fumadocs-mdx 11.6.11 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-64MMPGML.js → chunk-2CSSQTP6.js} +1 -10
- package/dist/{chunk-SXOJYWZ3.js → chunk-2KBRPMAM.js} +1 -1
- package/dist/{chunk-6PDS7MUA.js → chunk-C5INPAZJ.js} +4 -4
- package/dist/{chunk-DRVUBK5B.js → chunk-GWR7KMRU.js} +13 -1
- package/dist/chunk-JPPCALFT.js +34 -0
- package/dist/{chunk-22SBT5SQ.js → chunk-ZOWJF3OH.js} +6 -6
- package/dist/config/index.cjs +5 -18
- package/dist/config/index.d.cts +3 -7
- package/dist/config/index.d.ts +3 -7
- package/dist/config/index.js +8 -12
- package/dist/{types-DVeuYiq5.d.cts → define-CCrinVBZ.d.cts} +37 -119
- package/dist/{types-DVeuYiq5.d.ts → define-CCrinVBZ.d.ts} +37 -119
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/loader-mdx.cjs +155 -134
- package/dist/loader-mdx.js +7 -10
- package/dist/mdx-options-UDV5WEFU.js +6 -0
- package/dist/next/index.cjs +196 -53
- package/dist/next/index.js +7 -30
- package/dist/runtime/async.cjs +167 -15
- package/dist/runtime/async.d.cts +5 -6
- package/dist/runtime/async.d.ts +5 -6
- package/dist/runtime/async.js +24 -15
- package/dist/runtime/vite.cjs +116 -0
- package/dist/runtime/vite.d.cts +47 -0
- package/dist/runtime/vite.d.ts +47 -0
- package/dist/runtime/vite.js +90 -0
- package/dist/{types-HIdjlLo0.d.ts → types-C0bKwtAx.d.ts} +38 -50
- package/dist/{types-BcUhOIxN.d.cts → types-CnslxmoO.d.cts} +38 -50
- package/dist/vite/index.cjs +384 -137
- package/dist/vite/index.d.cts +12 -3
- package/dist/vite/index.d.ts +12 -3
- package/dist/vite/index.js +176 -20
- package/package.json +19 -9
package/dist/runtime/async.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "../chunk-NUDEC6C5.js";
|
|
5
5
|
import {
|
|
6
6
|
buildConfig
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-GWR7KMRU.js";
|
|
8
8
|
import {
|
|
9
9
|
remarkInclude
|
|
10
10
|
} from "../chunk-AVMO2SRO.js";
|
|
@@ -16,23 +16,32 @@ import {
|
|
|
16
16
|
remarkStructure
|
|
17
17
|
} from "fumadocs-core/mdx-plugins";
|
|
18
18
|
async function initCompiler(config, collection) {
|
|
19
|
-
let mdxOptions;
|
|
20
19
|
const col = config.collections.get(collection);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
switch (col?.type) {
|
|
21
|
+
case "doc":
|
|
22
|
+
if (col.mdxOptions)
|
|
23
|
+
return createCompiler({
|
|
24
|
+
preset: "minimal",
|
|
25
|
+
...col.mdxOptions
|
|
26
|
+
});
|
|
27
|
+
break;
|
|
28
|
+
case "docs":
|
|
29
|
+
if (col.docs.mdxOptions)
|
|
30
|
+
return createCompiler({
|
|
31
|
+
preset: "minimal",
|
|
32
|
+
...col.docs.mdxOptions
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
32
35
|
}
|
|
33
|
-
|
|
36
|
+
let defaultMdxOptions = config.global?.mdxOptions;
|
|
37
|
+
if (typeof defaultMdxOptions === "function")
|
|
38
|
+
defaultMdxOptions = await defaultMdxOptions();
|
|
39
|
+
if (defaultMdxOptions?.preset === "minimal") {
|
|
40
|
+
return createCompiler(defaultMdxOptions);
|
|
41
|
+
}
|
|
42
|
+
const remarkPlugins = defaultMdxOptions?.remarkPlugins ?? [];
|
|
34
43
|
return createCompiler({
|
|
35
|
-
...
|
|
44
|
+
...defaultMdxOptions,
|
|
36
45
|
remarkPlugins: (v) => typeof remarkPlugins === "function" ? [remarkInclude, ...remarkPlugins(v), remarkStructure] : [remarkInclude, ...v, ...remarkPlugins, remarkStructure]
|
|
37
46
|
});
|
|
38
47
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/runtime/vite.ts
|
|
21
|
+
var vite_exports = {};
|
|
22
|
+
__export(vite_exports, {
|
|
23
|
+
fromConfig: () => fromConfig,
|
|
24
|
+
toClientRenderer: () => toClientRenderer
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(vite_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
function fromConfig() {
|
|
29
|
+
function normalize(entries) {
|
|
30
|
+
const out = {};
|
|
31
|
+
for (const k in entries) {
|
|
32
|
+
const mappedK = k.startsWith("./") ? k.slice(2) : k;
|
|
33
|
+
out[mappedK] = entries[k];
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
function mapPageData(entry) {
|
|
38
|
+
const { toc, structuredData } = entry;
|
|
39
|
+
return {
|
|
40
|
+
...entry.frontmatter,
|
|
41
|
+
default: entry.default,
|
|
42
|
+
toc,
|
|
43
|
+
structuredData,
|
|
44
|
+
_exports: entry
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
doc(_, glob) {
|
|
49
|
+
return normalize(glob);
|
|
50
|
+
},
|
|
51
|
+
meta(_, glob) {
|
|
52
|
+
return normalize(glob);
|
|
53
|
+
},
|
|
54
|
+
docs(_, { doc, meta }) {
|
|
55
|
+
return {
|
|
56
|
+
doc: normalize(doc),
|
|
57
|
+
meta: normalize(meta)
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
source(doc, meta) {
|
|
61
|
+
const virtualFiles = [];
|
|
62
|
+
for (const [file, content] of Object.entries(doc)) {
|
|
63
|
+
virtualFiles.push({
|
|
64
|
+
type: "page",
|
|
65
|
+
path: file,
|
|
66
|
+
data: mapPageData(content)
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
for (const [file, content] of Object.entries(meta)) {
|
|
70
|
+
virtualFiles.push({
|
|
71
|
+
type: "meta",
|
|
72
|
+
path: file,
|
|
73
|
+
data: content
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
files: virtualFiles
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
async sourceAsync(doc, meta) {
|
|
81
|
+
const virtualFiles = [];
|
|
82
|
+
for (const [file, content] of Object.entries(doc)) {
|
|
83
|
+
virtualFiles.push({
|
|
84
|
+
type: "page",
|
|
85
|
+
path: file,
|
|
86
|
+
data: mapPageData(await content())
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
for (const [file, content] of Object.entries(meta)) {
|
|
90
|
+
virtualFiles.push({
|
|
91
|
+
type: "meta",
|
|
92
|
+
path: file,
|
|
93
|
+
data: await content()
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
files: virtualFiles
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function toClientRenderer(files, renderer) {
|
|
103
|
+
const loader = {};
|
|
104
|
+
for (const k in files) {
|
|
105
|
+
loader[k] = (0, import_react.lazy)(async () => {
|
|
106
|
+
const loaded = await files[k]();
|
|
107
|
+
return { default: (props) => renderer(loaded, props) };
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return loader;
|
|
111
|
+
}
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {
|
|
114
|
+
fromConfig,
|
|
115
|
+
toClientRenderer
|
|
116
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TableOfContents } from 'fumadocs-core/server';
|
|
2
|
+
import { FC, ReactNode, LazyExoticComponent } from 'react';
|
|
3
|
+
import { MDXProps } from 'mdx/types';
|
|
4
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
5
|
+
import { D as DocCollection, M as MetaCollection, a as DocsCollection } from '../define-CCrinVBZ.cjs';
|
|
6
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
|
+
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import '@mdx-js/mdx';
|
|
10
|
+
import 'unified';
|
|
11
|
+
|
|
12
|
+
type CompiledMDXFile<Frontmatter> = {
|
|
13
|
+
frontmatter: Frontmatter;
|
|
14
|
+
toc: TableOfContents;
|
|
15
|
+
default: FC<MDXProps>;
|
|
16
|
+
structuredData: StructuredData;
|
|
17
|
+
} & Record<string, unknown>;
|
|
18
|
+
type MDXFileToPageData<Frontmatter> = Frontmatter & {
|
|
19
|
+
toc: TableOfContents;
|
|
20
|
+
default: FC<MDXProps>;
|
|
21
|
+
structuredData: StructuredData;
|
|
22
|
+
_exports: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
type AttachGlobValue<GlobValue, Attach> = GlobValue extends () => Promise<unknown> ? () => Promise<Attach> : Attach;
|
|
25
|
+
declare function fromConfig<Config>(): {
|
|
26
|
+
doc: <Name extends keyof Config, GlobValue>(name: Name, glob: Record<string, GlobValue>) => Config[Name] extends DocCollection<infer Schema> ? Record<string, AttachGlobValue<GlobValue, CompiledMDXFile<StandardSchemaV1.InferOutput<Schema>>>> : never;
|
|
27
|
+
meta: <Name extends keyof Config, GlobValue>(name: Name, glob: Record<string, GlobValue>) => Config[Name] extends MetaCollection<infer Schema> ? AttachGlobValue<GlobValue, StandardSchemaV1.InferOutput<Schema>> : never;
|
|
28
|
+
docs: <Name extends keyof Config, DocGlobValue, MetaGlobValue>(name: Name, options: {
|
|
29
|
+
meta: Record<string, MetaGlobValue>;
|
|
30
|
+
doc: Record<string, DocGlobValue>;
|
|
31
|
+
}) => Config[Name] extends DocsCollection<infer DocSchema, infer MetaSchema> ? {
|
|
32
|
+
doc: Record<string, AttachGlobValue<DocGlobValue, CompiledMDXFile<StandardSchemaV1.InferOutput<DocSchema>>>>;
|
|
33
|
+
meta: Record<string, AttachGlobValue<MetaGlobValue, StandardSchemaV1.InferOutput<MetaSchema>>>;
|
|
34
|
+
} : never;
|
|
35
|
+
source: <DocOut extends PageData, MetaOut extends MetaData>(doc: Record<string, CompiledMDXFile<DocOut>>, meta: Record<string, MetaOut>) => Source<{
|
|
36
|
+
pageData: MDXFileToPageData<DocOut>;
|
|
37
|
+
metaData: MetaOut;
|
|
38
|
+
}>;
|
|
39
|
+
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: Record<string, () => Promise<CompiledMDXFile<DocOut>>>, meta: Record<string, () => Promise<MetaOut>>) => Promise<Source<{
|
|
40
|
+
pageData: MDXFileToPageData<DocOut>;
|
|
41
|
+
metaData: MetaOut;
|
|
42
|
+
}>>;
|
|
43
|
+
};
|
|
44
|
+
type ClientLoader<Props> = Record<string, LazyExoticComponent<(props: Props) => ReactNode>>;
|
|
45
|
+
declare function toClientRenderer<Frontmatter, Props extends object = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, renderer: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode): ClientLoader<Props>;
|
|
46
|
+
|
|
47
|
+
export { type CompiledMDXFile, fromConfig, toClientRenderer };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TableOfContents } from 'fumadocs-core/server';
|
|
2
|
+
import { FC, ReactNode, LazyExoticComponent } from 'react';
|
|
3
|
+
import { MDXProps } from 'mdx/types';
|
|
4
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
5
|
+
import { D as DocCollection, M as MetaCollection, a as DocsCollection } from '../define-CCrinVBZ.js';
|
|
6
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
|
+
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import '@mdx-js/mdx';
|
|
10
|
+
import 'unified';
|
|
11
|
+
|
|
12
|
+
type CompiledMDXFile<Frontmatter> = {
|
|
13
|
+
frontmatter: Frontmatter;
|
|
14
|
+
toc: TableOfContents;
|
|
15
|
+
default: FC<MDXProps>;
|
|
16
|
+
structuredData: StructuredData;
|
|
17
|
+
} & Record<string, unknown>;
|
|
18
|
+
type MDXFileToPageData<Frontmatter> = Frontmatter & {
|
|
19
|
+
toc: TableOfContents;
|
|
20
|
+
default: FC<MDXProps>;
|
|
21
|
+
structuredData: StructuredData;
|
|
22
|
+
_exports: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
type AttachGlobValue<GlobValue, Attach> = GlobValue extends () => Promise<unknown> ? () => Promise<Attach> : Attach;
|
|
25
|
+
declare function fromConfig<Config>(): {
|
|
26
|
+
doc: <Name extends keyof Config, GlobValue>(name: Name, glob: Record<string, GlobValue>) => Config[Name] extends DocCollection<infer Schema> ? Record<string, AttachGlobValue<GlobValue, CompiledMDXFile<StandardSchemaV1.InferOutput<Schema>>>> : never;
|
|
27
|
+
meta: <Name extends keyof Config, GlobValue>(name: Name, glob: Record<string, GlobValue>) => Config[Name] extends MetaCollection<infer Schema> ? AttachGlobValue<GlobValue, StandardSchemaV1.InferOutput<Schema>> : never;
|
|
28
|
+
docs: <Name extends keyof Config, DocGlobValue, MetaGlobValue>(name: Name, options: {
|
|
29
|
+
meta: Record<string, MetaGlobValue>;
|
|
30
|
+
doc: Record<string, DocGlobValue>;
|
|
31
|
+
}) => Config[Name] extends DocsCollection<infer DocSchema, infer MetaSchema> ? {
|
|
32
|
+
doc: Record<string, AttachGlobValue<DocGlobValue, CompiledMDXFile<StandardSchemaV1.InferOutput<DocSchema>>>>;
|
|
33
|
+
meta: Record<string, AttachGlobValue<MetaGlobValue, StandardSchemaV1.InferOutput<MetaSchema>>>;
|
|
34
|
+
} : never;
|
|
35
|
+
source: <DocOut extends PageData, MetaOut extends MetaData>(doc: Record<string, CompiledMDXFile<DocOut>>, meta: Record<string, MetaOut>) => Source<{
|
|
36
|
+
pageData: MDXFileToPageData<DocOut>;
|
|
37
|
+
metaData: MetaOut;
|
|
38
|
+
}>;
|
|
39
|
+
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: Record<string, () => Promise<CompiledMDXFile<DocOut>>>, meta: Record<string, () => Promise<MetaOut>>) => Promise<Source<{
|
|
40
|
+
pageData: MDXFileToPageData<DocOut>;
|
|
41
|
+
metaData: MetaOut;
|
|
42
|
+
}>>;
|
|
43
|
+
};
|
|
44
|
+
type ClientLoader<Props> = Record<string, LazyExoticComponent<(props: Props) => ReactNode>>;
|
|
45
|
+
declare function toClientRenderer<Frontmatter, Props extends object = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, renderer: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode): ClientLoader<Props>;
|
|
46
|
+
|
|
47
|
+
export { type CompiledMDXFile, fromConfig, toClientRenderer };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/runtime/vite.ts
|
|
2
|
+
import { lazy } from "react";
|
|
3
|
+
function fromConfig() {
|
|
4
|
+
function normalize(entries) {
|
|
5
|
+
const out = {};
|
|
6
|
+
for (const k in entries) {
|
|
7
|
+
const mappedK = k.startsWith("./") ? k.slice(2) : k;
|
|
8
|
+
out[mappedK] = entries[k];
|
|
9
|
+
}
|
|
10
|
+
return out;
|
|
11
|
+
}
|
|
12
|
+
function mapPageData(entry) {
|
|
13
|
+
const { toc, structuredData } = entry;
|
|
14
|
+
return {
|
|
15
|
+
...entry.frontmatter,
|
|
16
|
+
default: entry.default,
|
|
17
|
+
toc,
|
|
18
|
+
structuredData,
|
|
19
|
+
_exports: entry
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
doc(_, glob) {
|
|
24
|
+
return normalize(glob);
|
|
25
|
+
},
|
|
26
|
+
meta(_, glob) {
|
|
27
|
+
return normalize(glob);
|
|
28
|
+
},
|
|
29
|
+
docs(_, { doc, meta }) {
|
|
30
|
+
return {
|
|
31
|
+
doc: normalize(doc),
|
|
32
|
+
meta: normalize(meta)
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
source(doc, meta) {
|
|
36
|
+
const virtualFiles = [];
|
|
37
|
+
for (const [file, content] of Object.entries(doc)) {
|
|
38
|
+
virtualFiles.push({
|
|
39
|
+
type: "page",
|
|
40
|
+
path: file,
|
|
41
|
+
data: mapPageData(content)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
for (const [file, content] of Object.entries(meta)) {
|
|
45
|
+
virtualFiles.push({
|
|
46
|
+
type: "meta",
|
|
47
|
+
path: file,
|
|
48
|
+
data: content
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
files: virtualFiles
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
async sourceAsync(doc, meta) {
|
|
56
|
+
const virtualFiles = [];
|
|
57
|
+
for (const [file, content] of Object.entries(doc)) {
|
|
58
|
+
virtualFiles.push({
|
|
59
|
+
type: "page",
|
|
60
|
+
path: file,
|
|
61
|
+
data: mapPageData(await content())
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
for (const [file, content] of Object.entries(meta)) {
|
|
65
|
+
virtualFiles.push({
|
|
66
|
+
type: "meta",
|
|
67
|
+
path: file,
|
|
68
|
+
data: await content()
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
files: virtualFiles
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function toClientRenderer(files, renderer) {
|
|
78
|
+
const loader = {};
|
|
79
|
+
for (const k in files) {
|
|
80
|
+
loader[k] = lazy(async () => {
|
|
81
|
+
const loaded = await files[k]();
|
|
82
|
+
return { default: (props) => renderer(loaded, props) };
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return loader;
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
fromConfig,
|
|
89
|
+
toClientRenderer
|
|
90
|
+
};
|
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
import { F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry, L as LoadedConfig } from './types-DVeuYiq5.js';
|
|
2
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
2
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
3
|
+
import { D as DocCollection, M as MetaCollection, a as DocsCollection, G as GlobalConfig } from './define-CCrinVBZ.js';
|
|
4
|
+
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
|
+
import { FC } from 'react';
|
|
6
|
+
import { MDXProps } from 'mdx/types';
|
|
7
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
8
|
+
import { TableOfContents } from 'fumadocs-core/server';
|
|
4
9
|
|
|
10
|
+
interface LoadedConfig {
|
|
11
|
+
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
12
|
+
global?: GlobalConfig;
|
|
13
|
+
getDefaultMDXOptions(): Promise<ProcessorOptions>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface BaseCollectionEntry {
|
|
17
|
+
/**
|
|
18
|
+
* Raw file path of collection entry, including absolute path (not normalized).
|
|
19
|
+
*/
|
|
20
|
+
_file: FileInfo;
|
|
21
|
+
}
|
|
22
|
+
interface FileInfo {
|
|
23
|
+
path: string;
|
|
24
|
+
absolutePath: string;
|
|
25
|
+
}
|
|
26
|
+
interface MarkdownProps {
|
|
27
|
+
body: FC<MDXProps>;
|
|
28
|
+
structuredData: StructuredData;
|
|
29
|
+
toc: TableOfContents;
|
|
30
|
+
_exports: Record<string, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Only available when `lastModifiedTime` is enabled on MDX loader
|
|
33
|
+
*/
|
|
34
|
+
lastModified?: Date;
|
|
35
|
+
}
|
|
5
36
|
interface RuntimeFile {
|
|
6
37
|
info: FileInfo;
|
|
7
38
|
data: Record<string, unknown>;
|
|
@@ -21,33 +52,9 @@ type DocOut<Schema extends StandardSchemaV1> = Override<MarkdownProps & {
|
|
|
21
52
|
type Override<A, B> = Omit<A, keyof B> & B;
|
|
22
53
|
type MetaOut<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry;
|
|
23
54
|
interface Runtime {
|
|
24
|
-
doc: <C>(files: RuntimeFile[]) => C extends
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
schema: infer Schema extends StandardSchemaV1;
|
|
28
|
-
};
|
|
29
|
-
} ? DocOut<Schema>[] : never;
|
|
30
|
-
meta: <C>(files: RuntimeFile[]) => C extends {
|
|
31
|
-
type: 'meta';
|
|
32
|
-
_type: {
|
|
33
|
-
schema: infer Schema extends StandardSchemaV1;
|
|
34
|
-
};
|
|
35
|
-
} ? MetaOut<Schema>[] : never;
|
|
36
|
-
docs: <C>(docs: RuntimeFile[], metas: RuntimeFile[]) => C extends {
|
|
37
|
-
type: 'docs';
|
|
38
|
-
docs: {
|
|
39
|
-
type: 'doc';
|
|
40
|
-
_type: {
|
|
41
|
-
schema: infer DocSchema extends StandardSchemaV1;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
meta: {
|
|
45
|
-
type: 'meta';
|
|
46
|
-
_type: {
|
|
47
|
-
schema: infer MetaSchema extends StandardSchemaV1;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
} ? {
|
|
55
|
+
doc: <C>(files: RuntimeFile[]) => C extends DocCollection<infer Schema, false> ? DocOut<Schema>[] : never;
|
|
56
|
+
meta: <C>(files: RuntimeFile[]) => C extends MetaCollection<infer Schema> ? MetaOut<Schema>[] : never;
|
|
57
|
+
docs: <C>(docs: RuntimeFile[], metas: RuntimeFile[]) => C extends DocsCollection<infer DocSchema, infer MetaSchema, false> ? {
|
|
51
58
|
docs: DocOut<DocSchema>[];
|
|
52
59
|
meta: MetaOut<MetaSchema>[];
|
|
53
60
|
toFumadocsSource: () => Source<{
|
|
@@ -61,27 +68,8 @@ type AsyncDocOut<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput
|
|
|
61
68
|
load: () => Promise<MarkdownProps>;
|
|
62
69
|
};
|
|
63
70
|
interface RuntimeAsync {
|
|
64
|
-
doc: <C>(files: AsyncRuntimeFile[], collection: string, config: LoadedConfig) => C extends
|
|
65
|
-
|
|
66
|
-
_type: {
|
|
67
|
-
schema: infer Schema extends StandardSchemaV1;
|
|
68
|
-
};
|
|
69
|
-
} ? AsyncDocOut<Schema>[] : never;
|
|
70
|
-
docs: <C>(docs: AsyncRuntimeFile[], metas: RuntimeFile[], collection: string, config: LoadedConfig) => C extends {
|
|
71
|
-
type: 'docs';
|
|
72
|
-
docs: {
|
|
73
|
-
type: 'doc';
|
|
74
|
-
_type: {
|
|
75
|
-
schema: infer DocSchema extends StandardSchemaV1;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
meta: {
|
|
79
|
-
type: 'meta';
|
|
80
|
-
_type: {
|
|
81
|
-
schema: infer MetaSchema extends StandardSchemaV1;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
} ? {
|
|
71
|
+
doc: <C>(files: AsyncRuntimeFile[], collection: string, config: LoadedConfig) => C extends DocCollection<infer Schema, true> ? AsyncDocOut<Schema>[] : never;
|
|
72
|
+
docs: <C>(docs: AsyncRuntimeFile[], metas: RuntimeFile[], collection: string, config: LoadedConfig) => C extends DocsCollection<infer DocSchema, infer MetaSchema, true> ? {
|
|
85
73
|
docs: AsyncDocOut<DocSchema>[];
|
|
86
74
|
meta: MetaOut<MetaSchema>[];
|
|
87
75
|
toFumadocsSource: () => Source<{
|
|
@@ -91,4 +79,4 @@ interface RuntimeAsync {
|
|
|
91
79
|
} : never;
|
|
92
80
|
}
|
|
93
81
|
|
|
94
|
-
export type { Runtime as R, RuntimeAsync as a };
|
|
82
|
+
export type { BaseCollectionEntry as B, LoadedConfig as L, Runtime as R, RuntimeAsync as a };
|
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
import { F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry, L as LoadedConfig } from './types-DVeuYiq5.cjs';
|
|
2
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
2
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
3
|
+
import { D as DocCollection, M as MetaCollection, a as DocsCollection, G as GlobalConfig } from './define-CCrinVBZ.cjs';
|
|
4
|
+
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
|
+
import { FC } from 'react';
|
|
6
|
+
import { MDXProps } from 'mdx/types';
|
|
7
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
8
|
+
import { TableOfContents } from 'fumadocs-core/server';
|
|
4
9
|
|
|
10
|
+
interface LoadedConfig {
|
|
11
|
+
collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
|
|
12
|
+
global?: GlobalConfig;
|
|
13
|
+
getDefaultMDXOptions(): Promise<ProcessorOptions>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface BaseCollectionEntry {
|
|
17
|
+
/**
|
|
18
|
+
* Raw file path of collection entry, including absolute path (not normalized).
|
|
19
|
+
*/
|
|
20
|
+
_file: FileInfo;
|
|
21
|
+
}
|
|
22
|
+
interface FileInfo {
|
|
23
|
+
path: string;
|
|
24
|
+
absolutePath: string;
|
|
25
|
+
}
|
|
26
|
+
interface MarkdownProps {
|
|
27
|
+
body: FC<MDXProps>;
|
|
28
|
+
structuredData: StructuredData;
|
|
29
|
+
toc: TableOfContents;
|
|
30
|
+
_exports: Record<string, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Only available when `lastModifiedTime` is enabled on MDX loader
|
|
33
|
+
*/
|
|
34
|
+
lastModified?: Date;
|
|
35
|
+
}
|
|
5
36
|
interface RuntimeFile {
|
|
6
37
|
info: FileInfo;
|
|
7
38
|
data: Record<string, unknown>;
|
|
@@ -21,33 +52,9 @@ type DocOut<Schema extends StandardSchemaV1> = Override<MarkdownProps & {
|
|
|
21
52
|
type Override<A, B> = Omit<A, keyof B> & B;
|
|
22
53
|
type MetaOut<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry;
|
|
23
54
|
interface Runtime {
|
|
24
|
-
doc: <C>(files: RuntimeFile[]) => C extends
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
schema: infer Schema extends StandardSchemaV1;
|
|
28
|
-
};
|
|
29
|
-
} ? DocOut<Schema>[] : never;
|
|
30
|
-
meta: <C>(files: RuntimeFile[]) => C extends {
|
|
31
|
-
type: 'meta';
|
|
32
|
-
_type: {
|
|
33
|
-
schema: infer Schema extends StandardSchemaV1;
|
|
34
|
-
};
|
|
35
|
-
} ? MetaOut<Schema>[] : never;
|
|
36
|
-
docs: <C>(docs: RuntimeFile[], metas: RuntimeFile[]) => C extends {
|
|
37
|
-
type: 'docs';
|
|
38
|
-
docs: {
|
|
39
|
-
type: 'doc';
|
|
40
|
-
_type: {
|
|
41
|
-
schema: infer DocSchema extends StandardSchemaV1;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
meta: {
|
|
45
|
-
type: 'meta';
|
|
46
|
-
_type: {
|
|
47
|
-
schema: infer MetaSchema extends StandardSchemaV1;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
} ? {
|
|
55
|
+
doc: <C>(files: RuntimeFile[]) => C extends DocCollection<infer Schema, false> ? DocOut<Schema>[] : never;
|
|
56
|
+
meta: <C>(files: RuntimeFile[]) => C extends MetaCollection<infer Schema> ? MetaOut<Schema>[] : never;
|
|
57
|
+
docs: <C>(docs: RuntimeFile[], metas: RuntimeFile[]) => C extends DocsCollection<infer DocSchema, infer MetaSchema, false> ? {
|
|
51
58
|
docs: DocOut<DocSchema>[];
|
|
52
59
|
meta: MetaOut<MetaSchema>[];
|
|
53
60
|
toFumadocsSource: () => Source<{
|
|
@@ -61,27 +68,8 @@ type AsyncDocOut<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput
|
|
|
61
68
|
load: () => Promise<MarkdownProps>;
|
|
62
69
|
};
|
|
63
70
|
interface RuntimeAsync {
|
|
64
|
-
doc: <C>(files: AsyncRuntimeFile[], collection: string, config: LoadedConfig) => C extends
|
|
65
|
-
|
|
66
|
-
_type: {
|
|
67
|
-
schema: infer Schema extends StandardSchemaV1;
|
|
68
|
-
};
|
|
69
|
-
} ? AsyncDocOut<Schema>[] : never;
|
|
70
|
-
docs: <C>(docs: AsyncRuntimeFile[], metas: RuntimeFile[], collection: string, config: LoadedConfig) => C extends {
|
|
71
|
-
type: 'docs';
|
|
72
|
-
docs: {
|
|
73
|
-
type: 'doc';
|
|
74
|
-
_type: {
|
|
75
|
-
schema: infer DocSchema extends StandardSchemaV1;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
meta: {
|
|
79
|
-
type: 'meta';
|
|
80
|
-
_type: {
|
|
81
|
-
schema: infer MetaSchema extends StandardSchemaV1;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
} ? {
|
|
71
|
+
doc: <C>(files: AsyncRuntimeFile[], collection: string, config: LoadedConfig) => C extends DocCollection<infer Schema, true> ? AsyncDocOut<Schema>[] : never;
|
|
72
|
+
docs: <C>(docs: AsyncRuntimeFile[], metas: RuntimeFile[], collection: string, config: LoadedConfig) => C extends DocsCollection<infer DocSchema, infer MetaSchema, true> ? {
|
|
85
73
|
docs: AsyncDocOut<DocSchema>[];
|
|
86
74
|
meta: MetaOut<MetaSchema>[];
|
|
87
75
|
toFumadocsSource: () => Source<{
|
|
@@ -91,4 +79,4 @@ interface RuntimeAsync {
|
|
|
91
79
|
} : never;
|
|
92
80
|
}
|
|
93
81
|
|
|
94
|
-
export type { Runtime as R, RuntimeAsync as a };
|
|
82
|
+
export type { BaseCollectionEntry as B, LoadedConfig as L, Runtime as R, RuntimeAsync as a };
|