fumadocs-mdx 11.10.1 → 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.
Files changed (61) hide show
  1. package/dist/bin.cjs +29 -139
  2. package/dist/bin.js +1 -1
  3. package/dist/{browser-B2G8uAF2.d.cts → browser-D5lvL8vv.d.ts} +51 -4
  4. package/dist/{browser-DrH7tKRi.d.ts → browser-DjWADqp8.d.cts} +51 -4
  5. package/dist/bun/index.cjs +126 -108
  6. package/dist/bun/index.js +5 -5
  7. package/dist/chunk-3M4SHY6K.js +80 -0
  8. package/dist/{chunk-UOOPSLFY.js → chunk-AUOOMFAI.js} +27 -21
  9. package/dist/{chunk-QJCCVMBJ.js → chunk-KGUBBRL6.js} +11 -13
  10. package/dist/{chunk-SVTXMVLQ.js → chunk-KTDVTBMH.js} +1 -1
  11. package/dist/{chunk-766EAFX6.js → chunk-POXTQZ4D.js} +1 -31
  12. package/dist/chunk-SWNOXPYJ.js +142 -0
  13. package/dist/{chunk-XXSKWWMB.js → chunk-TLD6JMT6.js} +1 -1
  14. package/dist/{chunk-CNKI574E.js → chunk-VXEBLM4X.js} +1 -1
  15. package/dist/{chunk-QVZ7JH4H.js → chunk-YC25YEBF.js} +1 -1
  16. package/dist/chunk-ZLCSVXCD.js +10 -0
  17. package/dist/config/index.cjs +18 -97
  18. package/dist/config/index.d.cts +1 -1
  19. package/dist/config/index.d.ts +1 -1
  20. package/dist/config/index.js +48 -9
  21. package/dist/{define-BH4bnHQl.d.ts → define--6HQ1ehX.d.cts} +18 -3
  22. package/dist/{define-BH4bnHQl.d.cts → define--6HQ1ehX.d.ts} +18 -3
  23. package/dist/loader-mdx.cjs +127 -139
  24. package/dist/loader-mdx.js +6 -6
  25. package/dist/next/index.cjs +29 -139
  26. package/dist/next/index.js +16 -16
  27. package/dist/node/loader.cjs +131 -143
  28. package/dist/node/loader.js +6 -6
  29. package/dist/postinstall-U7VROOY7.js +9 -0
  30. package/dist/{mdx-options-T73E4LQB.js → preset-WFEORCAB.js} +1 -1
  31. package/dist/runtime/next/async.cjs +198 -150
  32. package/dist/runtime/next/async.d.cts +3 -3
  33. package/dist/runtime/next/async.d.ts +3 -3
  34. package/dist/runtime/next/async.js +50 -30
  35. package/dist/runtime/next/index.cjs +32 -21
  36. package/dist/runtime/next/index.d.cts +11 -7
  37. package/dist/runtime/next/index.d.ts +11 -7
  38. package/dist/runtime/next/index.js +2 -1
  39. package/dist/runtime/vite/browser.d.cts +2 -3
  40. package/dist/runtime/vite/browser.d.ts +2 -3
  41. package/dist/runtime/vite/server.cjs +67 -21
  42. package/dist/runtime/vite/server.d.cts +14 -28
  43. package/dist/runtime/vite/server.d.ts +14 -28
  44. package/dist/runtime/vite/server.js +61 -21
  45. package/dist/shared-0QIuV0XZ.d.ts +70 -0
  46. package/dist/shared-CqgMnt9h.d.cts +70 -0
  47. package/dist/{types-DN9KrG7R.d.ts → types-DLIAvrgC.d.ts} +6 -32
  48. package/dist/{types-DT83Ijs6.d.cts → types-Dl8HLbm5.d.cts} +6 -32
  49. package/dist/vite/index.cjs +131 -143
  50. package/dist/vite/index.js +7 -7
  51. package/package.json +2 -6
  52. package/dist/build-mdx-DnC1jKvn.d.cts +0 -46
  53. package/dist/build-mdx-DnC1jKvn.d.ts +0 -46
  54. package/dist/chunk-GBMFGEC7.js +0 -57
  55. package/dist/chunk-QQWCBFFE.js +0 -40
  56. package/dist/chunk-SMSNZ6N5.js +0 -155
  57. package/dist/config/zod-3.cjs +0 -422
  58. package/dist/config/zod-3.d.cts +0 -53
  59. package/dist/config/zod-3.d.ts +0 -53
  60. package/dist/config/zod-3.js +0 -40
  61. package/dist/postinstall-XV4WSHZP.js +0 -9
