@holmdigital/engine 3.1.4 → 3.1.5
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/dist/{chunk-5GV3T3S4.mjs → chunk-QIM5ZZCX.mjs} +17 -6
- package/dist/cli/index.js +16 -6
- package/dist/cli/index.mjs +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +18 -6
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
|
@@ -226,20 +226,28 @@ var CRITERION_OVERRIDE = {
|
|
|
226
226
|
"link-name": "4.1.2",
|
|
227
227
|
"area-alt": "4.1.2"
|
|
228
228
|
};
|
|
229
|
-
function
|
|
229
|
+
function getSelfMatchingRuleIds(rules) {
|
|
230
|
+
const axeIds = new Set(axeCore.getRules().map((r) => r.ruleId));
|
|
231
|
+
return new Set(rules.filter((r) => axeIds.has(r.ruleId)).map((r) => r.ruleId));
|
|
232
|
+
}
|
|
233
|
+
function selectMappedRuleId(ruleId, tags, rules, selfMatchingIds = /* @__PURE__ */ new Set()) {
|
|
234
|
+
const ruleForCriterion = (c) => {
|
|
235
|
+
const holders = rules.filter((r) => r.wcagCriteria === c);
|
|
236
|
+
return holders.find((r) => !selfMatchingIds.has(r.ruleId)) ?? holders[0];
|
|
237
|
+
};
|
|
230
238
|
const criteria = criteriaFromTags(tags);
|
|
231
239
|
const override = CRITERION_OVERRIDE[ruleId];
|
|
232
240
|
if (override && criteria.includes(override)) {
|
|
233
|
-
const r =
|
|
241
|
+
const r = ruleForCriterion(override);
|
|
234
242
|
if (r) return r.ruleId;
|
|
235
243
|
}
|
|
236
|
-
const matched = criteria.map((c) =>
|
|
244
|
+
const matched = criteria.map((c) => ruleForCriterion(c)).filter((r) => !!r);
|
|
237
245
|
if (matched.length === 0) return null;
|
|
238
246
|
matched.sort((a, b) => compareCriteria(a.wcagCriteria, b.wcagCriteria));
|
|
239
247
|
return matched[0].ruleId;
|
|
240
248
|
}
|
|
241
249
|
function getEngineVersion() {
|
|
242
|
-
return "3.1.
|
|
250
|
+
return "3.1.5";
|
|
243
251
|
}
|
|
244
252
|
function getStandardsVersion() {
|
|
245
253
|
try {
|
|
@@ -465,12 +473,13 @@ var RegulatoryScanner = class {
|
|
|
465
473
|
const { getCurrentLang } = await import("./i18n-7RPBNX7F.mjs");
|
|
466
474
|
const lang = getCurrentLang();
|
|
467
475
|
const allRules = getAllConvergenceRules(lang);
|
|
476
|
+
const selfMatchingIds = getSelfMatchingRuleIds(allRules);
|
|
468
477
|
return axeResults.violations.map((violation, index) => {
|
|
469
478
|
const impact = violation.impact || "moderate";
|
|
470
479
|
const risk = impactToRisk[impact] || "medium";
|
|
471
480
|
let report = generateRegulatoryReport(violation.id, lang);
|
|
472
481
|
if (!report) {
|
|
473
|
-
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
482
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules, selfMatchingIds);
|
|
474
483
|
if (ruleId) report = generateRegulatoryReport(ruleId, lang);
|
|
475
484
|
}
|
|
476
485
|
const plainLanguage = index < KLARSPRAK_TOP_N ? report?.plainLanguage : void 0;
|
|
@@ -518,10 +527,11 @@ var RegulatoryScanner = class {
|
|
|
518
527
|
const { getCurrentLang } = await import("./i18n-7RPBNX7F.mjs");
|
|
519
528
|
const lang = getCurrentLang();
|
|
520
529
|
const allRules = getAllConvergenceRules(lang);
|
|
530
|
+
const selfMatchingIds = getSelfMatchingRuleIds(allRules);
|
|
521
531
|
for (const violation of axeResults.violations) {
|
|
522
532
|
let report = generateRegulatoryReport(violation.id, lang);
|
|
523
533
|
if (!report) {
|
|
524
|
-
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
534
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules, selfMatchingIds);
|
|
525
535
|
if (ruleId) {
|
|
526
536
|
report = generateRegulatoryReport(ruleId, lang);
|
|
527
537
|
}
|
|
@@ -1208,6 +1218,7 @@ export {
|
|
|
1208
1218
|
probeWithoutJavaScript,
|
|
1209
1219
|
wcagTagToCriterion,
|
|
1210
1220
|
criteriaFromTags,
|
|
1221
|
+
getSelfMatchingRuleIds,
|
|
1211
1222
|
selectMappedRuleId,
|
|
1212
1223
|
getEngineVersion,
|
|
1213
1224
|
RegulatoryScanner,
|
package/dist/cli/index.js
CHANGED
|
@@ -1475,20 +1475,28 @@ var CRITERION_OVERRIDE = {
|
|
|
1475
1475
|
"link-name": "4.1.2",
|
|
1476
1476
|
"area-alt": "4.1.2"
|
|
1477
1477
|
};
|
|
1478
|
-
function
|
|
1478
|
+
function getSelfMatchingRuleIds(rules) {
|
|
1479
|
+
const axeIds = new Set(import_axe_core.default.getRules().map((r) => r.ruleId));
|
|
1480
|
+
return new Set(rules.filter((r) => axeIds.has(r.ruleId)).map((r) => r.ruleId));
|
|
1481
|
+
}
|
|
1482
|
+
function selectMappedRuleId(ruleId, tags, rules, selfMatchingIds = /* @__PURE__ */ new Set()) {
|
|
1483
|
+
const ruleForCriterion = (c) => {
|
|
1484
|
+
const holders = rules.filter((r) => r.wcagCriteria === c);
|
|
1485
|
+
return holders.find((r) => !selfMatchingIds.has(r.ruleId)) ?? holders[0];
|
|
1486
|
+
};
|
|
1479
1487
|
const criteria = criteriaFromTags(tags);
|
|
1480
1488
|
const override = CRITERION_OVERRIDE[ruleId];
|
|
1481
1489
|
if (override && criteria.includes(override)) {
|
|
1482
|
-
const r =
|
|
1490
|
+
const r = ruleForCriterion(override);
|
|
1483
1491
|
if (r) return r.ruleId;
|
|
1484
1492
|
}
|
|
1485
|
-
const matched = criteria.map((c) =>
|
|
1493
|
+
const matched = criteria.map((c) => ruleForCriterion(c)).filter((r) => !!r);
|
|
1486
1494
|
if (matched.length === 0) return null;
|
|
1487
1495
|
matched.sort((a, b) => compareCriteria(a.wcagCriteria, b.wcagCriteria));
|
|
1488
1496
|
return matched[0].ruleId;
|
|
1489
1497
|
}
|
|
1490
1498
|
function getEngineVersion() {
|
|
1491
|
-
return "3.1.
|
|
1499
|
+
return "3.1.5";
|
|
1492
1500
|
}
|
|
1493
1501
|
function getStandardsVersion() {
|
|
1494
1502
|
try {
|
|
@@ -1714,12 +1722,13 @@ var RegulatoryScanner = class {
|
|
|
1714
1722
|
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1715
1723
|
const lang = getCurrentLang2();
|
|
1716
1724
|
const allRules = getAllConvergenceRules2(lang);
|
|
1725
|
+
const selfMatchingIds = getSelfMatchingRuleIds(allRules);
|
|
1717
1726
|
return axeResults.violations.map((violation, index) => {
|
|
1718
1727
|
const impact = violation.impact || "moderate";
|
|
1719
1728
|
const risk = impactToRisk[impact] || "medium";
|
|
1720
1729
|
let report = generateRegulatoryReport(violation.id, lang);
|
|
1721
1730
|
if (!report) {
|
|
1722
|
-
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
1731
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules, selfMatchingIds);
|
|
1723
1732
|
if (ruleId) report = generateRegulatoryReport(ruleId, lang);
|
|
1724
1733
|
}
|
|
1725
1734
|
const plainLanguage = index < KLARSPRAK_TOP_N ? report?.plainLanguage : void 0;
|
|
@@ -1767,10 +1776,11 @@ var RegulatoryScanner = class {
|
|
|
1767
1776
|
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1768
1777
|
const lang = getCurrentLang2();
|
|
1769
1778
|
const allRules = getAllConvergenceRules2(lang);
|
|
1779
|
+
const selfMatchingIds = getSelfMatchingRuleIds(allRules);
|
|
1770
1780
|
for (const violation of axeResults.violations) {
|
|
1771
1781
|
let report = generateRegulatoryReport(violation.id, lang);
|
|
1772
1782
|
if (!report) {
|
|
1773
|
-
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
1783
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules, selfMatchingIds);
|
|
1774
1784
|
if (ruleId) {
|
|
1775
1785
|
report = generateRegulatoryReport(ruleId, lang);
|
|
1776
1786
|
}
|
package/dist/cli/index.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -44,7 +44,8 @@ declare function probeWithoutJavaScript(browser: Browser, options: NoScriptProbe
|
|
|
44
44
|
|
|
45
45
|
declare function wcagTagToCriterion(tag: string): string | null;
|
|
46
46
|
declare function criteriaFromTags(tags: string[]): string[];
|
|
47
|
-
declare function
|
|
47
|
+
declare function getSelfMatchingRuleIds(rules: ConvergenceRule[]): Set<string>;
|
|
48
|
+
declare function selectMappedRuleId(ruleId: string, tags: string[], rules: ConvergenceRule[], selfMatchingIds?: Set<string>): string | null;
|
|
48
49
|
declare function getEngineVersion(): string;
|
|
49
50
|
interface ScannerOptions {
|
|
50
51
|
url: string;
|
|
@@ -249,4 +250,4 @@ declare function resolveNationalLawReference(country: Country, sector: 'public'
|
|
|
249
250
|
declare function generateStatementContent(result: ScanResult, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<string>;
|
|
250
251
|
declare function generateStatement(result: ScanResult, outputPath: string, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<void>;
|
|
251
252
|
|
|
252
|
-
export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, criteriaFromTags, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, probeWithoutJavaScript, resolveNationalLawReference, selectMappedRuleId, setLanguage, t, wcagTagToCriterion };
|
|
253
|
+
export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, criteriaFromTags, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, getSelfMatchingRuleIds, probeWithoutJavaScript, resolveNationalLawReference, selectMappedRuleId, setLanguage, t, wcagTagToCriterion };
|
package/dist/index.d.ts
CHANGED
|
@@ -44,7 +44,8 @@ declare function probeWithoutJavaScript(browser: Browser, options: NoScriptProbe
|
|
|
44
44
|
|
|
45
45
|
declare function wcagTagToCriterion(tag: string): string | null;
|
|
46
46
|
declare function criteriaFromTags(tags: string[]): string[];
|
|
47
|
-
declare function
|
|
47
|
+
declare function getSelfMatchingRuleIds(rules: ConvergenceRule[]): Set<string>;
|
|
48
|
+
declare function selectMappedRuleId(ruleId: string, tags: string[], rules: ConvergenceRule[], selfMatchingIds?: Set<string>): string | null;
|
|
48
49
|
declare function getEngineVersion(): string;
|
|
49
50
|
interface ScannerOptions {
|
|
50
51
|
url: string;
|
|
@@ -249,4 +250,4 @@ declare function resolveNationalLawReference(country: Country, sector: 'public'
|
|
|
249
250
|
declare function generateStatementContent(result: ScanResult, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<string>;
|
|
250
251
|
declare function generateStatement(result: ScanResult, outputPath: string, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<void>;
|
|
251
252
|
|
|
252
|
-
export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, criteriaFromTags, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, probeWithoutJavaScript, resolveNationalLawReference, selectMappedRuleId, setLanguage, t, wcagTagToCriterion };
|
|
253
|
+
export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, criteriaFromTags, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, getSelfMatchingRuleIds, probeWithoutJavaScript, resolveNationalLawReference, selectMappedRuleId, setLanguage, t, wcagTagToCriterion };
|
package/dist/index.js
CHANGED
|
@@ -911,6 +911,7 @@ __export(index_exports, {
|
|
|
911
911
|
generateStatementContent: () => generateStatementContent,
|
|
912
912
|
getCurrentLang: () => getCurrentLang,
|
|
913
913
|
getEngineVersion: () => getEngineVersion,
|
|
914
|
+
getSelfMatchingRuleIds: () => getSelfMatchingRuleIds,
|
|
914
915
|
probeWithoutJavaScript: () => probeWithoutJavaScript,
|
|
915
916
|
resolveNationalLawReference: () => resolveNationalLawReference,
|
|
916
917
|
selectMappedRuleId: () => selectMappedRuleId,
|
|
@@ -1145,20 +1146,28 @@ var CRITERION_OVERRIDE = {
|
|
|
1145
1146
|
"link-name": "4.1.2",
|
|
1146
1147
|
"area-alt": "4.1.2"
|
|
1147
1148
|
};
|
|
1148
|
-
function
|
|
1149
|
+
function getSelfMatchingRuleIds(rules) {
|
|
1150
|
+
const axeIds = new Set(import_axe_core.default.getRules().map((r) => r.ruleId));
|
|
1151
|
+
return new Set(rules.filter((r) => axeIds.has(r.ruleId)).map((r) => r.ruleId));
|
|
1152
|
+
}
|
|
1153
|
+
function selectMappedRuleId(ruleId, tags, rules, selfMatchingIds = /* @__PURE__ */ new Set()) {
|
|
1154
|
+
const ruleForCriterion = (c) => {
|
|
1155
|
+
const holders = rules.filter((r) => r.wcagCriteria === c);
|
|
1156
|
+
return holders.find((r) => !selfMatchingIds.has(r.ruleId)) ?? holders[0];
|
|
1157
|
+
};
|
|
1149
1158
|
const criteria = criteriaFromTags(tags);
|
|
1150
1159
|
const override = CRITERION_OVERRIDE[ruleId];
|
|
1151
1160
|
if (override && criteria.includes(override)) {
|
|
1152
|
-
const r =
|
|
1161
|
+
const r = ruleForCriterion(override);
|
|
1153
1162
|
if (r) return r.ruleId;
|
|
1154
1163
|
}
|
|
1155
|
-
const matched = criteria.map((c) =>
|
|
1164
|
+
const matched = criteria.map((c) => ruleForCriterion(c)).filter((r) => !!r);
|
|
1156
1165
|
if (matched.length === 0) return null;
|
|
1157
1166
|
matched.sort((a, b) => compareCriteria(a.wcagCriteria, b.wcagCriteria));
|
|
1158
1167
|
return matched[0].ruleId;
|
|
1159
1168
|
}
|
|
1160
1169
|
function getEngineVersion() {
|
|
1161
|
-
return "3.1.
|
|
1170
|
+
return "3.1.5";
|
|
1162
1171
|
}
|
|
1163
1172
|
function getStandardsVersion() {
|
|
1164
1173
|
try {
|
|
@@ -1384,12 +1393,13 @@ var RegulatoryScanner = class {
|
|
|
1384
1393
|
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1385
1394
|
const lang = getCurrentLang2();
|
|
1386
1395
|
const allRules = getAllConvergenceRules(lang);
|
|
1396
|
+
const selfMatchingIds = getSelfMatchingRuleIds(allRules);
|
|
1387
1397
|
return axeResults.violations.map((violation, index) => {
|
|
1388
1398
|
const impact = violation.impact || "moderate";
|
|
1389
1399
|
const risk = impactToRisk[impact] || "medium";
|
|
1390
1400
|
let report = generateRegulatoryReport(violation.id, lang);
|
|
1391
1401
|
if (!report) {
|
|
1392
|
-
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
1402
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules, selfMatchingIds);
|
|
1393
1403
|
if (ruleId) report = generateRegulatoryReport(ruleId, lang);
|
|
1394
1404
|
}
|
|
1395
1405
|
const plainLanguage = index < KLARSPRAK_TOP_N ? report?.plainLanguage : void 0;
|
|
@@ -1437,10 +1447,11 @@ var RegulatoryScanner = class {
|
|
|
1437
1447
|
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1438
1448
|
const lang = getCurrentLang2();
|
|
1439
1449
|
const allRules = getAllConvergenceRules(lang);
|
|
1450
|
+
const selfMatchingIds = getSelfMatchingRuleIds(allRules);
|
|
1440
1451
|
for (const violation of axeResults.violations) {
|
|
1441
1452
|
let report = generateRegulatoryReport(violation.id, lang);
|
|
1442
1453
|
if (!report) {
|
|
1443
|
-
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
1454
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules, selfMatchingIds);
|
|
1444
1455
|
if (ruleId) {
|
|
1445
1456
|
report = generateRegulatoryReport(ruleId, lang);
|
|
1446
1457
|
}
|
|
@@ -2134,6 +2145,7 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
|
|
|
2134
2145
|
generateStatementContent,
|
|
2135
2146
|
getCurrentLang,
|
|
2136
2147
|
getEngineVersion,
|
|
2148
|
+
getSelfMatchingRuleIds,
|
|
2137
2149
|
probeWithoutJavaScript,
|
|
2138
2150
|
resolveNationalLawReference,
|
|
2139
2151
|
selectMappedRuleId,
|
package/dist/index.mjs
CHANGED
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
generateStatement,
|
|
10
10
|
generateStatementContent,
|
|
11
11
|
getEngineVersion,
|
|
12
|
+
getSelfMatchingRuleIds,
|
|
12
13
|
probeWithoutJavaScript,
|
|
13
14
|
resolveNationalLawReference,
|
|
14
15
|
selectMappedRuleId,
|
|
15
16
|
wcagTagToCriterion
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-QIM5ZZCX.mjs";
|
|
17
18
|
import {
|
|
18
19
|
getCurrentLang,
|
|
19
20
|
setLanguage,
|
|
@@ -33,6 +34,7 @@ export {
|
|
|
33
34
|
generateStatementContent,
|
|
34
35
|
getCurrentLang,
|
|
35
36
|
getEngineVersion,
|
|
37
|
+
getSelfMatchingRuleIds,
|
|
36
38
|
probeWithoutJavaScript,
|
|
37
39
|
resolveNationalLawReference,
|
|
38
40
|
selectMappedRuleId,
|