@tempo-ai/visual-review 0.0.113-staging.1 → 0.0.113-staging.3
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 +1 -1
- package/dist/{chunk-AX52T3IT.js → chunk-MENKBHDB.js} +51 -7
- package/dist/chunk-MENKBHDB.js.map +1 -0
- package/dist/{cli-32JWCJ2S.js → cli-AVHP73RY.js} +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AX52T3IT.js.map +0 -1
- /package/dist/{cli-32JWCJ2S.js.map → cli-AVHP73RY.js.map} +0 -0
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-
|
|
9
|
+
return await (await import("./cli-AVHP73RY.js")).main(commandArgs);
|
|
10
10
|
case "claim":
|
|
11
11
|
return await (await import("./claim-J654JAS6.js")).main(commandArgs);
|
|
12
12
|
case "report":
|
|
@@ -134,6 +134,7 @@ var SETTLE_STEPS = [
|
|
|
134
134
|
"content-quiet",
|
|
135
135
|
"paint"
|
|
136
136
|
];
|
|
137
|
+
var VIDEO_FRAME_WAIT_CAP_MS = 2e3;
|
|
137
138
|
var DEFAULT_SETTLE_QUIET_MS = 300;
|
|
138
139
|
var DEFAULT_SETTLE_STEP_TIMEOUT_MS = 15e3;
|
|
139
140
|
var DEFAULT_SETTLE_POLL_MS = 50;
|
|
@@ -209,22 +210,48 @@ function buildSettleWaitScript(options) {
|
|
|
209
210
|
|
|
210
211
|
var quietKey = null;
|
|
211
212
|
var quietSince = 0;
|
|
213
|
+
// When a rendered video was first seen without a decoded frame, and how
|
|
214
|
+
// long that may hold the quiet window before we give up on it.
|
|
215
|
+
var videoWaitStartedAt = null;
|
|
216
|
+
var videoWaitCapMs = ${VIDEO_FRAME_WAIT_CAP_MS};
|
|
212
217
|
// Images that take part in the capture: laid out and not hidden. A
|
|
213
218
|
// hidden responsive variant never starts native lazy loading and must
|
|
214
219
|
// not hold the window; a rendered lazy image never starts either,
|
|
215
220
|
// because a capture does not scroll, so it is asked for eagerly.
|
|
216
|
-
function
|
|
217
|
-
var all = Array.prototype.slice.call(target.querySelectorAll(
|
|
221
|
+
function renderedMatches(target, tag) {
|
|
222
|
+
var all = Array.prototype.slice.call(target.querySelectorAll(tag));
|
|
218
223
|
var rendered = [];
|
|
219
224
|
for (var i = 0; i < all.length; i++) {
|
|
220
|
-
var
|
|
221
|
-
if (
|
|
222
|
-
var visibility = getComputedStyle(
|
|
225
|
+
var el = all[i];
|
|
226
|
+
if (el.getClientRects().length === 0) continue;
|
|
227
|
+
var visibility = getComputedStyle(el).visibility;
|
|
223
228
|
if (visibility === 'hidden' || visibility === 'collapse') continue;
|
|
224
|
-
rendered.push(
|
|
229
|
+
rendered.push(el);
|
|
225
230
|
}
|
|
226
231
|
return rendered;
|
|
227
232
|
}
|
|
233
|
+
function renderedImages(target) {
|
|
234
|
+
return renderedMatches(target, 'img');
|
|
235
|
+
}
|
|
236
|
+
// A video paints its current frame only once that frame is DECODED.
|
|
237
|
+
// HAVE_CURRENT_DATA (2) is exactly that bar.
|
|
238
|
+
//
|
|
239
|
+
// Everything else here is about FAILING OPEN. The baseline lane runs
|
|
240
|
+
// this step strict, so a video that can never reach that bar would turn
|
|
241
|
+
// a capture that used to succeed into a settle.content-quiet timeout \u2014
|
|
242
|
+
// for every storyboard in the repo, not just ones we had in mind. So a
|
|
243
|
+
// video only holds the window while it is plausibly ON ITS WAY to a
|
|
244
|
+
// frame: an errored element, one with no source at all, and one the page
|
|
245
|
+
// explicitly opted out of loading (preload="none", whose poster-or-
|
|
246
|
+
// nothing paint is already deterministic) are all treated as finished.
|
|
247
|
+
function videoFrameReady(video) {
|
|
248
|
+
if (video.error) return true;
|
|
249
|
+
if (video.preload === 'none') return true;
|
|
250
|
+
var networkState = video.networkState;
|
|
251
|
+
if (networkState === 0 /* NETWORK_EMPTY */) return true;
|
|
252
|
+
if (networkState === 3 /* NETWORK_NO_SOURCE */) return true;
|
|
253
|
+
return video.readyState >= 2 /* HAVE_CURRENT_DATA */;
|
|
254
|
+
}
|
|
228
255
|
function contentQuiet() {
|
|
229
256
|
var target = document.querySelector(selector);
|
|
230
257
|
if (!target) return false;
|
|
@@ -240,6 +267,23 @@ function buildSettleWaitScript(options) {
|
|
|
240
267
|
return false;
|
|
241
268
|
}
|
|
242
269
|
}
|
|
270
|
+
// Second line of defence behind videoFrameReady's fail-open rules: a
|
|
271
|
+
// video that is legitimately loading can still stall forever (a dev
|
|
272
|
+
// server that never answers, a huge asset). Waiting is an OPTIMISATION
|
|
273
|
+
// for baseline stability, never a reason to fail a capture, so the
|
|
274
|
+
// whole video wait is bounded \u2014 past the cap we capture whatever is
|
|
275
|
+
// on screen, exactly as we did before videos were considered at all.
|
|
276
|
+
var videos = renderedMatches(target, 'video');
|
|
277
|
+
for (var w = 0; w < videos.length; w++) {
|
|
278
|
+
if (!videoFrameReady(videos[w])) {
|
|
279
|
+
if (videoWaitStartedAt === null) videoWaitStartedAt = now();
|
|
280
|
+
if (now() - videoWaitStartedAt < videoWaitCapMs) {
|
|
281
|
+
quietKey = null;
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
243
287
|
var rect = target.getBoundingClientRect();
|
|
244
288
|
var text = target.innerText || '';
|
|
245
289
|
var key = [
|
|
@@ -13974,4 +14018,4 @@ export {
|
|
|
13974
14018
|
buildBaselineCaptureArgs,
|
|
13975
14019
|
main
|
|
13976
14020
|
};
|
|
13977
|
-
//# sourceMappingURL=chunk-
|
|
14021
|
+
//# sourceMappingURL=chunk-MENKBHDB.js.map
|