@holmdigital/engine 2.5.6 → 2.6.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.
- package/dist/{chunk-YI5WLSPC.mjs → chunk-DIVBAW6U.mjs} +2 -2
- package/dist/{chunk-FBGKWDZT.mjs → chunk-TT3JDVGJ.mjs} +189 -0
- package/dist/cli/index.js +674 -61
- package/dist/cli/index.mjs +362 -17
- package/dist/{i18n-ZLEGILHH.mjs → i18n-SE7FLXIF.mjs} +1 -1
- package/dist/index.d.mts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +190 -1
- package/dist/index.mjs +2 -2
- package/dist/plain-report-AK5QAT5P.mjs +77 -0
- package/package.json +3 -3
package/dist/cli/index.js
CHANGED
|
@@ -77,6 +77,27 @@ var init_en = __esm({
|
|
|
77
77
|
prescriptive_fix: "\u{1F4A1} Prescriptive Fix",
|
|
78
78
|
use: "Use",
|
|
79
79
|
footer: "Generated by @holmdigital/engine v{version} \u2022 Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
|
|
80
|
+
},
|
|
81
|
+
plain: {
|
|
82
|
+
what_happens: "What happens:",
|
|
83
|
+
who_is_affected: "Who is affected:",
|
|
84
|
+
business_impact: "What it costs you:",
|
|
85
|
+
how_to_fix: "How to fix it:",
|
|
86
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
87
|
+
badge_hindrar: "Excludes customers",
|
|
88
|
+
badge_forsamrar: "Degrades experience",
|
|
89
|
+
badge_putsning: "Worth polishing",
|
|
90
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
91
|
+
sorted_by: "Sorted by business impact",
|
|
92
|
+
intro_found: "Found {count} {unit}",
|
|
93
|
+
intro_unit_singular: "issue",
|
|
94
|
+
intro_unit_plural: "issues",
|
|
95
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
96
|
+
empty_state: "No barriers found this time.",
|
|
97
|
+
report_title: "Accessibility report for {url}",
|
|
98
|
+
report_tagline: "Accessibility report",
|
|
99
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
100
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
80
101
|
}
|
|
81
102
|
};
|
|
82
103
|
}
|
|
@@ -122,6 +143,27 @@ var init_sv = __esm({
|
|
|
122
143
|
prescriptive_fix: "\u{1F4A1} Preskriptiv L\xF6sning",
|
|
123
144
|
use: "Anv\xE4nd",
|
|
124
145
|
footer: "Genererad av @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, DOS-lagen"
|
|
146
|
+
},
|
|
147
|
+
plain: {
|
|
148
|
+
what_happens: "Vad som h\xE4nder:",
|
|
149
|
+
who_is_affected: "Vem det drabbar:",
|
|
150
|
+
business_impact: "Vad det kostar:",
|
|
151
|
+
how_to_fix: "S\xE5 fixar du:",
|
|
152
|
+
badge_stoppar_kop: "Stoppar k\xF6p",
|
|
153
|
+
badge_hindrar: "Hindrar kunder",
|
|
154
|
+
badge_forsamrar: "F\xF6rs\xE4mrar upplevelsen",
|
|
155
|
+
badge_putsning: "V\xE4rt att putsa",
|
|
156
|
+
intro_framing: "Det betyder inte att du gjort n\xE5got fel. De flesta som bygger en webbplats f\xE5r aldrig veta att tillg\xE4nglighet ens \xE4r en sak. Nu vet du. H\xE4r \xE4r vad som \xE4r v\xE4rt att b\xF6rja med, sorterat efter vad som kostar dig mest kunder.",
|
|
157
|
+
sorted_by: "Sorterat efter aff\xE4rsp\xE5verkan",
|
|
158
|
+
intro_found: "Hittade {count} {unit}",
|
|
159
|
+
intro_unit_singular: "hinder",
|
|
160
|
+
intro_unit_plural: "hinder",
|
|
161
|
+
closing: "B\xF6rja uppifr\xE5n. Punkterna h\xF6gst upp kostar dig mest kunder.",
|
|
162
|
+
empty_state: "Vi hittade inga hinder den h\xE4r g\xE5ngen.",
|
|
163
|
+
report_title: "Tillg\xE4nglighetsrapport f\xF6r {url}",
|
|
164
|
+
report_tagline: "Tillg\xE4nglighetsrapport",
|
|
165
|
+
attribution: "Rapporten genererades av HolmDigital Engine, en del av HolmDigitals ekosystem f\xF6r tillg\xE4nglighet.",
|
|
166
|
+
fallback_framing: "Tekniskt fynd. Be er utvecklare titta p\xE5 detta:"
|
|
125
167
|
}
|
|
126
168
|
};
|
|
127
169
|
}
|
|
@@ -167,6 +209,27 @@ var init_de = __esm({
|
|
|
167
209
|
prescriptive_fix: "\u{1F4A1} Vorschriftsm\xE4\xDFige L\xF6sung",
|
|
168
210
|
use: "Verwenden",
|
|
169
211
|
footer: "Generiert von @holmdigital/engine v{version} \u2022 Standards: WCAG 2.1 AA, EN 301 549, BITV 2.0"
|
|
212
|
+
},
|
|
213
|
+
plain: {
|
|
214
|
+
what_happens: "What happens:",
|
|
215
|
+
who_is_affected: "Who is affected:",
|
|
216
|
+
business_impact: "What it costs you:",
|
|
217
|
+
how_to_fix: "How to fix it:",
|
|
218
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
219
|
+
badge_hindrar: "Excludes customers",
|
|
220
|
+
badge_forsamrar: "Degrades experience",
|
|
221
|
+
badge_putsning: "Worth polishing",
|
|
222
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
223
|
+
sorted_by: "Sorted by business impact",
|
|
224
|
+
intro_found: "Found {count} {unit}",
|
|
225
|
+
intro_unit_singular: "issue",
|
|
226
|
+
intro_unit_plural: "issues",
|
|
227
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
228
|
+
empty_state: "No barriers found this time.",
|
|
229
|
+
report_title: "Accessibility report for {url}",
|
|
230
|
+
report_tagline: "Accessibility report",
|
|
231
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
232
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
170
233
|
}
|
|
171
234
|
};
|
|
172
235
|
}
|
|
@@ -212,6 +275,27 @@ var init_fr = __esm({
|
|
|
212
275
|
prescriptive_fix: "\u{1F4A1} Solution Prescriptive",
|
|
213
276
|
use: "Utiliser",
|
|
214
277
|
footer: "G\xE9n\xE9r\xE9 par @holmdigital/engine v{version} \u2022 Standards : WCAG 2.1 AA, EN 301 549, RGAA"
|
|
278
|
+
},
|
|
279
|
+
plain: {
|
|
280
|
+
what_happens: "What happens:",
|
|
281
|
+
who_is_affected: "Who is affected:",
|
|
282
|
+
business_impact: "What it costs you:",
|
|
283
|
+
how_to_fix: "How to fix it:",
|
|
284
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
285
|
+
badge_hindrar: "Excludes customers",
|
|
286
|
+
badge_forsamrar: "Degrades experience",
|
|
287
|
+
badge_putsning: "Worth polishing",
|
|
288
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
289
|
+
sorted_by: "Sorted by business impact",
|
|
290
|
+
intro_found: "Found {count} {unit}",
|
|
291
|
+
intro_unit_singular: "issue",
|
|
292
|
+
intro_unit_plural: "issues",
|
|
293
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
294
|
+
empty_state: "No barriers found this time.",
|
|
295
|
+
report_title: "Accessibility report for {url}",
|
|
296
|
+
report_tagline: "Accessibility report",
|
|
297
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
298
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
215
299
|
}
|
|
216
300
|
};
|
|
217
301
|
}
|
|
@@ -257,6 +341,27 @@ var init_es = __esm({
|
|
|
257
341
|
prescriptive_fix: "\u{1F4A1} Soluci\xF3n Prescriptiva",
|
|
258
342
|
use: "Usar",
|
|
259
343
|
footer: "Generado por @holmdigital/engine v{version} \u2022 Est\xE1ndares: WCAG 2.1 AA, EN 301 549, UNE 139803"
|
|
344
|
+
},
|
|
345
|
+
plain: {
|
|
346
|
+
what_happens: "What happens:",
|
|
347
|
+
who_is_affected: "Who is affected:",
|
|
348
|
+
business_impact: "What it costs you:",
|
|
349
|
+
how_to_fix: "How to fix it:",
|
|
350
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
351
|
+
badge_hindrar: "Excludes customers",
|
|
352
|
+
badge_forsamrar: "Degrades experience",
|
|
353
|
+
badge_putsning: "Worth polishing",
|
|
354
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
355
|
+
sorted_by: "Sorted by business impact",
|
|
356
|
+
intro_found: "Found {count} {unit}",
|
|
357
|
+
intro_unit_singular: "issue",
|
|
358
|
+
intro_unit_plural: "issues",
|
|
359
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
360
|
+
empty_state: "No barriers found this time.",
|
|
361
|
+
report_title: "Accessibility report for {url}",
|
|
362
|
+
report_tagline: "Accessibility report",
|
|
363
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
364
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
260
365
|
}
|
|
261
366
|
};
|
|
262
367
|
}
|
|
@@ -302,6 +407,27 @@ var init_fi = __esm({
|
|
|
302
407
|
prescriptive_fix: "\u{1F4A1} Ehdotettu korjaus",
|
|
303
408
|
use: "K\xE4yt\xE4",
|
|
304
409
|
footer: "Luonut @holmdigital/engine v{version} \u2022 Standardit: WCAG 2.1 AA, EN 301 549, Digipalvelulaki"
|
|
410
|
+
},
|
|
411
|
+
plain: {
|
|
412
|
+
what_happens: "What happens:",
|
|
413
|
+
who_is_affected: "Who is affected:",
|
|
414
|
+
business_impact: "What it costs you:",
|
|
415
|
+
how_to_fix: "How to fix it:",
|
|
416
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
417
|
+
badge_hindrar: "Excludes customers",
|
|
418
|
+
badge_forsamrar: "Degrades experience",
|
|
419
|
+
badge_putsning: "Worth polishing",
|
|
420
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
421
|
+
sorted_by: "Sorted by business impact",
|
|
422
|
+
intro_found: "Found {count} {unit}",
|
|
423
|
+
intro_unit_singular: "issue",
|
|
424
|
+
intro_unit_plural: "issues",
|
|
425
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
426
|
+
empty_state: "No barriers found this time.",
|
|
427
|
+
report_title: "Accessibility report for {url}",
|
|
428
|
+
report_tagline: "Accessibility report",
|
|
429
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
430
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
305
431
|
}
|
|
306
432
|
};
|
|
307
433
|
}
|
|
@@ -347,6 +473,27 @@ var init_dk = __esm({
|
|
|
347
473
|
prescriptive_fix: "\u{1F4A1} Foresl\xE5et L\xF8sning",
|
|
348
474
|
use: "Brug",
|
|
349
475
|
footer: "Genereret af @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Lov om tilg\xE6ngelighed"
|
|
476
|
+
},
|
|
477
|
+
plain: {
|
|
478
|
+
what_happens: "What happens:",
|
|
479
|
+
who_is_affected: "Who is affected:",
|
|
480
|
+
business_impact: "What it costs you:",
|
|
481
|
+
how_to_fix: "How to fix it:",
|
|
482
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
483
|
+
badge_hindrar: "Excludes customers",
|
|
484
|
+
badge_forsamrar: "Degrades experience",
|
|
485
|
+
badge_putsning: "Worth polishing",
|
|
486
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
487
|
+
sorted_by: "Sorted by business impact",
|
|
488
|
+
intro_found: "Found {count} {unit}",
|
|
489
|
+
intro_unit_singular: "issue",
|
|
490
|
+
intro_unit_plural: "issues",
|
|
491
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
492
|
+
empty_state: "No barriers found this time.",
|
|
493
|
+
report_title: "Accessibility report for {url}",
|
|
494
|
+
report_tagline: "Accessibility report",
|
|
495
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
496
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
350
497
|
}
|
|
351
498
|
};
|
|
352
499
|
}
|
|
@@ -392,6 +539,27 @@ var init_no = __esm({
|
|
|
392
539
|
prescriptive_fix: "\u{1F4A1} Foresl\xE5tt L\xF8sning",
|
|
393
540
|
use: "Bruk",
|
|
394
541
|
footer: "Generert av @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Uu-tilsynet"
|
|
542
|
+
},
|
|
543
|
+
plain: {
|
|
544
|
+
what_happens: "What happens:",
|
|
545
|
+
who_is_affected: "Who is affected:",
|
|
546
|
+
business_impact: "What it costs you:",
|
|
547
|
+
how_to_fix: "How to fix it:",
|
|
548
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
549
|
+
badge_hindrar: "Excludes customers",
|
|
550
|
+
badge_forsamrar: "Degrades experience",
|
|
551
|
+
badge_putsning: "Worth polishing",
|
|
552
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
553
|
+
sorted_by: "Sorted by business impact",
|
|
554
|
+
intro_found: "Found {count} {unit}",
|
|
555
|
+
intro_unit_singular: "issue",
|
|
556
|
+
intro_unit_plural: "issues",
|
|
557
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
558
|
+
empty_state: "No barriers found this time.",
|
|
559
|
+
report_title: "Accessibility report for {url}",
|
|
560
|
+
report_tagline: "Accessibility report",
|
|
561
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
562
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
395
563
|
}
|
|
396
564
|
};
|
|
397
565
|
}
|
|
@@ -437,6 +605,27 @@ var init_nl = __esm({
|
|
|
437
605
|
prescriptive_fix: "\u{1F4A1} Voorgeschreven oplossing",
|
|
438
606
|
use: "Gebruik",
|
|
439
607
|
footer: "Gegenereerd door @holmdigital/engine v{version} \u2022 Standaarden: WCAG 2.1 AA, EN 301 549, Besluit digitale toegankelijkheid overheid"
|
|
608
|
+
},
|
|
609
|
+
plain: {
|
|
610
|
+
what_happens: "What happens:",
|
|
611
|
+
who_is_affected: "Who is affected:",
|
|
612
|
+
business_impact: "What it costs you:",
|
|
613
|
+
how_to_fix: "How to fix it:",
|
|
614
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
615
|
+
badge_hindrar: "Excludes customers",
|
|
616
|
+
badge_forsamrar: "Degrades experience",
|
|
617
|
+
badge_putsning: "Worth polishing",
|
|
618
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
619
|
+
sorted_by: "Sorted by business impact",
|
|
620
|
+
intro_found: "Found {count} {unit}",
|
|
621
|
+
intro_unit_singular: "issue",
|
|
622
|
+
intro_unit_plural: "issues",
|
|
623
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
624
|
+
empty_state: "No barriers found this time.",
|
|
625
|
+
report_title: "Accessibility report for {url}",
|
|
626
|
+
report_tagline: "Accessibility report",
|
|
627
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
628
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
440
629
|
}
|
|
441
630
|
};
|
|
442
631
|
}
|
|
@@ -523,6 +712,87 @@ var init_i18n = __esm({
|
|
|
523
712
|
}
|
|
524
713
|
});
|
|
525
714
|
|
|
715
|
+
// src/reporting/plain-report.ts
|
|
716
|
+
var plain_report_exports = {};
|
|
717
|
+
__export(plain_report_exports, {
|
|
718
|
+
renderPlainReport: () => renderPlainReport
|
|
719
|
+
});
|
|
720
|
+
function levelOf(report) {
|
|
721
|
+
return report.plainLanguage?.impactLevel ?? RISK_TO_IMPACT[report.holmdigitalInsight.diggRisk] ?? "putsning";
|
|
722
|
+
}
|
|
723
|
+
function renderPlainReport(result, lang = "en") {
|
|
724
|
+
setLanguage(lang);
|
|
725
|
+
if (result.reports.length === 0) {
|
|
726
|
+
console.log(t("plain.empty_state"));
|
|
727
|
+
console.log("");
|
|
728
|
+
console.log(t("plain.attribution"));
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
const sortedReports = [...result.reports].sort((a, b) => {
|
|
732
|
+
const aLevel = IMPACT_ORDER[levelOf(a)] ?? 4;
|
|
733
|
+
const bLevel = IMPACT_ORDER[levelOf(b)] ?? 4;
|
|
734
|
+
return aLevel - bLevel;
|
|
735
|
+
});
|
|
736
|
+
const count = sortedReports.length;
|
|
737
|
+
const unit = count === 1 ? t("plain.intro_unit_singular") : t("plain.intro_unit_plural");
|
|
738
|
+
console.log(t("plain.intro_framing"));
|
|
739
|
+
console.log(t("plain.intro_found", { count, unit }));
|
|
740
|
+
console.log(t("plain.sorted_by"));
|
|
741
|
+
console.log("");
|
|
742
|
+
sortedReports.forEach((rawReport, index) => {
|
|
743
|
+
const report = rawReport;
|
|
744
|
+
const level = levelOf(report);
|
|
745
|
+
const badgeText = BADGE_CHALK[level](t(BADGE_KEY[level]));
|
|
746
|
+
const pl = report.plainLanguage;
|
|
747
|
+
console.log(`${index + 1}. ${badgeText} \u2014 ${report.ruleId}`);
|
|
748
|
+
if (pl) {
|
|
749
|
+
console.log(` ${t("plain.what_happens")} ${pl.whatHappens}`);
|
|
750
|
+
console.log(` ${t("plain.who_is_affected")} ${pl.whoIsAffected}`);
|
|
751
|
+
console.log(` ${t("plain.business_impact")} ${pl.businessImpact}`);
|
|
752
|
+
console.log(` ${t("plain.how_to_fix")} ${pl.howToFix}`);
|
|
753
|
+
} else {
|
|
754
|
+
console.log(` ${t("plain.fallback_framing")} ${report.remediation.description}`);
|
|
755
|
+
}
|
|
756
|
+
console.log("");
|
|
757
|
+
});
|
|
758
|
+
console.log(t("plain.closing"));
|
|
759
|
+
console.log("");
|
|
760
|
+
console.log(t("plain.attribution"));
|
|
761
|
+
}
|
|
762
|
+
var import_chalk, IMPACT_ORDER, RISK_TO_IMPACT, BADGE_CHALK, BADGE_KEY;
|
|
763
|
+
var init_plain_report = __esm({
|
|
764
|
+
"src/reporting/plain-report.ts"() {
|
|
765
|
+
"use strict";
|
|
766
|
+
init_cjs_shims();
|
|
767
|
+
import_chalk = __toESM(require("chalk"));
|
|
768
|
+
init_i18n();
|
|
769
|
+
IMPACT_ORDER = {
|
|
770
|
+
"stoppar-kop": 0,
|
|
771
|
+
"hindrar": 1,
|
|
772
|
+
"forsamrar": 2,
|
|
773
|
+
"putsning": 3
|
|
774
|
+
};
|
|
775
|
+
RISK_TO_IMPACT = {
|
|
776
|
+
critical: "stoppar-kop",
|
|
777
|
+
high: "hindrar",
|
|
778
|
+
medium: "forsamrar",
|
|
779
|
+
low: "putsning"
|
|
780
|
+
};
|
|
781
|
+
BADGE_CHALK = {
|
|
782
|
+
"stoppar-kop": import_chalk.default.red.bold,
|
|
783
|
+
"hindrar": import_chalk.default.red,
|
|
784
|
+
"forsamrar": import_chalk.default.yellow,
|
|
785
|
+
"putsning": import_chalk.default.gray
|
|
786
|
+
};
|
|
787
|
+
BADGE_KEY = {
|
|
788
|
+
"stoppar-kop": "plain.badge_stoppar_kop",
|
|
789
|
+
"hindrar": "plain.badge_hindrar",
|
|
790
|
+
"forsamrar": "plain.badge_forsamrar",
|
|
791
|
+
"putsning": "plain.badge_putsning"
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
|
|
526
796
|
// src/reporting/github-actions.ts
|
|
527
797
|
var github_actions_exports = {};
|
|
528
798
|
__export(github_actions_exports, {
|
|
@@ -642,7 +912,7 @@ var init_junit_generator = __esm({
|
|
|
642
912
|
// src/cli/index.ts
|
|
643
913
|
init_cjs_shims();
|
|
644
914
|
var import_commander = require("commander");
|
|
645
|
-
var
|
|
915
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
646
916
|
var import_ora = __toESM(require("ora"));
|
|
647
917
|
|
|
648
918
|
// src/core/regulatory-scanner.ts
|
|
@@ -783,7 +1053,7 @@ var HtmlValidator = class {
|
|
|
783
1053
|
// src/core/regulatory-scanner.ts
|
|
784
1054
|
var import_node_fs = require("fs");
|
|
785
1055
|
function getEngineVersion() {
|
|
786
|
-
return "2.
|
|
1056
|
+
return "2.6.1";
|
|
787
1057
|
}
|
|
788
1058
|
function getStandardsVersion() {
|
|
789
1059
|
try {
|
|
@@ -1184,6 +1454,8 @@ test('${testName}', async ({ page }) => {
|
|
|
1184
1454
|
|
|
1185
1455
|
// src/reporting/html-template.ts
|
|
1186
1456
|
init_cjs_shims();
|
|
1457
|
+
var import_node_fs2 = require("fs");
|
|
1458
|
+
var import_node_path = require("path");
|
|
1187
1459
|
|
|
1188
1460
|
// src/reporting/badge-generator.ts
|
|
1189
1461
|
init_cjs_shims();
|
|
@@ -1221,21 +1493,27 @@ var LOCALE_TO_INTL = {
|
|
|
1221
1493
|
"en-us": "en-US",
|
|
1222
1494
|
"en-ca": "en-CA"
|
|
1223
1495
|
};
|
|
1224
|
-
function
|
|
1496
|
+
function formatDate(dateString) {
|
|
1497
|
+
const intlLocale = LOCALE_TO_INTL[getCurrentLang()] || "en-US";
|
|
1498
|
+
return new Date(dateString).toLocaleDateString(intlLocale, {
|
|
1499
|
+
year: "numeric",
|
|
1500
|
+
month: "long",
|
|
1501
|
+
day: "numeric",
|
|
1502
|
+
hour: "2-digit",
|
|
1503
|
+
minute: "2-digit"
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
function escapeHtml(str) {
|
|
1507
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1508
|
+
}
|
|
1509
|
+
function generateReportHTML(result, sector = "public", audience = "developer") {
|
|
1510
|
+
if (audience === "plain") {
|
|
1511
|
+
return generatePlainReportHTML(result);
|
|
1512
|
+
}
|
|
1225
1513
|
const criticalCount = result.stats.critical;
|
|
1226
1514
|
const highCount = result.stats.high;
|
|
1227
1515
|
const htmlErrorsCount = result.htmlValidation?.errors?.length ?? 0;
|
|
1228
1516
|
const scoreColor = result.score > 90 ? "#16a34a" : result.score > 70 ? "#eab308" : "#dc2626";
|
|
1229
|
-
const formatDate = (dateString) => {
|
|
1230
|
-
const intlLocale = LOCALE_TO_INTL[getCurrentLang()] || "en-US";
|
|
1231
|
-
return new Date(dateString).toLocaleDateString(intlLocale, {
|
|
1232
|
-
year: "numeric",
|
|
1233
|
-
month: "long",
|
|
1234
|
-
day: "numeric",
|
|
1235
|
-
hour: "2-digit",
|
|
1236
|
-
minute: "2-digit"
|
|
1237
|
-
});
|
|
1238
|
-
};
|
|
1239
1517
|
return `
|
|
1240
1518
|
<!DOCTYPE html>
|
|
1241
1519
|
<html lang="${getCurrentLang()}">
|
|
@@ -1510,6 +1788,336 @@ function generateReportHTML(result, sector = "public") {
|
|
|
1510
1788
|
</html>
|
|
1511
1789
|
`;
|
|
1512
1790
|
}
|
|
1791
|
+
var PLAIN_IMPACT_ORDER = {
|
|
1792
|
+
"stoppar-kop": 0,
|
|
1793
|
+
"hindrar": 1,
|
|
1794
|
+
"forsamrar": 2,
|
|
1795
|
+
"putsning": 3
|
|
1796
|
+
};
|
|
1797
|
+
var PLAIN_RISK_TO_IMPACT = {
|
|
1798
|
+
critical: "stoppar-kop",
|
|
1799
|
+
high: "hindrar",
|
|
1800
|
+
medium: "forsamrar",
|
|
1801
|
+
low: "putsning"
|
|
1802
|
+
};
|
|
1803
|
+
var PLAIN_BADGE_CLASS = {
|
|
1804
|
+
"stoppar-kop": "badge-stoppar-kop",
|
|
1805
|
+
"hindrar": "badge-hindrar",
|
|
1806
|
+
"forsamrar": "badge-forsamrar",
|
|
1807
|
+
"putsning": "badge-putsning"
|
|
1808
|
+
};
|
|
1809
|
+
var PLAIN_BADGE_KEY = {
|
|
1810
|
+
"stoppar-kop": "plain.badge_stoppar_kop",
|
|
1811
|
+
"hindrar": "plain.badge_hindrar",
|
|
1812
|
+
"forsamrar": "plain.badge_forsamrar",
|
|
1813
|
+
"putsning": "plain.badge_putsning"
|
|
1814
|
+
};
|
|
1815
|
+
function plainLevelOf(report) {
|
|
1816
|
+
return report.plainLanguage?.impactLevel ?? PLAIN_RISK_TO_IMPACT[report.holmdigitalInsight.diggRisk] ?? "putsning";
|
|
1817
|
+
}
|
|
1818
|
+
var cachedLogoDataUri = null;
|
|
1819
|
+
function getLogoDataUri() {
|
|
1820
|
+
if (cachedLogoDataUri !== null) {
|
|
1821
|
+
return cachedLogoDataUri;
|
|
1822
|
+
}
|
|
1823
|
+
const candidates = [
|
|
1824
|
+
(0, import_node_path.join)(__dirname, "assets", "logo.jpg"),
|
|
1825
|
+
// dist/ and dist/cli/ (copy-assets.mjs)
|
|
1826
|
+
(0, import_node_path.join)(__dirname, "..", "assets", "logo.jpg")
|
|
1827
|
+
// src tree (dev/tests)
|
|
1828
|
+
];
|
|
1829
|
+
for (const candidate of candidates) {
|
|
1830
|
+
try {
|
|
1831
|
+
const buffer = (0, import_node_fs2.readFileSync)(candidate);
|
|
1832
|
+
cachedLogoDataUri = `data:image/jpeg;base64,${buffer.toString("base64")}`;
|
|
1833
|
+
return cachedLogoDataUri;
|
|
1834
|
+
} catch {
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
cachedLogoDataUri = "";
|
|
1838
|
+
return cachedLogoDataUri;
|
|
1839
|
+
}
|
|
1840
|
+
function generatePlainReportHTML(result) {
|
|
1841
|
+
const lang = getCurrentLang();
|
|
1842
|
+
const safeUrl = escapeHtml(result.url);
|
|
1843
|
+
const logoDataUri = getLogoDataUri();
|
|
1844
|
+
const sortedReports = [...result.reports].sort((a, b) => {
|
|
1845
|
+
const aLevel = PLAIN_IMPACT_ORDER[plainLevelOf(a)] ?? 4;
|
|
1846
|
+
const bLevel = PLAIN_IMPACT_ORDER[plainLevelOf(b)] ?? 4;
|
|
1847
|
+
return aLevel - bLevel;
|
|
1848
|
+
});
|
|
1849
|
+
const count = sortedReports.length;
|
|
1850
|
+
const unit = count === 1 ? t("plain.intro_unit_singular") : t("plain.intro_unit_plural");
|
|
1851
|
+
const itemsHtml = sortedReports.length === 0 ? `<p>${t("plain.empty_state")}</p>` : `<ul class="issue-list">
|
|
1852
|
+
${sortedReports.map((rawReport) => {
|
|
1853
|
+
const report = rawReport;
|
|
1854
|
+
const level = plainLevelOf(report);
|
|
1855
|
+
const badgeClass = PLAIN_BADGE_CLASS[level];
|
|
1856
|
+
const cardClass = `issue-item--${level}`;
|
|
1857
|
+
const badgeText = escapeHtml(t(PLAIN_BADGE_KEY[level]));
|
|
1858
|
+
const pl = report.plainLanguage;
|
|
1859
|
+
if (pl) {
|
|
1860
|
+
return ` <li class="issue-item ${cardClass}">
|
|
1861
|
+
<span class="badge ${badgeClass}">${badgeText}</span>
|
|
1862
|
+
<strong class="issue-id">${escapeHtml(report.ruleId)}</strong>
|
|
1863
|
+
<dl class="issue-fields">
|
|
1864
|
+
<dt>${t("plain.what_happens")}</dt><dd>${escapeHtml(pl.whatHappens)}</dd>
|
|
1865
|
+
<dt>${t("plain.who_is_affected")}</dt><dd>${escapeHtml(pl.whoIsAffected)}</dd>
|
|
1866
|
+
<dt>${t("plain.business_impact")}</dt><dd>${escapeHtml(pl.businessImpact)}</dd>
|
|
1867
|
+
<dt>${t("plain.how_to_fix")}</dt><dd>${escapeHtml(pl.howToFix)}</dd>
|
|
1868
|
+
</dl>
|
|
1869
|
+
</li>`;
|
|
1870
|
+
} else {
|
|
1871
|
+
return ` <li class="issue-item ${cardClass}">
|
|
1872
|
+
<span class="badge ${badgeClass}">${badgeText}</span>
|
|
1873
|
+
<strong class="issue-id">${escapeHtml(report.ruleId)}</strong>
|
|
1874
|
+
<p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span> ${escapeHtml(report.remediation.description)}</p>
|
|
1875
|
+
</li>`;
|
|
1876
|
+
}
|
|
1877
|
+
}).join("\n")}
|
|
1878
|
+
</ul>`;
|
|
1879
|
+
return `<!DOCTYPE html>
|
|
1880
|
+
<html lang="${lang}">
|
|
1881
|
+
<head>
|
|
1882
|
+
<meta charset="UTF-8">
|
|
1883
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1884
|
+
<title>${t("plain.report_title", { url: safeUrl })}</title>
|
|
1885
|
+
<style>
|
|
1886
|
+
/* ---- Per-page margins (Task G): every printed page, incl. 2+, gets
|
|
1887
|
+
breathing room at top/bottom. An author-level @page rule overrides
|
|
1888
|
+
the zero margins passed to Puppeteer's pdf() call, and it travels
|
|
1889
|
+
with THIS document only \u2014 the developer PDF is unaffected.
|
|
1890
|
+
Bottom margin enlarged (Task H2): reserves footer height + ~8mm
|
|
1891
|
+
so flowing content never overlaps the fixed per-page footer. ---- */
|
|
1892
|
+
@page {
|
|
1893
|
+
margin: 14mm 12mm 22mm;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/* ---- Reset & base ---- */
|
|
1897
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
1898
|
+
body {
|
|
1899
|
+
font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
1900
|
+
background: #ffffff;
|
|
1901
|
+
color: #334155;
|
|
1902
|
+
font-size: 14px;
|
|
1903
|
+
line-height: 1.6;
|
|
1904
|
+
-webkit-print-color-adjust: exact;
|
|
1905
|
+
print-color-adjust: exact;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
/* ---- Page-1 header (Task H1/I): light wiki style \u2014 white band, top
|
|
1909
|
+
accent line, real HolmDigital logo (embedded data URI). In
|
|
1910
|
+
normal flow, so it renders once on page 1 and is NOT repeated. ---- */
|
|
1911
|
+
.report-header {
|
|
1912
|
+
background: #ffffff;
|
|
1913
|
+
border-top: 3px solid #0369a1;
|
|
1914
|
+
border-bottom: 1px solid #e2e8f0;
|
|
1915
|
+
padding: 1.1rem 0 1.25rem;
|
|
1916
|
+
-webkit-print-color-adjust: exact;
|
|
1917
|
+
print-color-adjust: exact;
|
|
1918
|
+
}
|
|
1919
|
+
.report-header__row {
|
|
1920
|
+
display: flex;
|
|
1921
|
+
justify-content: space-between;
|
|
1922
|
+
align-items: flex-start;
|
|
1923
|
+
gap: 2rem;
|
|
1924
|
+
margin-bottom: 1.1rem;
|
|
1925
|
+
}
|
|
1926
|
+
.brand__logo {
|
|
1927
|
+
display: block;
|
|
1928
|
+
width: 160px;
|
|
1929
|
+
height: auto;
|
|
1930
|
+
}
|
|
1931
|
+
.brand__tagline {
|
|
1932
|
+
font-size: 0.6rem;
|
|
1933
|
+
font-weight: 600;
|
|
1934
|
+
letter-spacing: 0.14em;
|
|
1935
|
+
text-transform: uppercase;
|
|
1936
|
+
color: #64748b;
|
|
1937
|
+
margin-top: 0.35rem;
|
|
1938
|
+
}
|
|
1939
|
+
.report-header__meta {
|
|
1940
|
+
text-align: right;
|
|
1941
|
+
font-size: 0.75rem;
|
|
1942
|
+
color: #64748b;
|
|
1943
|
+
line-height: 1.8;
|
|
1944
|
+
white-space: nowrap;
|
|
1945
|
+
flex-shrink: 0;
|
|
1946
|
+
}
|
|
1947
|
+
.report-header__title {
|
|
1948
|
+
font-size: 1.45rem;
|
|
1949
|
+
font-weight: 700;
|
|
1950
|
+
color: #0f172a;
|
|
1951
|
+
line-height: 1.3;
|
|
1952
|
+
word-break: break-all;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
/* ---- Page body wrapper: sides + bottom now come from @page margins ---- */
|
|
1956
|
+
.report-body {
|
|
1957
|
+
max-width: 840px;
|
|
1958
|
+
margin: 0 auto;
|
|
1959
|
+
padding: 1.75rem 0 0;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
/* ---- Intro paragraph ---- */
|
|
1963
|
+
.intro {
|
|
1964
|
+
margin-bottom: 2rem;
|
|
1965
|
+
}
|
|
1966
|
+
.intro p {
|
|
1967
|
+
color: #334155;
|
|
1968
|
+
line-height: 1.7;
|
|
1969
|
+
margin-bottom: 0.5rem;
|
|
1970
|
+
}
|
|
1971
|
+
.intro p:first-child {
|
|
1972
|
+
font-size: 1rem;
|
|
1973
|
+
font-weight: 500;
|
|
1974
|
+
color: #0f172a;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
/* ---- Issue list ---- */
|
|
1978
|
+
.issue-list {
|
|
1979
|
+
list-style: none;
|
|
1980
|
+
padding: 0;
|
|
1981
|
+
margin: 0;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
/* ---- Finding card: comfortable padding + inter-card air (Task G) ---- */
|
|
1985
|
+
.issue-item {
|
|
1986
|
+
background: #f8fafc;
|
|
1987
|
+
border: 1px solid #e2e8f0;
|
|
1988
|
+
border-left: 4px solid #0369a1;
|
|
1989
|
+
border-radius: 8px;
|
|
1990
|
+
padding: 1.4rem 1.6rem;
|
|
1991
|
+
margin-bottom: 1.6rem;
|
|
1992
|
+
break-inside: avoid;
|
|
1993
|
+
page-break-inside: avoid;
|
|
1994
|
+
}
|
|
1995
|
+
.issue-item--stoppar-kop { border-left-color: #b91c1c; }
|
|
1996
|
+
.issue-item--hindrar { border-left-color: #c2410c; }
|
|
1997
|
+
.issue-item--forsamrar { border-left-color: #a16207; }
|
|
1998
|
+
.issue-item--putsning { border-left-color: #475569; }
|
|
1999
|
+
|
|
2000
|
+
/* ---- Badge chip \u2014 white text, WCAG AA contrast against solid background ---- */
|
|
2001
|
+
.badge {
|
|
2002
|
+
display: inline-block;
|
|
2003
|
+
padding: 0.2rem 0.65rem;
|
|
2004
|
+
border-radius: 9999px;
|
|
2005
|
+
font-size: 0.7rem;
|
|
2006
|
+
font-weight: 600;
|
|
2007
|
+
letter-spacing: 0.04em;
|
|
2008
|
+
text-transform: uppercase;
|
|
2009
|
+
color: #ffffff;
|
|
2010
|
+
margin-bottom: 0.6rem;
|
|
2011
|
+
-webkit-print-color-adjust: exact;
|
|
2012
|
+
print-color-adjust: exact;
|
|
2013
|
+
}
|
|
2014
|
+
/* All combos: white on solid \u2014 contrast ratios: #b91c1c 7.5:1, #c2410c 5.6:1, #a16207 4.6:1, #475569 5.9:1 */
|
|
2015
|
+
.badge-stoppar-kop { background: #b91c1c; }
|
|
2016
|
+
.badge-hindrar { background: #c2410c; }
|
|
2017
|
+
.badge-forsamrar { background: #a16207; }
|
|
2018
|
+
.badge-putsning { background: #475569; }
|
|
2019
|
+
|
|
2020
|
+
/* ---- Rule ID ---- */
|
|
2021
|
+
.issue-id {
|
|
2022
|
+
display: block;
|
|
2023
|
+
font-size: 0.78rem;
|
|
2024
|
+
font-weight: 600;
|
|
2025
|
+
color: #64748b;
|
|
2026
|
+
font-family: ui-monospace, 'Cascadia Code', 'Courier New', monospace;
|
|
2027
|
+
margin-bottom: 0.75rem;
|
|
2028
|
+
break-after: avoid;
|
|
2029
|
+
page-break-after: avoid;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/* ---- Field label/value pairs ---- */
|
|
2033
|
+
.issue-fields { margin: 0; }
|
|
2034
|
+
.issue-fields dt {
|
|
2035
|
+
font-weight: 600;
|
|
2036
|
+
font-size: 0.78rem;
|
|
2037
|
+
color: #0f172a;
|
|
2038
|
+
margin-top: 0.65rem;
|
|
2039
|
+
}
|
|
2040
|
+
.issue-fields dd {
|
|
2041
|
+
margin-left: 0;
|
|
2042
|
+
font-size: 0.9rem;
|
|
2043
|
+
color: #334155;
|
|
2044
|
+
line-height: 1.55;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
/* ---- Fallback (no plainLanguage data) ---- */
|
|
2048
|
+
.issue-fallback {
|
|
2049
|
+
font-size: 0.9rem;
|
|
2050
|
+
color: #334155;
|
|
2051
|
+
margin: 0.5rem 0 0;
|
|
2052
|
+
line-height: 1.5;
|
|
2053
|
+
}
|
|
2054
|
+
.fallback-framing {
|
|
2055
|
+
font-weight: 600;
|
|
2056
|
+
color: #0f172a;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
/* ---- Closing line ---- */
|
|
2060
|
+
.closing {
|
|
2061
|
+
margin-top: 2rem;
|
|
2062
|
+
font-size: 0.95rem;
|
|
2063
|
+
font-weight: 600;
|
|
2064
|
+
color: #0f172a;
|
|
2065
|
+
break-before: avoid;
|
|
2066
|
+
page-break-before: avoid;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
/* ---- Fixed per-page footer (Task H2): position:fixed elements are
|
|
2070
|
+
repeated on every printed page in Chromium print-to-PDF. White
|
|
2071
|
+
background + top border so cards never show through; the @page
|
|
2072
|
+
bottom margin reserves the vertical space. ---- */
|
|
2073
|
+
.page-footer {
|
|
2074
|
+
position: fixed;
|
|
2075
|
+
bottom: 0;
|
|
2076
|
+
left: 0;
|
|
2077
|
+
right: 0;
|
|
2078
|
+
background: #ffffff;
|
|
2079
|
+
border-top: 1px solid #e2e8f0;
|
|
2080
|
+
padding: 0.45rem 0 0.35rem;
|
|
2081
|
+
font-size: 0.7rem;
|
|
2082
|
+
color: #64748b;
|
|
2083
|
+
line-height: 1.7;
|
|
2084
|
+
-webkit-print-color-adjust: exact;
|
|
2085
|
+
print-color-adjust: exact;
|
|
2086
|
+
}
|
|
2087
|
+
</style>
|
|
2088
|
+
</head>
|
|
2089
|
+
<body>
|
|
2090
|
+
<header class="report-header">
|
|
2091
|
+
<div class="report-header__row">
|
|
2092
|
+
<div class="brand">
|
|
2093
|
+
${logoDataUri ? `<img class="brand__logo" src="${logoDataUri}" alt="Holm Digital logotyp">` : ""}
|
|
2094
|
+
<div class="brand__tagline">${escapeHtml(t("plain.report_tagline"))}</div>
|
|
2095
|
+
</div>
|
|
2096
|
+
<div class="report-header__meta">
|
|
2097
|
+
${formatDate(result.timestamp)}<br>v${getEngineVersion()}
|
|
2098
|
+
</div>
|
|
2099
|
+
</div>
|
|
2100
|
+
<div class="report-header__title">${safeUrl}</div>
|
|
2101
|
+
</header>
|
|
2102
|
+
|
|
2103
|
+
<div class="report-body">
|
|
2104
|
+
<div class="intro">
|
|
2105
|
+
<p>${t("plain.intro_framing")}</p>
|
|
2106
|
+
<p>${t("plain.intro_found", { count, unit })}</p>
|
|
2107
|
+
</div>
|
|
2108
|
+
|
|
2109
|
+
${itemsHtml}
|
|
2110
|
+
|
|
2111
|
+
<p class="closing">${t("plain.closing")}</p>
|
|
2112
|
+
</div>
|
|
2113
|
+
|
|
2114
|
+
<footer class="page-footer">
|
|
2115
|
+
${safeUrl} • ${formatDate(result.timestamp)} • v${getEngineVersion()}
|
|
2116
|
+
<br>${escapeHtml(t("plain.attribution"))}
|
|
2117
|
+
</footer>
|
|
2118
|
+
</body>
|
|
2119
|
+
</html>`;
|
|
2120
|
+
}
|
|
1513
2121
|
|
|
1514
2122
|
// src/reporting/pdf-generator.ts
|
|
1515
2123
|
init_cjs_shims();
|
|
@@ -1980,7 +2588,7 @@ function isValidUrl(urlString) {
|
|
|
1980
2588
|
}
|
|
1981
2589
|
var program = new import_commander.Command();
|
|
1982
2590
|
program.name("hd-a11y-scan").description("HolmDigital Regulatory Scanner").version(getEngineVersion());
|
|
1983
|
-
program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--sector <type>", "Sector type: public (WAD) or private (EAA)", "public").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").option("--light", "Light scan: fast score-only mode (skips HTML validation and detailed legal mapping)").action(async (url, cliOptions) => {
|
|
2591
|
+
program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--sector <type>", "Sector type: public (WAD) or private (EAA)", "public").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").option("--light", "Light scan: fast score-only mode (skips HTML validation and detailed legal mapping)").option("--audience <mode>", "Output audience: developer (default) or plain", "developer").option("--plain", "Alias for --audience plain (klarspr\xE5ksl\xE4ge for non-technical recipients)").action(async (url, cliOptions) => {
|
|
1984
2592
|
const explorer = (0, import_cosmiconfig.cosmiconfig)("a11y");
|
|
1985
2593
|
const configResult = await explorer.search();
|
|
1986
2594
|
const fileConfig = configResult ? configResult.config : {};
|
|
@@ -2007,15 +2615,17 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2007
2615
|
country: cliOptions.country || fileConfig.country,
|
|
2008
2616
|
sector: cliOptions.sector || fileConfig.sector || "public",
|
|
2009
2617
|
publishDate: cliOptions.publishDate || fileConfig.publishDate,
|
|
2010
|
-
light: cliOptions.light ?? fileConfig.light ?? false
|
|
2618
|
+
light: cliOptions.light ?? fileConfig.light ?? false,
|
|
2619
|
+
plain: cliOptions.plain ?? fileConfig.plain ?? false,
|
|
2620
|
+
audience: cliOptions.plain ? "plain" : cliOptions.audience || fileConfig.audience || "developer"
|
|
2011
2621
|
};
|
|
2012
2622
|
setLanguage(options.lang);
|
|
2013
2623
|
if (!isValidUrl(url)) {
|
|
2014
2624
|
}
|
|
2015
2625
|
if (!options.json) {
|
|
2016
|
-
console.log(
|
|
2017
|
-
if (configResult) console.log(
|
|
2018
|
-
console.log(
|
|
2626
|
+
console.log(import_chalk2.default.blue.bold(t("cli.title")));
|
|
2627
|
+
if (configResult) console.log(import_chalk2.default.gray(`Loaded config from ${configResult.filepath}`));
|
|
2628
|
+
console.log(import_chalk2.default.gray(t("cli.scanning", { url })));
|
|
2019
2629
|
}
|
|
2020
2630
|
const spinner = !options.json ? (0, import_ora.default)(t("cli.initializing")).start() : null;
|
|
2021
2631
|
let scanner;
|
|
@@ -2046,7 +2656,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2046
2656
|
if (spinner) spinner.succeed(t("cli.complete"));
|
|
2047
2657
|
if (options.pdf) {
|
|
2048
2658
|
if (spinner) spinner.start(t("cli.generating_pdf"));
|
|
2049
|
-
const html = generateReportHTML(result, options.sector);
|
|
2659
|
+
const html = options.audience === "plain" ? generateReportHTML(result, options.sector, "plain") : generateReportHTML(result, options.sector);
|
|
2050
2660
|
await generatePDF(html, options.pdf);
|
|
2051
2661
|
if (spinner) spinner.succeed(t("cli.pdf_saved", { path: options.pdf }));
|
|
2052
2662
|
}
|
|
@@ -2086,33 +2696,36 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2086
2696
|
} else if (options.json) {
|
|
2087
2697
|
console.log(JSON.stringify(result, null, 2));
|
|
2088
2698
|
} else if (options.light) {
|
|
2089
|
-
const scoreColor = result.score >= 90 ?
|
|
2090
|
-
const statusColor = result.complianceStatus === "PASS" ?
|
|
2699
|
+
const scoreColor = result.score >= 90 ? import_chalk2.default.green : result.score >= 70 ? import_chalk2.default.yellow : import_chalk2.default.red;
|
|
2700
|
+
const statusColor = result.complianceStatus === "PASS" ? import_chalk2.default.green : import_chalk2.default.red;
|
|
2091
2701
|
console.log("");
|
|
2092
|
-
console.log(
|
|
2093
|
-
console.log(
|
|
2702
|
+
console.log(import_chalk2.default.bold(`Score: ${scoreColor(`${result.score}/100`)} Status: ${statusColor(result.complianceStatus)}`));
|
|
2703
|
+
console.log(import_chalk2.default.gray(`Critical: ${result.stats.critical} | High: ${result.stats.high} | Medium: ${result.stats.medium} | Low: ${result.stats.low}`));
|
|
2094
2704
|
if (result.reports.length > 0) {
|
|
2095
2705
|
console.log("");
|
|
2096
|
-
console.log(
|
|
2706
|
+
console.log(import_chalk2.default.bold("Top Issues:"));
|
|
2097
2707
|
result.reports.slice(0, 5).forEach((r) => {
|
|
2098
|
-
const color = r.holmdigitalInsight.diggRisk === "critical" ?
|
|
2708
|
+
const color = r.holmdigitalInsight.diggRisk === "critical" ? import_chalk2.default.red : r.holmdigitalInsight.diggRisk === "high" ? import_chalk2.default.yellow : import_chalk2.default.gray;
|
|
2099
2709
|
console.log(color(` [${r.holmdigitalInsight.diggRisk.toUpperCase()}] ${r.ruleId} \u2014 ${r.remediation.description}`));
|
|
2100
2710
|
});
|
|
2101
2711
|
}
|
|
2102
|
-
console.log(
|
|
2712
|
+
console.log(import_chalk2.default.gray(`
|
|
2103
2713
|
Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
2714
|
+
} else if (options.audience === "plain") {
|
|
2715
|
+
const { renderPlainReport: renderPlainReport2 } = await Promise.resolve().then(() => (init_plain_report(), plain_report_exports));
|
|
2716
|
+
renderPlainReport2(result, options.lang);
|
|
2104
2717
|
} else {
|
|
2105
2718
|
console.log("\n");
|
|
2106
|
-
const scoreColor = result.score >= 90 ?
|
|
2107
|
-
console.log(
|
|
2719
|
+
const scoreColor = result.score >= 90 ? import_chalk2.default.green : result.score >= 70 ? import_chalk2.default.yellow : import_chalk2.default.red;
|
|
2720
|
+
console.log(import_chalk2.default.bold(`[ Compliance Score: ${scoreColor(result.score + "/100")} ] ${result.score >= 90 ? "\u{1F7E2}" : result.score >= 70 ? "\u{1F7E1}" : "\u{1F534}"}`));
|
|
2108
2721
|
if (result.score === 100) {
|
|
2109
2722
|
const badge = generateBadgeMarkdown(result.score);
|
|
2110
2723
|
if (badge) {
|
|
2111
|
-
console.log(
|
|
2112
|
-
console.log(
|
|
2724
|
+
console.log(import_chalk2.default.green.bold("\n\u{1F3C6} Perfect Score! Here is your accessibility badge:"));
|
|
2725
|
+
console.log(import_chalk2.default.white(badge));
|
|
2113
2726
|
}
|
|
2114
2727
|
}
|
|
2115
|
-
console.log(
|
|
2728
|
+
console.log(import_chalk2.default.gray("----------------------------------------"));
|
|
2116
2729
|
const calculateCategoryScore = (filterFn) => {
|
|
2117
2730
|
const failures = result.reports.filter(filterFn).length;
|
|
2118
2731
|
return Math.max(10, 100 - failures * 20);
|
|
@@ -2140,11 +2753,11 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
2140
2753
|
const empty = width - filled;
|
|
2141
2754
|
const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
|
|
2142
2755
|
let statusText = `${cat.score}%`;
|
|
2143
|
-
if (cat.critical) statusText +=
|
|
2144
|
-
else if (cat.score < 100) statusText +=
|
|
2145
|
-
console.log(`${cat.name} [${cat.score >= 80 ?
|
|
2756
|
+
if (cat.critical) statusText += import_chalk2.default.red(" (CRITICAL FAIL)");
|
|
2757
|
+
else if (cat.score < 100) statusText += import_chalk2.default.gray(" (Minor issues)");
|
|
2758
|
+
console.log(`${cat.name} [${cat.score >= 80 ? import_chalk2.default.green(bar) : cat.score >= 50 ? import_chalk2.default.yellow(bar) : import_chalk2.default.red(bar)}] ${statusText}`);
|
|
2146
2759
|
});
|
|
2147
|
-
console.log(
|
|
2760
|
+
console.log(import_chalk2.default.gray("----------------------------------------"));
|
|
2148
2761
|
let legalRisk = "LOW";
|
|
2149
2762
|
let riskReason = "No critical violations found.";
|
|
2150
2763
|
let riskIcon = "\u2705";
|
|
@@ -2163,44 +2776,44 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
2163
2776
|
riskReason = "Critical violations found.";
|
|
2164
2777
|
riskIcon = "\u26A0\uFE0F ";
|
|
2165
2778
|
}
|
|
2166
|
-
console.log(`${riskIcon} Legal Risk: ${legalRisk === "HIGH" ?
|
|
2779
|
+
console.log(`${riskIcon} Legal Risk: ${legalRisk === "HIGH" ? import_chalk2.default.red.bold(legalRisk) : legalRisk === "MEDIUM" ? import_chalk2.default.yellow.bold(legalRisk) : import_chalk2.default.green(legalRisk)} (${import_chalk2.default.white(riskReason)})`);
|
|
2167
2780
|
console.log("\n");
|
|
2168
2781
|
if (result.htmlValidation && !result.htmlValidation.valid) {
|
|
2169
|
-
console.log(
|
|
2170
|
-
console.log(
|
|
2782
|
+
console.log(import_chalk2.default.red.bold("\u26A0\uFE0F Structural HTML Issues Detected"));
|
|
2783
|
+
console.log(import_chalk2.default.yellow(" These issues may affect accessibility tool accuracy (e.g. contrast calculations)\n"));
|
|
2171
2784
|
result.htmlValidation.errors.forEach((error) => {
|
|
2172
|
-
console.log(
|
|
2785
|
+
console.log(import_chalk2.default.red(` [${error.rule}] ${error.message}`));
|
|
2173
2786
|
});
|
|
2174
|
-
console.log(
|
|
2175
|
-
console.log(
|
|
2787
|
+
console.log(import_chalk2.default.gray(" ... and more (run with --json for full details)"));
|
|
2788
|
+
console.log(import_chalk2.default.gray("----------------------------------------"));
|
|
2176
2789
|
}
|
|
2177
2790
|
if (result.reports.length > 0) {
|
|
2178
|
-
console.log(
|
|
2791
|
+
console.log(import_chalk2.default.bold("Top Violations:"));
|
|
2179
2792
|
}
|
|
2180
2793
|
result.reports.forEach((report, i) => {
|
|
2181
2794
|
if (i > 5) return;
|
|
2182
|
-
const color = report.holmdigitalInsight.diggRisk === "critical" ?
|
|
2795
|
+
const color = report.holmdigitalInsight.diggRisk === "critical" ? import_chalk2.default.red : import_chalk2.default.yellow;
|
|
2183
2796
|
console.log(color.bold(`
|
|
2184
2797
|
[${report.holmdigitalInsight.diggRisk.toUpperCase()}] ${report.ruleId}`));
|
|
2185
|
-
console.log(
|
|
2798
|
+
console.log(import_chalk2.default.white(`WCAG: ${report.wcagCriteria} | EN 301 549: ${report.en301549Criteria}`));
|
|
2186
2799
|
if (report.remediation.component) {
|
|
2187
|
-
console.log(
|
|
2800
|
+
console.log(import_chalk2.default.green(`Fix: Use component <${report.remediation.component} />`));
|
|
2188
2801
|
}
|
|
2189
2802
|
});
|
|
2190
2803
|
if (result.reports.length > 5) {
|
|
2191
|
-
console.log(
|
|
2804
|
+
console.log(import_chalk2.default.gray(`
|
|
2192
2805
|
... and ${result.reports.length - 5} more issues.`));
|
|
2193
2806
|
}
|
|
2194
|
-
console.log(
|
|
2807
|
+
console.log(import_chalk2.default.gray("\n----------------------------------------"));
|
|
2195
2808
|
console.log(`Scan Date: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}`);
|
|
2196
2809
|
console.log("\n");
|
|
2197
2810
|
if (options.generateTests) {
|
|
2198
|
-
console.log(
|
|
2811
|
+
console.log(import_chalk2.default.magenta.bold(t("cli.pseudo_tests")));
|
|
2199
2812
|
const automation = new PseudoAutomationEngine();
|
|
2200
2813
|
result.reports.forEach((report) => {
|
|
2201
2814
|
if (report.testability.pseudoAutomation) {
|
|
2202
|
-
console.log(
|
|
2203
|
-
console.log(
|
|
2815
|
+
console.log(import_chalk2.default.cyan(t("cli.test_for", { ruleId: report.ruleId })));
|
|
2816
|
+
console.log(import_chalk2.default.gray(automation.generateTestScript(report, url)));
|
|
2204
2817
|
}
|
|
2205
2818
|
});
|
|
2206
2819
|
}
|
|
@@ -2215,10 +2828,10 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
2215
2828
|
const xml = generateJUnitXML2(result);
|
|
2216
2829
|
await fs2.writeFile(options.junit, xml);
|
|
2217
2830
|
if (spinner) spinner.succeed(t("cli.junit_saved", { path: options.junit }));
|
|
2218
|
-
else if (!options.json) console.log(
|
|
2831
|
+
else if (!options.json) console.log(import_chalk2.default.green(`\u2713 JUnit report saved to ${options.junit}`));
|
|
2219
2832
|
}
|
|
2220
2833
|
if (options.ci && result.stats.critical > 0) {
|
|
2221
|
-
if (!options.json) console.error(
|
|
2834
|
+
if (!options.json) console.error(import_chalk2.default.red(t("cli.critical_failure")));
|
|
2222
2835
|
process.exit(1);
|
|
2223
2836
|
}
|
|
2224
2837
|
if (options.apiKey) {
|
|
@@ -2231,12 +2844,12 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
2231
2844
|
if (cloudResponse.success) {
|
|
2232
2845
|
if (cloudSpinner) cloudSpinner.succeed("Results uploaded to HolmDigital Cloud");
|
|
2233
2846
|
if (!options.json) {
|
|
2234
|
-
console.log(
|
|
2847
|
+
console.log(import_chalk2.default.green(`\u2713 ${cloudResponse.message}`));
|
|
2235
2848
|
}
|
|
2236
2849
|
} else {
|
|
2237
2850
|
if (cloudSpinner) cloudSpinner.fail("Cloud upload failed");
|
|
2238
2851
|
if (!options.json) {
|
|
2239
|
-
console.error(
|
|
2852
|
+
console.error(import_chalk2.default.red(`Cloud error: ${cloudResponse.error}`));
|
|
2240
2853
|
}
|
|
2241
2854
|
}
|
|
2242
2855
|
}
|
|
@@ -2244,16 +2857,16 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
2244
2857
|
if (spinner) spinner.fail(t("cli.scan_failed"));
|
|
2245
2858
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2246
2859
|
if (errorMessage.includes("ERR_NAME_NOT_RESOLVED")) {
|
|
2247
|
-
console.error(
|
|
2248
|
-
console.error(
|
|
2860
|
+
console.error(import_chalk2.default.red(`Error: Could not resolve domain for '${url}'`));
|
|
2861
|
+
console.error(import_chalk2.default.gray("Please check that the URL is correct and the site is accessible."));
|
|
2249
2862
|
} else if (errorMessage.includes("ERR_CONNECTION_REFUSED")) {
|
|
2250
|
-
console.error(
|
|
2251
|
-
console.error(
|
|
2863
|
+
console.error(import_chalk2.default.red(`Error: Connection refused for '${url}'`));
|
|
2864
|
+
console.error(import_chalk2.default.gray("The server may be down or blocking automated access."));
|
|
2252
2865
|
} else if (errorMessage.includes("Timeout")) {
|
|
2253
|
-
console.error(
|
|
2254
|
-
console.error(
|
|
2866
|
+
console.error(import_chalk2.default.red(`Error: Connection timed out for '${url}'`));
|
|
2867
|
+
console.error(import_chalk2.default.gray("The page took too long to respond."));
|
|
2255
2868
|
} else {
|
|
2256
|
-
console.error(
|
|
2869
|
+
console.error(import_chalk2.default.red(`Error: ${errorMessage}`));
|
|
2257
2870
|
}
|
|
2258
2871
|
process.exit(1);
|
|
2259
2872
|
} finally {
|