diff --git a/.changeset/little-items-lay.md b/.changeset/little-items-lay.md new file mode 100644 index 00000000000..0dd01fe5cdf --- /dev/null +++ b/.changeset/little-items-lay.md @@ -0,0 +1,5 @@ +--- +'@itwin/itwinui-react': patch +--- + +Type declarations are now generated using `"module": "NodeNext"`. diff --git a/.changeset/violet-lemons-exercise.md b/.changeset/violet-lemons-exercise.md new file mode 100644 index 00000000000..250ec1980b0 --- /dev/null +++ b/.changeset/violet-lemons-exercise.md @@ -0,0 +1,5 @@ +--- +'@itwin/itwinui-react': patch +--- + +The `"exports"` fallback for `/react-table` types is now handled using [`typesVersions`](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#version-selection-with-typesversions). diff --git a/packages/itwinui-react/package.json b/packages/itwinui-react/package.json index f8a7c4626e9..46fea0ddd39 100644 --- a/packages/itwinui-react/package.json +++ b/packages/itwinui-react/package.json @@ -24,21 +24,26 @@ }, "require": { "types": "./cjs/react-table/react-table.d.ts" - }, - "types": "./react-table.d.ts" + } }, "./styles.css": "./styles.css", "./cjs": "./cjs/index.js", "./esm": "./esm/index.js", "./package.json": "./package.json" }, + "typesVersions": { + "*": { + "react-table": [ + "./esm/react-table/react-table.d.ts" + ] + } + }, "files": [ "cjs", "esm", "styles.css", "CHANGELOG.md", - "LICENSE.md", - "react-table.d.ts" + "LICENSE.md" ], "description": "A react component library for iTwinUI", "homepage": "https://github.com/iTwin/iTwinUI", @@ -64,7 +69,7 @@ "scripts": { "build": "pnpm clean:build && pnpm build:js && pnpm build:styles && pnpm build:types && pnpm build:post", "build:js": "node ./scripts/build.mjs", - "build:types": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && tsc -p tsconfig.react-table.json", + "build:types": "tsc -p tsconfig.build.json --outDir esm && tsc -p tsconfig.build.json --outDir cjs", "build:styles": "vite build src/styles.js", "build:post": "node ./scripts/postBuild.mjs", "clean:build": "rimraf esm && rimraf cjs && rimraf react-table.d.ts", @@ -80,7 +85,7 @@ "dev": "pnpm clean:build && concurrently \"pnpm dev:esm\" \"pnpm dev:cjs\" \"pnpm build:styles --watch\" \"pnpm dev:types\"", "dev:esm": "swc src -d esm --watch --strip-leading-paths", "dev:cjs": "swc src -d cjs --watch --strip-leading-paths -C module.type=commonjs", - "dev:types": "concurrently \"tsc -p tsconfig.cjs.json --emitDeclarationOnly --watch --preserveWatchOutput\" \"tsc -p tsconfig.esm.json --emitDeclarationOnly --watch --preserveWatchOutput\" \"tsc -p tsconfig.react-table.json --watch --preserveWatchOutput\"", + "dev:types": "concurrently \"tsc -p tsconfig.build.json --outDir esm --watch --preserveWatchOutput\" \"tsc -p tsconfig.build.json --outDir cjs --watch --preserveWatchOutput\"", "dev:styles": "pnpm build:styles --watch" }, "dependencies": { diff --git a/packages/itwinui-react/tsconfig.cjs.json b/packages/itwinui-react/tsconfig.cjs.json deleted file mode 100644 index 20a77b5747c..00000000000 --- a/packages/itwinui-react/tsconfig.cjs.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "outDir": "cjs", - "module": "commonjs", - - // reverting this back because not supported in CJS - "verbatimModuleSyntax": false - } -} diff --git a/packages/itwinui-react/tsconfig.esm.json b/packages/itwinui-react/tsconfig.esm.json deleted file mode 100644 index 8aba9218200..00000000000 --- a/packages/itwinui-react/tsconfig.esm.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "outDir": "esm", - "module": "esnext" - } -} diff --git a/packages/itwinui-react/tsconfig.json b/packages/itwinui-react/tsconfig.json index 0be0dd97737..1e5378179dc 100644 --- a/packages/itwinui-react/tsconfig.json +++ b/packages/itwinui-react/tsconfig.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { "target": "es2020", - "module": "esnext", + "module": "NodeNext", "lib": ["esnext", "dom"], "declaration": true, "esModuleInterop": true, diff --git a/packages/itwinui-react/tsconfig.react-table.json b/packages/itwinui-react/tsconfig.react-table.json deleted file mode 100644 index 10da6c67841..00000000000 --- a/packages/itwinui-react/tsconfig.react-table.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "files": ["src/react-table/react-table.ts"], - "compilerOptions": { - "outDir": ".", - "noUnusedLocals": false, - "importHelpers": true, - "emitDeclarationOnly": true - } -}