-
Notifications
You must be signed in to change notification settings - Fork 427
feat(clerk-js): remove headless variant #7629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jacekradko
wants to merge
36
commits into
main
Choose a base branch
from
jrad/remove-headless-variant
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+364
−298
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
2e52e40
feat(nextjs): skip clerk-ui script injection for headless variant
nikosdouvlis 6ab9de3
feat(astro): skip clerk-ui script injection for headless variant
nikosdouvlis 9a82f92
feat(react): skip clerk-ui loading for headless variant
nikosdouvlis d5f819a
feat(vue): skip clerk-ui loading for headless variant
nikosdouvlis a2e16cd
test(e2e): add headless variant test for nextjs
nikosdouvlis 9d3bbe6
Merge branch 'main' into nikos/dont-load-clerk-ui-if-headless-is-used
nikosdouvlis f643280
dedupe
nikosdouvlis 320bdde
feat(clerk-js): remove headless variant, use react-native export cond…
jacekradko 92fe11c
Merge branch 'nikos/dont-load-clerk-ui-if-headless-is-used' of github…
jacekradko bb62787
fix: un-deprecate clerkJSVariant, update docs
jacekradko bc48c7e
feat: rename clerkJSVariant to ui prop for controlling UI script loading
jacekradko 84c2552
Merge branch 'main' into jrad/remove-headless-variant
jacekradko 1ca99cb
fix: update integration templates and tests to use ui prop
jacekradko eee7409
fix: update expo and chrome-extension for headless removal
jacekradko b85a057
fix: restore /no-rhc export for chrome-extension CSP compliance
jacekradko f3a8681
fix: add false-cjs to attw ignore rules for exports field
jacekradko a608376
feat: rename ui prop to prefetchUI for disabling UI bundle prefetching
jacekradko 7c3fb9a
fix: update nuxt and tanstack-react-start for prefetchUI rename
jacekradko ff90124
format
jacekradko a0068a4
fix: update ClerkProvider type tests for prefetchUI prop rename
jacekradko 40b99fd
fix: align env schema variable name with usage (PUBLIC_CLERK_PREFETCH…
jacekradko b28c7be
Merge branch 'main' into jrad/remove-headless-variant
jacekradko e67dfa5
fix: add shouldPrefetchClerkUi to mock in isomorphicClerk test
jacekradko 7bb210f
Merge branch 'main' into jrad/remove-headless-variant
jacekradko 06ca9e7
chore(clerk-js): remove obsolete headless test
jacekradko 4120be2
chore(clerk-js): remove headless references from config files
jacekradko 54ac826
wip
jacekradko a1416d6
fix: restore clerkUiUrl env support for integration tests
jacekradko cda44df
fix: restore clerkUiUrl in public types
jacekradko 60e5732
chore: rename headless-variant test to prefetch-ui
jacekradko 3ef7871
fix: update nextjs type tests for new prefetchUI API
jacekradko 11e3189
fix: pass clerkUiUrl to ClerkScripts opts
jacekradko 192a776
fix: pass clerkUiUrl through astro and react-router
jacekradko 16453c1
fix: rename clerkUiUrl to clerkUIUrl for consistency with clerkJSUrl
jacekradko 1719aea
fix: rename clerkUiUrl to clerkUIUrl in integration templates
jacekradko 05b569c
Merge branch 'main' into jrad/remove-headless-variant
jacekradko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| --- | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
|
|
||
| import type { Application } from '../models/application'; | ||
| import { appConfigs } from '../presets'; | ||
|
|
||
| test.describe('prefetchUI disabled @nextjs', () => { | ||
| test.describe.configure({ mode: 'serial' }); | ||
| let app: Application; | ||
|
|
||
| test.beforeAll(async () => { | ||
| app = await appConfigs.next.appRouter.clone().commit(); | ||
| await app.setup(); | ||
| // Use withEmailCodes but disable the UI prefetching | ||
| const env = appConfigs.envs.withEmailCodes.clone().setEnvVariable('public', 'CLERK_PREFETCH_UI_DISABLED', 'true'); | ||
| await app.withEnv(env); | ||
| await app.dev(); | ||
| }); | ||
|
|
||
| test.afterAll(async () => { | ||
| await app.teardown(); | ||
| }); | ||
|
|
||
| test('does not inject clerk-ui script when prefetchUI is disabled', async ({ page }) => { | ||
| await page.goto(app.serverUrl); | ||
|
|
||
| // Wait for clerk-js script to be present (ensures page has loaded) | ||
| await expect(page.locator('script[data-clerk-js-script]')).toBeAttached(); | ||
|
|
||
| // clerk-ui script should NOT be present | ||
| await expect(page.locator('script[data-clerk-ui-script]')).not.toBeAttached(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,57 @@ | ||
| import { clerkJsScriptUrl, clerkUiScriptUrl } from '@clerk/shared/loadClerkJsScript'; | ||
| import { clerkJsScriptUrl, clerkUiScriptUrl, shouldPrefetchClerkUi } from '@clerk/shared/loadClerkJsScript'; | ||
| import type { APIContext } from 'astro'; | ||
|
|
||
| import { getSafeEnv } from './get-safe-env'; | ||
|
|
||
| function buildClerkHotloadScript(locals: APIContext['locals']) { | ||
| const env = getSafeEnv(locals); | ||
| // eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
| const publishableKey = getSafeEnv(locals).pk!; | ||
| const publishableKey = env.pk!; | ||
| // eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
| const proxyUrl = getSafeEnv(locals).proxyUrl!; | ||
| const proxyUrl = env.proxyUrl!; | ||
| // eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
| const domain = getSafeEnv(locals).domain!; | ||
| const domain = env.domain!; | ||
|
|
||
| const clerkJsScriptSrc = clerkJsScriptUrl({ | ||
| clerkJSUrl: getSafeEnv(locals).clerkJsUrl, | ||
| clerkJSVariant: getSafeEnv(locals).clerkJsVariant, | ||
| clerkJSVersion: getSafeEnv(locals).clerkJsVersion, | ||
| domain, | ||
| proxyUrl, | ||
| publishableKey, | ||
| }); | ||
| const clerkUiScriptSrc = clerkUiScriptUrl({ | ||
| clerkUiUrl: getSafeEnv(locals).clerkUiUrl, | ||
| clerkJSUrl: env.clerkJsUrl, | ||
| clerkJSVersion: env.clerkJsVersion, | ||
| domain, | ||
| proxyUrl, | ||
| publishableKey, | ||
| }); | ||
| return ` | ||
|
|
||
| const clerkJsScript = ` | ||
| <script src="${clerkJsScriptSrc}" | ||
| data-clerk-js-script | ||
| async | ||
| crossOrigin='anonymous' | ||
| ${publishableKey ? `data-clerk-publishable-key="${publishableKey}"` : ``} | ||
| ${proxyUrl ? `data-clerk-proxy-url="${proxyUrl}"` : ``} | ||
| ${domain ? `data-clerk-domain="${domain}"` : ``} | ||
| ></script> | ||
| ></script>`; | ||
|
|
||
| if (!shouldPrefetchClerkUi(env.prefetchUI)) { | ||
| return clerkJsScript + '\n'; | ||
| } | ||
|
|
||
| const clerkUiScriptSrc = clerkUiScriptUrl({ | ||
| clerkUIUrl: env.clerkUIUrl, | ||
| domain, | ||
| proxyUrl, | ||
| publishableKey, | ||
| }); | ||
|
|
||
| const clerkUiScript = ` | ||
| <script src="${clerkUiScriptSrc}" | ||
| data-clerk-ui-script | ||
| async | ||
| crossOrigin='anonymous' | ||
| ${publishableKey ? `data-clerk-publishable-key="${publishableKey}"` : ``} | ||
| ${proxyUrl ? `data-clerk-proxy-url="${proxyUrl}"` : ``} | ||
| ${domain ? `data-clerk-domain="${domain}"` : ``} | ||
| ></script>\n`; | ||
| ></script>`; | ||
|
|
||
| return clerkJsScript + clerkUiScript + '\n'; | ||
| } | ||
|
|
||
| export { buildClerkHotloadScript }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty changeset file - missing package entries and description.
This changeset is empty but the PR introduces breaking changes (removal of
clerkJSVariant,@clerk/clerk-js/headlessimport path, newuiprop). The changeset should document affected packages and their semver bumps.🤖 Prompt for AI Agents