@module-federation/runtime 0.0.0-next-20240318025655 → 0.0.0-next-20240318072254

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
@@ -790,9 +790,7 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
790
790
  id: assetsInfo.moduleName === '.' ? remoteInfo.name : exposeFullPath,
791
791
  name: remoteInfo.name,
792
792
  remoteSnapshot: moduleInfoSnapshot,
793
- preloadConfig,
794
- remote: remoteInfo,
795
- origin
793
+ preloadConfig
796
794
  });
797
795
  const preloaded = share.getPreloaded(exposeFullPath);
798
796
  if (preloaded) {
@@ -1026,9 +1024,14 @@ class SnapshotHandler {
1026
1024
  return manifestJson;
1027
1025
  }
1028
1026
  try {
1029
- let res = await this.loaderHook.lifecycle.fetch.emit(manifestUrl, {});
1027
+ const headers = sdk.getHeaders();
1028
+ let res = await this.loaderHook.lifecycle.fetch.emit(manifestUrl, {
1029
+ headers
1030
+ });
1030
1031
  if (!res || !(res instanceof Response)) {
1031
- res = await fetch(manifestUrl, {});
1032
+ res = await fetch(manifestUrl, {
1033
+ headers
1034
+ });
1032
1035
  }
1033
1036
  manifestJson = await res.json();
1034
1037
  share.assert(manifestJson.metaData && manifestJson.exposes && manifestJson.shared, `${manifestUrl} is not a federation manifest`);
@@ -1751,8 +1754,6 @@ Object.defineProperty(exports, 'loadScriptNode', {
1751
1754
  get: function () { return sdk.loadScriptNode; }
1752
1755
  });
1753
1756
  exports.FederationHost = FederationHost;
1754
- exports.getRemoteEntry = getRemoteEntry;
1755
- exports.getRemoteInfo = getRemoteInfo;
1756
1757
  exports.init = init;
1757
1758
  exports.loadRemote = loadRemote;
1758
1759
  exports.loadShare = loadShare;
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
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 getRegisteredShare, m as getInfoWithoutType, n as getPreloaded, o as setPreloaded, p as getGlobalSnapshotInfoByModuleInfo, q as addGlobalSnapshot, r as setGlobalSnapshotInfoByModuleInfo, t as getGlobalSnapshot, G as Global, u as getGlobalShareScope, v as formatShareConfigs, x as getBuilderId, y as isBrowserEnv, z as addUniqueItem, A as setGlobalFederationConstructor, B as getGlobalFederationInstance, C as getGlobalFederationConstructor, E as setGlobalFederationInstance } from './share.esm.js';
1
+ import { g as getGlobalHostPlugins, D as DEFAULT_REMOTE_TYPE, a as DEFAULT_SCOPE, b as globalLoading, 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 getRegisteredShare, m as getInfoWithoutType, n as getPreloaded, o as setPreloaded, p as getGlobalSnapshotInfoByModuleInfo, q as addGlobalSnapshot, r as setGlobalSnapshotInfoByModuleInfo, t as getGlobalSnapshot, G as Global, u as getGlobalShareScope, v as formatShareConfigs, x as getBuilderId, y as isBrowserEnv, z as addUniqueItem, A as setGlobalFederationConstructor, B as getGlobalFederationInstance, C as getGlobalFederationConstructor, E as setGlobalFederationInstance } from './share.esm.js';
2
2
  export { F as registerGlobalPlugins } from './share.esm.js';
3
- import { loadScriptNode, loadScript, composeKeyWithSeparator, createLink, getResourceUrl, isManifestProvider, generateSnapshotFromManifest } from '@module-federation/sdk';
3
+ import { composeKeyWithSeparator, loadScriptNode, loadScript, createLink, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, getHeaders } from '@module-federation/sdk';
4
4
  export { loadScript, loadScriptNode } from '@module-federation/sdk';
5
5
 
6
6
  // Function to match a remote with its name and expose
@@ -788,9 +788,7 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
788
788
  id: assetsInfo.moduleName === '.' ? remoteInfo.name : exposeFullPath,
789
789
  name: remoteInfo.name,
790
790
  remoteSnapshot: moduleInfoSnapshot,
791
- preloadConfig,
792
- remote: remoteInfo,
793
- origin
791
+ preloadConfig
794
792
  });
795
793
  const preloaded = getPreloaded(exposeFullPath);
