@instructure/ui-axe-check 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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/CHANGELOG.md +13 -0
- package/es/index.js +2 -4
- package/es/runAxeCheck.js +42 -36
- package/package.json +5 -9
- package/tsconfig.build.json +1 -5
- package/lib/index.js +0 -38
- package/lib/package.json +0 -1
- package/lib/runAxeCheck.js +0 -70
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
15
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
16
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @instructure/ui-axe-check
|
package/es/index.js
CHANGED
|
@@ -20,8 +20,6 @@
|
|
|
20
20
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import runAxeCheck from './runAxeCheck.js';
|
|
23
|
+
*/ import runAxeCheck from './runAxeCheck.js';
|
|
26
24
|
export { runAxeCheck };
|
|
27
|
-
export default runAxeCheck;
|
|
25
|
+
export default runAxeCheck;
|
package/es/runAxeCheck.js
CHANGED
|
@@ -20,44 +20,50 @@
|
|
|
20
20
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import axeCore from 'axe-core';
|
|
23
|
+
*/ import axeCore from 'axe-core';
|
|
26
24
|
export default async function runAxe(element, options = {}) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
let result = true;
|
|
26
|
+
const context = {
|
|
27
|
+
include: [
|
|
28
|
+
element
|
|
29
|
+
],
|
|
30
|
+
exclude: options.exclude
|
|
31
|
+
};
|
|
32
|
+
const config = {
|
|
33
|
+
runOnly: {
|
|
34
|
+
type: 'tag',
|
|
35
|
+
values: [
|
|
36
|
+
'wcag2a',
|
|
37
|
+
'wcag2aa',
|
|
38
|
+
'section508',
|
|
39
|
+
'best-practice'
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
const axeResult = await axeCore.run(context, config);
|
|
45
|
+
// violations to ignore/filter out
|
|
46
|
+
const ignores = [
|
|
47
|
+
...options.ignores || [],
|
|
48
|
+
'color-contrast' // because we test color contrast in theme tests
|
|
49
|
+
];
|
|
50
|
+
const violations = (axeResult.violations || []).filter((violation)=>!ignores.includes(violation.id));
|
|
51
|
+
if (violations.length > 0) {
|
|
52
|
+
result = new Error(formatError(violations));
|
|
53
|
+
}
|
|
54
|
+
} catch (err) {
|
|
55
|
+
result = err;
|
|
36
56
|
}
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const axeResult = await axeCore.run(context, config);
|
|
40
|
-
|
|
41
|
-
// violations to ignore/filter out
|
|
42
|
-
const ignores = [...(options.ignores || []), 'color-contrast' // because we test color contrast in theme tests
|
|
43
|
-
];
|
|
44
|
-
const violations = (axeResult.violations || []).filter(violation => !ignores.includes(violation.id));
|
|
45
|
-
if (violations.length > 0) {
|
|
46
|
-
result = new Error(formatError(violations));
|
|
47
|
-
}
|
|
48
|
-
} catch (err) {
|
|
49
|
-
result = err;
|
|
50
|
-
}
|
|
51
|
-
return result;
|
|
57
|
+
return result;
|
|
52
58
|
}
|
|
53
59
|
function formatError(violations) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
let msg = '';
|
|
61
|
+
for (const violation of violations){
|
|
62
|
+
msg += `[${violation.id}] rule violation:\n`;
|
|
63
|
+
for (const node of violation.nodes){
|
|
64
|
+
msg += `${node.failureSummary}:\n${node.html}\n`;
|
|
65
|
+
}
|
|
66
|
+
msg += `${violation.help} ${violation.helpUrl}\n`;
|
|
59
67
|
}
|
|
60
|
-
msg
|
|
61
|
-
|
|
62
|
-
return msg;
|
|
63
|
-
}
|
|
68
|
+
return msg;
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-axe-check",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-pr-snapshot-1792147648392",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "A UI a11y testing library made by Instructure Inc.",
|
|
5
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
7
|
"module": "./es/index.js",
|
|
7
|
-
"main": "./lib/index.js",
|
|
8
8
|
"types": "./types/index.d.ts",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
"bugs": "https://github.com/instructure/instructure-ui/issues",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@
|
|
17
|
+
"@swc/helpers": "^0.5.23",
|
|
18
18
|
"axe-core": "4.12.1"
|
|
19
19
|
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@instructure/ui-babel-preset": "11.7.8"
|
|
22
|
-
},
|
|
20
|
+
"devDependencies": {},
|
|
23
21
|
"publishConfig": {
|
|
24
22
|
"access": "public"
|
|
25
23
|
},
|
|
@@ -28,10 +26,8 @@
|
|
|
28
26
|
"src": "./src/index.ts",
|
|
29
27
|
"types": "./types/index.d.ts",
|
|
30
28
|
"import": "./es/index.js",
|
|
31
|
-
"require": "./lib/index.js",
|
|
32
29
|
"default": "./es/index.js"
|
|
33
30
|
},
|
|
34
|
-
"./lib/*": "./lib/*",
|
|
35
31
|
"./es/*": "./es/*",
|
|
36
32
|
"./types/*": "./types/*",
|
|
37
33
|
"./package.json": "./package.json",
|
|
@@ -41,7 +37,7 @@
|
|
|
41
37
|
"lint": "ui-scripts lint",
|
|
42
38
|
"lint:fix": "ui-scripts lint --fix",
|
|
43
39
|
"clean": "ui-scripts clean",
|
|
44
|
-
"build": "ui-scripts build
|
|
40
|
+
"build": "ui-scripts build",
|
|
45
41
|
"build:watch": "ui-scripts build --watch",
|
|
46
42
|
"build:types": "tsc -p tsconfig.build.json"
|
|
47
43
|
}
|
package/tsconfig.build.json
CHANGED
package/lib/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
Object.defineProperty(exports, "runAxeCheck", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () {
|
|
11
|
-
return _runAxeCheck.default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
var _runAxeCheck = _interopRequireDefault(require("./runAxeCheck.js"));
|
|
15
|
-
/*
|
|
16
|
-
* The MIT License (MIT)
|
|
17
|
-
*
|
|
18
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
19
|
-
*
|
|
20
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
21
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
22
|
-
* in the Software without restriction, including without limitation the rights
|
|
23
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
24
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
25
|
-
* furnished to do so, subject to the following conditions:
|
|
26
|
-
*
|
|
27
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
28
|
-
* copies or substantial portions of the Software.
|
|
29
|
-
*
|
|
30
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
31
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
32
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
33
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
34
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
35
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
36
|
-
* SOFTWARE.
|
|
37
|
-
*/
|
|
38
|
-
var _default = exports.default = _runAxeCheck.default;
|
package/lib/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
package/lib/runAxeCheck.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = runAxe;
|
|
8
|
-
var _axeCore = _interopRequireDefault(require("axe-core"));
|
|
9
|
-
/*
|
|
10
|
-
* The MIT License (MIT)
|
|
11
|
-
*
|
|
12
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
13
|
-
*
|
|
14
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
* in the Software without restriction, including without limitation the rights
|
|
17
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
19
|
-
* furnished to do so, subject to the following conditions:
|
|
20
|
-
*
|
|
21
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
22
|
-
* copies or substantial portions of the Software.
|
|
23
|
-
*
|
|
24
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
-
* SOFTWARE.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
async function runAxe(element, options = {}) {
|
|
34
|
-
let result = true;
|
|
35
|
-
const context = {
|
|
36
|
-
include: [element],
|
|
37
|
-
exclude: options.exclude
|
|
38
|
-
};
|
|
39
|
-
const config = {
|
|
40
|
-
runOnly: {
|
|
41
|
-
type: 'tag',
|
|
42
|
-
values: ['wcag2a', 'wcag2aa', 'section508', 'best-practice']
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
try {
|
|
46
|
-
const axeResult = await _axeCore.default.run(context, config);
|
|
47
|
-
|
|
48
|
-
// violations to ignore/filter out
|
|
49
|
-
const ignores = [...(options.ignores || []), 'color-contrast' // because we test color contrast in theme tests
|
|
50
|
-
];
|
|
51
|
-
const violations = (axeResult.violations || []).filter(violation => !ignores.includes(violation.id));
|
|
52
|
-
if (violations.length > 0) {
|
|
53
|
-
result = new Error(formatError(violations));
|
|
54
|
-
}
|
|
55
|
-
} catch (err) {
|
|
56
|
-
result = err;
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
function formatError(violations) {
|
|
61
|
-
let msg = '';
|
|
62
|
-
for (const violation of violations) {
|
|
63
|
-
msg += `[${violation.id}] rule violation:\n`;
|
|
64
|
-
for (const node of violation.nodes) {
|
|
65
|
-
msg += `${node.failureSummary}:\n${node.html}\n`;
|
|
66
|
-
}
|
|
67
|
-
msg += `${violation.help} ${violation.helpUrl}\n`;
|
|
68
|
-
}
|
|
69
|
-
return msg;
|
|
70
|
-
}
|