fumadocs-mdx 15.0.13 → 15.1.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 (40) hide show
  1. package/dist/{adapter-CUkbjVed.js → adapter-DPEpBHhE.js} +2 -2
  2. package/dist/build-BnKCFeb6.js +13 -0
  3. package/dist/{build-mdx-B5ntJ10C.js → build-default-DCQTM_P7.js} +31 -8
  4. package/dist/build-satteri-Mk7OLtzu.js +91 -0
  5. package/dist/bun/index.d.ts +1 -1
  6. package/dist/bun/index.js +3 -3
  7. package/dist/config/index.d.ts +2 -2
  8. package/dist/config/index.js +8 -3
  9. package/dist/{core-Blh9aCh7.d.ts → core-Bx6PBf26.d.ts} +78 -37
  10. package/dist/{core-C5neSoHN.js → core-Cq6V99iz.js} +1 -18
  11. package/dist/{dist-Bw6UIEZC.js → dist-CE1l7WuI.js} +1 -3
  12. package/dist/index.d.ts +1 -2
  13. package/dist/{load-from-file-Du50S5f9.js → load-from-file-CVTAyohB.js} +1 -1
  14. package/dist/{mdx-VyLPp3lL.js → mdx-wSuDwc6c.js} +2 -2
  15. package/dist/next/index.d.ts +1 -1
  16. package/dist/next/index.js +2 -2
  17. package/dist/node/_loader.js +3 -3
  18. package/dist/node/index.d.ts +1 -1
  19. package/dist/node/loader.js +3 -3
  20. package/dist/plugins/index-file.d.ts +1 -1
  21. package/dist/plugins/json-schema.d.ts +1 -1
  22. package/dist/plugins/last-modified.d.ts +1 -1
  23. package/dist/plugins/last-modified.js +24 -10
  24. package/dist/{remark-include-DJN_j9Y9.js → remark-include-B6rmf4sh.js} +59 -1
  25. package/dist/rolldown/index.js +3 -3
  26. package/dist/runtime/browser.d.ts +2 -3
  27. package/dist/runtime/dynamic.d.ts +2 -2
  28. package/dist/runtime/dynamic.js +4 -5
  29. package/dist/runtime/server.d.ts +1 -1
  30. package/dist/runtime/server.js +3 -2
  31. package/dist/runtime/types.d.ts +1 -1
  32. package/dist/{types-CCb8V6-O.d.ts → types-Bi-SAQUY.d.ts} +1 -1
  33. package/dist/vite/index.d.ts +1 -1
  34. package/dist/vite/index.js +5 -5
  35. package/dist/webpack/mdx.js +3 -3
  36. package/dist/webpack/meta.js +2 -2
  37. package/dist/{webpack-C5OhQxDb.js → webpack-BZVbRnxp.js} +1 -1
  38. package/package.json +22 -11
  39. package/dist/build-mdx-1yRXUhuv.d.ts +0 -52
  40. package/dist/preset-NZprPlqc.js +0 -59
@@ -1,5 +1,5 @@
1
- import { r as ValidationError } from "./core-C5neSoHN.js";
2
- import { t as loadConfig } from "./load-from-file-Du50S5f9.js";
1
+ import { r as ValidationError } from "./core-Cq6V99iz.js";
2
+ import { t as loadConfig } from "./load-from-file-CVTAyohB.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  import fs from "node:fs/promises";
5
5
  import { fileURLToPath } from "node:url";
@@ -0,0 +1,13 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
+ //#region src/loaders/mdx/build.ts
3
+ var build_exports = /* @__PURE__ */ __exportAll({ buildMDX: () => buildMDX });
4
+ async function buildMDX(core, collection, options) {
5
+ if ((collection ? collection.compiler : core.getConfig().global.compiler) === "satteri") {
6
+ const { buildSatteriMDX } = await import("./build-satteri-Mk7OLtzu.js");
7
+ return buildSatteriMDX(core, collection, options);
8
+ }
9
+ const { buildJSMDX } = await import("./build-default-DCQTM_P7.js");
10
+ return buildJSMDX(core, collection, options);
11
+ }
12
+ //#endregion
13
+ export { build_exports as n, buildMDX as t };
@@ -1,5 +1,4 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { n as flattenNode, t as remarkInclude } from "./remark-include-DJN_j9Y9.js";
1
+ import { n as flattenNode, r as applyMdxPreset, t as remarkInclude } from "./remark-include-B6rmf4sh.js";
3
2
  import { visit } from "unist-util-visit";
4
3
  import { VFile } from "vfile";
5
4
  import { createProcessor } from "@mdx-js/mdx";
@@ -86,10 +85,9 @@ function getMdastExport(name, value) {
86
85
  };
87
86
  }
88
87
  //#endregion
89
- //#region src/loaders/mdx/build-mdx.ts
90
- var build_mdx_exports = /* @__PURE__ */ __exportAll({ buildMDX: () => buildMDX });
91
- async function buildMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
92
- const mdxOptions = await core.getConfig().getMDXOptions(collection, environment);
88
+ //#region src/loaders/mdx/build-default.ts
89
+ async function buildJSMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
90
+ const mdxOptions = await getMDXOptions(core.getConfig(), collection, environment);
93
91
  function getProcessor(format) {
94
92
  const cache = core.cache;
95
93
  const key = `build-mdx:${collection?.name ?? "global"}:${format}`;
@@ -129,7 +127,32 @@ async function buildMDX(core, collection, { filePath, frontmatter, source, _comp
129
127
  filePath,
130
128
  source
131
129
  }, vfile);
132
- return getProcessor(filePath.endsWith(".mdx") ? "mdx" : "md").process(vfile);
130
+ const out = await getProcessor(filePath.endsWith(".mdx") ? "mdx" : "md").process(vfile);
131
+ return {
132
+ code: String(out.value),
133
+ map: out.map
134
+ };
135
+ }
136
+ const mdxOptionsCache = /* @__PURE__ */ new WeakMap();
137
+ function getMDXOptions(config, collection, environment = "bundler") {
138
+ let cacheMap = mdxOptionsCache.get(config);
139
+ if (!cacheMap) {
140
+ cacheMap = /* @__PURE__ */ new Map();
141
+ mdxOptionsCache.set(config, cacheMap);
142
+ }
143
+ const key = collection ? `${environment}:${collection.name}` : environment;
144
+ const cached = cacheMap.get(key);
145
+ if (cached) return cached;
146
+ let result;
147
+ if (collection?.mdxOptions) {
148
+ const optionsFn = collection.mdxOptions;
149
+ result = typeof optionsFn === "function" ? optionsFn(environment) : optionsFn;
150
+ } else result = (async () => {
151
+ const optionsFn = config.global.mdxOptions;
152
+ return applyMdxPreset(typeof optionsFn === "function" ? await optionsFn() : optionsFn)(environment);
153
+ })();
154
+ cacheMap.set(key, result);
155
+ return result;
133
156
  }