@@ -30,86 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // src/mdx-plugins/remark-postprocess.ts
34
- function remarkPostprocess({
35
- injectExports
36
- }) {
37
- return (tree, file) => {
38
- let title;
39
- const urls = [];
40
- (0, import_unist_util_visit2.visit)(tree, ["heading", "link"], (node) => {
41
- if (node.type === "heading" && node.depth === 1) {
42
- title = flattenNode2(node);
43
- }
44
- if (node.type !== "link") return;
45
- urls.push({
46
- href: node.url
47
- });
48
- return "skip";
49
- });
50
- if (title) {
51
- file.data.frontmatter ??= {};
52
- if (!file.data.frontmatter.title) file.data.frontmatter.title = title;
53
- }
54
- file.data.extractedReferences = urls;
55
- for (const name of injectExports) {
56
- if (!(name in file.data)) continue;
57
- tree.children.unshift(getMdastExport(name, file.data[name]));
58
- }
59
- };
60
- }
61
- function flattenNode2(node) {
62
- if ("children" in node)
63
- return node.children.map((child) => flattenNode2(child)).join("");
64
- if ("value" in node) return node.value;
65
- return "";
66
- }
67
- function getMdastExport(name, value) {
68
- return {
69
- type: "mdxjsEsm",
70
- value: "",
71
- data: {
72
- estree: {
73
- type: "Program",
74
- sourceType: "module",
75
- body: [
76
- {
77
- type: "ExportNamedDeclaration",
78
- attributes: [],
79
- specifiers: [],
80
- source: null,
81
- declaration: {
82
- type: "VariableDeclaration",
83
- kind: "let",
84
- declarations: [
85
- {
86
- type: "VariableDeclarator",
87
- id: {
88
- type: "Identifier",
89
- name
90
- },
91
- init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
92
- }
93
- ]
94
- }
95
- }
96
- ]
97
- }
98
- }
99
- };
100
- }
101
- var import_unist_util_visit2, import_estree_util_value_to_estree;
102
- var init_remark_postprocess = __esm({
103
- "src/mdx-plugins/remark-postprocess.ts"() {
104
- "use strict";
105
- import_unist_util_visit2 = require("unist-util-visit");
106
- import_estree_util_value_to_estree = require("estree-util-value-to-estree");
107
- }
108
- });
109
-
110
- // src/utils/mdx-options.ts
111
- var mdx_options_exports = {};
112
- __export(mdx_options_exports, {
33
+ // src/mdx/preset.ts
34
+ var preset_exports = {};
35
+ __export(preset_exports, {
113
36
  getDefaultMDXOptions: () => getDefaultMDXOptions
114
37
  });
115
38
  function pluginOption(def, options = []) {
@@ -132,13 +55,6 @@ function getDefaultMDXOptions({
132
55
  _withoutBundler = false,
133
56
  ...mdxOptions
134
57
  }) {
135
- const mdxExports = [
136
- "structuredData",
137
- "extractedReferences",
138
- "frontmatter",
139
- "lastModified",
140
- ...valueToExport
141
- ];
142
58
  const remarkPlugins = pluginOption(
143
59
  (v) => [
144
60
  plugins.remarkGfm,
@@ -166,10 +82,15 @@ function getDefaultMDXOptions({
166
82
  plugins.remarkStructure,
167
83
  remarkStructureOptions
168
84
  ],
169
- [
170
- remarkPostprocess,
171
- { injectExports: mdxExports }
172
- ]
85
+ () => {
86
+ return (_, file) => {
87
+ file.data["mdx-export"] ??= [];
88
+ for (const name of valueToExport) {
89
+ if (name in file.data)
90
+ file.data["mdx-export"].push({ name, value: file.data[name] });
91
+ }
92
+ };
93
+ }
173
94
  ],
174
95
  mdxOptions.remarkPlugins
175
96
  );
@@ -189,11 +110,10 @@ function getDefaultMDXOptions({
189
110
  };
190
111
  }
191
112
  var plugins;
192
- var init_mdx_options = __esm({
193
- "src/utils/mdx-options.ts"() {
113
+ var init_preset = __esm({
114
+ "src/mdx/preset.ts"() {
194
115
  "use strict";
195
116
  plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
196
- init_remark_postprocess();
197
117
  }
198
118
  });
199
119
 
@@ -290,10 +210,10 @@ function countLines(s) {
290
210
  return num;
291
211
  }
292
212
 
293
- // src/utils/build-mdx.ts
213
+ // src/mdx/build-mdx.ts
294
214
  var import_mdx = require("@mdx-js/mdx");
295
215
 
296
- // src/mdx-plugins/remark-include.ts
216
+ // src/mdx/remark-include.ts
297
217
  var import_unified = require("unified");
298
218
  var import_unist_util_visit = require("unist-util-visit");
299
219
  var path2 = __toESM(require("path"), 1);
@@ -425,7 +345,90 @@ function getDefaultProcessor(format) {
425
345
  return mdProcessor.use(import_remark_mdx.default);
426
346
  }
427
347
 
428
- // src/utils/build-mdx.ts
348
+ // src/mdx/remark-postprocess.ts
349
+ var import_unist_util_visit2 = require("unist-util-visit");
350
+ var import_mdast_util_to_markdown = require("mdast-util-to-markdown");
351
+ var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
352
+ function remarkPostprocess({
353
+ includeProcessedMarkdown = false,
354
+ valueToExport = []
355
+ } = {}) {
356
+ return (tree, file) => {
357
+ let title;
358
+ const urls = [];
359
+ (0, import_unist_util_visit2.visit)(tree, ["heading", "link"], (node) => {
360
+ if (node.type === "heading" && node.depth === 1) {
361
+ title = flattenNode2(node);
362
+ }
363
+ if (node.type !== "link") return;
364
+ urls.push({
365
+ href: node.url
366
+ });
367
+ return "skip";
368
+ });
369
+ if (title) {
370
+ file.data.frontmatter ??= {};
371
+ if (!file.data.frontmatter.title) file.data.frontmatter.title = title;
372
+ }
373
+ file.data.extractedReferences = urls;
374
+ if (includeProcessedMarkdown) {
375
+ file.data._markdown = (0, import_mdast_util_to_markdown.toMarkdown)(tree, {
376
+ ...this.data("settings"),
377
+ // @ts-expect-error - from https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/lib/index.js
378
+ extensions: this.data("toMarkdownExtensions") || []
379
+ });
380
+ }
381
+ for (const { name, value } of file.data["mdx-export"] ?? []) {
382
+ tree.children.unshift(getMdastExport(name, value));
383
+ }
384
+ for (const name of valueToExport) {
385
+ if (!(name in file.data)) continue;
386
+ tree.children.unshift(getMdastExport(name, file.data[name]));
387
+ }
388
+ };
389
+ }
390
+ function getMdastExport(name, value) {
391
+ return {
392
+ type: "mdxjsEsm",
393
+ value: "",
394
+ data: {
395
+ estree: {
396
+ type: "Program",
397
+ sourceType: "module",
398
+ body: [
399
+ {
400
+ type: "ExportNamedDeclaration",
401
+ attributes: [],
402
+ specifiers: [],
403
+ source: null,
404
+ declaration: {
405
+ type: "VariableDeclaration",
406
+ kind: "let",
407
+ declarations: [
408
+ {
409
+ type: "VariableDeclarator",
410
+ id: {
411
+ type: "Identifier",
412
+ name
413
+ },
414
+ init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
415
+ }
416
+ ]
417
+ }
418
+ }
419
+ ]
420
+ }
421
+ }
422
+ };
423
+ }
424
+ function flattenNode2(node) {
425
+ if ("children" in node)
426
+ return node.children.map((child) => flattenNode2(child)).join("");
427
+ if ("value" in node) return node.value;
428
+ return "";
429
+ }
430
+
431
+ // src/mdx/build-mdx.ts
429
432
  var cache2 = /* @__PURE__ */ new Map();
430
433
  async function buildMDX(cacheKey, source, options) {
431
434
  const { filePath, frontmatter, data, _compiler, ...rest } = options;
@@ -436,7 +439,24 @@ async function buildMDX(cacheKey, source, options) {
436
439
  processor = (0, import_mdx.createProcessor)({
437
440
  outputFormat: "program",
438
441
  ...rest,
439
- remarkPlugins: [remarkInclude, ...rest.remarkPlugins ?? []],
442
+ remarkPlugins: [
443
+ remarkInclude,
444
+ ...rest.remarkPlugins ?? [],
445
+ [
446
+ remarkPostprocess,
447
+ {
448
+ ...options.postprocess,
449
+ valueToExport: [
450
+ ...options.postprocess?.valueToExport ?? [],
451
+ "structuredData",
452
+ "extractedReferences",
453
+ "frontmatter",
454
+ "lastModified",
455
+ "_markdown"
456
+ ]
457
+ }
458
+ ]
459
+ ],
440
460
  format
441
461
  });
442
462
  cache2.set(key, processor);
@@ -492,21 +512,18 @@ function createMdxLoader(configLoader) {
492
512
  if (cached && cached.hash === generateCacheHash(value)) return cached;
493
513
  }
494
514
  const collection = parsed.collection ? loaded.collections.get(parsed.collection) : void 0;
495
- let schema;
496
- let mdxOptions;
515
+ let docCollection;
497
516
  switch (collection?.type) {
498
517
  case "doc":
499
- mdxOptions = collection.mdxOptions;
500
- schema = collection.schema;
518
+ docCollection = collection;
501
519
  break;
502
520
  case "docs":
503
- mdxOptions = collection.docs.mdxOptions;
504
- schema = collection.docs.schema;
521
+ docCollection = collection.docs;
505
522
  break;
506
523
  }
507
- if (schema) {
524
+ if (docCollection?.schema) {
508
525
  matter.data = await validate(
509
- schema,
526
+ docCollection.schema,
510
527
  matter.data,
511
528
  {
512
529
  source: value,
@@ -531,7 +548,8 @@ function createMdxLoader(configLoader) {
531
548
  "\n".repeat(lineOffset) + matter.content,
532
549
  {
533
550
  development: isDevelopment,
534
- ...mdxOptions ?? await loaded.getDefaultMDXOptions(),
551
+ ...docCollection?.mdxOptions ?? await loaded.getDefaultMDXOptions(),
552
+ postprocess: docCollection?.postprocess,
535
553
  data,
536
554
  filePath,
537
555
  frontmatter: matter.data,
@@ -600,7 +618,7 @@ function buildConfig(config) {
600
618
  const input = this.global.mdxOptions;
601
619
  async function uncached() {
602
620
  const options = typeof input === "function" ? await input() : input;
603
- const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
621
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_preset(), preset_exports));
604
622
  if (options?.preset === "minimal") return options;
605
623
  return getDefaultMDXOptions2({
606
624
  ...options,
@@ -616,35 +634,6 @@ function buildConfig(config) {
616
634
 
617
635
  // src/utils/config.ts
618
636
  var cache3 = null;
619
- async function isZod3() {
620
- try {
621
- const content = JSON.parse(
622
- (await fs3.readFile("node_modules/zod/package.json")).toString()
623
- );
624
- const version = content.version;
625
- return typeof version === "string" && version.startsWith("3.");
626
- } catch {
627
- return false;
628
- }
629
- }
630
- function createCompatZodPlugin() {
631
- return {
632
- name: "replace-zod-import",
633
- async setup(build) {
634
- const usingZod3 = await isZod3();
635
- if (!usingZod3) return;
636
- console.warn(
637
- "[Fumadocs MDX] Noticed Zod v3 in your node_modules, we recommend upgrading to Zod v4 for better compatibility."
638
- );
639
- build.onResolve({ filter: /^fumadocs-mdx\/config$/ }, () => {
640
- return {
641
- path: "fumadocs-mdx/config/zod-3",
642
- external: true
643
- };
644
- });
645
- }
646
- };
647
- }
648
637
  async function compileConfig(configPath, outDir) {
649
638
  const { build } = await import("esbuild");
650
639
  const transformed = await build({
@@ -656,7 +645,6 @@ async function compileConfig(configPath, outDir) {
656
645
  platform: "node",
657
646
  format: "esm",
658
647
  packages: "external",
659
- plugins: [createCompatZodPlugin()],
660
648
  outExtension: {
661
649
  ".js": ".mjs"
662
650
  },
@@ -712,7 +700,7 @@ function toWebpack(loader2) {
712
700
  try {
713
701
  const result = await loader2({
714
702
  filePath: this.resourcePath,
715
- query: (0, import_node_querystring.parse)(this.resourceQuery),
703
+ query: (0, import_node_querystring.parse)(this.resourceQuery.slice(1)),
716
704
  source,
717
705
  development: this.mode === "development",
718
706
  compiler: this
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  toWebpack
3
- } from "./chunk-CNKI574E.js";
3
+ } from "./chunk-VXEBLM4X.js";
4
4
  import {
5
5
  createMdxLoader,
6
6
  dynamicConfig
7
- } from "./chunk-QJCCVMBJ.js";
8
- import "./chunk-QQWCBFFE.js";
9
- import "./chunk-SVTXMVLQ.js";
7
+ } from "./chunk-KGUBBRL6.js";
10
8
  import "./chunk-IQAEAI4P.js";
11
- import "./chunk-766EAFX6.js";
12
- import "./chunk-QVZ7JH4H.js";
9
+ import "./chunk-POXTQZ4D.js";
10
+ import "./chunk-SWNOXPYJ.js";
11
+ import "./chunk-KTDVTBMH.js";
12
+ import "./chunk-YC25YEBF.js";
13
13
  import "./chunk-VWJKRQZR.js";
14
14
 
15
15
  // src/loader-mdx.ts
@@ -30,86 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // src/mdx-plugins/remark-postprocess.ts
34
- function remarkPostprocess({
35
- injectExports
36
- }) {
37
- return (tree, file) => {
38
- let title;
39
- const urls = [];
40
- (0, import_unist_util_visit.visit)(tree, ["heading", "link"], (node) => {
41
- if (node.type === "heading" && node.depth === 1) {
42
- title = flattenNode(node);
43
- }
44
- if (node.type !== "link") return;
45
- urls.push({
46
- href: node.url
47
- });
48
- return "skip";
49
- });
50
- if (title) {
51
- file.data.frontmatter ??= {};
52
- if (!file.data.frontmatter.title) file.data.frontmatter.title = title;
53
- }
54
- file.data.extractedReferences = urls;
55
- for (const name of injectExports) {
56
- if (!(name in file.data)) continue;
57
- tree.children.unshift(getMdastExport(name, file.data[name]));
58
- }
59
- };
60
- }
61
- function flattenNode(node) {
62
- if ("children" in node)
63
- return node.children.map((child) => flattenNode(child)).join("");
64
- if ("value" in node) return node.value;
65
- return "";
66
- }
67
- function getMdastExport(name, value) {
68
- return {
69
- type: "mdxjsEsm",
70
- value: "",
71
- data: {
72
- estree: {
73
- type: "Program",
74
- sourceType: "module",
75
- body: [
76
- {
77
- type: "ExportNamedDeclaration",
78
- attributes: [],
79
- specifiers: [],
80
- source: null,
81
- declaration: {
82
- type: "VariableDeclaration",
83
- kind: "let",
84
- declarations: [
85
- {
86
- type: "VariableDeclarator",
87
- id: {
88
- type: "Identifier",
89
- name
90
- },
91
- init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
92
- }
93
- ]
94
- }
95
- }
96
- ]
97
- }
98
- }
99
- };
100
- }
101
- var import_unist_util_visit, import_estree_util_value_to_estree;
102
- var init_remark_postprocess = __esm({
103
- "src/mdx-plugins/remark-postprocess.ts"() {
104
- "use strict";
105
- import_unist_util_visit = require("unist-util-visit");
106
- import_estree_util_value_to_estree = require("estree-util-value-to-estree");
107
- }
108
- });
109
-
110
- // src/utils/mdx-options.ts
111
- var mdx_options_exports = {};
112
- __export(mdx_options_exports, {
33
+ // src/mdx/preset.ts
34
+ var preset_exports = {};
35
+ __export(preset_exports, {
113
36
  getDefaultMDXOptions: () => getDefaultMDXOptions
114
37
  });
115
38
  function pluginOption(def, options = []) {
@@ -132,13 +55,6 @@ function getDefaultMDXOptions({
132
55
  _withoutBundler = false,
133
56
  ...mdxOptions
134
57
  }) {
135
- const mdxExports = [
136
- "structuredData",
137
- "extractedReferences",
138
- "frontmatter",
139
- "lastModified",
140
- ...valueToExport
141
- ];
142
58
  const remarkPlugins = pluginOption(
143
59
  (v) => [
144
60
  plugins.remarkGfm,
@@ -166,10 +82,15 @@ function getDefaultMDXOptions({
166
82
  plugins.remarkStructure,
167
83
  remarkStructureOptions
168
84
  ],
169
- [
170
- remarkPostprocess,
171
- { injectExports: mdxExports }
172
- ]
85
+ () => {
86
+ return (_, file) => {
87
+ file.data["mdx-export"] ??= [];
88
+ for (const name of valueToExport) {
89
+ if (name in file.data)
90
+ file.data["mdx-export"].push({ name, value: file.data[name] });
91
+ }
92
+ };
93
+ }
173
94
  ],
174
95
  mdxOptions.remarkPlugins
175
96
  );
@@ -189,11 +110,10 @@ function getDefaultMDXOptions({
189
110
  };
190
111
  }
191
112
  var plugins;
192
- var init_mdx_options = __esm({
193
- "src/utils/mdx-options.ts"() {
113
+ var init_preset = __esm({
114
+ "src/mdx/preset.ts"() {
194
115
  "use strict";
195
116
  plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
196
- init_remark_postprocess();
197
117
  }
198
118
  });
199
119
 
@@ -277,7 +197,7 @@ function buildConfig(config) {
277
197
  const input = this.global.mdxOptions;
278
198
  async function uncached() {
279
199
  const options = typeof input === "function" ? await input() : input;
280
- const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
200
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_preset(), preset_exports));
281
201
  if (options?.preset === "minimal") return options;
282
202
  return getDefaultMDXOptions2({
283
203
  ...options,
@@ -296,35 +216,6 @@ function findConfigFile() {
296
216
  return path.resolve("source.config.ts");
297
217
  }
298
218
  var cache = null;
299
- async function isZod3() {
300
- try {
301
- const content = JSON.parse(
302
- (await fs.readFile("node_modules/zod/package.json")).toString()
303
- );
304
- const version = content.version;
305
- return typeof version === "string" && version.startsWith("3.");
306
- } catch {
307
- return false;
308
- }
309
- }
310
- function createCompatZodPlugin() {
311
- return {
312
- name: "replace-zod-import",
313
- async setup(build) {
314
- const usingZod3 = await isZod3();
315
- if (!usingZod3) return;
316
- console.warn(
317
- "[Fumadocs MDX] Noticed Zod v3 in your node_modules, we recommend upgrading to Zod v4 for better compatibility."
318
- );
319
- build.onResolve({ filter: /^fumadocs-mdx\/config$/ }, () => {
320
- return {
321
- path: "fumadocs-mdx/config/zod-3",
322
- external: true
323
- };
324
- });
325
- }
326
- };
327
- }
328
219
  async function compileConfig(configPath, outDir) {
329
220
  const { build } = await import("esbuild");
330
221
  const transformed = await build({
@@ -336,7 +227,6 @@ async function compileConfig(configPath, outDir) {
336
227
  platform: "node",
337
228
  format: "esm",
338
229
  packages: "external",
339
- plugins: [createCompatZodPlugin()],
340
230
  outExtension: {
341
231
  ".js": ".mjs"
342
232
  },
@@ -565,7 +455,7 @@ async function generateJS(configPath, config, importPath, configHash = false) {
565
455
  getImportCode({
566
456
  type: "namespace",
567
457
  name: importId,
568
- specifier: `${toImportPath(file.absolutePath, importPath)}?${params.join("&")}`
458
+ specifier: `${toImportPath(file.fullPath, importPath)}?${params.join("&")}`
569
459
  })
570
460
  );
571
461
  return `{ info: ${JSON.stringify(file)}, data: ${importId} }`;
@@ -574,17 +464,17 @@ async function generateJS(configPath, config, importPath, configHash = false) {
574
464
  }
575
465
  async function getMetaEntries(collection, files) {
576
466
  const items = files.map(async (file) => {
577
- const source = await readFileWithCache(file.absolutePath).catch(() => "");
578
- let data = source.length === 0 ? {} : parseMetaEntry(file.absolutePath, source);
467
+ const source = await readFileWithCache(file.fullPath).catch(() => "");
468
+ let data = source.length === 0 ? {} : parseMetaEntry(file.fullPath, source);
579
469
  if (collection?.schema) {
580
470
  data = await validate(
581
471
  collection.schema,
582
472
  data,
583
473
  {
584
474
  source,
585
- path: file.absolutePath
475
+ path: file.fullPath
586
476
  },
587
- `invalid data in ${file.absolutePath}`
477
+ `invalid data in ${file.fullPath}`
588
478
  );
589
479
  }
590
480
  return JSON.stringify({
@@ -608,20 +498,20 @@ async function generateJS(configPath, config, importPath, configHash = false) {
608
498
  }
609
499
  const entries2 = files.map(async (file) => {
610
500
  const parsed = fumaMatter(
611
- await readFileWithCache(file.absolutePath).catch(() => "")
501
+ await readFileWithCache(file.fullPath).catch(() => "")
612
502
  );
613
503
  let data = parsed.data;
614
504
  if (collection.schema) {
615
505
  data = await validate(
616
506
  collection.schema,
617
507
  parsed.data,
618
- { path: file.absolutePath, source: parsed.content },
619
- `invalid frontmatter in ${file.absolutePath}`
508
+ { path: file.fullPath, source: parsed.content },
509
+ `invalid frontmatter in ${file.fullPath}`
620
510
  );
621
511
  }
622
512
  let lastModified;
623
513
  if (config.global?.lastModifiedTime === "git") {
624
- lastModified = await getGitTimestamp(file.absolutePath);
514
+ lastModified = await getGitTimestamp(file.fullPath);
625
515
  }
626
516
  return JSON.stringify({
627
517
  info: file,
@@ -668,14 +558,14 @@ async function getCollectionFiles(collection) {
668
558
  await Promise.all(
669
559
  dirs.map(async (dir) => {
670
560
  const result = await (0, import_tinyglobby.glob)(patterns, {
671
- cwd: path4.resolve(dir),
672
- absolute: true
561
+ cwd: path4.resolve(dir)
673
562
  });
674
563
  for (const item of result) {
675
564
  if (!isFileSupported(item, collection)) continue;
676
- files.set(item, {
677
- path: path4.relative(dir, item),
678
- absolutePath: item
565
+ const fullPath = path4.join(dir, item);
566
+ files.set(fullPath, {
567
+ path: item,
568
+ fullPath
679
569
  });
680
570
  }
681
571
  })