fumadocs-mdx 15.0.2 → 15.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/bin.js +2 -0
  2. package/dist/{adapter-BketAUOZ.js → adapter-ClgSNqbq.js} +23 -21
  3. package/dist/{build-mdx-DeW1GoVI.js → build-mdx-Ck7r5VE4.js} +1 -1
  4. package/dist/bun/index.d.ts +1 -1
  5. package/dist/bun/index.js +2 -2
  6. package/dist/config/index.d.ts +1 -1
  7. package/dist/config/index.js +1 -1
  8. package/dist/{core-BOs29Mj7.d.ts → core-DAna8bb8.d.ts} +1 -1
  9. package/dist/dist-DV7kmyst.js +210 -0
  10. package/dist/index.d.ts +2 -2
  11. package/dist/{mdx-swV6_ZR5.js → mdx-xb45Eql8.js} +2 -1
  12. package/dist/next/index.d.ts +2 -2
  13. package/dist/next/index.js +1 -1
  14. package/dist/node/_loader.js +2 -2
  15. package/dist/node/index.d.ts +1 -1
  16. package/dist/node/index.js +1 -1
  17. package/dist/node/loader.js +2 -2
  18. package/dist/plugins/index-file.d.ts +1 -1
  19. package/dist/plugins/json-schema.d.ts +1 -1
  20. package/dist/plugins/last-modified.d.ts +1 -1
  21. package/dist/{remark-include-VDoXZSBN.js → remark-include-B1RWQhGC.js} +1 -1
  22. package/dist/rolldown/index.d.ts +10 -0
  23. package/dist/rolldown/index.js +48 -0
  24. package/dist/runtime/browser.d.ts +3 -3
  25. package/dist/runtime/dynamic.d.ts +2 -2
  26. package/dist/runtime/dynamic.js +1 -1
  27. package/dist/runtime/server.d.ts +1 -1
  28. package/dist/runtime/types.d.ts +1 -1
  29. package/dist/vite/index.d.ts +2 -2
  30. package/dist/vite/index.js +34 -34
  31. package/dist/webpack/mdx.d.ts +1 -1
  32. package/dist/webpack/mdx.js +2 -2
  33. package/dist/webpack/meta.d.ts +1 -1
  34. package/dist/webpack/meta.js +1 -1
  35. package/package.json +12 -6
  36. /package/dist/{build-mdx-YyRh-ZGV.d.ts → build-mdx-CAXqH1_C.d.ts} +0 -0
  37. /package/dist/{index-BIbaPT3v.d.ts → index-Cfo6kcGs.d.ts} +0 -0
  38. /package/dist/{types-hAduruLB.d.ts → types-DRpz2Vq2.d.ts} +0 -0
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
  }
