ms-vite-plugin 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/linux/ms-bundle-enc +0 -0
- package/bin/mac/ms-bundle-enc +0 -0
- package/dist/build.js +3 -42
- package/package.json +34 -34
package/bin/linux/ms-bundle-enc
CHANGED
|
File without changes
|
package/bin/mac/ms-bundle-enc
CHANGED
|
File without changes
|
package/dist/build.js
CHANGED
|
@@ -37,12 +37,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.buildAll = void 0;
|
|
40
|
-
const
|
|
40
|
+
const child_process_1 = require("child_process");
|
|
41
41
|
const fsExtra = __importStar(require("fs-extra"));
|
|
42
42
|
const path = __importStar(require("path"));
|
|
43
43
|
const vite_1 = require("vite");
|
|
44
|
-
const child_process_1 = require("child_process");
|
|
45
44
|
const vite_plugin_bundle_obfuscator_1 = __importDefault(require("vite-plugin-bundle-obfuscator"));
|
|
45
|
+
const zip_a_folder_1 = require("zip-a-folder");
|
|
46
46
|
/**
|
|
47
47
|
* 查找入口文件:main.js/main.ts 和所有以 _thread 结尾的 JS/TS 文件
|
|
48
48
|
* @param src 源目录路径
|
|
@@ -70,44 +70,6 @@ async function findEntryFiles(src, baseDir) {
|
|
|
70
70
|
await walk(src);
|
|
71
71
|
return result;
|
|
72
72
|
}
|
|
73
|
-
/**
|
|
74
|
-
* 插件:将 main 函数调用替换为 return main();
|
|
75
|
-
* 用于开发环境,不压缩变量名
|
|
76
|
-
* @returns 返回 Vite 插件实例
|
|
77
|
-
*/
|
|
78
|
-
function devReturnMain() {
|
|
79
|
-
return {
|
|
80
|
-
name: "return-main",
|
|
81
|
-
generateBundle(_, bundle) {
|
|
82
|
-
for (const fileName in bundle) {
|
|
83
|
-
const chunk = bundle[fileName];
|
|
84
|
-
if (chunk.type === "chunk") {
|
|
85
|
-
if (chunk.code.includes("setAsyncMode(true)")) {
|
|
86
|
-
chunk.code = chunk.code.replace(/\bmain\s*\(\s*\)\s*;/g, "return main();");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* 插件:将 main 函数调用替换为 return main();
|
|
95
|
-
* 用于生产环境,压缩后执行
|
|
96
|
-
* @returns 返回 Vite 插件实例
|
|
97
|
-
*/
|
|
98
|
-
function prodReturnMain() {
|
|
99
|
-
return {
|
|
100
|
-
name: "return-main",
|
|
101
|
-
renderChunk(code, chunk) {
|
|
102
|
-
if (chunk.isEntry) {
|
|
103
|
-
if (code.includes("setAsyncMode(true)")) {
|
|
104
|
-
return code.replace(/\bmain\s*\(\s*\)\s*;/g, "return main();");
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return code;
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
73
|
/**
|
|
112
74
|
* 检测系统是否存在 Python 3.14
|
|
113
75
|
* - 依次尝试 python3.14、python3、py -3.14(Windows)
|
|
@@ -215,9 +177,8 @@ const buildAll = async (isDev = true, workspacePath) => {
|
|
|
215
177
|
minify: !isDev, // 开发环境不压缩变量名
|
|
216
178
|
},
|
|
217
179
|
plugins: isDev
|
|
218
|
-
? [
|
|
180
|
+
? []
|
|
219
181
|
: [
|
|
220
|
-
prodReturnMain(),
|
|
221
182
|
(0, vite_plugin_bundle_obfuscator_1.default)({
|
|
222
183
|
autoExcludeNodeModules: true,
|
|
223
184
|
threadPool: true,
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ms-vite-plugin",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"type": "commonjs",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"bin"
|
|
12
|
-
],
|
|
13
|
-
"bin": {
|
|
14
|
-
"ms-cli": "
|
|
15
|
-
"ms": "
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsc",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@gamely/prometheus-cli": "^0.0.9",
|
|
23
|
-
"commander": "^14.0.2",
|
|
24
|
-
"fs-extra": "^11.3.2",
|
|
25
|
-
"vite": "^7.2.
|
|
26
|
-
"vite-plugin-bundle-obfuscator": "^1.
|
|
27
|
-
"zip-a-folder": "^4.0.4"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/fs-extra": "^11.0.4",
|
|
31
|
-
"@types/node": "^
|
|
32
|
-
"typescript": "~5.9.3"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ms-vite-plugin",
|
|
3
|
+
"version": "0.3.7",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"bin"
|
|
12
|
+
],
|
|
13
|
+
"bin": {
|
|
14
|
+
"ms-cli": "dist/cli.js",
|
|
15
|
+
"ms": "dist/cli.js"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"prepublishOnly": "npm run build"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@gamely/prometheus-cli": "^0.0.9",
|
|
23
|
+
"commander": "^14.0.2",
|
|
24
|
+
"fs-extra": "^11.3.2",
|
|
25
|
+
"vite": "^7.2.7",
|
|
26
|
+
"vite-plugin-bundle-obfuscator": "^1.9.0",
|
|
27
|
+
"zip-a-folder": "^4.0.4"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/fs-extra": "^11.0.4",
|
|
31
|
+
"@types/node": "^25.0.2",
|
|
32
|
+
"typescript": "~5.9.3"
|
|
33
|
+
}
|
|
34
|
+
}
|