@modern-js/runtime 2.50.0 → 2.52.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.
Files changed (23) hide show
  1. package/dist/cjs/core/compatible.js +8 -4
  2. package/dist/cjs/router/runtime/DeferredDataScripts.node.js +2 -5
  3. package/dist/cjs/router/runtime/plugin.node.js +17 -7
  4. package/dist/cjs/ssr/serverRender/renderToStream/bulidTemplate.before.js +7 -4
  5. package/dist/cjs/ssr/serverRender/renderToStream/renderToPipe.js +19 -7
  6. package/dist/cjs/ssr/serverRender/renderToStream/template.js +2 -2
  7. package/dist/esm/core/compatible.js +9 -3
  8. package/dist/esm/router/runtime/DeferredDataScripts.node.js +4 -7
  9. package/dist/esm/router/runtime/plugin.node.js +18 -8
  10. package/dist/esm/ssr/serverRender/renderToStream/bulidTemplate.before.js +10 -5
  11. package/dist/esm/ssr/serverRender/renderToStream/renderToPipe.js +18 -7
  12. package/dist/esm/ssr/serverRender/renderToStream/template.js +3 -3
  13. package/dist/esm-node/core/compatible.js +8 -4
  14. package/dist/esm-node/router/runtime/DeferredDataScripts.node.js +4 -7
  15. package/dist/esm-node/router/runtime/plugin.node.js +18 -8
  16. package/dist/esm-node/ssr/serverRender/renderToStream/bulidTemplate.before.js +7 -4
  17. package/dist/esm-node/ssr/serverRender/renderToStream/renderToPipe.js +19 -7
  18. package/dist/esm-node/ssr/serverRender/renderToStream/template.js +2 -2
  19. package/dist/types/router/runtime/DeferredDataScripts.node.d.ts +2 -0
  20. package/dist/types/router/runtime/types.d.ts +1 -1
  21. package/dist/types/ssr/serverRender/renderToStream/bulidTemplate.before.d.ts +1 -1
  22. package/dist/types/ssr/serverRender/renderToStream/template.d.ts +1 -1
  23. package/package.json +10 -10
