@geonosis/walk 3.8.4 → 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 CHANGED
@@ -1,5 +1,25 @@
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
+
15
+ ## 3.9.0
16
+
17
+ ### Patch Changes
18
+
19
+ - cac1a0c: `link-integrity` no longer requests a link to a place in the page it is on (#231). A skip link (`href="#main"`) on a page the walk list declares as a 404 was requested, answered the page's own 404, and was reported blocking. Such a link is now judged in the page: it passes when the page has an element with that id, or an `<a name>` of it, matched as written and percent-decoded, as the browser finds it. This widens the probe: a fragment that names no element on its page (`#delivery` with no `id="delivery"`) is a `major` finding, where it used to pass on the page's 200. `#top`, an empty fragment, a text fragment (`#:~:text=`) and a route after the hash (`#/cart`, `#!/cart`) are left alone. A link to another page's fragment is requested as before.
20
+ - 351ce36: A walk checks everything it needs before it opens a browser and names every missing piece in one refusal: each probe's option or peer, `playwright`, and Playwright's Chromium, read from `chromium.executablePath()` (#272). A pattern with an inline flag such as `(?i)` is refused saying that a pattern is a JavaScript `RegExp` source; the README names the `flags` option of the probes that take one.
21
+ - @geonosis/base@3.9.0
22
+
3
23
  ## 3.8.4
4
24
 
5
25
  ### 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. Fourteen computed-DOM probes and an `axe` probe over a list of URLs,
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
@@ -50,7 +50,7 @@ counter reads, is left absent.
50
50
  |---|---|---|
51
51
  | `light-on-light` | An element with an opaque background of its own, no background image, no border, no shadow, no outline, whose box does not simply repaint the one behind it — and whose WCAG contrast against the painted ancestor background is under the floor. | nothing (`minContrast` defaults to 1.05) |
52
52
  | `placeholder-asset` | Asset signatures: an image's resolved `src`, an SVG's own shape geometry. Fires on a signature used in more slots than allowed, and on any signature or `alt`/`aria-label`/`title` matching the placeholder list. | nothing (`maxRepeats` defaults to 2) |
53
- | `link-integrity` | `href` absent, empty, `#` or `javascript:` — and, for same-origin links, a HEAD (GET on 405/501) that answers 400 or worse. | nothing |
53
+ | `link-integrity` | `href` absent, empty, `#` or `javascript:` — and, for same-origin links, a HEAD (GET on 405/501) that answers 400 or worse. A link to a place in the page it is on (`#main`) is not requested: it is judged by whether the page has an element with that id (or an `<a name>`), as the browser finds it; `#top`, an empty fragment and a route after the hash (`#/cart`, `#!/cart`) are left alone. | nothing |
54
54
  | `fabricated-claim` | The page's rendered text, against a list of claim patterns. Not the markup: a claim in a comment is a claim nobody was shown. | **`claims`** |
55
55
  | `stub-only-entity` | An element naming an entity, offering a way to buy it, whose id is in no authoritative set. | **`known`** |
56
56
  | `fake-session` | Anything that means "signed in", on a page loaded with no cookies and no storage. | **`selectors` or `text`** |
@@ -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
 
@@ -77,6 +78,15 @@ would report a clean page for every repo that never set one up.
77
78
  peer missing, the walk exits 2 naming the install command, `npm i -D @axe-core/playwright`, and does
78
79
  not skip the probe in silence. A walk that names no probes does not run it.
79
80
 
81
+ Everything a walk needs is checked before it opens a browser, and every missing piece is named in
82
+ one refusal: each probe's option or peer, `playwright`, and Playwright's Chromium, whose path is
83
+ read from `chromium.executablePath()` rather than found by a launch that fails.
84
+
85
+ A pattern is a JavaScript `RegExp` source. It takes no inline flag: `(?i)trusted by` is refused as
86
+ not a regular expression. `fabricated-claim`, `ops-leakage`, `error-page-status`, `money-format`
87
+ and `placeholder-asset` take their flags in a `flags` option, any of `i`, `m`, `s` and `u`
88
+ (`{ "claims": ["trusted by"], "flags": "i" }`).
89
+
80
90
  Four of the others are the `content-integrity` class: a page that renders correctly and says nothing.
81
91
  Four defects of one audit were filed under `fabricated-claim`'s forbidden-string engine for want of
82
92
  it, which is one class borrowing another's mechanism.
@@ -91,6 +101,22 @@ so list it last in `probes`: a page that mounts content on scroll reads differen
91
101
  after it. A status the walk list declares stays `link-integrity`'s and `error-page-status`'s to
92
102
  judge, and the page's own document is not counted as a failed request.
93
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
+
94
120
  ## Configuration
95
121
 
96
122
  Everything lives in the `walk` block of `geonosis.json`; the command line wins where they overlap.
@@ -145,7 +171,7 @@ asks `failIfMajorPerformanceCaveat` even with no graphics processor, which Chrom
145
171
  false` (or `--no-gpu`) walks as a visitor with no graphics processor, so a page that offers a
146
172
  fallback for that refusal is walked on its fallback.
147
173
 
148
- With no `probes` the walk runs the four that need no list, leaving out `stillness`, which is opt-in.
174
+ With no `probes` the walk runs the five that need no list, leaving out `stillness`, which is opt-in.
149
175
  A mobile pass is the same command with `--viewport 390x844`.
150
176
 
151
177
  ## The report
@@ -209,11 +235,12 @@ read as still.
209
235
 
210
236
  ## What this is not
211
237
 
212
- A green report is not a clean surface. Twelve of the fourteen computed-DOM probes came from hand
238
+ A green report is not a clean surface. Twelve of the fifteen computed-DOM probes came from hand
213
239
  audits of one storefront, the largest holding 36 defects; six are reproduced by a probe alone,
214
240
  sixteen partially, and fourteen — five product tables that disagree, a cart that re-prices what the
215
241
  product page quoted, copy promising a control nobody built, four levels of taxonomy for fourteen
216
242
  products — are invisible to any browser probe there could be. Those stay the walker's judgement. The
217
- thirteenth came from a production incident instead, which is how the list is meant to grow, and the
218
- fourteenth from a site's own hand-written walk. The reasoning, defect by defect, is in
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
219
246
  [`docs/walk-review-inventory-2026-08-30.md`](../../docs/walk-review-inventory-2026-08-30.md).
@@ -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 pnpm 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).
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
@@ -18,8 +18,13 @@ export type AssetHit = {
18
18
  selector: string;
19
19
  signature: string;
20
20
  };
21
+ export type InPageTarget = {
22
+ found: boolean;
23
+ name: string;
24
+ };
21
25
  export type LinkHit = {
22
26
  href: null | string;
27
+ inPage: InPageTarget | null;
23
28
  resolved: string;
24
29
  selector: string;
25
30
  text: string;
@@ -48,6 +53,17 @@ export type ProseHit = {
48
53
  selector: string;
49
54
  words: number;
50
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
+ };
51
67
  export type Job = {
52
68
  assetSelector: string;
53
69
  kind: 'assets';
@@ -86,6 +102,8 @@ export type Job = {
86
102
  kind: 'matches';
87
103
  patterns: string[];
88
104
  scope: string;
105
+ } | {
106
+ kind: 'variables';
89
107
  };
90
108
  export type JobResult = {
91
109
  assets: AssetHit[];
@@ -100,6 +118,7 @@ export type JobResult = {
100
118
  present: PresentHit[];
101
119
  prose: ProseHit[];
102
120
  text: TextHit[];
121
+ variables: VariableHit[];
103
122
  };
104
123
  /** The one cast: the value comes back from another VM, so the discriminant is the contract, covered by the probe tests. */
105
124
  export declare const collect: <K extends Job['kind']>(page: Page, job: Extract<Job, {
package/dist/browser.js CHANGED
@@ -1,6 +1,13 @@
1
1
  // src/browser.ts
2
2
  var inPage = (job) => {
3
3
  const dom = {
4
+ decoded: (text) => {
5
+ try {
6
+ return decodeURIComponent(text);
7
+ } catch {
8
+ return text;
9
+ }
10
+ },
4
11
  deepest: (root, needle) => {
5
12
  let node = root;
6
13
  let moved = true;
@@ -46,6 +53,29 @@ var inPage = (job) => {
46
53
  return box.width > 0 && box.height > 0 && getComputedStyle(element).visibility !== "hidden";
47
54
  },
48
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
+ },
49
79
  wordsIn: (text) => text.split(/\s+/).filter((one) => one !== "").length
50
80
  };
51
81
  if (job.kind === "contrast") {
@@ -150,8 +180,28 @@ var inPage = (job) => {
150
180
  return hits;
151
181
  }
152
182
  if (job.kind === "links") {
183
+ const here = new URL(location.href);
184
+ here.hash = "";
185
+ const indicates = (name) => document.getElementById(name) !== null || [...document.getElementsByName(name)].some((one) => one.tagName === "A");
186
+ const targetIn = (resolved) => {
187
+ if (!URL.canParse(resolved))
188
+ return null;
189
+ const target = new URL(resolved);
190
+ if (target.hash === "")
191
+ return null;
192
+ const [name = ""] = target.hash.slice(1).split(":~:");
193
+ target.hash = "";
194
+ if (target.href !== here.href || name.startsWith("/") || name.startsWith("!"))
195
+ return null;
196
+ const readable = dom.decoded(name);
197
+ return {
198
+ found: name === "" || indicates(name) || indicates(readable) || readable.toLowerCase() === "top",
199
+ name
200
+ };
201
+ };
153
202
  return [...document.querySelectorAll(job.selector)].map((element) => ({
154
203
  href: element.getAttribute("href"),
204
+ inPage: targetIn(element.href ?? ""),
155
205
  resolved: element.href ?? "",
156
206
  selector: dom.selectorOf(element),
157
207
  text: dom.textOf(element).trim().slice(0, 80)
@@ -222,6 +272,277 @@ var inPage = (job) => {
222
272
  words: dom.wordsIn(dom.textOf(element))
223
273
  }));
224
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
+ }
225
546
  if (job.kind === "present") {
226
547
  return job.selectors.map((selector) => ({
227
548
  present: document.querySelector(selector) !== null,
package/dist/options.js CHANGED
@@ -51,7 +51,7 @@ var assertPatterns = (probe, patterns, flags) => {
51
51
  try {
52
52
  RegExp(pattern, `${flags}g`);
53
53
  } catch {
54
- throw new WalkError(`${probe}: "${pattern}" is not a regular expression`);
54
+ throw new WalkError(`${probe}: "${pattern}" is not a regular expression — a pattern is a JavaScript RegExp source, with no inline flags such as (?i)`);
55
55
  }
56
56
  }
57
57
  };
@@ -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);
@@ -34,6 +34,17 @@ var linkIntegrity = defineProbe({
34
34
  continue;
35
35
  if (ignore.some((pattern) => new RegExp(pattern).test(target)))
36
36
  continue;
37
+ if (hit.inPage !== null) {
38
+ if (!hit.inPage.found) {
39
+ found.push({
40
+ evidence: `#${hit.inPage.name} names no element on the page: the link goes nowhere`,
41
+ selector: hit.selector,
42
+ severity: "major",
43
+ url
44
+ });
45
+ }
46
+ continue;
47
+ }
37
48
  if (!checkExternal && new URL(target).origin !== origin)
