eaa-kit 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +51 -4
  2. package/dist/astro/index.d.ts +7 -34
  3. package/dist/astro/index.js +6 -26
  4. package/dist/audit/runners/worker.js +1 -1
  5. package/dist/audit-CPoZMXGM.js +779 -0
  6. package/dist/audit-CpXH2Mk8.js +2 -0
  7. package/dist/{baseline-CV_3lbER.js → baseline-22Y1NWxM.js} +1 -1
  8. package/dist/{baseline-CgBmzFTr.js → baseline-DB9CZGnV.js} +17 -27
  9. package/dist/cli/index.js +336 -142
  10. package/dist/collect-CFM8gEVv.js +134 -0
  11. package/dist/command-D8l_oYbV.js +77 -0
  12. package/dist/component-C3GL1Mnu.js +146 -0
  13. package/dist/component-DKd3EHOg.js +2 -0
  14. package/dist/coverage-B4IBKMO8.js +521 -0
  15. package/dist/{crawl-CtJbMNNb.js → crawl-BiI1Lau_.js} +13 -23
  16. package/dist/eleventy/index.d.ts +28 -0
  17. package/dist/eleventy/index.js +19 -0
  18. package/dist/frameworks-B4ClIJgE.js +314 -0
  19. package/dist/frameworks-etFg_O8K.js +2 -0
  20. package/dist/fs-BmPtmFke.js +40 -0
  21. package/dist/html-BGTO3ypW.js +543 -0
  22. package/dist/{impact-DvgBjupx.js → impact-DZt2oBCP.js} +15 -1
  23. package/dist/index.js +2 -2
  24. package/dist/{init-DRKIdpK1.js → init-DIWDE35F.js} +13 -10
  25. package/dist/jsdom-4IMzv0eE.js +3 -0
  26. package/dist/jsdom-DCpGSLfW.js +81 -0
  27. package/dist/{json-C9xS1PNC.js → json-DjEvy1nX.js} +19 -22
  28. package/dist/json-QQuFIw1W.js +2 -0
  29. package/dist/{load-sCkKsvGQ.js → load-5wRGLvub.js} +3 -9
  30. package/dist/nuxt/index.d.ts +35 -0
  31. package/dist/nuxt/index.js +23 -0
  32. package/dist/{playwright-DSRnXmcd.js → playwright-BWniOain.js} +70 -23
  33. package/dist/{pool-DixLeu8L.js → pool-BMevaLWD.js} +4 -12
  34. package/dist/{project-CufCqIE2.js → project-CzOnkLH6.js} +14 -21
  35. package/dist/project-MFrXcw1M.js +2 -0
  36. package/dist/remediation-Dtowi2EC.js +321 -0
  37. package/dist/{render-BO0nVrrZ.js → render-DrvXRCEn.js} +8 -16
  38. package/dist/{result-2aZPfM8w.js → result-DoamKFsp.js} +115 -1
  39. package/dist/routes-CmdRUuOs.js +265 -0
  40. package/dist/run-BMASMmwO.d.ts +45 -0
  41. package/dist/run-DB34BSOZ.js +53 -0
  42. package/dist/{sarif-eSCuI0eX.js → sarif-SR3_lLYd.js} +22 -36
  43. package/dist/{schema-CMZ8ItGk.js → schema-is6CGX2D.js} +4 -1
  44. package/dist/text-CKKpzkYM.js +43 -0
  45. package/dist/vite/index.d.ts +39 -0
  46. package/dist/vite/index.js +40 -0
  47. package/dist/webpack/index.d.ts +33 -0
  48. package/dist/webpack/index.js +20 -0
  49. package/package.json +36 -9
  50. package/dist/audit-B2dIKpJ5.js +0 -2
  51. package/dist/audit-DXpKkXsC.js +0 -950
  52. package/dist/escape-Dm1o_RAk.js +0 -21
  53. package/dist/html-BLEuzep6.js +0 -337
  54. package/dist/jsdom-BEu6Ra_2.js +0 -163
  55. package/dist/jsdom-C6dIyaxN.js +0 -3
  56. package/dist/routes-BxbSZKXC.js +0 -123
package/README.md CHANGED
@@ -9,6 +9,7 @@ in Austria.
9
9
 
10
10
  ```bash
11
11
  npx eaa-kit audit # WCAG 2.2 AA report; finds your build itself
12
+ npx eaa-kit diff a.json b.json # what a change made worse, and what it fixed
12
13
  npx eaa-kit init # write an eaa.config.json
13
14
  npx eaa-kit statement # Barrierefreiheitserklärung from that config
14
15
  ```
@@ -62,12 +63,54 @@ eaa-kit baseline ./dist
62
63
  eaa-kit audit ./dist --baseline eaa-baseline.json