@@ -57,13 +57,12 @@ const createApp = ({ plugins, props: globalProps }) => {
57
57
  return (App) => {
58
58
  const runner = appRuntime.init();
59
59
  const WrapperComponent = (props) => {
60
- var _props_children;
61
60
  const element = /* @__PURE__ */ import_react.default.createElement(App || import_react.default.Fragment, App ? {
62
61
  ...props
63
- } : null, App ? props.children : /* @__PURE__ */ import_react.default.cloneElement(props.children, {
64
- ...(_props_children = props.children) === null || _props_children === void 0 ? void 0 : _props_children.props,
62
+ } : null, App ? props.children : import_react.default.Children.map(props.children, (child) => /* @__PURE__ */ import_react.default.isValidElement(child) ? /* @__PURE__ */ import_react.default.cloneElement(child, {
63
+ ...child.props,
65
64
  ...props
66
- }));
65
+ }) : child));
67
66
  const context = (0, import_react.useContext)(import_runtimeContext.RuntimeReactContext);
68
67
  return runner.provide({
69
68
  element,
@@ -241,7 +240,12 @@ const bootstrap = async (BootApp, id, root, ReactDOM) => {
241
240
  };
242
241
  const initialData = await runInit(context);
243
242
  if (!isRedirectResponse(initialData)) {
243
+ var _context_routerContext, _context_routerContext1;
244
244
  context.initialData = initialData;
245
+ if (((_context_routerContext = context.routerContext) === null || _context_routerContext === void 0 ? void 0 : _context_routerContext.statusCode) && ((_context_routerContext1 = context.routerContext) === null || _context_routerContext1 === void 0 ? void 0 : _context_routerContext1.statusCode) !== 200) {
246
+ var _context_routerContext2, _context_ssrContext;
247
+ (_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.response.status((_context_routerContext2 = context.routerContext) === null || _context_routerContext2 === void 0 ? void 0 : _context_routerContext2.statusCode);
248
+ }
245
249
  return runner.server({
246
250
  App,
247
251
  context
@@ -25,14 +25,12 @@ var import_jsx_runtime = require("react/jsx-runtime");
25
25
  var import_react = require("react");
26
26
  var import_router = require("@modern-js/runtime-utils/router");
27
27
  var import_node = require("@modern-js/runtime-utils/node");
28
- var import_common = require("../../common");
29
28
  var import_utils = require("./utils");
30
29
  const setupFnStr = `function s(r,e){_ROUTER_DATA.r=_ROUTER_DATA.r||{},_ROUTER_DATA.r[r]=_ROUTER_DATA.r[r]||{};return new Promise((function(A,R){_ROUTER_DATA.r[r][e]={resolve:A,reject:R}}))};`;
31
30
  const resolveFnStr = `function r(e,r,o,A){A?_ROUTER_DATA.r[e][r].reject(A):_ROUTER_DATA.r[e][r].resolve(o)};`;
32
31
  const preResolvedFnStr = `function p(e,r){return void 0!==r?Promise.reject(new Error(r.message)):Promise.resolve(e)};`;
33
32
  const DeferredDataScripts = (props) => {
34
- const context = (0, import_react.useContext)(import_router.UNSAFE_DataRouterContext);
35
- const { staticContext } = context || {};
33
+ const staticContext = props === null || props === void 0 ? void 0 : props.context;
36
34
  const hydratedRef = (0, import_react.useRef)(false);
37
35
  (0, import_react.useEffect)(() => {
38
36
  hydratedRef.current = true;
@@ -101,8 +99,7 @@ const DeferredDataScripts = (props) => {
101
99
  __html: deferredScripts[0]
102
100
  }
103
101
  }),
104
- !hydratedRef.current && deferredScripts[1],
105
- import_common.JSX_SHELL_STREAM_END_MARK
102
+ !hydratedRef.current && deferredScripts[1]
106
103
  ]
107
104
  });
108
105
  };
@@ -42,9 +42,11 @@ var import_router2 = require("@modern-js/runtime-utils/router");
42
42
  var import_node = require("@modern-js/runtime-utils/node");
43
43
  var import_time = require("@modern-js/runtime-utils/time");
44
44
  var import_constants = require("@modern-js/utils/universal/constants");
45
+ var import_common = require("../../common");
45
46
  var import_core = require("../../core");
46
47
  var import_utils = require("./utils");
47
48
  var import_hooks = require("./hooks");
49
+ var import_DeferredDataScripts = __toESM(require("./DeferredDataScripts.node"));
48
50
  function createFetchRequest(req) {
49
51
  const origin = `${req.protocol}://${req.host}`;
50
52
  const url = new URL(req.originalUrl || req.url, origin);
@@ -133,14 +135,22 @@ const routerPlugin = ({ basename = "", originalBaseUrl = "", routesConfig, creat
133
135
  }
134
136
  const getRouteApp = () => {
135
137
  return (props) => {
136
- const { remixRouter, routerContext } = (0, import_react.useContext)(import_core.RuntimeReactContext);
137
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
138
+ const { remixRouter, routerContext, ssrContext } = (0, import_react.useContext)(import_core.RuntimeReactContext);
139
+ const { nonce, mode } = ssrContext;
140
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(App, {
138
141
  ...props,
139
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_router.StaticRouterProvider, {
140
- router: remixRouter,
141
- context: routerContext,
142
- hydrate: false
143
- })
142
+ children: [
143
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_router.StaticRouterProvider, {
144
+ router: remixRouter,
145
+ context: routerContext,
146
+ hydrate: false
147
+ }),
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DeferredDataScripts.default, {
149
+ nonce,
150
+ context: routerContext
151
+ }),
152
+ mode === "stream" && import_common.JSX_SHELL_STREAM_END_MARK
153
+ ]
144
154
  });
145
155
  };
146
156
  };
@@ -54,18 +54,21 @@ const checkIsInline = (chunk, enableInline) => {
54
54
  return false;
55
55
  }
56
56
  };
57
- async function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
57
+ async function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig, styledComponentsStyleTags) {
58
58
  const helmetData = import_react_helmet.default.renderStatic();
59
59
  const callbacks = [
60
60
  (headTemplate) => {
61
61
  return helmetData ? (0, import_helmet.default)(headTemplate, helmetData) : headTemplate;
62
62
  },
63
63
  // @TODO: prefetch scripts of lazy component
64
- injectCss
64
+ (template) => injectCss(template, styledComponentsStyleTags)
65
65
  ];
66
66
  return (0, import_buildTemplate.buildTemplate)(beforeAppTemplate, callbacks);
67
- async function injectCss(template) {
68
- const css = await getCssChunks();
67
+ async function injectCss(template, styledComponentsStyleTags2) {
68
+ let css = await getCssChunks();
69
+ if (styledComponentsStyleTags2) {
70
+ css += styledComponentsStyleTags2;
71
+ }
69
72
  return (0, import_utils.safeReplace)(template, import_constants.CHUNK_CSS_PLACEHOLDER, css);
70
73
  async function getCssChunks() {
71
74
  const { routeManifest, routerContext, routes } = context;
@@ -22,6 +22,7 @@ __export(renderToPipe_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(renderToPipe_exports);
24
24
  var import_stream = require("stream");
25
+ var import_styled_components = require("styled-components");
25
26
  var import_types = require("../types");
26
27
  var import_common = require("../../../common");
27
28
  var import_template = require("./template");
@@ -33,7 +34,9 @@ var ShellChunkStatus;
33
34
  function renderToPipe(rootElement, context, pluginConfig, options) {
34
35
  var _context_ssrContext;
35
36
  let shellChunkStatus = 0;
36
- const onReady = ((_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.isSpider) ? "onAllReady" : "onShellReady";
37
+ const forceStream2String = Boolean(process.env.MODERN_JS_STREAM_TO_STRING);
38
+ const onReady = ((_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.isSpider) || forceStream2String ? "onAllReady" : "onShellReady";
39
+ const sheet = new import_styled_components.ServerStyleSheet();
37
40
  const { ssrContext } = context;
38
41
  const chunkVec = [];
39
42
  const forUserPipe = new Promise((resolve) => {
@@ -42,20 +45,23 @@ function renderToPipe(rootElement, context, pluginConfig, options) {
42
45
  ({ renderToPipeableStream } = require("react-dom/server"));
43
46
  } catch (e) {
44
47
  }
45
- const { pipe } = renderToPipeableStream(rootElement, {
48
+ const root = forceStream2String ? sheet.collectStyles(rootElement) : rootElement;
49
+ let renderLevel = import_types.RenderLevel.SERVER_RENDER;
50
+ const { pipe } = renderToPipeableStream(root, {
46
51
  ...options,
47
52
  nonce: ssrContext === null || ssrContext === void 0 ? void 0 : ssrContext.nonce,
48
53
  [onReady]() {
49
- (0, import_template.getTemplates)(context, import_types.RenderLevel.SERVER_RENDER, pluginConfig).then(({ shellAfter, shellBefore }) => {
50
- var _options_onShellReady;
51
- options === null || options === void 0 ? void 0 : (_options_onShellReady = options.onShellReady) === null || _options_onShellReady === void 0 ? void 0 : _options_onShellReady.call(options);
54
+ const styledComponentsStyleTags = forceStream2String ? sheet.getStyleTags() : "";
55
+ (0, import_template.getTemplates)(context, renderLevel, pluginConfig, styledComponentsStyleTags).then(({ shellAfter, shellBefore }) => {
56
+ var _options_onReady;
57
+ options === null || options === void 0 ? void 0 : (_options_onReady = options[onReady]) === null || _options_onReady === void 0 ? void 0 : _options_onReady.call(options);
52
58
  const injectableTransform = new import_stream.Transform({
53
59
  transform(chunk, _encoding, callback) {
54
60
  try {
55
61
  if (shellChunkStatus !== 1) {
56
62
  chunkVec.push(chunk.toString());
57
63
  let concatedChunk = chunkVec.join("");
58
- if (concatedChunk.endsWith(import_common.ESCAPED_SHELL_STREAM_END_MARK)) {
64
+ if (concatedChunk.includes(import_common.ESCAPED_SHELL_STREAM_END_MARK)) {
59
65
  concatedChunk = concatedChunk.replace(import_common.ESCAPED_SHELL_STREAM_END_MARK, "");
60
66
  shellChunkStatus = 1;
61
67
  this.push(`${shellBefore}${concatedChunk}${shellAfter}`);
@@ -78,12 +84,18 @@ function renderToPipe(rootElement, context, pluginConfig, options) {
78
84
  });
79
85
  },
80
86
  onShellError(error) {
81
- (0, import_template.getTemplates)(context, import_types.RenderLevel.CLIENT_RENDER, pluginConfig).then(({ shellAfter, shellBefore }) => {
87
+ renderLevel = import_types.RenderLevel.CLIENT_RENDER;
88
+ (0, import_template.getTemplates)(context, renderLevel, pluginConfig).then(({ shellAfter, shellBefore }) => {
82
89
  var _options_onShellError;
83
90
  const fallbackHtml = `${shellBefore}${shellAfter}`;
84
91
  resolve(fallbackHtml);
85
92
  options === null || options === void 0 ? void 0 : (_options_onShellError = options.onShellError) === null || _options_onShellError === void 0 ? void 0 : _options_onShellError.call(options, error);
86
93
  });
94
+ },
95
+ onError(error) {
96
+ var _options_onError;
97
+ renderLevel = import_types.RenderLevel.CLIENT_RENDER;
98
+ options === null || options === void 0 ? void 0 : (_options_onError = options.onError) === null || _options_onError === void 0 ? void 0 : _options_onError.call(options, error);
87
99
  }
88
100
  });
89
101
  });
@@ -24,10 +24,10 @@ module.exports = __toCommonJS(template_exports);
24
24
  var import_buildTemplate = require("./buildTemplate.after");
25
25
  var import_bulidTemplate = require("./bulidTemplate.before");
26
26
  const HTML_SEPARATOR = "<!--<?- html ?>-->";
27
- const getTemplates = async (context, renderLevel, pluginConfig) => {
27
+ const getTemplates = async (context, renderLevel, pluginConfig, styledComponentsStyleTags) => {
28
28
  const { ssrContext } = context;
29
29
  const [beforeAppTemplate = "", afterAppHtmlTemplate = ""] = ssrContext.template.split(HTML_SEPARATOR) || [];
30
- const builtBeforeTemplate = await (0, import_bulidTemplate.buildShellBeforeTemplate)(beforeAppTemplate, context, pluginConfig);
30
+ const builtBeforeTemplate = await (0, import_bulidTemplate.buildShellBeforeTemplate)(beforeAppTemplate, context, pluginConfig, styledComponentsStyleTags);
31
31
  const builtAfterTemplate = await (0, import_buildTemplate.buildShellAfterTemplate)(afterAppHtmlTemplate, {
32
32
  context,
33
33
  renderLevel
@@ -32,8 +32,9 @@ var createApp = function(param) {
32
32
  return function(App) {
33
33
  var runner = appRuntime.init();
34
34
  var WrapperComponent = function(props) {
35
- var _props_children;
36
- var element = /* @__PURE__ */ React.createElement(App || React.Fragment, App ? _object_spread({}, props) : null, App ? props.children : /* @__PURE__ */ React.cloneElement(props.children, _object_spread({}, (_props_children = props.children) === null || _props_children === void 0 ? void 0 : _props_children.props, props)));
35
+ var element = /* @__PURE__ */ React.createElement(App || React.Fragment, App ? _object_spread({}, props) : null, App ? props.children : React.Children.map(props.children, function(child) {
36
+ return /* @__PURE__ */ React.isValidElement(child) ? /* @__PURE__ */ React.cloneElement(child, _object_spread({}, child.props, props)) : child;
37
+ }));
37
38
  var context = useContext(RuntimeReactContext);
38
39
  return runner.provide({
39
40
  element,
@@ -86,7 +87,7 @@ var createApp = function(param) {
86
87
  };
87
88
  var bootstrap = function() {
88
89
  var _ref = _async_to_generator(function(BootApp, id, root, ReactDOM) {
89
- var App, runner, context, runInit, isBrowser, _ssrData_data, _ssrData_data1, ssrData, loadersData, initialLoadersState, initialData, rootElement, ModernRender, ModernHydrate, isRedirectResponse, initialData1;
90
+ var App, runner, context, runInit, isBrowser, _ssrData_data, _ssrData_data1, ssrData, loadersData, initialLoadersState, initialData, rootElement, ModernRender, ModernHydrate, isRedirectResponse, initialData1, _context_routerContext, _context_routerContext1, _context_routerContext2, _context_ssrContext;
90
91
  return _ts_generator(this, function(_state) {
91
92
  switch (_state.label) {
92
93
  case 0:
@@ -247,7 +248,12 @@ var bootstrap = function() {
247
248
  case 5:
248
249
  initialData1 = _state.sent();
249
250
  if (!isRedirectResponse(initialData1)) {
251
+ ;
250
252
  context.initialData = initialData1;
253
+ if (((_context_routerContext = context.routerContext) === null || _context_routerContext === void 0 ? void 0 : _context_routerContext.statusCode) && ((_context_routerContext1 = context.routerContext) === null || _context_routerContext1 === void 0 ? void 0 : _context_routerContext1.statusCode) !== 200) {
254
+ ;
255
+ (_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.response.status((_context_routerContext2 = context.routerContext) === null || _context_routerContext2 === void 0 ? void 0 : _context_routerContext2.statusCode);
256
+ }
251
257
  return [
252
258
  2,
253
259
  runner.server({
@@ -1,16 +1,14 @@
1
1
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Suspense, useEffect, useRef, useMemo, useContext } from "react";
4
- import { Await, UNSAFE_DataRouterContext as DataRouterContext, useAsyncError } from "@modern-js/runtime-utils/router";
3
+ import { Suspense, useEffect, useRef, useMemo } from "react";
4
+ import { Await, useAsyncError } from "@modern-js/runtime-utils/router";
5
5
  import { serializeJson } from "@modern-js/runtime-utils/node";
6
- import { JSX_SHELL_STREAM_END_MARK } from "../../common";
7
6
  import { serializeErrors } from "./utils";
8
7
  var setupFnStr = "function s(r,e){_ROUTER_DATA.r=_ROUTER_DATA.r||{},_ROUTER_DATA.r[r]=_ROUTER_DATA.r[r]||{};return new Promise((function(A,R){_ROUTER_DATA.r[r][e]={resolve:A,reject:R}}))};";
9
8
  var resolveFnStr = "function r(e,r,o,A){A?_ROUTER_DATA.r[e][r].reject(A):_ROUTER_DATA.r[e][r].resolve(o)};";
10
9
  var preResolvedFnStr = "function p(e,r){return void 0!==r?Promise.reject(new Error(r.message)):Promise.resolve(e)};";
11
10
  var DeferredDataScripts = function(props) {
12
- var context = useContext(DataRouterContext);
13
- var staticContext = (context || {}).staticContext;
11
+ var staticContext = props === null || props === void 0 ? void 0 : props.context;
14
12
  var hydratedRef = useRef(false);
15
13
  useEffect(function() {
16
14
  hydratedRef.current = true;
@@ -80,8 +78,7 @@ var DeferredDataScripts = function(props) {
80
78
  __html: deferredScripts[0]
81
79
  }
82
80
  }),
83
- !hydratedRef.current && deferredScripts[1],
84
- JSX_SHELL_STREAM_END_MARK
81
+ !hydratedRef.current && deferredScripts[1]
85
82
  ]
86
83
  });
87
84
  };
@@ -4,7 +4,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
4
4
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
5
5
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
6
6
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
- import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  import { useContext } from "react";
9
9
  import { createStaticHandler } from "@modern-js/runtime-utils/remix-router";
10
10
  import { createStaticRouter, StaticRouterProvider } from "@modern-js/runtime-utils/node/router";
@@ -13,9 +13,11 @@ import { createRoutesFromElements } from "@modern-js/runtime-utils/router";
13
13
  import { reporterCtx, createRequestContext } from "@modern-js/runtime-utils/node";
14
14
  import { time } from "@modern-js/runtime-utils/time";
15
15
  import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
16
+ import { JSX_SHELL_STREAM_END_MARK } from "../../common";
16
17
  import { RuntimeReactContext } from "../../core";
17
18
  import { renderRoutes, urlJoin } from "./utils";
18
19
  import { modifyRoutes as modifyRoutesHook } from "./hooks";
20
+ import DeferredDataScripts from "./DeferredDataScripts.node";
19
21
  function createFetchRequest(req) {
20
22
  var origin = "".concat(req.protocol, "://").concat(req.host);
21
23
  var url = new URL(req.originalUrl || req.url, origin);
@@ -162,13 +164,21 @@ var routerPlugin = function(param) {
162
164
  }
163
165
  var getRouteApp = function() {
164
166
  return function(props) {
165
- var _useContext = useContext(RuntimeReactContext), remixRouter = _useContext.remixRouter, routerContext = _useContext.routerContext;
166
- return /* @__PURE__ */ _jsx(App, _object_spread_props(_object_spread({}, props), {
167
- children: /* @__PURE__ */ _jsx(StaticRouterProvider, {
168
- router: remixRouter,
169
- context: routerContext,
170
- hydrate: false
171
- })
167
+ var _useContext = useContext(RuntimeReactContext), remixRouter = _useContext.remixRouter, routerContext = _useContext.routerContext, ssrContext = _useContext.ssrContext;
168
+ var nonce = ssrContext.nonce, mode = ssrContext.mode;
169
+ return /* @__PURE__ */ _jsxs(App, _object_spread_props(_object_spread({}, props), {
170
+ children: [
171
+ /* @__PURE__ */ _jsx(StaticRouterProvider, {
172
+ router: remixRouter,
173
+ context: routerContext,
174
+ hydrate: false
175
+ }),
176
+ /* @__PURE__ */ _jsx(DeferredDataScripts, {
177
+ nonce,
178
+ context: routerContext
179
+ }),
180
+ mode === "stream" && JSX_SHELL_STREAM_END_MARK
181
+ ]
172
182
  }));
173
183
  };
174
184
  };
@@ -49,17 +49,17 @@ var checkIsInline = function(chunk, enableInline) {
49
49
  return false;
50
50
  }
51
51
  };
52
- function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
52
+ function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig, styledComponentsStyleTags) {
53
53
  return _buildShellBeforeTemplate.apply(this, arguments);
54
54
  }
55
55
  function _buildShellBeforeTemplate() {
56
- _buildShellBeforeTemplate = _async_to_generator(function(beforeAppTemplate, context, pluginConfig) {
56
+ _buildShellBeforeTemplate = _async_to_generator(function(beforeAppTemplate, context, pluginConfig, styledComponentsStyleTags) {
57
57
  var helmetData, callbacks;
58
- function injectCss(template) {
58
+ function injectCss(template, styledComponentsStyleTags2) {
59
59
  return _injectCss.apply(this, arguments);
60
60
  }
61
61
  function _injectCss() {
62
- _injectCss = _async_to_generator(function(template) {
62
+ _injectCss = _async_to_generator(function(template, styledComponentsStyleTags2) {
63
63
  var css;
64
64
  function getCssChunks() {
65
65
  return _getCssChunks.apply(this, arguments);
@@ -150,6 +150,9 @@ function _buildShellBeforeTemplate() {
150
150
  ];
151
151
  case 1:
152
152
  css = _state.sent();
153
+ if (styledComponentsStyleTags2) {
154
+ css += styledComponentsStyleTags2;
155
+ }
153
156
  return [
154
157
  2,
155
158
  safeReplace(template, CHUNK_CSS_PLACEHOLDER, css)
@@ -166,7 +169,9 @@ function _buildShellBeforeTemplate() {
166
169
  return helmetData ? helmetReplace(headTemplate, helmetData) : headTemplate;
167
170
  },
168
171
  // @TODO: prefetch scripts of lazy component
169
- injectCss
172
+ function(template) {
173
+ return injectCss(template, styledComponentsStyleTags);
174
+ }
170
175
  ];
171
176
  return [
172
177
  2,
@@ -3,6 +3,7 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
3
3
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
4
4
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
5
5
  import { Transform } from "stream";
6
+ import { ServerStyleSheet } from "styled-components";
6
7
  import { RenderLevel } from "../types";
7
8
  import { ESCAPED_SHELL_STREAM_END_MARK } from "../../../common";
8
9
  import { getTemplates } from "./template";
@@ -14,7 +15,9 @@ var ShellChunkStatus;
14
15
  function renderToPipe(rootElement, context, pluginConfig, options) {
15
16
  var _context_ssrContext;
16
17
  var shellChunkStatus = 0;
17
- var onReady = ((_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.isSpider) ? "onAllReady" : "onShellReady";
18
+ var forceStream2String = Boolean(process.env.MODERN_JS_STREAM_TO_STRING);
19
+ var onReady = ((_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.isSpider) || forceStream2String ? "onAllReady" : "onShellReady";
20
+ var sheet = new ServerStyleSheet();
18
21
  var ssrContext = context.ssrContext;
19
22
  var chunkVec = [];
20
23
  var forUserPipe = new Promise(function(resolve) {
@@ -23,21 +26,24 @@ function renderToPipe(rootElement, context, pluginConfig, options) {
23
26
  renderToPipeableStream = require("react-dom/server").renderToPipeableStream;
24
27
  } catch (e) {
25
28
  }
29
+ var root = forceStream2String ? sheet.collectStyles(rootElement) : rootElement;
30
+ var renderLevel = RenderLevel.SERVER_RENDER;
26
31
  var _obj;
27
- var pipe = renderToPipeableStream(rootElement, _object_spread_props(_object_spread({}, options), (_obj = {
32
+ var pipe = renderToPipeableStream(root, _object_spread_props(_object_spread({}, options), (_obj = {
28
33
  nonce: ssrContext === null || ssrContext === void 0 ? void 0 : ssrContext.nonce
29
34
  }, _define_property(_obj, onReady, function() {
30
- getTemplates(context, RenderLevel.SERVER_RENDER, pluginConfig).then(function(param) {
35
+ var styledComponentsStyleTags = forceStream2String ? sheet.getStyleTags() : "";
36
+ getTemplates(context, renderLevel, pluginConfig, styledComponentsStyleTags).then(function(param) {
31
37
  var shellAfter = param.shellAfter, shellBefore = param.shellBefore;
32
- var _options_onShellReady;
33
- options === null || options === void 0 ? void 0 : (_options_onShellReady = options.onShellReady) === null || _options_onShellReady === void 0 ? void 0 : _options_onShellReady.call(options);
38
+ var _options_onReady;
39
+ options === null || options === void 0 ? void 0 : (_options_onReady = options[onReady]) === null || _options_onReady === void 0 ? void 0 : _options_onReady.call(options);
34
40
  var injectableTransform = new Transform({
35
41
  transform: function transform(chunk, _encoding, callback) {
36
42
  try {
37
43
  if (shellChunkStatus !== 1) {
38
44
  chunkVec.push(chunk.toString());
39
45
  var concatedChunk = chunkVec.join("");
40
- if (concatedChunk.endsWith(ESCAPED_SHELL_STREAM_END_MARK)) {
46
+ if (concatedChunk.includes(ESCAPED_SHELL_STREAM_END_MARK)) {
41
47
  concatedChunk = concatedChunk.replace(ESCAPED_SHELL_STREAM_END_MARK, "");
42
48
  shellChunkStatus = 1;
43
49
  this.push("".concat(shellBefore).concat(concatedChunk).concat(shellAfter));
@@ -59,13 +65,18 @@ function renderToPipe(rootElement, context, pluginConfig, options) {
59
65
  resolve(injectableTransform);
60
66
  });
61
67
  }), _define_property(_obj, "onShellError", function onShellError(error) {
62
- getTemplates(context, RenderLevel.CLIENT_RENDER, pluginConfig).then(function(param) {
68
+ renderLevel = RenderLevel.CLIENT_RENDER;
69
+ getTemplates(context, renderLevel, pluginConfig).then(function(param) {
63
70
  var shellAfter = param.shellAfter, shellBefore = param.shellBefore;
64
71
  var _options_onShellError;
65
72
  var fallbackHtml = "".concat(shellBefore).concat(shellAfter);
66
73
  resolve(fallbackHtml);
67
74
  options === null || options === void 0 ? void 0 : (_options_onShellError = options.onShellError) === null || _options_onShellError === void 0 ? void 0 : _options_onShellError.call(options, error);
68
75
  });
76
+ }), _define_property(_obj, "onError", function onError(error) {
77
+ var _options_onError;
78
+ renderLevel = RenderLevel.CLIENT_RENDER;
79
+ options === null || options === void 0 ? void 0 : (_options_onError = options.onError) === null || _options_onError === void 0 ? void 0 : _options_onError.call(options, error);
69
80
  }), _obj))).pipe;
70
81
  });
71
82
  return forUserPipe;
@@ -5,7 +5,7 @@ import { buildShellAfterTemplate } from "./buildTemplate.after";
5
5
  import { buildShellBeforeTemplate } from "./bulidTemplate.before";
6
6
  var HTML_SEPARATOR = "<!--<?- html ?>-->";
7
7
  var getTemplates = function() {
8
- var _ref = _async_to_generator(function(context, renderLevel, pluginConfig) {
8
+ var _ref = _async_to_generator(function(context, renderLevel, pluginConfig, styledComponentsStyleTags) {
9
9
  var ssrContext, _ref2, tmp, beforeAppTemplate, tmp1, afterAppHtmlTemplate, builtBeforeTemplate, builtAfterTemplate;
10
10
  return _ts_generator(this, function(_state) {
11
11
  switch (_state.label) {
@@ -14,7 +14,7 @@ var getTemplates = function() {
14
14
  _ref2 = _sliced_to_array(ssrContext.template.split(HTML_SEPARATOR) || [], 2), tmp = _ref2[0], beforeAppTemplate = tmp === void 0 ? "" : tmp, tmp1 = _ref2[1], afterAppHtmlTemplate = tmp1 === void 0 ? "" : tmp1;
15
15
  return [
16
16
  4,
17
- buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig)
17
+ buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig, styledComponentsStyleTags)
18
18
  ];
19
19
  case 1:
20
20
  builtBeforeTemplate = _state.sent();
@@ -37,7 +37,7 @@ var getTemplates = function() {
37
37
  }
38
38
  });
39
39
  });
40
- return function getTemplates2(context, renderLevel, pluginConfig) {
40
+ return function getTemplates2(context, renderLevel, pluginConfig, styledComponentsStyleTags) {
41
41
  return _ref.apply(this, arguments);
42
42
  };
43
43
  }();
@@ -22,13 +22,12 @@ const createApp = ({ plugins, props: globalProps }) => {
22
22
  return (App) => {
23
23
  const runner = appRuntime.init();
24
24
  const WrapperComponent = (props) => {
25
- var _props_children;
26
25
  const element = /* @__PURE__ */ React.createElement(App || React.Fragment, App ? {
27
26
  ...props
28
- } : null, App ? props.children : /* @__PURE__ */ React.cloneElement(props.children, {
29
- ...(_props_children = props.children) === null || _props_children === void 0 ? void 0 : _props_children.props,
27
+ } : null, App ? props.children : React.Children.map(props.children, (child) => /* @__PURE__ */ React.isValidElement(child) ? /* @__PURE__ */ React.cloneElement(child, {
28
+ ...child.props,
30
29
  ...props
31
- }));
30
+ }) : child));
32
31
  const context = useContext(RuntimeReactContext);
33
32
  return runner.provide({
34
33
  element,
@@ -206,7 +205,12 @@ const bootstrap = async (BootApp, id, root, ReactDOM) => {
206
205
  };
207
206
  const initialData = await runInit(context);
208
207
  if (!isRedirectResponse(initialData)) {
208
+ var _context_routerContext, _context_routerContext1;
209
209
  context.initialData = initialData;
210
+ if (((_context_routerContext = context.routerContext) === null || _context_routerContext === void 0 ? void 0 : _context_routerContext.statusCode) && ((_context_routerContext1 = context.routerContext) === null || _context_routerContext1 === void 0 ? void 0 : _context_routerContext1.statusCode) !== 200) {
211
+ var _context_routerContext2, _context_ssrContext;
212
+ (_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.response.status((_context_routerContext2 = context.routerContext) === null || _context_routerContext2 === void 0 ? void 0 : _context_routerContext2.statusCode);
213
+ }
210
214
  return runner.server({
211
215
  App,
212
216
  context
@@ -1,15 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Suspense, useEffect, useRef, useMemo, useContext } from "react";
3
- import { Await, UNSAFE_DataRouterContext as DataRouterContext, useAsyncError } from "@modern-js/runtime-utils/router";
2
+ import { Suspense, useEffect, useRef, useMemo } from "react";
3
+ import { Await, useAsyncError } from "@modern-js/runtime-utils/router";
4
4
  import { serializeJson } from "@modern-js/runtime-utils/node";
5
- import { JSX_SHELL_STREAM_END_MARK } from "../../common";
6
5
  import { serializeErrors } from "./utils";
7
6
  const setupFnStr = `function s(r,e){_ROUTER_DATA.r=_ROUTER_DATA.r||{},_ROUTER_DATA.r[r]=_ROUTER_DATA.r[r]||{};return new Promise((function(A,R){_ROUTER_DATA.r[r][e]={resolve:A,reject:R}}))};`;
8
7
  const resolveFnStr = `function r(e,r,o,A){A?_ROUTER_DATA.r[e][r].reject(A):_ROUTER_DATA.r[e][r].resolve(o)};`;
9
8
  const preResolvedFnStr = `function p(e,r){return void 0!==r?Promise.reject(new Error(r.message)):Promise.resolve(e)};`;
10
9
  const DeferredDataScripts = (props) => {
11
- const context = useContext(DataRouterContext);
12
- const { staticContext } = context || {};
10
+ const staticContext = props === null || props === void 0 ? void 0 : props.context;
13
11
  const hydratedRef = useRef(false);
14
12
  useEffect(() => {
15
13
  hydratedRef.current = true;
@@ -78,8 +76,7 @@ const DeferredDataScripts = (props) => {
78
76
  __html: deferredScripts[0]
79
77
  }
80
78
  }),
81
- !hydratedRef.current && deferredScripts[1],
82
- JSX_SHELL_STREAM_END_MARK
79
+ !hydratedRef.current && deferredScripts[1]
83
80
  ]
84
81
  });
85
82
  };
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext } from "react";
3
3
  import { createStaticHandler } from "@modern-js/runtime-utils/remix-router";
4
4
  import { createStaticRouter, StaticRouterProvider } from "@modern-js/runtime-utils/node/router";
@@ -7,9 +7,11 @@ import { createRoutesFromElements } from "@modern-js/runtime-utils/router";
7
7
  import { reporterCtx, createRequestContext } from "@modern-js/runtime-utils/node";
8
8
  import { time } from "@modern-js/runtime-utils/time";
9
9
  import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
10
+ import { JSX_SHELL_STREAM_END_MARK } from "../../common";
10
11
  import { RuntimeReactContext } from "../../core";
11
12
  import { renderRoutes, urlJoin } from "./utils";
12
13
  import { modifyRoutes as modifyRoutesHook } from "./hooks";
14
+ import DeferredDataScripts from "./DeferredDataScripts.node";
13
15
  function createFetchRequest(req) {
14
16
  const origin = `${req.protocol}://${req.host}`;
15
17
  const url = new URL(req.originalUrl || req.url, origin);
@@ -98,14 +100,22 @@ const routerPlugin = ({ basename = "", originalBaseUrl = "", routesConfig, creat
98
100
  }
99
101
  const getRouteApp = () => {
100
102
  return (props) => {
101
- const { remixRouter, routerContext } = useContext(RuntimeReactContext);
102
- return /* @__PURE__ */ _jsx(App, {
103
+ const { remixRouter, routerContext, ssrContext } = useContext(RuntimeReactContext);
104
+ const { nonce, mode } = ssrContext;
105
+ return /* @__PURE__ */ _jsxs(App, {
103
106
  ...props,
104
- children: /* @__PURE__ */ _jsx(StaticRouterProvider, {
105
- router: remixRouter,
106
- context: routerContext,
107
- hydrate: false
108
- })
107
+ children: [
108
+ /* @__PURE__ */ _jsx(StaticRouterProvider, {
109
+ router: remixRouter,
110
+ context: routerContext,
111
+ hydrate: false
112
+ }),
113
+ /* @__PURE__ */ _jsx(DeferredDataScripts, {
114
+ nonce,
115
+ context: routerContext
116
+ }),
117
+ mode === "stream" && JSX_SHELL_STREAM_END_MARK
118
+ ]
109
119
  });
110
120
  };
111
121
  };
@@ -21,18 +21,21 @@ const checkIsInline = (chunk, enableInline) => {
21
21
  return false;
22
22
  }
23
23
  };
24
- async function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig) {
24
+ async function buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig, styledComponentsStyleTags) {
25
25
  const helmetData = ReactHelmet.renderStatic();
26
26
  const callbacks = [
27
27
  (headTemplate) => {
28
28
  return helmetData ? helmetReplace(headTemplate, helmetData) : headTemplate;
29
29
  },
30
30
  // @TODO: prefetch scripts of lazy component
31
- injectCss
31
+ (template) => injectCss(template, styledComponentsStyleTags)
32
32
  ];
33
33
  return buildTemplate(beforeAppTemplate, callbacks);
34
- async function injectCss(template) {
35
- const css = await getCssChunks();
34
+ async function injectCss(template, styledComponentsStyleTags2) {
35
+ let css = await getCssChunks();
36
+ if (styledComponentsStyleTags2) {
37
+ css += styledComponentsStyleTags2;
38
+ }
36
39
  return safeReplace(template, CHUNK_CSS_PLACEHOLDER, css);
37
40
  async function getCssChunks() {
38
41
  const { routeManifest, routerContext, routes } = context;
@@ -1,4 +1,5 @@
1
1
  import { Transform } from "stream";
2
+ import { ServerStyleSheet } from "styled-components";
2
3
  import { RenderLevel } from "../types";
3
4
  import { ESCAPED_SHELL_STREAM_END_MARK } from "../../../common";
4
5
  import { getTemplates } from "./template";
@@ -10,7 +11,9 @@ var ShellChunkStatus;
10
11
  function renderToPipe(rootElement, context, pluginConfig, options) {
11
12
  var _context_ssrContext;
12
13
  let shellChunkStatus = 0;
13
- const onReady = ((_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.isSpider) ? "onAllReady" : "onShellReady";
14
+ const forceStream2String = Boolean(process.env.MODERN_JS_STREAM_TO_STRING);
15
+ const onReady = ((_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.isSpider) || forceStream2String ? "onAllReady" : "onShellReady";
16
+ const sheet = new ServerStyleSheet();
14
17
  const { ssrContext } = context;
15
18
  const chunkVec = [];
16
19
  const forUserPipe = new Promise((resolve) => {
@@ -19,20 +22,23 @@ function renderToPipe(rootElement, context, pluginConfig, options) {
19
22
  ({ renderToPipeableStream } = require("react-dom/server"));
20
23
  } catch (e) {
21
24
  }
22
- const { pipe } = renderToPipeableStream(rootElement, {
25
+ const root = forceStream2String ? sheet.collectStyles(rootElement) : rootElement;
26
+ let renderLevel = RenderLevel.SERVER_RENDER;
27
+ const { pipe } = renderToPipeableStream(root, {
23
28
  ...options,
24
29
  nonce: ssrContext === null || ssrContext === void 0 ? void 0 : ssrContext.nonce,
25
30
  [onReady]() {
26
- getTemplates(context, RenderLevel.SERVER_RENDER, pluginConfig).then(({ shellAfter, shellBefore }) => {
27
- var _options_onShellReady;
28
- options === null || options === void 0 ? void 0 : (_options_onShellReady = options.onShellReady) === null || _options_onShellReady === void 0 ? void 0 : _options_onShellReady.call(options);
31
+ const styledComponentsStyleTags = forceStream2String ? sheet.getStyleTags() : "";
32
+ getTemplates(context, renderLevel, pluginConfig, styledComponentsStyleTags).then(({ shellAfter, shellBefore }) => {
33
+ var _options_onReady;
34
+ options === null || options === void 0 ? void 0 : (_options_onReady = options[onReady]) === null || _options_onReady === void 0 ? void 0 : _options_onReady.call(options);
29
35
  const injectableTransform = new Transform({
30
36
  transform(chunk, _encoding, callback) {
31
37
  try {
32
38
  if (shellChunkStatus !== 1) {
33
39
  chunkVec.push(chunk.toString());
34
40
  let concatedChunk = chunkVec.join("");
35
- if (concatedChunk.endsWith(ESCAPED_SHELL_STREAM_END_MARK)) {
41
+ if (concatedChunk.includes(ESCAPED_SHELL_STREAM_END_MARK)) {
36
42
  concatedChunk = concatedChunk.replace(ESCAPED_SHELL_STREAM_END_MARK, "");
37
43
  shellChunkStatus = 1;
38
44
  this.push(`${shellBefore}${concatedChunk}${shellAfter}`);
@@ -55,12 +61,18 @@ function renderToPipe(rootElement, context, pluginConfig, options) {
55
61
  });
56
62
  },
57
63
  onShellError(error) {
58
- getTemplates(context, RenderLevel.CLIENT_RENDER, pluginConfig).then(({ shellAfter, shellBefore }) => {
64
+ renderLevel = RenderLevel.CLIENT_RENDER;
65
+ getTemplates(context, renderLevel, pluginConfig).then(({ shellAfter, shellBefore }) => {
59
66
  var _options_onShellError;
60
67
  const fallbackHtml = `${shellBefore}${shellAfter}`;
61
68
  resolve(fallbackHtml);
62
69
  options === null || options === void 0 ? void 0 : (_options_onShellError = options.onShellError) === null || _options_onShellError === void 0 ? void 0 : _options_onShellError.call(options, error);
63
70
  });
71
+ },
72
+ onError(error) {
73
+ var _options_onError;
74
+ renderLevel = RenderLevel.CLIENT_RENDER;
75
+ options === null || options === void 0 ? void 0 : (_options_onError = options.onError) === null || _options_onError === void 0 ? void 0 : _options_onError.call(options, error);
64
76
  }
65
77
  });
66
78
  });
@@ -1,10 +1,10 @@
1
1
  import { buildShellAfterTemplate } from "./buildTemplate.after";
2
2
  import { buildShellBeforeTemplate } from "./bulidTemplate.before";
3
3
  const HTML_SEPARATOR = "<!--<?- html ?>-->";
4
- const getTemplates = async (context, renderLevel, pluginConfig) => {
4
+ const getTemplates = async (context, renderLevel, pluginConfig, styledComponentsStyleTags) => {
5
5
  const { ssrContext } = context;
6
6
  const [beforeAppTemplate = "", afterAppHtmlTemplate = ""] = ssrContext.template.split(HTML_SEPARATOR) || [];
7
- const builtBeforeTemplate = await buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig);
7
+ const builtBeforeTemplate = await buildShellBeforeTemplate(beforeAppTemplate, context, pluginConfig, styledComponentsStyleTags);
8
8
  const builtAfterTemplate = await buildShellAfterTemplate(afterAppHtmlTemplate, {
9
9
  context,
10
10
  renderLevel
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
2
3
  /**
3
4
  * DeferredDataScripts only renders in server side,
4
5
  * it doesn't need to be hydrated in client side.
5
6
  */
6
7
  declare const DeferredDataScripts: (props?: {
7
8
  nonce?: string;
9
+ context: StaticHandlerContext;
8
10
  }) => JSX.Element | null;
9
11
  export default DeferredDataScripts;
@@ -56,7 +56,7 @@ interface DataFunctionArgs<D = any> {
56
56
  params: Params;
57
57
  context?: D;
58
58
  }
59
- export type LoaderFunctionArgs<P extends Record<string, unknown> = any> = DataFunctionArgs<RequestContext<P>>;
59
+ export type LoaderFunctionArgs<P extends Record<string, unknown> = Record<string, unknown>> = DataFunctionArgs<RequestContext<P>>;
60
60
  declare type DataFunctionValue = Response | NonNullable<unknown> | null;
61
61
  export type LoaderFunction = <P extends Record<string, unknown> = Record<string, unknown>>(args: LoaderFunctionArgs<P>) => Promise<DataFunctionValue> | DataFunctionValue;
62
62
  export {};
@@ -1,2 +1,2 @@
1
1
  import { RuntimeContext, SSRPluginConfig } from '../types';
2
- export declare function buildShellBeforeTemplate(beforeAppTemplate: string, context: RuntimeContext, pluginConfig: SSRPluginConfig): Promise<string>;
2
+ export declare function buildShellBeforeTemplate(beforeAppTemplate: string, context: RuntimeContext, pluginConfig: SSRPluginConfig, styledComponentsStyleTags?: string): Promise<string>;
@@ -3,4 +3,4 @@ export type InjectTemplate = {
3
3
  shellBefore: string;
4
4
  shellAfter: string;
5
5
  };
6
- export declare const getTemplates: (context: RuntimeContext, renderLevel: RenderLevel, pluginConfig: SSRPluginConfig) => Promise<InjectTemplate>;
6
+ export declare const getTemplates: (context: RuntimeContext, renderLevel: RenderLevel, pluginConfig: SSRPluginConfig, styledComponentsStyleTags?: string) => Promise<InjectTemplate>;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.50.0",
18
+ "version": "2.52.0",
19
19
  "engines": {
20
20
  "node": ">=14.17.6"
21
21
  },
@@ -170,10 +170,10 @@
170
170
  "react-side-effect": "^2.1.1",
171
171
  "styled-components": "^5.3.1",
172
172
  "@swc/helpers": "0.5.3",
173
- "@modern-js/plugin": "2.50.0",
174
- "@modern-js/types": "2.50.0",
175
- "@modern-js/utils": "2.50.0",
176
- "@modern-js/runtime-utils": "2.50.0"
173
+ "@modern-js/plugin": "2.52.0",
174
+ "@modern-js/types": "2.52.0",
175
+ "@modern-js/runtime-utils": "2.52.0",
176
+ "@modern-js/utils": "2.52.0"
177
177
  },
178
178
  "peerDependencies": {
179
179
  "react": ">=17",
@@ -194,11 +194,11 @@
194
194
  "ts-jest": "^29.1.0",
195
195
  "typescript": "^5",
196
196
  "webpack": "^5.91.0",
197
- "@modern-js/app-tools": "2.50.0",
198
- "@modern-js/server-core": "2.50.0",
199
- "@modern-js/core": "2.50.0",
200
- "@scripts/build": "2.50.0",
201
- "@scripts/jest-config": "2.50.0"
197
+ "@scripts/build": "2.52.0",
198
+ "@modern-js/core": "2.52.0",
199
+ "@modern-js/app-tools": "2.52.0",
200
+ "@modern-js/server-core": "2.52.0",
201
+ "@scripts/jest-config": "2.52.0"
202
202
  },
203
203
  "sideEffects": false,
204
204
  "publishConfig": {