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