@vercel/geistdocs 2.15.4-canary.2a54b38 → 2.16.0-canary.abbda54

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.
Files changed (81) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/config.d.ts +3 -3
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
  5. package/dist/internal/mdx-to-markdown.js +0 -9
  6. package/dist/internal/navbar/mobile-menu.d.ts +3 -3
  7. package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
  8. package/dist/internal/navbar/mobile-menu.js +3 -3
  9. package/dist/internal/navbar/navbar-logo.d.ts +5 -3
  10. package/dist/internal/navbar/navbar-logo.d.ts.map +1 -1
  11. package/dist/internal/navbar/navbar-logo.js +71 -14
  12. package/dist/internal/page-actions.d.ts +4 -4
  13. package/dist/internal/page-actions.d.ts.map +1 -1
  14. package/dist/internal/page-actions.js +1 -6
  15. package/dist/mdx.d.ts +25 -3
  16. package/dist/mdx.d.ts.map +1 -1
  17. package/dist/mdx.js +61 -8
  18. package/dist/navbar.js +4 -3
  19. package/dist/next.d.ts +15 -12
  20. package/dist/next.d.ts.map +1 -1
  21. package/dist/next.js +28 -86
  22. package/dist/pages/docs.d.ts +98 -5
  23. package/dist/pages/docs.d.ts.map +1 -1
  24. package/dist/pages/docs.js +250 -13
  25. package/dist/routes/search.d.ts +8 -1
  26. package/dist/routes/search.d.ts.map +1 -1
  27. package/dist/routes/search.js +120 -82
  28. package/dist/source-config.d.ts +3 -10
  29. package/dist/source-config.d.ts.map +1 -1
  30. package/dist/source-config.js +12 -21
  31. package/dist/source.d.ts +17 -6
  32. package/dist/source.d.ts.map +1 -1
  33. package/dist/source.js +75 -2
  34. package/docs/agents.md +1 -1
  35. package/docs/llms.txt +70 -14
  36. package/docs/manifest.json +1 -1
  37. package/docs/pages/configuration.md +69 -13
  38. package/package.json +20 -35
  39. package/rehype-code-highlights.d.ts +1 -1
  40. package/rehype-code-highlights.js +49 -1
  41. package/search-index.d.ts +14 -0
  42. package/search-index.js +447 -0
  43. package/source-config-public.d.ts +15 -0
  44. package/source-config-public.js +47 -0
  45. package/source-config.js +12 -27
  46. package/template/AGENTS.md +4 -0
  47. package/template/app/api/search/route.ts +7 -2
  48. package/template/content/docs/configuration.mdx +69 -13
  49. package/template/lib/geistdocs/search-source.ts +6 -0
  50. package/template/next.config.ts +1 -1
  51. package/template/package.json +4 -7
  52. package/template/source.config.ts +1 -1
  53. package/dist/internal/source-loader.d.ts +0 -28
  54. package/dist/internal/source-loader.d.ts.map +0 -1
  55. package/dist/internal/source-loader.js +0 -77
  56. package/dist/mdx-basic.d.ts +0 -27
  57. package/dist/mdx-basic.d.ts.map +0 -1
  58. package/dist/mdx-basic.js +0 -61
  59. package/dist/navigation.d.ts +0 -11
  60. package/dist/navigation.d.ts.map +0 -1
  61. package/dist/navigation.js +0 -8
  62. package/dist/pages/docs-custom.d.ts +0 -111
  63. package/dist/pages/docs-custom.d.ts.map +0 -1
  64. package/dist/pages/docs-custom.js +0 -250
  65. package/native-mdx/LICENSE-mdxjs-rs +0 -22
  66. package/native-mdx/UPSTREAM.md +0 -16
  67. package/native-mdx/binaries/darwin-arm64.node +0 -0
  68. package/native-mdx/binaries/linux-x64-gnu.node +0 -0
  69. package/native-mdx/data-entry.d.mts +0 -15
  70. package/native-mdx/data-entry.mjs +0 -97
  71. package/native-mdx/data-projection.mjs +0 -205
  72. package/native-mdx/fumadocs-adapter.mjs +0 -36
  73. package/native-mdx/index-emitter.mjs +0 -34
  74. package/native-mdx/loader-data.cjs +0 -36
  75. package/native-mdx/loader-mdx.cjs +0 -9
  76. package/native-mdx/loader-mdx.mjs +0 -419
  77. package/native-mdx/native-binding.cjs +0 -27
  78. package/native-mdx/navigation-entry.d.mts +0 -11
  79. package/native-mdx/navigation-entry.mjs +0 -136
  80. package/native-mdx/navigation-title.mjs +0 -53
  81. package/template/pnpm-workspace.yaml +0 -3
