@decocms/parity 0.35.25 → 0.35.27
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/CHANGELOG.md +15 -1
- package/dist/cli.js +441 -96
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -38,6 +38,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
38
38
|
judged (never a pass). A request the recording never saw fails the check and is named. A corpus
|
|
39
39
|
suite (`tests/corpus/corpus.test.ts`, `PARITY_CORPUS_DIR`) replays a directory of reviewed
|
|
40
40
|
recordings kept in a separate private repository. See `docs/reports.md`.
|
|
41
|
+
* **Determinism test**: the same recording replayed twice must give identical checks, issues
|
|
42
|
+
(ids, severity, details, evidence), verdict and score, order included; the corpus suite repeats
|
|
43
|
+
that for every case.
|
|
44
|
+
* **`parity run --golden <dir>`** uses the prod half of a `--record` recording as the reference
|
|
45
|
+
and captures only cand (`--prod` optional). Prod is not contacted at all: pages, flows, visual
|
|
46
|
+
probes and the resolved config come from the recording, cand is captured at exactly the
|
|
47
|
+
recording's page keys, and prod-origin `fetch` calls made by checks are served only from its
|
|
48
|
+
fetch log. A prod request the recording never saw is reported as `golden.staleRequests` in
|
|
49
|
+
`report.json` and exits 2. Validation (other prod origin, missing viewports, uncovered check
|
|
50
|
+
selection, empty golden, `--pages` outside the golden) exits 2 before any browser work. Recordings
|
|
51
|
+
now also carry the detected `platform` (optional; older recordings still load). See
|
|
52
|
+
`docs/cli.md`.
|
|
41
53
|
|
|
42
54
|
### Fixed
|
|
43
55
|
|
|
@@ -92,7 +104,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
92
104
|
a `commerce` site profile; a content site's listing or about page is `other`.
|
|
93
105
|
`pages[].kindEvidence` records the decision. `category-auto` no longer hard-codes
|
|
94
106
|
`plp`.
|
|
95
|
-
|
|
107
|
+
* **`checks[]`, and the `issues[]` derived from it, are in registration order** instead of
|
|
108
|
+
completion order, so `report.json` and the JSONL stream no longer reorder between runs of the
|
|
109
|
+
same input. Results still land in the crash-safety array as each check finishes.
|
|
96
110
|
|
|
97
111
|
### Changed
|
|
98
112
|
|
package/dist/cli.js
CHANGED
|
@@ -90193,23 +90193,29 @@ function getCheckByName(name) {
|
|
|
90193
90193
|
}
|
|
90194
90194
|
async function runAllChecks(ctx, outResults, checkFilter) {
|
|
90195
90195
|
const results = outResults ?? [];
|
|
90196
|
-
const checksToRun = checkFilter ? Array.from(checkFilter).map((name) => getCheckByName(name)).filter((c) => c !== undefined) : ALL_CHECKS;
|
|
90197
|
-
|
|
90196
|
+
const checksToRun = checkFilter ? Array.from(checkFilter).map((name) => getCheckByName(name)).filter((c) => c !== undefined).sort((a, b) => ALL_CHECKS.indexOf(a) - ALL_CHECKS.indexOf(b)) : ALL_CHECKS;
|
|
90197
|
+
const rank = new Map;
|
|
90198
|
+
const push = (r, i) => {
|
|
90199
|
+
rank.set(r, i);
|
|
90200
|
+
results.push(r);
|
|
90201
|
+
};
|
|
90202
|
+
await Promise.all(checksToRun.map(async (check, i) => {
|
|
90198
90203
|
const start = Date.now();
|
|
90199
90204
|
try {
|
|
90200
90205
|
const r = await check(ctx);
|
|
90201
|
-
|
|
90206
|
+
push({ ...r, durationMs: r.durationMs || Date.now() - start }, i);
|
|
90202
90207
|
} catch (err) {
|
|
90203
|
-
|
|
90208
|
+
push({
|
|
90204
90209
|
name: check.name || "anonymous-check",
|
|
90205
90210
|
status: "fail",
|
|
90206
90211
|
severity: "medium",
|
|
90207
90212
|
durationMs: Date.now() - start,
|
|
90208
90213
|
summary: `check threw: ${err.message}`,
|
|
90209
90214
|
issues: []
|
|
90210
|
-
});
|
|
90215
|
+
}, i);
|
|
90211
90216
|
}
|
|
90212
90217
|
}));
|
|
90218
|
+
results.sort((a, b) => (rank.get(a) ?? -1) - (rank.get(b) ?? -1));
|
|
90213
90219
|
return results;
|
|
90214
90220
|
}
|
|
90215
90221
|
|
|
@@ -90491,6 +90497,7 @@ var PageCapture = z2.object({
|
|
|
90491
90497
|
tracePath: z2.string().optional(),
|
|
90492
90498
|
xRobotsTag: z2.string().nullable().optional(),
|
|
90493
90499
|
pairKey: z2.string().optional(),
|
|
90500
|
+
pass: z2.enum(["extra", "visual"]).optional(),
|
|
90494
90501
|
variant: VariantFingerprint.optional()
|
|
90495
90502
|
});
|
|
90496
90503
|
var StepCapture = z2.object({
|
|
@@ -90849,6 +90856,12 @@ var Run = z2.object({
|
|
|
90849
90856
|
cand: z2.object({ cookies: z2.array(z2.string()), headers: z2.array(z2.string()) })
|
|
90850
90857
|
}).optional(),
|
|
90851
90858
|
pagePairs: z2.array(PagePairMeasurement).optional(),
|
|
90859
|
+
golden: z2.object({
|
|
90860
|
+
dir: z2.string(),
|
|
90861
|
+
recordedAt: z2.string(),
|
|
90862
|
+
parityVersion: z2.string().optional(),
|
|
90863
|
+
staleRequests: z2.array(z2.string()).optional()
|
|
90864
|
+
}).optional(),
|
|
90852
90865
|
timings: z2.object({
|
|
90853
90866
|
totalMs: z2.number(),
|
|
90854
90867
|
phases: z2.array(z2.object({ phase: z2.string(), durationMs: z2.number() }))
|
|
@@ -117481,13 +117494,13 @@ function planTouchCommand(dir, page, opts) {
|
|
|
117481
117494
|
}
|
|
117482
117495
|
|
|
117483
117496
|
// src/commands/pr.ts
|
|
117484
|
-
import { existsSync as
|
|
117485
|
-
import { join as
|
|
117497
|
+
import { existsSync as existsSync32, readFileSync as readFileSync40, writeFileSync as writeFileSync33 } from "node:fs";
|
|
117498
|
+
import { join as join47 } from "node:path";
|
|
117486
117499
|
import chalk35 from "chalk";
|
|
117487
117500
|
|
|
117488
117501
|
// src/commands/run.ts
|
|
117489
|
-
import { existsSync as
|
|
117490
|
-
import { join as
|
|
117502
|
+
import { existsSync as existsSync31, readFileSync as readFileSync39, rmSync as rmSync5 } from "node:fs";
|
|
117503
|
+
import { join as join46, resolve as resolve21 } from "node:path";
|
|
117491
117504
|
import chalk34 from "chalk";
|
|
117492
117505
|
import ora8 from "ora";
|
|
117493
117506
|
|
|
@@ -117558,6 +117571,7 @@ var RecordedContext = z4.object({
|
|
|
117558
117571
|
viewports: z4.array(Viewport),
|
|
117559
117572
|
candIsProduction: z4.boolean().optional(),
|
|
117560
117573
|
checkNames: z4.array(z4.string()).optional(),
|
|
117574
|
+
platform: z4.string().optional(),
|
|
117561
117575
|
visualProbes: z4.array(z4.tuple([z4.string(), CaptureResultSchema])).optional(),
|
|
117562
117576
|
missingFiles: z4.array(MissingFile),
|
|
117563
117577
|
omittedArtifacts: z4.object({ har: z4.number(), trace: z4.number(), video: z4.number() })
|
|
@@ -117579,7 +117593,7 @@ function saveCheckContext(dir, ctx, meta) {
|
|
|
117579
117593
|
const missing = [];
|
|
117580
117594
|
const omitted = { har: 0, trace: 0, video: 0 };
|
|
117581
117595
|
let n = 0;
|
|
117582
|
-
const rel = (p) => {
|
|
117596
|
+
const rel = (p, expectedAbsent = false) => {
|
|
117583
117597
|
if (p === "")
|
|
117584
117598
|
return "";
|
|
117585
117599
|
const hit = copied.get(p);
|
|
@@ -117588,7 +117602,7 @@ function saveCheckContext(dir, ctx, meta) {
|
|
|
117588
117602
|
const dest = `files/${String(++n).padStart(4, "0")}-${basename5(p)}`;
|
|
117589
117603
|
if (existsSync29(p))
|
|
117590
117604
|
copyFileSync(p, join44(dir, dest));
|
|
117591
|
-
else
|
|
117605
|
+
else if (!expectedAbsent)
|
|
117592
117606
|
missing.push({ path: dest, original: p });
|
|
117593
117607
|
copied.set(p, dest);
|
|
117594
117608
|
return dest;
|
|
@@ -117600,7 +117614,7 @@ function saveCheckContext(dir, ctx, meta) {
|
|
|
117600
117614
|
omitted.har++;
|
|
117601
117615
|
if (tracePath)
|
|
117602
117616
|
omitted.trace++;
|
|
117603
|
-
return { ...rest, screenshotPath: rel(c.screenshotPath) };
|
|
117617
|
+
return { ...rest, screenshotPath: rel(c.screenshotPath, c.pass === "extra") };
|
|
117604
117618
|
};
|
|
117605
117619
|
const step = (s) => {
|
|
117606
117620
|
const { tracePath, screenshotBeforePath, ...rest } = s;
|
|
@@ -117625,6 +117639,7 @@ function saveCheckContext(dir, ctx, meta) {
|
|
|
117625
117639
|
prodUrl: meta.prodUrl,
|
|
117626
117640
|
candUrl: meta.candUrl,
|
|
117627
117641
|
...meta.checkNames ? { checkNames: meta.checkNames } : {},
|
|
117642
|
+
...meta.platform ? { platform: meta.platform } : {},
|
|
117628
117643
|
prodPages: ctx.prodPages.map(page),
|
|
117629
117644
|
candPages: ctx.candPages.map(page),
|
|
117630
117645
|
prodFlows: ctx.prodFlows.map(flow),
|
|
@@ -117701,6 +117716,7 @@ function loadCheckContext(dir) {
|
|
|
117701
117716
|
candUrl: r.candUrl,
|
|
117702
117717
|
recordedAt: r.recordedAt,
|
|
117703
117718
|
...r.checkNames ? { checkNames: r.checkNames } : {},
|
|
117719
|
+
...r.platform ? { platform: r.platform } : {},
|
|
117704
117720
|
...r.parityVersion ? { parityVersion: r.parityVersion } : {}
|
|
117705
117721
|
},
|
|
117706
117722
|
fetchLog,
|
|
@@ -118134,6 +118150,253 @@ function checkToJsonl(runId, check) {
|
|
|
118134
118150
|
};
|
|
118135
118151
|
}
|
|
118136
118152
|
|
|
118153
|
+
// src/engine/golden.ts
|
|
118154
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync30, mkdirSync as mkdirSync24 } from "node:fs";
|
|
118155
|
+
import { basename as basename6, join as join45 } from "node:path";
|
|
118156
|
+
var GOLDEN_STALE_AFTER_DAYS = 7;
|
|
118157
|
+
var isVisualPage = (p) => p.pass === "visual";
|
|
118158
|
+
var isExtraPage = (p) => p.pass === "extra";
|
|
118159
|
+
function pathname(url) {
|
|
118160
|
+
try {
|
|
118161
|
+
return new URL(url).pathname || "/";
|
|
118162
|
+
} catch {
|
|
118163
|
+
return url;
|
|
118164
|
+
}
|
|
118165
|
+
}
|
|
118166
|
+
function pathAndQuery(url) {
|
|
118167
|
+
try {
|
|
118168
|
+
const u = new URL(url);
|
|
118169
|
+
return (u.pathname || "/") + u.search;
|
|
118170
|
+
} catch {
|
|
118171
|
+
return url;
|
|
118172
|
+
}
|
|
118173
|
+
}
|
|
118174
|
+
var pairKeyOf = (p) => p.pairKey ?? pathAndQuery(p.url);
|
|
118175
|
+
function originOf2(url) {
|
|
118176
|
+
try {
|
|
118177
|
+
return new URL(url).origin;
|
|
118178
|
+
} catch {
|
|
118179
|
+
return null;
|
|
118180
|
+
}
|
|
118181
|
+
}
|
|
118182
|
+
function loadGolden(dir) {
|
|
118183
|
+
try {
|
|
118184
|
+
return { rec: loadCheckContext(dir) };
|
|
118185
|
+
} catch (err) {
|
|
118186
|
+
return { error: `--golden ${dir}: ${err.message}` };
|
|
118187
|
+
}
|
|
118188
|
+
}
|
|
118189
|
+
function planGoldenRun(rec, input) {
|
|
118190
|
+
const errors = [];
|
|
118191
|
+
const warnings = [];
|
|
118192
|
+
const plan = {
|
|
118193
|
+
errors,
|
|
118194
|
+
warnings,
|
|
118195
|
+
visualPaths: [],
|
|
118196
|
+
visualKeys: new Set,
|
|
118197
|
+
extraPaths: [],
|
|
118198
|
+
viewports: new Set(input.viewports),
|
|
118199
|
+
flows: new Set(input.flows)
|
|
118200
|
+
};
|
|
118201
|
+
const { prodPages, candPages, prodFlows, viewports: goldenViewports } = rec.ctx;
|
|
118202
|
+
if (input.prod !== undefined) {
|
|
118203
|
+
const asked = originOf2(input.prod);
|
|
118204
|
+
const held = originOf2(rec.meta.prodUrl);
|
|
118205
|
+
if (asked !== held) {
|
|
118206
|
+
errors.push(`--prod ${input.prod} is not the golden's prod (${rec.meta.prodUrl}): the recording is a capture of a different site. Drop --prod, or record a golden of that site.`);
|
|
118207
|
+
}
|
|
118208
|
+
}
|
|
118209
|
+
const missingViewports = input.viewports.filter((v) => !goldenViewports.includes(v));
|
|
118210
|
+
if (missingViewports.length > 0) {
|
|
118211
|
+
errors.push(`the golden holds viewport(s) ${goldenViewports.join(", ") || "(none)"} but this run asks for ${missingViewports.join(", ")}`);
|
|
118212
|
+
}
|
|
118213
|
+
if (rec.meta.checkNames) {
|
|
118214
|
+
const recorded = new Set(rec.meta.checkNames);
|
|
118215
|
+
const wanted = input.checkNames ?? new Set(Object.keys(ALL_CHECKS_BY_NAME));
|
|
118216
|
+
const uncovered = [...wanted].filter((n) => !recorded.has(n)).sort();
|
|
118217
|
+
if (uncovered.length > 0) {
|
|
118218
|
+
errors.push(`the golden was recorded with a check selection that does not cover ${uncovered.length} check(s) this run executes (${uncovered.join(", ")}); narrow --only/--skip or record a new golden`);
|
|
118219
|
+
}
|
|
118220
|
+
}
|
|
118221
|
+
if (prodPages.length === 0 && prodFlows.length === 0) {
|
|
118222
|
+
errors.push("the golden holds no prod pages and no prod flows: there is nothing to compare against");
|
|
118223
|
+
return plan;
|
|
118224
|
+
}
|
|
118225
|
+
const inFlow = new Set(prodFlows.flatMap((f) => f.pages.map((p) => `${p.viewport} ${p.url} ${p.screenshotPath}`)));
|
|
118226
|
+
const outsideFlows = prodPages.filter((p) => !inFlow.has(`${p.viewport} ${p.url} ${p.screenshotPath}`));
|
|
118227
|
+
if (outsideFlows.length > 0 && !prodPages.some((p) => p.pass !== undefined)) {
|
|
118228
|
+
errors.push("the golden was recorded before the capture pass was stored on each page; record it again");
|
|
118229
|
+
return plan;
|
|
118230
|
+
}
|
|
118231
|
+
const inRun = (p) => plan.viewports.has(p.viewport);
|
|
118232
|
+
if (input.visualPagesLimit > 0) {
|
|
118233
|
+
const goldenVisual = prodPages.filter((p) => isVisualPage(p) && inRun(p));
|
|
118234
|
+
const candPathByKey = new Map;
|
|
118235
|
+
for (const c of candPages) {
|
|
118236
|
+
if (isVisualPage(c) && !candPathByKey.has(pairKeyOf(c))) {
|
|
118237
|
+
candPathByKey.set(pairKeyOf(c), pathAndQuery(c.url));
|
|
118238
|
+
}
|
|
118239
|
+
}
|
|
118240
|
+
const keys = [...new Set(goldenVisual.map(pairKeyOf))];
|
|
118241
|
+
if (input.explicitPages) {
|
|
118242
|
+
const held = new Set(keys);
|
|
118243
|
+
const missing = input.explicitPages.filter((e) => !held.has(e.prod)).map((e) => e.prod);
|
|
118244
|
+
if (missing.length > 0) {
|
|
118245
|
+
errors.push(`the golden holds no prod capture for --pages path(s): ${missing.join(", ")} (it holds: ${keys.join(", ") || "none"}). Record a new golden that includes them.`);
|
|
118246
|
+
} else {
|
|
118247
|
+
plan.visualPaths = input.explicitPages;
|
|
118248
|
+
}
|
|
118249
|
+
} else {
|
|
118250
|
+
plan.visualPaths = keys.slice(0, input.visualPagesLimit).map((k) => ({ prod: k, cand: candPathByKey.get(k) ?? k }));
|
|
118251
|
+
}
|
|
118252
|
+
plan.visualKeys = new Set(plan.visualPaths.map((p) => p.prod));
|
|
118253
|
+
if (plan.visualKeys.size === 0 && errors.length === 0) {
|
|
118254
|
+
warnings.push("the golden holds no visual-pass pages (recorded with --no-visual-diff?): the visual check will be inconclusive");
|
|
118255
|
+
}
|
|
118256
|
+
}
|
|
118257
|
+
if (input.vitalsPagesLimit > 0) {
|
|
118258
|
+
const paths = prodPages.filter((p) => isExtraPage(p) && inRun(p)).map((p) => pathname(p.url));
|
|
118259
|
+
plan.extraPaths = [...new Set(paths)].slice(0, input.vitalsPagesLimit);
|
|
118260
|
+
}
|
|
118261
|
+
const heldFlows = new Set(prodFlows.map((f) => f.flow));
|
|
118262
|
+
const noProdFlow = input.flows.filter((f) => !heldFlows.has(f));
|
|
118263
|
+
if (noProdFlow.length > 0) {
|
|
118264
|
+
warnings.push(`the golden has no prod capture of flow(s) ${noProdFlow.join(", ")}: the cand side of each is reported as unpaired`);
|
|
118265
|
+
}
|
|
118266
|
+
return plan;
|
|
118267
|
+
}
|
|
118268
|
+
function makeRelocator(destDir) {
|
|
118269
|
+
const done = new Map;
|
|
118270
|
+
const taken = new Set;
|
|
118271
|
+
return (p) => {
|
|
118272
|
+
if (p === "")
|
|
118273
|
+
return p;
|
|
118274
|
+
const hit = done.get(p);
|
|
118275
|
+
if (hit !== undefined)
|
|
118276
|
+
return hit;
|
|
118277
|
+
let out = p;
|
|
118278
|
+
if (existsSync30(p)) {
|
|
118279
|
+
mkdirSync24(destDir, { recursive: true });
|
|
118280
|
+
const name = basename6(p).replace(/^\d{4}-/, "");
|
|
118281
|
+
const dot = name.lastIndexOf(".");
|
|
118282
|
+
const stem = dot > 0 ? name.slice(0, dot) : name;
|
|
118283
|
+
const ext = dot > 0 ? name.slice(dot) : "";
|
|
118284
|
+
let candidate = name;
|
|
118285
|
+
for (let n = 2;taken.has(candidate); n++)
|
|
118286
|
+
candidate = `${stem}-${n}${ext}`;
|
|
118287
|
+
taken.add(candidate);
|
|
118288
|
+
out = join45(destDir, candidate);
|
|
118289
|
+
copyFileSync2(p, out);
|
|
118290
|
+
}
|
|
118291
|
+
done.set(p, out);
|
|
118292
|
+
return out;
|
|
118293
|
+
};
|
|
118294
|
+
}
|
|
118295
|
+
function mergeGoldenContext(rec, plan, live, relocate) {
|
|
118296
|
+
const extraKept = (p) => plan.extraPaths.includes(pathname(p.url));
|
|
118297
|
+
const keepPage = (p) => {
|
|
118298
|
+
if (!plan.viewports.has(p.viewport))
|
|
118299
|
+
return false;
|
|
118300
|
+
if (isExtraPage(p))
|
|
118301
|
+
return extraKept(p);
|
|
118302
|
+
if (isVisualPage(p))
|
|
118303
|
+
return plan.visualKeys.has(pairKeyOf(p));
|
|
118304
|
+
return true;
|
|
118305
|
+
};
|
|
118306
|
+
const page = (p) => ({
|
|
118307
|
+
...p,
|
|
118308
|
+
screenshotPath: relocate(p.screenshotPath)
|
|
118309
|
+
});
|
|
118310
|
+
const step = (s) => ({
|
|
118311
|
+
...s,
|
|
118312
|
+
screenshotPath: relocate(s.screenshotPath),
|
|
118313
|
+
...s.screenshotBeforePath !== undefined ? { screenshotBeforePath: relocate(s.screenshotBeforePath) } : {}
|
|
118314
|
+
});
|
|
118315
|
+
const keepFlow = (f) => {
|
|
118316
|
+
if (!plan.viewports.has(f.viewport))
|
|
118317
|
+
return false;
|
|
118318
|
+
const only = f.pages.length === 1 ? f.pages[0] : undefined;
|
|
118319
|
+
if (only && isExtraPage(only))
|
|
118320
|
+
return extraKept(only);
|
|
118321
|
+
return plan.flows.has(f.flow);
|
|
118322
|
+
};
|
|
118323
|
+
const keptPages = rec.ctx.prodPages.filter(keepPage);
|
|
118324
|
+
const pages = [...keptPages.map(page), ...live.pages];
|
|
118325
|
+
const flows = [
|
|
118326
|
+
...rec.ctx.prodFlows.filter(keepFlow).map((f) => ({
|
|
118327
|
+
...f,
|
|
118328
|
+
pages: f.pages.map(page),
|
|
118329
|
+
...f.steps ? { steps: f.steps.map(step) } : {}
|
|
118330
|
+
})),
|
|
118331
|
+
...live.flows
|
|
118332
|
+
];
|
|
118333
|
+
let visualProbes;
|
|
118334
|
+
if (live.visualProbes) {
|
|
118335
|
+
visualProbes = new Map;
|
|
118336
|
+
const keptShots = new Set(keptPages.filter(isVisualPage).map((p) => p.screenshotPath));
|
|
118337
|
+
for (const [k, v] of rec.ctx.visualProbes ?? []) {
|
|
118338
|
+
if (!keptShots.has(k))
|
|
118339
|
+
continue;
|
|
118340
|
+
visualProbes.set(relocate(k), {
|
|
118341
|
+
...v,
|
|
118342
|
+
side: { ...v.side, screenshot: v.side.screenshot ? relocate(v.side.screenshot) : null },
|
|
118343
|
+
repeatScreenshot: v.repeatScreenshot ? relocate(v.repeatScreenshot) : null
|
|
118344
|
+
});
|
|
118345
|
+
}
|
|
118346
|
+
for (const [k, v] of live.visualProbes)
|
|
118347
|
+
visualProbes.set(k, v);
|
|
118348
|
+
}
|
|
118349
|
+
return { pages, flows, visualProbes };
|
|
118350
|
+
}
|
|
118351
|
+
function goldenPlatform(rec) {
|
|
118352
|
+
if (rec.meta.platform)
|
|
118353
|
+
return rec.meta.platform;
|
|
118354
|
+
const home = rec.ctx.prodPages.find((p) => p.html && pathname(p.url) === "/");
|
|
118355
|
+
return home?.html ? detectPlatform({ url: rec.meta.prodUrl, html: home.html }) : "custom";
|
|
118356
|
+
}
|
|
118357
|
+
function installGoldenFetch(log, prodOrigin) {
|
|
118358
|
+
const orig = globalThis.fetch;
|
|
118359
|
+
const replay = createReplayFetch(log);
|
|
118360
|
+
const stale = new Set;
|
|
118361
|
+
const mine = async (input, init) => {
|
|
118362
|
+
const raw = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
118363
|
+
if (originOf2(raw) !== prodOrigin)
|
|
118364
|
+
return orig(input, init);
|
|
118365
|
+
try {
|
|
118366
|
+
return await replay(input, init);
|
|
118367
|
+
} catch (err) {
|
|
118368
|
+
if (err instanceof UnrecordedFetchError) {
|
|
118369
|
+
stale.add(err.message.replace(/^replay: /, "").replace(/ was not made during the recorded run$/, ""));
|
|
118370
|
+
}
|
|
118371
|
+
throw err;
|
|
118372
|
+
}
|
|
118373
|
+
};
|
|
118374
|
+
globalThis.fetch = mine;
|
|
118375
|
+
return {
|
|
118376
|
+
stale: () => [...stale].sort(),
|
|
118377
|
+
restore: () => {
|
|
118378
|
+
if (globalThis.fetch === mine)
|
|
118379
|
+
globalThis.fetch = orig;
|
|
118380
|
+
}
|
|
118381
|
+
};
|
|
118382
|
+
}
|
|
118383
|
+
function goldenAge(recordedAt, now = Date.now()) {
|
|
118384
|
+
const ms = now - Date.parse(recordedAt);
|
|
118385
|
+
if (!Number.isFinite(ms))
|
|
118386
|
+
return { text: "age unknown", warn: true };
|
|
118387
|
+
const hours = Math.max(0, ms) / 3600000;
|
|
118388
|
+
const text = hours < 48 ? `${Math.round(hours)}h old` : `${Math.round(hours / 24)} days old`;
|
|
118389
|
+
return { text, warn: hours / 24 > GOLDEN_STALE_AFTER_DAYS };
|
|
118390
|
+
}
|
|
118391
|
+
function goldenReportField(dir, meta, stale) {
|
|
118392
|
+
return {
|
|
118393
|
+
dir,
|
|
118394
|
+
recordedAt: meta.recordedAt,
|
|
118395
|
+
...meta.parityVersion ? { parityVersion: meta.parityVersion } : {},
|
|
118396
|
+
...stale.length > 0 ? { staleRequests: stale } : {}
|
|
118397
|
+
};
|
|
118398
|
+
}
|
|
118399
|
+
|
|
118137
118400
|
// src/util/heartbeat.ts
|
|
118138
118401
|
function startHeartbeat(opts) {
|
|
118139
118402
|
const intervalMs = opts.intervalMs ?? 30000;
|
|
@@ -118584,7 +118847,14 @@ function readRunChecks(reportPath) {
|
|
|
118584
118847
|
}
|
|
118585
118848
|
}
|
|
118586
118849
|
async function runCommand(rawOpts) {
|
|
118587
|
-
|
|
118850
|
+
const goldenLoaded = rawOpts.golden ? loadGolden(rawOpts.golden) : undefined;
|
|
118851
|
+
if (goldenLoaded && "error" in goldenLoaded) {
|
|
118852
|
+
console.error(chalk34.red(` ${goldenLoaded.error}`));
|
|
118853
|
+
return 2;
|
|
118854
|
+
}
|
|
118855
|
+
const goldenRec = goldenLoaded?.rec;
|
|
118856
|
+
const userProd = rawOpts.prod;
|
|
118857
|
+
if (!rawOpts.prod && !goldenRec) {
|
|
118588
118858
|
const target = rawOpts.cand ?? "<url>";
|
|
118589
118859
|
console.error(`${chalk34.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
|
|
118590
118860
|
For one site, use: ${chalk34.cyan(`parity e2e --url ${target}`)}
|
|
@@ -118592,6 +118862,8 @@ async function runCommand(rawOpts) {
|
|
|
118592
118862
|
return 2;
|
|
118593
118863
|
}
|
|
118594
118864
|
const opts = applyPreset(rawOpts);
|
|
118865
|
+
if (goldenRec)
|
|
118866
|
+
opts.prod = goldenRec.meta.prodUrl;
|
|
118595
118867
|
if (opts.record) {
|
|
118596
118868
|
try {
|
|
118597
118869
|
assertRecordDirFree(opts.record);
|
|
@@ -118643,6 +118915,8 @@ async function runCommand(rawOpts) {
|
|
|
118643
118915
|
let profile;
|
|
118644
118916
|
if (opts.profile === "commerce" || opts.profile === "content") {
|
|
118645
118917
|
profile = opts.profile;
|
|
118918
|
+
} else if (goldenRec) {
|
|
118919
|
+
profile = goldenRec.ctx.rc.profile ?? "commerce";
|
|
118646
118920
|
} else {
|
|
118647
118921
|
const pv = opts.viewports.split(",")[0]?.trim() || "mobile";
|
|
118648
118922
|
earlyProdHtml = await fetchHomeHtml(opts.prod, pv, pinFetchHeaders(pins.prod));
|
|
@@ -118702,7 +118976,41 @@ async function runCommand(rawOpts) {
|
|
|
118702
118976
|
}
|
|
118703
118977
|
const viewports = opts.viewports.split(",").map((s) => s.trim());
|
|
118704
118978
|
const failOn = opts.failOn.split(",").map((s) => s.trim()).filter(Boolean);
|
|
118705
|
-
|
|
118979
|
+
let explicitForGolden = null;
|
|
118980
|
+
if (goldenRec) {
|
|
118981
|
+
try {
|
|
118982
|
+
explicitForGolden = resolveExplicitPages(opts.pagesFile, opts.pages);
|
|
118983
|
+
} catch (err) {
|
|
118984
|
+
console.error(chalk34.red(` ${err.message}`));
|
|
118985
|
+
return 2;
|
|
118986
|
+
}
|
|
118987
|
+
}
|
|
118988
|
+
const goldenPlan = goldenRec ? planGoldenRun(goldenRec, {
|
|
118989
|
+
prod: userProd,
|
|
118990
|
+
viewports,
|
|
118991
|
+
checkNames: hasSelection ? selection.checkNames : undefined,
|
|
118992
|
+
flows,
|
|
118993
|
+
explicitPages: explicitForGolden,
|
|
118994
|
+
visualPagesLimit: resolveVisualPagesLimit(opts, explicitForGolden?.length ?? null),
|
|
118995
|
+
vitalsPagesLimit: opts.vitalsPages ?? (isLocalhost(opts.cand) ? 3 : 10)
|
|
118996
|
+
}) : undefined;
|
|
118997
|
+
if (goldenRec && goldenPlan) {
|
|
118998
|
+
if (goldenPlan.errors.length > 0) {
|
|
118999
|
+
console.error(chalk34.red(` --golden ${opts.golden}: cannot use this recording:`));
|
|
119000
|
+
for (const e of goldenPlan.errors)
|
|
119001
|
+
console.error(chalk34.red(` - ${e}`));
|
|
119002
|
+
return 2;
|
|
119003
|
+
}
|
|
119004
|
+
const age = goldenAge(goldenRec.meta.recordedAt);
|
|
119005
|
+
const line = ` prod: from golden ${opts.golden} (recorded ${goldenRec.meta.recordedAt}, ${age.text}) — prod is not captured by this run`;
|
|
119006
|
+
console.log(age.warn ? chalk34.yellow(`${line}; older than a week, prod may have moved`) : chalk34.dim(line));
|
|
119007
|
+
for (const w of goldenPlan.warnings)
|
|
119008
|
+
console.log(chalk34.yellow(` ! ${w}`));
|
|
119009
|
+
if (goldenRec.missingFiles.length > 0) {
|
|
119010
|
+
console.log(chalk34.yellow(` ! ${goldenRec.missingFiles.length} file(s) the golden references were missing when it was saved`));
|
|
119011
|
+
}
|
|
119012
|
+
}
|
|
119013
|
+
const rc = goldenRec ? structuredClone(goldenRec.ctx.rc) : loadParityRc();
|
|
118706
119014
|
rc.profile = profile;
|
|
118707
119015
|
rc.cep = isContentProfile ? "" : opts.cep || rc.cep;
|
|
118708
119016
|
if (typeof opts.addToCartTimeout === "number" && Number.isFinite(opts.addToCartTimeout)) {
|
|
@@ -118718,7 +119026,7 @@ async function runCommand(rawOpts) {
|
|
|
118718
119026
|
console.log(chalk34.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
|
|
118719
119027
|
}
|
|
118720
119028
|
const primaryViewport = viewports[0] ?? "mobile";
|
|
118721
|
-
const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport, pins);
|
|
119029
|
+
const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport, pins, Boolean(goldenRec));
|
|
118722
119030
|
if (!preflight.ok) {
|
|
118723
119031
|
console.error(chalk34.red(`
|
|
118724
119032
|
✖ pre-flight falhou:`));
|
|
@@ -118731,7 +119039,9 @@ async function runCommand(rawOpts) {
|
|
|
118731
119039
|
const learned = loadLearned();
|
|
118732
119040
|
const learnedBefore = JSON.stringify(learned);
|
|
118733
119041
|
let platform = "custom";
|
|
118734
|
-
const prodHomeHtml = earlyProdHtml ?? await fetchHomeHtml(opts.prod, primaryViewport, pinFetchHeaders(pins.prod));
|
|
119042
|
+
const prodHomeHtml = goldenRec ? null : earlyProdHtml ?? await fetchHomeHtml(opts.prod, primaryViewport, pinFetchHeaders(pins.prod));
|
|
119043
|
+
if (goldenRec)
|
|
119044
|
+
platform = goldenPlatform(goldenRec);
|
|
118735
119045
|
if (prodHomeHtml) {
|
|
118736
119046
|
platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
|
|
118737
119047
|
if (platform !== "custom") {
|
|
@@ -118741,7 +119051,7 @@ async function runCommand(rawOpts) {
|
|
|
118741
119051
|
const prodHost = hostOf4(opts.prod);
|
|
118742
119052
|
let promotedCount = 0;
|
|
118743
119053
|
let deprecatedCount = 0;
|
|
118744
|
-
const wantsAutoSelectors = opts.autoSelectors !== false && isLlmAvailable();
|
|
119054
|
+
const wantsAutoSelectors = opts.autoSelectors !== false && isLlmAvailable() && !goldenRec;
|
|
118745
119055
|
let discoveryBrowser = null;
|
|
118746
119056
|
if (wantsAutoSelectors) {
|
|
118747
119057
|
discoveryBrowser = await runSelectorDiscoveryPass({
|
|
@@ -118804,6 +119114,7 @@ async function runCommand(rawOpts) {
|
|
|
118804
119114
|
let currentPhase = "launch";
|
|
118805
119115
|
let shuttingDown = false;
|
|
118806
119116
|
const partialChecks = [];
|
|
119117
|
+
let goldenFetch;
|
|
118807
119118
|
const forceCloseBrowser = async (b, capMs) => {
|
|
118808
119119
|
if (!b)
|
|
118809
119120
|
return;
|
|
@@ -118879,8 +119190,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
118879
119190
|
if (opts.warmup) {
|
|
118880
119191
|
const warmupSpinner = ora8("Warmup: bustando cache em prod + cand…").start();
|
|
118881
119192
|
const result = await warmupTargets({
|
|
118882
|
-
urls: [opts.prod, opts.cand],
|
|
118883
|
-
headersFor: [pinFetchHeaders(pins.prod), pinFetchHeaders(pins.cand)],
|
|
119193
|
+
urls: goldenRec ? [opts.cand] : [opts.prod, opts.cand],
|
|
119194
|
+
headersFor: goldenRec ? [pinFetchHeaders(pins.cand)] : [pinFetchHeaders(pins.prod), pinFetchHeaders(pins.cand)],
|
|
118884
119195
|
viewports,
|
|
118885
119196
|
bypassCache: opts.bypassCache !== false
|
|
118886
119197
|
});
|
|
@@ -118895,11 +119206,12 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
118895
119206
|
}
|
|
118896
119207
|
}
|
|
118897
119208
|
const traceEnabled = process.env.PARITY_TRACE === "1";
|
|
119209
|
+
const liveSides = goldenRec ? ["cand"] : ["prod", "cand"];
|
|
118898
119210
|
const runOneSide = async (viewport, side) => {
|
|
118899
119211
|
const baseUrl = side === "prod" ? opts.prod : opts.cand;
|
|
118900
119212
|
const harEnabled = process.env.PARITY_HAR === "1";
|
|
118901
|
-
const harPath = harEnabled ?
|
|
118902
|
-
const tracePath = traceEnabled ?
|
|
119213
|
+
const harPath = harEnabled ? join46(paths.harDir, `${viewport}-${side}.har`) : undefined;
|
|
119214
|
+
const tracePath = traceEnabled ? join46(paths.tracesDir, `${viewport}-${side}.zip`) : null;
|
|
118903
119215
|
const ctx = await newContext(browser, {
|
|
118904
119216
|
viewport,
|
|
118905
119217
|
harPath,
|
|
@@ -118976,7 +119288,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
118976
119288
|
};
|
|
118977
119289
|
const runOneViewport = async (viewport) => {
|
|
118978
119290
|
const [prodResult, candResult] = await Promise.all([
|
|
118979
|
-
runOneSide(viewport, "prod"),
|
|
119291
|
+
goldenRec ? { captures: [], pages: [] } : runOneSide(viewport, "prod"),
|
|
118980
119292
|
runOneSide(viewport, "cand")
|
|
118981
119293
|
]);
|
|
118982
119294
|
for (const r of [prodResult, candResult]) {
|
|
@@ -119025,7 +119337,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119025
119337
|
baseText: "Coletando vitals em páginas extras…"
|
|
119026
119338
|
});
|
|
119027
119339
|
try {
|
|
119028
|
-
const allUrls = await resolveSitemapUrls(opts.prod);
|
|
119340
|
+
const allUrls = goldenRec ? [] : await resolveSitemapUrls(opts.prod);
|
|
119029
119341
|
const visitedPaths = new Set;
|
|
119030
119342
|
for (const p of allPageCaptures) {
|
|
119031
119343
|
try {
|
|
@@ -119047,7 +119359,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119047
119359
|
arr.push(p);
|
|
119048
119360
|
buckets.set(seg, arr);
|
|
119049
119361
|
}
|
|
119050
|
-
const extraPaths = [];
|
|
119362
|
+
const extraPaths = goldenPlan ? [...goldenPlan.extraPaths] : [];
|
|
119051
119363
|
const keys = [...buckets.keys()];
|
|
119052
119364
|
let idx = 0;
|
|
119053
119365
|
while (extraPaths.length < vitalsPagesLimit && keys.some((k) => (buckets.get(k)?.length ?? 0) > 0)) {
|
|
@@ -119063,7 +119375,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119063
119375
|
const tasks = [];
|
|
119064
119376
|
for (const viewport of mobileOnly) {
|
|
119065
119377
|
for (const path of extraPaths) {
|
|
119066
|
-
for (const side of
|
|
119378
|
+
for (const side of liveSides) {
|
|
119067
119379
|
tasks.push({ path, viewport, side });
|
|
119068
119380
|
}
|
|
119069
119381
|
}
|
|
@@ -119112,6 +119424,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119112
119424
|
if (!cap) {
|
|
119113
119425
|
return;
|
|
119114
119426
|
}
|
|
119427
|
+
cap.pass = "extra";
|
|
119115
119428
|
allPageCaptures.push(cap);
|
|
119116
119429
|
allFlowCaptures.push({
|
|
119117
119430
|
flow: "homepage",
|
|
@@ -119158,11 +119471,11 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119158
119471
|
baseText: visualSpinnerBaseText
|
|
119159
119472
|
});
|
|
119160
119473
|
try {
|
|
119161
|
-
const visualPaths = explicitPaths ?? (await discoverPagesFromSitemap(opts.prod, { sampleSize: visualPagesLimit })).all.map((p) => ({ prod: p.path, cand: p.path }));
|
|
119474
|
+
const visualPaths = explicitPaths ?? (goldenPlan ? goldenPlan.visualPaths : (await discoverPagesFromSitemap(opts.prod, { sampleSize: visualPagesLimit })).all.map((p) => ({ prod: p.path, cand: p.path })));
|
|
119162
119475
|
const tasks = [];
|
|
119163
119476
|
for (const viewport of viewports) {
|
|
119164
119477
|
for (const pair of visualPaths) {
|
|
119165
|
-
for (const side of
|
|
119478
|
+
for (const side of liveSides) {
|
|
119166
119479
|
tasks.push({
|
|
119167
119480
|
path: side === "prod" ? pair.prod : pair.cand,
|
|
119168
119481
|
pairKey: pair.prod,
|
|
@@ -119206,8 +119519,9 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119206
119519
|
scrollToLoad: true,
|
|
119207
119520
|
pairKey: task.pairKey
|
|
119208
119521
|
});
|
|
119522
|
+
cap.pass = "visual";
|
|
119209
119523
|
allPageCaptures.push(cap);
|
|
119210
|
-
if (
|
|
119524
|
+
if (existsSync31(screenshotPath)) {
|
|
119211
119525
|
visualProbes.set(screenshotPath, await probeFullPage(page, screenshotPath, task.side === "prod" ? screenshotPath.replace(/\.png$/, "-repeat.png") : null));
|
|
119212
119526
|
}
|
|
119213
119527
|
} finally {
|
|
@@ -119238,6 +119552,18 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119238
119552
|
const w = vitalsWarm.stats;
|
|
119239
119553
|
console.log(chalk34.dim(` vitals warm-up: ${w.pages} page(s), ${w.loads} load(s)${w.failed ? `, ${w.failed} failed` : ""}, +${(w.totalMs / 1000).toFixed(1)}s summed across captures`));
|
|
119240
119554
|
}
|
|
119555
|
+
if (goldenRec && goldenPlan) {
|
|
119556
|
+
const merged = mergeGoldenContext(goldenRec, goldenPlan, {
|
|
119557
|
+
pages: allPageCaptures,
|
|
119558
|
+
flows: allFlowCaptures,
|
|
119559
|
+
visualProbes: visualPagesLimit > 0 ? visualProbes : undefined
|
|
119560
|
+
}, makeRelocator(paths.screenshotsDir));
|
|
119561
|
+
allPageCaptures.splice(0, allPageCaptures.length, ...merged.pages);
|
|
119562
|
+
allFlowCaptures.splice(0, allFlowCaptures.length, ...merged.flows);
|
|
119563
|
+
visualProbes.clear();
|
|
119564
|
+
for (const [k, v] of merged.visualProbes ?? [])
|
|
119565
|
+
visualProbes.set(k, v);
|
|
119566
|
+
}
|
|
119241
119567
|
currentPhase = "checks";
|
|
119242
119568
|
setSpinnerLabel("Rodando checks…");
|
|
119243
119569
|
spinner.start();
|
|
@@ -119255,13 +119581,15 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119255
119581
|
candIsProduction: opts.candIsProduction
|
|
119256
119582
|
};
|
|
119257
119583
|
let recordedOk = false;
|
|
119584
|
+
let goldenStale = [];
|
|
119258
119585
|
if (opts.record) {
|
|
119259
119586
|
try {
|
|
119260
119587
|
saveCheckContext(opts.record, checkCtx, {
|
|
119261
119588
|
prodUrl: opts.prod,
|
|
119262
119589
|
candUrl: opts.cand,
|
|
119263
119590
|
parityVersion: getPackageVersion(),
|
|
119264
|
-
checkNames: hasSelection ? [...selection.checkNames] : undefined
|
|
119591
|
+
checkNames: hasSelection ? [...selection.checkNames] : undefined,
|
|
119592
|
+
platform
|
|
119265
119593
|
});
|
|
119266
119594
|
recordedOk = true;
|
|
119267
119595
|
} catch (err) {
|
|
@@ -119269,6 +119597,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119269
119597
|
}
|
|
119270
119598
|
}
|
|
119271
119599
|
const runChecks = () => runAllChecks(checkCtx, partialChecks, hasSelection ? selection.checkNames : undefined);
|
|
119600
|
+
goldenFetch = goldenRec ? installGoldenFetch(goldenRec.fetchLog, new URL(opts.prod).origin) : undefined;
|
|
119272
119601
|
let checks;
|
|
119273
119602
|
if (recordedOk && opts.record) {
|
|
119274
119603
|
const { result, log } = await recordFetch(runChecks);
|
|
@@ -119282,6 +119611,10 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119282
119611
|
} else {
|
|
119283
119612
|
checks = await runChecks();
|
|
119284
119613
|
}
|
|
119614
|
+
if (goldenFetch) {
|
|
119615
|
+
goldenStale = goldenFetch.stale();
|
|
119616
|
+
goldenFetch.restore();
|
|
119617
|
+
}
|
|
119285
119618
|
checksHb.stop();
|
|
119286
119619
|
stampPhase("checks");
|
|
119287
119620
|
spinner.succeed(`Checks concluídos (${checks.length})`);
|
|
@@ -119393,7 +119726,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119393
119726
|
prodPinned: !isEmptyPin(pins.prod)
|
|
119394
119727
|
})),
|
|
119395
119728
|
pinned: isEmptyPin(pins.prod) && isEmptyPin(pins.cand) ? undefined : { prod: pinNames(pins.prod), cand: pinNames(pins.cand) },
|
|
119396
|
-
pagePairs
|
|
119729
|
+
pagePairs,
|
|
119730
|
+
golden: goldenRec ? goldenReportField(resolve21(opts.golden), goldenRec.meta, goldenStale) : undefined
|
|
119397
119731
|
};
|
|
119398
119732
|
const reportStart = performance.now();
|
|
119399
119733
|
const reportWhere = writeRunReport(paths, run, Boolean(opts.html || opts.open));
|
|
@@ -119411,6 +119745,11 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
119411
119745
|
verdict: { status: verdict.status, score: verdict.score, scoreVersion: SCORE_VERSION }
|
|
119412
119746
|
});
|
|
119413
119747
|
printSummary8(run, reportWhere, { promotedCount, deprecatedCount, platform });
|
|
119748
|
+
if (run.golden) {
|
|
119749
|
+
const age = goldenAge(run.golden.recordedAt);
|
|
119750
|
+
const say = age.warn ? chalk34.yellow : chalk34.dim;
|
|
119751
|
+
console.log(say(` prod from golden ${run.golden.dir} (${age.text}); prod was not recaptured`));
|
|
119752
|
+
}
|
|
119414
119753
|
console.log(`
|
|
119415
119754
|
${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
|
|
119416
119755
|
if (pagePairs) {
|
|
@@ -119429,6 +119768,11 @@ ${formatPagePairTable(pagePairs)}`);
|
|
|
119429
119768
|
console.log(chalk34.red(failOnGate.message));
|
|
119430
119769
|
return 1;
|
|
119431
119770
|
}
|
|
119771
|
+
if (goldenStale.length > 0) {
|
|
119772
|
+
console.log(chalk34.red(`
|
|
119773
|
+
✖ golden is stale for: ${goldenStale.join(", ")} — a check asked prod for something the recording never saw, so its result rests on no data; record a new golden (report.json golden.staleRequests)`));
|
|
119774
|
+
return 2;
|
|
119775
|
+
}
|
|
119432
119776
|
if (opts.open) {
|
|
119433
119777
|
const { default: open } = await import("open");
|
|
119434
119778
|
await open(paths.reportHtml).catch(() => {
|
|
@@ -119451,6 +119795,7 @@ ${formatPagePairTable(pagePairs)}`);
|
|
|
119451
119795
|
clearTimeout(globalTimeoutTimer);
|
|
119452
119796
|
process.removeListener("SIGINT", onSignal);
|
|
119453
119797
|
process.removeListener("SIGTERM", onSignal);
|
|
119798
|
+
goldenFetch?.restore();
|
|
119454
119799
|
if (browser)
|
|
119455
119800
|
await browser.close().catch(() => {
|
|
119456
119801
|
return;
|
|
@@ -119517,7 +119862,7 @@ function parsePagePair(entry) {
|
|
|
119517
119862
|
}
|
|
119518
119863
|
function resolveExplicitPages(pagesFile, pagesList) {
|
|
119519
119864
|
if (pagesFile) {
|
|
119520
|
-
if (!
|
|
119865
|
+
if (!existsSync31(pagesFile)) {
|
|
119521
119866
|
throw new Error(`--pages-file não encontrado: ${pagesFile}`);
|
|
119522
119867
|
}
|
|
119523
119868
|
const raw = readFileSync39(pagesFile, "utf-8");
|
|
@@ -119612,7 +119957,7 @@ async function runWithConcurrency2(items, workers, fn) {
|
|
|
119612
119957
|
}
|
|
119613
119958
|
}));
|
|
119614
119959
|
}
|
|
119615
|
-
async function preflightCheck(prodUrl, candUrl, viewport, pins) {
|
|
119960
|
+
async function preflightCheck(prodUrl, candUrl, viewport, pins, skipProd = false) {
|
|
119616
119961
|
const spinner = ora8("Pre-flight: verificando URLs…").start();
|
|
119617
119962
|
const errors = [];
|
|
119618
119963
|
const ua = userAgentFor(viewport);
|
|
@@ -119677,7 +120022,7 @@ async function preflightCheck(prodUrl, candUrl, viewport, pins) {
|
|
|
119677
120022
|
await probeWithFetch(label, url);
|
|
119678
120023
|
}
|
|
119679
120024
|
}
|
|
119680
|
-
await Promise.all([probe("prod", prodUrl), probe("cand", candUrl)]);
|
|
120025
|
+
await Promise.all([skipProd ? undefined : probe("prod", prodUrl), probe("cand", candUrl)]);
|
|
119681
120026
|
await browser?.close().catch(() => {});
|
|
119682
120027
|
if (errors.length > 0) {
|
|
119683
120028
|
spinner.fail("Pre-flight falhou");
|
|
@@ -119853,8 +120198,8 @@ async function prCommand(opts) {
|
|
|
119853
120198
|
return runCode || 1;
|
|
119854
120199
|
}
|
|
119855
120200
|
const latest = runs[0];
|
|
119856
|
-
const reportJsonPath =
|
|
119857
|
-
if (!
|
|
120201
|
+
const reportJsonPath = join47(opts.output, "runs", latest.id, "report.json");
|
|
120202
|
+
if (!existsSync32(reportJsonPath)) {
|
|
119858
120203
|
console.error(chalk35.red(`report.json not found at ${reportJsonPath}`));
|
|
119859
120204
|
return runCode || 1;
|
|
119860
120205
|
}
|
|
@@ -119938,7 +120283,7 @@ function moduleTableLines(run) {
|
|
|
119938
120283
|
}
|
|
119939
120284
|
|
|
119940
120285
|
// src/commands/prompt.ts
|
|
119941
|
-
import { existsSync as
|
|
120286
|
+
import { existsSync as existsSync33, writeFileSync as writeFileSync34 } from "node:fs";
|
|
119942
120287
|
import chalk36 from "chalk";
|
|
119943
120288
|
|
|
119944
120289
|
// src/report/prompt-builder.ts
|
|
@@ -120066,7 +120411,7 @@ function promptCommand(runId, opts) {
|
|
|
120066
120411
|
if (opts.out) {
|
|
120067
120412
|
writeFileSync34(opts.out, md, "utf8");
|
|
120068
120413
|
console.log(chalk36.green(`✔ prompt salvo em ${opts.out}`));
|
|
120069
|
-
if (
|
|
120414
|
+
if (existsSync33(opts.out)) {
|
|
120070
120415
|
const sizeKb = (md.length / 1024).toFixed(1);
|
|
120071
120416
|
console.log(chalk36.dim(` ${md.length} chars (${sizeKb} KB)`));
|
|
120072
120417
|
}
|
|
@@ -120077,12 +120422,12 @@ function promptCommand(runId, opts) {
|
|
|
120077
120422
|
}
|
|
120078
120423
|
|
|
120079
120424
|
// src/commands/qa.ts
|
|
120080
|
-
import { existsSync as
|
|
120081
|
-
import { basename as
|
|
120425
|
+
import { existsSync as existsSync37, readFileSync as readFileSync43 } from "node:fs";
|
|
120426
|
+
import { basename as basename7, dirname as dirname10, join as join51 } from "node:path";
|
|
120082
120427
|
import chalk38 from "chalk";
|
|
120083
120428
|
|
|
120084
120429
|
// src/board/sweep-cards.ts
|
|
120085
|
-
import { existsSync as
|
|
120430
|
+
import { existsSync as existsSync34, readFileSync as readFileSync41 } from "node:fs";
|
|
120086
120431
|
var QA_PREFIX = "[QA]";
|
|
120087
120432
|
var CARD_BODY_MAX = 1200;
|
|
120088
120433
|
var CLOSED = new Set(["done", "archived", "merged"]);
|
|
@@ -120409,7 +120754,7 @@ function readSpecs(entries) {
|
|
|
120409
120754
|
const out = {};
|
|
120410
120755
|
for (const e of entries)
|
|
120411
120756
|
for (const ev of e.issue?.evidence ?? [])
|
|
120412
|
-
if (ev.kind === "spec" &&
|
|
120757
|
+
if (ev.kind === "spec" && existsSync34(ev.path))
|
|
120413
120758
|
out[ev.path] = readFileSync41(ev.path, "utf8");
|
|
120414
120759
|
return out;
|
|
120415
120760
|
}
|
|
@@ -120434,7 +120779,7 @@ function plannedEvidenceUrls(entries, run, cfg) {
|
|
|
120434
120779
|
return {};
|
|
120435
120780
|
const out = {};
|
|
120436
120781
|
for (const p of cardEvidencePaths(entries))
|
|
120437
|
-
if (
|
|
120782
|
+
if (existsSync34(p))
|
|
120438
120783
|
out[p] = `${base}/fs/org/read?path=${encodeURIComponent(evidenceLibraryPath(p, run))}`;
|
|
120439
120784
|
return out;
|
|
120440
120785
|
}
|
|
@@ -120442,7 +120787,7 @@ async function uploadEvidence(entries, run, cfg, call, opts) {
|
|
|
120442
120787
|
const upload = opts.upload ?? ((local, lib) => uploadToLibrary(cfg, local, lib, call));
|
|
120443
120788
|
const out = {};
|
|
120444
120789
|
for (const p of cardEvidencePaths(entries)) {
|
|
120445
|
-
if (!
|
|
120790
|
+
if (!existsSync34(p))
|
|
120446
120791
|
continue;
|
|
120447
120792
|
const url = await upload(p, evidenceLibraryPath(p, run));
|
|
120448
120793
|
if (url)
|
|
@@ -120458,8 +120803,8 @@ function truncate6(s, n) {
|
|
|
120458
120803
|
}
|
|
120459
120804
|
|
|
120460
120805
|
// src/commands/sweep.ts
|
|
120461
|
-
import { existsSync as
|
|
120462
|
-
import { join as
|
|
120806
|
+
import { existsSync as existsSync36, readFileSync as readFileSync42, writeFileSync as writeFileSync35 } from "node:fs";
|
|
120807
|
+
import { join as join50 } from "node:path";
|
|
120463
120808
|
import chalk37 from "chalk";
|
|
120464
120809
|
import { z as z5 } from "zod";
|
|
120465
120810
|
|
|
@@ -120807,7 +121152,7 @@ function a11yIssues(results) {
|
|
|
120807
121152
|
}
|
|
120808
121153
|
|
|
120809
121154
|
// src/engine/menu-audit.ts
|
|
120810
|
-
import { join as
|
|
121155
|
+
import { join as join48 } from "node:path";
|
|
120811
121156
|
var MAX_LINKS = 40;
|
|
120812
121157
|
async function collectLinks(page, origin, scope) {
|
|
120813
121158
|
const raw = await page.evaluate((sel) => {
|
|
@@ -120936,7 +121281,7 @@ async function probeMenuLinks(url, opts = {}) {
|
|
|
120936
121281
|
try {
|
|
120937
121282
|
for (const link of [...links.values()].slice(0, MAX_LINKS)) {
|
|
120938
121283
|
const slug = new URL(link.href).pathname.replace(/[^a-z0-9]+/gi, "-").replace(/^-|-$/g, "");
|
|
120939
|
-
const shot = opts.screenshotsDir ?
|
|
121284
|
+
const shot = opts.screenshotsDir ? join48(opts.screenshotsDir, `menu-${slug || "root"}.jpg`) : undefined;
|
|
120940
121285
|
out.push(await visit(page, link, shot));
|
|
120941
121286
|
}
|
|
120942
121287
|
} finally {
|
|
@@ -121023,21 +121368,21 @@ function menuLinkIssues(visits) {
|
|
|
121023
121368
|
|
|
121024
121369
|
// src/engine/regression-specs.ts
|
|
121025
121370
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
121026
|
-
import { existsSync as
|
|
121027
|
-
import { join as
|
|
121371
|
+
import { existsSync as existsSync35 } from "node:fs";
|
|
121372
|
+
import { join as join49, resolve as resolve22 } from "node:path";
|
|
121028
121373
|
import { stripVTControlCharacters } from "node:util";
|
|
121029
121374
|
function runRegressionSpecs(repoDirArg, baseUrl) {
|
|
121030
|
-
const repoDir =
|
|
121031
|
-
const dir =
|
|
121032
|
-
if (!
|
|
121375
|
+
const repoDir = resolve22(repoDirArg);
|
|
121376
|
+
const dir = join49(repoDir, "tests", "qa");
|
|
121377
|
+
if (!existsSync35(dir))
|
|
121033
121378
|
return null;
|
|
121034
121379
|
spawnSync2("npx", ["playwright", "install", "chromium"], {
|
|
121035
121380
|
cwd: repoDir,
|
|
121036
121381
|
encoding: "utf8",
|
|
121037
121382
|
timeout: 10 * 60000
|
|
121038
121383
|
});
|
|
121039
|
-
const config =
|
|
121040
|
-
const args =
|
|
121384
|
+
const config = join49(dir, "playwright.config.ts");
|
|
121385
|
+
const args = existsSync35(config) ? ["playwright", "test", "-c", config, "--reporter=json"] : ["playwright", "test", "tests/qa", "--reporter=json"];
|
|
121041
121386
|
const res = spawnSync2("npx", args, {
|
|
121042
121387
|
cwd: repoDir,
|
|
121043
121388
|
env: { ...process.env, BASE_URL: baseUrl, CI: "1" },
|
|
@@ -121275,8 +121620,8 @@ async function addProbeFindings(url, runDir, reportJson, rc, json, specsRepo) {
|
|
|
121275
121620
|
{ label: "busca", selectors: selectorsFor("searchTrigger", { rc }) },
|
|
121276
121621
|
{ label: "menu", selectors: HAMBURGER_SELECTORS }
|
|
121277
121622
|
]).catch(() => []);
|
|
121278
|
-
const menu = await probeMenuLinks(url, { screenshotsDir:
|
|
121279
|
-
writeFileSync35(
|
|
121623
|
+
const menu = await probeMenuLinks(url, { screenshotsDir: join50(runDir, "screenshots") }).catch(() => []);
|
|
121624
|
+
writeFileSync35(join50(runDir, "menu-links.json"), `${JSON.stringify(menu, null, 2)}
|
|
121280
121625
|
`, "utf8");
|
|
121281
121626
|
const listing = menu.find((v) => v.listingUi && v.products > 0);
|
|
121282
121627
|
const a11y = await probeA11y(url, listing ? new URL(listing.link.href).pathname : undefined).catch(() => []);
|
|
@@ -121334,8 +121679,8 @@ function readUnverified(reportJson) {
|
|
|
121334
121679
|
var SEVERITIES = ["critical", "high", "medium", "low"];
|
|
121335
121680
|
var SWEEPER_ISSUES_FILE = "sweeper-issues.json";
|
|
121336
121681
|
function readSweeperIssues(runDir) {
|
|
121337
|
-
const path =
|
|
121338
|
-
if (!
|
|
121682
|
+
const path = join50(runDir, SWEEPER_ISSUES_FILE);
|
|
121683
|
+
if (!existsSync36(path))
|
|
121339
121684
|
return { issues: [], dropped: new Set };
|
|
121340
121685
|
const parsed = z5.object({
|
|
121341
121686
|
issues: agentIssues,
|
|
@@ -121362,8 +121707,8 @@ function normalizeAgentIssue(raw) {
|
|
|
121362
121707
|
}
|
|
121363
121708
|
var agentIssues = z5.preprocess((v) => Array.isArray(v) ? v.map(normalizeAgentIssue) : v, z5.array(Issue).default([]));
|
|
121364
121709
|
function readCardReview(runDir) {
|
|
121365
|
-
const path =
|
|
121366
|
-
if (!
|
|
121710
|
+
const path = join50(runDir, CARD_REVIEW_FILE);
|
|
121711
|
+
if (!existsSync36(path))
|
|
121367
121712
|
return { issues: [], hold: new Map };
|
|
121368
121713
|
const parsed = z5.object({
|
|
121369
121714
|
issues: agentIssues,
|
|
@@ -121425,12 +121770,12 @@ async function sweepFileCommand(opts) {
|
|
|
121425
121770
|
for (const i of agent.issues)
|
|
121426
121771
|
for (const e of i.evidence ?? [])
|
|
121427
121772
|
if (!e.path.startsWith("/"))
|
|
121428
|
-
e.path =
|
|
121773
|
+
e.path = join50(paths.runDir, e.path);
|
|
121429
121774
|
const review = readCardReview(paths.runDir);
|
|
121430
121775
|
for (const i of review.issues)
|
|
121431
121776
|
for (const e of i.evidence ?? [])
|
|
121432
121777
|
if (!e.path.startsWith("/"))
|
|
121433
|
-
e.path =
|
|
121778
|
+
e.path = join50(paths.runDir, e.path);
|
|
121434
121779
|
const { issues, held } = applyCardReview(mergeIssues(report.allIssues ?? [], agent.issues, agent.dropped), review);
|
|
121435
121780
|
const info = {
|
|
121436
121781
|
runId,
|
|
@@ -121569,7 +121914,7 @@ async function qaFileCommand(opts) {
|
|
|
121569
121914
|
console.error(chalk38.red(`--min-severity ${opts.minSeverity}: use ${SEVERITIES2.join("|")}`));
|
|
121570
121915
|
return 2;
|
|
121571
121916
|
}
|
|
121572
|
-
if (!
|
|
121917
|
+
if (!existsSync37(opts.issues)) {
|
|
121573
121918
|
console.error(chalk38.red(`${opts.issues}: not found`));
|
|
121574
121919
|
return 2;
|
|
121575
121920
|
}
|
|
@@ -121584,7 +121929,7 @@ async function qaFileCommand(opts) {
|
|
|
121584
121929
|
for (const i of [...parsed.data, ...review.issues])
|
|
121585
121930
|
for (const e of i.evidence ?? [])
|
|
121586
121931
|
if (!e.path.startsWith("/"))
|
|
121587
|
-
e.path =
|
|
121932
|
+
e.path = join51(dir, e.path);
|
|
121588
121933
|
const { issues, held } = applyCardReview(parsed.data, review);
|
|
121589
121934
|
const cfg = studioConfigFromEnv();
|
|
121590
121935
|
if (!cfg) {
|
|
@@ -121592,7 +121937,7 @@ async function qaFileCommand(opts) {
|
|
|
121592
121937
|
return 2;
|
|
121593
121938
|
}
|
|
121594
121939
|
const info = {
|
|
121595
|
-
runId:
|
|
121940
|
+
runId: basename7(opts.issues).replace(/\.json$/, ""),
|
|
121596
121941
|
source: "parity qa",
|
|
121597
121942
|
url: opts.url,
|
|
121598
121943
|
timestamp: new Date().toISOString(),
|
|
@@ -121639,8 +121984,8 @@ async function qaFileCommand(opts) {
|
|
|
121639
121984
|
}
|
|
121640
121985
|
|
|
121641
121986
|
// src/commands/report.ts
|
|
121642
|
-
import { existsSync as
|
|
121643
|
-
import { join as
|
|
121987
|
+
import { existsSync as existsSync38, readFileSync as readFileSync44, writeFileSync as writeFileSync36 } from "node:fs";
|
|
121988
|
+
import { join as join52, resolve as resolve23 } from "node:path";
|
|
121644
121989
|
import chalk39 from "chalk";
|
|
121645
121990
|
import open3 from "open";
|
|
121646
121991
|
|
|
@@ -122291,12 +122636,12 @@ var REMOVED_SECTIONS = {
|
|
|
122291
122636
|
prompt: "use `parity prompt <runId>` for the LLM-ready Markdown."
|
|
122292
122637
|
};
|
|
122293
122638
|
function resolveRunPaths(output, runIdOrDir) {
|
|
122294
|
-
if (
|
|
122295
|
-
return runPathsFor(
|
|
122639
|
+
if (existsSync38(join52(runIdOrDir, "report.json")))
|
|
122640
|
+
return runPathsFor(resolve23(runIdOrDir));
|
|
122296
122641
|
return getRunPaths(output, runIdOrDir);
|
|
122297
122642
|
}
|
|
122298
122643
|
function ensureReportHtml(paths) {
|
|
122299
|
-
if (
|
|
122644
|
+
if (existsSync38(paths.reportHtml))
|
|
122300
122645
|
return { path: paths.reportHtml, rendered: false };
|
|
122301
122646
|
const run = loadRunDir(paths.runDir);
|
|
122302
122647
|
writeRunReportHtml(paths.runDir, renderHtmlReport(run, paths.runDir));
|
|
@@ -122326,7 +122671,7 @@ async function reportCommand(runId, opts) {
|
|
|
122326
122671
|
}
|
|
122327
122672
|
}
|
|
122328
122673
|
const html = renderDeckHtml(buildDeckModel(run, plan), opts.lang ?? "en");
|
|
122329
|
-
const dest = opts.out ??
|
|
122674
|
+
const dest = opts.out ?? join52(paths.runDir, "deck.html");
|
|
122330
122675
|
writeFileSync36(dest, html, "utf8");
|
|
122331
122676
|
console.log(`${chalk39.green("✓")} deck → ${dest}`);
|
|
122332
122677
|
if (opts.open) {
|
|
@@ -122669,8 +123014,8 @@ async function rerenderCommand(opts) {
|
|
|
122669
123014
|
import chalk41 from "chalk";
|
|
122670
123015
|
|
|
122671
123016
|
// src/replay/outcome.ts
|
|
122672
|
-
import { existsSync as
|
|
122673
|
-
import { join as
|
|
123017
|
+
import { existsSync as existsSync39, readFileSync as readFileSync45, writeFileSync as writeFileSync38 } from "node:fs";
|
|
123018
|
+
import { join as join53 } from "node:path";
|
|
122674
123019
|
import { z as z6 } from "zod";
|
|
122675
123020
|
var EXPECTED_FILE = "expected.json";
|
|
122676
123021
|
var ReplayOutcome = z6.object({
|
|
@@ -122694,14 +123039,14 @@ function buildOutcome(checks, issues, verdict, parityVersion) {
|
|
|
122694
123039
|
};
|
|
122695
123040
|
}
|
|
122696
123041
|
function readExpected(dir) {
|
|
122697
|
-
const file =
|
|
122698
|
-
if (!
|
|
123042
|
+
const file = join53(dir, EXPECTED_FILE);
|
|
123043
|
+
if (!existsSync39(file))
|
|
122699
123044
|
throw new Error(`${file} not found (record the expectation with --update-expected)`);
|
|
122700
123045
|
return ReplayOutcome.parse(JSON.parse(readFileSync45(file, "utf8")));
|
|
122701
123046
|
}
|
|
122702
123047
|
function writeExpected(dir, outcome) {
|
|
122703
|
-
const file =
|
|
122704
|
-
const notes =
|
|
123048
|
+
const file = join53(dir, EXPECTED_FILE);
|
|
123049
|
+
const notes = existsSync39(file) ? readExpected(dir).notes : undefined;
|
|
122705
123050
|
const { notes: _drop, ...rest } = outcome;
|
|
122706
123051
|
writeFileSync38(file, `${JSON.stringify({ ...rest, ...notes !== undefined ? { notes } : {} }, null, 2)}
|
|
122707
123052
|
`, "utf8");
|
|
@@ -122739,9 +123084,9 @@ function formatDiff(d) {
|
|
|
122739
123084
|
}
|
|
122740
123085
|
|
|
122741
123086
|
// src/replay/replay.ts
|
|
122742
|
-
import { mkdirSync as
|
|
123087
|
+
import { mkdirSync as mkdirSync25, mkdtempSync as mkdtempSync2, rmSync as rmSync6 } from "node:fs";
|
|
122743
123088
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
122744
|
-
import { join as
|
|
123089
|
+
import { join as join54 } from "node:path";
|
|
122745
123090
|
class NothingToJudgeError extends Error {
|
|
122746
123091
|
name = "NothingToJudgeError";
|
|
122747
123092
|
}
|
|
@@ -122753,8 +123098,8 @@ async function replayRecording(dir, opts = {}) {
|
|
|
122753
123098
|
throw new NothingToJudgeError(`nothing was compared: ${dir} holds no page pairs and no flows`);
|
|
122754
123099
|
}
|
|
122755
123100
|
const ownsOutDir = opts.outDir === undefined;
|
|
122756
|
-
const outDir = opts.outDir ?? mkdtempSync2(
|
|
122757
|
-
|
|
123101
|
+
const outDir = opts.outDir ?? mkdtempSync2(join54(tmpdir3(), "parity-replay-"));
|
|
123102
|
+
mkdirSync25(outDir, { recursive: true });
|
|
122758
123103
|
const ctx = { ...rec.ctx, outDir };
|
|
122759
123104
|
const unrecorded = new Set;
|
|
122760
123105
|
const restore = replayFetch(rec.fetchLog);
|
|
@@ -122871,7 +123216,7 @@ async function replayCommand(dir, opts) {
|
|
|
122871
123216
|
}
|
|
122872
123217
|
|
|
122873
123218
|
// src/commands/serve.ts
|
|
122874
|
-
import { existsSync as
|
|
123219
|
+
import { existsSync as existsSync40 } from "node:fs";
|
|
122875
123220
|
import chalk42 from "chalk";
|
|
122876
123221
|
async function serveRunAndBlock(runDir, opts = {}) {
|
|
122877
123222
|
let handle;
|
|
@@ -122919,7 +123264,7 @@ async function serveRunAndBlock(runDir, opts = {}) {
|
|
|
122919
123264
|
}
|
|
122920
123265
|
async function serveCommand(runId, opts) {
|
|
122921
123266
|
const paths = getRunPaths(opts.output, runId);
|
|
122922
|
-
if (!
|
|
123267
|
+
if (!existsSync40(paths.runDir)) {
|
|
122923
123268
|
console.error(chalk42.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
|
|
122924
123269
|
return 1;
|
|
122925
123270
|
}
|
|
@@ -123792,8 +124137,8 @@ async function studioCommentCommand(opts, call = callTool2) {
|
|
|
123792
124137
|
|
|
123793
124138
|
// src/commands/drift.ts
|
|
123794
124139
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
123795
|
-
import { existsSync as
|
|
123796
|
-
import { resolve as
|
|
124140
|
+
import { existsSync as existsSync41, readFileSync as readFileSync46 } from "node:fs";
|
|
124141
|
+
import { resolve as resolve24 } from "node:path";
|
|
123797
124142
|
import chalk46 from "chalk";
|
|
123798
124143
|
var DRIFT_EXCLUDES = [":!.deco"];
|
|
123799
124144
|
var SHA_RE = /^[0-9a-f]{7,64}$/i;
|
|
@@ -123912,7 +124257,7 @@ function computeDrift(inputs, opts) {
|
|
|
123912
124257
|
const fail = (code, message) => ({ error: { code, message } });
|
|
123913
124258
|
if (headRef.startsWith("-"))
|
|
123914
124259
|
return fail("bad_head", `head "${headRef}" looks like a flag`);
|
|
123915
|
-
if (!
|
|
124260
|
+
if (!existsSync41(source))
|
|
123916
124261
|
return fail("not_a_repo", `${source} does not exist`);
|
|
123917
124262
|
const inside = git(source, ["rev-parse", "--is-inside-work-tree"]);
|
|
123918
124263
|
if (!inside.ok || inside.stdout.trim() !== "true") {
|
|
@@ -123980,7 +124325,7 @@ function computeDrift(inputs, opts) {
|
|
|
123980
124325
|
};
|
|
123981
124326
|
}
|
|
123982
124327
|
function loadState(path) {
|
|
123983
|
-
if (!
|
|
124328
|
+
if (!existsSync41(path))
|
|
123984
124329
|
return null;
|
|
123985
124330
|
try {
|
|
123986
124331
|
return JSON.parse(readFileSync46(path, "utf8"));
|
|
@@ -123991,7 +124336,7 @@ function loadState(path) {
|
|
|
123991
124336
|
function runDrift(flags) {
|
|
123992
124337
|
let state = null;
|
|
123993
124338
|
if (!(flags.source && flags.base)) {
|
|
123994
|
-
const loaded = loadState(
|
|
124339
|
+
const loaded = loadState(resolve24(flags.state ?? ".parity/migration.json"));
|
|
123995
124340
|
if (loaded && "error" in loaded)
|
|
123996
124341
|
return loaded;
|
|
123997
124342
|
state = loaded;
|
|
@@ -124160,9 +124505,9 @@ function varianceCommand(opts) {
|
|
|
124160
124505
|
}
|
|
124161
124506
|
|
|
124162
124507
|
// src/commands/vitals.ts
|
|
124163
|
-
import { existsSync as
|
|
124508
|
+
import { existsSync as existsSync42, readFileSync as readFileSync47, writeFileSync as writeFileSync39 } from "node:fs";
|
|
124164
124509
|
import { availableParallelism } from "node:os";
|
|
124165
|
-
import { join as
|
|
124510
|
+
import { join as join55 } from "node:path";
|
|
124166
124511
|
import chalk48 from "chalk";
|
|
124167
124512
|
import ora9 from "ora";
|
|
124168
124513
|
|
|
@@ -124211,7 +124556,7 @@ async function agenticNav(ctx) {
|
|
|
124211
124556
|
note: "no Lighthouse data (run without --no-lighthouse)"
|
|
124212
124557
|
});
|
|
124213
124558
|
}
|
|
124214
|
-
const candOrigin =
|
|
124559
|
+
const candOrigin = originOf3(ctx.candPages);
|
|
124215
124560
|
const llms = candOrigin ? await fetchLlmsTxtQuality(candOrigin) : null;
|
|
124216
124561
|
const llmsOk = !!llms?.wellFormed;
|
|
124217
124562
|
pillars.push({
|
|
@@ -124243,7 +124588,7 @@ async function agenticNav(ctx) {
|
|
|
124243
124588
|
data: { agentic: { passed, total: applicable.length, pillars } }
|
|
124244
124589
|
};
|
|
124245
124590
|
}
|
|
124246
|
-
function
|
|
124591
|
+
function originOf3(pages) {
|
|
124247
124592
|
for (const p of pages) {
|
|
124248
124593
|
try {
|
|
124249
124594
|
return new URL(p.url).origin;
|
|
@@ -124507,7 +124852,7 @@ async function vitalsCommand(opts) {
|
|
|
124507
124852
|
});
|
|
124508
124853
|
progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
|
|
124509
124854
|
if (opts.lighthouse !== false) {
|
|
124510
|
-
const lhDir =
|
|
124855
|
+
const lhDir = join55(paths.runDir, "lighthouse");
|
|
124511
124856
|
const lhCap = opts.lighthouseConcurrency ?? Math.max(1, Math.min(2, Math.floor(availableParallelism() / 2)));
|
|
124512
124857
|
const done = tasks.filter((t) => !!t.capture);
|
|
124513
124858
|
const lhT0 = Date.now();
|
|
@@ -124596,7 +124941,7 @@ async function vitalsCommand(opts) {
|
|
|
124596
124941
|
writeRunReportJson(paths.runDir, run);
|
|
124597
124942
|
const html = renderHtmlReport(run, paths.runDir);
|
|
124598
124943
|
writeRunReportHtml(paths.runDir, html);
|
|
124599
|
-
writeFileSync39(
|
|
124944
|
+
writeFileSync39(join55(paths.runDir, "vitals.json"), `${JSON.stringify({
|
|
124600
124945
|
schemaVersion: "0.1",
|
|
124601
124946
|
prodUrl: opts.prod,
|
|
124602
124947
|
candUrl: opts.cand,
|
|
@@ -124702,7 +125047,7 @@ async function discoverPagePaths2(prodUrl, opts) {
|
|
|
124702
125047
|
function parseUrlList(input) {
|
|
124703
125048
|
if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
|
|
124704
125049
|
const path = input.replace(/^file:\/\//, "");
|
|
124705
|
-
if (
|
|
125050
|
+
if (existsSync42(path)) {
|
|
124706
125051
|
return readFileSync47(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
|
|
124707
125052
|
}
|
|
124708
125053
|
}
|
|
@@ -124739,7 +125084,7 @@ program.command("run").description([
|
|
|
124739
125084
|
" visual-pages=5, auto-selectors=ON (if LLM), learn=ON, visual-diff=ON,",
|
|
124740
125085
|
" warmup=OFF, vitals warm=ON, bypass-cache=OFF, fail-on=critical (exit 1 if hit)."
|
|
124741
125086
|
].join(`
|
|
124742
|
-
`)).option("--prod <url>", "Production URL (source of truth, e.g. Fresh site). Omit for a single site — the run will point you to `parity e2e` (issue #141).").requiredOption("--cand <url>", "Candidate URL (migrated site, e.g. TanStack)").option("--preset <name>", "Bundle of defaults: smoke (fast, ~30s, no LLM) | full (deep audit) | ci (CI-tuned)").option("--flows <list>", "Comma-separated flows: homepage,plp,pdp,purchase-journey", "purchase-journey").option("--viewports <list>", "Comma-separated viewports: mobile,desktop", "mobile,desktop").option("--cep <cep>", "CEP for shipping calculation", "01310-100").option("--prod-cookie <name=value>", "Cookie set on every prod browser context and plain request; repeatable. Pins prod to one A/B variant (e.g. a Fresh-vs-TanStack bucket cookie) so the run does not compare whichever build each fresh context drew. Values are redacted in logs and report.json.", collectCookie, []).option("--cand-cookie <name=value>", "Same as --prod-cookie, for the candidate side", collectCookie, []).option("--prod-header <Name: value>", "Request header sent on every prod request (all origins — no credentials); repeatable. The header twin of --prod-cookie. Values are redacted in logs and report.json.", collectHeader, []).option("--cand-header <Name: value>", "Same as --prod-header, for the candidate side", collectHeader, []).option("--add-to-cart-timeout <ms>", "How long (ms) the add-to-cart step polls for a success signal before failing. Default 3000. Raise/lower to match your site's success-toast lifetime (issue #143).", (v) => Number(v)).option("--runs <n>", "Repeat each measurement N times (median)", "1").option("--baseline <name>", "Compare against a saved baseline").option("--output <dir>", "Output directory", "./parity-output").option("--fail-on <severities>", "Comma-separated severities that cause exit 1 (default: critical)", "critical").option("--html", "Also write report.html (off by default: render it later with `parity report <runId>`)", false).option("--open", "Write report.html and open it after the run completes (implies --html)", false).option("--no-auto-selectors", "Disable LLM-based selector discovery (uses defaults instead)").option("--refresh-selectors", "Bypass selector cache and re-run discovery", false).option("--no-learn", "Don't write to learned-selectors.json (read-only mode)").option("--vitals-pages <n>", "Extra pages from sitemap to crawl for Vitals coverage, beyond what --flows/--pages already cover (default 10). These are auto-sampled and can add significant unrelated noise to findings — pass 0 to scope the run to only the pages you explicitly requested.", (v) => Number(v), 10).option("--max-viewport-concurrency <n>", "How many viewports run concurrently during collect (default 2: mobile+desktop together). Set to 1 if you hit OOM with many viewports.", (v) => Number(v), 2).option("--visual-pages <n>", "Pages to compare visually with the heatmap engine — pixel diff + box-tree diff, no LLM (home + sampled PLPs/PDPs from sitemap, default 5)", (v) => Number(v), 5).option("--pages <list>", 'Comma-separated paths to compare visually (overrides sitemap discovery). E.g. "/,/account,/p/some-product". Use "prod->cand" for a page that lives at DIFFERENT paths on each side (partial migration), e.g. "/encimera-gc60/p->/ar-condicionado-12k/p". Use this when you want deterministic coverage instead of sampled. Scopes the visual-diff + vitals-extra-pages passes ONLY — the flows crawl (--flows, default purchase-journey) discovers its own target pages independently and ignores this flag. To scope which page(s) a flow visits, use --flows to pick a lighter flow and/or set the matching *UrlHint (e.g. plpUrlHint) in .parityrc.json. Issue #178.').option("--pages-file <path>", `Read paths to compare visually from a text file (one entry per line). Lines starting with # are ignored. Accepts the same "prod->cand" pair syntax as --pages. Overrides --pages when both are present. Same visual-diff/vitals-only scope as --pages — see that flag's help. Issue #178.`).option("--no-visual-diff", "Skip the visual diff capture pass entirely").option("--no-cache", "Deprecated, no effect (the visual verdict cache is gone).").option("--clear-cache", "Deprecated, no effect (the visual verdict cache is gone).", false).option("--bypass-cache", "Bypass CDN/edge caches AND the browser's own HTTP cache (CDP cache-disable), forcing a cold-visit fetch. Use right after a deploy to avoid false failures from stale CF edge content, or to approximate Lighthouse/CrUX-comparable TTFB/FCP/LCP numbers — without this flag, parity's vitals are a warm-connection/cache-enabled ('repeat visit') measurement, not a cold first-visit one, so they aren't directly comparable 1:1 to Lighthouse.", false).option("--warmup", "Before measurement, hit each target URL once (per viewport) with a cache-buster so the Worker serves a fresh response. Recommended after deploys.", false).option("--no-warm", "Don't warm each side's URL before measuring vitals. By default every vitals-measured page is loaded once on BOTH sides first, in a throwaway page (same device + cookies), so a cold edge/loader cache on whichever side hit the route first isn't reported as a Web Vitals or CLS regression. Ignored under --bypass-cache, which measures cold on purpose. Distinct from --warmup (a cache-busted homepage hit after a deploy).").option("--accept-prod-quirks", "Demote prod-side cart-empty journey failures (VTEX session quirk) from failed to skipped. The cart-reveal-mode-divergence check still emits critical if prod/cand markup intents differ, so this flag never masks a real regression. See issue #12.", false).option("--cand-is-production", "Cand is the final production domain, not a staging host. Disables staging detection (cand on another host with noindex everywhere), so noindex/nofollow on cand is critical and third-party origins missing on cand are high again.", false).option("--record <dir>", "Save the exact input the checks ran on (captures with full page HTML, resolved config, visual probes, screenshots, and the fetches the checks made) into <dir>, which must be new or empty. Contains full HTML and screenshots of both sites: do not commit it.").option("--llm-timeout <seconds>", "Deprecated, no effect: topIssues is ranked deterministically now, there is no LLM aggregation call to time out.").option("--keep-runs <n>", "After the run, delete all but the n newest runs of this prod/cand host pair under --output (other host pairs, runs without a readable report.json and baseline-referenced runs are never touched). 0 keeps everything. Default: 10.", (v) => Number(v), 10).option("--timeout <minutes>", "Hard wall-clock cap for the whole run (minutes). On expiry, parity writes a partial report and exits 130. Default: 30. Issue #56.", (v) => Number(v), 30).option("--flow <name>", "Alias for --flows when running a single flow (e.g. --flow cart). Issue #53.").option("--json <path|->", "Emit JSON-Lines (one line per check) to the given file path, or '-' for stdout. Schema versioned via leading metadata line. Issue #53.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Only affects LLM-generated content (issues, explain, prompts) — the static HTML report stays in English. Issue #67.").option("--llm <provider>", "Force LLM provider: anthropic | openrouter | claude-code | none. Default: auto-detect (anthropic key → openrouter key → local claude CLI → none). Issue #66.").option("--llm-model <overrides>", "Per-feature model override, e.g. visual-diff=claude-opus-5,explain=claude-opus-5. Features: selector-discovery, step-recovery, search-terms, plp-matching, pdp-matching, section-understanding, visual-diff, explain, component-detection. Issue #66.").option("--llm-tier-default <tier>", "Override the default tier (haiku | sonnet | opus) for every feature that doesn't have a per-feature override. Issue #66.").option("--llm-model-default <model>", "Force every LLM call to use this exact model ID, ignoring per-feature defaults. Issue #66.").option("--llm-premium", "Bump the reasoning-heavy features (explain/visual-diff) to opus. Defaults are sonnet-first for cost/latency (opus blew the 60s timeout on most runs); opt into opus for hard fixes. Issue #256.").option("--no-interactive", "Disable the interactive selector prompt that auto-fires in a TTY without an LLM provider. Use in scripts and CI where stdin is technically a TTY but you don't want to pause. Issue #72.").option("--only <modules>", "Scope the run to these modules and/or single checks (comma-separated). Module names: e2e, seo, visual, vitals, cache, console, html, network. Single-check granularity via `check:<name>`, e.g. `--only e2e,check:cache-coverage`. Run `parity list modules` for the full check/flow mapping. Default: all modules. M3 module selection.").option("--skip <modules>", "Subtract these modules and/or single checks (comma-separated, same syntax as --only) from whatever base set was chosen (all modules, or --only's set if both are given). M3 module selection.").option("--why <text>", "Free-text reason for this run's scope, stored in report.json as `selectionReason`. Purely informational. M3 module selection.").option("--profile <type>", "Site profile: commerce | content. Scopes modules/flows/CEP. `content` (blog/custom site with no storefront) drops the e2e purchase journey, scopes flows to the homepage, and skips CEP. Auto-detected from the platform when omitted. Issues #254/#255.").action(async (opts) => {
|
|
125087
|
+
`)).option("--prod <url>", "Production URL (source of truth, e.g. Fresh site). Omit for a single site — the run will point you to `parity e2e` (issue #141).").requiredOption("--cand <url>", "Candidate URL (migrated site, e.g. TanStack)").option("--preset <name>", "Bundle of defaults: smoke (fast, ~30s, no LLM) | full (deep audit) | ci (CI-tuned)").option("--flows <list>", "Comma-separated flows: homepage,plp,pdp,purchase-journey", "purchase-journey").option("--viewports <list>", "Comma-separated viewports: mobile,desktop", "mobile,desktop").option("--cep <cep>", "CEP for shipping calculation", "01310-100").option("--prod-cookie <name=value>", "Cookie set on every prod browser context and plain request; repeatable. Pins prod to one A/B variant (e.g. a Fresh-vs-TanStack bucket cookie) so the run does not compare whichever build each fresh context drew. Values are redacted in logs and report.json.", collectCookie, []).option("--cand-cookie <name=value>", "Same as --prod-cookie, for the candidate side", collectCookie, []).option("--prod-header <Name: value>", "Request header sent on every prod request (all origins — no credentials); repeatable. The header twin of --prod-cookie. Values are redacted in logs and report.json.", collectHeader, []).option("--cand-header <Name: value>", "Same as --prod-header, for the candidate side", collectHeader, []).option("--add-to-cart-timeout <ms>", "How long (ms) the add-to-cart step polls for a success signal before failing. Default 3000. Raise/lower to match your site's success-toast lifetime (issue #143).", (v) => Number(v)).option("--runs <n>", "Repeat each measurement N times (median)", "1").option("--baseline <name>", "Compare against a saved baseline").option("--output <dir>", "Output directory", "./parity-output").option("--fail-on <severities>", "Comma-separated severities that cause exit 1 (default: critical)", "critical").option("--html", "Also write report.html (off by default: render it later with `parity report <runId>`)", false).option("--open", "Write report.html and open it after the run completes (implies --html)", false).option("--no-auto-selectors", "Disable LLM-based selector discovery (uses defaults instead)").option("--refresh-selectors", "Bypass selector cache and re-run discovery", false).option("--no-learn", "Don't write to learned-selectors.json (read-only mode)").option("--vitals-pages <n>", "Extra pages from sitemap to crawl for Vitals coverage, beyond what --flows/--pages already cover (default 10). These are auto-sampled and can add significant unrelated noise to findings — pass 0 to scope the run to only the pages you explicitly requested.", (v) => Number(v), 10).option("--max-viewport-concurrency <n>", "How many viewports run concurrently during collect (default 2: mobile+desktop together). Set to 1 if you hit OOM with many viewports.", (v) => Number(v), 2).option("--visual-pages <n>", "Pages to compare visually with the heatmap engine — pixel diff + box-tree diff, no LLM (home + sampled PLPs/PDPs from sitemap, default 5)", (v) => Number(v), 5).option("--pages <list>", 'Comma-separated paths to compare visually (overrides sitemap discovery). E.g. "/,/account,/p/some-product". Use "prod->cand" for a page that lives at DIFFERENT paths on each side (partial migration), e.g. "/encimera-gc60/p->/ar-condicionado-12k/p". Use this when you want deterministic coverage instead of sampled. Scopes the visual-diff + vitals-extra-pages passes ONLY — the flows crawl (--flows, default purchase-journey) discovers its own target pages independently and ignores this flag. To scope which page(s) a flow visits, use --flows to pick a lighter flow and/or set the matching *UrlHint (e.g. plpUrlHint) in .parityrc.json. Issue #178.').option("--pages-file <path>", `Read paths to compare visually from a text file (one entry per line). Lines starting with # are ignored. Accepts the same "prod->cand" pair syntax as --pages. Overrides --pages when both are present. Same visual-diff/vitals-only scope as --pages — see that flag's help. Issue #178.`).option("--no-visual-diff", "Skip the visual diff capture pass entirely").option("--no-cache", "Deprecated, no effect (the visual verdict cache is gone).").option("--clear-cache", "Deprecated, no effect (the visual verdict cache is gone).", false).option("--bypass-cache", "Bypass CDN/edge caches AND the browser's own HTTP cache (CDP cache-disable), forcing a cold-visit fetch. Use right after a deploy to avoid false failures from stale CF edge content, or to approximate Lighthouse/CrUX-comparable TTFB/FCP/LCP numbers — without this flag, parity's vitals are a warm-connection/cache-enabled ('repeat visit') measurement, not a cold first-visit one, so they aren't directly comparable 1:1 to Lighthouse.", false).option("--warmup", "Before measurement, hit each target URL once (per viewport) with a cache-buster so the Worker serves a fresh response. Recommended after deploys.", false).option("--no-warm", "Don't warm each side's URL before measuring vitals. By default every vitals-measured page is loaded once on BOTH sides first, in a throwaway page (same device + cookies), so a cold edge/loader cache on whichever side hit the route first isn't reported as a Web Vitals or CLS regression. Ignored under --bypass-cache, which measures cold on purpose. Distinct from --warmup (a cache-busted homepage hit after a deploy).").option("--accept-prod-quirks", "Demote prod-side cart-empty journey failures (VTEX session quirk) from failed to skipped. The cart-reveal-mode-divergence check still emits critical if prod/cand markup intents differ, so this flag never masks a real regression. See issue #12.", false).option("--cand-is-production", "Cand is the final production domain, not a staging host. Disables staging detection (cand on another host with noindex everywhere), so noindex/nofollow on cand is critical and third-party origins missing on cand are high again.", false).option("--record <dir>", "Save the exact input the checks ran on (captures with full page HTML, resolved config, visual probes, screenshots, and the fetches the checks made) into <dir>, which must be new or empty. Contains full HTML and screenshots of both sites: do not commit it.").option("--golden <dir>", "Use the PROD half of a `--record` recording as the reference and capture only cand (--prod becomes optional). Pages come from the recording, prod-origin fetches by the checks are served from it, and a prod request it never saw is reported as stale (exit 2). Never written to. See docs/cli.md.").option("--llm-timeout <seconds>", "Deprecated, no effect: topIssues is ranked deterministically now, there is no LLM aggregation call to time out.").option("--keep-runs <n>", "After the run, delete all but the n newest runs of this prod/cand host pair under --output (other host pairs, runs without a readable report.json and baseline-referenced runs are never touched). 0 keeps everything. Default: 10.", (v) => Number(v), 10).option("--timeout <minutes>", "Hard wall-clock cap for the whole run (minutes). On expiry, parity writes a partial report and exits 130. Default: 30. Issue #56.", (v) => Number(v), 30).option("--flow <name>", "Alias for --flows when running a single flow (e.g. --flow cart). Issue #53.").option("--json <path|->", "Emit JSON-Lines (one line per check) to the given file path, or '-' for stdout. Schema versioned via leading metadata line. Issue #53.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Only affects LLM-generated content (issues, explain, prompts) — the static HTML report stays in English. Issue #67.").option("--llm <provider>", "Force LLM provider: anthropic | openrouter | claude-code | none. Default: auto-detect (anthropic key → openrouter key → local claude CLI → none). Issue #66.").option("--llm-model <overrides>", "Per-feature model override, e.g. visual-diff=claude-opus-5,explain=claude-opus-5. Features: selector-discovery, step-recovery, search-terms, plp-matching, pdp-matching, section-understanding, visual-diff, explain, component-detection. Issue #66.").option("--llm-tier-default <tier>", "Override the default tier (haiku | sonnet | opus) for every feature that doesn't have a per-feature override. Issue #66.").option("--llm-model-default <model>", "Force every LLM call to use this exact model ID, ignoring per-feature defaults. Issue #66.").option("--llm-premium", "Bump the reasoning-heavy features (explain/visual-diff) to opus. Defaults are sonnet-first for cost/latency (opus blew the 60s timeout on most runs); opt into opus for hard fixes. Issue #256.").option("--no-interactive", "Disable the interactive selector prompt that auto-fires in a TTY without an LLM provider. Use in scripts and CI where stdin is technically a TTY but you don't want to pause. Issue #72.").option("--only <modules>", "Scope the run to these modules and/or single checks (comma-separated). Module names: e2e, seo, visual, vitals, cache, console, html, network. Single-check granularity via `check:<name>`, e.g. `--only e2e,check:cache-coverage`. Run `parity list modules` for the full check/flow mapping. Default: all modules. M3 module selection.").option("--skip <modules>", "Subtract these modules and/or single checks (comma-separated, same syntax as --only) from whatever base set was chosen (all modules, or --only's set if both are given). M3 module selection.").option("--why <text>", "Free-text reason for this run's scope, stored in report.json as `selectionReason`. Purely informational. M3 module selection.").option("--profile <type>", "Site profile: commerce | content. Scopes modules/flows/CEP. `content` (blog/custom site with no storefront) drops the e2e purchase journey, scopes flows to the homepage, and skips CEP. Auto-detected from the platform when omitted. Issues #254/#255.").action(async (opts) => {
|
|
124743
125088
|
if (opts.flow) {
|
|
124744
125089
|
opts.flows = opts.flow;
|
|
124745
125090
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.27",
|
|
4
4
|
"description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with a ranked HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|