fumadocs-mdx 15.4.9 → 15.5.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 (70) hide show
  1. package/dist/{adapter-BUIa-1SI.js → adapter-C_fAYz8a.js} +6 -7
  2. package/dist/bin.js +1 -2
  3. package/dist/{build-H2VN-Hpm.js → build-6pmheBOc.js} +4 -5
  4. package/dist/{build-default-CSiWktEh.js → build-default-DxRVIZIq.js} +42 -13
  5. package/dist/{build-satteri-DUjpwpvb.js → build-satteri-BRRVAMZo.js} +2 -3
  6. package/dist/bun/index.d.ts +3 -5
  7. package/dist/bun/index.js +10 -11
  8. package/dist/{codegen-DfCJFqO-.js → codegen-D-Cjx_kh.js} +1 -2
  9. package/dist/config/index.d.ts +23 -3
  10. package/dist/config/index.js +4 -4
  11. package/dist/{core-DV3f7rXs.js → core-B3ysiPKS.js} +4 -7
  12. package/dist/{core-6H7qqwEM.d.ts → core-CdciznjV.d.ts} +5 -25
  13. package/dist/{define-BW5lveuc.js → define-C2jwQBlt.js} +1 -2
  14. package/dist/{dist-DrAxpp76.js → dist-C5kTFYyB.js} +1 -2
  15. package/dist/{eval-Cnxpyc4j.js → eval-BK4eWlcF.js} +6 -7
  16. package/dist/{index-CIxuOQ_6.d.ts → index-DHkDeoqE.d.ts} +1 -3
  17. package/dist/{index-file-C9-jDz59.js → index-file-Cd0QDLxu.js} +3 -5
  18. package/dist/index.d.ts +1 -1
  19. package/dist/{last-modified-BkZYFKSh.js → last-modified-COIEvwZu.js} +1 -2
  20. package/dist/{load-from-file-DGFWQ0eg.js → load-from-file-BP8EpGZa.js} +2 -3
  21. package/dist/{loaders-DWC_Uwqq.js → loaders-B_gj5Fq1.js} +1 -2
  22. package/dist/macro/index.d.ts +1 -3
  23. package/dist/macro/index.js +1 -2
  24. package/dist/{mdx-D0Qtc99b.js → mdx-wIFREygW.js} +5 -5
  25. package/dist/{meta-BR_rkCyY.js → meta-B2-_R5y0.js} +1 -2
  26. package/dist/next/index.d.ts +3 -5
  27. package/dist/next/index.js +6 -7
  28. package/dist/node/_loader.d.ts +1 -3
  29. package/dist/node/_loader.js +10 -11
  30. package/dist/node/index.d.ts +3 -5
  31. package/dist/node/index.js +1 -2
  32. package/dist/node/loader.d.ts +1 -3
  33. package/dist/node/loader.js +6 -7
  34. package/dist/{options-BNnYUjkM.js → options-B2o-zV4A.js} +1 -2
  35. package/dist/{options-aB6xV-d7.d.ts → options-BCId5Url.d.ts} +0 -2
  36. package/dist/plugins/index-file.d.ts +1 -1
  37. package/dist/plugins/index-file.js +1 -1
  38. package/dist/plugins/json-schema.d.ts +2 -4
  39. package/dist/plugins/json-schema.js +1 -2
  40. package/dist/plugins/last-modified.d.ts +2 -4
  41. package/dist/plugins/last-modified.js +1 -2
  42. package/dist/preset-Vhfrb01t.js +58 -0
  43. package/dist/press.d.ts +10 -0
  44. package/dist/press.js +53 -0
  45. package/dist/rolldown/index.d.ts +3 -5
  46. package/dist/rolldown/index.js +10 -11
  47. package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-D8jQpDG7.js} +1 -2
  48. package/dist/runtime/browser.d.ts +2 -4
  49. package/dist/runtime/browser.js +1 -2
  50. package/dist/runtime/dynamic.d.ts +4 -6
  51. package/dist/runtime/dynamic.js +3 -4
  52. package/dist/runtime/macro.d.ts +1 -3
  53. package/dist/runtime/macro.js +1 -2
  54. package/dist/runtime/server.d.ts +3 -5
  55. package/dist/runtime/server.js +1 -2
  56. package/dist/runtime/types.d.ts +1 -1
  57. package/dist/{transform-CpwlddS0.js → transform-CVIZq8Al.js} +4 -5
  58. package/dist/{types-1n7Fk5Dl.d.ts → types-CBr1-xYX.d.ts} +0 -2
  59. package/dist/vite/index.d.ts +4 -6
  60. package/dist/vite/index.js +20 -15
  61. package/dist/webpack/macro.d.ts +1 -3
  62. package/dist/webpack/macro.js +3 -4
  63. package/dist/webpack/mdx.d.ts +1 -3
  64. package/dist/webpack/mdx.js +4 -5
  65. package/dist/webpack/meta.d.ts +1 -3
  66. package/dist/webpack/meta.js +4 -5
  67. package/dist/{webpack-BozYCamo.js → webpack-DyVbvTYa.js} +3 -4
  68. package/package.json +13 -7
  69. package/dist/index-DosG5f9I.d.ts +0 -28
  70. package/dist/remark-include-WlmaWKPS.js +0 -318