@@ -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-BOs29Mj7.js";
1
+ import { r as CoreOptions } from "../core-DAna8bb8.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-BOs29Mj7.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-DAna8bb8.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) {
@@ -1,4 +1,4 @@
1
- import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-hAduruLB.js";
1
+ import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-DRpz2Vq2.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";
@@ -0,0 +1,210 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ //#region ../vite/dist/index.js
4
+ async function findClosestPkgJsonPath(dir, predicate) {
5
+ let currentDir = dir.endsWith("package.json") ? path.dirname(dir) : dir;
6
+ while (currentDir) {
7
+ const pkg = path.join(currentDir, "package.json");
8
+ try {
9
+ if ((await fs.stat(pkg)).isFile() && (!predicate || await predicate(pkg))) return pkg;
10
+ } catch {}
11
+ const nextDir = path.dirname(currentDir);
12
+ if (nextDir === currentDir) break;
13
+ currentDir = nextDir;
14
+ }
15
+ }
16
+ async function readJson(pkgJsonPath) {
17
+ return JSON.parse(await fs.readFile(pkgJsonPath, "utf8"));
18
+ }
19
+ var generated_default = {
20
+ optimizeDeps: {
21
+ "include": [
22
+ "@fumadocs/base-ui > rehype-raw > hast-util-raw > hast-util-to-parse5 > comma-separated-tokens",
23
+ "@fumadocs/base-ui > rehype-raw > hast-util-raw > hast-util-to-parse5 > space-separated-tokens",
24
+ "@fumadocs/base-ui > rehype-raw > hast-util-raw > html-void-elements",
25
+ "@fumadocs/base-ui > rehype-raw > hast-util-raw > mdast-util-to-hast > trim-lines",
26
+ "@fumadocs/base-ui > rehype-raw > hast-util-raw > web-namespaces",
27
+ "@fumadocs/base-ui > rehype-raw > hast-util-raw > zwitch",
28
+ "@fumadocs/base-ui > shiki > @shikijs/core > hast-util-to-html > ccount",
29
+ "@fumadocs/base-ui > shiki > @shikijs/core > hast-util-to-html > stringify-entities",
30
+ "@fumadocs/local-md > @mdx-js/mdx > collapse-white-space",
31
+ "@fumadocs/local-md > estree-util-to-js > source-map",
32
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > comma-separated-tokens",
33
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-from-markdown > decode-named-character-reference > character-entities",
34
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-from-markdown > micromark > debug",
35
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-to-markdown > longest-streak",
36
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-to-markdown > zwitch",
37
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > ccount",
38
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > parse-entities",
39
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > stringify-entities",
40
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > space-separated-tokens",
41
+ "@fumadocs/local-md > hast-util-to-jsx-runtime > style-to-js",
42
+ "@fumadocs/local-md > picomatch",
43
+ "@fumadocs/local-md > remark > unified > bail",
44
+ "@fumadocs/local-md > remark > unified > extend",
45
+ "@fumadocs/local-md > remark-rehype > mdast-util-to-hast > trim-lines",
46
+ "@fumadocs/mdx-remote > @mdx-js/mdx > collapse-white-space",
47
+ "@fumadocs/mdx-remote > @mdx-js/mdx > hast-util-to-jsx-runtime > comma-separated-tokens",
48
+ "@fumadocs/mdx-remote > @mdx-js/mdx > hast-util-to-jsx-runtime > mdast-util-mdx-expression > mdast-util-to-markdown > longest-streak",
49
+ "@fumadocs/mdx-remote > @mdx-js/mdx > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > ccount",
50
+ "@fumadocs/mdx-remote > @mdx-js/mdx > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > parse-entities",
51
+ "@fumadocs/mdx-remote > @mdx-js/mdx > hast-util-to-jsx-runtime > mdast-util-mdx-jsx > stringify-entities",
52
+ "@fumadocs/mdx-remote > @mdx-js/mdx > hast-util-to-jsx-runtime > space-separated-tokens",
53
+ "@fumadocs/mdx-remote > @mdx-js/mdx > hast-util-to-jsx-runtime > style-to-js",
54
+ "@fumadocs/mdx-remote > @mdx-js/mdx > rehype-recma > hast-util-to-estree > zwitch",
55
+ "@fumadocs/mdx-remote > @mdx-js/mdx > remark-parse > mdast-util-from-markdown > decode-named-character-reference > character-entities",
56
+ "@fumadocs/mdx-remote > @mdx-js/mdx > remark-parse > mdast-util-from-markdown > micromark > debug",
57
+ "@fumadocs/mdx-remote > @mdx-js/mdx > remark-rehype > mdast-util-to-hast > trim-lines",
58
+ "@fumadocs/mdx-remote > @mdx-js/mdx > source-map",
59
+ "@fumadocs/mdx-remote > js-yaml > argparse",
60
+ "@fumadocs/mdx-remote > unified > bail",
61
+ "@fumadocs/mdx-remote > unified > extend",
62
+ "@fumadocs/story > ts-morph",
63
+ "fumadocs-core > github-slugger",
64
+ "fumadocs-core > hast-util-to-estree > comma-separated-tokens",
65
+ "fumadocs-core > hast-util-to-estree > mdast-util-mdx-jsx > ccount",
66
+ "fumadocs-core > hast-util-to-estree > mdast-util-mdx-jsx > parse-entities",
67
+ "fumadocs-core > hast-util-to-estree > mdast-util-mdx-jsx > stringify-entities",
68
+ "fumadocs-core > hast-util-to-estree > space-separated-tokens",
69
+ "fumadocs-core > hast-util-to-estree > style-to-js",
70
+ "fumadocs-core > hast-util-to-estree > zwitch",
71
+ "fumadocs-core > js-yaml > argparse",
72
+ "fumadocs-core > mdast-util-mdx > mdast-util-from-markdown > decode-named-character-reference > character-entities",
73
+ "fumadocs-core > mdast-util-mdx > mdast-util-from-markdown > micromark > debug",
74
+ "fumadocs-core > mdast-util-to-markdown > longest-streak",
75
+ "fumadocs-core > remark-gfm > mdast-util-gfm > mdast-util-gfm-table > markdown-table",
76
+ "fumadocs-core > remark-rehype > mdast-util-to-hast > trim-lines",
77
+ "fumadocs-core > shiki > @shikijs/core > hast-util-to-html > html-void-elements",
78
+ "fumadocs-core > tinyglobby > picomatch",
79
+ "fumadocs-core > unified > bail",
80
+ "fumadocs-core > unified > extend",
81
+ "fumadocs-mdx > @mdx-js/mdx > collapse-white-space",
82
+ "fumadocs-mdx > @mdx-js/mdx > hast-util-to-jsx-runtime > comma-separated-tokens",
83
+ "fumadocs-mdx > @mdx-js/mdx > hast-util-to-jsx-runtime > space-separated-tokens",
84
+ "fumadocs-mdx > @mdx-js/mdx > hast-util-to-jsx-runtime > style-to-js",
85
+ "fumadocs-mdx > @mdx-js/mdx > remark-rehype > mdast-util-to-hast > trim-lines",
86
+ "fumadocs-mdx > @mdx-js/mdx > source-map",
87
+ "fumadocs-mdx > esbuild",
88
+ "fumadocs-mdx > js-yaml > argparse",
89
+ "fumadocs-mdx > mdast-util-mdx > mdast-util-from-markdown > decode-named-character-reference > character-entities",
90
+ "fumadocs-mdx > mdast-util-mdx > mdast-util-from-markdown > micromark > debug",
91
+ "fumadocs-mdx > mdast-util-mdx > mdast-util-mdx-jsx > ccount",
92
+ "fumadocs-mdx > mdast-util-mdx > mdast-util-mdx-jsx > parse-entities",
93
+ "fumadocs-mdx > mdast-util-mdx > mdast-util-mdx-jsx > stringify-entities",
94
+ "fumadocs-mdx > mdast-util-mdx > mdast-util-to-markdown > longest-streak",
95
+ "fumadocs-mdx > mdast-util-mdx > mdast-util-to-markdown > zwitch",
96
+ "fumadocs-mdx > picocolors",
97
+ "fumadocs-mdx > picomatch",
98
+ "fumadocs-mdx > unified > bail",
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
+ "fumadocs-twoslash > @shikijs/twoslash > @shikijs/core > hast-util-to-html > comma-separated-tokens",
119
+ "fumadocs-twoslash > @shikijs/twoslash > @shikijs/core > hast-util-to-html > html-void-elements",
120
+ "fumadocs-twoslash > @shikijs/twoslash > @shikijs/core > hast-util-to-html > space-separated-tokens",
121
+ "fumadocs-twoslash > @shikijs/twoslash > @shikijs/core > hast-util-to-html > stringify-entities",
122
+ "fumadocs-twoslash > mdast-util-from-markdown > decode-named-character-reference > character-entities",
123
+ "fumadocs-twoslash > mdast-util-from-markdown > micromark > debug",
124
+ "fumadocs-twoslash > mdast-util-gfm > mdast-util-gfm-autolink-literal > ccount",
125
+ "fumadocs-twoslash > mdast-util-gfm > mdast-util-gfm-table > markdown-table",
126
+ "fumadocs-twoslash > mdast-util-gfm > mdast-util-to-markdown > longest-streak",
127
+ "fumadocs-twoslash > mdast-util-gfm > mdast-util-to-markdown > zwitch",
128
+ "fumadocs-twoslash > mdast-util-to-hast > trim-lines",
129
+ "fumadocs-typescript > hast-util-to-estree > comma-separated-tokens",
130
+ "fumadocs-typescript > hast-util-to-estree > mdast-util-mdx-expression > mdast-util-from-markdown > decode-named-character-reference > character-entities",
131
+ "fumadocs-typescript > hast-util-to-estree > mdast-util-mdx-expression > mdast-util-from-markdown > micromark > debug",
132
+ "fumadocs-typescript > hast-util-to-estree > mdast-util-mdx-expression > mdast-util-to-markdown > longest-streak",
133
+ "fumadocs-typescript > hast-util-to-estree > mdast-util-mdx-jsx > ccount",
134
+ "fumadocs-typescript > hast-util-to-estree > mdast-util-mdx-jsx > parse-entities",
135
+ "fumadocs-typescript > hast-util-to-estree > mdast-util-mdx-jsx > stringify-entities",
136
+ "fumadocs-typescript > hast-util-to-estree > space-separated-tokens",
137
+ "fumadocs-typescript > hast-util-to-estree > style-to-js",
138
+ "fumadocs-typescript > hast-util-to-estree > zwitch",
139
+ "fumadocs-typescript > remark-rehype > mdast-util-to-hast > trim-lines",
140
+ "fumadocs-typescript > shiki > @shikijs/core > hast-util-to-html > html-void-elements",
141
+ "fumadocs-typescript > ts-morph",
142
+ "fumadocs-typescript > unified > bail",
143
+ "fumadocs-typescript > unified > extend",
144
+ "fumadocs-ui > rehype-raw > hast-util-raw > hast-util-to-parse5 > comma-separated-tokens",
145
+ "fumadocs-ui > rehype-raw > hast-util-raw > hast-util-to-parse5 > space-separated-tokens",
146
+ "fumadocs-ui > rehype-raw > hast-util-raw > html-void-elements",
147
+ "fumadocs-ui > rehype-raw > hast-util-raw > mdast-util-to-hast > trim-lines",
148
+ "fumadocs-ui > rehype-raw > hast-util-raw > web-namespaces",
149
+ "fumadocs-ui > rehype-raw > hast-util-raw > zwitch",
150
+ "fumadocs-ui > shiki > @shikijs/core > hast-util-to-html > ccount",
151
+ "fumadocs-ui > shiki > @shikijs/core > hast-util-to-html > stringify-entities"
152
+ ],
153
+ "exclude": [
154
+ "@fumadocs/base-ui",
155
+ "@fumadocs/basehub",
156
+ "@fumadocs/local-md",
157
+ "@fumadocs/mdx-remote",
158
+ "@fumadocs/sanity",
159
+ "@fumadocs/story",
160
+ "@fumadocs/tailwind",
161
+ "fumadocs-core",
162
+ "fumadocs-mdx",
163
+ "fumadocs-openapi",
164
+ "fumadocs-twoslash",
165
+ "fumadocs-typescript",
166
+ "fumadocs-ui"
167
+ ]
168
+ },
169
+ ssr: { "noExternal": [
170
+ "@fumadocs/base-ui",
171
+ "@fumadocs/basehub",
172
+ "@fumadocs/local-md",
173
+ "@fumadocs/mdx-remote",
174
+ "@fumadocs/sanity",
175
+ "@fumadocs/story",
176
+ "@fumadocs/tailwind",
177
+ "fumadocs-core",
178
+ "fumadocs-mdx",
179
+ "fumadocs-openapi",
180
+ "fumadocs-twoslash",
181
+ "fumadocs-typescript",
182
+ "fumadocs-ui"
183
+ ] }
184
+ };
185
+ async function getConfig(options) {
186
+ const pkgJsonPath = await findClosestPkgJsonPath(options.root);
187
+ if (!pkgJsonPath) return {
188
+ optimizeDeps: {
189
+ include: [],
190
+ exclude: []
191
+ },
192
+ ssr: { noExternal: [] }
193
+ };
194
+ const pkgJson = await readJson(pkgJsonPath).catch((e) => {
195
+ throw new Error(`Unable to read ${pkgJsonPath}`, { cause: e });
196
+ });
197
+ const out = structuredClone(generated_default);
198
+ const deps = /* @__PURE__ */ new Set();
199
+ if (pkgJson.dependencies) for (const name in pkgJson.dependencies) deps.add(name);
200
+ if (pkgJson.devDependencies) for (const name in pkgJson.devDependencies) deps.add(name);
201
+ out.optimizeDeps.include = out.optimizeDeps.include.filter((item) => {
202
+ const first = item.slice(0, item.indexOf(" > "));
203
+ return deps.has(first);
204
+ });
205
+ out.optimizeDeps.exclude = out.optimizeDeps.exclude.filter((item) => deps.has(item));
206
+ out.ssr.noExternal = out.ssr.noExternal.filter((item) => deps.has(item));
207
+ return out;
208
+ }
209
+ //#endregion
210
+ export { getConfig };
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-BOs29Mj7.js";
2
- import { t as CompiledMDXProperties } from "./build-mdx-YyRh-ZGV.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-DAna8bb8.js";
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-BOs29Mj7.js";
1
+ import { p as IndexFilePluginOptions } from "../core-DAna8bb8.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-BOs29Mj7.js";
1
+ import { r as CoreOptions } from "../core-DAna8bb8.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-BOs29Mj7.js";
1
+ import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-DAna8bb8.js";
2
2
  export { IndexFilePlugin, IndexFilePluginOptions, indexFile as default };
