@holmdigital/engine 2.1.5 → 2.1.7

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
@@ -14,7 +14,7 @@ Most accessibility tools give you technical errors (e.g., "Color contrast must b
14
14
  It handles the heavy lifting of:
15
15
  1. **Mapping** technical failures to specific legal clauses.
16
16
  2. **Validating** HTML structure to ensure test accuracy.
17
- 3. **Reporting** in multiple languages (EN, SV, NL, DE, FR, ES) for non-technical stakeholders.
17
+ 3. **Reporting** in multiple languages (EN, SV, NO, FI, DA, NL, DE, FR, ES) for non-technical stakeholders.
18
18
  4. **CI/CD Pipeline Integration** with automatic enforcement.
19
19
 
20
20
  For a comprehensive guide on CLI flags, CI/CD integration, and configuration files, see the **[Engine Library Catalog](../../docs/reference/engine.md)**.
@@ -30,6 +30,8 @@ For a comprehensive guide on CLI flags, CI/CD integration, and configuration fil
30
30
  - **Configurable Severity Threshold**: Fail CI only on critical/high issues (configurable).
31
31
  - **Pseudo-Automation**: Automatically generates Playwright/Puppeteer test scripts for manual verification steps.
32
32
  - **PDF Reporting**: Generates beautiful, compliant PDF reports with severity-sorted violations, HTML error counts, and `@HolmDigital/engine` branding.
33
+ - **Type-Safe Results**: Scan results return fully typed `EnrichedReport[]` with `failingNodes` and `legalContext` — zero `as any` casts in the pipeline.
34
+ - **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.
33
35
  - **TypeScript**: Written in TypeScript with full type definitions included.
34
36
 
35
37
  ## Installation
@@ -89,7 +91,7 @@ npx hd-a11y-scan https://example.com --json
89
91
  "url": "https://example.com",
90
92
  "timestamp": "2026-01-13T17:05:11.749Z",
91
93
  "metadata": {
92
- "engineVersion": "2.1.3",
94
+ "engineVersion": "2.1.5",
93
95
  "axeCoreVersion": "4.11.1",
94
96
  "standardsVersion": "1.2.3",
95
97
  "scanDuration": 2891,
@@ -1,6 +1,7 @@
1
1
  import {
2
+ __dirname,
2
3
  __require
3
- } from "./chunk-Y6FXYEAI.mjs";
4
+ } from "./chunk-DIBTSSLZ.mjs";
4
5
 
5
6
  // src/core/virtual-dom.ts
6
7
  var VirtualDOMBuilder = class {
@@ -136,17 +137,8 @@ var HtmlValidator = class {
136
137
 
137
138
  // src/core/regulatory-scanner.ts
138
139
  import { readFileSync } from "fs";
139
- import { resolve, dirname } from "path";
140
- import { fileURLToPath } from "url";
141
140
  function getEngineVersion() {
142
- try {
143
- const dir = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
144
- const pkgPath = resolve(dir, "..", "package.json");
145
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
146
- return pkg.version;
147
- } catch {
148
- return "2.1.1";
149
- }
141
+ return "2.1.7";
150
142
  }
151
143
  function getStandardsVersion() {
152
144
  try {
@@ -204,7 +196,7 @@ var RegulatoryScanner = class {
204
196
  retries--;
205
197
  if (retries === 0) throw e;
206
198
  this.log(`Navigation failed, retrying... (${retries} attempts left)`);
207
- await new Promise((resolve2) => setTimeout(resolve2, 2e3));
199
+ await new Promise((resolve) => setTimeout(resolve, 2e3));
208
200
  }
209
201
  }
210
202
  try {
@@ -279,7 +271,7 @@ var RegulatoryScanner = class {
279
271
  async enrichResults(axeResults) {
280
272
  const reports = [];
281
273
  const { searchRulesByTags, generateRegulatoryReport, getConvergenceRule } = await import("@holmdigital/standards");
282
- const { getCurrentLang } = await import("./i18n-JLPALD7H.mjs");
274
+ const { getCurrentLang } = await import("./i18n-6XB3K2PH.mjs");
283
275
  const lang = getCurrentLang();
284
276
  for (const violation of axeResults.violations) {
285
277
  let report = generateRegulatoryReport(violation.id, lang);
@@ -503,45 +495,61 @@ import { AccessibilityStatement } from "@holmdigital/components";
503
495
  import { ENFORCEMENT_BODIES } from "@holmdigital/standards";
504
496
  import fs from "fs/promises";
505
497
  import path from "path";
506
- import { fileURLToPath as fileURLToPath2 } from "url";
507
- var __dirname_esm = typeof __dirname === "undefined" ? path.dirname(fileURLToPath2(import.meta.url)) : __dirname;
498
+ var EVALUATION_METHOD = {
499
+ sv: "Automatiserad granskning via @holmdigital/engine",
500
+ en: "Automated scan via @holmdigital/engine",
501
+ no: "Automatisert gjennomgang via @holmdigital/engine",
502
+ nb: "Automatisert gjennomgang via @holmdigital/engine",
503
+ fi: "Automaattinen tarkistus @holmdigital/engine-ty\xF6kalulla",
504
+ da: "Automatiseret gennemgang via @holmdigital/engine",
505
+ de: "Automatisierte Pr\xFCfung mit @holmdigital/engine",
506
+ fr: "Analyse automatis\xE9e via @holmdigital/engine",
507
+ es: "An\xE1lisis automatizado mediante @holmdigital/engine",
508
+ nl: "Geautomatiseerde controle via @holmdigital/engine",
509
+ "en-gb": "Automated scan via @holmdigital/engine",
510
+ "en-us": "Automated scan via @holmdigital/engine",
511
+ "en-ca": "Automated scan via @holmdigital/engine"
512
+ };
513
+ var STATUS_LABELS = {
514
+ sv: { full: "Fullt ut f\xF6renlig", partial: "Delvis f\xF6renlig", "non-compliant": "Inte f\xF6renlig" },
515
+ en: { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
516
+ no: { full: "Helt i samsvar", partial: "Delvis i samsvar", "non-compliant": "Ikke i samsvar" },
517
+ nb: { full: "Helt i samsvar", partial: "Delvis i samsvar", "non-compliant": "Ikke i samsvar" },
518
+ fi: { full: "T\xE4ysin saavutettava", partial: "Osittain saavutettava", "non-compliant": "Ei saavutettava" },
519
+ da: { full: "Fuldt ud i overensstemmelse", partial: "Delvist i overensstemmelse", "non-compliant": "Ikke i overensstemmelse" },
520
+ de: { full: "Vollst\xE4ndig konform", partial: "Teilweise konform", "non-compliant": "Nicht konform" },
521
+ fr: { full: "Totalement conforme", partial: "Partiellement conforme", "non-compliant": "Non conforme" },
522
+ es: { full: "Plenamente conforme", partial: "Parcialmente conforme", "non-compliant": "No conforme" },
523
+ nl: { full: "Volledig conform", partial: "Gedeeltelijk conform", "non-compliant": "Niet conform" },
524
+ "en-gb": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
525
+ "en-us": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
526
+ "en-ca": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" }
527
+ };
528
+ var RESPONSE_TIME_DEFAULT = {
529
+ sv: "2 dagar",
530
+ en: "2 days",
531
+ no: "2 dager",
532
+ nb: "2 dager",
533
+ fi: "2 p\xE4iv\xE4\xE4",
534
+ da: "2 dage",
535
+ de: "2 Tage",
536
+ fr: "2 jours",
537
+ es: "2 d\xEDas",
538
+ nl: "2 dagen",
539
+ "en-gb": "2 days",
540
+ "en-us": "2 days",
541
+ "en-ca": "2 days"
542
+ };
508
543
  async function generateStatementContent(result, lang = "en", format = "html", metadata) {
544
+ const templatePath = path.join(__dirname, "templates", `${lang}.json`);
509
545
  let template;
510
- const possibleTemplatePaths = [
511
- path.join(__dirname_esm, "templates", `${lang}.json`),
512
- path.join(__dirname_esm, "../src/reporting/templates", `${lang}.json`),
513
- path.join(process.cwd(), "packages/engine/src/reporting/templates", `${lang}.json`)
514
- ];
515
- let loaded = false;
516
- for (const p of possibleTemplatePaths) {
517
- try {
518
- const data = await fs.readFile(p, "utf-8");
519
- template = JSON.parse(data);
520
- loaded = true;
521
- break;
522
- } catch (e) {
523
- continue;
524
- }
525
- }
526
- if (!loaded) {
527
- const fallbackPaths = [
528
- path.join(__dirname_esm, "templates", "en.json"),
529
- path.join(__dirname_esm, "../src/reporting/templates", "en.json"),
530
- path.join(process.cwd(), "packages/engine/src/reporting/templates", "en.json")
531
- ];
532
- for (const p of fallbackPaths) {
533
- try {
534
- const data = await fs.readFile(p, "utf-8");
535
- template = JSON.parse(data);
536
- loaded = true;
537
- break;
538
- } catch (e) {
539
- continue;
540
- }
541
- }
542
- }
543
- if (!loaded) {
544
- throw new Error(`Accessibility statement templates missing. Looked in: ${possibleTemplatePaths.join(", ")}`);
546
+ try {
547
+ const data = await fs.readFile(templatePath, "utf-8");
548
+ template = JSON.parse(data);
549
+ } catch {
550
+ throw new Error(
551
+ `Accessibility statement template not found for locale "${lang}". Expected file at: ${templatePath}`
552
+ );
545
553
  }
546
554
  let complianceLevel = "full";
547
555
  if (result.stats.critical > 0 || result.legalSummary && result.legalSummary.eaaDeadlineViolations > 0) {
@@ -563,6 +571,9 @@ async function generateStatementContent(result, lang = "en", format = "html", me
563
571
  if (result.url.endsWith(".dk")) country = "DK";
564
572
  if (result.url.endsWith(".fi")) country = "FI";
565
573
  if (result.url.endsWith(".de")) country = "DE";
574
+ if (result.url.endsWith(".uk")) country = "GB";
575
+ if (result.url.endsWith(".us")) country = "US";
576
+ if (result.url.endsWith(".ca")) country = "CA";
566
577
  }
567
578
  const sector = "public";
568
579
  let logoUrl;
@@ -592,7 +603,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
592
603
  complianceLevel,
593
604
  lastReviewDate: /* @__PURE__ */ new Date(),
594
605
  assessmentDate: /* @__PURE__ */ new Date(),
595
- evaluationMethod: lang === "sv" ? "Automatiserad granskning via @holmdigital/engine" : "Automated Scan via @holmdigital/engine",
606
+ evaluationMethod: EVALUATION_METHOD[lang] || EVALUATION_METHOD["en"],
596
607
  generatorTool: {
597
608
  name: "HolmDigital Regulatory Engine",
598
609
  url: "https://holmdigital.se"
@@ -600,7 +611,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
600
611
  logoUrl,
601
612
  contactEmail: metadata?.contactEmail || "hej@holmdigital.se",
602
613
  phoneNumber: metadata?.phoneNumber || "070-123 45 67",
603
- responseTime: metadata?.responseTime || (lang === "sv" ? "2 dagar" : "2 days"),
614
+ responseTime: metadata?.responseTime || RESPONSE_TIME_DEFAULT[lang] || RESPONSE_TIME_DEFAULT["en"],
604
615
  nonComplianceItems,
605
616
  locale: lang,
606
617
  badgeUrl: generateBadgeUrl(result.score) || void 0,
@@ -626,10 +637,11 @@ async function generateStatementContent(result, lang = "en", format = "html", me
626
637
  </html>`;
627
638
  } else {
628
639
  const dateStr = props.lastReviewDate.toISOString().split("T")[0];
640
+ const labels = STATUS_LABELS[lang] || STATUS_LABELS["en"];
629
641
  const statusMap = {
630
- "full": lang === "sv" ? "Fullt ut f\xF6renlig" : lang === "no" || lang === "nb" ? "Helt i samsvar" : lang === "da" ? "Fuldt ud i overensstemmelse" : "Fully compliant",
631
- "partial": lang === "sv" ? "Delvis f\xF6renlig" : lang === "no" || lang === "nb" ? "Delvis i samsvar" : lang === "da" ? "Delvist i overensstemmelse" : "Partially compliant",
632
- "non-compliant": lang === "sv" ? "Inte f\xF6renlig" : lang === "no" || lang === "nb" ? "Ikke i samsvar" : lang === "da" ? "Ikke i overensstemmelse" : "Non-compliant"
642
+ "full": labels["full"],
643
+ "partial": labels["partial"],
644
+ "non-compliant": labels["non-compliant"]
633
645
  };
634
646
  const substitutions = {
635
647
  statusString: statusMap[complianceLevel],
@@ -641,6 +653,8 @@ async function generateStatementContent(result, lang = "en", format = "html", me
641
653
  "{<e-postadress>}": props.contactEmail || "",
642
654
  "{<e-mailosoite>}": props.contactEmail || "",
643
655
  "{<e-mailadresse>}": props.contactEmail || "",
656
+ "{<e-mailadres>}": props.contactEmail || "",
657
+ "{<e-postadresse>}": props.contactEmail || "",
644
658
  "{<e-mail address>}": props.contactEmail || "",
645
659
  "{<email address>}": props.contactEmail || "",
646
660
  "{<telefonnummer>}": props.phoneNumber || "",
@@ -660,6 +674,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
660
674
  "{<assessment date>}": dateStr,
661
675
  "{<uppdateringsdatum>}": dateStr,
662
676
  "{<oppdateringsdato>}": dateStr,
677
+ "{<opdateringsdato>}": dateStr,
663
678
  "{<p\xE4ivitysp\xE4iv\xE4>}": dateStr,
664
679
  "{<updatedatum>}": dateStr,
665
680
  "{<aktualisierungsdatum>}": dateStr,
@@ -673,13 +688,18 @@ async function generateStatementContent(result, lang = "en", format = "html", me
673
688
  "{<ver\xF6ffentlichungsdatum>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
674
689
  "{<date_publication>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
675
690
  "{<fecha_publicacion>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
691
+ "{<offentligg\xF8relsesdato>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
676
692
  "{<publish date>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
677
693
  "{<metod>}": props.evaluationMethod || "Automated Scan",
678
694
  "{<metodi>}": props.evaluationMethod || "Automated Scan",
679
695
  "{<methode>}": props.evaluationMethod || "Automated Scan",
696
+ "{<metode>}": props.evaluationMethod || "Automated Scan",
697
+ "{<metodo>}": props.evaluationMethod || "Automated Scan",
698
+ "{<m\xE9thode>}": props.evaluationMethod || "Automated Scan",
680
699
  "{<m\xE9todo>}": props.evaluationMethod || "Automated Scan",
681
700
  "{<method>}": props.evaluationMethod || "Automated Scan",
682
701
  "{<extern akt\xF6r>}": props.generatorTool?.name || "HolmDigital Engine",
702
+ "{<ekstern akt\xF8r>}": props.generatorTool?.name || "HolmDigital Engine",
683
703
  "{<ekstern aktor>}": props.generatorTool?.name || "HolmDigital Engine",
684
704
  "{<ulkoinen taho>}": props.generatorTool?.name || "HolmDigital Engine",
685
705
  "{<externe partij>}": props.generatorTool?.name || "HolmDigital Engine",
@@ -711,6 +731,9 @@ async function generateStatementContent(result, lang = "en", format = "html", me
711
731
  }
712
732
  return content2;
713
733
  });
734
+ processed = processed.replace(/\{<[^>]+>\}/g, (match) => {
735
+ return substitutions[match] !== void 0 ? substitutions[match] : match;
736
+ });
714
737
  processed = processed.replace(/\{([^{}]*?)\}/g, (_match, content2) => {
715
738
  const parts = content2.split("/");
716
739
  if (parts.length >= 2) {
@@ -719,8 +742,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
719
742
  if (complianceLevel === "non-compliant") idx = parts.length > 2 ? 2 : 1;
720
743
  return parts[idx].trim();
721
744
  }
722
- const key = `{${content2}}`;
723
- return substitutions[key] !== void 0 ? substitutions[key] : _match;
745
+ return _match;
724
746
  });
725
747
  return processed;
726
748
  };
@@ -5,6 +5,14 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
5
  throw Error('Dynamic require of "' + x + '" is not supported');
6
6
  });
7
7
 
8
+ // ../../node_modules/tsup/assets/esm_shims.js
9
+ import path from "path";
10
+ import { fileURLToPath } from "url";
11
+ var getFilename = () => fileURLToPath(import.meta.url);
12
+ var getDirname = () => path.dirname(getFilename());
13
+ var __dirname = /* @__PURE__ */ getDirname();
14
+
8
15
  export {
9
- __require
16
+ __require,
17
+ __dirname
10
18
  };
@@ -34,7 +34,7 @@ var en_default = {
34
34
  detailed_violations: "Detailed Violations",
35
35
  prescriptive_fix: "\u{1F4A1} Prescriptive Fix",
36
36
  use: "Use",
37
- footer: "Generated by @holmdigital/engine v0.1.0 \u2022 Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
37
+ footer: "Generated by @holmdigital/engine v{version} \u2022 Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
38
38
  }
39
39
  };
40
40
 
@@ -74,7 +74,7 @@ var sv_default = {
74
74
  detailed_violations: "Detaljerade brister",
75
75
  prescriptive_fix: "\u{1F4A1} Preskriptiv L\xF6sning",
76
76
  use: "Anv\xE4nd",
77
- footer: "Genererad av @holmdigital/engine v0.1.0 \u2022 Standarder: WCAG 2.1 AA, EN 301 549, DOS-lagen"
77
+ footer: "Genererad av @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, DOS-lagen"
78
78
  }
79
79
  };
80
80
 
@@ -114,7 +114,7 @@ var de_default = {
114
114
  detailed_violations: "Detaillierte Verst\xF6\xDFe",
115
115
  prescriptive_fix: "\u{1F4A1} Vorschriftsm\xE4\xDFige L\xF6sung",
116
116
  use: "Verwenden",
117
- footer: "Generiert von @holmdigital/engine v0.1.0 \u2022 Standards: WCAG 2.1 AA, EN 301 549, BITV 2.0"
117
+ footer: "Generiert von @holmdigital/engine v{version} \u2022 Standards: WCAG 2.1 AA, EN 301 549, BITV 2.0"
118
118
  }
119
119
  };
120
120
 
@@ -154,7 +154,7 @@ var fr_default = {
154
154
  detailed_violations: "Violations D\xE9taill\xE9es",
155
155
  prescriptive_fix: "\u{1F4A1} Solution Prescriptive",
156
156
  use: "Utiliser",
157
- footer: "G\xE9n\xE9r\xE9 par @holmdigital/engine v0.1.0 \u2022 Standards : WCAG 2.1 AA, EN 301 549, RGAA"
157
+ footer: "G\xE9n\xE9r\xE9 par @holmdigital/engine v{version} \u2022 Standards : WCAG 2.1 AA, EN 301 549, RGAA"
158
158
  }
159
159
  };
160
160
 
@@ -194,7 +194,7 @@ var es_default = {
194
194
  detailed_violations: "Violaciones Detalladas",
195
195
  prescriptive_fix: "\u{1F4A1} Soluci\xF3n Prescriptiva",
196
196
  use: "Usar",
197
- footer: "Generado por @holmdigital/engine v0.1.0 \u2022 Est\xE1ndares: WCAG 2.1 AA, EN 301 549, UNE 139803"
197
+ footer: "Generado por @holmdigital/engine v{version} \u2022 Est\xE1ndares: WCAG 2.1 AA, EN 301 549, UNE 139803"
198
198
  }
199
199
  };
200
200
 
@@ -234,7 +234,7 @@ var fi_default = {
234
234
  detailed_violations: "Yksityiskohtaiset rikkomukset",
235
235
  prescriptive_fix: "\u{1F4A1} Ehdotettu korjaus",
236
236
  use: "K\xE4yt\xE4",
237
- footer: "Luonut @holmdigital/engine v0.1.0 \u2022 Standardit: WCAG 2.1 AA, EN 301 549, Digipalvelulaki"
237
+ footer: "Luonut @holmdigital/engine v{version} \u2022 Standardit: WCAG 2.1 AA, EN 301 549, Digipalvelulaki"
238
238
  }
239
239
  };
240
240
 
@@ -274,7 +274,7 @@ var dk_default = {
274
274
  detailed_violations: "Detaljerede Overtr\xE6delser",
275
275
  prescriptive_fix: "\u{1F4A1} Foresl\xE5et L\xF8sning",
276
276
  use: "Brug",
277
- footer: "Genereret af @holmdigital/engine v0.1.0 \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Lov om tilg\xE6ngelighed"
277
+ footer: "Genereret af @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Lov om tilg\xE6ngelighed"
278
278
  }
279
279
  };
280
280
 
@@ -314,7 +314,7 @@ var no_default = {
314
314
  detailed_violations: "Detaljerte Brudd",
315
315
  prescriptive_fix: "\u{1F4A1} Foresl\xE5tt L\xF8sning",
316
316
  use: "Bruk",
317
- footer: "Generert av @holmdigital/engine v0.1.0 \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Uu-tilsynet"
317
+ footer: "Generert av @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Uu-tilsynet"
318
318
  }
319
319
  };
320
320
 
@@ -354,7 +354,7 @@ var nl_default = {
354
354
  detailed_violations: "Gedetailleerde overtredingen",
355
355
  prescriptive_fix: "\u{1F4A1} Voorgeschreven oplossing",
356
356
  use: "Gebruik",
357
- footer: "Gegenereerd door @holmdigital/engine v0.1.0 \u2022 Standaarden: WCAG 2.1 AA, EN 301 549, Besluit digitale toegankelijkheid overheid"
357
+ footer: "Gegenereerd door @holmdigital/engine v{version} \u2022 Standaarden: WCAG 2.1 AA, EN 301 549, Besluit digitale toegankelijkheid overheid"
358
358
  }
359
359
  };
360
360