@tempo-ai/visual-review 0.0.139 → 0.0.140

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.
@@ -29529,6 +29529,7 @@ function buildSettleWaitScript(options) {
29529
29529
  return `
29530
29530
  (function() {
29531
29531
  var selector = ${JSON.stringify(options.selector)};
29532
+ var waitForMedia = ${options.waitForMedia !== false};
29532
29533
  var pendingSelector = ${JSON.stringify(options.pendingSelector ?? null)};
29533
29534
  var quietMs = ${quietMs};
29534
29535
  var stepTimeoutMs = ${stepTimeoutMs};
@@ -29770,7 +29771,7 @@ function buildSettleWaitScript(options) {
29770
29771
  releaseVideoFrames();
29771
29772
  return false;
29772
29773
  }
29773
- var videos = renderedMatches(target, 'video');
29774
+ var videos = waitForMedia ? renderedMatches(target, 'video') : [];
29774
29775
  if (strictVideoFrames) {
29775
29776
  videoFrames.forEach(function(entry) {
29776
29777
  if (videos.indexOf(entry.video) === -1) releaseVideoFrame(entry);
@@ -29788,7 +29789,7 @@ function buildSettleWaitScript(options) {
29788
29789
  return false;
29789
29790
  }
29790
29791
  }
29791
- var images = renderedImages(target);
29792
+ var images = waitForMedia ? renderedImages(target) : [];
29792
29793
  for (var i = 0; i < images.length; i++) {
29793
29794
  if (images[i].loading === 'lazy') images[i].loading = 'eager';
29794
29795
  }
@@ -38288,9 +38289,9 @@ async function settleAstroDocument(page, target, timeout) {
38288
38289
  });
38289
38290
  }
38290
38291
 
38291
- // ../../modules/iframe-projection/visual-readiness.ts
38292
- var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38293
- return new Promise(function(resolve) {
38292
+ // ../../modules/iframe-projection/visual-readiness-source.ts
38293
+ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness(doc, options) {
38294
+ return new Promise(function (resolve) {
38294
38295
  var view = doc.defaultView;
38295
38296
  var failures = [];
38296
38297
  var failedLinks = new WeakMap();
@@ -38299,7 +38300,15 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38299
38300
  var stopped = false;
38300
38301
  var timer;
38301
38302
  var observer;
38302
- var remaining = Math.max(0, Math.min(options.timeoutMs, options.resourceBudget ? options.resourceBudget.remainingMs : options.timeoutMs));
38303
+ var remaining = Math.max(
38304
+ 0,
38305
+ Math.min(
38306
+ options.timeoutMs,
38307
+ options.resourceBudget
38308
+ ? options.resourceBudget.remainingMs
38309
+ : options.timeoutMs,
38310
+ ),
38311
+ );
38303
38312
  var timerAt;
38304
38313
  var queued = 0;
38305
38314
  var admittedSlice;
@@ -38307,34 +38316,56 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38307
38316
  var checksDirty = false;
38308
38317
  var revision = 0;
38309
38318
  var terminalResolve;
38310
- var terminal = new Promise(function(done) { terminalResolve = done; });
38319
+ var terminal = new Promise(function (done) {
38320
+ terminalResolve = done;
38321
+ });
38311
38322
  function failure(kind, url) {
38312
- if (!failures.some(function(item) { return item.kind === kind && item.url === url; }))
38323
+ if (
38324
+ !failures.some(function (item) {
38325
+ return item.kind === kind && item.url === url;
38326
+ })
38327
+ )
38313
38328
  failures.push(url ? { kind: kind, url: url } : { kind: kind });
38314
38329
  }
38315
38330
  function finish(status) {
38316
38331
  if (stopped) return;
38317
- if (status === 'ready' && options.onReadyProof) options.onReadyProof();
38332
+ if (status === "ready" && options.onReadyProof) options.onReadyProof();
38318
38333
  if (stopped) return;
38319
38334
  stopped = true;
38320
- if (options.resourceBudget) options.resourceBudget.remainingMs = queued ? remaining :
38321
- Math.max(0, remaining - (timerAt === undefined ? 0 : Date.now() - timerAt));
38335
+ if (options.resourceBudget)
38336
+ options.resourceBudget.remainingMs = queued
38337
+ ? remaining
38338
+ : Math.max(
38339
+ 0,
38340
+ remaining - (timerAt === undefined ? 0 : Date.now() - timerAt),
38341
+ );
38322
38342
  clearTimeout(timer);
38323
38343
  if (observer) observer.disconnect();
38324
38344
  for (var cleanup of cleanups) cleanup();
38325
38345
  cleanups.clear();
38326
38346
  checks.clear();
38327
- if (options.signal) options.signal.removeEventListener('abort', cancel);
38347
+ if (options.signal) options.signal.removeEventListener("abort", cancel);
38328
38348
  terminalResolve();
38329
38349
  resolve({ status: status, failures: failures });
38330
38350
  }
38331
- function cancel() { finish('cancelled'); }
38332
- if (options.signal && options.signal.aborted) { cancel(); return; }
38333
- if (!view) { cancel(); return; }
38334
- if (options.signal) options.signal.addEventListener('abort', cancel, { once: true });
38351
+ function cancel() {
38352
+ finish("cancelled");
38353
+ }
38354
+ if (options.signal && options.signal.aborted) {
38355
+ cancel();
38356
+ return;
38357
+ }
38358
+ if (!view) {
38359
+ cancel();
38360
+ return;
38361
+ }
38362
+ if (options.signal)
38363
+ options.signal.addEventListener("abort", cancel, { once: true });
38335
38364
  function startTimer() {
38336
38365
  timerAt = Date.now();
38337
- timer = setTimeout(function() { finish('timeout'); }, remaining);
38366
+ timer = setTimeout(function () {
38367
+ finish("timeout");
38368
+ }, remaining);
38338
38369
  }
38339
38370
  startTimer();
38340
38371
  async function work(callback) {
@@ -38345,12 +38376,19 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38345
38376
  remaining = Math.max(0, remaining - (Date.now() - timerAt));
38346
38377
  }
38347
38378
  try {
38348
- if (admittedSlice && admittedSlice.canContinue && admittedSlice.canContinue())
38379
+ if (
38380
+ admittedSlice &&
38381
+ admittedSlice.canContinue &&
38382
+ admittedSlice.canContinue()
38383
+ )
38349
38384
  return callback(admittedSlice);
38350
- return await Promise.race([terminal, options.scheduleWork(function(slice) {
38351
- admittedSlice = slice;
38352
- if (!stopped) return callback(slice);
38353
- }, options.signal)]);
38385
+ return await Promise.race([
38386
+ terminal,
38387
+ options.scheduleWork(function (slice) {
38388
+ admittedSlice = slice;
38389
+ if (!stopped) return callback(slice);
38390
+ }, options.signal),
38391
+ ]);
38354
38392
  } finally {
38355
38393
  if (--queued === 0 && !stopped) startTimer();
38356
38394
  }
@@ -38359,7 +38397,7 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38359
38397
  var rows = [];
38360
38398
  var offset = 0;
38361
38399
  while (offset < items.length && !stopped) {
38362
- await work(function(slice) {
38400
+ await work(function (slice) {
38363
38401
  var limit = Math.min(offset + 32, items.length);
38364
38402
  do {
38365
38403
  var value = callback(items[offset++]);
@@ -38369,19 +38407,34 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38369
38407
  }
38370
38408
  return rows;
38371
38409
  }
38372
- if (remaining <= 0) { finish('timeout'); return; }
38410
+ if (remaining <= 0) {
38411
+ finish("timeout");
38412
+ return;
38413
+ }
38373
38414
  function changed() {
38374
38415
  if (stopped) return;
38375
- if (!options.scheduleWork) { for (var check of checks) check(); return; }
38376
- if (checksPending) { checksDirty = true; return; }
38416
+ if (!options.scheduleWork) {
38417
+ for (var check of checks) check();
38418
+ return;
38419
+ }
38420
+ if (checksPending) {
38421
+ checksDirty = true;
38422
+ return;
38423
+ }
38377
38424
  checksPending = true;
38378
38425
  checksDirty = false;
38379
- mapWork(Array.from(checks), function(check) { check(); }).finally(function() {
38380
- checksPending = false;
38381
- if (checksDirty) changed();
38382
- }).catch(function() { finish('cancelled'); });
38426
+ mapWork(Array.from(checks), function (check) {
38427
+ check();
38428
+ })
38429
+ .finally(function () {
38430
+ checksPending = false;
38431
+ if (checksDirty) changed();
38432
+ })
38433
+ .catch(function () {
38434
+ finish("cancelled");
38435
+ });
38383
38436
  }
38384
- observer = new view.MutationObserver(function() {
38437
+ observer = new view.MutationObserver(function () {
38385
38438
  revision++;
38386
38439
  changed();
38387
38440
  });
@@ -38389,41 +38442,62 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38389
38442
  // Opt-in admission may begin after a resource's terminal event. Preserve
38390
38443
  // its URL-scoped failure evidence while the initial inventory is queued.
38391
38444
  if (options.scheduleWork) {
38392
- var captureError = function(event) {
38445
+ var captureError = function (event) {
38393
38446
  var link = event.target;
38394
- if (link && link.tagName === 'LINK' && link.relList.contains('stylesheet') && applicable(link)) {
38447
+ if (
38448
+ link &&
38449
+ link.tagName === "LINK" &&
38450
+ link.relList.contains("stylesheet") &&
38451
+ applicable(link)
38452
+ ) {
38395
38453
  failedLinks.set(link, link.href);
38396
- failure('stylesheet', link.href);
38454
+ failure("stylesheet", link.href);
38397
38455
  changed();
38398
38456
  }
38399
38457
  };
38400
- doc.addEventListener('error', captureError, true);
38401
- cleanups.add(function() { doc.removeEventListener('error', captureError, true); });
38458
+ doc.addEventListener("error", captureError, true);
38459
+ cleanups.add(function () {
38460
+ doc.removeEventListener("error", captureError, true);
38461
+ });
38402
38462
  }
38403
38463
 
38404
38464
  function applicable(link) {
38405
- return link.isConnected && !link.disabled &&
38406
- (!link.media || !view.matchMedia || view.matchMedia(link.media).matches);
38465
+ return (
38466
+ link.isConnected &&
38467
+ !link.disabled &&
38468
+ (!link.media || !view.matchMedia || view.matchMedia(link.media).matches)
38469
+ );
38407
38470
  }
38408
38471
  function links() {
38409
- return Array.from(doc.querySelectorAll('link[rel~="stylesheet"]')).filter(applicable);
38472
+ return Array.from(doc.querySelectorAll('link[rel~="stylesheet"]')).filter(
38473
+ applicable,
38474
+ );
38410
38475
  }
38411
38476
  function visibleImage(img) {
38412
38477
  if (!img.isConnected) return false;
38413
38478
  var rect = img.getBoundingClientRect();
38414
38479
  var style = view.getComputedStyle(img);
38415
- return rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.right > 0 &&
38416
- rect.top < view.innerHeight && rect.left < view.innerWidth &&
38417
- style.visibility !== 'hidden' && style.visibility !== 'collapse';
38480
+ return (
38481
+ rect.width > 0 &&
38482
+ rect.height > 0 &&
38483
+ rect.bottom > 0 &&
38484
+ rect.right > 0 &&
38485
+ rect.top < view.innerHeight &&
38486
+ rect.left < view.innerWidth &&
38487
+ style.visibility !== "hidden" &&
38488
+ style.visibility !== "collapse"
38489
+ );
38418
38490
  }
38419
38491
  function images() {
38420
- return Array.from(doc.querySelectorAll('img')).filter(visibleImage);
38492
+ return Array.from(doc.querySelectorAll("img")).filter(visibleImage);
38421
38493
  }
38422
38494
  async function scheduledImages() {
38423
- var candidates, selected = [], offset = 0;
38495
+ var candidates,
38496
+ selected = [],
38497
+ offset = 0;
38424
38498
  do {
38425
- await work(function(slice) {
38426
- if (!candidates) candidates = Array.from(doc.querySelectorAll('img'));
38499
+ await work(function (slice) {
38500
+ if (!candidates) candidates = Array.from(doc.querySelectorAll("img"));
38427
38501
  var limit = Math.min(offset + 32, candidates.length);
38428
38502
  while (offset < limit) {
38429
38503
  var img = candidates[offset++];
@@ -38436,70 +38510,107 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38436
38510
  }
38437
38511
  function decodeImage(img) {
38438
38512
  if (!img.isConnected || !visibleImage(img)) return {};
38439
- if (!img.naturalWidth) { failure('image', img.currentSrc || img.src); return {}; }
38513
+ if (!img.naturalWidth) {
38514
+ failure("image", img.currentSrc || img.src);
38515
+ return {};
38516
+ }
38440
38517
  // A holder keeps a resource decode promise outside CPU admission.
38441
- return { decode: img.decode && img.decode().catch(function() {
38442
- failure('image', img.currentSrc || img.src);
38443
- }) };
38518
+ return {
38519
+ decode:
38520
+ img.decode &&
38521
+ img.decode().catch(function () {
38522
+ failure("image", img.currentSrc || img.src);
38523
+ }),
38524
+ };
38444
38525
  }
38445
38526
  function waitElement(element, ready, kind, url) {
38446
38527
  if (ready()) return Promise.resolve();
38447
- return new Promise(function(done) {
38528
+ return new Promise(function (done) {
38448
38529
  function requestCheck() {
38449
38530
  if (options.scheduleWork) changed();
38450
38531
  else check();
38451
38532
  }
38452
38533
  function cleanup() {
38453
- element.removeEventListener('load', requestCheck);
38454
- element.removeEventListener('error', error);
38534
+ element.removeEventListener("load", requestCheck);
38535
+ element.removeEventListener("error", error);
38455
38536
  checks.delete(check);
38456
38537
  cleanups.delete(cleanup);
38457
38538
  }
38458
- function check() { if (ready()) { cleanup(); done(); } }
38539
+ function check() {
38540
+ if (ready()) {
38541
+ cleanup();
38542
+ done();
38543
+ }
38544
+ }
38459
38545
  function error() {
38460
38546
  failure(kind, url);
38461
- if (kind === 'stylesheet') failedLinks.set(element, url);
38462
- cleanup(); done();
38547
+ if (kind === "stylesheet") failedLinks.set(element, url);
38548
+ cleanup();
38549
+ done();
38463
38550
  }
38464
38551
  cleanups.add(cleanup);
38465
38552
  checks.add(check);
38466
- element.addEventListener('load', requestCheck);
38467
- element.addEventListener('error', error);
38553
+ element.addEventListener("load", requestCheck);
38554
+ element.addEventListener("error", error);
38468
38555
  check();
38469
38556
  });
38470
38557
  }
38471
38558
  function inventory() {
38472
38559
  return {
38473
- links: links().map(function(link) {
38560
+ links: links().map(function (link) {
38474
38561
  // Resource evidence can change during a font/image await without
38475
38562
  // changing this node's URL or media. Revalidate the same readiness
38476
38563
  // facts, not CSSStyleSheet object identities or a content hash.
38477
- return [link, link.href, link.media, !!link.sheet,
38478
- link.getAttribute('data-tempo-stylesheet-pending') === link.href,
38479
- link.getAttribute('data-tempo-stylesheet-error') === link.href];
38564
+ return [
38565
+ link,
38566
+ link.href,
38567
+ link.media,
38568
+ !!link.sheet,
38569
+ link.getAttribute("data-tempo-stylesheet-pending") === link.href,
38570
+ link.getAttribute("data-tempo-stylesheet-error") === link.href,
38571
+ ];
38572
+ }),
38573
+ images: images().map(function (img) {
38574
+ return [img, img.currentSrc, img.src, img.srcset];
38575
+ }),
38576
+ styles: Array.from(doc.querySelectorAll("style")).map(function (style) {
38577
+ return [style, style.textContent];
38480
38578
  }),
38481
- images: images().map(function(img) { return [img, img.currentSrc, img.src, img.srcset]; }),
38482
- styles: Array.from(doc.querySelectorAll('style')).map(function(style) { return [style, style.textContent]; })
38483
38579
  };
38484
38580
  }
38485
38581
  async function scheduledInventory() {
38486
- var candidates, offset = 0;
38582
+ var candidates,
38583
+ offset = 0;
38487
38584
  var result = { revision: revision, links: [], images: [], styles: [] };
38488
38585
  // Small inventories finish in one admission. Large ones retain the
38489
38586
  // same 32-node/time bound, without paying a task per resource category.
38490
38587
  do {
38491
- await work(function(slice) {
38492
- if (!candidates) candidates = Array.from(doc.querySelectorAll('link[rel~="stylesheet"],img,style'));
38588
+ await work(function (slice) {
38589
+ if (!candidates)
38590
+ candidates = Array.from(
38591
+ doc.querySelectorAll('link[rel~="stylesheet"],img,style'),
38592
+ );
38493
38593
  var limit = Math.min(offset + 32, candidates.length);
38494
38594
  while (offset < limit) {
38495
38595
  var node = candidates[offset++];
38496
- if (node.localName === 'link' && applicable(node)) {
38497
- result.links.push([node, node.href, node.media, !!node.sheet,
38498
- node.getAttribute('data-tempo-stylesheet-pending') === node.href,
38499
- node.getAttribute('data-tempo-stylesheet-error') === node.href]);
38500
- } else if (node.localName === 'img' && visibleImage(node)) {
38501
- result.images.push([node, node.currentSrc, node.src, node.srcset]);
38502
- } else if (node.localName === 'style') {
38596
+ if (node.localName === "link" && applicable(node)) {
38597
+ result.links.push([
38598
+ node,
38599
+ node.href,
38600
+ node.media,
38601
+ !!node.sheet,
38602
+ node.getAttribute("data-tempo-stylesheet-pending") ===
38603
+ node.href,
38604
+ node.getAttribute("data-tempo-stylesheet-error") === node.href,
38605
+ ]);
38606
+ } else if (node.localName === "img" && visibleImage(node)) {
38607
+ result.images.push([
38608
+ node,
38609
+ node.currentSrc,
38610
+ node.src,
38611
+ node.srcset,
38612
+ ]);
38613
+ } else if (node.localName === "style") {
38503
38614
  result.styles.push([node, node.textContent]);
38504
38615
  }
38505
38616
  if (slice && !slice.hasTime()) break;
@@ -38509,48 +38620,86 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38509
38620
  return result;
38510
38621
  }
38511
38622
  function same(a, b) {
38512
- return ['links', 'images', 'styles'].every(function(key) {
38513
- return a[key].length === b[key].length && a[key].every(function(row, i) {
38514
- return row.every(function(value, j) { return value === b[key][i][j]; });
38515
- });
38623
+ return ["links", "images", "styles"].every(function (key) {
38624
+ return (
38625
+ a[key].length === b[key].length &&
38626
+ a[key].every(function (row, i) {
38627
+ return row.every(function (value, j) {
38628
+ return value === b[key][i][j];
38629
+ });
38630
+ })
38631
+ );
38516
38632
  });
38517
38633
  }
38518
38634
  async function run() {
38519
38635
  while (!stopped) {
38520
- var before = options.scheduleWork ? await scheduledInventory() : inventory();
38636
+ var before = options.scheduleWork
38637
+ ? await scheduledInventory()
38638
+ : inventory();
38521
38639
  if (stopped) return;
38522
- await Promise.race([terminal, Promise.all(before.links.map(function(row) { return row[0]; }).map(function(link) {
38523
- if ((!link.sheet && (options.failedStylesheetUrls || []).includes(link.href)) ||
38524
- link.getAttribute('data-tempo-stylesheet-error') === link.href) {
38525
- failedLinks.set(link, link.href); failure('stylesheet', link.href);
38526
- }
38527
- return waitElement(link, function() {
38528
- return !applicable(link) || (link.getAttribute('data-tempo-stylesheet-pending') !== link.href &&
38529
- (!!link.sheet || failedLinks.get(link) === link.href));
38530
- }, 'stylesheet', link.href);
38531
- }))]);
38640
+ await Promise.race([
38641
+ terminal,
38642
+ Promise.all(
38643
+ before.links
38644
+ .map(function (row) {
38645
+ return row[0];
38646
+ })
38647
+ .map(function (link) {
38648
+ if (
38649
+ (!link.sheet &&
38650
+ (options.failedStylesheetUrls || []).includes(link.href)) ||
38651
+ link.getAttribute("data-tempo-stylesheet-error") === link.href
38652
+ ) {
38653
+ failedLinks.set(link, link.href);
38654
+ failure("stylesheet", link.href);
38655
+ }
38656
+ return waitElement(
38657
+ link,
38658
+ function () {
38659
+ return (
38660
+ !applicable(link) ||
38661
+ (link.getAttribute("data-tempo-stylesheet-pending") !==
38662
+ link.href &&
38663
+ (!!link.sheet || failedLinks.get(link) === link.href))
38664
+ );
38665
+ },
38666
+ "stylesheet",
38667
+ link.href,
38668
+ );
38669
+ }),
38670
+ ),
38671
+ ]);
38532
38672
  if (stopped) return;
38533
38673
  // Force stylesheet application/layout BEFORE reading the current font
38534
38674
  // promise. A previously fulfilled promise cannot certify newly used fonts.
38535
- var readFontPromise = function() {
38675
+ var readFontPromise = function () {
38536
38676
  if (doc.documentElement) doc.documentElement.getBoundingClientRect();
38537
38677
  // Read the CURRENT promise in the same admitted layout callback.
38538
38678
  return { promise: doc.fonts && doc.fonts.ready };
38539
38679
  };
38540
- var currentFonts = options.scheduleWork ? await work(readFontPromise) : readFontPromise();
38680
+ var currentFonts = options.scheduleWork
38681
+ ? await work(readFontPromise)
38682
+ : readFontPromise();
38541
38683
  if (stopped) return;
38542
38684
  var fontPromise = currentFonts.promise;
38543
38685
  var fontRejected = false;
38544
- await Promise.race([terminal, Promise.resolve(fontPromise).catch(function() {
38545
- fontRejected = true; failure('font');
38546
- })]);
38686
+ await Promise.race([
38687
+ terminal,
38688
+ Promise.resolve(fontPromise).catch(function () {
38689
+ fontRejected = true;
38690
+ failure("font");
38691
+ }),
38692
+ ]);
38547
38693
  if (stopped) return;
38548
- var selected = options.scheduleWork ? await scheduledImages() : images();
38694
+ var selected = options.scheduleWork
38695
+ ? await scheduledImages()
38696
+ : images();
38549
38697
  if (stopped) return;
38550
38698
  if (options.scheduleWork) {
38551
- var pendingImages = [], pendingLoads = [];
38552
- var imageWaits = await mapWork(selected, function(img) {
38553
- if (img.loading === 'lazy') img.loading = 'eager';
38699
+ var pendingImages = [],
38700
+ pendingLoads = [];
38701
+ var imageWaits = await mapWork(selected, function (img) {
38702
+ if (img.loading === "lazy") img.loading = "eager";
38554
38703
  // Warm images need no load-event continuation. Prepare their
38555
38704
  // decodes in this bounded batch rather than one new task per image.
38556
38705
  if (img.complete) {
@@ -38558,60 +38707,116 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = String.raw`
38558
38707
  return Promise.race([terminal, Promise.resolve(proof.decode)]);
38559
38708
  }
