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/cli.js CHANGED
@@ -2992,6 +2992,27 @@ body {
2992
2992
  border: 1px solid var(--border);
2993
2993
  }
2994
2994
 
2995
+ .attachment-unavailable {
2996
+ padding: 0.75rem 1rem;
2997
+ border: 1px dashed var(--border);
2998
+ border-radius: calc(var(--radius) - 2px);
2999
+ background: var(--muted, transparent);
3000
+ color: var(--muted-foreground);
3001
+ font-size: 0.8125rem;
3002
+ }
3003
+
3004
+ .attachment-unavailable-label {
3005
+ font-weight: 600;
3006
+ margin-bottom: 0.25rem;
3007
+ }
3008
+
3009
+ .attachment-unavailable-path {
3010
+ font-family: var(--font-mono, ui-monospace, monospace);
3011
+ font-size: 0.75rem;
3012
+ word-break: break-all;
3013
+ opacity: 0.8;
3014
+ }
3015
+
2995
3016
  /* ============================================================================
2996
3017
  Chevron Icon - smooth rotation
2997
3018
  ============================================================================ */
@@ -3557,6 +3578,27 @@ body {
3557
3578
  font-style: italic;
3558
3579
  }
3559
3580
 
3581
+ .doc-screenshot-missing {
3582
+ padding: 0.75rem 1rem;
3583
+ border: 1px dashed var(--border);
3584
+ border-radius: calc(var(--radius) - 2px);
3585
+ background: var(--muted, transparent);
3586
+ color: var(--muted-foreground);
3587
+ font-size: 0.8125rem;
3588
+ }
3589
+
3590
+ .doc-screenshot-missing-label {
3591
+ font-weight: 600;
3592
+ margin-bottom: 0.25rem;
3593
+ }
3594
+
3595
+ .doc-screenshot-missing-path {
3596
+ font-family: var(--font-mono, ui-monospace, monospace);
3597
+ font-size: 0.75rem;
3598
+ word-break: break-all;
3599
+ opacity: 0.8;
3600
+ }
3601
+
3560
3602
  /* ============================================================================
3561
3603
  Documentation Entries - Custom
3562
3604
  ============================================================================ */
@@ -13531,11 +13573,18 @@ function renderTagBar(args, deps) {
13531
13573
  </div>`;
13532
13574
  }
13533
13575
 
13576
+ // src/notifiers/ansi-strip.ts
13577
+ function stripAnsi(text2) {
13578
+ return text2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
13579
+ }
13580
+
13534
13581
  // src/formatters/html/renderers/error-box.ts
13535
13582
  function renderErrorBox(args, deps) {
13536
- const body = args.stack != null ? `${deps.escapeHtml(args.message)}
13583
+ const message = stripAnsi(args.message);
13584
+ const stack = args.stack != null ? stripAnsi(args.stack) : void 0;
13585
+ const body = stack != null ? `${deps.escapeHtml(message)}
13537
13586
 
13538
- ${deps.escapeHtml(args.stack)}` : deps.escapeHtml(args.message);
13587
+ ${deps.escapeHtml(stack)}` : deps.escapeHtml(message);
13539
13588
  return `<div class="error-box">${body}</div>`;
13540
13589
  }
13541
13590
 
@@ -13548,6 +13597,7 @@ function renderAttachments(args, deps) {
13548
13597
  const isImage = att.mediaType.startsWith("image/");
13549
13598
  const isVideo = att.mediaType.startsWith("video/");
13550
13599
  const isBase64 = att.contentEncoding === "BASE64";
13600
+ const isUnreachableFsPath = deps.embedScreenshots && !isBase64 && typeof att.body === "string" && /^(?:[/\\]|[A-Za-z]:[/\\])/.test(att.body);
13551
13601
  if (isImage && deps.embedScreenshots && isBase64) {
13552
13602
  return `
13553
13603
  <div class="attachment">
@@ -13555,12 +13605,19 @@ function renderAttachments(args, deps) {
13555
13605
  <img class="attachment-image" src="data:${att.mediaType};base64,${att.body}" alt="${deps.escapeHtml(att.name)}" />
13556
13606
  </div>`;
13557
13607
  }
13558
- if (isVideo && deps.embedScreenshots) {
13608
+ if (isVideo && deps.embedScreenshots && !isUnreachableFsPath) {
13559
13609
  const src = isBase64 ? `data:${att.mediaType};base64,${att.body}` : att.body;
13560
13610
  return `
13561
13611
  <div class="attachment">
13562
13612
  ${deps.escapeHtml(att.name)}
13563
13613
  <video class="attachment-video" controls src="${deps.escapeHtml(src)}"></video>
13614
+ </div>`;
13615
+ }
13616
+ if (isUnreachableFsPath) {
13617
+ return `
13618
+ <div class="attachment attachment-unavailable">
13619
+ <div class="attachment-unavailable-label">${deps.escapeHtml(att.name)} unavailable</div>
13620
+ <div class="attachment-unavailable-path">${deps.escapeHtml(att.body)}</div>
13564
13621
  </div>`;
13565
13622
  }
13566
13623
  const href = isBase64 ? `data:${att.mediaType};base64,${att.body}` : att.body;
@@ -13643,7 +13700,18 @@ function renderDocScreenshot(entry, deps) {
13643
13700
  const alt = entry.alt ?? "Screenshot";
13644
13701
  const embedEnabled = deps.embedScreenshots ?? true;
13645
13702
  const isRemote = /^(?:https?:|data:)/i.test(entry.path);
13646
- const src = embedEnabled && !isRemote && deps.readScreenshot ? deps.readScreenshot(entry.path) ?? entry.path : entry.path;
13703
+ const embedAttempted = !isRemote && embedEnabled && !!deps.readScreenshot;
13704
+ const inlined = embedAttempted ? deps.readScreenshot(entry.path) : void 0;
13705
+ const isAbsoluteFsPath = !isRemote && /^(?:[/\\]|[A-Za-z]:[/\\])/.test(entry.path);
13706
+ if (embedAttempted && inlined === void 0 && isAbsoluteFsPath) {
13707
+ const captionHtml = entry.alt ? `<div class="doc-screenshot-caption">${deps.escapeHtml(entry.alt)}</div>` : "";
13708
+ return `<div class="doc-screenshot doc-screenshot-missing">
13709
+ <div class="doc-screenshot-missing-label">Screenshot unavailable</div>
13710
+ <div class="doc-screenshot-missing-path">${deps.escapeHtml(entry.path)}</div>
13711
+ ${captionHtml}
13712
+ </div>`;
13713
+ }
13714
+ const src = inlined ?? entry.path;
13647
13715
  return `<div class="doc-screenshot">
13648
13716
  <img src="${deps.escapeHtml(src)}" alt="${deps.escapeHtml(alt)}" class="doc-screenshot-img" />
13649
13717
  ${entry.alt ? `<div class="doc-screenshot-caption">${deps.escapeHtml(entry.alt)}</div>` : ""}
@@ -18052,11 +18120,6 @@ function pickleStepArgumentToDocs(ps) {
18052
18120
  return docs;
18053
18121
  }
18054
18122
 
18055
- // src/notifiers/ansi-strip.ts
18056
- function stripAnsi(text2) {
18057
- return text2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
18058
- }
18059
-
18060
18123
  // src/notifiers/slack.ts
18061
18124
  function truncate(text2, maxLen) {
18062
18125
  if (text2.length <= maxLen) return text2;