fumadocs-mdx 12.0.2 → 13.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.
Files changed (80) hide show
  1. package/dist/bin.cjs +1033 -308
  2. package/dist/bin.js +4 -4
  3. package/dist/build-mdx-BHG-_uxo.d.cts +53 -0
  4. package/dist/build-mdx-CzrQDBRZ.d.ts +53 -0
  5. package/dist/bun/index.cjs +92 -28
  6. package/dist/bun/index.js +6 -7
  7. package/dist/{chunk-QAUWMR5D.js → chunk-3J3WL7WN.js} +23 -5
  8. package/dist/chunk-4MAYA5QX.js +44 -0
  9. package/dist/{chunk-RMDXSZYE.js → chunk-CEA6MYJU.js} +13 -8
  10. package/dist/{chunk-IQAEAI4P.js → chunk-HI62EXSB.js} +63 -2
  11. package/dist/{chunk-46UPKP5R.js → chunk-II3H5ZVZ.js} +5 -5
  12. package/dist/{chunk-LGYVNESJ.js → chunk-JVZFH6ND.js} +6 -22
  13. package/dist/{chunk-LMG6UWCL.js → chunk-K5ZLPEIQ.js} +56 -16
  14. package/dist/{chunk-AUOOMFAI.js → chunk-KILFIBVW.js} +4 -13
  15. package/dist/chunk-NVRDCY6Z.js +30 -0
  16. package/dist/{chunk-VXEBLM4X.js → chunk-XV5Z4BFL.js} +1 -1
  17. package/dist/config/index.cjs +56 -16
  18. package/dist/config/index.d.cts +2 -1
  19. package/dist/config/index.d.ts +2 -1
  20. package/dist/config/index.js +1 -1
  21. package/dist/{define-DJbJduHy.d.ts → define-BCNh3n4O.d.cts} +40 -16
  22. package/dist/{define-DJbJduHy.d.cts → define-bck_EB4t.d.ts} +40 -16
  23. package/dist/index.cjs +0 -109
  24. package/dist/index.d.cts +73 -12
  25. package/dist/index.d.ts +73 -12
  26. package/dist/index.js +0 -11
  27. package/dist/{load-UUXLUBHL.js → load-MNG3CLET.js} +1 -3
  28. package/dist/loader-mdx.cjs +153 -60
  29. package/dist/loader-mdx.d.cts +1 -0
  30. package/dist/loader-mdx.d.ts +1 -0
  31. package/dist/loader-mdx.js +23 -9
  32. package/dist/next/index.cjs +213 -181
  33. package/dist/next/index.d.cts +2 -11
  34. package/dist/next/index.d.ts +2 -11
  35. package/dist/next/index.js +145 -117
  36. package/dist/node/loader.cjs +128 -70
  37. package/dist/node/loader.js +14 -9
  38. package/dist/plugins/index.cjs +78 -0
  39. package/dist/plugins/index.d.cts +7 -0
  40. package/dist/plugins/index.d.ts +7 -0
  41. package/dist/plugins/index.js +6 -0
  42. package/dist/plugins/json-schema.cjs +61 -0
  43. package/dist/plugins/json-schema.d.cts +16 -0
  44. package/dist/plugins/json-schema.d.ts +16 -0
  45. package/dist/plugins/json-schema.js +40 -0
  46. package/dist/remark-postprocess-K233ZVBK.d.cts +22 -0
  47. package/dist/remark-postprocess-K233ZVBK.d.ts +22 -0
  48. package/dist/runtime/next/async.cjs +109 -71
  49. package/dist/runtime/next/async.d.cts +9 -6
  50. package/dist/runtime/next/async.d.ts +9 -6
  51. package/dist/runtime/next/async.js +9 -19
  52. package/dist/runtime/next/index.cjs +26 -15
  53. package/dist/runtime/next/index.d.cts +11 -8
  54. package/dist/runtime/next/index.d.ts +11 -8
  55. package/dist/runtime/next/index.js +2 -2
  56. package/dist/runtime/vite/browser.cjs +7 -3
  57. package/dist/runtime/vite/browser.d.cts +56 -7
  58. package/dist/runtime/vite/browser.d.ts +56 -7
  59. package/dist/runtime/vite/browser.js +2 -1
  60. package/dist/runtime/vite/server.cjs +46 -36
  61. package/dist/runtime/vite/server.d.cts +13 -10
  62. package/dist/runtime/vite/server.d.ts +13 -10
  63. package/dist/runtime/vite/server.js +14 -25
  64. package/dist/{types-Ci6BA1tA.d.ts → types-1cCFEzWt.d.ts} +3 -10
  65. package/dist/{types-CbLt05Gc.d.cts → types-D5NhXTJY.d.cts} +3 -10
  66. package/dist/vite/index.cjs +387 -220
  67. package/dist/vite/index.d.cts +29 -10
  68. package/dist/vite/index.d.ts +29 -10
  69. package/dist/vite/index.js +212 -33
  70. package/dist/{watcher-HGOH3APP.js → watcher-WXJDWRZY.js} +1 -1
  71. package/package.json +29 -16
  72. package/dist/browser-BupUnhpC.d.ts +0 -98
  73. package/dist/browser-R0x9IPaQ.d.cts +0 -98
  74. package/dist/chunk-ADR6R7HM.js +0 -29
  75. package/dist/chunk-XMFLD5J6.js +0 -30
  76. package/dist/chunk-ZLCSVXCD.js +0 -10
  77. package/dist/chunk-ZX7TM4AR.js +0 -127
  78. package/dist/postinstall-SCSXM4IM.js +0 -10
  79. package/dist/shared-Cnm1afPW.d.cts +0 -71
  80. package/dist/shared-DpXxElc1.d.ts +0 -71
