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