fumadocs-mdx 15.0.3 → 15.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './dist/bin.js';
@@ -58,29 +58,31 @@ function toNode(loader) {
58
58
  }
59
59
  function toVite(loader) {
60
60
  return {
61
- filter(id) {
62
- return !loader.test || loader.test.test(id);
63
- },
61
+ filter: { id: loader.test },
64
62
  async transform(value, id) {
65
- const environment = this.environment;
66
63
  const [file, query = ""] = id.split("?", 2);
67
- const result = await loader.load({
68
- filePath: file,
69
- query: parse(query),
70
- getSource() {
71
- return value;
72
- },
73
- development: environment.mode === "dev",
74
- compiler: { addDependency: (file) => {
75
- this.addWatchFile(file);
76
- } }
77
- });
78
- if (result === null) return null;
79
- return {
80
- code: result.code,
81
- map: result.map,
82
- moduleType: result.moduleType
83
- };
64
+ try {
65
+ const result = await loader.load({
66
+ filePath: file,
67
+ query: parse(query),
68
+ getSource() {
69
+ return value;
70
+ },
71
+ development: this.environment ? this.environment.mode === "dev" : false,
72
+ compiler: { addDependency: (file) => {
73
+ this.addWatchFile(file);
74
+ } }
75
+ });
76
+ if (result === null) return null;
77
+ return {
78
+ code: result.code,
79
+ map: result.map,
80
+ moduleType: result.moduleType
81
+ };
82
+ } catch (e) {
83
+ if (e instanceof ValidationError) throw new Error(await e.toStringFormatted(), { cause: e });
84
+ throw e;
85
+ }
84
86
  }
85
87
  };
86
88
  }
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-VDoXZSBN.js";
2
+ import { n as flattenNode, t as remarkInclude } from "./remark-include-B1RWQhGC.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-DM-l-bvr.js";
2
2
  import { BunPlugin } from "bun";
3
3
 
4
4
  //#region src/bun/index.d.ts
package/dist/bun/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { t as createMdxLoader } from "../mdx-swV6_ZR5.js";
1
+ import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
2
  import { t as buildConfig } from "../build-DPafU2lu.js";
3
3
  import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
4
- import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-BketAUOZ.js";
4
+ import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-ClgSNqbq.js";
5
5
  import { t as createMetaLoader } from "../meta-B6guI74I.js";
6
6
  import { pathToFileURL } from "node:url";
7
7
  //#region src/bun/index.ts
@@ -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-DM-l-bvr.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-VDoXZSBN.js";
2
+ import { t as remarkInclude } from "../remark-include-B1RWQhGC.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) {
@@ -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
  }>;
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";
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-DM-l-bvr.js";
2
2
  import { t as CompiledMDXProperties } from "./build-mdx-CAXqH1_C.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 };
@@ -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-DeW1GoVI.js").then((n) => n.n);
61
+ const { buildMDX } = await import("./build-mdx-Ck7r5VE4.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,
@@ -69,6 +69,7 @@ function createMdxLoader({ getCore }) {
69
69
  });
70
70
  const out = {
71
71
  code: String(compiled.value),
72
+ moduleType: "js",
72
73
  map: compiled.map
73
74
  };
74
75
  await after?.();
@@ -1,4 +1,4 @@
1
- import { p as IndexFilePluginOptions } from "../core-DAna8bb8.js";
1
+ import { p as IndexFilePluginOptions } from "../core-DM-l-bvr.js";
2
2
  import { NextConfig } from "next";
3
3
 
4
4
  //#region src/next/index.d.ts
@@ -16,6 +16,6 @@ interface CreateMDXOptions {
16
16
  index?: IndexFilePluginOptions | false;
17
17
  }
