fumadocs-mdx 11.3.1 → 11.4.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/{build-mdx-C2hor32E.d.cts → build-mdx-o0kbHSlp.d.cts} +11 -8
- package/dist/{build-mdx-C2hor32E.d.ts → build-mdx-o0kbHSlp.d.ts} +11 -8
- package/dist/chunk-2DJQ3DOD.js +51 -0
- package/dist/{chunk-6LEQ23AC.js → chunk-IOENRFUX.js} +10 -14
- package/dist/{chunk-2ZPSMAUV.js → chunk-IU4D6M3A.js} +7 -49
- package/dist/config/index.cjs +10 -7
- package/dist/config/index.d.cts +6 -126
- package/dist/config/index.d.ts +6 -126
- package/dist/config/index.js +1 -1
- package/dist/define-BB9hRiTI.d.cts +106 -0
- package/dist/define-D3l733EX.d.ts +106 -0
- package/dist/index.cjs +27 -42
- package/dist/index.d.cts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +25 -40
- package/dist/loader-mdx.cjs +63 -47
- package/dist/loader-mdx.js +22 -12
- package/dist/{mdx-options-L5C3NQRY.js → mdx-options-CAU273O3.js} +1 -1
- package/dist/next/index.cjs +124 -76
- package/dist/next/index.js +79 -37
- package/dist/runtime/async.cjs +310 -0
- package/dist/runtime/async.d.cts +35 -0
- package/dist/runtime/async.d.ts +35 -0
- package/dist/runtime/async.js +54 -0
- package/package.json +17 -6
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { AnyZodObject, z } from 'zod';
|
|
2
2
|
import { MDXProps } from 'mdx/types';
|
|
3
|
-
import
|
|
3
|
+
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
4
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
4
5
|
import { TableOfContents } from 'fumadocs-core/server';
|
|
5
6
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
6
7
|
import { Pluggable } from 'unified';
|
|
8
|
+
import { FC } from 'react';
|
|
7
9
|
|
|
8
10
|
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
9
11
|
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
@@ -13,12 +15,13 @@ type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | '
|
|
|
13
15
|
* Properties to export from `vfile.data`
|
|
14
16
|
*/
|
|
15
17
|
valueToExport?: string[];
|
|
16
|
-
remarkStructureOptions?: StructureOptions | false;
|
|
17
|
-
remarkHeadingOptions?: RemarkHeadingOptions;
|
|
18
|
-
remarkImageOptions?: RemarkImageOptions | false;
|
|
19
|
-
|
|
18
|
+
remarkStructureOptions?: plugins.StructureOptions | false;
|
|
19
|
+
remarkHeadingOptions?: plugins.RemarkHeadingOptions;
|
|
20
|
+
remarkImageOptions?: plugins.RemarkImageOptions | false;
|
|
21
|
+
remarkCodeTabOptions?: false;
|
|
22
|
+
rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
|
|
20
23
|
};
|
|
21
|
-
declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
|
|
24
|
+
declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
|
|
22
25
|
|
|
23
26
|
interface GlobalConfig {
|
|
24
27
|
/**
|
|
@@ -49,7 +52,7 @@ interface FileInfo {
|
|
|
49
52
|
absolutePath: string;
|
|
50
53
|
}
|
|
51
54
|
interface MarkdownProps {
|
|
52
|
-
body:
|
|
55
|
+
body: FC<MDXProps>;
|
|
53
56
|
structuredData: StructuredData;
|
|
54
57
|
toc: TableOfContents;
|
|
55
58
|
_exports: Record<string, unknown>;
|
|
@@ -103,4 +106,4 @@ declare module 'vfile' {
|
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
export { type BaseCollectionEntry as B, type CollectionEntry as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type InferSchema as I, type MarkdownProps as M, type
|
|
109
|
+
export { type BaseCollectionEntry as B, type CollectionEntry as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type InferSchema as I, type MarkdownProps as M, type InferSchemaType as a, type GetOutput as b, type MDXOptions as c, getDefaultMDXOptions as g };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { AnyZodObject, z } from 'zod';
|
|
2
2
|
import { MDXProps } from 'mdx/types';
|
|
3
|
-
import
|
|
3
|
+
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
4
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
4
5
|
import { TableOfContents } from 'fumadocs-core/server';
|
|
5
6
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
6
7
|
import { Pluggable } from 'unified';
|
|
8
|
+
import { FC } from 'react';
|
|
7
9
|
|
|
8
10
|
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
9
11
|
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
@@ -13,12 +15,13 @@ type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | '
|
|
|
13
15
|
* Properties to export from `vfile.data`
|
|
14
16
|
*/
|
|
15
17
|
valueToExport?: string[];
|
|
16
|
-
remarkStructureOptions?: StructureOptions | false;
|
|
17
|
-
remarkHeadingOptions?: RemarkHeadingOptions;
|
|
18
|
-
remarkImageOptions?: RemarkImageOptions | false;
|
|
19
|
-
|
|
18
|
+
remarkStructureOptions?: plugins.StructureOptions | false;
|
|
19
|
+
remarkHeadingOptions?: plugins.RemarkHeadingOptions;
|
|
20
|
+
remarkImageOptions?: plugins.RemarkImageOptions | false;
|
|
21
|
+
remarkCodeTabOptions?: false;
|
|
22
|
+
rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
|
|
20
23
|
};
|
|
21
|
-
declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
|
|
24
|
+
declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
|
|
22
25
|
|
|
23
26
|
interface GlobalConfig {
|
|
24
27
|
/**
|
|
@@ -49,7 +52,7 @@ interface FileInfo {
|
|
|
49
52
|
absolutePath: string;
|
|
50
53
|
}
|
|
51
54
|
interface MarkdownProps {
|
|
52
|
-
body:
|
|
55
|
+
body: FC<MDXProps>;
|
|
53
56
|
structuredData: StructuredData;
|
|
54
57
|
toc: TableOfContents;
|
|
55
58
|
_exports: Record<string, unknown>;
|
|
@@ -103,4 +106,4 @@ declare module 'vfile' {
|
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
export { type BaseCollectionEntry as B, type CollectionEntry as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type InferSchema as I, type MarkdownProps as M, type
|
|
109
|
+
export { type BaseCollectionEntry as B, type CollectionEntry as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type InferSchema as I, type MarkdownProps as M, type InferSchemaType as a, type GetOutput as b, type MDXOptions as c, getDefaultMDXOptions as g };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/config/build.ts
|
|
2
|
+
function buildConfig(config) {
|
|
3
|
+
const collections = /* @__PURE__ */ new Map();
|
|
4
|
+
let globalConfig;
|
|
5
|
+
for (const [k, v] of Object.entries(config)) {
|
|
6
|
+
if (!v) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
if (typeof v === "object" && "_doc" in v && v._doc === "collections") {
|
|
10
|
+
collections.set(
|
|
11
|
+
k,
|
|
12
|
+
v
|
|
13
|
+
);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (k === "default") {
|
|
17
|
+
globalConfig = v;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
return [
|
|
21
|
+
`Unknown export "${k}", you can only export collections from source configuration file.`,
|
|
22
|
+
null
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
let cachedMdxOptions;
|
|
26
|
+
return [
|
|
27
|
+
null,
|
|
28
|
+
{
|
|
29
|
+
global: globalConfig,
|
|
30
|
+
collections,
|
|
31
|
+
async getDefaultMDXOptions() {
|
|
32
|
+
if (cachedMdxOptions) return cachedMdxOptions;
|
|
33
|
+
const { getDefaultMDXOptions } = await import("./mdx-options-CAU273O3.js");
|
|
34
|
+
const mdxOptions = globalConfig?.mdxOptions ?? {};
|
|
35
|
+
if (typeof mdxOptions === "function") {
|
|
36
|
+
cachedMdxOptions = getDefaultMDXOptions(await mdxOptions());
|
|
37
|
+
} else {
|
|
38
|
+
cachedMdxOptions = getDefaultMDXOptions(mdxOptions);
|
|
39
|
+
}
|
|
40
|
+
return cachedMdxOptions;
|
|
41
|
+
},
|
|
42
|
+
_runtime: {
|
|
43
|
+
files: /* @__PURE__ */ new Map()
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
buildConfig
|
|
51
|
+
};
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
// src/utils/mdx-options.ts
|
|
2
|
-
import
|
|
3
|
-
rehypeCode,
|
|
4
|
-
rehypeToc,
|
|
5
|
-
remarkGfm,
|
|
6
|
-
remarkHeading,
|
|
7
|
-
remarkImage,
|
|
8
|
-
remarkStructure
|
|
9
|
-
} from "fumadocs-core/mdx-plugins";
|
|
2
|
+
import * as plugins from "fumadocs-core/mdx-plugins";
|
|
10
3
|
|
|
11
4
|
// src/mdx-plugins/remark-exports.ts
|
|
12
5
|
import { valueToEstree } from "estree-util-value-to-estree";
|
|
@@ -68,6 +61,7 @@ function getDefaultMDXOptions({
|
|
|
68
61
|
remarkImageOptions,
|
|
69
62
|
remarkHeadingOptions,
|
|
70
63
|
remarkStructureOptions,
|
|
64
|
+
remarkCodeTabOptions,
|
|
71
65
|
...mdxOptions
|
|
72
66
|
}) {
|
|
73
67
|
const mdxExports = [
|
|
@@ -78,18 +72,20 @@ function getDefaultMDXOptions({
|
|
|
78
72
|
];
|
|
79
73
|
const remarkPlugins = pluginOption(
|
|
80
74
|
(v) => [
|
|
81
|
-
remarkGfm,
|
|
75
|
+
plugins.remarkGfm,
|
|
82
76
|
[
|
|
83
|
-
remarkHeading,
|
|
77
|
+
plugins.remarkHeading,
|
|
84
78
|
{
|
|
85
79
|
generateToc: false,
|
|
86
80
|
...remarkHeadingOptions
|
|
87
81
|
}
|
|
88
82
|
],
|
|
89
|
-
remarkImageOptions !== false && [remarkImage, remarkImageOptions],
|
|
83
|
+
remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
|
|
84
|
+
// Fumadocs 14 compatibility
|
|
85
|
+
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && plugins.remarkCodeTab,
|
|
90
86
|
...v,
|
|
91
87
|
remarkStructureOptions !== false && [
|
|
92
|
-
remarkStructure,
|
|
88
|
+
plugins.remarkStructure,
|
|
93
89
|
remarkStructureOptions
|
|
94
90
|
],
|
|
95
91
|
[remarkMdxExport, { values: mdxExports }]
|
|
@@ -98,9 +94,9 @@ function getDefaultMDXOptions({
|
|
|
98
94
|
);
|
|
99
95
|
const rehypePlugins = pluginOption(
|
|
100
96
|
(v) => [
|
|
101
|
-
rehypeCodeOptions !== false && [rehypeCode, rehypeCodeOptions],
|
|
97
|
+
rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
|
|
102
98
|
...v,
|
|
103
|
-
[rehypeToc]
|
|
99
|
+
[plugins.rehypeToc]
|
|
104
100
|
],
|
|
105
101
|
mdxOptions.rehypePlugins
|
|
106
102
|
);
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
buildConfig
|
|
3
|
+
} from "./chunk-2DJQ3DOD.js";
|
|
4
|
+
|
|
5
|
+
// src/utils/config-cache.ts
|
|
2
6
|
import { createHash } from "node:crypto";
|
|
3
7
|
import * as fs from "node:fs";
|
|
4
8
|
|
|
5
|
-
// src/
|
|
9
|
+
// src/utils/load-config.ts
|
|
6
10
|
import * as path from "node:path";
|
|
7
11
|
import { pathToFileURL } from "node:url";
|
|
8
12
|
function findConfigFile() {
|
|
@@ -36,54 +40,8 @@ async function loadConfig(configPath) {
|
|
|
36
40
|
if (err !== null) throw new Error(err);
|
|
37
41
|
return config;
|
|
38
42
|
}
|
|
39
|
-
function buildConfig(config) {
|
|
40
|
-
const collections = /* @__PURE__ */ new Map();
|
|
41
|
-
let globalConfig;
|
|
42
|
-
for (const [k, v] of Object.entries(config)) {
|
|
43
|
-
if (!v) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
if (typeof v === "object" && "_doc" in v && v._doc === "collections") {
|
|
47
|
-
collections.set(
|
|
48
|
-
k,
|
|
49
|
-
v
|
|
50
|
-
);
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (k === "default") {
|
|
54
|
-
globalConfig = v;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
return [
|
|
58
|
-
`Unknown export "${k}", you can only export collections from source configuration file.`,
|
|
59
|
-
null
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
let cachedMdxOptions;
|
|
63
|
-
return [
|
|
64
|
-
null,
|
|
65
|
-
{
|
|
66
|
-
global: globalConfig,
|
|
67
|
-
collections,
|
|
68
|
-
async getDefaultMDXOptions() {
|
|
69
|
-
if (cachedMdxOptions) return cachedMdxOptions;
|
|
70
|
-
const { getDefaultMDXOptions } = await import("./mdx-options-L5C3NQRY.js");
|
|
71
|
-
const mdxOptions = globalConfig?.mdxOptions ?? {};
|
|
72
|
-
if (typeof mdxOptions === "function") {
|
|
73
|
-
cachedMdxOptions = getDefaultMDXOptions(await mdxOptions());
|
|
74
|
-
} else {
|
|
75
|
-
cachedMdxOptions = getDefaultMDXOptions(mdxOptions);
|
|
76
|
-
}
|
|
77
|
-
return cachedMdxOptions;
|
|
78
|
-
},
|
|
79
|
-
_runtime: {
|
|
80
|
-
files: /* @__PURE__ */ new Map()
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
43
|
|
|
86
|
-
// src/config
|
|
44
|
+
// src/utils/config-cache.ts
|
|
87
45
|
var cache = /* @__PURE__ */ new Map();
|
|
88
46
|
async function loadConfigCached(configPath, hash) {
|
|
89
47
|
const cached = cache.get(configPath);
|
package/dist/config/index.cjs
CHANGED
|
@@ -90,7 +90,7 @@ function defineConfig(config = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// src/utils/mdx-options.ts
|
|
93
|
-
var
|
|
93
|
+
var plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
|
|
94
94
|
|
|
95
95
|
// src/mdx-plugins/remark-exports.ts
|
|
96
96
|
var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
|
|
@@ -152,6 +152,7 @@ function getDefaultMDXOptions({
|
|
|
152
152
|
remarkImageOptions,
|
|
153
153
|
remarkHeadingOptions,
|
|
154
154
|
remarkStructureOptions,
|
|
155
|
+
remarkCodeTabOptions,
|
|
155
156
|
...mdxOptions
|
|
156
157
|
}) {
|
|
157
158
|
const mdxExports = [
|
|
@@ -162,18 +163,20 @@ function getDefaultMDXOptions({
|
|
|
162
163
|
];
|
|
163
164
|
const remarkPlugins = pluginOption(
|
|
164
165
|
(v) => [
|
|
165
|
-
|
|
166
|
+
plugins.remarkGfm,
|
|
166
167
|
[
|
|
167
|
-
|
|
168
|
+
plugins.remarkHeading,
|
|
168
169
|
{
|
|
169
170
|
generateToc: false,
|
|
170
171
|
...remarkHeadingOptions
|
|
171
172
|
}
|
|
172
173
|
],
|
|
173
|
-
remarkImageOptions !== false && [
|
|
174
|
+
remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
|
|
175
|
+
// Fumadocs 14 compatibility
|
|
176
|
+
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && plugins.remarkCodeTab,
|
|
174
177
|
...v,
|
|
175
178
|
remarkStructureOptions !== false && [
|
|
176
|
-
|
|
179
|
+
plugins.remarkStructure,
|
|
177
180
|
remarkStructureOptions
|
|
178
181
|
],
|
|
179
182
|
[remarkMdxExport, { values: mdxExports }]
|
|
@@ -182,9 +185,9 @@ function getDefaultMDXOptions({
|
|
|
182
185
|
);
|
|
183
186
|
const rehypePlugins = pluginOption(
|
|
184
187
|
(v) => [
|
|
185
|
-
rehypeCodeOptions !== false && [
|
|
188
|
+
rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
|
|
186
189
|
...v,
|
|
187
|
-
[
|
|
190
|
+
[plugins.rehypeToc]
|
|
188
191
|
],
|
|
189
192
|
mdxOptions.rehypePlugins
|
|
190
193
|
);
|
package/dist/config/index.d.cts
CHANGED
|
@@ -1,134 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import { z, ZodTypeAny } from 'zod';
|
|
4
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
1
|
+
export { B as BaseCollectionEntry, C as CollectionEntry, D as DefaultMDXOptions, F as FileInfo, b as GetOutput, G as GlobalConfig, I as InferSchema, a as InferSchemaType, M as MarkdownProps, g as getDefaultMDXOptions } from '../build-mdx-o0kbHSlp.cjs';
|
|
2
|
+
export { B as BaseCollection, D as DocCollection, M as MetaCollection, T as TransformContext, d as defineCollections, b as defineConfig, a as defineDocs, f as frontmatterSchema, m as metaSchema } from '../define-BB9hRiTI.cjs';
|
|
5
3
|
import { Processor, Transformer } from 'unified';
|
|
6
4
|
import { Root } from 'mdast';
|
|
5
|
+
import 'zod';
|
|
7
6
|
import 'mdx/types';
|
|
8
7
|
import 'fumadocs-core/mdx-plugins';
|
|
9
8
|
import 'fumadocs-core/server';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
title: z.ZodOptional<z.ZodString>;
|
|
13
|
-
pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
-
description: z.ZodOptional<z.ZodString>;
|
|
15
|
-
root: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
-
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
root?: boolean | undefined;
|
|
20
|
-
title?: string | undefined;
|
|
21
|
-
icon?: string | undefined;
|
|
22
|
-
pages?: string[] | undefined;
|
|
23
|
-
description?: string | undefined;
|
|
24
|
-
defaultOpen?: boolean | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
root?: boolean | undefined;
|
|
27
|
-
title?: string | undefined;
|
|
28
|
-
icon?: string | undefined;
|
|
29
|
-
pages?: string[] | undefined;
|
|
30
|
-
description?: string | undefined;
|
|
31
|
-
defaultOpen?: boolean | undefined;
|
|
32
|
-
}>;
|
|
33
|
-
declare const frontmatterSchema: z.ZodObject<{
|
|
34
|
-
title: z.ZodString;
|
|
35
|
-
description: z.ZodOptional<z.ZodString>;
|
|
36
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
37
|
-
full: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
-
_openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
title: string;
|
|
41
|
-
icon?: string | undefined;
|
|
42
|
-
description?: string | undefined;
|
|
43
|
-
full?: boolean | undefined;
|
|
44
|
-
_openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
title: string;
|
|
47
|
-
icon?: string | undefined;
|
|
48
|
-
description?: string | undefined;
|
|
49
|
-
full?: boolean | undefined;
|
|
50
|
-
_openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
|
|
53
|
-
interface TransformContext {
|
|
54
|
-
path: string;
|
|
55
|
-
source: string;
|
|
56
|
-
/**
|
|
57
|
-
* Compile MDX to JavaScript
|
|
58
|
-
*/
|
|
59
|
-
buildMDX: (source: string, options?: ProcessorOptions) => Promise<string>;
|
|
60
|
-
}
|
|
61
|
-
interface BaseCollection<Schema> {
|
|
62
|
-
/**
|
|
63
|
-
* Directories to scan
|
|
64
|
-
*/
|
|
65
|
-
dir: string | string[];
|
|
66
|
-
/**
|
|
67
|
-
* what files to include/exclude (glob patterns)
|
|
68
|
-
*
|
|
69
|
-
* Include all files if not specified
|
|
70
|
-
*/
|
|
71
|
-
files?: string[];
|
|
72
|
-
schema?: Schema | ((ctx: TransformContext) => Schema);
|
|
73
|
-
}
|
|
74
|
-
interface MetaCollection<Schema extends ZodTypeAny = ZodTypeAny, TransformOutput = unknown> extends BaseCollection<Schema> {
|
|
75
|
-
type: 'meta';
|
|
76
|
-
/**
|
|
77
|
-
* Do transformation in runtime.
|
|
78
|
-
*
|
|
79
|
-
* This cannot be optimized by bundlers/loaders, avoid expensive calculations here.
|
|
80
|
-
*/
|
|
81
|
-
transform?: (entry: {
|
|
82
|
-
data: z.output<Schema>;
|
|
83
|
-
file: FileInfo;
|
|
84
|
-
}, globalConfig?: GlobalConfig) => TransformOutput | Promise<TransformOutput>;
|
|
85
|
-
}
|
|
86
|
-
interface DocCollection<Schema extends ZodTypeAny = ZodTypeAny, Async extends boolean = boolean, TransformOutput = unknown> extends BaseCollection<Schema> {
|
|
87
|
-
type: 'doc';
|
|
88
|
-
/**
|
|
89
|
-
* Do transformation in runtime.
|
|
90
|
-
*
|
|
91
|
-
* This cannot be optimized by bundlers/loaders, avoid expensive calculations here.
|
|
92
|
-
*/
|
|
93
|
-
transform?: (entry: {
|
|
94
|
-
data: z.output<Schema>;
|
|
95
|
-
file: FileInfo;
|
|
96
|
-
mdx: Async extends true ? MarkdownProps : never;
|
|
97
|
-
}, globalConfig?: GlobalConfig) => TransformOutput | Promise<TransformOutput>;
|
|
98
|
-
mdxOptions?: MDXOptions;
|
|
99
|
-
/**
|
|
100
|
-
* Load files with async
|
|
101
|
-
*/
|
|
102
|
-
async?: Async;
|
|
103
|
-
}
|
|
104
|
-
declare function defineCollections<T extends 'doc' | 'meta', Schema extends ZodTypeAny = ZodTypeAny, Async extends boolean = false, TransformOutput = unknown>(options: {
|
|
105
|
-
type: T;
|
|
106
|
-
} & (T extends 'doc' ? DocCollection<Schema, Async, TransformOutput> : MetaCollection<Schema, TransformOutput>)): {
|
|
107
|
-
_doc: 'collections';
|
|
108
|
-
type: T;
|
|
109
|
-
_type: {
|
|
110
|
-
async: Async;
|
|
111
|
-
transform: TransformOutput;
|
|
112
|
-
runtime: T extends 'doc' ? Async extends true ? z.infer<Schema> & BaseCollectionEntry & {
|
|
113
|
-
load: () => Promise<MarkdownProps>;
|
|
114
|
-
} : Omit<MarkdownProps, keyof z.infer<Schema>> & z.infer<Schema> & BaseCollectionEntry : typeof options extends MetaCollection ? z.infer<Schema> & BaseCollectionEntry : never;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
declare function defineDocs<DocData extends ZodTypeAny = typeof frontmatterSchema, MetaData extends ZodTypeAny = typeof metaSchema, DocAsync extends boolean = false, DocOut = unknown, MetaOut = unknown>(options?: {
|
|
118
|
-
/**
|
|
119
|
-
* The directory to scan files
|
|
120
|
-
*
|
|
121
|
-
* @defaultValue 'content/docs'
|
|
122
|
-
*/
|
|
123
|
-
dir?: string | string[];
|
|
124
|
-
docs?: Partial<DocCollection<DocData, DocAsync, DocOut>>;
|
|
125
|
-
meta?: Partial<MetaCollection<MetaData, MetaOut>>;
|
|
126
|
-
}): {
|
|
127
|
-
docs: ReturnType<typeof defineCollections<'doc', DocData, DocAsync, DocOut>>;
|
|
128
|
-
meta: ReturnType<typeof defineCollections<'meta', MetaData, false, MetaOut>>;
|
|
129
|
-
};
|
|
130
|
-
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
9
|
+
import '@mdx-js/mdx';
|
|
10
|
+
import 'react';
|
|
131
11
|
|
|
132
12
|
declare function remarkInclude(this: Processor): Transformer<Root, Root>;
|
|
133
13
|
|
|
134
|
-
export {
|
|
14
|
+
export { remarkInclude };
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,134 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import { z, ZodTypeAny } from 'zod';
|
|
4
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
1
|
+
export { B as BaseCollectionEntry, C as CollectionEntry, D as DefaultMDXOptions, F as FileInfo, b as GetOutput, G as GlobalConfig, I as InferSchema, a as InferSchemaType, M as MarkdownProps, g as getDefaultMDXOptions } from '../build-mdx-o0kbHSlp.js';
|
|
2
|
+
export { B as BaseCollection, D as DocCollection, M as MetaCollection, T as TransformContext, d as defineCollections, b as defineConfig, a as defineDocs, f as frontmatterSchema, m as metaSchema } from '../define-D3l733EX.js';
|
|
5
3
|
import { Processor, Transformer } from 'unified';
|
|
6
4
|
import { Root } from 'mdast';
|
|
5
|
+
import 'zod';
|
|
7
6
|
import 'mdx/types';
|
|
8
7
|
import 'fumadocs-core/mdx-plugins';
|
|
9
8
|
import 'fumadocs-core/server';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
title: z.ZodOptional<z.ZodString>;
|
|
13
|
-
pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
-
description: z.ZodOptional<z.ZodString>;
|
|
15
|
-
root: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
-
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
root?: boolean | undefined;
|
|
20
|
-
title?: string | undefined;
|
|
21
|
-
icon?: string | undefined;
|
|
22
|
-
pages?: string[] | undefined;
|
|
23
|
-
description?: string | undefined;
|
|
24
|
-
defaultOpen?: boolean | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
root?: boolean | undefined;
|
|
27
|
-
title?: string | undefined;
|
|
28
|
-
icon?: string | undefined;
|
|
29
|
-
pages?: string[] | undefined;
|
|
30
|
-
description?: string | undefined;
|
|
31
|
-
defaultOpen?: boolean | undefined;
|
|
32
|
-
}>;
|
|
33
|
-
declare const frontmatterSchema: z.ZodObject<{
|
|
34
|
-
title: z.ZodString;
|
|
35
|
-
description: z.ZodOptional<z.ZodString>;
|
|
36
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
37
|
-
full: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
-
_openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
title: string;
|
|
41
|
-
icon?: string | undefined;
|
|
42
|
-
description?: string | undefined;
|
|
43
|
-
full?: boolean | undefined;
|
|
44
|
-
_openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
title: string;
|
|
47
|
-
icon?: string | undefined;
|
|
48
|
-
description?: string | undefined;
|
|
49
|
-
full?: boolean | undefined;
|
|
50
|
-
_openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
|
|
53
|
-
interface TransformContext {
|
|
54
|
-
path: string;
|
|
55
|
-
source: string;
|
|
56
|
-
/**
|
|
57
|
-
* Compile MDX to JavaScript
|
|
58
|
-
*/
|
|
59
|
-
buildMDX: (source: string, options?: ProcessorOptions) => Promise<string>;
|
|
60
|
-
}
|
|
61
|
-
interface BaseCollection<Schema> {
|
|
62
|
-
/**
|
|
63
|
-
* Directories to scan
|
|
64
|
-
*/
|
|
65
|
-
dir: string | string[];
|
|
66
|
-
/**
|
|
67
|
-
* what files to include/exclude (glob patterns)
|
|
68
|
-
*
|
|
69
|
-
* Include all files if not specified
|
|
70
|
-
*/
|
|
71
|
-
files?: string[];
|
|
72
|
-
schema?: Schema | ((ctx: TransformContext) => Schema);
|
|
73
|
-
}
|
|
74
|
-
interface MetaCollection<Schema extends ZodTypeAny = ZodTypeAny, TransformOutput = unknown> extends BaseCollection<Schema> {
|
|
75
|
-
type: 'meta';
|
|
76
|
-
/**
|
|
77
|
-
* Do transformation in runtime.
|
|
78
|
-
*
|
|
79
|
-
* This cannot be optimized by bundlers/loaders, avoid expensive calculations here.
|
|
80
|
-
*/
|
|
81
|
-
transform?: (entry: {
|
|
82
|
-
data: z.output<Schema>;
|
|
83
|
-
file: FileInfo;
|
|
84
|
-
}, globalConfig?: GlobalConfig) => TransformOutput | Promise<TransformOutput>;
|
|
85
|
-
}
|
|
86
|
-
interface DocCollection<Schema extends ZodTypeAny = ZodTypeAny, Async extends boolean = boolean, TransformOutput = unknown> extends BaseCollection<Schema> {
|
|
87
|
-
type: 'doc';
|
|
88
|
-
/**
|
|
89
|
-
* Do transformation in runtime.
|
|
90
|
-
*
|
|
91
|
-
* This cannot be optimized by bundlers/loaders, avoid expensive calculations here.
|
|
92
|
-
*/
|
|
93
|
-
transform?: (entry: {
|
|
94
|
-
data: z.output<Schema>;
|
|
95
|
-
file: FileInfo;
|
|
96
|
-
mdx: Async extends true ? MarkdownProps : never;
|
|
97
|
-
}, globalConfig?: GlobalConfig) => TransformOutput | Promise<TransformOutput>;
|
|
98
|
-
mdxOptions?: MDXOptions;
|
|
99
|
-
/**
|
|
100
|
-
* Load files with async
|
|
101
|
-
*/
|
|
102
|
-
async?: Async;
|
|
103
|
-
}
|
|
104
|
-
declare function defineCollections<T extends 'doc' | 'meta', Schema extends ZodTypeAny = ZodTypeAny, Async extends boolean = false, TransformOutput = unknown>(options: {
|
|
105
|
-
type: T;
|
|
106
|
-
} & (T extends 'doc' ? DocCollection<Schema, Async, TransformOutput> : MetaCollection<Schema, TransformOutput>)): {
|
|
107
|
-
_doc: 'collections';
|
|
108
|
-
type: T;
|
|
109
|
-
_type: {
|
|
110
|
-
async: Async;
|
|
111
|
-
transform: TransformOutput;
|
|
112
|
-
runtime: T extends 'doc' ? Async extends true ? z.infer<Schema> & BaseCollectionEntry & {
|
|
113
|
-
load: () => Promise<MarkdownProps>;
|
|
114
|
-
} : Omit<MarkdownProps, keyof z.infer<Schema>> & z.infer<Schema> & BaseCollectionEntry : typeof options extends MetaCollection ? z.infer<Schema> & BaseCollectionEntry : never;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
declare function defineDocs<DocData extends ZodTypeAny = typeof frontmatterSchema, MetaData extends ZodTypeAny = typeof metaSchema, DocAsync extends boolean = false, DocOut = unknown, MetaOut = unknown>(options?: {
|
|
118
|
-
/**
|
|
119
|
-
* The directory to scan files
|
|
120
|
-
*
|
|
121
|
-
* @defaultValue 'content/docs'
|
|
122
|
-
*/
|
|
123
|
-
dir?: string | string[];
|
|
124
|
-
docs?: Partial<DocCollection<DocData, DocAsync, DocOut>>;
|
|
125
|
-
meta?: Partial<MetaCollection<MetaData, MetaOut>>;
|
|
126
|
-
}): {
|
|
127
|
-
docs: ReturnType<typeof defineCollections<'doc', DocData, DocAsync, DocOut>>;
|
|
128
|
-
meta: ReturnType<typeof defineCollections<'meta', MetaData, false, MetaOut>>;
|
|
129
|
-
};
|
|
130
|
-
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
9
|
+
import '@mdx-js/mdx';
|
|
10
|
+
import 'react';
|
|
131
11
|
|
|
132
12
|
declare function remarkInclude(this: Processor): Transformer<Root, Root>;
|
|
133
13
|
|
|
134
|
-
export {
|
|
14
|
+
export { remarkInclude };
|