@vercel/geistdocs 2.16.0-canary.abbda54 → 3.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/dist/cli/index.js +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/internal/lazy-mdx-components.d.ts +0 -2
- package/dist/internal/lazy-mdx-components.d.ts.map +1 -1
- package/dist/internal/lazy-mdx-components.js +0 -1
- package/dist/internal/mermaid-source.d.ts +5 -0
- package/dist/internal/mermaid-source.d.ts.map +1 -0
- package/dist/internal/mermaid-source.js +5 -0
- package/dist/internal/page-action-options.d.ts +9 -4
- package/dist/internal/page-action-options.d.ts.map +1 -1
- package/dist/internal/page-action-options.js +19 -12
- package/dist/internal/page-actions-client.d.ts.map +1 -1
- package/dist/internal/page-actions-client.js +19 -112
- package/dist/internal/page-actions-gate.d.ts +6 -0
- package/dist/internal/page-actions-gate.d.ts.map +1 -1
- package/dist/internal/page-actions-gate.js +11 -9
- package/dist/internal/page-actions-menu-client.d.ts +8 -0
- package/dist/internal/page-actions-menu-client.d.ts.map +1 -0
- package/dist/internal/page-actions-menu-client.js +105 -0
- package/dist/internal/page-markdown.d.ts +3 -0
- package/dist/internal/page-markdown.d.ts.map +1 -0
- package/dist/internal/page-markdown.js +45 -0
- package/dist/internal/toc-actions-client.d.ts +3 -1
- package/dist/internal/toc-actions-client.d.ts.map +1 -1
- package/dist/internal/toc-actions-client.js +7 -9
- package/dist/mdx.js +3 -2
- package/dist/next.d.ts +2 -15
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +5 -27
- package/dist/pages/docs.d.ts +6 -1
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +11 -6
- package/dist/routes/search.d.ts +1 -8
- package/dist/routes/search.d.ts.map +1 -1
- package/dist/routes/search.js +82 -120
- package/dist/source-config.d.ts +0 -2
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +0 -2
- package/docs/agents.md +2 -3
- package/docs/llms.txt +31 -250
- package/docs/manifest.json +2 -11
- package/docs/pages/changelog.md +1 -1
- package/docs/pages/components/index.md +0 -1
- package/docs/pages/configuration.md +24 -73
- package/docs/pages/edit-on-github.md +1 -1
- package/docs/pages/index.md +0 -29
- package/docs/pages/md.md +1 -1
- package/docs/pages/migration.md +1 -1
- package/docs/pages/syntax.md +1 -107
- package/docs/sitemap.md +1 -2
- package/package.json +14 -14
- package/source-config.js +0 -2
- package/template/AGENTS.md +0 -4
- package/template/app/[lang]/docs/[[...slug]]/page.tsx +1 -0
- package/template/app/api/search/route.ts +2 -7
- package/template/content/docs/changelog.mdx +1 -1
- package/template/content/docs/components/index.mdx +0 -1
- package/template/content/docs/components/meta.json +0 -1
- package/template/content/docs/configuration.mdx +24 -73
- package/template/content/docs/edit-on-github.mdx +1 -1
- package/template/content/docs/index.mdx +0 -28
- package/template/content/docs/md.mdx +1 -1
- package/template/content/docs/migration.mdx +1 -1
- package/template/content/docs/syntax.cn.mdx +1 -107
- package/template/content/docs/syntax.mdx +1 -107
- package/template/next.config.ts +1 -1
- package/template/package.json +1 -2
- package/template/source.config.ts +1 -1
- package/docs/pages/components/mermaid.md +0 -29
- package/search-index.d.ts +0 -14
- package/search-index.js +0 -447
- package/template/content/docs/components/mermaid.mdx +0 -25
- package/template/lib/geistdocs/search-source.ts +0 -6
package/dist/routes/search.js
CHANGED
|
@@ -50,25 +50,15 @@ const getBreadcrumbs = (pageTree, url) => {
|
|
|
50
50
|
}
|
|
51
51
|
return breadcrumbs.length > 0 ? breadcrumbs : undefined;
|
|
52
52
|
};
|
|
53
|
-
export const createSearchRoute = ({ config, filterPage,
|
|
53
|
+
export const createSearchRoute = ({ config, filterPage, source, sources, }) => {
|
|
54
54
|
const translations = config.translations ?? {};
|
|
55
|
-
|
|
56
|
-
(source !== undefined || sources !== undefined)) {
|
|
57
|
-
throw new Error("createSearchRoute loadSources cannot be combined with source or sources.");
|
|
58
|
-
}
|
|
59
|
-
const routeSources = loadSources ? [] : resolveSources(source, sources);
|
|
55
|
+
const routeSources = resolveSources(source, sources);
|
|
60
56
|
const { defaultLanguage, languages } = getLanguages(config);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.catch((error) => {
|
|
67
|
-
sourcesPromise = undefined;
|
|
68
|
-
throw error;
|
|
69
|
-
});
|
|
70
|
-
return sourcesPromise;
|
|
71
|
-
};
|
|
57
|
+
const i18n = defineI18n({
|
|
58
|
+
defaultLanguage,
|
|
59
|
+
languages,
|
|
60
|
+
hideLocale: "default-locale",
|
|
61
|
+
});
|
|
72
62
|
const localeMap = Object.fromEntries(Object.entries(translations).map(([locale, translation]) => [
|
|
73
63
|
locale,
|
|
74
64
|
translation.displayName.toLowerCase(),
|
|
@@ -95,120 +85,92 @@ export const createSearchRoute = ({ config, filterPage, loadSources, source, sou
|
|
|
95
85
|
},
|
|
96
86
|
};
|
|
97
87
|
}
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
content: [
|
|
122
|
-
...(data.structuredData?.headings ?? []),
|
|
123
|
-
...(data.structuredData?.contents ?? []),
|
|
124
|
-
]
|
|
125
|
-
.map((section) => section.content)
|
|
126
|
-
.join("\n"),
|
|
127
|
-
breadcrumbs: getBreadcrumbs(pageTree, page.url),
|
|
128
|
-
locale,
|
|
129
|
-
structuredData: data.structuredData ?? {
|
|
130
|
-
contents: [],
|
|
131
|
-
headings: [],
|
|
132
|
-
},
|
|
133
|
-
url: page.url,
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
const rankingIndex = prepareSearchIndex(indexes, locale);
|
|
138
|
-
const sections = createI18nSearchAPI("advanced", {
|
|
139
|
-
i18n,
|
|
140
|
-
indexes,
|
|
141
|
-
localeMap,
|
|
142
|
-
});
|
|
143
|
-
const pageSearch = {
|
|
144
|
-
// Page metadata must outweigh incidental mentions in paragraphs/tables.
|
|
145
|
-
boost: { title: 8, keywords: 6, description: 2, content: 1 },
|
|
146
|
-
properties: ["title", "keywords", "description", "content"],
|
|
147
|
-
// Retrieve all candidates; verify English term coverage during ranking.
|
|
148
|
-
threshold: 1,
|
|
149
|
-
tolerance: 0,
|
|
150
|
-
// Apply page limits after verifying query coverage and exact matches.
|
|
151
|
-
limit: indexes.length,
|
|
152
|
-
};
|
|
153
|
-
const pages = createI18nSearchAPI("simple", {
|
|
154
|
-
i18n,
|
|
155
|
-
localeMap: Object.fromEntries(Object.entries(localeMap).map(([locale, options]) => [
|
|
88
|
+
const getIndexes = () => languages.flatMap((locale) => routeSources.flatMap((source) => {
|
|
89
|
+
const pageTree = getPageTree(source, locale);
|
|
90
|
+
return getPages(source, locale)
|
|
91
|
+
.filter((page) => isPageVisibleForSurface(page, "search") &&
|
|
92
|
+
(filterPage?.(page, { lang: locale, source }) ?? true))
|
|
93
|
+
.map((page) => {
|
|
94
|
+
const data = page.data;
|
|
95
|
+
return {
|
|
96
|
+
id: page.url,
|
|
97
|
+
title: resolveDocumentTitle({
|
|
98
|
+
pageTitle: data.title ?? page.url,
|
|
99
|
+
pageUrl: page.url,
|
|
100
|
+
tree: pageTree,
|
|
101
|
+
}),
|
|
102
|
+
description: data.description ?? "",
|
|
103
|
+
keywords: data.keywords ?? [],
|
|
104
|
+
content: [
|
|
105
|
+
...(data.structuredData?.headings ?? []),
|
|
106
|
+
...(data.structuredData?.contents ?? []),
|
|
107
|
+
]
|
|
108
|
+
.map((section) => section.content)
|
|
109
|
+
.join("\n"),
|
|
110
|
+
breadcrumbs: getBreadcrumbs(pageTree, page.url),
|
|
156
111
|
locale,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
? options.search.threshold
|
|
164
|
-
: pageSearch.threshold,
|
|
165
|
-
},
|
|
166
|
-
}
|
|
167
|
-
: options,
|
|
168
|
-
])),
|
|
169
|
-
indexes: indexes.map((page) => ({
|
|
170
|
-
...page,
|
|
171
|
-
keywords: page.keywords.join(" "),
|
|
172
|
-
})),
|
|
173
|
-
search: pageSearch,
|
|
112
|
+
structuredData: data.structuredData ?? {
|
|
113
|
+
contents: [],
|
|
114
|
+
headings: [],
|
|
115
|
+
},
|
|
116
|
+
url: page.url,
|
|
117
|
+
};
|
|
174
118
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
await Promise.all([
|
|
179
|
-
pages.search("", { locale }),
|
|
180
|
-
sections.search("", { locale }),
|
|
181
|
-
]);
|
|
182
|
-
return { pages, sections, rankingIndex };
|
|
183
|
-
};
|
|
184
|
-
// Allocate cache entries only from configuration, never from request input.
|
|
185
|
-
const initializations = new Map(languages.map((locale) => [
|
|
119
|
+
}));
|
|
120
|
+
const indexes = getIndexes();
|
|
121
|
+
const rankingIndexes = new Map(languages.map((locale) => [
|
|
186
122
|
locale,
|
|
187
|
-
|
|
123
|
+
prepareSearchIndex(indexes.filter((page) => page.locale === locale), locale),
|
|
188
124
|
]));
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
125
|
+
const sections = createI18nSearchAPI("advanced", {
|
|
126
|
+
i18n,
|
|
127
|
+
indexes,
|
|
128
|
+
localeMap,
|
|
129
|
+
});
|
|
130
|
+
const pageSearch = {
|
|
131
|
+
// Page metadata must outweigh incidental mentions in paragraphs/tables.
|
|
132
|
+
boost: { title: 8, keywords: 6, description: 2, content: 1 },
|
|
133
|
+
properties: ["title", "keywords", "description", "content"],
|
|
134
|
+
// Retrieve all candidates; verify English term coverage during ranking.
|
|
135
|
+
threshold: 1,
|
|
136
|
+
tolerance: 0,
|
|
137
|
+
// Apply page limits after verifying query coverage and exact matches.
|
|
138
|
+
limit: indexes.length,
|
|
199
139
|
};
|
|
140
|
+
const pages = createI18nSearchAPI("simple", {
|
|
141
|
+
i18n,
|
|
142
|
+
localeMap: Object.fromEntries(Object.entries(localeMap).map(([locale, options]) => [
|
|
143
|
+
locale,
|
|
144
|
+
typeof options === "object"
|
|
145
|
+
? {
|
|
146
|
+
components: options.components,
|
|
147
|
+
search: {
|
|
148
|
+
...pageSearch,
|
|
149
|
+
threshold: options.search && "threshold" in options.search
|
|
150
|
+
? options.search.threshold
|
|
151
|
+
: pageSearch.threshold,
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
: options,
|
|
155
|
+
])),
|
|
156
|
+
indexes: indexes.map((page) => ({
|
|
157
|
+
...page,
|
|
158
|
+
keywords: page.keywords.join(" "),
|
|
159
|
+
})),
|
|
160
|
+
search: pageSearch,
|
|
161
|
+
});
|
|
200
162
|
return async (request) => {
|
|
201
163
|
const url = new URL(request.url);
|
|
202
|
-
const locale = url.searchParams.get("locale") ?? defaultLanguage;
|
|
203
|
-
const query = url.searchParams.get("query") ?? "";
|
|
204
|
-
if (!(initializations.has(locale) && query.trim())) {
|
|
205
|
-
return Response.json([]);
|
|
206
|
-
}
|
|
207
|
-
const { pages, sections, rankingIndex } = await getSearch(locale);
|
|
208
164
|
if (url.searchParams.get("mode") === "vector") {
|
|
209
165
|
return sections.GET(request);
|
|
210
166
|
}
|
|
167
|
+
const locale = url.searchParams.get("locale") ?? defaultLanguage;
|
|
168
|
+
const query = url.searchParams.get("query") ?? "";
|
|
211
169
|
const searchQuery = prepareSearchQuery(query, locale);
|
|
170
|
+
const rankingIndex = rankingIndexes.get(locale);
|
|
171
|
+
if (!(searchQuery && rankingIndex)) {
|
|
172
|
+
return Response.json([]);
|
|
173
|
+
}
|
|
212
174
|
const tag = url.searchParams.get("tag")?.split(",");
|
|
213
175
|
const [pageResults, sectionResults] = await Promise.all([
|
|
214
176
|
pages.search(searchQuery, { locale }),
|
package/dist/source-config.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ type FumadocsConfigInput = NonNullable<Parameters<typeof defineFumadocsConfig>[0
|
|
|
5
5
|
export interface GeistdocsSourceConfigOptions {
|
|
6
6
|
mdxOptions?: DefaultMDXOptions;
|
|
7
7
|
plugins?: FumadocsConfigInput["plugins"];
|
|
8
|
-
/** Generate search-only collections in .source/search (adds a remark pass). */
|
|
9
|
-
searchIndex?: boolean;
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
12
10
|
* Builds the remark pipeline from Fumadocs' resolved defaults.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,IAAI,oBAAoB,EAGrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,IAAI,oBAAoB,EAGrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,KAAK,mBAAmB,GAAG,WAAW,CACpC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CAC1C;AAQD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,SAAS,EAAE,EACrB,kBAAiB,SAAS,EAAO,KAChC,SAAS,EAgBX,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAsG3B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;iBAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GACxC,iBAAiB,iBAAiB,CAAC,eAAe,CAAC,KAClD,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAKhD,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,SAAQ,4BAAiC,+CA2B1C,CAAC"}
|
package/dist/source-config.js
CHANGED
|
@@ -4,7 +4,6 @@ import lastModified from "fumadocs-mdx/plugins/last-modified";
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { rehypeTaskListLabels } from "../rehype-task-list-labels.js";
|
|
6
6
|
import { remarkDetails } from "../remark-details.js";
|
|
7
|
-
import { searchIndex } from "../search-index.js";
|
|
8
7
|
import { getLastModified } from "./internal/last-modified.js";
|
|
9
8
|
const pluginOf = (entry) => Array.isArray(entry) ? entry[0] : entry;
|
|
10
9
|
const indexOfPlugin = (list, plugin) => list.findIndex((entry) => pluginOf(entry) === plugin);
|
|
@@ -196,7 +195,6 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
|
|
|
196
195
|
plugins: [
|
|
197
196
|
lastModified({ versionControl: getLastModified }),
|
|
198
197
|
...existingPlugins,
|
|
199
|
-
...(config.searchIndex ? [searchIndex()] : []),
|
|
200
198
|
],
|
|
201
199
|
});
|
|
202
200
|
};
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs`
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 3.0.0 so agents can understand the installed package without web access.
|
|
4
4
|
They are generated from `apps/template/content/docs` during the package build.
|
|
5
5
|
|
|
6
6
|
## How to use these files
|
|
@@ -29,7 +29,7 @@ They are generated from `apps/template/content/docs` during the package build.
|
|
|
29
29
|
- [Migrate to Geistdocs](pages/migration.md): Move an existing documentation site to @vercel/geistdocs while keeping local content, routing, middleware behavior, and AI-readable surfaces intact.
|
|
30
30
|
- [Choose a Geistdocs package](pages/packages.md): Use the public package by default and the private package only where restricted Vercel npm dependencies are already available.
|
|
31
31
|
- [Configuration](pages/configuration.md): Configure site metadata, navigation, AI features, page actions, translations, and local adapters.
|
|
32
|
-
- [MDX Components](pages/syntax.md): MDX component and authoring reference covering tabs, text formatting, code blocks, line highlighting
|
|
32
|
+
- [MDX Components](pages/syntax.md): MDX component and authoring reference covering tabs, text formatting, code blocks, and line highlighting.
|
|
33
33
|
- [Geistdocs Provider](pages/provider.md): The root provider component that wraps your application to handle toast notifications, search, and analytics.
|
|
34
34
|
- [Versioned docs](pages/versioned-docs.md): Use createVersionedSources to configure stable, pre-release, or host-based documentation versions.
|
|
35
35
|
- [Proxy and markdown routes](pages/proxy.md): Configure createProxy with generated route discovery, request hooks, markdown mappings, and a static Next.js matcher.
|
|
@@ -56,7 +56,6 @@ They are generated from `apps/template/content/docs` during the package build.
|
|
|
56
56
|
- [Input](pages/components/input.md): Use Input for text entry in custom documentation and application interfaces.
|
|
57
57
|
- [Internationalization](pages/internationalization.md): Serve documentation in multiple languages with automatic translation via the Geistdocs CLI and Fumadocs routing.
|
|
58
58
|
- [llms.txt](pages/llms-txt.md): A single endpoint that returns all documentation as plain Markdown text following the llms.txt standard.
|
|
59
|
-
- [Mermaid](pages/components/mermaid.md): Use Mermaid directly when diagram source is assembled outside an MDX Mermaid fence.
|
|
60
59
|
- [Native Link](pages/components/link.md): Use NativeDocsLink where Next.js client navigation is not appropriate.
|
|
61
60
|
- [Navigation Menu](pages/components/navigation-menu.md): Compose NavigationMenu primitives for custom product and documentation navigation.
|
|
62
61
|
- [Open in Chat](pages/open-in-chat.md): Transfer documentation context to AI chat platforms like ChatGPT, Claude, Cursor, and v0 with a single click.
|