@takazudo/zudo-doc 10.0.3 → 12.0.0
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/CHANGELOG.md +47 -0
- package/dist/agent-docs/search.js +6 -3
- package/dist/asset-index-page/index.js +1 -1
- package/dist/asset-page/index.js +1 -1
- package/dist/asset-path/index.d.ts +2 -0
- package/dist/asset-path/index.js +1 -0
- package/dist/catalog.js +1 -1
- package/dist/chrome/derive.js +14 -2
- package/dist/compiled.css +178 -30
- package/dist/config-assertions/index.d.ts +54 -0
- package/dist/config-assertions/index.js +205 -0
- package/dist/config.d.ts +12 -9
- package/dist/config.js +13 -0
- package/dist/content/index.d.ts +1 -0
- package/dist/content/index.js +2 -0
- package/dist/content/wide-section-heading.d.ts +12 -0
- package/dist/content/wide-section-heading.js +8 -0
- package/dist/content-admonition/index.d.ts +2 -1
- package/dist/content-admonition/index.js +2 -1
- package/dist/doc-body-end-islands/index.d.ts +0 -7
- package/dist/doc-body-end-islands/index.js +0 -6
- package/dist/doc-card-nav/index.d.ts +78 -0
- package/dist/doc-card-nav/index.js +82 -0
- package/dist/doc-card-nav/slug.d.ts +6 -0
- package/dist/doc-card-nav/slug.js +6 -0
- package/dist/doc-page-renderer/index.d.ts +5 -0
- package/dist/doc-page-renderer/index.js +7 -0
- package/dist/doc-page-shell/index.d.ts +12 -0
- package/dist/doc-page-shell/index.js +6 -1
- package/dist/docs-schema/index.d.ts +2 -0
- package/dist/docs-schema/index.js +9 -0
- package/dist/features.css +201 -0
- package/dist/frontmatter-preview-defaults/index.js +3 -1
- package/dist/head-with-defaults/index.d.ts +20 -0
- package/dist/head-with-defaults/index.js +25 -3
- package/dist/home-hero/index.d.ts +36 -0
- package/dist/home-hero/index.js +128 -0
- package/dist/home-page/index.js +157 -58
- package/dist/i18n-defaults/index.js +8 -0
- package/dist/mcp/constants.d.ts +11 -0
- package/dist/mcp/constants.js +20 -0
- package/dist/mcp/discovery.d.ts +45 -0
- package/dist/mcp/discovery.js +138 -0
- package/dist/mcp/handler.js +5 -9
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.js +37 -1
- package/dist/md-utils/index.d.ts +6 -1
- package/dist/md-utils/index.js +3 -2
- package/dist/mdx-components/index.js +4 -7
- package/dist/mdx-components/vocabulary.d.ts +19 -0
- package/dist/mdx-components/vocabulary.js +32 -0
- package/dist/nav-indexing/doc-card-grid.d.ts +6 -0
- package/dist/nav-indexing/doc-card-grid.js +26 -16
- package/dist/plugins/internal/agent-export/components.d.ts +27 -0
- package/dist/plugins/internal/agent-export/components.js +125 -0
- package/dist/plugins/internal/agent-export/index.d.ts +4 -0
- package/dist/plugins/internal/agent-export/index.js +29 -8
- package/dist/plugins/internal/agent-export/normalize.d.ts +18 -1
- package/dist/plugins/internal/agent-export/normalize.js +91 -5
- package/dist/plugins/internal/llms-txt/dev-middleware.d.ts +2 -0
- package/dist/plugins/internal/llms-txt/dev-middleware.js +6 -1
- package/dist/plugins/internal/llms-txt/emit.js +8 -1
- package/dist/plugins/internal/llms-txt/generate.d.ts +2 -0
- package/dist/plugins/internal/llms-txt/generate.js +3 -0
- package/dist/plugins/internal/llms-txt/load.js +2 -2
- package/dist/plugins/internal/llms-txt/types.d.ts +4 -0
- package/dist/plugins/internal/search-index/collect.js +5 -4
- package/dist/plugins/internal/search-index/types.d.ts +2 -0
- package/dist/plugins/routes.js +6 -1
- package/dist/preset.d.ts +6 -1
- package/dist/preset.js +13 -1
- package/dist/robots.d.ts +14 -0
- package/dist/robots.js +22 -4
- package/dist/route-enumerators/index.d.ts +63 -2
- package/dist/route-enumerators/index.js +124 -21
- package/dist/routes/404.js +1 -1
- package/dist/routes/_context.d.ts +1 -1
- package/dist/routes/_context.js +6 -0
- package/dist/routes/ai-catalog.d.ts +5 -0
- package/dist/routes/ai-catalog.js +28 -0
- package/dist/routes/mcp-server-card.d.ts +5 -0
- package/dist/routes/mcp-server-card.js +24 -0
- package/dist/routes/sitemap.xml.js +19 -9
- package/dist/settings-defaults.js +1 -1
- package/dist/settings.d.ts +102 -6
- package/dist/sidebar/client-data.d.ts +1 -1
- package/dist/sidebar/client-data.js +2 -0
- package/dist/sidebar/types.d.ts +4 -0
- package/dist/sidebar-tree/build-tree.js +1 -0
- package/dist/sidebar-tree/types.d.ts +4 -0
- package/dist/site-schema/nav-tree.js +2 -0
- package/dist/site-schema/types.d.ts +3 -0
- package/dist/site-tree-nav/index.d.ts +18 -0
- package/dist/site-tree-nav/index.js +18 -3
- package/dist/site-tree-nav/normalize-island-props.d.ts +6 -0
- package/dist/site-tree-nav/normalize-island-props.js +15 -0
- package/dist/site-tree-nav-island/count.d.ts +3 -0
- package/dist/site-tree-nav-island/count.js +11 -0
- package/dist/site-tree-nav-island/index.d.ts +22 -2
- package/dist/site-tree-nav-island/index.js +272 -221
- package/dist/tag-pages/index.d.ts +1 -0
- package/dist/tag-pages/index.js +2 -2
- package/dist/theme-packs/bauhaus/meta.json +1 -1
- package/dist/theme-packs/bauhaus/pack.css +2 -2
- package/dist/theme-packs/beacon/meta.json +1 -1
- package/dist/theme-packs/beacon/pack.css +0 -15
- package/dist/theme-packs/eink/meta.json +1 -1
- package/dist/theme-packs/eink/pack.css +1 -14
- package/dist/theme.css +0 -16
- package/dist/versions-page/index.d.ts +1 -0
- package/dist/versions-page/index.js +1 -1
- package/dist/wind.json +4 -6
- package/eject/content-admonition/index.tsx +4 -9
- package/eject/sidebar/client-data.ts +3 -1
- package/eject/sidebar/types.ts +4 -0
- package/eject/site-tree-nav-island/count.ts +11 -0
- package/eject/site-tree-nav-island/index.tsx +359 -256
- package/package.json +19 -7
- package/routes-src/404.tsx +1 -1
- package/routes-src/_context.ts +3 -0
- package/routes-src/ai-catalog.tsx +26 -0
- package/routes-src/mcp-server-card.tsx +21 -0
- package/routes-src/sitemap.xml.tsx +36 -12
- package/dist/find-in-page/find-bar.d.ts +0 -11
- package/dist/find-in-page/find-bar.js +0 -103
- package/dist/find-in-page/find-in-page.d.ts +0 -17
- package/dist/find-in-page/find-in-page.js +0 -131
- package/dist/find-in-page/index.d.ts +0 -5
- package/dist/find-in-page/index.js +0 -52
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { assetViewerHref } from "../asset-path/index.js";
|
|
2
2
|
import { mergeLocaleDocs } from "../locale-merge/index.js";
|
|
3
|
+
import { toHistorySlug } from "../slug/index.js";
|
|
4
|
+
function toSitemapDate(value) {
|
|
5
|
+
if (typeof value !== "string") return void 0;
|
|
6
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) return value;
|
|
7
|
+
if (!/^\d{4}-\d{2}-\d{2}T/.test(value)) return void 0;
|
|
8
|
+
const time = new Date(value).getTime();
|
|
9
|
+
return Number.isNaN(time) ? void 0 : new Date(time).toISOString().slice(0, 10);
|
|
10
|
+
}
|
|
3
11
|
function createRouteEnumerators(ctx) {
|
|
4
12
|
const defaultLocale = ctx.defaultLocale;
|
|
5
13
|
const getLocaleKeys = () => Object.keys(ctx.settings.locales);
|
|
@@ -17,22 +25,92 @@ function createRouteEnumerators(ctx) {
|
|
|
17
25
|
const collectAutoIndexNodes = ctx.collectAutoIndexNodes;
|
|
18
26
|
const resolveNavSource = ctx.resolveNavSource;
|
|
19
27
|
const resolveVersionedLocaleSource = ctx.resolveVersionedLocaleSource;
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
const
|
|
28
|
+
function enumerateKeyedDocsRoutes(locale) {
|
|
29
|
+
const entries = [];
|
|
30
|
+
const seen = /* @__PURE__ */ new Set();
|
|
31
|
+
const isDefault = locale === defaultLocale;
|
|
32
|
+
const { docs: allDocs, navDocs, categoryMeta, localeSlugSet } = resolveNavSource(
|
|
23
33
|
locale,
|
|
24
34
|
void 0,
|
|
25
35
|
{ applyDefaultLocaleOnlyFilter: true, keepUnlisted: true }
|
|
26
36
|
);
|
|
27
37
|
const tree = buildNavTree(navDocs, locale, categoryMeta);
|
|
38
|
+
function push(slug, isFallback, autoIndex) {
|
|
39
|
+
const url = docsUrl(slug, locale);
|
|
40
|
+
if (seen.has(url)) return;
|
|
41
|
+
seen.add(url);
|
|
42
|
+
const historySlug = toHistorySlug(slug);
|
|
43
|
+
entries.push({
|
|
44
|
+
url,
|
|
45
|
+
historyKey: isDefault || isFallback ? historySlug : `${locale}/${historySlug}`,
|
|
46
|
+
slug,
|
|
47
|
+
autoIndex
|
|
48
|
+
});
|
|
49
|
+
}
|
|
28
50
|
for (const doc of allDocs) {
|
|
29
51
|
if (doc.data.category_no_page === true) continue;
|
|
30
|
-
|
|
52
|
+
const slug = doc.data.slug ?? toRouteSlug(doc.slug);
|
|
53
|
+
push(slug, !isDefault && !localeSlugSet.has(slug), false);
|
|
31
54
|
}
|
|
32
55
|
for (const node of collectAutoIndexNodes(tree)) {
|
|
33
|
-
|
|
56
|
+
push(node.slug, false, true);
|
|
34
57
|
}
|
|
35
|
-
return
|
|
58
|
+
return entries;
|
|
59
|
+
}
|
|
60
|
+
function enumerateDocsRoutes(locale) {
|
|
61
|
+
return enumerateKeyedDocsRoutes(locale).map((entry) => entry.url);
|
|
62
|
+
}
|
|
63
|
+
const realSlugCache = /* @__PURE__ */ new WeakMap();
|
|
64
|
+
function realContentSlugs(locale) {
|
|
65
|
+
const source = resolveNavSource(locale, void 0, {
|
|
66
|
+
applyDefaultLocaleOnlyFilter: true,
|
|
67
|
+
keepUnlisted: true
|
|
68
|
+
});
|
|
69
|
+
const cached = realSlugCache.get(source.docs);
|
|
70
|
+
if (cached) return cached;
|
|
71
|
+
const isDefault = locale === defaultLocale;
|
|
72
|
+
const slugs = /* @__PURE__ */ new Set();
|
|
73
|
+
for (const doc of source.docs) {
|
|
74
|
+
if (doc.data.category_no_page === true) continue;
|
|
75
|
+
const slug = doc.data.slug ?? toRouteSlug(doc.slug);
|
|
76
|
+
if (!isDefault) {
|
|
77
|
+
if (!source.localeSlugSet.has(slug)) continue;
|
|
78
|
+
if (isDefaultLocaleOnlyPath(`/docs/${slug}`)) continue;
|
|
79
|
+
}
|
|
80
|
+
slugs.add(slug);
|
|
81
|
+
}
|
|
82
|
+
realSlugCache.set(source.docs, slugs);
|
|
83
|
+
return slugs;
|
|
84
|
+
}
|
|
85
|
+
function getDocLocaleAlternates(slug, locale) {
|
|
86
|
+
const localeKeys = getLocaleKeys();
|
|
87
|
+
if (localeKeys.length === 0) return [];
|
|
88
|
+
if (!realContentSlugs(locale).has(slug)) return [];
|
|
89
|
+
const candidates = [defaultLocale, ...localeKeys.filter((code) => code !== defaultLocale)];
|
|
90
|
+
const alternates = [];
|
|
91
|
+
for (const code of candidates) {
|
|
92
|
+
if (realContentSlugs(code).has(slug)) {
|
|
93
|
+
alternates.push({ hreflang: code, url: docsUrl(slug, code) });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (alternates.length < 2) return [];
|
|
97
|
+
if (alternates[0]?.hreflang === defaultLocale) {
|
|
98
|
+
alternates.push({ hreflang: "x-default", url: alternates[0].url });
|
|
99
|
+
}
|
|
100
|
+
return alternates;
|
|
101
|
+
}
|
|
102
|
+
function homeUrl(locale) {
|
|
103
|
+
return locale === defaultLocale ? withBase("/") : withBase(`/${locale}`);
|
|
104
|
+
}
|
|
105
|
+
function getHomeLocaleAlternates() {
|
|
106
|
+
const localeKeys = getLocaleKeys().filter((code) => code !== defaultLocale);
|
|
107
|
+
if (localeKeys.length === 0) return [];
|
|
108
|
+
const alternates = [
|
|
109
|
+
{ hreflang: defaultLocale, url: homeUrl(defaultLocale) },
|
|
110
|
+
...localeKeys.map((code) => ({ hreflang: code, url: homeUrl(code) }))
|
|
111
|
+
];
|
|
112
|
+
alternates.push({ hreflang: "x-default", url: homeUrl(defaultLocale) });
|
|
113
|
+
return alternates;
|
|
36
114
|
}
|
|
37
115
|
function enumerateTagsRoutes(locale) {
|
|
38
116
|
if (!getDocTags()) return [];
|
|
@@ -130,20 +208,27 @@ function createRouteEnumerators(ctx) {
|
|
|
130
208
|
}
|
|
131
209
|
return [...new Set(urls)];
|
|
132
210
|
}
|
|
133
|
-
function
|
|
134
|
-
const
|
|
135
|
-
const routes =
|
|
211
|
+
function collectAllRoutes() {
|
|
212
|
+
const seen = /* @__PURE__ */ new Set();
|
|
213
|
+
const routes = [];
|
|
136
214
|
const localeKeys = getLocaleKeys();
|
|
137
215
|
const versions = getVersions();
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
216
|
+
const homeAlternates = getHomeLocaleAlternates();
|
|
217
|
+
function add(url, historyKey, alternates) {
|
|
218
|
+
if (seen.has(url)) return;
|
|
219
|
+
seen.add(url);
|
|
220
|
+
const route = { url };
|
|
221
|
+
if (historyKey !== void 0) route.historyKey = historyKey;
|
|
222
|
+
if (alternates !== void 0 && alternates.length > 0) route.alternates = alternates;
|
|
223
|
+
routes.push(route);
|
|
142
224
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
225
|
+
function addDocs(locale) {
|
|
226
|
+
for (const { url, historyKey, slug, autoIndex } of enumerateKeyedDocsRoutes(locale)) {
|
|
227
|
+
add(url, historyKey, autoIndex ? void 0 : getDocLocaleAlternates(slug, locale));
|
|
228
|
+
}
|
|
146
229
|
}
|
|
230
|
+
add(withBase("/"), void 0, homeAlternates);
|
|
231
|
+
addDocs(defaultLocale);
|
|
147
232
|
for (const url of enumerateTagsRoutes(defaultLocale)) {
|
|
148
233
|
add(url);
|
|
149
234
|
}
|
|
@@ -151,10 +236,8 @@ function createRouteEnumerators(ctx) {
|
|
|
151
236
|
add(url);
|
|
152
237
|
}
|
|
153
238
|
for (const locale of localeKeys) {
|
|
154
|
-
add(withBase(`/${locale}`));
|
|
155
|
-
|
|
156
|
-
add(url);
|
|
157
|
-
}
|
|
239
|
+
add(withBase(`/${locale}`), void 0, homeAlternates);
|
|
240
|
+
addDocs(locale);
|
|
158
241
|
for (const url of enumerateTagsRoutes(locale)) {
|
|
159
242
|
add(url);
|
|
160
243
|
}
|
|
@@ -182,12 +265,32 @@ function createRouteEnumerators(ctx) {
|
|
|
182
265
|
}
|
|
183
266
|
return routes;
|
|
184
267
|
}
|
|
268
|
+
function enumerateAllRoutes() {
|
|
269
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0] ?? "";
|
|
270
|
+
return new Map(collectAllRoutes().map(({ url }) => [url, today]));
|
|
271
|
+
}
|
|
272
|
+
function enumerateSitemapEntries(options = {}) {
|
|
273
|
+
const meta = options.docHistoryMeta ?? {};
|
|
274
|
+
return collectAllRoutes().map(({ url, historyKey, alternates }) => {
|
|
275
|
+
const sitemapEntry = { url };
|
|
276
|
+
if (historyKey !== void 0 && Object.hasOwn(meta, historyKey)) {
|
|
277
|
+
const entry = meta[historyKey];
|
|
278
|
+
const lastmod = toSitemapDate(entry?.updatedDate);
|
|
279
|
+
if (lastmod !== void 0) sitemapEntry.lastmod = lastmod;
|
|
280
|
+
}
|
|
281
|
+
if (alternates !== void 0) sitemapEntry.alternates = alternates;
|
|
282
|
+
return sitemapEntry;
|
|
283
|
+
});
|
|
284
|
+
}
|
|
185
285
|
return {
|
|
186
286
|
enumerateDocsRoutes,
|
|
187
287
|
enumerateTagsRoutes,
|
|
188
288
|
enumerateAssetRoutes,
|
|
189
289
|
enumerateVersionedRoutes,
|
|
190
|
-
enumerateAllRoutes
|
|
290
|
+
enumerateAllRoutes,
|
|
291
|
+
enumerateSitemapEntries,
|
|
292
|
+
getDocLocaleAlternates,
|
|
293
|
+
getHomeLocaleAlternates
|
|
191
294
|
};
|
|
192
295
|
}
|
|
193
296
|
export {
|
package/dist/routes/404.js
CHANGED
|
@@ -17,7 +17,7 @@ function NotFoundPage() {
|
|
|
17
17
|
DocLayoutWithDefaults,
|
|
18
18
|
{
|
|
19
19
|
title: composeMetaTitle(title),
|
|
20
|
-
head: /* @__PURE__ */ jsx(HeadWithDefaults, { title }),
|
|
20
|
+
head: /* @__PURE__ */ jsx(HeadWithDefaults, { title, locale }),
|
|
21
21
|
lang: locale,
|
|
22
22
|
dataThemePack: resolveThemePackSsrSlug(themePackRegistry, settings),
|
|
23
23
|
noindex: true,
|
|
@@ -26,6 +26,6 @@ export declare const i18n: import("../index.js").FactoryI18n, defaultLocale: str
|
|
|
26
26
|
};
|
|
27
27
|
}>, slugFn: (entrySlug: string, data: {
|
|
28
28
|
slug?: string;
|
|
29
|
-
}) => string) => Map<string, import("./_context.js").TagInfo>, resolveNavSource: (lang: string, currentVersion: string | undefined, options?: import("../nav-source-docs/index.js").NavSourceOptions) => import("../nav-source-docs/index.js").NavSourceDocs, resolveVersionedLocaleSource: (versionSlug: string, versionDocsDir: string | undefined, lang: string, localeDir: string | undefined, options?: import("../nav-source-docs/index.js").NavSourceOptions) => import("../nav-source-docs/index.js").NavSourceDocs, loadNavSourceDocs: (lang: string, currentVersion: string | undefined) => import("../nav-source-docs/index.js").NavSourceDocs, buildDocRouteEntries: (args: import("../site-schema/doc-route-entries.js").BuildDocRouteEntriesArgs<import("../doc-page-props/index.js").DocPageEntry>) => import("../site-schema/doc-route-entries.js").DocRouteEntry<import("../doc-page-props/index.js").DocPageEntry>[], enumerateDocsRoutes: (locale: string) => string[], enumerateTagsRoutes: (locale: string) => string[], enumerateVersionedRoutes: (version: import("../route-enumerators/index.js").VersionConfigForEnum, locale: string) => string[], enumerateAllRoutes: () => Map<string, string>, buildNavTree: (docs: import("../doc-page-props/index.js").DocPageEntry[], locale: string, categoryMeta: Map<string, import("../sidebar-tree/types.js").CategoryMeta> | undefined, buildHref: import("../index.js").RouteHrefBuilder, options?: {
|
|
29
|
+
}) => string) => Map<string, import("./_context.js").TagInfo>, resolveNavSource: (lang: string, currentVersion: string | undefined, options?: import("../nav-source-docs/index.js").NavSourceOptions) => import("../nav-source-docs/index.js").NavSourceDocs, resolveVersionedLocaleSource: (versionSlug: string, versionDocsDir: string | undefined, lang: string, localeDir: string | undefined, options?: import("../nav-source-docs/index.js").NavSourceOptions) => import("../nav-source-docs/index.js").NavSourceDocs, loadNavSourceDocs: (lang: string, currentVersion: string | undefined) => import("../nav-source-docs/index.js").NavSourceDocs, buildDocRouteEntries: (args: import("../site-schema/doc-route-entries.js").BuildDocRouteEntriesArgs<import("../doc-page-props/index.js").DocPageEntry>) => import("../site-schema/doc-route-entries.js").DocRouteEntry<import("../doc-page-props/index.js").DocPageEntry>[], enumerateDocsRoutes: (locale: string) => string[], enumerateTagsRoutes: (locale: string) => string[], enumerateVersionedRoutes: (version: import("../route-enumerators/index.js").VersionConfigForEnum, locale: string) => string[], enumerateAllRoutes: () => Map<string, string>, enumerateSitemapEntries: (options?: import("../route-enumerators/index.js").SitemapEntriesOptions) => import("../route-enumerators/index.js").SitemapEntry[], getDocLocaleAlternates: (slug: string, locale: string) => import("../route-enumerators/index.js").LocaleAlternate[], getHomeLocaleAlternates: () => import("../route-enumerators/index.js").LocaleAlternate[], buildNavTree: (docs: import("../doc-page-props/index.js").DocPageEntry[], locale: string, categoryMeta: Map<string, import("../sidebar-tree/types.js").CategoryMeta> | undefined, buildHref: import("../index.js").RouteHrefBuilder, options?: {
|
|
30
30
|
buildHref?: import("../index.js").RouteHrefBuilder;
|
|
31
31
|
}) => import("./_chrome.js").DocNavNode[], groupSatelliteNodes: (tree: import("./_chrome.js").DocNavNode[], prefixes: string[]) => import("./_chrome.js").DocNavNode[], findNode: (nodes: import("./_chrome.js").DocNavNode[], slug: string) => import("./_chrome.js").DocNavNode | undefined, firstRoutedHref: (node: import("./_chrome.js").DocNavNode) => string | undefined, collectAutoIndexNodes: (nodes: import("./_chrome.js").DocNavNode[]) => import("./_chrome.js").DocNavNode[], isNavVisible: (doc: import("../doc-page-props/index.js").DocPageEntry) => boolean, stableDocs: (collectionName: string) => import("../doc-page-props/index.js").DocPageEntry[], toRouteSlug: (entrySlug: string) => string, toSlugParams: (routeSlug: string) => string[];
|
package/dist/routes/_context.js
CHANGED
|
@@ -40,6 +40,9 @@ const {
|
|
|
40
40
|
enumerateTagsRoutes,
|
|
41
41
|
enumerateVersionedRoutes,
|
|
42
42
|
enumerateAllRoutes,
|
|
43
|
+
enumerateSitemapEntries,
|
|
44
|
+
getDocLocaleAlternates,
|
|
45
|
+
getHomeLocaleAlternates,
|
|
43
46
|
buildNavTree,
|
|
44
47
|
groupSatelliteNodes,
|
|
45
48
|
findNode,
|
|
@@ -64,12 +67,15 @@ export {
|
|
|
64
67
|
docsUrl,
|
|
65
68
|
enumerateAllRoutes,
|
|
66
69
|
enumerateDocsRoutes,
|
|
70
|
+
enumerateSitemapEntries,
|
|
67
71
|
enumerateTagsRoutes,
|
|
68
72
|
enumerateVersionedRoutes,
|
|
69
73
|
extractHeadings,
|
|
70
74
|
findNode,
|
|
71
75
|
firstRoutedHref,
|
|
72
76
|
getCategoryOrder,
|
|
77
|
+
getDocLocaleAlternates,
|
|
78
|
+
getHomeLocaleAlternates,
|
|
73
79
|
getLocaleConfig,
|
|
74
80
|
getLocaleLabel,
|
|
75
81
|
getNavSectionForSlug,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getCloudflareContext } from "@takazudo/zfb-adapter-cloudflare";
|
|
2
|
+
import {
|
|
3
|
+
AI_CATALOG_MEDIA_TYPE,
|
|
4
|
+
AI_CATALOG_WELL_KNOWN_PATH,
|
|
5
|
+
buildAiCatalog,
|
|
6
|
+
mcpPublicOrigin,
|
|
7
|
+
respondWithDiscoveryDocument
|
|
8
|
+
} from "../mcp/index.js";
|
|
9
|
+
import { settings } from "./_context.js";
|
|
10
|
+
const frontmatter = { title: "AI Catalog" };
|
|
11
|
+
const prerender = false;
|
|
12
|
+
async function AiCatalogRoute() {
|
|
13
|
+
const { request } = getCloudflareContext();
|
|
14
|
+
if (new URL(request.url).pathname !== AI_CATALOG_WELL_KNOWN_PATH) {
|
|
15
|
+
return new Response("Not Found", { status: 404, headers: { "content-type": "text/plain; charset=utf-8" } });
|
|
16
|
+
}
|
|
17
|
+
const catalog = buildAiCatalog({
|
|
18
|
+
base: settings.base ?? "/",
|
|
19
|
+
siteName: settings.siteName,
|
|
20
|
+
origin: mcpPublicOrigin(settings.siteUrl, request.url)
|
|
21
|
+
});
|
|
22
|
+
return respondWithDiscoveryDocument(request, catalog, AI_CATALOG_MEDIA_TYPE);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
AiCatalogRoute as default,
|
|
26
|
+
frontmatter,
|
|
27
|
+
prerender
|
|
28
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getCloudflareContext } from "@takazudo/zfb-adapter-cloudflare";
|
|
2
|
+
import {
|
|
3
|
+
MCP_SERVER_CARD_MEDIA_TYPE,
|
|
4
|
+
buildMcpServerCard,
|
|
5
|
+
mcpPublicOrigin,
|
|
6
|
+
respondWithDiscoveryDocument
|
|
7
|
+
} from "../mcp/index.js";
|
|
8
|
+
import { settings } from "./_context.js";
|
|
9
|
+
const frontmatter = { title: "MCP Server Card" };
|
|
10
|
+
const prerender = false;
|
|
11
|
+
function McpServerCardRoute() {
|
|
12
|
+
const { request } = getCloudflareContext();
|
|
13
|
+
const card = buildMcpServerCard({
|
|
14
|
+
base: settings.base ?? "/",
|
|
15
|
+
siteName: settings.siteName,
|
|
16
|
+
origin: mcpPublicOrigin(settings.siteUrl, request.url)
|
|
17
|
+
});
|
|
18
|
+
return respondWithDiscoveryDocument(request, card, MCP_SERVER_CARD_MEDIA_TYPE);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
McpServerCardRoute as default,
|
|
22
|
+
frontmatter,
|
|
23
|
+
prerender
|
|
24
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { chromeBindings } from "virtual:zudo-doc-chrome-bindings";
|
|
2
|
+
import { settings, enumerateSitemapEntries } from "./_context.js";
|
|
2
3
|
const frontmatter = { title: "Sitemap" };
|
|
3
4
|
const contentType = "application/xml";
|
|
4
5
|
function escapeXml(str) {
|
|
@@ -13,16 +14,25 @@ function Sitemap() {
|
|
|
13
14
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
14
15
|
</urlset>`;
|
|
15
16
|
}
|
|
16
|
-
const
|
|
17
|
+
const entries = enumerateSitemapEntries({
|
|
18
|
+
docHistoryMeta: settings.docHistory ? chromeBindings.docHistoryMeta : void 0
|
|
19
|
+
});
|
|
17
20
|
const siteUrlBase = (settings.siteUrl ?? "").replace(/\/$/, "");
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<lastmod>${lastmod}</lastmod
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const withAlternates = siteUrlBase !== "" && entries.some((e) => e.alternates);
|
|
22
|
+
const urlEntries = entries.sort((a, b) => a.url.localeCompare(b.url)).map(({ url, lastmod, alternates }) => {
|
|
23
|
+
const lastmodLine = lastmod ? `
|
|
24
|
+
<lastmod>${lastmod}</lastmod>` : "";
|
|
25
|
+
const alternateLines = withAlternates && alternates ? alternates.map(
|
|
26
|
+
(a) => `
|
|
27
|
+
<xhtml:link rel="alternate" hreflang="${escapeXml(a.hreflang)}" href="${escapeXml(siteUrlBase + a.url)}"/>`
|
|
28
|
+
).join("") : "";
|
|
29
|
+
return ` <url>
|
|
30
|
+
<loc>${escapeXml(siteUrlBase + url)}</loc>${lastmodLine}${alternateLines}
|
|
31
|
+
</url>`;
|
|
32
|
+
}).join("\n");
|
|
33
|
+
const urlsetOpen = withAlternates ? '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">' : '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
|
24
34
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
25
|
-
|
|
35
|
+
${urlsetOpen}
|
|
26
36
|
${urlEntries}
|
|
27
37
|
</urlset>
|
|
28
38
|
`;
|
|
@@ -26,6 +26,7 @@ const DEFAULT_SETTINGS = {
|
|
|
26
26
|
mermaid: true,
|
|
27
27
|
transclude: false,
|
|
28
28
|
noindex: false,
|
|
29
|
+
contentSignals: false,
|
|
29
30
|
editUrl: false,
|
|
30
31
|
githubUrl: false,
|
|
31
32
|
siteUrl: "",
|
|
@@ -64,7 +65,6 @@ const DEFAULT_SETTINGS = {
|
|
|
64
65
|
sidebarToggle: false,
|
|
65
66
|
tocToggle: false,
|
|
66
67
|
imageEnlarge: false,
|
|
67
|
-
findInPage: false,
|
|
68
68
|
dynamicPageTransition: false,
|
|
69
69
|
frontmatterPreview: false,
|
|
70
70
|
docHistory: false,
|
package/dist/settings.d.ts
CHANGED
|
@@ -78,6 +78,13 @@ export interface LocaleConfig {
|
|
|
78
78
|
introMarkdown?: string;
|
|
79
79
|
/** Sitemap title override. Blank restores the translated default. @default undefined */
|
|
80
80
|
sitemapHeading?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Link-preview image (og:image / twitter:image) for this locale's pages, a
|
|
83
|
+
* root-absolute site path. Overrides `metaTags.ogImage`; `false` emits none
|
|
84
|
+
* for this locale. A page's `og_image` frontmatter still wins.
|
|
85
|
+
* @default undefined
|
|
86
|
+
*/
|
|
87
|
+
ogImage?: string | false;
|
|
81
88
|
}
|
|
82
89
|
export interface FooterLinkItem {
|
|
83
90
|
label: string;
|
|
@@ -176,6 +183,82 @@ export interface HomeConfig {
|
|
|
176
183
|
introMarkdown?: string;
|
|
177
184
|
/** Sitemap title; blank uses the translated package label. @default "" */
|
|
178
185
|
sitemapHeading?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Full-colour picture drawn in the home hero in place of the logo. Omitted
|
|
188
|
+
* keeps the logo. See {@link HomeImageConfig}.
|
|
189
|
+
* @default undefined
|
|
190
|
+
*/
|
|
191
|
+
image?: HomeImageConfig;
|
|
192
|
+
/**
|
|
193
|
+
* How `image` is placed in the hero. `"logo"` uses the logo's box (320px);
|
|
194
|
+
* `"large"` a 560px box beside the title; `"banner"` a full-width picture
|
|
195
|
+
* above the centred title; `"backdrop"` the picture behind the title, cropped
|
|
196
|
+
* to cover, with the copy on a readable panel. Ignored without `image`.
|
|
197
|
+
* @default "logo"
|
|
198
|
+
*/
|
|
199
|
+
imageLayout?: HomeImageLayout;
|
|
200
|
+
/**
|
|
201
|
+
* Optional navigation recipe that replaces the legacy sitemap block: exactly
|
|
202
|
+
* one `site-tree` section and at most one `doc-cards` section, in either
|
|
203
|
+
* order. Omitted keeps the legacy home page (sitemap heading + tree).
|
|
204
|
+
* See {@link HomeSection}.
|
|
205
|
+
* @default undefined
|
|
206
|
+
*/
|
|
207
|
+
sections?: readonly HomeSection[];
|
|
208
|
+
}
|
|
209
|
+
/** Placement of the `home.image` picture in the home hero. */
|
|
210
|
+
export type HomeImageLayout = "logo" | "large" | "banner" | "backdrop";
|
|
211
|
+
/** Per-locale presentation overrides for a home section heading/description. */
|
|
212
|
+
export interface HomeSectionLocaleText {
|
|
213
|
+
heading?: string;
|
|
214
|
+
description?: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Selected document cards: entry points to existing documents, resolved from
|
|
218
|
+
* canonical published slugs (e.g. `"getting-started/introduction"`) in order.
|
|
219
|
+
* Unknown, duplicate and no-page references produce no card.
|
|
220
|
+
*/
|
|
221
|
+
export interface HomeDocCardsSection {
|
|
222
|
+
type: "doc-cards";
|
|
223
|
+
/** Section heading. Blank/omitted uses the translated "Start here" label. */
|
|
224
|
+
heading?: string;
|
|
225
|
+
/** Short plain-text line under the heading. */
|
|
226
|
+
description?: string;
|
|
227
|
+
/** Ordered canonical document slugs. */
|
|
228
|
+
docs: readonly string[];
|
|
229
|
+
/** Per-locale heading/description overrides keyed by locale code. */
|
|
230
|
+
locales?: Readonly<Record<string, HomeSectionLocaleText>>;
|
|
231
|
+
}
|
|
232
|
+
/** The canonical site tree (categories → documents). */
|
|
233
|
+
export interface HomeSiteTreeSection {
|
|
234
|
+
type: "site-tree";
|
|
235
|
+
/** Section heading. Blank/omitted uses the sitemap heading chain. */
|
|
236
|
+
heading?: string;
|
|
237
|
+
/** Short plain-text line under the heading. */
|
|
238
|
+
description?: string;
|
|
239
|
+
/** `"described"` shows descriptions and document counts. @default "default" */
|
|
240
|
+
variant?: "default" | "described";
|
|
241
|
+
/** Per-locale heading/description overrides keyed by locale code. */
|
|
242
|
+
locales?: Readonly<Record<string, HomeSectionLocaleText>>;
|
|
243
|
+
}
|
|
244
|
+
export type HomeSection = HomeDocCardsSection | HomeSiteTreeSection;
|
|
245
|
+
/**
|
|
246
|
+
* Full-colour home hero image (`home.image`). Rendered as a real `<img>` in
|
|
247
|
+
* the box the logo occupies (320px wide, 1200:630, fluid on narrow screens)
|
|
248
|
+
* with `object-fit: contain`. Unlike a `logo` path it is never masked, so it
|
|
249
|
+
* keeps its own colours.
|
|
250
|
+
*/
|
|
251
|
+
export interface HomeImageConfig {
|
|
252
|
+
/** Root-absolute site path (e.g. `"/img/hero.png"`), prefixed with `base`. External URLs are rejected. */
|
|
253
|
+
src: string;
|
|
254
|
+
/** Alternative text. Defaults to `""` because the site name is printed beside the image. */
|
|
255
|
+
alt?: string;
|
|
256
|
+
/** Intrinsic width in pixels (positive integer). Give together with `height`. */
|
|
257
|
+
width?: number;
|
|
258
|
+
/** Intrinsic height in pixels (positive integer). Give together with `width`. */
|
|
259
|
+
height?: number;
|
|
260
|
+
/** Root-absolute site path shown instead of `src` while the site is in dark colour mode. */
|
|
261
|
+
darkSrc?: string;
|
|
179
262
|
}
|
|
180
263
|
export type TagPlacement = "after-title" | "before-pager";
|
|
181
264
|
/** Per-role date-format patterns. Each key independently opts into a pattern. */
|
|
@@ -224,6 +307,19 @@ export interface ChangelogConfig {
|
|
|
224
307
|
/** Document heading. Defaults to "Changelog". */
|
|
225
308
|
title?: string;
|
|
226
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Content Signals (https://contentsignals.org) declared in the `User-agent: *`
|
|
312
|
+
* group of `robots.txt`. `true` renders `yes`, `false` renders `no`, and an
|
|
313
|
+
* omitted key expresses no preference for that use.
|
|
314
|
+
*/
|
|
315
|
+
export interface ContentSignalsConfig {
|
|
316
|
+
/** Building a search index and providing search results (not AI-generated search summaries). */
|
|
317
|
+
search?: boolean;
|
|
318
|
+
/** Inputting content into AI models, such as retrieval, grounding or agent use. */
|
|
319
|
+
aiInput?: boolean;
|
|
320
|
+
/** Training or fine-tuning AI models. */
|
|
321
|
+
aiTrain?: boolean;
|
|
322
|
+
}
|
|
227
323
|
export interface MetaTagsConfig {
|
|
228
324
|
/** Emit <meta name="description">. Default true. */
|
|
229
325
|
description: boolean;
|
|
@@ -397,6 +493,12 @@ export interface Settings {
|
|
|
397
493
|
mermaid: boolean;
|
|
398
494
|
transclude: boolean;
|
|
399
495
|
noindex: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Content Signals for `robots.txt` — see {@link ContentSignalsConfig}.
|
|
498
|
+
* Optional so complete `Settings` literals built outside `zudoDoc()` keep
|
|
499
|
+
* compiling; absent and `false` both publish no `Content-Signal` line.
|
|
500
|
+
*/
|
|
501
|
+
contentSignals?: ContentSignalsConfig | false;
|
|
400
502
|
editUrl: string | false;
|
|
401
503
|
githubUrl: string | false;
|
|
402
504
|
siteUrl: string;
|
|
@@ -449,12 +551,6 @@ export interface Settings {
|
|
|
449
551
|
sidebarToggle: boolean;
|
|
450
552
|
tocToggle: boolean;
|
|
451
553
|
imageEnlarge: boolean;
|
|
452
|
-
/**
|
|
453
|
-
* Mount the `FindInPageInit` island (Cmd/Ctrl+F find bar). Self-gates on
|
|
454
|
-
* `window.__TAURI_INTERNALS__` — a no-op outside a Tauri shell even when
|
|
455
|
-
* `true`, since the OS/browser already own that shortcut elsewhere.
|
|
456
|
-
*/
|
|
457
|
-
findInPage: boolean;
|
|
458
554
|
dynamicPageTransition: boolean;
|
|
459
555
|
frontmatterPreview: FrontmatterPreviewConfig | false;
|
|
460
556
|
docHistory: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SidebarNavNode, SidebarNavigationContext } from "./types.js";
|
|
2
2
|
/** Navigation data needed by the native sidebar islands, without server prose. */
|
|
3
|
-
export type SidebarClientNode = Omit<SidebarNavNode, "description" | "children"> & {
|
|
3
|
+
export type SidebarClientNode = Omit<SidebarNavNode, "description" | "cover" | "coverHref" | "children"> & {
|
|
4
4
|
children: SidebarClientNode[];
|
|
5
5
|
};
|
|
6
6
|
export type SidebarClientNavigation = Omit<SidebarNavigationContext, "roots"> & {
|
package/dist/sidebar/types.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ export interface SidebarNavNode {
|
|
|
30
30
|
slug: string;
|
|
31
31
|
label: string;
|
|
32
32
|
description?: string;
|
|
33
|
+
/** Raw `cover` frontmatter path; the home page turns it into `coverHref`. */
|
|
34
|
+
cover?: string;
|
|
35
|
+
/** Base-prefixed home-grid card picture URL (top-level nodes on the home page only). */
|
|
36
|
+
coverHref?: string;
|
|
33
37
|
position: number;
|
|
34
38
|
href?: string;
|
|
35
39
|
hasPage: boolean;
|
|
@@ -83,6 +83,7 @@ function toSidebarNodes(parent, locale, buildHref, categoryMeta, parentSortOrder
|
|
|
83
83
|
id: child.fullPath,
|
|
84
84
|
label,
|
|
85
85
|
...description !== void 0 ? { description } : {},
|
|
86
|
+
...doc?.data.cover !== void 0 ? { cover: doc.data.cover } : {},
|
|
86
87
|
...positionRaw !== void 0 ? { sidebar_position: positionRaw } : {},
|
|
87
88
|
...href !== void 0 ? { href } : {},
|
|
88
89
|
hasPage,
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
export interface SidebarFrontmatter {
|
|
13
13
|
title: string;
|
|
14
14
|
description?: string;
|
|
15
|
+
/** Home-grid card picture (root-absolute site path). */
|
|
16
|
+
cover?: string;
|
|
15
17
|
sidebar_position?: number;
|
|
16
18
|
sidebar_label?: string;
|
|
17
19
|
sidebar_initial_expansion?: "collapsed" | "expanded";
|
|
@@ -89,6 +91,8 @@ export interface SidebarNode {
|
|
|
89
91
|
id: string;
|
|
90
92
|
label: string;
|
|
91
93
|
description?: string;
|
|
94
|
+
/** Raw `cover` frontmatter path; base-prefixed by the home page. */
|
|
95
|
+
cover?: string;
|
|
92
96
|
href?: string;
|
|
93
97
|
sidebar_position?: number;
|
|
94
98
|
/** True when an actual MDX file backs this slug (vs. directory-only). */
|
|
@@ -9,6 +9,7 @@ function toNavNode(node) {
|
|
|
9
9
|
slug: node.id,
|
|
10
10
|
label: node.label,
|
|
11
11
|
...node.description !== void 0 ? { description: node.description } : {},
|
|
12
|
+
...node.cover !== void 0 ? { cover: node.cover } : {},
|
|
12
13
|
position: node.sidebar_position ?? 999,
|
|
13
14
|
...node.href !== void 0 ? { href: node.href } : {},
|
|
14
15
|
hasPage: node.hasPage,
|
|
@@ -43,6 +44,7 @@ function toRootNavNode(doc, locale, buildHref, categoryMeta) {
|
|
|
43
44
|
hasPage: noPage !== true,
|
|
44
45
|
children: [],
|
|
45
46
|
sortOrder,
|
|
47
|
+
...typeof doc.data.cover === "string" ? { cover: doc.data.cover } : {},
|
|
46
48
|
...doc.data.category_shape !== void 0 ? { shape: doc.data.category_shape } : {},
|
|
47
49
|
...doc.data.note_tray_dated !== void 0 ? { noteTrayDated: doc.data.note_tray_dated } : {},
|
|
48
50
|
...doc.data.note_tray_sidebar !== void 0 ? { noteTraySidebar: doc.data.note_tray_sidebar } : {},
|
|
@@ -13,6 +13,8 @@ export interface DocNavNode {
|
|
|
13
13
|
slug: string;
|
|
14
14
|
label: string;
|
|
15
15
|
description?: string;
|
|
16
|
+
/** Raw `cover` frontmatter path of a category index page. */
|
|
17
|
+
cover?: string;
|
|
16
18
|
position: number;
|
|
17
19
|
href?: string;
|
|
18
20
|
hasPage: boolean;
|
|
@@ -57,6 +59,7 @@ export interface DocPageFrontmatter {
|
|
|
57
59
|
pagination_prev?: string | null;
|
|
58
60
|
pagination_next?: string | null;
|
|
59
61
|
tags?: string[];
|
|
62
|
+
og_image?: string;
|
|
60
63
|
[key: string]: unknown;
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
@@ -31,6 +31,13 @@ export interface SiteTreeNavWrapperProps {
|
|
|
31
31
|
* leaves behavior unchanged.
|
|
32
32
|
*/
|
|
33
33
|
currentVersion?: string;
|
|
34
|
+
/**
|
|
35
|
+
* `"described"` shows category/document descriptions and per-category
|
|
36
|
+
* document counts. Omitted keeps the standard compact grid.
|
|
37
|
+
*/
|
|
38
|
+
variant?: "default" | "described";
|
|
39
|
+
/** Disclosure-target id prefix; give distinct values for several trees on one page. */
|
|
40
|
+
idPrefix?: string;
|
|
34
41
|
}
|
|
35
42
|
/** Injected dependencies for {@link createSiteTreeNavWrapper}. */
|
|
36
43
|
export interface SiteTreeNavDeps {
|
|
@@ -96,7 +103,18 @@ export interface SiteTreeNavDeps {
|
|
|
96
103
|
* to `"locale"` — today's behaviour.
|
|
97
104
|
*/
|
|
98
105
|
dateFormat?: DateFormatSetting;
|
|
106
|
+
/**
|
|
107
|
+
* Translator for the described variant's document-count labels
|
|
108
|
+
* (`siteTreeNav.documentCount.one` / `.other`). Optional for existing
|
|
109
|
+
* hand-constructed deps; omitted leaves the island's English default.
|
|
110
|
+
*/
|
|
111
|
+
t?: (key: string, locale: string) => string;
|
|
99
112
|
}
|
|
113
|
+
/** Locale-resolved described-variant count templates, or `undefined` without a translator. */
|
|
114
|
+
export declare function resolveSiteTreeNavCountLabels(t: ((key: string, locale: string) => string) | undefined, locale: string): {
|
|
115
|
+
one: string;
|
|
116
|
+
other: string;
|
|
117
|
+
} | undefined;
|
|
100
118
|
/**
|
|
101
119
|
* Create the `SiteTreeNavWrapper` component bound to the host's nav source
|
|
102
120
|
* and tree-building dependencies.
|