@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.91

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 (223) hide show
  1. package/compiler-assets/nextjs/defaults/group/layout.tsx +1 -5
  2. package/compiler-assets/nextjs/defaults/group/page.tsx +31 -22
  3. package/compiler-assets/nextjs/defaults/project/next.config.mjs +19 -10
  4. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
  5. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  6. package/compiler-assets/nextjs/shims/document.tsx +38 -0
  7. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +2 -0
  8. package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
  9. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  10. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  11. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  12. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  13. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  14. package/compiler-assets/nextjs/shims/proxy.ts +126 -60
  15. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
  16. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
  17. package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
  18. package/dist/{build-operation-2JAYBSKF.js → build-operation-5QMLXF7N.js} +29 -23
  19. package/dist/{button-c3WGnxIj.d.ts → button-BdCScEKi.d.ts} +3 -3
  20. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  21. package/dist/chunk-22RSSUNV.js +13 -0
  22. package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
  23. package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
  24. package/dist/chunk-5KAD7W53.js +248 -0
  25. package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
  26. package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
  27. package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
  28. package/dist/chunk-EFO6AWXN.js +19 -0
  29. package/dist/{chunk-726GV2NF.js → chunk-F3AGNDF4.js} +100 -67
  30. package/dist/chunk-GBPLER5H.js +426 -0
  31. package/dist/chunk-IL4RJOKI.js +186 -0
  32. package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
  33. package/dist/{chunk-VO2I7MTM.js → chunk-ORIUWJBQ.js} +8 -6
  34. package/dist/{chunk-H6XILMZX.js → chunk-OXOFRXEI.js} +1806 -831
  35. package/dist/chunk-UYGCOWRF.js +1709 -0
  36. package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
  37. package/dist/compiler.d.ts +15 -2
  38. package/dist/compiler.js +90 -21
  39. package/dist/components/blocks/agent-actions.d.ts +81 -0
  40. package/dist/components/blocks/agent-actions.js +594 -0
  41. package/dist/components/blocks/toc.d.ts +43 -0
  42. package/dist/components/blocks/toc.js +136 -0
  43. package/dist/components/ui/button.d.ts +5 -0
  44. package/dist/components/ui/button.js +94 -0
  45. package/dist/compose-CVBJRAF6.js +16 -0
  46. package/dist/config/createNextConfig.js +17 -3
  47. package/dist/{dev-operation-TZDVJCN7.js → dev-operation-OSHHWRWK.js} +121 -81
  48. package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
  49. package/dist/ide-support-CU6Z5PVR.js +16 -0
  50. package/dist/index.d.ts +40 -1
  51. package/dist/jsx-dev-runtime.d.ts +6 -0
  52. package/dist/jsx-dev-runtime.js +100 -0
  53. package/dist/jsx-runtime.d.ts +7 -0
  54. package/dist/jsx-runtime.js +97 -0
  55. package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
  56. package/dist/kernel/components/blocks/AgentActions.js +383 -142
  57. package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
  58. package/dist/kernel/components/blocks/agent-actions.js +594 -0
  59. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  60. package/dist/kernel/components/blocks/color-palette.js +4 -4
  61. package/dist/kernel/components/blocks/logo-block.js +1 -1
  62. package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -2
  63. package/dist/kernel/components/blocks/navbar.js +17 -17
  64. package/dist/kernel/components/blocks/navigation-progress.js +2 -2
  65. package/dist/kernel/components/blocks/next-prev.js +1 -1
  66. package/dist/kernel/components/blocks/page-list.js +2 -2
  67. package/dist/kernel/components/blocks/search.d.ts +1 -1
  68. package/dist/kernel/components/blocks/search.js +16 -17
  69. package/dist/kernel/components/blocks/sidebar-node.js +1 -1
  70. package/dist/kernel/components/blocks/sidebar.js +7 -4
  71. package/dist/kernel/components/blocks/theme-toggle.d.ts +1 -1
  72. package/dist/kernel/components/blocks/theme-toggle.js +5 -5
  73. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  74. package/dist/kernel/components/blocks/toc-client.js +495 -0
  75. package/dist/kernel/components/blocks/toc.d.ts +19 -1
  76. package/dist/kernel/components/blocks/toc.js +121 -179
  77. package/dist/kernel/components/mdx/components/blockquote.js +1 -1
  78. package/dist/kernel/components/mdx/components/callout.js +1 -1
  79. package/dist/kernel/components/mdx/components/code-block.js +2 -2
  80. package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
  81. package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
  82. package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
  83. package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
  84. package/dist/kernel/components/mdx/components/figure.js +23 -13
  85. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  86. package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
  87. package/dist/kernel/components/mdx/components/heading.js +6 -3
  88. package/dist/kernel/components/mdx/components/hr.js +2 -2
  89. package/dist/kernel/components/mdx/components/image-zoom.js +1 -1
  90. package/dist/kernel/components/mdx/components/image.d.ts +1 -1
  91. package/dist/kernel/components/mdx/components/image.js +21 -16
  92. package/dist/kernel/components/mdx/components/inline-code.js +1 -1
  93. package/dist/kernel/components/mdx/components/kbd.js +2 -2
  94. package/dist/kernel/components/mdx/components/link.d.ts +3 -3
  95. package/dist/kernel/components/mdx/components/link.js +2 -2
  96. package/dist/kernel/components/mdx/components/paragraph.js +1 -1
  97. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  98. package/dist/kernel/components/mdx/components/table.js +2 -2
  99. package/dist/kernel/components/mdx/components/task-list.js +1 -1
  100. package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
  101. package/dist/kernel/components/mdx/components/video-player.js +6 -2
  102. package/dist/kernel/components/mdx/components/video.d.ts +5 -3
  103. package/dist/kernel/components/mdx/components/video.js +7 -5
  104. package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
  105. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  106. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  107. package/dist/kernel/components/mdx/mdx.d.ts +20 -10
  108. package/dist/kernel/components/mdx/mdx.js +231 -34
  109. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  110. package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
  111. package/dist/kernel/components/mdx/types.d.ts +1 -1
  112. package/dist/kernel/components/next-image.d.ts +12 -0
  113. package/dist/kernel/components/next-image.js +61 -0
  114. package/dist/kernel/components/ui/accordion.js +1 -1
  115. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +2 -2
  116. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  117. package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
  118. package/dist/kernel/components/ui/breadcrumb.js +4 -4
  119. package/dist/kernel/components/ui/button-group.d.ts +1 -1
  120. package/dist/kernel/components/ui/button-group.js +3 -3
  121. package/dist/kernel/components/ui/button.d.ts +56 -4
  122. package/dist/kernel/components/ui/button.js +43 -39
  123. package/dist/kernel/components/ui/card.js +1 -1
  124. package/dist/kernel/components/ui/dialog.js +1 -1
  125. package/dist/kernel/components/ui/drawer.js +1 -1
  126. package/dist/kernel/components/ui/input.d.ts +2 -2
  127. package/dist/kernel/components/ui/input.js +1 -1
  128. package/dist/kernel/components/ui/kbd.d.ts +1 -1
  129. package/dist/kernel/components/ui/kbd.js +1 -1
  130. package/dist/kernel/components/ui/link.d.ts +8 -2
  131. package/dist/kernel/components/ui/link.js +2 -2
  132. package/dist/kernel/components/ui/menu.js +1 -1
  133. package/dist/kernel/components/ui/mod-key.js +2 -2
  134. package/dist/kernel/components/ui/navigation-menu.js +1 -1
  135. package/dist/kernel/components/ui/popover.js +1 -1
  136. package/dist/kernel/components/ui/progress.js +1 -1
  137. package/dist/kernel/components/ui/scroll-area.d.ts +8 -8
  138. package/dist/kernel/components/ui/scroll-area.js +1 -1
  139. package/dist/kernel/components/ui/select.js +1 -1
  140. package/dist/kernel/components/ui/separator.js +1 -1
  141. package/dist/kernel/components/ui/table.js +1 -1
  142. package/dist/kernel/components/ui/tabs.js +1 -1
  143. package/dist/kernel/components/ui/tag.js +1 -1
  144. package/dist/kernel/components/ui/text.d.ts +1 -1
  145. package/dist/kernel/components/ui/text.js +1 -1
  146. package/dist/kernel/components/ui/toast.js +1 -1
  147. package/dist/kernel/components/ui/tooltip.js +1 -1
  148. package/dist/kernel/defaults.registry.d.ts +2 -15
  149. package/dist/kernel/defaults.registry.js +2 -17
  150. package/dist/kernel/routes/agent/markdown.d.ts +3 -0
  151. package/dist/kernel/routes/agent/markdown.js +219 -48
  152. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  153. package/dist/kernel/routes/layouts/group.js +5 -7
  154. package/dist/kernel/routes/metadata/feed.d.ts +1 -1
  155. package/dist/kernel/routes/metadata/feed.js +109 -83
  156. package/dist/kernel/routes/metadata/llms.d.ts +11 -3
  157. package/dist/kernel/routes/metadata/llms.js +154 -57
  158. package/dist/kernel/routes/metadata/og-image.js +1 -1
  159. package/dist/kernel/routes/metadata/robots.d.ts +1 -1
  160. package/dist/kernel/routes/metadata/sitemap.d.ts +22 -3
  161. package/dist/kernel/routes/metadata/sitemap.js +183 -43
  162. package/dist/kernel/routes/not-found.d.ts +34 -0
  163. package/dist/kernel/routes/not-found.js +213 -0
  164. package/dist/kernel/routes/pages/group.d.ts +2 -2
  165. package/dist/kernel/routes/pages/group.js +1 -1
  166. package/dist/kernel/routes/pages/leaf.d.ts +30 -3
  167. package/dist/kernel/routes/pages/leaf.js +5 -4
  168. package/dist/kernel/routes/pages/root.d.ts +2 -2
  169. package/dist/kernel/routes/pages/root.js +1 -1
  170. package/dist/keyboard-shortcuts.js +1 -1
  171. package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
  172. package/dist/search.js +7 -9
  173. package/dist/theme-scope.js +1 -1
  174. package/dist/{types-BzkZty3r.d.ts → types-J2w_puPF.d.ts} +1 -20
  175. package/dist/types-sM2g9nW0.d.ts +12 -0
  176. package/dist/types.d.ts +1 -0
  177. package/dist/utils/heading-ids.js +30 -11
  178. package/dist/utils/toc-selection.d.ts +7 -0
  179. package/dist/utils/toc-selection.js +14 -0
  180. package/dist/validate-local-source-SV44DBQT.js +16 -0
  181. package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
  182. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  183. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  184. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  185. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  186. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  187. package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
  188. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  189. package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
  190. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  191. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
  192. package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
  193. package/init/seed/minimal/publish.os/publish.os.config.json +6 -2
  194. package/init/seed/minimal/publish.os/theme.css +3 -3
  195. package/init/seed/minimal/seed.json +11 -4
  196. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
  197. package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
  198. package/package.json +45 -20
  199. package/release/app/phosphor/package.json +3 -3
  200. package/release/app/phosphor/pnpm-lock.yaml.template +88 -75
  201. package/release/compiler/package.json +5 -3
  202. package/release/compiler/pnpm-lock.yaml.template +118 -74
  203. package/release/release.json +6 -6
  204. package/dist/button-CtzUJB8u.d.ts +0 -11
  205. package/dist/chunk-535TM4A5.js +0 -1455
  206. package/dist/chunk-B2V22WRT.js +0 -297
  207. package/dist/chunk-NECL5IBJ.js +0 -318
  208. package/dist/chunk-SVYGXXYR.js +0 -36
  209. package/dist/chunk-UF6ATARM.js +0 -1100
  210. package/dist/compose-NN23UJGC.js +0 -13
  211. package/dist/ide-support-ZNW7ODFY.js +0 -15
  212. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  213. package/dist/kernel/components/blocks/design-system-preview.js +0 -667
  214. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  215. package/dist/kernel/components/blocks/link-playground.js +0 -744
  216. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  217. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  218. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  219. package/dist/kernel/components/ui/theme-toggle.js +0 -53
  220. package/dist/validate-local-source-XRL2Y7XE.js +0 -14
  221. package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
  222. package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
  223. package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
