vike-react 0.6.18 → 0.6.20-commit-542502a
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,13 +1,14 @@
|
|
|
1
|
-
// TODO/soon: add deprecation warning in favor of <ClientOnly>
|
|
2
1
|
// TO-DO/breaking-change: remove it
|
|
3
2
|
export { clientOnly };
|
|
4
3
|
import React, { Suspense, forwardRef, lazy, useEffect, useState, } from 'react';
|
|
4
|
+
import { assertWarning } from '../utils/assert.js';
|
|
5
5
|
/**
|
|
6
6
|
* Load and render a component only on the client-side.
|
|
7
7
|
*
|
|
8
8
|
* https://vike.dev/clientOnly
|
|
9
9
|
*/
|
|
10
10
|
function clientOnly(load) {
|
|
11
|
+
assertWarning(false, 'clientOnly() is deprecated — use <ClientOnly> https://vike.dev/ClientOnly');
|
|
11
12
|
if (!globalThis.__VIKE__IS_CLIENT) {
|
|
12
13
|
return (props) => React.createElement(React.Fragment, null, props.fallback);
|
|
13
14
|
}
|
|
@@ -55,7 +55,7 @@ async function renderPageToHtml(pageContext) {
|
|
|
55
55
|
pageContext.page = getPageElement(pageContext).page;
|
|
56
56
|
// https://github.com/vikejs/vike-react/issues/87#issuecomment-2488742744
|
|
57
57
|
await callCumulativeHooks(pageContext.config.onBeforeRenderHtml, pageContext);
|
|
58
|
-
const { renderToStringOptions } = resolveReactOptions(pageContext);
|
|
58
|
+
const { renderToStringOptions, renderToStreamOptions } = resolveReactOptions(pageContext);
|
|
59
59
|
if (pageContext.page) {
|
|
60
60
|
const streamSetting = resolveStreamSetting(pageContext);
|
|
61
61
|
if (!streamSetting.enable && !streamSetting.require) {
|
|
@@ -83,6 +83,7 @@ async function renderPageToHtml(pageContext) {
|
|
|
83
83
|
false,
|
|
84
84
|
*/
|
|
85
85
|
undefined,
|
|
86
|
+
...renderToStreamOptions,
|
|
86
87
|
});
|
|
87
88
|
pageContext.pageHtmlStream = pageHtmlStream;
|
|
88
89
|
}
|
package/dist/types/Config.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { ConfigsCumulative } from '../hooks/useConfig/configsCumulative.js'
|
|
|
5
5
|
import type React from 'react';
|
|
6
6
|
import type { HydrationOptions, RootOptions } from 'react-dom/client';
|
|
7
7
|
import type { ServerOptions } from 'react-dom/server';
|
|
8
|
+
import type { RenderToStreamOptions } from 'react-streaming/server';
|
|
8
9
|
declare global {
|
|
9
10
|
namespace Vike {
|
|
10
11
|
interface Config {
|
|
@@ -262,8 +263,33 @@ type PickWithoutGetter<T, K extends keyof T> = {
|
|
|
262
263
|
export type ConfigViaHook = PickWithoutGetter<Vike.Config, 'Head' | 'title' | 'description' | 'image' | 'favicon' | 'lang' | 'viewport' | 'bodyAttributes' | 'htmlAttributes'>;
|
|
263
264
|
export type ConfigViaHookResolved = Omit<ConfigViaHook, ConfigsCumulative> & Pick<Vike.ConfigResolved, ConfigsCumulative>;
|
|
264
265
|
export type ReactOptions = {
|
|
266
|
+
/**
|
|
267
|
+
* Options passed to React's `hydrateRoot()`.
|
|
268
|
+
*
|
|
269
|
+
* https://react.dev/reference/react-dom/client/hydrateRoot
|
|
270
|
+
* https://vike.dev/react-setting
|
|
271
|
+
*/
|
|
265
272
|
hydrateRootOptions?: HydrationOptions;
|
|
273
|
+
/**
|
|
274
|
+
* Options passed to React's `createRoot()`.
|
|
275
|
+
*
|
|
276
|
+
* https://react.dev/reference/react-dom/client/createRoot
|
|
277
|
+
* https://vike.dev/react-setting
|
|
278
|
+
*/
|
|
266
279
|
createRootOptions?: RootOptions;
|
|
280
|
+
/**
|
|
281
|
+
* Options passed to React's `renderToString()`.
|
|
282
|
+
*
|
|
283
|
+
* https://react.dev/reference/react-dom/server/renderToString
|
|
284
|
+
* https://vike.dev/react-setting
|
|
285
|
+
*/
|
|
267
286
|
renderToStringOptions?: ServerOptions;
|
|
287
|
+
/**
|
|
288
|
+
* Options passed to `react-streaming`'s `renderToStream()` during SSR streaming.
|
|
289
|
+
*
|
|
290
|
+
* https://github.com/brillout/react-streaming#options
|
|
291
|
+
* https://vike.dev/react-setting
|
|
292
|
+
*/
|
|
293
|
+
renderToStreamOptions?: RenderToStreamOptions;
|
|
268
294
|
};
|
|
269
295
|
export {};
|
package/dist/utils/assert.d.ts
CHANGED
package/dist/utils/assert.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { assert };
|
|
2
|
+
export { assertWarning };
|
|
3
|
+
function assert(condition) {
|
|
2
4
|
if (condition)
|
|
3
5
|
return;
|
|
4
|
-
throw new Error('You stumbled upon a
|
|
6
|
+
throw new Error('[vike-react] You stumbled upon a bug, reach out on GitHub.');
|
|
7
|
+
}
|
|
8
|
+
function assertWarning(condition, message) {
|
|
9
|
+
if (condition)
|
|
10
|
+
return;
|
|
11
|
+
console.warn(new Error(message));
|
|
5
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike-react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.20-commit-542502a",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike-react",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -8,14 +8,17 @@
|
|
|
8
8
|
"./useData": "./dist/hooks/useData.js",
|
|
9
9
|
"./useHydrated": "./dist/hooks/useHydrated.js",
|
|
10
10
|
"./useConfig": {
|
|
11
|
+
"worker": "./dist/hooks/useConfig/useConfig-server.js",
|
|
11
12
|
"browser": "./dist/hooks/useConfig/useConfig-client.js",
|
|
12
13
|
"default": "./dist/hooks/useConfig/useConfig-server.js"
|
|
13
14
|
},
|
|
14
15
|
"./Config": {
|
|
16
|
+
"worker": "./dist/components/Config/Config-server.js",
|
|
15
17
|
"browser": "./dist/components/Config/Config-client.js",
|
|
16
18
|
"default": "./dist/components/Config/Config-server.js"
|
|
17
19
|
},
|
|
18
20
|
"./Head": {
|
|
21
|
+
"worker": "./dist/components/Head/Head-server.js",
|
|
19
22
|
"browser": "./dist/components/Head/Head-client.js",
|
|
20
23
|
"default": "./dist/components/Head/Head-server.js"
|
|
21
24
|
},
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
"./__internal/integration/Loading": "./dist/integration/Loading.js"
|
|
29
32
|
},
|
|
30
33
|
"dependencies": {
|
|
31
|
-
"react-streaming": "^0.4.
|
|
34
|
+
"react-streaming": "^0.4.16"
|
|
32
35
|
},
|
|
33
36
|
"peerDependencies": {
|
|
34
37
|
"react": ">=19",
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
"react-dom": "^19.2.1",
|
|
46
49
|
"rimraf": "^5.0.5",
|
|
47
50
|
"typescript": "^5.9.2",
|
|
48
|
-
"vike": "^0.4.
|
|
51
|
+
"vike": "^0.4.253",
|
|
49
52
|
"vite": "^7.3.0"
|
|
50
53
|
},
|
|
51
54
|
"typesVersions": {
|