@vercel/geistdocs 2.15.3-canary.f771302 → 2.15.4-canary.2a54b38

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 (39) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/internal/page-actions-client.js +1 -1
  3. package/dist/internal/source-loader.d.ts +28 -0
  4. package/dist/internal/source-loader.d.ts.map +1 -0
  5. package/dist/internal/source-loader.js +77 -0
  6. package/dist/mobile-docs-bar.js +1 -1
  7. package/dist/navigation.d.ts +11 -0
  8. package/dist/navigation.d.ts.map +1 -0
  9. package/dist/navigation.js +8 -0
  10. package/dist/next.d.ts +4 -2
  11. package/dist/next.d.ts.map +1 -1
  12. package/dist/next.js +75 -18
  13. package/dist/source-config.d.ts +2 -2
  14. package/dist/source-config.d.ts.map +1 -1
  15. package/dist/source-config.js +3 -2
  16. package/dist/source.d.ts +6 -17
  17. package/dist/source.d.ts.map +1 -1
  18. package/dist/source.js +2 -75
  19. package/docs/agents.md +1 -1
  20. package/docs/llms.txt +19 -1
  21. package/docs/manifest.json +1 -1
  22. package/docs/pages/configuration.md +18 -0
  23. package/native-mdx/UPSTREAM.md +16 -0
  24. package/native-mdx/binaries/darwin-arm64.node +0 -0
  25. package/native-mdx/binaries/linux-x64-gnu.node +0 -0
  26. package/native-mdx/data-entry.mjs +5 -24
  27. package/native-mdx/fumadocs-adapter.mjs +36 -0
  28. package/native-mdx/index-emitter.mjs +34 -0
  29. package/native-mdx/loader-mdx.mjs +237 -53
  30. package/native-mdx/native-binding.cjs +5 -3
  31. package/native-mdx/navigation-entry.d.mts +11 -0
  32. package/native-mdx/navigation-entry.mjs +136 -0
  33. package/native-mdx/navigation-title.mjs +53 -0
  34. package/package.json +17 -9
  35. package/shared-theme.css +7 -1
  36. package/source-config.js +5 -2
  37. package/template/content/docs/configuration.mdx +18 -0
  38. package/template/package.json +7 -4
  39. package/template/pnpm-workspace.yaml +3 -0
