@modern-js/plugin-garfish 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @modern-js/plugin-garfish
2
2
 
3
+ ## 2.18.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 1fdf649: feat(plugin-garfish): support garfish plugin in Rspack
8
+
9
+ feat(plugin-garfish): 在使用 Rspack 构建时支持 garfish 插件
10
+
11
+ - Updated dependencies [7de6599]
12
+ - @modern-js/runtime@2.18.0
13
+ - @modern-js/utils@2.18.0
14
+
15
+ ## 2.17.1
16
+
17
+ ### Patch Changes
18
+
19
+ - @modern-js/runtime@2.17.1
20
+ - @modern-js/utils@2.17.1
21
+
3
22
  ## 2.17.0
4
23
 
5
24
  ### Patch Changes
@@ -103,8 +103,36 @@ const _default = ({ pluginName = "@modern-js/plugin-garfish", runtimePluginName
103
103
  "Access-Control-Allow-Origin": "*"
104
104
  }
105
105
  },
106
- webpackChain: (chain, { webpack, env, CHAIN_ID }) => {
107
- var _resolveOptions_deploy, _resolveWebpackConfig_resolve;
106
+ webpackChain: (chain, { webpack, CHAIN_ID }) => {
107
+ if (webpack.BannerPlugin) {
108
+ chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [
109
+ {
110
+ banner: "Micro front-end"
111
+ }
112
+ ]);
113
+ }
114
+ },
115
+ rspack: (config2) => {
116
+ var _resolveOptions_deploy;
117
+ var _config;
118
+ var _builtins;
119
+ (_builtins = (_config = config2).builtins) !== null && _builtins !== void 0 ? _builtins : _config.builtins = {};
120
+ const resolveOptions = useResolvedConfigContext();
121
+ if ((resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) && !config2.externalsType) {
122
+ config2.externalsType = "commonjs";
123
+ }
124
+ const banner = config2.builtins.banner || [];
125
+ config2.builtins.banner = [
126
+ ...Array.isArray(banner) ? banner : [
127
+ banner
128
+ ],
129
+ {
130
+ banner: "Micro front-end"
131
+ }
132
+ ];
133
+ },
134
+ bundlerChain: (chain, { env, CHAIN_ID }) => {
135
+ var _resolveOptions_deploy, _resolveConfig_resolve;
108
136
  const resolveOptions = useResolvedConfigContext();
109
137
  if (resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) {
110
138
  var _useConfig_dev, _resolveOptions_server, _resolveOptions_deploy1;
@@ -112,13 +140,6 @@ const _default = ({ pluginName = "@modern-js/plugin-garfish", runtimePluginName
112
140
  if (!((_useConfig_dev = useConfig.dev) === null || _useConfig_dev === void 0 ? void 0 : _useConfig_dev.assetPrefix) && (resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_server = resolveOptions.server) === null || _resolveOptions_server === void 0 ? void 0 : _resolveOptions_server.port) && env === "development") {
113
141
  chain.output.publicPath(`//localhost:${resolveOptions.server.port}/`);
114
142
  }
115
- if (webpack.BannerPlugin) {
116
- chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [
117
- {
118
- banner: "Micro front-end"
119
- }
120
- ]);
121
- }
122
143
  const { enableHtmlEntry, externalBasicLibrary } = getDefaultMicroFrontedConfig((_resolveOptions_deploy1 = resolveOptions.deploy) === null || _resolveOptions_deploy1 === void 0 ? void 0 : _resolveOptions_deploy1.microFrontend);
123
144
  if (externalBasicLibrary) {
124
145
  chain.externals(externals);
@@ -132,13 +153,13 @@ const _default = ({ pluginName = "@modern-js/plugin-garfish", runtimePluginName
132
153
  });
133
154
  }
134
155
  }
135
- const resolveWebpackConfig = chain.toConfig();
136
- (0, _util.logger)("webpackConfig", {
137
- output: resolveWebpackConfig.output,
138
- externals: resolveWebpackConfig.externals,
156
+ const resolveConfig = chain.toConfig();
157
+ (0, _util.logger)("bundlerConfig", {
158
+ output: resolveConfig.output,
159
+ externals: resolveConfig.externals,
139
160
  env,
140
- alias: (_resolveWebpackConfig_resolve = resolveWebpackConfig.resolve) === null || _resolveWebpackConfig_resolve === void 0 ? void 0 : _resolveWebpackConfig_resolve.alias,
141
- plugins: resolveWebpackConfig.plugins
161
+ alias: (_resolveConfig_resolve = resolveConfig.resolve) === null || _resolveConfig_resolve === void 0 ? void 0 : _resolveConfig_resolve.alias,
162
+ plugins: resolveConfig.plugins
142
163
  });
143
164
  }
144
165
  }
@@ -125,7 +125,7 @@ function setRuntimeConfig(config, key, value) {
125
125
  return void 0;
126
126
  }
127
127
  const generateAsyncEntry = (code) => {
128
- const transformCode = code.replace(`import('./bootstrap.js');`, `if (!window.__GARFISH__) { import('./bootstrap.js'); }`);
128
+ const transformCode = code.replace(`import('./bootstrap.jsx');`, `if (!window.__GARFISH__) { import('./bootstrap.jsx'); }`);
129
129
  return `
130
130
  export const provider = async (...args) => {
131
131
  const exports = await import('./bootstrap');
@@ -1,3 +1,14 @@
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
+ }
1
12
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
13
  try {
3
14
  var info = gen[key](arg);
@@ -30,7 +41,7 @@ function _async_to_generator(fn) {
30
41
  function _define_property(obj, key, value) {
31
42
  if (key in obj) {
32
43
  Object.defineProperty(obj, key, {
33
- value,
44
+ value: value,
34
45
  enumerable: true,
35
46
  configurable: true,
36
47
  writable: true
@@ -40,6 +51,13 @@ function _define_property(obj, key, value) {
40
51
  }
41
52
  return obj;
42
53
  }
54
+ function _iterable_to_array(iter) {
55
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
56
+ return Array.from(iter);
57
+ }
58
+ function _non_iterable_spread() {
59
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
60
+ }
43
61
  function _object_spread(target) {
44
62
  for (var i = 1; i < arguments.length; i++) {
45
63
  var source = arguments[i] != null ? arguments[i] : {};
@@ -55,6 +73,22 @@ function _object_spread(target) {
55
73
  }
56
74
  return target;
57
75
  }
76
+ function _to_consumable_array(arr) {
77
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
78
+ }
79
+ function _unsupported_iterable_to_array(o, minLen) {
80
+ if (!o)
81
+ return;
82
+ if (typeof o === "string")
83
+ return _array_like_to_array(o, minLen);
84
+ var n = Object.prototype.toString.call(o).slice(8, -1);
85
+ if (n === "Object" && o.constructor)
86
+ n = o.constructor.name;
87
+ if (n === "Map" || n === "Set")
88
+ return Array.from(n);
89
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
90
+ return _array_like_to_array(o, minLen);
91
+ }
58
92
  var __generator = function(thisArg, body) {
59
93
  var f, y, t, g, _ = {
60
94
  label: 0,
@@ -240,7 +274,7 @@ export default function() {
240
274
  }
241
275
  return {
242
276
  output: {
243
- disableCssExtract
277
+ disableCssExtract: disableCssExtract
244
278
  },
245
279
  source: {
246
280
  alias: {
@@ -255,8 +289,36 @@ export default function() {
255
289
  }
256
290
  },
257
291
  webpackChain: function(chain, param2) {
258
- var webpack = param2.webpack, env = param2.env, CHAIN_ID = param2.CHAIN_ID;
259
- var _resolveOptions_deploy, _resolveWebpackConfig_resolve;
292
+ var webpack = param2.webpack, CHAIN_ID = param2.CHAIN_ID;
293
+ if (webpack.BannerPlugin) {
294
+ chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [
295
+ {
296
+ banner: "Micro front-end"
297
+ }
298
+ ]);
299
+ }
300
+ },
301
+ rspack: function(config3) {
302
+ var _resolveOptions_deploy;
303
+ var _config;
304
+ var _builtins;
305
+ (_builtins = (_config = config3).builtins) !== null && _builtins !== void 0 ? _builtins : _config.builtins = {};
306
+ var resolveOptions = useResolvedConfigContext();
307
+ if ((resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) && !config3.externalsType) {
308
+ config3.externalsType = "commonjs";
309
+ }
310
+ var banner = config3.builtins.banner || [];
311
+ config3.builtins.banner = _to_consumable_array(Array.isArray(banner) ? banner : [
312
+ banner
313
+ ]).concat([
314
+ {
315
+ banner: "Micro front-end"
316
+ }
317
+ ]);
318
+ },
319
+ bundlerChain: function(chain, param2) {
320
+ var env = param2.env, CHAIN_ID = param2.CHAIN_ID;
321
+ var _resolveOptions_deploy, _resolveConfig_resolve;
260
322
  var resolveOptions = useResolvedConfigContext();
261
323
  if (resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) {
262
324
  var _useConfig_dev, _resolveOptions_server, _resolveOptions_deploy1;
@@ -264,13 +326,6 @@ export default function() {
264
326
  if (!((_useConfig_dev = useConfig.dev) === null || _useConfig_dev === void 0 ? void 0 : _useConfig_dev.assetPrefix) && (resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_server = resolveOptions.server) === null || _resolveOptions_server === void 0 ? void 0 : _resolveOptions_server.port) && env === "development") {
265
327
  chain.output.publicPath("//localhost:".concat(resolveOptions.server.port, "/"));
266
328
  }
267
- if (webpack.BannerPlugin) {
268
- chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [
269
- {
270
- banner: "Micro front-end"
271
- }
272
- ]);
273
- }
274
329
  var _getDefaultMicroFrontedConfig = getDefaultMicroFrontedConfig((_resolveOptions_deploy1 = resolveOptions.deploy) === null || _resolveOptions_deploy1 === void 0 ? void 0 : _resolveOptions_deploy1.microFrontend), enableHtmlEntry2 = _getDefaultMicroFrontedConfig.enableHtmlEntry, externalBasicLibrary = _getDefaultMicroFrontedConfig.externalBasicLibrary;
275
330
  if (externalBasicLibrary) {
276
331
  chain.externals(externals);
@@ -284,13 +339,13 @@ export default function() {
284
339
  });
285
340
  }
286
341
  }
287
- var resolveWebpackConfig = chain.toConfig();
288
- logger("webpackConfig", {
289
- output: resolveWebpackConfig.output,
290
- externals: resolveWebpackConfig.externals,
291
- env,
292
- alias: (_resolveWebpackConfig_resolve = resolveWebpackConfig.resolve) === null || _resolveWebpackConfig_resolve === void 0 ? void 0 : _resolveWebpackConfig_resolve.alias,
293
- plugins: resolveWebpackConfig.plugins
342
+ var resolveConfig = chain.toConfig();
343
+ logger("bundlerConfig", {
344
+ output: resolveConfig.output,
345
+ externals: resolveConfig.externals,
346
+ env: env,
347
+ alias: (_resolveConfig_resolve = resolveConfig.resolve) === null || _resolveConfig_resolve === void 0 ? void 0 : _resolveConfig_resolve.alias,
348
+ plugins: resolveConfig.plugins
294
349
  });
295
350
  }
296
351
  }
@@ -350,8 +405,8 @@ export default function() {
350
405
  ]
351
406
  });
352
407
  return {
353
- imports,
354
- entrypoint
408
+ imports: imports,
409
+ entrypoint: entrypoint
355
410
  };
356
411
  },
357
412
  modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(param2) {
@@ -367,8 +422,8 @@ export default function() {
367
422
  });
368
423
  }
369
424
  return {
370
- entrypoint,
371
- plugins
425
+ entrypoint: entrypoint,
426
+ plugins: plugins
372
427
  };
373
428
  },
374
429
  modifyEntryRenderFunction: function modifyEntryRenderFunction(param2) {
@@ -377,14 +432,14 @@ export default function() {
377
432
  var config = useResolvedConfigContext();
378
433
  if (!(config === null || config === void 0 ? void 0 : (_config_deploy = config.deploy) === null || _config_deploy === void 0 ? void 0 : _config_deploy.microFrontend)) {
379
434
  return {
380
- entrypoint,
381
- code
435
+ entrypoint: entrypoint,
436
+ code: code
382
437
  };
383
438
  }
384
439
  var nCode = makeRenderFunction(code);
385
440
  logger("makeRenderFunction", nCode);
386
441
  return {
387
- entrypoint,
442
+ entrypoint: entrypoint,
388
443
  code: nCode
389
444
  };
390
445
  },
@@ -396,12 +451,12 @@ export default function() {
396
451
  if ((config === null || config === void 0 ? void 0 : (_config_deploy = config.deploy) === null || _config_deploy === void 0 ? void 0 : _config_deploy.microFrontend) && (config === null || config === void 0 ? void 0 : (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.enableAsyncEntry)) {
397
452
  finalCode = generateAsyncEntry(code);
398
453
  return {
399
- entrypoint,
454
+ entrypoint: entrypoint,
400
455
  code: "".concat(finalCode)
401
456
  };
402
457
  }
403
458
  return {
404
- entrypoint,
459
+ entrypoint: entrypoint,
405
460
  code: finalCode
406
461
  };
407
462
  },
@@ -413,13 +468,13 @@ export default function() {
413
468
  var exportStatementCode = makeProvider();
414
469
  logger("exportStatement", exportStatementCode);
415
470
  return {
416
- entrypoint,
471
+ entrypoint: entrypoint,
417
472
  exportStatement: exportStatementCode
418
473
  };
419
474
  }
420
475
  return {
421
- entrypoint,
422
- exportStatement
476
+ entrypoint: entrypoint,
477
+ exportStatement: exportStatement
423
478
  };
424
479
  }
425
480
  };
@@ -26,6 +26,6 @@ export function setRuntimeConfig(config, key, value) {
26
26
  return void 0;
27
27
  }
28
28
  export var generateAsyncEntry = function(code) {
29
- var transformCode = code.replace("import('./bootstrap.js');", "if (!window.__GARFISH__) { import('./bootstrap.js'); }");
29
+ var transformCode = code.replace("import('./bootstrap.jsx');", "if (!window.__GARFISH__) { import('./bootstrap.jsx'); }");
30
30
  return "\n export const provider = async (...args) => {\n const exports = await import('./bootstrap');\n return exports.provider.apply(null, args);\n };\n ".concat(transformCode, "\n if (typeof __GARFISH_EXPORTS__ !== 'undefined') {\n __GARFISH_EXPORTS__.provider = provider;\n }\n ");
31
31
  };
@@ -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
@@ -188,10 +188,10 @@ export function Loadable(WrapComponent) {
188
188
  var LoadingComponent = (_props_loadable = props.loadable) === null || _props_loadable === void 0 ? void 0 : _props_loadable.loading;
189
189
  useEffect(function() {
190
190
  logger("Loadable render state", {
191
- state,
191
+ state: state,
192
192
  props: otherProps,
193
- loadable,
194
- defaultLoadable
193
+ loadable: loadable,
194
+ defaultLoadable: defaultLoadable
195
195
  });
196
196
  return function() {
197
197
  setStateWithMountCheck({
@@ -232,7 +232,7 @@ export function Loadable(WrapComponent) {
232
232
  pastDelay: state.pastDelay,
233
233
  timedOut: state.timedOut,
234
234
  error: state === null || state === void 0 ? void 0 : state.error,
235
- retry
235
+ retry: retry
236
236
  }),
237
237
  /* @__PURE__ */ _jsx(WrapComponent, _object_spread({
238
238
  style: {
@@ -69,7 +69,7 @@ function _create_class(Constructor, protoProps, staticProps) {
69
69
  function _define_property(obj, key, value) {
70
70
  if (key in obj) {
71
71
  Object.defineProperty(obj, key, {
72
- value,
72
+ value: value,
73
73
  enumerable: true,
74
74
  configurable: true,
75
75
  writable: true
@@ -392,7 +392,7 @@ function _initOptions() {
392
392
  return [
393
393
  2,
394
394
  _object_spread_props(_object_spread({}, options), {
395
- apps
395
+ apps: apps
396
396
  })
397
397
  ];
398
398
  }
@@ -458,18 +458,18 @@ export default function(config) {
458
458
  GarfishInstance.registerApp(appInfoList);
459
459
  MApp = generateMApp(GarfishConfig, manifest);
460
460
  logger("initOptions result", {
461
- manifest,
462
- GarfishConfig
461
+ manifest: manifest,
462
+ GarfishConfig: GarfishConfig
463
463
  });
464
464
  logger("generateApps", {
465
- MApp,
466
- apps,
467
- appInfoList
465
+ MApp: MApp,
466
+ apps: apps,
467
+ appInfoList: appInfoList
468
468
  });
469
469
  _this1.setState({
470
- MApp,
471
- apps,
472
- appInfoList
470
+ MApp: MApp,
471
+ apps: apps,
472
+ appInfoList: appInfoList
473
473
  });
474
474
  return [
475
475
  2
@@ -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
@@ -32,11 +32,11 @@ import { GarfishContext } from "./utils/Context";
32
32
  export function useModuleApps() {
33
33
  var _useContext = useContext(GarfishContext), apps = _useContext.apps, MApp = _useContext.MApp, appInfoList = _useContext.appInfoList;
34
34
  logger("call useModuleApps", _object_spread({
35
- MApp,
35
+ MApp: MApp,
36
36
  apps: appInfoList
37
37
  }, apps));
38
38
  var Info = new Proxy(_object_spread({
39
- MApp,
39
+ MApp: MApp,
40
40
  apps: appInfoList
41
41
  }, apps), {
42
42
  get: function get(target, p, receiver) {
@@ -40,7 +40,7 @@ function _create_class(Constructor, protoProps, staticProps) {
40
40
  function _define_property(obj, key, value) {
41
41
  if (key in obj) {
42
42
  Object.defineProperty(obj, key, {
43
- value,
43
+ value: value,
44
44
  enumerable: true,
45
45
  configurable: true,
46
46
  writable: true
@@ -255,7 +255,7 @@ export function generateMApp(options, manifest) {
255
255
  logger("MApp errorLoadApp", error, args);
256
256
  if (appInfo.activeWhen) {
257
257
  setLoadingState({
258
- error
258
+ error: error
259
259
  });
260
260
  }
261
261
  return errorLoadApp === null || errorLoadApp === void 0 ? void 0 : errorLoadApp.apply(void 0, [
@@ -270,7 +270,7 @@ export function generateMApp(options, manifest) {
270
270
  logger("MApp errorMountApp", error, args);
271
271
  if (appInfo.activeWhen) {
272
272
  setLoadingState({
273
- error
273
+ error: error
274
274
  });
275
275
  }
276
276
  return errorMountApp === null || errorMountApp === void 0 ? void 0 : errorMountApp.apply(void 0, [
@@ -285,7 +285,7 @@ export function generateMApp(options, manifest) {
285
285
  logger("MApp errorUnmountApp", error, args);
286
286
  if (appInfo.activeWhen) {
287
287
  setLoadingState({
288
- error
288
+ error: error
289
289
  });
290
290
  }
291
291
  return errorUnmountApp === null || errorUnmountApp === void 0 ? void 0 : errorUnmountApp.apply(void 0, [
@@ -328,7 +328,7 @@ export function generateMApp(options, manifest) {
328
328
  };
329
329
  logger("MApp componentDidMount", {
330
330
  garfishRunning: Garfish.running,
331
- garfishOptions
331
+ garfishOptions: garfishOptions
332
332
  });
333
333
  if (!Garfish.running) {
334
334
  Garfish.run(garfishOptions);
@@ -45,7 +45,7 @@ function _async_to_generator(fn) {
45
45
  function _define_property(obj, key, value) {
46
46
  if (key in obj) {
47
47
  Object.defineProperty(obj, key, {
48
- value,
48
+ value: value,
49
49
  enumerable: true,
50
50
  configurable: true,
51
51
  writable: true
@@ -351,7 +351,7 @@ function getAppInstance(options, appInfo, manifest) {
351
351
  "_SERVER_DATA"
352
352
  ]),
353
353
  domGetter: "#".concat(domId),
354
- basename,
354
+ basename: basename,
355
355
  cache: true,
356
356
  props: _object_spread({}, appInfo.props, userProps),
357
357
  customLoader: function(provider) {
@@ -388,7 +388,7 @@ function getAppInstance(options, appInfo, manifest) {
388
388
  error: null
389
389
  });
390
390
  logger('MicroApp Garfish.loadApp "'.concat(appInfo.name, '"'), {
391
- loadAppOptions
391
+ loadAppOptions: loadAppOptions
392
392
  });
393
393
  function renderApp() {
394
394
  return _renderApp.apply(this, arguments);
@@ -425,7 +425,7 @@ function getAppInstance(options, appInfo, manifest) {
425
425
  ];
426
426
  logger('MicroApp Garfish.loadApp "'.concat(appInfo.name, '" show'), {
427
427
  appInfo: appInstance.appInfo,
428
- appInstance
428
+ appInstance: appInstance
429
429
  });
430
430
  return [
431
431
  4,
@@ -440,7 +440,7 @@ function getAppInstance(options, appInfo, manifest) {
440
440
  case 3:
441
441
  logger('MicroApp Garfish.loadApp "'.concat(appInfo.name, '" mount'), {
442
442
  appInfo: appInstance.appInfo,
443
- appInstance
443
+ appInstance: appInstance
444
444
  });
445
445
  return [
446
446
  4,
@@ -458,7 +458,7 @@ function getAppInstance(options, appInfo, manifest) {
458
458
  error = _state.sent();
459
459
  setLoadingState({
460
460
  isLoading: true,
461
- error
461
+ error: error
462
462
  });
463
463
  return [
464
464
  3,
@@ -508,7 +508,7 @@ export function generateApps(options, manifest) {
508
508
  apps[appInfo.name] = Component;
509
509
  });
510
510
  return {
511
- apps,
511
+ apps: apps,
512
512
  appInfoList: options.apps || []
513
513
  };
514
514
  }
@@ -87,8 +87,36 @@ export default ({ pluginName = "@modern-js/plugin-garfish", runtimePluginName =
87
87
  "Access-Control-Allow-Origin": "*"
88
88
  }
89
89
  },
90
- webpackChain: (chain, { webpack, env, CHAIN_ID }) => {
91
- var _resolveOptions_deploy, _resolveWebpackConfig_resolve;
90
+ webpackChain: (chain, { webpack, CHAIN_ID }) => {
91
+ if (webpack.BannerPlugin) {
92
+ chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [
93
+ {
94
+ banner: "Micro front-end"
95
+ }
96
+ ]);
97
+ }
98
+ },
99
+ rspack: (config2) => {
100
+ var _resolveOptions_deploy;
101
+ var _config;
102
+ var _builtins;
103
+ (_builtins = (_config = config2).builtins) !== null && _builtins !== void 0 ? _builtins : _config.builtins = {};
104
+ const resolveOptions = useResolvedConfigContext();
105
+ if ((resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) && !config2.externalsType) {
106
+ config2.externalsType = "commonjs";
107
+ }
108
+ const banner = config2.builtins.banner || [];
109
+ config2.builtins.banner = [
110
+ ...Array.isArray(banner) ? banner : [
111
+ banner
112
+ ],
113
+ {
114
+ banner: "Micro front-end"
115
+ }
116
+ ];
117
+ },
118
+ bundlerChain: (chain, { env, CHAIN_ID }) => {
119
+ var _resolveOptions_deploy, _resolveConfig_resolve;
92
120
  const resolveOptions = useResolvedConfigContext();
93
121
  if (resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) {
94
122
  var _useConfig_dev, _resolveOptions_server, _resolveOptions_deploy1;
@@ -96,13 +124,6 @@ export default ({ pluginName = "@modern-js/plugin-garfish", runtimePluginName =
96
124
  if (!((_useConfig_dev = useConfig.dev) === null || _useConfig_dev === void 0 ? void 0 : _useConfig_dev.assetPrefix) && (resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_server = resolveOptions.server) === null || _resolveOptions_server === void 0 ? void 0 : _resolveOptions_server.port) && env === "development") {
97
125
  chain.output.publicPath(`//localhost:${resolveOptions.server.port}/`);
98
126
  }
99
- if (webpack.BannerPlugin) {
100
- chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [
101
- {
102
- banner: "Micro front-end"
103
- }
104
- ]);
105
- }
106
127
  const { enableHtmlEntry, externalBasicLibrary } = getDefaultMicroFrontedConfig((_resolveOptions_deploy1 = resolveOptions.deploy) === null || _resolveOptions_deploy1 === void 0 ? void 0 : _resolveOptions_deploy1.microFrontend);
