@holmdigital/engine 2.6.1 → 2.8.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.
@@ -55,7 +55,8 @@ var en_default = {
55
55
  report_title: "Accessibility report for {url}",
56
56
  report_tagline: "Accessibility report",
57
57
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
58
- fallback_framing: "Technical finding. Ask your developer to review this:"
58
+ fallback_framing: "Technical finding. Ask your developer to review this:",
59
+ occurrences: "{count} occurrences"
59
60
  }
60
61
  };
61
62
 
@@ -116,7 +117,8 @@ var sv_default = {
116
117
  report_title: "Tillg\xE4nglighetsrapport f\xF6r {url}",
117
118
  report_tagline: "Tillg\xE4nglighetsrapport",
118
119
  attribution: "Rapporten genererades av HolmDigital Engine, en del av HolmDigitals ekosystem f\xF6r tillg\xE4nglighet.",
119
- fallback_framing: "Tekniskt fynd. Be er utvecklare titta p\xE5 detta:"
120
+ fallback_framing: "Tekniskt fynd som din utvecklare beh\xF6ver titta p\xE5.",
121
+ occurrences: "{count} f\xF6rekomster"
120
122
  }
121
123
  };
122
124
 
@@ -177,7 +179,8 @@ var de_default = {
177
179
  report_title: "Accessibility report for {url}",
178
180
  report_tagline: "Accessibility report",
179
181
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
180
- fallback_framing: "Technical finding. Ask your developer to review this:"
182
+ fallback_framing: "Technical finding. Ask your developer to review this:",
183
+ occurrences: "{count} occurrences"
181
184
  }
182
185
  };
183
186
 
@@ -238,7 +241,8 @@ var fr_default = {
238
241
  report_title: "Accessibility report for {url}",
239
242
  report_tagline: "Accessibility report",
240
243
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
241
- fallback_framing: "Technical finding. Ask your developer to review this:"
244
+ fallback_framing: "Technical finding. Ask your developer to review this:",
245
+ occurrences: "{count} occurrences"
242
246
  }
243
247
  };
244
248
 
@@ -299,7 +303,8 @@ var es_default = {
299
303
  report_title: "Accessibility report for {url}",
300
304
  report_tagline: "Accessibility report",
301
305
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
302
- fallback_framing: "Technical finding. Ask your developer to review this:"
306
+ fallback_framing: "Technical finding. Ask your developer to review this:",
307
+ occurrences: "{count} occurrences"
303
308
  }
304
309
  };
305
310
 
@@ -360,7 +365,8 @@ var fi_default = {
360
365
  report_title: "Accessibility report for {url}",
361
366
  report_tagline: "Accessibility report",
362
367
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
363
- fallback_framing: "Technical finding. Ask your developer to review this:"
368
+ fallback_framing: "Technical finding. Ask your developer to review this:",
369
+ occurrences: "{count} occurrences"
364
370
  }
365
371
  };
366
372
 
@@ -421,7 +427,8 @@ var dk_default = {
421
427
  report_title: "Accessibility report for {url}",
422
428
  report_tagline: "Accessibility report",
423
429
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
424
- fallback_framing: "Technical finding. Ask your developer to review this:"
430
+ fallback_framing: "Technical finding. Ask your developer to review this:",
431
+ occurrences: "{count} occurrences"
425
432
  }
426
433
  };
427
434
 
@@ -482,7 +489,8 @@ var no_default = {
482
489
  report_title: "Accessibility report for {url}",
483
490
  report_tagline: "Accessibility report",
484
491
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
485
- fallback_framing: "Technical finding. Ask your developer to review this:"
492
+ fallback_framing: "Technical finding. Ask your developer to review this:",
493
+ occurrences: "{count} occurrences"
486
494
  }
487
495
  };
488
496
 
@@ -543,7 +551,8 @@ var nl_default = {
543
551
  report_title: "Accessibility report for {url}",
544
552
  report_tagline: "Accessibility report",
545
553
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
546
- fallback_framing: "Technical finding. Ask your developer to review this:"
554
+ fallback_framing: "Technical finding. Ask your developer to review this:",
555
+ occurrences: "{count} occurrences"
547
556
  }
548
557
  };
549
558
 
