@decocms/parity 0.35.31 → 0.35.33
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 +27 -0
- package/dist/cli.js +502 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
* **`first-viewport-ssr` check (html module)** answers "is what the user sees in the first viewport
|
|
13
|
+
already in the server response, or does it arrive later?". A deferred header (a skeleton in the
|
|
14
|
+
server HTML that client JS fills in) passed `ssr-no-js` (the rest of the page carried the text)
|
|
15
|
+
and `lazy-section-presence` (the final DOM has the section on both sides). `capturePage` now
|
|
16
|
+
compares, per top-level section, the final DOM with the navigation response's raw HTML (text,
|
|
17
|
+
links, images, form fields; `<script>` payloads never count), matched by manifest key / landmark.
|
|
18
|
+
Cand defers a first-viewport section prod server-renders: `high`. Both sides defer it: `medium`
|
|
19
|
+
`first-viewport:improve:*`, worded as an improvement and left to the owner's `as-is` / `upgrade`
|
|
20
|
+
call; no cap, never critical. A localhost cand whose every judged section is deferred (the page
|
|
21
|
+
rendered client-side) is inconclusive. New optional `PageCapture.firstViewport`; older
|
|
22
|
+
recordings and `--golden` files parse unchanged and judge inconclusive. Tolerances in
|
|
23
|
+
`TOLERANCES.firstViewportSsr`.
|
|
12
24
|
* **`click-blocker-parity` check (visual module)** answers "can the user click the page on the
|
|
13
25
|
candidate where they can on prod?". `capturePage` now samples a 5x5 grid of viewport points
|
|
14
26
|
with `elementFromPoint` (one `page.evaluate`, at first-visit state, before the autoscroll and
|
|
@@ -69,6 +81,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
69
81
|
|
|
70
82
|
### Fixed
|
|
71
83
|
|
|
84
|
+
* **A dev-server candidate no longer fails the run on numbers the dev server itself produces.**
|
|
85
|
+
`cache-coverage` ("22 cacheable requests are not cached", hit rate down 54 points),
|
|
86
|
+
`network-summary-delta` (request volume 7x prod) and `web-vitals-mobile` were filed live against
|
|
87
|
+
a Vite dev server, while the `cand-dev-server` caveat said those numbers were not representative.
|
|
88
|
+
When cand is on a loopback host AND its captures show the dev toolchain (`/@vite/client`,
|
|
89
|
+
`/@react-refresh`, `/@id/`, `/node_modules/.vite/`, Next/webpack HMR, raw `/src/*.tsx` requests,
|
|
90
|
+
or the dev client tag in the HTML), the cand-derived findings of those checks, of
|
|
91
|
+
`lighthouse-opportunities`, of `lighthouse-scores` (performance category only) and of
|
|
92
|
+
`cookie-cep-modal-cls` are `inconclusive`: kept with a note, out of the score, check `warn`
|
|
93
|
+
rather than `fail`, pairs counted as inconclusive. A request that 404s, a lost deco section, an
|
|
94
|
+
accessibility score drop etc. stay live. A production build served on localhost is NOT a dev
|
|
95
|
+
server and keeps every finding (it now gets an info `cand-local-build` caveat instead of
|
|
96
|
+
`cand-dev-server`). The verdict is derived from the recorded captures, so `replay` / `--golden`
|
|
97
|
+
agree; no new recorded field.
|
|
98
|
+
|
|
72
99
|
* **The compared / passed counts agree across checks again.** Three changes that each assumed
|
|
73
100
|
the others were already in: a pair a not-captured guard (`withCapturedPairs`) withholds now
|
|
74
101
|
lands in the check's `inconclusive` count (a check that does not count stays uncounted);
|
package/dist/cli.js
CHANGED
|
@@ -76844,6 +76844,32 @@ var TOLERANCES = {
|
|
|
76844
76844
|
note: "A background, border or `::backdrop` colour with alpha below this, or an element chain whose opacity multiplies down below it, is treated as painting nothing. Matches 'nearly invisible' (a confirm button at opacity 0.02) without calling a faint tint invisible. Baked into the recorded `paints` flag, so changing it applies to new captures only."
|
|
76845
76845
|
}
|
|
76846
76846
|
},
|
|
76847
|
+
firstViewportSsr: {
|
|
76848
|
+
minViewportShare: {
|
|
76849
|
+
value: 0.05,
|
|
76850
|
+
unit: "ratio (0-1)",
|
|
76851
|
+
basis: "assumed",
|
|
76852
|
+
note: "A section counts as 'in the first viewport' for first-viewport-ssr only when it covers at least this share of the viewport area (a full-width band about 65 px tall on a 900 px viewport). Below it the section merely pokes in: a cart count, a thin promo strip, a sliver of the next block. Bottom-anchored fixed layers (consent bar, chat bubble) are dropped by the probe itself."
|
|
76853
|
+
},
|
|
76854
|
+
deferredBelow: {
|
|
76855
|
+
value: 0.5,
|
|
76856
|
+
unit: "ratio (0-1)",
|
|
76857
|
+
basis: "assumed",
|
|
76858
|
+
note: "A section is deferred when the mean, over the content kinds it has in the final DOM (text, links, images, form fields), of min(1, server count / final count) is at or below this. A skeleton keeps a logo or a wrapper link and loses the rest, so a single well-covered kind must not clear it (that is why it is a mean, not a max); a section the client merely adds to (a few more links after hydration, extra carousel slides) stays well above it. Not calibrated against real storefronts."
|
|
76859
|
+
},
|
|
76860
|
+
contentMinChars: {
|
|
76861
|
+
value: 20,
|
|
76862
|
+
unit: "chars",
|
|
76863
|
+
basis: "assumed",
|
|
76864
|
+
note: "Text counts as a content kind of a section only when its final DOM holds at least this many characters; a cart '3' or a 'Menu' label is not content. Links, images and form fields count from 1. A section with no content kind at or above the floor is not judgeable (it is empty in the final render too, which is another check's question)."
|
|
76865
|
+
},
|
|
76866
|
+
maxSections: {
|
|
76867
|
+
value: 40,
|
|
76868
|
+
unit: "count",
|
|
76869
|
+
basis: "assumed",
|
|
76870
|
+
note: "Sections recorded per page, first-viewport ones first. Bounds the size of a recording; below-the-fold sections are only kept so the other side's counterpart can be found."
|
|
76871
|
+
}
|
|
76872
|
+
},
|
|
76847
76873
|
geometry: {
|
|
76848
76874
|
subpixelPx: {
|
|
76849
76875
|
value: 1,
|
|
@@ -77985,6 +78011,44 @@ function buildCacheReport(entries, baseUrl) {
|
|
|
77985
78011
|
};
|
|
77986
78012
|
}
|
|
77987
78013
|
|
|
78014
|
+
// src/checks/lib/dev-server.ts
|
|
78015
|
+
var DEV_URL_MARKERS = [
|
|
78016
|
+
/\/@vite\/client/,
|
|
78017
|
+
/\/@react-refresh/,
|
|
78018
|
+
/\/@id\//,
|
|
78019
|
+
/\/@fs\//,
|
|
78020
|
+
/\/node_modules\/\.vite\//,
|
|
78021
|
+
/\/__vite_ping/,
|
|
78022
|
+
/\/_next\/webpack-hmr/,
|
|
78023
|
+
/\/_next\/static\/development\//,
|
|
78024
|
+
/\/webpack-dev-server\//,
|
|
78025
|
+
/\/sockjs-node\//,
|
|
78026
|
+
/\.hot-update\.(json|js)(\?|$)/,
|
|
78027
|
+
/\/src\/[^?#]*\.(tsx|ts|jsx)(\?|#|$)/
|
|
78028
|
+
];
|
|
78029
|
+
var DEV_HTML_MARKERS = [/\/@vite\/client/, /\/@react-refresh/, /\/_next\/webpack-hmr/];
|
|
78030
|
+
function isCandDevServer(candPages, candIsProduction = false) {
|
|
78031
|
+
if (candIsProduction)
|
|
78032
|
+
return false;
|
|
78033
|
+
const host = siteHost(candPages);
|
|
78034
|
+
if (!host || !isLoopbackHost(host))
|
|
78035
|
+
return false;
|
|
78036
|
+
return candPages.some((p) => {
|
|
78037
|
+
const html = p.html ?? "";
|
|
78038
|
+
return (p.network ?? []).some((e) => DEV_URL_MARKERS.some((re) => re.test(e.url))) || DEV_HTML_MARKERS.some((re) => re.test(html));
|
|
78039
|
+
});
|
|
78040
|
+
}
|
|
78041
|
+
var DEV_SERVER_NOTE = "Medido contra um dev server (cand-dev-server): sem minificação, sem cache de edge, módulos sem bundle. Este número não é evidência sobre a migração — reconfirme contra um build de produção.";
|
|
78042
|
+
function asDevServerInconclusive(issue) {
|
|
78043
|
+
return {
|
|
78044
|
+
...issue,
|
|
78045
|
+
inconclusive: true,
|
|
78046
|
+
details: issue.details ? `${DEV_SERVER_NOTE}
|
|
78047
|
+
|
|
78048
|
+
${issue.details}` : DEV_SERVER_NOTE
|
|
78049
|
+
};
|
|
78050
|
+
}
|
|
78051
|
+
|
|
77988
78052
|
// src/checks/cache-coverage.ts
|
|
77989
78053
|
function cacheCoverage(ctx) {
|
|
77990
78054
|
const start = Date.now();
|
|
@@ -78049,14 +78113,27 @@ Cache-Control: ${opp.entry.cacheControl ?? "(missing)"}
|
|
|
78049
78113
|
Status: ${opp.entry.status}`
|
|
78050
78114
|
});
|
|
78051
78115
|
}
|
|
78052
|
-
const
|
|
78116
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
78117
|
+
const reported = devServer ? issues.length > 0 ? issues.map(asDevServerInconclusive) : [
|
|
78118
|
+
{
|
|
78119
|
+
id: "cache:dev-server-not-judged",
|
|
78120
|
+
severity: "low",
|
|
78121
|
+
inconclusive: true,
|
|
78122
|
+
category: "performance",
|
|
78123
|
+
check: "cache-coverage",
|
|
78124
|
+
summary: "Cache de cand não julgado: dev server (cand-dev-server)",
|
|
78125
|
+
details: DEV_SERVER_NOTE
|
|
78126
|
+
}
|
|
78127
|
+
] : issues;
|
|
78128
|
+
const live = reported.filter((i) => !i.inconclusive);
|
|
78129
|
+
const status = live.some((i) => i.severity === "high") ? "fail" : reported.length > 0 ? "warn" : "pass";
|
|
78053
78130
|
return {
|
|
78054
78131
|
name: "cache-coverage",
|
|
78055
78132
|
status,
|
|
78056
78133
|
severity: "high",
|
|
78057
78134
|
durationMs: Date.now() - start,
|
|
78058
|
-
summary: `Cache hit rate cand: ${(report.hitRate * 100).toFixed(0)}% · ${oppCount} oportunidade(s) (${(oppBytes / 1024).toFixed(0)} KB)`,
|
|
78059
|
-
issues,
|
|
78135
|
+
summary: `Cache hit rate cand: ${(report.hitRate * 100).toFixed(0)}% · ${oppCount} oportunidade(s) (${(oppBytes / 1024).toFixed(0)} KB)${devServer ? " · dev server: inconclusivo" : ""}`,
|
|
78136
|
+
issues: reported,
|
|
78060
78137
|
data: {
|
|
78061
78138
|
hitRate: report.hitRate,
|
|
78062
78139
|
prodHitRate: prodReport?.hitRate,
|
|
@@ -78917,14 +78994,15 @@ function cookieCepModalCls(ctx) {
|
|
|
78917
78994
|
}
|
|
78918
78995
|
}
|
|
78919
78996
|
}
|
|
78920
|
-
const
|
|
78997
|
+
const reported = isCandDevServer(ctx.candPages, ctx.candIsProduction) ? issues.map(asDevServerInconclusive) : issues;
|
|
78998
|
+
const status = reported.some((i) => !i.inconclusive && (i.severity === "critical" || i.severity === "high")) ? "fail" : reported.length > 0 ? "warn" : "pass";
|
|
78921
78999
|
return {
|
|
78922
79000
|
name: "cookie-cep-modal-cls",
|
|
78923
79001
|
status,
|
|
78924
79002
|
severity: "high",
|
|
78925
79003
|
durationMs: Date.now() - start,
|
|
78926
|
-
summary: `${
|
|
78927
|
-
issues
|
|
79004
|
+
summary: `${reported.length} issue(s)`,
|
|
79005
|
+
issues: reported
|
|
78928
79006
|
};
|
|
78929
79007
|
}
|
|
78930
79008
|
function keyFor(p) {
|
|
@@ -79924,6 +80002,156 @@ function withHtmlSnapshot(check) {
|
|
|
79924
80002
|
return guarded;
|
|
79925
80003
|
}
|
|
79926
80004
|
|
|
80005
|
+
// src/checks/first-viewport-ssr.ts
|
|
80006
|
+
var T = TOLERANCES.firstViewportSsr;
|
|
80007
|
+
function firstViewportSsr(ctx) {
|
|
80008
|
+
const start = Date.now();
|
|
80009
|
+
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
80010
|
+
const issues = [];
|
|
80011
|
+
const judged = [];
|
|
80012
|
+
const unjudged = [];
|
|
80013
|
+
for (const pair of pairs) {
|
|
80014
|
+
const why = unjudgeable2(pair.prod.firstViewport, pair.cand.firstViewport);
|
|
80015
|
+
if (why) {
|
|
80016
|
+
unjudged.push(pair.key);
|
|
80017
|
+
issues.push({
|
|
80018
|
+
id: `first-viewport:no-probe:${pair.key}`,
|
|
80019
|
+
severity: "low",
|
|
80020
|
+
inconclusive: true,
|
|
80021
|
+
category: "performance",
|
|
80022
|
+
page: pair.key,
|
|
80023
|
+
check: "first-viewport-ssr",
|
|
80024
|
+
summary: `${pair.key}: first-viewport probe unavailable (${why}) — not compared by first-viewport-ssr`,
|
|
80025
|
+
details: "Without server HTML and judgeable first-viewport sections on both sides there is nothing to compare, and absence is not evidence that the server rendered them. Re-capture with a current parity."
|
|
80026
|
+
});
|
|
80027
|
+
continue;
|
|
80028
|
+
}
|
|
80029
|
+
judged.push(pair.key);
|
|
80030
|
+
issues.push(...judgePair2(pair));
|
|
80031
|
+
}
|
|
80032
|
+
const live = issues.filter((i) => !i.inconclusive);
|
|
80033
|
+
const compared = judged.length;
|
|
80034
|
+
const status = live.some((i) => i.severity === "high" || i.severity === "critical") ? "fail" : live.length > 0 ? "warn" : compared === 0 ? "skipped" : "pass";
|
|
80035
|
+
const regressions = live.filter((i) => i.id.startsWith("first-viewport:regression:")).length;
|
|
80036
|
+
const summary = compared === 0 ? `nothing compared: ${pairs.length === 0 ? "no prod x cand page pairs" : `${unjudged.length} of ${pairs.length} page pair(s) had no judgeable first-viewport probe`}` : `${compared} page pair(s) compared, ${regressions} first-viewport regression(s), ${live.length - regressions} deferred section(s) prod shares${unjudged.length ? `, ${unjudged.length} without a probe` : ""}`;
|
|
80037
|
+
return {
|
|
80038
|
+
name: "first-viewport-ssr",
|
|
80039
|
+
status,
|
|
80040
|
+
severity: "high",
|
|
80041
|
+
durationMs: Date.now() - start,
|
|
80042
|
+
summary,
|
|
80043
|
+
issues,
|
|
80044
|
+
...unitCounts({
|
|
80045
|
+
unit: "page-pair",
|
|
80046
|
+
judged,
|
|
80047
|
+
unjudged,
|
|
80048
|
+
issues,
|
|
80049
|
+
informational: (i) => i.id.startsWith("first-viewport:prod-deferred:")
|
|
80050
|
+
}),
|
|
80051
|
+
data: { pairs: pairs.length, compared, withoutProbe: unjudged.length }
|
|
80052
|
+
};
|
|
80053
|
+
}
|
|
80054
|
+
function kindsOf(final, server) {
|
|
80055
|
+
const s = server ?? { text: 0, links: 0, images: 0, inputs: 0 };
|
|
80056
|
+
const all = [
|
|
80057
|
+
{ label: "text chars", final: final.text, server: s.text },
|
|
80058
|
+
{ label: "links", final: final.links, server: s.links },
|
|
80059
|
+
{ label: "images", final: final.images, server: s.images },
|
|
80060
|
+
{ label: "inputs", final: final.inputs, server: s.inputs }
|
|
80061
|
+
];
|
|
80062
|
+
return all.filter((k) => k.final >= (k.label === "text chars" ? T.contentMinChars.value : 1));
|
|
80063
|
+
}
|
|
80064
|
+
var judgeable = (s) => kindsOf(s.final, s.server).length > 0;
|
|
80065
|
+
var inViewport = (s) => s.share >= T.minViewportShare.value && judgeable(s);
|
|
80066
|
+
function serverShare(s) {
|
|
80067
|
+
const kinds = kindsOf(s.final, s.server);
|
|
80068
|
+
return kinds.reduce((sum, k) => sum + Math.min(1, k.server / k.final), 0) / kinds.length;
|
|
80069
|
+
}
|
|
80070
|
+
var isDeferred = (s) => serverShare(s) <= T.deferredBelow.value;
|
|
80071
|
+
function unjudgeable2(prod, cand) {
|
|
80072
|
+
if (!prod || !cand)
|
|
80073
|
+
return `no probe on ${!prod && !cand ? "either side" : !prod ? "prod" : "cand"}`;
|
|
80074
|
+
if (prod.serverChars === 0 || cand.serverChars === 0)
|
|
80075
|
+
return "no server HTML recorded on a side";
|
|
80076
|
+
if (!cand.sections.some(inViewport))
|
|
80077
|
+
return "no judgeable section in cand's first viewport";
|
|
80078
|
+
return null;
|
|
80079
|
+
}
|
|
80080
|
+
function counterpart(s, others, used) {
|
|
80081
|
+
const free = others.filter((o) => !used.has(o));
|
|
80082
|
+
const hit = free.find((o) => o.keys.some((k) => s.keys.includes(k))) ?? (s.landmark ? free.find((o) => o.landmark === s.landmark) : undefined) ?? null;
|
|
80083
|
+
if (hit)
|
|
80084
|
+
used.add(hit);
|
|
80085
|
+
return hit;
|
|
80086
|
+
}
|
|
80087
|
+
function missing(s) {
|
|
80088
|
+
return kindsOf(s.final, s.server).map((k) => `${k.server} of ${k.final} ${k.label}`).join(", ");
|
|
80089
|
+
}
|
|
80090
|
+
function judgePair2(pair) {
|
|
80091
|
+
const prod = pair.prod.firstViewport;
|
|
80092
|
+
const cand = pair.cand.firstViewport;
|
|
80093
|
+
const candView = cand.sections.filter(inViewport);
|
|
80094
|
+
const wholePageClientSide = isLocalhost(pair.cand.finalUrl) && candView.length > 0 && candView.every(isDeferred);
|
|
80095
|
+
const caveat = wholePageClientSide ? " Measured against a local dev server on which every judged first-viewport section is deferred, i.e. the whole page rendered client-side, which several frameworks do in dev: reconfirm on a production build before treating this as a defect." : "";
|
|
80096
|
+
const out = [];
|
|
80097
|
+
const usedProd = new Set;
|
|
80098
|
+
const names = new Map;
|
|
80099
|
+
const idFor = (kind, name) => {
|
|
80100
|
+
const n = (names.get(`${kind}:${name}`) ?? 0) + 1;
|
|
80101
|
+
names.set(`${kind}:${name}`, n);
|
|
80102
|
+
return `first-viewport:${kind}:${name}${n > 1 ? `#${n}` : ""}:${pair.key}`;
|
|
80103
|
+
};
|
|
80104
|
+
const common = { category: "performance", page: pair.key, check: "first-viewport-ssr" };
|
|
80105
|
+
const where = `[${pair.viewport}] ${pair.cand.url}`;
|
|
80106
|
+
for (const s of candView) {
|
|
80107
|
+
const p = counterpart(s, prod.sections, usedProd);
|
|
80108
|
+
if (!isDeferred(s))
|
|
80109
|
+
continue;
|
|
80110
|
+
const pct = Math.round(s.share * 100);
|
|
80111
|
+
const lack = `${missing(s)} in the server HTML`;
|
|
80112
|
+
const prodState = p && judgeable(p) ? isDeferred(p) ? "deferred" : "rendered" : "unknown";
|
|
80113
|
+
const fix = "Server-render this section (do not wrap it in a lazy/deferred section, or mark it eager) so it is in the first response; if it must stay deferred, give its fallback the section's real size.";
|
|
80114
|
+
const inconclusive = wholePageClientSide ? { inconclusive: true } : {};
|
|
80115
|
+
if (prodState === "rendered") {
|
|
80116
|
+
out.push({
|
|
80117
|
+
...common,
|
|
80118
|
+
...inconclusive,
|
|
80119
|
+
id: idFor("regression", s.name),
|
|
80120
|
+
severity: "high",
|
|
80121
|
+
summary: `cand defers the ${s.name} section in the first viewport that prod server-renders (${lack})`,
|
|
80122
|
+
details: `${where}: ${s.name} covers ${pct}% of the first viewport and reaches the browser as a skeleton until client JS runs, while prod's server HTML already holds it (${missing(p)}).${caveat}`,
|
|
80123
|
+
suggestedFix: fix
|
|
80124
|
+
});
|
|
80125
|
+
} else {
|
|
80126
|
+
const why = prodState === "deferred" ? "prod defers it too, so this is not a regression: prod has the same flaw and the candidate can fix it" : "prod has no first-viewport counterpart to compare with";
|
|
80127
|
+
out.push({
|
|
80128
|
+
...common,
|
|
80129
|
+
...inconclusive,
|
|
80130
|
+
id: idFor("improve", s.name),
|
|
80131
|
+
severity: "medium",
|
|
80132
|
+
summary: `${s.name} is deferred in the first viewport on cand (${lack}); ${prodState === "deferred" ? "prod has the same flaw, the candidate can fix it" : "no prod counterpart to compare"}`,
|
|
80133
|
+
details: `${where}: ${s.name} covers ${pct}% of the first viewport and arrives after client JS runs; ${why}. Reported because content in the first viewport arriving late is a defect on its own. Whether to fix it or keep it as-is is the owner's decision (accept it with an expectedDivergences entry for this id).${caveat}`,
|
|
80134
|
+
suggestedFix: fix
|
|
80135
|
+
});
|
|
80136
|
+
}
|
|
80137
|
+
}
|
|
80138
|
+
const usedCand = new Set;
|
|
80139
|
+
for (const p of prod.sections.filter(inViewport)) {
|
|
80140
|
+
const c = counterpart(p, cand.sections, usedCand);
|
|
80141
|
+
if (!isDeferred(p) || !c || !judgeable(c) || isDeferred(c))
|
|
80142
|
+
continue;
|
|
80143
|
+
out.push({
|
|
80144
|
+
...common,
|
|
80145
|
+
id: idFor("prod-deferred", p.name),
|
|
80146
|
+
severity: "low",
|
|
80147
|
+
inconclusive: true,
|
|
80148
|
+
summary: `prod defers the ${p.name} section in the first viewport (${missing(p)} in the server HTML) and cand server-renders it`,
|
|
80149
|
+
details: `${where}: informational, the candidate is better than prod here.`
|
|
80150
|
+
});
|
|
80151
|
+
}
|
|
80152
|
+
return out;
|
|
80153
|
+
}
|
|
80154
|
+
|
|
79927
80155
|
// src/checks/login-flow.ts
|
|
79928
80156
|
var STEP_LABELS = {
|
|
79929
80157
|
"visit-home": "Visitar home",
|
|
@@ -80400,13 +80628,14 @@ function networkSummaryDelta(ctx) {
|
|
|
80400
80628
|
const start = Date.now();
|
|
80401
80629
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
80402
80630
|
const issues = [];
|
|
80631
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
80403
80632
|
for (const pair of pairs) {
|
|
80404
80633
|
const diff = diffNetwork(pair.prod.network, pair.cand.network, {
|
|
80405
80634
|
ignorePatterns: ctx.ignore.ignoreRequestPatterns,
|
|
80406
80635
|
maxTotalPct: TOLERANCES.network.maxTotalPct.value
|
|
80407
80636
|
});
|
|
80408
80637
|
if (diff.anyFailed) {
|
|
80409
|
-
|
|
80638
|
+
const volume = {
|
|
80410
80639
|
id: `network:volume:${pair.key}`,
|
|
80411
80640
|
severity: "medium",
|
|
80412
80641
|
category: "network",
|
|
@@ -80420,7 +80649,8 @@ function networkSummaryDelta(ctx) {
|
|
|
80420
80649
|
`URLs apenas em cand (${diff.urls.onlyCand.length} primeiras 5): ${diff.urls.onlyCand.slice(0, 5).join(", ")}`
|
|
80421
80650
|
].join(`
|
|
80422
80651
|
`)
|
|
80423
|
-
}
|
|
80652
|
+
};
|
|
80653
|
+
issues.push(devServer ? asDevServerInconclusive(volume) : volume);
|
|
80424
80654
|
}
|
|
80425
80655
|
const prodApi = new Set(diff.prod.decoSectionsHit);
|
|
80426
80656
|
for (const sec of prodApi) {
|
|
@@ -83830,6 +84060,205 @@ async function acceptCookieBanner(page, opts = {}) {
|
|
|
83830
84060
|
return false;
|
|
83831
84061
|
}
|
|
83832
84062
|
|
|
84063
|
+
// src/engine/first-viewport-probe.ts
|
|
84064
|
+
var FIRST_VIEWPORT_PROBE_SOURCE = `(function (arg) {
|
|
84065
|
+
var vw = window.innerWidth;
|
|
84066
|
+
var vh = window.innerHeight;
|
|
84067
|
+
var SKIP = { SCRIPT: 1, STYLE: 1, NOSCRIPT: 1, TEMPLATE: 1, LINK: 1, META: 1 };
|
|
84068
|
+
var LANDMARK = 'header,[role=banner],main,[role=main],footer,[role=contentinfo],nav,[role=navigation]';
|
|
84069
|
+
var KEY = 'data-manifest-key';
|
|
84070
|
+
|
|
84071
|
+
function landmarkName(el) {
|
|
84072
|
+
var tag = el.tagName.toLowerCase();
|
|
84073
|
+
var role = el.getAttribute('role');
|
|
84074
|
+
if (tag === 'header' || role === 'banner') return 'header';
|
|
84075
|
+
if (tag === 'main' || role === 'main') return 'main';
|
|
84076
|
+
if (tag === 'footer' || role === 'contentinfo') return 'footer';
|
|
84077
|
+
if (tag === 'nav' || role === 'navigation') return 'nav';
|
|
84078
|
+
return null;
|
|
84079
|
+
}
|
|
84080
|
+
function landmarkOf(el) {
|
|
84081
|
+
var self = el.matches(LANDMARK) ? el : el.querySelector(LANDMARK);
|
|
84082
|
+
return self ? landmarkName(self) : null;
|
|
84083
|
+
}
|
|
84084
|
+
// Outermost keyed elements; a landmark only when nothing keyed lives inside it (otherwise the
|
|
84085
|
+
// keyed children are the sections and the landmark is just their container).
|
|
84086
|
+
function collect(doc) {
|
|
84087
|
+
var out = [];
|
|
84088
|
+
(function walk(parent) {
|
|
84089
|
+
for (var c = parent.firstElementChild; c; c = c.nextElementSibling) {
|
|
84090
|
+
if (SKIP[c.tagName]) continue;
|
|
84091
|
+
if (c.hasAttribute(KEY)) { out.push(c); continue; }
|
|
84092
|
+
if (c.matches(LANDMARK)) {
|
|
84093
|
+
if (c.querySelector('[' + KEY + ']')) walk(c); else out.push(c);
|
|
84094
|
+
continue;
|
|
84095
|
+
}
|
|
84096
|
+
walk(c);
|
|
84097
|
+
}
|
|
84098
|
+
})(doc.body || doc.documentElement);
|
|
84099
|
+
return out;
|
|
84100
|
+
}
|
|
84101
|
+
function ownId(el) {
|
|
84102
|
+
var k = el.getAttribute(KEY);
|
|
84103
|
+
return k ? 'k:' + k : 't:' + el.tagName.toLowerCase() + ':' + (el.getAttribute('role') || '');
|
|
84104
|
+
}
|
|
84105
|
+
function innerKeys(el) {
|
|
84106
|
+
var seen = {};
|
|
84107
|
+
var keys = [];
|
|
84108
|
+
var nodes = el.querySelectorAll('[' + KEY + ']');
|
|
84109
|
+
for (var i = 0; i < nodes.length && keys.length < 6; i++) {
|
|
84110
|
+
var k = nodes[i].getAttribute(KEY);
|
|
84111
|
+
if (k && !seen[k]) { seen[k] = 1; keys.push(k); }
|
|
84112
|
+
}
|
|
84113
|
+
return keys;
|
|
84114
|
+
}
|
|
84115
|
+
function keysOf(el) {
|
|
84116
|
+
var inner = innerKeys(el);
|
|
84117
|
+
if (inner.length) return inner;
|
|
84118
|
+
var own = el.getAttribute(KEY);
|
|
84119
|
+
return own ? [own] : [];
|
|
84120
|
+
}
|
|
84121
|
+
function nameOf(el, keys) {
|
|
84122
|
+
if (keys.length) return keys[0].split('/').pop().replace(/\\.(tsx|ts|jsx|js|mjs)$/i, '');
|
|
84123
|
+
return landmarkOf(el) || el.tagName.toLowerCase();
|
|
84124
|
+
}
|
|
84125
|
+
function metrics(el) {
|
|
84126
|
+
var buf = '';
|
|
84127
|
+
var links = 0, images = 0, inputs = 0;
|
|
84128
|
+
(function walk(n) {
|
|
84129
|
+
for (var c = n.firstChild; c; c = c.nextSibling) {
|
|
84130
|
+
if (c.nodeType === 3) { buf += ' ' + c.nodeValue; continue; }
|
|
84131
|
+
if (c.nodeType !== 1 || SKIP[c.tagName]) continue;
|
|
84132
|
+
var t = c.tagName;
|
|
84133
|
+
if (t === 'A' && c.hasAttribute('href')) links++;
|
|
84134
|
+
else if (t === 'IMG' || t === 'VIDEO') images++;
|
|
84135
|
+
else if (t === 'SELECT' || t === 'TEXTAREA' || (t === 'INPUT' && c.getAttribute('type') !== 'hidden')) inputs++;
|
|
84136
|
+
walk(c);
|
|
84137
|
+
}
|
|
84138
|
+
})(el);
|
|
84139
|
+
return { text: buf.replace(/\\s+/g, ' ').trim().length, links: links, images: images, inputs: inputs };
|
|
84140
|
+
}
|
|
84141
|
+
// A modal, drawer, consent bar or chat bubble: a fixed layer that is bottom-anchored or covers
|
|
84142
|
+
// at least half the viewport (a fixed TOP header is neither). It is client-only by nature and
|
|
84143
|
+
// click-blocker-parity's business, not a section whose server rendering the user waits for.
|
|
84144
|
+
function isLayer(el, r, cs) {
|
|
84145
|
+
if (el.tagName === 'DIALOG' || el.getAttribute('role') === 'dialog' || el.getAttribute('aria-modal') === 'true') return true;
|
|
84146
|
+
if (cs.position !== 'fixed') return false;
|
|
84147
|
+
var w = Math.max(0, Math.min(r.right, vw) - Math.max(r.left, 0));
|
|
84148
|
+
var h = Math.max(0, Math.min(r.bottom, vh) - Math.max(r.top, 0));
|
|
84149
|
+
return r.top > vh * 0.5 || (vw * vh > 0 && (w * h) / (vw * vh) >= 0.5);
|
|
84150
|
+
}
|
|
84151
|
+
// A section wrapper can be 0px tall while its content is positioned out of flow (an absolute or
|
|
84152
|
+
// fixed header over the hero: seen on a real storefront, where the keyed header section measured
|
|
84153
|
+
// 0x1440 and the header inside it 134px). With no box of its own, the section is where its
|
|
84154
|
+
// content is: its landmark's box, else the union of its visible descendants' boxes (a menu panel
|
|
84155
|
+
// that is hidden or transparent has a box and must not widen it), layers excluded.
|
|
84156
|
+
function boxOf(el, cs) {
|
|
84157
|
+
var own = el.getBoundingClientRect();
|
|
84158
|
+
if (cs.display !== 'contents' && own.width * own.height > 0) return own;
|
|
84159
|
+
var lm = el.querySelector(LANDMARK);
|
|
84160
|
+
if (lm) {
|
|
84161
|
+
var lr = lm.getBoundingClientRect();
|
|
84162
|
+
if (lr.width * lr.height > 0 && !isLayer(lm, lr, getComputedStyle(lm))) return lr;
|
|
84163
|
+
}
|
|
84164
|
+
var l = 1e9, t = 1e9, r = -1e9, b = -1e9;
|
|
84165
|
+
var nodes = el.querySelectorAll('*');
|
|
84166
|
+
var layers = [];
|
|
84167
|
+
for (var i = 0; i < nodes.length && i < 300; i++) {
|
|
84168
|
+
// Document order: a layer is seen before its children, which are part of it.
|
|
84169
|
+
if (layers.some(function (L) { return L.contains(nodes[i]); })) continue;
|
|
84170
|
+
var cr = nodes[i].getBoundingClientRect();
|
|
84171
|
+
if (cr.width * cr.height <= 0) continue;
|
|
84172
|
+
var ncs = getComputedStyle(nodes[i]);
|
|
84173
|
+
if (isLayer(nodes[i], cr, ncs)) { layers.push(nodes[i]); continue; }
|
|
84174
|
+
if (ncs.visibility === 'hidden' || ncs.opacity === '0') continue;
|
|
84175
|
+
l = Math.min(l, cr.left); t = Math.min(t, cr.top); r = Math.max(r, cr.right); b = Math.max(b, cr.bottom);
|
|
84176
|
+
}
|
|
84177
|
+
return r < l ? own : { left: l, top: t, right: r, bottom: b };
|
|
84178
|
+
}
|
|
84179
|
+
|
|
84180
|
+
var rawDoc = new DOMParser().parseFromString(arg.raw, 'text/html');
|
|
84181
|
+
var rawCands = collect(rawDoc);
|
|
84182
|
+
var rawById = {};
|
|
84183
|
+
rawCands.forEach(function (el) { (rawById[ownId(el)] = rawById[ownId(el)] || []).push(el); });
|
|
84184
|
+
var used = [];
|
|
84185
|
+
var seenOwn = {};
|
|
84186
|
+
|
|
84187
|
+
function serverCounterpart(el, keys) {
|
|
84188
|
+
var id = ownId(el);
|
|
84189
|
+
var n = seenOwn[id] || 0;
|
|
84190
|
+
seenOwn[id] = n + 1;
|
|
84191
|
+
var hit = rawById[id] && rawById[id][n];
|
|
84192
|
+
if (!hit) {
|
|
84193
|
+
hit = rawCands.filter(function (r) {
|
|
84194
|
+
return used.indexOf(r) < 0 && keysOf(r).some(function (k) { return keys.indexOf(k) >= 0; });
|
|
84195
|
+
})[0];
|
|
84196
|
+
}
|
|
84197
|
+
var lm = landmarkOf(el);
|
|
84198
|
+
if (!hit && lm) hit = rawCands.filter(function (r) { return used.indexOf(r) < 0 && landmarkOf(r) === lm; })[0];
|
|
84199
|
+
if (hit) used.push(hit);
|
|
84200
|
+
return hit ? metrics(hit) : null;
|
|
84201
|
+
}
|
|
84202
|
+
|
|
84203
|
+
var sections = [];
|
|
84204
|
+
collect(document).forEach(function (el) {
|
|
84205
|
+
var keys = keysOf(el);
|
|
84206
|
+
// Counted before any exclusion so the n-th-own-key pairing stays aligned with the server HTML.
|
|
84207
|
+
var server = serverCounterpart(el, keys);
|
|
84208
|
+
var cs = getComputedStyle(el);
|
|
84209
|
+
var share = 0;
|
|
84210
|
+
if (cs.display !== 'none' && cs.visibility !== 'hidden') {
|
|
84211
|
+
var r = boxOf(el, cs);
|
|
84212
|
+
if (isLayer(el, r, cs)) return;
|
|
84213
|
+
var w = Math.max(0, Math.min(r.right, vw) - Math.max(r.left, 0));
|
|
84214
|
+
var h = Math.max(0, Math.min(r.bottom, vh) - Math.max(r.top, 0));
|
|
84215
|
+
share = vw * vh > 0 ? Math.round((w * h) / (vw * vh) * 1000) / 1000 : 0;
|
|
84216
|
+
}
|
|
84217
|
+
sections.push({
|
|
84218
|
+
name: nameOf(el, keys),
|
|
84219
|
+
keys: keys,
|
|
84220
|
+
landmark: landmarkOf(el),
|
|
84221
|
+
share: share,
|
|
84222
|
+
final: metrics(el),
|
|
84223
|
+
server: server
|
|
84224
|
+
});
|
|
84225
|
+
});
|
|
84226
|
+
// In-viewport sections first: the cap must never drop the part the check is about.
|
|
84227
|
+
sections = sections
|
|
84228
|
+
.map(function (s, i) { return { s: s, i: i }; })
|
|
84229
|
+
.sort(function (a, b) { return (b.s.share > 0) - (a.s.share > 0) || a.i - b.i; })
|
|
84230
|
+
.map(function (x) { return x.s; })
|
|
84231
|
+
.slice(0, arg.maxSections);
|
|
84232
|
+
return { viewportWidth: vw, viewportHeight: vh, serverChars: arg.raw.length, sections: sections };
|
|
84233
|
+
})`;
|
|
84234
|
+
var MAX_RAW_CHARS = 8000000;
|
|
84235
|
+
function sameDocument(a, b) {
|
|
84236
|
+
try {
|
|
84237
|
+
const x = new URL(a);
|
|
84238
|
+
const y = new URL(b);
|
|
84239
|
+
return x.origin === y.origin && x.pathname === y.pathname && x.search === y.search;
|
|
84240
|
+
} catch {
|
|
84241
|
+
return false;
|
|
84242
|
+
}
|
|
84243
|
+
}
|
|
84244
|
+
async function readFirstViewportProbe(page, response) {
|
|
84245
|
+
try {
|
|
84246
|
+
if (!response || !sameDocument(response.url(), page.url()))
|
|
84247
|
+
return;
|
|
84248
|
+
const raw = await response.text().catch(() => null);
|
|
84249
|
+
if (!raw || raw.length > MAX_RAW_CHARS)
|
|
84250
|
+
return;
|
|
84251
|
+
return await page.evaluate(`${FIRST_VIEWPORT_PROBE_SOURCE}(${JSON.stringify({
|
|
84252
|
+
raw,
|
|
84253
|
+
maxSections: TOLERANCES.firstViewportSsr.maxSections.value
|
|
84254
|
+
})})`).catch(() => {
|
|
84255
|
+
return;
|
|
84256
|
+
}) ?? undefined;
|
|
84257
|
+
} catch {
|
|
84258
|
+
return;
|
|
84259
|
+
}
|
|
84260
|
+
}
|
|
84261
|
+
|
|
83833
84262
|
// src/engine/vitals-warm.ts
|
|
83834
84263
|
var VITALS_WARM_LOADS = 1;
|
|
83835
84264
|
var VITALS_WARM_TIMEOUT_MS = 15000;
|
|
@@ -84415,6 +84844,7 @@ async function capturePage(page, opts) {
|
|
|
84415
84844
|
xRobotsTag,
|
|
84416
84845
|
pairKey: opts.pairKey,
|
|
84417
84846
|
...clickProbe ? { clickProbe } : {},
|
|
84847
|
+
...firstViewport ? { firstViewport } : {},
|
|
84418
84848
|
...response ? { variant: fingerprintVariant(html, response.headers(), cookieNames) } : {}
|
|
84419
84849
|
});
|
|
84420
84850
|
let cookieNames = [];
|
|
@@ -84425,6 +84855,7 @@ async function capturePage(page, opts) {
|
|
|
84425
84855
|
let vitalsStats;
|
|
84426
84856
|
let vitalsFullPage = null;
|
|
84427
84857
|
let clickProbe;
|
|
84858
|
+
let firstViewport;
|
|
84428
84859
|
let html = "";
|
|
84429
84860
|
const readVitals = async () => {
|
|
84430
84861
|
dlog(opts.side, opts.viewport, ` capturePage: vitals evaluate (cap=${Math.min(5000, remaining())}ms)`);
|
|
@@ -84437,6 +84868,10 @@ async function capturePage(page, opts) {
|
|
|
84437
84868
|
readClickProbe(page),
|
|
84438
84869
|
new Promise((resolve) => setTimeout(() => resolve(undefined), Math.min(3000, remaining())))
|
|
84439
84870
|
]) : undefined;
|
|
84871
|
+
const readFirstViewportCapped = async () => response ? await Promise.race([
|
|
84872
|
+
readFirstViewportProbe(page, response),
|
|
84873
|
+
new Promise((resolve) => setTimeout(() => resolve(undefined), Math.min(4000, remaining())))
|
|
84874
|
+
]) : undefined;
|
|
84440
84875
|
let _resolveDisconnect;
|
|
84441
84876
|
const disconnectPromise = new Promise((r) => {
|
|
84442
84877
|
_resolveDisconnect = r;
|
|
@@ -84474,6 +84909,7 @@ async function capturePage(page, opts) {
|
|
|
84474
84909
|
await page.waitForTimeout(Math.min(opts.settleMs ?? 1200, remaining()));
|
|
84475
84910
|
vitals = await readVitals();
|
|
84476
84911
|
clickProbe = await readClickProbeCapped();
|
|
84912
|
+
firstViewport = await readFirstViewportCapped();
|
|
84477
84913
|
} else {
|
|
84478
84914
|
dlog(opts.side, opts.viewport, ` capturePage: waitForLoadState('load') (cap=${Math.min(12000, remaining())}ms)`);
|
|
84479
84915
|
await page.waitForLoadState("load", { timeout: Math.min(12000, remaining()) }).catch(() => {
|
|
@@ -84489,6 +84925,7 @@ async function capturePage(page, opts) {
|
|
|
84489
84925
|
await page.waitForTimeout(Math.min(opts.settleMs ?? 2000, remaining()));
|
|
84490
84926
|
vitals = await readVitals();
|
|
84491
84927
|
clickProbe = await readClickProbeCapped();
|
|
84928
|
+
firstViewport = await readFirstViewportCapped();
|
|
84492
84929
|
if (opts.scrollToLoad !== false && remaining() > 3000) {
|
|
84493
84930
|
const scrollBudget = Math.min(45000, remaining());
|
|
84494
84931
|
dlog(opts.side, opts.viewport, ` capturePage: scrollFullPage start (budget=${scrollBudget}ms, remaining=${remaining()}ms)`);
|
|
@@ -89426,7 +89863,7 @@ async function compareViewport(browser, args) {
|
|
|
89426
89863
|
repeatPath: null
|
|
89427
89864
|
})
|
|
89428
89865
|
]);
|
|
89429
|
-
return
|
|
89866
|
+
return judgePair3({
|
|
89430
89867
|
spec,
|
|
89431
89868
|
paths,
|
|
89432
89869
|
prod: prod.side,
|
|
@@ -89487,7 +89924,7 @@ function artifactPaths(outDir, prefix, label) {
|
|
|
89487
89924
|
candMasked: at("cand-masked")
|
|
89488
89925
|
};
|
|
89489
89926
|
}
|
|
89490
|
-
function
|
|
89927
|
+
function judgePair3(args) {
|
|
89491
89928
|
const { spec, paths, prod, cand } = args;
|
|
89492
89929
|
const base = {
|
|
89493
89930
|
label: spec.label,
|
|
@@ -90239,7 +90676,7 @@ async function visualRegressionKeyframes(ctx) {
|
|
|
90239
90676
|
const prod = prodProbe ?? unprobed("prod");
|
|
90240
90677
|
const cand = candProbe ?? unprobed("cand");
|
|
90241
90678
|
const prefix = `heatmap-${hashSelector(pair.key)}`;
|
|
90242
|
-
const r =
|
|
90679
|
+
const r = judgePair3({
|
|
90243
90680
|
spec: { label: pair.viewport, viewport: pair.viewport, size: null },
|
|
90244
90681
|
paths: artifactPaths(diffDir, prefix, pair.viewport),
|
|
90245
90682
|
prod: prod.side,
|
|
@@ -90523,6 +90960,7 @@ function webVitalsMobile(ctx) {
|
|
|
90523
90960
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
90524
90961
|
const mobilePairs = pairs.filter((p) => p.viewport === "mobile");
|
|
90525
90962
|
const issues = [];
|
|
90963
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
90526
90964
|
for (const pair of mobilePairs) {
|
|
90527
90965
|
const diff = diffVitals(pair.prod.vitals, pair.cand.vitals, DEFAULT_THRESHOLDS);
|
|
90528
90966
|
if (!diff.anyFailed)
|
|
@@ -90533,7 +90971,7 @@ function webVitalsMobile(ctx) {
|
|
|
90533
90971
|
return `${k.toUpperCase()}: prod=${fmt(v.prod)}, cand=${fmt(v.cand)} (${v.reason})`;
|
|
90534
90972
|
}).join(`
|
|
90535
90973
|
`);
|
|
90536
|
-
|
|
90974
|
+
const regression = {
|
|
90537
90975
|
id: `vitals:${pair.key}`,
|
|
90538
90976
|
severity: "high",
|
|
90539
90977
|
category: "performance",
|
|
@@ -90545,11 +90983,13 @@ function webVitalsMobile(ctx) {
|
|
|
90545
90983
|
{ kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
|
|
90546
90984
|
{ kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
|
|
90547
90985
|
]
|
|
90548
|
-
}
|
|
90986
|
+
};
|
|
90987
|
+
issues.push(devServer ? asDevServerInconclusive(regression) : regression);
|
|
90549
90988
|
}
|
|
90989
|
+
const live = issues.filter((i) => !i.inconclusive);
|
|
90550
90990
|
return {
|
|
90551
90991
|
name: "web-vitals-mobile",
|
|
90552
|
-
status:
|
|
90992
|
+
status: live.length > 0 ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
90553
90993
|
severity: "high",
|
|
90554
90994
|
durationMs: Date.now() - start,
|
|
90555
90995
|
summary: `${mobilePairs.length} página(s) mobile, ${issues.length} regressão(ões)`,
|
|
@@ -90580,6 +91020,7 @@ var consoleErrorsBaseline2 = withCapturedPairs(consoleErrorsBaseline);
|
|
|
90580
91020
|
var redirectsParity2 = withCapturedPairs(redirectsParity);
|
|
90581
91021
|
var thirdPartyScriptsParity2 = withCapturedPairs(thirdPartyScriptsParity);
|
|
90582
91022
|
var clickBlockerParity2 = withCapturedPairs(clickBlockerParity);
|
|
91023
|
+
var firstViewportSsr2 = withCapturedPairs(firstViewportSsr);
|
|
90583
91024
|
var imageLoadingHealth2 = withHtmlSnapshot(imageLoadingHealth);
|
|
90584
91025
|
var lazySectionPresence2 = withHtmlSnapshot(lazySectionPresence);
|
|
90585
91026
|
var metaSeoParity2 = withHtmlSnapshot(metaSeoParity);
|
|
@@ -90613,6 +91054,7 @@ var ALL_CHECKS = [
|
|
|
90613
91054
|
notFoundParity2,
|
|
90614
91055
|
cookieCepModalCls2,
|
|
90615
91056
|
clickBlockerParity2,
|
|
91057
|
+
firstViewportSsr2,
|
|
90616
91058
|
pdpGalleryRelated2,
|
|
90617
91059
|
footerLinksHealth2,
|
|
90618
91060
|
loginFlow,
|
|
@@ -90656,6 +91098,7 @@ var ALL_CHECKS_BY_NAME = {
|
|
|
90656
91098
|
"not-found-parity": notFoundParity2,
|
|
90657
91099
|
"cookie-cep-modal-cls": cookieCepModalCls2,
|
|
90658
91100
|
"click-blocker-parity": clickBlockerParity2,
|
|
91101
|
+
"first-viewport-ssr": firstViewportSsr2,
|
|
90659
91102
|
"pdp-gallery-related": pdpGalleryRelated2,
|
|
90660
91103
|
"footer-links-health": footerLinksHealth2,
|
|
90661
91104
|
"login-flow": loginFlow,
|
|
@@ -90803,7 +91246,7 @@ var MODULES = {
|
|
|
90803
91246
|
},
|
|
90804
91247
|
html: {
|
|
90805
91248
|
name: "html",
|
|
90806
|
-
description: "HTML structure — structural diff, lazy sections, image loading health, missing picture dimensions, editorial content structure",
|
|
91249
|
+
description: "HTML structure — structural diff, lazy sections, first-viewport content in the server response, image loading health, missing picture dimensions, editorial content structure",
|
|
90807
91250
|
checks: [
|
|
90808
91251
|
"html-structural-diff",
|
|
90809
91252
|
"lazy-section-presence",
|
|
@@ -90811,6 +91254,7 @@ var MODULES = {
|
|
|
90811
91254
|
"picture-missing-dims",
|
|
90812
91255
|
"font-parity",
|
|
90813
91256
|
"ssr-no-js",
|
|
91257
|
+
"first-viewport-ssr",
|
|
90814
91258
|
"section-order-parity",
|
|
90815
91259
|
"content-structure"
|
|
90816
91260
|
],
|
|
@@ -91002,6 +91446,26 @@ var ClickProbe = z2.object({
|
|
|
91002
91446
|
viewportHeight: z2.number(),
|
|
91003
91447
|
points: z2.array(ClickProbePoint)
|
|
91004
91448
|
});
|
|
91449
|
+
var SectionContent = z2.object({
|
|
91450
|
+
text: z2.number(),
|
|
91451
|
+
links: z2.number(),
|
|
91452
|
+
images: z2.number(),
|
|
91453
|
+
inputs: z2.number()
|
|
91454
|
+
});
|
|
91455
|
+
var FirstViewportSection = z2.object({
|
|
91456
|
+
name: z2.string(),
|
|
91457
|
+
keys: z2.array(z2.string()),
|
|
91458
|
+
landmark: z2.string().nullable(),
|
|
91459
|
+
share: z2.number(),
|
|
91460
|
+
final: SectionContent,
|
|
91461
|
+
server: SectionContent.nullable()
|
|
91462
|
+
});
|
|
91463
|
+
var FirstViewportProbe = z2.object({
|
|
91464
|
+
viewportWidth: z2.number(),
|
|
91465
|
+
viewportHeight: z2.number(),
|
|
91466
|
+
serverChars: z2.number(),
|
|
91467
|
+
sections: z2.array(FirstViewportSection)
|
|
91468
|
+
});
|
|
91005
91469
|
var PageCapture = z2.object({
|
|
91006
91470
|
url: z2.string(),
|
|
91007
91471
|
finalUrl: z2.string(),
|
|
@@ -91027,7 +91491,8 @@ var PageCapture = z2.object({
|
|
|
91027
91491
|
pass: z2.enum(["extra", "visual"]).optional(),
|
|
91028
91492
|
variant: VariantFingerprint.optional(),
|
|
91029
91493
|
retried: z2.boolean().optional(),
|
|
91030
|
-
clickProbe: ClickProbe.optional()
|
|
91494
|
+
clickProbe: ClickProbe.optional(),
|
|
91495
|
+
firstViewport: FirstViewportProbe.optional()
|
|
91031
91496
|
});
|
|
91032
91497
|
var StepCapture = z2.object({
|
|
91033
91498
|
step: z2.number(),
|
|
@@ -119055,7 +119520,16 @@ function isColdCandidate(loads) {
|
|
|
119055
119520
|
// src/engine/run-context.ts
|
|
119056
119521
|
function detectRunCaveats(input) {
|
|
119057
119522
|
const out = [];
|
|
119058
|
-
|
|
119523
|
+
const candHost = siteHost(input.candPages);
|
|
119524
|
+
const localBuild = isLocalhost(input.candUrl) && !input.candIsProduction && candHost !== null && isLoopbackHost(candHost) && input.candPages.some((p) => (p.network?.length ?? 0) > 0) && !isCandDevServer(input.candPages, input.candIsProduction);
|
|
119525
|
+
if (localBuild) {
|
|
119526
|
+
out.push({
|
|
119527
|
+
id: "cand-local-build",
|
|
119528
|
+
level: "info",
|
|
119529
|
+
summary: "Candidato servido localmente, sem sinais de dev server",
|
|
119530
|
+
detail: "Nenhum marcador de dev server (HMR, módulos sem bundle) nas capturas: cache, volume de requests e vitals foram julgados como num host remoto. Se este local é na verdade um dev server, os números de performance não são representativos."
|
|
119531
|
+
});
|
|
119532
|
+
} else if (isLocalhost(input.candUrl)) {
|
|
119059
119533
|
out.push({
|
|
119060
119534
|
id: "cand-dev-server",
|
|
119061
119535
|
level: "warn",
|
|
@@ -122944,11 +123418,11 @@ function L2(pt, en, lang) {
|
|
|
122944
123418
|
const initial = lang === "pt" ? pt : en;
|
|
122945
123419
|
return `<span class="i18n" data-pt="${esc3(pt)}" data-en="${esc3(en)}">${esc3(initial)}</span>`;
|
|
122946
123420
|
}
|
|
122947
|
-
function
|
|
123421
|
+
function T2(text, lang) {
|
|
122948
123422
|
return L2(text.pt, text.en, lang);
|
|
122949
123423
|
}
|
|
122950
123424
|
function tiles(items, lang) {
|
|
122951
|
-
const cells = items.map((t) => `<div class="tile"><div class="tile-val ${TONE_CLASS[t.tone]}">${esc3(t.value)}</div><div class="tile-label">${
|
|
123425
|
+
const cells = items.map((t) => `<div class="tile"><div class="tile-val ${TONE_CLASS[t.tone]}">${esc3(t.value)}</div><div class="tile-label">${T2(t.label, lang)}</div>${t.sub ? `<div class="tile-sub">${T2(t.sub, lang)}</div>` : ""}</div>`).join("");
|
|
122952
123426
|
return `<div class="stat-grid">${cells}</div>`;
|
|
122953
123427
|
}
|
|
122954
123428
|
function page(eyebrow, title, body, note) {
|
|
@@ -125404,9 +125878,10 @@ function lighthouseOpportunities(ctx) {
|
|
|
125404
125878
|
}
|
|
125405
125879
|
const deltas = diffOpportunities(ctx.prodPages, ctx.candPages);
|
|
125406
125880
|
const reportable = deltas.filter((d) => opportunitySeverity(d.cand.savingsMs) !== "low");
|
|
125881
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
125407
125882
|
const issues = reportable.map((d) => {
|
|
125408
125883
|
const sev = opportunitySeverity(d.cand.savingsMs);
|
|
125409
|
-
|
|
125884
|
+
const issue = {
|
|
125410
125885
|
id: `lh:${d.cand.id}`,
|
|
125411
125886
|
severity: d.regression && sev === "medium" ? "high" : sev,
|
|
125412
125887
|
category: "performance",
|
|
@@ -125414,6 +125889,7 @@ function lighthouseOpportunities(ctx) {
|
|
|
125414
125889
|
summary: `${d.cand.title} — ${fmtMs2(d.cand.savingsMs)} recuperáveis${d.regression ? " (regressão: prod não tem, ou tem bem menos)" : ""}`,
|
|
125415
125890
|
details: buildDetails(d.cand, d.prod, d.regression)
|
|
125416
125891
|
};
|
|
125892
|
+
return devServer ? asDevServerInconclusive(issue) : issue;
|
|
125417
125893
|
});
|
|
125418
125894
|
const dropped = deltas.length - reportable.length;
|
|
125419
125895
|
const worst = reportable[0]?.cand;
|
|
@@ -125425,7 +125901,7 @@ function lighthouseOpportunities(ctx) {
|
|
|
125425
125901
|
].filter(Boolean);
|
|
125426
125902
|
return {
|
|
125427
125903
|
name,
|
|
125428
|
-
status: issues.length > 0 ? "
|
|
125904
|
+
status: issues.some((i) => !i.inconclusive) ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
125429
125905
|
severity: "medium",
|
|
125430
125906
|
durationMs: Date.now() - start,
|
|
125431
125907
|
summary: summaryParts.join(", "),
|
|
@@ -125468,6 +125944,7 @@ function lighthouseScores(ctx) {
|
|
|
125468
125944
|
const start = Date.now();
|
|
125469
125945
|
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
125470
125946
|
const issues = [];
|
|
125947
|
+
const devServer = isCandDevServer(ctx.candPages, ctx.candIsProduction);
|
|
125471
125948
|
for (const pair of pairs) {
|
|
125472
125949
|
const prod = pair.prod.lhScores;
|
|
125473
125950
|
const cand = pair.cand.lhScores;
|
|
@@ -125481,7 +125958,7 @@ function lighthouseScores(ctx) {
|
|
|
125481
125958
|
const delta = c - p;
|
|
125482
125959
|
if (delta >= -REGRESSION_DELTA)
|
|
125483
125960
|
continue;
|
|
125484
|
-
|
|
125961
|
+
const regression = {
|
|
125485
125962
|
id: `lh-score:${key}:${pair.key}`,
|
|
125486
125963
|
severity: -delta >= TOLERANCES.vitals.lighthouseScoreHighDrop.value ? "high" : "medium",
|
|
125487
125964
|
category: key === "seo" ? "seo" : key === "accessibility" ? "a11y" : "performance",
|
|
@@ -125489,13 +125966,14 @@ function lighthouseScores(ctx) {
|
|
|
125489
125966
|
check: "lighthouse-scores",
|
|
125490
125967
|
summary: `${label} regrediu em ${pair.key}: cand ${c} vs prod ${p} (${delta})`,
|
|
125491
125968
|
details: `Objetivo da migração é igual ou melhor. ${label}: prod=${p}, cand=${c}. Recupere pelo menos o nível de prod.`
|
|
125492
|
-
}
|
|
125969
|
+
};
|
|
125970
|
+
issues.push(devServer && key === "performance" ? asDevServerInconclusive(regression) : regression);
|
|
125493
125971
|
}
|
|
125494
125972
|
}
|
|
125495
125973
|
const hasScores = pairs.some((p) => p.prod.lhScores && p.cand.lhScores);
|
|
125496
125974
|
return {
|
|
125497
125975
|
name: "lighthouse-scores",
|
|
125498
|
-
status: !hasScores ? "skipped" : issues.length > 0 ? "
|
|
125976
|
+
status: !hasScores ? "skipped" : issues.some((i) => !i.inconclusive) ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
125499
125977
|
severity: "medium",
|
|
125500
125978
|
durationMs: Date.now() - start,
|
|
125501
125979
|
summary: !hasScores ? "Sem scores Lighthouse (rode sem --no-lighthouse)" : `${pairs.length} página(s), ${issues.length} regressão(ões) de categoria`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.33",
|
|
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",
|