fumadocs-mdx 11.6.11 → 11.7.1
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-64MMPGML.js → chunk-2CSSQTP6.js} +1 -10
- package/dist/{chunk-SXOJYWZ3.js → chunk-2KBRPMAM.js} +1 -1
- package/dist/{chunk-6PDS7MUA.js → chunk-C5INPAZJ.js} +4 -4
- package/dist/{chunk-DRVUBK5B.js → chunk-GWR7KMRU.js} +13 -1
- package/dist/chunk-OWZSTKKX.js +58 -0
- package/dist/{chunk-22SBT5SQ.js → chunk-ZOWJF3OH.js} +6 -6
- package/dist/config/index.cjs +4 -19
- package/dist/config/index.d.cts +3 -7
- package/dist/config/index.d.ts +3 -7
- package/dist/config/index.js +7 -13
- package/dist/{types-DVeuYiq5.d.cts → define-CCrinVBZ.d.cts} +37 -119
- package/dist/{types-DVeuYiq5.d.ts → define-CCrinVBZ.d.ts} +37 -119
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/loader-mdx.cjs +155 -134
- package/dist/loader-mdx.js +7 -10
- package/dist/mdx-options-UDV5WEFU.js +6 -0
- package/dist/next/index.cjs +253 -85
- package/dist/next/index.js +49 -63
- package/dist/runtime/async.cjs +167 -15
- package/dist/runtime/async.d.cts +5 -6
- package/dist/runtime/async.d.ts +5 -6
- package/dist/runtime/async.js +24 -15
- package/dist/runtime/vite.cjs +150 -0
- package/dist/runtime/vite.d.cts +71 -0
- package/dist/runtime/vite.d.ts +71 -0
- package/dist/runtime/vite.js +123 -0
- package/dist/{types-HIdjlLo0.d.ts → types-C0bKwtAx.d.ts} +38 -50
- package/dist/{types-BcUhOIxN.d.cts → types-CnslxmoO.d.cts} +38 -50
- package/dist/vite/index.cjs +385 -134
- package/dist/vite/index.d.cts +12 -3
- package/dist/vite/index.d.ts +12 -3
- package/dist/vite/index.js +165 -20
- package/package.json +20 -10
|
@@ -110,16 +110,7 @@ function getDefaultMDXOptions({
|
|
|
110
110
|
rehypePlugins
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
async function loadDefaultOptions(config) {
|
|
114
|
-
const input = config.global?.mdxOptions;
|
|
115
|
-
config._mdx_loader ??= {};
|
|
116
|
-
const mdxLoader = config._mdx_loader;
|
|
117
|
-
if (!mdxLoader.cachedOptions) {
|
|
118
|
-
mdxLoader.cachedOptions = typeof input === "function" ? getDefaultMDXOptions(await input()) : getDefaultMDXOptions(input ?? {});
|
|
119
|
-
}
|
|
120
|
-
return mdxLoader.cachedOptions;
|
|
121
|
-
}
|
|
122
113
|
|
|
123
114
|
export {
|
|
124
|
-
|
|
115
|
+
getDefaultMDXOptions
|
|
125
116
|
};
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
import { createProcessor } from "@mdx-js/mdx";
|
|
7
7
|
var cache = /* @__PURE__ */ new Map();
|
|
8
8
|
async function buildMDX(cacheKey, source, options) {
|
|
9
|
-
const { filePath, frontmatter, data, ...rest } = options;
|
|
9
|
+
const { filePath, frontmatter, data, _compiler, ...rest } = options;
|
|
10
10
|
let format = options.format;
|
|
11
|
-
if (
|
|
12
|
-
format
|
|
11
|
+
if (filePath) {
|
|
12
|
+
format ??= filePath.endsWith(".mdx") ? "mdx" : "md";
|
|
13
13
|
}
|
|
14
14
|
format ??= "mdx";
|
|
15
15
|
const key = `${cacheKey}:${format}`;
|
|
@@ -29,7 +29,7 @@ async function buildMDX(cacheKey, source, options) {
|
|
|
29
29
|
data: {
|
|
30
30
|
...data,
|
|
31
31
|
frontmatter,
|
|
32
|
-
_compiler
|
|
32
|
+
_compiler
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -25,11 +25,23 @@ function buildConfig(config) {
|
|
|
25
25
|
null
|
|
26
26
|
];
|
|
27
27
|
}
|
|
28
|
+
let cachedMdxOptions;
|
|
28
29
|
return [
|
|
29
30
|
null,
|
|
30
31
|
{
|
|
31
32
|
global: globalConfig,
|
|
32
|
-
collections
|
|
33
|
+
collections,
|
|
34
|
+
async getDefaultMDXOptions() {
|
|
35
|
+
if (cachedMdxOptions) return cachedMdxOptions;
|
|
36
|
+
const input = this.global?.mdxOptions;
|
|
37
|
+
async function uncached() {
|
|
38
|
+
const options = typeof input === "function" ? await input() : input;
|
|
39
|
+
const { getDefaultMDXOptions } = await import("./mdx-options-UDV5WEFU.js");
|
|
40
|
+
if (options?.preset === "minimal") return options;
|
|
41
|
+
return getDefaultMDXOptions(options ?? {});
|
|
42
|
+
}
|
|
43
|
+
return cachedMdxOptions = uncached();
|
|
44
|
+
}
|
|
33
45
|
}
|
|
34
46
|
];
|
|
35
47
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/utils/import-formatter.ts
|
|
2
|
+
import path from "path";
|
|
3
|
+
function getImportCode(info) {
|
|
4
|
+
const specifier = JSON.stringify(info.specifier);
|
|
5
|
+
if (info.type === "default") return `import ${info.name} from ${specifier}`;
|
|
6
|
+
if (info.type === "namespace")
|
|
7
|
+
return `import * as ${info.name} from ${specifier}`;
|
|
8
|
+
if (info.type === "named") {
|
|
9
|
+
const names = info.names.map(
|
|
10
|
+
(name) => Array.isArray(name) ? `${name[0]} as ${name[1]}` : name
|
|
11
|
+
);
|
|
12
|
+
return `import { ${names.join(", ")} } from ${specifier}`;
|
|
13
|
+
}
|
|
14
|
+
return `import ${specifier}`;
|
|
15
|
+
}
|
|
16
|
+
function toImportPath(file, config) {
|
|
17
|
+
const ext = path.extname(file);
|
|
18
|
+
const filename = ext === ".ts" ? file.substring(0, file.length - ext.length) : file;
|
|
19
|
+
let importPath;
|
|
20
|
+
if ("relativeTo" in config) {
|
|
21
|
+
importPath = path.relative(config.relativeTo, filename);
|
|
22
|
+
if (!path.isAbsolute(importPath) && !importPath.startsWith(".")) {
|
|
23
|
+
importPath = `./${importPath}`;
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
importPath = path.resolve(filename);
|
|
27
|
+
}
|
|
28
|
+
return importPath.replaceAll(path.sep, "/");
|
|
29
|
+
}
|
|
30
|
+
function ident(code, tab = 1) {
|
|
31
|
+
return code.split("\n").map((v) => " ".repeat(tab) + v).join("\n");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/utils/collections.ts
|
|
35
|
+
function getSupportedFormats(collection) {
|
|
36
|
+
return {
|
|
37
|
+
doc: ["mdx", "md"],
|
|
38
|
+
meta: ["json", "yaml"]
|
|
39
|
+
}[collection.type];
|
|
40
|
+
}
|
|
41
|
+
function getGlobPatterns(collection) {
|
|
42
|
+
if (collection.files) return collection.files;
|
|
43
|
+
return [`**/*.{${getSupportedFormats(collection).join(",")}}`];
|
|
44
|
+
}
|
|
45
|
+
function isFileSupported(filePath, collection) {
|
|
46
|
+
for (const format of getSupportedFormats(collection)) {
|
|
47
|
+
if (filePath.endsWith(`.${format}`)) return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
getImportCode,
|
|
54
|
+
toImportPath,
|
|
55
|
+
ident,
|
|
56
|
+
getGlobPatterns,
|
|
57
|
+
isFileSupported
|
|
58
|
+
};
|
|
@@ -19,16 +19,16 @@ var frontmatterSchema = z.object({
|
|
|
19
19
|
});
|
|
20
20
|
var ValidationError = class extends Error {
|
|
21
21
|
constructor(message, issues) {
|
|
22
|
-
super(
|
|
22
|
+
super(
|
|
23
|
+
`${message}:
|
|
24
|
+
${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n")}`
|
|
25
|
+
);
|
|
26
|
+
this.title = message;
|
|
23
27
|
this.issues = issues;
|
|
24
28
|
}
|
|
25
|
-
toString() {
|
|
26
|
-
return `${this.message}:
|
|
27
|
-
${this.issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n")}`;
|
|
28
|
-
}
|
|
29
29
|
toStringFormatted() {
|
|
30
30
|
return [
|
|
31
|
-
picocolors.bold(`[MDX] ${this.
|
|
31
|
+
picocolors.bold(`[MDX] ${this.title}:`),
|
|
32
32
|
...this.issues.map(
|
|
33
33
|
(issue) => picocolors.redBright(
|
|
34
34
|
`- ${picocolors.bold(issue.path?.join(".") ?? "*")}: ${issue.message}`
|
package/dist/config/index.cjs
CHANGED
|
@@ -34,7 +34,7 @@ __export(config_exports, {
|
|
|
34
34
|
defineConfig: () => defineConfig,
|
|
35
35
|
defineDocs: () => defineDocs,
|
|
36
36
|
frontmatterSchema: () => frontmatterSchema,
|
|
37
|
-
|
|
37
|
+
getDefaultMDXOptions: () => getDefaultMDXOptions,
|
|
38
38
|
metaSchema: () => metaSchema,
|
|
39
39
|
remarkInclude: () => remarkInclude
|
|
40
40
|
});
|
|
@@ -62,11 +62,7 @@ var frontmatterSchema = import_zod.z.object({
|
|
|
62
62
|
|
|
63
63
|
// src/config/define.ts
|
|
64
64
|
function defineCollections(options) {
|
|
65
|
-
return
|
|
66
|
-
// @ts-expect-error -- internal type inferring
|
|
67
|
-
_type: void 0,
|
|
68
|
-
...options
|
|
69
|
-
};
|
|
65
|
+
return options;
|
|
70
66
|
}
|
|
71
67
|
function defineDocs(options) {
|
|
72
68
|
if (!options)
|
|
@@ -76,17 +72,15 @@ function defineDocs(options) {
|
|
|
76
72
|
const dir = options?.dir ?? "content/docs";
|
|
77
73
|
return {
|
|
78
74
|
type: "docs",
|
|
79
|
-
|
|
75
|
+
dir,
|
|
80
76
|
docs: defineCollections({
|
|
81
77
|
type: "doc",
|
|
82
78
|
dir,
|
|
83
79
|
schema: frontmatterSchema,
|
|
84
80
|
...options?.docs
|
|
85
81
|
}),
|
|
86
|
-
// @ts-expect-error -- internal type inferring
|
|
87
82
|
meta: defineCollections({
|
|
88
83
|
type: "meta",
|
|
89
|
-
files: ["**/*.{json,yaml}"],
|
|
90
84
|
dir,
|
|
91
85
|
schema: metaSchema,
|
|
92
86
|
...options?.meta
|
|
@@ -209,15 +203,6 @@ function getDefaultMDXOptions({
|
|
|
209
203
|
rehypePlugins
|
|
210
204
|
};
|
|
211
205
|
}
|
|
212
|
-
async function loadDefaultOptions(config) {
|
|
213
|
-
const input = config.global?.mdxOptions;
|
|
214
|
-
config._mdx_loader ??= {};
|
|
215
|
-
const mdxLoader = config._mdx_loader;
|
|
216
|
-
if (!mdxLoader.cachedOptions) {
|
|
217
|
-
mdxLoader.cachedOptions = typeof input === "function" ? getDefaultMDXOptions(await input()) : getDefaultMDXOptions(input ?? {});
|
|
218
|
-
}
|
|
219
|
-
return mdxLoader.cachedOptions;
|
|
220
|
-
}
|
|
221
206
|
|
|
222
207
|
// src/mdx-plugins/remark-include.ts
|
|
223
208
|
var import_unist_util_visit = require("unist-util-visit");
|
|
@@ -316,7 +301,7 @@ ${e instanceof Error ? e.message : String(e)}`
|
|
|
316
301
|
defineConfig,
|
|
317
302
|
defineDocs,
|
|
318
303
|
frontmatterSchema,
|
|
319
|
-
|
|
304
|
+
getDefaultMDXOptions,
|
|
320
305
|
metaSchema,
|
|
321
306
|
remarkInclude
|
|
322
307
|
});
|
package/dist/config/index.d.cts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, b as DefaultMDXOptions, D as DocCollection, a as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-CCrinVBZ.cjs';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
|
-
import 'mdx/types';
|
|
5
|
-
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import 'fumadocs-core/server';
|
|
7
|
-
import '@mdx-js/mdx';
|
|
8
|
-
import 'react';
|
|
9
4
|
import 'zod';
|
|
10
5
|
import '@standard-schema/spec';
|
|
11
|
-
import '
|
|
6
|
+
import 'fumadocs-core/mdx-plugins';
|
|
7
|
+
import '@mdx-js/mdx';
|
|
12
8
|
|
|
13
9
|
declare function remarkInclude(this: Processor): Transformer<Root, Root>;
|
|
14
10
|
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, b as DefaultMDXOptions, D as DocCollection, a as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-CCrinVBZ.js';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
|
-
import 'mdx/types';
|
|
5
|
-
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import 'fumadocs-core/server';
|
|
7
|
-
import '@mdx-js/mdx';
|
|
8
|
-
import 'react';
|
|
9
4
|
import 'zod';
|
|
10
5
|
import '@standard-schema/spec';
|
|
11
|
-
import '
|
|
6
|
+
import 'fumadocs-core/mdx-plugins';
|
|
7
|
+
import '@mdx-js/mdx';
|
|
12
8
|
|
|
13
9
|
declare function remarkInclude(this: Processor): Transformer<Root, Root>;
|
|
14
10
|
|
package/dist/config/index.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
frontmatterSchema,
|
|
3
3
|
metaSchema
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import {
|
|
6
|
-
loadDefaultOptions
|
|
7
|
-
} from "../chunk-64MMPGML.js";
|
|
4
|
+
} from "../chunk-ZOWJF3OH.js";
|
|
8
5
|
import {
|
|
9
6
|
remarkInclude
|
|
10
7
|
} from "../chunk-AVMO2SRO.js";
|
|
11
8
|
import "../chunk-KVWX6THC.js";
|
|
9
|
+
import {
|
|
10
|
+
getDefaultMDXOptions
|
|
11
|
+
} from "../chunk-2CSSQTP6.js";
|
|
12
12
|
|
|
13
13
|
// src/config/define.ts
|
|
14
14
|
function defineCollections(options) {
|
|
15
|
-
return
|
|
16
|
-
// @ts-expect-error -- internal type inferring
|
|
17
|
-
_type: void 0,
|
|
18
|
-
...options
|
|
19
|
-
};
|
|
15
|
+
return options;
|
|
20
16
|
}
|
|
21
17
|
function defineDocs(options) {
|
|
22
18
|
if (!options)
|
|
@@ -26,17 +22,15 @@ function defineDocs(options) {
|
|
|
26
22
|
const dir = options?.dir ?? "content/docs";
|
|
27
23
|
return {
|
|
28
24
|
type: "docs",
|
|
29
|
-
|
|
25
|
+
dir,
|
|
30
26
|
docs: defineCollections({
|
|
31
27
|
type: "doc",
|
|
32
28
|
dir,
|
|
33
29
|
schema: frontmatterSchema,
|
|
34
30
|
...options?.docs
|
|
35
31
|
}),
|
|
36
|
-
// @ts-expect-error -- internal type inferring
|
|
37
32
|
meta: defineCollections({
|
|
38
33
|
type: "meta",
|
|
39
|
-
files: ["**/*.{json,yaml}"],
|
|
40
34
|
dir,
|
|
41
35
|
schema: metaSchema,
|
|
42
36
|
...options?.meta
|
|
@@ -51,7 +45,7 @@ export {
|
|
|
51
45
|
defineConfig,
|
|
52
46
|
defineDocs,
|
|
53
47
|
frontmatterSchema,
|
|
54
|
-
|
|
48
|
+
getDefaultMDXOptions,
|
|
55
49
|
metaSchema,
|
|
56
50
|
remarkInclude
|
|
57
51
|
};
|
|
@@ -1,41 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
3
|
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
3
|
-
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
4
|
-
import { TableOfContents } from 'fumadocs-core/server';
|
|
5
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
6
5
|
import { Pluggable } from 'unified';
|
|
7
|
-
import { FC } from 'react';
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
10
|
-
import { MDXOptions as MDXOptions$1 } from '@fumadocs/mdx-remote';
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
collection?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Specify a file path for source
|
|
19
|
-
*/
|
|
20
|
-
filePath?: string;
|
|
21
|
-
frontmatter?: Record<string, unknown>;
|
|
7
|
+
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
8
|
+
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
9
|
+
rehypePlugins?: ResolvePlugins;
|
|
10
|
+
remarkPlugins?: ResolvePlugins;
|
|
22
11
|
/**
|
|
23
|
-
*
|
|
12
|
+
* Properties to export from `vfile.data`
|
|
24
13
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* The compiler object from loader
|
|
35
|
-
*/
|
|
36
|
-
_compiler?: CompilerOptions;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
14
|
+
valueToExport?: string[];
|
|
15
|
+
remarkStructureOptions?: plugins.StructureOptions | false;
|
|
16
|
+
remarkHeadingOptions?: plugins.RemarkHeadingOptions;
|
|
17
|
+
remarkImageOptions?: plugins.RemarkImageOptions | false;
|
|
18
|
+
remarkCodeTabOptions?: plugins.RemarkCodeTabOptions | false;
|
|
19
|
+
remarkNpmOptions?: plugins.RemarkNpmOptions | false;
|
|
20
|
+
rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
|
|
21
|
+
};
|
|
22
|
+
declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, remarkNpmOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
|
|
39
23
|
|
|
40
24
|
declare const metaSchema: z.ZodObject<{
|
|
41
25
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -54,6 +38,7 @@ declare const frontmatterSchema: z.ZodObject<{
|
|
|
54
38
|
}, z.core.$strip>;
|
|
55
39
|
|
|
56
40
|
type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
|
|
41
|
+
type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
|
57
42
|
interface BaseCollection {
|
|
58
43
|
/**
|
|
59
44
|
* Directories to scan
|
|
@@ -75,7 +60,7 @@ interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> ext
|
|
|
75
60
|
}
|
|
76
61
|
interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
|
|
77
62
|
type: 'doc';
|
|
78
|
-
mdxOptions?:
|
|
63
|
+
mdxOptions?: ProcessorOptions;
|
|
79
64
|
/**
|
|
80
65
|
* Load files with async
|
|
81
66
|
*/
|
|
@@ -87,105 +72,38 @@ interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Asyn
|
|
|
87
72
|
}
|
|
88
73
|
interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> {
|
|
89
74
|
type: 'docs';
|
|
90
|
-
dir: string
|
|
75
|
+
dir: string;
|
|
91
76
|
docs: DocCollection<DocSchema, Async>;
|
|
92
77
|
meta: MetaCollection<MetaSchema>;
|
|
93
78
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
} &
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
async: Async;
|
|
100
|
-
schema: Schema;
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options?: {
|
|
104
|
-
/**
|
|
105
|
-
* The directory to scan files
|
|
106
|
-
*
|
|
107
|
-
* @defaultValue 'content/docs'
|
|
108
|
-
*/
|
|
109
|
-
dir?: string | string[];
|
|
110
|
-
docs?: Omit<DocCollection<DocSchema, Async>, 'dir' | 'type'>;
|
|
111
|
-
meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
|
|
112
|
-
}): {
|
|
113
|
-
type: 'docs';
|
|
114
|
-
docs: {
|
|
115
|
-
type: 'doc';
|
|
116
|
-
_type: {
|
|
117
|
-
schema: DocSchema;
|
|
118
|
-
async: Async;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
meta: {
|
|
122
|
-
type: 'meta';
|
|
123
|
-
_type: {
|
|
124
|
-
schema: MetaSchema;
|
|
125
|
-
async: false;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
130
|
-
|
|
131
|
-
interface LoadedConfig {
|
|
132
|
-
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
133
|
-
global?: GlobalConfig;
|
|
134
|
-
_mdx_loader?: {
|
|
135
|
-
cachedOptions?: ProcessorOptions;
|
|
136
|
-
};
|
|
137
|
-
_mdx_async?: {
|
|
138
|
-
cachedMdxOptions?: MDXOptions$1;
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
143
|
-
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
144
|
-
rehypePlugins?: ResolvePlugins;
|
|
145
|
-
remarkPlugins?: ResolvePlugins;
|
|
146
|
-
/**
|
|
147
|
-
* Properties to export from `vfile.data`
|
|
148
|
-
*/
|
|
149
|
-
valueToExport?: string[];
|
|
150
|
-
remarkStructureOptions?: plugins.StructureOptions | false;
|
|
151
|
-
remarkHeadingOptions?: plugins.RemarkHeadingOptions;
|
|
152
|
-
remarkImageOptions?: plugins.RemarkImageOptions | false;
|
|
153
|
-
remarkCodeTabOptions?: plugins.RemarkCodeTabOptions | false;
|
|
154
|
-
remarkNpmOptions?: plugins.RemarkNpmOptions | false;
|
|
155
|
-
rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
|
|
156
|
-
};
|
|
157
|
-
declare function loadDefaultOptions(config: LoadedConfig): Promise<ProcessorOptions>;
|
|
158
|
-
|
|
79
|
+
type GlobalConfigMDXOptions = ({
|
|
80
|
+
preset?: 'fumadocs';
|
|
81
|
+
} & DefaultMDXOptions) | ({
|
|
82
|
+
preset: 'minimal';
|
|
83
|
+
} & ProcessorOptions);
|
|
159
84
|
interface GlobalConfig {
|
|
160
85
|
/**
|
|
161
86
|
* Configure global MDX options
|
|
162
87
|
*/
|
|
163
|
-
mdxOptions?:
|
|
88
|
+
mdxOptions?: GlobalConfigMDXOptions | (() => Promise<GlobalConfigMDXOptions>);
|
|
164
89
|
/**
|
|
165
90
|
* Fetch last modified time with specified version control
|
|
166
91
|
* @defaultValue 'none'
|
|
167
92
|
*/
|
|
168
93
|
lastModifiedTime?: 'git' | 'none';
|
|
169
94
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
interface MarkdownProps {
|
|
175
|
-
body: FC<MDXProps>;
|
|
176
|
-
structuredData: StructuredData;
|
|
177
|
-
toc: TableOfContents;
|
|
178
|
-
_exports: Record<string, unknown>;
|
|
179
|
-
/**
|
|
180
|
-
* Only available when `lastModifiedTime` is enabled on MDX loader
|
|
181
|
-
*/
|
|
182
|
-
lastModified?: Date;
|
|
183
|
-
}
|
|
184
|
-
interface BaseCollectionEntry {
|
|
95
|
+
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = false>(options: DocCollection<Schema, Async>): DocCollection<Schema, Async>;
|
|
96
|
+
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
|
|
97
|
+
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options?: {
|
|
185
98
|
/**
|
|
186
|
-
*
|
|
99
|
+
* The directory to scan files
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue 'content/docs'
|
|
187
102
|
*/
|
|
188
|
-
|
|
189
|
-
|
|
103
|
+
dir?: string;
|
|
104
|
+
docs?: Omit<DocCollection<DocSchema, Async>, 'dir' | 'type'>;
|
|
105
|
+
meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
|
|
106
|
+
}): DocsCollection<DocSchema, MetaSchema, Async>;
|
|
107
|
+
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
190
108
|
|
|
191
|
-
export { type
|
|
109
|
+
export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DocCollection as D, type GlobalConfig as G, type MetaCollection as M, type DocsCollection as a, type DefaultMDXOptions as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
|