@module-federation/runtime 0.1.13 → 0.1.14

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
@@ -224,6 +224,7 @@ let Module = class Module {
224
224
  const res = this.host.loaderHook.lifecycle.createScript.emit({
225
225
  url
226
226
  });
227
+ if (!res) return;
227
228
  if (typeof document === 'undefined') {
228
229
  //todo: needs real fix
229
230
  return res;
@@ -231,6 +232,9 @@ let Module = class Module {
231
232
  if (res instanceof HTMLScriptElement) {
232
233
  return res;
233
234
  }
235
+ if ('script' in res || 'timeout' in res) {
236
+ return res;
237
+ }
234
238
  return;
235
239
  }
236
240
  });
@@ -544,9 +548,17 @@ function preloadAssets(remoteInfo, host, assets) {
544
548
  const res = host.loaderHook.lifecycle.createScript.emit({
545
549
  url
546
550
  });
551
+ if (!res) return;
552
+ if (typeof document === 'undefined') {
553
+ //todo: needs real fix
554
+ return res;
555
+ }
547
556
  if (res instanceof HTMLScriptElement) {
548
557
  return res;
549
558
  }
559
+ if ('script' in res || 'timeout' in res) {
560
+ return res;
561
+ }
550
562
  return;
551
563
  }
552
564
  });
@@ -558,9 +570,17 @@ function preloadAssets(remoteInfo, host, assets) {
558
570
  const res = host.loaderHook.lifecycle.createScript.emit({
559
571
  url
560
572
  });
573
+ if (!res) return;
574
+ if (typeof document === 'undefined') {
575
+ //todo: needs real fix
576
+ return res;
577
+ }
561
578
  if (res instanceof HTMLScriptElement) {
562
579
  return res;
563
580
  }
581
+ if ('script' in res || 'timeout' in res) {
582
+ return res;
583
+ }
564
584
  return;
565
585
  }
566
586
  });
@@ -1860,7 +1880,7 @@ class FederationHost {
1860
1880
  // maybe will change, temporarily for internal use only
1861
1881
  initContainer: new AsyncWaterfallHook('initContainer')
1862
1882
  });
1863
- this.version = "0.1.13";
1883
+ this.version = "0.1.14";
1864
1884
  this.moduleCache = new Map();
1865
1885
  this.loaderHook = new PluginSystem({
1866
1886
  // FIXME: may not be suitable , not open to the public yet
package/dist/index.esm.js CHANGED
@@ -222,6 +222,7 @@ let Module = class Module {
222
222
  const res = this.host.loaderHook.lifecycle.createScript.emit({
223
223
  url
224
224
  });
225
+ if (!res) return;
225
226
  if (typeof document === 'undefined') {
226
227
  //todo: needs real fix
227
228
  return res;
@@ -229,6 +230,9 @@ let Module = class Module {
229
230
  if (res instanceof HTMLScriptElement) {
230
231
  return res;
231
232
  }
233
+ if ('script' in res || 'timeout' in res) {
234
+ return res;
235
+ }
232
236
  return;
233
237
  }
234
238
  });
@@ -542,9 +546,17 @@ function preloadAssets(remoteInfo, host, assets) {
542
546
  const res = host.loaderHook.lifecycle.createScript.emit({
543
547
  url
544
548
  });
549
+ if (!res) return;
550
+ if (typeof document === 'undefined') {
551
+ //todo: needs real fix
552
+ return res;
553
+ }
545
554
  if (res instanceof HTMLScriptElement) {
546
555
  return res;
547
556
  }
557
+ if ('script' in res || 'timeout' in res) {
558
+ return res;
559
+ }
548
560
  return;
549
561
  }
550
562
  });
@@ -556,9 +568,17 @@ function preloadAssets(remoteInfo, host, assets) {
556
568
  const res = host.loaderHook.lifecycle.createScript.emit({
557
569
  url
558
570
  });
571
+ if (!res) return;
572
+ if (typeof document === 'undefined') {
573
+ //todo: needs real fix
574
+ return res;
575
+ }
559
576
  if (res instanceof HTMLScriptElement) {
560
577
  return res;
561
578
  }
579
+ if ('script' in res || 'timeout' in res) {
580
+ return res;
581
+ }
562
582
  return;
563
583
  }
564
584
  });
@@ -1858,7 +1878,7 @@ class FederationHost {
1858
1878
  // maybe will change, temporarily for internal use only
1859
1879
  initContainer: new AsyncWaterfallHook('initContainer')
1860
1880
  });
1861
- this.version = "0.1.13";
1881
+ this.version = "0.1.14";
1862
1882
  this.moduleCache = new Map();
1863
1883
  this.loaderHook = new PluginSystem({
1864
1884
  // 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.1.13",
3
+ "version": "0.1.14",
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
@@ -190,7 +190,7 @@ function getGlobalFederationConstructor() {
190
190
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
191
191
  if (isDebug) {
192
192
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
193
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.13";
193
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.14";
194
194
  }
195
195
  }
196
196
  // eslint-disable-next-line @typescript-eslint/ban-types
package/dist/share.esm.js CHANGED
@@ -188,7 +188,7 @@ function getGlobalFederationConstructor() {
188
188
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
189
189
  if (isDebug) {
190
190
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
191
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.13";
191
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.14";
192
192
  }
193
193
  }
194
194
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1,3 +1,4 @@
1
+ import type { CreateScriptHookReturn } from '@module-federation/sdk';
1
2
  import { Options, PreloadRemoteArgs, RemoteEntryExports, Remote, Shared, ShareInfos, UserOptions, RemoteInfo, ShareScopeMap, InitScope, RemoteEntryInitOptions } from './type';
2
3
  import { Module } from './module';
3
4
  import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHook } from './utils/hooks';
@@ -50,7 +51,7 @@ export declare class FederationHost {
50
51
  }>;
51
52
  createScript: SyncHook<[{
52
53
  url: string;
53
- }], void | HTMLScriptElement>;
54
+ }], CreateScriptHookReturn>;
54
55
  createLink: SyncHook<[{
55
56
  url: string;
56
57
  }], void | HTMLLinkElement>;
@@ -1,3 +1,4 @@
1
+ import { CreateScriptHookReturn } from '@module-federation/sdk';
1
2
  import { Remote, RemoteEntryExports, RemoteInfo } from '../type';
2
3
  export declare function loadEsmEntry({ entry, remoteEntryExports, }: {
3
4
  entry: string;
@@ -7,12 +8,12 @@ export declare function loadEntryScript({ name, globalName, entry, createScriptH
7
8
  name: string;
8
9
  globalName: string;
9
10
  entry: string;
10
- createScriptHook?: (url: string) => HTMLScriptElement | void;
11
+ createScriptHook?: (url: string) => CreateScriptHookReturn;
11
12
  }): Promise<RemoteEntryExports>;
12
13
  export declare function getRemoteEntryUniqueKey(remoteInfo: RemoteInfo): string;
13
14
  export declare function getRemoteEntry({ remoteEntryExports, remoteInfo, createScriptHook, }: {
14
15
  remoteInfo: RemoteInfo;
15
16
  remoteEntryExports?: RemoteEntryExports | undefined;
16
- createScriptHook?: (url: string) => HTMLScriptElement | void;
17
+ createScriptHook?: (url: string) => CreateScriptHookReturn;
17
18
  }): Promise<RemoteEntryExports | void>;
18
19
  export declare function getRemoteInfo(remote: Remote): RemoteInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -45,6 +45,6 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@module-federation/sdk": "0.1.13"
48
+ "@module-federation/sdk": "0.1.14"
49
49
  }
50
50
  }