fumadocs-mdx 11.6.0 → 13.0.1

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 (93) hide show
  1. package/dist/bin.cjs +1728 -0
  2. package/dist/bin.d.cts +1 -0
  3. package/dist/bin.d.ts +1 -0
  4. package/dist/bin.js +16 -0
  5. package/dist/build-mdx-CCNr86q6.d.ts +53 -0
  6. package/dist/build-mdx-D-r3_eQL.d.cts +53 -0
  7. package/dist/bun/index.cjs +857 -0
  8. package/dist/bun/index.d.cts +13 -0
  9. package/dist/bun/index.d.ts +13 -0
  10. package/dist/bun/index.js +62 -0
  11. package/dist/chunk-3J3WL7WN.js +160 -0
  12. package/dist/chunk-CXA4JO4Z.js +45 -0
  13. package/dist/chunk-EELYB2XC.js +207 -0
  14. package/dist/chunk-FSZMKRVH.js +80 -0
  15. package/dist/chunk-II3H5ZVZ.js +77 -0
  16. package/dist/chunk-JVZFH6ND.js +40 -0
  17. package/dist/chunk-K5ZLPEIQ.js +207 -0
  18. package/dist/{chunk-VFALQK6O.js → chunk-KILFIBVW.js} +21 -12
  19. package/dist/chunk-NVRDCY6Z.js +30 -0
  20. package/dist/chunk-U4MQ44TS.js +53 -0
  21. package/dist/chunk-VWJKRQZR.js +19 -0
  22. package/dist/chunk-XQ5O7IPO.js +128 -0
  23. package/dist/chunk-XZY2AWJI.js +81 -0
  24. package/dist/chunk-YVCR6FUH.js +82 -0
  25. package/dist/config/index.cjs +232 -128
  26. package/dist/config/index.d.cts +4 -6
  27. package/dist/config/index.d.ts +4 -6
  28. package/dist/config/index.js +26 -19
  29. package/dist/core-B6j6Fxse.d.cts +218 -0
  30. package/dist/core-B6j6Fxse.d.ts +218 -0
  31. package/dist/index.cjs +0 -76
  32. package/dist/index.d.cts +73 -20
  33. package/dist/index.d.ts +73 -20
  34. package/dist/index.js +0 -10
  35. package/dist/load-MNG3CLET.js +7 -0
  36. package/dist/next/index.cjs +567 -314
  37. package/dist/next/index.d.cts +9 -12
  38. package/dist/next/index.d.ts +9 -12
  39. package/dist/next/index.js +238 -211
  40. package/dist/node/loader.cjs +922 -0
  41. package/dist/node/loader.d.cts +5 -0
  42. package/dist/node/loader.d.ts +5 -0
  43. package/dist/node/loader.js +33 -0
  44. package/dist/plugins/json-schema.cjs +162 -0
  45. package/dist/plugins/json-schema.d.cts +24 -0
  46. package/dist/plugins/json-schema.d.ts +24 -0
  47. package/dist/plugins/json-schema.js +78 -0
  48. package/dist/{mdx-options-CAU273O3.js → preset-ZMP6U62C.js} +1 -1
  49. package/dist/runtime/next/async.cjs +715 -0
  50. package/dist/runtime/next/async.d.cts +21 -0
  51. package/dist/runtime/next/async.d.ts +21 -0
  52. package/dist/runtime/next/async.js +89 -0
  53. package/dist/runtime/next/index.cjs +136 -0
  54. package/dist/runtime/next/index.d.cts +33 -0
  55. package/dist/runtime/next/index.d.ts +33 -0
  56. package/dist/runtime/next/index.js +11 -0
  57. package/dist/runtime/vite/browser.cjs +107 -0
  58. package/dist/runtime/vite/browser.d.cts +59 -0
  59. package/dist/runtime/vite/browser.d.ts +59 -0
  60. package/dist/runtime/vite/browser.js +11 -0
  61. package/dist/runtime/vite/server.cjs +243 -0
  62. package/dist/runtime/vite/server.d.cts +30 -0
  63. package/dist/runtime/vite/server.d.ts +30 -0
  64. package/dist/runtime/vite/server.js +111 -0
  65. package/dist/types-AGzTfBmf.d.ts +45 -0
  66. package/dist/types-DKGMoay5.d.cts +45 -0
  67. package/dist/vite/index.cjs +1185 -0
  68. package/dist/vite/index.d.cts +45 -0
  69. package/dist/vite/index.d.ts +45 -0
  70. package/dist/vite/index.js +297 -0
  71. package/dist/webpack/index.cjs +957 -0
  72. package/dist/{loader-mdx.d.cts → webpack/index.d.cts} +3 -6
  73. package/dist/{loader-mdx.d.ts → webpack/index.d.ts} +3 -6
  74. package/dist/webpack/index.js +44 -0
  75. package/loader-mdx.cjs +1 -1
  76. package/package.json +86 -29
  77. package/bin.js +0 -5
  78. package/dist/chunk-2ZOW45YZ.js +0 -63
  79. package/dist/chunk-DRVUBK5B.js +0 -39
  80. package/dist/chunk-HFLDWPJA.js +0 -62
  81. package/dist/chunk-IOENRFUX.js +0 -112
  82. package/dist/chunk-MK7EXW7O.js +0 -75
  83. package/dist/define-BaW0PQDJ.d.cts +0 -201
  84. package/dist/define-BaW0PQDJ.d.ts +0 -201
  85. package/dist/loader-mdx.cjs +0 -527
  86. package/dist/loader-mdx.js +0 -162
  87. package/dist/runtime/async.cjs +0 -269
  88. package/dist/runtime/async.d.cts +0 -18
  89. package/dist/runtime/async.d.ts +0 -18
  90. package/dist/runtime/async.js +0 -73
  91. package/dist/types-BNrQHCj5.d.cts +0 -100
  92. package/dist/types-DEduCvIT.d.ts +0 -100
  93. package/dist/watcher-IAZDSTU7.js +0 -24
