fumadocs-mdx 11.7.3 → 11.7.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-AVMO2SRO.js → chunk-3XN4P23K.js} +49 -11
- package/dist/chunk-GBMFGEC7.js +57 -0
- package/dist/{chunk-ZOWJF3OH.js → chunk-GX3THK2Q.js} +25 -20
- package/dist/{chunk-2CSSQTP6.js → chunk-GYWPPGFD.js} +9 -1
- package/dist/chunk-HWSF4OGZ.js +42 -0
- package/dist/chunk-UCY7OBZG.js +12 -0
- package/dist/{chunk-JFNBRKRV.js → chunk-XVL4ZQFK.js} +12 -6
- package/dist/{chunk-4CGSOZUZ.js → chunk-XZR5QXVY.js} +32 -2
- package/dist/config/index.cjs +59 -14
- package/dist/config/index.d.cts +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +8 -36
- package/dist/config/zod-3.cjs +371 -0
- package/dist/config/zod-3.d.cts +53 -0
- package/dist/config/zod-3.d.ts +53 -0
- package/dist/config/zod-3.js +40 -0
- package/dist/{define-E6TRBwBQ.d.cts → define-DnJzAZrj.d.cts} +3 -2
- package/dist/{define-E6TRBwBQ.d.ts → define-DnJzAZrj.d.ts} +3 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/loader-mdx.cjs +121 -53
- package/dist/loader-mdx.js +8 -8
- package/dist/{mdx-options-UDV5WEFU.js → mdx-options-3NB74EMB.js} +1 -1
- package/dist/next/index.cjs +52 -25
- package/dist/next/index.js +4 -6
- package/dist/runtime/async.cjs +202 -129
- package/dist/runtime/async.d.cts +3 -3
- package/dist/runtime/async.d.ts +3 -3
- package/dist/runtime/async.js +26 -43
- package/dist/runtime/vite.d.cts +2 -2
- package/dist/runtime/vite.d.ts +2 -2
- package/dist/{types-DiL328cG.d.ts → types-C-WXTx1W.d.cts} +2 -2
- package/dist/{types-Lh_-Uuix.d.cts → types-CU9nn_je.d.ts} +2 -2
- package/dist/vite/index.cjs +92 -54
- package/dist/vite/index.js +8 -8
- package/package.json +12 -7
- package/dist/chunk-C5INPAZJ.js +0 -49
- package/dist/chunk-VUEZTR2H.js +0 -26
package/dist/runtime/async.cjs
CHANGED
|
@@ -102,6 +102,7 @@ function getDefaultMDXOptions({
|
|
|
102
102
|
remarkStructureOptions,
|
|
103
103
|
remarkCodeTabOptions,
|
|
104
104
|
remarkNpmOptions,
|
|
105
|
+
_withoutBundler = false,
|
|
105
106
|
...mdxOptions
|
|
106
107
|
}) {
|
|
107
108
|
const mdxExports = [
|
|
@@ -120,7 +121,13 @@ function getDefaultMDXOptions({
|
|
|
120
121
|
...remarkHeadingOptions
|
|
121
122
|
}
|
|
122
123
|
],
|
|
123
|
-
remarkImageOptions !== false && [
|
|
124
|
+
remarkImageOptions !== false && [
|
|
125
|
+
plugins.remarkImage,
|
|
126
|
+
{
|
|
127
|
+
...remarkImageOptions,
|
|
128
|
+
useImport: _withoutBundler ? false : remarkImageOptions?.useImport
|
|
129
|
+
}
|
|
130
|
+
],
|
|
124
131
|
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
|
|
125
132
|
plugins.remarkCodeTab,
|
|
126
133
|
remarkCodeTabOptions
|
|
@@ -145,6 +152,7 @@ function getDefaultMDXOptions({
|
|
|
145
152
|
);
|
|
146
153
|
return {
|
|
147
154
|
...mdxOptions,
|
|
155
|
+
outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
|
|
148
156
|
remarkPlugins,
|
|
149
157
|
rehypePlugins
|
|
150
158
|
};
|
|
@@ -165,12 +173,87 @@ __export(async_exports, {
|
|
|
165
173
|
buildConfig: () => buildConfig
|
|
166
174
|
});
|
|
167
175
|
module.exports = __toCommonJS(async_exports);
|
|
168
|
-
|
|
176
|
+
|
|
177
|
+
// src/runtime/index.ts
|
|
178
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
179
|
+
var cache = /* @__PURE__ */ new Map();
|
|
180
|
+
var _runtime = {
|
|
181
|
+
doc(files) {
|
|
182
|
+
return files.map((file) => {
|
|
183
|
+
const { default: body, frontmatter, ...exports2 } = file.data;
|
|
184
|
+
return {
|
|
185
|
+
body,
|
|
186
|
+
...exports2,
|
|
187
|
+
...frontmatter,
|
|
188
|
+
_file: file.info,
|
|
189
|
+
_exports: file.data,
|
|
190
|
+
get content() {
|
|
191
|
+
const path2 = this._file.absolutePath;
|
|
192
|
+
const cached = cache.get(path2);
|
|
193
|
+
if (cached) return cached;
|
|
194
|
+
const content = import_node_fs.default.readFileSync(path2).toString();
|
|
195
|
+
cache.set(path2, content);
|
|
196
|
+
return content;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
meta(files) {
|
|
202
|
+
return files.map((file) => {
|
|
203
|
+
return {
|
|
204
|
+
...file.data,
|
|
205
|
+
_file: file.info
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
docs(docs, metas) {
|
|
210
|
+
const parsedDocs = this.doc(docs);
|
|
211
|
+
const parsedMetas = this.meta(metas);
|
|
212
|
+
return {
|
|
213
|
+
docs: parsedDocs,
|
|
214
|
+
meta: parsedMetas,
|
|
215
|
+
toFumadocsSource() {
|
|
216
|
+
return createMDXSource(parsedDocs, parsedMetas);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
function createMDXSource(docs, meta = []) {
|
|
222
|
+
return {
|
|
223
|
+
files: () => resolveFiles({
|
|
224
|
+
docs,
|
|
225
|
+
meta
|
|
226
|
+
})
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function resolveFiles({ docs, meta }) {
|
|
230
|
+
const outputs = [];
|
|
231
|
+
for (const entry of docs) {
|
|
232
|
+
outputs.push({
|
|
233
|
+
type: "page",
|
|
234
|
+
absolutePath: entry._file.absolutePath,
|
|
235
|
+
path: entry._file.path,
|
|
236
|
+
data: entry
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
for (const entry of meta) {
|
|
240
|
+
outputs.push({
|
|
241
|
+
type: "meta",
|
|
242
|
+
absolutePath: entry._file.absolutePath,
|
|
243
|
+
path: entry._file.path,
|
|
244
|
+
data: entry
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
return outputs;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// src/utils/build-mdx.ts
|
|
251
|
+
var import_mdx = require("@mdx-js/mdx");
|
|
169
252
|
|
|
170
253
|
// src/mdx-plugins/remark-include.ts
|
|
171
254
|
var import_unist_util_visit = require("unist-util-visit");
|
|
172
255
|
var path = __toESM(require("path"), 1);
|
|
173
|
-
var
|
|
256
|
+
var fs2 = __toESM(require("fs/promises"), 1);
|
|
174
257
|
|
|
175
258
|
// src/utils/fuma-matter.ts
|
|
176
259
|
var import_js_yaml = require("js-yaml");
|
|
@@ -195,9 +278,29 @@ function flattenNode(node) {
|
|
|
195
278
|
if ("value" in node) return node.value;
|
|
196
279
|
return "";
|
|
197
280
|
}
|
|
281
|
+
function parseSpecifier(specifier) {
|
|
282
|
+
const idx = specifier.lastIndexOf("#");
|
|
283
|
+
if (idx === -1) return { file: specifier };
|
|
284
|
+
return {
|
|
285
|
+
file: specifier.slice(0, idx),
|
|
286
|
+
section: specifier.slice(idx + 1)
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function extractSection(root, section) {
|
|
290
|
+
for (const node of root.children) {
|
|
291
|
+
if (node.type === "mdxJsxFlowElement" && node.name === "section" && node.attributes.some(
|
|
292
|
+
(attr) => attr.type === "mdxJsxAttribute" && attr.name === "id" && attr.value === section
|
|
293
|
+
)) {
|
|
294
|
+
return {
|
|
295
|
+
type: "root",
|
|
296
|
+
children: node.children
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
198
301
|
function remarkInclude() {
|
|
199
302
|
const TagName = "include";
|
|
200
|
-
async function update(tree,
|
|
303
|
+
async function update(tree, directory, data) {
|
|
201
304
|
const queue = [];
|
|
202
305
|
(0, import_unist_util_visit.visit)(
|
|
203
306
|
tree,
|
|
@@ -217,27 +320,44 @@ function remarkInclude() {
|
|
|
217
320
|
}
|
|
218
321
|
}
|
|
219
322
|
if (!specifier) return;
|
|
323
|
+
const { file, section } = parseSpecifier(specifier);
|
|
220
324
|
const targetPath = path.resolve(
|
|
221
|
-
"cwd" in params ? process.cwd() :
|
|
222
|
-
|
|
325
|
+
"cwd" in params ? process.cwd() : directory,
|
|
326
|
+
file
|
|
223
327
|
);
|
|
224
|
-
const asCode = params.lang || !
|
|
328
|
+
const asCode = params.lang || !file.endsWith(".md") && !file.endsWith(".mdx");
|
|
225
329
|
queue.push(
|
|
226
|
-
|
|
227
|
-
|
|
330
|
+
fs2.readFile(targetPath).then((buffer) => buffer.toString()).then(async (content) => {
|
|
331
|
+
data._compiler?.addDependency(targetPath);
|
|
228
332
|
if (asCode) {
|
|
229
|
-
const lang = params.lang ?? path.extname(
|
|
333
|
+
const lang = params.lang ?? path.extname(file).slice(1);
|
|
230
334
|
Object.assign(node, {
|
|
231
335
|
type: "code",
|
|
232
336
|
lang,
|
|
233
337
|
meta: params.meta,
|
|
234
|
-
value: content
|
|
338
|
+
value: content,
|
|
235
339
|
data: {}
|
|
236
340
|
});
|
|
237
341
|
return;
|
|
238
342
|
}
|
|
239
|
-
const
|
|
240
|
-
|
|
343
|
+
const processor = data._processor ? data._processor.getProcessor(
|
|
344
|
+
targetPath.endsWith(".md") ? "md" : "mdx"
|
|
345
|
+
) : this;
|
|
346
|
+
let parsed = processor.parse(fumaMatter(content).content);
|
|
347
|
+
if (section) {
|
|
348
|
+
const extracted = extractSection(parsed, section);
|
|
349
|
+
if (!extracted)
|
|
350
|
+
throw new Error(
|
|
351
|
+
`Cannot find section ${section} in ${file}, make sure you have encapsulated the section in a <section id="${section}"> tag`
|
|
352
|
+
);
|
|
353
|
+
parsed = extracted;
|
|
354
|
+
}
|
|
355
|
+
await update.call(
|
|
356
|
+
processor,
|
|
357
|
+
parsed,
|
|
358
|
+
path.dirname(targetPath),
|
|
359
|
+
data
|
|
360
|
+
);
|
|
241
361
|
Object.assign(
|
|
242
362
|
parent && parent.type === "paragraph" ? parent : node,
|
|
243
363
|
parsed
|
|
@@ -245,7 +365,8 @@ function remarkInclude() {
|
|
|
245
365
|
}).catch((e) => {
|
|
246
366
|
throw new Error(
|
|
247
367
|
`failed to read file ${targetPath}
|
|
248
|
-
${e instanceof Error ? e.message : String(e)}
|
|
368
|
+
${e instanceof Error ? e.message : String(e)}`,
|
|
369
|
+
{ cause: e }
|
|
249
370
|
);
|
|
250
371
|
})
|
|
251
372
|
);
|
|
@@ -255,86 +376,48 @@ ${e instanceof Error ? e.message : String(e)}`
|
|
|
255
376
|
await Promise.all(queue);
|
|
256
377
|
}
|
|
257
378
|
return async (tree, file) => {
|
|
258
|
-
await update(tree, file.path,
|
|
379
|
+
await update.call(this, tree, path.dirname(file.path), file.data);
|
|
259
380
|
};
|
|
260
381
|
}
|
|
261
382
|
|
|
262
|
-
// src/
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
const path2 = this._file.absolutePath;
|
|
280
|
-
const cached = cache.get(path2);
|
|
281
|
-
if (cached) return cached;
|
|
282
|
-
const content = import_node_fs.default.readFileSync(path2).toString();
|
|
283
|
-
cache.set(path2, content);
|
|
284
|
-
return content;
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
});
|
|
288
|
-
},
|
|
289
|
-
meta(files) {
|
|
290
|
-
return files.map((file) => {
|
|
291
|
-
return {
|
|
292
|
-
...file.data,
|
|
293
|
-
_file: file.info
|
|
294
|
-
};
|
|
295
|
-
});
|
|
296
|
-
},
|
|
297
|
-
docs(docs, metas) {
|
|
298
|
-
const parsedDocs = this.doc(docs);
|
|
299
|
-
const parsedMetas = this.meta(metas);
|
|
300
|
-
return {
|
|
301
|
-
docs: parsedDocs,
|
|
302
|
-
meta: parsedMetas,
|
|
303
|
-
toFumadocsSource() {
|
|
304
|
-
return createMDXSource(parsedDocs, parsedMetas);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
function createMDXSource(docs, meta = []) {
|
|
310
|
-
return {
|
|
311
|
-
files: () => resolveFiles({
|
|
312
|
-
docs,
|
|
313
|
-
meta
|
|
314
|
-
})
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
function resolveFiles({ docs, meta }) {
|
|
318
|
-
const outputs = [];
|
|
319
|
-
for (const entry of docs) {
|
|
320
|
-
outputs.push({
|
|
321
|
-
type: "page",
|
|
322
|
-
absolutePath: entry._file.absolutePath,
|
|
323
|
-
path: entry._file.path,
|
|
324
|
-
data: entry
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
for (const entry of meta) {
|
|
328
|
-
outputs.push({
|
|
329
|
-
type: "meta",
|
|
330
|
-
absolutePath: entry._file.absolutePath,
|
|
331
|
-
path: entry._file.path,
|
|
332
|
-
data: entry
|
|
333
|
-
});
|
|
383
|
+
// src/utils/build-mdx.ts
|
|
384
|
+
var cache2 = /* @__PURE__ */ new Map();
|
|
385
|
+
async function buildMDX(cacheKey, source, options) {
|
|
386
|
+
const { filePath, frontmatter, data, _compiler, ...rest } = options;
|
|
387
|
+
function getProcessor(format) {
|
|
388
|
+
const key = `${cacheKey}:${format}`;
|
|
389
|
+
let processor = cache2.get(key);
|
|
390
|
+
if (!processor) {
|
|
391
|
+
processor = (0, import_mdx.createProcessor)({
|
|
392
|
+
outputFormat: "program",
|
|
393
|
+
...rest,
|
|
394
|
+
remarkPlugins: [remarkInclude, ...rest.remarkPlugins ?? []],
|
|
395
|
+
format
|
|
396
|
+
});
|
|
397
|
+
cache2.set(key, processor);
|
|
398
|
+
}
|
|
399
|
+
return processor;
|
|
334
400
|
}
|
|
335
|
-
return
|
|
401
|
+
return getProcessor(
|
|
402
|
+
options.format ?? filePath.endsWith(".mdx") ? "mdx" : "md"
|
|
403
|
+
).process({
|
|
404
|
+
value: source,
|
|
405
|
+
path: filePath,
|
|
406
|
+
data: {
|
|
407
|
+
...data,
|
|
408
|
+
frontmatter,
|
|
409
|
+
_compiler,
|
|
410
|
+
_processor: {
|
|
411
|
+
getProcessor
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
});
|
|
336
415
|
}
|
|
337
416
|
|
|
417
|
+
// src/runtime/async.ts
|
|
418
|
+
var import_client = require("@fumadocs/mdx-remote/client");
|
|
419
|
+
var import_node_url = require("url");
|
|
420
|
+
|
|
338
421
|
// src/config/build.ts
|
|
339
422
|
function buildConfig(config) {
|
|
340
423
|
const collections = /* @__PURE__ */ new Map();
|
|
@@ -361,75 +444,65 @@ function buildConfig(config) {
|
|
|
361
444
|
`Unknown export "${k}", you can only export collections from source configuration file.`
|
|
362
445
|
);
|
|
363
446
|
}
|
|
364
|
-
|
|
447
|
+
const mdxOptionsCache = /* @__PURE__ */ new Map();
|
|
365
448
|
return {
|
|
366
449
|
global: globalConfig,
|
|
367
450
|
collections,
|
|
368
|
-
async getDefaultMDXOptions() {
|
|
369
|
-
|
|
451
|
+
async getDefaultMDXOptions(mode = "default") {
|
|
452
|
+
const cached = mdxOptionsCache.get(mode);
|
|
453
|
+
if (cached) return cached;
|
|
370
454
|
const input = this.global.mdxOptions;
|
|
371
455
|
async function uncached() {
|
|
372
456
|
const options = typeof input === "function" ? await input() : input;
|
|
373
457
|
const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
|
|
374
458
|
if (options?.preset === "minimal") return options;
|
|
375
|
-
return getDefaultMDXOptions2(
|
|
459
|
+
return getDefaultMDXOptions2({
|
|
460
|
+
...options,
|
|
461
|
+
_withoutBundler: mode === "remote"
|
|
462
|
+
});
|
|
376
463
|
}
|
|
377
|
-
|
|
464
|
+
const result = uncached();
|
|
465
|
+
mdxOptionsCache.set(mode, result);
|
|
466
|
+
return result;
|
|
378
467
|
}
|
|
379
468
|
};
|
|
380
469
|
}
|
|
381
470
|
|
|
382
471
|
// src/runtime/async.ts
|
|
383
|
-
async function
|
|
472
|
+
async function getOptions(config, collection) {
|
|
384
473
|
const col = config.collections.get(collection);
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
return (0, import_mdx_remote.createCompiler)({
|
|
389
|
-
preset: "minimal",
|
|
390
|
-
...col.mdxOptions
|
|
391
|
-
});
|
|
392
|
-
break;
|
|
393
|
-
case "docs":
|
|
394
|
-
if (col.docs.mdxOptions)
|
|
395
|
-
return (0, import_mdx_remote.createCompiler)({
|
|
396
|
-
preset: "minimal",
|
|
397
|
-
...col.docs.mdxOptions
|
|
398
|
-
});
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
let defaultMdxOptions = config.global?.mdxOptions;
|
|
402
|
-
if (typeof defaultMdxOptions === "function")
|
|
403
|
-
defaultMdxOptions = await defaultMdxOptions();
|
|
404
|
-
if (defaultMdxOptions?.preset === "minimal") {
|
|
405
|
-
return (0, import_mdx_remote.createCompiler)(defaultMdxOptions);
|
|
406
|
-
}
|
|
407
|
-
const remarkPlugins = defaultMdxOptions?.remarkPlugins ?? [];
|
|
408
|
-
return (0, import_mdx_remote.createCompiler)({
|
|
409
|
-
...defaultMdxOptions,
|
|
410
|
-
remarkPlugins: (v) => typeof remarkPlugins === "function" ? [remarkInclude, ...remarkPlugins(v), import_mdx_plugins.remarkStructure] : [remarkInclude, ...v, ...remarkPlugins, import_mdx_plugins.remarkStructure]
|
|
411
|
-
});
|
|
474
|
+
if (col?.type === "doc" && col.mdxOptions) return col.mdxOptions;
|
|
475
|
+
if (col?.type === "docs" && col.docs.mdxOptions) return col.docs.mdxOptions;
|
|
476
|
+
return config.getDefaultMDXOptions("remote");
|
|
412
477
|
}
|
|
413
478
|
var _runtimeAsync = {
|
|
414
479
|
doc(files, collection, config) {
|
|
415
|
-
const
|
|
480
|
+
const initMdxOptions = getOptions(config, collection);
|
|
416
481
|
return files.map(({ info: file, data, content, lastModified }) => {
|
|
417
482
|
return {
|
|
418
483
|
...data,
|
|
419
484
|
_file: file,
|
|
420
485
|
content,
|
|
421
486
|
async load() {
|
|
422
|
-
const
|
|
423
|
-
const out = await
|
|
424
|
-
|
|
487
|
+
const mdxOptions = await initMdxOptions;
|
|
488
|
+
const out = await buildMDX(collection, content, {
|
|
489
|
+
...mdxOptions,
|
|
490
|
+
development: false,
|
|
491
|
+
frontmatter: data,
|
|
492
|
+
data: {
|
|
493
|
+
lastModified
|
|
494
|
+
},
|
|
425
495
|
filePath: file.absolutePath
|
|
426
496
|
});
|
|
497
|
+
const executed = await (0, import_client.executeMdx)(String(out), {
|
|
498
|
+
baseUrl: (0, import_node_url.pathToFileURL)(file.absolutePath)
|
|
499
|
+
});
|
|
427
500
|
return {
|
|
428
|
-
body:
|
|
429
|
-
toc:
|
|
501
|
+
body: executed.default,
|
|
502
|
+
toc: executed.toc,
|
|
430
503
|
lastModified,
|
|
431
|
-
structuredData: out.
|
|
432
|
-
_exports:
|
|
504
|
+
structuredData: out.data.structuredData,
|
|
505
|
+
_exports: executed
|
|
433
506
|
};
|
|
434
507
|
}
|
|
435
508
|
};
|
package/dist/runtime/async.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { L as LoadedConfig, a as RuntimeAsync } from '../types-
|
|
1
|
+
import { L as LoadedConfig, a as RuntimeAsync } from '../types-C-WXTx1W.cjs';
|
|
2
2
|
import '@standard-schema/spec';
|
|
3
3
|
import 'fumadocs-core/source';
|
|
4
|
-
import '../define-
|
|
5
|
-
import 'zod';
|
|
4
|
+
import '../define-DnJzAZrj.cjs';
|
|
6
5
|
import 'fumadocs-core/mdx-plugins';
|
|
7
6
|
import '@mdx-js/mdx';
|
|
8
7
|
import 'unified';
|
|
8
|
+
import 'zod';
|
|
9
9
|
import 'react';
|
|
10
10
|
import 'mdx/types';
|
|
11
11
|
import 'fumadocs-core/server';
|
package/dist/runtime/async.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { L as LoadedConfig, a as RuntimeAsync } from '../types-
|
|
1
|
+
import { L as LoadedConfig, a as RuntimeAsync } from '../types-CU9nn_je.js';
|
|
2
2
|
import '@standard-schema/spec';
|
|
3
3
|
import 'fumadocs-core/source';
|
|
4
|
-
import '../define-
|
|
5
|
-
import 'zod';
|
|
4
|
+
import '../define-DnJzAZrj.js';
|
|
6
5
|
import 'fumadocs-core/mdx-plugins';
|
|
7
6
|
import '@mdx-js/mdx';
|
|
8
7
|
import 'unified';
|
|
8
|
+
import 'zod';
|
|
9
9
|
import 'react';
|
|
10
10
|
import 'mdx/types';
|
|
11
11
|
import 'fumadocs-core/server';
|
package/dist/runtime/async.js
CHANGED
|
@@ -3,68 +3,51 @@ import {
|
|
|
3
3
|
createMDXSource
|
|
4
4
|
} from "../chunk-NUDEC6C5.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "../chunk-
|
|
6
|
+
buildMDX
|
|
7
|
+
} from "../chunk-HWSF4OGZ.js";
|
|
8
|
+
import "../chunk-3XN4P23K.js";
|
|
8
9
|
import {
|
|
9
10
|
buildConfig
|
|
10
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-XVL4ZQFK.js";
|
|
11
12
|
import "../chunk-KVWX6THC.js";
|
|
12
13
|
|
|
13
14
|
// src/runtime/async.ts
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
} from "fumadocs-core/mdx-plugins";
|
|
18
|
-
async function initCompiler(config, collection) {
|
|
15
|
+
import { executeMdx } from "@fumadocs/mdx-remote/client";
|
|
16
|
+
import { pathToFileURL } from "url";
|
|
17
|
+
async function getOptions(config, collection) {
|
|
19
18
|
const col = config.collections.get(collection);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return createCompiler({
|
|
24
|
-
preset: "minimal",
|
|
25
|
-
...col.mdxOptions
|
|
26
|
-
});
|
|
27
|
-
break;
|
|
28
|
-
case "docs":
|
|
29
|
-
if (col.docs.mdxOptions)
|
|
30
|
-
return createCompiler({
|
|
31
|
-
preset: "minimal",
|
|
32
|
-
...col.docs.mdxOptions
|
|
33
|
-
});
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
let defaultMdxOptions = config.global?.mdxOptions;
|
|
37
|
-
if (typeof defaultMdxOptions === "function")
|
|
38
|
-
defaultMdxOptions = await defaultMdxOptions();
|
|
39
|
-
if (defaultMdxOptions?.preset === "minimal") {
|
|
40
|
-
return createCompiler(defaultMdxOptions);
|
|
41
|
-
}
|
|
42
|
-
const remarkPlugins = defaultMdxOptions?.remarkPlugins ?? [];
|
|
43
|
-
return createCompiler({
|
|
44
|
-
...defaultMdxOptions,
|
|
45
|
-
remarkPlugins: (v) => typeof remarkPlugins === "function" ? [remarkInclude, ...remarkPlugins(v), remarkStructure] : [remarkInclude, ...v, ...remarkPlugins, remarkStructure]
|
|
46
|
-
});
|
|
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");
|
|
47
22
|
}
|
|
48
23
|
var _runtimeAsync = {
|
|
49
24
|
doc(files, collection, config) {
|
|
50
|
-
const
|
|
25
|
+
const initMdxOptions = getOptions(config, collection);
|
|
51
26
|
return files.map(({ info: file, data, content, lastModified }) => {
|
|
52
27
|
return {
|
|
53
28
|
...data,
|
|
54
29
|
_file: file,
|
|
55
30
|
content,
|
|
56
31
|
async load() {
|
|
57
|
-
const
|
|
58
|
-
const out = await
|
|
59
|
-
|
|
32
|
+
const mdxOptions = await initMdxOptions;
|
|
33
|
+
const out = await buildMDX(collection, content, {
|
|
34
|
+
...mdxOptions,
|
|
35
|
+
development: false,
|
|
36
|
+
frontmatter: data,
|
|
37
|
+
data: {
|
|
38
|
+
lastModified
|
|
39
|
+
},
|
|
60
40
|
filePath: file.absolutePath
|
|
61
41
|
});
|
|
42
|
+
const executed = await executeMdx(String(out), {
|
|
43
|
+
baseUrl: pathToFileURL(file.absolutePath)
|
|
44
|
+
});
|
|
62
45
|
return {
|
|
63
|
-
body:
|
|
64
|
-
toc:
|
|
46
|
+
body: executed.default,
|
|
47
|
+
toc: executed.toc,
|
|
65
48
|
lastModified,
|
|
66
|
-
structuredData: out.
|
|
67
|
-
_exports:
|
|
49
|
+
structuredData: out.data.structuredData,
|
|
50
|
+
_exports: executed
|
|
68
51
|
};
|
|
69
52
|
}
|
|
70
53
|
};
|
package/dist/runtime/vite.d.cts
CHANGED
|
@@ -2,12 +2,12 @@ import { TableOfContents } from 'fumadocs-core/server';
|
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
3
|
import { MDXProps } from 'mdx/types';
|
|
4
4
|
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
5
|
-
import { a as DocCollection, M as MetaCollection, b as DocsCollection } from '../define-
|
|
5
|
+
import { a as DocCollection, M as MetaCollection, b as DocsCollection } from '../define-DnJzAZrj.cjs';
|
|
6
6
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
7
|
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
8
|
-
import 'zod';
|
|
9
8
|
import '@mdx-js/mdx';
|
|
10
9
|
import 'unified';
|
|
10
|
+
import 'zod';
|
|
11
11
|
|
|
12
12
|
interface CompiledMDXProperties<Frontmatter> {
|
|
13
13
|
frontmatter: Frontmatter;
|
package/dist/runtime/vite.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { TableOfContents } from 'fumadocs-core/server';
|
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
3
|
import { MDXProps } from 'mdx/types';
|
|
4
4
|
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
5
|
-
import { a as DocCollection, M as MetaCollection, b as DocsCollection } from '../define-
|
|
5
|
+
import { a as DocCollection, M as MetaCollection, b as DocsCollection } from '../define-DnJzAZrj.js';
|
|
6
6
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
7
|
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
8
|
-
import 'zod';
|
|
9
8
|
import '@mdx-js/mdx';
|
|
10
9
|
import 'unified';
|
|
10
|
+
import 'zod';
|
|
11
11
|
|
|
12
12
|
interface CompiledMDXProperties<Frontmatter> {
|
|
13
13
|
frontmatter: Frontmatter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
3
|
-
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-
|
|
3
|
+
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-DnJzAZrj.cjs';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
5
|
import { FC } from 'react';
|
|
6
6
|
import { MDXProps } from 'mdx/types';
|
|
@@ -10,7 +10,7 @@ import { TableOfContents } from 'fumadocs-core/server';
|
|
|
10
10
|
interface LoadedConfig {
|
|
11
11
|
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
12
12
|
global: GlobalConfig;
|
|
13
|
-
getDefaultMDXOptions(): Promise<ProcessorOptions>;
|
|
13
|
+
getDefaultMDXOptions(mode?: 'default' | 'remote'): Promise<ProcessorOptions>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface BaseCollectionEntry {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
3
|
-
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-
|
|
3
|
+
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-DnJzAZrj.js';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
5
|
import { FC } from 'react';
|
|
6
6
|
import { MDXProps } from 'mdx/types';
|
|
@@ -10,7 +10,7 @@ import { TableOfContents } from 'fumadocs-core/server';
|
|
|
10
10
|
interface LoadedConfig {
|
|
11
11
|
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
12
12
|
global: GlobalConfig;
|
|
13
|
-
getDefaultMDXOptions(): Promise<ProcessorOptions>;
|
|
13
|
+
getDefaultMDXOptions(mode?: 'default' | 'remote'): Promise<ProcessorOptions>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface BaseCollectionEntry {
|