@geonosis/walk 3.4.1 → 3.6.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,28 @@
1
1
  # @geonosis/walk
2
2
 
3
+ ## 3.6.0
4
+
5
+ This package had no change of its own in 3.6.0. What the group changed under that number is in `GROUP-CHANGELOG.md`, in the `@geonosis/cli` package.
6
+
7
+ ### Patch Changes
8
+
9
+ - Updated dependencies [630d44c]
10
+ - Updated dependencies [e65a3b0]
11
+ - Updated dependencies [f275d25]
12
+ - @geonosis/base@3.6.0
13
+
14
+ ## 3.5.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 2cc5f78: The walk launches Playwright's full Chromium (`channel: 'chromium'`), not its headless shell (#155). Under Playwright 1.64.0 and Chromium 156 the shell grants WebGL that asks `failIfMajorPerformanceCaveat` in SwiftShader even under `--disable-gpu`, so a walk saw 3D no visitor without a graphics processor gets. `walk.gpu: false` and `--no-gpu` walk without one; the WebGL caveat is then refused, as Chrome refuses it. `npx playwright install chromium` installs the full build beside the shell.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [2cc5f78]
23
+ - Updated dependencies [b01150f]
24
+ - @geonosis/base@3.5.0
25
+
3
26
  ## 3.4.1
4
27
 
5
28
  ### Patch Changes
package/README.md CHANGED
@@ -99,7 +99,7 @@ Everything lives in the `walk` block of `geonosis.json`; the command line wins w
99
99
  ```
100
100
 
101
101
  ```
