@module-federation/runtime 0.7.3 → 0.7.5

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.
@@ -88,6 +88,9 @@ class FederationHost {
88
88
  get loaderHook() {
89
89
  return this._getInstance().loaderHook;
90
90
  }
91
+ get bridgeHook() {
92
+ return this._getInstance().bridgeHook;
93
+ }
91
94
  initOptions(...args) {
92
95
  return this._getInstance().initOptions(...args);
93
96
  }
@@ -86,6 +86,9 @@ class FederationHost {
86
86
  get loaderHook() {
87
87
  return this._getInstance().loaderHook;
88
88
  }
89
+ get bridgeHook() {
90
+ return this._getInstance().bridgeHook;
91
+ }
89
92
  initOptions(...args) {
90
93
  return this._getInstance().initOptions(...args);
91
94
  }
package/dist/index.cjs.js CHANGED
@@ -333,7 +333,9 @@ let Module = class Module {
333
333
  moduleFactory = await remoteEntryExports.get(expose);
334
334
  }
335
335
  share.assert(moduleFactory, `${share.getFMId(this.remoteInfo)} remote don't export ${expose}.`);
336
- const wrapModuleFactory = this.wraperFactory(moduleFactory, id);
336
+ // keep symbol for module name always one format
337
+ const symbolName = share.processModuleAlias(this.remoteInfo.name, expose);
338
+ const wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);
337
339
  if (!loadFactory) {
338
340
  return wrapModuleFactory;
339
341
  }
@@ -1071,6 +1073,8 @@ class SnapshotHandler {
1071
1073
  remoteSnapshot,
1072
1074
  globalSnapshot
1073
1075
  });
1076
+ let mSnapshot;
1077
+ let gSnapshot;
1074
1078
  // global snapshot includes manifest or module info includes manifest
1075
1079
  if (globalRemoteSnapshot) {
1076
1080
  if (sdk.isManifestProvider(globalRemoteSnapshot)) {
@@ -1082,10 +1086,8 @@ class SnapshotHandler {
1082
1086
  // Therefore, set the snapshot key to the global address of the actual request
1083
1087
  entry: remoteEntry
1084
1088
  }), moduleSnapshot);
1085
- return {
1086
- remoteSnapshot: moduleSnapshot,
1087
- globalSnapshot: globalSnapshotRes
1088
- };
1089
+ mSnapshot = moduleSnapshot;
1090
+ gSnapshot = globalSnapshotRes;
1089
1091
  } else {
1090
1092
  const { remoteSnapshot: remoteSnapshotRes } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1091
1093
  options: this.HostInstance.options,
@@ -1093,10 +1095,8 @@ class SnapshotHandler {
1093
1095
  remoteSnapshot: globalRemoteSnapshot,
1094
1096
  from: 'global'
1095
1097
  });
1096
- return {
1097
- remoteSnapshot: remoteSnapshotRes,
1098
- globalSnapshot: globalSnapshotRes
1099
- };
1098
+ mSnapshot = remoteSnapshotRes;
1099
+ gSnapshot = globalSnapshotRes;
1100
1100
  }
1101
1101
  } else {
1102
1102
  if (share.isRemoteInfoWithEntry(moduleInfo)) {
@@ -1110,10 +1110,8 @@ class SnapshotHandler {
1110
1110
  remoteSnapshot: moduleSnapshot,
1111
1111
  from: 'global'
1112
1112
  });
1113
- return {
1114
- remoteSnapshot: remoteSnapshotRes,
1115
- globalSnapshot: globalSnapshotRes
1116
- };
1113
+ mSnapshot = remoteSnapshotRes;
1114
+ gSnapshot = globalSnapshotRes;
1117
1115
  } else {
1118
1116
  share.error(errorCodes.getShortErrorMsg(errorCodes.RUNTIME_007, errorCodes.runtimeDescMap, {
1119
1117
  hostName: moduleInfo.name,
@@ -1122,6 +1120,15 @@ class SnapshotHandler {
1122
1120
  }));
1123
1121
  }
1124
1122
  }
1123
+ await this.hooks.lifecycle.afterLoadSnapshot.emit({
1124
+ options,
1125
+ moduleInfo,
1126
+ remoteSnapshot: mSnapshot
1127
+ });
1128
+ return {
1129
+ remoteSnapshot: mSnapshot,
1130
+ globalSnapshot: gSnapshot
1131
+ };
1125
1132
  }
