fumadocs-mdx 11.6.8 → 11.6.9
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-6PDS7MUA.js +49 -0
- package/dist/{chunk-KTLWF7GN.js → chunk-AVMO2SRO.js} +1 -1
- package/dist/chunk-KVWX6THC.js +19 -0
- package/dist/{chunk-VC3Y6FLZ.js → chunk-YRT4TZBA.js} +10 -1
- package/dist/config/index.cjs +17 -29
- package/dist/config/index.d.cts +3 -2
- package/dist/config/index.d.ts +3 -2
- package/dist/config/index.js +6 -6
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/loader-mdx.cjs +144 -183
- package/dist/loader-mdx.js +9 -56
- package/dist/next/index.cjs +33 -40
- package/dist/next/index.js +28 -14
- package/dist/runtime/async.cjs +9 -30
- package/dist/runtime/async.d.cts +5 -5
- package/dist/runtime/async.d.ts +5 -5
- package/dist/runtime/async.js +2 -2
- package/dist/{define-uoePrCQ_.d.ts → types-CDl6YYjj.d.cts} +66 -54
- package/dist/{define-uoePrCQ_.d.cts → types-CDl6YYjj.d.ts} +66 -54
- package/dist/{types-BYJBKH4G.d.ts → types-DVyGNyFh.d.ts} +2 -15
- package/dist/{types-BsJd_P5O.d.cts → types-DZW0R4_d.d.cts} +2 -15
- package/dist/vite/index.cjs +383 -0
- package/dist/vite/index.d.cts +8 -0
- package/dist/vite/index.d.ts +8 -0
- package/dist/vite/index.js +71 -0
- package/package.json +16 -3
- package/dist/chunk-MXACIHNJ.js +0 -40
- package/dist/mdx-options-YGL3EP3M.js +0 -6
package/dist/loader-mdx.js
CHANGED
|
@@ -8,51 +8,21 @@ import {
|
|
|
8
8
|
validate
|
|
9
9
|
} from "./chunk-OTM6WYMS.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
buildMDX,
|
|
12
|
+
countLines
|
|
13
|
+
} from "./chunk-6PDS7MUA.js";
|
|
14
|
+
import {
|
|
15
|
+
loadDefaultOptions
|
|
16
|
+
} from "./chunk-YRT4TZBA.js";
|
|
17
|
+
import "./chunk-AVMO2SRO.js";
|
|
13
18
|
import "./chunk-DRVUBK5B.js";
|
|
14
19
|
import {
|
|
15
20
|
fumaMatter
|
|
16
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KVWX6THC.js";
|
|
17
22
|
|
|
18
23
|
// src/loader-mdx.ts
|
|
19
24
|
import * as path from "path";
|
|
20
25
|
import { parse } from "querystring";
|
|
21
|
-
|
|
22
|
-
// src/utils/build-mdx.ts
|
|
23
|
-
import { createProcessor } from "@mdx-js/mdx";
|
|
24
|
-
var cache = /* @__PURE__ */ new Map();
|
|
25
|
-
async function buildMDX(cacheKey, source, options) {
|
|
26
|
-
const { filePath, frontmatter, data, ...rest } = options;
|
|
27
|
-
let format = options.format;
|
|
28
|
-
if (!format && filePath) {
|
|
29
|
-
format = filePath.endsWith(".mdx") ? "mdx" : "md";
|
|
30
|
-
}
|
|
31
|
-
format ??= "mdx";
|
|
32
|
-
const key = `${cacheKey}:${format}`;
|
|
33
|
-
let cached = cache.get(key);
|
|
34
|
-
if (cached === void 0) {
|
|
35
|
-
cached = createProcessor({
|
|
36
|
-
outputFormat: "program",
|
|
37
|
-
development: process.env.NODE_ENV === "development",
|
|
38
|
-
...rest,
|
|
39
|
-
remarkPlugins: [remarkInclude, ...rest.remarkPlugins ?? []],
|
|
40
|
-
format
|
|
41
|
-
});
|
|
42
|
-
cache.set(key, cached);
|
|
43
|
-
}
|
|
44
|
-
return cached.process({
|
|
45
|
-
value: source,
|
|
46
|
-
path: filePath,
|
|
47
|
-
data: {
|
|
48
|
-
...data,
|
|
49
|
-
frontmatter,
|
|
50
|
-
_compiler: options._compiler
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// src/loader-mdx.ts
|
|
56
26
|
async function loader(source, callback) {
|
|
57
27
|
this.cacheable(true);
|
|
58
28
|
const context = this.context;
|
|
@@ -95,7 +65,7 @@ async function loader(source, callback) {
|
|
|
95
65
|
}
|
|
96
66
|
try {
|
|
97
67
|
const lineOffset = "\n".repeat(
|
|
98
|
-
this.mode === "development" ?
|
|
68
|
+
this.mode === "development" ? countLines(matter.matter) : 0
|
|
99
69
|
);
|
|
100
70
|
const file = await buildMDX(
|
|
101
71
|
`${configHash}:${collectionId ?? "global"}`,
|
|
@@ -119,23 +89,6 @@ async function loader(source, callback) {
|
|
|
119
89
|
callback(error);
|
|
120
90
|
}
|
|
121
91
|
}
|
|
122
|
-
async function loadDefaultOptions(config) {
|
|
123
|
-
const input = config.global?.mdxOptions;
|
|
124
|
-
config._mdx_loader ??= {};
|
|
125
|
-
const mdxLoader = config._mdx_loader;
|
|
126
|
-
if (!mdxLoader.cachedOptions) {
|
|
127
|
-
const { getDefaultMDXOptions } = await import("./mdx-options-YGL3EP3M.js");
|
|
128
|
-
mdxLoader.cachedOptions = typeof input === "function" ? getDefaultMDXOptions(await input()) : getDefaultMDXOptions(input ?? {});
|
|
129
|
-
}
|
|
130
|
-
return mdxLoader.cachedOptions;
|
|
131
|
-
}
|
|
132
|
-
function lines(s) {
|
|
133
|
-
let num = 0;
|
|
134
|
-
for (const c of s) {
|
|
135
|
-
if (c === "\n") num++;
|
|
136
|
-
}
|
|
137
|
-
return num;
|
|
138
|
-
}
|
|
139
92
|
export {
|
|
140
93
|
loader as default
|
|
141
94
|
};
|
package/dist/next/index.cjs
CHANGED
|
@@ -281,37 +281,16 @@ async function getGitTimestamp(file) {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
// src/utils/fuma-matter.ts
|
|
284
|
-
var import_lru_cache2 = require("lru-cache");
|
|
285
284
|
var import_js_yaml = require("js-yaml");
|
|
286
|
-
var
|
|
287
|
-
max: 200
|
|
288
|
-
});
|
|
285
|
+
var regex = /^---\r?\n(.+?)\r?\n---\r?\n/s;
|
|
289
286
|
function fumaMatter(input) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const cached = cache3.get(input);
|
|
294
|
-
if (cached) return cached;
|
|
295
|
-
const result = parseMatter(input);
|
|
296
|
-
cache3.set(input, result);
|
|
297
|
-
return structuredClone(result);
|
|
298
|
-
}
|
|
299
|
-
var delimiter = "---";
|
|
300
|
-
function parseMatter(str) {
|
|
301
|
-
const output = { matter: "", data: {}, content: str };
|
|
302
|
-
const open = delimiter + "\n";
|
|
303
|
-
const close = "\n" + delimiter;
|
|
304
|
-
if (!str.startsWith(open)) {
|
|
287
|
+
const output = { matter: "", data: {}, content: input };
|
|
288
|
+
const match = regex.exec(input);
|
|
289
|
+
if (!match) {
|
|
305
290
|
return output;
|
|
306
291
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
let closeIdx = str.indexOf(close);
|
|
310
|
-
if (closeIdx === -1) {
|
|
311
|
-
closeIdx = len;
|
|
312
|
-
}
|
|
313
|
-
output.matter = str.slice(0, closeIdx);
|
|
314
|
-
output.content = str.slice(closeIdx + close.length);
|
|
292
|
+
output.matter = match[1];
|
|
293
|
+
output.content = input.slice(match[0].length);
|
|
315
294
|
const loaded = (0, import_js_yaml.load)(output.matter);
|
|
316
295
|
output.data = loaded ?? {};
|
|
317
296
|
return output;
|
|
@@ -323,8 +302,7 @@ async function readFileWithCache(file) {
|
|
|
323
302
|
if (cached) return cached;
|
|
324
303
|
return (await fs2.readFile(file)).toString();
|
|
325
304
|
}
|
|
326
|
-
async function generateJS(configPath, config,
|
|
327
|
-
const outDir = path3.dirname(outputPath);
|
|
305
|
+
async function generateJS(configPath, config, importPath, configHash = false) {
|
|
328
306
|
let asyncInit = false;
|
|
329
307
|
const lines = [
|
|
330
308
|
getImportCode({
|
|
@@ -334,7 +312,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
334
312
|
}),
|
|
335
313
|
getImportCode({
|
|
336
314
|
type: "namespace",
|
|
337
|
-
specifier: toImportPath(configPath,
|
|
315
|
+
specifier: toImportPath(configPath, importPath),
|
|
338
316
|
name: "_source"
|
|
339
317
|
})
|
|
340
318
|
];
|
|
@@ -342,11 +320,15 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
342
320
|
async function getDocEntries(collectionName, files) {
|
|
343
321
|
const items = files.map(async (file, i) => {
|
|
344
322
|
const importId = `${collectionName}_${i}`;
|
|
323
|
+
const params = [`collection=${collectionName}`];
|
|
324
|
+
if (configHash) {
|
|
325
|
+
params.push(`hash=${configHash}`);
|
|
326
|
+
}
|
|
345
327
|
lines.unshift(
|
|
346
328
|
getImportCode({
|
|
347
329
|
type: "namespace",
|
|
348
330
|
name: importId,
|
|
349
|
-
specifier: `${toImportPath(file.absolutePath,
|
|
331
|
+
specifier: `${toImportPath(file.absolutePath, importPath)}?${params.join("&")}`
|
|
350
332
|
})
|
|
351
333
|
);
|
|
352
334
|
return `{ info: ${JSON.stringify(file)}, data: ${importId} }`;
|
|
@@ -476,14 +458,17 @@ function getImportCode(info) {
|
|
|
476
458
|
}
|
|
477
459
|
return `import ${specifier}`;
|
|
478
460
|
}
|
|
479
|
-
function toImportPath(file,
|
|
461
|
+
function toImportPath(file, config) {
|
|
480
462
|
const ext = path3.extname(file);
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
463
|
+
const filename = ext === ".ts" ? file.substring(0, file.length - ext.length) : file;
|
|
464
|
+
let importPath;
|
|
465
|
+
if ("relativeTo" in config) {
|
|
466
|
+
importPath = path3.relative(config.relativeTo, filename);
|
|
467
|
+
if (!path3.isAbsolute(importPath) && !importPath.startsWith(".")) {
|
|
468
|
+
importPath = `./${importPath}`;
|
|
469
|
+
}
|
|
470
|
+
} else {
|
|
471
|
+
importPath = path3.resolve(filename);
|
|
487
472
|
}
|
|
488
473
|
return importPath.replaceAll(path3.sep, "/");
|
|
489
474
|
}
|
|
@@ -510,7 +495,12 @@ async function start(dev, configPath, outDir) {
|
|
|
510
495
|
try {
|
|
511
496
|
await fs3.writeFile(
|
|
512
497
|
outPath,
|
|
513
|
-
await generateJS(
|
|
498
|
+
await generateJS(
|
|
499
|
+
configPath,
|
|
500
|
+
config,
|
|
501
|
+
{ relativeTo: outDir },
|
|
502
|
+
configHash
|
|
503
|
+
)
|
|
514
504
|
);
|
|
515
505
|
} catch (err) {
|
|
516
506
|
if (err instanceof ValidationError) {
|
|
@@ -615,7 +605,10 @@ async function postInstall(configPath = findConfigFile(), outDir = ".source") {
|
|
|
615
605
|
const config = await loadConfig(configPath, outDir, hash, true);
|
|
616
606
|
await fs4.rm(path5.dirname(jsOut), { recursive: true });
|
|
617
607
|
await fs4.mkdir(path5.dirname(jsOut), { recursive: true });
|
|
618
|
-
await fs4.writeFile(
|
|
608
|
+
await fs4.writeFile(
|
|
609
|
+
jsOut,
|
|
610
|
+
await generateJS(configPath, config, { relativeTo: outDir }, hash)
|
|
611
|
+
);
|
|
619
612
|
console.log("[MDX] types generated");
|
|
620
613
|
}
|
|
621
614
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/next/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import "../chunk-DRVUBK5B.js";
|
|
12
12
|
import {
|
|
13
13
|
fumaMatter
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-KVWX6THC.js";
|
|
15
15
|
|
|
16
16
|
// src/map/index.ts
|
|
17
17
|
import * as path2 from "path";
|
|
@@ -59,8 +59,7 @@ async function readFileWithCache(file) {
|
|
|
59
59
|
if (cached) return cached;
|
|
60
60
|
return (await fs.readFile(file)).toString();
|
|
61
61
|
}
|
|
62
|
-
async function generateJS(configPath, config,
|
|
63
|
-
const outDir = path.dirname(outputPath);
|
|
62
|
+
async function generateJS(configPath, config, importPath, configHash = false) {
|
|
64
63
|
let asyncInit = false;
|
|
65
64
|
const lines = [
|
|
66
65
|
getImportCode({
|
|
@@ -70,7 +69,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
70
69
|
}),
|
|
71
70
|
getImportCode({
|
|
72
71
|
type: "namespace",
|
|
73
|
-
specifier: toImportPath(configPath,
|
|
72
|
+
specifier: toImportPath(configPath, importPath),
|
|
74
73
|
name: "_source"
|
|
75
74
|
})
|
|
76
75
|
];
|
|
@@ -78,11 +77,15 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
78
77
|
async function getDocEntries(collectionName, files) {
|
|
79
78
|
const items = files.map(async (file, i) => {
|
|
80
79
|
const importId = `${collectionName}_${i}`;
|
|
80
|
+
const params = [`collection=${collectionName}`];
|
|
81
|
+
if (configHash) {
|
|
82
|
+
params.push(`hash=${configHash}`);
|
|
83
|
+
}
|
|
81
84
|
lines.unshift(
|
|
82
85
|
getImportCode({
|
|
83
86
|
type: "namespace",
|
|
84
87
|
name: importId,
|
|
85
|
-
specifier: `${toImportPath(file.absolutePath,
|
|
88
|
+
specifier: `${toImportPath(file.absolutePath, importPath)}?${params.join("&")}`
|
|
86
89
|
})
|
|
87
90
|
);
|
|
88
91
|
return `{ info: ${JSON.stringify(file)}, data: ${importId} }`;
|
|
@@ -212,14 +215,17 @@ function getImportCode(info) {
|
|
|
212
215
|
}
|
|
213
216
|
return `import ${specifier}`;
|
|
214
217
|
}
|
|
215
|
-
function toImportPath(file,
|
|
218
|
+
function toImportPath(file, config) {
|
|
216
219
|
const ext = path.extname(file);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
const filename = ext === ".ts" ? file.substring(0, file.length - ext.length) : file;
|
|
221
|
+
let importPath;
|
|
222
|
+
if ("relativeTo" in config) {
|
|
223
|
+
importPath = path.relative(config.relativeTo, filename);
|
|
224
|
+
if (!path.isAbsolute(importPath) && !importPath.startsWith(".")) {
|
|
225
|
+
importPath = `./${importPath}`;
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
importPath = path.resolve(filename);
|
|
223
229
|
}
|
|
224
230
|
return importPath.replaceAll(path.sep, "/");
|
|
225
231
|
}
|
|
@@ -246,7 +252,12 @@ async function start(dev, configPath, outDir) {
|
|
|
246
252
|
try {
|
|
247
253
|
await fs2.writeFile(
|
|
248
254
|
outPath,
|
|
249
|
-
await generateJS(
|
|
255
|
+
await generateJS(
|
|
256
|
+
configPath,
|
|
257
|
+
config,
|
|
258
|
+
{ relativeTo: outDir },
|
|
259
|
+
configHash
|
|
260
|
+
)
|
|
250
261
|
);
|
|
251
262
|
} catch (err) {
|
|
252
263
|
if (err instanceof ValidationError) {
|
|
@@ -351,7 +362,10 @@ async function postInstall(configPath = findConfigFile(), outDir = ".source") {
|
|
|
351
362
|
const config = await loadConfig(configPath, outDir, hash, true);
|
|
352
363
|
await fs3.rm(path3.dirname(jsOut), { recursive: true });
|
|
353
364
|
await fs3.mkdir(path3.dirname(jsOut), { recursive: true });
|
|
354
|
-
await fs3.writeFile(
|
|
365
|
+
await fs3.writeFile(
|
|
366
|
+
jsOut,
|
|
367
|
+
await generateJS(configPath, config, { relativeTo: outDir }, hash)
|
|
368
|
+
);
|
|
355
369
|
console.log("[MDX] types generated");
|
|
356
370
|
}
|
|
357
371
|
export {
|
package/dist/runtime/async.cjs
CHANGED
|
@@ -42,37 +42,16 @@ var path = __toESM(require("path"), 1);
|
|
|
42
42
|
var fs = __toESM(require("fs/promises"), 1);
|
|
43
43
|
|
|
44
44
|
// src/utils/fuma-matter.ts
|
|
45
|
-
var import_lru_cache = require("lru-cache");
|
|
46
45
|
var import_js_yaml = require("js-yaml");
|
|
47
|
-
var
|
|
48
|
-
max: 200
|
|
49
|
-
});
|
|
46
|
+
var regex = /^---\r?\n(.+?)\r?\n---\r?\n/s;
|
|
50
47
|
function fumaMatter(input) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const cached = cache.get(input);
|
|
55
|
-
if (cached) return cached;
|
|
56
|
-
const result = parseMatter(input);
|
|
57
|
-
cache.set(input, result);
|
|
58
|
-
return structuredClone(result);
|
|
59
|
-
}
|
|
60
|
-
var delimiter = "---";
|
|
61
|
-
function parseMatter(str) {
|
|
62
|
-
const output = { matter: "", data: {}, content: str };
|
|
63
|
-
const open = delimiter + "\n";
|
|
64
|
-
const close = "\n" + delimiter;
|
|
65
|
-
if (!str.startsWith(open)) {
|
|
48
|
+
const output = { matter: "", data: {}, content: input };
|
|
49
|
+
const match = regex.exec(input);
|
|
50
|
+
if (!match) {
|
|
66
51
|
return output;
|
|
67
52
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
let closeIdx = str.indexOf(close);
|
|
71
|
-
if (closeIdx === -1) {
|
|
72
|
-
closeIdx = len;
|
|
73
|
-
}
|
|
74
|
-
output.matter = str.slice(0, closeIdx);
|
|
75
|
-
output.content = str.slice(closeIdx + close.length);
|
|
53
|
+
output.matter = match[1];
|
|
54
|
+
output.content = input.slice(match[0].length);
|
|
76
55
|
const loaded = (0, import_js_yaml.load)(output.matter);
|
|
77
56
|
output.data = loaded ?? {};
|
|
78
57
|
return output;
|
|
@@ -154,7 +133,7 @@ var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
|
|
|
154
133
|
|
|
155
134
|
// src/runtime/index.ts
|
|
156
135
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
157
|
-
var
|
|
136
|
+
var cache = /* @__PURE__ */ new Map();
|
|
158
137
|
var _runtime = {
|
|
159
138
|
doc(files) {
|
|
160
139
|
return files.map((file) => {
|
|
@@ -167,10 +146,10 @@ var _runtime = {
|
|
|
167
146
|
_exports: file.data,
|
|
168
147
|
get content() {
|
|
169
148
|
const path2 = this._file.absolutePath;
|
|
170
|
-
const cached =
|
|
149
|
+
const cached = cache.get(path2);
|
|
171
150
|
if (cached) return cached;
|
|
172
151
|
const content = import_node_fs.default.readFileSync(path2).toString();
|
|
173
|
-
|
|
152
|
+
cache.set(path2, content);
|
|
174
153
|
return content;
|
|
175
154
|
}
|
|
176
155
|
};
|
package/dist/runtime/async.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../
|
|
3
|
-
import '@
|
|
1
|
+
import { a as RuntimeAsync } from '../types-DZW0R4_d.cjs';
|
|
2
|
+
import { L as LoadedConfig } from '../types-CDl6YYjj.cjs';
|
|
3
|
+
import '@standard-schema/spec';
|
|
4
|
+
import 'fumadocs-core/source';
|
|
4
5
|
import 'mdx/types';
|
|
5
6
|
import 'fumadocs-core/mdx-plugins';
|
|
6
7
|
import 'fumadocs-core/server';
|
|
8
|
+
import '@mdx-js/mdx';
|
|
7
9
|
import 'unified';
|
|
8
10
|
import 'react';
|
|
9
11
|
import 'zod';
|
|
10
|
-
import '@standard-schema/spec';
|
|
11
|
-
import 'fumadocs-core/source';
|
|
12
12
|
import '@fumadocs/mdx-remote';
|
|
13
13
|
|
|
14
14
|
declare function buildConfig(config: Record<string, unknown>): [err: string, value: null] | [err: null, value: LoadedConfig];
|
package/dist/runtime/async.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../
|
|
3
|
-
import '@
|
|
1
|
+
import { a as RuntimeAsync } from '../types-DVyGNyFh.js';
|
|
2
|
+
import { L as LoadedConfig } from '../types-CDl6YYjj.js';
|
|
3
|
+
import '@standard-schema/spec';
|
|
4
|
+
import 'fumadocs-core/source';
|
|
4
5
|
import 'mdx/types';
|
|
5
6
|
import 'fumadocs-core/mdx-plugins';
|
|
6
7
|
import 'fumadocs-core/server';
|
|
8
|
+
import '@mdx-js/mdx';
|
|
7
9
|
import 'unified';
|
|
8
10
|
import 'react';
|
|
9
11
|
import 'zod';
|
|
10
|
-
import '@standard-schema/spec';
|
|
11
|
-
import 'fumadocs-core/source';
|
|
12
12
|
import '@fumadocs/mdx-remote';
|
|
13
13
|
|
|
14
14
|
declare function buildConfig(config: Record<string, unknown>): [err: string, value: null] | [err: null, value: LoadedConfig];
|
package/dist/runtime/async.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "../chunk-NUDEC6C5.js";
|
|
5
5
|
import {
|
|
6
6
|
remarkInclude
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-AVMO2SRO.js";
|
|
8
8
|
import {
|
|
9
9
|
buildConfig
|
|
10
10
|
} from "../chunk-DRVUBK5B.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-KVWX6THC.js";
|
|
12
12
|
|
|
13
13
|
// src/runtime/async.ts
|
|
14
14
|
import { createCompiler } from "@fumadocs/mdx-remote";
|
|
@@ -1,60 +1,13 @@
|
|
|
1
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
2
1
|
import { MDXProps } from 'mdx/types';
|
|
3
2
|
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
4
3
|
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
5
4
|
import { TableOfContents } from 'fumadocs-core/server';
|
|
5
|
+
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
6
6
|
import { Pluggable } from 'unified';
|
|
7
7
|
import { FC } from 'react';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
10
|
-
|
|
11
|
-
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
12
|
-
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
13
|
-
rehypePlugins?: ResolvePlugins;
|
|
14
|
-
remarkPlugins?: ResolvePlugins;
|
|
15
|
-
/**
|
|
16
|
-
* Properties to export from `vfile.data`
|
|
17
|
-
*/
|
|
18
|
-
valueToExport?: string[];
|
|
19
|
-
remarkStructureOptions?: plugins.StructureOptions | false;
|
|
20
|
-
remarkHeadingOptions?: plugins.RemarkHeadingOptions;
|
|
21
|
-
remarkImageOptions?: plugins.RemarkImageOptions | false;
|
|
22
|
-
remarkCodeTabOptions?: plugins.RemarkCodeTabOptions | false;
|
|
23
|
-
rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
|
|
24
|
-
};
|
|
25
|
-
declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
|
|
26
|
-
|
|
27
|
-
interface GlobalConfig {
|
|
28
|
-
/**
|
|
29
|
-
* Configure global MDX options
|
|
30
|
-
*/
|
|
31
|
-
mdxOptions?: DefaultMDXOptions | (() => DefaultMDXOptions | Promise<DefaultMDXOptions>);
|
|
32
|
-
/**
|
|
33
|
-
* Fetch last modified time with specified version control
|
|
34
|
-
* @defaultValue 'none'
|
|
35
|
-
*/
|
|
36
|
-
lastModifiedTime?: 'git' | 'none';
|
|
37
|
-
}
|
|
38
|
-
interface FileInfo {
|
|
39
|
-
path: string;
|
|
40
|
-
absolutePath: string;
|
|
41
|
-
}
|
|
42
|
-
interface MarkdownProps {
|
|
43
|
-
body: FC<MDXProps>;
|
|
44
|
-
structuredData: StructuredData;
|
|
45
|
-
toc: TableOfContents;
|
|
46
|
-
_exports: Record<string, unknown>;
|
|
47
|
-
/**
|
|
48
|
-
* Only available when `lastModifiedTime` is enabled on MDX loader
|
|
49
|
-
*/
|
|
50
|
-
lastModified?: Date;
|
|
51
|
-
}
|
|
52
|
-
interface BaseCollectionEntry {
|
|
53
|
-
/**
|
|
54
|
-
* Raw file path of collection entry, including absolute path (not normalized).
|
|
55
|
-
*/
|
|
56
|
-
_file: FileInfo;
|
|
57
|
-
}
|
|
10
|
+
import { MDXOptions as MDXOptions$1 } from '@fumadocs/mdx-remote';
|
|
58
11
|
|
|
59
12
|
interface MDXOptions extends ProcessorOptions {
|
|
60
13
|
/**
|
|
@@ -94,17 +47,17 @@ declare const metaSchema: z.ZodObject<{
|
|
|
94
47
|
}, "strip", z.ZodTypeAny, {
|
|
95
48
|
root?: boolean | undefined;
|
|
96
49
|
title?: string | undefined;
|
|
97
|
-
icon?: string | undefined;
|
|
98
50
|
pages?: string[] | undefined;
|
|
99
51
|
description?: string | undefined;
|
|
100
52
|
defaultOpen?: boolean | undefined;
|
|
53
|
+
icon?: string | undefined;
|
|
101
54
|
}, {
|
|
102
55
|
root?: boolean | undefined;
|
|
103
56
|
title?: string | undefined;
|
|
104
|
-
icon?: string | undefined;
|
|
105
57
|
pages?: string[] | undefined;
|
|
106
58
|
description?: string | undefined;
|
|
107
59
|
defaultOpen?: boolean | undefined;
|
|
60
|
+
icon?: string | undefined;
|
|
108
61
|
}>;
|
|
109
62
|
declare const frontmatterSchema: z.ZodObject<{
|
|
110
63
|
title: z.ZodString;
|
|
@@ -114,14 +67,14 @@ declare const frontmatterSchema: z.ZodObject<{
|
|
|
114
67
|
_openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
115
68
|
}, "strip", z.ZodTypeAny, {
|
|
116
69
|
title: string;
|
|
117
|
-
icon?: string | undefined;
|
|
118
70
|
description?: string | undefined;
|
|
71
|
+
icon?: string | undefined;
|
|
119
72
|
full?: boolean | undefined;
|
|
120
73
|
_openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
121
74
|
}, {
|
|
122
75
|
title: string;
|
|
123
|
-
icon?: string | undefined;
|
|
124
76
|
description?: string | undefined;
|
|
77
|
+
icon?: string | undefined;
|
|
125
78
|
full?: boolean | undefined;
|
|
126
79
|
_openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
127
80
|
}>;
|
|
@@ -201,4 +154,63 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
|
|
|
201
154
|
};
|
|
202
155
|
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
203
156
|
|
|
204
|
-
|
|
157
|
+
interface LoadedConfig {
|
|
158
|
+
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
159
|
+
global?: GlobalConfig;
|
|
160
|
+
_mdx_loader?: {
|
|
161
|
+
cachedOptions?: ProcessorOptions;
|
|
162
|
+
};
|
|
163
|
+
_mdx_async?: {
|
|
164
|
+
cachedMdxOptions?: MDXOptions$1;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
169
|
+
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
170
|
+
rehypePlugins?: ResolvePlugins;
|
|
171
|
+
remarkPlugins?: ResolvePlugins;
|
|
172
|
+
/**
|
|
173
|
+
* Properties to export from `vfile.data`
|
|
174
|
+
*/
|
|
175
|
+
valueToExport?: string[];
|
|
176
|
+
remarkStructureOptions?: plugins.StructureOptions | false;
|
|
177
|
+
remarkHeadingOptions?: plugins.RemarkHeadingOptions;
|
|
178
|
+
remarkImageOptions?: plugins.RemarkImageOptions | false;
|
|
179
|
+
remarkCodeTabOptions?: plugins.RemarkCodeTabOptions | false;
|
|
180
|
+
rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
|
|
181
|
+
};
|
|
182
|
+
declare function loadDefaultOptions(config: LoadedConfig): Promise<ProcessorOptions>;
|
|
183
|
+
|
|
184
|
+
interface GlobalConfig {
|
|
185
|
+
/**
|
|
186
|
+
* Configure global MDX options
|
|
187
|
+
*/
|
|
188
|
+
mdxOptions?: DefaultMDXOptions | (() => DefaultMDXOptions | Promise<DefaultMDXOptions>);
|
|
189
|
+
/**
|
|
190
|
+
* Fetch last modified time with specified version control
|
|
191
|
+
* @defaultValue 'none'
|
|
192
|
+
*/
|
|
193
|
+
lastModifiedTime?: 'git' | 'none';
|
|
194
|
+
}
|
|
195
|
+
interface FileInfo {
|
|
196
|
+
path: string;
|
|
197
|
+
absolutePath: string;
|
|
198
|
+
}
|
|
199
|
+
interface MarkdownProps {
|
|
200
|
+
body: FC<MDXProps>;
|
|
201
|
+
structuredData: StructuredData;
|
|
202
|
+
toc: TableOfContents;
|
|
203
|
+
_exports: Record<string, unknown>;
|
|
204
|
+
/**
|
|
205
|
+
* Only available when `lastModifiedTime` is enabled on MDX loader
|
|
206
|
+
*/
|
|
207
|
+
lastModified?: Date;
|
|
208
|
+
}
|
|
209
|
+
interface BaseCollectionEntry {
|
|
210
|
+
/**
|
|
211
|
+
* Raw file path of collection entry, including absolute path (not normalized).
|
|
212
|
+
*/
|
|
213
|
+
_file: FileInfo;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { type BaseCollectionEntry as B, type CollectionSchema as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type LoadedConfig as L, type MarkdownProps as M, type BaseCollection as a, type MetaCollection as b, type DocCollection as c, type DocsCollection as d, defineCollections as e, frontmatterSchema as f, defineDocs as g, defineConfig as h, loadDefaultOptions as l, metaSchema as m };
|