From 9227a7d6bf884cc92c730194d05085709dcef1f2 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Thu, 16 Apr 2026 09:44:29 -0700 Subject: [PATCH] chore: replace rollup-plugin-dts with tsc for declaration emission Remove rollup-plugin-dts and emit type declarations directly with tsc via a new tsconfig.build.json. The build now produces lib/types/*.d.ts alongside the existing lib/cjs and lib/esm bundles; the `types` / `exports.types` entries in package.json point at lib/types/index.d.ts. --- package.json | 7 +++---- rollup.config.ts | 9 --------- tsconfig.build.json | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 tsconfig.build.json diff --git a/package.json b/package.json index abe807f..cc56a75 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,12 @@ "bindings" ], "exports": { - "types": "./lib/index.d.ts", + "types": "./lib/types/index.d.ts", "require": "./lib/cjs/index.js", "import": "./lib/esm/index.js" }, "main": "./lib/cjs/index.js", - "types": "./lib/index.d.ts", + "types": "./lib/types/index.d.ts", "files": [ "lib", "src", @@ -29,7 +29,7 @@ "test": "jest", "test:junit": "jest --ci --reporters=default", "clean": "rimraf lib/*", - "rb": "rollup -c --configPlugin typescript", + "rb": "rollup -c --configPlugin typescript && tsc -p tsconfig.build.json", "rbw": "npm run rb --watch", "build": "npm run clean && npm run rb", "lint": "eslint ./src", @@ -75,7 +75,6 @@ "react-test-renderer": "^18.0.0", "rimraf": "^6.0.1", "rollup": "^4.19.0", - "rollup-plugin-dts": "^6.1.0", "rollup-plugin-esbuild": "^6.1.1", "ts-jest": "^29.2.2", "tslib": "^2.8.1", diff --git a/rollup.config.ts b/rollup.config.ts index a0181c1..aec1fcc 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,4 +1,3 @@ -import dts from 'rollup-plugin-dts'; import esbuild from 'rollup-plugin-esbuild'; import json from '@rollup/plugin-json'; import resolve from '@rollup/plugin-node-resolve'; @@ -33,12 +32,4 @@ export default [ plugins, external, }, - { - input: 'src/index.ts', - plugins: [dts(), json()], - output: { - file: 'lib/index.d.ts', - format: 'es', - }, - }, ]; diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..f80be94 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "declaration": true, + "declarationDir": "lib/types", + "emitDeclarationOnly": true, + "sourceMap": false, + "sourceRoot": null, + "noEmit": false + }, + "include": ["src"], + "exclude": ["node_modules", "lib", "dist", "example", "**/*.test.ts", "**/*.test.tsx"] +}