@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.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 BUN_BOOTSTRAP_TIMEOUT_MS = 6e4;
7406
7405
  var HEARTBEAT_INTERVAL_MS = 5e3;
7407
7406
  function reportRegistry(workDir, onProgress) {
7408
7407
  try {
@@ -7491,74 +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
- async function runInstall(exec, pm, workDir, onProgress) {
7522
- reportRegistry(workDir, onProgress);
7523
- const bunReady = await runCommand(
7524
- exec,
7525
- "npm",
7526
- ["install", "-g", "bun"],
7527
- workDir,
7528
- onProgress,
7529
- "bun bootstrap",
7530
- BUN_BOOTSTRAP_TIMEOUT_MS
7531
- );
7532
- if (bunReady) {
7533
- const bunOk = await runCommand(
7534
- exec,
7535
- "bun",
7536
- ["install", "--ignore-scripts"],
7537
- workDir,
7538
- onProgress,
7539
- "bun install",
7540
- INSTALL_TIMEOUT_MS
7541
- );
7542
- if (bunOk) {
7543
- reportNodeModules(workDir, onProgress);
7544
- return true;
7545
- }
7546
- onProgress("[diag] bun install failed \u2014 falling back to npm");
7547
- } else {
7548
- onProgress("[diag] bun bootstrap failed \u2014 falling back to npm");
7549
- }
7550
- const ok = await runCommand(
7551
- exec,
7552
- pm.cmd,
7553
- pm.args,
7554
- workDir,
7555
- onProgress,
7556
- "npm install",
7557
- INSTALL_TIMEOUT_MS
7558
- );
7559
- reportNodeModules(workDir, onProgress);
7560
- return ok;
7561
- }
7562
7523
  async function installWithCache(workDir, exec, cacheBase, pm, onProgress) {
7563
7524
  const sourceContent = readFileSync(
7564
7525
  path.join(workDir, pm.cacheSourceFile),