@pygmalionjs/pygmalion 0.7.1 → 0.7.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.
@@ -1,5 +1,5 @@
1
1
  import type { InspectApplyPayload } from './inspect';
2
- import type { EditorTransport } from '../contract/transport.js';
2
+ import type { EditorTransport, TransportCallOptions } from '../contract/transport.js';
3
3
  import type { DesignCodegenData } from './designCompiler';
4
4
  export interface InspectQaArtifactHash {
5
5
  domStructureHash: string;
@@ -61,4 +61,4 @@ export declare function inspectQaFrameIds(payload: InspectApplyPayload, eligible
61
61
  * and strictly normalizes its answer. Artifact paths are accepted only under
62
62
  * the transport's QA artifact prefix and come back resolved for the document.
63
63
  */
64
- export declare function requestInspectQaCapture(transport: EditorTransport, request: InspectQaCaptureRequest): Promise<InspectQaResult>;
64
+ export declare function requestInspectQaCapture(transport: EditorTransport, request: InspectQaCaptureRequest, options?: TransportCallOptions): Promise<InspectQaResult>;
@@ -272,6 +272,32 @@ async function git(cwd, ...args) {
272
272
  return run('git', ['-C', cwd, ...args]);
273
273
  }
274
274
 
275
+ /**
276
+ * Spawn options for the dependency install command.
277
+ *
278
+ * Package managers on Windows are `.cmd` shims (`npm.cmd`, `pnpm.cmd`,
279
+ * `yarn.cmd`), and CreateProcess cannot start those: spawning the bare name
280
+ * fails with ENOENT, and since Node 20.12 naming the `.cmd` file explicitly
281
+ * fails with EINVAL. Only a shell resolves them, so on Windows the install
282
+ * goes through one unless the host pointed at an `.exe`. Git is an `.exe`
283
+ * and never needs this. Install arguments are plain tokens, which is what
284
+ * the shell path can carry safely.
285
+ */
286
+ export function dependencyInstallSpawnOptions(command, platform = process.platform) {
287
+ if (platform !== 'win32') return {};
288
+ if (path.extname(command).toLowerCase() === '.exe') return {};
289
+ return { shell: true };
290
+ }
291
+
292
+ async function runDependencyInstall(dependencies, cwd) {
293
+ const command = dependencies.installCommand ?? 'npm';
294
+ await run(
295
+ command,
296
+ dependencies.installArgs ?? ['install', '--no-audit', '--no-fund'],
297
+ { cwd, ...dependencyInstallSpawnOptions(command) },
298
+ );
299
+ }
300
+
275
301
  async function exists(target) {
276
302
  try {
277
303
  await fsp.access(target);
@@ -1493,11 +1519,7 @@ export function pygmalionDevMirrorPlugin(options) {
1493
1519
  const stampFile = path.join(nodeModules, '.pygmalion-dev-lock');
1494
1520
  if (!(await exists(lockFile))) {
1495
1521
  if (await exists(nodeModules)) return false;
1496
- await run(
1497
- dependencies.installCommand ?? 'npm',
1498
- dependencies.installArgs ?? ['install', '--no-audit', '--no-fund'],
1499
- { cwd: mirrorAppRoot },
1500
- );
1522
+ await runDependencyInstall(dependencies, mirrorAppRoot);
1501
1523
  return true;
1502
1524
  }
1503
1525
  const lockHash = await fileHash(lockFile);
@@ -1521,11 +1543,7 @@ export function pygmalionDevMirrorPlugin(options) {
1521
1543
  if (await exists(nodeModules)) return false;
1522
1544
  }
1523
1545
  }
1524
- await run(
1525
- dependencies.installCommand ?? 'npm',
1526
- dependencies.installArgs ?? ['install', '--no-audit', '--no-fund'],
1527
- { cwd: mirrorAppRoot },
1528
- );
1546
+ await runDependencyInstall(dependencies, mirrorAppRoot);
1529
1547
  await fsp.writeFile(stampFile, `${lockHash}\n`);
1530
1548
  return true;
1531
1549
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pygmalionjs/pygmalion",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Code-backed DOM design sandbox and visual QA editor",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {