Skip to content

Commit 3591d53

Browse files
committed
perf: added terser
1 parent 681e04d commit 3591d53

File tree

5 files changed

+87
-7
lines changed

5 files changed

+87
-7
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"scripts": {
99
"dev": "tsx src/index.ts",
10-
"build": "rimraf dist && npm run lint && rollup -c",
10+
"build": "rimraf dist && npm run lint && rollup -c --compact",
1111
"format": "prettier --write .",
1212
"lint": "eslint **/*.ts **/*.tsx",
1313
"typecheck": "tsc --noEmit",
@@ -35,6 +35,8 @@
3535
"tslib": "2.4.0"
3636
},
3737
"devDependencies": {
38+
"@babel/code-frame": "7.18.6",
39+
"@ducanh2912/rollup-plugin-terser": "1.1.2",
3840
"@eslint/eslintrc": "1.3.2",
3941
"@rollup/plugin-typescript": "8.5.0",
4042
"@semantic-release/changelog": "6.0.1",
@@ -43,6 +45,7 @@
4345
"@semantic-release/github": "8.0.6",
4446
"@semantic-release/npm": "9.0.1",
4547
"@semantic-release/release-notes-generator": "10.0.3",
48+
"@types/babel__code-frame": "7.0.3",
4649
"@types/inquirer": "9.0.2",
4750
"@types/node": "18.8.2",
4851
"@types/pdfkit": "0.12.6",
@@ -58,6 +61,7 @@
5861
"rimraf": "3.0.2",
5962
"rollup": "2.79.1",
6063
"semantic-release": "19.0.5",
64+
"terser": "5.15.1",
6165
"tsx": "3.9.0",
6266
"typescript": "4.8.4"
6367
}

pnpm-lock.yaml

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rollup.config.js renamed to rollup.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { terser } from "@ducanh2912/rollup-plugin-terser";
12
import typescript from "@rollup/plugin-typescript";
3+
import { defineConfig } from "rollup";
24

3-
/** @type {import("rollup").RollupOptions} */
4-
export default {
5+
export default defineConfig({
56
input: "src/index.ts",
67
output: {
78
file: "dist/index.js",
@@ -13,6 +14,7 @@ export default {
1314
noForceEmit: true,
1415
noEmitOnError: true,
1516
}),
17+
terser(),
1618
],
1719
external: [
1820
"axios",
@@ -26,4 +28,4 @@ export default {
2628
"node-html-parser",
2729
"crypto",
2830
],
29-
};
31+
});

src/shared/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ interface ChapterType {
1010

1111
type DownloadTypesType = typeof DOWNLOAD_TYPES[number];
1212

13-
export { ChapterType, DownloadTypesType, ImageType };
13+
export type { ChapterType, DownloadTypesType, ImageType };

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
"module": "ESNext",
55
"lib": ["DOM", "ES6", "ES2017", "ESNext.AsyncIterable"],
66
"sourceMap": false,
7-
"rootDir": "src",
87
"strict": true,
98
"esModuleInterop": true,
10-
"moduleResolution": "node",
9+
"moduleResolution": "Node",
1110
"resolveJsonModule": true,
1211
"allowSyntheticDefaultImports": true,
1312
"noUnusedLocals": true,
1413
"noUnusedParameters": true,
1514
"noImplicitReturns": true,
1615
"noFallthroughCasesInSwitch": true,
16+
"isolatedModules": true,
1717
"removeComments": true,
1818
"checkJs": true
1919
},

0 commit comments

Comments
 (0)