accessibility-checker 4.0.0 → 4.0.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/achecker.js +262 -213
- package/bin/achecker.js.map +1 -1
- package/index.js +63 -21
- package/index.js.map +1 -1
- package/lib/ACBrowserManager.js +203 -138
- package/lib/ACBrowserManager.js.map +1 -1
- package/lib/ACEngineManager.js +402 -395
- package/lib/ACEngineManager.js.map +1 -1
- package/lib/ACHelper.js +642 -581
- package/lib/ACHelper.js.map +1 -1
- package/lib/common/api-ext/Fetch.js +78 -58
- package/lib/common/api-ext/Fetch.js.map +1 -1
- package/lib/common/config/ACConfigManager.d.ts +1 -1
- package/lib/common/config/ACConfigManager.js +295 -285
- package/lib/common/config/ACConfigManager.js.map +1 -1
- package/lib/common/config/ACConstants.js +4 -38
- package/lib/common/config/ACConstants.js.map +1 -1
- package/lib/common/config/IConfig.d.ts +1 -1
- package/lib/common/engine/IChecker.d.ts +2 -2
- package/lib/common/engine/IEngine.d.ts +1 -1
- package/lib/common/engine/IGuideline.d.ts +1 -1
- package/lib/common/engine/IMapper.d.ts +1 -1
- package/lib/common/engine/IReport.d.ts +4 -4
- package/lib/common/engine/IRule.d.ts +4 -4
- package/lib/common/engine/IRuleset.d.ts +1 -1
- package/lib/common/report/ACReporterCSV.js +77 -42
- package/lib/common/report/ACReporterCSV.js.map +1 -1
- package/lib/common/report/ACReporterHTML.js +48 -15
- package/lib/common/report/ACReporterHTML.js.map +1 -1
- package/lib/common/report/ACReporterJSON.js +94 -59
- package/lib/common/report/ACReporterJSON.js.map +1 -1
- package/lib/common/report/ACReporterMetrics.js +108 -45
- package/lib/common/report/ACReporterMetrics.js.map +1 -1
- package/lib/common/report/ACReporterXLSX.js +300 -282
- package/lib/common/report/ACReporterXLSX.js.map +1 -1
- package/lib/common/report/BaselineManager.js +56 -82
- package/lib/common/report/BaselineManager.js.map +1 -1
- package/lib/common/report/ReporterManager.js +190 -125
- package/lib/common/report/ReporterManager.js.map +1 -1
- package/lib/common/report/genReport.js +2 -2
- package/package.json +4 -10
- package/cjs/bin/achecker.d.ts +0 -2
- package/cjs/bin/achecker.js +0 -306
- package/cjs/bin/achecker.js.map +0 -1
- package/cjs/index.d.ts +0 -319
- package/cjs/index.js +0 -402
- package/cjs/index.js.map +0 -1
- package/cjs/lib/ACBrowserManager.d.ts +0 -22
- package/cjs/lib/ACBrowserManager.js +0 -172
- package/cjs/lib/ACBrowserManager.js.map +0 -1
- package/cjs/lib/ACEngineManager.d.ts +0 -19
- package/cjs/lib/ACEngineManager.js +0 -457
- package/cjs/lib/ACEngineManager.js.map +0 -1
- package/cjs/lib/ACHelper.d.ts +0 -2
- package/cjs/lib/ACHelper.js +0 -678
- package/cjs/lib/ACHelper.js.map +0 -1
- package/cjs/lib/api/IChecker.d.ts +0 -28
- package/cjs/lib/api/IChecker.js +0 -11
- package/cjs/lib/api/IChecker.js.map +0 -1
- package/cjs/lib/api/IMapper.d.ts +0 -37
- package/cjs/lib/api/IMapper.js +0 -18
- package/cjs/lib/api/IMapper.js.map +0 -1
- package/cjs/lib/common/api-ext/Fetch.d.ts +0 -17
- package/cjs/lib/common/api-ext/Fetch.js +0 -95
- package/cjs/lib/common/api-ext/Fetch.js.map +0 -1
- package/cjs/lib/common/api-ext/IAbstractAPI.d.ts +0 -33
- package/cjs/lib/common/api-ext/IAbstractAPI.js +0 -18
- package/cjs/lib/common/api-ext/IAbstractAPI.js.map +0 -1
- package/cjs/lib/common/config/ACConfigManager.d.ts +0 -13
- package/cjs/lib/common/config/ACConfigManager.js +0 -483
- package/cjs/lib/common/config/ACConfigManager.js.map +0 -1
- package/cjs/lib/common/config/ACConstants.d.ts +0 -17
- package/cjs/lib/common/config/ACConstants.js +0 -111
- package/cjs/lib/common/config/ACConstants.js.map +0 -1
- package/cjs/lib/common/config/IArchive.d.ts +0 -37
- package/cjs/lib/common/config/IArchive.js +0 -18
- package/cjs/lib/common/config/IArchive.js.map +0 -1
- package/cjs/lib/common/config/IConfig.d.ts +0 -152
- package/cjs/lib/common/config/IConfig.js +0 -36
- package/cjs/lib/common/config/IConfig.js.map +0 -1
- package/cjs/lib/common/engine/IBounds.d.ts +0 -21
- package/cjs/lib/common/engine/IBounds.js +0 -18
- package/cjs/lib/common/engine/IBounds.js.map +0 -1
- package/cjs/lib/common/engine/IChecker.d.ts +0 -23
- package/cjs/lib/common/engine/IChecker.js +0 -18
- package/cjs/lib/common/engine/IChecker.js.map +0 -1
- package/cjs/lib/common/engine/IEngine.d.ts +0 -39
- package/cjs/lib/common/engine/IEngine.js +0 -18
- package/cjs/lib/common/engine/IEngine.js.map +0 -1
- package/cjs/lib/common/engine/IGuideline.d.ts +0 -53
- package/cjs/lib/common/engine/IGuideline.js +0 -37
- package/cjs/lib/common/engine/IGuideline.js.map +0 -1
- package/cjs/lib/common/engine/IMapper.d.ts +0 -32
- package/cjs/lib/common/engine/IMapper.js +0 -18
- package/cjs/lib/common/engine/IMapper.js.map +0 -1
- package/cjs/lib/common/engine/IReport.d.ts +0 -143
- package/cjs/lib/common/engine/IReport.js +0 -44
- package/cjs/lib/common/engine/IReport.js.map +0 -1
- package/cjs/lib/common/engine/IRule.d.ts +0 -100
- package/cjs/lib/common/engine/IRule.js +0 -87
- package/cjs/lib/common/engine/IRule.js.map +0 -1
- package/cjs/lib/common/engine/IRuleset.d.ts +0 -20
- package/cjs/lib/common/engine/IRuleset.js +0 -18
- package/cjs/lib/common/engine/IRuleset.js.map +0 -1
- package/cjs/lib/common/report/ACReporterCSV.d.ts +0 -28
- package/cjs/lib/common/report/ACReporterCSV.js +0 -75
- package/cjs/lib/common/report/ACReporterCSV.js.map +0 -1
- package/cjs/lib/common/report/ACReporterHTML.d.ts +0 -27
- package/cjs/lib/common/report/ACReporterHTML.js +0 -61
- package/cjs/lib/common/report/ACReporterHTML.js.map +0 -1
- package/cjs/lib/common/report/ACReporterJSON.d.ts +0 -36
- package/cjs/lib/common/report/ACReporterJSON.js +0 -109
- package/cjs/lib/common/report/ACReporterJSON.js.map +0 -1
- package/cjs/lib/common/report/ACReporterMetrics.d.ts +0 -78
- package/cjs/lib/common/report/ACReporterMetrics.js +0 -135
- package/cjs/lib/common/report/ACReporterMetrics.js.map +0 -1
- package/cjs/lib/common/report/ACReporterXLSX.d.ts +0 -38
- package/cjs/lib/common/report/ACReporterXLSX.js +0 -996
- package/cjs/lib/common/report/ACReporterXLSX.js.map +0 -1
- package/cjs/lib/common/report/BaselineManager.d.ts +0 -169
- package/cjs/lib/common/report/BaselineManager.js +0 -382
- package/cjs/lib/common/report/BaselineManager.js.map +0 -1
- package/cjs/lib/common/report/ReporterManager.d.ts +0 -79
- package/cjs/lib/common/report/ReporterManager.js +0 -469
- package/cjs/lib/common/report/ReporterManager.js.map +0 -1
- package/cjs/lib/common/report/genReport.d.ts +0 -1
- package/cjs/lib/common/report/genReport.js +0 -12
- package/cjs/lib/common/report/genReport.js.map +0 -1
- package/cjs/package.json +0 -3
- package/mjs/bin/achecker.d.ts +0 -2
- package/mjs/bin/achecker.js +0 -236
- package/mjs/bin/achecker.js.map +0 -1
- package/mjs/index.d.ts +0 -319
- package/mjs/index.js +0 -368
- package/mjs/index.js.map +0 -1
- package/mjs/lib/ACBrowserManager.d.ts +0 -22
- package/mjs/lib/ACBrowserManager.js +0 -121
- package/mjs/lib/ACBrowserManager.js.map +0 -1
- package/mjs/lib/ACEngineManager.d.ts +0 -19
- package/mjs/lib/ACEngineManager.js +0 -397
- package/mjs/lib/ACEngineManager.js.map +0 -1
- package/mjs/lib/ACHelper.d.ts +0 -2
- package/mjs/lib/ACHelper.js +0 -614
- package/mjs/lib/ACHelper.js.map +0 -1
- package/mjs/lib/api/IChecker.d.ts +0 -28
- package/mjs/lib/api/IChecker.js +0 -8
- package/mjs/lib/api/IChecker.js.map +0 -1
- package/mjs/lib/api/IMapper.d.ts +0 -37
- package/mjs/lib/api/IMapper.js +0 -17
- package/mjs/lib/api/IMapper.js.map +0 -1
- package/mjs/lib/common/api-ext/Fetch.d.ts +0 -17
- package/mjs/lib/common/api-ext/Fetch.js +0 -45
- package/mjs/lib/common/api-ext/Fetch.js.map +0 -1
- package/mjs/lib/common/api-ext/IAbstractAPI.d.ts +0 -33
- package/mjs/lib/common/api-ext/IAbstractAPI.js +0 -17
- package/mjs/lib/common/api-ext/IAbstractAPI.js.map +0 -1
- package/mjs/lib/common/config/ACConfigManager.d.ts +0 -13
- package/mjs/lib/common/config/ACConfigManager.js +0 -421
- package/mjs/lib/common/config/ACConfigManager.js.map +0 -1
- package/mjs/lib/common/config/ACConstants.d.ts +0 -17
- package/mjs/lib/common/config/ACConstants.js +0 -75
- package/mjs/lib/common/config/ACConstants.js.map +0 -1
- package/mjs/lib/common/config/IArchive.d.ts +0 -37
- package/mjs/lib/common/config/IArchive.js +0 -17
- package/mjs/lib/common/config/IArchive.js.map +0 -1
- package/mjs/lib/common/config/IConfig.d.ts +0 -152
- package/mjs/lib/common/config/IConfig.js +0 -33
- package/mjs/lib/common/config/IConfig.js.map +0 -1
- package/mjs/lib/common/engine/IBounds.d.ts +0 -21
- package/mjs/lib/common/engine/IBounds.js +0 -17
- package/mjs/lib/common/engine/IBounds.js.map +0 -1
- package/mjs/lib/common/engine/IChecker.d.ts +0 -23
- package/mjs/lib/common/engine/IChecker.js +0 -17
- package/mjs/lib/common/engine/IChecker.js.map +0 -1
- package/mjs/lib/common/engine/IEngine.d.ts +0 -39
- package/mjs/lib/common/engine/IEngine.js +0 -17
- package/mjs/lib/common/engine/IEngine.js.map +0 -1
- package/mjs/lib/common/engine/IGuideline.d.ts +0 -53
- package/mjs/lib/common/engine/IGuideline.js +0 -34
- package/mjs/lib/common/engine/IGuideline.js.map +0 -1
- package/mjs/lib/common/engine/IMapper.d.ts +0 -32
- package/mjs/lib/common/engine/IMapper.js +0 -17
- package/mjs/lib/common/engine/IMapper.js.map +0 -1
- package/mjs/lib/common/engine/IReport.d.ts +0 -143
- package/mjs/lib/common/engine/IReport.js +0 -36
- package/mjs/lib/common/engine/IReport.js.map +0 -1
- package/mjs/lib/common/engine/IRule.d.ts +0 -100
- package/mjs/lib/common/engine/IRule.js +0 -79
- package/mjs/lib/common/engine/IRule.js.map +0 -1
- package/mjs/lib/common/engine/IRuleset.d.ts +0 -20
- package/mjs/lib/common/engine/IRuleset.js +0 -17
- package/mjs/lib/common/engine/IRuleset.js.map +0 -1
- package/mjs/lib/common/report/ACReporterCSV.d.ts +0 -28
- package/mjs/lib/common/report/ACReporterCSV.js +0 -60
- package/mjs/lib/common/report/ACReporterCSV.js.map +0 -1
- package/mjs/lib/common/report/ACReporterHTML.d.ts +0 -27
- package/mjs/lib/common/report/ACReporterHTML.js +0 -46
- package/mjs/lib/common/report/ACReporterHTML.js.map +0 -1
- package/mjs/lib/common/report/ACReporterJSON.d.ts +0 -36
- package/mjs/lib/common/report/ACReporterJSON.js +0 -94
- package/mjs/lib/common/report/ACReporterJSON.js.map +0 -1
- package/mjs/lib/common/report/ACReporterMetrics.d.ts +0 -78
- package/mjs/lib/common/report/ACReporterMetrics.js +0 -122
- package/mjs/lib/common/report/ACReporterMetrics.js.map +0 -1
- package/mjs/lib/common/report/ACReporterXLSX.d.ts +0 -38
- package/mjs/lib/common/report/ACReporterXLSX.js +0 -948
- package/mjs/lib/common/report/ACReporterXLSX.js.map +0 -1
- package/mjs/lib/common/report/BaselineManager.d.ts +0 -169
- package/mjs/lib/common/report/BaselineManager.js +0 -348
- package/mjs/lib/common/report/BaselineManager.js.map +0 -1
- package/mjs/lib/common/report/ReporterManager.d.ts +0 -79
- package/mjs/lib/common/report/ReporterManager.js +0 -469
- package/mjs/lib/common/report/ReporterManager.js.map +0 -1
- package/mjs/lib/common/report/genReport.d.ts +0 -1
- package/mjs/lib/common/report/genReport.js +0 -9
- package/mjs/lib/common/report/genReport.js.map +0 -1
- package/mjs/package.json +0 -3
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,8 +8,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
9
|
});
|
|
43
10
|
};
|
|
44
|
-
var
|
|
45
|
-
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
46
37
|
};
|
|
47
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
39
|
exports.ACConfigManager = void 0;
|
|
@@ -63,16 +54,13 @@ exports.compareVersions = compareVersions;
|
|
|
63
54
|
limitations under the License.
|
|
64
55
|
*****************************************************************************/
|
|
65
56
|
// Load all the modules that are needed
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const path_1 = __importDefault(require("path"));
|
|
74
|
-
// This line will be modified by sed for cjs vs mjs environments. Look at package.json before modifying
|
|
75
|
-
// import { fileURLToPath } from 'url';
|
|
57
|
+
var pathLib = require("path");
|
|
58
|
+
var fs = require("fs");
|
|
59
|
+
var YAML = require("js-yaml");
|
|
60
|
+
var ACConstants_js_1 = require("./ACConstants.js");
|
|
61
|
+
var crypto = require("crypto");
|
|
62
|
+
var Fetch_js_1 = require("../api-ext/Fetch.js");
|
|
63
|
+
var ReporterManager_js_1 = require("../report/ReporterManager.js");
|
|
76
64
|
/**
|
|
77
65
|
* This function is responsible converting policies into an Array based on string or Array.
|
|
78
66
|
*
|
|
@@ -93,10 +81,10 @@ const path_1 = __importDefault(require("path"));
|
|
|
93
81
|
* @memberOf this
|
|
94
82
|
*/
|
|
95
83
|
function convertPolicies(policies) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("START 'convertPolicies' function");
|
|
85
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Converting policy provided to Array: ");
|
|
86
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log(policies);
|
|
87
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("END 'convertPolicies' function");
|
|
100
88
|
// In the case policies is an Array return it as engine expects list
|
|
101
89
|
if (policies instanceof Array) {
|
|
102
90
|
return policies;
|
|
@@ -113,7 +101,7 @@ function convertPolicies(policies) {
|
|
|
113
101
|
* @param versionB
|
|
114
102
|
*/
|
|
115
103
|
function compareVersions(versionA, versionB) {
|
|
116
|
-
|
|
104
|
+
var versionRE = /[0-9.]+(-rc\.[0-9]+)?/;
|
|
117
105
|
versionA = versionA.trim();
|
|
118
106
|
versionB = versionB.trim();
|
|
119
107
|
if (!versionRE.test(versionA))
|
|
@@ -124,14 +112,14 @@ function compareVersions(versionA, versionB) {
|
|
|
124
112
|
return 0;
|
|
125
113
|
// Get x.y.z-rc.a into [x.y.z, a]
|
|
126
114
|
// Get x.y.z into [x.y.z]
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
var split1A = versionA.split("-rc.");
|
|
116
|
+
var split1B = versionB.split("-rc.");
|
|
129
117
|
// Get x.y.z into [x,y,z]
|
|
130
|
-
|
|
131
|
-
|
|
118
|
+
var split2A = split1A[0].split(".");
|
|
119
|
+
var split2B = split1B[0].split(".");
|
|
132
120
|
// For the components of the shortest version - can only compare numbers we have
|
|
133
|
-
|
|
134
|
-
for (
|
|
121
|
+
var minLength = Math.min(split2A.length, split2B.length);
|
|
122
|
+
for (var idx = 0; idx < minLength; ++idx) {
|
|
135
123
|
if (split2A[idx] !== split2B[idx]) {
|
|
136
124
|
return parseInt(split2A[idx]) - parseInt(split2B[idx]);
|
|
137
125
|
}
|
|
@@ -152,8 +140,9 @@ function compareVersions(versionA, versionB) {
|
|
|
152
140
|
* @param toolVersion
|
|
153
141
|
*/
|
|
154
142
|
function findLatestArchiveId(archives, toolVersion) {
|
|
155
|
-
|
|
156
|
-
for (
|
|
143
|
+
var validArchiveKeywords = ["latest", "preview", "versioned"];
|
|
144
|
+
for (var _i = 0, archives_1 = archives; _i < archives_1.length; _i++) {
|
|
145
|
+
var archive = archives_1[_i];
|
|
157
146
|
if (validArchiveKeywords.includes(archive.id))
|
|
158
147
|
continue;
|
|
159
148
|
// If the toolVersion is greater than or equal to the archive version we've found it
|
|
@@ -181,87 +170,95 @@ function findLatestArchiveId(archives, toolVersion) {
|
|
|
181
170
|
* @memberOf this
|
|
182
171
|
*/
|
|
183
172
|
function processACConfig(ACConfig) {
|
|
184
|
-
return __awaiter(this, void 0, void 0, function
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
var validArchiveKeywords, ruleServer, ruleArchiveFile, ruleArchiveParse, err_1, ruleArchivePath, ruleArchive, i, errStr, i, errStr;
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("START 'processACConfig' function");
|
|
179
|
+
validArchiveKeywords = ["latest", "preview", "versioned"];
|
|
180
|
+
// Convert the reportLevels and failLevels to match with what the engine provides
|
|
181
|
+
// Don't need to convert the levels from the input as we are going to compare with out the level.
|
|
182
|
+
// by using contains algo, so that in the reports we can add it without level, until the engine is
|
|
183
|
+
// updated to pass back with out level.
|
|
184
|
+
//ACConfig.reportLevels = mapLevelsToEngineReadableLevels(ACConfig.reportLevels);
|
|
185
|
+
//ACConfig.failLevels = mapLevelsToEngineReadableLevels(ACConfig.failLevels);
|
|
186
|
+
// Convert the policies into a comma seperated string
|
|
187
|
+
ACConfig.policies = convertPolicies(ACConfig.policies);
|
|
188
|
+
ruleServer = ACConfig.ruleServer ? ACConfig.ruleServer : ACConstants_js_1.ACConstants.ruleServer;
|
|
189
|
+
ruleArchiveFile = "".concat(ruleServer).concat(ruleServer.includes("jsdelivr.net") ? "@next" : "", "/archives.json");
|
|
190
|
+
_a.label = 1;
|
|
191
|
+
case 1:
|
|
192
|
+
_a.trys.push([1, 3, , 4]);
|
|
193
|
+
if (ACConfig.ignoreHTTPSErrors) {
|
|
194
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
195
|
+
}
|
|
196
|
+
return [4 /*yield*/, (0, Fetch_js_1.fetch_get)(ruleArchiveFile)];
|
|
197
|
+
case 2:
|
|
198
|
+
ruleArchiveParse = _a.sent();
|
|
199
|
+
return [3 /*break*/, 4];
|
|
200
|
+
case 3:
|
|
201
|
+
err_1 = _a.sent();
|
|
202
|
+
console.log(err_1);
|
|
203
|
+
throw new Error(err_1);
|
|
204
|
+
case 4:
|
|
205
|
+
ruleArchivePath = null;
|
|
206
|
+
if (ruleArchiveParse && ruleArchiveParse.length > 0) {
|
|
207
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Found archiveFile: " + ruleArchiveFile);
|
|
208
|
+
ACConfig.ruleArchiveSet = ruleArchiveParse;
|
|
209
|
+
ruleArchive = ACConfig.ruleArchive;
|
|
210
|
+
// If the user asked us to sync the rule version with the tool version, we need to figure out what the last rule version was
|
|
211
|
+
if (ruleArchive === "versioned") {
|
|
212
|
+
if (!ACConfig.toolVersion) {
|
|
213
|
+
ruleArchive = "latest";
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
ruleArchive = findLatestArchiveId(ACConfig.ruleArchiveSet, ACConfig.toolVersion);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
ACConfig.ruleArchiveLabel = ACConfig.ruleArchive;
|
|
220
|
+
for (i = 0; i < ACConfig.ruleArchiveSet.length; i++) {
|
|
221
|
+
if (ruleArchive === ACConfig.ruleArchiveSet[i].id && !ACConfig.ruleArchiveSet[i].sunset) {
|
|
222
|
+
ruleArchivePath = ACConfig.ruleArchiveSet[i].path;
|
|
223
|
+
ACConfig.ruleArchiveVersion = ACConfig.ruleArchiveSet[i].version;
|
|
224
|
+
ACConfig.ruleArchiveLabel = ruleArchiveParse[i].name + " (" + ruleArchiveParse[i].id + ")";
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (!ruleArchivePath || ACConfig.ruleArchiveVersion === null) {
|
|
229
|
+
errStr = "[ERROR] RuleArchiveInvalid: Make Sure correct rule archive is provided in the configuration file. More information is available in the README.md";
|
|
230
|
+
console.error(errStr);
|
|
231
|
+
throw new Error(errStr);
|
|
232
|
+
}
|
|
233
|
+
for (i = 0; i < ACConfig.ruleArchiveSet.length; i++) {
|
|
234
|
+
if (ACConfig.ruleArchiveVersion === ACConfig.ruleArchiveSet[i].version && !validArchiveKeywords.includes(ACConfig.ruleArchiveSet[i].id)) {
|
|
235
|
+
ACConfig.ruleArchivePath = ACConfig.ruleArchiveSet[i].path;
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
//}
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
errStr = "[ERROR] UnableToParseArchive: Archives are unable to be parse. Contact support team.";
|
|
243
|
+
console.error(errStr);
|
|
244
|
+
throw new Error(errStr);
|
|
245
|
+
}
|
|
246
|
+
// Build the new rulePack based of the baseA11yServerURL
|
|
247
|
+
if (!ACConfig.rulePack) {
|
|
248
|
+
if (ruleServer.includes("jsdelivr.net")) {
|
|
249
|
+
ACConfig.rulePack = "".concat(ruleServer, "@").concat(ACConfig.ruleArchiveVersion);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
ACConfig.rulePack = "".concat(ruleServer).concat(ruleArchivePath, "/js");
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
ACConfig.ruleServer = ruleServer;
|
|
256
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Built new rulePack: " + ACConfig.rulePack);
|
|
257
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("END 'processACConfig' function");
|
|
258
|
+
// Return the updated ACConfig object
|
|
259
|
+
return [2 /*return*/, ACConfig];
|
|
258
260
|
}
|
|
259
|
-
}
|
|
260
|
-
ACConfig.ruleServer = ruleServer;
|
|
261
|
-
ACConstants_1.ACConstants.DEBUG && console.log("Built new rulePack: " + ACConfig.rulePack);
|
|
262
|
-
ACConstants_1.ACConstants.DEBUG && console.log("END 'processACConfig' function");
|
|
263
|
-
// Return the updated ACConfig object
|
|
264
|
-
return ACConfig;
|
|
261
|
+
});
|
|
265
262
|
});
|
|
266
263
|
}
|
|
267
264
|
/**
|
|
@@ -276,33 +273,24 @@ function processACConfig(ACConfig) {
|
|
|
276
273
|
* @memberOf this
|
|
277
274
|
*/
|
|
278
275
|
function initializeDefaults(config) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("START 'initializeDefaults' function");
|
|
277
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Config before initialization: ");
|
|
278
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log(config);
|
|
282
279
|
// Make sure all the following options are defined, otherwise reset them to default values.
|
|
283
|
-
config.ruleArchiveLabel = config.ruleArchiveLabel ||
|
|
280
|
+
config.ruleArchiveLabel = config.ruleArchiveLabel || ACConstants_js_1.ACConstants.ruleArchiveLabel || config.ruleArchive;
|
|
284
281
|
// For capture screenshots need to check for null or undefined and then set default otherwise it will evaluate the
|
|
285
282
|
// boolean which causes it to always comply with the default value and not user provided option
|
|
286
283
|
if (config.captureScreenshots === null || config.captureScreenshots === undefined || typeof config.captureScreenshots === "undefined") {
|
|
287
|
-
config.captureScreenshots =
|
|
284
|
+
config.captureScreenshots = ACConstants_js_1.ACConstants.captureScreenshots;
|
|
288
285
|
}
|
|
289
286
|
// Load in the package.json file so that we can extract the module name and the version to build
|
|
290
287
|
// a toolID which needs to be used when results are build for the purpose of keeping track of
|
|
291
288
|
// which tool is uploading the results.
|
|
292
|
-
|
|
293
|
-
try {
|
|
294
|
-
packageDir = __dirname;
|
|
295
|
-
}
|
|
296
|
-
catch (err) {
|
|
297
|
-
// This line will be modified by sed for cjs vs mjs environments. Look at package.json before modifying
|
|
298
|
-
// const __filename = fileURLToPath(import.meta.url);
|
|
299
|
-
const __dirname = path_1.default.dirname(__filename);
|
|
300
|
-
packageDir = __dirname;
|
|
301
|
-
}
|
|
289
|
+
var packageDir = __dirname;
|
|
302
290
|
while (!fs.existsSync(pathLib.join(packageDir, "package.json"))) {
|
|
303
291
|
packageDir = pathLib.join(packageDir, "..");
|
|
304
292
|
}
|
|
305
|
-
|
|
293
|
+
var packageObject = JSON.parse(fs.readFileSync(pathLib.join(packageDir, 'package.json')).toString());
|
|
306
294
|
// Build the toolID based on name and version
|
|
307
295
|
config.toolID = packageObject.name + "-v" + packageObject.version;
|
|
308
296
|
config.toolName = packageObject.name;
|
|
@@ -310,12 +298,12 @@ function initializeDefaults(config) {
|
|
|
310
298
|
// Using the uuid module generate a uuid number which is used to assoiciate to the scans that
|
|
311
299
|
// are done for a single run of karma.
|
|
312
300
|
config.scanID = crypto.randomUUID();
|
|
313
|
-
for (
|
|
314
|
-
config[key] = typeof config[key] !== "undefined" ? config[key] :
|
|
301
|
+
for (var key in ACConstants_js_1.ACConstants) {
|
|
302
|
+
config[key] = typeof config[key] !== "undefined" ? config[key] : ACConstants_js_1.ACConstants[key];
|
|
315
303
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
304
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Config after initialization: ");
|
|
305
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log(config);
|
|
306
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("END 'initializeDefaults' function");
|
|
319
307
|
}
|
|
320
308
|
/**
|
|
321
309
|
* This function is responsible reading in the .yaml or .yml or .json and set the config options based on this.
|
|
@@ -326,78 +314,70 @@ function initializeDefaults(config) {
|
|
|
326
314
|
* @memberOf this
|
|
327
315
|
*/
|
|
328
316
|
function loadConfigFromYAMLorJSONFile() {
|
|
329
|
-
return __awaiter(this, void 0, void 0, function
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
// Get the extension of the file we are about to scan
|
|
356
|
-
let fileExtension = fileToCheck.substr(fileToCheck.lastIndexOf('.') + 1);
|
|
357
|
-
// If this is a yml or yaml file verify that the file exists and then load as such.
|
|
358
|
-
if (fileExtension === "yml" || fileExtension === "yaml") {
|
|
359
|
-
// Start checking which files exists, if it exists then load it as the config that was read in
|
|
360
|
-
// We only allow specifying a file, and the order it checks is based on what is specified in the array.
|
|
361
|
-
// i.e. So in the case that it finds yml, it will load and not check the rest, etc...
|
|
362
|
-
if (fs.existsSync(fileToCheck)) {
|
|
363
|
-
ACConstants_1.ACConstants.DEBUG && console.log("File: " + fileToCheck + " exists loading it.");
|
|
364
|
-
ACConstants_1.ACConstants.DEBUG && console.log("Loading as YAML file.");
|
|
365
|
-
// Load in as yml or yaml file and return this object
|
|
366
|
-
return YAML.load(fs.readFileSync(fileToCheck), 'utf8');
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
ACConstants_1.ACConstants.DEBUG && console.log("Trying to load as json or js.");
|
|
371
|
-
// Need to use try/catch mech so that in the case the require throws an exception, we can
|
|
372
|
-
// catch this and discatd the error, as in the case there is no config file provided then
|
|
373
|
-
// we load in default values.
|
|
374
|
-
try {
|
|
375
|
-
// call the resolve to check if the file exists or not, and get the actualy path if it was js or json
|
|
376
|
-
let jsOrJSONFile = require.resolve(fileToCheck);
|
|
377
|
-
// Only try to load the achecker js or json file if it exists.
|
|
378
|
-
if (jsOrJSONFile) {
|
|
379
|
-
ACConstants_1.ACConstants.DEBUG && console.log("Loading: " + jsOrJSONFile);
|
|
380
|
-
// Load in as json or js and return this object
|
|
381
|
-
try {
|
|
382
|
-
return require(fileToCheck);
|
|
383
|
-
}
|
|
384
|
-
catch (err) {
|
|
385
|
-
try {
|
|
386
|
-
return yield Promise.resolve(`${fileToCheck}`).then(s => __importStar(require(s)));
|
|
387
|
-
}
|
|
388
|
-
catch (err) {
|
|
389
|
-
return JSON.parse(fs.readFileSync(jsOrJSONFile).toString());
|
|
390
|
-
}
|
|
391
|
-
}
|
|
317
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
318
|
+
var config, workingDir, configFiles, i, fileToCheck, fileExtension, jsOrJSONFile, err_2, err_3, e_1;
|
|
319
|
+
return __generator(this, function (_a) {
|
|
320
|
+
switch (_a.label) {
|
|
321
|
+
case 0:
|
|
322
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("START 'loadConfigFromYAMLorJSONFile' function");
|
|
323
|
+
config = {};
|
|
324
|
+
workingDir = process.cwd();
|
|
325
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Working directory set to: " + workingDir);
|
|
326
|
+
configFiles = ACConstants_js_1.ACConstants.configFiles;
|
|
327
|
+
i = 0;
|
|
328
|
+
_a.label = 1;
|
|
329
|
+
case 1:
|
|
330
|
+
if (!(i < configFiles.length)) return [3 /*break*/, 13];
|
|
331
|
+
fileToCheck = pathLib.join(workingDir, configFiles[i]);
|
|
332
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Checking file: " + fileToCheck);
|
|
333
|
+
fileExtension = fileToCheck.substr(fileToCheck.lastIndexOf('.') + 1);
|
|
334
|
+
if (!(fileExtension === "yml" || fileExtension === "yaml")) return [3 /*break*/, 2];
|
|
335
|
+
// Start checking which files exists, if it exists then load it as the config that was read in
|
|
336
|
+
// We only allow specifying a file, and the order it checks is based on what is specified in the array.
|
|
337
|
+
// i.e. So in the case that it finds yml, it will load and not check the rest, etc...
|
|
338
|
+
if (fs.existsSync(fileToCheck)) {
|
|
339
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("File: " + fileToCheck + " exists loading it.");
|
|
340
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Loading as YAML file.");
|
|
341
|
+
// Load in as yml or yaml file and return this object
|
|
342
|
+
return [2 /*return*/, YAML.load(fs.readFileSync(fileToCheck), 'utf8')];
|
|
392
343
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
344
|
+
return [3 /*break*/, 12];
|
|
345
|
+
case 2:
|
|
346
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Trying to load as json or js.");
|
|
347
|
+
_a.label = 3;
|
|
348
|
+
case 3:
|
|
349
|
+
_a.trys.push([3, 11, , 12]);
|
|
350
|
+
jsOrJSONFile = require.resolve(fileToCheck);
|
|
351
|
+
if (!jsOrJSONFile) return [3 /*break*/, 10];
|
|
352
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Loading: " + jsOrJSONFile);
|
|
353
|
+
_a.label = 4;
|
|
354
|
+
case 4:
|
|
355
|
+
_a.trys.push([4, 5, , 10]);
|
|
356
|
+
return [2 /*return*/, require(fileToCheck)];
|
|
357
|
+
case 5:
|
|
358
|
+
err_2 = _a.sent();
|
|
359
|
+
_a.label = 6;
|
|
360
|
+
case 6:
|
|
361
|
+
_a.trys.push([6, 8, , 9]);
|
|
362
|
+
return [4 /*yield*/, Promise.resolve("".concat(fileToCheck)).then(function (s) { return require(s); })];
|
|
363
|
+
case 7: return [2 /*return*/, _a.sent()];
|
|
364
|
+
case 8:
|
|
365
|
+
err_3 = _a.sent();
|
|
366
|
+
return [2 /*return*/, JSON.parse(fs.readFileSync(jsOrJSONFile).toString())];
|
|
367
|
+
case 9: return [3 /*break*/, 10];
|
|
368
|
+
case 10: return [3 /*break*/, 12];
|
|
369
|
+
case 11:
|
|
370
|
+
e_1 = _a.sent();
|
|
371
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("JSON or JS file does not exists, will load default config.");
|
|
372
|
+
return [3 /*break*/, 12];
|
|
373
|
+
case 12:
|
|
374
|
+
i++;
|
|
375
|
+
return [3 /*break*/, 1];
|
|
376
|
+
case 13:
|
|
377
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("END 'loadConfigFromYAMLorJSONFile' function");
|
|
378
|
+
return [2 /*return*/, config];
|
|
397
379
|
}
|
|
398
|
-
}
|
|
399
|
-
ACConstants_1.ACConstants.DEBUG && console.log("END 'loadConfigFromYAMLorJSONFile' function");
|
|
400
|
-
return config;
|
|
380
|
+
});
|
|
401
381
|
});
|
|
402
382
|
}
|
|
403
383
|
/**
|
|
@@ -417,67 +397,97 @@ function loadConfigFromYAMLorJSONFile() {
|
|
|
417
397
|
* @memberOf this
|
|
418
398
|
*/
|
|
419
399
|
function processConfiguration(config) {
|
|
420
|
-
return __awaiter(this, void 0, void 0, function
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
400
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
401
|
+
var ACConfig, configFromFile;
|
|
402
|
+
return __generator(this, function (_a) {
|
|
403
|
+
switch (_a.label) {
|
|
404
|
+
case 0:
|
|
405
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("START 'processConfiguration' function");
|
|
406
|
+
ACConfig = null;
|
|
407
|
+
configFromFile = null;
|
|
408
|
+
return [4 /*yield*/, loadConfigFromYAMLorJSONFile()];
|
|
409
|
+
case 1:
|
|
410
|
+
// Read in the .yaml (.yml) or .json file to load in the configuration
|
|
411
|
+
configFromFile = _a.sent();
|
|
412
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Loaded config from file: ");
|
|
413
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log(configFromFile);
|
|
414
|
+
// In the case configuration was provided in a yaml, yml or json file, then set this as the configuration
|
|
415
|
+
// otherwise load them from the Karma configuration.
|
|
416
|
+
if (configFromFile !== null && typeof (configFromFile) !== "undefined" && Object.keys(configFromFile).length !== 0) {
|
|
417
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Using config which was loaded from config file.");
|
|
418
|
+
ACConfig = configFromFile;
|
|
419
|
+
}
|
|
420
|
+
else if (config !== null && typeof (config) !== "undefined" && Object.keys(config).length !== 0) {
|
|
421
|
+
// Extract the ACConfig from the overall karma configuration, in the case config file
|
|
422
|
+
// was not provided.
|
|
423
|
+
ACConfig = config;
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
ACConfig = JSON.parse(JSON.stringify(ACConstants_js_1.ACConstants));
|
|
427
|
+
}
|
|
428
|
+
// In the case the ACConfig object is not defined, then define it with default config options so
|
|
429
|
+
// it can be set in window.__karma__.config.ACConfig, so that we know even in the testcases, other
|
|
430
|
+
// wrapper scripts that there was nothing defined at all, and at the same time to make sure that this
|
|
431
|
+
// code was actually executed.
|
|
432
|
+
initializeDefaults(ACConfig);
|
|
433
|
+
// Now we process the final accessibility-checker config object that is build to make sure it is valid, also need to perform some
|
|
434
|
+
// mapping for provided paremeters to actualy read by the engine.
|
|
435
|
+
return [4 /*yield*/, processACConfig(ACConfig)];
|
|
436
|
+
case 2:
|
|
437
|
+
// Now we process the final accessibility-checker config object that is build to make sure it is valid, also need to perform some
|
|
438
|
+
// mapping for provided paremeters to actualy read by the engine.
|
|
439
|
+
_a.sent();
|
|
440
|
+
// In the case the Karma config is set to config.LOG_DEBUG then also enable the accessibility-checker debuging
|
|
441
|
+
ACConfig.DEBUG = ACConstants_js_1.ACConstants.DEBUG;
|
|
442
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("END 'processConfiguration' function");
|
|
443
|
+
return [2 /*return*/, ACConfig];
|
|
444
|
+
}
|
|
445
|
+
});
|
|
455
446
|
});
|
|
456
447
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
461
|
-
config = yield processConfiguration(inConfig);
|
|
462
|
-
ReporterManager_1.ReporterManager.setConfig(config);
|
|
463
|
-
});
|
|
448
|
+
var config = null;
|
|
449
|
+
var ACConfigManager = /** @class */ (function () {
|
|
450
|
+
function ACConfigManager() {
|
|
464
451
|
}
|
|
465
|
-
|
|
466
|
-
return __awaiter(this, void 0, void 0, function
|
|
467
|
-
return this
|
|
452
|
+
ACConfigManager.setConfig = function (inConfig) {
|
|
453
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
454
|
+
return __generator(this, function (_a) {
|
|
455
|
+
switch (_a.label) {
|
|
456
|
+
case 0: return [4 /*yield*/, processConfiguration(inConfig)];
|
|
457
|
+
case 1:
|
|
458
|
+
config = _a.sent();
|
|
459
|
+
ReporterManager_js_1.ReporterManager.setConfig(config);
|
|
460
|
+
return [2 /*return*/];
|
|
461
|
+
}
|
|
462
|
+
});
|
|
468
463
|
});
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
return __awaiter(this, void 0, void 0, function
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
return config;
|
|
464
|
+
};
|
|
465
|
+
ACConfigManager.getConfig = function () {
|
|
466
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
467
|
+
return __generator(this, function (_a) {
|
|
468
|
+
return [2 /*return*/, this.getConfigUnsupported()];
|
|
469
|
+
});
|
|
476
470
|
});
|
|
477
|
-
}
|
|
478
|
-
|
|
471
|
+
};
|
|
472
|
+
ACConfigManager.getConfigUnsupported = function () {
|
|
473
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
474
|
+
return __generator(this, function (_a) {
|
|
475
|
+
switch (_a.label) {
|
|
476
|
+
case 0:
|
|
477
|
+
if (!!config) return [3 /*break*/, 2];
|
|
478
|
+
return [4 /*yield*/, ACConfigManager.setConfig()];
|
|
479
|
+
case 1:
|
|
480
|
+
_a.sent();
|
|
481
|
+
_a.label = 2;
|
|
482
|
+
case 2: return [2 /*return*/, config];
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
};
|
|
487
|
+
ACConfigManager.getConfigNow = function () {
|
|
479
488
|
return config;
|
|
480
|
-
}
|
|
481
|
-
|
|
489
|
+
};
|
|
490
|
+
return ACConfigManager;
|
|
491
|
+
}());
|
|
482
492
|
exports.ACConfigManager = ACConfigManager;
|
|
483
493
|
//# sourceMappingURL=ACConfigManager.js.map
|