eaa-kit 0.9.0 → 0.11.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.
Files changed (106) hide show
  1. package/README.md +174 -149
  2. package/dist/astro/index.d.ts +1 -3
  3. package/dist/astro/index.js +2 -3
  4. package/dist/audit/runners/worker.js +2 -3
  5. package/dist/{audit-J2jeLo-y.js → audit-DbqNIrt6.js} +61 -35
  6. package/dist/audit-rUhqnm3o.js +1 -0
  7. package/dist/{baseline-DrFh7joZ.js → baseline-CKElWbx4.js} +4 -5
  8. package/dist/baseline-DU0EPiTq.js +1 -0
  9. package/dist/baseline-DYOejLFO.js +1 -0
  10. package/dist/{baseline-wyJsSIFQ.js → baseline-DvdsFTQy.js} +5 -6
  11. package/dist/{cache-D4dOIuOi.js → cache-DIV4G0TI.js} +24 -5
  12. package/dist/{checklist-Gx2g3LFC.js → checklist-CA0Ri71Z.js} +7 -8
  13. package/dist/cli/index.js +52 -35
  14. package/dist/{collect-BJYk7_pJ.js → collect-CjucwTEF.js} +16 -8
  15. package/dist/{command-BGGMf4vn.js → command-C8ZFvcc1.js} +6 -9
  16. package/dist/completeness-Cg-XIKWN.js +1 -0
  17. package/dist/completeness-Dzyvgr4Z.js +72 -0
  18. package/dist/component-CgbeRgJa.js +1 -0
  19. package/dist/{component-ChisoFyY.js → component-ZLd8DA_a.js} +3 -4
  20. package/dist/{countries-Dg0BdytB.js → countries-B_PE6r5R.js} +42 -18
  21. package/dist/{countries-DRTBubeE.js → countries-CCqog6dy.js} +10 -7
  22. package/dist/coverage-B9_6yv_8.js +2 -0
  23. package/dist/{coverage-zdzgSKjz.js → coverage-C1Z6t9Ct.js} +5 -7
  24. package/dist/{crawl-DwdqiljK.js → crawl-CkHJJV4w.js} +131 -23
  25. package/dist/{criteria-CnPJKGeb.js → criteria-CacF0HP1.js} +1 -2
  26. package/dist/{define-Ctf2uOEh.js → define-BdTPIfqE.js} +5 -5
  27. package/dist/detect-DnFHXpWh.js +49 -0
  28. package/dist/detect-oLDadgee.js +160 -0
  29. package/dist/doctor-q8IebwAb.js +248 -0
  30. package/dist/eleventy/index.d.ts +1 -3
  31. package/dist/eleventy/index.js +2 -3
  32. package/dist/{entry-CjqjrUBY.js → entry-kf94P140.js} +1 -2
  33. package/dist/{fingerprint-BjYV_0F7.js → fingerprint-CcoQ1WxQ.js} +1 -2
  34. package/dist/{frameworks-B4ClIJgE.js → frameworks-BboC8eNk.js} +234 -28
  35. package/dist/frameworks-Y-n3NUuG.js +1 -0
  36. package/dist/{fs-BmPtmFke.js → fs-tPD5r0wY.js} +1 -2
  37. package/dist/hosts-B48qR6Vt.js +19 -0
  38. package/dist/{html-whingnfj.js → html-Bjq3Iw3g.js} +54 -14
  39. package/dist/{impact-luGCnN8F.js → impact-BGlJ6j0Y.js} +1 -2
  40. package/dist/{impact-EEB9ZXmC.d.ts → impact-CZjUloYC.d.ts} +0 -2
  41. package/dist/index.d.ts +10 -23
  42. package/dist/index.js +3 -3
  43. package/dist/{init-CPbFVMuk.js → init-3Ti3ao5Z.js} +65 -126
  44. package/dist/issues-WLlepU95.js +120 -0
  45. package/dist/{jsdom-CsW_xVcA.js → jsdom-C4pLIMyP.js} +2 -3
  46. package/dist/jsdom-Zle--VQ1.js +2 -0
  47. package/dist/{json-SGCgxSPT.js → json-B_k4CDmR.js} +5 -6
  48. package/dist/json-IL1JxlTL.js +1 -0
  49. package/dist/{load-CH-ltdlq.js → load-C3eFEdoH.js} +3 -4
  50. package/dist/load-oQQJPNlV.js +1 -0
  51. package/dist/markdown-D-QpPYsz.js +138 -0
  52. package/dist/next-8zDgH0nP.js +119 -0
  53. package/dist/nuxt/index.d.ts +1 -3
  54. package/dist/nuxt/index.js +2 -3
  55. package/dist/{pages-DxY5Z0gl.js → pages-CCP1WfYe.js} +80 -17
  56. package/dist/{playwright-ukCr_5o3.js → playwright-ky4b_HME.js} +98 -16
  57. package/dist/{pool-B4tEUa2S.js → pool-B3XKdk57.js} +4 -5
  58. package/dist/project-B21NT_aX.js +502 -0
  59. package/dist/project-Dht13sb1.js +1 -0
  60. package/dist/{remediation-Bbs4KcX1.js → remediation-BkE7q7dT.js} +2 -193
  61. package/dist/{render-C6zYfaba.js → render-ky8cm4QF.js} +22 -20
  62. package/dist/result-DhoT4g0P.js +1 -0
  63. package/dist/{result-B7_zVxAX.js → result-g8dGsrcv.js} +1 -2
  64. package/dist/{review-Bz0fO9_I.js → review-BGjTBFvd.js} +2 -3
  65. package/dist/review-iheEjp7_.js +1 -0
  66. package/dist/{routes-CSctpS1P.js → routes-BpQeBDmM.js} +4 -5
  67. package/dist/{run-DzVEOkiF.js → run-D7tc7IU2.js} +2 -3
  68. package/dist/{run-BK2blxMI.d.ts → run-VXnP4uLp.d.ts} +2 -6
  69. package/dist/{sarif-9BAgNiOa.js → sarif-v66-PjdE.js} +7 -8
  70. package/dist/{schema-DJSF4K05.js → schema-DfC-Ww1w.js} +1 -2
  71. package/dist/setup-BYlqHlo0.js +2 -0
  72. package/dist/setup-Cf82ONw0.js +353 -0
  73. package/dist/shell-BdQYTaBQ.js +89 -0
  74. package/dist/{site-BHMtf3q2.js → site-CxVyh8IO.js} +1 -2
  75. package/dist/{start-DzOM0p6I.js → start-bdanSxZr.js} +9 -10
  76. package/dist/statement/templates/cz.cs.md +2 -1
  77. package/dist/statement/templates/cz.en.md +2 -1
  78. package/dist/statement/templates/dk.da.md +3 -2
  79. package/dist/statement/templates/dk.en.md +4 -3
  80. package/dist/statement/templates/pt.en.md +3 -2
  81. package/dist/statement/templates/pt.pt.md +3 -3
  82. package/dist/statement/templates/se.en.md +9 -0
  83. package/dist/statement/templates/se.sv.md +8 -0
  84. package/dist/{text-BF1LHMiV.js → text-CISDPU49.js} +11 -3
  85. package/dist/{version-B3v4rNoG.js → version-C8aJm8YJ.js} +1 -2
  86. package/dist/vite/index.d.ts +1 -3
  87. package/dist/vite/index.js +2 -3
  88. package/dist/{watch-B2RoUbo0.js → watch-CefxwMsZ.js} +3 -4
  89. package/dist/webpack/index.d.ts +1 -3
  90. package/dist/webpack/index.js +2 -3
  91. package/dist/{worksheet-B_kQ1pxq.js → worksheet-CcBo9G7s.js} +4 -5
  92. package/dist/workspaces-BBFXOyeV.js +85 -0
  93. package/package.json +15 -13
  94. package/dist/audit-CJDCQaFY.js +0 -2
  95. package/dist/baseline-477B1CZ_.js +0 -2
  96. package/dist/baseline-D9ihb-wk.js +0 -2
  97. package/dist/component-DcCn3BJS.js +0 -2
  98. package/dist/coverage-GvaMpV64.js +0 -3
  99. package/dist/frameworks-etFg_O8K.js +0 -2
  100. package/dist/jsdom-BUYuVJJm.js +0 -3
  101. package/dist/json-CyLmvF5P.js +0 -2
  102. package/dist/load-D7lBeOsq.js +0 -2
  103. package/dist/project-BLFdCbOq.js +0 -2
  104. package/dist/project-v2PoRw70.js +0 -291
  105. package/dist/result-CRmjjoAA.js +0 -2
  106. package/dist/review-a-2ghjQ5.js +0 -2
