fumadocs-mdx 15.0.4 → 15.0.6

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 (48) hide show
  1. package/bin.js +0 -0
  2. package/dist/{adapter-ClgSNqbq.js → adapter-BSlBR-2Y.js} +2 -2
  3. package/dist/bin.js +0 -0
  4. package/dist/{build-mdx-Ck7r5VE4.js → build-mdx-H6gA2VPm.js} +1 -1
  5. package/dist/bun/index.d.ts +1 -1
  6. package/dist/bun/index.js +4 -5
  7. package/dist/config/index.d.ts +1 -1
  8. package/dist/config/index.js +1 -1
  9. package/dist/{core-DAna8bb8.d.ts → core-C4xPhmBp.d.ts} +8 -4
  10. package/dist/{core-Wd5WdPN4.js → core-DlDe_Eze.js} +97 -2
  11. package/dist/{dist-DV7kmyst.js → dist-B7SYXrlp.js} +0 -20
  12. package/dist/{index-file-CyGG-8n8.js → index-file-DBypGEp7.js} +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/{load-from-file--MfW8a2Z.js → load-from-file-CiyxzRPF.js} +6 -2
  15. package/dist/{mdx-xb45Eql8.js → mdx-C6JG017v.js} +2 -2
  16. package/dist/{meta-B6guI74I.js → meta-_7-eciVa.js} +1 -1
  17. package/dist/next/index.d.ts +1 -1
  18. package/dist/next/index.js +3 -4
  19. package/dist/node/_loader.js +4 -4
  20. package/dist/node/index.d.ts +1 -1
  21. package/dist/node/loader.js +4 -4
  22. package/dist/plugins/index-file.d.ts +1 -1
  23. package/dist/plugins/index-file.js +1 -1
  24. package/dist/plugins/json-schema.d.ts +1 -1
  25. package/dist/plugins/last-modified.d.ts +1 -1
  26. package/dist/plugins/last-modified.js +1 -1
  27. package/dist/rolldown/index.js +5 -6
  28. package/dist/runtime/browser.d.ts +3 -3
  29. package/dist/runtime/dynamic.d.ts +2 -2
  30. package/dist/runtime/dynamic.js +2 -3
  31. package/dist/runtime/server.d.ts +1 -1
  32. package/dist/runtime/server.js +8 -7
  33. package/dist/runtime/types.d.ts +1 -1
  34. package/dist/vite/index.d.ts +1 -1
  35. package/dist/vite/index.js +7 -8
  36. package/dist/webpack/mdx.d.ts +1 -1
  37. package/dist/webpack/mdx.js +3 -3
  38. package/dist/webpack/meta.d.ts +1 -1
  39. package/dist/webpack/meta.js +3 -3
  40. package/dist/{webpack-CBlMzMlJ.js → webpack-C4iZ7HjD.js} +1 -1
  41. package/package.json +7 -7
  42. package/dist/build-DPafU2lu.js +0 -97
  43. package/dist/loaders-ezSYYkT7.js +0 -5
  44. /package/dist/{build-mdx-CAXqH1_C.d.ts → build-mdx-CDcIdtZ2.d.ts} +0 -0
  45. /package/dist/{codegen-B8EhLmbU.js → codegen-sWuQ5hQ_.js} +0 -0
  46. /package/dist/{index-Cfo6kcGs.d.ts → index-Dq27x9Hl.d.ts} +0 -0
  47. /package/dist/{remark-include-B1RWQhGC.js → remark-include-BG_6eQl6.js} +0 -0
  48. /package/dist/{types-DRpz2Vq2.d.ts → types-BRJOx-ji.d.ts} +0 -0
package/bin.js CHANGED
File without changes
@@ -1,5 +1,5 @@
1
- import { r as ValidationError } from "./core-Wd5WdPN4.js";
2
- import { t as loadConfig } from "./load-from-file--MfW8a2Z.js";
1
+ import { t as loadConfig } from "./load-from-file-CiyxzRPF.js";
2
+ import { r as ValidationError } from "./core-DlDe_Eze.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  import fs from "node:fs/promises";
5
5
  import { fileURLToPath } from "node:url";
package/dist/bin.js CHANGED
File without changes
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
2
- import { n as flattenNode, t as remarkInclude } from "./remark-include-B1RWQhGC.js";
2
+ import { n as flattenNode, t as remarkInclude } from "./remark-include-BG_6eQl6.js";
3
3
  import { visit } from "unist-util-visit";
4
4
  import { VFile } from "vfile";
5
5
  import { createProcessor } from "@mdx-js/mdx";
@@ -1,4 +1,4 @@
1
- import { r as CoreOptions } from "../core-DAna8bb8.js";
1
+ import { r as CoreOptions } from "../core-C4xPhmBp.js";
2
2
  import { BunPlugin } from "bun";
3
3
 
4
4
  //#region src/bun/index.d.ts
