@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.92
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/compiler-assets/nextjs/defaults/group/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -6
- package/compiler-assets/nextjs/defaults/group/page.tsx +36 -26
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +21 -11
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
- package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
- package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
- package/compiler-assets/nextjs/shims/document.tsx +46 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +5 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
- package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
- package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
- package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
- package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
- package/compiler-assets/nextjs/shims/proxy.ts +254 -86
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
- package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
- package/dist/{build-operation-2JAYBSKF.js → build-operation-CJDUL4OW.js} +29 -23
- package/dist/{button-c3WGnxIj.d.ts → button-D6Xp2HBm.d.ts} +4 -4
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-3T4HVDSC.js +426 -0
- package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
- package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
- package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
- package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
- package/dist/chunk-DX7PXFCM.js +2519 -0
- package/dist/{chunk-726GV2NF.js → chunk-DZ3VWEV5.js} +950 -632
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/{chunk-H6XILMZX.js → chunk-NHSLTARU.js} +2588 -1493
- package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
- package/dist/{chunk-VO2I7MTM.js → chunk-SBMDONTV.js} +10 -7
- package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
- package/dist/compiler.d.ts +15 -2
- package/dist/compiler.js +111 -23
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +563 -0
- package/dist/components/blocks/toc.d.ts +43 -0
- package/dist/components/blocks/toc.js +136 -0
- package/dist/components/ui/button.d.ts +4 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-44GJSMXD.js +16 -0
- package/dist/config/createNextConfig.js +19 -3
- package/dist/{dev-operation-TZDVJCN7.js → dev-operation-WNECBHZ5.js} +134 -84
- package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
- package/dist/ide-support-TG74L4FF.js +16 -0
- package/dist/index.d.ts +151 -95
- package/dist/index.js +25 -0
- package/dist/jsx-dev-runtime.d.ts +6 -0
- package/dist/jsx-dev-runtime.js +100 -0
- package/dist/jsx-runtime.d.ts +7 -0
- package/dist/jsx-runtime.js +97 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +37 -8
- package/dist/kernel/components/blocks/AgentActions.js +384 -174
- package/dist/kernel/components/blocks/agent-actions.d.ts +4 -0
- package/dist/kernel/components/blocks/agent-actions.js +563 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
- package/dist/kernel/components/blocks/logo-block.js +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
- package/dist/kernel/components/blocks/nav-breadcrumb.js +21 -15
- package/dist/kernel/components/blocks/navbar.d.ts +5 -4
- package/dist/kernel/components/blocks/navbar.js +79 -59
- package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
- package/dist/kernel/components/blocks/navigation-progress.js +2 -2
- package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
- package/dist/kernel/components/blocks/next-prev.js +30 -7
- package/dist/kernel/components/blocks/page-list.d.ts +4 -4
- package/dist/kernel/components/blocks/page-list.js +32 -9
- package/dist/kernel/components/blocks/search.d.ts +9 -15
- package/dist/kernel/components/blocks/search.js +16 -17
- package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
- package/dist/kernel/components/blocks/sidebar-node.js +13 -3
- package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
- package/dist/kernel/components/blocks/sidebar.js +137 -28
- package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
- package/dist/kernel/components/blocks/theme-toggle.js +5 -5
- package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
- package/dist/kernel/components/blocks/toc-client.js +495 -0
- package/dist/kernel/components/blocks/toc.d.ts +20 -2
- package/dist/kernel/components/blocks/toc.js +121 -179
- package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
- package/dist/kernel/components/mdx/components/callout.js +1 -1
- package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +3 -3
- package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +8 -4
- package/dist/kernel/components/mdx/components/figure.js +23 -13
- package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
- package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.js +4 -3
- package/dist/kernel/components/mdx/components/image.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image.js +22 -17
- package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +6 -6
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +1 -1
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.d.ts +7 -7
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
- package/dist/kernel/components/mdx/components/task-list.js +1 -1
- package/dist/kernel/components/mdx/components/video-player.d.ts +8 -4
- package/dist/kernel/components/mdx/components/video-player.js +6 -2
- package/dist/kernel/components/mdx/components/video.d.ts +5 -4
- package/dist/kernel/components/mdx/components/video.js +7 -5
- package/dist/kernel/components/mdx/error-boundary.d.ts +3 -4
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +57 -16
- package/dist/kernel/components/mdx/mdx.js +232 -35
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/next-image.d.ts +12 -0
- package/dist/kernel/components/next-image.js +61 -0
- package/dist/kernel/components/ui/accordion.d.ts +7 -7
- package/dist/kernel/components/ui/accordion.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -4
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +14 -14
- package/dist/kernel/components/ui/breadcrumb.js +4 -4
- package/dist/kernel/components/ui/button-group.d.ts +6 -6
- package/dist/kernel/components/ui/button-group.js +3 -3
- package/dist/kernel/components/ui/button.d.ts +59 -7
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +7 -7
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.d.ts +10 -10
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +12 -12
- package/dist/kernel/components/ui/drawer.js +1 -1
- package/dist/kernel/components/ui/input.d.ts +2 -2
- package/dist/kernel/components/ui/input.js +1 -1
- package/dist/kernel/components/ui/kbd.d.ts +4 -4
- package/dist/kernel/components/ui/kbd.js +1 -1
- package/dist/kernel/components/ui/link.d.ts +11 -5
- package/dist/kernel/components/ui/link.js +2 -2
- package/dist/kernel/components/ui/menu.d.ts +22 -22
- package/dist/kernel/components/ui/menu.js +1 -1
- package/dist/kernel/components/ui/mod-key.d.ts +2 -3
- package/dist/kernel/components/ui/mod-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
- package/dist/kernel/components/ui/navigation-menu.js +1 -1
- package/dist/kernel/components/ui/popover.d.ts +11 -11
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.d.ts +7 -7
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +9 -10
- package/dist/kernel/components/ui/scroll-area.js +1 -1
- package/dist/kernel/components/ui/select.d.ts +16 -16
- package/dist/kernel/components/ui/select.js +1 -1
- package/dist/kernel/components/ui/separator.d.ts +3 -3
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.d.ts +7 -7
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.d.ts +12 -12
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.d.ts +3 -3
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +4 -4
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.d.ts +11 -11
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.d.ts +9 -9
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +4 -17
- package/dist/kernel/defaults.registry.js +4 -19
- package/dist/kernel/routes/agent/markdown.d.ts +7 -0
- package/dist/kernel/routes/agent/markdown.js +229 -54
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +5 -7
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +119 -88
- package/dist/kernel/routes/metadata/llms.d.ts +3 -23
- package/dist/kernel/routes/metadata/llms.js +2 -103
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +5 -3
- package/dist/kernel/routes/metadata/robots.js +4 -25
- package/dist/kernel/routes/metadata/sitemap.d.ts +36 -3
- package/dist/kernel/routes/metadata/sitemap.js +277 -49
- package/dist/kernel/routes/not-found.d.ts +34 -0
- package/dist/kernel/routes/not-found.js +213 -0
- package/dist/kernel/routes/pages/group.d.ts +5 -5
- package/dist/kernel/routes/pages/group.js +11 -5
- package/dist/kernel/routes/pages/leaf.d.ts +38 -6
- package/dist/kernel/routes/pages/leaf.js +21 -12
- package/dist/kernel/routes/pages/root.d.ts +5 -5
- package/dist/kernel/routes/pages/root.js +21 -6
- package/dist/keyboard-shortcuts.d.ts +2 -2
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
- package/dist/resolvers/manifest-resolver.d.ts +2 -2
- package/dist/resolvers/manifest-resolver.js +65 -35
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +2 -9
- package/dist/search.js +9 -16
- package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
- package/dist/theme-scope.d.ts +2 -2
- package/dist/theme-scope.js +1 -1
- package/dist/types-BbqmOzLC.d.ts +168 -0
- package/dist/types-TjH1ek0X.d.ts +22 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +117 -91
- package/dist/utils/heading-ids.js +30 -11
- package/dist/utils/toc-selection.d.ts +7 -0
- package/dist/utils/toc-selection.js +14 -0
- package/dist/validate-local-source-EN2GW4FR.js +16 -0
- package/dist/validate-publish-os-source-OEWQDB7B.js +14 -0
- package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
- package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
- package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
- package/init/seed/minimal/publish.os/blog/index.tsx +85 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +91 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
- package/init/seed/minimal/publish.os/publish.os.config.json +17 -2
- package/init/seed/minimal/publish.os/theme.css +3 -3
- package/init/seed/minimal/seed.json +12 -4
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
- package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
- package/package.json +48 -23
- package/release/app/phosphor/package.json +4 -4
- package/release/app/phosphor/pnpm-lock.yaml.template +123 -184
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +153 -183
- package/release/release.json +6 -6
- package/dist/button-CtzUJB8u.d.ts +0 -11
- package/dist/chunk-535TM4A5.js +0 -1455
- package/dist/chunk-B2V22WRT.js +0 -297
- package/dist/chunk-NECL5IBJ.js +0 -318
- package/dist/chunk-SVYGXXYR.js +0 -36
- package/dist/chunk-UF6ATARM.js +0 -1100
- package/dist/compose-NN23UJGC.js +0 -13
- package/dist/ide-support-ZNW7ODFY.js +0 -15
- package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -667
- package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/link-playground.js +0 -744
- package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
- package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -53
- package/dist/sidebar-types-DKpR27II.d.ts +0 -25
- package/dist/types-BzkZty3r.d.ts +0 -147
- package/dist/types-CJWRG05y.d.ts +0 -76
- package/dist/types-CUtrppxt.d.ts +0 -69
- package/dist/validate-local-source-XRL2Y7XE.js +0 -14
- package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
- package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// src/lib/runtime/response/cached-text-response.ts
|
|
2
|
+
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";
|
|
3
|
+
function cacheControl(policy) {
|
|
4
|
+
return !policy || policy === "default" ? CACHE_CONTROL : policy === "short" ? SHORT_CACHE_CONTROL : policy;
|
|
5
|
+
}
|
|
6
|
+
function cdnCacheControl(policy) {
|
|
7
|
+
return !policy || policy === "default" ? CDN_CACHE_CONTROL : policy === "short" ? SHORT_CDN_CACHE_CONTROL : policy;
|
|
8
|
+
}
|
|
9
|
+
function cachedTextHeaders(contentType, options = {}) {
|
|
10
|
+
let headers = new Headers(options.headers);
|
|
11
|
+
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;
|
|
12
|
+
}
|
|
13
|
+
function createCachedTextResponse(options) {
|
|
14
|
+
let status = options.status ?? 200, method = options.method ?? "GET", headers = cachedTextHeaders(options.contentType, options);
|
|
15
|
+
return new Response(method === "HEAD" ? null : options.body, {
|
|
16
|
+
headers,
|
|
17
|
+
status
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/route-not-found.ts
|
|
22
|
+
var MAX_PATH_LENGTH = 2048, UNSAFE_PATH_CHARACTERS = /[\p{Cc}\p{Cs}\u200b-\u200f\u2028-\u202f\u2060-\u206f\ufeff]/u, INTERNAL_PATHS = ["/__publishos", "/_next", "/_not-found", "/publishos"], DEFAULT_MARKDOWN = serializeNotFoundMarkdown({
|
|
23
|
+
recommendations: [],
|
|
24
|
+
indexes: []
|
|
25
|
+
});
|
|
26
|
+
function normalizePublicPath(pathname) {
|
|
27
|
+
let path = pathname.split(/[?#]/u, 1)[0];
|
|
28
|
+
if (!path?.startsWith("/") || path.startsWith("//") || path.length > MAX_PATH_LENGTH || UNSAFE_PATH_CHARACTERS.test(path))
|
|
29
|
+
return;
|
|
30
|
+
let segments = [];
|
|
31
|
+
for (let segment of path.split("/")) {
|
|
32
|
+
if (!segment) continue;
|
|
33
|
+
let decoded;
|
|
34
|
+
try {
|
|
35
|
+
decoded = decodeURIComponent(segment);
|
|
36
|
+
} catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (decoded === "." || decoded === ".." || /[/\\]/u.test(decoded) || /%[\da-f]{2}/iu.test(decoded) || UNSAFE_PATH_CHARACTERS.test(decoded))
|
|
40
|
+
return;
|
|
41
|
+
segments.push(decoded.normalize("NFC"));
|
|
42
|
+
}
|
|
43
|
+
return `/${segments.join("/")}`;
|
|
44
|
+
}
|
|
45
|
+
function containsPath({ parent, path }) {
|
|
46
|
+
return parent === "/" || path === parent || path.startsWith(`${parent}/`);
|
|
47
|
+
}
|
|
48
|
+
function missingPagePath(pathname) {
|
|
49
|
+
let normalized = normalizePublicPath(pathname);
|
|
50
|
+
if (!normalized) return;
|
|
51
|
+
let path = normalized.endsWith(".md") ? normalized.slice(0, -3) || "/" : normalized;
|
|
52
|
+
return INTERNAL_PATHS.some((parent) => containsPath({ parent, path })) ? void 0 : path;
|
|
53
|
+
}
|
|
54
|
+
function resolveNotFoundScope({
|
|
55
|
+
scopes,
|
|
56
|
+
pathname
|
|
57
|
+
}) {
|
|
58
|
+
let path = missingPagePath(pathname);
|
|
59
|
+
if (!path) return;
|
|
60
|
+
let matched, matchedLength = -1;
|
|
61
|
+
for (let scope of scopes) {
|
|
62
|
+
let scopePath = normalizePublicPath(scope.path);
|
|
63
|
+
!scopePath || !containsPath({ parent: scopePath, path }) || (scopePath.length > matchedLength || scopePath.length === matchedLength && scope.group && !matched?.group) && (matched = scope, matchedLength = scopePath.length);
|
|
64
|
+
}
|
|
65
|
+
return matched;
|
|
66
|
+
}
|
|
67
|
+
function trustedHostname(origin) {
|
|
68
|
+
if (origin)
|
|
69
|
+
try {
|
|
70
|
+
let url = new URL(origin);
|
|
71
|
+
return !["http:", "https:"].includes(url.protocol) || url.username || url.password ? void 0 : url.host.replace(/`/gu, "%60");
|
|
72
|
+
} catch {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function requestExplanation({
|
|
77
|
+
pathname,
|
|
78
|
+
origin
|
|
79
|
+
}) {
|
|
80
|
+
let path = pathname.split("/").map(encodeURIComponent).join("/"), hostname = trustedHostname(origin);
|
|
81
|
+
return `No page exists at \`${path}\`${hostname ? ` on ${hostname}` : ""}.`;
|
|
82
|
+
}
|
|
83
|
+
function indexKind(link) {
|
|
84
|
+
if (link.kind) return link.kind;
|
|
85
|
+
switch (link.title) {
|
|
86
|
+
case "Sitemap":
|
|
87
|
+
return "sitemap";
|
|
88
|
+
case "Markdown sitemap":
|
|
89
|
+
return "sitemap-md";
|
|
90
|
+
case "llms.txt":
|
|
91
|
+
case "LLMS index":
|
|
92
|
+
return "llms";
|
|
93
|
+
case "llms-full.txt":
|
|
94
|
+
return "llms-full";
|
|
95
|
+
default:
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function publicRecoveryHref(href) {
|
|
100
|
+
if (href.includes("\\") || UNSAFE_PATH_CHARACTERS.test(href))
|
|
101
|
+
return;
|
|
102
|
+
let relative = href.startsWith("/") && !href.startsWith("//");
|
|
103
|
+
try {
|
|
104
|
+
let url = new URL(
|
|
105
|
+
href,
|
|
106
|
+
relative ? "https://publishos.invalid" : void 0
|
|
107
|
+
);
|
|
108
|
+
return !["http:", "https:"].includes(url.protocol) || url.username || url.password ? void 0 : relative ? `${url.pathname}${url.search}${url.hash}` : url.href;
|
|
109
|
+
} catch {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function markdownText(value) {
|
|
114
|
+
return value.replace(/\s+/gu, " ").replace(/[\p{Cc}\p{Cs}]/gu, "").trim().replace(/[\\`*_[\]{}<>|~]/gu, "\\$&");
|
|
115
|
+
}
|
|
116
|
+
function markdownLink(link) {
|
|
117
|
+
let title = markdownText(link.title), href = publicRecoveryHref(link.href)?.replace(
|
|
118
|
+
/[()`<>]/gu,
|
|
119
|
+
(character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`
|
|
120
|
+
);
|
|
121
|
+
if (!title || !href) return;
|
|
122
|
+
let description = link.description ? markdownText(link.description) : void 0;
|
|
123
|
+
return `- [${title}](${href})${description ? `: ${description}` : ""}`;
|
|
124
|
+
}
|
|
125
|
+
function serializeNotFoundMarkdown({
|
|
126
|
+
recommendations,
|
|
127
|
+
indexes
|
|
128
|
+
}) {
|
|
129
|
+
let sections = [
|
|
130
|
+
{ title: "Recommendations", links: recommendations },
|
|
131
|
+
{ title: "For crawlers and agents", links: indexes }
|
|
132
|
+
], lines = [
|
|
133
|
+
"# 404 \u2014 Not Found",
|
|
134
|
+
"",
|
|
135
|
+
"This page does not exist. Please check the URL and try again.",
|
|
136
|
+
""
|
|
137
|
+
];
|
|
138
|
+
for (let section of sections) {
|
|
139
|
+
let links = section.links.map(markdownLink).filter((link) => link !== void 0);
|
|
140
|
+
links.length && lines.push(`## ${section.title}`, "", ...links, "");
|
|
141
|
+
}
|
|
142
|
+
return lines.join(`
|
|
143
|
+
`);
|
|
144
|
+
}
|
|
145
|
+
function discoveryHeaders(scope) {
|
|
146
|
+
let headers = new Headers(), links = [];
|
|
147
|
+
for (let link of scope?.indexes ?? []) {
|
|
148
|
+
let kind = indexKind(link), href = /[\s<>"\\]/u.test(link.href) ? void 0 : publicRecoveryHref(link.href);
|
|
149
|
+
if (!(!kind || !href))
|
|
150
|
+
switch (kind) {
|
|
151
|
+
case "llms":
|
|
152
|
+
if (scope?.describedBy !== void 0) break;
|
|
153
|
+
links.push(`<${href}>; rel="describedby"; type="text/plain"`), headers.set("x-publishos-llms", href);
|
|
154
|
+
break;
|
|
155
|
+
case "llms-full":
|
|
156
|
+
links.push(
|
|
157
|
+
`<${href}>; rel="related"; type="text/plain"; title="Full content"`
|
|
158
|
+
);
|
|
159
|
+
break;
|
|
160
|
+
case "sitemap":
|
|
161
|
+
case "sitemap-md":
|
|
162
|
+
links.push(
|
|
163
|
+
`<${href}>; rel="sitemap"; type="${kind === "sitemap-md" ? "text/markdown" : "application/xml"}"`
|
|
164
|
+
), headers.set("x-publishos-sitemap", href);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (scope?.describedBy !== void 0) {
|
|
169
|
+
let href = /[\s<>"\\]/u.test(scope.describedBy) ? void 0 : publicRecoveryHref(scope.describedBy);
|
|
170
|
+
href && (links.push(`<${href}>; rel="describedby"; type="text/plain"`), headers.set("x-publishos-llms", href));
|
|
171
|
+
}
|
|
172
|
+
return links.length && headers.set("link", links.join(", ")), headers;
|
|
173
|
+
}
|
|
174
|
+
function createNotFoundTextResponse({
|
|
175
|
+
scope,
|
|
176
|
+
pathname,
|
|
177
|
+
method,
|
|
178
|
+
contentType = "text/markdown; charset=utf-8",
|
|
179
|
+
vary = !1
|
|
180
|
+
}) {
|
|
181
|
+
let path = pathname === void 0 ? void 0 : missingPagePath(pathname), resolvedScope = scope && (pathname === void 0 || resolveNotFoundScope({ scopes: [scope], pathname })) ? scope : void 0, body = resolvedScope?.markdown ?? DEFAULT_MARKDOWN;
|
|
182
|
+
if (resolvedScope && path) {
|
|
183
|
+
let explanation = requestExplanation({
|
|
184
|
+
pathname: path,
|
|
185
|
+
origin: scope?.origin
|
|
186
|
+
}), headingEnd = body.indexOf(`
|
|
187
|
+
|
|
188
|
+
`);
|
|
189
|
+
body = headingEnd === -1 ? `${body}
|
|
190
|
+
|
|
191
|
+
${explanation}
|
|
192
|
+
` : `${body.slice(0, headingEnd)}
|
|
193
|
+
|
|
194
|
+
${explanation}
|
|
195
|
+
|
|
196
|
+
${body.slice(headingEnd + 2)}`;
|
|
197
|
+
}
|
|
198
|
+
let headers = discoveryHeaders(resolvedScope);
|
|
199
|
+
return vary && headers.set("vary", "Accept, User-Agent"), createCachedTextResponse({
|
|
200
|
+
body,
|
|
201
|
+
cachePolicy: "short",
|
|
202
|
+
contentType,
|
|
203
|
+
headers,
|
|
204
|
+
method,
|
|
205
|
+
noindex: !0,
|
|
206
|
+
status: 404
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
export {
|
|
210
|
+
createNotFoundTextResponse,
|
|
211
|
+
resolveNotFoundScope,
|
|
212
|
+
serializeNotFoundMarkdown
|
|
213
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Metadata } from 'next';
|
|
1
|
+
import * as react from 'react';
|
|
3
2
|
import { ReactElement } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Metadata } from 'next';
|
|
4
|
+
import { O as OgManifestLike } from '../../../route-metadata-og-image-BeKKFHg7.js';
|
|
5
|
+
import { ManifestLike, IndexPageProps } from '../../../types.js';
|
|
6
6
|
|
|
7
7
|
type IndexPageComponent = (props: IndexPageProps) => ReactElement | Promise<ReactElement>;
|
|
8
8
|
type GroupRouteConfig = {
|
|
@@ -11,7 +11,7 @@ type GroupRouteConfig = {
|
|
|
11
11
|
ogManifest?: OgManifestLike;
|
|
12
12
|
IndexPage: IndexPageComponent;
|
|
13
13
|
};
|
|
14
|
-
declare function createGroupPage({ group, manifest, IndexPage, }: GroupRouteConfig): () => Promise<
|
|
14
|
+
declare function createGroupPage({ group, manifest, IndexPage, }: GroupRouteConfig): () => Promise<react.JSX.Element>;
|
|
15
15
|
declare function createGroupMetadata({ group, manifest, ogManifest, }: GroupRouteConfig): Metadata;
|
|
16
16
|
|
|
17
17
|
export { type GroupRouteConfig, type IndexPageComponent, createGroupMetadata, createGroupPage };
|
|
@@ -23,7 +23,8 @@ var isDev = process.env.NODE_ENV !== "production", isDebugEnabled = process.env.
|
|
|
23
23
|
// src/lib/runtime/metadata/canonical-url.ts
|
|
24
24
|
function canonicalUrl(manifest, path, group) {
|
|
25
25
|
let origin = (group && manifest.groups[group]?.origin) ?? manifest.site.origin;
|
|
26
|
-
if (!origin)
|
|
26
|
+
if (!origin)
|
|
27
|
+
return /^[a-z][a-z\d+.-]*:/i.test(path) ? path : new URL(path, "https://publish.invalid").pathname;
|
|
27
28
|
try {
|
|
28
29
|
return new URL(path, `${origin}/`).toString();
|
|
29
30
|
} catch {
|
|
@@ -46,7 +47,12 @@ function agentReadableAlternates({
|
|
|
46
47
|
return {
|
|
47
48
|
...canonical.startsWith("http") ? { canonical } : {},
|
|
48
49
|
types: {
|
|
49
|
-
...markdownPath ? {
|
|
50
|
+
...markdownPath ? {
|
|
51
|
+
"text/markdown": new URL(
|
|
52
|
+
normalizePath(markdownPath),
|
|
53
|
+
"https://publish.invalid"
|
|
54
|
+
).pathname
|
|
55
|
+
} : {},
|
|
50
56
|
"text/plain": "/llms.txt"
|
|
51
57
|
}
|
|
52
58
|
};
|
|
@@ -101,7 +107,7 @@ function createSocialMetadata({
|
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
// src/route-page-group.tsx
|
|
104
|
-
import { jsx } from "
|
|
110
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
105
111
|
var manifests = /* @__PURE__ */ new Map(), indexPages = /* @__PURE__ */ new Map();
|
|
106
112
|
async function CachedGroupPage({ group }) {
|
|
107
113
|
"use cache";
|
|
@@ -136,11 +142,11 @@ function createGroupMetadata({
|
|
|
136
142
|
}) : void 0,
|
|
137
143
|
...createSocialMetadata({
|
|
138
144
|
canonicalPath,
|
|
139
|
-
description,
|
|
145
|
+
description: groupData?.metadata?.openGraph?.description ?? description,
|
|
140
146
|
group,
|
|
141
147
|
manifest,
|
|
142
148
|
ogManifest,
|
|
143
|
-
title
|
|
149
|
+
title: groupData?.metadata?.openGraph?.title ?? title
|
|
144
150
|
})
|
|
145
151
|
};
|
|
146
152
|
}
|
|
@@ -1,8 +1,38 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Metadata } from 'next';
|
|
1
|
+
import * as react from 'react';
|
|
3
2
|
import { ReactElement, ReactNode } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Metadata } from 'next';
|
|
4
|
+
import { O as OgManifestLike } from '../../../route-metadata-og-image-BeKKFHg7.js';
|
|
5
|
+
import { PageProps, ManifestLike, ResolvedAttribution } from '../../../types.js';
|
|
6
|
+
|
|
7
|
+
type MarkdownRouteArtifact = {
|
|
8
|
+
body: string;
|
|
9
|
+
bodyHash?: string;
|
|
10
|
+
byteSize?: number;
|
|
11
|
+
htmlPath: string;
|
|
12
|
+
markdownPath: string;
|
|
13
|
+
sourceHash?: string;
|
|
14
|
+
robots?: {
|
|
15
|
+
index?: boolean;
|
|
16
|
+
follow?: boolean;
|
|
17
|
+
};
|
|
18
|
+
title: string;
|
|
19
|
+
};
|
|
20
|
+
type MarkdownRouteArtifactIndexEntry = Omit<MarkdownRouteArtifact, "body"> & {
|
|
21
|
+
shardId: string;
|
|
22
|
+
};
|
|
23
|
+
type MarkdownRouteArtifactIndex = Record<string, MarkdownRouteArtifactIndexEntry>;
|
|
24
|
+
type MarkdownRouteArtifactShardMetadata = {
|
|
25
|
+
byteSize: number;
|
|
26
|
+
contentHash: string;
|
|
27
|
+
id: string;
|
|
28
|
+
modulePath: string;
|
|
29
|
+
pageCount: number;
|
|
30
|
+
};
|
|
31
|
+
type MarkdownRouteArtifactManifest = {
|
|
32
|
+
byHtmlPath: Record<string, string>;
|
|
33
|
+
byMarkdownPath: MarkdownRouteArtifactIndex;
|
|
34
|
+
shards: MarkdownRouteArtifactShardMetadata[];
|
|
35
|
+
};
|
|
6
36
|
|
|
7
37
|
type LeafComponent = (props: PageProps) => ReactElement | Promise<ReactElement>;
|
|
8
38
|
type PoweredByFooterComponent = (props: {
|
|
@@ -11,7 +41,9 @@ type PoweredByFooterComponent = (props: {
|
|
|
11
41
|
type LeafRouteConfig = {
|
|
12
42
|
group: string;
|
|
13
43
|
manifest: ManifestLike;
|
|
44
|
+
markdownArtifactManifest?: Pick<MarkdownRouteArtifactManifest, "byMarkdownPath">;
|
|
14
45
|
ogManifest?: OgManifestLike;
|
|
46
|
+
markdownRoutesEnabled?: boolean;
|
|
15
47
|
Leaf: LeafComponent;
|
|
16
48
|
PoweredByFooter?: PoweredByFooterComponent;
|
|
17
49
|
};
|
|
@@ -27,8 +59,8 @@ declare function appendPoweredByFooter({ footer, node, }: {
|
|
|
27
59
|
node: ReactNode;
|
|
28
60
|
placed: boolean;
|
|
29
61
|
};
|
|
30
|
-
declare function createLeafPage({ group, manifest, Leaf, PoweredByFooter, }: LeafRouteConfig): ({ params }: PageRouteProps) => Promise<
|
|
31
|
-
declare function createLeafMetadata({ group, manifest, ogManifest, }: LeafRouteConfig): ({ params, }: PageRouteProps) => Promise<Metadata>;
|
|
62
|
+
declare function createLeafPage({ group, manifest, markdownArtifactManifest, Leaf, PoweredByFooter, }: LeafRouteConfig): ({ params }: PageRouteProps) => Promise<react.JSX.Element>;
|
|
63
|
+
declare function createLeafMetadata({ group, manifest, ogManifest, markdownRoutesEnabled, }: LeafRouteConfig): ({ params, }: PageRouteProps) => Promise<Metadata>;
|
|
32
64
|
declare function createLeafStaticParams({ group, manifest }: LeafRouteConfig): () => {
|
|
33
65
|
slug: string[];
|
|
34
66
|
}[];
|
|
@@ -32,7 +32,8 @@ var isDev = process.env.NODE_ENV !== "production", isDebugEnabled = process.env.
|
|
|
32
32
|
// src/lib/runtime/metadata/canonical-url.ts
|
|
33
33
|
function canonicalUrl(manifest, path, group) {
|
|
34
34
|
let origin = (group && manifest.groups[group]?.origin) ?? manifest.site.origin;
|
|
35
|
-
if (!origin)
|
|
35
|
+
if (!origin)
|
|
36
|
+
return /^[a-z][a-z\d+.-]*:/i.test(path) ? path : new URL(path, "https://publish.invalid").pathname;
|
|
36
37
|
try {
|
|
37
38
|
return new URL(path, `${origin}/`).toString();
|
|
38
39
|
} catch {
|
|
@@ -59,7 +60,12 @@ function agentReadableAlternates({
|
|
|
59
60
|
return {
|
|
60
61
|
...canonical.startsWith("http") ? { canonical } : {},
|
|
61
62
|
types: {
|
|
62
|
-
...markdownPath ? {
|
|
63
|
+
...markdownPath ? {
|
|
64
|
+
"text/markdown": new URL(
|
|
65
|
+
normalizePath(markdownPath),
|
|
66
|
+
"https://publish.invalid"
|
|
67
|
+
).pathname
|
|
68
|
+
} : {},
|
|
63
69
|
"text/plain": "/llms.txt"
|
|
64
70
|
}
|
|
65
71
|
};
|
|
@@ -114,8 +120,8 @@ function createSocialMetadata({
|
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
// src/route-page-leaf.tsx
|
|
117
|
-
import { jsx, jsxs } from "
|
|
118
|
-
var manifests = /* @__PURE__ */ new Map(), leaves = /* @__PURE__ */ new Map(), poweredByFooters = /* @__PURE__ */ new Map();
|
|
123
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
124
|
+
var manifests = /* @__PURE__ */ new Map(), markdownArtifactIndexes = /* @__PURE__ */ new Map(), leaves = /* @__PURE__ */ new Map(), poweredByFooters = /* @__PURE__ */ new Map();
|
|
119
125
|
function hasClassName(value, className) {
|
|
120
126
|
return typeof value == "string" && value.split(/\s+/).includes(className);
|
|
121
127
|
}
|
|
@@ -204,7 +210,7 @@ async function CachedLeafPage({
|
|
|
204
210
|
(!manifest || !Leaf) && notFound(), cacheTag(tags.manifest(manifest.contentHash)), log.debug("[cache]", `${group}/${slug.join("/")}`);
|
|
205
211
|
let resolved = resolveLeaf(manifest, group, slug);
|
|
206
212
|
resolved || notFound();
|
|
207
|
-
let attribution = manifest.attribution?.[group] ?? { enabled: !1 }, leaf = await Leaf(resolved), footer = attribution.enabled && PoweredByFooter ? /* @__PURE__ */ jsx(PoweredByFooter, { attribution }) : null, placed = footer ? appendPoweredByFooter({ footer, node: leaf }) : { node: leaf, placed: !0 };
|
|
213
|
+
let attribution = manifest.attribution?.[group] ?? { enabled: !1 }, markdownRevision = markdownArtifactIndexes.get(group)?.[markdownPathForHtmlPath(resolved.page.path)]?.bodyHash, leaf = await Leaf({ ...resolved, markdownRevision }), footer = attribution.enabled && PoweredByFooter ? /* @__PURE__ */ jsx(PoweredByFooter, { attribution }) : null, placed = footer ? appendPoweredByFooter({ footer, node: leaf }) : { node: leaf, placed: !0 };
|
|
208
214
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-full min-w-0 flex-1 flex-col", children: [
|
|
209
215
|
placed.node,
|
|
210
216
|
footer && !placed.placed ? footer : null
|
|
@@ -213,10 +219,11 @@ async function CachedLeafPage({
|
|
|
213
219
|
function createLeafPage({
|
|
214
220
|
group,
|
|
215
221
|
manifest,
|
|
222
|
+
markdownArtifactManifest,
|
|
216
223
|
Leaf,
|
|
217
224
|
PoweredByFooter
|
|
218
225
|
}) {
|
|
219
|
-
return manifests.set(group, manifest), leaves.set(group, Leaf), PoweredByFooter ? poweredByFooters.set(group, PoweredByFooter) : poweredByFooters.delete(group), async function({ params }) {
|
|
226
|
+
return manifests.set(group, manifest), markdownArtifactManifest ? markdownArtifactIndexes.set(group, markdownArtifactManifest.byMarkdownPath) : markdownArtifactIndexes.delete(group), leaves.set(group, Leaf), PoweredByFooter ? poweredByFooters.set(group, PoweredByFooter) : poweredByFooters.delete(group), async function({ params }) {
|
|
220
227
|
let { slug = [] } = await params;
|
|
221
228
|
return log.debug("[render]", `${group}/${slug.join("/")}`), /* @__PURE__ */ jsx(CachedLeafPage, { group, slug });
|
|
222
229
|
};
|
|
@@ -224,7 +231,8 @@ function createLeafPage({
|
|
|
224
231
|
function createLeafMetadata({
|
|
225
232
|
group,
|
|
226
233
|
manifest,
|
|
227
|
-
ogManifest
|
|
234
|
+
ogManifest,
|
|
235
|
+
markdownRoutesEnabled
|
|
228
236
|
}) {
|
|
229
237
|
return async function({
|
|
230
238
|
params
|
|
@@ -233,21 +241,22 @@ function createLeafMetadata({
|
|
|
233
241
|
log.debug("[metadata]", `${group}/${slug.join("/")}`);
|
|
234
242
|
let resolved = resolveLeaf(manifest, group, slug);
|
|
235
243
|
return resolved ? {
|
|
236
|
-
title: resolved.page.title,
|
|
237
|
-
description: resolved.page.description,
|
|
244
|
+
title: resolved.page.frontmatter.title,
|
|
245
|
+
description: resolved.page.frontmatter.description,
|
|
246
|
+
...resolved.page.frontmatter.metadata.robots ? { robots: resolved.page.frontmatter.metadata.robots } : {},
|
|
238
247
|
alternates: agentReadableAlternates({
|
|
239
248
|
canonicalPath: resolved.page.path,
|
|
240
249
|
group,
|
|
241
250
|
manifest,
|
|
242
|
-
markdownPath: markdownPathForHtmlPath(resolved.page.path)
|
|
251
|
+
markdownPath: markdownRoutesEnabled === !1 ? void 0 : markdownPathForHtmlPath(resolved.page.path)
|
|
243
252
|
}),
|
|
244
253
|
...createSocialMetadata({
|
|
245
254
|
canonicalPath: resolved.page.path,
|
|
246
|
-
description: resolved.page.description,
|
|
255
|
+
description: resolved.page.frontmatter.metadata.openGraph?.description ?? resolved.page.frontmatter.description,
|
|
247
256
|
group,
|
|
248
257
|
manifest,
|
|
249
258
|
ogManifest,
|
|
250
|
-
title: resolved.page.title,
|
|
259
|
+
title: resolved.page.frontmatter.metadata.openGraph?.title ?? resolved.page.frontmatter.title,
|
|
251
260
|
type: "article"
|
|
252
261
|
})
|
|
253
262
|
} : {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Metadata } from 'next';
|
|
1
|
+
import * as react from 'react';
|
|
3
2
|
import { ReactElement } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Metadata } from 'next';
|
|
4
|
+
import { O as OgManifestLike } from '../../../route-metadata-og-image-BeKKFHg7.js';
|
|
5
|
+
import { RootPageProps, ManifestLike } from '../../../types.js';
|
|
6
6
|
|
|
7
7
|
type RootPageComponent = (props: RootPageProps) => ReactElement | Promise<ReactElement>;
|
|
8
8
|
type RootRouteConfig = {
|
|
@@ -10,7 +10,7 @@ type RootRouteConfig = {
|
|
|
10
10
|
ogManifest?: OgManifestLike;
|
|
11
11
|
RootPage: RootPageComponent;
|
|
12
12
|
};
|
|
13
|
-
declare function createRootPage({ manifest, RootPage }: RootRouteConfig): () => Promise<
|
|
13
|
+
declare function createRootPage({ manifest, RootPage }: RootRouteConfig): () => Promise<react.JSX.Element>;
|
|
14
14
|
declare function createRootMetadata({ manifest, ogManifest, }: RootRouteConfig): Metadata;
|
|
15
15
|
|
|
16
16
|
export { type RootPageComponent, type RootRouteConfig, createRootMetadata, createRootPage };
|
|
@@ -21,7 +21,8 @@ var isDev = process.env.NODE_ENV !== "production", isDebugEnabled = process.env.
|
|
|
21
21
|
// src/lib/runtime/metadata/canonical-url.ts
|
|
22
22
|
function canonicalUrl(manifest, path, group) {
|
|
23
23
|
let origin = (group && manifest.groups[group]?.origin) ?? manifest.site.origin;
|
|
24
|
-
if (!origin)
|
|
24
|
+
if (!origin)
|
|
25
|
+
return /^[a-z][a-z\d+.-]*:/i.test(path) ? path : new URL(path, "https://publish.invalid").pathname;
|
|
25
26
|
try {
|
|
26
27
|
return new URL(path, `${origin}/`).toString();
|
|
27
28
|
} catch {
|
|
@@ -44,7 +45,12 @@ function agentReadableAlternates({
|
|
|
44
45
|
return {
|
|
45
46
|
...canonical.startsWith("http") ? { canonical } : {},
|
|
46
47
|
types: {
|
|
47
|
-
...markdownPath ? {
|
|
48
|
+
...markdownPath ? {
|
|
49
|
+
"text/markdown": new URL(
|
|
50
|
+
normalizePath(markdownPath),
|
|
51
|
+
"https://publish.invalid"
|
|
52
|
+
).pathname
|
|
53
|
+
} : {},
|
|
48
54
|
"text/plain": "/llms.txt"
|
|
49
55
|
}
|
|
50
56
|
};
|
|
@@ -98,12 +104,21 @@ function createSocialMetadata({
|
|
|
98
104
|
};
|
|
99
105
|
}
|
|
100
106
|
|
|
107
|
+
// src/lib/shared/root-content-group.ts
|
|
108
|
+
var ROOT_CONTENT_GROUP_KEY = "__root";
|
|
109
|
+
|
|
101
110
|
// src/route-page-root.tsx
|
|
102
|
-
import { jsx } from "
|
|
111
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
103
112
|
var rootManifest, rootPage;
|
|
104
113
|
async function CachedRootPage() {
|
|
105
114
|
"use cache";
|
|
106
|
-
|
|
115
|
+
if (cacheLife("page"), cacheTag(tags.site()), !rootManifest || !rootPage) return null;
|
|
116
|
+
cacheTag(tags.manifest(rootManifest.contentHash)), log.debug("[cache]", "root");
|
|
117
|
+
let RootPage = rootPage, navigation = rootManifest.groups[ROOT_CONTENT_GROUP_KEY]?.navigation ?? {
|
|
118
|
+
rootGroup: ROOT_CONTENT_GROUP_KEY,
|
|
119
|
+
items: []
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ jsx(RootPage, { site: rootManifest.site, navigation });
|
|
107
122
|
}
|
|
108
123
|
function createRootPage({ manifest, RootPage }) {
|
|
109
124
|
return rootManifest = manifest, rootPage = RootPage, async function() {
|
|
@@ -125,10 +140,10 @@ function createRootMetadata({
|
|
|
125
140
|
}),
|
|
126
141
|
...createSocialMetadata({
|
|
127
142
|
canonicalPath: "/",
|
|
128
|
-
description,
|
|
143
|
+
description: manifest.site.metadata?.openGraph?.description ?? description,
|
|
129
144
|
manifest,
|
|
130
145
|
ogManifest,
|
|
131
|
-
title: manifest.site.name
|
|
146
|
+
title: manifest.site.metadata?.openGraph?.title ?? manifest.site.name
|
|
132
147
|
})
|
|
133
148
|
};
|
|
134
149
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type Modifier = "mod" | "meta" | "ctrl" | "alt" | "shift";
|
|
@@ -26,7 +26,7 @@ type ShortcutRegistryApi = {
|
|
|
26
26
|
};
|
|
27
27
|
declare function KeyboardShortcutsProvider({ children, }: {
|
|
28
28
|
children: ReactNode;
|
|
29
|
-
}):
|
|
29
|
+
}): react.JSX.Element;
|
|
30
30
|
declare function useShortcut(combo: string | readonly string[], handler: ShortcutHandler, options?: ShortcutOptions): void;
|
|
31
31
|
declare function useShortcutRegistry(): ShortcutRegistryApi;
|
|
32
32
|
declare function formatShortcut(source: string): string[];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
type OgImageMetadata = string | {
|
|
2
|
+
src: string;
|
|
3
|
+
alt?: string;
|
|
4
|
+
};
|
|
5
|
+
type OgMetadata = {
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
image?: OgImageMetadata;
|
|
9
|
+
};
|
|
10
|
+
type PageStatus = "published" | "draft";
|
|
11
|
+
type PageMetadata = {
|
|
12
|
+
openGraph?: OgMetadata;
|
|
13
|
+
robots?: {
|
|
14
|
+
index?: boolean;
|
|
15
|
+
follow?: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
type PageFrontmatter<TCustom extends Record<string, unknown> = Record<string, unknown>> = TCustom & {
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
slug: string;
|
|
22
|
+
status: PageStatus;
|
|
23
|
+
metadata: PageMetadata;
|
|
24
|
+
};
|
|
25
|
+
type PageData<TCustom extends Record<string, unknown> = Record<string, unknown>> = {
|
|
26
|
+
fileID: string;
|
|
27
|
+
group: string;
|
|
28
|
+
path: string;
|
|
29
|
+
frontmatter: PageFrontmatter<TCustom>;
|
|
30
|
+
body: string;
|
|
31
|
+
};
|
|
32
|
+
type NavigationPageNode = {
|
|
33
|
+
id: string;
|
|
34
|
+
type: "page";
|
|
35
|
+
label: string;
|
|
36
|
+
href: string;
|
|
37
|
+
page: Omit<PageData, "body">;
|
|
38
|
+
children?: NavigationNode[];
|
|
39
|
+
};
|
|
40
|
+
type NavigationGroupNode = {
|
|
41
|
+
id: string;
|
|
42
|
+
type: "group";
|
|
43
|
+
label: string;
|
|
44
|
+
groupKey: string;
|
|
45
|
+
route: string;
|
|
46
|
+
presentation: "page" | "folder";
|
|
47
|
+
href?: string;
|
|
48
|
+
children: NavigationNode[];
|
|
49
|
+
};
|
|
50
|
+
type NavigationContainerNode = {
|
|
51
|
+
id: string;
|
|
52
|
+
type: "section" | "folder";
|
|
53
|
+
label: string;
|
|
54
|
+
children: NavigationNode[];
|
|
55
|
+
};
|
|
56
|
+
type NavigationLinkNode = {
|
|
57
|
+
id: string;
|
|
58
|
+
type: "link";
|
|
59
|
+
label: string;
|
|
60
|
+
href: string;
|
|
61
|
+
};
|
|
62
|
+
type NavigationViewNode = {
|
|
63
|
+
id: string;
|
|
64
|
+
type: "view";
|
|
65
|
+
label?: string;
|
|
66
|
+
viewId?: string;
|
|
67
|
+
items: NavigationNode[];
|
|
68
|
+
};
|
|
69
|
+
type NavigationSwitchViewNode = {
|
|
70
|
+
id: string;
|
|
71
|
+
type: "switch-view";
|
|
72
|
+
label: string;
|
|
73
|
+
target: string | {
|
|
74
|
+
view: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
type NavigationNode = NavigationPageNode | NavigationGroupNode | NavigationContainerNode | NavigationLinkNode | NavigationViewNode | NavigationSwitchViewNode;
|
|
78
|
+
type ResolvedNavigation = {
|
|
79
|
+
rootGroup: string;
|
|
80
|
+
items: NavigationNode[];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type { ResolvedNavigation as R };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react__default from 'react';
|
|
2
2
|
import { IndexPageProps, PageProps, ManifestLike, LayoutProps } from '../types.js';
|
|
3
3
|
|
|
4
4
|
type ResolvedLeaf = PageProps;
|
|
5
5
|
type ResolvedGroup = Omit<IndexPageProps, "children">;
|
|
6
6
|
declare function resolveLeaf(manifest: ManifestLike, group: string, slug: string | string[]): ResolvedLeaf | null;
|
|
7
7
|
declare function resolveGroup(manifest: ManifestLike, group: string): ResolvedGroup | null;
|
|
8
|
-
declare function resolveGroupLayout(manifest: ManifestLike, group: string, children:
|
|
8
|
+
declare function resolveGroupLayout(manifest: ManifestLike, group: string, children: react__default.ReactNode): LayoutProps | null;
|
|
9
9
|
declare function listStaticParams(manifest: ManifestLike, group: string): Array<{
|
|
10
10
|
slug: string[];
|
|
11
11
|
}>;
|