@rspress/shared 2.0.0-beta.24 → 2.0.0-beta.26

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
@@ -420,7 +420,7 @@ export declare interface NormalizedSidebar {
420
420
  }
421
421
 
422
422
  export declare interface NormalizedSidebarGroup extends Omit<SidebarGroup, 'items'> {
423
- items: (SidebarDivider | SidebarItem | SidebarSectionHeader | NormalizedSidebarGroup)[];
423
+ items: SidebarData;
424
424
  collapsible: boolean;
425
425
  collapsed: boolean;
426
426
  }
@@ -666,6 +666,8 @@ export declare interface Sidebar {
666
666
  [path: string]: (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[];
667
667
  }
668
668
 
669
+ export declare type SidebarData = (SidebarDivider | SidebarItem | SidebarSectionHeader | NormalizedSidebarGroup)[];
670
+
669
671
  export declare type SidebarDivider = {
670
672
  dividerType: 'dashed' | 'solid';
671
673
  };
@@ -740,7 +742,7 @@ export declare interface SocialLink {
740
742
  content: string;
741
743
  }
742
744
 
743
- export declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | {
745
+ export declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | 'npm' | {
744
746
  svg: string;
745
747
  };
746
748
 
package/dist/index.js CHANGED
@@ -147,12 +147,16 @@ function normalizeHref(url, cleanUrls = false) {
147
147
  if (!url) return '/';
148
148
  if (isExternalUrl(url)) return url;
149
149
  if (url.startsWith('#')) return url;
150
+ if (!url.startsWith('/')) return url;
150
151
  let { url: cleanUrl, hash } = parseUrl(decodeURIComponent(url));
151
152
  if (cleanUrls) {
152
153
  if (cleanUrl.endsWith('.html')) cleanUrl = cleanUrl.replace(/\.html$/, '');
153
154
  if (cleanUrls && cleanUrl.endsWith('/index')) cleanUrl = cleanUrl.replace(/\/index$/, '/');
154
- } else if (!cleanUrl.endsWith('.html')) if (cleanUrl.endsWith('/')) cleanUrl += 'index.html';
155
- else cleanUrl += '.html';
155
+ } else {
156
+ const hasExt = /\.[a-zA-Z]\w*$/.test(cleanUrl);
157
+ if (!hasExt) if (cleanUrl.endsWith('/')) cleanUrl += 'index.html';
158
+ else cleanUrl += '.html';
159
+ }
156
160
  return addLeadingSlash(hash ? `${cleanUrl}#${hash}` : cleanUrl);
157
161
  }
158
162
  function withoutLang(path, langs) {
@@ -569,7 +569,7 @@ declare interface SocialLink {
569
569
  content: string;
570
570
  }
571
571
 
572
- declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | {
572
+ declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | 'npm' | {
573
573
  svg: string;
574
574
  };
575
575
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "2.0.0-beta.24",
3
+ "version": "2.0.0-beta.26",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/web-infra-dev/rspress.git",
@@ -32,27 +32,26 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "~1.4.12",
36
- "@shikijs/rehype": "^3.8.1",
35
+ "@rsbuild/core": "~1.4.15",
36
+ "@shikijs/rehype": "^3.9.2",
37
37
  "gray-matter": "4.0.3",
38
38
  "lodash-es": "^4.17.21",
39
39
  "unified": "^11.0.5"
40
40
  },
41
41
  "devDependencies": {
42
- "@rslib/core": "0.11.0",
42
+ "@rslib/core": "0.11.2",
43
43
  "@types/jest": "~29.5.14",
44
44
  "@types/lodash-es": "^4.17.12",
45
45
  "@types/node": "^22.8.1",
46
- "@types/react": "^19.1.8",
46
+ "@types/react": "^19.1.9",
47
47
  "mdast-util-mdx-jsx": "^3.2.0",
48
48
  "medium-zoom": "1.1.0",
49
49
  "rimraf": "^6.0.1",
50
- "rsbuild-plugin-publint": "^0.3.2",
50
+ "rsbuild-plugin-publint": "^0.3.3",
51
51
  "typescript": "^5.8.2"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public",
55
- "provenance": true,
56
55
  "registry": "https://registry.npmjs.org/"
57
56
  },
58
57
  "scripts": {