@rspress/runtime 1.25.0 → 1.25.2

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/utils.js CHANGED
@@ -32,7 +32,10 @@ function normalizeImagePath(imagePath) {
32
32
  if (!isProd) {
33
33
  return imagePath;
34
34
  }
35
- if (isExternalUrl(imagePath) || isDataUrl(imagePath)) {
35
+ if (isExternalUrl(imagePath) || isDataUrl(imagePath) || imagePath.startsWith("//")) {
36
+ return imagePath;
37
+ }
38
+ if (!imagePath.startsWith("/")) {
36
39
  return imagePath;
37
40
  }
38
41
  return withBase(imagePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/runtime",
3
- "version": "1.25.0",
3
+ "version": "1.25.2",
4
4
  "description": "The Runtime of Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -29,10 +29,10 @@
29
29
  "react-dom": "^18.2.0",
30
30
  "react-helmet-async": "^1.3.0",
31
31
  "react-router-dom": "^6.8.1",
32
- "@rspress/shared": "1.25.0"
32
+ "@rspress/shared": "1.25.2"
33
33
  },
34
34
  "devDependencies": {
35
- "@modern-js/tsconfig": "2.53.0",
35
+ "@modern-js/tsconfig": "2.54.5",
36
36
  "@types/jest": "~29.5.12",
37
37
  "@types/react": "^18",
38
38
  "@types/react-dom": "^18",
package/src/utils.ts CHANGED
@@ -43,7 +43,15 @@ export function normalizeImagePath(imagePath: string) {
43
43
  if (!isProd) {
44
44
  return imagePath;
45
45
  }
46
- if (isExternalUrl(imagePath) || isDataUrl(imagePath)) {
46
+ if (
47
+ isExternalUrl(imagePath) ||
48
+ isDataUrl(imagePath) ||
49
+ imagePath.startsWith('//')
50
+ ) {
51
+ return imagePath;
52
+ }
53
+ // only append base to internal non-relative urls
54
+ if (!imagePath.startsWith('/')) {
47
55
  return imagePath;
48
56
  }
49
57