@holmdigital/engine 3.0.2 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -90,6 +90,8 @@ var init_en = __esm({
90
90
  total_issues: "Total Issues",
91
91
  html_errors: "HTML Errors",
92
92
  detailed_violations: "Detailed Violations",
93
+ needs_review_title: "Needs review ({count})",
94
+ needs_review_note: "axe-core could not determine these automatically \u2014 verify them manually. They are not counted in the totals above.",
93
95
  prescriptive_fix: "\u{1F4A1} Prescriptive Fix",
94
96
  use: "Use",
95
97
  footer: "Generated by @holmdigital/engine v{version} \u2022 Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
@@ -115,6 +117,8 @@ var init_en = __esm({
115
117
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
116
118
  fallback_framing: "Technical finding. Ask your developer to review this:",
117
119
  occurrences: "{count} occurrences",
120
+ needs_review_heading: "Needs a human check ({count})",
121
+ needs_review_intro: "Automated tools couldn't decide these \u2014 a person should confirm them. They're not counted as barriers above.",
118
122
  gate_blocked: "Plain-language (klarspr\xE5k) output is not yet available in '{lang}'.",
119
123
  gate_supported: "Languages with klarspr\xE5k: {langs}.",
120
124
  gate_howto: "Run without --plain for the developer report, or use a supported language (e.g. --lang sv).",
@@ -172,6 +176,8 @@ var init_sv = __esm({
172
176
  total_issues: "Antal brister",
173
177
  html_errors: "HTML-fel",
174
178
  detailed_violations: "Detaljerade brister",
179
+ needs_review_title: "Beh\xF6ver granskas ({count})",
180
+ needs_review_note: "axe-core kunde inte avg\xF6ra dessa automatiskt \u2014 kontrollera dem manuellt. De r\xE4knas inte in i summorna ovan.",
175
181
  prescriptive_fix: "\u{1F4A1} Preskriptiv L\xF6sning",
176
182
  use: "Anv\xE4nd",
177
183
  footer: "Genererad av @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, DOS-lagen"
@@ -197,6 +203,8 @@ var init_sv = __esm({
197
203
  attribution: "Rapporten genererades av HolmDigital Engine, en del av HolmDigitals ekosystem f\xF6r tillg\xE4nglighet.",
198
204
  fallback_framing: "Tekniskt fynd som din utvecklare beh\xF6ver titta p\xE5.",
199
205
  occurrences: "{count} f\xF6rekomster",
206
+ needs_review_heading: "Beh\xF6ver en m\xE4nsklig kontroll ({count})",
207
+ needs_review_intro: "Automatiken kunde inte avg\xF6ra dessa \u2014 en m\xE4nniska b\xF6r bekr\xE4fta dem. De r\xE4knas inte som hinder ovan.",
200
208
  gate_blocked: "Klarspr\xE5k st\xF6ds \xE4nnu inte p\xE5 '{lang}'.",
201
209
  gate_supported: "Spr\xE5k med klarspr\xE5k: {langs}.",
202
210
  gate_howto: "K\xF6r utan --plain f\xF6r utvecklarrapporten, eller v\xE4lj ett spr\xE5k som st\xF6ds (t.ex. --lang sv).",
@@ -254,6 +262,8 @@ var init_de = __esm({
254
262
  total_issues: "Gesamtprobleme",
255
263
  html_errors: "HTML-Fehler",
256
264
  detailed_violations: "Detaillierte Verst\xF6\xDFe",
265
+ needs_review_title: "Muss gepr\xFCft werden ({count})",
266
+ needs_review_note: "axe-core konnte diese nicht automatisch bestimmen \u2014 bitte manuell pr\xFCfen. Sie werden oben nicht mitgez\xE4hlt.",
257
267
  prescriptive_fix: "\u{1F4A1} Vorschriftsm\xE4\xDFige L\xF6sung",
258
268
  use: "Verwenden",
259
269
  footer: "Generiert von @holmdigital/engine v{version} \u2022 Standards: WCAG 2.1 AA, EN 301 549, BITV 2.0"
@@ -279,6 +289,8 @@ var init_de = __esm({
279
289
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
280
290
  fallback_framing: "Technical finding. Ask your developer to review this:",
281
291
  occurrences: "{count} occurrences",
292
+ needs_review_heading: "Braucht eine menschliche Pr\xFCfung ({count})",
293
+ needs_review_intro: "Automatische Werkzeuge konnten dies nicht entscheiden \u2014 eine Person sollte es best\xE4tigen. Sie z\xE4hlen oben nicht als Barrieren.",
282
294
  gate_blocked: "Verst\xE4ndliche Sprache (Klarspr\xE5k) ist f\xFCr '{lang}' noch nicht verf\xFCgbar.",
283
295
  gate_supported: "Sprachen mit verst\xE4ndlicher Sprache: {langs}.",
284
296
  gate_howto: "Ohne --plain ausf\xFChren f\xFCr den Entwicklerbericht, oder eine unterst\xFCtzte Sprache verwenden (z. B. --lang sv).",
@@ -336,6 +348,8 @@ var init_fr = __esm({
336
348
  total_issues: "Total des Probl\xE8mes",
337
349
  html_errors: "Erreurs HTML",
338
350
  detailed_violations: "Violations D\xE9taill\xE9es",
351
+ needs_review_title: "\xC0 v\xE9rifier ({count})",
352
+ needs_review_note: "axe-core n'a pas pu les d\xE9terminer automatiquement \u2014 v\xE9rifiez-les manuellement. Ils ne sont pas compt\xE9s dans les totaux ci-dessus.",
339
353
  prescriptive_fix: "\u{1F4A1} Solution Prescriptive",
340
354
  use: "Utiliser",
341
355
  footer: "G\xE9n\xE9r\xE9 par @holmdigital/engine v{version} \u2022 Standards : WCAG 2.1 AA, EN 301 549, RGAA"
@@ -361,6 +375,8 @@ var init_fr = __esm({
361
375
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
362
376
  fallback_framing: "Technical finding. Ask your developer to review this:",
363
377
  occurrences: "{count} occurrences",
378
+ needs_review_heading: "N\xE9cessite une v\xE9rification humaine ({count})",
379
+ needs_review_intro: "Les outils automatiques n'ont pas pu trancher \u2014 une personne devrait le confirmer. Ils ne sont pas compt\xE9s comme des obstacles ci-dessus.",
364
380
  gate_blocked: "Le langage clair (klarspr\xE5k) n'est pas encore disponible en \xAB {lang} \xBB.",
365
381
  gate_supported: "Langues avec langage clair : {langs}.",
366
382
  gate_howto: "Lancez sans --plain pour le rapport d\xE9veloppeur, ou utilisez une langue prise en charge (par ex. --lang sv).",
@@ -418,6 +434,8 @@ var init_es = __esm({
418
434
  total_issues: "Problemas Totales",
419
435
  html_errors: "Errores HTML",
420
436
  detailed_violations: "Violaciones Detalladas",
437
+ needs_review_title: "Requiere revisi\xF3n ({count})",
438
+ needs_review_note: "axe-core no pudo determinarlos autom\xE1ticamente \u2014 verif\xEDcalos manualmente. No se cuentan en los totales anteriores.",
421
439
  prescriptive_fix: "\u{1F4A1} Soluci\xF3n Prescriptiva",
422
440
  use: "Usar",
423
441
  footer: "Generado por @holmdigital/engine v{version} \u2022 Est\xE1ndares: WCAG 2.1 AA, EN 301 549, UNE 139803"
@@ -443,6 +461,8 @@ var init_es = __esm({
443
461
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
444
462
  fallback_framing: "Technical finding. Ask your developer to review this:",
445
463
  occurrences: "{count} occurrences",
464
+ needs_review_heading: "Necesita una revisi\xF3n humana ({count})",
465
+ needs_review_intro: "Las herramientas autom\xE1ticas no pudieron decidirlo \u2014 una persona deber\xEDa confirmarlo. No se cuentan como barreras arriba.",
446
466
  gate_blocked: "El lenguaje claro (klarspr\xE5k) a\xFAn no est\xE1 disponible en '{lang}'.",
447
467
  gate_supported: "Idiomas con lenguaje claro: {langs}.",
448
468
  gate_howto: "Ejecuta sin --plain para el informe para desarrolladores, o usa un idioma compatible (p. ej. --lang sv).",
@@ -500,6 +520,8 @@ var init_fi = __esm({
500
520
  total_issues: "Ongelmat yhteens\xE4",
501
521
  html_errors: "HTML-virheet",
502
522
  detailed_violations: "Yksityiskohtaiset rikkomukset",
523
+ needs_review_title: "Vaatii tarkistuksen ({count})",
524
+ needs_review_note: "axe-core ei voinut m\xE4\xE4ritt\xE4\xE4 n\xE4it\xE4 automaattisesti \u2014 tarkista ne manuaalisesti. Niit\xE4 ei lasketa yll\xE4 oleviin summiin.",
503
525
  prescriptive_fix: "\u{1F4A1} Ehdotettu korjaus",
504
526
  use: "K\xE4yt\xE4",
505
527
  footer: "Luonut @holmdigital/engine v{version} \u2022 Standardit: WCAG 2.1 AA, EN 301 549, Digipalvelulaki"
@@ -525,6 +547,8 @@ var init_fi = __esm({
525
547
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
526
548
  fallback_framing: "Technical finding. Ask your developer to review this:",
527
549
  occurrences: "{count} occurrences",
550
+ needs_review_heading: "Vaatii ihmisen tarkistuksen ({count})",
551
+ needs_review_intro: "Automaattiset ty\xF6kalut eiv\xE4t voineet p\xE4\xE4tt\xE4\xE4 n\xE4it\xE4 \u2014 ihmisen tulisi vahvistaa ne. Niit\xE4 ei lasketa esteiksi yll\xE4.",
528
552
  gate_blocked: "Selkokielinen (klarspr\xE5k) raportti ei ole viel\xE4 saatavilla kielell\xE4 '{lang}'.",
529
553
  gate_supported: "Kielet, joilla selkokielinen raportti on saatavilla: {langs}.",
530
554
  gate_howto: "Aja ilman --plain-valitsinta kehitt\xE4j\xE4raporttia varten tai k\xE4yt\xE4 tuettua kielt\xE4 (esim. --lang sv).",
@@ -582,6 +606,8 @@ var init_dk = __esm({
582
606
  total_issues: "Totale Fejl",
583
607
  html_errors: "HTML Fejl",
584
608
  detailed_violations: "Detaljerede Overtr\xE6delser",
609
+ needs_review_title: "Skal gennemg\xE5s ({count})",
610
+ needs_review_note: "axe-core kunne ikke afg\xF8re disse automatisk \u2014 kontroll\xE9r dem manuelt. De t\xE6lles ikke med i totalerne ovenfor.",
585
611
  prescriptive_fix: "\u{1F4A1} Foresl\xE5et L\xF8sning",
586
612
  use: "Brug",
587
613
  footer: "Genereret af @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Lov om tilg\xE6ngelighed"
@@ -607,6 +633,8 @@ var init_dk = __esm({
607
633
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
608
634
  fallback_framing: "Technical finding. Ask your developer to review this:",
609
635
  occurrences: "{count} occurrences",
636
+ needs_review_heading: "Kr\xE6ver et menneskeligt tjek ({count})",
637
+ needs_review_intro: "Automatiske v\xE6rkt\xF8jer kunne ikke afg\xF8re disse \u2014 en person b\xF8r bekr\xE6fte dem. De t\xE6lles ikke som barrierer ovenfor.",
610
638
  gate_blocked: "Klarsprog (klarspr\xE5k) er endnu ikke tilg\xE6ngeligt p\xE5 '{lang}'.",
611
639
  gate_supported: "Sprog med klarsprog: {langs}.",
612
640
  gate_howto: "K\xF8r uden --plain for udviklerrapporten, eller brug et underst\xF8ttet sprog (f.eks. --lang sv).",
@@ -664,6 +692,8 @@ var init_no = __esm({
664
692
  total_issues: "Totale Feil",
665
693
  html_errors: "HTML Feil",
666
694
  detailed_violations: "Detaljerte Brudd",
695
+ needs_review_title: "M\xE5 gjennomg\xE5s ({count})",
696
+ needs_review_note: "axe-core kunne ikke avgj\xF8re disse automatisk \u2014 kontroller dem manuelt. De telles ikke med i totalene ovenfor.",
667
697
  prescriptive_fix: "\u{1F4A1} Foresl\xE5tt L\xF8sning",
668
698
  use: "Bruk",
669
699
  footer: "Generert av @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Uu-tilsynet"
@@ -689,6 +719,8 @@ var init_no = __esm({
689
719
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
690
720
  fallback_framing: "Technical finding. Ask your developer to review this:",
691
721
  occurrences: "{count} occurrences",
722
+ needs_review_heading: "Trenger en menneskelig sjekk ({count})",
723
+ needs_review_intro: "Automatiske verkt\xF8y kunne ikke avgj\xF8re disse \u2014 en person b\xF8r bekrefte dem. De telles ikke som barrierer ovenfor.",
692
724
  gate_blocked: "Klarspr\xE5k er enn\xE5 ikke tilgjengelig p\xE5 '{lang}'.",
693
725
  gate_supported: "Spr\xE5k med klarspr\xE5k: {langs}.",
694
726
  gate_howto: "Kj\xF8r uten --plain for utviklerrapporten, eller bruk et st\xF8ttet spr\xE5k (f.eks. --lang sv).",
@@ -746,6 +778,8 @@ var init_nl = __esm({
746
778
  total_issues: "Totaal aantal problemen",
747
779
  html_errors: "HTML-fouten",
748
780
  detailed_violations: "Gedetailleerde overtredingen",
781
+ needs_review_title: "Moet worden gecontroleerd ({count})",
782
+ needs_review_note: "axe-core kon deze niet automatisch bepalen \u2014 controleer ze handmatig. Ze worden hierboven niet meegeteld.",
749
783
  prescriptive_fix: "\u{1F4A1} Voorgeschreven oplossing",
750
784
  use: "Gebruik",
751
785
  footer: "Gegenereerd door @holmdigital/engine v{version} \u2022 Standaarden: WCAG 2.1 AA, EN 301 549, Besluit digitale toegankelijkheid overheid"
@@ -771,6 +805,8 @@ var init_nl = __esm({
771
805
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
772
806
  fallback_framing: "Technical finding. Ask your developer to review this:",
773
807
  occurrences: "{count} occurrences",
808
+ needs_review_heading: "Heeft een menselijke controle nodig ({count})",
809
+ needs_review_intro: "Automatische tools konden dit niet bepalen \u2014 een persoon moet het bevestigen. Ze tellen hierboven niet als drempels.",
774
810
  gate_blocked: "Begrijpelijke taal (klarspr\xE5k) is nog niet beschikbaar in '{lang}'.",
775
811
  gate_supported: "Talen met begrijpelijke taal: {langs}.",
776
812
  gate_howto: "Voer uit zonder --plain voor het ontwikkelaarsrapport, of gebruik een ondersteunde taal (bijv. --lang sv).",
@@ -875,6 +911,7 @@ __export(index_exports, {
875
911
  getCurrentLang: () => getCurrentLang,
876
912
  getEngineVersion: () => getEngineVersion,
877
913
  probeWithoutJavaScript: () => probeWithoutJavaScript,
914
+ resolveNationalLawReference: () => resolveNationalLawReference,
878
915
  setLanguage: () => setLanguage,
879
916
  t: () => t
880
917
  });
@@ -1083,7 +1120,7 @@ async function probeWithoutJavaScript(browser, options) {
1083
1120
  // src/core/regulatory-scanner.ts
1084
1121
  var import_node_fs = require("fs");
1085
1122
  function getEngineVersion() {
1086
- return "3.0.2";
1123
+ return "3.1.1";
1087
1124
  }
1088
1125
  function getStandardsVersion() {
1089
1126
  try {
@@ -1205,12 +1242,14 @@ var RegulatoryScanner = class {
1205
1242
  this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
1206
1243
  passedCount = axeResults.passes?.length || 0;
1207
1244
  const regulatoryReports = this.options.light ? await this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
1245
+ const incompleteReports = await this.enrichIncomplete(axeResults);
1246
+ const allReports = [...regulatoryReports, ...incompleteReports];
1208
1247
  let noScript;
1209
1248
  if (this.options.noScriptCheck) {
1210
1249
  noScript = await this.runNoScriptCheck(textLengthWithJs ?? 0);
1211
1250
  }
1212
1251
  const scanDuration = Date.now() - startTime;
1213
- const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
1252
+ const result = this.generateResultPackage(allReports, passedCount, scanDuration, pageTitle, pageLanguage);
1214
1253
  if (htmlValidation) {
1215
1254
  result.htmlValidation = htmlValidation;
1216
1255
  }
@@ -1420,14 +1459,96 @@ var RegulatoryScanner = class {
1420
1459
  }
1421
1460
  return reports;
1422
1461
  }
1462
+ /**
1463
+ * KRAV-3 (Intern #12): bär axes `incomplete` vidare som "needs review"-poster
1464
+ * (internt `cantTell`). axe kunde inte avgöra pass/fail, så en människa måste
1465
+ * kontrollera. Poster märks `cantTell` och exkluderas ur stats/score/
1466
+ * complianceStatus i generateResultPackage — men tappas aldrig tyst.
1467
+ *
1468
+ * Skälet läses ur nodens check-data (`message` + `messageKey`), t.ex.
1469
+ * `bgOverlap` = bakgrunden kunde inte bestämmas. Ett `contrastRatio: 0` som
1470
+ * följer med i det fallet är INTE en uppmätt nollkontrast, så vi bär
1471
+ * skäl-texten, aldrig ett hopfabricerat mätvärde (Intern #20).
1472
+ */
1473
+ async enrichIncomplete(axeResults) {
1474
+ const incomplete = axeResults.incomplete;
1475
+ if (!incomplete || incomplete.length === 0) return [];
1476
+ const reports = [];
1477
+ const { generateRegulatoryReport, getConvergenceRule } = await import("@holmdigital/standards");
1478
+ const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
1479
+ const lang = getCurrentLang2();
1480
+ const readMessageKey = (checks) => checks?.find((c) => c.data && typeof c.data === "object" && "messageKey" in c.data) ?? checks?.[0];
1481
+ for (const item of incomplete) {
1482
+ const nodeInfos = item.nodes.map((node) => {
1483
+ const c = readMessageKey(node.any);
1484
+ const data = c?.data && typeof c.data === "object" ? c.data : void 0;
1485
+ const messageKey = data && typeof data.messageKey === "string" ? data.messageKey : void 0;
1486
+ const concerning = !!data && ("expectedContrastRatio" in data || "contrastRatio" in data);
1487
+ return {
1488
+ html: node.html,
1489
+ target: node.target.join(" "),
1490
+ // axes egen check-message (VARFÖR den inte kunde avgöras).
1491
+ // Aldrig ett kontrastvärde — i bgOverlap-fallet finns inget uppmätt.
1492
+ failureSummary: c?.message ?? node.failureSummary ?? item.help,
1493
+ messageKey,
1494
+ concerning
1495
+ };
1496
+ });
1497
+ const ordered = nodeInfos.map((n, i) => ({ n, i })).sort((a, b) => Number(b.n.concerning) - Number(a.n.concerning) || a.i - b.i).map((x) => x.n);
1498
+ const reviewReason = (ordered.find((n) => n.concerning) ?? ordered[0])?.messageKey;
1499
+ const failingNodes = ordered.slice(0, 3).map((n) => ({
1500
+ html: n.html,
1501
+ target: n.target,
1502
+ failureSummary: n.failureSummary
1503
+ }));
1504
+ const reasoning = failingNodes[0]?.failureSummary ?? item.help;
1505
+ const base = generateRegulatoryReport(item.id, lang);
1506
+ if (base) {
1507
+ const fullRule = getConvergenceRule(base.ruleId, lang);
1508
+ reports.push({
1509
+ ...base,
1510
+ cantTell: true,
1511
+ reviewReason,
1512
+ holmdigitalInsight: { ...base.holmdigitalInsight, reasoning },
1513
+ legalContext: fullRule?.legalContext,
1514
+ failingNodes
1515
+ });
1516
+ } else {
1517
+ reports.push({
1518
+ ruleId: item.id,
1519
+ wcagCriteria: item.tags.find((t2) => t2.startsWith("wcag")) || "Unknown",
1520
+ en301549Criteria: "",
1521
+ dosLagenReference: "",
1522
+ diggRisk: "medium",
1523
+ eaaImpact: "medium",
1524
+ remediation: { description: item.help, technicalGuidance: item.description, component: void 0 },
1525
+ holmdigitalInsight: {
1526
+ diggRisk: "medium",
1527
+ eaaImpact: "medium",
1528
+ reasoning,
1529
+ swedishInterpretation: "",
1530
+ priorityRationale: ""
1531
+ },
1532
+ testability: { automated: false, requiresManualCheck: true, pseudoAutomation: false, complexity: "moderate" },
1533
+ cantTell: true,
1534
+ reviewReason,
1535
+ failingNodes
1536
+ });
1537
+ }
1538
+ }
1539
+ return reports;
1540
+ }
1423
1541
  generateResultPackage(reports, passedCount, scanDuration, pageTitle, pageLanguage) {
1542
+ const scored = reports.filter((r) => !r.cantTell);
1543
+ const needsReview = reports.length - scored.length;
1424
1544
  const stats = {
1425
1545
  passed: passedCount,
1426
- critical: reports.filter((r) => r.holmdigitalInsight.diggRisk === "critical").length,
1427
- high: reports.filter((r) => r.holmdigitalInsight.diggRisk === "high").length,
1428
- medium: reports.filter((r) => r.holmdigitalInsight.diggRisk === "medium").length,
1429
- low: reports.filter((r) => r.holmdigitalInsight.diggRisk === "low").length,
1430
- total: reports.length
1546
+ critical: scored.filter((r) => r.holmdigitalInsight.diggRisk === "critical").length,
1547
+ high: scored.filter((r) => r.holmdigitalInsight.diggRisk === "high").length,
1548
+ medium: scored.filter((r) => r.holmdigitalInsight.diggRisk === "medium").length,
1549
+ low: scored.filter((r) => r.holmdigitalInsight.diggRisk === "low").length,
1550
+ total: scored.length,
1551
+ needsReview
1431
1552
  };
1432
1553
  const weightedScore = stats.critical * 25 + // Critical violations are severe
1433
1554
  stats.high * 15 + // High risk affects usability significantly
@@ -1458,7 +1579,7 @@ var RegulatoryScanner = class {
1458
1579
  pageTitle,
1459
1580
  pageLanguage
1460
1581
  };
1461
- const reportsWithContext = reports.filter((r) => r.legalContext);
1582
+ const reportsWithContext = scored.filter((r) => r.legalContext);
1462
1583
  const legalSummary = {
1463
1584
  wadApplicable: reportsWithContext.filter(
1464
1585
  (r) => r.legalContext?.appliesTo?.includes("WAD")
@@ -1584,6 +1705,11 @@ function generateBadgeUrl(score) {
1584
1705
  return `${BADGE_BASE_URL}-100%25-${BADGE_COLOR}?style=flat-square`;
1585
1706
  }
1586
1707
 
1708
+ // src/reporting/needs-review.ts
1709
+ init_cjs_shims();
1710
+ var isNeedsReview = (report) => report.cantTell === true;
1711
+ var violationsOf = (reports) => reports.filter((r) => !isNeedsReview(r));
1712
+
1587
1713
  // src/reporting/statement-generator.ts
1588
1714
  var EVALUATION_METHOD = {
1589
1715
  sv: "Automatiserad granskning via @holmdigital/engine",
@@ -1642,6 +1768,42 @@ var RESPONSE_TIME_DEFAULT = {
1642
1768
  "en-ca": "2 days",
1643
1769
  "en-au": "2 days"
1644
1770
  };
1771
+ var NATIONAL_LAW_FALLBACK = {
1772
+ en: "applicable accessibility requirements",
1773
+ sv: "g\xE4llande tillg\xE4nglighetskrav",
1774
+ no: "gjeldende tilgjengelighetskrav",
1775
+ da: "g\xE6ldende tilg\xE6ngelighedskrav",
1776
+ fi: "sovellettavat saavutettavuusvaatimukset",
1777
+ de: "die geltenden Barrierefreiheitsanforderungen",
1778
+ nl: "de geldende toegankelijkheidseisen",
1779
+ fr: "la r\xE9glementation d'accessibilit\xE9 applicable",
1780
+ es: "los requisitos de accesibilidad aplicables",
1781
+ it: "i requisiti di accessibilit\xE0 applicabili",
1782
+ pt: "os requisitos de acessibilidade aplic\xE1veis",
1783
+ pl: "obowi\u0105zuj\u0105ce wymagania dost\u0119pno\u015Bci"
1784
+ };
1785
+ function resolveNationalLawReference(country, sector, lang = "en") {
1786
+ if (country === "AU") {
1787
+ const ddaLaw = (0, import_standards.getNationalLawByFramework)("DDA", "AU");
1788
+ return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
1789
+ }
1790
+ if (country === "US") {
1791
+ const usLaws = (0, import_standards.getNationalLaws)("US");
1792
+ const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
1793
+ if (adaLaw) {
1794
+ if (sector === "public") {
1795
+ const s508 = usLaws.find((l) => l.id === "us-508");
1796
+ return s508 ? `${adaLaw.fullName} (${adaLaw.law}) & ${s508.fullName} (${s508.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1797
+ }
1798
+ const hhs504 = usLaws.find((l) => l.euFramework === "REHAB" && l.scope === "private");
1799
+ return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1800
+ }
1801
+ }
1802
+ const law = (0, import_standards.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
1803
+ if (law) return `${law.fullName} (${law.law})`;
1804
+ const langKey = lang.split("-")[0];
1805
+ return NATIONAL_LAW_FALLBACK[langKey] ?? NATIONAL_LAW_FALLBACK.en;
1806
+ }
1645
1807
  async function generateStatementContent(result, lang = "en", format = "html", metadata) {
1646
1808
  const templatePath = import_path.default.join(__dirname, "templates", `${lang}.json`);
1647
1809
  let template;
@@ -1660,7 +1822,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1660
1822
  complianceLevel = "partial";
1661
1823
  }
1662
1824
  const issuesMap = /* @__PURE__ */ new Map();
1663
- result.reports.forEach((report) => {
1825
+ violationsOf(result.reports).forEach((report) => {
1664
1826
  if (!issuesMap.has(report.ruleId)) {
1665
1827
  const issueText = `${report.ruleId} (${report.wcagCriteria})`;
1666
1828
  issuesMap.set(report.ruleId, issueText);
@@ -1837,26 +1999,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1837
1999
  }
1838
2000
  return (0, import_standards.getEnforcementBody)(country, sector);
1839
2001
  })(),
1840
- "{<national_law>}": (() => {
1841
- if (country === "AU") {
1842
- const ddaLaw = (0, import_standards.getNationalLawByFramework)("DDA", "AU");
1843
- return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
1844
- }
1845
- if (country === "US") {
1846
- const usLaws = (0, import_standards.getNationalLaws)("US");
1847
- const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
1848
- if (adaLaw) {
1849
- if (sector === "public") {
1850
- const s508 = usLaws.find((l) => l.id === "us-508");
1851
- return s508 ? `${adaLaw.fullName} (${adaLaw.law}) & ${s508.fullName} (${s508.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1852
- }
1853
- const hhs504 = usLaws.find((l) => l.euFramework === "REHAB" && l.scope === "private");
1854
- return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1855
- }
1856
- }
1857
- const law = (0, import_standards.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
1858
- return law ? `${law.fullName} (${law.law})` : "";
1859
- })(),
2002
+ "{<national_law>}": resolveNationalLawReference(country, sector, lang),
1860
2003
  "{<ahrc_url>}": "https://www.humanrights.gov.au/complaints",
1861
2004
  "{<brister>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "sv" ? "Inga k\xE4nda brister." : "No known issues.",
1862
2005
  "{<puutteet>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fi" ? "Ei tiedossa olevia puutteita." : "No known issues.",
@@ -1934,6 +2077,7 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
1934
2077
  getCurrentLang,
1935
2078
  getEngineVersion,
1936
2079
  probeWithoutJavaScript,
2080
+ resolveNationalLawReference,
1937
2081
  setLanguage,
1938
2082
  t
1939
2083
  });
package/dist/index.mjs CHANGED
@@ -8,13 +8,15 @@ import {
8
8
  generateStatement,
9
9
  generateStatementContent,
10
10
  getEngineVersion,
11
- probeWithoutJavaScript
12
- } from "./chunk-VF73LLSO.mjs";
11
+ probeWithoutJavaScript,
12
+ resolveNationalLawReference
13
+ } from "./chunk-356E3K2G.mjs";
13
14
  import {
14
15
  getCurrentLang,
15
16
  setLanguage,
16
17
  t
17
- } from "./chunk-QUCGL754.mjs";
18
+ } from "./chunk-RNCZ2GNY.mjs";
19
+ import "./chunk-QEHLOWUK.mjs";
18
20
  import "./chunk-DIBTSSLZ.mjs";
19
21
  export {
20
22
  NOSCRIPT_EMPTY_THRESHOLD,
@@ -28,6 +30,7 @@ export {
28
30
  getCurrentLang,
29
31
  getEngineVersion,
30
32
  probeWithoutJavaScript,
33
+ resolveNationalLawReference,
31
34
  setLanguage,
32
35
  t
33
36
  };
@@ -1,3 +1,7 @@
1
+ import {
2
+ needsReviewOf,
3
+ violationsOf
4
+ } from "./chunk-QEHLOWUK.mjs";
1
5
  import "./chunk-DIBTSSLZ.mjs";
2
6
 
3
7
  // src/reporting/junit-generator.ts
@@ -5,12 +9,15 @@ function generateJUnitXML(result) {
5
9
  const { url, reports, stats, metadata } = result;
6
10
  const duration = metadata.scanDuration;
7
11
  const timestamp = result.timestamp;
8
- const totalTests = stats.passed + stats.total;
12
+ const violations = violationsOf(reports);
13
+ const needsReview = needsReviewOf(reports);
14
+ const totalTests = stats.passed + stats.total + stats.needsReview;
9
15
  const failures = stats.total;
16
+ const skipped = stats.needsReview;
10
17
  const xmlLines = [
11
18
  `<?xml version="1.0" encoding="UTF-8"?>`,
12
19
  `<testsuites name="HolmDigital Accessibility Scan" time="${duration / 1e3}" tests="${totalTests}" failures="${failures}">`,
13
- ` <testsuite name="${url}" tests="${totalTests}" failures="${failures}" errors="0" time="${duration / 1e3}" timestamp="${timestamp}">`,
20
+ ` <testsuite name="${url}" tests="${totalTests}" failures="${failures}" skipped="${skipped}" errors="0" time="${duration / 1e3}" timestamp="${timestamp}">`,
14
21
  ` <properties>`,
15
22
  ` <property name="engineVersion" value="${metadata.engineVersion}"/>`,
16
23
  ` <property name="axeCoreVersion" value="${metadata.axeCoreVersion}"/>`,
@@ -24,7 +31,7 @@ function generateJUnitXML(result) {
24
31
  for (let i = 0; i < stats.passed; i++) {
25
32
  xmlLines.push(` <testcase name="Passed Accessibility Rule ${i + 1}" classname="Accessibility.Success" time="0" />`);
26
33
  }
27
- reports.forEach((report) => {
34
+ violations.forEach((report) => {
28
35
  const severity = report.holmdigitalInsight.diggRisk;
29
36
  const message = escapeXML(report.holmdigitalInsight.reasoning);
30
37
  const criteria = `WCAG ${report.wcagCriteria} | EN 301 549 ${report.en301549Criteria}`;
@@ -49,6 +56,12 @@ ${escapeXML(help)}</failure>`);
49
56
  }
50
57
  xmlLines.push(` </testcase>`);
51
58
  });
59
+ needsReview.forEach((report) => {
60
+ const message = escapeXML(report.holmdigitalInsight.reasoning);
61
+ xmlLines.push(` <testcase name="[NEEDS REVIEW] ${report.ruleId}" classname="${report.wcagCriteria}" time="0">`);
62
+ xmlLines.push(` <skipped message="${message}"/>`);
63
+ xmlLines.push(` </testcase>`);
64
+ });
52
65
  xmlLines.push(` </testsuite>`);
53
66
  xmlLines.push(`</testsuites>`);
54
67
  return xmlLines.join("\n");
@@ -7,7 +7,11 @@ import {
7
7
  getCurrentLang,
8
8
  setLanguage,
9
9
  t
10
- } from "./chunk-QUCGL754.mjs";
10
+ } from "./chunk-RNCZ2GNY.mjs";
11
+ import {
12
+ needsReviewOf,
13
+ violationsOf
14
+ } from "./chunk-QEHLOWUK.mjs";
11
15
  import "./chunk-DIBTSSLZ.mjs";
12
16
 
13
17
  // src/reporting/plain-report.ts
@@ -45,26 +49,30 @@ function renderPlainReport(result, lang = "en", plainFallbackFrom) {
45
49
  console.log(chalk.yellow(t("plain.gate_fallback", { lang: languageDisplayName(plainFallbackFrom) })));
46
50
  console.log("");
47
51
  }
48
- if (result.reports.length === 0) {
52
+ const violations = violationsOf(result.reports);
53
+ const needsReview = needsReviewOf(result.reports);
54
+ if (violations.length === 0 && needsReview.length === 0) {
49
55
  console.log(t("plain.empty_state"));
50
56
  console.log("");
51
57
  console.log(t("plain.attribution"));
52
58
  return;
53
59
  }
54
- const sortedGroups = groupReportsByRule(result.reports).sort((a, b) => {
60
+ const sortedGroups = groupReportsByRule(violations).sort((a, b) => {
55
61
  const aLevel = IMPACT_ORDER[levelOf(a.report)] ?? 4;
56
62
  const bLevel = IMPACT_ORDER[levelOf(b.report)] ?? 4;
57
63
  return aLevel - bLevel;
58
64
  });
59
- const count = result.reports.length;
65
+ const count = violations.length;
60
66
  const unit = count === 1 ? t("plain.intro_unit_singular") : t("plain.intro_unit_plural");
61
- const breakdown = impactBreakdown(result.reports, levelOf, IMPACT_ORDER);
67
+ const breakdown = impactBreakdown(violations, levelOf, IMPACT_ORDER);
62
68
  const breakdownText = breakdown.map((b) => `${b.count} ${t(BADGE_KEY[b.level])}`).join(", ");
63
- console.log(t("plain.intro_framing"));
64
- console.log(t("plain.intro_found", { count, unit }));
65
- console.log(`${count} ${unit}: ${breakdownText}`);
66
- console.log(t("plain.sorted_by"));
67
- console.log("");
69
+ if (violations.length > 0) {
70
+ console.log(t("plain.intro_framing"));
71
+ console.log(t("plain.intro_found", { count, unit }));
72
+ console.log(`${count} ${unit}: ${breakdownText}`);
73
+ console.log(t("plain.sorted_by"));
74
+ console.log("");
75
+ }
68
76
  const isSwedish = getCurrentLang() === "sv";
69
77
  sortedGroups.forEach((group, index) => {
70
78
  const report = group.report;
@@ -86,6 +94,16 @@ function renderPlainReport(result, lang = "en", plainFallbackFrom) {
86
94
  }
87
95
  console.log("");
88
96
  });
97
+ if (needsReview.length > 0) {
98
+ console.log(t("plain.needs_review_heading", { count: needsReview.length }));
99
+ console.log(t("plain.needs_review_intro"));
100
+ needsReview.forEach((report) => {
101
+ const pl = report.plainLanguage;
102
+ const heading = pl?.headline ? `${pl.headline} (${report.ruleId})` : report.ruleId;
103
+ console.log(`- ${heading}`);
104
+ });
105
+ console.log("");
106
+ }
89
107
  console.log(t("plain.closing"));
90
108
  console.log("");
91
109
  console.log(t("plain.attribution"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holmdigital/engine",
3
- "version": "3.0.2",
3
+ "version": "3.1.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -86,7 +86,7 @@
86
86
  },
87
87
  "dependencies": {
88
88
  "@holmdigital/components": "^4.0.0",
89
- "@holmdigital/standards": "^3.0.1",
89
+ "@holmdigital/standards": "^3.0.2",
90
90
  "axe-core": "^4.13.0",
91
91
  "chalk": "^6.0.0",
92
92
  "commander": "^15.0.0",