@holmdigital/engine 3.2.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import {
8
8
  generateStatementContent,
9
9
  getEngineVersion,
10
10
  isBadgeWithheldByRobustness
11
- } from "../chunk-D66R3ESC.mjs";
11
+ } from "../chunk-VCZZMEKN.mjs";
12
12
  import {
13
13
  groupReportsByRule,
14
14
  impactBreakdown,
@@ -20,7 +20,7 @@ import {
20
20
  getCurrentLang,
21
21
  setLanguage,
22
22
  t
23
- } from "../chunk-RNCZ2GNY.mjs";
23
+ } from "../chunk-DSZ7B2IH.mjs";
24
24
  import {
25
25
  needsReviewOf,
26
26
  violationsOf
@@ -105,7 +105,43 @@ function renderNoScriptSection(result) {
105
105
  </section>
106
106
  `;
107
107
  }
108
+ function inconclusiveReportHTML(result) {
109
+ return `<!DOCTYPE html>
110
+ <html lang="${getCurrentLang()}">
111
+ <head>
112
+ <meta charset="utf-8" />
113
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
114
+ <title>${t("report.title", { url: result.url })}</title>
115
+ <style>
116
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f8fafc; color: #0f172a; margin: 0; padding: 3rem 1.5rem; }
117
+ .wrap { max-width: 640px; margin: 0 auto; }
118
+ .brand { font-weight: 700; color: #0369a1; margin-bottom: 2rem; }
119
+ .card { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 2rem; }
120
+ .icon { font-size: 2rem; }
121
+ h1 { font-size: 1.35rem; margin: 0.5rem 0 1rem; color: #92400e; }
122
+ p { line-height: 1.6; color: #334155; }
123
+ .page-title { margin-top: 1.5rem; font-size: 0.85rem; color: #64748b; word-break: break-all; }
124
+ .footer { text-align: center; color: #94a3b8; font-size: 0.75rem; margin-top: 2rem; }
125
+ </style>
126
+ </head>
127
+ <body>
128
+ <div class="wrap">
129
+ <div class="brand">@HolmDigital/engine</div>
130
+ <div class="card">
131
+ <div class="icon">\u26A0\uFE0F</div>
132
+ <h1>${t("report.inconclusive_title")}</h1>
133
+ <p>${t("report.inconclusive_detail")}</p>
134
+ <div class="page-title">${t("report.scan_target", { url: result.url })}<br/>${escapeHtml(result.metadata.pageTitle || "N/A")}</div>
135
+ </div>
136
+ <div class="footer">${t("report.footer", { version: getEngineVersion() })}</div>
137
+ </div>
138
+ </body>
139
+ </html>`;
140
+ }
108
141
  function generateReportHTML(result, sector = "public", audience = "developer", plainFallbackFrom) {
142
+ if (result.complianceStatus === "INCONCLUSIVE") {
143
+ return inconclusiveReportHTML(result);
144
+ }
109
145
  if (audience === "plain") {
110
146
  return generatePlainReportHTML(result, plainFallbackFrom);
111
147
  }
@@ -902,6 +938,12 @@ function transformToCloudPayload(result) {
902
938
  };
903
939
  }
904
940
  async function sendToCloud(config, result) {
941
+ if (result.complianceStatus === "INCONCLUSIVE") {
942
+ return {
943
+ success: false,
944
+ error: "Scan inconclusive (interstitial/wait page) \u2014 not uploaded; no real content was assessed."
945
+ };
946
+ }
905
947
  const payload = transformToCloudPayload(result);
906
948
  const endpoint = `${config.cloudUrl.replace(/\/$/, "")}/api/v1/ingest`;
907
949
  try {
@@ -1081,7 +1123,10 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1081
1123
  await generatePDF(html, options.pdf);
1082
1124
  if (spinner) spinner.succeed(t("cli.pdf_saved", { path: options.pdf }));
1083
1125
  }
1084
- if (options.statement) {
1126
+ if (options.statement && result.complianceStatus === "INCONCLUSIVE") {
1127
+ if (spinner) spinner.warn("Skipping accessibility statement \u2014 scan inconclusive (interstitial/wait page); the real content was not assessed.");
1128
+ else if (!options.json) console.error(chalk.yellow("Skipping accessibility statement \u2014 scan inconclusive; real content not assessed."));
1129
+ } else if (options.statement) {
1085
1130
  if (spinner) spinner.start(t("cli.generating_statement", { path: options.statement }));
1086
1131
  const metadata = {
1087
1132
  contactEmail: options.email,
@@ -1131,6 +1176,19 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1131
1176
  console.log(JSON.stringify(lightResult, null, 2));
1132
1177
  } else if (options.json) {
1133
1178
  console.log(JSON.stringify(result, null, 2));
1179
+ } else if (result.complianceStatus === "INCONCLUSIVE") {
1180
+ if (options.audience === "plain") {
1181
+ const { renderPlainReport } = await import("../plain-report-V5ZUHISZ.mjs");
1182
+ renderPlainReport(result, plainFallbackFrom ? "en" : options.lang, plainFallbackFrom);
1183
+ } else {
1184
+ console.log("");
1185
+ console.log(chalk.yellow.bold(t("cli.inconclusive_headline")));
1186
+ console.log(chalk.yellow(t("cli.inconclusive_detail")));
1187
+ if (result.metadata.pageTitle) {
1188
+ console.log(chalk.gray(` (${result.metadata.pageTitle})`));
1189
+ }
1190
+ console.log("");
1191
+ }
1134
1192
  } else if (options.light) {
1135
1193
  const scoreColor = result.score >= 90 ? chalk.green : result.score >= 70 ? chalk.yellow : chalk.red;
1136
1194
  const statusColor = result.complianceStatus === "PASS" ? chalk.green : chalk.red;
@@ -1152,7 +1210,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1152
1210
  console.log(chalk.gray(`
1153
1211
  Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
1154
1212
  } else if (options.audience === "plain") {
1155
- const { renderPlainReport } = await import("../plain-report-QLJTGX5L.mjs");
1213
+ const { renderPlainReport } = await import("../plain-report-V5ZUHISZ.mjs");
1156
1214
  renderPlainReport(result, plainFallbackFrom ? "en" : options.lang, plainFallbackFrom);
1157
1215
  } else {
1158
1216
  const violations = violationsOf(result.reports);
@@ -1282,19 +1340,30 @@ ${t("cli.badge_withheld")}`));
1282
1340
  const { generateGitHubActionsAnnotations } = await import("../github-actions-PIV5JU2C.mjs");
1283
1341
  generateGitHubActionsAnnotations(result.reports);
1284
1342
  }
1343
+ if (options.ci && result.complianceStatus === "INCONCLUSIVE") {
1344
+ console.log("::warning::Accessibility scan inconclusive \u2014 the page looked like an interstitial/wait/bot-challenge page, so the real content was not assessed. Try a higher --wait-for-hydration.");
1345
+ }
1285
1346
  if (options.junit) {
1286
- const { generateJUnitXML } = await import("../junit-generator-5DTJ7YEU.mjs");
1347
+ const { generateJUnitXML } = await import("../junit-generator-B6HW7DCD.mjs");
1287
1348
  const fs = await import("fs/promises");
1288
1349
  const xml = generateJUnitXML(result);
1289
1350
  await fs.writeFile(options.junit, xml);
1290
1351
  if (spinner) spinner.succeed(t("cli.junit_saved", { path: options.junit }));
1291
1352
  else if (!options.json) console.log(chalk.green(`\u2713 JUnit report saved to ${options.junit}`));
1292
1353
  }
1354
+ if (options.ci && result.complianceStatus === "INCONCLUSIVE") {
1355
+ if (!options.json) console.error(chalk.yellow("\nCI/CD: scan inconclusive \u2014 real content not assessed (interstitial/wait page). Not treated as a pass."));
1356
+ process.exit(1);
1357
+ }
1293
1358
  if (options.ci && result.stats.critical > 0) {
1294
1359
  if (!options.json) console.error(chalk.red(t("cli.critical_failure")));
1295
1360
  process.exit(1);
1296
1361
  }
1297
- if (options.apiKey) {
1362
+ if (options.apiKey && result.complianceStatus === "INCONCLUSIVE") {
1363
+ if (!options.json) {
1364
+ console.log(chalk.yellow("Skipping cloud upload \u2014 scan inconclusive (interstitial/wait page), nothing real to ingest."));
1365
+ }
1366
+ } else if (options.apiKey) {
1298
1367
  const cloudSpinner = !options.json ? ora("Uploading results to HolmDigital Cloud...").start() : null;
1299
1368
  const cloudConfig = {
1300
1369
  apiKey: options.apiKey,
@@ -2,7 +2,7 @@ import {
2
2
  getCurrentLang,
3
3
  setLanguage,
4
4
  t
5
- } from "./chunk-RNCZ2GNY.mjs";
5
+ } from "./chunk-DSZ7B2IH.mjs";
6
6
  import "./chunk-DIBTSSLZ.mjs";
7
7
  export {
8
8
  getCurrentLang,
package/dist/index.d.mts CHANGED
@@ -44,6 +44,7 @@ declare function probeWithoutJavaScript(browser: Browser, options: NoScriptProbe
44
44
 
45
45
  declare function wcagTagToCriterion(tag: string): string | null;
46
46
  declare function criteriaFromTags(tags: string[]): string[];
47
+ declare function en301549FromTags(tags: string[]): string | null;
47
48
  declare function getSelfMatchingRuleIds(rules: ConvergenceRule[]): Set<string>;
48
49
  declare function selectMappedRuleId(ruleId: string, tags: string[], rules: ConvergenceRule[], selfMatchingIds?: Set<string>): string | null;
49
50
  declare function isInterstitialPage(pageTitle: string | undefined, hasMetaRefresh: boolean, bodyTextLength: number): boolean;
@@ -89,7 +90,7 @@ interface ScanResult {
89
90
  needsReview: number;
90
91
  };
91
92
  score: number;
92
- complianceStatus: 'PASS' | 'FAIL';
93
+ complianceStatus: 'PASS' | 'FAIL' | 'INCONCLUSIVE';
93
94
  htmlValidation?: ValidationResult;
94
95
  noScript?: NoScriptResult;
95
96
  legalSummary?: {
@@ -179,7 +180,9 @@ var cli = {
179
180
  noscript_no_fallback: "No <noscript> fallback was found.",
180
181
  noscript_impact: "This rarely affects the people who turned JavaScript off, but the people whose scripts never arrived: a weak mobile network, a corporate proxy, a browser extension that misbehaves, a timeout. They get an empty page instead of a slow one.",
181
182
  noscript_advisory: "Recommendation, not a legal requirement. No WCAG success criterion requires a page to work without JavaScript, so this does not affect the compliance score.",
182
- badge_withheld: "100/100 with no findings. The robustness check is not clean, so we do not generate a shareable badge."
183
+ badge_withheld: "100/100 with no findings. The robustness check is not clean, so we do not generate a shareable badge.",
184
+ inconclusive_headline: "⚠️ Could not scan the real content",
185
+ inconclusive_detail: "The page looked like a wait / redirect / bot-challenge page (interstitial), so this result does not reflect the real site. An honest \"could not measure\" is safer than a misleading score. Try a higher --wait-for-hydration <ms>, or open the URL in a browser to check."
183
186
  };
184
187
  var report = {
185
188
  title: "Accessibility Report - {url}",
@@ -195,7 +198,9 @@ var report = {
195
198
  needs_review_note: "axe-core could not determine these automatically — verify them manually. They are not counted in the totals above.",
196
199
  prescriptive_fix: "💡 Prescriptive Fix",
197
200
  use: "Use",
198
- footer: "Generated by @holmdigital/engine v{version} • Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
201
+ footer: "Generated by @holmdigital/engine v{version} • Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen",
202
+ inconclusive_title: "We could not scan the real page",
203
+ inconclusive_detail: "The page looked like a wait, redirect, or verification screen (for example a bot check or an interstitial), so the engine measured that screen instead of your site. Nothing here reflects your real content. Try again with a higher --wait-for-hydration value, and if it persists, open the address in a browser to confirm the site loads."
199
204
  };
200
205
  var plain = {
201
206
  what_happens: "What happens:",
@@ -213,6 +218,7 @@ var plain = {
213
218
  intro_unit_plural: "issues",
214
219
  closing: "Start at the top. The items highest up cost you the most customers.",
215
220
  empty_state: "No barriers found this time.",
221
+ inconclusive: "We could not read your real page this time. It looked like a waiting or verification screen (for example a \"please wait\" message or a bot check), so there is nothing reliable to report yet. Please try again — and if it keeps happening, open your website in a normal browser to make sure it loads.",
216
222
  report_title: "Accessibility report for {url}",
217
223
  report_tagline: "Accessibility report",
218
224
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
@@ -253,4 +259,4 @@ declare function resolveNationalLawReference(country: Country, sector: 'public'
253
259
  declare function generateStatementContent(result: ScanResult, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<string>;
254
260
  declare function generateStatement(result: ScanResult, outputPath: string, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<void>;
255
261
 
256
- export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, criteriaFromTags, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, getSelfMatchingRuleIds, getStandardsVersion, isInterstitialPage, probeWithoutJavaScript, resolveNationalLawReference, selectMappedRuleId, setLanguage, t, wcagTagToCriterion };
262
+ export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, criteriaFromTags, en301549FromTags, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, getSelfMatchingRuleIds, getStandardsVersion, isInterstitialPage, probeWithoutJavaScript, resolveNationalLawReference, selectMappedRuleId, setLanguage, t, wcagTagToCriterion };
package/dist/index.d.ts CHANGED
@@ -44,6 +44,7 @@ declare function probeWithoutJavaScript(browser: Browser, options: NoScriptProbe
44
44
 
45
45
  declare function wcagTagToCriterion(tag: string): string | null;
46
46
  declare function criteriaFromTags(tags: string[]): string[];
47
+ declare function en301549FromTags(tags: string[]): string | null;
47
48
  declare function getSelfMatchingRuleIds(rules: ConvergenceRule[]): Set<string>;
48
49
  declare function selectMappedRuleId(ruleId: string, tags: string[], rules: ConvergenceRule[], selfMatchingIds?: Set<string>): string | null;
49
50
  declare function isInterstitialPage(pageTitle: string | undefined, hasMetaRefresh: boolean, bodyTextLength: number): boolean;
@@ -89,7 +90,7 @@ interface ScanResult {
89
90
  needsReview: number;
90
91
  };
91
92
  score: number;
92
- complianceStatus: 'PASS' | 'FAIL';
93
+ complianceStatus: 'PASS' | 'FAIL' | 'INCONCLUSIVE';
93
94
  htmlValidation?: ValidationResult;
94
95
  noScript?: NoScriptResult;
95
96
  legalSummary?: {
@@ -179,7 +180,9 @@ var cli = {
179
180
  noscript_no_fallback: "No <noscript> fallback was found.",
180
181
  noscript_impact: "This rarely affects the people who turned JavaScript off, but the people whose scripts never arrived: a weak mobile network, a corporate proxy, a browser extension that misbehaves, a timeout. They get an empty page instead of a slow one.",
181
182
  noscript_advisory: "Recommendation, not a legal requirement. No WCAG success criterion requires a page to work without JavaScript, so this does not affect the compliance score.",
182
- badge_withheld: "100/100 with no findings. The robustness check is not clean, so we do not generate a shareable badge."
183
+ badge_withheld: "100/100 with no findings. The robustness check is not clean, so we do not generate a shareable badge.",
184
+ inconclusive_headline: "⚠️ Could not scan the real content",
185
+ inconclusive_detail: "The page looked like a wait / redirect / bot-challenge page (interstitial), so this result does not reflect the real site. An honest \"could not measure\" is safer than a misleading score. Try a higher --wait-for-hydration <ms>, or open the URL in a browser to check."
183
186
  };
184
187
  var report = {
185
188
  title: "Accessibility Report - {url}",
@@ -195,7 +198,9 @@ var report = {
195
198
  needs_review_note: "axe-core could not determine these automatically — verify them manually. They are not counted in the totals above.",
196
199
  prescriptive_fix: "💡 Prescriptive Fix",
197
200
  use: "Use",
198
- footer: "Generated by @holmdigital/engine v{version} • Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
201
+ footer: "Generated by @holmdigital/engine v{version} • Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen",
202
+ inconclusive_title: "We could not scan the real page",
203
+ inconclusive_detail: "The page looked like a wait, redirect, or verification screen (for example a bot check or an interstitial), so the engine measured that screen instead of your site. Nothing here reflects your real content. Try again with a higher --wait-for-hydration value, and if it persists, open the address in a browser to confirm the site loads."
199
204
  };
200
205
  var plain = {
201
206
  what_happens: "What happens:",
@@ -213,6 +218,7 @@ var plain = {
213
218
  intro_unit_plural: "issues",
214
219
  closing: "Start at the top. The items highest up cost you the most customers.",
215
220
  empty_state: "No barriers found this time.",
221
+ inconclusive: "We could not read your real page this time. It looked like a waiting or verification screen (for example a \"please wait\" message or a bot check), so there is nothing reliable to report yet. Please try again — and if it keeps happening, open your website in a normal browser to make sure it loads.",
216
222
  report_title: "Accessibility report for {url}",
217
223
  report_tagline: "Accessibility report",
218
224
  attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
@@ -253,4 +259,4 @@ declare function resolveNationalLawReference(country: Country, sector: 'public'
253
259
  declare function generateStatementContent(result: ScanResult, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<string>;
254
260
  declare function generateStatement(result: ScanResult, outputPath: string, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<void>;
255
261
 
256
- export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, criteriaFromTags, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, getSelfMatchingRuleIds, getStandardsVersion, isInterstitialPage, probeWithoutJavaScript, resolveNationalLawReference, selectMappedRuleId, setLanguage, t, wcagTagToCriterion };
262
+ export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, criteriaFromTags, en301549FromTags, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, getSelfMatchingRuleIds, getStandardsVersion, isInterstitialPage, probeWithoutJavaScript, resolveNationalLawReference, selectMappedRuleId, setLanguage, t, wcagTagToCriterion };