102
- geonosis-walk [url…] [--report <path>] [--config <path>] [--viewport WIDTHxHEIGHT] [--probe <id>]… [--version-key <key>]
102
+ geonosis-walk [url…] [--report <path>] [--config <path>] [--viewport WIDTHxHEIGHT] [--probe <id>]… [--version-key <key>] [--no-gpu]
103
103
  ```
104
104
 
105
105
  `versionKey` (or `--version-key`) sends `Cloudflare-Workers-Version-Key: <key>` with every request
@@ -109,6 +109,12 @@ chance unless the key pins the client, so a walk without one can read HTML from
109
109
  assets from the other
110
110
  ([Version affinity](https://developers.cloudflare.com/workers/versions-and-deployments/gradual-deployments/version-affinity/)).
111
111
 
112
+ The walk runs Playwright's full Chromium (`channel: 'chromium'`, installed by `npx playwright install
113
+ chromium`), not its headless shell: the shell draws WebGL in SwiftShader and grants a context that
114
+ asks `failIfMajorPerformanceCaveat` even with no graphics processor, which Chrome refuses. `"gpu":
115
+ false` (or `--no-gpu`) walks as a visitor with no graphics processor, so a page that offers a
116
+ fallback for that refusal is walked on its fallback.
117
+
112
118
  With no `probes` the walk runs the three that need no list. A mobile pass is the same command with
113
119
  `--viewport 390x844`.
114
120
 
package/dist/config.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Viewport } from './types.js';
2
2
  export type WalkConfig = {
3
3
  expected: Record<string, number>;
4
+ gpu: boolean;
4
5
  options: Record<string, Record<string, unknown>>;
5
6
  probes: string[];
6
7
  report: string;
package/dist/config.js CHANGED
@@ -8,6 +8,7 @@ var VIEWPORT = { height: 900, width: 1440 };
8
8
  var WALK_REPORT = ".geonosis/walk-report.json";
9
9
  var WALK_DEFAULT = {
10
10
  expected: {},
11
+ gpu: true,
11
12
  options: {},
12
13
  probes: DEFAULT_PROBES.map((one) => one.id),
13
14
  report: WALK_REPORT,
@@ -15,6 +16,7 @@ var WALK_DEFAULT = {
15
16
  viewport: VIEWPORT
16
17
  };
17
18
  var ABOUT = {
19
+ gpu: "boolean? false walks as a visitor with no graphics processor: WebGL asking failIfMajorPerformanceCaveat is refused",
18
20
  options: "object? keyed by probe id; each probe validates its own",
19
21
  probes: "string[]? the probe ids to run",
20
22
  report: "string? where the JSON report is written",
@@ -125,11 +127,15 @@ var loadWalkConfig = (file) => {
125
127
  throw new WalkError(`walk.${key} is not a key of the walk block`);
126
128
  }
127
129
  const { expected, urls } = readUrls(block.urls);
130
+ if (block.gpu !== undefined && typeof block.gpu !== "boolean") {
131
+ throw new WalkError("walk.gpu must be true or false");
132
+ }
128
133
  if (block.versionKey !== undefined && (typeof block.versionKey !== "string" || block.versionKey === "")) {
129
134
  throw new WalkError("walk.versionKey must be the value to send as Cloudflare-Workers-Version-Key");
130
135
  }
131
136
  return {
132
137
  expected,
138
+ gpu: block.gpu ?? true,
133
139
  options: readOptions(block.options),
134
140
  probes: readStrings(block.probes, "probes", WALK_DEFAULT.probes),
135
141
  report: typeof block.report === "string" ? block.report : WALK_REPORT,
package/dist/walk-cli.js CHANGED
@@ -14,6 +14,7 @@ var parse = (argv) => {
14
14
  args: argv,
15
15
  options: {
16
16
  config: { type: "string" },
17
+ "no-gpu": { type: "boolean" },
17
18
  probe: { multiple: true, type: "string" },
18
19
  report: { type: "string" },
19
20
  "version-key": { type: "string" },
@@ -23,6 +24,7 @@ var parse = (argv) => {
23
24
  });
24
25
  return {
25
26
  ...values.config === undefined ? {} : { config: values.config },
27
+ gpu: values["no-gpu"] !== true,
26
28
  probes: values.probe ?? [],
27
29
  ...values.report === undefined ? {} : { report: values.report },
28
30
  urls: positionals,
@@ -33,7 +35,7 @@ var parse = (argv) => {
33
35
  throw new WalkError(`${errorMessage(error)} — run geonosis-walk --help`);
34
36
  }
35
37
  };
36
- var USAGE = `geonosis-walk [url…] [--config <geonosis.json>] [--probe <id>] [--viewport <WxH>] [--report <path>] [--version-key <key>]
38
+ var USAGE = `geonosis-walk [url…] [--config <geonosis.json>] [--probe <id>] [--viewport <WxH>] [--report <path>] [--version-key <key>] [--no-gpu]
37
39
 
38
40
  Walks the URLs this repo declares and runs the accessibility, correctness and dead-end probes
39
41
  against each. URLs and probes named on the command line replace the configured ones.
@@ -43,6 +45,7 @@ against each. URLs and probes named on the command line replace the configured o
43
45
  --viewport <WxH> the viewport to render at, e.g. 1280x800
44
46
  --report <path> where the JSON report is written (default: the config's)
45
47
  --version-key <key> send Cloudflare-Workers-Version-Key: <key> with every request to a walked origin, so a walk during a gradual deployment sees one version
48
+ --no-gpu walk as a visitor with no graphics processor (default: the config's walk.gpu, else with one)
46
49
  --help, -h this text
47
50
 
48
51
  A page that answers is walked whatever its status. An error status the config does not declare
@@ -96,6 +99,7 @@ var main = async () => {
96
99
  throw new WalkError("--version-key needs the value to send");
97
100
  const report = await walk({
98
101
  expected: config.expected,
102
+ gpu: argv.gpu && config.gpu,
99
103
  options: config.options,
100
104
  probes,
101
105
  urls: argv.urls.length > 0 ? argv.urls : config.urls,
package/dist/walk.d.ts CHANGED
@@ -3,13 +3,16 @@ import type { Probe, Viewport, WalkReport } from './types.js';
3
3
  export type WalkInput = {
4
4
  browser?: Browser;
5
5
  expected?: Record<string, number>;
6
+ gpu?: boolean;
6
7
  options?: Record<string, Record<string, unknown>>;
7
8
  probes: Probe[];
8
9
  urls: string[];
9
10
  versionKey?: string;
10
11
  viewport: Viewport;
11
12
  };
13
+ /** 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. */
14
+ export declare const launchBrowser: (gpu?: boolean) => Promise<Browser>;
12
15
  export declare const VERSION_KEY = "Cloudflare-Workers-Version-Key";
13
16
  /** 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. */
14
- export declare const walk: ({ browser, expected, options, probes, urls, versionKey, viewport }: WalkInput) => Promise<WalkReport>;
17
+ export declare const walk: ({ browser, expected, gpu, options, probes, urls, versionKey, viewport }: WalkInput) => Promise<WalkReport>;
15
18
  export declare const findingsIn: (report: WalkReport) => number;
package/dist/walk.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/walk.ts
2
2
  import { errorMessage } from "@geonosis/base";
3
3
  import { WalkError, WalkStopped } from "./types.js";
4
- var launch = async () => {
4
+ var launchBrowser = async (gpu = true) => {
5
5
  let chromium;
6
6
  try {
7
7
  ({ chromium } = await import("playwright"));
@@ -9,7 +9,11 @@ var launch = async () => {
9
9
  throw new WalkError(`playwright is a peer dependency of @geonosis/walk and is not installed: ${errorMessage(error)}`);
10
10
  }
11
11
  try {
12
- return await chromium.launch({ headless: true });
12
+ return await chromium.launch({
13
+ channel: "chromium",
14
+ headless: true,
15
+ ...gpu ? {} : { args: ["--disable-gpu"] }
16
+ });
13
17
  } catch (error) {
14
18
  throw new WalkError(`chromium would not launch — \`npx playwright install chromium\`: ${errorMessage(error)}`);
