eaa-kit 0.6.0 → 0.9.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 (97) hide show
  1. package/README.md +52 -15
  2. package/dist/astro/index.d.ts +1 -1
  3. package/dist/astro/index.js +1 -1
  4. package/dist/audit/runners/worker.js +1 -1
  5. package/dist/audit-CJDCQaFY.js +2 -0
  6. package/dist/{audit-e_uixhPG.js → audit-J2jeLo-y.js} +170 -241
  7. package/dist/{baseline-BscHfFSW.js → baseline-477B1CZ_.js} +1 -1
  8. package/dist/baseline-D9ihb-wk.js +2 -0
  9. package/dist/{baseline-D2qWmUC6.js → baseline-DrFh7joZ.js} +15 -4
  10. package/dist/baseline-wyJsSIFQ.js +127 -0
  11. package/dist/cache-D4dOIuOi.js +219 -0
  12. package/dist/{checklist-BtgkxMEa.js → checklist-Gx2g3LFC.js} +6 -6
  13. package/dist/cli/index.js +103 -147
  14. package/dist/{collect-Cu1q9NTB.js → collect-BJYk7_pJ.js} +1 -1
  15. package/dist/{command-CZKp9Wi_.js → command-BGGMf4vn.js} +35 -8
  16. package/dist/countries-DRTBubeE.js +25 -0
  17. package/dist/countries-Dg0BdytB.js +156 -0
  18. package/dist/coverage-GvaMpV64.js +3 -0
  19. package/dist/{coverage-BD2_CYns.js → coverage-zdzgSKjz.js} +4 -286
  20. package/dist/{crawl-BHkJmUkA.js → crawl-DwdqiljK.js} +5 -3
  21. package/dist/criteria-CnPJKGeb.js +286 -0
  22. package/dist/{load-vZdV_fD1.js → define-Ctf2uOEh.js} +47 -95
  23. package/dist/eleventy/index.d.ts +1 -1
  24. package/dist/eleventy/index.js +1 -1
  25. package/dist/entry-CjqjrUBY.js +174 -0
  26. package/dist/{html-Bmh7X_sM.js → html-whingnfj.js} +9 -5
  27. package/dist/index.d.ts +61 -5
  28. package/dist/index.js +3 -2
  29. package/dist/init-CPbFVMuk.js +293 -0
  30. package/dist/jsdom-BUYuVJJm.js +3 -0
  31. package/dist/{jsdom-CQar6OQS.js → jsdom-CsW_xVcA.js} +11 -12
  32. package/dist/{json-HJDgJp09.js → json-CyLmvF5P.js} +1 -1
  33. package/dist/{json-PNg6BeXp.js → json-SGCgxSPT.js} +4 -3
  34. package/dist/load-CH-ltdlq.js +99 -0
  35. package/dist/load-D7lBeOsq.js +2 -0
  36. package/dist/nuxt/index.d.ts +1 -1
  37. package/dist/nuxt/index.js +1 -1
  38. package/dist/pages-DxY5Z0gl.js +300 -0
  39. package/dist/{playwright-C-miJP2b.js → playwright-ukCr_5o3.js} +1 -1
  40. package/dist/{pool-dkexq5xo.js → pool-B4tEUa2S.js} +6 -2
  41. package/dist/{project-MFrXcw1M.js → project-BLFdCbOq.js} +1 -1
  42. package/dist/{project-CzOnkLH6.js → project-v2PoRw70.js} +18 -1
  43. package/dist/{completeness-Dwq3CPB3.js → remediation-Bbs4KcX1.js} +72 -42
  44. package/dist/{render-CtsqR0k-.js → render-C6zYfaba.js} +69 -7
  45. package/dist/{result-DfUru6y_.js → result-B7_zVxAX.js} +1 -1
  46. package/dist/result-CRmjjoAA.js +2 -0
  47. package/dist/{review-CdMK2GpQ.js → review-Bz0fO9_I.js} +9 -1
  48. package/dist/{review-DIbOTmOM.js → review-a-2ghjQ5.js} +1 -1
  49. package/dist/{routes-CmdRUuOs.js → routes-CSctpS1P.js} +1 -1
  50. package/dist/{run-YiqyQA2b.d.ts → run-BK2blxMI.d.ts} +8 -0
  51. package/dist/{run-D7hdVXLA.js → run-DzVEOkiF.js} +6 -2
  52. package/dist/{sarif-BKvq_AUm.js → sarif-9BAgNiOa.js} +5 -3
  53. package/dist/site-BHMtf3q2.js +72 -0
  54. package/dist/start-DzOM0p6I.js +101 -0
  55. package/dist/statement/templates/at.de.md +14 -0
  56. package/dist/statement/templates/at.en.md +14 -0
  57. package/dist/statement/templates/be.de.md +148 -0
  58. package/dist/statement/templates/be.en.md +142 -0
  59. package/dist/statement/templates/be.fr.md +146 -0
  60. package/dist/statement/templates/be.nl.md +147 -0
  61. package/dist/statement/templates/ch.de.md +14 -0
  62. package/dist/statement/templates/ch.en.md +14 -0
  63. package/dist/statement/templates/cz.cs.md +137 -0
  64. package/dist/statement/templates/cz.en.md +139 -0
  65. package/dist/statement/templates/de.de.md +14 -0
  66. package/dist/statement/templates/de.en.md +14 -0
  67. package/dist/statement/templates/dk.da.md +141 -0
  68. package/dist/statement/templates/dk.en.md +141 -0
  69. package/dist/statement/templates/es.en.md +14 -0
  70. package/dist/statement/templates/es.es.md +15 -0
  71. package/dist/statement/templates/fi.en.md +139 -0
  72. package/dist/statement/templates/fi.fi.md +141 -0
  73. package/dist/statement/templates/fr.en.md +14 -0
  74. package/dist/statement/templates/fr.fr.md +15 -0
  75. package/dist/statement/templates/ie.en.md +144 -0
  76. package/dist/statement/templates/it.en.md +14 -0
  77. package/dist/statement/templates/it.it.md +15 -0
  78. package/dist/statement/templates/nl.en.md +14 -0
  79. package/dist/statement/templates/nl.nl.md +15 -0
  80. package/dist/statement/templates/pl.en.md +143 -0
  81. package/dist/statement/templates/pl.pl.md +144 -0
  82. package/dist/statement/templates/pt.en.md +142 -0
  83. package/dist/statement/templates/pt.pt.md +145 -0
  84. package/dist/statement/templates/se.en.md +139 -0
  85. package/dist/statement/templates/se.sv.md +142 -0
  86. package/dist/vite/index.d.ts +1 -1
  87. package/dist/vite/index.js +1 -1
  88. package/dist/watch-B2RoUbo0.js +122 -0
  89. package/dist/webpack/index.d.ts +1 -1
  90. package/dist/webpack/index.js +1 -1
  91. package/dist/{worksheet-eUjwYLxC.js → worksheet-B_kQ1pxq.js} +3 -2
  92. package/package.json +4 -3
  93. package/dist/audit-DK2StT1_.js +0 -2
  94. package/dist/coverage-7bQqWNfN.js +0 -2
  95. package/dist/init-BjKYttxc.js +0 -119
  96. package/dist/jsdom-DMvU2h-f.js +0 -3
  97. package/dist/load-Bc_xDGAh.js +0 -2