@@ -1,10 +1,10 @@
1
- import { i as buildConfig, n as ValidationError } from "./core-DV3f7rXs.js";
2
- import { t as loadConfig } from "./load-from-file-DGFWQ0eg.js";
1
+ import { i as buildConfig, n as ValidationError } from "./core-B3ysiPKS.js";
2
+ import { t as loadConfig } from "./load-from-file-BP8EpGZa.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  import fs from "node:fs/promises";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { parse } from "node:querystring";
7
- //#region src/loaders/config.ts
7
+ // src/loaders/config.ts
8
8
  function createStandaloneConfigLoader({ core, buildConfig: buildConfig$1, mode }) {
9
9
  let prev;
10
10
  async function getConfigHash() {
@@ -34,8 +34,7 @@ function createIntegratedConfigLoader(core) {
34
34
  return core;
35
35
  } };
36
36
  }
37
- //#endregion
38
- //#region src/loaders/adapter.ts
37
+ // src/loaders/adapter.ts
39
38
  function toNode(test, loader) {
40
39
  return async (url, _context, nextLoad) => {
41
40
  if (url.startsWith("file:///") && (!test || test.test(url))) {
@@ -59,13 +58,14 @@ function toNode(test, loader) {
59
58
  return nextLoad(url);
60
59
  };
61
60
  }
62
- function toVite(loader) {
61
+ function toVite(loader, getInput) {
63
62
  return { async transform(value, id) {
64
63
  const [file, query = ""] = id.split("?", 2);
65
64
  try {
66
65
  const parsedQuery = parse(query);
67
66
  if ("raw" in parsedQuery) return null;
68
67
  const result = await loader.load({
68
+ ...getInput?.(),
69
69
  filePath: file,
70
70
  query: parsedQuery,
71
71
  getSource() {
@@ -139,5 +139,4 @@ function toBun(test, loader) {
139
139
  });
140
140
  };
141
141
  }
142
- //#endregion
143
142
  export { createIntegratedConfigLoader as a, toWebpack as i, toNode as n, createStandaloneConfigLoader as o, toVite as r, toBun as t };
package/dist/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync } from "node:fs";
3
- //#region src/bin.ts
3
+ // src/bin.ts
4
4
  async function start() {
5
5
  const [configPath, outDir] = process.argv.slice(2);
6
6
  if (existsSync("next.config.js") || existsSync("next.config.mjs") || existsSync("next.config.mts") || existsSync("next.config.ts")) {
@@ -18,4 +18,3 @@ async function start() {
18
18
  }
19
19
  }
20
20
  start();
21
- //#endregion
@@ -1,13 +1,12 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- //#region src/loaders/mdx/build.ts
1
+ import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
+ // src/loaders/mdx/build.ts
3
3
  var build_exports = /* @__PURE__ */ __exportAll({ buildMDX: () => buildMDX });
4
4
  async function buildMDX(core, collection, options) {
5
5
  if ((collection ? collection.compiler : core.getConfig().global.compiler) === "satteri") {
6
- const { buildSatteriMDX } = await import("./build-satteri-DUjpwpvb.js");
6
+ const { buildSatteriMDX } = await import("./build-satteri-BRRVAMZo.js");
7
7
  return buildSatteriMDX(core, collection, options);
8
8
  }
9
- const { buildJSMDX } = await import("./build-default-CSiWktEh.js");
9
+ const { buildJSMDX } = await import("./build-default-DxRVIZIq.js");
10
10
  return buildJSMDX(core, collection, options);
11
11
  }
12
- //#endregion
13
12
  export { build_exports as n, buildMDX as t };
@@ -1,11 +1,29 @@
1
- import { i as applyMdxPreset, n as flattenNode, r as walk, t as remarkInclude } from "./remark-include-WlmaWKPS.js";
2
- import { t as resolveLastModified } from "./last-modified-BkZYFKSh.js";
3
- import { VFile } from "vfile";
1
+ import { t as applyMdxPreset } from "./preset-Vhfrb01t.js";
2
+ import { t as resolveLastModified } from "./last-modified-COIEvwZu.js";
3
+ import { remarkInclude } from "fumadocs-core/mdx-plugins/remark-include";
4
4
  import { createProcessor } from "@mdx-js/mdx";
5
+ import { VFile } from "vfile";
5
6
  import { valueToEstree } from "estree-util-value-to-estree";
6
7
  import { removePosition } from "unist-util-remove-position";
7
8
  import { remarkLLMs } from "fumadocs-core/mdx-plugins/remark-llms";
8
- //#region src/loaders/mdx/remark-postprocess.ts
9
+ // src/loaders/mdx/mdast-utils.ts
10
+ function flattenNode(node) {
11
+ if ("children" in node) return node.children.map((child) => flattenNode(child)).join("");
12
+ if ("value" in node) return node.value;
13
+ return "";
14
+ }
15
+ /**
16
+ * Visit a tree in document order, returning `skip` skips the children of a node and `false` stops the walk.
17
+ */
18
+ function walk(node, visitor, index, parent) {
19
+ const result = visitor(node, index, parent);
20
+ if (result === false) return false;
21
+ if (result !== "skip" && node.children) {
22
+ for (let i = 0; i < node.children.length; i++) if (!walk(node.children[i], visitor, i, node)) return false;
23
+ }
24
+ return true;
25
+ }
26
+ // src/loaders/mdx/remark-postprocess.ts
9
27
  /**
10
28
  * - collect references
11
29
  * - write frontmatter (auto-title & description)
@@ -91,13 +109,12 @@ function getMdastExport(name, value) {
91
109
  } }
92
110
  };
93
111
  }
94
- //#endregion
95
- //#region src/loaders/mdx/build-default.ts
96
- async function buildJSMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
112
+ // src/loaders/mdx/build-default.ts
113
+ async function buildJSMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment, importsOnly = false }) {
97
114
  const mdxOptions = await getMDXOptions(core.getConfig(), collection, environment);
98
115
  function getProcessor(format) {
99
116
  const cache = core.cache;
100
- const key = `build-mdx:${collection?.name ?? "global"}:${format}`;
117
+ const key = `build-mdx:${collection?.name ?? "global"}:${format}:${importsOnly}`;
101
118
  let processor = cache.get(key);
102
119
  if (!processor) {
103
120
  const postprocessOptions = {
@@ -109,9 +126,9 @@ async function buildJSMDX(core, collection, { filePath, frontmatter, source, _co
109
126
  development: isDevelopment,
110
127
  ...mdxOptions,
111
128
  remarkPlugins: [
112
- remarkInclude,
129
+ [remarkInclude, { getProcessor }],
113
130
  ...mdxOptions.remarkPlugins ?? [],
114
- [remarkPostprocess, postprocessOptions]
131
+ importsOnly ? remarkImportsOnly : [remarkPostprocess, postprocessOptions]
115
132
  ],
116
133
  format
117
134
  });
@@ -125,8 +142,7 @@ async function buildJSMDX(core, collection, { filePath, frontmatter, source, _co
125
142
  cwd: collection?.cwd,
126
143
  data: {
127
144
  frontmatter,
128
- _compiler,
129
- _getProcessor: getProcessor
145
+ _compiler
130
146
  }
131
147
  });
132
148
  if (collection) vfile = await core.transformVFile({
@@ -148,6 +164,20 @@ async function buildJSMDX(core, collection, { filePath, frontmatter, source, _co
148
164
  map: out.map
149
165
  };
150
166
  }
167
+ /**
168
+ * Keep only the ESM, after the remark plugins that may add imports, so the other plugins have nothing to process.
169
+ */
170
+ function remarkImportsOnly() {
171
+ return (tree) => {
172
+ const esm = [];
173
+ walk(tree, (node) => {
174
+ if (node.type !== "mdxjsEsm") return;
175
+ esm.push(node);
176
+ return "skip";
177
+ });
178
+ tree.children = esm;
179
+ };
180
+ }
151
181
  const mdxOptionsCache = /* @__PURE__ */ new WeakMap();
152
182
  function getMDXOptions(config, collection, environment = "bundler") {
153
183
  let cacheMap = mdxOptionsCache.get(config);
@@ -170,5 +200,4 @@ function getMDXOptions(config, collection, environment = "bundler") {
170
200
  cacheMap.set(key, result);
171
201
  return result;
172
202
  }
173
- //#endregion
174
203
  export { buildJSMDX };
@@ -1,6 +1,6 @@
1
- import { t as resolveLastModified } from "./last-modified-BkZYFKSh.js";
1
+ import { t as resolveLastModified } from "./last-modified-COIEvwZu.js";
2
2
  import { pathToFileURL } from "node:url";
3
- //#region src/loaders/mdx/build-satteri.ts
3
+ // src/loaders/mdx/build-satteri.ts
4
4
  async function buildSatteriMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
5
5
  const satteriOptions = await getSatteriOptions(core.getConfig(), collection, environment);
6
6
  const format = filePath.endsWith(".mdx") ? "mdx" : "md";
@@ -91,5 +91,4 @@ function getSatteriOptions(config, collection, environment = "bundler") {
91
91
  cache.set(key, result);
92
92
  return result;
93
93
  }
94
- //#endregion
95
94
  export { buildSatteriMDX };
@@ -1,7 +1,6 @@
1
- import { r as CoreOptions } from "../core-6H7qqwEM.js";
2
- import { n as ResolvedMacroOptions, t as MacroPluginOption } from "../options-aB6xV-d7.js";
1
+ import { r as CoreOptions } from "../core-CdciznjV.js";
2
+ import { n as ResolvedMacroOptions, t as MacroPluginOption } from "../options-BCId5Url.js";
3
3
  import { BunPlugin } from "bun";
4
- //#region src/bun/index.d.ts
5
4
  export interface MdxPluginOptions extends Pick<CoreOptions, 'configPath' | 'outDir' | 'plugins'> {
6
5
  /**
7
6
  * Configure the macro API (`fumadocs-mdx/macro`), or `false` to disable it.
@@ -16,5 +15,4 @@ export interface MdxPluginOptions extends Pick<CoreOptions, 'configPath' | 'outD
16
15
  * @internal
17
16
  */
18
17
  export declare function macroFilter(root: string, { include, exclude }: ResolvedMacroOptions): RegExp;
19
- export declare function createMdxPlugin(options?: MdxPluginOptions): BunPlugin;
20
- //#endregion
18
+ export declare function createMdxPlugin(options?: MdxPluginOptions): BunPlugin;
package/dist/bun/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { t as createMdxLoader } from "../mdx-D0Qtc99b.js";
2
- import { i as buildConfig, t as createCore } from "../core-DV3f7rXs.js";
3
- import { r as slash } from "../codegen-DfCJFqO-.js";
4
- import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-BUIa-1SI.js";
5
- import { t as createMetaLoader } from "../meta-BR_rkCyY.js";
6
- import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-DWC_Uwqq.js";
7
- import { r as resolveMacroOptions } from "../options-BNnYUjkM.js";
1
+ import { t as createMdxLoader } from "../mdx-wIFREygW.js";
2
+ import { i as buildConfig, t as createCore } from "../core-B3ysiPKS.js";
3
+ import { r as slash } from "../codegen-D-Cjx_kh.js";
4
+ import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-C_fAYz8a.js";
5
+ import { t as createMetaLoader } from "../meta-B2-_R5y0.js";
6
+ import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-B_gj5Fq1.js";
7
+ import { r as resolveMacroOptions } from "../options-B2o-zV4A.js";
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { randomUUID } from "node:crypto";
11
11
  import picomatch from "picomatch";
12
12
  import { pathToFileURL } from "node:url";
13
- //#region src/bun/index.ts
13
+ // src/bun/index.ts
14
14
  const EvalQueryKey = "fd-macro-eval";
15
15
  /**
16
16
  * @internal
@@ -44,7 +44,7 @@ function createMdxPlugin(options = {}) {
44
44
  await core.init({ config: buildConfig(configExports, process.cwd()) });
45
45
  if (macroOptions) {
46
46
  const root = process.cwd();
47
- const { MacroCollector } = await import("../eval-Cnxpyc4j.js").then((n) => n.r);
47
+ const { MacroCollector } = await import("../eval-BK4eWlcF.js").then((n) => n.r);
48
48
  const pendingEvals = /* @__PURE__ */ new Map();
49
49
  core.macro = new MacroCollector({
50
50
  root,
@@ -76,7 +76,7 @@ function createMdxPlugin(options = {}) {
76
76
  contents: await transform(source, file) ?? source,
77
77
  loader
78
78
  };
79
- const { transformMacroModule } = await import("../transform-CpwlddS0.js").then((n) => n.i);
79
+ const { transformMacroModule } = await import("../transform-CVIZq8Al.js").then((n) => n.i);
80
80
  return {
81
81
  contents: (await transformMacroModule({
82
82
  code: source,
@@ -94,5 +94,4 @@ function createMdxPlugin(options = {}) {
94
94
  }
95
95
  };
96
96
  }
97
- //#endregion
98
97
  export { createMdxPlugin, macroFilter };
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { glob } from "tinyglobby";
3
- //#region src/utils/codegen.ts
3
+ // src/utils/codegen.ts
4
4
  /**
5
5
  * Code generator (one instance per file)
6
6
  */
@@ -104,5 +104,4 @@ function slash(path) {
104
104
  function ident(code, tab = 1) {
105
105
  return code.split("\n").map((v) => " ".repeat(tab) + v).join("\n");
106
106
  }
107
- //#endregion
108
107
  export { ident as n, slash as r, createCodegen as t };
@@ -1,3 +1,23 @@
1
- import { C as DocsCollection, D as defineCollections, E as SatteriPresetOptions, F as DefaultMDXOptions, I as MDXPresetOptions, L as applyMdxPreset, O as defineConfig, P as PostprocessOptions, S as DocCollectionSatteri, T as MetaCollection, _ as BaseCollection, b as DocCollectionBase, g as AnyCollection, k as defineDocs, v as CollectionSchema, w as GlobalConfig, x as DocCollectionMdx, y as DocCollection } from "../core-6H7qqwEM.js";
2
- import { n as metaSchema, r as remarkInclude, t as frontmatterSchema } from "../index-DosG5f9I.js";
3
- export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocCollectionBase, DocCollectionMdx, DocCollectionSatteri, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, type PostprocessOptions, type SatteriPresetOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
1
+ import { C as DocsCollection, D as defineCollections, E as SatteriPresetOptions, F as DefaultMDXOptions, I as MDXPresetOptions, L as applyMdxPreset, O as defineConfig, P as PostprocessOptions, S as DocCollectionSatteri, T as MetaCollection, _ as BaseCollection, b as DocCollectionBase, g as AnyCollection, k as defineDocs, v as CollectionSchema, w as GlobalConfig, x as DocCollectionMdx, y as DocCollection } from "../core-CdciznjV.js";
2
+ import { remarkInclude } from "fumadocs-core/mdx-plugins/remark-include";
3
+ /** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */
4
+ export declare const frontmatterSchema: import("zod").ZodObject<{
5
+ title: import("zod").ZodString;
6
+ description: import("zod").ZodOptional<import("zod").ZodString>;
7
+ icon: import("zod").ZodOptional<import("zod").ZodString>;
8
+ full: import("zod").ZodOptional<import("zod").ZodBoolean>;
9
+ _openapi: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodCustom<import("fumadocs-core/source/schema")._JSONType, import("fumadocs-core/source/schema")._JSONType>>>;
10
+ _asyncapi: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodCustom<import("fumadocs-core/source/schema")._JSONType, import("fumadocs-core/source/schema")._JSONType>>>;
11
+ }, import("zod/v4/core").$strip>;
12
+ /** @deprecated import from `fumadocs-core/source/schema` instead (since 16.2.3) */
13
+ export declare const metaSchema: import("zod").ZodObject<{
14
+ title: import("zod").ZodOptional<import("zod").ZodString>;
15
+ pages: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
16
+ pagesIndex: import("zod").ZodOptional<import("zod").ZodString>;
17
+ description: import("zod").ZodOptional<import("zod").ZodString>;
18
+ root: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodString]>>;
19
+ defaultOpen: import("zod").ZodOptional<import("zod").ZodBoolean>;
20
+ collapsible: import("zod").ZodOptional<import("zod").ZodBoolean>;
21
+ icon: import("zod").ZodOptional<import("zod").ZodString>;
22
+ }, import("zod/v4/core").$strip>;
23
+ export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocCollectionBase, DocCollectionMdx, DocCollectionSatteri, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, type PostprocessOptions, type SatteriPresetOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, remarkInclude };
@@ -1,10 +1,10 @@
1
- import { n as defineConfig, r as defineDocs, t as defineCollections } from "../define-BW5lveuc.js";
2
- import { i as applyMdxPreset, t as remarkInclude } from "../remark-include-WlmaWKPS.js";
1
+ import { n as defineConfig, r as defineDocs, t as defineCollections } from "../define-C2jwQBlt.js";
2
+ import { t as applyMdxPreset } from "../preset-Vhfrb01t.js";
3
3
  import { metaSchema as metaSchema$1, pageSchema } from "fumadocs-core/source/schema";
4
- //#region src/config/index.ts
4
+ import { remarkInclude } from "fumadocs-core/mdx-plugins/remark-include";
5
+ // src/config/index.ts
5
6
  /** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */
6
7
  const frontmatterSchema = pageSchema;
7
8
  /** @deprecated import from `fumadocs-core/source/schema` instead (since 16.2.3) */
8
9
  const metaSchema = metaSchema$1;
9
- //#endregion
10
10
  export { applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
@@ -1,8 +1,8 @@
1
- import { n as ident } from "./codegen-DfCJFqO-.js";
1
+ import { n as ident } from "./codegen-D-Cjx_kh.js";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import picomatch from "picomatch";
5
- //#region src/config/build.ts
5
+ // src/config/build.ts
6
6
  const SupportedFormats = {
7
7
  doc: ["mdx", "md"],
8
8
  meta: ["json", "yaml"]
@@ -78,8 +78,7 @@ function buildConfig(config, cwd) {
78
78
  }))
79
79
  };
80
80
  }
81
- //#endregion
82
- //#region src/utils/validation.ts
81
+ // src/utils/validation.ts
83
82
  var ValidationError = class extends Error {
84
83
  constructor(message, issues) {
85
84
  super(`${message}:\n${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n")}`);
@@ -101,8 +100,7 @@ async function validate(schema, data, context, errorMessage) {
101
100
  }
102
101
  return data;
103
102
  }
104
- //#endregion
105
- //#region src/core.ts
103
+ // src/core.ts
106
104
  async function getPlugins(pluginOptions) {
107
105
  const plugins = [];
108
106
  for await (const option of pluginOptions) {
@@ -314,5 +312,4 @@ function postprocessPlugin() {
314
312
  return lines.join("\n");
315
313
  } } };
316
314
  }
317
- //#endregion
318
315
  export { buildConfig as i, ValidationError as n, buildCollection as r, createCore as t };
@@ -1,17 +1,16 @@
1
- import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
2
- import { Pluggable, Transformer } from "unified";
3
- import * as Plugins from "fumadocs-core/mdx-plugins";
4
- import { LLMsOptions, StructuredData } from "fumadocs-core/mdx-plugins";
5
- import { VFile } from "vfile";
6
1
  import { FC } from "react";
2
+ import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
7
3
  import { ProcessorOptions } from "@mdx-js/mdx";
4
+ import { VFile } from "vfile";
8
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
+ import { Pluggable } from "unified";
7
+ import * as Plugins from "fumadocs-core/mdx-plugins";
8
+ import { LLMsOptions, StructuredData } from "fumadocs-core/mdx-plugins";
9
9
  import { Root } from "mdast";
10
10
  import { SatteriPresetOptions, SatteriPresetOptions as SatteriPresetOptions$1 } from "@fumadocs/satteri/preset";
11
11
  import { TOCItemType } from "fumadocs-core/toc";
12
12
  import { MDXProps } from "mdx/types";
13
13
  import { FSWatcher } from "chokidar";
14
- //#region src/config/preset.d.ts
15
14
  type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
16
15
  type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
17
16
  rehypePlugins?: ResolvePlugins;
@@ -36,8 +35,6 @@ type MDXPresetOptions = ({
36
35
  * apply MDX processor presets
37
36
  */
38
37
  declare function applyMdxPreset(options?: MDXPresetOptions): (environment: BuildEnvironment) => Promise<ProcessorOptions>;
39
- //#endregion
40
- //#region src/loaders/mdx/remark-postprocess.d.ts
41
38
  interface ExtractedReference {
42
39
  href: string;
43
40
  }
@@ -62,16 +59,12 @@ interface PostprocessOptions {
62
59
  removePosition?: boolean;
63
60
  };
64
61
  }
65
- //#endregion
66
- //#region src/loaders/mdx/last-modified.d.ts
67
62
  /**
68
63
  * Obtain the last modified time of a file.
69
64
  *
70
65
  * @returns `null`/`undefined` when unknown (e.g. the file isn't committed).
71
66
  */
72
67
  type LastModifiedFn = (filePath: string) => Promise<Date | null | undefined>;
73
- //#endregion
74
- //#region src/loaders/mdx/build.d.ts
75
68
  interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
76
69
  frontmatter: Frontmatter;
77
70
  structuredData: StructuredData;
@@ -89,8 +82,6 @@ interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
89
82
  */
90
83
  _mdast?: string;
91
84
  }
92
- //#endregion
93
- //#region src/loaders/mdx/build-satteri.d.ts
94
85
  declare module 'satteri' {
95
86
  interface DataMap {
96
87
  extractedReferences?: {
@@ -99,8 +90,6 @@ declare module 'satteri' {
99
90
  }
100
91
  }
101
92
  type SatteriOptionsInput = SatteriPresetOptions | ((environment: BuildEnvironment) => SatteriPresetOptions | Promise<SatteriPresetOptions>) | undefined;
102
- //#endregion
103
- //#region src/config/define.d.ts
104
93
  type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
105
94
  type AnyCollection = DocsCollection | DocCollection | MetaCollection;
106
95
  interface BaseCollection {
@@ -188,8 +177,6 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof pageSche
188
177
  meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
189
178
  }): DocsCollection<DocSchema, MetaSchema>;
190
179
  declare function defineConfig(config?: GlobalConfig): GlobalConfig;
191
- //#endregion
192
- //#region src/config/build.d.ts
193
180
  type BuildEnvironment = 'bundler' | 'runtime';
194
181
  interface LoadedConfig {
195
182
  collections: Map<string, CollectionItem>;
@@ -217,8 +204,6 @@ interface DocsCollectionItem extends Omit<DocsCollection, 'dir' | 'meta' | 'docs
217
204
  meta: MetaCollectionItem;
218
205
  docs: DocCollectionItem;
219
206
  }
220
- //#endregion
221
- //#region src/plugins/index-file.d.ts
222
207
  interface IndexFilePluginOptions {
223
208
  target?: 'default' | 'vite';
224
209
  /**
@@ -242,8 +227,6 @@ interface IndexFilePlugin {
242
227
  };
243
228
  }
244
229
  declare function indexFile(options?: IndexFilePluginOptions): Plugin;
245
- //#endregion
246
- //#region src/macro/eval.d.ts
247
230
  interface MacroEvaluatorOptions {
248
231
  /**
249
232
  * absolute path of the entry module
@@ -307,8 +290,6 @@ declare class MacroCollector {
307
290
  private stamp;
308
291
  private evaluate;
309
292
  }
310
- //#endregion
311
- //#region src/core.d.ts
312
293
  type Awaitable<T> = T | Promise<T>;
313
294
  interface EmitEntry {
314
295
  /**
@@ -493,5 +474,4 @@ declare function createCore(options: CoreOptions): {
493
474
  transformVFile(options: TransformOptions<DocCollectionItem>, file: VFile): Promise<VFile>;
494
475
  };
495
476
  type Core = ReturnType<typeof createCore>;
496
- //#endregion
497
477
  export { SatteriOptionsInput as A, DocsCollection as C, defineCollections as D, SatteriPresetOptions$1 as E, DefaultMDXOptions as F, MDXPresetOptions as I, applyMdxPreset as L, LastModifiedFn as M, ExtractedReference as N, defineConfig as O, PostprocessOptions as P, DocCollectionSatteri as S, MetaCollection as T, BaseCollection as _, EmitOptions as a, DocCollectionBase as b, PluginContext as c, TransformOptions as d, IndexFilePlugin as f, AnyCollection as g, BuildEnvironment as h, EmitEntry as i, CompiledMDXProperties as j, defineDocs as k, PluginOption as l, indexFile as m, Core as n, EmitOutput as o, IndexFilePluginOptions as p, CoreOptions as r, Plugin as s, CompilationContext as t, ServerContext as u, CollectionSchema as v, GlobalConfig as w, DocCollectionMdx as x, DocCollection as y };
@@ -1,5 +1,5 @@
1
1
  import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
2
- //#region src/config/define.ts
2
+ // src/config/define.ts
3
3
  function defineCollections(options) {
4
4
  return options;
5
5
  }
@@ -25,5 +25,4 @@ function defineDocs(options) {
25
25
  function defineConfig(config = {}) {
26
26
  return config;
27
27
  }
28
- //#endregion
29
28
  export { defineConfig as n, defineDocs as r, defineCollections as t };
@@ -2,7 +2,7 @@ import fsSync from "node:fs";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { createRequire } from "node:module";
5
- //#region ../vite/dist/index.js
5
+ // ../vite/dist/index.js
6
6
  let pnp;
7
7
  if (process.versions.pnp) try {
8
8
  pnp = createRequire(import.meta.url)("pnpapi");
@@ -209,5 +209,4 @@ async function getInstallKey(root) {
209
209
  if (path.dirname(dir) === dir) return;
210
210
  }
211
211
  }
212
- //#endregion
213
212
  export { getConfig };
@@ -1,13 +1,13 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { r as buildCollection } from "./core-DV3f7rXs.js";
3
- import { r as slash } from "./codegen-DfCJFqO-.js";
4
- import { r as defineDocs } from "./define-BW5lveuc.js";
5
- import { n as transformMacroConfigModule, t as parseMacroId } from "./transform-CpwlddS0.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
+ import { r as buildCollection } from "./core-B3ysiPKS.js";
3
+ import { r as slash } from "./codegen-D-Cjx_kh.js";
4
+ import { r as defineDocs } from "./define-C2jwQBlt.js";
5
+ import { n as transformMacroConfigModule, t as parseMacroId } from "./transform-CVIZq8Al.js";
6
6
  import fs from "node:fs/promises";
7
7
  import path from "node:path";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { pathToFileURL } from "node:url";
10
- //#region src/macro/eval.ts
10
+ // src/macro/eval.ts
11
11
  var eval_exports = /* @__PURE__ */ __exportAll({
12
12
  MacroCollector: () => MacroCollector,
13
13
  createNodeEvaluator: () => createNodeEvaluator
@@ -172,5 +172,4 @@ var MacroCollector = class {
172
172
  };
173
173
  }
174
174
  };
175
- //#endregion
176
175
  export { createNodeEvaluator as n, eval_exports as r, MacroCollector as t };
@@ -1,5 +1,4 @@
1
- import "./core-6H7qqwEM.js";
2
- //#region src/webpack/index.d.ts
1
+ import "./core-CdciznjV.js";
3
2
  interface WebpackLoaderOptions {
4
3
  type: 'webpack' | 'turbopack';
5
4
  /** absolute path */
@@ -14,5 +13,4 @@ interface WebpackLoaderOptions {
14
13
  */
15
14
  macro?: boolean;
16
15
  }
17
- //#endregion
18
16
  export { WebpackLoaderOptions as t };
@@ -1,10 +1,10 @@
1
- import { n as ident, r as slash, t as createCodegen } from "./codegen-DfCJFqO-.js";
1
+ import { n as ident, r as slash, t as createCodegen } from "./codegen-D-Cjx_kh.js";
2
2
  import { frontmatter } from "fumadocs-core/content/md/frontmatter";
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { createHash } from "node:crypto";
6
6
  import { glob } from "tinyglobby";
7
- //#region src/utils/fs-cache.ts
7
+ // src/utils/fs-cache.ts
8
8
  const map = /* @__PURE__ */ new Map();
9
9
  function createFSCache() {
10
10
  return {
@@ -28,8 +28,7 @@ function toFullPath(file) {
28
28
  if (path.isAbsolute(file)) return path.relative(process.cwd(), file);
29
29
  return file;
30
30
  }
31
- //#endregion
32
- //#region src/plugins/index-file.ts
31
+ // src/plugins/index-file.ts
33
32
  const indexFileCache = createFSCache();
34
33
  function indexFile(options = {}) {
35
34
  const { target = "default", addJsExtension, browser = true, dynamic = true } = options;
@@ -268,5 +267,4 @@ function generateMetaCollectionGlob({ codegen, workspace }, collection, eager =
268
267
  eager
269
268
  });
270
269
  }
271
- //#endregion
272
270
  export { indexFile as t };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { N as ExtractedReference, a as EmitOptions, c as PluginContext, d as TransformOptions, i as EmitEntry, j as CompiledMDXProperties, l as PluginOption, n as Core, o as EmitOutput, r as CoreOptions, s as Plugin, t as CompilationContext, u as ServerContext } from "./core-6H7qqwEM.js";
1
+ import { N as ExtractedReference, a as EmitOptions, c as PluginContext, d as TransformOptions, i as EmitEntry, j as CompiledMDXProperties, l as PluginOption, n as Core, o as EmitOutput, r as CoreOptions, s as Plugin, t as CompilationContext, u as ServerContext } from "./core-CdciznjV.js";
2
2
  export type { CompilationContext, CompiledMDXProperties, Core, CoreOptions, EmitEntry, EmitOptions, EmitOutput, ExtractedReference, Plugin, PluginContext, PluginOption, ServerContext, TransformOptions };
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { x } from "tinyexec";
3
- //#region src/loaders/mdx/last-modified.ts
3
+ // src/loaders/mdx/last-modified.ts
4
4
  const cache = /* @__PURE__ */ new Map();
5
5
  /**
6
6
  * Resolve the `lastModified` collection option for a document.
@@ -43,5 +43,4 @@ function getGitTimestamps(cwd, dir) {
43
43
  cache.set(dir, promise);
44
44
  return promise;
45
45
  }
46
- //#endregion
47
46
  export { resolveLastModified as t };
@@ -1,8 +1,8 @@
1
- import { i as buildConfig } from "./core-DV3f7rXs.js";
1
+ import { i as buildConfig } from "./core-B3ysiPKS.js";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
- //#region src/config/load-from-file.ts
5
+ // src/config/load-from-file.ts
6
6
  async function compileConfig(core) {
7
7
  const { build } = await import("esbuild");
8
8
  let source;
@@ -53,5 +53,4 @@ async function loadConfig(core, build = false) {
53
53
  fromFile: true
54
54
  };
55
55
  }
56
- //#endregion
57
56
  export { loadConfig as t };
@@ -1,7 +1,6 @@
1
- //#region src/loaders/index.ts
1
+ // src/loaders/index.ts
2
2
  const metaLoaderGlob = /\.(json|yaml)\?.*(collection|macro_id)=/;
3
3
  const metaLoaderFileGlob = /\.(json|yaml)$/;
4
4
  const metaLoaderQueryGlob = /[?&](collection|macro_id)=/;
5
5
  const mdxLoaderGlob = /\.mdx?(\?.+?)?$/;
6
- //#endregion
7
6
  export { metaLoaderQueryGlob as i, metaLoaderFileGlob as n, metaLoaderGlob as r, mdxLoaderGlob as t };
@@ -1,10 +1,9 @@
1
- import { A as SatteriOptionsInput, N as ExtractedReference, P as PostprocessOptions, h as BuildEnvironment, v as CollectionSchema } from "../core-6H7qqwEM.js";
1
+ import { A as SatteriOptionsInput, N as ExtractedReference, P as PostprocessOptions, h as BuildEnvironment, v as CollectionSchema } from "../core-CdciznjV.js";
2
2
  import { MacroAsyncDocCollection, MacroAsyncDocsCollection, MacroDocCollection, MacroDocsCollection, MacroMetaCollection } from "../runtime/macro.js";
3
3
  import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
4
4
  import { MetaData, PageData } from "fumadocs-core/source";
5
5
  import { ProcessorOptions } from "@mdx-js/mdx";
6
6
  import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
7
- //#region src/macro/index.d.ts
8
7
  export interface MacroSchemaContext {
9
8
  path: string;
10
9
  source: string;
@@ -120,5 +119,4 @@ export declare function defineCollections<DocSchema extends StandardSchemaV1 = S
120
119
  async: Async;
121
120
  lastModified: LastModified;
122
121
  }>>;
123
- //#endregion
124
122
  export type { ExtractedReference };
@@ -1,4 +1,4 @@
1
- //#region src/macro/index.ts
1
+ // src/macro/index.ts
2
2
  function macroError() {
3
3
  return /* @__PURE__ */ new Error("[MDX] this macro was not compiled by the bundler plugin of `fumadocs-mdx`. To use `fumadocs-mdx/macro`, set the `include` option on your bundler plugin, and make sure this module matches its patterns.");
4
4
  }
@@ -18,5 +18,4 @@ function defineDocs(options) {
18
18
  function defineCollections() {
19
19
  throw macroError();
20
20
  }
21
- //#endregion
22
21
  export { defineCollections, defineDocs };