From 01454cd15fe48d80248ac8edbfe3ec2d0bf8e06c Mon Sep 17 00:00:00 2001 From: Stanislaw Wilczynski Date: Mon, 9 Mar 2026 12:49:46 +0100 Subject: [PATCH 1/6] Change files --- ...ct-test-utils-70d1decc-1438-42a9-a486-de651f2fa6bd.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@nova-react-test-utils-70d1decc-1438-42a9-a486-de651f2fa6bd.json diff --git a/change/@nova-react-test-utils-70d1decc-1438-42a9-a486-de651f2fa6bd.json b/change/@nova-react-test-utils-70d1decc-1438-42a9-a486-de651f2fa6bd.json new file mode 100644 index 0000000..abdf84f --- /dev/null +++ b/change/@nova-react-test-utils-70d1decc-1438-42a9-a486-de651f2fa6bd.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Fix exports map: move types condition before import/require for modern moduleResolution compatibility", + "packageName": "@nova/react-test-utils", + "email": "stwilczy@microsoft.com", + "dependentChangeType": "patch" +} From 4d84ce40e601c815422d6215fcbcae361c5a4a21 Mon Sep 17 00:00:00 2001 From: Stanislaw Wilczynski Date: Mon, 9 Mar 2026 12:50:02 +0100 Subject: [PATCH 2/6] Fix exports map: move types before import/require TypeScript with modern moduleResolution (node16/nodenext/bundler) requires the "types" condition to appear first in package.json exports. Otherwise, TS resolves the .mjs file but can't find matching .d.mts types. Fixes #172 Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/nova-react-test-utils/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/nova-react-test-utils/package.json b/packages/nova-react-test-utils/package.json index 1f6faed..cdd3465 100644 --- a/packages/nova-react-test-utils/package.json +++ b/packages/nova-react-test-utils/package.json @@ -113,19 +113,19 @@ "publishConfig": { "exports": { ".": { + "types": "./lib/relay/index.d.ts", "import": "./lib/relay/index.mjs", - "require": "./lib/relay/index.js", - "types": "./lib/relay/index.d.ts" + "require": "./lib/relay/index.js" }, "./relay": { + "types": "./lib/relay/index.d.ts", "import": "./lib/relay/index.mjs", - "require": "./lib/relay/index.js", - "types": "./lib/relay/index.d.ts" + "require": "./lib/relay/index.js" }, "./apollo": { + "types": "./lib/apollo/index.d.ts", "import": "./lib/apollo/index.mjs", - "require": "./lib/apollo/index.js", - "types": "./lib/apollo/index.d.ts" + "require": "./lib/apollo/index.js" } }, "main": "./lib/relay/index", From 2617e03e5163b72ba5815a99fce7e7aa49b79b15 Mon Sep 17 00:00:00 2001 From: Stanislaw Wilczynski Date: Mon, 9 Mar 2026 13:06:16 +0100 Subject: [PATCH 3/6] Generate .d.mts declarations and use nested export conditions Copy .d.ts to .d.mts after tsc so ESM imports resolve to ESM-specific type declarations. Update publishConfig.exports in all packages to use nested conditions with per-format types, fixing the "Masquerading as CJS" issue reported by arethetypeswrong. Fixes #172 Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/examples/package.json | 5 ++--- packages/nova-react-test-utils/package.json | 15 ++++++--------- packages/nova-react/package.json | 5 ++--- packages/nova-types/package.json | 5 ++--- scripts/just.config.ts | 13 ++++++++++++- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/packages/examples/package.json b/packages/examples/package.json index b795402..17d5f21 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -70,9 +70,8 @@ "publishConfig": { "exports": { ".": { - "types": "./lib/index.d.ts", - "import": "./lib/index.mjs", - "require": "./lib/index.js" + "import": { "types": "./lib/index.d.mts", "default": "./lib/index.mjs" }, + "require": { "types": "./lib/index.d.ts", "default": "./lib/index.js" } } }, "main": "./lib/index", diff --git a/packages/nova-react-test-utils/package.json b/packages/nova-react-test-utils/package.json index cdd3465..f7c59a8 100644 --- a/packages/nova-react-test-utils/package.json +++ b/packages/nova-react-test-utils/package.json @@ -113,19 +113,16 @@ "publishConfig": { "exports": { ".": { - "types": "./lib/relay/index.d.ts", - "import": "./lib/relay/index.mjs", - "require": "./lib/relay/index.js" + "import": { "types": "./lib/relay/index.d.mts", "default": "./lib/relay/index.mjs" }, + "require": { "types": "./lib/relay/index.d.ts", "default": "./lib/relay/index.js" } }, "./relay": { - "types": "./lib/relay/index.d.ts", - "import": "./lib/relay/index.mjs", - "require": "./lib/relay/index.js" + "import": { "types": "./lib/relay/index.d.mts", "default": "./lib/relay/index.mjs" }, + "require": { "types": "./lib/relay/index.d.ts", "default": "./lib/relay/index.js" } }, "./apollo": { - "types": "./lib/apollo/index.d.ts", - "import": "./lib/apollo/index.mjs", - "require": "./lib/apollo/index.js" + "import": { "types": "./lib/apollo/index.d.mts", "default": "./lib/apollo/index.mjs" }, + "require": { "types": "./lib/apollo/index.d.ts", "default": "./lib/apollo/index.js" } } }, "main": "./lib/relay/index", diff --git a/packages/nova-react/package.json b/packages/nova-react/package.json index 9ae4255..8f54c8f 100644 --- a/packages/nova-react/package.json +++ b/packages/nova-react/package.json @@ -41,9 +41,8 @@ "publishConfig": { "exports": { ".": { - "types": "./lib/index.d.ts", - "import": "./lib/index.mjs", - "require": "./lib/index.js" + "import": { "types": "./lib/index.d.mts", "default": "./lib/index.mjs" }, + "require": { "types": "./lib/index.d.ts", "default": "./lib/index.js" } } }, "main": "./lib/index", diff --git a/packages/nova-types/package.json b/packages/nova-types/package.json index 3d308e6..d34fc08 100644 --- a/packages/nova-types/package.json +++ b/packages/nova-types/package.json @@ -21,9 +21,8 @@ "publishConfig": { "exports": { ".": { - "types": "./lib/index.d.ts", - "import": "./lib/index.mjs", - "require": "./lib/index.js" + "import": { "types": "./lib/index.d.mts", "default": "./lib/index.mjs" }, + "require": { "types": "./lib/index.d.ts", "default": "./lib/index.js" } } }, "main": "./lib/index", diff --git a/scripts/just.config.ts b/scripts/just.config.ts index 5ea1cbd..264529b 100644 --- a/scripts/just.config.ts +++ b/scripts/just.config.ts @@ -4,7 +4,18 @@ import * as path from "path"; import * as fs from "fs"; import * as glob from "fast-glob"; -export const types = tscTask({ emitDeclarationOnly: true }); +export const types = async () => { + await tscTask({ emitDeclarationOnly: true })(); + // Copy .d.ts -> .d.mts so ESM imports resolve to correct declaration files + const dtsFiles = glob.sync(["lib/**/*.d.ts"], { ignore: ["lib/**/*.d.mts"] }); + for (const file of dtsFiles) { + fs.copyFileSync(file, file.replace(/\.d\.ts$/, ".d.mts")); + } + const mapFiles = glob.sync(["lib/**/*.d.ts.map"]); + for (const file of mapFiles) { + fs.copyFileSync(file, file.replace(/\.d\.ts\.map$/, ".d.mts.map")); + } +}; export const build = () => { const baseEsbuildOptions: EsbuildBuildOptions = { From dd8abfc201660bbe2d533889c0ceb5b8a1779cd2 Mon Sep 17 00:00:00 2001 From: Stanislaw Wilczynski Date: Mon, 9 Mar 2026 13:06:22 +0100 Subject: [PATCH 4/6] Change files --- .../@nova-react-a2b641e3-77cc-4e9c-99f8-8f4db5031ac0.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@nova-react-a2b641e3-77cc-4e9c-99f8-8f4db5031ac0.json diff --git a/change/@nova-react-a2b641e3-77cc-4e9c-99f8-8f4db5031ac0.json b/change/@nova-react-a2b641e3-77cc-4e9c-99f8-8f4db5031ac0.json new file mode 100644 index 0000000..2b10ad8 --- /dev/null +++ b/change/@nova-react-a2b641e3-77cc-4e9c-99f8-8f4db5031ac0.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Add .d.mts declarations and nested export conditions for modern moduleResolution", + "packageName": "@nova/react", + "email": "stwilczy@microsoft.com", + "dependentChangeType": "patch" +} From 8250cebbec8fb88a5f22b99cdffcd281bdbf0753 Mon Sep 17 00:00:00 2001 From: Stanislaw Wilczynski Date: Mon, 9 Mar 2026 13:06:22 +0100 Subject: [PATCH 5/6] Change files --- .../@nova-types-7b01095b-4805-46aa-a17c-a16bcea5de7d.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@nova-types-7b01095b-4805-46aa-a17c-a16bcea5de7d.json diff --git a/change/@nova-types-7b01095b-4805-46aa-a17c-a16bcea5de7d.json b/change/@nova-types-7b01095b-4805-46aa-a17c-a16bcea5de7d.json new file mode 100644 index 0000000..4d268fe --- /dev/null +++ b/change/@nova-types-7b01095b-4805-46aa-a17c-a16bcea5de7d.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Add .d.mts declarations and nested export conditions for modern moduleResolution", + "packageName": "@nova/types", + "email": "stwilczy@microsoft.com", + "dependentChangeType": "patch" +} From 99b6a8c772c94ee6269515706f06a091837f0068 Mon Sep 17 00:00:00 2001 From: Stanislaw Wilczynski Date: Mon, 9 Mar 2026 13:06:26 +0100 Subject: [PATCH 6/6] Change files --- ...nova-examples-d474789e-8fec-4908-be19-e9417ec6f4df.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@nova-examples-d474789e-8fec-4908-be19-e9417ec6f4df.json diff --git a/change/@nova-examples-d474789e-8fec-4908-be19-e9417ec6f4df.json b/change/@nova-examples-d474789e-8fec-4908-be19-e9417ec6f4df.json new file mode 100644 index 0000000..553ab7f --- /dev/null +++ b/change/@nova-examples-d474789e-8fec-4908-be19-e9417ec6f4df.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Add nested export conditions", + "packageName": "@nova/examples", + "email": "stwilczy@microsoft.com", + "dependentChangeType": "none" +}