18
18
  declare function createMDX(createOptions?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
19
- declare function postInstall(options: CreateMDXOptions): Promise<void>;
19
+ declare function postInstall(options?: CreateMDXOptions): Promise<void>;
20
20
  //#endregion
21
21
  export { CreateMDXOptions, createMDX, postInstall };
@@ -121,7 +121,7 @@ async function init(dev, core) {
121
121
  await initOrReload();
122
122
  if (dev) await devServer();
123
123
  }
124
- async function postInstall(options) {
124
+ async function postInstall(options = {}) {
125
125
  const core = createNextCore(applyDefaults(options));
126
126
  await core.init({ config: loadConfig(core, true) });
127
127
  await core.emit({ write: true });
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-swV6_ZR5.js";
1
+ import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
2
  import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
3
- import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-BketAUOZ.js";
3
+ import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-ClgSNqbq.js";
4
4
  import { t as createMetaLoader } from "../meta-B6guI74I.js";
5
5
  //#region src/node/_loader.ts
6
6
  let cachedLoaders;
@@ -1,4 +1,4 @@
1
- import { r as CoreOptions } from "../core-DAna8bb8.js";
1
+ import { r as CoreOptions } from "../core-DM-l-bvr.js";
2
2
 
3
3
  //#region src/node/index.d.ts
4
4
  interface NodeLoaderOptions extends Partial<CoreOptions> {
@@ -1,7 +1,7 @@
1
1
  import * as module from "node:module";
2
2
  //#region src/node/index.ts
3
3
  function register(options = {}) {
4
- module.register("./_loader.mjs", import.meta.url, { data: options });
4
+ module.register("./_loader.js", import.meta.url, { data: options });
5
5
  }
6
6
  //#endregion
7
7
  export { register };
@@ -1,6 +1,6 @@
1
- import { t as createMdxLoader } from "../mdx-swV6_ZR5.js";
1
+ import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
2
  import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
3
- import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-BketAUOZ.js";
3
+ import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-ClgSNqbq.js";
4
4
  import { t as createMetaLoader } from "../meta-B6guI74I.js";
5
5
  //#region src/node/loader.ts
6
6
  const configLoader = createStandaloneConfigLoader({
@@ -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-DM-l-bvr.js";
2
2
  export { IndexFilePlugin, IndexFilePluginOptions, indexFile as default };
@@ -1,4 +1,4 @@
1
- import { s as Plugin } from "../core-DAna8bb8.js";
1
+ import { s as Plugin } from "../core-DM-l-bvr.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-DM-l-bvr.js";
2
2
 
3
3
  //#region src/plugins/last-modified.d.ts
4
4
  type VersionControlFn = (filePath: string) => Promise<Date | null | undefined>;
@@ -226,7 +226,7 @@ function remarkInclude() {
226
226
  if (specifier.length === 0) return "skip";
227
227
  const attributes = parseElementAttributes(node);
228
228
  const { file: relativePath, section } = parseSpecifier(specifier);
229
- const targetPath = path$1.resolve("cwd" in attributes ? file.cwd : file.dirname, relativePath);
229
+ const targetPath = path$1.resolve("cwd" in attributes || !file.dirname ? file.cwd : file.dirname, relativePath);
230
230
  queue.push(embedContent(targetPath, section, attributes, file).then((replace) => {
231
231
  Object.assign(parent && parent.type === "paragraph" ? parent : node, replace);
232
232
  }));
@@ -0,0 +1,10 @@
1
+ import { RolldownPlugin } from "rolldown";
2
+
3
+ //#region src/rolldown/index.d.ts
4
+ interface PluginOptions {
5
+ configPath?: string;
6
+ outDir?: string;
7
+ }
8
+ declare function mdx(config: Record<string, unknown> | Promise<Record<string, unknown>>, options?: PluginOptions): Promise<RolldownPlugin[]>;
9
+ //#endregion
10
+ export { PluginOptions, mdx as default };
@@ -0,0 +1,48 @@
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";
7
+ import fs from "node:fs/promises";
8
+ //#region src/rolldown/index.ts
9
+ async function mdx(config, options) {
10
+ const core = createCore({
11
+ configPath: options?.configPath ?? _Defaults.configPath,
12
+ outDir: options?.outDir ?? _Defaults.outDir,
13
+ environment: "rolldown"
14
+ });
15
+ await core.init({ config: buildConfig(await config) });
16
+ const configLoader = createIntegratedConfigLoader(core);
17
+ const mdxLoader = toVite(createMdxLoader(configLoader));
18
+ const metaLoader = toVite(createMetaLoader(configLoader, { json: "json" }));
19
+ return [
20
+ {
21
+ name: "fumadocs-mdx",
22
+ load: {
23
+ filter: { id: [metaLoaderGlob, mdxLoaderGlob] },
24
+ async handler(id) {
25
+ const idx = id.lastIndexOf("?");
26
+ if (idx === -1) return null;
27
+ return fs.readFile(id.slice(0, idx), "utf-8");
28
+ }
29
+ }
30
+ },
31
+ {
32
+ name: "fumadocs-mdx:mdx",
33
+ transform: {
34
+ filter: mdxLoader.filter,
35
+ handler: mdxLoader.transform
36
+ }
37
+ },
38
+ {
39
+ name: "fumadocs-mdx:meta",
40
+ transform: {
41
+ filter: metaLoader.filter,
42
+ handler: metaLoader.transform
43
+ }
44
+ }
45
+ ];
46
+ }
47
+ //#endregion
48
+ export { mdx as default };
@@ -1,4 +1,4 @@
1
- import { A as DocCollection, j as DocsCollection } from "../core-DAna8bb8.js";
1
+ import { A as DocCollection, j as DocsCollection } from "../core-DM-l-bvr.js";
2
2
  import { i as InternalTypeConfig } from "../types-DRpz2Vq2.js";
3
3
  import { t as CompiledMDXProperties } from "../build-mdx-CAXqH1_C.js";
4
4
  import { FC, ReactNode } from "react";
@@ -1,4 +1,4 @@
1
- import { A as DocCollection, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, j as DocsCollection, r as CoreOptions, x as ServerOptions } from "../core-DAna8bb8.js";
1
+ import { A as DocCollection, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, j as DocsCollection, r as CoreOptions, x as ServerOptions } from "../core-DM-l-bvr.js";
2
2
  import { i as InternalTypeConfig, r as FileInfo } from "../types-DRpz2Vq2.js";
3
3
  import * as _$_standard_schema_spec0 from "@standard-schema/spec";
4
4
  import * as _$fumadocs_core_source0 from "fumadocs-core/source";
@@ -1,6 +1,6 @@
1
1
  import { t as buildConfig } from "../build-DPafU2lu.js";
2
2
  import { n as createCore } from "../core-Wd5WdPN4.js";
3
- import { t as buildMDX } from "../build-mdx-DeW1GoVI.js";
3
+ import { t as buildMDX } from "../build-mdx-Ck7r5VE4.js";
4
4
  import { server } from "./server.js";
5
5
  import { frontmatter } from "fumadocs-core/content/md/frontmatter";
6
6
  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-DM-l-bvr.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,4 +1,4 @@
1
- import { p as IndexFilePluginOptions } from "../core-DAna8bb8.js";
1
+ import { p as IndexFilePluginOptions } from "../core-DM-l-bvr.js";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/vite/index.d.ts
@@ -26,7 +26,7 @@ interface PluginOptions {
26
26
  */
27
27
  outDir?: string;
28
28
  }
29
- declare function mdx(_config?: Record<string, unknown> | Promise<Record<string, unknown>>, pluginOptions?: PluginOptions): Promise<Plugin>;
29
+ declare function mdx(_config?: Record<string, unknown> | Promise<Record<string, unknown>>, pluginOptions?: PluginOptions): Promise<Plugin[]>;
30
30
  declare function postInstall(pluginOptions?: PluginOptions): Promise<void>;
31
31
  //#endregion
32
32
  export { PluginOptions, mdx as default, postInstall };
@@ -1,7 +1,7 @@
1
- import { t as createMdxLoader } from "../mdx-swV6_ZR5.js";
1
+ import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
2
  import { t as buildConfig } from "../build-DPafU2lu.js";
3
- import { n as createCore, r as ValidationError, t as _Defaults } from "../core-Wd5WdPN4.js";
4
- import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-BketAUOZ.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
5
  import { t as createMetaLoader } from "../meta-B6guI74I.js";
6
6
  import { t as indexFile } from "../index-file-CyGG-8n8.js";
7
7
  import { runnerImport } from "vite";
@@ -14,31 +14,41 @@ async function mdx(_config, pluginOptions = {}) {
14
14
  const configLoader = createIntegratedConfigLoader(core);
15
15
  const mdxLoader = toVite(createMdxLoader(configLoader));
16
16
  const metaLoader = toVite(createMetaLoader(configLoader, { json: "json" }));
17
- return {
18
- name: "fumadocs-mdx",
19
- enforce: "pre",
20
- async config() {
21
- if (!options.updateViteConfig) return;
22
- const { getConfig } = await import("../dist-DV7kmyst.js");
23
- return getConfig({ root: process.cwd() });
24
- },
25
- async buildStart() {
26
- await core.emit({ write: true });
17
+ return [
18
+ {
19
+ name: "fumadocs-mdx",
20
+ async config() {
21
+ if (!options.updateViteConfig) return;
22
+ const { getConfig } = await import("../dist-DV7kmyst.js");
23
+ return getConfig({ root: process.cwd() });
24
+ },
25
+ async buildStart() {
26
+ await core.emit({ write: true });
27
+ },
28
+ async configureServer(server) {
29
+ await core.initServer({ watcher: server.watcher });
30
+ }
27
31
  },
28
- async configureServer(server) {
29
- await core.initServer({ watcher: server.watcher });
32
+ {
33
+ name: "fumadocs-mdx:mdx",
34
+ enforce: "pre",
35
+ transform: {
36
+ filter: mdxLoader.filter,
37
+ async handler(code, id) {
38
+ if (id.includes("virtual:vite-rsc")) return null;
39
+ return await mdxLoader.transform.call(this, code, id);
40
+ }
41
+ }
30
42
  },
31
- async transform(value, id) {
32
- if (id.includes("virtual:vite-rsc")) return null;
33
- try {
34
- if (metaLoader.filter(id)) return await metaLoader.transform.call(this, value, id);
35
- if (mdxLoader.filter(id)) return await mdxLoader.transform.call(this, value, id);
36
- } catch (e) {
37
- if (e instanceof ValidationError) throw new Error(await e.toStringFormatted(), { cause: e });
38
- throw e;
43
+ {
44
+ name: "fumadocs-mdx:meta",
45
+ enforce: "pre",
46
+ transform: {
47
+ filter: metaLoader.filter,
48
+ handler: metaLoader.transform
39
49
  }
40
50
  }
41
- };
51
+ ];
42
52
  }
43
53
  async function postInstall(pluginOptions = {}) {
44
54
  const { loadConfig } = await import("../load-from-file--MfW8a2Z.js").then((n) => n.n);
@@ -1,5 +1,5 @@
1
- import { t as createMdxLoader } from "../mdx-swV6_ZR5.js";
2
- import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-BketAUOZ.js";
1
+ import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
2
+ import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-ClgSNqbq.js";
3
3
  import { t as getCore } from "../webpack-CBlMzMlJ.js";
4
4
  //#region src/webpack/mdx.ts
5
5
  let instance;
@@ -1,4 +1,4 @@
1
- import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-BketAUOZ.js";
1
+ import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-ClgSNqbq.js";
2
2
  import { t as createMetaLoader } from "../meta-B6guI74I.js";
3
3
  import { t as getCore } from "../webpack-CBlMzMlJ.js";
4
4
  //#region src/webpack/meta.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "15.0.3",
3
+ "version": "15.0.5",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -11,10 +11,11 @@
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
- "dist"
17
+ "dist",
18
+ "bin.js"
18
19
  ],
19
20
  "type": "module",
20
21
  "exports": {
@@ -29,6 +30,7 @@
29
30
  "./plugins/index-file": "./dist/plugins/index-file.js",
30
31
  "./plugins/json-schema": "./dist/plugins/json-schema.js",
31
32
  "./plugins/last-modified": "./dist/plugins/last-modified.js",
33
+ "./rolldown": "./dist/rolldown/index.js",
32
34
  "./runtime/browser": "./dist/runtime/browser.js",
33
35
  "./runtime/dynamic": "./dist/runtime/dynamic.js",
34
36
  "./runtime/server": "./dist/runtime/server.js",
@@ -75,11 +77,11 @@
75
77
  "remark-mdx": "^3.1.1",
76
78
  "rolldown": "1.0.0",
77
79
  "tsdown": "0.22.0",
78
- "vite": "^8.0.11",
80
+ "vite": "^8.0.12",
79
81
  "webpack": "^5.106.2",
80
82
  "@fumadocs/vite": "0.0.1",
81
- "tsconfig": "0.0.0",
82
- "fumadocs-core": "16.8.10"
83
+ "fumadocs-core": "16.8.11",
84
+ "tsconfig": "0.0.0"
83
85
  },
84
86
  "peerDependencies": {
85
87
  "@types/mdast": "*",
@@ -89,9 +91,13 @@
89
91
  "mdast-util-directive": "*",
90
92
  "next": "^15.3.0 || ^16.0.0",
91
93
  "react": "^19.2.0",
94
+ "rolldown": "*",
92
95
  "vite": "7.x.x || 8.x.x"
93
96
  },
94
97
  "peerDependenciesMeta": {
98
+ "rolldown": {
99
+ "optional": true
100
+ },
95
101
  "mdast-util-directive": {
96
102
  "optional": true
97
103
  },