@module-federation/runtime 0.0.0-next-20240808030043 → 0.0.0-next-20240808083234
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 +6 -3
- package/dist/index.esm.js +6 -4
- package/dist/src/core.d.ts +3 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/module/index.d.ts +2 -1
- package/dist/src/remote/index.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -269,7 +269,7 @@ let Module = class Module {
|
|
|
269
269
|
return this.remoteEntryExports;
|
|
270
270
|
}
|
|
271
271
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
272
|
-
async get(id, expose, options) {
|
|
272
|
+
async get(id, expose, options, remoteSnapshot) {
|
|
273
273
|
const { loadFactory = true } = options || {
|
|
274
274
|
loadFactory: true
|
|
275
275
|
};
|
|
@@ -302,6 +302,8 @@ let Module = class Module {
|
|
|
302
302
|
});
|
|
303
303
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
304
304
|
await this.host.hooks.lifecycle.initContainer.emit(_extends$6({}, initContainerOptions, {
|
|
305
|
+
id,
|
|
306
|
+
remoteSnapshot,
|
|
305
307
|
remoteEntryExports
|
|
306
308
|
}));
|
|
307
309
|
}
|
|
@@ -1644,8 +1646,8 @@ class RemoteHandler {
|
|
|
1644
1646
|
const { module, moduleOptions, remoteMatchInfo } = await this.getRemoteModuleAndOptions({
|
|
1645
1647
|
id
|
|
1646
1648
|
});
|
|
1647
|
-
const { pkgNameOrAlias, remote, expose, id: idRes } = remoteMatchInfo;
|
|
1648
|
-
const moduleOrFactory = await module.get(idRes, expose, options);
|
|
1649
|
+
const { pkgNameOrAlias, remote, expose, id: idRes, remoteSnapshot } = remoteMatchInfo;
|
|
1650
|
+
const moduleOrFactory = await module.get(idRes, expose, options, remoteSnapshot);
|
|
1649
1651
|
const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({
|
|
1650
1652
|
id: idRes,
|
|
1651
1653
|
pkgNameOrAlias,
|
|
@@ -2171,6 +2173,7 @@ Object.defineProperty(exports, 'loadScriptNode', {
|
|
|
2171
2173
|
get: function () { return sdk.loadScriptNode; }
|
|
2172
2174
|
});
|
|
2173
2175
|
exports.FederationHost = FederationHost;
|
|
2176
|
+
exports.Module = Module;
|
|
2174
2177
|
exports.getInstance = getInstance;
|
|
2175
2178
|
exports.getRemoteEntry = getRemoteEntry;
|
|
2176
2179
|
exports.getRemoteInfo = getRemoteInfo;
|
package/dist/index.esm.js
CHANGED
|
@@ -267,7 +267,7 @@ let Module = class Module {
|
|
|
267
267
|
return this.remoteEntryExports;
|
|
268
268
|
}
|
|
269
269
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
270
|
-
async get(id, expose, options) {
|
|
270
|
+
async get(id, expose, options, remoteSnapshot) {
|
|
271
271
|
const { loadFactory = true } = options || {
|
|
272
272
|
loadFactory: true
|
|
273
273
|
};
|
|
@@ -300,6 +300,8 @@ let Module = class Module {
|
|
|
300
300
|
});
|
|
301
301
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
302
302
|
await this.host.hooks.lifecycle.initContainer.emit(_extends$6({}, initContainerOptions, {
|
|
303
|
+
id,
|
|
304
|
+
remoteSnapshot,
|
|
303
305
|
remoteEntryExports
|
|
304
306
|
}));
|
|
305
307
|
}
|
|
@@ -1642,8 +1644,8 @@ class RemoteHandler {
|
|
|
1642
1644
|
const { module, moduleOptions, remoteMatchInfo } = await this.getRemoteModuleAndOptions({
|
|
1643
1645
|
id
|
|
1644
1646
|
});
|
|
1645
|
-
const { pkgNameOrAlias, remote, expose, id: idRes } = remoteMatchInfo;
|
|
1646
|
-
const moduleOrFactory = await module.get(idRes, expose, options);
|
|
1647
|
+
const { pkgNameOrAlias, remote, expose, id: idRes, remoteSnapshot } = remoteMatchInfo;
|
|
1648
|
+
const moduleOrFactory = await module.get(idRes, expose, options, remoteSnapshot);
|
|
1647
1649
|
const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({
|
|
1648
1650
|
id: idRes,
|
|
1649
1651
|
pkgNameOrAlias,
|
|
@@ -2159,4 +2161,4 @@ function getInstance() {
|
|
|
2159
2161
|
// Inject for debug
|
|
2160
2162
|
setGlobalFederationConstructor(FederationHost);
|
|
2161
2163
|
|
|
2162
|
-
export { FederationHost, getInstance, getRemoteEntry, getRemoteInfo, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerPlugins, registerRemotes };
|
|
2164
|
+
export { FederationHost, Module, getInstance, getRemoteEntry, getRemoteInfo, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerPlugins, registerRemotes };
|
package/dist/src/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateScriptHookReturn } from '@module-federation/sdk';
|
|
1
|
+
import type { CreateScriptHookReturn, ModuleInfo } from '@module-federation/sdk';
|
|
2
2
|
import { Options, PreloadRemoteArgs, RemoteEntryExports, Remote, Shared, ShareInfos, UserOptions, RemoteInfo, ShareScopeMap, InitScope, RemoteEntryInitOptions } from './type';
|
|
3
3
|
import { Module } from './module';
|
|
4
4
|
import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHook } from './utils/hooks';
|
|
@@ -32,6 +32,8 @@ export declare class FederationHost {
|
|
|
32
32
|
remoteInfo: RemoteInfo;
|
|
33
33
|
remoteEntryExports: RemoteEntryExports;
|
|
34
34
|
origin: FederationHost;
|
|
35
|
+
id: string;
|
|
36
|
+
remoteSnapshot?: ModuleInfo;
|
|
35
37
|
}>;
|
|
36
38
|
}>;
|
|
37
39
|
version: string;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { FederationHost } from './core';
|
|
|
4
4
|
export { registerGlobalPlugins } from './global';
|
|
5
5
|
export { getRemoteEntry, getRemoteInfo } from './utils';
|
|
6
6
|
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
7
|
+
export { Module } from './module';
|
|
7
8
|
export type { Federation } from './global';
|
|
8
9
|
export type { FederationRuntimePlugin };
|
|
9
10
|
export declare function init(options: UserOptions): FederationHost;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModuleInfo } from '@module-federation/sdk';
|
|
1
2
|
import { FederationHost } from '../core';
|
|
2
3
|
import { RemoteEntryExports, RemoteInfo } from '../type';
|
|
3
4
|
export type ModuleOptions = ConstructorParameters<typeof Module>[0];
|
|
@@ -14,7 +15,7 @@ declare class Module {
|
|
|
14
15
|
getEntry(): Promise<RemoteEntryExports>;
|
|
15
16
|
get(id: string, expose: string, options?: {
|
|
16
17
|
loadFactory?: boolean;
|
|
17
|
-
}): Promise<any>;
|
|
18
|
+
}, remoteSnapshot?: ModuleInfo): Promise<any>;
|
|
18
19
|
private wraperFactory;
|
|
19
20
|
}
|
|
20
21
|
export { Module };
|
|
@@ -44,14 +44,14 @@ export declare class RemoteHandler {
|
|
|
44
44
|
exposeModuleFactory: any;
|
|
45
45
|
moduleInstance: Module;
|
|
46
46
|
}], void>;
|
|
47
|
-
handlePreloadModule: SyncHook<{
|
|
47
|
+
handlePreloadModule: SyncHook<[{
|
|
48
48
|
id: string;
|
|
49
49
|
name: string;
|
|
50
50
|
remote: Remote;
|
|
51
51
|
remoteSnapshot: ModuleInfo;
|
|
52
52
|
preloadConfig: PreloadRemoteArgs;
|
|
53
53
|
origin: FederationHost;
|
|
54
|
-
}, void>;
|
|
54
|
+
}], void>;
|
|
55
55
|
errorLoadRemote: AsyncHook<[{
|
|
56
56
|
id: string;
|
|
57
57
|
error: unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240808083234",
|
|
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.0.0-next-
|
|
48
|
+
"@module-federation/sdk": "0.0.0-next-20240808083234"
|
|
49
49
|
}
|
|
50
50
|
}
|