@publish.os/nextjs 0.0.1-alpha.91 → 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 -2
- package/compiler-assets/nextjs/defaults/group/page.tsx +7 -6
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +2 -1
- 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 +9 -1
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +3 -0
- package/compiler-assets/nextjs/shims/proxy.ts +156 -54
- package/dist/{build-operation-5QMLXF7N.js → build-operation-CJDUL4OW.js} +5 -5
- package/dist/{chunk-GBPLER5H.js → chunk-3T4HVDSC.js} +2 -2
- package/dist/{chunk-UYGCOWRF.js → chunk-DX7PXFCM.js} +860 -50
- package/dist/{chunk-F3AGNDF4.js → chunk-DZ3VWEV5.js} +860 -575
- package/dist/{chunk-OXOFRXEI.js → chunk-NHSLTARU.js} +1284 -1164
- package/dist/{chunk-ORIUWJBQ.js → chunk-SBMDONTV.js} +3 -2
- package/dist/compiler.js +42 -23
- package/dist/components/blocks/agent-actions.d.ts +7 -7
- package/dist/components/blocks/agent-actions.js +1 -32
- package/dist/components/blocks/toc.d.ts +7 -7
- package/dist/components/ui/button.d.ts +1 -2
- package/dist/{compose-CVBJRAF6.js → compose-44GJSMXD.js} +2 -2
- package/dist/config/createNextConfig.js +2 -0
- package/dist/{dev-operation-OSHHWRWK.js → dev-operation-WNECBHZ5.js} +17 -7
- package/dist/{ide-support-CU6Z5PVR.js → ide-support-TG74L4FF.js} +3 -3
- package/dist/index.d.ts +143 -126
- package/dist/index.js +25 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +7 -7
- package/dist/kernel/components/blocks/AgentActions.js +1 -32
- package/dist/kernel/components/blocks/agent-actions.d.ts +1 -2
- package/dist/kernel/components/blocks/agent-actions.js +1 -32
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
- package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
- package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
- package/dist/kernel/components/blocks/nav-breadcrumb.js +19 -13
- package/dist/kernel/components/blocks/navbar.d.ts +5 -4
- package/dist/kernel/components/blocks/navbar.js +62 -42
- package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
- package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
- package/dist/kernel/components/blocks/next-prev.js +29 -6
- package/dist/kernel/components/blocks/page-list.d.ts +4 -4
- package/dist/kernel/components/blocks/page-list.js +30 -7
- package/dist/kernel/components/blocks/search.d.ts +9 -15
- package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
- package/dist/kernel/components/blocks/sidebar-node.js +12 -2
- package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
- package/dist/kernel/components/blocks/sidebar.js +132 -26
- package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
- package/dist/kernel/components/blocks/toc-client.d.ts +7 -7
- package/dist/kernel/components/blocks/toc.d.ts +3 -3
- package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
- package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
- package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +2 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +3 -3
- package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
- package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.js +3 -2
- package/dist/kernel/components/mdx/components/image.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image.js +1 -1
- package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
- package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
- package/dist/kernel/components/mdx/components/link.d.ts +3 -3
- package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
- package/dist/kernel/components/mdx/components/table.d.ts +7 -7
- package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
- package/dist/kernel/components/mdx/components/video-player.d.ts +2 -2
- package/dist/kernel/components/mdx/components/video.d.ts +2 -3
- package/dist/kernel/components/mdx/error-boundary.d.ts +2 -3
- package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
- package/dist/kernel/components/mdx/mdx.d.ts +42 -11
- package/dist/kernel/components/mdx/mdx.js +1 -1
- package/dist/kernel/components/next-image.d.ts +3 -3
- package/dist/kernel/components/ui/accordion.d.ts +7 -7
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +2 -3
- package/dist/kernel/components/ui/breadcrumb.d.ts +13 -13
- package/dist/kernel/components/ui/button-group.d.ts +5 -5
- package/dist/kernel/components/ui/button.d.ts +3 -3
- package/dist/kernel/components/ui/card.d.ts +7 -7
- package/dist/kernel/components/ui/dialog.d.ts +10 -10
- package/dist/kernel/components/ui/drawer.d.ts +12 -12
- package/dist/kernel/components/ui/kbd.d.ts +3 -3
- package/dist/kernel/components/ui/link.d.ts +3 -3
- package/dist/kernel/components/ui/menu.d.ts +22 -22
- package/dist/kernel/components/ui/mod-key.d.ts +2 -3
- package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
- package/dist/kernel/components/ui/popover.d.ts +11 -11
- package/dist/kernel/components/ui/progress.d.ts +7 -7
- package/dist/kernel/components/ui/scroll-area.d.ts +1 -2
- package/dist/kernel/components/ui/select.d.ts +16 -16
- package/dist/kernel/components/ui/separator.d.ts +3 -3
- package/dist/kernel/components/ui/table.d.ts +7 -7
- package/dist/kernel/components/ui/tabs.d.ts +12 -12
- package/dist/kernel/components/ui/tag.d.ts +3 -3
- package/dist/kernel/components/ui/text.d.ts +4 -4
- package/dist/kernel/components/ui/toast.d.ts +11 -11
- package/dist/kernel/components/ui/tooltip.d.ts +9 -9
- package/dist/kernel/defaults.registry.d.ts +2 -2
- package/dist/kernel/defaults.registry.js +2 -2
- package/dist/kernel/routes/agent/markdown.d.ts +4 -0
- package/dist/kernel/routes/agent/markdown.js +11 -7
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +34 -29
- package/dist/kernel/routes/metadata/llms.d.ts +3 -31
- package/dist/kernel/routes/metadata/llms.js +2 -200
- 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 +15 -1
- package/dist/kernel/routes/metadata/sitemap.js +200 -112
- package/dist/kernel/routes/not-found.js +1 -1
- package/dist/kernel/routes/pages/group.d.ts +3 -3
- package/dist/kernel/routes/pages/group.js +10 -4
- package/dist/kernel/routes/pages/leaf.d.ts +9 -4
- package/dist/kernel/routes/pages/leaf.js +16 -8
- package/dist/kernel/routes/pages/root.d.ts +3 -3
- package/dist/kernel/routes/pages/root.js +20 -5
- package/dist/keyboard-shortcuts.d.ts +2 -2
- 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/search.d.ts +2 -9
- package/dist/search.js +2 -7
- package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
- package/dist/theme-scope.d.ts +2 -2
- package/dist/types-BbqmOzLC.d.ts +168 -0
- package/dist/types-TjH1ek0X.d.ts +22 -0
- package/dist/types.d.ts +116 -91
- package/dist/{validate-local-source-SV44DBQT.js → validate-local-source-EN2GW4FR.js} +3 -3
- package/dist/{validate-publish-os-source-NZJF3TB2.js → validate-publish-os-source-OEWQDB7B.js} +2 -2
- package/init/seed/minimal/publish.os/blog/index.tsx +25 -22
- package/init/seed/minimal/publish.os/blog/page.tsx +31 -16
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +1 -1
- package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
- package/init/seed/minimal/publish.os/publish.os.config.json +13 -2
- package/init/seed/minimal/seed.json +1 -0
- package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
- package/package.json +4 -4
- package/release/app/phosphor/package.json +1 -1
- package/release/app/phosphor/pnpm-lock.yaml.template +53 -127
- package/release/compiler/pnpm-lock.yaml.template +49 -123
- package/release/release.json +4 -4
- package/dist/sidebar-types-DKpR27II.d.ts +0 -25
- package/dist/types-CJWRG05y.d.ts +0 -76
- package/dist/types-CUtrppxt.d.ts +0 -69
- package/dist/types-J2w_puPF.d.ts +0 -128
- package/dist/{button-BdCScEKi.d.ts → button-D6Xp2HBm.d.ts} +1 -1
|
@@ -1,134 +1,3 @@
|
|
|
1
|
-
// src/route-metadata-llms.ts
|
|
2
|
-
import { tags } from "@publish.os/nextjs/cache/tags";
|
|
3
|
-
import { cacheLife, cacheTag } from "next/cache";
|
|
4
|
-
|
|
5
|
-
// src/lib/runtime/metadata/canonical-url.ts
|
|
6
|
-
function canonicalUrl(manifest, path, group) {
|
|
7
|
-
let origin = (group && manifest.groups[group]?.origin) ?? manifest.site.origin;
|
|
8
|
-
if (!origin) return path;
|
|
9
|
-
try {
|
|
10
|
-
return new URL(path, `${origin}/`).toString();
|
|
11
|
-
} catch {
|
|
12
|
-
return path;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
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
|
-
function serializeLlmsFull(input) {
|
|
103
|
-
let encoder = new TextEncoder(), byteLength = (value) => encoder.encode(value).byteLength, references = [
|
|
104
|
-
input.indexUrl ? `> LLMS index: ${input.indexUrl}` : void 0,
|
|
105
|
-
input.sitemapUrl ? `> Sitemap: ${input.sitemapUrl}` : void 0
|
|
106
|
-
].filter(Boolean).join(`
|
|
107
|
-
`), header = `# ${input.title} Full Content
|
|
108
|
-
|
|
109
|
-
${references ? `${references}
|
|
110
|
-
|
|
111
|
-
` : ""}`, sections = [], totalBytes = byteLength(header), included = 0, truncated = !1;
|
|
112
|
-
for (let artifact of [...input.artifacts].sort(
|
|
113
|
-
(a, b) => a.markdownPath.localeCompare(b.markdownPath)
|
|
114
|
-
)) {
|
|
115
|
-
let section = `---
|
|
116
|
-
|
|
117
|
-
${artifact.body.trim()}
|
|
118
|
-
|
|
119
|
-
`, sectionBytes = byteLength(section);
|
|
120
|
-
if (totalBytes + sectionBytes > input.maxBytes) {
|
|
121
|
-
truncated = !0;
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
sections.push(section), totalBytes += sectionBytes, included += 1;
|
|
125
|
-
}
|
|
126
|
-
let footer = truncated ? `
|
|
127
|
-
> Truncated at ${included} of ${input.totalCount ?? input.artifacts.length} Markdown pages to stay under ${input.maxBytes} bytes.
|
|
128
|
-
` : "";
|
|
129
|
-
return `${header}${sections.join("")}${footer}`;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
1
|
// src/lib/runtime/response/cached-text-response.ts
|
|
133
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";
|
|
134
3
|
function cacheControl(policy) {
|
|
@@ -150,50 +19,7 @@ function createCachedTextResponse(options) {
|
|
|
150
19
|
}
|
|
151
20
|
|
|
152
21
|
// src/route-metadata-llms.ts
|
|
153
|
-
|
|
154
|
-
async function llmsTxt(manifest, options = {}, artifactManifest) {
|
|
155
|
-
"use cache";
|
|
156
|
-
cacheLife("page"), cacheTag(
|
|
157
|
-
tags.site(),
|
|
158
|
-
tags.llms(options.group ?? options.scope ?? "root"),
|
|
159
|
-
tags.manifest(manifest.contentHash)
|
|
160
|
-
);
|
|
161
|
-
let pages = discoveryPages({ manifest, ...options }), group = options.group ? manifest.groups[options.group] : void 0;
|
|
162
|
-
return serializeLlmsIndex({
|
|
163
|
-
title: group?.title ?? manifest.site.name,
|
|
164
|
-
summary: manifest.site.description ? manifest.site.description : `Agent-readable index for ${manifest.site.name}.`,
|
|
165
|
-
sections: groupDiscoveryPages({ manifest, pages }).map((section) => ({
|
|
166
|
-
title: section.title,
|
|
167
|
-
pages: section.pages.map((page) => ({
|
|
168
|
-
title: page.title,
|
|
169
|
-
url: canonicalUrl(
|
|
170
|
-
manifest,
|
|
171
|
-
artifactManifest?.byHtmlPath[page.path] ?? page.path,
|
|
172
|
-
page.group
|
|
173
|
-
),
|
|
174
|
-
description: page.description
|
|
175
|
-
}))
|
|
176
|
-
})),
|
|
177
|
-
includeDescriptions: options.includeDescriptions,
|
|
178
|
-
links: options.links?.map((link) => ({
|
|
179
|
-
title: link.title,
|
|
180
|
-
url: canonicalUrl(manifest, link.path, link.group)
|
|
181
|
-
})),
|
|
182
|
-
otherGroupLinks: options.otherGroupLinks?.map((link) => ({
|
|
183
|
-
title: link.title,
|
|
184
|
-
url: canonicalUrl(manifest, link.path, link.group)
|
|
185
|
-
}))
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
function createLlmsTxtRoute(manifest, options = {}, artifactManifest) {
|
|
189
|
-
return async function() {
|
|
190
|
-
return createCachedTextResponse({
|
|
191
|
-
body: await llmsTxt(manifest, options, artifactManifest),
|
|
192
|
-
contentType: "text/plain; charset=utf-8"
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function createPrecomputedLlmsTxtRoute(output) {
|
|
22
|
+
function createLlmsTxtRoute(output) {
|
|
197
23
|
return function() {
|
|
198
24
|
return createCachedTextResponse({
|
|
199
25
|
body: output.body,
|
|
@@ -201,30 +27,6 @@ function createPrecomputedLlmsTxtRoute(output) {
|
|
|
201
27
|
});
|
|
202
28
|
};
|
|
203
29
|
}
|
|
204
|
-
async function llmsFullTxt(manifest, artifacts, options = {}) {
|
|
205
|
-
return serializeLlmsFull({
|
|
206
|
-
title: manifest.site.name,
|
|
207
|
-
indexUrl: options.indexPath === !1 ? void 0 : canonicalUrl(manifest, options.indexPath ?? "/llms.txt"),
|
|
208
|
-
sitemapUrl: options.sitemapPath === !1 ? void 0 : canonicalUrl(manifest, options.sitemapPath ?? "/sitemap.md"),
|
|
209
|
-
// Route factories serialize their supplied artifacts; generated output filters by origin.
|
|
210
|
-
artifacts: Object.values(artifacts),
|
|
211
|
-
maxBytes: options.maxBytes ?? DEFAULT_LLMS_FULL_MAX_BYTES
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
async function llmsFullTxtResponse(manifest, artifacts, options = {}) {
|
|
215
|
-
return createCachedTextResponse({
|
|
216
|
-
body: await llmsFullTxt(manifest, artifacts, options),
|
|
217
|
-
contentType: "text/plain; charset=utf-8"
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
function createLlmsFullTxtRoute(manifest, artifacts, options = {}) {
|
|
221
|
-
return async function() {
|
|
222
|
-
return llmsFullTxtResponse(manifest, artifacts, options);
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
30
|
export {
|
|
226
|
-
|
|
227
|
-
createLlmsTxtRoute,
|
|
228
|
-
createPrecomputedLlmsTxtRoute,
|
|
229
|
-
llmsFullTxtResponse
|
|
31
|
+
createLlmsTxtRoute
|
|
230
32
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare function createRobotsTxtRoute(defaultOutput: {
|
|
2
|
+
body: string;
|
|
3
|
+
}, outputsByOrigin?: Record<string, {
|
|
4
|
+
body: string;
|
|
5
|
+
}>): (request: Request) => Response;
|
|
4
6
|
|
|
5
7
|
export { createRobotsTxtRoute };
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
// src/route-metadata-robots.ts
|
|
2
|
-
import { tags } from "@publish.os/nextjs/cache/tags";
|
|
3
|
-
import { cacheLife, cacheTag } from "next/cache";
|
|
4
|
-
|
|
5
|
-
// src/lib/runtime/metadata/canonical-url.ts
|
|
6
|
-
function canonicalUrl(manifest, path, group) {
|
|
7
|
-
let origin = (group && manifest.groups[group]?.origin) ?? manifest.site.origin;
|
|
8
|
-
if (!origin) return path;
|
|
9
|
-
try {
|
|
10
|
-
return new URL(path, `${origin}/`).toString();
|
|
11
|
-
} catch {
|
|
12
|
-
return path;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
1
|
// src/lib/runtime/response/cached-text-response.ts
|
|
17
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";
|
|
18
3
|
function cacheControl(policy) {
|
|
@@ -34,17 +19,11 @@ function createCachedTextResponse(options) {
|
|
|
34
19
|
}
|
|
35
20
|
|
|
36
21
|
// src/route-metadata-robots.ts
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Allow: /
|
|
41
|
-
Sitemap: ${canonicalUrl(manifest, "/sitemap.xml")}
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
function createRobotsTxtRoute(manifest) {
|
|
45
|
-
return async function() {
|
|
22
|
+
function createRobotsTxtRoute(defaultOutput, outputsByOrigin = {}) {
|
|
23
|
+
return function(request) {
|
|
24
|
+
let output = outputsByOrigin[new URL(request.url).origin] ?? defaultOutput;
|
|
46
25
|
return createCachedTextResponse({
|
|
47
|
-
body:
|
|
26
|
+
body: output.body,
|
|
48
27
|
contentType: "text/plain; charset=utf-8"
|
|
49
28
|
});
|
|
50
29
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MarkdownRouteArtifactManifest } from '../agent/markdown.js';
|
|
2
|
-
import { M as ManifestLike } from '../../../types-
|
|
2
|
+
import { M as ManifestLike } from '../../../types-BbqmOzLC.js';
|
|
3
3
|
import '../not-found.js';
|
|
4
4
|
|
|
5
5
|
type SitemapReference = {
|
|
@@ -9,12 +9,26 @@ type SitemapReference = {
|
|
|
9
9
|
type SitemapRouteOptions = {
|
|
10
10
|
group?: string;
|
|
11
11
|
path?: string;
|
|
12
|
+
includeUrls?: SitemapReference[];
|
|
12
13
|
sitemaps?: SitemapReference[];
|
|
13
14
|
exclude?: SitemapReference[];
|
|
14
15
|
};
|
|
15
16
|
type SitemapMarkdownRouteOptions = {
|
|
16
17
|
group?: string;
|
|
18
|
+
path?: string;
|
|
17
19
|
scope?: "site" | "group" | "self";
|
|
20
|
+
excludeGroups?: string[];
|
|
21
|
+
includeUrls?: Array<{
|
|
22
|
+
path?: string;
|
|
23
|
+
group?: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
}>;
|
|
26
|
+
groupSitemaps?: Array<SitemapReference & {
|
|
27
|
+
title: string;
|
|
28
|
+
}>;
|
|
29
|
+
parts?: Array<SitemapReference & {
|
|
30
|
+
title: string;
|
|
31
|
+
}>;
|
|
18
32
|
links?: Array<SitemapReference & {
|
|
19
33
|
title: string;
|
|
20
34
|
}>;
|