@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
@@ -467,5 +467,5 @@
467
467
  }
468
468
  ],
469
469
  "source": "apps/template/content/docs",
470
- "version": "2.15.3-canary.f771302"
470
+ "version": "2.15.4-canary.2a54b38"
471
471
  }
@@ -285,8 +285,26 @@ export const docs = defineDocs({
285
285
  export default defineGeistdocsSourceConfig();
286
286
  ```
287
287
 
288
+ ### MDX compiler
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.
291
+
292
+ Select a compiler in `next.config.ts`:
293
+
294
+ ```ts
295
+ const withGeistdocs = createGeistdocs({ mdxCompiler: "auto" });
296
+ ```
297
+
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.
301
+
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.
303
+
288
304
  ### Code highlighter
289
305
 
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.
307
+
290
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"`:
291
309
 
292
310
  ```ts title="source.config.ts"
@@ -0,0 +1,16 @@
1
+ # Vendored MDX compiler
2
+
3
+ Upstream: https://github.com/wooorm/mdxjs-rs
4
+
5
+ Source version: `mdxjs` 1.0.4 (MIT).
6
+ Published crate revision: `282729e6a0750c19dfd9217bc511971bf3295a29`, recorded in
7
+ that crate's `.cargo_vcs_info.json`.
8
+
9
+ This directory is an adapted subset, not an unmodified upstream checkout.
10
+ Geistdocs adds pipeline hooks and fixes JSX style attributes, URL encoding,
11
+ GFM nested links and component-only paragraph handling. Geistdocs-specific
12
+ transforms and highlighting live outside this directory.
13
+
14
+ Keep `LICENSE-mdxjs-rs` with these sources and with every distributed native
15
+ binary, including the private Geistdocs package. Review upstream changes and
16
+ rerun output parity tests before updating this fork.
@@ -1,7 +1,7 @@
1
1
  import { DATA_QUERY, withoutDataQuery } from "./data-projection.mjs";
2
+ import { extendIndexEmitter } from "./index-emitter.mjs";
2
3
 
3
4
  const MDX_EXTENSION = /\.mdx?$/;
4
- const ORIGINAL_EMIT = Symbol.for("geistdocs.data-entry.original-emit");
5
5
 
6
6
  /**
7
7
  * Opt-in Fumadocs 14 plugin. Extend the existing index-file emitter in place:
@@ -21,40 +21,21 @@ export function dataEntryPlugin(typeScriptOrLoader) {
21
21
  return {
22
22
  name: "geistdocs-data-entry",
23
23
  config() {
24
- const indexes = this.core
25
- .getPlugins()
26
- .filter((plugin) => plugin.name === "index-file");
27
- // The webpack/Turbopack compiler core has no discovery/index emitter.
28
- // It still loads the same site config to run frontmatter and doc hooks.
29
- if (indexes.length === 0 && this.environment === "webpack") {
30
- return;
31
- }
32
- if (indexes.length !== 1 || typeof indexes[0].emit !== "function") {
33
- throw new Error("Data entries require one Fumadocs index-file emitter");
34
- }
35
- const index = indexes[0];
36
- const original = index.emit[ORIGINAL_EMIT] ?? index.emit;
37
- const emit = async function () {
38
- const entries = await original.call(this);
24
+ extendIndexEmitter(this, "geistdocs-data-entry", async (entries) => {
39
25
  const server = entries.find((entry) => entry.path === "server.ts");
40
26
  if (!server || entries.some((entry) => entry.path === "data.ts")) {
41
27
  throw new Error(
42
- "Data entries require server.ts and an unused data.ts output"
28
+ "Content entries require server.ts and an unused data.ts output"
43
29
  );
44
30
  }
45
- // Compiler workers load config but never emit indexes. Keep TypeScript
46
- // out of their initialization path; the host supplies a lazy import.
47
- const ts = await getParser();
48
31
  return [
49
32
  ...entries,
50
33
  {
51
34
  path: "data.ts",
52
- content: createDataEntry(server.content, ts).code,
35
+ content: createDataEntry(server.content, await getParser()).code,
53
36
  },
54
37
  ];
55
- };
56
- emit[ORIGINAL_EMIT] = original;
57
- index.emit = emit;
38
+ });
58
39
  },
59
40
  };
60
41
  }
@@ -0,0 +1,36 @@
1
+ // The version-specific Fumadocs boundary. Upgrades must update these imports
2
+ // together and pass native/JS parity plus configuration-reload tests.
3
+ import { createRequire } from "node:module";
4
+ import path from "node:path";
5
+ import { fileURLToPath, pathToFileURL } from "node:url";
6
+
7
+ const require = createRequire(import.meta.url);
8
+ const dist = path.dirname(fileURLToPath(import.meta.resolve("fumadocs-mdx")));
9
+ const version = require(path.join(dist, "../package.json")).version;
10
+ if (version !== "14.0.4") {
11
+ throw new Error(
12
+ `Geistdocs MDX requires fumadocs-mdx 14.0.4; found ${version}`
13
+ );
14
+ }
15
+ export const internal = (chunk) =>
16
+ import(pathToFileURL(path.join(dist, chunk)).href);
17
+ export const { fumaMatter } = await internal("chunk-VWJKRQZR.js");
18
+ const { createCore } = await internal("chunk-K4KWUM3J.js");
19
+ const cores = new Map();
20
+ export function getCore(options) {
21
+ const key = JSON.stringify([options.configPath, options.outDir]);
22
+ if (!cores.has(key)) {
23
+ cores.set(
24
+ key,
25
+ createCore({
26
+ environment: "webpack",
27
+ configPath: options.configPath,
28
+ outDir: options.outDir,
29
+ })
30
+ );
31
+ }
32
+ return cores.get(key);
33
+ }
34
+ export const { createStandaloneConfigLoader } =
35
+ await internal("chunk-NKIL543T.js");
36
+ export const { buildConfig } = await internal("chunk-6RPNS75C.js");
@@ -0,0 +1,34 @@
1
+ const EXTENSIONS = Symbol.for("geistdocs.index-emitter.extensions");
2
+
3
+ /** One wrapper for sibling entries; re-registering on config reload replaces
4
+ * each extension instead of recursively wrapping another plugin's emitter. */
5
+ export function extendIndexEmitter(context, name, extend) {
6
+ const plugins = context.core.getPlugins();
7
+ const indexes = plugins.filter((plugin) => plugin.name === "index-file");
8
+ if (indexes.length === 0 && context.environment === "webpack") {
9
+ return;
10
+ }
11
+ if (indexes.length !== 1 || typeof indexes[0].emit !== "function") {
12
+ throw new Error("Content entries require one Fumadocs index-file emitter");
13
+ }
14
+ const index = indexes[0];
15
+ let state = index.emit[EXTENSIONS];
16
+ if (!state) {
17
+ state = { original: index.emit, extensions: new Map() };
18
+ const emit = async function () {
19
+ let entries = await state.original.call(this);
20
+ const active = new Set(
21
+ context.core.getPlugins().map((plugin) => plugin.name)
22
+ );
23
+ for (const [extensionName, extension] of state.extensions) {
24
+ if (active.has(extensionName)) {
25
+ entries = await extension(entries);
26
+ }
27
+ }
28
+ return entries;
29
+ };
30
+ emit[EXTENSIONS] = state;
31
+ index.emit = emit;
32
+ }
33
+ state.extensions.set(name, extend);
34
+ }
@@ -4,29 +4,60 @@
4
4
  // parsing, transforms, highlighting, and codegen run natively. Files that
5
5
  // use something the native pipeline doesn't cover go to fumadocs-mdx.
6
6
  import { createHash } from "node:crypto";
7
+ import { existsSync } from "node:fs";
7
8
  import { readFile } from "node:fs/promises";
8
9
  import { createRequire } from "node:module";
9
10
  import path from "node:path";
10
11
  import { pathToFileURL } from "node:url";
11
-
12
- // fumadocs-mdx 14.0.4 internals (not in its public exports).
13
- const fumadocsDist = path.dirname(
14
- new URL(import.meta.resolve("fumadocs-mdx")).pathname
15
- );
16
- const internal = (chunk) =>
17
- import(pathToFileURL(path.join(fumadocsDist, chunk)).href);
18
- const { fumaMatter } = await internal("chunk-VWJKRQZR.js");
19
- const { getCore } = await internal("chunk-CGGDM5F3.js");
20
- const { createStandaloneConfigLoader } = await internal("chunk-NKIL543T.js");
12
+ import { isDeepStrictEqual } from "node:util";
13
+ import {
14
+ buildConfig,
15
+ createStandaloneConfigLoader,
16
+ fumaMatter,
17
+ getCore,
18
+ internal,
19
+ } from "./fumadocs-adapter.mjs";
21
20
 
22
21
  const require = createRequire(import.meta.url);
23
- const native = require(
24
- process.env.FUMADOCS_MDX_RS_BINARY ?? "./native-binding.cjs"
25
- );
22
+ let native;
23
+ let nativeUnavailable;
24
+ const reportedFallbacks = new Set();
26
25
 
27
- let configLoader;
28
- let jsLoader;
29
- let compiledConfigIdentity;
26
+ // Only binary availability errors select JS automatically. Compiler errors
27
+ // remain errors, rather than silently hiding native output bugs.
28
+ function getNative() {
29
+ if (native || nativeUnavailable) {
30
+ return native;
31
+ }
32
+ try {
33
+ native = require(
34
+ process.env.FUMADOCS_MDX_RS_BINARY ?? "./native-binding.cjs"
35
+ );
36
+ } catch (error) {
37
+ if (
38
+ process.env.FUMADOCS_MDX_RS_BINARY ||
39
+ !["GEISTDOCS_NATIVE_UNAVAILABLE", "ERR_DLOPEN_FAILED"].includes(
40
+ error.code
41
+ )
42
+ ) {
43
+ throw error;
44
+ }
45
+ nativeUnavailable = error.message;
46
+ }
47
+ return native;
48
+ }
49
+
50
+ function reportFallback(reason, mode) {
51
+ if (mode === "native") {
52
+ throw new Error(`Native MDX required, but this page needs JS: ${reason}`);
53
+ }
54
+ if (!reportedFallbacks.has(reason)) {
55
+ reportedFallbacks.add(reason);
56
+ console.warn(`[geistdocs/mdx] Using JS compiler: ${reason}`);
57
+ }
58
+ }
59
+
60
+ const configs = new Map();
30
61
  const compatibility = new WeakMap();
31
62
 
32
63
  // The plugin list the native pipeline implements: Geistdocs' defaults with
@@ -53,24 +84,39 @@ const NATIVE_OPTION_KEYS = new Set([
53
84
  "outputFormat",
54
85
  ]);
55
86
 
87
+ let defaultOptions;
88
+ function getDefaultOptions() {
89
+ defaultOptions ??= (async () => {
90
+ const bundled = new URL("../source-config.js", import.meta.url);
91
+ const url = existsSync(bundled)
92
+ ? bundled
93
+ : pathToFileURL(require.resolve("@vercel/geistdocs/source-config"));
94
+ const { defineGeistdocsSourceConfig } = await import(url.href);
95
+ return buildConfig({
96
+ default: defineGeistdocsSourceConfig(),
97
+ }).getMDXOptions();
98
+ })();
99
+ return defaultOptions;
100
+ }
56
101
  const samePlugins = (actual, expected) =>
57
102
  actual.length === expected.length &&
58
103
  actual.every((entry, index) => {
59
104
  const [plugin, options] = Array.isArray(entry) ? entry : [entry];
60
- const [name, expectedOptions] = expected[index];
61
- if (plugin?.name !== name) {
62
- return false;
63
- }
64
- if (name === "rehypeCodeHighlights") {
65
- // Geistdocs forces the theme; any other option changes the output.
66
- return Object.keys(options ?? {}).every(
67
- (key) => key === "themes" || key === "defaultColor"
68
- );
69
- }
105
+ const expectedEntry = expected[index];
106
+ const [expectedPlugin, expectedOptions] = Array.isArray(expectedEntry)
107
+ ? expectedEntry
108
+ : [expectedEntry];
70
109
  return (
71
- JSON.stringify(options ?? {}) === JSON.stringify(expectedOptions ?? {})
110
+ plugin === expectedPlugin &&
111
+ isDeepStrictEqual(options ?? {}, expectedOptions ?? {})
72
112
  );
73
113
  });
114
+ const knownPreset = (actual, expected) =>
115
+ actual.length === expected.length &&
116
+ actual.every((entry, index) => {
117
+ const plugin = Array.isArray(entry) ? entry[0] : entry;
118
+ return plugin?.name === expected[index][0];
119
+ });
74
120
 
75
121
  /** Why a collection's MDX options need the JS pipeline, if they do. */
76
122
  async function incompatibility(config, collection) {
@@ -82,15 +128,29 @@ async function incompatibility(config, collection) {
82
128
  const key = collection?.name ?? "global";
83
129
  if (!reasons.has(key)) {
84
130
  const options = await config.getMDXOptions(collection, "bundler");
131
+ const defaults = await getDefaultOptions();
85
132
  let reason = null;
86
133
  const extraKeys = Object.keys(options).filter(
87
134
  (k) => !NATIVE_OPTION_KEYS.has(k)
88
135
  );
89
136
  if (extraKeys.length > 0) {
90
137
  reason = `MDX options: ${extraKeys.join(", ")}`;
91
- } else if (!samePlugins(options.remarkPlugins ?? [], NATIVE_REMARK)) {
138
+ } else if (
139
+ !(
140
+ knownPreset(defaults.remarkPlugins, NATIVE_REMARK) &&
141
+ knownPreset(defaults.rehypePlugins, NATIVE_REHYPE)
142
+ )
143
+ ) {
144
+ reason = "Geistdocs preset changed; native compatibility needs review";
145
+ } else if (options.outputFormat !== defaults.outputFormat) {
146
+ reason = "custom MDX output format";
147
+ } else if (
148
+ !samePlugins(options.remarkPlugins ?? [], defaults.remarkPlugins)
149
+ ) {
92
150
  reason = "custom remark plugins";
93
- } else if (!samePlugins(options.rehypePlugins ?? [], NATIVE_REHYPE)) {
151
+ } else if (
152
+ !samePlugins(options.rehypePlugins ?? [], defaults.rehypePlugins)
153
+ ) {
94
154
  reason = "custom rehype plugins or Shiki";
95
155
  }
96
156
  reasons.set(key, reason);
@@ -108,11 +168,29 @@ const docCollectionOf = (collection) => {
108
168
  }
109
169
  };
110
170
 
111
- async function fallback({ source, development, query, compiler, filePath }) {
112
- jsLoader ??= (await internal("chunk-USWQVJWR.js")).createMdxLoader(
113
- configLoader
114
- );
115
- const out = await jsLoader.load({
171
+ async function fallback({
172
+ source,
173
+ development,
174
+ query,
175
+ compiler,
176
+ filePath,
177
+ state,
178
+ validated,
179
+ }) {
180
+ const { createMdxLoader } = await internal("chunk-USWQVJWR.js");
181
+ // Content fallback can happen after schema transforms. Reuse that validated
182
+ // value for this call only, so user validation hooks never run twice.
183
+ state.jsLoader ??= createMdxLoader(state.configLoader);
184
+ const loader = validated
185
+ ? createMdxLoader({
186
+ ...state.configLoader,
187
+ core: {
188
+ ...state.configLoader.core,
189
+ transformFrontmatter: () => validated.data,
190
+ },
191
+ })
192
+ : state.jsLoader;
193
+ const out = await loader.load({
116
194
  getSource: () => source,
117
195
  development,
118
196
  query,
@@ -132,37 +210,140 @@ const literal = (value) => {
132
210
  return JSON.stringify(value);
133
211
  };
134
212
 
135
- export async function load({
136
- source,
137
- filePath,
138
- query,
139
- development,
140
- compiler,
141
- options,
142
- }) {
213
+ async function fillNavigationTitle(matter, config, docCollection, filePath) {
214
+ if (matter.data.title === "") {
215
+ throw new Error(
216
+ "Navigation requires a nonempty frontmatter title; omit it to use heading fallback with a compatible schema"
217
+ );
218
+ }
219
+ if (matter.data.title != null) {
220
+ return;
221
+ }
222
+ if (await incompatibility(config, docCollection)) {
223
+ throw new Error(
224
+ "Navigation requires an explicit frontmatter title when using custom MDX plugins or options"
225
+ );
226
+ }
227
+ const { navigationTitle } = await import("./navigation-title.mjs");
228
+ const title = await navigationTitle(
229
+ matter.content,
230
+ filePath.endsWith(".mdx") ? "mdx" : "md"
231
+ );
232
+ if (title !== undefined) {
233
+ matter.data.title = title;
234
+ }
235
+ }
236
+
237
+ async function getConfigState(options, development) {
238
+ const key = JSON.stringify([options.configPath, options.outDir, development]);
239
+ if (!configs.has(key)) {
240
+ configs.set(key, {});
241
+ }
242
+ const state = configs.get(key);
143
243
  if (development) {
144
244
  // Imported settings can change the bundled config without changing the
145
245
  // source config's mtime, which is all Fumadocs checks for reloads.
146
246
  const compiled = await readFile(options.absoluteCompiledConfigPath);
147
247
  const identity = createHash("sha256").update(compiled).digest("hex");
148
- if (identity !== compiledConfigIdentity) {
149
- compiledConfigIdentity = identity;
150
- configLoader = undefined;
151
- jsLoader = undefined;
248
+ if (identity !== state.compiledConfigIdentity) {
249
+ state.compiledConfigIdentity = identity;
250
+ state.configLoader = undefined;
251
+ state.jsLoader = undefined;
152
252
  }
153
253
  }
154
- configLoader ??= createStandaloneConfigLoader({
254
+ state.configLoader ??= createStandaloneConfigLoader({
155
255
  core: getCore(options),
156
256
  buildConfig: false,
157
257
  mode: development ? "dev" : "production",
158
258
  });
159
- const core = configLoader.core;
160
- const config = await configLoader.getConfig();
161
- const matter = fumaMatter(source);
259
+ return state;
260
+ }
261
+
262
+ async function fallbackReason(filePath, config, collection) {
263
+ if (filePath.endsWith(".md")) {
264
+ return "plain Markdown format";
265
+ }
266
+ if (
267
+ Object.keys(collection?.postprocess ?? {}).some(
268
+ (key) => key !== "includeProcessedMarkdown"
269
+ )
270
+ ) {
271
+ return "custom postprocess exports";
272
+ }
273
+ const reason = await incompatibility(config, collection);
274
+ if (reason) {
275
+ return reason;
276
+ }
277
+ if (!getNative()) {
278
+ return nativeUnavailable;
279
+ }
280
+ }
281
+
282
+ function nativeFrontmatter(value) {
283
+ if (value === null) {
284
+ return true;
285
+ }
286
+ if (typeof value === "number") {
287
+ return Number.isFinite(value);
288
+ }
289
+ if (typeof value === "string" || typeof value === "boolean") {
290
+ return true;
291
+ }
292
+ if (Array.isArray(value)) {
293
+ return value.every(nativeFrontmatter);
294
+ }
295
+ if (
296
+ typeof value !== "object" ||
297
+ Object.getPrototypeOf(value) !== Object.prototype
298
+ ) {
299
+ return false;
300
+ }
301
+ return Object.values(value).every(nativeFrontmatter);
302
+ }
303
+
304
+ export async function load({
305
+ source,
306
+ filePath,
307
+ query,
308
+ development,
309
+ compiler,
310
+ options,
311
+ }) {
312
+ const mode = options.geistdocsMdxCompiler ?? "auto";
313
+ if (!["auto", "native", "js"].includes(mode)) {
314
+ throw new Error(`Invalid MDX compiler mode: ${mode}`);
315
+ }
316
+ const state = await getConfigState(options, development);
317
+ const core = state.configLoader.core;
318
+ const config = await state.configLoader.getConfig();
162
319
  const collection = query.collection
163
320
  ? config.getCollection(query.collection)
164
321
  : undefined;
165
322
  const docCollection = docCollectionOf(collection);
323
+ const compileWithJS = (reason, validated) => {
324
+ if (mode !== "js") {
325
+ reportFallback(reason, mode);
326
+ }
327
+ return fallback({
328
+ source,
329
+ development,
330
+ query,
331
+ compiler,
332
+ filePath,
333
+ state,
334
+ validated,
335
+ });
336
+ };
337
+ if (mode === "js") {
338
+ return compileWithJS("explicit JS mode");
339
+ }
340
+ if (query.only !== "frontmatter") {
341
+ const reason = await fallbackReason(filePath, config, docCollection);
342
+ if (reason) {
343
+ return compileWithJS(reason);
344
+ }
345
+ }
346
+ const matter = fumaMatter(source);
166
347
  if (docCollection) {
167
348
  matter.data = await core.transformFrontmatter(
168
349
  { collection: docCollection, filePath, source },
@@ -170,11 +351,14 @@ export async function load({
170
351
  );
171
352
  }
172
353
  if (query.only === "frontmatter") {
354
+ if (query["geistdocs-navigation"] === "1") {
355
+ await fillNavigationTitle(matter, config, docCollection, filePath);
356
+ }
173
357
  return `export const frontmatter = ${JSON.stringify(matter.data)}`;
174
358
  }
175
359
 
176
- if (await incompatibility(config, docCollection)) {
177
- return fallback({ source, development, query, compiler, filePath });
360
+ if (!nativeFrontmatter(matter.data)) {
361
+ return compileWithJS("non-JSON frontmatter values", matter);
178
362
  }
179
363
 
180
364
  const result = native.compile(
@@ -188,7 +372,7 @@ export async function load({
188
372
  }
189
373
  );
190
374
  if (result.fallback) {
191
- return fallback({ source, development, query, compiler, filePath });
375
+ return compileWithJS(result.fallback, matter);
192
376
  }
193
377
 
194
378
  // Doc plugins (e.g. last-modified) contribute extra exports.
@@ -15,11 +15,13 @@ if (existsSync(local)) {
15
15
  (process.platform === "linux" &&
16
16
  !process.report.getReport().header.glibcVersionRuntime)
17
17
  ) {
18
- throw new Error(
19
- `This Geistdocs native MDX canary has no binary for ${platform}. ` +
18
+ const error = new Error(
19
+ `Geistdocs has no native MDX binary for ${platform}. ` +
20
20
  "Supported: macOS arm64 and Linux x64 (glibc). " +
21
- "Remove experimentalMdxLoader to use the JS compiler."
21
+ 'Use mdxCompiler: "js" to select the JS compiler.'
22
22
  );
23
+ error.code = "GEISTDOCS_NATIVE_UNAVAILABLE";
24
+ throw error;
23
25
  }
24
26
  module.exports = require(bundled);
25
27
  }
@@ -0,0 +1,11 @@
1
+ import type { Plugin } from "fumadocs-mdx";
2
+ import type * as TypeScript from "typescript";
3
+ type Parser = typeof TypeScript;
4
+ /** Opt-in metadata-only navigation.ts, for synchronous collections and the native canary loader. */
5
+ export declare function navigationEntryPlugin(
6
+ parser: Parser | (() => Parser | Promise<Parser>)
7
+ ): Plugin;
8
+ export declare function createNavigationEntry(
9
+ serverCode: string,
10
+ parser: Parser
11
+ ): { code: string; imports: number };