134
157
  //#endregion
135
- export { build_mdx_exports as n, buildMDX as t };
158
+ export { buildJSMDX };
@@ -0,0 +1,91 @@
1
+ import { pathToFileURL } from "node:url";
2
+ //#region src/loaders/mdx/build-satteri.ts
3
+ async function buildSatteriMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
4
+ const satteriOptions = await getSatteriOptions(core.getConfig(), collection, environment);
5
+ const postprocess = {
6
+ _format: filePath.endsWith(".mdx") ? "mdx" : "md",
7
+ ...collection?.postprocess
8
+ };
9
+ const [{ compileMdx }, { remarkLlms }, { remarkInclude }] = await Promise.all([
10
+ import(
11
+ /* turbopackOptional: true */
12
+ "@fumadocs/satteri/compile"
13
+ ),
14
+ import(
15
+ /* turbopackOptional: true */
16
+ "@fumadocs/satteri/remark-llms"
17
+ ),
18
+ import(
19
+ /* turbopackOptional: true */
20
+ "@fumadocs/satteri/remark-include"
21
+ )
22
+ ]);
23
+ const data = {
24
+ frontmatter,
25
+ _compiler,
26
+ _cwd: collection?.cwd,
27
+ _valueToExport: collection?.postprocess?.valueToExport
28
+ };
29
+ const mdastPlugins = [remarkInclude({ cwd: collection?.cwd })];
30
+ if (satteriOptions.mdastPlugins) mdastPlugins.push(...satteriOptions.mdastPlugins);
31
+ if (postprocess.includeProcessedMarkdown) mdastPlugins.push(remarkLlms(typeof postprocess.includeProcessedMarkdown === "object" ? postprocess.includeProcessedMarkdown : void 0));
32
+ mdastPlugins.push(postprocessPlugin(postprocess));
33
+ return { code: (await compileMdx({
34
+ source,
35
+ filePath,
36
+ frontmatter,
37
+ isDevelopment,
38
+ environment,
39
+ options: {
40
+ ...satteriOptions,
41
+ fileURL: pathToFileURL(filePath),
42
+ data,
43
+ mdastPlugins
44
+ }
45
+ })).code };
46
+ }
47
+ function postprocessPlugin({ extractLinkReferences = false }) {
48
+ return {
49
+ name: "remark-postprocess",
50
+ heading(node, ctx) {
51
+ const frontmatter = ctx.data.frontmatter ??= {};
52
+ if (!frontmatter.title && node.depth === 1) frontmatter.title = ctx.textContent(node);
53
+ },
54
+ link(node, ctx) {
55
+ if (extractLinkReferences) (ctx.data.extractedReferences ??= []).push({ href: node.url });
56
+ },
57
+ afterToJs({ result }) {
58
+ if (extractLinkReferences) {
59
+ result.data.extractedReferences ??= [];
60
+ result.code += `\nexport const extractedReferences = ${JSON.stringify(result.data.extractedReferences)};`;
61
+ }
62
+ }
63
+ };
64
+ }
65
+ const satteriOptionsCache = /* @__PURE__ */ new WeakMap();
66
+ async function resolvePresetOptions(input, environment) {
67
+ const options = typeof input === "function" ? await input(environment) : input;
68
+ const { applySatteriPreset } = await import(
69
+ /* turbopackOptional: true */
70
+ "@fumadocs/satteri/preset"
71
+ );
72
+ return applySatteriPreset(options)(environment);
73
+ }
74
+ function getSatteriOptions(config, collection, environment = "bundler") {
75
+ let cache = satteriOptionsCache.get(config);
76
+ if (!cache) {
77
+ cache = /* @__PURE__ */ new Map();
78
+ satteriOptionsCache.set(config, cache);
79
+ }
80
+ const key = collection ? `${environment}:${collection.name}` : environment;
81
+ const cached = cache.get(key);
82
+ if (cached) return cached;
83
+ let result;
84
+ if (collection?.compiler === "satteri") result = resolvePresetOptions(collection.satteriOptions ?? config.global.satteriOptions, environment);
85
+ else if (collection) throw new Error(`Collection "${collection.name}" uses the default MDX compiler. Use getMDXOptions() instead of getSatteriOptions().`);
86
+ else result = resolvePresetOptions(config.global.satteriOptions, environment);
87
+ cache.set(key, result);
88
+ return result;
89
+ }
90
+ //#endregion
91
+ export { buildSatteriMDX };
@@ -1,4 +1,4 @@
1
- import { r as CoreOptions } from "../core-Blh9aCh7.js";
1
+ import { r as CoreOptions } from "../core-Bx6PBf26.js";
2
2
  import { BunPlugin } from "bun";
3
3
 
4
4
  //#region src/bun/index.d.ts
package/dist/bun/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-VyLPp3lL.js";
2
- import { i as buildConfig, n as createCore, t as _Defaults } from "../core-C5neSoHN.js";
3
- import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-CUkbjVed.js";
1
+ import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
2
+ import { i as buildConfig, n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
3
+ import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-DPEpBHhE.js";
4
4
  import { t as createMetaLoader } from "../meta-UmuO8lue.js";
5
5
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
6
6
  import { pathToFileURL } from "node:url";
@@ -1,2 +1,2 @@
1
- import { A as DocCollection, B as MDXPresetOptions, D as AnyCollection, E as remarkInclude, F as defineConfig, I as defineDocs, M as GlobalConfig, N as MetaCollection, O as BaseCollection, P as defineCollections, R as PostprocessOptions, T as metaSchema, V as applyMdxPreset, j as DocsCollection, k as CollectionSchema, w as frontmatterSchema, z as DefaultMDXOptions } from "../core-Blh9aCh7.js";
2
- export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, type PostprocessOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
1
+ import { A as DocCollection, B as defineCollections, D as AnyCollection, E as remarkInclude, F as DocsCollection, H as defineDocs, I as GlobalConfig, J as DefaultMDXOptions, L as MetaCollection, M as DocCollectionMdx, N as DocCollectionSatteri, O as BaseCollection, P as DocCollectionSatteriTyped, R as SatteriGlobalConfig, T as metaSchema, U as defineSatteriCollections, V as defineConfig, W as defineSatteriConfig, X as applyMdxPreset, Y as MDXPresetOptions, j as DocCollectionBase, k as CollectionSchema, q as PostprocessOptions, w as frontmatterSchema, z as SatteriPresetOptions } from "../core-Bx6PBf26.js";
2
+ export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocCollectionBase, DocCollectionMdx, DocCollectionSatteri, DocCollectionSatteriTyped, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, type PostprocessOptions, SatteriGlobalConfig, type SatteriPresetOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, defineSatteriCollections, defineSatteriConfig, frontmatterSchema, metaSchema, remarkInclude };
@@ -1,5 +1,4 @@
1
- import { t as applyMdxPreset } from "../preset-NZprPlqc.js";
2
- import { t as remarkInclude } from "../remark-include-DJN_j9Y9.js";
1
+ import { r as applyMdxPreset, t as remarkInclude } from "../remark-include-B6rmf4sh.js";
3
2
  import { metaSchema as metaSchema$1, pageSchema } from "fumadocs-core/source/schema";
