@module-federation/runtime 0.7.5 → 0.7.7

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
@@ -93,7 +93,14 @@ async function loadEsmEntry({ entry, remoteEntryExports }) {
93
93
  return new Promise((resolve, reject)=>{
94
94
  try {
95
95
  if (!remoteEntryExports) {
96
- import(/* webpackIgnore: true */ entry).then(resolve).catch(reject);
96
+ if (typeof FEDERATION_ALLOW_NEW_FUNCTION !== 'undefined') {
97
+ new Function('callbacks', `import("${entry}").then(callbacks[0]).catch(callbacks[1])`)([
98
+ resolve,
99
+ reject
100
+ ]);
101
+ } else {
102
+ import(/* webpackIgnore: true */ /* @vite-ignore */ entry).then(resolve).catch(reject);
103
+ }
97
104
  } else {
98
105
  resolve(remoteEntryExports);
99
106
  }
@@ -228,7 +235,6 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
228
235
  }
229
236
  if (!share.globalLoading[uniqueKey]) {
230
237
  const loadEntryHook = origin.remoteHandler.hooks.lifecycle.loadEntry;
231
- origin.loaderHook.lifecycle.createScript;
232
238
  const loaderHook = origin.loaderHook;
233
239
  share.globalLoading[uniqueKey] = loadEntryHook.emit({
234
240
  loaderHook,
@@ -2008,7 +2014,7 @@ class FederationHost {
2008
2014
  // maybe will change, temporarily for internal use only
2009
2015
  initContainer: new AsyncWaterfallHook('initContainer')
2010
2016
  });
2011
- this.version = "0.7.5";
2017
+ this.version = "0.7.7";
2012
2018
  this.moduleCache = new Map();
2013
2019
  this.loaderHook = new PluginSystem({
2014
2020
  // FIXME: may not be suitable , not open to the public yet
@@ -93,7 +93,14 @@ async function loadEsmEntry({ entry, remoteEntryExports }) {
93
93
  return new Promise((resolve, reject)=>{
94
94
  try {
95
95
  if (!remoteEntryExports) {
96
- import(/* webpackIgnore: true */ entry).then(resolve).catch(reject);
96
+ if (typeof FEDERATION_ALLOW_NEW_FUNCTION !== 'undefined') {
97
+ new Function('callbacks', `import("${entry}").then(callbacks[0]).catch(callbacks[1])`)([
98
+ resolve,
99
+ reject
100
+ ]);
101
+ } else {
102
+ import(/* webpackIgnore: true */ /* @vite-ignore */ entry).then(resolve).catch(reject);
103
+ }
97
104
  } else {
98
105
  resolve(remoteEntryExports);
99
106
  }
@@ -228,7 +235,6 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
228
235
  }
229
236
  if (!globalLoading[uniqueKey]) {
230
237
  const loadEntryHook = origin.remoteHandler.hooks.lifecycle.loadEntry;
231
- origin.loaderHook.lifecycle.createScript;
232
238
  const loaderHook = origin.loaderHook;
233
239
  globalLoading[uniqueKey] = loadEntryHook.emit({
234
240
  loaderHook,
@@ -2008,7 +2014,7 @@ class FederationHost {
2008
2014
  // maybe will change, temporarily for internal use only
2009
2015
  initContainer: new AsyncWaterfallHook('initContainer')
2010
2016
  });
2011
- this.version = "0.7.5";
2017
+ this.version = "0.7.7";
2012
2018
  this.moduleCache = new Map();
2013
2019
  this.loaderHook = new PluginSystem({
2014
2020
  // FIXME: may not be suitable , not open to the public yet
package/dist/share.cjs.js CHANGED
@@ -197,7 +197,7 @@ function getGlobalFederationConstructor() {
197
197
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
198
198
  if (isDebug) {
199
199
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
200
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.5";
200
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.7";
201
201
  }
202
202
  }
203
203
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -195,7 +195,7 @@ function getGlobalFederationConstructor() {
195
195
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
196
196
  if (isDebug) {
197
197
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
198
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.5";
198
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.7";
199
199
  }
200
200
  }
201
201
  // eslint-disable-next-line @typescript-eslint/ban-types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.mjs",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  },
52
52
  "dependencies": {
53
- "@module-federation/sdk": "0.7.5",
54
- "@module-federation/error-codes": "0.7.5"
53
+ "@module-federation/sdk": "0.7.7",
54
+ "@module-federation/error-codes": "0.7.7"
55
55
  }
56
56
  }