@tempo-ai/visual-review 0.0.108-staging.3 → 0.0.109-staging.1

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/dist/bin.js CHANGED
@@ -6,7 +6,7 @@ async function main(argv = process.argv.slice(2)) {
6
6
  const [command, ...commandArgs] = argv;
7
7
  switch (command) {
8
8
  case "capture":
9
- return await (await import("./cli-ASUZAROR.js")).main(commandArgs);
9
+ return await (await import("./cli-WNMIFR4A.js")).main(commandArgs);
10
10
  case "claim":
11
11
  return await (await import("./claim-J654JAS6.js")).main(commandArgs);
12
12
  case "report":
@@ -855,8 +855,7 @@ function readNavigatedMark(error) {
855
855
  return error !== null && typeof error === "object" && navigatedErrors.has(error);
856
856
  }
857
857
  function documentReplaced(start, now, expectedNavigations) {
858
- const ownSameDocument = now.sameDocumentIssued - start.sameDocumentIssued;
859
- return now.navigationRequests > start.navigationRequests + expectedNavigations || now.frameNavigations > start.frameNavigations + expectedNavigations + ownSameDocument;
858
+ return now.navigationRequests > start.navigationRequests + expectedNavigations || now.documentCommits > start.documentCommits + expectedNavigations;
860
859
  }
861
860
  var BOARD_ATTEMPT_LIMIT = 3;
862
861
  function decideBoardRetry(attempt, attemptIndex, attemptLimit = BOARD_ATTEMPT_LIMIT) {
@@ -946,6 +945,7 @@ async function startCaptureSession(options) {
946
945
  await context.addInitScript(buildFreezeInitScript());
947
946
  await context.addInitScript(installRenderProfileInPage);
948
947
  const page = await context.newPage();
948
+ const documentEvents = await context.newCDPSession(page);
949
949
  const worker = {
950
950
  context,
951
951
  page,
@@ -954,12 +954,13 @@ async function startCaptureSession(options) {
954
954
  hasNavigated: false,
955
955
  counters: {
956
956
  navigationRequests: 0,
957
- frameNavigations: 0,
958
- sameDocumentIssued: 0
957
+ documentCommits: 0
959
958
  },
960
959
  documentsLoaded: 0,
961
960
  navigationsInFlight: 0,
962
961
  async dispose() {
962
+ await documentEvents.detach().catch(() => {
963
+ });
963
964
  await page.close().catch(() => {
964
965
  });
965
966
  await context.close().catch(() => {
@@ -983,9 +984,10 @@ async function startCaptureSession(options) {
983
984
  if (!isMainFrameNavigation(request)) return;
984
985
  worker.navigationsInFlight = Math.max(0, worker.navigationsInFlight - 1);
985
986
  });
986
- page.on("framenavigated", (frame) => {
987
- if (frame === page.mainFrame()) worker.counters.frameNavigations += 1;
987
+ documentEvents.on("Page.frameNavigated", ({ frame }) => {
988
+ if (!frame.parentId) worker.counters.documentCommits += 1;
988
989
  });
990
+ await documentEvents.send("Page.enable");
989
991
  page.on("domcontentloaded", () => {
990
992
  worker.documentsLoaded += 1;
991
993
  worker.navigationsInFlight = 0;
@@ -1051,10 +1053,11 @@ async function startCaptureSession(options) {
1051
1053
  } else {
1052
1054
  if (worker.currentSelector === selector) {
1053
1055
  await page.evaluate((url) => {
1054
- history.replaceState(null, "", url);
1055
- window.dispatchEvent(new PopStateEvent("popstate"));
1056
+ history.replaceState(history.state, "", url);
1057
+ window.dispatchEvent(
1058
+ new PopStateEvent("popstate", { state: history.state })
1059
+ );
1056
1060
  }, buildDirectRenderIdleUrl(options.hostUrl));
1057
- worker.counters.sameDocumentIssued += 1;
1058
1061
  await page.waitForSelector(worker.currentSelector, {
1059
1062
  state: "detached",
1060
1063
  timeout: capture.settleTimeoutMs ?? options.settleTimeoutMs ?? 3e4
@@ -1065,12 +1068,13 @@ async function startCaptureSession(options) {
1065
1068
  const captureWindow = window;
1066
1069
  captureWindow.__tempoResetCaptureDeterminism?.();
1067
1070
  captureWindow.__tempoCaptureRenderProfile?.begin(nextSelector);
1068
- history.replaceState(null, "", url);
1069
- window.dispatchEvent(new PopStateEvent("popstate"));
1071
+ history.replaceState(history.state, "", url);
1072
+ window.dispatchEvent(
1073
+ new PopStateEvent("popstate", { state: history.state })
1074
+ );
1070
1075
  },
1071
1076
  { url: targetUrl, nextSelector: selector }
1072
1077
  );
1073
- worker.counters.sameDocumentIssued += 1;
1074
1078
  }
1075
1079
  worker.currentSelector = selector;
1076
1080
  } finally {
@@ -1391,7 +1395,7 @@ async function startCaptureSession(options) {
1391
1395
  if (isReloadStorm(recentReloadRetries, stormWindow)) {
1392
1396
  aborted = true;
1393
1397
  throw new CaptureReloadStormError(
1394
- `capture aborted: the devserver reloaded during the last ${stormWindow} storyboards in a row (${reloadRetriesTotal} re-captures so far) \u2014 it is re-optimizing or restarting continuously; see the "devserver:" lines above`
1398
+ `capture aborted: the document reloaded during the last ${stormWindow} storyboards in a row (${reloadRetriesTotal} re-captures so far) \u2014 check the devserver output and storyboard navigation for repeated reloads`
1395
1399
  );
1396
1400
  }
1397
1401
  if (result.status === "render-error") {
@@ -8524,8 +8528,9 @@ Hint: ${current.hint}` : "";
8524
8528
  if (!publicUrl) {
8525
8529
  const crashed = this.lastExitCrashed;
8526
8530
  const probeBlocked = !crashed && !this.stopped && !probeResult.sawResponder;
8527
- const wrongResponder = !crashed && !this.stopped && probeResult.sawResponder && !probeResult.identityFailure;
8528
- const identityFailure = !crashed && !this.stopped && probeResult.identityFailure;
8531
+ const canClassifyResponder = !crashed && this.hasLivenessAuthority();
8532
+ const wrongResponder = canClassifyResponder && probeResult.sawResponder && !probeResult.identityFailure;
8533
+ const identityFailure = canClassifyResponder && probeResult.identityFailure;
8529
8534
  let message = crashed ? "Dev server exited before its URL became reachable" : "Tempo host URL did not become reachable in time";
8530
8535
  if (wrongResponder) {
8531
8536
  const target = publicUrlCandidates[0] ?? "";
@@ -13846,4 +13851,4 @@ export {
13846
13851
  buildBaselineCaptureArgs,
13847
13852
  main
13848
13853
  };
13849
- //# sourceMappingURL=chunk-2EVRJIRQ.js.map
13854
+ //# sourceMappingURL=chunk-L2AOGS53.js.map