@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/layouts/group.tsx
|
|
1
|
+
// src/kernel/routes/layouts/group.tsx
|
|
2
2
|
import { cacheLife, cacheTag } from "next/cache";
|
|
3
3
|
import { notFound } from "next/navigation";
|
|
4
4
|
|
|
@@ -48,14 +48,18 @@ var tags = {
|
|
|
48
48
|
},
|
|
49
49
|
llms(scope = "root") {
|
|
50
50
|
return assertTag(`llms:${safeSegment(scope)}`);
|
|
51
|
+
},
|
|
52
|
+
feed(format, scope = "site") {
|
|
53
|
+
return assertTag(`feed:${safeSegment(format)}:${safeSegment(scope)}`);
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
56
|
|
|
54
57
|
// src/internal/utils/logger.ts
|
|
55
58
|
var isDev = process.env.NODE_ENV !== "production";
|
|
59
|
+
var isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1";
|
|
56
60
|
var log = {
|
|
57
61
|
debug(...args) {
|
|
58
|
-
if (isDev) console.debug("[publish.os:debug]", ...args);
|
|
62
|
+
if (isDev && isDebugEnabled) console.debug("[publish.os:debug]", ...args);
|
|
59
63
|
},
|
|
60
64
|
info(...args) {
|
|
61
65
|
console.log("[publish.os]", ...args);
|
|
@@ -96,35 +100,55 @@ function resolveGroupLayout(manifest, group, children) {
|
|
|
96
100
|
return { ...resolved, children };
|
|
97
101
|
}
|
|
98
102
|
|
|
99
|
-
// src/layouts/group.tsx
|
|
103
|
+
// src/kernel/routes/layouts/group.tsx
|
|
100
104
|
import { jsx } from "react/jsx-runtime";
|
|
101
105
|
var manifests = /* @__PURE__ */ new Map();
|
|
102
|
-
var
|
|
103
|
-
async function CachedGroupLayoutData({
|
|
106
|
+
var layoutChains = /* @__PURE__ */ new Map();
|
|
107
|
+
async function CachedGroupLayoutData({
|
|
108
|
+
routeGroup,
|
|
109
|
+
layoutGroup
|
|
110
|
+
}) {
|
|
104
111
|
"use cache";
|
|
105
112
|
cacheLife("page");
|
|
106
|
-
cacheTag(tags.site(), tags.group(
|
|
107
|
-
const manifest = manifests.get(
|
|
113
|
+
cacheTag(tags.site(), tags.group(layoutGroup));
|
|
114
|
+
const manifest = manifests.get(routeGroup);
|
|
108
115
|
if (!manifest) notFound();
|
|
109
116
|
cacheTag(tags.manifest(manifest.contentHash));
|
|
110
|
-
log.debug("[cache]", `${
|
|
111
|
-
const resolved = resolveGroupLayout(manifest,
|
|
117
|
+
log.debug("[cache]", `${routeGroup}/layout:${layoutGroup}`);
|
|
118
|
+
const resolved = resolveGroupLayout(manifest, layoutGroup, null);
|
|
112
119
|
if (!resolved) notFound();
|
|
113
120
|
return resolved;
|
|
114
121
|
}
|
|
115
122
|
function createGroupLayout({
|
|
116
123
|
group,
|
|
117
124
|
manifest,
|
|
118
|
-
|
|
125
|
+
layouts
|
|
119
126
|
}) {
|
|
120
127
|
manifests.set(group, manifest);
|
|
121
|
-
|
|
128
|
+
layoutChains.set(group, layouts);
|
|
122
129
|
return async function GroupLayout({ children }) {
|
|
123
130
|
log.debug("[render]", `${group}/layout`);
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
126
|
-
const
|
|
127
|
-
|
|
131
|
+
const chain = layoutChains.get(group);
|
|
132
|
+
if (!chain?.length) notFound();
|
|
133
|
+
const resolvedLayouts = await Promise.all(
|
|
134
|
+
chain.map(async (item) => ({
|
|
135
|
+
item,
|
|
136
|
+
props: await CachedGroupLayoutData({
|
|
137
|
+
layoutGroup: item.group,
|
|
138
|
+
routeGroup: group
|
|
139
|
+
})
|
|
140
|
+
}))
|
|
141
|
+
);
|
|
142
|
+
let output = children;
|
|
143
|
+
for (let index = resolvedLayouts.length - 1; index >= 0; index -= 1) {
|
|
144
|
+
const resolvedLayout = resolvedLayouts[index];
|
|
145
|
+
if (resolvedLayout) {
|
|
146
|
+
const Layout = resolvedLayout.item.Layout;
|
|
147
|
+
const fontClassName = resolvedLayout.item.fontClassName;
|
|
148
|
+
output = /* @__PURE__ */ jsx(Layout, { ...resolvedLayout.props, children: fontClassName ? /* @__PURE__ */ jsx("div", { className: fontClassName, children: output }) : output });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return output;
|
|
128
152
|
};
|
|
129
153
|
}
|
|
130
154
|
export {
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/kernel/routes/metadata/feed.ts
|
|
21
|
+
var feed_exports = {};
|
|
22
|
+
__export(feed_exports, {
|
|
23
|
+
createAtomFeedRoute: () => createAtomFeedRoute,
|
|
24
|
+
createJsonFeedRoute: () => createJsonFeedRoute,
|
|
25
|
+
createPrecomputedFeedRoute: () => createPrecomputedFeedRoute,
|
|
26
|
+
createRssFeedRoute: () => createRssFeedRoute
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(feed_exports);
|
|
29
|
+
var import_cache = require("next/cache");
|
|
30
|
+
|
|
31
|
+
// src/cache/tags.ts
|
|
32
|
+
var import_node_crypto = require("crypto");
|
|
33
|
+
var MAX_TAG_LEN = 256;
|
|
34
|
+
var MAX_SEGMENT_LEN = 80;
|
|
35
|
+
var TAG_PATTERN = /^[a-z0-9:_./-]+$/;
|
|
36
|
+
function sha256(value) {
|
|
37
|
+
return (0, import_node_crypto.createHash)("sha256").update(value).digest("hex").slice(0, 16);
|
|
38
|
+
}
|
|
39
|
+
function safeSegment(value) {
|
|
40
|
+
const raw = value.trim().toLowerCase() || "root";
|
|
41
|
+
const normalized = raw.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\//, "").replace(/\/$/, "").replace(/[^a-z0-9:_./-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
42
|
+
const segment = normalized || "root";
|
|
43
|
+
if (segment.length <= MAX_SEGMENT_LEN) return segment;
|
|
44
|
+
return `${segment.slice(0, 48)}.${sha256(segment)}`;
|
|
45
|
+
}
|
|
46
|
+
function assertTag(tag) {
|
|
47
|
+
if (tag.length > MAX_TAG_LEN || !TAG_PATTERN.test(tag)) {
|
|
48
|
+
return `tag:${sha256(tag)}`;
|
|
49
|
+
}
|
|
50
|
+
return tag;
|
|
51
|
+
}
|
|
52
|
+
var tags = {
|
|
53
|
+
site() {
|
|
54
|
+
return "site";
|
|
55
|
+
},
|
|
56
|
+
pages() {
|
|
57
|
+
return "pages";
|
|
58
|
+
},
|
|
59
|
+
group(group) {
|
|
60
|
+
return assertTag(`group:${safeSegment(group)}`);
|
|
61
|
+
},
|
|
62
|
+
page(group, slug) {
|
|
63
|
+
const path = Array.isArray(slug) ? slug.join("/") : slug;
|
|
64
|
+
return assertTag(`page:${safeSegment(group)}:${safeSegment(path)}`);
|
|
65
|
+
},
|
|
66
|
+
manifest(contentHash) {
|
|
67
|
+
return assertTag(`manifest:${safeSegment(contentHash)}`);
|
|
68
|
+
},
|
|
69
|
+
sitemap() {
|
|
70
|
+
return "sitemap";
|
|
71
|
+
},
|
|
72
|
+
robots() {
|
|
73
|
+
return "robots";
|
|
74
|
+
},
|
|
75
|
+
llms(scope = "root") {
|
|
76
|
+
return assertTag(`llms:${safeSegment(scope)}`);
|
|
77
|
+
},
|
|
78
|
+
feed(format, scope = "site") {
|
|
79
|
+
return assertTag(`feed:${safeSegment(format)}:${safeSegment(scope)}`);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// src/kernel/routes/response.ts
|
|
84
|
+
var CACHE_CONTROL = "public, max-age=300, s-maxage=86400, stale-while-revalidate=3600, must-revalidate";
|
|
85
|
+
var CDN_CACHE_CONTROL = "public, max-age=2592000, stale-while-revalidate=31536000";
|
|
86
|
+
var SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate";
|
|
87
|
+
var SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
|
|
88
|
+
function cacheControl(policy) {
|
|
89
|
+
if (!policy || policy === "default") return CACHE_CONTROL;
|
|
90
|
+
if (policy === "short") return SHORT_CACHE_CONTROL;
|
|
91
|
+
return policy;
|
|
92
|
+
}
|
|
93
|
+
function cdnCacheControl(policy) {
|
|
94
|
+
if (!policy || policy === "default") return CDN_CACHE_CONTROL;
|
|
95
|
+
if (policy === "short") return SHORT_CDN_CACHE_CONTROL;
|
|
96
|
+
return policy;
|
|
97
|
+
}
|
|
98
|
+
function cachedTextHeaders(contentType, options = {}) {
|
|
99
|
+
const headers = new Headers(options.headers);
|
|
100
|
+
headers.set("cache-control", cacheControl(options.cachePolicy));
|
|
101
|
+
headers.set("cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
102
|
+
headers.set("vercel-cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
103
|
+
headers.set("content-type", contentType);
|
|
104
|
+
headers.set("x-content-type-options", "nosniff");
|
|
105
|
+
if (options.noindex) headers.set("x-robots-tag", "noindex");
|
|
106
|
+
return headers;
|
|
107
|
+
}
|
|
108
|
+
function createCachedTextResponse(options) {
|
|
109
|
+
const status = options.status ?? 200;
|
|
110
|
+
const method = options.method ?? "GET";
|
|
111
|
+
const headers = cachedTextHeaders(options.contentType, options);
|
|
112
|
+
return new Response(method === "HEAD" ? null : options.body, {
|
|
113
|
+
headers,
|
|
114
|
+
status
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/kernel/routes/metadata/canonical-url.ts
|
|
119
|
+
function canonicalUrl(manifest, path) {
|
|
120
|
+
const origin = manifest.site.url?.replace(/\/+$/, "");
|
|
121
|
+
if (!origin) return path;
|
|
122
|
+
try {
|
|
123
|
+
return new URL(path, `${origin}/`).toString();
|
|
124
|
+
} catch {
|
|
125
|
+
return path;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// src/kernel/routes/metadata/feed.ts
|
|
130
|
+
function xmlEscape(value) {
|
|
131
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
132
|
+
}
|
|
133
|
+
function pageTimestamp(page) {
|
|
134
|
+
const value = page.publishedAt ?? page.updatedAt;
|
|
135
|
+
if (!value) return -Infinity;
|
|
136
|
+
const timestamp = Date.parse(value);
|
|
137
|
+
return Number.isNaN(timestamp) ? -Infinity : timestamp;
|
|
138
|
+
}
|
|
139
|
+
function pageInScope(page, options) {
|
|
140
|
+
if (options.scope === "site" || !options.group) return true;
|
|
141
|
+
if (options.scope === "self") return page.group === options.group;
|
|
142
|
+
return page.group === options.group || page.group.startsWith(`${options.group}/`);
|
|
143
|
+
}
|
|
144
|
+
function feedPages(manifest, options) {
|
|
145
|
+
const statuses = options.status ?? ["published"];
|
|
146
|
+
const pages = manifest.pages.filter((page) => statuses.includes(page.status)).filter((page) => pageInScope(page, options)).sort((a, b) => pageTimestamp(b) - pageTimestamp(a));
|
|
147
|
+
return options.limit ? pages.slice(0, options.limit) : pages;
|
|
148
|
+
}
|
|
149
|
+
async function rssXml(manifest, options = {}) {
|
|
150
|
+
"use cache";
|
|
151
|
+
(0, import_cache.cacheLife)("page");
|
|
152
|
+
(0, import_cache.cacheTag)(
|
|
153
|
+
tags.site(),
|
|
154
|
+
tags.feed("rss", options.group ?? options.scope ?? "site"),
|
|
155
|
+
tags.manifest(manifest.contentHash)
|
|
156
|
+
);
|
|
157
|
+
const title = manifest.site.name;
|
|
158
|
+
const description = manifest.site.description ?? title;
|
|
159
|
+
const pages = feedPages(manifest, options);
|
|
160
|
+
const homeUrl = canonicalUrl(manifest, "/");
|
|
161
|
+
const items = pages.map((page) => {
|
|
162
|
+
const pageUrl = canonicalUrl(manifest, page.path);
|
|
163
|
+
const pubDate = page.publishedAt ? `
|
|
164
|
+
<pubDate>${xmlEscape(new Date(page.publishedAt).toUTCString())}</pubDate>` : "";
|
|
165
|
+
const description2 = page.description ? `
|
|
166
|
+
<description>${xmlEscape(page.description)}</description>` : "";
|
|
167
|
+
return ` <item>
|
|
168
|
+
<title>${xmlEscape(page.title)}</title>
|
|
169
|
+
<link>${xmlEscape(pageUrl)}</link>
|
|
170
|
+
<guid>${xmlEscape(pageUrl)}</guid>${pubDate}${description2}
|
|
171
|
+
</item>`;
|
|
172
|
+
}).join("\n");
|
|
173
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
174
|
+
<rss version="2.0">
|
|
175
|
+
<channel>
|
|
176
|
+
<title>${xmlEscape(title)}</title>
|
|
177
|
+
<link>${xmlEscape(homeUrl)}</link>
|
|
178
|
+
<description>${xmlEscape(description)}</description>
|
|
179
|
+
${items}
|
|
180
|
+
</channel>
|
|
181
|
+
</rss>
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
function pageDate(page) {
|
|
185
|
+
return page.publishedAt ?? page.updatedAt;
|
|
186
|
+
}
|
|
187
|
+
function latestFeedDate(pages) {
|
|
188
|
+
const timestamp = Math.max(0, ...pages.map((page) => pageTimestamp(page)));
|
|
189
|
+
return new Date(timestamp).toISOString();
|
|
190
|
+
}
|
|
191
|
+
async function atomXml(manifest, options = {}) {
|
|
192
|
+
"use cache";
|
|
193
|
+
(0, import_cache.cacheLife)("page");
|
|
194
|
+
(0, import_cache.cacheTag)(
|
|
195
|
+
tags.site(),
|
|
196
|
+
tags.feed("atom", options.group ?? options.scope ?? "site"),
|
|
197
|
+
tags.manifest(manifest.contentHash)
|
|
198
|
+
);
|
|
199
|
+
const title = manifest.site.name;
|
|
200
|
+
const pages = feedPages(manifest, options);
|
|
201
|
+
const homeUrl = canonicalUrl(manifest, "/");
|
|
202
|
+
const entries = pages.map((page) => {
|
|
203
|
+
const date = pageDate(page);
|
|
204
|
+
const updated = date ? new Date(date).toISOString() : latestFeedDate([]);
|
|
205
|
+
const pageUrl = canonicalUrl(manifest, page.path);
|
|
206
|
+
const summary = page.description ? `
|
|
207
|
+
<summary>${xmlEscape(page.description)}</summary>` : "";
|
|
208
|
+
return ` <entry>
|
|
209
|
+
<title>${xmlEscape(page.title)}</title>
|
|
210
|
+
<id>${xmlEscape(pageUrl)}</id>
|
|
211
|
+
<link href="${xmlEscape(pageUrl)}" />
|
|
212
|
+
<updated>${xmlEscape(updated)}</updated>${summary}
|
|
213
|
+
</entry>`;
|
|
214
|
+
}).join("\n");
|
|
215
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
216
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
217
|
+
<title>${xmlEscape(title)}</title>
|
|
218
|
+
<id>${xmlEscape(homeUrl)}</id>
|
|
219
|
+
<updated>${xmlEscape(latestFeedDate(pages))}</updated>
|
|
220
|
+
${entries}
|
|
221
|
+
</feed>
|
|
222
|
+
`;
|
|
223
|
+
}
|
|
224
|
+
async function jsonFeed(manifest, options = {}) {
|
|
225
|
+
"use cache";
|
|
226
|
+
(0, import_cache.cacheLife)("page");
|
|
227
|
+
(0, import_cache.cacheTag)(
|
|
228
|
+
tags.site(),
|
|
229
|
+
tags.feed("json", options.group ?? options.scope ?? "site"),
|
|
230
|
+
tags.manifest(manifest.contentHash)
|
|
231
|
+
);
|
|
232
|
+
const pages = feedPages(manifest, options);
|
|
233
|
+
return `${JSON.stringify(
|
|
234
|
+
{
|
|
235
|
+
version: "https://jsonfeed.org/version/1.1",
|
|
236
|
+
title: manifest.site.name,
|
|
237
|
+
description: manifest.site.description,
|
|
238
|
+
home_page_url: canonicalUrl(manifest, "/"),
|
|
239
|
+
items: pages.map((page) => ({
|
|
240
|
+
id: canonicalUrl(manifest, page.path),
|
|
241
|
+
url: canonicalUrl(manifest, page.path),
|
|
242
|
+
title: page.title,
|
|
243
|
+
summary: page.description,
|
|
244
|
+
content_text: page.body,
|
|
245
|
+
date_published: page.publishedAt,
|
|
246
|
+
date_modified: page.updatedAt,
|
|
247
|
+
tags: page.tags
|
|
248
|
+
}))
|
|
249
|
+
},
|
|
250
|
+
null,
|
|
251
|
+
2
|
|
252
|
+
)}
|
|
253
|
+
`;
|
|
254
|
+
}
|
|
255
|
+
function createRssFeedRoute(manifest, options = {}) {
|
|
256
|
+
return async function GET() {
|
|
257
|
+
return createCachedTextResponse({
|
|
258
|
+
body: await rssXml(manifest, options),
|
|
259
|
+
contentType: "application/rss+xml; charset=utf-8"
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function createAtomFeedRoute(manifest, options = {}) {
|
|
264
|
+
return async function GET() {
|
|
265
|
+
return createCachedTextResponse({
|
|
266
|
+
body: await atomXml(manifest, options),
|
|
267
|
+
contentType: "application/atom+xml; charset=utf-8"
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function createJsonFeedRoute(manifest, options = {}) {
|
|
272
|
+
return async function GET() {
|
|
273
|
+
return createCachedTextResponse({
|
|
274
|
+
body: await jsonFeed(manifest, options),
|
|
275
|
+
contentType: "application/feed+json; charset=utf-8"
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function createPrecomputedFeedRoute(output) {
|
|
280
|
+
return function GET() {
|
|
281
|
+
return createCachedTextResponse({
|
|
282
|
+
body: output.body,
|
|
283
|
+
contentType: output.contentType
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
288
|
+
0 && (module.exports = {
|
|
289
|
+
createAtomFeedRoute,
|
|
290
|
+
createJsonFeedRoute,
|
|
291
|
+
createPrecomputedFeedRoute,
|
|
292
|
+
createRssFeedRoute
|
|
293
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ManifestLike, PageStatus } from '../../../types.cjs';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
type FeedScope = "site" | "group" | "self";
|
|
5
|
+
type FeedRouteOptions = {
|
|
6
|
+
scope?: FeedScope;
|
|
7
|
+
group?: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
status?: PageStatus[];
|
|
10
|
+
};
|
|
11
|
+
type PrecomputedFeedOutput = {
|
|
12
|
+
body: string;
|
|
13
|
+
contentType: string;
|
|
14
|
+
};
|
|
15
|
+
declare function createRssFeedRoute(manifest: ManifestLike, options?: FeedRouteOptions): () => Promise<Response>;
|
|
16
|
+
declare function createAtomFeedRoute(manifest: ManifestLike, options?: FeedRouteOptions): () => Promise<Response>;
|
|
17
|
+
declare function createJsonFeedRoute(manifest: ManifestLike, options?: FeedRouteOptions): () => Promise<Response>;
|
|
18
|
+
declare function createPrecomputedFeedRoute(output: PrecomputedFeedOutput): () => Response;
|
|
19
|
+
|
|
20
|
+
export { type FeedRouteOptions, type FeedScope, type PrecomputedFeedOutput, createAtomFeedRoute, createJsonFeedRoute, createPrecomputedFeedRoute, createRssFeedRoute };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ManifestLike, PageStatus } from '../../../types.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
type FeedScope = "site" | "group" | "self";
|
|
5
|
+
type FeedRouteOptions = {
|
|
6
|
+
scope?: FeedScope;
|
|
7
|
+
group?: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
status?: PageStatus[];
|
|
10
|
+
};
|
|
11
|
+
type PrecomputedFeedOutput = {
|
|
12
|
+
body: string;
|
|
13
|
+
contentType: string;
|
|
14
|
+
};
|
|
15
|
+
declare function createRssFeedRoute(manifest: ManifestLike, options?: FeedRouteOptions): () => Promise<Response>;
|
|
16
|
+
declare function createAtomFeedRoute(manifest: ManifestLike, options?: FeedRouteOptions): () => Promise<Response>;
|
|
17
|
+
declare function createJsonFeedRoute(manifest: ManifestLike, options?: FeedRouteOptions): () => Promise<Response>;
|
|
18
|
+
declare function createPrecomputedFeedRoute(output: PrecomputedFeedOutput): () => Response;
|
|
19
|
+
|
|
20
|
+
export { type FeedRouteOptions, type FeedScope, type PrecomputedFeedOutput, createAtomFeedRoute, createJsonFeedRoute, createPrecomputedFeedRoute, createRssFeedRoute };
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
// src/kernel/routes/metadata/feed.ts
|
|
2
|
+
import { cacheLife, cacheTag } from "next/cache";
|
|
3
|
+
|
|
4
|
+
// src/cache/tags.ts
|
|
5
|
+
import { createHash } from "crypto";
|
|
6
|
+
var MAX_TAG_LEN = 256;
|
|
7
|
+
var MAX_SEGMENT_LEN = 80;
|
|
8
|
+
var TAG_PATTERN = /^[a-z0-9:_./-]+$/;
|
|
9
|
+
function sha256(value) {
|
|
10
|
+
return createHash("sha256").update(value).digest("hex").slice(0, 16);
|
|
11
|
+
}
|
|
12
|
+
function safeSegment(value) {
|
|
13
|
+
const raw = value.trim().toLowerCase() || "root";
|
|
14
|
+
const normalized = raw.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\//, "").replace(/\/$/, "").replace(/[^a-z0-9:_./-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
15
|
+
const segment = normalized || "root";
|
|
16
|
+
if (segment.length <= MAX_SEGMENT_LEN) return segment;
|
|
17
|
+
return `${segment.slice(0, 48)}.${sha256(segment)}`;
|
|
18
|
+
}
|
|
19
|
+
function assertTag(tag) {
|
|
20
|
+
if (tag.length > MAX_TAG_LEN || !TAG_PATTERN.test(tag)) {
|
|
21
|
+
return `tag:${sha256(tag)}`;
|
|
22
|
+
}
|
|
23
|
+
return tag;
|
|
24
|
+
}
|
|
25
|
+
var tags = {
|
|
26
|
+
site() {
|
|
27
|
+
return "site";
|
|
28
|
+
},
|
|
29
|
+
pages() {
|
|
30
|
+
return "pages";
|
|
31
|
+
},
|
|
32
|
+
group(group) {
|
|
33
|
+
return assertTag(`group:${safeSegment(group)}`);
|
|
34
|
+
},
|
|
35
|
+
page(group, slug) {
|
|
36
|
+
const path = Array.isArray(slug) ? slug.join("/") : slug;
|
|
37
|
+
return assertTag(`page:${safeSegment(group)}:${safeSegment(path)}`);
|
|
38
|
+
},
|
|
39
|
+
manifest(contentHash) {
|
|
40
|
+
return assertTag(`manifest:${safeSegment(contentHash)}`);
|
|
41
|
+
},
|
|
42
|
+
sitemap() {
|
|
43
|
+
return "sitemap";
|
|
44
|
+
},
|
|
45
|
+
robots() {
|
|
46
|
+
return "robots";
|
|
47
|
+
},
|
|
48
|
+
llms(scope = "root") {
|
|
49
|
+
return assertTag(`llms:${safeSegment(scope)}`);
|
|
50
|
+
},
|
|
51
|
+
feed(format, scope = "site") {
|
|
52
|
+
return assertTag(`feed:${safeSegment(format)}:${safeSegment(scope)}`);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/kernel/routes/response.ts
|
|
57
|
+
var CACHE_CONTROL = "public, max-age=300, s-maxage=86400, stale-while-revalidate=3600, must-revalidate";
|
|
58
|
+
var CDN_CACHE_CONTROL = "public, max-age=2592000, stale-while-revalidate=31536000";
|
|
59
|
+
var SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate";
|
|
60
|
+
var SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
|
|
61
|
+
function cacheControl(policy) {
|
|
62
|
+
if (!policy || policy === "default") return CACHE_CONTROL;
|
|
63
|
+
if (policy === "short") return SHORT_CACHE_CONTROL;
|
|
64
|
+
return policy;
|
|
65
|
+
}
|
|
66
|
+
function cdnCacheControl(policy) {
|
|
67
|
+
if (!policy || policy === "default") return CDN_CACHE_CONTROL;
|
|
68
|
+
if (policy === "short") return SHORT_CDN_CACHE_CONTROL;
|
|
69
|
+
return policy;
|
|
70
|
+
}
|
|
71
|
+
function cachedTextHeaders(contentType, options = {}) {
|
|
72
|
+
const headers = new Headers(options.headers);
|
|
73
|
+
headers.set("cache-control", cacheControl(options.cachePolicy));
|
|
74
|
+
headers.set("cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
75
|
+
headers.set("vercel-cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
76
|
+
headers.set("content-type", contentType);
|
|
77
|
+
headers.set("x-content-type-options", "nosniff");
|
|
78
|
+
if (options.noindex) headers.set("x-robots-tag", "noindex");
|
|
79
|
+
return headers;
|
|
80
|
+
}
|
|
81
|
+
function createCachedTextResponse(options) {
|
|
82
|
+
const status = options.status ?? 200;
|
|
83
|
+
const method = options.method ?? "GET";
|
|
84
|
+
const headers = cachedTextHeaders(options.contentType, options);
|
|
85
|
+
return new Response(method === "HEAD" ? null : options.body, {
|
|
86
|
+
headers,
|
|
87
|
+
status
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// src/kernel/routes/metadata/canonical-url.ts
|
|
92
|
+
function canonicalUrl(manifest, path) {
|
|
93
|
+
const origin = manifest.site.url?.replace(/\/+$/, "");
|
|
94
|
+
if (!origin) return path;
|
|
95
|
+
try {
|
|
96
|
+
return new URL(path, `${origin}/`).toString();
|
|
97
|
+
} catch {
|
|
98
|
+
return path;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/kernel/routes/metadata/feed.ts
|
|
103
|
+
function xmlEscape(value) {
|
|
104
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
105
|
+
}
|
|
106
|
+
function pageTimestamp(page) {
|
|
107
|
+
const value = page.publishedAt ?? page.updatedAt;
|
|
108
|
+
if (!value) return -Infinity;
|
|
109
|
+
const timestamp = Date.parse(value);
|
|
110
|
+
return Number.isNaN(timestamp) ? -Infinity : timestamp;
|
|
111
|
+
}
|
|
112
|
+
function pageInScope(page, options) {
|
|
113
|
+
if (options.scope === "site" || !options.group) return true;
|
|
114
|
+
if (options.scope === "self") return page.group === options.group;
|
|
115
|
+
return page.group === options.group || page.group.startsWith(`${options.group}/`);
|
|
116
|
+
}
|
|
117
|
+
function feedPages(manifest, options) {
|
|
118
|
+
const statuses = options.status ?? ["published"];
|
|
119
|
+
const pages = manifest.pages.filter((page) => statuses.includes(page.status)).filter((page) => pageInScope(page, options)).sort((a, b) => pageTimestamp(b) - pageTimestamp(a));
|
|
120
|
+
return options.limit ? pages.slice(0, options.limit) : pages;
|
|
121
|
+
}
|
|
122
|
+
async function rssXml(manifest, options = {}) {
|
|
123
|
+
"use cache";
|
|
124
|
+
cacheLife("page");
|
|
125
|
+
cacheTag(
|
|
126
|
+
tags.site(),
|
|
127
|
+
tags.feed("rss", options.group ?? options.scope ?? "site"),
|
|
128
|
+
tags.manifest(manifest.contentHash)
|
|
129
|
+
);
|
|
130
|
+
const title = manifest.site.name;
|
|
131
|
+
const description = manifest.site.description ?? title;
|
|
132
|
+
const pages = feedPages(manifest, options);
|
|
133
|
+
const homeUrl = canonicalUrl(manifest, "/");
|
|
134
|
+
const items = pages.map((page) => {
|
|
135
|
+
const pageUrl = canonicalUrl(manifest, page.path);
|
|
136
|
+
const pubDate = page.publishedAt ? `
|
|
137
|
+
<pubDate>${xmlEscape(new Date(page.publishedAt).toUTCString())}</pubDate>` : "";
|
|
138
|
+
const description2 = page.description ? `
|
|
139
|
+
<description>${xmlEscape(page.description)}</description>` : "";
|
|
140
|
+
return ` <item>
|
|
141
|
+
<title>${xmlEscape(page.title)}</title>
|
|
142
|
+
<link>${xmlEscape(pageUrl)}</link>
|
|
143
|
+
<guid>${xmlEscape(pageUrl)}</guid>${pubDate}${description2}
|
|
144
|
+
</item>`;
|
|
145
|
+
}).join("\n");
|
|
146
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
147
|
+
<rss version="2.0">
|
|
148
|
+
<channel>
|
|
149
|
+
<title>${xmlEscape(title)}</title>
|
|
150
|
+
<link>${xmlEscape(homeUrl)}</link>
|
|
151
|
+
<description>${xmlEscape(description)}</description>
|
|
152
|
+
${items}
|
|
153
|
+
</channel>
|
|
154
|
+
</rss>
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
function pageDate(page) {
|
|
158
|
+
return page.publishedAt ?? page.updatedAt;
|
|
159
|
+
}
|
|
160
|
+
function latestFeedDate(pages) {
|
|
161
|
+
const timestamp = Math.max(0, ...pages.map((page) => pageTimestamp(page)));
|
|
162
|
+
return new Date(timestamp).toISOString();
|
|
163
|
+
}
|
|
164
|
+
async function atomXml(manifest, options = {}) {
|
|
165
|
+
"use cache";
|
|
166
|
+
cacheLife("page");
|
|
167
|
+
cacheTag(
|
|
168
|
+
tags.site(),
|
|
169
|
+
tags.feed("atom", options.group ?? options.scope ?? "site"),
|
|
170
|
+
tags.manifest(manifest.contentHash)
|
|
171
|
+
);
|
|
172
|
+
const title = manifest.site.name;
|
|
173
|
+
const pages = feedPages(manifest, options);
|
|
174
|
+
const homeUrl = canonicalUrl(manifest, "/");
|
|
175
|
+
const entries = pages.map((page) => {
|
|
176
|
+
const date = pageDate(page);
|
|
177
|
+
const updated = date ? new Date(date).toISOString() : latestFeedDate([]);
|
|
178
|
+
const pageUrl = canonicalUrl(manifest, page.path);
|
|
179
|
+
const summary = page.description ? `
|
|
180
|
+
<summary>${xmlEscape(page.description)}</summary>` : "";
|
|
181
|
+
return ` <entry>
|
|
182
|
+
<title>${xmlEscape(page.title)}</title>
|
|
183
|
+
<id>${xmlEscape(pageUrl)}</id>
|
|
184
|
+
<link href="${xmlEscape(pageUrl)}" />
|
|
185
|
+
<updated>${xmlEscape(updated)}</updated>${summary}
|
|
186
|
+
</entry>`;
|
|
187
|
+
}).join("\n");
|
|
188
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
189
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
190
|
+
<title>${xmlEscape(title)}</title>
|
|
191
|
+
<id>${xmlEscape(homeUrl)}</id>
|
|
192
|
+
<updated>${xmlEscape(latestFeedDate(pages))}</updated>
|
|
193
|
+
${entries}
|
|
194
|
+
</feed>
|
|
195
|
+
`;
|
|
196
|
+
}
|
|
197
|
+
async function jsonFeed(manifest, options = {}) {
|
|
198
|
+
"use cache";
|
|
199
|
+
cacheLife("page");
|
|
200
|
+
cacheTag(
|
|
201
|
+
tags.site(),
|
|
202
|
+
tags.feed("json", options.group ?? options.scope ?? "site"),
|
|
203
|
+
tags.manifest(manifest.contentHash)
|
|
204
|
+
);
|
|
205
|
+
const pages = feedPages(manifest, options);
|
|
206
|
+
return `${JSON.stringify(
|
|
207
|
+
{
|
|
208
|
+
version: "https://jsonfeed.org/version/1.1",
|
|
209
|
+
title: manifest.site.name,
|
|
210
|
+
description: manifest.site.description,
|
|
211
|
+
home_page_url: canonicalUrl(manifest, "/"),
|
|
212
|
+
items: pages.map((page) => ({
|
|
213
|
+
id: canonicalUrl(manifest, page.path),
|
|
214
|
+
url: canonicalUrl(manifest, page.path),
|
|
215
|
+
title: page.title,
|
|
216
|
+
summary: page.description,
|
|
217
|
+
content_text: page.body,
|
|
218
|
+
date_published: page.publishedAt,
|
|
219
|
+
date_modified: page.updatedAt,
|
|
220
|
+
tags: page.tags
|
|
221
|
+
}))
|
|
222
|
+
},
|
|
223
|
+
null,
|
|
224
|
+
2
|
|
225
|
+
)}
|
|
226
|
+
`;
|
|
227
|
+
}
|
|
228
|
+
function createRssFeedRoute(manifest, options = {}) {
|
|
229
|
+
return async function GET() {
|
|
230
|
+
return createCachedTextResponse({
|
|
231
|
+
body: await rssXml(manifest, options),
|
|
232
|
+
contentType: "application/rss+xml; charset=utf-8"
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function createAtomFeedRoute(manifest, options = {}) {
|
|
237
|
+
return async function GET() {
|
|
238
|
+
return createCachedTextResponse({
|
|
239
|
+
body: await atomXml(manifest, options),
|
|
240
|
+
contentType: "application/atom+xml; charset=utf-8"
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function createJsonFeedRoute(manifest, options = {}) {
|
|
245
|
+
return async function GET() {
|
|
246
|
+
return createCachedTextResponse({
|
|
247
|
+
body: await jsonFeed(manifest, options),
|
|
248
|
+
contentType: "application/feed+json; charset=utf-8"
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function createPrecomputedFeedRoute(output) {
|
|
253
|
+
return function GET() {
|
|
254
|
+
return createCachedTextResponse({
|
|
255
|
+
body: output.body,
|
|
256
|
+
contentType: output.contentType
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
export {
|
|
261
|
+
createAtomFeedRoute,
|
|
262
|
+
createJsonFeedRoute,
|
|
263
|
+
createPrecomputedFeedRoute,
|
|
264
|
+
createRssFeedRoute
|
|
265
|
+
};
|