@rspress/shared 2.0.12 → 2.0.14
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 +40 -4
- package/dist/index.js +1 -1
- package/dist/node-utils.d.ts +40 -4
- package/dist/rslib-runtime.js +9 -5
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -156,6 +156,7 @@ export declare interface I18nText {
|
|
|
156
156
|
'overview.filterPlaceholderText'?: I18nTextValue;
|
|
157
157
|
'overview.filterNoResultText'?: I18nTextValue;
|
|
158
158
|
codeButtonGroupCopyButtonText?: I18nTextValue;
|
|
159
|
+
codeButtonGroupWrapButtonText?: I18nTextValue;
|
|
159
160
|
notFoundText?: I18nTextValue;
|
|
160
161
|
takeMeHomeText?: I18nTextValue;
|
|
161
162
|
promptCopyText?: I18nTextValue;
|
|
@@ -256,10 +257,25 @@ export declare type LocalSearchOptions = SearchHooks & {
|
|
|
256
257
|
};
|
|
257
258
|
|
|
258
259
|
export declare interface MarkdownOptions {
|
|
260
|
+
/**
|
|
261
|
+
* @default []
|
|
262
|
+
*/
|
|
259
263
|
remarkPlugins?: PluggableList;
|
|
264
|
+
/**
|
|
265
|
+
* @default []
|
|
266
|
+
*/
|
|
260
267
|
rehypePlugins?: PluggableList;
|
|
268
|
+
/**
|
|
269
|
+
* @default { checkDeadLinks: true, autoPrefix: true }
|
|
270
|
+
*/
|
|
261
271
|
link?: RemarkLinkOptions;
|
|
272
|
+
/**
|
|
273
|
+
* @default { checkDeadImages: true }
|
|
274
|
+
*/
|
|
262
275
|
image?: RemarkImageOptions;
|
|
276
|
+
/**
|
|
277
|
+
* @default false
|
|
278
|
+
*/
|
|
263
279
|
showLineNumbers?: boolean;
|
|
264
280
|
/**
|
|
265
281
|
* Whether to wrap code by default
|
|
@@ -284,6 +300,7 @@ export declare interface MarkdownOptions {
|
|
|
284
300
|
};
|
|
285
301
|
/**
|
|
286
302
|
* Register global components in mdx files
|
|
303
|
+
* @default []
|
|
287
304
|
*/
|
|
288
305
|
globalComponents?: string[];
|
|
289
306
|
/**
|
|
@@ -547,7 +564,7 @@ export declare interface RouteMeta {
|
|
|
547
564
|
export declare interface RouteOptions {
|
|
548
565
|
/**
|
|
549
566
|
* The extension name of the filepath that will be converted to a route
|
|
550
|
-
* @default ['js','jsx','ts','tsx','md','mdx']
|
|
567
|
+
* @default ['.js', '.jsx', '.ts', '.tsx', '.md', '.mdx']
|
|
551
568
|
*/
|
|
552
569
|
extensions?: string[];
|
|
553
570
|
/**
|
|
@@ -735,7 +752,14 @@ export declare function slash(str: string): string;
|
|
|
735
752
|
|
|
736
753
|
export declare interface SocialLink {
|
|
737
754
|
icon: SocialLinkIcon;
|
|
738
|
-
mode: 'link' | 'text' | 'img' | 'dom';
|
|
755
|
+
mode: 'link' | 'text' | 'img' | 'dom' | 'github-stars';
|
|
756
|
+
/**
|
|
757
|
+
* For most modes, the URL, text, image path, or raw HTML to render.
|
|
758
|
+
*
|
|
759
|
+
* For `github-stars` mode, the GitHub repository URL
|
|
760
|
+
* (e.g. `https://github.com/web-infra-dev/rspress`). The repository's star
|
|
761
|
+
* count is fetched from the GitHub API and rendered next to the icon.
|
|
762
|
+
*/
|
|
739
763
|
content: string;
|
|
740
764
|
}
|
|
741
765
|
|
|
@@ -751,6 +775,7 @@ declare type ThemeConfig = {
|
|
|
751
775
|
darkMode?: boolean;
|
|
752
776
|
/**
|
|
753
777
|
* The nav items. When it's an object, the key is the version of current doc.
|
|
778
|
+
* @default []
|
|
754
779
|
*/
|
|
755
780
|
nav?: NavItem[] | {
|
|
756
781
|
[key: string]: NavItem[];
|
|
@@ -772,6 +797,7 @@ declare type ThemeConfig = {
|
|
|
772
797
|
/**
|
|
773
798
|
* The social links to be displayed at the end of the nav bar. Perfect for
|
|
774
799
|
* placing links to social services such as GitHub, X, Facebook, etc.
|
|
800
|
+
* @default []
|
|
775
801
|
*/
|
|
776
802
|
socialLinks?: SocialLink[];
|
|
777
803
|
/**
|
|
@@ -789,7 +815,7 @@ declare type ThemeConfig = {
|
|
|
789
815
|
/**
|
|
790
816
|
* The behavior of hiding navbar
|
|
791
817
|
* Currently, Rspress V2 does not implement `hideNavBar`
|
|
792
|
-
* @default 'never'
|
|
818
|
+
* @default 'never'
|
|
793
819
|
*/
|
|
794
820
|
hideNavbar?: 'always' | 'auto' | 'never';
|
|
795
821
|
/**
|
|
@@ -836,6 +862,7 @@ export declare interface UserConfig {
|
|
|
836
862
|
root?: string;
|
|
837
863
|
/**
|
|
838
864
|
* Path to the logo file in nav bar.
|
|
865
|
+
* @default ''
|
|
839
866
|
*/
|
|
840
867
|
logo?: string | {
|
|
841
868
|
dark: string;
|
|
@@ -858,6 +885,7 @@ export declare interface UserConfig {
|
|
|
858
885
|
base?: string;
|
|
859
886
|
/**
|
|
860
887
|
* Path to html icon file.
|
|
888
|
+
* @default ''
|
|
861
889
|
*/
|
|
862
890
|
icon?: string | URL;
|
|
863
891
|
/**
|
|
@@ -885,11 +913,12 @@ export declare interface UserConfig {
|
|
|
885
913
|
locales?: Locale[];
|
|
886
914
|
/**
|
|
887
915
|
* The i18n text data source path. Default is `i18n.json` in cwd.
|
|
888
|
-
* @default '
|
|
916
|
+
* @default path.join(process.cwd(), 'i18n.json')
|
|
889
917
|
*/
|
|
890
918
|
i18nSourcePath?: string;
|
|
891
919
|
/**
|
|
892
920
|
* The i18n text data.
|
|
921
|
+
* @default {}
|
|
893
922
|
*/
|
|
894
923
|
i18nSource?: (I18nText & Record<string, Record<string, string>>) | ((value: Record<string, Record<string, string>>) => Record<string, Record<string, string>> | Promise<Record<string, Record<string, string>>>);
|
|
895
924
|
/**
|
|
@@ -914,18 +943,22 @@ export declare interface UserConfig {
|
|
|
914
943
|
plugins?: RspressPlugin[];
|
|
915
944
|
/**
|
|
916
945
|
* Replace rule, will replace the content of the page.
|
|
946
|
+
* @default []
|
|
917
947
|
*/
|
|
918
948
|
replaceRules?: ReplaceRule[];
|
|
919
949
|
/**
|
|
920
950
|
* Output directory
|
|
951
|
+
* @default 'doc_build'
|
|
921
952
|
*/
|
|
922
953
|
outDir?: string;
|
|
923
954
|
/**
|
|
924
955
|
* User side custom theme directory
|
|
956
|
+
* @default path.join(process.cwd(), 'theme')
|
|
925
957
|
*/
|
|
926
958
|
themeDir?: string;
|
|
927
959
|
/**
|
|
928
960
|
* Global components
|
|
961
|
+
* @default []
|
|
929
962
|
*/
|
|
930
963
|
globalUIComponents?: (string | [string, object])[];
|
|
931
964
|
/**
|
|
@@ -990,14 +1023,17 @@ export declare interface UserConfig {
|
|
|
990
1023
|
languageParity?: {
|
|
991
1024
|
/**
|
|
992
1025
|
* Whether to enable language parity checking
|
|
1026
|
+
* @default false
|
|
993
1027
|
*/
|
|
994
1028
|
enabled?: boolean;
|
|
995
1029
|
/**
|
|
996
1030
|
* Directories to include in the parity check
|
|
1031
|
+
* @default []
|
|
997
1032
|
*/
|
|
998
1033
|
include?: string[];
|
|
999
1034
|
/**
|
|
1000
1035
|
* Directories to exclude from the parity check
|
|
1036
|
+
* @default []
|
|
1001
1037
|
*/
|
|
1002
1038
|
exclude?: string[];
|
|
1003
1039
|
};
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ function normalizePosixPath(id) {
|
|
|
35
35
|
if (isAbsolutePath) normalizedPath = `/${normalizedPath}`;
|
|
36
36
|
return normalizedPath;
|
|
37
37
|
}
|
|
38
|
-
const inBrowser = ()
|
|
38
|
+
const inBrowser = ()=>false;
|
|
39
39
|
function addLeadingSlash(url) {
|
|
40
40
|
return '/' === url.charAt(0) || isExternalUrl(url) ? url : `/${url}`;
|
|
41
41
|
}
|
package/dist/node-utils.d.ts
CHANGED
|
@@ -159,6 +159,7 @@ declare interface I18nText {
|
|
|
159
159
|
'overview.filterPlaceholderText'?: I18nTextValue;
|
|
160
160
|
'overview.filterNoResultText'?: I18nTextValue;
|
|
161
161
|
codeButtonGroupCopyButtonText?: I18nTextValue;
|
|
162
|
+
codeButtonGroupWrapButtonText?: I18nTextValue;
|
|
162
163
|
notFoundText?: I18nTextValue;
|
|
163
164
|
takeMeHomeText?: I18nTextValue;
|
|
164
165
|
promptCopyText?: I18nTextValue;
|
|
@@ -253,10 +254,25 @@ declare type LocalSearchOptions = SearchHooks & {
|
|
|
253
254
|
};
|
|
254
255
|
|
|
255
256
|
declare interface MarkdownOptions {
|
|
257
|
+
/**
|
|
258
|
+
* @default []
|
|
259
|
+
*/
|
|
256
260
|
remarkPlugins?: PluggableList;
|
|
261
|
+
/**
|
|
262
|
+
* @default []
|
|
263
|
+
*/
|
|
257
264
|
rehypePlugins?: PluggableList;
|
|
265
|
+
/**
|
|
266
|
+
* @default { checkDeadLinks: true, autoPrefix: true }
|
|
267
|
+
*/
|
|
258
268
|
link?: RemarkLinkOptions;
|
|
269
|
+
/**
|
|
270
|
+
* @default { checkDeadImages: true }
|
|
271
|
+
*/
|
|
259
272
|
image?: RemarkImageOptions;
|
|
273
|
+
/**
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
260
276
|
showLineNumbers?: boolean;
|
|
261
277
|
/**
|
|
262
278
|
* Whether to wrap code by default
|
|
@@ -281,6 +297,7 @@ declare interface MarkdownOptions {
|
|
|
281
297
|
};
|
|
282
298
|
/**
|
|
283
299
|
* Register global components in mdx files
|
|
300
|
+
* @default []
|
|
284
301
|
*/
|
|
285
302
|
globalComponents?: string[];
|
|
286
303
|
/**
|
|
@@ -433,7 +450,7 @@ declare interface RouteMeta {
|
|
|
433
450
|
declare interface RouteOptions {
|
|
434
451
|
/**
|
|
435
452
|
* The extension name of the filepath that will be converted to a route
|
|
436
|
-
* @default ['js','jsx','ts','tsx','md','mdx']
|
|
453
|
+
* @default ['.js', '.jsx', '.ts', '.tsx', '.md', '.mdx']
|
|
437
454
|
*/
|
|
438
455
|
extensions?: string[];
|
|
439
456
|
/**
|
|
@@ -581,7 +598,14 @@ declare type SidebarSectionHeader = {
|
|
|
581
598
|
|
|
582
599
|
declare interface SocialLink {
|
|
583
600
|
icon: SocialLinkIcon;
|
|
584
|
-
mode: 'link' | 'text' | 'img' | 'dom';
|
|
601
|
+
mode: 'link' | 'text' | 'img' | 'dom' | 'github-stars';
|
|
602
|
+
/**
|
|
603
|
+
* For most modes, the URL, text, image path, or raw HTML to render.
|
|
604
|
+
*
|
|
605
|
+
* For `github-stars` mode, the GitHub repository URL
|
|
606
|
+
* (e.g. `https://github.com/web-infra-dev/rspress`). The repository's star
|
|
607
|
+
* count is fetched from the GitHub API and rendered next to the icon.
|
|
608
|
+
*/
|
|
585
609
|
content: string;
|
|
586
610
|
}
|
|
587
611
|
|
|
@@ -597,6 +621,7 @@ declare type ThemeConfig = {
|
|
|
597
621
|
darkMode?: boolean;
|
|
598
622
|
/**
|
|
599
623
|
* The nav items. When it's an object, the key is the version of current doc.
|
|
624
|
+
* @default []
|
|
600
625
|
*/
|
|
601
626
|
nav?: NavItem[] | {
|
|
602
627
|
[key: string]: NavItem[];
|
|
@@ -618,6 +643,7 @@ declare type ThemeConfig = {
|
|
|
618
643
|
/**
|
|
619
644
|
* The social links to be displayed at the end of the nav bar. Perfect for
|
|
620
645
|
* placing links to social services such as GitHub, X, Facebook, etc.
|
|
646
|
+
* @default []
|
|
621
647
|
*/
|
|
622
648
|
socialLinks?: SocialLink[];
|
|
623
649
|
/**
|
|
@@ -635,7 +661,7 @@ declare type ThemeConfig = {
|
|
|
635
661
|
/**
|
|
636
662
|
* The behavior of hiding navbar
|
|
637
663
|
* Currently, Rspress V2 does not implement `hideNavBar`
|
|
638
|
-
* @default 'never'
|
|
664
|
+
* @default 'never'
|
|
639
665
|
*/
|
|
640
666
|
hideNavbar?: 'always' | 'auto' | 'never';
|
|
641
667
|
/**
|
|
@@ -680,6 +706,7 @@ declare interface UserConfig {
|
|
|
680
706
|
root?: string;
|
|
681
707
|
/**
|
|
682
708
|
* Path to the logo file in nav bar.
|
|
709
|
+
* @default ''
|
|
683
710
|
*/
|
|
684
711
|
logo?: string | {
|
|
685
712
|
dark: string;
|
|
@@ -702,6 +729,7 @@ declare interface UserConfig {
|
|
|
702
729
|
base?: string;
|
|
703
730
|
/**
|
|
704
731
|
* Path to html icon file.
|
|
732
|
+
* @default ''
|
|
705
733
|
*/
|
|
706
734
|
icon?: string | URL;
|
|
707
735
|
/**
|
|
@@ -729,11 +757,12 @@ declare interface UserConfig {
|
|
|
729
757
|
locales?: Locale[];
|
|
730
758
|
/**
|
|
731
759
|
* The i18n text data source path. Default is `i18n.json` in cwd.
|
|
732
|
-
* @default '
|
|
760
|
+
* @default path.join(process.cwd(), 'i18n.json')
|
|
733
761
|
*/
|
|
734
762
|
i18nSourcePath?: string;
|
|
735
763
|
/**
|
|
736
764
|
* The i18n text data.
|
|
765
|
+
* @default {}
|
|
737
766
|
*/
|
|
738
767
|
i18nSource?: (I18nText & Record<string, Record<string, string>>) | ((value: Record<string, Record<string, string>>) => Record<string, Record<string, string>> | Promise<Record<string, Record<string, string>>>);
|
|
739
768
|
/**
|
|
@@ -758,18 +787,22 @@ declare interface UserConfig {
|
|
|
758
787
|
plugins?: RspressPlugin[];
|
|
759
788
|
/**
|
|
760
789
|
* Replace rule, will replace the content of the page.
|
|
790
|
+
* @default []
|
|
761
791
|
*/
|
|
762
792
|
replaceRules?: ReplaceRule[];
|
|
763
793
|
/**
|
|
764
794
|
* Output directory
|
|
795
|
+
* @default 'doc_build'
|
|
765
796
|
*/
|
|
766
797
|
outDir?: string;
|
|
767
798
|
/**
|
|
768
799
|
* User side custom theme directory
|
|
800
|
+
* @default path.join(process.cwd(), 'theme')
|
|
769
801
|
*/
|
|
770
802
|
themeDir?: string;
|
|
771
803
|
/**
|
|
772
804
|
* Global components
|
|
805
|
+
* @default []
|
|
773
806
|
*/
|
|
774
807
|
globalUIComponents?: (string | [string, object])[];
|
|
775
808
|
/**
|
|
@@ -834,14 +867,17 @@ declare interface UserConfig {
|
|
|
834
867
|
languageParity?: {
|
|
835
868
|
/**
|
|
836
869
|
* Whether to enable language parity checking
|
|
870
|
+
* @default false
|
|
837
871
|
*/
|
|
838
872
|
enabled?: boolean;
|
|
839
873
|
/**
|
|
840
874
|
* Directories to include in the parity check
|
|
875
|
+
* @default []
|
|
841
876
|
*/
|
|
842
877
|
include?: string[];
|
|
843
878
|
/**
|
|
844
879
|
* Directories to exclude from the parity check
|
|
880
|
+
* @default []
|
|
845
881
|
*/
|
|
846
882
|
exclude?: string[];
|
|
847
883
|
};
|
package/dist/rslib-runtime.js
CHANGED
|
@@ -20,11 +20,15 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
20
20
|
};
|
|
21
21
|
})();
|
|
22
22
|
(()=>{
|
|
23
|
-
__webpack_require__.d = (exports,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
__webpack_require__.d = (exports, getters, values)=>{
|
|
24
|
+
var define = (defs, kind)=>{
|
|
25
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
[kind]: defs[key]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
define(getters, "get");
|
|
31
|
+
define(values, "value");
|
|
28
32
|
};
|
|
29
33
|
})();
|
|
30
34
|
(()=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/shared",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/web-infra-dev/rspress.git",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"dist"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@rsbuild/core": "^2.0.
|
|
47
|
+
"@rsbuild/core": "^2.0.9",
|
|
48
48
|
"@shikijs/rehype": "^4.0.2",
|
|
49
49
|
"unified": "^11.0.5"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@rslib/core": "0.
|
|
52
|
+
"@rslib/core": "0.22.0",
|
|
53
53
|
"@types/lodash-es": "^4.17.12",
|
|
54
54
|
"@types/node": "^22.8.1",
|
|
55
|
-
"@types/react": "^19.2.
|
|
55
|
+
"@types/react": "^19.2.15",
|
|
56
56
|
"github-slugger": "^2.0.0",
|
|
57
57
|
"gray-matter": "4.0.3",
|
|
58
58
|
"lodash-es": "^4.18.1",
|