fumadocs-mdx 13.0.8 → 14.0.1
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.cjs +985 -893
- package/dist/bin.js +3 -3
- package/dist/build-mdx-6UAK5FF5.js +8 -0
- package/dist/bun/index.cjs +613 -471
- package/dist/bun/index.d.cts +9 -2
- package/dist/bun/index.d.ts +9 -2
- package/dist/bun/index.js +15 -14
- package/dist/chunk-4JSFLXXT.js +8 -0
- package/dist/chunk-5OBUOALK.js +141 -0
- package/dist/{chunk-2E2JCOSO.js → chunk-6NISOLQ6.js} +16 -44
- package/dist/chunk-7UKSZSPY.js +331 -0
- package/dist/chunk-BEBCWQC7.js +224 -0
- package/dist/chunk-E5DJTSIM.js +86 -0
- package/dist/{chunk-K5ZLPEIQ.js → chunk-FBLMK4RS.js} +9 -6
- package/dist/chunk-IQGEFL2B.js +17 -0
- package/dist/{chunk-5FTSWCB4.js → chunk-K6HCOGOX.js} +9 -11
- package/dist/{chunk-QXHN25N3.js → chunk-MTTISKQJ.js} +6 -6
- package/dist/{chunk-3J3WL7WN.js → chunk-SLY7WXTX.js} +71 -58
- package/dist/chunk-TYJDYTKH.js +85 -0
- package/dist/chunk-WBIHDYMN.js +126 -0
- package/dist/{chunk-2HXTGJBI.js → chunk-ZY6UZ7NH.js} +22 -19
- package/dist/config/index.cjs +79 -71
- package/dist/config/index.d.cts +7 -1
- package/dist/config/index.d.ts +7 -1
- package/dist/config/index.js +5 -5
- package/dist/core-B9ZoS6sA.d.ts +341 -0
- package/dist/core-DTuP23zu.d.cts +341 -0
- package/dist/index-BD8Woo4m.d.cts +8 -0
- package/dist/index-CNOvhtOn.d.ts +8 -0
- package/dist/index.d.cts +38 -56
- package/dist/index.d.ts +38 -56
- package/dist/load-from-file-5HUQN36V.js +8 -0
- package/dist/next/index.cjs +763 -473
- package/dist/next/index.d.cts +16 -1
- package/dist/next/index.d.ts +16 -1
- package/dist/next/index.js +80 -281
- package/dist/node/loader.cjs +764 -627
- package/dist/node/loader.js +10 -11
- package/dist/plugins/index-file.cjs +495 -0
- package/dist/plugins/index-file.d.cts +14 -0
- package/dist/plugins/index-file.d.ts +14 -0
- package/dist/plugins/index-file.js +8 -0
- package/dist/plugins/json-schema.d.cts +9 -2
- package/dist/plugins/json-schema.d.ts +9 -2
- package/dist/plugins/last-modified.cjs +110 -0
- package/dist/plugins/last-modified.d.cts +37 -0
- package/dist/plugins/last-modified.d.ts +37 -0
- package/dist/plugins/last-modified.js +74 -0
- package/dist/runtime/browser.cjs +93 -0
- package/dist/runtime/browser.d.cts +53 -0
- package/dist/runtime/browser.d.ts +53 -0
- package/dist/runtime/browser.js +67 -0
- package/dist/runtime/dynamic.cjs +1023 -0
- package/dist/runtime/dynamic.d.cts +27 -0
- package/dist/runtime/dynamic.d.ts +27 -0
- package/dist/runtime/dynamic.js +79 -0
- package/dist/runtime/server.cjs +176 -0
- package/dist/runtime/server.d.cts +14 -0
- package/dist/runtime/server.d.ts +14 -0
- package/dist/runtime/server.js +8 -0
- package/dist/runtime/types.cjs +18 -0
- package/dist/runtime/types.d.cts +61 -0
- package/dist/runtime/types.d.ts +61 -0
- package/dist/runtime/types.js +0 -0
- package/dist/vite/index.cjs +984 -621
- package/dist/vite/index.d.cts +17 -22
- package/dist/vite/index.d.ts +17 -22
- package/dist/vite/index.js +32 -222
- package/dist/webpack/mdx.cjs +647 -514
- package/dist/webpack/mdx.d.cts +15 -1
- package/dist/webpack/mdx.d.ts +15 -1
- package/dist/webpack/mdx.js +12 -17
- package/dist/webpack/meta.cjs +360 -231
- package/dist/webpack/meta.d.cts +15 -1
- package/dist/webpack/meta.d.ts +15 -1
- package/dist/webpack/meta.js +13 -15
- package/package.json +15 -32
- package/dist/build-mdx-BjXOmv0b.d.cts +0 -53
- package/dist/build-mdx-CY5UldCO.d.ts +0 -53
- package/dist/chunk-2AQRQXSO.js +0 -119
- package/dist/chunk-CXA4JO4Z.js +0 -45
- package/dist/chunk-DMJ6I4C3.js +0 -76
- package/dist/chunk-FSZMKRVH.js +0 -80
- package/dist/chunk-II3H5ZVZ.js +0 -77
- package/dist/chunk-KILFIBVW.js +0 -75
- package/dist/chunk-NVRDCY6Z.js +0 -30
- package/dist/chunk-VUEZTR2H.js +0 -26
- package/dist/core-DB7TdlyC.d.cts +0 -234
- package/dist/core-DB7TdlyC.d.ts +0 -234
- package/dist/index-D7s7kCc2.d.cts +0 -7
- package/dist/index-D7s7kCc2.d.ts +0 -7
- package/dist/load-from-file-AVYOFOI7.js +0 -7
- package/dist/preset-ZMP6U62C.js +0 -6
- package/dist/runtime/next/async.cjs +0 -760
- package/dist/runtime/next/async.d.cts +0 -19
- package/dist/runtime/next/async.d.ts +0 -19
- package/dist/runtime/next/async.js +0 -86
- package/dist/runtime/next/index.cjs +0 -136
- package/dist/runtime/next/index.d.cts +0 -33
- package/dist/runtime/next/index.d.ts +0 -33
- package/dist/runtime/next/index.js +0 -11
- package/dist/runtime/vite/browser.cjs +0 -107
- package/dist/runtime/vite/browser.d.cts +0 -59
- package/dist/runtime/vite/browser.d.ts +0 -59
- package/dist/runtime/vite/browser.js +0 -11
- package/dist/runtime/vite/server.cjs +0 -243
- package/dist/runtime/vite/server.d.cts +0 -30
- package/dist/runtime/vite/server.d.ts +0 -30
- package/dist/runtime/vite/server.js +0 -111
- package/dist/types-Bnh9n7mj.d.cts +0 -45
- package/dist/types-ey1AZqrg.d.ts +0 -45
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
metaLoaderGlob
|
|
3
|
+
} from "./chunk-4JSFLXXT.js";
|
|
4
|
+
|
|
5
|
+
// src/loaders/meta.ts
|
|
6
|
+
import { dump, load } from "js-yaml";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var querySchema = z.object({
|
|
9
|
+
collection: z.string().optional()
|
|
10
|
+
}).loose();
|
|
11
|
+
function createMetaLoader(configLoader, resolve = {}) {
|
|
12
|
+
const { json: resolveJson = "js", yaml: resolveYaml = "js" } = resolve;
|
|
13
|
+
function parse(filePath, source) {
|
|
14
|
+
try {
|
|
15
|
+
if (filePath.endsWith(".json")) return JSON.parse(source);
|
|
16
|
+
if (filePath.endsWith(".yaml")) return load(source);
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw new Error(`invalid data in ${filePath}`, { cause: e });
|
|
19
|
+
}
|
|
20
|
+
throw new Error("Unknown file type " + filePath);
|
|
21
|
+
}
|
|
22
|
+
function onMeta(source, { filePath, query }) {
|
|
23
|
+
const parsed = querySchema.safeParse(query);
|
|
24
|
+
if (!parsed.success || !parsed.data.collection) return null;
|
|
25
|
+
const collectionName = parsed.data.collection;
|
|
26
|
+
return async () => {
|
|
27
|
+
const config = await configLoader.getConfig();
|
|
28
|
+
const collection = config.getCollection(collectionName);
|
|
29
|
+
let metaCollection;
|
|
30
|
+
switch (collection?.type) {
|
|
31
|
+
case "meta":
|
|
32
|
+
metaCollection = collection;
|
|
33
|
+
break;
|
|
34
|
+
case "docs":
|
|
35
|
+
metaCollection = collection.meta;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
const data = parse(filePath, source);
|
|
39
|
+
if (!metaCollection) return data;
|
|
40
|
+
return configLoader.core.transformMeta(
|
|
41
|
+
{
|
|
42
|
+
collection: metaCollection,
|
|
43
|
+
filePath,
|
|
44
|
+
source
|
|
45
|
+
},
|
|
46
|
+
data
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
test: metaLoaderGlob,
|
|
52
|
+
async load(input) {
|
|
53
|
+
const result = onMeta(await input.getSource(), input);
|
|
54
|
+
if (result === null) return null;
|
|
55
|
+
const data = await result();
|
|
56
|
+
if (input.filePath.endsWith(".json")) {
|
|
57
|
+
return {
|
|
58
|
+
code: resolveJson === "json" ? JSON.stringify(data) : `export default ${JSON.stringify(data)}`
|
|
59
|
+
};
|
|
60
|
+
} else {
|
|
61
|
+
return {
|
|
62
|
+
code: resolveYaml === "yaml" ? dump(data) : `export default ${JSON.stringify(data)}`
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
bun: {
|
|
67
|
+
load(source, input) {
|
|
68
|
+
const result = onMeta(source, input);
|
|
69
|
+
if (result === null)
|
|
70
|
+
return {
|
|
71
|
+
loader: "object",
|
|
72
|
+
exports: parse(input.filePath, source)
|
|
73
|
+
};
|
|
74
|
+
return result().then((data) => ({
|
|
75
|
+
loader: "object",
|
|
76
|
+
exports: { default: data }
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
createMetaLoader
|
|
85
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// src/utils/codegen.ts
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { glob } from "tinyglobby";
|
|
4
|
+
function createCodegen({
|
|
5
|
+
target = "default",
|
|
6
|
+
outDir = "",
|
|
7
|
+
jsExtension = false,
|
|
8
|
+
globCache = /* @__PURE__ */ new Map()
|
|
9
|
+
}) {
|
|
10
|
+
let eagerImportId = 0;
|
|
11
|
+
const banner = ["// @ts-nocheck"];
|
|
12
|
+
if (target === "vite") {
|
|
13
|
+
banner.push('/// <reference types="vite/client" />');
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
options: {
|
|
17
|
+
target,
|
|
18
|
+
outDir
|
|
19
|
+
},
|
|
20
|
+
lines: [],
|
|
21
|
+
addImport(statement) {
|
|
22
|
+
this.lines.unshift(statement);
|
|
23
|
+
},
|
|
24
|
+
async pushAsync(insert) {
|
|
25
|
+
for (const line of await Promise.all(insert)) {
|
|
26
|
+
if (line === void 0) continue;
|
|
27
|
+
this.lines.push(line);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
async generateGlobImport(patterns, options) {
|
|
31
|
+
if (target === "vite") {
|
|
32
|
+
return this.generateViteGlobImport(patterns, options);
|
|
33
|
+
}
|
|
34
|
+
return this.generateNodeGlobImport(patterns, options);
|
|
35
|
+
},
|
|
36
|
+
generateViteGlobImport(patterns, { base, ...rest }) {
|
|
37
|
+
patterns = (typeof patterns === "string" ? [patterns] : patterns).map(
|
|
38
|
+
normalizeViteGlobPath
|
|
39
|
+
);
|
|
40
|
+
return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify(
|
|
41
|
+
{
|
|
42
|
+
base: normalizeViteGlobPath(path.relative(outDir, base)),
|
|
43
|
+
...rest
|
|
44
|
+
},
|
|
45
|
+
null,
|
|
46
|
+
2
|
|
47
|
+
)})`;
|
|
48
|
+
},
|
|
49
|
+
async generateNodeGlobImport(patterns, {
|
|
50
|
+
base,
|
|
51
|
+
eager = false,
|
|
52
|
+
query = {},
|
|
53
|
+
import: importName
|
|
54
|
+
}) {
|
|
55
|
+
const cacheKey = JSON.stringify({ patterns, base });
|
|
56
|
+
let files = globCache.get(cacheKey);
|
|
57
|
+
if (!files) {
|
|
58
|
+
files = glob(patterns, {
|
|
59
|
+
cwd: base
|
|
60
|
+
});
|
|
61
|
+
globCache.set(cacheKey, files);
|
|
62
|
+
}
|
|
63
|
+
let code = "{";
|
|
64
|
+
for (const item of await files) {
|
|
65
|
+
const fullPath = path.join(base, item);
|
|
66
|
+
const searchParams = new URLSearchParams();
|
|
67
|
+
for (const [k, v] of Object.entries(query)) {
|
|
68
|
+
searchParams.set(k, v);
|
|
69
|
+
}
|
|
70
|
+
const importPath = this.formatImportPath(fullPath) + "?" + searchParams.toString();
|
|
71
|
+
if (eager) {
|
|
72
|
+
const name = `__fd_glob_${eagerImportId++}`;
|
|
73
|
+
this.lines.unshift(
|
|
74
|
+
importName ? `import { ${importName} as ${name} } from ${JSON.stringify(importPath)}` : `import * as ${name} from ${JSON.stringify(importPath)}`
|
|
75
|
+
);
|
|
76
|
+
code += `${JSON.stringify(item)}: ${name}, `;
|
|
77
|
+
} else {
|
|
78
|
+
let line = `${JSON.stringify(item)}: () => import(${JSON.stringify(importPath)})`;
|
|
79
|
+
if (importName) {
|
|
80
|
+
line += `.then(mod => mod.${importName})`;
|
|
81
|
+
}
|
|
82
|
+
code += `${line}, `;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
code += "}";
|
|
86
|
+
return code;
|
|
87
|
+
},
|
|
88
|
+
formatImportPath(file) {
|
|
89
|
+
const ext = path.extname(file);
|
|
90
|
+
let filename;
|
|
91
|
+
if (ext === ".ts" && jsExtension) {
|
|
92
|
+
filename = file.substring(0, file.length - ext.length) + ".js";
|
|
93
|
+
} else if (ext === ".ts") {
|
|
94
|
+
filename = file.substring(0, file.length - ext.length);
|
|
95
|
+
} else {
|
|
96
|
+
filename = file;
|
|
97
|
+
}
|
|
98
|
+
const importPath = slash(path.relative(outDir, filename));
|
|
99
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
100
|
+
},
|
|
101
|
+
toString() {
|
|
102
|
+
return [...banner, ...this.lines].join("\n");
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function normalizeViteGlobPath(file) {
|
|
107
|
+
file = slash(file);
|
|
108
|
+
if (file.startsWith("./")) return file;
|
|
109
|
+
if (file.startsWith("/")) return `.${file}`;
|
|
110
|
+
return `./${file}`;
|
|
111
|
+
}
|
|
112
|
+
function slash(path2) {
|
|
113
|
+
const isExtendedLengthPath = path2.startsWith("\\\\?\\");
|
|
114
|
+
if (isExtendedLengthPath) {
|
|
115
|
+
return path2;
|
|
116
|
+
}
|
|
117
|
+
return path2.replaceAll("\\", "/");
|
|
118
|
+
}
|
|
119
|
+
function ident(code, tab = 1) {
|
|
120
|
+
return code.split("\n").map((v) => " ".repeat(tab) + v).join("\n");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
createCodegen,
|
|
125
|
+
ident
|
|
126
|
+
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyMdxPreset
|
|
3
|
+
} from "./chunk-E5DJTSIM.js";
|
|
4
|
+
|
|
1
5
|
// src/config/build.ts
|
|
2
6
|
import picomatch from "picomatch";
|
|
3
7
|
var SupportedFormats = {
|
|
@@ -10,7 +14,10 @@ function buildCollection(name, config) {
|
|
|
10
14
|
...config,
|
|
11
15
|
name,
|
|
12
16
|
meta: buildPrimitiveCollection(name, config.meta),
|
|
13
|
-
docs: buildPrimitiveCollection(name, config.docs)
|
|
17
|
+
docs: buildPrimitiveCollection(name, config.docs),
|
|
18
|
+
hasFile(filePath) {
|
|
19
|
+
return this.docs.hasFile(filePath) || this.meta.hasFile(filePath);
|
|
20
|
+
}
|
|
14
21
|
};
|
|
15
22
|
}
|
|
16
23
|
return buildPrimitiveCollection(name, config);
|
|
@@ -64,11 +71,6 @@ function buildConfig(config) {
|
|
|
64
71
|
`Unknown export "${k}", you can only export collections from source configuration file.`
|
|
65
72
|
);
|
|
66
73
|
}
|
|
67
|
-
if (loaded.collections) {
|
|
68
|
-
for (const [k, v] of Object.entries(loaded.collections)) {
|
|
69
|
-
collections.set(k, buildCollection(k, v));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
74
|
const mdxOptionsCache = /* @__PURE__ */ new Map();
|
|
73
75
|
return {
|
|
74
76
|
global: loaded,
|
|
@@ -76,21 +78,22 @@ function buildConfig(config) {
|
|
|
76
78
|
getCollection(name) {
|
|
77
79
|
return collections.get(name);
|
|
78
80
|
},
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
+
getMDXOptions(collection, environment = "bundler") {
|
|
82
|
+
const key = collection ? `${environment}:${collection.name}` : environment;
|
|
83
|
+
const cached = mdxOptionsCache.get(key);
|
|
81
84
|
if (cached) return cached;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
let result;
|
|
86
|
+
if (collection?.mdxOptions) {
|
|
87
|
+
const optionsFn = collection.mdxOptions;
|
|
88
|
+
result = typeof optionsFn === "function" ? optionsFn(environment) : optionsFn;
|
|
89
|
+
} else {
|
|
90
|
+
result = (async () => {
|
|
91
|
+
const optionsFn = this.global.mdxOptions;
|
|
92
|
+
const options = typeof optionsFn === "function" ? await optionsFn() : optionsFn;
|
|
93
|
+
return applyMdxPreset(options)(environment);
|
|
94
|
+
})();
|
|
91
95
|
}
|
|
92
|
-
|
|
93
|
-
mdxOptionsCache.set(mode, result);
|
|
96
|
+
mdxOptionsCache.set(key, result);
|
|
94
97
|
return result;
|
|
95
98
|
}
|
|
96
99
|
};
|
package/dist/config/index.cjs
CHANGED
|
@@ -30,11 +30,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/config/index.ts
|
|
31
31
|
var config_exports = {};
|
|
32
32
|
__export(config_exports, {
|
|
33
|
+
applyMdxPreset: () => applyMdxPreset,
|
|
33
34
|
defineCollections: () => defineCollections,
|
|
34
35
|
defineConfig: () => defineConfig,
|
|
35
36
|
defineDocs: () => defineDocs,
|
|
36
37
|
frontmatterSchema: () => frontmatterSchema,
|
|
37
|
-
getDefaultMDXOptions: () => getDefaultMDXOptions,
|
|
38
38
|
metaSchema: () => metaSchema,
|
|
39
39
|
remarkInclude: () => remarkInclude
|
|
40
40
|
});
|
|
@@ -86,8 +86,7 @@ function defineConfig(config = {}) {
|
|
|
86
86
|
return config;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
// src/
|
|
90
|
-
var plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
|
|
89
|
+
// src/config/preset.ts
|
|
91
90
|
function pluginOption(def, options = []) {
|
|
92
91
|
const list = def(Array.isArray(options) ? options : []).filter(
|
|
93
92
|
Boolean
|
|
@@ -97,69 +96,76 @@ function pluginOption(def, options = []) {
|
|
|
97
96
|
}
|
|
98
97
|
return list;
|
|
99
98
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
99
|
+
function applyMdxPreset(options = {}) {
|
|
100
|
+
return async (environment = "bundler") => {
|
|
101
|
+
if (options.preset === "minimal") return options;
|
|
102
|
+
const plugins = await import("fumadocs-core/mdx-plugins");
|
|
103
|
+
const {
|
|
104
|
+
valueToExport = [],
|
|
105
|
+
rehypeCodeOptions,
|
|
106
|
+
remarkImageOptions,
|
|
107
|
+
remarkHeadingOptions,
|
|
108
|
+
remarkStructureOptions,
|
|
109
|
+
remarkCodeTabOptions,
|
|
110
|
+
remarkNpmOptions,
|
|
111
|
+
...mdxOptions
|
|
112
|
+
} = options;
|
|
113
|
+
const remarkPlugins = pluginOption(
|
|
114
|
+
(v) => [
|
|
115
|
+
plugins.remarkGfm,
|
|
116
|
+
[
|
|
117
|
+
plugins.remarkHeading,
|
|
118
|
+
{
|
|
119
|
+
generateToc: false,
|
|
120
|
+
...remarkHeadingOptions
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
remarkImageOptions !== false && [
|
|
124
|
+
plugins.remarkImage,
|
|
125
|
+
{
|
|
126
|
+
...remarkImageOptions,
|
|
127
|
+
useImport: remarkImageOptions?.useImport ?? environment === "bundler"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
|
|
131
|
+
plugins.remarkCodeTab,
|
|
132
|
+
remarkCodeTabOptions
|
|
133
|
+
],
|
|
134
|
+
"remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
|
|
135
|
+
...v,
|
|
136
|
+
remarkStructureOptions !== false && [
|
|
137
|
+
plugins.remarkStructure,
|
|
138
|
+
remarkStructureOptions
|
|
139
|
+
],
|
|
140
|
+
valueToExport.length > 0 && (() => {
|
|
141
|
+
return (_, file) => {
|
|
142
|
+
file.data["mdx-export"] ??= [];
|
|
143
|
+
for (const name of valueToExport) {
|
|
144
|
+
if (!(name in file.data)) continue;
|
|
145
|
+
file.data["mdx-export"].push({
|
|
146
|
+
name,
|
|
147
|
+
value: file.data[name]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
})
|
|
131
152
|
],
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
153
|
+
mdxOptions.remarkPlugins
|
|
154
|
+
);
|
|
155
|
+
const rehypePlugins = pluginOption(
|
|
156
|
+
(v) => [
|
|
157
|
+
rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
|
|
158
|
+
...v,
|
|
159
|
+
plugins.rehypeToc
|
|
137
160
|
],
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
mdxOptions.remarkPlugins
|
|
149
|
-
);
|
|
150
|
-
const rehypePlugins = pluginOption(
|
|
151
|
-
(v) => [
|
|
152
|
-
rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
|
|
153
|
-
...v,
|
|
154
|
-
plugins.rehypeToc
|
|
155
|
-
],
|
|
156
|
-
mdxOptions.rehypePlugins
|
|
157
|
-
);
|
|
158
|
-
return {
|
|
159
|
-
...mdxOptions,
|
|
160
|
-
outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
|
|
161
|
-
remarkPlugins,
|
|
162
|
-
rehypePlugins
|
|
161
|
+
mdxOptions.rehypePlugins
|
|
162
|
+
);
|
|
163
|
+
return {
|
|
164
|
+
...mdxOptions,
|
|
165
|
+
outputFormat: environment === "runtime" ? "function-body" : mdxOptions.outputFormat,
|
|
166
|
+
remarkPlugins,
|
|
167
|
+
rehypePlugins
|
|
168
|
+
};
|
|
163
169
|
};
|
|
164
170
|
}
|
|
165
171
|
|
|
@@ -232,6 +238,14 @@ function remarkMarkAndUnravel() {
|
|
|
232
238
|
};
|
|
233
239
|
}
|
|
234
240
|
|
|
241
|
+
// src/loaders/mdx/mdast-utils.ts
|
|
242
|
+
function flattenNode(node) {
|
|
243
|
+
if ("children" in node)
|
|
244
|
+
return node.children.map((child) => flattenNode(child)).join("");
|
|
245
|
+
if ("value" in node) return node.value;
|
|
246
|
+
return "";
|
|
247
|
+
}
|
|
248
|
+
|
|
235
249
|
// src/loaders/mdx/remark-include.ts
|
|
236
250
|
var ElementLikeTypes = [
|
|
237
251
|
"mdxJsxFlowElement",
|
|
@@ -255,12 +269,6 @@ function parseElementAttributes(element) {
|
|
|
255
269
|
}
|
|
256
270
|
return element.attributes ?? {};
|
|
257
271
|
}
|
|
258
|
-
function flattenNode(node) {
|
|
259
|
-
if ("children" in node)
|
|
260
|
-
return node.children.map((child) => flattenNode(child)).join("");
|
|
261
|
-
if ("value" in node) return node.value;
|
|
262
|
-
return "";
|
|
263
|
-
}
|
|
264
272
|
function parseSpecifier(specifier) {
|
|
265
273
|
const idx = specifier.lastIndexOf("#");
|
|
266
274
|
if (idx === -1) return { file: specifier };
|
|
@@ -382,11 +390,11 @@ ${e instanceof Error ? e.message : String(e)}`,
|
|
|
382
390
|
}
|
|
383
391
|
// Annotate the CommonJS export names for ESM import in node:
|
|
384
392
|
0 && (module.exports = {
|
|
393
|
+
applyMdxPreset,
|
|
385
394
|
defineCollections,
|
|
386
395
|
defineConfig,
|
|
387
396
|
defineDocs,
|
|
388
397
|
frontmatterSchema,
|
|
389
|
-
getDefaultMDXOptions,
|
|
390
398
|
metaSchema,
|
|
391
399
|
remarkInclude
|
|
392
400
|
});
|
package/dist/config/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyCollection, B as BaseCollection,
|
|
1
|
+
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, e as DefaultMDXOptions, D as DocCollection, a as DocsCollection, G as GlobalConfig, f as MDXPresetOptions, M as MetaCollection, P as PostprocessOptions, g as applyMdxPreset, d as defineCollections, c as defineConfig, b as defineDocs, h as frontmatterSchema, m as metaSchema } from '../core-DTuP23zu.cjs';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
4
|
import '@mdx-js/mdx';
|
|
@@ -6,6 +6,12 @@ import '@standard-schema/spec';
|
|
|
6
6
|
import 'fumadocs-core/mdx-plugins';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import 'chokidar';
|
|
9
|
+
import 'vfile';
|
|
10
|
+
import 'fumadocs-core/source';
|
|
11
|
+
import '../runtime/types.cjs';
|
|
12
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
13
|
+
import 'fumadocs-core/toc';
|
|
14
|
+
import 'mdx/types';
|
|
9
15
|
|
|
10
16
|
declare function remarkInclude(this: Processor): Transformer<Root, Root>;
|
|
11
17
|
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyCollection, B as BaseCollection,
|
|
1
|
+
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, e as DefaultMDXOptions, D as DocCollection, a as DocsCollection, G as GlobalConfig, f as MDXPresetOptions, M as MetaCollection, P as PostprocessOptions, g as applyMdxPreset, d as defineCollections, c as defineConfig, b as defineDocs, h as frontmatterSchema, m as metaSchema } from '../core-B9ZoS6sA.js';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
4
|
import '@mdx-js/mdx';
|
|
@@ -6,6 +6,12 @@ import '@standard-schema/spec';
|
|
|
6
6
|
import 'fumadocs-core/mdx-plugins';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import 'chokidar';
|
|
9
|
+
import 'vfile';
|
|
10
|
+
import 'fumadocs-core/source';
|
|
11
|
+
import '../runtime/types.js';
|
|
12
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
13
|
+
import 'fumadocs-core/toc';
|
|
14
|
+
import 'mdx/types';
|
|
9
15
|
|
|
10
16
|
declare function remarkInclude(this: Processor): Transformer<Root, Root>;
|
|
11
17
|
|
package/dist/config/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDefaultMDXOptions
|
|
3
|
-
} from "../chunk-FSZMKRVH.js";
|
|
4
1
|
import {
|
|
5
2
|
remarkInclude
|
|
6
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-FBLMK4RS.js";
|
|
4
|
+
import {
|
|
5
|
+
applyMdxPreset
|
|
6
|
+
} from "../chunk-E5DJTSIM.js";
|
|
7
7
|
import "../chunk-VWJKRQZR.js";
|
|
8
8
|
|
|
9
9
|
// src/config/zod-4.ts
|
|
@@ -52,11 +52,11 @@ function defineConfig(config = {}) {
|
|
|
52
52
|
return config;
|
|
53
53
|
}
|
|
54
54
|
export {
|
|
55
|
+
applyMdxPreset,
|
|
55
56
|
defineCollections,
|
|
56
57
|
defineConfig,
|
|
57
58
|
defineDocs,
|
|
58
59
|
frontmatterSchema,
|
|
59
|
-
getDefaultMDXOptions,
|
|
60
60
|
metaSchema,
|
|
61
61
|
remarkInclude
|
|
62
62
|
};
|