@@ -22,12 +22,13 @@ var browser_exports = {};
22
22
  __export(browser_exports, {
23
23
  createClientLoader: () => createClientLoader,
24
24
  fromConfig: () => fromConfigBase,
25
+ fromConfigBase: () => fromConfigBase,
25
26
  toClientRenderer: () => toClientRenderer
26
27
  });
27
28
  module.exports = __toCommonJS(browser_exports);
28
- var import_react = require("react");
29
29
 
30
30
  // src/runtime/vite/base.ts
31
+ var import_react = require("react");
31
32
  function fromConfigBase() {
32
33
  function normalize(entries, base) {
33
34
  const out = {};
@@ -54,8 +55,6 @@ function fromConfigBase() {
54
55
  }
55
56
  };
56
57
  }
57
-
58
- // src/runtime/vite/browser.ts
59
58
  var loaderStore = /* @__PURE__ */ new Map();
60
59
  function createClientLoader(files, options) {
61
60
  const { id = "", component } = options;
@@ -89,6 +88,10 @@ function createClientLoader(files, options) {
89
88
  getRenderer,
90
89
  getComponent(path) {
91
90
  return getRenderer()[path];
91
+ },
92
+ useContent(path, props) {
93
+ const Comp = this.getComponent(path);
94
+ return (0, import_react.createElement)(Comp, props);
92
95
  }
93
96
  };
94
97
  }