@@ -1,7 +1,7 @@
1
1
  import { c as nullable, d as optional, h as string, l as number, m as safeParse, o as isoDate, t as array, u as object, y as withDefault } from "./schema-DJSF4K05.js";
2
2
  import { a as isoDate$1 } from "./text-BF1LHMiV.js";
3
3
  import { t as elementFingerprint } from "./fingerprint-BjYV_0F7.js";
4
- import { o as findingElements } from "./result-DfUru6y_.js";
4
+ import { s as findingElements } from "./result-B7_zVxAX.js";
5
5
  import { mkdir, readFile, writeFile } from "node:fs/promises";
6
6
  import path from "node:path";
7
7
  /** Default filename, used by the CLI when no path is given. */
@@ -29,7 +29,12 @@ const baselineSchema = object({
29
29
  entries: withDefault(array(entrySchema), () => [])
30
30
  });
31
31
  var BaselineError = class extends Error {
32
+ next;
32
33
  name = "BaselineError";
34
+ constructor(message, next) {
35
+ super(message);
36
+ this.next = next;
37
+ }
33
38
  };
34
39
  /**
35
40
  * Move the violations a baseline accounts for out of the failing set.
@@ -154,7 +159,10 @@ async function readBaseline(file, cwd = process.cwd()) {
154
159
  try {
155
160
  raw = await readFile(target, "utf8");
156
161
  } catch {
157
- throw new BaselineError(`Could not read the baseline at ${file}. Create one with: eaa-kit baseline`);
162
+ throw new BaselineError(`Could not read the baseline at ${file}`, {
163
+ command: `eaa-kit baseline --output ${file}`,
164
+ why: "record what the build has today"
165
+ });
158
166
  }
159
167
  let value;
160
168
  try {
@@ -167,8 +175,11 @@ async function readBaseline(file, cwd = process.cwd()) {
167
175
  const issues = result.error.issues.map((issue) => `${issue.path.join(".") || "document"}: ${issue.message}`).slice(0, 5);
168
176
  throw new BaselineError(`${path.basename(target)} is not an eaa-kit baseline (${issues.join("; ")})`);
169
177
  }
170
- if (result.data.schemaVersion !== 2) throw new BaselineError(`${path.basename(target)} has schemaVersion ${result.data.schemaVersion}; this version of eaa-kit reads 2.\n Record it again on the current build: eaa-kit baseline\n Read the new file before committing it: it lists what this run found, which is
171
- not necessarily what the old one accepted.`);
178
+ if (result.data.schemaVersion !== 2) throw new BaselineError(`${path.basename(target)} has schemaVersion ${result.data.schemaVersion}; this version of eaa-kit reads 2.\n Read the new file before committing it: it lists what this run found, which is
179
+ not necessarily what the old one accepted.`, {
180
+ command: `eaa-kit baseline --output ${file}`,
181
+ why: "record it again on the current build"
182
+ });
172
183
  return result.data;
173
184
  }
174
185
  async function writeBaseline(file, baseline, cwd = process.cwd()) {
@@ -0,0 +1,127 @@
1
+ import { n as count } from "./text-BF1LHMiV.js";
2
+ import { a as pruneBaseline, c as writeBaseline, i as buildBaseline, o as readBaseline, r as applyBaseline, t as BaselineError } from "./baseline-DrFh7joZ.js";
3
+ import { l as note, o as fail, s as failWith, t as advise, u as runEngine } from "./command-BGGMf4vn.js";
4
+ import { t as resolvePages } from "./pages-DxY5Z0gl.js";
5
+ import path from "node:path";
6
+ //#region src/cli/baseline.ts
7
+ /**
8
+ * `eaa-kit baseline [dir]`.
9
+ *
10
+ * Runs the same audit the audit command runs and writes down every violation it
11
+ * found, so that a later run can fail on what is new instead of on everything.
12
+ *
13
+ * Deliberately a subcommand rather than a flag on `audit`. Accepting a set of
14
+ * violations is a decision somebody makes once and commits to a file others
15
+ * will read; folding it into the command that checks them would make it far too
16
+ * easy to type by reflex when a build goes red, which is precisely the moment
17
+ * it should take a deliberate act.
18
+ */
19
+ async function runBaselineCommand(dir, options = {}) {
20
+ const cwd = options.cwd ?? process.cwd();
21
+ const resolved = await resolvePages(path.resolve(cwd, dir), {
22
+ ...options,
23
+ label: dir
24
+ });
25
+ if (!resolved) return {
26
+ entries: 0,
27
+ exitCode: 2
28
+ };
29
+ const { pages, origin, label, directory } = resolved;
30
+ note(`Auditing ${count(pages.length, "page")} in ${label}…`);
31
+ const baseUrl = options.baseUrl ?? origin;
32
+ const audits = await runEngine(pages, {
33
+ cwd,
34
+ ...options.headers === void 0 ? {} : { headers: options.headers },
35
+ ...baseUrl === void 0 ? {} : { baseUrl },
36
+ ...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs },
37
+ ...options.browser ? { browser: true } : {},
38
+ ...options.concurrency === void 0 ? {} : { concurrency: options.concurrency },
39
+ ...directory === void 0 ? {} : { directory }
40
+ });
41
+ if (!audits) return {
42
+ entries: 0,
43
+ exitCode: 2
44
+ };
45
+ const unaudited = audits.filter((audit) => audit.error);
46
+ if (unaudited.length > 0) {
47
+ fail(`${unaudited.length} of ${audits.length} pages could not be audited, so no baseline was written`);
48
+ return {
49
+ entries: 0,
50
+ exitCode: 2
51
+ };
52
+ }
53
+ const target = options.output ?? "eaa-baseline.json";
54
+ if (options.prune) return await prune(audits, target, cwd);
55
+ const baseline = buildBaseline(audits, {
56
+ ...options.note ? { note: options.note } : {},
57
+ ...options.expiresOn ? { expiresOn: options.expiresOn } : {}
58
+ });
59
+ try {
60
+ await writeBaseline(target, baseline, cwd);
61
+ } catch (cause) {
62
+ if (cause instanceof BaselineError) {
63
+ failWith(cause);
64
+ return {
65
+ entries: 0,
66
+ exitCode: 2
67
+ };
68
+ }
69
+ throw cause;
70
+ }
71
+ const entries = baseline.entries.length;
72
+ note(`Wrote ${count(entries, "entry")} to ${target}`);
73
+ if (entries > 0) advise("These are barriers, not exceptions. Commit the file, then work the list down.");
74
+ return {
75
+ entries,
76
+ exitCode: 0
77
+ };
78
+ }
79
+ /**
80
+ * `--prune`: take out what this run shows is gone, and add nothing.
81
+ *
82
+ * The audit already tells anybody running it that entries no longer match and
83
+ * can be removed. Acting on that advice meant editing JSON by hand, entry by
84
+ * entry, against a file whose whole purpose is that nobody has to remember what
85
+ * is in it — so most people did not, and a baseline accumulated barriers that
86
+ * were fixed years ago while looking exactly like one that had not been read.
87
+ *
88
+ * Recording a new baseline is not the same operation and is not a substitute:
89
+ * it accepts whatever the site fails today, which on a bad day quietly adopts a
90
+ * barrier nobody agreed to.
91
+ */
92
+ async function prune(audits, target, cwd) {
93
+ let existing;
94
+ try {
95
+ existing = await readBaseline(target, cwd);
96
+ } catch (cause) {
97
+ if (cause instanceof BaselineError) {
98
+ failWith(cause);
99
+ return {
100
+ entries: 0,
101
+ exitCode: 2
102
+ };
103
+ }
104
+ throw cause;
105
+ }
106
+ const outcome = applyBaseline(audits, existing);
107
+ const { baseline, removed } = pruneBaseline(existing, outcome.stale);
108
+ if (removed.length === 0) {
109
+ note(`Nothing to remove from ${target}: every entry still matches something on this run`);
110
+ return {
111
+ entries: existing.entries.length,
112
+ removed: 0,
113
+ exitCode: 0
114
+ };
115
+ }
116
+ await writeBaseline(target, baseline, cwd);
117
+ note(`Removed ${count(removed.length, "entry")} from ${target}; ${count(baseline.entries.length, "entry")} left`);
118
+ for (const entry of removed) note(` ${entry.page} ${entry.ruleId}`);
119
+ if (outcome.expired.length > 0) advise(`${count(outcome.expired.length, "entry")} have expired and suppress nothing; --prune leaves them for you to decide about`);
120
+ return {
121
+ entries: baseline.entries.length,
122
+ removed: removed.length,
123
+ exitCode: 0
124
+ };
125
+ }
126
+ //#endregion
127
+ export { runBaselineCommand as t };
@@ -0,0 +1,219 @@
1
+ import { c as nullable, d as optional, h as string, i as enumeration, l as number, m as safeParse, t as array, u as object, y as withDefault } from "./schema-DJSF4K05.js";
2
+ import { a as isoDate } from "./text-BF1LHMiV.js";
3
+ import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { createHash } from "node:crypto";
6
+ const MANIFEST_FILE = "manifest.json";
7
+ const outcomeSchema = object({
8
+ ruleId: string(),
9
+ help: withDefault(string(), () => ""),
10
+ helpUrl: withDefault(string(), () => ""),
11
+ successCriteria: withDefault(array(string()), () => []),
12
+ enClauses: withDefault(array(string()), () => []),
13
+ tags: withDefault(array(string()), () => [])
14
+ });
15
+ const nodeSchema = object({
16
+ html: string(),
17
+ target: withDefault(array(string()), () => []),
18
+ failureSummary: optional(string())
19
+ });
20
+ const findingSchema = object({
21
+ ruleId: string(),
22
+ help: withDefault(string(), () => ""),
23
+ helpUrl: withDefault(string(), () => ""),
24
+ successCriteria: withDefault(array(string()), () => []),
25
+ enClauses: withDefault(array(string()), () => []),
26
+ tags: withDefault(array(string()), () => []),
27
+ impact: withDefault(nullable(string()), () => null),
28
+ nodes: withDefault(array(nodeSchema), () => [])
29
+ });
30
+ const incompleteSchema = object({
31
+ ruleId: string(),
32
+ help: withDefault(string(), () => ""),
33
+ helpUrl: withDefault(string(), () => ""),
34
+ successCriteria: withDefault(array(string()), () => []),
35
+ enClauses: withDefault(array(string()), () => []),
36
+ tags: withDefault(array(string()), () => []),
37
+ impact: withDefault(nullable(string()), () => null),
38
+ nodes: withDefault(array(nodeSchema), () => []),
39
+ reason: enumeration(["needs-review", "engine-limitation"]),
40
+ reasonDetail: withDefault(string(), () => "")
41
+ });
42
+ const entrySchema = object({
43
+ schemaVersion: number(),
44
+ /** The page this describes, as the run names it. */
45
+ page: string(),
46
+ /** ISO date the result was produced, printed by the reports. */
47
+ cachedOn: string(),
48
+ violations: withDefault(array(findingSchema), () => []),
49
+ incomplete: withDefault(array(incompleteSchema), () => []),
50
+ passes: withDefault(array(outcomeSchema), () => []),
51
+ inapplicable: withDefault(array(outcomeSchema), () => [])
52
+ });
53
+ const manifestSchema = object({
54
+ schemaVersion: number(),
55
+ /** Hash of everything in `CacheInputs`. A mismatch discards the cache. */
56
+ key: string(),
57
+ createdOn: withDefault(string(), () => "")
58
+ });
59
+ /**
60
+ * The identity of a page's content.
61
+ *
62
+ * Path and HTML together: the same markup at two paths is two pages, because
63
+ * the path is what a baseline, a diff and every report key on. A full digest
64
+ * rather than the sixteen characters `elementFingerprint` uses — that one is
65
+ * read by people in a committed file, and this one is read only by the tool,
66
+ * where a collision would serve one page's verdicts for another's.
67
+ */
68
+ function pageKey(page) {
69
+ return createHash("sha256").update(`${page.relativePath}\n${page.html}`).digest("hex");
70
+ }
71
+ /**
72
+ * The identity of everything else the verdict depends on.
73
+ *
74
+ * Headers are hashed with the rest and never recorded: what a run sent can
75
+ * change what it was served, so it belongs in the key, and a credential does
76
+ * not belong on disk.
77
+ */
78
+ function inputsKey(inputs) {
79
+ const headers = Object.entries(inputs.headers ?? {}).map(([name, value]) => `${name.toLowerCase()}=${value}`).sort().join("\n");
80
+ return createHash("sha256").update([
81
+ `tool=${inputs.toolVersion}`,
82
+ `axe=${inputs.axeVersion}`,
83
+ `tags=${[...inputs.tags].join(",")}`,
84
+ `engine=${inputs.engine}`,
85
+ `fast=${inputs.fast}`,
86
+ `viewport=${inputs.viewport ? `${inputs.viewport.width}x${inputs.viewport.height}` : ""}`,
87
+ `baseUrl=${inputs.baseUrl ?? ""}`,
88
+ `timeout=${inputs.timeoutMs ?? ""}`,
89
+ `headers=${createHash("sha256").update(headers).digest("hex")}`
90
+ ].join("\n")).digest("hex");
91
+ }
92
+ /**
93
+ * Open the cache for a run, discarding it if anything about the run changed.
94
+ *
95
+ * Everything is read up front and held in memory: an audit asks about every
96
+ * page before it audits any, the entries are small, and a synchronous answer
97
+ * is what lets the caller decide whether to import an engine at all.
98
+ */
99
+ async function openCache(inputs, options = {}) {
100
+ const root = path.resolve(options.cwd ?? process.cwd(), options.dir ?? ".eaa-kit/cache");
101
+ const key = inputsKey(inputs);
102
+ const today = isoDate(options.today ?? /* @__PURE__ */ new Date());
103
+ const entries = await manifestMatches(root, key) ? await readEntries(root) : /* @__PURE__ */ new Map();
104
+ const written = /* @__PURE__ */ new Map();
105
+ return {
106
+ get(page) {
107
+ return entries.get(pageKey(page));
108
+ },
109
+ put(page, audit) {
110
+ if (audit.error !== void 0) return;
111
+ written.set(pageKey(page), toEntry(page, audit, today));
112
+ },
113
+ async flush() {
114
+ if (written.size === 0) return;
115
+ try {
116
+ await mkdir(root, { recursive: true });
117
+ await writeFile(path.join(root, MANIFEST_FILE), `${JSON.stringify({
118
+ schemaVersion: 1,
119
+ key,
120
+ createdOn: today
121
+ }, null, 2)}\n`, "utf8");
122
+ await Promise.all([...written].map(([hash, entry]) => writeFile(path.join(root, `${hash}.json`), `${JSON.stringify(entry)}\n`, "utf8")));
123
+ } catch {}
124
+ }
125
+ };
126
+ }
127
+ /**
128
+ * Whether the stored cache was produced under the same conditions as this run.
129
+ *
130
+ * A mismatch empties the directory rather than leaving entries to be stepped
131
+ * over. They can never be read again — the key that would reach them is gone —
132
+ * and leaving them would grow `.eaa-kit/` without limit.
133
+ */
134
+ async function manifestMatches(root, key) {
135
+ let raw;
136
+ try {
137
+ raw = await readFile(path.join(root, MANIFEST_FILE), "utf8");
138
+ } catch {
139
+ return false;
140
+ }
141
+ let parsed;
142
+ try {
143
+ parsed = JSON.parse(raw);
144
+ } catch {
145
+ await discard(root);
146
+ return false;
147
+ }
148
+ const result = safeParse(manifestSchema, parsed);
149
+ if (!result.success || result.data.schemaVersion !== 1 || result.data.key !== key) {
150
+ await discard(root);
151
+ return false;
152
+ }
153
+ return true;
154
+ }
155
+ async function discard(root) {
156
+ try {
157
+ await rm(root, {
158
+ recursive: true,
159
+ force: true
160
+ });
161
+ } catch {}
162
+ }
163
+ /** Every entry in the directory, keyed by page hash. A bad file is skipped. */
164
+ async function readEntries(root) {
165
+ let files;
166
+ try {
167
+ files = await readdir(root);
168
+ } catch {
169
+ return /* @__PURE__ */ new Map();
170
+ }
171
+ const entries = /* @__PURE__ */ new Map();
172
+ await Promise.all(files.filter((file) => file.endsWith(".json") && file !== MANIFEST_FILE).map(async (file) => {
173
+ try {
174
+ const parsed = JSON.parse(await readFile(path.join(root, file), "utf8"));
175
+ const result = safeParse(entrySchema, parsed);
176
+ if (!result.success || result.data.schemaVersion !== 1) return;
177
+ entries.set(path.basename(file, ".json"), result.data);
178
+ } catch {}
179
+ }));
180
+ return entries;
181
+ }
182
+ /** The parts of a result that describe the page rather than the run. */
183
+ function toEntry(page, audit, today) {
184
+ return {
185
+ schemaVersion: 1,
186
+ page: page.relativePath,
187
+ cachedOn: today,
188
+ violations: audit.violations,
189
+ incomplete: audit.incomplete,
190
+ passes: audit.passes,
191
+ inapplicable: audit.inapplicable
192
+ };
193
+ }
194
+ /**
195
+ * A stored result, put back together as this run's audit.
196
+ *
197
+ * The page's own facts come from the cache; everything about *this* run — where
198
+ * the file is, what URL it is audited under, which engine is running — comes
199
+ * from the run, because those are not properties of the result. `durationMs` is
200
+ * zero rather than the duration of a run that happened on another day, and
201
+ * `reused` is what stops every consumer downstream from mistaking this for work
202
+ * that was done just now.
203
+ */
204
+ function fromEntry(entry, page, context) {
205
+ return {
206
+ relativePath: page.relativePath,
207
+ absolutePath: page.absolutePath,
208
+ url: context.url,
209
+ engine: context.engine,
210
+ violations: entry.violations,
211
+ incomplete: entry.incomplete,
212
+ passes: entry.passes,
213
+ inapplicable: entry.inapplicable,
214
+ durationMs: 0,
215
+ reused: { on: entry.cachedOn }
216
+ };
217
+ }
218
+ //#endregion
219
+ export { fromEntry, openCache };
@@ -1,21 +1,21 @@
1
1
  import { n as count } from "./text-BF1LHMiV.js";
