Skip to content

Commit 4b8025a

Browse files
authored
chore(repo): Update rolldown and tsdown (#8207)
1 parent b9c484f commit 4b8025a

41 files changed

Lines changed: 653 additions & 460 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/clerk-js/sandbox/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PageMocking, type MockScenario } from '@clerk/msw';
2-
import * as l from '../../localizations';
2+
import * as l from '../../localizations/src';
33
import { dark, neobrutalism, shadcn, shadesOfPurple } from '../../ui/src/themes';
44
import type { Clerk as ClerkType } from '../';
55
import * as scenarios from './scenarios';

packages/expo/src/cache/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { TokenCache } from './types';
1+
export type { TokenCache } from './types';
22

33
export { MemoryTokenCache } from './MemoryTokenCache';
44
export { ClientResourceCache, EnvironmentResourceCache, SessionJWTCache } from './ResourceCache';

packages/react/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"default": "./dist/index.mjs"
3030
},
3131
"require": {
32-
"types": "./dist/index.d.ts",
33-
"default": "./dist/index.js"
32+
"types": "./dist/index.d.cts",
33+
"default": "./dist/index.cjs"
3434
}
3535
},
3636
"./internal": {
@@ -39,8 +39,8 @@
3939
"default": "./dist/internal.mjs"
4040
},
4141
"require": {
42-
"types": "./dist/internal.d.ts",
43-
"default": "./dist/internal.js"
42+
"types": "./dist/internal.d.cts",
43+
"default": "./dist/internal.cjs"
4444
}
4545
},
4646
"./errors": {
@@ -49,8 +49,8 @@
4949
"default": "./dist/errors.mjs"
5050
},
5151
"require": {
52-
"types": "./dist/errors.d.ts",
53-
"default": "./dist/errors.js"
52+
"types": "./dist/errors.d.cts",
53+
"default": "./dist/errors.cjs"
5454
}
5555
},
5656
"./experimental": {
@@ -59,8 +59,8 @@
5959
"default": "./dist/experimental.mjs"
6060
},
6161
"require": {
62-
"types": "./dist/experimental.d.ts",
63-
"default": "./dist/experimental.js"
62+
"types": "./dist/experimental.d.cts",
63+
"default": "./dist/experimental.cjs"
6464
}
6565
},
6666
"./legacy": {
@@ -69,21 +69,21 @@
6969
"default": "./dist/legacy.mjs"
7070
},
7171
"require": {
72-
"types": "./dist/legacy.d.ts",
73-
"default": "./dist/legacy.js"
72+
"types": "./dist/legacy.d.cts",
73+
"default": "./dist/legacy.cjs"
7474
}
7575
},
7676
"./types": {
7777
"import": {
7878
"types": "./dist/types.d.mts"
7979
},
8080
"require": {
81-
"types": "./dist/types.d.ts"
81+
"types": "./dist/types.d.cts"
8282
}
8383
},
8484
"./package.json": "./package.json"
8585
},
86-
"main": "./dist/index.js",
86+
"main": "./dist/index.cjs",
8787
"files": [
8888
"dist"
8989
],

packages/react/src/contexts/ClerkProvider.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { ClerkContextProvider } from '@clerk/shared/react';
2-
import type { Ui } from '@clerk/ui/internal';
32
import React from 'react';
43

54
import { multipleClerkProvidersError } from '../errors/messages';
65
import { IsomorphicClerk } from '../isomorphicClerk';
7-
import type { ClerkProviderProps, IsomorphicClerkOptions } from '../types';
6+
import type { ClerkProviderProps, IsomorphicClerkOptions, Ui } from '../types';
87
import { mergeWithEnv, withMaxAllowedInstancesGuard } from '../utils';
98
import { IS_REACT_SHARED_VARIANT_COMPATIBLE } from '../utils/versionCheck';
109

packages/react/src/contexts/__tests__/ClerkProvider.test.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ import { dark } from '@clerk/ui/themes';
1919
import { describe, expectTypeOf, it } from 'vitest';
2020

2121
import type { ClerkProvider } from '../ClerkProvider';
22+
import type { ClerkProviderProps as GenericClerkProviderProps, Ui } from '../../types';
2223

2324
type ClerkProviderProps = Parameters<typeof ClerkProvider>[0];
25+
type CustomAppearance = {
26+
options?: {
27+
customFlag?: boolean;
28+
};
29+
};
30+
const customUi = {} as Ui<CustomAppearance>;
2431

