executable-stories-formatters 0.7.11 → 0.7.12

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/index.js CHANGED
@@ -2315,6 +2315,27 @@ body {
2315
2315
  border: 1px solid var(--border);
2316
2316
  }
2317
2317
 
2318
+ .attachment-unavailable {
2319
+ padding: 0.75rem 1rem;
2320
+ border: 1px dashed var(--border);
2321
+ border-radius: calc(var(--radius) - 2px);
2322
+ background: var(--muted, transparent);
2323
+ color: var(--muted-foreground);
2324
+ font-size: 0.8125rem;
2325
+ }
2326
+
2327
+ .attachment-unavailable-label {
2328
+ font-weight: 600;
2329
+ margin-bottom: 0.25rem;
2330
+ }
2331
+
2332
+ .attachment-unavailable-path {
2333
+ font-family: var(--font-mono, ui-monospace, monospace);
2334
+ font-size: 0.75rem;
2335
+ word-break: break-all;
2336
+ opacity: 0.8;
2337
+ }
2338
+
2318
2339
  /* ============================================================================
2319
2340
  Chevron Icon - smooth rotation
2320
2341
  ============================================================================ */
@@ -2880,6 +2901,27 @@ body {
2880
2901
  font-style: italic;
2881
2902
  }
2882
2903
 
2904
+ .doc-screenshot-missing {
2905
+ padding: 0.75rem 1rem;
2906
+ border: 1px dashed var(--border);
2907
+ border-radius: calc(var(--radius) - 2px);
2908
+ background: var(--muted, transparent);
2909
+ color: var(--muted-foreground);
2910
+ font-size: 0.8125rem;
2911
+ }
2912
+
2913
+ .doc-screenshot-missing-label {
2914
+ font-weight: 600;
2915
+ margin-bottom: 0.25rem;
2916
+ }
2917
+
2918
+ .doc-screenshot-missing-path {
2919
+ font-family: var(--font-mono, ui-monospace, monospace);
2920
+ font-size: 0.75rem;
2921
+ word-break: break-all;
2922
+ opacity: 0.8;
2923
+ }
2924
+
2883
2925
  /* ============================================================================
2884
2926
  Documentation Entries - Custom
2885
2927
  ============================================================================ */
@@ -12857,11 +12899,18 @@ function renderTagBar(args, deps) {
12857
12899
  </div>`;
12858
12900
  }
12859
12901
 
12902
+ // src/notifiers/ansi-strip.ts
12903
+ function stripAnsi(text2) {
12904
+ return text2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
12905
+ }
12906
+
12860
12907
  // src/formatters/html/renderers/error-box.ts
12861
12908
  function renderErrorBox(args, deps) {
12862
- const body = args.stack != null ? `${deps.escapeHtml(args.message)}
12909
+ const message = stripAnsi(args.message);
12910
+ const stack = args.stack != null ? stripAnsi(args.stack) : void 0;
12911
+ const body = stack != null ? `${deps.escapeHtml(message)}
12863
12912
 
12864
- ${deps.escapeHtml(args.stack)}` : deps.escapeHtml(args.message);
12913
+ ${deps.escapeHtml(stack)}` : deps.escapeHtml(message);
12865
12914
  return `<div class="error-box">${body}</div>`;
12866
12915
  }
12867
12916
 
@@ -12874,6 +12923,7 @@ function renderAttachments(args, deps) {
12874
12923
  const isImage = att.mediaType.startsWith("image/");
12875
12924
  const isVideo = att.mediaType.startsWith("video/");
12876
12925
  const isBase64 = att.contentEncoding === "BASE64";
12926
+ const isUnreachableFsPath = deps.embedScreenshots && !isBase64 && typeof att.body === "string" && /^(?:[/\\]|[A-Za-z]:[/\\])/.test(att.body);
12877
12927
  if (isImage && deps.embedScreenshots && isBase64) {
12878
12928
  return `
12879
12929
  <div class="attachment">
@@ -12881,12 +12931,19 @@ function renderAttachments(args, deps) {
12881
12931
  <img class="attachment-image" src="data:${att.mediaType};base64,${att.body}" alt="${deps.escapeHtml(att.name)}" />
12882
12932
  </div>`;
12883
12933
  }
12884
- if (isVideo && deps.embedScreenshots) {
12934
+ if (isVideo && deps.embedScreenshots && !isUnreachableFsPath) {
12885
12935
  const src = isBase64 ? `data:${att.mediaType};base64,${att.body}` : att.body;
12886
12936
  return `
12887
12937
  <div class="attachment">
12888
12938
  ${deps.escapeHtml(att.name)}
12889
12939
  <video class="attachment-video" controls src="${deps.escapeHtml(src)}"></video>
12940
+ </div>`;
12941
+ }
12942
+ if (isUnreachableFsPath) {
12943
+ return `
12944
+ <div class="attachment attachment-unavailable">
12945
+ <div class="attachment-unavailable-label">${deps.escapeHtml(att.name)} unavailable</div>
12946
+ <div class="attachment-unavailable-path">${deps.escapeHtml(att.body)}</div>
12890
12947
  </div>`;
12891
12948
  }
12892
12949
  const href = isBase64 ? `data:${att.mediaType};base64,${att.body}` : att.body;
@@ -12969,7 +13026,18 @@ function renderDocScreenshot(entry, deps) {
12969
13026
  const alt = entry.alt ?? "Screenshot";
12970
13027
  const embedEnabled = deps.embedScreenshots ?? true;
12971
13028
  const isRemote = /^(?:https?:|data:)/i.test(entry.path);
12972
- const src = embedEnabled && !isRemote && deps.readScreenshot ? deps.readScreenshot(entry.path) ?? entry.path : entry.path;
13029
+ const embedAttempted = !isRemote && embedEnabled && !!deps.readScreenshot;
13030
+ const inlined = embedAttempted ? deps.readScreenshot(entry.path) : void 0;
13031
+ const isAbsoluteFsPath = !isRemote && /^(?:[/\\]|[A-Za-z]:[/\\])/.test(entry.path);
13032
+ if (embedAttempted && inlined === void 0 && isAbsoluteFsPath) {
13033
+ const captionHtml = entry.alt ? `<div class="doc-screenshot-caption">${deps.escapeHtml(entry.alt)}</div>` : "";
13034
+ return `<div class="doc-screenshot doc-screenshot-missing">
13035
+ <div class="doc-screenshot-missing-label">Screenshot unavailable</div>
13036
+ <div class="doc-screenshot-missing-path">${deps.escapeHtml(entry.path)}</div>
13037
+ ${captionHtml}
13038
+ </div>`;
13039
+ }
13040
+ const src = inlined ?? entry.path;
12973
13041
  return `<div class="doc-screenshot">
12974
13042
  <img src="${deps.escapeHtml(src)}" alt="${deps.escapeHtml(alt)}" class="doc-screenshot-img" />
12975
13043
  ${entry.alt ? `<div class="doc-screenshot-caption">${deps.escapeHtml(entry.alt)}</div>` : ""}
@@ -18013,11 +18081,6 @@ function resolveTraceUrl(template, traceId) {
18013
18081
  return template.replace(/\{traceId\}/g, traceId);
18014
18082
  }
18015
18083
 
18016
- // src/notifiers/ansi-strip.ts
18017
- function stripAnsi(text2) {
18018
- return text2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
18019
- }
18020
-
18021
18084
  // src/notifiers/slack.ts
18022
18085
  function truncate(text2, maxLen) {
18023
18086
  if (text2.length <= maxLen) return text2;