@modern-js/runtime 2.60.0 → 2.60.1-alpha.0

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.
@@ -139,7 +139,7 @@ const routerPlugin = (userConfig = {}) => {
139
139
  return (props) => {
140
140
  beforeCreateRouter = false;
141
141
  const router = useCreateRouter(props);
142
- return (
142
+ const routerWrapper = (
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,6 +153,9 @@ const routerPlugin = (userConfig = {}) => {
153
153
  ]
154
154
  })
155
155
  );
156
+ return App ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
157
+ children: routerWrapper
158
+ }) : routerWrapper;
156
159
  };
157
160
  };
158
161
  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
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
128
+ const routerWrapper = /* @__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,6 +141,9 @@ 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;
144
147
  };
145
148
  };
146
149
  return getRouteApp();
@@ -124,7 +124,7 @@ var routerPlugin = function() {
124
124
  return function(props) {
125
125
  beforeCreateRouter = false;
126
126
  var router = useCreateRouter(props);
127
- return (
127
+ var routerWrapper = (
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,6 +138,9 @@ var routerPlugin = function() {
138
138
  ]
139
139
  })
140
140
  );
141
+ return App ? /* @__PURE__ */ _jsx(App, {
142
+ children: routerWrapper
143
+ }) : routerWrapper;
141
144
  };
142
145
  };
143
146
  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
- return /* @__PURE__ */ _jsxs(_Fragment, {
119
+ var routerWrapper = /* @__PURE__ */ _jsxs(_Fragment, {
120
120
  children: [
121
121
  /* @__PURE__ */ _jsx(StaticRouterProvider, {
122
122
  router: remixRouter,
@@ -132,6 +132,9 @@ 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;
135
138
  };
136
139
  };
137
140
  return getRouteApp();
@@ -113,7 +113,7 @@ const routerPlugin = (userConfig = {}) => {
113
113
  return (props) => {
114
114
  beforeCreateRouter = false;
115
115
  const router = useCreateRouter(props);
116
- return (
116
+ const routerWrapper = (
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,6 +127,9 @@ const routerPlugin = (userConfig = {}) => {
127
127
  ]
128
128
  })
129
129
  );
130
+ return App ? /* @__PURE__ */ _jsx(App, {
131
+ children: routerWrapper
132
+ }) : routerWrapper;
130
133
  };
131
134
  };
132
135
  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
- return /* @__PURE__ */ _jsxs(_Fragment, {
94
+ const routerWrapper = /* @__PURE__ */ _jsxs(_Fragment, {
95
95
  children: [
96
96
  /* @__PURE__ */ _jsx(StaticRouterProvider, {
97
97
  router: remixRouter,
@@ -107,6 +107,9 @@ 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;
110
113
  };
111
114
  };
112
115
  return getRouteApp();
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.60.0",
18
+ "version": "2.60.1-alpha.0",
19
19
  "engines": {
20
20
  "node": ">=14.17.6"
21
21
  },
@@ -200,8 +200,8 @@
200
200
  "react-side-effect": "^2.1.1",
201
201
  "styled-components": "^5.3.1",
202
202
  "@modern-js/plugin": "2.60.0",
203
- "@modern-js/runtime-utils": "2.60.0",
204
203
  "@modern-js/types": "2.60.0",
204
+ "@modern-js/runtime-utils": "2.60.0",
205
205
  "@modern-js/utils": "2.60.0",
206
206
  "@modern-js/plugin-data-loader": "2.60.0"
207
207
  },
@@ -226,9 +226,9 @@
226
226
  "ts-jest": "^29.1.0",
227
227
  "typescript": "^5",
228
228
  "webpack": "^5.94.0",
229
- "@modern-js/core": "2.60.0",
230
- "@modern-js/app-tools": "2.60.0",
231
229
  "@scripts/build": "2.60.0",
230
+ "@modern-js/app-tools": "2.60.0",
231
+ "@modern-js/core": "2.60.0",
232
232
  "@scripts/jest-config": "2.60.0"
233
233
  },
234
234
  "sideEffects": false,