@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.91
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/layout.tsx +1 -5
- package/compiler-assets/nextjs/defaults/group/page.tsx +31 -22
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +19 -10
- 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/shims/document.tsx +38 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +2 -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 +126 -60
- 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-5QMLXF7N.js} +29 -23
- package/dist/{button-c3WGnxIj.d.ts → button-BdCScEKi.d.ts} +3 -3
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -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-EFO6AWXN.js +19 -0
- package/dist/{chunk-726GV2NF.js → chunk-F3AGNDF4.js} +100 -67
- package/dist/chunk-GBPLER5H.js +426 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
- package/dist/{chunk-VO2I7MTM.js → chunk-ORIUWJBQ.js} +8 -6
- package/dist/{chunk-H6XILMZX.js → chunk-OXOFRXEI.js} +1806 -831
- package/dist/chunk-UYGCOWRF.js +1709 -0
- package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
- package/dist/compiler.d.ts +15 -2
- package/dist/compiler.js +90 -21
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +594 -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 +5 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-CVBJRAF6.js +16 -0
- package/dist/config/createNextConfig.js +17 -3
- package/dist/{dev-operation-TZDVJCN7.js → dev-operation-OSHHWRWK.js} +121 -81
- package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
- package/dist/ide-support-CU6Z5PVR.js +16 -0
- package/dist/index.d.ts +40 -1
- 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 +35 -6
- package/dist/kernel/components/blocks/AgentActions.js +383 -142
- package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
- package/dist/kernel/components/blocks/agent-actions.js +594 -0
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.js +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -2
- package/dist/kernel/components/blocks/navbar.js +17 -17
- package/dist/kernel/components/blocks/navigation-progress.js +2 -2
- package/dist/kernel/components/blocks/next-prev.js +1 -1
- package/dist/kernel/components/blocks/page-list.js +2 -2
- package/dist/kernel/components/blocks/search.d.ts +1 -1
- package/dist/kernel/components/blocks/search.js +16 -17
- package/dist/kernel/components/blocks/sidebar-node.js +1 -1
- package/dist/kernel/components/blocks/sidebar.js +7 -4
- package/dist/kernel/components/blocks/theme-toggle.d.ts +1 -1
- 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 +19 -1
- package/dist/kernel/components/blocks/toc.js +121 -179
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.js +1 -1
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
- package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
- package/dist/kernel/components/mdx/components/figure.js +23 -13
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +1 -1
- package/dist/kernel/components/mdx/components/image.d.ts +1 -1
- package/dist/kernel/components/mdx/components/image.js +21 -16
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +3 -3
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +1 -1
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +1 -1
- package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
- package/dist/kernel/components/mdx/components/video-player.js +6 -2
- package/dist/kernel/components/mdx/components/video.d.ts +5 -3
- package/dist/kernel/components/mdx/components/video.js +7 -5
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +20 -10
- package/dist/kernel/components/mdx/mdx.js +231 -34
- 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.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +2 -2
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb.js +4 -4
- package/dist/kernel/components/ui/button-group.d.ts +1 -1
- package/dist/kernel/components/ui/button-group.js +3 -3
- package/dist/kernel/components/ui/button.d.ts +56 -4
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.js +1 -1
- 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 +1 -1
- package/dist/kernel/components/ui/kbd.js +1 -1
- package/dist/kernel/components/ui/link.d.ts +8 -2
- package/dist/kernel/components/ui/link.js +2 -2
- package/dist/kernel/components/ui/menu.js +1 -1
- package/dist/kernel/components/ui/mod-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.js +1 -1
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +8 -8
- package/dist/kernel/components/ui/scroll-area.js +1 -1
- package/dist/kernel/components/ui/select.js +1 -1
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +1 -1
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +2 -15
- package/dist/kernel/defaults.registry.js +2 -17
- package/dist/kernel/routes/agent/markdown.d.ts +3 -0
- package/dist/kernel/routes/agent/markdown.js +219 -48
- 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 -1
- package/dist/kernel/routes/metadata/feed.js +109 -83
- package/dist/kernel/routes/metadata/llms.d.ts +11 -3
- package/dist/kernel/routes/metadata/llms.js +154 -57
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +1 -1
- package/dist/kernel/routes/metadata/sitemap.d.ts +22 -3
- package/dist/kernel/routes/metadata/sitemap.js +183 -43
- 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 +2 -2
- package/dist/kernel/routes/pages/group.js +1 -1
- package/dist/kernel/routes/pages/leaf.d.ts +30 -3
- package/dist/kernel/routes/pages/leaf.js +5 -4
- package/dist/kernel/routes/pages/root.d.ts +2 -2
- package/dist/kernel/routes/pages/root.js +1 -1
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.js +7 -9
- package/dist/theme-scope.js +1 -1
- package/dist/{types-BzkZty3r.d.ts → types-J2w_puPF.d.ts} +1 -20
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +1 -0
- 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-SV44DBQT.js +16 -0
- package/dist/validate-publish-os-source-NZJF3TB2.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 +82 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -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 +6 -2
- package/init/seed/minimal/publish.os/theme.css +3 -3
- package/init/seed/minimal/seed.json +11 -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 +45 -20
- package/release/app/phosphor/package.json +3 -3
- package/release/app/phosphor/pnpm-lock.yaml.template +88 -75
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +118 -74
- 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/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
|
@@ -13,6 +13,93 @@ function canonicalUrl(manifest, path, group) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
// src/lib/runtime/metadata/discovery-content.ts
|
|
17
|
+
function discoveryOrigin(manifest, group) {
|
|
18
|
+
return (group ? manifest.groups[group]?.origin : void 0) ?? manifest.site.origin;
|
|
19
|
+
}
|
|
20
|
+
function pathWithin(path, basePath) {
|
|
21
|
+
return basePath === "/" || path === basePath || path.startsWith(`${basePath}/`);
|
|
22
|
+
}
|
|
23
|
+
function discoveryPages({
|
|
24
|
+
manifest,
|
|
25
|
+
group,
|
|
26
|
+
scope,
|
|
27
|
+
limit
|
|
28
|
+
}) {
|
|
29
|
+
let origin = discoveryOrigin(manifest, group), basePath = group ? manifest.groups[group]?.path ?? "/" : "/", pages = manifest.pages.filter((page) => page.status !== "published" || discoveryOrigin(manifest, page.group) !== origin ? !1 : !group || scope === "site" ? !0 : pathWithin(page.path, basePath) ? page.group === group || scope !== "self" && page.group.startsWith(`${group}/`) : !1);
|
|
30
|
+
return limit ? pages.slice(0, limit) : pages;
|
|
31
|
+
}
|
|
32
|
+
function groupDiscoveryPages({
|
|
33
|
+
manifest,
|
|
34
|
+
pages
|
|
35
|
+
}) {
|
|
36
|
+
let sections = /* @__PURE__ */ new Map();
|
|
37
|
+
for (let page of pages) {
|
|
38
|
+
let group = manifest.groups[page.group], key = group ? page.group : "", section = sections.get(key);
|
|
39
|
+
section || (section = {
|
|
40
|
+
...group ? { group: page.group } : {},
|
|
41
|
+
title: group ? group.key === "__root" ? manifest.site.name : group.title : "Pages",
|
|
42
|
+
pages: []
|
|
43
|
+
}, sections.set(key, section)), section.pages.push(page);
|
|
44
|
+
}
|
|
45
|
+
return [...sections.values()].sort(
|
|
46
|
+
(a, b) => (manifest.groups[a.group ?? ""]?.path ?? "/").localeCompare(
|
|
47
|
+
manifest.groups[b.group ?? ""]?.path ?? "/"
|
|
48
|
+
) || a.title.localeCompare(b.title)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/lib/runtime/metadata/llms-serialization.ts
|
|
53
|
+
function inlineText(value) {
|
|
54
|
+
return value.replace(/[\r\n]+/g, " ").replace(/([\\`*_[\]<>])/g, "\\$1");
|
|
55
|
+
}
|
|
56
|
+
function markdownLink(link) {
|
|
57
|
+
let url = link.url.replace(
|
|
58
|
+
/[\s()<>]/g,
|
|
59
|
+
(value) => value === "(" ? "%28" : value === ")" ? "%29" : encodeURIComponent(value)
|
|
60
|
+
);
|
|
61
|
+
return `[${inlineText(link.title)}](${url})`;
|
|
62
|
+
}
|
|
63
|
+
function serializeLlmsIndex(input) {
|
|
64
|
+
let body = (input.sections ?? [
|
|
65
|
+
{ title: "Pages", pages: input.pages ?? [] }
|
|
66
|
+
]).map((section) => {
|
|
67
|
+
let lines = [
|
|
68
|
+
...(section.links ?? []).map((link) => `- ${markdownLink(link)}`),
|
|
69
|
+
...section.pages.map((page) => {
|
|
70
|
+
let description = input.includeDescriptions && page.description ? `: ${inlineText(page.description)}` : "", alternate = page.alternate ? ` (${markdownLink(page.alternate)})` : "";
|
|
71
|
+
return `- ${markdownLink(page)}${alternate}${description}`;
|
|
72
|
+
})
|
|
73
|
+
];
|
|
74
|
+
return `## ${inlineText(section.title)}
|
|
75
|
+
|
|
76
|
+
${lines.join(`
|
|
77
|
+
`)}`;
|
|
78
|
+
}).join(`
|
|
79
|
+
|
|
80
|
+
`), linkLines = (input.links ?? []).map(
|
|
81
|
+
(link) => `- ${markdownLink(link)}`
|
|
82
|
+
), linkSection = linkLines.length ? `
|
|
83
|
+
|
|
84
|
+
## Group LLM indexes
|
|
85
|
+
|
|
86
|
+
${linkLines.join(`
|
|
87
|
+
`)}` : "", otherGroupLines = (input.otherGroupLinks ?? []).map(
|
|
88
|
+
(link) => `- ${markdownLink(link)}`
|
|
89
|
+
), otherGroupSection = otherGroupLines.length ? `
|
|
90
|
+
|
|
91
|
+
## Other content groups
|
|
92
|
+
|
|
93
|
+
${otherGroupLines.join(`
|
|
94
|
+
`)}` : "";
|
|
95
|
+
return `# ${inlineText(input.title)}
|
|
96
|
+
|
|
97
|
+
> ${inlineText(input.summary)}
|
|
98
|
+
|
|
99
|
+
${body}${linkSection}${otherGroupSection}
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
|
|
16
103
|
// src/lib/runtime/response/cached-text-response.ts
|
|
17
104
|
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";
|
|
18
105
|
function cacheControl(policy) {
|
|
@@ -36,32 +123,53 @@ function createCachedTextResponse(options) {
|
|
|
36
123
|
// src/route-metadata-sitemap.ts
|
|
37
124
|
var ROOT_CONTENT_GROUP_KEY = "__root";
|
|
38
125
|
function xmlEscape(value) {
|
|
39
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
126
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/"/g, """);
|
|
40
127
|
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
function pathInScope(path, basePath) {
|
|
45
|
-
return basePath === "/" || path === basePath || path.startsWith(`${basePath}/`);
|
|
128
|
+
function sitemapDirectory(path) {
|
|
129
|
+
return path.slice(0, path.lastIndexOf("/") + 1) || "/";
|
|
46
130
|
}
|
|
47
131
|
function rootMountedGroup(manifest, origin) {
|
|
48
132
|
return Object.values(manifest.groups).find(
|
|
49
|
-
(group) => group.key !== ROOT_CONTENT_GROUP_KEY && group.path === "/" &&
|
|
133
|
+
(group) => group.key !== ROOT_CONTENT_GROUP_KEY && group.path === "/" && discoveryOrigin(manifest, group.key) === origin
|
|
50
134
|
);
|
|
51
135
|
}
|
|
52
136
|
async function sitemapXml(manifest, options) {
|
|
53
137
|
"use cache";
|
|
54
138
|
cacheLife("page"), cacheTag(tags.site(), tags.sitemap(), tags.manifest(manifest.contentHash));
|
|
55
|
-
let targetGroup = options.group ? manifest.groups[options.group] : void 0,
|
|
56
|
-
|
|
139
|
+
let targetGroup = options.group ? manifest.groups[options.group] : void 0, directory = sitemapDirectory(
|
|
140
|
+
options.path ?? `${targetGroup?.path === "/" ? "" : targetGroup?.path ?? ""}/sitemap.xml`
|
|
141
|
+
), origin = targetGroup ? discoveryOrigin(manifest, targetGroup.key) : manifest.site.origin;
|
|
142
|
+
if (options.sitemaps)
|
|
143
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
144
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
145
|
+
${[
|
|
146
|
+
...new Set(
|
|
147
|
+
options.sitemaps.filter(
|
|
148
|
+
(sitemap) => discoveryOrigin(manifest, sitemap.group) === origin
|
|
149
|
+
).filter(
|
|
150
|
+
(sitemap) => sitemap.path.startsWith(directory) && sitemap.path !== options.path
|
|
151
|
+
).map(
|
|
152
|
+
(sitemap) => canonicalUrl(manifest, sitemap.path, sitemap.group)
|
|
153
|
+
)
|
|
154
|
+
)
|
|
155
|
+
].map((url) => ` <sitemap><loc>${xmlEscape(url)}</loc></sitemap>`).join(`
|
|
156
|
+
`)}
|
|
157
|
+
</sitemapindex>
|
|
158
|
+
`;
|
|
159
|
+
let homeGroup = targetGroup ?? rootMountedGroup(manifest, origin), groups = Object.values(manifest.groups).filter(
|
|
160
|
+
(group) => discoveryOrigin(manifest, group.key) === origin && (directory === "/" || group.path.startsWith(directory))
|
|
57
161
|
), urls = [
|
|
58
162
|
{
|
|
59
163
|
path: homeGroup?.path ?? "/",
|
|
60
164
|
group: homeGroup?.key
|
|
61
165
|
},
|
|
62
166
|
...groups.map((group) => ({ path: group.path, group: group.key })),
|
|
63
|
-
...manifest.pages.filter((page) => page.status === "published").filter((page) =>
|
|
64
|
-
]
|
|
167
|
+
...manifest.pages.filter((page) => page.status === "published").filter((page) => discoveryOrigin(manifest, page.group) === origin).map((page) => ({ path: page.path, group: page.group }))
|
|
168
|
+
].filter(
|
|
169
|
+
({ path }) => (directory === "/" || path.startsWith(directory)) && !(options.exclude ?? []).some(
|
|
170
|
+
(sitemap) => discoveryOrigin(manifest, sitemap.group) === origin && path.startsWith(sitemapDirectory(sitemap.path))
|
|
171
|
+
)
|
|
172
|
+
);
|
|
65
173
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
66
174
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
67
175
|
${[...new Map(
|
|
@@ -82,42 +190,74 @@ function createSitemapXmlRoute(manifest, options = {}) {
|
|
|
82
190
|
});
|
|
83
191
|
};
|
|
84
192
|
}
|
|
85
|
-
async function sitemapMarkdown(manifest, artifactManifest) {
|
|
86
|
-
let origin = manifest.
|
|
87
|
-
(group) =>
|
|
88
|
-
), pages =
|
|
89
|
-
|
|
90
|
-
|
|
193
|
+
async function sitemapMarkdown(manifest, artifactManifest, options) {
|
|
194
|
+
let origin = discoveryOrigin(manifest, options.group), targetGroup = options.group ? manifest.groups[options.group] : void 0, rootGroup = targetGroup?.key === ROOT_CONTENT_GROUP_KEY ? void 0 : targetGroup ?? rootMountedGroup(manifest, origin), groups = Object.values(manifest.groups).filter((group) => group.key !== ROOT_CONTENT_GROUP_KEY).filter((group) => discoveryOrigin(manifest, group.key) === origin).filter(
|
|
195
|
+
(group) => !targetGroup || options.scope === "site" || pathWithin(group.path, targetGroup.path) && (group.key === targetGroup.key || options.scope !== "self" && group.key.startsWith(`${targetGroup.key}/`))
|
|
196
|
+
), pages = discoveryPages({ manifest, ...options }).sort(
|
|
197
|
+
(a, b) => a.path.localeCompare(b.path)
|
|
198
|
+
), sections = groupDiscoveryPages({ manifest, pages });
|
|
199
|
+
for (let group of groups)
|
|
200
|
+
sections.some((section) => section.group === group.key) || sections.push({ group: group.key, title: group.title, pages: [] });
|
|
201
|
+
sections.sort(
|
|
202
|
+
(a, b) => (manifest.groups[a.group ?? ""]?.path ?? "/").localeCompare(
|
|
203
|
+
manifest.groups[b.group ?? ""]?.path ?? "/"
|
|
204
|
+
)
|
|
205
|
+
);
|
|
206
|
+
let links = options.links ?? [
|
|
207
|
+
{ title: "LLMS index", path: "/llms.txt" },
|
|
208
|
+
{ title: "Full LLMS index", path: "/llms-full.txt" },
|
|
209
|
+
{ title: "XML sitemap", path: "/sitemap.xml" }
|
|
210
|
+
];
|
|
211
|
+
return serializeLlmsIndex({
|
|
212
|
+
title: `${rootGroup?.title ?? manifest.site.name} Sitemap`,
|
|
213
|
+
summary: "Browse the published pages and their available Markdown versions.",
|
|
214
|
+
sections: [
|
|
215
|
+
...links.length ? [
|
|
216
|
+
{
|
|
217
|
+
title: "Agent indexes",
|
|
218
|
+
pages: [],
|
|
219
|
+
links: links.map((link) => ({
|
|
220
|
+
title: link.title,
|
|
221
|
+
url: canonicalUrl(manifest, link.path, link.group)
|
|
222
|
+
}))
|
|
223
|
+
}
|
|
224
|
+
] : [],
|
|
225
|
+
...sections.map((section) => {
|
|
226
|
+
let group = manifest.groups[section.group ?? ""];
|
|
227
|
+
return {
|
|
228
|
+
title: section.title,
|
|
229
|
+
links: group && group.key !== ROOT_CONTENT_GROUP_KEY ? [
|
|
230
|
+
{
|
|
231
|
+
title: group.title,
|
|
232
|
+
url: canonicalUrl(manifest, group.path, group.key)
|
|
233
|
+
}
|
|
234
|
+
] : [],
|
|
235
|
+
pages: section.pages.map((page) => {
|
|
236
|
+
let markdownPath = options.markdownAlternates === !1 ? void 0 : artifactManifest.byHtmlPath[page.path];
|
|
237
|
+
return {
|
|
238
|
+
title: page.title,
|
|
239
|
+
url: canonicalUrl(manifest, page.path, page.group),
|
|
240
|
+
...markdownPath ? {
|
|
241
|
+
alternate: {
|
|
242
|
+
title: "Markdown",
|
|
243
|
+
url: canonicalUrl(manifest, markdownPath, page.group)
|
|
244
|
+
}
|
|
245
|
+
} : {}
|
|
246
|
+
};
|
|
247
|
+
})
|
|
248
|
+
};
|
|
249
|
+
})
|
|
250
|
+
],
|
|
251
|
+
otherGroupLinks: options.otherGroupLinks?.map((link) => ({
|
|
252
|
+
title: link.title,
|
|
253
|
+
url: canonicalUrl(manifest, link.path, link.group)
|
|
254
|
+
}))
|
|
91
255
|
});
|
|
92
|
-
return [
|
|
93
|
-
`# ${rootGroup?.title ?? manifest.site.name} Sitemap`,
|
|
94
|
-
"## Agent indexes",
|
|
95
|
-
`- [LLMS index](${canonicalUrl(manifest, "/llms.txt")})`,
|
|
96
|
-
`- [Full LLMS index](${canonicalUrl(manifest, "/llms-full.txt")})`,
|
|
97
|
-
`- [XML sitemap](${canonicalUrl(manifest, "/sitemap.xml")})`,
|
|
98
|
-
"## Sections",
|
|
99
|
-
groups.length ? groups.join(`
|
|
100
|
-
`) : `- [${rootGroup?.title ?? "Home"}](${canonicalUrl(
|
|
101
|
-
manifest,
|
|
102
|
-
rootGroup?.path ?? "/",
|
|
103
|
-
rootGroup?.key
|
|
104
|
-
)})`,
|
|
105
|
-
"## Pages",
|
|
106
|
-
pages.length ? pages.join(`
|
|
107
|
-
`) : `- [${rootGroup?.title ?? "Home"}](${canonicalUrl(
|
|
108
|
-
manifest,
|
|
109
|
-
rootGroup?.path ?? "/",
|
|
110
|
-
rootGroup?.key
|
|
111
|
-
)})`,
|
|
112
|
-
""
|
|
113
|
-
].join(`
|
|
114
|
-
|
|
115
|
-
`);
|
|
116
256
|
}
|
|
117
|
-
function createSitemapMarkdownRoute(manifest, artifactManifest) {
|
|
257
|
+
function createSitemapMarkdownRoute(manifest, artifactManifest, options = {}) {
|
|
118
258
|
return async function() {
|
|
119
259
|
return createCachedTextResponse({
|
|
120
|
-
body: await sitemapMarkdown(manifest, artifactManifest),
|
|
260
|
+
body: await sitemapMarkdown(manifest, artifactManifest, options),
|
|
121
261
|
contentType: "text/markdown; charset=utf-8"
|
|
122
262
|
});
|
|
123
263
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type NotFoundLink = {
|
|
2
|
+
title: string;
|
|
3
|
+
href: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
kind?: "sitemap" | "sitemap-md" | "llms" | "llms-full";
|
|
6
|
+
};
|
|
7
|
+
type NotFoundScope = {
|
|
8
|
+
id: string;
|
|
9
|
+
path: string;
|
|
10
|
+
group?: string;
|
|
11
|
+
origin?: string;
|
|
12
|
+
describedBy?: string;
|
|
13
|
+
htmlPath: string;
|
|
14
|
+
recommendations: readonly NotFoundLink[];
|
|
15
|
+
indexes: readonly NotFoundLink[];
|
|
16
|
+
markdown: string;
|
|
17
|
+
};
|
|
18
|
+
declare function resolveNotFoundScope({ scopes, pathname, }: {
|
|
19
|
+
scopes: readonly NotFoundScope[];
|
|
20
|
+
pathname: string;
|
|
21
|
+
}): NotFoundScope | undefined;
|
|
22
|
+
declare function serializeNotFoundMarkdown({ recommendations, indexes, }: {
|
|
23
|
+
recommendations: readonly NotFoundLink[];
|
|
24
|
+
indexes: readonly NotFoundLink[];
|
|
25
|
+
}): string;
|
|
26
|
+
declare function createNotFoundTextResponse({ scope, pathname, method, contentType, vary, }: {
|
|
27
|
+
scope?: NotFoundScope;
|
|
28
|
+
pathname?: string;
|
|
29
|
+
method: string;
|
|
30
|
+
contentType?: "text/markdown; charset=utf-8" | "text/plain; charset=utf-8";
|
|
31
|
+
vary?: boolean;
|
|
32
|
+
}): Response;
|
|
33
|
+
|
|
34
|
+
export { type NotFoundLink, type NotFoundScope, createNotFoundTextResponse, resolveNotFoundScope, serializeNotFoundMarkdown };
|
|
@@ -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);
|
|
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
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Metadata } from 'next';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
|
-
import { OgManifestLike } from '
|
|
5
|
-
import {
|
|
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 = {
|
|
@@ -101,7 +101,7 @@ function createSocialMetadata({
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// src/route-page-group.tsx
|
|
104
|
-
import { jsx } from "
|
|
104
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
105
105
|
var manifests = /* @__PURE__ */ new Map(), indexPages = /* @__PURE__ */ new Map();
|
|
106
106
|
async function CachedGroupPage({ group }) {
|
|
107
107
|
"use cache";
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Metadata } from 'next';
|
|
3
3
|
import { ReactElement, ReactNode } from 'react';
|
|
4
|
-
import { OgManifestLike } from '
|
|
5
|
-
import {
|
|
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
|
+
title: string;
|
|
15
|
+
};
|
|
16
|
+
type MarkdownRouteArtifactIndexEntry = Omit<MarkdownRouteArtifact, "body"> & {
|
|
17
|
+
shardId: string;
|
|
18
|
+
};
|
|
19
|
+
type MarkdownRouteArtifactIndex = Record<string, MarkdownRouteArtifactIndexEntry>;
|
|
20
|
+
type MarkdownRouteArtifactShardMetadata = {
|
|
21
|
+
byteSize: number;
|
|
22
|
+
contentHash: string;
|
|
23
|
+
id: string;
|
|
24
|
+
modulePath: string;
|
|
25
|
+
pageCount: number;
|
|
26
|
+
};
|
|
27
|
+
type MarkdownRouteArtifactManifest = {
|
|
28
|
+
byHtmlPath: Record<string, string>;
|
|
29
|
+
byMarkdownPath: MarkdownRouteArtifactIndex;
|
|
30
|
+
shards: MarkdownRouteArtifactShardMetadata[];
|
|
31
|
+
};
|
|
6
32
|
|
|
7
33
|
type LeafComponent = (props: PageProps) => ReactElement | Promise<ReactElement>;
|
|
8
34
|
type PoweredByFooterComponent = (props: {
|
|
@@ -11,6 +37,7 @@ type PoweredByFooterComponent = (props: {
|
|
|
11
37
|
type LeafRouteConfig = {
|
|
12
38
|
group: string;
|
|
13
39
|
manifest: ManifestLike;
|
|
40
|
+
markdownArtifactManifest?: Pick<MarkdownRouteArtifactManifest, "byMarkdownPath">;
|
|
14
41
|
ogManifest?: OgManifestLike;
|
|
15
42
|
Leaf: LeafComponent;
|
|
16
43
|
PoweredByFooter?: PoweredByFooterComponent;
|
|
@@ -27,7 +54,7 @@ declare function appendPoweredByFooter({ footer, node, }: {
|
|
|
27
54
|
node: ReactNode;
|
|
28
55
|
placed: boolean;
|
|
29
56
|
};
|
|
30
|
-
declare function createLeafPage({ group, manifest, Leaf, PoweredByFooter, }: LeafRouteConfig): ({ params }: PageRouteProps) => Promise<react_jsx_runtime.JSX.Element>;
|
|
57
|
+
declare function createLeafPage({ group, manifest, markdownArtifactManifest, Leaf, PoweredByFooter, }: LeafRouteConfig): ({ params }: PageRouteProps) => Promise<react_jsx_runtime.JSX.Element>;
|
|
31
58
|
declare function createLeafMetadata({ group, manifest, ogManifest, }: LeafRouteConfig): ({ params, }: PageRouteProps) => Promise<Metadata>;
|
|
32
59
|
declare function createLeafStaticParams({ group, manifest }: LeafRouteConfig): () => {
|
|
33
60
|
slug: string[];
|
|
@@ -114,8 +114,8 @@ function createSocialMetadata({
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// src/route-page-leaf.tsx
|
|
117
|
-
import { jsx, jsxs } from "
|
|
118
|
-
var manifests = /* @__PURE__ */ new Map(), leaves = /* @__PURE__ */ new Map(), poweredByFooters = /* @__PURE__ */ new Map();
|
|
117
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
118
|
+
var manifests = /* @__PURE__ */ new Map(), markdownArtifactIndexes = /* @__PURE__ */ new Map(), leaves = /* @__PURE__ */ new Map(), poweredByFooters = /* @__PURE__ */ new Map();
|
|
119
119
|
function hasClassName(value, className) {
|
|
120
120
|
return typeof value == "string" && value.split(/\s+/).includes(className);
|
|
121
121
|
}
|
|
@@ -204,7 +204,7 @@ async function CachedLeafPage({
|
|
|
204
204
|
(!manifest || !Leaf) && notFound(), cacheTag(tags.manifest(manifest.contentHash)), log.debug("[cache]", `${group}/${slug.join("/")}`);
|
|
205
205
|
let resolved = resolveLeaf(manifest, group, slug);
|
|
206
206
|
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 };
|
|
207
|
+
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
208
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-full min-w-0 flex-1 flex-col", children: [
|
|
209
209
|
placed.node,
|
|
210
210
|
footer && !placed.placed ? footer : null
|
|
@@ -213,10 +213,11 @@ async function CachedLeafPage({
|
|
|
213
213
|
function createLeafPage({
|
|
214
214
|
group,
|
|
215
215
|
manifest,
|
|
216
|
+
markdownArtifactManifest,
|
|
216
217
|
Leaf,
|
|
217
218
|
PoweredByFooter
|
|
218
219
|
}) {
|
|
219
|
-
return manifests.set(group, manifest), leaves.set(group, Leaf), PoweredByFooter ? poweredByFooters.set(group, PoweredByFooter) : poweredByFooters.delete(group), async function({ params }) {
|
|
220
|
+
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
221
|
let { slug = [] } = await params;
|
|
221
222
|
return log.debug("[render]", `${group}/${slug.join("/")}`), /* @__PURE__ */ jsx(CachedLeafPage, { group, slug });
|
|
222
223
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Metadata } from 'next';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
|
-
import { OgManifestLike } from '
|
|
5
|
-
import {
|
|
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 = {
|
|
@@ -99,7 +99,7 @@ function createSocialMetadata({
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
// src/route-page-root.tsx
|
|
102
|
-
import { jsx } from "
|
|
102
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
103
103
|
var rootManifest, rootPage;
|
|
104
104
|
async function CachedRootPage() {
|
|
105
105
|
"use cache";
|