@module-federation/runtime 0.0.10 → 0.0.11

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.cjs.js CHANGED
@@ -263,7 +263,7 @@ let Module = class Module {
263
263
  remoteInfo: this.remoteInfo,
264
264
  origin: this.host
265
265
  });
266
- remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
266
+ await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
267
267
  await this.host.hooks.lifecycle.initContainer.emit(_extends$4({}, initContainerOptions, {
268
268
  remoteEntryExports
269
269
  }));
@@ -1402,7 +1402,7 @@ class FederationHost {
1402
1402
  const versions = scope[name];
1403
1403
  const activeVersion = versions[version];
1404
1404
  const activeVersionEager = Boolean(activeVersion && (activeVersion.eager || ((_activeVersion_shareConfig = activeVersion.shareConfig) == null ? void 0 : _activeVersion_shareConfig.eager)));
1405
- if (!activeVersion || !activeVersion.loaded && (Boolean(!eager) !== !activeVersionEager ? eager : hostName > activeVersion.from)) {
1405
+ if (!activeVersion || activeVersion.strategy !== 'loaded-first' && !activeVersion.loaded && (Boolean(!eager) !== !activeVersionEager ? eager : hostName > activeVersion.from)) {
1406
1406
  versions[version] = shared;
1407
1407
  }
1408
1408
  };
@@ -1579,7 +1579,7 @@ class FederationHost {
1579
1579
  // not used yet
1580
1580
  afterPreloadRemote: new AsyncHook()
1581
1581
  });
1582
- this.version = "0.0.10";
1582
+ this.version = "0.0.11";
1583
1583
  this.moduleCache = new Map();
1584
1584
  this.loaderHook = new PluginSystem({
1585
1585
  // FIXME: may not be suitable , not open to the public yet
package/dist/index.esm.js CHANGED
@@ -261,7 +261,7 @@ let Module = class Module {
261
261
  remoteInfo: this.remoteInfo,
262
262
  origin: this.host
263
263
  });
264
- remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
264
+ await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
265
265
  await this.host.hooks.lifecycle.initContainer.emit(_extends$4({}, initContainerOptions, {
266
266
  remoteEntryExports
267
267
  }));
@@ -1400,7 +1400,7 @@ class FederationHost {
1400
1400
  const versions = scope[name];
1401
1401
  const activeVersion = versions[version];
1402
1402
  const activeVersionEager = Boolean(activeVersion && (activeVersion.eager || ((_activeVersion_shareConfig = activeVersion.shareConfig) == null ? void 0 : _activeVersion_shareConfig.eager)));
1403
- if (!activeVersion || !activeVersion.loaded && (Boolean(!eager) !== !activeVersionEager ? eager : hostName > activeVersion.from)) {
1403
+ if (!activeVersion || activeVersion.strategy !== 'loaded-first' && !activeVersion.loaded && (Boolean(!eager) !== !activeVersionEager ? eager : hostName > activeVersion.from)) {
1404
1404
  versions[version] = shared;
1405
1405
  }
1406
1406
  };
@@ -1577,7 +1577,7 @@ class FederationHost {
1577
1577
  // not used yet
1578
1578
  afterPreloadRemote: new AsyncHook()
1579
1579
  });
1580
- this.version = "0.0.10";
1580
+ this.version = "0.0.11";
1581
1581
  this.moduleCache = new Map();
1582
1582
  this.loaderHook = new PluginSystem({
1583
1583
  // FIXME: may not be suitable , not open to the public yet
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
package/dist/share.cjs.js CHANGED
@@ -89,8 +89,13 @@ function _object_without_properties_loose(source, excluded) {
89
89
  }
90
90
  return target;
91
91
  }
92
- // export const nativeGlobal: typeof global = new Function('return this')();
93
- const nativeGlobal = new Function('return this')();
92
+ const nativeGlobal = (()=>{
93
+ try {
94
+ return new Function('return this')();
95
+ } catch (e) {
96
+ return globalThis;
97
+ }
98
+ })();
94
99
  const Global = nativeGlobal;
95
100
  function definePropertyGlobalVal(target, key, val) {
96
101
  Object.defineProperty(target, key, {
@@ -171,7 +176,7 @@ function getGlobalFederationConstructor() {
171
176
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
172
177
  if (isDebug) {
173
178
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
174
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.10";
179
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.11";
175
180
  }
176
181
  }
177
182
  // eslint-disable-next-line @typescript-eslint/ban-types
package/dist/share.esm.js CHANGED
@@ -87,8 +87,13 @@ function _object_without_properties_loose(source, excluded) {
87
87
  }
88
88
  return target;
89
89
  }
90
- // export const nativeGlobal: typeof global = new Function('return this')();
91
- const nativeGlobal = new Function('return this')();
90
+ const nativeGlobal = (()=>{
91
+ try {
92
+ return new Function('return this')();
93
+ } catch (e) {
94
+ return globalThis;
95
+ }
96
+ })();
92
97
  const Global = nativeGlobal;
93
98
  function definePropertyGlobalVal(target, key, val) {
94
99
  Object.defineProperty(target, key, {
@@ -169,7 +174,7 @@ function getGlobalFederationConstructor() {
169
174
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
170
175
  if (isDebug) {
171
176
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
172
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.10";
177
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.11";
173
178
  }
174
179
  }
175
180
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -95,6 +95,6 @@ export type RemoteEntryInitOptions = {
95
95
  export type InitScope = Array<Record<string, never>>;
96
96
  export type RemoteEntryExports = {
97
97
  get: (id: string) => () => Promise<Module>;
98
- init: (shareScope: ShareScopeMap[string], initScope?: InitScope, remoteEntryInitOPtions?: RemoteEntryInitOptions) => void;
98
+ init: (shareScope: ShareScopeMap[string], initScope?: InitScope, remoteEntryInitOPtions?: RemoteEntryInitOptions) => void | Promise<void>;
99
99
  };
100
100
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.esm.js",
@@ -45,6 +45,6 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@module-federation/sdk": "0.0.10"
48
+ "@module-federation/sdk": "0.0.11"
49
49
  }
50
50
  }