Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c29586b
wip
nikosdouvlis Oct 17, 2025
15551ec
fix build
nikosdouvlis Oct 17, 2025
c98b464
fix build
nikosdouvlis Oct 17, 2025
083ef3d
fix build
nikosdouvlis Oct 17, 2025
31dd221
fix build
nikosdouvlis Oct 17, 2025
4e9cdf0
fix build and static analysis
nikosdouvlis Oct 17, 2025
73e31d0
dedupe lockfile
nikosdouvlis Oct 17, 2025
a5e40af
temporarily remove node 18 tests
nikosdouvlis Oct 17, 2025
053c07e
migrate clerkjs
nikosdouvlis Oct 17, 2025
5d75555
format
nikosdouvlis Oct 17, 2025
40c4118
dedupe lockfile
nikosdouvlis Oct 17, 2025
caf27cc
fix bundlewatch config
nikosdouvlis Oct 18, 2025
65cf7f6
dedupe lockfile
nikosdouvlis Oct 18, 2025
72d97d2
resolve lint errors
nikosdouvlis Oct 18, 2025
0c72edb
fix(repo): Pin React 18.3.1 in overrides to fix test failures
nikosdouvlis Oct 18, 2025
42fce5e
dedupe lockfile
nikosdouvlis Oct 18, 2025
99d20a4
fix node 22 tests
nikosdouvlis Oct 18, 2025
8b82759
drop node 18 tests
nikosdouvlis Oct 18, 2025
f00a0f0
delete unused files
nikosdouvlis Oct 19, 2025
3c50200
fix: remove trailing whitespace in file-structure.test.ts
nikosdouvlis Oct 19, 2025
b21da21
dedupe loclfile
nikosdouvlis Oct 20, 2025
20276ca
Merge branch 'main' into nikos/migrate-types-to-shared
nikosdouvlis Oct 20, 2025
55c4907
attempt to fix expo tests
nikosdouvlis Oct 20, 2025
955dce8
fix expo subpaths
nikosdouvlis Oct 20, 2025
27850c1
Merge branch 'main' into nikos/migrate-types-to-shared
nikosdouvlis Oct 29, 2025
a7f5d85
Merge branch 'main' into nikos/migrate-types-to-shared
nikosdouvlis Oct 29, 2025
9545b8e
dedupe
nikosdouvlis Oct 29, 2025
e32de45
migrate clerk-react to shared/types
nikosdouvlis Oct 29, 2025
bbc3738
format
nikosdouvlis Oct 29, 2025
4b299d5
Merge branch 'main' into nikos/migrate-types-to-shared
nikosdouvlis Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export default tseslint.config([
'packages/backend/src/runtime/**/*',
'packages/clerk-js/rspack.config.js',
'packages/shared/src/compiled/path-to-regexp/index.js',
'packages/shared/tsdown.config.mjs',
],
},
{
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@
"react": "catalog:react",
"react-dom": "catalog:react",
"rimraf": "6.0.1",
"rolldown": "catalog:repo",
"statuses": "^1.5.0",
"tree-kill": "^1.2.2",
"ts-jest": "29.2.5",
"tsdown": "catalog:repo",
Comment on lines +137 to +141
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the new build tooling is properly configured across all packages.

Two new build tools have been added as dev dependencies:

  • rolldown (line 138) - a Rust-based bundler
  • tsdown (line 142) - a TypeScript declaration bundler

Since this is part of the migration from tsup to tsdown/rolldown, ensure that:

  1. All packages using these tools have appropriate configuration files (e.g., tsdown.config.mts)
  2. Build scripts in individual packages are updated to use the new tooling
  3. The build pipeline works end-to-end with the new tools

Run the following to verify the build tooling setup:


🏁 Script executed:

#!/bin/bash
# Check for tsdown config files
echo "=== Checking for tsdown configuration files ==="
fd -t f "tsdown.config" packages/

# Check if tsup configs still exist (should be removed/replaced)
echo -e "\n=== Checking for remaining tsup configs (should be minimal) ==="
fd -t f "tsup.config" packages/

# Check package.json build scripts that reference the new tools
echo -e "\n=== Checking for build script references ==="
fd -t f "package.json" packages/ --exec grep -l "tsdown\|rolldown" {}

# Verify the new tools are in the catalog
echo -e "\n=== Checking pnpm workspace catalog ==="
cat pnpm-workspace.yaml | grep -A 2 "tsdown\|rolldown"

Length of output: 986


I need to verify if this partial migration is intentional and check the build scripts in packages that still use tsup.

Let me check the build scripts to see which tools are being used in the packages:

Let me examine the actual build scripts in the packages to understand the state better:


🏁 Script executed:

#!/bin/bash
# Check build scripts in shared package (already migrated)
echo "=== shared package.json build scripts ==="
cat packages/shared/package.json | grep -A 20 '"scripts"'

# Check one package still using tsup
echo -e "\n=== One example: agent-toolkit package.json build scripts ==="
cat packages/agent-toolkit/package.json | grep -A 20 '"scripts"'

# Count packages and their tooling
echo -e "\n=== Build tool references in package.json files ==="
echo "Packages with tsdown reference:"
fd -t f "package.json" packages/ --exec grep -l "tsdown" {} | wc -l

echo "Packages with tsup reference:"
fd -t f "package.json" packages/ --exec grep -l "tsup" {} | wc -l

echo "Packages with neither (might use rolldown directly):"
fd -t f "package.json" packages/ -not -exec grep -l "tsdown\|tsup\|rolldown" {} \; | wc -l

Length of output: 2357


Build tooling migration is incomplete—only 1 of ~20 packages has been migrated to tsdown.

The verification confirms the review comment's concern: the migration from tsup to tsdown/rolldown is not yet complete across all packages.

Current state:

  • 1 package migrated: packages/shared has tsdown.config.mts and uses tsdown in build scripts
  • 19 packages unmigrated: Still have tsup.config.ts files and tsup commands in build scripts (agent-toolkit, astro, backend, chrome-extension, elements, expo, expo-passkeys, express, fastify, localizations, nextjs, nuxt, react, react-router, remix, tanstack-react-start, testing, themes, vue)

Both tooling versions remain in the pnpm workspace catalog (tsup: 8.5.0, tsdown: 0.15.7, rolldown: 1.0.0-beta.43).

Either complete the migration across remaining packages or document why the partial migration is intentional.

🤖 Prompt for AI Agents
package.json lines 138-142: the repo shows only one package migrated to
tsdown/rolldown while ~19 still use tsup; either finish migration or document
the intentional partial state. To fix, either (A) complete migration across the
listed packages by converting each package's tsup.config.ts to tsdown (create
tsdown.config.mts where needed), update package.json build scripts to use
tsdown/rolldown commands, update the pnpm workspace catalog to remove/replace
tsup with the chosen tsdown/rolldown versions and ensure lockfile is refreshed,
and remove tsup entries from package.json; or (B) if partial migration is
intentional, add a top-level migration note in the repo (README or MIGRATION.md)
listing migrated packages, those pending, rationale, and an action
plan/timeline, and keep package.json entries consistent with that documentation.

