@holmdigital/engine 2.10.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-O5RJOSBZ.mjs → chunk-5S6UAABI.mjs} +18 -7
- package/dist/{chunk-KGUYOQMY.mjs → chunk-CE5CPK4U.mjs} +18 -9
- package/dist/chunk-IMRWWO5R.mjs +66 -0
- package/dist/cli/index.js +128 -71
- package/dist/cli/index.mjs +41 -53
- package/dist/{i18n-BXFF6TW2.mjs → i18n-7WMKI7JK.mjs} +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +35 -15
- package/dist/index.mjs +2 -2
- package/dist/{plain-report-AWMBH6TM.mjs → plain-report-WIL7FGCM.mjs} +9 -4
- package/package.json +8 -8
- package/dist/chunk-VNNYP4NV.mjs +0 -26
|
@@ -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,
|
|
@@ -330,7 +341,7 @@ var RegulatoryScanner = class {
|
|
|
330
341
|
async enrichResults(axeResults) {
|
|
331
342
|
const reports = [];
|
|
332
343
|
const { searchRulesByTags, generateRegulatoryReport, getConvergenceRule } = await import("@holmdigital/standards");
|
|
333
|
-
const { getCurrentLang } = await import("./i18n-
|
|
344
|
+
const { getCurrentLang } = await import("./i18n-7WMKI7JK.mjs");
|
|
334
345
|
const lang = getCurrentLang();
|
|
335
346
|
for (const violation of axeResults.violations) {
|
|
336
347
|
let report = generateRegulatoryReport(violation.id, lang);
|
|
@@ -59,7 +59,8 @@ var en_default = {
|
|
|
59
59
|
occurrences: "{count} occurrences",
|
|
60
60
|
gate_blocked: "Plain-language (klarspr\xE5k) output is not yet available in '{lang}'.",
|
|
61
61
|
gate_supported: "Languages with klarspr\xE5k: {langs}.",
|
|
62
|
-
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv)."
|
|
62
|
+
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv).",
|
|
63
|
+
gate_fallback: "Plain language is not yet available in {lang}, so this report is shown in English. We add languages one country at a time."
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
66
|
|
|
@@ -124,7 +125,8 @@ var sv_default = {
|
|
|
124
125
|
occurrences: "{count} f\xF6rekomster",
|
|
125
126
|
gate_blocked: "Klarspr\xE5k st\xF6ds \xE4nnu inte p\xE5 '{lang}'.",
|
|
126
127
|
gate_supported: "Spr\xE5k med klarspr\xE5k: {langs}.",
|
|
127
|
-
gate_howto: "K\xF6r utan --plain f\xF6r utvecklarrapporten, eller v\xE4lj ett spr\xE5k som st\xF6ds (t.ex. --lang sv)."
|
|
128
|
+
gate_howto: "K\xF6r utan --plain f\xF6r utvecklarrapporten, eller v\xE4lj ett spr\xE5k som st\xF6ds (t.ex. --lang sv).",
|
|
129
|
+
gate_fallback: "Klarspr\xE5k finns \xE4nnu inte p\xE5 {lang}, s\xE5 den h\xE4r rapporten visas p\xE5 engelska. Vi l\xE4gger till spr\xE5k land f\xF6r land."
|
|
128
130
|
}
|
|
129
131
|
};
|
|
130
132
|
|
|
@@ -189,7 +191,8 @@ var de_default = {
|
|
|
189
191
|
occurrences: "{count} occurrences",
|
|
190
192
|
gate_blocked: "Verst\xE4ndliche Sprache (Klarspr\xE5k) ist f\xFCr '{lang}' noch nicht verf\xFCgbar.",
|
|
191
193
|
gate_supported: "Sprachen mit verst\xE4ndlicher Sprache: {langs}.",
|
|
192
|
-
gate_howto: "Ohne --plain ausf\xFChren f\xFCr den Entwicklerbericht, oder eine unterst\xFCtzte Sprache verwenden (z. B. --lang sv)."
|
|
194
|
+
gate_howto: "Ohne --plain ausf\xFChren f\xFCr den Entwicklerbericht, oder eine unterst\xFCtzte Sprache verwenden (z. B. --lang sv).",
|
|
195
|
+
gate_fallback: "Einfache Sprache ist f\xFCr {lang} noch nicht verf\xFCgbar, daher wird dieser Bericht auf Englisch angezeigt. Wir erg\xE4nzen Sprachen Land f\xFCr Land."
|
|
193
196
|
}
|
|
194
197
|
};
|
|
195
198
|
|
|
@@ -254,7 +257,8 @@ var fr_default = {
|
|
|
254
257
|
occurrences: "{count} occurrences",
|
|
255
258
|
gate_blocked: "Le langage clair (klarspr\xE5k) n'est pas encore disponible en \xAB {lang} \xBB.",
|
|
256
259
|
gate_supported: "Langues avec langage clair : {langs}.",
|
|
257
|
-
gate_howto: "Lancez sans --plain pour le rapport d\xE9veloppeur, ou utilisez une langue prise en charge (par ex. --lang sv)."
|
|
260
|
+
gate_howto: "Lancez sans --plain pour le rapport d\xE9veloppeur, ou utilisez une langue prise en charge (par ex. --lang sv).",
|
|
261
|
+
gate_fallback: "Le langage clair n\u2019est pas encore disponible en {lang}, ce rapport est donc affich\xE9 en anglais. Nous ajoutons les langues pays par pays."
|
|
258
262
|
}
|
|
259
263
|
};
|
|
260
264
|
|
|
@@ -319,7 +323,8 @@ var es_default = {
|
|
|
319
323
|
occurrences: "{count} occurrences",
|
|
320
324
|
gate_blocked: "El lenguaje claro (klarspr\xE5k) a\xFAn no est\xE1 disponible en '{lang}'.",
|
|
321
325
|
gate_supported: "Idiomas con lenguaje claro: {langs}.",
|
|
322
|
-
gate_howto: "Ejecuta sin --plain para el informe para desarrolladores, o usa un idioma compatible (p. ej. --lang sv)."
|
|
326
|
+
gate_howto: "Ejecuta sin --plain para el informe para desarrolladores, o usa un idioma compatible (p. ej. --lang sv).",
|
|
327
|
+
gate_fallback: "El lenguaje claro a\xFAn no est\xE1 disponible en {lang}, por lo que este informe se muestra en ingl\xE9s. A\xF1adimos idiomas pa\xEDs por pa\xEDs."
|
|
323
328
|
}
|
|
324
329
|
};
|
|
325
330
|
|
|
@@ -384,7 +389,8 @@ var fi_default = {
|
|
|
384
389
|
occurrences: "{count} occurrences",
|
|
385
390
|
gate_blocked: "Selkokielinen (klarspr\xE5k) raportti ei ole viel\xE4 saatavilla kielell\xE4 '{lang}'.",
|
|
386
391
|
gate_supported: "Kielet, joilla selkokielinen raportti on saatavilla: {langs}.",
|
|
387
|
-
gate_howto: "Aja ilman --plain-valitsinta kehitt\xE4j\xE4raporttia varten tai k\xE4yt\xE4 tuettua kielt\xE4 (esim. --lang sv)."
|
|
392
|
+
gate_howto: "Aja ilman --plain-valitsinta kehitt\xE4j\xE4raporttia varten tai k\xE4yt\xE4 tuettua kielt\xE4 (esim. --lang sv).",
|
|
393
|
+
gate_fallback: "Selkokieli ei ole viel\xE4 saatavilla kielell\xE4 {lang}, joten t\xE4m\xE4 raportti n\xE4ytet\xE4\xE4n englanniksi. Lis\xE4\xE4mme kieli\xE4 maa kerrallaan."
|
|
388
394
|
}
|
|
389
395
|
};
|
|
390
396
|
|
|
@@ -449,7 +455,8 @@ var dk_default = {
|
|
|
449
455
|
occurrences: "{count} occurrences",
|
|
450
456
|
gate_blocked: "Klarsprog (klarspr\xE5k) er endnu ikke tilg\xE6ngeligt p\xE5 '{lang}'.",
|
|
451
457
|
gate_supported: "Sprog med klarsprog: {langs}.",
|
|
452
|
-
gate_howto: "K\xF8r uden --plain for udviklerrapporten, eller brug et underst\xF8ttet sprog (f.eks. --lang sv)."
|
|
458
|
+
gate_howto: "K\xF8r uden --plain for udviklerrapporten, eller brug et underst\xF8ttet sprog (f.eks. --lang sv).",
|
|
459
|
+
gate_fallback: "Klarsprog er endnu ikke tilg\xE6ngeligt p\xE5 {lang}, s\xE5 denne rapport vises p\xE5 engelsk. Vi tilf\xF8jer sprog land for land."
|
|
453
460
|
}
|
|
454
461
|
};
|
|
455
462
|
|
|
@@ -514,7 +521,8 @@ var no_default = {
|
|
|
514
521
|
occurrences: "{count} occurrences",
|
|
515
522
|
gate_blocked: "Klarspr\xE5k er enn\xE5 ikke tilgjengelig p\xE5 '{lang}'.",
|
|
516
523
|
gate_supported: "Spr\xE5k med klarspr\xE5k: {langs}.",
|
|
517
|
-
gate_howto: "Kj\xF8r uten --plain for utviklerrapporten, eller bruk et st\xF8ttet spr\xE5k (f.eks. --lang sv)."
|
|
524
|
+
gate_howto: "Kj\xF8r uten --plain for utviklerrapporten, eller bruk et st\xF8ttet spr\xE5k (f.eks. --lang sv).",
|
|
525
|
+
gate_fallback: "Klarspr\xE5k er enn\xE5 ikke tilgjengelig p\xE5 {lang}, s\xE5 denne rapporten vises p\xE5 engelsk. Vi legger til spr\xE5k land for land."
|
|
518
526
|
}
|
|
519
527
|
};
|
|
520
528
|
|
|
@@ -579,7 +587,8 @@ var nl_default = {
|
|
|
579
587
|
occurrences: "{count} occurrences",
|
|
580
588
|
gate_blocked: "Begrijpelijke taal (klarspr\xE5k) is nog niet beschikbaar in '{lang}'.",
|
|
581
589
|
gate_supported: "Talen met begrijpelijke taal: {langs}.",
|
|
582
|
-
gate_howto: "Voer uit zonder --plain voor het ontwikkelaarsrapport, of gebruik een ondersteunde taal (bijv. --lang sv)."
|
|
590
|
+
gate_howto: "Voer uit zonder --plain voor het ontwikkelaarsrapport, of gebruik een ondersteunde taal (bijv. --lang sv).",
|
|
591
|
+
gate_fallback: "Duidelijke taal is nog niet beschikbaar in {lang}, daarom wordt dit rapport in het Engels getoond. We voegen talen land voor land toe."
|
|
583
592
|
}
|
|
584
593
|
};
|
|
585
594
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// src/reporting/plain-group.ts
|
|
2
|
+
function groupReportsByRule(reports) {
|
|
3
|
+
const groups = /* @__PURE__ */ new Map();
|
|
4
|
+
for (const report of reports) {
|
|
5
|
+
const existing = groups.get(report.ruleId);
|
|
6
|
+
if (existing) {
|
|
7
|
+
existing.count += 1;
|
|
8
|
+
} else {
|
|
9
|
+
groups.set(report.ruleId, { report, count: 1 });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return [...groups.values()];
|
|
13
|
+
}
|
|
14
|
+
function impactBreakdown(reports, levelOf, order) {
|
|
15
|
+
const counts = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const report of reports) {
|
|
17
|
+
const level = levelOf(report);
|
|
18
|
+
counts.set(level, (counts.get(level) ?? 0) + 1);
|
|
19
|
+
}
|
|
20
|
+
return [...counts.entries()].map(([level, count]) => ({ level, count })).sort((a, b) => (order[a.level] ?? 4) - (order[b.level] ?? 4));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/reporting/plain-language-support.ts
|
|
24
|
+
import { getAllConvergenceRules } from "@holmdigital/standards";
|
|
25
|
+
var PLAIN_LANGUAGE_CORE_RULES = [
|
|
26
|
+
"color-contrast",
|
|
27
|
+
"keyboard-accessible",
|
|
28
|
+
"alt-text",
|
|
29
|
+
"form-labels",
|
|
30
|
+
"link-purpose",
|
|
31
|
+
"language-of-page",
|
|
32
|
+
"name-role-value",
|
|
33
|
+
"landmark-one-main",
|
|
34
|
+
"heading-order",
|
|
35
|
+
"region",
|
|
36
|
+
"target-size"
|
|
37
|
+
];
|
|
38
|
+
function isEnglish(lang) {
|
|
39
|
+
return /^en(-|$)/i.test(lang.trim());
|
|
40
|
+
}
|
|
41
|
+
function isPlainLanguageSupported(lang) {
|
|
42
|
+
if (isEnglish(lang)) return true;
|
|
43
|
+
const byId = new Map(getAllConvergenceRules(lang).map((r) => [r.ruleId, r]));
|
|
44
|
+
return PLAIN_LANGUAGE_CORE_RULES.every((id) => Boolean(byId.get(id)?.plainLanguage?.headline));
|
|
45
|
+
}
|
|
46
|
+
var LANG_DISPLAY_NAME = {
|
|
47
|
+
de: "German",
|
|
48
|
+
fr: "French",
|
|
49
|
+
es: "Spanish",
|
|
50
|
+
nl: "Dutch",
|
|
51
|
+
no: "Norwegian",
|
|
52
|
+
nb: "Norwegian",
|
|
53
|
+
fi: "Finnish",
|
|
54
|
+
da: "Danish",
|
|
55
|
+
dk: "Danish"
|
|
56
|
+
};
|
|
57
|
+
function languageDisplayName(code) {
|
|
58
|
+
return LANG_DISPLAY_NAME[code.toLowerCase()] ?? code;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
groupReportsByRule,
|
|
63
|
+
impactBreakdown,
|
|
64
|
+
isPlainLanguageSupported,
|
|
65
|
+
languageDisplayName
|
|
66
|
+
};
|
package/dist/cli/index.js
CHANGED
|
@@ -101,7 +101,8 @@ var init_en = __esm({
|
|
|
101
101
|
occurrences: "{count} occurrences",
|
|
102
102
|
gate_blocked: "Plain-language (klarspr\xE5k) output is not yet available in '{lang}'.",
|
|
103
103
|
gate_supported: "Languages with klarspr\xE5k: {langs}.",
|
|
104
|
-
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv)."
|
|
104
|
+
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv).",
|
|
105
|
+
gate_fallback: "Plain language is not yet available in {lang}, so this report is shown in English. We add languages one country at a time."
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
}
|
|
@@ -171,7 +172,8 @@ var init_sv = __esm({
|
|
|
171
172
|
occurrences: "{count} f\xF6rekomster",
|
|
172
173
|
gate_blocked: "Klarspr\xE5k st\xF6ds \xE4nnu inte p\xE5 '{lang}'.",
|
|
173
174
|
gate_supported: "Spr\xE5k med klarspr\xE5k: {langs}.",
|
|
174
|
-
gate_howto: "K\xF6r utan --plain f\xF6r utvecklarrapporten, eller v\xE4lj ett spr\xE5k som st\xF6ds (t.ex. --lang sv)."
|
|
175
|
+
gate_howto: "K\xF6r utan --plain f\xF6r utvecklarrapporten, eller v\xE4lj ett spr\xE5k som st\xF6ds (t.ex. --lang sv).",
|
|
176
|
+
gate_fallback: "Klarspr\xE5k finns \xE4nnu inte p\xE5 {lang}, s\xE5 den h\xE4r rapporten visas p\xE5 engelska. Vi l\xE4gger till spr\xE5k land f\xF6r land."
|
|
175
177
|
}
|
|
176
178
|
};
|
|
177
179
|
}
|
|
@@ -241,7 +243,8 @@ var init_de = __esm({
|
|
|
241
243
|
occurrences: "{count} occurrences",
|
|
242
244
|
gate_blocked: "Verst\xE4ndliche Sprache (Klarspr\xE5k) ist f\xFCr '{lang}' noch nicht verf\xFCgbar.",
|
|
243
245
|
gate_supported: "Sprachen mit verst\xE4ndlicher Sprache: {langs}.",
|
|
244
|
-
gate_howto: "Ohne --plain ausf\xFChren f\xFCr den Entwicklerbericht, oder eine unterst\xFCtzte Sprache verwenden (z. B. --lang sv)."
|
|
246
|
+
gate_howto: "Ohne --plain ausf\xFChren f\xFCr den Entwicklerbericht, oder eine unterst\xFCtzte Sprache verwenden (z. B. --lang sv).",
|
|
247
|
+
gate_fallback: "Einfache Sprache ist f\xFCr {lang} noch nicht verf\xFCgbar, daher wird dieser Bericht auf Englisch angezeigt. Wir erg\xE4nzen Sprachen Land f\xFCr Land."
|
|
245
248
|
}
|
|
246
249
|
};
|
|
247
250
|
}
|
|
@@ -311,7 +314,8 @@ var init_fr = __esm({
|
|
|
311
314
|
occurrences: "{count} occurrences",
|
|
312
315
|
gate_blocked: "Le langage clair (klarspr\xE5k) n'est pas encore disponible en \xAB {lang} \xBB.",
|
|
313
316
|
gate_supported: "Langues avec langage clair : {langs}.",
|
|
314
|
-
gate_howto: "Lancez sans --plain pour le rapport d\xE9veloppeur, ou utilisez une langue prise en charge (par ex. --lang sv)."
|
|
317
|
+
gate_howto: "Lancez sans --plain pour le rapport d\xE9veloppeur, ou utilisez une langue prise en charge (par ex. --lang sv).",
|
|
318
|
+
gate_fallback: "Le langage clair n\u2019est pas encore disponible en {lang}, ce rapport est donc affich\xE9 en anglais. Nous ajoutons les langues pays par pays."
|
|
315
319
|
}
|
|
316
320
|
};
|
|
317
321
|
}
|
|
@@ -381,7 +385,8 @@ var init_es = __esm({
|
|
|
381
385
|
occurrences: "{count} occurrences",
|
|
382
386
|
gate_blocked: "El lenguaje claro (klarspr\xE5k) a\xFAn no est\xE1 disponible en '{lang}'.",
|
|
383
387
|
gate_supported: "Idiomas con lenguaje claro: {langs}.",
|
|
384
|
-
gate_howto: "Ejecuta sin --plain para el informe para desarrolladores, o usa un idioma compatible (p. ej. --lang sv)."
|
|
388
|
+
gate_howto: "Ejecuta sin --plain para el informe para desarrolladores, o usa un idioma compatible (p. ej. --lang sv).",
|
|
389
|
+
gate_fallback: "El lenguaje claro a\xFAn no est\xE1 disponible en {lang}, por lo que este informe se muestra en ingl\xE9s. A\xF1adimos idiomas pa\xEDs por pa\xEDs."
|
|
385
390
|
}
|
|
386
391
|
};
|
|
387
392
|
}
|
|
@@ -451,7 +456,8 @@ var init_fi = __esm({
|
|
|
451
456
|
occurrences: "{count} occurrences",
|
|
452
457
|
gate_blocked: "Selkokielinen (klarspr\xE5k) raportti ei ole viel\xE4 saatavilla kielell\xE4 '{lang}'.",
|
|
453
458
|
gate_supported: "Kielet, joilla selkokielinen raportti on saatavilla: {langs}.",
|
|
454
|
-
gate_howto: "Aja ilman --plain-valitsinta kehitt\xE4j\xE4raporttia varten tai k\xE4yt\xE4 tuettua kielt\xE4 (esim. --lang sv)."
|
|
459
|
+
gate_howto: "Aja ilman --plain-valitsinta kehitt\xE4j\xE4raporttia varten tai k\xE4yt\xE4 tuettua kielt\xE4 (esim. --lang sv).",
|
|
460
|
+
gate_fallback: "Selkokieli ei ole viel\xE4 saatavilla kielell\xE4 {lang}, joten t\xE4m\xE4 raportti n\xE4ytet\xE4\xE4n englanniksi. Lis\xE4\xE4mme kieli\xE4 maa kerrallaan."
|
|
455
461
|
}
|
|
456
462
|
};
|
|
457
463
|
}
|
|
@@ -521,7 +527,8 @@ var init_dk = __esm({
|
|
|
521
527
|
occurrences: "{count} occurrences",
|
|
522
528
|
gate_blocked: "Klarsprog (klarspr\xE5k) er endnu ikke tilg\xE6ngeligt p\xE5 '{lang}'.",
|
|
523
529
|
gate_supported: "Sprog med klarsprog: {langs}.",
|
|
524
|
-
gate_howto: "K\xF8r uden --plain for udviklerrapporten, eller brug et underst\xF8ttet sprog (f.eks. --lang sv)."
|
|
530
|
+
gate_howto: "K\xF8r uden --plain for udviklerrapporten, eller brug et underst\xF8ttet sprog (f.eks. --lang sv).",
|
|
531
|
+
gate_fallback: "Klarsprog er endnu ikke tilg\xE6ngeligt p\xE5 {lang}, s\xE5 denne rapport vises p\xE5 engelsk. Vi tilf\xF8jer sprog land for land."
|
|
525
532
|
}
|
|
526
533
|
};
|
|
527
534
|
}
|
|
@@ -591,7 +598,8 @@ var init_no = __esm({
|
|
|
591
598
|
occurrences: "{count} occurrences",
|
|
592
599
|
gate_blocked: "Klarspr\xE5k er enn\xE5 ikke tilgjengelig p\xE5 '{lang}'.",
|
|
593
600
|
gate_supported: "Spr\xE5k med klarspr\xE5k: {langs}.",
|
|
594
|
-
gate_howto: "Kj\xF8r uten --plain for utviklerrapporten, eller bruk et st\xF8ttet spr\xE5k (f.eks. --lang sv)."
|
|
601
|
+
gate_howto: "Kj\xF8r uten --plain for utviklerrapporten, eller bruk et st\xF8ttet spr\xE5k (f.eks. --lang sv).",
|
|
602
|
+
gate_fallback: "Klarspr\xE5k er enn\xE5 ikke tilgjengelig p\xE5 {lang}, s\xE5 denne rapporten vises p\xE5 engelsk. Vi legger til spr\xE5k land for land."
|
|
595
603
|
}
|
|
596
604
|
};
|
|
597
605
|
}
|
|
@@ -661,7 +669,8 @@ var init_nl = __esm({
|
|
|
661
669
|
occurrences: "{count} occurrences",
|
|
662
670
|
gate_blocked: "Begrijpelijke taal (klarspr\xE5k) is nog niet beschikbaar in '{lang}'.",
|
|
663
671
|
gate_supported: "Talen met begrijpelijke taal: {langs}.",
|
|
664
|
-
gate_howto: "Voer uit zonder --plain voor het ontwikkelaarsrapport, of gebruik een ondersteunde taal (bijv. --lang sv)."
|
|
672
|
+
gate_howto: "Voer uit zonder --plain voor het ontwikkelaarsrapport, of gebruik een ondersteunde taal (bijv. --lang sv).",
|
|
673
|
+
gate_fallback: "Duidelijke taal is nog niet beschikbaar in {lang}, daarom wordt dit rapport in het Engels getoond. We voegen talen land voor land toe."
|
|
665
674
|
}
|
|
666
675
|
};
|
|
667
676
|
}
|
|
@@ -776,6 +785,51 @@ var init_plain_group = __esm({
|
|
|
776
785
|
}
|
|
777
786
|
});
|
|
778
787
|
|
|
788
|
+
// src/reporting/plain-language-support.ts
|
|
789
|
+
function isEnglish(lang) {
|
|
790
|
+
return /^en(-|$)/i.test(lang.trim());
|
|
791
|
+
}
|
|
792
|
+
function isPlainLanguageSupported(lang) {
|
|
793
|
+
if (isEnglish(lang)) return true;
|
|
794
|
+
const byId = new Map((0, import_standards.getAllConvergenceRules)(lang).map((r) => [r.ruleId, r]));
|
|
795
|
+
return PLAIN_LANGUAGE_CORE_RULES.every((id) => Boolean(byId.get(id)?.plainLanguage?.headline));
|
|
796
|
+
}
|
|
797
|
+
function languageDisplayName(code) {
|
|
798
|
+
return LANG_DISPLAY_NAME[code.toLowerCase()] ?? code;
|
|
799
|
+
}
|
|
800
|
+
var import_standards, PLAIN_LANGUAGE_CORE_RULES, LANG_DISPLAY_NAME;
|
|
801
|
+
var init_plain_language_support = __esm({
|
|
802
|
+
"src/reporting/plain-language-support.ts"() {
|
|
803
|
+
"use strict";
|
|
804
|
+
init_cjs_shims();
|
|
805
|
+
import_standards = require("@holmdigital/standards");
|
|
806
|
+
PLAIN_LANGUAGE_CORE_RULES = [
|
|
807
|
+
"color-contrast",
|
|
808
|
+
"keyboard-accessible",
|
|
809
|
+
"alt-text",
|
|
810
|
+
"form-labels",
|
|
811
|
+
"link-purpose",
|
|
812
|
+
"language-of-page",
|
|
813
|
+
"name-role-value",
|
|
814
|
+
"landmark-one-main",
|
|
815
|
+
"heading-order",
|
|
816
|
+
"region",
|
|
817
|
+
"target-size"
|
|
818
|
+
];
|
|
819
|
+
LANG_DISPLAY_NAME = {
|
|
820
|
+
de: "German",
|
|
821
|
+
fr: "French",
|
|
822
|
+
es: "Spanish",
|
|
823
|
+
nl: "Dutch",
|
|
824
|
+
no: "Norwegian",
|
|
825
|
+
nb: "Norwegian",
|
|
826
|
+
fi: "Finnish",
|
|
827
|
+
da: "Danish",
|
|
828
|
+
dk: "Danish"
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
|
|
779
833
|
// src/reporting/plain-report.ts
|
|
780
834
|
var plain_report_exports = {};
|
|
781
835
|
__export(plain_report_exports, {
|
|
@@ -784,8 +838,12 @@ __export(plain_report_exports, {
|
|
|
784
838
|
function levelOf(report) {
|
|
785
839
|
return report.plainLanguage?.impactLevel ?? RISK_TO_IMPACT[report.holmdigitalInsight.diggRisk] ?? "putsning";
|
|
786
840
|
}
|
|
787
|
-
function renderPlainReport(result, lang = "en") {
|
|
841
|
+
function renderPlainReport(result, lang = "en", plainFallbackFrom) {
|
|
788
842
|
setLanguage(lang);
|
|
843
|
+
if (plainFallbackFrom) {
|
|
844
|
+
console.log(import_chalk.default.yellow(t("plain.gate_fallback", { lang: languageDisplayName(plainFallbackFrom) })));
|
|
845
|
+
console.log("");
|
|
846
|
+
}
|
|
789
847
|
if (result.reports.length === 0) {
|
|
790
848
|
console.log(t("plain.empty_state"));
|
|
791
849
|
console.log("");
|
|
@@ -839,6 +897,7 @@ var init_plain_report = __esm({
|
|
|
839
897
|
import_chalk = __toESM(require("chalk"));
|
|
840
898
|
init_i18n();
|
|
841
899
|
init_plain_group();
|
|
900
|
+
init_plain_language_support();
|
|
842
901
|
IMPACT_ORDER = {
|
|
843
902
|
"stoppar-kop": 0,
|
|
844
903
|
"hindrar": 1,
|
|
@@ -1126,7 +1185,7 @@ var HtmlValidator = class {
|
|
|
1126
1185
|
// src/core/regulatory-scanner.ts
|
|
1127
1186
|
var import_node_fs = require("fs");
|
|
1128
1187
|
function getEngineVersion() {
|
|
1129
|
-
return "2.
|
|
1188
|
+
return "2.12.0";
|
|
1130
1189
|
}
|
|
1131
1190
|
function getStandardsVersion() {
|
|
1132
1191
|
try {
|
|
@@ -1235,7 +1294,7 @@ var RegulatoryScanner = class {
|
|
|
1235
1294
|
});
|
|
1236
1295
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
1237
1296
|
passedCount = axeResults.passes?.length || 0;
|
|
1238
|
-
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);
|
|
1239
1298
|
const scanDuration = Date.now() - startTime;
|
|
1240
1299
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
1241
1300
|
if (htmlValidation) {
|
|
@@ -1269,19 +1328,29 @@ var RegulatoryScanner = class {
|
|
|
1269
1328
|
await page.evaluate(axeSource);
|
|
1270
1329
|
}
|
|
1271
1330
|
/**
|
|
1272
|
-
* Light enrichment — maps axe severity directly
|
|
1273
|
-
*
|
|
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.
|
|
1274
1338
|
*/
|
|
1275
|
-
enrichResultsLight(axeResults) {
|
|
1339
|
+
async enrichResultsLight(axeResults) {
|
|
1276
1340
|
const impactToRisk = {
|
|
1277
1341
|
critical: "critical",
|
|
1278
1342
|
serious: "high",
|
|
1279
1343
|
moderate: "medium",
|
|
1280
1344
|
minor: "low"
|
|
1281
1345
|
};
|
|
1282
|
-
|
|
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) => {
|
|
1283
1351
|
const impact = violation.impact || "moderate";
|
|
1284
1352
|
const risk = impactToRisk[impact] || "medium";
|
|
1353
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? generateRegulatoryReport(violation.id, lang)?.plainLanguage : void 0;
|
|
1285
1354
|
return {
|
|
1286
1355
|
ruleId: violation.id,
|
|
1287
1356
|
wcagCriteria: violation.tags.find((t2) => t2.startsWith("wcag")) || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
@@ -1289,6 +1358,7 @@ var RegulatoryScanner = class {
|
|
|
1289
1358
|
dosLagenReference: "",
|
|
1290
1359
|
diggRisk: risk,
|
|
1291
1360
|
eaaImpact: risk,
|
|
1361
|
+
plainLanguage,
|
|
1292
1362
|
remediation: {
|
|
1293
1363
|
description: violation.help,
|
|
1294
1364
|
technicalGuidance: violation.description,
|
|
@@ -1558,6 +1628,7 @@ function generateBadgeMarkdown(score) {
|
|
|
1558
1628
|
// src/reporting/html-template.ts
|
|
1559
1629
|
init_i18n();
|
|
1560
1630
|
init_plain_group();
|
|
1631
|
+
init_plain_language_support();
|
|
1561
1632
|
var LOCALE_TO_INTL = {
|
|
1562
1633
|
sv: "sv-SE",
|
|
1563
1634
|
en: "en-US",
|
|
@@ -1587,9 +1658,9 @@ function formatDate(dateString) {
|
|
|
1587
1658
|
function escapeHtml(str) {
|
|
1588
1659
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1589
1660
|
}
|
|
1590
|
-
function generateReportHTML(result, sector = "public", audience = "developer") {
|
|
1661
|
+
function generateReportHTML(result, sector = "public", audience = "developer", plainFallbackFrom) {
|
|
1591
1662
|
if (audience === "plain") {
|
|
1592
|
-
return generatePlainReportHTML(result);
|
|
1663
|
+
return generatePlainReportHTML(result, plainFallbackFrom);
|
|
1593
1664
|
}
|
|
1594
1665
|
const criticalCount = result.stats.critical;
|
|
1595
1666
|
const highCount = result.stats.high;
|
|
@@ -1918,10 +1989,12 @@ function getLogoDataUri() {
|
|
|
1918
1989
|
cachedLogoDataUri = "";
|
|
1919
1990
|
return cachedLogoDataUri;
|
|
1920
1991
|
}
|
|
1921
|
-
function generatePlainReportHTML(result) {
|
|
1992
|
+
function generatePlainReportHTML(result, plainFallbackFrom) {
|
|
1922
1993
|
const lang = getCurrentLang();
|
|
1923
1994
|
const safeUrl = escapeHtml(result.url);
|
|
1924
1995
|
const logoDataUri = getLogoDataUri();
|
|
1996
|
+
const fallbackName = plainFallbackFrom ? languageDisplayName(plainFallbackFrom) : "";
|
|
1997
|
+
const noticeHtml = fallbackName ? `<p class="plain-fallback-notice">${escapeHtml(t("plain.gate_fallback", { lang: fallbackName }))}</p>` : "";
|
|
1925
1998
|
const sortedGroups = groupReportsByRule(result.reports).sort((a, b) => {
|
|
1926
1999
|
const aLevel = PLAIN_IMPACT_ORDER[plainLevelOf(a.report)] ?? 4;
|
|
1927
2000
|
const bLevel = PLAIN_IMPACT_ORDER[plainLevelOf(b.report)] ?? 4;
|
|
@@ -2060,6 +2133,23 @@ ${sortedGroups.map((group) => {
|
|
|
2060
2133
|
color: #0f172a;
|
|
2061
2134
|
}
|
|
2062
2135
|
|
|
2136
|
+
/* ---- Fallback notice: calm, informational banner shown when the report
|
|
2137
|
+
is served in English because the requested language is not yet
|
|
2138
|
+
covered. Amber note, not an error. ---- */
|
|
2139
|
+
.plain-fallback-notice {
|
|
2140
|
+
background: #fffbeb;
|
|
2141
|
+
border: 1px solid #fde68a;
|
|
2142
|
+
border-left: 4px solid #d97706;
|
|
2143
|
+
border-radius: 8px;
|
|
2144
|
+
padding: 0.85rem 1.1rem;
|
|
2145
|
+
margin-bottom: 1.6rem;
|
|
2146
|
+
font-size: 0.85rem;
|
|
2147
|
+
color: #713f12;
|
|
2148
|
+
line-height: 1.55;
|
|
2149
|
+
-webkit-print-color-adjust: exact;
|
|
2150
|
+
print-color-adjust: exact;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2063
2153
|
/* ---- Issue list ---- */
|
|
2064
2154
|
.issue-list {
|
|
2065
2155
|
list-style: none;
|
|
@@ -2195,6 +2285,7 @@ ${sortedGroups.map((group) => {
|
|
|
2195
2285
|
</header>
|
|
2196
2286
|
|
|
2197
2287
|
<div class="report-body">
|
|
2288
|
+
${noticeHtml}
|
|
2198
2289
|
<div class="intro">
|
|
2199
2290
|
<p>${t("plain.intro_framing")}</p>
|
|
2200
2291
|
<p>${t("plain.intro_found", { count, unit })}</p>
|
|
@@ -2249,7 +2340,7 @@ init_cjs_shims();
|
|
|
2249
2340
|
var import_react = __toESM(require("react"));
|
|
2250
2341
|
var import_server = require("react-dom/server");
|
|
2251
2342
|
var import_components = require("@holmdigital/components");
|
|
2252
|
-
var
|
|
2343
|
+
var import_standards2 = require("@holmdigital/standards");
|
|
2253
2344
|
var import_promises = __toESM(require("fs/promises"));
|
|
2254
2345
|
var import_path = __toESM(require("path"));
|
|
2255
2346
|
var EVALUATION_METHOD = {
|
|
@@ -2499,18 +2590,18 @@ async function generateStatementContent(result, lang = "en", format = "html", me
|
|
|
2499
2590
|
"{<third party>}": props.generatorTool?.name || "HolmDigital Engine",
|
|
2500
2591
|
"{<enforcement_body>}": (() => {
|
|
2501
2592
|
if (country === "US") {
|
|
2502
|
-
const adaLaw = (0,
|
|
2593
|
+
const adaLaw = (0, import_standards2.getNationalLaws)("US").find((l) => l.euFramework === "ADA" && l.scope === sector);
|
|
2503
2594
|
if (adaLaw) return adaLaw.enforcement.authorityName;
|
|
2504
2595
|
}
|
|
2505
|
-
return (0,
|
|
2596
|
+
return (0, import_standards2.getEnforcementBody)(country, sector);
|
|
2506
2597
|
})(),
|
|
2507
2598
|
"{<national_law>}": (() => {
|
|
2508
2599
|
if (country === "AU") {
|
|
2509
|
-
const ddaLaw = (0,
|
|
2600
|
+
const ddaLaw = (0, import_standards2.getNationalLawByFramework)("DDA", "AU");
|
|
2510
2601
|
return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
|
|
2511
2602
|
}
|
|
2512
2603
|
if (country === "US") {
|
|
2513
|
-
const usLaws = (0,
|
|
2604
|
+
const usLaws = (0, import_standards2.getNationalLaws)("US");
|
|
2514
2605
|
const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
|
|
2515
2606
|
if (adaLaw) {
|
|
2516
2607
|
if (sector === "public") {
|
|
@@ -2521,7 +2612,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
|
|
|
2521
2612
|
return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
|
|
2522
2613
|
}
|
|
2523
2614
|
}
|
|
2524
|
-
const law = (0,
|
|
2615
|
+
const law = (0, import_standards2.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
|
|
2525
2616
|
return law ? `${law.fullName} (${law.law})` : "";
|
|
2526
2617
|
})(),
|
|
2527
2618
|
"{<ahrc_url>}": "https://www.humanrights.gov.au/complaints",
|
|
@@ -2591,45 +2682,7 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
|
|
|
2591
2682
|
|
|
2592
2683
|
// src/cli/index.ts
|
|
2593
2684
|
init_i18n();
|
|
2594
|
-
|
|
2595
|
-
// src/reporting/plain-language-support.ts
|
|
2596
|
-
init_cjs_shims();
|
|
2597
|
-
var import_standards2 = require("@holmdigital/standards");
|
|
2598
|
-
var PLAIN_LANGUAGE_CORE_RULES = [
|
|
2599
|
-
"color-contrast",
|
|
2600
|
-
"keyboard-accessible",
|
|
2601
|
-
"alt-text",
|
|
2602
|
-
"form-labels",
|
|
2603
|
-
"link-purpose",
|
|
2604
|
-
"language-of-page",
|
|
2605
|
-
"name-role-value",
|
|
2606
|
-
"landmark-one-main",
|
|
2607
|
-
"heading-order",
|
|
2608
|
-
"region",
|
|
2609
|
-
"target-size"
|
|
2610
|
-
];
|
|
2611
|
-
var CANDIDATE_LANGS = [
|
|
2612
|
-
"en",
|
|
2613
|
-
"sv",
|
|
2614
|
-
"de",
|
|
2615
|
-
"fr",
|
|
2616
|
-
"es",
|
|
2617
|
-
"nl",
|
|
2618
|
-
"no",
|
|
2619
|
-
"fi",
|
|
2620
|
-
"da"
|
|
2621
|
-
];
|
|
2622
|
-
function isEnglish(lang) {
|
|
2623
|
-
return /^en(-|$)/i.test(lang.trim());
|
|
2624
|
-
}
|
|
2625
|
-
function isPlainLanguageSupported(lang) {
|
|
2626
|
-
if (isEnglish(lang)) return true;
|
|
2627
|
-
const byId = new Map((0, import_standards2.getAllConvergenceRules)(lang).map((r) => [r.ruleId, r]));
|
|
2628
|
-
return PLAIN_LANGUAGE_CORE_RULES.every((id) => Boolean(byId.get(id)?.plainLanguage?.headline));
|
|
2629
|
-
}
|
|
2630
|
-
function getPlainLanguageSupportedLanguages() {
|
|
2631
|
-
return CANDIDATE_LANGS.filter((lang) => isPlainLanguageSupported(lang));
|
|
2632
|
-
}
|
|
2685
|
+
init_plain_language_support();
|
|
2633
2686
|
|
|
2634
2687
|
// src/cli/cloud-client.ts
|
|
2635
2688
|
init_cjs_shims();
|
|
@@ -2754,11 +2807,10 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2754
2807
|
audience: cliOptions.plain ? "plain" : cliOptions.audience || fileConfig.audience || "developer"
|
|
2755
2808
|
};
|
|
2756
2809
|
setLanguage(options.lang);
|
|
2810
|
+
let plainFallbackFrom;
|
|
2757
2811
|
if (options.audience === "plain" && !options.json && !isPlainLanguageSupported(options.lang)) {
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
console.error(import_chalk2.default.gray(` ${t("plain.gate_howto")}`));
|
|
2761
|
-
process.exit(1);
|
|
2812
|
+
plainFallbackFrom = options.lang;
|
|
2813
|
+
setLanguage("en");
|
|
2762
2814
|
}
|
|
2763
2815
|
if (!isValidUrl(url)) {
|
|
2764
2816
|
}
|
|
@@ -2796,7 +2848,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2796
2848
|
if (spinner) spinner.succeed(t("cli.complete"));
|
|
2797
2849
|
if (options.pdf) {
|
|
2798
2850
|
if (spinner) spinner.start(t("cli.generating_pdf"));
|
|
2799
|
-
const html = options.audience === "plain" ? generateReportHTML(result, options.sector, "plain") : generateReportHTML(result, options.sector);
|
|
2851
|
+
const html = options.audience === "plain" ? generateReportHTML(result, options.sector, "plain", plainFallbackFrom) : generateReportHTML(result, options.sector);
|
|
2800
2852
|
await generatePDF(html, options.pdf);
|
|
2801
2853
|
if (spinner) spinner.succeed(t("cli.pdf_saved", { path: options.pdf }));
|
|
2802
2854
|
}
|
|
@@ -2829,7 +2881,12 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2829
2881
|
topIssues: result.reports.slice(0, 5).map((r) => ({
|
|
2830
2882
|
id: r.ruleId,
|
|
2831
2883
|
impact: r.holmdigitalInsight.diggRisk,
|
|
2832
|
-
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
|
|
2833
2890
|
}))
|
|
2834
2891
|
};
|
|
2835
2892
|
console.log(JSON.stringify(lightResult, null, 2));
|
|
@@ -2853,7 +2910,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2853
2910
|
Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
2854
2911
|
} else if (options.audience === "plain") {
|
|
2855
2912
|
const { renderPlainReport: renderPlainReport2 } = await Promise.resolve().then(() => (init_plain_report(), plain_report_exports));
|
|
2856
|
-
renderPlainReport2(result, options.lang);
|
|
2913
|
+
renderPlainReport2(result, plainFallbackFrom ? "en" : options.lang, plainFallbackFrom);
|
|
2857
2914
|
} else {
|
|
2858
2915
|
console.log("\n");
|
|
2859
2916
|
const scoreColor = result.score >= 90 ? import_chalk2.default.green : result.score >= 70 ? import_chalk2.default.yellow : import_chalk2.default.red;
|
package/dist/cli/index.mjs
CHANGED
|
@@ -7,16 +7,18 @@ 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
|
-
impactBreakdown
|
|
14
|
-
|
|
13
|
+
impactBreakdown,
|
|
14
|
+
isPlainLanguageSupported,
|
|
15
|
+
languageDisplayName
|
|
16
|
+
} from "../chunk-IMRWWO5R.mjs";
|
|
15
17
|
import {
|
|
16
18
|
getCurrentLang,
|
|
17
19
|
setLanguage,
|
|
18
20
|
t
|
|
19
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-CE5CPK4U.mjs";
|
|
20
22
|
import {
|
|
21
23
|
__dirname
|
|
22
24
|
} from "../chunk-DIBTSSLZ.mjs";
|
|
@@ -58,9 +60,9 @@ function formatDate(dateString) {
|
|
|
58
60
|
function escapeHtml(str) {
|
|
59
61
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
60
62
|
}
|
|
61
|
-
function generateReportHTML(result, sector = "public", audience = "developer") {
|
|
63
|
+
function generateReportHTML(result, sector = "public", audience = "developer", plainFallbackFrom) {
|
|
62
64
|
if (audience === "plain") {
|
|
63
|
-
return generatePlainReportHTML(result);
|
|
65
|
+
return generatePlainReportHTML(result, plainFallbackFrom);
|
|
64
66
|
}
|
|
65
67
|
const criticalCount = result.stats.critical;
|
|
66
68
|
const highCount = result.stats.high;
|
|
@@ -389,10 +391,12 @@ function getLogoDataUri() {
|
|
|
389
391
|
cachedLogoDataUri = "";
|
|
390
392
|
return cachedLogoDataUri;
|
|
391
393
|
}
|
|
392
|
-
function generatePlainReportHTML(result) {
|
|
394
|
+
function generatePlainReportHTML(result, plainFallbackFrom) {
|
|
393
395
|
const lang = getCurrentLang();
|
|
394
396
|
const safeUrl = escapeHtml(result.url);
|
|
395
397
|
const logoDataUri = getLogoDataUri();
|
|
398
|
+
const fallbackName = plainFallbackFrom ? languageDisplayName(plainFallbackFrom) : "";
|
|
399
|
+
const noticeHtml = fallbackName ? `<p class="plain-fallback-notice">${escapeHtml(t("plain.gate_fallback", { lang: fallbackName }))}</p>` : "";
|
|
396
400
|
const sortedGroups = groupReportsByRule(result.reports).sort((a, b) => {
|
|
397
401
|
const aLevel = PLAIN_IMPACT_ORDER[plainLevelOf(a.report)] ?? 4;
|
|
398
402
|
const bLevel = PLAIN_IMPACT_ORDER[plainLevelOf(b.report)] ?? 4;
|
|
@@ -531,6 +535,23 @@ ${sortedGroups.map((group) => {
|
|
|
531
535
|
color: #0f172a;
|
|
532
536
|
}
|
|
533
537
|
|
|
538
|
+
/* ---- Fallback notice: calm, informational banner shown when the report
|
|
539
|
+
is served in English because the requested language is not yet
|
|
540
|
+
covered. Amber note, not an error. ---- */
|
|
541
|
+
.plain-fallback-notice {
|
|
542
|
+
background: #fffbeb;
|
|
543
|
+
border: 1px solid #fde68a;
|
|
544
|
+
border-left: 4px solid #d97706;
|
|
545
|
+
border-radius: 8px;
|
|
546
|
+
padding: 0.85rem 1.1rem;
|
|
547
|
+
margin-bottom: 1.6rem;
|
|
548
|
+
font-size: 0.85rem;
|
|
549
|
+
color: #713f12;
|
|
550
|
+
line-height: 1.55;
|
|
551
|
+
-webkit-print-color-adjust: exact;
|
|
552
|
+
print-color-adjust: exact;
|
|
553
|
+
}
|
|
554
|
+
|
|
534
555
|
/* ---- Issue list ---- */
|
|
535
556
|
.issue-list {
|
|
536
557
|
list-style: none;
|
|
@@ -666,6 +687,7 @@ ${sortedGroups.map((group) => {
|
|
|
666
687
|
</header>
|
|
667
688
|
|
|
668
689
|
<div class="report-body">
|
|
690
|
+
${noticeHtml}
|
|
669
691
|
<div class="intro">
|
|
670
692
|
<p>${t("plain.intro_framing")}</p>
|
|
671
693
|
<p>${t("plain.intro_found", { count, unit })}</p>
|
|
@@ -714,44 +736,6 @@ async function generatePDF(htmlContent, outputPath) {
|
|
|
714
736
|
}
|
|
715
737
|
}
|
|
716
738
|
|
|
717
|
-
// src/reporting/plain-language-support.ts
|
|
718
|
-
import { getAllConvergenceRules } from "@holmdigital/standards";
|
|
719
|
-
var PLAIN_LANGUAGE_CORE_RULES = [
|
|
720
|
-
"color-contrast",
|
|
721
|
-
"keyboard-accessible",
|
|
722
|
-
"alt-text",
|
|
723
|
-
"form-labels",
|
|
724
|
-
"link-purpose",
|
|
725
|
-
"language-of-page",
|
|
726
|
-
"name-role-value",
|
|
727
|
-
"landmark-one-main",
|
|
728
|
-
"heading-order",
|
|
729
|
-
"region",
|
|
730
|
-
"target-size"
|
|
731
|
-
];
|
|
732
|
-
var CANDIDATE_LANGS = [
|
|
733
|
-
"en",
|
|
734
|
-
"sv",
|
|
735
|
-
"de",
|
|
736
|
-
"fr",
|
|
737
|
-
"es",
|
|
738
|
-
"nl",
|
|
739
|
-
"no",
|
|
740
|
-
"fi",
|
|
741
|
-
"da"
|
|
742
|
-
];
|
|
743
|
-
function isEnglish(lang) {
|
|
744
|
-
return /^en(-|$)/i.test(lang.trim());
|
|
745
|
-
}
|
|
746
|
-
function isPlainLanguageSupported(lang) {
|
|
747
|
-
if (isEnglish(lang)) return true;
|
|
748
|
-
const byId = new Map(getAllConvergenceRules(lang).map((r) => [r.ruleId, r]));
|
|
749
|
-
return PLAIN_LANGUAGE_CORE_RULES.every((id) => Boolean(byId.get(id)?.plainLanguage?.headline));
|
|
750
|
-
}
|
|
751
|
-
function getPlainLanguageSupportedLanguages() {
|
|
752
|
-
return CANDIDATE_LANGS.filter((lang) => isPlainLanguageSupported(lang));
|
|
753
|
-
}
|
|
754
|
-
|
|
755
739
|
// src/cli/cloud-client.ts
|
|
756
740
|
function transformToCloudPayload(result) {
|
|
757
741
|
const violations = result.reports.map((report) => {
|
|
@@ -874,11 +858,10 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
874
858
|
audience: cliOptions.plain ? "plain" : cliOptions.audience || fileConfig.audience || "developer"
|
|
875
859
|
};
|
|
876
860
|
setLanguage(options.lang);
|
|
861
|
+
let plainFallbackFrom;
|
|
877
862
|
if (options.audience === "plain" && !options.json && !isPlainLanguageSupported(options.lang)) {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
console.error(chalk.gray(` ${t("plain.gate_howto")}`));
|
|
881
|
-
process.exit(1);
|
|
863
|
+
plainFallbackFrom = options.lang;
|
|
864
|
+
setLanguage("en");
|
|
882
865
|
}
|
|
883
866
|
if (!isValidUrl(url)) {
|
|
884
867
|
}
|
|
@@ -916,7 +899,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
916
899
|
if (spinner) spinner.succeed(t("cli.complete"));
|
|
917
900
|
if (options.pdf) {
|
|
918
901
|
if (spinner) spinner.start(t("cli.generating_pdf"));
|
|
919
|
-
const html = options.audience === "plain" ? generateReportHTML(result, options.sector, "plain") : generateReportHTML(result, options.sector);
|
|
902
|
+
const html = options.audience === "plain" ? generateReportHTML(result, options.sector, "plain", plainFallbackFrom) : generateReportHTML(result, options.sector);
|
|
920
903
|
await generatePDF(html, options.pdf);
|
|
921
904
|
if (spinner) spinner.succeed(t("cli.pdf_saved", { path: options.pdf }));
|
|
922
905
|
}
|
|
@@ -949,7 +932,12 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
949
932
|
topIssues: result.reports.slice(0, 5).map((r) => ({
|
|
950
933
|
id: r.ruleId,
|
|
951
934
|
impact: r.holmdigitalInsight.diggRisk,
|
|
952
|
-
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
|
|
953
941
|
}))
|
|
954
942
|
};
|
|
955
943
|
console.log(JSON.stringify(lightResult, null, 2));
|
|
@@ -972,8 +960,8 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
972
960
|
console.log(chalk.gray(`
|
|
973
961
|
Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
974
962
|
} else if (options.audience === "plain") {
|
|
975
|
-
const { renderPlainReport } = await import("../plain-report-
|
|
976
|
-
renderPlainReport(result, options.lang);
|
|
963
|
+
const { renderPlainReport } = await import("../plain-report-WIL7FGCM.mjs");
|
|
964
|
+
renderPlainReport(result, plainFallbackFrom ? "en" : options.lang, plainFallbackFrom);
|
|
977
965
|
} else {
|
|
978
966
|
console.log("\n");
|
|
979
967
|
const scoreColor = result.score >= 90 ? chalk.green : result.score >= 70 ? chalk.yellow : chalk.red;
|
package/dist/index.d.mts
CHANGED
|
@@ -165,7 +165,8 @@ var plain = {
|
|
|
165
165
|
occurrences: "{count} occurrences",
|
|
166
166
|
gate_blocked: "Plain-language (klarspråk) output is not yet available in '{lang}'.",
|
|
167
167
|
gate_supported: "Languages with klarspråk: {langs}.",
|
|
168
|
-
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv)."
|
|
168
|
+
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv).",
|
|
169
|
+
gate_fallback: "Plain language is not yet available in {lang}, so this report is shown in English. We add languages one country at a time."
|
|
169
170
|
};
|
|
170
171
|
var en = {
|
|
171
172
|
cli: cli,
|
package/dist/index.d.ts
CHANGED
|
@@ -165,7 +165,8 @@ var plain = {
|
|
|
165
165
|
occurrences: "{count} occurrences",
|
|
166
166
|
gate_blocked: "Plain-language (klarspråk) output is not yet available in '{lang}'.",
|
|
167
167
|
gate_supported: "Languages with klarspråk: {langs}.",
|
|
168
|
-
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv)."
|
|
168
|
+
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv).",
|
|
169
|
+
gate_fallback: "Plain language is not yet available in {lang}, so this report is shown in English. We add languages one country at a time."
|
|
169
170
|
};
|
|
170
171
|
var en = {
|
|
171
172
|
cli: cli,
|
package/dist/index.js
CHANGED
|
@@ -101,7 +101,8 @@ var init_en = __esm({
|
|
|
101
101
|
occurrences: "{count} occurrences",
|
|
102
102
|
gate_blocked: "Plain-language (klarspr\xE5k) output is not yet available in '{lang}'.",
|
|
103
103
|
gate_supported: "Languages with klarspr\xE5k: {langs}.",
|
|
104
|
-
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv)."
|
|
104
|
+
gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv).",
|
|
105
|
+
gate_fallback: "Plain language is not yet available in {lang}, so this report is shown in English. We add languages one country at a time."
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
}
|
|
@@ -171,7 +172,8 @@ var init_sv = __esm({
|
|
|
171
172
|
occurrences: "{count} f\xF6rekomster",
|
|
172
173
|
gate_blocked: "Klarspr\xE5k st\xF6ds \xE4nnu inte p\xE5 '{lang}'.",
|
|
173
174
|
gate_supported: "Spr\xE5k med klarspr\xE5k: {langs}.",
|
|
174
|
-
gate_howto: "K\xF6r utan --plain f\xF6r utvecklarrapporten, eller v\xE4lj ett spr\xE5k som st\xF6ds (t.ex. --lang sv)."
|
|
175
|
+
gate_howto: "K\xF6r utan --plain f\xF6r utvecklarrapporten, eller v\xE4lj ett spr\xE5k som st\xF6ds (t.ex. --lang sv).",
|
|
176
|
+
gate_fallback: "Klarspr\xE5k finns \xE4nnu inte p\xE5 {lang}, s\xE5 den h\xE4r rapporten visas p\xE5 engelska. Vi l\xE4gger till spr\xE5k land f\xF6r land."
|
|
175
177
|
}
|
|
176
178
|
};
|
|
177
179
|
}
|
|
@@ -241,7 +243,8 @@ var init_de = __esm({
|
|
|
241
243
|
occurrences: "{count} occurrences",
|
|
242
244
|
gate_blocked: "Verst\xE4ndliche Sprache (Klarspr\xE5k) ist f\xFCr '{lang}' noch nicht verf\xFCgbar.",
|
|
243
245
|
gate_supported: "Sprachen mit verst\xE4ndlicher Sprache: {langs}.",
|
|
244
|
-
gate_howto: "Ohne --plain ausf\xFChren f\xFCr den Entwicklerbericht, oder eine unterst\xFCtzte Sprache verwenden (z. B. --lang sv)."
|
|
246
|
+
gate_howto: "Ohne --plain ausf\xFChren f\xFCr den Entwicklerbericht, oder eine unterst\xFCtzte Sprache verwenden (z. B. --lang sv).",
|
|
247
|
+
gate_fallback: "Einfache Sprache ist f\xFCr {lang} noch nicht verf\xFCgbar, daher wird dieser Bericht auf Englisch angezeigt. Wir erg\xE4nzen Sprachen Land f\xFCr Land."
|
|
245
248
|
}
|
|
246
249
|
};
|
|
247
250
|
}
|
|
@@ -311,7 +314,8 @@ var init_fr = __esm({
|
|
|
311
314
|
occurrences: "{count} occurrences",
|
|
312
315
|
gate_blocked: "Le langage clair (klarspr\xE5k) n'est pas encore disponible en \xAB {lang} \xBB.",
|
|
313
316
|
gate_supported: "Langues avec langage clair : {langs}.",
|
|
314
|
-
gate_howto: "Lancez sans --plain pour le rapport d\xE9veloppeur, ou utilisez une langue prise en charge (par ex. --lang sv)."
|
|
317
|
+
gate_howto: "Lancez sans --plain pour le rapport d\xE9veloppeur, ou utilisez une langue prise en charge (par ex. --lang sv).",
|
|
318
|
+
gate_fallback: "Le langage clair n\u2019est pas encore disponible en {lang}, ce rapport est donc affich\xE9 en anglais. Nous ajoutons les langues pays par pays."
|
|
315
319
|
}
|
|
316
320
|
};
|
|
317
321
|
}
|
|
@@ -381,7 +385,8 @@ var init_es = __esm({
|
|
|
381
385
|
occurrences: "{count} occurrences",
|
|
382
386
|
gate_blocked: "El lenguaje claro (klarspr\xE5k) a\xFAn no est\xE1 disponible en '{lang}'.",
|
|
383
387
|
gate_supported: "Idiomas con lenguaje claro: {langs}.",
|
|
384
|
-
gate_howto: "Ejecuta sin --plain para el informe para desarrolladores, o usa un idioma compatible (p. ej. --lang sv)."
|
|
388
|
+
gate_howto: "Ejecuta sin --plain para el informe para desarrolladores, o usa un idioma compatible (p. ej. --lang sv).",
|
|
389
|
+
gate_fallback: "El lenguaje claro a\xFAn no est\xE1 disponible en {lang}, por lo que este informe se muestra en ingl\xE9s. A\xF1adimos idiomas pa\xEDs por pa\xEDs."
|
|
385
390
|
}
|
|
386
391
|
};
|
|
387
392
|
}
|
|
@@ -451,7 +456,8 @@ var init_fi = __esm({
|
|
|
451
456
|
occurrences: "{count} occurrences",
|
|
452
457
|
gate_blocked: "Selkokielinen (klarspr\xE5k) raportti ei ole viel\xE4 saatavilla kielell\xE4 '{lang}'.",
|
|
453
458
|
gate_supported: "Kielet, joilla selkokielinen raportti on saatavilla: {langs}.",
|
|
454
|
-
gate_howto: "Aja ilman --plain-valitsinta kehitt\xE4j\xE4raporttia varten tai k\xE4yt\xE4 tuettua kielt\xE4 (esim. --lang sv)."
|
|
459
|
+
gate_howto: "Aja ilman --plain-valitsinta kehitt\xE4j\xE4raporttia varten tai k\xE4yt\xE4 tuettua kielt\xE4 (esim. --lang sv).",
|
|
460
|
+
gate_fallback: "Selkokieli ei ole viel\xE4 saatavilla kielell\xE4 {lang}, joten t\xE4m\xE4 raportti n\xE4ytet\xE4\xE4n englanniksi. Lis\xE4\xE4mme kieli\xE4 maa kerrallaan."
|
|
455
461
|
}
|
|
456
462
|
};
|
|
457
463
|
}
|
|
@@ -521,7 +527,8 @@ var init_dk = __esm({
|
|
|
521
527
|
occurrences: "{count} occurrences",
|
|
522
528
|
gate_blocked: "Klarsprog (klarspr\xE5k) er endnu ikke tilg\xE6ngeligt p\xE5 '{lang}'.",
|
|
523
529
|
gate_supported: "Sprog med klarsprog: {langs}.",
|
|
524
|
-
gate_howto: "K\xF8r uden --plain for udviklerrapporten, eller brug et underst\xF8ttet sprog (f.eks. --lang sv)."
|
|
530
|
+
gate_howto: "K\xF8r uden --plain for udviklerrapporten, eller brug et underst\xF8ttet sprog (f.eks. --lang sv).",
|
|
531
|
+
gate_fallback: "Klarsprog er endnu ikke tilg\xE6ngeligt p\xE5 {lang}, s\xE5 denne rapport vises p\xE5 engelsk. Vi tilf\xF8jer sprog land for land."
|
|
525
532
|
}
|
|
526
533
|
};
|
|
527
534
|
}
|
|
@@ -591,7 +598,8 @@ var init_no = __esm({
|
|
|
591
598
|
occurrences: "{count} occurrences",
|
|
592
599
|
gate_blocked: "Klarspr\xE5k er enn\xE5 ikke tilgjengelig p\xE5 '{lang}'.",
|
|
593
600
|
gate_supported: "Spr\xE5k med klarspr\xE5k: {langs}.",
|
|
594
|
-
gate_howto: "Kj\xF8r uten --plain for utviklerrapporten, eller bruk et st\xF8ttet spr\xE5k (f.eks. --lang sv)."
|
|
601
|
+
gate_howto: "Kj\xF8r uten --plain for utviklerrapporten, eller bruk et st\xF8ttet spr\xE5k (f.eks. --lang sv).",
|
|
602
|
+
gate_fallback: "Klarspr\xE5k er enn\xE5 ikke tilgjengelig p\xE5 {lang}, s\xE5 denne rapporten vises p\xE5 engelsk. Vi legger til spr\xE5k land for land."
|
|
595
603
|
}
|
|
596
604
|
};
|
|
597
605
|
}
|
|
@@ -661,7 +669,8 @@ var init_nl = __esm({
|
|
|
661
669
|
occurrences: "{count} occurrences",
|
|
662
670
|
gate_blocked: "Begrijpelijke taal (klarspr\xE5k) is nog niet beschikbaar in '{lang}'.",
|
|
663
671
|
gate_supported: "Talen met begrijpelijke taal: {langs}.",
|
|
664
|
-
gate_howto: "Voer uit zonder --plain voor het ontwikkelaarsrapport, of gebruik een ondersteunde taal (bijv. --lang sv)."
|
|
672
|
+
gate_howto: "Voer uit zonder --plain voor het ontwikkelaarsrapport, of gebruik een ondersteunde taal (bijv. --lang sv).",
|
|
673
|
+
gate_fallback: "Duidelijke taal is nog niet beschikbaar in {lang}, daarom wordt dit rapport in het Engels getoond. We voegen talen land voor land toe."
|
|
665
674
|
}
|
|
666
675
|
};
|
|
667
676
|
}
|
|
@@ -902,7 +911,7 @@ var HtmlValidator = class {
|
|
|
902
911
|
// src/core/regulatory-scanner.ts
|
|
903
912
|
var import_node_fs = require("fs");
|
|
904
913
|
function getEngineVersion() {
|
|
905
|
-
return "2.
|
|
914
|
+
return "2.12.0";
|
|
906
915
|
}
|
|
907
916
|
function getStandardsVersion() {
|
|
908
917
|
try {
|
|
@@ -1011,7 +1020,7 @@ var RegulatoryScanner = class {
|
|
|
1011
1020
|
});
|
|
1012
1021
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
1013
1022
|
passedCount = axeResults.passes?.length || 0;
|
|
1014
|
-
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);
|
|
1015
1024
|
const scanDuration = Date.now() - startTime;
|
|
1016
1025
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
1017
1026
|
if (htmlValidation) {
|
|
@@ -1045,19 +1054,29 @@ var RegulatoryScanner = class {
|
|
|
1045
1054
|
await page.evaluate(axeSource);
|
|
1046
1055
|
}
|
|
1047
1056
|
/**
|
|
1048
|
-
* Light enrichment — maps axe severity directly
|
|
1049
|
-
*
|
|
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.
|
|
1050
1064
|
*/
|
|
1051
|
-
enrichResultsLight(axeResults) {
|
|
1065
|
+
async enrichResultsLight(axeResults) {
|
|
1052
1066
|
const impactToRisk = {
|
|
1053
1067
|
critical: "critical",
|
|
1054
1068
|
serious: "high",
|
|
1055
1069
|
moderate: "medium",
|
|
1056
1070
|
minor: "low"
|
|
1057
1071
|
};
|
|
1058
|
-
|
|
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) => {
|
|
1059
1077
|
const impact = violation.impact || "moderate";
|
|
1060
1078
|
const risk = impactToRisk[impact] || "medium";
|
|
1079
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? generateRegulatoryReport(violation.id, lang)?.plainLanguage : void 0;
|
|
1061
1080
|
return {
|
|
1062
1081
|
ruleId: violation.id,
|
|
1063
1082
|
wcagCriteria: violation.tags.find((t2) => t2.startsWith("wcag")) || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
@@ -1065,6 +1084,7 @@ var RegulatoryScanner = class {
|
|
|
1065
1084
|
dosLagenReference: "",
|
|
1066
1085
|
diggRisk: risk,
|
|
1067
1086
|
eaaImpact: risk,
|
|
1087
|
+
plainLanguage,
|
|
1068
1088
|
remediation: {
|
|
1069
1089
|
description: violation.help,
|
|
1070
1090
|
technicalGuidance: violation.description,
|
package/dist/index.mjs
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
generateStatement,
|
|
6
6
|
generateStatementContent,
|
|
7
7
|
getEngineVersion
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5S6UAABI.mjs";
|
|
9
9
|
import {
|
|
10
10
|
getCurrentLang,
|
|
11
11
|
setLanguage,
|
|
12
12
|
t
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CE5CPK4U.mjs";
|
|
14
14
|
import "./chunk-DIBTSSLZ.mjs";
|
|
15
15
|
export {
|
|
16
16
|
PseudoAutomationEngine,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
groupReportsByRule,
|
|
3
|
-
impactBreakdown
|
|
4
|
-
|
|
3
|
+
impactBreakdown,
|
|
4
|
+
languageDisplayName
|
|
5
|
+
} from "./chunk-IMRWWO5R.mjs";
|
|
5
6
|
import {
|
|
6
7
|
getCurrentLang,
|
|
7
8
|
setLanguage,
|
|
8
9
|
t
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CE5CPK4U.mjs";
|
|
10
11
|
import "./chunk-DIBTSSLZ.mjs";
|
|
11
12
|
|
|
12
13
|
// src/reporting/plain-report.ts
|
|
@@ -38,8 +39,12 @@ var BADGE_KEY = {
|
|
|
38
39
|
function levelOf(report) {
|
|
39
40
|
return report.plainLanguage?.impactLevel ?? RISK_TO_IMPACT[report.holmdigitalInsight.diggRisk] ?? "putsning";
|
|
40
41
|
}
|
|
41
|
-
function renderPlainReport(result, lang = "en") {
|
|
42
|
+
function renderPlainReport(result, lang = "en", plainFallbackFrom) {
|
|
42
43
|
setLanguage(lang);
|
|
44
|
+
if (plainFallbackFrom) {
|
|
45
|
+
console.log(chalk.yellow(t("plain.gate_fallback", { lang: languageDisplayName(plainFallbackFrom) })));
|
|
46
|
+
console.log("");
|
|
47
|
+
}
|
|
43
48
|
if (result.reports.length === 0) {
|
|
44
49
|
console.log(t("plain.empty_state"));
|
|
45
50
|
console.log("");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holmdigital/engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -83,21 +83,21 @@
|
|
|
83
83
|
"license": "MIT",
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@holmdigital/components": "^3.0.0",
|
|
86
|
-
"@holmdigital/standards": "^2.
|
|
86
|
+
"@holmdigital/standards": "^2.10.0",
|
|
87
87
|
"axe-core": "^4.12.1",
|
|
88
88
|
"chalk": "^5.3.0",
|
|
89
|
-
"commander": "^
|
|
89
|
+
"commander": "^15.0.0",
|
|
90
90
|
"cosmiconfig": "^9.0.2",
|
|
91
|
-
"html-validate": "11.5.
|
|
92
|
-
"ora": "^
|
|
93
|
-
"puppeteer": "25.2.
|
|
91
|
+
"html-validate": "11.5.4",
|
|
92
|
+
"ora": "^9.4.1",
|
|
93
|
+
"puppeteer": "25.2.1",
|
|
94
94
|
"react": "^18.3.1 || ^19.0.0",
|
|
95
95
|
"react-dom": "^18.3.1 || ^19.0.0",
|
|
96
96
|
"ws": "^8.18.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@types/cosmiconfig": "^
|
|
100
|
-
"@types/node": "^26.0.
|
|
99
|
+
"@types/cosmiconfig": "^6.0.3",
|
|
100
|
+
"@types/node": "^26.0.1",
|
|
101
101
|
"@types/react": "^18.3.1 || ^19.0.0",
|
|
102
102
|
"@types/react-dom": "^18.3.1 || ^19.0.0",
|
|
103
103
|
"@types/ws": "^8.5.13",
|
package/dist/chunk-VNNYP4NV.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/reporting/plain-group.ts
|
|
2
|
-
function groupReportsByRule(reports) {
|
|
3
|
-
const groups = /* @__PURE__ */ new Map();
|
|
4
|
-
for (const report of reports) {
|
|
5
|
-
const existing = groups.get(report.ruleId);
|
|
6
|
-
if (existing) {
|
|
7
|
-
existing.count += 1;
|
|
8
|
-
} else {
|
|
9
|
-
groups.set(report.ruleId, { report, count: 1 });
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return [...groups.values()];
|
|
13
|
-
}
|
|
14
|
-
function impactBreakdown(reports, levelOf, order) {
|
|
15
|
-
const counts = /* @__PURE__ */ new Map();
|
|
16
|
-
for (const report of reports) {
|
|
17
|
-
const level = levelOf(report);
|
|
18
|
-
counts.set(level, (counts.get(level) ?? 0) + 1);
|
|
19
|
-
}
|
|
20
|
-
return [...counts.entries()].map(([level, count]) => ({ level, count })).sort((a, b) => (order[a.level] ?? 4) - (order[b.level] ?? 4));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
groupReportsByRule,
|
|
25
|
-
impactBreakdown
|
|
26
|
-
};
|