@modern-js/runtime 2.17.0 → 2.18.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 (40) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +6 -0
  3. package/dist/cjs/ssr/cli/index.js +28 -13
  4. package/dist/cjs/ssr/cli/loadable-bundler-plugin.js +112 -0
  5. package/dist/esm/core/compatible.js +13 -13
  6. package/dist/esm/core/loader/loaderManager.js +7 -7
  7. package/dist/esm/core/loader/useLoader.js +2 -2
  8. package/dist/esm/core/plugin.js +6 -6
  9. package/dist/esm/document/Html.js +5 -5
  10. package/dist/esm/document/cli/index.js +6 -6
  11. package/dist/esm/document/constants.js +1 -1
  12. package/dist/esm/router/cli/index.js +6 -6
  13. package/dist/esm/router/runtime/DeferredDataScripts.node.js +3 -3
  14. package/dist/esm/router/runtime/PrefetchLink.js +7 -7
  15. package/dist/esm/router/runtime/plugin.js +9 -9
  16. package/dist/esm/router/runtime/plugin.node.js +7 -7
  17. package/dist/esm/router/runtime/utils.js +6 -6
  18. package/dist/esm/router/runtime/withRouter.js +4 -4
  19. package/dist/esm/ssr/cli/index.js +35 -20
  20. package/dist/esm/ssr/cli/loadable-bundler-plugin.js +209 -0
  21. package/dist/esm/ssr/index.js +13 -13
  22. package/dist/esm/ssr/index.node.js +9 -9
  23. package/dist/esm/ssr/prefetch.js +3 -3
  24. package/dist/esm/ssr/react/prerender/index.js +1 -1
  25. package/dist/esm/ssr/serverRender/renderToStream/buildTemplate.after.js +3 -3
  26. package/dist/esm/ssr/serverRender/renderToStream/loadable.js +1 -1
  27. package/dist/esm/ssr/serverRender/renderToStream/renderToPipe.js +1 -1
  28. package/dist/esm/ssr/serverRender/renderToStream/renderToPipe.worker.js +1 -1
  29. package/dist/esm/ssr/serverRender/renderToStream/template.js +2 -2
  30. package/dist/esm/ssr/serverRender/renderToString/entry.js +3 -3
  31. package/dist/esm/ssr/serverRender/renderToString/index.js +2 -2
  32. package/dist/esm/ssr/serverRender/renderToString/loadable.js +1 -1
  33. package/dist/esm/ssr/serverRender/renderToString/template.js +1 -1
  34. package/dist/esm/ssr/utils.js +4 -4
  35. package/dist/esm/state/cli/index.js +4 -4
  36. package/dist/esm/state/runtime/plugin.js +7 -7
  37. package/dist/esm-node/ssr/cli/index.js +28 -13
  38. package/dist/esm-node/ssr/cli/loadable-bundler-plugin.js +103 -0
  39. package/dist/types/ssr/cli/loadable-bundler-plugin.d.ts +10 -0
  40. package/package.json +9 -9