@@ -13,6 +13,90 @@ function canonicalUrl(manifest, path, group) {
13
13
  }
14
14
  }
15
15
 
16
+ // src/lib/runtime/metadata/feed-serialization.ts
17
+ function xmlEscape(value) {
18
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
19
+ }
20
+ function latestDate(pages) {
21
+ let timestamp = Math.max(
22
+ 0,
23
+ ...pages.map((page) => {
24
+ let date = page.publishedAt ?? page.updatedAt;
25
+ if (!date) return -1 / 0;
26
+ let parsed = Date.parse(date);
27
+ return Number.isNaN(parsed) ? -1 / 0 : parsed;
28
+ })
29
+ );
30
+ return new Date(timestamp).toISOString();
31
+ }
32
+ function serializeRssFeed(input) {
33
+ let description = input.description ?? input.title, items = input.pages.map((page) => {
34
+ let publishedAt = page.publishedAt, pubDate = publishedAt ? `
35
+ <pubDate>${xmlEscape(new Date(publishedAt).toUTCString())}</pubDate>` : "", itemDescription = page.description ? `
36
+ <description>${xmlEscape(page.description)}</description>` : "";
37
+ return ` <item>
38
+ <title>${xmlEscape(page.title)}</title>
39
+ <link>${xmlEscape(page.url)}</link>
40
+ <guid>${xmlEscape(page.url)}</guid>${pubDate}${itemDescription}
41
+ </item>`;
42
+ }).join(`
43
+ `);
44
+ return `<?xml version="1.0" encoding="UTF-8"?>
45
+ <rss version="2.0">
46
+ <channel>
47
+ <title>${xmlEscape(input.title)}</title>
48
+ <link>${xmlEscape(input.homeUrl)}</link>
49
+ <description>${xmlEscape(description)}</description>
50
+ ${items}
51
+ </channel>
52
+ </rss>
53
+ `;
54
+ }
55
+ function serializeAtomFeed(input) {
56
+ let entries = input.pages.map((page) => {
57
+ let date = page.publishedAt ?? page.updatedAt, updated = date ? new Date(date).toISOString() : latestDate([]), summary = page.description ? `
58
+ <summary>${xmlEscape(page.description)}</summary>` : "";
59
+ return ` <entry>
60
+ <title>${xmlEscape(page.title)}</title>
61
+ <id>${xmlEscape(page.url)}</id>
62
+ <link href="${xmlEscape(page.url)}" />
63
+ <updated>${xmlEscape(updated)}</updated>${summary}
64
+ </entry>`;
65
+ }).join(`
66
+ `);
67
+ return `<?xml version="1.0" encoding="UTF-8"?>
68
+ <feed xmlns="http://www.w3.org/2005/Atom">
69
+ <title>${xmlEscape(input.title)}</title>
70
+ <id>${xmlEscape(input.homeUrl)}</id>
71
+ <updated>${xmlEscape(latestDate(input.pages))}</updated>
72
+ ${entries}
73
+ </feed>
74
+ `;
75
+ }
76
+ function serializeJsonFeed(input) {
77
+ return `${JSON.stringify(
78
+ {
79
+ version: "https://jsonfeed.org/version/1.1",
80
+ title: input.title,
81
+ description: input.description,
82
+ home_page_url: input.homeUrl,
83
+ items: input.pages.map((page) => ({
84
+ id: page.url,
85
+ url: page.url,
86
+ title: page.title,
87
+ summary: page.description,
88
+ content_text: page.body,
89
+ date_published: page.publishedAt,
90
+ date_modified: page.updatedAt,
91
+ tags: page.tags
92
+ }))
93
+ },
94
+ null,
95
+ 2
96
+ )}
97
+ `;
98
+ }
99
+
16
100
  // src/lib/runtime/response/cached-text-response.ts
