fumadocs-mdx 11.6.10 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{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-JPPCALFT.js +34 -0
- package/dist/{chunk-OTM6WYMS.js → chunk-ZOWJF3OH.js} +7 -7
- package/dist/config/index.cjs +6 -19
- package/dist/config/index.d.cts +3 -7
- package/dist/config/index.d.ts +3 -7
- package/dist/config/index.js +8 -12
- package/dist/define-CCrinVBZ.d.cts +109 -0
- package/dist/define-CCrinVBZ.d.ts +109 -0
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/loader-mdx.cjs +156 -135
- package/dist/loader-mdx.js +7 -10
- package/dist/mdx-options-UDV5WEFU.js +6 -0
- package/dist/next/index.cjs +197 -54
- package/dist/next/index.js +7 -30
- 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 +26 -17
- package/dist/runtime/vite.cjs +116 -0
- package/dist/runtime/vite.d.cts +47 -0
- package/dist/runtime/vite.d.ts +47 -0
- package/dist/runtime/vite.js +90 -0
- package/dist/{types-Dk7DhSKZ.d.ts → types-C0bKwtAx.d.ts} +38 -50
- package/dist/{types-ZwLebhOl.d.cts → types-CnslxmoO.d.cts} +38 -50
- package/dist/vite/index.cjs +384 -137
- package/dist/vite/index.d.cts +12 -3
- package/dist/vite/index.d.ts +12 -3
- package/dist/vite/index.js +177 -21
- package/package.json +20 -10
- package/dist/types-DvTNxAvo.d.cts +0 -217
- package/dist/types-DvTNxAvo.d.ts +0 -217
|
@@ -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,34 @@
|
|
|
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
|
+
|
|
31
|
+
export {
|
|
32
|
+
getImportCode,
|
|
33
|
+
toImportPath
|
|
34
|
+
};
|
|
@@ -15,20 +15,20 @@ var frontmatterSchema = z.object({
|
|
|
15
15
|
icon: z.string().optional(),
|
|
16
16
|
full: z.boolean().optional(),
|
|
17
17
|
// Fumadocs OpenAPI generated
|
|
18
|
-
_openapi: z.
|
|
18
|
+
_openapi: z.looseObject({}).optional()
|
|
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
|
});
|
|
@@ -57,16 +57,12 @@ var frontmatterSchema = import_zod.z.object({
|
|
|
57
57
|
icon: import_zod.z.string().optional(),
|
|
58
58
|
full: import_zod.z.boolean().optional(),
|
|
59
59
|
// Fumadocs OpenAPI generated
|
|
60
|
-
_openapi: import_zod.z.
|
|
60
|
+
_openapi: import_zod.z.looseObject({}).optional()
|
|
61
61
|
});
|
|
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,14 +72,14 @@ 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,
|
|
79
|
+
files: ["**/*.{md,mdx}"],
|
|
83
80
|
schema: frontmatterSchema,
|
|
84
81
|
...options?.docs
|
|
85
82
|
}),
|
|
86
|
-
// @ts-expect-error -- internal type inferring
|
|
87
83
|
meta: defineCollections({
|
|
88
84
|
type: "meta",
|
|
89
85
|
files: ["**/*.{json,yaml}"],
|
|
@@ -209,15 +205,6 @@ function getDefaultMDXOptions({
|
|
|
209
205
|
rehypePlugins
|
|
210
206
|
};
|
|
211
207
|
}
|
|
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
208
|
|
|
222
209
|
// src/mdx-plugins/remark-include.ts
|
|
223
210
|
var import_unist_util_visit = require("unist-util-visit");
|
|
@@ -316,7 +303,7 @@ ${e instanceof Error ? e.message : String(e)}`
|
|
|
316
303
|
defineConfig,
|
|
317
304
|
defineDocs,
|
|
318
305
|
frontmatterSchema,
|
|
319
|
-
|
|
306
|
+
getDefaultMDXOptions,
|
|
320
307
|
metaSchema,
|
|
321
308
|
remarkInclude
|
|
322
309
|
});
|
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,14 +22,14 @@ 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,
|
|
29
|
+
files: ["**/*.{md,mdx}"],
|
|
33
30
|
schema: frontmatterSchema,
|
|
34
31
|
...options?.docs
|
|
35
32
|
}),
|
|
36
|
-
// @ts-expect-error -- internal type inferring
|
|
37
33
|
meta: defineCollections({
|
|
38
34
|
type: "meta",
|
|
39
35
|
files: ["**/*.{json,yaml}"],
|
|
@@ -51,7 +47,7 @@ export {
|
|
|
51
47
|
defineConfig,
|
|
52
48
|
defineDocs,
|
|
53
49
|
frontmatterSchema,
|
|
54
|
-
|
|
50
|
+
getDefaultMDXOptions,
|
|
55
51
|
metaSchema,
|
|
56
52
|
remarkInclude
|
|
57
53
|
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
+
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
4
|
+
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
|
+
import { Pluggable } from 'unified';
|
|
6
|
+
|
|
7
|
+
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
8
|
+
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
9
|
+
rehypePlugins?: ResolvePlugins;
|
|
10
|
+
remarkPlugins?: ResolvePlugins;
|
|
11
|
+
/**
|
|
12
|
+
* Properties to export from `vfile.data`
|
|
13
|
+
*/
|
|
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;
|
|
23
|
+
|
|
24
|
+
declare const metaSchema: z.ZodObject<{
|
|
25
|
+
title: z.ZodOptional<z.ZodString>;
|
|
26
|
+
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
root: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
declare const frontmatterSchema: z.ZodObject<{
|
|
33
|
+
title: z.ZodString;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
35
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
36
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
_openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
|
|
40
|
+
type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
|
|
41
|
+
type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
|
42
|
+
interface BaseCollection {
|
|
43
|
+
/**
|
|
44
|
+
* Directories to scan
|
|
45
|
+
*/
|
|
46
|
+
dir: string | string[];
|
|
47
|
+
/**
|
|
48
|
+
* what files to include/exclude (glob patterns)
|
|
49
|
+
*
|
|
50
|
+
* Include all files if not specified
|
|
51
|
+
*/
|
|
52
|
+
files?: string[];
|
|
53
|
+
}
|
|
54
|
+
interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
|
|
55
|
+
type: 'meta';
|
|
56
|
+
schema?: CollectionSchema<Schema, {
|
|
57
|
+
path: string;
|
|
58
|
+
source: string;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
|
|
62
|
+
type: 'doc';
|
|
63
|
+
mdxOptions?: ProcessorOptions;
|
|
64
|
+
/**
|
|
65
|
+
* Load files with async
|
|
66
|
+
*/
|
|
67
|
+
async?: Async;
|
|
68
|
+
schema?: CollectionSchema<Schema, {
|
|
69
|
+
path: string;
|
|
70
|
+
source: string;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> {
|
|
74
|
+
type: 'docs';
|
|
75
|
+
dir: string;
|
|
76
|
+
docs: DocCollection<DocSchema, Async>;
|
|
77
|
+
meta: MetaCollection<MetaSchema>;
|
|
78
|
+
}
|
|
79
|
+
type GlobalConfigMDXOptions = ({
|
|
80
|
+
preset?: 'fumadocs';
|
|
81
|
+
} & DefaultMDXOptions) | ({
|
|
82
|
+
preset: 'minimal';
|
|
83
|
+
} & ProcessorOptions);
|
|
84
|
+
interface GlobalConfig {
|
|
85
|
+
/**
|
|
86
|
+
* Configure global MDX options
|
|
87
|
+
*/
|
|
88
|
+
mdxOptions?: GlobalConfigMDXOptions | (() => Promise<GlobalConfigMDXOptions>);
|
|
89
|
+
/**
|
|
90
|
+
* Fetch last modified time with specified version control
|
|
91
|
+
* @defaultValue 'none'
|
|
92
|
+
*/
|
|
93
|
+
lastModifiedTime?: 'git' | 'none';
|
|
94
|
+
}
|
|
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?: {
|
|
98
|
+
/**
|
|
99
|
+
* The directory to scan files
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue 'content/docs'
|
|
102
|
+
*/
|
|
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;
|
|
108
|
+
|
|
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 };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
+
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
4
|
+
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
|
+
import { Pluggable } from 'unified';
|
|
6
|
+
|
|
7
|
+
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
8
|
+
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
9
|
+
rehypePlugins?: ResolvePlugins;
|
|
10
|
+
remarkPlugins?: ResolvePlugins;
|
|
11
|
+
/**
|
|
12
|
+
* Properties to export from `vfile.data`
|
|
13
|
+
*/
|
|
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;
|
|
23
|
+
|
|
24
|
+
declare const metaSchema: z.ZodObject<{
|
|
25
|
+
title: z.ZodOptional<z.ZodString>;
|
|
26
|
+
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
root: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
declare const frontmatterSchema: z.ZodObject<{
|
|
33
|
+
title: z.ZodString;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
35
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
36
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
_openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
|
|
40
|
+
type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
|
|
41
|
+
type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
|
42
|
+
interface BaseCollection {
|
|
43
|
+
/**
|
|
44
|
+
* Directories to scan
|
|
45
|
+
*/
|
|
46
|
+
dir: string | string[];
|
|
47
|
+
/**
|
|
48
|
+
* what files to include/exclude (glob patterns)
|
|
49
|
+
*
|
|
50
|
+
* Include all files if not specified
|
|
51
|
+
*/
|
|
52
|
+
files?: string[];
|
|
53
|
+
}
|
|
54
|
+
interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
|
|
55
|
+
type: 'meta';
|
|
56
|
+
schema?: CollectionSchema<Schema, {
|
|
57
|
+
path: string;
|
|
58
|
+
source: string;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
|
|
62
|
+
type: 'doc';
|
|
63
|
+
mdxOptions?: ProcessorOptions;
|
|
64
|
+
/**
|
|
65
|
+
* Load files with async
|
|
66
|
+
*/
|
|
67
|
+
async?: Async;
|
|
68
|
+
schema?: CollectionSchema<Schema, {
|
|
69
|
+
path: string;
|
|
70
|
+
source: string;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> {
|
|
74
|
+
type: 'docs';
|
|
75
|
+
dir: string;
|
|
76
|
+
docs: DocCollection<DocSchema, Async>;
|
|
77
|
+
meta: MetaCollection<MetaSchema>;
|
|
78
|
+
}
|
|
79
|
+
type GlobalConfigMDXOptions = ({
|
|
80
|
+
preset?: 'fumadocs';
|
|
81
|
+
} & DefaultMDXOptions) | ({
|
|
82
|
+
preset: 'minimal';
|
|
83
|
+
} & ProcessorOptions);
|
|
84
|
+
interface GlobalConfig {
|
|
85
|
+
/**
|
|
86
|
+
* Configure global MDX options
|
|
87
|
+
*/
|
|
88
|
+
mdxOptions?: GlobalConfigMDXOptions | (() => Promise<GlobalConfigMDXOptions>);
|
|
89
|
+
/**
|
|
90
|
+
* Fetch last modified time with specified version control
|
|
91
|
+
* @defaultValue 'none'
|
|
92
|
+
*/
|
|
93
|
+
lastModifiedTime?: 'git' | 'none';
|
|
94
|
+
}
|
|
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?: {
|
|
98
|
+
/**
|
|
99
|
+
* The directory to scan files
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue 'content/docs'
|
|
102
|
+
*/
|
|
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;
|
|
108
|
+
|
|
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 };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
|
|
2
|
-
import { B as BaseCollectionEntry } from './types-
|
|
3
|
-
import
|
|
4
|
-
import '
|
|
2
|
+
import { R as Runtime, B as BaseCollectionEntry } from './types-CnslxmoO.cjs';
|
|
3
|
+
import '@standard-schema/spec';
|
|
4
|
+
import './define-CCrinVBZ.cjs';
|
|
5
|
+
import 'zod';
|
|
5
6
|
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import 'fumadocs-core/server';
|
|
7
7
|
import '@mdx-js/mdx';
|
|
8
8
|
import 'unified';
|
|
9
9
|
import 'react';
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import '@fumadocs/mdx-remote';
|
|
10
|
+
import 'mdx/types';
|
|
11
|
+
import 'fumadocs-core/server';
|
|
13
12
|
|
|
14
13
|
declare const _runtime: Runtime;
|
|
15
14
|
declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
|
|
2
|
-
import { B as BaseCollectionEntry } from './types-
|
|
3
|
-
import
|
|
4
|
-
import '
|
|
2
|
+
import { R as Runtime, B as BaseCollectionEntry } from './types-C0bKwtAx.js';
|
|
3
|
+
import '@standard-schema/spec';
|
|
4
|
+
import './define-CCrinVBZ.js';
|
|
5
|
+
import 'zod';
|
|
5
6
|
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import 'fumadocs-core/server';
|
|
7
7
|
import '@mdx-js/mdx';
|
|
8
8
|
import 'unified';
|
|
9
9
|
import 'react';
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import '@fumadocs/mdx-remote';
|
|
10
|
+
import 'mdx/types';
|
|
11
|
+
import 'fumadocs-core/server';
|
|
13
12
|
|
|
14
13
|
declare const _runtime: Runtime;
|
|
15
14
|
declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
|