38
49
  continue;
39
50
  const status = await statusOf(page, memo, target, new URL(target).origin === origin ? headers : undefined);
@@ -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
@@ -12,7 +12,8 @@ var DEFECT_CLASSES = [
12
12
  "ops-leakage",
13
13
  "placeholder-asset",
14
14
  "stillness",
15
- "stub-only-entity"
15
+ "stub-only-entity",
16
+ "undefined-custom-property"
16
17
  ];
17
18
  var classesOf = (probe) => [
18
19
  probe.class,
package/dist/walk.d.ts CHANGED
@@ -15,6 +15,13 @@ export type WalkInput = {
15
15
  /** Imported here, not at module top: a consumer without a browser gets a sentence naming what to install, and the ratchet importing this package's types must not drag one in. */
16
16
  export declare const launchBrowser: (gpu?: boolean) => Promise<Browser>;
17
17
  export declare const VERSION_KEY = "Cloudflare-Workers-Version-Key";
18
+ type ChromiumLocator = {
19
+ chromium: {
20
+ executablePath: () => string;
21
+ };
22
+ };
23
+ export declare const unmetBeforeLaunch: (probes: readonly Probe[], options: Record<string, Record<string, unknown>>, locate?: () => Promise<ChromiumLocator>) => Promise<string[]>;
18
24
  /** Each page gets its own context with no cookies or storage, which is what gives `fake-session` meaning. Refusals come before the browser opens, a page that answers is walked whatever its status, and a page that answers nothing stops the walk. */
19
25
  export declare const walk: ({ browser, expected, gpu, options, probes, ready, readyTimeoutMs, urls, versionKey, viewport }: WalkInput) => Promise<WalkReport>;
20
26
  export declare const findingsIn: (report: WalkReport) => number;
27
+ export {};
package/dist/walk.js CHANGED
@@ -1,9 +1,11 @@
1
1
  // src/walk.ts
2
+ import { existsSync } from "node:fs";
2
3
  import { errorMessage } from "@geonosis/base";
3
4
  import { classesOf, WalkError, WalkStopped } from "./types.js";
4
5
  import { readWebgl } from "./webgl.js";
5
6
  var READY_TIMEOUT_MS = 1e4;
6
7
  var NO_GPU_ARGS = ["--disable-gpu", "--use-angle=swiftshader"];
8
+ var INSTALL_CHROMIUM = "npx playwright install chromium";
7
9
  var launchBrowser = async (gpu = true) => {
8
10
  let chromium;
9
11
  try {
@@ -18,7 +20,7 @@ var launchBrowser = async (gpu = true) => {
18
20
  ...gpu ? {} : { args: NO_GPU_ARGS }
19
21
  });
20
22
  } catch (error) {
21
- throw new WalkError(`chromium would not launch — \`npx playwright install chromium\`: ${errorMessage(error)}`);
23
+ throw new WalkError(`chromium would not launch — \`${INSTALL_CHROMIUM}\`: ${errorMessage(error)}`);
22
24
  }
23
25
  };
24
26
  var VERSION_KEY = "Cloudflare-Workers-Version-Key";
@@ -63,6 +65,33 @@ var statusFindings = (url, status, declared) => {
63
65
  };
64
66
  var firstLine = (error) => errorMessage(error).split(`
65
67
  `)[0] ?? "";
68
+ var loadPlaywright = () => import("playwright");
69
+ var unmetBeforeLaunch = async (probes, options, locate) => {
70
+ const unmet = [];
71
+ for (const probe of probes) {
72
+ try {
73
+ await probe.needs?.(options[probe.id] ?? {});
74
+ } catch (error) {
75
+ if (!(error instanceof WalkError))
76
+ throw error;
77
+ unmet.push(error.message);
78
+ }
79
+ }
80
+ if (locate === undefined)
81
+ return unmet;
82
+ let located;
83
+ try {
84
+ located = await locate();
85
+ } catch (error) {
86
+ return [
87
+ ...unmet,
88
+ `playwright is a peer dependency of @geonosis/walk and is not installed — npm i -D playwright: ${firstLine(error)}`,
89
+ `chromium, once playwright is installed — ${INSTALL_CHROMIUM}`
90
+ ];
91
+ }
92
+ const path = located.chromium.executablePath();
93
+ return existsSync(path) ? unmet : [...unmet, `chromium is not installed at ${path} — ${INSTALL_CHROMIUM}`];
94
+ };
66
95
  var settle = async (page, ready, timeout) => {
67
96
  if (ready.scrollTo !== undefined) {
68
97
  try {
@@ -117,8 +146,12 @@ var walk = async ({
117
146
  }) => {
118
147
  if (urls.length === 0)
119
148
  throw new WalkError("no URL to walk");
120
- for (const probe of probes)
121
- await probe.needs?.(options[probe.id] ?? {});
149
+ const unmet = await unmetBeforeLaunch(probes, options, browser === undefined ? loadPlaywright : undefined);
150
+ if (unmet.length > 0) {
151
+ throw new WalkError(`the walk cannot start until each of these is fixed:
152
+ ${unmet.map((line) => ` - ${line}`).join(`
153
+ `)}`);
154
+ }
122
155
  const startedAt = new Date().toISOString();
123
156
  const own = browser ?? await launchBrowser(gpu);
124
157
  const memo = new Map;
@@ -183,5 +216,6 @@ export {
183
216
  VERSION_KEY,
184
217
  findingsIn,
185
218
  launchBrowser,
219
+ unmetBeforeLaunch,
186
220
  walk
187
221
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@geonosis/walk",
3
- "version": "3.8.4",
3
+ "version": "3.10.0",
4
4
  "types": "./dist/index.d.ts",
5
- "description": "The customer walk as a gate: fifteen probes over a list of URLs, fourteen 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.",
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.8.4"
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.0",
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.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": "tsc --noEmit",
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
+ }