@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/index.js
CHANGED
|
@@ -5,8 +5,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
|
|
8
|
+
var __esm = (fn, res, err) => function __init() {
|
|
9
|
+
if (err) throw err[0];
|
|
10
|
+
try {
|
|
11
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw err = [e], e;
|
|
14
|
+
}
|
|
10
15
|
};
|
|
11
16
|
var __export = (target, all) => {
|
|
12
17
|
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}",
|
|
@@ -760,13 +864,17 @@ var init_i18n = __esm({
|
|
|
760
864
|
// src/index.ts
|
|
761
865
|
var index_exports = {};
|
|
762
866
|
__export(index_exports, {
|
|
867
|
+
NOSCRIPT_EMPTY_THRESHOLD: () => NOSCRIPT_EMPTY_THRESHOLD,
|
|
868
|
+
NOSCRIPT_PARTIAL_THRESHOLD: () => NOSCRIPT_PARTIAL_THRESHOLD,
|
|
763
869
|
PseudoAutomationEngine: () => PseudoAutomationEngine,
|
|
764
870
|
RegulatoryScanner: () => RegulatoryScanner,
|
|
765
871
|
VirtualDOMBuilder: () => VirtualDOMBuilder,
|
|
872
|
+
evaluateNoScriptCoverage: () => evaluateNoScriptCoverage,
|
|
766
873
|
generateStatement: () => generateStatement,
|
|
767
874
|
generateStatementContent: () => generateStatementContent,
|
|
768
875
|
getCurrentLang: () => getCurrentLang,
|
|
769
876
|
getEngineVersion: () => getEngineVersion,
|
|
877
|
+
probeWithoutJavaScript: () => probeWithoutJavaScript,
|
|
770
878
|
setLanguage: () => setLanguage,
|
|
771
879
|
t: () => t
|
|
772
880
|
});
|
|
@@ -908,10 +1016,74 @@ var HtmlValidator = class {
|
|
|
908
1016
|
}
|
|
909
1017
|
};
|
|
910
1018
|
|
|
1019
|
+
// src/core/noscript-check.ts
|
|
1020
|
+
init_cjs_shims();
|
|
1021
|
+
var NOSCRIPT_EMPTY_THRESHOLD = 0.05;
|
|
1022
|
+
var NOSCRIPT_PARTIAL_THRESHOLD = 0.5;
|
|
1023
|
+
function evaluateNoScriptCoverage(textLengthWithoutJs, textLengthWithJs, hasNoScriptFallback = false) {
|
|
1024
|
+
const withoutJs = Math.max(0, Math.trunc(textLengthWithoutJs) || 0);
|
|
1025
|
+
const withJs = Math.max(0, Math.trunc(textLengthWithJs) || 0);
|
|
1026
|
+
const base = {
|
|
1027
|
+
textLengthWithoutJs: withoutJs,
|
|
1028
|
+
textLengthWithJs: withJs,
|
|
1029
|
+
hasNoScriptFallback,
|
|
1030
|
+
isWcagViolation: false,
|
|
1031
|
+
affectsScore: false
|
|
1032
|
+
};
|
|
1033
|
+
if (withJs === 0) {
|
|
1034
|
+
return {
|
|
1035
|
+
...base,
|
|
1036
|
+
coverageRatio: 0,
|
|
1037
|
+
verdict: "unknown",
|
|
1038
|
+
hasContentWithoutJs: withoutJs > 0
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
const coverageRatio = Math.min(1, withoutJs / withJs);
|
|
1042
|
+
let verdict;
|
|
1043
|
+
if (coverageRatio < NOSCRIPT_EMPTY_THRESHOLD) {
|
|
1044
|
+
verdict = "empty";
|
|
1045
|
+
} else if (coverageRatio < NOSCRIPT_PARTIAL_THRESHOLD) {
|
|
1046
|
+
verdict = "partial";
|
|
1047
|
+
} else {
|
|
1048
|
+
verdict = "ok";
|
|
1049
|
+
}
|
|
1050
|
+
return {
|
|
1051
|
+
...base,
|
|
1052
|
+
coverageRatio,
|
|
1053
|
+
verdict,
|
|
1054
|
+
hasContentWithoutJs: coverageRatio >= NOSCRIPT_EMPTY_THRESHOLD
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
async function probeWithoutJavaScript(browser, options) {
|
|
1058
|
+
const page = await browser.newPage();
|
|
1059
|
+
try {
|
|
1060
|
+
if (options.userAgent) await page.setUserAgent(options.userAgent);
|
|
1061
|
+
if (options.viewport) await page.setViewport(options.viewport);
|
|
1062
|
+
await page.setJavaScriptEnabled(false);
|
|
1063
|
+
await page.goto(options.url, {
|
|
1064
|
+
waitUntil: "domcontentloaded",
|
|
1065
|
+
timeout: options.timeout ?? 6e4
|
|
1066
|
+
});
|
|
1067
|
+
await page.setJavaScriptEnabled(true);
|
|
1068
|
+
return await page.evaluate(() => {
|
|
1069
|
+
const noScriptEls = Array.from(document.querySelectorAll("noscript"));
|
|
1070
|
+
noScriptEls.forEach((el) => {
|
|
1071
|
+
el.style.display = "none";
|
|
1072
|
+
});
|
|
1073
|
+
return {
|
|
1074
|
+
textLength: (document.body?.innerText ?? "").trim().length,
|
|
1075
|
+
hasNoScriptFallback: noScriptEls.length > 0
|
|
1076
|
+
};
|
|
1077
|
+
});
|
|
1078
|
+
} finally {
|
|
1079
|
+
await page.close();
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
911
1083
|
// src/core/regulatory-scanner.ts
|
|
912
1084
|
var import_node_fs = require("fs");
|
|
913
1085
|
function getEngineVersion() {
|
|
914
|
-
return "
|
|
1086
|
+
return "3.0.0";
|
|
915
1087
|
}
|
|
916
1088
|
function getStandardsVersion() {
|
|
917
1089
|
try {
|
|
@@ -922,6 +1094,7 @@ function getStandardsVersion() {
|
|
|
922
1094
|
return "unknown";
|
|
923
1095
|
}
|
|
924
1096
|
}
|
|
1097
|
+
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
1098
|
var RegulatoryScanner = class {
|
|
926
1099
|
browser = null;
|
|
927
1100
|
options;
|
|
@@ -935,8 +1108,13 @@ var RegulatoryScanner = class {
|
|
|
935
1108
|
invalidHttpsCert: false,
|
|
936
1109
|
waitForHydrationMs: 2500,
|
|
937
1110
|
// Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
|
|
1111
|
+
noScriptCheck: false,
|
|
1112
|
+
// Default AV: opt-in, kostar en extra sidladdning
|
|
938
1113
|
...options
|
|
939
1114
|
};
|
|
1115
|
+
if (this.options.waitForHydrationMs === void 0) {
|
|
1116
|
+
this.options.waitForHydrationMs = 2500;
|
|
1117
|
+
}
|
|
940
1118
|
this.htmlValidator = new HtmlValidator();
|
|
941
1119
|
}
|
|
942
1120
|
/** Log only when not in silent mode */
|
|
@@ -990,6 +1168,12 @@ var RegulatoryScanner = class {
|
|
|
990
1168
|
}
|
|
991
1169
|
pageTitle = await page.title();
|
|
992
1170
|
pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
|
|
1171
|
+
let textLengthWithJs;
|
|
1172
|
+
if (this.options.noScriptCheck) {
|
|
1173
|
+
textLengthWithJs = await page.evaluate(
|
|
1174
|
+
() => (document.body?.innerText ?? "").trim().length
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
993
1177
|
let htmlValidation;
|
|
994
1178
|
if (!this.options.light) {
|
|
995
1179
|
const pageContent = await page.content();
|
|
@@ -1021,11 +1205,18 @@ var RegulatoryScanner = class {
|
|
|
1021
1205
|
this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
|
|
1022
1206
|
passedCount = axeResults.passes?.length || 0;
|
|
1023
1207
|
const regulatoryReports = this.options.light ? await this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
|
|
1208
|
+
let noScript;
|
|
1209
|
+
if (this.options.noScriptCheck) {
|
|
1210
|
+
noScript = await this.runNoScriptCheck(textLengthWithJs ?? 0);
|
|
1211
|
+
}
|
|
1024
1212
|
const scanDuration = Date.now() - startTime;
|
|
1025
1213
|
const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
|
|
1026
1214
|
if (htmlValidation) {
|
|
1027
1215
|
result.htmlValidation = htmlValidation;
|
|
1028
1216
|
}
|
|
1217
|
+
if (noScript) {
|
|
1218
|
+
result.noScript = noScript;
|
|
1219
|
+
}
|
|
1029
1220
|
return result;
|
|
1030
1221
|
} finally {
|
|
1031
1222
|
await this.close();
|
|
@@ -1046,13 +1237,55 @@ var RegulatoryScanner = class {
|
|
|
1046
1237
|
async getPage() {
|
|
1047
1238
|
if (!this.browser) throw new Error("Browser not initialized");
|
|
1048
1239
|
const page = await this.browser.newPage();
|
|
1049
|
-
await page.setUserAgent(
|
|
1240
|
+
await page.setUserAgent(SCAN_USER_AGENT);
|
|
1050
1241
|
return page;
|
|
1051
1242
|
}
|
|
1052
1243
|
async injectAxe(page) {
|
|
1053
1244
|
const axeSource = import_axe_core.default.source;
|
|
1054
1245
|
await page.evaluate(axeSource);
|
|
1055
1246
|
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Laddar sidan en andra gång med JS avstängt och jämför innehållsmängden
|
|
1249
|
+
* med den hydrerade sidan. Rådgivande robusthetsindikator, aldrig ett
|
|
1250
|
+
* WCAG-fel och aldrig en faktor i scoren. Se noscript-check.ts.
|
|
1251
|
+
*
|
|
1252
|
+
* Kastar aldrig: en misslyckad sond får inte fälla en i övrigt lyckad scan.
|
|
1253
|
+
* Vid fel returneras verdict 'unknown' med felmeddelandet bevarat, inte
|
|
1254
|
+
* 'empty' (vi vill inte larma om en tom sida när det var sonden som brast).
|
|
1255
|
+
*/
|
|
1256
|
+
async runNoScriptCheck(textLengthWithJs) {
|
|
1257
|
+
try {
|
|
1258
|
+
if (!this.browser) throw new Error("Browser not initialized");
|
|
1259
|
+
this.log("M\xE4ter robusthet utan JavaScript...");
|
|
1260
|
+
const measurement = await probeWithoutJavaScript(this.browser, {
|
|
1261
|
+
// SAMMA user agent och viewport som huvudskanningen. Skiljer de sig
|
|
1262
|
+
// åt kan servern svara med annan markup och jämförelsen blir falsk:
|
|
1263
|
+
// vi skulle mäta två olika sidor, inte JS-effekten.
|
|
1264
|
+
url: this.options.url,
|
|
1265
|
+
userAgent: SCAN_USER_AGENT,
|
|
1266
|
+
viewport: this.options.viewport
|
|
1267
|
+
});
|
|
1268
|
+
return evaluateNoScriptCoverage(
|
|
1269
|
+
measurement.textLength,
|
|
1270
|
+
textLengthWithJs,
|
|
1271
|
+
measurement.hasNoScriptFallback
|
|
1272
|
+
);
|
|
1273
|
+
} catch (e) {
|
|
1274
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
1275
|
+
this.log(`Robusthetskontrollen kunde inte genomf\xF6ras: ${message}`);
|
|
1276
|
+
return {
|
|
1277
|
+
textLengthWithoutJs: 0,
|
|
1278
|
+
textLengthWithJs: Math.max(0, textLengthWithJs),
|
|
1279
|
+
coverageRatio: 0,
|
|
1280
|
+
verdict: "unknown",
|
|
1281
|
+
hasContentWithoutJs: false,
|
|
1282
|
+
hasNoScriptFallback: false,
|
|
1283
|
+
isWcagViolation: false,
|
|
1284
|
+
affectsScore: false,
|
|
1285
|
+
error: message
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1056
1289
|
/**
|
|
1057
1290
|
* Light enrichment — maps axe severity directly, then attaches plain-language
|
|
1058
1291
|
* (klarspråk) copy to the top findings so the public light scan can render
|
|
@@ -1690,13 +1923,17 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
|
|
|
1690
1923
|
}
|
|
1691
1924
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1692
1925
|
0 && (module.exports = {
|
|
1926
|
+
NOSCRIPT_EMPTY_THRESHOLD,
|
|
1927
|
+
NOSCRIPT_PARTIAL_THRESHOLD,
|
|
1693
1928
|
PseudoAutomationEngine,
|
|
1694
1929
|
RegulatoryScanner,
|
|
1695
1930
|
VirtualDOMBuilder,
|
|
1931
|
+
evaluateNoScriptCoverage,
|
|
1696
1932
|
generateStatement,
|
|
1697
1933
|
generateStatementContent,
|
|
1698
1934
|
getCurrentLang,
|
|
1699
1935
|
getEngineVersion,
|
|
1936
|
+
probeWithoutJavaScript,
|
|
1700
1937
|
setLanguage,
|
|
1701
1938
|
t
|
|
1702
1939
|
});
|
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-F2GV3JGS.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
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holmdigital/engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -81,28 +81,31 @@
|
|
|
81
81
|
],
|
|
82
82
|
"author": "Holm Digital AB",
|
|
83
83
|
"license": "MIT",
|
|
84
|
+
"engines": {
|
|
85
|
+
"node": ">=22.22.0"
|
|
86
|
+
},
|
|
84
87
|
"dependencies": {
|
|
85
|
-
"@holmdigital/components": "^
|
|
86
|
-
"@holmdigital/standards": "^
|
|
88
|
+
"@holmdigital/components": "^4.0.0",
|
|
89
|
+
"@holmdigital/standards": "^3.0.0",
|
|
87
90
|
"axe-core": "^4.12.1",
|
|
88
|
-
"chalk": "^
|
|
91
|
+
"chalk": "^6.0.0",
|
|
89
92
|
"commander": "^15.0.0",
|
|
90
93
|
"cosmiconfig": "^9.0.2",
|
|
91
|
-
"html-validate": "11.5.
|
|
94
|
+
"html-validate": "11.5.6",
|
|
92
95
|
"ora": "^9.4.1",
|
|
93
|
-
"puppeteer": "25.
|
|
94
|
-
"react": "^
|
|
95
|
-
"react-dom": "^
|
|
96
|
-
"ws": "^8.
|
|
96
|
+
"puppeteer": "25.4.0",
|
|
97
|
+
"react": "^19.2.8",
|
|
98
|
+
"react-dom": "^19.2.8",
|
|
99
|
+
"ws": "^8.21.1"
|
|
97
100
|
},
|
|
98
101
|
"devDependencies": {
|
|
99
102
|
"@types/cosmiconfig": "^6.0.3",
|
|
100
|
-
"@types/node": "^26.
|
|
103
|
+
"@types/node": "^26.1.1",
|
|
101
104
|
"@types/react": "^18.3.1 || ^19.0.0",
|
|
102
105
|
"@types/react-dom": "^18.3.1 || ^19.0.0",
|
|
103
106
|
"@types/ws": "^8.5.13",
|
|
104
107
|
"tsup": "^8.3.5",
|
|
105
108
|
"typescript": "^6.0.3",
|
|
106
|
-
"vitest": "^4.1.
|
|
109
|
+
"vitest": "^4.1.10"
|
|
107
110
|
}
|
|
108
111
|
}
|