@holmdigital/engine 2.11.0 → 2.12.0
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-RVJPW54H.mjs → chunk-5S6UAABI.mjs} +17 -6
- package/dist/cli/index.js +23 -7
- package/dist/cli/index.mjs +7 -2
- package/dist/index.js +17 -6
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -138,7 +138,7 @@ var HtmlValidator = class {
|
|
|
138
138
|
// src/core/regulatory-scanner.ts
|
|
139
139
|
import { readFileSync } from "fs";
|
|
140
140
|
function getEngineVersion() {
|
|
141
|
-
return "2.
|
|
141
|
+
return "2.12.0";
|
|
142
142
|
}
|
|
143
143
|
function getStandardsVersion() {
|
|
144
144
|
try {
|
|
@@ -247,7 +247,7 @@ var RegulatoryScanner = class {
|
|
|
247
247
|
});
|
|
248
248
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
249
249
|
passedCount = axeResults.passes?.length || 0;
|
|
250
|
-
const regulatoryReports = this.options.light ? this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
250
|
+
const regulatoryReports = this.options.light ? await this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
251
251
|
const scanDuration = Date.now() - startTime;
|
|
252
252
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
253
253
|
if (htmlValidation) {
|
|
@@ -281,19 +281,29 @@ var RegulatoryScanner = class {
|
|
|
281
281
|
await page.evaluate(axeSource);
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
|
-
* Light enrichment — maps axe severity directly
|
|
285
|
-
*
|
|
284
|
+
* Light enrichment — maps axe severity directly, then attaches plain-language
|
|
285
|
+
* (klarspråk) copy to the top findings so the public light scan can render
|
|
286
|
+
* readable cards instead of raw axe rule ids. Stays light: a single standards
|
|
287
|
+
* import and a lookup only for the first N findings (the widget shows a
|
|
288
|
+
* handful). The language follows getCurrentLang() — the public Swedish scan
|
|
289
|
+
* sets 'sv'; generateRegulatoryReport carries the built-in EN fallback for
|
|
290
|
+
* rules lacking the target language.
|
|
286
291
|
*/
|
|
287
|
-
enrichResultsLight(axeResults) {
|
|
292
|
+
async enrichResultsLight(axeResults) {
|
|
288
293
|
const impactToRisk = {
|
|
289
294
|
critical: "critical",
|
|
290
295
|
serious: "high",
|
|
291
296
|
moderate: "medium",
|
|
292
297
|
minor: "low"
|
|
293
298
|
};
|
|
294
|
-
|
|
299
|
+
const KLARSPRAK_TOP_N = 8;
|
|
300
|
+
const { generateRegulatoryReport } = await import("@holmdigital/standards");
|
|
301
|
+
const { getCurrentLang } = await import("./i18n-7WMKI7JK.mjs");
|
|
302
|
+
const lang = getCurrentLang();
|
|
303
|
+
return axeResults.violations.map((violation, index) => {
|
|
295
304
|
const impact = violation.impact || "moderate";
|
|
296
305
|
const risk = impactToRisk[impact] || "medium";
|
|
306
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? generateRegulatoryReport(violation.id, lang)?.plainLanguage : void 0;
|
|
297
307
|
return {
|
|
298
308
|
ruleId: violation.id,
|
|
299
309
|
wcagCriteria: violation.tags.find((t) => t.startsWith("wcag")) || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
@@ -301,6 +311,7 @@ var RegulatoryScanner = class {
|
|
|
301
311
|
dosLagenReference: "",
|
|
302
312
|
diggRisk: risk,
|
|
303
313
|
eaaImpact: risk,
|
|
314
|
+
plainLanguage,
|
|
304
315
|
remediation: {
|
|
305
316
|
description: violation.help,
|
|
306
317
|
technicalGuidance: violation.description,
|
package/dist/cli/index.js
CHANGED
|
@@ -1185,7 +1185,7 @@ var HtmlValidator = class {
|
|
|
1185
1185
|
// src/core/regulatory-scanner.ts
|
|
1186
1186
|
var import_node_fs = require("fs");
|
|
1187
1187
|
function getEngineVersion() {
|
|
1188
|
-
return "2.
|
|
1188
|
+
return "2.12.0";
|
|
1189
1189
|
}
|
|
1190
1190
|
function getStandardsVersion() {
|
|
1191
1191
|
try {
|
|
@@ -1294,7 +1294,7 @@ var RegulatoryScanner = class {
|
|
|
1294
1294
|
});
|
|
1295
1295
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
1296
1296
|
passedCount = axeResults.passes?.length || 0;
|
|
1297
|
-
const regulatoryReports = this.options.light ? this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1297
|
+
const regulatoryReports = this.options.light ? await this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1298
1298
|
const scanDuration = Date.now() - startTime;
|
|
1299
1299
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
1300
1300
|
if (htmlValidation) {
|
|
@@ -1328,19 +1328,29 @@ var RegulatoryScanner = class {
|
|
|
1328
1328
|
await page.evaluate(axeSource);
|
|
1329
1329
|
}
|
|
1330
1330
|
/**
|
|
1331
|
-
* Light enrichment — maps axe severity directly
|
|
1332
|
-
*
|
|
1331
|
+
* Light enrichment — maps axe severity directly, then attaches plain-language
|
|
1332
|
+
* (klarspråk) copy to the top findings so the public light scan can render
|
|
1333
|
+
* readable cards instead of raw axe rule ids. Stays light: a single standards
|
|
1334
|
+
* import and a lookup only for the first N findings (the widget shows a
|
|
1335
|
+
* handful). The language follows getCurrentLang() — the public Swedish scan
|
|
1336
|
+
* sets 'sv'; generateRegulatoryReport carries the built-in EN fallback for
|
|
1337
|
+
* rules lacking the target language.
|
|
1333
1338
|
*/
|
|
1334
|
-
enrichResultsLight(axeResults) {
|
|
1339
|
+
async enrichResultsLight(axeResults) {
|
|
1335
1340
|
const impactToRisk = {
|
|
1336
1341
|
critical: "critical",
|
|
1337
1342
|
serious: "high",
|
|
1338
1343
|
moderate: "medium",
|
|
1339
1344
|
minor: "low"
|
|
1340
1345
|
};
|
|
1341
|
-
|
|
1346
|
+
const KLARSPRAK_TOP_N = 8;
|
|
1347
|
+
const { generateRegulatoryReport } = await import("@holmdigital/standards");
|
|
1348
|
+
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1349
|
+
const lang = getCurrentLang2();
|
|
1350
|
+
return axeResults.violations.map((violation, index) => {
|
|
1342
1351
|
const impact = violation.impact || "moderate";
|
|
1343
1352
|
const risk = impactToRisk[impact] || "medium";
|
|
1353
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? generateRegulatoryReport(violation.id, lang)?.plainLanguage : void 0;
|
|
1344
1354
|
return {
|
|
1345
1355
|
ruleId: violation.id,
|
|
1346
1356
|
wcagCriteria: violation.tags.find((t2) => t2.startsWith("wcag")) || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
@@ -1348,6 +1358,7 @@ var RegulatoryScanner = class {
|
|
|
1348
1358
|
dosLagenReference: "",
|
|
1349
1359
|
diggRisk: risk,
|
|
1350
1360
|
eaaImpact: risk,
|
|
1361
|
+
plainLanguage,
|
|
1351
1362
|
remediation: {
|
|
1352
1363
|
description: violation.help,
|
|
1353
1364
|
technicalGuidance: violation.description,
|
|
@@ -2870,7 +2881,12 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2870
2881
|
topIssues: result.reports.slice(0, 5).map((r) => ({
|
|
2871
2882
|
id: r.ruleId,
|
|
2872
2883
|
impact: r.holmdigitalInsight.diggRisk,
|
|
2873
|
-
description: r.remediation.description
|
|
2884
|
+
description: r.remediation.description,
|
|
2885
|
+
// Plain-language (klarspråk) fields, present when the rule
|
|
2886
|
+
// is covered; undefined values drop out of the JSON.
|
|
2887
|
+
headline: r.plainLanguage?.headline,
|
|
2888
|
+
businessImpact: r.plainLanguage?.businessImpact,
|
|
2889
|
+
impactLevel: r.plainLanguage?.impactLevel
|
|
2874
2890
|
}))
|
|
2875
2891
|
};
|
|
2876
2892
|
console.log(JSON.stringify(lightResult, null, 2));
|
package/dist/cli/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
generateStatement,
|
|
8
8
|
generateStatementContent,
|
|
9
9
|
getEngineVersion
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-5S6UAABI.mjs";
|
|
11
11
|
import {
|
|
12
12
|
groupReportsByRule,
|
|
13
13
|
impactBreakdown,
|
|
@@ -932,7 +932,12 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
932
932
|
topIssues: result.reports.slice(0, 5).map((r) => ({
|
|
933
933
|
id: r.ruleId,
|
|
934
934
|
impact: r.holmdigitalInsight.diggRisk,
|
|
935
|
-
description: r.remediation.description
|
|
935
|
+
description: r.remediation.description,
|
|
936
|
+
// Plain-language (klarspråk) fields, present when the rule
|
|
937
|
+
// is covered; undefined values drop out of the JSON.
|
|
938
|
+
headline: r.plainLanguage?.headline,
|
|
939
|
+
businessImpact: r.plainLanguage?.businessImpact,
|
|
940
|
+
impactLevel: r.plainLanguage?.impactLevel
|
|
936
941
|
}))
|
|
937
942
|
};
|
|
938
943
|
console.log(JSON.stringify(lightResult, null, 2));
|
package/dist/index.js
CHANGED
|
@@ -911,7 +911,7 @@ var HtmlValidator = class {
|
|
|
911
911
|
// src/core/regulatory-scanner.ts
|
|
912
912
|
var import_node_fs = require("fs");
|
|
913
913
|
function getEngineVersion() {
|
|
914
|
-
return "2.
|
|
914
|
+
return "2.12.0";
|
|
915
915
|
}
|
|
916
916
|
function getStandardsVersion() {
|
|
917
917
|
try {
|
|
@@ -1020,7 +1020,7 @@ var RegulatoryScanner = class {
|
|
|
1020
1020
|
});
|
|
1021
1021
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
1022
1022
|
passedCount = axeResults.passes?.length || 0;
|
|
1023
|
-
const regulatoryReports = this.options.light ? this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1023
|
+
const regulatoryReports = this.options.light ? await this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1024
1024
|
const scanDuration = Date.now() - startTime;
|
|
1025
1025
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
1026
1026
|
if (htmlValidation) {
|
|
@@ -1054,19 +1054,29 @@ var RegulatoryScanner = class {
|
|
|
1054
1054
|
await page.evaluate(axeSource);
|
|
1055
1055
|
}
|
|
1056
1056
|
/**
|
|
1057
|
-
* Light enrichment — maps axe severity directly
|
|
1058
|
-
*
|
|
1057
|
+
* Light enrichment — maps axe severity directly, then attaches plain-language
|
|
1058
|
+
* (klarspråk) copy to the top findings so the public light scan can render
|
|
1059
|
+
* readable cards instead of raw axe rule ids. Stays light: a single standards
|
|
1060
|
+
* import and a lookup only for the first N findings (the widget shows a
|
|
1061
|
+
* handful). The language follows getCurrentLang() — the public Swedish scan
|
|
1062
|
+
* sets 'sv'; generateRegulatoryReport carries the built-in EN fallback for
|
|
1063
|
+
* rules lacking the target language.
|
|
1059
1064
|
*/
|
|
1060
|
-
enrichResultsLight(axeResults) {
|
|
1065
|
+
async enrichResultsLight(axeResults) {
|
|
1061
1066
|
const impactToRisk = {
|
|
1062
1067
|
critical: "critical",
|
|
1063
1068
|
serious: "high",
|
|
1064
1069
|
moderate: "medium",
|
|
1065
1070
|
minor: "low"
|
|
1066
1071
|
};
|
|
1067
|
-
|
|
1072
|
+
const KLARSPRAK_TOP_N = 8;
|
|
1073
|
+
const { generateRegulatoryReport } = await import("@holmdigital/standards");
|
|
1074
|
+
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1075
|
+
const lang = getCurrentLang2();
|
|
1076
|
+
return axeResults.violations.map((violation, index) => {
|
|
1068
1077
|
const impact = violation.impact || "moderate";
|
|
1069
1078
|
const risk = impactToRisk[impact] || "medium";
|
|
1079
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? generateRegulatoryReport(violation.id, lang)?.plainLanguage : void 0;
|
|
1070
1080
|
return {
|
|
1071
1081
|
ruleId: violation.id,
|
|
1072
1082
|
wcagCriteria: violation.tags.find((t2) => t2.startsWith("wcag")) || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
@@ -1074,6 +1084,7 @@ var RegulatoryScanner = class {
|
|
|
1074
1084
|
dosLagenReference: "",
|
|
1075
1085
|
diggRisk: risk,
|
|
1076
1086
|
eaaImpact: risk,
|
|
1087
|
+
plainLanguage,
|
|
1077
1088
|
remediation: {
|
|
1078
1089
|
description: violation.help,
|
|
1079
1090
|
technicalGuidance: violation.description,
|
package/dist/index.mjs
CHANGED