@wix/evalforge-evaluator 0.194.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.js CHANGED
@@ -7373,7 +7373,6 @@ var import_crypto = require("crypto");
7373
7373
  var import_path2 = __toESM(require("path"));
7374
7374
  var import_child_process = require("child_process");
7375
7375
  var INSTALL_TIMEOUT_MS = 1e5;
7376
- var BUN_BOOTSTRAP_TIMEOUT_MS = 6e4;
7377
7376
  var HEARTBEAT_INTERVAL_MS = 5e3;
7378
7377
  function reportRegistry(workDir, onProgress) {
7379
7378
  try {
@@ -7462,74 +7461,36 @@ function cloneDirectory(src, dest) {
7462
7461
  (0, import_fs.cpSync)(src, dest, { recursive: true });
7463
7462
  }
7464
7463
  }
7465
- async function runCommand(exec, cmd, args, workDir, onProgress, label, timeoutMs) {
7466
- onProgress(`[diag] ${label} starting: ${cmd} ${args.join(" ")}`);
7464
+ async function runInstall(exec, pm, workDir, onProgress) {
7465
+ reportRegistry(workDir, onProgress);
7466
+ onProgress(`[diag] npm install starting: ${pm.cmd} ${pm.args.join(" ")}`);
7467
7467
  const startedAt = Date.now();
7468
7468
  const heartbeat = setInterval(() => {
7469
7469
  onProgress(
7470
- `[diag] ${label} still running: ${Math.round(
7470
+ `[diag] npm install still running: ${Math.round(
7471
7471
  (Date.now() - startedAt) / 1e3
7472
7472
  )}s elapsed`
7473
7473
  );
7474
7474
  }, HEARTBEAT_INTERVAL_MS);
7475
7475
  try {
7476
- await exec(cmd, args, {
7476
+ await exec(pm.cmd, pm.args, {
7477
7477
  cwd: workDir,
7478
- timeoutMs,
7478
+ timeoutMs: INSTALL_TIMEOUT_MS,
7479
7479
  env: { ...process.env, NODE_ENV: "development" }
7480
7480
  });
7481
- onProgress(`[diag] ${label} finished in ${Date.now() - startedAt}ms`);
7481
+ onProgress(`[diag] npm install finished in ${Date.now() - startedAt}ms`);
7482
+ reportNodeModules(workDir, onProgress);
7482
7483
  return true;
7483
7484
  } catch (err) {
7484
7485
  onProgress(
7485
- `[diag] ${label} FAILED after ${Date.now() - startedAt}ms: ${err instanceof Error ? err.message : String(err)}`
7486
+ `[diag] npm install FAILED after ${Date.now() - startedAt}ms: ${err instanceof Error ? err.message : String(err)}`
7486
7487
  );
7488
+ reportNodeModules(workDir, onProgress);
7487
7489
  return false;
7488
7490
  } finally {
7489
7491
  clearInterval(heartbeat);
7490
7492
  }
7491
7493
  }
7492
- async function runInstall(exec, pm, workDir, onProgress) {
7493
- reportRegistry(workDir, onProgress);
7494
- const bunReady = await runCommand(
7495
- exec,
7496
- "npm",
7497
- ["install", "-g", "bun"],
7498
- workDir,
7499
- onProgress,
7500
- "bun bootstrap",
7501
- BUN_BOOTSTRAP_TIMEOUT_MS
7502
- );
7503
- if (bunReady) {
7504
- const bunOk = await runCommand(
7505
- exec,
7506
- "bun",
7507
- ["install", "--ignore-scripts"],
7508
- workDir,
7509
- onProgress,
7510
- "bun install",
7511
- INSTALL_TIMEOUT_MS
7512
- );
7513
- if (bunOk) {
7514
- reportNodeModules(workDir, onProgress);
7515
- return true;
7516
- }
7517
- onProgress("[diag] bun install failed \u2014 falling back to npm");
7518
- } else {
7519
- onProgress("[diag] bun bootstrap failed \u2014 falling back to npm");
7520
- }
7521
- const ok = await runCommand(
7522
- exec,
7523
- pm.cmd,
7524
- pm.args,
7525
- workDir,
7526
- onProgress,
7527
- "npm install",
7528
- INSTALL_TIMEOUT_MS
7529
- );
7530
- reportNodeModules(workDir, onProgress);
7531
- return ok;
7532
- }
7533
7494
  async function installWithCache(workDir, exec, cacheBase, pm, onProgress) {
7534
7495
  const sourceContent = (0, import_fs.readFileSync)(
7535
7496
  import_path2.default.join(workDir, pm.cacheSourceFile),