From e3ca17525849eb2df4f86d3cc6167db321fb2afb Mon Sep 17 00:00:00 2001 From: MengYX Date: Thu, 6 Feb 2020 14:05:46 +0800 Subject: [PATCH] Optimize Bundle Size --- babel.config.js | 19 +++- package-lock.json | 234 +++++++++++++++++++++++++++++++++---------- package.json | 1 + src/App.vue | 7 +- src/decrypt/mflac.js | 7 +- 5 files changed, 204 insertions(+), 64 deletions(-) diff --git a/babel.config.js b/babel.config.js index e955840..ec9cfe1 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,16 @@ module.exports = { - presets: [ - '@vue/cli-plugin-babel/preset' - ] -} + presets: [ + '@vue/cli-plugin-babel/preset', + ["@babel/preset-env", { + "useBuiltIns": "entry", + "corejs": 3, + "modules": false + }] + ], + plugins: [ + ["component", { + "libraryName": "element-ui", + "styleLibraryName": "theme-chalk" + }] + ] +}; diff --git a/package-lock.json b/package-lock.json index 328e77b..4dd27c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,28 +14,70 @@ } }, "@babel/compat-data": { - "version": "7.8.1", - "resolved": "https://registry.npm.taobao.org/@babel/compat-data/download/@babel/compat-data-7.8.1.tgz", - "integrity": "sha1-/Au7t5keT7K0fhaOYPLMLEFoC+k=", + "version": "7.8.5", + "resolved": "https://registry.npm.taobao.org/@babel/compat-data/download/@babel/compat-data-7.8.5.tgz?cache=0&sync_timestamp=1580497169646&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcompat-data%2Fdownload%2F%40babel%2Fcompat-data-7.8.5.tgz", + "integrity": "sha1-0ozocneMI1Ucu5Qy/GjShJW2E7k=", "dev": true, "requires": { - "browserslist": "^4.8.2", + "browserslist": "^4.8.5", "invariant": "^2.2.4", "semver": "^5.5.0" + }, + "dependencies": { + "browserslist": { + "version": "4.8.6", + "resolved": "https://registry.npm.taobao.org/browserslist/download/browserslist-4.8.6.tgz", + "integrity": "sha1-lkBvP18HVdJy4npm9BY8qCFZCn4=", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001023", + "electron-to-chromium": "^1.3.341", + "node-releases": "^1.1.47" + } + }, + "caniuse-lite": { + "version": "1.0.30001025", + "resolved": "https://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30001025.tgz?cache=0&sync_timestamp=1580798021168&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcaniuse-lite%2Fdownload%2Fcaniuse-lite-1.0.30001025.tgz", + "integrity": "sha1-MDNqisp/mGGOs88441GE4T1OX+Y=", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.345", + "resolved": "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.345.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron-to-chromium%2Fdownload%2Felectron-to-chromium-1.3.345.tgz", + "integrity": "sha1-JWnQ1Upk7w8ypLfoyAr6X+V8XZg=", + "dev": true + }, + "node-releases": { + "version": "1.1.47", + "resolved": "https://registry.npm.taobao.org/node-releases/download/node-releases-1.1.47.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-releases%2Fdownload%2Fnode-releases-1.1.47.tgz", + "integrity": "sha1-xZ73OaH9fsvZ8LfPW3hx6Ki1keQ=", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1580434257623&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + } } }, "@babel/core": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.8.3.tgz", - "integrity": "sha1-MLDrtN0Vhd5pI6C00XngufXYKUE=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.8.4.tgz?cache=0&sync_timestamp=1580387817329&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.8.4.tgz", + "integrity": "sha1-1JZ5nlwSGVs2AtD93XcpTj446A4=", "dev": true, "requires": { "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.8.3", - "@babel/helpers": "^7.8.3", - "@babel/parser": "^7.8.3", + "@babel/generator": "^7.8.4", + "@babel/helpers": "^7.8.4", + "@babel/parser": "^7.8.4", "@babel/template": "^7.8.3", - "@babel/traverse": "^7.8.3", + "@babel/traverse": "^7.8.4", "@babel/types": "^7.8.3", "convert-source-map": "^1.7.0", "debug": "^4.1.0", @@ -48,9 +90,9 @@ } }, "@babel/generator": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/generator/download/@babel/generator-7.8.3.tgz", - "integrity": "sha1-DiLABbCpTBx06v4Z73jOU6TUXAM=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/generator/download/@babel/generator-7.8.4.tgz?cache=0&sync_timestamp=1580387848805&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fgenerator%2Fdownload%2F%40babel%2Fgenerator-7.8.4.tgz", + "integrity": "sha1-NbvHRIaVb+QlGCn59sSDMOjQmF4=", "dev": true, "requires": { "@babel/types": "^7.8.3", @@ -90,16 +132,58 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/helper-compilation-targets/download/@babel/helper-compilation-targets-7.8.3.tgz", - "integrity": "sha1-Le7cgW/UHcpzVe85/UDJ6mnwcZo=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/helper-compilation-targets/download/@babel/helper-compilation-targets-7.8.4.tgz?cache=0&sync_timestamp=1580388006542&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-compilation-targets%2Fdownload%2F%40babel%2Fhelper-compilation-targets-7.8.4.tgz", + "integrity": "sha1-A9fs1FS36+GaJU92YX5hdwrtLIg=", "dev": true, "requires": { - "@babel/compat-data": "^7.8.1", - "browserslist": "^4.8.2", + "@babel/compat-data": "^7.8.4", + "browserslist": "^4.8.5", "invariant": "^2.2.4", - "levenary": "^1.1.0", + "levenary": "^1.1.1", "semver": "^5.5.0" + }, + "dependencies": { + "browserslist": { + "version": "4.8.6", + "resolved": "https://registry.npm.taobao.org/browserslist/download/browserslist-4.8.6.tgz", + "integrity": "sha1-lkBvP18HVdJy4npm9BY8qCFZCn4=", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001023", + "electron-to-chromium": "^1.3.341", + "node-releases": "^1.1.47" + } + }, + "caniuse-lite": { + "version": "1.0.30001025", + "resolved": "https://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30001025.tgz?cache=0&sync_timestamp=1580798021168&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcaniuse-lite%2Fdownload%2Fcaniuse-lite-1.0.30001025.tgz", + "integrity": "sha1-MDNqisp/mGGOs88441GE4T1OX+Y=", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.345", + "resolved": "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.345.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron-to-chromium%2Fdownload%2Felectron-to-chromium-1.3.345.tgz", + "integrity": "sha1-JWnQ1Upk7w8ypLfoyAr6X+V8XZg=", + "dev": true + }, + "node-releases": { + "version": "1.1.47", + "resolved": "https://registry.npm.taobao.org/node-releases/download/node-releases-1.1.47.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-releases%2Fdownload%2Fnode-releases-1.1.47.tgz", + "integrity": "sha1-xZ73OaH9fsvZ8LfPW3hx6Ki1keQ=", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1580434257623&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + } } }, "@babel/helper-create-class-features-plugin": { @@ -289,13 +373,13 @@ } }, "@babel/helpers": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/helpers/download/@babel/helpers-7.8.3.tgz?cache=0&sync_timestamp=1578951723636&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelpers%2Fdownload%2F%40babel%2Fhelpers-7.8.3.tgz", - "integrity": "sha1-OC+7A4LOfEzpBZRauWQdaIM2zoU=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/helpers/download/@babel/helpers-7.8.4.tgz?cache=0&sync_timestamp=1580388006568&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelpers%2Fdownload%2F%40babel%2Fhelpers-7.8.4.tgz", + "integrity": "sha1-dU6z7nJ8Fl4KJA1sIH3nxFXzb3M=", "dev": true, "requires": { "@babel/template": "^7.8.3", - "@babel/traverse": "^7.8.3", + "@babel/traverse": "^7.8.4", "@babel/types": "^7.8.3" } }, @@ -311,9 +395,9 @@ } }, "@babel/parser": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/parser/download/@babel/parser-7.8.3.tgz", - "integrity": "sha1-eQh0CR0gAcm+bsQmwu7Ue8dnkIE=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/parser/download/@babel/parser-7.8.4.tgz?cache=0&sync_timestamp=1580387974017&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fparser%2Fdownload%2F%40babel%2Fparser-7.8.4.tgz", + "integrity": "sha1-0dvmRpHWA1ipdClfpT2gdN0s6Og=", "dev": true }, "@babel/plugin-proposal-async-generator-functions": { @@ -611,9 +695,9 @@ } }, "@babel/plugin-transform-for-of": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/plugin-transform-for-of/download/@babel/plugin-transform-for-of-7.8.3.tgz?cache=0&sync_timestamp=1578951936196&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-transform-for-of%2Fdownload%2F%40babel%2Fplugin-transform-for-of-7.8.3.tgz", - "integrity": "sha1-FfF7zi/JXH1ZokspnoPoHO3CLhg=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/plugin-transform-for-of/download/@babel/plugin-transform-for-of-7.8.4.tgz?cache=0&sync_timestamp=1580387848578&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-transform-for-of%2Fdownload%2F%40babel%2Fplugin-transform-for-of-7.8.4.tgz", + "integrity": "sha1-b+jq5daHUIbuGF3QsJioUTeDtH0=", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.8.3" @@ -721,9 +805,9 @@ } }, "@babel/plugin-transform-parameters": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/plugin-transform-parameters/download/@babel/plugin-transform-parameters-7.8.3.tgz", - "integrity": "sha1-eJBXahOxcyXYt9RMs38h3Du92lk=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/plugin-transform-parameters/download/@babel/plugin-transform-parameters-7.8.4.tgz?cache=0&sync_timestamp=1580387848572&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-transform-parameters%2Fdownload%2F%40babel%2Fplugin-transform-parameters-7.8.4.tgz", + "integrity": "sha1-HVFV3gtl2wzPmXEWV0XTu5kNd9M=", "dev": true, "requires": { "@babel/helper-call-delegate": "^7.8.3", @@ -809,9 +893,9 @@ } }, "@babel/plugin-transform-typeof-symbol": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/plugin-transform-typeof-symbol/download/@babel/plugin-transform-typeof-symbol-7.8.3.tgz?cache=0&sync_timestamp=1578953126454&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-transform-typeof-symbol%2Fdownload%2F%40babel%2Fplugin-transform-typeof-symbol-7.8.3.tgz", - "integrity": "sha1-XP+yFvslyMZLpr9fds5J06sHn00=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/plugin-transform-typeof-symbol/download/@babel/plugin-transform-typeof-symbol-7.8.4.tgz", + "integrity": "sha1-7eQGIxXOCq+KZXqSCFjxovNfxBI=", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.8.3" @@ -828,13 +912,13 @@ } }, "@babel/preset-env": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/preset-env/download/@babel/preset-env-7.8.3.tgz", - "integrity": "sha1-3A+yk49Su93XmzyGGks0J906bFQ=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/preset-env/download/@babel/preset-env-7.8.4.tgz?cache=0&sync_timestamp=1580388072547&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fpreset-env%2Fdownload%2F%40babel%2Fpreset-env-7.8.4.tgz", + "integrity": "sha1-naxt9fQjAV09Sbbp5fo0E+SnLE4=", "dev": true, "requires": { - "@babel/compat-data": "^7.8.0", - "@babel/helper-compilation-targets": "^7.8.3", + "@babel/compat-data": "^7.8.4", + "@babel/helper-compilation-targets": "^7.8.4", "@babel/helper-module-imports": "^7.8.3", "@babel/helper-plugin-utils": "^7.8.3", "@babel/plugin-proposal-async-generator-functions": "^7.8.3", @@ -863,7 +947,7 @@ "@babel/plugin-transform-dotall-regex": "^7.8.3", "@babel/plugin-transform-duplicate-keys": "^7.8.3", "@babel/plugin-transform-exponentiation-operator": "^7.8.3", - "@babel/plugin-transform-for-of": "^7.8.3", + "@babel/plugin-transform-for-of": "^7.8.4", "@babel/plugin-transform-function-name": "^7.8.3", "@babel/plugin-transform-literals": "^7.8.3", "@babel/plugin-transform-member-expression-literals": "^7.8.3", @@ -874,7 +958,7 @@ "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", "@babel/plugin-transform-new-target": "^7.8.3", "@babel/plugin-transform-object-super": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.8.4", "@babel/plugin-transform-property-literals": "^7.8.3", "@babel/plugin-transform-regenerator": "^7.8.3", "@babel/plugin-transform-reserved-words": "^7.8.3", @@ -882,14 +966,56 @@ "@babel/plugin-transform-spread": "^7.8.3", "@babel/plugin-transform-sticky-regex": "^7.8.3", "@babel/plugin-transform-template-literals": "^7.8.3", - "@babel/plugin-transform-typeof-symbol": "^7.8.3", + "@babel/plugin-transform-typeof-symbol": "^7.8.4", "@babel/plugin-transform-unicode-regex": "^7.8.3", "@babel/types": "^7.8.3", - "browserslist": "^4.8.2", + "browserslist": "^4.8.5", "core-js-compat": "^3.6.2", "invariant": "^2.2.2", - "levenary": "^1.1.0", + "levenary": "^1.1.1", "semver": "^5.5.0" + }, + "dependencies": { + "browserslist": { + "version": "4.8.6", + "resolved": "https://registry.npm.taobao.org/browserslist/download/browserslist-4.8.6.tgz", + "integrity": "sha1-lkBvP18HVdJy4npm9BY8qCFZCn4=", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001023", + "electron-to-chromium": "^1.3.341", + "node-releases": "^1.1.47" + } + }, + "caniuse-lite": { + "version": "1.0.30001025", + "resolved": "https://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30001025.tgz?cache=0&sync_timestamp=1580798021168&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcaniuse-lite%2Fdownload%2Fcaniuse-lite-1.0.30001025.tgz", + "integrity": "sha1-MDNqisp/mGGOs88441GE4T1OX+Y=", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.345", + "resolved": "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.345.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron-to-chromium%2Fdownload%2Felectron-to-chromium-1.3.345.tgz", + "integrity": "sha1-JWnQ1Upk7w8ypLfoyAr6X+V8XZg=", + "dev": true + }, + "node-releases": { + "version": "1.1.47", + "resolved": "https://registry.npm.taobao.org/node-releases/download/node-releases-1.1.47.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-releases%2Fdownload%2Fnode-releases-1.1.47.tgz", + "integrity": "sha1-xZ73OaH9fsvZ8LfPW3hx6Ki1keQ=", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1580434257623&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + } } }, "@babel/runtime": { @@ -913,16 +1039,16 @@ } }, "@babel/traverse": { - "version": "7.8.3", - "resolved": "https://registry.npm.taobao.org/@babel/traverse/download/@babel/traverse-7.8.3.tgz?cache=0&sync_timestamp=1578951726386&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftraverse%2Fdownload%2F%40babel%2Ftraverse-7.8.3.tgz", - "integrity": "sha1-qCYhWwEcm09z86iTr7wFFRNYv5o=", + "version": "7.8.4", + "resolved": "https://registry.npm.taobao.org/@babel/traverse/download/@babel/traverse-7.8.4.tgz?cache=0&sync_timestamp=1580387975267&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftraverse%2Fdownload%2F%40babel%2Ftraverse-7.8.4.tgz", + "integrity": "sha1-8IRYIjZfnVsOMS7TlZ0/gn+Gnjw=", "dev": true, "requires": { "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.8.3", + "@babel/generator": "^7.8.4", "@babel/helper-function-name": "^7.8.3", "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/parser": "^7.8.3", + "@babel/parser": "^7.8.4", "@babel/types": "^7.8.3", "debug": "^4.1.0", "globals": "^11.1.0", @@ -6663,9 +6789,9 @@ "dev": true }, "levenary": { - "version": "1.1.0", - "resolved": "https://registry.npm.taobao.org/levenary/download/levenary-1.1.0.tgz", - "integrity": "sha1-/BRv518y3Eg6Cixkrvcg9gLNYhA=", + "version": "1.1.1", + "resolved": "https://registry.npm.taobao.org/levenary/download/levenary-1.1.1.tgz", + "integrity": "sha1-hCqe6Y0gdap/ru2+MmeekgX0b3c=", "dev": true, "requires": { "leven": "^3.1.0" diff --git a/package.json b/package.json index 5677bce..388c81f 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "vue": "^2.6.11" }, "devDependencies": { + "@babel/preset-env": "^7.8.4", "@vue/cli-plugin-babel": "^4.1.2", "@vue/cli-plugin-pwa": "^4.1.2", "@vue/cli-service": "^4.1.2", diff --git a/src/App.vue b/src/App.vue index ce92925..972aef3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -96,8 +96,6 @@ // 严格模式 用于尾调用优化 "use strict"; - const worker = require("workerize-loader!./decrypt/common"); - const dec = require('./decrypt/common'); export default { name: 'app', components: {}, @@ -132,12 +130,15 @@ this.finishLoad(); }); if (document.location.host !== "") { - this.thread_num = Math.max(navigator.hardwareConcurrency, 1); + //todo: Fail on Hot Reload + const worker = require("workerize-loader!./decrypt/common"); + this.thread_num = navigator.hardwareConcurrency || 1; for (let i = 0; i < this.thread_num; i++) { this.workers.push(worker().CommonDecrypt); this.idle_workers.push(i); } } else { + const dec = require('./decrypt/common'); this.workers.push(dec.CommonDecrypt); this.idle_workers.push(0) } diff --git a/src/decrypt/mflac.js b/src/decrypt/mflac.js index c30a606..ec27afa 100644 --- a/src/decrypt/mflac.js +++ b/src/decrypt/mflac.js @@ -1,6 +1,7 @@ const musicMetadata = require("music-metadata-browser"); const util = require("./util"); export {Decrypt} +const FLAC_HEADER = [0x66, 0x4C, 0x61, 0x43, 0x00]; async function Decrypt(file, raw_filename, raw_ext) { // 获取扩展名 @@ -45,7 +46,7 @@ async function Decrypt(file, raw_filename, raw_ext) { } class Mask { - FLAC_HEADER = [0x66, 0x4C, 0x61, 0x43, 0x00]; + constructor() { this.index = -1; @@ -69,9 +70,9 @@ class Mask { if (!flag) continue; - for (let test_idx = 0; test_idx < this.FLAC_HEADER.length; test_idx++) { + for (let test_idx = 0; test_idx < FLAC_HEADER.length; test_idx++) { let p = data[test_idx] ^ mask[test_idx]; - if (p !== this.FLAC_HEADER[test_idx]) { + if (p !== FLAC_HEADER[test_idx]) { flag = false; debugger; break;