@pulse-editor/react-api 0.1.1-beta.79 → 0.1.1-beta.81

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/dist/main.js CHANGED
@@ -724,9 +724,7 @@ function generateSnapshotFromManifest(manifest) {
724
724
  return {
725
725
  assets: item.assets,
726
726
  sharedName: item.name,
727
- version: item.version,
728
- // @ts-ignore
729
- usedExports: item.referenceExports || []
727
+ version: item.version
730
728
  };
731
729
  }),
732
730
  modules: exposes === null || exposes === void 0 ? void 0 : exposes.map(function (expose) {
@@ -1533,7 +1531,7 @@ var BUILD_001 = 'BUILD-001';
1533
1531
  var BUILD_002 = 'BUILD-002';
1534
1532
  var getDocsUrl = function getDocsUrl(errorCode) {
1535
1533
  var type = errorCode.split('-')[0].toLowerCase();
1536
- return "View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/".concat(type, "#").concat(errorCode.toLowerCase());
1534
+ return "View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/".concat(type, "/").concat(errorCode);
1537
1535
  };
1538
1536
  var getShortErrorMsg = function getShortErrorMsg(errorCode, errorDescMap, args, originalErrorMsg) {
1539
1537
  var msg = ["".concat([errorDescMap[errorCode]], " #").concat(errorCode)];
@@ -1619,7 +1617,7 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
1619
1617
  type: 'global',
1620
1618
  globalName: ''
1621
1619
  };
1622
- if (isBrowserEnv() || isReactNativeEnv() || !('ssrRemoteEntry' in snapshot)) {
1620
+ if (isBrowserEnv() || isReactNativeEnv()) {
1623
1621
  return 'remoteEntry' in snapshot ? {
1624
1622
  url: snapshot.remoteEntry,
1625
1623
  type: snapshot.remoteEntryType,
@@ -1712,7 +1710,7 @@ function setGlobalFederationConstructor(FederationConstructor) {
1712
1710
  var isDebug = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isDebugMode();
1713
1711
  if (isDebug) {
1714
1712
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
1715
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.0.1";
1713
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.21.6";
1716
1714
  }
1717
1715
  }
1718
1716
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -2296,7 +2294,7 @@ function satisfy(version, range) {
2296
2294
  return false;
2297
2295
  }
2298
2296
  function formatShare(shareArgs, from, name, shareStrategy) {
2299
- var _shareArgs$shareConfi, _shareArgs$treeShakin, _shareArgs$version, _shareArgs$scope, _shareArgs$strategy, _shareArgs$treeShakin2, _shareArgs$treeShakin3;
2297
+ var _shareArgs$version, _shareArgs$scope, _shareArgs$strategy;
2300
2298
  var get;
2301
2299
  if ('get' in shareArgs) {
2302
2300
  // eslint-disable-next-line prefer-destructuring
@@ -2312,9 +2310,6 @@ function formatShare(shareArgs, from, name, shareStrategy) {
2312
2310
  });
2313
2311
  };
2314
2312
  }
2315
- if ((_shareArgs$shareConfi = shareArgs.shareConfig) !== null && _shareArgs$shareConfi !== void 0 && _shareArgs$shareConfi.eager && (_shareArgs$treeShakin = shareArgs.treeShaking) !== null && _shareArgs$treeShakin !== void 0 && _shareArgs$treeShakin.mode) {
2316
- throw new Error('Can not set "eager:true" and "treeShaking" at the same time!');
2317
- }
2318
2313
  return _objectSpread2(_objectSpread2({
2319
2314
  deps: [],
2320
2315
  useIn: [],
@@ -2331,68 +2326,40 @@ function formatShare(shareArgs, from, name, shareStrategy) {
2331
2326
  loaded: shareArgs !== null && shareArgs !== void 0 && shareArgs.loaded || 'lib' in shareArgs ? true : undefined,
2332
2327
  version: (_shareArgs$version = shareArgs.version) !== null && _shareArgs$version !== void 0 ? _shareArgs$version : '0',
2333
2328
  scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [(_shareArgs$scope = shareArgs.scope) !== null && _shareArgs$scope !== void 0 ? _shareArgs$scope : 'default'],
2334
- strategy: ((_shareArgs$strategy = shareArgs.strategy) !== null && _shareArgs$strategy !== void 0 ? _shareArgs$strategy : shareStrategy) || 'version-first',
2335
- treeShaking: shareArgs.treeShaking ? _objectSpread2(_objectSpread2({}, shareArgs.treeShaking), {}, {
2336
- mode: (_shareArgs$treeShakin2 = shareArgs.treeShaking.mode) !== null && _shareArgs$treeShakin2 !== void 0 ? _shareArgs$treeShakin2 : 'server-calc',
2337
- status: (_shareArgs$treeShakin3 = shareArgs.treeShaking.status) !== null && _shareArgs$treeShakin3 !== void 0 ? _shareArgs$treeShakin3 : 1 /* TreeShakingStatus.UNKNOWN */,
2338
- useIn: []
2339
- }) : undefined
2329
+ strategy: ((_shareArgs$strategy = shareArgs.strategy) !== null && _shareArgs$strategy !== void 0 ? _shareArgs$strategy : shareStrategy) || 'version-first'
2340
2330
  });
2341
2331
  }
2342
- function formatShareConfigs(prevOptions, newOptions) {
2343
- var shareArgs = newOptions.shared || {};
2344
- var from = newOptions.name;
2345
- var newShareInfos = Object.keys(shareArgs).reduce(function (res, pkgName) {
2332
+ function formatShareConfigs(globalOptions, userOptions) {
2333
+ var shareArgs = userOptions.shared || {};
2334
+ var from = userOptions.name;
2335
+ var shareInfos = Object.keys(shareArgs).reduce(function (res, pkgName) {
2346
2336
  var arrayShareArgs = arrayOptions(shareArgs[pkgName]);
2347
2337
  res[pkgName] = res[pkgName] || [];
2348
2338
  arrayShareArgs.forEach(function (shareConfig) {
2349
- res[pkgName].push(formatShare(shareConfig, from, pkgName, newOptions.shareStrategy));
2339
+ res[pkgName].push(formatShare(shareConfig, from, pkgName, userOptions.shareStrategy));
2350
2340
  });
2351
2341
  return res;
2352
2342
  }, {});
2353
- var allShareInfos = _objectSpread2({}, prevOptions.shared);
2354
- Object.keys(newShareInfos).forEach(function (shareKey) {
2355
- if (!allShareInfos[shareKey]) {
2356
- allShareInfos[shareKey] = newShareInfos[shareKey];
2343
+ var shared = _objectSpread2({}, globalOptions.shared);
2344
+ Object.keys(shareInfos).forEach(function (shareKey) {
2345
+ if (!shared[shareKey]) {
2346
+ shared[shareKey] = shareInfos[shareKey];
2357
2347
  } else {
2358
- newShareInfos[shareKey].forEach(function (newUserSharedOptions) {
2359
- var isSameVersion = allShareInfos[shareKey].find(function (sharedVal) {
2348
+ shareInfos[shareKey].forEach(function (newUserSharedOptions) {
2349
+ var isSameVersion = shared[shareKey].find(function (sharedVal) {
2360
2350
  return sharedVal.version === newUserSharedOptions.version;
2361
2351
  });
2362
2352
  if (!isSameVersion) {
2363
- allShareInfos[shareKey].push(newUserSharedOptions);
2353
+ shared[shareKey].push(newUserSharedOptions);
2364
2354
  }
2365
2355
  });
2366
2356
  }
2367
2357
  });
2368
2358
  return {
2369
- allShareInfos: allShareInfos,
2370
- newShareInfos: newShareInfos
2359
+ shared: shared,
2360
+ shareInfos: shareInfos
2371
2361
  };
2372
2362
  }
2373
- function shouldUseTreeShaking(treeShaking, usedExports) {
2374
- if (!treeShaking) {
2375
- return false;
2376
- }
2377
- var status = treeShaking.status,
2378
- mode = treeShaking.mode;
2379
- if (status === 0 /* TreeShakingStatus.NO_USE */) {
2380
- return false;
2381
- }
2382
- if (status === 2 /* TreeShakingStatus.CALCULATED */) {
2383
- return true;
2384
- }
2385
- if (mode === 'runtime-infer') {
2386
- if (!usedExports) {
2387
- return true;
2388
- }
2389
- return isMatchUsedExports(treeShaking, usedExports);
2390
- }
2391
- return false;
2392
- }
2393
- /**
2394
- * compare version a and b, return true if a is less than b
2395
- */
2396
2363
  function versionLt(a, b) {
2397
2364
  var transformInvalidVersion = function transformInvalidVersion(version) {
2398
2365
  var isNumberVersion = !Number.isNaN(Number(version));
@@ -2436,80 +2403,19 @@ var isLoaded = function isLoaded(shared) {
2436
2403
  var isLoading = function isLoading(shared) {
2437
2404
  return Boolean(shared.loading);
2438
2405
  };
2439
- var isMatchUsedExports = function isMatchUsedExports(treeShaking, usedExports) {
2440
- if (!treeShaking || !usedExports) {
2441
- return false;
2442
- }
2443
- var treeShakingUsedExports = treeShaking.usedExports;
2444
- if (!treeShakingUsedExports) {
2445
- return false;
2446
- }
2447
- if (usedExports.every(function (e) {
2448
- return treeShakingUsedExports.includes(e);
2449
- })) {
2450
- return true;
2451
- }
2452
- return false;
2453
- };
2454
- function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName, treeShaking) {
2406
+ function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
2455
2407
  var versions = shareScopeMap[scope][pkgName];
2456
- var version = '';
2457
- var useTreesShaking = shouldUseTreeShaking(treeShaking);
2458
- // return false means use prev version
2459
2408
  var callback = function callback(prev, cur) {
2460
- if (useTreesShaking) {
2461
- if (!versions[prev].treeShaking) {
2462
- return true;
2463
- }
2464
- if (!versions[cur].treeShaking) {
2465
- return false;
2466
- }
2467
- return !isLoaded(versions[prev].treeShaking) && versionLt(prev, cur);
2468
- }
2469
2409
  return !isLoaded(versions[prev]) && versionLt(prev, cur);
2470
2410
  };
2471
- if (useTreesShaking) {
2472
- version = findVersion(shareScopeMap[scope][pkgName], callback);
2473
- if (version) {
2474
- return {
2475
- version: version,
2476
- useTreesShaking: useTreesShaking
2477
- };
2478
- }
2479
- useTreesShaking = false;
2480
- }
2481
- return {
2482
- version: findVersion(shareScopeMap[scope][pkgName], callback),
2483
- useTreesShaking: useTreesShaking
2484
- };
2411
+ return findVersion(shareScopeMap[scope][pkgName], callback);
2485
2412
  }
2486
- var isLoadingOrLoaded = function isLoadingOrLoaded(shared) {
2487
- return isLoaded(shared) || isLoading(shared);
2488
- };
2489
- function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName, treeShaking) {
2413
+ function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
2490
2414
  var versions = shareScopeMap[scope][pkgName];
2491
- var version = '';
2492
- var useTreesShaking = shouldUseTreeShaking(treeShaking);
2493
- // return false means use prev version
2494
2415
  var callback = function callback(prev, cur) {
2495
- if (useTreesShaking) {
2496
- if (!versions[prev].treeShaking) {
2497
- return true;
2498
- }
2499
- if (!versions[cur].treeShaking) {
2500
- return false;
2501
- }
2502
- if (isLoadingOrLoaded(versions[cur].treeShaking)) {
2503
- if (isLoadingOrLoaded(versions[prev].treeShaking)) {
2504
- return Boolean(versionLt(prev, cur));
2505
- } else {
2506
- return true;
2507
- }
2508
- }
2509
- if (isLoadingOrLoaded(versions[prev].treeShaking)) {
2510
- return false;
2511
- }
2512
- }
2416
+ var isLoadingOrLoaded = function isLoadingOrLoaded(shared) {
2417
+ return isLoaded(shared) || isLoading(shared);
2418
+ };
2513
2419
  if (isLoadingOrLoaded(versions[cur])) {
2514
2420
  if (isLoadingOrLoaded(versions[prev])) {
2515
2421
  return Boolean(versionLt(prev, cur));
@@ -2522,20 +2428,7 @@ function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName, treeSh
2522
2428
  }
2523
2429
  return versionLt(prev, cur);
2524
2430
  };
2525
- if (useTreesShaking) {
2526
- version = findVersion(shareScopeMap[scope][pkgName], callback);
2527
- if (version) {
2528
- return {
2529
- version: version,
2530
- useTreesShaking: useTreesShaking
2531
- };
2532
- }
2533
- useTreesShaking = false;
2534
- }
2535
- return {
2536
- version: findVersion(shareScopeMap[scope][pkgName], callback),
2537
- useTreesShaking: useTreesShaking
2538
- };
2431
+ return findVersion(shareScopeMap[scope][pkgName], callback);
2539
2432
  }
2540
2433
  function getFindShareFunction(strategy) {
2541
2434
  if (strategy === 'loaded-first') {
@@ -2550,8 +2443,7 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
2550
2443
  var shareConfig = shareInfo.shareConfig,
2551
2444
  _shareInfo$scope = shareInfo.scope,
2552
2445
  scope = _shareInfo$scope === void 0 ? DEFAULT_SCOPE : _shareInfo$scope,
2553
- strategy = shareInfo.strategy,
2554
- treeShaking = shareInfo.treeShaking;
2446
+ strategy = shareInfo.strategy;
2555
2447
  var scopes = Array.isArray(scope) ? scope : [scope];
2556
2448
  var _iterator3 = _createForOfIteratorHelper(scopes),
2557
2449
  _step3;
@@ -2561,67 +2453,35 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
2561
2453
  if (shareConfig && localShareScopeMap[sc] && localShareScopeMap[sc][pkgName]) {
2562
2454
  var requiredVersion = shareConfig.requiredVersion;
2563
2455
  var findShareFunction = getFindShareFunction(strategy);
2564
- var _findShareFunction = findShareFunction(localShareScopeMap, sc, pkgName, treeShaking),
2565
- maxOrSingletonVersion = _findShareFunction.version,
2566
- useTreesShaking = _findShareFunction.useTreesShaking;
2456
+ var maxOrSingletonVersion = findShareFunction(localShareScopeMap, sc, pkgName);
2457
+ //@ts-ignore
2567
2458
  var defaultResolver = function defaultResolver() {
2568
- var shared = localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
2569
2459
  if (shareConfig.singleton) {
2570
2460
  if (typeof requiredVersion === 'string' && !satisfy(maxOrSingletonVersion, requiredVersion)) {
2571
- var msg = "Version ".concat(maxOrSingletonVersion, " from ").concat(maxOrSingletonVersion && shared.from, " of shared singleton module ").concat(pkgName, " does not satisfy the requirement of ").concat(shareInfo.from, " which needs ").concat(requiredVersion, ")");
2461
+ var msg = "Version ".concat(maxOrSingletonVersion, " from ").concat(maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from, " of shared singleton module ").concat(pkgName, " does not satisfy the requirement of ").concat(shareInfo.from, " which needs ").concat(requiredVersion, ")");
2572
2462
  if (shareConfig.strictVersion) {
2573
2463
  error(msg);
2574
2464
  } else {
2575
2465
  warn(msg);
2576
2466
  }
2577
2467
  }
2578
- return {
2579
- shared: shared,
2580
- useTreesShaking: useTreesShaking
2581
- };
2468
+ return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
2582
2469
  } else {
2583
2470
  if (requiredVersion === false || requiredVersion === '*') {
2584
- return {
2585
- shared: shared,
2586
- useTreesShaking: useTreesShaking
2587
- };
2471
+ return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
2588
2472
  }
2589
2473
  if (satisfy(maxOrSingletonVersion, requiredVersion)) {
2590
- return {
2591
- shared: shared,
2592
- useTreesShaking: useTreesShaking
2593
- };
2594
- }
2595
- var _usedTreeShaking = shouldUseTreeShaking(treeShaking);
2596
- if (_usedTreeShaking) {
2597
- for (var _i3 = 0, _Object$entries = Object.entries(localShareScopeMap[sc][pkgName]); _i3 < _Object$entries.length; _i3++) {
2598
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
2599
- versionKey = _Object$entries$_i[0],
2600
- versionValue = _Object$entries$_i[1];
2601
- if (!shouldUseTreeShaking(versionValue.treeShaking, treeShaking === null || treeShaking === void 0 ? void 0 : treeShaking.usedExports)) {
2602
- continue;
2603
- }
2604
- if (satisfy(versionKey, requiredVersion)) {
2605
- return {
2606
- shared: versionValue,
2607
- useTreesShaking: _usedTreeShaking
2608
- };
2609
- }
2610
- }
2474
+ return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
2611
2475
  }
2612
- for (var _i4 = 0, _Object$entries2 = Object.entries(localShareScopeMap[sc][pkgName]); _i4 < _Object$entries2.length; _i4++) {
2613
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i4], 2),
2614
- _versionKey = _Object$entries2$_i[0],
2615
- _versionValue = _Object$entries2$_i[1];
2616
- if (satisfy(_versionKey, requiredVersion)) {
2617
- return {
2618
- shared: _versionValue,
2619
- useTreesShaking: false
2620
- };
2476
+ for (var _i3 = 0, _Object$entries = Object.entries(localShareScopeMap[sc][pkgName]); _i3 < _Object$entries.length; _i3++) {
2477
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
2478
+ versionKey = _Object$entries$_i[0],
2479
+ versionValue = _Object$entries$_i[1];
2480
+ if (satisfy(versionKey, requiredVersion)) {
2481
+ return versionValue;
2621
2482
  }
2622
2483
  }
2623
2484
  }
2624
- return;
2625
2485
  };
2626
2486
  var params = {
2627
2487
  shareScopeMap: localShareScopeMap,
@@ -2629,7 +2489,6 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
2629
2489
  pkgName: pkgName,
2630
2490
  version: maxOrSingletonVersion,
2631
2491
  GlobalFederation: Global.__FEDERATION__,
2632
- shareInfo: shareInfo,
2633
2492
  resolver: defaultResolver
2634
2493
  };
2635
2494
  var resolveShared = resolveShare.emit(params) || params;
@@ -2666,53 +2525,13 @@ function getTargetSharedOptions(options) {
2666
2525
  shareVersionMap[shared.version] = shared;
2667
2526
  });
2668
2527
  var callback = function callback(prev, cur) {
2669
- return (
2670
- // TODO: consider multiple treeShaking shared scenes
2671
- !isLoaded(shareVersionMap[prev]) && versionLt(prev, cur)
2672
- );
2528
+ return !isLoaded(shareVersionMap[prev]) && versionLt(prev, cur);
2673
2529
  };
2674
2530
  var maxVersion = findVersion(shareVersionMap, callback);
2675
2531
  return shareVersionMap[maxVersion];
2676
2532
  };
2677
2533
  var resolver = (_extraOptions$resolve = extraOptions === null || extraOptions === void 0 ? void 0 : extraOptions.resolver) !== null && _extraOptions$resolve !== void 0 ? _extraOptions$resolve : defaultResolver;
2678
- var isPlainObject = function isPlainObject(val) {
2679
- return val !== null && _typeof(val) === 'object' && !Array.isArray(val);
2680
- };
2681
- var _merge = function merge() {
2682
- var out = {};
2683
- for (var _len2 = arguments.length, sources = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2684
- sources[_key2] = arguments[_key2];
2685
- }
2686
- for (var _i5 = 0, _sources = sources; _i5 < _sources.length; _i5++) {
2687
- var src = _sources[_i5];
2688
- if (!src) continue;
2689
- for (var _i6 = 0, _Object$entries3 = Object.entries(src); _i6 < _Object$entries3.length; _i6++) {
2690
- var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i6], 2),
2691
- key = _Object$entries3$_i[0],
2692
- value = _Object$entries3$_i[1];
2693
- var prev = out[key];
2694
- if (isPlainObject(prev) && isPlainObject(value)) {
2695
- out[key] = _merge(prev, value);
2696
- } else if (value !== undefined) {
2697
- out[key] = value;
2698
- }
2699
- }
2700
- }
2701
- return out;
2702
- };
2703
- return _merge(resolver(shareInfos[pkgName]), extraOptions === null || extraOptions === void 0 ? void 0 : extraOptions.customShareInfo);
2704
- }
2705
- var addUseIn = function addUseIn(shared, from) {
2706
- if (!shared.useIn) {
2707
- shared.useIn = [];
2708
- }
2709
- addUniqueItem(shared.useIn, from);
2710
- };
2711
- function directShare(shared, useTreesShaking) {
2712
- if (useTreesShaking && shared.treeShaking) {
2713
- return shared.treeShaking;
2714
- }
2715
- return shared;
2534
+ return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions === null || extraOptions === void 0 ? void 0 : extraOptions.customShareInfo);
2716
2535
  }
2717
2536
  function getBuilderId() {
2718
2537
  //@ts-ignore
@@ -2829,13 +2648,13 @@ function loadEsmEntry(_x3) {
2829
2648
  return _loadEsmEntry.apply(this, arguments);
2830
2649
  }
2831
2650
  function _loadEsmEntry() {
2832
- _loadEsmEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(_ref) {
2651
+ _loadEsmEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(_ref) {
2833
2652
  var entry, remoteEntryExports;
2834
- return _regenerator().w(function (_context23) {
2835
- while (1) switch (_context23.n) {
2653
+ return _regenerator().w(function (_context21) {
2654
+ while (1) switch (_context21.n) {
2836
2655
  case 0:
2837
2656
  entry = _ref.entry, remoteEntryExports = _ref.remoteEntryExports;
2838
- return _context23.a(2, new Promise(function (resolve, reject) {
2657
+ return _context21.a(2, new Promise(function (resolve, reject) {
2839
2658
  try {
2840
2659
  if (!remoteEntryExports) {
2841
2660
  if (typeof FEDERATION_ALLOW_NEW_FUNCTION !== 'undefined') {
@@ -2851,7 +2670,7 @@ function _loadEsmEntry() {
2851
2670
  }
2852
2671
  }));
2853
2672
  }
2854
- }, _callee23);
2673
+ }, _callee21);
2855
2674
  }));
2856
2675
  return _loadEsmEntry.apply(this, arguments);
2857
2676
  }
@@ -2859,13 +2678,13 @@ function loadSystemJsEntry(_x4) {
2859
2678
  return _loadSystemJsEntry.apply(this, arguments);
2860
2679
  }
2861
2680
  function _loadSystemJsEntry() {
2862
- _loadSystemJsEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(_ref2) {
2681
+ _loadSystemJsEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(_ref2) {
2863
2682
  var entry, remoteEntryExports;
2864
- return _regenerator().w(function (_context24) {
2865
- while (1) switch (_context24.n) {
2683
+ return _regenerator().w(function (_context22) {
2684
+ while (1) switch (_context22.n) {
2866
2685
  case 0:
2867
2686
  entry = _ref2.entry, remoteEntryExports = _ref2.remoteEntryExports;
2868
- return _context24.a(2, new Promise(function (resolve, reject) {
2687
+ return _context22.a(2, new Promise(function (resolve, reject) {
2869
2688
  try {
2870
2689
  if (!remoteEntryExports) {
2871
2690
  //@ts-ignore
@@ -2883,7 +2702,7 @@ function _loadSystemJsEntry() {
2883
2702
  }
2884
2703
  }));
2885
2704
  }
2886
- }, _callee24);
2705
+ }, _callee22);
2887
2706
  }));
2888
2707
  return _loadSystemJsEntry.apply(this, arguments);
2889
2708
  }
@@ -2902,22 +2721,22 @@ function loadEntryScript(_x5) {
2902
2721
  return _loadEntryScript.apply(this, arguments);
2903
2722
  }
2904
2723
  function _loadEntryScript() {
2905
- _loadEntryScript = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(_ref3) {
2724
+ _loadEntryScript = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(_ref3) {
2906
2725
  var name, globalName, entry, loaderHook, getEntryUrl, _getRemoteEntryExport2, remoteEntryExports, url;
2907
- return _regenerator().w(function (_context25) {
2908
- while (1) switch (_context25.n) {
2726
+ return _regenerator().w(function (_context23) {
2727
+ while (1) switch (_context23.n) {
2909
2728
  case 0:
2910
2729
  name = _ref3.name, globalName = _ref3.globalName, entry = _ref3.entry, loaderHook = _ref3.loaderHook, getEntryUrl = _ref3.getEntryUrl;
2911
2730
  _getRemoteEntryExport2 = getRemoteEntryExports(name, globalName), remoteEntryExports = _getRemoteEntryExport2.entryExports;
2912
2731
  if (!remoteEntryExports) {
2913
- _context25.n = 1;
2732
+ _context23.n = 1;
2914
2733
  break;
2915
2734
  }
2916
- return _context25.a(2, remoteEntryExports);
2735
+ return _context23.a(2, remoteEntryExports);
2917
2736
  case 1:
2918
2737
  // if getEntryUrl is passed, use the getEntryUrl to get the entry url
2919
2738
  url = getEntryUrl ? getEntryUrl(entry) : entry;
2920
- return _context25.a(2, loadScript(url, {
2739
+ return _context23.a(2, loadScript(url, {
2921
2740
  attrs: {},
2922
2741
  createScriptHook: function createScriptHook(url, attrs) {
2923
2742
  var res = loaderHook.lifecycle.createScript.emit({
@@ -2943,7 +2762,7 @@ function _loadEntryScript() {
2943
2762
  throw e;
2944
2763
  }));
2945
2764
  }
2946
- }, _callee25);
2765
+ }, _callee23);
2947
2766
  }));
2948
2767
  return _loadEntryScript.apply(this, arguments);
2949
2768
  }
@@ -2951,28 +2770,28 @@ function loadEntryDom(_x6) {
2951
2770
  return _loadEntryDom.apply(this, arguments);
2952
2771
  }
2953
2772
  function _loadEntryDom() {
2954
- _loadEntryDom = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(_ref4) {
2773
+ _loadEntryDom = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(_ref4) {
2955
2774
  var remoteInfo, remoteEntryExports, loaderHook, getEntryUrl, entry, globalName, name, type, _t6;
2956
- return _regenerator().w(function (_context26) {
2957
- while (1) switch (_context26.n) {
2775
+ return _regenerator().w(function (_context24) {
2776
+ while (1) switch (_context24.n) {
2958
2777
  case 0:
2959
2778
  remoteInfo = _ref4.remoteInfo, remoteEntryExports = _ref4.remoteEntryExports, loaderHook = _ref4.loaderHook, getEntryUrl = _ref4.getEntryUrl;
2960
2779
  entry = remoteInfo.entry, globalName = remoteInfo.entryGlobalName, name = remoteInfo.name, type = remoteInfo.type;
2961
2780
  _t6 = type;
2962
- _context26.n = _t6 === 'esm' ? 1 : _t6 === 'module' ? 1 : _t6 === 'system' ? 2 : 3;
2781
+ _context24.n = _t6 === 'esm' ? 1 : _t6 === 'module' ? 1 : _t6 === 'system' ? 2 : 3;
2963
2782
  break;
2964
2783
  case 1:
2965
- return _context26.a(2, loadEsmEntry({
2784
+ return _context24.a(2, loadEsmEntry({
2966
2785
  entry: entry,
2967
2786
  remoteEntryExports: remoteEntryExports
2968
2787
  }));
2969
2788
  case 2:
2970
- return _context26.a(2, loadSystemJsEntry({
2789
+ return _context24.a(2, loadSystemJsEntry({
2971
2790
  entry: entry,
2972
2791
  remoteEntryExports: remoteEntryExports
2973
2792
  }));
2974
2793
  case 3:
2975
- return _context26.a(2, loadEntryScript({
2794
+ return _context24.a(2, loadEntryScript({
2976
2795
  entry: entry,
2977
2796
  globalName: globalName,
2978
2797
  name: name,
@@ -2980,9 +2799,9 @@ function _loadEntryDom() {
2980
2799
  getEntryUrl: getEntryUrl
2981
2800
  }));
2982
2801
  case 4:
2983
- return _context26.a(2);
2802
+ return _context24.a(2);
2984
2803
  }
2985
- }, _callee26);
2804
+ }, _callee24);
2986
2805
  }));
2987
2806
  return _loadEntryDom.apply(this, arguments);
2988
2807
  }
@@ -2990,21 +2809,21 @@ function loadEntryNode(_x7) {
2990
2809
  return _loadEntryNode.apply(this, arguments);
2991
2810
  }
2992
2811
  function _loadEntryNode() {
2993
- _loadEntryNode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(_ref5) {
2812
+ _loadEntryNode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(_ref5) {
2994
2813
  var remoteInfo, loaderHook, entry, globalName, name, type, _getRemoteEntryExport3, remoteEntryExports;
2995
- return _regenerator().w(function (_context27) {
2996
- while (1) switch (_context27.n) {
2814
+ return _regenerator().w(function (_context25) {
2815
+ while (1) switch (_context25.n) {
2997
2816
  case 0:
2998
2817
  remoteInfo = _ref5.remoteInfo, loaderHook = _ref5.loaderHook;
2999
2818
  entry = remoteInfo.entry, globalName = remoteInfo.entryGlobalName, name = remoteInfo.name, type = remoteInfo.type;
3000
2819
  _getRemoteEntryExport3 = getRemoteEntryExports(name, globalName), remoteEntryExports = _getRemoteEntryExport3.entryExports;
3001
2820
  if (!remoteEntryExports) {
3002
- _context27.n = 1;
2821
+ _context25.n = 1;
3003
2822
  break;
3004
2823
  }
3005
- return _context27.a(2, remoteEntryExports);
2824
+ return _context25.a(2, remoteEntryExports);
3006
2825
  case 1:
3007
- return _context27.a(2, loadScriptNode(entry, {
2826
+ return _context25.a(2, loadScriptNode(entry, {
3008
2827
  attrs: {
3009
2828
  name: name,
3010
2829
  globalName: globalName,
@@ -3030,7 +2849,7 @@ function _loadEntryNode() {
3030
2849
  throw e;
3031
2850
  }));
3032
2851
  }
3033
- }, _callee27);
2852
+ }, _callee25);
3034
2853
  }));
3035
2854
  return _loadEntryNode.apply(this, arguments);
3036
2855
  }
@@ -3043,18 +2862,18 @@ function getRemoteEntry(_x8) {
3043
2862
  return _getRemoteEntry.apply(this, arguments);
3044
2863
  }
3045
2864
  function _getRemoteEntry() {
3046
- _getRemoteEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(params) {
2865
+ _getRemoteEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(params) {
3047
2866
  var origin, remoteEntryExports, remoteInfo, getEntryUrl, _params$_inErrorHandl, _inErrorHandling, uniqueKey, loadEntryHook, loaderHook;
3048
- return _regenerator().w(function (_context29) {
3049
- while (1) switch (_context29.n) {
2867
+ return _regenerator().w(function (_context27) {
2868
+ while (1) switch (_context27.n) {
3050
2869
  case 0:
3051
2870
  origin = params.origin, remoteEntryExports = params.remoteEntryExports, remoteInfo = params.remoteInfo, getEntryUrl = params.getEntryUrl, _params$_inErrorHandl = params._inErrorHandling, _inErrorHandling = _params$_inErrorHandl === void 0 ? false : _params$_inErrorHandl;
3052
2871
  uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
3053
2872
  if (!remoteEntryExports) {
3054
- _context29.n = 1;
2873
+ _context27.n = 1;
3055
2874
  break;
3056
2875
  }
3057
- return _context29.a(2, remoteEntryExports);
2876
+ return _context27.a(2, remoteEntryExports);
3058
2877
  case 1:
3059
2878
  if (!globalLoading[uniqueKey]) {
3060
2879
  loadEntryHook = origin.remoteHandler.hooks.lifecycle.loadEntry;
@@ -3079,15 +2898,15 @@ function _getRemoteEntry() {
3079
2898
  loaderHook: loaderHook
3080
2899
  });
3081
2900
  })["catch"](/*#__PURE__*/function () {
3082
- var _ref25 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(err) {
2901
+ var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(err) {
3083
2902
  var uniqueKey, isScriptLoadError, wrappedGetRemoteEntry, RemoteEntryExports;
3084
- return _regenerator().w(function (_context28) {
3085
- while (1) switch (_context28.n) {
2903
+ return _regenerator().w(function (_context26) {
2904
+ while (1) switch (_context26.n) {
3086
2905
  case 0:
3087
2906
  uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
3088
2907
  isScriptLoadError = err instanceof Error && err.message.includes(RUNTIME_008);
3089
2908
  if (!(isScriptLoadError && !_inErrorHandling)) {
3090
- _context28.n = 2;
2909
+ _context26.n = 2;
3091
2910
  break;
3092
2911
  }
3093
2912
  wrappedGetRemoteEntry = function wrappedGetRemoteEntry(params) {
@@ -3095,7 +2914,7 @@ function _getRemoteEntry() {
3095
2914
  _inErrorHandling: true
3096
2915
  }));
3097
2916
  };
3098
- _context28.n = 1;
2917
+ _context26.n = 1;
3099
2918
  return origin.loaderHook.lifecycle.loadEntryError.emit({
3100
2919
  getRemoteEntry: wrappedGetRemoteEntry,
3101
2920
  origin: origin,
@@ -3105,27 +2924,27 @@ function _getRemoteEntry() {
3105
2924
  uniqueKey: uniqueKey
3106
2925
  });
3107
2926
  case 1:
3108
- RemoteEntryExports = _context28.v;
2927
+ RemoteEntryExports = _context26.v;
3109
2928
  if (!RemoteEntryExports) {
3110
- _context28.n = 2;
2929
+ _context26.n = 2;
3111
2930
  break;
3112
2931
  }
3113
- return _context28.a(2, RemoteEntryExports);
2932
+ return _context26.a(2, RemoteEntryExports);
3114
2933
  case 2:
3115
2934
  throw err;
3116
2935
  case 3:
3117
- return _context28.a(2);
2936
+ return _context26.a(2);
3118
2937
  }
3119
- }, _callee28);
2938
+ }, _callee26);
3120
2939
  }));
3121
- return function (_x31) {
3122
- return _ref25.apply(this, arguments);
2940
+ return function (_x29) {
2941
+ return _ref20.apply(this, arguments);
3123
2942
  };
3124
2943
  }());
3125
2944
  }
3126
- return _context29.a(2, globalLoading[uniqueKey]);
2945
+ return _context27.a(2, globalLoading[uniqueKey]);
3127
2946
  }
3128
- }, _callee29);
2947
+ }, _callee27);
3129
2948
  }));
3130
2949
  return _getRemoteEntry.apply(this, arguments);
3131
2950
  }
@@ -3309,43 +3128,12 @@ function preloadAssets(remoteInfo, host, assets) {
3309
3128
  }
3310
3129
  }
3311
3130
  }
3312
- function createRemoteEntryInitOptions(remoteInfo, hostShareScopeMap) {
3313
- var localShareScopeMap = hostShareScopeMap;
3314
- var shareScopeKeys = Array.isArray(remoteInfo.shareScope) ? remoteInfo.shareScope : [remoteInfo.shareScope];
3315
- if (!shareScopeKeys.length) {
3316
- shareScopeKeys.push('default');
3317
- }
3318
- shareScopeKeys.forEach(function (shareScopeKey) {
3319
- if (!localShareScopeMap[shareScopeKey]) {
3320
- localShareScopeMap[shareScopeKey] = {};
3321
- }
3322
- });
3323
- var remoteEntryInitOptions = {
3324
- version: remoteInfo.version || '',
3325
- shareScopeKeys: Array.isArray(remoteInfo.shareScope) ? shareScopeKeys : remoteInfo.shareScope || 'default'
3326
- };
3327
- // Help to find host instance
3328
- Object.defineProperty(remoteEntryInitOptions, 'shareScopeMap', {
3329
- value: localShareScopeMap,
3330
- // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
3331
- enumerable: false
3332
- });
3333
- // TODO: compate legacy init params, should use shareScopeMap if exist
3334
- var shareScope = localShareScopeMap[shareScopeKeys[0]];
3335
- var initScope = [];
3336
- return {
3337
- remoteEntryInitOptions: remoteEntryInitOptions,
3338
- shareScope: shareScope,
3339
- initScope: initScope
3340
- };
3341
- }
3342
3131
  var Module = /*#__PURE__*/function () {
3343
3132
  function Module(_ref6) {
3344
3133
  var remoteInfo = _ref6.remoteInfo,
3345
3134
  host = _ref6.host;
3346
3135
  _classCallCheck(this, Module);
3347
3136
  this.inited = false;
3348
- this.initing = false;
3349
3137
  this.lib = undefined;
3350
3138
  this.remoteInfo = remoteInfo;
3351
3139
  this.host = host;
@@ -3384,145 +3172,113 @@ var Module = /*#__PURE__*/function () {
3384
3172
  return getEntry;
3385
3173
  }() // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
3386
3174
  }, {
3387
- key: "init",
3175
+ key: "get",
3388
3176
  value: function () {
3389
- var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(id, remoteSnapshot) {
3390
- var _this = this;
3391
- var remoteEntryExports;
3392
- return _regenerator().w(function (_context3) {
3393
- while (1) switch (_context3.p = _context3.n) {
3177
+ var _get = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(id, expose, options, remoteSnapshot) {
3178
+ var _ref7, _ref7$loadFactory, loadFactory, remoteEntryExports, localShareScopeMap, shareScopeKeys, shareScope, initScope, remoteEntryInitOptions, initContainerOptions, moduleFactory, symbolName, wrapModuleFactory, exposeContent;
3179
+ return _regenerator().w(function (_context2) {
3180
+ while (1) switch (_context2.n) {
3394
3181
  case 0:
3395
- _context3.n = 1;
3182
+ _ref7 = options || {
3183
+ loadFactory: true
3184
+ }, _ref7$loadFactory = _ref7.loadFactory, loadFactory = _ref7$loadFactory === void 0 ? true : _ref7$loadFactory; // Get remoteEntry.js
3185
+ _context2.n = 1;
3396
3186
  return this.getEntry();
3397
3187
  case 1:
3398
- remoteEntryExports = _context3.v;
3399
- if (!this.inited) {
3400
- _context3.n = 2;
3188
+ remoteEntryExports = _context2.v;
3189
+ if (this.inited) {
3190
+ _context2.n = 4;
3401
3191
  break;
3402
3192
  }
3403
- return _context3.a(2, remoteEntryExports);
3193
+ localShareScopeMap = this.host.shareScopeMap;
3194
+ shareScopeKeys = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [this.remoteInfo.shareScope];
3195
+ if (!shareScopeKeys.length) {
3196
+ shareScopeKeys.push('default');
3197
+ }
3198
+ shareScopeKeys.forEach(function (shareScopeKey) {
3199
+ if (!localShareScopeMap[shareScopeKey]) {
3200
+ localShareScopeMap[shareScopeKey] = {};
3201
+ }
3202
+ });
3203
+ // TODO: compate legacy init params, should use shareScopeMap if exist
3204
+ shareScope = localShareScopeMap[shareScopeKeys[0]];
3205
+ initScope = [];
3206
+ remoteEntryInitOptions = {
3207
+ version: this.remoteInfo.version || '',
3208
+ shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? shareScopeKeys : this.remoteInfo.shareScope || 'default'
3209
+ }; // Help to find host instance
3210
+ Object.defineProperty(remoteEntryInitOptions, 'shareScopeMap', {
3211
+ value: localShareScopeMap,
3212
+ // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
3213
+ enumerable: false
3214
+ });
3215
+ _context2.n = 2;
3216
+ return this.host.hooks.lifecycle.beforeInitContainer.emit({
3217
+ shareScope: shareScope,
3218
+ // @ts-ignore shareScopeMap will be set by Object.defineProperty
3219
+ remoteEntryInitOptions: remoteEntryInitOptions,
3220
+ initScope: initScope,
3221
+ remoteInfo: this.remoteInfo,
3222
+ origin: this.host
3223
+ });
3404
3224
  case 2:
3405
- if (!this.initPromise) {
3406
- _context3.n = 4;
3407
- break;
3225
+ initContainerOptions = _context2.v;
3226
+ if (typeof (remoteEntryExports === null || remoteEntryExports === void 0 ? void 0 : remoteEntryExports.init) === 'undefined') {
3227
+ error(getShortErrorMsg(RUNTIME_002, runtimeDescMap, {
3228
+ hostName: this.host.name,
3229
+ remoteName: this.remoteInfo.name,
3230
+ remoteEntryUrl: this.remoteInfo.entry,
3231
+ remoteEntryKey: this.remoteInfo.entryGlobalName
3232
+ }));
3408
3233
  }
3409
- _context3.n = 3;
3410
- return this.initPromise;
3234
+ _context2.n = 3;
3235
+ return remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
3411
3236
  case 3:
3412
- return _context3.a(2, remoteEntryExports);
3237
+ _context2.n = 4;
3238
+ return this.host.hooks.lifecycle.initContainer.emit(_objectSpread2(_objectSpread2({}, initContainerOptions), {}, {
3239
+ id: id,
3240
+ remoteSnapshot: remoteSnapshot,
3241
+ remoteEntryExports: remoteEntryExports
3242
+ }));
3413
3243
  case 4:
3414
- this.initing = true;
3415
- this.initPromise = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
3416
- var _createRemoteEntryIni, remoteEntryInitOptions, shareScope, initScope, initContainerOptions;
3417
- return _regenerator().w(function (_context2) {
3418
- while (1) switch (_context2.n) {
3419
- case 0:
3420
- _createRemoteEntryIni = createRemoteEntryInitOptions(_this.remoteInfo, _this.host.shareScopeMap), remoteEntryInitOptions = _createRemoteEntryIni.remoteEntryInitOptions, shareScope = _createRemoteEntryIni.shareScope, initScope = _createRemoteEntryIni.initScope;
3421
- _context2.n = 1;
3422
- return _this.host.hooks.lifecycle.beforeInitContainer.emit({
3423
- shareScope: shareScope,
3424
- // @ts-ignore shareScopeMap will be set by Object.defineProperty
3425
- remoteEntryInitOptions: remoteEntryInitOptions,
3426
- initScope: initScope,
3427
- remoteInfo: _this.remoteInfo,
3428
- origin: _this.host
3429
- });
3430
- case 1:
3431
- initContainerOptions = _context2.v;
3432
- if (typeof (remoteEntryExports === null || remoteEntryExports === void 0 ? void 0 : remoteEntryExports.init) === 'undefined') {
3433
- error(getShortErrorMsg(RUNTIME_002, runtimeDescMap, {
3434
- hostName: _this.host.name,
3435
- remoteName: _this.remoteInfo.name,
3436
- remoteEntryUrl: _this.remoteInfo.entry,
3437
- remoteEntryKey: _this.remoteInfo.entryGlobalName
3438
- }));
3439
- }
3440
- _context2.n = 2;
3441
- return remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
3442
- case 2:
3443
- _context2.n = 3;
3444
- return _this.host.hooks.lifecycle.initContainer.emit(_objectSpread2(_objectSpread2({}, initContainerOptions), {}, {
3445
- id: id,
3446
- remoteSnapshot: remoteSnapshot,
3447
- remoteEntryExports: remoteEntryExports
3448
- }));
3449
- case 3:
3450
- _this.inited = true;
3451
- case 4:
3452
- return _context2.a(2);
3453
- }
3454
- }, _callee2);
3455
- }))();
3456
- _context3.p = 5;
3457
- _context3.n = 6;
3458
- return this.initPromise;
3459
- case 6:
3460
- _context3.p = 6;
3461
- this.initing = false;
3462
- this.initPromise = undefined;
3463
- return _context3.f(6);
3464
- case 7:
3465
- return _context3.a(2, remoteEntryExports);
3466
- }
3467
- }, _callee3, this, [[5,, 6, 7]]);
3468
- }));
3469
- function init(_x9, _x0) {
3470
- return _init.apply(this, arguments);
3471
- }
3472
- return init;
3473
- }() // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
3474
- }, {
3475
- key: "get",
3476
- value: function () {
3477
- var _get = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(id, expose, options, remoteSnapshot) {
3478
- var _ref8, _ref8$loadFactory, loadFactory, remoteEntryExports, moduleFactory, symbolName, wrapModuleFactory, exposeContent;
3479
- return _regenerator().w(function (_context4) {
3480
- while (1) switch (_context4.n) {
3481
- case 0:
3482
- _ref8 = options || {
3483
- loadFactory: true
3484
- }, _ref8$loadFactory = _ref8.loadFactory, loadFactory = _ref8$loadFactory === void 0 ? true : _ref8$loadFactory;
3485
- _context4.n = 1;
3486
- return this.init(id, remoteSnapshot);
3487
- case 1:
3488
- remoteEntryExports = _context4.v;
3489
3244
  this.lib = remoteEntryExports;
3490
- _context4.n = 2;
3245
+ this.inited = true;
3246
+ _context2.n = 5;
3491
3247
  return this.host.loaderHook.lifecycle.getModuleFactory.emit({
3492
3248
  remoteEntryExports: remoteEntryExports,
3493
3249
  expose: expose,
3494
3250
  moduleInfo: this.remoteInfo
3495
3251
  });
3496
- case 2:
3497
- moduleFactory = _context4.v;
3252
+ case 5:
3253
+ moduleFactory = _context2.v;
3498
3254
  if (moduleFactory) {
3499
- _context4.n = 4;
3255
+ _context2.n = 7;
3500
3256
  break;
3501
3257
  }
3502
- _context4.n = 3;
3258
+ _context2.n = 6;
3503
3259
  return remoteEntryExports.get(expose);
3504
- case 3:
3505
- moduleFactory = _context4.v;
3506
- case 4:
3260
+ case 6:
3261
+ moduleFactory = _context2.v;
3262
+ case 7:
3507
3263
  assert(moduleFactory, "".concat(getFMId(this.remoteInfo), " remote don't export ").concat(expose, "."));
3508
3264
  // keep symbol for module name always one format
3509
3265
  symbolName = processModuleAlias(this.remoteInfo.name, expose);
3510
3266
  wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);
3511
3267
  if (loadFactory) {
3512
- _context4.n = 5;
3268
+ _context2.n = 8;
3513
3269
  break;
3514
3270
  }
3515
- return _context4.a(2, wrapModuleFactory);
3516
- case 5:
3517
- _context4.n = 6;
3271
+ return _context2.a(2, wrapModuleFactory);
3272
+ case 8:
3273
+ _context2.n = 9;
3518
3274
  return wrapModuleFactory();
3519
- case 6:
3520
- exposeContent = _context4.v;
3521
- return _context4.a(2, exposeContent);
3275
+ case 9:
3276
+ exposeContent = _context2.v;
3277
+ return _context2.a(2, exposeContent);
3522
3278
  }
3523
- }, _callee4, this);
3279
+ }, _callee2, this);
3524
3280
  }));
3525
- function get(_x1, _x10, _x11, _x12) {
3281
+ function get(_x9, _x0, _x1, _x10) {
3526
3282
  return _get.apply(this, arguments);
3527
3283
  }
3528
3284
  return get;
@@ -3539,20 +3295,20 @@ var Module = /*#__PURE__*/function () {
3539
3295
  }
3540
3296
  }
3541
3297
  if (moduleFactory instanceof Promise) {
3542
- return /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
3298
+ return /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
3543
3299
  var res;
3544
- return _regenerator().w(function (_context5) {
3545
- while (1) switch (_context5.n) {
3300
+ return _regenerator().w(function (_context3) {
3301
+ while (1) switch (_context3.n) {
3546
3302
  case 0:
3547
- _context5.n = 1;
3303
+ _context3.n = 1;
3548
3304
  return moduleFactory();
3549
3305
  case 1:
3550
- res = _context5.v;
3306
+ res = _context3.v;
3551
3307
  // This parameter is used for bridge debugging
3552
3308
  defineModuleId(res, id);
3553
- return _context5.a(2, res);
3309
+ return _context3.a(2, res);
3554
3310
  }
3555
- }, _callee5);
3311
+ }, _callee3);
3556
3312
  }));
3557
3313
  } else {
3558
3314
  return function () {
@@ -3589,8 +3345,8 @@ var SyncHook = /*#__PURE__*/function () {
3589
3345
  this.on(function wrapper() {
3590
3346
  self.remove(wrapper);
3591
3347
  // eslint-disable-next-line prefer-spread
3592
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
3593
- args[_key3] = arguments[_key3];
3348
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3349
+ args[_key2] = arguments[_key2];
3594
3350
  }
3595
3351
  return fn.apply(null, args);
3596
3352
  });
@@ -3598,8 +3354,8 @@ var SyncHook = /*#__PURE__*/function () {
3598
3354
  }, {
3599
3355
  key: "emit",
3600
3356
  value: function emit() {
3601
- for (var _len4 = arguments.length, data = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
3602
- data[_key4] = arguments[_key4];
3357
+ for (var _len3 = arguments.length, data = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
3358
+ data[_key3] = arguments[_key3];
3603
3359
  }
3604
3360
  var result;
3605
3361
  if (this.listeners.size > 0) {
@@ -3631,8 +3387,8 @@ var AsyncHook = /*#__PURE__*/function (_SyncHook) {
3631
3387
  return _createClass(AsyncHook, [{
3632
3388
  key: "emit",
3633
3389
  value: function emit() {
3634
- for (var _len5 = arguments.length, data = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
3635
- data[_key5] = arguments[_key5];
3390
+ for (var _len4 = arguments.length, data = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
3391
+ data[_key4] = arguments[_key4];
3636
3392
  }
3637
3393
  var result;
3638
3394
  var ls = Array.from(this.listeners);
@@ -3669,12 +3425,12 @@ function checkReturnData(originalData, returnedData) {
3669
3425
  }
3670
3426
  var SyncWaterfallHook = /*#__PURE__*/function (_SyncHook2) {
3671
3427
  function SyncWaterfallHook(type) {
3672
- var _this2;
3428
+ var _this;
3673
3429
  _classCallCheck(this, SyncWaterfallHook);
3674
- _this2 = _callSuper(this, SyncWaterfallHook);
3675
- _this2.onerror = error;
3676
- _this2.type = type;
3677
- return _this2;
3430
+ _this = _callSuper(this, SyncWaterfallHook);
3431
+ _this.onerror = error;
3432
+ _this.type = type;
3433
+ return _this;
3678
3434
  }
3679
3435
  _inherits(SyncWaterfallHook, _SyncHook2);
3680
3436
  return _createClass(SyncWaterfallHook, [{
@@ -3712,18 +3468,18 @@ var SyncWaterfallHook = /*#__PURE__*/function (_SyncHook2) {
3712
3468
  }(SyncHook);
3713
3469
  var AsyncWaterfallHook = /*#__PURE__*/function (_SyncHook3) {
3714
3470
  function AsyncWaterfallHook(type) {
3715
- var _this3;
3471
+ var _this2;
3716
3472
  _classCallCheck(this, AsyncWaterfallHook);
3717
- _this3 = _callSuper(this, AsyncWaterfallHook);
3718
- _this3.onerror = error;
3719
- _this3.type = type;
3720
- return _this3;
3473
+ _this2 = _callSuper(this, AsyncWaterfallHook);
3474
+ _this2.onerror = error;
3475
+ _this2.type = type;
3476
+ return _this2;
3721
3477
  }
3722
3478
  _inherits(AsyncWaterfallHook, _SyncHook3);
3723
3479
  return _createClass(AsyncWaterfallHook, [{
3724
3480
  key: "emit",
3725
3481
  value: function emit(data) {
3726
- var _this4 = this;
3482
+ var _this3 = this;
3727
3483
  if (!isObject(data)) {
3728
3484
  error("The response data for the \"".concat(this.type, "\" hook must be an object."));
3729
3485
  }
@@ -3732,7 +3488,7 @@ var AsyncWaterfallHook = /*#__PURE__*/function (_SyncHook3) {
3732
3488
  var i = 0;
3733
3489
  var processError = function processError(e) {
3734
3490
  warn(e);
3735
- _this4.onerror(e);
3491
+ _this3.onerror(e);
3736
3492
  return data;
3737
3493
  };
3738
3494
  var _call2 = function call(prevData) {
@@ -3746,7 +3502,7 @@ var AsyncWaterfallHook = /*#__PURE__*/function (_SyncHook3) {
3746
3502
  }
3747
3503
  }
3748
3504
  } else {
3749
- _this4.onerror("A plugin returned an incorrect value for the \"".concat(_this4.type, "\" type."));
3505
+ _this3.onerror("A plugin returned an incorrect value for the \"".concat(_this3.type, "\" type."));
3750
3506
  }
3751
3507
  return data;
3752
3508
  };
@@ -3766,7 +3522,7 @@ var PluginSystem = /*#__PURE__*/function () {
3766
3522
  return _createClass(PluginSystem, [{
3767
3523
  key: "applyPlugin",
3768
3524
  value: function applyPlugin(plugin, instance) {
3769
- var _this5 = this;
3525
+ var _this4 = this;
3770
3526
  assert(isPlainObject(plugin), 'Plugin configuration is invalid.');
3771
3527
  // The plugin's name is mandatory and must be unique
3772
3528
  var pluginName = plugin.name;
@@ -3778,7 +3534,7 @@ var PluginSystem = /*#__PURE__*/function () {
3778
3534
  Object.keys(this.lifecycle).forEach(function (key) {
3779
3535
  var pluginLife = plugin[key];
3780
3536
  if (pluginLife) {
3781
- _this5.lifecycle[key].on(pluginLife);
3537
+ _this4.lifecycle[key].on(pluginLife);
3782
3538
  }
3783
3539
  });
3784
3540
  }
@@ -3786,13 +3542,13 @@ var PluginSystem = /*#__PURE__*/function () {
3786
3542
  }, {
3787
3543
  key: "removePlugin",
3788
3544
  value: function removePlugin(pluginName) {
3789
- var _this6 = this;
3545
+ var _this5 = this;
3790
3546
  assert(pluginName, 'A name is required.');
3791
3547
  var plugin = this.registerPlugins[pluginName];
3792
3548
  assert(plugin, "The plugin \"".concat(pluginName, "\" is not registered."));
3793
3549
  Object.keys(plugin).forEach(function (key) {
3794
3550
  if (key !== 'name') {
3795
- _this6.lifecycle[key].remove(plugin[key]);
3551
+ _this5.lifecycle[key].remove(plugin[key]);
3796
3552
  }
3797
3553
  });
3798
3554
  }
@@ -3817,23 +3573,23 @@ function snapshotPlugin() {
3817
3573
  return {
3818
3574
  name: 'snapshot-plugin',
3819
3575
  afterResolve: function afterResolve(args) {
3820
- return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
3576
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
3821
3577
  var remote, pkgNameOrAlias, expose, origin, remoteInfo, id, _yield$origin$snapsho, remoteSnapshot, globalSnapshot, preloadOptions, assets;
3822
- return _regenerator().w(function (_context6) {
3823
- while (1) switch (_context6.n) {
3578
+ return _regenerator().w(function (_context4) {
3579
+ while (1) switch (_context4.n) {
3824
3580
  case 0:
3825
3581
  remote = args.remote, pkgNameOrAlias = args.pkgNameOrAlias, expose = args.expose, origin = args.origin, remoteInfo = args.remoteInfo, id = args.id;
3826
3582
  if (!(!isRemoteInfoWithEntry(remote) || !isPureRemoteEntry(remote))) {
3827
- _context6.n = 3;
3583
+ _context4.n = 3;
3828
3584
  break;
3829
3585
  }
3830
- _context6.n = 1;
3586
+ _context4.n = 1;
3831
3587
  return origin.snapshotHandler.loadRemoteSnapshotInfo({
3832
3588
  moduleInfo: remote,
3833
3589
  id: id
3834
3590
  });
3835
3591
  case 1:
3836
- _yield$origin$snapsho = _context6.v;
3592
+ _yield$origin$snapsho = _context4.v;
3837
3593
  remoteSnapshot = _yield$origin$snapsho.remoteSnapshot;
3838
3594
  globalSnapshot = _yield$origin$snapsho.globalSnapshot;
3839
3595
  assignRemoteInfo(remoteInfo, remoteSnapshot);
@@ -3848,7 +3604,7 @@ function snapshotPlugin() {
3848
3604
  depsRemote: false
3849
3605
  }
3850
3606
  };
3851
- _context6.n = 2;
3607
+ _context4.n = 2;
3852
3608
  return origin.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
3853
3609
  origin: origin,
3854
3610
  preloadOptions: preloadOptions,
@@ -3858,17 +3614,17 @@ function snapshotPlugin() {
3858
3614
  globalSnapshot: globalSnapshot
3859
3615
  });
3860
3616
  case 2:
3861
- assets = _context6.v;
3617
+ assets = _context4.v;
3862
3618
  if (assets) {
3863
3619
  preloadAssets(remoteInfo, origin, assets, false);
3864
3620
  }
3865
- return _context6.a(2, _objectSpread2(_objectSpread2({}, args), {}, {
3621
+ return _context4.a(2, _objectSpread2(_objectSpread2({}, args), {}, {
3866
3622
  remoteSnapshot: remoteSnapshot
3867
3623
  }));
3868
3624
  case 3:
3869
- return _context6.a(2, args);
3625
+ return _context4.a(2, args);
3870
3626
  }
3871
- }, _callee6);
3627
+ }, _callee4);
3872
3628
  }))();
3873
3629
  }
3874
3630
  };
@@ -3907,8 +3663,8 @@ function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot) {
3907
3663
  traverse(effectiveRemoteSnapshot, remoteInfo, isRoot);
3908
3664
  if (effectiveRemoteSnapshot.remotesInfo) {
3909
3665
  var remoteKeys = Object.keys(effectiveRemoteSnapshot.remotesInfo);
3910
- for (var _i7 = 0, _remoteKeys = remoteKeys; _i7 < _remoteKeys.length; _i7++) {
3911
- var key = _remoteKeys[_i7];
3666
+ for (var _i4 = 0, _remoteKeys = remoteKeys; _i4 < _remoteKeys.length; _i4++) {
3667
+ var key = _remoteKeys[_i4];
3912
3668
  if (memo[key]) {
3913
3669
  continue;
3914
3670
  }
@@ -4028,8 +3784,7 @@ function _generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot,
4028
3784
  }, true, memo, remoteSnapshot);
4029
3785
  if (remoteSnapshot.shared && remoteSnapshot.shared.length > 0) {
4030
3786
  var collectSharedAssets = function collectSharedAssets(shareInfo, snapshotShared) {
4031
- var _ref0 = getRegisteredShare(origin.shareScopeMap, snapshotShared.sharedName, shareInfo, origin.sharedHandler.hooks.lifecycle.resolveShare) || {},
4032
- registeredShared = _ref0.shared;
3787
+ var registeredShared = getRegisteredShare(origin.shareScopeMap, snapshotShared.sharedName, shareInfo, origin.sharedHandler.hooks.lifecycle.resolveShare);
4033
3788
  // If the global share does not exist, or the lib function does not exist, it means that the shared has not been loaded yet and can be preloaded.
4034
3789
  if (registeredShared && typeof registeredShared.lib === 'function') {
4035
3790
  snapshotShared.assets.js.sync.forEach(function (asset) {
@@ -4077,27 +3832,27 @@ var generatePreloadAssetsPlugin = function generatePreloadAssetsPlugin() {
4077
3832
  return {
4078
3833
  name: 'generate-preload-assets-plugin',
4079
3834
  generatePreloadAssets: function generatePreloadAssets(args) {
4080
- return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
3835
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
4081
3836
  var origin, preloadOptions, remoteInfo, remote, globalSnapshot, remoteSnapshot, assets;
4082
- return _regenerator().w(function (_context7) {
4083
- while (1) switch (_context7.n) {
3837
+ return _regenerator().w(function (_context5) {
3838
+ while (1) switch (_context5.n) {
4084
3839
  case 0:
4085
3840
  origin = args.origin, preloadOptions = args.preloadOptions, remoteInfo = args.remoteInfo, remote = args.remote, globalSnapshot = args.globalSnapshot, remoteSnapshot = args.remoteSnapshot;
4086
3841
  if (isBrowserEnv()) {
4087
- _context7.n = 1;
3842
+ _context5.n = 1;
4088
3843
  break;
4089
3844
  }
4090
- return _context7.a(2, {
3845
+ return _context5.a(2, {
4091
3846
  cssAssets: [],
4092
3847
  jsAssetsWithoutEntry: [],
4093
3848
  entryAssets: []
4094
3849
  });
4095
3850
  case 1:
4096
3851
  if (!(isRemoteInfoWithEntry(remote) && isPureRemoteEntry(remote))) {
4097
- _context7.n = 2;
3852
+ _context5.n = 2;
4098
3853
  break;
4099
3854
  }
4100
- return _context7.a(2, {
3855
+ return _context5.a(2, {
4101
3856
  cssAssets: [],
4102
3857
  jsAssetsWithoutEntry: [],
4103
3858
  entryAssets: [{
@@ -4115,9 +3870,9 @@ var generatePreloadAssetsPlugin = function generatePreloadAssetsPlugin() {
4115
3870
  case 2:
4116
3871
  assignRemoteInfo(remoteInfo, remoteSnapshot);
4117
3872
  assets = _generatePreloadAssets(origin, preloadOptions, remoteInfo, globalSnapshot, remoteSnapshot);
4118
- return _context7.a(2, assets);
3873
+ return _context5.a(2, assets);
4119
3874
  }
4120
- }, _callee7);
3875
+ }, _callee5);
4121
3876
  }))();
4122
3877
  }
4123
3878
  };
@@ -4167,14 +3922,14 @@ var SnapshotHandler = /*#__PURE__*/function () {
4167
3922
  return _createClass(SnapshotHandler, [{
4168
3923
  key: "loadRemoteSnapshotInfo",
4169
3924
  value: function () {
4170
- var _loadRemoteSnapshotInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(_ref1) {
3925
+ var _loadRemoteSnapshotInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref9) {
4171
3926
  var moduleInfo, id, options, hostSnapshot, _hostSnapshot, _this$getGlobalRemote, hostGlobalSnapshot, remoteSnapshot, globalSnapshot, _yield$this$hooks$lif, globalRemoteSnapshot, globalSnapshotRes, mSnapshot, gSnapshot, remoteEntry, moduleSnapshot, _globalSnapshotRes, _yield$this$hooks$lif2, remoteSnapshotRes, _moduleSnapshot, _globalSnapshotRes2, _yield$this$hooks$lif3, _remoteSnapshotRes;
4172
- return _regenerator().w(function (_context8) {
4173
- while (1) switch (_context8.n) {
3927
+ return _regenerator().w(function (_context6) {
3928
+ while (1) switch (_context6.n) {
4174
3929
  case 0:
4175
- moduleInfo = _ref1.moduleInfo, id = _ref1.id, _ref1.expose;
3930
+ moduleInfo = _ref9.moduleInfo, id = _ref9.id, _ref9.expose;
4176
3931
  options = this.HostInstance.options;
4177
- _context8.n = 1;
3932
+ _context6.n = 1;
4178
3933
  return this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
4179
3934
  options: options,
4180
3935
  moduleInfo: moduleInfo
@@ -4202,7 +3957,7 @@ var SnapshotHandler = /*#__PURE__*/function () {
4202
3957
  }
4203
3958
  }
4204
3959
  _this$getGlobalRemote = this.getGlobalRemoteInfo(moduleInfo), hostGlobalSnapshot = _this$getGlobalRemote.hostGlobalSnapshot, remoteSnapshot = _this$getGlobalRemote.remoteSnapshot, globalSnapshot = _this$getGlobalRemote.globalSnapshot;
4205
- _context8.n = 2;
3960
+ _context6.n = 2;
4206
3961
  return this.hooks.lifecycle.loadSnapshot.emit({
4207
3962
  options: options,
4208
3963
  moduleInfo: moduleInfo,
@@ -4211,22 +3966,22 @@ var SnapshotHandler = /*#__PURE__*/function () {
4211
3966
  globalSnapshot: globalSnapshot
4212
3967
  });
4213
3968
  case 2:
4214
- _yield$this$hooks$lif = _context8.v;
3969
+ _yield$this$hooks$lif = _context6.v;
4215
3970
  globalRemoteSnapshot = _yield$this$hooks$lif.remoteSnapshot;
4216
3971
  globalSnapshotRes = _yield$this$hooks$lif.globalSnapshot;
4217
3972
  if (!globalRemoteSnapshot) {
4218
- _context8.n = 7;
3973
+ _context6.n = 7;
4219
3974
  break;
4220
3975
  }
4221
3976
  if (!isManifestProvider(globalRemoteSnapshot)) {
4222
- _context8.n = 4;
3977
+ _context6.n = 4;
4223
3978
  break;
4224
3979
  }
4225
3980
  remoteEntry = isBrowserEnv() ? globalRemoteSnapshot.remoteEntry : globalRemoteSnapshot.ssrRemoteEntry || globalRemoteSnapshot.remoteEntry || '';
4226
- _context8.n = 3;
3981
+ _context6.n = 3;
4227
3982
  return this.getManifestJson(remoteEntry, moduleInfo, {});
4228
3983
  case 3:
4229
- moduleSnapshot = _context8.v;
3984
+ moduleSnapshot = _context6.v;
4230
3985
  // eslint-disable-next-line @typescript-eslint/no-shadow
4231
3986
  _globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(_objectSpread2(_objectSpread2({}, moduleInfo), {}, {
4232
3987
  // The global remote may be overridden
@@ -4235,10 +3990,10 @@ var SnapshotHandler = /*#__PURE__*/function () {
4235
3990
  }), moduleSnapshot);
4236
3991
  mSnapshot = moduleSnapshot;
4237
3992
  gSnapshot = _globalSnapshotRes;
4238
- _context8.n = 6;
3993
+ _context6.n = 6;
4239
3994
  break;
4240
3995
  case 4:
4241
- _context8.n = 5;
3996
+ _context6.n = 5;
4242
3997
  return this.hooks.lifecycle.loadRemoteSnapshot.emit({
4243
3998
  options: this.HostInstance.options,
4244
3999
  moduleInfo: moduleInfo,
@@ -4246,25 +4001,25 @@ var SnapshotHandler = /*#__PURE__*/function () {
4246
4001
  from: 'global'
4247
4002
  });
4248
4003
  case 5:
4249
- _yield$this$hooks$lif2 = _context8.v;
4004
+ _yield$this$hooks$lif2 = _context6.v;
4250
4005
  remoteSnapshotRes = _yield$this$hooks$lif2.remoteSnapshot;
4251
4006
  mSnapshot = remoteSnapshotRes;
4252
4007
  gSnapshot = globalSnapshotRes;
4253
4008
  case 6:
4254
- _context8.n = 11;
4009
+ _context6.n = 11;
4255
4010
  break;
4256
4011
  case 7:
4257
4012
  if (!isRemoteInfoWithEntry(moduleInfo)) {
4258
- _context8.n = 10;
4013
+ _context6.n = 10;
4259
4014
  break;
4260
4015
  }
4261
- _context8.n = 8;
4016
+ _context6.n = 8;
4262
4017
  return this.getManifestJson(moduleInfo.entry, moduleInfo, {});
4263
4018
  case 8:
4264
- _moduleSnapshot = _context8.v;
4019
+ _moduleSnapshot = _context6.v;
4265
4020
  // eslint-disable-next-line @typescript-eslint/no-shadow
4266
4021
  _globalSnapshotRes2 = setGlobalSnapshotInfoByModuleInfo(moduleInfo, _moduleSnapshot);
4267
- _context8.n = 9;
4022
+ _context6.n = 9;
4268
4023
  return this.hooks.lifecycle.loadRemoteSnapshot.emit({
4269
4024
  options: this.HostInstance.options,
4270
4025
  moduleInfo: moduleInfo,
@@ -4272,11 +4027,11 @@ var SnapshotHandler = /*#__PURE__*/function () {
4272
4027
  from: 'global'
4273
4028
  });
4274
4029
  case 9:
4275
- _yield$this$hooks$lif3 = _context8.v;
4030
+ _yield$this$hooks$lif3 = _context6.v;
4276
4031
  _remoteSnapshotRes = _yield$this$hooks$lif3.remoteSnapshot;
4277
4032
  mSnapshot = _remoteSnapshotRes;
4278
4033
  gSnapshot = _globalSnapshotRes2;
4279
- _context8.n = 11;
4034
+ _context6.n = 11;
4280
4035
  break;
4281
4036
  case 10:
4282
4037
  error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
@@ -4285,7 +4040,7 @@ var SnapshotHandler = /*#__PURE__*/function () {
4285
4040
  globalSnapshot: JSON.stringify(globalSnapshotRes)
4286
4041
  }));
4287
4042
  case 11:
4288
- _context8.n = 12;
4043
+ _context6.n = 12;
4289
4044
  return this.hooks.lifecycle.afterLoadSnapshot.emit({
4290
4045
  id: id,
4291
4046
  host: this.HostInstance,
@@ -4294,14 +4049,14 @@ var SnapshotHandler = /*#__PURE__*/function () {
4294
4049
  remoteSnapshot: mSnapshot
4295
4050
  });
4296
4051
  case 12:
4297
- return _context8.a(2, {
4052
+ return _context6.a(2, {
4298
4053
  remoteSnapshot: mSnapshot,
4299
4054
  globalSnapshot: gSnapshot
4300
4055
  });
4301
4056
  }
4302
- }, _callee8, this);
4057
+ }, _callee6, this);
4303
4058
  }));
4304
- function loadRemoteSnapshotInfo(_x13) {
4059
+ function loadRemoteSnapshotInfo(_x11) {
4305
4060
  return _loadRemoteSnapshotInfo.apply(this, arguments);
4306
4061
  }
4307
4062
  return loadRemoteSnapshotInfo;
@@ -4314,93 +4069,93 @@ var SnapshotHandler = /*#__PURE__*/function () {
4314
4069
  }, {
4315
4070
  key: "getManifestJson",
4316
4071
  value: function () {
4317
- var _getManifestJson = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(manifestUrl, moduleInfo, extraOptions) {
4318
- var _this7 = this;
4072
+ var _getManifestJson = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(manifestUrl, moduleInfo, extraOptions) {
4073
+ var _this6 = this;
4319
4074
  var getManifest, asyncLoadProcess;
4320
- return _regenerator().w(function (_context1) {
4321
- while (1) switch (_context1.n) {
4075
+ return _regenerator().w(function (_context9) {
4076
+ while (1) switch (_context9.n) {
4322
4077
  case 0:
4323
4078
  getManifest = /*#__PURE__*/function () {
4324
- var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
4079
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
4325
4080
  var manifestJson, res, _t;
4326
- return _regenerator().w(function (_context9) {
4327
- while (1) switch (_context9.p = _context9.n) {
4081
+ return _regenerator().w(function (_context7) {
4082
+ while (1) switch (_context7.p = _context7.n) {
4328
4083
  case 0:
4329
- manifestJson = _this7.manifestCache.get(manifestUrl);
4084
+ manifestJson = _this6.manifestCache.get(manifestUrl);
4330
4085
  if (!manifestJson) {
4331
- _context9.n = 1;
4086
+ _context7.n = 1;
4332
4087
  break;
4333
4088
  }
4334
- return _context9.a(2, manifestJson);
4089
+ return _context7.a(2, manifestJson);
4335
4090
  case 1:
4336
- _context9.p = 1;
4337
- _context9.n = 2;
4338
- return _this7.loaderHook.lifecycle.fetch.emit(manifestUrl, {});
4091
+ _context7.p = 1;
4092
+ _context7.n = 2;
4093
+ return _this6.loaderHook.lifecycle.fetch.emit(manifestUrl, {});
4339
4094
  case 2:
4340
- res = _context9.v;
4095
+ res = _context7.v;
4341
4096
  if (!(!res || !(res instanceof Response))) {
4342
- _context9.n = 4;
4097
+ _context7.n = 4;
4343
4098
  break;
4344
4099
  }
4345
- _context9.n = 3;
4100
+ _context7.n = 3;
4346
4101
  return fetch(manifestUrl, {});
4347
4102
  case 3:
4348
- res = _context9.v;
4103
+ res = _context7.v;
4349
4104
  case 4:
4350
- _context9.n = 5;
4105
+ _context7.n = 5;
4351
4106
  return res.json();
4352
4107
  case 5:
4353
- manifestJson = _context9.v;
4354
- _context9.n = 8;
4108
+ manifestJson = _context7.v;
4109
+ _context7.n = 8;
4355
4110
  break;
4356
4111
  case 6:
4357
- _context9.p = 6;
4358
- _t = _context9.v;
4359
- _context9.n = 7;
4360
- return _this7.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
4112
+ _context7.p = 6;
4113
+ _t = _context7.v;
4114
+ _context7.n = 7;
4115
+ return _this6.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
4361
4116
  id: manifestUrl,
4362
4117
  error: _t,
4363
4118
  from: 'runtime',
4364
4119
  lifecycle: 'afterResolve',
4365
- origin: _this7.HostInstance
4120
+ origin: _this6.HostInstance
4366
4121
  });
4367
4122
  case 7:
4368
- manifestJson = _context9.v;
4123
+ manifestJson = _context7.v;
4369
4124
  if (!manifestJson) {
4370
- delete _this7.manifestLoading[manifestUrl];
4125
+ delete _this6.manifestLoading[manifestUrl];
4371
4126
  error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
4372
4127
  manifestUrl: manifestUrl,
4373
4128
  moduleName: moduleInfo.name,
4374
- hostName: _this7.HostInstance.options.name
4129
+ hostName: _this6.HostInstance.options.name
4375
4130
  }, "".concat(_t)));
4376
4131
  }
4377
4132
  case 8:
4378
4133
  assert(manifestJson.metaData && manifestJson.exposes && manifestJson.shared, "".concat(manifestUrl, " is not a federation manifest"));
4379
- _this7.manifestCache.set(manifestUrl, manifestJson);
4380
- return _context9.a(2, manifestJson);
4134
+ _this6.manifestCache.set(manifestUrl, manifestJson);
4135
+ return _context7.a(2, manifestJson);
4381
4136
  }
4382
- }, _callee9, null, [[1, 6]]);
4137
+ }, _callee7, null, [[1, 6]]);
4383
4138
  }));
4384
4139
  return function getManifest() {
4385
- return _ref10.apply(this, arguments);
4140
+ return _ref0.apply(this, arguments);
4386
4141
  };
4387
4142
  }();
4388
4143
  asyncLoadProcess = /*#__PURE__*/function () {
4389
- var _ref11 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
4390
- var manifestJson, remoteSnapshot, _yield$_this7$hooks$l, remoteSnapshotRes;
4391
- return _regenerator().w(function (_context0) {
4392
- while (1) switch (_context0.n) {
4144
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
4145
+ var manifestJson, remoteSnapshot, _yield$_this6$hooks$l, remoteSnapshotRes;
4146
+ return _regenerator().w(function (_context8) {
4147
+ while (1) switch (_context8.n) {
4393
4148
  case 0:
4394
- _context0.n = 1;
4149
+ _context8.n = 1;
4395
4150
  return getManifest();
4396
4151
  case 1:
4397
- manifestJson = _context0.v;
4152
+ manifestJson = _context8.v;
4398
4153
  remoteSnapshot = generateSnapshotFromManifest(manifestJson, {
4399
4154
  version: manifestUrl
4400
4155
  });
4401
- _context0.n = 2;
4402
- return _this7.hooks.lifecycle.loadRemoteSnapshot.emit({
4403
- options: _this7.HostInstance.options,
4156
+ _context8.n = 2;
4157
+ return _this6.hooks.lifecycle.loadRemoteSnapshot.emit({
4158
+ options: _this6.HostInstance.options,
4404
4159
  moduleInfo: moduleInfo,
4405
4160
  manifestJson: manifestJson,
4406
4161
  remoteSnapshot: remoteSnapshot,
@@ -4408,14 +4163,14 @@ var SnapshotHandler = /*#__PURE__*/function () {
4408
4163
  from: 'manifest'
4409
4164
  });
4410
4165
  case 2:
4411
- _yield$_this7$hooks$l = _context0.v;
4412
- remoteSnapshotRes = _yield$_this7$hooks$l.remoteSnapshot;
4413
- return _context0.a(2, remoteSnapshotRes);
4166
+ _yield$_this6$hooks$l = _context8.v;
4167
+ remoteSnapshotRes = _yield$_this6$hooks$l.remoteSnapshot;
4168
+ return _context8.a(2, remoteSnapshotRes);
4414
4169
  }
4415
- }, _callee0);
4170
+ }, _callee8);
4416
4171
  }));
4417
4172
  return function asyncLoadProcess() {
4418
- return _ref11.apply(this, arguments);
4173
+ return _ref1.apply(this, arguments);
4419
4174
  };
4420
4175
  }();
4421
4176
  if (!this.manifestLoading[manifestUrl]) {
@@ -4423,11 +4178,11 @@ var SnapshotHandler = /*#__PURE__*/function () {
4423
4178
  return res;
4424
4179
  });
4425
4180
  }
4426
- return _context1.a(2, this.manifestLoading[manifestUrl]);
4181
+ return _context9.a(2, this.manifestLoading[manifestUrl]);
4427
4182
  }
4428
- }, _callee1, this);
4183
+ }, _callee9, this);
4429
4184
  }));
4430
- function getManifestJson(_x14, _x15, _x16) {
4185
+ function getManifestJson(_x12, _x13, _x14) {
4431
4186
  return _getManifestJson.apply(this, arguments);
4432
4187
  }
4433
4188
  return getManifestJson;
@@ -4438,7 +4193,6 @@ var SharedHandler = /*#__PURE__*/function () {
4438
4193
  function SharedHandler(host) {
4439
4194
  _classCallCheck(this, SharedHandler);
4440
4195
  this.hooks = new PluginSystem({
4441
- beforeRegisterShare: new SyncWaterfallHook('beforeRegisterShare'),
4442
4196
  afterResolve: new AsyncWaterfallHook('afterResolve'),
4443
4197
  beforeLoadShare: new AsyncWaterfallHook('beforeLoadShare'),
4444
4198
  // not used yet
@@ -4456,24 +4210,19 @@ var SharedHandler = /*#__PURE__*/function () {
4456
4210
  return _createClass(SharedHandler, [{
4457
4211
  key: "registerShared",
4458
4212
  value: function registerShared(globalOptions, userOptions) {
4459
- var _this8 = this;
4213
+ var _this7 = this;
4460
4214
  var _formatShareConfigs = formatShareConfigs(globalOptions, userOptions),
4461
- newShareInfos = _formatShareConfigs.newShareInfos,
4462
- allShareInfos = _formatShareConfigs.allShareInfos;
4463
- var sharedKeys = Object.keys(newShareInfos);
4215
+ shareInfos = _formatShareConfigs.shareInfos,
4216
+ shared = _formatShareConfigs.shared;
4217
+ var sharedKeys = Object.keys(shareInfos);
4464
4218
  sharedKeys.forEach(function (sharedKey) {
4465
- var sharedVals = newShareInfos[sharedKey];
4219
+ var sharedVals = shareInfos[sharedKey];
4466
4220
  sharedVals.forEach(function (sharedVal) {
4467
4221
  sharedVal.scope.forEach(function (sc) {
4468
- var _this8$shareScopeMap$;
4469
- _this8.hooks.lifecycle.beforeRegisterShare.emit({
4470
- origin: _this8.host,
4471
- pkgName: sharedKey,
4472
- shared: sharedVal
4473
- });
4474
- var registeredShared = (_this8$shareScopeMap$ = _this8.shareScopeMap[sc]) === null || _this8$shareScopeMap$ === void 0 ? void 0 : _this8$shareScopeMap$[sharedKey];
4222
+ var _this7$shareScopeMap$;
4223
+ var registeredShared = (_this7$shareScopeMap$ = _this7.shareScopeMap[sc]) === null || _this7$shareScopeMap$ === void 0 ? void 0 : _this7$shareScopeMap$[sharedKey];
4475
4224
  if (!registeredShared) {
4476
- _this8.setShared({
4225
+ _this7.setShared({
4477
4226
  pkgName: sharedKey,
4478
4227
  lib: sharedVal.lib,
4479
4228
  get: sharedVal.get,
@@ -4486,18 +4235,18 @@ var SharedHandler = /*#__PURE__*/function () {
4486
4235
  });
4487
4236
  });
4488
4237
  return {
4489
- newShareInfos: newShareInfos,
4490
- allShareInfos: allShareInfos
4238
+ shareInfos: shareInfos,
4239
+ shared: shared
4491
4240
  };
4492
4241
  }
4493
4242
  }, {
4494
4243
  key: "loadShare",
4495
4244
  value: function () {
4496
- var _loadShare = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(pkgName, extraOptions) {
4497
- var _this9 = this;
4498
- var host, shareOptions, loadShareRes, shareOptionsRes, _ref13, registeredShared, useTreesShaking, targetShared, factory, asyncLoadProcess, loading, _useTreeShaking, _targetShared, _asyncLoadProcess, _loading;
4499
- return _regenerator().w(function (_context13) {
4500
- while (1) switch (_context13.n) {
4245
+ var _loadShare = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(pkgName, extraOptions) {
4246
+ var _this8 = this;
4247
+ var host, shareOptions, loadShareRes, shareOptionsRes, registeredShared, addUseIn, factory, asyncLoadProcess, loading, _asyncLoadProcess, _loading;
4248
+ return _regenerator().w(function (_context11) {
4249
+ while (1) switch (_context11.n) {
4501
4250
  case 0:
4502
4251
  host = this.host; // This function performs the following steps:
4503
4252
  // 1. Checks if the currently loaded share already exists, if not, it throws an error
@@ -4509,30 +4258,30 @@ var SharedHandler = /*#__PURE__*/function () {
4509
4258
  shareInfos: host.options.shared
4510
4259
  });
4511
4260
  if (!(shareOptions !== null && shareOptions !== void 0 && shareOptions.scope)) {
4512
- _context13.n = 1;
4261
+ _context11.n = 1;
4513
4262
  break;
4514
4263
  }
4515
- _context13.n = 1;
4264
+ _context11.n = 1;
4516
4265
  return Promise.all(shareOptions.scope.map(/*#__PURE__*/function () {
4517
- var _ref12 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(shareScope) {
4518
- return _regenerator().w(function (_context10) {
4519
- while (1) switch (_context10.n) {
4266
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(shareScope) {
4267
+ return _regenerator().w(function (_context0) {
4268
+ while (1) switch (_context0.n) {
4520
4269
  case 0:
4521
- _context10.n = 1;
4522
- return Promise.all(_this9.initializeSharing(shareScope, {
4270
+ _context0.n = 1;
4271
+ return Promise.all(_this8.initializeSharing(shareScope, {
4523
4272
  strategy: shareOptions.strategy
4524
4273
  }));
4525
4274
  case 1:
4526
- return _context10.a(2);
4275
+ return _context0.a(2);
4527
4276
  }
4528
- }, _callee10);
4277
+ }, _callee0);
4529
4278
  }));
4530
- return function (_x19) {
4531
- return _ref12.apply(this, arguments);
4279
+ return function (_x17) {
4280
+ return _ref10.apply(this, arguments);
4532
4281
  };
4533
4282
  }()));
4534
4283
  case 1:
4535
- _context13.n = 2;
4284
+ _context11.n = 2;
4536
4285
  return this.hooks.lifecycle.beforeLoadShare.emit({
4537
4286
  pkgName: pkgName,
4538
4287
  shareInfo: shareOptions,
@@ -4540,56 +4289,62 @@ var SharedHandler = /*#__PURE__*/function () {
4540
4289
  origin: host
4541
4290
  });
4542
4291
  case 2:
4543
- loadShareRes = _context13.v;
4292
+ loadShareRes = _context11.v;
4544
4293
  shareOptionsRes = loadShareRes.shareInfo; // Assert that shareInfoRes exists, if not, throw an error
4545
4294
  assert(shareOptionsRes, "Cannot find ".concat(pkgName, " Share in the ").concat(host.options.name, ". Please ensure that the ").concat(pkgName, " Share parameters have been injected"));
4546
- _ref13 = getRegisteredShare(this.shareScopeMap, pkgName, shareOptionsRes, this.hooks.lifecycle.resolveShare) || {}, registeredShared = _ref13.shared, useTreesShaking = _ref13.useTreesShaking;
4547
- if (!registeredShared) {
4548
- _context13.n = 7;
4549
- break;
4550
- }
4551
- targetShared = directShare(registeredShared, useTreesShaking);
4552
- if (!targetShared.lib) {
4553
- _context13.n = 3;
4295
+ // Retrieve from cache
4296
+ registeredShared = getRegisteredShare(this.shareScopeMap, pkgName, shareOptionsRes, this.hooks.lifecycle.resolveShare);
4297
+ addUseIn = function addUseIn(shared) {
4298
+ if (!shared.useIn) {
4299
+ shared.useIn = [];
4300
+ }
4301
+ addUniqueItem(shared.useIn, host.options.name);
4302
+ };
4303
+ if (!(registeredShared && registeredShared.lib)) {
4304
+ _context11.n = 3;
4554
4305
  break;
4555
4306
  }
4556
- addUseIn(targetShared, host.options.name);
4557
- return _context13.a(2, targetShared.lib);
4307
+ addUseIn(registeredShared);
4308
+ return _context11.a(2, registeredShared.lib);
4558
4309
  case 3:
4559
- if (!(targetShared.loading && !targetShared.loaded)) {
4560
- _context13.n = 5;
4310
+ if (!(registeredShared && registeredShared.loading && !registeredShared.loaded)) {
4311
+ _context11.n = 5;
4561
4312
  break;
4562
4313
  }
4563
- _context13.n = 4;
4564
- return targetShared.loading;
4314
+ _context11.n = 4;
4315
+ return registeredShared.loading;
4565
4316
  case 4:
4566
- factory = _context13.v;
4567
- targetShared.loaded = true;
4568
- if (!targetShared.lib) {
4569
- targetShared.lib = factory;
4317
+ factory = _context11.v;
4318
+ registeredShared.loaded = true;
4319
+ if (!registeredShared.lib) {
4320
+ registeredShared.lib = factory;
4570
4321
  }
4571
- addUseIn(targetShared, host.options.name);
4572
- return _context13.a(2, factory);
4322
+ addUseIn(registeredShared);
4323
+ return _context11.a(2, factory);
4573
4324
  case 5:
4325
+ if (!registeredShared) {
4326
+ _context11.n = 6;
4327
+ break;
4328
+ }
4574
4329
  asyncLoadProcess = /*#__PURE__*/function () {
4575
- var _ref14 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
4330
+ var _ref11 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
4576
4331
  var factory;
4577
- return _regenerator().w(function (_context11) {
4578
- while (1) switch (_context11.n) {
4332
+ return _regenerator().w(function (_context1) {
4333
+ while (1) switch (_context1.n) {
4579
4334
  case 0:
4580
- _context11.n = 1;
4581
- return targetShared.get();
4335
+ _context1.n = 1;
4336
+ return registeredShared.get();
4582
4337
  case 1:
4583
- factory = _context11.v;
4584
- addUseIn(targetShared, host.options.name);
4585
- targetShared.loaded = true;
4586
- targetShared.lib = factory;
4587
- return _context11.a(2, factory);
4338
+ factory = _context1.v;
4339
+ addUseIn(registeredShared);
4340
+ registeredShared.loaded = true;
4341
+ registeredShared.lib = factory;
4342
+ return _context1.a(2, factory);
4588
4343
  }
4589
- }, _callee11);
4344
+ }, _callee1);
4590
4345
  }));
4591
4346
  return function asyncLoadProcess() {
4592
- return _ref14.apply(this, arguments);
4347
+ return _ref11.apply(this, arguments);
4593
4348
  };
4594
4349
  }();
4595
4350
  loading = asyncLoadProcess();
@@ -4599,48 +4354,41 @@ var SharedHandler = /*#__PURE__*/function () {
4599
4354
  shared: registeredShared,
4600
4355
  from: host.options.name,
4601
4356
  lib: null,
4602
- loading: loading,
4603
- treeShaking: useTreesShaking ? targetShared : undefined
4357
+ loading: loading
4604
4358
  });
4605
- return _context13.a(2, loading);
4359
+ return _context11.a(2, loading);
4606
4360
  case 6:
4607
- _context13.n = 9;
4608
- break;
4609
- case 7:
4610
4361
  if (!(extraOptions !== null && extraOptions !== void 0 && extraOptions.customShareInfo)) {
4611
- _context13.n = 8;
4362
+ _context11.n = 7;
4612
4363
  break;
4613
4364
  }
4614
- return _context13.a(2, false);
4615
- case 8:
4616
- _useTreeShaking = shouldUseTreeShaking(shareOptionsRes.treeShaking);
4617
- _targetShared = directShare(shareOptionsRes, _useTreeShaking);
4365
+ return _context11.a(2, false);
4366
+ case 7:
4618
4367
  _asyncLoadProcess = /*#__PURE__*/function () {
4619
- var _ref15 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
4620
- var factory, _ref16, gShared, gUseTreeShaking, targetGShared;
4621
- return _regenerator().w(function (_context12) {
4622
- while (1) switch (_context12.n) {
4368
+ var _ref12 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
4369
+ var factory, gShared;
4370
+ return _regenerator().w(function (_context10) {
4371
+ while (1) switch (_context10.n) {
4623
4372
  case 0:
4624
- _context12.n = 1;
4625
- return _targetShared.get();
4373
+ _context10.n = 1;
4374
+ return shareOptionsRes.get();
4626
4375
  case 1:
4627
- factory = _context12.v;
4628
- _targetShared.lib = factory;
4629
- _targetShared.loaded = true;
4630
- addUseIn(_targetShared, host.options.name);
4631
- _ref16 = getRegisteredShare(_this9.shareScopeMap, pkgName, shareOptionsRes, _this9.hooks.lifecycle.resolveShare) || {}, gShared = _ref16.shared, gUseTreeShaking = _ref16.useTreesShaking;
4376
+ factory = _context10.v;
4377
+ shareOptionsRes.lib = factory;
4378
+ shareOptionsRes.loaded = true;
4379
+ addUseIn(shareOptionsRes);
4380
+ gShared = getRegisteredShare(_this8.shareScopeMap, pkgName, shareOptionsRes, _this8.hooks.lifecycle.resolveShare);
4632
4381
  if (gShared) {
4633
- targetGShared = directShare(gShared, gUseTreeShaking);
4634
- targetGShared.lib = factory;
4635
- targetGShared.loaded = true;
4382
+ gShared.lib = factory;
4383
+ gShared.loaded = true;
4636
4384
  gShared.from = shareOptionsRes.from;
4637
4385
  }
4638
- return _context12.a(2, factory);
4386
+ return _context10.a(2, factory);
4639
4387
  }
4640
- }, _callee12);
4388
+ }, _callee10);
4641
4389
  }));
4642
4390
  return function _asyncLoadProcess() {
4643
- return _ref15.apply(this, arguments);
4391
+ return _ref12.apply(this, arguments);
4644
4392
  };
4645
4393
  }();
4646
4394
  _loading = _asyncLoadProcess();
@@ -4650,16 +4398,15 @@ var SharedHandler = /*#__PURE__*/function () {
4650
4398
  shared: shareOptionsRes,
4651
4399
  from: host.options.name,
4652
4400
  lib: null,
4653
- loading: _loading,
4654
- treeShaking: _useTreeShaking ? _targetShared : undefined
4401
+ loading: _loading
4655
4402
  });
4656
- return _context13.a(2, _loading);
4657
- case 9:
4658
- return _context13.a(2);
4403
+ return _context11.a(2, _loading);
4404
+ case 8:
4405
+ return _context11.a(2);
4659
4406
  }
4660
- }, _callee13, this);
4407
+ }, _callee11, this);
4661
4408
  }));
4662
- function loadShare(_x17, _x18) {
4409
+ function loadShare(_x15, _x16) {
4663
4410
  return _loadShare.apply(this, arguments);
4664
4411
  }
4665
4412
  return loadShare;
@@ -4704,37 +4451,43 @@ var SharedHandler = /*#__PURE__*/function () {
4704
4451
  eager = shared.eager;
4705
4452
  scope[name] = scope[name] || {};
4706
4453
  var versions = scope[name];
4707
- var activeVersion = versions[version] && directShare(versions[version]);
4708
- var activeVersionEager = Boolean(activeVersion && ('eager' in activeVersion && activeVersion.eager || 'shareConfig' in activeVersion && ((_activeVersion$shareC = activeVersion.shareConfig) === null || _activeVersion$shareC === void 0 ? void 0 : _activeVersion$shareC.eager)));
4709
- if (!activeVersion || activeVersion.strategy !== 'loaded-first' && !activeVersion.loaded && (Boolean(!eager) !== !activeVersionEager ? eager : hostName > versions[version].from)) {
4454
+ var activeVersion = versions[version];
4455
+ var activeVersionEager = Boolean(activeVersion && (activeVersion.eager || ((_activeVersion$shareC = activeVersion.shareConfig) === null || _activeVersion$shareC === void 0 ? void 0 : _activeVersion$shareC.eager)));
4456
+ if (!activeVersion || activeVersion.strategy !== 'loaded-first' && !activeVersion.loaded && (Boolean(!eager) !== !activeVersionEager ? eager : hostName > activeVersion.from)) {
4710
4457
  versions[version] = shared;
4711
4458
  }
4712
4459
  };
4460
+ var initFn = function initFn(mod) {
4461
+ return mod && mod.init && mod.init(shareScope[shareScopeName], initScope);
4462
+ };
4713
4463
  var initRemoteModule = /*#__PURE__*/function () {
4714
- var _ref17 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(key) {
4715
- var _yield$host$remoteHan, module, remoteEntryExports, _remoteEntryExports, _t2;
4716
- return _regenerator().w(function (_context14) {
4717
- while (1) switch (_context14.p = _context14.n) {
4464
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(key) {
4465
+ var _yield$host$remoteHan, module, remoteEntryExports, _t2;
4466
+ return _regenerator().w(function (_context12) {
4467
+ while (1) switch (_context12.p = _context12.n) {
4718
4468
  case 0:
4719
- _context14.n = 1;
4469
+ _context12.n = 1;
4720
4470
  return host.remoteHandler.getRemoteModuleAndOptions({
4721
4471
  id: key
4722
4472
  });
4723
4473
  case 1:
4724
- _yield$host$remoteHan = _context14.v;
4474
+ _yield$host$remoteHan = _context12.v;
4725
4475
  module = _yield$host$remoteHan.module;
4726
- remoteEntryExports = undefined;
4727
- _context14.p = 2;
4728
- _context14.n = 3;
4476
+ if (!module.getEntry) {
4477
+ _context12.n = 8;
4478
+ break;
4479
+ }
4480
+ _context12.p = 2;
4481
+ _context12.n = 3;
4729
4482
  return module.getEntry();
4730
4483
  case 3:
4731
- remoteEntryExports = _context14.v;
4732
- _context14.n = 6;
4484
+ remoteEntryExports = _context12.v;
4485
+ _context12.n = 6;
4733
4486
  break;
4734
4487
  case 4:
4735
- _context14.p = 4;
4736
- _t2 = _context14.v;
4737
- _context14.n = 5;
4488
+ _context12.p = 4;
4489
+ _t2 = _context12.v;
4490
+ _context12.n = 5;
4738
4491
  return host.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
4739
4492
  id: key,
4740
4493
  error: _t2,
@@ -4743,25 +4496,23 @@ var SharedHandler = /*#__PURE__*/function () {
4743
4496
  origin: host
4744
4497
  });
4745
4498
  case 5:
4746
- remoteEntryExports = _context14.v;
4499
+ remoteEntryExports = _context12.v;
4747
4500
  case 6:
4748
- _context14.p = 6;
4749
- if (!((_remoteEntryExports = remoteEntryExports) !== null && _remoteEntryExports !== void 0 && _remoteEntryExports.init)) {
4750
- _context14.n = 7;
4501
+ if (module.inited) {
4502
+ _context12.n = 8;
4751
4503
  break;
4752
4504
  }
4753
- module.remoteEntryExports = remoteEntryExports;
4754
- _context14.n = 7;
4755
- return module.init();
4505
+ _context12.n = 7;
4506
+ return initFn(remoteEntryExports);
4756
4507
  case 7:
4757
- return _context14.f(6);
4508
+ module.inited = true;
4758
4509
  case 8:
4759
- return _context14.a(2);
4510
+ return _context12.a(2);
4760
4511
  }
4761
- }, _callee14, null, [[2, 4, 6, 8]]);
4512
+ }, _callee12, null, [[2, 4]]);
4762
4513
  }));
4763
- return function initRemoteModule(_x20) {
4764
- return _ref17.apply(this, arguments);
4514
+ return function initRemoteModule(_x18) {
4515
+ return _ref13.apply(this, arguments);
4765
4516
  };
4766
4517
  }();
4767
4518
  Object.keys(host.options.shared).forEach(function (shareName) {
@@ -4789,7 +4540,7 @@ var SharedHandler = /*#__PURE__*/function () {
4789
4540
  }, {
4790
4541
  key: "loadShareSync",
4791
4542
  value: function loadShareSync(pkgName, extraOptions) {
4792
- var _this0 = this;
4543
+ var _this9 = this;
4793
4544
  var host = this.host;
4794
4545
  var shareOptions = getTargetSharedOptions({
4795
4546
  pkgName: pkgName,
@@ -4798,17 +4549,21 @@ var SharedHandler = /*#__PURE__*/function () {
4798
4549
  });
4799
4550
  if (shareOptions !== null && shareOptions !== void 0 && shareOptions.scope) {
4800
4551
  shareOptions.scope.forEach(function (shareScope) {
4801
- _this0.initializeSharing(shareScope, {
4552
+ _this9.initializeSharing(shareScope, {
4802
4553
  strategy: shareOptions.strategy
4803
4554
  });
4804
4555
  });
4805
4556
  }
4806
- var _ref18 = getRegisteredShare(this.shareScopeMap, pkgName, shareOptions, this.hooks.lifecycle.resolveShare) || {},
4807
- registeredShared = _ref18.shared;
4808
- _ref18.useTreesShaking;
4557
+ var registeredShared = getRegisteredShare(this.shareScopeMap, pkgName, shareOptions, this.hooks.lifecycle.resolveShare);
4558
+ var addUseIn = function addUseIn(shared) {
4559
+ if (!shared.useIn) {
4560
+ shared.useIn = [];
4561
+ }
4562
+ addUniqueItem(shared.useIn, host.options.name);
4563
+ };
4809
4564
  if (registeredShared) {
4810
4565
  if (typeof registeredShared.lib === 'function') {
4811
- addUseIn(registeredShared, host.options.name);
4566
+ addUseIn(registeredShared);
4812
4567
  if (!registeredShared.loaded) {
4813
4568
  registeredShared.loaded = true;
4814
4569
  if (registeredShared.from === host.options.name) {
@@ -4820,7 +4575,7 @@ var SharedHandler = /*#__PURE__*/function () {
4820
4575
  if (typeof registeredShared.get === 'function') {
4821
4576
  var module = registeredShared.get();
4822
4577
  if (!(module instanceof Promise)) {
4823
- addUseIn(registeredShared, host.options.name);
4578
+ addUseIn(registeredShared);
4824
4579
  this.setShared({
4825
4580
  pkgName: pkgName,
4826
4581
  loaded: true,
@@ -4878,49 +4633,48 @@ var SharedHandler = /*#__PURE__*/function () {
4878
4633
  }
4879
4634
  }, {
4880
4635
  key: "setShared",
4881
- value: function setShared(_ref19) {
4882
- var _this1 = this;
4883
- var pkgName = _ref19.pkgName,
4884
- shared = _ref19.shared,
4885
- from = _ref19.from,
4886
- lib = _ref19.lib,
4887
- loading = _ref19.loading,
4888
- loaded = _ref19.loaded,
4889
- get = _ref19.get,
4890
- treeShaking = _ref19.treeShaking;
4636
+ value: function setShared(_ref14) {
4637
+ var _this0 = this;
4638
+ var pkgName = _ref14.pkgName,
4639
+ shared = _ref14.shared,
4640
+ from = _ref14.from,
4641
+ lib = _ref14.lib,
4642
+ loading = _ref14.loading,
4643
+ loaded = _ref14.loaded,
4644
+ get = _ref14.get;
4891
4645
  var version = shared.version,
4892
4646
  _shared$scope = shared.scope,
4893
4647
  scope = _shared$scope === void 0 ? 'default' : _shared$scope,
4894
4648
  shareInfo = _objectWithoutProperties(shared, _excluded2);
4895
4649
  var scopes = Array.isArray(scope) ? scope : [scope];
4896
- var mergeAttrs = function mergeAttrs(shared) {
4897
- var merge = function merge(s, key, val) {
4898
- if (val && !s[key]) {
4899
- s[key] = val;
4900
- }
4901
- };
4902
- var targetShared = treeShaking ? shared.treeShaking : shared;
4903
- merge(targetShared, 'loaded', loaded);
4904
- merge(targetShared, 'loading', loading);
4905
- merge(targetShared, 'get', get);
4906
- };
4907
4650
  scopes.forEach(function (sc) {
4908
- if (!_this1.shareScopeMap[sc]) {
4909
- _this1.shareScopeMap[sc] = {};
4651
+ if (!_this0.shareScopeMap[sc]) {
4652
+ _this0.shareScopeMap[sc] = {};
4910
4653
  }
4911
- if (!_this1.shareScopeMap[sc][pkgName]) {
4912
- _this1.shareScopeMap[sc][pkgName] = {};
4654
+ if (!_this0.shareScopeMap[sc][pkgName]) {
4655
+ _this0.shareScopeMap[sc][pkgName] = {};
4913
4656
  }
4914
- if (!_this1.shareScopeMap[sc][pkgName][version]) {
4915
- _this1.shareScopeMap[sc][pkgName][version] = _objectSpread2(_objectSpread2({
4657
+ if (!_this0.shareScopeMap[sc][pkgName][version]) {
4658
+ _this0.shareScopeMap[sc][pkgName][version] = _objectSpread2(_objectSpread2({
4916
4659
  version: version,
4917
4660
  scope: [sc]
4918
4661
  }, shareInfo), {}, {
4919
- lib: lib
4662
+ lib: lib,
4663
+ loaded: loaded,
4664
+ loading: loading
4920
4665
  });
4666
+ if (get) {
4667
+ _this0.shareScopeMap[sc][pkgName][version].get = get;
4668
+ }
4669
+ return;
4670
+ }
4671
+ var registeredShared = _this0.shareScopeMap[sc][pkgName][version];
4672
+ if (loading && !registeredShared.loading) {
4673
+ registeredShared.loading = loading;
4674
+ }
4675
+ if (loaded && !registeredShared.loaded) {
4676
+ registeredShared.loaded = loaded;
4921
4677
  }
4922
- var registeredShared = _this1.shareScopeMap[sc][pkgName][version];
4923
- mergeAttrs(registeredShared);
4924
4678
  if (from && registeredShared.from !== from) {
4925
4679
  registeredShared.from = from;
4926
4680
  }
@@ -4951,7 +4705,6 @@ var RemoteHandler = /*#__PURE__*/function () {
4951
4705
  generatePreloadAssets: new AsyncHook('generatePreloadAssets'),
4952
4706
  // not used yet
4953
4707
  afterPreloadRemote: new AsyncHook(),
4954
- // TODO: Move to loaderHook
4955
4708
  loadEntry: new AsyncHook()
4956
4709
  });
4957
4710
  this.host = host;
@@ -4960,10 +4713,10 @@ var RemoteHandler = /*#__PURE__*/function () {
4960
4713
  return _createClass(RemoteHandler, [{
4961
4714
  key: "formatAndRegisterRemote",
4962
4715
  value: function formatAndRegisterRemote(globalOptions, userOptions) {
4963
- var _this10 = this;
4716
+ var _this1 = this;
4964
4717
  var userRemotes = userOptions.remotes || [];
4965
4718
  return userRemotes.reduce(function (res, remote) {
4966
- _this10.registerRemote(remote, res, {
4719
+ _this1.registerRemote(remote, res, {
4967
4720
  force: false
4968
4721
  });
4969
4722
  return res;
@@ -5001,37 +4754,37 @@ var RemoteHandler = /*#__PURE__*/function () {
5001
4754
  }, {
5002
4755
  key: "loadRemote",
5003
4756
  value: function () {
5004
- var _loadRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(id, options) {
5005
- var host, _ref20, _ref20$loadFactory, loadFactory, _yield$this$getRemote, module, moduleOptions, remoteMatchInfo, pkgNameOrAlias, remote, expose, idRes, remoteSnapshot, moduleOrFactory, moduleWrapper, _ref21, _ref21$from, from, failOver, _t3;
5006
- return _regenerator().w(function (_context15) {
5007
- while (1) switch (_context15.p = _context15.n) {
4757
+ var _loadRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(id, options) {
4758
+ var host, _ref15, _ref15$loadFactory, loadFactory, _yield$this$getRemote, module, moduleOptions, remoteMatchInfo, pkgNameOrAlias, remote, expose, idRes, remoteSnapshot, moduleOrFactory, moduleWrapper, _ref16, _ref16$from, from, failOver, _t3;
4759
+ return _regenerator().w(function (_context13) {
4760
+ while (1) switch (_context13.p = _context13.n) {
5008
4761
  case 0:
5009
4762
  host = this.host;
5010
- _context15.p = 1;
5011
- _ref20 = options || {
4763
+ _context13.p = 1;
4764
+ _ref15 = options || {
5012
4765
  loadFactory: true
5013
- }, _ref20$loadFactory = _ref20.loadFactory, loadFactory = _ref20$loadFactory === void 0 ? true : _ref20$loadFactory; // 1. Validate the parameters of the retrieved module. There are two module request methods: pkgName + expose and alias + expose.
4766
+ }, _ref15$loadFactory = _ref15.loadFactory, loadFactory = _ref15$loadFactory === void 0 ? true : _ref15$loadFactory; // 1. Validate the parameters of the retrieved module. There are two module request methods: pkgName + expose and alias + expose.
5014
4767
  // 2. Request the snapshot information of the current host and globally store the obtained snapshot information. The retrieved module information is partially offline and partially online. The online module information will retrieve the modules used online.
5015
4768
  // 3. Retrieve the detailed information of the current module from global (remoteEntry address, expose resource address)
5016
4769
  // 4. After retrieving remoteEntry, call the init of the module, and then retrieve the exported content of the module through get
5017
4770
  // id: pkgName(@federation/app1) + expose(button) = @federation/app1/button
5018
4771
  // id: alias(app1) + expose(button) = app1/button
5019
4772
  // id: alias(app1/utils) + expose(loadash/sort) = app1/utils/loadash/sort
5020
- _context15.n = 2;
4773
+ _context13.n = 2;
5021
4774
  return this.getRemoteModuleAndOptions({
5022
4775
  id: id
5023
4776
  });
5024
4777
  case 2:
5025
- _yield$this$getRemote = _context15.v;
4778
+ _yield$this$getRemote = _context13.v;
5026
4779
  module = _yield$this$getRemote.module;
5027
4780
  moduleOptions = _yield$this$getRemote.moduleOptions;
5028
4781
  remoteMatchInfo = _yield$this$getRemote.remoteMatchInfo;
5029
4782
  pkgNameOrAlias = remoteMatchInfo.pkgNameOrAlias, remote = remoteMatchInfo.remote, expose = remoteMatchInfo.expose, idRes = remoteMatchInfo.id, remoteSnapshot = remoteMatchInfo.remoteSnapshot;
5030
- _context15.n = 3;
4783
+ _context13.n = 3;
5031
4784
  return module.get(idRes, expose, options, remoteSnapshot);
5032
4785
  case 3:
5033
- moduleOrFactory = _context15.v;
5034
- _context15.n = 4;
4786
+ moduleOrFactory = _context13.v;
4787
+ _context13.n = 4;
5035
4788
  return this.hooks.lifecycle.onLoad.emit({
5036
4789
  id: idRes,
5037
4790
  pkgNameOrAlias: pkgNameOrAlias,
@@ -5044,22 +4797,22 @@ var RemoteHandler = /*#__PURE__*/function () {
5044
4797
  origin: host
5045
4798
  });
5046
4799
  case 4:
5047
- moduleWrapper = _context15.v;
4800
+ moduleWrapper = _context13.v;
5048
4801
  this.setIdToRemoteMap(id, remoteMatchInfo);
5049
4802
  if (!(typeof moduleWrapper === 'function')) {
5050
- _context15.n = 5;
4803
+ _context13.n = 5;
5051
4804
  break;
5052
4805
  }
5053
- return _context15.a(2, moduleWrapper);
4806
+ return _context13.a(2, moduleWrapper);
5054
4807
  case 5:
5055
- return _context15.a(2, moduleOrFactory);
4808
+ return _context13.a(2, moduleOrFactory);
5056
4809
  case 6:
5057
- _context15.p = 6;
5058
- _t3 = _context15.v;
5059
- _ref21 = options || {
4810
+ _context13.p = 6;
4811
+ _t3 = _context13.v;
4812
+ _ref16 = options || {
5060
4813
  from: 'runtime'
5061
- }, _ref21$from = _ref21.from, from = _ref21$from === void 0 ? 'runtime' : _ref21$from;
5062
- _context15.n = 7;
4814
+ }, _ref16$from = _ref16.from, from = _ref16$from === void 0 ? 'runtime' : _ref16$from;
4815
+ _context13.n = 7;
5063
4816
  return this.hooks.lifecycle.errorLoadRemote.emit({
5064
4817
  id: id,
5065
4818
  error: _t3,
@@ -5068,18 +4821,18 @@ var RemoteHandler = /*#__PURE__*/function () {
5068
4821
  origin: host
5069
4822
  });
5070
4823
  case 7:
5071
- failOver = _context15.v;
4824
+ failOver = _context13.v;
5072
4825
  if (failOver) {
5073
- _context15.n = 8;
4826
+ _context13.n = 8;
5074
4827
  break;
5075
4828
  }
5076
4829
  throw _t3;
5077
4830
  case 8:
5078
- return _context15.a(2, failOver);
4831
+ return _context13.a(2, failOver);
5079
4832
  }
5080
- }, _callee15, this, [[1, 6]]);
4833
+ }, _callee13, this, [[1, 6]]);
5081
4834
  }));
5082
- function loadRemote(_x21, _x22) {
4835
+ function loadRemote(_x19, _x20) {
5083
4836
  return _loadRemote.apply(this, arguments);
5084
4837
  }
5085
4838
  return loadRemote;
@@ -5087,14 +4840,14 @@ var RemoteHandler = /*#__PURE__*/function () {
5087
4840
  }, {
5088
4841
  key: "preloadRemote",
5089
4842
  value: function () {
5090
- var _preloadRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(preloadOptions) {
5091
- var _this11 = this;
4843
+ var _preloadRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(preloadOptions) {
4844
+ var _this10 = this;
5092
4845
  var host, preloadOps;
5093
- return _regenerator().w(function (_context17) {
5094
- while (1) switch (_context17.n) {
4846
+ return _regenerator().w(function (_context15) {
4847
+ while (1) switch (_context15.n) {
5095
4848
  case 0:
5096
4849
  host = this.host;
5097
- _context17.n = 1;
4850
+ _context15.n = 1;
5098
4851
  return this.hooks.lifecycle.beforePreloadRemote.emit({
5099
4852
  preloadOps: preloadOptions,
5100
4853
  options: host.options,
@@ -5102,25 +4855,25 @@ var RemoteHandler = /*#__PURE__*/function () {
5102
4855
  });
5103
4856
  case 1:
5104
4857
  preloadOps = formatPreloadArgs(host.options.remotes, preloadOptions);
5105
- _context17.n = 2;
4858
+ _context15.n = 2;
5106
4859
  return Promise.all(preloadOps.map(/*#__PURE__*/function () {
5107
- var _ref22 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(ops) {
4860
+ var _ref17 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(ops) {
5108
4861
  var remote, remoteInfo, _yield$host$snapshotH, globalSnapshot, remoteSnapshot, assets;
5109
- return _regenerator().w(function (_context16) {
5110
- while (1) switch (_context16.n) {
4862
+ return _regenerator().w(function (_context14) {
4863
+ while (1) switch (_context14.n) {
5111
4864
  case 0:
5112
4865
  remote = ops.remote;
5113
4866
  remoteInfo = getRemoteInfo(remote);
5114
- _context16.n = 1;
4867
+ _context14.n = 1;
5115
4868
  return host.snapshotHandler.loadRemoteSnapshotInfo({
5116
4869
  moduleInfo: remote
5117
4870
  });
5118
4871
  case 1:
5119
- _yield$host$snapshotH = _context16.v;
4872
+ _yield$host$snapshotH = _context14.v;
5120
4873
  globalSnapshot = _yield$host$snapshotH.globalSnapshot;
5121
4874
  remoteSnapshot = _yield$host$snapshotH.remoteSnapshot;
5122
- _context16.n = 2;
5123
- return _this11.hooks.lifecycle.generatePreloadAssets.emit({
4875
+ _context14.n = 2;
4876
+ return _this10.hooks.lifecycle.generatePreloadAssets.emit({
5124
4877
  origin: host,
5125
4878
  preloadOptions: ops,
5126
4879
  remote: remote,
@@ -5129,29 +4882,29 @@ var RemoteHandler = /*#__PURE__*/function () {
5129
4882
  remoteSnapshot: remoteSnapshot
5130
4883
  });
5131
4884
  case 2:
5132
- assets = _context16.v;
4885
+ assets = _context14.v;
5133
4886
  if (assets) {
5134
- _context16.n = 3;
4887
+ _context14.n = 3;
5135
4888
  break;
5136
4889
  }
5137
- return _context16.a(2);
4890
+ return _context14.a(2);
5138
4891
  case 3:
5139
4892
  preloadAssets(remoteInfo, host, assets);
5140
4893
  case 4:
5141
- return _context16.a(2);
4894
+ return _context14.a(2);
5142
4895
  }
5143
- }, _callee16);
4896
+ }, _callee14);
5144
4897
  }));
5145
- return function (_x24) {
5146
- return _ref22.apply(this, arguments);
4898
+ return function (_x22) {
4899
+ return _ref17.apply(this, arguments);
5147
4900
  };
5148
4901
  }()));
5149
4902
  case 2:
5150
- return _context17.a(2);
4903
+ return _context15.a(2);
5151
4904
  }
5152
- }, _callee17, this);
4905
+ }, _callee15, this);
5153
4906
  }));
5154
- function preloadRemote(_x23) {
4907
+ function preloadRemote(_x21) {
5155
4908
  return _preloadRemote.apply(this, arguments);
5156
4909
  }
5157
4910
  return preloadRemote;
@@ -5159,10 +4912,10 @@ var RemoteHandler = /*#__PURE__*/function () {
5159
4912
  }, {
5160
4913
  key: "registerRemotes",
5161
4914
  value: function registerRemotes(remotes, options) {
5162
- var _this12 = this;
4915
+ var _this11 = this;
5163
4916
  var host = this.host;
5164
4917
  remotes.forEach(function (remote) {
5165
- _this12.registerRemote(remote, host.options.remotes, {
4918
+ _this11.registerRemote(remote, host.options.remotes, {
5166
4919
  force: options === null || options === void 0 ? void 0 : options.force
5167
4920
  });
5168
4921
  });
@@ -5170,28 +4923,28 @@ var RemoteHandler = /*#__PURE__*/function () {
5170
4923
  }, {
5171
4924
  key: "getRemoteModuleAndOptions",
5172
4925
  value: function () {
5173
- var _getRemoteModuleAndOptions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(options) {
4926
+ var _getRemoteModuleAndOptions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(options) {
5174
4927
  var host, id, loadRemoteArgs, _loadRemoteArgs, idRes, remoteSplitInfo, rawRemote, remoteInfo, matchInfo, remote, expose, module, moduleOptions, _t4;
5175
- return _regenerator().w(function (_context18) {
5176
- while (1) switch (_context18.p = _context18.n) {
4928
+ return _regenerator().w(function (_context16) {
4929
+ while (1) switch (_context16.p = _context16.n) {
5177
4930
  case 0:
5178
4931
  host = this.host;
5179
4932
  id = options.id;
5180
- _context18.p = 1;
5181
- _context18.n = 2;
4933
+ _context16.p = 1;
4934
+ _context16.n = 2;
5182
4935
  return this.hooks.lifecycle.beforeRequest.emit({
5183
4936
  id: id,
5184
4937
  options: host.options,
5185
4938
  origin: host
5186
4939
  });
5187
4940
  case 2:
5188
- loadRemoteArgs = _context18.v;
5189
- _context18.n = 5;
4941
+ loadRemoteArgs = _context16.v;
4942
+ _context16.n = 5;
5190
4943
  break;
5191
4944
  case 3:
5192
- _context18.p = 3;
5193
- _t4 = _context18.v;
5194
- _context18.n = 4;
4945
+ _context16.p = 3;
4946
+ _t4 = _context16.v;
4947
+ _context16.n = 4;
5195
4948
  return this.hooks.lifecycle.errorLoadRemote.emit({
5196
4949
  id: id,
5197
4950
  options: host.options,
@@ -5201,9 +4954,9 @@ var RemoteHandler = /*#__PURE__*/function () {
5201
4954
  lifecycle: 'beforeRequest'
5202
4955
  });
5203
4956
  case 4:
5204
- loadRemoteArgs = _context18.v;
4957
+ loadRemoteArgs = _context16.v;
5205
4958
  if (loadRemoteArgs) {
5206
- _context18.n = 5;
4959
+ _context16.n = 5;
5207
4960
  break;
5208
4961
  }
5209
4962
  throw _t4;
@@ -5216,7 +4969,7 @@ var RemoteHandler = /*#__PURE__*/function () {
5216
4969
  }));
5217
4970
  rawRemote = remoteSplitInfo.remote;
5218
4971
  remoteInfo = getRemoteInfo(rawRemote);
5219
- _context18.n = 6;
4972
+ _context16.n = 6;
5220
4973
  return host.sharedHandler.hooks.lifecycle.afterResolve.emit(_objectSpread2(_objectSpread2({
5221
4974
  id: idRes
5222
4975
  }, remoteSplitInfo), {}, {
@@ -5225,7 +4978,7 @@ var RemoteHandler = /*#__PURE__*/function () {
5225
4978
  remoteInfo: remoteInfo
5226
4979
  }));
5227
4980
  case 6:
5228
- matchInfo = _context18.v;
4981
+ matchInfo = _context16.v;
5229
4982
  remote = matchInfo.remote, expose = matchInfo.expose;
5230
4983
  assert(remote && expose, "The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ".concat(idRes, "."));
5231
4984
  module = host.moduleCache.get(remote.name);
@@ -5237,15 +4990,15 @@ var RemoteHandler = /*#__PURE__*/function () {
5237
4990
  module = new Module(moduleOptions);
5238
4991
  host.moduleCache.set(remote.name, module);
5239
4992
  }
5240
- return _context18.a(2, {
4993
+ return _context16.a(2, {
5241
4994
  module: module,
5242
4995
  moduleOptions: moduleOptions,
5243
4996
  remoteMatchInfo: matchInfo
5244
4997
  });
5245
4998
  }
5246
- }, _callee18, this, [[1, 3]]);
4999
+ }, _callee16, this, [[1, 3]]);
5247
5000
  }));
5248
- function getRemoteModuleAndOptions(_x25) {
5001
+ function getRemoteModuleAndOptions(_x23) {
5249
5002
  return _getRemoteModuleAndOptions.apply(this, arguments);
5250
5003
  }
5251
5004
  return getRemoteModuleAndOptions;
@@ -5310,15 +5063,15 @@ var RemoteHandler = /*#__PURE__*/function () {
5310
5063
  key: "removeRemote",
5311
5064
  value: function removeRemote(remote) {
5312
5065
  try {
5313
- var host = this.host;
5066
+ var _host = this.host;
5314
5067
  var name = remote.name;
5315
- var remoteIndex = host.options.remotes.findIndex(function (item) {
5068
+ var remoteIndex = _host.options.remotes.findIndex(function (item) {
5316
5069
  return item.name === name;
5317
5070
  });
5318
5071
  if (remoteIndex !== -1) {
5319
- host.options.remotes.splice(remoteIndex, 1);
5072
+ _host.options.remotes.splice(remoteIndex, 1);
5320
5073
  }
5321
- var loadedModule = host.moduleCache.get(remote.name);
5074
+ var loadedModule = _host.moduleCache.get(remote.name);
5322
5075
  if (loadedModule) {
5323
5076
  var remoteInfo = loadedModule.remoteInfo;
5324
5077
  var key = remoteInfo.entryGlobalName;
@@ -5335,7 +5088,7 @@ var RemoteHandler = /*#__PURE__*/function () {
5335
5088
  if (globalLoading[remoteEntryUniqueKey]) {
5336
5089
  delete globalLoading[remoteEntryUniqueKey];
5337
5090
  }
5338
- host.snapshotHandler.manifestCache["delete"](remoteInfo.entry);
5091
+ _host.snapshotHandler.manifestCache["delete"](remoteInfo.entry);
5339
5092
  // delete unloaded shared and instance
5340
5093
  var remoteInsId = remoteInfo.buildVersion ? composeKeyWithSeparator(remoteInfo.name, remoteInfo.buildVersion) : remoteInfo.name;
5341
5094
  var remoteInsIndex = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(function (ins) {
@@ -5381,18 +5134,18 @@ var RemoteHandler = /*#__PURE__*/function () {
5381
5134
  remoteIns.shareScopeMap = {};
5382
5135
  delete globalShareScopeMap[remoteInsId];
5383
5136
  }
5384
- needDeleteKeys.forEach(function (_ref23) {
5137
+ needDeleteKeys.forEach(function (_ref18) {
5385
5138
  var _globalShareScopeMap$;
5386
- var _ref24 = _slicedToArray(_ref23, 4),
5387
- insId = _ref24[0],
5388
- shareScope = _ref24[1],
5389
- shareName = _ref24[2],
5390
- shareVersion = _ref24[3];
5139
+ var _ref19 = _slicedToArray(_ref18, 4),
5140
+ insId = _ref19[0],
5141
+ shareScope = _ref19[1],
5142
+ shareName = _ref19[2],
5143
+ shareVersion = _ref19[3];
5391
5144
  (_globalShareScopeMap$ = globalShareScopeMap[insId]) === null || _globalShareScopeMap$ === void 0 || (_globalShareScopeMap$ = _globalShareScopeMap$[shareScope]) === null || _globalShareScopeMap$ === void 0 || (_globalShareScopeMap$ = _globalShareScopeMap$[shareName]) === null || _globalShareScopeMap$ === void 0 || delete _globalShareScopeMap$[shareVersion];
5392
5145
  });
5393
5146
  CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(remoteInsIndex, 1);
5394
5147
  }
5395
- var _getGlobalRemoteInfo2 = _getGlobalRemoteInfo(remote, host),
5148
+ var _getGlobalRemoteInfo2 = _getGlobalRemoteInfo(remote, _host),
5396
5149
  hostGlobalSnapshot = _getGlobalRemoteInfo2.hostGlobalSnapshot;
5397
5150
  if (hostGlobalSnapshot) {
5398
5151
  var remoteKey = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && getInfoWithoutType(hostGlobalSnapshot.remotesInfo, remote.name).key;
@@ -5405,7 +5158,7 @@ var RemoteHandler = /*#__PURE__*/function () {
5405
5158
  }
5406
5159
  }
5407
5160
  }
5408
- host.moduleCache["delete"](remote.name);
5161
+ _host.moduleCache["delete"](remote.name);
5409
5162
  }
5410
5163
  } catch (err) {
5411
5164
  logger.log('removeRemote fail: ', err);
@@ -5425,7 +5178,7 @@ var ModuleFederation = /*#__PURE__*/function () {
5425
5178
  // maybe will change, temporarily for internal use only
5426
5179
  initContainer: new AsyncWaterfallHook('initContainer')
5427
5180
  });
5428
- this.version = "2.0.1";
5181
+ this.version = "0.21.6";
5429
5182
  this.moduleCache = new Map();
5430
5183
  this.loaderHook = new PluginSystem({
5431
5184
  // FIXME: may not be suitable , not open to the public yet
@@ -5473,15 +5226,15 @@ var ModuleFederation = /*#__PURE__*/function () {
5473
5226
  }, {
5474
5227
  key: "loadShare",
5475
5228
  value: function () {
5476
- var _loadShare2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(pkgName, extraOptions) {
5477
- return _regenerator().w(function (_context19) {
5478
- while (1) switch (_context19.n) {
5229
+ var _loadShare2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(pkgName, extraOptions) {
5230
+ return _regenerator().w(function (_context17) {
5231
+ while (1) switch (_context17.n) {
5479
5232
  case 0:
5480
- return _context19.a(2, this.sharedHandler.loadShare(pkgName, extraOptions));
5233
+ return _context17.a(2, this.sharedHandler.loadShare(pkgName, extraOptions));
5481
5234
  }
5482
- }, _callee19, this);
5235
+ }, _callee17, this);
5483
5236
  }));
5484
- function loadShare(_x26, _x27) {
5237
+ function loadShare(_x24, _x25) {
5485
5238
  return _loadShare2.apply(this, arguments);
5486
5239
  }
5487
5240
  return loadShare;
@@ -5521,15 +5274,15 @@ var ModuleFederation = /*#__PURE__*/function () {
5521
5274
  }, {
5522
5275
  key: "loadRemote",
5523
5276
  value: function () {
5524
- var _loadRemote2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(id, options) {
5525
- return _regenerator().w(function (_context20) {
5526
- while (1) switch (_context20.n) {
5277
+ var _loadRemote2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(id, options) {
5278
+ return _regenerator().w(function (_context18) {
5279
+ while (1) switch (_context18.n) {
5527
5280
  case 0:
5528
- return _context20.a(2, this.remoteHandler.loadRemote(id, options));
5281
+ return _context18.a(2, this.remoteHandler.loadRemote(id, options));
5529
5282
  }
5530
- }, _callee20, this);
5283
+ }, _callee18, this);
5531
5284
  }));
5532
- function loadRemote(_x28, _x29) {
5285
+ function loadRemote(_x26, _x27) {
5533
5286
  return _loadRemote2.apply(this, arguments);
5534
5287
  }
5535
5288
  return loadRemote;
@@ -5537,15 +5290,15 @@ var ModuleFederation = /*#__PURE__*/function () {
5537
5290
  }, {
5538
5291
  key: "preloadRemote",
5539
5292
  value: function () {
5540
- var _preloadRemote2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(preloadOptions) {
5541
- return _regenerator().w(function (_context21) {
5542
- while (1) switch (_context21.n) {
5293
+ var _preloadRemote2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(preloadOptions) {
5294
+ return _regenerator().w(function (_context19) {
5295
+ while (1) switch (_context19.n) {
5543
5296
  case 0:
5544
- return _context21.a(2, this.remoteHandler.preloadRemote(preloadOptions));
5297
+ return _context19.a(2, this.remoteHandler.preloadRemote(preloadOptions));
5545
5298
  }
5546
- }, _callee21, this);
5299
+ }, _callee19, this);
5547
5300
  }));
5548
- function preloadRemote(_x30) {
5301
+ function preloadRemote(_x28) {
5549
5302
  return _preloadRemote2.apply(this, arguments);
5550
5303
  }
5551
5304
  return preloadRemote;
@@ -5560,7 +5313,7 @@ var ModuleFederation = /*#__PURE__*/function () {
5560
5313
  key: "formatOptions",
5561
5314
  value: function formatOptions(globalOptions, userOptions) {
5562
5315
  var _formatShareConfigs2 = formatShareConfigs(globalOptions, userOptions),
5563
- shared = _formatShareConfigs2.allShareInfos;
5316
+ shared = _formatShareConfigs2.shared;
5564
5317
  var _this$hooks$lifecycle = this.hooks.lifecycle.beforeInit.emit({
5565
5318
  origin: this,
5566
5319
  userOptions: userOptions,
@@ -5571,7 +5324,7 @@ var ModuleFederation = /*#__PURE__*/function () {
5571
5324
  globalOptionsRes = _this$hooks$lifecycle.options;
5572
5325
  var remotes = this.remoteHandler.formatAndRegisterRemote(globalOptionsRes, userOptionsRes);
5573
5326
  var _this$sharedHandler$r = this.sharedHandler.registerShared(globalOptionsRes, userOptionsRes),
5574
- allShareInfos = _this$sharedHandler$r.allShareInfos;
5327
+ handledShared = _this$sharedHandler$r.shared;
5575
5328
  var plugins = _toConsumableArray(globalOptionsRes.plugins);
5576
5329
  if (userOptionsRes.plugins) {
5577
5330
  userOptionsRes.plugins.forEach(function (plugin) {
@@ -5583,7 +5336,7 @@ var ModuleFederation = /*#__PURE__*/function () {
5583
5336
  var optionsRes = _objectSpread2(_objectSpread2(_objectSpread2({}, globalOptions), userOptions), {}, {
5584
5337
  plugins: plugins,
5585
5338
  remotes: remotes,
5586
- shared: allShareInfos
5339
+ shared: handledShared
5587
5340
  });
5588
5341
  this.hooks.lifecycle.init.emit({
5589
5342
  origin: this,
@@ -5665,6 +5418,10 @@ function useActionEffect(params, deps, isExtReady = true) {
5665
5418
  if (isReady) {
5666
5419
  fetchRemoteOrigin();
5667
5420
  }
5421
+ else {
5422
+ // Set remote origin to local
5423
+ setRemoteOrigin(window.location.origin);
5424
+ }
5668
5425
  }, [isReady]);
5669
5426
  // Flush queued commands when isExtReady becomes true
5670
5427
  useEffect(() => {
@@ -5693,6 +5450,7 @@ function useActionEffect(params, deps, isExtReady = true) {
5693
5450
  const config = await pulseConfig.json();
5694
5451
  const actionInfo = config.actions?.find((action) => action.name === actionName);
5695
5452
  if (!actionInfo) {
5453
+ console.error(`Action ${actionName} not found in pulse.config.json`);
5696
5454
  throw new Error(`Action ${actionName} not found in pulse.config.json`);
5697
5455
  }
5698
5456
  return {
@@ -5726,7 +5484,14 @@ function useActionEffect(params, deps, isExtReady = true) {
5726
5484
  if (isExtReady && remoteOrigin) {
5727
5485
  updateAction();
5728
5486
  }
5729
- }, [params.actionName, imc, isExtReady, remoteOrigin, beforeAction, afterAction]);
5487
+ }, [
5488
+ params.actionName,
5489
+ imc,
5490
+ isExtReady,
5491
+ remoteOrigin,
5492
+ beforeAction,
5493
+ afterAction,
5494
+ ]);
5730
5495
  useEffect(() => {
5731
5496
  setBeforeAction(() => params.beforeAction ?? (async () => { }));
5732
5497
  setAfterAction(() => params.afterAction ?? (async () => { }));
@@ -5736,14 +5501,16 @@ function useActionEffect(params, deps, isExtReady = true) {
5736
5501
  if (!handler) {
5737
5502
  throw new Error("Action handler is not set");
5738
5503
  }
5504
+ let beforeRes;
5739
5505
  if (beforeAction) {
5740
- args = await beforeAction(args);
5506
+ beforeRes = await beforeAction(args);
5741
5507
  }
5742
- let res = await handler(args);
5508
+ let res = await handler(beforeRes !== undefined ? beforeRes : args);
5509
+ let afterRes;
5743
5510
  if (afterAction) {
5744
- res = await afterAction(res);
5511
+ afterRes = await afterAction(res);
5745
5512
  }
5746
- return res;
5513
+ return afterRes !== undefined ? afterRes : res;
5747
5514
  }
5748
5515
  function getReceiverHandlerMap(actionHandlerFunc) {
5749
5516
  const receiverHandlerMap = new Map([
@@ -5849,87 +5616,80 @@ function useTheme() {
5849
5616
  }
5850
5617
 
5851
5618
  function c(e, u, c, i) {
5852
- var l = this,
5853
- a = useRef(null),
5854
- o = useRef(0),
5619
+ var a = this,
5620
+ o = useRef(null),
5855
5621
  f = useRef(0),
5622
+ l = useRef(0),
5856
5623
  v = useRef(null),
5857
- d = useRef([]),
5858
- m = useRef(),
5859
- s = useRef(),
5860
- g = useRef(e),
5861
- h = useRef(true),
5862
- x = useRef(),
5863
- E = useRef();
5864
- g.current = e;
5865
- var b = "undefined" != typeof window,
5866
- p = !u && 0 !== u && b;
5624
+ m = useRef([]),
5625
+ d = useRef(),
5626
+ g = useRef(),
5627
+ p = useRef(e),
5628
+ w = useRef(true);
5629
+ p.current = e;
5630
+ var s = "undefined" != typeof window,
5631
+ x = !u && 0 !== u && s;
5867
5632
  if ("function" != typeof e) throw new TypeError("Expected a function");
5868
5633
  u = +u || 0;
5869
- var y = !!(c = c || {}).leading,
5870
- w = !("trailing" in c) || !!c.trailing,
5871
- O = !!c.flushOnExit && w,
5634
+ var h = !!(c = c || {}).leading,
5635
+ y = !("trailing" in c) || !!c.trailing,
5872
5636
  F = "maxWait" in c,
5873
- L = "debounceOnServer" in c && !!c.debounceOnServer,
5874
- A = F ? Math.max(+c.maxWait || 0, u) : null,
5875
- D = useMemo(function () {
5876
- var r = function r(_r) {
5877
- var n = d.current,
5878
- t = m.current;
5879
- return d.current = m.current = null, o.current = _r, f.current = f.current || _r, s.current = g.current.apply(t, n);
5880
- },
5881
- n = function n(r, _n) {
5882
- p && cancelAnimationFrame(v.current), v.current = p ? requestAnimationFrame(r) : setTimeout(r, _n);
5883
- },
5884
- t = function t(r) {
5885
- if (!h.current) return false;
5886
- var n = r - a.current;
5887
- return !a.current || n >= u || n < 0 || F && r - o.current >= A;
5888
- },
5889
- e = function e(n) {
5890
- return v.current = null, w && d.current ? r(n) : (d.current = m.current = null, s.current);
5891
- },
5892
- c = function r() {
5893
- var c = Date.now();
5894
- if (y && f.current === o.current && D(), t(c)) return e(c);
5895
- if (h.current) {
5896
- var i = u - (c - a.current),
5897
- l = F ? Math.min(i, A - (c - o.current)) : i;
5898
- n(r, l);
5899
- }
5900
- },
5901
- D = function D() {
5902
- },
5903
- S = function S() {
5904
- if (b || L) {
5905
- var e,
5906
- i = Date.now(),
5907
- f = t(i);
5908
- if (d.current = [].slice.call(arguments), m.current = l, a.current = i, O && !x.current && (x.current = function () {
5909
- var r;
5910
- "hidden" === (null == (r = global.document) ? void 0 : r.visibilityState) && E.current.flush();
5911
- }, null == (e = global.document) || null == e.addEventListener || e.addEventListener("visibilitychange", x.current)), f) {
5912
- if (!v.current && h.current) return o.current = a.current, n(c, u), y ? r(a.current) : s.current;
5913
- if (F) return n(c, u), r(a.current);
5914
- }
5915
- return v.current || n(c, u), s.current;
5916
- }
5917
- };
5918
- return S.cancel = function () {
5919
- var r = v.current;
5920
- r && (p ? cancelAnimationFrame(v.current) : clearTimeout(v.current)), o.current = 0, d.current = a.current = m.current = v.current = null;
5921
- }, S.isPending = function () {
5922
- return !!v.current;
5923
- }, S.flush = function () {
5924
- return v.current ? e(Date.now()) : s.current;
5925
- }, S;
5926
- }, [y, F, u, A, w, O, p, b, L, i]);
5927
- return E.current = D, useEffect(function () {
5928
- return h.current = true, function () {
5929
- var r;
5930
- O && E.current.flush(), x.current && (null == (r = global.document) || null == r.removeEventListener || r.removeEventListener("visibilitychange", x.current), x.current = null), h.current = false;
5637
+ A = "debounceOnServer" in c && !!c.debounceOnServer,
5638
+ D = F ? Math.max(+c.maxWait || 0, u) : null;
5639
+ useEffect(function () {
5640
+ return w.current = true, function () {
5641
+ w.current = false;
5931
5642
  };
5932
- }, [O]), D;
5643
+ }, []);
5644
+ var T = useMemo(function () {
5645
+ var r = function r(_r) {
5646
+ var n = m.current,
5647
+ t = d.current;
5648
+ return m.current = d.current = null, f.current = _r, l.current = l.current || _r, g.current = p.current.apply(t, n);
5649
+ },
5650
+ n = function n(r, _n) {
5651
+ x && cancelAnimationFrame(v.current), v.current = x ? requestAnimationFrame(r) : setTimeout(r, _n);
5652
+ },
5653
+ t = function t(r) {
5654
+ if (!w.current) return false;
5655
+ var n = r - o.current;
5656
+ return !o.current || n >= u || n < 0 || F && r - f.current >= D;
5657
+ },
5658
+ e = function e(n) {
5659
+ return v.current = null, y && m.current ? r(n) : (m.current = d.current = null, g.current);
5660
+ },
5661
+ c = function r() {
5662
+ var c = Date.now();
5663
+ if (h && l.current === f.current && T(), t(c)) return e(c);
5664
+ if (w.current) {
5665
+ var i = u - (c - o.current),
5666
+ a = F ? Math.min(i, D - (c - f.current)) : i;
5667
+ n(r, a);
5668
+ }
5669
+ },
5670
+ T = function T() {
5671
+ },
5672
+ W = function W() {
5673
+ if (s || A) {
5674
+ var e = Date.now(),
5675
+ i = t(e);
5676
+ if (m.current = [].slice.call(arguments), d.current = a, o.current = e, i) {
5677
+ if (!v.current && w.current) return f.current = o.current, n(c, u), h ? r(o.current) : g.current;
5678
+ if (F) return n(c, u), r(o.current);
5679
+ }
5680
+ return v.current || n(c, u), g.current;
5681
+ }
5682
+ };
5683
+ return W.cancel = function () {
5684
+ var r = v.current;
5685
+ r && (x ? cancelAnimationFrame(v.current) : clearTimeout(v.current)), f.current = 0, m.current = o.current = d.current = v.current = null;
5686
+ }, W.isPending = function () {
5687
+ return !!v.current;
5688
+ }, W.flush = function () {
5689
+ return v.current ? e(Date.now()) : g.current;
5690
+ }, W;
5691
+ }, [h, F, u, D, y, x, s, A, i]);
5692
+ return T;
5933
5693
  }
5934
5694
 
5935
5695
  /**