@tempo-ai/visual-review 0.0.126-staging.2 → 0.0.127-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
@@ -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-ZHNSPGSE.js")).main(commandArgs);
10
+ return await (await import("./cli-TDKLDTXX.js")).main(commandArgs);
11
11
  case "claim":
12
12
  return await (await import("./claim-C5UVLSMX.js")).main(commandArgs);
13
13
  case "report":
@@ -16018,6 +16018,7 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
16018
16018
  var remaining = Math.max(0, Math.min(options.timeoutMs, options.resourceBudget ? options.resourceBudget.remainingMs : options.timeoutMs));
16019
16019
  var timerAt;
16020
16020
  var queued = 0;
16021
+ var admittedSlice;
16021
16022
  var checksPending = false;
16022
16023
  var checksDirty = false;
16023
16024
  var revision = 0;
@@ -16028,6 +16029,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
16028
16029
  failures.push(url ? { kind: kind, url: url } : { kind: kind });
16029
16030
  }
16030
16031
  function finish(status) {
16032
+ if (stopped) return;
16033
+ if (status === 'ready' && options.onReadyProof) options.onReadyProof();
16031
16034
  if (stopped) return;
16032
16035
  stopped = true;
16033
16036
  if (options.resourceBudget) options.resourceBudget.remainingMs = queued ? remaining :
@@ -16058,7 +16061,10 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
16058
16061
  remaining = Math.max(0, remaining - (Date.now() - timerAt));
16059
16062
  }
16060
16063
  try {
16064
+ if (admittedSlice && admittedSlice.canContinue && admittedSlice.canContinue())
16065
+ return callback(admittedSlice);
16061
16066
  return await Promise.race([terminal, options.scheduleWork(function(slice) {
16067
+ admittedSlice = slice;
16062
16068
  if (!stopped) return callback(slice);
16063
16069
  }, options.signal)]);
16064
16070
  } finally {
@@ -16130,9 +16136,27 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
16130
16136
  return Array.from(doc.querySelectorAll('img')).filter(visibleImage);
16131
16137
  }
16132
16138
  async function scheduledImages() {
16133
- var candidates = await work(function() { return Array.from(doc.querySelectorAll('img')); });
16134
- if (stopped) return [];
16135
- return mapWork(candidates, function(img) { if (visibleImage(img)) return img; });
16139
+ var candidates, selected = [], offset = 0;
16140
+ do {
16141
+ await work(function(slice) {
16142
+ if (!candidates) candidates = Array.from(doc.querySelectorAll('img'));
16143
+ var limit = Math.min(offset + 32, candidates.length);
16144
+ while (offset < limit) {
16145
+ var img = candidates[offset++];
16146
+ if (visibleImage(img)) selected.push(img);
16147
+ if (slice && !slice.hasTime()) break;
16148
+ }
16149
+ });
16150
+ } while (!stopped && candidates && offset < candidates.length);
16151
+ return selected;
16152
+ }
16153
+ function decodeImage(img) {
16154
+ if (!img.isConnected || !visibleImage(img)) return {};
16155
+ if (!img.naturalWidth) { failure('image', img.currentSrc || img.src); return {}; }
16156
+ // A holder keeps a resource decode promise outside CPU admission.
16157
+ return { decode: img.decode && img.decode().catch(function() {
16158
+ failure('image', img.currentSrc || img.src);
16159
+ }) };
16136
16160
  }
16137
16161
  function waitElement(element, ready, kind, url) {
16138
16162
  if (ready()) return Promise.resolve();
@@ -16175,23 +16199,30 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
16175
16199
  };
16176
16200
  }
16177
16201
  async function scheduledInventory() {
16178
- var atRevision = revision;
16179
- var selectedLinks = await work(links);
16180
- if (stopped) return { links: [], images: [], styles: [] };
16181
- var selectedImages = await scheduledImages();
16182
- return {
16183
- revision: atRevision,
16184
- links: selectedLinks.map(function(link) {
16185
- // Resource evidence can change during a font/image await without
16186
- // changing this node's URL or media. Revalidate the same readiness
16187
- // facts, not CSSStyleSheet object identities or a content hash.
16188
- return [link, link.href, link.media, !!link.sheet,
16189
- link.getAttribute('data-tempo-stylesheet-pending') === link.href,
16190
- link.getAttribute('data-tempo-stylesheet-error') === link.href];
16191
- }),
16192
- images: selectedImages.map(function(img) { return [img, img.currentSrc, img.src, img.srcset]; }),
16193
- styles: await work(function() { return Array.from(doc.querySelectorAll('style')).map(function(style) { return [style, style.textContent]; }); })
16194
- };
16202
+ var candidates, offset = 0;
16203
+ var result = { revision: revision, links: [], images: [], styles: [] };
16204
+ // Small inventories finish in one admission. Large ones retain the
16205
+ // same 32-node/time bound, without paying a task per resource category.
16206
+ do {
16207
+ await work(function(slice) {
16208
+ if (!candidates) candidates = Array.from(doc.querySelectorAll('link[rel~="stylesheet"],img,style'));
16209
+ var limit = Math.min(offset + 32, candidates.length);
16210
+ while (offset < limit) {
16211
+ var node = candidates[offset++];
16212
+ if (node.localName === 'link' && applicable(node)) {
16213
+ result.links.push([node, node.href, node.media, !!node.sheet,
16214
+ node.getAttribute('data-tempo-stylesheet-pending') === node.href,
16215
+ node.getAttribute('data-tempo-stylesheet-error') === node.href]);
16216
+ } else if (node.localName === 'img' && visibleImage(node)) {
16217
+ result.images.push([node, node.currentSrc, node.src, node.srcset]);
16218
+ } else if (node.localName === 'style') {
16219
+ result.styles.push([node, node.textContent]);
16220
+ }
16221
+ if (slice && !slice.hasTime()) break;
16222
+ }
16223
+ });
16224
+ } while (!stopped && candidates && offset < candidates.length);
16225
+ return result;
16195
16226
  }