@@ -0,0 +1,160 @@
1
+ import { i as toPosix } from "./fs-tPD5r0wY.js";
2
+ import { i as detectFramework } from "./frameworks-BboC8eNk.js";
3
+ import { i as findPackageManager, o as readPackageJson, r as findBuildOutput } from "./project-B21NT_aX.js";
4
+ import path from "node:path";
5
+ // src/audit/detect.ts
6
+ async function detectProject(cwd) {
7
+ const pkg = await readPackageJson(cwd);
8
+ const manager = await findPackageManager(cwd);
9
+ const detected = await detectFramework(cwd, pkg);
10
+ const { candidateOutputs } = await import("./frameworks-Y-n3NUuG.js");
11
+ const base = {
12
+ ...detected === void 0 ? {} : { framework: {
13
+ id: detected.framework.id,
14
+ name: detected.framework.name,
15
+ evidence: detected.evidence
16
+ } },
17
+ ...pkg === void 0 ? {} : { packageManager: {
18
+ name: manager.manager,
19
+ evidence: manager.evidence
20
+ } },
21
+ plan: "nothing",
22
+ summary: "",
23
+ outputs: await candidateOutputs(cwd, pkg)
24
+ };
25
+ const run = (script) => `${manager.manager} ${manager.manager === "deno" ? "task" : "run"} ${script}`;
26
+ const relative = (dir) => toPosix(path.relative(cwd, dir)) || ".";
27
+ const existing = await findBuildOutput(cwd);
28
+ if (existing !== void 0) return {
29
+ ...base,
30
+ plan: "audit-build",
31
+ directory: relative(existing),
32
+ summary: `audit the build already in ${relative(existing)}/`
33
+ };
34
+ if (detected === void 0) {
35
+ const { findWorkspaceSites } = await import("./workspaces-BBFXOyeV.js");
36
+ const workspace = await findWorkspaceSites(cwd);
37
+ const sites = workspace?.sites ?? [];
38
+ if (workspace !== void 0 && sites.length > 0) {
39
+ const listed = {
40
+ evidence: workspace.evidence,
41
+ sites: sites.map((site) => ({
42
+ dir: site.dir,
43
+ framework: site.framework.framework.name
44
+ }))
45
+ };
46
+ const only = sites[0];
47
+ if (sites.length === 1 && only !== void 0) {
48
+ const inner = await detectProject(path.join(cwd, only.dir));
49
+ return {
50
+ ...base,
51
+ plan: inner.plan,
52
+ workspace: listed,
53
+ site: inner,
54
+ summary: `go into ${only.dir}/, this monorepo's one site, and ${inner.summary}`
55
+ };
56
+ }
57
+ return {
58
+ ...base,
59
+ plan: "choose-site",
60
+ workspace: listed,
61
+ summary: `do nothing until a site is chosen: this monorepo has ${sites.length}`
62
+ };
63
+ }
64
+ }
65
+ if (detected !== void 0 && detected.framework.outputs.length === 0) return {
66
+ ...base,
67
+ plan: "url",
68
+ ...detected.framework.serveCommand === void 0 ? {} : { serveCommand: detected.framework.serveCommand },
69
+ summary: `do nothing on its own: ${detected.framework.name} renders on a server, so start the site and audit it with --url`
70
+ };
71
+ if (pkg === void 0) {
72
+ const { glob } = await import("tinyglobby");
73
+ const html = await glob(["*.html", "*.htm"], {
74
+ cwd,
75
+ onlyFiles: true,
76
+ dot: false
77
+ });
78
+ if (detected === void 0 && html.length > 0) return {
79
+ ...base,
80
+ plan: "audit-build",
81
+ directory: ".",
82
+ summary: "audit the hand-written HTML in this folder"
83
+ };
84
+ const command = detected?.framework.buildCommand;
85
+ if (command !== void 0) return {
86
+ ...base,
87
+ build: command,
88
+ summary: `do nothing yet: build the site with ${command} first`
89
+ };
90
+ return {
91
+ ...base,
92
+ summary: "do nothing: there is no build, no package.json and no HTML here"
93
+ };
94
+ }
95
+ const scripts = pkg.scripts ?? {};
96
+ const isNext = detected?.framework.id === "next";
97
+ const nextFacts = isNext ? await readNext(cwd) : void 0;
98
+ const servesAfterBuild = isNext && nextFacts?.output !== "export";
99
+ const serveScript = servesAfterBuild ? scripts["start"] !== void 0 ? run("start") : "next start" : [
100
+ "start",
101
+ "preview",
102
+ "serve"
103
+ ].filter((name) => scripts[name] !== void 0).map(run)[0];
104
+ const withNext = nextFacts === void 0 ? {} : { next: nextFacts };
105
+ if (scripts["build"] !== void 0) {
106
+ const expected = base.outputs[0];
107
+ if (servesAfterBuild) return {
108
+ ...base,
109
+ ...withNext,
110
+ plan: "build-and-serve",
111
+ build: run("build"),
112
+ ...serveScript === void 0 ? {} : { serve: serveScript },
113
+ summary: `run ${run("build")}, start the site with ${serveScript}, and crawl the pages its build lists`
114
+ };
115
+ const shell = await sourceIsShell(cwd);
116
+ return {
117
+ ...base,
118
+ ...withNext,
119
+ plan: "build",
120
+ build: run("build"),
121
+ ...expected === void 0 ? {} : { directory: expected },
122
+ ...serveScript === void 0 ? {} : { serve: serveScript },
123
+ ...shell ? { appShell: true } : {},
124
+ summary: (expected === void 0 ? `run ${run("build")} and audit what it writes` : `run ${run("build")} and audit what it writes, expected in ${expected}/`) + (shell ? ", which is an empty app shell until JavaScript runs: add --browser" : "")
125
+ };
126
+ }
127
+ if (serveScript !== void 0) return {
128
+ ...base,
129
+ ...withNext,
130
+ plan: "serve",
131
+ serve: serveScript,
132
+ summary: `start the site with ${serveScript} and crawl it`
133
+ };
134
+ return {
135
+ ...base,
136
+ summary: "do nothing: there is no build, and no script to build or serve one"
137
+ };
138
+ }
139
+ async function readNext(cwd) {
140
+ const { nextRoutes, readNextConfig } = await import("./next-8zDgH0nP.js");
141
+ const config = await readNextConfig(cwd);
142
+ const routes = await nextRoutes(cwd);
143
+ return {
144
+ ...config.output === void 0 ? {} : { output: config.output },
145
+ ...config.basePath === void 0 ? {} : { basePath: config.basePath },
146
+ pages: routes?.pages.length ?? 0,
147
+ dynamic: routes?.dynamic ?? []
148
+ };
149
+ }
150
+ /** Whether the index.html a Vite-style build starts from is an empty shell. */
151
+ async function sourceIsShell(cwd) {
152
+ const { readFile } = await import("node:fs/promises");
153
+ const { isAppShell } = await import("./shell-BdQYTaBQ.js");
154
+ try {
155
+ return isAppShell(await readFile(path.join(cwd, "index.html"), "utf8"));
156
+ } catch {
157
+ return false;
158
+ }
159
+ }
160
+ export { detectProject };
@@ -0,0 +1,248 @@
1
+ import { t as exists } from "./fs-tPD5r0wY.js";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import pc from "picocolors";
5
+ import { spawn } from "node:child_process";
6
+ // src/cli/doctor.ts
7
+ async function runDoctor(cwd, environment = {}) {
8
+ const nodeVersion = environment.nodeVersion ?? process.versions.node;
9
+ const onPath = environment.onPath ?? canRun;
10
+ const chromium = environment.chromium ?? chromiumCheck;
11
+ const checks = [];
12
+ const engines = createRequire(import.meta.url)("eaa-kit/package.json").engines.node;
13
+ checks.push(nodeSatisfies(nodeVersion, engines) ? {
14
+ label: "Node.js",
15
+ status: "ok",
16
+ detail: nodeVersion
17
+ } : {
18
+ label: "Node.js",
19
+ status: "fail",
20
+ detail: `${nodeVersion} is not supported; this needs ${engines}`,
21
+ fix: "install Node.js 22 LTS or newer from https://nodejs.org"
22
+ });
23
+ const { detectProject } = await import("./detect-oLDadgee.js");
24
+ const detection = await detectProject(cwd);
25
+ const inner = detection.site ?? detection;
26
+ const manager = detection.packageManager;
27
+ if (manager !== void 0) {
28
+ const found = await onPath(manager.name);
29
+ checks.push(found ? {
30
+ label: "Package manager",
31
+ status: "ok",
32
+ detail: `${manager.name} (${manager.evidence})`
33
+ } : {
34
+ label: "Package manager",
35
+ status: inner.build === void 0 && inner.serve === void 0 ? "warn" : "fail",
36
+ detail: `${manager.name} is what this project uses (${manager.evidence}), and it is not installed`,
37
+ fix: manager.name === "pnpm" || manager.name === "yarn" ? "corepack enable" : manager.name === "bun" ? "npm i -g bun" : manager.name === "deno" ? "npm i -g deno" : "install Node.js, which includes npm"
38
+ });
39
+ }
40
+ checks.push(siteCheck(detection));
41
+ checks.push(await configCheck(cwd));
42
+ checks.push(await ciCheck(cwd));
43
+ checks.push(await baselineCheck(cwd));
44
+ checks.push({
45
+ label: "Browser mode",
46
+ ...await chromium(cwd)
47
+ });
48
+ return {
49
+ checks,
50
+ exitCode: checks.some((item) => item.status === "fail") ? 2 : 0
51
+ };
52
+ }
53
+ function siteCheck(detection) {
54
+ const inner = detection.site ?? detection;
55
+ const label = "Site";
56
+ const name = inner.framework?.name;
57
+ switch (detection.plan) {
58
+ case "nothing": return {
59
+ label,
60
+ status: "fail",
61
+ detail: `nothing to audit: an audit would ${detection.summary}`,
62
+ fix: inner.build ?? "npx eaa-kit audit ./path/to/build"
63
+ };
64
+ case "choose-site": return {
65
+ label,
66
+ status: "warn",
67
+ detail: `a monorepo with ${detection.workspace?.sites.length ?? 0} sites`,
68
+ fix: `cd ${detection.workspace?.sites[0]?.dir ?? "<site>"} && npx eaa-kit doctor`
69
+ };
70
+ case "url": return {
71
+ label,
72
+ status: "warn",
73
+ detail: `${name} renders on a server; audit it running, with --url`,
74
+ fix: "npx eaa-kit audit --url http://localhost:8000"
75
+ };
76
+ default: return {
77
+ label,
78
+ status: inner.appShell ? "warn" : "ok",
79
+ detail: `${name ?? "HTML"}: an audit would ${detection.summary}`,
80
+ ...inner.appShell ? { fix: "npx eaa-kit audit --browser" } : {}
81
+ };
82
+ }
83
+ }
84
+ async function configCheck(cwd) {
85
+ const { findConfigFile, loadConfig } = await import("./load-oQQJPNlV.js");
86
+ const file = await findConfigFile(cwd);
87
+ if (file === void 0) return {
88
+ label: "Config",
89
+ status: "warn",
90
+ detail: "none: audits run on defaults, and statements cannot be written",
91
+ fix: "npx eaa-kit init"
92
+ };
93
+ const shown = path.relative(cwd, file) || path.basename(file);
94
+ try {
95
+ await loadConfig({
96
+ cwd,
97
+ path: file
98
+ });
99
+ return {
100
+ label: "Config",
101
+ status: "ok",
102
+ detail: shown
103
+ };
104
+ } catch (cause) {
105
+ const issues = cause.issues ?? [];
106
+ return {
107
+ label: "Config",
108
+ status: "fail",
109
+ detail: `${shown}: ${[cause.message, ...issues].join("; ")}`,
110
+ fix: "npx eaa-kit init --force"
111
+ };
112
+ }
113
+ }
114
+ /** Where the CI systems `init` knows about keep their pipelines. */
115
+ async function ciCheck(cwd) {
116
+ const { findGitRoot } = await import("./setup-BYlqHlo0.js");
117
+ const root = await findGitRoot(cwd) ?? cwd;
118
+ const { glob } = await import("tinyglobby");
119
+ const { readFile } = await import("node:fs/promises");
120
+ const candidates = [
121
+ ...(await glob([".github/workflows/*.{yml,yaml}"], {
122
+ cwd: root,
123
+ dot: true
124
+ })).sort(),
125
+ ".gitlab-ci.yml",
126
+ ".gitlab/eaa-kit.gitlab-ci.yml",
127
+ "bitbucket-pipelines.yml"
128
+ ];
129
+ for (const file of candidates) try {
130
+ if ((await readFile(path.join(root, file), "utf8")).includes("eaa-kit")) return {
131
+ label: "CI",
132
+ status: "ok",
133
+ detail: file
134
+ };
135
+ } catch {}
136
+ return {
137
+ label: "CI",
138
+ status: "warn",
139
+ detail: "no pipeline runs eaa-kit, so nothing stops a barrier being merged",
140
+ fix: "npx eaa-kit init"
141
+ };
142
+ }
143
+ async function baselineCheck(cwd) {
144
+ const { DEFAULT_BASELINE_FILE, readBaseline } = await import("./baseline-DYOejLFO.js");
145
+ if (!await exists(path.join(cwd, DEFAULT_BASELINE_FILE))) return {
146
+ label: "Baseline",
147
+ status: "warn",
148
+ detail: "none: CI fails on every barrier the site has today, not only new ones",
149
+ fix: "npx eaa-kit init"
150
+ };
151
+ try {
152
+ const baseline = await readBaseline(DEFAULT_BASELINE_FILE, cwd);
153
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
154
+ const expired = baseline.entries.filter((entry) => entry.expiresOn !== void 0 && entry.expiresOn < today).length;
155
+ const count = `${baseline.entries.length} ${baseline.entries.length === 1 ? "entry" : "entries"}`;
156
+ if (expired > 0) return {
157
+ label: "Baseline",
158
+ status: "warn",
159
+ detail: `${DEFAULT_BASELINE_FILE}: ${expired} ${expired === 1 ? "entry has" : "entries have"} expired and no longer suppress anything`,
160
+ fix: "npx eaa-kit baseline"
161
+ };
162
+ return {
163
+ label: "Baseline",
164
+ status: "ok",
165
+ detail: `${DEFAULT_BASELINE_FILE}, ${count}`
166
+ };
167
+ } catch (cause) {
168
+ return {
169
+ label: "Baseline",
170
+ status: "fail",
171
+ detail: cause.message,
172
+ fix: "npx eaa-kit baseline"
173
+ };
174
+ }
175
+ }
176
+ async function chromiumCheck(cwd) {
177
+ const { loadChromium } = await import("./playwright-ky4b_HME.js");
178
+ let launcher;
179
+ try {
180
+ launcher = await loadChromium(cwd);
181
+ } catch {
182
+ return {
183
+ status: "skip",
184
+ detail: "optional, for --browser: Playwright is not installed",
185
+ fix: "npm i -D playwright && npx playwright install chromium"
186
+ };
187
+ }
188
+ const executable = launcher.executablePath?.();
189
+ if (executable !== void 0 && !await exists(executable)) return {
190
+ status: "warn",
191
+ detail: "Playwright is installed, but the Chromium it drives is not",
192
+ fix: "npx playwright install chromium"
193
+ };
194
+ return {
195
+ status: "ok",
196
+ detail: "Playwright and Chromium are installed, for --browser"
197
+ };
198
+ }
199
+ /** Whether `command --version` runs. */
200
+ async function canRun(command) {
201
+ return new Promise((resolve) => {
202
+ const child = spawn(command, ["--version"], {
203
+ stdio: "ignore",
204
+ shell: process.platform === "win32"
205
+ });
206
+ child.on("error", () => resolve(false));
207
+ child.on("close", (code) => resolve(code === 0));
208
+ });
209
+ }
210
+ /**
211
+ * Whether a Node version satisfies an `engines` range of the forms this
212
+ * package uses: `^x.y.z`, `>=x.y.z`, joined with `||`. Not a semver library,
213
+ * because one range is all it has to read.
214
+ */
215
+ function nodeSatisfies(version, range) {
216
+ const parse = (value) => value.replace(/^v/, "").split(".").map((part) => Number.parseInt(part, 10) || 0);
217
+ const compare = (a, b) => {
218
+ for (let i = 0; i < 3; i++) {
219
+ const diff = (a[i] ?? 0) - (b[i] ?? 0);
220
+ if (diff !== 0) return diff;
221
+ }
222
+ return 0;
223
+ };
224
+ const have = parse(version);
225
+ return range.split("||").some((alternative) => {
226
+ const clause = alternative.trim();
227
+ if (clause.startsWith("^")) {
228
+ const want = parse(clause.slice(1));
229
+ return have[0] === want[0] && compare(have, want) >= 0;
230
+ }
231
+ if (clause.startsWith(">=")) return compare(have, parse(clause.slice(2))) >= 0;
232
+ return compare(have, parse(clause)) === 0;
233
+ });
234
+ }
235
+ function formatDoctor(result, color = pc.isColorSupported) {
236
+ const colors = pc.createColors(color);
237
+ const mark = {
238
+ ok: colors.green("✓"),
239
+ warn: colors.yellow("!"),
240
+ fail: colors.red("✗"),
241
+ skip: colors.dim("–")
242
+ };
243
+ const lines = result.checks.flatMap((item) => [`${mark[item.status]} ${item.label.padEnd(16)} ${item.detail}`, ...item.fix === void 0 || item.status === "ok" ? [] : [` ${" ".repeat(16)} ${colors.cyan("→")} ${colors.bold(item.fix)}`]]);
244
+ const failed = result.checks.filter((item) => item.status === "fail").length;
245
+ lines.push("", failed === 0 ? "Nothing stops an audit from running here." : `${failed} ${failed === 1 ? "problem stops" : "problems stop"} an audit from running here.`);
246
+ return `${lines.join("\n")}\n`;
247
+ }
248
+ export { formatDoctor, runDoctor };
@@ -1,5 +1,4 @@
1
- import { n as IntegrationOptions, t as BuildAuditError } from "../run-BK2blxMI.js";
2
- //#region src/eleventy/index.d.ts
1
+ import { n as IntegrationOptions, t as BuildAuditError } from "../run-VXnP4uLp.js";
3
2
  /** What `eleventy.after` is given. Only two of its fields are read. */
