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
package/dist/config/zod-3.cjs
DELETED
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/config/zod-3.ts
|
|
31
|
-
var zod_3_exports = {};
|
|
32
|
-
__export(zod_3_exports, {
|
|
33
|
-
defineCollections: () => defineCollections,
|
|
34
|
-
defineConfig: () => defineConfig,
|
|
35
|
-
defineDocs: () => defineDocs,
|
|
36
|
-
frontmatterSchema: () => frontmatterSchema2,
|
|
37
|
-
getDefaultMDXOptions: () => getDefaultMDXOptions,
|
|
38
|
-
metaSchema: () => metaSchema2,
|
|
39
|
-
remarkInclude: () => remarkInclude
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(zod_3_exports);
|
|
42
|
-
var import_v3 = require("zod/v3");
|
|
43
|
-
|
|
44
|
-
// src/config/zod-4.ts
|
|
45
|
-
var import_zod = require("zod");
|
|
46
|
-
var metaSchema = import_zod.z.object({
|
|
47
|
-
title: import_zod.z.string().optional(),
|
|
48
|
-
pages: import_zod.z.array(import_zod.z.string()).optional(),
|
|
49
|
-
description: import_zod.z.string().optional(),
|
|
50
|
-
root: import_zod.z.boolean().optional(),
|
|
51
|
-
defaultOpen: import_zod.z.boolean().optional(),
|
|
52
|
-
icon: import_zod.z.string().optional()
|
|
53
|
-
});
|
|
54
|
-
var frontmatterSchema = import_zod.z.object({
|
|
55
|
-
title: import_zod.z.string(),
|
|
56
|
-
description: import_zod.z.string().optional(),
|
|
57
|
-
icon: import_zod.z.string().optional(),
|
|
58
|
-
full: import_zod.z.boolean().optional(),
|
|
59
|
-
// Fumadocs OpenAPI generated
|
|
60
|
-
_openapi: import_zod.z.looseObject({}).optional()
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// src/config/define.ts
|
|
64
|
-
function defineCollections(options) {
|
|
65
|
-
return options;
|
|
66
|
-
}
|
|
67
|
-
function defineDocs(options) {
|
|
68
|
-
if (!options)
|
|
69
|
-
console.warn(
|
|
70
|
-
"[`source.config.ts`] Deprecated: please pass options to `defineDocs()` and specify a `dir`."
|
|
71
|
-
);
|
|
72
|
-
const dir = options?.dir ?? "content/docs";
|
|
73
|
-
return {
|
|
74
|
-
type: "docs",
|
|
75
|
-
dir,
|
|
76
|
-
docs: defineCollections({
|
|
77
|
-
type: "doc",
|
|
78
|
-
dir,
|
|
79
|
-
schema: frontmatterSchema,
|
|
80
|
-
...options?.docs
|
|
81
|
-
}),
|
|
82
|
-
meta: defineCollections({
|
|
83
|
-
type: "meta",
|
|
84
|
-
dir,
|
|
85
|
-
schema: metaSchema,
|
|
86
|
-
...options?.meta
|
|
87
|
-
})
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function defineConfig(config = {}) {
|
|
91
|
-
return config;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// src/utils/mdx-options.ts
|
|
95
|
-
var plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
|
|
96
|
-
|
|
97
|
-
// src/mdx-plugins/remark-postprocess.ts
|
|
98
|
-
var import_unist_util_visit = require("unist-util-visit");
|
|
99
|
-
var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
|
|
100
|
-
function remarkPostprocess({
|
|
101
|
-
injectExports
|
|
102
|
-
}) {
|
|
103
|
-
return (tree, file) => {
|
|
104
|
-
let title;
|
|
105
|
-
const urls = [];
|
|
106
|
-
(0, import_unist_util_visit.visit)(tree, ["heading", "link"], (node) => {
|
|
107
|
-
if (node.type === "heading" && node.depth === 1) {
|
|
108
|
-
title = flattenNode(node);
|
|
109
|
-
}
|
|
110
|
-
if (node.type !== "link") return;
|
|
111
|
-
urls.push({
|
|
112
|
-
href: node.url
|
|
113
|
-
});
|
|
114
|
-
return "skip";
|
|
115
|
-
});
|
|
116
|
-
if (title) {
|
|
117
|
-
file.data.frontmatter ??= {};
|
|
118
|
-
if (!file.data.frontmatter.title) file.data.frontmatter.title = title;
|
|
119
|
-
}
|
|
120
|
-
file.data.extractedReferences = urls;
|
|
121
|
-
for (const name of injectExports) {
|
|
122
|
-
if (!(name in file.data)) continue;
|
|
123
|
-
tree.children.unshift(getMdastExport(name, file.data[name]));
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function flattenNode(node) {
|
|
128
|
-
if ("children" in node)
|
|
129
|
-
return node.children.map((child) => flattenNode(child)).join("");
|
|
130
|
-
if ("value" in node) return node.value;
|
|
131
|
-
return "";
|
|
132
|
-
}
|
|
133
|
-
function getMdastExport(name, value) {
|
|
134
|
-
return {
|
|
135
|
-
type: "mdxjsEsm",
|
|
136
|
-
value: "",
|
|
137
|
-
data: {
|
|
138
|
-
estree: {
|
|
139
|
-
type: "Program",
|
|
140
|
-
sourceType: "module",
|
|
141
|
-
body: [
|
|
142
|
-
{
|
|
143
|
-
type: "ExportNamedDeclaration",
|
|
144
|
-
attributes: [],
|
|
145
|
-
specifiers: [],
|
|
146
|
-
source: null,
|
|
147
|
-
declaration: {
|
|
148
|
-
type: "VariableDeclaration",
|
|
149
|
-
kind: "let",
|
|
150
|
-
declarations: [
|
|
151
|
-
{
|
|
152
|
-
type: "VariableDeclarator",
|
|
153
|
-
id: {
|
|
154
|
-
type: "Identifier",
|
|
155
|
-
name
|
|
156
|
-
},
|
|
157
|
-
init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// src/utils/mdx-options.ts
|
|
169
|
-
function pluginOption(def, options = []) {
|
|
170
|
-
const list = def(Array.isArray(options) ? options : []).filter(
|
|
171
|
-
Boolean
|
|
172
|
-
);
|
|
173
|
-
if (typeof options === "function") {
|
|
174
|
-
return options(list);
|
|
175
|
-
}
|
|
176
|
-
return list;
|
|
177
|
-
}
|
|
178
|
-
function getDefaultMDXOptions({
|
|
179
|
-
valueToExport = [],
|
|
180
|
-
rehypeCodeOptions,
|
|
181
|
-
remarkImageOptions,
|
|
182
|
-
remarkHeadingOptions,
|
|
183
|
-
remarkStructureOptions,
|
|
184
|
-
remarkCodeTabOptions,
|
|
185
|
-
remarkNpmOptions,
|
|
186
|
-
_withoutBundler = false,
|
|
187
|
-
...mdxOptions
|
|
188
|
-
}) {
|
|
189
|
-
const mdxExports = [
|
|
190
|
-
"structuredData",
|
|
191
|
-
"extractedReferences",
|
|
192
|
-
"frontmatter",
|
|
193
|
-
"lastModified",
|
|
194
|
-
...valueToExport
|
|
195
|
-
];
|
|
196
|
-
const remarkPlugins = pluginOption(
|
|
197
|
-
(v) => [
|
|
198
|
-
plugins.remarkGfm,
|
|
199
|
-
[
|
|
200
|
-
plugins.remarkHeading,
|
|
201
|
-
{
|
|
202
|
-
generateToc: false,
|
|
203
|
-
...remarkHeadingOptions
|
|
204
|
-
}
|
|
205
|
-
],
|
|
206
|
-
remarkImageOptions !== false && [
|
|
207
|
-
plugins.remarkImage,
|
|
208
|
-
{
|
|
209
|
-
...remarkImageOptions,
|
|
210
|
-
useImport: _withoutBundler ? false : remarkImageOptions?.useImport
|
|
211
|
-
}
|
|
212
|
-
],
|
|
213
|
-
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
|
|
214
|
-
plugins.remarkCodeTab,
|
|
215
|
-
remarkCodeTabOptions
|
|
216
|
-
],
|
|
217
|
-
"remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
|
|
218
|
-
...v,
|
|
219
|
-
remarkStructureOptions !== false && [
|
|
220
|
-
plugins.remarkStructure,
|
|
221
|
-
remarkStructureOptions
|
|
222
|
-
],
|
|
223
|
-
[
|
|
224
|
-
remarkPostprocess,
|
|
225
|
-
{ injectExports: mdxExports }
|
|
226
|
-
]
|
|
227
|
-
],
|
|
228
|
-
mdxOptions.remarkPlugins
|
|
229
|
-
);
|
|
230
|
-
const rehypePlugins = pluginOption(
|
|
231
|
-
(v) => [
|
|
232
|
-
rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
|
|
233
|
-
...v,
|
|
234
|
-
plugins.rehypeToc
|
|
235
|
-
],
|
|
236
|
-
mdxOptions.rehypePlugins
|
|
237
|
-
);
|
|
238
|
-
return {
|
|
239
|
-
...mdxOptions,
|
|
240
|
-
outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
|
|
241
|
-
remarkPlugins,
|
|
242
|
-
rehypePlugins
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// src/mdx-plugins/remark-include.ts
|
|
247
|
-
var import_unified = require("unified");
|
|
248
|
-
var import_unist_util_visit2 = require("unist-util-visit");
|
|
249
|
-
var path = __toESM(require("path"), 1);
|
|
250
|
-
var fs = __toESM(require("fs/promises"), 1);
|
|
251
|
-
|
|
252
|
-
// src/utils/fuma-matter.ts
|
|
253
|
-
var import_js_yaml = require("js-yaml");
|
|
254
|
-
var regex = /^---\r?\n(.+?)\r?\n---\r?\n/s;
|
|
255
|
-
function fumaMatter(input) {
|
|
256
|
-
const output = { matter: "", data: {}, content: input };
|
|
257
|
-
const match = regex.exec(input);
|
|
258
|
-
if (!match) {
|
|
259
|
-
return output;
|
|
260
|
-
}
|
|
261
|
-
output.matter = match[0];
|
|
262
|
-
output.content = input.slice(match[0].length);
|
|
263
|
-
const loaded = (0, import_js_yaml.load)(match[1]);
|
|
264
|
-
output.data = loaded ?? {};
|
|
265
|
-
return output;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// src/mdx-plugins/remark-include.ts
|
|
269
|
-
var import_remark_parse = __toESM(require("remark-parse"), 1);
|
|
270
|
-
var import_remark_mdx = __toESM(require("remark-mdx"), 1);
|
|
271
|
-
var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
|
|
272
|
-
var baseProcessor = (0, import_unified.unified)().use(import_mdx_plugins.remarkHeading);
|
|
273
|
-
function flattenNode2(node) {
|
|
274
|
-
if ("children" in node)
|
|
275
|
-
return node.children.map((child) => flattenNode2(child)).join("");
|
|
276
|
-
if ("value" in node) return node.value;
|
|
277
|
-
return "";
|
|
278
|
-
}
|
|
279
|
-
function parseSpecifier(specifier) {
|
|
280
|
-
const idx = specifier.lastIndexOf("#");
|
|
281
|
-
if (idx === -1) return { file: specifier };
|
|
282
|
-
return {
|
|
283
|
-
file: specifier.slice(0, idx),
|
|
284
|
-
section: specifier.slice(idx + 1)
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function extractSection(root, section) {
|
|
288
|
-
let nodes;
|
|
289
|
-
for (const node of root.children) {
|
|
290
|
-
if (node.type === "mdxJsxFlowElement" && node.name === "section" && node.attributes.some(
|
|
291
|
-
(attr) => attr.type === "mdxJsxAttribute" && attr.name === "id" && attr.value === section
|
|
292
|
-
)) {
|
|
293
|
-
nodes = node.children;
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
if (node.type === "heading" && node.data?.hProperties?.id === section) {
|
|
297
|
-
nodes = [node];
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
if (!nodes) continue;
|
|
301
|
-
if (node.type === "heading") break;
|
|
302
|
-
nodes.push(node);
|
|
303
|
-
}
|
|
304
|
-
if (nodes)
|
|
305
|
-
return {
|
|
306
|
-
type: "root",
|
|
307
|
-
children: nodes
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
function remarkInclude() {
|
|
311
|
-
const TagName = "include";
|
|
312
|
-
async function embedContent(file, heading, params, data) {
|
|
313
|
-
let content;
|
|
314
|
-
try {
|
|
315
|
-
content = (await fs.readFile(file)).toString();
|
|
316
|
-
} catch (e) {
|
|
317
|
-
throw new Error(
|
|
318
|
-
`failed to read file ${file}
|
|
319
|
-
${e instanceof Error ? e.message : String(e)}`,
|
|
320
|
-
{ cause: e }
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
const ext = path.extname(file);
|
|
324
|
-
data._compiler?.addDependency(file);
|
|
325
|
-
if (params.lang || ext !== ".md" && ext !== ".mdx") {
|
|
326
|
-
const lang = params.lang ?? ext.slice(1);
|
|
327
|
-
return {
|
|
328
|
-
type: "code",
|
|
329
|
-
lang,
|
|
330
|
-
meta: params.meta,
|
|
331
|
-
value: content,
|
|
332
|
-
data: {}
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
const processor = (data._getProcessor ?? getDefaultProcessor)(
|
|
336
|
-
ext === ".mdx" ? "mdx" : "md"
|
|
337
|
-
);
|
|
338
|
-
let parsed = await baseProcessor.run(
|
|
339
|
-
processor.parse(fumaMatter(content).content)
|
|
340
|
-
);
|
|
341
|
-
if (heading) {
|
|
342
|
-
const extracted = extractSection(parsed, heading);
|
|
343
|
-
if (!extracted)
|
|
344
|
-
throw new Error(
|
|
345
|
-
`Cannot find section ${heading} in ${file}, make sure you have encapsulated the section in a <section id="${heading}"> tag.`
|
|
346
|
-
);
|
|
347
|
-
parsed = extracted;
|
|
348
|
-
}
|
|
349
|
-
await update(parsed, path.dirname(file), data);
|
|
350
|
-
return parsed;
|
|
351
|
-
}
|
|
352
|
-
async function update(tree, directory, data) {
|
|
353
|
-
const queue = [];
|
|
354
|
-
(0, import_unist_util_visit2.visit)(
|
|
355
|
-
tree,
|
|
356
|
-
["mdxJsxFlowElement", "mdxJsxTextElement"],
|
|
357
|
-
(_node, _, parent) => {
|
|
358
|
-
const node = _node;
|
|
359
|
-
if (node.name !== TagName) return;
|
|
360
|
-
const params = {};
|
|
361
|
-
const specifier = flattenNode2(node);
|
|
362
|
-
if (specifier.length === 0) return "skip";
|
|
363
|
-
for (const attr of node.attributes) {
|
|
364
|
-
if (attr.type === "mdxJsxAttribute" && (typeof attr.value === "string" || attr.value === null)) {
|
|
365
|
-
params[attr.name] = attr.value;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
const { file: relativePath, section } = parseSpecifier(specifier);
|
|
369
|
-
const file = path.resolve(
|
|
370
|
-
"cwd" in params ? process.cwd() : directory,
|
|
371
|
-
relativePath
|
|
372
|
-
);
|
|
373
|
-
queue.push(
|
|
374
|
-
embedContent(file, section, params, data).then((replace) => {
|
|
375
|
-
Object.assign(
|
|
376
|
-
parent && parent.type === "paragraph" ? parent : node,
|
|
377
|
-
replace
|
|
378
|
-
);
|
|
379
|
-
})
|
|
380
|
-
);
|
|
381
|
-
return "skip";
|
|
382
|
-
}
|
|
383
|
-
);
|
|
384
|
-
await Promise.all(queue);
|
|
385
|
-
}
|
|
386
|
-
return async (tree, file) => {
|
|
387
|
-
await update(tree, path.dirname(file.path), file.data);
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
function getDefaultProcessor(format) {
|
|
391
|
-
const mdProcessor = (0, import_unified.unified)().use(import_remark_parse.default);
|
|
392
|
-
if (format === "md") return mdProcessor;
|
|
393
|
-
return mdProcessor.use(import_remark_mdx.default);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// src/config/zod-3.ts
|
|
397
|
-
var metaSchema2 = import_v3.z.object({
|
|
398
|
-
title: import_v3.z.string().optional(),
|
|
399
|
-
pages: import_v3.z.array(import_v3.z.string()).optional(),
|
|
400
|
-
description: import_v3.z.string().optional(),
|
|
401
|
-
root: import_v3.z.boolean().optional(),
|
|
402
|
-
defaultOpen: import_v3.z.boolean().optional(),
|
|
403
|
-
icon: import_v3.z.string().optional()
|
|
404
|
-
});
|
|
405
|
-
var frontmatterSchema2 = import_v3.z.object({
|
|
406
|
-
title: import_v3.z.string(),
|
|
407
|
-
description: import_v3.z.string().optional(),
|
|
408
|
-
icon: import_v3.z.string().optional(),
|
|
409
|
-
full: import_v3.z.boolean().optional(),
|
|
410
|
-
// Fumadocs OpenAPI generated
|
|
411
|
-
_openapi: import_v3.z.object({}).passthrough().optional()
|
|
412
|
-
});
|
|
413
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
414
|
-
0 && (module.exports = {
|
|
415
|
-
defineCollections,
|
|
416
|
-
defineConfig,
|
|
417
|
-
defineDocs,
|
|
418
|
-
frontmatterSchema,
|
|
419
|
-
getDefaultMDXOptions,
|
|
420
|
-
metaSchema,
|
|
421
|
-
remarkInclude
|
|
422
|
-
});
|
package/dist/config/zod-3.d.cts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v3';
|
|
2
|
-
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, g as getDefaultMDXOptions } from '../define-BH4bnHQl.cjs';
|
|
3
|
-
export { Params, remarkInclude } from './index.cjs';
|
|
4
|
-
import '@standard-schema/spec';
|
|
5
|
-
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import '@mdx-js/mdx';
|
|
7
|
-
import 'unified';
|
|
8
|
-
import 'zod';
|
|
9
|
-
import 'mdast';
|
|
10
|
-
|
|
11
|
-
declare const metaSchema: z.ZodObject<{
|
|
12
|
-
title: z.ZodOptional<z.ZodString>;
|
|
13
|
-
pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
-
description: z.ZodOptional<z.ZodString>;
|
|
15
|
-
root: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
-
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
title?: string | undefined;
|
|
20
|
-
pages?: string[] | undefined;
|
|
21
|
-
description?: string | undefined;
|
|
22
|
-
root?: boolean | undefined;
|
|
23
|
-
defaultOpen?: boolean | undefined;
|
|
24
|
-
icon?: string | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
title?: string | undefined;
|
|
27
|
-
pages?: string[] | undefined;
|
|
28
|
-
description?: string | undefined;
|
|
29
|
-
root?: boolean | undefined;
|
|
30
|
-
defaultOpen?: boolean | undefined;
|
|
31
|
-
icon?: string | undefined;
|
|
32
|
-
}>;
|
|
33
|
-
declare const frontmatterSchema: z.ZodObject<{
|
|
34
|
-
title: z.ZodString;
|
|
35
|
-
description: z.ZodOptional<z.ZodString>;
|
|
36
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
37
|
-
full: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
-
_openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
title: string;
|
|
41
|
-
description?: string | undefined;
|
|
42
|
-
icon?: string | undefined;
|
|
43
|
-
full?: boolean | undefined;
|
|
44
|
-
_openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
title: string;
|
|
47
|
-
description?: string | undefined;
|
|
48
|
-
icon?: string | undefined;
|
|
49
|
-
full?: boolean | undefined;
|
|
50
|
-
_openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
|
|
53
|
-
export { frontmatterSchema, metaSchema };
|
package/dist/config/zod-3.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v3';
|
|
2
|
-
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, g as getDefaultMDXOptions } from '../define-BH4bnHQl.js';
|
|
3
|
-
export { Params, remarkInclude } from './index.js';
|
|
4
|
-
import '@standard-schema/spec';
|
|
5
|
-
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import '@mdx-js/mdx';
|
|
7
|
-
import 'unified';
|
|
8
|
-
import 'zod';
|
|
9
|
-
import 'mdast';
|
|
10
|
-
|
|
11
|
-
declare const metaSchema: z.ZodObject<{
|
|
12
|
-
title: z.ZodOptional<z.ZodString>;
|
|
13
|
-
pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
-
description: z.ZodOptional<z.ZodString>;
|
|
15
|
-
root: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
-
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
title?: string | undefined;
|
|
20
|
-
pages?: string[] | undefined;
|
|
21
|
-
description?: string | undefined;
|
|
22
|
-
root?: boolean | undefined;
|
|
23
|
-
defaultOpen?: boolean | undefined;
|
|
24
|
-
icon?: string | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
title?: string | undefined;
|
|
27
|
-
pages?: string[] | undefined;
|
|
28
|
-
description?: string | undefined;
|
|
29
|
-
root?: boolean | undefined;
|
|
30
|
-
defaultOpen?: boolean | undefined;
|
|
31
|
-
icon?: string | undefined;
|
|
32
|
-
}>;
|
|
33
|
-
declare const frontmatterSchema: z.ZodObject<{
|
|
34
|
-
title: z.ZodString;
|
|
35
|
-
description: z.ZodOptional<z.ZodString>;
|
|
36
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
37
|
-
full: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
-
_openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
title: string;
|
|
41
|
-
description?: string | undefined;
|
|
42
|
-
icon?: string | undefined;
|
|
43
|
-
full?: boolean | undefined;
|
|
44
|
-
_openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
title: string;
|
|
47
|
-
description?: string | undefined;
|
|
48
|
-
icon?: string | undefined;
|
|
49
|
-
full?: boolean | undefined;
|
|
50
|
-
_openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
|
|
53
|
-
export { frontmatterSchema, metaSchema };
|
package/dist/config/zod-3.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineCollections,
|
|
3
|
-
defineConfig,
|
|
4
|
-
defineDocs
|
|
5
|
-
} from "../chunk-GBMFGEC7.js";
|
|
6
|
-
import {
|
|
7
|
-
getDefaultMDXOptions
|
|
8
|
-
} from "../chunk-SMSNZ6N5.js";
|
|
9
|
-
import {
|
|
10
|
-
remarkInclude
|
|
11
|
-
} from "../chunk-SVTXMVLQ.js";
|
|
12
|
-
import "../chunk-VWJKRQZR.js";
|
|
13
|
-
|
|
14
|
-
// src/config/zod-3.ts
|
|
15
|
-
import { z } from "zod/v3";
|
|
16
|
-
var metaSchema = z.object({
|
|
17
|
-
title: z.string().optional(),
|
|
18
|
-
pages: z.array(z.string()).optional(),
|
|
19
|
-
description: z.string().optional(),
|
|
20
|
-
root: z.boolean().optional(),
|
|
21
|
-
defaultOpen: z.boolean().optional(),
|
|
22
|
-
icon: z.string().optional()
|
|
23
|
-
});
|
|
24
|
-
var frontmatterSchema = z.object({
|
|
25
|
-
title: z.string(),
|
|
26
|
-
description: z.string().optional(),
|
|
27
|
-
icon: z.string().optional(),
|
|
28
|
-
full: z.boolean().optional(),
|
|
29
|
-
// Fumadocs OpenAPI generated
|
|
30
|
-
_openapi: z.object({}).passthrough().optional()
|
|
31
|
-
});
|
|
32
|
-
export {
|
|
33
|
-
defineCollections,
|
|
34
|
-
defineConfig,
|
|
35
|
-
defineDocs,
|
|
36
|
-
frontmatterSchema,
|
|
37
|
-
getDefaultMDXOptions,
|
|
38
|
-
metaSchema,
|
|
39
|
-
remarkInclude
|
|
40
|
-
};
|
package/dist/index.d.cts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
|
|
2
|
-
import { R as Runtime, B as BaseCollectionEntry } from './types-DT83Ijs6.cjs';
|
|
3
|
-
import '@standard-schema/spec';
|
|
4
|
-
import './define-BH4bnHQl.cjs';
|
|
5
|
-
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import '@mdx-js/mdx';
|
|
7
|
-
import 'unified';
|
|
8
|
-
import 'zod';
|
|
9
|
-
import './build-mdx-DnC1jKvn.cjs';
|
|
10
|
-
import 'fumadocs-core/server';
|
|
11
|
-
import 'react';
|
|
12
|
-
import 'mdx/types';
|
|
13
|
-
|
|
14
|
-
declare const _runtime: Runtime;
|
|
15
|
-
declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
|
|
16
|
-
pageData: Doc;
|
|
17
|
-
metaData: Meta;
|
|
18
|
-
}>;
|
|
19
|
-
interface ResolveOptions {
|
|
20
|
-
docs: BaseCollectionEntry[];
|
|
21
|
-
meta: BaseCollectionEntry[];
|
|
22
|
-
rootDir?: string;
|
|
23
|
-
}
|
|
24
|
-
declare function resolveFiles({ docs, meta }: ResolveOptions): VirtualFile[];
|
|
25
|
-
|
|
26
|
-
export { _runtime, createMDXSource, resolveFiles };
|
package/dist/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
|
|
2
|
-
import { R as Runtime, B as BaseCollectionEntry } from './types-DN9KrG7R.js';
|
|
3
|
-
import '@standard-schema/spec';
|
|
4
|
-
import './define-BH4bnHQl.js';
|
|
5
|
-
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import '@mdx-js/mdx';
|
|
7
|
-
import 'unified';
|
|
8
|
-
import 'zod';
|
|
9
|
-
import './build-mdx-DnC1jKvn.js';
|
|
10
|
-
import 'fumadocs-core/server';
|
|
11
|
-
import 'react';
|
|
12
|
-
import 'mdx/types';
|
|
13
|
-
|
|
14
|
-
declare const _runtime: Runtime;
|
|
15
|
-
declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
|
|
16
|
-
pageData: Doc;
|
|
17
|
-
metaData: Meta;
|
|
18
|
-
}>;
|
|
19
|
-
interface ResolveOptions {
|
|
20
|
-
docs: BaseCollectionEntry[];
|
|
21
|
-
meta: BaseCollectionEntry[];
|
|
22
|
-
rootDir?: string;
|
|
23
|
-
}
|
|
24
|
-
declare function resolveFiles({ docs, meta }: ResolveOptions): VirtualFile[];
|
|
25
|
-
|
|
26
|
-
export { _runtime, createMDXSource, resolveFiles };
|
package/dist/runtime/async.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
_runtime,
|
|
3
|
-
createMDXSource
|
|
4
|
-
} from "../chunk-NUDEC6C5.js";
|
|
5
|
-
import {
|
|
6
|
-
buildMDX
|
|
7
|
-
} from "../chunk-QQWCBFFE.js";
|
|
8
|
-
import "../chunk-SVTXMVLQ.js";
|
|
9
|
-
import {
|
|
10
|
-
buildConfig
|
|
11
|
-
} from "../chunk-QVZ7JH4H.js";
|
|
12
|
-
import "../chunk-VWJKRQZR.js";
|
|
13
|
-
|
|
14
|
-
// src/runtime/async.ts
|
|
15
|
-
import { executeMdx } from "@fumadocs/mdx-remote/client";
|
|
16
|
-
import { pathToFileURL } from "url";
|
|
17
|
-
async function getOptions(config, collection) {
|
|
18
|
-
const col = config.collections.get(collection);
|
|
19
|
-
if (col?.type === "doc" && col.mdxOptions) return col.mdxOptions;
|
|
20
|
-
if (col?.type === "docs" && col.docs.mdxOptions) return col.docs.mdxOptions;
|
|
21
|
-
return config.getDefaultMDXOptions("remote");
|
|
22
|
-
}
|
|
23
|
-
var _runtimeAsync = {
|
|
24
|
-
doc(files, collection, config) {
|
|
25
|
-
const initMdxOptions = getOptions(config, collection);
|
|
26
|
-
return files.map(({ info: file, data, content, lastModified }) => {
|
|
27
|
-
return {
|
|
28
|
-
...data,
|
|
29
|
-
_file: file,
|
|
30
|
-
get content() {
|
|
31
|
-
return `${content.matter}${content.body}`;
|
|
32
|
-
},
|
|
33
|
-
async load() {
|
|
34
|
-
const mdxOptions = await initMdxOptions;
|
|
35
|
-
const out = await buildMDX(collection, content.body, {
|
|
36
|
-
...mdxOptions,
|
|
37
|
-
development: false,
|
|
38
|
-
frontmatter: data,
|
|
39
|
-
data: {
|
|
40
|
-
lastModified
|
|
41
|
-
},
|
|
42
|
-
filePath: file.absolutePath
|
|
43
|
-
});
|
|
44
|
-
const { default: body, ...rest } = await executeMdx(String(out), {
|
|
45
|
-
baseUrl: pathToFileURL(file.absolutePath)
|
|
46
|
-
});
|
|
47
|
-
return {
|
|
48
|
-
structuredData: out.data.structuredData,
|
|
49
|
-
body,
|
|
50
|
-
...rest,
|
|
51
|
-
lastModified
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
docs(docs, metas, collection, config) {
|
|
58
|
-
const parsedDocs = this.doc(docs, collection, config);
|
|
59
|
-
const parsedMetas = _runtime.meta(metas);
|
|
60
|
-
return {
|
|
61
|
-
docs: parsedDocs,
|
|
62
|
-
meta: parsedMetas,
|
|
63
|
-
toFumadocsSource() {
|
|
64
|
-
return createMDXSource(parsedDocs, parsedMetas);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
export {
|
|
70
|
-
_runtimeAsync,
|
|
71
|
-
buildConfig
|
|
72
|
-
};
|