@tempo-ai/visual-review 0.0.131 → 0.0.132-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
@@ -7,7 +7,7 @@ async function main(argv = process.argv.slice(2)) {
7
7
  const [command, ...commandArgs] = argv;
8
8
  switch (command) {
9
9
  case "capture":
10
- return await (await import("./cli-L4IPMJZ7.js")).main(commandArgs);
10
+ return await (await import("./cli-ZR27KAIU.js")).main(commandArgs);
11
11
  case "claim":
12
12
  return await (await import("./claim-C5UVLSMX.js")).main(commandArgs);
13
13
  case "report":
@@ -29363,6 +29363,8 @@ var RESPONSIVE_CAPTURE_VIEWPORT = {
29363
29363
  };
29364
29364
  var STORYBOARD_RENDER_ID_ATTRIBUTE = "data-tempo-storyboard-render-id";
29365
29365
  var STORYBOARD_PENDING_SELECTOR = `[${PROJECTION_PENDING_ATTRIBUTE}]`;
29366
+ var STORYBOARD_RENDER_ERROR_SELECTOR = '[data-render-error="true"]';
29367
+ var STORYBOARD_RENDER_ERROR_MESSAGE_ATTRIBUTE = "data-render-error-message";
29366
29368
  function buildCanvasStoryboardRenderId(canvasPath, storyboardId) {
29367
29369
  return `canvas:${encodeURIComponent(canvasPath.trim())}#storyboard:${encodeURIComponent(
29368
29370
  storyboardId.trim()
@@ -29458,7 +29460,6 @@ var FREEZE_MOTION_CSS = `
29458
29460
  *, *::before, *::after {
29459
29461
  animation-duration: 0s !important;
29460
29462
  animation-delay: 0s !important;
29461
- animation-iteration-count: 1 !important;
29462
29463
  transition-duration: 0s !important;
29463
29464
  transition-delay: 0s !important;
29464
29465
  scroll-behavior: auto !important;
@@ -38736,6 +38737,41 @@ function assessPageStylesInPage(selector) {
38736
38737
  inlineStyledElementCount: scope.querySelectorAll("[style]").length
38737
38738
  };
38738
38739
  }
38740
+ function watchRenderErrorsInPage(input) {
38741
+ const target = document.querySelector(input.selector);
38742
+ const messages = [];
38743
+ const record = () => {
38744
+ if (!target) return;
38745
+ for (const element of Array.from(
38746
+ target.querySelectorAll(input.errorSelector)
38747
+ )) {
38748
+ const message = element.getAttribute(input.messageAttribute) || "unknown error";
38749
+ if (!messages.includes(message)) messages.push(message);
38750
+ }
38751
+ };
38752
+ record();
38753
+ const observer = new MutationObserver(record);
38754
+ if (target) {
38755
+ observer.observe(target, {
38756
+ subtree: true,
38757
+ childList: true,
38758
+ attributes: true,
38759
+ attributeFilter: [input.messageAttribute]
38760
+ });
38761
+ }
38762
+ window.__tempoCaptureRenderErrors = () => {
38763
+ observer.takeRecords();
38764
+ observer.disconnect();
38765
+ record();
38766
+ return messages;
38767
+ };
38768
+ }
38769
+ function readRenderErrorsInPage() {
38770
+ const captureWindow = window;
38771
+ const stop = captureWindow.__tempoCaptureRenderErrors;
38772
+ delete captureWindow.__tempoCaptureRenderErrors;
38773
+ return stop ? stop() : [];
38774
+ }
38739
38775
  async function inlinePortableHtmlInPage(input) {
38740
38776
  const warnings = [];
38741
38777
  const warn = (message) => {
@@ -39469,7 +39505,18 @@ async function startCaptureSession(options) {
39469
39505
  profile.longTaskCount,
39470
39506
  "count"
39471
39507
  );
39508
+ await page.evaluate(watchRenderErrorsInPage, {
39509
+ selector,
39510
+ errorSelector: STORYBOARD_RENDER_ERROR_SELECTOR,
39511
+ messageAttribute: STORYBOARD_RENDER_ERROR_MESSAGE_ATTRIBUTE
39512
+ });
39472
39513
  const value = await work(page, selector);
39514
+ const renderErrors = await page.evaluate(readRenderErrorsInPage);
39515
+ if (renderErrors.length > 0) {
39516
+ throw new Error(
39517
+ `storyboard rendered its error boundary: ${renderErrors.join("; ")}`
39518
+ );
39519
+ }
39473
39520
  return { value, navigated: navigatedSinceStart() };
39474
39521
  } catch (error) {
39475
39522
  markNavigated(error, navigatedSinceStart());
@@ -40154,7 +40201,7 @@ var MissingRootDepsError = class extends TempoDevServerError {
40154
40201
  // ../tempo-sdk/package.json
40155
40202
  var package_default = {
40156
40203
  name: "tempo-sdk",
40157
- version: "0.0.76",
40204
+ version: "0.0.79",
40158
40205
  publishConfig: {
40159
40206
  tag: "sdk-v2-latest"
40160
40207
  },
@@ -41096,7 +41143,7 @@ function probeNodeVersion(env) {
41096
41143
  output += String(chunk);
41097
41144
  });
41098
41145
  child.on("error", () => resolve2(null));
41099
- child.on("exit", (code) => {
41146
+ child.on("close", (code) => {
41100
41147
  resolve2(code === 0 ? output.trim() || null : null);
41101
41148
  });
41102
41149
  });
@@ -49425,7 +49472,7 @@ var FlutterDevServer = class {
49425
49472
  this.resolutionSignature = "";
49426
49473
  this.sourceDebounceTimer = null;
49427
49474
  this.pendingSourcePaths = /* @__PURE__ */ new Set();
49428
- this.sourceSyncRunning = false;
49475
+ this.sourceSyncPromise = null;
49429
49476
  // Reloads run one at a time; the daemon answers concurrent restarts poorly.
49430
49477
  this.reloadChain = Promise.resolve();
49431
49478
  // One listener on the public port for this server's whole lifetime: no
@@ -49525,6 +49572,7 @@ var FlutterDevServer = class {
49525
49572
  this.cancelPendingSourceSync();
49526
49573
  await this.gate.close();
49527
49574
  await this.daemon?.stop(this.timing.stopGraceMs, this.timing.killGraceMs);
49575
+ await this.sourceSyncPromise;
49528
49576
  this.setStatus({ state: "stopped" });
49529
49577
  }
49530
49578
  /** Synchronous teardown for process-exit paths only. */
@@ -49909,6 +49957,7 @@ var FlutterDevServer = class {
49909
49957
  );
49910
49958
  }
49911
49959
  sourceFilesChanged(relativePaths) {
49960
+ if (this.stopRequested) return;
49912
49961
  for (const relativePath of relativePaths) {
49913
49962
  this.pendingSourcePaths.add(relativePath);
49914
49963
  }
@@ -49929,35 +49978,43 @@ var FlutterDevServer = class {
49929
49978
  * relaunch, which consumes the batch. Starting: leave them pending; the
49930
49979
  * transition to ready flushes again.
49931
49980
  */
49932
- async flushSourceChanges() {
49933
- if (this.sourceSyncRunning) return;
49934
- this.sourceSyncRunning = true;
49935
- try {
49936
- while (this.pendingSourcePaths.size > 0 && !this.stopRequested) {
49937
- const state = this.currentStatus.state;
49938
- if (state === "failed") {
49939
- const changed2 = [...this.pendingSourcePaths];
49940
- this.pendingSourcePaths.clear();
49941
- const stamps = await this.readSourceStamps(changed2);
49942
- const graph = await readPackageGraphFingerprint(
49943
- this.sourceDirectories(),
49944
- this.options.projectRoot
49945
- );
49946
- if (graph === this.launchedPackageGraph && changed2.every(
49947
- (file) => (this.attemptedSourceStamps.get(file) ?? "missing") === stamps.get(file)
49948
- ))
49949
- continue;
49950
- await this.relaunch("source-change-after-failure");
49951
- if (this.status().state === "ready") this.rememberCompiled(stamps);
49952
- continue;
49953
- }
49954
- if (state !== "ready") break;
49955
- const changed = [...this.pendingSourcePaths];
49981
+ flushSourceChanges() {
49982
+ if (this.sourceSyncPromise) return this.sourceSyncPromise;
49983
+ const pending = this.performSourceSync();
49984
+ this.sourceSyncPromise = pending;
49985
+ void pending.then(
49986
+ () => {
49987
+ if (this.sourceSyncPromise === pending) this.sourceSyncPromise = null;
49988
+ },
49989
+ () => {
49990
+ if (this.sourceSyncPromise === pending) this.sourceSyncPromise = null;
49991
+ }
49992
+ );
49993
+ return pending;
49994
+ }
49995
+ async performSourceSync() {
49996
+ while (this.pendingSourcePaths.size > 0 && !this.stopRequested) {
49997
+ const state = this.currentStatus.state;
49998
+ if (state === "failed") {
49999
+ const changed2 = [...this.pendingSourcePaths];
49956
50000
  this.pendingSourcePaths.clear();
49957
- await this.applySourceChanges(changed);
50001
+ const stamps = await this.readSourceStamps(changed2);
50002
+ const graph = await readPackageGraphFingerprint(
50003
+ this.sourceDirectories(),
50004
+ this.options.projectRoot
50005
+ );
50006
+ if (graph === this.launchedPackageGraph && changed2.every(
50007
+ (file) => (this.attemptedSourceStamps.get(file) ?? "missing") === stamps.get(file)
50008
+ ))
50009
+ continue;
50010
+ await this.relaunch("source-change-after-failure");
50011
+ if (this.status().state === "ready") this.rememberCompiled(stamps);
50012
+ continue;
49958
50013
  }
49959
- } finally {
49960
- this.sourceSyncRunning = false;
50014
+ if (state !== "ready") break;
50015
+ const changed = [...this.pendingSourcePaths];
50016
+ this.pendingSourcePaths.clear();
50017
+ await this.applySourceChanges(changed);
49961
50018
  }
49962
50019
  }
49963
50020
  /** Spec §4.4 source-change policy. */
@@ -50043,7 +50100,7 @@ var FlutterDevServer = class {
50043
50100
  const startedAt = Date.now();
50044
50101
  const daemon = this.daemon;
50045
50102
  const appId = daemon?.appId ?? null;
50046
- if (!daemon || !appId || this.currentStatus.state !== "ready") {
50103
+ if (this.stopRequested || !daemon || !appId || this.currentStatus.state !== "ready") {
50047
50104
  return this.recordReload({
50048
50105
  kind,
50049
50106
  ok: false,
@@ -52717,9 +52774,14 @@ var TempoDevServer = class _TempoDevServer {
52717
52774
  upgradeError: sdkUpgradeResult.error ?? null,
52718
52775
  projectNodeHint: getProjectNodeUnsatisfiedHint(this.commandCwd)
52719
52776
  } : null;
52777
+ const attemptedPorts = /* @__PURE__ */ new Set();
52720
52778
  const spawnProcess = async (attempt) => {
52721
52779
  throwIfLaunchAborted(options?.signal);
52722
- const startPlan = await this.buildStartCommandForAttempt(attempt);
52780
+ const startPlan = await this.buildStartCommandForAttempt(
52781
+ attempt,
52782
+ attemptedPorts
52783
+ );
52784
+ attemptedPorts.add(startPlan.injectedPort);
52723
52785
  throwIfLaunchAborted(options?.signal);
52724
52786
  const expectedIdentity = await this.readExpectedHostIdentity();
52725
52787
  const stopCommand = this.config.scripts.stop ? substituteAppPort(this.config.scripts.stop, startPlan.injectedPort) : null;
@@ -53422,13 +53484,13 @@ var TempoDevServer = class _TempoDevServer {
53422
53484
  });
53423
53485
  }
53424
53486
  }
53425
- async buildStartCommandForAttempt(attempt) {
53487
+ async buildStartCommandForAttempt(attempt, attemptedPorts) {
53426
53488
  const configuredPort = portFromConfiguredTempoHostUrl(
53427
53489
  this.config.tempoHostUrl
53428
53490
  );
53429
53491
  const needsLegacyPortInjection = !this.config.scripts.start.includes("${PORT}") && canInjectDevServerPort(this.config.scripts.start);
53430
53492
  const framework = needsLegacyPortInjection ? await this.resolveStartFramework() : "vite";
53431
- const port = configuredPort ?? await getAvailableLocalPort();
53493
+ const port = configuredPort ?? await getAvailableLocalPort(attemptedPorts);
53432
53494
  const plan = buildManagedStartPlan({
53433
53495
  command: this.config.scripts.start,
53434
53496
  tempoHostUrl: this.config.tempoHostUrl,
@@ -55280,7 +55342,7 @@ async function resolveProjectNodeOverrideForDir(cwd) {
55280
55342
  projectNodeOverrideCache.set(key2, resolution);
55281
55343
  return await resolution;
55282
55344
  }
55283
- async function getAvailableLocalPort() {
55345
+ async function getAvailableLocalPort(excludedPorts = /* @__PURE__ */ new Set()) {
55284
55346
  return await new Promise((resolve2, reject) => {
55285
55347
  const server = createServer2();
55286
55348
  server.unref();
@@ -55288,6 +55350,13 @@ async function getAvailableLocalPort() {
55288
55350
  server.listen(0, "127.0.0.1", () => {
55289
55351
  const address = server.address();
55290
55352
  const port = address && typeof address === "object" ? address.port : null;
55353
+ if (port && excludedPorts.has(port)) {
55354
+ void getAvailableLocalPort(excludedPorts).then(
55355
+ (next) => server.close(() => resolve2(next)),
55356
+ (error) => server.close(() => reject(error))
55357
+ );
55358
+ return;
55359
+ }
55291
55360
  server.close(() => {
55292
55361
  if (port) {
55293
55362
  resolve2(port);
@@ -63642,4 +63711,4 @@ export {
63642
63711
  buildBaselineCaptureArgs,
63643
63712
  main
63644
63713
  };
63645
- //# sourceMappingURL=chunk-JEFUWIZL.js.map
63714
+ //# sourceMappingURL=chunk-2DMOFAJO.js.map