@modern-js/runtime 2.34.0 → 2.35.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.
Files changed (98) hide show
  1. package/dist/cjs/core/compatible.js +9 -10
  2. package/dist/cjs/core/loader/useLoader.js +8 -8
  3. package/dist/cjs/core/plugin.js +2 -3
  4. package/dist/cjs/document/Html.js +3 -4
  5. package/dist/cjs/document/cli/index.js +4 -6
  6. package/dist/cjs/router/cli/index.js +1 -2
  7. package/dist/cjs/router/runtime/DeferredDataScripts.node.js +9 -11
  8. package/dist/cjs/router/runtime/PrefetchLink.js +5 -9
  9. package/dist/cjs/router/runtime/index.js +5 -1
  10. package/dist/cjs/router/runtime/plugin.js +5 -7
  11. package/dist/cjs/router/runtime/plugin.node.js +8 -9
  12. package/dist/cjs/router/runtime/server.js +1 -1
  13. package/dist/cjs/router/runtime/utils.js +7 -7
  14. package/dist/cjs/router/runtime/withRouter.js +1 -1
  15. package/dist/cjs/ssr/cli/index.js +9 -11
  16. package/dist/cjs/ssr/index.js +3 -3
  17. package/dist/cjs/ssr/index.node.js +3 -2
  18. package/dist/cjs/ssr/prefetch.js +4 -4
  19. package/dist/cjs/ssr/react/prerender/util.js +2 -4
  20. package/dist/cjs/ssr/serverRender/renderToStream/buildTemplate.after.js +6 -3
  21. package/dist/cjs/ssr/serverRender/renderToStream/bulidTemplate.before.js +3 -7
  22. package/dist/cjs/ssr/serverRender/renderToStream/index.js +14 -5
  23. package/dist/cjs/ssr/serverRender/renderToStream/renderToPipe.js +5 -13
  24. package/dist/cjs/ssr/serverRender/renderToStream/renderToPipe.worker.js +5 -8
  25. package/dist/cjs/ssr/serverRender/renderToString/entry.js +5 -5
  26. package/dist/cjs/ssr/serverRender/renderToString/index.js +3 -3
  27. package/dist/cjs/ssr/serverRender/renderToString/loadable.js +29 -18
  28. package/dist/cjs/ssr/serverRender/tracker.js +14 -0
  29. package/dist/esm/core/compatible.js +9 -10
  30. package/dist/esm/core/loader/useLoader.js +8 -8
  31. package/dist/esm/core/plugin.js +2 -3
  32. package/dist/esm/document/Html.js +3 -4
  33. package/dist/esm/document/cli/index.js +4 -5
  34. package/dist/esm/router/cli/index.js +1 -2
  35. package/dist/esm/router/runtime/DeferredDataScripts.node.js +4 -6
  36. package/dist/esm/router/runtime/PrefetchLink.js +5 -9
  37. package/dist/esm/router/runtime/index.js +3 -2
  38. package/dist/esm/router/runtime/plugin.js +4 -6
  39. package/dist/esm/router/runtime/plugin.node.js +6 -7
  40. package/dist/esm/router/runtime/server.js +1 -1
  41. package/dist/esm/router/runtime/utils.js +6 -6
  42. package/dist/esm/router/runtime/withRouter.js +1 -1
  43. package/dist/esm/ssr/cli/index.js +9 -11
  44. package/dist/esm/ssr/index.js +1 -1
  45. package/dist/esm/ssr/index.node.js +3 -2
  46. package/dist/esm/ssr/prefetch.js +3 -3
  47. package/dist/esm/ssr/react/prerender/util.js +2 -4
  48. package/dist/esm/ssr/serverRender/renderToStream/buildTemplate.after.js +5 -2
  49. package/dist/esm/ssr/serverRender/renderToStream/bulidTemplate.before.js +3 -5
  50. package/dist/esm/ssr/serverRender/renderToStream/index.js +14 -5
  51. package/dist/esm/ssr/serverRender/renderToStream/renderToPipe.js +5 -13
  52. package/dist/esm/ssr/serverRender/renderToStream/renderToPipe.worker.js +6 -7
  53. package/dist/esm/ssr/serverRender/renderToString/entry.js +4 -4
  54. package/dist/esm/ssr/serverRender/renderToString/index.js +2 -2
  55. package/dist/esm/ssr/serverRender/renderToString/loadable.js +32 -18
  56. package/dist/esm/ssr/serverRender/tracker.js +11 -0
  57. package/dist/esm-node/core/compatible.js +9 -10
  58. package/dist/esm-node/core/loader/useLoader.js +8 -8
  59. package/dist/esm-node/core/plugin.js +2 -3
  60. package/dist/esm-node/document/Html.js +3 -4
  61. package/dist/esm-node/document/cli/index.js +4 -6
  62. package/dist/esm-node/router/cli/index.js +1 -2
  63. package/dist/esm-node/router/runtime/DeferredDataScripts.node.js +4 -6
  64. package/dist/esm-node/router/runtime/PrefetchLink.js +5 -9
  65. package/dist/esm-node/router/runtime/index.js +3 -2
  66. package/dist/esm-node/router/runtime/plugin.js +4 -6
  67. package/dist/esm-node/router/runtime/plugin.node.js +6 -7
  68. package/dist/esm-node/router/runtime/server.js +1 -1
  69. package/dist/esm-node/router/runtime/utils.js +6 -6
  70. package/dist/esm-node/router/runtime/withRouter.js +1 -1
  71. package/dist/esm-node/ssr/cli/index.js +9 -11
  72. package/dist/esm-node/ssr/index.js +1 -1
  73. package/dist/esm-node/ssr/index.node.js +3 -2
  74. package/dist/esm-node/ssr/prefetch.js +3 -3
  75. package/dist/esm-node/ssr/react/prerender/util.js +2 -4
  76. package/dist/esm-node/ssr/serverRender/renderToStream/buildTemplate.after.js +5 -2
  77. package/dist/esm-node/ssr/serverRender/renderToStream/bulidTemplate.before.js +3 -7
  78. package/dist/esm-node/ssr/serverRender/renderToStream/index.js +13 -4
  79. package/dist/esm-node/ssr/serverRender/renderToStream/renderToPipe.js +5 -13
  80. package/dist/esm-node/ssr/serverRender/renderToStream/renderToPipe.worker.js +5 -8
  81. package/dist/esm-node/ssr/serverRender/renderToString/entry.js +4 -4
  82. package/dist/esm-node/ssr/serverRender/renderToString/index.js +2 -2
  83. package/dist/esm-node/ssr/serverRender/renderToString/loadable.js +29 -18
  84. package/dist/esm-node/ssr/serverRender/tracker.js +14 -0
  85. package/dist/types/router/runtime/PrefetchLink.d.ts +1 -1
  86. package/dist/types/router/runtime/hooks.d.ts +1 -1
  87. package/dist/types/router/runtime/index.d.ts +4 -3
  88. package/dist/types/router/runtime/server.d.ts +1 -1
  89. package/dist/types/router/runtime/types.d.ts +2 -2
  90. package/dist/types/router/runtime/utils.d.ts +1 -1
  91. package/dist/types/router/runtime/withRouter.d.ts +1 -1
  92. package/dist/types/runtimeContext.d.ts +1 -1
  93. package/dist/types/ssr/serverRender/renderToString/entry.d.ts +2 -2
  94. package/dist/types/ssr/serverRender/renderToString/loadable.d.ts +1 -0
  95. package/dist/types/ssr/serverRender/renderToString/type.d.ts +0 -10
  96. package/dist/types/ssr/serverRender/tracker.d.ts +5 -2
  97. package/dist/types/ssr/serverRender/types.d.ts +12 -1
  98. package/package.json +10 -9
