From 801a892f55106cf185a059f37dcba42b6b036338 Mon Sep 17 00:00:00 2001 From: Nikos Douvlis Date: Fri, 6 Oct 2023 11:51:30 +0300 Subject: [PATCH 1/3] fix(clerk-react,remix,shared): Move `exports.types` to the top The TypeScript docs (https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing) recommends so, but it's also because the "exports" field is order-based. For example, a scenario where both the "types" and "import" condition could be active, "types" should be first so that it matches and returns a .d.ts file, rather than a .js file from the "import" condition. --- packages/react/package.json | 4 ++-- packages/remix/package.json | 15 ++++++++++++--- packages/shared/package.json | 8 ++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/react/package.json b/packages/react/package.json index 46489b06b64..2381a74f49e 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -18,9 +18,9 @@ "types": "./dist/types/index.d.ts", "exports": { ".": { + "types": "./dist/types/index.d.ts", "import": "./dist/esm/index.js", - "require": "./dist/cjs/index.js", - "types": "./dist/types/index.d.ts" + "require": "./dist/cjs/index.js" } }, "files": [ diff --git a/packages/remix/package.json b/packages/remix/package.json index eb9085808c4..e1ce29dfd8b 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -18,9 +18,18 @@ "types": "dist/index.d.ts", "sideEffects": false, "exports": { - ".": "./dist/index.js", - "./ssr.server": "./dist/ssr/index.js", - "./api.server": "./dist/api/index.js" + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./ssr.server": { + "types": "./dist/ssr/index.d.ts", + "default": "./dist/ssr/index.js" + }, + "./api.server": { + "types": "./dist/api/index.d.ts", + "default": "./dist/api/index.js" + } }, "typesVersions": { "*": { diff --git a/packages/shared/package.json b/packages/shared/package.json index 8ccf92ec069..54cdd33a8c1 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -12,14 +12,14 @@ ], "exports": { ".": { + "types": "./dist/types/index.d.ts", "import": "./dist/esm/index.js", - "require": "./dist/cjs/index.js", - "types": "./dist/types/index.d.ts" + "require": "./dist/cjs/index.js" }, "./testUtils": { + "types": "./dist/types/testUtils/index.d.ts", "import": "./dist/esm/testUtils/index.js", - "require": "./dist/cjs/testUtils/index.js", - "types": "./dist/types/testUtils/index.d.ts" + "require": "./dist/cjs/testUtils/index.js" } }, "scripts": { From 3dc386aedce8c996c680ad73a7da6383b1947721 Mon Sep 17 00:00:00 2001 From: Nikos Douvlis Date: Fri, 6 Oct 2023 11:55:04 +0300 Subject: [PATCH 2/3] Create dull-gifts-yawn.md --- .changeset/dull-gifts-yawn.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/dull-gifts-yawn.md diff --git a/.changeset/dull-gifts-yawn.md b/.changeset/dull-gifts-yawn.md new file mode 100644 index 00000000000..d1378b6b737 --- /dev/null +++ b/.changeset/dull-gifts-yawn.md @@ -0,0 +1,7 @@ +--- +"@clerk/clerk-react": patch +"@clerk/remix": patch +"@clerk/shared": patch +--- + +Make `types` the first key in all `exports` keys defined in our packages. The TypeScript docs (https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing) recommends so, as the the "exports" field is order-based. From 3f560d357828350534c2b1c3ebb600c108e3d791 Mon Sep 17 00:00:00 2001 From: Lennart Date: Fri, 6 Oct 2023 11:19:50 +0200 Subject: [PATCH 3/3] Update dull-gifts-yawn.md --- .changeset/dull-gifts-yawn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/dull-gifts-yawn.md b/.changeset/dull-gifts-yawn.md index d1378b6b737..c67d5353162 100644 --- a/.changeset/dull-gifts-yawn.md +++ b/.changeset/dull-gifts-yawn.md @@ -4,4 +4,4 @@ "@clerk/shared": patch --- -Make `types` the first key in all `exports` keys defined in our packages. The TypeScript docs (https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing) recommends so, as the the "exports" field is order-based. +Make `types` the first key in all `exports` maps defined in our packages' `package.json`. The [TypeScript docs](https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing) recommends so, as the the `exports` map is order-based.