@holmdigital/engine 2.7.0 → 2.9.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 CHANGED
@@ -35,6 +35,7 @@ For a comprehensive guide on CLI flags, CI/CD integration, and configuration fil
35
35
  - **Configurable Severity Threshold**: Fail CI only on critical/high issues (configurable).
36
36
  - **Pseudo-Automation**: Automatically generates Playwright/Puppeteer test scripts for manual verification steps.
37
37
  - **PDF Reporting**: Generates beautiful, compliant PDF reports with severity-sorted violations, HTML error counts, and `@HolmDigital/engine` branding.
38
+ - **Plain-Language Reports**: `--plain` (or `--audience plain`) renders the report and PDF in plain language for managers, lawyers, and buyers without a technical background. Findings of the same rule are grouped into one card with an occurrence count, with a business-impact breakdown and Swedish-language fallback.
38
39
  - **Type-Safe Results**: Scan results return fully typed `EnrichedReport[]` with `failingNodes` and `legalContext` — zero `as any` casts in the pipeline.
39
40
  - **Build-Time Version Injection**: Engine version derived from `package.json` at build time via tsup `define` — CLI, cloud client, and reports always report the correct version.
40
41
  - **TypeScript**: Written in TypeScript with full type definitions included.
@@ -73,6 +74,8 @@ npx hd-a11y-scan <url> [options]
73
74
  | `--api-key <key>` | API Key for HolmDigital Cloud |
74
75
  | `--cloud-url <url>` | Custom Cloud API Endpoint (default: cloud.holmdigital.se) |
75
76
  | `--light` | Fast score-only mode — skips HTML validation and detailed legal mapping |
77
+ | `--plain` | Plain-language mode (klarspråksläge): report and PDF in non-technical language for recipients without a technical background. Alias for `--audience plain`. |
78
+ | `--audience <mode>` | Report audience: `developer` (default) or `plain`. |
76
79
 
77
80
  ### 🏆 Accessibility Badge