38560
38709
  pendingImages.push(img);
38561
- pendingLoads.push(Promise.race([terminal, waitElement(img, function() {
38562
- return !img.isConnected || !visibleImage(img) || img.complete;
38563
- }, 'image', img.currentSrc || img.src)]));
38710
+ pendingLoads.push(
38711
+ Promise.race([
38712
+ terminal,
38713
+ waitElement(
38714
+ img,
38715
+ function () {
38716
+ return (
38717
+ !img.isConnected || !visibleImage(img) || img.complete
38718
+ );
38719
+ },
38720
+ "image",
38721
+ img.currentSrc || img.src,
38722
+ ),
38723
+ ]),
38724
+ );
38564
38725
  });
38565
38726
  await Promise.race([terminal, Promise.all(pendingLoads)]);
38566
38727
  if (stopped) return;
38567
38728
  // Load events often arrive together from the browser cache. Decode
38568
38729
  // their now-ready images in bounded batches, rather than granting
38569
38730
  // each event its own renderer task. Warm decodes above stay in flight.
38570
- var loadedDecodes = await mapWork(pendingImages, function(img) {
38731
+ var loadedDecodes = await mapWork(pendingImages, function (img) {
38571
38732
  var proof = decodeImage(img);
38572
38733
  return Promise.race([terminal, Promise.resolve(proof.decode)]);
38573
38734
  });
38574
- await Promise.race([terminal, Promise.all(imageWaits.concat(loadedDecodes))]);
38735
+ await Promise.race([
38736
+ terminal,
38737
+ Promise.all(imageWaits.concat(loadedDecodes)),
38738
+ ]);
38575
38739
  } else {
38576
- await Promise.race([terminal, Promise.all(selected.map(async function(img) {
38577
- if (img.loading === 'lazy') img.loading = 'eager';
38578
- await Promise.race([terminal, waitElement(img, function() {
38579
- return !img.isConnected || !visibleImage(img) || img.complete;
38580
- }, 'image', img.currentSrc || img.src)]);
38581
- if (stopped || !img.isConnected || !visibleImage(img)) return;
38582
- if (!img.naturalWidth) { failure('image', img.currentSrc || img.src); return; }
38583
- if (img.decode) await img.decode().catch(function() {
38584
- failure('image', img.currentSrc || img.src);
38585
- });
38586
- }))]);
38740
+ await Promise.race([
38741
+ terminal,
38742
+ Promise.all(
38743
+ selected.map(async function (img) {
38744
+ if (img.loading === "lazy") img.loading = "eager";
38745
+ await Promise.race([
38746
+ terminal,
38747
+ waitElement(
38748
+ img,
38749
+ function () {
38750
+ return (
38751
+ !img.isConnected || !visibleImage(img) || img.complete
38752
+ );
38753
+ },
38754
+ "image",
38755
+ img.currentSrc || img.src,
38756
+ ),
38757
+ ]);
38758
+ if (stopped || !img.isConnected || !visibleImage(img)) return;
38759
+ if (!img.naturalWidth) {
38760
+ failure("image", img.currentSrc || img.src);
38761
+ return;
38762
+ }
38763
+ if (img.decode)
38764
+ await img.decode().catch(function () {
38765
+ failure("image", img.currentSrc || img.src);
38766
+ });
38767
+ }),
38768
+ ),
38769
+ ]);
38587
38770
  }
38588
38771
  if (stopped) return;
38589
- if (doc.fonts) doc.fonts.forEach(function(face) {
38590
- if (face.status === 'error') failure('font', face.family);
38591
- });
38592
- var after = options.scheduleWork ? await scheduledInventory() : inventory();
38772
+ if (doc.fonts)
38773
+ doc.fonts.forEach(function (face) {
38774
+ if (face.status === "error") failure("font", face.family);
38775
+ });
38776
+ var after = options.scheduleWork
38777
+ ? await scheduledInventory()
38778
+ : inventory();
38593
38779
  if (stopped) return;
38594
38780
  // A scheduled inventory can span multiple tasks. A mutation during
38595
38781
  // its geometry reads cannot certify a mixed document observation.
38596
38782
  if (options.scheduleWork && observer.takeRecords().length) revision++;
38597
- if ((!options.scheduleWork || options.requireStableDom === false || (before.revision === after.revision && after.revision === revision)) &&
38598
- same(before, after) && (!doc.fonts || fontRejected ||
38599
- (doc.fonts.status !== 'loading' && doc.fonts.ready === fontPromise))) {
38600
- finish('ready'); return;
38783
+ if (
38784
+ (!options.scheduleWork ||
38785
+ options.requireStableDom === false ||
38786
+ (before.revision === after.revision &&
38787
+ after.revision === revision)) &&
38788
+ same(before, after) &&
38789
+ (!doc.fonts ||
38790
+ fontRejected ||
38791
+ (doc.fonts.status !== "loading" && doc.fonts.ready === fontPromise))
38792
+ ) {
38793
+ finish("ready");
38794
+ return;
38601
38795
  }
38602
38796
  // Let resource events and the deadline run if this document keeps
38603
38797
  // discovering assets; never monopolize the microtask queue.
38604
- await Promise.race([terminal, new Promise(function(done) {
38605
- var retry = setTimeout(function() { cleanups.delete(cleanup); done(); }, 0);
38606
- function cleanup() { clearTimeout(retry); done(); }
38607
- cleanups.add(cleanup);
38608
- })]);
38798
+ await Promise.race([
38799
+ terminal,
38800
+ new Promise(function (done) {
38801
+ var retry = setTimeout(function () {
38802
+ cleanups.delete(cleanup);
38803
+ done();
38804
+ }, 0);
38805
+ function cleanup() {
38806
+ clearTimeout(retry);
38807
+ done();
38808
+ }
38809
+ cleanups.add(cleanup);
38810
+ }),
38811
+ ]);
38609
38812
  }
38610
38813
  }
