@rspress/shared 2.0.16 → 2.0.17

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
@@ -629,6 +629,18 @@ export declare interface RouteOptions {
629
629
  * @default false
630
630
  */
631
631
  cleanUrls?: boolean;
632
+ /**
633
+ * Enable concurrent, optimized routing for internal links rendered by
634
+ * Rspress' default Link component.
635
+ * @default true
636
+ */
637
+ useTransitions?: boolean;
638
+ /**
639
+ * Whether to enable prefetching for matching internal routes from Rspress'
640
+ * default Link component.
641
+ * @default true
642
+ */
643
+ prefetchLink?: boolean;
632
644
  }
633
645
 
634
646
  export declare const RSPRESS_TEMP_DIR = ".rspress";
@@ -762,6 +774,7 @@ export declare type SidebarSectionHeader = {
762
774
 
763
775
  export declare interface SiteData {
764
776
  base: string;
777
+ siteOrigin: string;
765
778
  lang: string;
766
779
  route: RouteOptions;
767
780
  locales: {
@@ -930,6 +943,10 @@ export declare interface UserConfig {
930
943
  * @default '/'
931
944
  */
932
945
  base?: string;
946
+ /**
947
+ * Origin of the site, such as `https://example.com`.
948
+ */
949
+ siteOrigin?: string;
933
950
  /**
934
951
  * Path to html icon file.
935
952
  * @default ''
@@ -1090,6 +1107,8 @@ export declare function withBase(url: string, base: string): string;
1090
1107
 
1091
1108
  export declare function withoutLang(path: string, langs: string[]): string;
1092
1109
 
1110
+ export declare function withSiteOrigin(url: string, siteOrigin?: string): string;
1111
+
1093
1112
  declare interface ZoomContainer {
1094
1113
  width?: number
1095
1114
  height?: number
package/dist/index.js CHANGED
@@ -140,6 +140,10 @@ function withBase(url, base) {
140
140
  }
141
141
  return `${normalizedBase}${normalizedUrl}`;
142
142
  }
143
+ function withSiteOrigin(url, siteOrigin) {
144
+ if (!siteOrigin || isExternalUrl(url)) return url;
145
+ return new URL(addLeadingSlash(url), addTrailingSlash(siteOrigin)).href;
146
+ }
143
147
  function removeBase(url, base) {
144
148
  const normalizedUrl = addLeadingSlash(url);
145
149
  const normalizedBase = normalizeSlash(base);
@@ -173,4 +177,4 @@ const getDefaultDarkModeValue = (darkMode)=>{
173
177
  return normalizedDarkMode;
174
178
  };
175
179
  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 };
180
+ 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, withSiteOrigin, withoutLang };
@@ -503,6 +503,18 @@ declare interface RouteOptions {
503
503
  * @default false
504
504
  */
505
505
  cleanUrls?: boolean;
506
+ /**
507
+ * Enable concurrent, optimized routing for internal links rendered by
508
+ * Rspress' default Link component.
509
+ * @default true
510
+ */
511
+ useTransitions?: boolean;
512
+ /**
513
+ * Whether to enable prefetching for matching internal routes from Rspress'
514
+ * default Link component.
515
+ * @default true
516
+ */
517
+ prefetchLink?: boolean;
506
518
  }
507
519
 
508
520
  declare interface RspressPlugin {
@@ -760,6 +772,10 @@ declare interface UserConfig {
760
772
  * @default '/'
761
773
  */
762
774
  base?: string;
775
+ /**
776
+ * Origin of the site, such as `https://example.com`.
777
+ */
778
+ siteOrigin?: string;
763
779
  /**
764
780
  * Path to html icon file.
765
781
  * @default ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
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.15",
47
+ "@rsbuild/core": "^2.1.5",
48
48
  "@shikijs/rehype": "^4.2.0",
49
49
  "unified": "^11.0.5"
50
50
  },
51
51
  "devDependencies": {
52
- "@rslib/core": "0.23.0",
52
+ "@rslib/core": "0.23.2",
53
53
  "@types/lodash-es": "^4.17.12",
54
54
  "@types/node": "^22.8.1",
55
55
  "@types/react": "^19.2.17",