fumadocs-mdx 14.0.0 → 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 +270 -201
- package/dist/bun/index.cjs +63 -28
- package/dist/bun/index.d.cts +7 -1
- package/dist/bun/index.d.ts +7 -1
- package/dist/bun/index.js +6 -5
- package/dist/{chunk-5YXP7JLN.js → chunk-5OBUOALK.js} +8 -5
- package/dist/{chunk-XHJCLBZ4.js → chunk-7UKSZSPY.js} +87 -162
- package/dist/{chunk-7L2KNF6B.js → chunk-BEBCWQC7.js} +51 -7
- package/dist/{chunk-5UMZCWKV.js → chunk-IQGEFL2B.js} +1 -1
- package/dist/{chunk-SRSRFOVI.js → chunk-K6HCOGOX.js} +3 -3
- package/dist/{chunk-OXSRIWQW.js → chunk-MTTISKQJ.js} +3 -2
- package/dist/chunk-WBIHDYMN.js +126 -0
- package/dist/config/index.d.cts +6 -1
- package/dist/config/index.d.ts +6 -1
- package/dist/{index-D7JdSMpp.d.cts → core-B9ZoS6sA.d.ts} +73 -4
- package/dist/{index-D7JdSMpp.d.ts → core-DTuP23zu.d.cts} +73 -4
- package/dist/{index-BlVBvy-z.d.ts → index-BD8Woo4m.d.cts} +1 -1
- package/dist/{index-P2NNUkHn.d.cts → index-CNOvhtOn.d.ts} +1 -1
- package/dist/index.d.cts +56 -3
- package/dist/index.d.ts +56 -3
- package/dist/{load-from-file-I3ALLIVB.js → load-from-file-5HUQN36V.js} +1 -1
- package/dist/next/index.cjs +260 -192
- package/dist/next/index.d.cts +7 -2
- package/dist/next/index.d.ts +7 -2
- package/dist/next/index.js +10 -8
- package/dist/node/loader.cjs +72 -37
- package/dist/node/loader.js +3 -3
- package/dist/plugins/index-file.cjs +69 -45
- package/dist/plugins/index-file.d.cts +7 -22
- package/dist/plugins/index-file.d.ts +7 -22
- package/dist/plugins/index-file.js +2 -2
- package/dist/plugins/json-schema.d.cts +7 -1
- package/dist/plugins/json-schema.d.ts +7 -1
- package/dist/plugins/last-modified.cjs +41 -6
- package/dist/plugins/last-modified.d.cts +11 -1
- package/dist/plugins/last-modified.d.ts +11 -1
- package/dist/plugins/last-modified.js +34 -4
- package/dist/runtime/browser.cjs +7 -8
- package/dist/runtime/browser.d.cts +22 -19
- package/dist/runtime/browser.d.ts +22 -19
- package/dist/runtime/browser.js +5 -6
- package/dist/runtime/dynamic.cjs +81 -43
- package/dist/runtime/dynamic.d.cts +12 -12
- package/dist/runtime/dynamic.d.ts +12 -12
- package/dist/runtime/dynamic.js +9 -8
- package/dist/runtime/server.cjs +9 -6
- package/dist/runtime/server.d.cts +10 -157
- package/dist/runtime/server.d.ts +10 -157
- package/dist/runtime/server.js +3 -3
- 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 +257 -190
- package/dist/vite/index.d.cts +7 -2
- package/dist/vite/index.d.ts +7 -2
- package/dist/vite/index.js +7 -6
- package/dist/webpack/mdx.cjs +60 -25
- package/dist/webpack/mdx.d.cts +8 -2
- package/dist/webpack/mdx.d.ts +8 -2
- package/dist/webpack/mdx.js +4 -4
- package/dist/webpack/meta.cjs +60 -25
- package/dist/webpack/meta.d.cts +8 -2
- package/dist/webpack/meta.d.ts +8 -2
- package/dist/webpack/meta.js +4 -4
- package/package.json +2 -2
- package/dist/chunk-PKI7ZDA5.js +0 -29
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import * as fumadocs_core_source from 'fumadocs-core/source';
|
|
2
|
-
import {
|
|
3
|
-
import { C as CoreOptions, D as DocCollection, b as DocsCollection } from '../index-D7JdSMpp.js';
|
|
2
|
+
import { i as CoreOptions, S as ServerOptions, D as DocCollection, a as DocsCollection, k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry } from '../core-B9ZoS6sA.js';
|
|
4
3
|
import * as _standard_schema_spec from '@standard-schema/spec';
|
|
5
|
-
import '
|
|
6
|
-
import 'fumadocs-core/toc';
|
|
7
|
-
import 'mdx/types';
|
|
8
|
-
import 'mdast';
|
|
4
|
+
import { FileInfo, InternalTypeConfig } from './types.js';
|
|
9
5
|
import '@mdx-js/mdx';
|
|
10
|
-
import 'react';
|
|
11
6
|
import 'unified';
|
|
7
|
+
import 'fumadocs-core/mdx-plugins';
|
|
12
8
|
import 'zod';
|
|
13
9
|
import 'chokidar';
|
|
14
10
|
import 'vfile';
|
|
11
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
12
|
+
import 'fumadocs-core/toc';
|
|
13
|
+
import 'mdast';
|
|
14
|
+
import 'mdx/types';
|
|
15
15
|
|
|
16
16
|
interface LazyEntry<Data = unknown> {
|
|
17
17
|
info: FileInfo;
|
|
18
18
|
data: Data;
|
|
19
19
|
hash?: string;
|
|
20
20
|
}
|
|
21
|
-
type CreateDynamic<Config> = ReturnType<typeof
|
|
22
|
-
declare function
|
|
23
|
-
doc<Name extends keyof Config>(name: Name, base: string, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<_standard_schema_spec.StandardSchemaV1.InferOutput<Schema
|
|
24
|
-
docs<Name extends keyof Config>(name: Name, base: string, meta: Record<string, unknown>, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocsCollection<infer Page extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, infer Meta extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? _standard_schema_spec.StandardSchemaV1.InferOutput<Page> extends fumadocs_core_source.PageData ? _standard_schema_spec.StandardSchemaV1.InferOutput<Meta> extends fumadocs_core_source.MetaData ? AsyncDocsCollectionEntry<_standard_schema_spec.StandardSchemaV1.InferOutput<Page>, _standard_schema_spec.StandardSchemaV1.InferOutput<Meta
|
|
21
|
+
type CreateDynamic<Config, TC extends InternalTypeConfig = InternalTypeConfig> = ReturnType<typeof dynamic<Config, TC>>;
|
|
22
|
+
declare function dynamic<Config, TC extends InternalTypeConfig>(configExports: Config, coreOptions: CoreOptions, serverOptions?: ServerOptions): Promise<{
|
|
23
|
+
doc<Name extends keyof Config & string>(name: Name, base: string, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<Name, _standard_schema_spec.StandardSchemaV1.InferOutput<Schema>, TC>[] : never>;
|
|
24
|
+
docs<Name extends keyof Config & string>(name: Name, base: string, meta: Record<string, unknown>, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocsCollection<infer Page extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, infer Meta extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? _standard_schema_spec.StandardSchemaV1.InferOutput<Page> extends fumadocs_core_source.PageData ? _standard_schema_spec.StandardSchemaV1.InferOutput<Meta> extends fumadocs_core_source.MetaData ? AsyncDocsCollectionEntry<Name, _standard_schema_spec.StandardSchemaV1.InferOutput<Page>, _standard_schema_spec.StandardSchemaV1.InferOutput<Meta>, TC> : never : never : never>;
|
|
25
25
|
}>;
|
|
26
26
|
|
|
27
|
-
export { type CreateDynamic, type LazyEntry,
|
|
27
|
+
export { type CreateDynamic, type LazyEntry, dynamic };
|
package/dist/runtime/dynamic.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
buildMDX
|
|
3
3
|
} from "../chunk-SLY7WXTX.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "../chunk-
|
|
5
|
+
server
|
|
6
|
+
} from "../chunk-5OBUOALK.js";
|
|
7
7
|
import "../chunk-FBLMK4RS.js";
|
|
8
8
|
import {
|
|
9
9
|
buildConfig
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
import "../chunk-E5DJTSIM.js";
|
|
12
12
|
import {
|
|
13
13
|
createCore
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-BEBCWQC7.js";
|
|
15
|
+
import "../chunk-WBIHDYMN.js";
|
|
16
16
|
import {
|
|
17
17
|
fumaMatter
|
|
18
18
|
} from "../chunk-VWJKRQZR.js";
|
|
@@ -21,11 +21,12 @@ import {
|
|
|
21
21
|
import { executeMdx } from "@fumadocs/mdx-remote/client";
|
|
22
22
|
import { pathToFileURL } from "url";
|
|
23
23
|
import fs from "fs/promises";
|
|
24
|
-
async function
|
|
25
|
-
const core =
|
|
24
|
+
async function dynamic(configExports, coreOptions, serverOptions) {
|
|
25
|
+
const core = createCore(coreOptions);
|
|
26
|
+
await core.init({
|
|
26
27
|
config: buildConfig(configExports)
|
|
27
28
|
});
|
|
28
|
-
const create =
|
|
29
|
+
const create = server(serverOptions);
|
|
29
30
|
function getDocCollection(name) {
|
|
30
31
|
const collection = core.getConfig().getCollection(name);
|
|
31
32
|
if (!collection) return;
|
|
@@ -74,5 +75,5 @@ async function fromConfigDynamic(configExports, coreOptions) {
|
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
export {
|
|
77
|
-
|
|
78
|
+
dynamic
|
|
78
79
|
};
|
package/dist/runtime/server.cjs
CHANGED
|
@@ -30,12 +30,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/runtime/server.ts
|
|
31
31
|
var server_exports = {};
|
|
32
32
|
__export(server_exports, {
|
|
33
|
-
|
|
33
|
+
server: () => server,
|
|
34
34
|
toFumadocsSource: () => toFumadocsSource
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(server_exports);
|
|
37
37
|
var path = __toESM(require("path"), 1);
|
|
38
|
-
function
|
|
38
|
+
function server(options = {}) {
|
|
39
|
+
const { doc: { passthroughs: docPassthroughs = [] } = {} } = options;
|
|
39
40
|
function fileInfo(file, base) {
|
|
40
41
|
if (file.startsWith("./")) {
|
|
41
42
|
file = file.slice(2);
|
|
@@ -46,14 +47,16 @@ function fromConfig() {
|
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
function mapDocData(entry) {
|
|
49
|
-
|
|
50
|
+
const data = {
|
|
50
51
|
body: entry.default,
|
|
51
52
|
toc: entry.toc,
|
|
52
|
-
extractedReferences: entry.extractedReferences,
|
|
53
53
|
structuredData: entry.structuredData,
|
|
54
|
-
lastModified: entry.lastModified,
|
|
55
54
|
_exports: entry
|
|
56
55
|
};
|
|
56
|
+
for (const key of docPassthroughs) {
|
|
57
|
+
data[key] = entry[key];
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
57
60
|
}
|
|
58
61
|
return {
|
|
59
62
|
async doc(_name, base, glob) {
|
|
@@ -168,6 +171,6 @@ function createDocMethods(info, load) {
|
|
|
168
171
|
}
|
|
169
172
|
// Annotate the CommonJS export names for ESM import in node:
|
|
170
173
|
0 && (module.exports = {
|
|
171
|
-
|
|
174
|
+
server,
|
|
172
175
|
toFumadocsSource
|
|
173
176
|
});
|
|
@@ -1,161 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Root } from 'mdast';
|
|
7
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
8
|
-
import { createProcessor } from '@mdx-js/mdx';
|
|
9
|
-
import { FC } from 'react';
|
|
1
|
+
import 'fumadocs-core/source';
|
|
2
|
+
export { k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry, w as DocCollectionEntry, x as DocsCollectionEntry, v as MetaCollectionEntry, y as ServerCreate, S as ServerOptions, z as server, F as toFumadocsSource } from '../core-DTuP23zu.cjs';
|
|
3
|
+
import '@standard-schema/spec';
|
|
4
|
+
import './types.cjs';
|
|
5
|
+
import '@mdx-js/mdx';
|
|
10
6
|
import 'unified';
|
|
7
|
+
import 'fumadocs-core/mdx-plugins';
|
|
11
8
|
import 'zod';
|
|
12
9
|
import 'chokidar';
|
|
13
10
|
import 'vfile';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
|
|
20
|
-
frontmatter: Frontmatter;
|
|
21
|
-
structuredData: StructuredData;
|
|
22
|
-
toc: TOCItemType[];
|
|
23
|
-
default: FC<MDXProps>;
|
|
24
|
-
/**
|
|
25
|
-
* Added by the `last-modified` plugin.
|
|
26
|
-
*/
|
|
27
|
-
lastModified?: Date;
|
|
28
|
-
/**
|
|
29
|
-
* Enable from `postprocess` option.
|
|
30
|
-
*/
|
|
31
|
-
extractedReferences?: ExtractedReference[];
|
|
32
|
-
/**
|
|
33
|
-
* Enable from `postprocess` option.
|
|
34
|
-
*/
|
|
35
|
-
_markdown?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Enable from `postprocess` option.
|
|
38
|
-
*/
|
|
39
|
-
_mdast?: string;
|
|
40
|
-
}
|
|
41
|
-
interface FumadocsDataMap {
|
|
42
|
-
/**
|
|
43
|
-
* [Fumadocs MDX] raw frontmatter, you can modify it
|
|
44
|
-
*/
|
|
45
|
-
frontmatter?: Record<string, unknown>;
|
|
46
|
-
/**
|
|
47
|
-
* [Fumadocs MDX] additional ESM exports to write
|
|
48
|
-
*/
|
|
49
|
-
'mdx-export'?: {
|
|
50
|
-
name: string;
|
|
51
|
-
value: unknown;
|
|
52
|
-
}[];
|
|
53
|
-
/**
|
|
54
|
-
* [Fumadocs MDX] The compiler object from loader
|
|
55
|
-
*/
|
|
56
|
-
_compiler?: CompilerOptions;
|
|
57
|
-
/**
|
|
58
|
-
* [Fumadocs MDX] get internal processor, do not use this on user land.
|
|
59
|
-
*/
|
|
60
|
-
_getProcessor?: (format: 'md' | 'mdx') => Processor;
|
|
61
|
-
}
|
|
62
|
-
declare module 'vfile' {
|
|
63
|
-
interface DataMap extends FumadocsDataMap {
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface FileInfo {
|
|
68
|
-
/**
|
|
69
|
-
* virtualized path for Source API
|
|
70
|
-
*/
|
|
71
|
-
path: string;
|
|
72
|
-
/**
|
|
73
|
-
* the file path in file system
|
|
74
|
-
*/
|
|
75
|
-
fullPath: string;
|
|
76
|
-
}
|
|
77
|
-
interface DocData {
|
|
78
|
-
/**
|
|
79
|
-
* Compiled MDX content (as component)
|
|
80
|
-
*/
|
|
81
|
-
body: MDXContent;
|
|
82
|
-
/**
|
|
83
|
-
* table of contents generated from content.
|
|
84
|
-
*/
|
|
85
|
-
toc: TOCItemType[];
|
|
86
|
-
/**
|
|
87
|
-
* structured data for document search indexing.
|
|
88
|
-
*/
|
|
89
|
-
structuredData: StructuredData;
|
|
90
|
-
/**
|
|
91
|
-
* Raw exports from the compiled MDX file.
|
|
92
|
-
*/
|
|
93
|
-
_exports: Record<string, unknown>;
|
|
94
|
-
/**
|
|
95
|
-
* Last modified date of document file, obtained from version control.
|
|
96
|
-
*
|
|
97
|
-
* Added by the `last-modified` plugin.
|
|
98
|
-
*/
|
|
99
|
-
lastModified?: Date;
|
|
100
|
-
/**
|
|
101
|
-
* extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
|
|
102
|
-
*/
|
|
103
|
-
extractedReferences?: ExtractedReference[];
|
|
104
|
-
}
|
|
105
|
-
interface DocMethods {
|
|
106
|
-
/**
|
|
107
|
-
* file info
|
|
108
|
-
*/
|
|
109
|
-
info: FileInfo;
|
|
110
|
-
/**
|
|
111
|
-
* get document as text.
|
|
112
|
-
*
|
|
113
|
-
* - `type: raw` - read the original content from file system.
|
|
114
|
-
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
115
|
-
*/
|
|
116
|
-
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
117
|
-
getMDAST: () => Promise<Root>;
|
|
118
|
-
}
|
|
119
|
-
interface MetaMethods {
|
|
120
|
-
/**
|
|
121
|
-
* file info
|
|
122
|
-
*/
|
|
123
|
-
info: FileInfo;
|
|
124
|
-
}
|
|
125
|
-
type MetaCollectionEntry<Data> = Data & MetaMethods;
|
|
126
|
-
type DocCollectionEntry<Frontmatter> = DocData & DocMethods & Frontmatter;
|
|
127
|
-
type AsyncDocCollectionEntry<Frontmatter> = DocMethods & {
|
|
128
|
-
load: () => Promise<DocData>;
|
|
129
|
-
} & Frontmatter;
|
|
130
|
-
type CompiledMDXFile<Frontmatter> = CompiledMDXProperties<Frontmatter> & Record<string, unknown>;
|
|
131
|
-
interface DocsCollectionEntry<Frontmatter extends PageData, Meta extends MetaData> {
|
|
132
|
-
docs: DocCollectionEntry<Frontmatter>[];
|
|
133
|
-
meta: MetaCollectionEntry<Meta>[];
|
|
134
|
-
toFumadocsSource: () => Source<{
|
|
135
|
-
pageData: DocCollectionEntry<Frontmatter>;
|
|
136
|
-
metaData: MetaCollectionEntry<Meta>;
|
|
137
|
-
}>;
|
|
138
|
-
}
|
|
139
|
-
interface AsyncDocsCollectionEntry<Frontmatter extends PageData, Meta extends MetaData> {
|
|
140
|
-
docs: AsyncDocCollectionEntry<Frontmatter>[];
|
|
141
|
-
meta: MetaCollectionEntry<Meta>[];
|
|
142
|
-
toFumadocsSource: () => Source<{
|
|
143
|
-
pageData: AsyncDocCollectionEntry<Frontmatter>;
|
|
144
|
-
metaData: MetaCollectionEntry<Meta>;
|
|
145
|
-
}>;
|
|
146
|
-
}
|
|
147
|
-
type AwaitableGlobEntries<T> = Record<string, T | (() => Promise<T>)>;
|
|
148
|
-
type ServerCreate<Config> = ReturnType<typeof fromConfig<Config>>;
|
|
149
|
-
declare function fromConfig<Config>(): {
|
|
150
|
-
doc<Name extends keyof Config>(_name: Name, base: string, glob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends DocCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends StandardSchemaV1<unknown, unknown>, StandardSchemaV1<unknown, unknown>> ? DocCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
|
|
151
|
-
docLazy<Name extends keyof Config>(_name: Name, base: string, head: AwaitableGlobEntries<unknown>, body: Record<string, () => Promise<unknown>>): Promise<Config[Name] extends DocCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends StandardSchemaV1<unknown, unknown>, StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
|
|
152
|
-
meta<Name extends keyof Config>(_name: Name, base: string, glob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends MetaCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<StandardSchemaV1<unknown, unknown>, infer Schema extends StandardSchemaV1<unknown, unknown>> ? MetaCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
|
|
153
|
-
docs<Name extends keyof Config>(name: Name, base: string, metaGlob: AwaitableGlobEntries<unknown>, docGlob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends DocsCollection<infer Page extends StandardSchemaV1<unknown, unknown>, infer Meta extends StandardSchemaV1<unknown, unknown>> ? StandardSchemaV1.InferOutput<Page> extends PageData ? StandardSchemaV1.InferOutput<Meta> extends MetaData ? DocsCollectionEntry<StandardSchemaV1.InferOutput<Page>, StandardSchemaV1.InferOutput<Meta>> : never : never : never>;
|
|
154
|
-
docsLazy<Name extends keyof Config>(name: Name, base: string, metaGlob: AwaitableGlobEntries<unknown>, docHeadGlob: AwaitableGlobEntries<unknown>, docBodyGlob: Record<string, () => Promise<unknown>>): Promise<Config[Name] extends DocsCollection<infer Page extends StandardSchemaV1<unknown, unknown>, infer Meta extends StandardSchemaV1<unknown, unknown>> ? StandardSchemaV1.InferOutput<Page> extends PageData ? StandardSchemaV1.InferOutput<Meta> extends MetaData ? AsyncDocsCollectionEntry<StandardSchemaV1.InferOutput<Page>, StandardSchemaV1.InferOutput<Meta>> : never : never : never>;
|
|
155
|
-
};
|
|
156
|
-
declare function toFumadocsSource<Page extends DocMethods & PageData, Meta extends MetaMethods & MetaData>(pages: Page[], metas: Meta[]): Source<{
|
|
157
|
-
pageData: Page;
|
|
158
|
-
metaData: Meta;
|
|
159
|
-
}>;
|
|
160
|
-
|
|
161
|
-
export { type AsyncDocCollectionEntry, type AsyncDocsCollectionEntry, type CompiledMDXFile, type DocCollectionEntry, type DocData, type DocMethods, type DocsCollectionEntry, type FileInfo, type MetaCollectionEntry, type MetaMethods, type ServerCreate, fromConfig, toFumadocsSource };
|
|
11
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
12
|
+
import 'fumadocs-core/toc';
|
|
13
|
+
import 'mdast';
|
|
14
|
+
import 'mdx/types';
|
package/dist/runtime/server.d.ts
CHANGED
|
@@ -1,161 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Root } from 'mdast';
|
|
7
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
8
|
-
import { createProcessor } from '@mdx-js/mdx';
|
|
9
|
-
import { FC } from 'react';
|
|
1
|
+
import 'fumadocs-core/source';
|
|
2
|
+
export { k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry, w as DocCollectionEntry, x as DocsCollectionEntry, v as MetaCollectionEntry, y as ServerCreate, S as ServerOptions, z as server, F as toFumadocsSource } from '../core-B9ZoS6sA.js';
|
|
3
|
+
import '@standard-schema/spec';
|
|
4
|
+
import './types.js';
|
|
5
|
+
import '@mdx-js/mdx';
|
|
10
6
|
import 'unified';
|
|
7
|
+
import 'fumadocs-core/mdx-plugins';
|
|
11
8
|
import 'zod';
|
|
12
9
|
import 'chokidar';
|
|
13
10
|
import 'vfile';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
|
|
20
|
-
frontmatter: Frontmatter;
|
|
21
|
-
structuredData: StructuredData;
|
|
22
|
-
toc: TOCItemType[];
|
|
23
|
-
default: FC<MDXProps>;
|
|
24
|
-
/**
|
|
25
|
-
* Added by the `last-modified` plugin.
|
|
26
|
-
*/
|
|
27
|
-
lastModified?: Date;
|
|
28
|
-
/**
|
|
29
|
-
* Enable from `postprocess` option.
|
|
30
|
-
*/
|
|
31
|
-
extractedReferences?: ExtractedReference[];
|
|
32
|
-
/**
|
|
33
|
-
* Enable from `postprocess` option.
|
|
34
|
-
*/
|
|
35
|
-
_markdown?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Enable from `postprocess` option.
|
|
38
|
-
*/
|
|
39
|
-
_mdast?: string;
|
|
40
|
-
}
|
|
41
|
-
interface FumadocsDataMap {
|
|
42
|
-
/**
|
|
43
|
-
* [Fumadocs MDX] raw frontmatter, you can modify it
|
|
44
|
-
*/
|
|
45
|
-
frontmatter?: Record<string, unknown>;
|
|
46
|
-
/**
|
|
47
|
-
* [Fumadocs MDX] additional ESM exports to write
|
|
48
|
-
*/
|
|
49
|
-
'mdx-export'?: {
|
|
50
|
-
name: string;
|
|
51
|
-
value: unknown;
|
|
52
|
-
}[];
|
|
53
|
-
/**
|
|
54
|
-
* [Fumadocs MDX] The compiler object from loader
|
|
55
|
-
*/
|
|
56
|
-
_compiler?: CompilerOptions;
|
|
57
|
-
/**
|
|
58
|
-
* [Fumadocs MDX] get internal processor, do not use this on user land.
|
|
59
|
-
*/
|
|
60
|
-
_getProcessor?: (format: 'md' | 'mdx') => Processor;
|
|
61
|
-
}
|
|
62
|
-
declare module 'vfile' {
|
|
63
|
-
interface DataMap extends FumadocsDataMap {
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface FileInfo {
|
|
68
|
-
/**
|
|
69
|
-
* virtualized path for Source API
|
|
70
|
-
*/
|
|
71
|
-
path: string;
|
|
72
|
-
/**
|
|
73
|
-
* the file path in file system
|
|
74
|
-
*/
|
|
75
|
-
fullPath: string;
|
|
76
|
-
}
|
|
77
|
-
interface DocData {
|
|
78
|
-
/**
|
|
79
|
-
* Compiled MDX content (as component)
|
|
80
|
-
*/
|
|
81
|
-
body: MDXContent;
|
|
82
|
-
/**
|
|
83
|
-
* table of contents generated from content.
|
|
84
|
-
*/
|
|
85
|
-
toc: TOCItemType[];
|
|
86
|
-
/**
|
|
87
|
-
* structured data for document search indexing.
|
|
88
|
-
*/
|
|
89
|
-
structuredData: StructuredData;
|
|
90
|
-
/**
|
|
91
|
-
* Raw exports from the compiled MDX file.
|
|
92
|
-
*/
|
|
93
|
-
_exports: Record<string, unknown>;
|
|
94
|
-
/**
|
|
95
|
-
* Last modified date of document file, obtained from version control.
|
|
96
|
-
*
|
|
97
|
-
* Added by the `last-modified` plugin.
|
|
98
|
-
*/
|
|
99
|
-
lastModified?: Date;
|
|
100
|
-
/**
|
|
101
|
-
* extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
|
|
102
|
-
*/
|
|
103
|
-
extractedReferences?: ExtractedReference[];
|
|
104
|
-
}
|
|
105
|
-
interface DocMethods {
|
|
106
|
-
/**
|
|
107
|
-
* file info
|
|
108
|
-
*/
|
|
109
|
-
info: FileInfo;
|
|
110
|
-
/**
|
|
111
|
-
* get document as text.
|
|
112
|
-
*
|
|
113
|
-
* - `type: raw` - read the original content from file system.
|
|
114
|
-
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
115
|
-
*/
|
|
116
|
-
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
117
|
-
getMDAST: () => Promise<Root>;
|
|
118
|
-
}
|
|
119
|
-
interface MetaMethods {
|
|
120
|
-
/**
|
|
121
|
-
* file info
|
|
122
|
-
*/
|
|
123
|
-
info: FileInfo;
|
|
124
|
-
}
|
|
125
|
-
type MetaCollectionEntry<Data> = Data & MetaMethods;
|
|
126
|
-
type DocCollectionEntry<Frontmatter> = DocData & DocMethods & Frontmatter;
|
|
127
|
-
type AsyncDocCollectionEntry<Frontmatter> = DocMethods & {
|
|
128
|
-
load: () => Promise<DocData>;
|
|
129
|
-
} & Frontmatter;
|
|
130
|
-
type CompiledMDXFile<Frontmatter> = CompiledMDXProperties<Frontmatter> & Record<string, unknown>;
|
|
131
|
-
interface DocsCollectionEntry<Frontmatter extends PageData, Meta extends MetaData> {
|
|
132
|
-
docs: DocCollectionEntry<Frontmatter>[];
|
|
133
|
-
meta: MetaCollectionEntry<Meta>[];
|
|
134
|
-
toFumadocsSource: () => Source<{
|
|
135
|
-
pageData: DocCollectionEntry<Frontmatter>;
|
|
136
|
-
metaData: MetaCollectionEntry<Meta>;
|
|
137
|
-
}>;
|
|
138
|
-
}
|
|
139
|
-
interface AsyncDocsCollectionEntry<Frontmatter extends PageData, Meta extends MetaData> {
|
|
140
|
-
docs: AsyncDocCollectionEntry<Frontmatter>[];
|
|
141
|
-
meta: MetaCollectionEntry<Meta>[];
|
|
142
|
-
toFumadocsSource: () => Source<{
|
|
143
|
-
pageData: AsyncDocCollectionEntry<Frontmatter>;
|
|
144
|
-
metaData: MetaCollectionEntry<Meta>;
|
|
145
|
-
}>;
|
|
146
|
-
}
|
|
147
|
-
type AwaitableGlobEntries<T> = Record<string, T | (() => Promise<T>)>;
|
|
148
|
-
type ServerCreate<Config> = ReturnType<typeof fromConfig<Config>>;
|
|
149
|
-
declare function fromConfig<Config>(): {
|
|
150
|
-
doc<Name extends keyof Config>(_name: Name, base: string, glob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends DocCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends StandardSchemaV1<unknown, unknown>, StandardSchemaV1<unknown, unknown>> ? DocCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
|
|
151
|
-
docLazy<Name extends keyof Config>(_name: Name, base: string, head: AwaitableGlobEntries<unknown>, body: Record<string, () => Promise<unknown>>): Promise<Config[Name] extends DocCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends StandardSchemaV1<unknown, unknown>, StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
|
|
152
|
-
meta<Name extends keyof Config>(_name: Name, base: string, glob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends MetaCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<StandardSchemaV1<unknown, unknown>, infer Schema extends StandardSchemaV1<unknown, unknown>> ? MetaCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
|
|
153
|
-
docs<Name extends keyof Config>(name: Name, base: string, metaGlob: AwaitableGlobEntries<unknown>, docGlob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends DocsCollection<infer Page extends StandardSchemaV1<unknown, unknown>, infer Meta extends StandardSchemaV1<unknown, unknown>> ? StandardSchemaV1.InferOutput<Page> extends PageData ? StandardSchemaV1.InferOutput<Meta> extends MetaData ? DocsCollectionEntry<StandardSchemaV1.InferOutput<Page>, StandardSchemaV1.InferOutput<Meta>> : never : never : never>;
|
|
154
|
-
docsLazy<Name extends keyof Config>(name: Name, base: string, metaGlob: AwaitableGlobEntries<unknown>, docHeadGlob: AwaitableGlobEntries<unknown>, docBodyGlob: Record<string, () => Promise<unknown>>): Promise<Config[Name] extends DocsCollection<infer Page extends StandardSchemaV1<unknown, unknown>, infer Meta extends StandardSchemaV1<unknown, unknown>> ? StandardSchemaV1.InferOutput<Page> extends PageData ? StandardSchemaV1.InferOutput<Meta> extends MetaData ? AsyncDocsCollectionEntry<StandardSchemaV1.InferOutput<Page>, StandardSchemaV1.InferOutput<Meta>> : never : never : never>;
|
|
155
|
-
};
|
|
156
|
-
declare function toFumadocsSource<Page extends DocMethods & PageData, Meta extends MetaMethods & MetaData>(pages: Page[], metas: Meta[]): Source<{
|
|
157
|
-
pageData: Page;
|
|
158
|
-
metaData: Meta;
|
|
159
|
-
}>;
|
|
160
|
-
|
|
161
|
-
export { type AsyncDocCollectionEntry, type AsyncDocsCollectionEntry, type CompiledMDXFile, type DocCollectionEntry, type DocData, type DocMethods, type DocsCollectionEntry, type FileInfo, type MetaCollectionEntry, type MetaMethods, type ServerCreate, fromConfig, toFumadocsSource };
|
|
11
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
12
|
+
import 'fumadocs-core/toc';
|
|
13
|
+
import 'mdast';
|
|
14
|
+
import 'mdx/types';
|
package/dist/runtime/server.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/runtime/types.ts
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins/remark-structure';
|
|
2
|
+
import { TOCItemType } from 'fumadocs-core/toc';
|
|
3
|
+
import { Root } from 'mdast';
|
|
4
|
+
import { MDXContent } from 'mdx/types';
|
|
5
|
+
|
|
6
|
+
interface DocData {
|
|
7
|
+
/**
|
|
8
|
+
* Compiled MDX content (as component)
|
|
9
|
+
*/
|
|
10
|
+
body: MDXContent;
|
|
11
|
+
/**
|
|
12
|
+
* table of contents generated from content.
|
|
13
|
+
*/
|
|
14
|
+
toc: TOCItemType[];
|
|
15
|
+
/**
|
|
16
|
+
* structured data for document search indexing.
|
|
17
|
+
*/
|
|
18
|
+
structuredData: StructuredData;
|
|
19
|
+
/**
|
|
20
|
+
* Raw exports from the compiled MDX file.
|
|
21
|
+
*/
|
|
22
|
+
_exports: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
interface FileInfo {
|
|
25
|
+
/**
|
|
26
|
+
* virtualized path for Source API
|
|
27
|
+
*/
|
|
28
|
+
path: string;
|
|
29
|
+
/**
|
|
30
|
+
* the file path in file system
|
|
31
|
+
*/
|
|
32
|
+
fullPath: string;
|
|
33
|
+
}
|
|
34
|
+
interface DocMethods {
|
|
35
|
+
/**
|
|
36
|
+
* file info
|
|
37
|
+
*/
|
|
38
|
+
info: FileInfo;
|
|
39
|
+
/**
|
|
40
|
+
* get document as text.
|
|
41
|
+
*
|
|
42
|
+
* - `type: raw` - read the original content from file system.
|
|
43
|
+
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
44
|
+
*/
|
|
45
|
+
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
46
|
+
getMDAST: () => Promise<Root>;
|
|
47
|
+
}
|
|
48
|
+
interface MetaMethods {
|
|
49
|
+
/**
|
|
50
|
+
* file info
|
|
51
|
+
*/
|
|
52
|
+
info: FileInfo;
|
|
53
|
+
}
|
|
54
|
+
interface InternalTypeConfig {
|
|
55
|
+
/**
|
|
56
|
+
* collection name -> collection properties
|
|
57
|
+
*/
|
|
58
|
+
DocData: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins/remark-structure';
|
|
2
|
+
import { TOCItemType } from 'fumadocs-core/toc';
|
|
3
|
+
import { Root } from 'mdast';
|
|
4
|
+
import { MDXContent } from 'mdx/types';
|
|
5
|
+
|
|
6
|
+
interface DocData {
|
|
7
|
+
/**
|
|
8
|
+
* Compiled MDX content (as component)
|
|
9
|
+
*/
|
|
10
|
+
body: MDXContent;
|
|
11
|
+
/**
|
|
12
|
+
* table of contents generated from content.
|
|
13
|
+
*/
|
|
14
|
+
toc: TOCItemType[];
|
|
15
|
+
/**
|
|
16
|
+
* structured data for document search indexing.
|
|
17
|
+
*/
|
|
18
|
+
structuredData: StructuredData;
|
|
19
|
+
/**
|
|
20
|
+
* Raw exports from the compiled MDX file.
|
|
21
|
+
*/
|
|
22
|
+
_exports: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
interface FileInfo {
|
|
25
|
+
/**
|
|
26
|
+
* virtualized path for Source API
|
|
27
|
+
*/
|
|
28
|
+
path: string;
|
|
29
|
+
/**
|
|
30
|
+
* the file path in file system
|
|
31
|
+
*/
|
|
32
|
+
fullPath: string;
|
|
33
|
+
}
|
|
34
|
+
interface DocMethods {
|
|
35
|
+
/**
|
|
36
|
+
* file info
|
|
37
|
+
*/
|
|
38
|
+
info: FileInfo;
|
|
39
|
+
/**
|
|
40
|
+
* get document as text.
|
|
41
|
+
*
|
|
42
|
+
* - `type: raw` - read the original content from file system.
|
|
43
|
+
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
44
|
+
*/
|
|
45
|
+
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
46
|
+
getMDAST: () => Promise<Root>;
|
|
47
|
+
}
|
|
48
|
+
interface MetaMethods {
|
|
49
|
+
/**
|
|
50
|
+
* file info
|
|
51
|
+
*/
|
|
52
|
+
info: FileInfo;
|
|
53
|
+
}
|
|
54
|
+
interface InternalTypeConfig {
|
|
55
|
+
/**
|
|
56
|
+
* collection name -> collection properties
|
|
57
|
+
*/
|
|
58
|
+
DocData: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };
|
|
File without changes
|