ms-vite-plugin 0.3.7 → 0.3.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 +1 -40
- package/package.json +2 -3
- package/bin/linux/ms-bundle-enc +0 -0
package/dist/build.js
CHANGED
|
@@ -144,7 +144,6 @@ async function normalizePythonArtifacts(rootDir) {
|
|
|
144
144
|
const buildAll = async (isDev = true, workspacePath) => {
|
|
145
145
|
const isJs = await fsExtra.pathExists(path.join(workspacePath, "scripts", "main.js"));
|
|
146
146
|
const isPy = await fsExtra.pathExists(path.join(workspacePath, "scripts", "main.py"));
|
|
147
|
-
const isLua = await fsExtra.pathExists(path.join(workspacePath, "scripts", "main.lua"));
|
|
148
147
|
if (isJs) {
|
|
149
148
|
console.log("🚀 开始构建JavaScript项目...");
|
|
150
149
|
const obfuscatorConfigPath = path.join(workspacePath, "obfuscator.json");
|
|
@@ -193,7 +192,7 @@ const buildAll = async (isDev = true, workspacePath) => {
|
|
|
193
192
|
}
|
|
194
193
|
const outPath = path.join(workspacePath, "msbundle");
|
|
195
194
|
await fsExtra.ensureDir(outPath);
|
|
196
|
-
if (isPy
|
|
195
|
+
if (isPy) {
|
|
197
196
|
await fsExtra.copy(path.join(workspacePath, "scripts"), path.join(outPath, "scripts"));
|
|
198
197
|
}
|
|
199
198
|
if (isPy) {
|
|
@@ -221,44 +220,6 @@ const buildAll = async (isDev = true, workspacePath) => {
|
|
|
221
220
|
console.warn("⚠️ 未检测到 Python 3.14,请确保在目标运行环境安装 Python 3.14");
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
|
-
else if (isLua) {
|
|
225
|
-
const scriptsDir = path.join(outPath, "scripts");
|
|
226
|
-
// 递归查找所有 .lua 文件
|
|
227
|
-
const luaFiles = [];
|
|
228
|
-
const walk = async (dir) => {
|
|
229
|
-
const entries = await fsExtra.readdir(dir, { withFileTypes: true });
|
|
230
|
-
for (const entry of entries) {
|
|
231
|
-
const full = path.join(dir, entry.name);
|
|
232
|
-
if (entry.isDirectory()) {
|
|
233
|
-
await walk(full);
|
|
234
|
-
}
|
|
235
|
-
else if (entry.isFile() && entry.name.endsWith(".lua")) {
|
|
236
|
-
luaFiles.push(full);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
await walk(scriptsDir);
|
|
241
|
-
// Prometheus CLI 路径(本插件 node_modules 内)
|
|
242
|
-
const cliPath = path.resolve(process.cwd(), "node_modules/@gamely/prometheus-cli/bin/cli.js");
|
|
243
|
-
for (const file of luaFiles) {
|
|
244
|
-
const rel = path.relative(scriptsDir, file);
|
|
245
|
-
console.log(`🛠️ 混淆 Lua: ${rel}`);
|
|
246
|
-
const r = (0, child_process_1.spawnSync)(process.execPath, [cliPath, rel, "--preset", "Medium"], { cwd: scriptsDir, encoding: "utf8" });
|
|
247
|
-
if (r.status !== 0) {
|
|
248
|
-
console.error("❌ 混淆 Lua 失败:", rel);
|
|
249
|
-
console.error(r.stderr || r.stdout || "");
|
|
250
|
-
process.exit(1);
|
|
251
|
-
}
|
|
252
|
-
const obfRel = rel.replace(/\.lua$/, ".obfuscated.lua");
|
|
253
|
-
const obfPath = path.join(scriptsDir, obfRel);
|
|
254
|
-
if (await fsExtra.pathExists(obfPath)) {
|
|
255
|
-
// 删除原文件并将混淆文件改回原文件名
|
|
256
|
-
await fsExtra.remove(file);
|
|
257
|
-
await fsExtra.move(obfPath, file, { overwrite: true });
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
console.log("✅ Lua 混淆完成");
|
|
261
|
-
}
|
|
262
223
|
// 打包完成后执行
|
|
263
224
|
await fsExtra.copy(path.join(workspacePath, "res"), path.join(outPath, "res"));
|
|
264
225
|
await fsExtra.copy(path.join(workspacePath, "ui"), path.join(outPath, "ui"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ms-vite-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"prepublishOnly": "npm run build"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@gamely/prometheus-cli": "^0.0.9",
|
|
23
22
|
"commander": "^14.0.2",
|
|
24
23
|
"fs-extra": "^11.3.2",
|
|
25
24
|
"vite": "^7.2.7",
|
|
@@ -31,4 +30,4 @@
|
|
|
31
30
|
"@types/node": "^25.0.2",
|
|
32
31
|
"typescript": "~5.9.3"
|
|
33
32
|
}
|
|
34
|
-
}
|
|
33
|
+
}
|
package/bin/linux/ms-bundle-enc
DELETED
|
Binary file
|