befly-vscode 1.8.0 → 1.10.0

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.
@@ -18,7 +18,7 @@ export default {
18
18
  enabled: isBuild,
19
19
  analyzerMode: "static",
20
20
  openAnalyzer: false,
21
- fileName: "bundle-analyzer.html",
21
+ fileName: () => path.join(pkgDir, ".temp", "bundle-analyzer.html"),
22
22
  reportTitle: "WebView Bundle",
23
23
  defaultSizes: "gzip"
24
24
  })
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "befly-vscode",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "private": false,
5
5
  "description": "Befly VSCode - VSCode 扩展构建工具集",
6
6
  "bin": {
7
- "vscode-release": "scripts/release.mjs"
7
+ "vscode-release": "scripts/release.js"
8
8
  },
9
9
  "files": [
10
10
  "utils/",
@@ -25,8 +25,6 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@vitejs/plugin-vue": "^6.0.7",
28
- "@vscode/vsce": "^3.9.2",
29
- "javascript-obfuscator": "^5.4.3",
30
28
  "vite-bundle-analyzer": "^1.3.8"
31
29
  },
32
30
  "engines": {
@@ -1,16 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from "node:child_process";
3
3
  /* eslint-disable no-console */
4
- import { createRequire } from "node:module";
5
4
  import { dirname, resolve } from "node:path";
6
5
  import { fileURLToPath } from "node:url";
7
6
 
8
7
  const dirname2 = dirname(fileURLToPath(import.meta.url));
9
- const require = createRequire(import.meta.url);
10
8
 
11
- const obfuscatorBin = resolve(require.resolve("javascript-obfuscator/package.json"), "../bin/javascript-obfuscator");
12
9
  const obfuscatorConfig = resolve(dirname2, "../configs/obfuscator.config.json");
13
- const vsceBin = resolve(require.resolve("@vscode/vsce/package.json"), "../vsce");
14
10
 
15
11
  const type = process.argv[2];
16
12
  const allowed = ["major", "minor", "patch"];
@@ -23,20 +19,22 @@ if (!allowed.includes(type)) {
23
19
  process.exit(1);
24
20
  }
25
21
 
22
+ const shell = process.platform === "win32";
23
+
26
24
  function run(cmd, args) {
27
- return new Promise((resolve, reject) => {
28
- const child = spawn(cmd, args, { stdio: "inherit", env: process.env });
29
- child.on("error", reject);
25
+ return new Promise((onOk, onErr) => {
26
+ const child = spawn(cmd, args, { stdio: "inherit", env: process.env, shell: shell });
27
+ child.on("error", onErr);
30
28
  child.on("exit", (code) => {
31
29
  if (code === 0) {
32
- resolve();
30
+ onOk();
33
31
  return;
34
32
  }
35
- reject(new Error(`命令执行失败: ${cmd} ${args.join(" ")}`));
33
+ onErr(new Error(`命令执行失败: ${cmd} ${args.join(" ")}`));
36
34
  });
37
35
  });
38
36
  }
39
37
 
40
- await run("node", [obfuscatorBin, "./dist/extension.mjs", "--output", "./dist/extension.mjs", "--config", obfuscatorConfig]);
38
+ await run("javascript-obfuscator", ["./dist/extension.mjs", "--output", "./dist/extension.mjs", "--config", obfuscatorConfig]);
41
39
 
42
- await run("node", [vsceBin, "publish", type, "--no-dependencies", "--no-git-tag-version", "--allow-missing-repository", "--allow-unused-files-pattern", "--skip-license", "--skip-duplicate", "--baseImagesUrl", ".", "--baseContentUrl", "."]);
40
+ await run("vsce", ["publish", type, "--no-dependencies", "--no-git-tag-version", "--allow-missing-repository", "--allow-unused-files-pattern", "--skip-license", "--skip-duplicate", "--baseImagesUrl", ".", "--baseContentUrl", "."]);