fumadocs-mdx 11.6.0 → 13.0.1

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 (93) hide show
  1. package/dist/bin.cjs +1728 -0
  2. package/dist/bin.d.cts +1 -0
  3. package/dist/bin.d.ts +1 -0
  4. package/dist/bin.js +16 -0
  5. package/dist/build-mdx-CCNr86q6.d.ts +53 -0
  6. package/dist/build-mdx-D-r3_eQL.d.cts +53 -0
  7. package/dist/bun/index.cjs +857 -0
  8. package/dist/bun/index.d.cts +13 -0
  9. package/dist/bun/index.d.ts +13 -0
  10. package/dist/bun/index.js +62 -0
  11. package/dist/chunk-3J3WL7WN.js +160 -0
  12. package/dist/chunk-CXA4JO4Z.js +45 -0
  13. package/dist/chunk-EELYB2XC.js +207 -0
  14. package/dist/chunk-FSZMKRVH.js +80 -0
  15. package/dist/chunk-II3H5ZVZ.js +77 -0
  16. package/dist/chunk-JVZFH6ND.js +40 -0
  17. package/dist/chunk-K5ZLPEIQ.js +207 -0
  18. package/dist/{chunk-VFALQK6O.js → chunk-KILFIBVW.js} +21 -12
  19. package/dist/chunk-NVRDCY6Z.js +30 -0
  20. package/dist/chunk-U4MQ44TS.js +53 -0
  21. package/dist/chunk-VWJKRQZR.js +19 -0
  22. package/dist/chunk-XQ5O7IPO.js +128 -0
  23. package/dist/chunk-XZY2AWJI.js +81 -0
  24. package/dist/chunk-YVCR6FUH.js +82 -0
  25. package/dist/config/index.cjs +232 -128
  26. package/dist/config/index.d.cts +4 -6
  27. package/dist/config/index.d.ts +4 -6
  28. package/dist/config/index.js +26 -19
  29. package/dist/core-B6j6Fxse.d.cts +218 -0
  30. package/dist/core-B6j6Fxse.d.ts +218 -0
  31. package/dist/index.cjs +0 -76
  32. package/dist/index.d.cts +73 -20
  33. package/dist/index.d.ts +73 -20
  34. package/dist/index.js +0 -10
  35. package/dist/load-MNG3CLET.js +7 -0
  36. package/dist/next/index.cjs +567 -314
  37. package/dist/next/index.d.cts +9 -12
  38. package/dist/next/index.d.ts +9 -12
  39. package/dist/next/index.js +238 -211
  40. package/dist/node/loader.cjs +922 -0
  41. package/dist/node/loader.d.cts +5 -0
  42. package/dist/node/loader.d.ts +5 -0
  43. package/dist/node/loader.js +33 -0
  44. package/dist/plugins/json-schema.cjs +162 -0
  45. package/dist/plugins/json-schema.d.cts +24 -0
  46. package/dist/plugins/json-schema.d.ts +24 -0
  47. package/dist/plugins/json-schema.js +78 -0
  48. package/dist/{mdx-options-CAU273O3.js → preset-ZMP6U62C.js} +1 -1
  49. package/dist/runtime/next/async.cjs +715 -0
  50. package/dist/runtime/next/async.d.cts +21 -0
  51. package/dist/runtime/next/async.d.ts +21 -0
  52. package/dist/runtime/next/async.js +89 -0
  53. package/dist/runtime/next/index.cjs +136 -0
  54. package/dist/runtime/next/index.d.cts +33 -0
  55. package/dist/runtime/next/index.d.ts +33 -0
  56. package/dist/runtime/next/index.js +11 -0
  57. package/dist/runtime/vite/browser.cjs +107 -0
  58. package/dist/runtime/vite/browser.d.cts +59 -0
  59. package/dist/runtime/vite/browser.d.ts +59 -0
  60. package/dist/runtime/vite/browser.js +11 -0
  61. package/dist/runtime/vite/server.cjs +243 -0
  62. package/dist/runtime/vite/server.d.cts +30 -0
  63. package/dist/runtime/vite/server.d.ts +30 -0
  64. package/dist/runtime/vite/server.js +111 -0
  65. package/dist/types-AGzTfBmf.d.ts +45 -0
  66. package/dist/types-DKGMoay5.d.cts +45 -0
  67. package/dist/vite/index.cjs +1185 -0
  68. package/dist/vite/index.d.cts +45 -0
  69. package/dist/vite/index.d.ts +45 -0
  70. package/dist/vite/index.js +297 -0
  71. package/dist/webpack/index.cjs +957 -0
  72. package/dist/{loader-mdx.d.cts → webpack/index.d.cts} +3 -6
  73. package/dist/{loader-mdx.d.ts → webpack/index.d.ts} +3 -6
  74. package/dist/webpack/index.js +44 -0
  75. package/loader-mdx.cjs +1 -1
  76. package/package.json +86 -29
  77. package/bin.js +0 -5
  78. package/dist/chunk-2ZOW45YZ.js +0 -63
  79. package/dist/chunk-DRVUBK5B.js +0 -39
  80. package/dist/chunk-HFLDWPJA.js +0 -62
  81. package/dist/chunk-IOENRFUX.js +0 -112
  82. package/dist/chunk-MK7EXW7O.js +0 -75
  83. package/dist/define-BaW0PQDJ.d.cts +0 -201
  84. package/dist/define-BaW0PQDJ.d.ts +0 -201
  85. package/dist/loader-mdx.cjs +0 -527
  86. package/dist/loader-mdx.js +0 -162
  87. package/dist/runtime/async.cjs +0 -269
  88. package/dist/runtime/async.d.cts +0 -18
  89. package/dist/runtime/async.d.ts +0 -18
  90. package/dist/runtime/async.js +0 -73
  91. package/dist/types-BNrQHCj5.d.cts +0 -100
  92. package/dist/types-DEduCvIT.d.ts +0 -100
  93. package/dist/watcher-IAZDSTU7.js +0 -24
@@ -40,9 +40,8 @@ __export(config_exports, {
40
40
  });
41
41
  module.exports = __toCommonJS(config_exports);
42
42
 
43
- // src/utils/schema.ts
43
+ // src/config/zod-4.ts
44
44
  var import_zod = require("zod");
45
- var import_picocolors = __toESM(require("picocolors"), 1);
46
45
  var metaSchema = import_zod.z.object({
47
46
  title: import_zod.z.string().optional(),
48
47
  pages: import_zod.z.array(import_zod.z.string()).optional(),
@@ -57,33 +56,24 @@ var frontmatterSchema = import_zod.z.object({
57
56
  icon: import_zod.z.string().optional(),
58
57
  full: import_zod.z.boolean().optional(),
59
58
  // Fumadocs OpenAPI generated
60
- _openapi: import_zod.z.object({}).passthrough().optional()
59
+ _openapi: import_zod.z.looseObject({}).optional()
61
60
  });
62
61
 
63
62
  // src/config/define.ts
64
63
  function defineCollections(options) {
65
- return {
66
- // @ts-expect-error -- internal type inferring
67
- _type: void 0,
68
- ...options
69
- };
64
+ return options;
70
65
  }
71
66
  function defineDocs(options) {
72
- if (!options)
73
- console.warn(
74
- "[`source.config.ts`] Deprecated: please pass options to `defineDocs()` and specify a `dir`."
75
- );
76
- const dir = options?.dir ?? "content/docs";
67
+ const dir = options.dir ?? "content/docs";
77
68
  return {
78
69
  type: "docs",
79
- // @ts-expect-error -- internal type inferring
70
+ dir,
80
71
  docs: defineCollections({
81
72
  type: "doc",
82
73
  dir,
83
74
  schema: frontmatterSchema,
84
75
  ...options?.docs
85
76
  }),
86
- // @ts-expect-error -- internal type inferring
87
77
  meta: defineCollections({
88
78
  type: "meta",
89
79
  dir,
@@ -96,54 +86,8 @@ function defineConfig(config = {}) {
96
86
  return config;
97
87
  }
98
88
 
99
- // src/utils/mdx-options.ts
89
+ // src/loaders/mdx/preset.ts
100
90
  var plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
101
-
102
- // src/mdx-plugins/remark-exports.ts
103
- var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
104
- function remarkMdxExport({ values }) {
105
- return (tree, vfile) => {
106
- for (const name of values) {
107
- if (!(name in vfile.data)) return;
108
- tree.children.unshift(getMdastExport(name, vfile.data[name]));
109
- }
110
- };
111
- }
112
- function getMdastExport(name, value) {
113
- return {
114
- type: "mdxjsEsm",
115
- value: "",
116
- data: {
117
- estree: {
118
- type: "Program",
119
- sourceType: "module",
120
- body: [
121
- {
122
- type: "ExportNamedDeclaration",
123
- specifiers: [],
124
- source: null,
125
- declaration: {
126
- type: "VariableDeclaration",
127
- kind: "let",
128
- declarations: [
129
- {
130
- type: "VariableDeclarator",
131
- id: {
132
- type: "Identifier",
133
- name
134
- },
135
- init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
136
- }
137
- ]
138
- }
139
- }
140
- ]
141
- }
142
- }
143
- };
144
- }
145
-
146
- // src/utils/mdx-options.ts
147
91
  function pluginOption(def, options = []) {
148
92
  const list = def(Array.isArray(options) ? options : []).filter(
149
93
  Boolean
@@ -160,14 +104,10 @@ function getDefaultMDXOptions({
160
104
  remarkHeadingOptions,
161
105
  remarkStructureOptions,
162
106
  remarkCodeTabOptions,
107
+ remarkNpmOptions,
108
+ _withoutBundler = false,
163
109
  ...mdxOptions
164
110
  }) {
165
- const mdxExports = [
166
- "structuredData",
167
- "frontmatter",
168
- "lastModified",
169
- ...valueToExport
170
- ];
171
111
  const remarkPlugins = pluginOption(
172
112
  (v) => [
173
113
  plugins.remarkGfm,
@@ -178,15 +118,32 @@ function getDefaultMDXOptions({
178
118
  ...remarkHeadingOptions
179
119
  }
180
120
  ],
181
- remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
182
- // Fumadocs 14 compatibility
183
- "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && plugins.remarkCodeTab,
121
+ remarkImageOptions !== false && [
122
+ plugins.remarkImage,
123
+ {
124
+ ...remarkImageOptions,
125
+ useImport: _withoutBundler ? false : remarkImageOptions?.useImport
126
+ }
127
+ ],
128
+ "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
129
+ plugins.remarkCodeTab,
130
+ remarkCodeTabOptions
131
+ ],
132
+ "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
184
133
  ...v,
185
134
  remarkStructureOptions !== false && [
186
135
  plugins.remarkStructure,
187
136
  remarkStructureOptions
188
137
  ],
189
- [remarkMdxExport, { values: mdxExports }]
138
+ () => {
139
+ return (_, file) => {
140
+ file.data["mdx-export"] ??= [];
141
+ for (const name of valueToExport) {
142
+ if (name in file.data)
143
+ file.data["mdx-export"].push({ name, value: file.data[name] });
144
+ }
145
+ };
146
+ }
190
147
  ],
191
148
  mdxOptions.remarkPlugins
192
149
  );
@@ -194,86 +151,233 @@ function getDefaultMDXOptions({
194
151
  (v) => [
195
152
  rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
196
153
  ...v,
197
- [plugins.rehypeToc]
154
+ plugins.rehypeToc
198
155
  ],
199
156
  mdxOptions.rehypePlugins
200
157
  );
201
158
  return {
202
159
  ...mdxOptions,
160
+ outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
203
161
  remarkPlugins,
204
162
  rehypePlugins
205
163
  };
206
164
  }
207
165
 
208
- // src/mdx-plugins/remark-include.ts
209
- var import_unist_util_visit = require("unist-util-visit");
166
+ // src/loaders/mdx/remark-include.ts
167
+ var import_unified = require("unified");
168
+ var import_unist_util_visit2 = require("unist-util-visit");
210
169
  var path = __toESM(require("path"), 1);
211
170
  var fs = __toESM(require("fs/promises"), 1);
212
- var import_gray_matter = __toESM(require("gray-matter"), 1);
171
+
172
+ // src/utils/fuma-matter.ts
173
+ var import_js_yaml = require("js-yaml");
174
+ var regex = /^---\r?\n(.+?)\r?\n---\r?\n/s;
175
+ function fumaMatter(input) {
176
+ const output = { matter: "", data: {}, content: input };
177
+ const match = regex.exec(input);
178
+ if (!match) {
179
+ return output;
180
+ }
181
+ output.matter = match[0];
182
+ output.content = input.slice(match[0].length);
183
+ const loaded = (0, import_js_yaml.load)(match[1]);
184
+ output.data = loaded ?? {};
185
+ return output;
186
+ }
187
+
188
+ // src/loaders/mdx/remark-include.ts
189
+ var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
190
+
191
+ // src/loaders/mdx/remark-unravel.ts
192
+ var import_unist_util_visit = require("unist-util-visit");
193
+ function remarkMarkAndUnravel() {
194
+ return (tree) => {
195
+ (0, import_unist_util_visit.visit)(tree, function(node, index, parent) {
196
+ let offset = -1;
197
+ let all = true;
198
+ let oneOrMore = false;
199
+ if (parent && typeof index === "number" && node.type === "paragraph") {
200
+ const children = node.children;
201
+ while (++offset < children.length) {
202
+ const child = children[offset];
203
+ if (child.type === "mdxJsxTextElement" || child.type === "mdxTextExpression") {
204
+ oneOrMore = true;
205
+ } else if (child.type === "text" && child.value.trim().length === 0) {
206
+ } else {
207
+ all = false;
208
+ break;
209
+ }
210
+ }
211
+ if (all && oneOrMore) {
212
+ offset = -1;
213
+ const newChildren = [];
214
+ while (++offset < children.length) {
215
+ const child = children[offset];
216
+ if (child.type === "mdxJsxTextElement") {
217
+ child.type = "mdxJsxFlowElement";
218
+ }
219
+ if (child.type === "mdxTextExpression") {
220
+ child.type = "mdxFlowExpression";
221
+ }
222
+ if (child.type === "text" && /^[\t\r\n ]+$/.test(String(child.value))) {
223
+ } else {
224
+ newChildren.push(child);
225
+ }
226
+ }
227
+ parent.children.splice(index, 1, ...newChildren);
228
+ return index;
229
+ }
230
+ }
231
+ });
232
+ };
233
+ }
234
+
235
+ // src/loaders/mdx/remark-include.ts
236
+ var ElementLikeTypes = [
237
+ "mdxJsxFlowElement",
238
+ "mdxJsxTextElement",
239
+ "containerDirective",
240
+ "textDirective",
241
+ "leafDirective"
242
+ ];
243
+ function isElementLike(node) {
244
+ return ElementLikeTypes.includes(node.type);
245
+ }
246
+ function parseElementAttributes(element) {
247
+ if (Array.isArray(element.attributes)) {
248
+ const attributes = {};
249
+ for (const attr of element.attributes) {
250
+ if (attr.type === "mdxJsxAttribute" && (typeof attr.value === "string" || attr.value === null)) {
251
+ attributes[attr.name] = attr.value;
252
+ }
253
+ }
254
+ return attributes;
255
+ }
256
+ return element.attributes ?? {};
257
+ }
213
258
  function flattenNode(node) {
214
259
  if ("children" in node)
215
260
  return node.children.map((child) => flattenNode(child)).join("");
216
261
  if ("value" in node) return node.value;
217
262
  return "";
218
263
  }
264
+ function parseSpecifier(specifier) {
265
+ const idx = specifier.lastIndexOf("#");
266
+ if (idx === -1) return { file: specifier };
267
+ return {
268
+ file: specifier.slice(0, idx),
269
+ section: specifier.slice(idx + 1)
270
+ };
271
+ }
272
+ function extractSection(root, section) {
273
+ let nodes;
274
+ let capturingHeadingContent = false;
275
+ (0, import_unist_util_visit2.visit)(root, (node) => {
276
+ if (node.type === "heading") {
277
+ if (capturingHeadingContent) {
278
+ return false;
279
+ }
280
+ if (node.data?.hProperties?.id === section) {
281
+ capturingHeadingContent = true;
282
+ nodes = [node];
283
+ return "skip";
284
+ }
285
+ return;
286
+ }
287
+ if (capturingHeadingContent) {
288
+ nodes?.push(node);
289
+ return "skip";
290
+ }
291
+ if (isElementLike(node) && node.name === "section") {
292
+ const attributes = parseElementAttributes(node);
293
+ if (attributes.id === section) {
294
+ nodes = node.children;
295
+ return false;
296
+ }
297
+ }
298
+ });
299
+ if (nodes)
300
+ return {
301
+ type: "root",
302
+ children: nodes
303
+ };
304
+ }
219
305
  function remarkInclude() {
220
306
  const TagName = "include";
221
- async function update(tree, file, processor, compiler) {
222
- const queue = [];
223
- (0, import_unist_util_visit.visit)(
224
- tree,
225
- ["mdxJsxFlowElement", "mdxJsxTextElement"],
226
- (node, _, parent) => {
227
- let specifier;
228
- const params = {};
229
- if ((node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name === TagName) {
230
- const value = flattenNode(node);
231
- if (value.length > 0) {
232
- for (const attr of node.attributes) {
233
- if (attr.type === "mdxJsxAttribute" && (typeof attr.value === "string" || attr.value === null)) {
234
- params[attr.name] = attr.value;
235
- }
236
- }
237
- specifier = value;
238
- }
239
- }
240
- if (!specifier) return;
241
- const targetPath = path.resolve(
242
- "cwd" in params ? process.cwd() : path.dirname(file),
243
- specifier
244
- );
245
- const asCode = params.lang || !specifier.endsWith(".md") && !specifier.endsWith(".mdx");
246
- queue.push(
247
- fs.readFile(targetPath).then(async (content) => {
248
- compiler?.addDependency(targetPath);
249
- if (asCode) {
250
- const lang = params.lang ?? path.extname(specifier).slice(1);
251
- Object.assign(node, {
252
- type: "code",
253
- lang,
254
- meta: params.meta,
255
- value: content.toString(),
256
- data: {}
257
- });
258
- return;
259
- }
260
- const parsed = processor.parse((0, import_gray_matter.default)(content).content);
261
- await update(parsed, targetPath, processor, compiler);
262
- Object.assign(
263
- parent && parent.type === "paragraph" ? parent : node,
264
- parsed
265
- );
266
- }).catch((e) => {
267
- console.warn(`failed to read file: ${targetPath}`, e);
268
- })
307
+ const embedContent = async (file, heading, params, data) => {
308
+ let content;
309
+ try {
310
+ content = (await fs.readFile(file)).toString();
311
+ } catch (e) {
312
+ throw new Error(
313
+ `failed to read file ${file}
314
+ ${e instanceof Error ? e.message : String(e)}`,
315
+ { cause: e }
316
+ );
317
+ }
318
+ const ext = path.extname(file);
319
+ data._compiler?.addDependency(file);
320
+ if (params.lang || ext !== ".md" && ext !== ".mdx") {
321
+ const lang = params.lang ?? ext.slice(1);
322
+ return {
323
+ type: "code",
324
+ lang,
325
+ meta: params.meta,
326
+ value: content,
327
+ data: {}
328
+ };
329
+ }
330
+ const parser = data._getProcessor ? data._getProcessor(ext === ".mdx" ? "mdx" : "md") : this;
331
+ const parsed = fumaMatter(content);
332
+ let mdast = parser.parse({
333
+ path: file,
334
+ value: parsed.content,
335
+ data: { frontmatter: parsed.data }
336
+ });
337
+ const baseProcessor = (0, import_unified.unified)().use(remarkMarkAndUnravel);
338
+ if (heading) {
339
+ const extracted = extractSection(
340
+ await baseProcessor.use(import_mdx_plugins.remarkHeading).run(mdast),
341
+ heading
342
+ );
343
+ if (!extracted)
344
+ throw new Error(
345
+ `Cannot find section ${heading} in ${file}, make sure you have encapsulated the section in a <section id="${heading}"> tag, or a :::section directive with remark-directive configured.`
269
346
  );
270
- return "skip";
271
- }
272
- );
347
+ mdast = extracted;
348
+ } else {
349
+ mdast = await baseProcessor.run(mdast);
350
+ }
351
+ await update(mdast, path.dirname(file), data);
352
+ return mdast;
353
+ };
354
+ async function update(tree, directory, data) {
355
+ const queue = [];
356
+ (0, import_unist_util_visit2.visit)(tree, ElementLikeTypes, (_node, _, parent) => {
357
+ const node = _node;
358
+ if (node.name !== TagName) return;
359
+ const specifier = flattenNode(node);
360
+ if (specifier.length === 0) return "skip";
361
+ const attributes = parseElementAttributes(node);
362
+ const { file: relativePath, section } = parseSpecifier(specifier);
363
+ const file = path.resolve(
364
+ "cwd" in attributes ? process.cwd() : directory,
365
+ relativePath
366
+ );
367
+ queue.push(
368
+ embedContent(file, section, attributes, data).then((replace) => {
369
+ Object.assign(
370
+ parent && parent.type === "paragraph" ? parent : node,
371
+ replace
372
+ );
373
+ })
374
+ );
375
+ return "skip";
376
+ });
273
377
  await Promise.all(queue);
274
378
  }
275
379
  return async (tree, file) => {
276
- await update(tree, file.path, this, file.data._compiler);
380
+ await update(tree, path.dirname(file.path), file.data);
277
381
  };
278
382
  }
279
383
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,13 +1,11 @@
1
- export { c as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, a as DocsCollection, F as FileInfo, G as GlobalConfig, b as MarkdownProps, M as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-BaW0PQDJ.cjs';
1
+ export { A as AnyCollection, B as BaseCollection, a as CollectionSchema, D as DefaultMDXOptions, b as DocCollection, c as DocsCollection, G as GlobalConfig, M as MetaCollection, P as PostprocessOptions, d as defineCollections, f as defineConfig, e as defineDocs, h as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../core-B6j6Fxse.cjs';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
- import '@mdx-js/mdx';
5
- import 'mdx/types';
4
+ import '@standard-schema/spec';
6
5
  import 'fumadocs-core/mdx-plugins';
7
- import 'fumadocs-core/server';
8
- import 'react';
6
+ import '@mdx-js/mdx';
9
7
  import 'zod';
10
- import '@standard-schema/spec';
8
+ import 'chokidar';
11
9
 
12
10
  declare function remarkInclude(this: Processor): Transformer<Root, Root>;
13
11
 
@@ -1,13 +1,11 @@
1
- export { c as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, a as DocsCollection, F as FileInfo, G as GlobalConfig, b as MarkdownProps, M as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-BaW0PQDJ.js';
1
+ export { A as AnyCollection, B as BaseCollection, a as CollectionSchema, D as DefaultMDXOptions, b as DocCollection, c as DocsCollection, G as GlobalConfig, M as MetaCollection, P as PostprocessOptions, d as defineCollections, f as defineConfig, e as defineDocs, h as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../core-B6j6Fxse.js';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
- import '@mdx-js/mdx';
5
- import 'mdx/types';
4
+ import '@standard-schema/spec';
6
5
  import 'fumadocs-core/mdx-plugins';
7
- import 'fumadocs-core/server';
8
- import 'react';
6
+ import '@mdx-js/mdx';
9
7
  import 'zod';
10
- import '@standard-schema/spec';
8
+ import 'chokidar';
11
9
 
12
10
  declare function remarkInclude(this: Processor): Transformer<Root, Root>;
13
11
 
@@ -1,38 +1,45 @@
1
1
  import {
2
- frontmatterSchema,
3
- metaSchema
4
- } from "../chunk-2ZOW45YZ.js";
2
+ getDefaultMDXOptions
3
+ } from "../chunk-FSZMKRVH.js";
5
4
  import {
6
5
  remarkInclude
7
- } from "../chunk-MK7EXW7O.js";
8
- import {
9
- getDefaultMDXOptions
10
- } from "../chunk-IOENRFUX.js";
6
+ } from "../chunk-K5ZLPEIQ.js";
7
+ import "../chunk-VWJKRQZR.js";
8
+
9
+ // src/config/zod-4.ts
10
+ import { z } from "zod";
11
+ var metaSchema = z.object({
12
+ title: z.string().optional(),
13
+ pages: z.array(z.string()).optional(),
14
+ description: z.string().optional(),
15
+ root: z.boolean().optional(),
16
+ defaultOpen: z.boolean().optional(),
17
+ icon: z.string().optional()
18
+ });
19
+ var frontmatterSchema = z.object({
20
+ title: z.string(),
21
+ description: z.string().optional(),
22
+ icon: z.string().optional(),
23
+ full: z.boolean().optional(),
24
+ // Fumadocs OpenAPI generated
25
+ _openapi: z.looseObject({}).optional()
26
+ });
11
27
 
12
28
  // src/config/define.ts
13
29
  function defineCollections(options) {
14
- return {
15
- // @ts-expect-error -- internal type inferring
16
- _type: void 0,
17
- ...options
18
- };
30
+ return options;
19
31
  }
20
32
  function defineDocs(options) {
21
- if (!options)
22
- console.warn(
23
- "[`source.config.ts`] Deprecated: please pass options to `defineDocs()` and specify a `dir`."
24
- );
25
- const dir = options?.dir ?? "content/docs";
33
+ const dir = options.dir ?? "content/docs";
26
34
  return {
27
35
  type: "docs",
28
- // @ts-expect-error -- internal type inferring
36
+ dir,
29
37
  docs: defineCollections({
30
38
  type: "doc",
31
39
  dir,
32
40
  schema: frontmatterSchema,
33
41
  ...options?.docs
34
42
  }),
35
- // @ts-expect-error -- internal type inferring
36
43
  meta: defineCollections({
37
44
  type: "meta",
38
45
  dir,