4
3
  //#region src/config/define.ts
5
4
  function defineCollections(options) {
@@ -27,6 +26,12 @@ function defineDocs(options) {
27
26
  function defineConfig(config = {}) {
28
27
  return config;
29
28
  }
29
+ function defineSatteriConfig(config = {}) {
30
+ return config;
31
+ }
32
+ function defineSatteriCollections(options) {
33
+ return options;
34
+ }
30
35
  //#endregion
31
36
  //#region src/config/index.ts
32
37
  /** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */
@@ -34,4 +39,4 @@ const frontmatterSchema = pageSchema;
34
39
  /** @deprecated import from `fumadocs-core/source/schema` instead (since 16.2.3) */
35
40
  const metaSchema = metaSchema$1;
36
41
  //#endregion
37
- export { applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
42
+ export { applyMdxPreset, defineCollections, defineConfig, defineDocs, defineSatteriCollections, defineSatteriConfig, frontmatterSchema, metaSchema, remarkInclude };
@@ -1,12 +1,16 @@
1
- import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-CCb8V6-O.js";
1
+ import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-Bi-SAQUY.js";
2
2
  import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
3
3
  import { Pluggable, Processor, Transformer } from "unified";
4
4
  import * as Plugins from "fumadocs-core/mdx-plugins";
5
- import { LLMsOptions } from "fumadocs-core/mdx-plugins";
5
+ import { LLMsOptions, StructuredData } from "fumadocs-core/mdx-plugins";
6
6
  import { VFile } from "vfile";
7
+ import { FC } from "react";
7
8
  import { ProcessorOptions } from "@mdx-js/mdx";
8
9
  import { StandardSchemaV1 } from "@standard-schema/spec";
9
10
  import { Root } from "mdast";
11
+ import { SatteriPresetOptions, SatteriPresetOptions as SatteriPresetOptions$1 } from "@fumadocs/satteri/preset";
12
+ import { TOCItemType } from "fumadocs-core/toc";
13
+ import { MDXProps } from "mdx/types";
10
14
  import { FSWatcher } from "chokidar";
11
15
  import { MetaData, PageData, Source } from "fumadocs-core/source";
12
16
  import { StructuredData as StructuredData$1 } from "fumadocs-core/mdx-plugins/remark-structure";
@@ -63,19 +67,37 @@ interface PostprocessOptions {
63
67
  };
64
68
  }
65
69
  //#endregion
70
+ //#region src/loaders/mdx/build.d.ts
71
+ interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
72
+ frontmatter: Frontmatter;
73
+ structuredData: StructuredData;
74
+ toc: TOCItemType[];
75
+ default: FC<MDXProps>;
76
+ /**
77
+ * Enable from `postprocess` option.
78
+ */
79
+ _markdown?: string;
80
+ /**
81
+ * Enable from `postprocess` option.
82
+ */
83
+ _mdast?: string;
84
+ }
85
+ //#endregion
86
+ //#region src/loaders/mdx/build-satteri.d.ts
87
+ declare module 'satteri' {
88
+ interface DataMap {
89
+ extractedReferences?: {
90
+ href: string;
91
+ }[];
92
+ }
93
+ }
94
+ type SatteriOptionsInput = SatteriPresetOptions | ((environment: BuildEnvironment) => SatteriPresetOptions | Promise<SatteriPresetOptions>) | undefined;
95
+ //#endregion
66
96
  //#region src/config/define.d.ts
67
97
  type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
68
98
  type AnyCollection = DocsCollection | DocCollection | MetaCollection;
69
99
  interface BaseCollection {
70
- /**
71
- * Directory to scan
72
- */
73
100
  dir: string;
74
- /**
75
- * what files to include/exclude (glob patterns)
76
- *
77
- * Include all files if not specified
78
- */
79
101
  files?: string[];
80
102
  }
81
103
  interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
@@ -85,28 +107,34 @@ interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> ext
85
107
  source: string;
86
108
  }>;
87
109
  }
88
- interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
89
- type: 'doc';
110
+ interface DocCollectionBase<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
90
111
  postprocess?: Partial<PostprocessOptions>;
91
- /**
92
- * By defining a collection-level MDX options, **the default options & plugins will be removed**.
93
- *
94
- * See [`mdxOptions`](https://fumadocs.dev/docs/mdx/collections#mdxoptions) for details.
95
- */
96
- mdxOptions?: ProcessorOptions | ((environment: BuildEnvironment) => Promise<ProcessorOptions>);
97
- /**
98
- * Load files with async
99
- */
100
112
  async?: boolean;
101
- /**
102
- * Compile files on-demand
103
- */
104
113
  dynamic?: boolean;
105
114
  schema?: CollectionSchema<Schema, {
106
115
  path: string;
107
116
  source: string;
108
117
  }>;
109
118
  }
