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.
- package/README.md +2 -1
- package/dist/astro/index.d.ts +7 -34
- package/dist/astro/index.js +6 -26
- package/dist/audit/runners/worker.js +1 -1
- package/dist/audit-CuG2hYyo.js +2 -0
- package/dist/audit-DcL73mOC.js +635 -0
- package/dist/{baseline-CV_3lbER.js → baseline-CuKFq4IF.js} +1 -1
- package/dist/{baseline-CgBmzFTr.js → baseline-s9F3fXTN.js} +16 -26
- package/dist/cli/index.js +80 -143
- package/dist/collect-BkAQ0viT.js +123 -0
- package/dist/command-Dxpa00Ha.js +77 -0
- package/dist/component-7kEBjv_y.js +111 -0
- package/dist/{crawl-CtJbMNNb.js → crawl-Oxt2Gaqo.js} +13 -23
- package/dist/frameworks-BYa3tULg.js +243 -0
- package/dist/frameworks-DaDqrJOw.js +2 -0
- package/dist/fs-BmPtmFke.js +40 -0
- package/dist/{html-BLEuzep6.js → html-DKiI_3gs.js} +167 -86
- package/dist/{impact-DvgBjupx.js → impact-YdoOtFqm.js} +15 -1
- package/dist/index.js +2 -2
- package/dist/{init-DRKIdpK1.js → init-DiLiYvN1.js} +13 -10
- package/dist/{jsdom-BEu6Ra_2.js → jsdom-BjpF-2V-.js} +2 -7
- package/dist/jsdom-X4KYfTp8.js +3 -0
- package/dist/json-B0Y7rNjt.js +2 -0
- package/dist/{json-C9xS1PNC.js → json-Cnv9nd6U.js} +13 -21
- package/dist/{load-sCkKsvGQ.js → load-UYXLqGV9.js} +2 -8
- package/dist/manual-Vz-oX1I_.js +239 -0
- package/dist/{playwright-DSRnXmcd.js → playwright-DYFsGUNd.js} +70 -23
- package/dist/{pool-DixLeu8L.js → pool-BWkWZiJW.js} +4 -12
- package/dist/{project-CufCqIE2.js → project-DW08TseF.js} +8 -21
- package/dist/{render-BO0nVrrZ.js → render-DI_aCnAZ.js} +7 -15
- package/dist/{result-2aZPfM8w.js → result-DLxd2Eip.js} +38 -1
- package/dist/{routes-BxbSZKXC.js → routes-C2Cgf6Ko.js} +4 -8
- package/dist/run-BMASMmwO.d.ts +45 -0
- package/dist/run-BW6CVuND.js +36 -0
- package/dist/{sarif-eSCuI0eX.js → sarif-DB3WG7T9.js} +11 -33
- package/dist/text-BFmNtMsV.js +43 -0
- package/dist/vite/index.d.ts +39 -0
- package/dist/vite/index.js +40 -0
- package/package.json +8 -3
- package/dist/audit-B2dIKpJ5.js +0 -2
- package/dist/audit-DXpKkXsC.js +0 -950
- package/dist/escape-Dm1o_RAk.js +0 -21
- 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
|
|
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
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
}
|
package/dist/astro/index.js
CHANGED
|
@@ -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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
}
|