796
794
  if (preloaded) {
@@ -1024,9 +1022,14 @@ class SnapshotHandler {
1024
1022
  return manifestJson;
1025
1023
  }
1026
1024
  try {
1027
- let res = await this.loaderHook.lifecycle.fetch.emit(manifestUrl, {});
1025
+ const headers = getHeaders();
1026
+ let res = await this.loaderHook.lifecycle.fetch.emit(manifestUrl, {
1027
+ headers
1028
+ });
1028
1029
  if (!res || !(res instanceof Response)) {
1029
- res = await fetch(manifestUrl, {});
1030
+ res = await fetch(manifestUrl, {
1031
+ headers
1032
+ });
1030
1033
  }
1031
1034
  manifestJson = await res.json();
1032
1035
  assert(manifestJson.metaData && manifestJson.exposes && manifestJson.shared, `${manifestUrl} is not a federation manifest`);
@@ -1739,4 +1742,4 @@ function registerRemotes(...args) {
1739
1742
  // Inject for debug
1740
1743
  setGlobalFederationConstructor(FederationHost);
1741
1744
 
1742
- export { FederationHost, getRemoteEntry, getRemoteInfo, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerRemotes };
1745
+ export { FederationHost, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerRemotes };
package/dist/share.esm.js CHANGED
@@ -803,4 +803,4 @@ function getGlobalShareScope() {
803
803
  return Global.__FEDERATION__.__SHARE__;
804
804
  }
805
805
 
806
- export { setGlobalFederationConstructor as A, getGlobalFederationInstance as B, getGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, setGlobalFederationInstance as E, registerGlobalPlugins as F, Global as G, nativeGlobal as H, resetFederationGlobalInfo as I, getTargetSnapshotInfoByModuleInfo as J, 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, getRegisteredShare as l, getInfoWithoutType as m, getPreloaded as n, setPreloaded as o, getGlobalSnapshotInfoByModuleInfo as p, addGlobalSnapshot as q, setGlobalSnapshotInfoByModuleInfo as r, safeToString as s, getGlobalSnapshot as t, getGlobalShareScope as u, formatShareConfigs as v, warn as w, getBuilderId as x, isBrowserEnv as y, addUniqueItem as z };
806
+ export { setGlobalFederationConstructor as A, getGlobalFederationInstance as B, getGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, setGlobalFederationInstance as E, registerGlobalPlugins as F, Global as G, nativeGlobal as H, resetFederationGlobalInfo as I, getTargetSnapshotInfoByModuleInfo as J, DEFAULT_SCOPE as a, globalLoading 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, getRegisteredShare as l, getInfoWithoutType as m, getPreloaded as n, setPreloaded as o, getGlobalSnapshotInfoByModuleInfo as p, addGlobalSnapshot as q, setGlobalSnapshotInfoByModuleInfo as r, safeToString as s, getGlobalSnapshot as t, getGlobalShareScope as u, formatShareConfigs as v, warn as w, getBuilderId as x, isBrowserEnv as y, addUniqueItem as z };
@@ -67,10 +67,8 @@ export declare class FederationHost {
67
67
  handlePreloadModule: SyncHook<{
68
68
  id: string;
69
69
  name: string;
70
- remote: Remote;
71
70
  remoteSnapshot: ModuleInfo;
72
71
  preloadConfig: PreloadRemoteArgs;
73
- origin: FederationHost;
74
72
  }, void>;
75
73
  errorLoadRemote: AsyncHook<[{
76
74
  id: string;
@@ -2,7 +2,6 @@ import { FederationHost } from './core';
2
2
  import { UserOptions, FederationRuntimePlugin } from './type';
3
3
  export { FederationHost } from './core';
4
4
  export { registerGlobalPlugins } from './global';
5
- export { getRemoteEntry, getRemoteInfo } from './utils';
6
5
  export { loadScript, loadScriptNode } from '@module-federation/sdk';
7
6
  export type { Federation } from './global';
8
7
  export type { FederationRuntimePlugin };
@@ -3,4 +3,3 @@ export * from './tool';
3
3
  export * from './manifest';
4
4
  export * from './logger';
5
5
  export * from './plugin';
6
- export * from './load';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20240318025655",
3
+ "version": "0.0.0-next-20240318072254",
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.0-next-20240318025655"
48
+ "@module-federation/sdk": "0.0.0-next-20240318072254"
49
49
  }
50
50
  }