Skip to content

Conversation

@LekoArts
Copy link
Contributor

@LekoArts LekoArts commented Feb 10, 2025

Description

TL;DR: Switch some key SDKs to use tsc for type compilation in order to create sourcemaps for d.ts files (.d.ts.map) so that Typedoc can understand cross-package references.

So for my Typedoc project I need to get cross-package references working. So @clerk/clerk-react imports from @clerk/shared which in itself imports from @clerk/types. In order to have the type from @clerk/types correctly be linked in @clerk/clerk-react Typedoc needs declaration maps.

Which is a problem, because:

So the current state of the PR will have these problems: https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md

The questions now is: Will this have an impact and if yes, do we tolerate it? I've created a snapshot release and will test it but I'd be super open to another approach as long as the result is right 👍

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel
Copy link

vercel bot commented Feb 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 10:53am

@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2025

🦋 Changeset detected

Latest commit: a3e75bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@clerk/shared Patch
@clerk/clerk-react Patch
@clerk/types Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/clerk-expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-start Patch
@clerk/testing Patch
@clerk/ui Patch
@clerk/vue Patch
@clerk/localizations Patch
@clerk/themes Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LekoArts
Copy link
Contributor Author

!snapshot

@LekoArts LekoArts changed the title chore(repo): Switch to tsc for type generation chore(clerk-react,shared,types): Switch to tsc for type generation Feb 11, 2025
@clerk-cookie
Copy link
Collaborator

Hey @LekoArts - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 2.1.21-snapshot.v20250211113352
@clerk/backend 1.24.1-snapshot.v20250211113352
@clerk/chrome-extension 2.2.9-snapshot.v20250211113352
@clerk/clerk-js 5.52.3-snapshot.v20250211113352
@clerk/elements 0.22.22-snapshot.v20250211113352
@clerk/clerk-expo 2.7.7-snapshot.v20250211113352
@clerk/expo-passkeys 0.1.20-snapshot.v20250211113352
@clerk/express 1.3.48-snapshot.v20250211113352
@clerk/fastify 2.1.21-snapshot.v20250211113352
@clerk/localizations 3.10.6-snapshot.v20250211113352
@clerk/nextjs 6.11.3-snapshot.v20250211113352
@clerk/nuxt 1.1.4-snapshot.v20250211113352
@clerk/clerk-react 5.22.13-snapshot.v20250211113352
@clerk/react-router 1.0.8-snapshot.v20250211113352
@clerk/remix 4.4.24-snapshot.v20250211113352
@clerk/shared 2.21.1-snapshot.v20250211113352
@clerk/tanstack-start 0.9.6-snapshot.v20250211113352
@clerk/testing 1.4.22-snapshot.v20250211113352
@clerk/themes 2.2.18-snapshot.v20250211113352
@clerk/types 4.45.2-snapshot.v20250211113352
@clerk/ui 0.3.23-snapshot.v20250211113352
@clerk/vue 1.1.12-snapshot.v20250211113352

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@2.1.21-snapshot.v20250211113352 --save-exact

@clerk/backend

npm i @clerk/backend@1.24.1-snapshot.v20250211113352 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@2.2.9-snapshot.v20250211113352 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.52.3-snapshot.v20250211113352 --save-exact

@clerk/elements

npm i @clerk/elements@0.22.22-snapshot.v20250211113352 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.7.7-snapshot.v20250211113352 --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@0.1.20-snapshot.v20250211113352 --save-exact

@clerk/express

npm i @clerk/express@1.3.48-snapshot.v20250211113352 --save-exact

@clerk/fastify

npm i @clerk/fastify@2.1.21-snapshot.v20250211113352 --save-exact

@clerk/localizations

npm i @clerk/localizations@3.10.6-snapshot.v20250211113352 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@6.11.3-snapshot.v20250211113352 --save-exact

@clerk/nuxt

npm i @clerk/nuxt@1.1.4-snapshot.v20250211113352 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.22.13-snapshot.v20250211113352 --save-exact

@clerk/react-router

npm i @clerk/react-router@1.0.8-snapshot.v20250211113352 --save-exact

@clerk/remix

npm i @clerk/remix@4.4.24-snapshot.v20250211113352 --save-exact

@clerk/shared

npm i @clerk/shared@2.21.1-snapshot.v20250211113352 --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.9.6-snapshot.v20250211113352 --save-exact

@clerk/testing

npm i @clerk/testing@1.4.22-snapshot.v20250211113352 --save-exact

@clerk/themes

npm i @clerk/themes@2.2.18-snapshot.v20250211113352 --save-exact

@clerk/types

npm i @clerk/types@4.45.2-snapshot.v20250211113352 --save-exact

@clerk/ui

npm i @clerk/ui@0.3.23-snapshot.v20250211113352 --save-exact

@clerk/vue

npm i @clerk/vue@1.1.12-snapshot.v20250211113352 --save-exact

"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"declaration": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was already defined in the declarations tsconfig so I removed this duplicate

"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"declaration": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was already defined in the declarations tsconfig so I removed this duplicate

".": {
"import": {
"types": "./dist/index.d.mts",
"types": "./dist/index.d.ts",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Core of the problem, tsc can't dual emit .d.ts as CJS and .d.mts as ESM so it's only .d.ts for both

@LekoArts
Copy link
Contributor Author

Closing this in favor of a new PR where I'll only create those declaration maps locally/in CI and won't be published

@LekoArts LekoArts closed this Feb 18, 2025
@LekoArts LekoArts deleted the lekoarts/eco-371-generate-declaration-maps-in-sdks branch February 18, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants