fumadocs-mdx 11.7.3 → 11.7.5

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 (38) hide show
  1. package/dist/{chunk-AVMO2SRO.js → chunk-3XN4P23K.js} +49 -11
  2. package/dist/chunk-GBMFGEC7.js +57 -0
  3. package/dist/{chunk-ZOWJF3OH.js → chunk-GX3THK2Q.js} +25 -20
  4. package/dist/{chunk-2CSSQTP6.js → chunk-GYWPPGFD.js} +9 -1
  5. package/dist/chunk-HWSF4OGZ.js +42 -0
  6. package/dist/chunk-UCY7OBZG.js +12 -0
  7. package/dist/{chunk-JFNBRKRV.js → chunk-XVL4ZQFK.js} +12 -6
  8. package/dist/{chunk-4CGSOZUZ.js → chunk-XZR5QXVY.js} +32 -2
  9. package/dist/config/index.cjs +59 -14
  10. package/dist/config/index.d.cts +2 -2
  11. package/dist/config/index.d.ts +2 -2
  12. package/dist/config/index.js +8 -36
  13. package/dist/config/zod-3.cjs +371 -0
  14. package/dist/config/zod-3.d.cts +53 -0
  15. package/dist/config/zod-3.d.ts +53 -0
  16. package/dist/config/zod-3.js +40 -0
  17. package/dist/{define-E6TRBwBQ.d.cts → define-DnJzAZrj.d.cts} +3 -2
  18. package/dist/{define-E6TRBwBQ.d.ts → define-DnJzAZrj.d.ts} +3 -2
  19. package/dist/index.d.cts +3 -3
  20. package/dist/index.d.ts +3 -3
  21. package/dist/loader-mdx.cjs +121 -53
  22. package/dist/loader-mdx.js +8 -8
  23. package/dist/{mdx-options-UDV5WEFU.js → mdx-options-3NB74EMB.js} +1 -1
  24. package/dist/next/index.cjs +52 -25
  25. package/dist/next/index.js +4 -6
  26. package/dist/runtime/async.cjs +202 -129
  27. package/dist/runtime/async.d.cts +3 -3
  28. package/dist/runtime/async.d.ts +3 -3
  29. package/dist/runtime/async.js +26 -43
  30. package/dist/runtime/vite.d.cts +2 -2
  31. package/dist/runtime/vite.d.ts +2 -2
  32. package/dist/{types-DiL328cG.d.ts → types-C-WXTx1W.d.cts} +2 -2
  33. package/dist/{types-Lh_-Uuix.d.cts → types-CU9nn_je.d.ts} +2 -2
  34. package/dist/vite/index.cjs +92 -54
  35. package/dist/vite/index.js +8 -8
  36. package/package.json +12 -7
  37. package/dist/chunk-C5INPAZJ.js +0 -49
  38. package/dist/chunk-VUEZTR2H.js +0 -26
@@ -12,9 +12,29 @@ function flattenNode(node) {
12
12
  if ("value" in node) return node.value;
13
13
  return "";
14
14
  }
