fumadocs-mdx 12.0.3 → 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.
- package/dist/bin.cjs +1033 -308
- package/dist/bin.js +4 -4
- package/dist/build-mdx-BHG-_uxo.d.cts +53 -0
- package/dist/build-mdx-CzrQDBRZ.d.ts +53 -0
- package/dist/bun/index.cjs +92 -28
- package/dist/bun/index.js +6 -7
- package/dist/{chunk-QAUWMR5D.js → chunk-3J3WL7WN.js} +23 -5
- package/dist/chunk-4MAYA5QX.js +44 -0
- package/dist/{chunk-RMDXSZYE.js → chunk-CEA6MYJU.js} +13 -8
- package/dist/{chunk-IQAEAI4P.js → chunk-HI62EXSB.js} +63 -2
- package/dist/{chunk-46UPKP5R.js → chunk-II3H5ZVZ.js} +5 -5
- package/dist/{chunk-LGYVNESJ.js → chunk-JVZFH6ND.js} +6 -22
- package/dist/{chunk-LMG6UWCL.js → chunk-K5ZLPEIQ.js} +56 -16
- package/dist/{chunk-OMAMTKDE.js → chunk-KILFIBVW.js} +3 -12
- package/dist/chunk-NVRDCY6Z.js +30 -0
- package/dist/{chunk-VXEBLM4X.js → chunk-XV5Z4BFL.js} +1 -1
- package/dist/config/index.cjs +56 -16
- package/dist/config/index.d.cts +2 -1
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.js +1 -1
- package/dist/{define-DJbJduHy.d.ts → define-BCNh3n4O.d.cts} +40 -16
- package/dist/{define-DJbJduHy.d.cts → define-bck_EB4t.d.ts} +40 -16
- package/dist/index.cjs +0 -109
- package/dist/index.d.cts +73 -12
- package/dist/index.d.ts +73 -12
- package/dist/index.js +0 -11
- package/dist/{load-UUXLUBHL.js → load-MNG3CLET.js} +1 -3
- package/dist/loader-mdx.cjs +153 -60
- package/dist/loader-mdx.d.cts +1 -0
- package/dist/loader-mdx.d.ts +1 -0
- package/dist/loader-mdx.js +23 -9
- package/dist/next/index.cjs +213 -181
- package/dist/next/index.d.cts +2 -11
- package/dist/next/index.d.ts +2 -11
- package/dist/next/index.js +145 -117
- package/dist/node/loader.cjs +128 -70
- package/dist/node/loader.js +14 -9
- package/dist/plugins/index.cjs +78 -0
- package/dist/plugins/index.d.cts +7 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/index.js +6 -0
- package/dist/plugins/json-schema.cjs +61 -0
- package/dist/plugins/json-schema.d.cts +16 -0
- package/dist/plugins/json-schema.d.ts +16 -0
- package/dist/plugins/json-schema.js +40 -0
- package/dist/remark-postprocess-K233ZVBK.d.cts +22 -0
- package/dist/remark-postprocess-K233ZVBK.d.ts +22 -0
- package/dist/runtime/next/async.cjs +108 -70
- package/dist/runtime/next/async.d.cts +9 -6
- package/dist/runtime/next/async.d.ts +9 -6
- package/dist/runtime/next/async.js +9 -19
- package/dist/runtime/next/index.cjs +25 -14
- package/dist/runtime/next/index.d.cts +11 -8
- package/dist/runtime/next/index.d.ts +11 -8
- package/dist/runtime/next/index.js +2 -2
- package/dist/runtime/vite/browser.cjs +7 -3
- package/dist/runtime/vite/browser.d.cts +56 -7
- package/dist/runtime/vite/browser.d.ts +56 -7
- package/dist/runtime/vite/browser.js +2 -1
- package/dist/runtime/vite/server.cjs +40 -34
- package/dist/runtime/vite/server.d.cts +13 -10
- package/dist/runtime/vite/server.d.ts +13 -10
- package/dist/runtime/vite/server.js +8 -23
- package/dist/{types-TeHjsmja.d.ts → types-1cCFEzWt.d.ts} +3 -10
- package/dist/{types-BRx1QsIJ.d.cts → types-D5NhXTJY.d.cts} +3 -10
- package/dist/vite/index.cjs +386 -224
- package/dist/vite/index.d.cts +23 -10
- package/dist/vite/index.d.ts +23 -10
- package/dist/vite/index.js +211 -37
- package/dist/{watcher-HGOH3APP.js → watcher-WXJDWRZY.js} +1 -1
- package/package.json +28 -15
- package/dist/browser-BupUnhpC.d.ts +0 -98
- package/dist/browser-R0x9IPaQ.d.cts +0 -98
- package/dist/chunk-ADR6R7HM.js +0 -29
- package/dist/chunk-XMFLD5J6.js +0 -30
- package/dist/chunk-ZLCSVXCD.js +0 -10
- package/dist/chunk-ZX7TM4AR.js +0 -127
- package/dist/postinstall-SCSXM4IM.js +0 -10
- package/dist/shared-CfiiRctw.d.ts +0 -70
- package/dist/shared-fFqiuWJC.d.cts +0 -70
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
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
6
|
var __copyProps = (to, from, except, desc) => {
|
|
13
7
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
8
|
for (let key of __getOwnPropNames(from))
|
|
@@ -17,111 +11,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
11
|
}
|
|
18
12
|
return to;
|
|
19
13
|
};
|
|
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
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
15
|
|
|
30
16
|
// src/index.ts
|
|
31
17
|
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
_runtime: () => _runtime,
|
|
34
|
-
createMDXSource: () => createMDXSource,
|
|
35
|
-
resolveFiles: () => resolveFiles
|
|
36
|
-
});
|
|
37
18
|
module.exports = __toCommonJS(index_exports);
|
|
38
|
-
|
|
39
|
-
// src/runtime/next/index.ts
|
|
40
|
-
var fs = __toESM(require("fs/promises"), 1);
|
|
41
|
-
|
|
42
|
-
// src/runtime/shared.ts
|
|
43
|
-
function missingProcessedMarkdown() {
|
|
44
|
-
throw new Error(
|
|
45
|
-
"getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// src/runtime/next/index.ts
|
|
50
|
-
var _runtime = {
|
|
51
|
-
doc(files) {
|
|
52
|
-
return files.map((file) => {
|
|
53
|
-
const data = file.data;
|
|
54
|
-
const filePath = file.info.fullPath;
|
|
55
|
-
return {
|
|
56
|
-
info: file.info,
|
|
57
|
-
_exports: data,
|
|
58
|
-
body: data.default,
|
|
59
|
-
lastModified: data.lastModified,
|
|
60
|
-
toc: data.toc,
|
|
61
|
-
structuredData: data.structuredData,
|
|
62
|
-
extractedReferences: data.extractedReferences,
|
|
63
|
-
...data.frontmatter,
|
|
64
|
-
async getText(type) {
|
|
65
|
-
if (type === "raw") {
|
|
66
|
-
return (await fs.readFile(filePath)).toString();
|
|
67
|
-
}
|
|
68
|
-
if (typeof data._markdown !== "string") missingProcessedMarkdown();
|
|
69
|
-
return data._markdown;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
meta(files) {
|
|
75
|
-
return files.map((file) => {
|
|
76
|
-
return {
|
|
77
|
-
info: file.info,
|
|
78
|
-
...file.data
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
docs(docs, metas) {
|
|
83
|
-
const parsedDocs = this.doc(docs);
|
|
84
|
-
const parsedMetas = this.meta(metas);
|
|
85
|
-
return {
|
|
86
|
-
docs: parsedDocs,
|
|
87
|
-
meta: parsedMetas,
|
|
88
|
-
toFumadocsSource() {
|
|
89
|
-
return createMDXSource(parsedDocs, parsedMetas);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
function createMDXSource(docs, meta = []) {
|
|
95
|
-
return {
|
|
96
|
-
files: resolveFiles({
|
|
97
|
-
docs,
|
|
98
|
-
meta
|
|
99
|
-
})
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function resolveFiles({ docs, meta }) {
|
|
103
|
-
const outputs = [];
|
|
104
|
-
for (const entry of docs) {
|
|
105
|
-
outputs.push({
|
|
106
|
-
type: "page",
|
|
107
|
-
absolutePath: entry.info.fullPath,
|
|
108
|
-
path: entry.info.path,
|
|
109
|
-
data: entry
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
for (const entry of meta) {
|
|
113
|
-
outputs.push({
|
|
114
|
-
type: "meta",
|
|
115
|
-
absolutePath: entry.info.fullPath,
|
|
116
|
-
path: entry.info.path,
|
|
117
|
-
data: entry
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return outputs;
|
|
121
|
-
}
|
|
122
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
-
0 && (module.exports = {
|
|
124
|
-
_runtime,
|
|
125
|
-
createMDXSource,
|
|
126
|
-
resolveFiles
|
|
127
|
-
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import 'react';
|
|
8
|
-
import 'mdx/types';
|
|
9
|
-
import 'fumadocs-core/source';
|
|
10
|
-
import '@standard-schema/spec';
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
2
|
+
import { TOCItemType } from 'fumadocs-core/toc';
|
|
3
|
+
import { MDXContent } from 'mdx/types';
|
|
4
|
+
import { E as ExtractedReference } from './remark-postprocess-K233ZVBK.cjs';
|
|
5
|
+
import { Root } from 'mdast';
|
|
6
|
+
import { C as CompiledMDXProperties } from './build-mdx-BHG-_uxo.cjs';
|
|
11
7
|
import '@mdx-js/mdx';
|
|
12
|
-
import '
|
|
13
|
-
|
|
8
|
+
import 'react';
|
|
9
|
+
|
|
10
|
+
interface FileInfo {
|
|
11
|
+
/**
|
|
12
|
+
* virtualized path for Source API
|
|
13
|
+
*/
|
|
14
|
+
path: string;
|
|
15
|
+
/**
|
|
16
|
+
* the file path in file system
|
|
17
|
+
*/
|
|
18
|
+
fullPath: string;
|
|
19
|
+
}
|
|
20
|
+
interface DocData {
|
|
21
|
+
/**
|
|
22
|
+
* Compiled MDX content (as component)
|
|
23
|
+
*/
|
|
24
|
+
body: MDXContent;
|
|
25
|
+
/**
|
|
26
|
+
* table of contents generated from content.
|
|
27
|
+
*/
|
|
28
|
+
toc: TOCItemType[];
|
|
29
|
+
/**
|
|
30
|
+
* structured data for document search indexing.
|
|
31
|
+
*/
|
|
32
|
+
structuredData: StructuredData;
|
|
33
|
+
/**
|
|
34
|
+
* Raw exports from the compiled MDX file.
|
|
35
|
+
*/
|
|
36
|
+
_exports: Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Last modified date of document file, obtained from version control.
|
|
39
|
+
*
|
|
40
|
+
* Only available when `lastModifiedTime` is enabled on global config.
|
|
41
|
+
*/
|
|
42
|
+
lastModified?: Date;
|
|
43
|
+
/**
|
|
44
|
+
* extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
|
|
45
|
+
*/
|
|
46
|
+
extractedReferences?: ExtractedReference[];
|
|
47
|
+
}
|
|
48
|
+
interface DocMethods {
|
|
49
|
+
/**
|
|
50
|
+
* file info
|
|
51
|
+
*/
|
|
52
|
+
info: FileInfo;
|
|
53
|
+
/**
|
|
54
|
+
* get document as text.
|
|
55
|
+
*
|
|
56
|
+
* - `type: raw` - read the original content from file system.
|
|
57
|
+
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
58
|
+
*/
|
|
59
|
+
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
60
|
+
getMDAST: () => Promise<Root>;
|
|
61
|
+
}
|
|
62
|
+
type MetaCollectionEntry<Data> = Data & {
|
|
63
|
+
/**
|
|
64
|
+
* file info
|
|
65
|
+
*/
|
|
66
|
+
info: FileInfo;
|
|
67
|
+
};
|
|
68
|
+
type DocCollectionEntry<Frontmatter> = DocData & DocMethods & Frontmatter;
|
|
69
|
+
type AsyncDocCollectionEntry<Frontmatter> = DocMethods & {
|
|
70
|
+
load: () => Promise<DocData>;
|
|
71
|
+
} & Frontmatter;
|
|
72
|
+
declare function createDocMethods(info: FileInfo, load: () => Promise<CompiledMDXProperties<any>>): DocMethods;
|
|
73
|
+
|
|
74
|
+
export { type AsyncDocCollectionEntry, type DocCollectionEntry, type DocData, type DocMethods, ExtractedReference, type FileInfo, type MetaCollectionEntry, createDocMethods };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import 'react';
|
|
8
|
-
import 'mdx/types';
|
|
9
|
-
import 'fumadocs-core/source';
|
|
10
|
-
import '@standard-schema/spec';
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
2
|
+
import { TOCItemType } from 'fumadocs-core/toc';
|
|
3
|
+
import { MDXContent } from 'mdx/types';
|
|
4
|
+
import { E as ExtractedReference } from './remark-postprocess-K233ZVBK.js';
|
|
5
|
+
import { Root } from 'mdast';
|
|
6
|
+
import { C as CompiledMDXProperties } from './build-mdx-CzrQDBRZ.js';
|
|
11
7
|
import '@mdx-js/mdx';
|
|
12
|
-
import '
|
|
13
|
-
|
|
8
|
+
import 'react';
|
|
9
|
+
|
|
10
|
+
interface FileInfo {
|
|
11
|
+
/**
|
|
12
|
+
* virtualized path for Source API
|
|
13
|
+
*/
|
|
14
|
+
path: string;
|
|
15
|
+
/**
|
|
16
|
+
* the file path in file system
|
|
17
|
+
*/
|
|
18
|
+
fullPath: string;
|
|
19
|
+
}
|
|
20
|
+
interface DocData {
|
|
21
|
+
/**
|
|
22
|
+
* Compiled MDX content (as component)
|
|
23
|
+
*/
|
|
24
|
+
body: MDXContent;
|
|
25
|
+
/**
|
|
26
|
+
* table of contents generated from content.
|
|
27
|
+
*/
|
|
28
|
+
toc: TOCItemType[];
|
|
29
|
+
/**
|
|
30
|
+
* structured data for document search indexing.
|
|
31
|
+
*/
|
|
32
|
+
structuredData: StructuredData;
|
|
33
|
+
/**
|
|
34
|
+
* Raw exports from the compiled MDX file.
|
|
35
|
+
*/
|
|
36
|
+
_exports: Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Last modified date of document file, obtained from version control.
|
|
39
|
+
*
|
|
40
|
+
* Only available when `lastModifiedTime` is enabled on global config.
|
|
41
|
+
*/
|
|
42
|
+
lastModified?: Date;
|
|
43
|
+
/**
|
|
44
|
+
* extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
|
|
45
|
+
*/
|
|
46
|
+
extractedReferences?: ExtractedReference[];
|
|
47
|
+
}
|
|
48
|
+
interface DocMethods {
|
|
49
|
+
/**
|
|
50
|
+
* file info
|
|
51
|
+
*/
|
|
52
|
+
info: FileInfo;
|
|
53
|
+
/**
|
|
54
|
+
* get document as text.
|
|
55
|
+
*
|
|
56
|
+
* - `type: raw` - read the original content from file system.
|
|
57
|
+
* - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
|
|
58
|
+
*/
|
|
59
|
+
getText: (type: 'raw' | 'processed') => Promise<string>;
|
|
60
|
+
getMDAST: () => Promise<Root>;
|
|
61
|
+
}
|
|
62
|
+
type MetaCollectionEntry<Data> = Data & {
|
|
63
|
+
/**
|
|
64
|
+
* file info
|
|
65
|
+
*/
|
|
66
|
+
info: FileInfo;
|
|
67
|
+
};
|
|
68
|
+
type DocCollectionEntry<Frontmatter> = DocData & DocMethods & Frontmatter;
|
|
69
|
+
type AsyncDocCollectionEntry<Frontmatter> = DocMethods & {
|
|
70
|
+
load: () => Promise<DocData>;
|
|
71
|
+
} & Frontmatter;
|
|
72
|
+
declare function createDocMethods(info: FileInfo, load: () => Promise<CompiledMDXProperties<any>>): DocMethods;
|
|
73
|
+
|
|
74
|
+
export { type AsyncDocCollectionEntry, type DocCollectionEntry, type DocData, type DocMethods, ExtractedReference, type FileInfo, type MetaCollectionEntry, createDocMethods };
|
package/dist/index.js
CHANGED