@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
@@ -4,11 +4,10 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
4
4
  import { ChunkExtractor } from "@loadable/server";
5
5
  import { attributesToString, getLoadableScripts } from "../utils";
6
6
  var extname = function(uri) {
7
- var _uri;
8
7
  if (typeof uri !== "string" || !uri.includes(".")) {
9
8
  return "";
10
9
  }
11
- return ".".concat((_uri = uri) === null || _uri === void 0 ? void 0 : _uri.split(".").pop()) || "";
10
+ return ".".concat(uri === null || uri === void 0 ? void 0 : uri.split(".").pop()) || "";
12
11
  };
13
12
  var LoadableCollector = /* @__PURE__ */ function() {
14
13
  "use strict";
@@ -45,35 +44,38 @@ var LoadableCollector = /* @__PURE__ */ function() {
45
44
  var extractor = this.extractor;
46
45
  var chunks = extractor.getChunkAssets(extractor.chunks);
47
46
  chunksMap.js = (chunksMap.js || "") + getLoadableScripts(extractor);
47
+ var attributes = this.generateAttributes();
48
48
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
49
49
  try {
50
50
  for (var _iterator = chunks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
51
51
  var v = _step.value;
52
- var fileType = extname(v.url).slice(1);
53
- var attributes = {};
54
- var crossorigin = config.crossorigin, _config_scriptLoading = config.scriptLoading, scriptLoading = _config_scriptLoading === void 0 ? "defer" : _config_scriptLoading;
55
- if (crossorigin) {
56
- attributes.crossorigin = crossorigin === true ? "anonymous" : crossorigin;
57
- }
58
- switch (scriptLoading) {
59
- case "defer":
60
- attributes.defer = true;
61
- break;
62
- case "module":
63
- attributes.type = "module";
64
- break;
65
- default:
52
+ if (!v.url) {
53
+ continue;
66
54
  }
55
+ var fileType = extname(v.url).slice(1);
67
56
  if (fileType === "js") {
68
57
  var jsChunkReg = new RegExp('<script .*src="'.concat(v.url, '".*>'));
69
58
  if (!jsChunkReg.test(template)) {
59
+ var _config_scriptLoading = config.scriptLoading, scriptLoading = _config_scriptLoading === void 0 ? "defer" : _config_scriptLoading;
60
+ switch (scriptLoading) {
61
+ case "defer":
62
+ attributes.defer = true;
63
+ break;
64
+ case "module":
65
+ attributes.type = "module";
66
+ break;
67
+ default:
68
+ }
70
69
  attributes.nonce = nonce;
71
70
  var attrsStr = attributesToString(attributes);
72
71
  chunksMap[fileType] += "<script".concat(attrsStr, ' src="').concat(v.url, '"></script>');
73
72
  }
74
73
  } else if (fileType === "css") {
75
- var attrsStr1 = attributesToString(attributes);
76
- chunksMap[fileType] += "<link".concat(attrsStr1, ' href="').concat(v.url, '" rel="stylesheet" />');
74
+ var cssChunkReg = new RegExp('<link .*href="'.concat(v.url, '".*>'));
75
+ if (!cssChunkReg.test(template)) {
76
+ var attrsStr1 = attributesToString(attributes);
77
+ chunksMap[fileType] += "<link".concat(attrsStr1, ' href="').concat(v.url, '" rel="stylesheet" />');
78
+ }
77
79
  }
78
80
  }
79
81
  } catch (err) {
@@ -91,6 +93,18 @@ var LoadableCollector = /* @__PURE__ */ function() {
91
93
  }
92
94
  }
93
95
  }
96
+ },
97
+ {
98
+ key: "generateAttributes",
99
+ value: function generateAttributes() {
100
+ var config = this.options.config;
101
+ var crossorigin = config.crossorigin;
102
+ var attributes = {};
103
+ if (crossorigin) {
104
+ attributes.crossorigin = crossorigin === true ? "anonymous" : crossorigin;
105
+ }
106
+ return attributes;
107
+ }
94
108
  }
95
109
  ]);
96
110
  return LoadableCollector2;
@@ -4,11 +4,14 @@ export var SSRTimings;
4
4
  SSRTimings2[SSRTimings2["SSR_RENDER_TOTAL"] = 0] = "SSR_RENDER_TOTAL";
5
5
  SSRTimings2[SSRTimings2["SSR_PREFETCH"] = 1] = "SSR_PREFETCH";
6
6
  SSRTimings2[SSRTimings2["SSR_RENDER_HTML"] = 2] = "SSR_RENDER_HTML";
7
+ SSRTimings2[SSRTimings2["SSR_RENDER_SHELL"] = 3] = "SSR_RENDER_SHELL";
7
8
  })(SSRTimings || (SSRTimings = {}));
8
9
  export var SSRErrors;
