Skip to content

Commit de8c439

Browse files
committed
升级
1 parent 8c3276c commit de8c439

File tree

9 files changed

+2614
-801
lines changed

9 files changed

+2614
-801
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ typings/
6161
.next
6262
*.zip
6363
.yarn/install-state.gz
64+
.vscode/settings.json

.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,34 @@
1919
"precommit": "npm run format ||node -v",
2020
"dev": "vite serve --config vite.config.ts",
2121
"build": "vite build --config vite.config.ts",
22-
"format": "npx prettier --write *.json *.md */*.js */*.html *.ts */*.ts *.js",
23-
"prepare": "husky install"
22+
"format": "npx prettier --write *.json *.md */*.js */*.html *.ts */*.ts *.js"
2423
},
2524
"devDependencies": {
26-
"@babel/code-frame": "^7.16.7",
27-
"@babel/core": "^7.15.5",
28-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
29-
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
25+
"@babel/code-frame": "^7.18.6",
26+
"@babel/core": "^7.18.10",
27+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
28+
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
3029
"@rollup/plugin-babel": "^5.3.0",
3130
"@rollup/plugin-commonjs": "^22.0.0",
3231
"@rollup/plugin-node-resolve": "^13.3.0",
3332
"@types/babel__code-frame": "^7.0.3",
34-
"@types/ejs": "^3.1.0",
35-
"@types/eslint": "^8.4.1",
36-
"@types/html-minifier-terser": "^6.0.0",
37-
"@types/node": "^17.0.33",
33+
"@types/ejs": "^3.1.1",
34+
"@types/eslint": "^8.4.5",
35+
"@types/html-minifier-terser": "^6.1.0",
36+
"@types/node": "^18.6.3",
3837
"ejs": "^3.1.8",
39-
"eslint": "^8.11.0",
40-
"husky": "^8.0.1",
41-
"prettier": "^2.4.1",
42-
"rollup": "^2.70.1",
38+
"prettier": "^2.7.1",
39+
"rollup": "^2.77.2",
4340
"rollup-external-modules": "^2.0.0",
4441
"rollup-plugin-terser": "^7.0.2",
45-
"rollup-plugin-ts": "^2.0.5",
46-
"tslib": "^2.3.1",
47-
"typescript": "^4.6.2",
48-
"vite": "^2.8.6",
42+
"rollup-plugin-ts": "^3.0.2",
43+
"terser": "^5.14.2",
44+
"tslib": "^2.4.0",
45+
"typescript": "^4.7.4",
46+
"vite": "^3.0.4",
4947
"vite-plugin-checker": "^0.4.3",
50-
"vite-plugin-html": "^2.1.0"
48+
"vite-plugin-html": "^3.2.0",
49+
"vite-plugin-pwa": "^0.12.3"
5150
},
5251
"description": "Pi calculation, multithreading, based on large number frames decimal.js and webworker 圆周率计算,多线程,基于大数框架 decimal.js 和 webworker 圆周率计算-可设置圆周率位数-可选择线程个数-多线程大数框架 webworker 输出 useragent 大数框架",
5352
"bugs": {
@@ -68,6 +67,7 @@
6867
"resolutions": {
6968
"minimist": "1.2.6",
7069
"async": "3.2.3",
70+
"terser": "^5.14.2",
7171
"ejs": "3.1.8"
7272
}
7373
}

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default defineConfig({
2525
output: { beautify: true, comments: false },
2626
}),
2727
],
28-
input: "src/index.ts",
28+
input: "./src/index.ts",
2929
output: [
3030
{ format: "esm", file: "dist/index.js" },
3131
{ format: "cjs", file: "dist/index.cjs" },

src/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4+
<script type="module" src="./register.ts"></script>
45
<link
56
rel="stylesheet"
67
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css"

src/register.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
!(async () => {
2+
if (process.env.NODE_ENV === "production") {
3+
//@ts-ignore
4+
const { registerSW } = await import("virtual:pwa-register");
5+
6+
registerSW({})().catch(() => {});
7+
}
8+
})();

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"include": ["src", "vite.config.ts"],
33
"compilerOptions": {
44
"moduleResolution": "node",
5-
"skipDefaultLibCheck": false,
6-
"skipLibCheck": false,
5+
"skipDefaultLibCheck": true,
6+
"skipLibCheck": true,
77
"allowJs": false,
88
"checkJs": false,
99
"types": ["vite/client"],

vite.config.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
import path, { resolve } from "path";
22
import { defineConfig } from "vite";
3-
import { minifyHtml } from "vite-plugin-html";
3+
import { createHtmlPlugin } from "vite-plugin-html";
44
import checker from "vite-plugin-checker";
5+
import { VitePWA } from "vite-plugin-pwa";
56
export default defineConfig({
67
esbuild: { drop: ["console", "debugger"] },
78
plugins: [
8-
minifyHtml({ removeAttributeQuotes: false }),
9+
VitePWA({
10+
registerType: "autoUpdate",
11+
workbox: { globPatterns: ["*/*"] },
12+
}),
13+
createHtmlPlugin({
14+
minify: {
15+
removeAttributeQuotes: false,
16+
removeComments: true,
17+
removeTagWhitespace: true,
18+
collapseWhitespace: true,
19+
},
20+
}),
921
checker({ typescript: { root: path.resolve(__dirname) } }),
1022
],
1123
root: resolve(__dirname, "src"),
1224
build: {
1325
minify: "terser",
1426
target: "es2015",
1527
terserOptions: {
16-
output: { comments: false },
28+
format: { comments: false },
1729
compress: { drop_console: true, drop_debugger: true },
1830
},
1931
},

0 commit comments

Comments
 (0)