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

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-JDSQSM3K.js")).main(commandArgs);
10
10
  case "claim":
11
11
  return await (await import("./claim-J654JAS6.js")).main(commandArgs);
12
12
  case "report":
@@ -419,7 +419,7 @@ async function installChromium(log, spawnImpl = spawn) {
419
419
  }
420
420
 
421
421
  // ../canvas-capture-headless/src/fingerprint.ts
422
- var KIT_VERSION = "3";
422
+ var KIT_VERSION = "5";
423
423
  var FONTS_BUNDLE_VERSION = "system-1";
424
424
  var DEVICE_SCALE_FACTOR = 2;
425
425
  function buildEnvFingerprint(input) {
@@ -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) {
@@ -910,7 +909,7 @@ function describeRetryReason(attempt) {
910
909
  }
911
910
  return "document reloaded mid-capture";
912
911
  }
913
- var DEFAULT_VIEWPORT = { width: 1600, height: 1200 };
912
+ var INITIAL_VIEWPORT = { width: 1600, height: 1200 };
914
913
  async function startCaptureSession(options) {
915
914
  const log = options.log ?? (() => {
916
915
  });
@@ -936,7 +935,7 @@ async function startCaptureSession(options) {
936
935
  const contextStart = Date.now();
937
936
  const context = await browser.newContext({
938
937
  deviceScaleFactor: capture.deviceScaleFactor ?? DEVICE_SCALE_FACTOR,
939
- viewport: capture.viewport ?? DEFAULT_VIEWPORT,
938
+ viewport: capture.viewport ?? INITIAL_VIEWPORT,
940
939
  reducedMotion: "reduce",
941
940
  colorScheme: "light",
942
941
  timezoneId: "UTC",
@@ -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;
@@ -1030,8 +1032,12 @@ async function startCaptureSession(options) {
1030
1032
  target.storyboardId
1031
1033
  );
1032
1034
  const selector = buildStoryboardRenderSelector(renderId);
1035
+ const viewport = capture.viewport ?? {
1036
+ width: Math.ceil(target.width),
1037
+ height: Math.ceil(target.height)
1038
+ };
1033
1039
  const ownsWorker = reusableWorker === void 0;
1034
- const worker = reusableWorker ?? await createCaptureWorker(capture);
1040
+ const worker = reusableWorker ?? await createCaptureWorker({ ...capture, viewport });
1035
1041
  const { page } = worker;
1036
1042
  if (!worker.contextClaimed) {
1037
1043
  timings.contextMs = worker.contextMs;
@@ -1043,6 +1049,10 @@ async function startCaptureSession(options) {
1043
1049
  try {
1044
1050
  const navStart = Date.now();
1045
1051
  try {
1052
+ const currentViewport = page.viewportSize();
1053
+ if (currentViewport?.width !== viewport.width || currentViewport?.height !== viewport.height) {
1054
+ await page.setViewportSize(viewport);
1055
+ }
1046
1056
  const targetUrl = buildDirectRenderUrl2(options.hostUrl, target);
1047
1057
  if (!worker.hasNavigated) {
1048
1058
  await page.goto(targetUrl, { waitUntil: "domcontentloaded" });
@@ -1051,10 +1061,11 @@ async function startCaptureSession(options) {
1051
1061
  } else {
1052
1062
  if (worker.currentSelector === selector) {
1053
1063
  await page.evaluate((url) => {
1054
- history.replaceState(null, "", url);
1055
- window.dispatchEvent(new PopStateEvent("popstate"));
1064
+ history.replaceState(history.state, "", url);
1065
+ window.dispatchEvent(
1066
+ new PopStateEvent("popstate", { state: history.state })
1067
+ );
1056
1068
  }, buildDirectRenderIdleUrl(options.hostUrl));
1057
- worker.counters.sameDocumentIssued += 1;
1058
1069
  await page.waitForSelector(worker.currentSelector, {
1059
1070
  state: "detached",
1060
1071
  timeout: capture.settleTimeoutMs ?? options.settleTimeoutMs ?? 3e4
@@ -1065,12 +1076,13 @@ async function startCaptureSession(options) {
1065
1076
  const captureWindow = window;
1066
1077
  captureWindow.__tempoResetCaptureDeterminism?.();
1067
1078
  captureWindow.__tempoCaptureRenderProfile?.begin(nextSelector);
1068
- history.replaceState(null, "", url);
1069
- window.dispatchEvent(new PopStateEvent("popstate"));
1079
+ history.replaceState(history.state, "", url);
1080
+ window.dispatchEvent(
1081
+ new PopStateEvent("popstate", { state: history.state })
1082
+ );
1070
1083
  },
1071
1084
  { url: targetUrl, nextSelector: selector }
1072
1085
  );
1073
- worker.counters.sameDocumentIssued += 1;
1074
1086
  }
1075
1087
  worker.currentSelector = selector;
1076
1088
  } finally {
@@ -1391,7 +1403,7 @@ async function startCaptureSession(options) {
1391
1403
  if (isReloadStorm(recentReloadRetries, stormWindow)) {
1392
1404
  aborted = true;
1393
1405
  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`
1406
+ `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
1407
  );
1396
1408
  }
1397
1409
  if (result.status === "render-error") {
@@ -4813,7 +4825,7 @@ async function parcelEventToFileEvent(event, rootInfo) {
4813
4825
  // ../tempo-sdk/package.json
4814
4826
  var package_default = {
4815
4827
  name: "tempo-sdk",
4816
- version: "0.0.42",
4828
+ version: "0.0.44",
4817
4829
  type: "module",
4818
4830
  description: "Tempo SDK \u2014 Vite, Next.js, and Expo plugins for JSX annotation and shared page/storyboard types",
4819
4831
  repository: {
@@ -4894,7 +4906,7 @@ var package_default = {
4894
4906
  demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
4895
4907
  "demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
4896
4908
  test: "vitest run",
4897
- "test:browser": "vitest run canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts",
4909
+ "test:browser": "vitest run canvas-capture-determinism-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts",
4898
4910
  "test:watch": "vitest",
4899
4911
  "test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
4900
4912
  "test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
@@ -8524,8 +8536,9 @@ Hint: ${current.hint}` : "";
8524
8536
  if (!publicUrl) {
8525
8537
  const crashed = this.lastExitCrashed;
8526
8538
  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;
8539
+ const canClassifyResponder = !crashed && this.hasLivenessAuthority();
8540
+ const wrongResponder = canClassifyResponder && probeResult.sawResponder && !probeResult.identityFailure;
8541
+ const identityFailure = canClassifyResponder && probeResult.identityFailure;
8529
8542
  let message = crashed ? "Dev server exited before its URL became reachable" : "Tempo host URL did not become reachable in time";
8530
8543
  if (wrongResponder) {
8531
8544
  const target = publicUrlCandidates[0] ?? "";
@@ -13846,4 +13859,4 @@ export {
13846
13859
  buildBaselineCaptureArgs,
13847
13860
  main
13848
13861
  };
13849
- //# sourceMappingURL=chunk-2EVRJIRQ.js.map
13862
+ //# sourceMappingURL=chunk-7P5FPOFE.js.map