@buildinternet/uploads 0.37.2 → 0.37.3

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/commands.js CHANGED
@@ -4,7 +4,7 @@ import { mapBounded } from "./async.js";
4
4
  import { createUploadsClient, } from "./client.js";
5
5
  import { parseCommandArgs, flagString, flagBool, flagInt, flagValues, UsageError, } from "./cli-args.js";
6
6
  import { resolvePutDefaults, workspaceMismatch, workspaceFromToken, } from "./config.js";
7
- import { buildMarkdown } from "./embed.js";
7
+ import { buildUploadMarkdown } from "./embed.js";
8
8
  import { readLocalRepoCommentConfig, resolveCommentOptions } from "./comment-config.js";
9
9
  import { urlForGithubEmbed } from "./public-urls.js";
10
10
  import { UploadsError } from "./errors.js";
@@ -411,9 +411,10 @@ export async function uploadPreparedImage(client, bytes, sourceName, opts) {
411
411
  }),
412
412
  metadata,
413
413
  });
414
- const markdown = buildMarkdown(urlForGithubEmbed(result.url, result.embedUrl), {
414
+ const markdown = buildUploadMarkdown(urlForGithubEmbed(result.url, result.embedUrl), {
415
415
  alt: opts.alt(prepared),
416
416
  width: opts.width,
417
+ key: result.key,
417
418
  });
418
419
  return { result, prepared, markdown, sentMetadata: metadata };
419
420
  }
@@ -748,8 +749,9 @@ async function uploadAttachmentBatch(opts) {
748
749
  upload: {
749
750
  ...result,
750
751
  file,
751
- markdown: buildMarkdown(urlForGithubEmbed(result.url, result.embedUrl), {
752
+ markdown: buildUploadMarkdown(urlForGithubEmbed(result.url, result.embedUrl), {
752
753
  alt: sourceName,
754
+ key: result.key,
753
755
  }),
754
756
  optimize: {
755
757
  optimized: prepared.optimized,
package/dist/embed.d.ts CHANGED
@@ -4,3 +4,13 @@ export declare function buildMarkdown(url: string, opts: {
4
4
  alt: string;
5
5
  width?: number;
6
6
  }): string;
7
+ /**
8
+ * Null-safe wrapper for upload flows: workspaces with no public base URL
9
+ * (BYO signed-URLs-only) upload fine but have no embeddable URL, and the
10
+ * markdown must degrade to honest plain text instead of `![alt](null)`.
11
+ */
12
+ export declare function buildUploadMarkdown(url: string | null | undefined, opts: {
13
+ alt: string;
14
+ width?: number;
15
+ key: string;
16
+ }): string;
package/dist/embed.js CHANGED
@@ -28,3 +28,14 @@ export function buildMarkdown(url, opts) {
28
28
  }
29
29
  return `![${opts.alt}](${url})`;
30
30
  }
31
+ /**
32
+ * Null-safe wrapper for upload flows: workspaces with no public base URL
33
+ * (BYO signed-URLs-only) upload fine but have no embeddable URL, and the
34
+ * markdown must degrade to honest plain text instead of `![alt](null)`.
35
+ */
36
+ export function buildUploadMarkdown(url, opts) {
37
+ if (!url) {
38
+ return `\`${opts.key}\` uploaded (no public URL — this workspace serves signed URLs only)`;
39
+ }
40
+ return buildMarkdown(url, opts);
41
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { inferContentType, buildMarkdown } from "./embed.js";
1
+ export { inferContentType, buildMarkdown, buildUploadMarkdown } from "./embed.js";
2
2
  export { DEFAULT_EMBED_PUBLIC_BASE_URL, embedBaseUrlFromEnv, embedUrlFromPublic, resolveEmbedBaseUrl, resolveEmbedUrl, urlForGithubEmbed, } from "./public-urls.js";
3
3
  export { sanitizeKeySegment, sha256Short, deriveRepoFromGit, buildScreenshotKey } from "./keys.js";
4
4
  export { BUILTIN_DESTINATIONS, isBuiltinDestination, keyMatchesDestination, resolveDestinationRoot, resolvePutPrefix, type BuiltinDestinationId, } from "./destinations.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { inferContentType, buildMarkdown } from "./embed.js";
1
+ export { inferContentType, buildMarkdown, buildUploadMarkdown } from "./embed.js";
2
2
  export { DEFAULT_EMBED_PUBLIC_BASE_URL, embedBaseUrlFromEnv, embedUrlFromPublic, resolveEmbedBaseUrl, resolveEmbedUrl, urlForGithubEmbed, } from "./public-urls.js";
3
3
  export { sanitizeKeySegment, sha256Short, deriveRepoFromGit, buildScreenshotKey } from "./keys.js";
4
4
  export { BUILTIN_DESTINATIONS, isBuiltinDestination, keyMatchesDestination, resolveDestinationRoot, resolvePutPrefix, } from "./destinations.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/uploads",
3
- "version": "0.37.2",
3
+ "version": "0.37.3",
4
4
  "description": "CLI and client for uploads.sh — workspace-scoped image hosting for GitHub embeds",
5
5
  "type": "module",
6
6
  "sideEffects": false,