fumadocs-mdx 11.10.0 → 12.0.0
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 +953 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +16 -0
- package/dist/{browser-B2G8uAF2.d.cts → browser-D5lvL8vv.d.ts} +51 -4
- package/dist/{browser-DrH7tKRi.d.ts → browser-DjWADqp8.d.cts} +51 -4
- package/dist/bun/index.cjs +129 -109
- package/dist/bun/index.js +9 -6
- package/dist/chunk-3M4SHY6K.js +80 -0
- package/dist/chunk-6Y5JDZHD.js +65 -0
- package/dist/{chunk-NUDEC6C5.js → chunk-AUOOMFAI.js} +28 -22
- package/dist/chunk-IQAEAI4P.js +66 -0
- package/dist/{chunk-5XJM5RPV.js → chunk-KGUBBRL6.js} +13 -13
- package/dist/{chunk-SVTXMVLQ.js → chunk-KTDVTBMH.js} +1 -1
- package/dist/chunk-POXTQZ4D.js +60 -0
- package/dist/chunk-SWNOXPYJ.js +142 -0
- package/dist/{chunk-COQ4VMK2.js → chunk-TLD6JMT6.js} +28 -61
- package/dist/{chunk-NVX3U5YE.js → chunk-VXEBLM4X.js} +2 -2
- package/dist/{chunk-QVZ7JH4H.js → chunk-YC25YEBF.js} +1 -1
- package/dist/chunk-ZLCSVXCD.js +10 -0
- package/dist/config/index.cjs +18 -97
- package/dist/config/index.d.cts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +48 -9
- package/dist/{define-BH4bnHQl.d.cts → define--6HQ1ehX.d.cts} +18 -3
- package/dist/{define-BH4bnHQl.d.ts → define--6HQ1ehX.d.ts} +18 -3
- package/dist/loader-mdx.cjs +127 -139
- package/dist/loader-mdx.js +7 -6
- package/dist/next/index.cjs +44 -269
- package/dist/next/index.js +30 -46
- package/dist/node/loader.cjs +131 -143
- package/dist/node/loader.js +7 -6
- package/dist/postinstall-U7VROOY7.js +9 -0
- package/dist/{mdx-options-T73E4LQB.js → preset-WFEORCAB.js} +1 -1
- package/dist/runtime/{async.cjs → next/async.cjs} +202 -154
- package/dist/runtime/{async.d.cts → next/async.d.cts} +3 -3
- package/dist/runtime/{async.d.ts → next/async.d.ts} +3 -3
- package/dist/runtime/next/async.js +92 -0
- package/dist/{index.cjs → runtime/next/index.cjs} +35 -26
- package/dist/runtime/next/index.d.cts +30 -0
- package/dist/runtime/next/index.d.ts +30 -0
- package/dist/{index.js → runtime/next/index.js} +2 -1
- package/dist/runtime/vite/browser.d.cts +2 -3
- package/dist/runtime/vite/browser.d.ts +2 -3
- package/dist/runtime/vite/server.cjs +67 -21
- package/dist/runtime/vite/server.d.cts +14 -28
- package/dist/runtime/vite/server.d.ts +14 -28
- package/dist/runtime/vite/server.js +61 -21
- package/dist/shared-0QIuV0XZ.d.ts +70 -0
- package/dist/shared-CqgMnt9h.d.cts +70 -0
- package/dist/{types-DN9KrG7R.d.ts → types-DLIAvrgC.d.ts} +6 -32
- package/dist/{types-DT83Ijs6.d.cts → types-Dl8HLbm5.d.cts} +6 -32
- package/dist/vite/index.cjs +201 -123
- package/dist/vite/index.d.cts +4 -1
- package/dist/vite/index.d.ts +4 -1
- package/dist/vite/index.js +13 -9
- package/package.json +11 -17
- package/bin.js +0 -5
- package/dist/build-mdx-DnC1jKvn.d.cts +0 -46
- package/dist/build-mdx-DnC1jKvn.d.ts +0 -46
- package/dist/chunk-2HKRTQYP.js +0 -154
- package/dist/chunk-GBMFGEC7.js +0 -57
- package/dist/chunk-QQWCBFFE.js +0 -40
- package/dist/chunk-SMSNZ6N5.js +0 -155
- package/dist/config/zod-3.cjs +0 -422
- package/dist/config/zod-3.d.cts +0 -53
- package/dist/config/zod-3.d.ts +0 -53
- package/dist/config/zod-3.js +0 -40
- package/dist/index.d.cts +0 -26
- package/dist/index.d.ts +0 -26
- package/dist/runtime/async.js +0 -72
|
@@ -30,86 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// src/mdx
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}) {
|
|
37
|
-
return (tree, file) => {
|
|
38
|
-
let title;
|
|
39
|
-
const urls = [];
|
|
40
|
-
(0, import_unist_util_visit2.visit)(tree, ["heading", "link"], (node) => {
|
|
41
|
-
if (node.type === "heading" && node.depth === 1) {
|
|
42
|
-
title = flattenNode2(node);
|
|
43
|
-
}
|
|
44
|
-
if (node.type !== "link") return;
|
|
45
|
-
urls.push({
|
|
46
|
-
href: node.url
|
|
47
|
-
});
|
|
48
|
-
return "skip";
|
|
49
|
-
});
|
|
50
|
-
if (title) {
|
|
51
|
-
file.data.frontmatter ??= {};
|
|
52
|
-
if (!file.data.frontmatter.title) file.data.frontmatter.title = title;
|
|
53
|
-
}
|
|
54
|
-
file.data.extractedReferences = urls;
|
|
55
|
-
for (const name of injectExports) {
|
|
56
|
-
if (!(name in file.data)) continue;
|
|
57
|
-
tree.children.unshift(getMdastExport(name, file.data[name]));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function flattenNode2(node) {
|
|
62
|
-
if ("children" in node)
|
|
63
|
-
return node.children.map((child) => flattenNode2(child)).join("");
|
|
64
|
-
if ("value" in node) return node.value;
|
|
65
|
-
return "";
|
|
66
|
-
}
|
|
67
|
-
function getMdastExport(name, value) {
|
|
68
|
-
return {
|
|
69
|
-
type: "mdxjsEsm",
|
|
70
|
-
value: "",
|
|
71
|
-
data: {
|
|
72
|
-
estree: {
|
|
73
|
-
type: "Program",
|
|
74
|
-
sourceType: "module",
|
|
75
|
-
body: [
|
|
76
|
-
{
|
|
77
|
-
type: "ExportNamedDeclaration",
|
|
78
|
-
attributes: [],
|
|
79
|
-
specifiers: [],
|
|
80
|
-
source: null,
|
|
81
|
-
declaration: {
|
|
82
|
-
type: "VariableDeclaration",
|
|
83
|
-
kind: "let",
|
|
84
|
-
declarations: [
|
|
85
|
-
{
|
|
86
|
-
type: "VariableDeclarator",
|
|
87
|
-
id: {
|
|
88
|
-
type: "Identifier",
|
|
89
|
-
name
|
|
90
|
-
},
|
|
91
|
-
init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
var import_unist_util_visit2, import_estree_util_value_to_estree;
|
|
102
|
-
var init_remark_postprocess = __esm({
|
|
103
|
-
"src/mdx-plugins/remark-postprocess.ts"() {
|
|
104
|
-
"use strict";
|
|
105
|
-
import_unist_util_visit2 = require("unist-util-visit");
|
|
106
|
-
import_estree_util_value_to_estree = require("estree-util-value-to-estree");
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// src/utils/mdx-options.ts
|
|
111
|
-
var mdx_options_exports = {};
|
|
112
|
-
__export(mdx_options_exports, {
|
|
33
|
+
// src/mdx/preset.ts
|
|
34
|
+
var preset_exports = {};
|
|
35
|
+
__export(preset_exports, {
|
|
113
36
|
getDefaultMDXOptions: () => getDefaultMDXOptions
|
|
114
37
|
});
|
|
115
38
|
function pluginOption(def, options = []) {
|
|
@@ -132,13 +55,6 @@ function getDefaultMDXOptions({
|
|
|
132
55
|
_withoutBundler = false,
|
|
133
56
|
...mdxOptions
|
|
134
57
|
}) {
|
|
135
|
-
const mdxExports = [
|
|
136
|
-
"structuredData",
|
|
137
|
-
"extractedReferences",
|
|
138
|
-
"frontmatter",
|
|
139
|
-
"lastModified",
|
|
140
|
-
...valueToExport
|
|
141
|
-
];
|
|
142
58
|
const remarkPlugins = pluginOption(
|
|
143
59
|
(v) => [
|
|
144
60
|
plugins.remarkGfm,
|
|
@@ -166,10 +82,15 @@ function getDefaultMDXOptions({
|
|
|
166
82
|
plugins.remarkStructure,
|
|
167
83
|
remarkStructureOptions
|
|
168
84
|
],
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
85
|
+
() => {
|
|
86
|
+
return (_, file) => {
|
|
87
|
+
file.data["mdx-export"] ??= [];
|
|
88
|
+
for (const name of valueToExport) {
|
|
89
|
+
if (name in file.data)
|
|
90
|
+
file.data["mdx-export"].push({ name, value: file.data[name] });
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
173
94
|
],
|
|
174
95
|
mdxOptions.remarkPlugins
|
|
175
96
|
);
|
|
@@ -189,15 +110,14 @@ function getDefaultMDXOptions({
|
|
|
189
110
|
};
|
|
190
111
|
}
|
|
191
112
|
var plugins;
|
|
192
|
-
var
|
|
193
|
-
"src/
|
|
113
|
+
var init_preset = __esm({
|
|
114
|
+
"src/mdx/preset.ts"() {
|
|
194
115
|
"use strict";
|
|
195
116
|
plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
|
|
196
|
-
init_remark_postprocess();
|
|
197
117
|
}
|
|
198
118
|
});
|
|
199
119
|
|
|
200
|
-
// src/runtime/async.ts
|
|
120
|
+
// src/runtime/next/async.ts
|
|
201
121
|
var async_exports = {};
|
|
202
122
|
__export(async_exports, {
|
|
203
123
|
_runtimeAsync: () => _runtimeAsync,
|
|
@@ -205,26 +125,37 @@ __export(async_exports, {
|
|
|
205
125
|
});
|
|
206
126
|
module.exports = __toCommonJS(async_exports);
|
|
207
127
|
|
|
208
|
-
// src/runtime/index.ts
|
|
209
|
-
var
|
|
210
|
-
|
|
128
|
+
// src/runtime/next/index.ts
|
|
129
|
+
var fs = __toESM(require("fs/promises"), 1);
|
|
130
|
+
|
|
131
|
+
// src/runtime/shared.ts
|
|
132
|
+
function missingProcessedMarkdown() {
|
|
133
|
+
throw new Error(
|
|
134
|
+
"getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/runtime/next/index.ts
|
|
211
139
|
var _runtime = {
|
|
212
140
|
doc(files) {
|
|
213
141
|
return files.map((file) => {
|
|
214
|
-
const
|
|
142
|
+
const data = file.data;
|
|
143
|
+
const filePath = file.info.fullPath;
|
|
215
144
|
return {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
145
|
+
info: file.info,
|
|
146
|
+
_exports: data,
|
|
147
|
+
body: data.default,
|
|
148
|
+
lastModified: data.lastModified,
|
|
149
|
+
toc: data.toc,
|
|
150
|
+
structuredData: data.structuredData,
|
|
151
|
+
extractedReferences: data.extractedReferences,
|
|
152
|
+
...data.frontmatter,
|
|
153
|
+
async getText(type) {
|
|
154
|
+
if (type === "raw") {
|
|
155
|
+
return (await fs.readFile(filePath)).toString();
|
|
156
|
+
}
|
|
157
|
+
if (typeof data._markdown !== "string") missingProcessedMarkdown();
|
|
158
|
+
return data._markdown;
|
|
228
159
|
}
|
|
229
160
|
};
|
|
230
161
|
});
|
|
@@ -232,8 +163,8 @@ var _runtime = {
|
|
|
232
163
|
meta(files) {
|
|
233
164
|
return files.map((file) => {
|
|
234
165
|
return {
|
|
235
|
-
|
|
236
|
-
|
|
166
|
+
info: file.info,
|
|
167
|
+
...file.data
|
|
237
168
|
};
|
|
238
169
|
});
|
|
239
170
|
},
|
|
@@ -262,26 +193,26 @@ function resolveFiles({ docs, meta }) {
|
|
|
262
193
|
for (const entry of docs) {
|
|
263
194
|
outputs.push({
|
|
264
195
|
type: "page",
|
|
265
|
-
absolutePath: entry.
|
|
266
|
-
path: entry.
|
|
196
|
+
absolutePath: entry.info.fullPath,
|
|
197
|
+
path: entry.info.path,
|
|
267
198
|
data: entry
|
|
268
199
|
});
|
|
269
200
|
}
|
|
270
201
|
for (const entry of meta) {
|
|
271
202
|
outputs.push({
|
|
272
203
|
type: "meta",
|
|
273
|
-
absolutePath: entry.
|
|
274
|
-
path: entry.
|
|
204
|
+
absolutePath: entry.info.fullPath,
|
|
205
|
+
path: entry.info.path,
|
|
275
206
|
data: entry
|
|
276
207
|
});
|
|
277
208
|
}
|
|
278
209
|
return outputs;
|
|
279
210
|
}
|
|
280
211
|
|
|
281
|
-
// src/
|
|
212
|
+
// src/mdx/build-mdx.ts
|
|
282
213
|
var import_mdx = require("@mdx-js/mdx");
|
|
283
214
|
|
|
284
|
-
// src/mdx
|
|
215
|
+
// src/mdx/remark-include.ts
|
|
285
216
|
var import_unified = require("unified");
|
|
286
217
|
var import_unist_util_visit = require("unist-util-visit");
|
|
287
218
|
var path = __toESM(require("path"), 1);
|
|
@@ -303,7 +234,7 @@ function fumaMatter(input) {
|
|
|
303
234
|
return output;
|
|
304
235
|
}
|
|
305
236
|
|
|
306
|
-
// src/mdx
|
|
237
|
+
// src/mdx/remark-include.ts
|
|
307
238
|
var import_remark_parse = __toESM(require("remark-parse"), 1);
|
|
308
239
|
var import_remark_mdx = __toESM(require("remark-mdx"), 1);
|
|
309
240
|
var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
|
|
@@ -431,21 +362,121 @@ function getDefaultProcessor(format) {
|
|
|
431
362
|
return mdProcessor.use(import_remark_mdx.default);
|
|
432
363
|
}
|
|
433
364
|
|
|
434
|
-
// src/
|
|
435
|
-
var
|
|
365
|
+
// src/mdx/remark-postprocess.ts
|
|
366
|
+
var import_unist_util_visit2 = require("unist-util-visit");
|
|
367
|
+
var import_mdast_util_to_markdown = require("mdast-util-to-markdown");
|
|
368
|
+
var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
|
|
369
|
+
function remarkPostprocess({
|
|
370
|
+
includeProcessedMarkdown = false,
|
|
371
|
+
valueToExport = []
|
|
372
|
+
} = {}) {
|
|
373
|
+
return (tree, file) => {
|
|
374
|
+
let title;
|
|
375
|
+
const urls = [];
|
|
376
|
+
(0, import_unist_util_visit2.visit)(tree, ["heading", "link"], (node) => {
|
|
377
|
+
if (node.type === "heading" && node.depth === 1) {
|
|
378
|
+
title = flattenNode2(node);
|
|
379
|
+
}
|
|
380
|
+
if (node.type !== "link") return;
|
|
381
|
+
urls.push({
|
|
382
|
+
href: node.url
|
|
383
|
+
});
|
|
384
|
+
return "skip";
|
|
385
|
+
});
|
|
386
|
+
if (title) {
|
|
387
|
+
file.data.frontmatter ??= {};
|
|
388
|
+
if (!file.data.frontmatter.title) file.data.frontmatter.title = title;
|
|
389
|
+
}
|
|
390
|
+
file.data.extractedReferences = urls;
|
|
391
|
+
if (includeProcessedMarkdown) {
|
|
392
|
+
file.data._markdown = (0, import_mdast_util_to_markdown.toMarkdown)(tree, {
|
|
393
|
+
...this.data("settings"),
|
|
394
|
+
// @ts-expect-error - from https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/lib/index.js
|
|
395
|
+
extensions: this.data("toMarkdownExtensions") || []
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
for (const { name, value } of file.data["mdx-export"] ?? []) {
|
|
399
|
+
tree.children.unshift(getMdastExport(name, value));
|
|
400
|
+
}
|
|
401
|
+
for (const name of valueToExport) {
|
|
402
|
+
if (!(name in file.data)) continue;
|
|
403
|
+
tree.children.unshift(getMdastExport(name, file.data[name]));
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function getMdastExport(name, value) {
|
|
408
|
+
return {
|
|
409
|
+
type: "mdxjsEsm",
|
|
410
|
+
value: "",
|
|
411
|
+
data: {
|
|
412
|
+
estree: {
|
|
413
|
+
type: "Program",
|
|
414
|
+
sourceType: "module",
|
|
415
|
+
body: [
|
|
416
|
+
{
|
|
417
|
+
type: "ExportNamedDeclaration",
|
|
418
|
+
attributes: [],
|
|
419
|
+
specifiers: [],
|
|
420
|
+
source: null,
|
|
421
|
+
declaration: {
|
|
422
|
+
type: "VariableDeclaration",
|
|
423
|
+
kind: "let",
|
|
424
|
+
declarations: [
|
|
425
|
+
{
|
|
426
|
+
type: "VariableDeclarator",
|
|
427
|
+
id: {
|
|
428
|
+
type: "Identifier",
|
|
429
|
+
name
|
|
430
|
+
},
|
|
431
|
+
init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
|
|
432
|
+
}
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function flattenNode2(node) {
|
|
442
|
+
if ("children" in node)
|
|
443
|
+
return node.children.map((child) => flattenNode2(child)).join("");
|
|
444
|
+
if ("value" in node) return node.value;
|
|
445
|
+
return "";
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// src/mdx/build-mdx.ts
|
|
449
|
+
var cache = /* @__PURE__ */ new Map();
|
|
436
450
|
async function buildMDX(cacheKey, source, options) {
|
|
437
451
|
const { filePath, frontmatter, data, _compiler, ...rest } = options;
|
|
438
452
|
function getProcessor(format) {
|
|
439
453
|
const key = `${cacheKey}:${format}`;
|
|
440
|
-
let processor =
|
|
454
|
+
let processor = cache.get(key);
|
|
441
455
|
if (!processor) {
|
|
442
456
|
processor = (0, import_mdx.createProcessor)({
|
|
443
457
|
outputFormat: "program",
|
|
444
458
|
...rest,
|
|
445
|
-
remarkPlugins: [
|
|
459
|
+
remarkPlugins: [
|
|
460
|
+
remarkInclude,
|
|
461
|
+
...rest.remarkPlugins ?? [],
|
|
462
|
+
[
|
|
463
|
+
remarkPostprocess,
|
|
464
|
+
{
|
|
465
|
+
...options.postprocess,
|
|
466
|
+
valueToExport: [
|
|
467
|
+
...options.postprocess?.valueToExport ?? [],
|
|
468
|
+
"structuredData",
|
|
469
|
+
"extractedReferences",
|
|
470
|
+
"frontmatter",
|
|
471
|
+
"lastModified",
|
|
472
|
+
"_markdown"
|
|
473
|
+
]
|
|
474
|
+
}
|
|
475
|
+
]
|
|
476
|
+
],
|
|
446
477
|
format
|
|
447
478
|
});
|
|
448
|
-
|
|
479
|
+
cache.set(key, processor);
|
|
449
480
|
}
|
|
450
481
|
return processor;
|
|
451
482
|
}
|
|
@@ -463,7 +494,7 @@ async function buildMDX(cacheKey, source, options) {
|
|
|
463
494
|
});
|
|
464
495
|
}
|
|
465
496
|
|
|
466
|
-
// src/runtime/async.ts
|
|
497
|
+
// src/runtime/next/async.ts
|
|
467
498
|
var import_client = require("@fumadocs/mdx-remote/client");
|
|
468
499
|
var import_node_url = require("url");
|
|
469
500
|
|
|
@@ -503,7 +534,7 @@ function buildConfig(config) {
|
|
|
503
534
|
const input = this.global.mdxOptions;
|
|
504
535
|
async function uncached() {
|
|
505
536
|
const options = typeof input === "function" ? await input() : input;
|
|
506
|
-
const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (
|
|
537
|
+
const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_preset(), preset_exports));
|
|
507
538
|
if (options?.preset === "minimal") return options;
|
|
508
539
|
return getDefaultMDXOptions2({
|
|
509
540
|
...options,
|
|
@@ -517,42 +548,59 @@ function buildConfig(config) {
|
|
|
517
548
|
};
|
|
518
549
|
}
|
|
519
550
|
|
|
520
|
-
// src/runtime/async.ts
|
|
521
|
-
|
|
551
|
+
// src/runtime/next/async.ts
|
|
552
|
+
function getDocCollection(config, collection) {
|
|
522
553
|
const col = config.collections.get(collection);
|
|
523
|
-
if (col?.type === "doc" && col.mdxOptions) return col
|
|
524
|
-
if (col?.type === "docs" && col.docs.mdxOptions) return col.docs
|
|
525
|
-
|
|
554
|
+
if (col?.type === "doc" && col.mdxOptions) return col;
|
|
555
|
+
if (col?.type === "docs" && col.docs.mdxOptions) return col.docs;
|
|
556
|
+
}
|
|
557
|
+
async function getOptions(config, collection) {
|
|
558
|
+
return collection?.mdxOptions ?? await config.getDefaultMDXOptions("remote");
|
|
526
559
|
}
|
|
527
560
|
var _runtimeAsync = {
|
|
528
|
-
doc(files,
|
|
561
|
+
doc(files, collectionName, config) {
|
|
562
|
+
const collection = getDocCollection(config, collectionName);
|
|
529
563
|
const initMdxOptions = getOptions(config, collection);
|
|
530
|
-
return files.map(({ info
|
|
564
|
+
return files.map(({ info, data, content, lastModified }) => {
|
|
565
|
+
let cachedResult;
|
|
566
|
+
async function compileAndLoad() {
|
|
567
|
+
if (cachedResult) return cachedResult;
|
|
568
|
+
const mdxOptions = await initMdxOptions;
|
|
569
|
+
const compiled = await buildMDX(collectionName, content.body, {
|
|
570
|
+
...mdxOptions,
|
|
571
|
+
development: false,
|
|
572
|
+
frontmatter: data,
|
|
573
|
+
postprocess: collection?.postprocess,
|
|
574
|
+
data: {
|
|
575
|
+
lastModified
|
|
576
|
+
},
|
|
577
|
+
filePath: info.fullPath
|
|
578
|
+
});
|
|
579
|
+
const result = await (0, import_client.executeMdx)(String(compiled.value), {
|
|
580
|
+
baseUrl: (0, import_node_url.pathToFileURL)(info.fullPath)
|
|
581
|
+
});
|
|
582
|
+
return cachedResult = result;
|
|
583
|
+
}
|
|
531
584
|
return {
|
|
532
585
|
...data,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
586
|
+
info,
|
|
587
|
+
async getText(type) {
|
|
588
|
+
if (type === "raw") {
|
|
589
|
+
return `${content.matter}${content.body}`;
|
|
590
|
+
}
|
|
591
|
+
const out = await compileAndLoad();
|
|
592
|
+
if (typeof out._markdown !== "string") missingProcessedMarkdown();
|
|
593
|
+
return out._markdown;
|
|
536
594
|
},
|
|
537
595
|
async load() {
|
|
538
|
-
const
|
|
539
|
-
const out = await buildMDX(collection, content.body, {
|
|
540
|
-
...mdxOptions,
|
|
541
|
-
development: false,
|
|
542
|
-
frontmatter: data,
|
|
543
|
-
data: {
|
|
544
|
-
lastModified
|
|
545
|
-
},
|
|
546
|
-
filePath: file.absolutePath
|
|
547
|
-
});
|
|
548
|
-
const { default: body, ...rest } = await (0, import_client.executeMdx)(String(out), {
|
|
549
|
-
baseUrl: (0, import_node_url.pathToFileURL)(file.absolutePath)
|
|
550
|
-
});
|
|
596
|
+
const out = await compileAndLoad();
|
|
551
597
|
return {
|
|
552
|
-
|
|
553
|
-
body,
|
|
554
|
-
|
|
555
|
-
|
|
598
|
+
_exports: out,
|
|
599
|
+
body: out.default,
|
|
600
|
+
lastModified,
|
|
601
|
+
toc: out.toc,
|
|
602
|
+
extractedReferences: out.extractedReferences,
|
|
603
|
+
structuredData: out.structuredData
|
|
556
604
|
};
|
|
557
605
|
}
|
|
558
606
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { L as LoadedConfig,
|
|
1
|
+
import { L as LoadedConfig, c as RuntimeAsync } from '../../types-Dl8HLbm5.cjs';
|
|
2
2
|
import '@standard-schema/spec';
|
|
3
3
|
import 'fumadocs-core/source';
|
|
4
|
-
import '
|
|
4
|
+
import '../../define--6HQ1ehX.cjs';
|
|
5
5
|
import 'fumadocs-core/mdx-plugins';
|
|
6
6
|
import '@mdx-js/mdx';
|
|
7
7
|
import 'unified';
|
|
8
8
|
import 'zod';
|
|
9
|
-
import '
|
|
9
|
+
import '../../shared-CqgMnt9h.cjs';
|
|
10
10
|
import 'fumadocs-core/server';
|
|
11
11
|
import 'react';
|
|
12
12
|
import 'mdx/types';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { L as LoadedConfig,
|
|
1
|
+
import { L as LoadedConfig, c as RuntimeAsync } from '../../types-DLIAvrgC.js';
|
|
2
2
|
import '@standard-schema/spec';
|
|
3
3
|
import 'fumadocs-core/source';
|
|
4
|
-
import '
|
|
4
|
+
import '../../define--6HQ1ehX.js';
|
|
5
5
|
import 'fumadocs-core/mdx-plugins';
|
|
6
6
|
import '@mdx-js/mdx';
|
|
7
7
|
import 'unified';
|
|
8
8
|
import 'zod';
|
|
9
|
-
import '
|
|
9
|
+
import '../../shared-0QIuV0XZ.js';
|
|
10
10
|
import 'fumadocs-core/server';
|
|
11
11
|
import 'react';
|
|
12
12
|
import 'mdx/types';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_runtime,
|
|
3
|
+
createMDXSource
|
|
4
|
+
} from "../../chunk-AUOOMFAI.js";
|
|
5
|
+
import {
|
|
6
|
+
missingProcessedMarkdown
|
|
7
|
+
} from "../../chunk-ZLCSVXCD.js";
|
|
8
|
+
import {
|
|
9
|
+
buildMDX
|
|
10
|
+
} from "../../chunk-SWNOXPYJ.js";
|
|
11
|
+
import "../../chunk-KTDVTBMH.js";
|
|
12
|
+
import {
|
|
13
|
+
buildConfig
|
|
14
|
+
} from "../../chunk-YC25YEBF.js";
|
|
15
|
+
import "../../chunk-VWJKRQZR.js";
|
|
16
|
+
|
|
17
|
+
// src/runtime/next/async.ts
|
|
18
|
+
import { executeMdx } from "@fumadocs/mdx-remote/client";
|
|
19
|
+
import { pathToFileURL } from "url";
|
|
20
|
+
function getDocCollection(config, collection) {
|
|
21
|
+
const col = config.collections.get(collection);
|
|
22
|
+
if (col?.type === "doc" && col.mdxOptions) return col;
|
|
23
|
+
if (col?.type === "docs" && col.docs.mdxOptions) return col.docs;
|
|
24
|
+
}
|
|
25
|
+
async function getOptions(config, collection) {
|
|
26
|
+
return collection?.mdxOptions ?? await config.getDefaultMDXOptions("remote");
|
|
27
|
+
}
|
|
28
|
+
var _runtimeAsync = {
|
|
29
|
+
doc(files, collectionName, config) {
|
|
30
|
+
const collection = getDocCollection(config, collectionName);
|
|
31
|
+
const initMdxOptions = getOptions(config, collection);
|
|
32
|
+
return files.map(({ info, data, content, lastModified }) => {
|
|
33
|
+
let cachedResult;
|
|
34
|
+
async function compileAndLoad() {
|
|
35
|
+
if (cachedResult) return cachedResult;
|
|
36
|
+
const mdxOptions = await initMdxOptions;
|
|
37
|
+
const compiled = await buildMDX(collectionName, content.body, {
|
|
38
|
+
...mdxOptions,
|
|
39
|
+
development: false,
|
|
40
|
+
frontmatter: data,
|
|
41
|
+
postprocess: collection?.postprocess,
|
|
42
|
+
data: {
|
|
43
|
+
lastModified
|
|
44
|
+
},
|
|
45
|
+
filePath: info.fullPath
|
|
46
|
+
});
|
|
47
|
+
const result = await executeMdx(String(compiled.value), {
|
|
48
|
+
baseUrl: pathToFileURL(info.fullPath)
|
|
49
|
+
});
|
|
50
|
+
return cachedResult = result;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
...data,
|
|
54
|
+
info,
|
|
55
|
+
async getText(type) {
|
|
56
|
+
if (type === "raw") {
|
|
57
|
+
return `${content.matter}${content.body}`;
|
|
58
|
+
}
|
|
59
|
+
const out = await compileAndLoad();
|
|
60
|
+
if (typeof out._markdown !== "string") missingProcessedMarkdown();
|
|
61
|
+
return out._markdown;
|
|
62
|
+
},
|
|
63
|
+
async load() {
|
|
64
|
+
const out = await compileAndLoad();
|
|
65
|
+
return {
|
|
66
|
+
_exports: out,
|
|
67
|
+
body: out.default,
|
|
68
|
+
lastModified,
|
|
69
|
+
toc: out.toc,
|
|
70
|
+
extractedReferences: out.extractedReferences,
|
|
71
|
+
structuredData: out.structuredData
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
docs(docs, metas, collection, config) {
|
|
78
|
+
const parsedDocs = this.doc(docs, collection, config);
|
|
79
|
+
const parsedMetas = _runtime.meta(metas);
|
|
80
|
+
return {
|
|
81
|
+
docs: parsedDocs,
|
|
82
|
+
meta: parsedMetas,
|
|
83
|
+
toFumadocsSource() {
|
|
84
|
+
return createMDXSource(parsedDocs, parsedMetas);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
90
|
+
_runtimeAsync,
|
|
91
|
+
buildConfig
|
|
92
|
+
};
|