@@ -0,0 +1,136 @@
1
+ import { extendIndexEmitter } from "./index-emitter.mjs";
2
+
3
+ const MDX_EXTENSION = /\.mdx?$/;
4
+ const META_EXTENSION = /\.json$/;
5
+
6
+ /** Add navigation.ts to Fumadocs' existing discovery/watch lifecycle. */
7
+ export function navigationEntryPlugin(typeScriptOrLoader) {
8
+ let parserPromise;
9
+ const getParser = () =>
10
+ (parserPromise ??= Promise.resolve()
11
+ .then(() =>
12
+ typeof typeScriptOrLoader === "function"
13
+ ? typeScriptOrLoader()
14
+ : typeScriptOrLoader
15
+ )
16
+ .then((module) => module.default ?? module));
17
+ return {
18
+ name: "geistdocs-navigation-entry",
19
+ config() {
20
+ const collections = this.core.getConfig?.().collectionList ?? [];
21
+ for (const collection of collections) {
22
+ const doc = collection.type === "docs" ? collection.docs : collection;
23
+ if (doc.dynamic || doc.async) {
24
+ throw new Error(
25
+ "Navigation entries require synchronous collections; disable docs.async and docs.dynamic"
26
+ );
27
+ }
28
+ }
29
+ extendIndexEmitter(
30
+ this,
31
+ "geistdocs-navigation-entry",
32
+ async (entries) => {
33
+ const server = entries.find((entry) => entry.path === "server.ts");
34
+ if (
35
+ !server ||
36
+ entries.some((entry) => entry.path === "navigation.ts")
37
+ ) {
38
+ throw new Error(
39
+ "Content entries require server.ts and an unused navigation.ts output"
40
+ );
41
+ }
42
+ return [
43
+ ...entries,
44
+ {
45
+ path: "navigation.ts",
46
+ content: createNavigationEntry(server.content, await getParser())
47
+ .code,
48
+ },
49
+ ];
50
+ }
51
+ );
52
+ },
53
+ };
54
+ }
55
+
56
+ /** Metadata queries only: no renderable MDX imports, including dynamic ones. */
57
+ export function createNavigationEntry(serverCode, ts) {
58
+ const file = ts.createSourceFile(
59
+ "server.ts",
60
+ serverCode,
61
+ ts.ScriptTarget.Latest,
62
+ true,
63
+ ts.ScriptKind.TS
64
+ );
65
+ if (file.parseDiagnostics.length) {
66
+ throw new Error("Cannot parse generated server entry");
67
+ }
68
+ const edits = [];
69
+ function inspect(node) {
70
+ if (
71
+ ts.isMetaProperty(node) &&
72
+ node.keywordToken === ts.SyntaxKind.ImportKeyword
73
+ ) {
74
+ throw new Error("Navigation entries do not support Vite glob entries");
75
+ }
76
+ if (
77
+ ts.isCallExpression(node) &&
78
+ (node.expression.kind === ts.SyntaxKind.ImportKeyword ||
79
+ (ts.isPropertyAccessExpression(node.expression) &&
80
+ ["docsLazy", "docLazy"].includes(node.expression.name.text)))
81
+ ) {
82
+ throw new Error(
83
+ "Navigation entries currently require synchronous Fumadocs collections; leave docs.async disabled"
84
+ );
85
+ }
86
+ ts.forEachChild(node, inspect);
87
+ }
88
+ inspect(file);
89
+ for (const statement of file.statements) {
90
+ if (
91
+ !(
92
+ ts.isImportDeclaration(statement) &&
93
+ ts.isStringLiteral(statement.moduleSpecifier)
94
+ )
95
+ ) {
96
+ continue;
97
+ }
98
+ const specifier = statement.moduleSpecifier;
99
+ const separator = specifier.text.indexOf("?");
100
+ const pathname =
101
+ separator < 0 ? specifier.text : specifier.text.slice(0, separator);
102
+ if (!MDX_EXTENSION.test(pathname)) {
103
+ if (
104
+ !(
105
+ statement.importClause?.isTypeOnly ||
106
+ META_EXTENSION.test(pathname) ||
107
+ pathname === "fumadocs-mdx/runtime/server"
108
+ )
109
+ ) {
110
+ throw new Error(`Unsupported navigation runtime import: ${pathname}`);
111
+ }
112
+ continue;
113
+ }
114
+ const query = new URLSearchParams(
115
+ separator < 0 ? "" : specifier.text.slice(separator + 1)
116
+ );
117
+ if (!query.has("collection")) {
118
+ throw new Error(
119
+ "Navigation MDX imports must identify a Fumadocs collection"
120
+ );
121
+ }
122
+ query.delete("geistdocs-data");
123
+ query.set("only", "frontmatter");
124
+ query.set("geistdocs-navigation", "1");
125
+ edits.push({
126
+ start: specifier.getStart(file),
127
+ end: specifier.end,
128
+ value: JSON.stringify(`${pathname}?${query}`),
129
+ });
130
+ }
131
+ let code = serverCode;
132
+ for (const edit of edits.reverse()) {
133
+ code = code.slice(0, edit.start) + edit.value + code.slice(edit.end);
134
+ }
135
+ return { code, imports: edits.length };
136
+ }
@@ -0,0 +1,53 @@
1
+ let parserPromise;
2
+
3
+ /** Parse only when frontmatter omits a title. Never compile or evaluate MDX. */
4
+ export async function navigationTitle(content, format = "mdx") {
5
+ parserPromise ??= Promise.all([
6
+ import("unified"),
7
+ import("remark-parse"),
8
+ import("remark-mdx"),
9
+ import("remark-gfm"),
10
+ import("fumadocs-core/mdx-plugins/remark-heading"),
11
+ import("fumadocs-core/mdx-plugins/remark-steps"),
12
+ ]);
13
+ const [
14
+ { unified },
15
+ { default: parse },
16
+ { default: mdx },
17
+ { default: gfm },
18
+ { remarkHeading },
19
+ { remarkSteps },
20
+ ] = await parserPromise;
21
+ let parser = unified().use(parse).use(gfm);
22
+ if (format === "mdx") {
23
+ parser = parser.use(mdx);
24
+ }
25
+ parser = parser.use(remarkSteps).use(remarkHeading, { generateToc: false });
26
+ const parsed = parser.parse(content);
27
+ const checkIncludes = (node) => {
28
+ if (node.name === "include") {
29
+ throw new Error(
30
+ "Navigation requires an explicit frontmatter title for pages using include"
31
+ );
32
+ }
33
+ for (const child of node.children ?? []) {
34
+ checkIncludes(child);
35
+ }
36
+ };
37
+ checkIncludes(parsed);
38
+ const tree = await parser.run(parsed);
39
+ const flatten = (node) =>
40
+ node.children ? node.children.map(flatten).join("") : (node.value ?? "");
41
+ const find = (node) => {
42
+ if (node.type === "heading" && node.depth === 1) {
43
+ return flatten(node);
44
+ }
45
+ for (const child of node.children ?? []) {
46
+ const value = find(child);
47
+ if (value !== undefined) {
48
+ return value;
49
+ }
50
+ }
51
+ };
52
+ return find(tree);
53
+ }
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.3-canary.f771302",
4
+ "version": "2.15.4-canary.2a54b38",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -95,6 +95,10 @@
95
95
  "types": "./dist/source.d.ts",
