@bleedingdev/modern-js-plugin-tanstack 3.2.0-ultramodern.63 → 3.2.0-ultramodern.65
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/cjs/runtime/plugin.js +2 -5
- package/dist/cjs/runtime/plugin.node.js +2 -5
- package/dist/esm/runtime/plugin.mjs +6 -9
- package/dist/esm/runtime/plugin.node.mjs +3 -6
- package/dist/esm-node/runtime/plugin.mjs +6 -9
- package/dist/esm-node/runtime/plugin.node.mjs +3 -6
- package/package.json +8 -8
- package/src/runtime/plugin.node.tsx +2 -4
- package/src/runtime/plugin.tsx +1 -4
|
@@ -216,11 +216,8 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
216
216
|
router,
|
|
217
217
|
runtimeContext: runtimeState
|
|
218
218
|
});
|
|
219
|
-
const RouterContent = hasSSRBootstrap ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
220
|
-
|
|
221
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.RouterClient, {
|
|
222
|
-
router: router
|
|
223
|
-
})
|
|
219
|
+
const RouterContent = hasSSRBootstrap ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.RouterClient, {
|
|
220
|
+
router: router
|
|
224
221
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_router_namespaceObject.RouterProvider, {
|
|
225
222
|
router: router
|
|
226
223
|
});
|
|
@@ -292,11 +292,8 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
292
292
|
if (!router) return App ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(App, {
|
|
293
293
|
...props
|
|
294
294
|
}) : null;
|
|
295
|
-
const routerWrapper = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
296
|
-
|
|
297
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_router_namespaceObject.RouterProvider, {
|
|
298
|
-
router: router
|
|
299
|
-
})
|
|
295
|
+
const routerWrapper = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_router_namespaceObject.RouterProvider, {
|
|
296
|
+
router: router
|
|
300
297
|
});
|
|
301
298
|
return App ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(App, {
|
|
302
299
|
children: routerWrapper
|
|
@@ -4,6 +4,7 @@ import { merge } from "@modern-js/runtime-utils/merge";
|
|
|
4
4
|
import { normalizePathname } from "@modern-js/runtime-utils/url";
|
|
5
5
|
import { RouterProvider, createBrowserHistory, createHashHistory, createRouter, useLocation, useMatches, useNavigate, useRouter } from "@tanstack/react-router";
|
|
6
6
|
import { RouterClient } from "@tanstack/react-router/ssr/client";
|
|
7
|
+
import { useContext, useMemo } from "react";
|
|
7
8
|
import { createModernBasepathRewrite } from "./basepathRewrite.mjs";
|
|
8
9
|
import { modifyRoutes, onAfterCreateRouter, onAfterHydrateRouter, onBeforeCreateRouter, onBeforeCreateRoutes, onBeforeHydrateRouter } from "./hooks.mjs";
|
|
9
10
|
import { applyRouterRuntimeState } from "./lifecycle.mjs";
|
|
@@ -11,7 +12,6 @@ import { Link } from "./prefetchLink.mjs";
|
|
|
11
12
|
import { createRouteTreeFromRouteObjects } from "./routeTree.mjs";
|
|
12
13
|
import { getTanstackRscSerializationAdapters } from "./rsc/client.mjs";
|
|
13
14
|
import { createRouteObjectsFromConfig, urlJoin } from "./utils.mjs";
|
|
14
|
-
import * as __rspack_external_react from "react";
|
|
15
15
|
const BLOCKING_SUBSCRIBE_SYMBOL = Symbol.for('@modern-js/plugin-tanstack:blocking-subscribe');
|
|
16
16
|
const BLOCKING_STATE_SYMBOL = Symbol.for('@modern-js/plugin-tanstack:blocking-state');
|
|
17
17
|
function normalizeBase(b) {
|
|
@@ -109,10 +109,10 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
109
109
|
let cachedRouter = null;
|
|
110
110
|
let cachedRouterBasepath = null;
|
|
111
111
|
const RouterWrapper = ()=>{
|
|
112
|
-
const runtimeContext =
|
|
112
|
+
const runtimeContext = useContext(InternalRuntimeContext);
|
|
113
113
|
const baseUrl = selectBasePath(location.pathname).replace(/^\/*/, '/');
|
|
114
114
|
const _basename = '/' === baseUrl ? urlJoin(baseUrl, runtimeContext._internalRouterBaseName || basename || '') : baseUrl;
|
|
115
|
-
const routeTree =
|
|
115
|
+
const routeTree = useMemo(()=>{
|
|
116
116
|
if (cachedRouteTree) return cachedRouteTree;
|
|
117
117
|
const routeObjects = getRouteObjects();
|
|
118
118
|
if (!routeObjects.length) return null;
|
|
@@ -122,7 +122,7 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
122
122
|
return cachedRouteTree;
|
|
123
123
|
}, []);
|
|
124
124
|
if (!routeTree) return App ? /*#__PURE__*/ jsx(App, {}) : null;
|
|
125
|
-
const router =
|
|
125
|
+
const router = useMemo(()=>{
|
|
126
126
|
const lifecycleContext = {
|
|
127
127
|
framework: 'tanstack',
|
|
128
128
|
phase: 'client-create',
|
|
@@ -187,11 +187,8 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
187
187
|
router,
|
|
188
188
|
runtimeContext: runtimeState
|
|
189
189
|
});
|
|
190
|
-
const RouterContent = hasSSRBootstrap ? /*#__PURE__*/ jsx(
|
|
191
|
-
|
|
192
|
-
children: /*#__PURE__*/ jsx(RouterClient, {
|
|
193
|
-
router: router
|
|
194
|
-
})
|
|
190
|
+
const RouterContent = hasSSRBootstrap ? /*#__PURE__*/ jsx(RouterClient, {
|
|
191
|
+
router: router
|
|
195
192
|
}) : /*#__PURE__*/ jsx(RouterProvider, {
|
|
196
193
|
router: router
|
|
197
194
|
});
|
|
@@ -6,7 +6,7 @@ import { time } from "@modern-js/runtime-utils/time";
|
|
|
6
6
|
import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
|
|
7
7
|
import { RouterProvider, createMemoryHistory, createRouter } from "@tanstack/react-router";
|
|
8
8
|
import { attachRouterServerSsrUtils } from "@tanstack/router-core/ssr/server";
|
|
9
|
-
import {
|
|
9
|
+
import { useContext } from "react";
|
|
10
10
|
import { createModernBasepathRewrite } from "./basepathRewrite.mjs";
|
|
11
11
|
import { modifyRoutes, onAfterCreateRouter, onAfterHydrateRouter, onBeforeCreateRouter, onBeforeCreateRoutes, onBeforeHydrateRouter } from "./hooks.mjs";
|
|
12
12
|
import { applyRouterServerPrepareResult, createRouterServerSnapshot } from "./lifecycle.mjs";
|
|
@@ -263,11 +263,8 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
263
263
|
if (!router) return App ? /*#__PURE__*/ jsx(App, {
|
|
264
264
|
...props
|
|
265
265
|
}) : null;
|
|
266
|
-
const routerWrapper = /*#__PURE__*/ jsx(
|
|
267
|
-
|
|
268
|
-
children: /*#__PURE__*/ jsx(RouterProvider, {
|
|
269
|
-
router: router
|
|
270
|
-
})
|
|
266
|
+
const routerWrapper = /*#__PURE__*/ jsx(RouterProvider, {
|
|
267
|
+
router: router
|
|
271
268
|
});
|
|
272
269
|
return App ? /*#__PURE__*/ jsx(App, {
|
|
273
270
|
children: routerWrapper
|
|
@@ -5,6 +5,7 @@ import { merge } from "@modern-js/runtime-utils/merge";
|
|
|
5
5
|
import { normalizePathname } from "@modern-js/runtime-utils/url";
|
|
6
6
|
import { RouterProvider, createBrowserHistory, createHashHistory, createRouter, useLocation, useMatches, useNavigate, useRouter } from "@tanstack/react-router";
|
|
7
7
|
import { RouterClient } from "@tanstack/react-router/ssr/client";
|
|
8
|
+
import { useContext, useMemo } from "react";
|
|
8
9
|
import { createModernBasepathRewrite } from "./basepathRewrite.mjs";
|
|
9
10
|
import { modifyRoutes, onAfterCreateRouter, onAfterHydrateRouter, onBeforeCreateRouter, onBeforeCreateRoutes, onBeforeHydrateRouter } from "./hooks.mjs";
|
|
10
11
|
import { applyRouterRuntimeState } from "./lifecycle.mjs";
|
|
@@ -12,7 +13,6 @@ import { Link } from "./prefetchLink.mjs";
|
|
|
12
13
|
import { createRouteTreeFromRouteObjects } from "./routeTree.mjs";
|
|
13
14
|
import { getTanstackRscSerializationAdapters } from "./rsc/client.mjs";
|
|
14
15
|
import { createRouteObjectsFromConfig, urlJoin } from "./utils.mjs";
|
|
15
|
-
import * as __rspack_external_react from "react";
|
|
16
16
|
const BLOCKING_SUBSCRIBE_SYMBOL = Symbol.for('@modern-js/plugin-tanstack:blocking-subscribe');
|
|
17
17
|
const BLOCKING_STATE_SYMBOL = Symbol.for('@modern-js/plugin-tanstack:blocking-state');
|
|
18
18
|
function normalizeBase(b) {
|
|
@@ -110,10 +110,10 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
110
110
|
let cachedRouter = null;
|
|
111
111
|
let cachedRouterBasepath = null;
|
|
112
112
|
const RouterWrapper = ()=>{
|
|
113
|
-
const runtimeContext =
|
|
113
|
+
const runtimeContext = useContext(InternalRuntimeContext);
|
|
114
114
|
const baseUrl = selectBasePath(location.pathname).replace(/^\/*/, '/');
|
|
115
115
|
const _basename = '/' === baseUrl ? urlJoin(baseUrl, runtimeContext._internalRouterBaseName || basename || '') : baseUrl;
|
|
116
|
-
const routeTree =
|
|
116
|
+
const routeTree = useMemo(()=>{
|
|
117
117
|
if (cachedRouteTree) return cachedRouteTree;
|
|
118
118
|
const routeObjects = getRouteObjects();
|
|
119
119
|
if (!routeObjects.length) return null;
|
|
@@ -123,7 +123,7 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
123
123
|
return cachedRouteTree;
|
|
124
124
|
}, []);
|
|
125
125
|
if (!routeTree) return App ? /*#__PURE__*/ jsx(App, {}) : null;
|
|
126
|
-
const router =
|
|
126
|
+
const router = useMemo(()=>{
|
|
127
127
|
const lifecycleContext = {
|
|
128
128
|
framework: 'tanstack',
|
|
129
129
|
phase: 'client-create',
|
|
@@ -188,11 +188,8 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
188
188
|
router,
|
|
189
189
|
runtimeContext: runtimeState
|
|
190
190
|
});
|
|
191
|
-
const RouterContent = hasSSRBootstrap ? /*#__PURE__*/ jsx(
|
|
192
|
-
|
|
193
|
-
children: /*#__PURE__*/ jsx(RouterClient, {
|
|
194
|
-
router: router
|
|
195
|
-
})
|
|
191
|
+
const RouterContent = hasSSRBootstrap ? /*#__PURE__*/ jsx(RouterClient, {
|
|
192
|
+
router: router
|
|
196
193
|
}) : /*#__PURE__*/ jsx(RouterProvider, {
|
|
197
194
|
router: router
|
|
198
195
|
});
|
|
@@ -7,7 +7,7 @@ import { time } from "@modern-js/runtime-utils/time";
|
|
|
7
7
|
import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
|
|
8
8
|
import { RouterProvider, createMemoryHistory, createRouter } from "@tanstack/react-router";
|
|
9
9
|
import { attachRouterServerSsrUtils } from "@tanstack/router-core/ssr/server";
|
|
10
|
-
import {
|
|
10
|
+
import { useContext } from "react";
|
|
11
11
|
import { createModernBasepathRewrite } from "./basepathRewrite.mjs";
|
|
12
12
|
import { modifyRoutes, onAfterCreateRouter, onAfterHydrateRouter, onBeforeCreateRouter, onBeforeCreateRoutes, onBeforeHydrateRouter } from "./hooks.mjs";
|
|
13
13
|
import { applyRouterServerPrepareResult, createRouterServerSnapshot } from "./lifecycle.mjs";
|
|
@@ -264,11 +264,8 @@ const tanstackRouterPlugin = (userConfig = {})=>{
|
|
|
264
264
|
if (!router) return App ? /*#__PURE__*/ jsx(App, {
|
|
265
265
|
...props
|
|
266
266
|
}) : null;
|
|
267
|
-
const routerWrapper = /*#__PURE__*/ jsx(
|
|
268
|
-
|
|
269
|
-
children: /*#__PURE__*/ jsx(RouterProvider, {
|
|
270
|
-
router: router
|
|
271
|
-
})
|
|
267
|
+
const routerWrapper = /*#__PURE__*/ jsx(RouterProvider, {
|
|
268
|
+
router: router
|
|
272
269
|
});
|
|
273
270
|
return App ? /*#__PURE__*/ jsx(App, {
|
|
274
271
|
children: routerWrapper
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"modern.js",
|
|
19
19
|
"tanstack-router"
|
|
20
20
|
],
|
|
21
|
-
"version": "3.2.0-ultramodern.
|
|
21
|
+
"version": "3.2.0-ultramodern.65",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=20"
|
|
24
24
|
},
|
|
@@ -88,13 +88,13 @@
|
|
|
88
88
|
"@swc/helpers": "^0.5.21",
|
|
89
89
|
"@tanstack/react-router": "1.170.8",
|
|
90
90
|
"@tanstack/router-core": "1.171.6",
|
|
91
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.
|
|
92
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.2.0-ultramodern.
|
|
93
|
-
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.2.0-ultramodern.
|
|
94
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.
|
|
91
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.65",
|
|
92
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.2.0-ultramodern.65",
|
|
93
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.2.0-ultramodern.65",
|
|
94
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.65"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@modern-js/runtime": "3.2.0-ultramodern.
|
|
97
|
+
"@modern-js/runtime": "3.2.0-ultramodern.65",
|
|
98
98
|
"react": "^19.2.6",
|
|
99
99
|
"react-dom": "^19.2.6"
|
|
100
100
|
},
|
|
@@ -109,9 +109,9 @@
|
|
|
109
109
|
"@typescript/native-preview": "7.0.0-dev.20260527.2",
|
|
110
110
|
"react": "^19.2.6",
|
|
111
111
|
"react-dom": "^19.2.6",
|
|
112
|
-
"@modern-js/
|
|
112
|
+
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.2.0-ultramodern.65",
|
|
113
113
|
"@scripts/rstest-config": "2.66.0",
|
|
114
|
-
"@modern-js/
|
|
114
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.2.0-ultramodern.65"
|
|
115
115
|
},
|
|
116
116
|
"sideEffects": false,
|
|
117
117
|
"publishConfig": {
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from '@tanstack/react-router';
|
|
29
29
|
import { attachRouterServerSsrUtils } from '@tanstack/router-core/ssr/server';
|
|
30
30
|
import type React from 'react';
|
|
31
|
-
import {
|
|
31
|
+
import { useContext } from 'react';
|
|
32
32
|
import { createModernBasepathRewrite } from './basepathRewrite';
|
|
33
33
|
import {
|
|
34
34
|
modifyRoutes as modifyRoutesHook,
|
|
@@ -557,9 +557,7 @@ export const tanstackRouterPlugin = (
|
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
const routerWrapper = (
|
|
560
|
-
<
|
|
561
|
-
<RouterProvider router={router as AnyRouter} />
|
|
562
|
-
</Suspense>
|
|
560
|
+
<RouterProvider router={router as AnyRouter} />
|
|
563
561
|
);
|
|
564
562
|
|
|
565
563
|
return App ? <App>{routerWrapper}</App> : routerWrapper;
|
package/src/runtime/plugin.tsx
CHANGED
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
useRouter,
|
|
26
26
|
} from '@tanstack/react-router';
|
|
27
27
|
import { RouterClient } from '@tanstack/react-router/ssr/client';
|
|
28
|
-
import * as React from 'react';
|
|
29
28
|
import { useContext, useMemo } from 'react';
|
|
30
29
|
import { createModernBasepathRewrite } from './basepathRewrite';
|
|
31
30
|
import {
|
|
@@ -370,9 +369,7 @@ export const tanstackRouterPlugin = (
|
|
|
370
369
|
}
|
|
371
370
|
|
|
372
371
|
const RouterContent = hasSSRBootstrap ? (
|
|
373
|
-
<
|
|
374
|
-
<RouterClient router={router} />
|
|
375
|
-
</React.Suspense>
|
|
372
|
+
<RouterClient router={router} />
|
|
376
373
|
) : (
|
|
377
374
|
<RouterProvider router={router} />
|
|
378
375
|
);
|