accessibility-checker 4.0.1 → 4.0.2
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 +213 -262
- package/bin/achecker.js.map +1 -1
- package/cjs/bin/achecker.d.ts +2 -0
- package/cjs/bin/achecker.js +306 -0
- package/cjs/bin/achecker.js.map +1 -0
- package/cjs/index.d.ts +319 -0
- package/cjs/index.js +402 -0
- package/cjs/index.js.map +1 -0
- package/cjs/lib/ACBrowserManager.d.ts +22 -0
- package/cjs/lib/ACBrowserManager.js +172 -0
- package/cjs/lib/ACBrowserManager.js.map +1 -0
- package/cjs/lib/ACEngineManager.d.ts +19 -0
- package/cjs/lib/ACEngineManager.js +457 -0
- package/cjs/lib/ACEngineManager.js.map +1 -0
- package/cjs/lib/ACHelper.d.ts +2 -0
- package/cjs/lib/ACHelper.js +678 -0
- package/cjs/lib/ACHelper.js.map +1 -0
- package/cjs/lib/api/IChecker.d.ts +28 -0
- package/cjs/lib/api/IChecker.js +11 -0
- package/cjs/lib/api/IChecker.js.map +1 -0
- package/cjs/lib/api/IMapper.d.ts +37 -0
- package/cjs/lib/api/IMapper.js +18 -0
- package/cjs/lib/api/IMapper.js.map +1 -0
- package/cjs/lib/common/api-ext/Fetch.d.ts +17 -0
- package/cjs/lib/common/api-ext/Fetch.js +95 -0
- package/cjs/lib/common/api-ext/Fetch.js.map +1 -0
- package/cjs/lib/common/api-ext/IAbstractAPI.d.ts +33 -0
- package/cjs/lib/common/api-ext/IAbstractAPI.js +18 -0
- package/cjs/lib/common/api-ext/IAbstractAPI.js.map +1 -0
- package/cjs/lib/common/config/ACConfigManager.d.ts +13 -0
- package/cjs/lib/common/config/ACConfigManager.js +483 -0
- package/cjs/lib/common/config/ACConfigManager.js.map +1 -0
- package/cjs/lib/common/config/ACConstants.d.ts +17 -0
- package/cjs/lib/common/config/ACConstants.js +111 -0
- package/cjs/lib/common/config/ACConstants.js.map +1 -0
- package/cjs/lib/common/config/IArchive.d.ts +37 -0
- package/cjs/lib/common/config/IArchive.js +18 -0
- package/cjs/lib/common/config/IArchive.js.map +1 -0
- package/cjs/lib/common/config/IConfig.d.ts +152 -0
- package/cjs/lib/common/config/IConfig.js +36 -0
- package/cjs/lib/common/config/IConfig.js.map +1 -0
- package/cjs/lib/common/engine/IBounds.d.ts +21 -0
- package/cjs/lib/common/engine/IBounds.js +18 -0
- package/cjs/lib/common/engine/IBounds.js.map +1 -0
- package/cjs/lib/common/engine/IChecker.d.ts +23 -0
- package/cjs/lib/common/engine/IChecker.js +18 -0
- package/cjs/lib/common/engine/IChecker.js.map +1 -0
- package/cjs/lib/common/engine/IEngine.d.ts +39 -0
- package/cjs/lib/common/engine/IEngine.js +18 -0
- package/cjs/lib/common/engine/IEngine.js.map +1 -0
- package/cjs/lib/common/engine/IGuideline.d.ts +53 -0
- package/cjs/lib/common/engine/IGuideline.js +37 -0
- package/cjs/lib/common/engine/IGuideline.js.map +1 -0
- package/cjs/lib/common/engine/IMapper.d.ts +32 -0
- package/cjs/lib/common/engine/IMapper.js +18 -0
- package/cjs/lib/common/engine/IMapper.js.map +1 -0
- package/cjs/lib/common/engine/IReport.d.ts +143 -0
- package/cjs/lib/common/engine/IReport.js +44 -0
- package/cjs/lib/common/engine/IReport.js.map +1 -0
- package/cjs/lib/common/engine/IRule.d.ts +100 -0
- package/cjs/lib/common/engine/IRule.js +87 -0
- package/cjs/lib/common/engine/IRule.js.map +1 -0
- package/cjs/lib/common/engine/IRuleset.d.ts +20 -0
- package/cjs/lib/common/engine/IRuleset.js +18 -0
- package/cjs/lib/common/engine/IRuleset.js.map +1 -0
- package/cjs/lib/common/report/ACReporterCSV.d.ts +28 -0
- package/cjs/lib/common/report/ACReporterCSV.js +75 -0
- package/cjs/lib/common/report/ACReporterCSV.js.map +1 -0
- package/cjs/lib/common/report/ACReporterHTML.d.ts +27 -0
- package/cjs/lib/common/report/ACReporterHTML.js +61 -0
- package/cjs/lib/common/report/ACReporterHTML.js.map +1 -0
- package/cjs/lib/common/report/ACReporterJSON.d.ts +36 -0
- package/cjs/lib/common/report/ACReporterJSON.js +109 -0
- package/cjs/lib/common/report/ACReporterJSON.js.map +1 -0
- package/cjs/lib/common/report/ACReporterMetrics.d.ts +78 -0
- package/cjs/lib/common/report/ACReporterMetrics.js +135 -0
- package/cjs/lib/common/report/ACReporterMetrics.js.map +1 -0
- package/cjs/lib/common/report/ACReporterXLSX.d.ts +38 -0
- package/cjs/lib/common/report/ACReporterXLSX.js +996 -0
- package/cjs/lib/common/report/ACReporterXLSX.js.map +1 -0
- package/cjs/lib/common/report/BaselineManager.d.ts +169 -0
- package/cjs/lib/common/report/BaselineManager.js +382 -0
- package/cjs/lib/common/report/BaselineManager.js.map +1 -0
- package/cjs/lib/common/report/ReporterManager.d.ts +79 -0
- package/cjs/lib/common/report/ReporterManager.js +469 -0
- package/cjs/lib/common/report/ReporterManager.js.map +1 -0
- package/cjs/lib/common/report/genReport.d.ts +1 -0
- package/cjs/lib/common/report/genReport.js +12 -0
- package/cjs/lib/common/report/genReport.js.map +1 -0
- package/cjs/package.json +3 -0
- package/index.js +21 -63
- package/index.js.map +1 -1
- package/lib/ACBrowserManager.js +138 -203
- package/lib/ACBrowserManager.js.map +1 -1
- package/lib/ACEngineManager.js +395 -402
- package/lib/ACEngineManager.js.map +1 -1
- package/lib/ACHelper.js +581 -642
- package/lib/ACHelper.js.map +1 -1
- package/lib/common/api-ext/Fetch.js +58 -78
- package/lib/common/api-ext/Fetch.js.map +1 -1
- package/lib/common/config/ACConfigManager.js +271 -281
- package/lib/common/config/ACConfigManager.js.map +1 -1
- package/lib/common/config/ACConstants.js +38 -4
- package/lib/common/config/ACConstants.js.map +1 -1
- package/lib/common/config/IConfig.d.ts +1 -1
- package/lib/common/report/ACReporterCSV.js +42 -77
- package/lib/common/report/ACReporterCSV.js.map +1 -1
- package/lib/common/report/ACReporterHTML.js +15 -48
- package/lib/common/report/ACReporterHTML.js.map +1 -1
- package/lib/common/report/ACReporterJSON.js +59 -94
- package/lib/common/report/ACReporterJSON.js.map +1 -1
- package/lib/common/report/ACReporterMetrics.js +45 -108
- package/lib/common/report/ACReporterMetrics.js.map +1 -1
- package/lib/common/report/ACReporterXLSX.js +282 -300
- package/lib/common/report/ACReporterXLSX.js.map +1 -1
- package/lib/common/report/BaselineManager.js +82 -56
- package/lib/common/report/BaselineManager.js.map +1 -1
- package/lib/common/report/ReporterManager.js +125 -190
- package/lib/common/report/ReporterManager.js.map +1 -1
- package/lib/common/report/genReport.js +2 -2
- package/mjs/bin/achecker.d.ts +2 -0
- package/mjs/bin/achecker.js +236 -0
- package/mjs/bin/achecker.js.map +1 -0
- package/mjs/index.d.ts +319 -0
- package/mjs/index.js +368 -0
- package/mjs/index.js.map +1 -0
- package/mjs/lib/ACBrowserManager.d.ts +22 -0
- package/mjs/lib/ACBrowserManager.js +121 -0
- package/mjs/lib/ACBrowserManager.js.map +1 -0
- package/mjs/lib/ACEngineManager.d.ts +19 -0
- package/mjs/lib/ACEngineManager.js +397 -0
- package/mjs/lib/ACEngineManager.js.map +1 -0
- package/mjs/lib/ACHelper.d.ts +2 -0
- package/mjs/lib/ACHelper.js +614 -0
- package/mjs/lib/ACHelper.js.map +1 -0
- package/mjs/lib/api/IChecker.d.ts +28 -0
- package/mjs/lib/api/IChecker.js +8 -0
- package/mjs/lib/api/IChecker.js.map +1 -0
- package/mjs/lib/api/IMapper.d.ts +37 -0
- package/mjs/lib/api/IMapper.js +17 -0
- package/mjs/lib/api/IMapper.js.map +1 -0
- package/mjs/lib/common/api-ext/Fetch.d.ts +17 -0
- package/mjs/lib/common/api-ext/Fetch.js +45 -0
- package/mjs/lib/common/api-ext/Fetch.js.map +1 -0
- package/mjs/lib/common/api-ext/IAbstractAPI.d.ts +33 -0
- package/mjs/lib/common/api-ext/IAbstractAPI.js +17 -0
- package/mjs/lib/common/api-ext/IAbstractAPI.js.map +1 -0
- package/mjs/lib/common/config/ACConfigManager.d.ts +13 -0
- package/mjs/lib/common/config/ACConfigManager.js +421 -0
- package/mjs/lib/common/config/ACConfigManager.js.map +1 -0
- package/mjs/lib/common/config/ACConstants.d.ts +17 -0
- package/mjs/lib/common/config/ACConstants.js +75 -0
- package/mjs/lib/common/config/ACConstants.js.map +1 -0
- package/mjs/lib/common/config/IArchive.d.ts +37 -0
- package/mjs/lib/common/config/IArchive.js +17 -0
- package/mjs/lib/common/config/IArchive.js.map +1 -0
- package/mjs/lib/common/config/IConfig.d.ts +152 -0
- package/mjs/lib/common/config/IConfig.js +33 -0
- package/mjs/lib/common/config/IConfig.js.map +1 -0
- package/mjs/lib/common/engine/IBounds.d.ts +21 -0
- package/mjs/lib/common/engine/IBounds.js +17 -0
- package/mjs/lib/common/engine/IBounds.js.map +1 -0
- package/mjs/lib/common/engine/IChecker.d.ts +23 -0
- package/mjs/lib/common/engine/IChecker.js +17 -0
- package/mjs/lib/common/engine/IChecker.js.map +1 -0
- package/mjs/lib/common/engine/IEngine.d.ts +39 -0
- package/mjs/lib/common/engine/IEngine.js +17 -0
- package/mjs/lib/common/engine/IEngine.js.map +1 -0
- package/mjs/lib/common/engine/IGuideline.d.ts +53 -0
- package/mjs/lib/common/engine/IGuideline.js +34 -0
- package/mjs/lib/common/engine/IGuideline.js.map +1 -0
- package/mjs/lib/common/engine/IMapper.d.ts +32 -0
- package/mjs/lib/common/engine/IMapper.js +17 -0
- package/mjs/lib/common/engine/IMapper.js.map +1 -0
- package/mjs/lib/common/engine/IReport.d.ts +143 -0
- package/mjs/lib/common/engine/IReport.js +36 -0
- package/mjs/lib/common/engine/IReport.js.map +1 -0
- package/mjs/lib/common/engine/IRule.d.ts +100 -0
- package/mjs/lib/common/engine/IRule.js +79 -0
- package/mjs/lib/common/engine/IRule.js.map +1 -0
- package/mjs/lib/common/engine/IRuleset.d.ts +20 -0
- package/mjs/lib/common/engine/IRuleset.js +17 -0
- package/mjs/lib/common/engine/IRuleset.js.map +1 -0
- package/mjs/lib/common/report/ACReporterCSV.d.ts +28 -0
- package/mjs/lib/common/report/ACReporterCSV.js +60 -0
- package/mjs/lib/common/report/ACReporterCSV.js.map +1 -0
- package/mjs/lib/common/report/ACReporterHTML.d.ts +27 -0
- package/mjs/lib/common/report/ACReporterHTML.js +46 -0
- package/mjs/lib/common/report/ACReporterHTML.js.map +1 -0
- package/mjs/lib/common/report/ACReporterJSON.d.ts +36 -0
- package/mjs/lib/common/report/ACReporterJSON.js +94 -0
- package/mjs/lib/common/report/ACReporterJSON.js.map +1 -0
- package/mjs/lib/common/report/ACReporterMetrics.d.ts +78 -0
- package/mjs/lib/common/report/ACReporterMetrics.js +122 -0
- package/mjs/lib/common/report/ACReporterMetrics.js.map +1 -0
- package/mjs/lib/common/report/ACReporterXLSX.d.ts +38 -0
- package/mjs/lib/common/report/ACReporterXLSX.js +948 -0
- package/mjs/lib/common/report/ACReporterXLSX.js.map +1 -0
- package/mjs/lib/common/report/BaselineManager.d.ts +169 -0
- package/mjs/lib/common/report/BaselineManager.js +348 -0
- package/mjs/lib/common/report/BaselineManager.js.map +1 -0
- package/mjs/lib/common/report/ReporterManager.d.ts +79 -0
- package/mjs/lib/common/report/ReporterManager.js +469 -0
- package/mjs/lib/common/report/ReporterManager.js.map +1 -0
- package/mjs/lib/common/report/genReport.d.ts +1 -0
- package/mjs/lib/common/report/genReport.js +9 -0
- package/mjs/lib/common/report/genReport.js.map +1 -0
- package/mjs/package.json +3 -0
- package/package.json +10 -4
|
@@ -1,4 +1,37 @@
|
|
|
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
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,32 +41,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
42
|
});
|
|
10
43
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
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
|
-
}
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
46
|
};
|
|
38
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
48
|
exports.ACConfigManager = void 0;
|
|
@@ -54,13 +63,16 @@ exports.compareVersions = compareVersions;
|
|
|
54
63
|
limitations under the License.
|
|
55
64
|
*****************************************************************************/
|
|
56
65
|
// Load all the modules that are needed
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
const pathLib = __importStar(require("path"));
|
|
67
|
+
const fs = __importStar(require("fs"));
|
|
68
|
+
const YAML = __importStar(require("js-yaml"));
|
|
69
|
+
const ACConstants_js_1 = require("./ACConstants.js");
|
|
70
|
+
const crypto = __importStar(require("crypto"));
|
|
71
|
+
const Fetch_js_1 = require("../api-ext/Fetch.js");
|
|
72
|
+
const ReporterManager_js_1 = require("../report/ReporterManager.js");
|
|
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';
|
|
64
76
|
/**
|
|
65
77
|
* This function is responsible converting policies into an Array based on string or Array.
|
|
66
78
|
*
|
|
@@ -101,7 +113,7 @@ function convertPolicies(policies) {
|
|
|
101
113
|
* @param versionB
|
|
102
114
|
*/
|
|
103
115
|
function compareVersions(versionA, versionB) {
|
|
104
|
-
|
|
116
|
+
const versionRE = /[0-9.]+(-rc\.[0-9]+)?/;
|
|
105
117
|
versionA = versionA.trim();
|
|
106
118
|
versionB = versionB.trim();
|
|
107
119
|
if (!versionRE.test(versionA))
|
|
@@ -112,14 +124,14 @@ function compareVersions(versionA, versionB) {
|
|
|
112
124
|
return 0;
|
|
113
125
|
// Get x.y.z-rc.a into [x.y.z, a]
|
|
114
126
|
// Get x.y.z into [x.y.z]
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
let split1A = versionA.split("-rc.");
|
|
128
|
+
let split1B = versionB.split("-rc.");
|
|
117
129
|
// Get x.y.z into [x,y,z]
|
|
118
|
-
|
|
119
|
-
|
|
130
|
+
let split2A = split1A[0].split(".");
|
|
131
|
+
let split2B = split1B[0].split(".");
|
|
120
132
|
// For the components of the shortest version - can only compare numbers we have
|
|
121
|
-
|
|
122
|
-
for (
|
|
133
|
+
let minLength = Math.min(split2A.length, split2B.length);
|
|
134
|
+
for (let idx = 0; idx < minLength; ++idx) {
|
|
123
135
|
if (split2A[idx] !== split2B[idx]) {
|
|
124
136
|
return parseInt(split2A[idx]) - parseInt(split2B[idx]);
|
|
125
137
|
}
|
|
@@ -140,9 +152,8 @@ function compareVersions(versionA, versionB) {
|
|
|
140
152
|
* @param toolVersion
|
|
141
153
|
*/
|
|
142
154
|
function findLatestArchiveId(archives, toolVersion) {
|
|
143
|
-
|
|
144
|
-
for (
|
|
145
|
-
var archive = archives_1[_i];
|
|
155
|
+
const validArchiveKeywords = ["latest", "preview", "versioned"];
|
|
156
|
+
for (const archive of archives) {
|
|
146
157
|
if (validArchiveKeywords.includes(archive.id))
|
|
147
158
|
continue;
|
|
148
159
|
// If the toolVersion is greater than or equal to the archive version we've found it
|
|
@@ -170,95 +181,87 @@ function findLatestArchiveId(archives, toolVersion) {
|
|
|
170
181
|
* @memberOf this
|
|
171
182
|
*/
|
|
172
183
|
function processACConfig(ACConfig) {
|
|
173
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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];
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("START 'processACConfig' function");
|
|
186
|
+
const validArchiveKeywords = ["latest", "preview", "versioned"];
|
|
187
|
+
// Convert the reportLevels and failLevels to match with what the engine provides
|
|
188
|
+
// Don't need to convert the levels from the input as we are going to compare with out the level.
|
|
189
|
+
// by using contains algo, so that in the reports we can add it without level, until the engine is
|
|
190
|
+
// updated to pass back with out level.
|
|
191
|
+
//ACConfig.reportLevels = mapLevelsToEngineReadableLevels(ACConfig.reportLevels);
|
|
192
|
+
//ACConfig.failLevels = mapLevelsToEngineReadableLevels(ACConfig.failLevels);
|
|
193
|
+
// Convert the policies into a comma seperated string
|
|
194
|
+
ACConfig.policies = convertPolicies(ACConfig.policies);
|
|
195
|
+
// In the case that baseA11yServerURL is provided in the config use that as the base otherwise switch to the default one from the ACConstants object
|
|
196
|
+
let ruleServer = ACConfig.ruleServer ? ACConfig.ruleServer : ACConstants_js_1.ACConstants.ruleServer;
|
|
197
|
+
// Get and parse the rule archive.
|
|
198
|
+
let ruleArchiveFile = `${ruleServer}${ruleServer.includes("jsdelivr.net") ? "@next" : ""}/archives.json`;
|
|
199
|
+
let ruleArchiveParse;
|
|
200
|
+
try {
|
|
201
|
+
if (ACConfig.ignoreHTTPSErrors) {
|
|
202
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
260
203
|
}
|
|
261
|
-
|
|
204
|
+
ruleArchiveParse = yield (0, Fetch_js_1.fetch_get)(ruleArchiveFile);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
console.log(err);
|
|
208
|
+
throw new Error(err);
|
|
209
|
+
}
|
|
210
|
+
let ruleArchivePath = null;
|
|
211
|
+
if (ruleArchiveParse && ruleArchiveParse.length > 0) {
|
|
212
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Found archiveFile: " + ruleArchiveFile);
|
|
213
|
+
ACConfig.ruleArchiveSet = ruleArchiveParse;
|
|
214
|
+
let ruleArchive = ACConfig.ruleArchive;
|
|
215
|
+
// 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
|
|
216
|
+
if (ruleArchive === "versioned") {
|
|
217
|
+
if (!ACConfig.toolVersion) {
|
|
218
|
+
ruleArchive = "latest";
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
ruleArchive = findLatestArchiveId(ACConfig.ruleArchiveSet, ACConfig.toolVersion);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
ACConfig.ruleArchiveLabel = ACConfig.ruleArchive;
|
|
225
|
+
for (let i = 0; i < ACConfig.ruleArchiveSet.length; i++) {
|
|
226
|
+
if (ruleArchive === ACConfig.ruleArchiveSet[i].id && !ACConfig.ruleArchiveSet[i].sunset) {
|
|
227
|
+
ruleArchivePath = ACConfig.ruleArchiveSet[i].path;
|
|
228
|
+
ACConfig.ruleArchiveVersion = ACConfig.ruleArchiveSet[i].version;
|
|
229
|
+
ACConfig.ruleArchiveLabel = ruleArchiveParse[i].name + " (" + ruleArchiveParse[i].id + ")";
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (!ruleArchivePath || ACConfig.ruleArchiveVersion === null) {
|
|
234
|
+
const errStr = "[ERROR] RuleArchiveInvalid: Make Sure correct rule archive is provided in the configuration file. More information is available in the README.md";
|
|
235
|
+
console.error(errStr);
|
|
236
|
+
throw new Error(errStr);
|
|
237
|
+
}
|
|
238
|
+
for (let i = 0; i < ACConfig.ruleArchiveSet.length; i++) {
|
|
239
|
+
if (ACConfig.ruleArchiveVersion === ACConfig.ruleArchiveSet[i].version && !validArchiveKeywords.includes(ACConfig.ruleArchiveSet[i].id)) {
|
|
240
|
+
ACConfig.ruleArchivePath = ACConfig.ruleArchiveSet[i].path;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
//}
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
const errStr = "[ERROR] UnableToParseArchive: Archives are unable to be parse. Contact support team.";
|
|
248
|
+
console.error(errStr);
|
|
249
|
+
throw new Error(errStr);
|
|
250
|
+
}
|
|
251
|
+
// Build the new rulePack based of the baseA11yServerURL
|
|
252
|
+
if (!ACConfig.rulePack) {
|
|
253
|
+
if (ruleServer.includes("jsdelivr.net")) {
|
|
254
|
+
ACConfig.rulePack = `${ruleServer}@${ACConfig.ruleArchiveVersion}`;
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
ACConfig.rulePack = `${ruleServer}${ruleArchivePath}/js`;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
ACConfig.ruleServer = ruleServer;
|
|
261
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Built new rulePack: " + ACConfig.rulePack);
|
|
262
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("END 'processACConfig' function");
|
|
263
|
+
// Return the updated ACConfig object
|
|
264
|
+
return ACConfig;
|
|
262
265
|
});
|
|
263
266
|
}
|
|
264
267
|
/**
|
|
@@ -286,11 +289,20 @@ function initializeDefaults(config) {
|
|
|
286
289
|
// Load in the package.json file so that we can extract the module name and the version to build
|
|
287
290
|
// a toolID which needs to be used when results are build for the purpose of keeping track of
|
|
288
291
|
// which tool is uploading the results.
|
|
289
|
-
|
|
292
|
+
let packageDir = "";
|
|
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
|
+
}
|
|
290
302
|
while (!fs.existsSync(pathLib.join(packageDir, "package.json"))) {
|
|
291
303
|
packageDir = pathLib.join(packageDir, "..");
|
|
292
304
|
}
|
|
293
|
-
|
|
305
|
+
const packageObject = JSON.parse(fs.readFileSync(pathLib.join(packageDir, 'package.json')).toString());
|
|
294
306
|
// Build the toolID based on name and version
|
|
295
307
|
config.toolID = packageObject.name + "-v" + packageObject.version;
|
|
296
308
|
config.toolName = packageObject.name;
|
|
@@ -298,7 +310,7 @@ function initializeDefaults(config) {
|
|
|
298
310
|
// Using the uuid module generate a uuid number which is used to assoiciate to the scans that
|
|
299
311
|
// are done for a single run of karma.
|
|
300
312
|
config.scanID = crypto.randomUUID();
|
|
301
|
-
for (
|
|
313
|
+
for (const key in ACConstants_js_1.ACConstants) {
|
|
302
314
|
config[key] = typeof config[key] !== "undefined" ? config[key] : ACConstants_js_1.ACConstants[key];
|
|
303
315
|
}
|
|
304
316
|
ACConstants_js_1.ACConstants.DEBUG && console.log("Config after initialization: ");
|
|
@@ -314,70 +326,78 @@ function initializeDefaults(config) {
|
|
|
314
326
|
* @memberOf this
|
|
315
327
|
*/
|
|
316
328
|
function loadConfigFromYAMLorJSONFile() {
|
|
317
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
330
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("START 'loadConfigFromYAMLorJSONFile' function");
|
|
331
|
+
// Variable Decleration
|
|
332
|
+
let config = {};
|
|
333
|
+
// Get the current working directory, where we will look for the yaml, yml or json file
|
|
334
|
+
let workingDir = process.cwd();
|
|
335
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Working directory set to: " + workingDir);
|
|
336
|
+
// List of files to look for in that order, in the case even one is found we stop and load that as the config.
|
|
337
|
+
// Theses files will be checked for in the working directory:
|
|
338
|
+
// ./.achecker.yml
|
|
339
|
+
// ./.achecker.yaml
|
|
340
|
+
// ./achecker.js
|
|
341
|
+
// ./achecker.json
|
|
342
|
+
// ./.config/.achecker.yml
|
|
343
|
+
// ./.config/.achecker.yaml
|
|
344
|
+
// ./.config/achecker.js
|
|
345
|
+
// ./.config/achecker.json
|
|
346
|
+
// The node module, require will load js or json depending on which one is present, in the case
|
|
347
|
+
// both json and js are present it loads js first.
|
|
348
|
+
// Refer to ACConstants.js for more details
|
|
349
|
+
let configFiles = ACConstants_js_1.ACConstants.configFiles;
|
|
350
|
+
// Loop over all the possible location where the config file can reside, if one is found load it and break out.
|
|
351
|
+
for (let i = 0; i < configFiles.length; i++) {
|
|
352
|
+
// Get the full path to the config file we are going to check
|
|
353
|
+
let fileToCheck = pathLib.join(workingDir, configFiles[i]);
|
|
354
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Checking file: " + fileToCheck);
|
|
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_js_1.ACConstants.DEBUG && console.log("File: " + fileToCheck + " exists loading it.");
|
|
364
|
+
ACConstants_js_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_js_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_js_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
|
+
}
|
|
343
392
|
}
|
|
344
|
-
|
|
345
|
-
|
|
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();
|
|
393
|
+
}
|
|
394
|
+
catch (e) {
|
|
371
395
|
ACConstants_js_1.ACConstants.DEBUG && console.log("JSON or JS file does not exists, will load default config.");
|
|
372
|
-
|
|
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];
|
|
396
|
+
}
|
|
379
397
|
}
|
|
380
|
-
}
|
|
398
|
+
}
|
|
399
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("END 'loadConfigFromYAMLorJSONFile' function");
|
|
400
|
+
return config;
|
|
381
401
|
});
|
|
382
402
|
}
|
|
383
403
|
/**
|
|
@@ -397,97 +417,67 @@ function loadConfigFromYAMLorJSONFile() {
|
|
|
397
417
|
* @memberOf this
|
|
398
418
|
*/
|
|
399
419
|
function processConfiguration(config) {
|
|
400
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
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
|
-
});
|
|
420
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
421
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("START 'processConfiguration' function");
|
|
422
|
+
// Variable Decleration
|
|
423
|
+
let ACConfig = null;
|
|
424
|
+
let configFromFile = null;
|
|
425
|
+
// Read in the .yaml (.yml) or .json file to load in the configuration
|
|
426
|
+
configFromFile = yield loadConfigFromYAMLorJSONFile();
|
|
427
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Loaded config from file: ");
|
|
428
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log(configFromFile);
|
|
429
|
+
// In the case configuration was provided in a yaml, yml or json file, then set this as the configuration
|
|
430
|
+
// otherwise load them from the Karma configuration.
|
|
431
|
+
if (configFromFile !== null && typeof (configFromFile) !== "undefined" && Object.keys(configFromFile).length !== 0) {
|
|
432
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("Using config which was loaded from config file.");
|
|
433
|
+
ACConfig = configFromFile;
|
|
434
|
+
}
|
|
435
|
+
else if (config !== null && typeof (config) !== "undefined" && Object.keys(config).length !== 0) {
|
|
436
|
+
// Extract the ACConfig from the overall karma configuration, in the case config file
|
|
437
|
+
// was not provided.
|
|
438
|
+
ACConfig = config;
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
ACConfig = JSON.parse(JSON.stringify(ACConstants_js_1.ACConstants));
|
|
442
|
+
}
|
|
443
|
+
// In the case the ACConfig object is not defined, then define it with default config options so
|
|
444
|
+
// it can be set in window.__karma__.config.ACConfig, so that we know even in the testcases, other
|
|
445
|
+
// wrapper scripts that there was nothing defined at all, and at the same time to make sure that this
|
|
446
|
+
// code was actually executed.
|
|
447
|
+
initializeDefaults(ACConfig);
|
|
448
|
+
// Now we process the final accessibility-checker config object that is build to make sure it is valid, also need to perform some
|
|
449
|
+
// mapping for provided paremeters to actualy read by the engine.
|
|
450
|
+
yield processACConfig(ACConfig);
|
|
451
|
+
// In the case the Karma config is set to config.LOG_DEBUG then also enable the accessibility-checker debuging
|
|
452
|
+
ACConfig.DEBUG = ACConstants_js_1.ACConstants.DEBUG;
|
|
453
|
+
ACConstants_js_1.ACConstants.DEBUG && console.log("END 'processConfiguration' function");
|
|
454
|
+
return ACConfig;
|
|
446
455
|
});
|
|
447
456
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
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
|
-
});
|
|
457
|
+
let config = null;
|
|
458
|
+
class ACConfigManager {
|
|
459
|
+
static setConfig(inConfig) {
|
|
460
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
461
|
+
config = yield processConfiguration(inConfig);
|
|
462
|
+
ReporterManager_js_1.ReporterManager.setConfig(config);
|
|
463
463
|
});
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
467
|
-
return
|
|
468
|
-
return [2 /*return*/, this.getConfigUnsupported()];
|
|
469
|
-
});
|
|
464
|
+
}
|
|
465
|
+
static getConfig() {
|
|
466
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
467
|
+
return this.getConfigUnsupported();
|
|
470
468
|
});
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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
|
-
});
|
|
469
|
+
}
|
|
470
|
+
static getConfigUnsupported() {
|
|
471
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
472
|
+
if (!config) {
|
|
473
|
+
yield ACConfigManager.setConfig();
|
|
474
|
+
}
|
|
475
|
+
return config;
|
|
485
476
|
});
|
|
486
|
-
}
|
|
487
|
-
|
|
477
|
+
}
|
|
478
|
+
static getConfigNow() {
|
|
488
479
|
return config;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
}());
|
|
480
|
+
}
|
|
481
|
+
}
|
|
492
482
|
exports.ACConfigManager = ACConfigManager;
|
|
493
483
|
//# sourceMappingURL=ACConfigManager.js.map
|