fumadocs-mdx 11.5.3 → 11.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3PXNPJQ2.js → chunk-IZURUUPO.js} +1 -1
- package/dist/chunk-KGLACICA.js +43 -0
- package/dist/{chunk-USWGH3VH.js → chunk-R6U7CJLB.js} +14 -17
- package/dist/{chunk-6ZVE73IT.js → chunk-SLCPEEMF.js} +0 -12
- package/dist/config/index.d.cts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +4 -19
- package/dist/{define-BUjajTka.d.ts → define-DxwgTgV6.d.cts} +13 -13
- package/dist/{define-BUjajTka.d.cts → define-DxwgTgV6.d.ts} +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/loader-mdx.cjs +66 -62
- package/dist/loader-mdx.js +20 -36
- package/dist/next/index.cjs +152 -231
- package/dist/next/index.js +106 -81
- package/dist/runtime/async.cjs +9 -147
- package/dist/runtime/async.d.cts +3 -2
- package/dist/runtime/async.d.ts +3 -2
- package/dist/runtime/async.js +10 -9
- package/dist/{types-CvzwQDWV.d.ts → types-2R3kLFSi.d.ts} +8 -2
- package/dist/{types-Dh6jLIT1.d.cts → types-BIA23Xld.d.cts} +8 -2
- package/package.json +5 -5
package/dist/next/index.js
CHANGED
|
@@ -2,18 +2,22 @@ import {
|
|
|
2
2
|
findConfigFile,
|
|
3
3
|
getConfigHash,
|
|
4
4
|
loadConfig
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import
|
|
5
|
+
} from "../chunk-R6U7CJLB.js";
|
|
6
|
+
import {
|
|
7
|
+
validate
|
|
8
|
+
} from "../chunk-KGLACICA.js";
|
|
9
|
+
import "../chunk-SLCPEEMF.js";
|
|
7
10
|
|
|
8
11
|
// src/next/create.ts
|
|
9
12
|
import path3 from "node:path";
|
|
10
13
|
|
|
11
14
|
// src/map/index.ts
|
|
12
15
|
import * as path2 from "node:path";
|
|
13
|
-
import * as
|
|
16
|
+
import * as fs3 from "node:fs/promises";
|
|
14
17
|
|
|
15
18
|
// src/map/generate.ts
|
|
16
19
|
import * as path from "node:path";
|
|
20
|
+
import * as fs2 from "node:fs/promises";
|
|
17
21
|
import fg from "fast-glob";
|
|
18
22
|
|
|
19
23
|
// src/utils/get-type-from-path.ts
|
|
@@ -26,8 +30,65 @@ function getTypeFromPath(path5) {
|
|
|
26
30
|
if (metaTypes.includes(ext)) return "meta";
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
// src/map/file-cache.ts
|
|
34
|
+
var map = /* @__PURE__ */ new Map();
|
|
35
|
+
var fileCache = {
|
|
36
|
+
read(namespace, path5) {
|
|
37
|
+
return map.get(`${namespace}.${path5}}`);
|
|
38
|
+
},
|
|
39
|
+
write(namespace, path5, data) {
|
|
40
|
+
map.set(`${namespace}.${path5}}`, data);
|
|
41
|
+
},
|
|
42
|
+
removeCache(path5) {
|
|
43
|
+
for (const key of map.keys()) {
|
|
44
|
+
const keyPath = key.slice(key.indexOf(".") + 1);
|
|
45
|
+
if (keyPath === path5) map.delete(key);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// src/utils/read-frontmatter.ts
|
|
51
|
+
import * as fs from "node:fs";
|
|
52
|
+
import grayMatter from "gray-matter";
|
|
53
|
+
async function readFrontmatter(file) {
|
|
54
|
+
const readStream = fs.createReadStream(file, {
|
|
55
|
+
highWaterMark: 250
|
|
56
|
+
});
|
|
57
|
+
return new Promise((res, rej) => {
|
|
58
|
+
let idx = 0;
|
|
59
|
+
let str = "";
|
|
60
|
+
readStream.on("data", (_chunk) => {
|
|
61
|
+
const chunk = _chunk.toString();
|
|
62
|
+
if (idx === 0 && !chunk.startsWith("---")) {
|
|
63
|
+
res({});
|
|
64
|
+
readStream.close();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
str += chunk;
|
|
68
|
+
idx++;
|
|
69
|
+
if (str.includes("\n---")) {
|
|
70
|
+
res(
|
|
71
|
+
grayMatter({
|
|
72
|
+
content: str
|
|
73
|
+
}).data
|
|
74
|
+
);
|
|
75
|
+
readStream.close();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
readStream.on("end", () => res({}));
|
|
79
|
+
readStream.on("error", (e) => rej(e));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
29
83
|
// src/map/generate.ts
|
|
30
|
-
async function
|
|
84
|
+
async function readFrontmatterWithCache(file) {
|
|
85
|
+
const cached = fileCache.read("read-frontmatter", file);
|
|
86
|
+
if (cached) return cached;
|
|
87
|
+
const res = await readFrontmatter(file);
|
|
88
|
+
fileCache.write("read-frontmatter", file, res);
|
|
89
|
+
return res;
|
|
90
|
+
}
|
|
91
|
+
async function generateJS(configPath, config, outputPath, configHash) {
|
|
31
92
|
const outDir2 = path.dirname(outputPath);
|
|
32
93
|
let asyncInit = false;
|
|
33
94
|
const lines = [
|
|
@@ -47,7 +108,27 @@ async function generateJS(configPath, config, outputPath, configHash, getFrontma
|
|
|
47
108
|
async function getEntries(collectionName, collection, files) {
|
|
48
109
|
const items = files.map(async (file, i) => {
|
|
49
110
|
config._runtime.files.set(file.absolutePath, collectionName);
|
|
50
|
-
|
|
111
|
+
if (collection.type === "meta") {
|
|
112
|
+
const cached = fileCache.read("generate-js", file.absolutePath);
|
|
113
|
+
if (cached) return cached;
|
|
114
|
+
const source = (await fs2.readFile(file.absolutePath)).toString();
|
|
115
|
+
let data = JSON.parse(source);
|
|
116
|
+
if (collection?.schema) {
|
|
117
|
+
data = await validate(
|
|
118
|
+
collection.schema,
|
|
119
|
+
data,
|
|
120
|
+
{
|
|
121
|
+
source,
|
|
122
|
+
path: file.absolutePath
|
|
123
|
+
},
|
|
124
|
+
`invalid data in ${file.absolutePath}:`
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
const entry = `{ info: ${JSON.stringify(file)}, data: ${JSON.stringify(data)} }`;
|
|
128
|
+
fileCache.write("generate-js", file.absolutePath, entry);
|
|
129
|
+
return entry;
|
|
130
|
+
}
|
|
131
|
+
const importId = `${collectionName}_${i}`;
|
|
51
132
|
lines.unshift(
|
|
52
133
|
getImportCode({
|
|
53
134
|
type: "namespace",
|
|
@@ -73,10 +154,9 @@ async function generateJS(configPath, config, outputPath, configHash, getFrontma
|
|
|
73
154
|
asyncInit = true;
|
|
74
155
|
}
|
|
75
156
|
const entries2 = files.map(async (file) => {
|
|
76
|
-
const frontmatter = await getFrontmatter(file.absolutePath);
|
|
77
157
|
return JSON.stringify({
|
|
78
158
|
info: file,
|
|
79
|
-
data:
|
|
159
|
+
data: await readFrontmatterWithCache(file.absolutePath)
|
|
80
160
|
});
|
|
81
161
|
});
|
|
82
162
|
return Promise.all(entries2);
|
|
@@ -85,19 +165,16 @@ async function generateJS(configPath, config, outputPath, configHash, getFrontma
|
|
|
85
165
|
if (collection.type === "docs") {
|
|
86
166
|
const docs = await getCollectionFiles(collection.docs);
|
|
87
167
|
const metas = await getCollectionFiles(collection.meta);
|
|
168
|
+
const metaEntries = (await getEntries(k, collection.meta, metas)).join(
|
|
169
|
+
", "
|
|
170
|
+
);
|
|
88
171
|
if (collection.docs.async) {
|
|
89
172
|
const docsEntries2 = (await getAsyncEntries(docs)).join(", ");
|
|
90
|
-
const
|
|
91
|
-
", "
|
|
92
|
-
);
|
|
93
|
-
return `export const ${k} = _runtimeAsync.docs<typeof _source.${k}>([${docsEntries2}], [${metaEntries2}], "${k}", _sourceConfig)`;
|
|
173
|
+
return `export const ${k} = _runtimeAsync.docs<typeof _source.${k}>([${docsEntries2}], [${metaEntries}], "${k}", _sourceConfig)`;
|
|
94
174
|
}
|
|
95
175
|
const docsEntries = (await getEntries(k, collection.docs, docs)).join(
|
|
96
176
|
", "
|
|
97
177
|
);
|
|
98
|
-
const metaEntries = (await getEntries(k, collection.meta, metas)).join(
|
|
99
|
-
", "
|
|
100
|
-
);
|
|
101
178
|
return `export const ${k} = _runtime.docs<typeof _source.${k}>([${docsEntries}], [${metaEntries}])`;
|
|
102
179
|
}
|
|
103
180
|
const files = await getCollectionFiles(collection);
|
|
@@ -158,72 +235,23 @@ function toImportPath(file, dir) {
|
|
|
158
235
|
return importPath.replaceAll(path.sep, "/");
|
|
159
236
|
}
|
|
160
237
|
|
|
161
|
-
// src/utils/read-frontmatter.ts
|
|
162
|
-
import * as fs from "node:fs";
|
|
163
|
-
import grayMatter from "gray-matter";
|
|
164
|
-
async function readFrontmatter(file) {
|
|
165
|
-
const readStream = fs.createReadStream(file, {
|
|
166
|
-
highWaterMark: 250
|
|
167
|
-
});
|
|
168
|
-
return new Promise((res, rej) => {
|
|
169
|
-
let idx = 0;
|
|
170
|
-
let str = "";
|
|
171
|
-
readStream.on("data", (_chunk) => {
|
|
172
|
-
const chunk = _chunk.toString();
|
|
173
|
-
if (idx === 0 && !chunk.startsWith("---")) {
|
|
174
|
-
res({});
|
|
175
|
-
readStream.close();
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
str += chunk;
|
|
179
|
-
idx++;
|
|
180
|
-
if (str.includes("\n---")) {
|
|
181
|
-
res(
|
|
182
|
-
grayMatter({
|
|
183
|
-
content: str
|
|
184
|
-
}).data
|
|
185
|
-
);
|
|
186
|
-
readStream.close();
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
readStream.on("end", () => res({}));
|
|
190
|
-
readStream.on("error", (e) => rej(e));
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
238
|
// src/map/index.ts
|
|
195
239
|
async function start(dev, configPath, outDir2) {
|
|
196
|
-
void
|
|
197
|
-
void
|
|
198
|
-
await
|
|
240
|
+
void fs3.rm(path2.resolve(outDir2, `index.js`), { force: true });
|
|
241
|
+
void fs3.rm(path2.resolve(outDir2, `index.d.ts`), { force: true });
|
|
242
|
+
await fs3.mkdir(outDir2, { recursive: true });
|
|
199
243
|
let configHash = await getConfigHash(configPath);
|
|
200
244
|
let config = await loadConfig(configPath, configHash, true);
|
|
201
245
|
const outPath = path2.resolve(outDir2, `index.ts`);
|
|
202
|
-
const frontmatterCache = /* @__PURE__ */ new Map();
|
|
203
|
-
let hookUpdate = false;
|
|
204
|
-
async function readFrontmatterWithCache(file) {
|
|
205
|
-
hookUpdate = true;
|
|
206
|
-
const cached = frontmatterCache.get(file);
|
|
207
|
-
if (cached) return cached;
|
|
208
|
-
const res = await readFrontmatter(file);
|
|
209
|
-
frontmatterCache.set(file, res);
|
|
210
|
-
return res;
|
|
211
|
-
}
|
|
212
246
|
async function updateMapFile() {
|
|
213
|
-
|
|
247
|
+
console.time(`[MDX] update map file`);
|
|
248
|
+
await fs3.writeFile(
|
|
214
249
|
outPath,
|
|
215
|
-
await generateJS(
|
|
216
|
-
configPath,
|
|
217
|
-
config,
|
|
218
|
-
outPath,
|
|
219
|
-
configHash,
|
|
220
|
-
readFrontmatterWithCache
|
|
221
|
-
)
|
|
250
|
+
await generateJS(configPath, config, outPath, configHash)
|
|
222
251
|
);
|
|
252
|
+
console.timeEnd(`[MDX] update map file`);
|
|
223
253
|
}
|
|
224
|
-
console.time(`[MDX] initialize map file`);
|
|
225
254
|
await updateMapFile();
|
|
226
|
-
console.timeEnd(`[MDX] initialize map file`);
|
|
227
255
|
if (dev) {
|
|
228
256
|
const { watcher } = await import("../watcher-IAZDSTU7.js");
|
|
229
257
|
const instance = watcher(configPath, config);
|
|
@@ -232,17 +260,15 @@ async function start(dev, configPath, outDir2) {
|
|
|
232
260
|
});
|
|
233
261
|
instance.on("all", (event, file) => {
|
|
234
262
|
if (typeof file !== "string") return;
|
|
263
|
+
const absolutePath = path2.resolve(file);
|
|
235
264
|
const onUpdate = async () => {
|
|
236
|
-
const isConfigFile =
|
|
265
|
+
const isConfigFile = absolutePath === configPath;
|
|
237
266
|
if (isConfigFile) {
|
|
238
267
|
configHash = await getConfigHash(configPath);
|
|
239
268
|
config = await loadConfig(configPath, configHash, true);
|
|
240
269
|
}
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
await updateMapFile();
|
|
244
|
-
console.log("[MDX] Updated map file");
|
|
245
|
-
}
|
|
270
|
+
if (event === "change") fileCache.removeCache(absolutePath);
|
|
271
|
+
await updateMapFile();
|
|
246
272
|
};
|
|
247
273
|
void onUpdate();
|
|
248
274
|
});
|
|
@@ -316,20 +342,19 @@ function createMDX({
|
|
|
316
342
|
|
|
317
343
|
// src/postinstall.ts
|
|
318
344
|
import * as path4 from "node:path";
|
|
319
|
-
import * as
|
|
345
|
+
import * as fs4 from "node:fs";
|
|
320
346
|
async function postInstall(configPath = findConfigFile()) {
|
|
321
347
|
const jsOut = path4.resolve(".source/index.ts");
|
|
322
348
|
const hash = await getConfigHash(configPath);
|
|
323
349
|
const config = await loadConfig(configPath, hash, true);
|
|
324
|
-
|
|
325
|
-
|
|
350
|
+
fs4.mkdirSync(path4.dirname(jsOut), { recursive: true });
|
|
351
|
+
fs4.writeFileSync(
|
|
326
352
|
jsOut,
|
|
327
353
|
await generateJS(
|
|
328
354
|
configPath,
|
|
329
355
|
config,
|
|
330
356
|
path4.resolve(".source/index.ts"),
|
|
331
|
-
hash
|
|
332
|
-
readFrontmatter
|
|
357
|
+
hash
|
|
333
358
|
)
|
|
334
359
|
);
|
|
335
360
|
console.log("[MDX] types generated");
|
package/dist/runtime/async.cjs
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,130 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
29
|
|
|
33
|
-
// src/mdx-plugins/remark-exports.ts
|
|
34
|
-
function remarkMdxExport({ values }) {
|
|
35
|
-
return (tree, vfile) => {
|
|
36
|
-
for (const name of values) {
|
|
37
|
-
if (!(name in vfile.data)) return;
|
|
38
|
-
tree.children.unshift(getMdastExport(name, vfile.data[name]));
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function getMdastExport(name, value) {
|
|
43
|
-
return {
|
|
44
|
-
type: "mdxjsEsm",
|
|
45
|
-
value: "",
|
|
46
|
-
data: {
|
|
47
|
-
estree: {
|
|
48
|
-
type: "Program",
|
|
49
|
-
sourceType: "module",
|
|
50
|
-
body: [
|
|
51
|
-
{
|
|
52
|
-
type: "ExportNamedDeclaration",
|
|
53
|
-
specifiers: [],
|
|
54
|
-
source: null,
|
|
55
|
-
declaration: {
|
|
56
|
-
type: "VariableDeclaration",
|
|
57
|
-
kind: "let",
|
|
58
|
-
declarations: [
|
|
59
|
-
{
|
|
60
|
-
type: "VariableDeclarator",
|
|
61
|
-
id: {
|
|
62
|
-
type: "Identifier",
|
|
63
|
-
name
|
|
64
|
-
},
|
|
65
|
-
init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
var import_estree_util_value_to_estree;
|
|
76
|
-
var init_remark_exports = __esm({
|
|
77
|
-
"src/mdx-plugins/remark-exports.ts"() {
|
|
78
|
-
"use strict";
|
|
79
|
-
import_estree_util_value_to_estree = require("estree-util-value-to-estree");
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// src/utils/mdx-options.ts
|
|
84
|
-
var mdx_options_exports = {};
|
|
85
|
-
__export(mdx_options_exports, {
|
|
86
|
-
getDefaultMDXOptions: () => getDefaultMDXOptions
|
|
87
|
-
});
|
|
88
|
-
function pluginOption(def, options = []) {
|
|
89
|
-
const list = def(Array.isArray(options) ? options : []).filter(
|
|
90
|
-
Boolean
|
|
91
|
-
);
|
|
92
|
-
if (typeof options === "function") {
|
|
93
|
-
return options(list);
|
|
94
|
-
}
|
|
95
|
-
return list;
|
|
96
|
-
}
|
|
97
|
-
function getDefaultMDXOptions({
|
|
98
|
-
valueToExport = [],
|
|
99
|
-
rehypeCodeOptions,
|
|
100
|
-
remarkImageOptions,
|
|
101
|
-
remarkHeadingOptions,
|
|
102
|
-
remarkStructureOptions,
|
|
103
|
-
remarkCodeTabOptions,
|
|
104
|
-
...mdxOptions
|
|
105
|
-
}) {
|
|
106
|
-
const mdxExports = [
|
|
107
|
-
"structuredData",
|
|
108
|
-
"frontmatter",
|
|
109
|
-
"lastModified",
|
|
110
|
-
...valueToExport
|
|
111
|
-
];
|
|
112
|
-
const remarkPlugins = pluginOption(
|
|
113
|
-
(v) => [
|
|
114
|
-
plugins.remarkGfm,
|
|
115
|
-
[
|
|
116
|
-
plugins.remarkHeading,
|
|
117
|
-
{
|
|
118
|
-
generateToc: false,
|
|
119
|
-
...remarkHeadingOptions
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
|
|
123
|
-
// Fumadocs 14 compatibility
|
|
124
|
-
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && plugins.remarkCodeTab,
|
|
125
|
-
...v,
|
|
126
|
-
remarkStructureOptions !== false && [
|
|
127
|
-
plugins.remarkStructure,
|
|
128
|
-
remarkStructureOptions
|
|
129
|
-
],
|
|
130
|
-
[remarkMdxExport, { values: mdxExports }]
|
|
131
|
-
],
|
|
132
|
-
mdxOptions.remarkPlugins
|
|
133
|
-
);
|
|
134
|
-
const rehypePlugins = pluginOption(
|
|
135
|
-
(v) => [
|
|
136
|
-
rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
|
|
137
|
-
...v,
|
|
138
|
-
[plugins.rehypeToc]
|
|
139
|
-
],
|
|
140
|
-
mdxOptions.rehypePlugins
|
|
141
|
-
);
|
|
142
|
-
return {
|
|
143
|
-
...mdxOptions,
|
|
144
|
-
remarkPlugins,
|
|
145
|
-
rehypePlugins
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
var plugins;
|
|
149
|
-
var init_mdx_options = __esm({
|
|
150
|
-
"src/utils/mdx-options.ts"() {
|
|
151
|
-
"use strict";
|
|
152
|
-
plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
|
|
153
|
-
init_remark_exports();
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
|
|
157
30
|
// src/runtime/async.ts
|
|
158
31
|
var async_exports = {};
|
|
159
32
|
__export(async_exports, {
|
|
@@ -234,7 +107,7 @@ var _runtime = {
|
|
|
234
107
|
meta(files) {
|
|
235
108
|
return files.map((file) => {
|
|
236
109
|
return {
|
|
237
|
-
...file.data
|
|
110
|
+
...file.data,
|
|
238
111
|
_file: file.info
|
|
239
112
|
};
|
|
240
113
|
});
|
|
@@ -311,23 +184,11 @@ function buildConfig(config) {
|
|
|
311
184
|
null
|
|
312
185
|
];
|
|
313
186
|
}
|
|
314
|
-
let cachedMdxOptions;
|
|
315
187
|
return [
|
|
316
188
|
null,
|
|
317
189
|
{
|
|
318
190
|
global: globalConfig,
|
|
319
191
|
collections,
|
|
320
|
-
async getDefaultMDXOptions() {
|
|
321
|
-
if (cachedMdxOptions) return cachedMdxOptions;
|
|
322
|
-
const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
|
|
323
|
-
const mdxOptions = globalConfig?.mdxOptions ?? {};
|
|
324
|
-
if (typeof mdxOptions === "function") {
|
|
325
|
-
cachedMdxOptions = getDefaultMDXOptions2(await mdxOptions());
|
|
326
|
-
} else {
|
|
327
|
-
cachedMdxOptions = getDefaultMDXOptions2(mdxOptions);
|
|
328
|
-
}
|
|
329
|
-
return cachedMdxOptions;
|
|
330
|
-
},
|
|
331
192
|
_runtime: {
|
|
332
193
|
files: /* @__PURE__ */ new Map()
|
|
333
194
|
}
|
|
@@ -343,14 +204,15 @@ async function initCompiler(config, collection) {
|
|
|
343
204
|
else if (col?.type === "docs")
|
|
344
205
|
mdxOptions = col.docs?.mdxOptions;
|
|
345
206
|
if (!mdxOptions) {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
mdxOptions =
|
|
349
|
-
...options,
|
|
350
|
-
remarkPlugins: (v) => typeof remarkPlugins === "function" ? [remarkInclude, ...remarkPlugins(v), import_mdx_plugins.remarkStructure] : [remarkInclude, ...v, ...remarkPlugins, import_mdx_plugins.remarkStructure]
|
|
351
|
-
};
|
|
207
|
+
config._mdx_async ??= {};
|
|
208
|
+
config._mdx_async.cachedMdxOptions ??= typeof config.global?.mdxOptions === "function" ? await config.global.mdxOptions() : config.global?.mdxOptions ?? {};
|
|
209
|
+
mdxOptions = config._mdx_async.cachedMdxOptions;
|
|
352
210
|
}
|
|
353
|
-
|
|
211
|
+
const remarkPlugins = mdxOptions.remarkPlugins ?? [];
|
|
212
|
+
return (0, import_mdx_remote.createCompiler)({
|
|
213
|
+
...mdxOptions,
|
|
214
|
+
remarkPlugins: (v) => typeof remarkPlugins === "function" ? [remarkInclude, ...remarkPlugins(v), import_mdx_plugins.remarkStructure] : [remarkInclude, ...v, ...remarkPlugins, import_mdx_plugins.remarkStructure]
|
|
215
|
+
});
|
|
354
216
|
}
|
|
355
217
|
var _runtimeAsync = {
|
|
356
218
|
doc(files, collection, config) {
|
package/dist/runtime/async.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoadedConfig, b as RuntimeAsync } from '../types-
|
|
2
|
-
import '../define-
|
|
1
|
+
import { L as LoadedConfig, b as RuntimeAsync } from '../types-BIA23Xld.cjs';
|
|
2
|
+
import '../define-DxwgTgV6.cjs';
|
|
3
3
|
import '@mdx-js/mdx';
|
|
4
4
|
import 'mdx/types';
|
|
5
5
|
import 'fumadocs-core/mdx-plugins';
|
|
@@ -9,6 +9,7 @@ import 'react';
|
|
|
9
9
|
import 'zod';
|
|
10
10
|
import '@standard-schema/spec';
|
|
11
11
|
import 'fumadocs-core/source';
|
|
12
|
+
import '@fumadocs/mdx-remote';
|
|
12
13
|
|
|
13
14
|
declare function buildConfig(config: Record<string, unknown>): [err: string, value: null] | [err: null, value: LoadedConfig];
|
|
14
15
|
|
package/dist/runtime/async.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoadedConfig, b as RuntimeAsync } from '../types-
|
|
2
|
-
import '../define-
|
|
1
|
+
import { L as LoadedConfig, b as RuntimeAsync } from '../types-2R3kLFSi.js';
|
|
2
|
+
import '../define-DxwgTgV6.js';
|
|
3
3
|
import '@mdx-js/mdx';
|
|
4
4
|
import 'mdx/types';
|
|
5
5
|
import 'fumadocs-core/mdx-plugins';
|
|
@@ -9,6 +9,7 @@ import 'react';
|
|
|
9
9
|
import 'zod';
|
|
10
10
|
import '@standard-schema/spec';
|
|
11
11
|
import 'fumadocs-core/source';
|
|
12
|
+
import '@fumadocs/mdx-remote';
|
|
12
13
|
|
|
13
14
|
declare function buildConfig(config: Record<string, unknown>): [err: string, value: null] | [err: null, value: LoadedConfig];
|
|
14
15
|
|
package/dist/runtime/async.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
_runtime,
|
|
3
3
|
createMDXSource
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-IZURUUPO.js";
|
|
5
5
|
import {
|
|
6
6
|
remarkInclude
|
|
7
7
|
} from "../chunk-PY2KKTR2.js";
|
|
8
8
|
import {
|
|
9
9
|
buildConfig
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-SLCPEEMF.js";
|
|
11
11
|
|
|
12
12
|
// src/runtime/async.ts
|
|
13
13
|
import { createCompiler } from "@fumadocs/mdx-remote";
|
|
@@ -22,14 +22,15 @@ async function initCompiler(config, collection) {
|
|
|
22
22
|
else if (col?.type === "docs")
|
|
23
23
|
mdxOptions = col.docs?.mdxOptions;
|
|
24
24
|
if (!mdxOptions) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
mdxOptions =
|
|
28
|
-
...options,
|
|
29
|
-
remarkPlugins: (v) => typeof remarkPlugins === "function" ? [remarkInclude, ...remarkPlugins(v), remarkStructure] : [remarkInclude, ...v, ...remarkPlugins, remarkStructure]
|
|
30
|
-
};
|
|
25
|
+
config._mdx_async ??= {};
|
|
26
|
+
config._mdx_async.cachedMdxOptions ??= typeof config.global?.mdxOptions === "function" ? await config.global.mdxOptions() : config.global?.mdxOptions ?? {};
|
|
27
|
+
mdxOptions = config._mdx_async.cachedMdxOptions;
|
|
31
28
|
}
|
|
32
|
-
|
|
29
|
+
const remarkPlugins = mdxOptions.remarkPlugins ?? [];
|
|
30
|
+
return createCompiler({
|
|
31
|
+
...mdxOptions,
|
|
32
|
+
remarkPlugins: (v) => typeof remarkPlugins === "function" ? [remarkInclude, ...remarkPlugins(v), remarkStructure] : [remarkInclude, ...v, ...remarkPlugins, remarkStructure]
|
|
33
|
+
});
|
|
33
34
|
}
|
|
34
35
|
var _runtimeAsync = {
|
|
35
36
|
doc(files, collection, config) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-
|
|
1
|
+
import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-DxwgTgV6.js';
|
|
2
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
|
+
import { MDXOptions } from '@fumadocs/mdx-remote';
|
|
5
6
|
|
|
6
7
|
interface LoadedConfig {
|
|
7
8
|
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
8
|
-
getDefaultMDXOptions: () => Promise<ProcessorOptions>;
|
|
9
9
|
global?: GlobalConfig;
|
|
10
10
|
_runtime: {
|
|
11
11
|
/**
|
|
@@ -13,6 +13,12 @@ interface LoadedConfig {
|
|
|
13
13
|
*/
|
|
14
14
|
files: Map<string, string>;
|
|
15
15
|
};
|
|
16
|
+
_mdx_loader?: {
|
|
17
|
+
cachedProcessorOptions?: ProcessorOptions;
|
|
18
|
+
};
|
|
19
|
+
_mdx_async?: {
|
|
20
|
+
cachedMdxOptions?: MDXOptions;
|
|
21
|
+
};
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
interface RuntimeFile {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-
|
|
1
|
+
import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-DxwgTgV6.cjs';
|
|
2
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
|
+
import { MDXOptions } from '@fumadocs/mdx-remote';
|
|
5
6
|
|
|
6
7
|
interface LoadedConfig {
|
|
7
8
|
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
8
|
-
getDefaultMDXOptions: () => Promise<ProcessorOptions>;
|
|
9
9
|
global?: GlobalConfig;
|
|
10
10
|
_runtime: {
|
|
11
11
|
/**
|
|
@@ -13,6 +13,12 @@ interface LoadedConfig {
|
|
|
13
13
|
*/
|
|
14
14
|
files: Map<string, string>;
|
|
15
15
|
};
|
|
16
|
+
_mdx_loader?: {
|
|
17
|
+
cachedProcessorOptions?: ProcessorOptions;
|
|
18
|
+
};
|
|
19
|
+
_mdx_async?: {
|
|
20
|
+
cachedMdxOptions?: MDXOptions;
|
|
21
|
+
};
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
interface RuntimeFile {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-mdx",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.5",
|
|
4
4
|
"description": "The built-in source for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@standard-schema/spec": "^1.0.0",
|
|
47
47
|
"chokidar": "^4.0.3",
|
|
48
48
|
"cross-spawn": "^7.0.6",
|
|
49
|
-
"esbuild": "^0.
|
|
49
|
+
"esbuild": "^0.25.0",
|
|
50
50
|
"estree-util-value-to-estree": "^3.3.2",
|
|
51
51
|
"fast-glob": "^3.3.3",
|
|
52
52
|
"gray-matter": "^4.0.3",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"vfile": "^6.0.3",
|
|
65
65
|
"webpack": "^5.97.1",
|
|
66
66
|
"@fumadocs/mdx-remote": "1.2.0",
|
|
67
|
-
"
|
|
68
|
-
"fumadocs-core": "15.0.
|
|
69
|
-
"
|
|
67
|
+
"eslint-config-custom": "0.0.0",
|
|
68
|
+
"fumadocs-core": "15.0.8",
|
|
69
|
+
"tsconfig": "0.0.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@fumadocs/mdx-remote": "^1.2.0",
|