@modern-js/runtime 2.60.1-alpha.0 → 2.60.1-alpha.1
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/router/runtime/plugin.js +3 -6
- package/dist/cjs/router/runtime/plugin.node.js +1 -4
- package/dist/esm/router/runtime/plugin.js +3 -6
- package/dist/esm/router/runtime/plugin.node.js +1 -4
- package/dist/esm-node/router/runtime/plugin.js +3 -6
- package/dist/esm-node/router/runtime/plugin.node.js +1 -4
- package/package.json +7 -8
|
@@ -84,8 +84,8 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
84
84
|
const useCreateRouter = (props) => {
|
|
85
85
|
var _window__SERVER_DATA;
|
|
86
86
|
const runtimeContext = (0, import_react.useContext)(import_core.RuntimeReactContext);
|
|
87
|
-
const baseUrl = (
|
|
88
|
-
const _basename = baseUrl === "/" ? (0, import_utils.urlJoin)(baseUrl, basename) : baseUrl;
|
|
87
|
+
const baseUrl = (((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname)).replace(/^\/*/, "/");
|
|
88
|
+
const _basename = baseUrl === "/" ? (0, import_utils.urlJoin)(baseUrl, runtimeContext._internalRouterBaseName || basename) : baseUrl;
|
|
89
89
|
let hydrationData = window._ROUTER_DATA;
|
|
90
90
|
const { unstable_getBlockNavState: getBlockNavState } = runtimeContext;
|
|
91
91
|
return (0, import_react.useMemo)(() => {
|
|
@@ -139,7 +139,7 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
139
139
|
return (props) => {
|
|
140
140
|
beforeCreateRouter = false;
|
|
141
141
|
const router = useCreateRouter(props);
|
|
142
|
-
|
|
142
|
+
return (
|
|
143
143
|
// To match the node tree about https://github.com/web-infra-dev/modern.js/blob/v2.59.0/packages/runtime/plugin-runtime/src/router/runtime/plugin.node.tsx#L150-L168
|
|
144
144
|
// According to react [useId generation algorithm](https://github.com/facebook/react/pull/22644), `useId` will generate id with the react node react struct.
|
|
145
145
|
// To void hydration failed, we must guarantee that the node tree when browser hydrate must have same struct with node tree when ssr render.
|
|
@@ -153,9 +153,6 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
153
153
|
]
|
|
154
154
|
})
|
|
155
155
|
);
|
|
156
|
-
return App ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
|
157
|
-
children: routerWrapper
|
|
158
|
-
}) : routerWrapper;
|
|
159
156
|
};
|
|
160
157
|
};
|
|
161
158
|
return getRouteApp();
|
|
@@ -125,7 +125,7 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
125
125
|
const context = (0, import_react.useContext)(import_core.RuntimeReactContext);
|
|
126
126
|
const { remixRouter, routerContext, ssrContext } = context;
|
|
127
127
|
const { nonce, mode } = ssrContext;
|
|
128
|
-
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
129
129
|
children: [
|
|
130
130
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_router.StaticRouterProvider, {
|
|
131
131
|
router: remixRouter,
|
|
@@ -141,9 +141,6 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
141
141
|
mode === "stream" && import_common.JSX_SHELL_STREAM_END_MARK
|
|
142
142
|
]
|
|
143
143
|
});
|
|
144
|
-
return App ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
|
145
|
-
children: routerWrapper
|
|
146
|
-
}) : routerWrapper;
|
|
147
144
|
};
|
|
148
145
|
};
|
|
149
146
|
return getRouteApp();
|
|
@@ -65,8 +65,8 @@ var routerPlugin = function() {
|
|
|
65
65
|
var useCreateRouter = function(props) {
|
|
66
66
|
var _window__SERVER_DATA;
|
|
67
67
|
var runtimeContext = useContext(RuntimeReactContext);
|
|
68
|
-
var baseUrl = (
|
|
69
|
-
var _basename = baseUrl === "/" ? urlJoin(baseUrl, basename) : baseUrl;
|
|
68
|
+
var baseUrl = (((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname)).replace(/^\/*/, "/");
|
|
69
|
+
var _basename = baseUrl === "/" ? urlJoin(baseUrl, runtimeContext._internalRouterBaseName || basename) : baseUrl;
|
|
70
70
|
var hydrationData = window._ROUTER_DATA;
|
|
71
71
|
var getBlockNavState = runtimeContext.unstable_getBlockNavState;
|
|
72
72
|
return useMemo(function() {
|
|
@@ -124,7 +124,7 @@ var routerPlugin = function() {
|
|
|
124
124
|
return function(props) {
|
|
125
125
|
beforeCreateRouter = false;
|
|
126
126
|
var router = useCreateRouter(props);
|
|
127
|
-
|
|
127
|
+
return (
|
|
128
128
|
// To match the node tree about https://github.com/web-infra-dev/modern.js/blob/v2.59.0/packages/runtime/plugin-runtime/src/router/runtime/plugin.node.tsx#L150-L168
|
|
129
129
|
// According to react [useId generation algorithm](https://github.com/facebook/react/pull/22644), `useId` will generate id with the react node react struct.
|
|
130
130
|
// To void hydration failed, we must guarantee that the node tree when browser hydrate must have same struct with node tree when ssr render.
|
|
@@ -138,9 +138,6 @@ var routerPlugin = function() {
|
|
|
138
138
|
]
|
|
139
139
|
})
|
|
140
140
|
);
|
|
141
|
-
return App ? /* @__PURE__ */ _jsx(App, {
|
|
142
|
-
children: routerWrapper
|
|
143
|
-
}) : routerWrapper;
|
|
144
141
|
};
|
|
145
142
|
};
|
|
146
143
|
return getRouteApp();
|
|
@@ -116,7 +116,7 @@ var routerPlugin = function() {
|
|
|
116
116
|
var context = useContext(RuntimeReactContext);
|
|
117
117
|
var remixRouter = context.remixRouter, routerContext = context.routerContext, ssrContext = context.ssrContext;
|
|
118
118
|
var nonce = ssrContext.nonce, mode = ssrContext.mode;
|
|
119
|
-
|
|
119
|
+
return /* @__PURE__ */ _jsxs(_Fragment, {
|
|
120
120
|
children: [
|
|
121
121
|
/* @__PURE__ */ _jsx(StaticRouterProvider, {
|
|
122
122
|
router: remixRouter,
|
|
@@ -132,9 +132,6 @@ var routerPlugin = function() {
|
|
|
132
132
|
mode === "stream" && JSX_SHELL_STREAM_END_MARK
|
|
133
133
|
]
|
|
134
134
|
});
|
|
135
|
-
return App ? /* @__PURE__ */ _jsx(App, {
|
|
136
|
-
children: routerWrapper
|
|
137
|
-
}) : routerWrapper;
|
|
138
135
|
};
|
|
139
136
|
};
|
|
140
137
|
return getRouteApp();
|
|
@@ -58,8 +58,8 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
58
58
|
const useCreateRouter = (props) => {
|
|
59
59
|
var _window__SERVER_DATA;
|
|
60
60
|
const runtimeContext = useContext(RuntimeReactContext);
|
|
61
|
-
const baseUrl = (
|
|
62
|
-
const _basename = baseUrl === "/" ? urlJoin(baseUrl, basename) : baseUrl;
|
|
61
|
+
const baseUrl = (((_window__SERVER_DATA = window._SERVER_DATA) === null || _window__SERVER_DATA === void 0 ? void 0 : _window__SERVER_DATA.router.baseUrl) || select(location.pathname)).replace(/^\/*/, "/");
|
|
62
|
+
const _basename = baseUrl === "/" ? urlJoin(baseUrl, runtimeContext._internalRouterBaseName || basename) : baseUrl;
|
|
63
63
|
let hydrationData = window._ROUTER_DATA;
|
|
64
64
|
const { unstable_getBlockNavState: getBlockNavState } = runtimeContext;
|
|
65
65
|
return useMemo(() => {
|
|
@@ -113,7 +113,7 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
113
113
|
return (props) => {
|
|
114
114
|
beforeCreateRouter = false;
|
|
115
115
|
const router = useCreateRouter(props);
|
|
116
|
-
|
|
116
|
+
return (
|
|
117
117
|
// To match the node tree about https://github.com/web-infra-dev/modern.js/blob/v2.59.0/packages/runtime/plugin-runtime/src/router/runtime/plugin.node.tsx#L150-L168
|
|
118
118
|
// According to react [useId generation algorithm](https://github.com/facebook/react/pull/22644), `useId` will generate id with the react node react struct.
|
|
119
119
|
// To void hydration failed, we must guarantee that the node tree when browser hydrate must have same struct with node tree when ssr render.
|
|
@@ -127,9 +127,6 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
127
127
|
]
|
|
128
128
|
})
|
|
129
129
|
);
|
|
130
|
-
return App ? /* @__PURE__ */ _jsx(App, {
|
|
131
|
-
children: routerWrapper
|
|
132
|
-
}) : routerWrapper;
|
|
133
130
|
};
|
|
134
131
|
};
|
|
135
132
|
return getRouteApp();
|
|
@@ -91,7 +91,7 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
91
91
|
const context = useContext(RuntimeReactContext);
|
|
92
92
|
const { remixRouter, routerContext, ssrContext } = context;
|
|
93
93
|
const { nonce, mode } = ssrContext;
|
|
94
|
-
|
|
94
|
+
return /* @__PURE__ */ _jsxs(_Fragment, {
|
|
95
95
|
children: [
|
|
96
96
|
/* @__PURE__ */ _jsx(StaticRouterProvider, {
|
|
97
97
|
router: remixRouter,
|
|
@@ -107,9 +107,6 @@ const routerPlugin = (userConfig = {}) => {
|
|
|
107
107
|
mode === "stream" && JSX_SHELL_STREAM_END_MARK
|
|
108
108
|
]
|
|
109
109
|
});
|
|
110
|
-
return App ? /* @__PURE__ */ _jsx(App, {
|
|
111
|
-
children: routerWrapper
|
|
112
|
-
}) : routerWrapper;
|
|
113
110
|
};
|
|
114
111
|
};
|
|
115
112
|
return getRouteApp();
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.60.1-alpha.
|
|
18
|
+
"version": "2.60.1-alpha.1",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14.17.6"
|
|
21
21
|
},
|
|
@@ -199,11 +199,11 @@
|
|
|
199
199
|
"react-is": "^18",
|
|
200
200
|
"react-side-effect": "^2.1.1",
|
|
201
201
|
"styled-components": "^5.3.1",
|
|
202
|
-
"@modern-js/plugin": "2.60.0",
|
|
203
|
-
"@modern-js/types": "2.60.0",
|
|
204
202
|
"@modern-js/runtime-utils": "2.60.0",
|
|
203
|
+
"@modern-js/types": "2.60.0",
|
|
205
204
|
"@modern-js/utils": "2.60.0",
|
|
206
|
-
"@modern-js/plugin-data-loader": "2.60.0"
|
|
205
|
+
"@modern-js/plugin-data-loader": "2.60.0",
|
|
206
|
+
"@modern-js/plugin": "2.60.0"
|
|
207
207
|
},
|
|
208
208
|
"peerDependencies": {
|
|
209
209
|
"react": ">=17",
|
|
@@ -228,14 +228,13 @@
|
|
|
228
228
|
"webpack": "^5.94.0",
|
|
229
229
|
"@scripts/build": "2.60.0",
|
|
230
230
|
"@modern-js/app-tools": "2.60.0",
|
|
231
|
-
"@
|
|
232
|
-
"@
|
|
231
|
+
"@scripts/jest-config": "2.60.0",
|
|
232
|
+
"@modern-js/core": "2.60.0"
|
|
233
233
|
},
|
|
234
234
|
"sideEffects": false,
|
|
235
235
|
"publishConfig": {
|
|
236
236
|
"registry": "https://registry.npmjs.org/",
|
|
237
|
-
"access": "public"
|
|
238
|
-
"provenance": true
|
|
237
|
+
"access": "public"
|
|
239
238
|
},
|
|
240
239
|
"scripts": {
|
|
241
240
|
"dev": "modern-lib build --watch",
|