fumadocs-mdx 13.0.8 → 14.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 (104) hide show
  1. package/dist/bin.cjs +924 -901
  2. package/dist/bin.js +3 -3
  3. package/dist/build-mdx-6UAK5FF5.js +8 -0
  4. package/dist/bun/index.cjs +578 -471
  5. package/dist/bun/index.d.cts +3 -2
  6. package/dist/bun/index.d.ts +3 -2
  7. package/dist/bun/index.js +12 -12
  8. package/dist/chunk-4JSFLXXT.js +8 -0
  9. package/dist/chunk-5UMZCWKV.js +17 -0
  10. package/dist/chunk-5YXP7JLN.js +138 -0
  11. package/dist/{chunk-2E2JCOSO.js → chunk-6NISOLQ6.js} +16 -44
  12. package/dist/chunk-7L2KNF6B.js +180 -0
  13. package/dist/chunk-E5DJTSIM.js +86 -0
  14. package/dist/{chunk-K5ZLPEIQ.js → chunk-FBLMK4RS.js} +9 -6
  15. package/dist/{chunk-QXHN25N3.js → chunk-OXSRIWQW.js} +7 -8
  16. package/dist/chunk-PKI7ZDA5.js +29 -0
  17. package/dist/{chunk-3J3WL7WN.js → chunk-SLY7WXTX.js} +71 -58
  18. package/dist/{chunk-5FTSWCB4.js → chunk-SRSRFOVI.js} +8 -10
  19. package/dist/chunk-TYJDYTKH.js +85 -0
  20. package/dist/chunk-XHJCLBZ4.js +406 -0
  21. package/dist/{chunk-2HXTGJBI.js → chunk-ZY6UZ7NH.js} +22 -19
  22. package/dist/config/index.cjs +79 -71
  23. package/dist/config/index.d.cts +2 -1
  24. package/dist/config/index.d.ts +2 -1
  25. package/dist/config/index.js +5 -5
  26. package/dist/index-BlVBvy-z.d.ts +8 -0
  27. package/dist/{core-DB7TdlyC.d.cts → index-D7JdSMpp.d.cts} +99 -61
  28. package/dist/{core-DB7TdlyC.d.ts → index-D7JdSMpp.d.ts} +99 -61
  29. package/dist/index-P2NNUkHn.d.cts +8 -0
  30. package/dist/index.d.cts +3 -74
  31. package/dist/index.d.ts +3 -74
  32. package/dist/load-from-file-I3ALLIVB.js +8 -0
  33. package/dist/next/index.cjs +698 -476
  34. package/dist/next/index.d.cts +11 -1
  35. package/dist/next/index.d.ts +11 -1
  36. package/dist/next/index.js +78 -281
  37. package/dist/node/loader.cjs +704 -602
  38. package/dist/node/loader.js +10 -11
  39. package/dist/plugins/index-file.cjs +471 -0
  40. package/dist/plugins/index-file.d.cts +29 -0
  41. package/dist/plugins/index-file.d.ts +29 -0
  42. package/dist/plugins/index-file.js +8 -0
  43. package/dist/plugins/json-schema.d.cts +3 -2
  44. package/dist/plugins/json-schema.d.ts +3 -2
  45. package/dist/plugins/last-modified.cjs +75 -0
  46. package/dist/plugins/last-modified.d.cts +27 -0
  47. package/dist/plugins/last-modified.d.ts +27 -0
  48. package/dist/plugins/last-modified.js +44 -0
  49. package/dist/runtime/{vite/browser.cjs → browser.cjs} +40 -53
  50. package/dist/runtime/browser.d.cts +50 -0
  51. package/dist/runtime/browser.d.ts +50 -0
  52. package/dist/runtime/browser.js +68 -0
  53. package/dist/runtime/dynamic.cjs +985 -0
  54. package/dist/runtime/dynamic.d.cts +27 -0
  55. package/dist/runtime/dynamic.d.ts +27 -0
  56. package/dist/runtime/dynamic.js +78 -0
  57. package/dist/runtime/server.cjs +173 -0
  58. package/dist/runtime/server.d.cts +161 -0
  59. package/dist/runtime/server.d.ts +161 -0
  60. package/dist/runtime/server.js +8 -0
  61. package/dist/vite/index.cjs +934 -638
  62. package/dist/vite/index.d.cts +12 -22
  63. package/dist/vite/index.d.ts +12 -22
  64. package/dist/vite/index.js +30 -221
  65. package/dist/webpack/mdx.cjs +613 -515
  66. package/dist/webpack/mdx.d.cts +9 -1
  67. package/dist/webpack/mdx.d.ts +9 -1
  68. package/dist/webpack/mdx.js +12 -17
  69. package/dist/webpack/meta.cjs +327 -233
  70. package/dist/webpack/meta.d.cts +9 -1
  71. package/dist/webpack/meta.d.ts +9 -1
  72. package/dist/webpack/meta.js +13 -15
  73. package/package.json +15 -32
  74. package/dist/build-mdx-BjXOmv0b.d.cts +0 -53
  75. package/dist/build-mdx-CY5UldCO.d.ts +0 -53
  76. package/dist/chunk-2AQRQXSO.js +0 -119
  77. package/dist/chunk-CXA4JO4Z.js +0 -45
  78. package/dist/chunk-DMJ6I4C3.js +0 -76
  79. package/dist/chunk-FSZMKRVH.js +0 -80
  80. package/dist/chunk-II3H5ZVZ.js +0 -77
  81. package/dist/chunk-KILFIBVW.js +0 -75
  82. package/dist/chunk-NVRDCY6Z.js +0 -30
  83. package/dist/chunk-VUEZTR2H.js +0 -26
  84. package/dist/index-D7s7kCc2.d.cts +0 -7
  85. package/dist/index-D7s7kCc2.d.ts +0 -7
  86. package/dist/load-from-file-AVYOFOI7.js +0 -7
  87. package/dist/preset-ZMP6U62C.js +0 -6
  88. package/dist/runtime/next/async.cjs +0 -760
  89. package/dist/runtime/next/async.d.cts +0 -19
  90. package/dist/runtime/next/async.d.ts +0 -19
  91. package/dist/runtime/next/async.js +0 -86
  92. package/dist/runtime/next/index.cjs +0 -136
  93. package/dist/runtime/next/index.d.cts +0 -33
  94. package/dist/runtime/next/index.d.ts +0 -33
  95. package/dist/runtime/next/index.js +0 -11
  96. package/dist/runtime/vite/browser.d.cts +0 -59
  97. package/dist/runtime/vite/browser.d.ts +0 -59
  98. package/dist/runtime/vite/browser.js +0 -11
  99. package/dist/runtime/vite/server.cjs +0 -243
  100. package/dist/runtime/vite/server.d.cts +0 -30
  101. package/dist/runtime/vite/server.d.ts +0 -30
  102. package/dist/runtime/vite/server.js +0 -111
  103. package/dist/types-Bnh9n7mj.d.cts +0 -45
  104. package/dist/types-ey1AZqrg.d.ts +0 -45
