@decocms/parity 0.34.2 → 0.34.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +48 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -76820,7 +76820,14 @@ function snapshotDom(html) {
|
|
|
76820
76820
|
total: imgs.length,
|
|
76821
76821
|
withSrcset: imgs.filter((_, el) => Boolean($(el).attr("srcset"))).length,
|
|
76822
76822
|
withAlt: imgs.filter((_, el) => Boolean($(el).attr("alt"))).length,
|
|
76823
|
-
withoutAlt: imgs.filter((_, el) =>
|
|
76823
|
+
withoutAlt: imgs.filter((_, el) => {
|
|
76824
|
+
const $el = $(el);
|
|
76825
|
+
if ($el.attr("alt") !== undefined)
|
|
76826
|
+
return false;
|
|
76827
|
+
if ($el.attr("aria-hidden") === "true")
|
|
76828
|
+
return false;
|
|
76829
|
+
return !/^(presentation|none)$/.test($el.attr("role") ?? "");
|
|
76830
|
+
}).length,
|
|
76824
76831
|
src: imgs.map((_, el) => $(el).attr("src") ?? "").get().filter(Boolean),
|
|
76825
76832
|
banners
|
|
76826
76833
|
};
|
|
@@ -119271,6 +119278,7 @@ function summaryCardBody(run, filed, belowThreshold) {
|
|
|
119271
119278
|
function issueKey(issue) {
|
|
119272
119279
|
const page = pageOf(issue);
|
|
119273
119280
|
let summary = issue.summary.replace(/^\[(mobile|desktop|tablet)\]\s*/, "").replace(/\s*\(×\d+\)$/, "");
|
|
119281
|
+
summary = summary.replace(/\b(mobile|desktop|tablet):(?=https?:\/\/)/g, "");
|
|
119274
119282
|
if (page)
|
|
119275
119283
|
summary = summary.split(page).join("");
|
|
119276
119284
|
summary = summary.replace(/::(mobile|desktop|tablet)/g, "").replace(/\d+(\.\d+)?\s*(MB|KB|ms|%)/gi, "#").replace(/\b\d+\.\d+\b/g, "#");
|
|
@@ -119345,7 +119353,10 @@ async function fileSweepCards(issues, runIn, cfg, opts = {}) {
|
|
|
119345
119353
|
const selected = selectIssues(issues, opts.minSeverity, opts.hold);
|
|
119346
119354
|
const entries = planCards(selected, board.items, runIn);
|
|
119347
119355
|
const withSpecs = { ...runIn, specSources: readSpecs(entries) };
|
|
119348
|
-
const run =
|
|
119356
|
+
const run = {
|
|
119357
|
+
...withSpecs,
|
|
119358
|
+
evidenceUrls: opts.dryRun ? plannedEvidenceUrls(entries, runIn, cfg) : await uploadEvidence(entries, runIn, cfg, call, opts)
|
|
119359
|
+
};
|
|
119349
119360
|
const result = { created: 0, updated: 0, regressions: 0, skipped: 0, entries };
|
|
119350
119361
|
const filed = [];
|
|
119351
119362
|
const month = monthOf(run.timestamp);
|
|
@@ -119424,8 +119435,12 @@ function readSpecs(entries) {
|
|
|
119424
119435
|
out[ev.path] = readFileSync43(ev.path, "utf8");
|
|
119425
119436
|
return out;
|
|
119426
119437
|
}
|
|
119427
|
-
|
|
119428
|
-
const
|
|
119438
|
+
function evidenceLibraryPath(p, run) {
|
|
119439
|
+
const idx = Math.max(p.indexOf("/screenshots/"), p.indexOf("/videos/"));
|
|
119440
|
+
const rel = idx >= 0 ? p.slice(idx + 1) : p.split("/").pop() ?? p;
|
|
119441
|
+
return `parity-sweep/${hostOf5(run.url)}/${run.runId}/${rel}`;
|
|
119442
|
+
}
|
|
119443
|
+
function cardEvidencePaths(entries) {
|
|
119429
119444
|
const paths = new Set;
|
|
119430
119445
|
for (const e of entries) {
|
|
119431
119446
|
if (e.action === "skip" || !e.issue)
|
|
@@ -119433,13 +119448,25 @@ async function uploadEvidence(entries, run, cfg, call, opts) {
|
|
|
119433
119448
|
for (const m of (e.issue.evidence ?? []).filter((x) => (x.kind === "screenshot" || x.kind === "video") && x.path).slice(0, 4))
|
|
119434
119449
|
paths.add(m.path);
|
|
119435
119450
|
}
|
|
119451
|
+
return paths;
|
|
119452
|
+
}
|
|
119453
|
+
function plannedEvidenceUrls(entries, run, cfg) {
|
|
119454
|
+
const base = cfg.url.match(/^(https?:\/\/[^/]+\/api\/[^/]+)\/mcp(\/|$)/)?.[1];
|
|
119455
|
+
if (!base)
|
|
119456
|
+
return {};
|
|
119436
119457
|
const out = {};
|
|
119437
|
-
for (const p of
|
|
119458
|
+
for (const p of cardEvidencePaths(entries))
|
|
119459
|
+
if (existsSync35(p))
|
|
119460
|
+
out[p] = `${base}/fs/org/read?path=${encodeURIComponent(evidenceLibraryPath(p, run))}`;
|
|
119461
|
+
return out;
|
|
119462
|
+
}
|
|
119463
|
+
async function uploadEvidence(entries, run, cfg, call, opts) {
|
|
119464
|
+
const upload = opts.upload ?? ((local, lib) => uploadToLibrary(cfg, local, lib, call));
|
|
119465
|
+
const out = {};
|
|
119466
|
+
for (const p of cardEvidencePaths(entries)) {
|
|
119438
119467
|
if (!existsSync35(p))
|
|
119439
119468
|
continue;
|
|
119440
|
-
const
|
|
119441
|
-
const rel = idx >= 0 ? p.slice(idx + 1) : p.split("/").pop() ?? p;
|
|
119442
|
-
const url = await upload(p, `parity-sweep/${hostOf5(run.url)}/${run.runId}/${rel}`);
|
|
119469
|
+
const url = await upload(p, evidenceLibraryPath(p, run));
|
|
119443
119470
|
if (url)
|
|
119444
119471
|
out[p] = url;
|
|
119445
119472
|
}
|
|
@@ -120346,7 +120373,15 @@ function applyCardReview(issues, review) {
|
|
|
120346
120373
|
return { issues: mergeIssues(issues, review.issues, new Set), held };
|
|
120347
120374
|
}
|
|
120348
120375
|
function mergeIssues(report, agent, dropped) {
|
|
120349
|
-
const
|
|
120376
|
+
const rank = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
120377
|
+
const byId = new Map;
|
|
120378
|
+
for (const i of report) {
|
|
120379
|
+
if (dropped.has(i.id))
|
|
120380
|
+
continue;
|
|
120381
|
+
const prev = byId.get(i.id);
|
|
120382
|
+
if (!prev || rank[i.severity] < rank[prev.severity])
|
|
120383
|
+
byId.set(i.id, i);
|
|
120384
|
+
}
|
|
120350
120385
|
for (const i of agent)
|
|
120351
120386
|
if (!dropped.has(i.id))
|
|
120352
120387
|
byId.set(i.id, { ...byId.get(i.id), ...i });
|
|
@@ -120384,6 +120419,10 @@ async function sweepFileCommand(opts) {
|
|
|
120384
120419
|
if (!e.path.startsWith("/"))
|
|
120385
120420
|
e.path = join50(paths.runDir, e.path);
|
|
120386
120421
|
const review = readCardReview(paths.runDir);
|
|
120422
|
+
for (const i of review.issues)
|
|
120423
|
+
for (const e of i.evidence ?? [])
|
|
120424
|
+
if (!e.path.startsWith("/"))
|
|
120425
|
+
e.path = join50(paths.runDir, e.path);
|
|
120387
120426
|
const { issues, held } = applyCardReview(mergeIssues(report.allIssues ?? [], agent.issues, agent.dropped), review);
|
|
120388
120427
|
const info = {
|
|
120389
120428
|
runId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.3",
|
|
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",
|