@storyshelf/app 0.5.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.
Files changed (268) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -0
  3. package/dist/app-types.d.mts +54 -0
  4. package/dist/asset-manifest.mjs +41 -0
  5. package/dist/asset-manifest.mjs.map +1 -0
  6. package/dist/asset-paths.mjs +23 -0
  7. package/dist/asset-paths.mjs.map +1 -0
  8. package/dist/assets/htmx.min.js +3304 -0
  9. package/dist/assets/mark.svg +1 -0
  10. package/dist/capture-setup.mjs +139 -0
  11. package/dist/capture-setup.mjs.map +1 -0
  12. package/dist/credential-keys.mjs +20 -0
  13. package/dist/credential-keys.mjs.map +1 -0
  14. package/dist/credentials.mjs +56 -0
  15. package/dist/credentials.mjs.map +1 -0
  16. package/dist/index.d.mts +18 -0
  17. package/dist/index.mjs +310 -0
  18. package/dist/index.mjs.map +1 -0
  19. package/dist/lifecycle.mjs +132 -0
  20. package/dist/lifecycle.mjs.map +1 -0
  21. package/dist/middleware/auth-gate.mjs +36 -0
  22. package/dist/middleware/auth-gate.mjs.map +1 -0
  23. package/dist/middleware/csrf.mjs +75 -0
  24. package/dist/middleware/csrf.mjs.map +1 -0
  25. package/dist/middleware/rate-limit.mjs +68 -0
  26. package/dist/middleware/rate-limit.mjs.map +1 -0
  27. package/dist/middleware/request-log.mjs +30 -0
  28. package/dist/middleware/request-log.mjs.map +1 -0
  29. package/dist/middleware/server-timing.mjs +39 -0
  30. package/dist/middleware/server-timing.mjs.map +1 -0
  31. package/dist/middleware/setup-gate.mjs +37 -0
  32. package/dist/middleware/setup-gate.mjs.map +1 -0
  33. package/dist/middleware/store-scope.mjs +33 -0
  34. package/dist/middleware/store-scope.mjs.map +1 -0
  35. package/dist/notify.d.mts +17 -0
  36. package/dist/notify.mjs +141 -0
  37. package/dist/notify.mjs.map +1 -0
  38. package/dist/pages/admin-system.mjs +243 -0
  39. package/dist/pages/admin-system.mjs.map +1 -0
  40. package/dist/pages/build-detail.mjs +392 -0
  41. package/dist/pages/build-detail.mjs.map +1 -0
  42. package/dist/pages/build-diff-actions.mjs +162 -0
  43. package/dist/pages/build-diff-actions.mjs.map +1 -0
  44. package/dist/pages/build-diff-comments.mjs +104 -0
  45. package/dist/pages/build-diff-comments.mjs.map +1 -0
  46. package/dist/pages/build-diff-header.mjs +117 -0
  47. package/dist/pages/build-diff-header.mjs.map +1 -0
  48. package/dist/pages/build-diff-model.mjs +48 -0
  49. package/dist/pages/build-diff-model.mjs.map +1 -0
  50. package/dist/pages/build-diff-nav.mjs +122 -0
  51. package/dist/pages/build-diff-nav.mjs.map +1 -0
  52. package/dist/pages/build-diff-shortcuts.mjs +78 -0
  53. package/dist/pages/build-diff-shortcuts.mjs.map +1 -0
  54. package/dist/pages/build-diff-stale.mjs +70 -0
  55. package/dist/pages/build-diff-stale.mjs.map +1 -0
  56. package/dist/pages/build-diff-viewer.mjs +70 -0
  57. package/dist/pages/build-diff-viewer.mjs.map +1 -0
  58. package/dist/pages/build-diff.mjs +110 -0
  59. package/dist/pages/build-diff.mjs.map +1 -0
  60. package/dist/pages/compute-jobs.mjs +165 -0
  61. package/dist/pages/compute-jobs.mjs.map +1 -0
  62. package/dist/pages/invite.mjs +91 -0
  63. package/dist/pages/invite.mjs.map +1 -0
  64. package/dist/pages/label-detail.mjs +154 -0
  65. package/dist/pages/label-detail.mjs.map +1 -0
  66. package/dist/pages/library.mjs +343 -0
  67. package/dist/pages/library.mjs.map +1 -0
  68. package/dist/pages/login.mjs +117 -0
  69. package/dist/pages/login.mjs.map +1 -0
  70. package/dist/pages/passkey-ceremony.mjs +97 -0
  71. package/dist/pages/passkey-ceremony.mjs.map +1 -0
  72. package/dist/pages/profile.mjs +364 -0
  73. package/dist/pages/profile.mjs.map +1 -0
  74. package/dist/pages/project-builds-table.mjs +151 -0
  75. package/dist/pages/project-builds-table.mjs.map +1 -0
  76. package/dist/pages/project-builds.mjs +143 -0
  77. package/dist/pages/project-builds.mjs.map +1 -0
  78. package/dist/pages/project-create.mjs +90 -0
  79. package/dist/pages/project-create.mjs.map +1 -0
  80. package/dist/pages/project-settings.mjs +95 -0
  81. package/dist/pages/project-settings.mjs.map +1 -0
  82. package/dist/pages/projects-card.mjs +194 -0
  83. package/dist/pages/projects-card.mjs.map +1 -0
  84. package/dist/pages/projects.mjs +129 -0
  85. package/dist/pages/projects.mjs.map +1 -0
  86. package/dist/pages/root.mjs +98 -0
  87. package/dist/pages/root.mjs.map +1 -0
  88. package/dist/pages/settings-general.mjs +138 -0
  89. package/dist/pages/settings-general.mjs.map +1 -0
  90. package/dist/pages/settings-labels.mjs +107 -0
  91. package/dist/pages/settings-labels.mjs.map +1 -0
  92. package/dist/pages/settings-members.mjs +192 -0
  93. package/dist/pages/settings-members.mjs.map +1 -0
  94. package/dist/pages/settings-notifications.mjs +240 -0
  95. package/dist/pages/settings-notifications.mjs.map +1 -0
  96. package/dist/pages/settings-status.mjs +137 -0
  97. package/dist/pages/settings-status.mjs.map +1 -0
  98. package/dist/pages/settings-tests.mjs +111 -0
  99. package/dist/pages/settings-tests.mjs.map +1 -0
  100. package/dist/pages/settings-tokens.mjs +90 -0
  101. package/dist/pages/settings-tokens.mjs.map +1 -0
  102. package/dist/pages/settings-webhooks.mjs +104 -0
  103. package/dist/pages/settings-webhooks.mjs.map +1 -0
  104. package/dist/pages/storybook.mjs +116 -0
  105. package/dist/pages/storybook.mjs.map +1 -0
  106. package/dist/retention-timer.mjs +65 -0
  107. package/dist/retention-timer.mjs.map +1 -0
  108. package/dist/routers/admin-pages.mjs +48 -0
  109. package/dist/routers/admin-pages.mjs.map +1 -0
  110. package/dist/routers/admin.mjs +113 -0
  111. package/dist/routers/admin.mjs.map +1 -0
  112. package/dist/routers/assets.mjs +64 -0
  113. package/dist/routers/assets.mjs.map +1 -0
  114. package/dist/routers/attempts.mjs +96 -0
  115. package/dist/routers/attempts.mjs.map +1 -0
  116. package/dist/routers/auth-sync.mjs +64 -0
  117. package/dist/routers/auth-sync.mjs.map +1 -0
  118. package/dist/routers/auth.mjs +236 -0
  119. package/dist/routers/auth.mjs.map +1 -0
  120. package/dist/routers/baseline-guard.mjs +83 -0
  121. package/dist/routers/baseline-guard.mjs.map +1 -0
  122. package/dist/routers/builds.handlers.mjs +217 -0
  123. package/dist/routers/builds.handlers.mjs.map +1 -0
  124. package/dist/routers/builds.mjs +381 -0
  125. package/dist/routers/builds.mjs.map +1 -0
  126. package/dist/routers/comments.mjs +109 -0
  127. package/dist/routers/comments.mjs.map +1 -0
  128. package/dist/routers/flash.mjs +35 -0
  129. package/dist/routers/flash.mjs.map +1 -0
  130. package/dist/routers/health-report.mjs +159 -0
  131. package/dist/routers/health-report.mjs.map +1 -0
  132. package/dist/routers/health.mjs +46 -0
  133. package/dist/routers/health.mjs.map +1 -0
  134. package/dist/routers/helpers.mjs +110 -0
  135. package/dist/routers/helpers.mjs.map +1 -0
  136. package/dist/routers/htmx.mjs +24 -0
  137. package/dist/routers/htmx.mjs.map +1 -0
  138. package/dist/routers/labels.mjs +118 -0
  139. package/dist/routers/labels.mjs.map +1 -0
  140. package/dist/routers/media.mjs +53 -0
  141. package/dist/routers/media.mjs.map +1 -0
  142. package/dist/routers/members.mjs +177 -0
  143. package/dist/routers/members.mjs.map +1 -0
  144. package/dist/routers/notification-channels.mjs +190 -0
  145. package/dist/routers/notification-channels.mjs.map +1 -0
  146. package/dist/routers/notification-subscriptions.mjs +120 -0
  147. package/dist/routers/notification-subscriptions.mjs.map +1 -0
  148. package/dist/routers/profile.mjs +276 -0
  149. package/dist/routers/profile.mjs.map +1 -0
  150. package/dist/routers/projects.mjs +133 -0
  151. package/dist/routers/projects.mjs.map +1 -0
  152. package/dist/routers/review-next.mjs +47 -0
  153. package/dist/routers/review-next.mjs.map +1 -0
  154. package/dist/routers/schemas.mjs +337 -0
  155. package/dist/routers/schemas.mjs.map +1 -0
  156. package/dist/routers/settings-general.mjs +104 -0
  157. package/dist/routers/settings-general.mjs.map +1 -0
  158. package/dist/routers/settings-labels.mjs +52 -0
  159. package/dist/routers/settings-labels.mjs.map +1 -0
  160. package/dist/routers/settings-members.mjs +58 -0
  161. package/dist/routers/settings-members.mjs.map +1 -0
  162. package/dist/routers/settings-notifications.mjs +108 -0
  163. package/dist/routers/settings-notifications.mjs.map +1 -0
  164. package/dist/routers/settings-status.mjs +77 -0
  165. package/dist/routers/settings-status.mjs.map +1 -0
  166. package/dist/routers/settings-tokens.mjs +40 -0
  167. package/dist/routers/settings-tokens.mjs.map +1 -0
  168. package/dist/routers/settings-webhooks.mjs +67 -0
  169. package/dist/routers/settings-webhooks.mjs.map +1 -0
  170. package/dist/routers/settings.handlers.mjs +149 -0
  171. package/dist/routers/settings.handlers.mjs.map +1 -0
  172. package/dist/routers/settings.mjs +25 -0
  173. package/dist/routers/settings.mjs.map +1 -0
  174. package/dist/routers/snapshots.mjs +240 -0
  175. package/dist/routers/snapshots.mjs.map +1 -0
  176. package/dist/routers/status-configs.mjs +108 -0
  177. package/dist/routers/status-configs.mjs.map +1 -0
  178. package/dist/routers/storybook.mjs +171 -0
  179. package/dist/routers/storybook.mjs.map +1 -0
  180. package/dist/routers/tokens.mjs +91 -0
  181. package/dist/routers/tokens.mjs.map +1 -0
  182. package/dist/routers/ui.mjs +166 -0
  183. package/dist/routers/ui.mjs.map +1 -0
  184. package/dist/routers/webhooks.mjs +97 -0
  185. package/dist/routers/webhooks.mjs.map +1 -0
  186. package/dist/routers/well-known.mjs +43 -0
  187. package/dist/routers/well-known.mjs.map +1 -0
  188. package/dist/runtime.mjs +52 -0
  189. package/dist/runtime.mjs.map +1 -0
  190. package/dist/store.mjs +20 -0
  191. package/dist/store.mjs.map +1 -0
  192. package/dist/ui/avatar.mjs +76 -0
  193. package/dist/ui/avatar.mjs.map +1 -0
  194. package/dist/ui/buttons.mjs +205 -0
  195. package/dist/ui/buttons.mjs.map +1 -0
  196. package/dist/ui/code-block.mjs +47 -0
  197. package/dist/ui/code-block.mjs.map +1 -0
  198. package/dist/ui/compare-stage.mjs +344 -0
  199. package/dist/ui/compare-stage.mjs.map +1 -0
  200. package/dist/ui/csrf-field.mjs +20 -0
  201. package/dist/ui/csrf-field.mjs.map +1 -0
  202. package/dist/ui/css.mjs +36 -0
  203. package/dist/ui/css.mjs.map +1 -0
  204. package/dist/ui/document.mjs +130 -0
  205. package/dist/ui/document.mjs.map +1 -0
  206. package/dist/ui/dropdown.mjs +181 -0
  207. package/dist/ui/dropdown.mjs.map +1 -0
  208. package/dist/ui/feedback.mjs +341 -0
  209. package/dist/ui/feedback.mjs.map +1 -0
  210. package/dist/ui/filter-input.mjs +58 -0
  211. package/dist/ui/filter-input.mjs.map +1 -0
  212. package/dist/ui/forms.mjs +291 -0
  213. package/dist/ui/forms.mjs.map +1 -0
  214. package/dist/ui/icons/icon.mjs +53 -0
  215. package/dist/ui/icons/icon.mjs.map +1 -0
  216. package/dist/ui/icons/paths.mjs +61 -0
  217. package/dist/ui/icons/paths.mjs.map +1 -0
  218. package/dist/ui/icons/sprite.mjs +26 -0
  219. package/dist/ui/icons/sprite.mjs.map +1 -0
  220. package/dist/ui/kbd.mjs +33 -0
  221. package/dist/ui/kbd.mjs.map +1 -0
  222. package/dist/ui/layout.mjs +173 -0
  223. package/dist/ui/layout.mjs.map +1 -0
  224. package/dist/ui/progress.mjs +44 -0
  225. package/dist/ui/progress.mjs.map +1 -0
  226. package/dist/ui/segmented.mjs +77 -0
  227. package/dist/ui/segmented.mjs.map +1 -0
  228. package/dist/ui/shell/account.mjs +161 -0
  229. package/dist/ui/shell/account.mjs.map +1 -0
  230. package/dist/ui/shell/bare.mjs +69 -0
  231. package/dist/ui/shell/bare.mjs.map +1 -0
  232. package/dist/ui/shell/boot-script.mjs +46 -0
  233. package/dist/ui/shell/boot-script.mjs.map +1 -0
  234. package/dist/ui/shell/client-script.mjs +259 -0
  235. package/dist/ui/shell/client-script.mjs.map +1 -0
  236. package/dist/ui/shell/nav.mjs +111 -0
  237. package/dist/ui/shell/nav.mjs.map +1 -0
  238. package/dist/ui/shell/review-script.mjs +195 -0
  239. package/dist/ui/shell/review-script.mjs.map +1 -0
  240. package/dist/ui/shell/sidebar.mjs +323 -0
  241. package/dist/ui/shell/sidebar.mjs.map +1 -0
  242. package/dist/ui/shell/topbar.mjs +268 -0
  243. package/dist/ui/shell/topbar.mjs.map +1 -0
  244. package/dist/ui/stacks.mjs +82 -0
  245. package/dist/ui/stacks.mjs.map +1 -0
  246. package/dist/ui/styles/base.mjs +41 -0
  247. package/dist/ui/styles/base.mjs.map +1 -0
  248. package/dist/ui/styles/behavior.mjs +43 -0
  249. package/dist/ui/styles/behavior.mjs.map +1 -0
  250. package/dist/ui/styles/review-layout.mjs +347 -0
  251. package/dist/ui/styles/review-layout.mjs.map +1 -0
  252. package/dist/ui/styles/review.mjs +86 -0
  253. package/dist/ui/styles/review.mjs.map +1 -0
  254. package/dist/ui/styles/tokens.mjs +132 -0
  255. package/dist/ui/styles/tokens.mjs.map +1 -0
  256. package/dist/ui/styles.mjs +19 -0
  257. package/dist/ui/styles.mjs.map +1 -0
  258. package/dist/ui/subnav.mjs +91 -0
  259. package/dist/ui/subnav.mjs.map +1 -0
  260. package/dist/ui/table.mjs +73 -0
  261. package/dist/ui/table.mjs.map +1 -0
  262. package/dist/ui/theme.mjs +64 -0
  263. package/dist/ui/theme.mjs.map +1 -0
  264. package/dist/ui/thumbnail.mjs +51 -0
  265. package/dist/ui/thumbnail.mjs.map +1 -0
  266. package/dist/ui/time.mjs +50 -0
  267. package/dist/ui/time.mjs.map +1 -0
  268. package/package.json +92 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Siddhant Gupta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @storyshelf/app
