fumadocs-mdx 8.2.32 → 8.2.34
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/index.d.mts +12 -1
- package/dist/index.mjs +2 -1
- package/dist/loader-mdx.mjs +11 -4
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -10,14 +10,17 @@ declare const defaultSchemas: {
|
|
|
10
10
|
title: z.ZodString;
|
|
11
11
|
description: z.ZodOptional<z.ZodString>;
|
|
12
12
|
icon: z.ZodOptional<z.ZodString>;
|
|
13
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
13
14
|
}, "strip", z.ZodTypeAny, {
|
|
14
15
|
title: string;
|
|
15
16
|
icon?: string | undefined;
|
|
16
17
|
description?: string | undefined;
|
|
18
|
+
full?: boolean | undefined;
|
|
17
19
|
}, {
|
|
18
20
|
title: string;
|
|
19
21
|
icon?: string | undefined;
|
|
20
22
|
description?: string | undefined;
|
|
23
|
+
full?: boolean | undefined;
|
|
21
24
|
}>;
|
|
22
25
|
meta: z.ZodObject<{
|
|
23
26
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -62,6 +65,14 @@ interface MDXExport<Frontmatter = PageData> {
|
|
|
62
65
|
type MDXPageData<Frontmatter extends PageData = PageData> = Omit<Frontmatter, 'exports'> & {
|
|
63
66
|
exports: Omit<MDXExport<Frontmatter>, 'frontmatter'>;
|
|
64
67
|
};
|
|
68
|
+
interface InternalFrontmatter {
|
|
69
|
+
_mdx?: {
|
|
70
|
+
/**
|
|
71
|
+
* Mirror another MDX file
|
|
72
|
+
*/
|
|
73
|
+
mirror?: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
65
76
|
|
|
66
77
|
interface SourceOptions<Frontmatter, Meta> {
|
|
67
78
|
schema?: {
|
|
@@ -80,4 +91,4 @@ declare function createMDXSource<Frontmatter extends DefaultFrontmatter = Defaul
|
|
|
80
91
|
}>;
|
|
81
92
|
declare function loadMDXSource<Frontmatter extends DefaultFrontmatter = DefaultFrontmatter, Meta extends DefaultMeta = DefaultMeta>(map: Record<string, unknown>, options?: LoadOptions<Frontmatter, Meta>): SourceFile<z.infer<Meta>, z.infer<Frontmatter>>[];
|
|
82
93
|
|
|
83
|
-
export { type MDXExport, type MDXPageData, type SourceFile, createMDXSource, defaultSchemas, loadMDXSource };
|
|
94
|
+
export { type InternalFrontmatter, type MDXExport, type MDXPageData, type SourceFile, createMDXSource, defaultSchemas, loadMDXSource };
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,8 @@ var metaSchema = z.object({
|
|
|
13
13
|
var frontmatterSchema = z.object({
|
|
14
14
|
title: z.string(),
|
|
15
15
|
description: z.string().optional(),
|
|
16
|
-
icon: z.string().optional()
|
|
16
|
+
icon: z.string().optional(),
|
|
17
|
+
full: z.boolean().optional()
|
|
17
18
|
});
|
|
18
19
|
var defaultSchemas = {
|
|
19
20
|
frontmatter: frontmatterSchema,
|
package/dist/loader-mdx.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/loader-mdx.ts
|
|
2
2
|
import path2 from "node:path";
|
|
3
|
+
import fs2 from "node:fs/promises";
|
|
3
4
|
import { createProcessor } from "@mdx-js/mdx";
|
|
4
5
|
import grayMatter from "gray-matter";
|
|
5
6
|
|
|
@@ -38,10 +39,8 @@ async function loader(source, callback) {
|
|
|
38
39
|
const context = this.context;
|
|
39
40
|
const filePath = this.resourcePath;
|
|
40
41
|
const { lastModifiedTime, ...options } = this.getOptions();
|
|
41
|
-
const { content, data: frontmatter } = grayMatter(source);
|
|
42
42
|
const detectedFormat = filePath.endsWith(".mdx") ? "mdx" : "md";
|
|
43
43
|
const format = options.format ?? detectedFormat;
|
|
44
|
-
let timestamp;
|
|
45
44
|
let processor = cache2.get(format);
|
|
46
45
|
if (processor === void 0) {
|
|
47
46
|
processor = createProcessor({
|
|
@@ -51,14 +50,22 @@ async function loader(source, callback) {
|
|
|
51
50
|
});
|
|
52
51
|
cache2.set(format, processor);
|
|
53
52
|
}
|
|
53
|
+
const matter = grayMatter(source);
|
|
54
|
+
const props = matter.data._mdx ?? {};
|
|
55
|
+
if (props.mirror) {
|
|
56
|
+
const mirrorPath = path2.resolve(path2.dirname(filePath), props.mirror);
|
|
57
|
+
this.addDependency(mirrorPath);
|
|
58
|
+
matter.content = await fs2.readFile(mirrorPath).then((res) => grayMatter(res.toString()).content);
|
|
59
|
+
}
|
|
60
|
+
let timestamp;
|
|
54
61
|
if (lastModifiedTime === "git")
|
|
55
62
|
timestamp = (await getGitTimestamp(filePath))?.getTime();
|
|
56
63
|
processor.process({
|
|
57
|
-
value: content,
|
|
64
|
+
value: matter.content,
|
|
58
65
|
path: filePath,
|
|
59
66
|
data: {
|
|
60
67
|
lastModified: timestamp,
|
|
61
|
-
frontmatter
|
|
68
|
+
frontmatter: matter.data
|
|
62
69
|
}
|
|
63
70
|
}).then(
|
|
64
71
|
(file) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-mdx",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.34",
|
|
4
4
|
"description": "The built-in source for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@mdx-js/mdx": "^3.0.1",
|
|
41
41
|
"cross-spawn": "^7.0.3",
|
|
42
|
-
"estree-util-value-to-estree": "^3.1.
|
|
42
|
+
"estree-util-value-to-estree": "^3.1.2",
|
|
43
43
|
"fast-glob": "^3.3.1",
|
|
44
44
|
"gray-matter": "^4.0.3",
|
|
45
45
|
"zod": "^3.23.8"
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"@types/mdast": "^4.0.3",
|
|
50
50
|
"@types/mdx": "^2.0.13",
|
|
51
51
|
"@types/react": "^18.3.3",
|
|
52
|
-
"next": "^14.2.
|
|
53
|
-
"unified": "^11.0.
|
|
52
|
+
"next": "^14.2.5",
|
|
53
|
+
"unified": "^11.0.5",
|
|
54
54
|
"webpack": "^5.90.3",
|
|
55
55
|
"eslint-config-custom": "0.0.0",
|
|
56
|
-
"fumadocs-core": "12.
|
|
56
|
+
"fumadocs-core": "12.5.3",
|
|
57
57
|
"tsconfig": "0.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|