fumadocs-mdx 11.10.1 → 12.0.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/bin.cjs +29 -139
- package/dist/bin.js +1 -1
- package/dist/{browser-B2G8uAF2.d.cts → browser-D5lvL8vv.d.ts} +51 -4
- package/dist/{browser-DrH7tKRi.d.ts → browser-DjWADqp8.d.cts} +51 -4
- package/dist/bun/index.cjs +126 -108
- package/dist/bun/index.js +5 -5
- package/dist/chunk-3M4SHY6K.js +80 -0
- package/dist/{chunk-UOOPSLFY.js → chunk-AUOOMFAI.js} +27 -21
- package/dist/{chunk-QJCCVMBJ.js → chunk-KGUBBRL6.js} +11 -13
- package/dist/{chunk-SVTXMVLQ.js → chunk-KTDVTBMH.js} +1 -1
- package/dist/{chunk-766EAFX6.js → chunk-POXTQZ4D.js} +1 -31
- package/dist/chunk-SWNOXPYJ.js +142 -0
- package/dist/{chunk-XXSKWWMB.js → chunk-TLD6JMT6.js} +1 -1
- package/dist/{chunk-CNKI574E.js → chunk-VXEBLM4X.js} +1 -1
- package/dist/{chunk-QVZ7JH4H.js → chunk-YC25YEBF.js} +1 -1
- package/dist/chunk-ZLCSVXCD.js +10 -0
- package/dist/config/index.cjs +18 -97
- package/dist/config/index.d.cts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +48 -9
- package/dist/{define-BH4bnHQl.d.ts → define--6HQ1ehX.d.cts} +18 -3
- package/dist/{define-BH4bnHQl.d.cts → define--6HQ1ehX.d.ts} +18 -3
- package/dist/loader-mdx.cjs +127 -139
- package/dist/loader-mdx.js +6 -6
- package/dist/next/index.cjs +29 -139
- package/dist/next/index.js +16 -16
- package/dist/node/loader.cjs +131 -143
- package/dist/node/loader.js +6 -6
- package/dist/postinstall-U7VROOY7.js +9 -0
- package/dist/{mdx-options-T73E4LQB.js → preset-WFEORCAB.js} +1 -1
- package/dist/runtime/next/async.cjs +198 -150
- package/dist/runtime/next/async.d.cts +3 -3
- package/dist/runtime/next/async.d.ts +3 -3
- package/dist/runtime/next/async.js +50 -30
- package/dist/runtime/next/index.cjs +32 -21
- package/dist/runtime/next/index.d.cts +11 -7
- package/dist/runtime/next/index.d.ts +11 -7
- package/dist/runtime/next/index.js +2 -1
- package/dist/runtime/vite/browser.d.cts +2 -3
- package/dist/runtime/vite/browser.d.ts +2 -3
- package/dist/runtime/vite/server.cjs +67 -21
- package/dist/runtime/vite/server.d.cts +14 -28
- package/dist/runtime/vite/server.d.ts +14 -28
- package/dist/runtime/vite/server.js +61 -21
- package/dist/shared-0QIuV0XZ.d.ts +70 -0
- package/dist/shared-CqgMnt9h.d.cts +70 -0
- package/dist/{types-DN9KrG7R.d.ts → types-DLIAvrgC.d.ts} +6 -32
- package/dist/{types-DT83Ijs6.d.cts → types-Dl8HLbm5.d.cts} +6 -32
- package/dist/vite/index.cjs +131 -143
- package/dist/vite/index.js +7 -7
- package/package.json +2 -6
- package/dist/build-mdx-DnC1jKvn.d.cts +0 -46
- package/dist/build-mdx-DnC1jKvn.d.ts +0 -46
- package/dist/chunk-GBMFGEC7.js +0 -57
- package/dist/chunk-QQWCBFFE.js +0 -40
- package/dist/chunk-SMSNZ6N5.js +0 -155
- package/dist/config/zod-3.cjs +0 -422
- package/dist/config/zod-3.d.cts +0 -53
- package/dist/config/zod-3.d.ts +0 -53
- package/dist/config/zod-3.js +0 -40
- package/dist/postinstall-XV4WSHZP.js +0 -9
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
|
|
2
|
-
import { R as Runtime
|
|
2
|
+
import { R as Runtime } from '../../types-Dl8HLbm5.cjs';
|
|
3
|
+
export { b as AsyncDocOut, A as AsyncRuntimeFile, D as DocOut, M as MetaOut, c as RuntimeAsync, a as RuntimeFile } from '../../types-Dl8HLbm5.cjs';
|
|
4
|
+
import { F as FileInfo } from '../../shared-CqgMnt9h.cjs';
|
|
3
5
|
import '@standard-schema/spec';
|
|
4
|
-
import '../../define
|
|
6
|
+
import '../../define--6HQ1ehX.cjs';
|
|
5
7
|
import 'fumadocs-core/mdx-plugins';
|
|
6
8
|
import '@mdx-js/mdx';
|
|
7
9
|
import 'unified';
|
|
8
10
|
import 'zod';
|
|
9
|
-
import '../../build-mdx-DnC1jKvn.cjs';
|
|
10
11
|
import 'fumadocs-core/server';
|
|
11
12
|
import 'react';
|
|
12
13
|
import 'mdx/types';
|
|
13
14
|
|
|
14
15
|
declare const _runtime: Runtime;
|
|
15
|
-
|
|
16
|
+
interface AnyCollectionEntry {
|
|
17
|
+
info: FileInfo;
|
|
18
|
+
}
|
|
19
|
+
declare function createMDXSource<Doc extends PageData & AnyCollectionEntry, Meta extends MetaData & AnyCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
|
|
16
20
|
pageData: Doc;
|
|
17
21
|
metaData: Meta;
|
|
18
22
|
}>;
|
|
19
23
|
interface ResolveOptions {
|
|
20
|
-
docs:
|
|
21
|
-
meta:
|
|
24
|
+
docs: AnyCollectionEntry[];
|
|
25
|
+
meta: AnyCollectionEntry[];
|
|
22
26
|
rootDir?: string;
|
|
23
27
|
}
|
|
24
28
|
declare function resolveFiles({ docs, meta }: ResolveOptions): VirtualFile[];
|
|
25
29
|
|
|
26
|
-
export { _runtime, createMDXSource, resolveFiles };
|
|
30
|
+
export { type AnyCollectionEntry, Runtime, _runtime, createMDXSource, resolveFiles };
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
|
|
2
|
-
import { R as Runtime
|
|
2
|
+
import { R as Runtime } from '../../types-DLIAvrgC.js';
|
|
3
|
+
export { b as AsyncDocOut, A as AsyncRuntimeFile, D as DocOut, M as MetaOut, c as RuntimeAsync, a as RuntimeFile } from '../../types-DLIAvrgC.js';
|
|
4
|
+
import { F as FileInfo } from '../../shared-0QIuV0XZ.js';
|
|
3
5
|
import '@standard-schema/spec';
|
|
4
|
-
import '../../define
|
|
6
|
+
import '../../define--6HQ1ehX.js';
|
|
5
7
|
import 'fumadocs-core/mdx-plugins';
|
|
6
8
|
import '@mdx-js/mdx';
|
|
7
9
|
import 'unified';
|
|
8
10
|
import 'zod';
|
|
9
|
-
import '../../build-mdx-DnC1jKvn.js';
|
|
10
11
|
import 'fumadocs-core/server';
|
|
11
12
|
import 'react';
|
|
12
13
|
import 'mdx/types';
|
|
13
14
|
|
|
14
15
|
declare const _runtime: Runtime;
|
|
15
|
-
|
|
16
|
+
interface AnyCollectionEntry {
|
|
17
|
+
info: FileInfo;
|
|
18
|
+
}
|
|
19
|
+
declare function createMDXSource<Doc extends PageData & AnyCollectionEntry, Meta extends MetaData & AnyCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
|
|
16
20
|
pageData: Doc;
|
|
17
21
|
metaData: Meta;
|
|
18
22
|
}>;
|
|
19
23
|
interface ResolveOptions {
|
|
20
|
-
docs:
|
|
21
|
-
meta:
|
|
24
|
+
docs: AnyCollectionEntry[];
|
|
25
|
+
meta: AnyCollectionEntry[];
|
|
22
26
|
rootDir?: string;
|
|
23
27
|
}
|
|
24
28
|
declare function resolveFiles({ docs, meta }: ResolveOptions): VirtualFile[];
|
|
25
29
|
|
|
26
|
-
export { _runtime, createMDXSource, resolveFiles };
|
|
30
|
+
export { type AnyCollectionEntry, Runtime, _runtime, createMDXSource, resolveFiles };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as ClientLoader, a as ClientLoaderOptions, c as createClientLoader, f as fromConfig, t as toClientRenderer } from '../../browser-DjWADqp8.cjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../../build-mdx-DnC1jKvn.cjs';
|
|
4
3
|
import '@mdx-js/mdx';
|
|
5
4
|
import 'fumadocs-core/mdx-plugins';
|
|
6
5
|
import 'fumadocs-core/server';
|
|
7
6
|
import 'mdx/types';
|
|
8
|
-
import '../../define
|
|
7
|
+
import '../../define--6HQ1ehX.cjs';
|
|
9
8
|
import '@standard-schema/spec';
|
|
10
9
|
import 'unified';
|
|
11
10
|
import 'zod';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as ClientLoader, a as ClientLoaderOptions, c as createClientLoader, f as fromConfig, t as toClientRenderer } from '../../browser-D5lvL8vv.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../../build-mdx-DnC1jKvn.js';
|
|
4
3
|
import '@mdx-js/mdx';
|
|
5
4
|
import 'fumadocs-core/mdx-plugins';
|
|
6
5
|
import 'fumadocs-core/server';
|
|
7
6
|
import 'mdx/types';
|
|
8
|
-
import '../../define
|
|
7
|
+
import '../../define--6HQ1ehX.js';
|
|
9
8
|
import '@standard-schema/spec';
|
|
10
9
|
import 'unified';
|
|
11
10
|
import 'zod';
|
|
@@ -67,6 +67,16 @@ function fromConfigBase() {
|
|
|
67
67
|
// src/runtime/vite/server.ts
|
|
68
68
|
var path = __toESM(require("path"), 1);
|
|
69
69
|
|
|
70
|
+
// src/runtime/shared.ts
|
|
71
|
+
function missingProcessedMarkdown() {
|
|
72
|
+
throw new Error(
|
|
73
|
+
"getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/runtime/vite/server.ts
|
|
78
|
+
var import_promises = __toESM(require("fs/promises"), 1);
|
|
79
|
+
|
|
70
80
|
// src/runtime/vite/browser.ts
|
|
71
81
|
var import_react = require("react");
|
|
72
82
|
var loaderStore = /* @__PURE__ */ new Map();
|
|
@@ -112,45 +122,79 @@ function toClientRenderer(files, component) {
|
|
|
112
122
|
// src/runtime/vite/server.ts
|
|
113
123
|
function fromConfig() {
|
|
114
124
|
const base = fromConfigBase();
|
|
115
|
-
function
|
|
116
|
-
|
|
125
|
+
function fileInfo(file, base2) {
|
|
126
|
+
return {
|
|
127
|
+
path: file,
|
|
128
|
+
fullPath: path.join(base2, file)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function mapDocData(entry) {
|
|
117
132
|
return {
|
|
118
|
-
...frontmatter,
|
|
119
|
-
default: entry.default,
|
|
120
133
|
body: entry.default,
|
|
121
|
-
toc,
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
toc: entry.toc,
|
|
135
|
+
extractedReferences: entry.extractedReferences,
|
|
136
|
+
structuredData: entry.structuredData,
|
|
137
|
+
lastModified: entry.lastModified,
|
|
124
138
|
_exports: entry
|
|
125
139
|
};
|
|
126
140
|
}
|
|
127
|
-
function
|
|
141
|
+
function mapPageData(info, entry) {
|
|
142
|
+
return {
|
|
143
|
+
...mapDocData(entry),
|
|
144
|
+
info,
|
|
145
|
+
async getText(type) {
|
|
146
|
+
if (type === "raw") {
|
|
147
|
+
return (await import_promises.default.readFile(info.fullPath)).toString();
|
|
148
|
+
}
|
|
149
|
+
if (typeof entry._markdown !== "string") missingProcessedMarkdown();
|
|
150
|
+
return entry._markdown;
|
|
151
|
+
},
|
|
152
|
+
...entry.frontmatter
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function mapPageDataLazy(info, head, content) {
|
|
128
156
|
return {
|
|
129
157
|
...head,
|
|
158
|
+
info,
|
|
130
159
|
async load() {
|
|
131
|
-
|
|
132
|
-
|
|
160
|
+
return mapDocData(await content());
|
|
161
|
+
},
|
|
162
|
+
async getText(type) {
|
|
163
|
+
if (type === "raw") {
|
|
164
|
+
return (await import_promises.default.readFile(info.fullPath)).toString();
|
|
165
|
+
}
|
|
166
|
+
const entry = await content();
|
|
167
|
+
if (typeof entry._markdown !== "string") missingProcessedMarkdown();
|
|
168
|
+
return entry._markdown;
|
|
133
169
|
}
|
|
134
170
|
};
|
|
135
171
|
}
|
|
172
|
+
function mapMetaData(info, content) {
|
|
173
|
+
return {
|
|
174
|
+
info,
|
|
175
|
+
...content
|
|
176
|
+
};
|
|
177
|
+
}
|
|
136
178
|
return {
|
|
137
179
|
...base,
|
|
138
180
|
async sourceAsync(doc, meta) {
|
|
139
181
|
const virtualFiles = [
|
|
140
182
|
...Object.entries(doc).map(async ([file, content]) => {
|
|
183
|
+
const info = fileInfo(file, content.base);
|
|
141
184
|
return {
|
|
142
185
|
type: "page",
|
|
143
186
|
path: file,
|
|
144
|
-
absolutePath:
|
|
145
|
-
data: mapPageData(await content())
|
|
187
|
+
absolutePath: info.fullPath,
|
|
188
|
+
data: mapPageData(info, await content())
|
|
146
189
|
};
|
|
147
190
|
}),
|
|
148
191
|
...Object.entries(meta).map(async ([file, content]) => {
|
|
192
|
+
const info = fileInfo(file, content.base);
|
|
149
193
|
return {
|
|
150
194
|
type: "meta",
|
|
151
|
-
path:
|
|
152
|
-
absolutePath:
|
|
153
|
-
data: await content()
|
|
195
|
+
path: info.path,
|
|
196
|
+
absolutePath: info.fullPath,
|
|
197
|
+
data: mapMetaData(info, await content())
|
|
154
198
|
};
|
|
155
199
|
})
|
|
156
200
|
];
|
|
@@ -159,19 +203,21 @@ function fromConfig() {
|
|
|
159
203
|
async sourceLazy(doc, meta) {
|
|
160
204
|
const virtualFiles = [
|
|
161
205
|
...Object.entries(doc.head).map(async ([file, frontmatter]) => {
|
|
206
|
+
const info = fileInfo(file, doc.base);
|
|
162
207
|
return {
|
|
163
208
|
type: "page",
|
|
164
|
-
path:
|
|
165
|
-
absolutePath:
|
|
166
|
-
data: mapPageDataLazy(await frontmatter(), doc.body[file])
|
|
209
|
+
path: info.path,
|
|
210
|
+
absolutePath: info.fullPath,
|
|
211
|
+
data: mapPageDataLazy(info, await frontmatter(), doc.body[file])
|
|
167
212
|
};
|
|
168
213
|
}),
|
|
169
214
|
...Object.entries(meta).map(async ([file, content]) => {
|
|
215
|
+
const info = fileInfo(file, content.base);
|
|
170
216
|
return {
|
|
171
217
|
type: "meta",
|
|
172
|
-
path:
|
|
173
|
-
absolutePath:
|
|
174
|
-
data: await content()
|
|
218
|
+
path: info.path,
|
|
219
|
+
absolutePath: info.fullPath,
|
|
220
|
+
data: mapMetaData(info, await content())
|
|
175
221
|
};
|
|
176
222
|
})
|
|
177
223
|
];
|
|
@@ -1,41 +1,27 @@
|
|
|
1
|
-
import { B as BaseCreate, D as DocMap, M as MetaMap, L as LazyDocMap
|
|
2
|
-
export {
|
|
1
|
+
import { B as BaseCreate, D as DocMap, M as MetaMap, L as LazyDocMap } from '../../browser-DjWADqp8.cjs';
|
|
2
|
+
export { C as ClientLoader, a as ClientLoaderOptions, b as CompiledMDXFile, c as createClientLoader, t as toClientRenderer } from '../../browser-DjWADqp8.cjs';
|
|
3
3
|
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
4
|
-
import {
|
|
5
|
-
import { FC } from 'react';
|
|
6
|
-
import { MDXProps } from 'mdx/types';
|
|
7
|
-
import '../../define-BH4bnHQl.cjs';
|
|
8
|
-
import '@standard-schema/spec';
|
|
9
|
-
import 'fumadocs-core/mdx-plugins';
|
|
4
|
+
import { D as DocCollectionEntry, M as MetaCollectionEntry, A as AsyncDocCollectionEntry } from '../../shared-CqgMnt9h.cjs';
|
|
10
5
|
import '@mdx-js/mdx';
|
|
6
|
+
import 'fumadocs-core/mdx-plugins';
|
|
7
|
+
import 'fumadocs-core/server';
|
|
8
|
+
import 'react';
|
|
9
|
+
import 'mdx/types';
|
|
10
|
+
import '../../define--6HQ1ehX.cjs';
|
|
11
|
+
import '@standard-schema/spec';
|
|
11
12
|
import 'unified';
|
|
12
13
|
import 'zod';
|
|
13
|
-
import 'fumadocs-core/server';
|
|
14
14
|
|
|
15
|
-
type Override<A, B> = Omit<A, keyof B> & B;
|
|
16
|
-
type MDXFileToPageData<Frontmatter> = Override<Omit<CompiledMDXProperties<Frontmatter>, 'frontmatter' | 'default'>, Frontmatter & {
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated use `body` instead.
|
|
19
|
-
*/
|
|
20
|
-
default: FC<MDXProps>;
|
|
21
|
-
_exports: Record<string, unknown>;
|
|
22
|
-
body: FC<MDXProps>;
|
|
23
|
-
}>;
|
|
24
|
-
type MDXFileToPageDataLazy<Frontmatter> = Override<Frontmatter, {
|
|
25
|
-
load: () => Promise<Omit<CompiledMDXFile<Frontmatter>, 'default'> & {
|
|
26
|
-
body: FC<MDXProps>;
|
|
27
|
-
}>;
|
|
28
|
-
}>;
|
|
29
15
|
interface ServerCreate<Config> extends BaseCreate<Config> {
|
|
30
16
|
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: DocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
31
|
-
pageData:
|
|
32
|
-
metaData: MetaOut
|
|
17
|
+
pageData: DocCollectionEntry<DocOut>;
|
|
18
|
+
metaData: MetaCollectionEntry<MetaOut>;
|
|
33
19
|
}>>;
|
|
34
20
|
sourceLazy: <DocOut extends PageData, MetaOut extends MetaData>(doc: LazyDocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
35
|
-
pageData:
|
|
36
|
-
metaData: MetaOut
|
|
21
|
+
pageData: AsyncDocCollectionEntry<DocOut>;
|
|
22
|
+
metaData: MetaCollectionEntry<MetaOut>;
|
|
37
23
|
}>>;
|
|
38
24
|
}
|
|
39
25
|
declare function fromConfig<Config>(): ServerCreate<Config>;
|
|
40
26
|
|
|
41
|
-
export {
|
|
27
|
+
export { type ServerCreate, fromConfig };
|
|
@@ -1,41 +1,27 @@
|
|
|
1
|
-
import { B as BaseCreate, D as DocMap, M as MetaMap, L as LazyDocMap
|
|
2
|
-
export {
|
|
1
|
+
import { B as BaseCreate, D as DocMap, M as MetaMap, L as LazyDocMap } from '../../browser-D5lvL8vv.js';
|
|
2
|
+
export { C as ClientLoader, a as ClientLoaderOptions, b as CompiledMDXFile, c as createClientLoader, t as toClientRenderer } from '../../browser-D5lvL8vv.js';
|
|
3
3
|
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
4
|
-
import {
|
|
5
|
-
import { FC } from 'react';
|
|
6
|
-
import { MDXProps } from 'mdx/types';
|
|
7
|
-
import '../../define-BH4bnHQl.js';
|
|
8
|
-
import '@standard-schema/spec';
|
|
9
|
-
import 'fumadocs-core/mdx-plugins';
|
|
4
|
+
import { D as DocCollectionEntry, M as MetaCollectionEntry, A as AsyncDocCollectionEntry } from '../../shared-0QIuV0XZ.js';
|
|
10
5
|
import '@mdx-js/mdx';
|
|
6
|
+
import 'fumadocs-core/mdx-plugins';
|
|
7
|
+
import 'fumadocs-core/server';
|
|
8
|
+
import 'react';
|
|
9
|
+
import 'mdx/types';
|
|
10
|
+
import '../../define--6HQ1ehX.js';
|
|
11
|
+
import '@standard-schema/spec';
|
|
11
12
|
import 'unified';
|
|
12
13
|
import 'zod';
|
|
13
|
-
import 'fumadocs-core/server';
|
|
14
14
|
|
|
15
|
-
type Override<A, B> = Omit<A, keyof B> & B;
|
|
16
|
-
type MDXFileToPageData<Frontmatter> = Override<Omit<CompiledMDXProperties<Frontmatter>, 'frontmatter' | 'default'>, Frontmatter & {
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated use `body` instead.
|
|
19
|
-
*/
|
|
20
|
-
default: FC<MDXProps>;
|
|
21
|
-
_exports: Record<string, unknown>;
|
|
22
|
-
body: FC<MDXProps>;
|
|
23
|
-
}>;
|
|
24
|
-
type MDXFileToPageDataLazy<Frontmatter> = Override<Frontmatter, {
|
|
25
|
-
load: () => Promise<Omit<CompiledMDXFile<Frontmatter>, 'default'> & {
|
|
26
|
-
body: FC<MDXProps>;
|
|
27
|
-
}>;
|
|
28
|
-
}>;
|
|
29
15
|
interface ServerCreate<Config> extends BaseCreate<Config> {
|
|
30
16
|
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: DocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
31
|
-
pageData:
|
|
32
|
-
metaData: MetaOut
|
|
17
|
+
pageData: DocCollectionEntry<DocOut>;
|
|
18
|
+
metaData: MetaCollectionEntry<MetaOut>;
|
|
33
19
|
}>>;
|
|
34
20
|
sourceLazy: <DocOut extends PageData, MetaOut extends MetaData>(doc: LazyDocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
35
|
-
pageData:
|
|
36
|
-
metaData: MetaOut
|
|
21
|
+
pageData: AsyncDocCollectionEntry<DocOut>;
|
|
22
|
+
metaData: MetaCollectionEntry<MetaOut>;
|
|
37
23
|
}>>;
|
|
38
24
|
}
|
|
39
25
|
declare function fromConfig<Config>(): ServerCreate<Config>;
|
|
40
26
|
|
|
41
|
-
export {
|
|
27
|
+
export { type ServerCreate, fromConfig };
|
|
@@ -3,50 +3,88 @@ import {
|
|
|
3
3
|
fromConfigBase,
|
|
4
4
|
toClientRenderer
|
|
5
5
|
} from "../../chunk-46UPKP5R.js";
|
|
6
|
+
import {
|
|
7
|
+
missingProcessedMarkdown
|
|
8
|
+
} from "../../chunk-ZLCSVXCD.js";
|
|
6
9
|
|
|
7
10
|
// src/runtime/vite/server.ts
|
|
8
11
|
import * as path from "path";
|
|
12
|
+
import fs from "fs/promises";
|
|
9
13
|
function fromConfig() {
|
|
10
14
|
const base = fromConfigBase();
|
|
11
|
-
function
|
|
12
|
-
|
|
15
|
+
function fileInfo(file, base2) {
|
|
16
|
+
return {
|
|
17
|
+
path: file,
|
|
18
|
+
fullPath: path.join(base2, file)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function mapDocData(entry) {
|
|
13
22
|
return {
|
|
14
|
-
...frontmatter,
|
|
15
|
-
default: entry.default,
|
|
16
23
|
body: entry.default,
|
|
17
|
-
toc,
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
toc: entry.toc,
|
|
25
|
+
extractedReferences: entry.extractedReferences,
|
|
26
|
+
structuredData: entry.structuredData,
|
|
27
|
+
lastModified: entry.lastModified,
|
|
20
28
|
_exports: entry
|
|
21
29
|
};
|
|
22
30
|
}
|
|
23
|
-
function
|
|
31
|
+
function mapPageData(info, entry) {
|
|
32
|
+
return {
|
|
33
|
+
...mapDocData(entry),
|
|
34
|
+
info,
|
|
35
|
+
async getText(type) {
|
|
36
|
+
if (type === "raw") {
|
|
37
|
+
return (await fs.readFile(info.fullPath)).toString();
|
|
38
|
+
}
|
|
39
|
+
if (typeof entry._markdown !== "string") missingProcessedMarkdown();
|
|
40
|
+
return entry._markdown;
|
|
41
|
+
},
|
|
42
|
+
...entry.frontmatter
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function mapPageDataLazy(info, head, content) {
|
|
24
46
|
return {
|
|
25
47
|
...head,
|
|
48
|
+
info,
|
|
26
49
|
async load() {
|
|
27
|
-
|
|
28
|
-
|
|
50
|
+
return mapDocData(await content());
|
|
51
|
+
},
|
|
52
|
+
async getText(type) {
|
|
53
|
+
if (type === "raw") {
|
|
54
|
+
return (await fs.readFile(info.fullPath)).toString();
|
|
55
|
+
}
|
|
56
|
+
const entry = await content();
|
|
57
|
+
if (typeof entry._markdown !== "string") missingProcessedMarkdown();
|
|
58
|
+
return entry._markdown;
|
|
29
59
|
}
|
|
30
60
|
};
|
|
31
61
|
}
|
|
62
|
+
function mapMetaData(info, content) {
|
|
63
|
+
return {
|
|
64
|
+
info,
|
|
65
|
+
...content
|
|
66
|
+
};
|
|
67
|
+
}
|
|
32
68
|
return {
|
|
33
69
|
...base,
|
|
34
70
|
async sourceAsync(doc, meta) {
|
|
35
71
|
const virtualFiles = [
|
|
36
72
|
...Object.entries(doc).map(async ([file, content]) => {
|
|
73
|
+
const info = fileInfo(file, content.base);
|
|
37
74
|
return {
|
|
38
75
|
type: "page",
|
|
39
76
|
path: file,
|
|
40
|
-
absolutePath:
|
|
41
|
-
data: mapPageData(await content())
|
|
77
|
+
absolutePath: info.fullPath,
|
|
78
|
+
data: mapPageData(info, await content())
|
|
42
79
|
};
|
|
43
80
|
}),
|
|
44
81
|
...Object.entries(meta).map(async ([file, content]) => {
|
|
82
|
+
const info = fileInfo(file, content.base);
|
|
45
83
|
return {
|
|
46
84
|
type: "meta",
|
|
47
|
-
path:
|
|
48
|
-
absolutePath:
|
|
49
|
-
data: await content()
|
|
85
|
+
path: info.path,
|
|
86
|
+
absolutePath: info.fullPath,
|
|
87
|
+
data: mapMetaData(info, await content())
|
|
50
88
|
};
|
|
51
89
|
})
|
|
52
90
|
];
|
|
@@ -55,19 +93,21 @@ function fromConfig() {
|
|
|
55
93
|
async sourceLazy(doc, meta) {
|
|
56
94
|
const virtualFiles = [
|
|
57
95
|
...Object.entries(doc.head).map(async ([file, frontmatter]) => {
|
|
96
|
+
const info = fileInfo(file, doc.base);
|
|
58
97
|
return {
|
|
59
98
|
type: "page",
|
|
60
|
-
path:
|
|
61
|
-
absolutePath:
|
|
62
|
-
data: mapPageDataLazy(await frontmatter(), doc.body[file])
|
|
99
|
+
path: info.path,
|
|
100
|
+
absolutePath: info.fullPath,
|
|
101
|
+
data: mapPageDataLazy(info, await frontmatter(), doc.body[file])
|
|
63
102
|
};
|
|
64
103
|
}),
|
|
65
104
|
...Object.entries(meta).map(async ([file, content]) => {
|
|
105
|
+
const info = fileInfo(file, content.base);
|
|
66
106
|
return {
|
|
67
107
|
type: "meta",
|
|
68
|
-
path:
|
|
69
|
-
absolutePath:
|
|
70
|
-
data: await content()
|
|
108
|
+
path: info.path,
|
|
109
|
+
absolutePath: info.fullPath,
|
|
110
|
+
data: mapMetaData(info, await content())
|
|
71
111
|
};
|
|
72
112
|
})
|
|
73
113
|
];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
2
|
+
import { TableOfContents } from 'fumadocs-core/server';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
import { MDXProps } from 'mdx/types';
|
|
5
|
+
import { E as ExtractedReference } from './define--6HQ1ehX.js';
|
|
6
|
+
|
|
7
|
+
interface FileInfo {
|
|
8
|
+
/**
|
|
9
|
+
* virtualized path for Source API
|
|
10
|
+
*/
|
|
11
|
+
path: string;
|
|
12
|
+
/**
|
|
13
|
+
* the file path in file system
|
|
14
|
+
*/
|
|
15
|
+
fullPath: string;
|
|
16
|
+
}
|
|
17
|
+
interface DocData {
|
|
18
|
+
/**
|
|
19
|
+
* Compiled MDX content (as component)
|
|
20
|
+
*/
|
|
21
|
+
body: FC<MDXProps>;
|
|
22
|
+
/**
|
|
23
|
+
* table of contents generated from content.
|
|
24
|
+
*/
|
|
25
|
+
toc: TableOfContents;
|
|
26
|
+
/**
|
|
27
|
+
* structured data for document search indexing.
|
|
28
|
+
*/
|
|
29
|
+
structuredData: StructuredData;
|
|
30
|
+
/**
|
|
31
|
+
* Raw exports from the compiled MDX file.
|
|
32
|
+
*/
|
|
33
|
+
_exports: Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Last modified date of document file, obtained from version control.
|
|
36
|
+
*
|
|
37
|
+
* Only available when `lastModifiedTime` is enabled on global config.
|
|
38
|
+
*/
|
|
39
|
+
lastModified?: Date;
|
|
40
|
+
/**
|
|
41
|
+
* extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
|
|
42
|
+
*/
|
|
43
|
+
extractedReferences?: ExtractedReference[];
|
|
44
|
+
}
|
|
45
|
+
interface DocMethods {
|
|
46
|
+
/**
|
|
47
|
+
* file info
|
|
48
|
+
*/
|
|
49
|
+
info: FileInfo;
|
|
50
|
+
/**
|
|
51
|
+
* get document as text.
|
|
52
|
+
*
|
|
53
|
+
* - `type: raw` - read the original content from file system.
|
|
54
|
+
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
55
|
+
*/
|
|
56
|
+
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
57
|
+
}
|
|
58
|
+
type MetaCollectionEntry<Data> = Data & {
|
|
59
|
+
/**
|
|
60
|
+
* file info
|
|
61
|
+
*/
|
|
62
|
+
info: FileInfo;
|
|
63
|
+
};
|
|
64
|
+
type DocCollectionEntry<Frontmatter> = Override<DocData & DocMethods, Frontmatter>;
|
|
65
|
+
type AsyncDocCollectionEntry<Frontmatter> = Override<DocMethods & {
|
|
66
|
+
load: () => Promise<DocData>;
|
|
67
|
+
}, Frontmatter>;
|
|
68
|
+
type Override<A, B> = Omit<A, keyof B> & B;
|
|
69
|
+
|
|
70
|
+
export type { AsyncDocCollectionEntry as A, DocCollectionEntry as D, FileInfo as F, MetaCollectionEntry as M };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
2
|
+
import { TableOfContents } from 'fumadocs-core/server';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
import { MDXProps } from 'mdx/types';
|
|
5
|
+
import { E as ExtractedReference } from './define--6HQ1ehX.cjs';
|
|
6
|
+
|
|
7
|
+
interface FileInfo {
|
|
8
|
+
/**
|
|
9
|
+
* virtualized path for Source API
|
|
10
|
+
*/
|
|
11
|
+
path: string;
|
|
12
|
+
/**
|
|
13
|
+
* the file path in file system
|
|
14
|
+
*/
|
|
15
|
+
fullPath: string;
|
|
16
|
+
}
|
|
17
|
+
interface DocData {
|
|
18
|
+
/**
|
|
19
|
+
* Compiled MDX content (as component)
|
|
20
|
+
*/
|
|
21
|
+
body: FC<MDXProps>;
|
|
22
|
+
/**
|
|
23
|
+
* table of contents generated from content.
|
|
24
|
+
*/
|
|
25
|
+
toc: TableOfContents;
|
|
26
|
+
/**
|
|
27
|
+
* structured data for document search indexing.
|
|
28
|
+
*/
|
|
29
|
+
structuredData: StructuredData;
|
|
30
|
+
/**
|
|
31
|
+
* Raw exports from the compiled MDX file.
|
|
32
|
+
*/
|
|
33
|
+
_exports: Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Last modified date of document file, obtained from version control.
|
|
36
|
+
*
|
|
37
|
+
* Only available when `lastModifiedTime` is enabled on global config.
|
|
38
|
+
*/
|
|
39
|
+
lastModified?: Date;
|
|
40
|
+
/**
|
|
41
|
+
* extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
|
|
42
|
+
*/
|
|
43
|
+
extractedReferences?: ExtractedReference[];
|
|
44
|
+
}
|
|
45
|
+
interface DocMethods {
|
|
46
|
+
/**
|
|
47
|
+
* file info
|
|
48
|
+
*/
|
|
49
|
+
info: FileInfo;
|
|
50
|
+
/**
|
|
51
|
+
* get document as text.
|
|
52
|
+
*
|
|
53
|
+
* - `type: raw` - read the original content from file system.
|
|
54
|
+
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
55
|
+
*/
|
|
56
|
+
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
57
|
+
}
|
|
58
|
+
type MetaCollectionEntry<Data> = Data & {
|
|
59
|
+
/**
|
|
60
|
+
* file info
|
|
61
|
+
*/
|
|
62
|
+
info: FileInfo;
|
|
63
|
+
};
|
|
64
|
+
type DocCollectionEntry<Frontmatter> = Override<DocData & DocMethods, Frontmatter>;
|
|
65
|
+
type AsyncDocCollectionEntry<Frontmatter> = Override<DocMethods & {
|
|
66
|
+
load: () => Promise<DocData>;
|
|
67
|
+
}, Frontmatter>;
|
|
68
|
+
type Override<A, B> = Omit<A, keyof B> & B;
|
|
69
|
+
|
|
70
|
+
export type { AsyncDocCollectionEntry as A, DocCollectionEntry as D, FileInfo as F, MetaCollectionEntry as M };
|