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