@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/dist/cli/index.js CHANGED
@@ -30,6 +30,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
+ // ../../node_modules/tsup/assets/cjs_shims.js
34
+ var init_cjs_shims = __esm({
35
+ "../../node_modules/tsup/assets/cjs_shims.js"() {
36
+ "use strict";
37
+ }
38
+ });
39
+
33
40
  // src/locales/en.json
34
41
  var en_default;
35
42
  var init_en = __esm({
@@ -69,7 +76,7 @@ var init_en = __esm({
69
76
  detailed_violations: "Detailed Violations",
70
77
  prescriptive_fix: "\u{1F4A1} Prescriptive Fix",
71
78
  use: "Use",
72
- footer: "Generated by @holmdigital/engine v0.1.0 \u2022 Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
79
+ footer: "Generated by @holmdigital/engine v{version} \u2022 Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
73
80
  }
74
81
  };
75
82
  }
@@ -114,7 +121,7 @@ var init_sv = __esm({
114
121
  detailed_violations: "Detaljerade brister",
115
122
  prescriptive_fix: "\u{1F4A1} Preskriptiv L\xF6sning",
116
123
  use: "Anv\xE4nd",
117
- footer: "Genererad av @holmdigital/engine v0.1.0 \u2022 Standarder: WCAG 2.1 AA, EN 301 549, DOS-lagen"
124
+ footer: "Genererad av @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, DOS-lagen"
118
125
  }
119
126
  };
120
127
  }
@@ -159,7 +166,7 @@ var init_de = __esm({
159
166
  detailed_violations: "Detaillierte Verst\xF6\xDFe",
160
167
  prescriptive_fix: "\u{1F4A1} Vorschriftsm\xE4\xDFige L\xF6sung",
161
168
  use: "Verwenden",
162
- footer: "Generiert von @holmdigital/engine v0.1.0 \u2022 Standards: WCAG 2.1 AA, EN 301 549, BITV 2.0"
169
+ footer: "Generiert von @holmdigital/engine v{version} \u2022 Standards: WCAG 2.1 AA, EN 301 549, BITV 2.0"
163
170
  }
164
171
  };
165
172
  }
@@ -204,7 +211,7 @@ var init_fr = __esm({
204
211
  detailed_violations: "Violations D\xE9taill\xE9es",
205
212
  prescriptive_fix: "\u{1F4A1} Solution Prescriptive",
206
213
  use: "Utiliser",
207
- footer: "G\xE9n\xE9r\xE9 par @holmdigital/engine v0.1.0 \u2022 Standards : WCAG 2.1 AA, EN 301 549, RGAA"
214
+ footer: "G\xE9n\xE9r\xE9 par @holmdigital/engine v{version} \u2022 Standards : WCAG 2.1 AA, EN 301 549, RGAA"
208
215
  }
209
216
  };
210
217
  }
@@ -249,7 +256,7 @@ var init_es = __esm({
249
256
  detailed_violations: "Violaciones Detalladas",
250
257
  prescriptive_fix: "\u{1F4A1} Soluci\xF3n Prescriptiva",
251
258
  use: "Usar",
252
- footer: "Generado por @holmdigital/engine v0.1.0 \u2022 Est\xE1ndares: WCAG 2.1 AA, EN 301 549, UNE 139803"
259
+ footer: "Generado por @holmdigital/engine v{version} \u2022 Est\xE1ndares: WCAG 2.1 AA, EN 301 549, UNE 139803"
253
260
  }
254
261
  };
255
262
  }
@@ -294,7 +301,7 @@ var init_fi = __esm({
294
301
  detailed_violations: "Yksityiskohtaiset rikkomukset",
295
302
  prescriptive_fix: "\u{1F4A1} Ehdotettu korjaus",
296
303
  use: "K\xE4yt\xE4",
297
- footer: "Luonut @holmdigital/engine v0.1.0 \u2022 Standardit: WCAG 2.1 AA, EN 301 549, Digipalvelulaki"
304
+ footer: "Luonut @holmdigital/engine v{version} \u2022 Standardit: WCAG 2.1 AA, EN 301 549, Digipalvelulaki"
298
305
  }
299
306
  };
300
307
  }
@@ -339,7 +346,7 @@ var init_dk = __esm({
339
346
  detailed_violations: "Detaljerede Overtr\xE6delser",
340
347
  prescriptive_fix: "\u{1F4A1} Foresl\xE5et L\xF8sning",
341
348
  use: "Brug",
342
- footer: "Genereret af @holmdigital/engine v0.1.0 \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Lov om tilg\xE6ngelighed"
349
+ footer: "Genereret af @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Lov om tilg\xE6ngelighed"
343
350
  }
344
351
  };
