eaa-kit 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -149
- 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-J2jeLo-y.js → audit-DbqNIrt6.js} +61 -35
- package/dist/audit-rUhqnm3o.js +1 -0
- package/dist/{baseline-DrFh7joZ.js → baseline-CKElWbx4.js} +4 -5
- package/dist/baseline-DU0EPiTq.js +1 -0
- package/dist/baseline-DYOejLFO.js +1 -0
- package/dist/{baseline-wyJsSIFQ.js → baseline-DvdsFTQy.js} +5 -6
- package/dist/{cache-D4dOIuOi.js → cache-DIV4G0TI.js} +24 -5
- package/dist/{checklist-Gx2g3LFC.js → checklist-CA0Ri71Z.js} +7 -8
- package/dist/cli/index.js +52 -35
- package/dist/{collect-BJYk7_pJ.js → collect-CjucwTEF.js} +16 -8
- package/dist/{command-BGGMf4vn.js → command-C8ZFvcc1.js} +6 -9
- 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-Dg0BdytB.js → countries-B_PE6r5R.js} +42 -18
- package/dist/{countries-DRTBubeE.js → countries-CCqog6dy.js} +10 -7
- package/dist/coverage-B9_6yv_8.js +2 -0
- package/dist/{coverage-zdzgSKjz.js → coverage-C1Z6t9Ct.js} +5 -7
- package/dist/{crawl-DwdqiljK.js → crawl-CkHJJV4w.js} +131 -23
- package/dist/{criteria-CnPJKGeb.js → criteria-CacF0HP1.js} +1 -2
- package/dist/{define-Ctf2uOEh.js → define-BdTPIfqE.js} +5 -5
- 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-CjqjrUBY.js → entry-kf94P140.js} +1 -2
- 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-whingnfj.js → html-Bjq3Iw3g.js} +54 -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 +10 -23
- package/dist/index.js +3 -3
- package/dist/{init-CPbFVMuk.js → init-3Ti3ao5Z.js} +65 -126
- 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-SGCgxSPT.js → json-B_k4CDmR.js} +5 -6
- package/dist/json-IL1JxlTL.js +1 -0
- package/dist/{load-CH-ltdlq.js → load-C3eFEdoH.js} +3 -4
- 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-DxY5Z0gl.js → pages-CCP1WfYe.js} +80 -17
- 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-Bbs4KcX1.js → remediation-BkE7q7dT.js} +2 -193
- package/dist/{render-C6zYfaba.js → render-ky8cm4QF.js} +22 -20
- package/dist/result-DhoT4g0P.js +1 -0
- package/dist/{result-B7_zVxAX.js → result-g8dGsrcv.js} +1 -2
- package/dist/{review-Bz0fO9_I.js → review-BGjTBFvd.js} +2 -3
- package/dist/review-iheEjp7_.js +1 -0
- package/dist/{routes-CSctpS1P.js → routes-BpQeBDmM.js} +4 -5
- package/dist/{run-DzVEOkiF.js → run-D7tc7IU2.js} +2 -3
- package/dist/{run-BK2blxMI.d.ts → run-VXnP4uLp.d.ts} +2 -6
- package/dist/{sarif-9BAgNiOa.js → sarif-v66-PjdE.js} +7 -8
- 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-BHMtf3q2.js → site-CxVyh8IO.js} +1 -2
- package/dist/{start-DzOM0p6I.js → start-bdanSxZr.js} +9 -10
- package/dist/statement/templates/cz.cs.md +2 -1
- package/dist/statement/templates/cz.en.md +2 -1
- package/dist/statement/templates/dk.da.md +3 -2
- package/dist/statement/templates/dk.en.md +4 -3
- package/dist/statement/templates/pt.en.md +3 -2
- package/dist/statement/templates/pt.pt.md +3 -3
- package/dist/statement/templates/se.en.md +9 -0
- package/dist/statement/templates/se.sv.md +8 -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-B2RoUbo0.js → watch-CefxwMsZ.js} +3 -4
- package/dist/webpack/index.d.ts +1 -3
- package/dist/webpack/index.js +2 -3
- package/dist/{worksheet-B_kQ1pxq.js → worksheet-CcBo9G7s.js} +4 -5
- package/dist/workspaces-BBFXOyeV.js +85 -0
- package/package.json +15 -13
- package/dist/audit-CJDCQaFY.js +0 -2
- package/dist/baseline-477B1CZ_.js +0 -2
- package/dist/baseline-D9ihb-wk.js +0 -2
- package/dist/component-DcCn3BJS.js +0 -2
- package/dist/coverage-GvaMpV64.js +0 -3
- package/dist/frameworks-etFg_O8K.js +0 -2
- package/dist/jsdom-BUYuVJJm.js +0 -3
- package/dist/json-CyLmvF5P.js +0 -2
- package/dist/load-D7lBeOsq.js +0 -2
- package/dist/project-BLFdCbOq.js +0 -2
- package/dist/project-v2PoRw70.js +0 -291
- package/dist/result-CRmjjoAA.js +0 -2
- package/dist/review-a-2ghjQ5.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,7 @@ 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
|
-
//#region src/next.ts
|
|
83
|
+
// src/next.ts
|
|
85
84
|
/** The next step an error carries, if it carries one. */
|
|
86
85
|
function nextStepOf(cause) {
|
|
87
86
|
if (cause === null || typeof cause !== "object") return void 0;
|
|
@@ -93,8 +92,7 @@ function nextStepOf(cause) {
|
|
|
93
92
|
why
|
|
94
93
|
} : void 0;
|
|
95
94
|
}
|
|
96
|
-
|
|
97
|
-
//#region src/cli/command.ts
|
|
95
|
+
// src/cli/command.ts
|
|
98
96
|
/**
|
|
99
97
|
* What every command does around the audit itself: say what is happening, run
|
|
100
98
|
* the engine, and put the document somewhere.
|
|
@@ -147,14 +145,14 @@ async function runEngine(pages, options) {
|
|
|
147
145
|
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
|
|
148
146
|
};
|
|
149
147
|
if (!options.browser) {
|
|
150
|
-
const { runPooledAudit } = await import("./pool-
|
|
148
|
+
const { runPooledAudit } = await import("./pool-B3XKdk57.js");
|
|
151
149
|
return runPooledAudit(pages, {
|
|
152
150
|
...runnerOptions,
|
|
153
151
|
...options.fast ? { fast: true } : {},
|
|
154
152
|
...options.concurrency === void 0 ? {} : { concurrency: options.concurrency }
|
|
155
153
|
});
|
|
156
154
|
}
|
|
157
|
-
const { BrowserUnavailableError, runBrowserAudit } = await import("./playwright-
|
|
155
|
+
const { BrowserUnavailableError, runBrowserAudit } = await import("./playwright-ky4b_HME.js");
|
|
158
156
|
try {
|
|
159
157
|
return await runBrowserAudit(options.directory, pages, {
|
|
160
158
|
...runnerOptions,
|
|
@@ -201,7 +199,7 @@ async function emitDocument(body, output, cwd) {
|
|
|
201
199
|
* on different settings than it names would be worse than stopping.
|
|
202
200
|
*/
|
|
203
201
|
async function auditDefaults(options = {}) {
|
|
204
|
-
const { loadAuditConfig } = await import("./load-
|
|
202
|
+
const { loadAuditConfig } = await import("./load-oQQJPNlV.js");
|
|
205
203
|
const loaded = await loadAuditConfig({
|
|
206
204
|
...options.cwd ? { cwd: options.cwd } : {},
|
|
207
205
|
...options.config ? { path: options.config } : {}
|
|
@@ -274,5 +272,4 @@ function pick(source, keys) {
|
|
|
274
272
|
for (const key of keys) if (source[key] !== void 0) out[key] = source[key];
|
|
275
273
|
return out;
|
|
276
274
|
}
|
|
277
|
-
//#endregion
|
|
278
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/config/countries.ts
|
|
2
2
|
const COUNTRY_INFO = {
|
|
3
3
|
AT: {
|
|
4
4
|
name: "Austria",
|
|
@@ -17,8 +17,7 @@ const COUNTRY_INFO = {
|
|
|
17
17
|
],
|
|
18
18
|
siteLocale: "fr-BE",
|
|
19
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
|
|
20
|
+
authority: "SPF Économie / FOD Economie, Economic Inspection"
|
|
22
21
|
},
|
|
23
22
|
CH: {
|
|
24
23
|
name: "Switzerland",
|
|
@@ -32,8 +31,7 @@ const COUNTRY_INFO = {
|
|
|
32
31
|
languages: ["cs", "en"],
|
|
33
32
|
siteLocale: "cs-CZ",
|
|
34
33
|
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
|
|
34
|
+
authority: "Česká obchodní inspekce (ČOI)"
|
|
37
35
|
},
|
|
38
36
|
DE: {
|
|
39
37
|
name: "Germany",
|
|
@@ -47,8 +45,7 @@ const COUNTRY_INFO = {
|
|
|
47
45
|
languages: ["da", "en"],
|
|
48
46
|
siteLocale: "da-DK",
|
|
49
47
|
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
|
|
48
|
+
authority: "Sikkerhedsstyrelsen for e-commerce; supervision is split"
|
|
52
49
|
},
|
|
53
50
|
ES: {
|
|
54
51
|
name: "Spain",
|
|
@@ -62,8 +59,7 @@ const COUNTRY_INFO = {
|
|
|
62
59
|
languages: ["fi", "en"],
|
|
63
60
|
siteLocale: "fi-FI",
|
|
64
61
|
statute: "Laki digitaalisten palvelujen tarjoamisesta (306/2019), as amended",
|
|
65
|
-
authority: "Liikenne- ja viestintävirasto Traficom"
|
|
66
|
-
unverified: true
|
|
62
|
+
authority: "Liikenne- ja viestintävirasto Traficom"
|
|
67
63
|
},
|
|
68
64
|
FR: {
|
|
69
65
|
name: "France",
|
|
@@ -77,8 +73,7 @@ const COUNTRY_INFO = {
|
|
|
77
73
|
languages: ["en"],
|
|
78
74
|
siteLocale: "en-IE",
|
|
79
75
|
statute: "S.I. No. 636 of 2023",
|
|
80
|
-
authority: "Competition and Consumer Protection Commission (CCPC)"
|
|
81
|
-
unverified: true
|
|
76
|
+
authority: "Competition and Consumer Protection Commission (CCPC)"
|
|
82
77
|
},
|
|
83
78
|
IT: {
|
|
84
79
|
name: "Italy",
|
|
@@ -99,16 +94,14 @@ const COUNTRY_INFO = {
|
|
|
99
94
|
languages: ["pl", "en"],
|
|
100
95
|
siteLocale: "pl-PL",
|
|
101
96
|
statute: "Ustawa z dnia 26 kwietnia 2024 r. (Dz.U. 2024 poz. 731)",
|
|
102
|
-
authority: "Prezes Zarządu PFRON"
|
|
103
|
-
unverified: true
|
|
97
|
+
authority: "Prezes Zarządu PFRON"
|
|
104
98
|
},
|
|
105
99
|
PT: {
|
|
106
100
|
name: "Portugal",
|
|
107
101
|
languages: ["pt", "en"],
|
|
108
102
|
siteLocale: "pt-PT",
|
|
109
103
|
statute: "Decreto-Lei n.º 82/2022, de 6 de dezembro",
|
|
110
|
-
authority: "ANACOM for e-commerce services"
|
|
111
|
-
unverified: true
|
|
104
|
+
authority: "ANACOM for e-commerce services"
|
|
112
105
|
},
|
|
113
106
|
SE: {
|
|
114
107
|
name: "Sweden",
|
|
@@ -116,10 +109,42 @@ const COUNTRY_INFO = {
|
|
|
116
109
|
siteLocale: "sv-SE",
|
|
117
110
|
statute: "Lag (2023:254) om vissa produkters och tjänsters tillgänglighet",
|
|
118
111
|
authority: "Post- och telestyrelsen (PTS)",
|
|
119
|
-
|
|
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
|
+
}
|
|
120
117
|
}
|
|
121
118
|
};
|
|
122
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
|
+
/**
|
|
123
148
|
* A country from what somebody typed: the code in any case, or the English name.
|
|
124
149
|
*
|
|
125
150
|
* Undefined rather than a default. A statement is a legal document under one
|
|
@@ -152,5 +177,4 @@ function countryForLocale(tag) {
|
|
|
152
177
|
const speakers = codes.filter((code) => COUNTRY_INFO[code].siteLocale.startsWith(`${language}-`));
|
|
153
178
|
return speakers.length === 1 ? speakers[0] : void 0;
|
|
154
179
|
}
|
|
155
|
-
|
|
156
|
-
export { countryForLocale as n, findCountry as r, COUNTRY_INFO as t };
|
|
180
|
+
export { findCountry as a, countryForLocale as i, authorityChanged as n, localToday as o, authorityOn as r, COUNTRY_INFO as t };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import {
|
|
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
3
|
import pc from "picocolors";
|
|
4
|
-
|
|
4
|
+
// src/cli/countries.ts
|
|
5
5
|
function formatCountries(options = {}) {
|
|
6
|
+
const today = options.today ?? localToday();
|
|
6
7
|
if (options.json) {
|
|
7
8
|
const entries = COUNTRIES.map((code) => ({
|
|
8
9
|
code,
|
|
9
|
-
...COUNTRY_INFO[code]
|
|
10
|
+
...COUNTRY_INFO[code],
|
|
11
|
+
authority: authorityOn(code, today)
|
|
10
12
|
}));
|
|
11
13
|
return `${JSON.stringify(entries, null, 2)}\n`;
|
|
12
14
|
}
|
|
@@ -14,12 +16,13 @@ function formatCountries(options = {}) {
|
|
|
14
16
|
const lines = [];
|
|
15
17
|
for (const code of COUNTRIES) {
|
|
16
18
|
const info = COUNTRY_INFO[code];
|
|
17
|
-
lines.push(`${colors.bold(code)} ${info.name} ${colors.dim(`(${info.languages.join(", ")})`)}`, ` Statute: ${info.statute}`, ` Authority: ${
|
|
18
|
-
|
|
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"));
|
|
19
23
|
lines.push("");
|
|
20
24
|
}
|
|
21
25
|
lines.push("eaa-kit statement --country <code> --lang <language>");
|
|
22
26
|
return `${lines.join("\n")}\n`;
|
|
23
27
|
}
|
|
24
|
-
//#endregion
|
|
25
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,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as stripBom } from "./collect-CjucwTEF.js";
|
|
2
2
|
/** Per-request timeout. */
|
|
3
3
|
const DEFAULT_REQUEST_TIMEOUT_MS = 15e3;
|
|
4
4
|
/** Requests in flight at once. Politeness, not throughput. */
|
|
@@ -61,7 +61,9 @@ const NON_PAGE = /\.(?:css|js|mjs|json|xml|txt|png|jpe?g|gif|svg|webp|avif|ico|w
|
|
|
61
61
|
function linksFrom(html, from) {
|
|
62
62
|
const found = [];
|
|
63
63
|
const seen = /* @__PURE__ */ new Set();
|
|
64
|
-
for (const
|
|
64
|
+
for (const tag of anchorTags(html)) {
|
|
65
|
+
const match = /\shref\s*=\s*("([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(tag);
|
|
66
|
+
if (match === null) continue;
|
|
65
67
|
const raw = (match[2] ?? match[3] ?? match[4] ?? "").trim();
|
|
66
68
|
if (raw === "" || raw.startsWith("#")) continue;
|
|
67
69
|
if (/^(?:mailto|tel|javascript|data):/i.test(raw)) continue;
|
|
@@ -80,12 +82,48 @@ function linksFrom(html, from) {
|
|
|
80
82
|
}
|
|
81
83
|
return found;
|
|
82
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
|
+
}
|
|
83
114
|
/** Page URLs listed in a sitemap, including one level of sitemap index. */
|
|
84
115
|
function urlsFromSitemap(xml, origin) {
|
|
85
116
|
const urls = [];
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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;
|
|
89
127
|
try {
|
|
90
128
|
const url = new URL(raw);
|
|
91
129
|
url.hash = "";
|
|
@@ -99,30 +137,39 @@ async function fetchPage(url, impl, timeoutMs, origin, maxBodyBytes, headers) {
|
|
|
99
137
|
const controller = new AbortController();
|
|
100
138
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
101
139
|
try {
|
|
102
|
-
const
|
|
140
|
+
const fetched = await fetchWithinOrigin(url, impl, origin, {
|
|
103
141
|
signal: controller.signal,
|
|
104
|
-
redirect: "follow",
|
|
105
142
|
headers: {
|
|
106
143
|
accept: "text/html,application/xhtml+xml",
|
|
107
144
|
"user-agent": "eaa-kit",
|
|
108
145
|
...headers
|
|
109
146
|
}
|
|
110
147
|
});
|
|
111
|
-
if (
|
|
148
|
+
if ("offOrigin" in fetched) return {
|
|
112
149
|
ok: false,
|
|
113
|
-
reason: `
|
|
150
|
+
reason: `redirected off ${origin} to ${fetched.offOrigin.origin}`
|
|
114
151
|
};
|
|
115
|
-
|
|
116
|
-
finalUrl.hash = "";
|
|
117
|
-
if (finalUrl.origin !== origin) return {
|
|
152
|
+
if ("tooMany" in fetched) return {
|
|
118
153
|
ok: false,
|
|
119
|
-
reason: `
|
|
154
|
+
reason: `more than ${MAX_REDIRECTS} redirects`
|
|
120
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;
|
|
121
165
|
const type = response.headers.get("content-type") ?? "";
|
|
122
|
-
if (!/\b(?:text\/html|application\/xhtml\+xml)\b/i.test(type))
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
+
}
|
|
126
173
|
const body = await readCapped(response, maxBodyBytes);
|
|
127
174
|
if (body === void 0) return {
|
|
128
175
|
ok: false,
|
|
@@ -145,6 +192,53 @@ async function fetchPage(url, impl, timeoutMs, origin, maxBodyBytes, headers) {
|
|
|
145
192
|
clearTimeout(timer);
|
|
146
193
|
}
|
|
147
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
|
+
}
|
|
148
242
|
/**
|
|
149
243
|
* A response body, up to a limit, or undefined when it runs past it.
|
|
150
244
|
*
|
|
@@ -220,13 +314,16 @@ async function fetchSiteFile(entry, impl, name, timeoutMs, maxBodyBytes, headers
|
|
|
220
314
|
const controller = new AbortController();
|
|
221
315
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
222
316
|
try {
|
|
223
|
-
const
|
|
224
|
-
redirect: "follow",
|
|
317
|
+
const fetched = await fetchWithinOrigin(new URL(name, entry), impl, entry.origin, {
|
|
225
318
|
signal: controller.signal,
|
|
226
319
|
...headers === void 0 ? {} : { headers }
|
|
227
320
|
});
|
|
228
|
-
if (!response
|
|
229
|
-
|
|
321
|
+
if (!("response" in fetched)) return void 0;
|
|
322
|
+
const { response } = fetched;
|
|
323
|
+
if (!response.ok) {
|
|
324
|
+
await discard(response);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
230
327
|
return await readCapped(response, maxBodyBytes);
|
|
231
328
|
} catch {
|
|
232
329
|
return;
|
|
@@ -263,9 +360,21 @@ async function crawlSite(entry, options = {}) {
|
|
|
263
360
|
});
|
|
264
361
|
};
|
|
265
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
|
+
}
|
|
266
375
|
const listed = sitemap === void 0 ? [] : urlsFromSitemap(sitemap, entry);
|
|
267
376
|
if (listed.length > 0) {
|
|
268
|
-
discovery = "sitemap";
|
|
377
|
+
if (discovery !== "manifest") discovery = "sitemap";
|
|
269
378
|
for (const url of listed) enqueue(url, 0);
|
|
270
379
|
}
|
|
271
380
|
enqueue(entry, 0);
|
|
@@ -350,5 +459,4 @@ function byIdentity(pages) {
|
|
|
350
459
|
return true;
|
|
351
460
|
}).sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
352
461
|
}
|
|
353
|
-
//#endregion
|
|
354
462
|
export { CrawlError, DEFAULT_REQUEST_TIMEOUT_MS, MAX_BODY_BYTES, collapsedOnto, crawlSite, parseEntryUrl };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/audit/criteria.ts
|
|
2
2
|
/**
|
|
3
3
|
* WCAG 2.2 at Levels A and AA, which is what this tool audits against.
|
|
4
4
|
*
|
|
@@ -282,5 +282,4 @@ const WCAG22_AA_CRITERIA = [
|
|
|
282
282
|
level: "AA"
|
|
283
283
|
}
|
|
284
284
|
];
|
|
285
|
-
//#endregion
|
|
286
285
|
export { WCAG22_AA_CRITERIA as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as IMPACT_LEVELS } from "./impact-
|
|
2
|
-
import { _ as union, a as integer, d as optional, f as pipe, g as transform, h as string, i as enumeration, m as safeParse, n as boolean, o as isoDate, r as email, t as array, u as object, v as url, y as withDefault } from "./schema-
|
|
3
|
-
|
|
1
|
+
import { n as IMPACT_LEVELS } from "./impact-BGlJ6j0Y.js";
|
|
2
|
+
import { _ as union, a as integer, d as optional, f as pipe, g as transform, h as string, i as enumeration, m as safeParse, n as boolean, o as isoDate, r as email, t as array, u as object, v as url, y as withDefault } from "./schema-DfC-Ww1w.js";
|
|
3
|
+
// src/config/define.ts
|
|
4
4
|
/**
|
|
5
5
|
* Countries with their own supervisory body and statute text. What is known
|
|
6
6
|
* about each one is in `countries.ts`.
|
|
@@ -134,7 +134,8 @@ const auditSchema = object({
|
|
|
134
134
|
"console",
|
|
135
135
|
"json",
|
|
136
136
|
"sarif",
|
|
137
|
-
"html"
|
|
137
|
+
"html",
|
|
138
|
+
"markdown"
|
|
138
139
|
])),
|
|
139
140
|
/** Write the report here instead of stdout. */
|
|
140
141
|
output: optional(string({ min: 1 })),
|
|
@@ -263,5 +264,4 @@ function parse(schema, value, source) {
|
|
|
263
264
|
});
|
|
264
265
|
throw new ConfigError(`${source} is not valid`, issues);
|
|
265
266
|
}
|
|
266
|
-
//#endregion
|
|
267
267
|
export { ISSUE_REASONS as a, configSchema as c, parseConfig as d, ConfigError as i, defineConfig as l, COMPLIANCE_STATUSES as n, REDIRECT_MODES as o, COUNTRIES as r, STATEMENT_LOCALES as s, ASSESSMENT_METHODS as t, parseAuditConfig as u };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
// src/cli/detect.ts
|
|
4
|
+
async function runDetectCommand(dir, options = {}) {
|
|
5
|
+
const { detectProject } = await import("./detect-oLDadgee.js");
|
|
6
|
+
const detection = await detectProject(path.resolve(dir ?? "."));
|
|
7
|
+
return options.json ? `${JSON.stringify(detection, null, 2)}\n` : formatDetection(detection, options);
|
|
8
|
+
}
|
|
9
|
+
function formatDetection(detection, options = {}) {
|
|
10
|
+
const colors = pc.createColors(options.color ?? pc.isColorSupported);
|
|
11
|
+
const lines = [];
|
|
12
|
+
const row = (label, value, why) => {
|
|
13
|
+
lines.push(`${label.padEnd(16)} ${value}${why === void 0 ? "" : ` ${colors.dim(`(${why})`)}`}`);
|
|
14
|
+
};
|
|
15
|
+
const framework = detection.framework;
|
|
16
|
+
row("Framework", framework?.name ?? "none recognised", framework === void 0 ? void 0 : framework.evidence.join("; "));
|
|
17
|
+
if (detection.packageManager !== void 0) row("Package manager", detection.packageManager.name, detection.packageManager.evidence);
|
|
18
|
+
if (detection.workspace !== void 0) row("Monorepo", detection.workspace.sites.map((site) => `${site.dir} (${site.framework})`).join(", "), detection.workspace.evidence);
|
|
19
|
+
const inner = detection.site ?? detection;
|
|
20
|
+
if (inner.site === void 0 && detection.site !== void 0) row("Site framework", inner.framework?.name ?? "none recognised", inner.framework?.evidence.join("; "));
|
|
21
|
+
if (inner.directory !== void 0) row("Build output", `${inner.directory}/`);
|
|
22
|
+
if (inner.next !== void 0) {
|
|
23
|
+
const { pages, dynamic } = inner.next;
|
|
24
|
+
row("Next.js pages", `${pages} listed by the build`, dynamic.length === 0 ? void 0 : `not listed, rendered on request: ${dynamic.join(", ")}`);
|
|
25
|
+
}
|
|
26
|
+
lines.push("");
|
|
27
|
+
lines.push(`${colors.bold("An audit would")} ${detection.summary}.`);
|
|
28
|
+
const next = nextCommand(detection);
|
|
29
|
+
if (next !== void 0) lines.push(` ${colors.cyan("→")} ${colors.bold(next)}`);
|
|
30
|
+
return `${lines.join("\n")}\n`;
|
|
31
|
+
}
|
|
32
|
+
/** The command to type next, given what was found. */
|
|
33
|
+
function nextCommand(detection) {
|
|
34
|
+
const inner = detection.site ?? detection;
|
|
35
|
+
if (detection.plan === "choose-site") {
|
|
36
|
+
const first = detection.workspace?.sites[0]?.dir;
|
|
37
|
+
return first === void 0 ? void 0 : `cd ${first} && npx eaa-kit detect`;
|
|
38
|
+
}
|
|
39
|
+
if (inner.appShell) return "npx eaa-kit audit --browser";
|
|
40
|
+
switch (inner.plan) {
|
|
41
|
+
case "audit-build":
|
|
42
|
+
case "build":
|
|
43
|
+
case "build-and-serve":
|
|
44
|
+
case "serve": return "npx eaa-kit";
|
|
45
|
+
case "url": return "npx eaa-kit audit --url http://localhost:8000";
|
|
46
|
+
default: return inner.build ?? "npx eaa-kit audit ./path/to/build";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export { runDetectCommand };
|