1126
1133
  getGlobalRemoteInfo(moduleInfo) {
1127
1134
  return getGlobalRemoteInfo(moduleInfo, this.HostInstance);
@@ -1175,7 +1182,8 @@ class SnapshotHandler {
1175
1182
  this.hooks = new PluginSystem({
1176
1183
  beforeLoadRemoteSnapshot: new AsyncHook('beforeLoadRemoteSnapshot'),
1177
1184
  loadSnapshot: new AsyncWaterfallHook('loadGlobalSnapshot'),
1178
- loadRemoteSnapshot: new AsyncWaterfallHook('loadRemoteSnapshot')
1185
+ loadRemoteSnapshot: new AsyncWaterfallHook('loadRemoteSnapshot'),
1186
+ afterLoadSnapshot: new AsyncWaterfallHook('afterLoadSnapshot')
1179
1187
  });
1180
1188
  this.manifestLoading = share.Global.__FEDERATION__.__MANIFEST_LOADING__;
1181
1189
  this.HostInstance = HostInstance;
@@ -1976,7 +1984,8 @@ class FederationHost {
1976
1984
  this.remoteHandler.hooks,
1977
1985
  this.sharedHandler.hooks,
1978
1986
  this.snapshotHandler.hooks,
1979
- this.loaderHook
1987
+ this.loaderHook,
1988
+ this.bridgeHook
1980
1989
  ]);
1981
1990
  // Merge plugin
1982
1991
  this.options.plugins = this.options.plugins.reduce((res, plugin)=>{
@@ -1999,7 +2008,7 @@ class FederationHost {
1999
2008
  // maybe will change, temporarily for internal use only
2000
2009
  initContainer: new AsyncWaterfallHook('initContainer')
2001
2010
  });
2002
- this.version = "0.7.3";
2011
+ this.version = "0.7.5";
2003
2012
  this.moduleCache = new Map();
2004
2013
  this.loaderHook = new PluginSystem({
2005
2014
  // FIXME: may not be suitable , not open to the public yet
@@ -2010,6 +2019,12 @@ class FederationHost {
2010
2019
  fetch: new AsyncHook(),
2011
2020
  getModuleFactory: new AsyncHook()
2012
2021
  });
2022
+ this.bridgeHook = new PluginSystem({
2023
+ beforeBridgeRender: new SyncHook(),
2024
+ afterBridgeRender: new SyncHook(),
2025
+ beforeBridgeDestroy: new SyncHook(),
2026
+ afterBridgeDestroy: new SyncHook()
2027
+ });
2013
2028
  // TODO: Validate the details of the options
2014
2029
  // Initialize options with default values
2015
2030
  const defaultOptions = {
@@ -1,7 +1,7 @@
1
1
  import { a as _extends, _ as _object_without_properties_loose } from './polyfills.esm.mjs';
2
2
  import { isBrowserEnv, loadScriptNode, composeKeyWithSeparator, loadScript, safeToString, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
3
3
  export { loadScript, loadScriptNode } from '@module-federation/sdk';
4
- import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as error, x as getFMId, y as isObject, z as warn, A as isPlainObject, B as isRemoteInfoWithEntry, C as isPureRemoteEntry, E as getRemoteEntryInfoFromSnapshot, e as getInfoWithoutType, p as getPreloaded, q as setPreloaded, g as getRegisteredShare, F as arrayOptions, i as getGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, j as setGlobalSnapshotInfoByModuleInfo, G as Global, f as getGlobalSnapshot, H as formatShareConfigs, I as getTargetSharedOptions, a as getGlobalShareScope, J as addUniqueItem, K as CurrentGlobal, L as logger, M as getBuilderId, d as setGlobalFederationConstructor, b as getGlobalFederationInstance, c as getGlobalFederationConstructor, s as setGlobalFederationInstance } from './share.esm.mjs';
4
+ import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as error, x as getFMId, y as processModuleAlias, z as isObject, A as warn, B as isPlainObject, C as isRemoteInfoWithEntry, E as isPureRemoteEntry, F as getRemoteEntryInfoFromSnapshot, e as getInfoWithoutType, p as getPreloaded, q as setPreloaded, g as getRegisteredShare, H as arrayOptions, i as getGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, j as setGlobalSnapshotInfoByModuleInfo, G as Global, f as getGlobalSnapshot, I as formatShareConfigs, J as getTargetSharedOptions, a as getGlobalShareScope, K as addUniqueItem, L as CurrentGlobal, M as logger, N as getBuilderId, d as setGlobalFederationConstructor, b as getGlobalFederationInstance, c as getGlobalFederationConstructor, s as setGlobalFederationInstance } from './share.esm.mjs';
5
5
  export { m as registerGlobalPlugins } from './share.esm.mjs';
6
6
  import { getShortErrorMsg, RUNTIME_001, runtimeDescMap, RUNTIME_002, RUNTIME_007, RUNTIME_003, RUNTIME_005, RUNTIME_006, RUNTIME_004 } from '@module-federation/error-codes';
7
7
 
@@ -333,7 +333,9 @@ let Module = class Module {
333
333
  moduleFactory = await remoteEntryExports.get(expose);
334
334
  }
335
335
  assert(moduleFactory, `${getFMId(this.remoteInfo)} remote don't export ${expose}.`);
336
- const wrapModuleFactory = this.wraperFactory(moduleFactory, id);
336
+ // keep symbol for module name always one format
337
+ const symbolName = processModuleAlias(this.remoteInfo.name, expose);
338
+ const wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);
337
339
  if (!loadFactory) {
338
340
  return wrapModuleFactory;
339
341
  }
@@ -1071,6 +1073,8 @@ class SnapshotHandler {
1071
1073
  remoteSnapshot,
1072
1074
  globalSnapshot
1073
1075
  });
1076
+ let mSnapshot;
1077
+ let gSnapshot;
1074
1078
  // global snapshot includes manifest or module info includes manifest
1075
1079
  if (globalRemoteSnapshot) {
1076
1080
  if (isManifestProvider(globalRemoteSnapshot)) {
@@ -1082,10 +1086,8 @@ class SnapshotHandler {
1082
1086
  // Therefore, set the snapshot key to the global address of the actual request
1083
1087
  entry: remoteEntry
1084
1088
  }), moduleSnapshot);
1085
- return {
1086
- remoteSnapshot: moduleSnapshot,
1087
- globalSnapshot: globalSnapshotRes
1088
- };
1089
+ mSnapshot = moduleSnapshot;
1090
+ gSnapshot = globalSnapshotRes;
1089
1091
  } else {
1090
1092
  const { remoteSnapshot: remoteSnapshotRes } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1091
1093
  options: this.HostInstance.options,
@@ -1093,10 +1095,8 @@ class SnapshotHandler {
1093
1095
  remoteSnapshot: globalRemoteSnapshot,
1094
1096
  from: 'global'
1095
1097
  });
