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.cjs CHANGED
@@ -2422,6 +2422,27 @@ body {
2422
2422
  border: 1px solid var(--border);
2423
2423
  }
2424
2424
 
2425
+ .attachment-unavailable {
2426
+ padding: 0.75rem 1rem;
2427
+ border: 1px dashed var(--border);
2428
+ border-radius: calc(var(--radius) - 2px);
2429
+ background: var(--muted, transparent);
2430
+ color: var(--muted-foreground);
2431
+ font-size: 0.8125rem;
2432
+ }
2433
+
2434
+ .attachment-unavailable-label {
2435
+ font-weight: 600;
2436
+ margin-bottom: 0.25rem;
2437
+ }
2438
+
2439
+ .attachment-unavailable-path {
2440
+ font-family: var(--font-mono, ui-monospace, monospace);
2441
+ font-size: 0.75rem;
2442
+ word-break: break-all;
2443
+ opacity: 0.8;
2444
+ }
2445
+
2425
2446
  /* ============================================================================
2426
2447
  Chevron Icon - smooth rotation
2427
2448
  ============================================================================ */
@@ -2987,6 +3008,27 @@ body {
2987
3008
  font-style: italic;
2988
3009
  }
2989
3010
 
3011
+ .doc-screenshot-missing {
3012
+ padding: 0.75rem 1rem;
3013
+ border: 1px dashed var(--border);
3014
+ border-radius: calc(var(--radius) - 2px);
3015
+ background: var(--muted, transparent);
3016
+ color: var(--muted-foreground);
3017
+ font-size: 0.8125rem;
3018
+ }
3019
+
3020
+ .doc-screenshot-missing-label {
3021
+ font-weight: 600;
3022
+ margin-bottom: 0.25rem;
3023
+ }
3024
+
3025
+ .doc-screenshot-missing-path {
3026
+ font-family: var(--font-mono, ui-monospace, monospace);
3027
+ font-size: 0.75rem;
3028
+ word-break: break-all;
3029
+ opacity: 0.8;
3030
+ }
3031
+
2990
3032
  /* ============================================================================
2991
3033
  Documentation Entries - Custom
2992
3034
  ============================================================================ */
@@ -12964,11 +13006,18 @@ function renderTagBar(args, deps) {
12964
13006
  </div>`;
12965
13007
  }
12966
13008
 
13009
+ // src/notifiers/ansi-strip.ts
13010
+ function stripAnsi(text2) {
13011
+ return text2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
13012
+ }
13013
+
12967
13014
  // src/formatters/html/renderers/error-box.ts
12968
13015
  function renderErrorBox(args, deps) {
12969
- const body = args.stack != null ? `${deps.escapeHtml(args.message)}
13016
+ const message = stripAnsi(args.message);
13017
+ const stack = args.stack != null ? stripAnsi(args.stack) : void 0;
13018
+ const body = stack != null ? `${deps.escapeHtml(message)}
12970
13019
 
12971
- ${deps.escapeHtml(args.stack)}` : deps.escapeHtml(args.message);
13020
+ ${deps.escapeHtml(stack)}` : deps.escapeHtml(message);
12972
13021
  return `<div class="error-box">${body}</div>`;
12973
13022
  }
12974
13023
 
@@ -12981,6 +13030,7 @@ function renderAttachments(args, deps) {
12981
13030
  const isImage = att.mediaType.startsWith("image/");
12982
13031
  const isVideo = att.mediaType.startsWith("video/");
12983
13032
  const isBase64 = att.contentEncoding === "BASE64";
13033
+ const isUnreachableFsPath = deps.embedScreenshots && !isBase64 && typeof att.body === "string" && /^(?:[/\\]|[A-Za-z]:[/\\])/.test(att.body);
12984
13034
  if (isImage && deps.embedScreenshots && isBase64) {
12985
13035
  return `
12986
13036
  <div class="attachment">
@@ -12988,12 +13038,19 @@ function renderAttachments(args, deps) {
12988
13038
  <img class="attachment-image" src="data:${att.mediaType};base64,${att.body}" alt="${deps.escapeHtml(att.name)}" />
12989
13039
  </div>`;
12990
13040
  }
12991
- if (isVideo && deps.embedScreenshots) {
13041
+ if (isVideo && deps.embedScreenshots && !isUnreachableFsPath) {
12992
13042
  const src = isBase64 ? `data:${att.mediaType};base64,${att.body}` : att.body;
12993
13043
  return `
12994
13044
  <div class="attachment">
12995
13045
  ${deps.escapeHtml(att.name)}
12996
13046
  <video class="attachment-video" controls src="${deps.escapeHtml(src)}"></video>
13047
+ </div>`;
13048
+ }
13049
+ if (isUnreachableFsPath) {
13050
+ return `
13051
+ <div class="attachment attachment-unavailable">
13052
+ <div class="attachment-unavailable-label">${deps.escapeHtml(att.name)} unavailable</div>
13053
+ <div class="attachment-unavailable-path">${deps.escapeHtml(att.body)}</div>
12997
13054
  </div>`;
12998
13055
  }
12999
13056
  const href = isBase64 ? `data:${att.mediaType};base64,${att.body}` : att.body;
@@ -13076,7 +13133,18 @@ function renderDocScreenshot(entry, deps) {
13076
13133
  const alt = entry.alt ?? "Screenshot";
13077
13134
  const embedEnabled = deps.embedScreenshots ?? true;
13078
13135
  const isRemote = /^(?:https?:|data:)/i.test(entry.path);
13079
- const src = embedEnabled && !isRemote && deps.readScreenshot ? deps.readScreenshot(entry.path) ?? entry.path : entry.path;
13136
+ const embedAttempted = !isRemote && embedEnabled && !!deps.readScreenshot;
13137
+ const inlined = embedAttempted ? deps.readScreenshot(entry.path) : void 0;
13138
+ const isAbsoluteFsPath = !isRemote && /^(?:[/\\]|[A-Za-z]:[/\\])/.test(entry.path);
13139
+ if (embedAttempted && inlined === void 0 && isAbsoluteFsPath) {
13140
+ const captionHtml = entry.alt ? `<div class="doc-screenshot-caption">${deps.escapeHtml(entry.alt)}</div>` : "";
13141
+ return `<div class="doc-screenshot doc-screenshot-missing">
13142
+ <div class="doc-screenshot-missing-label">Screenshot unavailable</div>
13143
+ <div class="doc-screenshot-missing-path">${deps.escapeHtml(entry.path)}</div>
13144
+ ${captionHtml}
13145
+ </div>`;
13146
+ }
13147
+ const src = inlined ?? entry.path;
13080
13148
  return `<div class="doc-screenshot">
13081
13149
  <img src="${deps.escapeHtml(src)}" alt="${deps.escapeHtml(alt)}" class="doc-screenshot-img" />
13082
13150
  ${entry.alt ? `<div class="doc-screenshot-caption">${deps.escapeHtml(entry.alt)}</div>` : ""}
@@ -18121,11 +18189,6 @@ function resolveTraceUrl(template, traceId) {
18121
18189
  return template.replace(/\{traceId\}/g, traceId);
18122
18190
  }
18123
18191
 
18124
- // src/notifiers/ansi-strip.ts
18125
- function stripAnsi(text2) {
18126
- return text2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
18127
- }
18128
-
18129
18192
  // src/notifiers/slack.ts
18130
18193
  function truncate(text2, maxLen) {
18131
18194
  if (text2.length <= maxLen) return text2;