@void/react 0.7.1 → 0.7.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/dist/plugin.mjs +24 -14
- package/dist/runtime/pages-client.mjs +13 -8
- package/package.json +11 -11
package/dist/plugin.mjs
CHANGED
|
@@ -413,6 +413,16 @@ initIslands(islands, hydrateIsland);
|
|
|
413
413
|
//#region src/plugin-pages.ts
|
|
414
414
|
const RENDERER_ID = "virtual:void-pages-renderer";
|
|
415
415
|
const CLIENT_ENTRY_ID = "virtual:void-pages-client";
|
|
416
|
+
const WORKER_ENVIRONMENT_NAME = "void_worker";
|
|
417
|
+
const REACT_DEDUPE = ["react", "react-dom"];
|
|
418
|
+
const REACT_OPTIMIZE_DEPS = [
|
|
419
|
+
"react",
|
|
420
|
+
"react/jsx-runtime",
|
|
421
|
+
"react/jsx-dev-runtime",
|
|
422
|
+
"react-dom",
|
|
423
|
+
"react-dom/client",
|
|
424
|
+
"react-dom/server"
|
|
425
|
+
];
|
|
416
426
|
/** Check if the pages directory has any non-island page files (.tsx/.jsx without .island.). */
|
|
417
427
|
function hasNonIslandPages(dir) {
|
|
418
428
|
try {
|
|
@@ -464,27 +474,27 @@ function pagesPlugin(pagesDir, options) {
|
|
|
464
474
|
if (!existsSync(pagesDir)) return;
|
|
465
475
|
if (env.command === "serve") {
|
|
466
476
|
isDev = true;
|
|
467
|
-
const reactOptimizeDeps = [
|
|
468
|
-
"react",
|
|
469
|
-
"react/jsx-runtime",
|
|
470
|
-
"react/jsx-dev-runtime",
|
|
471
|
-
"react-dom",
|
|
472
|
-
"react-dom/client",
|
|
473
|
-
"react-dom/server"
|
|
474
|
-
];
|
|
475
477
|
return {
|
|
478
|
+
resolve: { dedupe: REACT_DEDUPE },
|
|
476
479
|
optimizeDeps: {
|
|
477
480
|
exclude: ["@void/react"],
|
|
478
|
-
include:
|
|
481
|
+
include: REACT_OPTIMIZE_DEPS
|
|
479
482
|
},
|
|
480
|
-
ssr: { optimizeDeps: { include:
|
|
483
|
+
ssr: { optimizeDeps: { include: REACT_OPTIMIZE_DEPS } },
|
|
484
|
+
environments: { [WORKER_ENVIRONMENT_NAME]: { optimizeDeps: {
|
|
485
|
+
exclude: ["@void/react"],
|
|
486
|
+
include: REACT_OPTIMIZE_DEPS
|
|
487
|
+
} } }
|
|
481
488
|
};
|
|
482
489
|
}
|
|
483
490
|
if (!hasNonIslandPages(pagesDir)) return;
|
|
484
|
-
return {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
491
|
+
return {
|
|
492
|
+
resolve: { dedupe: REACT_DEDUPE },
|
|
493
|
+
build: {
|
|
494
|
+
manifest: true,
|
|
495
|
+
rollupOptions: { input: { "pages-client": CLIENT_ENTRY_ID } }
|
|
496
|
+
}
|
|
497
|
+
};
|
|
488
498
|
}
|
|
489
499
|
};
|
|
490
500
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as SharedContext, n as NavigationContext, r as RouterContext, t as ErrorsContext } from "../context-BCeFV8Jy.mjs";
|
|
2
2
|
import { n as setActionRouter } from "../action-BFWtavbf.mjs";
|
|
3
|
-
import React, { Suspense, use, useCallback, useEffect, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useTransition } from "react";
|
|
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
5
|
import { hydrateRoot } from "react-dom/client";
|
|
6
6
|
//#region src/runtime/pages-client.ts
|
|
@@ -307,7 +307,8 @@ function App({ engine, router, viewTransitions }) {
|
|
|
307
307
|
resolveViewTransition();
|
|
308
308
|
}
|
|
309
309
|
pendingVisitSettlers.delete(prepared.id);
|
|
310
|
-
|
|
310
|
+
if (prepared.method.toUpperCase() === "GET" && !prepared.options._resolveOnShell && isAbortError(error)) resolveVisit(void 0);
|
|
311
|
+
else rejectVisit(error);
|
|
311
312
|
if (activePendingNavigationId === prepared.id) activePendingNavigationId = null;
|
|
312
313
|
if (prepared.options._resolveOnShell || isAbortError(error) || isCallSiteActionError(error)) {
|
|
313
314
|
dispatch({
|
|
@@ -344,7 +345,9 @@ function App({ engine, router, viewTransitions }) {
|
|
|
344
345
|
});
|
|
345
346
|
});
|
|
346
347
|
};
|
|
347
|
-
|
|
348
|
+
next.shell.then((result) => {
|
|
349
|
+
if (result && activePendingNavigationId === next.id) startViewTransition(next, reveal, options.viewTransition ?? viewTransitions);
|
|
350
|
+
}, () => {});
|
|
348
351
|
return pagePromise;
|
|
349
352
|
}, [
|
|
350
353
|
engine,
|
|
@@ -404,11 +407,13 @@ async function startReactPages(config) {
|
|
|
404
407
|
setActionRouter(router);
|
|
405
408
|
const appEl = document.getElementById("app");
|
|
406
409
|
if (!appEl) throw new Error("pages: Missing #app element for Void React pages hydration.");
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
startTransition(() => {
|
|
411
|
+
hydrateRoot(appEl, React.createElement(App, {
|
|
412
|
+
engine,
|
|
413
|
+
router,
|
|
414
|
+
viewTransitions: config.viewTransitions
|
|
415
|
+
}));
|
|
416
|
+
});
|
|
412
417
|
appEl.setAttribute("data-hydrated", "true");
|
|
413
418
|
engine.start();
|
|
414
419
|
return { router };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/react",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -43,25 +43,25 @@
|
|
|
43
43
|
"@vitejs/plugin-react": "^6.0.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "^25.6.
|
|
46
|
+
"@types/node": "^25.6.2",
|
|
47
47
|
"@types/react": "^19.2.14",
|
|
48
48
|
"@types/react-dom": "^19.2.3",
|
|
49
49
|
"pathe": "^2.0.3",
|
|
50
|
-
"react": "^19.2.
|
|
51
|
-
"react-dom": "^19.2.
|
|
52
|
-
"
|
|
53
|
-
"vite": "^
|
|
54
|
-
"void": "0.7.
|
|
50
|
+
"react": "^19.2.6",
|
|
51
|
+
"react-dom": "^19.2.6",
|
|
52
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.20",
|
|
53
|
+
"vite-plus": "^0.1.20",
|
|
54
|
+
"void": "0.7.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "^19.0.0",
|
|
58
58
|
"react-dom": "^19.0.0",
|
|
59
|
-
"vite": "
|
|
60
|
-
"void": "0.7.
|
|
59
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.20",
|
|
60
|
+
"void": "0.7.3"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
|
-
"build": "
|
|
64
|
-
"dev": "
|
|
63
|
+
"build": "vp pack",
|
|
64
|
+
"dev": "vp pack --watch",
|
|
65
65
|
"typecheck": "tsgo --noEmit"
|
|
66
66
|
}
|
|
67
67
|
}
|