@module-federation/runtime-core 0.0.0-next-20250703101410 → 0.0.0-next-20250704061325
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.cjs +4 -9
- package/dist/index.esm.js +4 -9
- package/dist/src/core.d.ts +6 -7
- package/dist/src/global.d.ts +10 -10
- package/dist/src/index.d.ts +2 -2
- package/dist/src/module/index.d.ts +3 -3
- package/dist/src/plugins/generate-preload-assets.d.ts +4 -4
- package/dist/src/plugins/snapshot/SnapshotHandler.d.ts +6 -6
- package/dist/src/plugins/snapshot/index.d.ts +2 -2
- package/dist/src/remote/index.d.ts +14 -14
- package/dist/src/shared/index.d.ts +6 -6
- package/dist/src/type/config.d.ts +2 -2
- package/dist/src/type/plugin.d.ts +3 -3
- package/dist/src/utils/load.d.ts +2 -2
- package/dist/src/utils/plugin.d.ts +2 -2
- package/dist/src/utils/preload.d.ts +2 -2
- package/package.json +3 -3
package/dist/index.cjs.cjs
CHANGED
|
@@ -196,7 +196,7 @@ function getGlobalFederationConstructor() {
|
|
|
196
196
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
|
|
197
197
|
if (isDebug) {
|
|
198
198
|
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
199
|
-
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.
|
|
199
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.16.0";
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -2918,7 +2918,7 @@ class RemoteHandler {
|
|
|
2918
2918
|
}
|
|
2919
2919
|
|
|
2920
2920
|
const USE_SNAPSHOT = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN === 'boolean' ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : true; // Default to true (use snapshot) when not explicitly defined
|
|
2921
|
-
class
|
|
2921
|
+
class FederationHost {
|
|
2922
2922
|
initOptions(userOptions) {
|
|
2923
2923
|
this.registerPlugins(userOptions.plugins);
|
|
2924
2924
|
const options = this.formatOptions(this.options, userOptions);
|
|
@@ -3015,11 +3015,6 @@ class ModuleFederation {
|
|
|
3015
3015
|
registerRemotes(remotes, options) {
|
|
3016
3016
|
return this.remoteHandler.registerRemotes(remotes, options);
|
|
3017
3017
|
}
|
|
3018
|
-
registerShared(shared) {
|
|
3019
|
-
this.sharedHandler.registerShared(this.options, polyfills._extends({}, this.options, {
|
|
3020
|
-
shared
|
|
3021
|
-
}));
|
|
3022
|
-
}
|
|
3023
3018
|
constructor(userOptions){
|
|
3024
3019
|
this.hooks = new PluginSystem({
|
|
3025
3020
|
beforeInit: new SyncWaterfallHook('beforeInit'),
|
|
@@ -3029,7 +3024,7 @@ class ModuleFederation {
|
|
|
3029
3024
|
// maybe will change, temporarily for internal use only
|
|
3030
3025
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
3031
3026
|
});
|
|
3032
|
-
this.version = "0.
|
|
3027
|
+
this.version = "0.16.0";
|
|
3033
3028
|
this.moduleCache = new Map();
|
|
3034
3029
|
this.loaderHook = new PluginSystem({
|
|
3035
3030
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -3081,9 +3076,9 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3081
3076
|
exports.loadScript = sdk.loadScript;
|
|
3082
3077
|
exports.loadScriptNode = sdk.loadScriptNode;
|
|
3083
3078
|
exports.CurrentGlobal = CurrentGlobal;
|
|
3079
|
+
exports.FederationHost = FederationHost;
|
|
3084
3080
|
exports.Global = Global;
|
|
3085
3081
|
exports.Module = Module;
|
|
3086
|
-
exports.ModuleFederation = ModuleFederation;
|
|
3087
3082
|
exports.addGlobalSnapshot = addGlobalSnapshot;
|
|
3088
3083
|
exports.assert = assert;
|
|
3089
3084
|
exports.getGlobalFederationConstructor = getGlobalFederationConstructor;
|
package/dist/index.esm.js
CHANGED
|
@@ -195,7 +195,7 @@ function getGlobalFederationConstructor() {
|
|
|
195
195
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
196
196
|
if (isDebug) {
|
|
197
197
|
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
198
|
-
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.
|
|
198
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.16.0";
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -2917,7 +2917,7 @@ class RemoteHandler {
|
|
|
2917
2917
|
}
|
|
2918
2918
|
|
|
2919
2919
|
const USE_SNAPSHOT = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN === 'boolean' ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : true; // Default to true (use snapshot) when not explicitly defined
|
|
2920
|
-
class
|
|
2920
|
+
class FederationHost {
|
|
2921
2921
|
initOptions(userOptions) {
|
|
2922
2922
|
this.registerPlugins(userOptions.plugins);
|
|
2923
2923
|
const options = this.formatOptions(this.options, userOptions);
|
|
@@ -3014,11 +3014,6 @@ class ModuleFederation {
|
|
|
3014
3014
|
registerRemotes(remotes, options) {
|
|
3015
3015
|
return this.remoteHandler.registerRemotes(remotes, options);
|
|
3016
3016
|
}
|
|
3017
|
-
registerShared(shared) {
|
|
3018
|
-
this.sharedHandler.registerShared(this.options, _extends({}, this.options, {
|
|
3019
|
-
shared
|
|
3020
|
-
}));
|
|
3021
|
-
}
|
|
3022
3017
|
constructor(userOptions){
|
|
3023
3018
|
this.hooks = new PluginSystem({
|
|
3024
3019
|
beforeInit: new SyncWaterfallHook('beforeInit'),
|
|
@@ -3028,7 +3023,7 @@ class ModuleFederation {
|
|
|
3028
3023
|
// maybe will change, temporarily for internal use only
|
|
3029
3024
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
3030
3025
|
});
|
|
3031
|
-
this.version = "0.
|
|
3026
|
+
this.version = "0.16.0";
|
|
3032
3027
|
this.moduleCache = new Map();
|
|
3033
3028
|
this.loaderHook = new PluginSystem({
|
|
3034
3029
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -3077,4 +3072,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3077
3072
|
__proto__: null
|
|
3078
3073
|
});
|
|
3079
3074
|
|
|
3080
|
-
export { CurrentGlobal, Global, Module,
|
|
3075
|
+
export { CurrentGlobal, FederationHost, Global, Module, addGlobalSnapshot, assert, getGlobalFederationConstructor, getGlobalSnapshot, getInfoWithoutType, getRegisteredShare, getRemoteEntry, getRemoteInfo, helpers, isStaticResourcesEqual, matchRemoteWithNameAndExpose, registerGlobalPlugins, resetFederationGlobalInfo, safeWrapper, satisfy, setGlobalFederationConstructor, setGlobalFederationInstance, index as types };
|
package/dist/src/core.d.ts
CHANGED
|
@@ -6,25 +6,25 @@ import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHoo
|
|
|
6
6
|
import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler';
|
|
7
7
|
import { SharedHandler } from './shared';
|
|
8
8
|
import { RemoteHandler } from './remote';
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class FederationHost {
|
|
10
10
|
options: Options;
|
|
11
11
|
hooks: PluginSystem<{
|
|
12
12
|
beforeInit: SyncWaterfallHook<{
|
|
13
13
|
userOptions: UserOptions;
|
|
14
14
|
options: Options;
|
|
15
|
-
origin:
|
|
15
|
+
origin: FederationHost;
|
|
16
16
|
shareInfo: ShareInfos;
|
|
17
17
|
}>;
|
|
18
18
|
init: SyncHook<[{
|
|
19
19
|
options: Options;
|
|
20
|
-
origin:
|
|
20
|
+
origin: FederationHost;
|
|
21
21
|
}], void>;
|
|
22
22
|
beforeInitContainer: AsyncWaterfallHook<{
|
|
23
23
|
shareScope: ShareScopeMap[string];
|
|
24
24
|
initScope: InitScope;
|
|
25
25
|
remoteEntryInitOptions: RemoteEntryInitOptions;
|
|
26
26
|
remoteInfo: RemoteInfo;
|
|
27
|
-
origin:
|
|
27
|
+
origin: FederationHost;
|
|
28
28
|
}>;
|
|
29
29
|
initContainer: AsyncWaterfallHook<{
|
|
30
30
|
shareScope: ShareScopeMap[string];
|
|
@@ -32,7 +32,7 @@ export declare class ModuleFederation {
|
|
|
32
32
|
remoteEntryInitOptions: RemoteEntryInitOptions;
|
|
33
33
|
remoteInfo: RemoteInfo;
|
|
34
34
|
remoteEntryExports: RemoteEntryExports;
|
|
35
|
-
origin:
|
|
35
|
+
origin: FederationHost;
|
|
36
36
|
id: string;
|
|
37
37
|
remoteSnapshot?: ModuleInfo;
|
|
38
38
|
}>;
|
|
@@ -63,7 +63,7 @@ export declare class ModuleFederation {
|
|
|
63
63
|
fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
64
64
|
loadEntryError: AsyncHook<[{
|
|
65
65
|
getRemoteEntry: typeof getRemoteEntry;
|
|
66
|
-
origin:
|
|
66
|
+
origin: FederationHost;
|
|
67
67
|
remoteInfo: RemoteInfo;
|
|
68
68
|
remoteEntryExports?: RemoteEntryExports | undefined;
|
|
69
69
|
globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
|
|
@@ -111,5 +111,4 @@ export declare class ModuleFederation {
|
|
|
111
111
|
registerRemotes(remotes: Remote[], options?: {
|
|
112
112
|
force?: boolean;
|
|
113
113
|
}): void;
|
|
114
|
-
registerShared(shared: UserOptions['shared']): void;
|
|
115
114
|
}
|
package/dist/src/global.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FederationHost } from './core';
|
|
2
2
|
import { RemoteEntryExports, GlobalShareScopeMap, Remote, Optional } from './type';
|
|
3
3
|
import { GlobalModuleInfo, ModuleInfo } from '@module-federation/sdk';
|
|
4
|
-
import {
|
|
4
|
+
import { FederationRuntimePlugin } from './type/plugin';
|
|
5
5
|
export interface Federation {
|
|
6
|
-
__GLOBAL_PLUGIN__: Array<
|
|
6
|
+
__GLOBAL_PLUGIN__: Array<FederationRuntimePlugin>;
|
|
7
7
|
__DEBUG_CONSTRUCTOR_VERSION__?: string;
|
|
8
8
|
moduleInfo: GlobalModuleInfo;
|
|
9
|
-
__DEBUG_CONSTRUCTOR__?: typeof
|
|
10
|
-
__INSTANCES__: Array<
|
|
9
|
+
__DEBUG_CONSTRUCTOR__?: typeof FederationHost;
|
|
10
|
+
__INSTANCES__: Array<FederationHost>;
|
|
11
11
|
__SHARE__: GlobalShareScopeMap;
|
|
12
12
|
__MANIFEST_LOADING__: Record<string, Promise<ModuleInfo>>;
|
|
13
13
|
__PRELOADED_MAP__: Map<string, boolean>;
|
|
@@ -20,9 +20,9 @@ declare global {
|
|
|
20
20
|
}
|
|
21
21
|
export declare const globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
|
|
22
22
|
export declare function resetFederationGlobalInfo(): void;
|
|
23
|
-
export declare function setGlobalFederationInstance(FederationInstance:
|
|
24
|
-
export declare function getGlobalFederationConstructor(): typeof
|
|
25
|
-
export declare function setGlobalFederationConstructor(FederationConstructor: typeof
|
|
23
|
+
export declare function setGlobalFederationInstance(FederationInstance: FederationHost): void;
|
|
24
|
+
export declare function getGlobalFederationConstructor(): typeof FederationHost | undefined;
|
|
25
|
+
export declare function setGlobalFederationConstructor(FederationConstructor: typeof FederationHost | undefined, isDebug?: boolean): void;
|
|
26
26
|
export declare function getInfoWithoutType<T extends object>(target: T, key: keyof T): {
|
|
27
27
|
value: T[keyof T] | undefined;
|
|
28
28
|
key: string;
|
|
@@ -36,7 +36,7 @@ export declare const getRemoteEntryExports: (name: string, globalName: string |
|
|
|
36
36
|
remoteEntryKey: string;
|
|
37
37
|
entryExports: RemoteEntryExports | undefined;
|
|
38
38
|
};
|
|
39
|
-
export declare const registerGlobalPlugins: (plugins: Array<
|
|
40
|
-
export declare const getGlobalHostPlugins: () => Array<
|
|
39
|
+
export declare const registerGlobalPlugins: (plugins: Array<FederationRuntimePlugin>) => void;
|
|
40
|
+
export declare const getGlobalHostPlugins: () => Array<FederationRuntimePlugin>;
|
|
41
41
|
export declare const getPreloaded: (id: string) => boolean | undefined;
|
|
42
42
|
export declare const setPreloaded: (id: string) => Map<string, boolean>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import helpers, { type IGlobalUtils, type IShareUtils } from './helpers';
|
|
2
|
-
export {
|
|
2
|
+
export { FederationHost } from './core';
|
|
3
3
|
export { type Federation, CurrentGlobal, Global, getGlobalFederationConstructor, setGlobalFederationInstance, setGlobalFederationConstructor, resetFederationGlobalInfo, addGlobalSnapshot, getGlobalSnapshot, getInfoWithoutType, } from './global';
|
|
4
|
-
export type { UserOptions,
|
|
4
|
+
export type { UserOptions, FederationRuntimePlugin } from './type';
|
|
5
5
|
export { assert } from './utils/logger';
|
|
6
6
|
export { registerGlobalPlugins } from './global';
|
|
7
7
|
export { getRemoteEntry, getRemoteInfo, isStaticResourcesEqual, matchRemoteWithNameAndExpose, safeWrapper, } from './utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleInfo } from '@module-federation/sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { FederationHost } from '../core';
|
|
3
3
|
import { RemoteEntryExports, RemoteInfo } from '../type';
|
|
4
4
|
export type ModuleOptions = ConstructorParameters<typeof Module>[0];
|
|
5
5
|
declare class Module {
|
|
@@ -7,10 +7,10 @@ declare class Module {
|
|
|
7
7
|
inited: boolean;
|
|
8
8
|
remoteEntryExports?: RemoteEntryExports;
|
|
9
9
|
lib: RemoteEntryExports | undefined;
|
|
10
|
-
host:
|
|
10
|
+
host: FederationHost;
|
|
11
11
|
constructor({ remoteInfo, host, }: {
|
|
12
12
|
remoteInfo: RemoteInfo;
|
|
13
|
-
host:
|
|
13
|
+
host: FederationHost;
|
|
14
14
|
});
|
|
15
15
|
getEntry(): Promise<RemoteEntryExports>;
|
|
16
16
|
get(id: string, expose: string, options?: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GlobalModuleInfo, ModuleInfo } from '@module-federation/sdk';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FederationRuntimePlugin, PreloadAssets, PreloadOptions, RemoteInfoOptionalVersion } from '../type';
|
|
3
|
+
import { FederationHost } from '../core';
|
|
4
4
|
declare global {
|
|
5
5
|
var __INIT_VMOK_DEPLOY_GLOBAL_DATA__: boolean | undefined;
|
|
6
6
|
}
|
|
7
|
-
export declare function generatePreloadAssets(origin:
|
|
8
|
-
export declare const generatePreloadAssetsPlugin: () =>
|
|
7
|
+
export declare function generatePreloadAssets(origin: FederationHost, preloadOptions: PreloadOptions[number], remote: RemoteInfoOptionalVersion, globalSnapshot: GlobalModuleInfo, remoteSnapshot: ModuleInfo): PreloadAssets;
|
|
8
|
+
export declare const generatePreloadAssetsPlugin: () => FederationRuntimePlugin;
|
|
@@ -2,15 +2,15 @@ import { GlobalModuleInfo, Manifest, ModuleInfo } from '@module-federation/sdk';
|
|
|
2
2
|
import { Options, Remote } from '../../type';
|
|
3
3
|
import { getGlobalSnapshot } from '../../global';
|
|
4
4
|
import { PluginSystem, AsyncHook, AsyncWaterfallHook } from '../../utils/hooks';
|
|
5
|
-
import {
|
|
6
|
-
export declare function getGlobalRemoteInfo(moduleInfo: Remote, origin:
|
|
5
|
+
import { FederationHost } from '../../core';
|
|
6
|
+
export declare function getGlobalRemoteInfo(moduleInfo: Remote, origin: FederationHost): {
|
|
7
7
|
hostGlobalSnapshot: ModuleInfo | undefined;
|
|
8
8
|
globalSnapshot: ReturnType<typeof getGlobalSnapshot>;
|
|
9
9
|
remoteSnapshot: GlobalModuleInfo[string] | undefined;
|
|
10
10
|
};
|
|
11
11
|
export declare class SnapshotHandler {
|
|
12
12
|
loadingHostSnapshot: Promise<GlobalModuleInfo | void> | null;
|
|
13
|
-
HostInstance:
|
|
13
|
+
HostInstance: FederationHost;
|
|
14
14
|
manifestCache: Map<string, Manifest>;
|
|
15
15
|
hooks: PluginSystem<{
|
|
16
16
|
beforeLoadRemoteSnapshot: AsyncHook<[{
|
|
@@ -34,15 +34,15 @@ export declare class SnapshotHandler {
|
|
|
34
34
|
}>;
|
|
35
35
|
afterLoadSnapshot: AsyncWaterfallHook<{
|
|
36
36
|
id?: string;
|
|
37
|
-
host:
|
|
37
|
+
host: FederationHost;
|
|
38
38
|
options: Options;
|
|
39
39
|
moduleInfo: Remote;
|
|
40
40
|
remoteSnapshot: ModuleInfo;
|
|
41
41
|
}>;
|
|
42
42
|
}>;
|
|
43
|
-
loaderHook:
|
|
43
|
+
loaderHook: FederationHost['loaderHook'];
|
|
44
44
|
manifestLoading: Record<string, Promise<ModuleInfo>>;
|
|
45
|
-
constructor(HostInstance:
|
|
45
|
+
constructor(HostInstance: FederationHost);
|
|
46
46
|
loadRemoteSnapshotInfo({ moduleInfo, id, expose, }: {
|
|
47
47
|
moduleInfo: Remote;
|
|
48
48
|
id?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleInfo } from '@module-federation/sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { FederationRuntimePlugin } from '../../type/plugin';
|
|
3
3
|
import { RemoteInfo } from '../../type';
|
|
4
4
|
export declare function assignRemoteInfo(remoteInfo: RemoteInfo, remoteSnapshot: ModuleInfo): void;
|
|
5
|
-
export declare function snapshotPlugin():
|
|
5
|
+
export declare function snapshotPlugin(): FederationRuntimePlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleInfo, GlobalModuleInfo } from '@module-federation/sdk';
|
|
2
2
|
import { Options, UserOptions, PreloadAssets, PreloadOptions, PreloadRemoteArgs, Remote, RemoteInfo, RemoteEntryExports, CallFrom } from '../type';
|
|
3
|
-
import {
|
|
3
|
+
import { FederationHost } from '../core';
|
|
4
4
|
import { PluginSystem, AsyncHook, AsyncWaterfallHook, SyncHook, SyncWaterfallHook } from '../utils/hooks';
|
|
5
5
|
import { Module, ModuleOptions } from '../module';
|
|
6
6
|
export interface LoadRemoteMatch {
|
|
@@ -9,12 +9,12 @@ export interface LoadRemoteMatch {
|
|
|
9
9
|
expose: string;
|
|
10
10
|
remote: Remote;
|
|
11
11
|
options: Options;
|
|
12
|
-
origin:
|
|
12
|
+
origin: FederationHost;
|
|
13
13
|
remoteInfo: RemoteInfo;
|
|
14
14
|
remoteSnapshot?: ModuleInfo;
|
|
15
15
|
}
|
|
16
16
|
export declare class RemoteHandler {
|
|
17
|
-
host:
|
|
17
|
+
host: FederationHost;
|
|
18
18
|
idToRemoteMap: Record<string, {
|
|
19
19
|
name: string;
|
|
20
20
|
expose: string;
|
|
@@ -22,16 +22,16 @@ export declare class RemoteHandler {
|
|
|
22
22
|
hooks: PluginSystem<{
|
|
23
23
|
beforeRegisterRemote: SyncWaterfallHook<{
|
|
24
24
|
remote: Remote;
|
|
25
|
-
origin:
|
|
25
|
+
origin: FederationHost;
|
|
26
26
|
}>;
|
|
27
27
|
registerRemote: SyncWaterfallHook<{
|
|
28
28
|
remote: Remote;
|
|
29
|
-
origin:
|
|
29
|
+
origin: FederationHost;
|
|
30
30
|
}>;
|
|
31
31
|
beforeRequest: AsyncWaterfallHook<{
|
|
32
32
|
id: string;
|
|
33
33
|
options: Options;
|
|
34
|
-
origin:
|
|
34
|
+
origin: FederationHost;
|
|
35
35
|
}>;
|
|
36
36
|
onLoad: AsyncHook<[{
|
|
37
37
|
id: string;
|
|
@@ -39,7 +39,7 @@ export declare class RemoteHandler {
|
|
|
39
39
|
pkgNameOrAlias: string;
|
|
40
40
|
remote: Remote;
|
|
41
41
|
options: ModuleOptions;
|
|
42
|
-
origin:
|
|
42
|
+
origin: FederationHost;
|
|
43
43
|
exposeModule: any;
|
|
44
44
|
exposeModuleFactory: any;
|
|
45
45
|
moduleInstance: Module;
|
|
@@ -50,7 +50,7 @@ export declare class RemoteHandler {
|
|
|
50
50
|
remote: Remote;
|
|
51
51
|
remoteSnapshot: ModuleInfo;
|
|
52
52
|
preloadConfig: PreloadRemoteArgs;
|
|
53
|
-
origin:
|
|
53
|
+
origin: FederationHost;
|
|
54
54
|
}], void>;
|
|
55
55
|
errorLoadRemote: AsyncHook<[{
|
|
56
56
|
id: string;
|
|
@@ -58,15 +58,15 @@ export declare class RemoteHandler {
|
|
|
58
58
|
options?: any;
|
|
59
59
|
from: CallFrom;
|
|
60
60
|
lifecycle: "beforeRequest" | "beforeLoadShare" | "afterResolve" | "onLoad";
|
|
61
|
-
origin:
|
|
61
|
+
origin: FederationHost;
|
|
62
62
|
}], unknown>;
|
|
63
63
|
beforePreloadRemote: AsyncHook<[{
|
|
64
64
|
preloadOps: Array<PreloadRemoteArgs>;
|
|
65
65
|
options: Options;
|
|
66
|
-
origin:
|
|
66
|
+
origin: FederationHost;
|
|
67
67
|
}], false | void | Promise<false | void>>;
|
|
68
68
|
generatePreloadAssets: AsyncHook<[{
|
|
69
|
-
origin:
|
|
69
|
+
origin: FederationHost;
|
|
70
70
|
preloadOptions: PreloadOptions[number];
|
|
71
71
|
remote: Remote;
|
|
72
72
|
remoteInfo: RemoteInfo;
|
|
@@ -76,15 +76,15 @@ export declare class RemoteHandler {
|
|
|
76
76
|
afterPreloadRemote: AsyncHook<{
|
|
77
77
|
preloadOps: Array<PreloadRemoteArgs>;
|
|
78
78
|
options: Options;
|
|
79
|
-
origin:
|
|
79
|
+
origin: FederationHost;
|
|
80
80
|
}, false | void | Promise<false | void>>;
|
|
81
81
|
loadEntry: AsyncHook<[{
|
|
82
|
-
loaderHook:
|
|
82
|
+
loaderHook: FederationHost["loaderHook"];
|
|
83
83
|
remoteInfo: RemoteInfo;
|
|
84
84
|
remoteEntryExports?: RemoteEntryExports;
|
|
85
85
|
}], Promise<RemoteEntryExports>>;
|
|
86
86
|
}>;
|
|
87
|
-
constructor(host:
|
|
87
|
+
constructor(host: FederationHost);
|
|
88
88
|
formatAndRegisterRemote(globalOptions: Options, userOptions: UserOptions): Remote[];
|
|
89
89
|
setIdToRemoteMap(id: string, remoteMatchInfo: LoadRemoteMatch): void;
|
|
90
90
|
loadRemote<T>(id: string, options?: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Federation } from '../global';
|
|
2
2
|
import { Options, ShareScopeMap, ShareInfos, Shared, UserOptions, ShareStrategy, InitScope, InitTokens, CallFrom } from '../type';
|
|
3
|
-
import {
|
|
3
|
+
import { FederationHost } from '../core';
|
|
4
4
|
import { PluginSystem, AsyncHook, AsyncWaterfallHook, SyncWaterfallHook } from '../utils/hooks';
|
|
5
5
|
import { LoadRemoteMatch } from '../remote';
|
|
6
6
|
export declare class SharedHandler {
|
|
7
|
-
host:
|
|
7
|
+
host: FederationHost;
|
|
8
8
|
shareScopeMap: ShareScopeMap;
|
|
9
9
|
hooks: PluginSystem<{
|
|
10
10
|
afterResolve: AsyncWaterfallHook<LoadRemoteMatch>;
|
|
@@ -12,9 +12,9 @@ export declare class SharedHandler {
|
|
|
12
12
|
pkgName: string;
|
|
13
13
|
shareInfo?: Shared;
|
|
14
14
|
shared: Options["shared"];
|
|
15
|
-
origin:
|
|
15
|
+
origin: FederationHost;
|
|
16
16
|
}>;
|
|
17
|
-
loadShare: AsyncHook<[
|
|
17
|
+
loadShare: AsyncHook<[FederationHost, string, ShareInfos], false | void | Promise<false | void>>;
|
|
18
18
|
resolveShare: SyncWaterfallHook<{
|
|
19
19
|
shareScopeMap: ShareScopeMap;
|
|
20
20
|
scope: string;
|
|
@@ -26,13 +26,13 @@ export declare class SharedHandler {
|
|
|
26
26
|
initContainerShareScopeMap: SyncWaterfallHook<{
|
|
27
27
|
shareScope: ShareScopeMap[string];
|
|
28
28
|
options: Options;
|
|
29
|
-
origin:
|
|
29
|
+
origin: FederationHost;
|
|
30
30
|
scopeName: string;
|
|
31
31
|
hostShareScopeMap?: ShareScopeMap;
|
|
32
32
|
}>;
|
|
33
33
|
}>;
|
|
34
34
|
initTokens: InitTokens;
|
|
35
|
-
constructor(host:
|
|
35
|
+
constructor(host: FederationHost);
|
|
36
36
|
registerShared(globalOptions: Options, userOptions: UserOptions): {
|
|
37
37
|
shareInfos: ShareInfos;
|
|
38
38
|
shared: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RemoteWithEntry, RemoteWithVersion, Module, RemoteEntryType } from '@module-federation/sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { FederationRuntimePlugin } from './plugin';
|
|
3
3
|
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];
|
|
@@ -88,7 +88,7 @@ export interface Options {
|
|
|
88
88
|
version?: string;
|
|
89
89
|
remotes: Array<Remote>;
|
|
90
90
|
shared: ShareInfos;
|
|
91
|
-
plugins: Array<
|
|
91
|
+
plugins: Array<FederationRuntimePlugin>;
|
|
92
92
|
inBrowser: boolean;
|
|
93
93
|
shareStrategy?: ShareStrategy;
|
|
94
94
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FederationHost } from '../core';
|
|
2
2
|
import { Module } from '../module';
|
|
3
3
|
import { SnapshotHandler } from '../plugins/snapshot/SnapshotHandler';
|
|
4
4
|
import { SharedHandler } from '../shared';
|
|
5
5
|
import { RemoteHandler } from '../remote';
|
|
6
|
-
type CoreLifeCycle =
|
|
6
|
+
type CoreLifeCycle = FederationHost['hooks']['lifecycle'];
|
|
7
7
|
type CoreLifeCyclePartial = Partial<{
|
|
8
8
|
[k in keyof CoreLifeCycle]: Parameters<CoreLifeCycle[k]['on']>[0];
|
|
9
9
|
}>;
|
|
@@ -27,7 +27,7 @@ type RemoteLifeCycle = RemoteHandler['hooks']['lifecycle'];
|
|
|
27
27
|
type RemoteLifeCycleCyclePartial = Partial<{
|
|
28
28
|
[k in keyof RemoteLifeCycle]: Parameters<RemoteLifeCycle[k]['on']>[0];
|
|
29
29
|
}>;
|
|
30
|
-
export type
|
|
30
|
+
export type FederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & ModuleBridgeLifeCycleCyclePartial & {
|
|
31
31
|
name: string;
|
|
32
32
|
version?: string;
|
|
33
33
|
};
|
package/dist/src/utils/load.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FederationHost } from '../core';
|
|
2
2
|
import { Remote, RemoteEntryExports, RemoteInfo } from '../type';
|
|
3
3
|
export declare function getRemoteEntryUniqueKey(remoteInfo: RemoteInfo): string;
|
|
4
4
|
export declare function getRemoteEntry({ origin, remoteEntryExports, remoteInfo, }: {
|
|
5
|
-
origin:
|
|
5
|
+
origin: FederationHost;
|
|
6
6
|
remoteInfo: RemoteInfo;
|
|
7
7
|
remoteEntryExports?: RemoteEntryExports | undefined;
|
|
8
8
|
}): Promise<RemoteEntryExports | false | void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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<
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PreloadAssets, PreloadConfig, PreloadOptions, PreloadRemoteArgs, Remote, RemoteInfo, depsPreloadArg } from '../type';
|
|
2
|
-
import {
|
|
2
|
+
import { FederationHost } from '../core';
|
|
3
3
|
export declare function defaultPreloadArgs(preloadConfig: PreloadRemoteArgs | depsPreloadArg): PreloadConfig;
|
|
4
4
|
export declare function formatPreloadArgs(remotes: Array<Remote>, preloadArgs: Array<PreloadRemoteArgs>): PreloadOptions;
|
|
5
5
|
export declare function normalizePreloadExposes(exposes?: string[]): string[];
|
|
6
|
-
export declare function preloadAssets(remoteInfo: RemoteInfo, host:
|
|
6
|
+
export declare function preloadAssets(remoteInfo: RemoteInfo, host: FederationHost, assets: PreloadAssets, useLinkPreload?: boolean): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime-core",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250704061325",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
6
6
|
"main": "./dist/index.cjs.cjs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
56
|
-
"@module-federation/error-codes": "0.0.0-next-
|
|
55
|
+
"@module-federation/sdk": "0.0.0-next-20250704061325",
|
|
56
|
+
"@module-federation/error-codes": "0.0.0-next-20250704061325"
|
|
57
57
|
}
|
|
58
58
|
}
|