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" +} 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" +} 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" +} 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" +} 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 1f6faed..f7c59a8 100644 --- a/packages/nova-react-test-utils/package.json +++ b/packages/nova-react-test-utils/package.json @@ -113,19 +113,16 @@ "publishConfig": { "exports": { ".": { - "import": "./lib/relay/index.mjs", - "require": "./lib/relay/index.js", - "types": "./lib/relay/index.d.ts" + "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": { - "import": "./lib/relay/index.mjs", - "require": "./lib/relay/index.js", - "types": "./lib/relay/index.d.ts" + "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": { - "import": "./lib/apollo/index.mjs", - "require": "./lib/apollo/index.js", - "types": "./lib/apollo/index.d.ts" + "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 = {