aria-ease 2.2.2 → 2.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 +387 -30
- package/bin/cli.cjs +475 -0
- package/bin/cli.cjs.map +1 -0
- package/bin/cli.d.ts.map +1 -0
- package/bin/cli.js +452 -0
- package/bin/cli.js.map +1 -0
- package/bin/{audit-cli.ts → cli.ts} +35 -26
- package/bin/configLoader.d.ts +19 -0
- package/bin/configLoader.d.ts.map +1 -0
- package/bin/configLoader.js +155 -0
- package/bin/configLoader.ts +170 -0
- package/bin/contractTestRunnerPlaywright-2LQHVMXT.js +426 -0
- package/bin/contractTestRunnerPlaywright-2LQHVMXT.js.map +1 -0
- package/dist/chunk-4F6O5RKZ.js +207 -0
- package/dist/chunk-4F6O5RKZ.js.map +1 -0
- package/dist/contractTestRunnerPlaywright-FM6MK6DY.js +255 -0
- package/dist/contractTestRunnerPlaywright-FM6MK6DY.js.map +1 -0
- package/dist/index.cjs +13642 -233
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -7
- package/dist/index.d.ts +100 -7
- package/dist/index.js +13189 -7
- package/dist/index.js.map +1 -1
- package/dist/{Types.d-p85gN5m_.d.cts → src/Types.d-BbztRe-S.d.cts} +0 -5
- package/dist/{Types.d-p85gN5m_.d.ts → src/Types.d-BbztRe-S.d.ts} +0 -5
- package/dist/src/accordion/index.cjs +25 -19
- package/dist/src/accordion/index.cjs.map +1 -1
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/accordion/index.js +28 -1
- package/dist/src/accordion/index.js.map +1 -1
- package/dist/src/block/index.cjs +98 -99
- package/dist/src/block/index.cjs.map +1 -1
- package/dist/src/block/index.d.cts +2 -2
- package/dist/src/block/index.d.ts +2 -2
- package/dist/src/block/index.js +41 -2
- package/dist/src/block/index.js.map +1 -1
- package/dist/src/checkbox/index.cjs +30 -13
- package/dist/src/checkbox/index.cjs.map +1 -1
- package/dist/src/checkbox/index.d.cts +1 -1
- package/dist/src/checkbox/index.d.ts +1 -1
- package/dist/src/checkbox/index.js +33 -1
- package/dist/src/checkbox/index.js.map +1 -1
- package/dist/src/chunk-MNMWQWXH.js +117 -0
- package/dist/src/chunk-MNMWQWXH.js.map +1 -0
- package/dist/src/menu/index.cjs +208 -130
- package/dist/src/menu/index.cjs.map +1 -1
- package/dist/src/menu/index.d.cts +9 -3
- package/dist/src/menu/index.d.ts +9 -3
- package/dist/src/menu/index.js +118 -2
- package/dist/src/menu/index.js.map +1 -1
- package/dist/src/radio/index.cjs +29 -16
- package/dist/src/radio/index.cjs.map +1 -1
- package/dist/src/radio/index.d.cts +1 -1
- package/dist/src/radio/index.d.ts +1 -1
- package/dist/src/radio/index.js +32 -1
- package/dist/src/radio/index.js.map +1 -1
- package/dist/src/toggle/index.cjs +26 -16
- package/dist/src/toggle/index.cjs.map +1 -1
- package/dist/src/toggle/index.d.cts +1 -1
- package/dist/src/toggle/index.d.ts +1 -1
- package/dist/src/toggle/index.js +29 -1
- package/dist/src/toggle/index.js.map +1 -1
- package/dist/src/utils/test/chunk-UAS6V5MH.js +203 -0
- package/dist/src/utils/test/chunk-UAS6V5MH.js.map +1 -0
- package/dist/src/utils/test/contractTestRunnerPlaywright-IBC4FHWK.js +251 -0
- package/dist/src/utils/test/contractTestRunnerPlaywright-IBC4FHWK.js.map +1 -0
- package/dist/src/utils/test/contracts/MenuContract.json +343 -0
- package/dist/src/utils/test/index.cjs +13092 -0
- package/dist/src/utils/test/index.cjs.map +1 -0
- package/dist/src/utils/test/index.d.cts +16 -0
- package/dist/src/utils/test/index.d.ts +16 -0
- package/dist/src/utils/test/index.js +12608 -0
- package/dist/src/utils/test/index.js.map +1 -0
- package/package.json +27 -12
- package/bin/audit-cli.cjs +0 -841
- package/bin/audit-cli.cjs.map +0 -1
- package/bin/audit-cli.js +0 -744
- package/bin/audit-cli.js.map +0 -1
- package/dist/chunk-4366LRNM.js +0 -38
- package/dist/chunk-4366LRNM.js.map +0 -1
- package/dist/chunk-5HQ6LLC5.js +0 -21
- package/dist/chunk-5HQ6LLC5.js.map +0 -1
- package/dist/chunk-FBQ5LF2T.js +0 -21
- package/dist/chunk-FBQ5LF2T.js.map +0 -1
- package/dist/chunk-KVTLMA4J.js +0 -58
- package/dist/chunk-KVTLMA4J.js.map +0 -1
- package/dist/chunk-MEA5U2G4.js +0 -24
- package/dist/chunk-MEA5U2G4.js.map +0 -1
- package/dist/chunk-RK3JUAFZ.js +0 -18
- package/dist/chunk-RK3JUAFZ.js.map +0 -1
- package/dist/chunk-RT5IROW4.js +0 -99
- package/dist/chunk-RT5IROW4.js.map +0 -1
- package/dist/src/utils/audit/audit.cjs +0 -234
- package/dist/src/utils/audit/audit.cjs.map +0 -1
- package/dist/src/utils/audit/audit.d.cts +0 -5
- package/dist/src/utils/audit/audit.d.ts +0 -5
- package/dist/src/utils/audit/audit.js +0 -227
- package/dist/src/utils/audit/audit.js.map +0 -1
- /package/bin/{audit-cli.d.cts → cli.d.cts} +0 -0
- /package/bin/{audit-cli.d.ts → cli.d.ts} +0 -0
package/bin/audit-cli.js
DELETED
|
@@ -1,744 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
function _array_like_to_array(arr, len) {
|
|
3
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
-
return arr2;
|
|
6
|
-
}
|
|
7
|
-
function _array_with_holes(arr) {
|
|
8
|
-
if (Array.isArray(arr)) return arr;
|
|
9
|
-
}
|
|
10
|
-
function _array_without_holes(arr) {
|
|
11
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
-
}
|
|
13
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
|
-
try {
|
|
15
|
-
var info = gen[key](arg);
|
|
16
|
-
var value = info.value;
|
|
17
|
-
} catch (error) {
|
|
18
|
-
reject(error);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (info.done) {
|
|
22
|
-
resolve(value);
|
|
23
|
-
} else {
|
|
24
|
-
Promise.resolve(value).then(_next, _throw);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function _async_to_generator(fn) {
|
|
28
|
-
return function() {
|
|
29
|
-
var self = this, args = arguments;
|
|
30
|
-
return new Promise(function(resolve, reject) {
|
|
31
|
-
var gen = fn.apply(self, args);
|
|
32
|
-
function _next(value) {
|
|
33
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
34
|
-
}
|
|
35
|
-
function _throw(err) {
|
|
36
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
37
|
-
}
|
|
38
|
-
_next(undefined);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function _instanceof(left, right) {
|
|
43
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
44
|
-
return !!right[Symbol.hasInstance](left);
|
|
45
|
-
} else {
|
|
46
|
-
return left instanceof right;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function _iterable_to_array(iter) {
|
|
50
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
51
|
-
}
|
|
52
|
-
function _iterable_to_array_limit(arr, i) {
|
|
53
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
54
|
-
if (_i == null) return;
|
|
55
|
-
var _arr = [];
|
|
56
|
-
var _n = true;
|
|
57
|
-
var _d = false;
|
|
58
|
-
var _s, _e;
|
|
59
|
-
try {
|
|
60
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
61
|
-
_arr.push(_s.value);
|
|
62
|
-
if (i && _arr.length === i) break;
|
|
63
|
-
}
|
|
64
|
-
} catch (err) {
|
|
65
|
-
_d = true;
|
|
66
|
-
_e = err;
|
|
67
|
-
} finally{
|
|
68
|
-
try {
|
|
69
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
70
|
-
} finally{
|
|
71
|
-
if (_d) throw _e;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return _arr;
|
|
75
|
-
}
|
|
76
|
-
function _non_iterable_rest() {
|
|
77
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
78
|
-
}
|
|
79
|
-
function _non_iterable_spread() {
|
|
80
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
81
|
-
}
|
|
82
|
-
function _sliced_to_array(arr, i) {
|
|
83
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
84
|
-
}
|
|
85
|
-
function _to_consumable_array(arr) {
|
|
86
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
87
|
-
}
|
|
88
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
89
|
-
if (!o) return;
|
|
90
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
91
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
92
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
93
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
94
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
95
|
-
}
|
|
96
|
-
function _ts_generator(thisArg, body) {
|
|
97
|
-
var f, y, t, _ = {
|
|
98
|
-
label: 0,
|
|
99
|
-
sent: function() {
|
|
100
|
-
if (t[0] & 1) throw t[1];
|
|
101
|
-
return t[1];
|
|
102
|
-
},
|
|
103
|
-
trys: [],
|
|
104
|
-
ops: []
|
|
105
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
106
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
107
|
-
return this;
|
|
108
|
-
}), g;
|
|
109
|
-
function verb(n) {
|
|
110
|
-
return function(v) {
|
|
111
|
-
return step([
|
|
112
|
-
n,
|
|
113
|
-
v
|
|
114
|
-
]);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function step(op) {
|
|
118
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
119
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
120
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
121
|
-
if (y = 0, t) op = [
|
|
122
|
-
op[0] & 2,
|
|
123
|
-
t.value
|
|
124
|
-
];
|
|
125
|
-
switch(op[0]){
|
|
126
|
-
case 0:
|
|
127
|
-
case 1:
|
|
128
|
-
t = op;
|
|
129
|
-
break;
|
|
130
|
-
case 4:
|
|
131
|
-
_.label++;
|
|
132
|
-
return {
|
|
133
|
-
value: op[1],
|
|
134
|
-
done: false
|
|
135
|
-
};
|
|
136
|
-
case 5:
|
|
137
|
-
_.label++;
|
|
138
|
-
y = op[1];
|
|
139
|
-
op = [
|
|
140
|
-
0
|
|
141
|
-
];
|
|
142
|
-
continue;
|
|
143
|
-
case 7:
|
|
144
|
-
op = _.ops.pop();
|
|
145
|
-
_.trys.pop();
|
|
146
|
-
continue;
|
|
147
|
-
default:
|
|
148
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
149
|
-
_ = 0;
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
153
|
-
_.label = op[1];
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
157
|
-
_.label = t[1];
|
|
158
|
-
t = op;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
if (t && _.label < t[2]) {
|
|
162
|
-
_.label = t[2];
|
|
163
|
-
_.ops.push(op);
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
if (t[2]) _.ops.pop();
|
|
167
|
-
_.trys.pop();
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
op = body.call(thisArg, _);
|
|
171
|
-
} catch (e) {
|
|
172
|
-
op = [
|
|
173
|
-
6,
|
|
174
|
-
e
|
|
175
|
-
];
|
|
176
|
-
y = 0;
|
|
177
|
-
} finally{
|
|
178
|
-
f = t = 0;
|
|
179
|
-
}
|
|
180
|
-
if (op[0] & 5) throw op[1];
|
|
181
|
-
return {
|
|
182
|
-
value: op[0] ? op[1] : void 0,
|
|
183
|
-
done: true
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
// bin/audit-cli.ts
|
|
188
|
-
import { Command } from "commander";
|
|
189
|
-
import chalk from "chalk";
|
|
190
|
-
import path from "path";
|
|
191
|
-
import fs from "fs-extra";
|
|
192
|
-
// dist/src/utils/audit/audit.js
|
|
193
|
-
import AxeBuilder from "@axe-core/playwright";
|
|
194
|
-
import { chromium } from "playwright";
|
|
195
|
-
function asyncGeneratorStep1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
196
|
-
try {
|
|
197
|
-
var info = gen[key](arg);
|
|
198
|
-
var value = info.value;
|
|
199
|
-
} catch (error) {
|
|
200
|
-
reject(error);
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (info.done) {
|
|
204
|
-
resolve(value);
|
|
205
|
-
} else {
|
|
206
|
-
Promise.resolve(value).then(_next, _throw);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function _async_to_generator1(fn) {
|
|
210
|
-
return function() {
|
|
211
|
-
var self = this, args = arguments;
|
|
212
|
-
return new Promise(function(resolve, reject) {
|
|
213
|
-
var gen = fn.apply(self, args);
|
|
214
|
-
function _next(value) {
|
|
215
|
-
asyncGeneratorStep1(gen, resolve, reject, _next, _throw, "next", value);
|
|
216
|
-
}
|
|
217
|
-
function _throw(err) {
|
|
218
|
-
asyncGeneratorStep1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
219
|
-
}
|
|
220
|
-
_next(void 0);
|
|
221
|
-
});
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
function _instanceof1(left, right) {
|
|
225
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
226
|
-
return !!right[Symbol.hasInstance](left);
|
|
227
|
-
} else {
|
|
228
|
-
return _instanceof(left, right);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
function _ts_generator1(thisArg, body) {
|
|
232
|
-
var f, y, t, _ = {
|
|
233
|
-
label: 0,
|
|
234
|
-
sent: function sent() {
|
|
235
|
-
if (t[0] & 1) throw t[1];
|
|
236
|
-
return t[1];
|
|
237
|
-
},
|
|
238
|
-
trys: [],
|
|
239
|
-
ops: []
|
|
240
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
241
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
242
|
-
return this;
|
|
243
|
-
}), g;
|
|
244
|
-
function verb(n) {
|
|
245
|
-
return function(v) {
|
|
246
|
-
return step([
|
|
247
|
-
n,
|
|
248
|
-
v
|
|
249
|
-
]);
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
function step(op) {
|
|
253
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
254
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
255
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
256
|
-
if (y = 0, t) op = [
|
|
257
|
-
op[0] & 2,
|
|
258
|
-
t.value
|
|
259
|
-
];
|
|
260
|
-
switch(op[0]){
|
|
261
|
-
case 0:
|
|
262
|
-
case 1:
|
|
263
|
-
t = op;
|
|
264
|
-
break;
|
|
265
|
-
case 4:
|
|
266
|
-
_.label++;
|
|
267
|
-
return {
|
|
268
|
-
value: op[1],
|
|
269
|
-
done: false
|
|
270
|
-
};
|
|
271
|
-
case 5:
|
|
272
|
-
_.label++;
|
|
273
|
-
y = op[1];
|
|
274
|
-
op = [
|
|
275
|
-
0
|
|
276
|
-
];
|
|
277
|
-
continue;
|
|
278
|
-
case 7:
|
|
279
|
-
op = _.ops.pop();
|
|
280
|
-
_.trys.pop();
|
|
281
|
-
continue;
|
|
282
|
-
default:
|
|
283
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
284
|
-
_ = 0;
|
|
285
|
-
continue;
|
|
286
|
-
}
|
|
287
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
288
|
-
_.label = op[1];
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
292
|
-
_.label = t[1];
|
|
293
|
-
t = op;
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
if (t && _.label < t[2]) {
|
|
297
|
-
_.label = t[2];
|
|
298
|
-
_.ops.push(op);
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
if (t[2]) _.ops.pop();
|
|
302
|
-
_.trys.pop();
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
op = body.call(thisArg, _);
|
|
306
|
-
} catch (e) {
|
|
307
|
-
op = [
|
|
308
|
-
6,
|
|
309
|
-
e
|
|
310
|
-
];
|
|
311
|
-
y = 0;
|
|
312
|
-
} finally{
|
|
313
|
-
f = t = 0;
|
|
314
|
-
}
|
|
315
|
-
if (op[0] & 5) throw op[1];
|
|
316
|
-
return {
|
|
317
|
-
value: op[0] ? op[1] : void 0,
|
|
318
|
-
done: true
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
function runAudit(url) {
|
|
323
|
-
return _async_to_generator1(function() {
|
|
324
|
-
var browser, context, page, axe, axeResults, error;
|
|
325
|
-
return _ts_generator1(this, function(_state) {
|
|
326
|
-
switch(_state.label){
|
|
327
|
-
case 0:
|
|
328
|
-
_state.trys.push([
|
|
329
|
-
0,
|
|
330
|
-
6,
|
|
331
|
-
7,
|
|
332
|
-
10
|
|
333
|
-
]);
|
|
334
|
-
return [
|
|
335
|
-
4,
|
|
336
|
-
chromium.launch({
|
|
337
|
-
headless: true
|
|
338
|
-
})
|
|
339
|
-
];
|
|
340
|
-
case 1:
|
|
341
|
-
browser = _state.sent();
|
|
342
|
-
return [
|
|
343
|
-
4,
|
|
344
|
-
browser.newContext()
|
|
345
|
-
];
|
|
346
|
-
case 2:
|
|
347
|
-
context = _state.sent();
|
|
348
|
-
return [
|
|
349
|
-
4,
|
|
350
|
-
context.newPage()
|
|
351
|
-
];
|
|
352
|
-
case 3:
|
|
353
|
-
page = _state.sent();
|
|
354
|
-
return [
|
|
355
|
-
4,
|
|
356
|
-
page.goto(url, {
|
|
357
|
-
waitUntil: "networkidle"
|
|
358
|
-
})
|
|
359
|
-
];
|
|
360
|
-
case 4:
|
|
361
|
-
_state.sent();
|
|
362
|
-
axe = new AxeBuilder({
|
|
363
|
-
page: page
|
|
364
|
-
});
|
|
365
|
-
return [
|
|
366
|
-
4,
|
|
367
|
-
axe.analyze()
|
|
368
|
-
];
|
|
369
|
-
case 5:
|
|
370
|
-
axeResults = _state.sent();
|
|
371
|
-
return [
|
|
372
|
-
2,
|
|
373
|
-
axeResults
|
|
374
|
-
];
|
|
375
|
-
case 6:
|
|
376
|
-
error = _state.sent();
|
|
377
|
-
if (_instanceof1(error, Error)) {
|
|
378
|
-
if (error.message.includes("Executable doesn't exist")) {
|
|
379
|
-
console.error("\n\u274C Playwright browsers not found!\n");
|
|
380
|
-
console.log("\uD83D\uDCE6 First-time setup required:");
|
|
381
|
-
console.log(" Run: npx playwright install chromium\n");
|
|
382
|
-
console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
|
|
383
|
-
console.log(" You only need to do this once.\n");
|
|
384
|
-
} else if (error.message.includes("page.goto: net::ERR_CONNECTION_REFUSED")) {
|
|
385
|
-
console.error("\n\u274C Server Not Running!\n");
|
|
386
|
-
console.log(" Make sure your server is running before auditing URL");
|
|
387
|
-
console.log(" Run: npm run dev # or your start command");
|
|
388
|
-
}
|
|
389
|
-
process.exit(1);
|
|
390
|
-
}
|
|
391
|
-
console.error("Error during audit:", error);
|
|
392
|
-
throw error;
|
|
393
|
-
case 7:
|
|
394
|
-
if (!browser) return [
|
|
395
|
-
3,
|
|
396
|
-
9
|
|
397
|
-
];
|
|
398
|
-
return [
|
|
399
|
-
4,
|
|
400
|
-
browser.close()
|
|
401
|
-
];
|
|
402
|
-
case 8:
|
|
403
|
-
_state.sent();
|
|
404
|
-
_state.label = 9;
|
|
405
|
-
case 9:
|
|
406
|
-
return [
|
|
407
|
-
7
|
|
408
|
-
];
|
|
409
|
-
case 10:
|
|
410
|
-
return [
|
|
411
|
-
2
|
|
412
|
-
];
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
})();
|
|
416
|
-
}
|
|
417
|
-
// src/utils/audit/formatters.ts
|
|
418
|
-
function formatResults(allResults, format) {
|
|
419
|
-
switch(format){
|
|
420
|
-
case "json":
|
|
421
|
-
return JSON.stringify(allResults.flatMap(function(param) {
|
|
422
|
-
var url = param.url, result = param.result;
|
|
423
|
-
return result ? result.violations.flatMap(function(v) {
|
|
424
|
-
return v.nodes.map(function(n) {
|
|
425
|
-
return {
|
|
426
|
-
URL: url,
|
|
427
|
-
Rule: v.id,
|
|
428
|
-
Impact: v.impact,
|
|
429
|
-
Description: v.description,
|
|
430
|
-
Target: n.target,
|
|
431
|
-
FailureSummary: n.failureSummary
|
|
432
|
-
};
|
|
433
|
-
});
|
|
434
|
-
}) : [];
|
|
435
|
-
}), null, 2);
|
|
436
|
-
case "csv":
|
|
437
|
-
return toCSV(allResults);
|
|
438
|
-
case "html":
|
|
439
|
-
return toHTML(allResults);
|
|
440
|
-
default:
|
|
441
|
-
return "";
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
function toCSV(allResults) {
|
|
445
|
-
var rows = [
|
|
446
|
-
"URL,Rule,Impact,Description,Target,FailureSummary"
|
|
447
|
-
];
|
|
448
|
-
allResults.forEach(function(param) {
|
|
449
|
-
var url = param.url, result = param.result;
|
|
450
|
-
if (result) {
|
|
451
|
-
result.violations.forEach(function(v) {
|
|
452
|
-
v.nodes.forEach(function(n) {
|
|
453
|
-
var _n_failureSummary;
|
|
454
|
-
rows.push(escapeCSV(url) + "," + escapeCSV(v.id) + "," + escapeCSV(v.impact) + "," + escapeCSV(v.description) + "," + escapeCSV(Array.isArray(n.target) ? n.target.join("; ") : String(n.target)) + "," + escapeCSV((_n_failureSummary = n.failureSummary) !== null && _n_failureSummary !== void 0 ? _n_failureSummary : ""));
|
|
455
|
-
});
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
return rows.join("\n");
|
|
460
|
-
}
|
|
461
|
-
function escapeCSV(value) {
|
|
462
|
-
var s = String(value !== null && value !== void 0 ? value : "");
|
|
463
|
-
return '"'.concat(s.replace(/"/g, '""'), '"');
|
|
464
|
-
}
|
|
465
|
-
function toHTML(allResults) {
|
|
466
|
-
var summary = {
|
|
467
|
-
pagesAudited: 0,
|
|
468
|
-
pagesWithViolations: 0,
|
|
469
|
-
totalViolations: 0,
|
|
470
|
-
distinctRules: /* @__PURE__ */ new Set(),
|
|
471
|
-
impactCounts: /* @__PURE__ */ new Map()
|
|
472
|
-
};
|
|
473
|
-
allResults.forEach(function(param) {
|
|
474
|
-
var result = param.result;
|
|
475
|
-
if (!result) return;
|
|
476
|
-
summary.pagesAudited++;
|
|
477
|
-
var pageViolations = result.violations.reduce(function(acc, v) {
|
|
478
|
-
var nodesCount = (v.nodes || []).length;
|
|
479
|
-
if (nodesCount > 0) {
|
|
480
|
-
summary.distinctRules.add(v.id);
|
|
481
|
-
summary.totalViolations += nodesCount;
|
|
482
|
-
acc += nodesCount;
|
|
483
|
-
var _v_impact;
|
|
484
|
-
var impact = String((_v_impact = v.impact) !== null && _v_impact !== void 0 ? _v_impact : "unknown");
|
|
485
|
-
summary.impactCounts.set(impact, (summary.impactCounts.get(impact) || 0) + nodesCount);
|
|
486
|
-
}
|
|
487
|
-
return acc;
|
|
488
|
-
}, 0);
|
|
489
|
-
if (pageViolations > 0) summary.pagesWithViolations++;
|
|
490
|
-
});
|
|
491
|
-
var rows = [];
|
|
492
|
-
allResults.forEach(function(param) {
|
|
493
|
-
var url = param.url, result = param.result;
|
|
494
|
-
if (!result) return;
|
|
495
|
-
result.violations.forEach(function(v) {
|
|
496
|
-
v.nodes.forEach(function(n) {
|
|
497
|
-
var target = Array.isArray(n.target) ? n.target.join("; ") : String(n.target);
|
|
498
|
-
var _v_impact, _v_impact1, _v_description, _n_failureSummary;
|
|
499
|
-
rows.push('\n <tr>\n <td class="nowrap">'.concat(escapeHTML(url), '</td>\n <td class="nowrap">').concat(escapeHTML(v.id), '</td>\n <td class="impact ').concat(escapeClass(String((_v_impact = v.impact) !== null && _v_impact !== void 0 ? _v_impact : "unknown")), '">').concat(escapeHTML(String((_v_impact1 = v.impact) !== null && _v_impact1 !== void 0 ? _v_impact1 : "")), '</td>\n <td class="desc">').concat(escapeHTML((_v_description = v.description) !== null && _v_description !== void 0 ? _v_description : ""), '</td>\n <td class="target"><code>').concat(escapeHTML(target), '</code></td>\n <td class="fail">').concat(escapeHTML((_n_failureSummary = n.failureSummary) !== null && _n_failureSummary !== void 0 ? _n_failureSummary : "").split(/\r?\n/).join("<br/>"), "</td>\n </tr>\n "));
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
});
|
|
503
|
-
var impactSummary = Array.from(summary.impactCounts.entries()).map(function(param) {
|
|
504
|
-
var _param = _sliced_to_array(param, 2), impact = _param[0], count = _param[1];
|
|
505
|
-
return '<li><strong class="impact '.concat(escapeClass(impact), '">').concat(escapeHTML(impact), "</strong>: ").concat(count, "</li>");
|
|
506
|
-
}).join("\n");
|
|
507
|
-
var d = /* @__PURE__ */ new Date();
|
|
508
|
-
var pad = function(n) {
|
|
509
|
-
return String(n).padStart(2, "0");
|
|
510
|
-
};
|
|
511
|
-
var reportDateTime = "".concat(pad(d.getDate()), "-").concat(pad(d.getMonth() + 1), "-").concat(d.getFullYear(), " ").concat(pad(d.getHours()), ":").concat(pad(d.getMinutes()), ":").concat(pad(d.getSeconds()));
|
|
512
|
-
var headerSummary = '\n <section class="summary">\n <h2>Report summary</h2>\n <ul>\n <li><strong>Date:</strong> '.concat(reportDateTime, "</li>\n <li><strong>Pages audited:</strong> ").concat(summary.pagesAudited, "</li>\n <li><strong>Pages with violations:</strong> ").concat(summary.pagesWithViolations, "</li>\n <li><strong>Total violations:</strong> ").concat(summary.totalViolations, "</li>\n <li><strong>Distinct rules:</strong> ").concat(summary.distinctRules.size, '</li>\n </ul>\n <div class="impact-summary">\n <h3>By impact</h3>\n <ul class="summary-list">\n ').concat(impactSummary || "<li>None</li>", "\n </ul>\n </div>\n </section>\n ").trim();
|
|
513
|
-
var html = '\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8"/>\n <title>Aria-Ease Accessibility Audit Report</title>\n <meta name="viewport" content="width=device-width, initial-scale=1"/>\n <style>\n :root{\n --bg:#ffffff; --muted:#6b7280; --border:#e6e9ee;\n --impact-critical: red; --impact-moderate:#fff4dd; --impact-serious:rgb(255, 123, 0);\n }\n body{font-family:Inter,ui-sans-serif,system-ui,Segoe UI,Roboto,Helvetica,Arial; background:var(--bg); color:#111827; padding:24px; line-height:1.4}\n h1{margin:0 0 8px}\n .summary{background:#f8fafc;border:1px solid var(--border);padding:12px 16px;border-radius:8px;margin-bottom:18px}\n .summary ul{margin:6px 0 0 0;padding:0 18px}\n .impact-summary h3{margin:12px 0 6px}\n table{width:100%; border-collapse:collapse; margin-top:12px}\n th,td{border:1px solid var(--border); padding:10px; text-align:left; vertical-align:top}\n th{background:#f3f4f6; font-weight:600; position:sticky; top:0; z-index:1}\n .nowrap{white-space:nowrap}\n .target code{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace; white-space:pre-wrap}\n .desc{max-width:380px}\n tr:nth-child(even){background:#fbfbfb}\n td.fail{color:#7b1e1e}\n .impact.critical{background:var(--impact-critical); font-weight:600}\n .impact.moderate{background:var(--impact-moderate); font-weight:600}\n .impact.serious{background:var(--impact-serious); font-weight:600}\n @media (max-width:900px){\n .desc{max-width:200px}\n table, thead, tbody, th, td, tr{display:block}\n thead{display:none}\n tr{margin-bottom:10px; border: 1px solid var(--border);}\n td{border:1px solid var(--border); padding:6px}\n td::before{font-weight:600; display:inline-block; width:120px}\n }\n .summary-list strong,\n .summary-list li {\n padding: 2px 4px;\n }\n </style>\n </head>\n <body>\n <h1>Aria-Ease Accessibility Audit Report</h1>\n '.concat(headerSummary, "\n <table>\n <thead>\n <tr>\n <th>URL</th><th>Rule</th><th>Impact</th><th>Description</th><th>Target</th><th>FailureSummary</th>\n </tr>\n </thead>\n <tbody>\n ").concat(rows.join("\n") || '<tr><td colspan="6"><em>No violations found.</em></td></tr>', "\n </tbody>\n </table>\n </body>\n </html>\n ").trim();
|
|
514
|
-
return html;
|
|
515
|
-
}
|
|
516
|
-
function escapeHTML(str) {
|
|
517
|
-
return String(str !== null && str !== void 0 ? str : "").replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
518
|
-
}
|
|
519
|
-
function escapeClass(s) {
|
|
520
|
-
return String(s !== null && s !== void 0 ? s : "").toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
521
|
-
}
|
|
522
|
-
// bin/audit-cli.ts
|
|
523
|
-
var program = new Command();
|
|
524
|
-
program.name("aria-ease").description("Run accessibility tests and audits").version("2.1.1");
|
|
525
|
-
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").option("-o, --out <path>", "Directory to save the audit report", "./accessibility-reports/audit").action(function(opts) {
|
|
526
|
-
return _async_to_generator(function() {
|
|
527
|
-
var _urls, _opts_audit, _config_audit, _config_audit1, _opts_audit1, configPath, config, _tmp, urls, format, allResults, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, result, error, err, hasResults;
|
|
528
|
-
function createReport(format2) {
|
|
529
|
-
return _async_to_generator(function() {
|
|
530
|
-
var _config_audit, formatted, out, d, pad, timestamp, fileName, filePath;
|
|
531
|
-
return _ts_generator(this, function(_state) {
|
|
532
|
-
switch(_state.label){
|
|
533
|
-
case 0:
|
|
534
|
-
formatted = formatResults(allResults, format2);
|
|
535
|
-
out = ((_config_audit = config.audit) === null || _config_audit === void 0 ? void 0 : _config_audit.output) && config.audit.output.out || opts.audit.out;
|
|
536
|
-
return [
|
|
537
|
-
4,
|
|
538
|
-
fs.ensureDir(out)
|
|
539
|
-
];
|
|
540
|
-
case 1:
|
|
541
|
-
_state.sent();
|
|
542
|
-
d = /* @__PURE__ */ new Date();
|
|
543
|
-
pad = function(n) {
|
|
544
|
-
return String(n).padStart(2, "0");
|
|
545
|
-
};
|
|
546
|
-
timestamp = "".concat(pad(d.getDate()), "-").concat(pad(d.getMonth() + 1), "-").concat(d.getFullYear(), " ").concat(pad(d.getHours()), ":").concat(pad(d.getMinutes()), ":").concat(pad(d.getSeconds()));
|
|
547
|
-
fileName = "ariaease-report-".concat(timestamp, ".").concat(format2);
|
|
548
|
-
filePath = path.join(out, fileName);
|
|
549
|
-
return [
|
|
550
|
-
4,
|
|
551
|
-
fs.writeFile(filePath, formatted, "utf-8")
|
|
552
|
-
];
|
|
553
|
-
case 2:
|
|
554
|
-
_state.sent();
|
|
555
|
-
console.log(chalk.magentaBright("\uD83D\uDCC1 Report saved to ".concat(filePath)));
|
|
556
|
-
return [
|
|
557
|
-
2
|
|
558
|
-
];
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
})();
|
|
562
|
-
}
|
|
563
|
-
return _ts_generator(this, function(_state) {
|
|
564
|
-
switch(_state.label){
|
|
565
|
-
case 0:
|
|
566
|
-
console.log(chalk.cyanBright("\uD83D\uDE80 Starting accessibility audit...\n"));
|
|
567
|
-
configPath = path.resolve(process.cwd(), "ariaease.config.js");
|
|
568
|
-
config = {};
|
|
569
|
-
return [
|
|
570
|
-
4,
|
|
571
|
-
fs.pathExists(configPath)
|
|
572
|
-
];
|
|
573
|
-
case 1:
|
|
574
|
-
if (!_state.sent()) return [
|
|
575
|
-
3,
|
|
576
|
-
5
|
|
577
|
-
];
|
|
578
|
-
return [
|
|
579
|
-
4,
|
|
580
|
-
import(configPath)
|
|
581
|
-
];
|
|
582
|
-
case 2:
|
|
583
|
-
_tmp = _state.sent().default;
|
|
584
|
-
if (_tmp) return [
|
|
585
|
-
3,
|
|
586
|
-
4
|
|
587
|
-
];
|
|
588
|
-
return [
|
|
589
|
-
4,
|
|
590
|
-
import(configPath)
|
|
591
|
-
];
|
|
592
|
-
case 3:
|
|
593
|
-
_tmp = _state.sent();
|
|
594
|
-
_state.label = 4;
|
|
595
|
-
case 4:
|
|
596
|
-
config = _tmp;
|
|
597
|
-
console.log(chalk.green("\u2705 Loaded config from ariaease.config.js\n"));
|
|
598
|
-
return [
|
|
599
|
-
3,
|
|
600
|
-
6
|
|
601
|
-
];
|
|
602
|
-
case 5:
|
|
603
|
-
console.log(chalk.yellow("\u2139\uFE0F No ariaease.config.js found at project root, using CLI configurations."));
|
|
604
|
-
_state.label = 6;
|
|
605
|
-
case 6:
|
|
606
|
-
urls = [];
|
|
607
|
-
if ((_opts_audit = opts.audit) === null || _opts_audit === void 0 ? void 0 : _opts_audit.url) urls.push(opts.audit.url);
|
|
608
|
-
if (((_config_audit = config.audit) === null || _config_audit === void 0 ? void 0 : _config_audit.urls) && Array.isArray(config.audit.urls)) (_urls = urls).push.apply(_urls, _to_consumable_array(config.audit.urls));
|
|
609
|
-
format = ((_config_audit1 = config.audit) === null || _config_audit1 === void 0 ? void 0 : _config_audit1.output) && config.audit.output.format || ((_opts_audit1 = opts.audit) === null || _opts_audit1 === void 0 ? void 0 : _opts_audit1.format);
|
|
610
|
-
if (![
|
|
611
|
-
"json",
|
|
612
|
-
"csv",
|
|
613
|
-
"html",
|
|
614
|
-
"all"
|
|
615
|
-
].includes(format)) {
|
|
616
|
-
console.log(chalk.red('\u274C Invalid format. Use "json", "csv", "html" or "all".'));
|
|
617
|
-
process.exit(1);
|
|
618
|
-
}
|
|
619
|
-
if (urls.length === 0) {
|
|
620
|
-
console.log(chalk.red('\u274C No URLs provided. Use --url option or add "urls" in ariaease.config.js'));
|
|
621
|
-
process.exit(1);
|
|
622
|
-
}
|
|
623
|
-
allResults = [];
|
|
624
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
625
|
-
_state.label = 7;
|
|
626
|
-
case 7:
|
|
627
|
-
_state.trys.push([
|
|
628
|
-
7,
|
|
629
|
-
14,
|
|
630
|
-
15,
|
|
631
|
-
16
|
|
632
|
-
]);
|
|
633
|
-
_iterator = urls[Symbol.iterator]();
|
|
634
|
-
_state.label = 8;
|
|
635
|
-
case 8:
|
|
636
|
-
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
637
|
-
3,
|
|
638
|
-
13
|
|
639
|
-
];
|
|
640
|
-
url = _step.value;
|
|
641
|
-
console.log(chalk.yellow("\uD83D\uDD0E Auditing: ".concat(url)));
|
|
642
|
-
_state.label = 9;
|
|
643
|
-
case 9:
|
|
644
|
-
_state.trys.push([
|
|
645
|
-
9,
|
|
646
|
-
11,
|
|
647
|
-
,
|
|
648
|
-
12
|
|
649
|
-
]);
|
|
650
|
-
return [
|
|
651
|
-
4,
|
|
652
|
-
runAudit(url)
|
|
653
|
-
];
|
|
654
|
-
case 10:
|
|
655
|
-
result = _state.sent();
|
|
656
|
-
allResults.push({
|
|
657
|
-
url: url,
|
|
658
|
-
result: result
|
|
659
|
-
});
|
|
660
|
-
console.log(chalk.green("✅ Completed audit for ".concat(url, "\n")));
|
|
661
|
-
return [
|
|
662
|
-
3,
|
|
663
|
-
12
|
|
664
|
-
];
|
|
665
|
-
case 11:
|
|
666
|
-
error = _state.sent();
|
|
667
|
-
if (_instanceof(error, Error) && error.message) {
|
|
668
|
-
console.log(chalk.red("❌ Failed auditing ".concat(url, ": ").concat(error.message)));
|
|
669
|
-
}
|
|
670
|
-
return [
|
|
671
|
-
3,
|
|
672
|
-
12
|
|
673
|
-
];
|
|
674
|
-
case 12:
|
|
675
|
-
_iteratorNormalCompletion = true;
|
|
676
|
-
return [
|
|
677
|
-
3,
|
|
678
|
-
8
|
|
679
|
-
];
|
|
680
|
-
case 13:
|
|
681
|
-
return [
|
|
682
|
-
3,
|
|
683
|
-
16
|
|
684
|
-
];
|
|
685
|
-
case 14:
|
|
686
|
-
err = _state.sent();
|
|
687
|
-
_didIteratorError = true;
|
|
688
|
-
_iteratorError = err;
|
|
689
|
-
return [
|
|
690
|
-
3,
|
|
691
|
-
16
|
|
692
|
-
];
|
|
693
|
-
case 15:
|
|
694
|
-
try {
|
|
695
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
696
|
-
_iterator.return();
|
|
697
|
-
}
|
|
698
|
-
} finally{
|
|
699
|
-
if (_didIteratorError) {
|
|
700
|
-
throw _iteratorError;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
return [
|
|
704
|
-
7
|
|
705
|
-
];
|
|
706
|
-
case 16:
|
|
707
|
-
hasResults = allResults.some(function(r) {
|
|
708
|
-
return r.result && r.result.violations && r.result.violations.length > 0;
|
|
709
|
-
});
|
|
710
|
-
if (!hasResults) {
|
|
711
|
-
console.log(chalk.red("\u274C No audit report generated"));
|
|
712
|
-
process.exit(1);
|
|
713
|
-
}
|
|
714
|
-
if ([
|
|
715
|
-
"json",
|
|
716
|
-
"csv",
|
|
717
|
-
"html"
|
|
718
|
-
].includes(format)) {
|
|
719
|
-
createReport(format);
|
|
720
|
-
} else if (format === "all") {
|
|
721
|
-
[
|
|
722
|
-
"json",
|
|
723
|
-
"csv",
|
|
724
|
-
"html"
|
|
725
|
-
].map(function(format2) {
|
|
726
|
-
createReport(format2);
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
console.log(chalk.green("\n\uD83C\uDF89 All audits completed."));
|
|
730
|
-
return [
|
|
731
|
-
2
|
|
732
|
-
];
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
})();
|
|
736
|
-
});
|
|
737
|
-
program.command("test").description("Run core a11y accessibility standard tests on UI components").option("-f, --format <format>", "Output format for the test report: json | csv | html", "html").option("-o, --out <path>", "Directory to save the test report", "./accessibility-reports/test").action(function() {
|
|
738
|
-
console.log("Coming soon");
|
|
739
|
-
});
|
|
740
|
-
program.command("help").description("Display help information").action(function() {
|
|
741
|
-
program.outputHelp();
|
|
742
|
-
});
|
|
743
|
-
program.parse(process.argv);
|
|
744
|
-
//# sourceMappingURL=audit-cli.js.map
|