@@ -105,7 +105,7 @@ export const navbarBrand: GeistdocsNavbarBrand = "labs";
105
105
 
106
106
  The generated `lib/geistdocs/config.tsx` forwards this export to `defineConfig`. Existing sites can forward it in their adapter or set `navbarBrand: "labs"` directly in `defineConfig`. Private projects use the type from `@vercel/geistdocs-private/config`.
107
107
 
108
- Labs links to [vercel.com/labs](https://vercel.com/labs) and adapts to light and dark themes. Brand selection is independent of `navbarVariant`, which selects the `"oss"` (default) or `"vercel"` layout; either supports both brands. The previous `"standard"` value remains supported as an alias for `"vercel"`. The OSS layout keeps your project's `Logo` and `logoHref` separate from the brand. The Vercel layout shows only the selected brand mark, with no separator, project logo, or OSS products menu.
108
+ Labs links to [vercel.com/labs](https://vercel.com/labs) and adapts to light and dark themes. Set `navbarVariant: "vercel-labs"` in `defineConfig` to use the Labs mark and show the Labs products and experiments menu. The previous `"standard"` value remains supported as an alias for `"vercel"`. The `"oss"` (default) layout keeps your project's `Logo` and `logoHref` separate from the brand and shows the OSS product menu. The `"vercel"` layout shows the selected brand mark, with no separator, project logo, or product menu.
109
109
 
110
110
  For new projects, both CLIs accept `--brand labs`; omitting it or using `--brand vercel` preserves the defaults. See [Create a Labs starter](/docs/getting-started#create-a-labs-starter).
111
111
 
@@ -285,32 +285,88 @@ export const docs = defineDocs({
285
285
  export default defineGeistdocsSourceConfig();
286
286
  ```
287
287
 
288
- ### MDX compiler
288
+ ### Search-only collections
289
289
 
290
- `createGeistdocs()` uses the native Rust MDX compiler by default with both Turbopack and webpack. Compatible pages compile natively; custom plugins, Shiki, unsupported content and platforms without a native binary use the JS pipeline automatically. Build output reports fallback reasons.
290
+ Enable generation of search data without compiled page bodies:
291
291
 
292
- Select a compiler in `next.config.ts`:
292
+ ```ts title="source.config.ts"
293
+ export default defineGeistdocsSourceConfig({ searchIndex: true });
294
+ ```
293
295
 
294
- ```ts
295
- const withGeistdocs = createGeistdocs({ mdxCompiler: "auto" });
296
+ Also enable preparation in the Next wrapper. It waits for codegen before bundling
297
+ and skips source extraction in `next start`:
298
+
299
+ ```ts title="next.config.ts"
300
+ const withGeistdocs = createGeistdocs({ searchIndex: true });
301
+ export default withGeistdocs(config);
296
302
  ```
297
303
 
298
- - `"auto"` (default): native when compatible, JS otherwise.
299
- - `"native"`: fail if a page needs JS fallback; useful for checking native coverage.
300
- - `"js"`: use the existing JS compiler for every page.
304
+ With this option, the wrapper returns a phase-aware Next config function. Export
305
+ it directly as above; apply other Next config wrappers to `config` first.
301
306
 
302
- Frontmatter-only requests do not compile page bodies. Native binaries ship with Geistdocs for macOS arm64 and Linux x64 (glibc 2.31+); consumers do not install Rust or a separate compiler package. Unsupported native content currently includes npm fences, Markdown images, includes, explicit code-tab wrappers and math. Actual native compiler errors fail the build instead of silently switching compilers.
307
+ Run your existing `fumadocs-mdx` postinstall command to generate
308
+ `.source/search/<collection>.ts`. Each module exports a collection compatible
309
+ with `createSource`; its frontmatter, sections, and metadata contain no MDX
310
+ imports. Keep the same source options (base URL, slugs, locales, page-tree
311
+ customization) as your rendering source, in a shared module that does not import
312
+ `.source/server`.
303
313
 
304
- ### Code highlighter
314
+ ```ts title="lib/geistdocs/search-source.ts"
315
+ import { createSource } from "@vercel/geistdocs/source";
316
+ import docs from "@/.source/search/docs";
317
+ import { config } from "./config";
305
318
 
306
- For a custom highlighter, pass `highlighter: false` to `defineGeistdocsSourceConfig`; the native compiler will fall back to JS so your plugins run. Passing `mdxOptions.rehypeCodeOptions: false` to the helper also disables built-in highlighting.
319
+ export const searchSource = createSource({ docs, config });
320
+ ```
307
321
 
308
- Code blocks are tokenized by [Highlights](https://diffs.com/highlights), which uses hand-written WebAssembly lexers, and rendered with the same HTML as Shiki: Geist colors, titles, icons, tabs, and `[!code ...]` notation all work. Languages without a built-in Highlights lexer render as plain text. To use Shiki's TextMate grammars instead, for example for an unsupported language, pass `highlighter: "shiki"`:
322
+ ```ts title="app/api/search/route.ts"
323
+ import { createSearchRoute } from "@vercel/geistdocs/routes/search";
324
+ import { config } from "@/lib/geistdocs/config";
325
+
326
+ export const GET = createSearchRoute({
327
+ config,
328
+ loadSources: async () => {
329
+ const { searchSource } = await import("@/lib/geistdocs/search-source");
330
+ return [searchSource];
331
+ },
332
+ });
333
+ ```
334
+
335
+ Use either `loadSources` or the existing `source`/`sources` options. Concurrent
336
+ requests share initialization; a failed initialization can be retried. Only the
337
+ requested locale's indexes are built. For versioned sites, create one lazy route
338
+ per version and dispatch to it using your existing version selector. Do not
339
+ import a barrel that also loads the rendering sources.
340
+
341
+ The generator runs the collection's schemas, frontmatter/VFile/metadata hooks,
342
+ and resolved remark plugins, including Markdown includes. It skips highlighting,
343
+ rehype, and recma, and adds a separate remark pass during codegen. Custom search
344
+ content must be recorded in `structuredData` by the remark pipeline. Collection
345
+ MDX overrides must retain `remarkStructure`. Metadata must serialize as JSON
346
+ values or Dates; custom runtime exports, page bodies, and Markdown methods are
347
+ not available on search-only pages. Filters must use stable metadata, not render
348
+ or load page bodies. Keep generated modules server-only: internal pages and
349
+ custom metadata may be present, with `internal`, `excludeFrom`, and `filterPage`
350
+ applied by the search route before returning results.
351
+
352
+ This works in development, previews, and production, in both packages. Content,
353
+ metadata, and registered include dependencies regenerate on edits; generation
354
+ errors invalidate old output and fail production/codegen commands. Orama still
355
+ builds its indexes on first search. Keep `.source/server` for docs rendering,
356
+ Markdown exports, and chat.
357
+
358
+ ### Code highlighter (public package)
359
+
360
+ The public package uses [Highlights](https://diffs.com/highlights), which tokenizes code with WebAssembly lexers while keeping the JavaScript MDX compiler. Geist colors, titles, icons, tabs and `[!code ...]` annotations are preserved. Some token colors differ from Shiki, and unsupported languages render as plain text. To use Shiki's TextMate grammars instead, pass `highlighter: "shiki"`:
309
361
 
310
362
  ```ts title="source.config.ts"
311
363
  export default defineGeistdocsSourceConfig({ highlighter: "shiki" });
312
364
  ```
313
365
 
366
+ Set `highlighter: false` or `mdxOptions.rehypeCodeOptions: false` to disable built-in highlighting when providing your own plugin. A `rehypePlugins` callback can also remove or replace Fumadocs' default highlighter without Highlights being added back.
367
+
368
+ The private package retains its existing Shiki pipeline. The `highlighter` option above is available only in the public package.
369
+
314
370
  To serve docs from the site root, use `route: "/"` in `content` and `baseUrl: "/"` in `createSource`. Root-mounted docs need explicit `markdownRoutes`; Geistdocs does not infer a broad `/*path` mapping because it can capture homepages and non-docs app routes.
315
371
 
316
372
  ## Page URLs
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vercel/geistdocs",
3
3
  "description": "Runtime and CLI for Geistdocs projects.",
4
- "version": "2.15.4-canary.2a54b38",
4
+ "version": "2.16.0-canary.abbda54",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -34,13 +34,16 @@
34
34
  "remark-details.d.ts",
35
35
  "remark-details.js",
36
36
  "source-config.js",
37
+ "source-config-public.js",
38
+ "source-config-public.d.ts",
37
39
  "template",
38
40
  "public-foundation.css",
39
41
  "shared-theme.css",
40
42
  "styles.css",
41
43
  "theme.css",
42
44
  "LICENSE",
43
- "native-mdx"
45
+ "search-index.js",
46
+ "search-index.d.ts"
44
47
  ],
45
48
  "exports": {
46
49
  "./changelog": {
@@ -95,10 +98,6 @@
95
98
  "types": "./dist/source.d.ts",
96
99
  "default": "./dist/source.js"
97
100
  },
98
- "./navigation": {
99
- "types": "./dist/navigation.d.ts",
100
- "default": "./dist/navigation.js"
101
- },
102
101
  "./sidebar": {
103
102
  "types": "./dist/sidebar.d.ts",
104
103
  "default": "./dist/sidebar.js"
@@ -168,8 +167,8 @@
168
167
  "default": "./dist/providers/public/utils.js"
169
168
  },
170
169
  "./source-config": {
171
- "types": "./dist/source-config.d.ts",
172
- "default": "./source-config.js"
170
+ "types": "./source-config-public.d.ts",
171
+ "default": "./source-config-public.js"
173
172
  },
174
173
  "./docs/agents.md": "./docs/agents.md",
175
174
  "./docs/llms.txt": "./docs/llms.txt",
@@ -306,35 +305,18 @@
306
305
  },
307
306
  "./styles.css": "./styles.css",
308
307
  "./theme.css": "./theme.css",
309
- "./package.json": "./package.json",
310
- "./pages/docs/custom": {
311
- "types": "./dist/pages/docs-custom.d.ts",
312
- "default": "./dist/pages/docs-custom.js"
313
- },
314
- "./mdx/basic": {
315
- "types": "./dist/mdx-basic.d.ts",
316
- "default": "./dist/mdx-basic.js"
317
- },
318
- "./native-mdx": "./native-mdx/loader-mdx.cjs",
319
- "./native-mdx/data-loader": "./native-mdx/loader-data.cjs",
320
- "./native-mdx/data-entry": {
321
- "types": "./native-mdx/data-entry.d.mts",
322
- "import": "./native-mdx/data-entry.mjs"
323
- },
324
- "./native-mdx/navigation-entry": {
325
- "types": "./native-mdx/navigation-entry.d.mts",
326
- "import": "./native-mdx/navigation-entry.mjs"
327
- }
308
+ "./package.json": "./package.json"
328
309
  },
329
310
  "scripts": {
330
- "build": "node ../../scripts/prepare-native-loader.mjs --runtime-only && rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
311
+ "build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
331
312
  "dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
332
313
  },
333
314
  "dependencies": {
334
315
  "@ai-sdk/react": "^3.0.134",
335
316
  "@clack/prompts": "^0.11.0",
336
- "@modelcontextprotocol/server": "^2.3.0",
337
- "@next/env": "16.4.5",
317
+ "@mdx-js/mdx": "^3.1.1",
318
+ "@modelcontextprotocol/server": "^2.0.0",
319
+ "@next/env": "16.3.3",
338
320
  "@orama/tokenizers": "^3.1.16",
339
321
  "@pierre/highlights": "0.5.1",
340
322
  "@shikijs/rehype": "3.19.0",
@@ -353,9 +335,10 @@
353
335
  "fumadocs-mdx": "14.0.4",
354
336
  "fumadocs-ui": "16.2.2",
355
337
  "geist": "1.7.1",
356
- "glob": "^14.0.2",
338
+ "glob": "^11.0.0",
339
+ "js-yaml": "^4.1.1",
357
340
  "mcp-handler": "2.2.0",
358
- "mermaid": "^11.16.1",
341
+ "mermaid": "^11.12.2",
359
342
  "next-themes": "^0.4.6",
360
343
  "phase": "^0.5.4",
361
344
  "radix-ui": "1.6.4",
@@ -370,16 +353,18 @@
370
353
  "sonner": "^2.0.8",
371
354
  "streamdown": "^2.1.0",
372
355
  "tailwind-merge": "^3.4.0",
356
+ "tinyglobby": "^0.2.15",
373
357
  "ts-morph": "^27.0.2",
374
358
  "tw-animate-css": "^1.4.0",
375
359
  "unified": "^11.0.5",
376
360
  "unist-util-visit": "^5.1.0",
377
361
  "use-stick-to-bottom": "^1.1.1",
378
362
  "vaul": "^1.1.2",
379
- "zod": "^4.6.6"
363
+ "vfile": "^6.0.3",
364
+ "zod": "^4.6.5"
380
365
  },
381
366
  "peerDependencies": {
382
- "next": "^16.4.5",
367
+ "next": "^16.3.3",
383
368
  "react": "^19.2.3",
384
369
  "react-dom": "^19.2.3",
385
370
  "tailwindcss": "^4.1.17"
@@ -391,7 +376,7 @@
391
376
  "@types/node": "^24.10.1",
392
377
  "@types/react-dom": "^19.2.3",
393
378
  "mdast-util-mdx-jsx": "^3.2.0",
394
- "next": "16.4.5",
379
+ "next": "16.3.3",
395
380
  "react": "^19.2.3",
396
381
  "react-dom": "^19.2.3",
397
382
  "tsup": "^8.5.1",
@@ -5,7 +5,7 @@ import type { Root } from "hast";
5
5
  export declare const geistHighlightsTheme: Record<string, unknown>;
6
6
 
7
7
  /**
8
- * Experimental drop-in for Fumadocs' `rehypeCode` that tokenizes with
8
+ * Drop-in for Fumadocs' `rehypeCode` that tokenizes with
9
9
  * @pierre/highlights while keeping Shiki's HAST output and transformers.
10
10
  */
11
11
  export declare const rehypeCodeHighlights: (
@@ -7,7 +7,7 @@ import {
7
7
  } from "fumadocs-core/mdx-plugins";
8
8
  import { tokensToHast, transformerDecorations } from "shiki/core";
9
9
 
10
- // Experimental: highlights code blocks with @pierre/highlights (hand-written
10
+ // Highlights code blocks with @pierre/highlights (hand-written
11
11
  // Wasm lexers) instead of Shiki's TextMate grammars, while keeping Shiki's
12
12
  // HAST output and transformer pipeline so Fumadocs' code block features
13
13
  // (titles, icons, tabs, line notation, diffs, focus) keep working.
@@ -116,6 +116,53 @@ const getTransformers = (options) => [
116
116
  ];
117
117
 
118
118
  const UNSTYLED = "var(--shiki-foreground)";
119
+ const COMMENT = "var(--shiki-token-comment)";
120
+ const TRAILING_SPACE = /[\t ]+$/;
121
+
122
+ const joinCommentWhitespace = (line) => {
123
+ for (let index = 1; index < line.length; index++) {
124
+ const token = line[index];
125
+ if (token.htmlStyle?.color !== COMMENT) {
126
+ continue;
127
+ }
128
+ // Shiki groups JSX indentation with the opening brace. Its annotation
129
+ // transformer recognizes a standalone JSX comment by those three tokens.
130
+ const opening = index - 1;
131
+ if (
132
+ token.content.trimStart().startsWith("/*") &&
133
+ line[opening].content.trim() === "{" &&
134
+ line[index + 1]?.content.trim() === "}" &&
135
+ line.slice(0, opening).every((part) => part.content.trim() === "")
136
+ ) {
137
+ const indentation = line
138
+ .slice(0, opening)
139
+ .map((part) => part.content)
140
+ .join("");
141
+ line[opening].content = indentation + line[opening].content;
142
+ line[opening].offset -= indentation.length;
143
+ line.splice(0, opening);
144
+ index -= opening;
145
+ }
146
+ // Shiki includes the separator before a comment in its comment token.
147
+ // Match that boundary so notation removal also removes the separator,
148
+ // without trimming authored whitespace from unrelated code lines.
149
+ while (index > 0) {
150
+ const previous = line[index - 1];
151
+ const whitespace = previous.content.match(TRAILING_SPACE)?.[0];
152
+ if (!whitespace) {
153
+ break;
154
+ }
155
+ previous.content = previous.content.slice(0, -whitespace.length);
156
+ token.content = whitespace + token.content;
157
+ token.offset -= whitespace.length;
158
+ if (previous.content) {
159
+ break;
160
+ }
161
+ line.splice(index - 1, 1);
162
+ index--;
163
+ }
164
+ }
165
+ };
119
166
 
120
167
  const tokenize = (code, options) => {
121
168
  const result = codeToTokens(code, {
@@ -127,6 +174,7 @@ const tokenize = (code, options) => {
127
174
  // Highlights colors unstyled runs with `var(--shiki-foreground)`; Shiki uses
128
175
  // the theme foreground, which Geist defines as `--shiki-color-text`.
129
176
  for (const line of result.tokens) {
177
+ joinCommentWhitespace(line);
130
178
  for (const token of line) {
131
179
  if (token.htmlStyle?.color === UNSTYLED) {
132
180
  token.htmlStyle = { ...token.htmlStyle, color: result.fg };
@@ -0,0 +1,14 @@
1
+ import type { defineConfig } from "fumadocs-mdx/config";
2
+ /** Generates search-only collections in .source/search before bundling. */
3
+ export declare const searchIndex: () => NonNullable<
4
+ NonNullable<Parameters<typeof defineConfig>[0]>["plugins"]
5
+ >[number];
6
+
7
+ /** Internal Next integration: await generation and surface extraction failures. */
8
+ export declare const prepareSearchIndex: (
9
+ options?: import("fumadocs-mdx/next").CreateMDXOptions
10
+ ) => Promise<void>;
11
+
12
+ export declare const skipSearchIndexGeneration: (
13
+ options?: import("fumadocs-mdx/next").CreateMDXOptions
14
+ ) => void;