@tempo-ai/visual-review 0.0.140 → 0.0.141-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 +2 -2
- package/dist/{chunk-GH43HSTJ.js → chunk-3IKPKXZZ.js} +222 -39
- package/dist/chunk-3IKPKXZZ.js.map +1 -0
- package/dist/{chunk-TEVWNWZ6.js → chunk-Q6FW7NII.js} +1 -1
- package/dist/chunk-Q6FW7NII.js.map +1 -0
- package/dist/{chunk-PI6TS733.js → chunk-WQOUTFK5.js} +2 -2
- package/dist/{cli-VA6YGDST.js → cli-AGRYO7E7.js} +3 -3
- package/dist/index.js +3 -3
- package/dist/{report-XRYE2D5O.js → report-5LJCK3JT.js} +3 -3
- package/package.json +3 -2
- package/dist/chunk-GH43HSTJ.js.map +0 -1
- package/dist/chunk-TEVWNWZ6.js.map +0 -1
- /package/dist/{chunk-PI6TS733.js.map → chunk-WQOUTFK5.js.map} +0 -0
- /package/dist/{cli-VA6YGDST.js.map → cli-AGRYO7E7.js.map} +0 -0
- /package/dist/{report-XRYE2D5O.js.map → report-5LJCK3JT.js.map} +0 -0
package/dist/bin.js
CHANGED
|
@@ -7,11 +7,11 @@ 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-
|
|
10
|
+
return await (await import("./cli-AGRYO7E7.js")).main(commandArgs);
|
|
11
11
|
case "claim":
|
|
12
12
|
return await (await import("./claim-TARSUW6K.js")).main(commandArgs);
|
|
13
13
|
case "report":
|
|
14
|
-
return await (await import("./report-
|
|
14
|
+
return await (await import("./report-5LJCK3JT.js")).main(commandArgs);
|
|
15
15
|
case "install-browsers":
|
|
16
16
|
return await (await import("./install-browsers-VPIMDVB6.js")).main(commandArgs);
|
|
17
17
|
default:
|
|
@@ -2,7 +2,7 @@ import { createRequire as __tempoCreateRequire } from 'node:module'; const requi
|
|
|
2
2
|
import {
|
|
3
3
|
buildBitbucketNoVisualChangeComment,
|
|
4
4
|
upsertBitbucketStickyComment
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Q6FW7NII.js";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_VISUAL_REVIEW_INGEST_URL,
|
|
8
8
|
declareNoVisualChangeIfPresent,
|
|
@@ -29419,7 +29419,7 @@ function buildDirectRenderIdleUrl(hostUrl) {
|
|
|
29419
29419
|
}
|
|
29420
29420
|
|
|
29421
29421
|
// ../canvas-capture-headless/src/capture.ts
|
|
29422
|
-
import { createHash } from "crypto";
|
|
29422
|
+
import { createHash as createHash2 } from "crypto";
|
|
29423
29423
|
import { PNG } from "pngjs";
|
|
29424
29424
|
|
|
29425
29425
|
// ../../modules/frame-pool/capture-determinism.ts
|
|
@@ -29895,7 +29895,7 @@ function buildSettleWaitScript(options) {
|
|
|
29895
29895
|
}
|
|
29896
29896
|
|
|
29897
29897
|
// ../canvas-capture-headless/src/fingerprint.ts
|
|
29898
|
-
var KIT_VERSION = "
|
|
29898
|
+
var KIT_VERSION = "9";
|
|
29899
29899
|
var FONTS_BUNDLE_VERSION = "system-1";
|
|
29900
29900
|
var DEVICE_SCALE_FACTOR = 1;
|
|
29901
29901
|
function buildEnvFingerprint(input) {
|
|
@@ -30119,6 +30119,162 @@ import { randomBytes } from "crypto";
|
|
|
30119
30119
|
import { readFile, stat as stat2 } from "fs/promises";
|
|
30120
30120
|
import path3 from "path";
|
|
30121
30121
|
|
|
30122
|
+
// ../canvas-capture-headless/src/capture-images.ts
|
|
30123
|
+
import { createHash } from "crypto";
|
|
30124
|
+
import sharp from "sharp";
|
|
30125
|
+
var MAX_IMAGE_BYTES = 24 * 1024 * 1024;
|
|
30126
|
+
var MAX_IMAGE_PIXELS = 64 * 1024 * 1024;
|
|
30127
|
+
var CACHE_BYTES = 32 * 1024 * 1024;
|
|
30128
|
+
function createCaptureImageNormalizer() {
|
|
30129
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
30130
|
+
let retainedBytes = 0;
|
|
30131
|
+
return async (bytes) => {
|
|
30132
|
+
if (bytes[0] !== 255 || bytes[1] !== 216 || bytes[2] !== 255)
|
|
30133
|
+
return bytes;
|
|
30134
|
+
if (bytes.length > MAX_IMAGE_BYTES)
|
|
30135
|
+
throw new Error("capture JPEG exceeds the 24 MiB input limit");
|
|
30136
|
+
const key2 = createHash("sha256").update(bytes).digest("hex");
|
|
30137
|
+
const cached = cache2.get(key2);
|
|
30138
|
+
if (cached) {
|
|
30139
|
+
cache2.delete(key2);
|
|
30140
|
+
cache2.set(key2, cached);
|
|
30141
|
+
return cached;
|
|
30142
|
+
}
|
|
30143
|
+
const png = await sharp(bytes, { limitInputPixels: MAX_IMAGE_PIXELS }).keepExif().png().toBuffer();
|
|
30144
|
+
if (cache2.has(key2)) return cache2.get(key2);
|
|
30145
|
+
if (png.length <= CACHE_BYTES) {
|
|
30146
|
+
while (retainedBytes + png.length > CACHE_BYTES) {
|
|
30147
|
+
const oldest = cache2.keys().next().value;
|
|
30148
|
+
retainedBytes -= cache2.get(oldest).length;
|
|
30149
|
+
cache2.delete(oldest);
|
|
30150
|
+
}
|
|
30151
|
+
cache2.set(key2, png);
|
|
30152
|
+
retainedBytes += png.length;
|
|
30153
|
+
}
|
|
30154
|
+
return png;
|
|
30155
|
+
};
|
|
30156
|
+
}
|
|
30157
|
+
async function installCaptureImages(page, normalize3) {
|
|
30158
|
+
const session = await page.context().newCDPSession(page);
|
|
30159
|
+
const failures = /* @__PURE__ */ new Map();
|
|
30160
|
+
const pending = /* @__PURE__ */ new Set();
|
|
30161
|
+
const requests = /* @__PURE__ */ new Map();
|
|
30162
|
+
let disposing = false;
|
|
30163
|
+
const handle = async (event) => {
|
|
30164
|
+
const {
|
|
30165
|
+
requestId,
|
|
30166
|
+
networkId,
|
|
30167
|
+
request,
|
|
30168
|
+
responseStatusCode,
|
|
30169
|
+
responseHeaders = []
|
|
30170
|
+
} = event;
|
|
30171
|
+
const requestState = {
|
|
30172
|
+
canceled: false
|
|
30173
|
+
};
|
|
30174
|
+
if (networkId) requests.set(networkId, requestState);
|
|
30175
|
+
try {
|
|
30176
|
+
const mime = responseHeaders.find((h) => h.name.toLowerCase() === "content-type")?.value.split(";", 1)[0].trim().toLowerCase();
|
|
30177
|
+
const mayBeJpeg = mime === "image/jpeg" || mime === "image/jpg" || mime === "application/octet-stream" || !mime;
|
|
30178
|
+
if (responseStatusCode !== 200 || !mayBeJpeg) {
|
|
30179
|
+
await session.send("Fetch.continueRequest", { requestId });
|
|
30180
|
+
return;
|
|
30181
|
+
}
|
|
30182
|
+
const declaredLength = Number(
|
|
30183
|
+
responseHeaders.find((h) => h.name.toLowerCase() === "content-length")?.value
|
|
30184
|
+
);
|
|
30185
|
+
if (declaredLength > MAX_IMAGE_BYTES)
|
|
30186
|
+
throw new Error("capture image exceeds the 24 MiB input limit");
|
|
30187
|
+
let timer;
|
|
30188
|
+
const response = await Promise.race([
|
|
30189
|
+
session.send("Fetch.getResponseBody", { requestId }),
|
|
30190
|
+
new Promise((_, reject) => {
|
|
30191
|
+
timer = setTimeout(
|
|
30192
|
+
() => reject(new Error("capture image download exceeded 30 seconds")),
|
|
30193
|
+
3e4
|
|
30194
|
+
);
|
|
30195
|
+
}),
|
|
30196
|
+
new Promise((_, reject) => {
|
|
30197
|
+
requestState.cancelBody = () => reject(new Error("capture image request was canceled"));
|
|
30198
|
+
if (requestState.canceled) requestState.cancelBody();
|
|
30199
|
+
})
|
|
30200
|
+
]).finally(() => {
|
|
30201
|
+
clearTimeout(timer);
|
|
30202
|
+
requestState.cancelBody = void 0;
|
|
30203
|
+
});
|
|
30204
|
+
const body = Buffer.from(
|
|
30205
|
+
response.body,
|
|
30206
|
+
response.base64Encoded ? "base64" : "utf8"
|
|
30207
|
+
);
|
|
30208
|
+
const normalized = await normalize3(body);
|
|
30209
|
+
if (normalized === body) {
|
|
30210
|
+
await session.send("Fetch.continueRequest", { requestId });
|
|
30211
|
+
return;
|
|
30212
|
+
}
|
|
30213
|
+
const replaced = /* @__PURE__ */ new Set([
|
|
30214
|
+
"content-type",
|
|
30215
|
+
"content-encoding",
|
|
30216
|
+
"content-length",
|
|
30217
|
+
"etag",
|
|
30218
|
+
"content-md5",
|
|
30219
|
+
"digest",
|
|
30220
|
+
"content-digest",
|
|
30221
|
+
"repr-digest"
|
|
30222
|
+
]);
|
|
30223
|
+
const headers = responseHeaders.filter(
|
|
30224
|
+
(h) => !replaced.has(h.name.toLowerCase())
|
|
30225
|
+
);
|
|
30226
|
+
headers.push({ name: "Content-Type", value: "image/png" });
|
|
30227
|
+
await session.send("Fetch.fulfillRequest", {
|
|
30228
|
+
requestId,
|
|
30229
|
+
responseCode: responseStatusCode,
|
|
30230
|
+
responseHeaders: headers,
|
|
30231
|
+
body: normalized.toString("base64")
|
|
30232
|
+
});
|
|
30233
|
+
} catch (error) {
|
|
30234
|
+
if (!disposing && !requestState.canceled)
|
|
30235
|
+
failures.set(request.url, String(error));
|
|
30236
|
+
await session.send("Fetch.failRequest", { requestId, errorReason: "Failed" }).catch(() => {
|
|
30237
|
+
});
|
|
30238
|
+
} finally {
|
|
30239
|
+
if (networkId && requests.get(networkId) === requestState)
|
|
30240
|
+
requests.delete(networkId);
|
|
30241
|
+
}
|
|
30242
|
+
};
|
|
30243
|
+
session.on("Network.loadingFailed", (event) => {
|
|
30244
|
+
if (!event.canceled) return;
|
|
30245
|
+
const request = requests.get(event.requestId);
|
|
30246
|
+
if (!request) return;
|
|
30247
|
+
request.canceled = true;
|
|
30248
|
+
request.cancelBody?.();
|
|
30249
|
+
});
|
|
30250
|
+
session.on("Fetch.requestPaused", (event) => {
|
|
30251
|
+
const task = handle(event);
|
|
30252
|
+
pending.add(task);
|
|
30253
|
+
void task.finally(() => pending.delete(task)).catch(() => {
|
|
30254
|
+
});
|
|
30255
|
+
});
|
|
30256
|
+
await session.send("Network.enable");
|
|
30257
|
+
await session.send("Fetch.enable", {
|
|
30258
|
+
patterns: [{ resourceType: "Image", requestStage: "Response" }]
|
|
30259
|
+
});
|
|
30260
|
+
return {
|
|
30261
|
+
assertHealthy() {
|
|
30262
|
+
if (failures.size)
|
|
30263
|
+
throw new Error(
|
|
30264
|
+
`capture image normalization failed: ${[...failures].map(([url, error]) => `${url}: ${error}`).join("; ")}`
|
|
30265
|
+
);
|
|
30266
|
+
},
|
|
30267
|
+
async dispose() {
|
|
30268
|
+
disposing = true;
|
|
30269
|
+
await session.send("Fetch.disable").catch(() => {
|
|
30270
|
+
});
|
|
30271
|
+
await session.detach().catch(() => {
|
|
30272
|
+
});
|
|
30273
|
+
await Promise.allSettled([...pending]);
|
|
30274
|
+
}
|
|
30275
|
+
};
|
|
30276
|
+
}
|
|
30277
|
+
|
|
30122
30278
|
// ../canvas/html-storyboard-resources.ts
|
|
30123
30279
|
import path2 from "path";
|
|
30124
30280
|
import { realpath, stat } from "fs/promises";
|
|
@@ -38206,7 +38362,7 @@ var contentTypes = {
|
|
|
38206
38362
|
".wav": "audio/wav",
|
|
38207
38363
|
".webm": "video/webm"
|
|
38208
38364
|
};
|
|
38209
|
-
async function openHeadlessHtmlSource(context, filepath) {
|
|
38365
|
+
async function openHeadlessHtmlSource(context, filepath, normalizeImage = createCaptureImageNormalizer()) {
|
|
38210
38366
|
const accepted = await authorizeHtmlStoryboardResource(filepath);
|
|
38211
38367
|
const content = await readFile(accepted.filepath, "utf8");
|
|
38212
38368
|
const annotated = annotateHtmlStoryboardRevision(content, {
|
|
@@ -38222,7 +38378,7 @@ async function openHeadlessHtmlSource(context, filepath) {
|
|
|
38222
38378
|
if (requested.origin !== origin) {
|
|
38223
38379
|
if (requested.protocol === "file:" || request.isNavigationRequest())
|
|
38224
38380
|
return route.abort("blockedbyclient");
|
|
38225
|
-
return route.
|
|
38381
|
+
return route.fallback();
|
|
38226
38382
|
}
|
|
38227
38383
|
const resource = await resolveHtmlStoryboardResource(
|
|
38228
38384
|
accepted.authorization,
|
|
@@ -38233,14 +38389,16 @@ async function openHeadlessHtmlSource(context, filepath) {
|
|
|
38233
38389
|
return route.fulfill({ status: resource.status, body: "" });
|
|
38234
38390
|
}
|
|
38235
38391
|
try {
|
|
38392
|
+
const body = resource.filepath === accepted.filepath ? annotated : await readFile(resource.filepath);
|
|
38393
|
+
const normalized = request.resourceType() === "image" && Buffer.isBuffer(body) ? await normalizeImage(body) : body;
|
|
38236
38394
|
await route.fulfill({
|
|
38237
38395
|
status: 200,
|
|
38238
|
-
contentType: contentTypes[path3.extname(resource.filepath).toLowerCase()],
|
|
38396
|
+
contentType: normalized !== body ? "image/png" : contentTypes[path3.extname(resource.filepath).toLowerCase()],
|
|
38239
38397
|
headers: {
|
|
38240
38398
|
"cache-control": "no-store",
|
|
38241
38399
|
"content-security-policy": "sandbox allow-scripts allow-same-origin"
|
|
38242
38400
|
},
|
|
38243
|
-
body:
|
|
38401
|
+
body: normalized
|
|
38244
38402
|
});
|
|
38245
38403
|
} catch (error) {
|
|
38246
38404
|
failures.add(`${requested.pathname}: ${String(error)}`);
|
|
@@ -38489,7 +38647,11 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38489
38647
|
);
|
|
38490
38648
|
}
|
|
38491
38649
|
function images() {
|
|
38492
|
-
return Array.from(doc.querySelectorAll("img"))
|
|
38650
|
+
return Array.from(doc.querySelectorAll("img"))
|
|
38651
|
+
.filter(visibleImage)
|
|
38652
|
+
.map(function (img) {
|
|
38653
|
+
return [img, img.currentSrc, img.src, img.srcset];
|
|
38654
|
+
});
|
|
38493
38655
|
}
|
|
38494
38656
|
async function scheduledImages() {
|
|
38495
38657
|
var candidates,
|
|
@@ -38501,7 +38663,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38501
38663
|
var limit = Math.min(offset + 32, candidates.length);
|
|
38502
38664
|
while (offset < limit) {
|
|
38503
38665
|
var img = candidates[offset++];
|
|
38504
|
-
if (visibleImage(img))
|
|
38666
|
+
if (visibleImage(img))
|
|
38667
|
+
selected.push([img, img.currentSrc, img.src, img.srcset]);
|
|
38505
38668
|
if (slice && !slice.hasTime()) break;
|
|
38506
38669
|
}
|
|
38507
38670
|
});
|
|
@@ -38555,7 +38718,7 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38555
38718
|
check();
|
|
38556
38719
|
});
|
|
38557
38720
|
}
|
|
38558
|
-
function inventory() {
|
|
38721
|
+
function inventory(includeImages) {
|
|
38559
38722
|
return {
|
|
38560
38723
|
links: links().map(function (link) {
|
|
38561
38724
|
// Resource evidence can change during a font/image await without
|
|
@@ -38570,15 +38733,13 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38570
38733
|
link.getAttribute("data-tempo-stylesheet-error") === link.href,
|
|
38571
38734
|
];
|
|
38572
38735
|
}),
|
|
38573
|
-
images: images()
|
|
38574
|
-
return [img, img.currentSrc, img.src, img.srcset];
|
|
38575
|
-
}),
|
|
38736
|
+
images: includeImages ? images() : [],
|
|
38576
38737
|
styles: Array.from(doc.querySelectorAll("style")).map(function (style) {
|
|
38577
38738
|
return [style, style.textContent];
|
|
38578
38739
|
}),
|
|
38579
38740
|
};
|
|
38580
38741
|
}
|
|
38581
|
-
async function scheduledInventory() {
|
|
38742
|
+
async function scheduledInventory(includeImages) {
|
|
38582
38743
|
var candidates,
|
|
38583
38744
|
offset = 0;
|
|
38584
38745
|
var result = { revision: revision, links: [], images: [], styles: [] };
|
|
@@ -38588,7 +38749,11 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38588
38749
|
await work(function (slice) {
|
|
38589
38750
|
if (!candidates)
|
|
38590
38751
|
candidates = Array.from(
|
|
38591
|
-
doc.querySelectorAll(
|
|
38752
|
+
doc.querySelectorAll(
|
|
38753
|
+
includeImages
|
|
38754
|
+
? 'link[rel~="stylesheet"],img,style'
|
|
38755
|
+
: 'link[rel~="stylesheet"],style',
|
|
38756
|
+
),
|
|
38592
38757
|
);
|
|
38593
38758
|
var limit = Math.min(offset + 32, candidates.length);
|
|
38594
38759
|
while (offset < limit) {
|
|
@@ -38634,8 +38799,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38634
38799
|
async function run() {
|
|
38635
38800
|
while (!stopped) {
|
|
38636
38801
|
var before = options.scheduleWork
|
|
38637
|
-
? await scheduledInventory()
|
|
38638
|
-
: inventory();
|
|
38802
|
+
? await scheduledInventory(false)
|
|
38803
|
+
: inventory(false);
|
|
38639
38804
|
if (stopped) return;
|
|
38640
38805
|
await Promise.race([
|
|
38641
38806
|
terminal,
|
|
@@ -38691,14 +38856,18 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38691
38856
|
}),
|
|
38692
38857
|
]);
|
|
38693
38858
|
if (stopped) return;
|
|
38859
|
+
// Fonts can change which images are visible. Capture the image evidence
|
|
38860
|
+
// only after their layout settles, before awaiting any selected decode.
|
|
38694
38861
|
var selected = options.scheduleWork
|
|
38695
38862
|
? await scheduledImages()
|
|
38696
38863
|
: images();
|
|
38697
38864
|
if (stopped) return;
|
|
38865
|
+
before.images = selected;
|
|
38698
38866
|
if (options.scheduleWork) {
|
|
38699
38867
|
var pendingImages = [],
|
|
38700
38868
|
pendingLoads = [];
|
|
38701
|
-
var imageWaits = await mapWork(selected, function (
|
|
38869
|
+
var imageWaits = await mapWork(selected, function (row) {
|
|
38870
|
+
var img = row[0];
|
|
38702
38871
|
if (img.loading === "lazy") img.loading = "eager";
|
|
38703
38872
|
// Warm images need no load-event continuation. Prepare their
|
|
38704
38873
|
// decodes in this bounded batch rather than one new task per image.
|
|
@@ -38740,7 +38909,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38740
38909
|
await Promise.race([
|
|
38741
38910
|
terminal,
|
|
38742
38911
|
Promise.all(
|
|
38743
|
-
selected.map(async function (
|
|
38912
|
+
selected.map(async function (row) {
|
|
38913
|
+
var img = row[0];
|
|
38744
38914
|
if (img.loading === "lazy") img.loading = "eager";
|
|
38745
38915
|
await Promise.race([
|
|
38746
38916
|
terminal,
|
|
@@ -38774,8 +38944,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
|
|
|
38774
38944
|
if (face.status === "error") failure("font", face.family);
|
|
38775
38945
|
});
|
|
38776
38946
|
var after = options.scheduleWork
|
|
38777
|
-
? await scheduledInventory()
|
|
38778
|
-
: inventory();
|
|
38947
|
+
? await scheduledInventory(true)
|
|
38948
|
+
: inventory(true);
|
|
38779
38949
|
if (stopped) return;
|
|
38780
38950
|
// A scheduled inventory can span multiple tasks. A mutation during
|
|
38781
38951
|
// its geometry reads cannot certify a mixed document observation.
|
|
@@ -39272,7 +39442,7 @@ function buildDirectRenderUrl2(hostUrl, target) {
|
|
|
39272
39442
|
});
|
|
39273
39443
|
}
|
|
39274
39444
|
function sha256Hex(bytes) {
|
|
39275
|
-
return
|
|
39445
|
+
return createHash2("sha256").update(bytes).digest("hex");
|
|
39276
39446
|
}
|
|
39277
39447
|
function looksBlank(pngBytes) {
|
|
39278
39448
|
let png;
|
|
@@ -39375,6 +39545,7 @@ async function startCaptureSession(options) {
|
|
|
39375
39545
|
const log = options.log ?? (() => {
|
|
39376
39546
|
});
|
|
39377
39547
|
const parallelPages = options.parallelPages ?? 1;
|
|
39548
|
+
const normalizeImage = createCaptureImageNormalizer();
|
|
39378
39549
|
const { chromium } = await import("playwright");
|
|
39379
39550
|
let browser;
|
|
39380
39551
|
try {
|
|
@@ -39406,10 +39577,12 @@ async function startCaptureSession(options) {
|
|
|
39406
39577
|
await context.addInitScript(buildFreezeInitScript());
|
|
39407
39578
|
await context.addInitScript(installRenderProfileInPage);
|
|
39408
39579
|
const page = await context.newPage();
|
|
39580
|
+
const images = await installCaptureImages(page, normalizeImage);
|
|
39409
39581
|
const documentEvents = await context.newCDPSession(page);
|
|
39410
39582
|
const worker = {
|
|
39411
39583
|
context,
|
|
39412
39584
|
page,
|
|
39585
|
+
images,
|
|
39413
39586
|
contextMs: Date.now() - contextStart,
|
|
39414
39587
|
contextClaimed: false,
|
|
39415
39588
|
hasNavigated: false,
|
|
@@ -39420,6 +39593,7 @@ async function startCaptureSession(options) {
|
|
|
39420
39593
|
documentsLoaded: 0,
|
|
39421
39594
|
navigationsInFlight: 0,
|
|
39422
39595
|
async dispose() {
|
|
39596
|
+
await images.dispose();
|
|
39423
39597
|
await documentEvents.detach().catch(() => {
|
|
39424
39598
|
});
|
|
39425
39599
|
await page.close().catch(() => {
|
|
@@ -39496,7 +39670,8 @@ async function startCaptureSession(options) {
|
|
|
39496
39670
|
try {
|
|
39497
39671
|
const source = target.source.kind === "html" ? await openHeadlessHtmlSource(
|
|
39498
39672
|
worker2.context,
|
|
39499
|
-
target.source.filepath
|
|
39673
|
+
target.source.filepath,
|
|
39674
|
+
normalizeImage
|
|
39500
39675
|
) : {
|
|
39501
39676
|
url: astroCaptureUrl(
|
|
39502
39677
|
await (options.getAppUrl?.() ?? Promise.reject(
|
|
@@ -39558,7 +39733,9 @@ async function startCaptureSession(options) {
|
|
|
39558
39733
|
`Astro storyboard failed: ${[...failures].join("; ")}`
|
|
39559
39734
|
);
|
|
39560
39735
|
timings.settleMs = Date.now() - settling;
|
|
39736
|
+
worker2.images.assertHealthy();
|
|
39561
39737
|
const value = await work(worker2.page, "body");
|
|
39738
|
+
worker2.images.assertHealthy();
|
|
39562
39739
|
source.assertResources();
|
|
39563
39740
|
if (target.source.kind === "astro" && failures.size)
|
|
39564
39741
|
throw new Error(
|
|
@@ -39723,7 +39900,9 @@ async function startCaptureSession(options) {
|
|
|
39723
39900
|
errorSelector: STORYBOARD_RENDER_ERROR_SELECTOR,
|
|
39724
39901
|
messageAttribute: STORYBOARD_RENDER_ERROR_MESSAGE_ATTRIBUTE
|
|
39725
39902
|
});
|
|
39903
|
+
worker.images.assertHealthy();
|
|
39726
39904
|
const value = await work(page, selector);
|
|
39905
|
+
worker.images.assertHealthy();
|
|
39727
39906
|
const renderErrors = await page.evaluate(readRenderErrorsInPage);
|
|
39728
39907
|
if (renderErrors.length > 0) {
|
|
39729
39908
|
throw new Error(
|
|
@@ -42492,7 +42671,7 @@ import {
|
|
|
42492
42671
|
writeFile as writeFile3
|
|
42493
42672
|
} from "fs/promises";
|
|
42494
42673
|
import path10 from "path";
|
|
42495
|
-
import { createHash as
|
|
42674
|
+
import { createHash as createHash3 } from "crypto";
|
|
42496
42675
|
var TEMPO_SDK_SOURCE_ENV = "TEMPO_MONOREPO_SDK_SOURCE";
|
|
42497
42676
|
var LOCAL_SDK_MARKER_FILE = "local-tempo-sdk.json";
|
|
42498
42677
|
var preparations2 = /* @__PURE__ */ new Map();
|
|
@@ -42546,7 +42725,7 @@ async function assertLocalSdkPrebuilt(localSdkRoot) {
|
|
|
42546
42725
|
}
|
|
42547
42726
|
var SNAPSHOT_MARKER = ".tempo-prebuilt-source.json";
|
|
42548
42727
|
async function snapshotRevision(root2, manifest, files) {
|
|
42549
|
-
const hash =
|
|
42728
|
+
const hash = createHash3("sha256").update(manifest);
|
|
42550
42729
|
async function visit(directory) {
|
|
42551
42730
|
for (const entry of (await readdir2(directory, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
42552
42731
|
const file = path10.join(directory, entry.name);
|
|
@@ -42640,7 +42819,7 @@ async function materializeSdk(localSdkRoot, installedSdkRoot) {
|
|
|
42640
42819
|
}
|
|
42641
42820
|
}
|
|
42642
42821
|
async function sdkBuildFingerprint(root2) {
|
|
42643
|
-
const hash =
|
|
42822
|
+
const hash = createHash3("sha256").update("snapshot-format-2");
|
|
42644
42823
|
const manifest = await readFile5(path10.join(root2, "package.json"), "utf8");
|
|
42645
42824
|
hash.update(manifest);
|
|
42646
42825
|
const pkg = JSON.parse(manifest);
|
|
@@ -44302,7 +44481,7 @@ import path12 from "path";
|
|
|
44302
44481
|
var DEFAULT_IDLE_TTL_MS = 60 * 60 * 1e3;
|
|
44303
44482
|
|
|
44304
44483
|
// ../tempo-devserver/dev-server-ownership-registry.ts
|
|
44305
|
-
import { createHash as
|
|
44484
|
+
import { createHash as createHash4 } from "crypto";
|
|
44306
44485
|
import { readFile as readFile7 } from "fs/promises";
|
|
44307
44486
|
import os from "os";
|
|
44308
44487
|
import path13 from "path";
|
|
@@ -45702,8 +45881,12 @@ var CanvasRegistry = class {
|
|
|
45702
45881
|
);
|
|
45703
45882
|
}
|
|
45704
45883
|
async pruneDeletedRequestedPaths(requestedPaths) {
|
|
45884
|
+
const candidates = /* @__PURE__ */ new Set([
|
|
45885
|
+
...requestedPaths,
|
|
45886
|
+
...this.requestedThisSession
|
|
45887
|
+
]);
|
|
45705
45888
|
const existingPaths = [];
|
|
45706
|
-
for (const requestedPath of
|
|
45889
|
+
for (const requestedPath of candidates) {
|
|
45707
45890
|
const absolutePath = this.requestedPathToAbsolutePath(requestedPath);
|
|
45708
45891
|
if (!absolutePath) continue;
|
|
45709
45892
|
if (await this.canvasFileExistsWithRecheck(absolutePath)) {
|
|
@@ -45712,17 +45895,17 @@ var CanvasRegistry = class {
|
|
|
45712
45895
|
}
|
|
45713
45896
|
return {
|
|
45714
45897
|
requestedPaths: existingPaths,
|
|
45715
|
-
changed: existingPaths.length !== requestedPaths.length
|
|
45898
|
+
changed: existingPaths.length !== requestedPaths.length || existingPaths.some((value, index) => value !== requestedPaths[index])
|
|
45716
45899
|
};
|
|
45717
45900
|
}
|
|
45718
|
-
//
|
|
45719
|
-
// explicit canvas open — so a single ENOENT must not be trusted. Editors and
|
|
45901
|
+
// Avoid dropping an import for a brief ENOENT. Editors and
|
|
45720
45902
|
// AI tools rewrite canvas files via write-temp + rename, and git operations
|
|
45721
45903
|
// (checkout, stash) briefly remove them; a prune racing that window used to
|
|
45722
45904
|
// silently unregister the canvas, leaving the generated tempo-host.tsx
|
|
45723
45905
|
// serving without it and every storyboard stuck "waiting for iframe content"
|
|
45724
45906
|
// until the 180s watchdog (TEM-919). Re-check once after a short delay and
|
|
45725
|
-
// only drop when the file is still gone.
|
|
45907
|
+
// only drop when the file is still gone. Session demand survives the drop
|
|
45908
|
+
// and restores registration on reconciliation when the file returns.
|
|
45726
45909
|
async canvasFileExistsWithRecheck(absolutePath) {
|
|
45727
45910
|
for (let attempt = 0; ; attempt += 1) {
|
|
45728
45911
|
try {
|
|
@@ -47943,7 +48126,7 @@ async function readOptional3(file) {
|
|
|
47943
48126
|
|
|
47944
48127
|
// ../tempo-devserver/tempo-devserver.ts
|
|
47945
48128
|
import { spawn as spawn6 } from "child_process";
|
|
47946
|
-
import { createHash as
|
|
48129
|
+
import { createHash as createHash6, randomUUID as randomUUID2 } from "crypto";
|
|
47947
48130
|
import fs from "fs";
|
|
47948
48131
|
import {
|
|
47949
48132
|
access as access5,
|
|
@@ -49649,7 +49832,7 @@ function installListenerRecorders(): () => void {
|
|
|
49649
49832
|
// ../tempo-devserver/flutter-devserver.ts
|
|
49650
49833
|
import { fileURLToPath, pathToFileURL as pathToFileURL2 } from "url";
|
|
49651
49834
|
import { spawn as spawn5 } from "child_process";
|
|
49652
|
-
import { createHash as
|
|
49835
|
+
import { createHash as createHash5 } from "crypto";
|
|
49653
49836
|
import { constants as fsConstants } from "fs";
|
|
49654
49837
|
import { access as access3, readdir as readdir7, readFile as readFile13, realpath as realpath6, stat as stat8 } from "fs/promises";
|
|
49655
49838
|
import {
|
|
@@ -50502,7 +50685,7 @@ function chooseSourceChangeAction(change) {
|
|
|
50502
50685
|
return "hot";
|
|
50503
50686
|
}
|
|
50504
50687
|
async function readPackageGraphFingerprint(packageDirs, projectRoot) {
|
|
50505
|
-
const hash =
|
|
50688
|
+
const hash = createHash5("sha256");
|
|
50506
50689
|
const dirs = /* @__PURE__ */ new Set();
|
|
50507
50690
|
for (const packageDir of [
|
|
50508
50691
|
...packageDirs,
|
|
@@ -55479,7 +55662,7 @@ async function computeInstallCompletionKey(packageRoot) {
|
|
|
55479
55662
|
if (parent === current) break;
|
|
55480
55663
|
current = parent;
|
|
55481
55664
|
}
|
|
55482
|
-
const hash =
|
|
55665
|
+
const hash = createHash6("sha256");
|
|
55483
55666
|
hash.update(JSON.stringify(dependencyInput));
|
|
55484
55667
|
hash.update("\0");
|
|
55485
55668
|
hash.update(lockfile?.path ?? "no-lockfile");
|
|
@@ -62834,7 +63017,7 @@ async function startDevserverSession(options) {
|
|
|
62834
63017
|
// ../canvas-capture-headless/src/enumerate.ts
|
|
62835
63018
|
import { access as access16, readFile as readFile29 } from "fs/promises";
|
|
62836
63019
|
import path42 from "path";
|
|
62837
|
-
import { createHash as
|
|
63020
|
+
import { createHash as createHash7 } from "crypto";
|
|
62838
63021
|
|
|
62839
63022
|
// ../canvas-capture-headless/src/ignore-mask.ts
|
|
62840
63023
|
function ignoredStoryboardArea(regions, width, height) {
|
|
@@ -62939,7 +63122,7 @@ async function enumerateCanvasStoryboards(options) {
|
|
|
62939
63122
|
canvasPath: parsed.canvasPath ?? toPosixPath3(
|
|
62940
63123
|
path42.relative(projectRoot, path42.dirname(filePath))
|
|
62941
63124
|
),
|
|
62942
|
-
revision:
|
|
63125
|
+
revision: createHash7("sha256").update(source).digest("hex")
|
|
62943
63126
|
}
|
|
62944
63127
|
} : storyboard.kind === "html" ? {
|
|
62945
63128
|
source: {
|
|
@@ -64223,4 +64406,4 @@ export {
|
|
|
64223
64406
|
buildBaselineCaptureArgs,
|
|
64224
64407
|
main
|
|
64225
64408
|
};
|
|
64226
|
-
//# sourceMappingURL=chunk-
|
|
64409
|
+
//# sourceMappingURL=chunk-3IKPKXZZ.js.map
|