"tsup": "catalog:repo",
"turbo": "^2.5.4",
"turbo-ignore": "^2.5.4",
Expand Down Expand Up @@ -165,9 +167,6 @@
"overrides": {
"jest": "29.7.0",
"jest-snapshot-prettier": "npm:prettier@^3.5.3"
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
}
}
3 changes: 2 additions & 1 deletion packages/astro/src/stores/external.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { deriveState } from '@clerk/shared/deriveState';
import { eventMethodCalled } from '@clerk/shared/telemetry';
import type { SignedInSessionResource } from '@clerk/types';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Leftover import from @clerk/types—migrate to @clerk/shared/types

This file still pulls SignedInSessionResource from @clerk/types. Switch to the shared path to align with the migration.

-import type { SignedInSessionResource } from '@clerk/types';
+import type { SignedInSessionResource } from '@clerk/shared/types';

🏁 Script executed:

#!/usr/bin/env bash
# Audit repo for lingering @clerk/types imports
rg -nP --type=ts --type=tsx --type=js --type=jsx -g '!**/node_modules/**' "\@clerk/types"

Length of output: 27



---

🏁 Script executed:

```shell
#!/bin/bash
# Audit repo for lingering @clerk/types imports with corrected syntax
rg -nP "@clerk/types" --type ts --type js -g '!**/node_modules/**'

Length of output: 68479


🏁 Script executed:

#!/bin/bash
# Verify the specific file mentioned in the review
cat packages/astro/src/stores/external.ts

Length of output: 5381


🏁 Script executed:

#!/bin/bash
# Check if @clerk/shared/types exists and what it exports
find . -path '*/node_modules' -prune -o -type f -name 'index.ts' -o -name 'types.ts' | grep -i "clerk/shared"

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Find the @clerk/shared package structure
find packages/shared -type f -name "*.ts" -o -name "*.tsx" | head -20

Length of output: 992


🏁 Script executed:

#!/bin/bash
# Check package.json exports for @clerk/shared
cat packages/shared/package.json 2>/dev/null | grep -A 20 '"exports"'

Length of output: 512


🏁 Script executed:

#!/bin/bash
# Search for SignedInSessionResource export in @clerk/shared
rg -n "SignedInSessionResource" packages/shared --type ts --type tsx

Length of output: 27


🏁 Script executed:

#!/bin/bash
# Search for SignedInSessionResource in packages/shared (corrected syntax)
rg -n "SignedInSessionResource" packages/shared --type ts

Length of output: 1544


🏁 Script executed:

#!/bin/bash
# Check packages/types to see where SignedInSessionResource is defined
rg -n "SignedInSessionResource" packages/types/src --type ts -A 2

Length of output: 0


🏁 Script executed:

#!/bin/bash
# List top-level source files in packages/shared
ls -la packages/shared/src/*.ts 2>/dev/null | head -30

Length of output: 2575


🏁 Script executed:

#!/bin/bash
# Check if packages/shared has a types.ts or similar
find packages/shared/src -maxdepth 1 -name "*types*" -o -name "*index*"

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Verify packages/types re-exports from @clerk/shared
cat packages/types/src/index.d.ts 2>/dev/null | head -30

Length of output: 313


🏁 Script executed:

#!/bin/bash
# Check if other astro files still use @clerk/types for comparison
rg -n "@clerk/types" packages/astro/src --type ts

Length of output: 1984


Migrate import to @clerk/shared/types for consistency with package deprecation

The review comment is correct. The packages/types package documentation explicitly states that "@clerk/types is now merged with @clerk/shared" and indicates "Please import from @clerk/shared/types instead." The SignedInSessionResource type is available from @clerk/shared/types, and this file already imports from @clerk/shared (lines 1–2), so the import should be migrated.

-import type { SignedInSessionResource } from '@clerk/types';
+import type { SignedInSessionResource } from '@clerk/shared/types';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type { SignedInSessionResource } from '@clerk/types';
import type { SignedInSessionResource } from '@clerk/shared/types';
🤖 Prompt for AI Agents
In packages/astro/src/stores/external.ts around line 3, the file imports
SignedInSessionResource from '@clerk/types' but the package has been merged and
types should be imported from '@clerk/shared/types'; update the import to pull
SignedInSessionResource from '@clerk/shared/types' (keeping any existing imports
from '@clerk/shared') and remove the '@clerk/types' import to maintain
consistency with the deprecation.

import { batched, computed, onMount, type Store } from 'nanostores';

import { $clerk, $csrState, $initialState } from './internal';
Expand Down Expand Up @@ -51,7 +52,7 @@ export const $userStore = computed([$authStore], auth => auth.user);
* @example
* $sessionStore.subscribe((session) => console.log(session.id))
*/
export const $sessionStore = computed([$authStore], auth => auth.session);
export const $sessionStore = computed([$authStore], auth => auth.session as SignedInSessionResource | null | undefined);

/**
* A client side store that is populated after clerk-js has loaded.
Expand Down
10 changes: 5 additions & 5 deletions packages/backend/src/util/shared.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export { addClerkPrefix, getScriptUrl, getClerkJsMajorVersionOrTag } from '@clerk/shared/url';
export { retry } from '@clerk/shared/retry';
export { deprecated, deprecatedProperty } from '@clerk/shared/deprecated';
export {
getCookieSuffix,
getSuffixedCookieName,
isDevelopmentFromSecretKey,
isProductionFromSecretKey,
parsePublishableKey,
getCookieSuffix,
getSuffixedCookieName,
} from '@clerk/shared/keys';
export { deprecated, deprecatedProperty } from '@clerk/shared/deprecated';
export { retry } from '@clerk/shared/retry';
export { addClerkPrefix, getClerkJsMajorVersionOrTag, getScriptUrl } from '@clerk/shared/url';

import { buildErrorThrower } from '@clerk/shared/error';
import { createDevOrStagingUrlCache } from '@clerk/shared/keys';
Expand Down
4 changes: 2 additions & 2 deletions packages/chrome-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"module": "nodenext",
"moduleResolution": "nodenext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
Expand Down
2 changes: 2 additions & 0 deletions packages/clerk-js/src/core/resources/BillingSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class BillingSubscription extends BaseResource implements BillingSubscrip

export class BillingSubscriptionItem extends BaseResource implements BillingSubscriptionItemResource {
id!: string;
paymentMethodId!: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify that paymentMethodId should be a required field.

The field is marked as required with the ! operator, which means it cannot be null or undefined. Please ensure that the backend always provides payment_method_id in the JSON response.

Run the following script to check if there are any existing tests or usage patterns that might expect this field to be optional:


🏁 Script executed:

#!/bin/bash
# Search for BillingSubscriptionItem usage and check if paymentMethodId is always present

echo "Checking for BillingSubscriptionItem usage patterns..."
rg -n -C3 "BillingSubscriptionItem" --type ts --type tsx -g '!**/dist/**' -g '!**/node_modules/**'

echo -e "\nChecking for payment_method_id in test fixtures or mocks..."
rg -n "payment_method_id" --type ts --type tsx --type json -g '!**/dist/**' -g '!**/node_modules/**'

Length of output: 171



🏁 Script executed:

#!/bin/bash
# Find and examine the BillingSubscription.ts file
echo "=== Finding BillingSubscription.ts ==="
fd -n "BillingSubscription.ts" --type f

# Look at the file content if it exists
echo -e "\n=== Content of BillingSubscription.ts ==="
find . -name "BillingSubscription.ts" -type f ! -path "*/node_modules/*" ! -path "*/dist/*" -exec cat {} \;

# Search for paymentMethodId usage more broadly
echo -e "\n=== Searching for paymentMethodId usage ==="
rg -n "paymentMethodId" -g '!**/dist/**' -g '!**/node_modules/**'

# Search for payment_method_id (snake_case) in all file types
echo -e "\n=== Searching for payment_method_id ==="
rg -n "payment_method_id" -g '!**/dist/**' -g '!**/node_modules/**'

Length of output: 5883


🏁 Script executed:

#!/bin/bash
# Find and examine the BillingSubscription.ts file
echo "=== Finding BillingSubscription.ts ==="
fd -n "BillingSubscription.ts" --type f

# Look at the file content if it exists
echo -e "\n=== Content of BillingSubscription.ts ==="
find . -name "BillingSubscription.ts" -type f ! -path "*/node_modules/*" ! -path "*/dist/*" -exec cat {} \;

# Search for paymentMethodId usage more broadly
echo -e "\n=== Searching for paymentMethodId usage ==="
rg -n "paymentMethodId" -g '!**/dist/**' -g '!**/node_modules/**'

# Search for payment_method_id (snake_case) in all file types
echo -e "\n=== Searching for payment_method_id ==="
rg -n "payment_method_id" -g '!**/dist/**' -g '!**/node_modules/**'

# Search for BillingSubscriptionItem definition
echo -e "\n=== Searching for BillingSubscriptionItem ==="
rg -n "BillingSubscriptionItem" -g '!**/dist/**' -g '!**/node_modules/**'

Length of output: 17657



🏁 Script executed:

#!/bin/bash
# Check the BillingSubscriptionItemJSON interface definition
echo "=== BillingSubscriptionItemJSON interface in packages/types/src/json.ts ==="
rg -n -A 30 "interface BillingSubscriptionItemJSON" packages/types/src/json.ts

echo -e "\n=== BillingSubscriptionItemJSON interface in packages/shared/src/types/json.ts ==="
rg -n -A 30 "interface BillingSubscriptionItemJSON" packages/shared/src/types/json.ts

# Check if there's any code path that could leave paymentMethodId undefined
echo -e "\n=== Check for optional handling or null checks on paymentMethodId ==="
rg -n -B2 -A2 "paymentMethodId\s*=" packages/clerk-js/src/core/resources/BillingSubscription.ts

Length of output: 3003



🏁 Script executed:

#!/bin/bash
# Get full BillingSubscriptionItemJSON interface from packages/types
echo "=== Full BillingSubscriptionItemJSON from packages/types/src/json.ts ==="
rg -n -A 50 "interface BillingSubscriptionItemJSON" packages/types/src/json.ts | head -60

# Check if there's any mention of payment_method_id in packages/types/src/json.ts
echo -e "\n=== Looking for payment_method_id in packages/types/src/json.ts ==="
rg -n "payment_method_id" packages/types/src/json.ts

# Check package resolution - what does @clerk/types point to
echo -e "\n=== Check @clerk/types resolution ==="
find . -name "package.json" -path "*/packages/types/*" ! -path "*/node_modules/*" -exec grep -l "@clerk/types\|clerk-js" {} \;

Length of output: 2364


Add missing payment_method_id field to BillingSubscriptionItemJSON interface in packages/types/src/json.ts.

The type definition is incomplete. While packages/shared/src/types/json.ts includes payment_method_id: string; in the BillingSubscriptionItemJSON interface at line 733, packages/types/src/json.ts is missing this required field. The implementation at packages/clerk-js/src/core/resources/BillingSubscription.ts line 90 assigns data.payment_method_id, but this field doesn't exist in the imported type definition, creating a type safety gap.

The field should be added to packages/types/src/json.ts after the credit property (around line 732):

payment_method_id: string;

This ensures consistency across type definitions and maintains type safety for the required field marked with ! at line 63 of BillingSubscription.ts.

🤖 Prompt for AI Agents
In packages/types/src/json.ts around line ~732, the BillingSubscriptionItemJSON
interface is missing the required payment_method_id field referenced in
packages/clerk-js/src/core/resources/BillingSubscription.ts (line 63) and used
elsewhere; add payment_method_id: string; immediately after the credit property
in that interface so the type matches packages/shared/src/types/json.ts and the
implementation that reads data.payment_method_id compiles with proper type
safety.

plan!: BillingPlan;
planPeriod!: BillingSubscriptionPlanPeriod;
status!: BillingSubscriptionStatus;
Expand All @@ -86,6 +87,7 @@ export class BillingSubscriptionItem extends BaseResource implements BillingSubs
}

this.id = data.id;
this.paymentMethodId = data.payment_method_id;
this.plan = new BillingPlan(data.plan);
this.planPeriod = data.plan_period;
this.status = data.status;
Expand Down
3 changes: 2 additions & 1 deletion packages/elements/src/react/hooks/use-password.hook.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useClerk } from '@clerk/shared/react';
import type { PasswordSettingsData, PasswordValidation } from '@clerk/shared/types';
import { noop } from '@clerk/shared/utils';
import type { PasswordSettingsData, PasswordValidation } from '@clerk/types';
import * as React from 'react';

import type { ErrorCodeOrTuple } from '../utils/generate-password-error-text';
Expand All @@ -21,6 +21,7 @@ type UsePasswordCallbacks = {

export const usePassword = (callbacks?: UsePasswordCallbacks) => {
const clerk = useClerk();
// @ts-expect-error - ignore error for now
const passwordSettings = clerk.__unstable__environment?.userSettings.passwordSettings as PasswordSettingsData;
const { disable_hibp, min_zxcvbn_strength, show_zxcvbn, ...config } = passwordSettings || {};

Expand Down
1 change: 1 addition & 0 deletions packages/elements/src/react/sign-in/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function SignInFlowProvider({ children, exampleMode, fallback, isRootPath }: Sig
const cb = () => {
const evt: SignInRouterInitEvent = {
type: 'INIT',
// @ts-expect-error - ignore error for now
clerk,
Comment on lines +44 to 45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Address type mismatch before merging.

The @ts-expect-error suppression indicates that the clerk property doesn't match the SignInRouterInitEvent type signature. This technical debt should be resolved before the PR is merged out of WIP status.

Consider either:

  1. Updating the SignInRouterInitEvent type definition to include the clerk property, or
  2. Removing the clerk property if it's not needed

To verify the current type definition:

#!/bin/bash
# Find the SignInRouterInitEvent type definition
ast-grep --pattern 'type SignInRouterInitEvent = {
  $$$
}'
🤖 Prompt for AI Agents
In packages/elements/src/react/sign-in/root.tsx around lines 44 to 45, the clerk
property is being passed despite a TypeScript mismatch (suppressed with
@ts-expect-error); resolve by either updating the SignInRouterInitEvent type to
include clerk (extend the interface/type with the correct clerk shape) or remove
the clerk property where it’s unused, and then remove the @ts-expect-error
comment; ensure any changes are mirrored in the type definition file found by
the project’s type declarations so the compiler no longer reports a mismatch.

exampleMode,
formRef,
Expand Down
1 change: 1 addition & 0 deletions packages/elements/src/react/sign-up/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function SignUpFlowProvider({ children, exampleMode, fallback, isRootPath }: Sig
const cb = () => {
const evt: SignUpRouterInitEvent = {
type: 'INIT',
// @ts-expect-error - ignore error for now
clerk,
Comment on lines +44 to 45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Address type mismatch before merging.

This has the same issue as packages/elements/src/react/sign-in/root.tsx (Lines 44-45). The @ts-expect-error suppression indicates a type mismatch that should be resolved before merging.

Update the SignUpRouterInitEvent type definition to properly include the clerk property:

#!/bin/bash
# Find the SignUpRouterInitEvent type definition
ast-grep --pattern 'type SignUpRouterInitEvent = {
  $$$
}'

exampleMode,
formRef,
Expand Down
64 changes: 32 additions & 32 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,75 +12,76 @@
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
"types": "./dist/runtime/index.d.mts",
"default": "./dist/runtime/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
"types": "./dist/runtime/index.d.ts",
"default": "./dist/runtime/index.js"
}
},
"./*": {
"import": {
"types": "./dist/*.d.mts",
"default": "./dist/*.mjs"
"types": "./dist/runtime/*.d.mts",
"default": "./dist/runtime/*.mjs"
},
"require": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
"types": "./dist/runtime/*.d.ts",
"default": "./dist/runtime/*.js"
}
},
"./react": {
"import": {
"types": "./dist/react/index.d.mts",
"default": "./dist/react/index.mjs"
"types": "./dist/runtime/react/index.d.mts",
"default": "./dist/runtime/react/index.mjs"
},
"require": {
"types": "./dist/react/index.d.ts",
"default": "./dist/react/index.js"
"types": "./dist/runtime/react/index.d.ts",
"default": "./dist/runtime/react/index.js"
}
},
"./utils": {
"import": {
"types": "./dist/utils/index.d.mts",
"default": "./dist/utils/index.mjs"
"types": "./dist/runtime/utils/index.d.mts",
"default": "./dist/runtime/utils/index.mjs"
},
"require": {
"types": "./dist/utils/index.d.ts",
"default": "./dist/utils/index.js"
"types": "./dist/runtime/utils/index.d.ts",
"default": "./dist/runtime/utils/index.js"
}
},
"./workerTimers": {
"import": {
"types": "./dist/workerTimers/index.d.mts",
"default": "./dist/workerTimers/index.mjs"
"types": "./dist/runtime/workerTimers/index.d.mts",
"default": "./dist/runtime/workerTimers/index.mjs"
},
"require": {
"types": "./dist/workerTimers/index.d.ts",
"default": "./dist/workerTimers/index.js"
"types": "./dist/runtime/workerTimers/index.d.ts",
"default": "./dist/runtime/workerTimers/index.js"
}
},
"./dom": {
"import": {
"types": "./dist/dom/index.d.mts",
"default": "./dist/dom/index.mjs"
"types": "./dist/runtime/dom/index.d.mts",
"default": "./dist/runtime/dom/index.mjs"
},
"require": {
"types": "./dist/dom/index.d.ts",
"default": "./dist/dom/index.js"
"types": "./dist/runtime/dom/index.d.ts",
"default": "./dist/runtime/dom/index.js"
}
},
"./types": {
"import": {
"types": "./dist/types/index.d.mts"
"types": "./dist/types/index.d.mts",
"default": "./dist/types/index.mjs"
},
"require": {
"types": "./dist/types/index.d.ts"
"types": "./dist/types/index.d.ts",
"default": "./dist/types/index.js"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"files": [
"dist",
"scripts",
Expand Down Expand Up @@ -135,11 +136,10 @@
"types"
],
"scripts": {
"build": "tsup",
"build": "tsdown",
"postbuild": "node ../../scripts/subpath-workaround.mjs shared",
"build:declarations": "tsc -p tsconfig.declarations.json",
"clean": "rimraf ./dist",
"dev": "tsup --watch",
"dev": "tsdown --watch src",
"dev:publish": "pnpm dev -- --env.publish",
"format": "node ../../scripts/format-package.mjs",
"format:check": "node ../../scripts/format-package.mjs --check",
Expand All @@ -153,7 +153,7 @@
"test:coverage": "vitest --collectCoverage && open coverage/lcov-report/index.html"
},
"dependencies": {
"@clerk/types": "workspace:^",
"csstype": "3.1.3",
"dequal": "2.0.3",
"glob-to-regexp": "0.4.1",
"js-cookie": "3.0.5",
Expand All @@ -166,7 +166,7 @@
"@types/glob-to-regexp": "0.4.4",
"@types/js-cookie": "3.0.6",
"cross-fetch": "^4.1.0",
"esbuild": "0.25.0"
"rolldown": "catalog:repo"
},
"peerDependencies": {
"react": "catalog:peer-react",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/__tests__/color.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Color } from '@clerk/types';
import { describe, expect, it } from 'vitest';

import { colorToSameTypeString, hexStringToRgbaColor, stringToHslaColor, stringToSameTypeColor } from '../color';
import type { Color } from '../types';

describe('stringToHslaColor(color)', function () {
const hsla = { h: 195, s: 1, l: 0.5 };
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/__tests__/color.test.ts.bak
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Color } from '@clerk/types';
import type { Color } from '../types';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Remove backup file from version control.

This .bak file should not be committed. Backup files typically indicate temporary copies during development and should be excluded via .gitignore or removed before committing.

Consider removing this file:


🏁 Script executed:

#!/bin/bash
# Check if there's a non-backup version of this test file
fd -t f "color.test.ts$" packages/shared/src/__tests__/

# Check for other .bak files that might need cleanup
fd -e bak . packages/

Length of output: 47


Remove the orphaned .bak file; test file structure is incomplete.

The file packages/shared/src/__tests__/color.test.ts.bak exists without a corresponding color.test.ts. Backup files should not be committed to version control. Either restore the original test file as color.test.ts (removing the .bak suffix) or delete the .bak file entirely if the test is no longer needed. Clarify which was intended and ensure the test suite structure remains consistent.

🤖 Prompt for AI Agents
In packages/shared/src/__tests__/color.test.ts.bak around lines 1 to 1, there is
an orphaned backup test file that breaks the test suite structure; either
restore it as the real test or remove it. If the test should exist, rename the
file to color.test.ts and ensure its imports/exports and test contents are
correct; if the test is obsolete, delete this .bak file and remove any
references to it in CI/test configs. Commit the appropriate change so only the
intended test file remains under __tests__.


import { colorToSameTypeString, hexStringToRgbaColor, stringToHslaColor, stringToSameTypeColor } from '../color';

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/__tests__/deriveState.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { InitialState, Resources } from '@clerk/types';
import { describe, expect, it } from 'vitest';

import { deriveState } from '../deriveState';
import type { InitialState, Resources } from '../types';

describe('deriveState', () => {
const mockInitialState = {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/__tests__/loadClerkJsScript.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('loadClerkJsScript(options)', () => {

try {
await loadPromise;
fail('Should have thrown error');
throw new Error('Should have thrown error');
} catch (error) {
expect(error).toBeInstanceOf(ClerkRuntimeError);
expect((error as Error).message).toContain('Clerk: Failed to load Clerk');
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/__tests__/organization.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { OrganizationMembershipResource } from '@clerk/types';
import { describe, expect, it } from 'vitest';
import type { OrganizationMembershipResource } from '../types';

import { getCurrentOrganizationMembership } from '../organization';

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/alternativePhoneCode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PhoneCodeChannelData } from '@clerk/types';
import type { PhoneCodeChannelData } from './types';

export const ALTERNATIVE_PHONE_CODE_PROVIDERS: PhoneCodeChannelData[] = [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/authorization-errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReverificationConfig } from '@clerk/types';
import type { ReverificationConfig } from './types';

type ClerkError<T> = {
clerk_error: T;
Expand Down Expand Up @@ -44,4 +44,4 @@ const isReverificationHint = (result: any): result is ReturnType<typeof reverifi
);
};

export { reverificationError, reverificationErrorResponse, isReverificationHint };
export { isReverificationHint, reverificationError, reverificationErrorResponse };
4 changes: 2 additions & 2 deletions packages/shared/src/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
SessionVerificationTypes,
SignOut,
UseAuthReturn,
} from '@clerk/types';
} from './types';

type TypesToConfig = Record<SessionVerificationTypes, Exclude<ReverificationConfig, SessionVerificationTypes>>;
type AuthorizationOptions = {
Expand Down Expand Up @@ -341,4 +341,4 @@ const resolveAuthState = ({
}
};

export { createCheckAuthorization, validateReverificationConfig, resolveAuthState, splitByScope };
export { createCheckAuthorization, resolveAuthState, splitByScope, validateReverificationConfig };
2 changes: 1 addition & 1 deletion packages/shared/src/clerkEventBus.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ClerkEventPayload } from '@clerk/types';
import type { ClerkEventPayload } from './types';

import { createEventBus } from './eventBus';

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/color.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Color, HslaColor, RgbaColor, TransparentColor } from '@clerk/types';
import type { Color, HslaColor, RgbaColor, TransparentColor } from './types';

const IS_HEX_COLOR_REGEX = /^#?([A-F0-9]{6}|[A-F0-9]{3})$/i;

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/deriveState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
Resources,
SignedInSessionResource,
UserResource,
} from '@clerk/types';
} from './types';

/**
* Derives authentication state based on the current rendering context (SSR or client-side).
Expand Down
3 changes: 1 addition & 2 deletions packages/shared/src/errors/clerkApiError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ClerkAPIError as ClerkAPIErrorInterface, ClerkAPIErrorJSON } from '@clerk/types';

import type { ClerkAPIError as ClerkAPIErrorInterface, ClerkAPIErrorJSON } from '../types';
import { createErrorTypeGuard } from './createErrorTypeGuard';

export type ClerkApiErrorMeta = Record<string, unknown>;
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/errors/clerkApiResponseError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ClerkAPIErrorJSON, ClerkAPIResponseError as ClerkAPIResponseErrorInterface } from '@clerk/types';
import type { ClerkAPIErrorJSON, ClerkAPIResponseError as ClerkAPIResponseErrorInterface } from '../types';

import { ClerkAPIError } from './clerkApiError';
import type { ClerkErrorParams } from './clerkError';
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/errors/parseError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ClerkAPIError as ClerkAPIErrorInterface, ClerkAPIErrorJSON } from '@clerk/types';
import type { ClerkAPIError as ClerkAPIErrorInterface, ClerkAPIErrorJSON } from '../types';

import { ClerkAPIError } from './clerkApiError';

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/jwtPayloadParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
OrganizationCustomPermissionKey,
OrganizationCustomRoleKey,
SharedSignedInAuthObjectProperties,
} from '@clerk/types';
} from './types';

import { splitByScope } from './authorization';

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/keys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PublishableKey } from '@clerk/types';
import type { PublishableKey } from './types';

import { DEV_OR_STAGING_SUFFIXES, LEGACY_DEV_INSTANCE_SUFFIXES } from './constants';
import { isomorphicAtob } from './isomorphicAtob';
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/loadClerkJsScript.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ClerkOptions, SDKMetadata, Without } from '@clerk/types';
import type { ClerkOptions, SDKMetadata, Without } from './types';

import { buildErrorThrower, ClerkRuntimeError } from './error';
import { createDevOrStagingUrlCache, parsePublishableKey } from './keys';
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/oauth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { OAuthProvider, OAuthProviderData, OAuthStrategy } from '@clerk/types';
import type { OAuthProvider, OAuthProviderData, OAuthStrategy } from './types';

export const OAUTH_PROVIDERS: OAuthProviderData[] = [
{
Expand Down
Loading
Loading