119
+ interface DocCollectionMdx<Schema extends StandardSchemaV1 = StandardSchemaV1> extends DocCollectionBase<Schema> {
120
+ type: 'doc';
121
+ compiler?: 'mdx';
122
+ /**
123
+ * By defining a collection-level MDX options, **the default options & plugins will be removed**.
124
+ */
125
+ mdxOptions?: ProcessorOptions | ((environment: BuildEnvironment) => Promise<ProcessorOptions>);
126
+ satteriOptions?: never;
127
+ }
128
+ interface DocCollectionSatteri<Schema extends StandardSchemaV1 = StandardSchemaV1> extends DocCollectionBase<Schema> {
129
+ type: 'doc';
130
+ compiler: 'satteri';
131
+ /**
132
+ * Sätteri compile options. When omitted, the global `satteriOptions` preset is used.
133
+ */
134
+ satteriOptions?: SatteriOptionsInput;
135
+ mdxOptions?: never;
136
+ }
137
+ type DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> = DocCollectionMdx<Schema> | DocCollectionSatteri<Schema>;
110
138
  interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1> {
111
139
  type: 'docs';
112
140
  dir: string;
@@ -116,40 +144,53 @@ interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1,
116
144
  interface GlobalConfig {
117
145
  plugins?: PluginOption[];
118
146
  /**
119
- * Configure global MDX options, will be used by all `doc` collections unless collection-level `mdxOptions` is specified.
147
+ * The compiler for files compiled without a collection (e.g. `page.mdx` routes).
148
+ *
149
+ * Collections choose their own compiler via the collection-level `compiler` option.
150
+ *
151
+ * @defaultValue 'mdx'
152
+ */
153
+ compiler?: 'mdx' | 'satteri';
154
+ /**
155
+ * Configure global MDX options, used by `doc` collections with the default MDX compiler.
120
156
  */
121
157
  mdxOptions?: MDXPresetOptions | (() => Promise<MDXPresetOptions>);
158
+ /**
159
+ * Configure global Sätteri options, used by `doc` collections with `compiler: "satteri"`.
160
+ */
161
+ satteriOptions?: SatteriOptionsInput;
122
162
  workspaces?: Record<string, {
123
163
  dir: string;
124
164
  config: Record<string, unknown>;
125
165
  }>;
126
- /**
127
- * specify a directory to access & store cache (disabled during development mode).
128
- *
129
- * The cache will never be updated, delete the cache folder to clean.
130
- */
131
166
  experimentalBuildCache?: string;
132
167
  }
168
+ type SatteriOptionsFactory = (environment: BuildEnvironment) => SatteriPresetOptions$1 | Promise<SatteriPresetOptions$1>;
169
+ interface DocCollectionSatteriTyped<Schema extends StandardSchemaV1 = StandardSchemaV1> extends DocCollectionBase<Schema> {
170
+ type: 'doc';
171
+ compiler: 'satteri';
172
+ satteriOptions?: SatteriPresetOptions$1 | SatteriOptionsFactory;
173
+ mdxOptions?: never;
174
+ }
175
+ interface SatteriGlobalConfig extends Omit<GlobalConfig, 'satteriOptions'> {
176
+ satteriOptions?: SatteriPresetOptions$1 | SatteriOptionsFactory;
177
+ }
133
178
  declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: DocCollection<Schema>): DocCollection<Schema>;
134
179
  declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
135
180
  declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof pageSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema>(options: {
136
- /**
137
- * The content directory to scan files
138
- *
139
- * @defaultValue 'content/docs'
140
- */
141
181
  dir?: string;
142
182
  docs?: Omit<DocCollection<DocSchema>, 'dir' | 'type'>;
143
183
  meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
144
184
  }): DocsCollection<DocSchema, MetaSchema>;
145
185
  declare function defineConfig(config?: GlobalConfig): GlobalConfig;
186
+ declare function defineSatteriConfig(config?: SatteriGlobalConfig): SatteriGlobalConfig;
187
+ declare function defineSatteriCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: DocCollectionSatteriTyped<Schema>): DocCollectionSatteriTyped<Schema>;
146
188
  //#endregion
147
189
  //#region src/config/build.d.ts
148
190
  type BuildEnvironment = 'bundler' | 'runtime';
149
191
  interface LoadedConfig {
150
192
  collections: Map<string, CollectionItem>;
151
193
  global: GlobalConfig;
152
- getMDXOptions(collection?: DocCollectionItem, environment?: BuildEnvironment): ProcessorOptions | Promise<ProcessorOptions>;
153
194
  workspaces: Record<string, {
154
195
  dir: string;
155
196
  config: LoadedConfig;
@@ -389,4 +430,4 @@ declare function createCore(options: CoreOptions): {
389
430
  };
390
431
  type Core = ReturnType<typeof createCore>;
391
432
  //#endregion
392
- export { DocCollection as A, MDXPresetOptions as B, toFumadocsSource as C, AnyCollection as D, remarkInclude as E, defineConfig as F, defineDocs as I, ExtractedReference as L, GlobalConfig as M, MetaCollection as N, BaseCollection as O, defineCollections as P, PostprocessOptions as R, server as S, metaSchema$1 as T, applyMdxPreset as V, DocCollectionEntry as _, EmitOptions as a, ServerCreate as b, PluginContext as c, TransformOptions as d, IndexFilePlugin as f, AsyncDocsCollectionEntry as g, AsyncDocCollectionEntry as h, EmitEntry as i, DocsCollection as j, CollectionSchema 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, DocsCollectionEntry as v, frontmatterSchema as w, ServerOptions as x, MetaCollectionEntry as y, DefaultMDXOptions as z };
433
+ export { DocCollection as A, defineCollections as B, toFumadocsSource as C, AnyCollection as D, remarkInclude as E, DocsCollection as F, CompiledMDXProperties as G, defineDocs as H, GlobalConfig as I, DefaultMDXOptions as J, ExtractedReference as K, MetaCollection as L, DocCollectionMdx as M, DocCollectionSatteri as N, BaseCollection as O, DocCollectionSatteriTyped as P, SatteriGlobalConfig as R, server as S, metaSchema$1 as T, defineSatteriCollections as U, defineConfig as V, defineSatteriConfig as W, applyMdxPreset as X, MDXPresetOptions as Y, DocCollectionEntry as _, EmitOptions as a, ServerCreate as b, PluginContext as c, TransformOptions as d, IndexFilePlugin as f, AsyncDocsCollectionEntry as g, AsyncDocCollectionEntry as h, EmitEntry as i, DocCollectionBase as j, CollectionSchema as k, PluginOption as l, indexFile as m, Core as n, EmitOutput as o, IndexFilePluginOptions as p, PostprocessOptions as q, CoreOptions as r, Plugin as s, CompilationContext as t, ServerContext as u, DocsCollectionEntry as v, frontmatterSchema as w, ServerOptions as x, MetaCollectionEntry as y, SatteriPresetOptions$1 as z };
@@ -1,4 +1,3 @@
1
- import { t as applyMdxPreset } from "./preset-NZprPlqc.js";
2
1
  import { n as ident } from "./codegen-ESdi9CDJ.js";
3
2
  import fs from "node:fs/promises";
4
3
  import path from "node:path";
@@ -68,7 +67,6 @@ function buildConfig(config, cwd) {
68
67
  }
69
68
  throw new Error(`Unknown export "${k}", you can only export collections from source configuration file.`);
70
69
  }
71
- const mdxOptionsCache = /* @__PURE__ */ new Map();
72
70
  return {
73
71
  global: loaded,
74
72
  collections,
@@ -77,22 +75,7 @@ function buildConfig(config, cwd) {
77
75
  dir: value.dir,
78
76
  config: buildConfig(value.config, path.resolve(cwd, value.dir))
79
77
  }];
80
- })),
81
- getMDXOptions(collection, environment = "bundler") {
82
- const key = collection ? `${environment}:${collection.name}` : environment;
83
- const cached = mdxOptionsCache.get(key);
84
- if (cached) return cached;
85
- let result;
86
- if (collection?.mdxOptions) {
87
- const optionsFn = collection.mdxOptions;
88
- result = typeof optionsFn === "function" ? optionsFn(environment) : optionsFn;
89
- } else result = (async () => {
90
- const optionsFn = this.global.mdxOptions;
91
- return applyMdxPreset(typeof optionsFn === "function" ? await optionsFn() : optionsFn)(environment);
92
- })();
93
- mdxOptionsCache.set(key, result);
94
- return result;
95
- }
78
+ }))
96
79
  };
