fumadocs-mdx 11.6.10 → 11.7.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 (36) hide show
  1. package/dist/{chunk-64MMPGML.js → chunk-2CSSQTP6.js} +1 -10
  2. package/dist/{chunk-SXOJYWZ3.js → chunk-2KBRPMAM.js} +1 -1
  3. package/dist/{chunk-6PDS7MUA.js → chunk-C5INPAZJ.js} +4 -4
  4. package/dist/{chunk-DRVUBK5B.js → chunk-GWR7KMRU.js} +13 -1
  5. package/dist/chunk-JPPCALFT.js +34 -0
  6. package/dist/{chunk-OTM6WYMS.js → chunk-ZOWJF3OH.js} +7 -7
  7. package/dist/config/index.cjs +6 -19
  8. package/dist/config/index.d.cts +3 -7
  9. package/dist/config/index.d.ts +3 -7
  10. package/dist/config/index.js +8 -12
  11. package/dist/define-CCrinVBZ.d.cts +109 -0
  12. package/dist/define-CCrinVBZ.d.ts +109 -0
  13. package/dist/index.d.cts +6 -7
  14. package/dist/index.d.ts +6 -7
  15. package/dist/loader-mdx.cjs +156 -135
  16. package/dist/loader-mdx.js +7 -10
  17. package/dist/mdx-options-UDV5WEFU.js +6 -0
  18. package/dist/next/index.cjs +197 -54
  19. package/dist/next/index.js +7 -30
  20. package/dist/runtime/async.cjs +167 -15
  21. package/dist/runtime/async.d.cts +5 -6
  22. package/dist/runtime/async.d.ts +5 -6
  23. package/dist/runtime/async.js +26 -17
  24. package/dist/runtime/vite.cjs +116 -0
  25. package/dist/runtime/vite.d.cts +47 -0
  26. package/dist/runtime/vite.d.ts +47 -0
  27. package/dist/runtime/vite.js +90 -0
  28. package/dist/{types-Dk7DhSKZ.d.ts → types-C0bKwtAx.d.ts} +38 -50
  29. package/dist/{types-ZwLebhOl.d.cts → types-CnslxmoO.d.cts} +38 -50
  30. package/dist/vite/index.cjs +384 -137
  31. package/dist/vite/index.d.cts +12 -3
  32. package/dist/vite/index.d.ts +12 -3
  33. package/dist/vite/index.js +177 -21
  34. package/package.json +20 -10
  35. package/dist/types-DvTNxAvo.d.cts +0 -217
  36. package/dist/types-DvTNxAvo.d.ts +0 -217
