@accesslint/core 0.2.2 → 0.2.3
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 +3 -26
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.iife.js +5 -5
- package/dist/index.js +249 -245
- package/dist/rules/index.d.ts +1 -0
- package/dist/rules/index.d.ts.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# @accesslint/core
|
|
2
2
|
|
|
3
|
-
Pure accessibility rule engine for WCAG auditing. 84 bundled rules
|
|
3
|
+
Pure accessibility rule engine for WCAG auditing. 84 bundled rules and zero browser dependencies.
|
|
4
4
|
|
|
5
5
|
## Highlights
|
|
6
6
|
|
|
7
7
|
- **Lightweight** — 31 KB gzipped (IIFE), with zero runtime dependencies
|
|
8
8
|
- **Chunked audits** — time-budgeted processing via [`createChunkedAudit`](#createchunkedauditdoc-document-chunkedaudit) to avoid long tasks on the main thread
|
|
9
|
-
- **Declarative rule engine** — define custom rules as JSON and compile them with [`compileDeclarativeRule`](#compiledeclarativerulespec-declarativerule-rule), no JavaScript required
|
|
10
9
|
- **ESM, CJS, and IIFE** — tree-shakable ES modules, CommonJS for Node, and a single-file IIFE for script injection into any page
|
|
11
10
|
- **Runs anywhere** — works with happy-dom, jsdom, and real browsers with no DOM polyfills or compatibility workarounds. Run accessibility audits in Vitest and React Testing Library using the same environment as the rest of your tests
|
|
12
11
|
- **MIT licensed**
|
|
@@ -136,28 +135,10 @@ processNext();
|
|
|
136
135
|
Customize which rules are active.
|
|
137
136
|
|
|
138
137
|
```js
|
|
139
|
-
import { configureRules
|
|
138
|
+
import { configureRules } from "@accesslint/core";
|
|
140
139
|
|
|
141
140
|
configureRules({
|
|
142
141
|
disabledRules: ["heading-order"],
|
|
143
|
-
additionalRules: [compileDeclarativeRule(myCustomRule)],
|
|
144
|
-
});
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### `compileDeclarativeRule(spec: DeclarativeRule): Rule`
|
|
148
|
-
|
|
149
|
-
Compile a declarative rule definition into an executable rule. Supports six check types: `selector-exists`, `attribute-value`, `attribute-missing`, `attribute-regex`, `child-required`, and `child-invalid`.
|
|
150
|
-
|
|
151
|
-
```js
|
|
152
|
-
const rule = compileDeclarativeRule({
|
|
153
|
-
id: "no-autofocus",
|
|
154
|
-
selector: "[autofocus]",
|
|
155
|
-
check: { type: "selector-exists" },
|
|
156
|
-
impact: "serious",
|
|
157
|
-
message: "Autofocus attribute should not be used.",
|
|
158
|
-
description: "autofocus moves focus unexpectedly.",
|
|
159
|
-
wcag: ["2.4.3"],
|
|
160
|
-
level: "A",
|
|
161
142
|
});
|
|
162
143
|
```
|
|
163
144
|
|
|
@@ -279,11 +260,7 @@ Helpers for building custom rules:
|
|
|
279
260
|
|
|
280
261
|
## Benchmarks
|
|
281
262
|
|
|
282
|
-
Full audit (`runAudit`) on
|
|
283
|
-
|
|
284
|
-
| Document size | ops/sec | mean |
|
|
285
|
-
| ------------- | ------: | ---: |
|
|
286
|
-
| 100 elements | 392 | 2.5 ms |
|
|
263
|
+
Full audit (`runAudit`) on synthetic documents with a realistic mix of valid and invalid elements.
|
|
287
264
|
|
|
288
265
|
### Concordance with axe-core
|
|
289
266
|
|