@@ -1,4 +1,4 @@
1
- import { s as Plugin } from "../core-BOs29Mj7.js";
1
+ import { s as Plugin } from "../core-DAna8bb8.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-BOs29Mj7.js";
1
+ import { s as Plugin } from "../core-DAna8bb8.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,6 +1,6 @@
1
- import { A as DocCollection, j as DocsCollection } from "../core-BOs29Mj7.js";
2
- import { i as InternalTypeConfig } from "../types-hAduruLB.js";
3
- import { t as CompiledMDXProperties } from "../build-mdx-YyRh-ZGV.js";
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";
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-BOs29Mj7.js";
2
- import { i as InternalTypeConfig, r as FileInfo } from "../types-hAduruLB.js";
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";
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,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-BOs29Mj7.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-DAna8bb8.js";
2
2
  export { AsyncDocCollectionEntry, AsyncDocsCollectionEntry, DocCollectionEntry, DocsCollectionEntry, MetaCollectionEntry, ServerCreate, ServerOptions, server, toFumadocsSource };
@@ -1,2 +1,2 @@
1
- import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, r as FileInfo, t as DocData } from "../types-hAduruLB.js";
1
+ import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, r as FileInfo, t as DocData } from "../types-DRpz2Vq2.js";
2
2
  export { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };
@@ -1,4 +1,4 @@
1
- import { p as IndexFilePluginOptions } from "../core-BOs29Mj7.js";
1
+ import { p as IndexFilePluginOptions } from "../core-DAna8bb8.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,11 +1,10 @@
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";
8
- import { crawlFrameworkPkgs } from "vitefu";
9
8
  //#region src/vite/index.ts
10
9
  async function mdx(_config, pluginOptions = {}) {
11
10
  const options = applyDefaults(pluginOptions);
@@ -15,40 +14,41 @@ async function mdx(_config, pluginOptions = {}) {
15
14
  const configLoader = createIntegratedConfigLoader(core);
16
15
  const mdxLoader = toVite(createMdxLoader(configLoader));
17
16
  const metaLoader = toVite(createMetaLoader(configLoader, { json: "json" }));
18
- return {
19
- name: "fumadocs-mdx",
20
- enforce: "pre",
21
- async config(config, { command }) {
22
- if (!options.updateViteConfig) return config;
23
- const out = await crawlFrameworkPkgs({
24
- root: process.cwd(),
25
- isBuild: command === "build",
26
- isFrameworkPkgByName(pkgName) {
27
- if (pkgName.startsWith("@fumapress/") || pkgName.startsWith("@fumadocs/") || pkgName.startsWith("fumadocs-") || pkgName === "fumapress") return true;
28
- }
29
- });
30
- return {
31
- ssr: { noExternal: out.ssr.noExternal },
32
- optimizeDeps: out.optimizeDeps
33
- };
34
- },
35
- async buildStart() {
36
- 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
+ }
37
31
  },
38
- async configureServer(server) {
39
- 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
+ }
40
42
  },
41
- async transform(value, id) {
42
- if (id.includes("virtual:vite-rsc")) return null;
43
- try {
44
- if (metaLoader.filter(id)) return await metaLoader.transform.call(this, value, id);
45
- if (mdxLoader.filter(id)) return await mdxLoader.transform.call(this, value, id);
46
- } catch (e) {
47
- if (e instanceof ValidationError) throw new Error(await e.toStringFormatted(), { cause: e });
48
- throw e;
43
+ {
44
+ name: "fumadocs-mdx:meta",
45
+ enforce: "pre",
46
+ transform: {
47
+ filter: metaLoader.filter,
48
+ handler: metaLoader.transform
49
49
  }
50
50
  }
51
- };
51
+ ];
52
52
  }
