Jelajahi Sumber

remove license from build

Michael Wang 3 tahun lalu
induk
melakukan
a71b59e4d8
4 mengubah file dengan 45 tambahan dan 20 penghapusan
  1. 1 1
      package.json
  2. 15 15
      pnpm-lock.yaml
  3. 26 1
      prebuild.mjs
  4. 3 3
      vite.config.ts

+ 1 - 1
package.json

@@ -48,7 +48,7 @@
     "@types/crypto-js": "^4.1.1",
     "@types/js-md5": "^0.4.3",
     "@types/lodash-es": "^4.17.6",
-    "@types/node": "^17.0.32",
+    "@types/node": "^17.0.33",
     "@types/ua-parser-js": "^0.7.36",
     "@typescript-eslint/eslint-plugin": "^5.23.0",
     "@typescript-eslint/parser": "^5.23.0",

+ 15 - 15
pnpm-lock.yaml

@@ -6,7 +6,7 @@ specifiers:
   '@types/crypto-js': ^4.1.1
   '@types/js-md5': ^0.4.3
   '@types/lodash-es': ^4.17.6
-  '@types/node': ^17.0.32
+  '@types/node': ^17.0.33
   '@types/ua-parser-js': ^0.7.36
   '@typescript-eslint/eslint-plugin': ^5.23.0
   '@typescript-eslint/parser': ^5.23.0
@@ -83,7 +83,7 @@ devDependencies:
   '@types/crypto-js': 4.1.1
   '@types/js-md5': 0.4.3
   '@types/lodash-es': 4.17.6
-  '@types/node': 17.0.32
+  '@types/node': 17.0.33
   '@types/ua-parser-js': 0.7.36
   '@typescript-eslint/eslint-plugin': 5.23.0_c63nfttrfhylg3zmgcxfslaw44
   '@typescript-eslint/parser': 5.23.0_hcfsmds2fshutdssjqluwm76uu
@@ -462,7 +462,7 @@ packages:
       ajv: 6.12.6
       debug: 4.3.4
       espree: 9.3.2
-      globals: 13.14.0
+      globals: 13.15.0
       ignore: 5.2.0
       import-fresh: 3.3.0
       js-yaml: 4.1.0
@@ -588,7 +588,7 @@ packages:
   /@types/concat-stream/1.6.1:
     resolution: {integrity: sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==}
     dependencies:
-      '@types/node': 17.0.32
+      '@types/node': 17.0.33
     dev: true
 
   /@types/crypto-js/4.1.1:
@@ -598,7 +598,7 @@ packages:
   /@types/form-data/0.0.33:
     resolution: {integrity: sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==}
     dependencies:
-      '@types/node': 17.0.32
+      '@types/node': 17.0.33
     dev: true
 
   /@types/jest/27.5.1:
@@ -632,8 +632,8 @@ packages:
     resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==}
     dev: true
 
-  /@types/node/17.0.32:
-    resolution: {integrity: sha512-eAIcfAvhf/BkHcf4pkLJ7ECpBAhh9kcxRBpip9cTiO+hf+aJrsxYxBeS6OXvOd9WqNAJmavXVpZvY1rBjNsXmw==}
+  /@types/node/17.0.33:
+    resolution: {integrity: sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ==}
 
   /@types/node/7.10.14:
     resolution: {integrity: sha512-29GS75BE8asnTno3yB6ubOJOO0FboExEqNJy4bpz0GSmW/8wPTNL4h9h63c6s1uTrOopCmJYe/4yJLh5r92ZUA==}
@@ -1124,7 +1124,7 @@ packages:
       postcss: ^8.1.0
     dependencies:
       browserslist: 4.20.3
-      caniuse-lite: 1.0.30001339
+      caniuse-lite: 1.0.30001340
       fraction.js: 4.2.0
       normalize-range: 0.1.2
       picocolors: 1.0.0
@@ -1210,7 +1210,7 @@ packages:
     engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
     hasBin: true
     dependencies:
-      caniuse-lite: 1.0.30001339
+      caniuse-lite: 1.0.30001340
       electron-to-chromium: 1.4.137
       escalade: 3.1.1
       node-releases: 2.0.4
@@ -1252,8 +1252,8 @@ packages:
     engines: {node: '>=10'}
     dev: true
 
