@rspress/shared 1.23.0 → 1.24.0
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 +6 -1
- package/dist/node-utils.d.ts +2 -2
- package/dist/node-utils.js +5 -6
- package/dist/node-utils.mjs +3 -4
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
@@ -309,6 +309,7 @@ interface SidebarGroup {
|
|
309
309
|
*/
|
310
310
|
_fileKey?: string;
|
311
311
|
overviewHeaders?: number[];
|
312
|
+
context?: string;
|
312
313
|
}
|
313
314
|
type SidebarItem = {
|
314
315
|
text: string;
|
@@ -319,6 +320,7 @@ type SidebarItem = {
|
|
319
320
|
*/
|
320
321
|
_fileKey?: string;
|
321
322
|
overviewHeaders?: number[];
|
323
|
+
context?: string;
|
322
324
|
};
|
323
325
|
type SidebarDivider = {
|
324
326
|
dividerType: 'dashed' | 'solid';
|
@@ -454,7 +456,7 @@ interface UserConfig<ThemeConfig = Config$1> {
|
|
454
456
|
/**
|
455
457
|
* Head tags.
|
456
458
|
*/
|
457
|
-
head?: string[];
|
459
|
+
head?: (string | [string, Record<string, string>] | ((route: RouteMeta) => string | [string, Record<string, string>] | undefined))[];
|
458
460
|
/**
|
459
461
|
* I18n config of the site.
|
460
462
|
*/
|
@@ -638,6 +640,9 @@ interface FrontMatterMeta {
|
|
638
640
|
lineNumbers?: boolean;
|
639
641
|
overviewHeaders?: number;
|
640
642
|
titleSuffix?: string;
|
643
|
+
head?: [string, Record<string, string>][];
|
644
|
+
context?: string;
|
645
|
+
[key: string]: unknown;
|
641
646
|
}
|
642
647
|
interface PageData {
|
643
648
|
siteData: SiteData<Config$1>;
|
package/dist/node-utils.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
declare function loadFrontMatter(source: string, filepath: string, root: string, outputWarning?: boolean): {
|
2
|
-
frontmatter:
|
1
|
+
declare function loadFrontMatter<TFrontmatter extends Record<string, unknown> = Record<string, string>>(source: string, filepath: string, root: string, outputWarning?: boolean): {
|
2
|
+
frontmatter: TFrontmatter;
|
3
3
|
content: string;
|
4
4
|
};
|
5
5
|
|
package/dist/node-utils.js
CHANGED
@@ -35,7 +35,7 @@ __export(node_utils_exports, {
|
|
35
35
|
module.exports = __toCommonJS(node_utils_exports);
|
36
36
|
|
37
37
|
// src/node-utils/loadFrontMatter.ts
|
38
|
-
var
|
38
|
+
var import_node_path = __toESM(require("path"));
|
39
39
|
var import_gray_matter = __toESM(require("gray-matter"));
|
40
40
|
|
41
41
|
// src/logger.ts
|
@@ -43,21 +43,20 @@ var import_core = require("@rsbuild/core");
|
|
43
43
|
|
44
44
|
// src/node-utils/loadFrontMatter.ts
|
45
45
|
function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
46
|
-
let content = "";
|
47
|
-
let frontmatter = {};
|
48
46
|
try {
|
49
|
-
|
47
|
+
const { content, data } = (0, import_gray_matter.default)(source);
|
48
|
+
return { content, frontmatter: data };
|
50
49
|
} catch (e) {
|
51
50
|
if (outputWarning) {
|
52
51
|
import_core.logger.warn(
|
53
|
-
`Parse frontmatter error: ${e.message} in ${
|
52
|
+
`Parse frontmatter error: ${e.message} in ${import_node_path.default.relative(
|
54
53
|
root,
|
55
54
|
filepath
|
56
55
|
)}`
|
57
56
|
);
|
58
57
|
}
|
59
58
|
}
|
60
|
-
return {
|
59
|
+
return { content: "", frontmatter: {} };
|
61
60
|
}
|
62
61
|
// Annotate the CommonJS export names for ESM import in node:
|
63
62
|
0 && (module.exports = {
|
package/dist/node-utils.mjs
CHANGED
@@ -7,10 +7,9 @@ import { logger } from "@rsbuild/core";
|
|
7
7
|
|
8
8
|
// src/node-utils/loadFrontMatter.ts
|
9
9
|
function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
10
|
-
let content = "";
|
11
|
-
let frontmatter = {};
|
12
10
|
try {
|
13
|
-
|
11
|
+
const { content, data } = grayMatter(source);
|
12
|
+
return { content, frontmatter: data };
|
14
13
|
} catch (e) {
|
15
14
|
if (outputWarning) {
|
16
15
|
logger.warn(
|
@@ -21,7 +20,7 @@ function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
|
21
20
|
);
|
22
21
|
}
|
23
22
|
}
|
24
|
-
return {
|
23
|
+
return { content: "", frontmatter: {} };
|
25
24
|
}
|
26
25
|
export {
|
27
26
|
loadFrontMatter
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/shared",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.24.0",
|
4
4
|
"types": "./dist/index.d.ts",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"module": "./dist/index.mjs",
|
@@ -42,15 +42,15 @@
|
|
42
42
|
}
|
43
43
|
},
|
44
44
|
"dependencies": {
|
45
|
-
"@rsbuild/core": "0.7.
|
46
|
-
"unified": "^10.1.2",
|
45
|
+
"@rsbuild/core": "0.7.3",
|
47
46
|
"chalk": "4.1.2",
|
48
47
|
"execa": "5.1.1",
|
49
48
|
"fs-extra": "11.2.0",
|
50
|
-
"gray-matter": "4.0.3"
|
49
|
+
"gray-matter": "4.0.3",
|
50
|
+
"unified": "^10.1.2"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
|
-
"
|
53
|
+
"@types/fs-extra": "11.0.4",
|
54
54
|
"@types/interpret": "^1.1.1",
|
55
55
|
"@types/jest": "~29.5.12",
|
56
56
|
"@types/lodash": "^4.17.0",
|
@@ -58,11 +58,11 @@
|
|
58
58
|
"@types/node": "^18.11.17",
|
59
59
|
"@types/react": "^18",
|
60
60
|
"@types/rechoir": "^0.6.1",
|
61
|
+
"lodash-es": "^4.17.21",
|
62
|
+
"medium-zoom": "1.1.0",
|
61
63
|
"rimraf": "^3.0.2",
|
62
64
|
"ts-node": "^10.9.1",
|
63
|
-
"typescript": "^5"
|
64
|
-
"medium-zoom": "1.1.0",
|
65
|
-
"@types/fs-extra": "11.0.4"
|
65
|
+
"typescript": "^5"
|
66
66
|
},
|
67
67
|
"sideEffects": [],
|
68
68
|
"publishConfig": {
|