fumadocs-mdx 11.6.1 → 11.6.3
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/{chunk-VFALQK6O.js → chunk-4LSNX4UE.js} +6 -0
- package/dist/config/index.cjs +1 -0
- package/dist/config/index.d.cts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -0
- package/dist/{define-CGHfrlrJ.d.cts → define-Cbpc-b73.d.cts} +3 -0
- package/dist/{define-CGHfrlrJ.d.ts → define-Cbpc-b73.d.ts} +3 -0
- package/dist/index.cjs +16 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/next/index.cjs +16 -3
- package/dist/next/index.js +16 -3
- package/dist/runtime/async.cjs +6 -0
- package/dist/runtime/async.d.cts +2 -2
- package/dist/runtime/async.d.ts +2 -2
- package/dist/runtime/async.js +1 -1
- package/dist/{types-CTLLuPxW.d.cts → types-CY4MX9if.d.cts} +8 -2
- package/dist/{types-CUbprvBB.d.ts → types-DeEXKgfl.d.ts} +8 -2
- package/package.json +8 -6
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
// src/runtime/index.ts
|
|
2
|
+
import fs from "node:fs";
|
|
2
3
|
var _runtime = {
|
|
3
4
|
doc(files) {
|
|
4
5
|
return files.map((file) => {
|
|
5
6
|
const { default: body, frontmatter, ...exports } = file.data;
|
|
7
|
+
let cachedContent;
|
|
6
8
|
return {
|
|
7
9
|
body,
|
|
8
10
|
...exports,
|
|
9
11
|
...frontmatter,
|
|
12
|
+
get content() {
|
|
13
|
+
cachedContent ??= fs.readFileSync(file.info.absolutePath).toString();
|
|
14
|
+
return cachedContent;
|
|
15
|
+
},
|
|
10
16
|
_exports: file.data,
|
|
11
17
|
_file: file.info
|
|
12
18
|
};
|
package/dist/config/index.cjs
CHANGED
package/dist/config/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, c as DocsCollection, F as FileInfo, G as GlobalConfig, M as MarkdownProps, b as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-
|
|
1
|
+
export { a as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, c as DocsCollection, F as FileInfo, G as GlobalConfig, M as MarkdownProps, b as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-Cbpc-b73.cjs';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
4
|
import '@mdx-js/mdx';
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, c as DocsCollection, F as FileInfo, G as GlobalConfig, M as MarkdownProps, b as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-
|
|
1
|
+
export { a as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, c as DocsCollection, F as FileInfo, G as GlobalConfig, M as MarkdownProps, b as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-Cbpc-b73.js';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
4
|
import '@mdx-js/mdx';
|
package/dist/config/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -27,14 +37,20 @@ __export(index_exports, {
|
|
|
27
37
|
module.exports = __toCommonJS(index_exports);
|
|
28
38
|
|
|
29
39
|
// src/runtime/index.ts
|
|
40
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
30
41
|
var _runtime = {
|
|
31
42
|
doc(files) {
|
|
32
43
|
return files.map((file) => {
|
|
33
44
|
const { default: body, frontmatter, ...exports2 } = file.data;
|
|
45
|
+
let cachedContent;
|
|
34
46
|
return {
|
|
35
47
|
body,
|
|
36
48
|
...exports2,
|
|
37
49
|
...frontmatter,
|
|
50
|
+
get content() {
|
|
51
|
+
cachedContent ??= import_node_fs.default.readFileSync(file.info.absolutePath).toString();
|
|
52
|
+
return cachedContent;
|
|
53
|
+
},
|
|
38
54
|
_exports: file.data,
|
|
39
55
|
_file: file.info
|
|
40
56
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
|
|
2
|
-
import { B as BaseCollectionEntry } from './define-
|
|
3
|
-
import { R as Runtime } from './types-
|
|
2
|
+
import { B as BaseCollectionEntry } from './define-Cbpc-b73.cjs';
|
|
3
|
+
import { R as Runtime } from './types-CY4MX9if.cjs';
|
|
4
4
|
import '@mdx-js/mdx';
|
|
5
5
|
import 'mdx/types';
|
|
6
6
|
import 'fumadocs-core/mdx-plugins';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
|
|
2
|
-
import { B as BaseCollectionEntry } from './define-
|
|
3
|
-
import { R as Runtime } from './types-
|
|
2
|
+
import { B as BaseCollectionEntry } from './define-Cbpc-b73.js';
|
|
3
|
+
import { R as Runtime } from './types-DeEXKgfl.js';
|
|
4
4
|
import '@mdx-js/mdx';
|
|
5
5
|
import 'mdx/types';
|
|
6
6
|
import 'fumadocs-core/mdx-plugins';
|
package/dist/index.js
CHANGED
package/dist/next/index.cjs
CHANGED
|
@@ -264,6 +264,7 @@ var fileCache = {
|
|
|
264
264
|
|
|
265
265
|
// src/map/generate.ts
|
|
266
266
|
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
267
|
+
var import_js_yaml = require("js-yaml");
|
|
267
268
|
async function readFileWithCache(file) {
|
|
268
269
|
const cached = fileCache.read("read-file", file);
|
|
269
270
|
if (cached) return cached;
|
|
@@ -302,7 +303,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
302
303
|
async function getMetaEntries(collection, files) {
|
|
303
304
|
const items = files.map(async (file) => {
|
|
304
305
|
const source = await readFileWithCache(file.absolutePath).catch(() => "");
|
|
305
|
-
let data = source.length === 0 ? {} :
|
|
306
|
+
let data = source.length === 0 ? {} : parseMetaEntry(file.absolutePath, source);
|
|
306
307
|
if (collection?.schema) {
|
|
307
308
|
data = await validate(
|
|
308
309
|
collection.schema,
|
|
@@ -427,6 +428,18 @@ function toImportPath(file, dir) {
|
|
|
427
428
|
}
|
|
428
429
|
return importPath.replaceAll(path2.sep, "/");
|
|
429
430
|
}
|
|
431
|
+
function parseMetaEntry(file, content) {
|
|
432
|
+
const extname3 = path2.extname(file);
|
|
433
|
+
try {
|
|
434
|
+
if (extname3 === ".json") return JSON.parse(content);
|
|
435
|
+
if (extname3 === ".yaml") return (0, import_js_yaml.load)(content);
|
|
436
|
+
} catch (e) {
|
|
437
|
+
throw new Error(`Failed to parse meta file: ${file}.`, {
|
|
438
|
+
cause: e
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
throw new Error(`Unknown meta file format: ${extname3}, in ${file}.`);
|
|
442
|
+
}
|
|
430
443
|
|
|
431
444
|
// src/map/index.ts
|
|
432
445
|
async function start(dev, configPath, outDir2) {
|
|
@@ -434,7 +447,7 @@ async function start(dev, configPath, outDir2) {
|
|
|
434
447
|
let config = await loadConfig(configPath, configHash, true);
|
|
435
448
|
const outPath = path3.resolve(outDir2, `index.ts`);
|
|
436
449
|
async function updateMapFile() {
|
|
437
|
-
const start2 =
|
|
450
|
+
const start2 = performance.now();
|
|
438
451
|
try {
|
|
439
452
|
await fs3.writeFile(
|
|
440
453
|
outPath,
|
|
@@ -447,7 +460,7 @@ async function start(dev, configPath, outDir2) {
|
|
|
447
460
|
console.error(err);
|
|
448
461
|
}
|
|
449
462
|
}
|
|
450
|
-
console.log(`[MDX] updated map file in ${
|
|
463
|
+
console.log(`[MDX] updated map file in ${performance.now() - start2}ms`);
|
|
451
464
|
}
|
|
452
465
|
await updateMapFile();
|
|
453
466
|
if (dev) {
|
package/dist/next/index.js
CHANGED
|
@@ -53,6 +53,7 @@ var fileCache = {
|
|
|
53
53
|
|
|
54
54
|
// src/map/generate.ts
|
|
55
55
|
import matter from "gray-matter";
|
|
56
|
+
import { load } from "js-yaml";
|
|
56
57
|
async function readFileWithCache(file) {
|
|
57
58
|
const cached = fileCache.read("read-file", file);
|
|
58
59
|
if (cached) return cached;
|
|
@@ -91,7 +92,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
91
92
|
async function getMetaEntries(collection, files) {
|
|
92
93
|
const items = files.map(async (file) => {
|
|
93
94
|
const source = await readFileWithCache(file.absolutePath).catch(() => "");
|
|
94
|
-
let data = source.length === 0 ? {} :
|
|
95
|
+
let data = source.length === 0 ? {} : parseMetaEntry(file.absolutePath, source);
|
|
95
96
|
if (collection?.schema) {
|
|
96
97
|
data = await validate(
|
|
97
98
|
collection.schema,
|
|
@@ -216,6 +217,18 @@ function toImportPath(file, dir) {
|
|
|
216
217
|
}
|
|
217
218
|
return importPath.replaceAll(path.sep, "/");
|
|
218
219
|
}
|
|
220
|
+
function parseMetaEntry(file, content) {
|
|
221
|
+
const extname3 = path.extname(file);
|
|
222
|
+
try {
|
|
223
|
+
if (extname3 === ".json") return JSON.parse(content);
|
|
224
|
+
if (extname3 === ".yaml") return load(content);
|
|
225
|
+
} catch (e) {
|
|
226
|
+
throw new Error(`Failed to parse meta file: ${file}.`, {
|
|
227
|
+
cause: e
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
throw new Error(`Unknown meta file format: ${extname3}, in ${file}.`);
|
|
231
|
+
}
|
|
219
232
|
|
|
220
233
|
// src/map/index.ts
|
|
221
234
|
async function start(dev, configPath, outDir2) {
|
|
@@ -223,7 +236,7 @@ async function start(dev, configPath, outDir2) {
|
|
|
223
236
|
let config = await loadConfig(configPath, configHash, true);
|
|
224
237
|
const outPath = path2.resolve(outDir2, `index.ts`);
|
|
225
238
|
async function updateMapFile() {
|
|
226
|
-
const start2 =
|
|
239
|
+
const start2 = performance.now();
|
|
227
240
|
try {
|
|
228
241
|
await fs2.writeFile(
|
|
229
242
|
outPath,
|
|
@@ -236,7 +249,7 @@ async function start(dev, configPath, outDir2) {
|
|
|
236
249
|
console.error(err);
|
|
237
250
|
}
|
|
238
251
|
}
|
|
239
|
-
console.log(`[MDX] updated map file in ${
|
|
252
|
+
console.log(`[MDX] updated map file in ${performance.now() - start2}ms`);
|
|
240
253
|
}
|
|
241
254
|
await updateMapFile();
|
|
242
255
|
if (dev) {
|
package/dist/runtime/async.cjs
CHANGED
|
@@ -112,14 +112,20 @@ function remarkInclude() {
|
|
|
112
112
|
var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
|
|
113
113
|
|
|
114
114
|
// src/runtime/index.ts
|
|
115
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
115
116
|
var _runtime = {
|
|
116
117
|
doc(files) {
|
|
117
118
|
return files.map((file) => {
|
|
118
119
|
const { default: body, frontmatter, ...exports2 } = file.data;
|
|
120
|
+
let cachedContent;
|
|
119
121
|
return {
|
|
120
122
|
body,
|
|
121
123
|
...exports2,
|
|
122
124
|
...frontmatter,
|
|
125
|
+
get content() {
|
|
126
|
+
cachedContent ??= import_node_fs.default.readFileSync(file.info.absolutePath).toString();
|
|
127
|
+
return cachedContent;
|
|
128
|
+
},
|
|
123
129
|
_exports: file.data,
|
|
124
130
|
_file: file.info
|
|
125
131
|
};
|
package/dist/runtime/async.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoadedConfig, a as RuntimeAsync } from '../types-
|
|
2
|
-
import '../define-
|
|
1
|
+
import { L as LoadedConfig, a as RuntimeAsync } from '../types-CY4MX9if.cjs';
|
|
2
|
+
import '../define-Cbpc-b73.cjs';
|
|
3
3
|
import '@mdx-js/mdx';
|
|
4
4
|
import 'mdx/types';
|
|
5
5
|
import 'fumadocs-core/mdx-plugins';
|
package/dist/runtime/async.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoadedConfig, a as RuntimeAsync } from '../types-
|
|
2
|
-
import '../define-
|
|
1
|
+
import { L as LoadedConfig, a as RuntimeAsync } from '../types-DeEXKgfl.js';
|
|
2
|
+
import '../define-Cbpc-b73.js';
|
|
3
3
|
import '@mdx-js/mdx';
|
|
4
4
|
import 'mdx/types';
|
|
5
5
|
import 'fumadocs-core/mdx-plugins';
|
package/dist/runtime/async.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-
|
|
1
|
+
import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-Cbpc-b73.cjs';
|
|
2
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
@@ -24,7 +24,13 @@ interface AsyncRuntimeFile {
|
|
|
24
24
|
data: Record<string, unknown>;
|
|
25
25
|
content: string;
|
|
26
26
|
}
|
|
27
|
-
type DocOut<Schema extends StandardSchemaV1> =
|
|
27
|
+
type DocOut<Schema extends StandardSchemaV1> = Override<MarkdownProps & {
|
|
28
|
+
/**
|
|
29
|
+
* Read the original content of file from file system.
|
|
30
|
+
*/
|
|
31
|
+
get content(): string;
|
|
32
|
+
}, StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry>;
|
|
33
|
+
type Override<A, B> = Omit<A, keyof B> & B;
|
|
28
34
|
type MetaOut<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry;
|
|
29
35
|
interface Runtime {
|
|
30
36
|
doc: <C>(files: RuntimeFile[]) => C extends {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-
|
|
1
|
+
import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-Cbpc-b73.js';
|
|
2
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
import { Source, PageData, MetaData } from 'fumadocs-core/source';
|
|
4
4
|
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
@@ -24,7 +24,13 @@ interface AsyncRuntimeFile {
|
|
|
24
24
|
data: Record<string, unknown>;
|
|
25
25
|
content: string;
|
|
26
26
|
}
|
|
27
|
-
type DocOut<Schema extends StandardSchemaV1> =
|
|
27
|
+
type DocOut<Schema extends StandardSchemaV1> = Override<MarkdownProps & {
|
|
28
|
+
/**
|
|
29
|
+
* Read the original content of file from file system.
|
|
30
|
+
*/
|
|
31
|
+
get content(): string;
|
|
32
|
+
}, StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry>;
|
|
33
|
+
type Override<A, B> = Omit<A, keyof B> & B;
|
|
28
34
|
type MetaOut<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry;
|
|
29
35
|
interface Runtime {
|
|
30
36
|
doc: <C>(files: RuntimeFile[]) => C extends {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-mdx",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.3",
|
|
4
4
|
"description": "The built-in source for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -46,28 +46,30 @@
|
|
|
46
46
|
"@standard-schema/spec": "^1.0.0",
|
|
47
47
|
"chokidar": "^4.0.3",
|
|
48
48
|
"cross-spawn": "^7.0.6",
|
|
49
|
-
"esbuild": "^0.25.
|
|
49
|
+
"esbuild": "^0.25.4",
|
|
50
50
|
"estree-util-value-to-estree": "^3.3.3",
|
|
51
51
|
"fast-glob": "^3.3.3",
|
|
52
52
|
"gray-matter": "^4.0.3",
|
|
53
|
+
"js-yaml": "^4.1.0",
|
|
53
54
|
"lru-cache": "^11.1.0",
|
|
54
55
|
"picocolors": "^1.1.1",
|
|
55
56
|
"unist-util-visit": "^5.0.0",
|
|
56
|
-
"zod": "^3.24.
|
|
57
|
+
"zod": "^3.24.4"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@types/cross-spawn": "^6.0.6",
|
|
61
|
+
"@types/js-yaml": "^4.0.9",
|
|
60
62
|
"@types/mdast": "^4.0.3",
|
|
61
63
|
"@types/mdx": "^2.0.13",
|
|
62
|
-
"@types/react": "^19.1.
|
|
64
|
+
"@types/react": "^19.1.3",
|
|
63
65
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
64
66
|
"next": "^15.3.1",
|
|
65
67
|
"unified": "^11.0.5",
|
|
66
68
|
"vfile": "^6.0.3",
|
|
67
|
-
"webpack": "^5.99.
|
|
69
|
+
"webpack": "^5.99.8",
|
|
68
70
|
"@fumadocs/mdx-remote": "1.3.0",
|
|
69
71
|
"eslint-config-custom": "0.0.0",
|
|
70
|
-
"fumadocs-core": "15.
|
|
72
|
+
"fumadocs-core": "15.3.0",
|
|
71
73
|
"tsconfig": "0.0.0"
|
|
72
74
|
},
|
|
73
75
|
"peerDependencies": {
|