@rspress/runtime 0.0.0-next-20240613032119 → 0.0.0-next-20241010114926
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/NoSSR.d.ts +1 -2
- package/dist/hooks.d.ts +1 -1
- package/dist/utils.js +4 -1
- package/package.json +10 -10
- package/src/hooks.ts +2 -1
- package/src/utils.ts +9 -1
package/dist/NoSSR.d.ts
CHANGED
package/dist/hooks.d.ts
CHANGED
@@ -22,7 +22,7 @@ export declare function useDark(): boolean;
|
|
22
22
|
export declare function useI18n<T = Record<string, Record<string, string>>>(): (key: keyof T) => any;
|
23
23
|
declare global {
|
24
24
|
interface Document {
|
25
|
-
startViewTransition: (callback: () => void) =>
|
25
|
+
startViewTransition: (callback: () => void) => any;
|
26
26
|
}
|
27
27
|
}
|
28
28
|
export declare function useViewTransition(dom: ReactElement): ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
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": "0.0.0-next-
|
3
|
+
"version": "0.0.0-next-20241010114926",
|
4
4
|
"description": "The Runtime of Rspress Documentation Framework",
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
6
6
|
"repository": {
|
@@ -25,18 +25,18 @@
|
|
25
25
|
"node": ">=14.17.6"
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"react": "^18.
|
29
|
-
"react-dom": "^18.
|
28
|
+
"react": "^18.3.1",
|
29
|
+
"react-dom": "^18.3.1",
|
30
30
|
"react-helmet-async": "^1.3.0",
|
31
|
-
"react-router-dom": "^6.
|
32
|
-
"@rspress/shared": "0.0.0-next-
|
31
|
+
"react-router-dom": "^6.26.2",
|
32
|
+
"@rspress/shared": "0.0.0-next-20241010114926"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
|
-
"@modern-js/tsconfig": "2.
|
36
|
-
"@types/jest": "~29.5.
|
37
|
-
"@types/react": "^18",
|
38
|
-
"@types/react-dom": "^18",
|
39
|
-
"typescript": "^5"
|
35
|
+
"@modern-js/tsconfig": "2.60.2",
|
36
|
+
"@types/jest": "~29.5.13",
|
37
|
+
"@types/react": "^18.3.11",
|
38
|
+
"@types/react-dom": "^18.3.0",
|
39
|
+
"typescript": "^5.5.3"
|
40
40
|
},
|
41
41
|
"sideEffects": [
|
42
42
|
"*.css",
|
package/src/hooks.ts
CHANGED
@@ -58,7 +58,8 @@ export function useI18n<T = Record<string, Record<string, string>>>() {
|
|
58
58
|
|
59
59
|
declare global {
|
60
60
|
interface Document {
|
61
|
-
|
61
|
+
// @ts-ignore view-transition new API type is failed in tsc, but it works in vscode
|
62
|
+
startViewTransition: (callback: () => void) => any;
|
62
63
|
}
|
63
64
|
}
|
64
65
|
|
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 (
|
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
|
|