fumadocs-mdx 11.3.0 → 11.3.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/chunk-PY2KKTR2.js +53 -0
- package/dist/config/index.cjs +24 -12
- package/dist/config/index.js +1 -1
- package/dist/loader-mdx.cjs +24 -12
- package/dist/loader-mdx.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-GUHWD47S.js +0 -41
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/mdx-plugins/remark-include.ts
|
|
2
|
+
import { visit } from "unist-util-visit";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as fs from "node:fs/promises";
|
|
5
|
+
import matter from "gray-matter";
|
|
6
|
+
function remarkInclude() {
|
|
7
|
+
const TagName = "include";
|
|
8
|
+
async function update(tree, file, processor, compiler) {
|
|
9
|
+
const queue = [];
|
|
10
|
+
visit(tree, ["mdxJsxFlowElement", "paragraph"], (node) => {
|
|
11
|
+
let specifier;
|
|
12
|
+
if (node.type === "paragraph" && node.children.length === 3) {
|
|
13
|
+
const [open, content, closure] = node.children;
|
|
14
|
+
if (open.type === "html" && open.value === `<${TagName}>` && content.type === "text" && closure.type === "html" && closure.value === `</${TagName}>`) {
|
|
15
|
+
specifier = content.value.trim();
|
|
16
|
+
}
|
|
17
|
+
} else if (node.type === "paragraph" && node.children.length === 1) {
|
|
18
|
+
const child = node.children[0];
|
|
19
|
+
if (child.type === "mdxJsxTextElement" && child.name === TagName) {
|
|
20
|
+
const text = child.children.at(0);
|
|
21
|
+
if (text && text.type === "text") {
|
|
22
|
+
specifier = text.value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (node.type === "mdxJsxFlowElement" && node.name === TagName) {
|
|
27
|
+
const child = node.children.at(0);
|
|
28
|
+
if (child && child.type === "text") {
|
|
29
|
+
specifier = child.value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (!specifier) return;
|
|
33
|
+
const targetPath = path.resolve(path.dirname(file), specifier);
|
|
34
|
+
queue.push(
|
|
35
|
+
fs.readFile(targetPath).then(async (content) => {
|
|
36
|
+
const parsed = processor.parse(matter(content).content);
|
|
37
|
+
compiler?.addDependency(targetPath);
|
|
38
|
+
await update(parsed, targetPath, processor, compiler);
|
|
39
|
+
Object.assign(node, parsed);
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
return "skip";
|
|
43
|
+
});
|
|
44
|
+
await Promise.all(queue);
|
|
45
|
+
}
|
|
46
|
+
return async (tree, file) => {
|
|
47
|
+
await update(tree, file.path, this, file.data._compiler);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
remarkInclude
|
|
53
|
+
};
|
package/dist/config/index.cjs
CHANGED
|
@@ -201,35 +201,47 @@ var path = __toESM(require("path"), 1);
|
|
|
201
201
|
var fs = __toESM(require("fs/promises"), 1);
|
|
202
202
|
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
203
203
|
function remarkInclude() {
|
|
204
|
-
|
|
204
|
+
const TagName = "include";
|
|
205
|
+
async function update(tree, file, processor, compiler) {
|
|
205
206
|
const queue = [];
|
|
206
207
|
(0, import_unist_util_visit.visit)(tree, ["mdxJsxFlowElement", "paragraph"], (node) => {
|
|
207
208
|
let specifier;
|
|
208
209
|
if (node.type === "paragraph" && node.children.length === 3) {
|
|
209
210
|
const [open, content, closure] = node.children;
|
|
210
|
-
if (open.type === "html" && open.value ===
|
|
211
|
+
if (open.type === "html" && open.value === `<${TagName}>` && content.type === "text" && closure.type === "html" && closure.value === `</${TagName}>`) {
|
|
211
212
|
specifier = content.value.trim();
|
|
212
213
|
}
|
|
214
|
+
} else if (node.type === "paragraph" && node.children.length === 1) {
|
|
215
|
+
const child = node.children[0];
|
|
216
|
+
if (child.type === "mdxJsxTextElement" && child.name === TagName) {
|
|
217
|
+
const text = child.children.at(0);
|
|
218
|
+
if (text && text.type === "text") {
|
|
219
|
+
specifier = text.value;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
213
222
|
}
|
|
214
|
-
if (node.type === "mdxJsxFlowElement" && node.name ===
|
|
223
|
+
if (node.type === "mdxJsxFlowElement" && node.name === TagName) {
|
|
215
224
|
const child = node.children.at(0);
|
|
216
|
-
if (
|
|
217
|
-
|
|
225
|
+
if (child && child.type === "text") {
|
|
226
|
+
specifier = child.value;
|
|
227
|
+
}
|
|
218
228
|
}
|
|
219
|
-
if (!specifier) return
|
|
220
|
-
const targetPath = path.resolve(path.dirname(file
|
|
229
|
+
if (!specifier) return;
|
|
230
|
+
const targetPath = path.resolve(path.dirname(file), specifier);
|
|
221
231
|
queue.push(
|
|
222
|
-
fs.readFile(targetPath).then((content) => {
|
|
223
|
-
const parsed =
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
232
|
+
fs.readFile(targetPath).then(async (content) => {
|
|
233
|
+
const parsed = processor.parse((0, import_gray_matter.default)(content).content);
|
|
234
|
+
compiler?.addDependency(targetPath);
|
|
235
|
+
await update(parsed, targetPath, processor, compiler);
|
|
227
236
|
Object.assign(node, parsed);
|
|
228
237
|
})
|
|
229
238
|
);
|
|
230
239
|
return "skip";
|
|
231
240
|
});
|
|
232
241
|
await Promise.all(queue);
|
|
242
|
+
}
|
|
243
|
+
return async (tree, file) => {
|
|
244
|
+
await update(tree, file.path, this, file.data._compiler);
|
|
233
245
|
};
|
|
234
246
|
}
|
|
235
247
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/config/index.js
CHANGED
package/dist/loader-mdx.cjs
CHANGED
|
@@ -272,35 +272,47 @@ var path2 = __toESM(require("path"), 1);
|
|
|
272
272
|
var fs2 = __toESM(require("fs/promises"), 1);
|
|
273
273
|
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
274
274
|
function remarkInclude() {
|
|
275
|
-
|
|
275
|
+
const TagName = "include";
|
|
276
|
+
async function update(tree, file, processor, compiler) {
|
|
276
277
|
const queue = [];
|
|
277
278
|
(0, import_unist_util_visit.visit)(tree, ["mdxJsxFlowElement", "paragraph"], (node) => {
|
|
278
279
|
let specifier;
|
|
279
280
|
if (node.type === "paragraph" && node.children.length === 3) {
|
|
280
281
|
const [open, content, closure] = node.children;
|
|
281
|
-
if (open.type === "html" && open.value ===
|
|
282
|
+
if (open.type === "html" && open.value === `<${TagName}>` && content.type === "text" && closure.type === "html" && closure.value === `</${TagName}>`) {
|
|
282
283
|
specifier = content.value.trim();
|
|
283
284
|
}
|
|
285
|
+
} else if (node.type === "paragraph" && node.children.length === 1) {
|
|
286
|
+
const child = node.children[0];
|
|
287
|
+
if (child.type === "mdxJsxTextElement" && child.name === TagName) {
|
|
288
|
+
const text = child.children.at(0);
|
|
289
|
+
if (text && text.type === "text") {
|
|
290
|
+
specifier = text.value;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
284
293
|
}
|
|
285
|
-
if (node.type === "mdxJsxFlowElement" && node.name ===
|
|
294
|
+
if (node.type === "mdxJsxFlowElement" && node.name === TagName) {
|
|
286
295
|
const child = node.children.at(0);
|
|
287
|
-
if (
|
|
288
|
-
|
|
296
|
+
if (child && child.type === "text") {
|
|
297
|
+
specifier = child.value;
|
|
298
|
+
}
|
|
289
299
|
}
|
|
290
|
-
if (!specifier) return
|
|
291
|
-
const targetPath = path2.resolve(path2.dirname(file
|
|
300
|
+
if (!specifier) return;
|
|
301
|
+
const targetPath = path2.resolve(path2.dirname(file), specifier);
|
|
292
302
|
queue.push(
|
|
293
|
-
fs2.readFile(targetPath).then((content) => {
|
|
294
|
-
const parsed =
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
303
|
+
fs2.readFile(targetPath).then(async (content) => {
|
|
304
|
+
const parsed = processor.parse((0, import_gray_matter.default)(content).content);
|
|
305
|
+
compiler?.addDependency(targetPath);
|
|
306
|
+
await update(parsed, targetPath, processor, compiler);
|
|
298
307
|
Object.assign(node, parsed);
|
|
299
308
|
})
|
|
300
309
|
);
|
|
301
310
|
return "skip";
|
|
302
311
|
});
|
|
303
312
|
await Promise.all(queue);
|
|
313
|
+
}
|
|
314
|
+
return async (tree, file) => {
|
|
315
|
+
await update(tree, file.path, this, file.data._compiler);
|
|
304
316
|
};
|
|
305
317
|
}
|
|
306
318
|
|
package/dist/loader-mdx.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-mdx",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.1",
|
|
4
4
|
"description": "The built-in source for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"@types/mdast": "^4.0.3",
|
|
55
55
|
"@types/mdx": "^2.0.13",
|
|
56
56
|
"@types/micromatch": "^4.0.9",
|
|
57
|
-
"@types/react": "^19.0.
|
|
58
|
-
"mdast-util-mdx-jsx": "^3.
|
|
57
|
+
"@types/react": "^19.0.7",
|
|
58
|
+
"mdast-util-mdx-jsx": "^3.2.0",
|
|
59
59
|
"next": "^15.1.4",
|
|
60
60
|
"unified": "^11.0.5",
|
|
61
61
|
"vfile": "^6.0.3",
|
|
62
62
|
"webpack": "^5.97.1",
|
|
63
63
|
"eslint-config-custom": "0.0.0",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
64
|
+
"fumadocs-core": "14.7.4",
|
|
65
|
+
"tsconfig": "0.0.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"fumadocs-core": "^14.0.0",
|
package/dist/chunk-GUHWD47S.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// src/mdx-plugins/remark-include.ts
|
|
2
|
-
import { visit } from "unist-util-visit";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import * as fs from "node:fs/promises";
|
|
5
|
-
import matter from "gray-matter";
|
|
6
|
-
function remarkInclude() {
|
|
7
|
-
return async (tree, file) => {
|
|
8
|
-
const queue = [];
|
|
9
|
-
visit(tree, ["mdxJsxFlowElement", "paragraph"], (node) => {
|
|
10
|
-
let specifier;
|
|
11
|
-
if (node.type === "paragraph" && node.children.length === 3) {
|
|
12
|
-
const [open, content, closure] = node.children;
|
|
13
|
-
if (open.type === "html" && open.value === "<include>" && content.type === "text" && closure.type === "html" && closure.value === "</include>") {
|
|
14
|
-
specifier = content.value.trim();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (node.type === "mdxJsxFlowElement" && node.name === "include") {
|
|
18
|
-
const child = node.children.at(0);
|
|
19
|
-
if (!child || child.type !== "text") return;
|
|
20
|
-
specifier = child.value;
|
|
21
|
-
}
|
|
22
|
-
if (!specifier) return "skip";
|
|
23
|
-
const targetPath = path.resolve(path.dirname(file.path), specifier);
|
|
24
|
-
queue.push(
|
|
25
|
-
fs.readFile(targetPath).then((content) => {
|
|
26
|
-
const parsed = this.parse(matter(content).content);
|
|
27
|
-
if (file.data._compiler) {
|
|
28
|
-
file.data._compiler.addDependency(targetPath);
|
|
29
|
-
}
|
|
30
|
-
Object.assign(node, parsed);
|
|
31
|
-
})
|
|
32
|
-
);
|
|
33
|
-
return "skip";
|
|
34
|
-
});
|
|
35
|
-
await Promise.all(queue);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
remarkInclude
|
|
41
|
-
};
|