@@ -138,7 +138,7 @@ var HtmlValidator = class {
138
138
  // src/core/regulatory-scanner.ts
139
139
  import { readFileSync } from "fs";
140
140
  function getEngineVersion() {
141
- return "2.6.1";
141
+ return "2.8.0";
142
142
  }
143
143
  function getStandardsVersion() {
144
144
  try {
@@ -160,6 +160,8 @@ var RegulatoryScanner = class {
160
160
  // Default till striktaste
161
161
  silent: false,
162
162
  invalidHttpsCert: false,
163
+ waitForHydrationMs: 2500,
164
+ // Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
163
165
  ...options
164
166
  };
165
167
  this.htmlValidator = new HtmlValidator();
@@ -208,6 +210,11 @@ var RegulatoryScanner = class {
208
210
  } catch {
209
211
  this.log("Network busy, proceeding with scan anyway...");
210
212
  }
213
+ const hydrationWait = this.options.waitForHydrationMs ?? 0;
214
+ if (hydrationWait > 0) {
215
+ this.log(`V\xE4ntar ${hydrationWait} ms p\xE5 hydrering...`);
216
+ await new Promise((resolve) => setTimeout(resolve, hydrationWait));
217
+ }
211
218
  pageTitle = await page.title();
212
219
  pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
213
220
  let htmlValidation;
@@ -323,7 +330,7 @@ var RegulatoryScanner = class {
323
330
  async enrichResults(axeResults) {
324
331
  const reports = [];
325
332
  const { searchRulesByTags, generateRegulatoryReport, getConvergenceRule } = await import("@holmdigital/standards");
326
- const { getCurrentLang } = await import("./i18n-SE7FLXIF.mjs");
333
+ const { getCurrentLang } = await import("./i18n-VUB5WFVC.mjs");
327
334
  const lang = getCurrentLang();
328
335
  for (const violation of axeResults.violations) {
329
336
  let report = generateRegulatoryReport(violation.id, lang);
@@ -0,0 +1,26 @@
1
+ // src/reporting/plain-group.ts
2
+ function groupReportsByRule(reports) {
3
+ const groups = /* @__PURE__ */ new Map();
4
+ for (const report of reports) {
5
+ const existing = groups.get(report.ruleId);
6
+ if (existing) {
7
+ existing.count += 1;
8
+ } else {
9
+ groups.set(report.ruleId, { report, count: 1 });
10
+ }
11
+ }
12
+ return [...groups.values()];
13
+ }
14
+ function impactBreakdown(reports, levelOf, order) {
15
+ const counts = /* @__PURE__ */ new Map();
16
+ for (const report of reports) {
17
+ const level = levelOf(report);
18
+ counts.set(level, (counts.get(level) ?? 0) + 1);
19
+ }
20
+ return [...counts.entries()].map(([level, count]) => ({ level, count })).sort((a, b) => (order[a.level] ?? 4) - (order[b.level] ?? 4));
21
+ }
22
+
23
+ export {
24
+ groupReportsByRule,
25
+ impactBreakdown
26
+ };
package/dist/cli/index.js CHANGED
@@ -97,7 +97,8 @@ var init_en = __esm({
97
97
  report_title: "Accessibility report for {url}",
98
98
  report_tagline: "Accessibility report",
99
99
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
100
- fallback_framing: "Technical finding. Ask your developer to review this:"
100
+ fallback_framing: "Technical finding. Ask your developer to review this:",
101
+ occurrences: "{count} occurrences"
101
102
  }
102
103
  };
103
104
  }
@@ -163,7 +164,8 @@ var init_sv = __esm({
163
164
  report_title: "Tillg\xE4nglighetsrapport f\xF6r {url}",
164
165
  report_tagline: "Tillg\xE4nglighetsrapport",
165
166
  attribution: "Rapporten genererades av HolmDigital Engine, en del av HolmDigitals ekosystem f\xF6r tillg\xE4nglighet.",
166
- fallback_framing: "Tekniskt fynd. Be er utvecklare titta p\xE5 detta:"
167
+ fallback_framing: "Tekniskt fynd som din utvecklare beh\xF6ver titta p\xE5.",
168
+ occurrences: "{count} f\xF6rekomster"
167
169
  }
168
170
  };
169
171
  }
@@ -229,7 +231,8 @@ var init_de = __esm({
229
231
  report_title: "Accessibility report for {url}",
230
232
  report_tagline: "Accessibility report",
231
233
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
232
- fallback_framing: "Technical finding. Ask your developer to review this:"
234
+ fallback_framing: "Technical finding. Ask your developer to review this:",
235
+ occurrences: "{count} occurrences"
233
236
  }
234
237
  };
235
238
  }
@@ -295,7 +298,8 @@ var init_fr = __esm({
295
298
  report_title: "Accessibility report for {url}",
296
299
  report_tagline: "Accessibility report",
297
300
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
298
- fallback_framing: "Technical finding. Ask your developer to review this:"
301
+ fallback_framing: "Technical finding. Ask your developer to review this:",
302
+ occurrences: "{count} occurrences"
299
303
  }
300
304
  };
301
305
  }
@@ -361,7 +365,8 @@ var init_es = __esm({
361
365
  report_title: "Accessibility report for {url}",
362
366
  report_tagline: "Accessibility report",
363
367
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
364
- fallback_framing: "Technical finding. Ask your developer to review this:"
368
+ fallback_framing: "Technical finding. Ask your developer to review this:",
369
+ occurrences: "{count} occurrences"
365
370
  }
366
371
  };
367
372
  }
@@ -427,7 +432,8 @@ var init_fi = __esm({
427
432
  report_title: "Accessibility report for {url}",
428
433
  report_tagline: "Accessibility report",
429
434
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
430
- fallback_framing: "Technical finding. Ask your developer to review this:"
435
+ fallback_framing: "Technical finding. Ask your developer to review this:",
436
+ occurrences: "{count} occurrences"
431
437
  }
432
438
  };
433
439
  }
