@holmdigital/engine 2.11.0 → 2.13.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/README.md +11 -0
- package/dist/{chunk-CE5CPK4U.mjs → chunk-AQFORQWK.mjs} +108 -9
- package/dist/{chunk-RVJPW54H.mjs → chunk-ZPNGG5KS.mjs} +151 -8
- package/dist/cli/index.js +379 -25
- package/dist/cli/index.mjs +129 -13
- package/dist/{i18n-7WMKI7JK.mjs → i18n-TCH23V3M.mjs} +1 -1
- package/dist/index.d.mts +47 -3
- package/dist/index.d.ts +47 -3
- package/dist/index.js +259 -16
- package/dist/index.mjs +11 -3
- package/dist/{plain-report-WIL7FGCM.mjs → plain-report-OF2MNEE4.mjs} +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -62,7 +62,18 @@ var init_en = __esm({
|
|
|
62
62
|
use_component: "Use component: {component}",
|
|
63
63
|
pseudo_tests: "\n\u{1F9EC} Generating Pseudo-Automation Tests...\n",
|
|
64
64
|
test_for: "Test for {ruleId}:",
|
|
65
|
-
junit_saved: "JUnit XML report saved to {path}"
|
|
65
|
+
junit_saved: "JUnit XML report saved to {path}",
|
|
66
|
+
noscript_heading: "\n\u{1F9EA} Robustness without JavaScript (advisory)",
|
|
67
|
+
noscript_coverage: "Content available without JavaScript: {percent}% ({without} of {with} characters)",
|
|
68
|
+
noscript_empty: "The page is effectively empty without JavaScript.",
|
|
69
|
+
noscript_partial: "A substantial part of the content is missing without JavaScript.",
|
|
70
|
+
noscript_ok: "Core content is available without JavaScript.",
|
|
71
|
+
noscript_unknown: "Could not be measured.",
|
|
72
|
+
noscript_fallback: "A <noscript> fallback is present.",
|
|
73
|
+
noscript_no_fallback: "No <noscript> fallback was found.",
|
|
74
|
+
noscript_impact: "This rarely affects the people who turned JavaScript off, but the people whose scripts never arrived: a weak mobile network, a corporate proxy, a browser extension that misbehaves, a timeout. They get an empty page instead of a slow one.",
|
|
75
|
+
noscript_advisory: "Recommendation, not a legal requirement. No WCAG success criterion requires a page to work without JavaScript, so this does not affect the compliance score.",
|
|
76
|
+
badge_withheld: "100/100 with no findings. The robustness check is not clean, so we do not generate a shareable badge."
|
|
66
77
|
},
|
|
67
78
|
report: {
|
|
68
79
|
title: "Accessibility Report - {url}",
|
|
@@ -133,7 +144,18 @@ var init_sv = __esm({
|
|
|
133
144
|
use_component: "Anv\xE4nd komponent: {component}",
|
|
134
145
|
pseudo_tests: "\n\u{1F9EC} Genererar Pseudo-automationstester...\n",
|
|
135
146
|
test_for: "Test f\xF6r {ruleId}:",
|
|
136
|
-
junit_saved: "JUnit XML-rapport sparad till {path}"
|
|
147
|
+
junit_saved: "JUnit XML-rapport sparad till {path}",
|
|
148
|
+
noscript_heading: "\n\u{1F9EA} Robusthet utan JavaScript (r\xE5dgivande)",
|
|
149
|
+
noscript_coverage: "Inneh\xE5ll som finns utan JavaScript: {percent}% ({without} av {with} tecken)",
|
|
150
|
+
noscript_empty: "Sidan \xE4r i praktiken tom utan JavaScript.",
|
|
151
|
+
noscript_partial: "En v\xE4sentlig del av inneh\xE5llet saknas utan JavaScript.",
|
|
152
|
+
noscript_ok: "K\xE4rninneh\xE5llet finns tillg\xE4ngligt utan JavaScript.",
|
|
153
|
+
noscript_unknown: "Kunde inte m\xE4tas.",
|
|
154
|
+
noscript_fallback: "Sidan har en <noscript>-fallback.",
|
|
155
|
+
noscript_no_fallback: "Ingen <noscript>-fallback hittades.",
|
|
156
|
+
noscript_impact: "Det drabbar s\xE4llan den som valt bort JavaScript, utan den vars skript aldrig kom fram: d\xE5ligt mobiln\xE4t, en f\xF6retagsproxy, ett webbl\xE4sartill\xE4gg som kr\xE5nglar, en timeout. De f\xE5r en tom sida i st\xE4llet f\xF6r en l\xE5ngsam.",
|
|
157
|
+
noscript_advisory: "Rekommendation, inte ett lagkrav. Inget WCAG-kriterium kr\xE4ver att en sida fungerar utan JavaScript, s\xE5 detta p\xE5verkar inte konformansscoren.",
|
|
158
|
+
badge_withheld: "100/100 utan anm\xE4rkning. Robusthetskontrollen \xE4r inte ren, s\xE5 vi genererar ingen delbar badge."
|
|
137
159
|
},
|
|
138
160
|
report: {
|
|
139
161
|
title: "Tillg\xE4nglighetsrapport - {url}",
|
|
@@ -204,7 +226,18 @@ var init_de = __esm({
|
|
|
204
226
|
use_component: "Verwenden Sie die Komponente: {component}",
|
|
205
227
|
pseudo_tests: "\n\u{1F9EC} Generiere Pseudo-Automatisierungstests...\n",
|
|
206
228
|
test_for: "Test f\xFCr {ruleId}:",
|
|
207
|
-
junit_saved: "JUnit XML-Bericht gespeichert unter {path}"
|
|
229
|
+
junit_saved: "JUnit XML-Bericht gespeichert unter {path}",
|
|
230
|
+
noscript_heading: "\n\u{1F9EA} Robustheit ohne JavaScript (Empfehlung)",
|
|
231
|
+
noscript_coverage: "Ohne JavaScript verf\xFCgbare Inhalte: {percent}% ({without} von {with} Zeichen)",
|
|
232
|
+
noscript_empty: "Die Seite ist ohne JavaScript praktisch leer.",
|
|
233
|
+
noscript_partial: "Ohne JavaScript fehlt ein wesentlicher Teil des Inhalts.",
|
|
234
|
+
noscript_ok: "Die Kerninhalte sind ohne JavaScript verf\xFCgbar.",
|
|
235
|
+
noscript_unknown: "Konnte nicht gemessen werden.",
|
|
236
|
+
noscript_fallback: "Ein <noscript>-Fallback ist vorhanden.",
|
|
237
|
+
noscript_no_fallback: "Es wurde kein <noscript>-Fallback gefunden.",
|
|
238
|
+
noscript_impact: "Das trifft selten die Menschen, die JavaScript abgeschaltet haben, sondern die Menschen, deren Skripte nie ankamen: ein schwaches Mobilfunknetz, ein Firmenproxy, eine st\xF6rende Browsererweiterung, ein Timeout. Sie bekommen eine leere Seite statt einer langsamen.",
|
|
239
|
+
noscript_advisory: "Empfehlung, keine gesetzliche Anforderung. Kein WCAG-Erfolgskriterium verlangt, dass eine Seite ohne JavaScript funktioniert. Dies beeinflusst daher den Konformit\xE4tswert nicht.",
|
|
240
|
+
badge_withheld: "100/100 ohne Befund. Die Robustheitspr\xFCfung ist nicht sauber, deshalb erzeugen wir kein teilbares Badge."
|
|
208
241
|
},
|
|
209
242
|
report: {
|
|
210
243
|
title: "Barrierefreiheitsbericht - {url}",
|
|
@@ -275,7 +308,18 @@ var init_fr = __esm({
|
|
|
275
308
|
use_component: "Utilisez le composant : {component}",
|
|
276
309
|
pseudo_tests: "\n\u{1F9EC} G\xE9n\xE9ration de tests de pseudo-automatisation...\n",
|
|
277
310
|
test_for: "Test pour {ruleId} :",
|
|
278
|
-
junit_saved: "Rapport XML JUnit enregistr\xE9 sous {path}"
|
|
311
|
+
junit_saved: "Rapport XML JUnit enregistr\xE9 sous {path}",
|
|
312
|
+
noscript_heading: "\n\u{1F9EA} Robustesse sans JavaScript (recommandation)",
|
|
313
|
+
noscript_coverage: "Contenu disponible sans JavaScript : {percent}% ({without} sur {with} caract\xE8res)",
|
|
314
|
+
noscript_empty: "La page est pratiquement vide sans JavaScript.",
|
|
315
|
+
noscript_partial: "Une partie importante du contenu est absente sans JavaScript.",
|
|
316
|
+
noscript_ok: "Le contenu principal est disponible sans JavaScript.",
|
|
317
|
+
noscript_unknown: "N'a pas pu \xEAtre mesur\xE9.",
|
|
318
|
+
noscript_fallback: "Une solution de repli <noscript> est pr\xE9sente.",
|
|
319
|
+
noscript_no_fallback: "Aucune solution de repli <noscript> n'a \xE9t\xE9 trouv\xE9e.",
|
|
320
|
+
noscript_impact: "Cela touche rarement les personnes qui ont d\xE9sactiv\xE9 JavaScript, mais celles dont les scripts ne sont jamais arriv\xE9s : un r\xE9seau mobile faible, un proxy d'entreprise, une extension de navigateur d\xE9faillante, un d\xE9lai d\xE9pass\xE9. Elles obtiennent une page vide au lieu d'une page lente.",
|
|
321
|
+
noscript_advisory: "Recommandation, pas une obligation l\xE9gale. Aucun crit\xE8re de succ\xE8s WCAG n'exige qu'une page fonctionne sans JavaScript. Cela n'affecte donc pas le score de conformit\xE9.",
|
|
322
|
+
badge_withheld: "100/100 sans r\xE9serve. Le contr\xF4le de robustesse n'est pas propre, nous ne g\xE9n\xE9rons donc pas de badge partageable."
|
|
279
323
|
},
|
|
280
324
|
report: {
|
|
281
325
|
title: "Rapport d'Accessibilit\xE9 - {url}",
|
|
@@ -346,7 +390,18 @@ var init_es = __esm({
|
|
|
346
390
|
use_component: "Use el componente: {component}",
|
|
347
391
|
pseudo_tests: "\n\u{1F9EC} Generando pruebas de pseudo-automatizaci\xF3n...\n",
|
|
348
392
|
test_for: "Prueba para {ruleId}:",
|
|
349
|
-
junit_saved: "Informe JUnit XML guardado en {path}"
|
|
393
|
+
junit_saved: "Informe JUnit XML guardado en {path}",
|
|
394
|
+
noscript_heading: "\n\u{1F9EA} Robustez sin JavaScript (recomendaci\xF3n)",
|
|
395
|
+
noscript_coverage: "Contenido disponible sin JavaScript: {percent}% ({without} de {with} caracteres)",
|
|
396
|
+
noscript_empty: "La p\xE1gina est\xE1 pr\xE1cticamente vac\xEDa sin JavaScript.",
|
|
397
|
+
noscript_partial: "Falta una parte sustancial del contenido sin JavaScript.",
|
|
398
|
+
noscript_ok: "El contenido principal est\xE1 disponible sin JavaScript.",
|
|
399
|
+
noscript_unknown: "No se pudo medir.",
|
|
400
|
+
noscript_fallback: "Hay una alternativa <noscript> presente.",
|
|
401
|
+
noscript_no_fallback: "No se encontr\xF3 ninguna alternativa <noscript>.",
|
|
402
|
+
noscript_impact: "Rara vez afecta a quien ha desactivado JavaScript, sino a quien nunca recibi\xF3 los scripts: una red m\xF3vil deficiente, un proxy corporativo, una extensi\xF3n del navegador que falla, un tiempo de espera agotado. Ven una p\xE1gina vac\xEDa en lugar de una lenta.",
|
|
403
|
+
noscript_advisory: "Recomendaci\xF3n, no un requisito legal. Ning\xFAn criterio de conformidad de las WCAG exige que una p\xE1gina funcione sin JavaScript, por lo que esto no afecta a la puntuaci\xF3n de conformidad.",
|
|
404
|
+
badge_withheld: "100/100 sin observaciones. La comprobaci\xF3n de robustez no est\xE1 limpia, por lo que no generamos una insignia compartible."
|
|
350
405
|
},
|
|
351
406
|
report: {
|
|
352
407
|
title: "Informe de Accesibilidad - {url}",
|
|
@@ -417,7 +472,18 @@ var init_fi = __esm({
|
|
|
417
472
|
use_component: "K\xE4yt\xE4 komponenttia: {component}",
|
|
418
473
|
pseudo_tests: "\n\u{1F9EC} Luodaan Pseudo-automaatiotestej\xE4...\n",
|
|
419
474
|
test_for: "Testi {ruleId}:lle:",
|
|
420
|
-
junit_saved: "JUnit XML -raportti tallennettu kohteeseen {path}"
|
|
475
|
+
junit_saved: "JUnit XML -raportti tallennettu kohteeseen {path}",
|
|
476
|
+
noscript_heading: "\n\u{1F9EA} Vakaus ilman JavaScripti\xE4 (suositus)",
|
|
477
|
+
noscript_coverage: "Sis\xE4lt\xF6\xE4 saatavilla ilman JavaScripti\xE4: {percent}% ({without}/{with} merkki\xE4)",
|
|
478
|
+
noscript_empty: "Sivu on k\xE4yt\xE4nn\xF6ss\xE4 tyhj\xE4 ilman JavaScripti\xE4.",
|
|
479
|
+
noscript_partial: "Merkitt\xE4v\xE4 osa sis\xE4ll\xF6st\xE4 puuttuu ilman JavaScripti\xE4.",
|
|
480
|
+
noscript_ok: "Ydinsis\xE4lt\xF6 on saatavilla ilman JavaScripti\xE4.",
|
|
481
|
+
noscript_unknown: "Ei voitu mitata.",
|
|
482
|
+
noscript_fallback: "Sivulla on <noscript>-varasis\xE4lt\xF6.",
|
|
483
|
+
noscript_no_fallback: "<noscript>-varasis\xE4lt\xF6\xE4 ei l\xF6ytynyt.",
|
|
484
|
+
noscript_impact: "T\xE4m\xE4 koskee harvoin niit\xE4, jotka ovat kytkeneet JavaScriptin pois. Se koskee niit\xE4, joiden skriptit eiv\xE4t koskaan tulleet perille: heikko mobiiliverkko, yrityksen v\xE4lityspalvelin, h\xE4irik\xF6iv\xE4 selainlaajennus, aikakatkaisu. He saavat tyhj\xE4n sivun hitaan sivun sijaan.",
|
|
485
|
+
noscript_advisory: "Suositus, ei lakis\xE4\xE4teinen vaatimus. Mik\xE4\xE4n WCAG-onnistumiskriteeri ei edellyt\xE4, ett\xE4 sivu toimii ilman JavaScripti\xE4, joten t\xE4m\xE4 ei vaikuta vaatimustenmukaisuuspisteisiin.",
|
|
486
|
+
badge_withheld: "100/100 ilman huomautuksia. Robustiustarkistus ei ole puhdas, joten emme luo jaettavaa merkki\xE4."
|
|
421
487
|
},
|
|
422
488
|
report: {
|
|
423
489
|
title: "Saavutettavuusraportti - {url}",
|
|
@@ -488,7 +554,18 @@ var init_dk = __esm({
|
|
|
488
554
|
use_component: "Brug komponent: {component}",
|
|
489
555
|
pseudo_tests: "\n\u{1F9EC} Genererer Pseudo-automatiseringstests...\n",
|
|
490
556
|
test_for: "Test for {ruleId}:",
|
|
491
|
-
junit_saved: "JUnit XML-rapport gemt i {path}"
|
|
557
|
+
junit_saved: "JUnit XML-rapport gemt i {path}",
|
|
558
|
+
noscript_heading: "\n\u{1F9EA} Robusthed uden JavaScript (anbefaling)",
|
|
559
|
+
noscript_coverage: "Indhold tilg\xE6ngeligt uden JavaScript: {percent}% ({without} af {with} tegn)",
|
|
560
|
+
noscript_empty: "Siden er reelt tom uden JavaScript.",
|
|
561
|
+
noscript_partial: "En v\xE6sentlig del af indholdet mangler uden JavaScript.",
|
|
562
|
+
noscript_ok: "Kerneindholdet er tilg\xE6ngeligt uden JavaScript.",
|
|
563
|
+
noscript_unknown: "Kunne ikke m\xE5les.",
|
|
564
|
+
noscript_fallback: "Der findes en <noscript>-fallback.",
|
|
565
|
+
noscript_no_fallback: "Der blev ikke fundet nogen <noscript>-fallback.",
|
|
566
|
+
noscript_impact: "Det rammer sj\xE6ldent dem, der har sl\xE5et JavaScript fra, men dem, hvis scripts aldrig n\xE5ede frem: d\xE5rligt mobilnet, en virksomhedsproxy, en browserudvidelse der driller, en timeout. De f\xE5r en tom side i stedet for en langsom.",
|
|
567
|
+
noscript_advisory: "Anbefaling, ikke et lovkrav. Intet WCAG-succeskriterium kr\xE6ver, at en side fungerer uden JavaScript, s\xE5 dette p\xE5virker ikke konformitetsscoren.",
|
|
568
|
+
badge_withheld: "100/100 uden anm\xE6rkninger. Robusthedstjekket er ikke rent, s\xE5 vi genererer ikke et delbart badge."
|
|
492
569
|
},
|
|
493
570
|
report: {
|
|
494
571
|
title: "Tilg\xE6ngelighedsrapport - {url}",
|
|
@@ -559,7 +636,18 @@ var init_no = __esm({
|
|
|
559
636
|
use_component: "Bruk komponent: {component}",
|
|
560
637
|
pseudo_tests: "\n\u{1F9EC} Genererer Pseudo-automatiseringstester...\n",
|
|
561
638
|
test_for: "Test for {ruleId}:",
|
|
562
|
-
junit_saved: "JUnit XML-rapport lagret i {path}"
|
|
639
|
+
junit_saved: "JUnit XML-rapport lagret i {path}",
|
|
640
|
+
noscript_heading: "\n\u{1F9EA} Robusthet uten JavaScript (anbefaling)",
|
|
641
|
+
noscript_coverage: "Innhold tilgjengelig uten JavaScript: {percent}% ({without} av {with} tegn)",
|
|
642
|
+
noscript_empty: "Siden er i praksis tom uten JavaScript.",
|
|
643
|
+
noscript_partial: "En vesentlig del av innholdet mangler uten JavaScript.",
|
|
644
|
+
noscript_ok: "Kjerneinnholdet er tilgjengelig uten JavaScript.",
|
|
645
|
+
noscript_unknown: "Kunne ikke m\xE5les.",
|
|
646
|
+
noscript_fallback: "Siden har en <noscript>-fallback.",
|
|
647
|
+
noscript_no_fallback: "Ingen <noscript>-fallback ble funnet.",
|
|
648
|
+
noscript_impact: "Det rammer sjelden den som har sl\xE5tt av JavaScript, men den som aldri fikk skriptene: d\xE5rlig mobilnett, en bedriftsproxy, en nettleserutvidelse som svikter, et tidsavbrudd. De f\xE5r en tom side i stedet for en treg.",
|
|
649
|
+
noscript_advisory: "Anbefaling, ikke et lovkrav. Ingen WCAG-suksesskriterier krever at en side fungerer uten JavaScript, s\xE5 dette p\xE5virker ikke samsvarsscoren.",
|
|
650
|
+
badge_withheld: "100/100 uten anmerkninger. Robusthetssjekken er ikke ren, s\xE5 vi genererer ikke et delbart badge."
|
|
563
651
|
},
|
|
564
652
|
report: {
|
|
565
653
|
title: "Tilgjengelighetsrapport - {url}",
|
|
@@ -630,7 +718,18 @@ var init_nl = __esm({
|
|
|
630
718
|
use_component: "Gebruik component: {component}",
|
|
631
719
|
pseudo_tests: "\n\u{1F9EC} Pseudo-automatiseringstests genereren...\n",
|
|
632
720
|
test_for: "Test voor {ruleId}:",
|
|
633
|
-
junit_saved: "JUnit XML-rapport opgeslagen op {path}"
|
|
721
|
+
junit_saved: "JUnit XML-rapport opgeslagen op {path}",
|
|
722
|
+
noscript_heading: "\n\u{1F9EA} Robuustheid zonder JavaScript (advies)",
|
|
723
|
+
noscript_coverage: "Inhoud beschikbaar zonder JavaScript: {percent}% ({without} van {with} tekens)",
|
|
724
|
+
noscript_empty: "De pagina is zonder JavaScript in feite leeg.",
|
|
725
|
+
noscript_partial: "Een aanzienlijk deel van de inhoud ontbreekt zonder JavaScript.",
|
|
726
|
+
noscript_ok: "De kerninhoud is beschikbaar zonder JavaScript.",
|
|
727
|
+
noscript_unknown: "Kon niet worden gemeten.",
|
|
728
|
+
noscript_fallback: "Er is een <noscript>-fallback aanwezig.",
|
|
729
|
+
noscript_no_fallback: "Er is geen <noscript>-fallback gevonden.",
|
|
730
|
+
noscript_impact: "Dit treft zelden de mensen die JavaScript hebben uitgezet, maar de mensen bij wie de scripts nooit aankwamen: een zwak mobiel netwerk, een bedrijfsproxy, een browserextensie die hapert, een time-out. Zij krijgen een lege pagina in plaats van een trage.",
|
|
731
|
+
noscript_advisory: "Aanbeveling, geen wettelijke vereiste. Geen enkel WCAG-succescriterium vereist dat een pagina zonder JavaScript werkt. Dit heeft dus geen invloed op de conformiteitsscore.",
|
|
732
|
+
badge_withheld: "100/100 zonder bevindingen. De robuustheidscontrole is niet schoon, dus we genereren geen deelbare badge."
|
|
634
733
|
},
|
|
635
734
|
report: {
|
|
636
735
|
title: "Toegankelijkheidsrapport - {url}",
|
|
@@ -1182,10 +1281,74 @@ var HtmlValidator = class {
|
|
|
1182
1281
|
}
|
|
1183
1282
|
};
|
|
1184
1283
|
|
|
1284
|
+
// src/core/noscript-check.ts
|
|
1285
|
+
init_cjs_shims();
|
|
1286
|
+
var NOSCRIPT_EMPTY_THRESHOLD = 0.05;
|
|
1287
|
+
var NOSCRIPT_PARTIAL_THRESHOLD = 0.5;
|
|
1288
|
+
function evaluateNoScriptCoverage(textLengthWithoutJs, textLengthWithJs, hasNoScriptFallback = false) {
|
|
1289
|
+
const withoutJs = Math.max(0, Math.trunc(textLengthWithoutJs) || 0);
|
|
1290
|
+
const withJs = Math.max(0, Math.trunc(textLengthWithJs) || 0);
|
|
1291
|
+
const base = {
|
|
1292
|
+
textLengthWithoutJs: withoutJs,
|
|
1293
|
+
textLengthWithJs: withJs,
|
|
1294
|
+
hasNoScriptFallback,
|
|
1295
|
+
isWcagViolation: false,
|
|
1296
|
+
affectsScore: false
|
|
1297
|
+
};
|
|
1298
|
+
if (withJs === 0) {
|
|
1299
|
+
return {
|
|
1300
|
+
...base,
|
|
1301
|
+
coverageRatio: 0,
|
|
1302
|
+
verdict: "unknown",
|
|
1303
|
+
hasContentWithoutJs: withoutJs > 0
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
const coverageRatio = Math.min(1, withoutJs / withJs);
|
|
1307
|
+
let verdict;
|
|
1308
|
+
if (coverageRatio < NOSCRIPT_EMPTY_THRESHOLD) {
|
|
1309
|
+
verdict = "empty";
|
|
1310
|
+
} else if (coverageRatio < NOSCRIPT_PARTIAL_THRESHOLD) {
|
|
1311
|
+
verdict = "partial";
|
|
1312
|
+
} else {
|
|
1313
|
+
verdict = "ok";
|
|
1314
|
+
}
|
|
1315
|
+
return {
|
|
1316
|
+
...base,
|
|
1317
|
+
coverageRatio,
|
|
1318
|
+
verdict,
|
|
1319
|
+
hasContentWithoutJs: coverageRatio >= NOSCRIPT_EMPTY_THRESHOLD
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
async function probeWithoutJavaScript(browser, options) {
|
|
1323
|
+
const page = await browser.newPage();
|
|
1324
|
+
try {
|
|
1325
|
+
if (options.userAgent) await page.setUserAgent(options.userAgent);
|
|
1326
|
+
if (options.viewport) await page.setViewport(options.viewport);
|
|
1327
|
+
await page.setJavaScriptEnabled(false);
|
|
1328
|
+
await page.goto(options.url, {
|
|
1329
|
+
waitUntil: "domcontentloaded",
|
|
1330
|
+
timeout: options.timeout ?? 6e4
|
|
1331
|
+
});
|
|
1332
|
+
await page.setJavaScriptEnabled(true);
|
|
1333
|
+
return await page.evaluate(() => {
|
|
1334
|
+
const noScriptEls = Array.from(document.querySelectorAll("noscript"));
|
|
1335
|
+
noScriptEls.forEach((el) => {
|
|
1336
|
+
el.style.display = "none";
|
|
1337
|
+
});
|
|
1338
|
+
return {
|
|
1339
|
+
textLength: (document.body?.innerText ?? "").trim().length,
|
|
1340
|
+
hasNoScriptFallback: noScriptEls.length > 0
|
|
1341
|
+
};
|
|
1342
|
+
});
|
|
1343
|
+
} finally {
|
|
1344
|
+
await page.close();
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1185
1348
|
// src/core/regulatory-scanner.ts
|
|
1186
1349
|
var import_node_fs = require("fs");
|
|
1187
1350
|
function getEngineVersion() {
|
|
1188
|
-
return "2.
|
|
1351
|
+
return "2.13.0";
|
|
1189
1352
|
}
|
|
1190
1353
|
function getStandardsVersion() {
|
|
1191
1354
|
try {
|
|
@@ -1196,6 +1359,7 @@ function getStandardsVersion() {
|
|
|
1196
1359
|
return "unknown";
|
|
1197
1360
|
}
|
|
1198
1361
|
}
|
|
1362
|
+
var SCAN_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
|
|
1199
1363
|
var RegulatoryScanner = class {
|
|
1200
1364
|
browser = null;
|
|
1201
1365
|
options;
|
|
@@ -1209,8 +1373,13 @@ var RegulatoryScanner = class {
|
|
|
1209
1373
|
invalidHttpsCert: false,
|
|
1210
1374
|
waitForHydrationMs: 2500,
|
|
1211
1375
|
// Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
|
|
1376
|
+
noScriptCheck: false,
|
|
1377
|
+
// Default AV: opt-in, kostar en extra sidladdning
|
|
1212
1378
|
...options
|
|
1213
1379
|
};
|
|
1380
|
+
if (this.options.waitForHydrationMs === void 0) {
|
|
1381
|
+
this.options.waitForHydrationMs = 2500;
|
|
1382
|
+
}
|
|
1214
1383
|
this.htmlValidator = new HtmlValidator();
|
|
1215
1384
|
}
|
|
1216
1385
|
/** Log only when not in silent mode */
|
|
@@ -1264,6 +1433,12 @@ var RegulatoryScanner = class {
|
|
|
1264
1433
|
}
|
|
1265
1434
|
pageTitle = await page.title();
|
|
1266
1435
|
pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
|
|
1436
|
+
let textLengthWithJs;
|
|
1437
|
+
if (this.options.noScriptCheck) {
|
|
1438
|
+
textLengthWithJs = await page.evaluate(
|
|
1439
|
+
() => (document.body?.innerText ?? "").trim().length
|
|
1440
|
+
);
|
|
1441
|
+
}
|
|
1267
1442
|
let htmlValidation;
|
|
1268
1443
|
if (!this.options.light) {
|
|
1269
1444
|
const pageContent = await page.content();
|
|
@@ -1294,12 +1469,19 @@ var RegulatoryScanner = class {
|
|
|
1294
1469
|
});
|
|
1295
1470
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
1296
1471
|
passedCount = axeResults.passes?.length || 0;
|
|
1297
|
-
const regulatoryReports = this.options.light ? this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1472
|
+
const regulatoryReports = this.options.light ? await this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1473
|
+
let noScript;
|
|
1474
|
+
if (this.options.noScriptCheck) {
|
|
1475
|
+
noScript = await this.runNoScriptCheck(textLengthWithJs ?? 0);
|
|
1476
|
+
}
|
|
1298
1477
|
const scanDuration = Date.now() - startTime;
|
|
1299
1478
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
1300
1479
|
if (htmlValidation) {
|
|
1301
1480
|
result.htmlValidation = htmlValidation;
|
|
1302
1481
|
}
|
|
1482
|
+
if (noScript) {
|
|
1483
|
+
result.noScript = noScript;
|
|
1484
|
+
}
|
|
1303
1485
|
return result;
|
|
1304
1486
|
} finally {
|
|
1305
1487
|
await this.close();
|
|
@@ -1320,7 +1502,7 @@ var RegulatoryScanner = class {
|
|
|
1320
1502
|
async getPage() {
|
|
1321
1503
|
if (!this.browser) throw new Error("Browser not initialized");
|
|
1322
1504
|
const page = await this.browser.newPage();
|
|
1323
|
-
await page.setUserAgent(
|
|
1505
|
+
await page.setUserAgent(SCAN_USER_AGENT);
|
|
1324
1506
|
return page;
|
|
1325
1507
|
}
|
|
1326
1508
|
async injectAxe(page) {
|
|
@@ -1328,19 +1510,71 @@ var RegulatoryScanner = class {
|
|
|
1328
1510
|
await page.evaluate(axeSource);
|
|
1329
1511
|
}
|
|
1330
1512
|
/**
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
1513
|
+
* Laddar sidan en andra gång med JS avstängt och jämför innehållsmängden
|
|
1514
|
+
* med den hydrerade sidan. Rådgivande robusthetsindikator, aldrig ett
|
|
1515
|
+
* WCAG-fel och aldrig en faktor i scoren. Se noscript-check.ts.
|
|
1516
|
+
*
|
|
1517
|
+
* Kastar aldrig: en misslyckad sond får inte fälla en i övrigt lyckad scan.
|
|
1518
|
+
* Vid fel returneras verdict 'unknown' med felmeddelandet bevarat, inte
|
|
1519
|
+
* 'empty' (vi vill inte larma om en tom sida när det var sonden som brast).
|
|
1520
|
+
*/
|
|
1521
|
+
async runNoScriptCheck(textLengthWithJs) {
|
|
1522
|
+
try {
|
|
1523
|
+
if (!this.browser) throw new Error("Browser not initialized");
|
|
1524
|
+
this.log("M\xE4ter robusthet utan JavaScript...");
|
|
1525
|
+
const measurement = await probeWithoutJavaScript(this.browser, {
|
|
1526
|
+
// SAMMA user agent och viewport som huvudskanningen. Skiljer de sig
|
|
1527
|
+
// åt kan servern svara med annan markup och jämförelsen blir falsk:
|
|
1528
|
+
// vi skulle mäta två olika sidor, inte JS-effekten.
|
|
1529
|
+
url: this.options.url,
|
|
1530
|
+
userAgent: SCAN_USER_AGENT,
|
|
1531
|
+
viewport: this.options.viewport
|
|
1532
|
+
});
|
|
1533
|
+
return evaluateNoScriptCoverage(
|
|
1534
|
+
measurement.textLength,
|
|
1535
|
+
textLengthWithJs,
|
|
1536
|
+
measurement.hasNoScriptFallback
|
|
1537
|
+
);
|
|
1538
|
+
} catch (e) {
|
|
1539
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
1540
|
+
this.log(`Robusthetskontrollen kunde inte genomf\xF6ras: ${message}`);
|
|
1541
|
+
return {
|
|
1542
|
+
textLengthWithoutJs: 0,
|
|
1543
|
+
textLengthWithJs: Math.max(0, textLengthWithJs),
|
|
1544
|
+
coverageRatio: 0,
|
|
1545
|
+
verdict: "unknown",
|
|
1546
|
+
hasContentWithoutJs: false,
|
|
1547
|
+
hasNoScriptFallback: false,
|
|
1548
|
+
isWcagViolation: false,
|
|
1549
|
+
affectsScore: false,
|
|
1550
|
+
error: message
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Light enrichment — maps axe severity directly, then attaches plain-language
|
|
1556
|
+
* (klarspråk) copy to the top findings so the public light scan can render
|
|
1557
|
+
* readable cards instead of raw axe rule ids. Stays light: a single standards
|
|
1558
|
+
* import and a lookup only for the first N findings (the widget shows a
|
|
1559
|
+
* handful). The language follows getCurrentLang() — the public Swedish scan
|
|
1560
|
+
* sets 'sv'; generateRegulatoryReport carries the built-in EN fallback for
|
|
1561
|
+
* rules lacking the target language.
|
|
1333
1562
|
*/
|
|
1334
|
-
enrichResultsLight(axeResults) {
|
|
1563
|
+
async enrichResultsLight(axeResults) {
|
|
1335
1564
|
const impactToRisk = {
|
|
1336
1565
|
critical: "critical",
|
|
1337
1566
|
serious: "high",
|
|
1338
1567
|
moderate: "medium",
|
|
1339
1568
|
minor: "low"
|
|
1340
1569
|
};
|
|
1341
|
-
|
|
1570
|
+
const KLARSPRAK_TOP_N = 8;
|
|
1571
|
+
const { generateRegulatoryReport } = await import("@holmdigital/standards");
|
|
1572
|
+
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1573
|
+
const lang = getCurrentLang2();
|
|
1574
|
+
return axeResults.violations.map((violation, index) => {
|
|
1342
1575
|
const impact = violation.impact || "moderate";
|
|
1343
1576
|
const risk = impactToRisk[impact] || "medium";
|
|
1577
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? generateRegulatoryReport(violation.id, lang)?.plainLanguage : void 0;
|
|
1344
1578
|
return {
|
|
1345
1579
|
ruleId: violation.id,
|
|
1346
1580
|
wcagCriteria: violation.tags.find((t2) => t2.startsWith("wcag")) || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
@@ -1348,6 +1582,7 @@ var RegulatoryScanner = class {
|
|
|
1348
1582
|
dosLagenReference: "",
|
|
1349
1583
|
diggRisk: risk,
|
|
1350
1584
|
eaaImpact: risk,
|
|
1585
|
+
plainLanguage,
|
|
1351
1586
|
remediation: {
|
|
1352
1587
|
description: violation.help,
|
|
1353
1588
|
technicalGuidance: violation.description,
|
|
@@ -1613,6 +1848,9 @@ function generateBadgeMarkdown(score) {
|
|
|
1613
1848
|
}
|
|
1614
1849
|
return ``;
|
|
1615
1850
|
}
|
|
1851
|
+
function isBadgeWithheldByRobustness(noScript) {
|
|
1852
|
+
return noScript?.verdict === "empty";
|
|
1853
|
+
}
|
|
1616
1854
|
|
|
1617
1855
|
// src/reporting/html-template.ts
|
|
1618
1856
|
init_i18n();
|
|
@@ -1647,6 +1885,45 @@ function formatDate(dateString) {
|
|
|
1647
1885
|
function escapeHtml(str) {
|
|
1648
1886
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1649
1887
|
}
|
|
1888
|
+
function renderNoScriptSection(result) {
|
|
1889
|
+
const noScript = result.noScript;
|
|
1890
|
+
if (!noScript) return "";
|
|
1891
|
+
const palette = {
|
|
1892
|
+
empty: { accent: "#b91c1c", bg: "#fef2f2", icon: "\u{1F534}" },
|
|
1893
|
+
partial: { accent: "#b45309", bg: "#fffbeb", icon: "\u{1F7E1}" },
|
|
1894
|
+
ok: { accent: "#15803d", bg: "#f0fdf4", icon: "\u{1F7E2}" },
|
|
1895
|
+
unknown: { accent: "#475569", bg: "#f8fafc", icon: "\u26AA" }
|
|
1896
|
+
}[noScript.verdict];
|
|
1897
|
+
const summary = noScript.verdict === "empty" ? t("cli.noscript_empty") : noScript.verdict === "partial" ? t("cli.noscript_partial") : noScript.verdict === "ok" ? t("cli.noscript_ok") : t("cli.noscript_unknown");
|
|
1898
|
+
const impact = noScript.verdict === "empty" || noScript.verdict === "partial" ? `<p style="margin: 0 0 0.5rem; color: #0f172a; font-size: 0.95rem; line-height: 1.55;">
|
|
1899
|
+
${escapeHtml(t("cli.noscript_impact"))}
|
|
1900
|
+
</p>` : "";
|
|
1901
|
+
const detail = noScript.verdict === "unknown" ? "" : `<p style="margin: 0 0 0.5rem; color: #334155; font-size: 0.95rem;">
|
|
1902
|
+
${escapeHtml(t("cli.noscript_coverage", {
|
|
1903
|
+
percent: Math.round(noScript.coverageRatio * 100),
|
|
1904
|
+
without: noScript.textLengthWithoutJs,
|
|
1905
|
+
with: noScript.textLengthWithJs
|
|
1906
|
+
}))}
|
|
1907
|
+
</p>
|
|
1908
|
+
${noScript.verdict !== "ok" ? `<p style="margin: 0 0 0.5rem; color: #475569; font-size: 0.9rem;">
|
|
1909
|
+
${escapeHtml(noScript.hasNoScriptFallback ? t("cli.noscript_fallback") : t("cli.noscript_no_fallback"))}
|
|
1910
|
+
</p>` : ""}`;
|
|
1911
|
+
return `
|
|
1912
|
+
<section style="margin: 2rem 0; padding: 1.25rem 1.5rem; background: ${palette.bg}; border-left: 5px solid ${palette.accent}; border-radius: 6px;">
|
|
1913
|
+
<h2 style="margin: 0 0 0.75rem; font-size: 1.1rem; color: ${palette.accent};">
|
|
1914
|
+
${escapeHtml(t("cli.noscript_heading").trim())}
|
|
1915
|
+
</h2>
|
|
1916
|
+
<p style="margin: 0 0 0.5rem; font-weight: 600; color: #0f172a; font-size: 1rem;">
|
|
1917
|
+
<span aria-hidden="true">${palette.icon}</span> ${escapeHtml(summary)}
|
|
1918
|
+
</p>
|
|
1919
|
+
${impact}
|
|
1920
|
+
${detail}
|
|
1921
|
+
<p style="margin: 0.75rem 0 0; color: #475569; font-size: 0.85rem; line-height: 1.5;">
|
|
1922
|
+
${escapeHtml(t("cli.noscript_advisory"))}
|
|
1923
|
+
</p>
|
|
1924
|
+
</section>
|
|
1925
|
+
`;
|
|
1926
|
+
}
|
|
1650
1927
|
function generateReportHTML(result, sector = "public", audience = "developer", plainFallbackFrom) {
|
|
1651
1928
|
if (audience === "plain") {
|
|
1652
1929
|
return generatePlainReportHTML(result, plainFallbackFrom);
|
|
@@ -1921,7 +2198,7 @@ function generateReportHTML(result, sector = "public", audience = "developer", p
|
|
|
1921
2198
|
</div>
|
|
1922
2199
|
`;
|
|
1923
2200
|
}).join("")}
|
|
1924
|
-
|
|
2201
|
+
${renderNoScriptSection(result)}
|
|
1925
2202
|
<footer>
|
|
1926
2203
|
${t("report.footer", { version: getEngineVersion() })}
|
|
1927
2204
|
</footer>
|
|
@@ -2282,7 +2559,7 @@ ${sortedGroups.map((group) => {
|
|
|
2282
2559
|
</div>
|
|
2283
2560
|
|
|
2284
2561
|
${itemsHtml}
|
|
2285
|
-
|
|
2562
|
+
${renderNoScriptSection(result)}
|
|
2286
2563
|
<p class="closing">${t("plain.closing")}</p>
|
|
2287
2564
|
</div>
|
|
2288
2565
|
|
|
@@ -2669,6 +2946,27 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
|
|
|
2669
2946
|
await import_promises.default.writeFile(outputPath, content, "utf-8");
|
|
2670
2947
|
}
|
|
2671
2948
|
|
|
2949
|
+
// src/cli/parse-options.ts
|
|
2950
|
+
init_cjs_shims();
|
|
2951
|
+
var MAX_HYDRATION_WAIT_MS = 6e4;
|
|
2952
|
+
var InvalidOptionError = class extends Error {
|
|
2953
|
+
};
|
|
2954
|
+
function parseHydrationWait(raw) {
|
|
2955
|
+
const trimmed = String(raw).trim();
|
|
2956
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
2957
|
+
throw new InvalidOptionError(
|
|
2958
|
+
`Invalid --wait-for-hydration value '${raw}'. Expected a whole number of milliseconds between 0 and ${MAX_HYDRATION_WAIT_MS} (e.g. --wait-for-hydration 5000).`
|
|
2959
|
+
);
|
|
2960
|
+
}
|
|
2961
|
+
const ms = Number(trimmed);
|
|
2962
|
+
if (ms > MAX_HYDRATION_WAIT_MS) {
|
|
2963
|
+
throw new InvalidOptionError(
|
|
2964
|
+
`--wait-for-hydration ${ms} is too high. The maximum is ${MAX_HYDRATION_WAIT_MS} ms. A page that has not hydrated within a minute will not hydrate at all.`
|
|
2965
|
+
);
|
|
2966
|
+
}
|
|
2967
|
+
return ms;
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2672
2970
|
// src/cli/index.ts
|
|
2673
2971
|
init_i18n();
|
|
2674
2972
|
init_plain_language_support();
|
|
@@ -2754,6 +3052,31 @@ async function sendToCloud(config, result) {
|
|
|
2754
3052
|
|
|
2755
3053
|
// src/cli/index.ts
|
|
2756
3054
|
var import_cosmiconfig = require("cosmiconfig");
|
|
3055
|
+
function renderNoScriptAdvisory(noScript) {
|
|
3056
|
+
console.log(import_chalk2.default.bold(t("cli.noscript_heading")));
|
|
3057
|
+
if (noScript.verdict === "unknown") {
|
|
3058
|
+
console.log(import_chalk2.default.gray(` ${t("cli.noscript_unknown")}${noScript.error ? ` (${noScript.error})` : ""}`));
|
|
3059
|
+
console.log(import_chalk2.default.gray(` ${t("cli.noscript_advisory")}`));
|
|
3060
|
+
return;
|
|
3061
|
+
}
|
|
3062
|
+
const percent = Math.round(noScript.coverageRatio * 100);
|
|
3063
|
+
const color = noScript.verdict === "empty" ? import_chalk2.default.red : noScript.verdict === "partial" ? import_chalk2.default.yellow : import_chalk2.default.green;
|
|
3064
|
+
const icon = noScript.verdict === "empty" ? "\u{1F534}" : noScript.verdict === "partial" ? "\u{1F7E1}" : "\u{1F7E2}";
|
|
3065
|
+
const summary = noScript.verdict === "empty" ? t("cli.noscript_empty") : noScript.verdict === "partial" ? t("cli.noscript_partial") : t("cli.noscript_ok");
|
|
3066
|
+
console.log(` ${icon} ${color.bold(summary)}`);
|
|
3067
|
+
if (noScript.verdict !== "ok") {
|
|
3068
|
+
console.log(import_chalk2.default.white(` ${t("cli.noscript_impact")}`));
|
|
3069
|
+
}
|
|
3070
|
+
console.log(import_chalk2.default.white(` ${t("cli.noscript_coverage", {
|
|
3071
|
+
percent,
|
|
3072
|
+
without: noScript.textLengthWithoutJs,
|
|
3073
|
+
with: noScript.textLengthWithJs
|
|
3074
|
+
})}`));
|
|
3075
|
+
if (noScript.verdict !== "ok") {
|
|
3076
|
+
console.log(import_chalk2.default.gray(` ${noScript.hasNoScriptFallback ? t("cli.noscript_fallback") : t("cli.noscript_no_fallback")}`));
|
|
3077
|
+
}
|
|
3078
|
+
console.log(import_chalk2.default.gray(` ${t("cli.noscript_advisory")}`));
|
|
3079
|
+
}
|
|
2757
3080
|
function isValidUrl(urlString) {
|
|
2758
3081
|
try {
|
|
2759
3082
|
const url = new URL(urlString);
|
|
@@ -2764,10 +3087,20 @@ function isValidUrl(urlString) {
|
|
|
2764
3087
|
}
|
|
2765
3088
|
var program = new import_commander.Command();
|
|
2766
3089
|
program.name("hd-a11y-scan").description("HolmDigital Regulatory Scanner").version(getEngineVersion());
|
|
2767
|
-
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) => {
|
|
3090
|
+
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)").option("--noscript-check", "Robustness probe: measure how much content is available without JavaScript. Advisory only, never affects the compliance score.").option("--wait-for-hydration <ms>", `Milliseconds to wait after network idle so client-rendered SPAs finish hydrating before axe runs (default 2500, 0 disables, max ${MAX_HYDRATION_WAIT_MS})`).action(async (url, cliOptions) => {
|
|
2768
3091
|
const explorer = (0, import_cosmiconfig.cosmiconfig)("a11y");
|
|
2769
3092
|
const configResult = await explorer.search();
|
|
2770
3093
|
const fileConfig = configResult ? configResult.config : {};
|
|
3094
|
+
let waitForHydrationMs;
|
|
3095
|
+
try {
|
|
3096
|
+
waitForHydrationMs = cliOptions.waitForHydration !== void 0 ? parseHydrationWait(cliOptions.waitForHydration) : fileConfig.waitForHydrationMs !== void 0 ? parseHydrationWait(String(fileConfig.waitForHydrationMs)) : void 0;
|
|
3097
|
+
} catch (e) {
|
|
3098
|
+
if (e instanceof InvalidOptionError) {
|
|
3099
|
+
console.error(import_chalk2.default.red(e.message));
|
|
3100
|
+
process.exit(1);
|
|
3101
|
+
}
|
|
3102
|
+
throw e;
|
|
3103
|
+
}
|
|
2771
3104
|
const options = {
|
|
2772
3105
|
lang: cliOptions.lang || fileConfig.lang || "en",
|
|
2773
3106
|
ci: cliOptions.ci ?? fileConfig.ci ?? false,
|
|
@@ -2793,6 +3126,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2793
3126
|
publishDate: cliOptions.publishDate || fileConfig.publishDate,
|
|
2794
3127
|
light: cliOptions.light ?? fileConfig.light ?? false,
|
|
2795
3128
|
plain: cliOptions.plain ?? fileConfig.plain ?? false,
|
|
3129
|
+
// Commander camelCase:ar --noscript-check till noscriptCheck.
|
|
3130
|
+
noScriptCheck: cliOptions.noscriptCheck ?? fileConfig.noScriptCheck ?? false,
|
|
3131
|
+
waitForHydrationMs,
|
|
2796
3132
|
audience: cliOptions.plain ? "plain" : cliOptions.audience || fileConfig.audience || "developer"
|
|
2797
3133
|
};
|
|
2798
3134
|
setLanguage(options.lang);
|
|
@@ -2830,7 +3166,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2830
3166
|
silent: options.json || options.light,
|
|
2831
3167
|
severityThreshold: options.threshold,
|
|
2832
3168
|
invalidHttpsCert: options.invalidHttpsCert,
|
|
2833
|
-
light: options.light
|
|
3169
|
+
light: options.light,
|
|
3170
|
+
noScriptCheck: options.noScriptCheck,
|
|
3171
|
+
waitForHydrationMs: options.waitForHydrationMs
|
|
2834
3172
|
});
|
|
2835
3173
|
if (spinner) spinner.text = t("cli.analyzing");
|
|
2836
3174
|
const result = await scanner.scan();
|
|
@@ -2867,10 +3205,18 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2867
3205
|
complianceStatus: result.complianceStatus,
|
|
2868
3206
|
stats: result.stats,
|
|
2869
3207
|
scanDuration: result.metadata.scanDuration,
|
|
3208
|
+
// Rådgivande robusthetsindikator. Undefined när --noscript-check
|
|
3209
|
+
// inte används och faller då ur JSON:en av sig själv.
|
|
3210
|
+
noScript: result.noScript,
|
|
2870
3211
|
topIssues: result.reports.slice(0, 5).map((r) => ({
|
|
2871
3212
|
id: r.ruleId,
|
|
2872
3213
|
impact: r.holmdigitalInsight.diggRisk,
|
|
2873
|
-
description: r.remediation.description
|
|
3214
|
+
description: r.remediation.description,
|
|
3215
|
+
// Plain-language (klarspråk) fields, present when the rule
|
|
3216
|
+
// is covered; undefined values drop out of the JSON.
|
|
3217
|
+
headline: r.plainLanguage?.headline,
|
|
3218
|
+
businessImpact: r.plainLanguage?.businessImpact,
|
|
3219
|
+
impactLevel: r.plainLanguage?.impactLevel
|
|
2874
3220
|
}))
|
|
2875
3221
|
};
|
|
2876
3222
|
console.log(JSON.stringify(lightResult, null, 2));
|
|
@@ -2900,10 +3246,15 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
2900
3246
|
const scoreColor = result.score >= 90 ? import_chalk2.default.green : result.score >= 70 ? import_chalk2.default.yellow : import_chalk2.default.red;
|
|
2901
3247
|
console.log(import_chalk2.default.bold(`[ Compliance Score: ${scoreColor(result.score + "/100")} ] ${result.score >= 90 ? "\u{1F7E2}" : result.score >= 70 ? "\u{1F7E1}" : "\u{1F534}"}`));
|
|
2902
3248
|
if (result.score === 100) {
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
3249
|
+
if (isBadgeWithheldByRobustness(result.noScript)) {
|
|
3250
|
+
console.log(import_chalk2.default.yellow(`
|
|
3251
|
+
${t("cli.badge_withheld")}`));
|
|
3252
|
+
} else {
|
|
3253
|
+
const badge = generateBadgeMarkdown(result.score);
|
|
3254
|
+
if (badge) {
|
|
3255
|
+
console.log(import_chalk2.default.green.bold("\n\u{1F3C6} Perfect Score! Here is your accessibility badge:"));
|
|
3256
|
+
console.log(import_chalk2.default.white(badge));
|
|
3257
|
+
}
|
|
2907
3258
|
}
|
|
2908
3259
|
}
|
|
2909
3260
|
console.log(import_chalk2.default.gray("----------------------------------------"));
|
|
@@ -2999,6 +3350,9 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
2999
3350
|
});
|
|
3000
3351
|
}
|
|
3001
3352
|
}
|
|
3353
|
+
if (result.noScript && !options.json) {
|
|
3354
|
+
renderNoScriptAdvisory(result.noScript);
|
|
3355
|
+
}
|
|
3002
3356
|
if (options.ci && result.reports.length > 0) {
|
|
3003
3357
|
const { generateGitHubActionsAnnotations: generateGitHubActionsAnnotations2 } = await Promise.resolve().then(() => (init_github_actions(), github_actions_exports));
|
|
3004
3358
|
generateGitHubActionsAnnotations2(result.reports);
|