@@ -99,5 +102,6 @@ function toClientRenderer(files, component) {
99
102
  0 && (module.exports = {
100
103
  createClientLoader,
101
104
  fromConfig,
105
+ fromConfigBase,
102
106
  toClientRenderer
103
107
  });
@@ -1,10 +1,59 @@
1
- export { C as ClientLoader, a as ClientLoaderOptions, c as createClientLoader, f as fromConfig, t as toClientRenderer } from '../../browser-R0x9IPaQ.cjs';
2
- import 'react';
3
- import '@mdx-js/mdx';
1
+ import { a as DocCollection, b as DocsCollection, M as MetaCollection } from '../../define-BCNh3n4O.cjs';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
3
+ import { C as CompiledMDXProperties } from '../../build-mdx-BHG-_uxo.cjs';
4
+ import { ReactNode, FC } from 'react';
4
5
  import 'fumadocs-core/mdx-plugins';
5
- import 'fumadocs-core/server';
6
- import 'mdx/types';
7
- import '../../define-DJbJduHy.cjs';
8
- import '@standard-schema/spec';
6
+ import '@mdx-js/mdx';
9
7
  import 'unified';
10
8
  import 'zod';
9
+ import '../../remark-postprocess-K233ZVBK.cjs';
10
+ import 'fumadocs-core/toc';
11
+ import 'mdx/types';
12
+
13
+ type CompiledMDXFile<Frontmatter> = CompiledMDXProperties<Frontmatter> & Record<string, unknown>;
14
+ type DocMap<Frontmatter> = Record<string, (() => Promise<CompiledMDXFile<Frontmatter>>) & {
15
+ base: string;
16
+ }>;
17
+ type MetaMap<Data> = Record<string, (() => Promise<Data>) & {
18
+ base: string;
19
+ }>;
20
+ interface LazyDocMap<Frontmatter> {
21
+ base: string;
22
+ head: Record<string, () => Promise<Frontmatter>>;
23
+ body: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>;
24
+ }
25
+ interface BaseCreate<Config> {
26
+ 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;
27
+ 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;
28
+ 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;
29
+ }
30
+ declare function fromConfigBase<Config>(): BaseCreate<Config>;
31
+ interface ClientLoaderOptions<Frontmatter, Props> {
32
+ /**
33
+ * Loader ID (usually your collection name)
34
+ *
35
+ * The code splitting strategy of frameworks like Tanstack Start may duplicate `createClientLoader()` into different chunks.
36
+ *
37
+ * We use loader ID to share cache between multiple instances of client loader.
38
+ *
39
+ * @defaultValue ''
40
+ */
41
+ id?: string;
42
+ component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode;
43
+ }
44
+ interface ClientLoader<Frontmatter, Props> {
45
+ preload: (path: string) => Promise<CompiledMDXFile<Frontmatter>>;
46
+ /**
47
+ * Get a component that renders content with `React.lazy`.
48
+ */
49
+ getComponent: (path: string) => FC<Props>;
50
+ /**
51
+ * Get react nodes that renders content with `React.lazy`.
52
+ */
53
+ useContent: (path: string, props: Props) => ReactNode;
54
+ getRenderer: () => Record<string, FC<Props>>;
55
+ }
56
+ declare function createClientLoader<Frontmatter, Props extends object = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, options: ClientLoaderOptions<Frontmatter, Props>): ClientLoader<Frontmatter, Props>;
57
+ declare function toClientRenderer<Frontmatter, Props extends object = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode): Record<string, FC<Props>>;
58
+
59
+ export { type BaseCreate, type ClientLoader, type ClientLoaderOptions, type CompiledMDXFile, type DocMap, type LazyDocMap, type MetaMap, createClientLoader, fromConfigBase as fromConfig, fromConfigBase, toClientRenderer };
@@ -1,10 +1,59 @@
1
- export { C as ClientLoader, a as ClientLoaderOptions, c as createClientLoader, f as fromConfig, t as toClientRenderer } from '../../browser-BupUnhpC.js';
2
- import 'react';
3
- import '@mdx-js/mdx';
1
+ import { a as DocCollection, b as DocsCollection, M as MetaCollection } from '../../define-bck_EB4t.js';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
3
+ import { C as CompiledMDXProperties } from '../../build-mdx-CzrQDBRZ.js';
4
+ import { ReactNode, FC } from 'react';
4
5
  import 'fumadocs-core/mdx-plugins';
5
- import 'fumadocs-core/server';
6
- import 'mdx/types';
7
- import '../../define-DJbJduHy.js';
8
- import '@standard-schema/spec';
6
+ import '@mdx-js/mdx';
9
7
  import 'unified';
10
8
  import 'zod';