@@ -493,7 +499,8 @@ var init_dk = __esm({
493
499
  report_title: "Accessibility report for {url}",
494
500
  report_tagline: "Accessibility report",
495
501
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
496
- fallback_framing: "Technical finding. Ask your developer to review this:"
502
+ fallback_framing: "Technical finding. Ask your developer to review this:",
503
+ occurrences: "{count} occurrences"
497
504
  }
498
505
  };
499
506
  }
@@ -559,7 +566,8 @@ var init_no = __esm({
559
566
  report_title: "Accessibility report for {url}",
560
567
  report_tagline: "Accessibility report",
561
568
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
562
- fallback_framing: "Technical finding. Ask your developer to review this:"
569
+ fallback_framing: "Technical finding. Ask your developer to review this:",
570
+ occurrences: "{count} occurrences"
563
571
  }
564
572
  };
565
573
  }
@@ -625,7 +633,8 @@ var init_nl = __esm({
625
633
  report_title: "Accessibility report for {url}",
626
634
  report_tagline: "Accessibility report",
627
635
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
628
- fallback_framing: "Technical finding. Ask your developer to review this:"
636
+ fallback_framing: "Technical finding. Ask your developer to review this:",
637
+ occurrences: "{count} occurrences"
629
638
  }
630
639
  };
631
640
  }
@@ -712,6 +721,34 @@ var init_i18n = __esm({
712
721
  }
713
722
  });
714
723
 
724
+ // src/reporting/plain-group.ts
725
+ function groupReportsByRule(reports) {
726
+ const groups = /* @__PURE__ */ new Map();
727
+ for (const report of reports) {
728
+ const existing = groups.get(report.ruleId);
729
+ if (existing) {
730
+ existing.count += 1;
731
+ } else {
732
+ groups.set(report.ruleId, { report, count: 1 });
733
+ }
734
+ }
735
+ return [...groups.values()];
736
+ }
737
+ function impactBreakdown(reports, levelOf2, order) {
738
+ const counts = /* @__PURE__ */ new Map();
739
+ for (const report of reports) {
740
+ const level = levelOf2(report);
741
+ counts.set(level, (counts.get(level) ?? 0) + 1);
742
+ }
743
+ return [...counts.entries()].map(([level, count]) => ({ level, count })).sort((a, b) => (order[a.level] ?? 4) - (order[b.level] ?? 4));
744
+ }
745
+ var init_plain_group = __esm({
746
+ "src/reporting/plain-group.ts"() {
747
+ "use strict";
748
+ init_cjs_shims();
749
+ }
750
+ });
751
+
715
752
  // src/reporting/plain-report.ts
716
753
  var plain_report_exports = {};