15
+ function parseSpecifier(specifier) {
16
+ const idx = specifier.lastIndexOf("#");
17
+ if (idx === -1) return { file: specifier };
18
+ return {
19
+ file: specifier.slice(0, idx),
20
+ section: specifier.slice(idx + 1)
21
+ };
22
+ }
23
+ function extractSection(root, section) {
24
+ for (const node of root.children) {
25
+ if (node.type === "mdxJsxFlowElement" && node.name === "section" && node.attributes.some(
26
+ (attr) => attr.type === "mdxJsxAttribute" && attr.name === "id" && attr.value === section
27
+ )) {
28
+ return {
29
+ type: "root",
30
+ children: node.children
31
+ };
32
+ }
33
+ }
34
+ }
15
35
  function remarkInclude() {
16
36
  const TagName = "include";
17
- async function update(tree, file, processor, compiler) {
37
+ async function update(tree, directory, data) {
18
38
  const queue = [];
19
39
  visit(
20
40
  tree,
@@ -34,27 +54,44 @@ function remarkInclude() {
34
54
  }
35
55
  }
36
56
  if (!specifier) return;
57
+ const { file, section } = parseSpecifier(specifier);
37
58
  const targetPath = path.resolve(
38
- "cwd" in params ? process.cwd() : path.dirname(file),
39
- specifier
59
+ "cwd" in params ? process.cwd() : directory,
60
+ file
40
61
  );
41
- const asCode = params.lang || !specifier.endsWith(".md") && !specifier.endsWith(".mdx");
62
+ const asCode = params.lang || !file.endsWith(".md") && !file.endsWith(".mdx");
42
63
  queue.push(
43
64
  fs.readFile(targetPath).then((buffer) => buffer.toString()).then(async (content) => {
44
- compiler?.addDependency(targetPath);
65
+ data._compiler?.addDependency(targetPath);
45
66
  if (asCode) {
46
- const lang = params.lang ?? path.extname(specifier).slice(1);
67
+ const lang = params.lang ?? path.extname(file).slice(1);
47
68
  Object.assign(node, {
48
69
  type: "code",
49
70
  lang,
50
71
  meta: params.meta,
51
- value: content.toString(),
72
+ value: content,
52
73
  data: {}
53
74
  });
54
75
  return;
55
76
  }
56
- const parsed = processor.parse(fumaMatter(content).content);
57
- await update(parsed, targetPath, processor, compiler);
77
+ const processor = data._processor ? data._processor.getProcessor(
78
+ targetPath.endsWith(".md") ? "md" : "mdx"
79
+ ) : this;
80
+ let parsed = processor.parse(fumaMatter(content).content);
81
+ if (section) {
82
+ const extracted = extractSection(parsed, section);
83
+ if (!extracted)
84
+ throw new Error(
85
+ `Cannot find section ${section} in ${file}, make sure you have encapsulated the section in a <section id="${section}"> tag`
86
+ );
87
+ parsed = extracted;
88
+ }
89
+ await update.call(
90
+ processor,
91
+ parsed,
92
+ path.dirname(targetPath),
93
+ data
94
+ );
58
95
  Object.assign(
59
96
  parent && parent.type === "paragraph" ? parent : node,
60
97
  parsed
@@ -62,7 +99,8 @@ function remarkInclude() {
62
99
  }).catch((e) => {
63
100
  throw new Error(
64
101
  `failed to read file ${targetPath}
65
- ${e instanceof Error ? e.message : String(e)}`
102
+ ${e instanceof Error ? e.message : String(e)}`,
103
+ { cause: e }
66
104
  );
67
105
  })
68
106
  );
@@ -72,7 +110,7 @@ ${e instanceof Error ? e.message : String(e)}`
72
110
  await Promise.all(queue);
73
111
  }
74
112
  return async (tree, file) => {
75
- await update(tree, file.path, this, file.data._compiler);
113
+ await update.call(this, tree, path.dirname(file.path), file.data);
76
114
  };
77
115
  }
78
116
 
@@ -0,0 +1,57 @@
1
+ // src/config/zod-4.ts
2
+ import { z } from "zod";
3
+ var metaSchema = z.object({
4
+ title: z.string().optional(),
5
+ pages: z.array(z.string()).optional(),
6
+ description: z.string().optional(),
7
+ root: z.boolean().optional(),
8
+ defaultOpen: z.boolean().optional(),
9
+ icon: z.string().optional()
10
+ });
11
+ var frontmatterSchema = z.object({
12
+ title: z.string(),
13
+ description: z.string().optional(),
14
+ icon: z.string().optional(),
15
+ full: z.boolean().optional(),
16
+ // Fumadocs OpenAPI generated
17
+ _openapi: z.looseObject({}).optional()
18
+ });
19
+
20
+ // src/config/define.ts
21
+ function defineCollections(options) {
22
+ return options;
23
+ }
24
+ function defineDocs(options) {
25
+ if (!options)
26
+ console.warn(
27
+ "[`source.config.ts`] Deprecated: please pass options to `defineDocs()` and specify a `dir`."
28
+ );
29
+ const dir = options?.dir ?? "content/docs";
30
+ return {
31
+ type: "docs",
32
+ dir,
33
+ docs: defineCollections({
34
+ type: "doc",
35
+ dir,
36
+ schema: frontmatterSchema,
37
+ ...options?.docs
38
+ }),
39
+ meta: defineCollections({
40
+ type: "meta",
41
+ dir,
42
+ schema: metaSchema,
43
+ ...options?.meta
44
+ })
45
+ };
46
+ }
47
+ function defineConfig(config = {}) {
48
+ return config;
49
+ }
50
+
51
+ export {
52
+ metaSchema,
53
+ frontmatterSchema,
54
+ defineCollections,
55
+ defineDocs,
56
+ defineConfig
57
+ };
@@ -1,22 +1,28 @@
1
- // src/utils/schema.ts
2
- import { z } from "zod";
1
+ // src/utils/git-timestamp.ts
2
+ import path from "path";
3
+ import { x } from "tinyexec";
4
+ var cache = /* @__PURE__ */ new Map();
5
+ async function getGitTimestamp(file) {
6
+ const cached = cache.get(file);
7
+ if (cached) return cached;
8
+ try {
9
+ const out = await x(
10
+ "git",
11
+ ["log", "-1", '--pretty="%ai"', path.relative(process.cwd(), file)],
12
+ {
13
+ throwOnError: true
14
+ }
15
+ );
16
+ const time = new Date(out.stdout);
17
+ cache.set(file, time);
18
+ return time;
19
+ } catch {
20
+ return;
21
+ }
22
+ }
23
+
24
+ // src/utils/validation.ts
3
25
  import picocolors from "picocolors";
4
- var metaSchema = z.object({
5
- title: z.string().optional(),
6
- pages: z.array(z.string()).optional(),
7
- description: z.string().optional(),
8
- root: z.boolean().optional(),
9
- defaultOpen: z.boolean().optional(),
10
- icon: z.string().optional()
11
- });
12
- var frontmatterSchema = z.object({
13
- title: z.string(),
14
- description: z.string().optional(),
15
- icon: z.string().optional(),
16
- full: z.boolean().optional(),
17
- // Fumadocs OpenAPI generated
18
- _openapi: z.looseObject({}).optional()
19
- });
20
26
  var ValidationError = class extends Error {
21
27
  constructor(message, issues) {
22
28
  super(
@@ -54,8 +60,7 @@ async function validate(schema, data, context, errorMessage) {
54
60
  }
55
61
 
56
62
  export {
57
- metaSchema,
58
- frontmatterSchema,
63
+ getGitTimestamp,
59
64
  ValidationError,
60
65
  validate
61
66
  };
@@ -63,6 +63,7 @@ function getDefaultMDXOptions({
63
63
  remarkStructureOptions,
64
64
  remarkCodeTabOptions,
65
65
  remarkNpmOptions,
66
+ _withoutBundler = false,
66
67
  ...mdxOptions
67
68
  }) {
68
69
  const mdxExports = [
@@ -81,7 +82,13 @@ function getDefaultMDXOptions({
81
82
  ...remarkHeadingOptions
82
83
  }
83
84
  ],
84
- remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
85
+ remarkImageOptions !== false && [
86
+ plugins.remarkImage,
87
+ {
88
+ ...remarkImageOptions,
89
+ useImport: _withoutBundler ? false : remarkImageOptions?.useImport
90
+ }
91
+ ],
85
92
  "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
86
93
  plugins.remarkCodeTab,
87
94
  remarkCodeTabOptions
@@ -106,6 +113,7 @@ function getDefaultMDXOptions({
106
113
  );
107
114
  return {
108
115
  ...mdxOptions,
116
+ outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
109
117
  remarkPlugins,
110
118
  rehypePlugins
111
119
  };
@@ -0,0 +1,42 @@
1
+ import {
2
+ remarkInclude
3
+ } from "./chunk-3XN4P23K.js";
4
+
5
+ // src/utils/build-mdx.ts
6
+ import { createProcessor } from "@mdx-js/mdx";
7
+ var cache = /* @__PURE__ */ new Map();
8
+ async function buildMDX(cacheKey, source, options) {
9
+ const { filePath, frontmatter, data, _compiler, ...rest } = options;
10
+ function getProcessor(format) {
11
+ const key = `${cacheKey}:${format}`;
12
+ let processor = cache.get(key);
13
+ if (!processor) {
14
+ processor = createProcessor({
15
+ outputFormat: "program",
16
+ ...rest,
17
+ remarkPlugins: [remarkInclude, ...rest.remarkPlugins ?? []],
18
+ format
19
+ });
20
+ cache.set(key, processor);
21
+ }
22
+ return processor;
23
+ }
24
+ return getProcessor(
25
+ options.format ?? filePath.endsWith(".mdx") ? "mdx" : "md"
26
+ ).process({
27
+ value: source,
28
+ path: filePath,
29
+ data: {
30
+ ...data,
31
+ frontmatter,
32
+ _compiler,
33
+ _processor: {
34
+ getProcessor
35
+ }
36
+ }
37
+ });
38
+ }
39
+
40
+ export {
41
+ buildMDX
42
+ };
@@ -0,0 +1,12 @@
1
+ // src/utils/count-lines.ts
2
+ function countLines(s) {
3
+ let num = 0;
4
+ for (const c of s) {
5
+ if (c === "\n") num++;
6
+ }
7
+ return num;
8
+ }
9
+
10
+ export {
11
+ countLines
12
+ };
@@ -24,20 +24,26 @@ function buildConfig(config) {
24
24
  `Unknown export "${k}", you can only export collections from source configuration file.`
25
25
  );
26
26
  }
27
- let cachedMdxOptions;
27
+ const mdxOptionsCache = /* @__PURE__ */ new Map();
28
28
  return {
29
29
  global: globalConfig,
30
30
  collections,
31
- async getDefaultMDXOptions() {
32
- if (cachedMdxOptions) return cachedMdxOptions;
31
+ async getDefaultMDXOptions(mode = "default") {
32
+ const cached = mdxOptionsCache.get(mode);
33
+ if (cached) return cached;
33
34
  const input = this.global.mdxOptions;
34
35
  async function uncached() {
35
36
  const options = typeof input === "function" ? await input() : input;
36
- const { getDefaultMDXOptions } = await import("./mdx-options-UDV5WEFU.js");
37
+ const { getDefaultMDXOptions } = await import("./mdx-options-3NB74EMB.js");
37
38
  if (options?.preset === "minimal") return options;
38
- return getDefaultMDXOptions(options ?? {});
39
+ return getDefaultMDXOptions({
40
+ ...options,
41
+ _withoutBundler: mode === "remote"
42
+ });
39
43
  }
40
- return cachedMdxOptions = uncached();
44
+ const result = uncached();
45
+ mdxOptionsCache.set(mode, result);
46
+ return result;
41
47
  }
42
48
  };
43
49
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildConfig
3
- } from "./chunk-JFNBRKRV.js";
3
+ } from "./chunk-XVL4ZQFK.js";
4
4
 
5
5
  // src/utils/config.ts
6
6
  import * as fs from "fs/promises";
@@ -10,17 +10,47 @@ function findConfigFile() {
10
10
  return path.resolve("source.config.ts");
11
11
  }
12
12
  var cache = null;
13
+ async function isZod3() {
14
+ try {
15
+ const content = JSON.parse(
16
+ (await fs.readFile("node_modules/zod/package.json")).toString()
17
+ );
18
+ const version = content.version;
19
+ return typeof version === "string" && version.startsWith("3.");
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+ function createCompatZodPlugin() {
25
+ return {
26
+ name: "replace-zod-import",
27
+ async setup(build) {
28
+ const usingZod3 = await isZod3();
29
+ if (!usingZod3) return;
30
+ console.warn(
31
+ "[Fumadocs MDX] Noticed Zod v3 in your node_modules, we recommend upgrading to Zod v4 for better compatibility."
32
+ );
33
+ build.onResolve({ filter: /^fumadocs-mdx\/config$/ }, () => {
34
+ return {
35
+ path: "fumadocs-mdx/config/zod-3",
36
+ external: true
37
+ };
38
+ });
39
+ }
40
+ };
41
+ }
13
42
  async function compileConfig(configPath, outDir) {
14
43
  const { build } = await import("esbuild");
15
44
  const transformed = await build({
16
45
  entryPoints: [{ in: configPath, out: "source.config" }],
17
46
  bundle: true,
18
47
  outdir: outDir,
19
- target: "node18",
48
+ target: "node20",
20
49
  write: true,
21
50
  platform: "node",
22
51
  format: "esm",
23
52
  packages: "external",
53
+ plugins: [createCompatZodPlugin()],
24
54
  outExtension: {
25
55
  ".js": ".mjs"
26
56
  },
@@ -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(),
@@ -156,6 +155,7 @@ function getDefaultMDXOptions({
156
155
  remarkStructureOptions,
157
156
  remarkCodeTabOptions,
158
157
  remarkNpmOptions,
158
+ _withoutBundler = false,
159
159
  ...mdxOptions
160
160
  }) {
161
161
  const mdxExports = [
@@ -174,7 +174,13 @@ function getDefaultMDXOptions({
174
174
  ...remarkHeadingOptions
175
175
  }
176
176
  ],
177
- remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
177
+ remarkImageOptions !== false && [
178
+ plugins.remarkImage,
179
+ {
180
+ ...remarkImageOptions,
181
+ useImport: _withoutBundler ? false : remarkImageOptions?.useImport
182
+ }
183
+ ],
178
184
  "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
179
185
  plugins.remarkCodeTab,
180
186
  remarkCodeTabOptions
@@ -199,6 +205,7 @@ function getDefaultMDXOptions({
199
205
  );
200
206
  return {
201
207
  ...mdxOptions,
208
+ outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
202
209
  remarkPlugins,
203
210
  rehypePlugins
204
211
  };
@@ -232,9 +239,29 @@ function flattenNode(node) {
232
239
  if ("value" in node) return node.value;
233
240
  return "";
234
241
  }
242
+ function parseSpecifier(specifier) {
243
+ const idx = specifier.lastIndexOf("#");
244
+ if (idx === -1) return { file: specifier };
245
+ return {
246
+ file: specifier.slice(0, idx),
247
+ section: specifier.slice(idx + 1)
248
+ };
249
+ }
250
+ function extractSection(root, section) {
251
+ for (const node of root.children) {
252
+ if (node.type === "mdxJsxFlowElement" && node.name === "section" && node.attributes.some(
253
+ (attr) => attr.type === "mdxJsxAttribute" && attr.name === "id" && attr.value === section
254
+ )) {
255
+ return {
256
+ type: "root",
257
+ children: node.children
258
+ };
259
+ }
260
+ }
261
+ }
235
262
  function remarkInclude() {
236
263
  const TagName = "include";
237
- async function update(tree, file, processor, compiler) {
264
+ async function update(tree, directory, data) {
238
265
  const queue = [];
239
266
  (0, import_unist_util_visit.visit)(
240
267
  tree,
@@ -254,27 +281,44 @@ function remarkInclude() {
254
281
  }
255
282
  }
256
283
  if (!specifier) return;
284
+ const { file, section } = parseSpecifier(specifier);
257
285
  const targetPath = path.resolve(
258
- "cwd" in params ? process.cwd() : path.dirname(file),
259
- specifier
286
+ "cwd" in params ? process.cwd() : directory,
287
+ file
260
288
  );
261
- const asCode = params.lang || !specifier.endsWith(".md") && !specifier.endsWith(".mdx");
289
+ const asCode = params.lang || !file.endsWith(".md") && !file.endsWith(".mdx");
262
290
  queue.push(
263
291
  fs.readFile(targetPath).then((buffer) => buffer.toString()).then(async (content) => {
264
- compiler?.addDependency(targetPath);
292
+ data._compiler?.addDependency(targetPath);
265
293
  if (asCode) {
266
- const lang = params.lang ?? path.extname(specifier).slice(1);
294
+ const lang = params.lang ?? path.extname(file).slice(1);
267
295
  Object.assign(node, {
268
296
  type: "code",
269
297
  lang,
270
298
  meta: params.meta,
271
- value: content.toString(),
299
+ value: content,
272
300
  data: {}
273
301
  });
274
302
  return;
275
303
  }
276
- const parsed = processor.parse(fumaMatter(content).content);
277
- await update(parsed, targetPath, processor, compiler);
304
+ const processor = data._processor ? data._processor.getProcessor(
305
+ targetPath.endsWith(".md") ? "md" : "mdx"
306
+ ) : this;
307
+ let parsed = processor.parse(fumaMatter(content).content);
308
+ if (section) {
309
+ const extracted = extractSection(parsed, section);
310
+ if (!extracted)
311
+ throw new Error(
312
+ `Cannot find section ${section} in ${file}, make sure you have encapsulated the section in a <section id="${section}"> tag`
313
+ );
314
+ parsed = extracted;
315
+ }
316
+ await update.call(
317
+ processor,
318
+ parsed,
319
+ path.dirname(targetPath),
320
+ data
321
+ );
278
322
  Object.assign(
279
323
  parent && parent.type === "paragraph" ? parent : node,
280
324
  parsed
@@ -282,7 +326,8 @@ function remarkInclude() {
282
326
  }).catch((e) => {
283
327
  throw new Error(
284
328
  `failed to read file ${targetPath}
285
- ${e instanceof Error ? e.message : String(e)}`
329
+ ${e instanceof Error ? e.message : String(e)}`,
330
+ { cause: e }
286
331
  );
287
332
  })
288
333
  );
@@ -292,7 +337,7 @@ ${e instanceof Error ? e.message : String(e)}`
292
337
  await Promise.all(queue);
293
338
  }
294
339
  return async (tree, file) => {
295
- await update(tree, file.path, this, file.data._compiler);
340
+ await update.call(this, tree, path.dirname(file.path), file.data);
296
341
  };
297
342
  }
298
343
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,10 +1,10 @@
1
- export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-E6TRBwBQ.cjs';
1
+ export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-DnJzAZrj.cjs';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
- import 'zod';
5
4
  import '@standard-schema/spec';
6
5
  import 'fumadocs-core/mdx-plugins';
7
6
  import '@mdx-js/mdx';
7
+ import 'zod';
8
8
 
9
9
  declare function remarkInclude(this: Processor): Transformer<Root, Root>;
10
10
 
@@ -1,10 +1,10 @@
1
- export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-E6TRBwBQ.js';
1
+ export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-DnJzAZrj.js';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
- import 'zod';
5
4
  import '@standard-schema/spec';
6
5
  import 'fumadocs-core/mdx-plugins';
7
6
  import '@mdx-js/mdx';
7
+ import 'zod';
8
8
 
9
9
  declare function remarkInclude(this: Processor): Transformer<Root, Root>;
10
10
 
@@ -1,45 +1,17 @@
1
1
  import {
2
+ defineCollections,
3
+ defineConfig,
4
+ defineDocs,
2
5
  frontmatterSchema,
3
6
  metaSchema
4
- } from "../chunk-ZOWJF3OH.js";
7
+ } from "../chunk-GBMFGEC7.js";
8
+ import {
9
+ getDefaultMDXOptions
10
+ } from "../chunk-GYWPPGFD.js";
5
11
  import {
6
12
  remarkInclude
7
- } from "../chunk-AVMO2SRO.js";
13
+ } from "../chunk-3XN4P23K.js";
8
14
  import "../chunk-KVWX6THC.js";
9
- import {
10
- getDefaultMDXOptions
11
- } from "../chunk-2CSSQTP6.js";
12
-
13
- // src/config/define.ts
14
- function defineCollections(options) {
15
- return options;
16
- }
17
- function defineDocs(options) {
18
- if (!options)
19
- console.warn(
20
- "[`source.config.ts`] Deprecated: please pass options to `defineDocs()` and specify a `dir`."
21
- );
22
- const dir = options?.dir ?? "content/docs";
23
- return {
24
- type: "docs",
25
- dir,
26
- docs: defineCollections({
27
- type: "doc",
28
- dir,
29
- schema: frontmatterSchema,
30
- ...options?.docs
31
- }),
32
- meta: defineCollections({
33
- type: "meta",
34
- dir,
35
- schema: metaSchema,
36
- ...options?.meta
37
- })
38
- };
39
- }
40
- function defineConfig(config = {}) {
41
- return config;
42
- }
43
15
  export {
44
16
  defineCollections,
45
17
  defineConfig,