9
+ import '../../remark-postprocess-K233ZVBK.js';
10
+ import 'fumadocs-core/toc';
11
+ import 'mdx/types';
12
+
13
+ type CompiledMDXFile<Frontmatter> = CompiledMDXProperties<Frontmatter> & Record<string, unknown>;
14
+ type DocMap<Frontmatter> = Record<string, (() => Promise<CompiledMDXFile<Frontmatter>>) & {
15
+ base: string;
16
+ }>;
17
+ type MetaMap<Data> = Record<string, (() => Promise<Data>) & {
18
+ base: string;
19
+ }>;
20
+ interface LazyDocMap<Frontmatter> {
21
+ base: string;
22
+ head: Record<string, () => Promise<Frontmatter>>;
23
+ body: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>;
24
+ }
25
+ interface BaseCreate<Config> {
26
+ 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;
27
+ 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;
28
+ 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;
29
+ }
30
+ declare function fromConfigBase<Config>(): BaseCreate<Config>;
31
+ interface ClientLoaderOptions<Frontmatter, Props> {
32
+ /**
33
+ * Loader ID (usually your collection name)
34
+ *
35
+ * The code splitting strategy of frameworks like Tanstack Start may duplicate `createClientLoader()` into different chunks.
36
+ *
37
+ * We use loader ID to share cache between multiple instances of client loader.
38
+ *
39
+ * @defaultValue ''
40
+ */
41
+ id?: string;
42
+ component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode;
43
+ }
44
+ interface ClientLoader<Frontmatter, Props> {
45
+ preload: (path: string) => Promise<CompiledMDXFile<Frontmatter>>;
46
+ /**
47
+ * Get a component that renders content with `React.lazy`.
48
+ */
49
+ getComponent: (path: string) => FC<Props>;
50
+ /**
51
+ * Get react nodes that renders content with `React.lazy`.
52
+ */
53
+ useContent: (path: string, props: Props) => ReactNode;
54
+ getRenderer: () => Record<string, FC<Props>>;
55
+ }
56
+ declare function createClientLoader<Frontmatter, Props extends object = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, options: ClientLoaderOptions<Frontmatter, Props>): ClientLoader<Frontmatter, Props>;
57
+ declare function toClientRenderer<Frontmatter, Props extends object = object>(files: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode): Record<string, FC<Props>>;
58
+
59
+ export { type BaseCreate, type ClientLoader, type ClientLoaderOptions, type CompiledMDXFile, type DocMap, type LazyDocMap, type MetaMap, createClientLoader, fromConfigBase as fromConfig, fromConfigBase, toClientRenderer };
@@ -2,9 +2,10 @@ import {
2
2
  createClientLoader,
3
3
  fromConfigBase,
4
4
  toClientRenderer
5
- } from "../../chunk-46UPKP5R.js";
5
+ } from "../../chunk-II3H5ZVZ.js";
6
6
  export {
7
7
  createClientLoader,
8
8
  fromConfigBase as fromConfig,
9
+ fromConfigBase,
9
10
  toClientRenderer
10
11
  };
@@ -32,11 +32,13 @@ var server_exports = {};
32
32
  __export(server_exports, {
33
33
  createClientLoader: () => createClientLoader,
34
34
  fromConfig: () => fromConfig,
35
+ fromConfigBase: () => fromConfigBase,
35
36
  toClientRenderer: () => toClientRenderer
36
37
  });
37
38
  module.exports = __toCommonJS(server_exports);
38
39
 
39
40
  // src/runtime/vite/base.ts
41
+ var import_react = require("react");
40
42
  function fromConfigBase() {
41
43
  function normalize(entries, base) {
42
44
  const out = {};
@@ -63,22 +65,6 @@ function fromConfigBase() {
63
65
  }
64
66
  };
65
67
  }
66
-
67
- // src/runtime/vite/server.ts
68
- var path = __toESM(require("path"), 1);
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
-
80
- // src/runtime/vite/browser.ts
81
- var import_react = require("react");
82
68
  var loaderStore = /* @__PURE__ */ new Map();
83
69
  function createClientLoader(files, options) {
84
70
  const { id = "", component } = options;
@@ -112,6 +98,10 @@ function createClientLoader(files, options) {
112
98
  getRenderer,
113
99
  getComponent(path2) {
114
100
  return getRenderer()[path2];
101
+ },
102
+ useContent(path2, props) {
103
+ const Comp = this.getComponent(path2);
104
+ return (0, import_react.createElement)(Comp, props);
115
105
  }
116
106
  };
117
107
  }
