@void/react 0.9.1 → 0.9.3
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/README.md +4 -0
- package/dist/plugin.mjs +2 -0
- package/dist/runtime/pages-client.mjs +8 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -88,6 +88,10 @@ the hydrated client. Put deferred reads behind Suspense, and use a normal React
|
|
|
88
88
|
error boundary around that Suspense boundary when rejected deferred values need a
|
|
89
89
|
custom error state.
|
|
90
90
|
|
|
91
|
+
Export `ssr = false` from a page's `.server.ts` file to skip server-rendered
|
|
92
|
+
component HTML for that route. The loader still runs and the browser mounts the
|
|
93
|
+
page with the embedded initial props.
|
|
94
|
+
|
|
91
95
|
For explicit prop annotations in React pages, import `Deferred` from
|
|
92
96
|
`@void/react`:
|
|
93
97
|
|
package/dist/plugin.mjs
CHANGED
|
@@ -513,6 +513,7 @@ import { renderReactPage } from "@void/react/pages-server";
|
|
|
513
513
|
${generateComponentManifest(scan, pagesDir)}
|
|
514
514
|
|
|
515
515
|
const PREAMBLE_SCRIPT = ${JSON.stringify(preambleScript)};
|
|
516
|
+
export const renderPreambleScript = PREAMBLE_SCRIPT;
|
|
516
517
|
|
|
517
518
|
export async function renderPage(pageObj, assetTags) {
|
|
518
519
|
return renderReactPage({
|
|
@@ -523,6 +524,7 @@ ${generateComponentManifest(scan, pagesDir)}
|
|
|
523
524
|
preambleScript: PREAMBLE_SCRIPT,
|
|
524
525
|
});
|
|
525
526
|
}
|
|
527
|
+
renderPage.preambleScript = PREAMBLE_SCRIPT;
|
|
526
528
|
`;
|
|
527
529
|
}
|
|
528
530
|
function generateClientEntry(scan, pagesDir, viewTransitions, prefetch, staticPageData) {
|
|
@@ -2,7 +2,7 @@ import { a as SharedContext, i as RouterContext, n as NavigationContext, r as Pa
|
|
|
2
2
|
import { n as setActionRouter } from "../action-BFWtavbf.mjs";
|
|
3
3
|
import React, { Suspense, startTransition, use, useCallback, useEffect, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useTransition } from "react";
|
|
4
4
|
import { createPageNavigationEngine, createRouterFacade, idleNavigationState, isAbortError, isCallSiteActionError } from "void/pages-client";
|
|
5
|
-
import { hydrateRoot } from "react-dom/client";
|
|
5
|
+
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
6
6
|
//#region src/runtime/pages-client.ts
|
|
7
7
|
const deferredState = /* @__PURE__ */ new WeakMap();
|
|
8
8
|
const viewTransitionWaiters = /* @__PURE__ */ new Map();
|
|
@@ -423,12 +423,14 @@ async function startReactPages(config) {
|
|
|
423
423
|
setActionRouter(router);
|
|
424
424
|
const appEl = document.getElementById("app");
|
|
425
425
|
if (!appEl) throw new Error("pages: Missing #app element for Void React pages hydration.");
|
|
426
|
+
const app = React.createElement(App, {
|
|
427
|
+
engine,
|
|
428
|
+
router,
|
|
429
|
+
viewTransitions: config.viewTransitions
|
|
430
|
+
});
|
|
426
431
|
startTransition(() => {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
router,
|
|
430
|
-
viewTransitions: config.viewTransitions
|
|
431
|
-
}));
|
|
432
|
+
if (appEl.getAttribute("data-void-ssr") === "false") createRoot(appEl).render(app);
|
|
433
|
+
else hydrateRoot(appEl, app);
|
|
432
434
|
});
|
|
433
435
|
appEl.setAttribute("data-hydrated", "true");
|
|
434
436
|
engine.start();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/react",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"react-dom": "^19.2.6",
|
|
52
52
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.20",
|
|
53
53
|
"vite-plus": "^0.1.20",
|
|
54
|
-
"void": "0.9.
|
|
54
|
+
"void": "0.9.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "^19.0.0",
|
|
58
58
|
"react-dom": "^19.0.0",
|
|
59
59
|
"vite": "^8.0.0",
|
|
60
|
-
"void": "0.9.
|
|
60
|
+
"void": "0.9.3"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "vp pack",
|