@modern-js/plugin-garfish 2.27.0 → 2.29.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.
@@ -16,6 +16,7 @@ const _garfish = /* @__PURE__ */ _interop_require_default._(require("garfish"));
16
16
  const _util = require("../../util");
17
17
  const _loadable = require("../loadable");
18
18
  function generateMApp(options, manifest) {
19
+ var _manifest;
19
20
  class MApp extends _react.default.Component {
20
21
  componentDidMount() {
21
22
  const { domId } = this.state;
@@ -27,6 +28,7 @@ function generateMApp(options, manifest) {
27
28
  const garfishOptions = {
28
29
  domGetter: `#${domId}`,
29
30
  beforeLoad(appInfo, ...args) {
31
+ var _beforeLoad;
30
32
  (0, _util.logger)("MApp beforeLoad", [
31
33
  appInfo
32
34
  ]);
@@ -36,47 +38,52 @@ function generateMApp(options, manifest) {
36
38
  error: null
37
39
  });
38
40
  }
39
- return beforeLoad === null || beforeLoad === void 0 ? void 0 : beforeLoad(appInfo, ...args);
41
+ return (_beforeLoad = beforeLoad) === null || _beforeLoad === void 0 ? void 0 : _beforeLoad(appInfo, ...args);
40
42
  },
41
43
  beforeMount(appInfo, ...args) {
44
+ var _beforeMount;
42
45
  (0, _util.logger)("MApp beforeMount", args);
43
46
  if (appInfo.activeWhen) {
44
47
  setLoadingState({
45
48
  isLoading: false
46
49
  });
47
50
  }
48
- return beforeMount === null || beforeMount === void 0 ? void 0 : beforeMount(appInfo, ...args);
51
+ return (_beforeMount = beforeMount) === null || _beforeMount === void 0 ? void 0 : _beforeMount(appInfo, ...args);
49
52
  },
50
53
  errorLoadApp(error, appInfo, ...args) {
54
+ var _errorLoadApp;
51
55
  (0, _util.logger)("MApp errorLoadApp", error, args);
52
56
  if (appInfo.activeWhen) {
53
57
  setLoadingState({
54
58
  error
55
59
  });
56
60
  }
57
- return errorLoadApp === null || errorLoadApp === void 0 ? void 0 : errorLoadApp(error, appInfo, ...args);
61
+ return (_errorLoadApp = errorLoadApp) === null || _errorLoadApp === void 0 ? void 0 : _errorLoadApp(error, appInfo, ...args);
58
62
  },
59
63
  errorMountApp(error, appInfo, ...args) {
64
+ var _errorMountApp;
60
65
  (0, _util.logger)("MApp errorMountApp", error, args);
61
66
  if (appInfo.activeWhen) {
62
67
  setLoadingState({
63
68
  error
64
69
  });
65
70
  }
66
- return errorMountApp === null || errorMountApp === void 0 ? void 0 : errorMountApp(error, appInfo, ...args);
71
+ return (_errorMountApp = errorMountApp) === null || _errorMountApp === void 0 ? void 0 : _errorMountApp(error, appInfo, ...args);
67
72
  },
68
73
  errorUnmountApp(error, appInfo, ...args) {
74
+ var _errorUnmountApp;
69
75
  (0, _util.logger)("MApp errorUnmountApp", error, args);
70
76
  if (appInfo.activeWhen) {
71
77
  setLoadingState({
72
78
  error
73
79
  });
74
80
  }
75
- return errorUnmountApp === null || errorUnmountApp === void 0 ? void 0 : errorUnmountApp(error, appInfo, ...args);
81
+ return (_errorUnmountApp = errorUnmountApp) === null || _errorUnmountApp === void 0 ? void 0 : _errorUnmountApp(error, appInfo, ...args);
76
82
  },
77
83
  customLoader: (provider) => {
84
+ var _manifest2;
78
85
  const { render, destroy, SubModuleComponent, jupiter_submodule_app_key } = provider;
79
- const componetRenderMode = (manifest === null || manifest === void 0 ? void 0 : manifest.componentRender) && (SubModuleComponent || jupiter_submodule_app_key);
86
+ const componetRenderMode = ((_manifest2 = manifest) === null || _manifest2 === void 0 ? void 0 : _manifest2.componentRender) && (SubModuleComponent || jupiter_submodule_app_key);
80
87
  return {
81
88
  mount: (appInfo) => {
82
89
  const transferProps = this.filterTransferProps();
@@ -90,13 +97,15 @@ function generateMApp(options, manifest) {
90
97
  });
91
98
  return void 0;
92
99
  } else {
100
+ var _render;
93
101
  (0, _util.logger)("MicroApp customer render", appInfo);
94
- return render === null || render === void 0 ? void 0 : render.apply(provider, [
102
+ return (_render = render) === null || _render === void 0 ? void 0 : _render.apply(provider, [
95
103
  appInfo
96
104
  ]);
97
105
  }
98
106
  },
99
107
  unmount: (appInfo) => {
108
+ var _destroy;
100
109
  const transferProps = this.filterTransferProps();
101
110
  appInfo.props = {
102
111
  ...appInfo.props,
@@ -106,7 +115,7 @@ function generateMApp(options, manifest) {
106
115
  return void 0;
107
116
  }
108
117
  (0, _util.logger)("MicroApp customer destroy", appInfo);
109
- return destroy === null || destroy === void 0 ? void 0 : destroy.apply(provider, [
118
+ return (_destroy = destroy) === null || _destroy === void 0 ? void 0 : _destroy.apply(provider, [
110
119
  appInfo
111
120
  ]);
112
121
  }
@@ -149,5 +158,5 @@ function generateMApp(options, manifest) {
149
158
  });
150
159
  }
151
160
  }
152
- return (0, _loadable.Loadable)(MApp)(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
161
+ return (0, _loadable.Loadable)(MApp)((_manifest = manifest) === null || _manifest === void 0 ? void 0 : _manifest.loadable);
153
162
  }
@@ -43,17 +43,18 @@ function pathJoin(...args) {
43
43
  return res || "/";
44
44
  }
45
45
  function getAppInstance(options, appInfo, manifest) {
46
+ var _manifest;
46
47
  let locationHref = "";
47
48
  function MicroApp(props) {
48
- var _context_router, _context_router_useRouteMatch, _context_router1, _context_router_useMatches, _context_router2, _context_router_useLocation;
49
+ var _context_router_useRouteMatch, _context_router, _context, _context_router_useMatches, _context_router1, _context1, _context_router_useLocation, _context_router2, _context2, _options;
49
50
  const appRef = (0, _react.useRef)(null);
50
51
  const domId = (0, _util.generateSubAppContainerKey)(appInfo);
51
52
  const [SubModuleComponent, setSubModuleComponent] = (0, _react.useState)();
52
53
  const context = (0, _react.useContext)(_runtime.RuntimeReactContext);
53
- const match = context === null || context === void 0 ? void 0 : (_context_router = context.router) === null || _context_router === void 0 ? void 0 : (_context_router_useRouteMatch = _context_router.useRouteMatch) === null || _context_router_useRouteMatch === void 0 ? void 0 : _context_router_useRouteMatch.call(_context_router);
54
- const matchs = context === null || context === void 0 ? void 0 : (_context_router1 = context.router) === null || _context_router1 === void 0 ? void 0 : (_context_router_useMatches = _context_router1.useMatches) === null || _context_router_useMatches === void 0 ? void 0 : _context_router_useMatches.call(_context_router1);
55
- const location = context === null || context === void 0 ? void 0 : (_context_router2 = context.router) === null || _context_router2 === void 0 ? void 0 : (_context_router_useLocation = _context_router2.useLocation) === null || _context_router_useLocation === void 0 ? void 0 : _context_router_useLocation.call(_context_router2);
56
- let basename = (options === null || options === void 0 ? void 0 : options.basename) || "/";
54
+ const match = (_context = context) === null || _context === void 0 ? void 0 : (_context_router = _context.router) === null || _context_router === void 0 ? void 0 : (_context_router_useRouteMatch = _context_router.useRouteMatch) === null || _context_router_useRouteMatch === void 0 ? void 0 : _context_router_useRouteMatch.call(_context_router);
55
+ const matchs = (_context1 = context) === null || _context1 === void 0 ? void 0 : (_context_router1 = _context1.router) === null || _context_router1 === void 0 ? void 0 : (_context_router_useMatches = _context_router1.useMatches) === null || _context_router_useMatches === void 0 ? void 0 : _context_router_useMatches.call(_context_router1);
56
+ const location = (_context2 = context) === null || _context2 === void 0 ? void 0 : (_context_router2 = _context2.router) === null || _context_router2 === void 0 ? void 0 : (_context_router_useLocation = _context_router2.useLocation) === null || _context_router_useLocation === void 0 ? void 0 : _context_router_useLocation.call(_context_router2);
57
+ let basename = ((_options = options) === null || _options === void 0 ? void 0 : _options.basename) || "/";
57
58
  if (matchs && matchs.length > 0) {
58
59
  const matchItem = {
59
60
  ...matchs[matchs.length - 1]
@@ -63,7 +64,8 @@ function getAppInstance(options, appInfo, manifest) {
63
64
  }
64
65
  basename = pathJoin(basename, matchItem.pathname || "/");
65
66
  } else if (match) {
66
- basename = pathJoin(basename, (match === null || match === void 0 ? void 0 : match.path) || "/");
67
+ var _match;
68
+ basename = pathJoin(basename, ((_match = match) === null || _match === void 0 ? void 0 : _match.path) || "/");
67
69
  }
68
70
  (0, _react.useEffect)(() => {
69
71
  if (location && locationHref !== location.pathname && !_garfish.default.running) {
@@ -92,24 +94,27 @@ function getAppInstance(options, appInfo, manifest) {
92
94
  ...userProps
93
95
  },
94
96
  customLoader: (provider) => {
97
+ var _manifest2;
95
98
  const { render, destroy, SubModuleComponent: SubModuleComponent2, jupiter_submodule_app_key } = provider;
96
- const componetRenderMode = (manifest === null || manifest === void 0 ? void 0 : manifest.componentRender) && (SubModuleComponent2 || jupiter_submodule_app_key);
99
+ const componetRenderMode = ((_manifest2 = manifest) === null || _manifest2 === void 0 ? void 0 : _manifest2.componentRender) && (SubModuleComponent2 || jupiter_submodule_app_key);
97
100
  return {
98
101
  mount: (...props2) => {
99
102
  if (componetRenderMode) {
100
103
  setSubModuleComponent(SubModuleComponent2);
101
104
  return void 0;
102
105
  } else {
106
+ var _render;
103
107
  (0, _util.logger)("MicroApp customer render", props2);
104
- return render === null || render === void 0 ? void 0 : render.apply(provider, props2);
108
+ return (_render = render) === null || _render === void 0 ? void 0 : _render.apply(provider, props2);
105
109
  }
106
110
  },
107
111
  unmount(...props2) {
112
+ var _destroy;
108
113
  if (componetRenderMode) {
109
114
  return void 0;
110
115
  }
111
116
  (0, _util.logger)("MicroApp customer destroy", props2);
112
- return destroy === null || destroy === void 0 ? void 0 : destroy.apply(provider, props2);
117
+ return (_destroy = destroy) === null || _destroy === void 0 ? void 0 : _destroy.apply(provider, props2);
113
118
  }
114
119
  };
115
120
  }
@@ -132,17 +137,19 @@ function getAppInstance(options, appInfo, manifest) {
132
137
  isLoading: false
133
138
  });
134
139
  if (appInstance.mounted && appInstance.appInfo.cache) {
140
+ var _appInstance;
135
141
  (0, _util.logger)(`MicroApp Garfish.loadApp "${appInfo.name}" show`, {
136
142
  appInfo: appInstance.appInfo,
137
143
  appInstance
138
144
  });
139
- await (appInstance === null || appInstance === void 0 ? void 0 : appInstance.show());
145
+ await ((_appInstance = appInstance) === null || _appInstance === void 0 ? void 0 : _appInstance.show());
140
146
  } else {
147
+ var _appInstance1;
141
148
  (0, _util.logger)(`MicroApp Garfish.loadApp "${appInfo.name}" mount`, {
142
149
  appInfo: appInstance.appInfo,
143
150
  appInstance
144
151
  });
145
- await (appInstance === null || appInstance === void 0 ? void 0 : appInstance.mount());
152
+ await ((_appInstance1 = appInstance) === null || _appInstance1 === void 0 ? void 0 : _appInstance1.mount());
146
153
  }
147
154
  } catch (error) {
148
155
  setLoadingState({
@@ -174,7 +181,7 @@ function getAppInstance(options, appInfo, manifest) {
174
181
  })
175
182
  });
176
183
  }
177
- return (0, _loadable.Loadable)(MicroApp)(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
184
+ return (0, _loadable.Loadable)(MicroApp)((_manifest = manifest) === null || _manifest === void 0 ? void 0 : _manifest.loadable);
178
185
  }
179
186
  function generateApps(options, manifest) {
180
187
  var _options_apps;
package/dist/cjs/util.js CHANGED
@@ -25,5 +25,6 @@ const _debug = /* @__PURE__ */ _interop_require_default._(require("debug"));
25
25
  const logger = (0, _debug.default)("modern-js:plugin-garfish");
26
26
  const SUBMODULE_APP_COMPONENT_KEY = "SubModuleComponent";
27
27
  function generateSubAppContainerKey(moduleInfo) {
28
- return moduleInfo ? `modern_sub_app_container_${decodeURIComponent(moduleInfo === null || moduleInfo === void 0 ? void 0 : moduleInfo.name)}` : "modern_sub_app_container";
28
+ var _moduleInfo;
29
+ return moduleInfo ? `modern_sub_app_container_${decodeURIComponent((_moduleInfo = moduleInfo) === null || _moduleInfo === void 0 ? void 0 : _moduleInfo.name)}` : "modern_sub_app_container";
29
30
  }
@@ -62,7 +62,7 @@ export var garfishPlugin = function() {
62
62
  },
63
63
  resolvedConfig: function() {
64
64
  var _ref2 = _async_to_generator(function(config) {
65
- var resolved, _getRuntimeConfig, masterApp, router, nConfig, _useConfig_server, _router_historyOptions, useConfig, baseUrl;
65
+ var resolved, _getRuntimeConfig, masterApp, router, nConfig, _useConfig_server, _useConfig, _router_historyOptions, _router, _router1, useConfig, baseUrl;
66
66
  return _ts_generator(this, function(_state) {
67
67
  resolved = config.resolved;
68
68
  _getRuntimeConfig = getRuntimeConfig(resolved), masterApp = _getRuntimeConfig.masterApp, router = _getRuntimeConfig.router;
@@ -72,12 +72,12 @@ export var garfishPlugin = function() {
72
72
  if (masterApp) {
73
73
  ;
74
74
  useConfig = useConfigContext();
75
- baseUrl = useConfig === null || useConfig === void 0 ? void 0 : (_useConfig_server = useConfig.server) === null || _useConfig_server === void 0 ? void 0 : _useConfig_server.baseUrl;
75
+ baseUrl = (_useConfig = useConfig) === null || _useConfig === void 0 ? void 0 : (_useConfig_server = _useConfig.server) === null || _useConfig_server === void 0 ? void 0 : _useConfig_server.baseUrl;
76
76
  if (Array.isArray(baseUrl)) {
77
77
  throw new Error("Now Micro-Front-End mode dose not support multiple baseUrl, you can set it as a string");
78
78
  }
79
79
  setRuntimeConfig(nConfig.resolved, "masterApp", Object.assign(typeof masterApp === "object" ? _object_spread({}, masterApp) : {}, {
80
- basename: baseUrl || (router === null || router === void 0 ? void 0 : (_router_historyOptions = router.historyOptions) === null || _router_historyOptions === void 0 ? void 0 : _router_historyOptions.basename) || (router === null || router === void 0 ? void 0 : router.basename) || "/"
80
+ basename: baseUrl || ((_router = router) === null || _router === void 0 ? void 0 : (_router_historyOptions = _router.historyOptions) === null || _router_historyOptions === void 0 ? void 0 : _router_historyOptions.basename) || ((_router1 = router) === null || _router1 === void 0 ? void 0 : _router1.basename) || "/"
81
81
  }));
82
82
  }
83
83
  logger("resolvedConfig", {
@@ -137,12 +137,12 @@ export var garfishPlugin = function() {
137
137
  }
138
138
  },
139
139
  rspack: function(config3) {
140
- var _resolveOptions_deploy;
140
+ var _resolveOptions_deploy, _resolveOptions;
141
141
  var _config;
142
142
  var _builtins;
143
143
  (_builtins = (_config = config3).builtins) !== null && _builtins !== void 0 ? _builtins : _config.builtins = {};
144
144
  var resolveOptions = useResolvedConfigContext();
145
- if ((resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) && !config3.externalsType) {
145
+ if (((_resolveOptions = resolveOptions) === null || _resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = _resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) && !config3.externalsType) {
146
146
  config3.externalsType = "commonjs";
147
147
  }
148
148
  var banner = config3.builtins.banner || [];
@@ -156,12 +156,12 @@ export var garfishPlugin = function() {
156
156
  },
157
157
  bundlerChain: function(chain, param2) {
158
158
  var env = param2.env, CHAIN_ID = param2.CHAIN_ID;
159
- var _resolveOptions_deploy, _resolveConfig_resolve;
159
+ var _resolveOptions_deploy, _resolveOptions, _resolveConfig_resolve;
160
160
  var resolveOptions = useResolvedConfigContext();
161
- if (resolveOptions === null || resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) {
162
- var _useConfig_dev, _resolveOptions_server, _resolveOptions_deploy1;
161
+ if ((_resolveOptions = resolveOptions) === null || _resolveOptions === void 0 ? void 0 : (_resolveOptions_deploy = _resolveOptions.deploy) === null || _resolveOptions_deploy === void 0 ? void 0 : _resolveOptions_deploy.microFrontend) {
162
+ var _useConfig_dev, _resolveOptions_server, _resolveOptions1, _resolveOptions_deploy1;
163
163
  chain.output.libraryTarget("umd");
164
- 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") {
164
+ if (!((_useConfig_dev = useConfig.dev) === null || _useConfig_dev === void 0 ? void 0 : _useConfig_dev.assetPrefix) && ((_resolveOptions1 = resolveOptions) === null || _resolveOptions1 === void 0 ? void 0 : (_resolveOptions_server = _resolveOptions1.server) === null || _resolveOptions_server === void 0 ? void 0 : _resolveOptions_server.port) && env === "development") {
165
165
  chain.output.publicPath("//localhost:".concat(resolveOptions.server.port, "/"));
166
166
  }
167
167
  var _getDefaultMicroFrontedConfig = getDefaultMicroFrontedConfig((_resolveOptions_deploy1 = resolveOptions.deploy) === null || _resolveOptions_deploy1 === void 0 ? void 0 : _resolveOptions_deploy1.microFrontend), enableHtmlEntry2 = _getDefaultMicroFrontedConfig.enableHtmlEntry, externalBasicLibrary = _getDefaultMicroFrontedConfig.externalBasicLibrary;
@@ -266,9 +266,9 @@ export var garfishPlugin = function() {
266
266
  },
267
267
  modifyEntryRenderFunction: function modifyEntryRenderFunction(param2) {
268
268
  var entrypoint = param2.entrypoint, code = param2.code;
269
- var _config_deploy;
269
+ var _config_deploy, _config;
270
270
  var config = useResolvedConfigContext();
271
- if (!(config === null || config === void 0 ? void 0 : (_config_deploy = config.deploy) === null || _config_deploy === void 0 ? void 0 : _config_deploy.microFrontend)) {
271
+ if (!((_config = config) === null || _config === void 0 ? void 0 : (_config_deploy = _config.deploy) === null || _config_deploy === void 0 ? void 0 : _config_deploy.microFrontend)) {
272
272
  return {
273
273
  entrypoint: entrypoint,
274
274
  code: code
@@ -283,10 +283,10 @@ export var garfishPlugin = function() {
283
283
  },
284
284
  modifyAsyncEntry: function modifyAsyncEntry(param2) {
285
285
  var entrypoint = param2.entrypoint, code = param2.code;
286
- var _config_deploy, _config_source;
286
+ var _config_deploy, _config, _config_source, _config1;
287
287
  var config = useResolvedConfigContext();
288
288
  var finalCode = code;
289
- 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)) {
289
+ if (((_config = config) === null || _config === void 0 ? void 0 : (_config_deploy = _config.deploy) === null || _config_deploy === void 0 ? void 0 : _config_deploy.microFrontend) && ((_config1 = config) === null || _config1 === void 0 ? void 0 : (_config_source = _config1.source) === null || _config_source === void 0 ? void 0 : _config_source.enableAsyncEntry)) {
290
290
  finalCode = generateAsyncEntry(code);
291
291
  return {
292
292
  entrypoint: entrypoint,
@@ -300,9 +300,9 @@ export var garfishPlugin = function() {
300
300
  },
301
301
  modifyEntryExport: function modifyEntryExport(param2) {
302
302
  var entrypoint = param2.entrypoint, exportStatement = param2.exportStatement;
303
- var _config_deploy;
303
+ var _config_deploy, _config;
304
304
  var config = useResolvedConfigContext();
305
- if (config === null || config === void 0 ? void 0 : (_config_deploy = config.deploy) === null || _config_deploy === void 0 ? void 0 : _config_deploy.microFrontend) {
305
+ if ((_config = config) === null || _config === void 0 ? void 0 : (_config_deploy = _config.deploy) === null || _config_deploy === void 0 ? void 0 : _config_deploy.microFrontend) {
306
306
  var exportStatementCode = makeProvider();
307
307
  logger("exportStatement", exportStatementCode);
308
308
  return {
@@ -6,20 +6,20 @@ export var makeRenderFunction = function(code) {
6
6
  return inGarfishToRender + code.replace("router(", "generateRouterPlugin(basename,").replace(/MOUNT_ID/g, "mountNode").replace("createApp({", "createApp({ props,").replace("bootstrap(AppWrapper, mountNode, root", "bootstrap(AppWrapper, mountNode, root = IS_REACT18 ? ReactDOM.createRoot(mountNode) : null").replace("customBootstrap(AppWrapper", "customBootstrap(AppWrapper, mountNode");
7
7
  };
8
8
  export function getRuntimeConfig(config) {
9
- var _config_runtime;
10
- if (config === null || config === void 0 ? void 0 : (_config_runtime = config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.features) {
11
- var _config_runtime1;
12
- return config === null || config === void 0 ? void 0 : (_config_runtime1 = config.runtime) === null || _config_runtime1 === void 0 ? void 0 : _config_runtime1.features;
9
+ var _config_runtime, _config, _config1;
10
+ if ((_config = config) === null || _config === void 0 ? void 0 : (_config_runtime = _config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.features) {
11
+ var _config_runtime1, _config2;
12
+ return (_config2 = config) === null || _config2 === void 0 ? void 0 : (_config_runtime1 = _config2.runtime) === null || _config_runtime1 === void 0 ? void 0 : _config_runtime1.features;
13
13
  }
14
- return (config === null || config === void 0 ? void 0 : config.runtime) || {};
14
+ return ((_config1 = config) === null || _config1 === void 0 ? void 0 : _config1.runtime) || {};
15
15
  }
16
16
  export function setRuntimeConfig(config, key, value) {
17
- var _config_runtime, _config_runtime1;
18
- if ((config === null || config === void 0 ? void 0 : (_config_runtime = config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.features) && (config === null || config === void 0 ? void 0 : (_config_runtime1 = config.runtime) === null || _config_runtime1 === void 0 ? void 0 : _config_runtime1.features[key])) {
17
+ var _config_runtime, _config, _config_runtime1, _config1, _config2, _config3;
18
+ if (((_config = config) === null || _config === void 0 ? void 0 : (_config_runtime = _config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.features) && ((_config1 = config) === null || _config1 === void 0 ? void 0 : (_config_runtime1 = _config1.runtime) === null || _config_runtime1 === void 0 ? void 0 : _config_runtime1.features[key])) {
19
19
  config.runtime.features[key] = value;
20
20
  return void 0;
21
21
  }
22
- if ((config === null || config === void 0 ? void 0 : config.runtime) && (config === null || config === void 0 ? void 0 : config.runtime[key])) {
22
+ if (((_config2 = config) === null || _config2 === void 0 ? void 0 : _config2.runtime) && ((_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.runtime[key])) {
23
23
  config.runtime[key] = value;
24
24
  return void 0;
25
25
  }
@@ -13,7 +13,7 @@ var DEFAULT_LOADABLE = {
13
13
  export function Loadable(WrapComponent) {
14
14
  return function(defaultLoadable) {
15
15
  return function Lodable(props) {
16
- var _props_loadable;
16
+ var _props_loadable, _state;
17
17
  var _props_loadable1 = props.loadable, loadable = _props_loadable1 === void 0 ? defaultLoadable !== null && defaultLoadable !== void 0 ? defaultLoadable : DEFAULT_LOADABLE : _props_loadable1, otherProps = _object_without_properties(props, [
18
18
  "loadable"
19
19
  ]);
@@ -93,7 +93,7 @@ export function Loadable(WrapComponent) {
93
93
  isLoading: state.isLoading,
94
94
  pastDelay: state.pastDelay,
95
95
  timedOut: state.timedOut,
96
- error: state === null || state === void 0 ? void 0 : state.error,
96
+ error: (_state = state) === null || _state === void 0 ? void 0 : _state.error,
97
97
  retry: retry
98
98
  }),
99
99
  /* @__PURE__ */ _jsx(WrapComponent, _object_spread({
@@ -24,27 +24,29 @@ function initOptions() {
24
24
  }
25
25
  function _initOptions() {
26
26
  _initOptions = _async_to_generator(function() {
27
- var manifest, options, _window_modern_manifest, _window_modern_manifest1, apps, getAppList, _window_modern_manifest2;
27
+ var manifest, options, _manifest, _manifest1, _window_modern_manifest, _window, _window_modern_manifest1, _window1, apps, _manifest2, _manifest3, _manifest4, getAppList, _window_modern_manifest2, _window2;
28
28
  var _arguments = arguments;
29
29
  return _ts_generator(this, function(_state) {
30
30
  switch (_state.label) {
31
31
  case 0:
32
32
  manifest = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, options = _arguments.length > 1 ? _arguments[1] : void 0;
33
33
  apps = options.apps || [];
34
- if (manifest === null || manifest === void 0 ? void 0 : manifest.modules) {
35
- if ((manifest === null || manifest === void 0 ? void 0 : manifest.modules.length) > 0) {
36
- apps = manifest === null || manifest === void 0 ? void 0 : manifest.modules;
34
+ if ((_manifest = manifest) === null || _manifest === void 0 ? void 0 : _manifest.modules) {
35
+ ;
36
+ if (((_manifest2 = manifest) === null || _manifest2 === void 0 ? void 0 : _manifest2.modules.length) > 0) {
37
+ ;
38
+ apps = (_manifest3 = manifest) === null || _manifest3 === void 0 ? void 0 : _manifest3.modules;
37
39
  }
38
40
  logger("manifest modules", apps);
39
41
  }
40
- if (!(manifest === null || manifest === void 0 ? void 0 : manifest.getAppList))
42
+ if (!((_manifest1 = manifest) === null || _manifest1 === void 0 ? void 0 : _manifest1.getAppList))
41
43
  return [
42
44
  3,
43
45
  2
44
46
  ];
45
47
  return [
46
48
  4,
47
- manifest === null || manifest === void 0 ? void 0 : manifest.getAppList(manifest)
49
+ (_manifest4 = manifest) === null || _manifest4 === void 0 ? void 0 : _manifest4.getAppList(manifest)
48
50
  ];
49
51
  case 1:
50
52
  getAppList = _state.sent();
@@ -54,9 +56,9 @@ function _initOptions() {
54
56
  logger("getAppList modules", apps);
55
57
  _state.label = 2;
56
58
  case 2:
57
- if ((window === null || window === void 0 ? void 0 : (_window_modern_manifest = window.modern_manifest) === null || _window_modern_manifest === void 0 ? void 0 : _window_modern_manifest.modules) && (window === null || window === void 0 ? void 0 : (_window_modern_manifest1 = window.modern_manifest) === null || _window_modern_manifest1 === void 0 ? void 0 : _window_modern_manifest1.modules.length) > 0) {
59
+ if (((_window = window) === null || _window === void 0 ? void 0 : (_window_modern_manifest = _window.modern_manifest) === null || _window_modern_manifest === void 0 ? void 0 : _window_modern_manifest.modules) && ((_window1 = window) === null || _window1 === void 0 ? void 0 : (_window_modern_manifest1 = _window1.modern_manifest) === null || _window_modern_manifest1 === void 0 ? void 0 : _window_modern_manifest1.modules.length) > 0) {
58
60
  ;
59
- apps = window === null || window === void 0 ? void 0 : (_window_modern_manifest2 = window.modern_manifest) === null || _window_modern_manifest2 === void 0 ? void 0 : _window_modern_manifest2.modules;
61
+ apps = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window_modern_manifest2 = _window2.modern_manifest) === null || _window_modern_manifest2 === void 0 ? void 0 : _window_modern_manifest2.modules;
60
62
  logger("modern_manifest", apps);
61
63
  }
62
64
  return [
@@ -13,6 +13,7 @@ import Garfish from "garfish";
13
13
  import { logger, generateSubAppContainerKey } from "../../util";
14
14
  import { Loadable } from "../loadable";
15
15
  export function generateMApp(options, manifest) {
16
+ var _manifest;
16
17
  var MApp = /* @__PURE__ */ function(_React_Component) {
17
18
  "use strict";
18
19
  _inherits(MApp2, _React_Component);
@@ -43,6 +44,7 @@ export function generateMApp(options, manifest) {
43
44
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
44
45
  args[_key - 1] = arguments[_key];
45
46
  }
47
+ var _beforeLoad;
46
48
  logger("MApp beforeLoad", [
47
49
  appInfo
48
50
  ]);
@@ -52,7 +54,7 @@ export function generateMApp(options, manifest) {
52
54
  error: null
53
55
  });
54
56
  }
55
- return beforeLoad === null || beforeLoad === void 0 ? void 0 : beforeLoad.apply(void 0, [
57
+ return (_beforeLoad = beforeLoad) === null || _beforeLoad === void 0 ? void 0 : _beforeLoad.apply(void 0, [
56
58
  appInfo
57
59
  ].concat(_to_consumable_array(args)));
58
60
  },
@@ -60,13 +62,14 @@ export function generateMApp(options, manifest) {
60
62
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
61
63
  args[_key - 1] = arguments[_key];
62
64
  }
65
+ var _beforeMount;
63
66
  logger("MApp beforeMount", args);
64
67
  if (appInfo.activeWhen) {
65
68
  setLoadingState({
66
69
  isLoading: false
67
70
  });
68
71
  }
69
- return beforeMount === null || beforeMount === void 0 ? void 0 : beforeMount.apply(void 0, [
72
+ return (_beforeMount = beforeMount) === null || _beforeMount === void 0 ? void 0 : _beforeMount.apply(void 0, [
70
73
  appInfo
71
74
  ].concat(_to_consumable_array(args)));
72
75
  },
@@ -74,13 +77,14 @@ export function generateMApp(options, manifest) {
74
77
  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
75
78
  args[_key - 2] = arguments[_key];
76
79
  }
80
+ var _errorLoadApp;
77
81
  logger("MApp errorLoadApp", error, args);
78
82
  if (appInfo.activeWhen) {
79
83
  setLoadingState({
80
84
  error: error
81
85
  });
82
86
  }
83
- return errorLoadApp === null || errorLoadApp === void 0 ? void 0 : errorLoadApp.apply(void 0, [
87
+ return (_errorLoadApp = errorLoadApp) === null || _errorLoadApp === void 0 ? void 0 : _errorLoadApp.apply(void 0, [
84
88
  error,
85
89
  appInfo
86
90
  ].concat(_to_consumable_array(args)));
@@ -89,13 +93,14 @@ export function generateMApp(options, manifest) {
89
93
  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
90
94
  args[_key - 2] = arguments[_key];
91
95
  }
96
+ var _errorMountApp;
92
97
  logger("MApp errorMountApp", error, args);
93
98
  if (appInfo.activeWhen) {
94
99
  setLoadingState({
95
100
  error: error
96
101
  });
97
102
  }
98
- return errorMountApp === null || errorMountApp === void 0 ? void 0 : errorMountApp.apply(void 0, [
103
+ return (_errorMountApp = errorMountApp) === null || _errorMountApp === void 0 ? void 0 : _errorMountApp.apply(void 0, [
99
104
  error,
100
105
  appInfo
101
106
  ].concat(_to_consumable_array(args)));
@@ -104,20 +109,22 @@ export function generateMApp(options, manifest) {
104
109
  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
105
110
  args[_key - 2] = arguments[_key];
106
111
  }
112
+ var _errorUnmountApp;
107
113
  logger("MApp errorUnmountApp", error, args);
108
114
  if (appInfo.activeWhen) {
109
115
  setLoadingState({
110
116
  error: error
111
117
  });
112
118
  }
113
- return errorUnmountApp === null || errorUnmountApp === void 0 ? void 0 : errorUnmountApp.apply(void 0, [
119
+ return (_errorUnmountApp = errorUnmountApp) === null || _errorUnmountApp === void 0 ? void 0 : _errorUnmountApp.apply(void 0, [
114
120
  error,
115
121
  appInfo
116
122
  ].concat(_to_consumable_array(args)));
117
123
  },
118
124
  customLoader: function(provider) {
125
+ var _manifest2;
119
126
  var render = provider.render, destroy = provider.destroy, SubModuleComponent = provider.SubModuleComponent, jupiter_submodule_app_key = provider.jupiter_submodule_app_key;
120
- var componetRenderMode = (manifest === null || manifest === void 0 ? void 0 : manifest.componentRender) && (SubModuleComponent || jupiter_submodule_app_key);
127
+ var componetRenderMode = ((_manifest2 = manifest) === null || _manifest2 === void 0 ? void 0 : _manifest2.componentRender) && (SubModuleComponent || jupiter_submodule_app_key);
121
128
  return {
122
129
  mount: function(appInfo) {
123
130
  var transferProps = _this.filterTransferProps();
@@ -128,20 +135,22 @@ export function generateMApp(options, manifest) {
128
135
  });
129
136
  return void 0;
130
137
  } else {
138
+ var _render;
131
139
  logger("MicroApp customer render", appInfo);
132
- return render === null || render === void 0 ? void 0 : render.apply(provider, [
140
+ return (_render = render) === null || _render === void 0 ? void 0 : _render.apply(provider, [
133
141
  appInfo
134
142
  ]);
135
143
  }
136
144
  },
137
145
  unmount: function(appInfo) {
146
+ var _destroy;
138
147
  var transferProps = _this.filterTransferProps();
139
148
  appInfo.props = _object_spread({}, appInfo.props, transferProps);
140
149
  if (componetRenderMode) {
141
150
  return void 0;
142
151
  }
143
152
  logger("MicroApp customer destroy", appInfo);
144
- return destroy === null || destroy === void 0 ? void 0 : destroy.apply(provider, [
153
+ return (_destroy = destroy) === null || _destroy === void 0 ? void 0 : _destroy.apply(provider, [
145
154
  appInfo
146
155
  ]);
147
156
  }
@@ -191,5 +200,5 @@ export function generateMApp(options, manifest) {
191
200
  ]);
192
201
  return MApp2;
193
202
  }(React.Component);
194
- return Loadable(MApp)(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
203
+ return Loadable(MApp)((_manifest = manifest) === null || _manifest === void 0 ? void 0 : _manifest.loadable);
195
204
  }