-
Notifications
You must be signed in to change notification settings - Fork 431
feat(ui): enforce minimum clerk-js version compatibility #7667
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
base: main
Are you sure you want to change the base?
feat(ui): enforce minimum clerk-js version compatibility #7667
Conversation
Introduces a "shared" variant of @clerk/ui that externalizes React dependencies, allowing the host application's React to be reused instead of bundling a separate copy. Changes: - Add @clerk/ui/register module to register React on globalThis - Add ui.shared.browser.js build variant with externalized React - Add React version compatibility checking in @clerk/react - Add clerkUiVariant option to load the appropriate variant - Make dev server React externalization conditional via --env shared Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract version checking logic into testable utility (versionCheck.ts) - Add comprehensive unit tests for version parsing and bounds checking - Move version compatibility check to module level for better performance - Add dev warning when pnpm-workspace.yaml fallback is used - Add warning for React version mismatch in register modules - Remove redundant clerkUiVariant assignment in isomorphicClerk.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The new exports field in clerk-js/package.json blocked deep imports that expo and chrome-extension packages depended on. This adds: - ./internal/fapi export for FapiRequestInit/FapiResponse types (expo) - ./no-rhc export for the no-RHC variant (chrome-extension) Also updates expo to use the new clean import path. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename register/index.js to register/index.cjs to fix module syntax mismatch (package uses "type": "module" but file was CommonJS) - Add register/index.d.cts for CJS type declarations to fix "Masquerading as ESM" attw error - Update exports to point to correct file extensions - Run pnpm dedupe to clean up lockfile Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The new exports field introduces ESM entry points (.mjs) with CJS type declarations (.d.ts), which triggers attw's "Masquerading as CJS" warning. This is expected behavior for this package's build setup, so we ignore the false-cjs rule. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 74be850.
…rhc variant" This reverts commit 364059b.
Add required curly braces after if conditions in versionCheck.ts and fix import sorting in index.ts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Externalize react-dom/client in the shared variant and register it on globalThis.__clerkSharedModules so host apps can share it with @clerk/ui. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…pendencies - Remove hardcoded fallback version range in tsup.config.ts - Start from package.json peerDependencies.react to determine version range - If it's a catalog reference (catalog:XXX), resolve it from pnpm-workspace.yaml - If it's already a version range, parse it directly - Extract parseRangeToBounds to build-utils/ for testability - Add comprehensive tests for version range parsing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ClerkScripts component was not passing clerkUiVariant to clerkUiScriptUrl(), causing ui.browser.js to load instead of ui.shared.browser.js in Next.js apps. - Export IS_REACT_SHARED_VARIANT_COMPATIBLE from @clerk/react/internal - Use React version compatibility to determine default UI variant in Next.js - Pass clerkUiVariant to opts, allowing user override via provider props Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add `noExternal: ['@clerk/ui/register']` to tsup config to inline the registration code at build time instead of requiring it as a runtime dependency - Rename `clerkUiVariant` to `clerkUIVariant` for consistency This eliminates the runtime dependency on @clerk/ui for consumers of @clerk/react while still enabling the shared React variant. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rray Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move parseVersion, checkVersionAgainstBounds, isVersionCompatible, and VersionBounds type from @clerk/react to @clerk/shared/versionCheck for reuse across packages. The React package now imports from shared and re-exports for backwards compatibility, keeping only the React-specific computeReactVersionCompatibility and IS_REACT_SHARED_VARIANT_COMPATIBLE. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add runtime version check in ClerkUi constructor to detect incompatible @clerk/clerk-js versions. In development instances, logs a warning; in production, throws ClerkRuntimeError with actionable upgrade guidance. Also adds isVersionAtLeast utility to @clerk/shared/versionCheck.
f6578d0 to
682ea78
Compare
Add runtime version check in ClerkUi constructor to detect incompatible @clerk/clerk-js versions. In development instances, logs a warning; in production, throws ClerkRuntimeError with actionable upgrade guidance.
Also moves shared version utilities to @clerk/shared/utils.
Description
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change