@@ -1,19 +0,0 @@
1
- import { R as RuntimeAsync } from '../../types-Bnh9n7mj.cjs';
2
- export { j as buildConfig } from '../../core-DB7TdlyC.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-BjXOmv0b.cjs';
11
- import '@mdx-js/mdx';
12
- import 'react';
13
- import 'unified';
14
- import 'zod';
15
- import 'chokidar';
16
-
17
- declare const _runtimeAsync: RuntimeAsync;
18
-
19
- export { _runtimeAsync };
@@ -1,19 +0,0 @@
1
- import { R as RuntimeAsync } from '../../types-ey1AZqrg.js';
2
- export { j as buildConfig } from '../../core-DB7TdlyC.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-CY5UldCO.js';
11
- import '@mdx-js/mdx';
12
- import 'react';
13
- import 'unified';
14
- import 'zod';
15
- import 'chokidar';
16
-
17
- declare const _runtimeAsync: RuntimeAsync;
18
-
19
- export { _runtimeAsync };
@@ -1,86 +0,0 @@
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-2HXTGJBI.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.getCollection(collection);
25
- if (col?.type === "doc" && col.mdxOptions) return col;
26
- if (col?.type === "docs" && col.docs.mdxOptions) return col.docs;
27
- }
28
- var _runtimeAsync = {
29
- doc(files, collectionName, config) {
30
- const collection = getDocCollection(config, collectionName);
31
- const initMdxOptions = collection?.mdxOptions ?? config.getDefaultMDXOptions("remote");
32
- return files.map(({ info, data, lastModified }) => {
33
- let cachedResult;
34
- async function compileAndLoad() {
35
- if (cachedResult) return cachedResult;
36
- const mdxOptions = await initMdxOptions;
37
- const raw = (await fs.readFile(info.fullPath)).toString();
38
- const { content } = fumaMatter(raw);
39
- const compiled = await buildMDX(collectionName, content, {
40
- ...mdxOptions,
41
- development: false,
42
- frontmatter: data,
43
- postprocess: collection?.postprocess,
44
- data: {
45
- lastModified
46
- },
47
- filePath: info.fullPath
48
- });
49
- const result = await executeMdx(String(compiled.value), {
50
- baseUrl: pathToFileURL(info.fullPath)
51
- });
52
- return cachedResult = result;
53
- }
54
- return {
55
- ...data,
56
- ...createDocMethods(info, () => compileAndLoad()),
57
- async load() {
58
- const out = await compileAndLoad();
59
- return {
60
- _exports: out,
61
- body: out.default,
62
- lastModified,
63
- toc: out.toc,
64
- extractedReferences: out.extractedReferences,
65
- structuredData: out.structuredData
66
- };
67
- }
68
- };
69
- });
70
- },
71
- docs(docs, metas, collection, config) {
72
- const parsedDocs = this.doc(docs, collection, config);
73
- const parsedMetas = _runtime.meta(metas);
74
- return {
75
- docs: parsedDocs,
76
- meta: parsedMetas,
77
- toFumadocsSource() {
78
- return createMDXSource(parsedDocs, parsedMetas);
79
- }
80
- };
81
- }
82
- };
83
- export {
84
- _runtimeAsync,
85
- buildConfig
86
- };
@@ -1,136 +0,0 @@
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
- });
@@ -1,33 +0,0 @@
1
- import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
- import { a as Runtime } from '../../types-Bnh9n7mj.cjs';
3
- export { c as AsyncDocOut, A as AsyncRuntimeFile, D as DocOut, M as MetaOut, R as RuntimeAsync, b as RuntimeFile } from '../../types-Bnh9n7mj.cjs';
4
- import { FileInfo } from '../../index.cjs';
5
- import '@standard-schema/spec';
6
- import '../../core-DB7TdlyC.cjs';
7
- import '@mdx-js/mdx';
8
- import 'fumadocs-core/mdx-plugins';
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-BjXOmv0b.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 };
@@ -1,33 +0,0 @@
1
- import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
- import { a as Runtime } from '../../types-ey1AZqrg.js';
3
- export { c as AsyncDocOut, A as AsyncRuntimeFile, D as DocOut, M as MetaOut, R as RuntimeAsync, b as RuntimeFile } from '../../types-ey1AZqrg.js';
4
- import { FileInfo } from '../../index.js';
5
- import '@standard-schema/spec';
6
- import '../../core-DB7TdlyC.js';
7
- import '@mdx-js/mdx';
8
- import 'fumadocs-core/mdx-plugins';
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-CY5UldCO.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 };
@@ -1,11 +0,0 @@
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
- };
@@ -1,59 +0,0 @@
1
- import { b as DocCollection, c as DocsCollection, M as MetaCollection } from '../../core-DB7TdlyC.cjs';
2
- import { StandardSchemaV1 } from '@standard-schema/spec';
3
- import { C as CompiledMDXProperties } from '../../build-mdx-BjXOmv0b.cjs';
4
- import { ReactNode, FC } from 'react';
5
- import '@mdx-js/mdx';
6
- import 'fumadocs-core/mdx-plugins';
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 };
@@ -1,59 +0,0 @@
1
- import { b as DocCollection, c as DocsCollection, M as MetaCollection } from '../../core-DB7TdlyC.js';
2
- import { StandardSchemaV1 } from '@standard-schema/spec';
3
- import { C as CompiledMDXProperties } from '../../build-mdx-CY5UldCO.js';
4
- import { ReactNode, FC } from 'react';
5
- import '@mdx-js/mdx';
6
- import 'fumadocs-core/mdx-plugins';
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 };
@@ -1,11 +0,0 @@
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
- };