fumadocs-mdx 15.4.5 → 15.4.7
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/dist/bin.js +0 -0
- package/dist/{build-JzZIalDH.js → build-H2VN-Hpm.js} +1 -1
- package/dist/{build-default-BYsCF-c1.js → build-default-CSiWktEh.js} +6 -6
- package/dist/bun/index.d.ts +1 -1
- package/dist/bun/index.js +3 -3
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +1 -1
- package/dist/{core-b6wXL1QY.d.ts → core-6H7qqwEM.d.ts} +2 -2
- package/dist/{eval-Cldqy98u.js → eval-DxGmVc3G.js} +1 -1
- package/dist/{index-BpgSE-Hl.d.ts → index-CIxuOQ_6.d.ts} +1 -1
- package/dist/{index-BQOS0ghC.d.ts → index-DosG5f9I.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/macro/index.d.ts +1 -1
- package/dist/{mdx-d_f7mjEH.js → mdx-D0Qtc99b.js} +1 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/node/_loader.js +3 -3
- package/dist/node/index.d.ts +1 -1
- package/dist/node/loader.js +1 -1
- package/dist/plugins/index-file.d.ts +1 -1
- package/dist/plugins/json-schema.d.ts +1 -1
- package/dist/plugins/last-modified.d.ts +1 -1
- package/dist/{remark-include-B6rmf4sh.js → remark-include-WlmaWKPS.js} +39 -21
- package/dist/rolldown/index.d.ts +1 -1
- package/dist/rolldown/index.js +3 -3
- package/dist/runtime/browser.d.ts +1 -1
- package/dist/runtime/dynamic.d.ts +2 -2
- package/dist/runtime/dynamic.js +1 -1
- package/dist/runtime/server.d.ts +2 -2
- package/dist/runtime/server.js +1 -1
- package/dist/{transform-BFCOrnrx.js → transform-YLS_tnU6.js} +9 -6
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +3 -3
- package/dist/webpack/macro.d.ts +1 -1
- package/dist/webpack/macro.js +1 -1
- package/dist/webpack/mdx.d.ts +1 -1
- package/dist/webpack/mdx.js +2 -2
- package/dist/webpack/meta.d.ts +1 -1
- package/dist/webpack/meta.js +1 -1
- package/dist/{webpack-OuhCGO35.js → webpack-IV_nHZIH.js} +1 -1
- package/package.json +10 -11
package/dist/bin.js
CHANGED
|
File without changes
|
|
@@ -6,7 +6,7 @@ async function buildMDX(core, collection, options) {
|
|
|
6
6
|
const { buildSatteriMDX } = await import("./build-satteri-DUjpwpvb.js");
|
|
7
7
|
return buildSatteriMDX(core, collection, options);
|
|
8
8
|
}
|
|
9
|
-
const { buildJSMDX } = await import("./build-default-
|
|
9
|
+
const { buildJSMDX } = await import("./build-default-CSiWktEh.js");
|
|
10
10
|
return buildJSMDX(core, collection, options);
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as flattenNode, r as
|
|
1
|
+
import { i as applyMdxPreset, n as flattenNode, r as walk, t as remarkInclude } from "./remark-include-WlmaWKPS.js";
|
|
2
2
|
import { t as resolveLastModified } from "./last-modified-BkZYFKSh.js";
|
|
3
|
-
import { visit } from "unist-util-visit";
|
|
4
3
|
import { VFile } from "vfile";
|
|
5
4
|
import { createProcessor } from "@mdx-js/mdx";
|
|
6
5
|
import { valueToEstree } from "estree-util-value-to-estree";
|
|
@@ -14,8 +13,8 @@ import { remarkLLMs } from "fumadocs-core/mdx-plugins/remark-llms";
|
|
|
14
13
|
function remarkPostprocess({ includeProcessedMarkdown = false, includeMDAST = false, extractLinkReferences = false, valueToExport = [] }) {
|
|
15
14
|
return (tree, file) => {
|
|
16
15
|
const frontmatter = file.data.frontmatter ??= {};
|
|
17
|
-
if (!frontmatter.title)
|
|
18
|
-
if (node.depth === 1) {
|
|
16
|
+
if (!frontmatter.title) walk(tree, (node) => {
|
|
17
|
+
if (node.type === "heading" && node.depth === 1) {
|
|
19
18
|
frontmatter.title = flattenNode(node);
|
|
20
19
|
return false;
|
|
21
20
|
}
|
|
@@ -27,7 +26,8 @@ function remarkPostprocess({ includeProcessedMarkdown = false, includeMDAST = fa
|
|
|
27
26
|
});
|
|
28
27
|
if (extractLinkReferences) {
|
|
29
28
|
const urls = [];
|
|
30
|
-
|
|
29
|
+
walk(tree, (node) => {
|
|
30
|
+
if (node.type !== "link") return;
|
|
31
31
|
urls.push({ href: node.url });
|
|
32
32
|
return "skip";
|
|
33
33
|
});
|
|
@@ -36,7 +36,7 @@ function remarkPostprocess({ includeProcessedMarkdown = false, includeMDAST = fa
|
|
|
36
36
|
value: urls
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
if (includeProcessedMarkdown) remarkLLMs
|
|
39
|
+
if (includeProcessedMarkdown) remarkLLMs(typeof includeProcessedMarkdown === "object" ? includeProcessedMarkdown : void 0)(tree, file, () => void 0);
|
|
40
40
|
if (includeMDAST) {
|
|
41
41
|
const options = includeMDAST === true ? {} : includeMDAST;
|
|
42
42
|
let serialized = tree;
|
package/dist/bun/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as CoreOptions } from "../core-
|
|
1
|
+
import { r as CoreOptions } from "../core-6H7qqwEM.js";
|
|
2
2
|
import { n as ResolvedMacroOptions, t as MacroPluginOption } from "../options-aB6xV-d7.js";
|
|
3
3
|
import { BunPlugin } from "bun";
|
|
4
4
|
//#region src/bun/index.d.ts
|
package/dist/bun/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-D0Qtc99b.js";
|
|
2
2
|
import { i as buildConfig, t as createCore } from "../core-DTiWJ6t1.js";
|
|
3
3
|
import { r as slash } from "../codegen-CNSKFlLn.js";
|
|
4
4
|
import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-XBO81DIE.js";
|
|
@@ -44,7 +44,7 @@ function createMdxPlugin(options = {}) {
|
|
|
44
44
|
await core.init({ config: buildConfig(configExports, process.cwd()) });
|
|
45
45
|
if (macroOptions) {
|
|
46
46
|
const root = process.cwd();
|
|
47
|
-
const { MacroCollector } = await import("../eval-
|
|
47
|
+
const { MacroCollector } = await import("../eval-DxGmVc3G.js").then((n) => n.r);
|
|
48
48
|
const pendingEvals = /* @__PURE__ */ new Map();
|
|
49
49
|
core.macro = new MacroCollector({
|
|
50
50
|
root,
|
|
@@ -76,7 +76,7 @@ function createMdxPlugin(options = {}) {
|
|
|
76
76
|
contents: await transform(source, file) ?? source,
|
|
77
77
|
loader
|
|
78
78
|
};
|
|
79
|
-
const { transformMacroModule } = await import("../transform-
|
|
79
|
+
const { transformMacroModule } = await import("../transform-YLS_tnU6.js").then((n) => n.i);
|
|
80
80
|
return {
|
|
81
81
|
contents: (await transformMacroModule({
|
|
82
82
|
code: source,
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as DocsCollection, D as defineCollections, E as SatteriPresetOptions, F as DefaultMDXOptions, I as MDXPresetOptions, L as applyMdxPreset, O as defineConfig, P as PostprocessOptions, S as DocCollectionSatteri, T as MetaCollection, _ as BaseCollection, b as DocCollectionBase, g as AnyCollection, k as defineDocs, v as CollectionSchema, w as GlobalConfig, x as DocCollectionMdx, y as DocCollection } from "../core-
|
|
2
|
-
import { n as metaSchema, r as remarkInclude, t as frontmatterSchema } from "../index-
|
|
1
|
+
import { C as DocsCollection, D as defineCollections, E as SatteriPresetOptions, F as DefaultMDXOptions, I as MDXPresetOptions, L as applyMdxPreset, O as defineConfig, P as PostprocessOptions, S as DocCollectionSatteri, T as MetaCollection, _ as BaseCollection, b as DocCollectionBase, g as AnyCollection, k as defineDocs, v as CollectionSchema, w as GlobalConfig, x as DocCollectionMdx, y as DocCollection } from "../core-6H7qqwEM.js";
|
|
2
|
+
import { n as metaSchema, r as remarkInclude, t as frontmatterSchema } from "../index-DosG5f9I.js";
|
|
3
3
|
export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocCollectionBase, DocCollectionMdx, DocCollectionSatteri, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, type PostprocessOptions, type SatteriPresetOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
|
package/dist/config/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as defineConfig, r as defineDocs, t as defineCollections } from "../define-BW5lveuc.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as applyMdxPreset, t as remarkInclude } from "../remark-include-WlmaWKPS.js";
|
|
3
3
|
import { metaSchema as metaSchema$1, pageSchema } from "fumadocs-core/source/schema";
|
|
4
4
|
//#region src/config/index.ts
|
|
5
5
|
/** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
|
|
2
|
-
import { Pluggable,
|
|
2
|
+
import { Pluggable, Transformer } from "unified";
|
|
3
3
|
import * as Plugins from "fumadocs-core/mdx-plugins";
|
|
4
4
|
import { LLMsOptions, StructuredData } from "fumadocs-core/mdx-plugins";
|
|
5
5
|
import { VFile } from "vfile";
|
|
@@ -48,7 +48,7 @@ interface PostprocessOptions {
|
|
|
48
48
|
*/
|
|
49
49
|
valueToExport?: string[];
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* export the Markdown of documents via `_markdown`, generated by `remarkLLMs`.
|
|
52
52
|
*/
|
|
53
53
|
includeProcessedMarkdown?: boolean | LLMsOptions;
|
|
54
54
|
/**
|
|
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
|
2
2
|
import { r as buildCollection } from "./core-DTiWJ6t1.js";
|
|
3
3
|
import { r as slash } from "./codegen-CNSKFlLn.js";
|
|
4
4
|
import { r as defineDocs } from "./define-BW5lveuc.js";
|
|
5
|
-
import { n as transformMacroConfigModule, t as parseMacroId } from "./transform-
|
|
5
|
+
import { n as transformMacroConfigModule, t as parseMacroId } from "./transform-YLS_tnU6.js";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { N as ExtractedReference, a as EmitOptions, c as PluginContext, d as TransformOptions, i as EmitEntry, j as CompiledMDXProperties, l as PluginOption, n as Core, o as EmitOutput, r as CoreOptions, s as Plugin, t as CompilationContext, u as ServerContext } from "./core-
|
|
1
|
+
import { N as ExtractedReference, a as EmitOptions, c as PluginContext, d as TransformOptions, i as EmitEntry, j as CompiledMDXProperties, l as PluginOption, n as Core, o as EmitOutput, r as CoreOptions, s as Plugin, t as CompilationContext, u as ServerContext } from "./core-6H7qqwEM.js";
|
|
2
2
|
export type { CompilationContext, CompiledMDXProperties, Core, CoreOptions, EmitEntry, EmitOptions, EmitOutput, ExtractedReference, Plugin, PluginContext, PluginOption, ServerContext, TransformOptions };
|
package/dist/macro/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SatteriOptionsInput, N as ExtractedReference, P as PostprocessOptions, h as BuildEnvironment, v as CollectionSchema } from "../core-
|
|
1
|
+
import { A as SatteriOptionsInput, N as ExtractedReference, P as PostprocessOptions, h as BuildEnvironment, v as CollectionSchema } from "../core-6H7qqwEM.js";
|
|
2
2
|
import { MacroAsyncDocCollection, MacroAsyncDocsCollection, MacroDocCollection, MacroDocsCollection, MacroMetaCollection } from "../runtime/macro.js";
|
|
3
3
|
import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
|
|
4
4
|
import { MetaData, PageData } from "fumadocs-core/source";
|
|
@@ -60,7 +60,7 @@ function createMdxLoader({ getCore }) {
|
|
|
60
60
|
source: value
|
|
61
61
|
}, matter.data);
|
|
62
62
|
if (only === "frontmatter") return { code: `export const frontmatter = ${JSON.stringify(matter.data)}` };
|
|
63
|
-
const { buildMDX } = await import("./build-
|
|
63
|
+
const { buildMDX } = await import("./build-H2VN-Hpm.js").then((n) => n.n);
|
|
64
64
|
const compiled = await buildMDX(core, docCollection, {
|
|
65
65
|
isDevelopment,
|
|
66
66
|
source: "\n".repeat(countLines(matter.matter)) + matter.content,
|
package/dist/next/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as IndexFilePluginOptions, r as CoreOptions } from "../core-
|
|
1
|
+
import { p as IndexFilePluginOptions, r as CoreOptions } from "../core-6H7qqwEM.js";
|
|
2
2
|
import { t as MacroPluginOption } from "../options-aB6xV-d7.js";
|
|
3
3
|
import { NextConfig } from "next";
|
|
4
4
|
//#region src/next/index.d.ts
|
package/dist/node/_loader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-D0Qtc99b.js";
|
|
2
2
|
import { t as createCore } from "../core-DTiWJ6t1.js";
|
|
3
3
|
import { r as slash } from "../codegen-CNSKFlLn.js";
|
|
4
4
|
import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-XBO81DIE.js";
|
|
5
5
|
import { t as createMetaLoader } from "../meta-BR_rkCyY.js";
|
|
6
6
|
import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-DWC_Uwqq.js";
|
|
7
7
|
import { n as createMacroMatcher, r as resolveMacroOptions } from "../options-BNnYUjkM.js";
|
|
8
|
-
import { n as createNodeEvaluator, t as MacroCollector } from "../eval-
|
|
8
|
+
import { n as createNodeEvaluator, t as MacroCollector } from "../eval-DxGmVc3G.js";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
//#region src/node/_loader.ts
|
|
@@ -20,7 +20,7 @@ function toNodeMacro(options, root) {
|
|
|
20
20
|
const loaded = await nextLoad(url, context);
|
|
21
21
|
const code = loaded.source?.toString();
|
|
22
22
|
if (!code || !code.includes("fumadocs-mdx/macro")) return loaded;
|
|
23
|
-
const { transformMacroModule } = await import("../transform-
|
|
23
|
+
const { transformMacroModule } = await import("../transform-YLS_tnU6.js").then((n) => n.i);
|
|
24
24
|
const result = await transformMacroModule({
|
|
25
25
|
code,
|
|
26
26
|
file,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as CoreOptions } from "../core-
|
|
1
|
+
import { r as CoreOptions } from "../core-6H7qqwEM.js";
|
|
2
2
|
import { t as MacroPluginOption } from "../options-aB6xV-d7.js";
|
|
3
3
|
//#region src/node/index.d.ts
|
|
4
4
|
export interface NodeLoaderOptions extends Pick<CoreOptions, 'configPath' | 'outDir' | 'plugins'> {
|
package/dist/node/loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-D0Qtc99b.js";
|
|
2
2
|
import { t as createCore } from "../core-DTiWJ6t1.js";
|
|
3
3
|
import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-XBO81DIE.js";
|
|
4
4
|
import { t as createMetaLoader } from "../meta-BR_rkCyY.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-
|
|
1
|
+
import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-6H7qqwEM.js";
|
|
2
2
|
export { IndexFilePlugin, IndexFilePluginOptions, indexFile as default };
|
|
@@ -2,9 +2,9 @@ import { frontmatter } from "fumadocs-core/content/md/frontmatter";
|
|
|
2
2
|
import * as fs$1 from "node:fs/promises";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import { unified } from "unified";
|
|
5
|
-
import { visit } from "unist-util-visit";
|
|
6
5
|
import { remarkHeading } from "fumadocs-core/mdx-plugins";
|
|
7
6
|
import { VFile } from "vfile";
|
|
7
|
+
import { embedSource, replaceSource } from "fumadocs-core/mdx-plugins/stringifier";
|
|
8
8
|
//#region src/config/preset.ts
|
|
9
9
|
function pluginOption(def, options = []) {
|
|
10
10
|
const list = def(Array.isArray(options) ? options : []).filter(Boolean);
|
|
@@ -63,10 +63,28 @@ function applyMdxPreset(options = {}) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
|
+
//#region src/loaders/mdx/mdast-utils.ts
|
|
67
|
+
function flattenNode(node) {
|
|
68
|
+
if ("children" in node) return node.children.map((child) => flattenNode(child)).join("");
|
|
69
|
+
if ("value" in node) return node.value;
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Visit a tree in document order, returning `skip` skips the children of a node and `false` stops the walk.
|
|
74
|
+
*/
|
|
75
|
+
function walk(node, visitor, index, parent) {
|
|
76
|
+
const result = visitor(node, index, parent);
|
|
77
|
+
if (result === false) return false;
|
|
78
|
+
if (result !== "skip" && node.children) {
|
|
79
|
+
for (let i = 0; i < node.children.length; i++) if (!walk(node.children[i], visitor, i, node)) return false;
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
66
84
|
//#region src/loaders/mdx/remark-unravel.ts
|
|
67
85
|
function remarkMarkAndUnravel() {
|
|
68
86
|
return (tree) => {
|
|
69
|
-
|
|
87
|
+
walk(tree, (node, index, parent) => {
|
|
70
88
|
let offset = -1;
|
|
71
89
|
let all = true;
|
|
72
90
|
let oneOrMore = false;
|
|
@@ -90,20 +108,13 @@ function remarkMarkAndUnravel() {
|
|
|
90
108
|
if (child.type === "text" && /^[\t\r\n ]+$/.test(String(child.value))) {} else newChildren.push(child);
|
|
91
109
|
}
|
|
92
110
|
parent.children.splice(index, 1, ...newChildren);
|
|
93
|
-
return
|
|
111
|
+
return "skip";
|
|
94
112
|
}
|
|
95
113
|
}
|
|
96
114
|
});
|
|
97
115
|
};
|
|
98
116
|
}
|
|
99
117
|
//#endregion
|
|
100
|
-
//#region src/loaders/mdx/mdast-utils.ts
|
|
101
|
-
function flattenNode(node) {
|
|
102
|
-
if ("children" in node) return node.children.map((child) => flattenNode(child)).join("");
|
|
103
|
-
if ("value" in node) return node.value;
|
|
104
|
-
return "";
|
|
105
|
-
}
|
|
106
|
-
//#endregion
|
|
107
118
|
//#region src/loaders/mdx/remark-include.ts
|
|
108
119
|
/**
|
|
109
120
|
* VS Code–style region extraction
|
|
@@ -205,7 +216,7 @@ function parseSpecifier(specifier) {
|
|
|
205
216
|
function extractSection(root, section) {
|
|
206
217
|
let nodes;
|
|
207
218
|
let capturingHeadingContent = false;
|
|
208
|
-
|
|
219
|
+
walk(root, (node) => {
|
|
209
220
|
if (node.type === "heading") {
|
|
210
221
|
if (capturingHeadingContent) return false;
|
|
211
222
|
if (node.data?.hProperties?.id === section) {
|
|
@@ -233,7 +244,7 @@ function extractSection(root, section) {
|
|
|
233
244
|
}
|
|
234
245
|
function remarkInclude() {
|
|
235
246
|
const TagName = "include";
|
|
236
|
-
const embedContent = async (targetPath, heading, params, parent) => {
|
|
247
|
+
const embedContent = async (target, targetPath, heading, params, parent, root) => {
|
|
237
248
|
const { _getProcessor = () => this, _compiler } = parent.data;
|
|
238
249
|
let content;
|
|
239
250
|
try {
|
|
@@ -247,6 +258,9 @@ function remarkInclude() {
|
|
|
247
258
|
const lang = params.lang ?? ext.slice(1);
|
|
248
259
|
let value = content;
|
|
249
260
|
if (heading) value = extractCodeRegion(content, heading.trim());
|
|
261
|
+
let fence = "```";
|
|
262
|
+
while (value.includes(fence)) fence += "`";
|
|
263
|
+
replaceSource(root, target, `${fence}${lang}${params.meta ? ` ${params.meta}` : ""}\n${value.replace(/\r?\n$/, "")}\n${fence}`);
|
|
250
264
|
return {
|
|
251
265
|
type: "code",
|
|
252
266
|
lang,
|
|
@@ -272,29 +286,33 @@ function remarkInclude() {
|
|
|
272
286
|
if (!extracted) throw new Error(`Cannot find section ${heading} in ${targetPath}, make sure you have encapsulated the section in a <section id="${heading}"> tag, or a :::section directive with remark-directive configured.`);
|
|
273
287
|
mdast = extracted;
|
|
274
288
|
} else mdast = await baseProcessor.run(mdast);
|
|
275
|
-
|
|
289
|
+
embedSource(root, target, parsed.content, mdast.children);
|
|
290
|
+
await update(mdast, targetFile, root);
|
|
276
291
|
return mdast;
|
|
277
292
|
};
|
|
278
|
-
async function update(tree, file) {
|
|
293
|
+
async function update(tree, file, root) {
|
|
279
294
|
const queue = [];
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (node.name !== TagName) return;
|
|
295
|
+
walk(tree, (node, _, parent) => {
|
|
296
|
+
if (!isElementLike(node) || node.name !== TagName) return;
|
|
283
297
|
const specifier = flattenNode(node);
|
|
284
298
|
if (specifier.length === 0) return "skip";
|
|
285
299
|
const attributes = parseElementAttributes(node);
|
|
286
300
|
const { file: relativePath, section } = parseSpecifier(specifier);
|
|
287
301
|
const targetPath = path$1.resolve("cwd" in attributes || !file.dirname ? file.cwd : file.dirname, relativePath);
|
|
288
|
-
|
|
289
|
-
|
|
302
|
+
const host = parent;
|
|
303
|
+
const target = host?.type === "paragraph" ? host : node;
|
|
304
|
+
queue.push(embedContent(target, targetPath, section, attributes, file, root).then((replace) => {
|
|
305
|
+
const { position } = target;
|
|
306
|
+
for (const key in target) delete target[key];
|
|
307
|
+
Object.assign(target, replace, { position });
|
|
290
308
|
}));
|
|
291
309
|
return "skip";
|
|
292
310
|
});
|
|
293
311
|
await Promise.all(queue);
|
|
294
312
|
}
|
|
295
313
|
return async (tree, file) => {
|
|
296
|
-
await update(tree, file);
|
|
314
|
+
await update(tree, file, file);
|
|
297
315
|
};
|
|
298
316
|
}
|
|
299
317
|
//#endregion
|
|
300
|
-
export { flattenNode as n,
|
|
318
|
+
export { applyMdxPreset as i, flattenNode as n, walk as r, remarkInclude as t };
|
package/dist/rolldown/index.d.ts
CHANGED
package/dist/rolldown/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-D0Qtc99b.js";
|
|
2
2
|
import { i as buildConfig, t as createCore } from "../core-DTiWJ6t1.js";
|
|
3
3
|
import { r as slash } from "../codegen-CNSKFlLn.js";
|
|
4
4
|
import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-XBO81DIE.js";
|
|
5
5
|
import { t as createMetaLoader } from "../meta-BR_rkCyY.js";
|
|
6
6
|
import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-DWC_Uwqq.js";
|
|
7
7
|
import { r as resolveMacroOptions, t as MacroModuleId } from "../options-BNnYUjkM.js";
|
|
8
|
-
import { n as createNodeEvaluator, t as MacroCollector } from "../eval-
|
|
8
|
+
import { n as createNodeEvaluator, t as MacroCollector } from "../eval-DxGmVc3G.js";
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
//#region src/rolldown/index.ts
|
|
@@ -42,7 +42,7 @@ async function mdx(config = {}, options) {
|
|
|
42
42
|
},
|
|
43
43
|
async handler(code, id) {
|
|
44
44
|
const [file] = id.split("?", 2);
|
|
45
|
-
const { transformMacroModule } = await import("../transform-
|
|
45
|
+
const { transformMacroModule } = await import("../transform-YLS_tnU6.js").then((n) => n.i);
|
|
46
46
|
const result = await transformMacroModule({
|
|
47
47
|
code,
|
|
48
48
|
file,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as DocsCollection, j as CompiledMDXProperties, y as DocCollection } from "../core-
|
|
1
|
+
import { C as DocsCollection, j as CompiledMDXProperties, y as DocCollection } from "../core-6H7qqwEM.js";
|
|
2
2
|
import { a as InternalTypeConfig } from "../types-1n7Fk5Dl.js";
|
|
3
3
|
import { FC, ReactNode } from "react";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as DocsCollection, r as CoreOptions, y as DocCollection } from "../core-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { C as DocsCollection, r as CoreOptions, y as DocCollection } from "../core-6H7qqwEM.js";
|
|
2
|
+
import "../index-DosG5f9I.js";
|
|
3
3
|
import { a as InternalTypeConfig, r as FileInfo } from "../types-1n7Fk5Dl.js";
|
|
4
4
|
import { AsyncDocCollectionEntry, AsyncDocsCollectionEntry } from "./server.js";
|
|
5
5
|
//#region src/runtime/dynamic.d.ts
|
package/dist/runtime/dynamic.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as buildConfig, t as createCore } from "../core-DTiWJ6t1.js";
|
|
2
|
-
import { t as buildMDX } from "../build-
|
|
2
|
+
import { t as buildMDX } from "../build-H2VN-Hpm.js";
|
|
3
3
|
import { server } from "./server.js";
|
|
4
4
|
import { frontmatter } from "fumadocs-core/content/md/frontmatter";
|
|
5
5
|
import fs from "node:fs/promises";
|
package/dist/runtime/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as DocsCollection, T as MetaCollection, y as DocCollection } from "../core-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { C as DocsCollection, T as MetaCollection, y as DocCollection } from "../core-6H7qqwEM.js";
|
|
2
|
+
import "../index-DosG5f9I.js";
|
|
3
3
|
import { a as InternalTypeConfig, n as DocMethods, o as MetaMethods, t as DocData } from "../types-1n7Fk5Dl.js";
|
|
4
4
|
import { MetaData, PageData, Source } from "fumadocs-core/source";
|
|
5
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
package/dist/runtime/server.js
CHANGED
|
@@ -54,8 +54,11 @@ function parseMacroId(id) {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
async function analyzeModule(code, file) {
|
|
57
|
-
const {
|
|
58
|
-
const module =
|
|
57
|
+
const { analyze } = await import("yuku-analyzer");
|
|
58
|
+
const module = analyze(code, {
|
|
59
|
+
path: file,
|
|
60
|
+
sourceType: "module"
|
|
61
|
+
});
|
|
59
62
|
const errors = module.diagnostics.filter((diagnostic) => diagnostic.severity === "error");
|
|
60
63
|
if (errors.length > 0) {
|
|
61
64
|
const first = errors[0];
|
|
@@ -165,7 +168,7 @@ async function parseMacroModule(code, file) {
|
|
|
165
168
|
const imported = spec.imported;
|
|
166
169
|
const name = imported.type === "Identifier" ? imported.name : imported.value;
|
|
167
170
|
if (name !== "defineDocs" && name !== "defineCollections") continue;
|
|
168
|
-
const symbol = module.
|
|
171
|
+
const symbol = module.bindingOf(spec.local);
|
|
169
172
|
if (symbol) macroSymbols.set(symbol, name);
|
|
170
173
|
}
|
|
171
174
|
imports.push(statement);
|
|
@@ -186,7 +189,7 @@ async function parseMacroModule(code, file) {
|
|
|
186
189
|
if (!init || init.type !== "CallExpression") continue;
|
|
187
190
|
const callee = init.callee;
|
|
188
191
|
if (callee.type !== "Identifier") continue;
|
|
189
|
-
const symbol = module.
|
|
192
|
+
const symbol = module.bindingOf(callee);
|
|
190
193
|
const fn = symbol ? macroSymbols.get(symbol) : void 0;
|
|
191
194
|
if (fn === void 0) continue;
|
|
192
195
|
const id = declarator.id;
|
|
@@ -221,12 +224,12 @@ function topLevelStatement(module, node) {
|
|
|
221
224
|
function retainMacroDependencies(parsed) {
|
|
222
225
|
const dependencies = /* @__PURE__ */ new Map();
|
|
223
226
|
for (const reference of parsed.module.references) {
|
|
224
|
-
if (reference.inTypePosition || !reference.
|
|
227
|
+
if (reference.inTypePosition || !reference.binding) continue;
|
|
225
228
|
const statement = topLevelStatement(parsed.module, reference.node);
|
|
226
229
|
if (!statement) continue;
|
|
227
230
|
let refs = dependencies.get(statement);
|
|
228
231
|
if (!refs) dependencies.set(statement, refs = /* @__PURE__ */ new Set());
|
|
229
|
-
for (const declaration of reference.
|
|
232
|
+
for (const declaration of reference.binding.declarations) {
|
|
230
233
|
const dependency = topLevelStatement(parsed.module, declaration);
|
|
231
234
|
if (dependency && dependency !== statement) refs.add(dependency);
|
|
232
235
|
}
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as IndexFilePluginOptions, r as CoreOptions, w as GlobalConfig } from "../core-
|
|
1
|
+
import { p as IndexFilePluginOptions, r as CoreOptions, w as GlobalConfig } from "../core-6H7qqwEM.js";
|
|
2
2
|
import { t as MacroPluginOption } from "../options-aB6xV-d7.js";
|
|
3
|
-
import "../index-
|
|
3
|
+
import "../index-DosG5f9I.js";
|
|
4
4
|
import { Plugin } from "vite";
|
|
5
5
|
//#region src/vite/index.d.ts
|
|
6
6
|
export interface PluginOptions extends Pick<CoreOptions, 'configPath' | 'outDir' | 'plugins'> {
|
package/dist/vite/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-D0Qtc99b.js";
|
|
2
2
|
import { i as buildConfig, t as createCore } from "../core-DTiWJ6t1.js";
|
|
3
3
|
import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-XBO81DIE.js";
|
|
4
4
|
import { t as createMetaLoader } from "../meta-BR_rkCyY.js";
|
|
@@ -50,7 +50,7 @@ function mdx(forcedConfig, pluginOptions = {}) {
|
|
|
50
50
|
const core = managed.core;
|
|
51
51
|
const macroOptions = resolveMacroOptions(pluginOptions.macro);
|
|
52
52
|
if (macroOptions) {
|
|
53
|
-
const { MacroCollector } = await import("../eval-
|
|
53
|
+
const { MacroCollector } = await import("../eval-DxGmVc3G.js").then((n) => n.r);
|
|
54
54
|
core.macro = new MacroCollector({
|
|
55
55
|
root: core.root,
|
|
56
56
|
outDir: core.outDir,
|
|
@@ -92,7 +92,7 @@ function mdx(forcedConfig, pluginOptions = {}) {
|
|
|
92
92
|
},
|
|
93
93
|
async handler(code, id) {
|
|
94
94
|
const [file] = id.split("?", 2);
|
|
95
|
-
const { transformMacroModule } = await import("../transform-
|
|
95
|
+
const { transformMacroModule } = await import("../transform-YLS_tnU6.js").then((n) => n.i);
|
|
96
96
|
const result = await transformMacroModule({
|
|
97
97
|
code,
|
|
98
98
|
file,
|
package/dist/webpack/macro.d.ts
CHANGED
package/dist/webpack/macro.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../options-BNnYUjkM.js";
|
|
2
|
-
import { r as transformMacroModule } from "../transform-
|
|
2
|
+
import { r as transformMacroModule } from "../transform-YLS_tnU6.js";
|
|
3
3
|
//#region src/webpack/macro.ts
|
|
4
4
|
/**
|
|
5
5
|
* Expand macro calls (`fumadocs-mdx/macro`) into static imports of content files.
|
package/dist/webpack/mdx.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as WebpackLoaderOptions } from "../index-
|
|
1
|
+
import { t as WebpackLoaderOptions } from "../index-CIxuOQ_6.js";
|
|
2
2
|
import { LoaderDefinitionFunction } from "webpack";
|
|
3
3
|
//#region src/webpack/mdx.d.ts
|
|
4
4
|
declare const loader: LoaderDefinitionFunction<WebpackLoaderOptions>;
|
package/dist/webpack/mdx.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-D0Qtc99b.js";
|
|
2
2
|
import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-XBO81DIE.js";
|
|
3
|
-
import { t as getCore } from "../webpack-
|
|
3
|
+
import { t as getCore } from "../webpack-IV_nHZIH.js";
|
|
4
4
|
//#region src/webpack/mdx.ts
|
|
5
5
|
let instance;
|
|
6
6
|
const loader = function loader(source) {
|
package/dist/webpack/meta.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as WebpackLoaderOptions } from "../index-
|
|
1
|
+
import { t as WebpackLoaderOptions } from "../index-CIxuOQ_6.js";
|
|
2
2
|
import { LoaderDefinitionFunction } from "webpack";
|
|
3
3
|
//#region src/webpack/meta.d.ts
|
|
4
4
|
declare const loader: LoaderDefinitionFunction<WebpackLoaderOptions>;
|
package/dist/webpack/meta.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-XBO81DIE.js";
|
|
2
2
|
import { t as createMetaLoader } from "../meta-BR_rkCyY.js";
|
|
3
|
-
import { t as getCore } from "../webpack-
|
|
3
|
+
import { t as getCore } from "../webpack-IV_nHZIH.js";
|
|
4
4
|
//#region src/webpack/meta.ts
|
|
5
5
|
const instances = /* @__PURE__ */ new Map();
|
|
6
6
|
const loader = function(source) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createCore } from "./core-DTiWJ6t1.js";
|
|
2
|
-
import { n as createNodeEvaluator, t as MacroCollector } from "./eval-
|
|
2
|
+
import { n as createNodeEvaluator, t as MacroCollector } from "./eval-DxGmVc3G.js";
|
|
3
3
|
//#region src/webpack/index.ts
|
|
4
4
|
let core;
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-mdx",
|
|
3
|
-
"version": "15.4.
|
|
3
|
+
"version": "15.4.7",
|
|
4
4
|
"description": "The built-in source for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"esbuild": "^0.28.2",
|
|
61
61
|
"estree-util-value-to-estree": "^3.5.0",
|
|
62
62
|
"github-slugger": "^2.0.0",
|
|
63
|
-
"magic-string": "^1.4.
|
|
63
|
+
"magic-string": "^1.4.2",
|
|
64
64
|
"mdast-util-mdx": "^3.0.0",
|
|
65
65
|
"picocolors": "^1.1.1",
|
|
66
66
|
"picomatch": "^4.0.7",
|
|
@@ -68,33 +68,32 @@
|
|
|
68
68
|
"tinyglobby": "^0.2.17",
|
|
69
69
|
"unified": "^11.0.5",
|
|
70
70
|
"unist-util-remove-position": "^5.0.0",
|
|
71
|
-
"unist-util-visit": "^5.1.0",
|
|
72
71
|
"vfile": "^6.0.3",
|
|
73
72
|
"yaml": "^2.9.1",
|
|
74
|
-
"yuku-analyzer": "^0.
|
|
73
|
+
"yuku-analyzer": "^0.17.0",
|
|
75
74
|
"zod": "^4.6.5"
|
|
76
75
|
},
|
|
77
76
|
"devDependencies": {
|
|
78
|
-
"@fumadocs/satteri": "0.
|
|
77
|
+
"@fumadocs/satteri": "0.6.0",
|
|
79
78
|
"@fumadocs/vite": "0.1.0",
|
|
80
79
|
"@types/bun": "^1.4.2",
|
|
81
80
|
"@types/mdast": "^4.0.4",
|
|
82
81
|
"@types/mdx": "^2.0.14",
|
|
83
|
-
"@types/node": "^26.6.
|
|
82
|
+
"@types/node": "^26.6.4",
|
|
84
83
|
"@types/picomatch": "^4.0.3",
|
|
85
84
|
"@types/react": "^19.3.0",
|
|
86
|
-
"fumadocs-core": "16.
|
|
85
|
+
"fumadocs-core": "16.17.0",
|
|
87
86
|
"mdast-util-directive": "^3.1.0",
|
|
88
|
-
"next": "^16.3.
|
|
87
|
+
"next": "^16.3.8",
|
|
89
88
|
"react": "^19.3.0",
|
|
90
89
|
"remark": "^15.0.1",
|
|
91
90
|
"remark-directive": "^4.0.0",
|
|
92
91
|
"remark-mdx": "^3.1.1",
|
|
93
|
-
"rolldown": "^1.2.
|
|
92
|
+
"rolldown": "^1.2.12",
|
|
94
93
|
"satteri": "^0.10.5",
|
|
95
94
|
"tsconfig": "0.0.0",
|
|
96
95
|
"tsdown": "0.23.0",
|
|
97
|
-
"vite": "^8.3.
|
|
96
|
+
"vite": "^8.3.2",
|
|
98
97
|
"webpack": "^5.111.1"
|
|
99
98
|
},
|
|
100
99
|
"peerDependencies": {
|
|
@@ -102,7 +101,7 @@
|
|
|
102
101
|
"@types/mdast": "*",
|
|
103
102
|
"@types/mdx": "*",
|
|
104
103
|
"@types/react": "*",
|
|
105
|
-
"fumadocs-core": "^16.
|
|
104
|
+
"fumadocs-core": "^16.17.0",
|
|
106
105
|
"mdast-util-directive": "*",
|
|
107
106
|
"next": "^15.3.0 || ^16.0.0",
|
|
108
107
|
"react": "^19.2.0",
|