1096
- return {
1097
- remoteSnapshot: remoteSnapshotRes,
1098
- globalSnapshot: globalSnapshotRes
1099
- };
1098
+ mSnapshot = remoteSnapshotRes;
1099
+ gSnapshot = globalSnapshotRes;
1100
1100
  }
1101
1101
  } else {
1102
1102
  if (isRemoteInfoWithEntry(moduleInfo)) {
@@ -1110,10 +1110,8 @@ class SnapshotHandler {
1110
1110
  remoteSnapshot: moduleSnapshot,
1111
1111
  from: 'global'
1112
1112
  });
1113
- return {
1114
- remoteSnapshot: remoteSnapshotRes,
1115
- globalSnapshot: globalSnapshotRes
1116
- };
1113
+ mSnapshot = remoteSnapshotRes;
1114
+ gSnapshot = globalSnapshotRes;
1117
1115
  } else {
1118
1116
  error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
1119
1117
  hostName: moduleInfo.name,
@@ -1122,6 +1120,15 @@ class SnapshotHandler {
1122
1120
  }));
1123
1121
  }
1124
1122
  }
1123
+ await this.hooks.lifecycle.afterLoadSnapshot.emit({
1124
+ options,
1125
+ moduleInfo,
1126
+ remoteSnapshot: mSnapshot
1127
+ });
1128
+ return {
1129
+ remoteSnapshot: mSnapshot,
1130
+ globalSnapshot: gSnapshot
1131
+ };
1125
1132
  }