9
10
  (function(SSRErrors2) {
10
11
  SSRErrors2[SSRErrors2["PREFETCH"] = 0] = "PREFETCH";
11
12
  SSRErrors2[SSRErrors2["RENDER_HTML"] = 1] = "RENDER_HTML";
13
+ SSRErrors2[SSRErrors2["RENDER_STREAM"] = 2] = "RENDER_STREAM";
14
+ SSRErrors2[SSRErrors2["RENDER_SHELL"] = 3] = "RENDER_SHELL";
12
15
  })(SSRErrors || (SSRErrors = {}));
13
16
  var _obj;
14
17
  var errors = (_obj = {}, _define_property(_obj, SSRErrors.PREFETCH, {
@@ -19,6 +22,12 @@ var errors = (_obj = {}, _define_property(_obj, SSRErrors.PREFETCH, {
19
22
  reporter: "SSR Error - App Render To HTML",
20
23
  logger: "App Render To HTML",
21
24
  metrics: "app.render.html.error"
25
+ }), _define_property(_obj, SSRErrors.RENDER_STREAM, {
26
+ reporter: "SSR Error - App Render To Streaming",
27
+ logger: "An error occurs during streaming SSR",
28
+ metrics: "app.render.streaming.error"
29
+ }), _define_property(_obj, SSRErrors.RENDER_SHELL, {
30
+ metrics: "app.render.streaming.shell.error"
22
31
  }), _obj);
23
32
  var _obj1;
24
33
  var timings = (_obj1 = {}, _define_property(_obj1, SSRTimings.SSR_PREFETCH, {
@@ -36,6 +45,8 @@ var timings = (_obj1 = {}, _define_property(_obj1, SSRTimings.SSR_PREFETCH, {
36
45
  serverTiming: "ssr-render-total",
37
46
  metrics: "app.render.cost",
38
47
  logger: "App Render Total cost = %d ms"
48
+ }), _define_property(_obj1, SSRTimings.SSR_RENDER_SHELL, {
49
+ reporter: "ssr-render-shell"
39
50
  }), _obj1);
40
51
  export function createSSRTracker(param) {
41
52
  var reporter = param.reporter, serverTiming = param.serverTiming, metrics = param.metrics, logger = param.logger;
@@ -48,16 +48,15 @@ export const createApp = ({ plugins, props: globalProps }) => {
48
48
  }, {
49
49
  onLast: ({ App: App2 }) => {
50
50
  const WrapComponent = ({ context, ...props }) => {
51
- var _contextValue;
52
51
  let contextValue = context;
53
- if (!((_contextValue = contextValue) === null || _contextValue === void 0 ? void 0 : _contextValue.runner)) {
52
+ if (!(contextValue === null || contextValue === void 0 ? void 0 : contextValue.runner)) {
54
53
  contextValue = getInitialContext(runner);
55
54
  runner.init({
56
55
  context: contextValue
57
56
  }, {
58
57
  onLast: ({ context: context1 }) => {
59
- var _App_init, _App;
60
- 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);
58
+ var _App_init;
59
+ return App2 === null || App2 === void 0 ? void 0 : (_App_init = App2.init) === null || _App_init === void 0 ? void 0 : _App_init.call(App2, context1);
61
60
  }
62
61
  });
63
62
  }
@@ -93,8 +92,8 @@ export const bootstrap = async (BootApp, id, root, ReactDOM) => {
93
92
  context: _context
94
93
  }, {
95
94
  onLast: ({ context: context1 }) => {
96
- var _App_init, _App;
97
- 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);
95
+ var _App_init;
96
+ return App === null || App === void 0 ? void 0 : (_App_init = App.init) === null || _App_init === void 0 ? void 0 : _App_init.call(App, context1);
98
97
  }
99
98
  });
100
99
  if (!id) {
@@ -105,9 +104,9 @@ export const bootstrap = async (BootApp, id, root, ReactDOM) => {
105
104
  const isBrowser = typeof window !== "undefined" && window.name !== "nodejs";
106
105
  if (isBrowser) {
107
106
  if (isClientArgs(id)) {
108
- var _ssrData_data, _ssrData, _ssrData1, _ssrData_data1, _ssrData2;
107
+ var _ssrData_data, _ssrData_data1;
109
108
  const ssrData = window._SSR_DATA;
110
- const loadersData = ((_ssrData = ssrData) === null || _ssrData === void 0 ? void 0 : (_ssrData_data = _ssrData.data) === null || _ssrData_data === void 0 ? void 0 : _ssrData_data.loadersData) || {};
109
+ const loadersData = (ssrData === null || ssrData === void 0 ? void 0 : (_ssrData_data = ssrData.data) === null || _ssrData_data === void 0 ? void 0 : _ssrData_data.loadersData) || {};
111
110
  const initialLoadersState = Object.keys(loadersData).reduce((res, key) => {
112
111
  const loaderData = loadersData[key];
113
112
  if (loaderData.loading !== false) {
@@ -121,10 +120,10 @@ export const bootstrap = async (BootApp, id, root, ReactDOM) => {
121
120
  skipStatic: true
122
121
  }),
123
122
  ...ssrData ? {
124
- ssrContext: (_ssrData1 = ssrData) === null || _ssrData1 === void 0 ? void 0 : _ssrData1.context
123
+ ssrContext: ssrData === null || ssrData === void 0 ? void 0 : ssrData.context
125
124
  } : {}
126
125
  });
127
- context.initialData = (_ssrData2 = ssrData) === null || _ssrData2 === void 0 ? void 0 : (_ssrData_data1 = _ssrData2.data) === null || _ssrData_data1 === void 0 ? void 0 : _ssrData_data1.initialData;
126
+ context.initialData = ssrData === null || ssrData === void 0 ? void 0 : (_ssrData_data1 = ssrData.data) === null || _ssrData_data1 === void 0 ? void 0 : _ssrData_data1.initialData;
128
127
  const initialData = await runInit(context);
129
128
  if (initialData) {
130
129
  context.initialData = initialData;
@@ -14,7 +14,7 @@ const useLoader = (loaderFn, options = {
14
14
  delete options._cache;
15
15
  }
16
16
  const load = useCallback((params) => {
17
- var _unlistenLoaderChangeRef_current, _unlistenLoaderChangeRef, _window__SSR_DATA_data_loadersData_id, _window__SSR_DATA_data, _window__SSR_DATA, _window, _loaderRef_current;
17
+ var _unlistenLoaderChangeRef_current, _window__SSR_DATA_data_loadersData_id, _window__SSR_DATA_data, _window__SSR_DATA, _window, _loaderRef_current;
18
18
  if (typeof params === "undefined") {
19
19
  var _loaderRef_current1;
20
20
  return (_loaderRef_current1 = loaderRef.current) === null || _loaderRef_current1 === void 0 ? void 0 : _loaderRef_current1.load();
@@ -34,7 +34,7 @@ const useLoader = (loaderFn, options = {
34
34
  params
35
35
  });
36
36
  loaderRef.current = loaderManager.get(id);
37
- (_unlistenLoaderChangeRef_current = (_unlistenLoaderChangeRef = unlistenLoaderChangeRef).current) === null || _unlistenLoaderChangeRef_current === void 0 ? void 0 : _unlistenLoaderChangeRef_current.call(_unlistenLoaderChangeRef);
37
+ (_unlistenLoaderChangeRef_current = unlistenLoaderChangeRef.current) === null || _unlistenLoaderChangeRef_current === void 0 ? void 0 : _unlistenLoaderChangeRef_current.call(unlistenLoaderChangeRef);
38
38
  if (isSSRRender) {
39
39
  return void 0;
40
40
  }
@@ -48,12 +48,12 @@ const useLoader = (loaderFn, options = {
48
48
  unlistenLoaderChangeRef.current = (_loaderRef_current = loaderRef.current) === null || _loaderRef_current === void 0 ? void 0 : _loaderRef_current.onChange((_status, _result) => {
49
49
  setResult(_result);
50
50
  if (_status === LoaderStatus.fulfilled) {
51
- var _options_onSuccess, _options;
52
- (_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);
51
+ var _options_onSuccess;
52
+ options === null || options === void 0 ? void 0 : (_options_onSuccess = options.onSuccess) === null || _options_onSuccess === void 0 ? void 0 : _options_onSuccess.call(options, _result.data);
53
53
  }
54
54
  if (_status === LoaderStatus.rejected) {
55
- var _options_onError, _options1;
56
- (_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);
55
+ var _options_onError;
56
+ options === null || options === void 0 ? void 0 : (_options_onError = options.onError) === null || _options_onError === void 0 ? void 0 : _options_onError.call(options, _result.error);
57
57
  }
58
58
  });
59
59
  return res;
@@ -61,8 +61,8 @@ const useLoader = (loaderFn, options = {
61
61
  options.skip
62
62
  ]);
63
63
  useEffect(() => () => {
64
- var _unlistenLoaderChangeRef_current, _unlistenLoaderChangeRef;
65
- (_unlistenLoaderChangeRef_current = (_unlistenLoaderChangeRef = unlistenLoaderChangeRef).current) === null || _unlistenLoaderChangeRef_current === void 0 ? void 0 : _unlistenLoaderChangeRef_current.call(_unlistenLoaderChangeRef);
64
+ var _unlistenLoaderChangeRef_current;
65
+ (_unlistenLoaderChangeRef_current = unlistenLoaderChangeRef.current) === null || _unlistenLoaderChangeRef_current === void 0 ? void 0 : _unlistenLoaderChangeRef_current.call(unlistenLoaderChangeRef);
66
66
  }, []);
67
67
  useMemo(() => {
68
68
  var _options_params;
@@ -18,13 +18,12 @@ export const createRuntime = () => createManager(runtimeHooks);
18
18
  const registerInit = (App, _init) => {
19
19
  const originalInit = App.init;
20
20
  App.init = async (context) => {
21
- var _originalInit, _init1;
22
21
  if (!context.loaderManager) {
23
22
  context.loaderManager = createLoaderManager({});
24
23
  }
25
24
  await Promise.all([
26
- (_originalInit = originalInit) === null || _originalInit === void 0 ? void 0 : _originalInit(context),
27
- (_init1 = _init) === null || _init1 === void 0 ? void 0 : _init1(context)
25
+ originalInit === null || originalInit === void 0 ? void 0 : originalInit(context),
26
+ _init === null || _init === void 0 ? void 0 : _init(context)
28
27
  ]);
29
28
  };
30
29
  };
@@ -6,8 +6,7 @@ function findTargetChild(tag, children) {
6
6
  return children.find((item) => getEleType(item) === tag);
7
7
  }
8
8
  function getEleType(ele) {
9
- var _ele, _ele1;
10
- 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;
9
+ return typeof (ele === null || ele === void 0 ? void 0 : ele.type) === "function" ? ele.type.name : ele === null || ele === void 0 ? void 0 : ele.type;
11
10
  }
12
11
  function findTargetElement(tag, children) {
13
12
  if (children.length === 0) {
@@ -15,11 +14,11 @@ function findTargetElement(tag, children) {
15
14
  }
16
15
  let nextChildren = [];
17
16
  for (const item of children) {
18
- var _item_props, _item;
17
+ var _item_props;
19
18
  if (tag === getEleType(item)) {
20
19
  return item;
21
20
  }
22
- if ((_item = item) === null || _item === void 0 ? void 0 : (_item_props = _item.props) === null || _item_props === void 0 ? void 0 : _item_props.children) {
21
+ if (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.children) {
23
22
  nextChildren = nextChildren.concat(item.props.children);
24
23
  }
25
24
  }
@@ -45,7 +45,6 @@ export const documentPlugin = () => ({
45
45
  return null;
46
46
  }
47
47
  return async ({ htmlWebpackPlugin }) => {
48
- var _tsConfig, _partialsByEntrypoint;
49
48
  const config = api.useResolvedConfigContext();
50
49
  const documentParams = getDocParams({
51
50
  config,
@@ -60,7 +59,7 @@ export const documentPlugin = () => ({
60
59
  } catch (err) {
61
60
  tsConfig = {};
62
61
  }
63
- if ((_tsConfig = tsConfig) === null || _tsConfig === void 0 ? void 0 : _tsConfig.compilerOptions) {
62
+ if (tsConfig === null || tsConfig === void 0 ? void 0 : tsConfig.compilerOptions) {
64
63
  tsConfig.compilerOptions.jsx = "react-jsx";
65
64
  } else {
66
65
  tsConfig.compilerOptions = {
@@ -120,7 +119,7 @@ export const documentPlugin = () => ({
120
119
  partialsHead: "",
121
120
  partialsBody: ""
122
121
  };
123
- if ((_partialsByEntrypoint = partialsByEntrypoint) === null || _partialsByEntrypoint === void 0 ? void 0 : _partialsByEntrypoint[entryName]) {
122
+ if (partialsByEntrypoint === null || partialsByEntrypoint === void 0 ? void 0 : partialsByEntrypoint[entryName]) {
124
123
  partialsContent.partialsTop = partialsByEntrypoint[entryName].top.join("\n");
125
124
  partialsContent.partialsHead = partialsByEntrypoint[entryName].head.join("\n");
126
125
  partialsContent.partialsBody = partialsByEntrypoint[entryName].body.join("\n");
@@ -153,9 +152,8 @@ export const documentPlugin = () => ({
153
152
  return {
154
153
  tools: {
155
154
  htmlPlugin: (options, entry) => {
156
- var _options, _options1, _options2;
157
- const hackParameters = typeof ((_options = options) === null || _options === void 0 ? void 0 : _options.templateParameters) === "function" ? (_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.templateParameters({}, {}, {}, {}) : {
158
- ...(_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.templateParameters
155
+ const hackParameters = typeof (options === null || options === void 0 ? void 0 : options.templateParameters) === "function" ? options === null || options === void 0 ? void 0 : options.templateParameters({}, {}, {}, {}) : {
156
+ ...options === null || options === void 0 ? void 0 : options.templateParameters
159
157
  };
160
158
  const templateContent = documentEntry(
161
159
  entry.entryName,
@@ -43,13 +43,12 @@ export const routerPlugin = () => ({
43
43
  ];
44
44
  },
45
45
  modifyEntryImports({ entrypoint, imports }) {
46
- var _runtimeConfig;
47
46
  const { entryName, isMainEntry, fileSystemRoutes } = entrypoint;
48
47
  const userConfig = api.useResolvedConfigContext();
49
48
  const { packageName } = api.useAppContext();
50
49
  const runtimeConfig = getEntryOptions(entryName, isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName);
51
50
  runtimeConfigMap.set(entryName, runtimeConfig);
52
- if ((_runtimeConfig = runtimeConfig) === null || _runtimeConfig === void 0 ? void 0 : _runtimeConfig.router) {
51
+ if (runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.router) {
53
52
  if (!isV5(userConfig)) {
54
53
  imports.push({
55
54
  value: "@modern-js/runtime/plugins",
@@ -1,14 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Suspense, useEffect, useRef, useMemo, useContext } from "react";
3
- import { Await, UNSAFE_DataRouterContext as DataRouterContext, useAsyncError } from "@modern-js/utils/runtime/router";
4
- import { serializeJson } from "@modern-js/utils/runtime-node";
3
+ import { Await, UNSAFE_DataRouterContext as DataRouterContext, useAsyncError } from "@modern-js/runtime-utils/router";
4
+ import { serializeJson } from "@modern-js/runtime-utils/node";
5
5
  import { JSX_SHELL_STREAM_END_MARK } from "../../common";
6
6
  import { serializeErrors } from "./utils";
7
7
  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
8
  const resolveFnStr = `function r(e,r,o,A){A?_ROUTER_DATA.r[e][r].reject(A):_ROUTER_DATA.r[e][r].resolve(o)};`;
9
9
  const preResolvedFnStr = `function p(e,r){return void 0!==r?Promise.reject(new Error(r.message)):Promise.resolve(e)};`;
10
10
  const DeferredDataScripts = (props) => {
11
- var _props;
12
11
  const context = useContext(DataRouterContext);
13
12
  const { staticContext } = context || {};
14
13
  const hydratedRef = useRef(false);
@@ -36,9 +35,8 @@ const DeferredDataScripts = (props) => {
36
35
  const { deferredKeys } = deferredData;
37
36
  const deferredKeyPromiseStr = deferredKeys.map((key) => {
38
37
  if (pendingKeys.has(key)) {
39
- var _props2;
40
38
  deferredDataScripts.push(/* @__PURE__ */ _jsx(DeferredDataScript, {
41
- nonce: (_props2 = props) === null || _props2 === void 0 ? void 0 : _props2.nonce,
39
+ nonce: props === null || props === void 0 ? void 0 : props.nonce,
42
40
  data: deferredData.data[key],
43
41
  dataKey: key,
44
42
  routeId
@@ -74,7 +72,7 @@ const DeferredDataScripts = (props) => {
74
72
  children: [
75
73
  !hydratedRef.current && /* @__PURE__ */ _jsx("script", {
76
74
  async: true,
77
- nonce: (_props = props) === null || _props === void 0 ? void 0 : _props.nonce,
75
+ nonce: props === null || props === void 0 ? void 0 : props.nonce,
78
76
  suppressHydrationWarning: true,
79
77
  dangerouslySetInnerHTML: {
80
78
  __html: deferredScripts[0]
@@ -1,11 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React, { useContext, useMemo } from "react";
3
- import { Link as RouterLink, matchRoutes, useResolvedPath, useHref, useMatches, NavLink as RouterNavLink } from "@modern-js/utils/runtime/router";
3
+ import { Link as RouterLink, matchRoutes, useResolvedPath, useHref, useMatches, NavLink as RouterNavLink } from "@modern-js/runtime-utils/router";
4
4
  import { RuntimeReactContext } from "../../core";
5
5
  export function composeEventHandlers(theirHandler, ourHandler) {
6
6
  return (event) => {
7
- var _theirHandler;
8
- (_theirHandler = theirHandler) === null || _theirHandler === void 0 ? void 0 : _theirHandler(event);
7
+ theirHandler === null || theirHandler === void 0 ? void 0 : theirHandler(event);
9
8
  if (!event.defaultPrevented) {
10
9
  ourHandler(event);
11
10
  }
@@ -71,8 +70,7 @@ async function loadRouteModule(route, routeAssets) {
71
70
  }
72
71
  try {
73
72
  await Promise.all(chunkIds.map((chunkId) => {
74
- var __webpack_chunk_load__1;
75
- return (__webpack_chunk_load__1 = __webpack_chunk_load__) === null || __webpack_chunk_load__1 === void 0 ? void 0 : __webpack_chunk_load__1(String(chunkId));
73
+ return __webpack_chunk_load__ === null || __webpack_chunk_load__ === void 0 ? void 0 : __webpack_chunk_load__(String(chunkId));
76
74
  }));
77
75
  } catch (error) {
78
76
  console.error(error);
@@ -106,8 +104,7 @@ const PrefetchPageLinks = ({ pathname }) => {
106
104
  const { routeAssets } = routeManifest || {};
107
105
  const matches = Array.isArray(routes) ? matchRoutes(routes, pathname) : [];
108
106
  if (Array.isArray(matches) && routeAssets) {
109
- var _matches;
110
- (_matches = matches) === null || _matches === void 0 ? void 0 : _matches.forEach((match) => loadRouteModule(match.route, routeAssets));
107
+ matches === null || matches === void 0 ? void 0 : matches.forEach((match) => loadRouteModule(match.route, routeAssets));
111
108
  }
112
109
  if (!window._SSR_DATA) {
113
110
  return null;
@@ -122,8 +119,7 @@ const PrefetchDataLinks = ({ matches, pathname, routeManifest }) => {
122
119
  const currentMatches = useMatches();
123
120
  const basename = useHref("/");
124
121
  const dataHrefs = useMemo(() => {
125
- var _matches;
126
- return (_matches = matches) === null || _matches === void 0 ? void 0 : _matches.filter((match, index) => {
122
+ return matches === null || matches === void 0 ? void 0 : matches.filter((match, index) => {
127
123
  if (!match.route.loader || typeof match.route.loader !== "function" || match.route.loader.length === 0) {
128
124
  return false;
129
125
  }
@@ -1,5 +1,6 @@
1
- import { useRouteLoaderData as useRouteData } from "@modern-js/utils/runtime/router";
1
+ import { useRouteLoaderData as useRouteData } from "@modern-js/runtime-utils/router";
2
2
  import { routerPlugin } from "./plugin";
3
+ export { renderRoutes } from "./utils";
3
4
  export default routerPlugin;
4
5
  export { modifyRoutes } from "./plugin";
5
6
  export * from "./withRouter";
@@ -65,4 +66,4 @@ export {
65
66
  defer,
66
67
  json,
67
68
  redirect
68
- } from "@modern-js/utils/runtime/router";
69
+ } from "@modern-js/runtime-utils/router";
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useContext, useMemo } from "react";
3
- import { createBrowserRouter, createHashRouter, RouterProvider, createRoutesFromElements, useMatches, useLocation } from "@modern-js/utils/runtime/router";
3
+ import { createBrowserRouter, createHashRouter, RouterProvider, createRoutesFromElements, useMatches, useLocation } from "@modern-js/runtime-utils/router";
4
4
  import hoistNonReactStatics from "hoist-non-react-statics";
5
- import { parsedJSONFromElement } from "@modern-js/utils/runtime-browser";
5
+ import { parsedJSONFromElement } from "@modern-js/runtime-utils/browser";
6
6
  import { RuntimeReactContext } from "../../core";
7
7
  import { modifyRoutes as modifyRoutesHook } from "./hooks";
8
8
  import { deserializeErrors, renderRoutes, urlJoin } from "./utils";
@@ -46,7 +46,6 @@ export const routerPlugin = ({ serverBase = [], supportHtml5History = true, base
46
46
  });
47
47
  },
48
48
  hoc: ({ App }, next) => {
49
- var _routesConfig;
50
49
  if (!finalRouteConfig && !createRoutes) {
51
50
  return next({
52
51
  App
@@ -61,8 +60,7 @@ export const routerPlugin = ({ serverBase = [], supportHtml5History = true, base
61
60
  const runtimeContext = useContext(RuntimeReactContext);
62
61
  const { unstable_getBlockNavState: getBlockNavState } = runtimeContext;
63
62
  return useMemo(() => {
64
- var _hydrationData;
65
- if ((_hydrationData = hydrationData) === null || _hydrationData === void 0 ? void 0 : _hydrationData.errors) {
63
+ if (hydrationData === null || hydrationData === void 0 ? void 0 : hydrationData.errors) {
66
64
  hydrationData = {
67
65
  ...hydrationData,
68
66
  errors: deserializeErrors(hydrationData.errors)
@@ -122,7 +120,7 @@ export const routerPlugin = ({ serverBase = [], supportHtml5History = true, base
122
120
  if (App) {
123
121
  RouteApp = hoistNonReactStatics(RouteApp, App);
124
122
  }
125
- if ((_routesConfig = routesConfig) === null || _routesConfig === void 0 ? void 0 : _routesConfig.globalApp) {
123
+ if (routesConfig === null || routesConfig === void 0 ? void 0 : routesConfig.globalApp) {
126
124
  return next({
127
125
  App: hoistNonReactStatics(RouteApp, routesConfig.globalApp)
128
126
  });
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useContext } from "react";
3
- import { createStaticHandler } from "@modern-js/utils/runtime/remix-router";
4
- import { createStaticRouter, StaticRouterProvider } from "@modern-js/utils/runtime-node/router";
3
+ import { createStaticHandler } from "@modern-js/runtime-utils/remix-router";
4
+ import { createStaticRouter, StaticRouterProvider } from "@modern-js/runtime-utils/node/router";
5
5
  import hoistNonReactStatics from "hoist-non-react-statics";
6
- import { createRoutesFromElements } from "@modern-js/utils/runtime/router";
7
- import { createRequestContext, reporterCtx } from "@modern-js/utils/runtime-node";
8
- import { time } from "@modern-js/utils/universal/time";
6
+ import { createRoutesFromElements } from "@modern-js/runtime-utils/router";
7
+ import { createRequestContext, reporterCtx } from "@modern-js/runtime-utils/node";
8
+ import { time } from "@modern-js/runtime-utils/time";
9
9
  import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
10
10
  import { RuntimeReactContext } from "../../core";
11
11
  import { renderRoutes, urlJoin } from "./utils";
@@ -92,7 +92,6 @@ export const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
92
92
  });
93
93
  },
94
94
  hoc: ({ App }, next) => {
95
- var _routesConfig;
96
95
  if (!routesConfig) {
97
96
  return next({
98
97
  App
@@ -112,7 +111,7 @@ export const routerPlugin = ({ basename = "", routesConfig, createRoutes }) => {
112
111
  };
113
112
  };
114
113
  const RouteApp = getRouteApp();
115
- if ((_routesConfig = routesConfig) === null || _routesConfig === void 0 ? void 0 : _routesConfig.globalApp) {
114
+ if (routesConfig === null || routesConfig === void 0 ? void 0 : routesConfig.globalApp) {
116
115
  return next({
117
116
  App: hoistNonReactStatics(RouteApp, routesConfig.globalApp)
118
117
  });
@@ -1 +1 @@
1
- export * from "@modern-js/utils/runtime-node/router";
1
+ export * from "@modern-js/runtime-utils/node/router";
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Route, isRouteErrorResponse } from "@modern-js/utils/runtime/router";
3
- import { ErrorResponse } from "@modern-js/utils/runtime/remix-router";
4
- import { renderNestedRoute } from "@modern-js/utils/runtime/nested-routes";
2
+ import { Route, isRouteErrorResponse } from "@modern-js/runtime-utils/router";
3
+ import { ErrorResponse } from "@modern-js/runtime-utils/remix-router";
4
+ import { renderNestedRoute } from "@modern-js/runtime-utils/browser";
5
5
  import { DefaultNotFound } from "./DefaultNotFound";
6
6
  import DeferredDataScripts from "./DeferredDataScripts";
7
7
  export function getRouteComponents(routes, { globalApp, ssrMode, props, reporter }) {
@@ -59,9 +59,9 @@ export function renderRoutes({ routesConfig, props, ssrMode, reporter }) {
59
59
  return routeElements;
60
60
  }
61
61
  export function getLocation(serverContext) {
62
- var _serverContext, _url_replace, _url;
63
- const { pathname, url } = ((_serverContext = serverContext) === null || _serverContext === void 0 ? void 0 : _serverContext.request) || {};
64
- 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://", "");
62
+ var _url_replace;
63
+ const { pathname, url } = (serverContext === null || serverContext === void 0 ? void 0 : serverContext.request) || {};
64
+ 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://", "");
65
65
  const index = (cleanUrl || "").indexOf(pathname);
66
66
  if (index === -1) {
67
67
  return pathname;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useLocation, useNavigate, useParams } from "@modern-js/utils/runtime/router";
2
+ import { useLocation, useNavigate, useParams } from "@modern-js/runtime-utils/router";
3
3
  export const withRouter = (Component) => {
4
4
  return (props) => {
5
5
  const location = useLocation();
@@ -2,13 +2,12 @@ import path from "path";
2
2
  import { getEntryOptions, SERVER_RENDER_FUNCTION_NAME, LOADABLE_STATS_FILE, isUseSSRBundle, createRuntimeExportsUtils, isSSGEntry } from "@modern-js/utils";
3
3
  const PLUGIN_IDENTIFIER = "ssr";
4
4
  const hasStringSSREntry = (userConfig) => {
5
- var _server, _server1;
6
5
  const isStreaming = (ssr) => ssr && typeof ssr === "object" && ssr.mode === "stream";
7
6
  const { server, output } = userConfig;
8
- if ((((_server = server) === null || _server === void 0 ? void 0 : _server.ssr) || output.ssg) && !isStreaming(server.ssr)) {
7
+ if (((server === null || server === void 0 ? void 0 : server.ssr) || output.ssg) && !isStreaming(server.ssr)) {
9
8
  return true;
10
9
  }
11
- if (((_server1 = server) === null || _server1 === void 0 ? void 0 : _server1.ssrByEntries) && typeof server.ssrByEntries === "object") {
10
+ if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && typeof server.ssrByEntries === "object") {
12
11
  for (const name of Object.keys(server.ssrByEntries)) {
13
12
  if (!isStreaming(server.ssrByEntries[name])) {
14
13
  return true;
@@ -18,9 +17,8 @@ const hasStringSSREntry = (userConfig) => {
18
17
  return false;
19
18
  };
20
19
  const checkUseStringSSR = (config) => {
21
- var _output;
22
20
  const { output } = config;
23
- return Boolean((_output = output) === null || _output === void 0 ? void 0 : _output.ssg) || hasStringSSREntry(config);
21
+ return Boolean(output === null || output === void 0 ? void 0 : output.ssg) || hasStringSSREntry(config);
24
22
  };
25
23
  export const ssrPlugin = () => ({
26
24
  name: "@modern-js/plugin-ssr",
@@ -63,8 +61,8 @@ export const ssrPlugin = () => ({
63
61
  return {
64
62
  source: {
65
63
  alias: {
66
- // ensure that all packages use the same storage in @modern-js/utils/runtime-node
67
- "@modern-js/utils/runtime-node$": require.resolve("@modern-js/utils/runtime-node"),
64
+ // ensure that all packages use the same storage in @modern-js/runtime-utils/node
65
+ "@modern-js/runtime-utils/node$": require.resolve("@modern-js/runtime-utils/node"),
68
66
  "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
69
67
  },
70
68
  globalVars: (values, { target }) => {
@@ -94,9 +92,9 @@ export const ssrPlugin = () => ({
94
92
  pluginsExportsUtils.addExport(`export { default as ssr } from '@modern-js/runtime/ssr'`);
95
93
  const ssrConfig = getEntryOptions(entryName, isMainEntry, userConfig.server.ssr, userConfig.server.ssrByEntries, packageName);
96
94
  if (typeof ssrConfig === "object" && ssrConfig.mode === "stream") {
97
- var _this, _runtimeConfig;
95
+ var _this;
98
96
  const runtimeConfig = getEntryOptions(entryName, isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName);
99
- if (((_this = (_runtimeConfig = runtimeConfig) === null || _runtimeConfig === void 0 ? void 0 : _runtimeConfig.router) === null || _this === void 0 ? void 0 : _this.mode) === "react-router-5") {
97
+ if (((_this = runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.router) === null || _this === void 0 ? void 0 : _this.mode) === "react-router-5") {
100
98
  throw new Error(`router v5 plugin doesn't support streaming SSR, check your config 'runtime.router'`);
101
99
  }
102
100
  if (fileSystemRoutes && !entrypoint.nestedRoutesEntry) {
@@ -122,8 +120,8 @@ export const ssrPlugin = () => ({
122
120
  },
123
121
  modifyEntryRuntimePlugins({ entrypoint, plugins, bundlerConfigs }) {
124
122
  if (ssrConfigMap.get(entrypoint.entryName)) {
125
- var _bundlerConfigs_find_output, _bundlerConfigs_find, _bundlerConfigs, _config_server;
126
- 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;
123
+ var _bundlerConfigs_find_output, _bundlerConfigs_find, _config_server;
124
+ 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;
127
125
  const config = api.useResolvedConfigContext();
128
126
  const { crossorigin, scriptLoading } = config.html;
129
127
  const disablePrerender = typeof ((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.ssr) === "object" ? Boolean(config.server.ssr.disablePrerender) : false;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { loadableReady } from "@loadable/component";
3
3
  import hoistNonReactStatics from "hoist-non-react-statics";
4
- import { parsedJSONFromElement } from "@modern-js/utils/runtime-browser";
4
+ import { parsedJSONFromElement } from "@modern-js/runtime-utils/browser";
5
5
  import { RenderLevel } from "./serverRender/types";
6
6
  import { WithCallback } from "./react/withCallback";
7
7
  import { formatClient, mockResponse, isReact18 } from "./utils";
@@ -1,5 +1,6 @@
1
1
  import { formatServer } from "./utils";
2
2
  import render from "./serverRender";
3
+ import { createSSRTracker } from "./serverRender/tracker";
3
4
  export const ssr = (config = {}) => ({
4
5
  name: "@modern-js/plugin-ssr",
5
6
  setup: () => {
@@ -16,6 +17,7 @@ export const ssr = (config = {}) => ({
16
17
  const { request } = context.ssrContext;
17
18
  context.ssrContext.request = formatServer(request);
18
19
  context.ssrContext.mode = config.mode;
20
+ context.ssrContext.tracker = createSSRTracker(context.ssrContext);
19
21
  if (!context.ssrContext.htmlModifiers) {
20
22
  context.ssrContext.htmlModifiers = [];
21
23
  }
@@ -24,8 +26,7 @@ export const ssr = (config = {}) => ({
24
26
  });
25
27
  },
26
28
  pickContext: ({ context, pickedContext }, next) => {
27
- var _context;
28
- const { request, response } = (_context = context) === null || _context === void 0 ? void 0 : _context.ssrContext;
29
+ const { request, response } = context === null || context === void 0 ? void 0 : context.ssrContext;
29
30
  const { initialData } = context;
30
31
  return next({
31
32
  context,