38611
38814
  // Unexpected browser/document loss is not a successful fallback rendering.
38612
- run().catch(function() { finish('cancelled'); });
38815
+ run().catch(function () {
38816
+ finish("cancelled");
38817
+ });
38613
38818
  });
38614
- `;
38819
+ })(doc, options);`;
38615
38820
 
38616
38821
  // ../../modules/frame-pool/visual-ready-script.ts
38617
38822
  function buildVisualReadyWaitScript(timeoutMs, failedStylesheetUrls = []) {
@@ -40245,7 +40450,7 @@ var MissingRootDepsError = class extends TempoDevServerError {
40245
40450
  // ../tempo-sdk/package.json
40246
40451
  var package_default = {
40247
40452
  name: "tempo-sdk",
40248
- version: "0.0.92",
40453
+ version: "0.0.93",
40249
40454
  publishConfig: {
40250
40455
  tag: "sdk-v2-latest"
40251
40456
  },
@@ -53020,7 +53225,7 @@ var TempoDevServer = class _TempoDevServer {
53020
53225
  sdkUpgradeResult = preparedSdkUpgrade ?? await ensureTempoSdkChannelSpec(this.commandCwd, options?.signal, {
53021
53226
  updateCommand: this.config.scripts.updateSdk,
53022
53227
  runCommand: async (command, cwd, signal) => {
53023
- options?.onInstallStart?.();
53228
+ options?.onInstallStart?.("sdk-update");
53024
53229
  const affectedRoots = this.config.scripts.updateSdk?.trim() || (await resolveTempoSdkUpgradePlan(cwd)).governedByAncestorWorkspace ? installRoots : [this.tempoRoot];
53025
53230
  sdkInstallReceipts = /* @__PURE__ */ new Map();
53026
53231
  this.state.dependenciesInstalled = false;
@@ -53377,14 +53582,17 @@ var TempoDevServer = class _TempoDevServer {
53377
53582
  options.signal,
53378
53583
  {
53379
53584
  updateCommand: this.config.scripts.updateSdk,
53380
- runCommand: async (command, cwd, signal) => runShellCommand(
53381
- command,
53382
- cwd,
53383
- signal,
53384
- options.onOutput,
53385
- this.projectRoot,
53386
- await this.nuxtSidecarNodePathEnv()
53387
- )
53585
+ runCommand: async (command, cwd, signal) => {
53586
+ options.onInstallStart?.("sdk-update");
53587
+ return runShellCommand(
53588
+ command,
53589
+ cwd,
53590
+ signal,
53591
+ options.onOutput,
53592
+ this.projectRoot,
53593
+ await this.nuxtSidecarNodePathEnv()
53594
+ );
53595
+ }
53388
53596
  }
53389
53597
  );
53390
53598
  if (result.error)
@@ -53394,6 +53602,7 @@ var TempoDevServer = class _TempoDevServer {
53394
53602
  result.error
53395
53603
  );
53396
53604
  if (!result.attempted) {
53605
+ options.onInstallStart?.();
53397
53606
  await runShellCommand(
53398
53607
  this.config.scripts.updateSdk,
53399
53608
  this.commandCwd,
@@ -64014,4 +64223,4 @@ export {
64014
64223
  buildBaselineCaptureArgs,
64015
64224
  main
64016
64225
  };
64017
- //# sourceMappingURL=chunk-VZDQYZCX.js.map
64226
+ //# sourceMappingURL=chunk-GH43HSTJ.js.map