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.
Files changed (217) hide show
  1. package/bin/achecker.js +262 -213
  2. package/bin/achecker.js.map +1 -1
  3. package/index.js +63 -21
  4. package/index.js.map +1 -1
  5. package/lib/ACBrowserManager.js +203 -138
  6. package/lib/ACBrowserManager.js.map +1 -1
  7. package/lib/ACEngineManager.js +402 -395
  8. package/lib/ACEngineManager.js.map +1 -1
  9. package/lib/ACHelper.js +642 -581
  10. package/lib/ACHelper.js.map +1 -1
  11. package/lib/common/api-ext/Fetch.js +78 -58
  12. package/lib/common/api-ext/Fetch.js.map +1 -1
  13. package/lib/common/config/ACConfigManager.d.ts +1 -1
  14. package/lib/common/config/ACConfigManager.js +295 -285
  15. package/lib/common/config/ACConfigManager.js.map +1 -1
  16. package/lib/common/config/ACConstants.js +4 -38
  17. package/lib/common/config/ACConstants.js.map +1 -1
  18. package/lib/common/config/IConfig.d.ts +1 -1
  19. package/lib/common/engine/IChecker.d.ts +2 -2
  20. package/lib/common/engine/IEngine.d.ts +1 -1
  21. package/lib/common/engine/IGuideline.d.ts +1 -1
  22. package/lib/common/engine/IMapper.d.ts +1 -1
  23. package/lib/common/engine/IReport.d.ts +4 -4
  24. package/lib/common/engine/IRule.d.ts +4 -4
  25. package/lib/common/engine/IRuleset.d.ts +1 -1
  26. package/lib/common/report/ACReporterCSV.js +77 -42
  27. package/lib/common/report/ACReporterCSV.js.map +1 -1
  28. package/lib/common/report/ACReporterHTML.js +48 -15
  29. package/lib/common/report/ACReporterHTML.js.map +1 -1
  30. package/lib/common/report/ACReporterJSON.js +94 -59
  31. package/lib/common/report/ACReporterJSON.js.map +1 -1
  32. package/lib/common/report/ACReporterMetrics.js +108 -45
  33. package/lib/common/report/ACReporterMetrics.js.map +1 -1
  34. package/lib/common/report/ACReporterXLSX.js +300 -282
  35. package/lib/common/report/ACReporterXLSX.js.map +1 -1
  36. package/lib/common/report/BaselineManager.js +56 -82
  37. package/lib/common/report/BaselineManager.js.map +1 -1
  38. package/lib/common/report/ReporterManager.js +190 -125
  39. package/lib/common/report/ReporterManager.js.map +1 -1
  40. package/lib/common/report/genReport.js +2 -2
  41. package/package.json +4 -10
  42. package/cjs/bin/achecker.d.ts +0 -2
  43. package/cjs/bin/achecker.js +0 -306
  44. package/cjs/bin/achecker.js.map +0 -1
  45. package/cjs/index.d.ts +0 -319
  46. package/cjs/index.js +0 -402
  47. package/cjs/index.js.map +0 -1
  48. package/cjs/lib/ACBrowserManager.d.ts +0 -22
  49. package/cjs/lib/ACBrowserManager.js +0 -172
  50. package/cjs/lib/ACBrowserManager.js.map +0 -1
  51. package/cjs/lib/ACEngineManager.d.ts +0 -19
  52. package/cjs/lib/ACEngineManager.js +0 -457
  53. package/cjs/lib/ACEngineManager.js.map +0 -1
  54. package/cjs/lib/ACHelper.d.ts +0 -2
  55. package/cjs/lib/ACHelper.js +0 -678
  56. package/cjs/lib/ACHelper.js.map +0 -1
  57. package/cjs/lib/api/IChecker.d.ts +0 -28
  58. package/cjs/lib/api/IChecker.js +0 -11
  59. package/cjs/lib/api/IChecker.js.map +0 -1
  60. package/cjs/lib/api/IMapper.d.ts +0 -37
  61. package/cjs/lib/api/IMapper.js +0 -18
  62. package/cjs/lib/api/IMapper.js.map +0 -1
  63. package/cjs/lib/common/api-ext/Fetch.d.ts +0 -17
  64. package/cjs/lib/common/api-ext/Fetch.js +0 -95
  65. package/cjs/lib/common/api-ext/Fetch.js.map +0 -1
  66. package/cjs/lib/common/api-ext/IAbstractAPI.d.ts +0 -33
  67. package/cjs/lib/common/api-ext/IAbstractAPI.js +0 -18
  68. package/cjs/lib/common/api-ext/IAbstractAPI.js.map +0 -1
  69. package/cjs/lib/common/config/ACConfigManager.d.ts +0 -13
  70. package/cjs/lib/common/config/ACConfigManager.js +0 -483
  71. package/cjs/lib/common/config/ACConfigManager.js.map +0 -1
  72. package/cjs/lib/common/config/ACConstants.d.ts +0 -17
  73. package/cjs/lib/common/config/ACConstants.js +0 -111
  74. package/cjs/lib/common/config/ACConstants.js.map +0 -1
  75. package/cjs/lib/common/config/IArchive.d.ts +0 -37
  76. package/cjs/lib/common/config/IArchive.js +0 -18
  77. package/cjs/lib/common/config/IArchive.js.map +0 -1
  78. package/cjs/lib/common/config/IConfig.d.ts +0 -152
  79. package/cjs/lib/common/config/IConfig.js +0 -36
  80. package/cjs/lib/common/config/IConfig.js.map +0 -1
  81. package/cjs/lib/common/engine/IBounds.d.ts +0 -21
  82. package/cjs/lib/common/engine/IBounds.js +0 -18
  83. package/cjs/lib/common/engine/IBounds.js.map +0 -1
  84. package/cjs/lib/common/engine/IChecker.d.ts +0 -23
  85. package/cjs/lib/common/engine/IChecker.js +0 -18
  86. package/cjs/lib/common/engine/IChecker.js.map +0 -1
  87. package/cjs/lib/common/engine/IEngine.d.ts +0 -39
  88. package/cjs/lib/common/engine/IEngine.js +0 -18
  89. package/cjs/lib/common/engine/IEngine.js.map +0 -1
  90. package/cjs/lib/common/engine/IGuideline.d.ts +0 -53
  91. package/cjs/lib/common/engine/IGuideline.js +0 -37
  92. package/cjs/lib/common/engine/IGuideline.js.map +0 -1
  93. package/cjs/lib/common/engine/IMapper.d.ts +0 -32
  94. package/cjs/lib/common/engine/IMapper.js +0 -18
  95. package/cjs/lib/common/engine/IMapper.js.map +0 -1
  96. package/cjs/lib/common/engine/IReport.d.ts +0 -143
  97. package/cjs/lib/common/engine/IReport.js +0 -44
  98. package/cjs/lib/common/engine/IReport.js.map +0 -1
  99. package/cjs/lib/common/engine/IRule.d.ts +0 -100
  100. package/cjs/lib/common/engine/IRule.js +0 -87
  101. package/cjs/lib/common/engine/IRule.js.map +0 -1
  102. package/cjs/lib/common/engine/IRuleset.d.ts +0 -20
  103. package/cjs/lib/common/engine/IRuleset.js +0 -18
  104. package/cjs/lib/common/engine/IRuleset.js.map +0 -1
  105. package/cjs/lib/common/report/ACReporterCSV.d.ts +0 -28
  106. package/cjs/lib/common/report/ACReporterCSV.js +0 -75
  107. package/cjs/lib/common/report/ACReporterCSV.js.map +0 -1
  108. package/cjs/lib/common/report/ACReporterHTML.d.ts +0 -27
  109. package/cjs/lib/common/report/ACReporterHTML.js +0 -61
  110. package/cjs/lib/common/report/ACReporterHTML.js.map +0 -1
  111. package/cjs/lib/common/report/ACReporterJSON.d.ts +0 -36
  112. package/cjs/lib/common/report/ACReporterJSON.js +0 -109
  113. package/cjs/lib/common/report/ACReporterJSON.js.map +0 -1
  114. package/cjs/lib/common/report/ACReporterMetrics.d.ts +0 -78
  115. package/cjs/lib/common/report/ACReporterMetrics.js +0 -135
  116. package/cjs/lib/common/report/ACReporterMetrics.js.map +0 -1
  117. package/cjs/lib/common/report/ACReporterXLSX.d.ts +0 -38
  118. package/cjs/lib/common/report/ACReporterXLSX.js +0 -996
  119. package/cjs/lib/common/report/ACReporterXLSX.js.map +0 -1
  120. package/cjs/lib/common/report/BaselineManager.d.ts +0 -169
  121. package/cjs/lib/common/report/BaselineManager.js +0 -382
  122. package/cjs/lib/common/report/BaselineManager.js.map +0 -1
  123. package/cjs/lib/common/report/ReporterManager.d.ts +0 -79
  124. package/cjs/lib/common/report/ReporterManager.js +0 -469
  125. package/cjs/lib/common/report/ReporterManager.js.map +0 -1
  126. package/cjs/lib/common/report/genReport.d.ts +0 -1
  127. package/cjs/lib/common/report/genReport.js +0 -12
  128. package/cjs/lib/common/report/genReport.js.map +0 -1
  129. package/cjs/package.json +0 -3
  130. package/mjs/bin/achecker.d.ts +0 -2
  131. package/mjs/bin/achecker.js +0 -236
  132. package/mjs/bin/achecker.js.map +0 -1
  133. package/mjs/index.d.ts +0 -319
  134. package/mjs/index.js +0 -368
  135. package/mjs/index.js.map +0 -1
  136. package/mjs/lib/ACBrowserManager.d.ts +0 -22
  137. package/mjs/lib/ACBrowserManager.js +0 -121
  138. package/mjs/lib/ACBrowserManager.js.map +0 -1
  139. package/mjs/lib/ACEngineManager.d.ts +0 -19
  140. package/mjs/lib/ACEngineManager.js +0 -397
  141. package/mjs/lib/ACEngineManager.js.map +0 -1
  142. package/mjs/lib/ACHelper.d.ts +0 -2
  143. package/mjs/lib/ACHelper.js +0 -614
  144. package/mjs/lib/ACHelper.js.map +0 -1
  145. package/mjs/lib/api/IChecker.d.ts +0 -28
  146. package/mjs/lib/api/IChecker.js +0 -8
  147. package/mjs/lib/api/IChecker.js.map +0 -1
  148. package/mjs/lib/api/IMapper.d.ts +0 -37
  149. package/mjs/lib/api/IMapper.js +0 -17
  150. package/mjs/lib/api/IMapper.js.map +0 -1
  151. package/mjs/lib/common/api-ext/Fetch.d.ts +0 -17
  152. package/mjs/lib/common/api-ext/Fetch.js +0 -45
  153. package/mjs/lib/common/api-ext/Fetch.js.map +0 -1
  154. package/mjs/lib/common/api-ext/IAbstractAPI.d.ts +0 -33
  155. package/mjs/lib/common/api-ext/IAbstractAPI.js +0 -17
  156. package/mjs/lib/common/api-ext/IAbstractAPI.js.map +0 -1
  157. package/mjs/lib/common/config/ACConfigManager.d.ts +0 -13
  158. package/mjs/lib/common/config/ACConfigManager.js +0 -421
  159. package/mjs/lib/common/config/ACConfigManager.js.map +0 -1
  160. package/mjs/lib/common/config/ACConstants.d.ts +0 -17
  161. package/mjs/lib/common/config/ACConstants.js +0 -75
  162. package/mjs/lib/common/config/ACConstants.js.map +0 -1
  163. package/mjs/lib/common/config/IArchive.d.ts +0 -37
  164. package/mjs/lib/common/config/IArchive.js +0 -17
  165. package/mjs/lib/common/config/IArchive.js.map +0 -1
  166. package/mjs/lib/common/config/IConfig.d.ts +0 -152
  167. package/mjs/lib/common/config/IConfig.js +0 -33
  168. package/mjs/lib/common/config/IConfig.js.map +0 -1
  169. package/mjs/lib/common/engine/IBounds.d.ts +0 -21
  170. package/mjs/lib/common/engine/IBounds.js +0 -17
  171. package/mjs/lib/common/engine/IBounds.js.map +0 -1
  172. package/mjs/lib/common/engine/IChecker.d.ts +0 -23
  173. package/mjs/lib/common/engine/IChecker.js +0 -17
  174. package/mjs/lib/common/engine/IChecker.js.map +0 -1
  175. package/mjs/lib/common/engine/IEngine.d.ts +0 -39
  176. package/mjs/lib/common/engine/IEngine.js +0 -17
  177. package/mjs/lib/common/engine/IEngine.js.map +0 -1
  178. package/mjs/lib/common/engine/IGuideline.d.ts +0 -53
  179. package/mjs/lib/common/engine/IGuideline.js +0 -34
  180. package/mjs/lib/common/engine/IGuideline.js.map +0 -1
  181. package/mjs/lib/common/engine/IMapper.d.ts +0 -32
  182. package/mjs/lib/common/engine/IMapper.js +0 -17
  183. package/mjs/lib/common/engine/IMapper.js.map +0 -1
  184. package/mjs/lib/common/engine/IReport.d.ts +0 -143
  185. package/mjs/lib/common/engine/IReport.js +0 -36
  186. package/mjs/lib/common/engine/IReport.js.map +0 -1
  187. package/mjs/lib/common/engine/IRule.d.ts +0 -100
  188. package/mjs/lib/common/engine/IRule.js +0 -79
  189. package/mjs/lib/common/engine/IRule.js.map +0 -1
  190. package/mjs/lib/common/engine/IRuleset.d.ts +0 -20
  191. package/mjs/lib/common/engine/IRuleset.js +0 -17
  192. package/mjs/lib/common/engine/IRuleset.js.map +0 -1
  193. package/mjs/lib/common/report/ACReporterCSV.d.ts +0 -28
  194. package/mjs/lib/common/report/ACReporterCSV.js +0 -60
  195. package/mjs/lib/common/report/ACReporterCSV.js.map +0 -1
  196. package/mjs/lib/common/report/ACReporterHTML.d.ts +0 -27
  197. package/mjs/lib/common/report/ACReporterHTML.js +0 -46
  198. package/mjs/lib/common/report/ACReporterHTML.js.map +0 -1
  199. package/mjs/lib/common/report/ACReporterJSON.d.ts +0 -36
  200. package/mjs/lib/common/report/ACReporterJSON.js +0 -94
  201. package/mjs/lib/common/report/ACReporterJSON.js.map +0 -1
  202. package/mjs/lib/common/report/ACReporterMetrics.d.ts +0 -78
  203. package/mjs/lib/common/report/ACReporterMetrics.js +0 -122
  204. package/mjs/lib/common/report/ACReporterMetrics.js.map +0 -1
  205. package/mjs/lib/common/report/ACReporterXLSX.d.ts +0 -38
  206. package/mjs/lib/common/report/ACReporterXLSX.js +0 -948
  207. package/mjs/lib/common/report/ACReporterXLSX.js.map +0 -1
  208. package/mjs/lib/common/report/BaselineManager.d.ts +0 -169
  209. package/mjs/lib/common/report/BaselineManager.js +0 -348
  210. package/mjs/lib/common/report/BaselineManager.js.map +0 -1
  211. package/mjs/lib/common/report/ReporterManager.d.ts +0 -79
  212. package/mjs/lib/common/report/ReporterManager.js +0 -469
  213. package/mjs/lib/common/report/ReporterManager.js.map +0 -1
  214. package/mjs/lib/common/report/genReport.d.ts +0 -1
  215. package/mjs/lib/common/report/genReport.js +0 -9
  216. package/mjs/lib/common/report/genReport.js.map +0 -1
  217. 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 __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