@@ -12,7 +12,7 @@ function _array_with_holes(arr) {
12
12
  function _define_property(obj, key, value) {
13
13
  if (key in obj) {
14
14
  Object.defineProperty(obj, key, {
15
- value,
15
+ value: value,
16
16
  enumerable: true,
17
17
  configurable: true,
18
18
  writable: true
@@ -164,7 +164,7 @@ export function getRouteComponents(routes, param) {
164
164
  return /* @__PURE__ */ _jsx(Component, _object_spread({}, props2));
165
165
  }
166
166
  return /* @__PURE__ */ _jsx(GlobalLayout, _object_spread({
167
- Component
167
+ Component: Component
168
168
  }, props2));
169
169
  };
170
170
  var routeElements = [];
@@ -175,7 +175,7 @@ export function getRouteComponents(routes, param) {
175
175
  if (route.type === "nested") {
176
176
  var routeElement = renderNestedRoute(route, {
177
177
  DeferredDataComponent: ssrMode === "stream" ? DeferredDataScripts : void 0,
178
- props
178
+ props: props
179
179
  });
180
180
  routeElements.push(routeElement);
181
181
  } else {
@@ -218,9 +218,9 @@ export function renderRoutes(param) {
218
218
  return null;
219
219
  }
220
220
  var routeElements = getRouteComponents(routes, {
221
- globalApp,
222
- ssrMode,
223
- props
221
+ globalApp: globalApp,
222
+ ssrMode: ssrMode,
223
+ props: props
224
224
  });
225
225
  return routeElements;
226
226
  }
@@ -1,7 +1,7 @@
1
1
  function _define_property(obj, key, value) {
2
2
  if (key in obj) {
3
3
  Object.defineProperty(obj, key, {
4
- value,
4
+ value: value,
5
5
  enumerable: true,
6
6
  configurable: true,
7
7
  writable: true
@@ -58,9 +58,9 @@ export var withRouter = function(Component) {
58
58
  var params = useParams();
59
59
  var navigate = useNavigate();
60
60
  return /* @__PURE__ */ _jsx(Component, _object_spread_props(_object_spread({}, props), {
61
- location,
62
- params,
63
- navigate
61
+ location: location,
62
+ params: params,
63
+ navigate: navigate
64
64
  }));
65
65
  };
66
66
  };
@@ -48,16 +48,31 @@ export default function() {
48
48
  config: function config() {
49
49
  var appContext = api.useAppContext();
50
50
  pluginsExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "plugins");
51
+ var userConfig = api.useResolvedConfigContext();
51
52
  var _api_useAppContext = api.useAppContext(), _api_useAppContext_bundlerType = _api_useAppContext.bundlerType, bundlerType = _api_useAppContext_bundlerType === void 0 ? "webpack" : _api_useAppContext_bundlerType;
52
- var babelConfig = bundlerType === "webpack" ? function(config2) {
53
- var _config_plugins;
54
- (_config_plugins = config2.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(path.join(__dirname, "./babel-plugin-ssr-loader-id"));
55
- var userConfig = api.useResolvedConfigContext();
56
- if (isUseSSRBundle(userConfig) && hasStringSSREntry(userConfig)) {
57
- var _config_plugins1;
58
- (_config_plugins1 = config2.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(require.resolve("@loadable/babel-plugin"));
53
+ var babelConfig = function() {
54
+ if (bundlerType === "webpack") {
55
+ return function(config2) {
56
+ var _config_plugins;
57
+ (_config_plugins = config2.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(path.join(__dirname, "./babel-plugin-ssr-loader-id"));
58
+ if (isUseSSRBundle(userConfig) && hasStringSSREntry(userConfig)) {
59
+ var _config_plugins1;
60
+ (_config_plugins1 = config2.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(require.resolve("@loadable/babel-plugin"));
61
+ }
62
+ };
63
+ } else if (bundlerType === "rspack") {
64
+ if (isUseSSRBundle(userConfig)) {
65
+ return function(config2) {
66
+ var _config_plugins;
67
+ (_config_plugins = config2.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(path.join(__dirname, "./babel-plugin-ssr-loader-id"));
68
+ if (hasStringSSREntry(userConfig)) {
69
+ var _config_plugins1;
70
+ (_config_plugins1 = config2.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(require.resolve("@loadable/babel-plugin"));
71
+ }
72
+ };
73
+ }
59
74
  }
60
- } : void 0;
75
+ }();
61
76
  return {
62
77
  source: {
63
78
  alias: {
@@ -71,12 +86,12 @@ export default function() {
71
86
  }
72
87
  },
73
88
  tools: {
74
- webpackChain: function(chain, param) {
89
+ bundlerChain: function bundlerChain(chain, param) {
75
90
  var isServer = param.isServer, isServiceWorker = param.isServiceWorker, CHAIN_ID = param.CHAIN_ID;
76
- var userConfig = api.useResolvedConfigContext();
77
- if (isUseSSRBundle(userConfig) && !isServer && !isServiceWorker && hasStringSSREntry(userConfig)) {
78
- var LoadableWebpackPlugin = require("@loadable/webpack-plugin");
79
- chain.plugin(CHAIN_ID.PLUGIN.LOADABLE).use(LoadableWebpackPlugin, [
91
+ var userConfig2 = api.useResolvedConfigContext();
92
+ if (isUseSSRBundle(userConfig2) && !isServer && !isServiceWorker && hasStringSSREntry(userConfig2)) {
93
+ var LoadableBundlerPlugin = require("./loadable-bundler-plugin.js");
94
+ chain.plugin(CHAIN_ID.PLUGIN.LOADABLE).use(LoadableBundlerPlugin, [
80
95
  {
81
96
  filename: LOADABLE_STATS_FILE
82
97
  }
@@ -117,8 +132,8 @@ export default function() {
117
132
  });
118
133
  }
119
134
  return {
120
- entrypoint,
121
- imports
135
+ entrypoint: entrypoint,
136
+ imports: imports
122
137
  };
123
138
  },
124
139
  modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(param) {
@@ -130,15 +145,15 @@ export default function() {
130
145
  });
131
146
  }
132
147
  return {
133
- entrypoint,
134
- plugins
148
+ entrypoint: entrypoint,
149
+ plugins: plugins
135
150
  };
136
151
  },
137
152
  modifyEntryExport: function modifyEntryExport(param) {
138
153
  var entrypoint = param.entrypoint, exportStatement = param.exportStatement;
139
154
  if (ssrConfigMap.get(entrypoint.entryName)) {
140
155
  return {
141
- entrypoint,
156
+ entrypoint: entrypoint,
142
157
  exportStatement: [
143
158
  "export function ".concat(SERVER_RENDER_FUNCTION_NAME, "(context) {\n return bootstrap(AppWrapper, context)\n }"),
144
159
  exportStatement
@@ -146,8 +161,8 @@ export default function() {
146
161
  };
147
162
  }
148
163
  return {
149
- entrypoint,
150
- exportStatement
164
+ entrypoint: entrypoint,
165
+ exportStatement: exportStatement
151
166
  };
152
167
  }
153
168
  };
@@ -0,0 +1,209 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length)
3
+ len = arr.length;
4
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
5
+ arr2[i] = arr[i];
6
+ return arr2;
7
+ }
8
+ function _array_without_holes(arr) {
9
+ if (Array.isArray(arr))
10
+ return _array_like_to_array(arr);
11
+ }
12
+ function _class_call_check(instance, Constructor) {
13
+ if (!(instance instanceof Constructor)) {
14
+ throw new TypeError("Cannot call a class as a function");
15
+ }
16
+ }
17
+ function _defineProperties(target, props) {
18
+ for (var i = 0; i < props.length; i++) {
19
+ var descriptor = props[i];
20
+ descriptor.enumerable = descriptor.enumerable || false;
21
+ descriptor.configurable = true;
22
+ if ("value" in descriptor)
23
+ descriptor.writable = true;
24
+ Object.defineProperty(target, descriptor.key, descriptor);
25
+ }
26
+ }
27
+ function _create_class(Constructor, protoProps, staticProps) {
28
+ if (protoProps)
29
+ _defineProperties(Constructor.prototype, protoProps);
30
+ if (staticProps)
31
+ _defineProperties(Constructor, staticProps);
32
+ return Constructor;
33
+ }
34
+ function _define_property(obj, key, value) {
35
+ if (key in obj) {
36
+ Object.defineProperty(obj, key, {
37
+ value: value,
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true
41
+ });
42
+ } else {
43
+ obj[key] = value;
44
+ }
45
+ return obj;
46
+ }
47
+ function _iterable_to_array(iter) {
48
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
49
+ return Array.from(iter);
50
+ }
51
+ function _non_iterable_spread() {
52
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
53
+ }
54
+ function _object_spread(target) {
55
+ for (var i = 1; i < arguments.length; i++) {
56
+ var source = arguments[i] != null ? arguments[i] : {};
57
+ var ownKeys2 = Object.keys(source);
58
+ if (typeof Object.getOwnPropertySymbols === "function") {
59
+ ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
60
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
61
+ }));
62
+ }
63
+ ownKeys2.forEach(function(key) {
64
+ _define_property(target, key, source[key]);
65
+ });
66
+ }
67
+ return target;
68
+ }
69
+ function ownKeys(object, enumerableOnly) {
70
+ var keys = Object.keys(object);
71
+ if (Object.getOwnPropertySymbols) {
72
+ var symbols = Object.getOwnPropertySymbols(object);
73
+ if (enumerableOnly) {
74
+ symbols = symbols.filter(function(sym) {
75
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
76
+ });
77
+ }
78
+ keys.push.apply(keys, symbols);
79
+ }
80
+ return keys;
81
+ }
82
+ function _object_spread_props(target, source) {
83
+ source = source != null ? source : {};
84
+ if (Object.getOwnPropertyDescriptors) {
85
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
86
+ } else {
87
+ ownKeys(Object(source)).forEach(function(key) {
88
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
89
+ });
90
+ }
91
+ return target;
92
+ }
93
+ function _to_consumable_array(arr) {
94
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
95
+ }
96
+ function _unsupported_iterable_to_array(o, minLen) {
97
+ if (!o)
98
+ return;
99
+ if (typeof o === "string")
100
+ return _array_like_to_array(o, minLen);
101
+ var n = Object.prototype.toString.call(o).slice(8, -1);
102
+ if (n === "Object" && o.constructor)
103
+ n = o.constructor.name;
104
+ if (n === "Map" || n === "Set")
105
+ return Array.from(n);
106
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
107
+ return _array_like_to_array(o, minLen);
108
+ }
109
+ import path from "path";
110
+ import { fs } from "@modern-js/utils";
111
+ var LoadablePlugin = /* @__PURE__ */ function() {
112
+ "use strict";
113
+ function LoadablePlugin2() {
114
+ var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
115
+ filename: "loadable-stats.json",
116
+ outputAsset: true,
117
+ chunkLoadingGlobal: "__LOADABLE_LOADED_CHUNKS__"
118
+ }, _ref_filename = _ref.filename, filename = _ref_filename === void 0 ? "loadable-stats.json" : _ref_filename, path2 = _ref.path, writeToDisk = _ref.writeToDisk, _ref_outputAsset = _ref.outputAsset, outputAsset = _ref_outputAsset === void 0 ? true : _ref_outputAsset, _ref_chunkLoadingGlobal = _ref.chunkLoadingGlobal, chunkLoadingGlobal = _ref_chunkLoadingGlobal === void 0 ? "__LOADABLE_LOADED_CHUNKS__" : _ref_chunkLoadingGlobal;
119
+ _class_call_check(this, LoadablePlugin2);
120
+ _define_property(this, "opts", void 0);
121
+ _define_property(this, "compiler", void 0);
122
+ this.opts = {
123
+ filename: filename,
124
+ path: path2,
125
+ writeToDisk: writeToDisk,
126
+ outputAsset: outputAsset,
127
+ chunkLoadingGlobal: chunkLoadingGlobal
128
+ };
129
+ this.compiler = null;
130
+ }
131
+ _create_class(LoadablePlugin2, [
132
+ {
133
+ key: "apply",
134
+ value: function apply(compiler) {
135
+ var _this = this;
136
+ this.compiler = compiler;
137
+ compiler.options.output.chunkLoadingGlobal = this.opts.chunkLoadingGlobal;
138
+ if (this.opts.outputAsset || this.opts.writeToDisk) {
139
+ compiler.hooks.make.tap(LoadablePlugin2.name, function(compilation) {
140
+ compilation.hooks.processAssets.tap({
141
+ name: LoadablePlugin2.name,
142
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT
143
+ }, function() {
144
+ var asset = _this.handleEmit(compilation);
145
+ if (asset) {
146
+ compilation.emitAsset(_this.opts.filename, asset);
147
+ }
148
+ });
149
+ });
150
+ }
151
+ }
152
+ },
153
+ {
154
+ key: "handleEmit",
155
+ value: function handleEmit(compilation) {
156
+ var stats = compilation.getStats().toJson({
157
+ all: false,
158
+ assets: true,
159
+ // rspack not support cachedAssets,
160
+ cachedAssets: true,
161
+ chunks: true,
162
+ chunkGroups: true,
163
+ entrypoints: true,
164
+ // rspack not support chunkGroupChildren.
165
+ chunkGroupChildren: true,
166
+ hash: true,
167
+ ids: true,
168
+ outputPath: true,
169
+ publicPath: true
170
+ });
171
+ var output = _object_spread_props(_object_spread({}, stats), {
172
+ generator: "loadable-components",
173
+ chunks: _to_consumable_array(stats.chunks || []).map(function(chunk) {
174
+ return {
175
+ id: chunk.id,
176
+ files: _to_consumable_array(chunk.files || [])
177
+ };
178
+ })
179
+ });
180
+ var result = JSON.stringify(output, null, 2);
181
+ if (this.opts.writeToDisk) {
182
+ this.writeAssetsFile(result);
183
+ }
184
+ if (this.opts.outputAsset) {
185
+ return {
186
+ source: function source() {
187
+ return result;
188
+ },
189
+ size: function size() {
190
+ return result.length;
191
+ }
192
+ };
193
+ }
194
+ return null;
195
+ }
196
+ },
197
+ {
198
+ key: "writeAssetsFile",
199
+ value: function writeAssetsFile(manifest) {
200
+ var _this_compiler;
201
+ var outputFolder = (_this_compiler = this.compiler) === null || _this_compiler === void 0 ? void 0 : _this_compiler.options.output.path;
202
+ var outputFile = path.resolve(outputFolder || "", this.opts.filename);
203
+ fs.outputFileSync(outputFile, manifest);
204
+ }
205
+ }
206
+ ]);
207
+ return LoadablePlugin2;
208
+ }();
209
+ module.exports = LoadablePlugin;
@@ -30,7 +30,7 @@ function _async_to_generator(fn) {
30
30
  function _define_property(obj, key, value) {
31
31
  if (key in obj) {
32
32
  Object.defineProperty(obj, key, {
33
- value,
33
+ value: value,
34
34
  enumerable: true,
35
35
  configurable: true,
36
36
  writable: true
@@ -205,14 +205,14 @@ export var ssr = function(config) {
205
205
  function stringSSRHydrate() {
206
206
  if (renderLevel === RenderLevel.CLIENT_RENDER || renderLevel === RenderLevel.SERVER_PREFETCH) {
207
207
  ModernRender(/* @__PURE__ */ _jsx(App, {
208
- context
208
+ context: context
209
209
  }));
210
210
  } else if (renderLevel === RenderLevel.SERVER_RENDER) {
211
211
  if (isReact18()) {
212
212
  loadableReady(function() {
213
213
  var SSRApp = function() {
214
214
  return /* @__PURE__ */ _jsx(WithCallback, {
215
- callback,
215
+ callback: callback,
216
216
  children: /* @__PURE__ */ _jsx(App, {
217
217
  context: hydrateContext
218
218
  })
@@ -231,7 +231,7 @@ export var ssr = function(config) {
231
231
  } else {
232
232
  console.warn("unknow render level: ".concat(renderLevel, ", execute render()"));
233
233
  ModernRender(/* @__PURE__ */ _jsx(App, {
234
- context
234
+ context: context
235
235
  }));
236
236
  }
237
237
  }
@@ -239,7 +239,7 @@ export var ssr = function(config) {
239
239
  if (renderLevel === RenderLevel.SERVER_RENDER) {
240
240
  var SSRApp = function() {
241
241
  return /* @__PURE__ */ _jsx(WithCallback, {
242
- callback,
242
+ callback: callback,
243
243
  children: /* @__PURE__ */ _jsx(App, {
244
244
  context: hydrateContext
245
245
  })
@@ -249,7 +249,7 @@ export var ssr = function(config) {
249
249
  ModernHydrate(/* @__PURE__ */ _jsx(SSRApp, {}));
250
250
  } else {
251
251
  ModernRender(/* @__PURE__ */ _jsx(App, {
252
- context
252
+ context: context
253
253
  }));
254
254
  }
255
255
  }
@@ -291,13 +291,13 @@ export var ssr = function(config) {
291
291
  request: formatClient({})
292
292
  });
293
293
  return next({
294
- context
294
+ context: context
295
295
  });
296
296
  }
297
297
  context.ssrContext.response = mockResp;
298
298
  context.ssrContext.request = formatClient(request);
299
299
  return next({
300
- context
300
+ context: context
301
301
  });
302
302
  },
303
303
  pickContext: function(param, next) {
@@ -307,17 +307,17 @@ export var ssr = function(config) {
307
307
  var initialData = context.initialData;
308
308
  if (!request) {
309
309
  return next({
310
- context,
310
+ context: context,
311
311
  pickedContext: _object_spread_props(_object_spread({}, pickedContext), {
312
- initialData
312
+ initialData: initialData
313
313
  })
314
314
  });
315
315
  }
316
316
  return next({
317
- context,
317
+ context: context,
318
318
  pickedContext: _object_spread_props(_object_spread({}, pickedContext), {
319
- initialData,
320
- request,
319
+ initialData: initialData,
320
+ request: request,
321
321
  response: mockResp
322
322
  })
323
323
  });
@@ -30,7 +30,7 @@ function _async_to_generator(fn) {
30
30
  function _define_property(obj, key, value) {
31
31
  if (key in obj) {
32
32
  Object.defineProperty(obj, key, {
33
- value,
33
+ value: value,
34
34
  enumerable: true,
35
35
  configurable: true,
36
36
  writable: true
@@ -199,9 +199,9 @@ export var ssr = function() {
199
199
  return [
200
200
  4,
201
201
  render({
202
- context,
203
- App,
204
- config
202
+ context: context,
203
+ App: App,
204
+ config: config
205
205
  })
206
206
  ];
207
207
  case 1:
@@ -223,7 +223,7 @@ export var ssr = function() {
223
223
  context.ssrContext.request = formatServer(request);
224
224
  context.ssrContext.mode = config.mode;
225
225
  return next({
226
- context
226
+ context: context
227
227
  });
228
228
  },
229
229
  pickContext: function(param, next) {
@@ -231,11 +231,11 @@ export var ssr = function() {
231
231
  var _ref = context === null || context === void 0 ? void 0 : context.ssrContext, request = _ref.request, response = _ref.response;
232
232
  var initialData = context.initialData;
233
233
  return next({
234
- context,
234
+ context: context,
235
235
  pickedContext: _object_spread_props(_object_spread({}, pickedContext), {
236
- initialData,
237
- request,
238
- response
236
+ initialData: initialData,
237
+ request: request,
238
+ response: response
239
239
  })
240
240
  });
241
241
  }
@@ -153,11 +153,11 @@ var prefetch = function() {
153
153
  ].filter(Boolean)
154
154
  });
155
155
  renderToStaticMarkup(extractor.collectChunks(/* @__PURE__ */ _jsx(App, {
156
- context
156
+ context: context
157
157
  })));
158
158
  } else {
159
159
  renderToStaticMarkup(/* @__PURE__ */ _jsx(App, {
160
- context
160
+ context: context
161
161
  }));
162
162
  }
163
163
  if (!context.loaderManager.hasPendingLoaders()) {
@@ -186,7 +186,7 @@ var prefetch = function() {
186
186
  return [
187
187
  2,
188
188
  {
189
- loadersData,
189
+ loadersData: loadersData,
190
190
  initialData: context.initialData,
191
191
  i18nData: context.__i18nData__,
192
192
  // todo: move to plugin state
@@ -29,7 +29,7 @@ function _create_class(Constructor, protoProps, staticProps) {
29
29
  function _define_property(obj, key, value) {
30
30
  if (key in obj) {
31
31
  Object.defineProperty(obj, key, {
32
- value,
32
+ value: value,
33
33
  enumerable: true,
34
34
  configurable: true,
35
35
  writable: true
@@ -1,7 +1,7 @@
1
1
  function _define_property(obj, key, value) {
2
2
  if (key in obj) {
3
3
  Object.defineProperty(obj, key, {
4
- value,
4
+ value: value,
5
5
  enumerable: true,
6
6
  configurable: true,
7
7
  writable: true
@@ -40,7 +40,7 @@ export function buildShellAfterTemplate(afterAppTemplate, options) {
40
40
  };
41
41
  var SSRData = {
42
42
  data: {
43
- initialData,
43
+ initialData: initialData,
44
44
  i18nData: __i18nData__
45
45
  },
46
46
  context: {
@@ -52,7 +52,7 @@ export function buildShellAfterTemplate(afterAppTemplate, options) {
52
52
  url: request.url
53
53
  }, enableUnsafeCtx ? unsafeContext : {})
54
54
  },
55
- renderLevel
55
+ renderLevel: renderLevel
56
56
  };
57
57
  return "\n <script>window._SSR_DATA = ".concat(serializeJson(SSRData), "</script>\n ");
58
58
  }
@@ -4,7 +4,7 @@ export function getLoadableChunks(param) {
4
4
  var _context_ssrContext = context.ssrContext, loadableStats = _context_ssrContext.loadableStats, entryName = _context_ssrContext.entryName;
5
5
  if (!loadableStats) {
6
6
  return {
7
- jsx
7
+ jsx: jsx
8
8
  };
9
9
  }
10
10
  var extractor = new ChunkExtractor({
@@ -1,7 +1,7 @@
1
1
  function _define_property(obj, key, value) {
2
2
  if (key in obj) {
3
3
  Object.defineProperty(obj, key, {
4
- value,
4
+ value: value,
5
5
  enumerable: true,
6
6
  configurable: true,
7
7
  writable: true
@@ -30,7 +30,7 @@ function _async_to_generator(fn) {
30
30
  function _define_property(obj, key, value) {
31
31
  if (key in obj) {
32
32
  Object.defineProperty(obj, key, {
33
- value,
33
+ value: value,
34
34
  enumerable: true,
35
35
  configurable: true,
36
36
  writable: true
@@ -64,8 +64,8 @@ export var getTemplates = function(context, renderLevel) {
64
64
  var _ref = _sliced_to_array(ssrContext.template.split(HTML_SEPARATOR) || [], 2), tmp = _ref[0], beforeAppTemplate = tmp === void 0 ? "" : tmp, tmp1 = _ref[1], afterAppHtmlTemplate = tmp1 === void 0 ? "" : tmp1;
65
65
  var builtBeforeTemplate = buildShellBeforeTemplate(beforeAppTemplate, context);
66
66
  var builtAfterTemplate = buildShellAfterTemplate(afterAppHtmlTemplate, {
67
- context,
68
- renderLevel
67
+ context: context,
68
+ renderLevel: renderLevel
69
69
  });
70
70
  return {
71
71
  shellBefore: builtBeforeTemplate,
@@ -52,7 +52,7 @@ function _create_class(Constructor, protoProps, staticProps) {
52
52
  function _define_property(obj, key, value) {
53
53
  if (key in obj) {
54
54
  Object.defineProperty(obj, key, {
55
- value,
55
+ value: value,
56
56
  enumerable: true,
57
57
  configurable: true,
58
58
  writable: true
@@ -199,7 +199,7 @@ var buildTemplateData = function(context, data, renderLevel) {
199
199
  headers: request.headers
200
200
  };
201
201
  return {
202
- data,
202
+ data: data,
203
203
  context: {
204
204
  request: _object_spread({
205
205
  params: request.params,
@@ -209,7 +209,7 @@ var buildTemplateData = function(context, data, renderLevel) {
209
209
  url: request.url
210
210
  }, enableUnsafeCtx ? unsafeContext : {})
211
211
  },
212
- renderLevel
212
+ renderLevel: renderLevel
213
213
  };
214
214
  };
215
215
  var Entry = /* @__PURE__ */ function() {
@@ -143,8 +143,8 @@ export var render = function(param) {
143
143
  case 0:
144
144
  entry = new SSREntry({
145
145
  ctx: ssrContext,
146
- App,
147
- config
146
+ App: App,
147
+ config: config
148
148
  });
149
149
  entry.metrics.emitCounter("app.visit.count", 1);
150
150
  end = time();
@@ -13,7 +13,7 @@ export var toHtml = function(jsx, renderer, next) {
13
13
  return next(jsx);
14
14
  }
15
15
  var extractor = new ChunkExtractor({
16
- stats,
16
+ stats: stats,
17
17
  entrypoints: [
18
18
  renderer.entryName
19
19
  ]
@@ -34,7 +34,7 @@ function _create_class(Constructor, protoProps, staticProps) {
34
34
  function _define_property(obj, key, value) {
35
35
  if (key in obj) {
36
36
  Object.defineProperty(obj, key, {
37
- value,
37
+ value: value,
38
38
  enumerable: true,
39
39
  configurable: true,
40
40
  writable: true