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,16 +1,18 @@
|
|
|
1
|
-
import { a as impactLabel, i as countAtOrAbove, r as byImpactThenRule } from "./impact-
|
|
2
|
-
import { n as count,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { n as buildSummary } from "./json-
|
|
11
|
-
import { t as
|
|
1
|
+
import { a as impactLabel, i as countAtOrAbove, r as byImpactThenRule } from "./impact-BGlJ6j0Y.js";
|
|
2
|
+
import { n as count, s as plural, t as collapse } from "./text-CISDPU49.js";
|
|
3
|
+
import { a as reusedPart, o as runCompleteness } from "./completeness-Dzyvgr4Z.js";
|
|
4
|
+
import { r as componentPath } from "./component-ZLd8DA_a.js";
|
|
5
|
+
import { a as manualCheckFor, n as coverageSummary, o as understandingUrl, r as reviewSummary, t as buildCoverage } from "./coverage-C1Z6t9Ct.js";
|
|
6
|
+
import { a as issueTotals, i as isShared, n as coverageParts, r as groupIssues, t as blindRules } from "./issues-WLlepU95.js";
|
|
7
|
+
import { t as remediationFor } from "./remediation-BkE7q7dT.js";
|
|
8
|
+
import { n as DEFAULT_TAGS, u as runEngine } from "./result-g8dGsrcv.js";
|
|
9
|
+
import { l as reviewSentence } from "./review-BGjTBFvd.js";
|
|
10
|
+
import { n as buildSummary } from "./json-B_k4CDmR.js";
|
|
11
|
+
import { t as TOOL_VERSION } from "./version-C8aJm8YJ.js";
|
|
12
|
+
import { a as emitDocument, d as warn, l as note, o as fail, s as failWith, t as advise, u as runEngine$1 } from "./command-C8ZFvcc1.js";
|
|
13
|
+
import { t as resolvePages } from "./pages-CCP1WfYe.js";
|
|
12
14
|
import pc from "picocolors";
|
|
13
|
-
|
|
15
|
+
// src/audit/report/console.ts
|
|
14
16
|
const DEFAULT_MAX_NODES = 3;
|
|
15
17
|
const MIN_WIDTH = 40;
|
|
16
18
|
const MAX_WIDTH = 100;
|
|
@@ -452,13 +454,13 @@ function wrap(text, width) {
|
|
|
452
454
|
if (line !== "") lines.push(line);
|
|
453
455
|
return lines;
|
|
454
456
|
}
|
|
455
|
-
|
|
456
|
-
//#region src/cli/audit.ts
|
|
457
|
+
// src/cli/audit.ts
|
|
457
458
|
const OUTPUT_FORMATS = [
|
|
458
459
|
"console",
|
|
459
460
|
"json",
|
|
460
461
|
"sarif",
|
|
461
|
-
"html"
|
|
462
|
+
"html",
|
|
463
|
+
"markdown"
|
|
462
464
|
];
|
|
463
465
|
/**
|
|
464
466
|
* `eaa-kit audit [dir]`.
|
|
@@ -503,6 +505,7 @@ async function runAuditCommand(dir, options = {}) {
|
|
|
503
505
|
await cache?.flush();
|
|
504
506
|
let audits = inCollectedOrder(pages, [...hits, ...fresh]);
|
|
505
507
|
const failOn = options.failOn ?? "serious";
|
|
508
|
+
let baseline;
|
|
506
509
|
if (options.baseline) {
|
|
507
510
|
const applied = await acceptBaseline(audits, options);
|
|
508
511
|
if (!applied) return {
|
|
@@ -510,7 +513,8 @@ async function runAuditCommand(dir, options = {}) {
|
|
|
510
513
|
...found,
|
|
511
514
|
exitCode: 2
|
|
512
515
|
};
|
|
513
|
-
audits = applied;
|
|
516
|
+
audits = applied.audits;
|
|
517
|
+
baseline = applied.counts;
|
|
514
518
|
}
|
|
515
519
|
const completeness = runCompleteness(audits, collection);
|
|
516
520
|
const review = await loadReview(options);
|
|
@@ -519,7 +523,7 @@ async function runAuditCommand(dir, options = {}) {
|
|
|
519
523
|
...found,
|
|
520
524
|
exitCode: 2
|
|
521
525
|
};
|
|
522
|
-
await emit(audits, label, failOn, completeness, options, review);
|
|
526
|
+
await emit(audits, label, failOn, completeness, options, review, baseline);
|
|
523
527
|
const unaudited = audits.filter((audit) => audit.error);
|
|
524
528
|
if (unaudited.length > 0) {
|
|
525
529
|
fail(`${unaudited.length} of ${audits.length} pages could not be audited`);
|
|
@@ -552,8 +556,8 @@ async function splitByCache(pages, baseUrl, options) {
|
|
|
552
556
|
misses: [...pages],
|
|
553
557
|
cache: void 0
|
|
554
558
|
};
|
|
555
|
-
const { fromEntry, openCache } = await import("./cache-
|
|
556
|
-
const { pageUrl } = await import("./result-
|
|
559
|
+
const { fromEntry, openCache } = await import("./cache-DIV4G0TI.js");
|
|
560
|
+
const { pageUrl } = await import("./result-DhoT4g0P.js");
|
|
557
561
|
const axe = (await import("axe-core")).default;
|
|
558
562
|
const engine = options.browser ? "browser" : "jsdom";
|
|
559
563
|
const cache = await openCache({
|
|
@@ -608,7 +612,7 @@ function inCollectedOrder(pages, audits) {
|
|
|
608
612
|
* would be as wrong as silently passing.
|
|
609
613
|
*/
|
|
610
614
|
async function acceptBaseline(audits, options) {
|
|
611
|
-
const { applyBaseline, BaselineError, readBaseline } = await import("./baseline-
|
|
615
|
+
const { applyBaseline, BaselineError, readBaseline } = await import("./baseline-DYOejLFO.js");
|
|
612
616
|
try {
|
|
613
617
|
const outcome = applyBaseline(audits, await readBaseline(options.baseline, options.cwd ?? process.cwd()));
|
|
614
618
|
if (outcome.accepted > 0) note(`Baseline accepted ${outcome.accepted} violating elements`);
|
|
@@ -617,7 +621,13 @@ async function acceptBaseline(audits, options) {
|
|
|
617
621
|
note(`${stale} baseline ${stale === 1 ? "entry no longer matches" : "entries no longer match"} and can be removed`);
|
|
618
622
|
}
|
|
619
623
|
if (outcome.expired.length > 0) advise(`${outcome.expired.length} baseline entries have expired and no longer suppress anything`);
|
|
620
|
-
return
|
|
624
|
+
return {
|
|
625
|
+
audits: outcome.audits,
|
|
626
|
+
counts: {
|
|
627
|
+
stale: outcome.stale.length,
|
|
628
|
+
expired: outcome.expired.length
|
|
629
|
+
}
|
|
630
|
+
};
|
|
621
631
|
} catch (cause) {
|
|
622
632
|
if (cause instanceof BaselineError) {
|
|
623
633
|
failWith(cause);
|
|
@@ -636,7 +646,7 @@ const FAILED = Symbol("review-failed");
|
|
|
636
646
|
*/
|
|
637
647
|
async function loadReview(options) {
|
|
638
648
|
if (options.review === void 0) return void 0;
|
|
639
|
-
const { answeredCount, readReview, ReviewError } = await import("./review-
|
|
649
|
+
const { answeredCount, readReview, ReviewError } = await import("./review-iheEjp7_.js");
|
|
640
650
|
try {
|
|
641
651
|
const record = await readReview(options.review, options.cwd ?? process.cwd());
|
|
642
652
|
note(`Review record: ${count(answeredCount(record), "criterion")} answered`);
|
|
@@ -661,7 +671,7 @@ async function loadReview(options) {
|
|
|
661
671
|
*/
|
|
662
672
|
async function describeEngine(pages, options) {
|
|
663
673
|
if (options.browser) return " with Chromium";
|
|
664
|
-
const { plannedWorkers } = await import("./pool-
|
|
674
|
+
const { plannedWorkers } = await import("./pool-B3XKdk57.js");
|
|
665
675
|
const workers = options.concurrency ?? plannedWorkers(pages);
|
|
666
676
|
const threads = workers > 1 ? ` across ${workers} threads` : "";
|
|
667
677
|
return options.fast ? `${threads}, skipping what this engine cannot decide` : threads;
|
|
@@ -675,22 +685,38 @@ async function describeEngine(pages, options) {
|
|
|
675
685
|
* to know where the document was going anyway — which is the whole of what the
|
|
676
686
|
* split was carrying between them.
|
|
677
687
|
*/
|
|
678
|
-
async function emit(audits, dir, failOn, completeness, options, review) {
|
|
679
|
-
const body = await render(audits, dir, failOn, completeness, typeof options.output === "string", options, review);
|
|
688
|
+
async function emit(audits, dir, failOn, completeness, options, review, baseline) {
|
|
689
|
+
const body = await render(audits, dir, failOn, completeness, typeof options.output === "string", options, review, baseline);
|
|
680
690
|
await emitDocument(body, options.output, options.cwd ?? process.cwd());
|
|
681
691
|
if (options.output !== void 0) note(`Report written to ${options.output}`);
|
|
682
692
|
if (options.htmlReport !== void 0) {
|
|
683
693
|
const html = await render(audits, dir, failOn, completeness, true, {
|
|
684
694
|
...options,
|
|
685
695
|
format: "html"
|
|
686
|
-
}, review);
|
|
696
|
+
}, review, baseline);
|
|
687
697
|
await emitDocument(html, options.htmlReport, options.cwd ?? process.cwd());
|
|
688
698
|
}
|
|
699
|
+
if (options.summary !== void 0) {
|
|
700
|
+
const markdown = await render(audits, dir, failOn, completeness, true, {
|
|
701
|
+
...options,
|
|
702
|
+
format: "markdown"
|
|
703
|
+
}, review, baseline);
|
|
704
|
+
await emitDocument(markdown, options.summary, options.cwd ?? process.cwd());
|
|
705
|
+
}
|
|
689
706
|
}
|
|
690
|
-
async function render(audits, dir, failOn, completeness, toFile, options, review) {
|
|
707
|
+
async function render(audits, dir, failOn, completeness, toFile, options, review, baseline) {
|
|
691
708
|
switch (options.format ?? "console") {
|
|
709
|
+
case "markdown": {
|
|
710
|
+
const { buildMarkdownReport } = await import("./markdown-D-QpPYsz.js");
|
|
711
|
+
return buildMarkdownReport(audits, {
|
|
712
|
+
directory: dir,
|
|
713
|
+
failOn,
|
|
714
|
+
completeness,
|
|
715
|
+
...baseline === void 0 ? {} : { baseline }
|
|
716
|
+
});
|
|
717
|
+
}
|
|
692
718
|
case "json": {
|
|
693
|
-
const { buildJsonReport, serialiseJsonReport } = await import("./json-
|
|
719
|
+
const { buildJsonReport, serialiseJsonReport } = await import("./json-IL1JxlTL.js");
|
|
694
720
|
return serialiseJsonReport(buildJsonReport(audits, {
|
|
695
721
|
directory: dir,
|
|
696
722
|
...options.url === void 0 ? {} : { sourceKind: "url" },
|
|
@@ -701,7 +727,7 @@ async function render(audits, dir, failOn, completeness, toFile, options, review
|
|
|
701
727
|
}));
|
|
702
728
|
}
|
|
703
729
|
case "sarif": {
|
|
704
|
-
const { buildSarifReport, serialiseSarifReport } = await import("./sarif-
|
|
730
|
+
const { buildSarifReport, serialiseSarifReport } = await import("./sarif-v66-PjdE.js");
|
|
705
731
|
return serialiseSarifReport(buildSarifReport(audits, {
|
|
706
732
|
directory: dir,
|
|
707
733
|
completeness,
|
|
@@ -709,13 +735,14 @@ async function render(audits, dir, failOn, completeness, toFile, options, review
|
|
|
709
735
|
}));
|
|
710
736
|
}
|
|
711
737
|
case "html": {
|
|
712
|
-
const { buildHtmlReport } = await import("./html-
|
|
738
|
+
const { buildHtmlReport } = await import("./html-Bjq3Iw3g.js");
|
|
713
739
|
return buildHtmlReport(audits, {
|
|
714
740
|
...await fromTheProject(audits, options),
|
|
715
741
|
directory: dir,
|
|
716
742
|
failOn,
|
|
717
743
|
completeness,
|
|
718
744
|
...review === void 0 ? {} : { review },
|
|
745
|
+
...baseline === void 0 ? {} : { baseline },
|
|
719
746
|
...options.baseUrl ? { baseUrl: options.baseUrl } : {}
|
|
720
747
|
});
|
|
721
748
|
}
|
|
@@ -742,8 +769,8 @@ async function render(audits, dir, failOn, completeness, toFile, options, review
|
|
|
742
769
|
*/
|
|
743
770
|
async function fromTheProject(audits, options) {
|
|
744
771
|
const cwd = options.cwd ?? process.cwd();
|
|
745
|
-
const { detectFramework } = await import("./frameworks-
|
|
746
|
-
const { readPackageJson } = await import("./project-
|
|
772
|
+
const { detectFramework } = await import("./frameworks-Y-n3NUuG.js");
|
|
773
|
+
const { readPackageJson } = await import("./project-Dht13sb1.js");
|
|
747
774
|
const detected = await detectFramework(cwd, await readPackageJson(cwd));
|
|
748
775
|
return {
|
|
749
776
|
...await sourceLookups(cwd, audits),
|
|
@@ -756,13 +783,13 @@ async function fromTheProject(audits, options) {
|
|
|
756
783
|
* report it always got, with no source named.
|
|
757
784
|
*/
|
|
758
785
|
async function sourceLookups(cwd, audits) {
|
|
759
|
-
const { buildRouteMap, sourceFor } = await import("./routes-
|
|
786
|
+
const { buildRouteMap, sourceFor } = await import("./routes-BpQeBDmM.js");
|
|
760
787
|
const routes = await buildRouteMap(cwd);
|
|
761
788
|
if (!hasElementsToAttribute(audits)) return {
|
|
762
789
|
sourceFor: (page) => sourceFor(routes, page),
|
|
763
790
|
componentFor: () => void 0
|
|
764
791
|
};
|
|
765
|
-
const { buildComponentIndex, componentFor } = await import("./component-
|
|
792
|
+
const { buildComponentIndex, componentFor } = await import("./component-CgbeRgJa.js");
|
|
766
793
|
const components = await buildComponentIndex(cwd);
|
|
767
794
|
return {
|
|
768
795
|
sourceFor: (page) => sourceFor(routes, page),
|
|
@@ -773,5 +800,4 @@ async function sourceLookups(cwd, audits) {
|
|
|
773
800
|
function hasElementsToAttribute(audits) {
|
|
774
801
|
return audits.some((audit) => audit.violations.length > 0 || (audit.accepted?.length ?? 0) > 0);
|
|
775
802
|
}
|
|
776
|
-
//#endregion
|
|
777
803
|
export { runAuditCommand as n, OUTPUT_FORMATS as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as runAuditCommand } from "./audit-DbqNIrt6.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as nullable, d as optional, h as string, l as number, m as safeParse, o as isoDate, t as array, u as object, y as withDefault } from "./schema-
|
|
2
|
-
import {
|
|
3
|
-
import { t as elementFingerprint } from "./fingerprint-
|
|
4
|
-
import { s as findingElements } from "./result-
|
|
1
|
+
import { c as nullable, d as optional, h as string, l as number, m as safeParse, o as isoDate, t as array, u as object, y as withDefault } from "./schema-DfC-Ww1w.js";
|
|
2
|
+
import { o as isoDate$1 } from "./text-CISDPU49.js";
|
|
3
|
+
import { t as elementFingerprint } from "./fingerprint-CcoQ1WxQ.js";
|
|
4
|
+
import { s as findingElements } from "./result-g8dGsrcv.js";
|
|
5
5
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
/** Default filename, used by the CLI when no path is given. */
|
|
@@ -194,5 +194,4 @@ function key(page, ruleId, fingerprint) {
|
|
|
194
194
|
function byEntry(a, b) {
|
|
195
195
|
return a.page.localeCompare(b.page) || a.ruleId.localeCompare(b.ruleId) || a.fingerprint.localeCompare(b.fingerprint);
|
|
196
196
|
}
|
|
197
|
-
//#endregion
|
|
198
197
|
export { pruneBaseline as a, writeBaseline as c, buildBaseline as i, DEFAULT_BASELINE_FILE as n, readBaseline as o, applyBaseline as r, serialiseBaseline as s, BaselineError as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as runBaselineCommand } from "./baseline-DvdsFTQy.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as BaselineError, n as DEFAULT_BASELINE_FILE, r as applyBaseline, o as readBaseline } from "./baseline-CKElWbx4.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { l as note, o as fail, s as failWith, t as advise, u as runEngine } from "./command-
|
|
4
|
-
import { t as resolvePages } from "./pages-
|
|
1
|
+
import { a as pruneBaseline, c as writeBaseline, i as buildBaseline, o as readBaseline, r as applyBaseline, t as BaselineError } from "./baseline-CKElWbx4.js";
|
|
2
|
+
import { n as count } from "./text-CISDPU49.js";
|
|
3
|
+
import { l as note, o as fail, s as failWith, t as advise, u as runEngine } from "./command-C8ZFvcc1.js";
|
|
4
|
+
import { t as resolvePages } from "./pages-CCP1WfYe.js";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
|
|
6
|
+
// src/cli/baseline.ts
|
|
7
7
|
/**
|
|
8
8
|
* `eaa-kit baseline [dir]`.
|
|
9
9
|
*
|
|
@@ -123,5 +123,4 @@ async function prune(audits, target, cwd) {
|
|
|
123
123
|
exitCode: 0
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
//#endregion
|
|
127
126
|
export { runBaselineCommand as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as nullable, d as optional, h as string, i as enumeration, l as number, m as safeParse, t as array, u as object, y as withDefault } from "./schema-
|
|
2
|
-
import {
|
|
1
|
+
import { c as nullable, d as optional, h as string, i as enumeration, l as number, m as safeParse, t as array, u as object, y as withDefault } from "./schema-DfC-Ww1w.js";
|
|
2
|
+
import { o as isoDate } from "./text-CISDPU49.js";
|
|
3
3
|
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { createHash } from "node:crypto";
|
|
5
|
+
import { createHash, scryptSync } from "node:crypto";
|
|
6
6
|
const MANIFEST_FILE = "manifest.json";
|
|
7
7
|
const outcomeSchema = object({
|
|
8
8
|
ruleId: string(),
|
|
@@ -86,10 +86,30 @@ function inputsKey(inputs) {
|
|
|
86
86
|
`viewport=${inputs.viewport ? `${inputs.viewport.width}x${inputs.viewport.height}` : ""}`,
|
|
87
87
|
`baseUrl=${inputs.baseUrl ?? ""}`,
|
|
88
88
|
`timeout=${inputs.timeoutMs ?? ""}`,
|
|
89
|
-
`headers=${
|
|
89
|
+
`headers=${headersDigest(headers)}`
|
|
90
90
|
].join("\n")).digest("hex");
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
+
* The credentials, as something that changes when they do and that nobody
|
|
94
|
+
* can work backwards from.
|
|
95
|
+
*
|
|
96
|
+
* A fast hash is not that. The cache directory is meant to be kept between CI
|
|
97
|
+
* runs, and with everything else in the key guessable, a SHA-256 of
|
|
98
|
+
* `authorization=Basic …` lets whoever can read the cache try billions of
|
|
99
|
+
* passwords a second until one matches. scrypt makes each guess cost what one
|
|
100
|
+
* run pays once, tens of milliseconds. No headers is the ordinary case and
|
|
101
|
+
* keeps the old digest, so existing caches stay valid.
|
|
102
|
+
*/
|
|
103
|
+
function headersDigest(headers) {
|
|
104
|
+
if (headers === "") return createHash("sha256").update("").digest("hex");
|
|
105
|
+
return scryptSync(headers, "eaa-kit cache: request headers", 32, {
|
|
106
|
+
N: 2 ** 15,
|
|
107
|
+
r: 8,
|
|
108
|
+
p: 1,
|
|
109
|
+
maxmem: 67108864
|
|
110
|
+
}).toString("hex");
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
93
113
|
* Open the cache for a run, discarding it if anything about the run changed.
|
|
94
114
|
*
|
|
95
115
|
* Everything is read up front and held in memory: an audit asks about every
|
|
@@ -215,5 +235,4 @@ function fromEntry(entry, page, context) {
|
|
|
215
235
|
reused: { on: entry.cachedOn }
|
|
216
236
|
};
|
|
217
237
|
}
|
|
218
|
-
//#endregion
|
|
219
238
|
export { fromEntry, openCache };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
1
|
+
import "./review-BGjTBFvd.js";
|
|
2
|
+
import { n as count } from "./text-CISDPU49.js";
|
|
3
|
+
import { a as emitDocument, l as note, s as failWith } from "./command-C8ZFvcc1.js";
|
|
4
4
|
import { access } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
|
|
6
|
+
// src/cli/checklist.ts
|
|
7
7
|
async function runChecklistCommand(options = {}) {
|
|
8
8
|
const cwd = options.cwd ?? process.cwd();
|
|
9
9
|
const recordPath = options.record ?? "eaa-review.json";
|
|
10
|
-
const { WCAG22_AA_CRITERIA } = await import("./coverage-
|
|
11
|
-
const { answeredCount, blankReview, readReview, ReviewError, writeReview } = await import("./review-
|
|
10
|
+
const { WCAG22_AA_CRITERIA } = await import("./coverage-B9_6yv_8.js");
|
|
11
|
+
const { answeredCount, blankReview, readReview, ReviewError, writeReview } = await import("./review-iheEjp7_.js");
|
|
12
12
|
let existing;
|
|
13
13
|
try {
|
|
14
14
|
existing = await readReview(recordPath, cwd);
|
|
@@ -23,7 +23,7 @@ async function runChecklistCommand(options = {}) {
|
|
|
23
23
|
if (options.reviewedBy !== void 0) record.reviewedBy = options.reviewedBy;
|
|
24
24
|
await writeReview(recordPath, record, cwd);
|
|
25
25
|
note(existing === void 0 ? `Review record written to ${recordPath}` : `Review record updated at ${recordPath}: ${count(answeredCount(record), "criterion")} already answered`);
|
|
26
|
-
const { buildWorksheet } = await import("./worksheet-
|
|
26
|
+
const { buildWorksheet } = await import("./worksheet-CcBo9G7s.js");
|
|
27
27
|
await emitDocument(buildWorksheet({
|
|
28
28
|
recordPath,
|
|
29
29
|
review: record
|
|
@@ -40,5 +40,4 @@ async function exists(target) {
|
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { runChecklistCommand };
|
package/dist/cli/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as count, t as collapse } from "../text-
|
|
8
|
-
import { t as TOOL_VERSION } from "../version-
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
2
|
+
import { n as DEFAULT_BASELINE_FILE } from "../baseline-CKElWbx4.js";
|
|
3
|
+
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-C8ZFvcc1.js";
|
|
4
|
+
import { c as meetsThreshold, n as IMPACT_LEVELS, o as impactRank, s as isImpactLevel, t as DEFAULT_FAIL_ON } from "../impact-BGlJ6j0Y.js";
|
|
5
|
+
import { t as DEFAULT_REVIEW_FILE } from "../review-BGjTBFvd.js";
|
|
6
|
+
import { i as ConfigError, o as REDIRECT_MODES, r as COUNTRIES, s as STATEMENT_LOCALES } from "../define-BdTPIfqE.js";
|
|
7
|
+
import { a as isCalendarDate, n as count, t as collapse } from "../text-CISDPU49.js";
|
|
8
|
+
import { t as TOOL_VERSION } from "../version-C8aJm8YJ.js";
|
|
9
|
+
import { n as runAuditCommand, t as OUTPUT_FORMATS } from "../audit-DbqNIrt6.js";
|
|
10
|
+
import { t as runBaselineCommand } from "../baseline-DvdsFTQy.js";
|
|
11
|
+
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-DfC-Ww1w.js";
|
|
12
|
+
import { t as elementFingerprint } from "../fingerprint-CcoQ1WxQ.js";
|
|
13
|
+
import { t as CI_HOSTS } from "../hosts-B48qR6Vt.js";
|
|
14
|
+
import { i as loadConfig } from "../load-C3eFEdoH.js";
|
|
15
|
+
import { c as StatementError, i as readAuditReport, o as checkStatementEvidence, s as refuses, t as renderStatement } from "../render-ky8cm4QF.js";
|
|
15
16
|
import { enableCompileCache } from "node:module";
|
|
16
17
|
import { readFile } from "node:fs/promises";
|
|
17
18
|
import path from "node:path";
|
|
@@ -184,8 +185,7 @@ async function readReport(file, cwd = process.cwd()) {
|
|
|
184
185
|
});
|
|
185
186
|
return result.data;
|
|
186
187
|
}
|
|
187
|
-
|
|
188
|
-
//#region src/cli/diff.ts
|
|
188
|
+
// src/cli/diff.ts
|
|
189
189
|
/**
|
|
190
190
|
* `eaa-kit diff <before.json> <after.json>`.
|
|
191
191
|
*
|
|
@@ -292,8 +292,7 @@ function entryLine(entry, c) {
|
|
|
292
292
|
const snippet = entry.html === "" ? "" : `\n ${c.dim(collapse(entry.html, MAX_SNIPPET))}`;
|
|
293
293
|
return ` ${c.bold(entry.ruleId)} ${c.dim(`(${impact})`)} — ${entry.help}\n ${where}${snippet}`;
|
|
294
294
|
}
|
|
295
|
-
|
|
296
|
-
//#region src/cli/statement.ts
|
|
295
|
+
// src/cli/statement.ts
|
|
297
296
|
/** Markdown for a content directory, HTML for dropping straight onto a site. */
|
|
298
297
|
const STATEMENT_FORMATS = ["markdown", "html"];
|
|
299
298
|
/**
|
|
@@ -313,7 +312,7 @@ async function runStatementCommand(options = {}) {
|
|
|
313
312
|
if (options.audit) audit = await readAuditReport(options.audit, options.cwd ?? process.cwd());
|
|
314
313
|
let review;
|
|
315
314
|
if (options.review) {
|
|
316
|
-
const { readReview } = await import("../review-
|
|
315
|
+
const { readReview } = await import("../review-iheEjp7_.js");
|
|
317
316
|
review = await readReview(options.review, options.cwd ?? process.cwd());
|
|
318
317
|
}
|
|
319
318
|
const problems = checkStatementEvidence({
|
|
@@ -332,7 +331,8 @@ async function runStatementCommand(options = {}) {
|
|
|
332
331
|
...options.locale ? { locale: options.locale } : {},
|
|
333
332
|
...options.country ? { country: options.country } : {},
|
|
334
333
|
...audit ? { audit } : {},
|
|
335
|
-
...review ? { review } : {}
|
|
334
|
+
...review ? { review } : {},
|
|
335
|
+
...options.date ? { today: options.date } : {}
|
|
336
336
|
});
|
|
337
337
|
note(`Statement for ${config.site.url} from ${path.basename(configPath)} (${statement.template}, ${format})`);
|
|
338
338
|
if (audit) {
|
|
@@ -350,7 +350,7 @@ async function runStatementCommand(options = {}) {
|
|
|
350
350
|
exitCode: 0
|
|
351
351
|
};
|
|
352
352
|
} catch (cause) {
|
|
353
|
-
const { ReviewError } = await import("../review-
|
|
353
|
+
const { ReviewError } = await import("../review-iheEjp7_.js");
|
|
354
354
|
if (cause instanceof ConfigError || cause instanceof StatementError || cause instanceof ReviewError) {
|
|
355
355
|
fail(cause.message);
|
|
356
356
|
if (cause instanceof ConfigError) for (const issue of cause.issues) note(` ${issue}`);
|
|
@@ -372,8 +372,7 @@ async function runStatementCommand(options = {}) {
|
|
|
372
372
|
function formatFor(output) {
|
|
373
373
|
return output && /\.html?$/i.test(output) ? "html" : "markdown";
|
|
374
374
|
}
|
|
375
|
-
|
|
376
|
-
//#region src/cli/index.ts
|
|
375
|
+
// src/cli/index.ts
|
|
377
376
|
/**
|
|
378
377
|
* Reuse the compiled form of this tool and its dependencies between runs.
|
|
379
378
|
*
|
|
@@ -420,12 +419,13 @@ function wholeNumber(min) {
|
|
|
420
419
|
};
|
|
421
420
|
}
|
|
422
421
|
function parseDate(value) {
|
|
423
|
-
if (
|
|
422
|
+
if (!isCalendarDate(value)) throw new InvalidArgumentError("expected an ISO date, e.g. 2026-12-31");
|
|
424
423
|
return value;
|
|
425
424
|
}
|
|
426
425
|
const parseLocale = oneOf(STATEMENT_LOCALES);
|
|
427
426
|
const parseCountry = oneOf(COUNTRIES, (value) => value.toUpperCase());
|
|
428
427
|
const parseStatementFormat = oneOf(STATEMENT_FORMATS);
|
|
428
|
+
const parseCiHost = oneOf(CI_HOSTS, (value) => value.toLowerCase());
|
|
429
429
|
const parseImpact = oneOf(IMPACT_LEVELS);
|
|
430
430
|
const parseFormat = oneOf(OUTPUT_FORMATS);
|
|
431
431
|
const parsePositive = wholeNumber(1);
|
|
@@ -458,7 +458,7 @@ function parseBasicAuth(value) {
|
|
|
458
458
|
const program = new Command();
|
|
459
459
|
program.exitOverride();
|
|
460
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 }) => {
|
|
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("--summary <path>", "also write a Markdown summary of what this run found, e.g. to $GITHUB_STEP_SUMMARY").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 }) => {
|
|
462
462
|
const defaults = await auditDefaults({ ...flags.config ? { config: flags.config } : {} });
|
|
463
463
|
const invocation = auditInvocation(dir, defaults, flags);
|
|
464
464
|
if (!watch) {
|
|
@@ -474,7 +474,7 @@ program.command("audit").description("Audit built HTML against WCAG 2.2 AA").arg
|
|
|
474
474
|
process.exitCode = 2;
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
477
|
-
const { watchAudit } = await import("../watch-
|
|
477
|
+
const { watchAudit } = await import("../watch-CefxwMsZ.js");
|
|
478
478
|
process.exitCode = await watchAudit({
|
|
479
479
|
run: (directory) => runAuditCommand(directory, invocation.options),
|
|
480
480
|
directory: invocation.dir,
|
|
@@ -489,29 +489,47 @@ program.command("baseline").description("Record the violations a build already h
|
|
|
489
489
|
process.exitCode = exitCode;
|
|
490
490
|
});
|
|
491
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) => {
|
|
492
|
-
const { runChecklistCommand } = await import("../checklist-
|
|
492
|
+
const { runChecklistCommand } = await import("../checklist-CA0Ri71Z.js");
|
|
493
493
|
const { exitCode } = await runChecklistCommand(flags);
|
|
494
494
|
process.exitCode = exitCode;
|
|
495
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-
|
|
498
|
-
|
|
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").option("--date <yyyy-mm-dd>", "list the authorities as of this day (default: today)", parseDate).action(async (flags) => {
|
|
497
|
+
const { formatCountries } = await import("../countries-CCqog6dy.js");
|
|
498
|
+
const { date, ...rest } = flags;
|
|
499
|
+
process.stdout.write(formatCountries({
|
|
500
|
+
...rest,
|
|
501
|
+
...date ? { today: date } : {}
|
|
502
|
+
}));
|
|
503
|
+
});
|
|
504
|
+
program.command("detect").description("Say what an audit here would do and why, without building or starting anything").argument("[dir]", "the project to look at (default: this directory)").option("--json", "print it as JSON, for tools and bug reports").action(async (dir, flags) => {
|
|
505
|
+
const { runDetectCommand } = await import("../detect-DnFHXpWh.js");
|
|
506
|
+
process.stdout.write(await runDetectCommand(dir, flags));
|
|
507
|
+
});
|
|
508
|
+
program.command("doctor").description("Check everything this needs to work here, and say how to fix what is missing").argument("[dir]", "the project to check (default: this directory)").action(async (dir) => {
|
|
509
|
+
const { formatDoctor, runDoctor } = await import("../doctor-q8IebwAb.js");
|
|
510
|
+
const { resolve } = await import("node:path");
|
|
511
|
+
const result = await runDoctor(resolve(dir ?? "."));
|
|
512
|
+
process.stdout.write(formatDoctor(result));
|
|
513
|
+
process.exitCode = result.exitCode;
|
|
499
514
|
});
|
|
500
515
|
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) => {
|
|
501
516
|
const { exitCode } = await runDiffCommand(before, after, flags);
|
|
502
517
|
process.exitCode = exitCode;
|
|
503
518
|
});
|
|
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
|
|
505
|
-
const { ci, baseline, ...rest } = flags;
|
|
506
|
-
const
|
|
519
|
+
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 a CI pipeline").option("--ci <host>", `CI to write a pipeline for (${CI_HOSTS.join("|")}; default: from the git remote)`, parseCiHost).option("--no-baseline", "never offer to record a baseline").action(async (flags) => {
|
|
520
|
+
const { ci: ciFlag, baseline, ...rest } = flags;
|
|
521
|
+
const ci = ciFlag !== false;
|
|
522
|
+
const ciHost = typeof ciFlag === "string" ? ciFlag : void 0;
|
|
523
|
+
const { runInitCommand } = await import("../init-3Ti3ao5Z.js");
|
|
507
524
|
const { exitCode } = await runInitCommand({
|
|
508
525
|
...rest,
|
|
509
526
|
...ci ? {} : { ci: false },
|
|
527
|
+
...ciHost === void 0 ? {} : { ciHost },
|
|
510
528
|
...baseline ? {} : { baseline: false }
|
|
511
529
|
});
|
|
512
530
|
process.exitCode = exitCode;
|
|
513
531
|
});
|
|
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) => {
|
|
532
|
+
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").option("--date <yyyy-mm-dd>", "generate as of this day, which decides a supervisor the law has scheduled to change (default: today)", parseDate).action(async (flags) => {
|
|
515
533
|
const { lang, ...options } = flags;
|
|
516
534
|
const { exitCode } = await runStatementCommand({
|
|
517
535
|
...options,
|
|
@@ -521,7 +539,7 @@ program.command("statement").description("Generate an EU accessibility statement
|
|
|
521
539
|
});
|
|
522
540
|
try {
|
|
523
541
|
if (process.argv.length <= 2) {
|
|
524
|
-
const { runFirstRun } = await import("../start-
|
|
542
|
+
const { runFirstRun } = await import("../start-bdanSxZr.js");
|
|
525
543
|
process.exitCode = (await runFirstRun()).exitCode;
|
|
526
544
|
} else await program.parseAsync(process.argv);
|
|
527
545
|
} catch (cause) {
|
|
@@ -554,5 +572,4 @@ try {
|
|
|
554
572
|
process.exitCode = 2;
|
|
555
573
|
}
|
|
556
574
|
}
|
|
557
|
-
//#endregion
|
|
558
575
|
export {};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import { i as toPosix, t as exists } from "./fs-
|
|
1
|
+
import { i as toPosix, t as exists } from "./fs-tPD5r0wY.js";
|
|
2
2
|
import { readFile, stat } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { glob } from "tinyglobby";
|
|
5
|
-
|
|
5
|
+
// src/audit/collect.ts
|
|
6
6
|
/** Every HTML document a static build is expected to emit. */
|
|
7
7
|
const DEFAULT_INCLUDE = ["**/*.html", "**/*.htm"];
|
|
8
8
|
/** Vendored and tooling directories are never part of the shipped site. */
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Never pages of the site. `storybook-static/` is Storybook's build: a
|
|
11
|
+
* catalogue of components out of context, whose findings would be reported
|
|
12
|
+
* against the site as though a visitor could reach them.
|
|
13
|
+
*/
|
|
14
|
+
const DEFAULT_EXCLUDE = [
|
|
15
|
+
"**/node_modules/**",
|
|
16
|
+
"**/.git/**",
|
|
17
|
+
"**/storybook-static/**"
|
|
18
|
+
];
|
|
10
19
|
/** Number of files read in parallel; keeps large builds under the fd limit. */
|
|
11
20
|
const READ_CONCURRENCY = 24;
|
|
12
21
|
/** A UTF-8 byte-order mark is not markup, and jsdom treats it as text. */
|
|
@@ -113,8 +122,8 @@ async function readPage(root, relativePath, onUnreadable, maxBytes) {
|
|
|
113
122
|
*/
|
|
114
123
|
async function emptyDirectoryHint(dir, cwd = process.cwd()) {
|
|
115
124
|
const head = await exists(dir, cwd) ? `${dir} holds no HTML files.` : `${dir} does not exist.`;
|
|
116
|
-
const { detectFramework } = await import("./frameworks-
|
|
117
|
-
const { readPackageJson } = await import("./project-
|
|
125
|
+
const { detectFramework } = await import("./frameworks-Y-n3NUuG.js");
|
|
126
|
+
const { readPackageJson } = await import("./project-Dht13sb1.js");
|
|
118
127
|
const detected = await detectFramework(cwd, await readPackageJson(cwd));
|
|
119
128
|
if (detected !== void 0) return frameworkAdvice(head, detected, cwd, dir);
|
|
120
129
|
return await siblingAdvice(head, cwd, dir) ?? generic(head);
|
|
@@ -137,7 +146,7 @@ async function frameworkAdvice(head, detected, cwd, dir) {
|
|
|
137
146
|
}
|
|
138
147
|
/** Naming a build directory that is actually there beats listing the usual ones. */
|
|
139
148
|
async function siblingAdvice(head, cwd, dir) {
|
|
140
|
-
const { FALLBACK_OUTPUTS } = await import("./frameworks-
|
|
149
|
+
const { FALLBACK_OUTPUTS } = await import("./frameworks-Y-n3NUuG.js");
|
|
141
150
|
const given = dir.replace(/^\.\//, "");
|
|
142
151
|
const others = (await Promise.all(FALLBACK_OUTPUTS.map(async (name) => name !== given && await exists(name, cwd) ? name : void 0))).filter((name) => name !== void 0);
|
|
143
152
|
if (others.length === 0) return void 0;
|
|
@@ -161,5 +170,4 @@ function article(name) {
|
|
|
161
170
|
function megabytes(bytes) {
|
|
162
171
|
return (bytes / 1048576).toFixed(1).replace(/\.0$/, "");
|
|
163
172
|
}
|
|
164
|
-
|
|
165
|
-
export { stripBom as a, holdsHtml as i, collectPages as n, emptyDirectoryHint as r, BuildDirectoryError as t };
|
|
173
|
+
export { holdsHtml as a, emptyDirectoryHint as i, DEFAULT_EXCLUDE as n, stripBom as o, collectPages as r, BuildDirectoryError as t };
|