@module-federation/runtime 0.6.0 → 0.6.2

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/index.esm.js CHANGED
@@ -1,7 +1,8 @@
1
- import { g as getGlobalHostPlugins, a as globalLoading, D as DEFAULT_REMOTE_TYPE, b as DEFAULT_SCOPE, c as getRemoteEntryExports, d as assert, s as safeToString, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getRemoteEntryInfoFromSnapshot, m as isBrowserEnv$1, n as getInfoWithoutType, o as getPreloaded, p as setPreloaded, q as getRegisteredShare, r as arrayOptions, t as getGlobalSnapshotInfoByModuleInfo, u as addGlobalSnapshot, v as setGlobalSnapshotInfoByModuleInfo, G as Global, x as getGlobalSnapshot, y as formatShareConfigs, z as getTargetSharedOptions, A as getGlobalShareScope, B as addUniqueItem, C as getBuilderId, E as setGlobalFederationConstructor, F as getGlobalFederationInstance, H as getGlobalFederationConstructor, I as setGlobalFederationInstance } from './share.esm.js';
2
- export { J as registerGlobalPlugins } from './share.esm.js';
3
- import { isBrowserEnv, loadScriptNode, composeKeyWithSeparator, loadScript, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
1
+ import { _ as _extends, a as _object_without_properties_loose } from './polyfills.esm.js';
2
+ import { isBrowserEnv, loadScriptNode, composeKeyWithSeparator, loadScript, safeToString, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
4
3
  export { loadScript, loadScriptNode } from '@module-federation/sdk';
4
+ import { g as getGlobalHostPlugins, a as globalLoading, D as DEFAULT_REMOTE_TYPE, b as DEFAULT_SCOPE, c as getRemoteEntryExports, d as assert, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getRemoteEntryInfoFromSnapshot, m as getInfoWithoutType, n as getPreloaded, s as setPreloaded, o as getRegisteredShare, p as arrayOptions, q as getGlobalSnapshotInfoByModuleInfo, r as addGlobalSnapshot, t as setGlobalSnapshotInfoByModuleInfo, G as Global, u as getGlobalSnapshot, v as formatShareConfigs, x as getTargetSharedOptions, y as getGlobalShareScope, z as addUniqueItem, A as getBuilderId, B as setGlobalFederationConstructor, C as getGlobalFederationInstance, E as getGlobalFederationConstructor, F as setGlobalFederationInstance } from './share.esm.js';
5
+ export { H as registerGlobalPlugins } from './share.esm.js';
5
6
 
6
7
  // Function to match a remote with its name and expose
7
8
  // id: pkgName(@federation/app1) + expose(button) = @federation/app1/button
@@ -87,20 +88,6 @@ function registerPlugins$1(plugins, hookInstances) {
87
88
  return plugins;
88
89
  }
89
90
 
90
- function _extends$7() {
91
- _extends$7 = Object.assign || function(target) {
92
- for(var i = 1; i < arguments.length; i++){
93
- var source = arguments[i];
94
- for(var key in source){
95
- if (Object.prototype.hasOwnProperty.call(source, key)) {
96
- target[key] = source[key];
97
- }
98
- }
99
- }
100
- return target;
101
- };
102
- return _extends$7.apply(this, arguments);
103
- }
104
91
  async function loadEsmEntry({ entry, remoteEntryExports }) {
105
92
  return new Promise((resolve, reject)=>{
106
93
  try {
@@ -263,7 +250,7 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
263
250
  return globalLoading[uniqueKey];
264
251
  }
265
252
  function getRemoteInfo(remote) {
266
- return _extends$7({}, remote, {
253
+ return _extends({}, remote, {
267
254
  entry: 'entry' in remote ? remote.entry : '',
268
255
  type: remote.type || DEFAULT_REMOTE_TYPE,
269
256
  entryGlobalName: remote.entryGlobalName || remote.name,
@@ -271,20 +258,6 @@ function getRemoteInfo(remote) {
271
258
  });
272
259
  }
273
260
 
274
- function _extends$6() {
275
- _extends$6 = Object.assign || function(target) {
276
- for(var i = 1; i < arguments.length; i++){
277
- var source = arguments[i];
278
- for(var key in source){
279
- if (Object.prototype.hasOwnProperty.call(source, key)) {
280
- target[key] = source[key];
281
- }
282
- }
283
- }
284
- return target;
285
- };
286
- return _extends$6.apply(this, arguments);
287
- }
288
261
  let Module = class Module {
289
262
  async getEntry() {
290
263
  if (this.remoteEntryExports) {
@@ -336,7 +309,7 @@ let Module = class Module {
336
309
  console.error('The remote entry interface does not contain "init"', '\n', 'Ensure the name of this remote is not reserved or in use. Check if anything already exists on window[nameOfRemote]', '\n', 'Ensure that window[nameOfRemote] is returning a {get,init} object.');
337
310
  }
338
311
  await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
339
- await this.host.hooks.lifecycle.initContainer.emit(_extends$6({}, initContainerOptions, {
312
+ await this.host.hooks.lifecycle.initContainer.emit(_extends({}, initContainerOptions, {
340
313
  remoteEntryExports
341
314
  }));
342
315
  }
@@ -572,22 +545,8 @@ class PluginSystem {
572
545
  }
573
546
  }
574
547
 
575
- function _extends$5() {
576
- _extends$5 = Object.assign || function(target) {
577
- for(var i = 1; i < arguments.length; i++){
578
- var source = arguments[i];
579
- for(var key in source){
580
- if (Object.prototype.hasOwnProperty.call(source, key)) {
581
- target[key] = source[key];
582
- }
583
- }
584
- }
585
- return target;
586
- };
587
- return _extends$5.apply(this, arguments);
588
- }
589
548
  function defaultPreloadArgs(preloadConfig) {
590
- return _extends$5({
549
+ return _extends({
591
550
  resourceCategory: 'sync',
592
551
  share: true,
593
552
  depsRemote: true,
@@ -743,27 +702,13 @@ useLinkPreload = true) {
743
702
  }
744
703
  }
745
704
 
746
- function _extends$4() {
747
- _extends$4 = Object.assign || function(target) {
748
- for(var i = 1; i < arguments.length; i++){
749
- var source = arguments[i];
750
- for(var key in source){
751
- if (Object.prototype.hasOwnProperty.call(source, key)) {
752
- target[key] = source[key];
753
- }
754
- }
755
- }
756
- return target;
757
- };
758
- return _extends$4.apply(this, arguments);
759
- }
760
705
  function assignRemoteInfo(remoteInfo, remoteSnapshot) {
761
706
  const remoteEntryInfo = getRemoteEntryInfoFromSnapshot(remoteSnapshot);
762
707
  if (!remoteEntryInfo.url) {
763
708
  error(`The attribute remoteEntry of ${remoteInfo.name} must not be undefined.`);
764
709
  }
765
710
  let entryUrl = getResourceUrl(remoteSnapshot, remoteEntryInfo.url);
766
- if (!isBrowserEnv$1() && !entryUrl.startsWith('http')) {
711
+ if (!isBrowserEnv() && !entryUrl.startsWith('http')) {
767
712
  entryUrl = `https:${entryUrl}`;
768
713
  }
769
714
  remoteInfo.type = remoteEntryInfo.type;
@@ -804,7 +749,7 @@ function snapshotPlugin() {
804
749
  if (assets) {
805
750
  preloadAssets(remoteInfo, origin, assets, false);
806
751
  }
807
- return _extends$4({}, args, {
752
+ return _extends({}, args, {
808
753
  remoteSnapshot
809
754
  });
810
755
  }
@@ -1025,20 +970,6 @@ const generatePreloadAssetsPlugin = function() {
1025
970
  };
1026
971
  };
1027
972
 
1028
- function _extends$3() {
1029
- _extends$3 = Object.assign || function(target) {
1030
- for(var i = 1; i < arguments.length; i++){
1031
- var source = arguments[i];
1032
- for(var key in source){
1033
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1034
- target[key] = source[key];
1035
- }
1036
- }
1037
- }
1038
- return target;
1039
- };
1040
- return _extends$3.apply(this, arguments);
1041
- }
1042
973
  function getGlobalRemoteInfo(moduleInfo, origin) {
1043
974
  const hostGlobalSnapshot = getGlobalSnapshotInfoByModuleInfo({
1044
975
  name: origin.options.name,
@@ -1106,7 +1037,7 @@ class SnapshotHandler {
1106
1037
  // This ensures the snapshot's integrity and helps the chrome plugin correctly identify all producer modules, ensuring that proxyable producer modules will not be missing.
1107
1038
  if (hostSnapshot && 'remotesInfo' in hostSnapshot && !getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name).value) {
1108
1039
  if ('version' in moduleInfo || 'entry' in moduleInfo) {
1109
- hostSnapshot.remotesInfo = _extends$3({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
1040
+ hostSnapshot.remotesInfo = _extends({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
1110
1041
  [moduleInfo.name]: {
1111
1042
  matchedVersion: 'version' in moduleInfo ? moduleInfo.version : moduleInfo.entry
1112
1043
  }
@@ -1124,10 +1055,10 @@ class SnapshotHandler {
1124
1055
  // global snapshot includes manifest or module info includes manifest
1125
1056
  if (globalRemoteSnapshot) {
1126
1057
  if (isManifestProvider(globalRemoteSnapshot)) {
1127
- const remoteEntry = isBrowserEnv$1() ? globalRemoteSnapshot.remoteEntry : globalRemoteSnapshot.ssrRemoteEntry || globalRemoteSnapshot.remoteEntry || '';
1058
+ const remoteEntry = isBrowserEnv() ? globalRemoteSnapshot.remoteEntry : globalRemoteSnapshot.ssrRemoteEntry || globalRemoteSnapshot.remoteEntry || '';
1128
1059
  const moduleSnapshot = await this.getManifestJson(remoteEntry, moduleInfo, {});
1129
1060
  // eslint-disable-next-line @typescript-eslint/no-shadow
1130
- const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(_extends$3({}, moduleInfo, {
1061
+ const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(_extends({}, moduleInfo, {
1131
1062
  // The global remote may be overridden
1132
1063
  // Therefore, set the snapshot key to the global address of the actual request
1133
1064
  entry: remoteEntry
@@ -1233,32 +1164,6 @@ class SnapshotHandler {
1233
1164
  }
1234
1165
  }
1235
1166
 
1236
- function _extends$2() {
1237
- _extends$2 = Object.assign || function(target) {
1238
- for(var i = 1; i < arguments.length; i++){
1239
- var source = arguments[i];
1240
- for(var key in source){
1241
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1242
- target[key] = source[key];
1243
- }
1244
- }
1245
- }
1246
- return target;
1247
- };
1248
- return _extends$2.apply(this, arguments);
1249
- }
1250
- function _object_without_properties_loose(source, excluded) {
1251
- if (source == null) return {};
1252
- var target = {};
1253
- var sourceKeys = Object.keys(source);
1254
- var key, i;
1255
- for(i = 0; i < sourceKeys.length; i++){
1256
- key = sourceKeys[i];
1257
- if (excluded.indexOf(key) >= 0) continue;
1258
- target[key] = source[key];
1259
- }
1260
- return target;
1261
- }
1262
1167
  class SharedHandler {
1263
1168
  // register shared in shareScopeMap
1264
1169
  registerShared(globalOptions, userOptions) {
@@ -1564,21 +1469,25 @@ class SharedHandler {
1564
1469
  if (!this.shareScopeMap[sc][pkgName]) {
1565
1470
  this.shareScopeMap[sc][pkgName] = {};
1566
1471
  }
1567
- if (this.shareScopeMap[sc][pkgName][version]) {
1472
+ if (!this.shareScopeMap[sc][pkgName][version]) {
1473
+ this.shareScopeMap[sc][pkgName][version] = _extends({
1474
+ version,
1475
+ scope: [
1476
+ 'default'
1477
+ ]
1478
+ }, shareInfo, {
1479
+ lib,
1480
+ loaded,
1481
+ loading
1482
+ });
1483
+ if (get) {
1484
+ this.shareScopeMap[sc][pkgName][version].get = get;
1485
+ }
1568
1486
  return;
1569
1487
  }
1570
- this.shareScopeMap[sc][pkgName][version] = _extends$2({
1571
- version,
1572
- scope: [
1573
- 'default'
1574
- ]
1575
- }, shareInfo, {
1576
- lib,
1577
- loaded,
1578
- loading
1579
- });
1580
- if (get) {
1581
- this.shareScopeMap[sc][pkgName][version].get = get;
1488
+ const registeredShared = this.shareScopeMap[sc][pkgName][version];
1489
+ if (loading && !registeredShared.loading) {
1490
+ registeredShared.loading = loading;
1582
1491
  }
1583
1492
  });
1584
1493
  }
@@ -1606,20 +1515,6 @@ class SharedHandler {
1606
1515
  }
1607
1516
  }
1608
1517
 
1609
- function _extends$1() {
1610
- _extends$1 = Object.assign || function(target) {
1611
- for(var i = 1; i < arguments.length; i++){
1612
- var source = arguments[i];
1613
- for(var key in source){
1614
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1615
- target[key] = source[key];
1616
- }
1617
- }
1618
- }
1619
- return target;
1620
- };
1621
- return _extends$1.apply(this, arguments);
1622
- }
1623
1518
  class RemoteHandler {
1624
1519
  formatAndRegisterRemote(globalOptions, userOptions) {
1625
1520
  const userRemotes = userOptions.remotes || [];
@@ -1776,7 +1671,7 @@ class RemoteHandler {
1776
1671
  `);
1777
1672
  const { remote: rawRemote } = remoteSplitInfo;
1778
1673
  const remoteInfo = getRemoteInfo(rawRemote);
1779
- const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
1674
+ const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends({
1780
1675
  id: idRes
1781
1676
  }, remoteSplitInfo, {
1782
1677
  options: host.options,
@@ -1945,7 +1840,8 @@ class RemoteHandler {
1945
1840
  const remoteKey = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && getInfoWithoutType(hostGlobalSnapshot.remotesInfo, remote.name).key;
1946
1841
  if (remoteKey) {
1947
1842
  delete hostGlobalSnapshot.remotesInfo[remoteKey];
1948
- if (Boolean(Global.__FEDERATION__.__MANIFEST_LOADING__[remoteKey])) {
1843
+ if (//eslint-disable-next-line no-extra-boolean-cast
1844
+ Boolean(Global.__FEDERATION__.__MANIFEST_LOADING__[remoteKey])) {
1949
1845
  delete Global.__FEDERATION__.__MANIFEST_LOADING__[remoteKey];
1950
1846
  }
1951
1847
  }
@@ -1975,20 +1871,6 @@ class RemoteHandler {
1975
1871
  }
1976
1872
  }
1977
1873
 
1978
- function _extends() {
1979
- _extends = Object.assign || function(target) {
1980
- for(var i = 1; i < arguments.length; i++){
1981
- var source = arguments[i];
1982
- for(var key in source){
1983
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1984
- target[key] = source[key];
1985
- }
1986
- }
1987
- }
1988
- return target;
1989
- };
1990
- return _extends.apply(this, arguments);
1991
- }
1992
1874
  class FederationHost {
1993
1875
  initOptions(userOptions) {
1994
1876
  this.registerPlugins(userOptions.plugins);
@@ -2094,7 +1976,7 @@ class FederationHost {
2094
1976
  // maybe will change, temporarily for internal use only
2095
1977
  initContainer: new AsyncWaterfallHook('initContainer')
2096
1978
  });
2097
- this.version = "0.6.0";
1979
+ this.version = "0.6.2";
2098
1980
  this.moduleCache = new Map();
2099
1981
  this.loaderHook = new PluginSystem({
2100
1982
  // FIXME: may not be suitable , not open to the public yet
@@ -2115,7 +1997,7 @@ class FederationHost {
2115
1997
  ],
2116
1998
  remotes: [],
2117
1999
  shared: {},
2118
- inBrowser: isBrowserEnv$1()
2000
+ inBrowser: isBrowserEnv()
2119
2001
  };
2120
2002
  this.name = userOptions.name;
2121
2003
  this.options = defaultOptions;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
@@ -29,10 +29,10 @@
29
29
  "import": "./dist/types.esm.js",
30
30
  "require": "./dist/types.cjs.js"
31
31
  },
32
- "./retry-plugin": {
33
- "types": "./dist/retry-plugin.cjs.d.ts",
34
- "import": "./dist/retry-plugin.esm.js",
35
- "require": "./dist/retry-plugin.cjs.js"
32
+ "./embedded": {
33
+ "types": "./dist/embedded.cjs.d.ts",
34
+ "import": "./dist/embedded.esm.js",
35
+ "require": "./dist/embedded.cjs.js"
36
36
  },
37
37
  "./*": "./*"
38
38
  },
@@ -46,9 +46,6 @@
46
46
  ],
47
47
  "types": [
48
48
  "./dist/types.cjs.d.ts"
49
- ],
50
- "retry-plugin": [
51
- "./dist/retry-plugin.cjs.d.ts"
52
49
  ]
53
50
  }
54
51
  },
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ function _extends() {
4
+ _extends = Object.assign || function assign(target) {
5
+ for(var i = 1; i < arguments.length; i++){
6
+ var source = arguments[i];
7
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
8
+ }
9
+ return target;
10
+ };
11
+ return _extends.apply(this, arguments);
12
+ }
13
+
14
+ function _object_without_properties_loose(source, excluded) {
15
+ if (source == null) return {};
16
+ var target = {};
17
+ var sourceKeys = Object.keys(source);
18
+ var key, i;
19
+ for(i = 0; i < sourceKeys.length; i++){
20
+ key = sourceKeys[i];
21
+ if (excluded.indexOf(key) >= 0) continue;
22
+ target[key] = source[key];
23
+ }
24
+ return target;
25
+ }
26
+
27
+ exports._extends = _extends;
28
+ exports._object_without_properties_loose = _object_without_properties_loose;
@@ -0,0 +1,25 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function assign(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
6
+ }
7
+ return target;
8
+ };
9
+ return _extends.apply(this, arguments);
10
+ }
11
+
12
+ function _object_without_properties_loose(source, excluded) {
13
+ if (source == null) return {};
14
+ var target = {};
15
+ var sourceKeys = Object.keys(source);
16
+ var key, i;
17
+ for(i = 0; i < sourceKeys.length; i++){
18
+ key = sourceKeys[i];
19
+ if (excluded.indexOf(key) >= 0) continue;
20
+ target[key] = source[key];
21
+ }
22
+ return target;
23
+ }
24
+
25
+ export { _extends as _, _object_without_properties_loose as a };
package/dist/share.cjs.js CHANGED
@@ -1,15 +1,12 @@
1
1
  'use strict';
2
2
 
3
+ var polyfills = require('./polyfills.cjs.js');
4
+ var sdk = require('@module-federation/sdk');
5
+
3
6
  function getBuilderId() {
4
7
  //@ts-ignore
5
8
  return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' ? FEDERATION_BUILD_IDENTIFIER : '';
6
9
  }
7
- function isDebugMode() {
8
- return Boolean("");
9
- }
10
- function isBrowserEnv() {
11
- return typeof window !== 'undefined';
12
- }
13
10
 
14
11
  const LOG_CATEGORY = '[ Federation Runtime ]';
15
12
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@@ -55,14 +52,6 @@ function isRemoteInfoWithEntry(remote) {
55
52
  function isPureRemoteEntry(remote) {
56
53
  return !remote.entry.includes('.json') && remote.entry.includes('.js');
57
54
  }
58
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
59
- function safeToString(info) {
60
- try {
61
- return JSON.stringify(info, null, 2);
62
- } catch (e) {
63
- return '';
64
- }
65
- }
66
55
  function isObject(val) {
67
56
  return val && typeof val === 'object';
68
57
  }
@@ -82,7 +71,7 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
82
71
  type: 'global',
83
72
  globalName: ''
84
73
  };
85
- if (isBrowserEnv()) {
74
+ if (sdk.isBrowserEnv()) {
86
75
  return 'remoteEntry' in snapshot ? {
87
76
  url: snapshot.remoteEntry,
88
77
  type: snapshot.remoteEntryType,
@@ -99,32 +88,6 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
99
88
  return defaultRemoteEntryInfo;
100
89
  }
101
90
 
102
- function _extends$1() {
103
- _extends$1 = Object.assign || function(target) {
104
- for(var i = 1; i < arguments.length; i++){
105
- var source = arguments[i];
106
- for(var key in source){
107
- if (Object.prototype.hasOwnProperty.call(source, key)) {
108
- target[key] = source[key];
109
- }
110
- }
111
- }
112
- return target;
113
- };
114
- return _extends$1.apply(this, arguments);
115
- }
116
- function _object_without_properties_loose(source, excluded) {
117
- if (source == null) return {};
118
- var target = {};
119
- var sourceKeys = Object.keys(source);
120
- var key, i;
121
- for(i = 0; i < sourceKeys.length; i++){
122
- key = sourceKeys[i];
123
- if (excluded.indexOf(key) >= 0) continue;
124
- target[key] = source[key];
125
- }
126
- return target;
127
- }
128
91
  const nativeGlobal = (()=>{
129
92
  try {
130
93
  return new Function('return this')();
@@ -209,10 +172,10 @@ function setGlobalFederationInstance(FederationInstance) {
209
172
  function getGlobalFederationConstructor() {
210
173
  return globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
211
174
  }
212
- function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
175
+ function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
213
176
  if (isDebug) {
214
177
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
215
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.0";
178
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.2";
216
179
  }
217
180
  }
218
181
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -260,7 +223,7 @@ const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot)=>{
260
223
  }
261
224
  // If the remote is not included in the hostSnapshot, deploy a micro app snapshot
262
225
  if ('version' in moduleInfo && moduleInfo['version']) {
263
- const { version } = moduleInfo, resModuleInfo = _object_without_properties_loose(moduleInfo, [
226
+ const { version } = moduleInfo, resModuleInfo = polyfills._object_without_properties_loose(moduleInfo, [
264
227
  "version"
265
228
  ]);
266
229
  const moduleKeyWithoutVersion = getFMId(resModuleInfo);
@@ -278,7 +241,7 @@ const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
278
241
  return nativeGlobal.__FEDERATION__.moduleInfo;
279
242
  };
280
243
  const addGlobalSnapshot = (moduleInfos)=>{
281
- nativeGlobal.__FEDERATION__.moduleInfo = _extends$1({}, nativeGlobal.__FEDERATION__.moduleInfo, moduleInfos);
244
+ nativeGlobal.__FEDERATION__.moduleInfo = polyfills._extends({}, nativeGlobal.__FEDERATION__.moduleInfo, moduleInfos);
282
245
  return ()=>{
283
246
  const keys = Object.keys(moduleInfos);
284
247
  for (const key of keys){
@@ -671,20 +634,6 @@ function satisfy(version, range) {
671
634
  return true;
672
635
  }
673
636
 
674
- function _extends() {
675
- _extends = Object.assign || function(target) {
676
- for(var i = 1; i < arguments.length; i++){
677
- var source = arguments[i];
678
- for(var key in source){
679
- if (Object.prototype.hasOwnProperty.call(source, key)) {
680
- target[key] = source[key];
681
- }
682
- }
683
- }
684
- return target;
685
- };
686
- return _extends.apply(this, arguments);
687
- }
688
637
  function formatShare(shareArgs, from, name, shareStrategy) {
689
638
  let get;
690
639
  if ('get' in shareArgs) {
@@ -701,13 +650,13 @@ function formatShare(shareArgs, from, name, shareStrategy) {
701
650
  warn(`"shared.strategy is deprecated, please set in initOptions.shareStrategy instead!"`);
702
651
  }
703
652
  var _shareArgs_version, _shareArgs_scope, _shareArgs_strategy;
704
- return _extends({
653
+ return polyfills._extends({
705
654
  deps: [],
706
655
  useIn: [],
707
656
  from,
708
657
  loading: null
709
658
  }, shareArgs, {
710
- shareConfig: _extends({
659
+ shareConfig: polyfills._extends({
711
660
  requiredVersion: `^${shareArgs.version}`,
712
661
  singleton: false,
713
662
  eager: false,
@@ -733,7 +682,7 @@ function formatShareConfigs(globalOptions, userOptions) {
733
682
  });
734
683
  return res;
735
684
  }, {});
736
- const shared = _extends({}, globalOptions.shared);
685
+ const shared = polyfills._extends({}, globalOptions.shared);
737
686
  Object.keys(shareInfos).forEach((shareKey)=>{
738
687
  if (!shared[shareKey]) {
739
688
  shared[shareKey] = shareInfos[shareKey];
@@ -922,7 +871,6 @@ exports.getRemoteEntryInfoFromSnapshot = getRemoteEntryInfoFromSnapshot;
922
871
  exports.getTargetSharedOptions = getTargetSharedOptions;
923
872
  exports.getTargetSnapshotInfoByModuleInfo = getTargetSnapshotInfoByModuleInfo;
924
873
  exports.globalLoading = globalLoading;
925
- exports.isBrowserEnv = isBrowserEnv;
926
874
  exports.isObject = isObject;
927
875
  exports.isPlainObject = isPlainObject;
928
876
  exports.isPureRemoteEntry = isPureRemoteEntry;
@@ -930,7 +878,6 @@ exports.isRemoteInfoWithEntry = isRemoteInfoWithEntry;
930
878
  exports.nativeGlobal = nativeGlobal;
931
879
  exports.registerGlobalPlugins = registerGlobalPlugins;
932
880
  exports.resetFederationGlobalInfo = resetFederationGlobalInfo;
933
- exports.safeToString = safeToString;
934
881
  exports.setGlobalFederationConstructor = setGlobalFederationConstructor;
935
882
  exports.setGlobalFederationInstance = setGlobalFederationInstance;
936
883
  exports.setGlobalSnapshotInfoByModuleInfo = setGlobalSnapshotInfoByModuleInfo;
package/dist/share.esm.js CHANGED
@@ -1,13 +1,10 @@
1
+ import { a as _object_without_properties_loose, _ as _extends } from './polyfills.esm.js';
2
+ import { isBrowserEnv, isDebugMode } from '@module-federation/sdk';
3
+
1
4
  function getBuilderId() {
2
5
  //@ts-ignore
3
6
  return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' ? FEDERATION_BUILD_IDENTIFIER : '';
4
7
  }
5
- function isDebugMode() {
6
- return Boolean("");
7
- }
8
- function isBrowserEnv() {
9
- return typeof window !== 'undefined';
10
- }
11
8
 
12
9
  const LOG_CATEGORY = '[ Federation Runtime ]';
13
10
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@@ -53,14 +50,6 @@ function isRemoteInfoWithEntry(remote) {
53
50
  function isPureRemoteEntry(remote) {
54
51
  return !remote.entry.includes('.json') && remote.entry.includes('.js');
55
52
  }
56
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
57
- function safeToString(info) {
58
- try {
59
- return JSON.stringify(info, null, 2);
60
- } catch (e) {
61
- return '';
62
- }
63
- }
64
53
  function isObject(val) {
65
54
  return val && typeof val === 'object';
66
55
  }
@@ -97,32 +86,6 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
97
86
  return defaultRemoteEntryInfo;
98
87
  }
99
88
 
100
- function _extends$1() {
101
- _extends$1 = Object.assign || function(target) {
102
- for(var i = 1; i < arguments.length; i++){
103
- var source = arguments[i];
104
- for(var key in source){
105
- if (Object.prototype.hasOwnProperty.call(source, key)) {
106
- target[key] = source[key];
107
- }
108
- }
109
- }
110
- return target;
111
- };
112
- return _extends$1.apply(this, arguments);
113
- }
114
- function _object_without_properties_loose(source, excluded) {
115
- if (source == null) return {};
116
- var target = {};
117
- var sourceKeys = Object.keys(source);
118
- var key, i;
119
- for(i = 0; i < sourceKeys.length; i++){
120
- key = sourceKeys[i];
121
- if (excluded.indexOf(key) >= 0) continue;
122
- target[key] = source[key];
123
- }
124
- return target;
125
- }
126
89
  const nativeGlobal = (()=>{
127
90
  try {
128
91
  return new Function('return this')();
@@ -210,7 +173,7 @@ function getGlobalFederationConstructor() {
210
173
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
211
174
  if (isDebug) {
212
175
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
213
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.0";
176
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.2";
214
177
  }
215
178
  }
216
179
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -276,7 +239,7 @@ const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
276
239
  return nativeGlobal.__FEDERATION__.moduleInfo;
277
240
  };
278
241
  const addGlobalSnapshot = (moduleInfos)=>{
279
- nativeGlobal.__FEDERATION__.moduleInfo = _extends$1({}, nativeGlobal.__FEDERATION__.moduleInfo, moduleInfos);
242
+ nativeGlobal.__FEDERATION__.moduleInfo = _extends({}, nativeGlobal.__FEDERATION__.moduleInfo, moduleInfos);
280
243
  return ()=>{
281
244
  const keys = Object.keys(moduleInfos);
282
245
  for (const key of keys){
@@ -669,20 +632,6 @@ function satisfy(version, range) {
669
632
  return true;
670
633
  }
671
634
 
672
- function _extends() {
673
- _extends = Object.assign || function(target) {
674
- for(var i = 1; i < arguments.length; i++){
675
- var source = arguments[i];
676
- for(var key in source){
677
- if (Object.prototype.hasOwnProperty.call(source, key)) {
678
- target[key] = source[key];
679
- }
680
- }
681
- }
682
- return target;
683
- };
684
- return _extends.apply(this, arguments);
685
- }
686
635
  function formatShare(shareArgs, from, name, shareStrategy) {
687
636
  let get;
688
637
  if ('get' in shareArgs) {
@@ -895,4 +844,4 @@ function getTargetSharedOptions(options) {
895
844
  return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
896
845
  }
897
846
 
898
- export { getGlobalShareScope as A, addUniqueItem as B, getBuilderId as C, DEFAULT_REMOTE_TYPE as D, setGlobalFederationConstructor as E, getGlobalFederationInstance as F, Global as G, getGlobalFederationConstructor as H, setGlobalFederationInstance as I, registerGlobalPlugins as J, nativeGlobal as K, resetFederationGlobalInfo as L, getTargetSnapshotInfoByModuleInfo as M, globalLoading as a, DEFAULT_SCOPE as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getRemoteEntryInfoFromSnapshot as l, isBrowserEnv as m, getInfoWithoutType as n, getPreloaded as o, setPreloaded as p, getRegisteredShare as q, arrayOptions as r, safeToString as s, getGlobalSnapshotInfoByModuleInfo as t, addGlobalSnapshot as u, setGlobalSnapshotInfoByModuleInfo as v, warn as w, getGlobalSnapshot as x, formatShareConfigs as y, getTargetSharedOptions as z };
847
+ export { getBuilderId as A, setGlobalFederationConstructor as B, getGlobalFederationInstance as C, DEFAULT_REMOTE_TYPE as D, getGlobalFederationConstructor as E, setGlobalFederationInstance as F, Global as G, registerGlobalPlugins as H, nativeGlobal as I, resetFederationGlobalInfo as J, getTargetSnapshotInfoByModuleInfo as K, globalLoading as a, DEFAULT_SCOPE as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getRemoteEntryInfoFromSnapshot as l, getInfoWithoutType as m, getPreloaded as n, getRegisteredShare as o, arrayOptions as p, getGlobalSnapshotInfoByModuleInfo as q, addGlobalSnapshot as r, setPreloaded as s, setGlobalSnapshotInfoByModuleInfo as t, getGlobalSnapshot as u, formatShareConfigs as v, warn as w, getTargetSharedOptions as x, getGlobalShareScope as y, addUniqueItem as z };