@rspress/shared 2.0.0-beta.11 → 2.0.0-beta.13
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.ts +5 -0
- package/dist/logger.js +2 -3
- package/dist/node-utils.d.ts +5 -0
- package/dist/node-utils.js +9 -9
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
@@ -356,6 +356,11 @@ export declare interface MarkdownOptions {
|
|
356
356
|
* @type import('@shikijs/rehype').RehypeShikiOptions
|
357
357
|
*/
|
358
358
|
shiki?: Partial<PluginShikiOptions>;
|
359
|
+
/**
|
360
|
+
* Speed up build time by caching mdx parsing result in `rspress build`
|
361
|
+
* @default true
|
362
|
+
*/
|
363
|
+
crossCompilerCache?: boolean;
|
359
364
|
}
|
360
365
|
|
361
366
|
export declare const matchNavbar: (item: NavItemWithLink, currentPathname: string, base: string) => boolean;
|
package/dist/logger.js
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
export { __webpack_exports__logger as logger };
|
1
|
+
import { logger } from "@rsbuild/core";
|
2
|
+
export { logger };
|
package/dist/node-utils.d.ts
CHANGED
@@ -331,6 +331,11 @@ declare interface MarkdownOptions {
|
|
331
331
|
* @type import('@shikijs/rehype').RehypeShikiOptions
|
332
332
|
*/
|
333
333
|
shiki?: Partial<PluginShikiOptions>;
|
334
|
+
/**
|
335
|
+
* Speed up build time by caching mdx parsing result in `rspress build`
|
336
|
+
* @default true
|
337
|
+
*/
|
338
|
+
crossCompilerCache?: boolean;
|
334
339
|
}
|
335
340
|
|
336
341
|
export declare const mergeDocConfig: (...configs: UserConfig[]) => Promise<UserConfig>;
|
package/dist/node-utils.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
1
|
+
import external_node_path_default from "node:path";
|
2
|
+
import { fileURLToPath } from "node:url";
|
3
|
+
import external_gray_matter_default from "gray-matter";
|
4
|
+
import { logger } from "@rsbuild/core";
|
5
5
|
const extractTextAndId = (title)=>{
|
6
6
|
if (!title) return [
|
7
7
|
'',
|
@@ -18,9 +18,9 @@ const extractTextAndId = (title)=>{
|
|
18
18
|
function getIconUrlPath(icon) {
|
19
19
|
if (!icon) return;
|
20
20
|
icon = icon.toString();
|
21
|
-
if (icon.startsWith('file://')) icon =
|
22
|
-
if (!
|
23
|
-
return `/${
|
21
|
+
if (icon.startsWith('file://')) icon = fileURLToPath(icon);
|
22
|
+
if (!external_node_path_default.isAbsolute(icon)) return icon;
|
23
|
+
return `/${external_node_path_default.basename(icon)}`;
|
24
24
|
}
|
25
25
|
function getNodeAttribute(node, attrName, attribute) {
|
26
26
|
const found = node.attributes.find((attr)=>'name' in attr && attr.name === attrName);
|
@@ -28,7 +28,7 @@ function getNodeAttribute(node, attrName, attribute) {
|
|
28
28
|
}
|
29
29
|
function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
30
30
|
try {
|
31
|
-
const { content, data } = (
|
31
|
+
const { content, data } = external_gray_matter_default(source);
|
32
32
|
const rawFrontMatter = source.slice(0, source.length - content.length);
|
33
33
|
const emptyLinesSource = rawFrontMatter.length ? `${rawFrontMatter.replace(/[^\n]/g, '')}${content}` : content;
|
34
34
|
return {
|
@@ -37,7 +37,7 @@ function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
|
37
37
|
emptyLinesSource
|
38
38
|
};
|
39
39
|
} catch (e) {
|
40
|
-
if (outputWarning)
|
40
|
+
if (outputWarning) logger.warn(`Parse frontmatter error in ${external_node_path_default.relative(root, filepath)}: \n`, e);
|
41
41
|
}
|
42
42
|
return {
|
43
43
|
content: '',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/shared",
|
3
|
-
"version": "2.0.0-beta.
|
3
|
+
"version": "2.0.0-beta.13",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/web-infra-dev/rspress.git",
|
@@ -32,14 +32,14 @@
|
|
32
32
|
"dist"
|
33
33
|
],
|
34
34
|
"dependencies": {
|
35
|
-
"@rsbuild/core": "~1.3.
|
35
|
+
"@rsbuild/core": "~1.3.22",
|
36
36
|
"@shikijs/rehype": "^3.4.2",
|
37
37
|
"gray-matter": "4.0.3",
|
38
38
|
"lodash-es": "^4.17.21",
|
39
39
|
"unified": "^11.0.5"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
|
-
"@rslib/core": "0.
|
42
|
+
"@rslib/core": "0.9.2",
|
43
43
|
"@types/jest": "~29.5.14",
|
44
44
|
"@types/lodash-es": "^4.17.12",
|
45
45
|
"@types/node": "^22.8.1",
|