ms-vite-plugin 0.3.3 → 0.3.5

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.
Files changed (2) hide show
  1. package/dist/build.js +9 -2
  2. package/package.json +1 -1
package/dist/build.js CHANGED
@@ -278,16 +278,23 @@ const buildAll = async (isDev = true, workspacePath) => {
278
278
  };
279
279
  await walk(scriptsDir);
280
280
  // Prometheus CLI 路径(本插件 node_modules 内)
281
- const cliPath = path.resolve(__dirname, "../node_modules/@gamely/prometheus-cli/bin/cli.js");
281
+ const cliPath = path.resolve(process.cwd(), "node_modules/@gamely/prometheus-cli/bin/cli.js");
282
282
  for (const file of luaFiles) {
283
283
  const rel = path.relative(scriptsDir, file);
284
284
  console.log(`🛠️ 混淆 Lua: ${rel}`);
285
- const r = (0, child_process_1.spawnSync)(process.execPath, [cliPath, rel, "--preset", "Minify"], { cwd: scriptsDir, encoding: "utf8" });
285
+ const r = (0, child_process_1.spawnSync)(process.execPath, [cliPath, rel, "--preset", "Medium"], { cwd: scriptsDir, encoding: "utf8" });
286
286
  if (r.status !== 0) {
287
287
  console.error("❌ 混淆 Lua 失败:", rel);
288
288
  console.error(r.stderr || r.stdout || "");
289
289
  process.exit(1);
290
290
  }
291
+ const obfRel = rel.replace(/\.lua$/, ".obfuscated.lua");
292
+ const obfPath = path.join(scriptsDir, obfRel);
293
+ if (await fsExtra.pathExists(obfPath)) {
294
+ // 删除原文件并将混淆文件改回原文件名
295
+ await fsExtra.remove(file);
296
+ await fsExtra.move(obfPath, file, { overwrite: true });
297
+ }
291
298
  }
292
299
  console.log("✅ Lua 混淆完成");
293
300
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {