@holmdigital/engine 2.12.0 → 3.0.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 +16 -3
- package/dist/{chunk-CE5CPK4U.mjs → chunk-AQFORQWK.mjs} +108 -9
- package/dist/{chunk-5S6UAABI.mjs → chunk-F2GV3JGS.mjs} +136 -4
- package/dist/cli/index.js +364 -21
- package/dist/cli/index.mjs +123 -12
- 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 +250 -13
- package/dist/index.mjs +11 -3
- package/dist/{plain-report-WIL7FGCM.mjs → plain-report-OF2MNEE4.mjs} +1 -1
- package/package.json +14 -11
package/dist/cli/index.js
CHANGED
|
@@ -6,8 +6,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __esm = (fn, res) => function __init() {
|
|
10
|
-
|
|
9
|
+
var __esm = (fn, res, err) => function __init() {
|
|
10
|
+
if (err) throw err[0];
|
|
11
|
+
try {
|
|
12
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw err = [e], e;
|
|
15
|
+
}
|
|
11
16
|
};
|
|
12
17
|
var __export = (target, all) => {
|
|
13
18
|
for (var name in all)
|
|
@@ -62,7 +67,18 @@ var init_en = __esm({
|
|
|
62
67
|
use_component: "Use component: {component}",
|
|
63
68
|
pseudo_tests: "\n\u{1F9EC} Generating Pseudo-Automation Tests...\n",
|
|
64
69
|
test_for: "Test for {ruleId}:",
|
|
65
|
-
junit_saved: "JUnit XML report saved to {path}"
|
|
70
|
+
junit_saved: "JUnit XML report saved to {path}",
|
|
71
|
+
noscript_heading: "\n\u{1F9EA} Robustness without JavaScript (advisory)",
|
|
72
|
+
noscript_coverage: "Content available without JavaScript: {percent}% ({without} of {with} characters)",
|
|
73
|
+
noscript_empty: "The page is effectively empty without JavaScript.",
|
|
74
|
+
noscript_partial: "A substantial part of the content is missing without JavaScript.",
|
|
75
|
+
noscript_ok: "Core content is available without JavaScript.",
|
|
76
|
+
noscript_unknown: "Could not be measured.",
|
|
77
|
+
noscript_fallback: "A <noscript> fallback is present.",
|
|
78
|
+
noscript_no_fallback: "No <noscript> fallback was found.",
|
|
79
|
+
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.",
|
|
80
|
+
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.",
|
|
81
|
+
badge_withheld: "100/100 with no findings. The robustness check is not clean, so we do not generate a shareable badge."
|
|
66
82
|
},
|
|
67
83
|
report: {
|
|
68
84
|
title: "Accessibility Report - {url}",
|
|
@@ -133,7 +149,18 @@ var init_sv = __esm({
|
|
|
133
149
|
use_component: "Anv\xE4nd komponent: {component}",
|
|
134
150
|
pseudo_tests: "\n\u{1F9EC} Genererar Pseudo-automationstester...\n",
|
|
135
151
|
test_for: "Test f\xF6r {ruleId}:",
|
|
136
|
-
junit_saved: "JUnit XML-rapport sparad till {path}"
|
|
152
|
+
junit_saved: "JUnit XML-rapport sparad till {path}",
|
|
153
|
+
noscript_heading: "\n\u{1F9EA} Robusthet utan JavaScript (r\xE5dgivande)",
|
|
154
|
+
noscript_coverage: "Inneh\xE5ll som finns utan JavaScript: {percent}% ({without} av {with} tecken)",
|
|
155
|
+
noscript_empty: "Sidan \xE4r i praktiken tom utan JavaScript.",
|
|
156
|
+
noscript_partial: "En v\xE4sentlig del av inneh\xE5llet saknas utan JavaScript.",
|
|
157
|
+
noscript_ok: "K\xE4rninneh\xE5llet finns tillg\xE4ngligt utan JavaScript.",
|
|
158
|
+
noscript_unknown: "Kunde inte m\xE4tas.",
|
|
159
|
+
noscript_fallback: "Sidan har en <noscript>-fallback.",
|
|
160
|
+
noscript_no_fallback: "Ingen <noscript>-fallback hittades.",
|
|
161
|
+
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.",
|
|
162
|
+
noscript_advisory: "Rekommendation, inte ett lagkrav. Inget WCAG-kriterium kr\xE4ver att en sida fungerar utan JavaScript, s\xE5 detta p\xE5verkar inte konformansscoren.",
|
|
163
|
+
badge_withheld: "100/100 utan anm\xE4rkning. Robusthetskontrollen \xE4r inte ren, s\xE5 vi genererar ingen delbar badge."
|
|
137
164
|
},
|
|
138
165
|
report: {
|
|
139
166
|
title: "Tillg\xE4nglighetsrapport - {url}",
|
|
@@ -204,7 +231,18 @@ var init_de = __esm({
|
|
|
204
231
|
use_component: "Verwenden Sie die Komponente: {component}",
|
|
205
232
|
pseudo_tests: "\n\u{1F9EC} Generiere Pseudo-Automatisierungstests...\n",
|
|
206
233
|
test_for: "Test f\xFCr {ruleId}:",
|
|
207
|
-
junit_saved: "JUnit XML-Bericht gespeichert unter {path}"
|
|
234
|
+
junit_saved: "JUnit XML-Bericht gespeichert unter {path}",
|
|
235
|
+
noscript_heading: "\n\u{1F9EA} Robustheit ohne JavaScript (Empfehlung)",
|
|
236
|
+
noscript_coverage: "Ohne JavaScript verf\xFCgbare Inhalte: {percent}% ({without} von {with} Zeichen)",
|
|
237
|
+
noscript_empty: "Die Seite ist ohne JavaScript praktisch leer.",
|
|
238
|
+
noscript_partial: "Ohne JavaScript fehlt ein wesentlicher Teil des Inhalts.",
|
|
239
|
+
noscript_ok: "Die Kerninhalte sind ohne JavaScript verf\xFCgbar.",
|
|
240
|
+
noscript_unknown: "Konnte nicht gemessen werden.",
|
|
241
|
+
noscript_fallback: "Ein <noscript>-Fallback ist vorhanden.",
|
|
242
|
+
noscript_no_fallback: "Es wurde kein <noscript>-Fallback gefunden.",
|
|
243
|
+
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.",
|
|
244
|
+
noscript_advisory: "Empfehlung, keine gesetzliche Anforderung. Kein WCAG-Erfolgskriterium verlangt, dass eine Seite ohne JavaScript funktioniert. Dies beeinflusst daher den Konformit\xE4tswert nicht.",
|
|
245
|
+
badge_withheld: "100/100 ohne Befund. Die Robustheitspr\xFCfung ist nicht sauber, deshalb erzeugen wir kein teilbares Badge."
|
|
208
246
|
},
|
|
209
247
|
report: {
|
|
210
248
|
title: "Barrierefreiheitsbericht - {url}",
|
|
@@ -275,7 +313,18 @@ var init_fr = __esm({
|
|
|
275
313
|
use_component: "Utilisez le composant : {component}",
|
|
276
314
|
pseudo_tests: "\n\u{1F9EC} G\xE9n\xE9ration de tests de pseudo-automatisation...\n",
|
|
277
315
|
test_for: "Test pour {ruleId} :",
|
|
278
|
-
junit_saved: "Rapport XML JUnit enregistr\xE9 sous {path}"
|
|
316
|
+
junit_saved: "Rapport XML JUnit enregistr\xE9 sous {path}",
|
|
317
|
+
noscript_heading: "\n\u{1F9EA} Robustesse sans JavaScript (recommandation)",
|
|
318
|
+
noscript_coverage: "Contenu disponible sans JavaScript : {percent}% ({without} sur {with} caract\xE8res)",
|
|
319
|
+
noscript_empty: "La page est pratiquement vide sans JavaScript.",
|
|
320
|
+
noscript_partial: "Une partie importante du contenu est absente sans JavaScript.",
|
|
321
|
+
noscript_ok: "Le contenu principal est disponible sans JavaScript.",
|
|
322
|
+
noscript_unknown: "N'a pas pu \xEAtre mesur\xE9.",
|
|
323
|
+
noscript_fallback: "Une solution de repli <noscript> est pr\xE9sente.",
|
|
324
|
+
noscript_no_fallback: "Aucune solution de repli <noscript> n'a \xE9t\xE9 trouv\xE9e.",
|
|
325
|
+
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.",
|
|
326
|
+
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.",
|
|
327
|
+
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
328
|
},
|
|
280
329
|
report: {
|
|
281
330
|
title: "Rapport d'Accessibilit\xE9 - {url}",
|
|
@@ -346,7 +395,18 @@ var init_es = __esm({
|
|
|
346
395
|
use_component: "Use el componente: {component}",
|
|
347
396
|
pseudo_tests: "\n\u{1F9EC} Generando pruebas de pseudo-automatizaci\xF3n...\n",
|
|
348
397
|
test_for: "Prueba para {ruleId}:",
|
|
349
|
-
junit_saved: "Informe JUnit XML guardado en {path}"
|
|
398
|
+
junit_saved: "Informe JUnit XML guardado en {path}",
|
|
399
|
+
noscript_heading: "\n\u{1F9EA} Robustez sin JavaScript (recomendaci\xF3n)",
|
|
400
|
+
noscript_coverage: "Contenido disponible sin JavaScript: {percent}% ({without} de {with} caracteres)",
|
|
401
|
+
noscript_empty: "La p\xE1gina est\xE1 pr\xE1cticamente vac\xEDa sin JavaScript.",
|
|
402
|
+
noscript_partial: "Falta una parte sustancial del contenido sin JavaScript.",
|
|
403
|
+
noscript_ok: "El contenido principal est\xE1 disponible sin JavaScript.",
|
|
404
|
+
noscript_unknown: "No se pudo medir.",
|
|
405
|
+
noscript_fallback: "Hay una alternativa <noscript> presente.",
|
|
406
|
+
noscript_no_fallback: "No se encontr\xF3 ninguna alternativa <noscript>.",
|
|
407
|
+
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.",
|
|
408
|
+
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.",
|
|
409
|
+
badge_withheld: "100/100 sin observaciones. La comprobaci\xF3n de robustez no est\xE1 limpia, por lo que no generamos una insignia compartible."
|
|
350
410
|
},
|
|
351
411
|
report: {
|
|
352
412
|
title: "Informe de Accesibilidad - {url}",
|
|
@@ -417,7 +477,18 @@ var init_fi = __esm({
|
|
|
417
477
|
use_component: "K\xE4yt\xE4 komponenttia: {component}",
|
|
418
478
|
pseudo_tests: "\n\u{1F9EC} Luodaan Pseudo-automaatiotestej\xE4...\n",
|
|
419
479
|
test_for: "Testi {ruleId}:lle:",
|
|
420
|
-
junit_saved: "JUnit XML -raportti tallennettu kohteeseen {path}"
|
|
480
|
+
junit_saved: "JUnit XML -raportti tallennettu kohteeseen {path}",
|
|
481
|
+
noscript_heading: "\n\u{1F9EA} Vakaus ilman JavaScripti\xE4 (suositus)",
|
|
482
|
+
noscript_coverage: "Sis\xE4lt\xF6\xE4 saatavilla ilman JavaScripti\xE4: {percent}% ({without}/{with} merkki\xE4)",
|
|
483
|
+
noscript_empty: "Sivu on k\xE4yt\xE4nn\xF6ss\xE4 tyhj\xE4 ilman JavaScripti\xE4.",
|
|
484
|
+
noscript_partial: "Merkitt\xE4v\xE4 osa sis\xE4ll\xF6st\xE4 puuttuu ilman JavaScripti\xE4.",
|
|
485
|
+
noscript_ok: "Ydinsis\xE4lt\xF6 on saatavilla ilman JavaScripti\xE4.",
|
|
486
|
+
noscript_unknown: "Ei voitu mitata.",
|
|
487
|
+
noscript_fallback: "Sivulla on <noscript>-varasis\xE4lt\xF6.",
|
|
488
|
+
noscript_no_fallback: "<noscript>-varasis\xE4lt\xF6\xE4 ei l\xF6ytynyt.",
|
|
489
|
+
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.",
|
|
490
|
+
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.",
|
|
491
|
+
badge_withheld: "100/100 ilman huomautuksia. Robustiustarkistus ei ole puhdas, joten emme luo jaettavaa merkki\xE4."
|
|
421
492
|
},
|
|
422
493
|
report: {
|
|
423
494
|
title: "Saavutettavuusraportti - {url}",
|
|
@@ -488,7 +559,18 @@ var init_dk = __esm({
|
|
|
488
559
|
use_component: "Brug komponent: {component}",
|
|
489
560
|
pseudo_tests: "\n\u{1F9EC} Genererer Pseudo-automatiseringstests...\n",
|
|
490
561
|
test_for: "Test for {ruleId}:",
|
|
491
|
-
junit_saved: "JUnit XML-rapport gemt i {path}"
|
|
562
|
+
junit_saved: "JUnit XML-rapport gemt i {path}",
|
|
563
|
+
noscript_heading: "\n\u{1F9EA} Robusthed uden JavaScript (anbefaling)",
|
|
564
|
+
noscript_coverage: "Indhold tilg\xE6ngeligt uden JavaScript: {percent}% ({without} af {with} tegn)",
|
|
565
|
+
noscript_empty: "Siden er reelt tom uden JavaScript.",
|
|
566
|
+
noscript_partial: "En v\xE6sentlig del af indholdet mangler uden JavaScript.",
|
|
567
|
+
noscript_ok: "Kerneindholdet er tilg\xE6ngeligt uden JavaScript.",
|
|
568
|
+
noscript_unknown: "Kunne ikke m\xE5les.",
|
|
569
|
+
noscript_fallback: "Der findes en <noscript>-fallback.",
|
|
570
|
+
noscript_no_fallback: "Der blev ikke fundet nogen <noscript>-fallback.",
|
|
571
|
+
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.",
|
|
572
|
+
noscript_advisory: "Anbefaling, ikke et lovkrav. Intet WCAG-succeskriterium kr\xE6ver, at en side fungerer uden JavaScript, s\xE5 dette p\xE5virker ikke konformitetsscoren.",
|
|
573
|
+
badge_withheld: "100/100 uden anm\xE6rkninger. Robusthedstjekket er ikke rent, s\xE5 vi genererer ikke et delbart badge."
|
|
492
574
|
},
|
|
493
575
|
report: {
|
|
494
576
|
title: "Tilg\xE6ngelighedsrapport - {url}",
|
|
@@ -559,7 +641,18 @@ var init_no = __esm({
|
|
|
559
641
|
use_component: "Bruk komponent: {component}",
|
|
560
642
|
pseudo_tests: "\n\u{1F9EC} Genererer Pseudo-automatiseringstester...\n",
|
|
561
643
|
test_for: "Test for {ruleId}:",
|
|
562
|
-
junit_saved: "JUnit XML-rapport lagret i {path}"
|
|
644
|
+
junit_saved: "JUnit XML-rapport lagret i {path}",
|
|
645
|
+
noscript_heading: "\n\u{1F9EA} Robusthet uten JavaScript (anbefaling)",
|
|
646
|
+
noscript_coverage: "Innhold tilgjengelig uten JavaScript: {percent}% ({without} av {with} tegn)",
|
|
647
|
+
noscript_empty: "Siden er i praksis tom uten JavaScript.",
|
|
648
|
+
noscript_partial: "En vesentlig del av innholdet mangler uten JavaScript.",
|
|
649
|
+
noscript_ok: "Kjerneinnholdet er tilgjengelig uten JavaScript.",
|
|
650
|
+
noscript_unknown: "Kunne ikke m\xE5les.",
|
|
651
|
+
noscript_fallback: "Siden har en <noscript>-fallback.",
|
|
652
|
+
noscript_no_fallback: "Ingen <noscript>-fallback ble funnet.",
|
|
653
|
+
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.",
|
|
654
|
+
noscript_advisory: "Anbefaling, ikke et lovkrav. Ingen WCAG-suksesskriterier krever at en side fungerer uten JavaScript, s\xE5 dette p\xE5virker ikke samsvarsscoren.",
|
|
655
|
+
badge_withheld: "100/100 uten anmerkninger. Robusthetssjekken er ikke ren, s\xE5 vi genererer ikke et delbart badge."
|
|
563
656
|
},
|
|
564
657
|
report: {
|
|
565
658
|
title: "Tilgjengelighetsrapport - {url}",
|
|
@@ -630,7 +723,18 @@ var init_nl = __esm({
|
|
|
630
723
|
use_component: "Gebruik component: {component}",
|
|
631
724
|
pseudo_tests: "\n\u{1F9EC} Pseudo-automatiseringstests genereren...\n",
|
|
632
725
|
test_for: "Test voor {ruleId}:",
|
|
633
|
-
junit_saved: "JUnit XML-rapport opgeslagen op {path}"
|
|
726
|
+
junit_saved: "JUnit XML-rapport opgeslagen op {path}",
|
|
727
|
+
noscript_heading: "\n\u{1F9EA} Robuustheid zonder JavaScript (advies)",
|
|
728
|
+
noscript_coverage: "Inhoud beschikbaar zonder JavaScript: {percent}% ({without} van {with} tekens)",
|
|
729
|
+
noscript_empty: "De pagina is zonder JavaScript in feite leeg.",
|
|
730
|
+
noscript_partial: "Een aanzienlijk deel van de inhoud ontbreekt zonder JavaScript.",
|
|
731
|
+
noscript_ok: "De kerninhoud is beschikbaar zonder JavaScript.",
|
|
732
|
+
noscript_unknown: "Kon niet worden gemeten.",
|
|
733
|
+
noscript_fallback: "Er is een <noscript>-fallback aanwezig.",
|
|
734
|
+
noscript_no_fallback: "Er is geen <noscript>-fallback gevonden.",
|
|
735
|
+
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.",
|
|
736
|
+
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.",
|
|
737
|
+
badge_withheld: "100/100 zonder bevindingen. De robuustheidscontrole is niet schoon, dus we genereren geen deelbare badge."
|
|
634
738
|
},
|
|
635
739
|
report: {
|
|
636
740
|
title: "Toegankelijkheidsrapport - {url}",
|
|
@@ -1182,10 +1286,74 @@ var HtmlValidator = class {
|
|
|
1182
1286
|
}
|
|
1183
1287
|
};
|
|
1184
1288
|
|
|
1289
|
+
// src/core/noscript-check.ts
|
|
1290
|
+
init_cjs_shims();
|
|
1291
|
+
var NOSCRIPT_EMPTY_THRESHOLD = 0.05;
|
|
1292
|
+
var NOSCRIPT_PARTIAL_THRESHOLD = 0.5;
|
|
1293
|
+
function evaluateNoScriptCoverage(textLengthWithoutJs, textLengthWithJs, hasNoScriptFallback = false) {
|
|
1294
|
+
const withoutJs = Math.max(0, Math.trunc(textLengthWithoutJs) || 0);
|
|
1295
|
+
const withJs = Math.max(0, Math.trunc(textLengthWithJs) || 0);
|
|
1296
|
+
const base = {
|
|
1297
|
+
textLengthWithoutJs: withoutJs,
|
|
1298
|
+
textLengthWithJs: withJs,
|
|
1299
|
+
hasNoScriptFallback,
|
|
1300
|
+
isWcagViolation: false,
|
|
1301
|
+
affectsScore: false
|
|
1302
|
+
};
|
|
1303
|
+
if (withJs === 0) {
|
|
1304
|
+
return {
|
|
1305
|
+
...base,
|
|
1306
|
+
coverageRatio: 0,
|
|
1307
|
+
verdict: "unknown",
|
|
1308
|
+
hasContentWithoutJs: withoutJs > 0
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
const coverageRatio = Math.min(1, withoutJs / withJs);
|
|
1312
|
+
let verdict;
|
|
1313
|
+
if (coverageRatio < NOSCRIPT_EMPTY_THRESHOLD) {
|
|
1314
|
+
verdict = "empty";
|
|
1315
|
+
} else if (coverageRatio < NOSCRIPT_PARTIAL_THRESHOLD) {
|
|
1316
|
+
verdict = "partial";
|
|
1317
|
+
} else {
|
|
1318
|
+
verdict = "ok";
|
|
1319
|
+
}
|
|
1320
|
+
return {
|
|
1321
|
+
...base,
|
|
1322
|
+
coverageRatio,
|
|
1323
|
+
verdict,
|
|
1324
|
+
hasContentWithoutJs: coverageRatio >= NOSCRIPT_EMPTY_THRESHOLD
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
async function probeWithoutJavaScript(browser, options) {
|
|
1328
|
+
const page = await browser.newPage();
|
|
1329
|
+
try {
|
|
1330
|
+
if (options.userAgent) await page.setUserAgent(options.userAgent);
|
|
1331
|
+
if (options.viewport) await page.setViewport(options.viewport);
|
|
1332
|
+
await page.setJavaScriptEnabled(false);
|
|
1333
|
+
await page.goto(options.url, {
|
|
1334
|
+
waitUntil: "domcontentloaded",
|
|
1335
|
+
timeout: options.timeout ?? 6e4
|
|
1336
|
+
});
|
|
1337
|
+
await page.setJavaScriptEnabled(true);
|
|
1338
|
+
return await page.evaluate(() => {
|
|
1339
|
+
const noScriptEls = Array.from(document.querySelectorAll("noscript"));
|
|
1340
|
+
noScriptEls.forEach((el) => {
|
|
1341
|
+
el.style.display = "none";
|
|
1342
|
+
});
|
|
1343
|
+
return {
|
|
1344
|
+
textLength: (document.body?.innerText ?? "").trim().length,
|
|
1345
|
+
hasNoScriptFallback: noScriptEls.length > 0
|
|
1346
|
+
};
|
|
1347
|
+
});
|
|
1348
|
+
} finally {
|
|
1349
|
+
await page.close();
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1185
1353
|
// src/core/regulatory-scanner.ts
|
|
1186
1354
|
var import_node_fs = require("fs");
|
|
1187
1355
|
function getEngineVersion() {
|
|
1188
|
-
return "
|
|
1356
|
+
return "3.0.0";
|
|
1189
1357
|
}
|
|
1190
1358
|
function getStandardsVersion() {
|
|
1191
1359
|
try {
|
|
@@ -1196,6 +1364,7 @@ function getStandardsVersion() {
|
|
|
1196
1364
|
return "unknown";
|
|
1197
1365
|
}
|
|
1198
1366
|
}
|
|
1367
|
+
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
1368
|
var RegulatoryScanner = class {
|
|
1200
1369
|
browser = null;
|
|
1201
1370
|
options;
|
|
@@ -1209,8 +1378,13 @@ var RegulatoryScanner = class {
|
|
|
1209
1378
|
invalidHttpsCert: false,
|
|
1210
1379
|
waitForHydrationMs: 2500,
|
|
1211
1380
|
// Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
|
|
1381
|
+
noScriptCheck: false,
|
|
1382
|
+
// Default AV: opt-in, kostar en extra sidladdning
|
|
1212
1383
|
...options
|
|
1213
1384
|
};
|
|
1385
|
+
if (this.options.waitForHydrationMs === void 0) {
|
|
1386
|
+
this.options.waitForHydrationMs = 2500;
|
|
1387
|
+
}
|
|
1214
1388
|
this.htmlValidator = new HtmlValidator();
|
|
1215
1389
|
}
|
|
1216
1390
|
/** Log only when not in silent mode */
|
|
@@ -1264,6 +1438,12 @@ var RegulatoryScanner = class {
|
|
|
1264
1438
|
}
|
|
1265
1439
|
pageTitle = await page.title();
|
|
1266
1440
|
pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
|
|
1441
|
+
let textLengthWithJs;
|
|
1442
|
+
if (this.options.noScriptCheck) {
|
|
1443
|
+
textLengthWithJs = await page.evaluate(
|
|
1444
|
+
() => (document.body?.innerText ?? "").trim().length
|
|
1445
|
+
);
|
|
1446
|
+
}
|
|
1267
1447
|
let htmlValidation;
|
|
1268
1448
|
if (!this.options.light) {
|
|
1269
1449
|
const pageContent = await page.content();
|
|
@@ -1295,11 +1475,18 @@ var RegulatoryScanner = class {
|
|
|
1295
1475
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
1296
1476
|
passedCount = axeResults.passes?.length || 0;
|
|
1297
1477
|
const regulatoryReports = this.options.light ? await this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1478
|
+
let noScript;
|
|
1479
|
+
if (this.options.noScriptCheck) {
|
|
1480
|
+
noScript = await this.runNoScriptCheck(textLengthWithJs ?? 0);
|
|
1481
|
+
}
|
|
1298
1482
|
const scanDuration = Date.now() - startTime;
|
|
1299
1483
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
1300
1484
|
if (htmlValidation) {
|
|
1301
1485
|
result.htmlValidation = htmlValidation;
|
|
1302
1486
|
}
|
|
1487
|
+
if (noScript) {
|
|
1488
|
+
result.noScript = noScript;
|
|
1489
|
+
}
|
|
1303
1490
|
return result;
|
|
1304
1491
|
} finally {
|
|
1305
1492
|
await this.close();
|
|
@@ -1320,13 +1507,55 @@ var RegulatoryScanner = class {
|
|
|
1320
1507
|
async getPage() {
|
|
1321
1508
|
if (!this.browser) throw new Error("Browser not initialized");
|
|
1322
1509
|
const page = await this.browser.newPage();
|
|
1323
|
-
await page.setUserAgent(
|
|
1510
|
+
await page.setUserAgent(SCAN_USER_AGENT);
|
|
1324
1511
|
return page;
|
|
1325
1512
|
}
|
|
1326
1513
|
async injectAxe(page) {
|
|
1327
1514
|
const axeSource = import_axe_core.default.source;
|
|
1328
1515
|
await page.evaluate(axeSource);
|
|
1329
1516
|
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Laddar sidan en andra gång med JS avstängt och jämför innehållsmängden
|
|
1519
|
+
* med den hydrerade sidan. Rådgivande robusthetsindikator, aldrig ett
|
|
1520
|
+
* WCAG-fel och aldrig en faktor i scoren. Se noscript-check.ts.
|
|
1521
|
+
*
|
|
1522
|
+
* Kastar aldrig: en misslyckad sond får inte fälla en i övrigt lyckad scan.
|
|
1523
|
+
* Vid fel returneras verdict 'unknown' med felmeddelandet bevarat, inte
|
|
1524
|
+
* 'empty' (vi vill inte larma om en tom sida när det var sonden som brast).
|
|
1525
|
+
*/
|
|
1526
|
+
async runNoScriptCheck(textLengthWithJs) {
|
|
1527
|
+
try {
|
|
1528
|
+
if (!this.browser) throw new Error("Browser not initialized");
|
|
1529
|
+
this.log("M\xE4ter robusthet utan JavaScript...");
|
|
1530
|
+
const measurement = await probeWithoutJavaScript(this.browser, {
|
|
1531
|
+
// SAMMA user agent och viewport som huvudskanningen. Skiljer de sig
|
|
1532
|
+
// åt kan servern svara med annan markup och jämförelsen blir falsk:
|
|
1533
|
+
// vi skulle mäta två olika sidor, inte JS-effekten.
|
|
1534
|
+
url: this.options.url,
|
|
1535
|
+
userAgent: SCAN_USER_AGENT,
|
|
1536
|
+
viewport: this.options.viewport
|
|
1537
|
+
});
|
|
1538
|
+
return evaluateNoScriptCoverage(
|
|
1539
|
+
measurement.textLength,
|
|
1540
|
+
textLengthWithJs,
|
|
1541
|
+
measurement.hasNoScriptFallback
|
|
1542
|
+
);
|
|
1543
|
+
} catch (e) {
|
|
1544
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
1545
|
+
this.log(`Robusthetskontrollen kunde inte genomf\xF6ras: ${message}`);
|
|
1546
|
+
return {
|
|
1547
|
+
textLengthWithoutJs: 0,
|
|
1548
|
+
textLengthWithJs: Math.max(0, textLengthWithJs),
|
|
1549
|
+
coverageRatio: 0,
|
|
1550
|
+
verdict: "unknown",
|
|
1551
|
+
hasContentWithoutJs: false,
|
|
1552
|
+
hasNoScriptFallback: false,
|
|
1553
|
+
isWcagViolation: false,
|
|
1554
|
+
affectsScore: false,
|
|
1555
|
+
error: message
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1330
1559
|
/**
|
|
1331
1560
|
* Light enrichment — maps axe severity directly, then attaches plain-language
|
|
1332
1561
|
* (klarspråk) copy to the top findings so the public light scan can render
|
|
@@ -1624,6 +1853,9 @@ function generateBadgeMarkdown(score) {
|
|
|
1624
1853
|
}
|
|
1625
1854
|
return ``;
|
|
1626
1855
|
}
|
|
1856
|
+
function isBadgeWithheldByRobustness(noScript) {
|
|
1857
|
+
return noScript?.verdict === "empty";
|
|
1858
|
+
}
|
|
1627
1859
|
|
|
1628
1860
|
// src/reporting/html-template.ts
|
|
1629
1861
|
init_i18n();
|
|
@@ -1658,6 +1890,45 @@ function formatDate(dateString) {
|
|
|
1658
1890
|
function escapeHtml(str) {
|
|
1659
1891
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1660
1892
|
}
|
|
1893
|
+
function renderNoScriptSection(result) {
|
|
1894
|
+
const noScript = result.noScript;
|
|
1895
|
+
if (!noScript) return "";
|
|
1896
|
+
const palette = {
|
|
1897
|
+
empty: { accent: "#b91c1c", bg: "#fef2f2", icon: "\u{1F534}" },
|
|
1898
|
+
partial: { accent: "#b45309", bg: "#fffbeb", icon: "\u{1F7E1}" },
|
|
1899
|
+
ok: { accent: "#15803d", bg: "#f0fdf4", icon: "\u{1F7E2}" },
|
|
1900
|
+
unknown: { accent: "#475569", bg: "#f8fafc", icon: "\u26AA" }
|
|
1901
|
+
}[noScript.verdict];
|
|
1902
|
+
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");
|
|
1903
|
+
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;">
|
|
1904
|
+
${escapeHtml(t("cli.noscript_impact"))}
|
|
1905
|
+
</p>` : "";
|
|
1906
|
+
const detail = noScript.verdict === "unknown" ? "" : `<p style="margin: 0 0 0.5rem; color: #334155; font-size: 0.95rem;">
|
|
1907
|
+
${escapeHtml(t("cli.noscript_coverage", {
|
|
1908
|
+
percent: Math.round(noScript.coverageRatio * 100),
|
|
1909
|
+
without: noScript.textLengthWithoutJs,
|
|
1910
|
+
with: noScript.textLengthWithJs
|
|
1911
|
+
}))}
|
|
1912
|
+
</p>
|
|
1913
|
+
${noScript.verdict !== "ok" ? `<p style="margin: 0 0 0.5rem; color: #475569; font-size: 0.9rem;">
|
|
1914
|
+
${escapeHtml(noScript.hasNoScriptFallback ? t("cli.noscript_fallback") : t("cli.noscript_no_fallback"))}
|
|
1915
|
+
</p>` : ""}`;
|
|
1916
|
+
return `
|
|
1917
|
+
<section style="margin: 2rem 0; padding: 1.25rem 1.5rem; background: ${palette.bg}; border-left: 5px solid ${palette.accent}; border-radius: 6px;">
|
|
1918
|
+
<h2 style="margin: 0 0 0.75rem; font-size: 1.1rem; color: ${palette.accent};">
|
|
1919
|
+
${escapeHtml(t("cli.noscript_heading").trim())}
|
|
1920
|
+
</h2>
|
|
1921
|
+
<p style="margin: 0 0 0.5rem; font-weight: 600; color: #0f172a; font-size: 1rem;">
|
|
1922
|
+
<span aria-hidden="true">${palette.icon}</span> ${escapeHtml(summary)}
|
|
1923
|
+
</p>
|
|
1924
|
+
${impact}
|
|
1925
|
+
${detail}
|
|
1926
|
+
<p style="margin: 0.75rem 0 0; color: #475569; font-size: 0.85rem; line-height: 1.5;">
|
|
1927
|
+
${escapeHtml(t("cli.noscript_advisory"))}
|
|
1928
|
+
</p>
|
|
1929
|
+
</section>
|
|
1930
|
+
`;
|
|
1931
|
+
}
|
|
1661
1932
|
function generateReportHTML(result, sector = "public", audience = "developer", plainFallbackFrom) {
|
|
1662
1933
|
if (audience === "plain") {
|
|
1663
1934
|
return generatePlainReportHTML(result, plainFallbackFrom);
|
|
@@ -1932,7 +2203,7 @@ function generateReportHTML(result, sector = "public", audience = "developer", p
|
|
|
1932
2203
|
</div>
|
|
1933
2204
|
`;
|
|
1934
2205
|
}).join("")}
|
|
1935
|
-
|
|
2206
|
+
${renderNoScriptSection(result)}
|
|
1936
2207
|
<footer>
|
|
1937
2208
|
${t("report.footer", { version: getEngineVersion() })}
|
|
1938
2209
|
</footer>
|
|
@@ -2293,7 +2564,7 @@ ${sortedGroups.map((group) => {
|
|
|
2293
2564
|
</div>
|
|
2294
2565
|
|
|
2295
2566
|
${itemsHtml}
|
|
2296
|
-
|
|
2567
|
+
${renderNoScriptSection(result)}
|
|
2297
2568
|
<p class="closing">${t("plain.closing")}</p>
|
|
2298
2569
|
</div>
|
|
2299
2570
|
|
|
@@ -2680,6 +2951,27 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
|
|
|
2680
2951
|
await import_promises.default.writeFile(outputPath, content, "utf-8");
|
|
2681
2952
|
}
|
|
2682
2953
|
|
|
2954
|
+
// src/cli/parse-options.ts
|
|
2955
|
+
init_cjs_shims();
|
|
2956
|
+
var MAX_HYDRATION_WAIT_MS = 6e4;
|
|
2957
|
+
var InvalidOptionError = class extends Error {
|
|
2958
|
+
};
|
|
2959
|
+
function parseHydrationWait(raw) {
|
|
2960
|
+
const trimmed = String(raw).trim();
|
|
2961
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
2962
|
+
throw new InvalidOptionError(
|
|
2963
|
+
`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).`
|
|
2964
|
+
);
|
|
2965
|
+
}
|
|
2966
|
+
const ms = Number(trimmed);
|
|
2967
|
+
if (ms > MAX_HYDRATION_WAIT_MS) {
|
|
2968
|
+
throw new InvalidOptionError(
|
|
2969
|
+
`--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.`
|
|
2970
|
+
);
|
|
2971
|
+
}
|
|
2972
|
+
return ms;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2683
2975
|
// src/cli/index.ts
|
|
2684
2976
|
init_i18n();
|
|
2685
2977
|
init_plain_language_support();
|
|
@@ -2765,6 +3057,31 @@ async function sendToCloud(config, result) {
|
|
|
2765
3057
|
|
|
2766
3058
|
// src/cli/index.ts
|
|
2767
3059
|
var import_cosmiconfig = require("cosmiconfig");
|
|
3060
|
+
function renderNoScriptAdvisory(noScript) {
|
|
3061
|
+
console.log(import_chalk2.default.bold(t("cli.noscript_heading")));
|
|
3062
|
+
if (noScript.verdict === "unknown") {
|
|
3063
|
+
console.log(import_chalk2.default.gray(` ${t("cli.noscript_unknown")}${noScript.error ? ` (${noScript.error})` : ""}`));
|
|
3064
|
+
console.log(import_chalk2.default.gray(` ${t("cli.noscript_advisory")}`));
|
|
3065
|
+
return;
|
|
3066
|
+
}
|
|
3067
|
+
const percent = Math.round(noScript.coverageRatio * 100);
|
|
3068
|
+
const color = noScript.verdict === "empty" ? import_chalk2.default.red : noScript.verdict === "partial" ? import_chalk2.default.yellow : import_chalk2.default.green;
|
|
3069
|
+
const icon = noScript.verdict === "empty" ? "\u{1F534}" : noScript.verdict === "partial" ? "\u{1F7E1}" : "\u{1F7E2}";
|
|
3070
|
+
const summary = noScript.verdict === "empty" ? t("cli.noscript_empty") : noScript.verdict === "partial" ? t("cli.noscript_partial") : t("cli.noscript_ok");
|
|
3071
|
+
console.log(` ${icon} ${color.bold(summary)}`);
|
|
3072
|
+
if (noScript.verdict !== "ok") {
|
|
3073
|
+
console.log(import_chalk2.default.white(` ${t("cli.noscript_impact")}`));
|
|
3074
|
+
}
|
|
3075
|
+
console.log(import_chalk2.default.white(` ${t("cli.noscript_coverage", {
|
|
3076
|
+
percent,
|
|
3077
|
+
without: noScript.textLengthWithoutJs,
|
|
3078
|
+
with: noScript.textLengthWithJs
|
|
3079
|
+
})}`));
|
|
3080
|
+
if (noScript.verdict !== "ok") {
|
|
3081
|
+
console.log(import_chalk2.default.gray(` ${noScript.hasNoScriptFallback ? t("cli.noscript_fallback") : t("cli.noscript_no_fallback")}`));
|
|
3082
|
+
}
|
|
3083
|
+
console.log(import_chalk2.default.gray(` ${t("cli.noscript_advisory")}`));
|
|
3084
|
+
}
|
|
2768
3085
|
function isValidUrl(urlString) {
|
|
2769
3086
|
try {
|
|
2770
3087
|
const url = new URL(urlString);
|
|
@@ -2775,10 +3092,20 @@ function isValidUrl(urlString) {
|
|
|
2775
3092
|
}
|
|
2776
3093
|
var program = new import_commander.Command();
|
|
2777
3094
|
program.name("hd-a11y-scan").description("HolmDigital Regulatory Scanner").version(getEngineVersion());
|
|
2778
|
-
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) => {
|
|
3095
|
+
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) => {
|
|
2779
3096
|
const explorer = (0, import_cosmiconfig.cosmiconfig)("a11y");
|
|
2780
3097
|
const configResult = await explorer.search();
|
|
2781
3098
|
const fileConfig = configResult ? configResult.config : {};
|
|
3099
|
+
let waitForHydrationMs;
|
|
3100
|
+
try {
|
|
3101
|
+
waitForHydrationMs = cliOptions.waitForHydration !== void 0 ? parseHydrationWait(cliOptions.waitForHydration) : fileConfig.waitForHydrationMs !== void 0 ? parseHydrationWait(String(fileConfig.waitForHydrationMs)) : void 0;
|
|
3102
|
+
} catch (e) {
|
|
3103
|
+
if (e instanceof InvalidOptionError) {
|
|
3104
|
+
console.error(import_chalk2.default.red(e.message));
|
|
3105
|
+
process.exit(1);
|
|
3106
|
+
}
|
|
3107
|
+
throw e;
|
|
3108
|
+
}
|
|
2782
3109
|
const options = {
|
|
2783
3110
|
lang: cliOptions.lang || fileConfig.lang || "en",
|
|
2784
3111
|
ci: cliOptions.ci ?? fileConfig.ci ?? false,
|
|
@@ -2804,6 +3131,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2804
3131
|
publishDate: cliOptions.publishDate || fileConfig.publishDate,
|
|
2805
3132
|
light: cliOptions.light ?? fileConfig.light ?? false,
|
|
2806
3133
|
plain: cliOptions.plain ?? fileConfig.plain ?? false,
|
|
3134
|
+
// Commander camelCase:ar --noscript-check till noscriptCheck.
|
|
3135
|
+
noScriptCheck: cliOptions.noscriptCheck ?? fileConfig.noScriptCheck ?? false,
|
|
3136
|
+
waitForHydrationMs,
|
|
2807
3137
|
audience: cliOptions.plain ? "plain" : cliOptions.audience || fileConfig.audience || "developer"
|
|
2808
3138
|
};
|
|
2809
3139
|
setLanguage(options.lang);
|
|
@@ -2841,7 +3171,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2841
3171
|
silent: options.json || options.light,
|
|
2842
3172
|
severityThreshold: options.threshold,
|
|
2843
3173
|
invalidHttpsCert: options.invalidHttpsCert,
|
|
2844
|
-
light: options.light
|
|
3174
|
+
light: options.light,
|
|
3175
|
+
noScriptCheck: options.noScriptCheck,
|
|
3176
|
+
waitForHydrationMs: options.waitForHydrationMs
|
|
2845
3177
|
});
|
|
2846
3178
|
if (spinner) spinner.text = t("cli.analyzing");
|
|
2847
3179
|
const result = await scanner.scan();
|
|
@@ -2878,6 +3210,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
2878
3210
|
complianceStatus: result.complianceStatus,
|
|
2879
3211
|
stats: result.stats,
|
|
2880
3212
|
scanDuration: result.metadata.scanDuration,
|
|
3213
|
+
// Rådgivande robusthetsindikator. Undefined när --noscript-check
|
|
3214
|
+
// inte används och faller då ur JSON:en av sig själv.
|
|
3215
|
+
noScript: result.noScript,
|
|
2881
3216
|
topIssues: result.reports.slice(0, 5).map((r) => ({
|
|
2882
3217
|
id: r.ruleId,
|
|
2883
3218
|
impact: r.holmdigitalInsight.diggRisk,
|
|
@@ -2916,10 +3251,15 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
2916
3251
|
const scoreColor = result.score >= 90 ? import_chalk2.default.green : result.score >= 70 ? import_chalk2.default.yellow : import_chalk2.default.red;
|
|
2917
3252
|
console.log(import_chalk2.default.bold(`[ Compliance Score: ${scoreColor(result.score + "/100")} ] ${result.score >= 90 ? "\u{1F7E2}" : result.score >= 70 ? "\u{1F7E1}" : "\u{1F534}"}`));
|
|
2918
3253
|
if (result.score === 100) {
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
3254
|
+
if (isBadgeWithheldByRobustness(result.noScript)) {
|
|
3255
|
+
console.log(import_chalk2.default.yellow(`
|
|
3256
|
+
${t("cli.badge_withheld")}`));
|
|
3257
|
+
} else {
|
|
3258
|
+
const badge = generateBadgeMarkdown(result.score);
|
|
3259
|
+
if (badge) {
|
|
3260
|
+
console.log(import_chalk2.default.green.bold("\n\u{1F3C6} Perfect Score! Here is your accessibility badge:"));
|
|
3261
|
+
console.log(import_chalk2.default.white(badge));
|
|
3262
|
+
}
|
|
2923
3263
|
}
|
|
2924
3264
|
}
|
|
2925
3265
|
console.log(import_chalk2.default.gray("----------------------------------------"));
|
|
@@ -3015,6 +3355,9 @@ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
|
3015
3355
|
});
|
|
3016
3356
|
}
|
|
3017
3357
|
}
|
|
3358
|
+
if (result.noScript && !options.json) {
|
|
3359
|
+
renderNoScriptAdvisory(result.noScript);
|
|
3360
|
+
}
|
|
3018
3361
|
if (options.ci && result.reports.length > 0) {
|
|
3019
3362
|
const { generateGitHubActionsAnnotations: generateGitHubActionsAnnotations2 } = await Promise.resolve().then(() => (init_github_actions(), github_actions_exports));
|
|
3020
3363
|
generateGitHubActionsAnnotations2(result.reports);
|