@@ -30,6 +30,134 @@ 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-exports.ts
34
+ function remarkMdxExport({ values }) {
35
+ return (tree, vfile) => {
36
+ for (const name of values) {
37
+ if (!(name in vfile.data)) return;
38
+ tree.children.unshift(getMdastExport(name, vfile.data[name]));
39
+ }
40
+ };
41
+ }
42
+ function getMdastExport(name, value) {
43
+ return {
44
+ type: "mdxjsEsm",
45
+ value: "",
46
+ data: {
47
+ estree: {
48
+ type: "Program",
49
+ sourceType: "module",
50
+ body: [
51
+ {
52
+ type: "ExportNamedDeclaration",
53
+ specifiers: [],
54
+ source: null,
55
+ declaration: {
56
+ type: "VariableDeclaration",
57
+ kind: "let",
58
+ declarations: [
59
+ {
60
+ type: "VariableDeclarator",
61
+ id: {
62
+ type: "Identifier",
63
+ name
64
+ },
65
+ init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
66
+ }
67
+ ]
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ }
73
+ };
74
+ }
75
+ var import_estree_util_value_to_estree;
76
+ var init_remark_exports = __esm({
77
+ "src/mdx-plugins/remark-exports.ts"() {
78
+ "use strict";
79
+ import_estree_util_value_to_estree = require("estree-util-value-to-estree");
80
+ }
81
+ });
82
+
83
+ // src/utils/mdx-options.ts
84
+ var mdx_options_exports = {};
85
+ __export(mdx_options_exports, {
86
+ getDefaultMDXOptions: () => getDefaultMDXOptions
87
+ });
88
+ function pluginOption(def, options = []) {
89
+ const list = def(Array.isArray(options) ? options : []).filter(
90
+ Boolean
91
+ );
92
+ if (typeof options === "function") {
93
+ return options(list);
94
+ }
95
+ return list;
96
+ }
97
+ function getDefaultMDXOptions({
98
+ valueToExport = [],
99
+ rehypeCodeOptions,
100
+ remarkImageOptions,
101
+ remarkHeadingOptions,
102
+ remarkStructureOptions,
103
+ remarkCodeTabOptions,
104
+ remarkNpmOptions,
105
+ ...mdxOptions
106
+ }) {
107
+ const mdxExports = [
108
+ "structuredData",
109
+ "frontmatter",
110
+ "lastModified",
111
+ ...valueToExport
112
+ ];
113
+ const remarkPlugins = pluginOption(
114
+ (v) => [
115
+ plugins.remarkGfm,
116
+ [
117
+ plugins.remarkHeading,
118
+ {
119
+ generateToc: false,
120
+ ...remarkHeadingOptions
121
+ }
122
+ ],
123
+ remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
124
+ "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
125
+ plugins.remarkCodeTab,
126
+ remarkCodeTabOptions
127
+ ],
128
+ "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
129
+ ...v,
130
+ remarkStructureOptions !== false && [
131
+ plugins.remarkStructure,
132
+ remarkStructureOptions
133
+ ],
134
+ [remarkMdxExport, { values: mdxExports }]
135
+ ],
136
+ mdxOptions.remarkPlugins
137
+ );
138
+ const rehypePlugins = pluginOption(
139
+ (v) => [
140
+ rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
141
+ ...v,
142
+ plugins.rehypeToc
143
+ ],
144
+ mdxOptions.rehypePlugins
145
+ );
146
+ return {
147
+ ...mdxOptions,
148
+ remarkPlugins,
149
+ rehypePlugins
150
+ };
151
+ }
152
+ var plugins;
153
+ var init_mdx_options = __esm({
154
+ "src/utils/mdx-options.ts"() {
155
+ "use strict";
156
+ plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
157
+ init_remark_exports();
158
+ }
159
+ });
160
+
33
161
  // src/map/watcher.ts
34
162
  var watcher_exports = {};
35
163
  __export(watcher_exports, {
@@ -101,11 +229,23 @@ function buildConfig(config) {
101
229
  null
102
230
  ];
103
231
  }
232
+ let cachedMdxOptions;
104
233
  return [
105
234
  null,
106
235
  {
107
236
  global: globalConfig,
108
- collections
237
+ collections,
238
+ async getDefaultMDXOptions() {
239
+ if (cachedMdxOptions) return cachedMdxOptions;
240
+ const input = this.global?.mdxOptions;
241
+ async function uncached() {
242
+ const options = typeof input === "function" ? await input() : input;
243
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
244
+ if (options?.preset === "minimal") return options;
245
+ return getDefaultMDXOptions2(options ?? {});
246
+ }
247
+ return cachedMdxOptions = uncached();
248
+ }
109
249
  }
110
250
  ];
111
251
  }
@@ -161,11 +301,11 @@ async function getConfigHash(configPath) {
161
301
  }
162
302
 
163
303
  // src/map/index.ts
164
- var path4 = __toESM(require("path"), 1);
304
+ var path5 = __toESM(require("path"), 1);
165
305
  var fs3 = __toESM(require("fs/promises"), 1);
166
306
 
167
307
  // src/map/generate.ts
168
- var path3 = __toESM(require("path"), 1);
308
+ var path4 = __toESM(require("path"), 1);
169
309
  var fs2 = __toESM(require("fs/promises"), 1);
170
310
  var import_tinyglobby = require("tinyglobby");
171
311
 
@@ -173,8 +313,8 @@ var import_tinyglobby = require("tinyglobby");
173
313
  var import_node_path = require("path");
174
314
  var docTypes = [".mdx", ".md"];
175
315
  var metaTypes = [".json", ".yaml"];
176
- function getTypeFromPath(path6) {
177
- const ext = (0, import_node_path.extname)(path6);
316
+ function getTypeFromPath(path7) {
317
+ const ext = (0, import_node_path.extname)(path7);
178
318
  if (docTypes.includes(ext)) return "doc";
179
319
  if (metaTypes.includes(ext)) return "meta";
180
320
  }
@@ -196,20 +336,20 @@ var frontmatterSchema = import_zod.z.object({
196
336
  icon: import_zod.z.string().optional(),
197
337
  full: import_zod.z.boolean().optional(),
198
338
  // Fumadocs OpenAPI generated
199
- _openapi: import_zod.z.object({}).passthrough().optional()
339
+ _openapi: import_zod.z.looseObject({}).optional()
200
340
  });
201
341
  var ValidationError = class extends Error {
202
342
  constructor(message, issues) {
203
- super(message);
343
+ super(
344
+ `${message}:
345
+ ${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n")}`
346
+ );
347
+ this.title = message;
204
348
  this.issues = issues;
205
349
  }
206
- toString() {
207
- return `${this.message}:
208
- ${this.issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n")}`;
209
- }
210
350
  toStringFormatted() {
211
351
  return [
212
- import_picocolors.default.bold(`[MDX] ${this.message}:`),
352
+ import_picocolors.default.bold(`[MDX] ${this.title}:`),
213
353
  ...this.issues.map(
214
354
  (issue) => import_picocolors.default.redBright(
215
355
  `- ${import_picocolors.default.bold(issue.path?.join(".") ?? "*")}: ${issue.message}`
@@ -240,16 +380,16 @@ var map = new import_lru_cache.LRUCache({
240
380
  max: 200
241
381
  });
242
382
  var fileCache = {
243
- read(namespace, path6) {
244
- return map.get(`${namespace}.${path6}`);
383
+ read(namespace, path7) {
384
+ return map.get(`${namespace}.${path7}`);
245
385
  },
246
- write(namespace, path6, data) {
247
- map.set(`${namespace}.${path6}`, data);
386
+ write(namespace, path7, data) {
387
+ map.set(`${namespace}.${path7}`, data);
248
388
  },
249
- removeCache(path6) {
389
+ removeCache(path7) {
250
390
  for (const key of map.keys()) {
251
391
  const keyPath = key.slice(key.indexOf(".") + 1);
252
- if (keyPath === path6) map.delete(key);
392
+ if (keyPath === path7) map.delete(key);
253
393
  }
254
394
  }
255
395
  };
@@ -296,6 +436,36 @@ function fumaMatter(input) {
296
436
  return output;
297
437
  }
298
438
 
439
+ // src/utils/import-formatter.ts
440
+ var import_node_path3 = __toESM(require("path"), 1);
441
+ function getImportCode(info) {
442
+ const specifier = JSON.stringify(info.specifier);
443
+ if (info.type === "default") return `import ${info.name} from ${specifier}`;
444
+ if (info.type === "namespace")
445
+ return `import * as ${info.name} from ${specifier}`;
446
+ if (info.type === "named") {
447
+ const names = info.names.map(
448
+ (name) => Array.isArray(name) ? `${name[0]} as ${name[1]}` : name
449
+ );
450
+ return `import { ${names.join(", ")} } from ${specifier}`;
451
+ }
452
+ return `import ${specifier}`;
453
+ }
454
+ function toImportPath(file, config) {
455
+ const ext = import_node_path3.default.extname(file);
456
+ const filename = ext === ".ts" ? file.substring(0, file.length - ext.length) : file;
457
+ let importPath;
458
+ if ("relativeTo" in config) {
459
+ importPath = import_node_path3.default.relative(config.relativeTo, filename);
460
+ if (!import_node_path3.default.isAbsolute(importPath) && !importPath.startsWith(".")) {
461
+ importPath = `./${importPath}`;
462
+ }
463
+ } else {
464
+ importPath = import_node_path3.default.resolve(filename);
465
+ }
466
+ return importPath.replaceAll(import_node_path3.default.sep, "/");
467
+ }
468
+
299
469
  // src/map/generate.ts
300
470
  async function readFileWithCache(file) {
301
471
  const cached = fileCache.read("read-file", file);
@@ -431,13 +601,13 @@ async function getCollectionFiles(collection) {
431
601
  await Promise.all(
432
602
  dirs.map(async (dir) => {
433
603
  const result = await (0, import_tinyglobby.glob)(collection.files ?? "**/*", {
434
- cwd: path3.resolve(dir),
604
+ cwd: path4.resolve(dir),
435
605
  absolute: true
436
606
  });
437
607
  for (const item of result) {
438
608
  if (getTypeFromPath(item) !== collection.type) continue;
439
609
  files.set(item, {
440
- path: path3.relative(dir, item),
610
+ path: path4.relative(dir, item),
441
611
  absolutePath: item
442
612
  });
443
613
  }
@@ -445,35 +615,8 @@ async function getCollectionFiles(collection) {
445
615
  );
446
616
  return Array.from(files.values());
447
617
  }
448
- function getImportCode(info) {
449
- const specifier = JSON.stringify(info.specifier);
450
- if (info.type === "default") return `import ${info.name} from ${specifier}`;
451
- if (info.type === "namespace")
452
- return `import * as ${info.name} from ${specifier}`;
453
- if (info.type === "named") {
454
- const names = info.names.map(
455
- (name) => Array.isArray(name) ? `${name[0]} as ${name[1]}` : name
456
- );
457
- return `import { ${names.join(", ")} } from ${specifier}`;
458
- }
459
- return `import ${specifier}`;
460
- }
461
- function toImportPath(file, config) {
462
- const ext = path3.extname(file);
463
- const filename = ext === ".ts" ? file.substring(0, file.length - ext.length) : file;
464
- let importPath;
465
- if ("relativeTo" in config) {
466
- importPath = path3.relative(config.relativeTo, filename);
467
- if (!path3.isAbsolute(importPath) && !importPath.startsWith(".")) {
468
- importPath = `./${importPath}`;
469
- }
470
- } else {
471
- importPath = path3.resolve(filename);
472
- }
473
- return importPath.replaceAll(path3.sep, "/");
474
- }
475
618
  function parseMetaEntry(file, content) {
476
- const extname3 = path3.extname(file);
619
+ const extname3 = path4.extname(file);
477
620
  try {
478
621
  if (extname3 === ".json") return JSON.parse(content);
479
622
  if (extname3 === ".yaml") return (0, import_js_yaml2.load)(content);
@@ -489,7 +632,7 @@ function parseMetaEntry(file, content) {
489
632
  async function start(dev, configPath, outDir) {
490
633
  let configHash = await getConfigHash(configPath);
491
634
  let config = await loadConfig(configPath, outDir, configHash, true);
492
- const outPath = path4.resolve(outDir, `index.ts`);
635
+ const outPath = path5.resolve(outDir, `index.ts`);
493
636
  async function updateMapFile() {
494
637
  const start2 = performance.now();
495
638
  try {
@@ -520,7 +663,7 @@ async function start(dev, configPath, outDir) {
520
663
  });
521
664
  instance.on("all", (event, file) => {
522
665
  if (typeof file !== "string") return;
523
- const absolutePath = path4.resolve(file);
666
+ const absolutePath = path5.resolve(file);
524
667
  const onUpdate = async () => {
525
668
  const isConfigFile = absolutePath === configPath;
526
669
  if (isConfigFile) {
@@ -597,14 +740,14 @@ function createMDX({
597
740
  }
598
741
 
599
742
  // src/postinstall.ts
600
- var path5 = __toESM(require("path"), 1);
743
+ var path6 = __toESM(require("path"), 1);
601
744
  var fs4 = __toESM(require("fs/promises"), 1);
602
745
  async function postInstall(configPath = findConfigFile(), outDir = ".source") {
603
- const jsOut = path5.resolve(outDir, "index.ts");
746
+ const jsOut = path6.resolve(outDir, "index.ts");
604
747
  const hash = await getConfigHash(configPath);
605
748
  const config = await loadConfig(configPath, outDir, hash, true);
606
- await fs4.rm(path5.dirname(jsOut), { recursive: true });
607
- await fs4.mkdir(path5.dirname(jsOut), { recursive: true });
749
+ await fs4.rm(path6.dirname(jsOut), { recursive: true });
750
+ await fs4.mkdir(path6.dirname(jsOut), { recursive: true });
608
751
  await fs4.writeFile(
609
752
  jsOut,
610
753
  await generateJS(configPath, config, { relativeTo: outDir }, hash)
@@ -3,12 +3,16 @@ import {
3
3
  getConfigHash,
4
4
  getGitTimestamp,
5
5
  loadConfig
6
- } from "../chunk-SXOJYWZ3.js";
6
+ } from "../chunk-2KBRPMAM.js";
7
+ import {
8
+ getImportCode,
9
+ toImportPath
10
+ } from "../chunk-JPPCALFT.js";
11
+ import "../chunk-GWR7KMRU.js";
7
12
  import {
8
13
  ValidationError,
9
14
  validate
10
- } from "../chunk-OTM6WYMS.js";
11
- import "../chunk-DRVUBK5B.js";
15
+ } from "../chunk-ZOWJF3OH.js";
12
16
  import {
13
17
  fumaMatter
14
18
  } from "../chunk-KVWX6THC.js";
@@ -202,33 +206,6 @@ async function getCollectionFiles(collection) {
202
206
  );
203
207
  return Array.from(files.values());
204
208
  }
205
- function getImportCode(info) {
206
- const specifier = JSON.stringify(info.specifier);
207
- if (info.type === "default") return `import ${info.name} from ${specifier}`;
208
- if (info.type === "namespace")
209
- return `import * as ${info.name} from ${specifier}`;
210
- if (info.type === "named") {
211
- const names = info.names.map(
212
- (name) => Array.isArray(name) ? `${name[0]} as ${name[1]}` : name
213
- );
214
- return `import { ${names.join(", ")} } from ${specifier}`;
215
- }
216
- return `import ${specifier}`;
217
- }
218
- function toImportPath(file, config) {
219
- const ext = path.extname(file);
220
- const filename = ext === ".ts" ? file.substring(0, file.length - ext.length) : file;
221
- let importPath;
222
- if ("relativeTo" in config) {
223
- importPath = path.relative(config.relativeTo, filename);
224
- if (!path.isAbsolute(importPath) && !importPath.startsWith(".")) {
225
- importPath = `./${importPath}`;
226
- }
227
- } else {
228
- importPath = path.resolve(filename);
229
- }
230
- return importPath.replaceAll(path.sep, "/");
231
- }
232
209
  function parseMetaEntry(file, content) {
233
210
  const extname3 = path.extname(file);
234
211
  try {
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
8
11
  var __export = (target, all) => {
9
12
  for (var name in all)
10
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -27,6 +30,134 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
30
  ));
28
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
32
 
33
+ // src/mdx-plugins/remark-exports.ts
34
+ function remarkMdxExport({ values }) {
35
+ return (tree, vfile) => {
36
+ for (const name of values) {
37
+ if (!(name in vfile.data)) return;
38
+ tree.children.unshift(getMdastExport(name, vfile.data[name]));
39
+ }
40
+ };
41
+ }
42
+ function getMdastExport(name, value) {
43
+ return {
44
+ type: "mdxjsEsm",
45
+ value: "",
46
+ data: {
47
+ estree: {
48
+ type: "Program",
49
+ sourceType: "module",
50
+ body: [
51
+ {
52
+ type: "ExportNamedDeclaration",
53
+ specifiers: [],
54
+ source: null,
55
+ declaration: {
56
+ type: "VariableDeclaration",
57
+ kind: "let",
58
+ declarations: [
59
+ {
60
+ type: "VariableDeclarator",
61
+ id: {
62
+ type: "Identifier",
63
+ name
64
+ },
65
+ init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
66
+ }
67
+ ]
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ }
73
+ };
74
+ }
75
+ var import_estree_util_value_to_estree;
76
+ var init_remark_exports = __esm({
77
+ "src/mdx-plugins/remark-exports.ts"() {
78
+ "use strict";
79
+ import_estree_util_value_to_estree = require("estree-util-value-to-estree");
80
+ }
81
+ });
82
+
83
+ // src/utils/mdx-options.ts
84
+ var mdx_options_exports = {};
85
+ __export(mdx_options_exports, {
86
+ getDefaultMDXOptions: () => getDefaultMDXOptions
87
+ });
88
+ function pluginOption(def, options = []) {
89
+ const list = def(Array.isArray(options) ? options : []).filter(
90
+ Boolean
91
+ );
92
+ if (typeof options === "function") {
93
+ return options(list);
94
+ }
95
+ return list;
96
+ }
97
+ function getDefaultMDXOptions({
98
+ valueToExport = [],
99
+ rehypeCodeOptions,
100
+ remarkImageOptions,
101
+ remarkHeadingOptions,
102
+ remarkStructureOptions,
103
+ remarkCodeTabOptions,
104
+ remarkNpmOptions,
105
+ ...mdxOptions
106
+ }) {
107
+ const mdxExports = [
108
+ "structuredData",
109
+ "frontmatter",
110
+ "lastModified",
111
+ ...valueToExport
112
+ ];
113
+ const remarkPlugins = pluginOption(
114
+ (v) => [
115
+ plugins.remarkGfm,
116
+ [
117
+ plugins.remarkHeading,
118
+ {
119
+ generateToc: false,
120
+ ...remarkHeadingOptions
121
+ }
122
+ ],
123
+ remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
124
+ "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
125
+ plugins.remarkCodeTab,
126
+ remarkCodeTabOptions
127
+ ],
128
+ "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
129
+ ...v,
130
+ remarkStructureOptions !== false && [
131
+ plugins.remarkStructure,
132
+ remarkStructureOptions
133
+ ],
134
+ [remarkMdxExport, { values: mdxExports }]
135
+ ],
136
+ mdxOptions.remarkPlugins
137
+ );
138
+ const rehypePlugins = pluginOption(
139
+ (v) => [
140
+ rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
141
+ ...v,
142
+ plugins.rehypeToc
143
+ ],
144
+ mdxOptions.rehypePlugins
145
+ );
146
+ return {
147
+ ...mdxOptions,
148
+ remarkPlugins,
149
+ rehypePlugins
150
+ };
151
+ }
152
+ var plugins;
153
+ var init_mdx_options = __esm({
154
+ "src/utils/mdx-options.ts"() {
155
+ "use strict";
156
+ plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
157
+ init_remark_exports();
158
+ }
159
+ });
160
+
30
161
  // src/runtime/async.ts
31
162
  var async_exports = {};
32
163
  __export(async_exports, {
@@ -231,34 +362,55 @@ function buildConfig(config) {
231
362
  null
232
363
  ];
233
364
  }
365
+ let cachedMdxOptions;
234
366
  return [
235
367
  null,
236
368
  {
237
369
  global: globalConfig,
238
- collections
370
+ collections,
371
+ async getDefaultMDXOptions() {
372
+ if (cachedMdxOptions) return cachedMdxOptions;
373
+ const input = this.global?.mdxOptions;
374
+ async function uncached() {
375
+ const options = typeof input === "function" ? await input() : input;
376
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
377
+ if (options?.preset === "minimal") return options;
378
+ return getDefaultMDXOptions2(options ?? {});
379
+ }
380
+ return cachedMdxOptions = uncached();
381
+ }
239
382
  }
240
383
  ];
241
384
  }
242
385
 
243
386
  // src/runtime/async.ts
244
387
  async function initCompiler(config, collection) {
245
- let mdxOptions;
246
388
  const col = config.collections.get(collection);
247
- if (col?.type === "doc") mdxOptions = col.mdxOptions;
248
- else if (col?.type === "docs")
249
- mdxOptions = col.docs?.mdxOptions;
250
- if (!mdxOptions) {
251
- config._mdx_async ??= {};
252
- const async = config._mdx_async;
253
- const globalConfig = config.global;
254
- if (globalConfig && !async.cachedMdxOptions) {
255
- async.cachedMdxOptions = typeof globalConfig.mdxOptions === "function" ? await globalConfig.mdxOptions() : globalConfig.mdxOptions;
256
- }
257
- mdxOptions = async.cachedMdxOptions;
389
+ switch (col?.type) {
390
+ case "doc":
391
+ if (col.mdxOptions)
392
+ return (0, import_mdx_remote.createCompiler)({
393
+ preset: "minimal",
394
+ ...col.mdxOptions
395
+ });
396
+ break;
397
+ case "docs":
398
+ if (col.docs.mdxOptions)
399
+ return (0, import_mdx_remote.createCompiler)({
400
+ preset: "minimal",
401
+ ...col.docs.mdxOptions
402
+ });
403
+ break;
404
+ }
405
+ let defaultMdxOptions = config.global?.mdxOptions;
406
+ if (typeof defaultMdxOptions === "function")
407
+ defaultMdxOptions = await defaultMdxOptions();
408
+ if (defaultMdxOptions?.preset === "minimal") {
409
+ return (0, import_mdx_remote.createCompiler)(defaultMdxOptions);
258
410
  }
259
- const remarkPlugins = mdxOptions?.remarkPlugins ?? [];
411
+ const remarkPlugins = defaultMdxOptions?.remarkPlugins ?? [];
260
412
  return (0, import_mdx_remote.createCompiler)({
261
- ...mdxOptions,
413
+ ...defaultMdxOptions,
262
414
  remarkPlugins: (v) => typeof remarkPlugins === "function" ? [remarkInclude, ...remarkPlugins(v), import_mdx_plugins.remarkStructure] : [remarkInclude, ...v, ...remarkPlugins, import_mdx_plugins.remarkStructure]
263
415
  });
264
416
  }
@@ -1,15 +1,14 @@
1
- import { a as RuntimeAsync } from '../types-ZwLebhOl.cjs';
2
- import { L as LoadedConfig } from '../types-DvTNxAvo.cjs';
1
+ import { L as LoadedConfig, a as RuntimeAsync } from '../types-CnslxmoO.cjs';
3
2
  import '@standard-schema/spec';
4
3
  import 'fumadocs-core/source';
5
- import 'mdx/types';
4
+ import '../define-CCrinVBZ.cjs';
5
+ import 'zod';
6
6
  import 'fumadocs-core/mdx-plugins';
7
- import 'fumadocs-core/server';
8
7
  import '@mdx-js/mdx';
9
8
  import 'unified';
10
9
  import 'react';
11
- import 'zod';
12
- import '@fumadocs/mdx-remote';
10
+ import 'mdx/types';
11
+ import 'fumadocs-core/server';
13
12
 
14
13
  declare function buildConfig(config: Record<string, unknown>): [err: string, value: null] | [err: null, value: LoadedConfig];
15
14
 
@@ -1,15 +1,14 @@
1
- import { a as RuntimeAsync } from '../types-Dk7DhSKZ.js';
2
- import { L as LoadedConfig } from '../types-DvTNxAvo.js';
1
+ import { L as LoadedConfig, a as RuntimeAsync } from '../types-C0bKwtAx.js';
3
2
  import '@standard-schema/spec';
4
3
  import 'fumadocs-core/source';
5
- import 'mdx/types';
4
+ import '../define-CCrinVBZ.js';
5
+ import 'zod';
6
6
  import 'fumadocs-core/mdx-plugins';
7
- import 'fumadocs-core/server';
8
7
  import '@mdx-js/mdx';
9
8
  import 'unified';
10
9
  import 'react';
11
- import 'zod';
12
- import '@fumadocs/mdx-remote';
10
+ import 'mdx/types';
11
+ import 'fumadocs-core/server';
13
12
 
14
13
  declare function buildConfig(config: Record<string, unknown>): [err: string, value: null] | [err: null, value: LoadedConfig];
15
14