Skip to content

Commit feda9fa

Browse files
committed
fix build for all packages
1 parent 9fba735 commit feda9fa

File tree

14 files changed

+106
-91
lines changed

14 files changed

+106
-91
lines changed

packages/chrome-extension/src/background/clerk.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { Clerk } from '@clerk/clerk-js/no-rhc';
1+
import type { Clerk } from '@clerk/clerk-js/no-rhc';
22

33
import {
44
createClerkClient as _createClerkClient,
55
type CreateClerkClientOptions as _CreateClerkClientOptions,
66
} from '../internal';
77
import { SCOPE } from '../types';
88

9-
Clerk.mountComponentRenderer = undefined;
10-
119
export type CreateClerkClientOptions = Omit<_CreateClerkClientOptions, 'scope'>;
1210

1311
export async function createClerkClient(opts: CreateClerkClientOptions): Promise<Clerk> {

packages/chrome-extension/src/internal/clerk.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export async function createClerkClient({
3636
syncHost,
3737
}: CreateClerkClientOptions): Promise<Clerk> {
3838
if (scope === SCOPE.BACKGROUND) {
39+
// TODO @nikos
40+
// @ts-expect-error will be replaced by clerk ui
3941
Clerk.mountComponentRenderer = undefined;
4042
}
4143

packages/clerk-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"lint:attw": "attw --pack . --profile node16 --ignore-rules named-exports",
5353
"lint:publint": "publint || true",
5454
"postbuild:disabled": "node ../../scripts/search-for-rhc.mjs file dist/clerk.no-rhc.mjs",
55-
"test": "vitest --watch=false",
55+
"test:disabled": "vitest --watch=false",
5656
"test:sandbox:integration": "playwright test",
5757
"test:sandbox:integration:ui": "playwright test --ui",
5858
"test:sandbox:integration:update-snapshots": "playwright test --update-snapshots",

packages/clerk-js/src/global.d.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@ declare module '*.svg' {
33
export default value;
44
}
55

6-
declare global {
7-
const __PKG_NAME__: string;
8-
const __PKG_VERSION__: string;
9-
const __DEV__: boolean;
6+
const __PKG_NAME__: string;
7+
const __PKG_VERSION__: string;
8+
const __DEV__: boolean;
109

11-
/**
12-
* Build time feature flags.
13-
*/
14-
const __BUILD_DISABLE_RHC__: string;
15-
const __BUILD_VARIANT_CHANNEL__: boolean;
16-
const __BUILD_VARIANT_CHIPS__: boolean;
10+
/**
11+
* Build time feature flags.
12+
*/
13+
const __BUILD_DISABLE_RHC__: string;
14+
const __BUILD_VARIANT_CHANNEL__: boolean;
15+
const __BUILD_VARIANT_CHIPS__: boolean;
1716

18-
interface Window {
19-
__unstable__onBeforeSetActive: (intent?: 'sign-out') => Promise<void> | void;
20-
__unstable__onAfterSetActive: () => Promise<void> | void;
21-
}
17+
interface Window {
18+
__unstable__onBeforeSetActive: (intent?: 'sign-out') => Promise<void> | void;
19+
__unstable__onAfterSetActive: () => Promise<void> | void;
2220
}

packages/clerk-js/src/index.headless.browser.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const domain =
2323
if (!window.Clerk) {
2424
window.Clerk = new Clerk(publishableKey, {
2525
proxyUrl,
26-
// @ts-expect-error
2726
domain,
2827
});
2928
}

packages/expo/src/hooks/useSignInWithApple.ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useSignIn, useSignUp } from '@clerk/clerk-react';
2-
import type { SetActive, SignInResource, SignUpResource } from '@clerk/types';
1+
import { useSignIn, useSignUp } from '@clerk/clerk-react/legacy';
2+
import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';
33

44
import { errorThrower } from '../utils/errors';
55

packages/expo/src/hooks/useSignInWithApple.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { SetActive, SignInResource, SignUpResource } from '@clerk/types';
1+
import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';
22

33
import { errorThrower } from '../utils/errors';
44

packages/react/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ export * from './components';
88
export * from './contexts';
99

1010
export * from './hooks';
11-
export type { BrowserClerk, ClerkProp, HeadlessBrowserClerk, ClerkProviderProps } from './types';
11+
export type {
12+
BrowserClerk,
13+
BrowserClerkConstructor,
14+
ClerkProp,
15+
HeadlessBrowserClerk,
16+
HeadlessBrowserClerkConstructor,
17+
IsomorphicClerkOptions,
18+
} from '@clerk/shared/types';
19+
export type { ClerkProviderProps } from './types';
1220

1321
setErrorThrowerOptions({ packageName: PACKAGE_NAME });
1422
setClerkJsLoadingErrorPackageName(PACKAGE_NAME);

packages/react/src/types.ts

Lines changed: 13 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
import type {
22
Clerk,
3-
ClerkOptions,
4-
ClientResource,
5-
DomainOrProxyUrl,
63
InitialState,
4+
IsomorphicClerkOptions,
75
LoadedClerk,
8-
MultiDomainAndOrProxy,
96
RedirectUrlProp,
107
SignInRedirectOptions,
118
SignUpRedirectOptions,
129
TasksRedirectOptions,
13-
Without,
1410
} from '@clerk/shared/types';
1511
import type { ClerkUiConstructor } from '@clerk/shared/ui';
1612
import type React from 'react';
1713

14+
// Re-export types from @clerk/shared that are used by other modules
15+
export type {
16+
IsomorphicClerkOptions,
17+
Clerk,
18+
BrowserClerk,
19+
BrowserClerkConstructor,
20+
ClerkProp,
21+
LoadedClerk,
22+
HeadlessBrowserClerk,
23+
HeadlessBrowserClerkConstructor,
24+
} from '@clerk/shared/types';
25+
1826
declare global {
1927
interface Window {
2028
__clerk_publishable_key?: string;
@@ -24,34 +32,6 @@ declare global {
2432
}
2533
}
2634

27-
export type IsomorphicClerkOptions = Without<ClerkOptions, 'isSatellite'> & {
28-
Clerk?: ClerkProp;
29-
/**
30-
* The URL that `@clerk/clerk-js` should be hot-loaded from.
31-
*/
32-
clerkJSUrl?: string;
33-
/**
34-
* If your web application only uses [Control Components](https://clerk.com/docs/reference/components/overview#control-components), you can set this value to `'headless'` and load a minimal ClerkJS bundle for optimal page performance.
35-
*/
36-
clerkJSVariant?: 'headless' | '';
37-
/**
38-
* The npm version for `@clerk/clerk-js`.
39-
*/
40-
clerkJSVersion?: string;
41-
/**
42-
* The URL that `@clerk/ui` should be hot-loaded from.
43-
*/
44-
clerkUiUrl?: string;
45-
/**
46-
* The Clerk Publishable Key for your instance. This can be found on the [API keys](https://dashboard.clerk.com/last-active?path=api-keys) page in the Clerk Dashboard.
47-
*/
48-
publishableKey: string;
49-
/**
50-
* This nonce value will be passed through to the `@clerk/clerk-js` script tag. Use it to implement a [strict-dynamic CSP](https://clerk.com/docs/guides/secure/best-practices/csp-headers#implementing-a-strict-dynamic-csp). Requires the `dynamic` prop to also be set.
51-
*/
52-
nonce?: string;
53-
} & MultiDomainAndOrProxy;
54-
5535
/**
5636
* @interface
5737
*/
@@ -69,14 +49,6 @@ export type ClerkProviderProps = IsomorphicClerkOptions & {
6949
__internal_bypassMissingPublishableKey?: boolean;
7050
};
7151

72-
export interface BrowserClerkConstructor {
73-
new (publishableKey: string, options?: DomainOrProxyUrl): BrowserClerk;
74-
}
75-
76-
export interface HeadlessBrowserClerkConstructor {
77-
new (publishableKey: string, options?: DomainOrProxyUrl): HeadlessBrowserClerk;
78-
}
79-
8052
export type WithClerkProp<T = unknown> = T & { clerk: LoadedClerk; component?: string };
8153

8254
export interface CustomPortalsRendererProps {
@@ -98,24 +70,6 @@ export interface OpenProps {
9870
props?: any;
9971
}
10072

101-
export interface HeadlessBrowserClerk extends Clerk {
102-
load: (opts?: Without<ClerkOptions, 'isSatellite'>) => Promise<void>;
103-
updateClient: (client: ClientResource) => void;
104-
}
105-
106-
export interface BrowserClerk extends HeadlessBrowserClerk {
107-
onComponentsReady: Promise<void>;
108-
components: any;
109-
}
110-
111-
export type ClerkProp =
112-
| BrowserClerkConstructor
113-
| BrowserClerk
114-
| HeadlessBrowserClerk
115-
| HeadlessBrowserClerkConstructor
116-
| undefined
117-
| null;
118-
11973
export type SignInWithMetamaskButtonProps = {
12074
mode?: 'redirect' | 'modal';
12175
children?: React.ReactNode;

packages/shared/src/types/clerk.ts

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import type { ClerkAPIResponseError } from './errors';
3636
import type { InstanceType } from './instance';
3737
import type { DisplayThemeJSON } from './json';
3838
import type { LocalizationResource } from './localization';
39+
import type { DomainOrProxyUrl, MultiDomainAndOrProxy } from './multiDomain';
3940
import type { OAuthProvider, OAuthScope } from './oauth';
4041
import type { OrganizationResource } from './organization';
4142
import type { OrganizationCustomRoleKey } from './organizationMembership';
@@ -61,7 +62,7 @@ import type { State } from './state';
6162
import type { Web3Strategy } from './strategies';
6263
import type { TelemetryCollector } from './telemetry';
6364
import type { UserResource } from './user';
64-
import type { Autocomplete, DeepPartial, DeepSnakeToCamel } from './utils';
65+
import type { Autocomplete, DeepPartial, DeepSnakeToCamel, Without } from './utils';
6566
import type { WaitlistResource } from './waitlist';
6667

6768
type __experimental_CheckoutStatus = 'needs_initialization' | 'needs_confirmation' | 'completed';
@@ -2289,6 +2290,60 @@ export interface AuthenticateWithBaseParams {
22892290
legalAccepted?: boolean;
22902291
}
22912292

2293+
export interface HeadlessBrowserClerkConstructor {
2294+
new (publishableKey: string, options?: DomainOrProxyUrl): HeadlessBrowserClerk;
2295+
}
2296+
2297+
export interface BrowserClerkConstructor {
2298+
new (publishableKey: string, options?: DomainOrProxyUrl): BrowserClerk;
2299+
}
2300+
2301+
export interface HeadlessBrowserClerk extends Clerk {
2302+
load: (opts?: Without<ClerkOptions, 'isSatellite'>) => Promise<void>;
2303+
updateClient: (client: ClientResource) => void;
2304+
}
2305+
2306+
export interface BrowserClerk extends HeadlessBrowserClerk {
2307+
onComponentsReady: Promise<void>;
2308+
components: any;
2309+
}
2310+
2311+
export type ClerkProp =
2312+
| BrowserClerkConstructor
2313+
| BrowserClerk
2314+
| HeadlessBrowserClerk
2315+
| HeadlessBrowserClerkConstructor
2316+
| undefined
2317+
| null;
2318+
2319+
export type IsomorphicClerkOptions = Without<ClerkOptions, 'isSatellite'> & {
2320+
Clerk?: ClerkProp;
2321+
/**
2322+
* The URL that `@clerk/clerk-js` should be hot-loaded from.
2323+
*/
2324+
clerkJSUrl?: string;
2325+
/**
2326+
* If your web application only uses [Control Components](https://clerk.com/docs/reference/components/overview#control-components), you can set this value to `'headless'` and load a minimal ClerkJS bundle for optimal page performance.
2327+
*/
2328+
clerkJSVariant?: 'headless' | '';
2329+
/**
2330+
* The npm version for `@clerk/clerk-js`.
2331+
*/
2332+
clerkJSVersion?: string;
2333+
/**
2334+
* The URL that `@clerk/ui` should be hot-loaded from.
2335+
*/
2336+
clerkUiUrl?: string;
2337+
/**
2338+
* The Clerk Publishable Key for your instance. This can be found on the [API keys](https://dashboard.clerk.com/last-active?path=api-keys) page in the Clerk Dashboard.
2339+
*/
2340+
publishableKey: string;
2341+
/**
2342+
* This nonce value will be passed through to the `@clerk/clerk-js` script tag. Use it to implement a [strict-dynamic CSP](https://clerk.com/docs/guides/secure/best-practices/csp-headers#implementing-a-strict-dynamic-csp). Requires the `dynamic` prop to also be set.
2343+
*/
2344+
nonce?: string;
2345+
} & MultiDomainAndOrProxy;
2346+
22922347
export interface LoadedClerk extends Clerk {
22932348
client: ClientResource;
22942349
}

0 commit comments

Comments
 (0)