@wix/evalforge-evaluator 0.195.0 → 0.196.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.
package/build/index.mjs CHANGED
@@ -7402,7 +7402,6 @@ import { createHash } from "crypto";
7402
7402
  import path from "path";
7403
7403
  import { spawn, execFileSync } from "child_process";
7404
7404
  var INSTALL_TIMEOUT_MS = 1e5;
7405
- var PNPM_BOOTSTRAP_TIMEOUT_MS = 6e4;
7406
7405
  var HEARTBEAT_INTERVAL_MS = 5e3;
7407
7406
  function reportRegistry(workDir, onProgress) {
7408
7407
  try {
@@ -7491,80 +7490,36 @@ function cloneDirectory(src, dest) {
7491
7490
  cpSync(src, dest, { recursive: true });
7492
7491
  }
7493
7492
  }
7494
- async function runCommand(exec, cmd, args, workDir, onProgress, label, timeoutMs) {
7495
- onProgress(`[diag] ${label} starting: ${cmd} ${args.join(" ")}`);
7493
+ async function runInstall(exec, pm, workDir, onProgress) {
7494
+ reportRegistry(workDir, onProgress);
7495
+ onProgress(`[diag] npm install starting: ${pm.cmd} ${pm.args.join(" ")}`);
7496
7496
  const startedAt = Date.now();
7497
7497
  const heartbeat = setInterval(() => {
7498
7498
  onProgress(
7499
- `[diag] ${label} still running: ${Math.round(
7499
+ `[diag] npm install still running: ${Math.round(
7500
7500
  (Date.now() - startedAt) / 1e3
7501
7501
  )}s elapsed`
7502
7502
  );
7503
7503
  }, HEARTBEAT_INTERVAL_MS);
7504
7504
  try {
7505
- await exec(cmd, args, {
7505
+ await exec(pm.cmd, pm.args, {
7506
7506
  cwd: workDir,
7507
- timeoutMs,
7507
+ timeoutMs: INSTALL_TIMEOUT_MS,
7508
7508
  env: { ...process.env, NODE_ENV: "development" }
7509
7509
  });
7510
- onProgress(`[diag] ${label} finished in ${Date.now() - startedAt}ms`);
7510
+ onProgress(`[diag] npm install finished in ${Date.now() - startedAt}ms`);
7511
+ reportNodeModules(workDir, onProgress);
7511
7512
  return true;
7512
7513
  } catch (err) {
7513
7514
  onProgress(
7514
- `[diag] ${label} FAILED after ${Date.now() - startedAt}ms: ${err instanceof Error ? err.message : String(err)}`
7515
+ `[diag] npm install FAILED after ${Date.now() - startedAt}ms: ${err instanceof Error ? err.message : String(err)}`
7515
7516
  );
7517
+ reportNodeModules(workDir, onProgress);
7516
7518
  return false;
7517
7519
  } finally {
7518
7520
  clearInterval(heartbeat);
7519
7521
  }
7520
7522
  }
7521
- var PNPM_INSTALL_ARGS = [
7522
- "install",
7523
- "--shamefully-hoist",
7524
- "--ignore-scripts",
7525
- "--network-concurrency=8"
7526
- ];
7527
- async function runInstall(exec, pm, workDir, onProgress) {
7528
- reportRegistry(workDir, onProgress);
7529
- const pnpmReady = await runCommand(
7530
- exec,
7531
- "npm",
7532
- ["install", "-g", "pnpm"],
7533
- workDir,
7534
- onProgress,
7535
- "pnpm bootstrap",
7536
- PNPM_BOOTSTRAP_TIMEOUT_MS
7537
- );
7538
- if (pnpmReady) {
7539
- const pnpmOk = await runCommand(
7540
- exec,
7541
- "pnpm",
7542
- PNPM_INSTALL_ARGS,
7543
- workDir,
7544
- onProgress,
7545
- "pnpm install",
7546
- INSTALL_TIMEOUT_MS
7547
- );
7548
- if (pnpmOk) {
7549
- reportNodeModules(workDir, onProgress);
7550
- return true;
7551
- }
7552
- onProgress("[diag] pnpm install failed \u2014 falling back to npm");
7553
- } else {
7554
- onProgress("[diag] pnpm bootstrap failed \u2014 falling back to npm");
7555
- }
7556
- const ok = await runCommand(
7557
- exec,
7558
- pm.cmd,
7559
- pm.args,
7560
- workDir,
7561
- onProgress,
7562
- "npm install",
7563
- INSTALL_TIMEOUT_MS
7564
- );
7565
- reportNodeModules(workDir, onProgress);
7566
- return ok;
7567
- }
7568
7523
  async function installWithCache(workDir, exec, cacheBase, pm, onProgress) {
7569
7524
  const sourceContent = readFileSync(
7570
7525
  path.join(workDir, pm.cacheSourceFile),