78
81
  If your site achieves a **100% score**, the CLI will generate a [Shields.io](https://shields.io/) badge that you can add to your project's README:
@@ -113,9 +116,9 @@ npx hd-a11y-scan https://hospital.example.com --country US --sector private --st
113
116
  "url": "https://example.com",
114
117
  "timestamp": "2026-01-13T17:05:11.749Z",
115
118
  "metadata": {
116
- "engineVersion": "2.5.3",
119
+ "engineVersion": "2.8.0",
117
120
  "axeCoreVersion": "4.11.1",
118
- "standardsVersion": "2.5.2",
121
+ "standardsVersion": "2.8.0",
119
122
  "scanDuration": 2891,
120
123
  "pageTitle": "Example Domain",
121
124
  "pageLanguage": "en"
@@ -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.7.0";
141
+ return "2.9.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;
package/dist/cli/index.js CHANGED
@@ -786,7 +786,8 @@ function renderPlainReport(result, lang = "en") {
786
786
  const badgeText = BADGE_CHALK[level](t(BADGE_KEY[level]));
787
787
  const pl = report.plainLanguage;
788
788
  const occurrences = group.count > 1 ? `, ${t("plain.occurrences", { count: group.count })}` : "";
789
- console.log(`${index + 1}. ${badgeText} \u2014 ${report.ruleId}${occurrences}`);
789
+ const heading = pl?.headline ? `${pl.headline} (${report.ruleId})` : report.ruleId;
790
+ console.log(`${index + 1}. ${badgeText}: ${heading}${occurrences}`);
790
791
  if (pl) {
791
792
  console.log(` ${t("plain.what_happens")} ${pl.whatHappens}`);
792
793
  console.log(` ${t("plain.who_is_affected")} ${pl.whoIsAffected}`);
@@ -1098,7 +1099,7 @@ var HtmlValidator = class {
1098
1099
  // src/core/regulatory-scanner.ts
1099
1100
  var import_node_fs = require("fs");
1100
1101
  function getEngineVersion() {
1101
- return "2.7.0";
1102
+ return "2.9.0";
1102
1103
  }
1103
1104
  function getStandardsVersion() {
1104
1105
  try {
@@ -1120,6 +1121,8 @@ var RegulatoryScanner = class {
1120
1121
  // Default till striktaste
1121
1122
  silent: false,
1122
1123
  invalidHttpsCert: false,
1124
+ waitForHydrationMs: 2500,
1125
+ // Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
1123
1126
  ...options
1124
1127
  };
1125
1128
  this.htmlValidator = new HtmlValidator();
@@ -1168,6 +1171,11 @@ var RegulatoryScanner = class {
1168
1171
  } catch {
1169
1172
  this.log("Network busy, proceeding with scan anyway...");
1170
1173
  }
1174
+ const hydrationWait = this.options.waitForHydrationMs ?? 0;
1175
+ if (hydrationWait > 0) {
1176
+ this.log(`V\xE4ntar ${hydrationWait} ms p\xE5 hydrering...`);
1177
+ await new Promise((resolve) => setTimeout(resolve, hydrationWait));
1178
+ }
1171
1179
  pageTitle = await page.title();
1172
1180
  pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
1173
1181
  let htmlValidation;
@@ -1905,10 +1913,11 @@ ${sortedGroups.map((group) => {
1905
1913
  const badgeText = escapeHtml(t(PLAIN_BADGE_KEY[level]));
1906
1914
  const pl = report.plainLanguage;
1907
1915
  const occurrences = group.count > 1 ? `, ${escapeHtml(t("plain.occurrences", { count: group.count }))}` : "";
1916
+ const headingHtml = pl?.headline ? `${escapeHtml(pl.headline)} <span class="issue-rule-ref">(${escapeHtml(report.ruleId)})</span>` : escapeHtml(report.ruleId);
1908
1917
  if (pl) {
1909
1918
  return ` <li class="issue-item ${cardClass}">
1910
1919
  <span class="badge ${badgeClass}">${badgeText}</span>
1911
- <strong class="issue-id">${escapeHtml(report.ruleId)}${occurrences}</strong>
1920
+ <strong class="issue-id">${headingHtml}${occurrences}</strong>
1912
1921
  <dl class="issue-fields">
1913
1922
  <dt>${t("plain.what_happens")}</dt><dd>${escapeHtml(pl.whatHappens)}</dd>
1914
1923
  <dt>${t("plain.who_is_affected")}</dt><dd>${escapeHtml(pl.whoIsAffected)}</dd>
@@ -1920,7 +1929,7 @@ ${sortedGroups.map((group) => {
1920
1929
  const rawDetail = isSwedish ? "" : ` ${escapeHtml(report.remediation.description)}`;
1921
1930
  return ` <li class="issue-item ${cardClass}">
1922
1931
  <span class="badge ${badgeClass}">${badgeText}</span>
1923
- <strong class="issue-id">${escapeHtml(report.ruleId)}${occurrences}</strong>
1932
+ <strong class="issue-id">${headingHtml}${occurrences}</strong>
1924
1933
  <p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span>${rawDetail}</p>
1925
1934
  </li>`;
1926
1935
  }
@@ -2070,13 +2079,21 @@ ${sortedGroups.map((group) => {
2070
2079
  /* ---- Rule ID ---- */
2071
2080
  .issue-id {
2072
2081
  display: block;
2082
+ font-size: 1.05rem;
2083
+ font-weight: 700;
2084
+ color: #1e293b;
2085
+ margin-bottom: 0.75rem;
2086
+ break-after: avoid;
2087
+ page-break-after: avoid;
2088
+ }
2089
+
2090
+ /* Raw axe rule id as a small, subordinate technical reference next to the
2091
+ Swedish plain-language heading. */
2092
+ .issue-rule-ref {
2073
2093
  font-size: 0.78rem;
2074
2094
  font-weight: 600;
2075
2095
  color: #64748b;
2076
2096
  font-family: ui-monospace, 'Cascadia Code', 'Courier New', monospace;
2077
- margin-bottom: 0.75rem;
2078
- break-after: avoid;
2079
- page-break-after: avoid;
2080
2097
  }
2081
2098
 
2082
2099
  /* ---- Field label/value pairs ---- */
@@ -7,7 +7,7 @@ import {
7
7
  generateStatement,
8
8
  generateStatementContent,
9
9
  getEngineVersion
10
- } from "../chunk-KXI4TVHQ.mjs";
10
+ } from "../chunk-4HV55NRY.mjs";
11
11
  import {
12
12
  groupReportsByRule,
13
13
  impactBreakdown
@@ -411,10 +411,11 @@ ${sortedGroups.map((group) => {
411
411
  const badgeText = escapeHtml(t(PLAIN_BADGE_KEY[level]));
412
412
  const pl = report.plainLanguage;
413
413
  const occurrences = group.count > 1 ? `, ${escapeHtml(t("plain.occurrences", { count: group.count }))}` : "";
414
+ const headingHtml = pl?.headline ? `${escapeHtml(pl.headline)} <span class="issue-rule-ref">(${escapeHtml(report.ruleId)})</span>` : escapeHtml(report.ruleId);
414
415
  if (pl) {
415
416
  return ` <li class="issue-item ${cardClass}">
416
417
  <span class="badge ${badgeClass}">${badgeText}</span>
417
- <strong class="issue-id">${escapeHtml(report.ruleId)}${occurrences}</strong>
418
+ <strong class="issue-id">${headingHtml}${occurrences}</strong>
418
419
  <dl class="issue-fields">
419
420
  <dt>${t("plain.what_happens")}</dt><dd>${escapeHtml(pl.whatHappens)}</dd>
420
421
  <dt>${t("plain.who_is_affected")}</dt><dd>${escapeHtml(pl.whoIsAffected)}</dd>
@@ -426,7 +427,7 @@ ${sortedGroups.map((group) => {
426
427
  const rawDetail = isSwedish ? "" : ` ${escapeHtml(report.remediation.description)}`;
427
428
  return ` <li class="issue-item ${cardClass}">
428
429
  <span class="badge ${badgeClass}">${badgeText}</span>
429
- <strong class="issue-id">${escapeHtml(report.ruleId)}${occurrences}</strong>
430
+ <strong class="issue-id">${headingHtml}${occurrences}</strong>
430
431
  <p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span>${rawDetail}</p>
431
432
  </li>`;
432
433
  }
@@ -576,13 +577,21 @@ ${sortedGroups.map((group) => {
576
577
  /* ---- Rule ID ---- */
577
578
  .issue-id {
578
579
  display: block;
580
+ font-size: 1.05rem;
581
+ font-weight: 700;
582
+ color: #1e293b;
583
+ margin-bottom: 0.75rem;
584
+ break-after: avoid;
585
+ page-break-after: avoid;
586
+ }
587
+
588
+ /* Raw axe rule id as a small, subordinate technical reference next to the
589
+ Swedish plain-language heading. */
590
+ .issue-rule-ref {
579
591
  font-size: 0.78rem;
580
592
  font-weight: 600;
581
593
  color: #64748b;
582
594
  font-family: ui-monospace, 'Cascadia Code', 'Courier New', monospace;
583
- margin-bottom: 0.75rem;
584
- break-after: avoid;
585
- page-break-after: avoid;
586
595
  }
587
596
 
588
597
  /* ---- Field label/value pairs ---- */
@@ -919,7 +928,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
919
928
  console.log(chalk.gray(`
920
929
  Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
921
930
  } else if (options.audience === "plain") {
922
- const { renderPlainReport } = await import("../plain-report-R2TZYGLD.mjs");
931
+ const { renderPlainReport } = await import("../plain-report-JQAGRPKC.mjs");
923
932
  renderPlainReport(result, options.lang);
924
933
  } else {
925
934
  console.log("\n");
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;
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;
package/dist/index.js CHANGED
@@ -875,7 +875,7 @@ var HtmlValidator = class {
875
875
  // src/core/regulatory-scanner.ts
876
876
  var import_node_fs = require("fs");
877
877
  function getEngineVersion() {
878
- return "2.7.0";
878
+ return "2.9.0";
879
879
  }
880
880
  function getStandardsVersion() {
881
881
  try {
@@ -897,6 +897,8 @@ var RegulatoryScanner = class {
897
897
  // Default till striktaste
898
898
  silent: false,
899
899
  invalidHttpsCert: false,
900
+ waitForHydrationMs: 2500,
901
+ // Default PÅ: klientrenderade SPA:er behöver tid att hydrera innan axe körs
900
902
  ...options
901
903
  };
902
904
  this.htmlValidator = new HtmlValidator();
@@ -945,6 +947,11 @@ var RegulatoryScanner = class {
945
947
  } catch {
946
948
  this.log("Network busy, proceeding with scan anyway...");
947
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
+ }
948
955
  pageTitle = await page.title();
949
956
  pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
950
957
  let htmlValidation;
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  generateStatement,
6
6
  generateStatementContent,
7
7
  getEngineVersion
8
- } from "./chunk-KXI4TVHQ.mjs";
8
+ } from "./chunk-4HV55NRY.mjs";
9
9
  import {
10
10
  getCurrentLang,
11
11
  setLanguage,
@@ -67,7 +67,8 @@ function renderPlainReport(result, lang = "en") {
67
67
  const badgeText = BADGE_CHALK[level](t(BADGE_KEY[level]));
68
68
  const pl = report.plainLanguage;
69
69
  const occurrences = group.count > 1 ? `, ${t("plain.occurrences", { count: group.count })}` : "";
70
- console.log(`${index + 1}. ${badgeText} \u2014 ${report.ruleId}${occurrences}`);
70
+ const heading = pl?.headline ? `${pl.headline} (${report.ruleId})` : report.ruleId;
71
+ console.log(`${index + 1}. ${badgeText}: ${heading}${occurrences}`);
71
72
  if (pl) {
72
73
  console.log(` ${t("plain.what_happens")} ${pl.whatHappens}`);
73
74
  console.log(` ${t("plain.who_is_affected")} ${pl.whoIsAffected}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holmdigital/engine",
3
- "version": "2.7.0",
3
+ "version": "2.9.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -84,25 +84,25 @@
84
84
  "dependencies": {
85
85
  "@holmdigital/components": "^3.0.0",
86
86
  "@holmdigital/standards": "^2.8.0",
87
- "axe-core": "^4.11.1",
87
+ "axe-core": "^4.12.1",
88
88
  "chalk": "^5.3.0",
89
89
  "commander": "^12.1.0",
90
- "cosmiconfig": "^9.0.0",
91
- "html-validate": "10.4.0",
90
+ "cosmiconfig": "^9.0.2",
91
+ "html-validate": "11.5.3",
92
92
  "ora": "^8.1.1",
93
- "puppeteer": "23.10.4",
93
+ "puppeteer": "25.2.0",
94
94
  "react": "^18.3.1 || ^19.0.0",
95
95
  "react-dom": "^18.3.1 || ^19.0.0",
96
96
  "ws": "^8.18.0"
97
97
  },
98
98
  "devDependencies": {
99
99
  "@types/cosmiconfig": "^5.0.3",
100
- "@types/node": "^22.10.2",
100
+ "@types/node": "^26.0.0",
101
101
  "@types/react": "^18.3.1 || ^19.0.0",
102
102
  "@types/react-dom": "^18.3.1 || ^19.0.0",
103
103
  "@types/ws": "^8.5.13",
104
104
  "tsup": "^8.3.5",
105
105
  "typescript": "^5.7.2",
106
- "vitest": "^4.0.16"
106
+ "vitest": "^4.1.9"
107
107
  }
108
108
  }