@module-federation/runtime 0.6.9 → 0.6.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
@@ -92,11 +92,7 @@ async function loadEsmEntry({ entry, remoteEntryExports }) {
92
92
  return new Promise((resolve, reject)=>{
93
93
  try {
94
94
  if (!remoteEntryExports) {
95
- // eslint-disable-next-line no-eval
96
- new Function('callbacks', `import("${entry}").then(callbacks[0]).catch(callbacks[1])`)([
97
- resolve,
98
- reject
99
- ]);
95
+ import(/* webpackIgnore: true */ entry).then(resolve).catch(reject);
100
96
  } else {
101
97
  resolve(remoteEntryExports);
102
98
  }
@@ -109,11 +105,16 @@ async function loadSystemJsEntry({ entry, remoteEntryExports }) {
109
105
  return new Promise((resolve, reject)=>{
110
106
  try {
111
107
  if (!remoteEntryExports) {
112
- // eslint-disable-next-line no-eval
113
- new Function('callbacks', `System.import("${entry}").then(callbacks[0]).catch(callbacks[1])`)([
114
- resolve,
115
- reject
116
- ]);
108
+ //@ts-ignore
109
+ if (typeof __system_context__ === 'undefined') {
110
+ //@ts-ignore
111
+ System.import(entry).then(resolve).catch(reject);
112
+ } else {
113
+ new Function('callbacks', `System.import("${entry}").then(callbacks[0]).catch(callbacks[1])`)([
114
+ resolve,
115
+ reject
116
+ ]);
117
+ }
117
118
  } else {
118
119
  resolve(remoteEntryExports);
119
120
  }
@@ -456,8 +457,7 @@ class SyncWaterfallHook extends SyncHook {
456
457
  return data;
457
458
  }
458
459
  constructor(type){
459
- super();
460
- this.onerror = share.error;
460
+ super(), this.onerror = share.error;
461
461
  this.type = type;
462
462
  }
463
463
  }
@@ -495,8 +495,7 @@ class AsyncWaterfallHook extends SyncHook {
495
495
  return Promise.resolve(data);
496
496
  }
497
497
  constructor(type){
498
- super();
499
- this.onerror = share.error;
498
+ super(), this.onerror = share.error;
500
499
  this.type = type;
501
500
  }
502
501
  }
@@ -604,13 +603,14 @@ useLinkPreload = true) {
604
603
  if (useLinkPreload) {
605
604
  const defaultAttrs = {
606
605
  rel: 'preload',
607
- as: 'style',
608
- crossorigin: 'anonymous'
606
+ as: 'style'
609
607
  };
610
608
  cssAssets.forEach((cssUrl)=>{
611
609
  const { link: cssEl, needAttach } = sdk.createLink({
612
610
  url: cssUrl,
613
- cb: ()=>{},
611
+ cb: ()=>{
612
+ // noop
613
+ },
614
614
  attrs: defaultAttrs,
615
615
  createLinkHook: (url, attrs)=>{
616
616
  const res = host.loaderHook.lifecycle.createLink.emit({
@@ -633,7 +633,9 @@ useLinkPreload = true) {
633
633
  cssAssets.forEach((cssUrl)=>{
634
634
  const { link: cssEl, needAttach } = sdk.createLink({
635
635
  url: cssUrl,
636
- cb: ()=>{},
636
+ cb: ()=>{
637
+ // noop
638
+ },
637
639
  attrs: defaultAttrs,
638
640
  createLinkHook: (url, attrs)=>{
639
641
  const res = host.loaderHook.lifecycle.createLink.emit({
@@ -653,13 +655,14 @@ useLinkPreload = true) {
653
655
  if (useLinkPreload) {
654
656
  const defaultAttrs = {
655
657
  rel: 'preload',
656
- as: 'script',
657
- crossorigin: 'anonymous'
658
+ as: 'script'
658
659
  };
659
660
  jsAssetsWithoutEntry.forEach((jsUrl)=>{
660
661
  const { link: linkEl, needAttach } = sdk.createLink({
661
662
  url: jsUrl,
662
- cb: ()=>{},
663
+ cb: ()=>{
664
+ // noop
665
+ },
663
666
  attrs: defaultAttrs,
664
667
  createLinkHook: (url, attrs)=>{
665
668
  const res = host.loaderHook.lifecycle.createLink.emit({
@@ -682,7 +685,9 @@ useLinkPreload = true) {
682
685
  jsAssetsWithoutEntry.forEach((jsUrl)=>{
683
686
  const { script: scriptEl, needAttach } = sdk.createScript({
684
687
  url: jsUrl,
685
- cb: ()=>{},
688
+ cb: ()=>{
689
+ // noop
690
+ },
686
691
  attrs: defaultAttrs,
687
692
  createScriptHook: (url, attrs)=>{
688
693
  const res = host.loaderHook.lifecycle.createScript.emit({
@@ -1987,7 +1992,7 @@ class FederationHost {
1987
1992
  // maybe will change, temporarily for internal use only
1988
1993
  initContainer: new AsyncWaterfallHook('initContainer')
1989
1994
  });
1990
- this.version = "0.6.9";
1995
+ this.version = "0.6.11";
1991
1996
  this.moduleCache = new Map();
1992
1997
  this.loaderHook = new PluginSystem({
1993
1998
  // FIXME: may not be suitable , not open to the public yet
package/dist/index.esm.js CHANGED
@@ -92,11 +92,7 @@ async function loadEsmEntry({ entry, remoteEntryExports }) {
92
92
  return new Promise((resolve, reject)=>{
93
93
  try {
94
94
  if (!remoteEntryExports) {
95
- // eslint-disable-next-line no-eval
96
- new Function('callbacks', `import("${entry}").then(callbacks[0]).catch(callbacks[1])`)([
97
- resolve,
98
- reject
99
- ]);
95
+ import(/* webpackIgnore: true */ entry).then(resolve).catch(reject);
100
96
  } else {
101
97
  resolve(remoteEntryExports);
102
98
  }
@@ -109,11 +105,16 @@ async function loadSystemJsEntry({ entry, remoteEntryExports }) {
109
105
  return new Promise((resolve, reject)=>{
110
106
  try {
111
107
  if (!remoteEntryExports) {
112
- // eslint-disable-next-line no-eval
113
- new Function('callbacks', `System.import("${entry}").then(callbacks[0]).catch(callbacks[1])`)([
114
- resolve,
115
- reject
116
- ]);
108
+ //@ts-ignore
109
+ if (typeof __system_context__ === 'undefined') {
110
+ //@ts-ignore
111
+ System.import(entry).then(resolve).catch(reject);
112
+ } else {
113
+ new Function('callbacks', `System.import("${entry}").then(callbacks[0]).catch(callbacks[1])`)([
114
+ resolve,
115
+ reject
116
+ ]);
117
+ }
117
118
  } else {
118
119
  resolve(remoteEntryExports);
119
120
  }
@@ -456,8 +457,7 @@ class SyncWaterfallHook extends SyncHook {
456
457
  return data;
457
458
  }
458
459
  constructor(type){
459
- super();
460
- this.onerror = error;
460
+ super(), this.onerror = error;
461
461
  this.type = type;
462
462
  }
463
463
  }
@@ -495,8 +495,7 @@ class AsyncWaterfallHook extends SyncHook {
495
495
  return Promise.resolve(data);
496
496
  }
497
497
  constructor(type){
498
- super();
499
- this.onerror = error;
498
+ super(), this.onerror = error;
500
499
  this.type = type;
501
500
  }
502
501
  }
@@ -604,13 +603,14 @@ useLinkPreload = true) {
604
603
  if (useLinkPreload) {
605
604
  const defaultAttrs = {
606
605
  rel: 'preload',
607
- as: 'style',
608
- crossorigin: 'anonymous'
606
+ as: 'style'
609
607
  };
610
608
  cssAssets.forEach((cssUrl)=>{
611
609
  const { link: cssEl, needAttach } = createLink({
612
610
  url: cssUrl,
613
- cb: ()=>{},
611
+ cb: ()=>{
612
+ // noop
613
+ },
614
614
  attrs: defaultAttrs,
615
615
  createLinkHook: (url, attrs)=>{
616
616
  const res = host.loaderHook.lifecycle.createLink.emit({
@@ -633,7 +633,9 @@ useLinkPreload = true) {
633
633
  cssAssets.forEach((cssUrl)=>{
634
634
  const { link: cssEl, needAttach } = createLink({
635
635
  url: cssUrl,
636
- cb: ()=>{},
636
+ cb: ()=>{
637
+ // noop
638
+ },
637
639
  attrs: defaultAttrs,
638
640
  createLinkHook: (url, attrs)=>{
639
641
  const res = host.loaderHook.lifecycle.createLink.emit({
@@ -653,13 +655,14 @@ useLinkPreload = true) {
653
655
  if (useLinkPreload) {
654
656
  const defaultAttrs = {
655
657
  rel: 'preload',
656
- as: 'script',
657
- crossorigin: 'anonymous'
658
+ as: 'script'
658
659
  };
659
660
  jsAssetsWithoutEntry.forEach((jsUrl)=>{
660
661
  const { link: linkEl, needAttach } = createLink({
661
662
  url: jsUrl,
662
- cb: ()=>{},
663
+ cb: ()=>{
664
+ // noop
665
+ },
663
666
  attrs: defaultAttrs,
664
667
  createLinkHook: (url, attrs)=>{
665
668
  const res = host.loaderHook.lifecycle.createLink.emit({
@@ -682,7 +685,9 @@ useLinkPreload = true) {
682
685
  jsAssetsWithoutEntry.forEach((jsUrl)=>{
683
686
  const { script: scriptEl, needAttach } = createScript({
684
687
  url: jsUrl,
685
- cb: ()=>{},
688
+ cb: ()=>{
689
+ // noop
690
+ },
686
691
  attrs: defaultAttrs,
687
692
  createScriptHook: (url, attrs)=>{
688
693
  const res = host.loaderHook.lifecycle.createScript.emit({
@@ -1987,7 +1992,7 @@ class FederationHost {
1987
1992
  // maybe will change, temporarily for internal use only
1988
1993
  initContainer: new AsyncWaterfallHook('initContainer')
1989
1994
  });
1990
- this.version = "0.6.9";
1995
+ this.version = "0.6.11";
1991
1996
  this.moduleCache = new Map();
1992
1997
  this.loaderHook = new PluginSystem({
1993
1998
  // 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.6.9",
3
+ "version": "0.6.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
@@ -175,7 +175,7 @@ function getGlobalFederationConstructor() {
175
175
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
176
176
  if (isDebug) {
177
177
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
178
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.9";
178
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.11";
179
179
  }
180
180
  }
181
181
  // eslint-disable-next-line @typescript-eslint/ban-types
package/dist/share.esm.js CHANGED
@@ -173,7 +173,7 @@ function getGlobalFederationConstructor() {
173
173
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
174
174
  if (isDebug) {
175
175
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
176
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.9";
176
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.11";
177
177
  }
178
178
  }
179
179
  // 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.6.9",
3
+ "version": "0.6.11",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -50,6 +50,6 @@
50
50
  }
51
51
  },
52
52
  "dependencies": {
53
- "@module-federation/sdk": "0.6.9"
53
+ "@module-federation/sdk": "0.6.11"
54
54
  }
55
55
  }