ms-vite-plugin 0.5.0 → 0.5.2

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 +14 -2
  2. package/package.json +3 -2
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 源目录路径
@@ -234,7 +246,7 @@ const buildAll = async (isDev = true, workspacePath) => {
234
246
  await fsExtra.emptyDir(distPath);
235
247
  const zipPath = path.join(distPath, "ms.zip");
236
248
  const msbundlePath = path.join(distPath, "ms.msbundle");
237
- await (0, zip_a_folder_1.zip)(outPath, zipPath);
249
+ await zipDirectory(outPath, zipPath);
238
250
  await fsExtra.rename(zipPath, msbundlePath);
239
251
  await fsExtra.remove(outPath);
240
252
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
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
  }