@code-pushup/axe-plugin 0.92.0 → 0.93.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 +1 -14
- package/package.json +3 -3
- package/src/index.d.ts +1 -1
- package/src/lib/config.d.ts +8 -0
- package/src/lib/config.js +9 -3
- package/src/lib/config.js.map +1 -1
- package/src/lib/constants.d.ts +2 -3
- package/src/lib/constants.js +1 -6
- package/src/lib/constants.js.map +1 -1
- package/src/lib/groups.d.ts +48 -0
- package/src/lib/groups.js +60 -0
- package/src/lib/groups.js.map +1 -0
- package/src/lib/meta/transform.d.ts +2 -2
- package/src/lib/meta/transform.js +10 -61
- package/src/lib/meta/transform.js.map +1 -1
- package/src/lib/processing.d.ts +1 -1
- package/src/lib/processing.js +1 -1
- package/src/lib/processing.js.map +1 -1
package/README.md
CHANGED
|
@@ -141,16 +141,7 @@ Available presets:
|
|
|
141
141
|
|
|
142
142
|
### Groups
|
|
143
143
|
|
|
144
|
-
The plugin
|
|
145
|
-
|
|
146
|
-
**WCAG presets** (`wcag21aa`, `wcag22aa`):
|
|
147
|
-
|
|
148
|
-
- `wcag21-level-a` - WCAG 2.1 Level A audits
|
|
149
|
-
- `wcag21-level-aa` - WCAG 2.1 Level AA audits
|
|
150
|
-
- `wcag22-level-a` - WCAG 2.2 Level A audits (wcag22aa only)
|
|
151
|
-
- `wcag22-level-aa` - WCAG 2.2 Level AA audits (wcag22aa only)
|
|
152
|
-
|
|
153
|
-
**Best practice preset** (`best-practice`):
|
|
144
|
+
The plugin organizes audits into category groups based on axe-core's accessibility categories:
|
|
154
145
|
|
|
155
146
|
- `aria` - ARIA
|
|
156
147
|
- `color` - Color & Contrast
|
|
@@ -166,10 +157,6 @@ The plugin automatically creates groups to organize audits:
|
|
|
166
157
|
- `text-alternatives` - Text Alternatives
|
|
167
158
|
- `time-and-media` - Media
|
|
168
159
|
|
|
169
|
-
**All preset** (`all`):
|
|
170
|
-
|
|
171
|
-
- Combines all WCAG groups and best practice category groups
|
|
172
|
-
|
|
173
160
|
Use `npx code-pushup print-config --onlyPlugins=axe` to list all audits and groups for your configuration.
|
|
174
161
|
|
|
175
162
|
## Resources
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/axe-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Code PushUp plugin for detecting accessibility issues using Axe 🌐",
|
|
6
6
|
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/plugin-axe#readme",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"type": "module",
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@axe-core/playwright": "^4.11.0",
|
|
45
|
-
"@code-pushup/models": "0.
|
|
46
|
-
"@code-pushup/utils": "0.
|
|
45
|
+
"@code-pushup/models": "0.93.0",
|
|
46
|
+
"@code-pushup/utils": "0.93.0",
|
|
47
47
|
"axe-core": "^4.11.0",
|
|
48
48
|
"playwright-core": "^1.56.1",
|
|
49
49
|
"zod": "^4.1.12"
|
package/src/index.d.ts
CHANGED
package/src/lib/config.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const axePresets: readonly ["wcag21aa", "wcag22aa", "best-practice", "all"];
|
|
3
|
+
export declare const axePresetSchema: z.ZodEnum<{
|
|
4
|
+
wcag21aa: "wcag21aa";
|
|
5
|
+
wcag22aa: "wcag22aa";
|
|
6
|
+
"best-practice": "best-practice";
|
|
7
|
+
all: "all";
|
|
8
|
+
}>;
|
|
9
|
+
export type AxePreset = z.infer<typeof axePresetSchema>;
|
|
2
10
|
export declare const axePluginOptionsSchema: z.ZodObject<{
|
|
3
11
|
preset: z.ZodDefault<z.ZodEnum<{
|
|
4
12
|
wcag21aa: "wcag21aa";
|
package/src/lib/config.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { pluginScoreTargetsSchema, positiveIntSchema, } from '@code-pushup/models';
|
|
3
|
-
import { AXE_DEFAULT_PRESET,
|
|
4
|
-
const
|
|
3
|
+
import { AXE_DEFAULT_PRESET, DEFAULT_TIMEOUT_MS } from './constants.js';
|
|
4
|
+
export const axePresets = [
|
|
5
|
+
'wcag21aa',
|
|
6
|
+
'wcag22aa',
|
|
7
|
+
'best-practice',
|
|
8
|
+
'all',
|
|
9
|
+
];
|
|
10
|
+
export const axePresetSchema = z.enum(axePresets).meta({ title: 'AxePreset' });
|
|
5
11
|
export const axePluginOptionsSchema = z
|
|
6
12
|
.object({
|
|
7
|
-
preset:
|
|
13
|
+
preset: axePresetSchema.default(AXE_DEFAULT_PRESET).meta({
|
|
8
14
|
description: 'Accessibility ruleset preset (default: wcag21aa for WCAG 2.1 Level AA compliance)',
|
|
9
15
|
}),
|
|
10
16
|
scoreTargets: pluginScoreTargetsSchema.optional(),
|
package/src/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU;IACV,UAAU;IACV,eAAe;IACf,KAAK;CACG,CAAC;AAEX,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;AAG/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC;QACvD,WAAW,EACT,mFAAmF;KACtF,CAAC;IACF,YAAY,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IACjD,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC;QAC1D,WAAW,EACT,kEAAkE;KACrE,CAAC;CACH,CAAC;KACD,IAAI,CAAC;IACJ,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,0CAA0C;CACxD,CAAC,CAAC"}
|
package/src/lib/constants.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const AXE_PLUGIN_SLUG = "axe";
|
|
2
|
-
export declare const
|
|
3
|
-
export
|
|
4
|
-
export declare const AXE_DEFAULT_PRESET: AxePreset;
|
|
2
|
+
export declare const AXE_DEFAULT_PRESET = "wcag21aa";
|
|
3
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
package/src/lib/constants.js
CHANGED
package/src/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAE7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const axeWcagTagSchema: z.ZodEnum<{
|
|
3
|
+
wcag21aa: "wcag21aa";
|
|
4
|
+
wcag22aa: "wcag22aa";
|
|
5
|
+
wcag2a: "wcag2a";
|
|
6
|
+
wcag21a: "wcag21a";
|
|
7
|
+
wcag2aa: "wcag2aa";
|
|
8
|
+
}>;
|
|
9
|
+
export type AxeWcagTag = z.infer<typeof axeWcagTagSchema>;
|
|
10
|
+
export declare const axeWcagPresetSchema: z.ZodEnum<{
|
|
11
|
+
wcag21aa: "wcag21aa";
|
|
12
|
+
wcag22aa: "wcag22aa";
|
|
13
|
+
}>;
|
|
14
|
+
export type AxeWcagPreset = z.infer<typeof axeWcagPresetSchema>;
|
|
15
|
+
export declare function getWcagPresetTags(preset: AxeWcagPreset): AxeWcagTag[];
|
|
16
|
+
export declare const axeCategoryGroupSlugSchema: z.ZodEnum<{
|
|
17
|
+
aria: "aria";
|
|
18
|
+
color: "color";
|
|
19
|
+
forms: "forms";
|
|
20
|
+
keyboard: "keyboard";
|
|
21
|
+
language: "language";
|
|
22
|
+
"name-role-value": "name-role-value";
|
|
23
|
+
parsing: "parsing";
|
|
24
|
+
semantics: "semantics";
|
|
25
|
+
"sensory-and-visual-cues": "sensory-and-visual-cues";
|
|
26
|
+
structure: "structure";
|
|
27
|
+
tables: "tables";
|
|
28
|
+
"text-alternatives": "text-alternatives";
|
|
29
|
+
"time-and-media": "time-and-media";
|
|
30
|
+
}>;
|
|
31
|
+
export type AxeCategoryGroupSlug = z.infer<typeof axeCategoryGroupSlugSchema>;
|
|
32
|
+
export declare const CATEGORY_GROUPS: Record<AxeCategoryGroupSlug, string>;
|
|
33
|
+
export declare const axeGroupSlugSchema: z.ZodEnum<{
|
|
34
|
+
aria: "aria";
|
|
35
|
+
color: "color";
|
|
36
|
+
forms: "forms";
|
|
37
|
+
keyboard: "keyboard";
|
|
38
|
+
language: "language";
|
|
39
|
+
"name-role-value": "name-role-value";
|
|
40
|
+
parsing: "parsing";
|
|
41
|
+
semantics: "semantics";
|
|
42
|
+
"sensory-and-visual-cues": "sensory-and-visual-cues";
|
|
43
|
+
structure: "structure";
|
|
44
|
+
tables: "tables";
|
|
45
|
+
"text-alternatives": "text-alternatives";
|
|
46
|
+
"time-and-media": "time-and-media";
|
|
47
|
+
}>;
|
|
48
|
+
export type AxeGroupSlug = AxeCategoryGroupSlug;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { axePresetSchema } from './config.js';
|
|
3
|
+
/* WCAG presets for rule loading */
|
|
4
|
+
const axeWcagTags = [
|
|
5
|
+
'wcag2a',
|
|
6
|
+
'wcag21a',
|
|
7
|
+
'wcag2aa',
|
|
8
|
+
'wcag21aa',
|
|
9
|
+
'wcag22aa',
|
|
10
|
+
];
|
|
11
|
+
export const axeWcagTagSchema = z
|
|
12
|
+
.enum(axeWcagTags)
|
|
13
|
+
.meta({ title: 'AxeWcagTag' });
|
|
14
|
+
export const axeWcagPresetSchema = axePresetSchema
|
|
15
|
+
.extract(['wcag21aa', 'wcag22aa'])
|
|
16
|
+
.meta({ title: 'AxeWcagPreset' });
|
|
17
|
+
const WCAG_PRESET_TAGS = {
|
|
18
|
+
wcag21aa: ['wcag2a', 'wcag21a', 'wcag2aa', 'wcag21aa'],
|
|
19
|
+
wcag22aa: ['wcag2a', 'wcag21a', 'wcag2aa', 'wcag21aa', 'wcag22aa'],
|
|
20
|
+
};
|
|
21
|
+
export function getWcagPresetTags(preset) {
|
|
22
|
+
return WCAG_PRESET_TAGS[preset];
|
|
23
|
+
}
|
|
24
|
+
/* Category groups for all presets */
|
|
25
|
+
const axeCategoryGroupSlugs = [
|
|
26
|
+
'aria',
|
|
27
|
+
'color',
|
|
28
|
+
'forms',
|
|
29
|
+
'keyboard',
|
|
30
|
+
'language',
|
|
31
|
+
'name-role-value',
|
|
32
|
+
'parsing',
|
|
33
|
+
'semantics',
|
|
34
|
+
'sensory-and-visual-cues',
|
|
35
|
+
'structure',
|
|
36
|
+
'tables',
|
|
37
|
+
'text-alternatives',
|
|
38
|
+
'time-and-media',
|
|
39
|
+
];
|
|
40
|
+
export const axeCategoryGroupSlugSchema = z
|
|
41
|
+
.enum(axeCategoryGroupSlugs)
|
|
42
|
+
.meta({ title: 'AxeCategoryGroupSlug' });
|
|
43
|
+
export const CATEGORY_GROUPS = {
|
|
44
|
+
aria: 'ARIA',
|
|
45
|
+
color: 'Color & Contrast',
|
|
46
|
+
forms: 'Forms',
|
|
47
|
+
keyboard: 'Keyboard',
|
|
48
|
+
language: 'Language',
|
|
49
|
+
'name-role-value': 'Names & Labels',
|
|
50
|
+
parsing: 'Parsing',
|
|
51
|
+
semantics: 'Semantics',
|
|
52
|
+
'sensory-and-visual-cues': 'Visual Cues',
|
|
53
|
+
structure: 'Structure',
|
|
54
|
+
tables: 'Tables',
|
|
55
|
+
'text-alternatives': 'Text Alternatives',
|
|
56
|
+
'time-and-media': 'Media',
|
|
57
|
+
};
|
|
58
|
+
/* Combined exports */
|
|
59
|
+
export const axeGroupSlugSchema = axeCategoryGroupSlugSchema;
|
|
60
|
+
//# sourceMappingURL=groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.js","sourceRoot":"","sources":["../../../src/lib/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,mCAAmC;AACnC,MAAM,WAAW,GAAG;IAClB,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,IAAI,CAAC,WAAW,CAAC;KACjB,IAAI,CAAC,EAAE,KAAK,EAAE,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AACtB,MAAM,CAAC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axe from 'axe-core';
|
|
2
2
|
import type { Audit, Group } from '@code-pushup/models';
|
|
3
|
-
import type { AxePreset } from '../
|
|
3
|
+
import type { AxePreset } from '../config.js';
|
|
4
4
|
export declare function loadAxeRules(preset: AxePreset): axe.RuleMetadata[];
|
|
5
5
|
export declare function transformRulesToAudits(rules: axe.RuleMetadata[]): Audit[];
|
|
6
|
-
export declare function transformRulesToGroups(rules: axe.RuleMetadata[]
|
|
6
|
+
export declare function transformRulesToGroups(rules: axe.RuleMetadata[]): Group[];
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import axe from 'axe-core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const WCAG_LEVEL_AA_TAGS_21 = ['wcag2aa', 'wcag21aa'];
|
|
5
|
-
const WCAG_LEVEL_AA_TAGS_22 = ['wcag2aa', 'wcag21aa', 'wcag22aa'];
|
|
6
|
-
const CATEGORY_TITLES = {
|
|
7
|
-
'cat.aria': 'ARIA',
|
|
8
|
-
'cat.color': 'Color & Contrast',
|
|
9
|
-
'cat.forms': 'Forms',
|
|
10
|
-
'cat.keyboard': 'Keyboard',
|
|
11
|
-
'cat.language': 'Language',
|
|
12
|
-
'cat.name-role-value': 'Names & Labels',
|
|
13
|
-
'cat.parsing': 'Parsing',
|
|
14
|
-
'cat.semantics': 'Semantics',
|
|
15
|
-
'cat.sensory-and-visual-cues': 'Visual Cues',
|
|
16
|
-
'cat.structure': 'Structure',
|
|
17
|
-
'cat.tables': 'Tables',
|
|
18
|
-
'cat.text-alternatives': 'Text Alternatives',
|
|
19
|
-
'cat.time-and-media': 'Media',
|
|
20
|
-
};
|
|
2
|
+
import { objectToEntries, wrapTags } from '@code-pushup/utils';
|
|
3
|
+
import { CATEGORY_GROUPS, getWcagPresetTags, } from '../groups.js';
|
|
21
4
|
export function loadAxeRules(preset) {
|
|
22
5
|
const tags = getPresetTags(preset);
|
|
23
6
|
return tags.length === 0 ? axe.getRules() : axe.getRules(tags);
|
|
@@ -25,28 +8,13 @@ export function loadAxeRules(preset) {
|
|
|
25
8
|
export function transformRulesToAudits(rules) {
|
|
26
9
|
return rules.map(rule => ({
|
|
27
10
|
slug: rule.ruleId,
|
|
28
|
-
title: rule.help,
|
|
29
|
-
description: rule.description,
|
|
11
|
+
title: wrapTags(rule.help),
|
|
12
|
+
description: wrapTags(rule.description),
|
|
30
13
|
docsUrl: rule.helpUrl,
|
|
31
14
|
}));
|
|
32
15
|
}
|
|
33
|
-
export function transformRulesToGroups(rules
|
|
34
|
-
const groups = (
|
|
35
|
-
switch (preset) {
|
|
36
|
-
case 'wcag21aa':
|
|
37
|
-
return createWcagGroups(rules, '2.1');
|
|
38
|
-
case 'wcag22aa':
|
|
39
|
-
return createWcagGroups(rules, '2.2');
|
|
40
|
-
// eslint-disable-next-line sonarjs/no-duplicate-string
|
|
41
|
-
case 'best-practice':
|
|
42
|
-
return createCategoryGroups(rules);
|
|
43
|
-
case 'all':
|
|
44
|
-
return [
|
|
45
|
-
...createWcagGroups(rules, '2.2'),
|
|
46
|
-
...createCategoryGroups(rules),
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
})();
|
|
16
|
+
export function transformRulesToGroups(rules) {
|
|
17
|
+
const groups = createCategoryGroups(rules);
|
|
50
18
|
return groups.filter(({ refs }) => refs.length > 0);
|
|
51
19
|
}
|
|
52
20
|
/**
|
|
@@ -58,9 +26,9 @@ export function transformRulesToGroups(rules, preset) {
|
|
|
58
26
|
function getPresetTags(preset) {
|
|
59
27
|
switch (preset) {
|
|
60
28
|
case 'wcag21aa':
|
|
61
|
-
return
|
|
29
|
+
return getWcagPresetTags('wcag21aa');
|
|
62
30
|
case 'wcag22aa':
|
|
63
|
-
return
|
|
31
|
+
return getWcagPresetTags('wcag22aa');
|
|
64
32
|
case 'best-practice':
|
|
65
33
|
return ['best-practice'];
|
|
66
34
|
case 'all':
|
|
@@ -74,30 +42,11 @@ function createGroup(slug, title, rules) {
|
|
|
74
42
|
refs: rules.map(({ ruleId }) => ({ slug: ruleId, weight: 1 })),
|
|
75
43
|
};
|
|
76
44
|
}
|
|
77
|
-
function createWcagGroups(rules, version) {
|
|
78
|
-
const aTags = WCAG_LEVEL_A_TAGS;
|
|
79
|
-
const aaTags = version === '2.1' ? WCAG_LEVEL_AA_TAGS_21 : WCAG_LEVEL_AA_TAGS_22;
|
|
80
|
-
const levelARules = rules.filter(({ tags }) => tags.some(tag => aTags.includes(tag)));
|
|
81
|
-
const levelAARules = rules.filter(({ tags }) => tags.some(tag => aaTags.includes(tag)));
|
|
82
|
-
const versionSlug = version.replace('.', '');
|
|
83
|
-
return [
|
|
84
|
-
createGroup(`wcag${versionSlug}-level-a`, `WCAG ${version} Level A`, levelARules),
|
|
85
|
-
createGroup(`wcag${versionSlug}-level-aa`, `WCAG ${version} Level AA`, levelAARules),
|
|
86
|
-
];
|
|
87
|
-
}
|
|
88
45
|
function createCategoryGroups(rules) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const slug = tag.replace('cat.', '');
|
|
92
|
-
const title = formatCategoryTitle(tag, slug);
|
|
46
|
+
return objectToEntries(CATEGORY_GROUPS).map(([slug, title]) => {
|
|
47
|
+
const tag = `cat.${slug}`;
|
|
93
48
|
const categoryRules = rules.filter(({ tags }) => tags.includes(tag));
|
|
94
49
|
return createGroup(slug, title, categoryRules);
|
|
95
50
|
});
|
|
96
51
|
}
|
|
97
|
-
function formatCategoryTitle(tag, slug) {
|
|
98
|
-
if (CATEGORY_TITLES[tag]) {
|
|
99
|
-
return CATEGORY_TITLES[tag];
|
|
100
|
-
}
|
|
101
|
-
return slug.split('-').map(capitalize).join(' ');
|
|
102
|
-
}
|
|
103
52
|
//# sourceMappingURL=transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../../src/lib/meta/transform.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iBAAiB,CAAC,UAAU,CAAC,CAAC;QACvC,KAAK,UAAU;YACb,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACvC,KAAK,eAAe;YAClB,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3B,KAAK,KAAK;YACR,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAClB,IAAkB,EAClB,KAAa,EACb,KAAyB;IAEzB,OAAO;QACL,IAAI;QACJ,KAAK;QACL,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;KAC/D,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAyB;IACrD,OAAO,eAAe,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QAC5D,MAAM,GAAG,GAAG,OAAO,IAAI,EAAE,CAAC;QAC1B,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAErE,OAAO,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/src/lib/processing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Audit, Group } from '@code-pushup/models';
|
|
2
|
-
import type { AxePreset } from './
|
|
2
|
+
import type { AxePreset } from './config.js';
|
|
3
3
|
export declare function processAuditsAndGroups(urls: string[], preset: AxePreset): {
|
|
4
4
|
audits: Audit[];
|
|
5
5
|
groups: Group[];
|
package/src/lib/processing.js
CHANGED
|
@@ -4,7 +4,7 @@ export function processAuditsAndGroups(urls, preset) {
|
|
|
4
4
|
const rules = loadAxeRules(preset);
|
|
5
5
|
const ruleIds = rules.map(({ ruleId }) => ruleId);
|
|
6
6
|
const audits = transformRulesToAudits(rules);
|
|
7
|
-
const groups = transformRulesToGroups(rules
|
|
7
|
+
const groups = transformRulesToGroups(rules);
|
|
8
8
|
if (!shouldExpandForUrls(urls.length)) {
|
|
9
9
|
return { audits, groups, ruleIds };
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processing.js","sourceRoot":"","sources":["../../../src/lib/processing.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,UAAU,sBAAsB,CACpC,IAAc,EACd,MAAiB;IAMjB,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"processing.js","sourceRoot":"","sources":["../../../src/lib/processing.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,UAAU,sBAAsB,CACpC,IAAc,EACd,MAAiB;IAMjB,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE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