96
96
  "default": "./dist/source.js"
97
97
  },
98
+ "./navigation": {
99
+ "types": "./dist/navigation.d.ts",
100
+ "default": "./dist/navigation.js"
101
+ },
98
102
  "./sidebar": {
99
103
  "types": "./dist/sidebar.d.ts",
100
104
  "default": "./dist/sidebar.js"
@@ -316,17 +320,21 @@
316
320
  "./native-mdx/data-entry": {
317
321
  "types": "./native-mdx/data-entry.d.mts",
318
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"
319
327
  }
320
328
  },
321
329
  "scripts": {
322
- "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",
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",
323
331
  "dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
324
332
  },
325
333
  "dependencies": {
326
334
  "@ai-sdk/react": "^3.0.134",
327
335
  "@clack/prompts": "^0.11.0",
328
- "@modelcontextprotocol/server": "^2.0.0",
329
- "@next/env": "16.3.3",
336
+ "@modelcontextprotocol/server": "^2.3.0",
337
+ "@next/env": "16.4.5",
330
338
  "@orama/tokenizers": "^3.1.16",
331
339
  "@pierre/highlights": "0.5.1",
332
340
  "@shikijs/rehype": "3.19.0",
@@ -345,9 +353,9 @@
345
353
  "fumadocs-mdx": "14.0.4",
346
354
  "fumadocs-ui": "16.2.2",
347
355
  "geist": "1.7.1",
348
- "glob": "^11.0.0",
356
+ "glob": "^14.0.2",
349
357
  "mcp-handler": "2.2.0",
350
- "mermaid": "^11.12.2",
358
+ "mermaid": "^11.16.1",
351
359
  "next-themes": "^0.4.6",
352
360
  "phase": "^0.5.4",
353
361
  "radix-ui": "1.6.4",
@@ -368,10 +376,10 @@
368
376
  "unist-util-visit": "^5.1.0",
369
377
  "use-stick-to-bottom": "^1.1.1",
370
378
  "vaul": "^1.1.2",
371
- "zod": "^4.6.5"
379
+ "zod": "^4.6.6"
372
380
  },
373
381
  "peerDependencies": {
374
- "next": "^16.3.3",
382
+ "next": "^16.4.5",
375
383
  "react": "^19.2.3",
376
384
  "react-dom": "^19.2.3",
377
385
  "tailwindcss": "^4.1.17"
@@ -383,7 +391,7 @@
383
391
  "@types/node": "^24.10.1",
384
392
  "@types/react-dom": "^19.2.3",
385
393
  "mdast-util-mdx-jsx": "^3.2.0",
386
- "next": "16.3.3",
394
+ "next": "16.4.5",
387
395
  "react": "^19.2.3",
388
396
  "react-dom": "^19.2.3",
389
397
  "tsup": "^8.5.1",
package/shared-theme.css CHANGED
@@ -281,7 +281,13 @@ button:not(:disabled, [aria-disabled="true"]) {
281
281
  }
282
282
  }
283
283
 