345
352
  }
@@ -384,7 +391,7 @@ var init_no = __esm({
384
391
  detailed_violations: "Detaljerte Brudd",
385
392
  prescriptive_fix: "\u{1F4A1} Foresl\xE5tt L\xF8sning",
386
393
  use: "Bruk",
387
- footer: "Generert av @holmdigital/engine v0.1.0 \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Uu-tilsynet"
394
+ footer: "Generert av @holmdigital/engine v{version} \u2022 Standarder: WCAG 2.1 AA, EN 301 549, Uu-tilsynet"
388
395
  }
389
396
  };
390
397
  }
@@ -429,7 +436,7 @@ var init_nl = __esm({
429
436
  detailed_violations: "Gedetailleerde overtredingen",
430
437
  prescriptive_fix: "\u{1F4A1} Voorgeschreven oplossing",
431
438
  use: "Gebruik",
432
- footer: "Gegenereerd door @holmdigital/engine v0.1.0 \u2022 Standaarden: WCAG 2.1 AA, EN 301 549, Besluit digitale toegankelijkheid overheid"
439
+ footer: "Gegenereerd door @holmdigital/engine v{version} \u2022 Standaarden: WCAG 2.1 AA, EN 301 549, Besluit digitale toegankelijkheid overheid"
433
440
  }
434
441
  };
435
442
  }
