@publish.os/nextjs 0.0.1-alpha.5 → 0.0.1-alpha.7
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 -5
- package/compiler-assets/nextjs/defaults/app/globals.css +6 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +23 -0
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +48 -0
- package/compiler-assets/nextjs/defaults/group/page.tsx +50 -0
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +45 -0
- package/compiler-assets/nextjs/defaults/project/postcss.config.mjs +5 -0
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +41 -0
- package/compiler-assets/nextjs/defaults/root/css/animation.css +90 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/drawer.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +25 -0
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +17 -0
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/toast.css +19 -0
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +15 -0
- package/compiler-assets/nextjs/defaults/root/css/layout.css +22 -0
- package/compiler-assets/nextjs/defaults/root/css/media.css +81 -0
- package/compiler-assets/nextjs/defaults/root/css/radius.css +49 -0
- package/compiler-assets/nextjs/defaults/root/css/scrollbar.css +43 -0
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +145 -0
- package/compiler-assets/nextjs/defaults/root/css/typography.css +607 -0
- package/compiler-assets/nextjs/defaults/root/css/zindex.css +39 -0
- package/compiler-assets/nextjs/defaults/root/globals.css +191 -0
- package/compiler-assets/nextjs/defaults/root/layout.tsx +19 -0
- package/compiler-assets/nextjs/defaults/root/page.tsx +61 -0
- package/compiler-assets/nextjs/defaults/root/theme.css +50 -0
- package/compiler-assets/nextjs/defaults/source/_internal/logger.ts +21 -0
- package/compiler-assets/nextjs/shims/generated-group-layout.tsx +19 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +18 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +21 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +134 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +29 -0
- package/compiler-assets/nextjs/shims/og-image-route.ts +18 -0
- package/compiler-assets/nextjs/shims/powered-by-footer.tsx +40 -0
- package/compiler-assets/nextjs/shims/providers.tsx +13 -0
- package/compiler-assets/nextjs/shims/proxy.ts +317 -0
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +77 -0
- package/compiler-assets/nextjs/shims/root-page.tsx +13 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +177 -0
- package/dist/{kernel/components/ui/button.d.cts → button-CFdx-ohV.d.ts} +1 -3
- package/dist/cache/tags.js +6 -14
- package/dist/compiler.d.ts +100 -0
- package/dist/compiler.js +13379 -0
- package/dist/config/createNextConfig.d.ts +2 -1
- package/dist/config/createNextConfig.js +16 -12
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/index.d.ts +303 -15
- package/dist/index.js +30 -1196
- package/dist/kernel/components/blocks/AgentActions.d.ts +9 -3
- package/dist/kernel/components/blocks/AgentActions.js +114 -200
- package/dist/kernel/components/blocks/animated-icon-swap.js +4 -25
- package/dist/kernel/components/blocks/color-palette.js +107 -157
- package/dist/kernel/components/blocks/design-system-preview.d.ts +38 -6
- package/dist/kernel/components/blocks/design-system-preview.js +44 -52
- package/dist/kernel/components/blocks/link-playground.js +23 -71
- package/dist/kernel/components/blocks/logo-block.js +19 -48
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +28 -52
- package/dist/kernel/components/blocks/navbar.d.ts +1 -1
- package/dist/kernel/components/blocks/navbar.js +14 -41
- package/dist/kernel/components/blocks/navigation-progress-playground.js +56 -149
- package/dist/kernel/components/blocks/navigation-progress.js +53 -157
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +16 -42
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +11 -16
- package/dist/kernel/components/blocks/search.d.ts +13 -2
- package/dist/kernel/components/blocks/search.js +116 -247
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +56 -95
- package/dist/kernel/components/blocks/sidebar.d.ts +5 -23
- package/dist/kernel/components/blocks/sidebar.js +35 -103
- package/dist/kernel/components/blocks/theme-toggle.d.ts +7 -3
- package/dist/kernel/components/blocks/theme-toggle.js +2 -2
- package/dist/kernel/components/blocks/toc.js +42 -178
- package/dist/kernel/components/mdx/components/blockquote.js +3 -24
- package/dist/kernel/components/mdx/components/callout.d.ts +1 -1
- package/dist/kernel/components/mdx/components/callout.js +15 -47
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/figure-caption.js +6 -24
- package/dist/kernel/components/mdx/components/figure.js +9 -36
- package/dist/kernel/components/mdx/components/footnotes.js +3 -24
- package/dist/kernel/components/mdx/components/heading-copy-link.js +13 -37
- package/dist/kernel/components/mdx/components/heading.d.ts +8 -3
- package/dist/kernel/components/mdx/components/heading.js +32 -116
- package/dist/kernel/components/mdx/components/hr.d.ts +5 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -3
- package/dist/kernel/components/mdx/components/image.js +23 -63
- package/dist/kernel/components/mdx/components/inline-code.js +3 -24
- package/dist/kernel/components/mdx/components/kbd.d.ts +9 -4
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +1 -2
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +13 -41
- package/dist/kernel/components/mdx/components/pre.js +3 -24
- package/dist/kernel/components/mdx/components/strikethrough.js +6 -24
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +6 -28
- package/dist/kernel/components/mdx/components/video-player.js +53 -88
- package/dist/kernel/components/mdx/components/video.js +27 -75
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/error-boundary.js +12 -15
- package/dist/kernel/components/mdx/error-fallback.js +4 -4
- package/dist/kernel/components/mdx/mdx.d.ts +68 -11
- package/dist/kernel/components/mdx/mdx.js +29 -29
- package/dist/kernel/components/mdx/rehype-heading-ids.js +11 -67
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/ui/accordion.js +3 -26
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +26 -8
- package/dist/kernel/components/ui/breadcrumb-trail.js +32 -79
- package/dist/kernel/components/ui/breadcrumb.d.ts +2 -6
- package/dist/kernel/components/ui/breadcrumb.js +21 -70
- package/dist/kernel/components/ui/button-group.d.ts +4 -3
- package/dist/kernel/components/ui/button-group.js +7 -30
- package/dist/kernel/components/ui/button.js +13 -36
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/card.js +2 -23
- package/dist/kernel/components/ui/dialog.d.ts +9 -9
- package/dist/kernel/components/ui/dialog.js +15 -33
- package/dist/kernel/components/ui/drawer.d.ts +10 -10
- package/dist/kernel/components/ui/drawer.js +15 -33
- package/dist/kernel/components/ui/input.js +6 -30
- package/dist/kernel/components/ui/kbd.js +10 -31
- package/dist/kernel/components/ui/link.d.ts +1 -1
- package/dist/kernel/components/ui/link.js +53 -104
- package/dist/kernel/components/ui/menu.d.ts +21 -21
- package/dist/kernel/components/ui/menu.js +14 -36
- package/dist/kernel/components/ui/meta-key.d.ts +9 -4
- package/dist/kernel/components/ui/meta-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +14 -14
- package/dist/kernel/components/ui/navigation-menu.js +9 -30
- package/dist/kernel/components/ui/popover.d.ts +10 -10
- package/dist/kernel/components/ui/popover.js +13 -34
- package/dist/kernel/components/ui/progress.js +2 -25
- package/dist/kernel/components/ui/scroll-area.js +39 -118
- package/dist/kernel/components/ui/select.d.ts +15 -15
- package/dist/kernel/components/ui/select.js +19 -35
- package/dist/kernel/components/ui/separator.js +2 -25
- package/dist/kernel/components/ui/table.js +2 -23
- package/dist/kernel/components/ui/tabs.js +39 -99
- package/dist/kernel/components/ui/tag.d.ts +2 -2
- package/dist/kernel/components/ui/tag.js +4 -25
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +112 -131
- package/dist/kernel/components/ui/theme-toggle.d.ts +18 -4
- package/dist/kernel/components/ui/theme-toggle.js +18 -44
- package/dist/kernel/components/ui/toast.d.ts +10 -10
- package/dist/kernel/components/ui/toast.js +13 -35
- package/dist/kernel/components/ui/tooltip.d.ts +8 -8
- package/dist/kernel/components/ui/tooltip.js +9 -30
- package/dist/kernel/defaults.registry.d.ts +61 -70
- package/dist/kernel/defaults.registry.js +61 -69
- package/dist/kernel/framework-icons.d.ts +1 -0
- package/dist/kernel/framework-icons.js +39 -0
- package/dist/kernel/routes/agent/markdown.js +36 -65
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +20 -109
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +46 -127
- package/dist/kernel/routes/metadata/llms.d.ts +1 -2
- package/dist/kernel/routes/metadata/llms.js +42 -120
- package/dist/kernel/routes/metadata/og-image.d.ts +11 -1
- package/dist/kernel/routes/metadata/og-image.js +264 -198
- package/dist/kernel/routes/metadata/robots.d.ts +1 -2
- package/dist/kernel/routes/metadata/robots.js +21 -90
- package/dist/kernel/routes/metadata/sitemap.d.ts +1 -2
- package/dist/kernel/routes/metadata/sitemap.js +36 -102
- package/dist/kernel/routes/pages/group.d.ts +1 -1
- package/dist/kernel/routes/pages/group.js +42 -137
- package/dist/kernel/routes/pages/leaf.d.ts +1 -1
- package/dist/kernel/routes/pages/leaf.js +74 -213
- package/dist/kernel/routes/pages/root.d.ts +1 -1
- package/dist/kernel/routes/pages/root.js +37 -108
- package/dist/keyboard-shortcuts.js +69 -141
- package/dist/{kernel/components/ui/link.d.cts → link-CYaCRDb6.d.ts} +9 -5
- package/dist/resolvers/manifest-resolver.d.ts +3 -3
- package/dist/resolvers/manifest-resolver.js +15 -21
- package/dist/{kernel/routes/metadata/og-image.d.cts → route-metadata-og-image-BeKKFHg7.d.ts} +12 -16
- package/dist/search.d.ts +81 -4
- package/dist/search.js +124 -195
- package/dist/{kernel/components/blocks/sidebar.d.cts → sidebar-types-Bgchdfd6.d.ts} +2 -10
- package/dist/theme-scope.d.ts +15 -0
- package/dist/theme-scope.js +23 -0
- package/dist/types-B_b3C0U6.d.ts +63 -0
- package/dist/types-CIwwieNw.d.ts +127 -0
- package/dist/types-DHBm7-j6.d.ts +57 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +0 -1
- package/dist/types.js +1 -1
- package/dist/utils/cn.d.ts +5 -9
- package/dist/utils/cn.js +13 -7
- package/dist/utils/heading-ids.js +20 -47
- package/dist/utils/pretty-date.js +7 -13
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.png +0 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +54 -0
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +31 -0
- package/init/seed/minimal/publish.os/docs/content/theme.mdx +64 -0
- package/init/seed/minimal/publish.os/publish.os.config.json +21 -0
- package/init/seed/minimal/publish.os/theme.css +47 -0
- package/init/seed/minimal/seed.json +13 -0
- package/package.json +470 -40
- package/release/{package.json → app/lucide/package.json} +14 -7
- package/release/app/lucide/pnpm-lock.yaml.template +2905 -0
- package/release/app/lucide/pnpm-workspace.yaml +11 -0
- package/release/app/phosphor/package.json +30 -0
- package/release/app/phosphor/pnpm-lock.yaml.template +2908 -0
- package/release/app/phosphor/pnpm-workspace.yaml +11 -0
- package/release/app/tabler/package.json +30 -0
- package/release/app/tabler/pnpm-lock.yaml.template +2911 -0
- package/release/app/tabler/pnpm-workspace.yaml +11 -0
- package/release/compiler/package.json +20 -0
- package/release/compiler/pnpm-lock.yaml.template +2432 -0
- package/release/compiler/pnpm-workspace.yaml +11 -0
- package/release/release.json +31 -7
- package/dist/cache/tags.cjs +0 -79
- package/dist/cache/tags.d.cts +0 -13
- package/dist/config/createNextConfig.cjs +0 -52
- package/dist/config/createNextConfig.d.cts +0 -8
- package/dist/config.cjs +0 -78
- package/dist/config.d.cts +0 -101
- package/dist/config.d.ts +0 -101
- package/dist/config.js +0 -48
- package/dist/index.cjs +0 -1266
- package/dist/index.d.cts +0 -18
- package/dist/kernel/components/blocks/AgentActions.cjs +0 -425
- package/dist/kernel/components/blocks/AgentActions.d.cts +0 -52
- package/dist/kernel/components/blocks/animated-icon-swap.cjs +0 -101
- package/dist/kernel/components/blocks/animated-icon-swap.d.cts +0 -16
- package/dist/kernel/components/blocks/color-palette.cjs +0 -413
- package/dist/kernel/components/blocks/color-palette.d.cts +0 -7
- package/dist/kernel/components/blocks/design-system-preview.cjs +0 -593
- package/dist/kernel/components/blocks/design-system-preview.d.cts +0 -29
- package/dist/kernel/components/blocks/link-playground.cjs +0 -816
- package/dist/kernel/components/blocks/link-playground.d.cts +0 -5
- package/dist/kernel/components/blocks/logo-block.cjs +0 -156
- package/dist/kernel/components/blocks/logo-block.d.cts +0 -21
- package/dist/kernel/components/blocks/nav-breadcrumb.cjs +0 -122
- package/dist/kernel/components/blocks/nav-breadcrumb.d.cts +0 -11
- package/dist/kernel/components/blocks/navbar.cjs +0 -154
- package/dist/kernel/components/blocks/navbar.d.cts +0 -16
- package/dist/kernel/components/blocks/navigation-progress-playground.cjs +0 -735
- package/dist/kernel/components/blocks/navigation-progress-playground.d.cts +0 -5
- package/dist/kernel/components/blocks/navigation-progress.cjs +0 -270
- package/dist/kernel/components/blocks/navigation-progress.d.cts +0 -16
- package/dist/kernel/components/blocks/next-prev.cjs +0 -142
- package/dist/kernel/components/blocks/next-prev.d.cts +0 -11
- package/dist/kernel/components/blocks/page-list.cjs +0 -59
- package/dist/kernel/components/blocks/page-list.d.cts +0 -11
- package/dist/kernel/components/blocks/search.cjs +0 -717
- package/dist/kernel/components/blocks/search.d.cts +0 -77
- package/dist/kernel/components/blocks/sidebar-node.cjs +0 -309
- package/dist/kernel/components/blocks/sidebar-node.d.cts +0 -8
- package/dist/kernel/components/blocks/sidebar.cjs +0 -317
- package/dist/kernel/components/blocks/theme-toggle.cjs +0 -31
- package/dist/kernel/components/blocks/theme-toggle.d.cts +0 -6
- package/dist/kernel/components/blocks/toc.cjs +0 -356
- package/dist/kernel/components/blocks/toc.d.cts +0 -10
- package/dist/kernel/components/mdx/components/blockquote.cjs +0 -66
- package/dist/kernel/components/mdx/components/blockquote.d.cts +0 -6
- package/dist/kernel/components/mdx/components/callout.cjs +0 -137
- package/dist/kernel/components/mdx/components/callout.d.cts +0 -18
- package/dist/kernel/components/mdx/components/code-block.cjs +0 -39
- package/dist/kernel/components/mdx/components/code-block.d.cts +0 -9
- package/dist/kernel/components/mdx/components/figure-caption.cjs +0 -63
- package/dist/kernel/components/mdx/components/figure-caption.d.cts +0 -6
- package/dist/kernel/components/mdx/components/figure.cjs +0 -78
- package/dist/kernel/components/mdx/components/figure.d.cts +0 -10
- package/dist/kernel/components/mdx/components/footnotes.cjs +0 -66
- package/dist/kernel/components/mdx/components/footnotes.d.cts +0 -6
- package/dist/kernel/components/mdx/components/heading-copy-link.cjs +0 -108
- package/dist/kernel/components/mdx/components/heading-copy-link.d.cts +0 -23
- package/dist/kernel/components/mdx/components/heading.cjs +0 -166
- package/dist/kernel/components/mdx/components/heading.d.cts +0 -8
- package/dist/kernel/components/mdx/components/hr.cjs +0 -34
- package/dist/kernel/components/mdx/components/hr.d.cts +0 -9
- package/dist/kernel/components/mdx/components/image-zoom.cjs +0 -49
- package/dist/kernel/components/mdx/components/image-zoom.d.cts +0 -10
- package/dist/kernel/components/mdx/components/image.cjs +0 -192
- package/dist/kernel/components/mdx/components/image.d.cts +0 -21
- package/dist/kernel/components/mdx/components/inline-code.cjs +0 -66
- package/dist/kernel/components/mdx/components/inline-code.d.cts +0 -6
- package/dist/kernel/components/mdx/components/kbd.cjs +0 -34
- package/dist/kernel/components/mdx/components/kbd.d.cts +0 -10
- package/dist/kernel/components/mdx/components/link.cjs +0 -49
- package/dist/kernel/components/mdx/components/link.d.cts +0 -11
- package/dist/kernel/components/mdx/components/paragraph.cjs +0 -87
- package/dist/kernel/components/mdx/components/paragraph.d.cts +0 -5
- package/dist/kernel/components/mdx/components/pre.cjs +0 -66
- package/dist/kernel/components/mdx/components/pre.d.cts +0 -6
- package/dist/kernel/components/mdx/components/strikethrough.cjs +0 -63
- package/dist/kernel/components/mdx/components/strikethrough.d.cts +0 -6
- package/dist/kernel/components/mdx/components/table.cjs +0 -59
- package/dist/kernel/components/mdx/components/table.d.cts +0 -10
- package/dist/kernel/components/mdx/components/task-list.cjs +0 -88
- package/dist/kernel/components/mdx/components/task-list.d.cts +0 -8
- package/dist/kernel/components/mdx/components/video-player.cjs +0 -173
- package/dist/kernel/components/mdx/components/video-player.d.cts +0 -18
- package/dist/kernel/components/mdx/components/video.cjs +0 -185
- package/dist/kernel/components/mdx/components/video.d.cts +0 -15
- package/dist/kernel/components/mdx/error-boundary.cjs +0 -62
- package/dist/kernel/components/mdx/error-boundary.d.cts +0 -8
- package/dist/kernel/components/mdx/error-fallback.cjs +0 -58
- package/dist/kernel/components/mdx/error-fallback.d.cts +0 -9
- package/dist/kernel/components/mdx/mdx.cjs +0 -141
- package/dist/kernel/components/mdx/mdx.d.cts +0 -22
- package/dist/kernel/components/mdx/rehype-heading-ids.cjs +0 -113
- package/dist/kernel/components/mdx/rehype-heading-ids.d.cts +0 -10
- package/dist/kernel/components/mdx/types.cjs +0 -18
- package/dist/kernel/components/mdx/types.d.cts +0 -18
- package/dist/kernel/components/ui/accordion.cjs +0 -104
- package/dist/kernel/components/ui/accordion.d.cts +0 -16
- package/dist/kernel/components/ui/breadcrumb-trail.cjs +0 -238
- package/dist/kernel/components/ui/breadcrumb-trail.d.cts +0 -13
- package/dist/kernel/components/ui/breadcrumb.cjs +0 -399
- package/dist/kernel/components/ui/breadcrumb.d.cts +0 -52
- package/dist/kernel/components/ui/button-group.cjs +0 -143
- package/dist/kernel/components/ui/button-group.d.cts +0 -19
- package/dist/kernel/components/ui/button.cjs +0 -139
- package/dist/kernel/components/ui/card.cjs +0 -133
- package/dist/kernel/components/ui/card.d.cts +0 -17
- package/dist/kernel/components/ui/dialog.cjs +0 -149
- package/dist/kernel/components/ui/dialog.d.cts +0 -22
- package/dist/kernel/components/ui/drawer.cjs +0 -163
- package/dist/kernel/components/ui/drawer.d.cts +0 -24
- package/dist/kernel/components/ui/input.cjs +0 -96
- package/dist/kernel/components/ui/input.d.cts +0 -18
- package/dist/kernel/components/ui/kbd.cjs +0 -105
- package/dist/kernel/components/ui/kbd.d.cts +0 -13
- package/dist/kernel/components/ui/link.cjs +0 -253
- package/dist/kernel/components/ui/menu.cjs +0 -301
- package/dist/kernel/components/ui/menu.d.cts +0 -70
- package/dist/kernel/components/ui/meta-key.cjs +0 -34
- package/dist/kernel/components/ui/meta-key.d.cts +0 -12
- package/dist/kernel/components/ui/navigation-menu.cjs +0 -253
- package/dist/kernel/components/ui/navigation-menu.d.cts +0 -47
- package/dist/kernel/components/ui/popover.cjs +0 -168
- package/dist/kernel/components/ui/popover.d.cts +0 -24
- package/dist/kernel/components/ui/progress.cjs +0 -112
- package/dist/kernel/components/ui/progress.d.cts +0 -16
- package/dist/kernel/components/ui/scroll-area.cjs +0 -413
- package/dist/kernel/components/ui/scroll-area.d.cts +0 -58
- package/dist/kernel/components/ui/select.cjs +0 -244
- package/dist/kernel/components/ui/select.d.cts +0 -40
- package/dist/kernel/components/ui/separator.cjs +0 -73
- package/dist/kernel/components/ui/separator.d.cts +0 -8
- package/dist/kernel/components/ui/table.cjs +0 -131
- package/dist/kernel/components/ui/table.d.cts +0 -11
- package/dist/kernel/components/ui/tabs.cjs +0 -450
- package/dist/kernel/components/ui/tabs.d.cts +0 -82
- package/dist/kernel/components/ui/tag.cjs +0 -104
- package/dist/kernel/components/ui/tag.d.cts +0 -14
- package/dist/kernel/components/ui/text.cjs +0 -184
- package/dist/kernel/components/ui/text.d.cts +0 -17
- package/dist/kernel/components/ui/theme-toggle.cjs +0 -108
- package/dist/kernel/components/ui/theme-toggle.d.cts +0 -10
- package/dist/kernel/components/ui/toast.cjs +0 -154
- package/dist/kernel/components/ui/toast.d.cts +0 -26
- package/dist/kernel/components/ui/tooltip.cjs +0 -127
- package/dist/kernel/components/ui/tooltip.d.cts +0 -20
- package/dist/kernel/defaults.registry.cjs +0 -541
- package/dist/kernel/defaults.registry.d.cts +0 -469
- package/dist/kernel/routes/agent/markdown.cjs +0 -202
- package/dist/kernel/routes/agent/markdown.d.cts +0 -58
- package/dist/kernel/routes/layouts/group.cjs +0 -181
- package/dist/kernel/routes/layouts/group.d.cts +0 -20
- package/dist/kernel/routes/metadata/feed.cjs +0 -293
- package/dist/kernel/routes/metadata/feed.d.cts +0 -20
- package/dist/kernel/routes/metadata/llms.cjs +0 -239
- package/dist/kernel/routes/metadata/llms.d.cts +0 -26
- package/dist/kernel/routes/metadata/og-image.cjs +0 -630
- package/dist/kernel/routes/metadata/robots.cjs +0 -148
- package/dist/kernel/routes/metadata/robots.d.cts +0 -6
- package/dist/kernel/routes/metadata/sitemap.cjs +0 -192
- package/dist/kernel/routes/metadata/sitemap.d.cts +0 -8
- package/dist/kernel/routes/pages/group.cjs +0 -263
- package/dist/kernel/routes/pages/group.d.cts +0 -17
- package/dist/kernel/routes/pages/leaf.cjs +0 -421
- package/dist/kernel/routes/pages/leaf.d.cts +0 -36
- package/dist/kernel/routes/pages/root.cjs +0 -229
- package/dist/kernel/routes/pages/root.d.cts +0 -16
- package/dist/keyboard-shortcuts.cjs +0 -345
- package/dist/keyboard-shortcuts.d.cts +0 -34
- package/dist/resolvers/manifest-resolver.cjs +0 -111
- package/dist/resolvers/manifest-resolver.d.cts +0 -13
- package/dist/search.cjs +0 -411
- package/dist/search.d.cts +0 -20
- package/dist/types.cjs +0 -30
- package/dist/types.d.cts +0 -269
- package/dist/utils/cn.cjs +0 -49
- package/dist/utils/cn.d.cts +0 -15
- package/dist/utils/heading-ids.cjs +0 -119
- package/dist/utils/heading-ids.d.cts +0 -15
- package/dist/utils/pretty-date.cjs +0 -55
- package/dist/utils/pretty-date.d.cts +0 -6
- package/release/pnpm-lock.yaml +0 -1215
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
var isDev = process.env.NODE_ENV !== "production"
|
|
3
|
-
var isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1";
|
|
4
|
-
var log = {
|
|
1
|
+
// src/lib/runtime/logging/logger.ts
|
|
2
|
+
var isDev = process.env.NODE_ENV !== "production", isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1", log = {
|
|
5
3
|
debug(...args) {
|
|
6
|
-
|
|
4
|
+
isDev && isDebugEnabled && console.debug("[publish.os:debug]", ...args);
|
|
7
5
|
},
|
|
8
6
|
info(...args) {
|
|
9
7
|
console.log("[publish.os]", ...args);
|
|
@@ -16,42 +14,27 @@ var log = {
|
|
|
16
14
|
}
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
// src/
|
|
20
|
-
var CACHE_CONTROL = "public, max-age=300, s-maxage=
|
|
21
|
-
var CDN_CACHE_CONTROL = "public, max-age=2592000, stale-while-revalidate=31536000";
|
|
22
|
-
var SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate";
|
|
23
|
-
var SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
|
|
17
|
+
// src/lib/runtime/response/cached-text-response.ts
|
|
18
|
+
var CACHE_CONTROL = "public, max-age=300, s-maxage=3600, stale-while-revalidate=3600, must-revalidate", CDN_CACHE_CONTROL = "public, max-age=3600, stale-while-revalidate=3600, must-revalidate", SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate", SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
|
|
24
19
|
function cacheControl(policy) {
|
|
25
|
-
|
|
26
|
-
if (policy === "short") return SHORT_CACHE_CONTROL;
|
|
27
|
-
return policy;
|
|
20
|
+
return !policy || policy === "default" ? CACHE_CONTROL : policy === "short" ? SHORT_CACHE_CONTROL : policy;
|
|
28
21
|
}
|
|
29
22
|
function cdnCacheControl(policy) {
|
|
30
|
-
|
|
31
|
-
if (policy === "short") return SHORT_CDN_CACHE_CONTROL;
|
|
32
|
-
return policy;
|
|
23
|
+
return !policy || policy === "default" ? CDN_CACHE_CONTROL : policy === "short" ? SHORT_CDN_CACHE_CONTROL : policy;
|
|
33
24
|
}
|
|
34
25
|
function cachedTextHeaders(contentType, options = {}) {
|
|
35
|
-
|
|
36
|
-
headers.set("cache-control", cacheControl(options.cachePolicy));
|
|
37
|
-
headers.set("cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
38
|
-
headers.set("vercel-cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
39
|
-
headers.set("content-type", contentType);
|
|
40
|
-
headers.set("x-content-type-options", "nosniff");
|
|
41
|
-
if (options.noindex) headers.set("x-robots-tag", "noindex");
|
|
42
|
-
return headers;
|
|
26
|
+
let headers = new Headers(options.headers);
|
|
27
|
+
return headers.set("cache-control", cacheControl(options.cachePolicy)), headers.set("cdn-cache-control", cdnCacheControl(options.cachePolicy)), headers.set("vercel-cdn-cache-control", cdnCacheControl(options.cachePolicy)), headers.set("content-type", contentType), headers.set("x-content-type-options", "nosniff"), options.noindex && headers.set("x-robots-tag", "noindex"), headers;
|
|
43
28
|
}
|
|
44
29
|
function createCachedTextResponse(options) {
|
|
45
|
-
|
|
46
|
-
const method = options.method ?? "GET";
|
|
47
|
-
const headers = cachedTextHeaders(options.contentType, options);
|
|
30
|
+
let status = options.status ?? 200, method = options.method ?? "GET", headers = cachedTextHeaders(options.contentType, options);
|
|
48
31
|
return new Response(method === "HEAD" ? null : options.body, {
|
|
49
32
|
headers,
|
|
50
33
|
status
|
|
51
34
|
});
|
|
52
35
|
}
|
|
53
36
|
|
|
54
|
-
// src/
|
|
37
|
+
// src/route-agent-markdown.ts
|
|
55
38
|
var DEFAULT_DISCOVERY_LINKS = {
|
|
56
39
|
home: "/",
|
|
57
40
|
llms: "/llms.txt",
|
|
@@ -61,17 +44,12 @@ function debugMarkdownResponse(details) {
|
|
|
61
44
|
log.debug("[agent-route]", "md-response", details);
|
|
62
45
|
}
|
|
63
46
|
function normalizeArtifactPath(parts) {
|
|
64
|
-
|
|
65
|
-
if (parts.some((part) => part === ".." || part.includes("\0"))) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
return `/${parts.join("/")}`.replace(/\/+/g, "/");
|
|
47
|
+
return parts?.length ? parts.some((part) => part === ".." || part.includes("\0")) ? null : `/${parts.join("/")}`.replace(/\/+/g, "/") : "/index.md";
|
|
69
48
|
}
|
|
70
49
|
function findArtifactKey(artifacts, artifactPath) {
|
|
71
50
|
if (artifacts[artifactPath]) return artifactPath;
|
|
72
|
-
|
|
51
|
+
let suffixedPath = artifactPath.endsWith(".md") ? artifactPath : `${artifactPath}.md`;
|
|
73
52
|
if (artifacts[suffixedPath]) return suffixedPath;
|
|
74
|
-
return void 0;
|
|
75
53
|
}
|
|
76
54
|
function findArtifact(artifacts, artifactPath) {
|
|
77
55
|
return artifacts[artifactPath] ?? artifacts[artifactPath.endsWith(".md") ? artifactPath : `${artifactPath}.md`];
|
|
@@ -85,68 +63,62 @@ function markdownHeaders(artifact) {
|
|
|
85
63
|
};
|
|
86
64
|
}
|
|
87
65
|
function markdown404Body(discoveryLinks) {
|
|
88
|
-
const links = [
|
|
89
|
-
discoveryLinks.home ? `> Home: ${discoveryLinks.home}` : void 0,
|
|
90
|
-
discoveryLinks.sitemap ? `> Sitemap: ${discoveryLinks.sitemap}` : void 0,
|
|
91
|
-
discoveryLinks.llms ? `> LLMS index: ${discoveryLinks.llms}` : void 0
|
|
92
|
-
].filter((line) => Boolean(line));
|
|
93
66
|
return [
|
|
94
67
|
"# Not found",
|
|
95
68
|
"",
|
|
96
|
-
...
|
|
69
|
+
...[
|
|
70
|
+
discoveryLinks.home ? `> Home: ${discoveryLinks.home}` : void 0,
|
|
71
|
+
discoveryLinks.sitemap ? `> Sitemap: ${discoveryLinks.sitemap}` : void 0,
|
|
72
|
+
discoveryLinks.llms ? `> LLMS index: ${discoveryLinks.llms}` : void 0
|
|
73
|
+
].filter((line) => !!line),
|
|
97
74
|
"",
|
|
98
75
|
"The requested Markdown page was not found.",
|
|
99
76
|
""
|
|
100
|
-
].join(
|
|
77
|
+
].join(`
|
|
78
|
+
`);
|
|
101
79
|
}
|
|
102
80
|
function notFoundResponse(method, discoveryLinks, artifactPath, reason) {
|
|
103
|
-
debugMarkdownResponse({
|
|
81
|
+
return debugMarkdownResponse({
|
|
104
82
|
artifactPath,
|
|
105
83
|
method,
|
|
106
84
|
reason,
|
|
107
85
|
status: 404
|
|
108
|
-
})
|
|
109
|
-
return createCachedTextResponse({
|
|
86
|
+
}), createCachedTextResponse({
|
|
110
87
|
body: markdown404Body(discoveryLinks),
|
|
111
88
|
cachePolicy: "short",
|
|
112
89
|
contentType: "text/markdown; charset=utf-8",
|
|
113
90
|
method,
|
|
114
|
-
noindex:
|
|
91
|
+
noindex: !0,
|
|
115
92
|
status: 404
|
|
116
93
|
});
|
|
117
94
|
}
|
|
118
95
|
async function markdownResponse(artifacts, discoveryLinks, method, context) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (!artifactPath) {
|
|
96
|
+
let params = await Promise.resolve(context.params), artifactPath = normalizeArtifactPath(params?.path);
|
|
97
|
+
if (!artifactPath)
|
|
122
98
|
return notFoundResponse(method, discoveryLinks, void 0, "invalid-path");
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (!artifactKey) {
|
|
99
|
+
let artifactKey = findArtifactKey(artifacts.index, artifactPath);
|
|
100
|
+
if (!artifactKey)
|
|
126
101
|
return notFoundResponse(
|
|
127
102
|
method,
|
|
128
103
|
discoveryLinks,
|
|
129
104
|
artifactPath,
|
|
130
105
|
"missing-index"
|
|
131
106
|
);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (!artifact) {
|
|
107
|
+
let artifact = await artifacts.loadArtifact(artifactKey);
|
|
108
|
+
if (!artifact)
|
|
135
109
|
return notFoundResponse(
|
|
136
110
|
method,
|
|
137
111
|
discoveryLinks,
|
|
138
112
|
artifactPath,
|
|
139
113
|
"missing-shard"
|
|
140
114
|
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
debugMarkdownResponse({
|
|
115
|
+
let { contentType, headers } = markdownHeaders(artifact);
|
|
116
|
+
return debugMarkdownResponse({
|
|
144
117
|
artifactPath: artifact.markdownPath,
|
|
145
118
|
contentType,
|
|
146
119
|
method,
|
|
147
120
|
status: 200
|
|
148
|
-
})
|
|
149
|
-
return createCachedTextResponse({
|
|
121
|
+
}), createCachedTextResponse({
|
|
150
122
|
body: artifact.body,
|
|
151
123
|
contentType,
|
|
152
124
|
headers,
|
|
@@ -155,17 +127,16 @@ async function markdownResponse(artifacts, discoveryLinks, method, context) {
|
|
|
155
127
|
});
|
|
156
128
|
}
|
|
157
129
|
function createMarkdownRouteHandlers(artifacts, options = {}) {
|
|
158
|
-
|
|
130
|
+
let discoveryLinks = {
|
|
159
131
|
...DEFAULT_DISCOVERY_LINKS,
|
|
160
132
|
...options.discoveryLinks
|
|
161
133
|
};
|
|
162
|
-
const generateStaticParams = () => Object.keys(artifacts.index).map((artifactPath) => ({
|
|
163
|
-
path: artifactPath.replace(/^\//, "").replace(/\.md$/, "").split("/")
|
|
164
|
-
}));
|
|
165
134
|
return {
|
|
166
135
|
GET: (_request, context) => markdownResponse(artifacts, discoveryLinks, "GET", context),
|
|
167
136
|
HEAD: (_request, context) => markdownResponse(artifacts, discoveryLinks, "HEAD", context),
|
|
168
|
-
generateStaticParams
|
|
137
|
+
generateStaticParams: () => Object.keys(artifacts.index).map((artifactPath) => ({
|
|
138
|
+
path: artifactPath.replace(/^\//, "").replace(/\.md$/, "").split("/")
|
|
139
|
+
}))
|
|
169
140
|
};
|
|
170
141
|
}
|
|
171
142
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { ManifestLike, LayoutProps } from '../../../types.js';
|
|
3
|
+
import { M as ManifestLike, L as LayoutProps } from '../../../types-CIwwieNw.js';
|
|
4
4
|
|
|
5
5
|
type LayoutComponent = (props: LayoutProps) => ReactElement | Promise<ReactElement>;
|
|
6
6
|
type GroupLayoutConfig = {
|
|
@@ -1,65 +1,13 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/route-layout-group.tsx
|
|
2
|
+
import { tags } from "@publish.os/nextjs/cache/tags";
|
|
3
|
+
import { resolveGroupLayout } from "@publish.os/nextjs/resolvers/manifest-resolver";
|
|
2
4
|
import { cacheLife, cacheTag } from "next/cache";
|
|
3
5
|
import { notFound } from "next/navigation";
|
|
4
6
|
|
|
5
|
-
// src/
|
|
6
|
-
|
|
7
|
-
var MAX_TAG_LEN = 256;
|
|
8
|
-
var MAX_SEGMENT_LEN = 80;
|
|
9
|
-
var TAG_PATTERN = /^[a-z0-9:_./-]+$/;
|
|
10
|
-
function sha256(value) {
|
|
11
|
-
return createHash("sha256").update(value).digest("hex").slice(0, 16);
|
|
12
|
-
}
|
|
13
|
-
function safeSegment(value) {
|
|
14
|
-
const raw = value.trim().toLowerCase() || "root";
|
|
15
|
-
const normalized = raw.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\//, "").replace(/\/$/, "").replace(/[^a-z0-9:_./-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
16
|
-
const segment = normalized || "root";
|
|
17
|
-
if (segment.length <= MAX_SEGMENT_LEN) return segment;
|
|
18
|
-
return `${segment.slice(0, 48)}.${sha256(segment)}`;
|
|
19
|
-
}
|
|
20
|
-
function assertTag(tag) {
|
|
21
|
-
if (tag.length > MAX_TAG_LEN || !TAG_PATTERN.test(tag)) {
|
|
22
|
-
return `tag:${sha256(tag)}`;
|
|
23
|
-
}
|
|
24
|
-
return tag;
|
|
25
|
-
}
|
|
26
|
-
var tags = {
|
|
27
|
-
site() {
|
|
28
|
-
return "site";
|
|
29
|
-
},
|
|
30
|
-
pages() {
|
|
31
|
-
return "pages";
|
|
32
|
-
},
|
|
33
|
-
group(group) {
|
|
34
|
-
return assertTag(`group:${safeSegment(group)}`);
|
|
35
|
-
},
|
|
36
|
-
page(group, slug) {
|
|
37
|
-
const path = Array.isArray(slug) ? slug.join("/") : slug;
|
|
38
|
-
return assertTag(`page:${safeSegment(group)}:${safeSegment(path)}`);
|
|
39
|
-
},
|
|
40
|
-
manifest(contentHash) {
|
|
41
|
-
return assertTag(`manifest:${safeSegment(contentHash)}`);
|
|
42
|
-
},
|
|
43
|
-
sitemap() {
|
|
44
|
-
return "sitemap";
|
|
45
|
-
},
|
|
46
|
-
robots() {
|
|
47
|
-
return "robots";
|
|
48
|
-
},
|
|
49
|
-
llms(scope = "root") {
|
|
50
|
-
return assertTag(`llms:${safeSegment(scope)}`);
|
|
51
|
-
},
|
|
52
|
-
feed(format, scope = "site") {
|
|
53
|
-
return assertTag(`feed:${safeSegment(format)}:${safeSegment(scope)}`);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/internal/utils/logger.ts
|
|
58
|
-
var isDev = process.env.NODE_ENV !== "production";
|
|
59
|
-
var isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1";
|
|
60
|
-
var log = {
|
|
7
|
+
// src/lib/runtime/logging/logger.ts
|
|
8
|
+
var isDev = process.env.NODE_ENV !== "production", isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1", log = {
|
|
61
9
|
debug(...args) {
|
|
62
|
-
|
|
10
|
+
isDev && isDebugEnabled && console.debug("[publish.os:debug]", ...args);
|
|
63
11
|
},
|
|
64
12
|
info(...args) {
|
|
65
13
|
console.log("[publish.os]", ...args);
|
|
@@ -72,65 +20,30 @@ var log = {
|
|
|
72
20
|
}
|
|
73
21
|
};
|
|
74
22
|
|
|
75
|
-
// src/
|
|
76
|
-
function groupNode(group) {
|
|
77
|
-
return {
|
|
78
|
-
type: "section",
|
|
79
|
-
id: group.key,
|
|
80
|
-
title: group.title,
|
|
81
|
-
path: group.path,
|
|
82
|
-
group: group.key,
|
|
83
|
-
children: group.tree
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function resolveGroup(manifest, group) {
|
|
87
|
-
const groupData = manifest.groups[group];
|
|
88
|
-
if (!groupData) return null;
|
|
89
|
-
return {
|
|
90
|
-
site: manifest.site,
|
|
91
|
-
tree: groupData.tree,
|
|
92
|
-
node: groupNode(groupData),
|
|
93
|
-
currentPath: groupData.path,
|
|
94
|
-
group
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function resolveGroupLayout(manifest, group, children) {
|
|
98
|
-
const resolved = resolveGroup(manifest, group);
|
|
99
|
-
if (!resolved) return null;
|
|
100
|
-
return { ...resolved, children };
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// src/kernel/routes/layouts/group.tsx
|
|
23
|
+
// src/route-layout-group.tsx
|
|
104
24
|
import { jsx } from "react/jsx-runtime";
|
|
105
|
-
var manifests = /* @__PURE__ */ new Map();
|
|
106
|
-
var layoutChains = /* @__PURE__ */ new Map();
|
|
25
|
+
var manifests = /* @__PURE__ */ new Map(), layoutChains = /* @__PURE__ */ new Map();
|
|
107
26
|
async function CachedGroupLayoutData({
|
|
108
27
|
routeGroup,
|
|
109
28
|
layoutGroup
|
|
110
29
|
}) {
|
|
111
30
|
"use cache";
|
|
112
|
-
cacheLife("page");
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
log.debug("[cache]", `${routeGroup}/layout:${layoutGroup}`);
|
|
118
|
-
const resolved = resolveGroupLayout(manifest, layoutGroup, null);
|
|
119
|
-
if (!resolved) notFound();
|
|
120
|
-
return resolved;
|
|
31
|
+
cacheLife("page"), cacheTag(tags.site(), tags.group(layoutGroup));
|
|
32
|
+
let manifest = manifests.get(routeGroup);
|
|
33
|
+
manifest || notFound(), cacheTag(tags.manifest(manifest.contentHash)), log.debug("[cache]", `${routeGroup}/layout:${layoutGroup}`);
|
|
34
|
+
let resolved = resolveGroupLayout(manifest, layoutGroup, null);
|
|
35
|
+
return resolved || notFound(), resolved;
|
|
121
36
|
}
|
|
122
37
|
function createGroupLayout({
|
|
123
38
|
group,
|
|
124
39
|
manifest,
|
|
125
40
|
layouts
|
|
126
41
|
}) {
|
|
127
|
-
manifests.set(group, manifest)
|
|
128
|
-
layoutChains.set(group, layouts);
|
|
129
|
-
return async function GroupLayout({ children }) {
|
|
42
|
+
return manifests.set(group, manifest), layoutChains.set(group, layouts), async function({ children }) {
|
|
130
43
|
log.debug("[render]", `${group}/layout`);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
44
|
+
let chain = layoutChains.get(group);
|
|
45
|
+
chain?.length || notFound();
|
|
46
|
+
let resolvedLayouts = await Promise.all(
|
|
134
47
|
chain.map(async (item) => ({
|
|
135
48
|
item,
|
|
136
49
|
props: await CachedGroupLayoutData({
|
|
@@ -138,13 +51,11 @@ function createGroupLayout({
|
|
|
138
51
|
routeGroup: group
|
|
139
52
|
})
|
|
140
53
|
}))
|
|
141
|
-
);
|
|
142
|
-
let output = children;
|
|
54
|
+
), output = children;
|
|
143
55
|
for (let index = resolvedLayouts.length - 1; index >= 0; index -= 1) {
|
|
144
|
-
|
|
56
|
+
let resolvedLayout = resolvedLayouts[index];
|
|
145
57
|
if (resolvedLayout) {
|
|
146
|
-
|
|
147
|
-
const fontClassName = resolvedLayout.item.fontClassName;
|
|
58
|
+
let Layout = resolvedLayout.item.Layout, fontClassName = resolvedLayout.item.fontClassName;
|
|
148
59
|
output = /* @__PURE__ */ jsx(Layout, { ...resolvedLayout.props, children: fontClassName ? /* @__PURE__ */ jsx("div", { className: fontClassName, children: output }) : output });
|
|
149
60
|
}
|
|
150
61
|
}
|
|
@@ -1,148 +1,74 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/route-metadata-feed.ts
|
|
2
|
+
import { tags } from "@publish.os/nextjs/cache/tags";
|
|
2
3
|
import { cacheLife, cacheTag } from "next/cache";
|
|
3
4
|
|
|
4
|
-
// src/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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)}`;
|
|
5
|
+
// src/lib/runtime/metadata/canonical-url.ts
|
|
6
|
+
function canonicalUrl(manifest, path) {
|
|
7
|
+
let origin = manifest.site.url?.replace(/\/+$/, "");
|
|
8
|
+
if (!origin) return path;
|
|
9
|
+
try {
|
|
10
|
+
return new URL(path, `${origin}/`).toString();
|
|
11
|
+
} catch {
|
|
12
|
+
return path;
|
|
22
13
|
}
|
|
23
|
-
return tag;
|
|
24
14
|
}
|
|
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
15
|
|
|
56
|
-
// src/
|
|
57
|
-
var CACHE_CONTROL = "public, max-age=300, s-maxage=
|
|
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";
|
|
16
|
+
// src/lib/runtime/response/cached-text-response.ts
|
|
17
|
+
var CACHE_CONTROL = "public, max-age=300, s-maxage=3600, stale-while-revalidate=3600, must-revalidate", CDN_CACHE_CONTROL = "public, max-age=3600, stale-while-revalidate=3600, must-revalidate", SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate", SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
|
|
61
18
|
function cacheControl(policy) {
|
|
62
|
-
|
|
63
|
-
if (policy === "short") return SHORT_CACHE_CONTROL;
|
|
64
|
-
return policy;
|
|
19
|
+
return !policy || policy === "default" ? CACHE_CONTROL : policy === "short" ? SHORT_CACHE_CONTROL : policy;
|
|
65
20
|
}
|
|
66
21
|
function cdnCacheControl(policy) {
|
|
67
|
-
|
|
68
|
-
if (policy === "short") return SHORT_CDN_CACHE_CONTROL;
|
|
69
|
-
return policy;
|
|
22
|
+
return !policy || policy === "default" ? CDN_CACHE_CONTROL : policy === "short" ? SHORT_CDN_CACHE_CONTROL : policy;
|
|
70
23
|
}
|
|
71
24
|
function cachedTextHeaders(contentType, options = {}) {
|
|
72
|
-
|
|
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;
|
|
25
|
+
let headers = new Headers(options.headers);
|
|
26
|
+
return headers.set("cache-control", cacheControl(options.cachePolicy)), headers.set("cdn-cache-control", cdnCacheControl(options.cachePolicy)), headers.set("vercel-cdn-cache-control", cdnCacheControl(options.cachePolicy)), headers.set("content-type", contentType), headers.set("x-content-type-options", "nosniff"), options.noindex && headers.set("x-robots-tag", "noindex"), headers;
|
|
80
27
|
}
|
|
81
28
|
function createCachedTextResponse(options) {
|
|
82
|
-
|
|
83
|
-
const method = options.method ?? "GET";
|
|
84
|
-
const headers = cachedTextHeaders(options.contentType, options);
|
|
29
|
+
let status = options.status ?? 200, method = options.method ?? "GET", headers = cachedTextHeaders(options.contentType, options);
|
|
85
30
|
return new Response(method === "HEAD" ? null : options.body, {
|
|
86
31
|
headers,
|
|
87
32
|
status
|
|
88
33
|
});
|
|
89
34
|
}
|
|
90
35
|
|
|
91
|
-
// src/
|
|
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
|
|
36
|
+
// src/route-metadata-feed.ts
|
|
103
37
|
function xmlEscape(value) {
|
|
104
38
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
105
39
|
}
|
|
106
40
|
function pageTimestamp(page) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
41
|
+
let value = pageDate(page);
|
|
42
|
+
return value ? Date.parse(value) : -1 / 0;
|
|
43
|
+
}
|
|
44
|
+
function validDate(value) {
|
|
45
|
+
return value && !Number.isNaN(Date.parse(value)) ? value : void 0;
|
|
111
46
|
}
|
|
112
47
|
function pageInScope(page, options) {
|
|
113
|
-
|
|
114
|
-
if (options.scope === "self") return page.group === options.group;
|
|
115
|
-
return page.group === options.group || page.group.startsWith(`${options.group}/`);
|
|
48
|
+
return options.scope === "site" || !options.group ? !0 : options.scope === "self" ? page.group === options.group : page.group === options.group || page.group.startsWith(`${options.group}/`);
|
|
116
49
|
}
|
|
117
50
|
function feedPages(manifest, options) {
|
|
118
|
-
|
|
119
|
-
const pages = manifest.pages.filter((page) => statuses.includes(page.status)).filter((page) => pageInScope(page, options)).sort((a, b) => pageTimestamp(b) - pageTimestamp(a));
|
|
51
|
+
let statuses = options.status ?? ["published"], pages = manifest.pages.filter((page) => statuses.includes(page.status)).filter((page) => pageInScope(page, options)).sort((a, b) => pageTimestamp(b) - pageTimestamp(a));
|
|
120
52
|
return options.limit ? pages.slice(0, options.limit) : pages;
|
|
121
53
|
}
|
|
122
54
|
async function rssXml(manifest, options = {}) {
|
|
123
55
|
"use cache";
|
|
124
|
-
cacheLife("page")
|
|
125
|
-
cacheTag(
|
|
56
|
+
cacheLife("page"), cacheTag(
|
|
126
57
|
tags.site(),
|
|
127
58
|
tags.feed("rss", options.group ?? options.scope ?? "site"),
|
|
128
59
|
tags.manifest(manifest.contentHash)
|
|
129
60
|
);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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 ? `
|
|
61
|
+
let title = manifest.site.name, description = manifest.site.description ?? title, pages = feedPages(manifest, options), homeUrl = canonicalUrl(manifest, "/"), items = pages.map((page) => {
|
|
62
|
+
let pageUrl = canonicalUrl(manifest, page.path), publishedAt = validDate(page.publishedAt), pubDate = publishedAt ? `
|
|
63
|
+
<pubDate>${xmlEscape(new Date(publishedAt).toUTCString())}</pubDate>` : "", description2 = page.description ? `
|
|
139
64
|
<description>${xmlEscape(page.description)}</description>` : "";
|
|
140
65
|
return ` <item>
|
|
141
66
|
<title>${xmlEscape(page.title)}</title>
|
|
142
67
|
<link>${xmlEscape(pageUrl)}</link>
|
|
143
68
|
<guid>${xmlEscape(pageUrl)}</guid>${pubDate}${description2}
|
|
144
69
|
</item>`;
|
|
145
|
-
}).join(
|
|
70
|
+
}).join(`
|
|
71
|
+
`);
|
|
146
72
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
147
73
|
<rss version="2.0">
|
|
148
74
|
<channel>
|
|
@@ -155,28 +81,21 @@ ${items}
|
|
|
155
81
|
`;
|
|
156
82
|
}
|
|
157
83
|
function pageDate(page) {
|
|
158
|
-
return page.publishedAt ?? page.updatedAt;
|
|
84
|
+
return validDate(page.publishedAt) ?? validDate(page.updatedAt);
|
|
159
85
|
}
|
|
160
86
|
function latestFeedDate(pages) {
|
|
161
|
-
|
|
87
|
+
let timestamp = Math.max(0, ...pages.map((page) => pageTimestamp(page)));
|
|
162
88
|
return new Date(timestamp).toISOString();
|
|
163
89
|
}
|
|
164
90
|
async function atomXml(manifest, options = {}) {
|
|
165
91
|
"use cache";
|
|
166
|
-
cacheLife("page")
|
|
167
|
-
cacheTag(
|
|
92
|
+
cacheLife("page"), cacheTag(
|
|
168
93
|
tags.site(),
|
|
169
94
|
tags.feed("atom", options.group ?? options.scope ?? "site"),
|
|
170
95
|
tags.manifest(manifest.contentHash)
|
|
171
96
|
);
|
|
172
|
-
|
|
173
|
-
|
|
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 ? `
|
|
97
|
+
let title = manifest.site.name, pages = feedPages(manifest, options), homeUrl = canonicalUrl(manifest, "/"), entries = pages.map((page) => {
|
|
98
|
+
let date = pageDate(page), updated = date ? new Date(date).toISOString() : latestFeedDate([]), pageUrl = canonicalUrl(manifest, page.path), summary = page.description ? `
|
|
180
99
|
<summary>${xmlEscape(page.description)}</summary>` : "";
|
|
181
100
|
return ` <entry>
|
|
182
101
|
<title>${xmlEscape(page.title)}</title>
|
|
@@ -184,7 +103,8 @@ async function atomXml(manifest, options = {}) {
|
|
|
184
103
|
<link href="${xmlEscape(pageUrl)}" />
|
|
185
104
|
<updated>${xmlEscape(updated)}</updated>${summary}
|
|
186
105
|
</entry>`;
|
|
187
|
-
}).join(
|
|
106
|
+
}).join(`
|
|
107
|
+
`);
|
|
188
108
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
189
109
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
190
110
|
<title>${xmlEscape(title)}</title>
|
|
@@ -196,13 +116,12 @@ ${entries}
|
|
|
196
116
|
}
|
|
197
117
|
async function jsonFeed(manifest, options = {}) {
|
|
198
118
|
"use cache";
|
|
199
|
-
cacheLife("page")
|
|
200
|
-
cacheTag(
|
|
119
|
+
cacheLife("page"), cacheTag(
|
|
201
120
|
tags.site(),
|
|
202
121
|
tags.feed("json", options.group ?? options.scope ?? "site"),
|
|
203
122
|
tags.manifest(manifest.contentHash)
|
|
204
123
|
);
|
|
205
|
-
|
|
124
|
+
let pages = feedPages(manifest, options);
|
|
206
125
|
return `${JSON.stringify(
|
|
207
126
|
{
|
|
208
127
|
version: "https://jsonfeed.org/version/1.1",
|
|
@@ -215,8 +134,8 @@ async function jsonFeed(manifest, options = {}) {
|
|
|
215
134
|
title: page.title,
|
|
216
135
|
summary: page.description,
|
|
217
136
|
content_text: page.body,
|
|
218
|
-
date_published: page.publishedAt,
|
|
219
|
-
date_modified: page.updatedAt,
|
|
137
|
+
date_published: validDate(page.publishedAt),
|
|
138
|
+
date_modified: validDate(page.updatedAt),
|
|
220
139
|
tags: page.tags
|
|
221
140
|
}))
|
|
222
141
|
},
|
|
@@ -226,7 +145,7 @@ async function jsonFeed(manifest, options = {}) {
|
|
|
226
145
|
`;
|
|
227
146
|
}
|
|
228
147
|
function createRssFeedRoute(manifest, options = {}) {
|
|
229
|
-
return async function
|
|
148
|
+
return async function() {
|
|
230
149
|
return createCachedTextResponse({
|
|
231
150
|
body: await rssXml(manifest, options),
|
|
232
151
|
contentType: "application/rss+xml; charset=utf-8"
|
|
@@ -234,7 +153,7 @@ function createRssFeedRoute(manifest, options = {}) {
|
|
|
234
153
|
};
|
|
235
154
|
}
|
|
236
155
|
function createAtomFeedRoute(manifest, options = {}) {
|
|
237
|
-
return async function
|
|
156
|
+
return async function() {
|
|
238
157
|
return createCachedTextResponse({
|
|
239
158
|
body: await atomXml(manifest, options),
|
|
240
159
|
contentType: "application/atom+xml; charset=utf-8"
|
|
@@ -242,7 +161,7 @@ function createAtomFeedRoute(manifest, options = {}) {
|
|
|
242
161
|
};
|
|
243
162
|
}
|
|
244
163
|
function createJsonFeedRoute(manifest, options = {}) {
|
|
245
|
-
return async function
|
|
164
|
+
return async function() {
|
|
246
165
|
return createCachedTextResponse({
|
|
247
166
|
body: await jsonFeed(manifest, options),
|
|
248
167
|
contentType: "application/feed+json; charset=utf-8"
|
|
@@ -250,7 +169,7 @@ function createJsonFeedRoute(manifest, options = {}) {
|
|
|
250
169
|
};
|
|
251
170
|
}
|
|
252
171
|
function createPrecomputedFeedRoute(output) {
|
|
253
|
-
return function
|
|
172
|
+
return function() {
|
|
254
173
|
return createCachedTextResponse({
|
|
255
174
|
body: output.body,
|
|
256
175
|
contentType: output.contentType
|