fumadocs-mdx 11.6.7 → 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-2Z6EJ3GA.js → chunk-AVMO2SRO.js} +6 -3
- package/dist/chunk-KVWX6THC.js +19 -0
- package/dist/{chunk-7SSA5RCV.js → chunk-NUDEC6C5.js} +12 -6
- package/dist/{chunk-VC3Y6FLZ.js → chunk-YRT4TZBA.js} +10 -1
- package/dist/config/index.cjs +31 -5
- package/dist/config/index.d.cts +3 -2
- package/dist/config/index.d.ts +3 -2
- package/dist/config/index.js +6 -5
- package/dist/index.cjs +12 -6
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/loader-mdx.cjs +158 -159
- package/dist/loader-mdx.js +15 -59
- package/dist/next/index.cjs +49 -19
- package/dist/next/index.js +34 -17
- package/dist/runtime/async.cjs +32 -9
- package/dist/runtime/async.d.cts +5 -5
- package/dist/runtime/async.d.ts +5 -5
- package/dist/runtime/async.js +3 -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 +19 -7
- package/dist/mdx-options-YGL3EP3M.js +0 -6
package/dist/next/index.js
CHANGED
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
validate
|
|
10
10
|
} from "../chunk-OTM6WYMS.js";
|
|
11
11
|
import "../chunk-DRVUBK5B.js";
|
|
12
|
+
import {
|
|
13
|
+
fumaMatter
|
|
14
|
+
} from "../chunk-KVWX6THC.js";
|
|
12
15
|
|
|
13
16
|
// src/map/index.ts
|
|
14
17
|
import * as path2 from "path";
|
|
@@ -50,15 +53,13 @@ var fileCache = {
|
|
|
50
53
|
};
|
|
51
54
|
|
|
52
55
|
// src/map/generate.ts
|
|
53
|
-
import matter from "gray-matter";
|
|
54
56
|
import { load } from "js-yaml";
|
|
55
57
|
async function readFileWithCache(file) {
|
|
56
58
|
const cached = fileCache.read("read-file", file);
|
|
57
59
|
if (cached) return cached;
|
|
58
60
|
return (await fs.readFile(file)).toString();
|
|
59
61
|
}
|
|
60
|
-
async function generateJS(configPath, config,
|
|
61
|
-
const outDir = path.dirname(outputPath);
|
|
62
|
+
async function generateJS(configPath, config, importPath, configHash = false) {
|
|
62
63
|
let asyncInit = false;
|
|
63
64
|
const lines = [
|
|
64
65
|
getImportCode({
|
|
@@ -68,7 +69,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
68
69
|
}),
|
|
69
70
|
getImportCode({
|
|
70
71
|
type: "namespace",
|
|
71
|
-
specifier: toImportPath(configPath,
|
|
72
|
+
specifier: toImportPath(configPath, importPath),
|
|
72
73
|
name: "_source"
|
|
73
74
|
})
|
|
74
75
|
];
|
|
@@ -76,11 +77,15 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
76
77
|
async function getDocEntries(collectionName, files) {
|
|
77
78
|
const items = files.map(async (file, i) => {
|
|
78
79
|
const importId = `${collectionName}_${i}`;
|
|
80
|
+
const params = [`collection=${collectionName}`];
|
|
81
|
+
if (configHash) {
|
|
82
|
+
params.push(`hash=${configHash}`);
|
|
83
|
+
}
|
|
79
84
|
lines.unshift(
|
|
80
85
|
getImportCode({
|
|
81
86
|
type: "namespace",
|
|
82
87
|
name: importId,
|
|
83
|
-
specifier: `${toImportPath(file.absolutePath,
|
|
88
|
+
specifier: `${toImportPath(file.absolutePath, importPath)}?${params.join("&")}`
|
|
84
89
|
})
|
|
85
90
|
);
|
|
86
91
|
return `{ info: ${JSON.stringify(file)}, data: ${importId} }`;
|
|
@@ -123,11 +128,12 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
123
128
|
asyncInit = true;
|
|
124
129
|
}
|
|
125
130
|
const entries2 = files.map(async (file) => {
|
|
126
|
-
const parsed =
|
|
131
|
+
const parsed = fumaMatter(
|
|
127
132
|
await readFileWithCache(file.absolutePath).catch(() => "")
|
|
128
133
|
);
|
|
134
|
+
let data = parsed.data;
|
|
129
135
|
if (collection.schema) {
|
|
130
|
-
|
|
136
|
+
data = await validate(
|
|
131
137
|
collection.schema,
|
|
132
138
|
parsed.data,
|
|
133
139
|
{ path: file.absolutePath, source: parsed.content },
|
|
@@ -141,7 +147,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
141
147
|
return JSON.stringify({
|
|
142
148
|
info: file,
|
|
143
149
|
lastModified,
|
|
144
|
-
data
|
|
150
|
+
data,
|
|
145
151
|
content: parsed.content
|
|
146
152
|
});
|
|
147
153
|
});
|
|
@@ -209,14 +215,17 @@ function getImportCode(info) {
|
|
|
209
215
|
}
|
|
210
216
|
return `import ${specifier}`;
|
|
211
217
|
}
|
|
212
|
-
function toImportPath(file,
|
|
218
|
+
function toImportPath(file, config) {
|
|
213
219
|
const ext = path.extname(file);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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);
|
|
220
229
|
}
|
|
221
230
|
return importPath.replaceAll(path.sep, "/");
|
|
222
231
|
}
|
|
@@ -243,7 +252,12 @@ async function start(dev, configPath, outDir) {
|
|
|
243
252
|
try {
|
|
244
253
|
await fs2.writeFile(
|
|
245
254
|
outPath,
|
|
246
|
-
await generateJS(
|
|
255
|
+
await generateJS(
|
|
256
|
+
configPath,
|
|
257
|
+
config,
|
|
258
|
+
{ relativeTo: outDir },
|
|
259
|
+
configHash
|
|
260
|
+
)
|
|
247
261
|
);
|
|
248
262
|
} catch (err) {
|
|
249
263
|
if (err instanceof ValidationError) {
|
|
@@ -348,7 +362,10 @@ async function postInstall(configPath = findConfigFile(), outDir = ".source") {
|
|
|
348
362
|
const config = await loadConfig(configPath, outDir, hash, true);
|
|
349
363
|
await fs3.rm(path3.dirname(jsOut), { recursive: true });
|
|
350
364
|
await fs3.mkdir(path3.dirname(jsOut), { recursive: true });
|
|
351
|
-
await fs3.writeFile(
|
|
365
|
+
await fs3.writeFile(
|
|
366
|
+
jsOut,
|
|
367
|
+
await generateJS(configPath, config, { relativeTo: outDir }, hash)
|
|
368
|
+
);
|
|
352
369
|
console.log("[MDX] types generated");
|
|
353
370
|
}
|
|
354
371
|
export {
|
package/dist/runtime/async.cjs
CHANGED
|
@@ -40,7 +40,24 @@ var import_mdx_remote = require("@fumadocs/mdx-remote");
|
|
|
40
40
|
var import_unist_util_visit = require("unist-util-visit");
|
|
41
41
|
var path = __toESM(require("path"), 1);
|
|
42
42
|
var fs = __toESM(require("fs/promises"), 1);
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
// src/utils/fuma-matter.ts
|
|
45
|
+
var import_js_yaml = require("js-yaml");
|
|
46
|
+
var regex = /^---\r?\n(.+?)\r?\n---\r?\n/s;
|
|
47
|
+
function fumaMatter(input) {
|
|
48
|
+
const output = { matter: "", data: {}, content: input };
|
|
49
|
+
const match = regex.exec(input);
|
|
50
|
+
if (!match) {
|
|
51
|
+
return output;
|
|
52
|
+
}
|
|
53
|
+
output.matter = match[1];
|
|
54
|
+
output.content = input.slice(match[0].length);
|
|
55
|
+
const loaded = (0, import_js_yaml.load)(output.matter);
|
|
56
|
+
output.data = loaded ?? {};
|
|
57
|
+
return output;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/mdx-plugins/remark-include.ts
|
|
44
61
|
function flattenNode(node) {
|
|
45
62
|
if ("children" in node)
|
|
46
63
|
return node.children.map((child) => flattenNode(child)).join("");
|
|
@@ -75,7 +92,7 @@ function remarkInclude() {
|
|
|
75
92
|
);
|
|
76
93
|
const asCode = params.lang || !specifier.endsWith(".md") && !specifier.endsWith(".mdx");
|
|
77
94
|
queue.push(
|
|
78
|
-
fs.readFile(targetPath).then(async (content) => {
|
|
95
|
+
fs.readFile(targetPath).then((buffer) => buffer.toString()).then(async (content) => {
|
|
79
96
|
compiler?.addDependency(targetPath);
|
|
80
97
|
if (asCode) {
|
|
81
98
|
const lang = params.lang ?? path.extname(specifier).slice(1);
|
|
@@ -88,7 +105,7 @@ function remarkInclude() {
|
|
|
88
105
|
});
|
|
89
106
|
return;
|
|
90
107
|
}
|
|
91
|
-
const parsed = processor.parse((
|
|
108
|
+
const parsed = processor.parse(fumaMatter(content).content);
|
|
92
109
|
await update(parsed, targetPath, processor, compiler);
|
|
93
110
|
Object.assign(
|
|
94
111
|
parent && parent.type === "paragraph" ? parent : node,
|
|
@@ -116,21 +133,25 @@ var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
|
|
|
116
133
|
|
|
117
134
|
// src/runtime/index.ts
|
|
118
135
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
136
|
+
var cache = /* @__PURE__ */ new Map();
|
|
119
137
|
var _runtime = {
|
|
120
138
|
doc(files) {
|
|
121
139
|
return files.map((file) => {
|
|
122
140
|
const { default: body, frontmatter, ...exports2 } = file.data;
|
|
123
|
-
let cachedContent;
|
|
124
141
|
return {
|
|
125
142
|
body,
|
|
126
143
|
...exports2,
|
|
127
144
|
...frontmatter,
|
|
128
|
-
|
|
129
|
-
cachedContent ??= import_node_fs.default.readFileSync(file.info.absolutePath).toString();
|
|
130
|
-
return cachedContent;
|
|
131
|
-
},
|
|
145
|
+
_file: file.info,
|
|
132
146
|
_exports: file.data,
|
|
133
|
-
|
|
147
|
+
get content() {
|
|
148
|
+
const path2 = this._file.absolutePath;
|
|
149
|
+
const cached = cache.get(path2);
|
|
150
|
+
if (cached) return cached;
|
|
151
|
+
const content = import_node_fs.default.readFileSync(path2).toString();
|
|
152
|
+
cache.set(path2, content);
|
|
153
|
+
return content;
|
|
154
|
+
}
|
|
134
155
|
};
|
|
135
156
|
});
|
|
136
157
|
},
|
|
@@ -167,6 +188,7 @@ function resolveFiles({ docs, meta }) {
|
|
|
167
188
|
for (const entry of docs) {
|
|
168
189
|
outputs.push({
|
|
169
190
|
type: "page",
|
|
191
|
+
absolutePath: entry._file.absolutePath,
|
|
170
192
|
path: entry._file.path,
|
|
171
193
|
data: entry
|
|
172
194
|
});
|
|
@@ -174,6 +196,7 @@ function resolveFiles({ docs, meta }) {
|
|
|
174
196
|
for (const entry of meta) {
|
|
175
197
|
outputs.push({
|
|
176
198
|
type: "meta",
|
|
199
|
+
absolutePath: entry._file.absolutePath,
|
|
177
200
|
path: entry._file.path,
|
|
178
201
|
data: entry
|
|
179
202
|
});
|
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
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
_runtime,
|
|
3
3
|
createMDXSource
|
|
4
|
-
} from "../chunk-
|
|
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-KVWX6THC.js";
|
|
11
12
|
|
|
12
13
|
// src/runtime/async.ts
|
|
13
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 };
|
|
@@ -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 };
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry, L as LoadedConfig } from './types-CDl6YYjj.js';
|
|
2
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
4
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
|
-
import { MDXOptions } from '@fumadocs/mdx-remote';
|
|
6
|
-
|
|
7
|
-
interface LoadedConfig {
|
|
8
|
-
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
9
|
-
global?: GlobalConfig;
|
|
10
|
-
_mdx_loader?: {
|
|
11
|
-
cachedOptions?: ProcessorOptions;
|
|
12
|
-
};
|
|
13
|
-
_mdx_async?: {
|
|
14
|
-
cachedMdxOptions?: MDXOptions;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
4
|
|
|
18
5
|
interface RuntimeFile {
|
|
19
6
|
info: FileInfo;
|
|
@@ -104,4 +91,4 @@ interface RuntimeAsync {
|
|
|
104
91
|
} : never;
|
|
105
92
|
}
|
|
106
93
|
|
|
107
|
-
export type {
|
|
94
|
+
export type { Runtime as R, RuntimeAsync as a };
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry, L as LoadedConfig } from './types-CDl6YYjj.cjs';
|
|
2
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
4
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
|
-
import { MDXOptions } from '@fumadocs/mdx-remote';
|
|
6
|
-
|
|
7
|
-
interface LoadedConfig {
|
|
8
|
-
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
9
|
-
global?: GlobalConfig;
|
|
10
|
-
_mdx_loader?: {
|
|
11
|
-
cachedOptions?: ProcessorOptions;
|
|
12
|
-
};
|
|
13
|
-
_mdx_async?: {
|
|
14
|
-
cachedMdxOptions?: MDXOptions;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
4
|
|
|
18
5
|
interface RuntimeFile {
|
|
19
6
|
info: FileInfo;
|
|
@@ -104,4 +91,4 @@ interface RuntimeAsync {
|
|
|
104
91
|
} : never;
|
|
105
92
|
}
|
|
106
93
|
|
|
107
|
-
export type {
|
|
94
|
+
export type { Runtime as R, RuntimeAsync as a };
|