eaa-kit 0.2.1 → 0.3.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 (43) hide show
  1. package/README.md +2 -1
  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-CuG2hYyo.js +2 -0
  6. package/dist/audit-DcL73mOC.js +635 -0
  7. package/dist/{baseline-CV_3lbER.js → baseline-CuKFq4IF.js} +1 -1
  8. package/dist/{baseline-CgBmzFTr.js → baseline-s9F3fXTN.js} +16 -26
  9. package/dist/cli/index.js +80 -143
  10. package/dist/collect-BkAQ0viT.js +123 -0
  11. package/dist/command-Dxpa00Ha.js +77 -0
  12. package/dist/component-7kEBjv_y.js +111 -0
  13. package/dist/{crawl-CtJbMNNb.js → crawl-Oxt2Gaqo.js} +13 -23
  14. package/dist/frameworks-BYa3tULg.js +243 -0
  15. package/dist/frameworks-DaDqrJOw.js +2 -0
  16. package/dist/fs-BmPtmFke.js +40 -0
  17. package/dist/{html-BLEuzep6.js → html-DKiI_3gs.js} +167 -86
  18. package/dist/{impact-DvgBjupx.js → impact-YdoOtFqm.js} +15 -1
  19. package/dist/index.js +2 -2
  20. package/dist/{init-DRKIdpK1.js → init-DiLiYvN1.js} +13 -10
  21. package/dist/{jsdom-BEu6Ra_2.js → jsdom-BjpF-2V-.js} +2 -7
  22. package/dist/jsdom-X4KYfTp8.js +3 -0
  23. package/dist/json-B0Y7rNjt.js +2 -0
  24. package/dist/{json-C9xS1PNC.js → json-Cnv9nd6U.js} +13 -21
  25. package/dist/{load-sCkKsvGQ.js → load-UYXLqGV9.js} +2 -8
  26. package/dist/manual-Vz-oX1I_.js +239 -0
  27. package/dist/{playwright-DSRnXmcd.js → playwright-DYFsGUNd.js} +70 -23
  28. package/dist/{pool-DixLeu8L.js → pool-BWkWZiJW.js} +4 -12
  29. package/dist/{project-CufCqIE2.js → project-DW08TseF.js} +8 -21
  30. package/dist/{render-BO0nVrrZ.js → render-DI_aCnAZ.js} +7 -15
  31. package/dist/{result-2aZPfM8w.js → result-DLxd2Eip.js} +38 -1
  32. package/dist/{routes-BxbSZKXC.js → routes-C2Cgf6Ko.js} +4 -8
  33. package/dist/run-BMASMmwO.d.ts +45 -0
  34. package/dist/run-BW6CVuND.js +36 -0
  35. package/dist/{sarif-eSCuI0eX.js → sarif-DB3WG7T9.js} +11 -33
  36. package/dist/text-BFmNtMsV.js +43 -0
  37. package/dist/vite/index.d.ts +39 -0
  38. package/dist/vite/index.js +40 -0
  39. package/package.json +8 -3
  40. package/dist/audit-B2dIKpJ5.js +0 -2
  41. package/dist/audit-DXpKkXsC.js +0 -950
  42. package/dist/escape-Dm1o_RAk.js +0 -21
  43. package/dist/jsdom-C6dIyaxN.js +0 -3
package/README.md CHANGED
@@ -66,7 +66,8 @@ eaa-kit audit ./dist --baseline eaa-baseline.json
66
66
  SARIF for GitHub code scanning, and a self-contained HTML page for the client whose site
67
67
  it is.
68
68
 
69
- **Runs in your build**, as an [Astro integration](docs/integrations.md#astro-integration)
69
+ **Runs in your build**, as a [Vite plugin](docs/integrations.md#vite-plugin) — covering
70
+ SvelteKit, Nuxt and Remix too — an [Astro integration](docs/integrations.md#astro-integration),
70
71
  or the bundled [GitHub Action](docs/integrations.md#github-actions).
71
72
 
72
73
  ## Documentation
@@ -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-BW6CVuND.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 { n as auditPage } from "../../jsdom-BjpF-2V-.js";
2
2
  import { parentPort, workerData } from "node:worker_threads";
3
3
  //#region src/audit/runners/worker.ts
4
4
  /**
@@ -0,0 +1,2 @@
1
+ import { n as runAuditCommand } from "./audit-DcL73mOC.js";
2
+ export { runAuditCommand };