aria-ease 6.2.0 → 6.2.1
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/bin/{audit-5JJ3XK46.js → audit-RM6TCZ5C.js} +17 -5
- package/bin/cli.cjs +33 -18
- package/bin/cli.js +17 -14
- package/dist/src/{Types.d-CBuuHF3d.d.cts → Types.d-CxWrr421.d.cts} +1 -1
- package/dist/src/{Types.d-CBuuHF3d.d.ts → Types.d-CxWrr421.d.ts} +1 -1
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/block/index.d.cts +1 -1
- package/dist/src/block/index.d.ts +1 -1
- package/dist/src/checkbox/index.d.cts +1 -1
- package/dist/src/checkbox/index.d.ts +1 -1
- package/dist/src/combobox/index.d.cts +1 -1
- package/dist/src/combobox/index.d.ts +1 -1
- package/dist/src/menu/index.d.cts +1 -1
- package/dist/src/menu/index.d.ts +1 -1
- package/dist/src/radio/index.d.cts +1 -1
- package/dist/src/radio/index.d.ts +1 -1
- package/dist/src/toggle/index.d.cts +1 -1
- package/dist/src/toggle/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,17 +3,26 @@ import "./chunk-I2KLQ2HA.js";
|
|
|
3
3
|
// src/utils/audit/src/audit/audit.ts
|
|
4
4
|
import AxeBuilder from "@axe-core/playwright";
|
|
5
5
|
import { chromium } from "playwright";
|
|
6
|
+
async function createAuditBrowser() {
|
|
7
|
+
return await chromium.launch({ headless: true });
|
|
8
|
+
}
|
|
6
9
|
async function runAudit(url, options) {
|
|
7
|
-
let browser;
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
+
let browser = options.browser;
|
|
11
|
+
let browserCreated = false;
|
|
12
|
+
const timeout = 6e4;
|
|
13
|
+
const waitUntil = "domcontentloaded";
|
|
10
14
|
try {
|
|
11
|
-
browser
|
|
15
|
+
if (!browser) {
|
|
16
|
+
browser = await chromium.launch({ headless: true });
|
|
17
|
+
browserCreated = true;
|
|
18
|
+
}
|
|
12
19
|
const context = await browser.newContext();
|
|
13
20
|
const page = await context.newPage();
|
|
14
21
|
await page.goto(url, { waitUntil, timeout });
|
|
15
22
|
const axe = new AxeBuilder({ page });
|
|
16
23
|
const axeResults = await axe.analyze();
|
|
24
|
+
await page.close();
|
|
25
|
+
await context.close();
|
|
17
26
|
return axeResults;
|
|
18
27
|
} catch (error) {
|
|
19
28
|
if (error instanceof Error) {
|
|
@@ -38,9 +47,12 @@ async function runAudit(url, options) {
|
|
|
38
47
|
}
|
|
39
48
|
throw error;
|
|
40
49
|
} finally {
|
|
41
|
-
if (browser
|
|
50
|
+
if (browser && browserCreated) {
|
|
51
|
+
await browser.close();
|
|
52
|
+
}
|
|
42
53
|
}
|
|
43
54
|
}
|
|
44
55
|
export {
|
|
56
|
+
createAuditBrowser,
|
|
45
57
|
runAudit
|
|
46
58
|
};
|
package/bin/cli.cjs
CHANGED
|
@@ -34,19 +34,29 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
// src/utils/audit/src/audit/audit.ts
|
|
35
35
|
var audit_exports = {};
|
|
36
36
|
__export(audit_exports, {
|
|
37
|
+
createAuditBrowser: () => createAuditBrowser,
|
|
37
38
|
runAudit: () => runAudit
|
|
38
39
|
});
|
|
40
|
+
async function createAuditBrowser() {
|
|
41
|
+
return await import_playwright2.chromium.launch({ headless: true });
|
|
42
|
+
}
|
|
39
43
|
async function runAudit(url, options) {
|
|
40
|
-
let browser;
|
|
41
|
-
|
|
42
|
-
const
|
|
44
|
+
let browser = options.browser;
|
|
45
|
+
let browserCreated = false;
|
|
46
|
+
const timeout = 6e4;
|
|
47
|
+
const waitUntil = "domcontentloaded";
|
|
43
48
|
try {
|
|
44
|
-
browser
|
|
49
|
+
if (!browser) {
|
|
50
|
+
browser = await import_playwright2.chromium.launch({ headless: true });
|
|
51
|
+
browserCreated = true;
|
|
52
|
+
}
|
|
45
53
|
const context = await browser.newContext();
|
|
46
54
|
const page = await context.newPage();
|
|
47
55
|
await page.goto(url, { waitUntil, timeout });
|
|
48
56
|
const axe2 = new import_playwright.default({ page });
|
|
49
57
|
const axeResults = await axe2.analyze();
|
|
58
|
+
await page.close();
|
|
59
|
+
await context.close();
|
|
50
60
|
return axeResults;
|
|
51
61
|
} catch (error) {
|
|
52
62
|
if (error instanceof Error) {
|
|
@@ -71,7 +81,9 @@ async function runAudit(url, options) {
|
|
|
71
81
|
}
|
|
72
82
|
throw error;
|
|
73
83
|
} finally {
|
|
74
|
-
if (browser
|
|
84
|
+
if (browser && browserCreated) {
|
|
85
|
+
await browser.close();
|
|
86
|
+
}
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
89
|
var import_playwright, import_playwright2;
|
|
@@ -1430,22 +1442,25 @@ program.command("audit").description("Run axe-core powered accessibility audit o
|
|
|
1430
1442
|
process.exit(1);
|
|
1431
1443
|
}
|
|
1432
1444
|
const allResults = [];
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1445
|
+
const { createAuditBrowser: createAuditBrowser2 } = await Promise.resolve().then(() => (init_audit(), audit_exports));
|
|
1446
|
+
const browser = await createAuditBrowser2();
|
|
1447
|
+
try {
|
|
1448
|
+
const auditOptions = { browser };
|
|
1449
|
+
for (const url of urls) {
|
|
1450
|
+
console.log(import_chalk.default.yellow(`\u{1F50E} Auditing: ${url}`));
|
|
1451
|
+
try {
|
|
1452
|
+
const result = await runAudit2(url, auditOptions);
|
|
1453
|
+
allResults.push({ url, result });
|
|
1454
|
+
console.log(import_chalk.default.green(`\u2705 Completed audit for ${url}
|
|
1443
1455
|
`));
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1456
|
+
} catch (error) {
|
|
1457
|
+
if (error instanceof Error && error.message) {
|
|
1458
|
+
console.log(import_chalk.default.red(`\u274C Failed auditing ${url}: ${error.message}`));
|
|
1459
|
+
}
|
|
1447
1460
|
}
|
|
1448
1461
|
}
|
|
1462
|
+
} finally {
|
|
1463
|
+
await browser.close();
|
|
1449
1464
|
}
|
|
1450
1465
|
const hasResults = allResults.some((r) => r.result && r.result.violations && r.result.violations.length > 0);
|
|
1451
1466
|
if (!hasResults) {
|
package/bin/cli.js
CHANGED
|
@@ -128,7 +128,7 @@ var program = new Command();
|
|
|
128
128
|
program.name("aria-ease").description("Run accessibility tests and audits").version("2.2.3");
|
|
129
129
|
program.command("audit").description("Run axe-core powered accessibility audit on webpages").option("-u, --url <url>", "Single URL to audit").option("-f, --format <format>", "Output format for the audit report: json | csv | html | all", "all").option("-o, --out <path>", "Directory to save the audit report", "./accessibility-reports/audit").action(async (opts) => {
|
|
130
130
|
console.log(chalk.cyanBright("\u{1F680} Starting accessibility audit...\n"));
|
|
131
|
-
const { runAudit } = await import("./audit-
|
|
131
|
+
const { runAudit } = await import("./audit-RM6TCZ5C.js");
|
|
132
132
|
const { formatResults } = await import("./formatters-32KQIIYS.js");
|
|
133
133
|
const { config, configPath, errors } = await loadConfig(process.cwd());
|
|
134
134
|
if (configPath) {
|
|
@@ -155,22 +155,25 @@ program.command("audit").description("Run axe-core powered accessibility audit o
|
|
|
155
155
|
process.exit(1);
|
|
156
156
|
}
|
|
157
157
|
const allResults = [];
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
158
|
+
const { createAuditBrowser } = await import("./audit-RM6TCZ5C.js");
|
|
159
|
+
const browser = await createAuditBrowser();
|
|
160
|
+
try {
|
|
161
|
+
const auditOptions = { browser };
|
|
162
|
+
for (const url of urls) {
|
|
163
|
+
console.log(chalk.yellow(`\u{1F50E} Auditing: ${url}`));
|
|
164
|
+
try {
|
|
165
|
+
const result = await runAudit(url, auditOptions);
|
|
166
|
+
allResults.push({ url, result });
|
|
167
|
+
console.log(chalk.green(`\u2705 Completed audit for ${url}
|
|
168
168
|
`));
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
} catch (error) {
|
|
170
|
+
if (error instanceof Error && error.message) {
|
|
171
|
+
console.log(chalk.red(`\u274C Failed auditing ${url}: ${error.message}`));
|
|
172
|
+
}
|
|
172
173
|
}
|
|
173
174
|
}
|
|
175
|
+
} finally {
|
|
176
|
+
await browser.close();
|
|
174
177
|
}
|
|
175
178
|
const hasResults = allResults.some((r) => r.result && r.result.violations && r.result.violations.length > 0);
|
|
176
179
|
if (!hasResults) {
|
|
@@ -61,4 +61,4 @@ interface MenuCallback {
|
|
|
61
61
|
onOpenChange?: (isOpen: boolean) => void;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export type {
|
|
64
|
+
export type { AccordionConfig as A, ComboboxConfig as C, MenuConfig as M, AccessibilityInstance as a };
|
|
@@ -61,4 +61,4 @@ interface MenuCallback {
|
|
|
61
61
|
onOpenChange?: (isOpen: boolean) => void;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export type {
|
|
64
|
+
export type { AccordionConfig as A, ComboboxConfig as C, MenuConfig as M, AccessibilityInstance as a };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as AccordionConfig, a as AccessibilityInstance } from '../Types.d-CxWrr421.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes an accordion accessible by managing ARIA attributes, keyboard navigation, and state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as AccordionConfig, a as AccessibilityInstance } from '../Types.d-CxWrr421.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes an accordion accessible by managing ARIA attributes, keyboard navigation, and state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ComboboxConfig,
|
|
1
|
+
import { C as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-CxWrr421.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ComboboxConfig,
|
|
1
|
+
import { C as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-CxWrr421.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MenuConfig,
|
|
1
|
+
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-CxWrr421.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
package/dist/src/menu/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MenuConfig,
|
|
1
|
+
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-CxWrr421.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|