@@ -0,0 +1,21 @@
1
+ import { c as RuntimeAsync } from '../../types-DKGMoay5.cjs';
2
+ import { L as LoadedConfig } from '../../core-B6j6Fxse.cjs';
3
+ import '@standard-schema/spec';
4
+ import 'fumadocs-core/source';
5
+ import '../../index.cjs';
6
+ import 'fumadocs-core/mdx-plugins';
7
+ import 'fumadocs-core/toc';
8
+ import 'mdx/types';
9
+ import 'mdast';
10
+ import '../../build-mdx-D-r3_eQL.cjs';
11
+ import '@mdx-js/mdx';
12
+ import 'react';
13
+ import 'unified';
14
+ import 'zod';
15
+ import 'chokidar';
16
+
17
+ declare function buildConfig(config: Record<string, unknown>): LoadedConfig;
18
+
19
+ declare const _runtimeAsync: RuntimeAsync;
20
+
21
+ export { _runtimeAsync, buildConfig };
@@ -0,0 +1,21 @@
1
+ import { c as RuntimeAsync } from '../../types-AGzTfBmf.js';
2
+ import { L as LoadedConfig } from '../../core-B6j6Fxse.js';
3
+ import '@standard-schema/spec';
4
+ import 'fumadocs-core/source';
5
+ import '../../index.js';
6
+ import 'fumadocs-core/mdx-plugins';
7
+ import 'fumadocs-core/toc';
8
+ import 'mdx/types';
9
+ import 'mdast';
10
+ import '../../build-mdx-CCNr86q6.js';
11
+ import '@mdx-js/mdx';
12
+ import 'react';
13
+ import 'unified';
14
+ import 'zod';
15
+ import 'chokidar';
16
+
17
+ declare function buildConfig(config: Record<string, unknown>): LoadedConfig;
18
+
19
+ declare const _runtimeAsync: RuntimeAsync;
20
+
21
+ export { _runtimeAsync, buildConfig };
@@ -0,0 +1,89 @@
1
+ import {
2
+ _runtime,
3
+ createMDXSource
4
+ } from "../../chunk-KILFIBVW.js";
5
+ import {
6
+ createDocMethods
7
+ } from "../../chunk-NVRDCY6Z.js";
8
+ import {
9
+ buildConfig
10
+ } from "../../chunk-U4MQ44TS.js";
11
+ import {
12
+ buildMDX
13
+ } from "../../chunk-3J3WL7WN.js";
14
+ import "../../chunk-K5ZLPEIQ.js";
15
+ import {
16
+ fumaMatter
17
+ } from "../../chunk-VWJKRQZR.js";
18
+
19
+ // src/runtime/next/async.ts
20
+ import { executeMdx } from "@fumadocs/mdx-remote/client";
21
+ import { pathToFileURL } from "url";
22
+ import fs from "fs/promises";
23
+ function getDocCollection(config, collection) {
24
+ const col = config.collections.get(collection);
25
+ if (col?.type === "doc" && col.mdxOptions) return col;
26
+ if (col?.type === "docs" && col.docs.mdxOptions) return col.docs;
27
+ }
28
+ async function getOptions(config, collection) {
29
+ return collection?.mdxOptions ?? await config.getDefaultMDXOptions("remote");
30
+ }
31
+ var _runtimeAsync = {
32
+ doc(files, collectionName, config) {
33
+ const collection = getDocCollection(config, collectionName);
34
+ const initMdxOptions = getOptions(config, collection);
35
+ return files.map(({ info, data, lastModified }) => {
36
+ let cachedResult;
37
+ async function compileAndLoad() {
38
+ if (cachedResult) return cachedResult;
39
+ const mdxOptions = await initMdxOptions;
40
+ const raw = (await fs.readFile(info.fullPath)).toString();
41
+ const { content } = fumaMatter(raw);
42
+ const compiled = await buildMDX(collectionName, content, {
43
+ ...mdxOptions,
44
+ development: false,
45
+ frontmatter: data,
46
+ postprocess: collection?.postprocess,
47
+ data: {
48
+ lastModified
49
+ },
50
+ filePath: info.fullPath
51
+ });
52
+ const result = await executeMdx(String(compiled.value), {
53
+ baseUrl: pathToFileURL(info.fullPath)
54
+ });
55
+ return cachedResult = result;
56
+ }
57
+ return {
58
+ ...data,
59
+ ...createDocMethods(info, () => compileAndLoad()),
60
+ async load() {
61
+ const out = await compileAndLoad();
62
+ return {
63
+ _exports: out,
64
+ body: out.default,
65
+ lastModified,
66
+ toc: out.toc,
67
+ extractedReferences: out.extractedReferences,
68
+ structuredData: out.structuredData
69
+ };
70
+ }
71
+ };
72
+ });
73
+ },
74
+ docs(docs, metas, collection, config) {
75
+ const parsedDocs = this.doc(docs, collection, config);
76
+ const parsedMetas = _runtime.meta(metas);
77
+ return {
78
+ docs: parsedDocs,
79
+ meta: parsedMetas,
80
+ toFumadocsSource() {
81
+ return createMDXSource(parsedDocs, parsedMetas);
82
+ }
83
+ };
84
+ }
85
+ };
86
+ export {
87
+ _runtimeAsync,
88
+ buildConfig
89
+ };
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
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
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/runtime/next/index.ts
31
+ var next_exports = {};
32
+ __export(next_exports, {
33
+ _runtime: () => _runtime,
34
+ createMDXSource: () => createMDXSource,
35
+ resolveFiles: () => resolveFiles
36
+ });
37
+ module.exports = __toCommonJS(next_exports);
38
+
39
+ // src/runtime/shared.ts
40
+ var import_promises = __toESM(require("fs/promises"), 1);
41
+ function createDocMethods(info, load) {
42
+ return {
43
+ info,
44
+ async getText(type) {
45
+ if (type === "raw") {
46
+ return (await import_promises.default.readFile(info.fullPath)).toString();
47
+ }
48
+ const data = await load();
49
+ if (typeof data._markdown !== "string")
50
+ throw new Error(
51
+ "getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
52
+ );
53
+ return data._markdown;
54
+ },
55
+ async getMDAST() {
56
+ const data = await load();
57
+ if (!data._mdast)
58
+ throw new Error(
59
+ "getMDAST() requires `includeMDAST` to be enabled in your collection config."
60
+ );
61
+ return JSON.parse(data._mdast);
62
+ }
63
+ };
64
+ }
65
+
66
+ // src/runtime/next/index.ts
67
+ var _runtime = {
68
+ doc(files) {
69
+ return files.map((file) => {
70
+ const data = file.data;
71
+ return {
72
+ _exports: data,
73
+ body: data.default,
74
+ lastModified: data.lastModified,
75
+ toc: data.toc,
76
+ structuredData: data.structuredData,
77
+ extractedReferences: data.extractedReferences,
78
+ ...data.frontmatter,
79
+ ...createDocMethods(file.info, () => Promise.resolve(data))
80
+ };
81
+ });
82
+ },
83
+ meta(files) {
84
+ return files.map((file) => {
85
+ return {
86
+ info: file.info,
87
+ ...file.data
88
+ };
89
+ });
90
+ },
91
+ docs(docs, metas) {
92
+ const parsedDocs = this.doc(docs);
93
+ const parsedMetas = this.meta(metas);
94
+ return {
95
+ docs: parsedDocs,
96
+ meta: parsedMetas,
97
+ toFumadocsSource() {
98
+ return createMDXSource(parsedDocs, parsedMetas);
99
+ }
100
+ };
101
+ }
102
+ };
103
+ function createMDXSource(docs, meta = []) {
104
+ return {
105
+ files: resolveFiles({
106
+ docs,
107
+ meta
108
+ })
109
+ };
110
+ }
111
+ function resolveFiles({ docs, meta }) {
112
+ const outputs = [];
113
+ for (const entry of docs) {
114
+ outputs.push({
115
+ type: "page",
116
+ absolutePath: entry.info.fullPath,
117
+ path: entry.info.path,
118
+ data: entry
119
+ });
120
+ }
121
+ for (const entry of meta) {
122
+ outputs.push({
123
+ type: "meta",
124
+ absolutePath: entry.info.fullPath,
125
+ path: entry.info.path,
126
+ data: entry
127
+ });
128
+ }
129
+ return outputs;
130
+ }
131
+ // Annotate the CommonJS export names for ESM import in node:
132
+ 0 && (module.exports = {
133
+ _runtime,
134
+ createMDXSource,
135
+ resolveFiles
136
+ });
@@ -0,0 +1,33 @@
1
+ import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
+ import { R as Runtime } from '../../types-DKGMoay5.cjs';
3
+ export { b as AsyncDocOut, A as AsyncRuntimeFile, D as DocOut, M as MetaOut, c as RuntimeAsync, a as RuntimeFile } from '../../types-DKGMoay5.cjs';
4
+ import { FileInfo } from '../../index.cjs';
5
+ import '@standard-schema/spec';
6
+ import '../../core-B6j6Fxse.cjs';
7
+ import 'fumadocs-core/mdx-plugins';
8
+ import '@mdx-js/mdx';
9
+ import 'unified';
10
+ import 'zod';
11
+ import 'chokidar';
12
+ import 'fumadocs-core/toc';
13
+ import 'mdx/types';
14
+ import 'mdast';
15
+ import '../../build-mdx-D-r3_eQL.cjs';
16
+ import 'react';
17
+
18
+ declare const _runtime: Runtime;
19
+ interface AnyCollectionEntry {
20
+ info: FileInfo;
21
+ }
22
+ declare function createMDXSource<Doc extends PageData & AnyCollectionEntry, Meta extends MetaData & AnyCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
23
+ pageData: Doc;
24
+ metaData: Meta;
25
+ }>;
26
+ interface ResolveOptions {
27
+ docs: AnyCollectionEntry[];
28
+ meta: AnyCollectionEntry[];
29
+ rootDir?: string;
30
+ }
31
+ declare function resolveFiles({ docs, meta }: ResolveOptions): VirtualFile[];
32
+
33
+ export { type AnyCollectionEntry, Runtime, _runtime, createMDXSource, resolveFiles };
@@ -0,0 +1,33 @@
1
+ import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
+ import { R as Runtime } from '../../types-AGzTfBmf.js';
3
+ export { b as AsyncDocOut, A as AsyncRuntimeFile, D as DocOut, M as MetaOut, c as RuntimeAsync, a as RuntimeFile } from '../../types-AGzTfBmf.js';
4
+ import { FileInfo } from '../../index.js';
5
+ import '@standard-schema/spec';
6
+ import '../../core-B6j6Fxse.js';
7
+ import 'fumadocs-core/mdx-plugins';
8
+ import '@mdx-js/mdx';
9
+ import 'unified';
10
+ import 'zod';
11
+ import 'chokidar';
12
+ import 'fumadocs-core/toc';
13
+ import 'mdx/types';
14
+ import 'mdast';
15
+ import '../../build-mdx-CCNr86q6.js';
16
+ import 'react';
17
+
18
+ declare const _runtime: Runtime;
19
+ interface AnyCollectionEntry {
20
+ info: FileInfo;
21
+ }
22
+ declare function createMDXSource<Doc extends PageData & AnyCollectionEntry, Meta extends MetaData & AnyCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
23
+ pageData: Doc;
24
+ metaData: Meta;
25
+ }>;
26
+ interface ResolveOptions {
27
+ docs: AnyCollectionEntry[];
28
+ meta: AnyCollectionEntry[];
29
+ rootDir?: string;
30
+ }
31
+ declare function resolveFiles({ docs, meta }: ResolveOptions): VirtualFile[];
32
+
33
+ export { type AnyCollectionEntry, Runtime, _runtime, createMDXSource, resolveFiles };
@@ -0,0 +1,11 @@
1
+ import {
2
+ _runtime,
3
+ createMDXSource,
4
+ resolveFiles
5
+ } from "../../chunk-KILFIBVW.js";
6
+ import "../../chunk-NVRDCY6Z.js";
7
+ export {
8
+ _runtime,
9
+ createMDXSource,
10
+ resolveFiles
11
+ };
@@ -0,0 +1,107 @@
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
+ fromConfigBase: () => fromConfigBase,
26
+ toClientRenderer: () => toClientRenderer
27
+ });
28
+ module.exports = __toCommonJS(browser_exports);
29
+
30
+ // src/runtime/vite/base.ts
31
+ var import_react = require("react");
32
+ function fromConfigBase() {
33
+ function normalize(entries, base) {
34
+ const out = {};
35
+ for (const k in entries) {
36
+ const mappedK = k.startsWith("./") ? k.slice(2) : k;
37
+ if (base) Object.assign(entries[k], { base });
38
+ out[mappedK] = entries[k];
39
+ }
40
+ return out;
41
+ }
42
+ return {
43
+ doc(_, base, glob) {
44
+ return normalize(glob, base);
45
+ },
46
+ meta(_, base, glob) {
47
+ return normalize(glob, base);
48
+ },
49
+ docLazy(_, base, head, body) {
50
+ return {
51
+ base,
52
+ head: normalize(head),
53
+ body: normalize(body)
54
+ };
55
+ }
56
+ };
57
+ }
58
+ var loaderStore = /* @__PURE__ */ new Map();
59
+ function createClientLoader(files, options) {
60
+ const { id = "", component } = options;
61
+ let renderer;
62
+ const store = loaderStore.get(id) ?? {
63
+ preloaded: /* @__PURE__ */ new Map()
64
+ };
65
+ loaderStore.set(id, store);
66
+ function getRenderer() {
67
+ if (renderer) return renderer;
68
+ renderer = {};
69
+ for (const k in files) {
70
+ const OnDemand = (0, import_react.lazy)(async () => {
71
+ const loaded = await files[k]();
72
+ return { default: (props) => component(loaded, props) };
73
+ });
74
+ renderer[k] = (props) => {
75
+ const cached = store.preloaded.get(k);
76
+ if (!cached) return (0, import_react.createElement)(OnDemand, props);
77
+ return component(cached, props);
78
+ };
79
+ }
80
+ return renderer;
81
+ }
82
+ return {
83
+ async preload(path) {
84
+ const loaded = await files[path]();
85
+ store.preloaded.set(path, loaded);
86
+ return loaded;
87
+ },
88
+ getRenderer,
89
+ getComponent(path) {
90
+ return getRenderer()[path];
91
+ },
92
+ useContent(path, props) {
93
+ const Comp = this.getComponent(path);
94
+ return (0, import_react.createElement)(Comp, props);
95
+ }
96
+ };
97
+ }
98
+ function toClientRenderer(files, component) {
99
+ return createClientLoader(files, { component }).getRenderer();
100
+ }
101
+ // Annotate the CommonJS export names for ESM import in node:
102
+ 0 && (module.exports = {
103
+ createClientLoader,
104
+ fromConfig,
105
+ fromConfigBase,
106
+ toClientRenderer
107
+ });
@@ -0,0 +1,59 @@
1
+ import { b as DocCollection, c as DocsCollection, M as MetaCollection } from '../../core-B6j6Fxse.cjs';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
3
+ import { C as CompiledMDXProperties } from '../../build-mdx-D-r3_eQL.cjs';
4
+ import { ReactNode, FC } from 'react';
5
+ import 'fumadocs-core/mdx-plugins';
6
+ import '@mdx-js/mdx';
7
+ import 'unified';
8
+ import 'zod';
9
+ import 'chokidar';
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 };
@@ -0,0 +1,59 @@
1
+ import { b as DocCollection, c as DocsCollection, M as MetaCollection } from '../../core-B6j6Fxse.js';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
3
+ import { C as CompiledMDXProperties } from '../../build-mdx-CCNr86q6.js';
4
+ import { ReactNode, FC } from 'react';
5
+ import 'fumadocs-core/mdx-plugins';
6
+ import '@mdx-js/mdx';
7
+ import 'unified';
8
+ import 'zod';
9
+ import 'chokidar';
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 };
@@ -0,0 +1,11 @@
1
+ import {
2
+ createClientLoader,
3
+ fromConfigBase,
4
+ toClientRenderer
5
+ } from "../../chunk-II3H5ZVZ.js";
6
+ export {
7
+ createClientLoader,
8
+ fromConfigBase as fromConfig,
9
+ fromConfigBase,
10
+ toClientRenderer
11
+ };