284
- @container (max-width: 960px) {
284
+ @container (width < 961px) {
285
+ #nd-page {
286
+ max-width: none;
287
+ padding-inline: 1.5rem;
288
+ transform: none;
289
+ }
290
+
285
291
  #nd-page > .text-gray-900:first-child {
286
292
  display: none;
287
293
  }
package/source-config.js CHANGED
@@ -304,7 +304,9 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
304
304
  };
305
305
  // `highlights` swaps Shiki's tokenizer for @pierre/highlights; `shiki`
306
306
  // keeps Fumadocs' rehypeCode.
307
- const useHighlights = highlighter === "highlights";
307
+ const highlightingDisabled =
308
+ highlighter === false || config.mdxOptions?.rehypeCodeOptions === false;
309
+ const useHighlights = highlighter === "highlights" && !highlightingDisabled;
308
310
 
309
311
  return defineFumadocsConfig({
310
312
  ...fumadocsConfig,
@@ -316,7 +318,8 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
316
318
  config.mdxOptions?.rehypePlugins,
317
319
  useHighlights ? [[rehypeCodeHighlights, rehypeCodeOptions]] : []
318
320
  ),
319
- rehypeCodeOptions: useHighlights ? false : rehypeCodeOptions,
321
+ rehypeCodeOptions:
322
+ useHighlights || highlightingDisabled ? false : rehypeCodeOptions,
320
323
  },
321
324
  plugins: [
322
325
  lastModified({ versionControl: getLastModified }),
@@ -283,8 +283,26 @@ export const docs = defineDocs({
283
283
  export default defineGeistdocsSourceConfig();
284
284
  ```
285
285
 
286
+ ### MDX compiler
287
+
288
+ `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.
289
+
290
+ Select a compiler in `next.config.ts`:
291
+
292
+ ```ts
293
+ const withGeistdocs = createGeistdocs({ mdxCompiler: "auto" });
294
+ ```
295
+
296
+ - `"auto"` (default): native when compatible, JS otherwise.
297
+ - `"native"`: fail if a page needs JS fallback; useful for checking native coverage.
298
+ - `"js"`: use the existing JS compiler for every page.
299
+
300
+ 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.
301
+
286
302
  ### Code highlighter
287
303
 
304
+ 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.
305
+
288
306
  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"`:
289
307
 
290
308
  ```ts title="source.config.ts"
@@ -17,7 +17,7 @@
17
17
  "@streamdown/code": "^1.0.1",
18
18
  "@vercel/agent-readability": "^0.7.0",
19
19
  "@vercel/analytics": "^1.6.1",
20
- "@vercel/geistdocs": "2.15.3-canary.f771302",
20
+ "@vercel/geistdocs": "2.15.4-canary.2a54b38",
21
21
  "@vercel/speed-insights": "^1.3.1",
22
22
  "ai": "^6.0.132",
23
23
  "clsx": "^2.1.1",
@@ -29,9 +29,9 @@
29
29
  "fumadocs-ui": "16.2.2",
30
30
  "geist": "1.7.1",
31
31
  "jotai": "^2.15.2",
32
- "mermaid": "^11.12.2",
32
+ "mermaid": "^11.16.1",
33
33
  "nanoid": "^5.1.6",
34
- "next": "16.3.3",
34
+ "next": "16.4.5",
35
35
  "next-themes": "^0.4.6",
36
36
  "react": "^19.2.3",
37
37
  "react-dom": "^19.2.3",
@@ -40,7 +40,7 @@
40
40
  "streamdown": "^2.1.0",
41
41
  "tailwind-merge": "^3.4.0",
42
42
  "use-stick-to-bottom": "^1.1.1",
43
- "zod": "^4.1.13"
43
+ "zod": "^4.6.6"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@tailwindcss/postcss": "^4.1.17",
@@ -52,5 +52,8 @@
52
52
  "tailwindcss": "^4.1.17",
53
53
  "tw-animate-css": "^1.4.0",
54
54
  "typescript": "^5.9.3"
55
+ },
56
+ "overrides": {
57
+ "katex": "0.18.2"
55
58
  }
56
59
  }
@@ -0,0 +1,3 @@
1
+ # Mermaid and rehype-katex still constrain KaTeX to its affected 0.16.x series.
2
+ overrides:
3
+ "katex@<0.18.2": "0.18.2"