@tempo-ai/visual-review 0.0.2 → 0.0.107-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-X7OOU6H4.js")).main(commandArgs);
9
+ return await (await import("./cli-JCGZRFSY.js")).main(commandArgs);
10
10
  case "claim":
11
11
  return await (await import("./claim-WI2ZVIDS.js")).main(commandArgs);
12
12
  case "report":
@@ -534,6 +534,9 @@ function installRenderProfileInPage() {
534
534
  const renderers = /* @__PURE__ */ new Map();
535
535
  profileWindow.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
536
536
  supportsFiber: true,
537
+ // Consumers that also load `modules/iframe-projection` see this window
538
+ // property through its global `DevToolsHook` augmentation, where
539
+ // `renderers` is typed by ReactRenderer; this stub only counts them.
537
540
  renderers,
538
541
  inject(renderer) {
539
542
  profile.reactInjectedMs ??= performance.now() - profile.startedAtMs;
@@ -4603,7 +4606,7 @@ async function parcelEventToFileEvent(event, rootInfo) {
4603
4606
  // ../tempo-sdk/package.json
4604
4607
  var package_default = {
4605
4608
  name: "tempo-sdk",
4606
- version: "0.0.38",
4609
+ version: "0.0.40",
4607
4610
  type: "module",
4608
4611
  description: "Tempo SDK \u2014 Vite, Next.js, and Expo plugins for JSX annotation and shared page/storyboard types",
4609
4612
  repository: {
@@ -12233,6 +12236,44 @@ async function readTempoDevserverConfig(tempoConfigPath) {
12233
12236
  tempoHostUrl: config.urls?.tempoHost ?? null
12234
12237
  };
12235
12238
  }
12239
+ function projectRootForTempoDir(tempoDir) {
12240
+ const resolved = path14.resolve(tempoDir);
12241
+ return path14.basename(resolved) === "tempo" ? path14.dirname(resolved) : resolved;
12242
+ }
12243
+ async function resolveCanvasHostLayout(options) {
12244
+ const repoRoot = path14.resolve(options.repoRoot);
12245
+ const candidates = options.tempoDir ? [path14.join(path14.resolve(options.tempoDir), "tempo.config.json")] : [
12246
+ path14.join(repoRoot, "tempo", "tempo.config.json"),
12247
+ path14.join(repoRoot, "tempo.config.json")
12248
+ ];
12249
+ for (const configPath of candidates) {
12250
+ let parsed;
12251
+ try {
12252
+ parsed = JSON.parse(await readFile10(configPath, "utf-8"));
12253
+ } catch {
12254
+ continue;
12255
+ }
12256
+ if (typeof parsed !== "object" || parsed === null || !("scripts" in parsed)) {
12257
+ continue;
12258
+ }
12259
+ const tempoDir2 = path14.dirname(configPath);
12260
+ const paths = parsed.paths;
12261
+ const canvases = typeof paths?.canvases === "string" && paths.canvases.trim().length > 0 ? paths.canvases.trim().split("\\").join("/") : "designs";
12262
+ return {
12263
+ tempoDir: tempoDir2,
12264
+ projectRoot: projectRootForTempoDir(tempoDir2),
12265
+ pagesDir: path14.resolve(tempoDir2, canvases),
12266
+ configPath
12267
+ };
12268
+ }
12269
+ const tempoDir = options.tempoDir ? path14.resolve(options.tempoDir) : path14.join(repoRoot, "tempo");
12270
+ return {
12271
+ tempoDir,
12272
+ projectRoot: projectRootForTempoDir(tempoDir),
12273
+ pagesDir: path14.join(tempoDir, "designs"),
12274
+ configPath: null
12275
+ };
12276
+ }
12236
12277
  function resolveTempoDir(options) {
12237
12278
  if (options.tempoConfigPath) return path14.dirname(options.tempoConfigPath);
12238
12279
  if (options.tempoDir) return options.tempoDir;
@@ -12317,7 +12358,7 @@ async function startDevserverSession(options) {
12317
12358
  scripts: config.scripts
12318
12359
  });
12319
12360
  await devServer.initialize();
12320
- const projectRoot = path14.dirname(tempoDir);
12361
+ const projectRoot = projectRootForTempoDir(tempoDir);
12321
12362
  for (const hostCanvasPath of hostCanvasPaths) {
12322
12363
  await devServer.ensureCanvasRegistered(
12323
12364
  path14.join(projectRoot, hostCanvasPath)
@@ -12393,14 +12434,14 @@ async function startDevserverSession(options) {
12393
12434
  }
12394
12435
 
12395
12436
  // ../canvas-capture-headless/src/enumerate.ts
12396
- import { readFile as readFile11 } from "fs/promises";
12437
+ import { access as access4, readFile as readFile11 } from "fs/promises";
12397
12438
  import path15 from "path";
12398
12439
  function toPosixPath2(value) {
12399
12440
  return value.split(path15.sep).join("/");
12400
12441
  }
12401
12442
  async function enumerateCanvasStoryboards(options) {
12402
12443
  const pagesDir = options.pagesDir ?? path15.join(options.tempoDir, "designs");
12403
- const projectRoot = path15.dirname(options.tempoDir);
12444
+ const projectRoot = projectRootForTempoDir(options.tempoDir);
12404
12445
  const canvasFiles = await scanCanvasFiles(pagesDir);
12405
12446
  const storyboards = [];
12406
12447
  const structuralErrors = [];
@@ -12465,6 +12506,61 @@ async function enumerateCanvasStoryboards(options) {
12465
12506
  vrtConfigErrors
12466
12507
  };
12467
12508
  }
12509
+ async function enumerateTrackedStoryboards(options) {
12510
+ try {
12511
+ await access4(options.tempoDir);
12512
+ } catch {
12513
+ return {
12514
+ tracked: [],
12515
+ paused: [],
12516
+ totalStoryboards: 0,
12517
+ totalCanvases: 0,
12518
+ errors: []
12519
+ };
12520
+ }
12521
+ const enumeration = await enumerateCanvasStoryboards(options);
12522
+ const tracked = [];
12523
+ const paused = [];
12524
+ const errors = [
12525
+ ...enumeration.structuralErrors,
12526
+ ...enumeration.vrtConfigErrors
12527
+ ];
12528
+ for (const storyboard of enumeration.storyboards) {
12529
+ if (!storyboard.vrt) continue;
12530
+ const board = {
12531
+ canvasPath: storyboard.canvasPath,
12532
+ hostCanvasPath: storyboard.hostCanvasPath,
12533
+ storyboardId: storyboard.storyboardId,
12534
+ name: storyboard.name,
12535
+ layout: storyboard.layout,
12536
+ threshold: storyboard.vrt.threshold,
12537
+ ignore: storyboard.vrt.ignore
12538
+ };
12539
+ const maskedArea = (storyboard.vrt.ignore ?? []).reduce(
12540
+ (total, region) => total + Math.max(0, Math.min(region.w, board.layout.width)) * Math.max(0, Math.min(region.h, board.layout.height)),
12541
+ 0
12542
+ );
12543
+ if (maskedArea >= 0.9 * board.layout.width * board.layout.height) {
12544
+ errors.push({
12545
+ filePath: storyboard.filePath,
12546
+ message: `<Storyboard id="${storyboard.storyboardId}"> vrt.ignore masks \u226590% of the board \u2014 untrack it instead`
12547
+ });
12548
+ continue;
12549
+ }
12550
+ if (storyboard.vrt.skip) {
12551
+ paused.push(board);
12552
+ continue;
12553
+ }
12554
+ tracked.push(board);
12555
+ }
12556
+ return {
12557
+ tracked,
12558
+ paused,
12559
+ totalStoryboards: enumeration.totalStoryboards,
12560
+ totalCanvases: enumeration.totalCanvases,
12561
+ errors
12562
+ };
12563
+ }
12468
12564
 
12469
12565
  // ../canvas-capture-headless/src/timing.ts
12470
12566
  function percentile(sortedValues, p) {
@@ -12544,64 +12640,8 @@ var TimingReport = class {
12544
12640
  };
12545
12641
 
12546
12642
  // src/enumerate.ts
12547
- import { access as access4 } from "fs/promises";
12548
- async function enumerateTrackedStoryboards(options) {
12549
- try {
12550
- await access4(options.tempoDir);
12551
- } catch {
12552
- return {
12553
- tracked: [],
12554
- paused: [],
12555
- totalStoryboards: 0,
12556
- totalCanvases: 0,
12557
- errors: []
12558
- };
12559
- }
12560
- const enumeration = await enumerateCanvasStoryboards({
12561
- tempoDir: options.tempoDir,
12562
- pagesDir: options.pagesDir
12563
- });
12564
- const tracked = [];
12565
- const paused = [];
12566
- const errors = [
12567
- ...enumeration.structuralErrors,
12568
- ...enumeration.vrtConfigErrors
12569
- ];
12570
- for (const storyboard of enumeration.storyboards) {
12571
- if (!storyboard.vrt) continue;
12572
- const board = {
12573
- canvasPath: storyboard.canvasPath,
12574
- hostCanvasPath: storyboard.hostCanvasPath,
12575
- storyboardId: storyboard.storyboardId,
12576
- name: storyboard.name,
12577
- layout: storyboard.layout,
12578
- threshold: storyboard.vrt.threshold,
12579
- ignore: storyboard.vrt.ignore
12580
- };
12581
- const maskedArea = (storyboard.vrt.ignore ?? []).reduce(
12582
- (total, region) => total + Math.max(0, Math.min(region.w, board.layout.width)) * Math.max(0, Math.min(region.h, board.layout.height)),
12583
- 0
12584
- );
12585
- if (maskedArea >= 0.9 * board.layout.width * board.layout.height) {
12586
- errors.push({
12587
- filePath: storyboard.filePath,
12588
- message: `<Storyboard id="${storyboard.storyboardId}"> vrt.ignore masks \u226590% of the board \u2014 untrack it instead`
12589
- });
12590
- continue;
12591
- }
12592
- if (storyboard.vrt.skip) {
12593
- paused.push(board);
12594
- continue;
12595
- }
12596
- tracked.push(board);
12597
- }
12598
- return {
12599
- tracked,
12600
- paused,
12601
- totalStoryboards: enumeration.totalStoryboards,
12602
- totalCanvases: enumeration.totalCanvases,
12603
- errors
12604
- };
12643
+ async function enumerateTrackedStoryboards2(options) {
12644
+ return await enumerateTrackedStoryboards(options);
12605
12645
  }
12606
12646
 
12607
12647
  // src/fingerprint.ts
@@ -12824,6 +12864,7 @@ function parseArgs(argv) {
12824
12864
  const args = {
12825
12865
  repoRoot: inferRepoRoot(),
12826
12866
  tempoDir: "",
12867
+ tempoDirExplicit: false,
12827
12868
  // The published CLI is intentionally near-argumentless in Actions. Local
12828
12869
  // capture remains Convex-free unless --upload is explicit.
12829
12870
  upload: process.env.GITHUB_ACTIONS === "true" && inferredTrigger !== "manual",
@@ -12854,6 +12895,7 @@ function parseArgs(argv) {
12854
12895
  break;
12855
12896
  case "--tempo-dir":
12856
12897
  args.tempoDir = path16.resolve(next());
12898
+ args.tempoDirExplicit = true;
12857
12899
  break;
12858
12900
  case "--out":
12859
12901
  args.out = path16.resolve(next());
@@ -13046,6 +13088,12 @@ function startClaimHeartbeat(options) {
13046
13088
  }
13047
13089
  };
13048
13090
  }
13091
+ function explicitTempoDirRelative(args) {
13092
+ if (!args.tempoDirExplicit) return void 0;
13093
+ const relative2 = path16.relative(args.repoRoot, args.tempoDir);
13094
+ if (relative2.startsWith("..") || path16.isAbsolute(relative2)) return void 0;
13095
+ return relative2;
13096
+ }
13049
13097
  function buildBaselineCaptureArgs(input) {
13050
13098
  const args = [
13051
13099
  "capture",
@@ -13067,6 +13115,12 @@ function buildBaselineCaptureArgs(input) {
13067
13115
  ];
13068
13116
  if (input.url) args.push("--url", input.url);
13069
13117
  if (input.githubRepo) args.push("--github-repo", input.githubRepo);
13118
+ if (input.tempoDirRelative !== void 0) {
13119
+ args.push(
13120
+ "--tempo-dir",
13121
+ path16.join(input.worktreeRoot, input.tempoDirRelative || ".")
13122
+ );
13123
+ }
13070
13124
  if (input.repoKey) args.push("--repo-key", input.repoKey);
13071
13125
  if (input.settleTimeoutMs !== void 0) {
13072
13126
  args.push("--settle-timeout", String(input.settleTimeoutMs));
@@ -13101,7 +13155,8 @@ async function runBaselineCaptureInWorktree(options) {
13101
13155
  url: options.args.url,
13102
13156
  githubRepo: options.args.githubRepo,
13103
13157
  repoKey: options.args.repoKey,
13104
- settleTimeoutMs: options.args.settleTimeoutMs
13158
+ settleTimeoutMs: options.args.settleTimeoutMs,
13159
+ tempoDirRelative: explicitTempoDirRelative(options.args)
13105
13160
  })
13106
13161
  ];
13107
13162
  await new Promise((resolve2, reject) => {
@@ -13152,10 +13207,15 @@ async function main(argv = process.argv.slice(2)) {
13152
13207
  if (args.trigger === "pr" && baseCandidates.length === 0) {
13153
13208
  throw new Error("--trigger pr requires --base <merge-base sha>");
13154
13209
  }
13155
- const pagesDir = path16.join(args.tempoDir, "designs");
13210
+ const layout = await resolveCanvasHostLayout({
13211
+ repoRoot: args.repoRoot,
13212
+ tempoDir: args.tempoDirExplicit ? args.tempoDir : void 0
13213
+ });
13214
+ args.tempoDir = layout.tempoDir;
13215
+ const pagesDir = layout.pagesDir;
13156
13216
  const enumeration = await timing.phase(
13157
13217
  "enumerate",
13158
- () => enumerateTrackedStoryboards({ tempoDir: args.tempoDir, pagesDir })
13218
+ () => enumerateTrackedStoryboards2({ tempoDir: args.tempoDir, pagesDir })
13159
13219
  );
13160
13220
  if (enumeration.errors.length > 0) {
13161
13221
  for (const error of enumeration.errors) {
@@ -13608,13 +13668,14 @@ export {
13608
13668
  percentile,
13609
13669
  summarize,
13610
13670
  TimingReport,
13611
- enumerateTrackedStoryboards,
13671
+ enumerateTrackedStoryboards2 as enumerateTrackedStoryboards,
13612
13672
  scaleIgnoreRegionsToDevicePx,
13613
13673
  VisualReviewHttpError,
13614
13674
  VisualReviewIngestClient,
13615
13675
  resolveOrClaimBaseline,
13676
+ explicitTempoDirRelative,
13616
13677
  buildBaselineCaptureArgs,
13617
13678
  main,
13618
13679
  VISUAL_REVIEW_OIDC_AUDIENCE
13619
13680
  };
13620
- //# sourceMappingURL=chunk-HTDJZ32L.js.map
13681
+ //# sourceMappingURL=chunk-MW6S36CX.js.map