eaa-kit 0.7.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 (115) hide show
  1. package/README.md +182 -135
  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-DRjAY2iY.js → audit-DbqNIrt6.js} +85 -219
  6. package/dist/audit-rUhqnm3o.js +1 -0
  7. package/dist/{baseline-BpE7DbDq.js → baseline-CKElWbx4.js} +18 -8
  8. package/dist/baseline-DU0EPiTq.js +1 -0
  9. package/dist/baseline-DYOejLFO.js +1 -0
  10. package/dist/baseline-DvdsFTQy.js +126 -0
  11. package/dist/{cache-D4dOIuOi.js → cache-DIV4G0TI.js} +24 -5
  12. package/dist/{checklist-DDd9jewi.js → checklist-CA0Ri71Z.js} +8 -9
  13. package/dist/cli/index.js +115 -158
  14. package/dist/{collect-Cu1q9NTB.js → collect-CjucwTEF.js} +16 -8
  15. package/dist/{command-3r4fht5f.js → command-C8ZFvcc1.js} +33 -10
  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-B_PE6r5R.js +180 -0
  21. package/dist/countries-CCqog6dy.js +28 -0
  22. package/dist/coverage-B9_6yv_8.js +2 -0
  23. package/dist/{coverage-cb5kPp48.js → coverage-C1Z6t9Ct.js} +5 -7
  24. package/dist/{crawl-BHkJmUkA.js → crawl-CkHJJV4w.js} +135 -25
  25. package/dist/{criteria-CnPJKGeb.js → criteria-CacF0HP1.js} +1 -2
  26. package/dist/{load-BaWMa-G_.js → define-BdTPIfqE.js} +46 -99
  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-kf94P140.js +173 -0
  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-BIxxF3FC.js → html-Bjq3Iw3g.js} +56 -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 +50 -26
  42. package/dist/index.js +3 -2
  43. package/dist/init-3Ti3ao5Z.js +232 -0
  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-Bus6YhxB.js → json-B_k4CDmR.js} +5 -6
  48. package/dist/json-IL1JxlTL.js +1 -0
  49. package/dist/load-C3eFEdoH.js +98 -0
  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-CCP1WfYe.js +363 -0
  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-C0klJblu.js → remediation-BkE7q7dT.js} +2 -176
  61. package/dist/{render-C1sUZZI_.js → render-ky8cm4QF.js} +50 -24
  62. package/dist/result-DhoT4g0P.js +1 -0
  63. package/dist/{result-B7_zVxAX.js → result-g8dGsrcv.js} +1 -2
  64. package/dist/{review-CdMK2GpQ.js → review-BGjTBFvd.js} +11 -4
  65. package/dist/review-iheEjp7_.js +1 -0
  66. package/dist/{routes-CmdRUuOs.js → routes-BpQeBDmM.js} +4 -5
  67. package/dist/{run-DrS0Komf.js → run-D7tc7IU2.js} +2 -3
  68. package/dist/{run-BK2blxMI.d.ts → run-VXnP4uLp.d.ts} +2 -6
  69. package/dist/{sarif-BNCE0PNT.js → sarif-v66-PjdE.js} +9 -9
  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-CxVyh8IO.js +71 -0
  75. package/dist/start-bdanSxZr.js +100 -0
  76. package/dist/statement/templates/be.de.md +148 -0
  77. package/dist/statement/templates/be.en.md +142 -0
  78. package/dist/statement/templates/be.fr.md +146 -0
  79. package/dist/statement/templates/be.nl.md +147 -0
  80. package/dist/statement/templates/cz.cs.md +138 -0
  81. package/dist/statement/templates/cz.en.md +140 -0
  82. package/dist/statement/templates/dk.da.md +142 -0
  83. package/dist/statement/templates/dk.en.md +142 -0
  84. package/dist/statement/templates/fi.en.md +139 -0
  85. package/dist/statement/templates/fi.fi.md +141 -0
  86. package/dist/statement/templates/ie.en.md +144 -0
  87. package/dist/statement/templates/pl.en.md +143 -0
  88. package/dist/statement/templates/pl.pl.md +144 -0
  89. package/dist/statement/templates/pt.en.md +143 -0
  90. package/dist/statement/templates/pt.pt.md +145 -0
  91. package/dist/statement/templates/se.en.md +148 -0
  92. package/dist/statement/templates/se.sv.md +150 -0
  93. package/dist/{text-BF1LHMiV.js → text-CISDPU49.js} +11 -3
  94. package/dist/{version-B3v4rNoG.js → version-C8aJm8YJ.js} +1 -2
  95. package/dist/vite/index.d.ts +1 -3
  96. package/dist/vite/index.js +2 -3
  97. package/dist/watch-CefxwMsZ.js +121 -0
  98. package/dist/webpack/index.d.ts +1 -3
  99. package/dist/webpack/index.js +2 -3
  100. package/dist/{worksheet-BIxMtbUd.js → worksheet-CcBo9G7s.js} +4 -5
  101. package/dist/workspaces-BBFXOyeV.js +85 -0
  102. package/package.json +16 -14
  103. package/dist/audit-Bwm1xBdJ.js +0 -2
  104. package/dist/baseline-rtnj3RHB.js +0 -2
  105. package/dist/component-DcCn3BJS.js +0 -2
  106. package/dist/coverage-n1X9CkiG.js +0 -3
  107. package/dist/frameworks-etFg_O8K.js +0 -2
  108. package/dist/init-DrFfzjvm.js +0 -119
  109. package/dist/jsdom-BUYuVJJm.js +0 -3
  110. package/dist/json-CrQmoTj6.js +0 -2
  111. package/dist/load-n62iXDq_.js +0 -2
  112. package/dist/project-CzOnkLH6.js +0 -274
  113. package/dist/project-MFrXcw1M.js +0 -2
  114. package/dist/result-CRmjjoAA.js +0 -2
  115. package/dist/review-DIbOTmOM.js +0 -2
