@rspress/shared 2.0.13 → 2.0.15
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 +90 -8
- package/dist/index.js +12 -1
- package/dist/node-utils.d.ts +75 -7
- package/dist/rslib-runtime.js +9 -5
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare const cleanUrl: (url: string) => string;
|
|
|
27
27
|
|
|
28
28
|
export declare type Config = UserConfig | Promise<UserConfig> | ((...args: Parameters<typeof loadConfig>) => UserConfig | Promise<UserConfig>);
|
|
29
29
|
|
|
30
|
+
export declare type DarkMode = boolean | NormalizedDarkMode;
|
|
31
|
+
|
|
30
32
|
export declare interface EditLink {
|
|
31
33
|
/**
|
|
32
34
|
* Custom repository url for edit link.
|
|
@@ -85,9 +87,12 @@ export declare interface FrontMatterMeta {
|
|
|
85
87
|
titleSuffix?: string;
|
|
86
88
|
head?: [string, Record<string, string>][];
|
|
87
89
|
context?: string;
|
|
90
|
+
search?: boolean;
|
|
88
91
|
[key: string]: unknown;
|
|
89
92
|
}
|
|
90
93
|
|
|
94
|
+
export declare const getDefaultDarkModeValue: (darkMode: DarkMode | undefined) => ThemeConfigValue;
|
|
95
|
+
|
|
91
96
|
/**
|
|
92
97
|
* get the sidebar group for the current page
|
|
93
98
|
* @param sidebar const { sidebar } = useLocaleSiteData();
|
|
@@ -144,6 +149,7 @@ export declare interface I18nText {
|
|
|
144
149
|
outlineTitle?: I18nTextValue;
|
|
145
150
|
scrollToTopText?: I18nTextValue;
|
|
146
151
|
lastUpdatedText?: I18nTextValue;
|
|
152
|
+
lastUpdatedAuthorText?: I18nTextValue;
|
|
147
153
|
prevPageText?: I18nTextValue;
|
|
148
154
|
nextPageText?: I18nTextValue;
|
|
149
155
|
editLinkText?: I18nTextValue;
|
|
@@ -173,6 +179,8 @@ declare type I18nTextValue = {
|
|
|
173
179
|
|
|
174
180
|
export declare const inBrowser: () => boolean;
|
|
175
181
|
|
|
182
|
+
export declare const isDarkModeSwitchEnabled: (darkMode: DarkMode | undefined) => boolean;
|
|
183
|
+
|
|
176
184
|
export declare function isDataUrl(url?: string): boolean;
|
|
177
185
|
|
|
178
186
|
export declare const isDebugMode: () => boolean;
|
|
@@ -183,6 +191,23 @@ export declare function isExternalUrl(url?: string): boolean;
|
|
|
183
191
|
|
|
184
192
|
export declare const isProduction: () => boolean;
|
|
185
193
|
|
|
194
|
+
export declare type LastUpdated = boolean | {
|
|
195
|
+
/**
|
|
196
|
+
* Whether to display the last author of the file (from git log).
|
|
197
|
+
* - `false`: hide the author.
|
|
198
|
+
* - `true`: show the commit author's name.
|
|
199
|
+
* - function: receives `{ name, email, filePath }` and returns the display string.
|
|
200
|
+
* @default false
|
|
201
|
+
*/
|
|
202
|
+
author?: LastUpdatedAuthor;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export declare type LastUpdatedAuthor = boolean | ((info: {
|
|
206
|
+
name: string;
|
|
207
|
+
email: string;
|
|
208
|
+
filePath: string;
|
|
209
|
+
}) => string);
|
|
210
|
+
|
|
186
211
|
/**
|
|
187
212
|
* Configuration for LLMS UI components displayed on H1 headers.
|
|
188
213
|
* When enabled, LlmsCopyButton and LlmsViewOptions will be automatically
|
|
@@ -257,10 +282,25 @@ export declare type LocalSearchOptions = SearchHooks & {
|
|
|
257
282
|
};
|
|
258
283
|
|
|
259
284
|
export declare interface MarkdownOptions {
|
|
285
|
+
/**
|
|
286
|
+
* @default []
|
|
287
|
+
*/
|
|
260
288
|
remarkPlugins?: PluggableList;
|
|
289
|
+
/**
|
|
290
|
+
* @default []
|
|
291
|
+
*/
|
|
261
292
|
rehypePlugins?: PluggableList;
|
|
293
|
+
/**
|
|
294
|
+
* @default { checkDeadLinks: true, checkAnchors: false, autoPrefix: true }
|
|
295
|
+
*/
|
|
262
296
|
link?: RemarkLinkOptions;
|
|
297
|
+
/**
|
|
298
|
+
* @default { checkDeadImages: true }
|
|
299
|
+
*/
|
|
263
300
|
image?: RemarkImageOptions;
|
|
301
|
+
/**
|
|
302
|
+
* @default false
|
|
303
|
+
*/
|
|
264
304
|
showLineNumbers?: boolean;
|
|
265
305
|
/**
|
|
266
306
|
* Whether to wrap code by default
|
|
@@ -285,6 +325,7 @@ export declare interface MarkdownOptions {
|
|
|
285
325
|
};
|
|
286
326
|
/**
|
|
287
327
|
* Register global components in mdx files
|
|
328
|
+
* @default []
|
|
288
329
|
*/
|
|
289
330
|
globalComponents?: string[];
|
|
290
331
|
/**
|
|
@@ -358,6 +399,14 @@ export declare interface NavItemWithLinkAndChildren {
|
|
|
358
399
|
rel?: string;
|
|
359
400
|
}
|
|
360
401
|
|
|
402
|
+
export declare const normalizeDarkMode: (darkMode: DarkMode | undefined) => NormalizedDarkMode;
|
|
403
|
+
|
|
404
|
+
export declare type NormalizedDarkMode = 'light' | 'dark' | 'auto' | 'force-light' | 'force-dark' | 'force-auto';
|
|
405
|
+
|
|
406
|
+
export declare type NormalizedLastUpdated = boolean | {
|
|
407
|
+
author?: boolean;
|
|
408
|
+
};
|
|
409
|
+
|
|
361
410
|
export declare interface NormalizedLocales extends Omit<LocaleConfig, 'sidebar'> {
|
|
362
411
|
sidebar: NormalizedSidebar;
|
|
363
412
|
}
|
|
@@ -372,7 +421,8 @@ export declare interface NormalizedSidebarGroup extends Omit<SidebarGroup, 'item
|
|
|
372
421
|
collapsed: boolean;
|
|
373
422
|
}
|
|
374
423
|
|
|
375
|
-
declare interface NormalizedThemeConfig extends Omit<ThemeConfig, 'locales' | 'sidebar'> {
|
|
424
|
+
declare interface NormalizedThemeConfig extends Omit<ThemeConfig, 'lastUpdated' | 'locales' | 'sidebar'> {
|
|
425
|
+
lastUpdated?: NormalizedLastUpdated;
|
|
376
426
|
locales: NormalizedLocales[];
|
|
377
427
|
sidebar: NormalizedSidebar;
|
|
378
428
|
}
|
|
@@ -395,6 +445,7 @@ export declare interface PageDataLegacy {
|
|
|
395
445
|
headingTitle?: string;
|
|
396
446
|
pagePath: string;
|
|
397
447
|
lastUpdatedTime?: string;
|
|
448
|
+
lastUpdatedAuthor?: string;
|
|
398
449
|
description?: string;
|
|
399
450
|
pageType: PageType;
|
|
400
451
|
[key: string]: unknown;
|
|
@@ -455,6 +506,13 @@ export declare type RemarkLinkOptions = {
|
|
|
455
506
|
checkDeadLinks?: boolean | {
|
|
456
507
|
excludes: string[] | ((url: string) => boolean);
|
|
457
508
|
};
|
|
509
|
+
/**
|
|
510
|
+
* Whether to enable dead anchor checks
|
|
511
|
+
* @default false
|
|
512
|
+
*/
|
|
513
|
+
checkAnchors?: boolean | {
|
|
514
|
+
excludes: string[] | ((url: string) => boolean);
|
|
515
|
+
};
|
|
458
516
|
/**
|
|
459
517
|
* [](/v3/zh/guide) [](/zh/guide) [](/guide) will be regarded as the same [](/v3/zh/guide) according to the directory.
|
|
460
518
|
* @default true
|
|
@@ -548,7 +606,7 @@ export declare interface RouteMeta {
|
|
|
548
606
|
export declare interface RouteOptions {
|
|
549
607
|
/**
|
|
550
608
|
* The extension name of the filepath that will be converted to a route
|
|
551
|
-
* @default ['js','jsx','ts','tsx','md','mdx']
|
|
609
|
+
* @default ['.js', '.jsx', '.ts', '.tsx', '.md', '.mdx']
|
|
552
610
|
*/
|
|
553
611
|
extensions?: string[];
|
|
554
612
|
/**
|
|
@@ -736,7 +794,14 @@ export declare function slash(str: string): string;
|
|
|
736
794
|
|
|
737
795
|
export declare interface SocialLink {
|
|
738
796
|
icon: SocialLinkIcon;
|
|
739
|
-
mode: 'link' | 'text' | 'img' | 'dom';
|
|
797
|
+
mode: 'link' | 'text' | 'img' | 'dom' | 'github-stars';
|
|
798
|
+
/**
|
|
799
|
+
* For most modes, the URL, text, image path, or raw HTML to render.
|
|
800
|
+
*
|
|
801
|
+
* For `github-stars` mode, the GitHub repository URL
|
|
802
|
+
* (e.g. `https://github.com/web-infra-dev/rspress`). The repository's star
|
|
803
|
+
* count is fetched from the GitHub API and rendered next to the icon.
|
|
804
|
+
*/
|
|
740
805
|
content: string;
|
|
741
806
|
}
|
|
742
807
|
|
|
@@ -746,12 +811,15 @@ declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'inst
|
|
|
746
811
|
|
|
747
812
|
declare type ThemeConfig = {
|
|
748
813
|
/**
|
|
749
|
-
* Whether to enable dark mode.
|
|
814
|
+
* Whether to enable dark mode and how to resolve the default theme.
|
|
815
|
+
* - `true`: same as `'auto'`.
|
|
816
|
+
* - `false`: same as `'force-light'`.
|
|
750
817
|
* @default true
|
|
751
818
|
*/
|
|
752
|
-
darkMode?:
|
|
819
|
+
darkMode?: DarkMode;
|
|
753
820
|
/**
|
|
754
821
|
* The nav items. When it's an object, the key is the version of current doc.
|
|
822
|
+
* @default []
|
|
755
823
|
*/
|
|
756
824
|
nav?: NavItem[] | {
|
|
757
825
|
[key: string]: NavItem[];
|
|
@@ -767,12 +835,14 @@ declare type ThemeConfig = {
|
|
|
767
835
|
editLink?: EditLink;
|
|
768
836
|
/**
|
|
769
837
|
* Whether to display the last update time of the file.
|
|
838
|
+
* Set `author` to show the last commit author.
|
|
770
839
|
* @default false
|
|
771
840
|
*/
|
|
772
|
-
lastUpdated?:
|
|
841
|
+
lastUpdated?: LastUpdated;
|
|
773
842
|
/**
|
|
774
843
|
* The social links to be displayed at the end of the nav bar. Perfect for
|
|
775
844
|
* placing links to social services such as GitHub, X, Facebook, etc.
|
|
845
|
+
* @default []
|
|
776
846
|
*/
|
|
777
847
|
socialLinks?: SocialLink[];
|
|
778
848
|
/**
|
|
@@ -790,7 +860,7 @@ declare type ThemeConfig = {
|
|
|
790
860
|
/**
|
|
791
861
|
* The behavior of hiding navbar
|
|
792
862
|
* Currently, Rspress V2 does not implement `hideNavBar`
|
|
793
|
-
* @default 'never'
|
|
863
|
+
* @default 'never'
|
|
794
864
|
*/
|
|
795
865
|
hideNavbar?: 'always' | 'auto' | 'never';
|
|
796
866
|
/**
|
|
@@ -829,6 +899,8 @@ declare type ThemeConfig = {
|
|
|
829
899
|
export { ThemeConfig as DefaultThemeConfig }
|
|
830
900
|
export { ThemeConfig }
|
|
831
901
|
|
|
902
|
+
declare type ThemeConfigValue = 'light' | 'dark' | 'auto';
|
|
903
|
+
|
|
832
904
|
export declare interface UserConfig {
|
|
833
905
|
/**
|
|
834
906
|
* The root directory of the site.
|
|
@@ -837,6 +909,7 @@ export declare interface UserConfig {
|
|
|
837
909
|
root?: string;
|
|
838
910
|
/**
|
|
839
911
|
* Path to the logo file in nav bar.
|
|
912
|
+
* @default ''
|
|
840
913
|
*/
|
|
841
914
|
logo?: string | {
|
|
842
915
|
dark: string;
|
|
@@ -859,6 +932,7 @@ export declare interface UserConfig {
|
|
|
859
932
|
base?: string;
|
|
860
933
|
/**
|
|
861
934
|
* Path to html icon file.
|
|
935
|
+
* @default ''
|
|
862
936
|
*/
|
|
863
937
|
icon?: string | URL;
|
|
864
938
|
/**
|
|
@@ -886,11 +960,12 @@ export declare interface UserConfig {
|
|
|
886
960
|
locales?: Locale[];
|
|
887
961
|
/**
|
|
888
962
|
* The i18n text data source path. Default is `i18n.json` in cwd.
|
|
889
|
-
* @default '
|
|
963
|
+
* @default path.join(process.cwd(), 'i18n.json')
|
|
890
964
|
*/
|
|
891
965
|
i18nSourcePath?: string;
|
|
892
966
|
/**
|
|
893
967
|
* The i18n text data.
|
|
968
|
+
* @default {}
|
|
894
969
|
*/
|
|
895
970
|
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
971
|
/**
|
|
@@ -915,18 +990,22 @@ export declare interface UserConfig {
|
|
|
915
990
|
plugins?: RspressPlugin[];
|
|
916
991
|
/**
|
|
917
992
|
* Replace rule, will replace the content of the page.
|
|
993
|
+
* @default []
|
|
918
994
|
*/
|
|
919
995
|
replaceRules?: ReplaceRule[];
|
|
920
996
|
/**
|
|
921
997
|
* Output directory
|
|
998
|
+
* @default 'doc_build'
|
|
922
999
|
*/
|
|
923
1000
|
outDir?: string;
|
|
924
1001
|
/**
|
|
925
1002
|
* User side custom theme directory
|
|
1003
|
+
* @default path.join(process.cwd(), 'theme')
|
|
926
1004
|
*/
|
|
927
1005
|
themeDir?: string;
|
|
928
1006
|
/**
|
|
929
1007
|
* Global components
|
|
1008
|
+
* @default []
|
|
930
1009
|
*/
|
|
931
1010
|
globalUIComponents?: (string | [string, object])[];
|
|
932
1011
|
/**
|
|
@@ -991,14 +1070,17 @@ export declare interface UserConfig {
|
|
|
991
1070
|
languageParity?: {
|
|
992
1071
|
/**
|
|
993
1072
|
* Whether to enable language parity checking
|
|
1073
|
+
* @default false
|
|
994
1074
|
*/
|
|
995
1075
|
enabled?: boolean;
|
|
996
1076
|
/**
|
|
997
1077
|
* Directories to include in the parity check
|
|
1078
|
+
* @default []
|
|
998
1079
|
*/
|
|
999
1080
|
include?: string[];
|
|
1000
1081
|
/**
|
|
1001
1082
|
* Directories to exclude from the parity check
|
|
1083
|
+
* @default []
|
|
1002
1084
|
*/
|
|
1003
1085
|
exclude?: string[];
|
|
1004
1086
|
};
|
package/dist/index.js
CHANGED
|
@@ -162,4 +162,15 @@ const getSidebarDataGroup = (sidebar, currentPathname)=>{
|
|
|
162
162
|
return [];
|
|
163
163
|
};
|
|
164
164
|
const matchNavbar = (item, currentPathname)=>new RegExp(item.activeMatch || normalizeHref(item.link, true)).test(currentPathname);
|
|
165
|
-
|
|
165
|
+
const normalizeDarkMode = (darkMode)=>{
|
|
166
|
+
if (false === darkMode) return 'force-light';
|
|
167
|
+
if (true === darkMode || void 0 === darkMode) return 'auto';
|
|
168
|
+
return darkMode;
|
|
169
|
+
};
|
|
170
|
+
const getDefaultDarkModeValue = (darkMode)=>{
|
|
171
|
+
const normalizedDarkMode = normalizeDarkMode(darkMode);
|
|
172
|
+
if (normalizedDarkMode.startsWith('force-')) return normalizedDarkMode.slice(6);
|
|
173
|
+
return normalizedDarkMode;
|
|
174
|
+
};
|
|
175
|
+
const isDarkModeSwitchEnabled = (darkMode)=>!normalizeDarkMode(darkMode).startsWith('force-');
|
|
176
|
+
export { HASH_REGEXP, MDX_OR_MD_REGEXP, QUERY_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, getDefaultDarkModeValue, getSidebarDataGroup, inBrowser, isDarkModeSwitchEnabled, isDataUrl, isDebugMode, isDevDebugMode, isExternalUrl, isProduction, matchNavbar, matchSidebar, normalizeDarkMode, normalizeHref, normalizePosixPath, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, utils_cleanUrl as cleanUrl, withBase, withoutLang };
|
package/dist/node-utils.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ declare interface AdditionalPage {
|
|
|
19
19
|
filepath?: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
declare type DarkMode = boolean | NormalizedDarkMode;
|
|
23
|
+
|
|
22
24
|
declare interface EditLink {
|
|
23
25
|
/**
|
|
24
26
|
* Custom repository url for edit link.
|
|
@@ -82,6 +84,7 @@ declare interface FrontMatterMeta {
|
|
|
82
84
|
titleSuffix?: string;
|
|
83
85
|
head?: [string, Record<string, string>][];
|
|
84
86
|
context?: string;
|
|
87
|
+
search?: boolean;
|
|
85
88
|
[key: string]: unknown;
|
|
86
89
|
}
|
|
87
90
|
|
|
@@ -147,6 +150,7 @@ declare interface I18nText {
|
|
|
147
150
|
outlineTitle?: I18nTextValue;
|
|
148
151
|
scrollToTopText?: I18nTextValue;
|
|
149
152
|
lastUpdatedText?: I18nTextValue;
|
|
153
|
+
lastUpdatedAuthorText?: I18nTextValue;
|
|
150
154
|
prevPageText?: I18nTextValue;
|
|
151
155
|
nextPageText?: I18nTextValue;
|
|
152
156
|
editLinkText?: I18nTextValue;
|
|
@@ -174,6 +178,23 @@ declare type I18nTextValue = {
|
|
|
174
178
|
[key: string]: string;
|
|
175
179
|
};
|
|
176
180
|
|
|
181
|
+
declare type LastUpdated = boolean | {
|
|
182
|
+
/**
|
|
183
|
+
* Whether to display the last author of the file (from git log).
|
|
184
|
+
* - `false`: hide the author.
|
|
185
|
+
* - `true`: show the commit author's name.
|
|
186
|
+
* - function: receives `{ name, email, filePath }` and returns the display string.
|
|
187
|
+
* @default false
|
|
188
|
+
*/
|
|
189
|
+
author?: LastUpdatedAuthor;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
declare type LastUpdatedAuthor = boolean | ((info: {
|
|
193
|
+
name: string;
|
|
194
|
+
email: string;
|
|
195
|
+
filePath: string;
|
|
196
|
+
}) => string);
|
|
197
|
+
|
|
177
198
|
/**
|
|
178
199
|
* Configuration for LLMS UI components displayed on H1 headers.
|
|
179
200
|
* When enabled, LlmsCopyButton and LlmsViewOptions will be automatically
|
|
@@ -254,10 +275,25 @@ declare type LocalSearchOptions = SearchHooks & {
|
|
|
254
275
|
};
|
|
255
276
|
|
|
256
277
|
declare interface MarkdownOptions {
|
|
278
|
+
/**
|
|
279
|
+
* @default []
|
|
280
|
+
*/
|
|
257
281
|
remarkPlugins?: PluggableList;
|
|
282
|
+
/**
|
|
283
|
+
* @default []
|
|
284
|
+
*/
|
|
258
285
|
rehypePlugins?: PluggableList;
|
|
286
|
+
/**
|
|
287
|
+
* @default { checkDeadLinks: true, checkAnchors: false, autoPrefix: true }
|
|
288
|
+
*/
|
|
259
289
|
link?: RemarkLinkOptions;
|
|
290
|
+
/**
|
|
291
|
+
* @default { checkDeadImages: true }
|
|
292
|
+
*/
|
|
260
293
|
image?: RemarkImageOptions;
|
|
294
|
+
/**
|
|
295
|
+
* @default false
|
|
296
|
+
*/
|
|
261
297
|
showLineNumbers?: boolean;
|
|
262
298
|
/**
|
|
263
299
|
* Whether to wrap code by default
|
|
@@ -282,6 +318,7 @@ declare interface MarkdownOptions {
|
|
|
282
318
|
};
|
|
283
319
|
/**
|
|
284
320
|
* Register global components in mdx files
|
|
321
|
+
* @default []
|
|
285
322
|
*/
|
|
286
323
|
globalComponents?: string[];
|
|
287
324
|
/**
|
|
@@ -346,6 +383,8 @@ declare interface NavItemWithLinkAndChildren {
|
|
|
346
383
|
rel?: string;
|
|
347
384
|
}
|
|
348
385
|
|
|
386
|
+
declare type NormalizedDarkMode = 'light' | 'dark' | 'auto' | 'force-light' | 'force-dark' | 'force-auto';
|
|
387
|
+
|
|
349
388
|
/**
|
|
350
389
|
* @description search-index.json file
|
|
351
390
|
* "_foo" is the private field that won't be written to search-index.json file
|
|
@@ -385,6 +424,13 @@ declare type RemarkLinkOptions = {
|
|
|
385
424
|
checkDeadLinks?: boolean | {
|
|
386
425
|
excludes: string[] | ((url: string) => boolean);
|
|
387
426
|
};
|
|
427
|
+
/**
|
|
428
|
+
* Whether to enable dead anchor checks
|
|
429
|
+
* @default false
|
|
430
|
+
*/
|
|
431
|
+
checkAnchors?: boolean | {
|
|
432
|
+
excludes: string[] | ((url: string) => boolean);
|
|
433
|
+
};
|
|
388
434
|
/**
|
|
389
435
|
* [](/v3/zh/guide) [](/zh/guide) [](/guide) will be regarded as the same [](/v3/zh/guide) according to the directory.
|
|
390
436
|
* @default true
|
|
@@ -434,7 +480,7 @@ declare interface RouteMeta {
|
|
|
434
480
|
declare interface RouteOptions {
|
|
435
481
|
/**
|
|
436
482
|
* The extension name of the filepath that will be converted to a route
|
|
437
|
-
* @default ['js','jsx','ts','tsx','md','mdx']
|
|
483
|
+
* @default ['.js', '.jsx', '.ts', '.tsx', '.md', '.mdx']
|
|
438
484
|
*/
|
|
439
485
|
extensions?: string[];
|
|
440
486
|
/**
|
|
@@ -582,7 +628,14 @@ declare type SidebarSectionHeader = {
|
|
|
582
628
|
|
|
583
629
|
declare interface SocialLink {
|
|
584
630
|
icon: SocialLinkIcon;
|
|
585
|
-
mode: 'link' | 'text' | 'img' | 'dom';
|
|
631
|
+
mode: 'link' | 'text' | 'img' | 'dom' | 'github-stars';
|
|
632
|
+
/**
|
|
633
|
+
* For most modes, the URL, text, image path, or raw HTML to render.
|
|
634
|
+
*
|
|
635
|
+
* For `github-stars` mode, the GitHub repository URL
|
|
636
|
+
* (e.g. `https://github.com/web-infra-dev/rspress`). The repository's star
|
|
637
|
+
* count is fetched from the GitHub API and rendered next to the icon.
|
|
638
|
+
*/
|
|
586
639
|
content: string;
|
|
587
640
|
}
|
|
588
641
|
|
|
@@ -592,12 +645,15 @@ declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'inst
|
|
|
592
645
|
|
|
593
646
|
declare type ThemeConfig = {
|
|
594
647
|
/**
|
|
595
|
-
* Whether to enable dark mode.
|
|
648
|
+
* Whether to enable dark mode and how to resolve the default theme.
|
|
649
|
+
* - `true`: same as `'auto'`.
|
|
650
|
+
* - `false`: same as `'force-light'`.
|
|
596
651
|
* @default true
|
|
597
652
|
*/
|
|
598
|
-
darkMode?:
|
|
653
|
+
darkMode?: DarkMode;
|
|
599
654
|
/**
|
|
600
655
|
* The nav items. When it's an object, the key is the version of current doc.
|
|
656
|
+
* @default []
|
|
601
657
|
*/
|
|
602
658
|
nav?: NavItem[] | {
|
|
603
659
|
[key: string]: NavItem[];
|
|
@@ -613,12 +669,14 @@ declare type ThemeConfig = {
|
|
|
613
669
|
editLink?: EditLink;
|
|
614
670
|
/**
|
|
615
671
|
* Whether to display the last update time of the file.
|
|
672
|
+
* Set `author` to show the last commit author.
|
|
616
673
|
* @default false
|
|
617
674
|
*/
|
|
618
|
-
lastUpdated?:
|
|
675
|
+
lastUpdated?: LastUpdated;
|
|
619
676
|
/**
|
|
620
677
|
* The social links to be displayed at the end of the nav bar. Perfect for
|
|
621
678
|
* placing links to social services such as GitHub, X, Facebook, etc.
|
|
679
|
+
* @default []
|
|
622
680
|
*/
|
|
623
681
|
socialLinks?: SocialLink[];
|
|
624
682
|
/**
|
|
@@ -636,7 +694,7 @@ declare type ThemeConfig = {
|
|
|
636
694
|
/**
|
|
637
695
|
* The behavior of hiding navbar
|
|
638
696
|
* Currently, Rspress V2 does not implement `hideNavBar`
|
|
639
|
-
* @default 'never'
|
|
697
|
+
* @default 'never'
|
|
640
698
|
*/
|
|
641
699
|
hideNavbar?: 'always' | 'auto' | 'never';
|
|
642
700
|
/**
|
|
@@ -681,6 +739,7 @@ declare interface UserConfig {
|
|
|
681
739
|
root?: string;
|
|
682
740
|
/**
|
|
683
741
|
* Path to the logo file in nav bar.
|
|
742
|
+
* @default ''
|
|
684
743
|
*/
|
|
685
744
|
logo?: string | {
|
|
686
745
|
dark: string;
|
|
@@ -703,6 +762,7 @@ declare interface UserConfig {
|
|
|
703
762
|
base?: string;
|
|
704
763
|
/**
|
|
705
764
|
* Path to html icon file.
|
|
765
|
+
* @default ''
|
|
706
766
|
*/
|
|
707
767
|
icon?: string | URL;
|
|
708
768
|
/**
|
|
@@ -730,11 +790,12 @@ declare interface UserConfig {
|
|
|
730
790
|
locales?: Locale[];
|
|
731
791
|
/**
|
|
732
792
|
* The i18n text data source path. Default is `i18n.json` in cwd.
|
|
733
|
-
* @default '
|
|
793
|
+
* @default path.join(process.cwd(), 'i18n.json')
|
|
734
794
|
*/
|
|
735
795
|
i18nSourcePath?: string;
|
|
736
796
|
/**
|
|
737
797
|
* The i18n text data.
|
|
798
|
+
* @default {}
|
|
738
799
|
*/
|
|
739
800
|
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
801
|
/**
|
|
@@ -759,18 +820,22 @@ declare interface UserConfig {
|
|
|
759
820
|
plugins?: RspressPlugin[];
|
|
760
821
|
/**
|
|
761
822
|
* Replace rule, will replace the content of the page.
|
|
823
|
+
* @default []
|
|
762
824
|
*/
|
|
763
825
|
replaceRules?: ReplaceRule[];
|
|
764
826
|
/**
|
|
765
827
|
* Output directory
|
|
828
|
+
* @default 'doc_build'
|
|
766
829
|
*/
|
|
767
830
|
outDir?: string;
|
|
768
831
|
/**
|
|
769
832
|
* User side custom theme directory
|
|
833
|
+
* @default path.join(process.cwd(), 'theme')
|
|
770
834
|
*/
|
|
771
835
|
themeDir?: string;
|
|
772
836
|
/**
|
|
773
837
|
* Global components
|
|
838
|
+
* @default []
|
|
774
839
|
*/
|
|
775
840
|
globalUIComponents?: (string | [string, object])[];
|
|
776
841
|
/**
|
|
@@ -835,14 +900,17 @@ declare interface UserConfig {
|
|
|
835
900
|
languageParity?: {
|
|
836
901
|
/**
|
|
837
902
|
* Whether to enable language parity checking
|
|
903
|
+
* @default false
|
|
838
904
|
*/
|
|
839
905
|
enabled?: boolean;
|
|
840
906
|
/**
|
|
841
907
|
* Directories to include in the parity check
|
|
908
|
+
* @default []
|
|
842
909
|
*/
|
|
843
910
|
include?: string[];
|
|
844
911
|
/**
|
|
845
912
|
* Directories to exclude from the parity check
|
|
913
|
+
* @default []
|
|
846
914
|
*/
|
|
847
915
|
exclude?: string[];
|
|
848
916
|
};
|
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.15",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/web-infra-dev/rspress.git",
|
|
@@ -44,22 +44,22 @@
|
|
|
44
44
|
"dist"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@rsbuild/core": "^2.0.
|
|
48
|
-
"@shikijs/rehype": "^4.0
|
|
47
|
+
"@rsbuild/core": "^2.0.15",
|
|
48
|
+
"@shikijs/rehype": "^4.2.0",
|
|
49
49
|
"unified": "^11.0.5"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@rslib/core": "0.
|
|
52
|
+
"@rslib/core": "0.23.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.17",
|
|
56
56
|
"github-slugger": "^2.0.0",
|
|
57
57
|
"gray-matter": "4.0.3",
|
|
58
58
|
"lodash-es": "^4.18.1",
|
|
59
59
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
60
60
|
"medium-zoom": "1.1.0",
|
|
61
61
|
"rimraf": "^6.1.3",
|
|
62
|
-
"rsbuild-plugin-publint": "^0.
|
|
62
|
+
"rsbuild-plugin-publint": "^1.0.0",
|
|
63
63
|
"typescript": "^6.0.3"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|