eaa-kit 0.7.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.
- package/README.md +30 -8
- package/dist/astro/index.js +1 -1
- package/dist/audit-CJDCQaFY.js +2 -0
- package/dist/{audit-DRjAY2iY.js → audit-J2jeLo-y.js} +38 -198
- package/dist/{baseline-rtnj3RHB.js → baseline-477B1CZ_.js} +1 -1
- package/dist/baseline-D9ihb-wk.js +2 -0
- package/dist/{baseline-BpE7DbDq.js → baseline-DrFh7joZ.js} +14 -3
- package/dist/baseline-wyJsSIFQ.js +127 -0
- package/dist/{checklist-DDd9jewi.js → checklist-Gx2g3LFC.js} +6 -6
- package/dist/cli/index.js +83 -143
- package/dist/{collect-Cu1q9NTB.js → collect-BJYk7_pJ.js} +1 -1
- package/dist/{command-3r4fht5f.js → command-BGGMf4vn.js} +30 -4
- package/dist/countries-DRTBubeE.js +25 -0
- package/dist/countries-Dg0BdytB.js +156 -0
- package/dist/{coverage-n1X9CkiG.js → coverage-GvaMpV64.js} +1 -1
- package/dist/{coverage-cb5kPp48.js → coverage-zdzgSKjz.js} +1 -1
- package/dist/{crawl-BHkJmUkA.js → crawl-DwdqiljK.js} +5 -3
- package/dist/{load-BaWMa-G_.js → define-Ctf2uOEh.js} +41 -94
- package/dist/eleventy/index.js +1 -1
- package/dist/entry-CjqjrUBY.js +174 -0
- package/dist/{html-BIxxF3FC.js → html-whingnfj.js} +6 -4
- package/dist/index.d.ts +42 -5
- package/dist/index.js +3 -2
- package/dist/init-CPbFVMuk.js +293 -0
- package/dist/{json-CrQmoTj6.js → json-CyLmvF5P.js} +1 -1
- package/dist/{json-Bus6YhxB.js → json-SGCgxSPT.js} +1 -1
- package/dist/load-CH-ltdlq.js +99 -0
- package/dist/load-D7lBeOsq.js +2 -0
- package/dist/nuxt/index.js +1 -1
- package/dist/pages-DxY5Z0gl.js +300 -0
- package/dist/{project-MFrXcw1M.js → project-BLFdCbOq.js} +1 -1
- package/dist/{project-CzOnkLH6.js → project-v2PoRw70.js} +18 -1
- package/dist/{remediation-C0klJblu.js → remediation-Bbs4KcX1.js} +18 -1
- package/dist/{render-C1sUZZI_.js → render-C6zYfaba.js} +29 -5
- package/dist/{review-CdMK2GpQ.js → review-Bz0fO9_I.js} +9 -1
- package/dist/{review-DIbOTmOM.js → review-a-2ghjQ5.js} +1 -1
- package/dist/{routes-CmdRUuOs.js → routes-CSctpS1P.js} +1 -1
- package/dist/{run-DrS0Komf.js → run-DzVEOkiF.js} +1 -1
- package/dist/{sarif-BNCE0PNT.js → sarif-9BAgNiOa.js} +3 -2
- package/dist/site-BHMtf3q2.js +72 -0
- package/dist/start-DzOM0p6I.js +101 -0
- package/dist/statement/templates/be.de.md +148 -0
- package/dist/statement/templates/be.en.md +142 -0
- package/dist/statement/templates/be.fr.md +146 -0
- package/dist/statement/templates/be.nl.md +147 -0
- package/dist/statement/templates/cz.cs.md +137 -0
- package/dist/statement/templates/cz.en.md +139 -0
- package/dist/statement/templates/dk.da.md +141 -0
- package/dist/statement/templates/dk.en.md +141 -0
- package/dist/statement/templates/fi.en.md +139 -0
- package/dist/statement/templates/fi.fi.md +141 -0
- package/dist/statement/templates/ie.en.md +144 -0
- package/dist/statement/templates/pl.en.md +143 -0
- package/dist/statement/templates/pl.pl.md +144 -0
- package/dist/statement/templates/pt.en.md +142 -0
- package/dist/statement/templates/pt.pt.md +145 -0
- package/dist/statement/templates/se.en.md +139 -0
- package/dist/statement/templates/se.sv.md +142 -0
- package/dist/vite/index.js +1 -1
- package/dist/watch-B2RoUbo0.js +122 -0
- package/dist/webpack/index.js +1 -1
- package/dist/{worksheet-BIxMtbUd.js → worksheet-B_kQ1pxq.js} +1 -1
- package/package.json +2 -2
- package/dist/audit-Bwm1xBdJ.js +0 -2
- package/dist/init-DrFfzjvm.js +0 -119
- package/dist/load-n62iXDq_.js +0 -2
package/dist/cli/index.js
CHANGED
|
@@ -1,142 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { c as meetsThreshold, n as IMPACT_LEVELS, o as impactRank, s as isImpactLevel, t as DEFAULT_FAIL_ON } from "../impact-luGCnN8F.js";
|
|
3
3
|
import { c as nullable, d as optional, h as string, l as number, m as safeParse, n as boolean, p as record, t as array, u as object, y as withDefault } from "../schema-DJSF4K05.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { i as ConfigError, o as REDIRECT_MODES, r as COUNTRIES, s as STATEMENT_LOCALES } from "../define-Ctf2uOEh.js";
|
|
5
|
+
import { i as loadConfig } from "../load-CH-ltdlq.js";
|
|
6
|
+
import { c as StatementError, i as readAuditReport, o as checkStatementEvidence, s as refuses, t as renderStatement } from "../render-C6zYfaba.js";
|
|
6
7
|
import { n as count, t as collapse } from "../text-BF1LHMiV.js";
|
|
7
8
|
import { t as TOOL_VERSION } from "../version-B3v4rNoG.js";
|
|
8
9
|
import { t as elementFingerprint } from "../fingerprint-BjYV_0F7.js";
|
|
9
|
-
import {
|
|
10
|
-
import { a as emitDocument, c as
|
|
11
|
-
import { t as DEFAULT_REVIEW_FILE } from "../review-
|
|
12
|
-
import { n as runAuditCommand,
|
|
10
|
+
import { n as DEFAULT_BASELINE_FILE } from "../baseline-DrFh7joZ.js";
|
|
11
|
+
import { a as emitDocument, c as nextStep, d as warn, f as basicAuth, i as baselineInvocation, l as note, n as auditDefaults, o as fail, p as parseHeader, r as auditInvocation, s as failWith, t as advise } from "../command-BGGMf4vn.js";
|
|
12
|
+
import { t as DEFAULT_REVIEW_FILE } from "../review-Bz0fO9_I.js";
|
|
13
|
+
import { n as runAuditCommand, t as OUTPUT_FORMATS } from "../audit-J2jeLo-y.js";
|
|
14
|
+
import { t as runBaselineCommand } from "../baseline-wyJsSIFQ.js";
|
|
13
15
|
import { enableCompileCache } from "node:module";
|
|
14
16
|
import { readFile } from "node:fs/promises";
|
|
15
17
|
import path from "node:path";
|
|
16
18
|
import { Command, InvalidArgumentError } from "commander";
|
|
17
19
|
import pc from "picocolors";
|
|
18
|
-
//#region src/cli/baseline.ts
|
|
19
|
-
/**
|
|
20
|
-
* `eaa-kit baseline [dir]`.
|
|
21
|
-
*
|
|
22
|
-
* Runs the same audit the audit command runs and writes down every violation it
|
|
23
|
-
* found, so that a later run can fail on what is new instead of on everything.
|
|
24
|
-
*
|
|
25
|
-
* Deliberately a subcommand rather than a flag on `audit`. Accepting a set of
|
|
26
|
-
* violations is a decision somebody makes once and commits to a file others
|
|
27
|
-
* will read; folding it into the command that checks them would make it far too
|
|
28
|
-
* easy to type by reflex when a build goes red, which is precisely the moment
|
|
29
|
-
* it should take a deliberate act.
|
|
30
|
-
*/
|
|
31
|
-
async function runBaselineCommand(dir, options = {}) {
|
|
32
|
-
const cwd = options.cwd ?? process.cwd();
|
|
33
|
-
const resolved = await resolvePages(path.resolve(cwd, dir), {
|
|
34
|
-
...options,
|
|
35
|
-
label: dir
|
|
36
|
-
});
|
|
37
|
-
if (!resolved) return {
|
|
38
|
-
entries: 0,
|
|
39
|
-
exitCode: 2
|
|
40
|
-
};
|
|
41
|
-
const { pages, origin, label, directory } = resolved;
|
|
42
|
-
note(`Auditing ${count(pages.length, "page")} in ${label}…`);
|
|
43
|
-
const baseUrl = options.baseUrl ?? origin;
|
|
44
|
-
const audits = await runEngine(pages, {
|
|
45
|
-
cwd,
|
|
46
|
-
...options.headers === void 0 ? {} : { headers: options.headers },
|
|
47
|
-
...baseUrl === void 0 ? {} : { baseUrl },
|
|
48
|
-
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs },
|
|
49
|
-
...options.browser ? { browser: true } : {},
|
|
50
|
-
...options.concurrency === void 0 ? {} : { concurrency: options.concurrency },
|
|
51
|
-
...directory === void 0 ? {} : { directory }
|
|
52
|
-
});
|
|
53
|
-
if (!audits) return {
|
|
54
|
-
entries: 0,
|
|
55
|
-
exitCode: 2
|
|
56
|
-
};
|
|
57
|
-
const unaudited = audits.filter((audit) => audit.error);
|
|
58
|
-
if (unaudited.length > 0) {
|
|
59
|
-
fail(`${unaudited.length} of ${audits.length} pages could not be audited, so no baseline was written`);
|
|
60
|
-
return {
|
|
61
|
-
entries: 0,
|
|
62
|
-
exitCode: 2
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const target = options.output ?? "eaa-baseline.json";
|
|
66
|
-
if (options.prune) return await prune(audits, target, cwd);
|
|
67
|
-
const baseline = buildBaseline(audits, {
|
|
68
|
-
...options.note ? { note: options.note } : {},
|
|
69
|
-
...options.expiresOn ? { expiresOn: options.expiresOn } : {}
|
|
70
|
-
});
|
|
71
|
-
try {
|
|
72
|
-
await writeBaseline(target, baseline, cwd);
|
|
73
|
-
} catch (cause) {
|
|
74
|
-
if (cause instanceof BaselineError) {
|
|
75
|
-
fail(cause.message);
|
|
76
|
-
return {
|
|
77
|
-
entries: 0,
|
|
78
|
-
exitCode: 2
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
throw cause;
|
|
82
|
-
}
|
|
83
|
-
const entries = baseline.entries.length;
|
|
84
|
-
note(`Wrote ${count(entries, "entry")} to ${target}`);
|
|
85
|
-
if (entries > 0) advise("These are barriers, not exceptions. Commit the file, then work the list down.");
|
|
86
|
-
return {
|
|
87
|
-
entries,
|
|
88
|
-
exitCode: 0
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* `--prune`: take out what this run shows is gone, and add nothing.
|
|
93
|
-
*
|
|
94
|
-
* The audit already tells anybody running it that entries no longer match and
|
|
95
|
-
* can be removed. Acting on that advice meant editing JSON by hand, entry by
|
|
96
|
-
* entry, against a file whose whole purpose is that nobody has to remember what
|
|
97
|
-
* is in it — so most people did not, and a baseline accumulated barriers that
|
|
98
|
-
* were fixed years ago while looking exactly like one that had not been read.
|
|
99
|
-
*
|
|
100
|
-
* Recording a new baseline is not the same operation and is not a substitute:
|
|
101
|
-
* it accepts whatever the site fails today, which on a bad day quietly adopts a
|
|
102
|
-
* barrier nobody agreed to.
|
|
103
|
-
*/
|
|
104
|
-
async function prune(audits, target, cwd) {
|
|
105
|
-
let existing;
|
|
106
|
-
try {
|
|
107
|
-
existing = await readBaseline(target, cwd);
|
|
108
|
-
} catch (cause) {
|
|
109
|
-
if (cause instanceof BaselineError) {
|
|
110
|
-
fail(cause.message);
|
|
111
|
-
return {
|
|
112
|
-
entries: 0,
|
|
113
|
-
exitCode: 2
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
throw cause;
|
|
117
|
-
}
|
|
118
|
-
const outcome = applyBaseline(audits, existing);
|
|
119
|
-
const { baseline, removed } = pruneBaseline(existing, outcome.stale);
|
|
120
|
-
if (removed.length === 0) {
|
|
121
|
-
note(`Nothing to remove from ${target}: every entry still matches something on this run`);
|
|
122
|
-
return {
|
|
123
|
-
entries: existing.entries.length,
|
|
124
|
-
removed: 0,
|
|
125
|
-
exitCode: 0
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
await writeBaseline(target, baseline, cwd);
|
|
129
|
-
note(`Removed ${count(removed.length, "entry")} from ${target}; ${count(baseline.entries.length, "entry")} left`);
|
|
130
|
-
for (const entry of removed) note(` ${entry.page} ${entry.ruleId}`);
|
|
131
|
-
if (outcome.expired.length > 0) advise(`${count(outcome.expired.length, "entry")} have expired and suppress nothing; --prune leaves them for you to decide about`);
|
|
132
|
-
return {
|
|
133
|
-
entries: baseline.entries.length,
|
|
134
|
-
removed: removed.length,
|
|
135
|
-
exitCode: 0
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
20
|
var DiffError = class extends Error {
|
|
21
|
+
next;
|
|
139
22
|
name = "DiffError";
|
|
23
|
+
constructor(message, next) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.next = next;
|
|
26
|
+
}
|
|
140
27
|
};
|
|
141
28
|
/**
|
|
142
29
|
* Only the fields a comparison reads. `completeness` is optional: a report
|
|
@@ -275,7 +162,10 @@ async function readReport(file, cwd = process.cwd()) {
|
|
|
275
162
|
try {
|
|
276
163
|
raw = await readFile(target, "utf8");
|
|
277
164
|
} catch {
|
|
278
|
-
throw new DiffError(`Report not found: ${file}
|
|
165
|
+
throw new DiffError(`Report not found: ${file}`, {
|
|
166
|
+
command: `eaa-kit audit --format json --output ${file}`,
|
|
167
|
+
why: "write it from the build as it is now"
|
|
168
|
+
});
|
|
279
169
|
}
|
|
280
170
|
let parsed;
|
|
281
171
|
try {
|
|
@@ -288,7 +178,10 @@ async function readReport(file, cwd = process.cwd()) {
|
|
|
288
178
|
const first = result.error.issues[0];
|
|
289
179
|
throw new DiffError(`${file} is not an eaa-kit JSON report${first === void 0 || first.path.length === 0 ? "" : ` at ${first.path.join(".")}`}: ${first?.message ?? "unrecognised shape"}`);
|
|
290
180
|
}
|
|
291
|
-
if (result.data.schemaVersion !== 2) throw new DiffError(`${file} is schemaVersion ${result.data.schemaVersion}; this version of eaa-kit reads 2.\n Write both reports with the same version of eaa-kit before comparing them
|
|
181
|
+
if (result.data.schemaVersion !== 2) throw new DiffError(`${file} is schemaVersion ${result.data.schemaVersion}; this version of eaa-kit reads 2.\n Write both reports with the same version of eaa-kit before comparing them.`, {
|
|
182
|
+
command: `eaa-kit audit --format json --output ${file}`,
|
|
183
|
+
why: "write it again with this version"
|
|
184
|
+
});
|
|
292
185
|
return result.data;
|
|
293
186
|
}
|
|
294
187
|
//#endregion
|
|
@@ -317,7 +210,7 @@ async function runDiffCommand(base, head, options = {}) {
|
|
|
317
210
|
diff = diffReports(await readReport(base, cwd), await readReport(head, cwd));
|
|
318
211
|
} catch (cause) {
|
|
319
212
|
if (cause instanceof DiffError) {
|
|
320
|
-
|
|
213
|
+
failWith(cause);
|
|
321
214
|
return { exitCode: 2 };
|
|
322
215
|
}
|
|
323
216
|
throw cause;
|
|
@@ -420,7 +313,7 @@ async function runStatementCommand(options = {}) {
|
|
|
420
313
|
if (options.audit) audit = await readAuditReport(options.audit, options.cwd ?? process.cwd());
|
|
421
314
|
let review;
|
|
422
315
|
if (options.review) {
|
|
423
|
-
const { readReview } = await import("../review-
|
|
316
|
+
const { readReview } = await import("../review-a-2ghjQ5.js");
|
|
424
317
|
review = await readReview(options.review, options.cwd ?? process.cwd());
|
|
425
318
|
}
|
|
426
319
|
const problems = checkStatementEvidence({
|
|
@@ -457,10 +350,11 @@ async function runStatementCommand(options = {}) {
|
|
|
457
350
|
exitCode: 0
|
|
458
351
|
};
|
|
459
352
|
} catch (cause) {
|
|
460
|
-
const { ReviewError } = await import("../review-
|
|
353
|
+
const { ReviewError } = await import("../review-a-2ghjQ5.js");
|
|
461
354
|
if (cause instanceof ConfigError || cause instanceof StatementError || cause instanceof ReviewError) {
|
|
462
355
|
fail(cause.message);
|
|
463
356
|
if (cause instanceof ConfigError) for (const issue of cause.issues) note(` ${issue}`);
|
|
357
|
+
if (cause.next !== void 0) nextStep(cause.next);
|
|
464
358
|
return {
|
|
465
359
|
document: "",
|
|
466
360
|
format,
|
|
@@ -563,31 +457,58 @@ function parseBasicAuth(value) {
|
|
|
563
457
|
}
|
|
564
458
|
const program = new Command();
|
|
565
459
|
program.exitOverride();
|
|
566
|
-
program.name("eaa-kit").description("WCAG 2.2 AA auditor and EU accessibility statement generator for static sites.\nNot legal advice.").version(TOOL_VERSION, "-v, --version");
|
|
567
|
-
program.command("audit").description("Audit built HTML against WCAG 2.2 AA").argument("[dir]", "directory holding the built site (default: found automatically)").option("--include <globs...>", "glob patterns to audit, relative to dir").option("--exclude <globs...>", "glob patterns to skip").option("--base-url <url>", "audit pages under their real site URL").option("--url <url>", "audit a running site instead of a build directory").option("--no-build", "never run the project build or start its server").option("--per-page", "also list every page and its result").option("--manual", "what to check by hand for the rules this engine cannot evaluate").option("--coverage", "list every WCAG 2.2 A/AA criterion and what this run reached on it").option("--allow-remote", "allow --url to crawl a host that is not localhost").option("--ignore-robots", "crawl paths robots.txt disallows").option("--sitemap <path>", "where the site lists its pages, if not /sitemap.xml").option("--max-pages <n>", "stop the crawl after this many pages", parsePositive).option("--max-depth <n>", "how far from the entry URL to follow links", parseDepth).option("--header <header>", "send this header with every request, e.g. \"Authorization: Bearer …\". Repeatable", collectHeader).option("--basic-auth <user:password>", "send an Authorization header for basic auth", parseBasicAuth).option("--fail-on <impact>", `exit 1 on violations at or above this impact (${IMPACT_LEVELS.join("|")}; default: ${DEFAULT_FAIL_ON})`, parseImpact).option("--format <format>", `output format (${OUTPUT_FORMATS.join("|")}; default: console)`, parseFormat).option("--output <path>", "write the report to a file instead of stdout").option("--browser", "audit in real Chromium, covering the rules jsdom cannot evaluate").option("--fast", "skip the rules the browserless engine cannot decide anyway, losing their element lists").option("--concurrency <n>", "pages to audit at once, or 1 for none (default: from the page and core count)", parseConcurrency).option("--baseline <path>", "accept the violations recorded in this file; fail only on new ones").option("--no-cache", "audit every page, reusing no result from an earlier run").option("--review <path>", "what a person checked, from eaa-kit checklist").option("--review-max-age <days>", "stop counting review entries older than this", parseDepth).option("--config <path>", "take defaults from this config file, otherwise it is searched for").action(async (dir, flags) => {
|
|
460
|
+
program.name("eaa-kit").description("WCAG 2.2 AA auditor and EU accessibility statement generator for static sites.\nRun it with no command to find your site, audit it and write a report.\nNot legal advice.").version(TOOL_VERSION, "-v, --version");
|
|
461
|
+
program.command("audit").description("Audit built HTML against WCAG 2.2 AA").argument("[dir]", "directory holding the built site (default: found automatically)").option("--include <globs...>", "glob patterns to audit, relative to dir").option("--exclude <globs...>", "glob patterns to skip").option("--base-url <url>", "audit pages under their real site URL").option("--url <url>", "audit a running site instead of a build directory").option("--no-build", "never run the project build or start its server").option("--per-page", "also list every page and its result").option("--manual", "what to check by hand for the rules this engine cannot evaluate").option("--coverage", "list every WCAG 2.2 A/AA criterion and what this run reached on it").option("--allow-remote", "allow --url to crawl a host that is not localhost").option("--ignore-robots", "crawl paths robots.txt disallows").option("--sitemap <path>", "where the site lists its pages, if not /sitemap.xml").option("--redirects <mode>", `when the URL redirects to another site: ${REDIRECT_MODES.join("|")} (default: ask)`, oneOf(REDIRECT_MODES)).option("--max-pages <n>", "stop the crawl after this many pages", parsePositive).option("--max-depth <n>", "how far from the entry URL to follow links", parseDepth).option("--header <header>", "send this header with every request, e.g. \"Authorization: Bearer …\". Repeatable", collectHeader).option("--basic-auth <user:password>", "send an Authorization header for basic auth", parseBasicAuth).option("--fail-on <impact>", `exit 1 on violations at or above this impact (${IMPACT_LEVELS.join("|")}; default: ${DEFAULT_FAIL_ON})`, parseImpact).option("--format <format>", `output format (${OUTPUT_FORMATS.join("|")}; default: console)`, parseFormat).option("--output <path>", "write the report to a file instead of stdout").option("--browser", "audit in real Chromium, covering the rules jsdom cannot evaluate").option("--fast", "skip the rules the browserless engine cannot decide anyway, losing their element lists").option("--concurrency <n>", "pages to audit at once, or 1 for none (default: from the page and core count)", parseConcurrency).option("--baseline <path>", "accept the violations recorded in this file; fail only on new ones").option("--no-cache", "audit every page, reusing no result from an earlier run").option("--review <path>", "what a person checked, from eaa-kit checklist").option("--review-max-age <days>", "stop counting review entries older than this", parseDepth).option("--config <path>", "take defaults from this config file, otherwise it is searched for").option("--watch", "audit again whenever the build directory changes, until Ctrl-C").action(async (dir, { watch, ...flags }) => {
|
|
568
462
|
const defaults = await auditDefaults({ ...flags.config ? { config: flags.config } : {} });
|
|
569
463
|
const invocation = auditInvocation(dir, defaults, flags);
|
|
570
|
-
|
|
571
|
-
|
|
464
|
+
if (!watch) {
|
|
465
|
+
const { exitCode } = await runAuditCommand(invocation.dir, invocation.options);
|
|
466
|
+
process.exitCode = exitCode;
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
if (invocation.options.url !== void 0) {
|
|
470
|
+
fail("--watch watches a build directory, and --url audits a running site.", {
|
|
471
|
+
command: "eaa-kit audit ./dist --watch",
|
|
472
|
+
why: "watch the build instead, with your build directory in place of ./dist"
|
|
473
|
+
});
|
|
474
|
+
process.exitCode = 2;
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const { watchAudit } = await import("../watch-B2RoUbo0.js");
|
|
478
|
+
process.exitCode = await watchAudit({
|
|
479
|
+
run: (directory) => runAuditCommand(directory, invocation.options),
|
|
480
|
+
directory: invocation.dir,
|
|
481
|
+
cwd: process.cwd(),
|
|
482
|
+
ignore: [".eaa-kit", ...invocation.options.output ? [invocation.options.output] : []]
|
|
483
|
+
});
|
|
572
484
|
});
|
|
573
|
-
program.command("baseline").description("Record the violations a build already has, so later runs fail only on new ones").argument("[dir]", "directory holding the built site (default: ./dist)").option("--include <globs...>", "glob patterns to audit, relative to dir").option("--exclude <globs...>", "glob patterns to skip").option("--base-url <url>", "audit pages under their real site URL").option("--url <url>", "record a baseline from a running site instead of a directory").option("--allow-remote", "allow --url to crawl a host that is not localhost").option("--ignore-robots", "crawl paths robots.txt disallows").option("--sitemap <path>", "where the site lists its pages, if not /sitemap.xml").option("--max-pages <n>", "stop the crawl after this many pages", parsePositive).option("--max-depth <n>", "how far from the entry URL to follow links", parseDepth).option("--header <header>", "send this header with every request, e.g. \"Authorization: Bearer …\". Repeatable", collectHeader).option("--basic-auth <user:password>", "send an Authorization header for basic auth", parseBasicAuth).option("--output <path>", `where to write it (default: ${DEFAULT_BASELINE_FILE})`).option("--prune", "remove the entries this run shows are gone, instead of recording a new baseline").option("--note <text>", "recorded on every entry, for whoever reads the file").option("--expires-on <date>", "ISO date after which the entries stop suppressing", parseDate).option("--browser", "audit in real Chromium instead of jsdom").option("--concurrency <n>", "pages to audit at once, or 1 for none", parseConcurrency).option("--config <path>", "take defaults from this config file, otherwise it is searched for").action(async (dir, flags) => {
|
|
485
|
+
program.command("baseline").description("Record the violations a build already has, so later runs fail only on new ones").argument("[dir]", "directory holding the built site (default: ./dist)").option("--include <globs...>", "glob patterns to audit, relative to dir").option("--exclude <globs...>", "glob patterns to skip").option("--base-url <url>", "audit pages under their real site URL").option("--url <url>", "record a baseline from a running site instead of a directory").option("--allow-remote", "allow --url to crawl a host that is not localhost").option("--ignore-robots", "crawl paths robots.txt disallows").option("--sitemap <path>", "where the site lists its pages, if not /sitemap.xml").option("--redirects <mode>", `when the URL redirects to another site: ${REDIRECT_MODES.join("|")} (default: ask)`, oneOf(REDIRECT_MODES)).option("--max-pages <n>", "stop the crawl after this many pages", parsePositive).option("--max-depth <n>", "how far from the entry URL to follow links", parseDepth).option("--header <header>", "send this header with every request, e.g. \"Authorization: Bearer …\". Repeatable", collectHeader).option("--basic-auth <user:password>", "send an Authorization header for basic auth", parseBasicAuth).option("--output <path>", `where to write it (default: ${DEFAULT_BASELINE_FILE})`).option("--prune", "remove the entries this run shows are gone, instead of recording a new baseline").option("--note <text>", "recorded on every entry, for whoever reads the file").option("--expires-on <date>", "ISO date after which the entries stop suppressing", parseDate).option("--browser", "audit in real Chromium instead of jsdom").option("--concurrency <n>", "pages to audit at once, or 1 for none", parseConcurrency).option("--config <path>", "take defaults from this config file, otherwise it is searched for").action(async (dir, flags) => {
|
|
574
486
|
const defaults = await auditDefaults({ ...flags.config ? { config: flags.config } : {} });
|
|
575
487
|
const invocation = baselineInvocation(dir, defaults, flags);
|
|
576
488
|
const { exitCode } = await runBaselineCommand(invocation.dir, invocation.options);
|
|
577
489
|
process.exitCode = exitCode;
|
|
578
490
|
});
|
|
579
491
|
program.command("checklist").description("Write the manual review: the 34 WCAG criteria no automated rule can reach").option("--record <path>", `where the answers live (default: ${DEFAULT_REVIEW_FILE})`).option("--output <path>", "write the worksheet here instead of stdout").option("--reviewed-by <name>", "who is carrying out the review").action(async (flags) => {
|
|
580
|
-
const { runChecklistCommand } = await import("../checklist-
|
|
492
|
+
const { runChecklistCommand } = await import("../checklist-Gx2g3LFC.js");
|
|
581
493
|
const { exitCode } = await runChecklistCommand(flags);
|
|
582
494
|
process.exitCode = exitCode;
|
|
583
495
|
});
|
|
496
|
+
program.command("countries").description("List the countries a statement can be written for, and what each one names").option("--json", "print the list as JSON").action(async (flags) => {
|
|
497
|
+
const { formatCountries } = await import("../countries-DRTBubeE.js");
|
|
498
|
+
process.stdout.write(formatCountries(flags));
|
|
499
|
+
});
|
|
584
500
|
program.command("diff").description("Compare two JSON reports: what a change made worse, and what it fixed").argument("<before>", "JSON report from before the change").argument("<after>", "JSON report from after it").option("--format <format>", `output format (${DIFF_FORMATS.join("|")})`, oneOf(DIFF_FORMATS)).option("--output <path>", "write the diff here instead of stdout").option("--fail-on <impact>", `exit 1 on NEW violations at or above this impact (${IMPACT_LEVELS.join("|")})`, parseImpact, DEFAULT_FAIL_ON).action(async (before, after, flags) => {
|
|
585
501
|
const { exitCode } = await runDiffCommand(before, after, flags);
|
|
586
502
|
process.exitCode = exitCode;
|
|
587
503
|
});
|
|
588
|
-
program.command("init").description("Write an eaa.config.json to generate statements from").option("--output <path>", "write here instead of eaa.config.json").option("--force", "overwrite a config that is already there").option("-y, --yes", "take every default without asking").action(async (flags) => {
|
|
589
|
-
const {
|
|
590
|
-
const {
|
|
504
|
+
program.command("init").description("Write an eaa.config.json to generate statements from").option("--output <path>", "write here instead of eaa.config.json").option("--force", "overwrite a config that is already there").option("-y, --yes", "take every default without asking").option("--no-ci", "never offer the GitHub Actions workflow").option("--no-baseline", "never offer to record a baseline").action(async (flags) => {
|
|
505
|
+
const { ci, baseline, ...rest } = flags;
|
|
506
|
+
const { runInitCommand } = await import("../init-CPbFVMuk.js");
|
|
507
|
+
const { exitCode } = await runInitCommand({
|
|
508
|
+
...rest,
|
|
509
|
+
...ci ? {} : { ci: false },
|
|
510
|
+
...baseline ? {} : { baseline: false }
|
|
511
|
+
});
|
|
591
512
|
process.exitCode = exitCode;
|
|
592
513
|
});
|
|
593
514
|
program.command("statement").description("Generate an EU accessibility statement from eaa.config").option("--config <path>", "path to the config file, otherwise it is searched for").option("--lang <locale>", `statement language (${STATEMENT_LOCALES.join("|")})`, parseLocale).option("--country <code>", `override the country template (${COUNTRIES.join("|")})`, parseCountry).option("--audit <path>", "list the barriers from an eaa-kit audit --format json report").option("--review <path>", "say how many criteria a person checked, and check the conformance claim against them").option("--format <format>", `output format (${STATEMENT_FORMATS.join("|")}), otherwise from the --output extension`, parseStatementFormat).option("--output <path>", "write the statement to a file instead of stdout").action(async (flags) => {
|
|
@@ -599,17 +520,36 @@ program.command("statement").description("Generate an EU accessibility statement
|
|
|
599
520
|
process.exitCode = exitCode;
|
|
600
521
|
});
|
|
601
522
|
try {
|
|
602
|
-
|
|
523
|
+
if (process.argv.length <= 2) {
|
|
524
|
+
const { runFirstRun } = await import("../start-DzOM0p6I.js");
|
|
525
|
+
process.exitCode = (await runFirstRun()).exitCode;
|
|
526
|
+
} else await program.parseAsync(process.argv);
|
|
603
527
|
} catch (cause) {
|
|
604
528
|
if (cause instanceof ConfigError) {
|
|
605
529
|
fail(cause.message);
|
|
606
530
|
for (const issue of cause.issues) note(` ${issue}`);
|
|
531
|
+
if (cause.next !== void 0) nextStep(cause.next);
|
|
607
532
|
process.exitCode = 2;
|
|
608
533
|
process.exit(2);
|
|
609
534
|
}
|
|
610
535
|
const error = cause;
|
|
611
|
-
if (typeof error.exitCode === "number")
|
|
612
|
-
|
|
536
|
+
if (typeof error.exitCode === "number") {
|
|
537
|
+
process.exitCode = error.exitCode === 0 ? 0 : 2;
|
|
538
|
+
if (error.exitCode !== 0 && error.code !== "commander.unknownCommand") {
|
|
539
|
+
const typed = process.argv[2];
|
|
540
|
+
const known = program.commands.find((command) => command.name() === typed);
|
|
541
|
+
nextStep(error.message?.includes("'--country") === true ? {
|
|
542
|
+
command: "eaa-kit countries",
|
|
543
|
+
why: "the countries a statement can be written for"
|
|
544
|
+
} : known === void 0 ? {
|
|
545
|
+
command: "eaa-kit --help",
|
|
546
|
+
why: "the commands, and what each one does"
|
|
547
|
+
} : {
|
|
548
|
+
command: `eaa-kit ${known.name()} --help`,
|
|
549
|
+
why: "every flag it takes"
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
613
553
|
process.stderr.write(`${cause instanceof Error ? cause.stack : String(cause)}\n`);
|
|
614
554
|
process.exitCode = 2;
|
|
615
555
|
}
|
|
@@ -114,7 +114,7 @@ async function readPage(root, relativePath, onUnreadable, maxBytes) {
|
|
|
114
114
|
async function emptyDirectoryHint(dir, cwd = process.cwd()) {
|
|
115
115
|
const head = await exists(dir, cwd) ? `${dir} holds no HTML files.` : `${dir} does not exist.`;
|
|
116
116
|
const { detectFramework } = await import("./frameworks-etFg_O8K.js");
|
|
117
|
-
const { readPackageJson } = await import("./project-
|
|
117
|
+
const { readPackageJson } = await import("./project-BLFdCbOq.js");
|
|
118
118
|
const detected = await detectFramework(cwd, await readPackageJson(cwd));
|
|
119
119
|
if (detected !== void 0) return frameworkAdvice(head, detected, cwd, dir);
|
|
120
120
|
return await siblingAdvice(head, cwd, dir) ?? generic(head);
|
|
@@ -81,6 +81,19 @@ function requestHeaders(options) {
|
|
|
81
81
|
return Object.keys(headers).length === 0 ? void 0 : headers;
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
|
+
//#region src/next.ts
|
|
85
|
+
/** The next step an error carries, if it carries one. */
|
|
86
|
+
function nextStepOf(cause) {
|
|
87
|
+
if (cause === null || typeof cause !== "object") return void 0;
|
|
88
|
+
const next = cause.next;
|
|
89
|
+
if (next === null || typeof next !== "object") return void 0;
|
|
90
|
+
const { command, why } = next;
|
|
91
|
+
return typeof command === "string" && typeof why === "string" ? {
|
|
92
|
+
command,
|
|
93
|
+
why
|
|
94
|
+
} : void 0;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
84
97
|
//#region src/cli/command.ts
|
|
85
98
|
/**
|
|
86
99
|
* What every command does around the audit itself: say what is happening, run
|
|
@@ -98,8 +111,20 @@ function note(message) {
|
|
|
98
111
|
function warn(message) {
|
|
99
112
|
process.stderr.write(`${pc.yellow("warning")} ${message}\n`);
|
|
100
113
|
}
|
|
101
|
-
function fail(message) {
|
|
114
|
+
function fail(message, next) {
|
|
102
115
|
process.stderr.write(`${pc.red("error")} ${message}\n`);
|
|
116
|
+
if (next !== void 0) nextStep(next);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* An error a command stops on: its message, then the command that fixes it
|
|
120
|
+
* when the error carries one.
|
|
121
|
+
*/
|
|
122
|
+
function failWith(cause) {
|
|
123
|
+
fail(cause.message, nextStepOf(cause));
|
|
124
|
+
}
|
|
125
|
+
/** The line under an error that says what to type. */
|
|
126
|
+
function nextStep(next) {
|
|
127
|
+
process.stderr.write(` ${pc.cyan("→")} ${pc.bold(next.command)} ${pc.dim(next.why)}\n`);
|
|
103
128
|
}
|
|
104
129
|
/**
|
|
105
130
|
* Advice the reader should not miss, without the `warning` prefix: nothing has
|
|
@@ -138,7 +163,7 @@ async function runEngine(pages, options) {
|
|
|
138
163
|
});
|
|
139
164
|
} catch (cause) {
|
|
140
165
|
if (cause instanceof BrowserUnavailableError) {
|
|
141
|
-
|
|
166
|
+
failWith(cause);
|
|
142
167
|
return;
|
|
143
168
|
}
|
|
144
169
|
throw cause;
|
|
@@ -176,7 +201,7 @@ async function emitDocument(body, output, cwd) {
|
|
|
176
201
|
* on different settings than it names would be worse than stopping.
|
|
177
202
|
*/
|
|
178
203
|
async function auditDefaults(options = {}) {
|
|
179
|
-
const { loadAuditConfig } = await import("./load-
|
|
204
|
+
const { loadAuditConfig } = await import("./load-D7lBeOsq.js");
|
|
180
205
|
const loaded = await loadAuditConfig({
|
|
181
206
|
...options.cwd ? { cwd: options.cwd } : {},
|
|
182
207
|
...options.config ? { path: options.config } : {}
|
|
@@ -236,6 +261,7 @@ function baselineDefaults(config) {
|
|
|
236
261
|
"allowRemote",
|
|
237
262
|
"ignoreRobots",
|
|
238
263
|
"sitemap",
|
|
264
|
+
"redirects",
|
|
239
265
|
"maxPages",
|
|
240
266
|
"maxDepth",
|
|
241
267
|
"browser",
|
|
@@ -249,4 +275,4 @@ function pick(source, keys) {
|
|
|
249
275
|
return out;
|
|
250
276
|
}
|
|
251
277
|
//#endregion
|
|
252
|
-
export { emitDocument as a,
|
|
278
|
+
export { emitDocument as a, nextStep as c, warn as d, basicAuth as f, baselineInvocation as i, note as l, auditDefaults as n, fail as o, parseHeader as p, auditInvocation as r, failWith as s, advise as t, runEngine as u };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { r as COUNTRIES } from "./define-Ctf2uOEh.js";
|
|
2
|
+
import { t as COUNTRY_INFO } from "./countries-Dg0BdytB.js";
|
|
3
|
+
import pc from "picocolors";
|
|
4
|
+
//#region src/cli/countries.ts
|
|
5
|
+
function formatCountries(options = {}) {
|
|
6
|
+
if (options.json) {
|
|
7
|
+
const entries = COUNTRIES.map((code) => ({
|
|
8
|
+
code,
|
|
9
|
+
...COUNTRY_INFO[code]
|
|
10
|
+
}));
|
|
11
|
+
return `${JSON.stringify(entries, null, 2)}\n`;
|
|
12
|
+
}
|
|
13
|
+
const colors = pc.createColors(options.color ?? pc.isColorSupported);
|
|
14
|
+
const lines = [];
|
|
15
|
+
for (const code of COUNTRIES) {
|
|
16
|
+
const info = COUNTRY_INFO[code];
|
|
17
|
+
lines.push(`${colors.bold(code)} ${info.name} ${colors.dim(`(${info.languages.join(", ")})`)}`, ` Statute: ${info.statute}`, ` Authority: ${info.authority}`);
|
|
18
|
+
if (info.unverified) lines.push(colors.yellow(" New in 0.8: citations not yet checked against the primary text"));
|
|
19
|
+
lines.push("");
|
|
20
|
+
}
|
|
21
|
+
lines.push("eaa-kit statement --country <code> --lang <language>");
|
|
22
|
+
return `${lines.join("\n")}\n`;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { formatCountries };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
//#region src/config/countries.ts
|
|
2
|
+
const COUNTRY_INFO = {
|
|
3
|
+
AT: {
|
|
4
|
+
name: "Austria",
|
|
5
|
+
languages: ["de", "en"],
|
|
6
|
+
siteLocale: "de-AT",
|
|
7
|
+
statute: "Barrierefreiheitsgesetz (BaFG)",
|
|
8
|
+
authority: "Sozialministeriumservice"
|
|
9
|
+
},
|
|
10
|
+
BE: {
|
|
11
|
+
name: "Belgium",
|
|
12
|
+
languages: [
|
|
13
|
+
"fr",
|
|
14
|
+
"nl",
|
|
15
|
+
"de",
|
|
16
|
+
"en"
|
|
17
|
+
],
|
|
18
|
+
siteLocale: "fr-BE",
|
|
19
|
+
statute: "Loi du 5 novembre 2023 / wet van 5 november 2023 (Code de droit économique)",
|
|
20
|
+
authority: "SPF Économie / FOD Economie, Economic Inspection",
|
|
21
|
+
unverified: true
|
|
22
|
+
},
|
|
23
|
+
CH: {
|
|
24
|
+
name: "Switzerland",
|
|
25
|
+
languages: ["de", "en"],
|
|
26
|
+
siteLocale: "de-CH",
|
|
27
|
+
statute: "Behindertengleichstellungsgesetz (BehiG), not an EAA transposition",
|
|
28
|
+
authority: "the courts; there is no supervisory body"
|
|
29
|
+
},
|
|
30
|
+
CZ: {
|
|
31
|
+
name: "Czechia",
|
|
32
|
+
languages: ["cs", "en"],
|
|
33
|
+
siteLocale: "cs-CZ",
|
|
34
|
+
statute: "Zákon č. 424/2023 Sb., o požadavcích na přístupnost některých výrobků a služeb",
|
|
35
|
+
authority: "Česká obchodní inspekce (ČOI)",
|
|
36
|
+
unverified: true
|
|
37
|
+
},
|
|
38
|
+
DE: {
|
|
39
|
+
name: "Germany",
|
|
40
|
+
languages: ["de", "en"],
|
|
41
|
+
siteLocale: "de-DE",
|
|
42
|
+
statute: "Barrierefreiheitsstärkungsgesetz (BFSG)",
|
|
43
|
+
authority: "Marktüberwachungsstelle der Länder (MLBF)"
|
|
44
|
+
},
|
|
45
|
+
DK: {
|
|
46
|
+
name: "Denmark",
|
|
47
|
+
languages: ["da", "en"],
|
|
48
|
+
siteLocale: "da-DK",
|
|
49
|
+
statute: "Lov nr. 801 af 7. juni 2022 om tilgængelighedskrav for produkter og tjenester",
|
|
50
|
+
authority: "Sikkerhedsstyrelsen for e-commerce; supervision is split",
|
|
51
|
+
unverified: true
|
|
52
|
+
},
|
|
53
|
+
ES: {
|
|
54
|
+
name: "Spain",
|
|
55
|
+
languages: ["es", "en"],
|
|
56
|
+
siteLocale: "es-ES",
|
|
57
|
+
statute: "Ley 11/2023, de 8 de mayo",
|
|
58
|
+
authority: "the competent market surveillance authority, usually the autonomous community's consumer body"
|
|
59
|
+
},
|
|
60
|
+
FI: {
|
|
61
|
+
name: "Finland",
|
|
62
|
+
languages: ["fi", "en"],
|
|
63
|
+
siteLocale: "fi-FI",
|
|
64
|
+
statute: "Laki digitaalisten palvelujen tarjoamisesta (306/2019), as amended",
|
|
65
|
+
authority: "Liikenne- ja viestintävirasto Traficom",
|
|
66
|
+
unverified: true
|
|
67
|
+
},
|
|
68
|
+
FR: {
|
|
69
|
+
name: "France",
|
|
70
|
+
languages: ["fr", "en"],
|
|
71
|
+
siteLocale: "fr-FR",
|
|
72
|
+
statute: "Ordonnance n° 2023-859, and art. 47 of loi n° 2005-102",
|
|
73
|
+
authority: "Défenseur des droits, and Arcom"
|
|
74
|
+
},
|
|
75
|
+
IE: {
|
|
76
|
+
name: "Ireland",
|
|
77
|
+
languages: ["en"],
|
|
78
|
+
siteLocale: "en-IE",
|
|
79
|
+
statute: "S.I. No. 636 of 2023",
|
|
80
|
+
authority: "Competition and Consumer Protection Commission (CCPC)",
|
|
81
|
+
unverified: true
|
|
82
|
+
},
|
|
83
|
+
IT: {
|
|
84
|
+
name: "Italy",
|
|
85
|
+
languages: ["it", "en"],
|
|
86
|
+
siteLocale: "it-IT",
|
|
87
|
+
statute: "D.lgs. 27 maggio 2022, n. 82 (legge Stanca)",
|
|
88
|
+
authority: "AgID"
|
|
89
|
+
},
|
|
90
|
+
NL: {
|
|
91
|
+
name: "Netherlands",
|
|
92
|
+
languages: ["nl", "en"],
|
|
93
|
+
siteLocale: "nl-NL",
|
|
94
|
+
statute: "Implementatiewet toegankelijkheidsvoorschriften producten en diensten",
|
|
95
|
+
authority: "ACM for services, RDI for products"
|
|
96
|
+
},
|
|
97
|
+
PL: {
|
|
98
|
+
name: "Poland",
|
|
99
|
+
languages: ["pl", "en"],
|
|
100
|
+
siteLocale: "pl-PL",
|
|
101
|
+
statute: "Ustawa z dnia 26 kwietnia 2024 r. (Dz.U. 2024 poz. 731)",
|
|
102
|
+
authority: "Prezes Zarządu PFRON",
|
|
103
|
+
unverified: true
|
|
104
|
+
},
|
|
105
|
+
PT: {
|
|
106
|
+
name: "Portugal",
|
|
107
|
+
languages: ["pt", "en"],
|
|
108
|
+
siteLocale: "pt-PT",
|
|
109
|
+
statute: "Decreto-Lei n.º 82/2022, de 6 de dezembro",
|
|
110
|
+
authority: "ANACOM for e-commerce services",
|
|
111
|
+
unverified: true
|
|
112
|
+
},
|
|
113
|
+
SE: {
|
|
114
|
+
name: "Sweden",
|
|
115
|
+
languages: ["sv", "en"],
|
|
116
|
+
siteLocale: "sv-SE",
|
|
117
|
+
statute: "Lag (2023:254) om vissa produkters och tjänsters tillgänglighet",
|
|
118
|
+
authority: "Post- och telestyrelsen (PTS)",
|
|
119
|
+
unverified: true
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* A country from what somebody typed: the code in any case, or the English name.
|
|
124
|
+
*
|
|
125
|
+
* Undefined rather than a default. A statement is a legal document under one
|
|
126
|
+
* country's law, and quietly substituting another country for a typo is how
|
|
127
|
+
* somebody ends up publishing an Austrian statement for a Polish shop.
|
|
128
|
+
*/
|
|
129
|
+
function findCountry(value) {
|
|
130
|
+
const wanted = value.trim().toLowerCase();
|
|
131
|
+
if (wanted === "") return void 0;
|
|
132
|
+
for (const [code, info] of Object.entries(COUNTRY_INFO)) if (code.toLowerCase() === wanted || info.name.toLowerCase() === wanted) return code;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The country a site's language tag points at, when it points at one.
|
|
136
|
+
*
|
|
137
|
+
* The region decides where there is one: `de-AT` is Austria, `fr-BE` is
|
|
138
|
+
* Belgium, and a region with no country listed here gives nothing. A bare language counts only where that language's own country is
|
|
139
|
+
* listed, so `pl` is Poland and `fr` is France. English has no such country, so
|
|
140
|
+
* `en` gives nothing. This is a default for `init` to offer, not an answer.
|
|
141
|
+
* Which country's law applies depends on where the business sells, and a site's
|
|
142
|
+
* language only suggests that.
|
|
143
|
+
*/
|
|
144
|
+
function countryForLocale(tag) {
|
|
145
|
+
const [language, region] = tag.toLowerCase().split("-");
|
|
146
|
+
if (language === void 0) return void 0;
|
|
147
|
+
const codes = Object.keys(COUNTRY_INFO);
|
|
148
|
+
if (region !== void 0) return codes.find((code) => code.toLowerCase() === region);
|
|
149
|
+
const own = codes.find((code) => COUNTRY_INFO[code].siteLocale.toLowerCase() === `${language}-${language}`);
|
|
150
|
+
if (own !== void 0) return own;
|
|
151
|
+
if (language === "en") return void 0;
|
|
152
|
+
const speakers = codes.filter((code) => COUNTRY_INFO[code].siteLocale.startsWith(`${language}-`));
|
|
153
|
+
return speakers.length === 1 ? speakers[0] : void 0;
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { countryForLocale as n, findCountry as r, COUNTRY_INFO as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as WCAG22_AA_CRITERIA } from "./criteria-CnPJKGeb.js";
|
|
2
2
|
import { n as DEFAULT_TAGS, p as successCriteria, r as ENGINE_BLIND_RULES } from "./result-B7_zVxAX.js";
|
|
3
|
-
import { s as criterionReview } from "./review-
|
|
3
|
+
import { s as criterionReview } from "./review-Bz0fO9_I.js";
|
|
4
4
|
import axe from "axe-core";
|
|
5
5
|
//#region src/audit/manual.ts
|
|
6
6
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { a as stripBom } from "./collect-
|
|
1
|
+
import { a as stripBom } from "./collect-BJYk7_pJ.js";
|
|
2
|
+
/** Per-request timeout. */
|
|
3
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 15e3;
|
|
2
4
|
/** Requests in flight at once. Politeness, not throughput. */
|
|
3
5
|
const REQUEST_CONCURRENCY = 4;
|
|
4
6
|
/**
|
|
@@ -244,7 +246,7 @@ async function crawlSite(entry, options = {}) {
|
|
|
244
246
|
const maxPages = options.maxPages ?? 200;
|
|
245
247
|
const maxDepth = options.maxDepth ?? 3;
|
|
246
248
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
247
|
-
const maxBodyBytes = options.maxBodyBytes ??
|
|
249
|
+
const maxBodyBytes = options.maxBodyBytes ?? 33554432;
|
|
248
250
|
const failures = [];
|
|
249
251
|
const robots = options.ignoreRobots ? void 0 : await fetchSiteFile(entry, impl, "/robots.txt", timeoutMs, maxBodyBytes, options.headers);
|
|
250
252
|
const blocked = robots === void 0 ? [] : disallowedPaths(robots);
|
|
@@ -349,4 +351,4 @@ function byIdentity(pages) {
|
|
|
349
351
|
}).sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
350
352
|
}
|
|
351
353
|
//#endregion
|
|
352
|
-
export { CrawlError, collapsedOnto, crawlSite, parseEntryUrl };
|
|
354
|
+
export { CrawlError, DEFAULT_REQUEST_TIMEOUT_MS, MAX_BODY_BYTES, collapsedOnto, crawlSite, parseEntryUrl };
|