1126
1133
  getGlobalRemoteInfo(moduleInfo) {
1127
1134
  return getGlobalRemoteInfo(moduleInfo, this.HostInstance);
@@ -1175,7 +1182,8 @@ class SnapshotHandler {
1175
1182
  this.hooks = new PluginSystem({
1176
1183
  beforeLoadRemoteSnapshot: new AsyncHook('beforeLoadRemoteSnapshot'),
1177
1184
  loadSnapshot: new AsyncWaterfallHook('loadGlobalSnapshot'),
1178
- loadRemoteSnapshot: new AsyncWaterfallHook('loadRemoteSnapshot')
1185
+ loadRemoteSnapshot: new AsyncWaterfallHook('loadRemoteSnapshot'),
1186
+ afterLoadSnapshot: new AsyncWaterfallHook('afterLoadSnapshot')
1179
1187
  });
1180
1188
  this.manifestLoading = Global.__FEDERATION__.__MANIFEST_LOADING__;
1181
1189
  this.HostInstance = HostInstance;
@@ -1976,7 +1984,8 @@ class FederationHost {
1976
1984
  this.remoteHandler.hooks,
1977
1985
  this.sharedHandler.hooks,
1978
1986
  this.snapshotHandler.hooks,
1979
- this.loaderHook
1987
+ this.loaderHook,
1988
+ this.bridgeHook
1980
1989
  ]);
1981
1990
  // Merge plugin
1982
1991
  this.options.plugins = this.options.plugins.reduce((res, plugin)=>{
@@ -1999,7 +2008,7 @@ class FederationHost {
1999
2008
  // maybe will change, temporarily for internal use only
2000
2009
  initContainer: new AsyncWaterfallHook('initContainer')
2001
2010
  });
2002
- this.version = "0.7.3";
2011
+ this.version = "0.7.5";
2003
2012
  this.moduleCache = new Map();
2004
2013
  this.loaderHook = new PluginSystem({
2005
2014
  // FIXME: may not be suitable , not open to the public yet
@@ -2010,6 +2019,12 @@ class FederationHost {
2010
2019
  fetch: new AsyncHook(),
2011
2020
  getModuleFactory: new AsyncHook()
2012
2021
  });
2022
+ this.bridgeHook = new PluginSystem({
2023
+ beforeBridgeRender: new SyncHook(),
2024
+ afterBridgeRender: new SyncHook(),
2025
+ beforeBridgeDestroy: new SyncHook(),
2026
+ afterBridgeDestroy: new SyncHook()
2027
+ });
2013
2028
  // TODO: Validate the details of the options
2014
2029
  // Initialize options with default values
2015
2030
  const defaultOptions = {
package/dist/share.cjs.js CHANGED
@@ -89,6 +89,20 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
89
89
  }
90
90
  return defaultRemoteEntryInfo;
91
91
  }
92
+ const processModuleAlias = (name, subPath)=>{
93
+ // @host/ ./button -> @host/button
94
+ let moduleName;
95
+ if (name.endsWith('/')) {
96
+ moduleName = name.slice(0, -1);
97
+ } else {
98
+ moduleName = name;
99
+ }
100
+ if (subPath.startsWith('.')) {
101
+ subPath = subPath.slice(1);
102
+ }
103
+ moduleName = moduleName + subPath;
104
+ return moduleName;
105
+ };
92
106
 
93
107
  const CurrentGlobal = typeof globalThis === 'object' ? globalThis : window;
94
108
  const nativeGlobal = (()=>{
@@ -183,7 +197,7 @@ function getGlobalFederationConstructor() {
183
197
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
184
198
  if (isDebug) {
185
199
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
186
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.3";
200
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.5";
187
201
  }
188
202
  }
189
203
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -913,6 +927,7 @@ exports.isPureRemoteEntry = isPureRemoteEntry;
913
927
  exports.isRemoteInfoWithEntry = isRemoteInfoWithEntry;
914
928
  exports.logger = logger;
915
929
  exports.nativeGlobal = nativeGlobal;
930
+ exports.processModuleAlias = processModuleAlias;
916
931
  exports.registerGlobalPlugins = registerGlobalPlugins;
917
932
  exports.resetFederationGlobalInfo = resetFederationGlobalInfo;
918
933
  exports.setGlobalFederationConstructor = setGlobalFederationConstructor;
@@ -87,6 +87,20 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
87
87
  }
88
88
  return defaultRemoteEntryInfo;
89
89
  }
90
+ const processModuleAlias = (name, subPath)=>{
91
+ // @host/ ./button -> @host/button
92
+ let moduleName;
93
+ if (name.endsWith('/')) {
94
+ moduleName = name.slice(0, -1);
95
+ } else {
96
+ moduleName = name;
97
+ }
98
+ if (subPath.startsWith('.')) {
99
+ subPath = subPath.slice(1);
100
+ }
101
+ moduleName = moduleName + subPath;
102
+ return moduleName;
103
+ };
90
104
 
91
105
  const CurrentGlobal = typeof globalThis === 'object' ? globalThis : window;
92
106
  const nativeGlobal = (()=>{
@@ -181,7 +195,7 @@ function getGlobalFederationConstructor() {
181
195
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
182
196
  if (isDebug) {
183
197
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
184
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.3";
198
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.5";
185
199
  }
186
200
  }
187
201
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -879,4 +893,4 @@ function getTargetSharedOptions(options) {
879
893
  return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
880
894
  }
881
895
 
882
- export { isPlainObject as A, isRemoteInfoWithEntry as B, isPureRemoteEntry as C, DEFAULT_REMOTE_TYPE as D, getRemoteEntryInfoFromSnapshot as E, arrayOptions as F, Global as G, formatShareConfigs as H, getTargetSharedOptions as I, addUniqueItem as J, CurrentGlobal as K, logger as L, getBuilderId as M, getGlobalShareScope as a, getGlobalFederationInstance as b, getGlobalFederationConstructor as c, setGlobalFederationConstructor as d, getInfoWithoutType as e, getGlobalSnapshot as f, getRegisteredShare as g, getTargetSnapshotInfoByModuleInfo as h, getGlobalSnapshotInfoByModuleInfo as i, setGlobalSnapshotInfoByModuleInfo as j, addGlobalSnapshot as k, getRemoteEntryExports as l, registerGlobalPlugins as m, nativeGlobal as n, getGlobalHostPlugins as o, getPreloaded as p, setPreloaded as q, resetFederationGlobalInfo as r, setGlobalFederationInstance as s, globalLoading as t, DEFAULT_SCOPE as u, assert as v, error as w, getFMId as x, isObject as y, warn as z };
896
+ export { warn as A, isPlainObject as B, isRemoteInfoWithEntry as C, DEFAULT_REMOTE_TYPE as D, isPureRemoteEntry as E, getRemoteEntryInfoFromSnapshot as F, Global as G, arrayOptions as H, formatShareConfigs as I, getTargetSharedOptions as J, addUniqueItem as K, CurrentGlobal as L, logger as M, getBuilderId as N, getGlobalShareScope as a, getGlobalFederationInstance as b, getGlobalFederationConstructor as c, setGlobalFederationConstructor as d, getInfoWithoutType as e, getGlobalSnapshot as f, getRegisteredShare as g, getTargetSnapshotInfoByModuleInfo as h, getGlobalSnapshotInfoByModuleInfo as i, setGlobalSnapshotInfoByModuleInfo as j, addGlobalSnapshot as k, getRemoteEntryExports as l, registerGlobalPlugins as m, nativeGlobal as n, getGlobalHostPlugins as o, getPreloaded as p, setPreloaded as q, resetFederationGlobalInfo as r, setGlobalFederationInstance as s, globalLoading as t, DEFAULT_SCOPE as u, assert as v, error as w, getFMId as x, processModuleAlias as y, isObject as z };
@@ -66,6 +66,12 @@ export declare class FederationHost {
66
66
  moduleInfo: RemoteInfo;
67
67
  }], Promise<(() => Promise<Module>) | undefined>>;
68
68
  }>;
69
+ bridgeHook: PluginSystem<{
70
+ beforeBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
71
+ afterBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
72
+ beforeBridgeDestroy: SyncHook<[Record<string, any>], void | Record<string, any>>;
73
+ afterBridgeDestroy: SyncHook<[Record<string, any>], void | Record<string, any>>;
74
+ }>;
69
75
  constructor(userOptions: UserOptions);
70
76
  initOptions(userOptions: UserOptions): Options;
71
77
  loadShare<T>(pkgName: string, extraOptions?: {
@@ -78,6 +78,12 @@ export declare class FederationHost implements IndexModule.FederationHost {
78
78
  moduleInfo: import("./type").RemoteInfo;
79
79
  }], Promise<(() => Promise<IndexModule.Module>) | undefined>>;
80
80
  }>;
81
+ get bridgeHook(): import("./utils/hooks").PluginSystem<{
82
+ beforeBridgeRender: import("./utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
83
+ afterBridgeRender: import("./utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
84
+ beforeBridgeDestroy: import("./utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
85
+ afterBridgeDestroy: import("./utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
86
+ }>;
81
87
  initOptions(...args: Parameters<IndexModule.FederationHost['initOptions']>): import("./type").Options;
82
88
  loadShare<T>(...args: Parameters<IndexModule.FederationHost['loadShare']>): Promise<false | (() => T | undefined)>;
83
89
  loadShareSync<T>(...args: Parameters<IndexModule.FederationHost['loadShareSync']>): () => T | never;
@@ -32,6 +32,11 @@ export declare class SnapshotHandler {
32
32
  remoteSnapshot: ModuleInfo;
33
33
  from: "global" | "manifest";
34
34
  }>;
35
+ afterLoadSnapshot: AsyncWaterfallHook<{
36
+ options: Options;
37
+ moduleInfo: Remote;
38
+ remoteSnapshot: ModuleInfo;
39
+ }>;
35
40
  }>;
36
41
  loaderHook: FederationHost['loaderHook'];
37
42
  manifestLoading: Record<string, Promise<ModuleInfo>>;
@@ -4,7 +4,7 @@ export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
4
4
  export type PartialOptional<T, K extends keyof T> = Omit<T, K> & {
5
5
  [P in K]-?: T[P];
6
6
  };
7
- interface RemoteInfoCommon {
7
+ export interface RemoteInfoCommon {
8
8
  alias?: string;
9
9
  shareScope?: string;
10
10
  type?: RemoteEntryType;
@@ -15,6 +15,10 @@ type ModuleLifeCycle = Module['host']['loaderHook']['lifecycle'];
15
15
  type ModuleLifeCycleCyclePartial = Partial<{
16
16
  [k in keyof ModuleLifeCycle]: Parameters<ModuleLifeCycle[k]['on']>[0];
17
17
  }>;
18
+ type ModuleBridgeLifeCycle = Module['host']['bridgeHook']['lifecycle'];
19
+ type ModuleBridgeLifeCycleCyclePartial = Partial<{
20
+ [k in keyof ModuleBridgeLifeCycle]: Parameters<ModuleBridgeLifeCycle[k]['on']>[0];
21
+ }>;
18
22
  type SharedLifeCycle = SharedHandler['hooks']['lifecycle'];
19
23
  type SharedLifeCycleCyclePartial = Partial<{
20
24
  [k in keyof SharedLifeCycle]: Parameters<SharedLifeCycle[k]['on']>[0];
@@ -23,7 +27,7 @@ type RemoteLifeCycle = RemoteHandler['hooks']['lifecycle'];
23
27
  type RemoteLifeCycleCyclePartial = Partial<{
24
28
  [k in keyof RemoteLifeCycle]: Parameters<RemoteLifeCycle[k]['on']>[0];
25
29
  }>;
26
- export type FederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & {
30
+ export type FederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & ModuleBridgeLifeCycleCyclePartial & {
27
31
  name: string;
28
32
  version?: string;
29
33
  };
@@ -1,4 +1,4 @@
1
1
  import { FederationHost } from '../core';
2
2
  import { UserOptions } from '../type';
3
3
  import { Module } from '../module';
4
- export declare function registerPlugins(plugins: UserOptions['plugins'], hookInstances: Array<FederationHost['hooks'] | FederationHost['snapshotHandler']['hooks'] | FederationHost['sharedHandler']['hooks'] | FederationHost['remoteHandler']['hooks'] | Module['host']['loaderHook']>): import("../type").FederationRuntimePlugin[] | undefined;
4
+ export declare function registerPlugins(plugins: UserOptions['plugins'], hookInstances: Array<FederationHost['hooks'] | FederationHost['snapshotHandler']['hooks'] | FederationHost['sharedHandler']['hooks'] | FederationHost['remoteHandler']['hooks'] | Module['host']['loaderHook'] | Module['host']['bridgeHook']>): import("../type").FederationRuntimePlugin[] | undefined;
@@ -15,3 +15,4 @@ export declare function getRemoteEntryInfoFromSnapshot(snapshot: ModuleInfo): {
15
15
  type: RemoteEntryType;
16
16
  globalName: string;
17
17
  };
18
+ export declare const processModuleAlias: (name: string, subPath: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
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.3",
54
- "@module-federation/error-codes": "0.7.3"
53
+ "@module-federation/sdk": "0.7.5",
54
+ "@module-federation/error-codes": "0.7.5"
55
55
  }
56
56
  }