package/dist/bun/index.js CHANGED
@@ -1,8 +1,7 @@
1
- import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
- import { t as buildConfig } from "../build-DPafU2lu.js";
3
- import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
4
- import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-ClgSNqbq.js";
5
- import { t as createMetaLoader } from "../meta-B6guI74I.js";
1
+ import { t as createMdxLoader } from "../mdx-C6JG017v.js";
2
+ import { i as buildConfig, n as createCore, t as _Defaults } from "../core-DlDe_Eze.js";
3
+ import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-BSlBR-2Y.js";
4
+ import { t as createMetaLoader } from "../meta-_7-eciVa.js";
6
5
  import { pathToFileURL } from "node:url";
7
6
  //#region src/bun/index.ts
8
7
  function createMdxPlugin(options = {}) {
@@ -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-DAna8bb8.js";
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-C4xPhmBp.js";
2
2
  export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, PostprocessOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
@@ -1,5 +1,5 @@
1
1
  import { t as applyMdxPreset } from "../preset-B0H8HalE.js";
2
- import { t as remarkInclude } from "../remark-include-B1RWQhGC.js";
2
+ import { t as remarkInclude } from "../remark-include-BG_6eQl6.js";
3
3
  import { metaSchema as metaSchema$1, pageSchema } from "fumadocs-core/source/schema";
4
4
  //#region src/config/define.ts
5
5
  function defineCollections(options) {
@@ -1,4 +1,4 @@
1
- import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-DRpz2Vq2.js";
1
+ import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-BRJOx-ji.js";
2
2
  import * as _$zod from "zod";
3
3
  import * as _$fumadocs_core_source_schema0 from "fumadocs-core/source/schema";
4
4
  import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
@@ -197,13 +197,17 @@ declare const metaSchema$1: _$zod.ZodObject<{
197
197
  //#region src/runtime/server.d.ts
198
198
  type MetaCollectionEntry<Data> = Data & MetaMethods;
199
199
  type DocCollectionEntry<Name extends string = string, Frontmatter = unknown, TC extends InternalTypeConfig = InternalTypeConfig> = DocData & DocMethods & Frontmatter & TC['DocData'][Name];
200
+ interface ToFumadocsSourceOptions {
201
+ /** base directory for virtual file paths */
202
+ baseDir?: string;
203
+ }
200
204
  type AsyncDocCollectionEntry<Name extends string = string, Frontmatter = unknown, TC extends InternalTypeConfig = InternalTypeConfig> = {
201
205
  load: () => Promise<DocData & TC['DocData'][Name]>;
202
206
  } & DocMethods & Frontmatter;
203
207
  interface DocsCollectionEntry<Name extends string = string, Frontmatter extends PageData = PageData, Meta extends MetaData = MetaData, TC extends InternalTypeConfig = InternalTypeConfig> {
204
208
  docs: DocCollectionEntry<Name, Frontmatter, TC>[];
205
209
  meta: MetaCollectionEntry<Meta>[];
206
- toFumadocsSource: () => Source<{
210
+ toFumadocsSource: (options?: ToFumadocsSourceOptions) => Source<{
207
211
  pageData: DocCollectionEntry<Name, Frontmatter, TC>;
208
212
  metaData: MetaCollectionEntry<Meta>;
209
213
  }>;
@@ -211,7 +215,7 @@ interface DocsCollectionEntry<Name extends string = string, Frontmatter extends
211
215
  interface AsyncDocsCollectionEntry<Name extends string = string, Frontmatter extends PageData = PageData, Meta extends MetaData = MetaData, TC extends InternalTypeConfig = InternalTypeConfig> {
212
216
  docs: AsyncDocCollectionEntry<Name, Frontmatter, TC>[];
213
217
  meta: MetaCollectionEntry<Meta>[];
214
- toFumadocsSource: () => Source<{
218
+ toFumadocsSource: (options?: ToFumadocsSourceOptions) => Source<{
215
219
  pageData: AsyncDocCollectionEntry<Name, Frontmatter, TC>;
216
220
  metaData: MetaCollectionEntry<Meta>;
217
221
  }>;
@@ -230,7 +234,7 @@ declare function server<Config, TC extends InternalTypeConfig>(options?: ServerO
230
234
  docs<Name extends keyof Config & string>(name: Name, base: string, metaGlob: AwaitableGlobEntries<unknown>, docGlob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends DocsCollection<infer Page extends StandardSchemaV1<unknown, unknown>, infer Meta extends StandardSchemaV1<unknown, unknown>> ? StandardSchemaV1.InferOutput<Page> extends PageData ? StandardSchemaV1.InferOutput<Meta> extends MetaData ? DocsCollectionEntry<Name, StandardSchemaV1.InferOutput<Page>, StandardSchemaV1.InferOutput<Meta>, TC> : never : never : never>;
231
235
  docsLazy<Name extends keyof Config & string>(name: Name, base: string, metaGlob: AwaitableGlobEntries<unknown>, docHeadGlob: AwaitableGlobEntries<unknown>, docBodyGlob: Record<string, () => Promise<unknown>>): Promise<Config[Name] extends DocsCollection<infer Page extends StandardSchemaV1<unknown, unknown>, infer Meta extends StandardSchemaV1<unknown, unknown>> ? StandardSchemaV1.InferOutput<Page> extends PageData ? StandardSchemaV1.InferOutput<Meta> extends MetaData ? AsyncDocsCollectionEntry<Name, StandardSchemaV1.InferOutput<Page>, StandardSchemaV1.InferOutput<Meta>, TC> : never : never : never>;
232
236
  };
233
- declare function toFumadocsSource<Page extends DocMethods & PageData, Meta extends MetaMethods & MetaData>(pages: Page[], metas: Meta[]): Source<{
237
+ declare function toFumadocsSource<Page extends DocMethods & PageData, Meta extends MetaMethods & MetaData>(pages: Page[], metas: Meta[], options?: ToFumadocsSourceOptions): Source<{
234
238
  pageData: Page;
235
239
  metaData: Meta;
236
240
  }>;
@@ -1,6 +1,101 @@
1
- import { n as ident } from "./codegen-B8EhLmbU.js";
1
+ import { t as applyMdxPreset } from "./preset-B0H8HalE.js";
2
+ import { n as ident } from "./codegen-sWuQ5hQ_.js";
2
3
  import fs from "node:fs/promises";
3
4
  import path from "node:path";
5
+ import picomatch from "picomatch";
6
+ //#region src/config/build.ts
7
+ const SupportedFormats = {
8
+ doc: ["mdx", "md"],
9
+ meta: ["json", "yaml"]
10
+ };
11
+ function buildCollection(name, collection, cwd) {
12
+ if (collection.type === "docs") return {
13
+ ...collection,
14
+ type: "docs",
15
+ get dir() {
16
+ return this.docs.dir;
17
+ },
18
+ name,
19
+ meta: buildCollection(name, collection.meta, cwd),
20
+ docs: buildCollection(name, collection.docs, cwd),
21
+ hasFile(filePath) {
22
+ return this.docs.hasFile(filePath) || this.meta.hasFile(filePath);
23
+ },
24
+ isFileSupported(filePath) {
25
+ return this.docs.isFileSupported(filePath) || this.meta.isFileSupported(filePath);
26
+ },
27
+ cwd
28
+ };
29
+ return {
30
+ ...collection,
31
+ ...buildPrimitiveCollection(name, collection, cwd)
32
+ };
33
+ }
34
+ function buildPrimitiveCollection(name, config, cwd) {
35
+ const supportedFormats = SupportedFormats[config.type];
36
+ const patterns = config.files ?? [`**/*.{${supportedFormats.join(",")}}`];
37
+ let matcher;
38
+ return {
39
+ dir: path.resolve(cwd, config.dir),
40
+ cwd,
41
+ name,
42
+ patterns,
43
+ isFileSupported(filePath) {
44
+ return supportedFormats.some((format) => filePath.endsWith(`.${format}`));
45
+ },
46
+ hasFile(filePath) {
47
+ if (!this.isFileSupported(filePath)) return false;
48
+ const relativePath = path.relative(this.dir, filePath);
49
+ if (relativePath.startsWith(`..${path.sep}`)) return false;
50
+ return (matcher ??= picomatch(patterns))(relativePath);
51
+ }
52
+ };
53
+ }
54
+ function buildConfig(config, cwd = process.cwd()) {
55
+ const collections = /* @__PURE__ */ new Map();
56
+ const loaded = {};
57
+ for (const [k, v] of Object.entries(config)) {
58
+ if (!v) continue;
59
+ if (typeof v === "object" && "type" in v) {
60
+ if (v.type === "docs" || v.type === "doc" || v.type === "meta") {
61
+ collections.set(k, buildCollection(k, v, cwd));
62
+ continue;
63
+ }
64
+ }
65
+ if (k === "default" && v) {
66
+ Object.assign(loaded, v);
67
+ continue;
68
+ }
69
+ throw new Error(`Unknown export "${k}", you can only export collections from source configuration file.`);
70
+ }
71
+ const mdxOptionsCache = /* @__PURE__ */ new Map();
72
+ return {
73
+ global: loaded,
74
+ collections,
75
+ workspaces: Object.fromEntries(Object.entries(loaded.workspaces ?? {}).map(([key, value]) => {
76
+ return [key, {
77
+ dir: value.dir,
78
+ config: buildConfig(value.config, path.resolve(cwd, value.dir))
79
+ }];
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
+ }
96
+ };
97
+ }
98
+ //#endregion
4
99
  //#region src/utils/validation.ts
5
100
  var ValidationError = class extends Error {
6
101
  constructor(message, issues) {
@@ -211,4 +306,4 @@ function postprocessPlugin() {
211
306
  } };
212
307
  }
213
308
  //#endregion
214
- export { createCore as n, ValidationError as r, _Defaults as t };
309
+ export { buildConfig as i, createCore as n, ValidationError as r, _Defaults as t };
@@ -97,24 +97,6 @@ var generated_default = {
97
97
  "fumadocs-mdx > picomatch",
98
98
  "fumadocs-mdx > unified > bail",
99
99
  "fumadocs-mdx > unified > extend",
100
- "fumadocs-openapi > ajv",
101
- "fumadocs-openapi > github-slugger",
102
- "fumadocs-openapi > hast-util-to-jsx-runtime > comma-separated-tokens",
103
- "fumadocs-openapi > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-from-markdown > decode-named-character-reference > character-entities",
104
- "fumadocs-openapi > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-from-markdown > micromark > debug",
105
- "fumadocs-openapi > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-to-markdown > longest-streak",
106
- "fumadocs-openapi > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-to-markdown > zwitch",
107
- "fumadocs-openapi > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > ccount",
108
- "fumadocs-openapi > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > parse-entities",
109
- "fumadocs-openapi > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > stringify-entities",
110
- "fumadocs-openapi > hast-util-to-jsx-runtime > space-separated-tokens",
111
- "fumadocs-openapi > hast-util-to-jsx-runtime > style-to-js",
112
- "fumadocs-openapi > js-yaml > argparse",
113
- "fumadocs-openapi > remark > unified > bail",
114
- "fumadocs-openapi > remark > unified > extend",
115
- "fumadocs-openapi > remark-rehype > mdast-util-to-hast > trim-lines",
116
- "fumadocs-openapi > shiki > @shikijs/core > hast-util-to-html > html-void-elements",
117
- "fumadocs-openapi > xml-js",
118
100
  "fumadocs-twoslash > @shikijs/twoslash > @shikijs/core > hast-util-to-html > comma-separated-tokens",
119
101
  "fumadocs-twoslash > @shikijs/twoslash > @shikijs/core > hast-util-to-html > html-void-elements",
120
102
  "fumadocs-twoslash > @shikijs/twoslash > @shikijs/core > hast-util-to-html > space-separated-tokens",
@@ -160,7 +142,6 @@ var generated_default = {
160
142
  "@fumadocs/tailwind",
161
143
  "fumadocs-core",
162
144
  "fumadocs-mdx",
163
- "fumadocs-openapi",
164
145
  "fumadocs-twoslash",
165
146
  "fumadocs-typescript",
166
147
  "fumadocs-ui"
@@ -176,7 +157,6 @@ var generated_default = {
176
157
  "@fumadocs/tailwind",
177
158
  "fumadocs-core",
178
159
  "fumadocs-mdx",
179
- "fumadocs-openapi",
180
160
  "fumadocs-twoslash",
181
161
  "fumadocs-typescript",
182
162
  "fumadocs-ui"
@@ -1,4 +1,4 @@
1
- import { n as ident, r as slash, t as createCodegen } from "./codegen-B8EhLmbU.js";
1
+ import { n as ident, r as slash, t as createCodegen } from "./codegen-sWuQ5hQ_.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";
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
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-DAna8bb8.js";
2
- import { t as CompiledMDXProperties } from "./build-mdx-CAXqH1_C.js";
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-C4xPhmBp.js";
2
+ import { t as CompiledMDXProperties } from "./build-mdx-CDcIdtZ2.js";
3
3
  export { type CompilationContext, type CompiledMDXProperties, type Core, type CoreOptions, type EmitEntry, type EmitOptions, type EmitOutput, type ExtractedReference, type Plugin, type PluginContext, type PluginOption, type ServerContext, type TransformOptions };
@@ -1,6 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
2
- import { t as buildConfig } from "./build-DPafU2lu.js";
2
+ import { i as buildConfig } from "./core-DlDe_Eze.js";
3
3
  import { pathToFileURL } from "node:url";
4
+ //#region src/loaders/index.ts
5
+ const metaLoaderGlob = /\.(json|yaml)(\?.+?)?$/;
6
+ const mdxLoaderGlob = /\.mdx?(\?.+?)?$/;
7
+ //#endregion
4
8
  //#region src/config/load-from-file.ts
5
9
  var load_from_file_exports = /* @__PURE__ */ __exportAll({ loadConfig: () => loadConfig });
6
10
  async function compileConfig(core) {
@@ -34,4 +38,4 @@ async function loadConfig(core, build = false) {
34
38
  return buildConfig(await import(url.href));
35
39
  }
36
40
  //#endregion
37
- export { load_from_file_exports as n, loadConfig as t };
41
+ export { metaLoaderGlob as i, load_from_file_exports as n, mdxLoaderGlob as r, loadConfig as t };
@@ -1,4 +1,4 @@
1
- import { t as mdxLoaderGlob } from "./loaders-ezSYYkT7.js";
1
+ import { r as mdxLoaderGlob } from "./load-from-file-CiyxzRPF.js";
2
2
  import { frontmatter } from "fumadocs-core/content/md/frontmatter";
3
3
  import { z } from "zod";
4
4
  import fs from "node:fs/promises";
@@ -58,7 +58,7 @@ function createMdxLoader({ getCore }) {
58
58
  code: `export const frontmatter = ${JSON.stringify(matter.data)}`,
59
59
  map: null
60
60
  };
61
- const { buildMDX } = await import("./build-mdx-Ck7r5VE4.js").then((n) => n.n);
61
+ const { buildMDX } = await import("./build-mdx-H6gA2VPm.js").then((n) => n.n);
62
62
  const compiled = await buildMDX(core, docCollection, {
63
63
  isDevelopment,
64
64
  source: "\n".repeat(countLines(matter.matter)) + matter.content,
@@ -1,4 +1,4 @@
1
- import { n as metaLoaderGlob } from "./loaders-ezSYYkT7.js";
1
+ import { i as metaLoaderGlob } from "./load-from-file-CiyxzRPF.js";
2
2
  import { z } from "zod";
3
3
  import { load } from "js-yaml";
4
4
  //#region src/loaders/meta.ts
@@ -1,4 +1,4 @@
1
- import { p as IndexFilePluginOptions } from "../core-DAna8bb8.js";
1
+ import { p as IndexFilePluginOptions } from "../core-C4xPhmBp.js";
2
2
  import { NextConfig } from "next";
3
3
 
4
4
  //#region src/next/index.d.ts
@@ -1,7 +1,6 @@
1
- import { n as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-ezSYYkT7.js";
2
- import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
3
- import { t as loadConfig } from "../load-from-file--MfW8a2Z.js";
4
- import { t as indexFile } from "../index-file-CyGG-8n8.js";
1
+ import { i as metaLoaderGlob, r as mdxLoaderGlob, t as loadConfig } from "../load-from-file-CiyxzRPF.js";
2
+ import { n as createCore, t as _Defaults } from "../core-DlDe_Eze.js";
3
+ import { t as indexFile } from "../index-file-DBypGEp7.js";
5
4
  import * as path$1 from "node:path";
6
5
  //#region src/next/index.ts
7
6
  const defaultPageExtensions = [
@@ -1,7 +1,7 @@
1
- import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
- import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
3
- import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-ClgSNqbq.js";
4
- import { t as createMetaLoader } from "../meta-B6guI74I.js";
1
+ import { t as createMdxLoader } from "../mdx-C6JG017v.js";
2
+ import { n as createCore, t as _Defaults } from "../core-DlDe_Eze.js";
3
+ import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-BSlBR-2Y.js";
4
+ import { t as createMetaLoader } from "../meta-_7-eciVa.js";
5
5
  //#region src/node/_loader.ts
6
6
  let cachedLoaders;
7
7
  const initialize = (options) => {
@@ -1,4 +1,4 @@
1
- import { r as CoreOptions } from "../core-DAna8bb8.js";
1
+ import { r as CoreOptions } from "../core-C4xPhmBp.js";
2
2
 
3
3
  //#region src/node/index.d.ts
4
4
  interface NodeLoaderOptions extends Partial<CoreOptions> {
@@ -1,7 +1,7 @@
1
- import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
- import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
3
- import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-ClgSNqbq.js";
4
- import { t as createMetaLoader } from "../meta-B6guI74I.js";
1
+ import { t as createMdxLoader } from "../mdx-C6JG017v.js";
2
+ import { n as createCore, t as _Defaults } from "../core-DlDe_Eze.js";
3
+ import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-BSlBR-2Y.js";
4
+ import { t as createMetaLoader } from "../meta-_7-eciVa.js";
5
5
  //#region src/node/loader.ts
6
6
  const configLoader = createStandaloneConfigLoader({
7
7
  core: createCore({
@@ -1,2 +1,2 @@
1
- import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-DAna8bb8.js";
1
+ import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-C4xPhmBp.js";
2
2
  export { IndexFilePlugin, IndexFilePluginOptions, indexFile as default };
@@ -1,2 +1,2 @@
1
- import { t as indexFile } from "../index-file-CyGG-8n8.js";
1
+ import { t as indexFile } from "../index-file-DBypGEp7.js";
2
2
  export { indexFile as default };
@@ -1,4 +1,4 @@
1
- import { s as Plugin } from "../core-DAna8bb8.js";
1
+ import { s as Plugin } from "../core-C4xPhmBp.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-DAna8bb8.js";
1
+ import { s as Plugin } from "../core-C4xPhmBp.js";
2
2
 
3
3
  //#region src/plugins/last-modified.d.ts
4
4
  type VersionControlFn = (filePath: string) => Promise<Date | null | undefined>;
@@ -1,4 +1,4 @@
1
- import { n as ident } from "../codegen-B8EhLmbU.js";
1
+ import { n as ident } from "../codegen-sWuQ5hQ_.js";
2
2
  import path from "node:path";
3
3
  import { x } from "tinyexec";
4
4
  //#region src/plugins/last-modified.ts
@@ -1,9 +1,8 @@
1
- import { n as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-ezSYYkT7.js";
2
- import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
3
- import { t as buildConfig } from "../build-DPafU2lu.js";
4
- import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
5
- import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-ClgSNqbq.js";
6
- import { t as createMetaLoader } from "../meta-B6guI74I.js";
1
+ import { i as metaLoaderGlob, r as mdxLoaderGlob } from "../load-from-file-CiyxzRPF.js";
2
+ import { t as createMdxLoader } from "../mdx-C6JG017v.js";
3
+ import { i as buildConfig, n as createCore, t as _Defaults } from "../core-DlDe_Eze.js";
4
+ import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-BSlBR-2Y.js";
5
+ import { t as createMetaLoader } from "../meta-_7-eciVa.js";
7
6
  import fs from "node:fs/promises";
8
7
  //#region src/rolldown/index.ts
9
8
  async function mdx(config, options) {
@@ -1,6 +1,6 @@
1
- import { A as DocCollection, j as DocsCollection } from "../core-DAna8bb8.js";
2
- import { i as InternalTypeConfig } from "../types-DRpz2Vq2.js";
3
- import { t as CompiledMDXProperties } from "../build-mdx-CAXqH1_C.js";
1
+ import { A as DocCollection, j as DocsCollection } from "../core-C4xPhmBp.js";
2
+ import { i as InternalTypeConfig } from "../types-BRJOx-ji.js";
3
+ import { t as CompiledMDXProperties } from "../build-mdx-CDcIdtZ2.js";
4
4
  import { FC, ReactNode } from "react";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
6
 
@@ -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-DAna8bb8.js";
2
- import { i as InternalTypeConfig, r as FileInfo } from "../types-DRpz2Vq2.js";
1
+ import { A as DocCollection, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, j as DocsCollection, r as CoreOptions, x as ServerOptions } from "../core-C4xPhmBp.js";
2
+ import { i as InternalTypeConfig, r as FileInfo } from "../types-BRJOx-ji.js";
3
3
  import * as _$_standard_schema_spec0 from "@standard-schema/spec";
4
4
  import * as _$fumadocs_core_source0 from "fumadocs-core/source";
5
5
 
@@ -1,6 +1,5 @@
1
- import { t as buildConfig } from "../build-DPafU2lu.js";
2
- import { n as createCore } from "../core-Wd5WdPN4.js";
3
- import { t as buildMDX } from "../build-mdx-Ck7r5VE4.js";
1
+ import { i as buildConfig, n as createCore } from "../core-DlDe_Eze.js";
2
+ import { t as buildMDX } from "../build-mdx-H6gA2VPm.js";
4
3
  import { server } from "./server.js";
5
4
  import { frontmatter } from "fumadocs-core/content/md/frontmatter";
6
5
  import fs from "node:fs/promises";
@@ -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-DAna8bb8.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-C4xPhmBp.js";
2
2
  export { AsyncDocCollectionEntry, AsyncDocsCollectionEntry, DocCollectionEntry, DocsCollectionEntry, MetaCollectionEntry, ServerCreate, ServerOptions, server, toFumadocsSource };
@@ -56,8 +56,8 @@ function server(options = {}) {
56
56
  return {
57
57
  docs: await this.doc(name, base, docGlob),
58
58
  meta: await this.meta(name, base, metaGlob),
59
- toFumadocsSource() {
60
- return toFumadocsSource(this.docs, this.meta);
59
+ toFumadocsSource(options) {
60
+ return toFumadocsSource(this.docs, this.meta, options);
61
61
  }
62
62
  };
63
63
  },
@@ -65,24 +65,25 @@ function server(options = {}) {
65
65
  return {
66
66
  docs: await this.docLazy(name, base, docHeadGlob, docBodyGlob),
67
67
  meta: await this.meta(name, base, metaGlob),
68
- toFumadocsSource() {
69
- return toFumadocsSource(this.docs, this.meta);
68
+ toFumadocsSource(options) {
69
+ return toFumadocsSource(this.docs, this.meta, options);
70
70
  }
71
71
  };
72
72
  }
73
73
  };
74
74
  }
75
- function toFumadocsSource(pages, metas) {
75
+ function toFumadocsSource(pages, metas, options) {
76
+ const baseDir = options?.baseDir;
76
77
  const files = [];
77
78
  for (const entry of pages) files.push({
78
79
  type: "page",
79
- path: entry.info.path,
80
+ path: baseDir ? path$1.join(baseDir, entry.info.path) : entry.info.path,
80
81
  absolutePath: entry.info.fullPath,
81
82
  data: entry
82
83
  });
83
84
  for (const entry of metas) files.push({
84
85
  type: "meta",
85
- path: entry.info.path,
86
+ path: baseDir ? path$1.join(baseDir, entry.info.path) : entry.info.path,
86
87
  absolutePath: entry.info.fullPath,
87
88
  data: entry
88
89
  });
@@ -1,2 +1,2 @@
1
- import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, r as FileInfo, t as DocData } from "../types-DRpz2Vq2.js";
1
+ import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, r as FileInfo, t as DocData } from "../types-BRJOx-ji.js";
2
2
  export { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };
@@ -1,4 +1,4 @@
1
- import { p as IndexFilePluginOptions } from "../core-DAna8bb8.js";
1
+ import { p as IndexFilePluginOptions } from "../core-C4xPhmBp.js";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/vite/index.d.ts
@@ -1,9 +1,8 @@
1
- import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
- import { t as buildConfig } from "../build-DPafU2lu.js";
3
- import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
4
- import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-ClgSNqbq.js";
5
- import { t as createMetaLoader } from "../meta-B6guI74I.js";
6
- import { t as indexFile } from "../index-file-CyGG-8n8.js";
1
+ import { t as createMdxLoader } from "../mdx-C6JG017v.js";
2
+ import { i as buildConfig, n as createCore, t as _Defaults } from "../core-DlDe_Eze.js";
3
+ import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-BSlBR-2Y.js";
4
+ import { t as createMetaLoader } from "../meta-_7-eciVa.js";
5
+ import { t as indexFile } from "../index-file-DBypGEp7.js";
7
6
  import { runnerImport } from "vite";
8
7
  //#region src/vite/index.ts
9
8
  async function mdx(_config, pluginOptions = {}) {
@@ -19,7 +18,7 @@ async function mdx(_config, pluginOptions = {}) {
19
18
  name: "fumadocs-mdx",
20
19
  async config() {
21
20
  if (!options.updateViteConfig) return;
22
- const { getConfig } = await import("../dist-DV7kmyst.js");
21
+ const { getConfig } = await import("../dist-B7SYXrlp.js");
23
22
  return getConfig({ root: process.cwd() });
24
23
  },
25
24
  async buildStart() {
@@ -51,7 +50,7 @@ async function mdx(_config, pluginOptions = {}) {
51
50
  ];
52
51
  }
53
52
  async function postInstall(pluginOptions = {}) {
54
- const { loadConfig } = await import("../load-from-file--MfW8a2Z.js").then((n) => n.n);
53
+ const { loadConfig } = await import("../load-from-file-CiyxzRPF.js").then((n) => n.n);
55
54
  const core = createViteCore(applyDefaults(pluginOptions));
56
55
  await core.init({ config: loadConfig(core, true) });
57
56
  await core.emit({ write: true });
@@ -1,4 +1,4 @@
1
- import { t as WebpackLoaderOptions } from "../index-Cfo6kcGs.js";
1
+ import { t as WebpackLoaderOptions } from "../index-Dq27x9Hl.js";
2
2
  import { LoaderDefinitionFunction } from "webpack";
3
3
 
4
4
  //#region src/webpack/mdx.d.ts
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
- import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-ClgSNqbq.js";
3
- import { t as getCore } from "../webpack-CBlMzMlJ.js";
1
+ import { t as createMdxLoader } from "../mdx-C6JG017v.js";
2
+ import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-BSlBR-2Y.js";
3
+ import { t as getCore } from "../webpack-C4iZ7HjD.js";
4
4
  //#region src/webpack/mdx.ts
5
5
  let instance;
6
6
  const loader = function loader(source) {
@@ -1,4 +1,4 @@
1
- import { t as WebpackLoaderOptions } from "../index-Cfo6kcGs.js";
1
+ import { t as WebpackLoaderOptions } from "../index-Dq27x9Hl.js";
2
2
  import { LoaderDefinitionFunction } from "webpack";
3
3
 
4
4
  //#region src/webpack/meta.d.ts
@@ -1,6 +1,6 @@
1
- import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-ClgSNqbq.js";
2
- import { t as createMetaLoader } from "../meta-B6guI74I.js";
3
- import { t as getCore } from "../webpack-CBlMzMlJ.js";
1
+ import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-BSlBR-2Y.js";
2
+ import { t as createMetaLoader } from "../meta-_7-eciVa.js";
3
+ import { t as getCore } from "../webpack-C4iZ7HjD.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-Wd5WdPN4.js";
1
+ import { n as createCore } from "./core-DlDe_Eze.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.4",
3
+ "version": "15.0.6",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -11,7 +11,7 @@
11
11
  "author": "Fuma Nama",
12
12
  "repository": "github:fuma-nama/fumadocs",
13
13
  "bin": {
14
- "fumadocs-mdx": "./dist/bin.js"
14
+ "fumadocs-mdx": "./bin.js"
15
15
  },
16
16
  "files": [
17
17
  "dist",
@@ -62,11 +62,11 @@
62
62
  "zod": "^4.4.3"
63
63
  },
64
64
  "devDependencies": {
65
- "@types/bun": "^1.3.13",
65
+ "@types/bun": "^1.3.14",
66
66
  "@types/js-yaml": "^4.0.9",
67
67
  "@types/mdast": "^4.0.4",
68
68
  "@types/mdx": "^2.0.13",
69
- "@types/node": "^25.6.2",
69
+ "@types/node": "^25.7.0",
70
70
  "@types/picomatch": "^4.0.3",
71
71
  "@types/react": "^19.2.14",
72
72
  "mdast-util-directive": "^3.1.0",
@@ -75,12 +75,12 @@
75
75
  "remark": "^15.0.1",
76
76
  "remark-directive": "^4.0.0",
77
77
  "remark-mdx": "^3.1.1",
78
- "rolldown": "1.0.0",
78
+ "rolldown": "^1.0.1",
79
79
  "tsdown": "0.22.0",
80
- "vite": "^8.0.12",
80
+ "vite": "^8.0.13",
81
81
  "webpack": "^5.106.2",
82
82
  "@fumadocs/vite": "0.0.1",
83
- "fumadocs-core": "16.8.10",
83
+ "fumadocs-core": "16.8.11",
84
84
  "tsconfig": "0.0.0"
85
85
  },
86
86
  "peerDependencies": {
@@ -1,97 +0,0 @@
1
- import { t as applyMdxPreset } from "./preset-B0H8HalE.js";
2
- import path from "node:path";
3
- import picomatch from "picomatch";
4
- //#region src/config/build.ts
5
- const SupportedFormats = {
6
- doc: ["mdx", "md"],
7
- meta: ["json", "yaml"]
8
- };
9
- function buildCollection(name, collection, cwd) {
10
- if (collection.type === "docs") return {
11
- ...collection,
12
- type: "docs",
13
- get dir() {
14
- return this.docs.dir;
15
- },
16
- name,
17
- meta: buildCollection(name, collection.meta, cwd),
18
- docs: buildCollection(name, collection.docs, cwd),
19
- hasFile(filePath) {
20
- return this.docs.hasFile(filePath) || this.meta.hasFile(filePath);
21
- },
22
- isFileSupported(filePath) {
23
- return this.docs.isFileSupported(filePath) || this.meta.isFileSupported(filePath);
24
- },
25
- cwd
26
- };
27
- return {
28
- ...collection,
29
- ...buildPrimitiveCollection(name, collection, cwd)
30
- };
31
- }
32
- function buildPrimitiveCollection(name, config, cwd) {
33
- const supportedFormats = SupportedFormats[config.type];
34
- const patterns = config.files ?? [`**/*.{${supportedFormats.join(",")}}`];
35
- let matcher;
36
- return {
37
- dir: path.resolve(cwd, config.dir),
38
- cwd,
39
- name,
40
- patterns,
41
- isFileSupported(filePath) {
42
- return supportedFormats.some((format) => filePath.endsWith(`.${format}`));
43
- },
44
- hasFile(filePath) {
45
- if (!this.isFileSupported(filePath)) return false;
46
- const relativePath = path.relative(this.dir, filePath);
47
- if (relativePath.startsWith(`..${path.sep}`)) return false;
48
- return (matcher ??= picomatch(patterns))(relativePath);
49
- }
50
- };
51
- }
52
- function buildConfig(config, cwd = process.cwd()) {
53
- const collections = /* @__PURE__ */ new Map();
54
- const loaded = {};
55
- for (const [k, v] of Object.entries(config)) {
56
- if (!v) continue;
57
- if (typeof v === "object" && "type" in v) {
58
- if (v.type === "docs" || v.type === "doc" || v.type === "meta") {
59
- collections.set(k, buildCollection(k, v, cwd));
60
- continue;
61
- }
62
- }
63
- if (k === "default" && v) {
64
- Object.assign(loaded, v);
65
- continue;
66
- }
67
- throw new Error(`Unknown export "${k}", you can only export collections from source configuration file.`);
68
- }
69
- const mdxOptionsCache = /* @__PURE__ */ new Map();
70
- return {
71
- global: loaded,
72
- collections,
73
- workspaces: Object.fromEntries(Object.entries(loaded.workspaces ?? {}).map(([key, value]) => {
74
- return [key, {
75
- dir: value.dir,
76
- config: buildConfig(value.config, path.resolve(cwd, value.dir))
77
- }];
78
- })),
79
- getMDXOptions(collection, environment = "bundler") {
80
- const key = collection ? `${environment}:${collection.name}` : environment;
81
- const cached = mdxOptionsCache.get(key);
82
- if (cached) return cached;
83
- let result;
84
- if (collection?.mdxOptions) {
85
- const optionsFn = collection.mdxOptions;
86
- result = typeof optionsFn === "function" ? optionsFn(environment) : optionsFn;
87
- } else result = (async () => {
88
- const optionsFn = this.global.mdxOptions;
89
- return applyMdxPreset(typeof optionsFn === "function" ? await optionsFn() : optionsFn)(environment);
90
- })();
91
- mdxOptionsCache.set(key, result);
92
- return result;
93
- }
94
- };
95
- }
96
- //#endregion
97
- export { buildConfig as t };
@@ -1,5 +0,0 @@
1
- //#region src/loaders/index.ts
2
- const metaLoaderGlob = /\.(json|yaml)(\?.+?)?$/;
3
- const mdxLoaderGlob = /\.mdx?(\?.+?)?$/;
4
- //#endregion
5
- export { metaLoaderGlob as n, mdxLoaderGlob as t };