- const pathLib = __importStar(require("path"));
67
- const fs = __importStar(require("fs"));
68
- const YAML = __importStar(require("js-yaml"));
69
- const ACConstants_1 = require("./ACConstants");
70
- const crypto = __importStar(require("crypto"));
71
- const Fetch_1 = require("../api-ext/Fetch");
72
- const ReporterManager_1 = require("../report/ReporterManager");
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
- ACConstants_1.ACConstants.DEBUG && console.log("START 'convertPolicies' function");
97
- ACConstants_1.ACConstants.DEBUG && console.log("Converting policy provided to Array: ");
98
- ACConstants_1.ACConstants.DEBUG && console.log(policies);
99
- ACConstants_1.ACConstants.DEBUG && console.log("END 'convertPolicies' function");
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
- const versionRE = /[0-9.]+(-rc\.[0-9]+)?/;
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
- let split1A = versionA.split("-rc.");
128
- let split1B = versionB.split("-rc.");
115
+ var split1A = versionA.split("-rc.");
116
+ var split1B = versionB.split("-rc.");
129
117
  // Get x.y.z into [x,y,z]
130
- let split2A = split1A[0].split(".");
131
- let split2B = split1B[0].split(".");
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
- let minLength = Math.min(split2A.length, split2B.length);
134
- for (let idx = 0; idx < minLength; ++idx) {
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
- const validArchiveKeywords = ["latest", "preview", "versioned"];
156
- for (const archive of archives) {
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
- ACConstants_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_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";
203
- }
204
- ruleArchiveParse = yield (0, Fetch_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_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`;
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
- ACConstants_1.ACConstants.DEBUG && console.log("START 'initializeDefaults' function");
280
- ACConstants_1.ACConstants.DEBUG && console.log("Config before initialization: ");
281
- ACConstants_1.ACConstants.DEBUG && console.log(config);
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 || ACConstants_1.ACConstants.ruleArchiveLabel || config.ruleArchive;
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 = ACConstants_1.ACConstants.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
- 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
- }
289
+ var packageDir = __dirname;
302
290
  while (!fs.existsSync(pathLib.join(packageDir, "package.json"))) {
303
291
  packageDir = pathLib.join(packageDir, "..");
304
292
  }
305
- const packageObject = JSON.parse(fs.readFileSync(pathLib.join(packageDir, 'package.json')).toString());
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 (const key in ACConstants_1.ACConstants) {
314
- config[key] = typeof config[key] !== "undefined" ? config[key] : ACConstants_1.ACConstants[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
- ACConstants_1.ACConstants.DEBUG && console.log("Config after initialization: ");
317
- ACConstants_1.ACConstants.DEBUG && console.log(config);
318
- ACConstants_1.ACConstants.DEBUG && console.log("END 'initializeDefaults' function");
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
- ACConstants_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_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_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_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_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
- catch (e) {
395
- ACConstants_1.ACConstants.DEBUG && console.log("JSON or JS file does not exists, will load default config.");
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
- ACConstants_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_1.ACConstants.DEBUG && console.log("Loaded config from file: ");
428
- ACConstants_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_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_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_1.ACConstants.DEBUG;
453
- ACConstants_1.ACConstants.DEBUG && console.log("END 'processConfiguration' function");
454
- return ACConfig;
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
- 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_1.ReporterManager.setConfig(config);
463
- });
448
+ var config = null;
449
+ var ACConfigManager = /** @class */ (function () {
450
+ function ACConfigManager() {
464
451
  }
465
- static getConfig() {
466
- return __awaiter(this, void 0, void 0, function* () {
467
- return this.getConfigUnsupported();
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
- static getConfigUnsupported() {
471
- return __awaiter(this, void 0, void 0, function* () {
472
- if (!config) {
473
- yield ACConfigManager.setConfig();
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
- static getConfigNow() {
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