@module-federation/runtime
Advanced tools
Comparing version 0.0.0-next-20240309014600 to 0.0.0-next-20240310052320
{ | ||
"name": "@module-federation/runtime", | ||
"version": "0.0.15", | ||
"version": "0.0.14", | ||
"author": "zhouxiao <codingzx@gmail.com>", | ||
@@ -5,0 +5,0 @@ "main": "./index.cjs.js", |
@@ -188,3 +188,3 @@ 'use strict'; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.15"; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.14"; | ||
} | ||
@@ -191,0 +191,0 @@ } |
@@ -186,3 +186,3 @@ function getBuilderId() { | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.15"; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.14"; | ||
} | ||
@@ -807,2 +807,2 @@ } | ||
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, isBrowserEnv as x, getBuilderId as y, addUniqueItem as z }; | ||
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 }; |
@@ -70,6 +70,4 @@ import type { ModuleInfo, GlobalModuleInfo } from '@module-federation/sdk'; | ||
name: string; | ||
remote: Remote; | ||
remoteSnapshot: ModuleInfo; | ||
preloadConfig: PreloadRemoteArgs; | ||
origin: FederationHost; | ||
}, void>; | ||
@@ -159,3 +157,8 @@ errorLoadRemote: AsyncHook<[{ | ||
private setShared; | ||
private removeRemote; | ||
private registerRemote; | ||
registerRemotes(remotes: Remote[], options?: { | ||
force?: boolean; | ||
}): void; | ||
} | ||
export {}; |
@@ -5,3 +5,2 @@ import { FederationHost } from './core'; | ||
export { registerGlobalPlugins } from './global'; | ||
export { getRemoteEntry, getRemoteInfo } from './utils'; | ||
export { loadScript, loadScriptNode } from '@module-federation/sdk'; | ||
@@ -15,1 +14,2 @@ export type { Federation } from './global'; | ||
export declare function preloadRemote(...args: Parameters<FederationHost['preloadRemote']>): ReturnType<FederationHost['preloadRemote']>; | ||
export declare function registerRemotes(...args: Parameters<FederationHost['registerRemotes']>): ReturnType<FederationHost['registerRemotes']>; |
@@ -6,2 +6,1 @@ export * from './env'; | ||
export * from './plugin'; | ||
export * from './load'; |
@@ -12,2 +12,3 @@ import { Remote, RemoteEntryExports, RemoteInfo } from '../type'; | ||
}): Promise<RemoteEntryExports>; | ||
export declare function getRemoteEntryUniqueKey(remoteInfo: RemoteInfo): string; | ||
export declare function getRemoteEntry({ remoteEntryExports, remoteInfo, createScriptHook, }: { | ||
@@ -14,0 +15,0 @@ remoteInfo: RemoteInfo; |
{ | ||
"name": "@module-federation/runtime", | ||
"version": "0.0.0-next-20240309014600", | ||
"version": "0.0.0-next-20240310052320", | ||
"author": "zhouxiao <codingzx@gmail.com>", | ||
@@ -48,4 +48,4 @@ "main": "./dist/index.cjs", | ||
"dependencies": { | ||
"@module-federation/sdk": "0.0.0-next-20240309014600" | ||
"@module-federation/sdk": "0.0.0-next-20240310052320" | ||
} | ||
} |
@@ -215,11 +215,11 @@ # `@module-federation/runtime` | ||
name: '@demo/sub1', | ||
entry: 'http://localhost:2001/vmok-manifest.json', | ||
entry: 'http://localhost:2001/mf-manifest.json', | ||
}, | ||
{ | ||
name: '@demo/sub2', | ||
entry: 'http://localhost:2001/vmok-manifest.json', | ||
entry: 'http://localhost:2001/mf-manifest.json', | ||
}, | ||
{ | ||
name: '@demo/sub3', | ||
entry: 'http://localhost:2001/vmok-manifest.json', | ||
entry: 'http://localhost:2001/mf-manifest.json', | ||
}, | ||
@@ -262,2 +262,69 @@ ], | ||
### registerRemotes | ||
- Type: `registerRemotes(remotes: Remote[], options?: { force?: boolean }): void` | ||
- Used to register remotes after init . | ||
- Type | ||
```typescript | ||
function registerRemotes(remotes: Remote[], options?: { force?: boolean }) {} | ||
type Remote = (RemoteWithEntry | RemoteWithVersion) & RemoteInfoCommon; | ||
interface RemoteInfoCommon { | ||
alias?: string; | ||
shareScope?: string; | ||
type?: RemoteEntryType; | ||
entryGlobalName?: string; | ||
} | ||
interface RemoteWithEntry { | ||
name: string; | ||
entry: string; | ||
} | ||
interface RemoteWithVersion { | ||
name: string; | ||
version: string; | ||
} | ||
``` | ||
- Details | ||
**info**: Please be careful when setting `force:true` ! | ||
If set `force: true`, it will merge remote(include loaded remote), and remove loaded remote cache , as well as console.warn to tell this action may have risks. | ||
* Example | ||
```ts | ||
import { init, registerRemotes } from '@module-federation/runtime'; | ||
init({ | ||
name: '@demo/register-new-remotes', | ||
remotes: [ | ||
{ | ||
name: '@demo/sub1', | ||
entry: 'http://localhost:2001/mf-manifest.json', | ||
} | ||
], | ||
}); | ||
// add new remote @demo/sub2 | ||
registerRemotes([ | ||
{ | ||
name: '@demo/sub2', | ||
entry: 'http://localhost:2002/mf-manifest.json', | ||
} | ||
]); | ||
// override previous remote @demo/sub1 | ||
registerRemotes([ | ||
{ | ||
name: '@demo/sub1', | ||
entry: 'http://localhost:2003/mf-manifest.json', | ||
} | ||
]); | ||
``` | ||
## hooks | ||
@@ -264,0 +331,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
265378
5821
751
+ Added@module-federation/sdk@0.0.0-next-20240310052320(transitive)
- Removed@module-federation/sdk@0.0.0-next-20240309014600(transitive)