Skip to content

Commit

Permalink
feat: bundle .d.ts (again)
Browse files Browse the repository at this point in the history
Bundled as `index.d.ts` as before
  • Loading branch information
syimyuzya committed Jul 28, 2024
1 parent 9458d86 commit 0fa8247
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ yarn.lock

/index.js
/index.js.map
/types
/index.d.ts

/docs

Expand Down
34 changes: 34 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.15.0-alpha.1",
"description": "A JavaScript library for the Qieyun phonological system",
"main": "index.js",
"types": "types/index.d.ts",
"types": "index.d.ts",
"scripts": {
"build": "run-p build:*",
"build:rollup": "rollup -c",
Expand Down Expand Up @@ -68,6 +68,7 @@
"open-cli": "^8.0.0",
"prettier": "^3.3.2",
"rollup": "^4.18.0",
"rollup-plugin-dts": "^6.1.1",
"ts-node": "^10.9.2",
"tslib": "^2.6.3",
"typedoc": "^0.26.3",
Expand All @@ -77,7 +78,7 @@
"files": [
"index.js",
"index.js.map",
"types",
"index.d.ts",
"LICENSE",
"README.md"
],
Expand Down
41 changes: 26 additions & 15 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
// @ts-check

import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';

export default {
input: 'src/index.ts',
output: {
file: 'index.js',
format: 'umd',
sourcemap: true,
name: 'Qieyun',
exports: 'named',
export default [
{
input: 'src/index.ts',
output: {
file: 'index.js',
format: 'umd',
sourcemap: true,
name: 'Qieyun',
exports: 'named',
},
plugins: [
typescript({
// NOTE Apparently needed with `"incremental": true` in tsconfig
outputToFilesystem: false,
}),
],
},
plugins: [
typescript({
// XXX Apparently needed with `"incremental": true` in tsconfig
outputToFilesystem: false,
}),
],
};
{
input: 'build/esnext/index.d.ts',
output: {
file: 'index.d.ts',
format: 'es',
},
plugins: [dts()],
},
];
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"moduleResolution": "node",
"module": "esnext",
"declaration": true,
"declarationDir": "types",
"inlineSourceMap": true,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"resolveJsonModule": true /* Include modules imported with .json extension. */,
Expand Down
1 change: 0 additions & 1 deletion tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"outDir": "build/test",
"module": "commonjs",
"declaration": false,
"declarationDir": null,
"types": ["node"]
},
"exclude": []
Expand Down

0 comments on commit 0fa8247

Please sign in to comment.