717
754
  __export(plain_report_exports, {
@@ -728,28 +765,35 @@ function renderPlainReport(result, lang = "en") {
728
765
  console.log(t("plain.attribution"));
729
766
  return;
730
767
  }
731
- const sortedReports = [...result.reports].sort((a, b) => {
732
- const aLevel = IMPACT_ORDER[levelOf(a)] ?? 4;
733
- const bLevel = IMPACT_ORDER[levelOf(b)] ?? 4;
768
+ const sortedGroups = groupReportsByRule(result.reports).sort((a, b) => {
769
+ const aLevel = IMPACT_ORDER[levelOf(a.report)] ?? 4;
770
+ const bLevel = IMPACT_ORDER[levelOf(b.report)] ?? 4;
734
771
  return aLevel - bLevel;
735
772
  });
736
- const count = sortedReports.length;
773
+ const count = result.reports.length;
737
774
  const unit = count === 1 ? t("plain.intro_unit_singular") : t("plain.intro_unit_plural");
775
+ const breakdown = impactBreakdown(result.reports, levelOf, IMPACT_ORDER);
776
+ const breakdownText = breakdown.map((b) => `${b.count} ${t(BADGE_KEY[b.level])}`).join(", ");
738
777
  console.log(t("plain.intro_framing"));
739
778
  console.log(t("plain.intro_found", { count, unit }));
779
+ console.log(`${count} ${unit}: ${breakdownText}`);
740
780
  console.log(t("plain.sorted_by"));
741
781
  console.log("");
742
- sortedReports.forEach((rawReport, index) => {
743
- const report = rawReport;
782
+ const isSwedish = getCurrentLang() === "sv";
783
+ sortedGroups.forEach((group, index) => {
784
+ const report = group.report;
744
785
  const level = levelOf(report);
745
786
  const badgeText = BADGE_CHALK[level](t(BADGE_KEY[level]));
746
787
  const pl = report.plainLanguage;
747
- console.log(`${index + 1}. ${badgeText} \u2014 ${report.ruleId}`);
788
+ const occurrences = group.count > 1 ? `, ${t("plain.occurrences", { count: group.count })}` : "";
789
+ console.log(`${index + 1}. ${badgeText} \u2014 ${report.ruleId}${occurrences}`);
748
790
  if (pl) {
749
791
  console.log(` ${t("plain.what_happens")} ${pl.whatHappens}`);
750
792
  console.log(` ${t("plain.who_is_affected")} ${pl.whoIsAffected}`);
751
793
  console.log(` ${t("plain.business_impact")} ${pl.businessImpact}`);
752
794
  console.log(` ${t("plain.how_to_fix")} ${pl.howToFix}`);
795
+ } else if (isSwedish) {
796
+ console.log(` ${t("plain.fallback_framing")}`);
753
797
  } else {
754
798
  console.log(` ${t("plain.fallback_framing")} ${report.remediation.description}`);
755
799
  }
@@ -766,6 +810,7 @@ var init_plain_report = __esm({
766
810
  init_cjs_shims();
767
811
  import_chalk = __toESM(require("chalk"));
768
812
  init_i18n();
813
+ init_plain_group();
769
814
  IMPACT_ORDER = {
770
815
  "stoppar-kop": 0,
771
816
  "hindrar": 1,
@@ -1053,7 +1098,7 @@ var HtmlValidator = class {
1053
1098
  // src/core/regulatory-scanner.ts
1054
1099
  var import_node_fs = require("fs");
1055
1100
  function getEngineVersion() {
1056
- return "2.6.1";
1101
+ return "2.8.0";
1057
1102
  }
1058
1103
  function getStandardsVersion() {
1059
1104
  try {
@@ -1075,6 +1120,8 @@ var RegulatoryScanner = class {
1075
1120
  // Default till striktaste
1076
1121
  silent: false,
1077
1122
  invalidHttpsCert: false,
1123
+ waitForHydrationMs: 2500,
1124
+ // Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
1078
1125
  ...options
1079
1126
  };
1080
1127
  this.htmlValidator = new HtmlValidator();
@@ -1123,6 +1170,11 @@ var RegulatoryScanner = class {
1123
1170
  } catch {
1124
1171
  this.log("Network busy, proceeding with scan anyway...");
1125
1172
  }
1173
+ const hydrationWait = this.options.waitForHydrationMs ?? 0;
1174
+ if (hydrationWait > 0) {
1175
+ this.log(`V\xE4ntar ${hydrationWait} ms p\xE5 hydrering...`);
1176
+ await new Promise((resolve) => setTimeout(resolve, hydrationWait));
1177
+ }
1126
1178
  pageTitle = await page.title();
1127
1179
  pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
1128
1180
  let htmlValidation;
@@ -1477,6 +1529,7 @@ function generateBadgeMarkdown(score) {
1477
1529
 
1478
1530
  // src/reporting/html-template.ts
1479
1531
  init_i18n();
1532
+ init_plain_group();
1480
1533
  var LOCALE_TO_INTL = {
1481
1534
  sv: "sv-SE",
1482
1535
  en: "en-US",
@@ -1841,25 +1894,28 @@ function generatePlainReportHTML(result) {
1841
1894
  const lang = getCurrentLang();
1842
1895
  const safeUrl = escapeHtml(result.url);
1843
1896
  const logoDataUri = getLogoDataUri();
1844
- const sortedReports = [...result.reports].sort((a, b) => {
1845
- const aLevel = PLAIN_IMPACT_ORDER[plainLevelOf(a)] ?? 4;
1846
- const bLevel = PLAIN_IMPACT_ORDER[plainLevelOf(b)] ?? 4;
1897
+ const sortedGroups = groupReportsByRule(result.reports).sort((a, b) => {
1898
+ const aLevel = PLAIN_IMPACT_ORDER[plainLevelOf(a.report)] ?? 4;
1899
+ const bLevel = PLAIN_IMPACT_ORDER[plainLevelOf(b.report)] ?? 4;
1847
1900
  return aLevel - bLevel;
1848
1901
  });
1849
- const count = sortedReports.length;
1902
+ const count = result.reports.length;
1850
1903
  const unit = count === 1 ? t("plain.intro_unit_singular") : t("plain.intro_unit_plural");
1851
- const itemsHtml = sortedReports.length === 0 ? `<p>${t("plain.empty_state")}</p>` : `<ul class="issue-list">
1852
- ${sortedReports.map((rawReport) => {
1853
- const report = rawReport;
1904
+ const breakdownText = impactBreakdown(result.reports, plainLevelOf, PLAIN_IMPACT_ORDER).map((b) => `${b.count} ${escapeHtml(t(PLAIN_BADGE_KEY[b.level]))}`).join(", ");
1905
+ const isSwedish = lang === "sv";
1906
+ const itemsHtml = sortedGroups.length === 0 ? `<p>${t("plain.empty_state")}</p>` : `<ul class="issue-list">
1907
+ ${sortedGroups.map((group) => {
1908
+ const report = group.report;
1854
1909
  const level = plainLevelOf(report);
1855
1910
  const badgeClass = PLAIN_BADGE_CLASS[level];
1856
1911
  const cardClass = `issue-item--${level}`;
1857
1912
  const badgeText = escapeHtml(t(PLAIN_BADGE_KEY[level]));
1858
1913
  const pl = report.plainLanguage;
1914
+ const occurrences = group.count > 1 ? `, ${escapeHtml(t("plain.occurrences", { count: group.count }))}` : "";
1859
1915
  if (pl) {
1860
1916
  return ` <li class="issue-item ${cardClass}">
1861
1917
  <span class="badge ${badgeClass}">${badgeText}</span>
1862
- <strong class="issue-id">${escapeHtml(report.ruleId)}</strong>
1918
+ <strong class="issue-id">${escapeHtml(report.ruleId)}${occurrences}</strong>
1863
1919
  <dl class="issue-fields">
1864
1920
  <dt>${t("plain.what_happens")}</dt><dd>${escapeHtml(pl.whatHappens)}</dd>
1865
1921
  <dt>${t("plain.who_is_affected")}</dt><dd>${escapeHtml(pl.whoIsAffected)}</dd>
@@ -1868,10 +1924,11 @@ ${sortedReports.map((rawReport) => {
1868
1924
  </dl>
1869
1925
  </li>`;
1870
1926
  } else {
1927
+ const rawDetail = isSwedish ? "" : ` ${escapeHtml(report.remediation.description)}`;
1871
1928
  return ` <li class="issue-item ${cardClass}">
1872
1929
  <span class="badge ${badgeClass}">${badgeText}</span>
1873
- <strong class="issue-id">${escapeHtml(report.ruleId)}</strong>
1874
- <p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span> ${escapeHtml(report.remediation.description)}</p>
1930
+ <strong class="issue-id">${escapeHtml(report.ruleId)}${occurrences}</strong>
1931
+ <p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span>${rawDetail}</p>
1875
1932
  </li>`;
1876
1933
  }
1877
1934
  }).join("\n")}
@@ -2104,6 +2161,7 @@ ${sortedReports.map((rawReport) => {
2104
2161
  <div class="intro">
2105
2162
  <p>${t("plain.intro_framing")}</p>
2106
2163
  <p>${t("plain.intro_found", { count, unit })}</p>
2164
+ <p class="intro-breakdown">${count} ${escapeHtml(unit)}: ${breakdownText}</p>
2107
2165
  </div>
2108
2166
 
2109
2167
  ${itemsHtml}
@@ -7,12 +7,16 @@ import {
7
7
  generateStatement,
8
8
  generateStatementContent,
9
9
  getEngineVersion
10
- } from "../chunk-DIVBAW6U.mjs";
10
+ } from "../chunk-AICMJ3YF.mjs";
11
+ import {
12
+ groupReportsByRule,
13
+ impactBreakdown
14
+ } from "../chunk-VNNYP4NV.mjs";
11
15
  import {
12
16
  getCurrentLang,
13
17
  setLanguage,
14
18
  t
15
- } from "../chunk-TT3JDVGJ.mjs";
19
+ } from "../chunk-6CGNOKCN.mjs";
16
20
  import {
17
21
  __dirname
18
22
  } from "../chunk-DIBTSSLZ.mjs";
@@ -389,25 +393,28 @@ function generatePlainReportHTML(result) {
389
393
  const lang = getCurrentLang();
390
394
  const safeUrl = escapeHtml(result.url);
391
395
  const logoDataUri = getLogoDataUri();
392
- const sortedReports = [...result.reports].sort((a, b) => {
393
- const aLevel = PLAIN_IMPACT_ORDER[plainLevelOf(a)] ?? 4;
394
- const bLevel = PLAIN_IMPACT_ORDER[plainLevelOf(b)] ?? 4;
396
+ const sortedGroups = groupReportsByRule(result.reports).sort((a, b) => {
397
+ const aLevel = PLAIN_IMPACT_ORDER[plainLevelOf(a.report)] ?? 4;
398
+ const bLevel = PLAIN_IMPACT_ORDER[plainLevelOf(b.report)] ?? 4;
395
399
  return aLevel - bLevel;
396
400
  });
397
- const count = sortedReports.length;
401
+ const count = result.reports.length;
398
402
  const unit = count === 1 ? t("plain.intro_unit_singular") : t("plain.intro_unit_plural");
399
- const itemsHtml = sortedReports.length === 0 ? `<p>${t("plain.empty_state")}</p>` : `<ul class="issue-list">
400
- ${sortedReports.map((rawReport) => {
401
- const report = rawReport;
403
+ const breakdownText = impactBreakdown(result.reports, plainLevelOf, PLAIN_IMPACT_ORDER).map((b) => `${b.count} ${escapeHtml(t(PLAIN_BADGE_KEY[b.level]))}`).join(", ");
404
+ const isSwedish = lang === "sv";
405
+ const itemsHtml = sortedGroups.length === 0 ? `<p>${t("plain.empty_state")}</p>` : `<ul class="issue-list">
406
+ ${sortedGroups.map((group) => {
407
+ const report = group.report;
402
408
  const level = plainLevelOf(report);
403
409
  const badgeClass = PLAIN_BADGE_CLASS[level];
404
410
  const cardClass = `issue-item--${level}`;
405
411
  const badgeText = escapeHtml(t(PLAIN_BADGE_KEY[level]));
406
412
  const pl = report.plainLanguage;
413
+ const occurrences = group.count > 1 ? `, ${escapeHtml(t("plain.occurrences", { count: group.count }))}` : "";
407
414
  if (pl) {
408
415
  return ` <li class="issue-item ${cardClass}">
409
416
  <span class="badge ${badgeClass}">${badgeText}</span>
410
- <strong class="issue-id">${escapeHtml(report.ruleId)}</strong>
417
+ <strong class="issue-id">${escapeHtml(report.ruleId)}${occurrences}</strong>
411
418
  <dl class="issue-fields">
412
419
  <dt>${t("plain.what_happens")}</dt><dd>${escapeHtml(pl.whatHappens)}</dd>
413
420
  <dt>${t("plain.who_is_affected")}</dt><dd>${escapeHtml(pl.whoIsAffected)}</dd>
@@ -416,10 +423,11 @@ ${sortedReports.map((rawReport) => {
416
423
  </dl>
417
424
  </li>`;
418
425
  } else {
426
+ const rawDetail = isSwedish ? "" : ` ${escapeHtml(report.remediation.description)}`;
419
427
  return ` <li class="issue-item ${cardClass}">
420
428
  <span class="badge ${badgeClass}">${badgeText}</span>
421
- <strong class="issue-id">${escapeHtml(report.ruleId)}</strong>
422
- <p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span> ${escapeHtml(report.remediation.description)}</p>
429
+ <strong class="issue-id">${escapeHtml(report.ruleId)}${occurrences}</strong>
430
+ <p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span>${rawDetail}</p>
423
431
  </li>`;
424
432
  }
425
433
  }).join("\n")}
@@ -652,6 +660,7 @@ ${sortedReports.map((rawReport) => {
652
660
  <div class="intro">
653
661
  <p>${t("plain.intro_framing")}</p>
654
662
  <p>${t("plain.intro_found", { count, unit })}</p>
663
+ <p class="intro-breakdown">${count} ${escapeHtml(unit)}: ${breakdownText}</p>
655
664
  </div>
656
665
 
657
666
  ${itemsHtml}
@@ -910,7 +919,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
910
919
  console.log(chalk.gray(`
911
920
  Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
912
921
  } else if (options.audience === "plain") {
913
- const { renderPlainReport } = await import("../plain-report-AK5QAT5P.mjs");
922
+ const { renderPlainReport } = await import("../plain-report-R2TZYGLD.mjs");
914
923
  renderPlainReport(result, options.lang);
915
924
  } else {
916
925
  console.log("\n");
@@ -2,7 +2,7 @@ import {
2
2
  getCurrentLang,
3
3
  setLanguage,
4
4
  t
5
- } from "./chunk-TT3JDVGJ.mjs";
5
+ } from "./chunk-6CGNOKCN.mjs";
6
6
  import "./chunk-DIBTSSLZ.mjs";
7
7
  export {
8
8
  getCurrentLang,
package/dist/index.d.mts CHANGED
@@ -26,6 +26,7 @@ interface ScannerOptions {
26
26
  severityThreshold?: 'critical' | 'high' | 'medium' | 'low';
27
27
  invalidHttpsCert?: boolean;
28
28
  light?: boolean;
29
+ waitForHydrationMs?: number;
29
30
  }
30
31
  interface ScanMetadata {
31
32
  engineVersion: string;
@@ -160,7 +161,8 @@ var plain = {
160
161
  report_title: "Accessibility report for {url}",
161
162
  report_tagline: "Accessibility report",
162
163
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
163
- fallback_framing: "Technical finding. Ask your developer to review this:"
164
+ fallback_framing: "Technical finding. Ask your developer to review this:",
165
+ occurrences: "{count} occurrences"
164
166
  };
165
167
  var en = {
166
168
  cli: cli,
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ interface ScannerOptions {
26
26
  severityThreshold?: 'critical' | 'high' | 'medium' | 'low';
27
27
  invalidHttpsCert?: boolean;
28
28
  light?: boolean;
29
+ waitForHydrationMs?: number;
29
30
  }
30
31
  interface ScanMetadata {
31
32
  engineVersion: string;
@@ -160,7 +161,8 @@ var plain = {
160
161
  report_title: "Accessibility report for {url}",
161
162
  report_tagline: "Accessibility report",
162
163
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
163
- fallback_framing: "Technical finding. Ask your developer to review this:"
164
+ fallback_framing: "Technical finding. Ask your developer to review this:",
165
+ occurrences: "{count} occurrences"
164
166
  };
165
167
  var en = {
166
168
  cli: cli,
package/dist/index.js CHANGED
@@ -97,7 +97,8 @@ var init_en = __esm({
97
97
  report_title: "Accessibility report for {url}",
98
98
  report_tagline: "Accessibility report",
99
99
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
100
- fallback_framing: "Technical finding. Ask your developer to review this:"
100
+ fallback_framing: "Technical finding. Ask your developer to review this:",
101
+ occurrences: "{count} occurrences"
101
102
  }
102
103
  };
103
104
  }
@@ -163,7 +164,8 @@ var init_sv = __esm({
163
164
  report_title: "Tillg\xE4nglighetsrapport f\xF6r {url}",
164
165
  report_tagline: "Tillg\xE4nglighetsrapport",
165
166
  attribution: "Rapporten genererades av HolmDigital Engine, en del av HolmDigitals ekosystem f\xF6r tillg\xE4nglighet.",
166
- fallback_framing: "Tekniskt fynd. Be er utvecklare titta p\xE5 detta:"
167
+ fallback_framing: "Tekniskt fynd som din utvecklare beh\xF6ver titta p\xE5.",
168
+ occurrences: "{count} f\xF6rekomster"
167
169
  }
168
170
  };
169
171
  }
@@ -229,7 +231,8 @@ var init_de = __esm({
229
231
  report_title: "Accessibility report for {url}",
230
232
  report_tagline: "Accessibility report",
231
233
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
232
- fallback_framing: "Technical finding. Ask your developer to review this:"
234
+ fallback_framing: "Technical finding. Ask your developer to review this:",
235
+ occurrences: "{count} occurrences"
233
236
  }
234
237
  };
235
238
  }
@@ -295,7 +298,8 @@ var init_fr = __esm({
295
298
  report_title: "Accessibility report for {url}",
296
299
  report_tagline: "Accessibility report",
297
300
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
298
- fallback_framing: "Technical finding. Ask your developer to review this:"
301
+ fallback_framing: "Technical finding. Ask your developer to review this:",
302
+ occurrences: "{count} occurrences"
299
303
  }
300
304
  };
301
305
  }
@@ -361,7 +365,8 @@ var init_es = __esm({
361
365
  report_title: "Accessibility report for {url}",
362
366
  report_tagline: "Accessibility report",
363
367
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
364
- fallback_framing: "Technical finding. Ask your developer to review this:"
368
+ fallback_framing: "Technical finding. Ask your developer to review this:",
369
+ occurrences: "{count} occurrences"
365
370
  }
366
371
  };
367
372
  }
@@ -427,7 +432,8 @@ var init_fi = __esm({
427
432
  report_title: "Accessibility report for {url}",
428
433
  report_tagline: "Accessibility report",
429
434
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
430
- fallback_framing: "Technical finding. Ask your developer to review this:"
435
+ fallback_framing: "Technical finding. Ask your developer to review this:",
436
+ occurrences: "{count} occurrences"
431
437
  }
432
438
  };
433
439
  }
@@ -493,7 +499,8 @@ var init_dk = __esm({
493
499
  report_title: "Accessibility report for {url}",
494
500
  report_tagline: "Accessibility report",
495
501
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
496
- fallback_framing: "Technical finding. Ask your developer to review this:"
502
+ fallback_framing: "Technical finding. Ask your developer to review this:",
503
+ occurrences: "{count} occurrences"
497
504
  }
498
505
  };
499
506
  }
@@ -559,7 +566,8 @@ var init_no = __esm({
559
566
  report_title: "Accessibility report for {url}",
560
567
  report_tagline: "Accessibility report",
561
568
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
562
- fallback_framing: "Technical finding. Ask your developer to review this:"
569
+ fallback_framing: "Technical finding. Ask your developer to review this:",
570
+ occurrences: "{count} occurrences"
563
571
  }
564
572
  };
565
573
  }
@@ -625,7 +633,8 @@ var init_nl = __esm({
625
633
  report_title: "Accessibility report for {url}",
626
634
  report_tagline: "Accessibility report",
627
635
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
628
- fallback_framing: "Technical finding. Ask your developer to review this:"
636
+ fallback_framing: "Technical finding. Ask your developer to review this:",
637
+ occurrences: "{count} occurrences"
629
638
  }
630
639
  };
631
640
  }
@@ -866,7 +875,7 @@ var HtmlValidator = class {
866
875
  // src/core/regulatory-scanner.ts
867
876
  var import_node_fs = require("fs");
868
877
  function getEngineVersion() {
869
- return "2.6.1";
878
+ return "2.8.0";
870
879
  }
871
880
  function getStandardsVersion() {
872
881
  try {
@@ -888,6 +897,8 @@ var RegulatoryScanner = class {
888
897
  // Default till striktaste
889
898
  silent: false,
890
899
  invalidHttpsCert: false,
900
+ waitForHydrationMs: 2500,
901
+ // Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
891
902
  ...options
892
903
  };
893
904
  this.htmlValidator = new HtmlValidator();
@@ -936,6 +947,11 @@ var RegulatoryScanner = class {
936
947
  } catch {
937
948
  this.log("Network busy, proceeding with scan anyway...");
938
949
  }
950
+ const hydrationWait = this.options.waitForHydrationMs ?? 0;
951
+ if (hydrationWait > 0) {
952
+ this.log(`V\xE4ntar ${hydrationWait} ms p\xE5 hydrering...`);
953
+ await new Promise((resolve) => setTimeout(resolve, hydrationWait));
954
+ }
939
955
  pageTitle = await page.title();
940
956
  pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
941
957
  let htmlValidation;
package/dist/index.mjs CHANGED
@@ -5,12 +5,12 @@ import {
5
5
  generateStatement,
6
6
  generateStatementContent,
7
7
  getEngineVersion
8
- } from "./chunk-DIVBAW6U.mjs";
8
+ } from "./chunk-AICMJ3YF.mjs";
9
9
  import {
10
10
  getCurrentLang,
11
11
  setLanguage,
12
12
  t
13
- } from "./chunk-TT3JDVGJ.mjs";
13
+ } from "./chunk-6CGNOKCN.mjs";
14
14
  import "./chunk-DIBTSSLZ.mjs";
15
15
  export {
16
16
  PseudoAutomationEngine,
@@ -1,7 +1,12 @@
1
1
  import {
2
+ groupReportsByRule,
3
+ impactBreakdown
4
+ } from "./chunk-VNNYP4NV.mjs";
5
+ import {
6
+ getCurrentLang,
2
7
  setLanguage,
3
8
  t
4
- } from "./chunk-TT3JDVGJ.mjs";
9
+ } from "./chunk-6CGNOKCN.mjs";
5
10
  import "./chunk-DIBTSSLZ.mjs";
6
11
 
7
12
  // src/reporting/plain-report.ts
@@ -41,28 +46,35 @@ function renderPlainReport(result, lang = "en") {
41
46
  console.log(t("plain.attribution"));
42
47
  return;
43
48
  }
44
- const sortedReports = [...result.reports].sort((a, b) => {
45
- const aLevel = IMPACT_ORDER[levelOf(a)] ?? 4;
46
- const bLevel = IMPACT_ORDER[levelOf(b)] ?? 4;
49
+ const sortedGroups = groupReportsByRule(result.reports).sort((a, b) => {
50
+ const aLevel = IMPACT_ORDER[levelOf(a.report)] ?? 4;
51
+ const bLevel = IMPACT_ORDER[levelOf(b.report)] ?? 4;
47
52
  return aLevel - bLevel;
48
53
  });
49
- const count = sortedReports.length;
54
+ const count = result.reports.length;
50
55
  const unit = count === 1 ? t("plain.intro_unit_singular") : t("plain.intro_unit_plural");
56
+ const breakdown = impactBreakdown(result.reports, levelOf, IMPACT_ORDER);
57
+ const breakdownText = breakdown.map((b) => `${b.count} ${t(BADGE_KEY[b.level])}`).join(", ");
51
58
  console.log(t("plain.intro_framing"));
52
59
  console.log(t("plain.intro_found", { count, unit }));
60
+ console.log(`${count} ${unit}: ${breakdownText}`);
53
61
  console.log(t("plain.sorted_by"));
54
62
  console.log("");
55
- sortedReports.forEach((rawReport, index) => {
56
- const report = rawReport;
63
+ const isSwedish = getCurrentLang() === "sv";
64
+ sortedGroups.forEach((group, index) => {
65
+ const report = group.report;
57
66
  const level = levelOf(report);
58
67
  const badgeText = BADGE_CHALK[level](t(BADGE_KEY[level]));
59
68
  const pl = report.plainLanguage;
60
- console.log(`${index + 1}. ${badgeText} \u2014 ${report.ruleId}`);
69
+ const occurrences = group.count > 1 ? `, ${t("plain.occurrences", { count: group.count })}` : "";
70
+ console.log(`${index + 1}. ${badgeText} \u2014 ${report.ruleId}${occurrences}`);
61
71
  if (pl) {
62
72
  console.log(` ${t("plain.what_happens")} ${pl.whatHappens}`);
63
73
  console.log(` ${t("plain.who_is_affected")} ${pl.whoIsAffected}`);
64
74
  console.log(` ${t("plain.business_impact")} ${pl.businessImpact}`);
65
75
  console.log(` ${t("plain.how_to_fix")} ${pl.howToFix}`);
76
+ } else if (isSwedish) {
77
+ console.log(` ${t("plain.fallback_framing")}`);
66
78
  } else {
67
79
  console.log(` ${t("plain.fallback_framing")} ${report.remediation.description}`);
68
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holmdigital/engine",
3
- "version": "2.6.1",
3
+ "version": "2.8.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -83,7 +83,7 @@
83
83
  "license": "MIT",
84
84
  "dependencies": {
85
85
  "@holmdigital/components": "^3.0.0",
86
- "@holmdigital/standards": "^2.7.0",
86
+ "@holmdigital/standards": "^2.8.0",
87
87
  "axe-core": "^4.11.1",
88
88
  "chalk": "^5.3.0",
89
89
  "commander": "^12.1.0",