17
101
  var CACHE_CONTROL = "public, max-age=300, s-maxage=3600, stale-while-revalidate=3600, must-revalidate", CDN_CACHE_CONTROL = "public, max-age=3600, stale-while-revalidate=3600, must-revalidate", SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate", SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
18
102
  function cacheControl(policy) {
@@ -34,11 +118,8 @@ function createCachedTextResponse(options) {
34
118
  }
35
119
 
36
120
  // src/route-metadata-feed.ts
37
- function xmlEscape(value) {
38
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
39
- }
40
121
  function pageTimestamp(page) {
41
- let value = pageDate(page);
122
+ let value = validDate(page.publishedAt) ?? validDate(page.updatedAt);
42
123
  return value ? Date.parse(value) : -1 / 0;
43
124
  }
44
125
  function validDate(value) {
@@ -51,102 +132,47 @@ function feedPages(manifest, options) {
51
132
  let statuses = options.status ?? ["published"], pages = manifest.pages.filter((page) => statuses.includes(page.status)).filter((page) => pageInScope(page, options)).sort((a, b) => pageTimestamp(b) - pageTimestamp(a));
52
133
  return options.limit ? pages.slice(0, options.limit) : pages;
53
134
  }
135
+ function feedInput(manifest, options = {}) {
136
+ let serializedPages = feedPages(manifest, options).map((page) => ({
137
+ url: canonicalUrl(manifest, page.path, page.group),
138
+ title: page.title,
139
+ publishedAt: validDate(page.publishedAt),
140
+ updatedAt: validDate(page.updatedAt),
141
+ description: page.description,
142
+ body: page.body,
143
+ tags: page.tags
144
+ })), group = options.group, homePath = group ? manifest.groups[group]?.path ?? "/" : "/";
145
+ return {
146
+ // Public route factories use the site name; generated group feeds use the group title.
147
+ title: manifest.site.name,
148
+ description: manifest.site.description,
149
+ homeUrl: canonicalUrl(manifest, homePath, group),
150
+ pages: serializedPages
151
+ };
152
+ }
54
153
  async function rssXml(manifest, options = {}) {
55
154
  "use cache";
56
- cacheLife("page"), cacheTag(
155
+ return cacheLife("page"), cacheTag(
57
156
  tags.site(),
58
157
  tags.feed("rss", options.group ?? options.scope ?? "site"),
59
158
  tags.manifest(manifest.contentHash)
60
- );
61
- let title = manifest.site.name, description = manifest.site.description ?? title, pages = feedPages(manifest, options), group = options.group, homePath = group ? manifest.groups[group]?.path ?? "/" : "/", homeUrl = canonicalUrl(manifest, homePath, group), items = pages.map((page) => {
62
- let pageUrl = canonicalUrl(manifest, page.path, page.group), publishedAt = validDate(page.publishedAt), pubDate = publishedAt ? `
63
- <pubDate>${xmlEscape(new Date(publishedAt).toUTCString())}</pubDate>` : "", description2 = page.description ? `
64
- <description>${xmlEscape(page.description)}</description>` : "";
65
- return ` <item>
66
- <title>${xmlEscape(page.title)}</title>
67
- <link>${xmlEscape(pageUrl)}</link>
68
- <guid>${xmlEscape(pageUrl)}</guid>${pubDate}${description2}
69
- </item>`;
70
- }).join(`
71
- `);
72
- return `<?xml version="1.0" encoding="UTF-8"?>
73
- <rss version="2.0">
74
- <channel>
75
- <title>${xmlEscape(title)}</title>
76
- <link>${xmlEscape(homeUrl)}</link>
77
- <description>${xmlEscape(description)}</description>
78
- ${items}
79
- </channel>
80
- </rss>
81
- `;
82
- }
83
- function pageDate(page) {
84
- return validDate(page.publishedAt) ?? validDate(page.updatedAt);
85
- }
86
- function latestFeedDate(pages) {
87
- let timestamp = Math.max(0, ...pages.map((page) => pageTimestamp(page)));
88
- return new Date(timestamp).toISOString();
159
+ ), serializeRssFeed(feedInput(manifest, options));
89
160
  }
90
161
  async function atomXml(manifest, options = {}) {
91
162
  "use cache";
92
- cacheLife("page"), cacheTag(
163
+ return cacheLife("page"), cacheTag(
93
164
  tags.site(),
94
165
  tags.feed("atom", options.group ?? options.scope ?? "site"),
95
166
  tags.manifest(manifest.contentHash)
96
- );
97
- let title = manifest.site.name, pages = feedPages(manifest, options), group = options.group, homePath = group ? manifest.groups[group]?.path ?? "/" : "/", homeUrl = canonicalUrl(manifest, homePath, group), entries = pages.map((page) => {
98
- let date = pageDate(page), updated = date ? new Date(date).toISOString() : latestFeedDate([]), pageUrl = canonicalUrl(manifest, page.path, page.group), summary = page.description ? `
99
- <summary>${xmlEscape(page.description)}</summary>` : "";
100
- return ` <entry>
101
- <title>${xmlEscape(page.title)}</title>
102
- <id>${xmlEscape(pageUrl)}</id>
103
- <link href="${xmlEscape(pageUrl)}" />
104
- <updated>${xmlEscape(updated)}</updated>${summary}
105
- </entry>`;
106
- }).join(`
107
- `);
108
- return `<?xml version="1.0" encoding="UTF-8"?>
109
- <feed xmlns="http://www.w3.org/2005/Atom">
110
- <title>${xmlEscape(title)}</title>
111
- <id>${xmlEscape(homeUrl)}</id>
112
- <updated>${xmlEscape(latestFeedDate(pages))}</updated>
113
- ${entries}
114
- </feed>
115
- `;
167
+ ), serializeAtomFeed(feedInput(manifest, options));
116
168
  }
117
169
  async function jsonFeed(manifest, options = {}) {
118
170
  "use cache";
119
- cacheLife("page"), cacheTag(
171
+ return cacheLife("page"), cacheTag(
120
172
  tags.site(),
121
173
  tags.feed("json", options.group ?? options.scope ?? "site"),
122
174
  tags.manifest(manifest.contentHash)
123
- );
124
- let pages = feedPages(manifest, options);
125
- return `${JSON.stringify(
126
- {
127
- version: "https://jsonfeed.org/version/1.1",
128
- title: manifest.site.name,
129
- description: manifest.site.description,
130
- home_page_url: canonicalUrl(
131
- manifest,
132
- options.group ? manifest.groups[options.group]?.path ?? "/" : "/",
133
- options.group
134
- ),
135
- items: pages.map((page) => ({
136
- id: canonicalUrl(manifest, page.path, page.group),
137
- url: canonicalUrl(manifest, page.path, page.group),
138
- title: page.title,
139
- summary: page.description,
140
- content_text: page.body,
141
- date_published: validDate(page.publishedAt),
142
- date_modified: validDate(page.updatedAt),
143
- tags: page.tags
144
- }))
145
- },
146
- null,
147
- 2
148
- )}
149
- `;
175
+ ), serializeJsonFeed(feedInput(manifest, options));
150
176
  }
151
177
  function createRssFeedRoute(manifest, options = {}) {
152
178
  return async function() {
@@ -1,5 +1,6 @@
1
- import { MarkdownRouteArtifacts } from '../agent/markdown.js';
2
- import { M as ManifestLike } from '../../../types-BzkZty3r.js';
1
+ import { MarkdownRouteArtifacts, MarkdownRouteArtifactManifest } from '../agent/markdown.js';
2
+ import { M as ManifestLike } from '../../../types-J2w_puPF.js';
3
+ import '../not-found.js';
3
4
 
4
5
  type LlmsRouteOptions = {
5
6
  scope?: "site" | "group" | "self";
@@ -11,14 +12,21 @@ type LlmsRouteOptions = {
11
12
  path: string;
12
13
  group?: string;
13
14
  }>;
15
+ otherGroupLinks?: Array<{
16
+ title: string;
17
+ path: string;
18
+ group?: string;
19
+ }>;
14
20
  };
15
21
  type LlmsFullRouteOptions = {
16
22
  maxBytes?: number;
23
+ indexPath?: string | false;
24
+ sitemapPath?: string | false;
17
25
  };
18
26
  type PrecomputedLlmsTxtOutput = {
19
27
  body: string;
20
28
  };
21
- declare function createLlmsTxtRoute(manifest: ManifestLike, options?: LlmsRouteOptions): () => Promise<Response>;
29
+ declare function createLlmsTxtRoute(manifest: ManifestLike, options?: LlmsRouteOptions, artifactManifest?: MarkdownRouteArtifactManifest): () => Promise<Response>;
22
30
  declare function createPrecomputedLlmsTxtRoute(output: PrecomputedLlmsTxtOutput): () => Response;
23
31
  declare function llmsFullTxtResponse(manifest: ManifestLike, artifacts: MarkdownRouteArtifacts, options?: LlmsFullRouteOptions): Promise<Response>;
24
32
  declare function createLlmsFullTxtRoute(manifest: ManifestLike, artifacts: MarkdownRouteArtifacts, options?: LlmsFullRouteOptions): () => Promise<Response>;
@@ -13,6 +13,122 @@ function canonicalUrl(manifest, path, group) {
13
13
  }
14
14
  }
15
15
 
16
+ // src/lib/runtime/metadata/discovery-content.ts
17
+ function discoveryOrigin(manifest, group) {
18
+ return (group ? manifest.groups[group]?.origin : void 0) ?? manifest.site.origin;
19
+ }
20
+ function pathWithin(path, basePath) {
21
+ return basePath === "/" || path === basePath || path.startsWith(`${basePath}/`);
22
+ }
23
+ function discoveryPages({
24
+ manifest,
25
+ group,
26
+ scope,
27
+ limit
28
+ }) {
29
+ let origin = discoveryOrigin(manifest, group), basePath = group ? manifest.groups[group]?.path ?? "/" : "/", pages = manifest.pages.filter((page) => page.status !== "published" || discoveryOrigin(manifest, page.group) !== origin ? !1 : !group || scope === "site" ? !0 : pathWithin(page.path, basePath) ? page.group === group || scope !== "self" && page.group.startsWith(`${group}/`) : !1);
30
+ return limit ? pages.slice(0, limit) : pages;
31
+ }
32
+ function groupDiscoveryPages({
33
+ manifest,
34
+ pages
35
+ }) {
36
+ let sections = /* @__PURE__ */ new Map();
37
+ for (let page of pages) {
38
+ let group = manifest.groups[page.group], key = group ? page.group : "", section = sections.get(key);
39
+ section || (section = {
40
+ ...group ? { group: page.group } : {},
41
+ title: group ? group.key === "__root" ? manifest.site.name : group.title : "Pages",
42
+ pages: []
43
+ }, sections.set(key, section)), section.pages.push(page);
44
+ }
45
+ return [...sections.values()].sort(
46
+ (a, b) => (manifest.groups[a.group ?? ""]?.path ?? "/").localeCompare(
47
+ manifest.groups[b.group ?? ""]?.path ?? "/"
48
+ ) || a.title.localeCompare(b.title)
49
+ );
50
+ }
51
+
52
+ // src/lib/runtime/metadata/llms-serialization.ts
53
+ function inlineText(value) {
54
+ return value.replace(/[\r\n]+/g, " ").replace(/([\\`*_[\]<>])/g, "\\$1");
55
+ }
56
+ function markdownLink(link) {
57
+ let url = link.url.replace(
58
+ /[\s()<>]/g,
59
+ (value) => value === "(" ? "%28" : value === ")" ? "%29" : encodeURIComponent(value)
60
+ );
61
+ return `[${inlineText(link.title)}](${url})`;
62
+ }
63
+ function serializeLlmsIndex(input) {
64
+ let body = (input.sections ?? [
65
+ { title: "Pages", pages: input.pages ?? [] }
66
+ ]).map((section) => {
67
+ let lines = [
68
+ ...(section.links ?? []).map((link) => `- ${markdownLink(link)}`),
69
+ ...section.pages.map((page) => {
70
+ let description = input.includeDescriptions && page.description ? `: ${inlineText(page.description)}` : "", alternate = page.alternate ? ` (${markdownLink(page.alternate)})` : "";
71
+ return `- ${markdownLink(page)}${alternate}${description}`;
72
+ })
73
+ ];
74
+ return `## ${inlineText(section.title)}
75
+
76
+ ${lines.join(`
77
+ `)}`;
78
+ }).join(`
79
+
80
+ `), linkLines = (input.links ?? []).map(
81
+ (link) => `- ${markdownLink(link)}`
82
+ ), linkSection = linkLines.length ? `
83
+
84
+ ## Group LLM indexes
85
+
86
+ ${linkLines.join(`
87
+ `)}` : "", otherGroupLines = (input.otherGroupLinks ?? []).map(
88
+ (link) => `- ${markdownLink(link)}`
89
+ ), otherGroupSection = otherGroupLines.length ? `
90
+
91
+ ## Other content groups
92
+
93
+ ${otherGroupLines.join(`
94
+ `)}` : "";
95
+ return `# ${inlineText(input.title)}
96
+
97
+ > ${inlineText(input.summary)}
98
+
99
+ ${body}${linkSection}${otherGroupSection}
100
+ `;
101
+ }
102
+ function serializeLlmsFull(input) {
103
+ let encoder = new TextEncoder(), byteLength = (value) => encoder.encode(value).byteLength, references = [
104
+ input.indexUrl ? `> LLMS index: ${input.indexUrl}` : void 0,
105
+ input.sitemapUrl ? `> Sitemap: ${input.sitemapUrl}` : void 0
106
+ ].filter(Boolean).join(`
107
+ `), header = `# ${input.title} Full Content
108
+
109
+ ${references ? `${references}
110
+
111
+ ` : ""}`, sections = [], totalBytes = byteLength(header), included = 0, truncated = !1;
112
+ for (let artifact of [...input.artifacts].sort(
113
+ (a, b) => a.markdownPath.localeCompare(b.markdownPath)
114
+ )) {
115
+ let section = `---
116
+
117
+ ${artifact.body.trim()}
118
+
119
+ `, sectionBytes = byteLength(section);
120
+ if (totalBytes + sectionBytes > input.maxBytes) {
121
+ truncated = !0;
122
+ break;
123
+ }
124
+ sections.push(section), totalBytes += sectionBytes, included += 1;
125
+ }
126
+ let footer = truncated ? `
127
+ > Truncated at ${included} of ${input.totalCount ?? input.artifacts.length} Markdown pages to stay under ${input.maxBytes} bytes.
128
+ ` : "";
129
+ return `${header}${sections.join("")}${footer}`;
130
+ }
131
+
16
132
  // src/lib/runtime/response/cached-text-response.ts
17
133
  var CACHE_CONTROL = "public, max-age=300, s-maxage=3600, stale-while-revalidate=3600, must-revalidate", CDN_CACHE_CONTROL = "public, max-age=3600, stale-while-revalidate=3600, must-revalidate", SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate", SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
18
134
  function cacheControl(policy) {
@@ -34,48 +150,45 @@ function createCachedTextResponse(options) {
34
150
  }
35
151
 
36
152
  // src/route-metadata-llms.ts
37
- var DEFAULT_LLMS_FULL_MAX_BYTES = 1e6, TEXT_ENCODER = new TextEncoder();
38
- function byteLength(value) {
39
- return TEXT_ENCODER.encode(value).byteLength;
40
- }
41
- function pageInScope(page, options) {
42
- return options.scope === "site" || !options.group ? !0 : options.scope === "self" ? page.group === options.group : page.group === options.group || page.group.startsWith(`${options.group}/`);
43
- }
44
- function llmsSummary(manifest) {
45
- return manifest.site.description ? `> ${manifest.site.description}` : `> Agent-readable index for ${manifest.site.name}.`;
46
- }
47
- async function llmsTxt(manifest, options = {}) {
153
+ var DEFAULT_LLMS_FULL_MAX_BYTES = 1e6;
154
+ async function llmsTxt(manifest, options = {}, artifactManifest) {
48
155
  "use cache";
49
156
  cacheLife("page"), cacheTag(
50
157
  tags.site(),
51
158
  tags.llms(options.group ?? options.scope ?? "root"),
52
159
  tags.manifest(manifest.contentHash)
53
160
  );
54
- let pages = manifest.pages.filter((page) => page.status === "published").filter((page) => pageInScope(page, options)), lines = (options.limit ? pages.slice(0, options.limit) : pages).map((page) => {
55
- let description = options.includeDescriptions && page.description ? ` - ${page.description}` : "";
56
- return `- [${page.title}](${canonicalUrl(manifest, page.path, page.group)})${description}`;
57
- }), linkLines = (options.links ?? []).map(
58
- (link) => `- [${link.title}](${canonicalUrl(manifest, link.path, link.group)})`
59
- ), linkSection = linkLines.length ? `
60
-
61
- ## Group LLM indexes
62
-
63
- ${linkLines.join(`
64
- `)}` : "";
65
- return `# ${manifest.site.name}
66
-
67
- ${llmsSummary(manifest)}
68
-
69
- ## Pages
70
-
71
- ${lines.join(`
72
- `)}${linkSection}
73
- `;
161
+ let pages = discoveryPages({ manifest, ...options }), group = options.group ? manifest.groups[options.group] : void 0;
162
+ return serializeLlmsIndex({
163
+ title: group?.title ?? manifest.site.name,
164
+ summary: manifest.site.description ? manifest.site.description : `Agent-readable index for ${manifest.site.name}.`,
165
+ sections: groupDiscoveryPages({ manifest, pages }).map((section) => ({
166
+ title: section.title,
167
+ pages: section.pages.map((page) => ({
168
+ title: page.title,
169
+ url: canonicalUrl(
170
+ manifest,
171
+ artifactManifest?.byHtmlPath[page.path] ?? page.path,
172
+ page.group
173
+ ),
174
+ description: page.description
175
+ }))
176
+ })),
177
+ includeDescriptions: options.includeDescriptions,
178
+ links: options.links?.map((link) => ({
179
+ title: link.title,
180
+ url: canonicalUrl(manifest, link.path, link.group)
181
+ })),
182
+ otherGroupLinks: options.otherGroupLinks?.map((link) => ({
183
+ title: link.title,
184
+ url: canonicalUrl(manifest, link.path, link.group)
185
+ }))
186
+ });
74
187
  }
75
- function createLlmsTxtRoute(manifest, options = {}) {
188
+ function createLlmsTxtRoute(manifest, options = {}, artifactManifest) {
76
189
  return async function() {
77
190
  return createCachedTextResponse({
78
- body: await llmsTxt(manifest, options),
191
+ body: await llmsTxt(manifest, options, artifactManifest),
79
192
  contentType: "text/plain; charset=utf-8"
80
193
  });
81
194
  };
@@ -89,30 +202,14 @@ function createPrecomputedLlmsTxtRoute(output) {
89
202
  };
90
203
  }
91
204
  async function llmsFullTxt(manifest, artifacts, options = {}) {
92
- let maxBytes = options.maxBytes ?? DEFAULT_LLMS_FULL_MAX_BYTES, header = `# ${manifest.site.name} Full Content
93
-
94
- > LLMS index: ${canonicalUrl(manifest, "/llms.txt")}
95
- > Sitemap: ${canonicalUrl(manifest, "/sitemap.md")}
96
-
97
- `, sections = [], totalBytes = byteLength(header), included = 0, truncated = !1;
98
- for (let artifact of Object.values(artifacts).sort(
99
- (a, b) => a.markdownPath.localeCompare(b.markdownPath)
100
- )) {
101
- let section = `---
102
-
103
- ${artifact.body.trim()}
104
-
105
- `, sectionBytes = byteLength(section);
106
- if (totalBytes + sectionBytes > maxBytes) {
107
- truncated = !0;
108
- break;
109
- }
110
- sections.push(section), totalBytes += sectionBytes, included += 1;
111
- }
112
- let footer = truncated ? `
113
- > Truncated at ${included} of ${Object.keys(artifacts).length} Markdown pages to stay under ${maxBytes} bytes.
114
- ` : "";
115
- return `${header}${sections.join("")}${footer}`;
205
+ return serializeLlmsFull({
206
+ title: manifest.site.name,
207
+ indexUrl: options.indexPath === !1 ? void 0 : canonicalUrl(manifest, options.indexPath ?? "/llms.txt"),
208
+ sitemapUrl: options.sitemapPath === !1 ? void 0 : canonicalUrl(manifest, options.sitemapPath ?? "/sitemap.md"),
209
+ // Route factories serialize their supplied artifacts; generated output filters by origin.
210
+ artifacts: Object.values(artifacts),
211
+ maxBytes: options.maxBytes ?? DEFAULT_LLMS_FULL_MAX_BYTES
212
+ });
116
213
  }
117
214
  async function llmsFullTxtResponse(manifest, artifacts, options = {}) {
118
215
  return createCachedTextResponse({
@@ -116,7 +116,7 @@ function getOgImageText(entry) {
116
116
  }
117
117
 
118
118
  // src/route-metadata-og-image.tsx
119
- import { jsx, jsxs } from "react/jsx-runtime";
119
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
120
120
  var ERROR_HEADERS = {
121
121
  "cache-control": "public, max-age=60, must-revalidate",
122
122
  "cdn-cache-control": "public, max-age=300",
@@ -1,4 +1,4 @@
1
- import { M as ManifestLike } from '../../../types-BzkZty3r.js';
1
+ import { M as ManifestLike } from '../../../types-J2w_puPF.js';
2
2
 
3
3
  declare function createRobotsTxtRoute(manifest: ManifestLike): () => Promise<Response>;
4
4
 
@@ -1,10 +1,29 @@
1
1
  import { MarkdownRouteArtifactManifest } from '../agent/markdown.js';
2
- import { M as ManifestLike } from '../../../types-BzkZty3r.js';
2
+ import { M as ManifestLike } from '../../../types-J2w_puPF.js';
3
+ import '../not-found.js';
3
4
 
5
+ type SitemapReference = {
6
+ path: string;
7
+ group?: string;
8
+ };
4
9
  type SitemapRouteOptions = {
5
10
  group?: string;
11
+ path?: string;
12
+ sitemaps?: SitemapReference[];
13
+ exclude?: SitemapReference[];
14
+ };
15
+ type SitemapMarkdownRouteOptions = {
16
+ group?: string;
17
+ scope?: "site" | "group" | "self";
18
+ links?: Array<SitemapReference & {
19
+ title: string;
20
+ }>;
21
+ otherGroupLinks?: Array<SitemapReference & {
22
+ title: string;
23
+ }>;
24
+ markdownAlternates?: boolean;
6
25
  };
7
26
  declare function createSitemapXmlRoute(manifest: ManifestLike, options?: SitemapRouteOptions): () => Promise<Response>;
8
- declare function createSitemapMarkdownRoute(manifest: ManifestLike, artifactManifest: MarkdownRouteArtifactManifest): () => Promise<Response>;
27
+ declare function createSitemapMarkdownRoute(manifest: ManifestLike, artifactManifest: MarkdownRouteArtifactManifest, options?: SitemapMarkdownRouteOptions): () => Promise<Response>;
9
28
 
10
- export { type SitemapRouteOptions, createSitemapMarkdownRoute, createSitemapXmlRoute };
29
+ export { type SitemapMarkdownRouteOptions, type SitemapRouteOptions, createSitemapMarkdownRoute, createSitemapXmlRoute };