@@ -72,16 +72,15 @@ const createApp = ({ plugins, props: globalProps }) => {
72
72
  }, {
73
73
  onLast: ({ App: App2 }) => {
74
74
  const WrapComponent = ({ context, ...props }) => {
75
- var _contextValue;
76
75
  let contextValue = context;
77
- if (!((_contextValue = contextValue) === null || _contextValue === void 0 ? void 0 : _contextValue.runner)) {
76
+ if (!(contextValue === null || contextValue === void 0 ? void 0 : contextValue.runner)) {
78
77
  contextValue = getInitialContext(runner);
79
78
  runner.init({
80
79
  context: contextValue
81
80
  }, {
82
81
  onLast: ({ context: context1 }) => {
83
- var _App_init, _App;
84
- return (_App = App2) === null || _App === void 0 ? void 0 : (_App_init = _App.init) === null || _App_init === void 0 ? void 0 : _App_init.call(_App, context1);
82
+ var _App_init;
83
+ return App2 === null || App2 === void 0 ? void 0 : (_App_init = App2.init) === null || _App_init === void 0 ? void 0 : _App_init.call(App2, context1);
85
84
  }
86
85
  });
87
86
  }
@@ -117,8 +116,8 @@ const bootstrap = async (BootApp, id, root, ReactDOM) => {
117
116
  context: _context
118
117
  }, {
119
118
  onLast: ({ context: context1 }) => {
120
- var _App_init, _App;
121
- return (_App = App) === null || _App === void 0 ? void 0 : (_App_init = _App.init) === null || _App_init === void 0 ? void 0 : _App_init.call(_App, context1);
119
+ var _App_init;
120
+ return App === null || App === void 0 ? void 0 : (_App_init = App.init) === null || _App_init === void 0 ? void 0 : _App_init.call(App, context1);
122
121
  }
123
122
  });
124
123
  if (!id) {
@@ -129,9 +128,9 @@ const bootstrap = async (BootApp, id, root, ReactDOM) => {
129
128
  const isBrowser = typeof window !== "undefined" && window.name !== "nodejs";
130
129
  if (isBrowser) {
131
130
  if (isClientArgs(id)) {
132
- var _ssrData_data, _ssrData, _ssrData1, _ssrData_data1, _ssrData2;
131
+ var _ssrData_data, _ssrData_data1;
133
132
  const ssrData = window._SSR_DATA;
134
- const loadersData = ((_ssrData = ssrData) === null || _ssrData === void 0 ? void 0 : (_ssrData_data = _ssrData.data) === null || _ssrData_data === void 0 ? void 0 : _ssrData_data.loadersData) || {};
133
+ const loadersData = (ssrData === null || ssrData === void 0 ? void 0 : (_ssrData_data = ssrData.data) === null || _ssrData_data === void 0 ? void 0 : _ssrData_data.loadersData) || {};
135
134
  const initialLoadersState = Object.keys(loadersData).reduce((res, key) => {
136
135
  const loaderData = loadersData[key];
137
136
  if (loaderData.loading !== false) {
@@ -145,10 +144,10 @@ const bootstrap = async (BootApp, id, root, ReactDOM) => {
145
144
  skipStatic: true
146
145
  }),
147
146
  ...ssrData ? {
148
- ssrContext: (_ssrData1 = ssrData) === null || _ssrData1 === void 0 ? void 0 : _ssrData1.context
147
+ ssrContext: ssrData === null || ssrData === void 0 ? void 0 : ssrData.context
149
148
  } : {}
150
149
  });
151
- context.initialData = (_ssrData2 = ssrData) === null || _ssrData2 === void 0 ? void 0 : (_ssrData_data1 = _ssrData2.data) === null || _ssrData_data1 === void 0 ? void 0 : _ssrData_data1.initialData;
150
+ context.initialData = ssrData === null || ssrData === void 0 ? void 0 : (_ssrData_data1 = ssrData.data) === null || _ssrData_data1 === void 0 ? void 0 : _ssrData_data1.initialData;
152
151
  const initialData = await runInit(context);
153
152
  if (initialData) {
154
153
  context.initialData = initialData;
@@ -25,7 +25,7 @@ const useLoader = (loaderFn, options = {
25
25
  delete options._cache;
26
26
  }
27
27
  const load = (0, _react.useCallback)((params) => {
28
- var _unlistenLoaderChangeRef_current, _unlistenLoaderChangeRef, _window__SSR_DATA_data_loadersData_id, _window__SSR_DATA_data, _window__SSR_DATA, _window, _loaderRef_current;
28
+ var _unlistenLoaderChangeRef_current, _window__SSR_DATA_data_loadersData_id, _window__SSR_DATA_data, _window__SSR_DATA, _window, _loaderRef_current;
29
29
  if (typeof params === "undefined") {
30
30
  var _loaderRef_current1;
31
31
  return (_loaderRef_current1 = loaderRef.current) === null || _loaderRef_current1 === void 0 ? void 0 : _loaderRef_current1.load();
@@ -45,7 +45,7 @@ const useLoader = (loaderFn, options = {
45
45
  params
46
46
  });
47
47
  loaderRef.current = loaderManager.get(id);
48
- (_unlistenLoaderChangeRef_current = (_unlistenLoaderChangeRef = unlistenLoaderChangeRef).current) === null || _unlistenLoaderChangeRef_current === void 0 ? void 0 : _unlistenLoaderChangeRef_current.call(_unlistenLoaderChangeRef);
48
+ (_unlistenLoaderChangeRef_current = unlistenLoaderChangeRef.current) === null || _unlistenLoaderChangeRef_current === void 0 ? void 0 : _unlistenLoaderChangeRef_current.call(unlistenLoaderChangeRef);
49
49
  if (isSSRRender) {
50
50
  return void 0;
51
51
  }
@@ -59,12 +59,12 @@ const useLoader = (loaderFn, options = {
59
59
  unlistenLoaderChangeRef.current = (_loaderRef_current = loaderRef.current) === null || _loaderRef_current === void 0 ? void 0 : _loaderRef_current.onChange((_status, _result) => {
60
60
  setResult(_result);
61
61
  if (_status === _loaderManager.LoaderStatus.fulfilled) {
62
- var _options_onSuccess, _options;
63
- (_options = options) === null || _options === void 0 ? void 0 : (_options_onSuccess = _options.onSuccess) === null || _options_onSuccess === void 0 ? void 0 : _options_onSuccess.call(_options, _result.data);
62
+ var _options_onSuccess;
63
+ options === null || options === void 0 ? void 0 : (_options_onSuccess = options.onSuccess) === null || _options_onSuccess === void 0 ? void 0 : _options_onSuccess.call(options, _result.data);
64
64
  }
65
65
  if (_status === _loaderManager.LoaderStatus.rejected) {
66
- var _options_onError, _options1;
67
- (_options1 = options) === null || _options1 === void 0 ? void 0 : (_options_onError = _options1.onError) === null || _options_onError === void 0 ? void 0 : _options_onError.call(_options1, _result.error);
66
+ var _options_onError;
67
+ options === null || options === void 0 ? void 0 : (_options_onError = options.onError) === null || _options_onError === void 0 ? void 0 : _options_onError.call(options, _result.error);
68
68
  }
69
69
  });
70
70
  return res;
@@ -72,8 +72,8 @@ const useLoader = (loaderFn, options = {
72
72
  options.skip
73
73
  ]);
74
74
  (0, _react.useEffect)(() => () => {
75
- var _unlistenLoaderChangeRef_current, _unlistenLoaderChangeRef;
76
- (_unlistenLoaderChangeRef_current = (_unlistenLoaderChangeRef = unlistenLoaderChangeRef).current) === null || _unlistenLoaderChangeRef_current === void 0 ? void 0 : _unlistenLoaderChangeRef_current.call(_unlistenLoaderChangeRef);
75
+ var _unlistenLoaderChangeRef_current;
76
+ (_unlistenLoaderChangeRef_current = unlistenLoaderChangeRef.current) === null || _unlistenLoaderChangeRef_current === void 0 ? void 0 : _unlistenLoaderChangeRef_current.call(unlistenLoaderChangeRef);
77
77
  }, []);
78
78
  (0, _react.useMemo)(() => {
79
79
  var _options_params;
@@ -43,13 +43,12 @@ const createRuntime = () => (0, _plugin.createManager)(runtimeHooks);
43
43
  const registerInit = (App, _init) => {
44
44
  const originalInit = App.init;
45
45
  App.init = async (context) => {
46
- var _originalInit, _init1;
47
46
  if (!context.loaderManager) {
48
47
  context.loaderManager = (0, _loaderManager.createLoaderManager)({});
49
48
  }
50
49
  await Promise.all([
51
- (_originalInit = originalInit) === null || _originalInit === void 0 ? void 0 : _originalInit(context),
52
- (_init1 = _init) === null || _init1 === void 0 ? void 0 : _init1(context)
50
+ originalInit === null || originalInit === void 0 ? void 0 : originalInit(context),
51
+ _init === null || _init === void 0 ? void 0 : _init(context)
53
52
  ]);
54
53
  };
55
54
  };
@@ -18,8 +18,7 @@ function findTargetChild(tag, children) {
18
18
  return children.find((item) => getEleType(item) === tag);
19
19
  }
20
20
  function getEleType(ele) {
21
- var _ele, _ele1;
22
- return typeof ((_ele = ele) === null || _ele === void 0 ? void 0 : _ele.type) === "function" ? ele.type.name : (_ele1 = ele) === null || _ele1 === void 0 ? void 0 : _ele1.type;
21
+ return typeof (ele === null || ele === void 0 ? void 0 : ele.type) === "function" ? ele.type.name : ele === null || ele === void 0 ? void 0 : ele.type;
23
22
  }
24
23
  function findTargetElement(tag, children) {
25
24
  if (children.length === 0) {
@@ -27,11 +26,11 @@ function findTargetElement(tag, children) {
27
26
  }
28
27
  let nextChildren = [];
29
28
  for (const item of children) {
30
- var _item_props, _item;
29
+ var _item_props;
31
30
  if (tag === getEleType(item)) {
32
31
  return item;
33
32
  }
34
- if ((_item = item) === null || _item === void 0 ? void 0 : (_item_props = _item.props) === null || _item_props === void 0 ? void 0 : _item_props.children) {
33
+ if (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.children) {
35
34
  nextChildren = nextChildren.concat(item.props.children);
36
35
  }
37
36
  }
@@ -68,7 +68,6 @@ const documentPlugin = () => ({
68
68
  return null;
69
69
  }
70
70
  return async ({ htmlWebpackPlugin }) => {
71
- var _tsConfig, _partialsByEntrypoint;
72
71
  const config = api.useResolvedConfigContext();
73
72
  const documentParams = getDocParams({
74
73
  config,
@@ -83,7 +82,7 @@ const documentPlugin = () => ({
83
82
  } catch (err) {
84
83
  tsConfig = {};
85
84
  }
86
- if ((_tsConfig = tsConfig) === null || _tsConfig === void 0 ? void 0 : _tsConfig.compilerOptions) {
85
+ if (tsConfig === null || tsConfig === void 0 ? void 0 : tsConfig.compilerOptions) {
87
86
  tsConfig.compilerOptions.jsx = "react-jsx";
88
87
  } else {
89
88
  tsConfig.compilerOptions = {
@@ -143,7 +142,7 @@ const documentPlugin = () => ({
143
142
  partialsHead: "",
144
143
  partialsBody: ""
145
144
  };
146
- if ((_partialsByEntrypoint = partialsByEntrypoint) === null || _partialsByEntrypoint === void 0 ? void 0 : _partialsByEntrypoint[entryName]) {
145
+ if (partialsByEntrypoint === null || partialsByEntrypoint === void 0 ? void 0 : partialsByEntrypoint[entryName]) {
147
146
  partialsContent.partialsTop = partialsByEntrypoint[entryName].top.join("\n");
148
147
  partialsContent.partialsHead = partialsByEntrypoint[entryName].head.join("\n");
149
148
  partialsContent.partialsBody = partialsByEntrypoint[entryName].body.join("\n");
@@ -176,9 +175,8 @@ const documentPlugin = () => ({
176
175
  return {
177
176
  tools: {
178
177
  htmlPlugin: (options, entry) => {
179
- var _options, _options1, _options2;
180
- const hackParameters = typeof ((_options = options) === null || _options === void 0 ? void 0 : _options.templateParameters) === "function" ? (_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.templateParameters({}, {}, {}, {}) : {
181
- ...(_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.templateParameters
178
+ const hackParameters = typeof (options === null || options === void 0 ? void 0 : options.templateParameters) === "function" ? options === null || options === void 0 ? void 0 : options.templateParameters({}, {}, {}, {}) : {
179
+ ...options === null || options === void 0 ? void 0 : options.templateParameters
182
180
  };
183
181
  const templateContent = documentEntry(
184
182
  entry.entryName,
@@ -62,13 +62,12 @@ const routerPlugin = () => ({
62
62
  ];
63
63
  },
64
64
  modifyEntryImports({ entrypoint, imports }) {
65
- var _runtimeConfig;
66
65
  const { entryName, isMainEntry, fileSystemRoutes } = entrypoint;
67
66
  const userConfig = api.useResolvedConfigContext();
68
67
  const { packageName } = api.useAppContext();
69
68
  const runtimeConfig = (0, _utils.getEntryOptions)(entryName, isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName);
70
69
  runtimeConfigMap.set(entryName, runtimeConfig);
71
- if ((_runtimeConfig = runtimeConfig) === null || _runtimeConfig === void 0 ? void 0 : _runtimeConfig.router) {
70
+ if (runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.router) {
72
71
  if (!(0, _utils.isRouterV5)(userConfig)) {
73
72
  imports.push({
74
73
  value: "@modern-js/runtime/plugins",
@@ -10,15 +10,14 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
12
12
  const _react = require("react");
13
- const _router = require("@modern-js/utils/runtime/router");
14
- const _runtimenode = require("@modern-js/utils/runtime-node");
13
+ const _router = require("@modern-js/runtime-utils/router");
14
+ const _node = require("@modern-js/runtime-utils/node");
15
15
  const _common = require("../../common");
16
16
  const _utils = require("./utils");
17
17
  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}}))};`;
18
18
  const resolveFnStr = `function r(e,r,o,A){A?_ROUTER_DATA.r[e][r].reject(A):_ROUTER_DATA.r[e][r].resolve(o)};`;
19
19
  const preResolvedFnStr = `function p(e,r){return void 0!==r?Promise.reject(new Error(r.message)):Promise.resolve(e)};`;
20
20
  const DeferredDataScripts = (props) => {
21
- var _props;
22
21
  const context = (0, _react.useContext)(_router.UNSAFE_DataRouterContext);
23
22
  const { staticContext } = context || {};
24
23
  const hydratedRef = (0, _react.useRef)(false);
@@ -35,7 +34,7 @@ const DeferredDataScripts = (props) => {
35
34
  errors: (0, _utils.serializeErrors)(staticContext.errors)
36
35
  };
37
36
  let initialScripts = [
38
- `_ROUTER_DATA = ${(0, _runtimenode.serializeJson)(_ROUTER_DATA)};`,
37
+ `_ROUTER_DATA = ${(0, _node.serializeJson)(_ROUTER_DATA)};`,
39
38
  `_ROUTER_DATA.s = ${setupFnStr}`,
40
39
  `_ROUTER_DATA.r = ${resolveFnStr}`,
41
40
  `_ROUTER_DATA.p = ${preResolvedFnStr}`
@@ -46,9 +45,8 @@ const DeferredDataScripts = (props) => {
46
45
  const { deferredKeys } = deferredData;
47
46
  const deferredKeyPromiseStr = deferredKeys.map((key) => {
48
47
  if (pendingKeys.has(key)) {
49
- var _props2;
50
48
  deferredDataScripts.push(/* @__PURE__ */ (0, _jsxruntime.jsx)(DeferredDataScript, {
51
- nonce: (_props2 = props) === null || _props2 === void 0 ? void 0 : _props2.nonce,
49
+ nonce: props === null || props === void 0 ? void 0 : props.nonce,
52
50
  data: deferredData.data[key],
53
51
  dataKey: key,
54
52
  routeId
@@ -61,12 +59,12 @@ const DeferredDataScripts = (props) => {
61
59
  message: trackedPromise._error.message,
62
60
  stack: process.env.NODE_ENV !== "production" ? trackedPromise._error.stack : void 0
63
61
  };
64
- return `${JSON.stringify(key)}: _ROUTER_DATA.p(${void 0}, ${(0, _runtimenode.serializeJson)(error)})`;
62
+ return `${JSON.stringify(key)}: _ROUTER_DATA.p(${void 0}, ${(0, _node.serializeJson)(error)})`;
65
63
  } else {
66
64
  if (typeof trackedPromise._data === "undefined") {
67
65
  throw new Error(`The deferred data for ${key} was not resolved, did you forget to return data from a deferred promise`);
68
66
  }
69
- return `${JSON.stringify(key)}: _ROUTER_DATA.p(${(0, _runtimenode.serializeJson)(trackedPromise._data)})`;
67
+ return `${JSON.stringify(key)}: _ROUTER_DATA.p(${(0, _node.serializeJson)(trackedPromise._data)})`;
70
68
  }
71
69
  }
72
70
  }).join(",\n");
@@ -84,7 +82,7 @@ const DeferredDataScripts = (props) => {
84
82
  children: [
85
83
  !hydratedRef.current && /* @__PURE__ */ (0, _jsxruntime.jsx)("script", {
86
84
  async: true,
87
- nonce: (_props = props) === null || _props === void 0 ? void 0 : _props.nonce,
85
+ nonce: props === null || props === void 0 ? void 0 : props.nonce,
88
86
  suppressHydrationWarning: true,
89
87
  dangerouslySetInnerHTML: {
90
88
  __html: deferredScripts[0]
@@ -109,7 +107,7 @@ const DeferredDataScript = ({ data, routeId, dataKey, nonce }) => {
109
107
  nonce,
110
108
  suppressHydrationWarning: true,
111
109
  dangerouslySetInnerHTML: {
112
- __html: `_ROUTER_DATA.r(${JSON.stringify(routeId)}, ${JSON.stringify(dataKey)}, ${(0, _runtimenode.serializeJson)(data2)});`
110
+ __html: `_ROUTER_DATA.r(${JSON.stringify(routeId)}, ${JSON.stringify(dataKey)}, ${(0, _node.serializeJson)(data2)});`
113
111
  }
114
112
  })
115
113
  }) : null
@@ -121,7 +119,7 @@ const ErrorDeferredDataScript = ({ routeId, dataKey, nonce }) => {
121
119
  nonce,
122
120
  suppressHydrationWarning: true,
123
121
  dangerouslySetInnerHTML: {
124
- __html: `_ROUTER_DATA.r(${JSON.stringify(routeId)}, ${JSON.stringify(dataKey)}, ${void 0}, ${(0, _runtimenode.serializeJson)({
122
+ __html: `_ROUTER_DATA.r(${JSON.stringify(routeId)}, ${JSON.stringify(dataKey)}, ${void 0}, ${(0, _node.serializeJson)({
125
123
  message: error.message,
126
124
  stack: error.stack
127
125
  })});`
@@ -23,12 +23,11 @@ _export(exports, {
23
23
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
24
24
  const _jsxruntime = require("react/jsx-runtime");
25
25
  const _react = /* @__PURE__ */ _interop_require_wildcard._(require("react"));
26
- const _router = require("@modern-js/utils/runtime/router");
26
+ const _router = require("@modern-js/runtime-utils/router");
27
27
  const _core = require("../../core");
28
28
  function composeEventHandlers(theirHandler, ourHandler) {
29
29
  return (event) => {
30
- var _theirHandler;
31
- (_theirHandler = theirHandler) === null || _theirHandler === void 0 ? void 0 : _theirHandler(event);
30
+ theirHandler === null || theirHandler === void 0 ? void 0 : theirHandler(event);
32
31
  if (!event.defaultPrevented) {
33
32
  ourHandler(event);
34
33
  }
@@ -94,8 +93,7 @@ async function loadRouteModule(route, routeAssets) {
94
93
  }
95
94
  try {
96
95
  await Promise.all(chunkIds.map((chunkId) => {
97
- var __webpack_chunk_load__1;
98
- return (__webpack_chunk_load__1 = __webpack_chunk_load__) === null || __webpack_chunk_load__1 === void 0 ? void 0 : __webpack_chunk_load__1(String(chunkId));
96
+ return __webpack_chunk_load__ === null || __webpack_chunk_load__ === void 0 ? void 0 : __webpack_chunk_load__(String(chunkId));
99
97
  }));
100
98
  } catch (error) {
101
99
  console.error(error);
@@ -129,8 +127,7 @@ const PrefetchPageLinks = ({ pathname }) => {
129
127
  const { routeAssets } = routeManifest || {};
130
128
  const matches = Array.isArray(routes) ? (0, _router.matchRoutes)(routes, pathname) : [];
131
129
  if (Array.isArray(matches) && routeAssets) {
132
- var _matches;
133
- (_matches = matches) === null || _matches === void 0 ? void 0 : _matches.forEach((match) => loadRouteModule(match.route, routeAssets));
130
+ matches === null || matches === void 0 ? void 0 : matches.forEach((match) => loadRouteModule(match.route, routeAssets));
134
131
  }
135
132
  if (!window._SSR_DATA) {
136
133
  return null;
@@ -145,8 +142,7 @@ const PrefetchDataLinks = ({ matches, pathname, routeManifest }) => {
145
142
  const currentMatches = (0, _router.useMatches)();
146
143
  const basename = (0, _router.useHref)("/");
147
144
  const dataHrefs = (0, _react.useMemo)(() => {
148
- var _matches;
149
- return (_matches = matches) === null || _matches === void 0 ? void 0 : _matches.filter((match, index) => {
145
+ return matches === null || matches === void 0 ? void 0 : matches.filter((match, index) => {
150
146
  if (!match.route.loader || typeof match.route.loader !== "function" || match.route.loader.length === 0) {
151
147
  return false;
152
148
  }
@@ -10,6 +10,9 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
+ renderRoutes: function() {
14
+ return _utils.renderRoutes;
15
+ },
13
16
  default: function() {
14
17
  return _default;
15
18
  },
@@ -200,8 +203,9 @@ _export(exports, {
200
203
  }
201
204
  });
202
205
  const _export_star = require("@swc/helpers/_/_export_star");
203
- const _router = require("@modern-js/utils/runtime/router");
206
+ const _router = require("@modern-js/runtime-utils/router");
204
207
  const _plugin = require("./plugin");
208
+ const _utils = require("./utils");
205
209
  _export_star._(require("./withRouter"), exports);
206
210
  const _PrefetchLink = require("./PrefetchLink");
207
211
  const _default = _plugin.routerPlugin;
@@ -27,9 +27,9 @@ const _interop_require_default = require("@swc/helpers/_/_interop_require_defaul
27
27
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
28
28
  const _jsxruntime = require("react/jsx-runtime");
29
29
  const _react = /* @__PURE__ */ _interop_require_wildcard._(require("react"));
30
- const _router = require("@modern-js/utils/runtime/router");
30
+ const _router = require("@modern-js/runtime-utils/router");
31
31
  const _hoistnonreactstatics = /* @__PURE__ */ _interop_require_default._(require("hoist-non-react-statics"));
32
- const _runtimebrowser = require("@modern-js/utils/runtime-browser");
32
+ const _browser = require("@modern-js/runtime-utils/browser");
33
33
  const _core = require("../../core");
34
34
  const _hooks = require("./hooks");
35
35
  const _utils = require("./utils");
@@ -50,7 +50,7 @@ const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename =
50
50
  const select = (pathname) => serverBase.find((baseUrl) => pathname.search(baseUrl) === 0) || "/";
51
51
  let routes = [];
52
52
  finalRouteConfig = routesConfig;
53
- window._SERVER_DATA = (0, _runtimebrowser.parsedJSONFromElement)("__MODERN_SERVER_DATA__");
53
+ window._SERVER_DATA = (0, _browser.parsedJSONFromElement)("__MODERN_SERVER_DATA__");
54
54
  return {
55
55
  name: "@modern-js/plugin-router",
56
56
  registerHook: {
@@ -73,7 +73,6 @@ const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename =
73
73
  });
74
74
  },
75
75
  hoc: ({ App }, next) => {
76
- var _routesConfig;
77
76
  if (!finalRouteConfig && !createRoutes) {
78
77
  return next({
79
78
  App
@@ -88,8 +87,7 @@ const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename =
88
87
  const runtimeContext = (0, _react.useContext)(_core.RuntimeReactContext);
89
88
  const { unstable_getBlockNavState: getBlockNavState } = runtimeContext;
90
89
  return (0, _react.useMemo)(() => {
91
- var _hydrationData;
92
- if ((_hydrationData = hydrationData) === null || _hydrationData === void 0 ? void 0 : _hydrationData.errors) {
90
+ if (hydrationData === null || hydrationData === void 0 ? void 0 : hydrationData.errors) {
93
91
  hydrationData = {
94
92
  ...hydrationData,
95
93
  errors: (0, _utils.deserializeErrors)(hydrationData.errors)
@@ -149,7 +147,7 @@ const routerPlugin = ({ serverBase = [], supportHtml5History = true, basename =
149
147
  if (App) {
150
148
  RouteApp = (0, _hoistnonreactstatics.default)(RouteApp, App);
151
149
  }
152
- if ((_routesConfig = routesConfig) === null || _routesConfig === void 0 ? void 0 : _routesConfig.globalApp) {
150
+ if (routesConfig === null || routesConfig === void 0 ? void 0 : routesConfig.globalApp) {
153
151
  return next({
154
152
  App: (0, _hoistnonreactstatics.default)(RouteApp, routesConfig.globalApp)
155
153
  });
@@ -24,12 +24,12 @@ const _interop_require_default = require("@swc/helpers/_/_interop_require_defaul
24
24
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
25
25
  const _jsxruntime = require("react/jsx-runtime");
26
26
  const _react = /* @__PURE__ */ _interop_require_wildcard._(require("react"));
27
- const _remixrouter = require("@modern-js/utils/runtime/remix-router");
28
- const _router = require("@modern-js/utils/runtime-node/router");
27
+ const _remixrouter = require("@modern-js/runtime-utils/remix-router");
28
+ const _router = require("@modern-js/runtime-utils/node/router");
29
29
  const _hoistnonreactstatics = /* @__PURE__ */ _interop_require_default._(require("hoist-non-react-statics"));
30
- const _router1 = require("@modern-js/utils/runtime/router");
31
- const _runtimenode = require("@modern-js/utils/runtime-node");
32
- const _time = require("@modern-js/utils/universal/time");
30
+ const _router1 = require("@modern-js/runtime-utils/router");
31
+ const _node = require("@modern-js/runtime-utils/node");
32
+ const _time = require("@modern-js/runtime-utils/time");
33
33
  const _constants = require("@modern-js/utils/universal/constants");
34
34
  const _core = require("../../core");
35
35
  const _utils = require("./utils");
@@ -80,8 +80,8 @@ const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
80
80
  const baseUrl = request.baseUrl;
81
81
  const _basename = baseUrl === "/" ? (0, _utils.urlJoin)(baseUrl, basename) : baseUrl;
82
82
  const { reporter, serverTiming } = context.ssrContext;
83
- const requestContext = (0, _runtimenode.createRequestContext)();
84
- requestContext.set(_runtimenode.reporterCtx, reporter);
83
+ const requestContext = (0, _node.createRequestContext)();
84
+ requestContext.set(_node.reporterCtx, reporter);
85
85
  let routes = createRoutes ? createRoutes() : (0, _router1.createRoutesFromElements)((0, _utils.renderRoutes)({
86
86
  routesConfig,
87
87
  ssrMode,
@@ -116,7 +116,6 @@ const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
116
116
  });
117
117
  },
118
118
  hoc: ({ App }, next) => {
119
- var _routesConfig;
120
119
  if (!routesConfig) {
121
120
  return next({
122
121
  App
@@ -136,7 +135,7 @@ const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
136
135
  };
137
136
  };
138
137
  const RouteApp = getRouteApp();
139
- if ((_routesConfig = routesConfig) === null || _routesConfig === void 0 ? void 0 : _routesConfig.globalApp) {
138
+ if (routesConfig === null || routesConfig === void 0 ? void 0 : routesConfig.globalApp) {
140
139
  return next({
141
140
  App: (0, _hoistnonreactstatics.default)(RouteApp, routesConfig.globalApp)
142
141
  });
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("@modern-js/utils/runtime-node/router"), exports);
6
+ _export_star._(require("@modern-js/runtime-utils/node/router"), exports);
@@ -35,9 +35,9 @@ _export(exports, {
35
35
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
36
36
  const _jsxruntime = require("react/jsx-runtime");
37
37
  const _react = /* @__PURE__ */ _interop_require_default._(require("react"));
38
- const _router = require("@modern-js/utils/runtime/router");
39
- const _remixrouter = require("@modern-js/utils/runtime/remix-router");
40
- const _nestedroutes = require("@modern-js/utils/runtime/nested-routes");
38
+ const _router = require("@modern-js/runtime-utils/router");
39
+ const _remixrouter = require("@modern-js/runtime-utils/remix-router");
40
+ const _browser = require("@modern-js/runtime-utils/browser");
41
41
  const _DefaultNotFound = require("./DefaultNotFound");
42
42
  const _DeferredDataScripts = /* @__PURE__ */ _interop_require_default._(require("./DeferredDataScripts"));
43
43
  function getRouteComponents(routes, { globalApp, ssrMode, props, reporter }) {
@@ -56,7 +56,7 @@ function getRouteComponents(routes, { globalApp, ssrMode, props, reporter }) {
56
56
  const routeElements = [];
57
57
  for (const route of routes) {
58
58
  if (route.type === "nested") {
59
- const routeElement = (0, _nestedroutes.renderNestedRoute)(route, {
59
+ const routeElement = (0, _browser.renderNestedRoute)(route, {
60
60
  DeferredDataComponent: ssrMode === "stream" ? _DeferredDataScripts.default : void 0,
61
61
  props,
62
62
  reporter
@@ -95,9 +95,9 @@ function renderRoutes({ routesConfig, props, ssrMode, reporter }) {
95
95
  return routeElements;
96
96
  }
97
97
  function getLocation(serverContext) {
98
- var _serverContext, _url_replace, _url;
99
- const { pathname, url } = ((_serverContext = serverContext) === null || _serverContext === void 0 ? void 0 : _serverContext.request) || {};
100
- const cleanUrl = (_url = url) === null || _url === void 0 ? void 0 : (_url_replace = _url.replace("http://", "")) === null || _url_replace === void 0 ? void 0 : _url_replace.replace("https://", "");
98
+ var _url_replace;
99
+ const { pathname, url } = (serverContext === null || serverContext === void 0 ? void 0 : serverContext.request) || {};
100
+ const cleanUrl = url === null || url === void 0 ? void 0 : (_url_replace = url.replace("http://", "")) === null || _url_replace === void 0 ? void 0 : _url_replace.replace("https://", "");
101
101
  const index = (cleanUrl || "").indexOf(pathname);
102
102
  if (index === -1) {
103
103
  return pathname;
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "withRouter", {
11
11
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
12
  const _jsxruntime = require("react/jsx-runtime");
13
13
  const _react = /* @__PURE__ */ _interop_require_default._(require("react"));
14
- const _router = require("@modern-js/utils/runtime/router");
14
+ const _router = require("@modern-js/runtime-utils/router");
15
15
  const withRouter = (Component) => {
16
16
  return (props) => {
17
17
  const location = (0, _router.useLocation)();
@@ -22,13 +22,12 @@ const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
22
22
  const _utils = require("@modern-js/utils");
23
23
  const PLUGIN_IDENTIFIER = "ssr";
24
24
  const hasStringSSREntry = (userConfig) => {
25
- var _server, _server1;
26
25
  const isStreaming = (ssr) => ssr && typeof ssr === "object" && ssr.mode === "stream";
27
26
  const { server, output } = userConfig;
28
- if ((((_server = server) === null || _server === void 0 ? void 0 : _server.ssr) || output.ssg) && !isStreaming(server.ssr)) {
27
+ if (((server === null || server === void 0 ? void 0 : server.ssr) || output.ssg) && !isStreaming(server.ssr)) {
29
28
  return true;
30
29
  }
31
- if (((_server1 = server) === null || _server1 === void 0 ? void 0 : _server1.ssrByEntries) && typeof server.ssrByEntries === "object") {
30
+ if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && typeof server.ssrByEntries === "object") {
32
31
  for (const name of Object.keys(server.ssrByEntries)) {
33
32
  if (!isStreaming(server.ssrByEntries[name])) {
34
33
  return true;
@@ -38,9 +37,8 @@ const hasStringSSREntry = (userConfig) => {
38
37
  return false;
39
38
  };
40
39
  const checkUseStringSSR = (config) => {
41
- var _output;
42
40
  const { output } = config;
43
- return Boolean((_output = output) === null || _output === void 0 ? void 0 : _output.ssg) || hasStringSSREntry(config);
41
+ return Boolean(output === null || output === void 0 ? void 0 : output.ssg) || hasStringSSREntry(config);
44
42
  };
45
43
  const ssrPlugin = () => ({
46
44
  name: "@modern-js/plugin-ssr",
@@ -83,8 +81,8 @@ const ssrPlugin = () => ({
83
81
  return {
84
82
  source: {
85
83
  alias: {
86
- // ensure that all packages use the same storage in @modern-js/utils/runtime-node
87
- "@modern-js/utils/runtime-node$": require.resolve("@modern-js/utils/runtime-node"),
84
+ // ensure that all packages use the same storage in @modern-js/runtime-utils/node
85
+ "@modern-js/runtime-utils/node$": require.resolve("@modern-js/runtime-utils/node"),
88
86
  "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
89
87
  },
90
88
  globalVars: (values, { target }) => {
@@ -114,9 +112,9 @@ const ssrPlugin = () => ({
114
112
  pluginsExportsUtils.addExport(`export { default as ssr } from '@modern-js/runtime/ssr'`);
115
113
  const ssrConfig = (0, _utils.getEntryOptions)(entryName, isMainEntry, userConfig.server.ssr, userConfig.server.ssrByEntries, packageName);
116
114
  if (typeof ssrConfig === "object" && ssrConfig.mode === "stream") {
117
- var _this, _runtimeConfig;
115
+ var _this;
118
116
  const runtimeConfig = (0, _utils.getEntryOptions)(entryName, isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName);
119
- if (((_this = (_runtimeConfig = runtimeConfig) === null || _runtimeConfig === void 0 ? void 0 : _runtimeConfig.router) === null || _this === void 0 ? void 0 : _this.mode) === "react-router-5") {
117
+ if (((_this = runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.router) === null || _this === void 0 ? void 0 : _this.mode) === "react-router-5") {
120
118
  throw new Error(`router v5 plugin doesn't support streaming SSR, check your config 'runtime.router'`);
121
119
  }
122
120
  if (fileSystemRoutes && !entrypoint.nestedRoutesEntry) {
@@ -142,8 +140,8 @@ const ssrPlugin = () => ({
142
140
  },
143
141
  modifyEntryRuntimePlugins({ entrypoint, plugins, bundlerConfigs }) {
144
142
  if (ssrConfigMap.get(entrypoint.entryName)) {
145
- var _bundlerConfigs_find_output, _bundlerConfigs_find, _bundlerConfigs, _config_server;
146
- const chunkLoadingGlobal = (_bundlerConfigs = bundlerConfigs) === null || _bundlerConfigs === void 0 ? void 0 : (_bundlerConfigs_find = _bundlerConfigs.find((config2) => config2.name === "client")) === null || _bundlerConfigs_find === void 0 ? void 0 : (_bundlerConfigs_find_output = _bundlerConfigs_find.output) === null || _bundlerConfigs_find_output === void 0 ? void 0 : _bundlerConfigs_find_output.chunkLoadingGlobal;
143
+ var _bundlerConfigs_find_output, _bundlerConfigs_find, _config_server;
144
+ const chunkLoadingGlobal = bundlerConfigs === null || bundlerConfigs === void 0 ? void 0 : (_bundlerConfigs_find = bundlerConfigs.find((config2) => config2.name === "client")) === null || _bundlerConfigs_find === void 0 ? void 0 : (_bundlerConfigs_find_output = _bundlerConfigs_find.output) === null || _bundlerConfigs_find_output === void 0 ? void 0 : _bundlerConfigs_find_output.chunkLoadingGlobal;
147
145
  const config = api.useResolvedConfigContext();
148
146
  const { crossorigin, scriptLoading } = config.html;
149
147
  const disablePrerender = typeof ((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.ssr) === "object" ? Boolean(config.server.ssr.disablePrerender) : false;
@@ -22,7 +22,7 @@ const _interop_require_default = require("@swc/helpers/_/_interop_require_defaul
22
22
  const _jsxruntime = require("react/jsx-runtime");
23
23
  const _component = require("@loadable/component");
24
24
  const _hoistnonreactstatics = /* @__PURE__ */ _interop_require_default._(require("hoist-non-react-statics"));
25
- const _runtimebrowser = require("@modern-js/utils/runtime-browser");
25
+ const _browser = require("@modern-js/runtime-utils/browser");
26
26
  const _types = require("./serverRender/types");
27
27
  const _withCallback = require("./react/withCallback");
28
28
  const _utils = require("./utils");
@@ -33,8 +33,8 @@ const ssr = (config) => ({
33
33
  setup: () => {
34
34
  const mockResp = (0, _utils.mockResponse)();
35
35
  if (config.inlineScript === false) {
36
- window._SSR_DATA = (0, _runtimebrowser.parsedJSONFromElement)(_utils1.SSR_DATA_JSON_ID);
37
- window._ROUTER_DATA = (0, _runtimebrowser.parsedJSONFromElement)(_utils1.ROUTER_DATA_JSON_ID);
36
+ window._SSR_DATA = (0, _browser.parsedJSONFromElement)(_utils1.SSR_DATA_JSON_ID);
37
+ window._ROUTER_DATA = (0, _browser.parsedJSONFromElement)(_utils1.ROUTER_DATA_JSON_ID);
38
38
  }
39
39
  return {
40
40
  client: async ({ App, context, ModernRender, ModernHydrate }) => {
@@ -21,6 +21,7 @@ const _export_star = require("@swc/helpers/_/_export_star");
21
21
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
22
22
  const _utils = require("./utils");
23
23
  const _serverRender = /* @__PURE__ */ _interop_require_default._(require("./serverRender"));
24
+ const _tracker = require("./serverRender/tracker");
24
25
  _export_star._(require("./react"), exports);
25
26
  const ssr = (config = {}) => ({
26
27
  name: "@modern-js/plugin-ssr",
@@ -38,6 +39,7 @@ const ssr = (config = {}) => ({
38
39
  const { request } = context.ssrContext;
39
40
  context.ssrContext.request = (0, _utils.formatServer)(request);
40
41
  context.ssrContext.mode = config.mode;
42
+ context.ssrContext.tracker = (0, _tracker.createSSRTracker)(context.ssrContext);
41
43
  if (!context.ssrContext.htmlModifiers) {
42
44
  context.ssrContext.htmlModifiers = [];
43
45
  }
@@ -46,8 +48,7 @@ const ssr = (config = {}) => ({
46
48
  });
47
49
  },
48
50
  pickContext: ({ context, pickedContext }, next) => {
49
- var _context;
50
- const { request, response } = (_context = context) === null || _context === void 0 ? void 0 : _context.ssrContext;
51
+ const { request, response } = context === null || context === void 0 ? void 0 : context.ssrContext;
51
52
  const { initialData } = context;
52
53
  return next({
53
54
  context,
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
12
12
  const _server = require("react-dom/server");
13
- const _runtimenode = require("@modern-js/utils/runtime-node");
13
+ const _node = require("@modern-js/runtime-utils/node");
14
14
  const _server1 = require("@loadable/server");
15
- const prefetch = async (App, context, config) => (0, _runtimenode.run)(context.ssrContext.request.headers, async () => {
16
- var _context_store, _context;
15
+ const prefetch = async (App, context, config) => (0, _node.run)(context.ssrContext.request.headers, async () => {
16
+ var _context_store;
17
17
  const { ssrContext } = context;
18
18
  const { loadableStats } = ssrContext;
19
19
  if (!config.disablePrerender) {
@@ -53,7 +53,7 @@ const prefetch = async (App, context, config) => (0, _runtimenode.run)(context.s
53
53
  initialData: context.initialData,
54
54
  i18nData: context.__i18nData__,
55
55
  // todo: move to plugin state
56
- storeState: (_context = context) === null || _context === void 0 ? void 0 : (_context_store = _context.store) === null || _context_store === void 0 ? void 0 : _context_store.getState()
56
+ storeState: context === null || context === void 0 ? void 0 : (_context_store = context.store) === null || _context_store === void 0 ? void 0 : _context_store.getState()
57
57
  };
58
58
  });
59
59
  const _default = prefetch;