forge-jsxy 1.0.82 → 1.0.83

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.
@@ -10,7 +10,7 @@
10
10
  <link rel="apple-touch-icon" href="/forge-explorer-favicon.svg"/>
11
11
  <link rel="stylesheet" href="/forge-explorer-codicons/codicon.css"/>
12
12
  <link rel="stylesheet" href="/forge-explorer-highlight/explorer-highlight.css"/>
13
- <!-- forge-jsxy@1.0.82 reconnect-ui npm-isolated-cache hub-20gib-delete-watch -->
13
+ <!-- forge-jsxy@1.0.83 reconnect-ui npm-isolated-cache hub-20gib-delete-watch -->
14
14
  <script>
15
15
  (function () {
16
16
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forge-jsxy",
3
- "version": "1.0.82",
3
+ "version": "1.0.83",
4
4
  "description": "Node.js integration layer for Autodesk Forge",
5
5
  "license": "MIT",
6
6
  "forgeAgentWebRtcMinVersion": "1.0.71",
@@ -79,6 +79,40 @@ function npmEnv() {
79
79
  };
80
80
  }
81
81
 
82
+ /**
83
+ * Run npm subcommands with argv-style args.
84
+ * Windows: `shell: true` so `npm.cmd` resolves from PATH like npm's own lifecycle scripts (Git Bash /
85
+ * non-interactive spawn often returns `status: null` without shell when PATH differs).
86
+ */
87
+ function npmSpawnSync(npmArgv, extraOptions) {
88
+ const cmd = npmCmd();
89
+ const merged = {
90
+ encoding: "utf8",
91
+ windowsHide: true,
92
+ env: npmEnv(),
93
+ ...extraOptions,
94
+ };
95
+ if (process.platform === "win32") {
96
+ return spawnSync(cmd, npmArgv, { ...merged, shell: true });
97
+ }
98
+ return spawnSync(cmd, npmArgv, merged);
99
+ }
100
+
101
+ /** When stderr/stdout are empty but status is null or non-zero — explain spawn/PATH/signal. */
102
+ function formatSpawnFailure(pr, label) {
103
+ const io = (pr.stderr || pr.stdout || "").trim();
104
+ if (io) return io.slice(0, 2000);
105
+ const parts = [`${label}: subprocess failed`];
106
+ if (pr.status !== null && pr.status !== undefined) parts.push(`exit=${pr.status}`);
107
+ else parts.push("exit=null (npm not started — PATH/npm.cmd, antivirus, or shell issue)");
108
+ if (pr.signal) parts.push(`signal=${pr.signal}`);
109
+ if (pr.error) parts.push(pr.error.message || String(pr.error));
110
+ parts.push(
111
+ "Windows: prefer cmd.exe or PowerShell for npm install; ensure Node/npm are on PATH; folder paths with spaces sometimes confuse tooling."
112
+ );
113
+ return parts.join(" — ");
114
+ }
115
+
82
116
  /**
83
117
  * @returns {{ ok: boolean, tgzPath: string, error?: string }}
84
118
  */
@@ -88,18 +122,15 @@ function npmPackToDir(packDir) {
88
122
  } catch (e) {
89
123
  return { ok: false, tgzPath: "", error: e instanceof Error ? e.message : String(e) };
90
124
  }
91
- const pr = spawnSync(npmCmd(), ["pack", pkgRoot, "--pack-destination", packDir], {
125
+ const pr = npmSpawnSync(["pack", pkgRoot, "--pack-destination", packDir], {
92
126
  cwd: packDir,
93
- encoding: "utf8",
94
- windowsHide: true,
95
- env: npmEnv(),
96
127
  maxBuffer: 10 * 1024 * 1024,
97
128
  });
98
129
  if (pr.status !== 0) {
99
130
  return {
100
131
  ok: false,
101
132
  tgzPath: "",
102
- error: (pr.stderr || pr.stdout || "").trim() || `npm pack exit ${pr.status}`,
133
+ error: formatSpawnFailure(pr, "npm pack"),
103
134
  };
104
135
  }
105
136
  const lines = (pr.stdout || "")
@@ -129,11 +160,8 @@ function npmInstallTgzLocalPrefix(tgzPath, prefixRoot) {
129
160
  "--no-fund",
130
161
  ];
131
162
  const cwd = existsSync(prefixRoot) ? prefixRoot : os.tmpdir();
132
- return spawnSync(npmCmd(), args, {
163
+ return npmSpawnSync(args, {
133
164
  cwd,
134
- encoding: "utf8",
135
- windowsHide: true,
136
- env: npmEnv(),
137
165
  maxBuffer: 40 * 1024 * 1024,
138
166
  });
139
167
  }
@@ -187,8 +215,13 @@ export function bootstrapDurableForgeJsxy() {
187
215
 
188
216
  const r = npmInstallTgzLocalPrefix(tgzPath, versionDir);
189
217
  if (r.status !== 0) {
190
- const err = (r.stderr || r.stdout || "").trim() || `npm install exit ${r.status}`;
191
- return { ok: false, distDir: "", versionDir, version, error: err };
218
+ return {
219
+ ok: false,
220
+ distDir: "",
221
+ versionDir,
222
+ version,
223
+ error: formatSpawnFailure(r, "npm install (durable prefix)"),
224
+ };
192
225
  }
193
226
 
194
227
  const distDir = resolveDistDirUnderLocalPrefix(versionDir);