@decocms/parity 0.17.0 → 0.17.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/cli.js +44 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -39020,6 +39020,21 @@ async function capturePage(page, opts) {
|
|
|
39020
39020
|
let xRobotsTag = null;
|
|
39021
39021
|
let vitals = null;
|
|
39022
39022
|
let html3 = "";
|
|
39023
|
+
let _resolveDisconnect;
|
|
39024
|
+
const disconnectPromise = new Promise((r) => {
|
|
39025
|
+
_resolveDisconnect = r;
|
|
39026
|
+
});
|
|
39027
|
+
const browser = page.context().browser();
|
|
39028
|
+
const handleBrowserDisconnect = () => {
|
|
39029
|
+
dlog(opts.side, opts.viewport, " capturePage: browser disconnected — aborting capture");
|
|
39030
|
+
_resolveDisconnect();
|
|
39031
|
+
};
|
|
39032
|
+
const handlePageCrash = () => {
|
|
39033
|
+
dlog(opts.side, opts.viewport, " capturePage: page crashed — aborting capture");
|
|
39034
|
+
_resolveDisconnect();
|
|
39035
|
+
};
|
|
39036
|
+
browser?.on("disconnected", handleBrowserDisconnect);
|
|
39037
|
+
page.on("crash", handlePageCrash);
|
|
39023
39038
|
const inner = async () => {
|
|
39024
39039
|
try {
|
|
39025
39040
|
dlog(opts.side, opts.viewport, ` capturePage: goto(${opts.url}) start`);
|
|
@@ -39130,7 +39145,7 @@ async function capturePage(page, opts) {
|
|
|
39130
39145
|
};
|
|
39131
39146
|
const SAFETY_MARGIN_MS = 1e4;
|
|
39132
39147
|
const outerDeadlineMs = overallBudgetMs + SAFETY_MARGIN_MS;
|
|
39133
|
-
|
|
39148
|
+
const result = await Promise.race([
|
|
39134
39149
|
inner(),
|
|
39135
39150
|
new Promise((resolve) => setTimeout(() => {
|
|
39136
39151
|
state.console.push({
|
|
@@ -39138,8 +39153,18 @@ async function capturePage(page, opts) {
|
|
|
39138
39153
|
text: `[capture-timeout] capturePage exceeded ${outerDeadlineMs}ms outer deadline — returning partial capture`
|
|
39139
39154
|
});
|
|
39140
39155
|
resolve(buildPartial());
|
|
39141
|
-
}, outerDeadlineMs))
|
|
39156
|
+
}, outerDeadlineMs)),
|
|
39157
|
+
disconnectPromise.then(() => {
|
|
39158
|
+
state.console.push({
|
|
39159
|
+
type: "error",
|
|
39160
|
+
text: "[browser-disconnected] browser/page crashed — returning partial capture"
|
|
39161
|
+
});
|
|
39162
|
+
return buildPartial();
|
|
39163
|
+
})
|
|
39142
39164
|
]);
|
|
39165
|
+
browser?.off("disconnected", handleBrowserDisconnect);
|
|
39166
|
+
page.off("crash", handlePageCrash);
|
|
39167
|
+
return result;
|
|
39143
39168
|
}
|
|
39144
39169
|
|
|
39145
39170
|
// src/report/html-template.ts
|
|
@@ -49348,6 +49373,7 @@ async function cssTraceCommand(opts) {
|
|
|
49348
49373
|
|
|
49349
49374
|
// src/commands/e2e.ts
|
|
49350
49375
|
import { writeFileSync as writeFileSync10 } from "node:fs";
|
|
49376
|
+
import { spawn } from "node:child_process";
|
|
49351
49377
|
import chalk8 from "chalk";
|
|
49352
49378
|
import ora4 from "ora";
|
|
49353
49379
|
|
|
@@ -55147,6 +55173,19 @@ async function e2eCommand(opts) {
|
|
|
55147
55173
|
quiet: opts.json === true
|
|
55148
55174
|
});
|
|
55149
55175
|
}
|
|
55176
|
+
const E2E_TIMEOUT_MS = 3 * 60 * 1000;
|
|
55177
|
+
const watchdogScript = `setTimeout(()=>{try{process.kill(${process.pid},9)}catch(_){}},${E2E_TIMEOUT_MS})`;
|
|
55178
|
+
const watchdog = spawn(process.execPath, ["-e", watchdogScript], {
|
|
55179
|
+
stdio: "ignore",
|
|
55180
|
+
detached: false
|
|
55181
|
+
});
|
|
55182
|
+
watchdog.unref();
|
|
55183
|
+
const onSignal = () => {
|
|
55184
|
+
watchdog.kill();
|
|
55185
|
+
process.exit(1);
|
|
55186
|
+
};
|
|
55187
|
+
process.once("SIGINT", onSignal);
|
|
55188
|
+
process.once("SIGTERM", onSignal);
|
|
55150
55189
|
const spinner = opts.json ? null : ora4("Lançando browser…").start();
|
|
55151
55190
|
let browser = null;
|
|
55152
55191
|
const allFlows = [];
|
|
@@ -55190,6 +55229,9 @@ async function e2eCommand(opts) {
|
|
|
55190
55229
|
if (spinner)
|
|
55191
55230
|
spinner.succeed(`${allFlows.length} flow capture(s), ${allPages.length} página(s)`);
|
|
55192
55231
|
} finally {
|
|
55232
|
+
watchdog.kill();
|
|
55233
|
+
process.off("SIGINT", onSignal);
|
|
55234
|
+
process.off("SIGTERM", onSignal);
|
|
55193
55235
|
await browser?.close().catch(() => {
|
|
55194
55236
|
return;
|
|
55195
55237
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|