@rspress/shared 2.0.13 → 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 CHANGED
@@ -257,10 +257,25 @@ export declare type LocalSearchOptions = SearchHooks & {
257
257
  };
258
258
 
259
259
  export declare interface MarkdownOptions {
260
+ /**
261
+ * @default []
262
+ */
260
263
  remarkPlugins?: PluggableList;
264
+ /**
265
+ * @default []
266
+ */
261
267
  rehypePlugins?: PluggableList;
268
+ /**
269
+ * @default { checkDeadLinks: true, autoPrefix: true }
270
+ */
262
271
  link?: RemarkLinkOptions;
272
+ /**
273
+ * @default { checkDeadImages: true }
274
+ */
263
275
  image?: RemarkImageOptions;
276
+ /**
277
+ * @default false
278
+ */
264
279
  showLineNumbers?: boolean;
265
280
  /**
266
281
  * Whether to wrap code by default
@@ -285,6 +300,7 @@ export declare interface MarkdownOptions {
285
300
  };
286
301
  /**
287
302
  * Register global components in mdx files
303
+ * @default []
288
304
  */
289
305
  globalComponents?: string[];
290
306
  /**
@@ -548,7 +564,7 @@ export declare interface RouteMeta {
548
564
  export declare interface RouteOptions {
549
565
  /**
550
566
  * The extension name of the filepath that will be converted to a route
551
- * @default ['js','jsx','ts','tsx','md','mdx']
567
+ * @default ['.js', '.jsx', '.ts', '.tsx', '.md', '.mdx']
552
568
  */
553
569
  extensions?: string[];
554
570
  /**
@@ -736,7 +752,14 @@ export declare function slash(str: string): string;
736
752
 
737
753
  export declare interface SocialLink {
738
754
  icon: SocialLinkIcon;
739
- 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
+ */
740
763
  content: string;
741
764
  }
742
765
 
