@rspress/shared 2.0.9 → 2.0.10

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
@@ -74,7 +74,7 @@ export declare interface FrontMatterMeta {
74
74
  hero?: Hero;
75
75
  tag?: string;
76
76
  navbar?: boolean;
77
- sidebar?: boolean;
77
+ sidebar?: boolean | 'placeholder';
78
78
  outline?: boolean;
79
79
  footer?: boolean;
80
80
  lineNumbers?: boolean;
@@ -155,6 +155,10 @@ export declare interface I18nText {
155
155
  codeButtonGroupCopyButtonText?: I18nTextValue;
156
156
  notFoundText?: I18nTextValue;
157
157
  takeMeHomeText?: I18nTextValue;
158
+ promptCopyText?: I18nTextValue;
159
+ promptCopiedText?: I18nTextValue;
160
+ promptExpandText?: I18nTextValue;
161
+ promptCollapseText?: I18nTextValue;
158
162
  }
159
163
 
160
164
  declare type I18nTextValue = {
package/dist/index.js CHANGED
@@ -48,8 +48,10 @@ function addTrailingSlash(url) {
48
48
  function removeTrailingSlash(url) {
49
49
  return '/' === url.charAt(url.length - 1) ? url.slice(0, -1) : url;
50
50
  }
51
+ const EXTERNAL_URL_SCHEME_REGEXP = /^[a-zA-Z][a-zA-Z\d+\-.]*:/;
52
+ const UNSAFE_EXTERNAL_URL_SCHEME_REGEXP = /^(?:javascript|data|file):/i;
51
53
  function isExternalUrl(url = '') {
52
- return url.startsWith('http://') || url.startsWith('https://') || url.startsWith('mailto:') || url.startsWith('tel:');
54
+ return EXTERNAL_URL_SCHEME_REGEXP.test(url) && !UNSAFE_EXTERNAL_URL_SCHEME_REGEXP.test(url);
53
55
  }
54
56
  function isDataUrl(url = '') {
55
57
  return /^\s*data:/i.test(url);
@@ -73,7 +73,7 @@ declare interface FrontMatterMeta {
73
73
  hero?: Hero;
74
74
  tag?: string;
75
75
  navbar?: boolean;
76
- sidebar?: boolean;
76
+ sidebar?: boolean | 'placeholder';
77
77
  outline?: boolean;
78
78
  footer?: boolean;
79
79
  lineNumbers?: boolean;
@@ -160,6 +160,10 @@ declare interface I18nText {
160
160
  codeButtonGroupCopyButtonText?: I18nTextValue;
161
161
  notFoundText?: I18nTextValue;
162
162
  takeMeHomeText?: I18nTextValue;
163
+ promptCopyText?: I18nTextValue;
164
+ promptCopiedText?: I18nTextValue;
165
+ promptExpandText?: I18nTextValue;
166
+ promptCollapseText?: I18nTextValue;
163
167
  }
164
168
 
165
169
  declare type I18nTextValue = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
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.0-rc.1",
47
+ "@rsbuild/core": "^2.0.2",
48
48
  "@shikijs/rehype": "^4.0.2",
49
49
  "unified": "^11.0.5"
50
50
  },
51
51
  "devDependencies": {
52
- "@rslib/core": "0.21.0",
52
+ "@rslib/core": "0.21.3",
53
53
  "@types/lodash-es": "^4.17.12",
54
54
  "@types/node": "^22.8.1",
55
55
  "@types/react": "^19.2.14",