ms-vite-plugin 0.2.8 → 0.2.9
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/dist/build.js +31 -0
- package/package.json +4 -4
package/dist/build.js
CHANGED
|
@@ -41,6 +41,7 @@ const zip_a_folder_1 = require("zip-a-folder");
|
|
|
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");
|
|
44
45
|
const vite_plugin_bundle_obfuscator_1 = __importDefault(require("vite-plugin-bundle-obfuscator"));
|
|
45
46
|
/**
|
|
46
47
|
* 查找入口文件:main.js/main.ts 和所有以 _thread 结尾的 JS/TS 文件
|
|
@@ -107,6 +108,28 @@ function prodReturnMain() {
|
|
|
107
108
|
},
|
|
108
109
|
};
|
|
109
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* 检测系统是否存在 Python 3.14
|
|
113
|
+
* - 依次尝试 python3.14、python3、py -3.14(Windows)
|
|
114
|
+
* - 返回检测结果与版本字符串
|
|
115
|
+
*/
|
|
116
|
+
function detectPython314() {
|
|
117
|
+
const candidates = [
|
|
118
|
+
{ cmd: "python3.14", args: ["--version"] },
|
|
119
|
+
{ cmd: "python3", args: ["--version"] },
|
|
120
|
+
];
|
|
121
|
+
for (const c of candidates) {
|
|
122
|
+
try {
|
|
123
|
+
const r = (0, child_process_1.spawnSync)(c.cmd, c.args, { encoding: "utf8" });
|
|
124
|
+
const out = (r.stdout || r.stderr || "").trim();
|
|
125
|
+
if (out && /Python\s+3\.14(\.\d+)?/i.test(out)) {
|
|
126
|
+
return { ok: true, path: c.cmd, version: out };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch { }
|
|
130
|
+
}
|
|
131
|
+
return { ok: false };
|
|
132
|
+
}
|
|
110
133
|
const buildAll = async (isDev = true, workspacePath) => {
|
|
111
134
|
const isJs = await fsExtra.pathExists(path.join(workspacePath, "scripts", "main.js"));
|
|
112
135
|
const isPy = await fsExtra.pathExists(path.join(workspacePath, "scripts", "main.py"));
|
|
@@ -161,6 +184,14 @@ const buildAll = async (isDev = true, workspacePath) => {
|
|
|
161
184
|
await fsExtra.ensureDir(outPath);
|
|
162
185
|
if (isPy) {
|
|
163
186
|
await fsExtra.copy(path.join(workspacePath, "scripts"), path.join(outPath, "scripts"));
|
|
187
|
+
// 获取系统有没有 3.14 版本的 python
|
|
188
|
+
const py = detectPython314();
|
|
189
|
+
if (py.ok) {
|
|
190
|
+
console.log(`✅ 检测到 ${py.version} (${py.path})`);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
console.warn("⚠️ 未检测到 Python 3.14,请确保在目标运行环境安装 Python 3.14");
|
|
194
|
+
}
|
|
164
195
|
}
|
|
165
196
|
// 打包完成后执行
|
|
166
197
|
await fsExtra.copy(path.join(workspacePath, "res"), path.join(outPath, "res"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ms-vite-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"commander": "^14.0.2",
|
|
23
23
|
"fs-extra": "^11.3.2",
|
|
24
|
-
"vite": "^7.2.
|
|
24
|
+
"vite": "^7.2.4",
|
|
25
25
|
"vite-plugin-bundle-obfuscator": "^1.8.0",
|
|
26
|
-
"zip-a-folder": "^
|
|
26
|
+
"zip-a-folder": "^4.0.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/fs-extra": "^11.0.4",
|
|
30
|
-
"@types/node": "^24.10.
|
|
30
|
+
"@types/node": "^24.10.1",
|
|
31
31
|
"typescript": "~5.9.3"
|
|
32
32
|
}
|
|
33
33
|
}
|