2
- import { a as emitDocument, o as fail, s as note } from "./command-CZKp9Wi_.js";
3
- import "./review-CdMK2GpQ.js";
2
+ import { a as emitDocument, l as note, s as failWith } from "./command-BGGMf4vn.js";
3
+ import "./review-Bz0fO9_I.js";
4
4
  import { access } from "node:fs/promises";
5
5
  import path from "node:path";
6
6
  //#region src/cli/checklist.ts
7
7
  async function runChecklistCommand(options = {}) {
8
8
  const cwd = options.cwd ?? process.cwd();
9
9
  const recordPath = options.record ?? "eaa-review.json";
10
- const { WCAG22_AA_CRITERIA } = await import("./coverage-7bQqWNfN.js");
11
- const { answeredCount, blankReview, readReview, ReviewError, writeReview } = await import("./review-DIbOTmOM.js");
10
+ const { WCAG22_AA_CRITERIA } = await import("./coverage-GvaMpV64.js");
11
+ const { answeredCount, blankReview, readReview, ReviewError, writeReview } = await import("./review-a-2ghjQ5.js");
12
12
  let existing;
13
13
  try {
14
14
  existing = await readReview(recordPath, cwd);
15
15
  } catch (cause) {
16
16
  if (!(cause instanceof ReviewError)) throw cause;
17
17
  if (await exists(path.resolve(cwd, recordPath))) {
18
- fail(cause.message);
18
+ failWith(cause);
19
19
  return { exitCode: 2 };
20
20
  }
21
21
  }
@@ -23,7 +23,7 @@ async function runChecklistCommand(options = {}) {
23
23
  if (options.reviewedBy !== void 0) record.reviewedBy = options.reviewedBy;
24
24
  await writeReview(recordPath, record, cwd);
25
25
  note(existing === void 0 ? `Review record written to ${recordPath}` : `Review record updated at ${recordPath}: ${count(answeredCount(record), "criterion")} already answered`);
26
- const { buildWorksheet } = await import("./worksheet-eUjwYLxC.js");
26
+ const { buildWorksheet } = await import("./worksheet-B_kQ1pxq.js");
27
27
  await emitDocument(buildWorksheet({
28
28
  recordPath,
29
29
  review: record