@@ -119,6 +109,36 @@ function toClientRenderer(files, component) {
119
109
  return createClientLoader(files, { component }).getRenderer();
120
110
  }
121
111
 
112
+ // src/runtime/vite/server.ts
113
+ var path = __toESM(require("path"), 1);
114
+
115
+ // src/runtime/shared.ts
116
+ var import_promises = __toESM(require("fs/promises"), 1);
117
+ function createDocMethods(info, load) {
118
+ return {
119
+ info,
120
+ async getText(type) {
121
+ if (type === "raw") {
122
+ return (await import_promises.default.readFile(info.fullPath)).toString();
123
+ }
124
+ const data = await load();
125
+ if (typeof data._markdown !== "string")
126
+ throw new Error(
127
+ "getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
128
+ );
129
+ return data._markdown;
130
+ },
131
+ async getMDAST() {
132
+ const data = await load();
133
+ if (!data._mdast)
134
+ throw new Error(
135
+ "getMDAST() requires `includeMDAST` to be enabled in your collection config."
136
+ );
137
+ return JSON.parse(data._mdast);
138
+ }
139
+ };
140
+ }
141
+
122
142
  // src/runtime/vite/server.ts
123
143
  function fromConfig() {
124
144
  const base = fromConfigBase();
@@ -141,31 +161,16 @@ function fromConfig() {
141
161
  function mapPageData(info, entry) {
142
162
  return {
143
163
  ...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
164
+ ...entry.frontmatter,
165
+ ...createDocMethods(info, async () => entry)
153
166
  };
154
167
  }
155
168
  function mapPageDataLazy(info, head, content) {
156
169
  return {
157
170
  ...head,
158
- info,
171
+ ...createDocMethods(info, content),
159
172
  async load() {
160
173
  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;
169
174
  }
170
175
  };
171
176
  }
@@ -198,7 +203,9 @@ function fromConfig() {
198
203
  };
199
204
  })
200
205
  ];
201
- return { files: await Promise.all(virtualFiles) };
206
+ return {
207
+ files: await Promise.all(virtualFiles)
208
+ };
202
209
  },
203
210
  async sourceLazy(doc, meta) {
204
211
  const virtualFiles = [
@@ -221,7 +228,9 @@ function fromConfig() {
221
228
  };
222
229
  })
223
230
  ];
224
- return { files: await Promise.all(virtualFiles) };
231
+ return {
232
+ files: await Promise.all(virtualFiles)
233
+ };
225
234
  }
226
235
  };
227
236
  }