63
64
  ```
64
65
 
66
+ **Says what a change did.** Two reports, and the difference between them: what is new, what
67
+ was fixed, and what the later run never looked at — which is kept apart, because a
68
+ violation missing from a run that stopped early was not fixed by anybody.
69
+
70
+ ```bash
71
+ eaa-kit diff before.json after.json
72
+ ```
73
+
74
+ **Says what to do about it.** Not "images must have alternative text" and a link — who the
75
+ barrier stops, what to change, and the corrected form of *your* markup, in your framework's
76
+ idiom where that differs. Deterministic and offline: no model, no API key, nothing that
77
+ could invent a fix that looks right and is not.
78
+
79
+ ```
80
+ ✗ image-alt critical, WCAG 1.1.1
81
+ A screen reader announces this image by its filename, or skips it entirely.
82
+ Fix: Add alt text describing what the image conveys…
83
+ → <img src="/assets/logo.svg" alt="What this image shows">
84
+ written in src/components/Header.astro:12
85
+ ```
86
+
87
+ **Says how much of WCAG it could reach.** WCAG 2.2 has 55 success criteria at Levels A and
88
+ AA. axe-core has rules touching 23 of them. Every run says so, and `--coverage` lists all
89
+ 55 with what this run reached on each — never as a percentage, because most of WCAG cannot
90
+ be automated and a score would present that as a fact about your site.
91
+
92
+ **Says what it did not measure.** A crawl that stopped at its page limit, or could not
93
+ fetch forty URLs, no longer produces a report that looks like a complete one.
94
+
65
95
  **Reports in four shapes**: a console report for whoever ran it, JSON for other tools,
66
96
  SARIF for GitHub code scanning, and a self-contained HTML page for the client whose site
67
97
  it is.
68
98
 
69
- **Runs in your build**, as an [Astro integration](docs/integrations.md#astro-integration)
70
- or the bundled [GitHub Action](docs/integrations.md#github-actions).
99
+ **Runs in your build**: a [Vite plugin](docs/integrations.md#vite-plugin) covering SvelteKit
100
+ and Remix too, and integrations for
101
+ [Astro](docs/integrations.md#astro-integration),
102
+ [Nuxt](docs/integrations.md#nuxt-module),
103
+ [Eleventy](docs/integrations.md#eleventy-plugin) and
104
+ [webpack](docs/integrations.md#webpack-plugin) — or the bundled
105
+ [GitHub Action](docs/integrations.md#github-actions).
106
+
107
+ **Audits what a CMS serves.** WordPress, TYPO3, Craft, Laravel, Symfony, Rails and Django
108
+ write no HTML to disk, so eaa-kit names the command that gets the site running and audits
109
+ that instead — following the site's own sitemap, wherever it keeps it.
110
+
111
+ ```bash
112
+ eaa-kit audit --url http://localhost:8000 --sitemap /sitemap_index.xml
113
+ ```
71
114
 
72
115
  ## Documentation
73
116
 
@@ -76,8 +119,10 @@ or the bundled [GitHub Action](docs/integrations.md#github-actions).
76
119
  | [Auditing a build](docs/audit.md) | The `audit` command, both engines, exit codes, and what an automated run can and cannot tell you |
77
120
  | [The statement command](docs/statement.md) | The config file, the three countries, and filling a statement from audit results |
78
121
  | [Baselines](docs/baseline.md) | Adopting the tool on a site that already has violations |
122
+ | [Comparing two runs](docs/reports.md#comparing-two-runs) | The `diff` command, and what it refuses to call fixed |
123
+ | [Coverage of WCAG](docs/audit.md#how-much-of-wcag-a-run-reaches) | What an automated engine can reach at all, and what it cannot |
79
124
  | [Report formats](docs/reports.md) | The JSON contract, SARIF, and the HTML report |
80
- | [Integrations](docs/integrations.md) | Astro and GitHub Actions |
125
+ | [Integrations](docs/integrations.md) | The build plugins, the GitHub Action, and the two builders that get a command instead |
81
126
 
82
127
  Complete generated output for every format is checked in under [examples/](examples).
83
128
 
@@ -89,7 +134,9 @@ The two things worth knowing before you rely on any of it:
89
134
  text is accurate, whether a page makes sense in reading order, or whether a form can
90
135
  actually be completed with a screen reader. A clean report means nothing was found by this
91
136
  engine, which is not the same as a site being accessible — and none of the four output
92
- formats will say otherwise on your behalf.
137
+ formats will say otherwise on your behalf. This is not a disclaimer the tool leaves you to
138
+ take on faith: it counts it. Of the 55 WCAG 2.2 A and AA criteria, 34 have no automated
139
+ rule at all, and every report says so.
93
140
 
94
141
  **The browserless engine cannot decide everything.** jsdom has no layout, so rules that
95
142
  depend on rendering — colour contrast, target size, computed overflow — cannot be
@@ -1,8 +1,4 @@
1
- import { t as ImpactLevel } from "../impact-EEB9ZXmC.js";
2
- //#region src/cli/audit.d.ts
3
- declare const OUTPUT_FORMATS: readonly ['console', 'json', 'sarif', 'html'];
4
- type OutputFormat = (typeof OUTPUT_FORMATS)[number];
5
- //#endregion
1
+ import { n as IntegrationOptions } from "../run-BMASMmwO.js";
6
2
  //#region src/astro/index.d.ts
7
3
  /**
8
4
  * An Astro integration that audits the build Astro just produced.
@@ -37,35 +33,12 @@ interface AstroIntegrationLike {
37
33
  'astro:build:done'?: (options: BuildDoneOptions) => void | Promise<void>;
38
34
  };
39
35
  }
40
- interface EaaKitIntegrationOptions {
41
- /** Lowest impact that fails the build. Defaults to 'serious'. */
42
- failOn?: ImpactLevel;
43
- /**
44
- * Whether a failing audit fails the build. Defaults to true.
45
- *
46
- * The CLI has no equivalent because a shell can ignore an exit code; a build
47
- * hook cannot. Turning this off is for the first week of adopting the tool on
48
- * an existing site — after that, a baseline is the honest way to go green,
49
- * because it records what is wrong instead of hiding it.
50
- */
51
- failBuild?: boolean;
52
- /** Skip the audit entirely. For turning it off by environment. */
53
- enabled?: boolean;
54
- include?: string[];
55
- exclude?: string[];
56
- /** Audit pages under their real site URL instead of file://. */
57
- baseUrl?: string;
58
- /** Audit in real Chromium. Needs the playwright peer. */
59
- browser?: boolean;
60
- /** Worker threads for the browserless engine. */
61
- concurrency?: number;
62
- /** Accept the violations recorded in this file; fail only on new ones. */
63
- baseline?: string;
64
- /** Write a report as well as printing one. */
65
- format?: OutputFormat;
66
- /** Where to write it. Required for `format` to do anything useful. */
67
- output?: string;
68
- }
36
+ /**
37
+ * The same options every build-time integration takes; see IntegrationOptions
38
+ * for what each one does. Aliased rather than restated so the Astro and Vite
39
+ * entries cannot drift apart.
40
+ */
41
+ type EaaKitIntegrationOptions = IntegrationOptions;
69
42
  declare class AstroAuditError extends Error {
70
43
  readonly name = "AstroAuditError";
71
44
  }
@@ -1,3 +1,4 @@
1
+ import { n as auditBuild, t as BuildAuditError } from "../run-DB34BSOZ.js";
1
2
  import { fileURLToPath } from "node:url";
2
3
  //#region src/astro/index.ts
3
4
  var AstroAuditError = class extends Error {
@@ -14,33 +15,12 @@ function eaaKit(options = {}) {
14
15
  return {
15
16
  name: "eaa-kit",
16
17
  hooks: { "astro:build:done": async ({ dir, logger }) => {
17
- if (options.enabled === false) {
18
- logger.info("skipped (enabled: false)");
19
- return;
18
+ try {
19
+ await auditBuild(fileURLToPath(dir), options, logger);
20
+ } catch (cause) {
21
+ if (cause instanceof BuildAuditError) throw new AstroAuditError(cause.message);
22
+ throw cause;
20
23
  }
21
- const { runAuditCommand } = await import("../audit-B2dIKpJ5.js");
22
- const { exitCode } = await runAuditCommand(fileURLToPath(dir), {
23
- ...options.failOn ? { failOn: options.failOn } : {},
24
- ...options.include ? { include: options.include } : {},
25
- ...options.exclude ? { exclude: options.exclude } : {},
26
- ...options.baseUrl ? { baseUrl: options.baseUrl } : {},
27
- ...options.browser ? { browser: true } : {},
28
- ...options.concurrency === void 0 ? {} : { concurrency: options.concurrency },
29
- ...options.baseline ? { baseline: options.baseline } : {},
30
- ...options.format ? { format: options.format } : {},
31
- ...options.output ? { output: options.output } : {}
32
- });
33
- if (exitCode === 0) {
34
- logger.info("no violations at or above the threshold");
35
- return;
36
- }
37
- const message = exitCode === 2 ? "the audit could not be completed, so this build was not checked" : "accessibility violations at or above the threshold";
38
- if (options.failBuild === false) {
39
- logger.warn(`${message} (failBuild: false, so the build continues)`);
40
- return;
41
- }
42
- logger.error(message);
43
- throw new AstroAuditError(`eaa-kit: ${message}`);
44
24
  } }
45
25
  };
46
26
  }
@@ -1,4 +1,4 @@
1
- import { n as auditPage } from "../../jsdom-BEu6Ra_2.js";
1
+ import { t as auditPage } from "../../jsdom-DCpGSLfW.js";
2
2
  import { parentPort, workerData } from "node:worker_threads";
3
3
  //#region src/audit/runners/worker.ts
4
4
  /**