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.
- package/README.md +182 -135
- package/dist/astro/index.d.ts +1 -3
- package/dist/astro/index.js +2 -3
- package/dist/audit/runners/worker.js +2 -3
- package/dist/{audit-DRjAY2iY.js → audit-DbqNIrt6.js} +85 -219
- package/dist/audit-rUhqnm3o.js +1 -0
- package/dist/{baseline-BpE7DbDq.js → baseline-CKElWbx4.js} +18 -8
- package/dist/baseline-DU0EPiTq.js +1 -0
- package/dist/baseline-DYOejLFO.js +1 -0
- package/dist/baseline-DvdsFTQy.js +126 -0
- package/dist/{cache-D4dOIuOi.js → cache-DIV4G0TI.js} +24 -5
- package/dist/{checklist-DDd9jewi.js → checklist-CA0Ri71Z.js} +8 -9
- package/dist/cli/index.js +115 -158
- package/dist/{collect-Cu1q9NTB.js → collect-CjucwTEF.js} +16 -8
- package/dist/{command-3r4fht5f.js → command-C8ZFvcc1.js} +33 -10
- package/dist/completeness-Cg-XIKWN.js +1 -0
- package/dist/completeness-Dzyvgr4Z.js +72 -0
- package/dist/component-CgbeRgJa.js +1 -0
- package/dist/{component-ChisoFyY.js → component-ZLd8DA_a.js} +3 -4
- package/dist/countries-B_PE6r5R.js +180 -0
- package/dist/countries-CCqog6dy.js +28 -0
- package/dist/coverage-B9_6yv_8.js +2 -0
- package/dist/{coverage-cb5kPp48.js → coverage-C1Z6t9Ct.js} +5 -7
- package/dist/{crawl-BHkJmUkA.js → crawl-CkHJJV4w.js} +135 -25
- package/dist/{criteria-CnPJKGeb.js → criteria-CacF0HP1.js} +1 -2
- package/dist/{load-BaWMa-G_.js → define-BdTPIfqE.js} +46 -99
- package/dist/detect-DnFHXpWh.js +49 -0
- package/dist/detect-oLDadgee.js +160 -0
- package/dist/doctor-q8IebwAb.js +248 -0
- package/dist/eleventy/index.d.ts +1 -3
- package/dist/eleventy/index.js +2 -3
- package/dist/entry-kf94P140.js +173 -0
- package/dist/{fingerprint-BjYV_0F7.js → fingerprint-CcoQ1WxQ.js} +1 -2
- package/dist/{frameworks-B4ClIJgE.js → frameworks-BboC8eNk.js} +234 -28
- package/dist/frameworks-Y-n3NUuG.js +1 -0
- package/dist/{fs-BmPtmFke.js → fs-tPD5r0wY.js} +1 -2
- package/dist/hosts-B48qR6Vt.js +19 -0
- package/dist/{html-BIxxF3FC.js → html-Bjq3Iw3g.js} +56 -14
- package/dist/{impact-luGCnN8F.js → impact-BGlJ6j0Y.js} +1 -2
- package/dist/{impact-EEB9ZXmC.d.ts → impact-CZjUloYC.d.ts} +0 -2
- package/dist/index.d.ts +50 -26
- package/dist/index.js +3 -2
- package/dist/init-3Ti3ao5Z.js +232 -0
- package/dist/issues-WLlepU95.js +120 -0
- package/dist/{jsdom-CsW_xVcA.js → jsdom-C4pLIMyP.js} +2 -3
- package/dist/jsdom-Zle--VQ1.js +2 -0
- package/dist/{json-Bus6YhxB.js → json-B_k4CDmR.js} +5 -6
- package/dist/json-IL1JxlTL.js +1 -0
- package/dist/load-C3eFEdoH.js +98 -0
- package/dist/load-oQQJPNlV.js +1 -0
- package/dist/markdown-D-QpPYsz.js +138 -0
- package/dist/next-8zDgH0nP.js +119 -0
- package/dist/nuxt/index.d.ts +1 -3
- package/dist/nuxt/index.js +2 -3
- package/dist/pages-CCP1WfYe.js +363 -0
- package/dist/{playwright-ukCr_5o3.js → playwright-ky4b_HME.js} +98 -16
- package/dist/{pool-B4tEUa2S.js → pool-B3XKdk57.js} +4 -5
- package/dist/project-B21NT_aX.js +502 -0
- package/dist/project-Dht13sb1.js +1 -0
- package/dist/{remediation-C0klJblu.js → remediation-BkE7q7dT.js} +2 -176
- package/dist/{render-C1sUZZI_.js → render-ky8cm4QF.js} +50 -24
- package/dist/result-DhoT4g0P.js +1 -0
- package/dist/{result-B7_zVxAX.js → result-g8dGsrcv.js} +1 -2
- package/dist/{review-CdMK2GpQ.js → review-BGjTBFvd.js} +11 -4
- package/dist/review-iheEjp7_.js +1 -0
- package/dist/{routes-CmdRUuOs.js → routes-BpQeBDmM.js} +4 -5
- package/dist/{run-DrS0Komf.js → run-D7tc7IU2.js} +2 -3
- package/dist/{run-BK2blxMI.d.ts → run-VXnP4uLp.d.ts} +2 -6
- package/dist/{sarif-BNCE0PNT.js → sarif-v66-PjdE.js} +9 -9
- package/dist/{schema-DJSF4K05.js → schema-DfC-Ww1w.js} +1 -2
- package/dist/setup-BYlqHlo0.js +2 -0
- package/dist/setup-Cf82ONw0.js +353 -0
- package/dist/shell-BdQYTaBQ.js +89 -0
- package/dist/site-CxVyh8IO.js +71 -0
- package/dist/start-bdanSxZr.js +100 -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 +138 -0
- package/dist/statement/templates/cz.en.md +140 -0
- package/dist/statement/templates/dk.da.md +142 -0
- package/dist/statement/templates/dk.en.md +142 -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 +143 -0
- package/dist/statement/templates/pt.pt.md +145 -0
- package/dist/statement/templates/se.en.md +148 -0
- package/dist/statement/templates/se.sv.md +150 -0
- package/dist/{text-BF1LHMiV.js → text-CISDPU49.js} +11 -3
- package/dist/{version-B3v4rNoG.js → version-C8aJm8YJ.js} +1 -2
- package/dist/vite/index.d.ts +1 -3
- package/dist/vite/index.js +2 -3
- package/dist/watch-CefxwMsZ.js +121 -0
- package/dist/webpack/index.d.ts +1 -3
- package/dist/webpack/index.js +2 -3
- package/dist/{worksheet-BIxMtbUd.js → worksheet-CcBo9G7s.js} +4 -5
- package/dist/workspaces-BBFXOyeV.js +85 -0
- package/package.json +16 -14
- package/dist/audit-Bwm1xBdJ.js +0 -2
- package/dist/baseline-rtnj3RHB.js +0 -2
- package/dist/component-DcCn3BJS.js +0 -2
- package/dist/coverage-n1X9CkiG.js +0 -3
- package/dist/frameworks-etFg_O8K.js +0 -2
- package/dist/init-DrFfzjvm.js +0 -119
- package/dist/jsdom-BUYuVJJm.js +0 -3
- package/dist/json-CrQmoTj6.js +0 -2
- package/dist/load-n62iXDq_.js +0 -2
- package/dist/project-CzOnkLH6.js +0 -274
- package/dist/project-MFrXcw1M.js +0 -2
- package/dist/result-CRmjjoAA.js +0 -2
- package/dist/review-DIbOTmOM.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import pc from "picocolors";
|
|
4
|
-
|
|
4
|
+
// src/audit/headers.ts
|
|
5
5
|
/**
|
|
6
6
|
* Request headers for the pages this tool fetches.
|
|
7
7
|
*
|
|
@@ -80,8 +80,19 @@ function requestHeaders(options) {
|
|
|
80
80
|
Object.assign(headers, parseHeaders(options.header ?? []));
|
|
81
81
|
return Object.keys(headers).length === 0 ? void 0 : headers;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
// src/next.ts
|
|
84
|
+
/** The next step an error carries, if it carries one. */
|
|
85
|
+
function nextStepOf(cause) {
|
|
86
|
+
if (cause === null || typeof cause !== "object") return void 0;
|
|
87
|
+
const next = cause.next;
|
|
88
|
+
if (next === null || typeof next !== "object") return void 0;
|
|
89
|
+
const { command, why } = next;
|
|
90
|
+
return typeof command === "string" && typeof why === "string" ? {
|
|
91
|
+
command,
|
|
92
|
+
why
|
|
93
|
+
} : void 0;
|
|
94
|
+
}
|
|
95
|
+
// src/cli/command.ts
|
|
85
96
|
/**
|
|
86
97
|
* What every command does around the audit itself: say what is happening, run
|
|
87
98
|
* the engine, and put the document somewhere.
|
|
@@ -98,8 +109,20 @@ function note(message) {
|
|
|
98
109
|
function warn(message) {
|
|
99
110
|
process.stderr.write(`${pc.yellow("warning")} ${message}\n`);
|
|
100
111
|
}
|
|
101
|
-
function fail(message) {
|
|
112
|
+
function fail(message, next) {
|
|
102
113
|
process.stderr.write(`${pc.red("error")} ${message}\n`);
|
|
114
|
+
if (next !== void 0) nextStep(next);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* An error a command stops on: its message, then the command that fixes it
|
|
118
|
+
* when the error carries one.
|
|
119
|
+
*/
|
|
120
|
+
function failWith(cause) {
|
|
121
|
+
fail(cause.message, nextStepOf(cause));
|
|
122
|
+
}
|
|
123
|
+
/** The line under an error that says what to type. */
|
|
124
|
+
function nextStep(next) {
|
|
125
|
+
process.stderr.write(` ${pc.cyan("→")} ${pc.bold(next.command)} ${pc.dim(next.why)}\n`);
|
|
103
126
|
}
|
|
104
127
|
/**
|
|
105
128
|
* Advice the reader should not miss, without the `warning` prefix: nothing has
|
|
@@ -122,14 +145,14 @@ async function runEngine(pages, options) {
|
|
|
122
145
|
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
|
|
123
146
|
};
|
|
124
147
|
if (!options.browser) {
|
|
125
|
-
const { runPooledAudit } = await import("./pool-
|
|
148
|
+
const { runPooledAudit } = await import("./pool-B3XKdk57.js");
|
|
126
149
|
return runPooledAudit(pages, {
|
|
127
150
|
...runnerOptions,
|
|
128
151
|
...options.fast ? { fast: true } : {},
|
|
129
152
|
...options.concurrency === void 0 ? {} : { concurrency: options.concurrency }
|
|
130
153
|
});
|
|
131
154
|
}
|
|
132
|
-
const { BrowserUnavailableError, runBrowserAudit } = await import("./playwright-
|
|
155
|
+
const { BrowserUnavailableError, runBrowserAudit } = await import("./playwright-ky4b_HME.js");
|
|
133
156
|
try {
|
|
134
157
|
return await runBrowserAudit(options.directory, pages, {
|
|
135
158
|
...runnerOptions,
|
|
@@ -138,7 +161,7 @@ async function runEngine(pages, options) {
|
|
|
138
161
|
});
|
|
139
162
|
} catch (cause) {
|
|
140
163
|
if (cause instanceof BrowserUnavailableError) {
|
|
141
|
-
|
|
164
|
+
failWith(cause);
|
|
142
165
|
return;
|
|
143
166
|
}
|
|
144
167
|
throw cause;
|
|
@@ -176,7 +199,7 @@ async function emitDocument(body, output, cwd) {
|
|
|
176
199
|
* on different settings than it names would be worse than stopping.
|
|
177
200
|
*/
|
|
178
201
|
async function auditDefaults(options = {}) {
|
|
179
|
-
const { loadAuditConfig } = await import("./load-
|
|
202
|
+
const { loadAuditConfig } = await import("./load-oQQJPNlV.js");
|
|
180
203
|
const loaded = await loadAuditConfig({
|
|
181
204
|
...options.cwd ? { cwd: options.cwd } : {},
|
|
182
205
|
...options.config ? { path: options.config } : {}
|
|
@@ -236,6 +259,7 @@ function baselineDefaults(config) {
|
|
|
236
259
|
"allowRemote",
|
|
237
260
|
"ignoreRobots",
|
|
238
261
|
"sitemap",
|
|
262
|
+
"redirects",
|
|
239
263
|
"maxPages",
|
|
240
264
|
"maxDepth",
|
|
241
265
|
"browser",
|
|
@@ -248,5 +272,4 @@ function pick(source, keys) {
|
|
|
248
272
|
for (const key of keys) if (source[key] !== void 0) out[key] = source[key];
|
|
249
273
|
return out;
|
|
250
274
|
}
|
|
251
|
-
|
|
252
|
-
export { emitDocument as a, runEngine as c, parseHeader as d, baselineInvocation as i, warn as l, auditDefaults as n, fail as o, auditInvocation as r, note as s, advise as t, basicAuth as u };
|
|
275
|
+
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 @@
|
|
|
1
|
+
export { t as discoveryLabel } from "./completeness-Dzyvgr4Z.js";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// src/audit/completeness.ts
|
|
2
|
+
/**
|
|
3
|
+
* Fold what the collector knew together with what the engine managed.
|
|
4
|
+
*
|
|
5
|
+
* The audits carry the second half: a page with an `error` was collected and
|
|
6
|
+
* then not audited, and is as unmeasured as one that was never fetched.
|
|
7
|
+
*/
|
|
8
|
+
function runCompleteness(audits, collection) {
|
|
9
|
+
const errored = audits.filter((audit) => audit.error).length;
|
|
10
|
+
const reused = audits.filter((audit) => audit.reused !== void 0).length;
|
|
11
|
+
return {
|
|
12
|
+
...collection,
|
|
13
|
+
audited: audits.length - errored - reused,
|
|
14
|
+
reused,
|
|
15
|
+
errored,
|
|
16
|
+
complete: collection.unreachable.length === 0 && !collection.truncated && errored === 0
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What a run reused, in one phrase, or nothing when it audited everything.
|
|
21
|
+
*
|
|
22
|
+
* Its own sentence rather than a clause in `missedParts`: nothing was missed
|
|
23
|
+
* here. The pages have verdicts; they were reached on an earlier day, on markup
|
|
24
|
+
* identical to today's, and a reader is entitled to know which.
|
|
25
|
+
*/
|
|
26
|
+
function reusedPart(completeness) {
|
|
27
|
+
if (completeness.reused === 0) return void 0;
|
|
28
|
+
const pages = completeness.reused === 1 ? "page" : "pages";
|
|
29
|
+
return `${completeness.reused} ${pages} unchanged since the last run, so the earlier result was reused`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Where a followed entry redirect took the run, in one sentence every format
|
|
33
|
+
* prints. Undefined when the run went where it was sent.
|
|
34
|
+
*/
|
|
35
|
+
function redirectPart(completeness) {
|
|
36
|
+
const redirect = completeness.entryRedirect;
|
|
37
|
+
if (redirect === void 0) return void 0;
|
|
38
|
+
return `${redirect.requested} redirected to ${redirect.auditedFrom} (${redirect.statuses.join(" → ")}; ${redirectReason(redirect)}), so this report is about ${redirect.auditedFrom}`;
|
|
39
|
+
}
|
|
40
|
+
/** Why a redirect was followed, in words. */
|
|
41
|
+
function redirectReason(redirect) {
|
|
42
|
+
return {
|
|
43
|
+
"same-site": "the same site at another address",
|
|
44
|
+
flag: "followed because --redirects follow was set",
|
|
45
|
+
prompt: "followed because it was approved when asked"
|
|
46
|
+
}[redirect.followedBecause];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* What was missed, as phrases both reports print.
|
|
50
|
+
*
|
|
51
|
+
* Separate clauses rather than one total, for the same reason the coverage
|
|
52
|
+
* parts are: a page that could not be fetched and a page that could not be
|
|
53
|
+
* parsed are different problems with different fixes, and summing them would
|
|
54
|
+
* name neither.
|
|
55
|
+
*/
|
|
56
|
+
function missedParts(completeness) {
|
|
57
|
+
const parts = [];
|
|
58
|
+
if (completeness.unreachable.length > 0) parts.push(`${completeness.unreachable.length} could not be reached`);
|
|
59
|
+
if (completeness.errored > 0) parts.push(`${completeness.errored} could not be audited`);
|
|
60
|
+
if (completeness.truncated) parts.push("the run stopped at its page limit");
|
|
61
|
+
return parts;
|
|
62
|
+
}
|
|
63
|
+
/** How the pages were found, in words, for the run details both reports show. */
|
|
64
|
+
function discoveryLabel(discovery) {
|
|
65
|
+
switch (discovery) {
|
|
66
|
+
case "directory": return "files in the build directory";
|
|
67
|
+
case "manifest": return "the build's own page list and links";
|
|
68
|
+
case "sitemap": return "sitemap.xml and links";
|
|
69
|
+
case "links": return "links from the entry page";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export { reusedPart as a, redirectReason as i, missedParts as n, runCompleteness as o, redirectPart as r, discoveryLabel as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as buildComponentIndex, n as componentFor } from "./component-ZLd8DA_a.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as toPosix } from "./fs-
|
|
2
|
-
import { t as collapse } from "./text-
|
|
1
|
+
import { i as toPosix } from "./fs-tPD5r0wY.js";
|
|
2
|
+
import { t as collapse } from "./text-CISDPU49.js";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { glob } from "tinyglobby";
|
|
6
|
-
|
|
6
|
+
// src/audit/component.ts
|
|
7
7
|
/**
|
|
8
8
|
* Which source file a failing element was written in.
|
|
9
9
|
*
|
|
@@ -142,5 +142,4 @@ function positionOf(source, offset) {
|
|
|
142
142
|
function componentPath(location) {
|
|
143
143
|
return `${location.file}:${location.line}`;
|
|
144
144
|
}
|
|
145
|
-
//#endregion
|
|
146
145
|
export { searchTermsFor as i, componentFor as n, componentPath as r, buildComponentIndex as t };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// 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
|
+
},
|
|
22
|
+
CH: {
|
|
23
|
+
name: "Switzerland",
|
|
24
|
+
languages: ["de", "en"],
|
|
25
|
+
siteLocale: "de-CH",
|
|
26
|
+
statute: "Behindertengleichstellungsgesetz (BehiG), not an EAA transposition",
|
|
27
|
+
authority: "the courts; there is no supervisory body"
|
|
28
|
+
},
|
|
29
|
+
CZ: {
|
|
30
|
+
name: "Czechia",
|
|
31
|
+
languages: ["cs", "en"],
|
|
32
|
+
siteLocale: "cs-CZ",
|
|
33
|
+
statute: "Zákon č. 424/2023 Sb., o požadavcích na přístupnost některých výrobků a služeb",
|
|
34
|
+
authority: "Česká obchodní inspekce (ČOI)"
|
|
35
|
+
},
|
|
36
|
+
DE: {
|
|
37
|
+
name: "Germany",
|
|
38
|
+
languages: ["de", "en"],
|
|
39
|
+
siteLocale: "de-DE",
|
|
40
|
+
statute: "Barrierefreiheitsstärkungsgesetz (BFSG)",
|
|
41
|
+
authority: "Marktüberwachungsstelle der Länder (MLBF)"
|
|
42
|
+
},
|
|
43
|
+
DK: {
|
|
44
|
+
name: "Denmark",
|
|
45
|
+
languages: ["da", "en"],
|
|
46
|
+
siteLocale: "da-DK",
|
|
47
|
+
statute: "Lov nr. 801 af 7. juni 2022 om tilgængelighedskrav for produkter og tjenester",
|
|
48
|
+
authority: "Sikkerhedsstyrelsen for e-commerce; supervision is split"
|
|
49
|
+
},
|
|
50
|
+
ES: {
|
|
51
|
+
name: "Spain",
|
|
52
|
+
languages: ["es", "en"],
|
|
53
|
+
siteLocale: "es-ES",
|
|
54
|
+
statute: "Ley 11/2023, de 8 de mayo",
|
|
55
|
+
authority: "the competent market surveillance authority, usually the autonomous community's consumer body"
|
|
56
|
+
},
|
|
57
|
+
FI: {
|
|
58
|
+
name: "Finland",
|
|
59
|
+
languages: ["fi", "en"],
|
|
60
|
+
siteLocale: "fi-FI",
|
|
61
|
+
statute: "Laki digitaalisten palvelujen tarjoamisesta (306/2019), as amended",
|
|
62
|
+
authority: "Liikenne- ja viestintävirasto Traficom"
|
|
63
|
+
},
|
|
64
|
+
FR: {
|
|
65
|
+
name: "France",
|
|
66
|
+
languages: ["fr", "en"],
|
|
67
|
+
siteLocale: "fr-FR",
|
|
68
|
+
statute: "Ordonnance n° 2023-859, and art. 47 of loi n° 2005-102",
|
|
69
|
+
authority: "Défenseur des droits, and Arcom"
|
|
70
|
+
},
|
|
71
|
+
IE: {
|
|
72
|
+
name: "Ireland",
|
|
73
|
+
languages: ["en"],
|
|
74
|
+
siteLocale: "en-IE",
|
|
75
|
+
statute: "S.I. No. 636 of 2023",
|
|
76
|
+
authority: "Competition and Consumer Protection Commission (CCPC)"
|
|
77
|
+
},
|
|
78
|
+
IT: {
|
|
79
|
+
name: "Italy",
|
|
80
|
+
languages: ["it", "en"],
|
|
81
|
+
siteLocale: "it-IT",
|
|
82
|
+
statute: "D.lgs. 27 maggio 2022, n. 82 (legge Stanca)",
|
|
83
|
+
authority: "AgID"
|
|
84
|
+
},
|
|
85
|
+
NL: {
|
|
86
|
+
name: "Netherlands",
|
|
87
|
+
languages: ["nl", "en"],
|
|
88
|
+
siteLocale: "nl-NL",
|
|
89
|
+
statute: "Implementatiewet toegankelijkheidsvoorschriften producten en diensten",
|
|
90
|
+
authority: "ACM for services, RDI for products"
|
|
91
|
+
},
|
|
92
|
+
PL: {
|
|
93
|
+
name: "Poland",
|
|
94
|
+
languages: ["pl", "en"],
|
|
95
|
+
siteLocale: "pl-PL",
|
|
96
|
+
statute: "Ustawa z dnia 26 kwietnia 2024 r. (Dz.U. 2024 poz. 731)",
|
|
97
|
+
authority: "Prezes Zarządu PFRON"
|
|
98
|
+
},
|
|
99
|
+
PT: {
|
|
100
|
+
name: "Portugal",
|
|
101
|
+
languages: ["pt", "en"],
|
|
102
|
+
siteLocale: "pt-PT",
|
|
103
|
+
statute: "Decreto-Lei n.º 82/2022, de 6 de dezembro",
|
|
104
|
+
authority: "ANACOM for e-commerce services"
|
|
105
|
+
},
|
|
106
|
+
SE: {
|
|
107
|
+
name: "Sweden",
|
|
108
|
+
languages: ["sv", "en"],
|
|
109
|
+
siteLocale: "sv-SE",
|
|
110
|
+
statute: "Lag (2023:254) om vissa produkters och tjänsters tillgänglighet",
|
|
111
|
+
authority: "Post- och telestyrelsen (PTS)",
|
|
112
|
+
authorityChange: {
|
|
113
|
+
on: "2027-01-01",
|
|
114
|
+
authority: "Digitaliseringsmyndigheten (PTS and Digg, merged)",
|
|
115
|
+
source: "Förordning (2026:1769) med instruktion för Digitaliseringsmyndigheten, 21 §"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Whether a country's scheduled change of supervisor has taken effect on a day.
|
|
121
|
+
*
|
|
122
|
+
* False for a country with no change scheduled. Dates are compared as ISO
|
|
123
|
+
* strings, which sort the way the calendar does.
|
|
124
|
+
*/
|
|
125
|
+
function authorityChanged(country, isoDate) {
|
|
126
|
+
const change = COUNTRY_INFO[country].authorityChange;
|
|
127
|
+
return change !== void 0 && isoDate >= change.on;
|
|
128
|
+
}
|
|
129
|
+
/** The body a reader is sent to on a given day. */
|
|
130
|
+
function authorityOn(country, isoDate) {
|
|
131
|
+
const info = COUNTRY_INFO[country];
|
|
132
|
+
return authorityChanged(country, isoDate) && info.authorityChange ? info.authorityChange.authority : info.authority;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Today in the local calendar, as an ISO date.
|
|
136
|
+
*
|
|
137
|
+
* Local rather than UTC because the switch is a legal date in the country's
|
|
138
|
+
* own calendar: a statement generated in Stockholm at half past midnight on
|
|
139
|
+
* New Year's Day is generated in the new year, which `toISOString` would deny
|
|
140
|
+
* for another hour.
|
|
141
|
+
*/
|
|
142
|
+
function localToday(now = /* @__PURE__ */ new Date()) {
|
|
143
|
+
const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
144
|
+
const day = String(now.getDate()).padStart(2, "0");
|
|
145
|
+
return `${now.getFullYear()}-${month}-${day}`;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A country from what somebody typed: the code in any case, or the English name.
|
|
149
|
+
*
|
|
150
|
+
* Undefined rather than a default. A statement is a legal document under one
|
|
151
|
+
* country's law, and quietly substituting another country for a typo is how
|
|
152
|
+
* somebody ends up publishing an Austrian statement for a Polish shop.
|
|
153
|
+
*/
|
|
154
|
+
function findCountry(value) {
|
|
155
|
+
const wanted = value.trim().toLowerCase();
|
|
156
|
+
if (wanted === "") return void 0;
|
|
157
|
+
for (const [code, info] of Object.entries(COUNTRY_INFO)) if (code.toLowerCase() === wanted || info.name.toLowerCase() === wanted) return code;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The country a site's language tag points at, when it points at one.
|
|
161
|
+
*
|
|
162
|
+
* The region decides where there is one: `de-AT` is Austria, `fr-BE` is
|
|
163
|
+
* Belgium, and a region with no country listed here gives nothing. A bare language counts only where that language's own country is
|
|
164
|
+
* listed, so `pl` is Poland and `fr` is France. English has no such country, so
|
|
165
|
+
* `en` gives nothing. This is a default for `init` to offer, not an answer.
|
|
166
|
+
* Which country's law applies depends on where the business sells, and a site's
|
|
167
|
+
* language only suggests that.
|
|
168
|
+
*/
|
|
169
|
+
function countryForLocale(tag) {
|
|
170
|
+
const [language, region] = tag.toLowerCase().split("-");
|
|
171
|
+
if (language === void 0) return void 0;
|
|
172
|
+
const codes = Object.keys(COUNTRY_INFO);
|
|
173
|
+
if (region !== void 0) return codes.find((code) => code.toLowerCase() === region);
|
|
174
|
+
const own = codes.find((code) => COUNTRY_INFO[code].siteLocale.toLowerCase() === `${language}-${language}`);
|
|
175
|
+
if (own !== void 0) return own;
|
|
176
|
+
if (language === "en") return void 0;
|
|
177
|
+
const speakers = codes.filter((code) => COUNTRY_INFO[code].siteLocale.startsWith(`${language}-`));
|
|
178
|
+
return speakers.length === 1 ? speakers[0] : void 0;
|
|
179
|
+
}
|
|
180
|
+
export { findCountry as a, countryForLocale as i, authorityChanged as n, localToday as o, authorityOn as r, COUNTRY_INFO as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { o as localToday, r as authorityOn, t as COUNTRY_INFO } from "./countries-B_PE6r5R.js";
|
|
2
|
+
import { r as COUNTRIES } from "./define-BdTPIfqE.js";
|
|
3
|
+
import pc from "picocolors";
|
|
4
|
+
// src/cli/countries.ts
|
|
5
|
+
function formatCountries(options = {}) {
|
|
6
|
+
const today = options.today ?? localToday();
|
|
7
|
+
if (options.json) {
|
|
8
|
+
const entries = COUNTRIES.map((code) => ({
|
|
9
|
+
code,
|
|
10
|
+
...COUNTRY_INFO[code],
|
|
11
|
+
authority: authorityOn(code, today)
|
|
12
|
+
}));
|
|
13
|
+
return `${JSON.stringify(entries, null, 2)}\n`;
|
|
14
|
+
}
|
|
15
|
+
const colors = pc.createColors(options.color ?? pc.isColorSupported);
|
|
16
|
+
const lines = [];
|
|
17
|
+
for (const code of COUNTRIES) {
|
|
18
|
+
const info = COUNTRY_INFO[code];
|
|
19
|
+
lines.push(`${colors.bold(code)} ${info.name} ${colors.dim(`(${info.languages.join(", ")})`)}`, ` Statute: ${info.statute}`, ` Authority: ${authorityOn(code, today)}`);
|
|
20
|
+
const change = info.authorityChange;
|
|
21
|
+
if (change && today < change.on) lines.push(colors.dim(` From ${change.on}: ${change.authority} (${change.source})`));
|
|
22
|
+
if (info.unverified) lines.push(colors.yellow(" Citations not yet checked against the primary text"));
|
|
23
|
+
lines.push("");
|
|
24
|
+
}
|
|
25
|
+
lines.push("eaa-kit statement --country <code> --lang <language>");
|
|
26
|
+
return `${lines.join("\n")}\n`;
|
|
27
|
+
}
|
|
28
|
+
export { formatCountries };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as WCAG22_AA_CRITERIA } from "./criteria-
|
|
2
|
-
import { n as DEFAULT_TAGS, p as successCriteria, r as ENGINE_BLIND_RULES } from "./result-
|
|
3
|
-
import { s as criterionReview } from "./review-
|
|
1
|
+
import { t as WCAG22_AA_CRITERIA } from "./criteria-CacF0HP1.js";
|
|
2
|
+
import { n as DEFAULT_TAGS, p as successCriteria, r as ENGINE_BLIND_RULES } from "./result-g8dGsrcv.js";
|
|
3
|
+
import { s as criterionReview } from "./review-BGjTBFvd.js";
|
|
4
4
|
import axe from "axe-core";
|
|
5
|
-
|
|
5
|
+
// src/audit/manual.ts
|
|
6
6
|
/**
|
|
7
7
|
* What a person has to check, and where to read about it.
|
|
8
8
|
*
|
|
@@ -136,8 +136,7 @@ const MANUAL_CHECKS = {
|
|
|
136
136
|
function manualCheckFor(ruleId) {
|
|
137
137
|
return MANUAL_CHECKS[ruleId];
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
//#region src/audit/coverage.ts
|
|
139
|
+
// src/audit/coverage.ts
|
|
141
140
|
/**
|
|
142
141
|
* Rules axe-core would run under these tags, mapped to the criteria they cover.
|
|
143
142
|
*
|
|
@@ -273,5 +272,4 @@ function reviewSummary(coverage) {
|
|
|
273
272
|
if (coverage.reviewNotCounted > 0) parts.push(`${coverage.reviewNotCounted} further entries were not counted`);
|
|
274
273
|
return `${parts.join("; ")}. This is a claim by a person, not a measurement.`;
|
|
275
274
|
}
|
|
276
|
-
//#endregion
|
|
277
275
|
export { manualCheckFor as a, rulesByCriterion as i, coverageSummary as n, understandingUrl as o, reviewSummary as r, buildCoverage as t };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as stripBom } from "./collect-CjucwTEF.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
|
/**
|
|
@@ -59,7 +61,9 @@ const NON_PAGE = /\.(?:css|js|mjs|json|xml|txt|png|jpe?g|gif|svg|webp|avif|ico|w
|
|
|
59
61
|
function linksFrom(html, from) {
|
|
60
62
|
const found = [];
|
|
61
63
|
const seen = /* @__PURE__ */ new Set();
|
|
62
|
-
for (const
|
|
64
|
+
for (const tag of anchorTags(html)) {
|
|
65
|
+
const match = /\shref\s*=\s*("([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(tag);
|
|
66
|
+
if (match === null) continue;
|
|
63
67
|
const raw = (match[2] ?? match[3] ?? match[4] ?? "").trim();
|
|
64
68
|
if (raw === "" || raw.startsWith("#")) continue;
|
|
65
69
|
if (/^(?:mailto|tel|javascript|data):/i.test(raw)) continue;
|
|
@@ -78,12 +82,48 @@ function linksFrom(html, from) {
|
|
|
78
82
|
}
|
|
79
83
|
return found;
|
|
80
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Each `<a …>` start tag, up to its `>`, with a `>` inside a quoted attribute
|
|
87
|
+
* kept in. Linear: every character is looked at once, and a tag left open
|
|
88
|
+
* ends the scan rather than being searched past from every `<a` inside it.
|
|
89
|
+
*/
|
|
90
|
+
function* anchorTags(html) {
|
|
91
|
+
const lower = html.toLowerCase();
|
|
92
|
+
let cursor = 0;
|
|
93
|
+
for (;;) {
|
|
94
|
+
let start = lower.indexOf("<a", cursor);
|
|
95
|
+
while (start !== -1 && /[a-z0-9:_-]/.test(lower[start + 2] ?? "")) start = lower.indexOf("<a", start + 2);
|
|
96
|
+
if (start === -1) return;
|
|
97
|
+
let quote;
|
|
98
|
+
let end = -1;
|
|
99
|
+
for (let at = start + 2; at < html.length; at += 1) {
|
|
100
|
+
const char = html[at];
|
|
101
|
+
if (quote !== void 0) {
|
|
102
|
+
if (char === quote) quote = void 0;
|
|
103
|
+
} else if (char === "\"" || char === "'") quote = char;
|
|
104
|
+
else if (char === ">") {
|
|
105
|
+
end = at;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (end === -1) return;
|
|
110
|
+
yield html.slice(start, end);
|
|
111
|
+
cursor = end + 1;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
81
114
|
/** Page URLs listed in a sitemap, including one level of sitemap index. */
|
|
82
115
|
function urlsFromSitemap(xml, origin) {
|
|
83
116
|
const urls = [];
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
117
|
+
const lower = xml.toLowerCase();
|
|
118
|
+
let cursor = 0;
|
|
119
|
+
for (;;) {
|
|
120
|
+
const open = lower.indexOf("<loc>", cursor);
|
|
121
|
+
if (open === -1) break;
|
|
122
|
+
const close = lower.indexOf("</loc>", open + 5);
|
|
123
|
+
if (close === -1) break;
|
|
124
|
+
cursor = close + 6;
|
|
125
|
+
const raw = xml.slice(open + 5, close).trim();
|
|
126
|
+
if (raw === "" || raw.includes("<")) continue;
|
|
87
127
|
try {
|
|
88
128
|
const url = new URL(raw);
|
|
89
129
|
url.hash = "";
|
|
@@ -97,30 +137,39 @@ async function fetchPage(url, impl, timeoutMs, origin, maxBodyBytes, headers) {
|
|
|
97
137
|
const controller = new AbortController();
|
|
98
138
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
99
139
|
try {
|
|
100
|
-
const
|
|
140
|
+
const fetched = await fetchWithinOrigin(url, impl, origin, {
|
|
101
141
|
signal: controller.signal,
|
|
102
|
-
redirect: "follow",
|
|
103
142
|
headers: {
|
|
104
143
|
accept: "text/html,application/xhtml+xml",
|
|
105
144
|
"user-agent": "eaa-kit",
|
|
106
145
|
...headers
|
|
107
146
|
}
|
|
108
147
|
});
|
|
109
|
-
if (
|
|
148
|
+
if ("offOrigin" in fetched) return {
|
|
110
149
|
ok: false,
|
|
111
|
-
reason: `
|
|
150
|
+
reason: `redirected off ${origin} to ${fetched.offOrigin.origin}`
|
|
112
151
|
};
|
|
113
|
-
|
|
114
|
-
finalUrl.hash = "";
|
|
115
|
-
if (finalUrl.origin !== origin) return {
|
|
152
|
+
if ("tooMany" in fetched) return {
|
|
116
153
|
ok: false,
|
|
117
|
-
reason: `
|
|
154
|
+
reason: `more than ${MAX_REDIRECTS} redirects`
|
|
118
155
|
};
|
|
156
|
+
const { response } = fetched;
|
|
157
|
+
if (!response.ok) {
|
|
158
|
+
await discard(response);
|
|
159
|
+
return {
|
|
160
|
+
ok: false,
|
|
161
|
+
reason: `HTTP ${response.status}`
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
const finalUrl = fetched.url;
|
|
119
165
|
const type = response.headers.get("content-type") ?? "";
|
|
120
|
-
if (!/\b(?:text\/html|application\/xhtml\+xml)\b/i.test(type))
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
166
|
+
if (!/\b(?:text\/html|application\/xhtml\+xml)\b/i.test(type)) {
|
|
167
|
+
await discard(response);
|
|
168
|
+
return {
|
|
169
|
+
ok: false,
|
|
170
|
+
reason: `not HTML (${type.split(";")[0] || "no content-type"})`
|
|
171
|
+
};
|
|
172
|
+
}
|
|
124
173
|
const body = await readCapped(response, maxBodyBytes);
|
|
125
174
|
if (body === void 0) return {
|
|
126
175
|
ok: false,
|
|
@@ -143,6 +192,53 @@ async function fetchPage(url, impl, timeoutMs, origin, maxBodyBytes, headers) {
|
|
|
143
192
|
clearTimeout(timer);
|
|
144
193
|
}
|
|
145
194
|
}
|
|
195
|
+
/** Redirects one fetch follows before it gives up on the chain. */
|
|
196
|
+
const MAX_REDIRECTS = 10;
|
|
197
|
+
/**
|
|
198
|
+
* One request, following redirects by hand and never off `origin`.
|
|
199
|
+
*
|
|
200
|
+
* `redirect: 'follow'` makes the off-origin request before the caller can see
|
|
201
|
+
* where it went, and carries every header with it: fetch drops Authorization
|
|
202
|
+
* on a cross-origin hop and nothing else, so a cookie or a preview bypass
|
|
203
|
+
* token went to wherever a page redirected. Each hop is checked before it is
|
|
204
|
+
* requested instead.
|
|
205
|
+
*/
|
|
206
|
+
async function fetchWithinOrigin(url, impl, origin, init) {
|
|
207
|
+
let current = new URL(url.href);
|
|
208
|
+
current.hash = "";
|
|
209
|
+
for (let hop = 0; hop <= MAX_REDIRECTS; hop += 1) {
|
|
210
|
+
const response = await impl(current.href, {
|
|
211
|
+
...init,
|
|
212
|
+
redirect: "manual"
|
|
213
|
+
});
|
|
214
|
+
const location = response.headers.get("location");
|
|
215
|
+
if (response.status >= 300 && response.status < 400 && location !== null) {
|
|
216
|
+
await discard(response);
|
|
217
|
+
const next = new URL(location, current);
|
|
218
|
+
next.hash = "";
|
|
219
|
+
if (next.origin !== origin) return { offOrigin: next };
|
|
220
|
+
current = next;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const landed = new URL(response.url || current.href);
|
|
224
|
+
landed.hash = "";
|
|
225
|
+
if (landed.origin !== origin) {
|
|
226
|
+
await discard(response);
|
|
227
|
+
return { offOrigin: landed };
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
response,
|
|
231
|
+
url: landed
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return { tooMany: true };
|
|
235
|
+
}
|
|
236
|
+
/** Let go of a body nobody will read, so its connection is released. */
|
|
237
|
+
async function discard(response) {
|
|
238
|
+
try {
|
|
239
|
+
await response.body?.cancel();
|
|
240
|
+
} catch {}
|
|
241
|
+
}
|
|
146
242
|
/**
|
|
147
243
|
* A response body, up to a limit, or undefined when it runs past it.
|
|
148
244
|
*
|
|
@@ -218,13 +314,16 @@ async function fetchSiteFile(entry, impl, name, timeoutMs, maxBodyBytes, headers
|
|
|
218
314
|
const controller = new AbortController();
|
|
219
315
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
220
316
|
try {
|
|
221
|
-
const
|
|
222
|
-
redirect: "follow",
|
|
317
|
+
const fetched = await fetchWithinOrigin(new URL(name, entry), impl, entry.origin, {
|
|
223
318
|
signal: controller.signal,
|
|
224
319
|
...headers === void 0 ? {} : { headers }
|
|
225
320
|
});
|
|
226
|
-
if (!response
|
|
227
|
-
|
|
321
|
+
if (!("response" in fetched)) return void 0;
|
|
322
|
+
const { response } = fetched;
|
|
323
|
+
if (!response.ok) {
|
|
324
|
+
await discard(response);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
228
327
|
return await readCapped(response, maxBodyBytes);
|
|
229
328
|
} catch {
|
|
230
329
|
return;
|
|
@@ -244,7 +343,7 @@ async function crawlSite(entry, options = {}) {
|
|
|
244
343
|
const maxPages = options.maxPages ?? 200;
|
|
245
344
|
const maxDepth = options.maxDepth ?? 3;
|
|
246
345
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
247
|
-
const maxBodyBytes = options.maxBodyBytes ??
|
|
346
|
+
const maxBodyBytes = options.maxBodyBytes ?? 33554432;
|
|
248
347
|
const failures = [];
|
|
249
348
|
const robots = options.ignoreRobots ? void 0 : await fetchSiteFile(entry, impl, "/robots.txt", timeoutMs, maxBodyBytes, options.headers);
|
|
250
349
|
const blocked = robots === void 0 ? [] : disallowedPaths(robots);
|
|
@@ -261,9 +360,21 @@ async function crawlSite(entry, options = {}) {
|
|
|
261
360
|
});
|
|
262
361
|
};
|
|
263
362
|
const sitemap = await fetchSiteFile(entry, impl, options.sitemap ?? "/sitemap.xml", timeoutMs, maxBodyBytes, options.headers);
|
|
363
|
+
const seeded = (options.seeds ?? []).flatMap((raw) => {
|
|
364
|
+
try {
|
|
365
|
+
const url = new URL(raw, entry);
|
|
366
|
+
return url.origin === entry.origin ? [url] : [];
|
|
367
|
+
} catch {
|
|
368
|
+
return [];
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
if (seeded.length > 0) {
|
|
372
|
+
discovery = "manifest";
|
|
373
|
+
for (const url of seeded) enqueue(url, 0);
|
|
374
|
+
}
|
|
264
375
|
const listed = sitemap === void 0 ? [] : urlsFromSitemap(sitemap, entry);
|
|
265
376
|
if (listed.length > 0) {
|
|
266
|
-
discovery = "sitemap";
|
|
377
|
+
if (discovery !== "manifest") discovery = "sitemap";
|
|
267
378
|
for (const url of listed) enqueue(url, 0);
|
|
268
379
|
}
|
|
269
380
|
enqueue(entry, 0);
|
|
@@ -348,5 +459,4 @@ function byIdentity(pages) {
|
|
|
348
459
|
return true;
|
|
349
460
|
}).sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
350
461
|
}
|
|
351
|
-
|
|
352
|
-
export { CrawlError, collapsedOnto, crawlSite, parseEntryUrl };
|
|
462
|
+
export { CrawlError, DEFAULT_REQUEST_TIMEOUT_MS, MAX_BODY_BYTES, collapsedOnto, crawlSite, parseEntryUrl };
|