@wix/evalforge-evaluator 0.190.0 → 0.191.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
@@ -7570,11 +7570,36 @@ async function fetchAndWriteTemplateFiles(template, workDir, onProgress) {
7570
7570
  );
7571
7571
  }
7572
7572
  await writeFilesToDirectory(workDir, sourceFiles);
7573
+ const extraFiles = template.extraFiles ?? [];
7574
+ onProgress(`[diag] resolving ${extraFiles.length} extra file(s)`);
7573
7575
  await Promise.all(
7574
- (template.extraFiles ?? []).map(async (ef) => {
7575
- const content = ef.gitSource ? await (0, import_evalforge_github_client.fetchGitHubFile)(ef.gitSource, {
7576
- userAgent: "EvalForge-Evaluator"
7577
- }) : ef.content ?? "";
7576
+ extraFiles.map(async (ef) => {
7577
+ let content;
7578
+ if (ef.gitSource) {
7579
+ const { owner, repo, path: gitPath, ref } = ef.gitSource;
7580
+ const startedAt = Date.now();
7581
+ onProgress(
7582
+ `[diag] extra fetch start: ${ef.path} <- ${owner}/${repo}/${gitPath ?? ""}@${ref ?? "default"}`
7583
+ );
7584
+ try {
7585
+ content = await withTimeout(
7586
+ (0, import_evalforge_github_client.fetchGitHubFile)(ef.gitSource, { userAgent: "EvalForge-Evaluator" }),
7587
+ 3e4,
7588
+ `extra file fetch (${ef.path})`
7589
+ );
7590
+ onProgress(
7591
+ `[diag] extra fetch done: ${ef.path} (${content.length} bytes) in ${Date.now() - startedAt}ms`
7592
+ );
7593
+ } catch (err) {
7594
+ onProgress(
7595
+ `[diag] extra fetch FAILED: ${ef.path} after ${Date.now() - startedAt}ms: ${err instanceof Error ? err.message : String(err)}`
7596
+ );
7597
+ throw err;
7598
+ }
7599
+ } else {
7600
+ content = ef.content ?? "";
7601
+ onProgress(`[diag] extra inline: ${ef.path} (${content.length} bytes)`);
7602
+ }
7578
7603
  const dest = import_path3.default.resolve(workDir, ef.path);
7579
7604
  if (!dest.startsWith(workDir + import_path3.sep)) {
7580
7605
  throw new Error(
@@ -7585,6 +7610,7 @@ async function fetchAndWriteTemplateFiles(template, workDir, onProgress) {
7585
7610
  await (0, import_promises2.writeFile)(dest, content, "utf8");
7586
7611
  })
7587
7612
  );
7613
+ onProgress("[diag] all extra files written");
7588
7614
  }
7589
7615
  function writeWixEnvFile(workDir) {
7590
7616
  const configPath = import_path3.default.join(workDir, "wix.config.json");