fumadocs-mdx 11.8.3 → 11.9.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-BWRDVK5L.js → chunk-766EAFX6.js} +1 -1
- package/dist/chunk-COQ4VMK2.js +158 -0
- package/dist/config/index.d.cts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/zod-3.d.cts +1 -1
- package/dist/config/zod-3.d.ts +1 -1
- package/dist/{define-DAZmbu3U.d.cts → define-DnJzAZrj.d.cts} +1 -1
- package/dist/{define-DAZmbu3U.d.ts → define-DnJzAZrj.d.ts} +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/loader-mdx.cjs +1 -1
- package/dist/loader-mdx.js +2 -2
- package/dist/next/index.cjs +126 -11
- package/dist/next/index.js +27 -9
- package/dist/runtime/async.d.cts +2 -2
- package/dist/runtime/async.d.ts +2 -2
- package/dist/runtime/async.js +1 -1
- package/dist/runtime/vite.cjs +47 -33
- package/dist/runtime/vite.d.cts +17 -12
- package/dist/runtime/vite.d.ts +17 -12
- package/dist/runtime/vite.js +37 -33
- package/dist/{types-B2kQsHs7.d.cts → types-BmVgoqsr.d.cts} +1 -1
- package/dist/{types-CkmezNbX.d.ts → types-WSHJKA8L.d.ts} +1 -1
- package/dist/vite/index.cjs +99 -84
- package/dist/vite/index.js +13 -93
- package/package.json +5 -5
- package/dist/chunk-6Y5JDZHD.js +0 -65
package/dist/runtime/vite.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/runtime/vite.ts
|
|
@@ -26,11 +36,13 @@ __export(vite_exports, {
|
|
|
26
36
|
});
|
|
27
37
|
module.exports = __toCommonJS(vite_exports);
|
|
28
38
|
var import_react = require("react");
|
|
39
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
29
40
|
function fromConfig() {
|
|
30
|
-
function normalize(entries) {
|
|
41
|
+
function normalize(entries, base) {
|
|
31
42
|
const out = {};
|
|
32
43
|
for (const k in entries) {
|
|
33
44
|
const mappedK = k.startsWith("./") ? k.slice(2) : k;
|
|
45
|
+
if (base) Object.assign(entries[k], { base });
|
|
34
46
|
out[mappedK] = entries[k];
|
|
35
47
|
}
|
|
36
48
|
return out;
|
|
@@ -57,14 +69,15 @@ function fromConfig() {
|
|
|
57
69
|
};
|
|
58
70
|
}
|
|
59
71
|
return {
|
|
60
|
-
doc(_, glob) {
|
|
61
|
-
return normalize(glob);
|
|
72
|
+
doc(_, base, glob) {
|
|
73
|
+
return normalize(glob, base);
|
|
62
74
|
},
|
|
63
|
-
meta(_, glob) {
|
|
64
|
-
return normalize(glob);
|
|
75
|
+
meta(_, base, glob) {
|
|
76
|
+
return normalize(glob, base);
|
|
65
77
|
},
|
|
66
|
-
docLazy(_, head, body) {
|
|
78
|
+
docLazy(_, base, head, body) {
|
|
67
79
|
return {
|
|
80
|
+
base,
|
|
68
81
|
head: normalize(head),
|
|
69
82
|
body: normalize(body)
|
|
70
83
|
};
|
|
@@ -75,6 +88,7 @@ function fromConfig() {
|
|
|
75
88
|
return {
|
|
76
89
|
type: "page",
|
|
77
90
|
path: file,
|
|
91
|
+
absolutePath: import_node_path.default.join(content.base, file),
|
|
78
92
|
data: mapPageData(await content())
|
|
79
93
|
};
|
|
80
94
|
}),
|
|
@@ -82,6 +96,7 @@ function fromConfig() {
|
|
|
82
96
|
return {
|
|
83
97
|
type: "meta",
|
|
84
98
|
path: file,
|
|
99
|
+
absolutePath: import_node_path.default.join(content.base, file),
|
|
85
100
|
data: await content()
|
|
86
101
|
};
|
|
87
102
|
})
|
|
@@ -94,6 +109,7 @@ function fromConfig() {
|
|
|
94
109
|
return {
|
|
95
110
|
type: "page",
|
|
96
111
|
path: file,
|
|
112
|
+
absolutePath: import_node_path.default.join(doc.base, file),
|
|
97
113
|
data: mapPageDataLazy(await frontmatter(), doc.body[file])
|
|
98
114
|
};
|
|
99
115
|
}),
|
|
@@ -101,6 +117,7 @@ function fromConfig() {
|
|
|
101
117
|
return {
|
|
102
118
|
type: "meta",
|
|
103
119
|
path: file,
|
|
120
|
+
absolutePath: import_node_path.default.join(content.base, file),
|
|
104
121
|
data: await content()
|
|
105
122
|
};
|
|
106
123
|
})
|
|
@@ -112,44 +129,41 @@ function fromConfig() {
|
|
|
112
129
|
var loaderStore = /* @__PURE__ */ new Map();
|
|
113
130
|
function createClientLoader(files, options) {
|
|
114
131
|
const { id = "", component } = options;
|
|
132
|
+
let renderer;
|
|
115
133
|
const store = loaderStore.get(id) ?? {
|
|
116
134
|
preloaded: /* @__PURE__ */ new Map()
|
|
117
135
|
};
|
|
118
136
|
loaderStore.set(id, store);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
getComponent(path) {
|
|
127
|
-
renderer ??= toClientRenderer(files, component, {
|
|
128
|
-
cache: store.preloaded
|
|
137
|
+
function getRenderer() {
|
|
138
|
+
if (renderer) return renderer;
|
|
139
|
+
renderer = {};
|
|
140
|
+
for (const k in files) {
|
|
141
|
+
const OnDemand = (0, import_react.lazy)(async () => {
|
|
142
|
+
const loaded = await files[k]();
|
|
143
|
+
return { default: (props) => component(loaded, props) };
|
|
129
144
|
});
|
|
130
|
-
return renderer[path];
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function toClientRenderer(files, component, options = {}) {
|
|
135
|
-
const { cache } = options;
|
|
136
|
-
const renderer = {};
|
|
137
|
-
for (const k in files) {
|
|
138
|
-
const OnDemand = (0, import_react.lazy)(async () => {
|
|
139
|
-
const loaded = await files[k]();
|
|
140
|
-
return { default: (props) => component(loaded, props) };
|
|
141
|
-
});
|
|
142
|
-
if (cache) {
|
|
143
145
|
renderer[k] = (props) => {
|
|
144
|
-
const cached =
|
|
146
|
+
const cached = store.preloaded.get(k);
|
|
145
147
|
if (!cached) return (0, import_react.createElement)(OnDemand, props);
|
|
146
148
|
return component(cached, props);
|
|
147
149
|
};
|
|
148
|
-
} else {
|
|
149
|
-
renderer[k] = OnDemand;
|
|
150
150
|
}
|
|
151
|
+
return renderer;
|
|
151
152
|
}
|
|
152
|
-
return
|
|
153
|
+
return {
|
|
154
|
+
async preload(path2) {
|
|
155
|
+
const loaded = await files[path2]();
|
|
156
|
+
store.preloaded.set(path2, loaded);
|
|
157
|
+
return loaded;
|
|
158
|
+
},
|
|
159
|
+
getRenderer,
|
|
160
|
+
getComponent(path2) {
|
|
161
|
+
return getRenderer()[path2];
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function toClientRenderer(files, component) {
|
|
166
|
+
return createClientLoader(files, { component }).getRenderer();
|
|
153
167
|
}
|
|
154
168
|
// Annotate the CommonJS export names for ESM import in node:
|
|
155
169
|
0 && (module.exports = {
|
package/dist/runtime/vite.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { MDXProps } from 'mdx/types';
|
|
3
|
-
import {
|
|
3
|
+
import { a as DocCollection, b as DocsCollection, M as MetaCollection } from '../define-DnJzAZrj.cjs';
|
|
4
4
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
5
5
|
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
6
6
|
import { C as CompiledMDXProperties } from '../build-mdx-DnC1jKvn.cjs';
|
|
@@ -25,19 +25,26 @@ type MDXFileToPageDataLazy<Frontmatter> = Override<Frontmatter, {
|
|
|
25
25
|
body: FC<MDXProps>;
|
|
26
26
|
}>;
|
|
27
27
|
}>;
|
|
28
|
+
type DocMap<Frontmatter> = Record<string, (() => Promise<CompiledMDXFile<Frontmatter>>) & {
|
|
29
|
+
base: string;
|
|
30
|
+
}>;
|
|
31
|
+
type MetaMap<Data> = Record<string, (() => Promise<Data>) & {
|
|
32
|
+
base: string;
|
|
33
|
+
}>;
|
|
28
34
|
interface LazyDocMap<Frontmatter> {
|
|
35
|
+
base: string;
|
|
29
36
|
head: Record<string, () => Promise<Frontmatter>>;
|
|
30
37
|
body: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>;
|
|
31
38
|
}
|
|
32
39
|
declare function fromConfig<Config>(): {
|
|
33
|
-
doc: <Name extends keyof Config>(name: Name, glob: Record<string, () => Promise<unknown>>) => Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ?
|
|
34
|
-
docLazy: <Name extends keyof Config>(name: Name, headGlob: Record<string, () => Promise<unknown>>, bodyGlob: Record<string, () => Promise<unknown>>) => Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? LazyDocMap<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
35
|
-
meta: <Name extends keyof Config>(name: Name, glob: Record<string, () => Promise<unknown>>) => Config[Name] extends MetaCollection<infer Schema> | DocsCollection<StandardSchemaV1, infer Schema> ?
|
|
36
|
-
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc:
|
|
40
|
+
doc: <Name extends keyof Config>(name: Name, base: string, glob: Record<string, () => Promise<unknown>>) => Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? DocMap<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
41
|
+
docLazy: <Name extends keyof Config>(name: Name, base: string, headGlob: Record<string, () => Promise<unknown>>, bodyGlob: Record<string, () => Promise<unknown>>) => Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? LazyDocMap<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
42
|
+
meta: <Name extends keyof Config>(name: Name, base: string, glob: Record<string, () => Promise<unknown>>) => Config[Name] extends MetaCollection<infer Schema> | DocsCollection<StandardSchemaV1, infer Schema> ? MetaMap<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
43
|
+
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: DocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
37
44
|
pageData: MDXFileToPageData<DocOut>;
|
|
38
45
|
metaData: MetaOut;
|
|
39
46
|
}>>;
|
|
40
|
-
sourceLazy: <DocOut extends PageData, MetaOut extends MetaData>(doc: LazyDocMap<DocOut>, meta:
|
|
47
|
+
sourceLazy: <DocOut extends PageData, MetaOut extends MetaData>(doc: LazyDocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
41
48
|
pageData: MDXFileToPageDataLazy<DocOut>;
|
|
42
49
|
metaData: MetaOut;
|
|
43
50
|
}>>;
|
|
@@ -55,18 +62,16 @@ interface ClientLoaderOptions<Frontmatter, Props> {
|
|
|
55
62
|
id?: string;
|
|
56
63
|
component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode;
|
|
57
64
|
}
|
|
65
|
+
type ClientRenderer<Props> = Record<string, FC<Props>>;
|
|
58
66
|
interface ClientLoader<Frontmatter, Props> {
|
|
59
67
|
preload: (path: string) => Promise<CompiledMDXFile<Frontmatter>>;
|
|
60
68
|
/**
|
|
61
69
|
* Get a component that renders content with `React.lazy`
|
|
62
70
|
*/
|
|
63
71
|
getComponent: (path: string) => FC<Props>;
|
|
72
|
+
getRenderer: () => ClientRenderer<Props>;
|
|
64
73
|
}
|
|
65
74
|
declare function createClientLoader<Frontmatter, Props = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, options: ClientLoaderOptions<Frontmatter, Props>): ClientLoader<Frontmatter, Props>;
|
|
66
|
-
|
|
67
|
-
cache?: Map<string, CompiledMDXFile<Frontmatter>>;
|
|
68
|
-
}
|
|
69
|
-
type ClientRenderer<Props> = Record<string, FC<Props>>;
|
|
70
|
-
declare function toClientRenderer<Frontmatter, Props = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode, options?: ClientRendererOptions<Frontmatter>): ClientRenderer<Props>;
|
|
75
|
+
declare function toClientRenderer<Frontmatter, Props = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode): ClientRenderer<Props>;
|
|
71
76
|
|
|
72
|
-
export { type ClientLoader, type ClientLoaderOptions, type
|
|
77
|
+
export { type ClientLoader, type ClientLoaderOptions, type CompiledMDXFile, createClientLoader, fromConfig, toClientRenderer };
|
package/dist/runtime/vite.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { MDXProps } from 'mdx/types';
|
|
3
|
-
import {
|
|
3
|
+
import { a as DocCollection, b as DocsCollection, M as MetaCollection } from '../define-DnJzAZrj.js';
|
|
4
4
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
5
5
|
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
6
6
|
import { C as CompiledMDXProperties } from '../build-mdx-DnC1jKvn.js';
|
|
@@ -25,19 +25,26 @@ type MDXFileToPageDataLazy<Frontmatter> = Override<Frontmatter, {
|
|
|
25
25
|
body: FC<MDXProps>;
|
|
26
26
|
}>;
|
|
27
27
|
}>;
|
|
28
|
+
type DocMap<Frontmatter> = Record<string, (() => Promise<CompiledMDXFile<Frontmatter>>) & {
|
|
29
|
+
base: string;
|
|
30
|
+
}>;
|
|
31
|
+
type MetaMap<Data> = Record<string, (() => Promise<Data>) & {
|
|
32
|
+
base: string;
|
|
33
|
+
}>;
|
|
28
34
|
interface LazyDocMap<Frontmatter> {
|
|
35
|
+
base: string;
|
|
29
36
|
head: Record<string, () => Promise<Frontmatter>>;
|
|
30
37
|
body: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>;
|
|
31
38
|
}
|
|
32
39
|
declare function fromConfig<Config>(): {
|
|
33
|
-
doc: <Name extends keyof Config>(name: Name, glob: Record<string, () => Promise<unknown>>) => Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ?
|
|
34
|
-
docLazy: <Name extends keyof Config>(name: Name, headGlob: Record<string, () => Promise<unknown>>, bodyGlob: Record<string, () => Promise<unknown>>) => Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? LazyDocMap<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
35
|
-
meta: <Name extends keyof Config>(name: Name, glob: Record<string, () => Promise<unknown>>) => Config[Name] extends MetaCollection<infer Schema> | DocsCollection<StandardSchemaV1, infer Schema> ?
|
|
36
|
-
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc:
|
|
40
|
+
doc: <Name extends keyof Config>(name: Name, base: string, glob: Record<string, () => Promise<unknown>>) => Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? DocMap<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
41
|
+
docLazy: <Name extends keyof Config>(name: Name, base: string, headGlob: Record<string, () => Promise<unknown>>, bodyGlob: Record<string, () => Promise<unknown>>) => Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? LazyDocMap<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
42
|
+
meta: <Name extends keyof Config>(name: Name, base: string, glob: Record<string, () => Promise<unknown>>) => Config[Name] extends MetaCollection<infer Schema> | DocsCollection<StandardSchemaV1, infer Schema> ? MetaMap<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
43
|
+
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: DocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
37
44
|
pageData: MDXFileToPageData<DocOut>;
|
|
38
45
|
metaData: MetaOut;
|
|
39
46
|
}>>;
|
|
40
|
-
sourceLazy: <DocOut extends PageData, MetaOut extends MetaData>(doc: LazyDocMap<DocOut>, meta:
|
|
47
|
+
sourceLazy: <DocOut extends PageData, MetaOut extends MetaData>(doc: LazyDocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
41
48
|
pageData: MDXFileToPageDataLazy<DocOut>;
|
|
42
49
|
metaData: MetaOut;
|
|
43
50
|
}>>;
|
|
@@ -55,18 +62,16 @@ interface ClientLoaderOptions<Frontmatter, Props> {
|
|
|
55
62
|
id?: string;
|
|
56
63
|
component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode;
|
|
57
64
|
}
|
|
65
|
+
type ClientRenderer<Props> = Record<string, FC<Props>>;
|
|
58
66
|
interface ClientLoader<Frontmatter, Props> {
|
|
59
67
|
preload: (path: string) => Promise<CompiledMDXFile<Frontmatter>>;
|
|
60
68
|
/**
|
|
61
69
|
* Get a component that renders content with `React.lazy`
|
|
62
70
|
*/
|
|
63
71
|
getComponent: (path: string) => FC<Props>;
|
|
72
|
+
getRenderer: () => ClientRenderer<Props>;
|
|
64
73
|
}
|
|
65
74
|
declare function createClientLoader<Frontmatter, Props = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, options: ClientLoaderOptions<Frontmatter, Props>): ClientLoader<Frontmatter, Props>;
|
|
66
|
-
|
|
67
|
-
cache?: Map<string, CompiledMDXFile<Frontmatter>>;
|
|
68
|
-
}
|
|
69
|
-
type ClientRenderer<Props> = Record<string, FC<Props>>;
|
|
70
|
-
declare function toClientRenderer<Frontmatter, Props = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode, options?: ClientRendererOptions<Frontmatter>): ClientRenderer<Props>;
|
|
75
|
+
declare function toClientRenderer<Frontmatter, Props = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode): ClientRenderer<Props>;
|
|
71
76
|
|
|
72
|
-
export { type ClientLoader, type ClientLoaderOptions, type
|
|
77
|
+
export { type ClientLoader, type ClientLoaderOptions, type CompiledMDXFile, createClientLoader, fromConfig, toClientRenderer };
|
package/dist/runtime/vite.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// src/runtime/vite.ts
|
|
2
2
|
import { createElement, lazy } from "react";
|
|
3
|
+
import path from "path";
|
|
3
4
|
function fromConfig() {
|
|
4
|
-
function normalize(entries) {
|
|
5
|
+
function normalize(entries, base) {
|
|
5
6
|
const out = {};
|
|
6
7
|
for (const k in entries) {
|
|
7
8
|
const mappedK = k.startsWith("./") ? k.slice(2) : k;
|
|
9
|
+
if (base) Object.assign(entries[k], { base });
|
|
8
10
|
out[mappedK] = entries[k];
|
|
9
11
|
}
|
|
10
12
|
return out;
|
|
@@ -31,14 +33,15 @@ function fromConfig() {
|
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
return {
|
|
34
|
-
doc(_, glob) {
|
|
35
|
-
return normalize(glob);
|
|
36
|
+
doc(_, base, glob) {
|
|
37
|
+
return normalize(glob, base);
|
|
36
38
|
},
|
|
37
|
-
meta(_, glob) {
|
|
38
|
-
return normalize(glob);
|
|
39
|
+
meta(_, base, glob) {
|
|
40
|
+
return normalize(glob, base);
|
|
39
41
|
},
|
|
40
|
-
docLazy(_, head, body) {
|
|
42
|
+
docLazy(_, base, head, body) {
|
|
41
43
|
return {
|
|
44
|
+
base,
|
|
42
45
|
head: normalize(head),
|
|
43
46
|
body: normalize(body)
|
|
44
47
|
};
|
|
@@ -49,6 +52,7 @@ function fromConfig() {
|
|
|
49
52
|
return {
|
|
50
53
|
type: "page",
|
|
51
54
|
path: file,
|
|
55
|
+
absolutePath: path.join(content.base, file),
|
|
52
56
|
data: mapPageData(await content())
|
|
53
57
|
};
|
|
54
58
|
}),
|
|
@@ -56,6 +60,7 @@ function fromConfig() {
|
|
|
56
60
|
return {
|
|
57
61
|
type: "meta",
|
|
58
62
|
path: file,
|
|
63
|
+
absolutePath: path.join(content.base, file),
|
|
59
64
|
data: await content()
|
|
60
65
|
};
|
|
61
66
|
})
|
|
@@ -68,6 +73,7 @@ function fromConfig() {
|
|
|
68
73
|
return {
|
|
69
74
|
type: "page",
|
|
70
75
|
path: file,
|
|
76
|
+
absolutePath: path.join(doc.base, file),
|
|
71
77
|
data: mapPageDataLazy(await frontmatter(), doc.body[file])
|
|
72
78
|
};
|
|
73
79
|
}),
|
|
@@ -75,6 +81,7 @@ function fromConfig() {
|
|
|
75
81
|
return {
|
|
76
82
|
type: "meta",
|
|
77
83
|
path: file,
|
|
84
|
+
absolutePath: path.join(content.base, file),
|
|
78
85
|
data: await content()
|
|
79
86
|
};
|
|
80
87
|
})
|
|
@@ -86,44 +93,41 @@ function fromConfig() {
|
|
|
86
93
|
var loaderStore = /* @__PURE__ */ new Map();
|
|
87
94
|
function createClientLoader(files, options) {
|
|
88
95
|
const { id = "", component } = options;
|
|
96
|
+
let renderer;
|
|
89
97
|
const store = loaderStore.get(id) ?? {
|
|
90
98
|
preloaded: /* @__PURE__ */ new Map()
|
|
91
99
|
};
|
|
92
100
|
loaderStore.set(id, store);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
getComponent(path) {
|
|
101
|
-
renderer ??= toClientRenderer(files, component, {
|
|
102
|
-
cache: store.preloaded
|
|
101
|
+
function getRenderer() {
|
|
102
|
+
if (renderer) return renderer;
|
|
103
|
+
renderer = {};
|
|
104
|
+
for (const k in files) {
|
|
105
|
+
const OnDemand = lazy(async () => {
|
|
106
|
+
const loaded = await files[k]();
|
|
107
|
+
return { default: (props) => component(loaded, props) };
|
|
103
108
|
});
|
|
104
|
-
return renderer[path];
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function toClientRenderer(files, component, options = {}) {
|
|
109
|
-
const { cache } = options;
|
|
110
|
-
const renderer = {};
|
|
111
|
-
for (const k in files) {
|
|
112
|
-
const OnDemand = lazy(async () => {
|
|
113
|
-
const loaded = await files[k]();
|
|
114
|
-
return { default: (props) => component(loaded, props) };
|
|
115
|
-
});
|
|
116
|
-
if (cache) {
|
|
117
109
|
renderer[k] = (props) => {
|
|
118
|
-
const cached =
|
|
110
|
+
const cached = store.preloaded.get(k);
|
|
119
111
|
if (!cached) return createElement(OnDemand, props);
|
|
120
112
|
return component(cached, props);
|
|
121
113
|
};
|
|
122
|
-
} else {
|
|
123
|
-
renderer[k] = OnDemand;
|
|
124
114
|
}
|
|
115
|
+
return renderer;
|
|
125
116
|
}
|
|
126
|
-
return
|
|
117
|
+
return {
|
|
118
|
+
async preload(path2) {
|
|
119
|
+
const loaded = await files[path2]();
|
|
120
|
+
store.preloaded.set(path2, loaded);
|
|
121
|
+
return loaded;
|
|
122
|
+
},
|
|
123
|
+
getRenderer,
|
|
124
|
+
getComponent(path2) {
|
|
125
|
+
return getRenderer()[path2];
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function toClientRenderer(files, component) {
|
|
130
|
+
return createClientLoader(files, { component }).getRenderer();
|
|
127
131
|
}
|
|
128
132
|
export {
|
|
129
133
|
createClientLoader,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
3
|
-
import {
|
|
3
|
+
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-DnJzAZrj.cjs';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
5
|
import { C as CompiledMDXProperties } from './build-mdx-DnC1jKvn.cjs';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
3
|
-
import {
|
|
3
|
+
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-DnJzAZrj.js';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
5
|
import { C as CompiledMDXProperties } from './build-mdx-DnC1jKvn.js';
|
|
6
6
|
|