2532
describe('ClerkProvider', () => {
2633
describe('Type tests', () => {
@@ -85,6 +92,19 @@ describe('ClerkProvider', () => {
8592
// appearance: { elements: { nonExistentKey: '' } },
8693
// }).not.toMatchTypeOf<ClerkProviderProps>();
8794
});
95+
96+
it('is driven by the passed ui object type', () => {
97+
expectTypeOf({
98+
...defaultProps,
99+
ui: customUi,
100+
appearance: { options: { customFlag: true } },
101+
}).toMatchTypeOf<GenericClerkProviderProps<typeof customUi>>();
102+
103+
expectTypeOf({
104+
...defaultProps,
105+
appearance: { options: { customFlag: true } },
106+
}).not.toMatchTypeOf<ClerkProviderProps>();
107+
});
88108
});
89109

90110
describe('localization', () => {

packages/react/src/internal.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import type { InternalClerkScriptProps } from '@clerk/shared/types';
2-
import type { Ui } from '@clerk/ui/internal';
32
import type React from 'react';
43

54
import { ClerkProvider } from './contexts/ClerkProvider';
6-
import type { ClerkProviderProps } from './types';
5+
import type { ClerkProviderProps, Ui } from './types';
76

87
export { setErrorThrowerOptions } from './errors/errorThrower';
98
export { MultisessionAppSupport } from './components/controlComponents';
@@ -23,7 +22,7 @@ export {
2322
setClerkJsLoadingErrorPackageName,
2423
} from '@clerk/shared/loadClerkJsScript';
2524

26-
export type { Ui } from '@clerk/ui/internal';
25+
export type { Ui } from './types';
2726

2827
export type { InternalClerkScriptProps } from '@clerk/shared/types';
2928

packages/react/src/types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {
1010
TasksRedirectOptions,
1111
} from '@clerk/shared/types';
1212
import type { ClerkUIConstructor } from '@clerk/shared/ui';
13-
import type { Appearance, ExtractAppearanceType, Ui } from '@clerk/ui/internal';
13+
import type { Appearance, ExtractAppearanceType } from '@clerk/ui/internal';
1414
import type React from 'react';
1515

1616
// Re-export types from @clerk/shared that are used by other modules
@@ -34,6 +34,15 @@ declare global {
3434
}
3535
}
3636

37+
// This is a redeclaration of the Ui type from @clerk/ui/internal, which prevents TypeScript from complaining that
38+
// there is a type mismatch between the Ui type from @clerk/ui/internal and the bundled Ui type from @clerk/react.
39+
export interface Ui<A = any> {
40+
__brand?: '__clerkUI';
41+
ClerkUI?: ClerkUIConstructor | Promise<ClerkUIConstructor>;
42+
version?: string;
43+
__appearanceType?: A;
44+
}
45+
3746
/**
3847
* @interface
3948
*/

packages/react/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": ".",
43
"esModuleInterop": true,
54
"importHelpers": true,
65
"isolatedModules": true,
@@ -16,7 +15,8 @@
1615
"skipLibCheck": true,
1716
"sourceMap": false,
1817
"strict": true,
19-
"target": "ES2019"
18+
"target": "ES2019",
19+
"rootDir": "./src"
2020
},
2121
"include": ["src"]
2222
}

packages/react/tsconfig.test.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"baseUrl": "src",
54
"jsx": "react",
65
"noImplicitReturns": false,
76
"strict": false,

packages/react/tsdown.config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
22
import { fileURLToPath } from 'node:url';
33

44
import { parse as parseYaml } from 'yaml';
5-
import { defineConfig } from 'tsdown';
5+
import { defineConfig, type Options } from 'tsdown';
66

77
import clerkJsPkgJson from '../clerk-js/package.json' with { type: 'json' };
88
import pkgJson from './package.json' with { type: 'json' };
@@ -52,7 +52,7 @@ function getClerkUISupportedReactBounds(): VersionBounds[] {
5252
return bounds;
5353
}
5454

55-
export default defineConfig(overrideOptions => {
55+
export default defineConfig((overrideOptions: Options) => {
5656
const isWatch = !!overrideOptions.watch;
5757
const shouldPublish = !!overrideOptions.env?.publish;
5858
const clerkUISupportedReactBounds = getClerkUISupportedReactBounds();

0 commit comments

Comments
 (0)