53
53
  async function postInstall(pluginOptions = {}) {
54
54
  const { loadConfig } = await import("../load-from-file--MfW8a2Z.js").then((n) => n.n);
@@ -1,4 +1,4 @@
1
- import { t as WebpackLoaderOptions } from "../index-BIbaPT3v.js";
1
+ import { t as WebpackLoaderOptions } from "../index-Cfo6kcGs.js";
2
2
  import { LoaderDefinitionFunction } from "webpack";
3
3
 
4
4
  //#region src/webpack/mdx.d.ts
@@ -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 { t as WebpackLoaderOptions } from "../index-BIbaPT3v.js";
1
+ import { t as WebpackLoaderOptions } from "../index-Cfo6kcGs.js";
2
2
  import { LoaderDefinitionFunction } from "webpack";
3
3
 
4
4
  //#region src/webpack/meta.d.ts
@@ -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.2",
3
+ "version": "15.0.4",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -14,7 +14,8 @@
14
14
  "fumadocs-mdx": "./dist/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",
@@ -57,7 +59,6 @@
57
59
  "unist-util-remove-position": "^5.0.0",
58
60
  "unist-util-visit": "^5.1.0",
59
61
  "vfile": "^6.0.3",
60
- "vitefu": "^1.1.3",
61
62
  "zod": "^4.4.3"
62
63
  },
63
64
  "devDependencies": {
@@ -76,10 +77,11 @@
76
77
  "remark-mdx": "^3.1.1",
77
78
  "rolldown": "1.0.0",
78
79
  "tsdown": "0.22.0",
79
- "vite": "^8.0.11",
80
+ "vite": "^8.0.12",
80
81
  "webpack": "^5.106.2",
81
- "tsconfig": "0.0.0",
82
- "fumadocs-core": "16.8.9"
82
+ "@fumadocs/vite": "0.0.1",
83
+ "fumadocs-core": "16.8.10",
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
  },