107
128
  if (externalBasicLibrary) {
108
129
  chain.externals(externals);
@@ -116,13 +137,13 @@ export default ({ pluginName = "@modern-js/plugin-garfish", runtimePluginName =
116
137
  });
117
138
  }
118
139
  }
119
- const resolveWebpackConfig = chain.toConfig();
120
- logger("webpackConfig", {
121
- output: resolveWebpackConfig.output,
122
- externals: resolveWebpackConfig.externals,
140
+ const resolveConfig = chain.toConfig();
141
+ logger("bundlerConfig", {
142
+ output: resolveConfig.output,
143
+ externals: resolveConfig.externals,
123
144
  env,
124
- alias: (_resolveWebpackConfig_resolve = resolveWebpackConfig.resolve) === null || _resolveWebpackConfig_resolve === void 0 ? void 0 : _resolveWebpackConfig_resolve.alias,
125
- plugins: resolveWebpackConfig.plugins
145
+ alias: (_resolveConfig_resolve = resolveConfig.resolve) === null || _resolveConfig_resolve === void 0 ? void 0 : _resolveConfig_resolve.alias,
146
+ plugins: resolveConfig.plugins
126
147
  });
127
148
  }
128
149
  }
@@ -107,7 +107,7 @@ export function setRuntimeConfig(config, key, value) {
107
107
  return void 0;
108
108
  }