97
80
  }
98
81
  //#endregion
@@ -44,13 +44,12 @@ var generated_default = {
44
44
  "fumadocs-mdx > picomatch",
45
45
  "fumadocs-mdx > unified > extend",
46
46
  "fumadocs-twoslash > mdast-util-from-markdown > micromark > debug",
47
- "fumadocs-typescript > hast-util-to-estree > mdast-util-mdx-expression > mdast-util-from-markdown > micromark > debug",
47
+ "fumadocs-typescript > hast-util-to-estree > mdast-util-mdx-jsx > mdast-util-from-markdown > micromark > debug",
48
48
  "fumadocs-typescript > hast-util-to-estree > style-to-js",
49
49
  "fumadocs-typescript > ts-morph",
50
50
  "fumadocs-typescript > unified > extend"
51
51
  ],
52
52
  "exclude": [
53
- "@fumadocs/base-ui",
54
53
  "@fumadocs/basehub",
55
54
  "@fumadocs/local-md",
56
55
  "@fumadocs/mdx-remote",
@@ -65,7 +64,6 @@ var generated_default = {
65
64
  ]
66
65
  },
67
66
  ssr: { "noExternal": [
68
- "@fumadocs/base-ui",
69
67
  "@fumadocs/basehub",
70
68
  "@fumadocs/local-md",
71
69
  "@fumadocs/mdx-remote",
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import { L as ExtractedReference, a as EmitOptions, c as PluginContext, d as TransformOptions, i as EmitEntry, l as PluginOption, n as Core, o as EmitOutput, r as CoreOptions, s as Plugin, t as CompilationContext, u as ServerContext } from "./core-Blh9aCh7.js";
2
- import { t as CompiledMDXProperties } from "./build-mdx-1yRXUhuv.js";
1
+ import { G as CompiledMDXProperties, K as ExtractedReference, a as EmitOptions, c as PluginContext, d as TransformOptions, i as EmitEntry, l as PluginOption, n as Core, o as EmitOutput, r as CoreOptions, s as Plugin, t as CompilationContext, u as ServerContext } from "./core-Bx6PBf26.js";
3
2
  export type { CompilationContext, CompiledMDXProperties, Core, CoreOptions, EmitEntry, EmitOptions, EmitOutput, ExtractedReference, Plugin, PluginContext, PluginOption, ServerContext, TransformOptions };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { i as buildConfig } from "./core-C5neSoHN.js";
2
+ import { i as buildConfig } from "./core-Cq6V99iz.js";
3
3
  import { pathToFileURL } from "node:url";
4
4
  //#region src/config/load-from-file.ts
5
5
  var load_from_file_exports = /* @__PURE__ */ __exportAll({ loadConfig: () => loadConfig });
@@ -55,7 +55,7 @@ function createMdxLoader({ getCore }) {
55
55
  code: `export const frontmatter = ${JSON.stringify(matter.data)}`,
56
56
  map: null
57
57
  };
58
- const { buildMDX } = await import("./build-mdx-B5ntJ10C.js").then((n) => n.n);
58
+ const { buildMDX } = await import("./build-BnKCFeb6.js").then((n) => n.n);
59
59
  const compiled = await buildMDX(core, docCollection, {
60
60
  isDevelopment,
61
61
  source: "\n".repeat(countLines(matter.matter)) + matter.content,
@@ -65,7 +65,7 @@ function createMdxLoader({ getCore }) {
65
65
  environment: "bundler"
66
66
  });
67
67
  const out = {
68
- code: String(compiled.value),
68
+ code: compiled.code,
69
69
  moduleType: "js",
70
70
  map: compiled.map
71
71
  };
@@ -1,4 +1,4 @@
1
- import { p as IndexFilePluginOptions } from "../core-Blh9aCh7.js";
1
+ import { p as IndexFilePluginOptions } from "../core-Bx6PBf26.js";
2
2
  import { NextConfig } from "next";
3
3
 
4
4
  //#region src/next/index.d.ts
@@ -1,5 +1,5 @@
1
- import { n as createCore, t as _Defaults } from "../core-C5neSoHN.js";
2
- import { t as loadConfig } from "../load-from-file-Du50S5f9.js";
1
+ import { n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
2
+ import { t as loadConfig } from "../load-from-file-CVTAyohB.js";
3
3
  import { i as metaLoaderQueryGlob, n as metaLoaderFileGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
4
4
  import { t as indexFile } from "../index-file-C9Bw7He1.js";
5
5
  import * as path$1 from "node:path";
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-VyLPp3lL.js";
2
- import { n as createCore, t as _Defaults } from "../core-C5neSoHN.js";
3
- import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-CUkbjVed.js";
1
+ import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
2
+ import { n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
3
+ import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-DPEpBHhE.js";
4
4
  import { t as createMetaLoader } from "../meta-UmuO8lue.js";
5
5
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
6
6
  //#region src/node/_loader.ts
@@ -1,4 +1,4 @@
1
- import { r as CoreOptions } from "../core-Blh9aCh7.js";
1
+ import { r as CoreOptions } from "../core-Bx6PBf26.js";
2
2
 
3
3
  //#region src/node/index.d.ts
4
4
  interface NodeLoaderOptions extends Partial<CoreOptions> {
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-VyLPp3lL.js";
2
- import { n as createCore, t as _Defaults } from "../core-C5neSoHN.js";
3
- import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-CUkbjVed.js";
1
+ import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
2
+ import { n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
3
+ import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-DPEpBHhE.js";
4
4
  import { t as createMetaLoader } from "../meta-UmuO8lue.js";
5
5
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
6
6
  //#region src/node/loader.ts
@@ -1,2 +1,2 @@
1
- import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-Blh9aCh7.js";
1
+ import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-Bx6PBf26.js";
2
2
  export { IndexFilePlugin, IndexFilePluginOptions, indexFile as default };
@@ -1,4 +1,4 @@
1
- import { s as Plugin } from "../core-Blh9aCh7.js";
1
+ import { s as Plugin } from "../core-Bx6PBf26.js";
2
2
 
3
3
  //#region src/plugins/json-schema.d.ts
4
4
  interface JSONSchemaOptions {
@@ -1,4 +1,4 @@
1
- import { s as Plugin } from "../core-Blh9aCh7.js";
1
+ import { s as Plugin } from "../core-Bx6PBf26.js";
2
2
 
3
3
  //#region src/plugins/last-modified.d.ts
4
4
  type VersionControlFn = (filePath: string) => Promise<Date | null | undefined>;
@@ -58,21 +58,35 @@ function lastModified(options = {}) {
58
58
  };
59
59
  }
60
60
  async function getGitTimestamp(file, cwd) {
61
- const cached = cache.get(file);
61
+ return (await getGitTimestamps(cwd)).get(path.resolve(cwd, file)) ?? null;
62
+ }
63
+ function getGitTimestamps(cwd) {
64
+ const cached = cache.get(cwd);
62
65
  if (cached) return cached;
63
- const timePromise = (async () => {
66
+ const promise = (async () => {
67
+ const timestamps = /* @__PURE__ */ new Map();
68
+ const root = await x("git", ["rev-parse", "--show-toplevel"], { nodeOptions: { cwd } });
69
+ if (root.exitCode !== 0) return timestamps;
64
70
  const out = await x("git", [
71
+ "-c",
72
+ "core.quotepath=off",
65
73
  "log",
66
- "-1",
67
- "--pretty=\"%ai\"",
68
- path.relative(cwd, file)
74
+ "--format=commit:%aI",
75
+ "--name-only"
69
76
  ], { nodeOptions: { cwd } });
70
- if (out.exitCode !== 0) return null;
71
- const date = new Date(out.stdout);
72
- return isNaN(date.getTime()) ? null : date;
77
+ if (out.exitCode !== 0) return timestamps;
78
+ let date;
79
+ for (const line of out.stdout.split("\n")) if (line.startsWith("commit:")) {
80
+ const parsed = new Date(line.slice(7));
81
+ date = isNaN(parsed.getTime()) ? void 0 : parsed;
82
+ } else if (line.length > 0 && date) {
83
+ const file = path.join(root.stdout.trim(), line);
84
+ if (!timestamps.has(file)) timestamps.set(file, date);
85
+ }
86
+ return timestamps;
73
87
  })();
74
- cache.set(file, timePromise);
75
- return timePromise;
88
+ cache.set(cwd, promise);
89
+ return promise;
76
90
  }
77
91
  //#endregion
78
92
  export { lastModified as default };
@@ -5,6 +5,64 @@ import { unified } from "unified";
5
5
  import { visit } from "unist-util-visit";
6
6
  import { remarkHeading } from "fumadocs-core/mdx-plugins";
7
7
  import { VFile } from "vfile";
8
+ //#region src/config/preset.ts
9
+ function pluginOption(def, options = []) {
10
+ const list = def(Array.isArray(options) ? options : []).filter(Boolean);
11
+ if (typeof options === "function") return options(list);
12
+ return list;
13
+ }
14
+ /**
15
+ * apply MDX processor presets
16
+ */
17
+ function applyMdxPreset(options = {}) {
18
+ return async (environment = "bundler") => {
19
+ if (options.preset === "minimal") return options;
20
+ const plugins = await import("fumadocs-core/mdx-plugins");
21
+ const { valueToExport = [], rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, remarkNpmOptions, ...mdxOptions } = options;
22
+ const remarkPlugins = pluginOption((v) => [
23
+ plugins.remarkGfm,
24
+ [plugins.remarkHeading, {
25
+ generateToc: false,
26
+ ...remarkHeadingOptions
27
+ }],
28
+ remarkImageOptions !== false && [plugins.remarkImage, {
29
+ ...remarkImageOptions,
30
+ useImport: remarkImageOptions?.useImport ?? environment === "bundler"
31
+ }],
32
+ "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [plugins.remarkCodeTab, remarkCodeTabOptions],
33
+ "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
34
+ ...v,
35
+ remarkStructureOptions !== false && [plugins.remarkStructure, {
36
+ exportAs: "structuredData",
37
+ ...remarkStructureOptions
38
+ }],
39
+ valueToExport.length > 0 && (() => {
40
+ return (_, file) => {
41
+ file.data["mdx-export"] ??= [];
42
+ for (const name of valueToExport) {
43
+ if (!(name in file.data)) continue;
44
+ file.data["mdx-export"].push({
45
+ name,
46
+ value: file.data[name]
47
+ });
48
+ }
49
+ };
50
+ })
51
+ ], mdxOptions.remarkPlugins);
52
+ const rehypePlugins = pluginOption((v) => [
53
+ rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
54
+ ...v,
55
+ plugins.rehypeToc
56
+ ], mdxOptions.rehypePlugins);
57
+ return {
58
+ ...mdxOptions,
59
+ outputFormat: environment === "runtime" ? "function-body" : mdxOptions.outputFormat,
60
+ remarkPlugins,
61
+ rehypePlugins
62
+ };
63
+ };
64
+ }
65
+ //#endregion
8
66
  //#region src/loaders/mdx/remark-unravel.ts
9
67
  function remarkMarkAndUnravel() {
10
68
  return (tree) => {
@@ -239,4 +297,4 @@ function remarkInclude() {
239
297
  };
240
298
  }
241
299
  //#endregion
242
- export { flattenNode as n, remarkInclude as t };
300
+ export { flattenNode as n, applyMdxPreset as r, remarkInclude as t };
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-VyLPp3lL.js";
2
- import { i as buildConfig, n as createCore, t as _Defaults } from "../core-C5neSoHN.js";
3
- import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-CUkbjVed.js";
1
+ import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
2
+ import { i as buildConfig, n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
3
+ import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-DPEpBHhE.js";
4
4
  import { t as createMetaLoader } from "../meta-UmuO8lue.js";
5
5
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
6
6
  import fs from "node:fs/promises";
@@ -1,6 +1,5 @@
1
- import { A as DocCollection, j as DocsCollection } from "../core-Blh9aCh7.js";
2
- import { i as InternalTypeConfig } from "../types-CCb8V6-O.js";
3
- import { t as CompiledMDXProperties } from "../build-mdx-1yRXUhuv.js";
1
+ import { A as DocCollection, F as DocsCollection, G as CompiledMDXProperties } from "../core-Bx6PBf26.js";
2
+ import { i as InternalTypeConfig } from "../types-Bi-SAQUY.js";
4
3
  import { FC, ReactNode } from "react";
5
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
5
 
@@ -1,5 +1,5 @@
1
- import { A as DocCollection, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, j as DocsCollection, r as CoreOptions, x as ServerOptions } from "../core-Blh9aCh7.js";
2
- import { i as InternalTypeConfig, r as FileInfo } from "../types-CCb8V6-O.js";
1
+ import { A as DocCollection, F as DocsCollection, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, r as CoreOptions, x as ServerOptions } from "../core-Bx6PBf26.js";
2
+ import { i as InternalTypeConfig, r as FileInfo } from "../types-Bi-SAQUY.js";
3
3
 
4
4
  //#region src/runtime/dynamic.d.ts
5
5
  interface LazyEntry<Data = unknown> {
@@ -1,5 +1,5 @@
1
- import { i as buildConfig, n as createCore } from "../core-C5neSoHN.js";
2
- import { t as buildMDX } from "../build-mdx-B5ntJ10C.js";
1
+ import { i as buildConfig, n as createCore } from "../core-Cq6V99iz.js";
2
+ import { t as buildMDX } from "../build-BnKCFeb6.js";
3
3
  import { server } from "./server.js";
4
4
  import { frontmatter } from "fumadocs-core/content/md/frontmatter";
5
5
  import fs from "node:fs/promises";
@@ -37,14 +37,13 @@ async function dynamic(configExports, coreOptions, serverOptions) {
37
37
  async function compile({ info, data }) {
38
38
  let content = await fs.readFile(info.fullPath, "utf-8");
39
39
  content = frontmatter(content).content;
40
- const compiled = await buildMDX(core, collection, {
40
+ return await executeMdx((await buildMDX(core, collection, {
41
41
  filePath: info.fullPath,
42
42
  source: content,
43
43
  frontmatter: data,
44
44
  isDevelopment: false,
45
45
  environment: "runtime"
46
- });
47
- return await executeMdx(String(compiled.value), { baseUrl: pathToFileURL(info.fullPath) });
46
+ })).code, { baseUrl: pathToFileURL(info.fullPath) });
48
47
  }
49
48
  for (const entry of entries) {
50
49
  head[entry.info.path] = () => entry.data;
@@ -1,2 +1,2 @@
1
- import { C as toFumadocsSource, S as server, _ as DocCollectionEntry, b as ServerCreate, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, v as DocsCollectionEntry, x as ServerOptions, y as MetaCollectionEntry } from "../core-Blh9aCh7.js";
1
+ import { C as toFumadocsSource, S as server, _ as DocCollectionEntry, b as ServerCreate, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, v as DocsCollectionEntry, x as ServerOptions, y as MetaCollectionEntry } from "../core-Bx6PBf26.js";
2
2
  export { AsyncDocCollectionEntry, AsyncDocsCollectionEntry, DocCollectionEntry, DocsCollectionEntry, MetaCollectionEntry, ServerCreate, ServerOptions, server, toFumadocsSource };
@@ -98,8 +98,9 @@ function createDocMethods(info, load) {
98
98
  async getText(type) {
99
99
  if (type === "raw") return await (await import("node:fs/promises")).readFile(info.fullPath, "utf-8");
100
100
  const data = await load();
101
- if (typeof data._markdown !== "string") throw new Error("getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config.");
102
- return data._markdown;
101
+ const markdown = data._markdown ?? data._exports?._markdown;
102
+ if (typeof markdown !== "string") throw new Error("getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config.");
103
+ return markdown;
103
104
  },
104
105
  async getMDAST() {
105
106
  const data = await load();
@@ -1,2 +1,2 @@
1
- import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, r as FileInfo, t as DocData } from "../types-CCb8V6-O.js";
1
+ import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, r as FileInfo, t as DocData } from "../types-Bi-SAQUY.js";
2
2
  export { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };
@@ -1,7 +1,7 @@
1
1
  import { Root } from "mdast";
2
- import { StructuredData } from "fumadocs-core/mdx-plugins/remark-structure";
3
2
  import { TOCItemType } from "fumadocs-core/toc";
4
3
  import { MDXContent } from "mdx/types";
4
+ import { StructuredData } from "fumadocs-core/mdx-plugins/remark-structure";
5
5
 
6
6
  //#region src/runtime/types.d.ts
7
7
  interface DocData {
@@ -1,4 +1,4 @@
1
- import { p as IndexFilePluginOptions } from "../core-Blh9aCh7.js";
1
+ import { p as IndexFilePluginOptions } from "../core-Bx6PBf26.js";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/vite/index.d.ts
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-VyLPp3lL.js";
2
- import { i as buildConfig, n as createCore, t as _Defaults } from "../core-C5neSoHN.js";
3
- import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-CUkbjVed.js";
1
+ import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
2
+ import { i as buildConfig, n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
3
+ import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-DPEpBHhE.js";
4
4
  import { t as createMetaLoader } from "../meta-UmuO8lue.js";
5
5
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
6
6
  import { t as indexFile } from "../index-file-C9Bw7He1.js";
@@ -43,7 +43,7 @@ function mdx(forcedConfig, pluginOptions = {}) {
43
43
  };
44
44
  if ("_fumadocs_skipViteConfig" in config && config._fumadocs_skipViteConfig) return;
45
45
  if (!options.updateViteConfig) return;
46
- const { getConfig } = await import("../dist-Bw6UIEZC.js");
46
+ const { getConfig } = await import("../dist-CE1l7WuI.js");
47
47
  return getConfig({ root });
48
48
  },
49
49
  async buildStart() {
@@ -64,7 +64,7 @@ function mdx(forcedConfig, pluginOptions = {}) {
64
64
  ];
65
65
  }
66
66
  async function postInstall(pluginOptions = {}) {
67
- const { loadConfig } = await import("../load-from-file-Du50S5f9.js").then((n) => n.n);
67
+ const { loadConfig } = await import("../load-from-file-CVTAyohB.js").then((n) => n.n);
68
68
  const core = createViteCore(applyDefaults(process.cwd(), pluginOptions));
69
69
  await core.init({ config: loadConfig(core, true) });
70
70
  await core.emit({ write: true });
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-VyLPp3lL.js";
2
- import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-CUkbjVed.js";
3
- import { t as getCore } from "../webpack-C5OhQxDb.js";
1
+ import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
2
+ import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-DPEpBHhE.js";
3
+ import { t as getCore } from "../webpack-BZVbRnxp.js";
4
4
  //#region src/webpack/mdx.ts
5
5
  let instance;
6
6
  const loader = function loader(source) {
@@ -1,6 +1,6 @@
1
- import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-CUkbjVed.js";
1
+ import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-DPEpBHhE.js";
2
2
  import { t as createMetaLoader } from "../meta-UmuO8lue.js";
3
- import { t as getCore } from "../webpack-C5OhQxDb.js";
3
+ import { t as getCore } from "../webpack-BZVbRnxp.js";
4
4
  //#region src/webpack/meta.ts
5
5
  let instance;
6
6
  const loader = function(source) {
@@ -1,4 +1,4 @@
1
- import { n as createCore } from "./core-C5neSoHN.js";
1
+ import { n as createCore } from "./core-Cq6V99iz.js";
2
2
  //#region src/webpack/index.ts
3
3
  let core;
4
4
  function getCore(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "15.0.13",
3
+ "version": "15.1.0",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -55,10 +55,11 @@
55
55
  "chokidar": "^5.0.0",
56
56
  "esbuild": "^0.28.1",
57
57
  "estree-util-value-to-estree": "^3.5.0",
58
- "js-yaml": "^5.1.0",
58
+ "github-slugger": "^2.0.0",
59
+ "js-yaml": "^5.2.1",
59
60
  "mdast-util-mdx": "^3.0.0",
60
61
  "picocolors": "^1.1.1",
61
- "picomatch": "^4.0.4",
62
+ "picomatch": "^4.0.5",
62
63
  "tinyexec": "^1.2.4",
63
64
  "tinyglobby": "^0.2.17",
64
65
  "unified": "^11.0.5",
@@ -71,24 +72,27 @@
71
72
  "@types/bun": "^1.3.14",
72
73
  "@types/mdast": "^4.0.4",
73
74
  "@types/mdx": "^2.0.14",
74
- "@types/node": "^26.0.0",
75
+ "@types/node": "^26.1.0",
75
76
  "@types/picomatch": "^4.0.3",
76
77
  "@types/react": "^19.2.17",
77
78
  "mdast-util-directive": "^3.1.0",
78
- "next": "^16.2.9",
79
+ "next": "^16.2.10",
79
80
  "react": "^19.2.7",
80
81
  "remark": "^15.0.1",
81
82
  "remark-directive": "^4.0.0",
82
83
  "remark-mdx": "^3.1.1",
83
- "rolldown": "^1.1.2",
84
+ "rolldown": "^1.1.4",
85
+ "satteri": "^0.9.4",
84
86
  "tsdown": "0.22.3",
85
- "vite": "^8.1.0",
86
- "webpack": "^5.107.2",
87
- "@fumadocs/vite": "0.0.2",
88
- "fumadocs-core": "16.10.6",
89
- "tsconfig": "0.0.0"
87
+ "vite": "^8.1.3",
88
+ "webpack": "^5.108.3",
89
+ "@fumadocs/satteri": "0.2.0",
90
+ "tsconfig": "0.0.0",
91
+ "@fumadocs/vite": "0.1.0",
92
+ "fumadocs-core": "16.11.0"
90
93
  },
91
94
  "peerDependencies": {
95
+ "@fumadocs/satteri": "0.x.x",
92
96
  "@types/mdast": "*",
93
97
  "@types/mdx": "*",
94
98
  "@types/react": "*",
@@ -97,9 +101,16 @@
97
101
  "next": "^15.3.0 || ^16.0.0",
98
102
  "react": "^19.2.0",
99
103
  "rolldown": "*",
104
+ "satteri": "^0.9.4",
100
105
  "vite": "7.x.x || 8.x.x"
101
106
  },
102
107
  "peerDependenciesMeta": {
108
+ "@fumadocs/satteri": {
109
+ "optional": true
110
+ },
111
+ "satteri": {
112
+ "optional": true
113
+ },
103
114
  "rolldown": {
104
115
  "optional": true
105
116
  },
@@ -1,52 +0,0 @@
1
- import { StructuredData } from "fumadocs-core/mdx-plugins";
2
- import { VFile } from "vfile";
3
- import { FC } from "react";
4
- import { createProcessor } from "@mdx-js/mdx";
5
- import { TOCItemType } from "fumadocs-core/toc";
6
- import { MDXProps } from "mdx/types";
7
-
8
- //#region src/loaders/mdx/build-mdx.d.ts
9
- type Processor = ReturnType<typeof createProcessor>;
10
- interface CompilerOptions {
11
- addDependency: (file: string) => void;
12
- }
13
- interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
14
- frontmatter: Frontmatter;
15
- structuredData: StructuredData;
16
- toc: TOCItemType[];
17
- default: FC<MDXProps>;
18
- /**
19
- * Enable from `postprocess` option.
20
- */
21
- _markdown?: string;
22
- /**
23
- * Enable from `postprocess` option.
24
- */
25
- _mdast?: string;
26
- }
27
- interface FumadocsDataMap {
28
- /**
29
- * [Fumadocs MDX] raw frontmatter, you can modify it
30
- */
31
- frontmatter?: Record<string, unknown>;
32
- /**
33
- * [Fumadocs MDX] additional ESM exports to write
34
- */
35
- 'mdx-export'?: {
36
- name: string;
37
- value: unknown;
38
- }[];
39
- /**
40
- * [Fumadocs MDX] The compiler object from loader
41
- */
42
- _compiler?: CompilerOptions;
43
- /**
44
- * [Fumadocs MDX] get internal processor, do not use this on user land.
45
- */
46
- _getProcessor?: (format: 'md' | 'mdx') => Processor;
47
- }
48
- declare module 'vfile' {
49
- interface DataMap extends FumadocsDataMap {}
50
- }
51
- //#endregion
52
- export { CompiledMDXProperties as t };
@@ -1,59 +0,0 @@
1
- //#region src/config/preset.ts
2
- function pluginOption(def, options = []) {
3
- const list = def(Array.isArray(options) ? options : []).filter(Boolean);
4
- if (typeof options === "function") return options(list);
5
- return list;
6
- }
7
- /**
8
- * apply MDX processor presets
9
- */
10
- function applyMdxPreset(options = {}) {
11
- return async (environment = "bundler") => {
12
- if (options.preset === "minimal") return options;
13
- const plugins = await import("fumadocs-core/mdx-plugins");
14
- const { valueToExport = [], rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, remarkNpmOptions, ...mdxOptions } = options;
15
- const remarkPlugins = pluginOption((v) => [
16
- plugins.remarkGfm,
17
- [plugins.remarkHeading, {
18
- generateToc: false,
19
- ...remarkHeadingOptions
20
- }],
21
- remarkImageOptions !== false && [plugins.remarkImage, {
22
- ...remarkImageOptions,
23
- useImport: remarkImageOptions?.useImport ?? environment === "bundler"
24
- }],
25
- "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [plugins.remarkCodeTab, remarkCodeTabOptions],
26
- "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
27
- ...v,
28
- remarkStructureOptions !== false && [plugins.remarkStructure, {
29
- exportAs: "structuredData",
30
- ...remarkStructureOptions
31
- }],
32
- valueToExport.length > 0 && (() => {
33
- return (_, file) => {
34
- file.data["mdx-export"] ??= [];
35
- for (const name of valueToExport) {
36
- if (!(name in file.data)) continue;
37
- file.data["mdx-export"].push({
38
- name,
39
- value: file.data[name]
40
- });
41
- }
42
- };
43
- })
44
- ], mdxOptions.remarkPlugins);
45
- const rehypePlugins = pluginOption((v) => [
46
- rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
47
- ...v,
48
- plugins.rehypeToc
49
- ], mdxOptions.rehypePlugins);
50
- return {
51
- ...mdxOptions,
52
- outputFormat: environment === "runtime" ? "function-body" : mdxOptions.outputFormat,
53
- remarkPlugins,
54
- rehypePlugins
55
- };
56
- };
57
- }
58
- //#endregion
59
- export { applyMdxPreset as t };