-  /caniuse-lite/1.0.30001339:
-    resolution: {integrity: sha512-Es8PiVqCe+uXdms0Gu5xP5PF2bxLR7OBp3wUzUnuO7OHzhOfCyg3hdiGWVPVxhiuniOzng+hTc1u3fEQ0TlkSQ==}
+  /caniuse-lite/1.0.30001340:
+    resolution: {integrity: sha512-jUNz+a9blQTQVu4uFcn17uAD8IDizPzQkIKh3LCJfg9BkyIqExYYdyc/ZSlWUSKb8iYiXxKsxbv4zYSvkqjrxw==}
     dev: true
 
   /caseless/0.12.0:
@@ -1425,7 +1425,7 @@ packages:
     resolution: {integrity: sha512-FMVcWsVipKEBR/mVf1+pIjCRQdztILVKxbp8TN5/Vf0Q/fdTq0OIb8JRW/pk7PP1eeWnB/ejQ0MNBe7ELjLblg==}
     dependencies:
       '@emotion/hash': 0.8.0
-      '@types/node': 17.0.32
+      '@types/node': 17.0.33
       csstype: 3.0.11
     dev: false
 
@@ -1983,7 +1983,7 @@ packages:
       file-entry-cache: 6.0.1
       functional-red-black-tree: 1.0.1
       glob-parent: 6.0.2
-      globals: 13.14.0
+      globals: 13.15.0
       ignore: 5.2.0
       import-fresh: 3.3.0
       imurmurhash: 0.1.4
@@ -2300,8 +2300,8 @@ packages:
     engines: {node: '>=4'}
     dev: true
 
-  /globals/13.14.0:
-    resolution: {integrity: sha512-ERO68sOYwm5UuLvSJTY7w7NP2c8S4UcXs3X1GBX8cwOr+ShOcDBbCY5mH4zxz0jsYCdJ8ve8Mv9n2YGJMB1aeg==}
+  /globals/13.15.0:
+    resolution: {integrity: sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==}
     engines: {node: '>=8'}
     dependencies:
       type-fest: 0.20.2

+ 26 - 1
prebuild.mjs

@@ -1,4 +1,4 @@
-import { writeFileSync } from "fs";
+import { writeFileSync, readFileSync } from "fs";
 import { execSync } from "child_process";
 import moment from "moment";
 import packageJson from "./package.json" assert { type: "json" };
@@ -13,6 +13,31 @@ if (process.argv.length < 3) {
   process.exit(1);
 }
 
+console.log("删除license注释,避免混淆文件被推测");
+let str = readFileSync(
+  "./node_modules/pinia/dist/pinia.esm-browser.js"
+).toString();
+console.log(
+  str.slice(0, 100),
+  str.replace(/\s+\* @license MIT\s*/, "").slice(0, 100)
+);
+writeFileSync(
+  "./node_modules/pinia/dist/pinia.esm-browser.js",
+  str.replace(/\s+\* @license MIT\s*/, "")
+);
+str = readFileSync("./node_modules/js-md5/src/md5.js").toString();
+writeFileSync(
+  "./node_modules/js-md5/src/md5.js",
+  str.replace(/\s+\* @license MIT\s*/, "")
+);
+str = readFileSync(
+  "./node_modules/.pnpm/sortablejs@1.14.0/node_modules/sortablejs/modular/sortable.esm.js"
+).toString();
+writeFileSync(
+  "./node_modules/.pnpm/sortablejs@1.14.0/node_modules/sortablejs/modular/sortable.esm.js",
+  str.replace(/\s+\* @license MIT\s*/, "")
+);
+
 const mode = process.argv[2];
 const validModes = ["production", "staging", "test", "dev"];
 if (!validModes.includes(mode)) {

+ 3 - 3
vite.config.ts

@@ -79,12 +79,12 @@ export default defineConfig({
               ".test41v3.qmth.com.cn",
               ".ecs.qmth.com.cn",
             ],
-            selfDefending: true,
+            // selfDefending: true,
             // sourceMap: false,
-            splitStrings: true,
+            // splitStrings: true,
             disableConsoleOutput: false,
             // // stringArrayCallsTransform: true,
-            deadCodeInjection: true,
+            // deadCodeInjection: true,
             // numbersToExpressions: true,
             controlFlowFlattening: true,
             // stringArrayEncoding: ["none", "base64", "rc4"],