diff --git a/package.json b/package.json index ad825d6b1ae..86dcee0f8de 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "turbo": "^2.0.14", "turbo-ignore": "^2.0.6", "typedoc": "0.27.6", - "typedoc-plugin-missing-exports": "3.1.0", + "typedoc-plugin-markdown": "4.4.1", "typescript": "catalog:repo", "typescript-eslint": "8.21.0", "uuid": "8.3.2", diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json index f11d7b36ca9..e8bcccca637 100644 --- a/packages/backend/tsconfig.json +++ b/packages/backend/tsconfig.json @@ -3,7 +3,7 @@ "allowSyntheticDefaultImports": true, "baseUrl": ".", "declaration": true, - "declarationMap": false, + "declarationMap": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "importHelpers": true, diff --git a/packages/expo-passkeys/tsconfig.json b/packages/expo-passkeys/tsconfig.json index 0b83924c354..2815e5fa5a0 100644 --- a/packages/expo-passkeys/tsconfig.json +++ b/packages/expo-passkeys/tsconfig.json @@ -3,7 +3,7 @@ "allowJs": true, "baseUrl": ".", "declaration": true, - "declarationMap": false, + "declarationMap": true, "esModuleInterop": true, "importHelpers": true, "incremental": true, diff --git a/packages/expo/tsconfig.json b/packages/expo/tsconfig.json index 53a1bad91ed..cab93f5bef5 100644 --- a/packages/expo/tsconfig.json +++ b/packages/expo/tsconfig.json @@ -8,7 +8,7 @@ "moduleResolution": "NodeNext", "importHelpers": true, "declaration": true, - "declarationMap": false, + "declarationMap": true, "noImplicitReturns": true, "noUnusedLocals": true, "noUnusedParameters": true, diff --git a/packages/express/tsconfig.json b/packages/express/tsconfig.json index 00aa5bab856..dfc9b97c17f 100644 --- a/packages/express/tsconfig.json +++ b/packages/express/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "declarationMap": false, + "declarationMap": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "importHelpers": true, diff --git a/packages/react-router/tsconfig.json b/packages/react-router/tsconfig.json index 8afddbe9195..84318f7426d 100644 --- a/packages/react-router/tsconfig.json +++ b/packages/react-router/tsconfig.json @@ -8,7 +8,7 @@ "moduleResolution": "Bundler", "importHelpers": true, "declaration": true, - "declarationMap": false, + "declarationMap": true, "noImplicitReturns": true, "noUnusedLocals": true, "noUnusedParameters": true, diff --git a/packages/react/package.json b/packages/react/package.json index ba2a328739c..92ede55496b 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -25,7 +25,7 @@ "exports": { ".": { "import": { - "types": "./dist/index.d.mts", + "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }, "require": { @@ -35,7 +35,7 @@ }, "./internal": { "import": { - "types": "./dist/internal.d.mts", + "types": "./dist/internal.d.ts", "default": "./dist/internal.mjs" }, "require": { @@ -45,7 +45,7 @@ }, "./errors": { "import": { - "types": "./dist/errors.d.mts", + "types": "./dist/errors.d.ts", "default": "./dist/errors.mjs" }, "require": { @@ -63,6 +63,7 @@ ], "scripts": { "build": "tsup", + "build:declarations": "tsc --emitDeclarationOnly --declaration", "postbuild": "node ../../scripts/subpath-workaround.mjs react", "clean": "rimraf ./dist", "dev": "tsup --watch", diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 90e5d8cc9b4..cb4634da3de 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "baseUrl": ".", "declaration": true, - "declarationMap": false, + "declarationMap": true, + "declarationDir": "./dist", "esModuleInterop": true, "emitDeclarationOnly": true, "importHelpers": true, @@ -21,5 +22,6 @@ "strict": true, "target": "ES2019" }, - "include": ["src"] + "include": ["src"], + "exclude": ["**/__tests__/**/*"] } diff --git a/packages/react/tsup.config.ts b/packages/react/tsup.config.ts index d0290c0e12a..e76a9a3a4ad 100644 --- a/packages/react/tsup.config.ts +++ b/packages/react/tsup.config.ts @@ -1,5 +1,7 @@ +import type { Options } from 'tsup'; import { defineConfig } from 'tsup'; +import { runAfterLast } from '../../scripts/utils'; import { version as clerkJsVersion } from '../clerk-js/package.json'; import { name, version } from './package.json'; @@ -7,14 +9,12 @@ export default defineConfig(overrideOptions => { const isWatch = !!overrideOptions.watch; const shouldPublish = !!overrideOptions.env?.publish; - return { + const options: Options = { entry: { index: 'src/index.ts', internal: 'src/internal.ts', errors: 'src/errors.ts', }, - dts: true, - onSuccess: shouldPublish ? 'pnpm publish:local' : undefined, format: ['cjs', 'esm'], bundle: true, clean: true, @@ -28,4 +28,6 @@ export default defineConfig(overrideOptions => { __DEV__: `${isWatch}`, }, }; + + return runAfterLast(['pnpm build:declarations', shouldPublish && 'pnpm publish:local'])(options) }); diff --git a/packages/remix/tsconfig.json b/packages/remix/tsconfig.json index d423ec1c4af..8874126a1ac 100644 --- a/packages/remix/tsconfig.json +++ b/packages/remix/tsconfig.json @@ -8,7 +8,7 @@ "moduleResolution": "NodeNext", "importHelpers": true, "declaration": true, - "declarationMap": false, + "declarationMap": true, "noImplicitReturns": true, "noUnusedLocals": true, "noUnusedParameters": true, diff --git a/packages/shared/package.json b/packages/shared/package.json index ce01dd916b6..c5283dd1823 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -12,7 +12,7 @@ "exports": { ".": { "import": { - "types": "./dist/index.d.mts", + "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }, "require": { @@ -22,7 +22,7 @@ }, "./*": { "import": { - "types": "./dist/*.d.mts", + "types": "./dist/*.d.ts", "default": "./dist/*.mjs" }, "require": { @@ -32,7 +32,7 @@ }, "./react": { "import": { - "types": "./dist/react/index.d.mts", + "types": "./dist/react/index.d.ts", "default": "./dist/react/index.mjs" }, "require": { @@ -42,7 +42,7 @@ }, "./utils": { "import": { - "types": "./dist/utils/index.d.mts", + "types": "./dist/utils/index.d.ts", "default": "./dist/utils/index.mjs" }, "require": { @@ -52,7 +52,7 @@ }, "./workerTimers": { "import": { - "types": "./dist/workerTimers/index.d.mts", + "types": "./dist/workerTimers/index.d.ts", "default": "./dist/workerTimers/index.mjs" }, "require": { @@ -62,7 +62,7 @@ }, "./dom": { "import": { - "types": "./dist/dom/index.d.mts", + "types": "./dist/dom/index.d.ts", "default": "./dist/dom/index.mjs" }, "require": { @@ -119,6 +119,7 @@ ], "scripts": { "build": "tsup", + "build:declarations": "tsc --emitDeclarationOnly --declaration", "postbuild": "node ../../scripts/subpath-workaround.mjs shared", "clean": "rimraf ./dist", "dev": "tsup --watch", diff --git a/packages/shared/src/telemetry/throttler.ts b/packages/shared/src/telemetry/throttler.ts index fd3a698e755..d5898f88662 100644 --- a/packages/shared/src/telemetry/throttler.ts +++ b/packages/shared/src/telemetry/throttler.ts @@ -48,7 +48,7 @@ export class TelemetryEventThrottler { #generateKey(event: TelemetryEvent): string { const { sk: _sk, pk: _pk, payload, ...rest } = event; - const sanitizedEvent = { + const sanitizedEvent: Omit & TelemetryEvent['payload'] = { ...payload, ...rest, }; diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index f120c796cd0..64fbffe907e 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -14,11 +14,11 @@ "declarationMap": true, "outDir": "dist", "resolveJsonModule": true, - "declarationDir": "dist/types", + "declarationDir": "./dist", "jsx": "react", "lib": ["ES6", "DOM", "WebWorker"], "allowJs": true }, - "exclude": ["node_modules"], + "exclude": ["node_modules", "**/__tests__/**/*"], "include": ["src", "global.d.ts"] } diff --git a/packages/shared/tsup.config.ts b/packages/shared/tsup.config.ts index 695703ac940..c629567f7b3 100644 --- a/packages/shared/tsup.config.ts +++ b/packages/shared/tsup.config.ts @@ -23,7 +23,7 @@ export default defineConfig(overrideOptions => { clean: true, minify: false, sourcemap: true, - dts: true, + onSuccess: 'pnpm build:declarations', external: ['react', 'react-dom'], esbuildPlugins: [WebWorkerMinifyPlugin as any], define: { diff --git a/packages/shared/typedoc.json b/packages/shared/typedoc.json new file mode 100644 index 00000000000..b893b67ec3b --- /dev/null +++ b/packages/shared/typedoc.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPoints": ["./src/index.ts", "./src/react/index.ts"], + "compilerOptions": { + "noImplicitAny": false + } +} diff --git a/packages/types/package.json b/packages/types/package.json index 83d5569f2a3..e38c815b7b7 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -24,14 +24,14 @@ "license": "MIT", "author": "Clerk", "main": "dist/index.js", - "module": "dist/esm/index.js", + "module": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ "dist" ], "scripts": { "build": "tsup --env.NODE_ENV production", - "clean": "rimraf ./dist", + "build:declarations": "tsc --emitDeclarationOnly --declaration", "dev": "tsup --watch", "lint": "eslint src" }, diff --git a/packages/types/src/hooks.ts b/packages/types/src/hooks.ts index 820f92f03dc..4a1a05c66ba 100644 --- a/packages/types/src/hooks.ts +++ b/packages/types/src/hooks.ts @@ -17,6 +17,7 @@ type CheckAuthorizationWithoutOrgOrUser = (params: Parameters { clean: true, sourcemap: true, format: ['cjs', 'esm'], - legacyOutput: true, - dts: true, + onSuccess: 'pnpm build:declarations', }; }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cfe776f07de..53a75c6ba6f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -277,9 +277,9 @@ importers: typedoc: specifier: 0.27.6 version: 0.27.6(typescript@5.6.3) - typedoc-plugin-missing-exports: - specifier: 3.1.0 - version: 3.1.0(typedoc@0.27.6(typescript@5.6.3)) + typedoc-plugin-markdown: + specifier: 4.4.1 + version: 4.4.1(typedoc@0.27.6(typescript@5.6.3)) typescript: specifier: catalog:repo version: 5.6.3 @@ -2825,7 +2825,7 @@ packages: '@expo/bunyan@4.0.1': resolution: {integrity: sha512-+Lla7nYSiHZirgK+U/uYzsLv/X+HaJienbD5AKX1UQZHYfWaP+9uuQluRB4GrEVWF0GZ7vEVp/jzaOT9k/SQlg==} - engines: {node: '>=0.10.0'} + engines: {'0': node >=0.10.0} '@expo/cli@0.18.30': resolution: {integrity: sha512-V90TUJh9Ly8stYo8nwqIqNWCsYjE28GlVFWEhAFCUOp99foiQr8HSTpiiX5GIrprcPoWmlGoY+J5fQA29R4lFg==} @@ -13944,10 +13944,11 @@ packages: resolution: {integrity: sha512-q7QNVDGTdl702bVFiI5eY4l/HkgCM6at9KhcFbgUAzezHFbOVy4+0O/lCjsABEQwbZPravVfBIiBVGo89yzHFg==} engines: {node: '>= 0.4'} - typedoc-plugin-missing-exports@3.1.0: - resolution: {integrity: sha512-Sogbaj+qDa21NjB3SlIw4JXSwmcl/WOjwiPNaVEcPhpNG/MiRTtpwV81cT7h1cbu9StpONFPbddYWR0KV/fTWA==} + typedoc-plugin-markdown@4.4.1: + resolution: {integrity: sha512-fx23nSCvewI9IR8lzIYtzDphETcgTDuxKcmHKGD4lo36oexC+B1k4NaCOY58Snqb4OlE8OXDAGVcQXYYuLRCNw==} + engines: {node: '>= 18'} peerDependencies: - typedoc: 0.26.x || 0.27.x + typedoc: 0.27.x typedoc@0.27.6: resolution: {integrity: sha512-oBFRoh2Px6jFx366db0lLlihcalq/JzyCVp7Vaq1yphL/tbgx2e+bkpkCgJPunaPvPwoTOXSwasfklWHm7GfAw==} @@ -31962,7 +31963,7 @@ snapshots: typed-array-buffer: 1.0.3 typed-array-byte-offset: 1.0.4 - typedoc-plugin-missing-exports@3.1.0(typedoc@0.27.6(typescript@5.6.3)): + typedoc-plugin-markdown@4.4.1(typedoc@0.27.6(typescript@5.6.3)): dependencies: typedoc: 0.27.6(typescript@5.6.3) diff --git a/tsconfig.json b/tsconfig.json index e5339d09383..47f291ac703 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "alwaysStrict": false, "declaration": true, - "declarationMap": false, + "declarationMap": true, "downlevelIteration": true, "forceConsistentCasingInFileNames": true, "importHelpers": true, diff --git a/typedoc.config.mjs b/typedoc.config.mjs index 82d6f8871d0..7e0f4f1786d 100644 --- a/typedoc.config.mjs +++ b/typedoc.config.mjs @@ -29,7 +29,7 @@ const config = { // TODO: Once we're happy with the output the JSON should be written to a non-gitignored location as we want to consume it in other places json: './.typedoc/output.json', entryPointStrategy: 'packages', - plugin: ['typedoc-plugin-missing-exports'], + plugin: ['typedoc-plugin-markdown'], packageOptions: { includeVersion: false, excludePrivate: true, @@ -39,11 +39,19 @@ const config = { excludeInternal: true, excludeNotDocumented: true, gitRevision: 'main', - blockTags: [...OptionDefaults.blockTags, '@warning', '@note', '@important'], + blockTags: [...OptionDefaults.blockTags, '@warning', '@note', '@important', '@memberof'], modifierTags: [...OptionDefaults.modifierTags], exclude: ['src/**/*.test.ts', 'src/**/*.test.tsx'], + readme: 'none', + disableGit: true, + disableSources: true, }, - entryPoints: ['packages/nextjs', 'packages/react', 'packages/backend', 'packages/types'], // getPackages(), + entryPoints: ['packages/nextjs', 'packages/react', 'packages/shared', 'packages/types'], // getPackages(), + /** + * typedoc-plugin-markdown options + */ + hidePageHeader: true, + hideBreadcrumbs: true, }; export default config;