@geonosis/walk 3.9.0 → 3.10.0
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 +12 -0
- package/README.md +23 -5
- package/bin/geonosis-walk.mjs +1 -1
- package/dist/browser.d.ts +14 -0
- package/dist/browser.js +294 -0
- package/dist/probes/index.js +3 -1
- package/dist/probes/undefined-custom-property.d.ts +1 -0
- package/dist/probes/undefined-custom-property.js +17 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +2 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @geonosis/walk
|
|
2
2
|
|
|
3
|
+
## 3.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7568e59: An `undefined-custom-property` probe, filed under a class of its own. It reads every `var(--name)` with no fallback in the page's style rules and `style` attributes through the browser's CSSOM, shorthands included, and in the stylesheets, adopted stylesheets and `style` attributes of every open shadow root, and reports each declaration whose `--name` has no value on an element the rule styles: the selector, the property, and what the property computes to instead. A rule on a pseudo-element is judged on the pseudo-element: a `::before` or `::after` only where it generates a box, a `::marker` only on a list item, and a `::part()` or `::slotted()` rule on the elements it reaches. An undefined name makes the declaration invalid at computed-value time, so an SVG `fill` paints black and a `stroke` paints nothing while every other probe passes. It needs no list, so a walk that names no probes now runs it. A custom property declared from a missing one is reported where a property reads it, a name a stylesheet registers with `@property` counts as defined, as Tailwind 4's composed utilities need, and a stylesheet from another origin that the page may not read is skipped while what it defines still counts.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [fb92561]
|
|
12
|
+
- Updated dependencies [6dc667c]
|
|
13
|
+
- @geonosis/base@3.10.0
|
|
14
|
+
|
|
3
15
|
## 3.9.0
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Through the front door: `geonosis walk` — the metapackage pins this and every other kit tool at ONE
|
|
4
4
|
version, and passes the exit code through unchanged.
|
|
5
5
|
|
|
6
|
-
The customer walk as a gate.
|
|
6
|
+
The customer walk as a gate. Fifteen computed-DOM probes and an `axe` probe over a list of URLs,
|
|
7
7
|
one JSON report, and an exit code that tells a run that could not happen from a page that was clean.
|
|
8
8
|
|
|
9
9
|
It exists because a screenshot lies. A cream chip on a cream page photographs exactly like a chip
|
|
@@ -61,6 +61,7 @@ counter reads, is left absent.
|
|
|
61
61
|
| `empty-section` | A container carrying a heading and no body text and no media — a promise with nothing under it. | **`selector`** |
|
|
62
62
|
| `money-format` | Money-shaped strings in the page's text nodes, against the shapes this repo accepts. `£24` beside `£24.00` is two answers to what a price looks like here. | **`accept`** |
|
|
63
63
|
| `orphan-url` | Which walked URLs nothing in the walk links to. The one probe with a report-level half: `run` records each page's links, `finish` names the pages nothing pointed at. | nothing (`entry` lists the deliberately unlinked) |
|
|
64
|
+
| `undefined-custom-property` | Every `var(--name)` with no fallback in the page's style rules and `style` attributes, as the browser parsed them (the CSSOM and its Typed OM, shorthands included), judged on each element the rule styles. A name with no value there (`computedStyleMap().has`) makes the declaration invalid at computed-value time: an SVG `fill` paints black and a `stroke` paints nothing. Inheritance, `style` attributes and values a script set all count, because the element's computed style holds them, and so does a name a stylesheet registers with `@property`. | nothing |
|
|
64
65
|
| `stillness` | A layout-shift observer installed before the first paint, read after a scroll through the page; each control's box and the page's height before and during a hover; `scrollWidth` against the viewport; console errors, uncaught errors and failed requests. Fires on any shift, any hover that moves or resizes a control or changes the page's height, any horizontal overflow, and any error. | nothing (`hover` is a selector, `ignore` a list of patterns); runs only when named |
|
|
65
66
|
| `axe` | Deque's axe rules, run through `@axe-core/playwright` on the page as rendered. One finding per violated rule, at the rule's impact. | **`@axe-core/playwright`**, an optional peer |
|
|
66
67
|
|
|
@@ -100,6 +101,22 @@ so list it last in `probes`: a page that mounts content on scroll reads differen
|
|
|
100
101
|
after it. A status the walk list declares stays `link-integrity`'s and `error-page-status`'s to
|
|
101
102
|
judge, and the page's own document is not counted as a failed request.
|
|
102
103
|
|
|
104
|
+
`undefined-custom-property` judges the declarations that paint. A custom property declared from a
|
|
105
|
+
missing one (`--rule: var(--green-300)`) is reported where a property reads `--rule`, not where it
|
|
106
|
+
is declared. A name a stylesheet registers with `@property` counts as defined on every element,
|
|
107
|
+
with or without an initial value: the registration says the name exists, and Tailwind 4 registers
|
|
108
|
+
the variables its utilities compose (`--tw-gradient-stops`) with none, so a gradient whose stops
|
|
109
|
+
come on `:hover` or at `md:` reads as designed. A walk of a page of Tailwind 4.3.5 utilities found
|
|
110
|
+
nothing, and found a renamed token planted beside them. A rule is judged when its selector matches
|
|
111
|
+
an element and its `@media` and `@supports` conditions hold at the walk's viewport, so a rule for a
|
|
112
|
+
pseudo-element (`::before`) or a state (`:hover`) is not judged. Not judged either: a shorthand that
|
|
113
|
+
a later longhand in the same rule overrides in part (`border: 1px solid var(--x); border-bottom: 0`),
|
|
114
|
+
whose text Chromium 156's CSSOM no longer holds, and the rules of a stylesheet from another origin
|
|
115
|
+
served without CORS, whose definitions still count. Chromium 156's Typed OM reports `var(--x,)`, an
|
|
116
|
+
empty fallback, as no fallback at all, so the declaration's text decides that one.
|
|
117
|
+
`checkCustomProperties` in `@geonosis/site` reads the same names from a build's files before a
|
|
118
|
+
browser runs.
|
|
119
|
+
|
|
103
120
|
## Configuration
|
|
104
121
|
|
|
105
122
|
Everything lives in the `walk` block of `geonosis.json`; the command line wins where they overlap.
|
|
@@ -154,7 +171,7 @@ asks `failIfMajorPerformanceCaveat` even with no graphics processor, which Chrom
|
|
|
154
171
|
false` (or `--no-gpu`) walks as a visitor with no graphics processor, so a page that offers a
|
|
155
172
|
fallback for that refusal is walked on its fallback.
|
|
156
173
|
|
|
157
|
-
With no `probes` the walk runs the
|
|
174
|
+
With no `probes` the walk runs the five that need no list, leaving out `stillness`, which is opt-in.
|
|
158
175
|
A mobile pass is the same command with `--viewport 390x844`.
|
|
159
176
|
|
|
160
177
|
## The report
|
|
@@ -218,11 +235,12 @@ read as still.
|
|
|
218
235
|
|
|
219
236
|
## What this is not
|
|
220
237
|
|
|
221
|
-
A green report is not a clean surface. Twelve of the
|
|
238
|
+
A green report is not a clean surface. Twelve of the fifteen computed-DOM probes came from hand
|
|
222
239
|
audits of one storefront, the largest holding 36 defects; six are reproduced by a probe alone,
|
|
223
240
|
sixteen partially, and fourteen — five product tables that disagree, a cart that re-prices what the
|
|
224
241
|
product page quoted, copy promising a control nobody built, four levels of taxonomy for fourteen
|
|
225
242
|
products — are invisible to any browser probe there could be. Those stay the walker's judgement. The
|
|
226
|
-
thirteenth came from a production incident instead, which is how the list is meant to grow,
|
|
227
|
-
fourteenth from a site's own hand-written walk
|
|
243
|
+
thirteenth came from a production incident instead, which is how the list is meant to grow, the
|
|
244
|
+
fourteenth from a site's own hand-written walk, and the fifteenth from a site whose restyle renamed
|
|
245
|
+
its tokens while its components still read the old names. The reasoning, defect by defect, is in
|
|
228
246
|
[`docs/walk-review-inventory-2026-08-30.md`](../../docs/walk-review-inventory-2026-08-30.md).
|
package/bin/geonosis-walk.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
':' //; if command -v bun >/dev/null 2>&1; then exec bun "$0" "$@"; fi; [ -n "$GEONOSIS_NODE_FALLBACK" ] || echo "geonosis-walk: bun is not on PATH, so this runs on node. To run on bun, add it as a devDependency (npm i -D bun) or install it from https://bun.sh." >&2; export GEONOSIS_NODE_FALLBACK=1; exec node "$0" "$@"; exit 127
|
|
3
|
-
// Generated by
|
|
3
|
+
// Generated by bun run generate:shims. src/ beside dist/ is the kit's own tree, where a stale dist once answered for a fix it did not carry (#62).
|
|
4
4
|
import { existsSync } from 'node:fs'
|
|
5
5
|
|
|
6
6
|
if (existsSync(new URL('../src', import.meta.url))) {
|
package/dist/browser.d.ts
CHANGED
|
@@ -53,6 +53,17 @@ export type ProseHit = {
|
|
|
53
53
|
selector: string;
|
|
54
54
|
words: number;
|
|
55
55
|
};
|
|
56
|
+
export type VariableHit = {
|
|
57
|
+
computed: string;
|
|
58
|
+
elements: number;
|
|
59
|
+
failing: number;
|
|
60
|
+
first: string;
|
|
61
|
+
names: string[];
|
|
62
|
+
property: string;
|
|
63
|
+
selector: string;
|
|
64
|
+
source: string;
|
|
65
|
+
value: string;
|
|
66
|
+
};
|
|
56
67
|
export type Job = {
|
|
57
68
|
assetSelector: string;
|
|
58
69
|
kind: 'assets';
|
|
@@ -91,6 +102,8 @@ export type Job = {
|
|
|
91
102
|
kind: 'matches';
|
|
92
103
|
patterns: string[];
|
|
93
104
|
scope: string;
|
|
105
|
+
} | {
|
|
106
|
+
kind: 'variables';
|
|
94
107
|
};
|
|
95
108
|
export type JobResult = {
|
|
96
109
|
assets: AssetHit[];
|
|
@@ -105,6 +118,7 @@ export type JobResult = {
|
|
|
105
118
|
present: PresentHit[];
|
|
106
119
|
prose: ProseHit[];
|
|
107
120
|
text: TextHit[];
|
|
121
|
+
variables: VariableHit[];
|
|
108
122
|
};
|
|
109
123
|
/** The one cast: the value comes back from another VM, so the discriminant is the contract, covered by the probe tests. */
|
|
110
124
|
export declare const collect: <K extends Job['kind']>(page: Page, job: Extract<Job, {
|
package/dist/browser.js
CHANGED
|
@@ -53,6 +53,29 @@ var inPage = (job) => {
|
|
|
53
53
|
return box.width > 0 && box.height > 0 && getComputedStyle(element).visibility !== "hidden";
|
|
54
54
|
},
|
|
55
55
|
textOf: (element) => element.innerText ?? element.textContent ?? "",
|
|
56
|
+
topLevel: (text, token) => {
|
|
57
|
+
const found = [];
|
|
58
|
+
let depth = 0;
|
|
59
|
+
let quote = "";
|
|
60
|
+
for (let at = 0;at < text.length; at += 1) {
|
|
61
|
+
const char = text[at] ?? "";
|
|
62
|
+
if (quote !== "") {
|
|
63
|
+
if (char === "\\")
|
|
64
|
+
at += 1;
|
|
65
|
+
else if (char === quote)
|
|
66
|
+
quote = "";
|
|
67
|
+
} else if (depth === 0 && text.startsWith(token, at)) {
|
|
68
|
+
found.push(at);
|
|
69
|
+
at += token.length - 1;
|
|
70
|
+
} else if (char === '"' || char === "'")
|
|
71
|
+
quote = char;
|
|
72
|
+
else if (char === "(" || char === "[")
|
|
73
|
+
depth += 1;
|
|
74
|
+
else if (char === ")" || char === "]")
|
|
75
|
+
depth -= 1;
|
|
76
|
+
}
|
|
77
|
+
return found;
|
|
78
|
+
},
|
|
56
79
|
wordsIn: (text) => text.split(/\s+/).filter((one) => one !== "").length
|
|
57
80
|
};
|
|
58
81
|
if (job.kind === "contrast") {
|
|
@@ -249,6 +272,277 @@ var inPage = (job) => {
|
|
|
249
272
|
words: dom.wordsIn(dom.textOf(element))
|
|
250
273
|
}));
|
|
251
274
|
}
|
|
275
|
+
if (job.kind === "variables") {
|
|
276
|
+
const longhands = new Set(getComputedStyle(document.documentElement));
|
|
277
|
+
const scratch = document.createElement("div");
|
|
278
|
+
const names = [];
|
|
279
|
+
for (const key in scratch.style) {
|
|
280
|
+
names.push(key.replaceAll(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`));
|
|
281
|
+
}
|
|
282
|
+
const shorthands = new Map;
|
|
283
|
+
for (const name of names) {
|
|
284
|
+
if (longhands.has(name))
|
|
285
|
+
continue;
|
|
286
|
+
scratch.style.cssText = "";
|
|
287
|
+
scratch.style.setProperty(name, "inherit");
|
|
288
|
+
const covers = [...scratch.style];
|
|
289
|
+
if (covers.length < 2)
|
|
290
|
+
continue;
|
|
291
|
+
const key = covers.join(" ");
|
|
292
|
+
const held = shorthands.get(key);
|
|
293
|
+
if (held === undefined || name.length < held.name.length)
|
|
294
|
+
shorthands.set(key, { covers, name });
|
|
295
|
+
}
|
|
296
|
+
const declared = (property, value) => {
|
|
297
|
+
let parsed;
|
|
298
|
+
try {
|
|
299
|
+
parsed = CSSStyleValue.parse("--geonosis-walk", value);
|
|
300
|
+
} catch {
|
|
301
|
+
return [];
|
|
302
|
+
}
|
|
303
|
+
if (!(parsed instanceof CSSUnparsedValue))
|
|
304
|
+
return [];
|
|
305
|
+
const compact = value.replaceAll(/\s/g, "").replaceAll(/var\(/gi, "var(");
|
|
306
|
+
const referencesIn = (members) => [...members].flatMap((member) => typeof member === "string" ? [] : [
|
|
307
|
+
{
|
|
308
|
+
fallback: member.fallback !== null ? referencesIn(member.fallback) : compact.includes(`var(${member.variable})`) ? null : [],
|
|
309
|
+
variable: member.variable
|
|
310
|
+
}
|
|
311
|
+
]);
|
|
312
|
+
const references = referencesIn(parsed);
|
|
313
|
+
return references.length === 0 ? [] : [{ property, references, value }];
|
|
314
|
+
};
|
|
315
|
+
const declarationsIn = (style) => {
|
|
316
|
+
const pending = new Set;
|
|
317
|
+
const found = [];
|
|
318
|
+
for (const property of style) {
|
|
319
|
+
if (property.startsWith("--"))
|
|
320
|
+
continue;
|
|
321
|
+
const value = style.getPropertyValue(property);
|
|
322
|
+
if (value === "")
|
|
323
|
+
pending.add(property);
|
|
324
|
+
else
|
|
325
|
+
found.push(...declared(property, value));
|
|
326
|
+
}
|
|
327
|
+
if (pending.size === 0)
|
|
328
|
+
return found;
|
|
329
|
+
for (const { covers, name } of shorthands.values()) {
|
|
330
|
+
if (!covers.some((one) => pending.has(one)))
|
|
331
|
+
continue;
|
|
332
|
+
const value = style.getPropertyValue(name);
|
|
333
|
+
if (value !== "")
|
|
334
|
+
found.push(...declared(name, value));
|
|
335
|
+
}
|
|
336
|
+
return found;
|
|
337
|
+
};
|
|
338
|
+
const maps = new Map;
|
|
339
|
+
const definedOn = ({ element, pseudo }, variable) => {
|
|
340
|
+
const held = maps.get(element) ?? new Map;
|
|
341
|
+
maps.set(element, held);
|
|
342
|
+
const known = held.get(pseudo);
|
|
343
|
+
if (known !== undefined)
|
|
344
|
+
return known.has(variable);
|
|
345
|
+
const map = pseudo === "" ? element.computedStyleMap() : new Set(getComputedStyle(element, pseudo));
|
|
346
|
+
held.set(pseudo, map);
|
|
347
|
+
return map.has(variable);
|
|
348
|
+
};
|
|
349
|
+
const registered = new Set;
|
|
350
|
+
const unset = (reference, target) => !registered.has(reference.variable) && !definedOn(target, reference.variable) && (reference.fallback === null || reference.fallback.some((one) => unset(one, target)));
|
|
351
|
+
const missing = (reference, target) => [
|
|
352
|
+
reference.variable,
|
|
353
|
+
...(reference.fallback ?? []).filter((one) => unset(one, target)).flatMap((one) => missing(one, target))
|
|
354
|
+
];
|
|
355
|
+
const where = (element) => {
|
|
356
|
+
const own = dom.selectorOf(element) || element.tagName.toLowerCase();
|
|
357
|
+
const root = element.getRootNode();
|
|
358
|
+
return root instanceof ShadowRoot ? `${where(root.host)} ${own}` : own;
|
|
359
|
+
};
|
|
360
|
+
const hits = [];
|
|
361
|
+
const judge = ({ selector, source, style, targets }) => {
|
|
362
|
+
for (const { property, references, value } of declarationsIn(style)) {
|
|
363
|
+
const failing = targets.filter((target) => references.some((one) => unset(one, target)));
|
|
364
|
+
const first = failing[0];
|
|
365
|
+
if (first === undefined)
|
|
366
|
+
continue;
|
|
367
|
+
hits.push({
|
|
368
|
+
computed: getComputedStyle(first.element, first.pseudo).getPropertyValue(property),
|
|
369
|
+
elements: targets.length,
|
|
370
|
+
failing: failing.length,
|
|
371
|
+
first: `${where(first.element)}${first.pseudo}`,
|
|
372
|
+
names: [
|
|
373
|
+
...new Set(failing.flatMap((target) => references.filter((one) => unset(one, target)).flatMap((one) => missing(one, target))))
|
|
374
|
+
],
|
|
375
|
+
property,
|
|
376
|
+
selector,
|
|
377
|
+
source,
|
|
378
|
+
value
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
const listOf = (selector) => {
|
|
383
|
+
const cuts = dom.topLevel(selector, ",");
|
|
384
|
+
return [-1, ...cuts].map((cut, index) => selector.slice(cut + 1, cuts[index] ?? selector.length).trim());
|
|
385
|
+
};
|
|
386
|
+
const called = (text, name) => {
|
|
387
|
+
if (!text.startsWith(`${name}(`))
|
|
388
|
+
return null;
|
|
389
|
+
const body = text.slice(name.length + 1);
|
|
390
|
+
const close = dom.topLevel(body, ")")[0];
|
|
391
|
+
return close === undefined ? null : { inner: body.slice(0, close), rest: body.slice(close + 1) };
|
|
392
|
+
};
|
|
393
|
+
const matches = (element, selector) => {
|
|
394
|
+
try {
|
|
395
|
+
return element.matches(selector);
|
|
396
|
+
} catch {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
const elementsIn = (scope, complex) => {
|
|
401
|
+
const host = scope.host === null ? null : called(complex, ":host");
|
|
402
|
+
if (scope.host !== null && complex === ":host")
|
|
403
|
+
return [scope.host];
|
|
404
|
+
if (scope.host !== null && host !== null && host.rest === "") {
|
|
405
|
+
return matches(scope.host, host.inner) ? [scope.host] : [];
|
|
406
|
+
}
|
|
407
|
+
try {
|
|
408
|
+
return [...scope.root.querySelectorAll(complex)];
|
|
409
|
+
} catch {
|
|
410
|
+
return [];
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
const generated = ({ element, pseudo }) => {
|
|
414
|
+
if (pseudo === "")
|
|
415
|
+
return true;
|
|
416
|
+
const style = getComputedStyle(element, pseudo);
|
|
417
|
+
if (style.length === 0)
|
|
418
|
+
return false;
|
|
419
|
+
if (pseudo === "::before" || pseudo === "::after")
|
|
420
|
+
return style.content !== "none";
|
|
421
|
+
if (pseudo === "::marker")
|
|
422
|
+
return getComputedStyle(element).display.includes("list-item");
|
|
423
|
+
return true;
|
|
424
|
+
};
|
|
425
|
+
const targetsOf = (scope, selector) => {
|
|
426
|
+
const seen = new Map;
|
|
427
|
+
const targets = [];
|
|
428
|
+
const add = (element, pseudo) => {
|
|
429
|
+
const held = seen.get(element) ?? new Set;
|
|
430
|
+
seen.set(element, held);
|
|
431
|
+
if (held.has(pseudo))
|
|
432
|
+
return;
|
|
433
|
+
held.add(pseudo);
|
|
434
|
+
targets.push({ element, pseudo });
|
|
435
|
+
};
|
|
436
|
+
const reached = (element, rest) => {
|
|
437
|
+
if (rest.startsWith("::"))
|
|
438
|
+
add(element, rest);
|
|
439
|
+
else if (rest === "" || matches(element, rest))
|
|
440
|
+
add(element, "");
|
|
441
|
+
};
|
|
442
|
+
for (const complex of listOf(selector)) {
|
|
443
|
+
const at = dom.topLevel(complex, "::")[0];
|
|
444
|
+
if (at === undefined) {
|
|
445
|
+
for (const element of elementsIn(scope, complex))
|
|
446
|
+
add(element, "");
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
const base = complex.slice(0, at);
|
|
450
|
+
const pseudo = complex.slice(at);
|
|
451
|
+
const part = called(pseudo, "::part");
|
|
452
|
+
const slotted = called(pseudo, "::slotted");
|
|
453
|
+
const originating = base === "" || /[\s>+~]$/.test(base) ? `${base}*` : base;
|
|
454
|
+
for (const element of elementsIn(scope, originating)) {
|
|
455
|
+
if (part !== null) {
|
|
456
|
+
const named = part.inner.trim().split(/\s+/).map((name) => `[part~="${name}"]`).join("");
|
|
457
|
+
for (const inner of element.shadowRoot?.querySelectorAll(named) ?? []) {
|
|
458
|
+
reached(inner, part.rest);
|
|
459
|
+
}
|
|
460
|
+
} else if (slotted !== null) {
|
|
461
|
+
for (const inner of element.assignedElements?.({ flatten: true }) ?? []) {
|
|
462
|
+
if (matches(inner, slotted.inner))
|
|
463
|
+
reached(inner, slotted.rest);
|
|
464
|
+
}
|
|
465
|
+
} else
|
|
466
|
+
add(element, pseudo);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return targets.filter((target) => generated(target));
|
|
470
|
+
};
|
|
471
|
+
const styled = [];
|
|
472
|
+
const scopes = [{ host: null, root: document }];
|
|
473
|
+
for (let index = 0;index < scopes.length; index += 1) {
|
|
474
|
+
for (const element of scopes[index]?.root.querySelectorAll("*") ?? []) {
|
|
475
|
+
if (element.shadowRoot !== null)
|
|
476
|
+
scopes.push({ host: element, root: element.shadowRoot });
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
for (const scope of scopes) {
|
|
480
|
+
const within = scope.host === null ? "" : ` in the shadow root of ${where(scope.host)}`;
|
|
481
|
+
const sheets = [...scope.root.styleSheets, ...scope.root.adoptedStyleSheets];
|
|
482
|
+
const visit = (rules, parent, source) => {
|
|
483
|
+
for (const rule of rules) {
|
|
484
|
+
if (rule instanceof CSSStyleRule) {
|
|
485
|
+
const selector = parent === "" ? rule.selectorText : rule.selectorText.replaceAll("&", `:is(${parent})`);
|
|
486
|
+
styled.push({
|
|
487
|
+
selector,
|
|
488
|
+
source,
|
|
489
|
+
style: rule.style,
|
|
490
|
+
targets: targetsOf(scope, selector)
|
|
491
|
+
});
|
|
492
|
+
visit(rule.cssRules, selector, source);
|
|
493
|
+
} else if (typeof CSSNestedDeclarations === "function" && rule instanceof CSSNestedDeclarations) {
|
|
494
|
+
styled.push({
|
|
495
|
+
selector: parent,
|
|
496
|
+
source,
|
|
497
|
+
style: rule.style,
|
|
498
|
+
targets: targetsOf(scope, parent)
|
|
499
|
+
});
|
|
500
|
+
} else if (rule instanceof CSSPropertyRule) {
|
|
501
|
+
if (scope.host === null)
|
|
502
|
+
registered.add(rule.name);
|
|
503
|
+
} else if (rule instanceof CSSMediaRule) {
|
|
504
|
+
if (matchMedia(rule.conditionText).matches)
|
|
505
|
+
visit(rule.cssRules, parent, source);
|
|
506
|
+
} else if (rule instanceof CSSSupportsRule) {
|
|
507
|
+
if (CSS.supports(rule.conditionText))
|
|
508
|
+
visit(rule.cssRules, parent, source);
|
|
509
|
+
} else if (rule instanceof CSSLayerBlockRule || rule instanceof CSSContainerRule) {
|
|
510
|
+
visit(rule.cssRules, parent, source);
|
|
511
|
+
} else if (rule instanceof CSSImportRule && rule.styleSheet !== null) {
|
|
512
|
+
sheets.push(rule.styleSheet);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
for (let index = 0;index < sheets.length; index += 1) {
|
|
517
|
+
const sheet = sheets[index];
|
|
518
|
+
if (sheet === undefined || sheet.disabled)
|
|
519
|
+
continue;
|
|
520
|
+
const media = sheet.media.mediaText;
|
|
521
|
+
if (media !== "" && !matchMedia(media).matches)
|
|
522
|
+
continue;
|
|
523
|
+
let rules;
|
|
524
|
+
try {
|
|
525
|
+
rules = sheet.cssRules;
|
|
526
|
+
} catch {
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
visit(rules, "", `${sheet.href ?? (sheet.ownerNode === null ? "a constructed stylesheet" : "a <style> element")}${within}`);
|
|
530
|
+
}
|
|
531
|
+
for (const element of scope.root.querySelectorAll("[style]")) {
|
|
532
|
+
styled.push({
|
|
533
|
+
selector: where(element),
|
|
534
|
+
source: `the style attribute${within}`,
|
|
535
|
+
style: element.style,
|
|
536
|
+
targets: [{ element, pseudo: "" }]
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
for (const one of styled) {
|
|
541
|
+
if (one.targets.length > 0)
|
|
542
|
+
judge(one);
|
|
543
|
+
}
|
|
544
|
+
return hits;
|
|
545
|
+
}
|
|
252
546
|
if (job.kind === "present") {
|
|
253
547
|
return job.selectors.map((selector) => ({
|
|
254
548
|
present: document.querySelector(selector) !== null,
|
package/dist/probes/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { placeholderAsset } from "./placeholder-asset.js";
|
|
|
14
14
|
import { stillness } from "./stillness.js";
|
|
15
15
|
import { stubOnlyEntity } from "./stub-only-entity.js";
|
|
16
16
|
import { thinPage } from "./thin-page.js";
|
|
17
|
+
import { undefinedCustomProperty } from "./undefined-custom-property.js";
|
|
17
18
|
var PROBES = [
|
|
18
19
|
axe,
|
|
19
20
|
buyBoxAboveFold,
|
|
@@ -29,7 +30,8 @@ var PROBES = [
|
|
|
29
30
|
placeholderAsset,
|
|
30
31
|
stillness,
|
|
31
32
|
stubOnlyEntity,
|
|
32
|
-
thinPage
|
|
33
|
+
thinPage,
|
|
34
|
+
undefinedCustomProperty
|
|
33
35
|
];
|
|
34
36
|
var probeById = (id) => {
|
|
35
37
|
const probe = PROBES.find((one) => one.id === id);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const undefinedCustomProperty: import('../index.js').Probe;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/probes/undefined-custom-property.ts
|
|
2
|
+
import { collect } from "../browser.js";
|
|
3
|
+
import { defineProbe } from "./define.js";
|
|
4
|
+
var evidenceOf = (hit) => `${hit.property}: ${hit.value} — ${hit.names.join(" and ")} ${hit.names.length === 1 ? "has" : "have"} no value on ${hit.failing} of ${hit.elements} element(s), and ${hit.property} computes to ${hit.computed === "" ? "nothing" : hit.computed} on ${hit.first}; from ${hit.source}`;
|
|
5
|
+
var undefinedCustomProperty = defineProbe({
|
|
6
|
+
class: "undefined-custom-property",
|
|
7
|
+
id: "undefined-custom-property",
|
|
8
|
+
run: async (page, { url }) => (await collect(page, { kind: "variables" })).map((hit) => ({
|
|
9
|
+
evidence: evidenceOf(hit),
|
|
10
|
+
selector: hit.selector,
|
|
11
|
+
severity: "major",
|
|
12
|
+
url
|
|
13
|
+
}))
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
undefinedCustomProperty
|
|
17
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Page } from 'playwright';
|
|
2
2
|
/** A green walk is not a clean surface: what these classes do not cover is in docs/walk-review-inventory-2026-08-30.md. */
|
|
3
|
-
export declare const DEFECT_CLASSES: readonly ['accessibility-error', 'accessibility-warning', 'buy-box-above-fold', 'content-integrity', 'error-page-status', 'fabricated-claim', 'fake-session', 'light-on-light', 'link-integrity', 'ops-leakage', 'placeholder-asset', 'stillness', 'stub-only-entity'];
|
|
3
|
+
export declare const DEFECT_CLASSES: readonly ['accessibility-error', 'accessibility-warning', 'buy-box-above-fold', 'content-integrity', 'error-page-status', 'fabricated-claim', 'fake-session', 'light-on-light', 'link-integrity', 'ops-leakage', 'placeholder-asset', 'stillness', 'stub-only-entity', 'undefined-custom-property'];
|
|
4
4
|
export type DefectClass = (typeof DEFECT_CLASSES)[number];
|
|
5
5
|
/** `blocking` breaks trust or the buy path; `major` confuses the buyer; `minor` is polish. */
|
|
6
6
|
export type Severity = 'blocking' | 'major' | 'minor';
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geonosis/walk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
|
-
"description": "The customer walk as a gate:
|
|
5
|
+
"description": "The customer walk as a gate: sixteen probes over a list of URLs, fifteen computed-DOM readings and axe’s accessibility rules, one JSON report, and an exit code that tells a could-not-run from a clean page.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"playwright",
|
|
8
8
|
"audit",
|
|
@@ -35,8 +35,16 @@
|
|
|
35
35
|
"bin",
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "bun ../../tooling/build-step.ts bun ../../tooling/bundle.ts",
|
|
40
|
+
"typecheck": "bun check --no-script",
|
|
41
|
+
"lint": "oxlint --report-unused-disable-directives-severity=error --config ../../.oxlintrc.json .",
|
|
42
|
+
"test:unit": "vitest run --project unit --root ../.. --passWithNoTests \"$PWD\"",
|
|
43
|
+
"test:bin": "vitest run --project bin --root ../.. --passWithNoTests \"$PWD\"",
|
|
44
|
+
"test:exam": "vitest run --project exam --root ../.. --passWithNoTests \"$PWD\""
|
|
45
|
+
},
|
|
38
46
|
"dependencies": {
|
|
39
|
-
"@geonosis/base": "3.
|
|
47
|
+
"@geonosis/base": "3.10.0"
|
|
40
48
|
},
|
|
41
49
|
"peerDependencies": {
|
|
42
50
|
"@axe-core/playwright": "^4.14.0",
|
|
@@ -51,7 +59,7 @@
|
|
|
51
59
|
}
|
|
52
60
|
},
|
|
53
61
|
"devDependencies": {
|
|
54
|
-
"@axe-core/playwright": "4.14.
|
|
62
|
+
"@axe-core/playwright": "4.14.1",
|
|
55
63
|
"playwright": "1.64.1"
|
|
56
64
|
},
|
|
57
65
|
"engines": {
|
|
@@ -61,7 +69,7 @@
|
|
|
61
69
|
"runtime": [
|
|
62
70
|
{
|
|
63
71
|
"name": "bun",
|
|
64
|
-
"version": "^1.4.
|
|
72
|
+
"version": "^1.4.5",
|
|
65
73
|
"onFail": "download"
|
|
66
74
|
},
|
|
67
75
|
{
|
|
@@ -72,13 +80,5 @@
|
|
|
72
80
|
},
|
|
73
81
|
"publishConfig": {
|
|
74
82
|
"access": "public"
|
|
75
|
-
},
|
|
76
|
-
"scripts": {
|
|
77
|
-
"build": "bun ../../tooling/build-step.ts bun ../../tooling/bundle.ts",
|
|
78
|
-
"typecheck": "bun check --no-script",
|
|
79
|
-
"lint": "oxlint --report-unused-disable-directives-severity=error --config ../../.oxlintrc.json .",
|
|
80
|
-
"test:unit": "vitest run --project unit --root ../.. --passWithNoTests \"$PWD\"",
|
|
81
|
-
"test:bin": "vitest run --project bin --root ../.. --passWithNoTests \"$PWD\"",
|
|
82
|
-
"test:exam": "vitest run --project exam --root ../.. --passWithNoTests \"$PWD\""
|
|
83
83
|
}
|
|
84
|
-
}
|
|
84
|
+
}
|