2
+
3
+ The StoryShelf HTTP app: `createShelfApp()` composes database, storage, capture, auth, and git-host adapters (all from `@storyshelf/core`) into a complete Hono application — JSON API under `/api/v1` plus server-rendered HTML pages (hono/jsx + HTMX, no client framework).
4
+
5
+ ## Quick start
6
+
7
+ ```ts
8
+ import { createShelfApp } from "@storyshelf/app";
9
+
10
+ const app = createShelfApp({ database, storage, captureRunner });
11
+ await app.lifecycle.init();
12
+
13
+ serve({ fetch: app.fetch, port: 3000 });
14
+ ```
15
+
16
+ ## How it fits in
17
+
18
+ `app` owns everything HTTP: `routers/`, `pages/`, `ui/`, `middleware/`, the request `store`, and vendored assets. All domain logic — adapter interfaces, models, schema, capture pipeline, retention, diff — lives in `@storyshelf/core` and is imported here through its granular subpaths (never the core barrel, which is now domain-only). Queue and remote workers depend on core alone and pull zero HTTP modules.
@@ -0,0 +1,54 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { OpenAPIHono } from "@hono/zod-openapi";
4
+ import { AdapterSetupResult } from "@storyshelf/core/adapter/setup";
5
+ import { NotifierProvider } from "@storyshelf/core/adapter/notifier";
6
+ import { AuthUser } from "@storyshelf/core/types";
7
+ import { ShelfConfig, UIConfig } from "@storyshelf/core/config";
8
+ import { Logger, createShelfLogger } from "@storyshelf/core/logger";
9
+ import { CaptureQueue } from "@storyshelf/core/adapter/capture-queue";
10
+ import { DatabaseAdapter } from "@storyshelf/core/adapter/database";
11
+ import { GitHostProvider } from "@storyshelf/core/adapter/git-host";
12
+ import { StorageAdapter } from "@storyshelf/core/adapter/storage";
13
+ //#region src/app-types.d.ts
14
+ /** Per-request shelf context (adapters, config, user, capture queue). */
15
+ interface ShelfContext {
16
+ requestId?: string;
17
+ db: DatabaseAdapter;
18
+ storage: StorageAdapter;
19
+ config: ShelfConfig;
20
+ ui: UIConfig;
21
+ logger: ReturnType<typeof createShelfLogger>;
22
+ user: AuthUser | null;
23
+ authEnabled: boolean;
24
+ enqueueCapture?: (buildId: string, reqId?: string) => Promise<void>;
25
+ captureQueue: CaptureQueue | null;
26
+ gitHosts: GitHostProvider[];
27
+ notifiers: NotifierProvider[];
28
+ }
29
+ /** Hono router type carrying the shelf context variables. */
30
+ type ShelfRouter = OpenAPIHono<{
31
+ Variables: ShelfContext;
32
+ }>;
33
+ /** App-scoped adapter lifecycle namespace (single `lifecycle` prop avoids Hono collisions). */
34
+ interface ShelfLifecycle {
35
+ /** Settled summary of the eager background setup run; never rejects. */
36
+ readonly ready: Promise<AdapterSetupResult>;
37
+ /** The resolved logger: the passed-in instance, or the app-created default. */
38
+ readonly logger: Logger;
39
+ /**
40
+ * Fail-fast await for server startup (`await app.lifecycle.setup()`).
41
+ * Re-runs setup so transient failures are retryable; throws AdapterLifecycleError.
42
+ * Optional — when skipped, the first request gates on `ready` instead.
43
+ */
44
+ setup(): Promise<void>;
45
+ /** Graceful teardown for SIGTERM/SIGINT (`await app.lifecycle.teardown()`). Idempotent. */
46
+ teardown(): Promise<void>;
47
+ }
48
+ /** Shelf app with the shelf lifecycle namespace attached. */
49
+ type ShelfApp = ShelfRouter & {
50
+ readonly lifecycle: ShelfLifecycle;
51
+ };
52
+ //#endregion
53
+ export { ShelfApp, ShelfContext, ShelfLifecycle, ShelfRouter };
54
+ //# sourceMappingURL=app-types.d.mts.map
@@ -0,0 +1,41 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { contentHash, iconSprite, iconSpriteHash, iconSpriteHref } from "./ui/icons/sprite.mjs";
5
+ import { findAsset } from "./asset-paths.mjs";
6
+ import { readFileSync } from "node:fs";
7
+ //#region src/asset-manifest.ts
8
+ /**
9
+ * Static assets with content-addressed URLs. A URL that embeds the content
10
+ * hash may be cached forever (`immutable`): changing the file changes the
11
+ * URL. Loaded synchronously once so the page shell can reference the URLs.
12
+ */
13
+ const htmxSource = readFileSync(findAsset("htmx.min.js", import.meta.url), "utf8");
14
+ const htmxHash = contentHash(htmxSource);
15
+ /**
16
+ * The StoryShelf brand mark. Serves as the enforced favicon and as the default
17
+ * sidebar logo when `ui.logo` is not set.
18
+ */
19
+ const markSource = readFileSync(findAsset("mark.svg", import.meta.url), "utf8");
20
+ const markHash = contentHash(markSource);
21
+ const assetManifest = {
22
+ htmx: {
23
+ source: htmxSource,
24
+ hash: htmxHash,
25
+ href: `/assets/htmx-${htmxHash}.js`
26
+ },
27
+ icons: {
28
+ source: iconSprite,
29
+ hash: iconSpriteHash,
30
+ href: iconSpriteHref
31
+ },
32
+ mark: {
33
+ source: markSource,
34
+ hash: markHash,
35
+ href: `/assets/mark-${markHash}.svg`
36
+ }
37
+ };
38
+ //#endregion
39
+ export { assetManifest };
40
+
41
+ //# sourceMappingURL=asset-manifest.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-manifest.mjs","names":[],"sources":["../src/asset-manifest.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { findAsset } from \"./asset-paths.ts\";\nimport { contentHash, iconSprite, iconSpriteHash, iconSpriteHref } from \"./ui/icons/sprite.ts\";\n\n/**\n * Static assets with content-addressed URLs. A URL that embeds the content\n * hash may be cached forever (`immutable`): changing the file changes the\n * URL. Loaded synchronously once so the page shell can reference the URLs.\n */\nconst htmxSource = readFileSync(findAsset(\"htmx.min.js\", import.meta.url), \"utf8\");\nconst htmxHash = contentHash(htmxSource);\n\n/**\n * The StoryShelf brand mark. Serves as the enforced favicon and as the default\n * sidebar logo when `ui.logo` is not set.\n */\nconst markSource = readFileSync(findAsset(\"mark.svg\", import.meta.url), \"utf8\");\nconst markHash = contentHash(markSource);\n\nexport const assetManifest = {\n htmx: { source: htmxSource, hash: htmxHash, href: `/assets/htmx-${htmxHash}.js` },\n icons: { source: iconSprite, hash: iconSpriteHash, href: iconSpriteHref },\n mark: { source: markSource, hash: markHash, href: `/assets/mark-${markHash}.svg` },\n} as const;\n"],"mappings":";;;;;;;;;;;;AASA,MAAM,aAAa,aAAa,UAAU,eAAe,YAAY,GAAG,GAAG,MAAM;AACjF,MAAM,WAAW,YAAY,UAAU;;;;;AAMvC,MAAM,aAAa,aAAa,UAAU,YAAY,YAAY,GAAG,GAAG,MAAM;AAC9E,MAAM,WAAW,YAAY,UAAU;AAEvC,MAAa,gBAAgB;CAC3B,MAAM;EAAE,QAAQ;EAAY,MAAM;EAAU,MAAM,gBAAgB,SAAS;CAAK;CAChF,OAAO;EAAE,QAAQ;EAAY,MAAM;EAAgB,MAAM;CAAe;CACxE,MAAM;EAAE,QAAQ;EAAY,MAAM;EAAU,MAAM,gBAAgB,SAAS;CAAM;AACnF"}
@@ -0,0 +1,23 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { existsSync } from "node:fs";
5
+ import { fileURLToPath } from "node:url";
6
+ //#region src/asset-paths.ts
7
+ /**
8
+ * Locate a vendored file under `assets/` for the three layouts the app runs in:
9
+ * - from source / the published library build, `assets/` sits next to the module;
10
+ * - in the bundled Fly server (`dist/server.mjs`) it sits one level up
11
+ * (`/app/assets`, copied by the Dockerfile).
12
+ * Throws with every path tried, since a missing file is a packaging bug.
13
+ */
14
+ function findAsset(name, from, exists = existsSync) {
15
+ const candidates = [`assets/${name}`, `../assets/${name}`].map((relative) => fileURLToPath(new URL(relative, from)));
16
+ const found = candidates.find((path) => exists(path));
17
+ if (!found) throw new Error(`Vendored asset "${name}" not found. Looked in: ${candidates.join(", ")}`);
18
+ return found;
19
+ }
20
+ //#endregion
21
+ export { findAsset };
22
+
23
+ //# sourceMappingURL=asset-paths.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-paths.mjs","names":[],"sources":["../src/asset-paths.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Locate a vendored file under `assets/` for the three layouts the app runs in:\n * - from source / the published library build, `assets/` sits next to the module;\n * - in the bundled Fly server (`dist/server.mjs`) it sits one level up\n * (`/app/assets`, copied by the Dockerfile).\n * Throws with every path tried, since a missing file is a packaging bug.\n */\nexport function findAsset(\n name: string,\n from: string | URL,\n exists: (path: string) => boolean = existsSync,\n): string {\n const candidates = [`assets/${name}`, `../assets/${name}`].map((relative) =>\n fileURLToPath(new URL(relative, from)),\n );\n const found = candidates.find((path) => exists(path));\n if (!found) {\n throw new Error(`Vendored asset \"${name}\" not found. Looked in: ${candidates.join(\", \")}`);\n }\n return found;\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,SAAgB,UACd,MACA,MACA,SAAoC,YAC5B;CACR,MAAM,aAAa,CAAC,UAAU,QAAQ,aAAa,MAAM,CAAC,CAAC,KAAK,aAC9D,cAAc,IAAI,IAAI,UAAU,IAAI,CAAC,CACvC;CACA,MAAM,QAAQ,WAAW,MAAM,SAAS,OAAO,IAAI,CAAC;CACpD,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mBAAmB,KAAK,0BAA0B,WAAW,KAAK,IAAI,GAAG;CAE3F,OAAO;AACT"}