ms-vite-plugin 0.5.1 → 0.5.3

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.
Binary file
Binary file
package/dist/build.js CHANGED
@@ -42,7 +42,19 @@ const fsExtra = __importStar(require("fs-extra"));
42
42
  const path = __importStar(require("path"));
43
43
  const vite_1 = require("vite");
44
44
  const vite_plugin_bundle_obfuscator_1 = __importDefault(require("vite-plugin-bundle-obfuscator"));
45
- const zip_a_folder_1 = require("zip-a-folder");
45
+ const archiver_1 = __importDefault(require("archiver"));
46
+ async function zipDirectory(source, out) {
47
+ const archive = (0, archiver_1.default)("zip", { zlib: { level: 9 } });
48
+ const stream = fsExtra.createWriteStream(out);
49
+ return new Promise((resolve, reject) => {
50
+ archive
51
+ .directory(source, false)
52
+ .on("error", (err) => reject(err))
53
+ .pipe(stream);
54
+ stream.on("close", () => resolve());
55
+ archive.finalize();
56
+ });
57
+ }
46
58
  /**
47
59
  * 查找入口文件:main.js/main.ts 和所有以 _thread 结尾的 JS/TS 文件
48
60
  * @param src 源目录路径
@@ -204,11 +216,6 @@ const buildAll = async (isDev = true, workspacePath) => {
204
216
  const r = (0, child_process_1.spawnSync)(py.path, ["-m", "compileall", "scripts"], {
205
217
  encoding: "utf8",
206
218
  cwd: outPath,
207
- env: {
208
- ...process.env,
209
- PYTHONIOENCODING: "utf-8",
210
- PYTHONUTF8: "1",
211
- },
212
219
  });
213
220
  if (r.status === 0) {
214
221
  console.log("✅ 成功编译所有 Python 文件");
@@ -239,7 +246,7 @@ const buildAll = async (isDev = true, workspacePath) => {
239
246
  await fsExtra.emptyDir(distPath);
240
247
  const zipPath = path.join(distPath, "ms.zip");
241
248
  const msbundlePath = path.join(distPath, "ms.msbundle");
242
- await (0, zip_a_folder_1.zip)(outPath, zipPath);
249
+ await zipDirectory(outPath, zipPath);
243
250
  await fsExtra.rename(zipPath, msbundlePath);
244
251
  await fsExtra.remove(outPath);
245
252
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -23,11 +23,12 @@
23
23
  "fs-extra": "^11.3.3",
24
24
  "vite": "^7.3.0",
25
25
  "vite-plugin-bundle-obfuscator": "^1.10.0",
26
- "zip-a-folder": "^4.0.4"
26
+ "archiver": "^7.0.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/fs-extra": "^11.0.4",
30
30
  "@types/node": "^25.0.3",
31
+ "@types/archiver": "^7.0.0",
31
32
  "typescript": "~5.9.3"
32
33
  }
33
34
  }