@publish.os/nextjs 0.0.1-alpha.2 → 0.0.1-alpha.4
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/README.md +3 -9
- package/dist/cache/tags.cjs +3 -0
- package/dist/cache/tags.d.cts +1 -0
- package/dist/cache/tags.d.ts +1 -0
- package/dist/cache/tags.js +3 -0
- package/dist/config.cjs +78 -0
- package/dist/config.d.cts +101 -0
- package/dist/config.d.ts +101 -0
- package/dist/config.js +48 -0
- package/dist/index.cjs +1043 -124
- package/dist/index.d.cts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +1031 -111
- package/dist/kernel/components/blocks/AgentActions.cjs +425 -0
- package/dist/kernel/components/blocks/AgentActions.d.cts +52 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +52 -0
- package/dist/kernel/components/blocks/AgentActions.js +429 -0
- package/dist/kernel/components/blocks/animated-icon-swap.cjs +101 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.cts +16 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +16 -0
- package/dist/kernel/components/blocks/animated-icon-swap.js +74 -0
- package/dist/kernel/components/blocks/color-palette.cjs +413 -0
- package/dist/kernel/components/blocks/color-palette.d.cts +7 -0
- package/dist/kernel/components/blocks/color-palette.d.ts +7 -0
- package/dist/kernel/components/blocks/color-palette.js +407 -0
- package/dist/kernel/components/blocks/design-system-preview.cjs +592 -0
- package/dist/kernel/components/blocks/design-system-preview.d.cts +29 -0
- package/dist/kernel/components/blocks/design-system-preview.d.ts +29 -0
- package/dist/kernel/components/blocks/design-system-preview.js +655 -0
- package/dist/kernel/components/blocks/link-playground.cjs +816 -0
- package/dist/kernel/components/blocks/link-playground.d.cts +5 -0
- package/dist/kernel/components/blocks/link-playground.d.ts +5 -0
- package/dist/kernel/components/blocks/link-playground.js +792 -0
- package/dist/kernel/components/blocks/logo-block.cjs +156 -0
- package/dist/kernel/components/blocks/logo-block.d.cts +21 -0
- package/dist/kernel/components/blocks/logo-block.d.ts +21 -0
- package/dist/kernel/components/blocks/logo-block.js +129 -0
- package/dist/{components → kernel/components/blocks}/nav-breadcrumb.cjs +19 -38
- package/dist/kernel/components/blocks/nav-breadcrumb.d.cts +11 -0
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +11 -0
- package/dist/{components → kernel/components/blocks}/nav-breadcrumb.js +22 -30
- package/dist/kernel/components/blocks/navbar.cjs +154 -0
- package/dist/kernel/components/blocks/navbar.d.cts +16 -0
- package/dist/kernel/components/blocks/navbar.d.ts +16 -0
- package/dist/kernel/components/blocks/navbar.js +122 -0
- package/dist/kernel/components/blocks/navigation-progress-playground.cjs +735 -0
- package/dist/kernel/components/blocks/navigation-progress-playground.d.cts +5 -0
- package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +5 -0
- package/dist/kernel/components/blocks/navigation-progress-playground.js +722 -0
- package/dist/kernel/components/blocks/navigation-progress.cjs +270 -0
- package/dist/kernel/components/blocks/navigation-progress.d.cts +16 -0
- package/dist/kernel/components/blocks/navigation-progress.d.ts +16 -0
- package/dist/kernel/components/blocks/navigation-progress.js +249 -0
- package/dist/kernel/components/blocks/next-prev.cjs +142 -0
- package/dist/kernel/components/blocks/next-prev.d.cts +11 -0
- package/dist/kernel/components/blocks/next-prev.d.ts +11 -0
- package/dist/kernel/components/blocks/next-prev.js +105 -0
- package/dist/{components → kernel/components/blocks}/page-list.cjs +7 -16
- package/dist/{components → kernel/components/blocks}/page-list.d.cts +1 -1
- package/dist/{components → kernel/components/blocks}/page-list.d.ts +1 -1
- package/dist/{components → kernel/components/blocks}/page-list.js +6 -5
- package/dist/kernel/components/blocks/search.cjs +717 -0
- package/dist/kernel/components/blocks/search.d.cts +77 -0
- package/dist/kernel/components/blocks/search.d.ts +77 -0
- package/dist/kernel/components/blocks/search.js +697 -0
- package/dist/kernel/components/blocks/sidebar-node.cjs +309 -0
- package/dist/kernel/components/blocks/sidebar-node.d.cts +8 -0
- package/dist/kernel/components/blocks/sidebar-node.d.ts +8 -0
- package/dist/kernel/components/blocks/sidebar-node.js +272 -0
- package/dist/kernel/components/blocks/sidebar.cjs +317 -0
- package/dist/kernel/components/blocks/sidebar.d.cts +33 -0
- package/dist/kernel/components/blocks/sidebar.d.ts +33 -0
- package/dist/kernel/components/blocks/sidebar.js +302 -0
- package/dist/kernel/components/blocks/theme-toggle.cjs +31 -0
- package/dist/kernel/components/blocks/theme-toggle.d.cts +6 -0
- package/dist/kernel/components/blocks/theme-toggle.d.ts +6 -0
- package/dist/kernel/components/blocks/theme-toggle.js +7 -0
- package/dist/kernel/components/blocks/toc.cjs +356 -0
- package/dist/kernel/components/blocks/toc.d.cts +10 -0
- package/dist/kernel/components/blocks/toc.d.ts +10 -0
- package/dist/kernel/components/blocks/toc.js +330 -0
- package/dist/kernel/components/mdx/components/blockquote.cjs +66 -0
- package/dist/kernel/components/mdx/components/blockquote.d.cts +6 -0
- package/dist/kernel/components/mdx/components/blockquote.d.ts +6 -0
- package/dist/kernel/components/mdx/components/blockquote.js +39 -0
- package/dist/kernel/components/mdx/components/callout.cjs +137 -0
- package/dist/kernel/components/mdx/components/callout.d.cts +18 -0
- package/dist/kernel/components/mdx/components/callout.d.ts +18 -0
- package/dist/kernel/components/mdx/components/callout.js +109 -0
- package/dist/kernel/components/mdx/components/code-block.cjs +39 -0
- package/dist/kernel/components/mdx/components/code-block.d.cts +9 -0
- package/dist/kernel/components/mdx/components/code-block.d.ts +9 -0
- package/dist/kernel/components/mdx/components/code-block.js +14 -0
- package/dist/kernel/components/mdx/components/figure-caption.cjs +63 -0
- package/dist/kernel/components/mdx/components/figure-caption.d.cts +6 -0
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +6 -0
- package/dist/kernel/components/mdx/components/figure-caption.js +36 -0
- package/dist/kernel/components/mdx/components/figure.cjs +78 -0
- package/dist/kernel/components/mdx/components/figure.d.cts +10 -0
- package/dist/kernel/components/mdx/components/figure.d.ts +10 -0
- package/dist/kernel/components/mdx/components/figure.js +53 -0
- package/dist/kernel/components/mdx/components/footnotes.cjs +66 -0
- package/dist/kernel/components/mdx/components/footnotes.d.cts +6 -0
- package/dist/kernel/components/mdx/components/footnotes.d.ts +6 -0
- package/dist/kernel/components/mdx/components/footnotes.js +39 -0
- package/dist/kernel/components/mdx/components/heading-copy-link.cjs +108 -0
- package/dist/kernel/components/mdx/components/heading-copy-link.d.cts +23 -0
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +23 -0
- package/dist/kernel/components/mdx/components/heading-copy-link.js +81 -0
- package/dist/kernel/components/mdx/components/heading.cjs +166 -0
- package/dist/kernel/components/mdx/components/heading.d.cts +8 -0
- package/dist/kernel/components/mdx/components/heading.d.ts +8 -0
- package/dist/kernel/components/mdx/components/heading.js +144 -0
- package/dist/kernel/components/mdx/components/hr.cjs +34 -0
- package/dist/kernel/components/mdx/components/hr.d.cts +9 -0
- package/dist/kernel/components/mdx/components/hr.d.ts +9 -0
- package/dist/kernel/components/mdx/components/hr.js +9 -0
- package/dist/kernel/components/mdx/components/image-zoom.cjs +49 -0
- package/dist/kernel/components/mdx/components/image-zoom.d.cts +10 -0
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +10 -0
- package/dist/kernel/components/mdx/components/image-zoom.js +15 -0
- package/dist/kernel/components/mdx/components/image.cjs +192 -0
- package/dist/kernel/components/mdx/components/image.d.cts +21 -0
- package/dist/kernel/components/mdx/components/image.d.ts +21 -0
- package/dist/kernel/components/mdx/components/image.js +157 -0
- package/dist/kernel/components/mdx/components/inline-code.cjs +66 -0
- package/dist/kernel/components/mdx/components/inline-code.d.cts +6 -0
- package/dist/kernel/components/mdx/components/inline-code.d.ts +6 -0
- package/dist/kernel/components/mdx/components/inline-code.js +39 -0
- package/dist/kernel/components/mdx/components/kbd.cjs +34 -0
- package/dist/kernel/components/mdx/components/kbd.d.cts +10 -0
- package/dist/kernel/components/mdx/components/kbd.d.ts +10 -0
- package/dist/kernel/components/mdx/components/kbd.js +9 -0
- package/dist/{components/providers.cjs → kernel/components/mdx/components/link.cjs} +20 -15
- package/dist/kernel/components/mdx/components/link.d.cts +11 -0
- package/dist/kernel/components/mdx/components/link.d.ts +11 -0
- package/dist/kernel/components/mdx/components/link.js +26 -0
- package/dist/kernel/components/mdx/components/paragraph.cjs +87 -0
- package/dist/kernel/components/mdx/components/paragraph.d.cts +5 -0
- package/dist/kernel/components/mdx/components/paragraph.d.ts +5 -0
- package/dist/kernel/components/mdx/components/paragraph.js +60 -0
- package/dist/kernel/components/mdx/components/pre.cjs +66 -0
- package/dist/kernel/components/mdx/components/pre.d.cts +6 -0
- package/dist/kernel/components/mdx/components/pre.d.ts +6 -0
- package/dist/kernel/components/mdx/components/pre.js +39 -0
- package/dist/kernel/components/mdx/components/strikethrough.cjs +63 -0
- package/dist/kernel/components/mdx/components/strikethrough.d.cts +6 -0
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +6 -0
- package/dist/kernel/components/mdx/components/strikethrough.js +36 -0
- package/dist/kernel/components/mdx/components/table.cjs +59 -0
- package/dist/kernel/components/mdx/components/table.d.cts +10 -0
- package/dist/kernel/components/mdx/components/table.d.ts +10 -0
- package/dist/kernel/components/mdx/components/table.js +36 -0
- package/dist/kernel/components/mdx/components/task-list.cjs +88 -0
- package/dist/kernel/components/mdx/components/task-list.d.cts +8 -0
- package/dist/kernel/components/mdx/components/task-list.d.ts +8 -0
- package/dist/kernel/components/mdx/components/task-list.js +60 -0
- package/dist/kernel/components/mdx/components/video-player.cjs +173 -0
- package/dist/kernel/components/mdx/components/video-player.d.cts +18 -0
- package/dist/kernel/components/mdx/components/video-player.d.ts +18 -0
- package/dist/kernel/components/mdx/components/video-player.js +147 -0
- package/dist/kernel/components/mdx/components/video.cjs +185 -0
- package/dist/kernel/components/mdx/components/video.d.cts +15 -0
- package/dist/kernel/components/mdx/components/video.d.ts +15 -0
- package/dist/kernel/components/mdx/components/video.js +162 -0
- package/dist/kernel/components/mdx/error-boundary.cjs +62 -0
- package/dist/{mdx → kernel/components/mdx}/error-boundary.d.cts +3 -8
- package/dist/{mdx → kernel/components/mdx}/error-boundary.d.ts +3 -8
- package/dist/kernel/components/mdx/error-boundary.js +38 -0
- package/dist/{mdx → kernel/components/mdx}/error-fallback.cjs +8 -8
- package/dist/{mdx → kernel/components/mdx}/error-fallback.js +8 -8
- package/dist/kernel/components/mdx/mdx.cjs +141 -0
- package/dist/kernel/components/mdx/mdx.d.cts +22 -0
- package/dist/kernel/components/mdx/mdx.d.ts +22 -0
- package/dist/kernel/components/mdx/mdx.js +109 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.cjs +113 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.d.cts +10 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +10 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +86 -0
- package/dist/kernel/components/mdx/types.cjs +18 -0
- package/dist/kernel/components/mdx/types.d.cts +18 -0
- package/dist/kernel/components/mdx/types.d.ts +18 -0
- package/dist/kernel/components/mdx/types.js +0 -0
- package/dist/kernel/components/ui/accordion.cjs +104 -0
- package/dist/kernel/components/ui/accordion.d.cts +16 -0
- package/dist/kernel/components/ui/accordion.d.ts +16 -0
- package/dist/kernel/components/ui/accordion.js +76 -0
- package/dist/kernel/components/ui/badge.cjs +75 -0
- package/dist/kernel/components/ui/badge.d.cts +12 -0
- package/dist/kernel/components/ui/badge.d.ts +12 -0
- package/dist/kernel/components/ui/badge.js +47 -0
- package/dist/kernel/components/ui/breadcrumb-trail.cjs +238 -0
- package/dist/kernel/components/ui/breadcrumb-trail.d.cts +13 -0
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +13 -0
- package/dist/kernel/components/ui/breadcrumb-trail.js +225 -0
- package/dist/kernel/components/ui/breadcrumb.cjs +399 -0
- package/dist/kernel/components/ui/breadcrumb.d.cts +52 -0
- package/dist/kernel/components/ui/breadcrumb.d.ts +52 -0
- package/dist/kernel/components/ui/breadcrumb.js +365 -0
- package/dist/kernel/components/ui/button-group.cjs +144 -0
- package/dist/kernel/components/ui/button-group.d.cts +19 -0
- package/dist/kernel/components/ui/button-group.d.ts +19 -0
- package/dist/kernel/components/ui/button-group.js +116 -0
- package/dist/kernel/components/ui/button.cjs +147 -0
- package/dist/kernel/components/ui/button.d.cts +23 -0
- package/dist/kernel/components/ui/button.d.ts +23 -0
- package/dist/kernel/components/ui/button.js +121 -0
- package/dist/kernel/components/ui/card.cjs +133 -0
- package/dist/kernel/components/ui/card.d.cts +17 -0
- package/dist/kernel/components/ui/card.d.ts +17 -0
- package/dist/kernel/components/ui/card.js +101 -0
- package/dist/kernel/components/ui/dialog.cjs +149 -0
- package/dist/kernel/components/ui/dialog.d.cts +22 -0
- package/dist/kernel/components/ui/dialog.d.ts +22 -0
- package/dist/kernel/components/ui/dialog.js +118 -0
- package/dist/kernel/components/ui/drawer.cjs +163 -0
- package/dist/kernel/components/ui/drawer.d.cts +24 -0
- package/dist/kernel/components/ui/drawer.d.ts +24 -0
- package/dist/kernel/components/ui/drawer.js +131 -0
- package/dist/kernel/components/ui/input.cjs +96 -0
- package/dist/kernel/components/ui/input.d.cts +18 -0
- package/dist/kernel/components/ui/input.d.ts +18 -0
- package/dist/kernel/components/ui/input.js +70 -0
- package/dist/kernel/components/ui/kbd.cjs +105 -0
- package/dist/kernel/components/ui/kbd.d.cts +13 -0
- package/dist/kernel/components/ui/kbd.d.ts +13 -0
- package/dist/kernel/components/ui/kbd.js +77 -0
- package/dist/kernel/components/ui/link.cjs +253 -0
- package/dist/kernel/components/ui/link.d.cts +31 -0
- package/dist/kernel/components/ui/link.d.ts +31 -0
- package/dist/kernel/components/ui/link.js +217 -0
- package/dist/kernel/components/ui/menu.cjs +301 -0
- package/dist/kernel/components/ui/menu.d.cts +70 -0
- package/dist/kernel/components/ui/menu.d.ts +70 -0
- package/dist/kernel/components/ui/menu.js +256 -0
- package/dist/kernel/components/ui/meta-key.cjs +34 -0
- package/dist/kernel/components/ui/meta-key.d.cts +12 -0
- package/dist/kernel/components/ui/meta-key.d.ts +12 -0
- package/dist/kernel/components/ui/meta-key.js +9 -0
- package/dist/kernel/components/ui/navigation-menu.cjs +253 -0
- package/dist/kernel/components/ui/navigation-menu.d.cts +47 -0
- package/dist/kernel/components/ui/navigation-menu.d.ts +47 -0
- package/dist/kernel/components/ui/navigation-menu.js +216 -0
- package/dist/kernel/components/ui/popover.cjs +168 -0
- package/dist/kernel/components/ui/popover.d.cts +24 -0
- package/dist/kernel/components/ui/popover.d.ts +24 -0
- package/dist/kernel/components/ui/popover.js +136 -0
- package/dist/kernel/components/ui/progress.cjs +112 -0
- package/dist/kernel/components/ui/progress.d.cts +16 -0
- package/dist/kernel/components/ui/progress.d.ts +16 -0
- package/dist/kernel/components/ui/progress.js +84 -0
- package/dist/kernel/components/ui/scroll-area.cjs +413 -0
- package/dist/kernel/components/ui/scroll-area.d.cts +58 -0
- package/dist/kernel/components/ui/scroll-area.d.ts +58 -0
- package/dist/kernel/components/ui/scroll-area.js +390 -0
- package/dist/kernel/components/ui/select.cjs +244 -0
- package/dist/kernel/components/ui/select.d.cts +40 -0
- package/dist/kernel/components/ui/select.d.ts +40 -0
- package/dist/kernel/components/ui/select.js +205 -0
- package/dist/kernel/components/ui/separator.cjs +73 -0
- package/dist/kernel/components/ui/separator.d.cts +8 -0
- package/dist/kernel/components/ui/separator.d.ts +8 -0
- package/dist/kernel/components/ui/separator.js +48 -0
- package/dist/kernel/components/ui/table.cjs +131 -0
- package/dist/kernel/components/ui/table.d.cts +11 -0
- package/dist/kernel/components/ui/table.d.ts +11 -0
- package/dist/kernel/components/ui/table.js +99 -0
- package/dist/kernel/components/ui/tabs.cjs +450 -0
- package/dist/kernel/components/ui/tabs.d.cts +82 -0
- package/dist/kernel/components/ui/tabs.d.ts +82 -0
- package/dist/kernel/components/ui/tabs.js +409 -0
- package/dist/kernel/components/ui/text.cjs +184 -0
- package/dist/kernel/components/ui/text.d.cts +17 -0
- package/dist/kernel/components/ui/text.d.ts +17 -0
- package/dist/kernel/components/ui/text.js +156 -0
- package/dist/kernel/components/ui/theme-toggle.cjs +108 -0
- package/dist/kernel/components/ui/theme-toggle.d.cts +10 -0
- package/dist/kernel/components/ui/theme-toggle.d.ts +10 -0
- package/dist/kernel/components/ui/theme-toggle.js +84 -0
- package/dist/kernel/components/ui/toast.cjs +154 -0
- package/dist/kernel/components/ui/toast.d.cts +26 -0
- package/dist/kernel/components/ui/toast.d.ts +26 -0
- package/dist/kernel/components/ui/toast.js +120 -0
- package/dist/kernel/components/ui/tooltip.cjs +127 -0
- package/dist/kernel/components/ui/tooltip.d.cts +20 -0
- package/dist/kernel/components/ui/tooltip.d.ts +20 -0
- package/dist/kernel/components/ui/tooltip.js +97 -0
- package/dist/kernel/defaults.registry.cjs +541 -0
- package/dist/kernel/defaults.registry.d.cts +469 -0
- package/dist/kernel/defaults.registry.d.ts +469 -0
- package/dist/kernel/defaults.registry.js +516 -0
- package/dist/kernel/routes/agent/markdown.cjs +202 -0
- package/dist/kernel/routes/agent/markdown.d.cts +58 -0
- package/dist/kernel/routes/agent/markdown.d.ts +58 -0
- package/dist/kernel/routes/agent/markdown.js +174 -0
- package/dist/{layouts → kernel/routes/layouts}/group.cjs +39 -15
- package/dist/kernel/routes/layouts/group.d.cts +20 -0
- package/dist/kernel/routes/layouts/group.d.ts +20 -0
- package/dist/{layouts → kernel/routes/layouts}/group.js +39 -15
- package/dist/kernel/routes/metadata/feed.cjs +293 -0
- package/dist/kernel/routes/metadata/feed.d.cts +20 -0
- package/dist/kernel/routes/metadata/feed.d.ts +20 -0
- package/dist/kernel/routes/metadata/feed.js +265 -0
- package/dist/kernel/routes/metadata/llms.cjs +239 -0
- package/dist/kernel/routes/metadata/llms.d.cts +26 -0
- package/dist/kernel/routes/metadata/llms.d.ts +26 -0
- package/dist/kernel/routes/metadata/llms.js +211 -0
- package/dist/kernel/routes/metadata/og-image.cjs +630 -0
- package/dist/kernel/routes/metadata/og-image.d.cts +62 -0
- package/dist/kernel/routes/metadata/og-image.d.ts +62 -0
- package/dist/kernel/routes/metadata/og-image.js +604 -0
- package/dist/{routes → kernel/routes/metadata}/robots.cjs +59 -5
- package/dist/{routes → kernel/routes/metadata}/robots.d.cts +2 -1
- package/dist/{routes → kernel/routes/metadata}/robots.d.ts +2 -1
- package/dist/kernel/routes/metadata/robots.js +123 -0
- package/dist/kernel/routes/metadata/sitemap.cjs +192 -0
- package/dist/kernel/routes/metadata/sitemap.d.cts +8 -0
- package/dist/kernel/routes/metadata/sitemap.d.ts +8 -0
- package/dist/kernel/routes/metadata/sitemap.js +166 -0
- package/dist/{pages → kernel/routes/pages}/group.cjs +107 -6
- package/dist/{pages → kernel/routes/pages}/group.d.cts +4 -2
- package/dist/{pages → kernel/routes/pages}/group.d.ts +4 -2
- package/dist/{pages → kernel/routes/pages}/group.js +107 -6
- package/dist/kernel/routes/pages/leaf.cjs +421 -0
- package/dist/kernel/routes/pages/leaf.d.cts +36 -0
- package/dist/kernel/routes/pages/leaf.d.ts +36 -0
- package/dist/kernel/routes/pages/leaf.js +397 -0
- package/dist/{pages → kernel/routes/pages}/root.cjs +108 -6
- package/dist/{pages → kernel/routes/pages}/root.d.cts +4 -2
- package/dist/{pages → kernel/routes/pages}/root.d.ts +4 -2
- package/dist/kernel/routes/pages/root.js +203 -0
- package/dist/keyboard-shortcuts.cjs +345 -0
- package/dist/keyboard-shortcuts.d.cts +34 -0
- package/dist/keyboard-shortcuts.d.ts +34 -0
- package/dist/keyboard-shortcuts.js +326 -0
- package/dist/resolvers/manifest-resolver.cjs +7 -3
- package/dist/resolvers/manifest-resolver.d.cts +2 -2
- package/dist/resolvers/manifest-resolver.d.ts +2 -2
- package/dist/resolvers/manifest-resolver.js +7 -3
- package/dist/search.cjs +411 -0
- package/dist/search.d.cts +20 -0
- package/dist/search.d.ts +20 -0
- package/dist/search.js +393 -0
- package/dist/types.cjs +12 -0
- package/dist/types.d.cts +132 -7
- package/dist/types.d.ts +132 -7
- package/dist/types.js +5 -0
- package/dist/utils/heading-ids.cjs +119 -0
- package/dist/utils/heading-ids.d.cts +15 -0
- package/dist/utils/heading-ids.d.ts +15 -0
- package/dist/utils/heading-ids.js +90 -0
- package/package.json +59 -38
- package/release/package.json +23 -0
- package/release/pnpm-lock.yaml +1192 -0
- package/release/release.json +39 -0
- package/dist/components/color-palette.cjs +0 -408
- package/dist/components/color-palette.d.cts +0 -5
- package/dist/components/color-palette.d.ts +0 -5
- package/dist/components/color-palette.js +0 -388
- package/dist/components/nav-breadcrumb.d.cts +0 -9
- package/dist/components/nav-breadcrumb.d.ts +0 -9
- package/dist/components/providers.d.cts +0 -8
- package/dist/components/providers.d.ts +0 -8
- package/dist/components/providers.js +0 -20
- package/dist/components/site-header.cjs +0 -302
- package/dist/components/site-header.d.cts +0 -12
- package/dist/components/site-header.d.ts +0 -12
- package/dist/components/site-header.js +0 -268
- package/dist/components/theme-toggle.cjs +0 -147
- package/dist/components/theme-toggle.d.cts +0 -5
- package/dist/components/theme-toggle.d.ts +0 -5
- package/dist/components/theme-toggle.js +0 -123
- package/dist/layouts/group.d.cts +0 -15
- package/dist/layouts/group.d.ts +0 -15
- package/dist/mdx/error-boundary.cjs +0 -94
- package/dist/mdx/error-boundary.js +0 -70
- package/dist/mdx/mdx.cjs +0 -182
- package/dist/mdx/mdx.d.cts +0 -10
- package/dist/mdx/mdx.d.ts +0 -10
- package/dist/mdx/mdx.js +0 -147
- package/dist/pages/leaf.cjs +0 -203
- package/dist/pages/leaf.d.cts +0 -23
- package/dist/pages/leaf.d.ts +0 -23
- package/dist/pages/leaf.js +0 -176
- package/dist/pages/root.js +0 -101
- package/dist/routes/llms.cjs +0 -101
- package/dist/routes/llms.d.cts +0 -7
- package/dist/routes/llms.d.ts +0 -7
- package/dist/routes/llms.js +0 -76
- package/dist/routes/robots.js +0 -69
- package/dist/routes/sitemap.cjs +0 -108
- package/dist/routes/sitemap.d.cts +0 -5
- package/dist/routes/sitemap.d.ts +0 -5
- package/dist/routes/sitemap.js +0 -83
- /package/dist/{mdx → kernel/components/mdx}/error-fallback.d.cts +0 -0
- /package/dist/{mdx → kernel/components/mdx}/error-fallback.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -44,11 +44,39 @@ var tags = {
|
|
|
44
44
|
},
|
|
45
45
|
llms(scope = "root") {
|
|
46
46
|
return assertTag(`llms:${safeSegment(scope)}`);
|
|
47
|
+
},
|
|
48
|
+
feed(format, scope = "site") {
|
|
49
|
+
return assertTag(`feed:${safeSegment(format)}:${safeSegment(scope)}`);
|
|
47
50
|
}
|
|
48
51
|
};
|
|
49
52
|
|
|
50
|
-
// src/
|
|
51
|
-
|
|
53
|
+
// src/config/createNextConfig.ts
|
|
54
|
+
function createNextConfig(_options) {
|
|
55
|
+
return {
|
|
56
|
+
transpilePackages: ["@publish.os/nextjs"],
|
|
57
|
+
cacheComponents: true,
|
|
58
|
+
cacheLife: {
|
|
59
|
+
page: {
|
|
60
|
+
stale: 60 * 60 * 24,
|
|
61
|
+
revalidate: 60 * 60 * 24 * 30,
|
|
62
|
+
expire: 60 * 60 * 24 * 365
|
|
63
|
+
},
|
|
64
|
+
feed: {
|
|
65
|
+
stale: 60 * 60,
|
|
66
|
+
revalidate: 60 * 60 * 6,
|
|
67
|
+
expire: 60 * 60 * 24 * 7
|
|
68
|
+
},
|
|
69
|
+
sitemap: {
|
|
70
|
+
stale: 60 * 60,
|
|
71
|
+
revalidate: 60 * 60 * 24,
|
|
72
|
+
expire: 60 * 60 * 24 * 30
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/kernel/components/blocks/page-list.tsx
|
|
79
|
+
import { Link } from "../ui/link.js";
|
|
52
80
|
import { jsx } from "react/jsx-runtime";
|
|
53
81
|
function pageNodes(nodes) {
|
|
54
82
|
return nodes.flatMap((node) => {
|
|
@@ -69,60 +97,928 @@ function PageList({ tree, currentPath, className }) {
|
|
|
69
97
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
70
98
|
Link,
|
|
71
99
|
{
|
|
72
|
-
|
|
73
|
-
|
|
100
|
+
active,
|
|
101
|
+
color: active ? "accent" : "default",
|
|
74
102
|
href: page.path,
|
|
103
|
+
size: "sm",
|
|
75
104
|
children: page.title
|
|
76
105
|
}
|
|
77
|
-
) }, `${page.group}:${page.
|
|
106
|
+
) }, `${page.group}:${page.fileID}`);
|
|
78
107
|
}) }) });
|
|
79
108
|
}
|
|
80
109
|
|
|
81
|
-
// src/
|
|
82
|
-
import {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
110
|
+
// src/kernel/routes/metadata/feed.ts
|
|
111
|
+
import { cacheLife, cacheTag } from "next/cache";
|
|
112
|
+
|
|
113
|
+
// src/kernel/routes/response.ts
|
|
114
|
+
var CACHE_CONTROL = "public, max-age=300, s-maxage=86400, stale-while-revalidate=3600, must-revalidate";
|
|
115
|
+
var CDN_CACHE_CONTROL = "public, max-age=2592000, stale-while-revalidate=31536000";
|
|
116
|
+
var SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate";
|
|
117
|
+
var SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
|
|
118
|
+
function cacheControl(policy) {
|
|
119
|
+
if (!policy || policy === "default") return CACHE_CONTROL;
|
|
120
|
+
if (policy === "short") return SHORT_CACHE_CONTROL;
|
|
121
|
+
return policy;
|
|
122
|
+
}
|
|
123
|
+
function cdnCacheControl(policy) {
|
|
124
|
+
if (!policy || policy === "default") return CDN_CACHE_CONTROL;
|
|
125
|
+
if (policy === "short") return SHORT_CDN_CACHE_CONTROL;
|
|
126
|
+
return policy;
|
|
127
|
+
}
|
|
128
|
+
function cachedTextHeaders(contentType, options = {}) {
|
|
129
|
+
const headers = new Headers(options.headers);
|
|
130
|
+
headers.set("cache-control", cacheControl(options.cachePolicy));
|
|
131
|
+
headers.set("cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
132
|
+
headers.set("vercel-cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
133
|
+
headers.set("content-type", contentType);
|
|
134
|
+
headers.set("x-content-type-options", "nosniff");
|
|
135
|
+
if (options.noindex) headers.set("x-robots-tag", "noindex");
|
|
136
|
+
return headers;
|
|
137
|
+
}
|
|
138
|
+
function createCachedTextResponse(options) {
|
|
139
|
+
const status = options.status ?? 200;
|
|
140
|
+
const method = options.method ?? "GET";
|
|
141
|
+
const headers = cachedTextHeaders(options.contentType, options);
|
|
142
|
+
return new Response(method === "HEAD" ? null : options.body, {
|
|
143
|
+
headers,
|
|
144
|
+
status
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/kernel/routes/metadata/canonical-url.ts
|
|
149
|
+
function canonicalUrl(manifest, path) {
|
|
150
|
+
const origin = manifest.site.url?.replace(/\/+$/, "");
|
|
151
|
+
if (!origin) return path;
|
|
152
|
+
try {
|
|
153
|
+
return new URL(path, `${origin}/`).toString();
|
|
154
|
+
} catch {
|
|
155
|
+
return path;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// src/kernel/routes/metadata/feed.ts
|
|
160
|
+
function xmlEscape(value) {
|
|
161
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
162
|
+
}
|
|
163
|
+
function pageTimestamp(page) {
|
|
164
|
+
const value = page.publishedAt ?? page.updatedAt;
|
|
165
|
+
if (!value) return -Infinity;
|
|
166
|
+
const timestamp = Date.parse(value);
|
|
167
|
+
return Number.isNaN(timestamp) ? -Infinity : timestamp;
|
|
168
|
+
}
|
|
169
|
+
function pageInScope(page, options) {
|
|
170
|
+
if (options.scope === "site" || !options.group) return true;
|
|
171
|
+
if (options.scope === "self") return page.group === options.group;
|
|
172
|
+
return page.group === options.group || page.group.startsWith(`${options.group}/`);
|
|
173
|
+
}
|
|
174
|
+
function feedPages(manifest, options) {
|
|
175
|
+
const statuses = options.status ?? ["published"];
|
|
176
|
+
const pages = manifest.pages.filter((page) => statuses.includes(page.status)).filter((page) => pageInScope(page, options)).sort((a, b) => pageTimestamp(b) - pageTimestamp(a));
|
|
177
|
+
return options.limit ? pages.slice(0, options.limit) : pages;
|
|
178
|
+
}
|
|
179
|
+
async function rssXml(manifest, options = {}) {
|
|
180
|
+
"use cache";
|
|
181
|
+
cacheLife("page");
|
|
182
|
+
cacheTag(
|
|
183
|
+
tags.site(),
|
|
184
|
+
tags.feed("rss", options.group ?? options.scope ?? "site"),
|
|
185
|
+
tags.manifest(manifest.contentHash)
|
|
186
|
+
);
|
|
187
|
+
const title = manifest.site.name;
|
|
188
|
+
const description = manifest.site.description ?? title;
|
|
189
|
+
const pages = feedPages(manifest, options);
|
|
190
|
+
const homeUrl = canonicalUrl(manifest, "/");
|
|
191
|
+
const items = pages.map((page) => {
|
|
192
|
+
const pageUrl = canonicalUrl(manifest, page.path);
|
|
193
|
+
const pubDate = page.publishedAt ? `
|
|
194
|
+
<pubDate>${xmlEscape(new Date(page.publishedAt).toUTCString())}</pubDate>` : "";
|
|
195
|
+
const description2 = page.description ? `
|
|
196
|
+
<description>${xmlEscape(page.description)}</description>` : "";
|
|
197
|
+
return ` <item>
|
|
198
|
+
<title>${xmlEscape(page.title)}</title>
|
|
199
|
+
<link>${xmlEscape(pageUrl)}</link>
|
|
200
|
+
<guid>${xmlEscape(pageUrl)}</guid>${pubDate}${description2}
|
|
201
|
+
</item>`;
|
|
202
|
+
}).join("\n");
|
|
203
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
204
|
+
<rss version="2.0">
|
|
205
|
+
<channel>
|
|
206
|
+
<title>${xmlEscape(title)}</title>
|
|
207
|
+
<link>${xmlEscape(homeUrl)}</link>
|
|
208
|
+
<description>${xmlEscape(description)}</description>
|
|
209
|
+
${items}
|
|
210
|
+
</channel>
|
|
211
|
+
</rss>
|
|
212
|
+
`;
|
|
213
|
+
}
|
|
214
|
+
function pageDate(page) {
|
|
215
|
+
return page.publishedAt ?? page.updatedAt;
|
|
216
|
+
}
|
|
217
|
+
function latestFeedDate(pages) {
|
|
218
|
+
const timestamp = Math.max(0, ...pages.map((page) => pageTimestamp(page)));
|
|
219
|
+
return new Date(timestamp).toISOString();
|
|
220
|
+
}
|
|
221
|
+
async function atomXml(manifest, options = {}) {
|
|
222
|
+
"use cache";
|
|
223
|
+
cacheLife("page");
|
|
224
|
+
cacheTag(
|
|
225
|
+
tags.site(),
|
|
226
|
+
tags.feed("atom", options.group ?? options.scope ?? "site"),
|
|
227
|
+
tags.manifest(manifest.contentHash)
|
|
228
|
+
);
|
|
229
|
+
const title = manifest.site.name;
|
|
230
|
+
const pages = feedPages(manifest, options);
|
|
231
|
+
const homeUrl = canonicalUrl(manifest, "/");
|
|
232
|
+
const entries = pages.map((page) => {
|
|
233
|
+
const date = pageDate(page);
|
|
234
|
+
const updated = date ? new Date(date).toISOString() : latestFeedDate([]);
|
|
235
|
+
const pageUrl = canonicalUrl(manifest, page.path);
|
|
236
|
+
const summary = page.description ? `
|
|
237
|
+
<summary>${xmlEscape(page.description)}</summary>` : "";
|
|
238
|
+
return ` <entry>
|
|
239
|
+
<title>${xmlEscape(page.title)}</title>
|
|
240
|
+
<id>${xmlEscape(pageUrl)}</id>
|
|
241
|
+
<link href="${xmlEscape(pageUrl)}" />
|
|
242
|
+
<updated>${xmlEscape(updated)}</updated>${summary}
|
|
243
|
+
</entry>`;
|
|
244
|
+
}).join("\n");
|
|
245
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
246
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
247
|
+
<title>${xmlEscape(title)}</title>
|
|
248
|
+
<id>${xmlEscape(homeUrl)}</id>
|
|
249
|
+
<updated>${xmlEscape(latestFeedDate(pages))}</updated>
|
|
250
|
+
${entries}
|
|
251
|
+
</feed>
|
|
252
|
+
`;
|
|
253
|
+
}
|
|
254
|
+
async function jsonFeed(manifest, options = {}) {
|
|
255
|
+
"use cache";
|
|
256
|
+
cacheLife("page");
|
|
257
|
+
cacheTag(
|
|
258
|
+
tags.site(),
|
|
259
|
+
tags.feed("json", options.group ?? options.scope ?? "site"),
|
|
260
|
+
tags.manifest(manifest.contentHash)
|
|
261
|
+
);
|
|
262
|
+
const pages = feedPages(manifest, options);
|
|
263
|
+
return `${JSON.stringify(
|
|
87
264
|
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
265
|
+
version: "https://jsonfeed.org/version/1.1",
|
|
266
|
+
title: manifest.site.name,
|
|
267
|
+
description: manifest.site.description,
|
|
268
|
+
home_page_url: canonicalUrl(manifest, "/"),
|
|
269
|
+
items: pages.map((page) => ({
|
|
270
|
+
id: canonicalUrl(manifest, page.path),
|
|
271
|
+
url: canonicalUrl(manifest, page.path),
|
|
272
|
+
title: page.title,
|
|
273
|
+
summary: page.description,
|
|
274
|
+
content_text: page.body,
|
|
275
|
+
date_published: page.publishedAt,
|
|
276
|
+
date_modified: page.updatedAt,
|
|
277
|
+
tags: page.tags
|
|
278
|
+
}))
|
|
279
|
+
},
|
|
280
|
+
null,
|
|
281
|
+
2
|
|
282
|
+
)}
|
|
283
|
+
`;
|
|
284
|
+
}
|
|
285
|
+
function createRssFeedRoute(manifest, options = {}) {
|
|
286
|
+
return async function GET() {
|
|
287
|
+
return createCachedTextResponse({
|
|
288
|
+
body: await rssXml(manifest, options),
|
|
289
|
+
contentType: "application/rss+xml; charset=utf-8"
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function createAtomFeedRoute(manifest, options = {}) {
|
|
294
|
+
return async function GET() {
|
|
295
|
+
return createCachedTextResponse({
|
|
296
|
+
body: await atomXml(manifest, options),
|
|
297
|
+
contentType: "application/atom+xml; charset=utf-8"
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function createJsonFeedRoute(manifest, options = {}) {
|
|
302
|
+
return async function GET() {
|
|
303
|
+
return createCachedTextResponse({
|
|
304
|
+
body: await jsonFeed(manifest, options),
|
|
305
|
+
contentType: "application/feed+json; charset=utf-8"
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/kernel/routes/metadata/llms.ts
|
|
311
|
+
import { cacheLife as cacheLife2, cacheTag as cacheTag2 } from "next/cache";
|
|
312
|
+
var TEXT_ENCODER = new TextEncoder();
|
|
313
|
+
function pageInScope2(page, options) {
|
|
314
|
+
if (options.scope === "site" || !options.group) return true;
|
|
315
|
+
if (options.scope === "self") return page.group === options.group;
|
|
316
|
+
return page.group === options.group || page.group.startsWith(`${options.group}/`);
|
|
317
|
+
}
|
|
318
|
+
function llmsSummary(manifest) {
|
|
319
|
+
return manifest.site.description ? `> ${manifest.site.description}` : `> Agent-readable index for ${manifest.site.name}.`;
|
|
320
|
+
}
|
|
321
|
+
async function llmsTxt(manifest, options = {}) {
|
|
322
|
+
"use cache";
|
|
323
|
+
cacheLife2("page");
|
|
324
|
+
cacheTag2(
|
|
325
|
+
tags.site(),
|
|
326
|
+
tags.llms(options.group ?? options.scope ?? "root"),
|
|
327
|
+
tags.manifest(manifest.contentHash)
|
|
94
328
|
);
|
|
329
|
+
const pages = manifest.pages.filter((page) => page.status === "published").filter((page) => pageInScope2(page, options));
|
|
330
|
+
const visiblePages = options.limit ? pages.slice(0, options.limit) : pages;
|
|
331
|
+
const lines = visiblePages.map((page) => {
|
|
332
|
+
const description = options.includeDescriptions && page.description ? ` - ${page.description}` : "";
|
|
333
|
+
return `- [${page.title}](${canonicalUrl(manifest, page.path)})${description}`;
|
|
334
|
+
});
|
|
335
|
+
const linkLines = (options.links ?? []).map(
|
|
336
|
+
(link) => `- [${link.title}](${canonicalUrl(manifest, link.path)})`
|
|
337
|
+
);
|
|
338
|
+
const linkSection = linkLines.length ? `
|
|
339
|
+
|
|
340
|
+
## Group LLM indexes
|
|
341
|
+
|
|
342
|
+
${linkLines.join("\n")}` : "";
|
|
343
|
+
return `# ${manifest.site.name}
|
|
344
|
+
|
|
345
|
+
${llmsSummary(manifest)}
|
|
346
|
+
|
|
347
|
+
${lines.join("\n")}${linkSection}
|
|
348
|
+
`;
|
|
349
|
+
}
|
|
350
|
+
function createLlmsTxtRoute(manifest, options = {}) {
|
|
351
|
+
return async function GET() {
|
|
352
|
+
return createCachedTextResponse({
|
|
353
|
+
body: await llmsTxt(manifest, options),
|
|
354
|
+
contentType: "text/plain; charset=utf-8"
|
|
355
|
+
});
|
|
356
|
+
};
|
|
95
357
|
}
|
|
96
358
|
|
|
97
|
-
// src/
|
|
98
|
-
|
|
359
|
+
// src/kernel/routes/metadata/og-image.tsx
|
|
360
|
+
import { readFile } from "fs/promises";
|
|
361
|
+
import { createRequire } from "module";
|
|
362
|
+
import { ImageResponse } from "next/og";
|
|
363
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
364
|
+
var ERROR_HEADERS = {
|
|
365
|
+
"cache-control": "public, max-age=60, must-revalidate",
|
|
366
|
+
"cdn-cache-control": "public, max-age=300",
|
|
367
|
+
"vercel-cdn-cache-control": "public, max-age=300",
|
|
368
|
+
"x-content-type-options": "nosniff"
|
|
369
|
+
};
|
|
370
|
+
var SUCCESS_HEADERS = {
|
|
371
|
+
"cache-control": "public, max-age=31536000, immutable",
|
|
372
|
+
"cdn-cache-control": "public, max-age=31536000, immutable",
|
|
373
|
+
"vercel-cdn-cache-control": "public, max-age=31536000, immutable",
|
|
374
|
+
"x-content-type-options": "nosniff"
|
|
375
|
+
};
|
|
376
|
+
var DEVELOPMENT_SUCCESS_HEADERS = {
|
|
377
|
+
"cache-control": "no-store",
|
|
378
|
+
"cdn-cache-control": "no-store",
|
|
379
|
+
"vercel-cdn-cache-control": "no-store",
|
|
380
|
+
"x-content-type-options": "nosniff"
|
|
381
|
+
};
|
|
382
|
+
var KEY_PATTERN = /^[a-f0-9]{16}$/;
|
|
383
|
+
var DESCRIPTION_MAX_LENGTH = 260;
|
|
384
|
+
var LABEL_MAX_LENGTH = 72;
|
|
385
|
+
var SITE_NAME_MAX_LENGTH = 42;
|
|
386
|
+
var TITLE_MAX_LENGTH = 220;
|
|
387
|
+
var GRID_INSET = 86;
|
|
388
|
+
var GRID_BOTTOM = 544;
|
|
389
|
+
var CONTENT_X = 122;
|
|
390
|
+
var CONTENT_WIDTH = 956;
|
|
391
|
+
var TITLE_MAX_FONT_SIZE = 60;
|
|
392
|
+
var TITLE_MIN_FONT_SIZE = 40;
|
|
393
|
+
var LOGO_MAX_WIDTH = 300;
|
|
394
|
+
var LOGO_MAX_HEIGHT = 46;
|
|
395
|
+
var MAX_RESPONSE_CACHE_ENTRIES = 128;
|
|
396
|
+
var BADGE_RADIUS = 999;
|
|
397
|
+
var CONTENT_TYPE_HEADER = { "content-type": "image/png" };
|
|
398
|
+
var PLATFORM_FONT_FAMILY = "PublishOS Geist";
|
|
399
|
+
var PLATFORM_FONT_WEIGHTS = [
|
|
400
|
+
400,
|
|
401
|
+
500,
|
|
402
|
+
600,
|
|
403
|
+
700,
|
|
404
|
+
800
|
|
405
|
+
];
|
|
406
|
+
var fontArrayBufferCache = /* @__PURE__ */ new Map();
|
|
407
|
+
var imageResponseFontCache = /* @__PURE__ */ new Map();
|
|
408
|
+
var imageResponseCache = /* @__PURE__ */ new Map();
|
|
409
|
+
var require2 = createRequire(`${process.cwd()}/package.json`);
|
|
410
|
+
var platformFontPath = require2.resolve(
|
|
411
|
+
"next/dist/compiled/@vercel/og/Geist-Regular.ttf"
|
|
412
|
+
);
|
|
413
|
+
var platformFontData;
|
|
414
|
+
function isDevelopment() {
|
|
415
|
+
return process.env.NODE_ENV === "development";
|
|
416
|
+
}
|
|
417
|
+
function successHeaders() {
|
|
418
|
+
return isDevelopment() ? DEVELOPMENT_SUCCESS_HEADERS : SUCCESS_HEADERS;
|
|
419
|
+
}
|
|
420
|
+
function clampText(value, maxLength) {
|
|
421
|
+
if (!value) return void 0;
|
|
422
|
+
if (value.length <= maxLength) return value;
|
|
423
|
+
return `${value.slice(0, maxLength - 3).trimEnd()}...`;
|
|
424
|
+
}
|
|
425
|
+
async function routeKey(context) {
|
|
426
|
+
const params = await context.params;
|
|
427
|
+
return params.key.replace(/\.png$/, "");
|
|
428
|
+
}
|
|
429
|
+
function ellipsize(value, maxLength) {
|
|
430
|
+
if (value.length <= maxLength) return value;
|
|
431
|
+
return `${value.slice(0, maxLength - 3).trimEnd()}...`;
|
|
432
|
+
}
|
|
433
|
+
function wrapText(options) {
|
|
434
|
+
const source = clampText(options.text, options.maxLength);
|
|
435
|
+
if (!source) return [];
|
|
436
|
+
const maxCharsPerLine = Math.max(
|
|
437
|
+
12,
|
|
438
|
+
Math.floor(options.width / (options.fontSize * 0.54))
|
|
439
|
+
);
|
|
440
|
+
const words = source.split(/\s+/).filter(Boolean);
|
|
441
|
+
const lines = [];
|
|
442
|
+
let line = "";
|
|
443
|
+
for (const word of words) {
|
|
444
|
+
const nextLine = line ? `${line} ${word}` : word;
|
|
445
|
+
if (nextLine.length <= maxCharsPerLine) {
|
|
446
|
+
line = nextLine;
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
if (line) lines.push(line);
|
|
450
|
+
line = word.length > maxCharsPerLine ? ellipsize(word, maxCharsPerLine) : word;
|
|
451
|
+
if (lines.length === options.maxLines) break;
|
|
452
|
+
}
|
|
453
|
+
if (line && lines.length < options.maxLines) lines.push(line);
|
|
454
|
+
const consumed = lines.join(" ").replace(/\.\.\.$/, "");
|
|
455
|
+
const didOverflow = words.join(" ").length > consumed.length || (lines.at(-1)?.endsWith("...") ?? false);
|
|
456
|
+
if (didOverflow && lines.length > 0) {
|
|
457
|
+
const lastIndex = lines.length - 1;
|
|
458
|
+
lines[lastIndex] = ellipsize(lines[lastIndex] ?? "", maxCharsPerLine);
|
|
459
|
+
}
|
|
460
|
+
return lines;
|
|
461
|
+
}
|
|
462
|
+
function singleLineText(options) {
|
|
463
|
+
const source = clampText(options.text, options.maxLength);
|
|
464
|
+
if (!source) return void 0;
|
|
465
|
+
const charWidth = options.fontSize * (options.mono ? 0.62 : 0.54);
|
|
466
|
+
const maxChars = Math.max(4, Math.floor(options.width / charWidth));
|
|
467
|
+
return ellipsize(source.replace(/\s+/g, " "), maxChars);
|
|
468
|
+
}
|
|
469
|
+
function titleFontSize(title) {
|
|
470
|
+
const length = title?.length ?? 0;
|
|
471
|
+
if (length > 130) return TITLE_MIN_FONT_SIZE;
|
|
472
|
+
if (length > 100) return 44;
|
|
473
|
+
if (length > 80) return 48;
|
|
474
|
+
if (length > 60) return 52;
|
|
475
|
+
if (length > 40) return 56;
|
|
476
|
+
return TITLE_MAX_FONT_SIZE;
|
|
477
|
+
}
|
|
478
|
+
function siteUrl(value) {
|
|
479
|
+
if (!value) return void 0;
|
|
480
|
+
const candidate = value.includes("://") ? value : `https://${value}`;
|
|
481
|
+
try {
|
|
482
|
+
return new URL(candidate);
|
|
483
|
+
} catch {
|
|
484
|
+
return void 0;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
function displayUrlParts(entry) {
|
|
488
|
+
const url = siteUrl(entry.siteUrl);
|
|
489
|
+
const host = url?.hostname ?? entry.siteUrl?.replace(/\/.*$/, "") ?? "";
|
|
490
|
+
const basePath = url?.pathname.replace(/\/+$/, "") ?? "";
|
|
491
|
+
const routePath = entry.routePath === "/" ? "" : `/${entry.routePath.replace(/^\/+/, "")}`;
|
|
492
|
+
const path = `${basePath === "/" ? "" : basePath}${routePath}`;
|
|
493
|
+
if (host) return { host, path };
|
|
494
|
+
return { host: "", path: path || routePath };
|
|
495
|
+
}
|
|
496
|
+
function dataUrlToArrayBuffer(value) {
|
|
497
|
+
const cached = fontArrayBufferCache.get(value);
|
|
498
|
+
if (cached) return cached;
|
|
499
|
+
const binary = atob(value);
|
|
500
|
+
const bytes = new Uint8Array(binary.length);
|
|
501
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
502
|
+
bytes[index] = binary.charCodeAt(index);
|
|
503
|
+
}
|
|
504
|
+
fontArrayBufferCache.set(value, bytes.buffer);
|
|
505
|
+
return bytes.buffer;
|
|
506
|
+
}
|
|
507
|
+
function platformFonts() {
|
|
508
|
+
platformFontData ??= readFile(platformFontPath).then(
|
|
509
|
+
(data) => data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)
|
|
510
|
+
);
|
|
511
|
+
return platformFontData.then(
|
|
512
|
+
(data) => PLATFORM_FONT_WEIGHTS.map((weight) => ({
|
|
513
|
+
data: data.slice(0),
|
|
514
|
+
name: PLATFORM_FONT_FAMILY,
|
|
515
|
+
style: "normal",
|
|
516
|
+
weight
|
|
517
|
+
}))
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
async function imageResponseFonts(entry) {
|
|
521
|
+
const cached = imageResponseFontCache.get(entry.key);
|
|
522
|
+
if (cached) return cached;
|
|
523
|
+
const manifestFonts = ["main", "mono"].flatMap((role) => {
|
|
524
|
+
const font = entry.fonts?.[role];
|
|
525
|
+
return font?.files?.map((file) => ({
|
|
526
|
+
data: dataUrlToArrayBuffer(file.data),
|
|
527
|
+
name: font.family,
|
|
528
|
+
style: file.style,
|
|
529
|
+
weight: file.weight
|
|
530
|
+
})) ?? [];
|
|
531
|
+
});
|
|
532
|
+
const fonts = manifestFonts.length > 0 ? [...manifestFonts, ...await platformFonts()] : await platformFonts();
|
|
533
|
+
imageResponseFontCache.set(entry.key, fonts);
|
|
534
|
+
return fonts;
|
|
535
|
+
}
|
|
536
|
+
function fontFamily(font, fallback) {
|
|
537
|
+
const fallbackStack = fallback === "mono" ? `"${PLATFORM_FONT_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace` : `"${PLATFORM_FONT_FAMILY}", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`;
|
|
538
|
+
return font?.family ? `${JSON.stringify(font.family)}, ${fallbackStack}` : fallbackStack;
|
|
539
|
+
}
|
|
540
|
+
function fittedLogoDimensions(logo) {
|
|
541
|
+
if (!logo?.width || !logo.height) return void 0;
|
|
542
|
+
const scale = Math.min(
|
|
543
|
+
LOGO_MAX_WIDTH / logo.width,
|
|
544
|
+
LOGO_MAX_HEIGHT / logo.height,
|
|
545
|
+
1
|
|
546
|
+
);
|
|
99
547
|
return {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
548
|
+
height: Math.max(1, Math.round(logo.height * scale)),
|
|
549
|
+
width: Math.max(1, Math.round(logo.width * scale))
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function cacheImageResponse(key, render) {
|
|
553
|
+
if (isDevelopment()) return render();
|
|
554
|
+
const cached = imageResponseCache.get(key);
|
|
555
|
+
if (cached) return cached;
|
|
556
|
+
const promise = render().catch((error) => {
|
|
557
|
+
imageResponseCache.delete(key);
|
|
558
|
+
throw error;
|
|
559
|
+
});
|
|
560
|
+
imageResponseCache.set(key, promise);
|
|
561
|
+
if (imageResponseCache.size > MAX_RESPONSE_CACHE_ENTRIES) {
|
|
562
|
+
const oldest = imageResponseCache.keys().next().value;
|
|
563
|
+
if (oldest) imageResponseCache.delete(oldest);
|
|
564
|
+
}
|
|
565
|
+
return promise;
|
|
566
|
+
}
|
|
567
|
+
function responseFromCachedImage(cached) {
|
|
568
|
+
return new Response(cached.body.slice(0), {
|
|
569
|
+
headers: cached.headers,
|
|
570
|
+
status: cached.status
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
async function cachedImageResponse(response) {
|
|
574
|
+
const headersToApply = successHeaders();
|
|
575
|
+
const headers = new Headers(response.headers);
|
|
576
|
+
headers.set("cache-control", headersToApply["cache-control"]);
|
|
577
|
+
headers.set("cdn-cache-control", headersToApply["cdn-cache-control"]);
|
|
578
|
+
headers.set(
|
|
579
|
+
"vercel-cdn-cache-control",
|
|
580
|
+
headersToApply["vercel-cdn-cache-control"]
|
|
581
|
+
);
|
|
582
|
+
headers.set(
|
|
583
|
+
"x-content-type-options",
|
|
584
|
+
headersToApply["x-content-type-options"]
|
|
585
|
+
);
|
|
586
|
+
if (!headers.has("content-type")) {
|
|
587
|
+
headers.set("content-type", CONTENT_TYPE_HEADER["content-type"]);
|
|
588
|
+
}
|
|
589
|
+
return {
|
|
590
|
+
body: await response.arrayBuffer(),
|
|
591
|
+
headers,
|
|
592
|
+
status: response.status
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
function createOgImageRoute({ manifest }) {
|
|
596
|
+
return async function GET(_request, context) {
|
|
597
|
+
const key = await routeKey(context);
|
|
598
|
+
if (!KEY_PATTERN.test(key)) {
|
|
599
|
+
return new Response("Bad request", {
|
|
600
|
+
headers: ERROR_HEADERS,
|
|
601
|
+
status: 400
|
|
602
|
+
});
|
|
118
603
|
}
|
|
604
|
+
const entry = manifest.generated[key];
|
|
605
|
+
if (!entry || entry.source !== "generated") {
|
|
606
|
+
return new Response("Not found", {
|
|
607
|
+
headers: ERROR_HEADERS,
|
|
608
|
+
status: 404
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
const titleSize = titleFontSize(entry.title);
|
|
612
|
+
const titleLines = wrapText({
|
|
613
|
+
fontSize: titleSize,
|
|
614
|
+
maxLength: TITLE_MAX_LENGTH,
|
|
615
|
+
maxLines: 2,
|
|
616
|
+
text: entry.title,
|
|
617
|
+
width: 900
|
|
618
|
+
});
|
|
619
|
+
const descriptionLines = wrapText({
|
|
620
|
+
fontSize: 30,
|
|
621
|
+
maxLength: DESCRIPTION_MAX_LENGTH,
|
|
622
|
+
maxLines: 2,
|
|
623
|
+
text: entry.description,
|
|
624
|
+
width: 870
|
|
625
|
+
});
|
|
626
|
+
const label = singleLineText({
|
|
627
|
+
fontSize: 22,
|
|
628
|
+
maxLength: LABEL_MAX_LENGTH,
|
|
629
|
+
mono: true,
|
|
630
|
+
text: entry.label,
|
|
631
|
+
width: 520
|
|
632
|
+
});
|
|
633
|
+
const displayUrl = displayUrlParts(entry);
|
|
634
|
+
const siteName = clampText(
|
|
635
|
+
entry.siteName ?? entry.alt,
|
|
636
|
+
SITE_NAME_MAX_LENGTH
|
|
637
|
+
);
|
|
638
|
+
const background = entry.background ?? "#ffffff";
|
|
639
|
+
const textPrimary = entry.textPrimary ?? "#111111";
|
|
640
|
+
const textSecondary = entry.textSecondary ?? "#525252";
|
|
641
|
+
const accent = entry.accent ?? "#2563eb";
|
|
642
|
+
const stroke = entry.stroke ?? "#e5e7eb";
|
|
643
|
+
const logoSrc = entry.logo?.dataUri;
|
|
644
|
+
const logoDimensions = fittedLogoDimensions(entry.logo);
|
|
645
|
+
return responseFromCachedImage(
|
|
646
|
+
await cacheImageResponse(
|
|
647
|
+
entry.key,
|
|
648
|
+
async () => cachedImageResponse(
|
|
649
|
+
new ImageResponse(
|
|
650
|
+
/* @__PURE__ */ jsxs(
|
|
651
|
+
"div",
|
|
652
|
+
{
|
|
653
|
+
style: {
|
|
654
|
+
background,
|
|
655
|
+
color: textPrimary,
|
|
656
|
+
display: "flex",
|
|
657
|
+
fontFamily: fontFamily(entry.fonts?.main, "sans"),
|
|
658
|
+
height: "100%",
|
|
659
|
+
position: "relative",
|
|
660
|
+
width: "100%"
|
|
661
|
+
},
|
|
662
|
+
children: [
|
|
663
|
+
/* @__PURE__ */ jsx2(
|
|
664
|
+
"div",
|
|
665
|
+
{
|
|
666
|
+
style: {
|
|
667
|
+
background: stroke,
|
|
668
|
+
display: "flex",
|
|
669
|
+
height: "100%",
|
|
670
|
+
left: GRID_INSET,
|
|
671
|
+
position: "absolute",
|
|
672
|
+
top: 0,
|
|
673
|
+
width: 2
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
),
|
|
677
|
+
/* @__PURE__ */ jsx2(
|
|
678
|
+
"div",
|
|
679
|
+
{
|
|
680
|
+
style: {
|
|
681
|
+
background: stroke,
|
|
682
|
+
display: "flex",
|
|
683
|
+
height: "100%",
|
|
684
|
+
position: "absolute",
|
|
685
|
+
right: GRID_INSET,
|
|
686
|
+
top: 0,
|
|
687
|
+
width: 2
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
),
|
|
691
|
+
/* @__PURE__ */ jsx2(
|
|
692
|
+
"div",
|
|
693
|
+
{
|
|
694
|
+
style: {
|
|
695
|
+
background: stroke,
|
|
696
|
+
display: "flex",
|
|
697
|
+
height: 2,
|
|
698
|
+
left: 0,
|
|
699
|
+
position: "absolute",
|
|
700
|
+
top: GRID_INSET,
|
|
701
|
+
width: "100%"
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
),
|
|
705
|
+
/* @__PURE__ */ jsx2(
|
|
706
|
+
"div",
|
|
707
|
+
{
|
|
708
|
+
style: {
|
|
709
|
+
background: stroke,
|
|
710
|
+
bottom: GRID_INSET,
|
|
711
|
+
display: "flex",
|
|
712
|
+
height: 2,
|
|
713
|
+
left: 0,
|
|
714
|
+
position: "absolute",
|
|
715
|
+
width: "100%"
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
),
|
|
719
|
+
/* @__PURE__ */ jsx2(
|
|
720
|
+
"div",
|
|
721
|
+
{
|
|
722
|
+
style: {
|
|
723
|
+
alignItems: "center",
|
|
724
|
+
color: accent,
|
|
725
|
+
display: "flex",
|
|
726
|
+
fontFamily: fontFamily(entry.fonts?.main, "sans"),
|
|
727
|
+
fontSize: 22,
|
|
728
|
+
fontWeight: 700,
|
|
729
|
+
height: GRID_INSET,
|
|
730
|
+
justifyContent: "flex-start",
|
|
731
|
+
left: CONTENT_X,
|
|
732
|
+
lineHeight: 1,
|
|
733
|
+
overflow: "hidden",
|
|
734
|
+
position: "absolute",
|
|
735
|
+
top: 0,
|
|
736
|
+
width: 430
|
|
737
|
+
},
|
|
738
|
+
children: logoSrc ? (
|
|
739
|
+
// biome-ignore lint/performance/noImgElement: ImageResponse renders static manifest-provided logo data; next/image is not available in Satori output.
|
|
740
|
+
/* @__PURE__ */ jsx2(
|
|
741
|
+
"img",
|
|
742
|
+
{
|
|
743
|
+
alt: "",
|
|
744
|
+
src: logoSrc,
|
|
745
|
+
style: {
|
|
746
|
+
height: logoDimensions?.height ?? LOGO_MAX_HEIGHT,
|
|
747
|
+
maxHeight: LOGO_MAX_HEIGHT,
|
|
748
|
+
maxWidth: LOGO_MAX_WIDTH,
|
|
749
|
+
objectFit: "contain",
|
|
750
|
+
objectPosition: "left center",
|
|
751
|
+
width: logoDimensions?.width ?? "auto"
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
) : siteName
|
|
756
|
+
}
|
|
757
|
+
),
|
|
758
|
+
label ? /* @__PURE__ */ jsx2(
|
|
759
|
+
"div",
|
|
760
|
+
{
|
|
761
|
+
style: {
|
|
762
|
+
alignItems: "center",
|
|
763
|
+
display: "flex",
|
|
764
|
+
fontFamily: fontFamily(entry.fonts?.mono, "mono"),
|
|
765
|
+
height: GRID_INSET,
|
|
766
|
+
justifyContent: "flex-end",
|
|
767
|
+
overflow: "hidden",
|
|
768
|
+
position: "absolute",
|
|
769
|
+
right: CONTENT_X,
|
|
770
|
+
top: 0,
|
|
771
|
+
width: 520
|
|
772
|
+
},
|
|
773
|
+
children: /* @__PURE__ */ jsxs(
|
|
774
|
+
"div",
|
|
775
|
+
{
|
|
776
|
+
style: {
|
|
777
|
+
alignItems: "center",
|
|
778
|
+
borderRadius: BADGE_RADIUS,
|
|
779
|
+
color: accent,
|
|
780
|
+
display: "flex",
|
|
781
|
+
fontSize: 20,
|
|
782
|
+
fontWeight: 600,
|
|
783
|
+
lineHeight: 1,
|
|
784
|
+
maxWidth: 520,
|
|
785
|
+
overflow: "hidden",
|
|
786
|
+
paddingBottom: 6,
|
|
787
|
+
paddingLeft: 12,
|
|
788
|
+
paddingRight: 12,
|
|
789
|
+
paddingTop: 6,
|
|
790
|
+
position: "relative"
|
|
791
|
+
},
|
|
792
|
+
children: [
|
|
793
|
+
/* @__PURE__ */ jsx2(
|
|
794
|
+
"div",
|
|
795
|
+
{
|
|
796
|
+
style: {
|
|
797
|
+
background: accent,
|
|
798
|
+
borderRadius: BADGE_RADIUS,
|
|
799
|
+
bottom: 0,
|
|
800
|
+
display: "flex",
|
|
801
|
+
left: 0,
|
|
802
|
+
opacity: 0.14,
|
|
803
|
+
position: "absolute",
|
|
804
|
+
right: 0,
|
|
805
|
+
top: 0
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
),
|
|
809
|
+
/* @__PURE__ */ jsx2(
|
|
810
|
+
"div",
|
|
811
|
+
{
|
|
812
|
+
style: {
|
|
813
|
+
borderColor: accent,
|
|
814
|
+
borderRadius: BADGE_RADIUS,
|
|
815
|
+
borderStyle: "solid",
|
|
816
|
+
borderWidth: 1,
|
|
817
|
+
bottom: 0,
|
|
818
|
+
display: "flex",
|
|
819
|
+
left: 0,
|
|
820
|
+
opacity: 0.32,
|
|
821
|
+
position: "absolute",
|
|
822
|
+
right: 0,
|
|
823
|
+
top: 0
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
),
|
|
827
|
+
/* @__PURE__ */ jsx2("div", { style: { display: "flex", position: "relative" }, children: label })
|
|
828
|
+
]
|
|
829
|
+
}
|
|
830
|
+
)
|
|
831
|
+
}
|
|
832
|
+
) : null,
|
|
833
|
+
/* @__PURE__ */ jsxs(
|
|
834
|
+
"div",
|
|
835
|
+
{
|
|
836
|
+
style: {
|
|
837
|
+
display: "flex",
|
|
838
|
+
flexDirection: "column",
|
|
839
|
+
gap: 24,
|
|
840
|
+
left: CONTENT_X,
|
|
841
|
+
position: "absolute",
|
|
842
|
+
top: 164,
|
|
843
|
+
width: CONTENT_WIDTH
|
|
844
|
+
},
|
|
845
|
+
children: [
|
|
846
|
+
/* @__PURE__ */ jsx2(
|
|
847
|
+
"div",
|
|
848
|
+
{
|
|
849
|
+
style: {
|
|
850
|
+
display: "flex",
|
|
851
|
+
flexDirection: "column",
|
|
852
|
+
fontSize: titleSize,
|
|
853
|
+
fontWeight: 800,
|
|
854
|
+
letterSpacing: 0,
|
|
855
|
+
lineHeight: 1.08,
|
|
856
|
+
width: 900
|
|
857
|
+
},
|
|
858
|
+
children: titleLines.map((line) => /* @__PURE__ */ jsx2("div", { style: { display: "flex" }, children: line }, line))
|
|
859
|
+
}
|
|
860
|
+
),
|
|
861
|
+
descriptionLines.length > 0 ? /* @__PURE__ */ jsx2(
|
|
862
|
+
"div",
|
|
863
|
+
{
|
|
864
|
+
style: {
|
|
865
|
+
color: textSecondary,
|
|
866
|
+
display: "flex",
|
|
867
|
+
flexDirection: "column",
|
|
868
|
+
fontSize: 30,
|
|
869
|
+
lineHeight: 1.25,
|
|
870
|
+
width: 870
|
|
871
|
+
},
|
|
872
|
+
children: descriptionLines.map((line) => /* @__PURE__ */ jsx2("div", { style: { display: "flex" }, children: line }, line))
|
|
873
|
+
}
|
|
874
|
+
) : null
|
|
875
|
+
]
|
|
876
|
+
}
|
|
877
|
+
),
|
|
878
|
+
/* @__PURE__ */ jsx2(
|
|
879
|
+
"div",
|
|
880
|
+
{
|
|
881
|
+
style: {
|
|
882
|
+
alignItems: "center",
|
|
883
|
+
display: "flex",
|
|
884
|
+
fontFamily: fontFamily(entry.fonts?.mono, "mono"),
|
|
885
|
+
fontSize: 22,
|
|
886
|
+
height: GRID_INSET,
|
|
887
|
+
justifyContent: "flex-start",
|
|
888
|
+
left: CONTENT_X,
|
|
889
|
+
lineHeight: 1.2,
|
|
890
|
+
overflow: "hidden",
|
|
891
|
+
position: "absolute",
|
|
892
|
+
top: GRID_BOTTOM,
|
|
893
|
+
width: CONTENT_WIDTH
|
|
894
|
+
},
|
|
895
|
+
children: /* @__PURE__ */ jsxs(
|
|
896
|
+
"div",
|
|
897
|
+
{
|
|
898
|
+
style: {
|
|
899
|
+
display: "flex",
|
|
900
|
+
flexDirection: "row",
|
|
901
|
+
overflow: "hidden",
|
|
902
|
+
textOverflow: "ellipsis",
|
|
903
|
+
whiteSpace: "nowrap",
|
|
904
|
+
width: CONTENT_WIDTH
|
|
905
|
+
},
|
|
906
|
+
children: [
|
|
907
|
+
displayUrl.host ? /* @__PURE__ */ jsx2(
|
|
908
|
+
"div",
|
|
909
|
+
{
|
|
910
|
+
style: {
|
|
911
|
+
color: textSecondary,
|
|
912
|
+
display: "flex",
|
|
913
|
+
flexShrink: 0,
|
|
914
|
+
whiteSpace: "nowrap"
|
|
915
|
+
},
|
|
916
|
+
children: displayUrl.host
|
|
917
|
+
}
|
|
918
|
+
) : null,
|
|
919
|
+
displayUrl.path ? /* @__PURE__ */ jsx2(
|
|
920
|
+
"div",
|
|
921
|
+
{
|
|
922
|
+
style: {
|
|
923
|
+
color: textPrimary,
|
|
924
|
+
display: "flex",
|
|
925
|
+
minWidth: 0,
|
|
926
|
+
overflow: "hidden",
|
|
927
|
+
textOverflow: "ellipsis",
|
|
928
|
+
whiteSpace: "nowrap"
|
|
929
|
+
},
|
|
930
|
+
children: displayUrl.path
|
|
931
|
+
}
|
|
932
|
+
) : null
|
|
933
|
+
]
|
|
934
|
+
}
|
|
935
|
+
)
|
|
936
|
+
}
|
|
937
|
+
)
|
|
938
|
+
]
|
|
939
|
+
}
|
|
940
|
+
),
|
|
941
|
+
{
|
|
942
|
+
fonts: await imageResponseFonts(entry),
|
|
943
|
+
headers: {
|
|
944
|
+
...CONTENT_TYPE_HEADER,
|
|
945
|
+
...successHeaders()
|
|
946
|
+
},
|
|
947
|
+
height: manifest.height,
|
|
948
|
+
width: manifest.width
|
|
949
|
+
}
|
|
950
|
+
)
|
|
951
|
+
)
|
|
952
|
+
)
|
|
953
|
+
);
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
function createOgImageStaticParams({ manifest }) {
|
|
957
|
+
return Object.keys(manifest.generated).map((key) => ({ key: `${key}.png` }));
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
// src/kernel/routes/metadata/robots.ts
|
|
961
|
+
import { cacheLife as cacheLife3, cacheTag as cacheTag3 } from "next/cache";
|
|
962
|
+
async function robotsTxt(manifest) {
|
|
963
|
+
"use cache";
|
|
964
|
+
cacheLife3("page");
|
|
965
|
+
cacheTag3(tags.site(), tags.robots(), tags.manifest(manifest.contentHash));
|
|
966
|
+
const sitemapUrl = canonicalUrl(manifest, "/sitemap.xml");
|
|
967
|
+
return `User-agent: *
|
|
968
|
+
Allow: /
|
|
969
|
+
Sitemap: ${sitemapUrl}
|
|
970
|
+
`;
|
|
971
|
+
}
|
|
972
|
+
function createRobotsTxtRoute(manifest) {
|
|
973
|
+
return async function GET() {
|
|
974
|
+
return createCachedTextResponse({
|
|
975
|
+
body: await robotsTxt(manifest),
|
|
976
|
+
contentType: "text/plain; charset=utf-8"
|
|
977
|
+
});
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// src/kernel/routes/metadata/sitemap.ts
|
|
982
|
+
import { cacheLife as cacheLife4, cacheTag as cacheTag4 } from "next/cache";
|
|
983
|
+
function xmlEscape2(value) {
|
|
984
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
985
|
+
}
|
|
986
|
+
async function sitemapXml(manifest) {
|
|
987
|
+
"use cache";
|
|
988
|
+
cacheLife4("page");
|
|
989
|
+
cacheTag4(tags.site(), tags.sitemap(), tags.manifest(manifest.contentHash));
|
|
990
|
+
const urls = [
|
|
991
|
+
"/",
|
|
992
|
+
...Object.values(manifest.groups).map((g) => g.path),
|
|
993
|
+
...manifest.pages.filter((page) => page.status === "published").map((page) => page.path)
|
|
994
|
+
];
|
|
995
|
+
const uniqueUrls = [...new Set(urls)];
|
|
996
|
+
const body = uniqueUrls.map(
|
|
997
|
+
(url) => ` <url><loc>${xmlEscape2(canonicalUrl(manifest, url))}</loc></url>`
|
|
998
|
+
).join("\n");
|
|
999
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
1000
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
1001
|
+
${body}
|
|
1002
|
+
</urlset>
|
|
1003
|
+
`;
|
|
1004
|
+
}
|
|
1005
|
+
function createSitemapXmlRoute(manifest) {
|
|
1006
|
+
return async function GET() {
|
|
1007
|
+
return createCachedTextResponse({
|
|
1008
|
+
body: await sitemapXml(manifest),
|
|
1009
|
+
contentType: "application/xml; charset=utf-8"
|
|
1010
|
+
});
|
|
119
1011
|
};
|
|
120
1012
|
}
|
|
121
1013
|
|
|
122
1014
|
// src/resolvers/manifest-resolver.ts
|
|
123
1015
|
function findNodeInTree(nodes, id) {
|
|
124
1016
|
for (const node of nodes) {
|
|
125
|
-
if (node.
|
|
1017
|
+
if (node.type === "page") {
|
|
1018
|
+
if (node.fileID === id) return node;
|
|
1019
|
+
} else if (node.id === id) {
|
|
1020
|
+
return node;
|
|
1021
|
+
}
|
|
126
1022
|
if (node.type === "section" || node.type === "folder") {
|
|
127
1023
|
const found = findNodeInTree(node.children, id);
|
|
128
1024
|
if (found) return found;
|
|
@@ -133,7 +1029,7 @@ function findNodeInTree(nodes, id) {
|
|
|
133
1029
|
function pageNode(page) {
|
|
134
1030
|
return {
|
|
135
1031
|
type: "page",
|
|
136
|
-
|
|
1032
|
+
fileID: page.fileID,
|
|
137
1033
|
title: page.title,
|
|
138
1034
|
path: page.path,
|
|
139
1035
|
group: page.group,
|
|
@@ -165,7 +1061,7 @@ function resolveLeaf(manifest, group, slug) {
|
|
|
165
1061
|
return {
|
|
166
1062
|
site: manifest.site,
|
|
167
1063
|
tree: groupData.tree,
|
|
168
|
-
node: findNodeInTree(groupData.tree, page.
|
|
1064
|
+
node: findNodeInTree(groupData.tree, page.fileID) ?? pageNode(page),
|
|
169
1065
|
page,
|
|
170
1066
|
currentPath: page.path,
|
|
171
1067
|
group
|
|
@@ -193,75 +1089,6 @@ function listStaticParams(manifest, group) {
|
|
|
193
1089
|
return groupData.pages.map((page) => ({ slug: page.slug.split("/") }));
|
|
194
1090
|
}
|
|
195
1091
|
|
|
196
|
-
// src/routes/llms.ts
|
|
197
|
-
import { cacheLife, cacheTag } from "next/cache";
|
|
198
|
-
async function llmsTxt(manifest, scope = "root") {
|
|
199
|
-
"use cache";
|
|
200
|
-
cacheLife("page");
|
|
201
|
-
cacheTag(tags.site(), tags.llms(scope), tags.manifest(manifest.contentHash));
|
|
202
|
-
const pages = manifest.pages.filter(
|
|
203
|
-
(page) => page.status === "published" && (scope === "root" || page.group === scope)
|
|
204
|
-
);
|
|
205
|
-
const lines = pages.map((page) => `- [${page.title}](${page.path})`);
|
|
206
|
-
return `# ${manifest.site.title}
|
|
207
|
-
|
|
208
|
-
${lines.join("\n")}
|
|
209
|
-
`;
|
|
210
|
-
}
|
|
211
|
-
function createLlmsTxtRoute(manifest, options = {}) {
|
|
212
|
-
return async function GET() {
|
|
213
|
-
return new Response(await llmsTxt(manifest, options.scope), {
|
|
214
|
-
headers: { "content-type": "text/plain; charset=utf-8" }
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// src/routes/robots.ts
|
|
220
|
-
import { cacheLife as cacheLife2, cacheTag as cacheTag2 } from "next/cache";
|
|
221
|
-
async function robotsTxt(manifest) {
|
|
222
|
-
"use cache";
|
|
223
|
-
cacheLife2("page");
|
|
224
|
-
cacheTag2(tags.site(), tags.robots(), tags.manifest(manifest.contentHash));
|
|
225
|
-
return "User-agent: *\nAllow: /\nSitemap: /sitemap.xml\n";
|
|
226
|
-
}
|
|
227
|
-
function createRobotsTxtRoute(manifest) {
|
|
228
|
-
return async function GET() {
|
|
229
|
-
return new Response(await robotsTxt(manifest), {
|
|
230
|
-
headers: { "content-type": "text/plain; charset=utf-8" }
|
|
231
|
-
});
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// src/routes/sitemap.ts
|
|
236
|
-
import { cacheLife as cacheLife3, cacheTag as cacheTag3 } from "next/cache";
|
|
237
|
-
function xmlEscape(value) {
|
|
238
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
239
|
-
}
|
|
240
|
-
async function sitemapXml(manifest) {
|
|
241
|
-
"use cache";
|
|
242
|
-
cacheLife3("page");
|
|
243
|
-
cacheTag3(tags.site(), tags.sitemap(), tags.manifest(manifest.contentHash));
|
|
244
|
-
const urls = [
|
|
245
|
-
"/",
|
|
246
|
-
...Object.values(manifest.groups).map((g) => g.path),
|
|
247
|
-
...manifest.pages.filter((page) => page.status === "published").map((page) => page.path)
|
|
248
|
-
];
|
|
249
|
-
const uniqueUrls = [...new Set(urls)];
|
|
250
|
-
const body = uniqueUrls.map((url) => ` <url><loc>${xmlEscape(url)}</loc></url>`).join("\n");
|
|
251
|
-
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
252
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
253
|
-
${body}
|
|
254
|
-
</urlset>
|
|
255
|
-
`;
|
|
256
|
-
}
|
|
257
|
-
function createSitemapXmlRoute(manifest) {
|
|
258
|
-
return async function GET() {
|
|
259
|
-
return new Response(await sitemapXml(manifest), {
|
|
260
|
-
headers: { "content-type": "application/xml; charset=utf-8" }
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
|
|
265
1092
|
// src/utils/cn.ts
|
|
266
1093
|
import { clsx } from "clsx";
|
|
267
1094
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
@@ -283,17 +1110,110 @@ var twMerge = extendTailwindMerge({
|
|
|
283
1110
|
function cn(...inputs) {
|
|
284
1111
|
return twMerge(clsx(inputs));
|
|
285
1112
|
}
|
|
1113
|
+
|
|
1114
|
+
// src/utils/heading-ids.ts
|
|
1115
|
+
import { isValidElement } from "react";
|
|
1116
|
+
var SELF_CLOSING_TAG_RE = new RegExp("<[^>]+/>", "g");
|
|
1117
|
+
var PAIRED_TAG_RE = /<\/?\w[^>]*>/g;
|
|
1118
|
+
var MDX_BOLD_RE = /\*\*(.*?)\*\*/g;
|
|
1119
|
+
var MDX_ITALIC_RE = /\*(.*?)\*/g;
|
|
1120
|
+
var MDX_UNDERLINE_BOLD_RE = /__(.*?)__/g;
|
|
1121
|
+
var MDX_UNDERLINE_ITALIC_RE = /_(.*?)_/g;
|
|
1122
|
+
var MDX_STRIKETHROUGH_RE = /~~(.*?)~~/g;
|
|
1123
|
+
var MDX_INLINE_CODE_RE = /`(.*?)`/g;
|
|
1124
|
+
var MDX_LINK_RE = /\[(.*?)\]\(.*?\)/g;
|
|
1125
|
+
var NON_ALPHANUMERIC_RE = /[^a-z0-9]+/g;
|
|
1126
|
+
var LEADING_TRAILING_HYPHEN_RE = /^-+|-+$/g;
|
|
1127
|
+
var LEADING_DIGIT_RE = /^(\d)/;
|
|
1128
|
+
var HEADING_RE = /^(#{1,6})[ \t]+(.+?)\s*#*\s*$/gm;
|
|
1129
|
+
var FENCED_CODE_RE = /```[\s\S]*?```|~~~[\s\S]*?~~~/g;
|
|
1130
|
+
function extractText(node) {
|
|
1131
|
+
if (typeof node === "string") return node;
|
|
1132
|
+
if (typeof node === "number") return String(node);
|
|
1133
|
+
if (node == null || typeof node === "boolean") return "";
|
|
1134
|
+
if (Array.isArray(node)) {
|
|
1135
|
+
return node.map(extractText).join("");
|
|
1136
|
+
}
|
|
1137
|
+
if (isValidElement(node)) {
|
|
1138
|
+
const element = node;
|
|
1139
|
+
return element.props.children === void 0 ? "" : extractText(element.props.children);
|
|
1140
|
+
}
|
|
1141
|
+
return "";
|
|
1142
|
+
}
|
|
1143
|
+
function cleanHeadingText(input) {
|
|
1144
|
+
const text = typeof input === "string" ? input : extractText(input);
|
|
1145
|
+
return text.replace(SELF_CLOSING_TAG_RE, "").replace(PAIRED_TAG_RE, "").replace(MDX_BOLD_RE, "$1").replace(MDX_ITALIC_RE, "$1").replace(MDX_UNDERLINE_BOLD_RE, "$1").replace(MDX_UNDERLINE_ITALIC_RE, "$1").replace(MDX_STRIKETHROUGH_RE, "$1").replace(MDX_INLINE_CODE_RE, "$1").replace(MDX_LINK_RE, "$1").trim();
|
|
1146
|
+
}
|
|
1147
|
+
function slugify(text) {
|
|
1148
|
+
return text.toLowerCase().replace(NON_ALPHANUMERIC_RE, "-").replace(LEADING_TRAILING_HYPHEN_RE, "").replace(LEADING_DIGIT_RE, "id-$1");
|
|
1149
|
+
}
|
|
1150
|
+
function headingToHTMLId(input) {
|
|
1151
|
+
try {
|
|
1152
|
+
const id = slugify(cleanHeadingText(input));
|
|
1153
|
+
return id || "empty-heading";
|
|
1154
|
+
} catch {
|
|
1155
|
+
return "empty-heading";
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
function createHeadingIdGenerator() {
|
|
1159
|
+
const usedIds = /* @__PURE__ */ new Map();
|
|
1160
|
+
return (input) => {
|
|
1161
|
+
const baseId = headingToHTMLId(input);
|
|
1162
|
+
if (baseId === "empty-heading") return baseId;
|
|
1163
|
+
const count = usedIds.get(baseId) ?? 0;
|
|
1164
|
+
usedIds.set(baseId, count + 1);
|
|
1165
|
+
return count === 0 ? baseId : `${baseId}-${count}`;
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
function extractMdxHeadings(content = "", levels) {
|
|
1169
|
+
const [minDepth, maxDepth] = levels;
|
|
1170
|
+
const headingId = createHeadingIdGenerator();
|
|
1171
|
+
const headings = [];
|
|
1172
|
+
const searchableContent = content.replace(FENCED_CODE_RE, "");
|
|
1173
|
+
HEADING_RE.lastIndex = 0;
|
|
1174
|
+
while (true) {
|
|
1175
|
+
const match = HEADING_RE.exec(searchableContent);
|
|
1176
|
+
if (!match) break;
|
|
1177
|
+
const marker = match[1];
|
|
1178
|
+
const rawText = match[2];
|
|
1179
|
+
if (!marker || !rawText) continue;
|
|
1180
|
+
const level = marker.length;
|
|
1181
|
+
const text = cleanHeadingText(rawText);
|
|
1182
|
+
const id = headingId(rawText);
|
|
1183
|
+
if (!text || id === "empty-heading") continue;
|
|
1184
|
+
if (level < minDepth || level > maxDepth) continue;
|
|
1185
|
+
headings.push({ id, level, text });
|
|
1186
|
+
}
|
|
1187
|
+
return headings;
|
|
1188
|
+
}
|
|
1189
|
+
function urlIdToText(urlId) {
|
|
1190
|
+
try {
|
|
1191
|
+
if (typeof urlId !== "string") return "";
|
|
1192
|
+
return urlId.replace(/^id-/, "").replace(/-/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
1193
|
+
} catch {
|
|
1194
|
+
return "";
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
286
1197
|
export {
|
|
287
1198
|
PageList,
|
|
288
|
-
|
|
1199
|
+
cleanHeadingText,
|
|
289
1200
|
cn,
|
|
1201
|
+
createAtomFeedRoute,
|
|
1202
|
+
createHeadingIdGenerator,
|
|
1203
|
+
createJsonFeedRoute,
|
|
290
1204
|
createLlmsTxtRoute,
|
|
291
1205
|
createNextConfig,
|
|
1206
|
+
createOgImageRoute,
|
|
1207
|
+
createOgImageStaticParams,
|
|
292
1208
|
createRobotsTxtRoute,
|
|
1209
|
+
createRssFeedRoute,
|
|
293
1210
|
createSitemapXmlRoute,
|
|
1211
|
+
extractMdxHeadings,
|
|
1212
|
+
headingToHTMLId,
|
|
294
1213
|
listStaticParams,
|
|
295
1214
|
resolveGroup,
|
|
296
1215
|
resolveGroupLayout,
|
|
297
1216
|
resolveLeaf,
|
|
298
|
-
tags
|
|
1217
|
+
tags,
|
|
1218
|
+
urlIdToText
|
|
299
1219
|
};
|