@@ -752,6 +775,7 @@ declare type ThemeConfig = {
752
775
  darkMode?: boolean;
753
776
  /**
754
777
  * The nav items. When it's an object, the key is the version of current doc.
778
+ * @default []
755
779
  */
756
780
  nav?: NavItem[] | {
757
781
  [key: string]: NavItem[];
@@ -773,6 +797,7 @@ declare type ThemeConfig = {
773
797
  /**
774
798
  * The social links to be displayed at the end of the nav bar. Perfect for
775
799
  * placing links to social services such as GitHub, X, Facebook, etc.
800
+ * @default []
776
801
  */
777
802
  socialLinks?: SocialLink[];
778
803
  /**
@@ -790,7 +815,7 @@ declare type ThemeConfig = {
790
815
  /**
791
816
  * The behavior of hiding navbar
792
817
  * Currently, Rspress V2 does not implement `hideNavBar`
793
- * @default 'never''
818
+ * @default 'never'
794
819
  */
795
820
  hideNavbar?: 'always' | 'auto' | 'never';
796
821
  /**
@@ -837,6 +862,7 @@ export declare interface UserConfig {
837
862
  root?: string;
838
863
  /**
839
864
  * Path to the logo file in nav bar.
865
+ * @default ''
840
866
  */
841
867
  logo?: string | {
842
868
  dark: string;
@@ -859,6 +885,7 @@ export declare interface UserConfig {
859
885
  base?: string;
860
886
  /**
861
887
  * Path to html icon file.
888
+ * @default ''
862
889
  */
863
890
  icon?: string | URL;
864
891
  /**
@@ -886,11 +913,12 @@ export declare interface UserConfig {
886
913
  locales?: Locale[];
887
914
  /**
888
915
  * The i18n text data source path. Default is `i18n.json` in cwd.
889
- * @default '<cwd>/i18n.json'
916
+ * @default path.join(process.cwd(), 'i18n.json')
890
917
  */
891
918
  i18nSourcePath?: string;
892
919
  /**
893
920
  * The i18n text data.
921
+ * @default {}
894
922
  */
895
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>>>);
896
924
  /**
@@ -915,18 +943,22 @@ export declare interface UserConfig {
915
943
  plugins?: RspressPlugin[];
916
944
  /**
917
945
  * Replace rule, will replace the content of the page.
946
+ * @default []
918
947
  */
919
948
  replaceRules?: ReplaceRule[];
920
949
  /**
921
950
  * Output directory
951
+ * @default 'doc_build'
922
952
  */
923
953
  outDir?: string;
924
954
  /**
925
955
  * User side custom theme directory
956
+ * @default path.join(process.cwd(), 'theme')
926
957
  */
927
958
  themeDir?: string;
928
959
  /**
929
960
  * Global components
961
+ * @default []
930
962
  */
931
963
  globalUIComponents?: (string | [string, object])[];
932
964
  /**
@@ -991,14 +1023,17 @@ export declare interface UserConfig {
991
1023
  languageParity?: {
992
1024
  /**
993
1025
  * Whether to enable language parity checking
1026
+ * @default false
994
1027
  */
995
1028
  enabled?: boolean;
996
1029
  /**
997
1030
  * Directories to include in the parity check
1031
+ * @default []
998
1032
  */
999
1033
  include?: string[];
1000
1034
  /**
1001
1035
  * Directories to exclude from the parity check
1036
+ * @default []
1002
1037
  */
1003
1038
  exclude?: string[];
1004
1039
  };
@@ -254,10 +254,25 @@ declare type LocalSearchOptions = SearchHooks & {
254
254
  };
255
255
 
256
256
  declare interface MarkdownOptions {
257
+ /**
258
+ * @default []
259
+ */
257
260
  remarkPlugins?: PluggableList;
261
+ /**
262
+ * @default []
263
+ */
258
264
  rehypePlugins?: PluggableList;
265
+ /**
266
+ * @default { checkDeadLinks: true, autoPrefix: true }
267
+ */
259
268
  link?: RemarkLinkOptions;
269
+ /**
270
+ * @default { checkDeadImages: true }
271
+ */
260
272
  image?: RemarkImageOptions;
273
+ /**
274
+ * @default false
275
+ */
261
276
  showLineNumbers?: boolean;
262
277
  /**
263
278
  * Whether to wrap code by default
@@ -282,6 +297,7 @@ declare interface MarkdownOptions {
282
297
  };
283
298
  /**
284
299
  * Register global components in mdx files
300
+ * @default []
285
301
  */
286
302
  globalComponents?: string[];
287
303
  /**
@@ -434,7 +450,7 @@ declare interface RouteMeta {
434
450
  declare interface RouteOptions {
435
451
  /**
436
452
  * The extension name of the filepath that will be converted to a route
437
- * @default ['js','jsx','ts','tsx','md','mdx']
453
+ * @default ['.js', '.jsx', '.ts', '.tsx', '.md', '.mdx']
438
454
  */
439
455
  extensions?: string[];
440
456
  /**
@@ -582,7 +598,14 @@ declare type SidebarSectionHeader = {
582
598
 
583
599
  declare interface SocialLink {
584
600
  icon: SocialLinkIcon;
585
- 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
+ */
586
609
  content: string;
587
610
  }
588
611
 
@@ -598,6 +621,7 @@ declare type ThemeConfig = {
598
621
  darkMode?: boolean;
599
622
  /**
600
623
  * The nav items. When it's an object, the key is the version of current doc.
624
+ * @default []
601
625
  */
602
626
  nav?: NavItem[] | {
603
627
  [key: string]: NavItem[];
@@ -619,6 +643,7 @@ declare type ThemeConfig = {
619
643
  /**
620
644
  * The social links to be displayed at the end of the nav bar. Perfect for
621
645
  * placing links to social services such as GitHub, X, Facebook, etc.
646
+ * @default []
622
647
  */
623
648
  socialLinks?: SocialLink[];
624
649
  /**
@@ -636,7 +661,7 @@ declare type ThemeConfig = {
636
661
  /**
637
662
  * The behavior of hiding navbar
638
663
  * Currently, Rspress V2 does not implement `hideNavBar`
639
- * @default 'never''
664
+ * @default 'never'
640
665
  */
641
666
  hideNavbar?: 'always' | 'auto' | 'never';
642
667
  /**
@@ -681,6 +706,7 @@ declare interface UserConfig {
681
706
  root?: string;
682
707
  /**
683
708
  * Path to the logo file in nav bar.
709
+ * @default ''
684
710
  */
685
711
  logo?: string | {
686
712
  dark: string;
@@ -703,6 +729,7 @@ declare interface UserConfig {
703
729
  base?: string;
704
730
  /**
705
731
  * Path to html icon file.
732
+ * @default ''
706
733
  */
707
734
  icon?: string | URL;
708
735
  /**
@@ -730,11 +757,12 @@ declare interface UserConfig {
730
757
  locales?: Locale[];
731
758
  /**
732
759
  * The i18n text data source path. Default is `i18n.json` in cwd.
733
- * @default '<cwd>/i18n.json'
760
+ * @default path.join(process.cwd(), 'i18n.json')
734
761
  */
735
762
  i18nSourcePath?: string;
736
763
  /**
737
764
  * The i18n text data.
765
+ * @default {}
738
766
  */
739
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>>>);
740
768
  /**
@@ -759,18 +787,22 @@ declare interface UserConfig {
759
787
  plugins?: RspressPlugin[];
760
788
  /**
761
789
  * Replace rule, will replace the content of the page.
790
+ * @default []
762
791
  */
763
792
  replaceRules?: ReplaceRule[];
764
793
  /**
765
794
  * Output directory
795
+ * @default 'doc_build'
766
796
  */
767
797
  outDir?: string;
768
798
  /**
769
799
  * User side custom theme directory
800
+ * @default path.join(process.cwd(), 'theme')
770
801
  */
771
802
  themeDir?: string;
772
803
  /**
773
804
  * Global components
805
+ * @default []
774
806
  */
775
807
  globalUIComponents?: (string | [string, object])[];
776
808
  /**
@@ -835,14 +867,17 @@ declare interface UserConfig {
835
867
  languageParity?: {
836
868
  /**
837
869
  * Whether to enable language parity checking
870
+ * @default false
838
871
  */
839
872
  enabled?: boolean;
840
873
  /**
841
874
  * Directories to include in the parity check
875
+ * @default []
842
876
  */
843
877
  include?: string[];
844
878
  /**
845
879
  * Directories to exclude from the parity check
880
+ * @default []
846
881
  */
847
882
  exclude?: string[];
848
883
  };
@@ -20,11 +20,15 @@ __webpack_require__.m = __webpack_modules__;
20
20
  };
21
21
  })();
22
22
  (()=>{
23
- __webpack_require__.d = (exports, definition)=>{
24
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
25
- enumerable: true,
26
- get: definition[key]
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.13",
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,12 +44,12 @@
44
44
  "dist"
45
45
  ],
46
46
  "dependencies": {
47
- "@rsbuild/core": "^2.0.7",
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.21.5",
52
+ "@rslib/core": "0.22.0",
53
53
  "@types/lodash-es": "^4.17.12",
54
54
  "@types/node": "^22.8.1",
55
55
  "@types/react": "^19.2.15",