109
109
  export const generateAsyncEntry = (code) => {
110
- const transformCode = code.replace(`import('./bootstrap.js');`, `if (!window.__GARFISH__) { import('./bootstrap.js'); }`);
110
+ const transformCode = code.replace(`import('./bootstrap.jsx');`, `if (!window.__GARFISH__) { import('./bootstrap.jsx'); }`);
111
111
  return `
112
112
  export const provider = async (...args) => {
113
113
  const exports = await import('./bootstrap');
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.17.0",
18
+ "version": "2.18.0",
19
19
  "jsnext:source": "./src/cli/index.ts",
20
20
  "types": "./dist/types/cli/index.d.ts",
21
21
  "typesVersions": {
@@ -70,10 +70,10 @@
70
70
  "garfish": "^1.8.1",
71
71
  "hoist-non-react-statics": "^3.3.2",
72
72
  "react-loadable": "^5.5.0",
73
- "@modern-js/utils": "2.17.0"
73
+ "@modern-js/utils": "2.18.0"
74
74
  },
75
75
  "peerDependencies": {
76
- "@modern-js/runtime": "^2.17.0"
76
+ "@modern-js/runtime": "^2.18.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@testing-library/jest-dom": "^5.16.1",
@@ -89,13 +89,13 @@
89
89
  "react-router-dom": "^6.8.1",
90
90
  "typescript": "^4",
91
91
  "webpack-chain": "^6.5.1",
92
- "@modern-js/app-tools": "2.17.0",
93
- "@modern-js/core": "2.17.0",
94
- "@modern-js/plugin-router-v5": "2.17.0",
95
- "@modern-js/runtime": "2.17.0",
96
- "@modern-js/types": "2.17.0",
97
- "@scripts/build": "2.17.0",
98
- "@scripts/jest-config": "2.17.0"
92
+ "@modern-js/app-tools": "2.18.0",
93
+ "@modern-js/core": "2.18.0",
94
+ "@modern-js/plugin-router-v5": "2.18.0",
95
+ "@modern-js/runtime": "2.18.0",
96
+ "@modern-js/types": "2.18.0",
97
+ "@scripts/build": "2.18.0",
98
+ "@scripts/jest-config": "2.18.0"
99
99
  },
100
100
  "sideEffects": false,
101
101
  "modernConfig": {},