fumadocs-mdx 13.0.8 → 14.0.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/bin.cjs +985 -893
- package/dist/bin.js +3 -3
- package/dist/build-mdx-6UAK5FF5.js +8 -0
- package/dist/bun/index.cjs +613 -471
- package/dist/bun/index.d.cts +9 -2
- package/dist/bun/index.d.ts +9 -2
- package/dist/bun/index.js +15 -14
- package/dist/chunk-4JSFLXXT.js +8 -0
- package/dist/chunk-5OBUOALK.js +141 -0
- package/dist/{chunk-2E2JCOSO.js → chunk-6NISOLQ6.js} +16 -44
- package/dist/chunk-7UKSZSPY.js +331 -0
- package/dist/chunk-BEBCWQC7.js +224 -0
- package/dist/chunk-E5DJTSIM.js +86 -0
- package/dist/{chunk-K5ZLPEIQ.js → chunk-FBLMK4RS.js} +9 -6
- package/dist/chunk-IQGEFL2B.js +17 -0
- package/dist/{chunk-5FTSWCB4.js → chunk-K6HCOGOX.js} +9 -11
- package/dist/{chunk-QXHN25N3.js → chunk-MTTISKQJ.js} +6 -6
- package/dist/{chunk-3J3WL7WN.js → chunk-SLY7WXTX.js} +71 -58
- package/dist/chunk-TYJDYTKH.js +85 -0
- package/dist/chunk-WBIHDYMN.js +126 -0
- package/dist/{chunk-2HXTGJBI.js → chunk-ZY6UZ7NH.js} +22 -19
- package/dist/config/index.cjs +79 -71
- package/dist/config/index.d.cts +7 -1
- package/dist/config/index.d.ts +7 -1
- package/dist/config/index.js +5 -5
- package/dist/core-B9ZoS6sA.d.ts +341 -0
- package/dist/core-DTuP23zu.d.cts +341 -0
- package/dist/index-BD8Woo4m.d.cts +8 -0
- package/dist/index-CNOvhtOn.d.ts +8 -0
- package/dist/index.d.cts +38 -56
- package/dist/index.d.ts +38 -56
- package/dist/load-from-file-5HUQN36V.js +8 -0
- package/dist/next/index.cjs +763 -473
- package/dist/next/index.d.cts +16 -1
- package/dist/next/index.d.ts +16 -1
- package/dist/next/index.js +80 -281
- package/dist/node/loader.cjs +764 -627
- package/dist/node/loader.js +10 -11
- package/dist/plugins/index-file.cjs +495 -0
- package/dist/plugins/index-file.d.cts +14 -0
- package/dist/plugins/index-file.d.ts +14 -0
- package/dist/plugins/index-file.js +8 -0
- package/dist/plugins/json-schema.d.cts +9 -2
- package/dist/plugins/json-schema.d.ts +9 -2
- package/dist/plugins/last-modified.cjs +110 -0
- package/dist/plugins/last-modified.d.cts +37 -0
- package/dist/plugins/last-modified.d.ts +37 -0
- package/dist/plugins/last-modified.js +74 -0
- package/dist/runtime/browser.cjs +93 -0
- package/dist/runtime/browser.d.cts +53 -0
- package/dist/runtime/browser.d.ts +53 -0
- package/dist/runtime/browser.js +67 -0
- package/dist/runtime/dynamic.cjs +1023 -0
- package/dist/runtime/dynamic.d.cts +27 -0
- package/dist/runtime/dynamic.d.ts +27 -0
- package/dist/runtime/dynamic.js +79 -0
- package/dist/runtime/server.cjs +176 -0
- package/dist/runtime/server.d.cts +14 -0
- package/dist/runtime/server.d.ts +14 -0
- package/dist/runtime/server.js +8 -0
- package/dist/runtime/types.cjs +18 -0
- package/dist/runtime/types.d.cts +61 -0
- package/dist/runtime/types.d.ts +61 -0
- package/dist/runtime/types.js +0 -0
- package/dist/vite/index.cjs +984 -621
- package/dist/vite/index.d.cts +17 -22
- package/dist/vite/index.d.ts +17 -22
- package/dist/vite/index.js +32 -222
- package/dist/webpack/mdx.cjs +647 -514
- package/dist/webpack/mdx.d.cts +15 -1
- package/dist/webpack/mdx.d.ts +15 -1
- package/dist/webpack/mdx.js +12 -17
- package/dist/webpack/meta.cjs +360 -231
- package/dist/webpack/meta.d.cts +15 -1
- package/dist/webpack/meta.d.ts +15 -1
- package/dist/webpack/meta.js +13 -15
- package/package.json +15 -32
- package/dist/build-mdx-BjXOmv0b.d.cts +0 -53
- package/dist/build-mdx-CY5UldCO.d.ts +0 -53
- package/dist/chunk-2AQRQXSO.js +0 -119
- package/dist/chunk-CXA4JO4Z.js +0 -45
- package/dist/chunk-DMJ6I4C3.js +0 -76
- package/dist/chunk-FSZMKRVH.js +0 -80
- package/dist/chunk-II3H5ZVZ.js +0 -77
- package/dist/chunk-KILFIBVW.js +0 -75
- package/dist/chunk-NVRDCY6Z.js +0 -30
- package/dist/chunk-VUEZTR2H.js +0 -26
- package/dist/core-DB7TdlyC.d.cts +0 -234
- package/dist/core-DB7TdlyC.d.ts +0 -234
- package/dist/index-D7s7kCc2.d.cts +0 -7
- package/dist/index-D7s7kCc2.d.ts +0 -7
- package/dist/load-from-file-AVYOFOI7.js +0 -7
- package/dist/preset-ZMP6U62C.js +0 -6
- package/dist/runtime/next/async.cjs +0 -760
- package/dist/runtime/next/async.d.cts +0 -19
- package/dist/runtime/next/async.d.ts +0 -19
- package/dist/runtime/next/async.js +0 -86
- package/dist/runtime/next/index.cjs +0 -136
- package/dist/runtime/next/index.d.cts +0 -33
- package/dist/runtime/next/index.d.ts +0 -33
- package/dist/runtime/next/index.js +0 -11
- package/dist/runtime/vite/browser.cjs +0 -107
- package/dist/runtime/vite/browser.d.cts +0 -59
- package/dist/runtime/vite/browser.d.ts +0 -59
- package/dist/runtime/vite/browser.js +0 -11
- package/dist/runtime/vite/server.cjs +0 -243
- package/dist/runtime/vite/server.d.cts +0 -30
- package/dist/runtime/vite/server.d.ts +0 -30
- package/dist/runtime/vite/server.js +0 -111
- package/dist/types-Bnh9n7mj.d.cts +0 -45
- package/dist/types-ey1AZqrg.d.ts +0 -45
package/dist/chunk-KILFIBVW.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createDocMethods
|
|
3
|
-
} from "./chunk-NVRDCY6Z.js";
|
|
4
|
-
|
|
5
|
-
// src/runtime/next/index.ts
|
|
6
|
-
var _runtime = {
|
|
7
|
-
doc(files) {
|
|
8
|
-
return files.map((file) => {
|
|
9
|
-
const data = file.data;
|
|
10
|
-
return {
|
|
11
|
-
_exports: data,
|
|
12
|
-
body: data.default,
|
|
13
|
-
lastModified: data.lastModified,
|
|
14
|
-
toc: data.toc,
|
|
15
|
-
structuredData: data.structuredData,
|
|
16
|
-
extractedReferences: data.extractedReferences,
|
|
17
|
-
...data.frontmatter,
|
|
18
|
-
...createDocMethods(file.info, () => Promise.resolve(data))
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
meta(files) {
|
|
23
|
-
return files.map((file) => {
|
|
24
|
-
return {
|
|
25
|
-
info: file.info,
|
|
26
|
-
...file.data
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
docs(docs, metas) {
|
|
31
|
-
const parsedDocs = this.doc(docs);
|
|
32
|
-
const parsedMetas = this.meta(metas);
|
|
33
|
-
return {
|
|
34
|
-
docs: parsedDocs,
|
|
35
|
-
meta: parsedMetas,
|
|
36
|
-
toFumadocsSource() {
|
|
37
|
-
return createMDXSource(parsedDocs, parsedMetas);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
function createMDXSource(docs, meta = []) {
|
|
43
|
-
return {
|
|
44
|
-
files: resolveFiles({
|
|
45
|
-
docs,
|
|
46
|
-
meta
|
|
47
|
-
})
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function resolveFiles({ docs, meta }) {
|
|
51
|
-
const outputs = [];
|
|
52
|
-
for (const entry of docs) {
|
|
53
|
-
outputs.push({
|
|
54
|
-
type: "page",
|
|
55
|
-
absolutePath: entry.info.fullPath,
|
|
56
|
-
path: entry.info.path,
|
|
57
|
-
data: entry
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
for (const entry of meta) {
|
|
61
|
-
outputs.push({
|
|
62
|
-
type: "meta",
|
|
63
|
-
absolutePath: entry.info.fullPath,
|
|
64
|
-
path: entry.info.path,
|
|
65
|
-
data: entry
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return outputs;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export {
|
|
72
|
-
_runtime,
|
|
73
|
-
createMDXSource,
|
|
74
|
-
resolveFiles
|
|
75
|
-
};
|
package/dist/chunk-NVRDCY6Z.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// src/runtime/shared.ts
|
|
2
|
-
import fs from "fs/promises";
|
|
3
|
-
function createDocMethods(info, load) {
|
|
4
|
-
return {
|
|
5
|
-
info,
|
|
6
|
-
async getText(type) {
|
|
7
|
-
if (type === "raw") {
|
|
8
|
-
return (await fs.readFile(info.fullPath)).toString();
|
|
9
|
-
}
|
|
10
|
-
const data = await load();
|
|
11
|
-
if (typeof data._markdown !== "string")
|
|
12
|
-
throw new Error(
|
|
13
|
-
"getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
|
|
14
|
-
);
|
|
15
|
-
return data._markdown;
|
|
16
|
-
},
|
|
17
|
-
async getMDAST() {
|
|
18
|
-
const data = await load();
|
|
19
|
-
if (!data._mdast)
|
|
20
|
-
throw new Error(
|
|
21
|
-
"getMDAST() requires `includeMDAST` to be enabled in your collection config."
|
|
22
|
-
);
|
|
23
|
-
return JSON.parse(data._mdast);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
createDocMethods
|
|
30
|
-
};
|
package/dist/chunk-VUEZTR2H.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/utils/git-timestamp.ts
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { x } from "tinyexec";
|
|
4
|
-
var cache = /* @__PURE__ */ new Map();
|
|
5
|
-
async function getGitTimestamp(file) {
|
|
6
|
-
const cached = cache.get(file);
|
|
7
|
-
if (cached) return cached;
|
|
8
|
-
try {
|
|
9
|
-
const out = await x(
|
|
10
|
-
"git",
|
|
11
|
-
["log", "-1", '--pretty="%ai"', path.relative(process.cwd(), file)],
|
|
12
|
-
{
|
|
13
|
-
throwOnError: true
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
const time = new Date(out.stdout);
|
|
17
|
-
cache.set(file, time);
|
|
18
|
-
return time;
|
|
19
|
-
} catch {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
getGitTimestamp
|
|
26
|
-
};
|
package/dist/core-DB7TdlyC.d.cts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
2
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
-
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
4
|
-
import { Pluggable } from 'unified';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { FSWatcher } from 'chokidar';
|
|
7
|
-
|
|
8
|
-
interface ExtractedReference {
|
|
9
|
-
href: string;
|
|
10
|
-
}
|
|
11
|
-
interface PostprocessOptions {
|
|
12
|
-
_format: 'md' | 'mdx';
|
|
13
|
-
/**
|
|
14
|
-
* Properties to export from `vfile.data`
|
|
15
|
-
*/
|
|
16
|
-
valueToExport?: string[];
|
|
17
|
-
/**
|
|
18
|
-
* stringify MDAST and export via `_markdown`.
|
|
19
|
-
*/
|
|
20
|
-
includeProcessedMarkdown?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* store MDAST and export via `_mdast`.
|
|
23
|
-
*/
|
|
24
|
-
includeMDAST?: boolean | {
|
|
25
|
-
removePosition?: boolean;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
30
|
-
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
31
|
-
rehypePlugins?: ResolvePlugins;
|
|
32
|
-
remarkPlugins?: ResolvePlugins;
|
|
33
|
-
/**
|
|
34
|
-
* Properties to export from `vfile.data`
|
|
35
|
-
*/
|
|
36
|
-
valueToExport?: string[];
|
|
37
|
-
remarkStructureOptions?: plugins.StructureOptions | false;
|
|
38
|
-
remarkHeadingOptions?: plugins.RemarkHeadingOptions;
|
|
39
|
-
remarkImageOptions?: plugins.RemarkImageOptions | false;
|
|
40
|
-
remarkCodeTabOptions?: plugins.RemarkCodeTabOptions | false;
|
|
41
|
-
remarkNpmOptions?: plugins.RemarkNpmOptions | false;
|
|
42
|
-
rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
|
|
43
|
-
_withoutBundler?: boolean;
|
|
44
|
-
};
|
|
45
|
-
declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, remarkNpmOptions, _withoutBundler, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Zod 4 schema
|
|
49
|
-
*/
|
|
50
|
-
declare const metaSchema: z.ZodObject<{
|
|
51
|
-
title: z.ZodOptional<z.ZodString>;
|
|
52
|
-
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
-
description: z.ZodOptional<z.ZodString>;
|
|
54
|
-
root: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
-
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
57
|
-
}, z.core.$strip>;
|
|
58
|
-
/**
|
|
59
|
-
* Zod 4 schema
|
|
60
|
-
*/
|
|
61
|
-
declare const frontmatterSchema: z.ZodObject<{
|
|
62
|
-
title: z.ZodString;
|
|
63
|
-
description: z.ZodOptional<z.ZodString>;
|
|
64
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
65
|
-
full: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
-
_openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
67
|
-
}, z.core.$strip>;
|
|
68
|
-
|
|
69
|
-
type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
|
|
70
|
-
type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
|
71
|
-
interface BaseCollection {
|
|
72
|
-
/**
|
|
73
|
-
* Directories to scan
|
|
74
|
-
*/
|
|
75
|
-
dir: string | string[];
|
|
76
|
-
/**
|
|
77
|
-
* what files to include/exclude (glob patterns)
|
|
78
|
-
*
|
|
79
|
-
* Include all files if not specified
|
|
80
|
-
*/
|
|
81
|
-
files?: string[];
|
|
82
|
-
}
|
|
83
|
-
interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
|
|
84
|
-
type: 'meta';
|
|
85
|
-
schema?: CollectionSchema<Schema, {
|
|
86
|
-
path: string;
|
|
87
|
-
source: string;
|
|
88
|
-
}>;
|
|
89
|
-
}
|
|
90
|
-
interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
|
|
91
|
-
type: 'doc';
|
|
92
|
-
postprocess?: Partial<PostprocessOptions>;
|
|
93
|
-
mdxOptions?: ProcessorOptions;
|
|
94
|
-
/**
|
|
95
|
-
* Load files with async
|
|
96
|
-
*/
|
|
97
|
-
async?: Async;
|
|
98
|
-
schema?: CollectionSchema<Schema, {
|
|
99
|
-
path: string;
|
|
100
|
-
source: string;
|
|
101
|
-
}>;
|
|
102
|
-
}
|
|
103
|
-
interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> {
|
|
104
|
-
type: 'docs';
|
|
105
|
-
dir: string;
|
|
106
|
-
docs: DocCollection<DocSchema, Async>;
|
|
107
|
-
meta: MetaCollection<MetaSchema>;
|
|
108
|
-
}
|
|
109
|
-
type GlobalConfigMDXOptions = ({
|
|
110
|
-
preset?: 'fumadocs';
|
|
111
|
-
} & DefaultMDXOptions) | ({
|
|
112
|
-
preset: 'minimal';
|
|
113
|
-
} & ProcessorOptions);
|
|
114
|
-
interface GlobalConfig {
|
|
115
|
-
collections?: Record<string, AnyCollection>;
|
|
116
|
-
plugins?: PluginOption[];
|
|
117
|
-
/**
|
|
118
|
-
* Configure global MDX options
|
|
119
|
-
*
|
|
120
|
-
* @remarks `GlobalConfigMDXOptions`
|
|
121
|
-
*/
|
|
122
|
-
mdxOptions?: GlobalConfigMDXOptions | (() => Promise<GlobalConfigMDXOptions>);
|
|
123
|
-
/**
|
|
124
|
-
* Fetch last modified time with specified version control
|
|
125
|
-
* @defaultValue 'none'
|
|
126
|
-
*/
|
|
127
|
-
lastModifiedTime?: 'git' | 'none';
|
|
128
|
-
/**
|
|
129
|
-
* specify a directory to access & store cache (disabled during development mode).
|
|
130
|
-
*
|
|
131
|
-
* The cache will never be updated, delete the cache folder to clean.
|
|
132
|
-
*/
|
|
133
|
-
experimentalBuildCache?: string;
|
|
134
|
-
}
|
|
135
|
-
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = false>(options: DocCollection<Schema, Async>): DocCollection<Schema, Async>;
|
|
136
|
-
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
|
|
137
|
-
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options: {
|
|
138
|
-
/**
|
|
139
|
-
* The content directory to scan files
|
|
140
|
-
*
|
|
141
|
-
* @defaultValue 'content/docs'
|
|
142
|
-
*/
|
|
143
|
-
dir?: string;
|
|
144
|
-
docs?: Omit<DocCollection<DocSchema, Async>, 'dir' | 'type'>;
|
|
145
|
-
meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
|
|
146
|
-
}): DocsCollection<DocSchema, MetaSchema, Async>;
|
|
147
|
-
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
148
|
-
|
|
149
|
-
interface LoadedConfig {
|
|
150
|
-
collectionList: CollectionItem[];
|
|
151
|
-
getCollection(name: string): CollectionItem | undefined;
|
|
152
|
-
global: GlobalConfig;
|
|
153
|
-
getDefaultMDXOptions(mode?: 'default' | 'remote'): Promise<ProcessorOptions>;
|
|
154
|
-
}
|
|
155
|
-
type CollectionItem = MetaCollectionItem | DocCollectionItem | DocsCollectionItem;
|
|
156
|
-
type PrimitiveCollectionItem<T extends DocCollection | MetaCollection> = Omit<T, 'files'> & {
|
|
157
|
-
name: string;
|
|
158
|
-
hasFile: (filePath: string) => boolean;
|
|
159
|
-
isFileSupported: (filePath: string) => boolean;
|
|
160
|
-
patterns: string[];
|
|
161
|
-
};
|
|
162
|
-
type MetaCollectionItem = PrimitiveCollectionItem<MetaCollection>;
|
|
163
|
-
type DocCollectionItem = PrimitiveCollectionItem<DocCollection>;
|
|
164
|
-
interface DocsCollectionItem extends DocsCollection {
|
|
165
|
-
name: string;
|
|
166
|
-
meta: MetaCollectionItem;
|
|
167
|
-
docs: DocCollectionItem;
|
|
168
|
-
}
|
|
169
|
-
declare function buildConfig(config: Record<string, unknown>): LoadedConfig;
|
|
170
|
-
|
|
171
|
-
type Awaitable<T> = T | Promise<T>;
|
|
172
|
-
interface EmitEntry {
|
|
173
|
-
/**
|
|
174
|
-
* path relative to output directory
|
|
175
|
-
*/
|
|
176
|
-
path: string;
|
|
177
|
-
content: string;
|
|
178
|
-
}
|
|
179
|
-
interface PluginContext extends CoreOptions {
|
|
180
|
-
core: Core;
|
|
181
|
-
}
|
|
182
|
-
interface Plugin {
|
|
183
|
-
name?: string;
|
|
184
|
-
/**
|
|
185
|
-
* on config loaded/updated
|
|
186
|
-
*/
|
|
187
|
-
config?: (this: PluginContext, config: LoadedConfig) => Awaitable<void | LoadedConfig>;
|
|
188
|
-
/**
|
|
189
|
-
* Generate files (e.g. types, index file, or JSON schemas)
|
|
190
|
-
*/
|
|
191
|
-
emit?: (this: PluginContext) => Awaitable<EmitEntry[]>;
|
|
192
|
-
/**
|
|
193
|
-
* Configure Fumadocs dev server
|
|
194
|
-
*/
|
|
195
|
-
configureServer?: (this: PluginContext, server: ServerContext) => Awaitable<void>;
|
|
196
|
-
}
|
|
197
|
-
type PluginOption = Awaitable<Plugin | Plugin[] | false>;
|
|
198
|
-
interface ServerContext {
|
|
199
|
-
/**
|
|
200
|
-
* the file watcher, by default all content files are watched, along with other files.
|
|
201
|
-
*
|
|
202
|
-
* make sure to filter when listening to events
|
|
203
|
-
*/
|
|
204
|
-
watcher?: FSWatcher;
|
|
205
|
-
}
|
|
206
|
-
interface CoreOptions {
|
|
207
|
-
environment: string;
|
|
208
|
-
configPath: string;
|
|
209
|
-
outDir: string;
|
|
210
|
-
}
|
|
211
|
-
interface EmitOptions {
|
|
212
|
-
/**
|
|
213
|
-
* filter the plugins to run emit
|
|
214
|
-
*/
|
|
215
|
-
filterPlugin?: (plugin: Plugin) => boolean;
|
|
216
|
-
}
|
|
217
|
-
declare function findConfigFile(): string;
|
|
218
|
-
declare function createCore(options: CoreOptions, defaultPlugins?: PluginOption[]): {
|
|
219
|
-
_options: CoreOptions;
|
|
220
|
-
getPluginContext(): PluginContext;
|
|
221
|
-
/**
|
|
222
|
-
* Convenient cache store, reset when config changes
|
|
223
|
-
*/
|
|
224
|
-
cache: Map<string, unknown>;
|
|
225
|
-
init({ config: newConfig }: {
|
|
226
|
-
config: Awaitable<LoadedConfig>;
|
|
227
|
-
}): Promise</*elided*/ any>;
|
|
228
|
-
getConfig(): LoadedConfig;
|
|
229
|
-
initServer(server: ServerContext): Promise<void>;
|
|
230
|
-
emitAndWrite({ filterPlugin, }?: EmitOptions): Promise<void>;
|
|
231
|
-
};
|
|
232
|
-
type Core = ReturnType<typeof createCore>;
|
|
233
|
-
|
|
234
|
-
export { type AnyCollection as A, type BaseCollection as B, type CoreOptions as C, type DefaultMDXOptions as D, type ExtractedReference as E, type GlobalConfig as G, type LoadedConfig as L, type MetaCollection as M, type PostprocessOptions as P, type ServerContext as S, type CollectionSchema as a, type DocCollection as b, type DocsCollection as c, defineCollections as d, defineDocs as e, defineConfig as f, getDefaultMDXOptions as g, frontmatterSchema as h, type Plugin as i, buildConfig as j, type EmitEntry as k, type PluginContext as l, metaSchema as m, type PluginOption as n, type EmitOptions as o, findConfigFile as p, createCore as q, type Core as r };
|
package/dist/core-DB7TdlyC.d.ts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
2
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
-
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
4
|
-
import { Pluggable } from 'unified';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { FSWatcher } from 'chokidar';
|
|
7
|
-
|
|
8
|
-
interface ExtractedReference {
|
|
9
|
-
href: string;
|
|
10
|
-
}
|
|
11
|
-
interface PostprocessOptions {
|
|
12
|
-
_format: 'md' | 'mdx';
|
|
13
|
-
/**
|
|
14
|
-
* Properties to export from `vfile.data`
|
|
15
|
-
*/
|
|
16
|
-
valueToExport?: string[];
|
|
17
|
-
/**
|
|
18
|
-
* stringify MDAST and export via `_markdown`.
|
|
19
|
-
*/
|
|
20
|
-
includeProcessedMarkdown?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* store MDAST and export via `_mdast`.
|
|
23
|
-
*/
|
|
24
|
-
includeMDAST?: boolean | {
|
|
25
|
-
removePosition?: boolean;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
30
|
-
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
31
|
-
rehypePlugins?: ResolvePlugins;
|
|
32
|
-
remarkPlugins?: ResolvePlugins;
|
|
33
|
-
/**
|
|
34
|
-
* Properties to export from `vfile.data`
|
|
35
|
-
*/
|
|
36
|
-
valueToExport?: string[];
|
|
37
|
-
remarkStructureOptions?: plugins.StructureOptions | false;
|
|
38
|
-
remarkHeadingOptions?: plugins.RemarkHeadingOptions;
|
|
39
|
-
remarkImageOptions?: plugins.RemarkImageOptions | false;
|
|
40
|
-
remarkCodeTabOptions?: plugins.RemarkCodeTabOptions | false;
|
|
41
|
-
remarkNpmOptions?: plugins.RemarkNpmOptions | false;
|
|
42
|
-
rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
|
|
43
|
-
_withoutBundler?: boolean;
|
|
44
|
-
};
|
|
45
|
-
declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, remarkNpmOptions, _withoutBundler, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Zod 4 schema
|
|
49
|
-
*/
|
|
50
|
-
declare const metaSchema: z.ZodObject<{
|
|
51
|
-
title: z.ZodOptional<z.ZodString>;
|
|
52
|
-
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
-
description: z.ZodOptional<z.ZodString>;
|
|
54
|
-
root: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
-
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
57
|
-
}, z.core.$strip>;
|
|
58
|
-
/**
|
|
59
|
-
* Zod 4 schema
|
|
60
|
-
*/
|
|
61
|
-
declare const frontmatterSchema: z.ZodObject<{
|
|
62
|
-
title: z.ZodString;
|
|
63
|
-
description: z.ZodOptional<z.ZodString>;
|
|
64
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
65
|
-
full: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
-
_openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
67
|
-
}, z.core.$strip>;
|
|
68
|
-
|
|
69
|
-
type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
|
|
70
|
-
type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
|
71
|
-
interface BaseCollection {
|
|
72
|
-
/**
|
|
73
|
-
* Directories to scan
|
|
74
|
-
*/
|
|
75
|
-
dir: string | string[];
|
|
76
|
-
/**
|
|
77
|
-
* what files to include/exclude (glob patterns)
|
|
78
|
-
*
|
|
79
|
-
* Include all files if not specified
|
|
80
|
-
*/
|
|
81
|
-
files?: string[];
|
|
82
|
-
}
|
|
83
|
-
interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
|
|
84
|
-
type: 'meta';
|
|
85
|
-
schema?: CollectionSchema<Schema, {
|
|
86
|
-
path: string;
|
|
87
|
-
source: string;
|
|
88
|
-
}>;
|
|
89
|
-
}
|
|
90
|
-
interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
|
|
91
|
-
type: 'doc';
|
|
92
|
-
postprocess?: Partial<PostprocessOptions>;
|
|
93
|
-
mdxOptions?: ProcessorOptions;
|
|
94
|
-
/**
|
|
95
|
-
* Load files with async
|
|
96
|
-
*/
|
|
97
|
-
async?: Async;
|
|
98
|
-
schema?: CollectionSchema<Schema, {
|
|
99
|
-
path: string;
|
|
100
|
-
source: string;
|
|
101
|
-
}>;
|
|
102
|
-
}
|
|
103
|
-
interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> {
|
|
104
|
-
type: 'docs';
|
|
105
|
-
dir: string;
|
|
106
|
-
docs: DocCollection<DocSchema, Async>;
|
|
107
|
-
meta: MetaCollection<MetaSchema>;
|
|
108
|
-
}
|
|
109
|
-
type GlobalConfigMDXOptions = ({
|
|
110
|
-
preset?: 'fumadocs';
|
|
111
|
-
} & DefaultMDXOptions) | ({
|
|
112
|
-
preset: 'minimal';
|
|
113
|
-
} & ProcessorOptions);
|
|
114
|
-
interface GlobalConfig {
|
|
115
|
-
collections?: Record<string, AnyCollection>;
|
|
116
|
-
plugins?: PluginOption[];
|
|
117
|
-
/**
|
|
118
|
-
* Configure global MDX options
|
|
119
|
-
*
|
|
120
|
-
* @remarks `GlobalConfigMDXOptions`
|
|
121
|
-
*/
|
|
122
|
-
mdxOptions?: GlobalConfigMDXOptions | (() => Promise<GlobalConfigMDXOptions>);
|
|
123
|
-
/**
|
|
124
|
-
* Fetch last modified time with specified version control
|
|
125
|
-
* @defaultValue 'none'
|
|
126
|
-
*/
|
|
127
|
-
lastModifiedTime?: 'git' | 'none';
|
|
128
|
-
/**
|
|
129
|
-
* specify a directory to access & store cache (disabled during development mode).
|
|
130
|
-
*
|
|
131
|
-
* The cache will never be updated, delete the cache folder to clean.
|
|
132
|
-
*/
|
|
133
|
-
experimentalBuildCache?: string;
|
|
134
|
-
}
|
|
135
|
-
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = false>(options: DocCollection<Schema, Async>): DocCollection<Schema, Async>;
|
|
136
|
-
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
|
|
137
|
-
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options: {
|
|
138
|
-
/**
|
|
139
|
-
* The content directory to scan files
|
|
140
|
-
*
|
|
141
|
-
* @defaultValue 'content/docs'
|
|
142
|
-
*/
|
|
143
|
-
dir?: string;
|
|
144
|
-
docs?: Omit<DocCollection<DocSchema, Async>, 'dir' | 'type'>;
|
|
145
|
-
meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
|
|
146
|
-
}): DocsCollection<DocSchema, MetaSchema, Async>;
|
|
147
|
-
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
148
|
-
|
|
149
|
-
interface LoadedConfig {
|
|
150
|
-
collectionList: CollectionItem[];
|
|
151
|
-
getCollection(name: string): CollectionItem | undefined;
|
|
152
|
-
global: GlobalConfig;
|
|
153
|
-
getDefaultMDXOptions(mode?: 'default' | 'remote'): Promise<ProcessorOptions>;
|
|
154
|
-
}
|
|
155
|
-
type CollectionItem = MetaCollectionItem | DocCollectionItem | DocsCollectionItem;
|
|
156
|
-
type PrimitiveCollectionItem<T extends DocCollection | MetaCollection> = Omit<T, 'files'> & {
|
|
157
|
-
name: string;
|
|
158
|
-
hasFile: (filePath: string) => boolean;
|
|
159
|
-
isFileSupported: (filePath: string) => boolean;
|
|
160
|
-
patterns: string[];
|
|
161
|
-
};
|
|
162
|
-
type MetaCollectionItem = PrimitiveCollectionItem<MetaCollection>;
|
|
163
|
-
type DocCollectionItem = PrimitiveCollectionItem<DocCollection>;
|
|
164
|
-
interface DocsCollectionItem extends DocsCollection {
|
|
165
|
-
name: string;
|
|
166
|
-
meta: MetaCollectionItem;
|
|
167
|
-
docs: DocCollectionItem;
|
|
168
|
-
}
|
|
169
|
-
declare function buildConfig(config: Record<string, unknown>): LoadedConfig;
|
|
170
|
-
|
|
171
|
-
type Awaitable<T> = T | Promise<T>;
|
|
172
|
-
interface EmitEntry {
|
|
173
|
-
/**
|
|
174
|
-
* path relative to output directory
|
|
175
|
-
*/
|
|
176
|
-
path: string;
|
|
177
|
-
content: string;
|
|
178
|
-
}
|
|
179
|
-
interface PluginContext extends CoreOptions {
|
|
180
|
-
core: Core;
|
|
181
|
-
}
|
|
182
|
-
interface Plugin {
|
|
183
|
-
name?: string;
|
|
184
|
-
/**
|
|
185
|
-
* on config loaded/updated
|
|
186
|
-
*/
|
|
187
|
-
config?: (this: PluginContext, config: LoadedConfig) => Awaitable<void | LoadedConfig>;
|
|
188
|
-
/**
|
|
189
|
-
* Generate files (e.g. types, index file, or JSON schemas)
|
|
190
|
-
*/
|
|
191
|
-
emit?: (this: PluginContext) => Awaitable<EmitEntry[]>;
|
|
192
|
-
/**
|
|
193
|
-
* Configure Fumadocs dev server
|
|
194
|
-
*/
|
|
195
|
-
configureServer?: (this: PluginContext, server: ServerContext) => Awaitable<void>;
|
|
196
|
-
}
|
|
197
|
-
type PluginOption = Awaitable<Plugin | Plugin[] | false>;
|
|
198
|
-
interface ServerContext {
|
|
199
|
-
/**
|
|
200
|
-
* the file watcher, by default all content files are watched, along with other files.
|
|
201
|
-
*
|
|
202
|
-
* make sure to filter when listening to events
|
|
203
|
-
*/
|
|
204
|
-
watcher?: FSWatcher;
|
|
205
|
-
}
|
|
206
|
-
interface CoreOptions {
|
|
207
|
-
environment: string;
|
|
208
|
-
configPath: string;
|
|
209
|
-
outDir: string;
|
|
210
|
-
}
|
|
211
|
-
interface EmitOptions {
|
|
212
|
-
/**
|
|
213
|
-
* filter the plugins to run emit
|
|
214
|
-
*/
|
|
215
|
-
filterPlugin?: (plugin: Plugin) => boolean;
|
|
216
|
-
}
|
|
217
|
-
declare function findConfigFile(): string;
|
|
218
|
-
declare function createCore(options: CoreOptions, defaultPlugins?: PluginOption[]): {
|
|
219
|
-
_options: CoreOptions;
|
|
220
|
-
getPluginContext(): PluginContext;
|
|
221
|
-
/**
|
|
222
|
-
* Convenient cache store, reset when config changes
|
|
223
|
-
*/
|
|
224
|
-
cache: Map<string, unknown>;
|
|
225
|
-
init({ config: newConfig }: {
|
|
226
|
-
config: Awaitable<LoadedConfig>;
|
|
227
|
-
}): Promise</*elided*/ any>;
|
|
228
|
-
getConfig(): LoadedConfig;
|
|
229
|
-
initServer(server: ServerContext): Promise<void>;
|
|
230
|
-
emitAndWrite({ filterPlugin, }?: EmitOptions): Promise<void>;
|
|
231
|
-
};
|
|
232
|
-
type Core = ReturnType<typeof createCore>;
|
|
233
|
-
|
|
234
|
-
export { type AnyCollection as A, type BaseCollection as B, type CoreOptions as C, type DefaultMDXOptions as D, type ExtractedReference as E, type GlobalConfig as G, type LoadedConfig as L, type MetaCollection as M, type PostprocessOptions as P, type ServerContext as S, type CollectionSchema as a, type DocCollection as b, type DocsCollection as c, defineCollections as d, defineDocs as e, defineConfig as f, getDefaultMDXOptions as g, frontmatterSchema as h, type Plugin as i, buildConfig as j, type EmitEntry as k, type PluginContext as l, metaSchema as m, type PluginOption as n, type EmitOptions as o, findConfigFile as p, createCore as q, type Core as r };
|
package/dist/index-D7s7kCc2.d.ts
DELETED