diff --git a/package.json b/package.json index 1193d8f..992a4da 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "build": "rolldown -c", "format": "prettier --write .", "format:check": "prettier --check .", - "typecheck": "tsc" + "typecheck": "tsc --build" }, "dependencies": { "@rolldown/pluginutils": "^1.0.0-beta.50", diff --git a/rolldown.config.ts b/rolldown.config.ts index 21fad5b..683f646 100644 --- a/rolldown.config.ts +++ b/rolldown.config.ts @@ -8,5 +8,9 @@ export default defineConfig({ }, platform: 'node', external: (id) => !id.startsWith('.'), - plugins: [dts()], + plugins: [ + dts({ + tsconfig: './tsconfig.lib.json', + }), + ], }); diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 0000000..6779d7a --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "composite": true, + "emitDeclarationOnly": true, + "erasableSyntaxOnly": true, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "isolatedDeclarations": true, + "isolatedModules": true, + "jsx": "react-jsx", + "lib": ["ESNext"], + "libReplacement": false, + "module": "esnext", + "moduleDetection": "force", + "moduleResolution": "bundler", + "noImplicitReturns": true, + "noUnusedLocals": true, + "outDir": "./.cache/ts", + "pretty": true, + "strict": true, + "target": "esnext", + "types": [], + "useUnknownInCatchVariables": true, + "verbatimModuleSyntax": true + } +} diff --git a/tsconfig.json b/tsconfig.json index 0b4d8b7..563f28f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,28 +1,7 @@ { - "compilerOptions": { - "allowSyntheticDefaultImports": true, - "declaration": true, - "erasableSyntaxOnly": true, - "exactOptionalPropertyTypes": true, - "forceConsistentCasingInFileNames": true, - "isolatedDeclarations": true, - "isolatedModules": true, - "jsx": "react-jsx", - "lib": ["ESNext"], - "libReplacement": false, - "module": "esnext", - "moduleDetection": "force", - "moduleResolution": "bundler", - "noImplicitReturns": true, - "noUnusedLocals": true, - "outDir": "./.cache/ts", - "pretty": true, - "strict": true, - "target": "esnext", - "types": ["node"], - "useUnknownInCatchVariables": true, - "verbatimModuleSyntax": true - }, - "files": ["src/index.ts"], - "include": [] + "include": [], + "references": [ + { "path": "tsconfig.src.json" }, + { "path": "tsconfig.tools.json" } + ] } diff --git a/tsconfig.lib.json b/tsconfig.lib.json new file mode 100644 index 0000000..3619bd5 --- /dev/null +++ b/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "composite": false, + "declaration": true, + "noCheck": true, + "types": ["node"] + }, + "files": ["src/index.ts"] +} diff --git a/tsconfig.src.json b/tsconfig.src.json new file mode 100644 index 0000000..abc1e65 --- /dev/null +++ b/tsconfig.src.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "types": ["node"] + }, + "include": ["src/**/*"] +} diff --git a/tsconfig.tools.json b/tsconfig.tools.json new file mode 100644 index 0000000..5722e0c --- /dev/null +++ b/tsconfig.tools.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "isolatedDeclarations": false, + "types": ["node"] + }, + "include": ["rolldown.config.ts"] +}