@@ -1,274 +0,0 @@
1
- import { n as isDirectory, t as exists } from "./fs-BmPtmFke.js";
2
- import { r as candidateOutputs } from "./frameworks-B4ClIJgE.js";
3
- import { readFile } from "node:fs/promises";
4
- import path from "node:path";
5
- import { glob } from "tinyglobby";
6
- import { spawn } from "node:child_process";
7
- //#region src/audit/project.ts
8
- /**
9
- * Working out what to audit when nobody said.
10
- *
11
- * `eaa-kit audit ./dist` assumes the reader knows which directory their builder
12
- * fills, that it has been built, and that it produces HTML at all — three
13
- * assumptions that are wrong often enough to be the main thing standing between
14
- * installing this tool and getting a report out of it. A Next.js project fails
15
- * all three at once.
16
- *
17
- * So with no directory and no --url, the tool works it out: an existing build
18
- * output if there is one, the project's own build if there is not, and the
19
- * project's server if the build produces nothing browsable. Naming a directory
20
- * or passing --url skips all of it.
21
- */
22
- /** Ports the common dev and preview servers use, tried if nothing is announced. */
23
- const KNOWN_PORTS = [
24
- 3e3,
25
- 4321,
26
- 5173,
27
- 8080,
28
- 4173,
29
- 3001
30
- ];
31
- /** How long to wait for a started server to answer. */
32
- const SERVER_START_TIMEOUT_MS = 9e4;
33
- async function readPackageJson(cwd) {
34
- try {
35
- return JSON.parse(await readFile(path.join(cwd, "package.json"), "utf8"));
36
- } catch {
37
- return;
38
- }
39
- }
40
- /**
41
- * The package manager this project uses, from its lockfile.
42
- *
43
- * Running the wrong one either fails or, worse, silently installs a second
44
- * dependency tree, so the lockfile decides rather than a guess.
45
- */
46
- async function detectPackageManager(cwd) {
47
- for (const [file, manager] of [
48
- ["pnpm-lock.yaml", "pnpm"],
49
- ["yarn.lock", "yarn"],
50
- ["bun.lockb", "bun"]
51
- ]) if (await exists(path.join(cwd, file))) return manager;
52
- return "npm";
53
- }
54
- /**
55
- * The first build directory that exists and actually holds HTML.
56
- *
57
- * Existence alone is not enough: `.next/` exists after any Next.js build and
58
- * holds no browsable page, and `public/` exists in most projects and holds
59
- * assets. What makes a directory the build output is that there is HTML in it.
60
- */
61
- async function findBuildOutput(cwd) {
62
- const candidates = await candidateOutputs(cwd, await readPackageJson(cwd));
63
- for (const candidate of candidates) {
64
- const directory = path.join(cwd, candidate);
65
- if (!await isDirectory(directory)) continue;
66
- if ((await glob(["**/*.html", "**/*.htm"], {
67
- cwd: directory,
68
- ignore: ["**/node_modules/**"],
69
- onlyFiles: true,
70
- dot: false
71
- })).length > 0) return directory;
72
- }
73
- }
74
- /**
75
- * How to invoke a package-manager script on this platform.
76
- *
77
- * Not `shell: true` with an argument array: Node deprecated that in DEP0190
78
- * because the arguments are concatenated rather than escaped, and it prints a
79
- * warning into the middle of somebody's build output. Windows still needs a
80
- * shell — npm and pnpm are `.cmd` shims there, which cannot be spawned
81
- * directly — so cmd.exe is invoked explicitly with one command string instead.
82
- */
83
- function scriptCommand(manager, script) {
84
- if (process.platform !== "win32") return {
85
- command: manager,
86
- args: ["run", script]
87
- };
88
- return {
89
- command: process.env["ComSpec"] ?? "cmd.exe",
90
- args: [
91
- "/d",
92
- "/s",
93
- "/c",
94
- `${manager} run ${script}`
95
- ]
96
- };
97
- }
98
- /**
99
- * Run one of the project's own scripts and wait for it.
100
- *
101
- * stdio is inherited so the build's output goes where the user expects it. This
102
- * runs project code, which is what a build-time tool does — the Astro
103
- * integration already audits from inside one — but it is announced first and
104
- * `--no-build` turns it off.
105
- */
106
- async function runScript(cwd, script) {
107
- const manager = await detectPackageManager(cwd);
108
- const command = `${manager} run ${script}`;
109
- return new Promise((resolve) => {
110
- const { command: bin, args } = scriptCommand(manager, script);
111
- const child = spawn(bin, args, {
112
- cwd,
113
- stdio: [
114
- "ignore",
115
- "inherit",
116
- "inherit"
117
- ]
118
- });
119
- child.on("error", () => resolve({
120
- ok: false,
121
- command
122
- }));
123
- child.on("close", (code) => resolve({
124
- ok: code === 0,
125
- command
126
- }));
127
- });
128
- }
129
- /** Whether something is answering HTTP there yet. */
130
- async function answers(origin) {
131
- try {
132
- const controller = new AbortController();
133
- const timer = setTimeout(() => controller.abort(), 2e3);
134
- try {
135
- await fetch(origin, { signal: controller.signal });
136
- return true;
137
- } finally {
138
- clearTimeout(timer);
139
- }
140
- } catch {
141
- return false;
142
- }
143
- }
144
- /**
145
- * Start the project's server and wait until it answers.
146
- *
147
- * The origin is taken from whatever the server prints, since a project may be
148
- * on any port, and only falls back to probing the common ones. Returns undefined
149
- * if nothing came up before the timeout, having already stopped the process.
150
- */
151
- async function startServer(cwd, script) {
152
- const { command: bin, args } = scriptCommand(await detectPackageManager(cwd), script);
153
- const child = spawn(bin, args, {
154
- cwd,
155
- stdio: [
156
- "ignore",
157
- "pipe",
158
- "pipe"
159
- ],
160
- detached: process.platform !== "win32"
161
- });
162
- let announced;
163
- const watch = (chunk) => {
164
- const match = /https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\]):(\d{2,5})/.exec(String(chunk));
165
- if (match && announced === void 0) announced = `http://localhost:${match[1]}`;
166
- };
167
- child.stdout?.on("data", watch);
168
- child.stderr?.on("data", watch);
169
- let stopped = false;
170
- const stop = async () => {
171
- if (stopped) return;
172
- stopped = true;
173
- const signal = (name) => {
174
- try {
175
- if (child.pid === void 0) return;
176
- if (process.platform === "win32") child.kill(name);
177
- else process.kill(-child.pid, name);
178
- } catch {}
179
- };
180
- if (child.exitCode === null && child.signalCode === null) {
181
- signal("SIGTERM");
182
- await new Promise((resolve) => {
183
- const timer = setTimeout(() => {
184
- signal("SIGKILL");
185
- resolve();
186
- }, 5e3);
187
- child.once("close", () => {
188
- clearTimeout(timer);
189
- resolve();
190
- });
191
- });
192
- }
193
- child.stdout?.destroy();
194
- child.stderr?.destroy();
195
- child.unref();
196
- };
197
- const deadline = Date.now() + SERVER_START_TIMEOUT_MS;
198
- while (Date.now() < deadline) {
199
- if (child.exitCode !== null) return void 0;
200
- for (const origin of announced === void 0 ? KNOWN_PORTS.map((port) => `http://localhost:${port}`) : [announced]) if (await answers(origin)) return {
201
- origin,
202
- stop
203
- };
204
- await new Promise((resolve) => setTimeout(resolve, 500));
205
- }
206
- await stop();
207
- }
208
- /**
209
- * Work out what to audit in this project, building or serving it if need be.
210
- *
211
- * Returns undefined when there is nothing it can do, leaving the caller to
212
- * explain — it has better context for the message than this does.
213
- */
214
- async function autoDetectSource(cwd, options = {}) {
215
- const steps = [];
216
- const step = (message) => {
217
- steps.push(message);
218
- options.onStep?.(message);
219
- };
220
- const existing = await findBuildOutput(cwd);
221
- if (existing !== void 0) {
222
- step(`Found a build in ${path.relative(cwd, existing) || "."}/`);
223
- return {
224
- directory: existing,
225
- steps
226
- };
227
- }
228
- const pkg = await readPackageJson(cwd);
229
- const { detectFramework } = await import("./frameworks-etFg_O8K.js");
230
- const detected = await detectFramework(cwd, pkg);
231
- if (detected !== void 0 && detected.framework.outputs.length === 0) {
232
- step(`${detected.framework.name} renders on a server and writes no HTML to disk`);
233
- return { steps };
234
- }
235
- if (pkg === void 0) return void 0;
236
- const scripts = pkg.scripts ?? {};
237
- if (options.noBuild) return void 0;
238
- if (scripts["build"] !== void 0) {
239
- step("No build found; running the project build first");
240
- const built = await runScript(cwd, "build");
241
- if (!built.ok) {
242
- step(`${built.command} failed`);
243
- return { steps };
244
- }
245
- const produced = await findBuildOutput(cwd);
246
- if (produced !== void 0) {
247
- step(`Built ${path.relative(cwd, produced) || "."}/`);
248
- return {
249
- directory: produced,
250
- steps
251
- };
252
- }
253
- }
254
- const serveScript = [
255
- "start",
256
- "preview",
257
- "serve"
258
- ].find((name) => scripts[name] !== void 0);
259
- if (serveScript === void 0) return { steps };
260
- step(`This site renders on a server; starting it with ${serveScript}`);
261
- const server = await startServer(cwd, serveScript);
262
- if (server === void 0) {
263
- step(`Could not start the site with ${serveScript}`);
264
- return { steps };
265
- }
266
- step(`Auditing ${server.origin}`);
267
- return {
268
- url: server.origin,
269
- cleanup: server.stop,
270
- steps
271
- };
272
- }
273
- //#endregion
274
- export { runScript as a, readPackageJson as i, detectPackageManager as n, startServer as o, findBuildOutput as r, autoDetectSource as t };
@@ -1,2 +0,0 @@
1
- import { i as readPackageJson, t as autoDetectSource } from "./project-CzOnkLH6.js";
2
- export { autoDetectSource, readPackageJson };
@@ -1,2 +0,0 @@
1
- import { c as pageUrl } from "./result-B7_zVxAX.js";
2
- export { pageUrl };
@@ -1,2 +0,0 @@
1
- import { a as blankReview, c as readReview, d as writeReview, i as answeredCount, r as ReviewError } from "./review-CdMK2GpQ.js";
2
- export { ReviewError, answeredCount, blankReview, readReview, writeReview };