@rspress/shared 2.0.23 → 2.1.0-beta.1

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
@@ -22,10 +22,16 @@ export declare function addTrailingSlash(url: string): string;
22
22
 
23
23
  export declare type BaseRuntimePageInfo = Omit<RemoveUnderscoreProps<PageIndexInfo>, 'id' | 'content' | 'domain'>;
24
24
 
25
+ declare type ChangeFreq = 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
26
+
25
27
  export declare const cleanUrl: (url: string) => string;
26
28
 
27
29
  export declare type Config = UserConfig | Promise<UserConfig> | ((...args: Parameters<typeof loadConfig>) => UserConfig | Promise<UserConfig>);
28
30
 
31
+ declare interface CustomMaps {
32
+ [routePath: string]: Sitemap;
33
+ }
34
+
29
35
  export declare type DarkMode = boolean | NormalizedDarkMode;
30
36
 
31
37
  export declare interface EditLink {
@@ -165,6 +171,10 @@ export declare interface I18nText {
165
171
  codeButtonGroupWrapButtonText?: I18nTextValue;
166
172
  notFoundText?: I18nTextValue;
167
173
  takeMeHomeText?: I18nTextValue;
174
+ errorTitleText?: I18nTextValue;
175
+ errorDescriptionText?: I18nTextValue;
176
+ reloadPageText?: I18nTextValue;
177
+ errorDetailsText?: I18nTextValue;
168
178
  promptCopyText?: I18nTextValue;
169
179
  promptCopiedText?: I18nTextValue;
170
180
  promptExpandText?: I18nTextValue;
@@ -567,6 +577,8 @@ export declare const parseUrl: (url: string) => {
567
577
  search: string;
568
578
  };
569
579
 
580
+ declare type Priority = '0.0' | '0.1' | '0.2' | '0.3' | '0.4' | '0.5' | '0.6' | '0.7' | '0.8' | '0.9' | '1.0';
581
+
570
582
  export declare const QUERY_REGEXP: RegExp;
571
583
 
572
584
  export declare type RemarkImageOptions = {
@@ -909,6 +921,20 @@ export declare interface SiteData {
909
921
  };
910
922
  }
911
923
 
924
+ declare interface Sitemap {
925
+ loc: string;
926
+ lastmod?: string;
927
+ changefreq?: ChangeFreq;
928
+ priority?: Priority;
929
+ }
930
+
931
+ export declare interface SitemapOptions {
932
+ siteUrl?: string;
933
+ customMaps?: CustomMaps;
934
+ defaultPriority?: Priority;
935
+ defaultChangeFreq?: ChangeFreq;
936
+ }
937
+
912
938
  export declare function slash(str: string): string;
913
939
 
914
940
  export declare interface SocialLink {
@@ -1054,6 +1080,11 @@ export declare interface UserConfig {
1054
1080
  * Origin of the site, such as `https://example.com`.
1055
1081
  */
1056
1082
  siteOrigin?: string;
1083
+ /**
1084
+ * Generate sitemap.xml during production builds.
1085
+ * @default true
1086
+ */
1087
+ sitemap?: boolean | SitemapOptions;
1057
1088
  /**
1058
1089
  * Path to html icon file.
1059
1090
  * @default ''
@@ -1141,7 +1172,10 @@ export declare interface UserConfig {
1141
1172
  */
1142
1173
  search?: SearchOptions;
1143
1174
  /**
1144
- * Whether to enable ssg
1175
+ * Whether to prerender page content into HTML at build time (SSG).
1176
+ * Set to `false` to generate HTML shells for client-side rendering instead.
1177
+ * This does not disable SSG-MD or llms.txt generation, which are controlled
1178
+ * independently by `llms`.
1145
1179
  * @default true
1146
1180
  */
1147
1181
  ssg?: boolean | {
@@ -1152,14 +1186,18 @@ export declare interface UserConfig {
1152
1186
  experimentalWorker?: boolean;
1153
1187
  /**
1154
1188
  * After enabled, some pages will not be rendered by SSG, and they will directly use html under CSR. This is suitable for SSG errors in large document sites bypassing a small number of pages. It is not recommended to enable this option actively.
1189
+ * Only affects SSG, not SSG-MD. If excluded pages are not SSR-compatible,
1190
+ * fix their SSR compatibility or set `llms: false` to disable SSG-MD.
1155
1191
  * @default []
1156
1192
  */
1157
1193
  experimentalExcludeRoutePaths?: (string | RegExp)[];
1158
1194
  };
1159
1195
  /**
1160
- * Whether to enable llms and ssg-md
1161
- * @default false
1162
- * @experimental
1196
+ * Whether to render pages to Markdown (SSG-MD) and generate llms.txt and
1197
+ * llms-full.txt at build time.
1198
+ * Independent of `ssg`: these files are still generated when `ssg: false`.
1199
+ * Set to `false` to disable these outputs without affecting SSG.
1200
+ * @default true
1163
1201
  */
1164
1202
  llms?: boolean | {
1165
1203
  /**
@@ -1172,6 +1210,15 @@ export declare interface UserConfig {
1172
1210
  */
1173
1211
  remarkSplitMdxOptions?: RemarkSplitMdxOptions;
1174
1212
  };
1213
+ /**
1214
+ * Expose built-in documentation tools through the browser WebMCP API.
1215
+ * Markdown tools require `llms: true` in production.
1216
+ * @default true
1217
+ * @experimental
1218
+ */
1219
+ webMcp?: boolean | {
1220
+ exposedTo?: string[];
1221
+ };
1175
1222
  /**
1176
1223
  * Whether to enable medium-zoom
1177
1224
  * @default true
@@ -18,6 +18,12 @@ declare interface AdditionalPage {
18
18
  filepath?: string;
19
19
  }
20
20
 
21
+ declare type ChangeFreq = 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
22
+
23
+ declare interface CustomMaps {
24
+ [routePath: string]: Sitemap;
25
+ }
26
+
21
27
  declare type DarkMode = boolean | NormalizedDarkMode;
22
28
 
23
29
  declare interface EditLink {
@@ -166,6 +172,10 @@ declare interface I18nText {
166
172
  codeButtonGroupWrapButtonText?: I18nTextValue;
167
173
  notFoundText?: I18nTextValue;
168
174
  takeMeHomeText?: I18nTextValue;
175
+ errorTitleText?: I18nTextValue;
176
+ errorDescriptionText?: I18nTextValue;
177
+ reloadPageText?: I18nTextValue;
178
+ errorDetailsText?: I18nTextValue;
169
179
  promptCopyText?: I18nTextValue;
170
180
  promptCopiedText?: I18nTextValue;
171
181
  promptExpandText?: I18nTextValue;
@@ -487,6 +497,8 @@ declare interface PageIndexInfo {
487
497
 
488
498
  declare type PageType = 'home' | 'doc' | 'doc-wide' | 'custom' | '404' | 'blank';
489
499
 
500
+ declare type Priority = '0.0' | '0.1' | '0.2' | '0.3' | '0.4' | '0.5' | '0.6' | '0.7' | '0.8' | '0.9' | '1.0';
501
+
490
502
  declare type RemarkImageOptions = {
491
503
  /**
492
504
  * Whether to enable check dead images
@@ -744,6 +756,20 @@ declare type SidebarSectionHeader = {
744
756
  tag?: string;
745
757
  };
746
758
 
759
+ declare interface Sitemap {
760
+ loc: string;
761
+ lastmod?: string;
762
+ changefreq?: ChangeFreq;
763
+ priority?: Priority;
764
+ }
765
+
766
+ declare interface SitemapOptions {
767
+ siteUrl?: string;
768
+ customMaps?: CustomMaps;
769
+ defaultPriority?: Priority;
770
+ defaultChangeFreq?: ChangeFreq;
771
+ }
772
+
747
773
  declare interface SocialLink {
748
774
  icon: SocialLinkIcon;
749
775
  mode: 'link' | 'text' | 'img' | 'dom' | 'github-stars';
@@ -883,6 +909,11 @@ declare interface UserConfig {
883
909
  * Origin of the site, such as `https://example.com`.
884
910
  */
885
911
  siteOrigin?: string;
912
+ /**
913
+ * Generate sitemap.xml during production builds.
914
+ * @default true
915
+ */
916
+ sitemap?: boolean | SitemapOptions;
886
917
  /**
887
918
  * Path to html icon file.
888
919
  * @default ''
@@ -970,7 +1001,10 @@ declare interface UserConfig {
970
1001
  */
971
1002
  search?: SearchOptions;
972
1003
  /**
973
- * Whether to enable ssg
1004
+ * Whether to prerender page content into HTML at build time (SSG).
1005
+ * Set to `false` to generate HTML shells for client-side rendering instead.
1006
+ * This does not disable SSG-MD or llms.txt generation, which are controlled
1007
+ * independently by `llms`.
974
1008
  * @default true
975
1009
  */
976
1010
  ssg?: boolean | {
@@ -981,14 +1015,18 @@ declare interface UserConfig {
981
1015
  experimentalWorker?: boolean;
982
1016
  /**
983
1017
  * After enabled, some pages will not be rendered by SSG, and they will directly use html under CSR. This is suitable for SSG errors in large document sites bypassing a small number of pages. It is not recommended to enable this option actively.
1018
+ * Only affects SSG, not SSG-MD. If excluded pages are not SSR-compatible,
1019
+ * fix their SSR compatibility or set `llms: false` to disable SSG-MD.
984
1020
  * @default []
985
1021
  */
986
1022
  experimentalExcludeRoutePaths?: (string | RegExp)[];
987
1023
  };
988
1024
  /**
989
- * Whether to enable llms and ssg-md
990
- * @default false
991
- * @experimental
1025
+ * Whether to render pages to Markdown (SSG-MD) and generate llms.txt and
1026
+ * llms-full.txt at build time.
1027
+ * Independent of `ssg`: these files are still generated when `ssg: false`.
1028
+ * Set to `false` to disable these outputs without affecting SSG.
1029
+ * @default true
992
1030
  */
993
1031
  llms?: boolean | {
994
1032
  /**
@@ -1001,6 +1039,15 @@ declare interface UserConfig {
1001
1039
  */
1002
1040
  remarkSplitMdxOptions?: RemarkSplitMdxOptions;
1003
1041
  };
1042
+ /**
1043
+ * Expose built-in documentation tools through the browser WebMCP API.
1044
+ * Markdown tools require `llms: true` in production.
1045
+ * @default true
1046
+ * @experimental
1047
+ */
1048
+ webMcp?: boolean | {
1049
+ exposedTo?: string[];
1050
+ };
1004
1051
  /**
1005
1052
  * Whether to enable medium-zoom
1006
1053
  * @default true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "2.0.23",
3
+ "version": "2.1.0-beta.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/web-infra-dev/rspress.git",
@@ -45,7 +45,7 @@
45
45
  "dist"
46
46
  ],
47
47
  "dependencies": {
48
- "@rsbuild/core": "^2.2.10",
48
+ "@rsbuild/core": "^2.2.12",
49
49
  "@shikijs/rehype": "^4.2.0",
50
50
  "@types/react": "^19.2.18",
51
51
  "mdast-util-mdx-jsx": "^3.2.0",