fumadocs-mdx 11.9.0 → 11.10.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/{runtime/vite.d.ts → browser-B2G8uAF2.d.cts} +9 -35
- package/dist/{runtime/vite.d.cts → browser-DrH7tKRi.d.ts} +9 -35
- package/dist/bun/index.cjs +667 -0
- package/dist/bun/index.d.cts +8 -0
- package/dist/bun/index.d.ts +8 -0
- package/dist/bun/index.js +50 -0
- package/dist/{chunk-766EAFX6.js → chunk-2HKRTQYP.js} +64 -0
- package/dist/chunk-46UPKP5R.js +77 -0
- package/dist/chunk-5XJM5RPV.js +149 -0
- package/dist/chunk-NVX3U5YE.js +82 -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-DnJzAZrj.d.ts → define-BH4bnHQl.d.cts} +6 -0
- package/dist/{define-DnJzAZrj.d.cts → define-BH4bnHQl.d.ts} +6 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/loader-mdx.cjs +345 -265
- package/dist/loader-mdx.js +11 -80
- package/dist/next/index.js +4 -6
- package/dist/node/loader.cjs +748 -0
- package/dist/node/loader.d.cts +5 -0
- package/dist/node/loader.d.ts +5 -0
- package/dist/node/loader.js +23 -0
- package/dist/runtime/async.d.cts +2 -2
- package/dist/runtime/async.d.ts +2 -2
- package/dist/runtime/vite/browser.cjs +103 -0
- package/dist/runtime/vite/browser.d.cts +11 -0
- package/dist/runtime/vite/browser.d.ts +11 -0
- package/dist/runtime/vite/browser.js +10 -0
- package/dist/runtime/{vite.cjs → vite/server.cjs} +77 -63
- package/dist/runtime/vite/server.d.cts +41 -0
- package/dist/runtime/vite/server.d.ts +41 -0
- package/dist/runtime/{vite.js → vite/server.js} +10 -64
- package/dist/{types-WSHJKA8L.d.ts → types-DN9KrG7R.d.ts} +1 -1
- package/dist/{types-BmVgoqsr.d.cts → types-DT83Ijs6.d.cts} +1 -1
- package/dist/vite/index.cjs +356 -282
- package/dist/vite/index.js +12 -78
- package/package.json +21 -11
- package/dist/chunk-GX3THK2Q.js +0 -66
- package/dist/chunk-UCY7OBZG.js +0 -12
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toNode
|
|
3
|
+
} from "../chunk-NVX3U5YE.js";
|
|
4
|
+
import {
|
|
5
|
+
createMdxLoader,
|
|
6
|
+
dynamicConfig
|
|
7
|
+
} from "../chunk-5XJM5RPV.js";
|
|
8
|
+
import {
|
|
9
|
+
findConfigFile
|
|
10
|
+
} from "../chunk-2HKRTQYP.js";
|
|
11
|
+
import "../chunk-QQWCBFFE.js";
|
|
12
|
+
import "../chunk-SVTXMVLQ.js";
|
|
13
|
+
import "../chunk-QVZ7JH4H.js";
|
|
14
|
+
import "../chunk-VWJKRQZR.js";
|
|
15
|
+
|
|
16
|
+
// src/node/loader.ts
|
|
17
|
+
var load = toNode(
|
|
18
|
+
createMdxLoader(dynamicConfig(findConfigFile(), ".source")),
|
|
19
|
+
(filePath) => filePath.endsWith(".md") || filePath.endsWith(".mdx")
|
|
20
|
+
);
|
|
21
|
+
export {
|
|
22
|
+
load
|
|
23
|
+
};
|
package/dist/runtime/async.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LoadedConfig, a as RuntimeAsync } from '../types-
|
|
1
|
+
import { L as LoadedConfig, a as RuntimeAsync } from '../types-DT83Ijs6.cjs';
|
|
2
2
|
import '@standard-schema/spec';
|
|
3
3
|
import 'fumadocs-core/source';
|
|
4
|
-
import '../define-
|
|
4
|
+
import '../define-BH4bnHQl.cjs';
|
|
5
5
|
import 'fumadocs-core/mdx-plugins';
|
|
6
6
|
import '@mdx-js/mdx';
|
|
7
7
|
import 'unified';
|
package/dist/runtime/async.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LoadedConfig, a as RuntimeAsync } from '../types-
|
|
1
|
+
import { L as LoadedConfig, a as RuntimeAsync } from '../types-DN9KrG7R.js';
|
|
2
2
|
import '@standard-schema/spec';
|
|
3
3
|
import 'fumadocs-core/source';
|
|
4
|
-
import '../define-
|
|
4
|
+
import '../define-BH4bnHQl.js';
|
|
5
5
|
import 'fumadocs-core/mdx-plugins';
|
|
6
6
|
import '@mdx-js/mdx';
|
|
7
7
|
import 'unified';
|
|
@@ -0,0 +1,103 @@
|
|
|
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/browser.ts
|
|
21
|
+
var browser_exports = {};
|
|
22
|
+
__export(browser_exports, {
|
|
23
|
+
createClientLoader: () => createClientLoader,
|
|
24
|
+
fromConfig: () => fromConfigBase,
|
|
25
|
+
toClientRenderer: () => toClientRenderer
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(browser_exports);
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
|
|
30
|
+
// src/runtime/vite/base.ts
|
|
31
|
+
function fromConfigBase() {
|
|
32
|
+
function normalize(entries, base) {
|
|
33
|
+
const out = {};
|
|
34
|
+
for (const k in entries) {
|
|
35
|
+
const mappedK = k.startsWith("./") ? k.slice(2) : k;
|
|
36
|
+
if (base) Object.assign(entries[k], { base });
|
|
37
|
+
out[mappedK] = entries[k];
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
doc(_, base, glob) {
|
|
43
|
+
return normalize(glob, base);
|
|
44
|
+
},
|
|
45
|
+
meta(_, base, glob) {
|
|
46
|
+
return normalize(glob, base);
|
|
47
|
+
},
|
|
48
|
+
docLazy(_, base, head, body) {
|
|
49
|
+
return {
|
|
50
|
+
base,
|
|
51
|
+
head: normalize(head),
|
|
52
|
+
body: normalize(body)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/runtime/vite/browser.ts
|
|
59
|
+
var loaderStore = /* @__PURE__ */ new Map();
|
|
60
|
+
function createClientLoader(files, options) {
|
|
61
|
+
const { id = "", component } = options;
|
|
62
|
+
let renderer;
|
|
63
|
+
const store = loaderStore.get(id) ?? {
|
|
64
|
+
preloaded: /* @__PURE__ */ new Map()
|
|
65
|
+
};
|
|
66
|
+
loaderStore.set(id, store);
|
|
67
|
+
function getRenderer() {
|
|
68
|
+
if (renderer) return renderer;
|
|
69
|
+
renderer = {};
|
|
70
|
+
for (const k in files) {
|
|
71
|
+
const OnDemand = (0, import_react.lazy)(async () => {
|
|
72
|
+
const loaded = await files[k]();
|
|
73
|
+
return { default: (props) => component(loaded, props) };
|
|
74
|
+
});
|
|
75
|
+
renderer[k] = (props) => {
|
|
76
|
+
const cached = store.preloaded.get(k);
|
|
77
|
+
if (!cached) return (0, import_react.createElement)(OnDemand, props);
|
|
78
|
+
return component(cached, props);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return renderer;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
async preload(path) {
|
|
85
|
+
const loaded = await files[path]();
|
|
86
|
+
store.preloaded.set(path, loaded);
|
|
87
|
+
return loaded;
|
|
88
|
+
},
|
|
89
|
+
getRenderer,
|
|
90
|
+
getComponent(path) {
|
|
91
|
+
return getRenderer()[path];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function toClientRenderer(files, component) {
|
|
96
|
+
return createClientLoader(files, { component }).getRenderer();
|
|
97
|
+
}
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
createClientLoader,
|
|
101
|
+
fromConfig,
|
|
102
|
+
toClientRenderer
|
|
103
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { a as ClientLoader, b as ClientLoaderOptions, c as createClientLoader, f as fromConfig, t as toClientRenderer } from '../../browser-B2G8uAF2.cjs';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../../build-mdx-DnC1jKvn.cjs';
|
|
4
|
+
import '@mdx-js/mdx';
|
|
5
|
+
import 'fumadocs-core/mdx-plugins';
|
|
6
|
+
import 'fumadocs-core/server';
|
|
7
|
+
import 'mdx/types';
|
|
8
|
+
import '../../define-BH4bnHQl.cjs';
|
|
9
|
+
import '@standard-schema/spec';
|
|
10
|
+
import 'unified';
|
|
11
|
+
import 'zod';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { a as ClientLoader, b as ClientLoaderOptions, c as createClientLoader, f as fromConfig, t as toClientRenderer } from '../../browser-DrH7tKRi.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../../build-mdx-DnC1jKvn.js';
|
|
4
|
+
import '@mdx-js/mdx';
|
|
5
|
+
import 'fumadocs-core/mdx-plugins';
|
|
6
|
+
import 'fumadocs-core/server';
|
|
7
|
+
import 'mdx/types';
|
|
8
|
+
import '../../define-BH4bnHQl.js';
|
|
9
|
+
import '@standard-schema/spec';
|
|
10
|
+
import 'unified';
|
|
11
|
+
import 'zod';
|
|
@@ -27,17 +27,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
|
-
// src/runtime/vite.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
30
|
+
// src/runtime/vite/server.ts
|
|
31
|
+
var server_exports = {};
|
|
32
|
+
__export(server_exports, {
|
|
33
33
|
createClientLoader: () => createClientLoader,
|
|
34
34
|
fromConfig: () => fromConfig,
|
|
35
35
|
toClientRenderer: () => toClientRenderer
|
|
36
36
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function
|
|
37
|
+
module.exports = __toCommonJS(server_exports);
|
|
38
|
+
|
|
39
|
+
// src/runtime/vite/base.ts
|
|
40
|
+
function fromConfigBase() {
|
|
41
41
|
function normalize(entries, base) {
|
|
42
42
|
const out = {};
|
|
43
43
|
for (const k in entries) {
|
|
@@ -47,6 +47,71 @@ function fromConfig() {
|
|
|
47
47
|
}
|
|
48
48
|
return out;
|
|
49
49
|
}
|
|
50
|
+
return {
|
|
51
|
+
doc(_, base, glob) {
|
|
52
|
+
return normalize(glob, base);
|
|
53
|
+
},
|
|
54
|
+
meta(_, base, glob) {
|
|
55
|
+
return normalize(glob, base);
|
|
56
|
+
},
|
|
57
|
+
docLazy(_, base, head, body) {
|
|
58
|
+
return {
|
|
59
|
+
base,
|
|
60
|
+
head: normalize(head),
|
|
61
|
+
body: normalize(body)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/runtime/vite/server.ts
|
|
68
|
+
var path = __toESM(require("path"), 1);
|
|
69
|
+
|
|
70
|
+
// src/runtime/vite/browser.ts
|
|
71
|
+
var import_react = require("react");
|
|
72
|
+
var loaderStore = /* @__PURE__ */ new Map();
|
|
73
|
+
function createClientLoader(files, options) {
|
|
74
|
+
const { id = "", component } = options;
|
|
75
|
+
let renderer;
|
|
76
|
+
const store = loaderStore.get(id) ?? {
|
|
77
|
+
preloaded: /* @__PURE__ */ new Map()
|
|
78
|
+
};
|
|
79
|
+
loaderStore.set(id, store);
|
|
80
|
+
function getRenderer() {
|
|
81
|
+
if (renderer) return renderer;
|
|
82
|
+
renderer = {};
|
|
83
|
+
for (const k in files) {
|
|
84
|
+
const OnDemand = (0, import_react.lazy)(async () => {
|
|
85
|
+
const loaded = await files[k]();
|
|
86
|
+
return { default: (props) => component(loaded, props) };
|
|
87
|
+
});
|
|
88
|
+
renderer[k] = (props) => {
|
|
89
|
+
const cached = store.preloaded.get(k);
|
|
90
|
+
if (!cached) return (0, import_react.createElement)(OnDemand, props);
|
|
91
|
+
return component(cached, props);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return renderer;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
async preload(path2) {
|
|
98
|
+
const loaded = await files[path2]();
|
|
99
|
+
store.preloaded.set(path2, loaded);
|
|
100
|
+
return loaded;
|
|
101
|
+
},
|
|
102
|
+
getRenderer,
|
|
103
|
+
getComponent(path2) {
|
|
104
|
+
return getRenderer()[path2];
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function toClientRenderer(files, component) {
|
|
109
|
+
return createClientLoader(files, { component }).getRenderer();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/runtime/vite/server.ts
|
|
113
|
+
function fromConfig() {
|
|
114
|
+
const base = fromConfigBase();
|
|
50
115
|
function mapPageData(entry) {
|
|
51
116
|
const { toc, structuredData, lastModified, frontmatter } = entry;
|
|
52
117
|
return {
|
|
@@ -69,26 +134,14 @@ function fromConfig() {
|
|
|
69
134
|
};
|
|
70
135
|
}
|
|
71
136
|
return {
|
|
72
|
-
|
|
73
|
-
return normalize(glob, base);
|
|
74
|
-
},
|
|
75
|
-
meta(_, base, glob) {
|
|
76
|
-
return normalize(glob, base);
|
|
77
|
-
},
|
|
78
|
-
docLazy(_, base, head, body) {
|
|
79
|
-
return {
|
|
80
|
-
base,
|
|
81
|
-
head: normalize(head),
|
|
82
|
-
body: normalize(body)
|
|
83
|
-
};
|
|
84
|
-
},
|
|
137
|
+
...base,
|
|
85
138
|
async sourceAsync(doc, meta) {
|
|
86
139
|
const virtualFiles = [
|
|
87
140
|
...Object.entries(doc).map(async ([file, content]) => {
|
|
88
141
|
return {
|
|
89
142
|
type: "page",
|
|
90
143
|
path: file,
|
|
91
|
-
absolutePath:
|
|
144
|
+
absolutePath: path.join(content.base, file),
|
|
92
145
|
data: mapPageData(await content())
|
|
93
146
|
};
|
|
94
147
|
}),
|
|
@@ -96,7 +149,7 @@ function fromConfig() {
|
|
|
96
149
|
return {
|
|
97
150
|
type: "meta",
|
|
98
151
|
path: file,
|
|
99
|
-
absolutePath:
|
|
152
|
+
absolutePath: path.join(content.base, file),
|
|
100
153
|
data: await content()
|
|
101
154
|
};
|
|
102
155
|
})
|
|
@@ -109,7 +162,7 @@ function fromConfig() {
|
|
|
109
162
|
return {
|
|
110
163
|
type: "page",
|
|
111
164
|
path: file,
|
|
112
|
-
absolutePath:
|
|
165
|
+
absolutePath: path.join(doc.base, file),
|
|
113
166
|
data: mapPageDataLazy(await frontmatter(), doc.body[file])
|
|
114
167
|
};
|
|
115
168
|
}),
|
|
@@ -117,7 +170,7 @@ function fromConfig() {
|
|
|
117
170
|
return {
|
|
118
171
|
type: "meta",
|
|
119
172
|
path: file,
|
|
120
|
-
absolutePath:
|
|
173
|
+
absolutePath: path.join(content.base, file),
|
|
121
174
|
data: await content()
|
|
122
175
|
};
|
|
123
176
|
})
|
|
@@ -126,45 +179,6 @@ function fromConfig() {
|
|
|
126
179
|
}
|
|
127
180
|
};
|
|
128
181
|
}
|
|
129
|
-
var loaderStore = /* @__PURE__ */ new Map();
|
|
130
|
-
function createClientLoader(files, options) {
|
|
131
|
-
const { id = "", component } = options;
|
|
132
|
-
let renderer;
|
|
133
|
-
const store = loaderStore.get(id) ?? {
|
|
134
|
-
preloaded: /* @__PURE__ */ new Map()
|
|
135
|
-
};
|
|
136
|
-
loaderStore.set(id, store);
|
|
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) };
|
|
144
|
-
});
|
|
145
|
-
renderer[k] = (props) => {
|
|
146
|
-
const cached = store.preloaded.get(k);
|
|
147
|
-
if (!cached) return (0, import_react.createElement)(OnDemand, props);
|
|
148
|
-
return component(cached, props);
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
return renderer;
|
|
152
|
-
}
|
|
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();
|
|
167
|
-
}
|
|
168
182
|
// Annotate the CommonJS export names for ESM import in node:
|
|
169
183
|
0 && (module.exports = {
|
|
170
184
|
createClientLoader,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { B as BaseCreate, D as DocMap, M as MetaMap, L as LazyDocMap, C as CompiledMDXFile } from '../../browser-B2G8uAF2.cjs';
|
|
2
|
+
export { a as ClientLoader, b as ClientLoaderOptions, c as createClientLoader, t as toClientRenderer } from '../../browser-B2G8uAF2.cjs';
|
|
3
|
+
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
4
|
+
import { C as CompiledMDXProperties } from '../../build-mdx-DnC1jKvn.cjs';
|
|
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';
|
|
10
|
+
import '@mdx-js/mdx';
|
|
11
|
+
import 'unified';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import 'fumadocs-core/server';
|
|
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
|
+
interface ServerCreate<Config> extends BaseCreate<Config> {
|
|
30
|
+
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: DocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
31
|
+
pageData: MDXFileToPageData<DocOut>;
|
|
32
|
+
metaData: MetaOut;
|
|
33
|
+
}>>;
|
|
34
|
+
sourceLazy: <DocOut extends PageData, MetaOut extends MetaData>(doc: LazyDocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
35
|
+
pageData: MDXFileToPageDataLazy<DocOut>;
|
|
36
|
+
metaData: MetaOut;
|
|
37
|
+
}>>;
|
|
38
|
+
}
|
|
39
|
+
declare function fromConfig<Config>(): ServerCreate<Config>;
|
|
40
|
+
|
|
41
|
+
export { CompiledMDXFile, type ServerCreate, fromConfig };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { B as BaseCreate, D as DocMap, M as MetaMap, L as LazyDocMap, C as CompiledMDXFile } from '../../browser-DrH7tKRi.js';
|
|
2
|
+
export { a as ClientLoader, b as ClientLoaderOptions, c as createClientLoader, t as toClientRenderer } from '../../browser-DrH7tKRi.js';
|
|
3
|
+
import { PageData, MetaData, Source } from 'fumadocs-core/source';
|
|
4
|
+
import { C as CompiledMDXProperties } from '../../build-mdx-DnC1jKvn.js';
|
|
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';
|
|
10
|
+
import '@mdx-js/mdx';
|
|
11
|
+
import 'unified';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import 'fumadocs-core/server';
|
|
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
|
+
interface ServerCreate<Config> extends BaseCreate<Config> {
|
|
30
|
+
sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: DocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
31
|
+
pageData: MDXFileToPageData<DocOut>;
|
|
32
|
+
metaData: MetaOut;
|
|
33
|
+
}>>;
|
|
34
|
+
sourceLazy: <DocOut extends PageData, MetaOut extends MetaData>(doc: LazyDocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
|
|
35
|
+
pageData: MDXFileToPageDataLazy<DocOut>;
|
|
36
|
+
metaData: MetaOut;
|
|
37
|
+
}>>;
|
|
38
|
+
}
|
|
39
|
+
declare function fromConfig<Config>(): ServerCreate<Config>;
|
|
40
|
+
|
|
41
|
+
export { CompiledMDXFile, type ServerCreate, fromConfig };
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
createClientLoader,
|
|
3
|
+
fromConfigBase,
|
|
4
|
+
toClientRenderer
|
|
5
|
+
} from "../../chunk-46UPKP5R.js";
|
|
6
|
+
|
|
7
|
+
// src/runtime/vite/server.ts
|
|
8
|
+
import * as path from "path";
|
|
4
9
|
function fromConfig() {
|
|
5
|
-
|
|
6
|
-
const out = {};
|
|
7
|
-
for (const k in entries) {
|
|
8
|
-
const mappedK = k.startsWith("./") ? k.slice(2) : k;
|
|
9
|
-
if (base) Object.assign(entries[k], { base });
|
|
10
|
-
out[mappedK] = entries[k];
|
|
11
|
-
}
|
|
12
|
-
return out;
|
|
13
|
-
}
|
|
10
|
+
const base = fromConfigBase();
|
|
14
11
|
function mapPageData(entry) {
|
|
15
12
|
const { toc, structuredData, lastModified, frontmatter } = entry;
|
|
16
13
|
return {
|
|
@@ -33,19 +30,7 @@ function fromConfig() {
|
|
|
33
30
|
};
|
|
34
31
|
}
|
|
35
32
|
return {
|
|
36
|
-
|
|
37
|
-
return normalize(glob, base);
|
|
38
|
-
},
|
|
39
|
-
meta(_, base, glob) {
|
|
40
|
-
return normalize(glob, base);
|
|
41
|
-
},
|
|
42
|
-
docLazy(_, base, head, body) {
|
|
43
|
-
return {
|
|
44
|
-
base,
|
|
45
|
-
head: normalize(head),
|
|
46
|
-
body: normalize(body)
|
|
47
|
-
};
|
|
48
|
-
},
|
|
33
|
+
...base,
|
|
49
34
|
async sourceAsync(doc, meta) {
|
|
50
35
|
const virtualFiles = [
|
|
51
36
|
...Object.entries(doc).map(async ([file, content]) => {
|
|
@@ -90,45 +75,6 @@ function fromConfig() {
|
|
|
90
75
|
}
|
|
91
76
|
};
|
|
92
77
|
}
|
|
93
|
-
var loaderStore = /* @__PURE__ */ new Map();
|
|
94
|
-
function createClientLoader(files, options) {
|
|
95
|
-
const { id = "", component } = options;
|
|
96
|
-
let renderer;
|
|
97
|
-
const store = loaderStore.get(id) ?? {
|
|
98
|
-
preloaded: /* @__PURE__ */ new Map()
|
|
99
|
-
};
|
|
100
|
-
loaderStore.set(id, store);
|
|
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) };
|
|
108
|
-
});
|
|
109
|
-
renderer[k] = (props) => {
|
|
110
|
-
const cached = store.preloaded.get(k);
|
|
111
|
-
if (!cached) return createElement(OnDemand, props);
|
|
112
|
-
return component(cached, props);
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return renderer;
|
|
116
|
-
}
|
|
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();
|
|
131
|
-
}
|
|
132
78
|
export {
|
|
133
79
|
createClientLoader,
|
|
134
80
|
fromConfig,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
3
|
-
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-
|
|
3
|
+
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-BH4bnHQl.js';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
5
|
import { C as CompiledMDXProperties } from './build-mdx-DnC1jKvn.js';
|
|
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 { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-
|
|
3
|
+
import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-BH4bnHQl.cjs';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
5
5
|
import { C as CompiledMDXProperties } from './build-mdx-DnC1jKvn.cjs';
|
|
6
6
|
|