You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update tsdown and rolldown to their latest versions. This surfaced several issues with our type system, which have been resolved in this PR:
We're now only building one type tree for @clerk/shared, using tsc instead of bundling types with tsdown. This prevents issues where the same type was pulled from dist/types and dist/runtime.
To support emitting types with tsc, the @/ path alias was removed in favor of relative imports. We can explore using "imports" in package.json in a future PR if we know that every runtime @clerk/shared supports has support for that.
Fixed an issue with CJS type resolution in @clerk/react by pointing the "require""types" field to the emitted CJS type bundle (which has been updated to simply re-export the exports of the ESM version)
Marked @clerk/ui/internal as an external in the tsdown config for @clerk/react, which prevents it from being bundled in. Now, all use of the type resolves to @clerk/ui, preventing issues where there's two versions of the same type.
Updates turbo.json to factor in tsdown.config.mts into whether or not to invalidate the cache.
Checklist
pnpm test runs as expected.
pnpm build runs as expected.
(If applicable) JSDoc comments have been added or updated for any package exports
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
The reason will be displayed to describe this comment to others. Learn more.
I do think it's somewhat strange that tsdown emits both mts and cts files. I would have thought that the CJS files would be js since the package doesn't have "type": "module". After looking into the config for tsdown it does appear that this is to be expected though. When you emit a cjs bundle, tsdown defaults platform to "node", which forces the fixedExtensions config to be true. So it does seem like this is intentional for dual ESM+CJS packages.
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
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.
Description
Update tsdown and rolldown to their latest versions. This surfaced several issues with our type system, which have been resolved in this PR:
@clerk/shared, usingtscinstead of bundling types withtsdown. This prevents issues where the same type was pulled fromdist/typesanddist/runtime.tsc, the@/path alias was removed in favor of relative imports. We can explore using"imports"inpackage.jsonin a future PR if we know that every runtime@clerk/sharedsupports has support for that.@clerk/reactby pointing the"require""types"field to the emitted CJS type bundle (which has been updated to simply re-export the exports of the ESM version)@clerk/ui/internalas anexternalin the tsdown config for@clerk/react, which prevents it from being bundled in. Now, all use of the type resolves to@clerk/ui, preventing issues where there's two versions of the same type.turbo.jsonto factor intsdown.config.mtsinto whether or not to invalidate the cache.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change