fumadocs-core 15.6.3 → 15.6.5
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/mdx-plugins/index.d.ts +12 -2
- package/dist/mdx-plugins/index.js +22 -7
- package/package.json +10 -10
|
@@ -57,11 +57,21 @@ interface RemarkImageOptions {
|
|
|
57
57
|
*/
|
|
58
58
|
publicDir?: string;
|
|
59
59
|
/**
|
|
60
|
-
* Preferred placeholder type
|
|
60
|
+
* Preferred placeholder type, only available with `useImport` + local images.
|
|
61
61
|
*
|
|
62
62
|
* @defaultValue 'blur'
|
|
63
63
|
*/
|
|
64
64
|
placeholder?: 'blur' | 'none';
|
|
65
|
+
/**
|
|
66
|
+
* Define how to handle errors when fetching image size.
|
|
67
|
+
*
|
|
68
|
+
* - `error` (default): throw an error.
|
|
69
|
+
* - `ignore`: do absolutely nothing (Next.js Image component may complain).
|
|
70
|
+
* - `hide`: remove that image element.
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue 'error'
|
|
73
|
+
*/
|
|
74
|
+
onError?: 'error' | 'hide' | 'ignore' | ((error: Error) => void);
|
|
65
75
|
/**
|
|
66
76
|
* Import images in the file, and let bundlers handle it.
|
|
67
77
|
*
|
|
@@ -86,7 +96,7 @@ interface RemarkImageOptions {
|
|
|
86
96
|
/**
|
|
87
97
|
* Turn images into Next.js Image compatible usage.
|
|
88
98
|
*/
|
|
89
|
-
declare function remarkImage({ placeholder, external, useImport, publicDir, }?: RemarkImageOptions): Transformer<Root$1, Root$1>;
|
|
99
|
+
declare function remarkImage({ placeholder, external, useImport, onError, publicDir, }?: RemarkImageOptions): Transformer<Root$1, Root$1>;
|
|
90
100
|
|
|
91
101
|
interface RemarkAdmonitionOptions {
|
|
92
102
|
tag?: string;
|
|
@@ -313,6 +313,7 @@ function remarkImage({
|
|
|
313
313
|
placeholder = "blur",
|
|
314
314
|
external = true,
|
|
315
315
|
useImport = true,
|
|
316
|
+
onError = "error",
|
|
316
317
|
publicDir = path.join(process.cwd(), "public")
|
|
317
318
|
} = {}) {
|
|
318
319
|
return async (tree, file) => {
|
|
@@ -358,15 +359,29 @@ function remarkImage({
|
|
|
358
359
|
name: "height",
|
|
359
360
|
value: size.height.toString()
|
|
360
361
|
}
|
|
361
|
-
]
|
|
362
|
+
],
|
|
363
|
+
children: []
|
|
362
364
|
});
|
|
363
365
|
}).catch((e) => {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
if (onError === "hide") {
|
|
367
|
+
Object.assign(node, {
|
|
368
|
+
type: "mdxJsxFlowElement",
|
|
369
|
+
name: null,
|
|
370
|
+
attributes: [],
|
|
371
|
+
children: []
|
|
372
|
+
});
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
if (onError === "ignore") return;
|
|
376
|
+
if (onError === "error") {
|
|
377
|
+
throw new Error(
|
|
378
|
+
`[Remark Image] Failed obtain image size for ${url} (public directory configured as ${publicDir})`,
|
|
379
|
+
{
|
|
380
|
+
cause: e
|
|
381
|
+
}
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
onError(e);
|
|
370
385
|
});
|
|
371
386
|
promises.push(task);
|
|
372
387
|
} else if (!isExternal) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.6.
|
|
3
|
+
"version": "15.6.5",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
],
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@formatjs/intl-localematcher": "^0.6.1",
|
|
89
|
-
"@orama/orama": "^3.1.
|
|
90
|
-
"@shikijs/rehype": "^3.
|
|
91
|
-
"@shikijs/transformers": "^3.
|
|
89
|
+
"@orama/orama": "^3.1.11",
|
|
90
|
+
"@shikijs/rehype": "^3.8.1",
|
|
91
|
+
"@shikijs/transformers": "^3.8.1",
|
|
92
92
|
"github-slugger": "^2.0.0",
|
|
93
93
|
"hast-util-to-estree": "^3.1.3",
|
|
94
94
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
@@ -100,25 +100,25 @@
|
|
|
100
100
|
"remark-gfm": "^4.0.1",
|
|
101
101
|
"remark-rehype": "^11.1.2",
|
|
102
102
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
103
|
-
"shiki": "^3.
|
|
103
|
+
"shiki": "^3.8.1",
|
|
104
104
|
"unist-util-visit": "^5.0.0"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@mdx-js/mdx": "^3.1.0",
|
|
108
108
|
"@oramacloud/client": "^2.1.4",
|
|
109
|
-
"@tanstack/react-router": "^1.
|
|
109
|
+
"@tanstack/react-router": "^1.128.8",
|
|
110
110
|
"@types/estree-jsx": "^1.0.5",
|
|
111
111
|
"@types/hast": "^3.0.4",
|
|
112
112
|
"@types/mdast": "^4.0.3",
|
|
113
113
|
"@types/negotiator": "^0.6.4",
|
|
114
|
-
"@types/node": "24.0.
|
|
114
|
+
"@types/node": "24.0.15",
|
|
115
115
|
"@types/react": "^19.1.8",
|
|
116
116
|
"@types/react-dom": "^19.1.6",
|
|
117
|
-
"algoliasearch": "5.
|
|
117
|
+
"algoliasearch": "5.34.0",
|
|
118
118
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
119
119
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
120
|
-
"next": "^15.
|
|
121
|
-
"react-router": "^7.
|
|
120
|
+
"next": "^15.4.2",
|
|
121
|
+
"react-router": "^7.7.0",
|
|
122
122
|
"remark-mdx": "^3.1.0",
|
|
123
123
|
"typescript": "^5.8.3",
|
|
124
124
|
"unified": "^11.0.5",
|