16196
16227
  function same(a, b) {
16197
16228
  return ['links', 'images', 'styles'].every(function(key) {
@@ -16233,27 +16264,30 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
16233
16264
  var selected = options.scheduleWork ? await scheduledImages() : images();
16234
16265
  if (stopped) return;
16235
16266
  if (options.scheduleWork) {
16267
+ var pendingImages = [], pendingLoads = [];
16236
16268
  var imageWaits = await mapWork(selected, function(img) {
16237
- return (async function() {
16238
- if (img.loading === 'lazy') img.loading = 'eager';
16239
- await Promise.race([terminal, waitElement(img, function() {
16240
- return !img.isConnected || !visibleImage(img) || img.complete;
16241
- }, 'image', img.currentSrc || img.src)]);
16242
- if (stopped) return;
16243
- var proof = await work(function() {
16244
- if (!img.isConnected || !visibleImage(img)) return {};
16245
- if (!img.naturalWidth) { failure('image', img.currentSrc || img.src); return {}; }
16246
- // Return a holder, so the resource decode promise itself does
16247
- // not pause its timeout as if it were queued CPU work.
16248
- return { decode: img.decode && img.decode().catch(function() {
16249
- failure('image', img.currentSrc || img.src);
16250
- }) };
16251
- });
16252
- if (stopped) return;
16253
- await Promise.race([terminal, Promise.resolve(proof.decode)]);
16254
- })().catch(function() { finish('cancelled'); });
16269
+ if (img.loading === 'lazy') img.loading = 'eager';
16270
+ // Warm images need no load-event continuation. Prepare their
16271
+ // decodes in this bounded batch rather than one new task per image.
16272
+ if (img.complete) {
16273
+ var proof = decodeImage(img);
16274
+ return Promise.race([terminal, Promise.resolve(proof.decode)]);
16275
+ }
16276
+ pendingImages.push(img);
16277
+ pendingLoads.push(Promise.race([terminal, waitElement(img, function() {
16278
+ return !img.isConnected || !visibleImage(img) || img.complete;
16279
+ }, 'image', img.currentSrc || img.src)]));
16280
+ });
16281
+ await Promise.race([terminal, Promise.all(pendingLoads)]);
16282
+ if (stopped) return;
16283
+ // Load events often arrive together from the browser cache. Decode
16284
+ // their now-ready images in bounded batches, rather than granting
16285
+ // each event its own renderer task. Warm decodes above stay in flight.
16286
+ var loadedDecodes = await mapWork(pendingImages, function(img) {
16287
+ var proof = decodeImage(img);
16288
+ return Promise.race([terminal, Promise.resolve(proof.decode)]);
16255
16289
  });
16256
- await Promise.race([terminal, Promise.all(imageWaits)]);
16290
+ await Promise.race([terminal, Promise.all(imageWaits.concat(loadedDecodes))]);
16257
16291
  } else {
16258
16292
  await Promise.race([terminal, Promise.all(selected.map(async function(img) {
16259
16293
  if (img.loading === 'lazy') img.loading = 'eager';
@@ -16276,7 +16310,7 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
16276
16310
  // A scheduled inventory can span multiple tasks. A mutation during
16277
16311
  // its geometry reads cannot certify a mixed document observation.
16278
16312
  if (options.scheduleWork && observer.takeRecords().length) revision++;
16279
- if ((!options.scheduleWork || (before.revision === after.revision && after.revision === revision)) &&
16313
+ if ((!options.scheduleWork || options.requireStableDom === false || (before.revision === after.revision && after.revision === revision)) &&
16280
16314
  same(before, after) && (!doc.fonts || fontRejected ||
16281
16315
  (doc.fonts.status !== 'loading' && doc.fonts.ready === fontPromise))) {
16282
16316
  finish('ready'); return;
@@ -17733,7 +17767,7 @@ var MissingRootDepsError = class extends TempoDevServerError {
17733
17767
  // ../tempo-sdk/package.json
17734
17768
  var package_default = {
17735
17769
  name: "tempo-sdk",
17736
- version: "0.0.60",
17770
+ version: "0.0.61",
17737
17771
  publishConfig: {
17738
17772
  tag: "sdk-v2-latest"
17739
17773
  },
@@ -17862,6 +17896,8 @@ var package_default = {
17862
17896
  "@vitejs/plugin-react": "catalog:",
17863
17897
  playwright: "^1.58.2",
17864
17898
  "react-dom": "catalog:",
17899
+ "react-dom18": "npm:react-dom@18.3.1",
17900
+ react18: "npm:react@18.3.1",
17865
17901
  svelte: "5.56.9",
17866
17902
  tsup: "^8.5.1",
17867
17903
  typescript: "catalog:",
@@ -30290,4 +30326,4 @@ export {
30290
30326
  buildBaselineCaptureArgs,
30291
30327
  main
30292
30328
  };
30293
- //# sourceMappingURL=chunk-5WAJ4KGX.js.map
30329
+ //# sourceMappingURL=chunk-TJHA5ZXN.js.map