@@ -229,5 +238,6 @@ function fromConfig() {
229
238
  0 && (module.exports = {
230
239
  createClientLoader,
231
240
  fromConfig,
241
+ fromConfigBase,
232
242
  toClientRenderer
233
243
  });
@@ -1,16 +1,19 @@
1
- import { B as BaseCreate, D as DocMap, M as MetaMap, L as LazyDocMap } from '../../browser-R0x9IPaQ.cjs';
2
- export { C as ClientLoader, a as ClientLoaderOptions, b as CompiledMDXFile, c as createClientLoader, t as toClientRenderer } from '../../browser-R0x9IPaQ.cjs';
3
1
  import { PageData, MetaData, Source } from 'fumadocs-core/source';
4
- import { D as DocCollectionEntry, M as MetaCollectionEntry, A as AsyncDocCollectionEntry } from '../../shared-Cnm1afPW.cjs';
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-DJbJduHy.cjs';
2
+ import { BaseCreate, DocMap, MetaMap, LazyDocMap } from './browser.cjs';
3
+ export { ClientLoader, ClientLoaderOptions, CompiledMDXFile, createClientLoader, fromConfig as fromConfigBase, toClientRenderer } from './browser.cjs';
4
+ import { DocCollectionEntry, MetaCollectionEntry, AsyncDocCollectionEntry } from '../../index.cjs';
5
+ import '../../define-BCNh3n4O.cjs';
11
6
  import '@standard-schema/spec';
7
+ import 'fumadocs-core/mdx-plugins';
8
+ import '@mdx-js/mdx';
12
9
  import 'unified';
13
10
  import 'zod';
11
+ import '../../remark-postprocess-K233ZVBK.cjs';
12
+ import '../../build-mdx-BHG-_uxo.cjs';
13
+ import 'fumadocs-core/toc';
14
+ import 'react';
15
+ import 'mdx/types';
16
+ import 'mdast';
14
17
 
15
18
  interface ServerCreate<Config> extends BaseCreate<Config> {
16
19
  sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: DocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
@@ -24,4 +27,4 @@ interface ServerCreate<Config> extends BaseCreate<Config> {
24
27
  }
25
28
  declare function fromConfig<Config>(): ServerCreate<Config>;
26
29
 
27
- export { DocMap, LazyDocMap, MetaMap, type ServerCreate, fromConfig };
30
+ export { BaseCreate, DocMap, LazyDocMap, MetaMap, type ServerCreate, fromConfig };
@@ -1,16 +1,19 @@
1
- import { B as BaseCreate, D as DocMap, M as MetaMap, L as LazyDocMap } from '../../browser-BupUnhpC.js';
2
- export { C as ClientLoader, a as ClientLoaderOptions, b as CompiledMDXFile, c as createClientLoader, t as toClientRenderer } from '../../browser-BupUnhpC.js';
3
1
  import { PageData, MetaData, Source } from 'fumadocs-core/source';
4
- import { D as DocCollectionEntry, M as MetaCollectionEntry, A as AsyncDocCollectionEntry } from '../../shared-DpXxElc1.js';
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-DJbJduHy.js';
2
+ import { BaseCreate, DocMap, MetaMap, LazyDocMap } from './browser.js';
3
+ export { ClientLoader, ClientLoaderOptions, CompiledMDXFile, createClientLoader, fromConfig as fromConfigBase, toClientRenderer } from './browser.js';
4
+ import { DocCollectionEntry, MetaCollectionEntry, AsyncDocCollectionEntry } from '../../index.js';
5
+ import '../../define-bck_EB4t.js';
11
6
  import '@standard-schema/spec';
7
+ import 'fumadocs-core/mdx-plugins';
8
+ import '@mdx-js/mdx';
12
9
  import 'unified';
13
10
  import 'zod';
11
+ import '../../remark-postprocess-K233ZVBK.js';
12
+ import '../../build-mdx-CzrQDBRZ.js';
13
+ import 'fumadocs-core/toc';
14
+ import 'react';
15
+ import 'mdx/types';
16
+ import 'mdast';
14
17
 
15
18
  interface ServerCreate<Config> extends BaseCreate<Config> {
16
19
  sourceAsync: <DocOut extends PageData, MetaOut extends MetaData>(doc: DocMap<DocOut>, meta: MetaMap<MetaOut>) => Promise<Source<{
@@ -24,4 +27,4 @@ interface ServerCreate<Config> extends BaseCreate<Config> {
24
27
  }
25
28
  declare function fromConfig<Config>(): ServerCreate<Config>;
26
29
 
27
- export { DocMap, LazyDocMap, MetaMap, type ServerCreate, fromConfig };
30
+ export { BaseCreate, DocMap, LazyDocMap, MetaMap, type ServerCreate, fromConfig };
@@ -1,15 +1,14 @@
1
+ import {
2
+ createDocMethods
3
+ } from "../../chunk-NVRDCY6Z.js";
1
4
  import {
2
5
  createClientLoader,
3
6
  fromConfigBase,
4
7
  toClientRenderer
5
- } from "../../chunk-46UPKP5R.js";
6
- import {
7
- missingProcessedMarkdown
8
- } from "../../chunk-ZLCSVXCD.js";
8
+ } from "../../chunk-II3H5ZVZ.js";
9
9
 
10
10
  // src/runtime/vite/server.ts
11
11
  import * as path from "path";
12
- import fs from "fs/promises";
13
12
  function fromConfig() {
14
13
  const base = fromConfigBase();
15
14
  function fileInfo(file, base2) {
@@ -31,31 +30,16 @@ function fromConfig() {
31
30
  function mapPageData(info, entry) {
32
31
  return {
33
32
  ...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
33
+ ...entry.frontmatter,
34
+ ...createDocMethods(info, async () => entry)
43
35
  };
44
36
  }
45
37
  function mapPageDataLazy(info, head, content) {
46
38
  return {
47
39
  ...head,
48
- info,
40
+ ...createDocMethods(info, content),
49
41
  async load() {
50
42
  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;
59
43
  }
60
44
  };
61
45
  }
@@ -88,7 +72,9 @@ function fromConfig() {
88
72
  };
89
73
  })
90
74
  ];
91
- return { files: await Promise.all(virtualFiles) };
75
+ return {
76
+ files: await Promise.all(virtualFiles)
77
+ };
92
78
  },
93
79
  async sourceLazy(doc, meta) {
94
80
  const virtualFiles = [
@@ -111,12 +97,15 @@ function fromConfig() {
111
97
  };
112
98
  })
113
99
  ];
114
- return { files: await Promise.all(virtualFiles) };
100
+ return {
101
+ files: await Promise.all(virtualFiles)
102
+ };
115
103
  }