4
3
  interface EleventyAfterEvent {
5
4
  dir: {
@@ -24,5 +23,4 @@ type EaaKitEleventyOptions = IntegrationOptions;
24
23
  * would be the one people got wrong.
25
24
  */
26
25
  declare function eaaKit(eleventyConfig: EleventyConfigLike, options?: EaaKitEleventyOptions): void;
27
- //#endregion
28
26
  export { BuildAuditError, EaaKitEleventyOptions, EleventyAfterEvent, EleventyConfigLike, eaaKit as default };
@@ -1,6 +1,6 @@
1
- import { n as auditBuild, r as stderrLogger, t as BuildAuditError } from "../run-DzVEOkiF.js";
1
+ import { n as auditBuild, r as stderrLogger, t as BuildAuditError } from "../run-D7tc7IU2.js";
2
2
  import path from "node:path";
3
- //#region src/eleventy/index.ts
3
+ // src/eleventy/index.ts
4
4
  /**
5
5
  * Usable both as a bare plugin and as a configured one.
6
6
  *
@@ -15,5 +15,4 @@ function eaaKit(eleventyConfig, options = {}) {
15
15
  await auditBuild(path.resolve(event.dir.output), options, stderrLogger());
16
16
  });
17
17
  }
18
- //#endregion
19
18
  export { BuildAuditError, eaaKit as default };
@@ -1,4 +1,4 @@
1
- //#region src/audit/entry.ts
1
+ // src/audit/entry.ts
2
2
  /**
3
3
  * What the entry URL of a crawl actually leads to, found before any page is
4
4
  * crawled.
@@ -170,5 +170,4 @@ function describeSignIn(evidence, at) {
170
170
  case "password-field": return `it sends visitors to ${at}, a page with a password field on it`;
171
171
  }
172
172
  }
173
- //#endregion
174
173
  export { describeSignIn, hasPasswordField, isSameSite, probeEntry };
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- //#region src/audit/fingerprint.ts
2
+ // src/audit/fingerprint.ts
3
3
  /**
4
4
  * A stable identity for one violating element.
5
5
  *
@@ -63,5 +63,4 @@ function openingTag(html) {
63
63
  }
64
64
  return trimmed;
65
65
  }
66
- //#endregion
67
66
  export { elementFingerprint as t };