fumadocs-mdx 13.0.8 → 14.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.
- package/dist/bin.cjs +985 -893
- package/dist/bin.js +3 -3
- package/dist/build-mdx-6UAK5FF5.js +8 -0
- package/dist/bun/index.cjs +613 -471
- package/dist/bun/index.d.cts +9 -2
- package/dist/bun/index.d.ts +9 -2
- package/dist/bun/index.js +15 -14
- package/dist/chunk-4JSFLXXT.js +8 -0
- package/dist/chunk-5OBUOALK.js +141 -0
- package/dist/{chunk-2E2JCOSO.js → chunk-6NISOLQ6.js} +16 -44
- package/dist/chunk-7UKSZSPY.js +331 -0
- package/dist/chunk-BEBCWQC7.js +224 -0
- package/dist/chunk-E5DJTSIM.js +86 -0
- package/dist/{chunk-K5ZLPEIQ.js → chunk-FBLMK4RS.js} +9 -6
- package/dist/chunk-IQGEFL2B.js +17 -0
- package/dist/{chunk-5FTSWCB4.js → chunk-K6HCOGOX.js} +9 -11
- package/dist/{chunk-QXHN25N3.js → chunk-MTTISKQJ.js} +6 -6
- package/dist/{chunk-3J3WL7WN.js → chunk-SLY7WXTX.js} +71 -58
- package/dist/chunk-TYJDYTKH.js +85 -0
- package/dist/chunk-WBIHDYMN.js +126 -0
- package/dist/{chunk-2HXTGJBI.js → chunk-ZY6UZ7NH.js} +22 -19
- package/dist/config/index.cjs +79 -71
- package/dist/config/index.d.cts +7 -1
- package/dist/config/index.d.ts +7 -1
- package/dist/config/index.js +5 -5
- package/dist/core-B9ZoS6sA.d.ts +341 -0
- package/dist/core-DTuP23zu.d.cts +341 -0
- package/dist/index-BD8Woo4m.d.cts +8 -0
- package/dist/index-CNOvhtOn.d.ts +8 -0
- package/dist/index.d.cts +38 -56
- package/dist/index.d.ts +38 -56
- package/dist/load-from-file-5HUQN36V.js +8 -0
- package/dist/next/index.cjs +763 -473
- package/dist/next/index.d.cts +16 -1
- package/dist/next/index.d.ts +16 -1
- package/dist/next/index.js +80 -281
- package/dist/node/loader.cjs +764 -627
- package/dist/node/loader.js +10 -11
- package/dist/plugins/index-file.cjs +495 -0
- package/dist/plugins/index-file.d.cts +14 -0
- package/dist/plugins/index-file.d.ts +14 -0
- package/dist/plugins/index-file.js +8 -0
- package/dist/plugins/json-schema.d.cts +9 -2
- package/dist/plugins/json-schema.d.ts +9 -2
- package/dist/plugins/last-modified.cjs +110 -0
- package/dist/plugins/last-modified.d.cts +37 -0
- package/dist/plugins/last-modified.d.ts +37 -0
- package/dist/plugins/last-modified.js +74 -0
- package/dist/runtime/browser.cjs +93 -0
- package/dist/runtime/browser.d.cts +53 -0
- package/dist/runtime/browser.d.ts +53 -0
- package/dist/runtime/browser.js +67 -0
- package/dist/runtime/dynamic.cjs +1023 -0
- package/dist/runtime/dynamic.d.cts +27 -0
- package/dist/runtime/dynamic.d.ts +27 -0
- package/dist/runtime/dynamic.js +79 -0
- package/dist/runtime/server.cjs +176 -0
- package/dist/runtime/server.d.cts +14 -0
- package/dist/runtime/server.d.ts +14 -0
- package/dist/runtime/server.js +8 -0
- package/dist/runtime/types.cjs +18 -0
- package/dist/runtime/types.d.cts +61 -0
- package/dist/runtime/types.d.ts +61 -0
- package/dist/runtime/types.js +0 -0
- package/dist/vite/index.cjs +984 -621
- package/dist/vite/index.d.cts +17 -22
- package/dist/vite/index.d.ts +17 -22
- package/dist/vite/index.js +32 -222
- package/dist/webpack/mdx.cjs +647 -514
- package/dist/webpack/mdx.d.cts +15 -1
- package/dist/webpack/mdx.d.ts +15 -1
- package/dist/webpack/mdx.js +12 -17
- package/dist/webpack/meta.cjs +360 -231
- package/dist/webpack/meta.d.cts +15 -1
- package/dist/webpack/meta.d.ts +15 -1
- package/dist/webpack/meta.js +13 -15
- package/package.json +15 -32
- package/dist/build-mdx-BjXOmv0b.d.cts +0 -53
- package/dist/build-mdx-CY5UldCO.d.ts +0 -53
- package/dist/chunk-2AQRQXSO.js +0 -119
- package/dist/chunk-CXA4JO4Z.js +0 -45
- package/dist/chunk-DMJ6I4C3.js +0 -76
- package/dist/chunk-FSZMKRVH.js +0 -80
- package/dist/chunk-II3H5ZVZ.js +0 -77
- package/dist/chunk-KILFIBVW.js +0 -75
- package/dist/chunk-NVRDCY6Z.js +0 -30
- package/dist/chunk-VUEZTR2H.js +0 -26
- package/dist/core-DB7TdlyC.d.cts +0 -234
- package/dist/core-DB7TdlyC.d.ts +0 -234
- package/dist/index-D7s7kCc2.d.cts +0 -7
- package/dist/index-D7s7kCc2.d.ts +0 -7
- package/dist/load-from-file-AVYOFOI7.js +0 -7
- package/dist/preset-ZMP6U62C.js +0 -6
- package/dist/runtime/next/async.cjs +0 -760
- package/dist/runtime/next/async.d.cts +0 -19
- package/dist/runtime/next/async.d.ts +0 -19
- package/dist/runtime/next/async.js +0 -86
- package/dist/runtime/next/index.cjs +0 -136
- package/dist/runtime/next/index.d.cts +0 -33
- package/dist/runtime/next/index.d.ts +0 -33
- package/dist/runtime/next/index.js +0 -11
- package/dist/runtime/vite/browser.cjs +0 -107
- package/dist/runtime/vite/browser.d.cts +0 -59
- package/dist/runtime/vite/browser.d.ts +0 -59
- package/dist/runtime/vite/browser.js +0 -11
- package/dist/runtime/vite/server.cjs +0 -243
- package/dist/runtime/vite/server.d.cts +0 -30
- package/dist/runtime/vite/server.d.ts +0 -30
- package/dist/runtime/vite/server.js +0 -111
- package/dist/types-Bnh9n7mj.d.cts +0 -45
- package/dist/types-ey1AZqrg.d.ts +0 -45
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as fumadocs_core_source from 'fumadocs-core/source';
|
|
2
|
+
import { i as CoreOptions, S as ServerOptions, D as DocCollection, a as DocsCollection, k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry } from '../core-DTuP23zu.cjs';
|
|
3
|
+
import * as _standard_schema_spec from '@standard-schema/spec';
|
|
4
|
+
import { FileInfo, InternalTypeConfig } from './types.cjs';
|
|
5
|
+
import '@mdx-js/mdx';
|
|
6
|
+
import 'unified';
|
|
7
|
+
import 'fumadocs-core/mdx-plugins';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import 'chokidar';
|
|
10
|
+
import 'vfile';
|
|
11
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
12
|
+
import 'fumadocs-core/toc';
|
|
13
|
+
import 'mdast';
|
|
14
|
+
import 'mdx/types';
|
|
15
|
+
|
|
16
|
+
interface LazyEntry<Data = unknown> {
|
|
17
|
+
info: FileInfo;
|
|
18
|
+
data: Data;
|
|
19
|
+
hash?: string;
|
|
20
|
+
}
|
|
21
|
+
type CreateDynamic<Config, TC extends InternalTypeConfig = InternalTypeConfig> = ReturnType<typeof dynamic<Config, TC>>;
|
|
22
|
+
declare function dynamic<Config, TC extends InternalTypeConfig>(configExports: Config, coreOptions: CoreOptions, serverOptions?: ServerOptions): Promise<{
|
|
23
|
+
doc<Name extends keyof Config & string>(name: Name, base: string, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<Name, _standard_schema_spec.StandardSchemaV1.InferOutput<Schema>, TC>[] : never>;
|
|
24
|
+
docs<Name extends keyof Config & string>(name: Name, base: string, meta: Record<string, unknown>, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocsCollection<infer Page extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, infer Meta extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? _standard_schema_spec.StandardSchemaV1.InferOutput<Page> extends fumadocs_core_source.PageData ? _standard_schema_spec.StandardSchemaV1.InferOutput<Meta> extends fumadocs_core_source.MetaData ? AsyncDocsCollectionEntry<Name, _standard_schema_spec.StandardSchemaV1.InferOutput<Page>, _standard_schema_spec.StandardSchemaV1.InferOutput<Meta>, TC> : never : never : never>;
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
export { type CreateDynamic, type LazyEntry, dynamic };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as fumadocs_core_source from 'fumadocs-core/source';
|
|
2
|
+
import { i as CoreOptions, S as ServerOptions, D as DocCollection, a as DocsCollection, k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry } from '../core-B9ZoS6sA.js';
|
|
3
|
+
import * as _standard_schema_spec from '@standard-schema/spec';
|
|
4
|
+
import { FileInfo, InternalTypeConfig } from './types.js';
|
|
5
|
+
import '@mdx-js/mdx';
|
|
6
|
+
import 'unified';
|
|
7
|
+
import 'fumadocs-core/mdx-plugins';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import 'chokidar';
|
|
10
|
+
import 'vfile';
|
|
11
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
12
|
+
import 'fumadocs-core/toc';
|
|
13
|
+
import 'mdast';
|
|
14
|
+
import 'mdx/types';
|
|
15
|
+
|
|
16
|
+
interface LazyEntry<Data = unknown> {
|
|
17
|
+
info: FileInfo;
|
|
18
|
+
data: Data;
|
|
19
|
+
hash?: string;
|
|
20
|
+
}
|
|
21
|
+
type CreateDynamic<Config, TC extends InternalTypeConfig = InternalTypeConfig> = ReturnType<typeof dynamic<Config, TC>>;
|
|
22
|
+
declare function dynamic<Config, TC extends InternalTypeConfig>(configExports: Config, coreOptions: CoreOptions, serverOptions?: ServerOptions): Promise<{
|
|
23
|
+
doc<Name extends keyof Config & string>(name: Name, base: string, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<Name, _standard_schema_spec.StandardSchemaV1.InferOutput<Schema>, TC>[] : never>;
|
|
24
|
+
docs<Name extends keyof Config & string>(name: Name, base: string, meta: Record<string, unknown>, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocsCollection<infer Page extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, infer Meta extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? _standard_schema_spec.StandardSchemaV1.InferOutput<Page> extends fumadocs_core_source.PageData ? _standard_schema_spec.StandardSchemaV1.InferOutput<Meta> extends fumadocs_core_source.MetaData ? AsyncDocsCollectionEntry<Name, _standard_schema_spec.StandardSchemaV1.InferOutput<Page>, _standard_schema_spec.StandardSchemaV1.InferOutput<Meta>, TC> : never : never : never>;
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
export { type CreateDynamic, type LazyEntry, dynamic };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMDX
|
|
3
|
+
} from "../chunk-SLY7WXTX.js";
|
|
4
|
+
import {
|
|
5
|
+
server
|
|
6
|
+
} from "../chunk-5OBUOALK.js";
|
|
7
|
+
import "../chunk-FBLMK4RS.js";
|
|
8
|
+
import {
|
|
9
|
+
buildConfig
|
|
10
|
+
} from "../chunk-ZY6UZ7NH.js";
|
|
11
|
+
import "../chunk-E5DJTSIM.js";
|
|
12
|
+
import {
|
|
13
|
+
createCore
|
|
14
|
+
} from "../chunk-BEBCWQC7.js";
|
|
15
|
+
import "../chunk-WBIHDYMN.js";
|
|
16
|
+
import {
|
|
17
|
+
fumaMatter
|
|
18
|
+
} from "../chunk-VWJKRQZR.js";
|
|
19
|
+
|
|
20
|
+
// src/runtime/dynamic.ts
|
|
21
|
+
import { executeMdx } from "@fumadocs/mdx-remote/client";
|
|
22
|
+
import { pathToFileURL } from "url";
|
|
23
|
+
import fs from "fs/promises";
|
|
24
|
+
async function dynamic(configExports, coreOptions, serverOptions) {
|
|
25
|
+
const core = createCore(coreOptions);
|
|
26
|
+
await core.init({
|
|
27
|
+
config: buildConfig(configExports)
|
|
28
|
+
});
|
|
29
|
+
const create = server(serverOptions);
|
|
30
|
+
function getDocCollection(name) {
|
|
31
|
+
const collection = core.getConfig().getCollection(name);
|
|
32
|
+
if (!collection) return;
|
|
33
|
+
if (collection.type === "docs") return collection.docs;
|
|
34
|
+
else if (collection.type === "doc") return collection;
|
|
35
|
+
}
|
|
36
|
+
function convertLazyEntries(collection, entries) {
|
|
37
|
+
const head = {};
|
|
38
|
+
const body = {};
|
|
39
|
+
async function compile({ info, data }) {
|
|
40
|
+
let content = (await fs.readFile(info.fullPath)).toString();
|
|
41
|
+
content = fumaMatter(content).content;
|
|
42
|
+
const compiled = await buildMDX(core, collection, {
|
|
43
|
+
filePath: info.fullPath,
|
|
44
|
+
source: content,
|
|
45
|
+
frontmatter: data,
|
|
46
|
+
isDevelopment: false,
|
|
47
|
+
environment: "runtime"
|
|
48
|
+
});
|
|
49
|
+
return await executeMdx(String(compiled.value), {
|
|
50
|
+
baseUrl: pathToFileURL(info.fullPath)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
head[entry.info.path] = () => entry.data;
|
|
55
|
+
let cachedResult;
|
|
56
|
+
body[entry.info.path] = () => cachedResult ??= compile(entry);
|
|
57
|
+
}
|
|
58
|
+
return { head, body };
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
async doc(name, base, entries) {
|
|
62
|
+
const collection = getDocCollection(name);
|
|
63
|
+
if (!collection)
|
|
64
|
+
throw new Error(`the doc collection ${name} doesn't exist.`);
|
|
65
|
+
const { head, body } = convertLazyEntries(collection, entries);
|
|
66
|
+
return create.docLazy(name, base, head, body);
|
|
67
|
+
},
|
|
68
|
+
async docs(name, base, meta, entries) {
|
|
69
|
+
const collection = getDocCollection(name);
|
|
70
|
+
if (!collection)
|
|
71
|
+
throw new Error(`the doc collection ${name} doesn't exist.`);
|
|
72
|
+
const docs = convertLazyEntries(collection, entries);
|
|
73
|
+
return create.docsLazy(name, base, meta, docs.head, docs.body);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
dynamic
|
|
79
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
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/server.ts
|
|
31
|
+
var server_exports = {};
|
|
32
|
+
__export(server_exports, {
|
|
33
|
+
server: () => server,
|
|
34
|
+
toFumadocsSource: () => toFumadocsSource
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(server_exports);
|
|
37
|
+
var path = __toESM(require("path"), 1);
|
|
38
|
+
function server(options = {}) {
|
|
39
|
+
const { doc: { passthroughs: docPassthroughs = [] } = {} } = options;
|
|
40
|
+
function fileInfo(file, base) {
|
|
41
|
+
if (file.startsWith("./")) {
|
|
42
|
+
file = file.slice(2);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
path: file,
|
|
46
|
+
fullPath: path.join(base, file)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function mapDocData(entry) {
|
|
50
|
+
const data = {
|
|
51
|
+
body: entry.default,
|
|
52
|
+
toc: entry.toc,
|
|
53
|
+
structuredData: entry.structuredData,
|
|
54
|
+
_exports: entry
|
|
55
|
+
};
|
|
56
|
+
for (const key of docPassthroughs) {
|
|
57
|
+
data[key] = entry[key];
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
async doc(_name, base, glob) {
|
|
63
|
+
const out = await Promise.all(
|
|
64
|
+
Object.entries(glob).map(async ([k, v]) => {
|
|
65
|
+
const data = typeof v === "function" ? await v() : v;
|
|
66
|
+
return {
|
|
67
|
+
...mapDocData(data),
|
|
68
|
+
...data.frontmatter,
|
|
69
|
+
...createDocMethods(fileInfo(k, base), () => data)
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
return out;
|
|
74
|
+
},
|
|
75
|
+
async docLazy(_name, base, head, body) {
|
|
76
|
+
const out = await Promise.all(
|
|
77
|
+
Object.entries(head).map(async ([k, v]) => {
|
|
78
|
+
const data = typeof v === "function" ? await v() : v;
|
|
79
|
+
const content = body[k];
|
|
80
|
+
return {
|
|
81
|
+
...data,
|
|
82
|
+
...createDocMethods(fileInfo(k, base), content),
|
|
83
|
+
async load() {
|
|
84
|
+
return mapDocData(await content());
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
return out;
|
|
90
|
+
},
|
|
91
|
+
async meta(_name, base, glob) {
|
|
92
|
+
const out = await Promise.all(
|
|
93
|
+
Object.entries(glob).map(async ([k, v]) => {
|
|
94
|
+
const data = typeof v === "function" ? await v() : v;
|
|
95
|
+
return {
|
|
96
|
+
info: fileInfo(k, base),
|
|
97
|
+
...data
|
|
98
|
+
};
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
return out;
|
|
102
|
+
},
|
|
103
|
+
async docs(name, base, metaGlob, docGlob) {
|
|
104
|
+
const entry = {
|
|
105
|
+
docs: await this.doc(name, base, docGlob),
|
|
106
|
+
meta: await this.meta(name, base, metaGlob),
|
|
107
|
+
toFumadocsSource() {
|
|
108
|
+
return toFumadocsSource(this.docs, this.meta);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return entry;
|
|
112
|
+
},
|
|
113
|
+
async docsLazy(name, base, metaGlob, docHeadGlob, docBodyGlob) {
|
|
114
|
+
const entry = {
|
|
115
|
+
docs: await this.docLazy(name, base, docHeadGlob, docBodyGlob),
|
|
116
|
+
meta: await this.meta(name, base, metaGlob),
|
|
117
|
+
toFumadocsSource() {
|
|
118
|
+
return toFumadocsSource(this.docs, this.meta);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return entry;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function toFumadocsSource(pages, metas) {
|
|
126
|
+
const files = [];
|
|
127
|
+
for (const entry of pages) {
|
|
128
|
+
files.push({
|
|
129
|
+
type: "page",
|
|
130
|
+
path: entry.info.path,
|
|
131
|
+
absolutePath: entry.info.fullPath,
|
|
132
|
+
data: entry
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
for (const entry of metas) {
|
|
136
|
+
files.push({
|
|
137
|
+
type: "meta",
|
|
138
|
+
path: entry.info.path,
|
|
139
|
+
absolutePath: entry.info.fullPath,
|
|
140
|
+
data: entry
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
files
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function createDocMethods(info, load) {
|
|
148
|
+
return {
|
|
149
|
+
info,
|
|
150
|
+
async getText(type) {
|
|
151
|
+
if (type === "raw") {
|
|
152
|
+
const fs = await import("fs/promises");
|
|
153
|
+
return (await fs.readFile(info.fullPath)).toString();
|
|
154
|
+
}
|
|
155
|
+
const data = await load();
|
|
156
|
+
if (typeof data._markdown !== "string")
|
|
157
|
+
throw new Error(
|
|
158
|
+
"getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
|
|
159
|
+
);
|
|
160
|
+
return data._markdown;
|
|
161
|
+
},
|
|
162
|
+
async getMDAST() {
|
|
163
|
+
const data = await load();
|
|
164
|
+
if (!data._mdast)
|
|
165
|
+
throw new Error(
|
|
166
|
+
"getMDAST() requires `includeMDAST` to be enabled in your collection config."
|
|
167
|
+
);
|
|
168
|
+
return JSON.parse(data._mdast);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
173
|
+
0 && (module.exports = {
|
|
174
|
+
server,
|
|
175
|
+
toFumadocsSource
|
|
176
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'fumadocs-core/source';
|
|
2
|
+
export { k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry, w as DocCollectionEntry, x as DocsCollectionEntry, v as MetaCollectionEntry, y as ServerCreate, S as ServerOptions, z as server, F as toFumadocsSource } from '../core-DTuP23zu.cjs';
|
|
3
|
+
import '@standard-schema/spec';
|
|
4
|
+
import './types.cjs';
|
|
5
|
+
import '@mdx-js/mdx';
|
|
6
|
+
import 'unified';
|
|
7
|
+
import 'fumadocs-core/mdx-plugins';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import 'chokidar';
|
|
10
|
+
import 'vfile';
|
|
11
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
12
|
+
import 'fumadocs-core/toc';
|
|
13
|
+
import 'mdast';
|
|
14
|
+
import 'mdx/types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'fumadocs-core/source';
|
|
2
|
+
export { k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry, w as DocCollectionEntry, x as DocsCollectionEntry, v as MetaCollectionEntry, y as ServerCreate, S as ServerOptions, z as server, F as toFumadocsSource } from '../core-B9ZoS6sA.js';
|
|
3
|
+
import '@standard-schema/spec';
|
|
4
|
+
import './types.js';
|
|
5
|
+
import '@mdx-js/mdx';
|
|
6
|
+
import 'unified';
|
|
7
|
+
import 'fumadocs-core/mdx-plugins';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import 'chokidar';
|
|
10
|
+
import 'vfile';
|
|
11
|
+
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
12
|
+
import 'fumadocs-core/toc';
|
|
13
|
+
import 'mdast';
|
|
14
|
+
import 'mdx/types';
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/runtime/types.ts
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins/remark-structure';
|
|
2
|
+
import { TOCItemType } from 'fumadocs-core/toc';
|
|
3
|
+
import { Root } from 'mdast';
|
|
4
|
+
import { MDXContent } from 'mdx/types';
|
|
5
|
+
|
|
6
|
+
interface DocData {
|
|
7
|
+
/**
|
|
8
|
+
* Compiled MDX content (as component)
|
|
9
|
+
*/
|
|
10
|
+
body: MDXContent;
|
|
11
|
+
/**
|
|
12
|
+
* table of contents generated from content.
|
|
13
|
+
*/
|
|
14
|
+
toc: TOCItemType[];
|
|
15
|
+
/**
|
|
16
|
+
* structured data for document search indexing.
|
|
17
|
+
*/
|
|
18
|
+
structuredData: StructuredData;
|
|
19
|
+
/**
|
|
20
|
+
* Raw exports from the compiled MDX file.
|
|
21
|
+
*/
|
|
22
|
+
_exports: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
interface FileInfo {
|
|
25
|
+
/**
|
|
26
|
+
* virtualized path for Source API
|
|
27
|
+
*/
|
|
28
|
+
path: string;
|
|
29
|
+
/**
|
|
30
|
+
* the file path in file system
|
|
31
|
+
*/
|
|
32
|
+
fullPath: string;
|
|
33
|
+
}
|
|
34
|
+
interface DocMethods {
|
|
35
|
+
/**
|
|
36
|
+
* file info
|
|
37
|
+
*/
|
|
38
|
+
info: FileInfo;
|
|
39
|
+
/**
|
|
40
|
+
* get document as text.
|
|
41
|
+
*
|
|
42
|
+
* - `type: raw` - read the original content from file system.
|
|
43
|
+
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
44
|
+
*/
|
|
45
|
+
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
46
|
+
getMDAST: () => Promise<Root>;
|
|
47
|
+
}
|
|
48
|
+
interface MetaMethods {
|
|
49
|
+
/**
|
|
50
|
+
* file info
|
|
51
|
+
*/
|
|
52
|
+
info: FileInfo;
|
|
53
|
+
}
|
|
54
|
+
interface InternalTypeConfig {
|
|
55
|
+
/**
|
|
56
|
+
* collection name -> collection properties
|
|
57
|
+
*/
|
|
58
|
+
DocData: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins/remark-structure';
|
|
2
|
+
import { TOCItemType } from 'fumadocs-core/toc';
|
|
3
|
+
import { Root } from 'mdast';
|
|
4
|
+
import { MDXContent } from 'mdx/types';
|
|
5
|
+
|
|
6
|
+
interface DocData {
|
|
7
|
+
/**
|
|
8
|
+
* Compiled MDX content (as component)
|
|
9
|
+
*/
|
|
10
|
+
body: MDXContent;
|
|
11
|
+
/**
|
|
12
|
+
* table of contents generated from content.
|
|
13
|
+
*/
|
|
14
|
+
toc: TOCItemType[];
|
|
15
|
+
/**
|
|
16
|
+
* structured data for document search indexing.
|
|
17
|
+
*/
|
|
18
|
+
structuredData: StructuredData;
|
|
19
|
+
/**
|
|
20
|
+
* Raw exports from the compiled MDX file.
|
|
21
|
+
*/
|
|
22
|
+
_exports: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
interface FileInfo {
|
|
25
|
+
/**
|
|
26
|
+
* virtualized path for Source API
|
|
27
|
+
*/
|
|
28
|
+
path: string;
|
|
29
|
+
/**
|
|
30
|
+
* the file path in file system
|
|
31
|
+
*/
|
|
32
|
+
fullPath: string;
|
|
33
|
+
}
|
|
34
|
+
interface DocMethods {
|
|
35
|
+
/**
|
|
36
|
+
* file info
|
|
37
|
+
*/
|
|
38
|
+
info: FileInfo;
|
|
39
|
+
/**
|
|
40
|
+
* get document as text.
|
|
41
|
+
*
|
|
42
|
+
* - `type: raw` - read the original content from file system.
|
|
43
|
+
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
44
|
+
*/
|
|
45
|
+
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
46
|
+
getMDAST: () => Promise<Root>;
|
|
47
|
+
}
|
|
48
|
+
interface MetaMethods {
|
|
49
|
+
/**
|
|
50
|
+
* file info
|
|
51
|
+
*/
|
|
52
|
+
info: FileInfo;
|
|
53
|
+
}
|
|
54
|
+
interface InternalTypeConfig {
|
|
55
|
+
/**
|
|
56
|
+
* collection name -> collection properties
|
|
57
|
+
*/
|
|
58
|
+
DocData: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };
|
|
File without changes
|