@@ -484,6 +491,7 @@ var locales, currentLang;
484
491
  var init_i18n = __esm({
485
492
  "src/i18n/index.ts"() {
486
493
  "use strict";
494
+ init_cjs_shims();
487
495
  init_en();
488
496
  init_sv();
489
497
  init_de();
@@ -542,6 +550,7 @@ Fix: ${report.remediation.component ? `Use <${report.remediation.component} />`
542
550
  var init_github_actions = __esm({
543
551
  "src/reporting/github-actions.ts"() {
544
552
  "use strict";
553
+ init_cjs_shims();
545
554
  }
546
555
  });
547
556
 
@@ -625,19 +634,23 @@ function escapeXML(unsafe) {
625
634
  var init_junit_generator = __esm({
626
635
  "src/reporting/junit-generator.ts"() {
627
636
  "use strict";
637
+ init_cjs_shims();
628
638
  }
629
639
  });
630
640
 
631
641
  // src/cli/index.ts
642
+ init_cjs_shims();
632
643
  var import_commander = require("commander");
633
644
  var import_chalk = __toESM(require("chalk"));
634
645
  var import_ora = __toESM(require("ora"));
635
646
 
636
647
  // src/core/regulatory-scanner.ts
648
+ init_cjs_shims();
637
649
  var import_axe_core = __toESM(require("axe-core"));
638
650
  var import_puppeteer = __toESM(require("puppeteer"));
639
651
 
640
652
  // src/core/virtual-dom.ts
653
+ init_cjs_shims();
641
654
  var VirtualDOMBuilder = class {
642
655
  page;
643
656
  constructor(page) {
@@ -728,6 +741,7 @@ var VirtualDOMBuilder = class {
728
741
  };
729
742
 
730
743
  // src/core/html-validator.ts
744
+ init_cjs_shims();
731
745
  var import_html_validate = require("html-validate");
732
746
  var HtmlValidator = class {
733
747
  validator;
@@ -767,18 +781,8 @@ var HtmlValidator = class {
767
781
 
768
782
  // src/core/regulatory-scanner.ts
769
783
  var import_node_fs = require("fs");
770
- var import_node_path = require("path");
771
- var import_node_url = require("url");
772
- var import_meta = {};
773
784
  function getEngineVersion() {
774
- try {
775
- const dir = typeof __dirname !== "undefined" ? __dirname : (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
776
- const pkgPath = (0, import_node_path.resolve)(dir, "..", "package.json");
777
- const pkg = JSON.parse((0, import_node_fs.readFileSync)(pkgPath, "utf-8"));
778
- return pkg.version;
779
- } catch {
780
- return "2.1.1";
781
- }
785
+ return "2.1.7";
782
786
  }
783
787
  function getStandardsVersion() {
784
788
  try {
@@ -836,7 +840,7 @@ var RegulatoryScanner = class {
836
840
  retries--;
837
841
  if (retries === 0) throw e;
838
842
  this.log(`Navigation failed, retrying... (${retries} attempts left)`);
839
- await new Promise((resolve2) => setTimeout(resolve2, 2e3));
843
+ await new Promise((resolve) => setTimeout(resolve, 2e3));
840
844
  }
841
845
  }
842
846
  try {
@@ -1044,6 +1048,7 @@ var RegulatoryScanner = class {
1044
1048
  };
1045
1049
 
1046
1050
  // src/automation/pseudo-automation.ts
1051
+ init_cjs_shims();
1047
1052
  var PseudoAutomationEngine = class {
1048
1053
  /**
1049
1054
  * Generera ett Playwright-testskript baserat på en rapport
@@ -1111,7 +1116,11 @@ test('${testName}', async ({ page }) => {
1111
1116
  }
1112
1117
  };
1113
1118
 
1119
+ // src/reporting/html-template.ts
1120
+ init_cjs_shims();
1121
+
1114
1122
  // src/reporting/badge-generator.ts
1123
+ init_cjs_shims();
1115
1124
  var BADGE_COLOR = "00703C";
1116
1125
  var BADGE_BASE_URL = "https://img.shields.io/badge/HolmDigital_Engine";
1117
1126
  function generateBadgeUrl(score) {
@@ -1130,13 +1139,30 @@ function generateBadgeMarkdown(score) {
1130
1139
 
1131
1140
  // src/reporting/html-template.ts
1132
1141
  init_i18n();
1142
+ var LOCALE_TO_INTL = {
1143
+ sv: "sv-SE",
1144
+ en: "en-US",
1145
+ no: "nb-NO",
1146
+ nb: "nb-NO",
1147
+ fi: "fi-FI",
1148
+ da: "da-DK",
1149
+ dk: "da-DK",
1150
+ de: "de-DE",
1151
+ fr: "fr-FR",
1152
+ es: "es-ES",
1153
+ nl: "nl-NL",
1154
+ "en-gb": "en-GB",
1155
+ "en-us": "en-US",
1156
+ "en-ca": "en-CA"
1157
+ };
1133
1158
  function generateReportHTML(result) {
1134
1159
  const criticalCount = result.stats.critical;
1135
1160
  const highCount = result.stats.high;
1136
1161
  const htmlErrorsCount = result.htmlValidation?.errors?.length ?? 0;
1137
1162
  const scoreColor = result.score > 90 ? "#16a34a" : result.score > 70 ? "#eab308" : "#dc2626";
1138
1163
  const formatDate = (dateString) => {
1139
- return new Date(dateString).toLocaleDateString(getCurrentLang() === "sv" ? "sv-SE" : "en-US", {
1164
+ const intlLocale = LOCALE_TO_INTL[getCurrentLang()] || "en-US";
1165
+ return new Date(dateString).toLocaleDateString(intlLocale, {
1140
1166
  year: "numeric",
1141
1167
  month: "long",
1142
1168
  day: "numeric",
@@ -1408,7 +1434,7 @@ function generateReportHTML(result) {
1408
1434
  }).join("")}
1409
1435
 
1410
1436
  <footer>
1411
- ${t("report.footer")}
1437
+ ${t("report.footer", { version: getEngineVersion() })}
1412
1438
  </footer>
1413
1439
  </body>
1414
1440
  </html>
@@ -1416,6 +1442,7 @@ function generateReportHTML(result) {
1416
1442
  }
1417
1443
 
1418
1444
  // src/reporting/pdf-generator.ts
1445
+ init_cjs_shims();
1419
1446
  var import_puppeteer2 = __toESM(require("puppeteer"));
1420
1447
  async function generatePDF(htmlContent, outputPath) {
1421
1448
  const browser = await import_puppeteer2.default.launch({
@@ -1445,52 +1472,68 @@ async function generatePDF(htmlContent, outputPath) {
1445
1472
  }
1446
1473
 
1447
1474
  // src/reporting/statement-generator.ts
1475
+ init_cjs_shims();
1448
1476
  var import_react = __toESM(require("react"));
1449
1477
  var import_server = require("react-dom/server");
1450
1478
  var import_components = require("@holmdigital/components");
1451
1479
  var import_standards = require("@holmdigital/standards");
1452
1480
  var import_promises = __toESM(require("fs/promises"));
1453
1481
  var import_path = __toESM(require("path"));
1454
- var import_node_url2 = require("url");
1455
- var import_meta2 = {};
1456
- var __dirname_esm = typeof __dirname === "undefined" ? import_path.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url)) : __dirname;
1482
+ var EVALUATION_METHOD = {
1483
+ sv: "Automatiserad granskning via @holmdigital/engine",
1484
+ en: "Automated scan via @holmdigital/engine",
1485
+ no: "Automatisert gjennomgang via @holmdigital/engine",
1486
+ nb: "Automatisert gjennomgang via @holmdigital/engine",
1487
+ fi: "Automaattinen tarkistus @holmdigital/engine-ty\xF6kalulla",
1488
+ da: "Automatiseret gennemgang via @holmdigital/engine",
1489
+ de: "Automatisierte Pr\xFCfung mit @holmdigital/engine",
1490
+ fr: "Analyse automatis\xE9e via @holmdigital/engine",
1491
+ es: "An\xE1lisis automatizado mediante @holmdigital/engine",
1492
+ nl: "Geautomatiseerde controle via @holmdigital/engine",
1493
+ "en-gb": "Automated scan via @holmdigital/engine",
1494
+ "en-us": "Automated scan via @holmdigital/engine",
1495
+ "en-ca": "Automated scan via @holmdigital/engine"
1496
+ };
1497
+ var STATUS_LABELS = {
1498
+ sv: { full: "Fullt ut f\xF6renlig", partial: "Delvis f\xF6renlig", "non-compliant": "Inte f\xF6renlig" },
1499
+ en: { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
1500
+ no: { full: "Helt i samsvar", partial: "Delvis i samsvar", "non-compliant": "Ikke i samsvar" },
1501
+ nb: { full: "Helt i samsvar", partial: "Delvis i samsvar", "non-compliant": "Ikke i samsvar" },
1502
+ fi: { full: "T\xE4ysin saavutettava", partial: "Osittain saavutettava", "non-compliant": "Ei saavutettava" },
1503
+ da: { full: "Fuldt ud i overensstemmelse", partial: "Delvist i overensstemmelse", "non-compliant": "Ikke i overensstemmelse" },
1504
+ de: { full: "Vollst\xE4ndig konform", partial: "Teilweise konform", "non-compliant": "Nicht konform" },
1505
+ fr: { full: "Totalement conforme", partial: "Partiellement conforme", "non-compliant": "Non conforme" },
1506
+ es: { full: "Plenamente conforme", partial: "Parcialmente conforme", "non-compliant": "No conforme" },
1507
+ nl: { full: "Volledig conform", partial: "Gedeeltelijk conform", "non-compliant": "Niet conform" },
1508
+ "en-gb": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
1509
+ "en-us": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
1510
+ "en-ca": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" }
1511
+ };
1512
+ var RESPONSE_TIME_DEFAULT = {
1513
+ sv: "2 dagar",
1514
+ en: "2 days",
1515
+ no: "2 dager",
1516
+ nb: "2 dager",
1517
+ fi: "2 p\xE4iv\xE4\xE4",
1518
+ da: "2 dage",
1519
+ de: "2 Tage",
1520
+ fr: "2 jours",
1521
+ es: "2 d\xEDas",
1522
+ nl: "2 dagen",
1523
+ "en-gb": "2 days",
1524
+ "en-us": "2 days",
1525
+ "en-ca": "2 days"
1526
+ };
1457
1527
  async function generateStatementContent(result, lang = "en", format = "html", metadata) {
1528
+ const templatePath = import_path.default.join(__dirname, "templates", `${lang}.json`);
1458
1529
  let template;
1459
- const possibleTemplatePaths = [
1460
- import_path.default.join(__dirname_esm, "templates", `${lang}.json`),
1461
- import_path.default.join(__dirname_esm, "../src/reporting/templates", `${lang}.json`),
1462
- import_path.default.join(process.cwd(), "packages/engine/src/reporting/templates", `${lang}.json`)
1463
- ];
1464
- let loaded = false;
1465
- for (const p of possibleTemplatePaths) {
1466
- try {
1467
- const data = await import_promises.default.readFile(p, "utf-8");
1468
- template = JSON.parse(data);
1469
- loaded = true;
1470
- break;
1471
- } catch (e) {
1472
- continue;
1473
- }
1474
- }
1475
- if (!loaded) {
1476
- const fallbackPaths = [
1477
- import_path.default.join(__dirname_esm, "templates", "en.json"),
1478
- import_path.default.join(__dirname_esm, "../src/reporting/templates", "en.json"),
1479
- import_path.default.join(process.cwd(), "packages/engine/src/reporting/templates", "en.json")
1480
- ];
1481
- for (const p of fallbackPaths) {
1482
- try {
1483
- const data = await import_promises.default.readFile(p, "utf-8");
1484
- template = JSON.parse(data);
1485
- loaded = true;
1486
- break;
1487
- } catch (e) {
1488
- continue;
1489
- }
1490
- }
1491
- }
1492
- if (!loaded) {
1493
- throw new Error(`Accessibility statement templates missing. Looked in: ${possibleTemplatePaths.join(", ")}`);
1530
+ try {
1531
+ const data = await import_promises.default.readFile(templatePath, "utf-8");
1532
+ template = JSON.parse(data);
1533
+ } catch {
1534
+ throw new Error(
1535
+ `Accessibility statement template not found for locale "${lang}". Expected file at: ${templatePath}`
1536
+ );
1494
1537
  }
1495
1538
  let complianceLevel = "full";
1496
1539
  if (result.stats.critical > 0 || result.legalSummary && result.legalSummary.eaaDeadlineViolations > 0) {
@@ -1512,6 +1555,9 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1512
1555
  if (result.url.endsWith(".dk")) country = "DK";
1513
1556
  if (result.url.endsWith(".fi")) country = "FI";
1514
1557
  if (result.url.endsWith(".de")) country = "DE";
1558
+ if (result.url.endsWith(".uk")) country = "GB";
1559
+ if (result.url.endsWith(".us")) country = "US";
1560
+ if (result.url.endsWith(".ca")) country = "CA";
1515
1561
  }
1516
1562
  const sector = "public";
1517
1563
  let logoUrl;
@@ -1541,7 +1587,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1541
1587
  complianceLevel,
1542
1588
  lastReviewDate: /* @__PURE__ */ new Date(),
1543
1589
  assessmentDate: /* @__PURE__ */ new Date(),
1544
- evaluationMethod: lang === "sv" ? "Automatiserad granskning via @holmdigital/engine" : "Automated Scan via @holmdigital/engine",
1590
+ evaluationMethod: EVALUATION_METHOD[lang] || EVALUATION_METHOD["en"],
1545
1591
  generatorTool: {
1546
1592
  name: "HolmDigital Regulatory Engine",
1547
1593
  url: "https://holmdigital.se"
@@ -1549,7 +1595,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1549
1595
  logoUrl,
1550
1596
  contactEmail: metadata?.contactEmail || "hej@holmdigital.se",
1551
1597
  phoneNumber: metadata?.phoneNumber || "070-123 45 67",
1552
- responseTime: metadata?.responseTime || (lang === "sv" ? "2 dagar" : "2 days"),
1598
+ responseTime: metadata?.responseTime || RESPONSE_TIME_DEFAULT[lang] || RESPONSE_TIME_DEFAULT["en"],
1553
1599
  nonComplianceItems,
1554
1600
  locale: lang,
1555
1601
  badgeUrl: generateBadgeUrl(result.score) || void 0,
@@ -1575,10 +1621,11 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1575
1621
  </html>`;
1576
1622
  } else {
1577
1623
  const dateStr = props.lastReviewDate.toISOString().split("T")[0];
1624
+ const labels = STATUS_LABELS[lang] || STATUS_LABELS["en"];
1578
1625
  const statusMap = {
1579
- "full": lang === "sv" ? "Fullt ut f\xF6renlig" : lang === "no" || lang === "nb" ? "Helt i samsvar" : lang === "da" ? "Fuldt ud i overensstemmelse" : "Fully compliant",
1580
- "partial": lang === "sv" ? "Delvis f\xF6renlig" : lang === "no" || lang === "nb" ? "Delvis i samsvar" : lang === "da" ? "Delvist i overensstemmelse" : "Partially compliant",
1581
- "non-compliant": lang === "sv" ? "Inte f\xF6renlig" : lang === "no" || lang === "nb" ? "Ikke i samsvar" : lang === "da" ? "Ikke i overensstemmelse" : "Non-compliant"
1626
+ "full": labels["full"],
1627
+ "partial": labels["partial"],
1628
+ "non-compliant": labels["non-compliant"]
1582
1629
  };
1583
1630
  const substitutions = {
1584
1631
  statusString: statusMap[complianceLevel],
@@ -1590,6 +1637,8 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1590
1637
  "{<e-postadress>}": props.contactEmail || "",
1591
1638
  "{<e-mailosoite>}": props.contactEmail || "",
1592
1639
  "{<e-mailadresse>}": props.contactEmail || "",
1640
+ "{<e-mailadres>}": props.contactEmail || "",
1641
+ "{<e-postadresse>}": props.contactEmail || "",
1593
1642
  "{<e-mail address>}": props.contactEmail || "",
1594
1643
  "{<email address>}": props.contactEmail || "",
1595
1644
  "{<telefonnummer>}": props.phoneNumber || "",
@@ -1609,6 +1658,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1609
1658
  "{<assessment date>}": dateStr,
1610
1659
  "{<uppdateringsdatum>}": dateStr,
1611
1660
  "{<oppdateringsdato>}": dateStr,
1661
+ "{<opdateringsdato>}": dateStr,
1612
1662
  "{<p\xE4ivitysp\xE4iv\xE4>}": dateStr,
1613
1663
  "{<updatedatum>}": dateStr,
1614
1664
  "{<aktualisierungsdatum>}": dateStr,
@@ -1622,13 +1672,18 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1622
1672
  "{<ver\xF6ffentlichungsdatum>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1623
1673
  "{<date_publication>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1624
1674
  "{<fecha_publicacion>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1675
+ "{<offentligg\xF8relsesdato>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1625
1676
  "{<publish date>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1626
1677
  "{<metod>}": props.evaluationMethod || "Automated Scan",
1627
1678
  "{<metodi>}": props.evaluationMethod || "Automated Scan",
1628
1679
  "{<methode>}": props.evaluationMethod || "Automated Scan",
1680
+ "{<metode>}": props.evaluationMethod || "Automated Scan",
1681
+ "{<metodo>}": props.evaluationMethod || "Automated Scan",
1682
+ "{<m\xE9thode>}": props.evaluationMethod || "Automated Scan",
1629
1683
  "{<m\xE9todo>}": props.evaluationMethod || "Automated Scan",
1630
1684
  "{<method>}": props.evaluationMethod || "Automated Scan",
1631
1685
  "{<extern akt\xF6r>}": props.generatorTool?.name || "HolmDigital Engine",
1686
+ "{<ekstern akt\xF8r>}": props.generatorTool?.name || "HolmDigital Engine",
1632
1687
  "{<ekstern aktor>}": props.generatorTool?.name || "HolmDigital Engine",
1633
1688
  "{<ulkoinen taho>}": props.generatorTool?.name || "HolmDigital Engine",
1634
1689
  "{<externe partij>}": props.generatorTool?.name || "HolmDigital Engine",
@@ -1660,6 +1715,9 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1660
1715
  }
1661
1716
  return content2;
1662
1717
  });
1718
+ processed = processed.replace(/\{<[^>]+>\}/g, (match) => {
1719
+ return substitutions[match] !== void 0 ? substitutions[match] : match;
1720
+ });
1663
1721
  processed = processed.replace(/\{([^{}]*?)\}/g, (_match, content2) => {
1664
1722
  const parts = content2.split("/");
1665
1723
  if (parts.length >= 2) {
@@ -1668,8 +1726,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1668
1726
  if (complianceLevel === "non-compliant") idx = parts.length > 2 ? 2 : 1;
1669
1727
  return parts[idx].trim();
1670
1728
  }
1671
- const key = `{${content2}}`;
1672
- return substitutions[key] !== void 0 ? substitutions[key] : _match;
1729
+ return _match;
1673
1730
  });
1674
1731
  return processed;
1675
1732
  };
@@ -1700,6 +1757,7 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
1700
1757
  init_i18n();
1701
1758
 
1702
1759
  // src/cli/cloud-client.ts
1760
+ init_cjs_shims();
1703
1761
  function transformToCloudPayload(result) {
1704
1762
  const violations = result.reports.map((report) => {
1705
1763
  const firstNode = report.failingNodes?.[0];
@@ -1707,7 +1765,7 @@ function transformToCloudPayload(result) {
1707
1765
  rule_id: report.ruleId,
1708
1766
  impact: report.holmdigitalInsight?.diggRisk || "medium",
1709
1767
  wcag_criteria: report.wcagCriteria ? [report.wcagCriteria] : [],
1710
- element_selector: firstNode?.target || "",
1768
+ element_selector: Array.isArray(firstNode?.target) ? firstNode.target.join(" ") : firstNode?.target || "",
1711
1769
  element_html: firstNode?.html || "",
1712
1770
  failure_summary: report.holmdigitalInsight?.reasoning || report.remediation?.description || "",
1713
1771
  fix_suggestion: report.remediation?.description || ""
@@ -7,13 +7,13 @@ import {
7
7
  generateStatement,
8
8
  generateStatementContent,
9
9
  getEngineVersion
10
- } from "../chunk-SJF3O7SK.mjs";
10
+ } from "../chunk-BXSPTSSZ.mjs";
11
11
  import {
12
12
  getCurrentLang,
13
13
  setLanguage,
14
14
  t
15
- } from "../chunk-32WU5BD6.mjs";
16
- import "../chunk-Y6FXYEAI.mjs";
15
+ } from "../chunk-MGIEQZMZ.mjs";
16
+ import "../chunk-DIBTSSLZ.mjs";
17
17
 
18
18
  // src/cli/index.ts
19
19
  import { Command } from "commander";
@@ -21,13 +21,30 @@ import chalk from "chalk";
21
21
  import ora from "ora";
22
22
 
23
23
  // src/reporting/html-template.ts
24
+ var LOCALE_TO_INTL = {
25
+ sv: "sv-SE",
26
+ en: "en-US",
27
+ no: "nb-NO",
28
+ nb: "nb-NO",
29
+ fi: "fi-FI",
30
+ da: "da-DK",
31
+ dk: "da-DK",
32
+ de: "de-DE",
33
+ fr: "fr-FR",
34
+ es: "es-ES",
35
+ nl: "nl-NL",
36
+ "en-gb": "en-GB",
37
+ "en-us": "en-US",
38
+ "en-ca": "en-CA"
39
+ };
24
40
  function generateReportHTML(result) {
25
41
  const criticalCount = result.stats.critical;
26
42
  const highCount = result.stats.high;
27
43
  const htmlErrorsCount = result.htmlValidation?.errors?.length ?? 0;
28
44
  const scoreColor = result.score > 90 ? "#16a34a" : result.score > 70 ? "#eab308" : "#dc2626";
29
45
  const formatDate = (dateString) => {
30
- return new Date(dateString).toLocaleDateString(getCurrentLang() === "sv" ? "sv-SE" : "en-US", {
46
+ const intlLocale = LOCALE_TO_INTL[getCurrentLang()] || "en-US";
47
+ return new Date(dateString).toLocaleDateString(intlLocale, {
31
48
  year: "numeric",
32
49
  month: "long",
33
50
  day: "numeric",
@@ -299,7 +316,7 @@ function generateReportHTML(result) {
299
316
  }).join("")}
300
317
 
301
318
  <footer>
302
- ${t("report.footer")}
319
+ ${t("report.footer", { version: getEngineVersion() })}
303
320
  </footer>
304
321
  </body>
305
322
  </html>
@@ -343,7 +360,7 @@ function transformToCloudPayload(result) {
343
360
  rule_id: report.ruleId,
344
361
  impact: report.holmdigitalInsight?.diggRisk || "medium",
345
362
  wcag_criteria: report.wcagCriteria ? [report.wcagCriteria] : [],
346
- element_selector: firstNode?.target || "",
363
+ element_selector: Array.isArray(firstNode?.target) ? firstNode.target.join(" ") : firstNode?.target || "",
347
364
  element_html: firstNode?.html || "",
348
365
  failure_summary: report.holmdigitalInsight?.reasoning || report.remediation?.description || "",
349
366
  fix_suggestion: report.remediation?.description || ""
@@ -618,11 +635,11 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
618
635
  }
619
636
  }
620
637
  if (options.ci && result.reports.length > 0) {
621
- const { generateGitHubActionsAnnotations } = await import("../github-actions-DYED2EIL.mjs");
638
+ const { generateGitHubActionsAnnotations } = await import("../github-actions-5AFDFD4T.mjs");
622
639
  generateGitHubActionsAnnotations(result.reports);
623
640
  }
624
641
  if (options.junit) {
625
- const { generateJUnitXML } = await import("../junit-generator-QIUEEUXW.mjs");
642
+ const { generateJUnitXML } = await import("../junit-generator-MNO6GP5J.mjs");
626
643
  const fs = await import("fs/promises");
627
644
  const xml = generateJUnitXML(result);
628
645
  await fs.writeFile(options.junit, xml);
@@ -0,0 +1,39 @@
1
+ {
2
+ "title": "Accessibility of {<website>}",
3
+ "intro": "This website is run by {<organisation>}. We want as many people as possible to be able to use it, and this document describes how {<website>} complies with the Accessible Canada Act and the Accessibility for Ontarians with Disabilities Act, any known accessibility issues, and how you can report problems so that we can fix them.",
4
+ "sections": [
5
+ {
6
+ "id": "how-accessible",
7
+ "title": "How accessible is the website?",
8
+ "content": "{There are no known accessibility issues with this website./We know some parts of this website aren't fully accessible. See the section on non-accessible content below for more information./We know some parts of this website aren't fully accessible. See the section on non-accessible content below for more information.}"
9
+ },
10
+ {
11
+ "id": "what-to-do",
12
+ "title": "What to do if you can't access parts of this website?",
13
+ "content": "If you need content from this website that is not accessible for you, but is not within the scope of the accessibility regulations as described below, please contact us.\n\n[Our normal response time is {<response time>}.]\n\n[You can also contact us in the following ways:\n\n* email {<email address>}\n* call {<telephone number>}]"
14
+ },
15
+ {
16
+ "id": "reporting",
17
+ "title": "Reporting accessibility problems with this website",
18
+ "content": "We're always looking to improve the accessibility of this website. If you find any problems that aren't listed on this page or if we're not meeting the requirements of the accessibility regulations, contact us and let us know about the problem."
19
+ },
20
+ {
21
+ "id": "enforcement",
22
+ "title": "Enforcement procedure",
23
+ "content": "The {<enforcement_body>} is responsible for enforcing the Accessible Canada Act. If you experience accessibility issues on our website, you can submit a complaint to {<enforcement_body>}.\n\nYou can also file a complaint with {<enforcement_body>} if you believe our website does not comply with the Accessible Canada Act or the Accessibility for Ontarians with Disabilities Act, or if your request for accessible content has not been handled appropriately."
24
+ },
25
+ {
26
+ "id": "technical",
27
+ "title": "Technical information about this website's accessibility",
28
+ "content": "{This website is fully compliant with the Accessible Canada Act and the Accessibility for Ontarians with Disabilities Act./This website is partially compliant with the Accessible Canada Act and the Accessibility for Ontarians with Disabilities Act, due to the non-compliances listed below./This website is not compliant with the Accessible Canada Act and the Accessibility for Ontarians with Disabilities Act. The non-accessible sections are listed below.}"
29
+ },
30
+ {
31
+ "content": "The content described below is, in one way or another, not fully accessible.\n\n[\n**Non-compliance with the accessibility regulations**\n\n{<issues>}\n]"
32
+ },
33
+ {
34
+ "id": "testing",
35
+ "title": "How we tested this website",
36
+ "content": "{We have performed a self-assessment (internal testing) of {<website>}./{<third party>} has tested {<website>}./We have estimated the accessibility without testing.}\n\nThe last assessment was made on {<assessment date>}.\n\n[Assessment method: {<method>}]\n\nThe website was published on {<publish date>}.\n\nThe statement was last updated on {<update date>}."
37
+ }
38
+ ]
39
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "title": "Accessibility of {<website>}",
3
+ "intro": "This website is run by {<organisation>}. We want as many people as possible to be able to use it, and this document describes how {<website>} complies with the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018, any known accessibility issues, and how you can report problems so that we can fix them.",
4
+ "sections": [
5
+ {
6
+ "id": "how-accessible",
7
+ "title": "How accessible is the website?",
8
+ "content": "{There are no known accessibility issues with this website./We know some parts of this website aren't fully accessible. See the section on non-accessible content below for more information./We know some parts of this website aren't fully accessible. See the section on non-accessible content below for more information.}"
9
+ },
10
+ {
11
+ "id": "what-to-do",
12
+ "title": "What to do if you can't access parts of this website?",
13
+ "content": "If you need content from this website that is not accessible for you, but is not within the scope of the accessibility regulations as described below, please contact us.\n\n[Our normal response time is {<response time>}.]\n\n[You can also contact us in the following ways:\n\n* email {<email address>}\n* call {<telephone number>}]"
14
+ },
15
+ {
16
+ "id": "reporting",
17
+ "title": "Reporting accessibility problems with this website",
18
+ "content": "We're always looking to improve the accessibility of this website. If you find any problems that aren't listed on this page or if we're not meeting the requirements of the accessibility regulations, contact us and let us know about the problem."
19
+ },
20
+ {
21
+ "id": "enforcement",
22
+ "title": "Enforcement procedure",
23
+ "content": "The {<enforcement_body>} is responsible for enforcing the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018. If you experience accessibility issues on our website, you can submit a complaint to {<enforcement_body>}.\n\nYou can also submit a complaint to {<enforcement_body>} if you think that our assessment of what constitutes a disproportionate burden should be reviewed, if you think that our accessibility statement is inadequate, or if you think that your request for excluded content in an accessible format has not been handled correctly."
24
+ },
25
+ {
26
+ "id": "technical",
27
+ "title": "Technical information about this website's accessibility",
28
+ "content": "{This website is fully compliant with the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018./This website is partially compliant with the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018, due to the non-compliances listed below./This website is not compliant with the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018. The non-accessible sections are listed below.}"
29
+ },
30
+ {
31
+ "content": "The content described below is, in one way or another, not fully accessible.\n\n[\n**Non-compliance with the accessibility regulations**\n\n{<issues>}\n]"
32
+ },
33
+ {
34
+ "id": "testing",
35
+ "title": "How we tested this website",
36
+ "content": "{We have performed a self-assessment (internal testing) of {<website>}./{<third party>} has tested {<website>}./We have estimated the accessibility without testing.}\n\nThe last assessment was made on {<assessment date>}.\n\n[Assessment method: {<method>}]\n\nThe website was published on {<publish date>}.\n\nThe statement was last updated on {<update date>}."
37
+ }
38
+ ]
39
+ }