fumadocs-mdx 15.0.3 → 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.
- package/bin.js +2 -0
- package/dist/{adapter-BketAUOZ.js → adapter-ClgSNqbq.js} +23 -21
- package/dist/{build-mdx-DeW1GoVI.js → build-mdx-Ck7r5VE4.js} +1 -1
- package/dist/bun/index.js +2 -2
- package/dist/config/index.js +1 -1
- package/dist/{mdx-swV6_ZR5.js → mdx-xb45Eql8.js} +2 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +1 -1
- package/dist/node/_loader.js +2 -2
- package/dist/node/index.js +1 -1
- package/dist/node/loader.js +2 -2
- package/dist/{remark-include-VDoXZSBN.js → remark-include-B1RWQhGC.js} +1 -1
- package/dist/rolldown/index.d.ts +10 -0
- package/dist/rolldown/index.js +48 -0
- package/dist/runtime/dynamic.js +1 -1
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +34 -24
- package/dist/webpack/mdx.js +2 -2
- package/dist/webpack/meta.js +1 -1
- package/package.json +11 -5
package/bin.js
ADDED
|
@@ -58,29 +58,31 @@ function toNode(loader) {
|
|
|
58
58
|
}
|
|
59
59
|
function toVite(loader) {
|
|
60
60
|
return {
|
|
61
|
-
filter
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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-
|
|
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";
|
package/dist/bun/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
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-
|
|
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
|
package/dist/config/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as applyMdxPreset } from "../preset-B0H8HalE.js";
|
|
2
|
-
import { t as remarkInclude } from "../remark-include-
|
|
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) {
|
|
@@ -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-
|
|
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?.();
|
package/dist/next/index.d.ts
CHANGED
|
@@ -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
|
|
19
|
+
declare function postInstall(options?: CreateMDXOptions): Promise<void>;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { CreateMDXOptions, createMDX, postInstall };
|
package/dist/next/index.js
CHANGED
|
@@ -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 });
|
package/dist/node/_loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
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-
|
|
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;
|
package/dist/node/index.js
CHANGED
|
@@ -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.
|
|
4
|
+
module.register("./_loader.js", import.meta.url, { data: options });
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
7
|
export { register };
|
package/dist/node/loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
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-
|
|
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({
|
|
@@ -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 };
|
package/dist/runtime/dynamic.js
CHANGED
|
@@ -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-
|
|
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";
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -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 };
|
package/dist/vite/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-xb45Eql8.js";
|
|
2
2
|
import { t as buildConfig } from "../build-DPafU2lu.js";
|
|
3
|
-
import { n as createCore,
|
|
4
|
-
import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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);
|
package/dist/webpack/mdx.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
2
|
-
import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-
|
|
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;
|
package/dist/webpack/meta.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-
|
|
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
|
+
"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",
|
|
@@ -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.
|
|
80
|
+
"vite": "^8.0.12",
|
|
79
81
|
"webpack": "^5.106.2",
|
|
80
82
|
"@fumadocs/vite": "0.0.1",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
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
|
},
|