15
19
  }
@@ -76,6 +80,7 @@ var reportOf = (input) => {
76
80
  var walk = async ({
77
81
  browser,
78
82
  expected = {},
83
+ gpu = true,
79
84
  options = {},
80
85
  probes,
81
86
  urls,
@@ -87,7 +92,7 @@ var walk = async ({
87
92
  for (const probe of probes)
88
93
  probe.needs?.(options[probe.id] ?? {});
89
94
  const startedAt = new Date().toISOString();
90
- const own = browser ?? await launch();
95
+ const own = browser ?? await launchBrowser(gpu);
91
96
  const memo = new Map;
92
97
  const pages = [];
93
98
  const stoppedAt = (url, why) => new WalkStopped(`${url} ${why}`, reportOf({ pages, probes, startedAt, stoppedAt: { url, why }, viewport }));
@@ -142,5 +147,6 @@ var findingsIn = (report) => report.pages.reduce((total, page) => total + page.f
142
147
  export {
143
148
  VERSION_KEY,
144
149
  findingsIn,
150
+ launchBrowser,
145
151
  walk
146
152
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geonosis/walk",
3
- "version": "3.4.1",
3
+ "version": "3.6.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "description": "The customer walk as a gate: eight computed-DOM probes over a list of URLs, one JSON report, and an exit code that tells a could-not-run from a clean page.",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@geonosis/base": "3.4.1"
39
+ "@geonosis/base": "3.6.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "playwright": ">=1.40.0"
@@ -47,7 +47,7 @@
47
47
  }
48
48
  },
49
49
  "devDependencies": {
50
- "playwright": "1.64.0"
50
+ "playwright": "1.64.1"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=22"
@@ -71,7 +71,7 @@
71
71
  "scripts": {
72
72
  "build": "bun ../../tooling/build-step.ts bun ../../tooling/bundle.ts",
73
73
  "typecheck": "tsc --noEmit",
74
- "lint": "oxlint --config ../../.oxlintrc.json .",
74
+ "lint": "oxlint --report-unused-disable-directives-severity=error --config ../../.oxlintrc.json .",
75
75
  "test:unit": "vitest run --project unit --root ../.. --passWithNoTests \"$PWD\"",
76
76
  "test:bin": "vitest run --project bin --root ../.. --passWithNoTests \"$PWD\"",
77
77
  "test:exam": "vitest run --project exam --root ../.. --passWithNoTests \"$PWD\""