@holmdigital/engine 2.12.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-5S6UAABI.mjs → chunk-ZPNGG5KS.mjs} +136 -4
- package/dist/cli/index.js +357 -19
- 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 +243 -11
- 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/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}",
|
|
@@ -760,13 +859,17 @@ var init_i18n = __esm({
|
|
|
760
859
|
// src/index.ts
|
|
761
860
|
var index_exports = {};
|
|
762
861
|
__export(index_exports, {
|
|
862
|
+
NOSCRIPT_EMPTY_THRESHOLD: () => NOSCRIPT_EMPTY_THRESHOLD,
|
|
863
|
+
NOSCRIPT_PARTIAL_THRESHOLD: () => NOSCRIPT_PARTIAL_THRESHOLD,
|
|
763
864
|
PseudoAutomationEngine: () => PseudoAutomationEngine,
|
|
764
865
|
RegulatoryScanner: () => RegulatoryScanner,
|
|
765
866
|
VirtualDOMBuilder: () => VirtualDOMBuilder,
|
|
867
|
+
evaluateNoScriptCoverage: () => evaluateNoScriptCoverage,
|
|
766
868
|
generateStatement: () => generateStatement,
|
|
767
869
|
generateStatementContent: () => generateStatementContent,
|
|
768
870
|
getCurrentLang: () => getCurrentLang,
|
|
769
871
|
getEngineVersion: () => getEngineVersion,
|
|
872
|
+
probeWithoutJavaScript: () => probeWithoutJavaScript,
|
|
770
873
|
setLanguage: () => setLanguage,
|
|
771
874
|
t: () => t
|
|
772
875
|
});
|
|
@@ -908,10 +1011,74 @@ var HtmlValidator = class {
|
|
|
908
1011
|
}
|
|
909
1012
|
};
|
|
910
1013
|
|
|
1014
|
+
// src/core/noscript-check.ts
|
|
1015
|
+
init_cjs_shims();
|
|
1016
|
+
var NOSCRIPT_EMPTY_THRESHOLD = 0.05;
|
|
1017
|
+
var NOSCRIPT_PARTIAL_THRESHOLD = 0.5;
|
|
1018
|
+
function evaluateNoScriptCoverage(textLengthWithoutJs, textLengthWithJs, hasNoScriptFallback = false) {
|
|
1019
|
+
const withoutJs = Math.max(0, Math.trunc(textLengthWithoutJs) || 0);
|
|
1020
|
+
const withJs = Math.max(0, Math.trunc(textLengthWithJs) || 0);
|
|
1021
|
+
const base = {
|
|
1022
|
+
textLengthWithoutJs: withoutJs,
|
|
1023
|
+
textLengthWithJs: withJs,
|
|
1024
|
+
hasNoScriptFallback,
|
|
1025
|
+
isWcagViolation: false,
|
|
1026
|
+
affectsScore: false
|
|
1027
|
+
};
|
|
1028
|
+
if (withJs === 0) {
|
|
1029
|
+
return {
|
|
1030
|
+
...base,
|
|
1031
|
+
coverageRatio: 0,
|
|
1032
|
+
verdict: "unknown",
|
|
1033
|
+
hasContentWithoutJs: withoutJs > 0
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
const coverageRatio = Math.min(1, withoutJs / withJs);
|
|
1037
|
+
let verdict;
|
|
1038
|
+
if (coverageRatio < NOSCRIPT_EMPTY_THRESHOLD) {
|
|
1039
|
+
verdict = "empty";
|
|
1040
|
+
} else if (coverageRatio < NOSCRIPT_PARTIAL_THRESHOLD) {
|
|
1041
|
+
verdict = "partial";
|
|
1042
|
+
} else {
|
|
1043
|
+
verdict = "ok";
|
|
1044
|
+
}
|
|
1045
|
+
return {
|
|
1046
|
+
...base,
|
|
1047
|
+
coverageRatio,
|
|
1048
|
+
verdict,
|
|
1049
|
+
hasContentWithoutJs: coverageRatio >= NOSCRIPT_EMPTY_THRESHOLD
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
async function probeWithoutJavaScript(browser, options) {
|
|
1053
|
+
const page = await browser.newPage();
|
|
1054
|
+
try {
|
|
1055
|
+
if (options.userAgent) await page.setUserAgent(options.userAgent);
|
|
1056
|
+
if (options.viewport) await page.setViewport(options.viewport);
|
|
1057
|
+
await page.setJavaScriptEnabled(false);
|
|
1058
|
+
await page.goto(options.url, {
|
|
1059
|
+
waitUntil: "domcontentloaded",
|
|
1060
|
+
timeout: options.timeout ?? 6e4
|
|
1061
|
+
});
|
|
1062
|
+
await page.setJavaScriptEnabled(true);
|
|
1063
|
+
return await page.evaluate(() => {
|
|
1064
|
+
const noScriptEls = Array.from(document.querySelectorAll("noscript"));
|
|
1065
|
+
noScriptEls.forEach((el) => {
|
|
1066
|
+
el.style.display = "none";
|
|
1067
|
+
});
|
|
1068
|
+
return {
|
|
1069
|
+
textLength: (document.body?.innerText ?? "").trim().length,
|
|
1070
|
+
hasNoScriptFallback: noScriptEls.length > 0
|
|
1071
|
+
};
|
|
1072
|
+
});
|
|
1073
|
+
} finally {
|
|
1074
|
+
await page.close();
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
911
1078
|
// src/core/regulatory-scanner.ts
|
|
912
1079
|
var import_node_fs = require("fs");
|
|
913
1080
|
function getEngineVersion() {
|
|
914
|
-
return "2.
|
|
1081
|
+
return "2.13.0";
|
|
915
1082
|
}
|
|
916
1083
|
function getStandardsVersion() {
|
|
917
1084
|
try {
|
|
@@ -922,6 +1089,7 @@ function getStandardsVersion() {
|
|
|
922
1089
|
return "unknown";
|
|
923
1090
|
}
|
|
924
1091
|
}
|
|
1092
|
+
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";
|
|
925
1093
|
var RegulatoryScanner = class {
|
|
926
1094
|
browser = null;
|
|
927
1095
|
options;
|
|
@@ -935,8 +1103,13 @@ var RegulatoryScanner = class {
|
|
|
935
1103
|
invalidHttpsCert: false,
|
|
936
1104
|
waitForHydrationMs: 2500,
|
|
937
1105
|
// Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
|
|
1106
|
+
noScriptCheck: false,
|
|
1107
|
+
// Default AV: opt-in, kostar en extra sidladdning
|
|
938
1108
|
...options
|
|
939
1109
|
};
|
|
1110
|
+
if (this.options.waitForHydrationMs === void 0) {
|
|
1111
|
+
this.options.waitForHydrationMs = 2500;
|
|
1112
|
+
}
|
|
940
1113
|
this.htmlValidator = new HtmlValidator();
|
|
941
1114
|
}
|
|
942
1115
|
/** Log only when not in silent mode */
|
|
@@ -990,6 +1163,12 @@ var RegulatoryScanner = class {
|
|
|
990
1163
|
}
|
|
991
1164
|
pageTitle = await page.title();
|
|
992
1165
|
pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
|
|
1166
|
+
let textLengthWithJs;
|
|
1167
|
+
if (this.options.noScriptCheck) {
|
|
1168
|
+
textLengthWithJs = await page.evaluate(
|
|
1169
|
+
() => (document.body?.innerText ?? "").trim().length
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
993
1172
|
let htmlValidation;
|
|
994
1173
|
if (!this.options.light) {
|
|
995
1174
|
const pageContent = await page.content();
|
|
@@ -1021,11 +1200,18 @@ var RegulatoryScanner = class {
|
|
|
1021
1200
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
1022
1201
|
passedCount = axeResults.passes?.length || 0;
|
|
1023
1202
|
const regulatoryReports = this.options.light ? await this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1203
|
+
let noScript;
|
|
1204
|
+
if (this.options.noScriptCheck) {
|
|
1205
|
+
noScript = await this.runNoScriptCheck(textLengthWithJs ?? 0);
|
|
1206
|
+
}
|
|
1024
1207
|
const scanDuration = Date.now() - startTime;
|
|
1025
1208
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
1026
1209
|
if (htmlValidation) {
|
|
1027
1210
|
result.htmlValidation = htmlValidation;
|
|
1028
1211
|
}
|
|
1212
|
+
if (noScript) {
|
|
1213
|
+
result.noScript = noScript;
|
|
1214
|
+
}
|
|
1029
1215
|
return result;
|
|
1030
1216
|
} finally {
|
|
1031
1217
|
await this.close();
|
|
@@ -1046,13 +1232,55 @@ var RegulatoryScanner = class {
|
|
|
1046
1232
|
async getPage() {
|
|
1047
1233
|
if (!this.browser) throw new Error("Browser not initialized");
|
|
1048
1234
|
const page = await this.browser.newPage();
|
|
1049
|
-
await page.setUserAgent(
|
|
1235
|
+
await page.setUserAgent(SCAN_USER_AGENT);
|
|
1050
1236
|
return page;
|
|
1051
1237
|
}
|
|
1052
1238
|
async injectAxe(page) {
|
|
1053
1239
|
const axeSource = import_axe_core.default.source;
|
|
1054
1240
|
await page.evaluate(axeSource);
|
|
1055
1241
|
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Laddar sidan en andra gång med JS avstängt och jämför innehållsmängden
|
|
1244
|
+
* med den hydrerade sidan. Rådgivande robusthetsindikator, aldrig ett
|
|
1245
|
+
* WCAG-fel och aldrig en faktor i scoren. Se noscript-check.ts.
|
|
1246
|
+
*
|
|
1247
|
+
* Kastar aldrig: en misslyckad sond får inte fälla en i övrigt lyckad scan.
|
|
1248
|
+
* Vid fel returneras verdict 'unknown' med felmeddelandet bevarat, inte
|
|
1249
|
+
* 'empty' (vi vill inte larma om en tom sida när det var sonden som brast).
|
|
1250
|
+
*/
|
|
1251
|
+
async runNoScriptCheck(textLengthWithJs) {
|
|
1252
|
+
try {
|
|
1253
|
+
if (!this.browser) throw new Error("Browser not initialized");
|
|
1254
|
+
this.log("M\xE4ter robusthet utan JavaScript...");
|
|
1255
|
+
const measurement = await probeWithoutJavaScript(this.browser, {
|
|
1256
|
+
// SAMMA user agent och viewport som huvudskanningen. Skiljer de sig
|
|
1257
|
+
// åt kan servern svara med annan markup och jämförelsen blir falsk:
|
|
1258
|
+
// vi skulle mäta två olika sidor, inte JS-effekten.
|
|
1259
|
+
url: this.options.url,
|
|
1260
|
+
userAgent: SCAN_USER_AGENT,
|
|
1261
|
+
viewport: this.options.viewport
|
|
1262
|
+
});
|
|
1263
|
+
return evaluateNoScriptCoverage(
|
|
1264
|
+
measurement.textLength,
|
|
1265
|
+
textLengthWithJs,
|
|
1266
|
+
measurement.hasNoScriptFallback
|
|
1267
|
+
);
|
|
1268
|
+
} catch (e) {
|
|
1269
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
1270
|
+
this.log(`Robusthetskontrollen kunde inte genomf\xF6ras: ${message}`);
|
|
1271
|
+
return {
|
|
1272
|
+
textLengthWithoutJs: 0,
|
|
1273
|
+
textLengthWithJs: Math.max(0, textLengthWithJs),
|
|
1274
|
+
coverageRatio: 0,
|
|
1275
|
+
verdict: "unknown",
|
|
1276
|
+
hasContentWithoutJs: false,
|
|
1277
|
+
hasNoScriptFallback: false,
|
|
1278
|
+
isWcagViolation: false,
|
|
1279
|
+
affectsScore: false,
|
|
1280
|
+
error: message
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1056
1284
|
/**
|
|
1057
1285
|
* Light enrichment — maps axe severity directly, then attaches plain-language
|
|
1058
1286
|
* (klarspråk) copy to the top findings so the public light scan can render
|
|
@@ -1690,13 +1918,17 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
|
|
|
1690
1918
|
}
|
|
1691
1919
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1692
1920
|
0 && (module.exports = {
|
|
1921
|
+
NOSCRIPT_EMPTY_THRESHOLD,
|
|
1922
|
+
NOSCRIPT_PARTIAL_THRESHOLD,
|
|
1693
1923
|
PseudoAutomationEngine,
|
|
1694
1924
|
RegulatoryScanner,
|
|
1695
1925
|
VirtualDOMBuilder,
|
|
1926
|
+
evaluateNoScriptCoverage,
|
|
1696
1927
|
generateStatement,
|
|
1697
1928
|
generateStatementContent,
|
|
1698
1929
|
getCurrentLang,
|
|
1699
1930
|
getEngineVersion,
|
|
1931
|
+
probeWithoutJavaScript,
|
|
1700
1932
|
setLanguage,
|
|
1701
1933
|
t
|
|
1702
1934
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NOSCRIPT_EMPTY_THRESHOLD,
|
|
3
|
+
NOSCRIPT_PARTIAL_THRESHOLD,
|
|
2
4
|
PseudoAutomationEngine,
|
|
3
5
|
RegulatoryScanner,
|
|
4
6
|
VirtualDOMBuilder,
|
|
7
|
+
evaluateNoScriptCoverage,
|
|
5
8
|
generateStatement,
|
|
6
9
|
generateStatementContent,
|
|
7
|
-
getEngineVersion
|
|
8
|
-
|
|
10
|
+
getEngineVersion,
|
|
11
|
+
probeWithoutJavaScript
|
|
12
|
+
} from "./chunk-ZPNGG5KS.mjs";
|
|
9
13
|
import {
|
|
10
14
|
getCurrentLang,
|
|
11
15
|
setLanguage,
|
|
12
16
|
t
|
|
13
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-AQFORQWK.mjs";
|
|
14
18
|
import "./chunk-DIBTSSLZ.mjs";
|
|
15
19
|
export {
|
|
20
|
+
NOSCRIPT_EMPTY_THRESHOLD,
|
|
21
|
+
NOSCRIPT_PARTIAL_THRESHOLD,
|
|
16
22
|
PseudoAutomationEngine,
|
|
17
23
|
RegulatoryScanner,
|
|
18
24
|
VirtualDOMBuilder,
|
|
25
|
+
evaluateNoScriptCoverage,
|
|
19
26
|
generateStatement,
|
|
20
27
|
generateStatementContent,
|
|
21
28
|
getCurrentLang,
|
|
22
29
|
getEngineVersion,
|
|
30
|
+
probeWithoutJavaScript,
|
|
23
31
|
setLanguage,
|
|
24
32
|
t
|
|
25
33
|
};
|