116
104
  };
117
105
  }
118
106
  export {
119
107
  createClientLoader,
120
108
  fromConfig,
109
+ fromConfigBase,
121
110
  toClientRenderer
122
111
  };
@@ -1,14 +1,7 @@
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-DJbJduHy.js';
4
- import { ProcessorOptions } from '@mdx-js/mdx';
5
- import { F as FileInfo, D as DocCollectionEntry, M as MetaCollectionEntry, A as AsyncDocCollectionEntry } from './shared-DpXxElc1.js';
6
-
7
- interface LoadedConfig {
8
- collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
9
- global: GlobalConfig;
10
- getDefaultMDXOptions(mode?: 'default' | 'remote'): Promise<ProcessorOptions>;
11
- }
3
+ import { L as LoadedConfig, a as DocCollection, b as DocsCollection, M as MetaCollection } from './define-bck_EB4t.js';
4
+ import { FileInfo, AsyncDocCollectionEntry, MetaCollectionEntry, DocCollectionEntry } from './index.js';
12
5
 
13
6
  interface RuntimeFile {
14
7
  info: FileInfo;
@@ -49,4 +42,4 @@ interface RuntimeAsync {
49
42
  } : never;
50
43
  }
51
44
 
52
- export type { AsyncRuntimeFile as A, DocOut as D, LoadedConfig as L, MetaOut as M, RuntimeAsync as R, Runtime as a, RuntimeFile as b, AsyncDocOut as c };
45
+ export type { AsyncRuntimeFile as A, DocOut as D, MetaOut as M, Runtime as R, RuntimeFile as a, AsyncDocOut as b, RuntimeAsync as c };
@@ -1,14 +1,7 @@
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-DJbJduHy.cjs';
4
- import { ProcessorOptions } from '@mdx-js/mdx';
5
- import { F as FileInfo, D as DocCollectionEntry, M as MetaCollectionEntry, A as AsyncDocCollectionEntry } from './shared-Cnm1afPW.cjs';
6
-
7
- interface LoadedConfig {
8
- collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
9
- global: GlobalConfig;
10
- getDefaultMDXOptions(mode?: 'default' | 'remote'): Promise<ProcessorOptions>;
11
- }
3
+ import { L as LoadedConfig, a as DocCollection, b as DocsCollection, M as MetaCollection } from './define-BCNh3n4O.cjs';
4
+ import { FileInfo, AsyncDocCollectionEntry, MetaCollectionEntry, DocCollectionEntry } from './index.cjs';
12
5
 
13
6
  interface RuntimeFile {
14
7
  info: FileInfo;
@@ -49,4 +42,4 @@ interface RuntimeAsync {
49
42
  } : never;
50
43
  }
51
44
 
52
- export type { AsyncRuntimeFile as A, DocOut as D, LoadedConfig as L, MetaOut as M, RuntimeAsync as R, Runtime as a, RuntimeFile as b, AsyncDocOut as c };
45
+ export type { AsyncRuntimeFile as A, DocOut as D, MetaOut as M, Runtime as R, RuntimeFile as a, AsyncDocOut as b, RuntimeAsync as c };