vike-react 0.6.14 → 0.6.15
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.
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export { clientOnly };
|
|
2
2
|
import { type ComponentProps, type ComponentType, type ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Load and render a component only on the client-side.
|
|
5
|
+
*
|
|
6
|
+
* https://vike.dev/clientOnly
|
|
7
|
+
*/
|
|
3
8
|
declare function clientOnly<T extends ComponentType<any>>(load: () => Promise<{
|
|
4
9
|
default: T;
|
|
5
10
|
} | T>): ComponentType<ComponentProps<T> & {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export { clientOnly };
|
|
2
2
|
import React, { Suspense, forwardRef, lazy, useEffect, useState, } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Load and render a component only on the client-side.
|
|
5
|
+
*
|
|
6
|
+
* https://vike.dev/clientOnly
|
|
7
|
+
*/
|
|
3
8
|
function clientOnly(load) {
|
|
4
9
|
if (!globalThis.__VIKE__IS_CLIENT) {
|
|
5
10
|
return (props) => React.createElement(React.Fragment, null, props.fallback);
|
|
@@ -4,7 +4,7 @@ import { getPageContext } from 'vike/getPageContext';
|
|
|
4
4
|
import { applyHeadSettings } from '../../integration/applyHeadSettings.js';
|
|
5
5
|
function useConfig() {
|
|
6
6
|
// Vike hook
|
|
7
|
-
let pageContext = getPageContext();
|
|
7
|
+
let pageContext = getPageContext({ asyncHook: false });
|
|
8
8
|
if (pageContext)
|
|
9
9
|
return (config) => setPageContextConfigViaHook(config, pageContext);
|
|
10
10
|
// Component
|
|
@@ -13,7 +13,7 @@ import { configsCumulative } from './configsCumulative.js';
|
|
|
13
13
|
*/
|
|
14
14
|
function useConfig() {
|
|
15
15
|
// Vike hook
|
|
16
|
-
let pageContext = getPageContext();
|
|
16
|
+
let pageContext = getPageContext({ asyncHook: false });
|
|
17
17
|
if (pageContext)
|
|
18
18
|
return (config) => setPageContextConfigViaHook(config, pageContext);
|
|
19
19
|
// Component
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { getBetterErrorLight };
|
|
2
|
-
// Same as getBetterError() with less features (thus less KBs) for the client-side
|
|
2
|
+
// Same as getBetterError() but with less features (thus less KBs) for the client-side
|
|
3
3
|
// Copies:
|
|
4
4
|
// - https://github.com/vikejs/vike/blob/a54b7618d80409c6df4b597489ddbb7739f3e86f/packages/vike/utils/getBetterError.ts
|
|
5
5
|
// - https://github.com/brillout/react-streaming/blob/b8565c1257c63a665bda31b9be42112e458859d1/src/utils/getBetterError.ts
|
|
6
6
|
function getBetterErrorLight(err, modifications) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
// We don't clone/preserve the original error, because it would slightly increase client-side KBs.
|
|
8
|
+
// https://github.com/vikejs/vike/blob/cbfb27fb0d061c8258f4b147e91cc6e97a2183b7/packages/vike/utils/shallowClone.ts#L6
|
|
9
|
+
Object.assign(err, modifications);
|
|
10
|
+
/* Doesn't make sense since we don't clone the original error, see comment above.
|
|
11
|
+
Object.assign(err, { getOriginalError: () => (err as any)?.getOriginalError?.() ?? errOriginal })
|
|
12
|
+
*/
|
|
13
|
+
return err;
|
|
12
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike-react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike-react",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"./__internal/integration/Loading": "./dist/integration/Loading.js"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"react-streaming": "^0.4.
|
|
30
|
+
"react-streaming": "^0.4.15"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=19",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@biomejs/biome": "^1.9.4",
|
|
39
|
-
"@brillout/release-me": "^0.4.
|
|
39
|
+
"@brillout/release-me": "^0.4.12",
|
|
40
40
|
"@types/node": "^24.0.8",
|
|
41
41
|
"@types/react": "^19.1.13",
|
|
42
42
|
"@types/react-dom": "^19.1.9",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"react-dom": "^19.2.1",
|
|
45
45
|
"rimraf": "^5.0.5",
|
|
46
46
|
"typescript": "^5.9.2",
|
|
47
|
-
"vike": "^0.4.
|
|
47
|
+
"vike": "^0.4.249",
|
|
48
48
|
"vite": "^7.1.7"
|
|
49
49
|
},
|
|
50
50
|
"typesVersions": {
|