@module-federation/webpack-bundler-runtime 2.6.0 → 2.8.0
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 +13 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -27
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/init.cjs +65 -62
- package/dist/init.cjs.map +1 -1
- package/dist/init.js +65 -62
- package/dist/init.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +4 -4
- package/dist/runtime-core/dist/core.d.ts +0 -198
- package/dist/runtime-core/dist/global.d.ts +0 -24
- package/dist/runtime-core/dist/helpers.d.ts +0 -1
- package/dist/runtime-core/dist/index.d.ts +0 -6
- package/dist/runtime-core/dist/module/index.d.ts +0 -33
- package/dist/runtime-core/dist/plugins/snapshot/SnapshotHandler.d.ts +0 -70
- package/dist/runtime-core/dist/remote/index.d.ts +0 -146
- package/dist/runtime-core/dist/shared/index.d.ts +0 -106
- package/dist/runtime-core/dist/type/config.d.ts +0 -117
- package/dist/runtime-core/dist/type/index.d.ts +0 -1
- package/dist/runtime-core/dist/type/plugin.d.ts +0 -28
- package/dist/runtime-core/dist/type/preload.d.ts +0 -55
- package/dist/runtime-core/dist/types.d.ts +0 -3
- package/dist/runtime-core/dist/utils/hooks/asyncHook.d.ts +0 -11
- package/dist/runtime-core/dist/utils/hooks/asyncWaterfallHooks.d.ts +0 -13
- package/dist/runtime-core/dist/utils/hooks/pluginSystem.d.ts +0 -20
- package/dist/runtime-core/dist/utils/hooks/syncHook.d.ts +0 -17
- package/dist/runtime-core/dist/utils/hooks/syncWaterfallHook.d.ts +0 -12
- package/dist/runtime-core/dist/utils/load.d.ts +0 -17
- package/dist/runtime-core/dist/utils/manifest.d.ts +0 -1
- package/dist/runtime-core/dist/utils/preload.d.ts +0 -1
- package/dist/runtime-core/dist/utils/share.d.ts +0 -1
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { SyncHook } from "./utils/hooks/syncHook.js";
|
|
2
|
-
import { AsyncHook } from "./utils/hooks/asyncHook.js";
|
|
3
|
-
import { SyncWaterfallHook } from "./utils/hooks/syncWaterfallHook.js";
|
|
4
|
-
import { AsyncWaterfallHook } from "./utils/hooks/asyncWaterfallHooks.js";
|
|
5
|
-
import { PluginSystem } from "./utils/hooks/pluginSystem.js";
|
|
6
|
-
import { CallFrom, InitScope, Options, Remote, RemoteEntryExports, RemoteEntryInitOptions, RemoteInfo, ShareInfos, ShareScopeMap, Shared, UserOptions } from "./type/config.js";
|
|
7
|
-
import { PreloadRemoteArgs, ResourceLoadContext } from "./type/preload.js";
|
|
8
|
-
import { RemoteHandler } from "./remote/index.js";
|
|
9
|
-
import { SharedHandler } from "./shared/index.js";
|
|
10
|
-
import { SnapshotHandler } from "./plugins/snapshot/SnapshotHandler.js";
|
|
11
|
-
import { getRemoteEntry } from "./utils/load.js";
|
|
12
|
-
import { Module$1, RemoteModuleFactory } from "./module/index.js";
|
|
13
|
-
import { CreateLinkHookReturnDom, CreateScriptHookReturn, GlobalModuleInfo, ModuleInfo } from "@module-federation/sdk";
|
|
14
|
-
|
|
15
|
-
//#region ../runtime-core/dist/core.d.ts
|
|
16
|
-
//#region src/core.d.ts
|
|
17
|
-
declare class ModuleFederation {
|
|
18
|
-
options: Options;
|
|
19
|
-
hooks: PluginSystem<{
|
|
20
|
-
beforeInit: SyncWaterfallHook<{
|
|
21
|
-
userOptions: UserOptions;
|
|
22
|
-
options: Options;
|
|
23
|
-
origin: ModuleFederation;
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated shareInfo will be removed soon, please use userOptions directly!
|
|
26
|
-
*/
|
|
27
|
-
shareInfo: ShareInfos;
|
|
28
|
-
}>;
|
|
29
|
-
init: SyncHook<[{
|
|
30
|
-
options: Options;
|
|
31
|
-
origin: ModuleFederation;
|
|
32
|
-
}], void>;
|
|
33
|
-
beforeInitContainer: AsyncWaterfallHook<{
|
|
34
|
-
shareScope: ShareScopeMap[string];
|
|
35
|
-
initScope: InitScope;
|
|
36
|
-
remoteEntryInitOptions: RemoteEntryInitOptions;
|
|
37
|
-
remoteInfo: RemoteInfo;
|
|
38
|
-
origin: ModuleFederation;
|
|
39
|
-
}>;
|
|
40
|
-
initContainer: AsyncWaterfallHook<{
|
|
41
|
-
shareScope: ShareScopeMap[string];
|
|
42
|
-
initScope: InitScope;
|
|
43
|
-
remoteEntryInitOptions: RemoteEntryInitOptions;
|
|
44
|
-
remoteInfo: RemoteInfo;
|
|
45
|
-
remoteEntryExports: RemoteEntryExports;
|
|
46
|
-
origin: ModuleFederation;
|
|
47
|
-
id?: string;
|
|
48
|
-
remoteSnapshot?: ModuleInfo;
|
|
49
|
-
}>;
|
|
50
|
-
}>;
|
|
51
|
-
version: string;
|
|
52
|
-
name: string;
|
|
53
|
-
moduleCache: Map<string, Module$1>;
|
|
54
|
-
snapshotHandler: SnapshotHandler;
|
|
55
|
-
sharedHandler: SharedHandler;
|
|
56
|
-
remoteHandler: RemoteHandler;
|
|
57
|
-
shareScopeMap: ShareScopeMap;
|
|
58
|
-
loaderHook: PluginSystem<{
|
|
59
|
-
getModuleInfo: SyncHook<[{
|
|
60
|
-
target: Record<string, any>;
|
|
61
|
-
key: any;
|
|
62
|
-
}], void | {
|
|
63
|
-
value: any | undefined;
|
|
64
|
-
key: string;
|
|
65
|
-
}>;
|
|
66
|
-
createScript: SyncHook<[{
|
|
67
|
-
url: string;
|
|
68
|
-
attrs?: Record<string, any>;
|
|
69
|
-
/**
|
|
70
|
-
* The producer(remote) info bound to this resource.
|
|
71
|
-
* Only present when the loader is invoked in a remote-related context
|
|
72
|
-
* (e.g. preloadRemote / loading remoteEntry).
|
|
73
|
-
*/
|
|
74
|
-
remoteInfo?: RemoteInfo;
|
|
75
|
-
resourceContext?: ResourceLoadContext;
|
|
76
|
-
}], CreateScriptHookReturn>;
|
|
77
|
-
createLink: SyncHook<[{
|
|
78
|
-
url: string;
|
|
79
|
-
attrs?: Record<string, any>;
|
|
80
|
-
/**
|
|
81
|
-
* The producer(remote) info bound to this resource.
|
|
82
|
-
* Only present when the loader is invoked in a remote-related context
|
|
83
|
-
* (e.g. preloadRemote / loading remoteEntry).
|
|
84
|
-
*/
|
|
85
|
-
remoteInfo?: RemoteInfo;
|
|
86
|
-
resourceContext?: ResourceLoadContext;
|
|
87
|
-
}], CreateLinkHookReturnDom>;
|
|
88
|
-
fetch: AsyncHook<[string, RequestInit, (RemoteInfo | undefined)?, (ResourceLoadContext | undefined)?], false | void | Promise<Response>>;
|
|
89
|
-
loadEntryError: AsyncHook<[{
|
|
90
|
-
getRemoteEntry: typeof getRemoteEntry;
|
|
91
|
-
origin: ModuleFederation;
|
|
92
|
-
remoteInfo: RemoteInfo;
|
|
93
|
-
remoteEntryExports?: RemoteEntryExports | undefined;
|
|
94
|
-
globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
|
|
95
|
-
uniqueKey: string;
|
|
96
|
-
}], Promise<Promise<RemoteEntryExports | undefined> | undefined>>;
|
|
97
|
-
afterLoadEntry: AsyncHook<[{
|
|
98
|
-
origin: ModuleFederation;
|
|
99
|
-
remoteInfo: RemoteInfo;
|
|
100
|
-
remoteEntryExports?: false | void | RemoteEntryExports | undefined;
|
|
101
|
-
error?: unknown;
|
|
102
|
-
recovered?: boolean;
|
|
103
|
-
}], void>;
|
|
104
|
-
beforeInitRemote: AsyncHook<[{
|
|
105
|
-
id?: string;
|
|
106
|
-
remoteInfo: RemoteInfo;
|
|
107
|
-
remoteSnapshot?: ModuleInfo;
|
|
108
|
-
origin: ModuleFederation;
|
|
109
|
-
}], void>;
|
|
110
|
-
afterInitRemote: AsyncHook<[{
|
|
111
|
-
id?: string;
|
|
112
|
-
remoteInfo: RemoteInfo;
|
|
113
|
-
remoteSnapshot?: ModuleInfo;
|
|
114
|
-
remoteEntryExports?: RemoteEntryExports;
|
|
115
|
-
error?: unknown;
|
|
116
|
-
cached?: boolean;
|
|
117
|
-
origin: ModuleFederation;
|
|
118
|
-
}], void>;
|
|
119
|
-
beforeGetExpose: AsyncHook<[{
|
|
120
|
-
id: string;
|
|
121
|
-
expose: string;
|
|
122
|
-
moduleInfo: RemoteInfo;
|
|
123
|
-
remoteEntryExports: RemoteEntryExports;
|
|
124
|
-
origin: ModuleFederation;
|
|
125
|
-
}], void>;
|
|
126
|
-
afterGetExpose: AsyncHook<[{
|
|
127
|
-
id: string;
|
|
128
|
-
expose: string;
|
|
129
|
-
moduleInfo: RemoteInfo;
|
|
130
|
-
remoteEntryExports: RemoteEntryExports;
|
|
131
|
-
moduleFactory?: RemoteModuleFactory;
|
|
132
|
-
error?: unknown;
|
|
133
|
-
origin: ModuleFederation;
|
|
134
|
-
}], void>;
|
|
135
|
-
beforeExecuteFactory: AsyncHook<[{
|
|
136
|
-
id: string;
|
|
137
|
-
expose: string;
|
|
138
|
-
moduleInfo: RemoteInfo;
|
|
139
|
-
loadFactory: boolean;
|
|
140
|
-
origin: ModuleFederation;
|
|
141
|
-
}], void>;
|
|
142
|
-
afterExecuteFactory: AsyncHook<[{
|
|
143
|
-
id: string;
|
|
144
|
-
expose: string;
|
|
145
|
-
moduleInfo: RemoteInfo;
|
|
146
|
-
loadFactory: boolean;
|
|
147
|
-
exposeModule?: unknown;
|
|
148
|
-
error?: unknown;
|
|
149
|
-
origin: ModuleFederation;
|
|
150
|
-
}], void>;
|
|
151
|
-
getModuleFactory: AsyncHook<[{
|
|
152
|
-
remoteEntryExports: RemoteEntryExports;
|
|
153
|
-
expose: string;
|
|
154
|
-
moduleInfo: RemoteInfo;
|
|
155
|
-
}], RemoteModuleFactory | Promise<RemoteModuleFactory | undefined> | undefined>;
|
|
156
|
-
}>;
|
|
157
|
-
bridgeHook: PluginSystem<{
|
|
158
|
-
beforeBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
159
|
-
afterBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
160
|
-
beforeBridgeDestroy: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
161
|
-
afterBridgeDestroy: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
162
|
-
}>;
|
|
163
|
-
moduleInfo?: GlobalModuleInfo[string];
|
|
164
|
-
constructor(userOptions: UserOptions);
|
|
165
|
-
initOptions(userOptions: UserOptions): Options;
|
|
166
|
-
loadShare<T>(pkgName: string, extraOptions?: {
|
|
167
|
-
customShareInfo?: Partial<Shared>;
|
|
168
|
-
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
169
|
-
}): Promise<false | (() => T | undefined)>;
|
|
170
|
-
loadShareSync<T>(pkgName: string, extraOptions?: {
|
|
171
|
-
customShareInfo?: Partial<Shared>;
|
|
172
|
-
from?: 'build' | 'runtime';
|
|
173
|
-
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
174
|
-
}): () => T | never;
|
|
175
|
-
initializeSharing(shareScopeName?: string, extraOptions?: {
|
|
176
|
-
initScope?: InitScope;
|
|
177
|
-
from?: CallFrom;
|
|
178
|
-
strategy?: Shared['strategy'];
|
|
179
|
-
}): Array<Promise<void>>;
|
|
180
|
-
initRawContainer(name: string, url: string, container: RemoteEntryExports): Module$1;
|
|
181
|
-
loadRemote<T>(id: string, options?: {
|
|
182
|
-
loadFactory?: boolean;
|
|
183
|
-
from: CallFrom;
|
|
184
|
-
}): Promise<T | null>;
|
|
185
|
-
preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
|
|
186
|
-
initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string], extraOptions?: {
|
|
187
|
-
hostShareScopeMap?: ShareScopeMap;
|
|
188
|
-
}): void;
|
|
189
|
-
formatOptions(globalOptions: Options, userOptions: UserOptions): Options;
|
|
190
|
-
registerPlugins(plugins: UserOptions['plugins']): void;
|
|
191
|
-
registerRemotes(remotes: Remote[], options?: {
|
|
192
|
-
force?: boolean;
|
|
193
|
-
}): void;
|
|
194
|
-
registerShared(shared: UserOptions['shared']): void;
|
|
195
|
-
} //#endregion
|
|
196
|
-
//#endregion
|
|
197
|
-
export { ModuleFederation };
|
|
198
|
-
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { GlobalShareScopeMap, RemoteEntryExports } from "./type/config.js";
|
|
2
|
-
import { ModuleFederationRuntimePlugin } from "./type/plugin.js";
|
|
3
|
-
import { ModuleFederation } from "./core.js";
|
|
4
|
-
import { GlobalModuleInfo, ModuleInfo } from "@module-federation/sdk";
|
|
5
|
-
|
|
6
|
-
//#region ../runtime-core/dist/global.d.ts
|
|
7
|
-
//#region src/global.d.ts
|
|
8
|
-
interface Federation {
|
|
9
|
-
__GLOBAL_PLUGIN__: Array<ModuleFederationRuntimePlugin>;
|
|
10
|
-
__DEBUG_CONSTRUCTOR_VERSION__?: string;
|
|
11
|
-
moduleInfo: GlobalModuleInfo;
|
|
12
|
-
__DEBUG_CONSTRUCTOR__?: typeof ModuleFederation;
|
|
13
|
-
__INSTANCES__: Array<ModuleFederation>;
|
|
14
|
-
__SHARE__: GlobalShareScopeMap;
|
|
15
|
-
__MANIFEST_LOADING__: Record<string, Promise<ModuleInfo>>;
|
|
16
|
-
__PRELOADED_MAP__: Map<string, boolean>;
|
|
17
|
-
}
|
|
18
|
-
declare global {
|
|
19
|
-
var __FEDERATION__: Federation, __VMOK__: Federation, __GLOBAL_LOADING_REMOTE_ENTRY__: Record<string, undefined | Promise<RemoteEntryExports | void>>;
|
|
20
|
-
}
|
|
21
|
-
declare const getGlobalSnapshot: () => GlobalModuleInfo;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { Federation, getGlobalSnapshot };
|
|
24
|
-
//# sourceMappingURL=global.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { UserOptions } from "./type/config.js";
|
|
2
|
-
import { ModuleFederationRuntimePlugin } from "./type/plugin.js";
|
|
3
|
-
import { Federation, getGlobalSnapshot } from "./global.js";
|
|
4
|
-
import { getRemoteEntry } from "./utils/load.js";
|
|
5
|
-
import { ModuleFederation } from "./core.js";
|
|
6
|
-
import { Module$1 } from "./module/index.js";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { InitScope, RemoteEntryExports, RemoteInfo } from "../type/config.js";
|
|
2
|
-
import { ModuleFederation } from "../core.js";
|
|
3
|
-
import { ModuleInfo } from "@module-federation/sdk";
|
|
4
|
-
|
|
5
|
-
//#region ../runtime-core/dist/module/index.d.ts
|
|
6
|
-
//#region src/module/index.d.ts
|
|
7
|
-
type ModuleOptions = ConstructorParameters<typeof Module$1>[0];
|
|
8
|
-
type RemoteModuleFactory = () => unknown | Promise<unknown>;
|
|
9
|
-
declare class Module$1 {
|
|
10
|
-
remoteInfo: RemoteInfo;
|
|
11
|
-
inited: boolean;
|
|
12
|
-
initing: boolean;
|
|
13
|
-
initPromise?: Promise<void>;
|
|
14
|
-
remoteEntryExports?: RemoteEntryExports;
|
|
15
|
-
lib: RemoteEntryExports | undefined;
|
|
16
|
-
host: ModuleFederation;
|
|
17
|
-
constructor({
|
|
18
|
-
remoteInfo,
|
|
19
|
-
host
|
|
20
|
-
}: {
|
|
21
|
-
remoteInfo: RemoteInfo;
|
|
22
|
-
host: ModuleFederation;
|
|
23
|
-
});
|
|
24
|
-
getEntry(expose?: string): Promise<RemoteEntryExports>;
|
|
25
|
-
init(id?: string, remoteSnapshot?: ModuleInfo, rawInitScope?: InitScope, expose?: string): Promise<RemoteEntryExports>;
|
|
26
|
-
get(id: string, expose: string, options?: {
|
|
27
|
-
loadFactory?: boolean;
|
|
28
|
-
}, remoteSnapshot?: ModuleInfo): Promise<unknown>;
|
|
29
|
-
private wraperFactory;
|
|
30
|
-
} //#endregion
|
|
31
|
-
//#endregion
|
|
32
|
-
export { Module$1, ModuleOptions, RemoteModuleFactory };
|
|
33
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { AsyncHook } from "../../utils/hooks/asyncHook.js";
|
|
2
|
-
import { AsyncWaterfallHook } from "../../utils/hooks/asyncWaterfallHooks.js";
|
|
3
|
-
import { PluginSystem } from "../../utils/hooks/pluginSystem.js";
|
|
4
|
-
import { Options, Remote } from "../../type/config.js";
|
|
5
|
-
import { ResourceLoadInitiator } from "../../type/preload.js";
|
|
6
|
-
import { getGlobalSnapshot } from "../../global.js";
|
|
7
|
-
import { ModuleFederation } from "../../core.js";
|
|
8
|
-
import { GlobalModuleInfo, Manifest, ModuleInfo } from "@module-federation/sdk";
|
|
9
|
-
|
|
10
|
-
//#region ../runtime-core/dist/plugins/snapshot/SnapshotHandler.d.ts
|
|
11
|
-
//#region src/plugins/snapshot/SnapshotHandler.d.ts
|
|
12
|
-
declare class SnapshotHandler {
|
|
13
|
-
loadingHostSnapshot: Promise<GlobalModuleInfo | void> | null;
|
|
14
|
-
HostInstance: ModuleFederation;
|
|
15
|
-
manifestCache: Map<string, Manifest>;
|
|
16
|
-
hooks: PluginSystem<{
|
|
17
|
-
beforeLoadRemoteSnapshot: AsyncHook<[{
|
|
18
|
-
options: Options;
|
|
19
|
-
moduleInfo: Remote;
|
|
20
|
-
origin: ModuleFederation;
|
|
21
|
-
}], void>;
|
|
22
|
-
loadSnapshot: AsyncWaterfallHook<{
|
|
23
|
-
options: Options;
|
|
24
|
-
moduleInfo: Remote;
|
|
25
|
-
hostGlobalSnapshot: GlobalModuleInfo[string] | undefined;
|
|
26
|
-
globalSnapshot: ReturnType<typeof getGlobalSnapshot>;
|
|
27
|
-
remoteSnapshot?: GlobalModuleInfo[string] | undefined;
|
|
28
|
-
}>;
|
|
29
|
-
loadRemoteSnapshot: AsyncWaterfallHook<{
|
|
30
|
-
options: Options;
|
|
31
|
-
moduleInfo: Remote;
|
|
32
|
-
manifestJson?: Manifest;
|
|
33
|
-
manifestUrl?: string;
|
|
34
|
-
remoteSnapshot: ModuleInfo;
|
|
35
|
-
from: "global" | "manifest";
|
|
36
|
-
}>;
|
|
37
|
-
afterLoadSnapshot: AsyncWaterfallHook<{
|
|
38
|
-
id?: string;
|
|
39
|
-
host: ModuleFederation;
|
|
40
|
-
options: Options;
|
|
41
|
-
moduleInfo: Remote;
|
|
42
|
-
remoteSnapshot: ModuleInfo;
|
|
43
|
-
}>;
|
|
44
|
-
}>;
|
|
45
|
-
loaderHook: ModuleFederation['loaderHook'];
|
|
46
|
-
manifestLoading: Record<string, Promise<ModuleInfo>>;
|
|
47
|
-
constructor(HostInstance: ModuleFederation);
|
|
48
|
-
loadRemoteSnapshotInfo({
|
|
49
|
-
moduleInfo,
|
|
50
|
-
id,
|
|
51
|
-
initiator
|
|
52
|
-
}: {
|
|
53
|
-
moduleInfo: Remote;
|
|
54
|
-
id?: string;
|
|
55
|
-
initiator?: ResourceLoadInitiator;
|
|
56
|
-
}): Promise<{
|
|
57
|
-
remoteSnapshot: ModuleInfo;
|
|
58
|
-
globalSnapshot: GlobalModuleInfo;
|
|
59
|
-
}> | never;
|
|
60
|
-
getGlobalRemoteInfo(moduleInfo: Remote): {
|
|
61
|
-
hostGlobalSnapshot: ModuleInfo | undefined;
|
|
62
|
-
globalSnapshot: ReturnType<typeof getGlobalSnapshot>;
|
|
63
|
-
remoteSnapshot: GlobalModuleInfo[string] | undefined;
|
|
64
|
-
};
|
|
65
|
-
private getManifestJson;
|
|
66
|
-
private loadManifestSnapshot;
|
|
67
|
-
} //#endregion
|
|
68
|
-
//#endregion
|
|
69
|
-
export { SnapshotHandler };
|
|
70
|
-
//# sourceMappingURL=SnapshotHandler.d.ts.map
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { SyncHook } from "../utils/hooks/syncHook.js";
|
|
2
|
-
import { AsyncHook } from "../utils/hooks/asyncHook.js";
|
|
3
|
-
import { SyncWaterfallHook } from "../utils/hooks/syncWaterfallHook.js";
|
|
4
|
-
import { AsyncWaterfallHook } from "../utils/hooks/asyncWaterfallHooks.js";
|
|
5
|
-
import { PluginSystem } from "../utils/hooks/pluginSystem.js";
|
|
6
|
-
import { CallFrom, Options, Remote, RemoteEntryExports, RemoteInfo, UserOptions } from "../type/config.js";
|
|
7
|
-
import { PreloadAssets, PreloadOptions, PreloadRemoteArgs, PreloadRemoteResult } from "../type/preload.js";
|
|
8
|
-
import { ModuleFederation } from "../core.js";
|
|
9
|
-
import { Module$1, ModuleOptions } from "../module/index.js";
|
|
10
|
-
import { GlobalModuleInfo, ModuleInfo } from "@module-federation/sdk";
|
|
11
|
-
|
|
12
|
-
//#region ../runtime-core/dist/remote/index.d.ts
|
|
13
|
-
//#region src/remote/index.d.ts
|
|
14
|
-
interface LoadRemoteMatch {
|
|
15
|
-
id: string;
|
|
16
|
-
pkgNameOrAlias: string;
|
|
17
|
-
expose: string;
|
|
18
|
-
remote: Remote;
|
|
19
|
-
options: Options;
|
|
20
|
-
origin: ModuleFederation;
|
|
21
|
-
remoteInfo: RemoteInfo;
|
|
22
|
-
remoteSnapshot?: ModuleInfo;
|
|
23
|
-
}
|
|
24
|
-
declare class RemoteHandler {
|
|
25
|
-
host: ModuleFederation;
|
|
26
|
-
idToRemoteMap: Record<string, {
|
|
27
|
-
name: string;
|
|
28
|
-
expose: string;
|
|
29
|
-
}>;
|
|
30
|
-
hooks: PluginSystem<{
|
|
31
|
-
beforeRegisterRemote: SyncWaterfallHook<{
|
|
32
|
-
remote: Remote;
|
|
33
|
-
origin: ModuleFederation;
|
|
34
|
-
}>;
|
|
35
|
-
registerRemote: SyncWaterfallHook<{
|
|
36
|
-
remote: Remote;
|
|
37
|
-
origin: ModuleFederation;
|
|
38
|
-
}>;
|
|
39
|
-
beforeRequest: AsyncWaterfallHook<{
|
|
40
|
-
id: string;
|
|
41
|
-
options: Options;
|
|
42
|
-
origin: ModuleFederation;
|
|
43
|
-
}>;
|
|
44
|
-
afterMatchRemote: AsyncHook<[{
|
|
45
|
-
id: string;
|
|
46
|
-
options: Options;
|
|
47
|
-
remote?: Remote;
|
|
48
|
-
expose?: string;
|
|
49
|
-
remoteInfo?: RemoteInfo;
|
|
50
|
-
error?: unknown;
|
|
51
|
-
origin: ModuleFederation;
|
|
52
|
-
}], void>;
|
|
53
|
-
onLoad: AsyncHook<[{
|
|
54
|
-
id: string;
|
|
55
|
-
expose: string;
|
|
56
|
-
pkgNameOrAlias: string;
|
|
57
|
-
remote: Remote;
|
|
58
|
-
options: ModuleOptions;
|
|
59
|
-
origin: ModuleFederation;
|
|
60
|
-
exposeModule: any;
|
|
61
|
-
exposeModuleFactory: any;
|
|
62
|
-
moduleInstance: Module$1;
|
|
63
|
-
}], unknown>;
|
|
64
|
-
afterLoadRemote: AsyncHook<[{
|
|
65
|
-
id: string;
|
|
66
|
-
expose?: string;
|
|
67
|
-
remote?: RemoteInfo;
|
|
68
|
-
options?: {
|
|
69
|
-
loadFactory?: boolean;
|
|
70
|
-
from?: CallFrom;
|
|
71
|
-
};
|
|
72
|
-
error?: unknown;
|
|
73
|
-
recovered?: boolean;
|
|
74
|
-
origin: ModuleFederation;
|
|
75
|
-
}], void>;
|
|
76
|
-
handlePreloadModule: SyncHook<[{
|
|
77
|
-
id: string;
|
|
78
|
-
name: string;
|
|
79
|
-
remote: Remote;
|
|
80
|
-
remoteSnapshot: ModuleInfo;
|
|
81
|
-
preloadConfig: PreloadRemoteArgs;
|
|
82
|
-
origin: ModuleFederation;
|
|
83
|
-
}], void>;
|
|
84
|
-
errorLoadRemote: AsyncHook<[{
|
|
85
|
-
id: string;
|
|
86
|
-
error: unknown;
|
|
87
|
-
options?: any;
|
|
88
|
-
from: CallFrom;
|
|
89
|
-
lifecycle: "beforeRequest" | "beforeLoadShare" | "afterResolve" | "onLoad";
|
|
90
|
-
remote?: RemoteInfo;
|
|
91
|
-
expose?: string;
|
|
92
|
-
origin: ModuleFederation;
|
|
93
|
-
}], unknown>;
|
|
94
|
-
beforePreloadRemote: AsyncHook<[{
|
|
95
|
-
preloadOps: Array<PreloadRemoteArgs>;
|
|
96
|
-
options: Options;
|
|
97
|
-
origin: ModuleFederation;
|
|
98
|
-
}], false | void | Promise<false | void>>;
|
|
99
|
-
generatePreloadAssets: AsyncHook<[{
|
|
100
|
-
origin: ModuleFederation;
|
|
101
|
-
preloadOptions: PreloadOptions[number];
|
|
102
|
-
remote: Remote;
|
|
103
|
-
remoteInfo: RemoteInfo;
|
|
104
|
-
remoteSnapshot: ModuleInfo;
|
|
105
|
-
globalSnapshot: GlobalModuleInfo;
|
|
106
|
-
}], Promise<PreloadAssets>>;
|
|
107
|
-
afterPreloadRemote: AsyncHook<[{
|
|
108
|
-
preloadOps: Array<PreloadRemoteArgs>;
|
|
109
|
-
options: Options;
|
|
110
|
-
origin: ModuleFederation;
|
|
111
|
-
results: PreloadRemoteResult[];
|
|
112
|
-
error?: unknown;
|
|
113
|
-
}], false | void | Promise<false | void>>;
|
|
114
|
-
loadEntry: AsyncHook<[{
|
|
115
|
-
origin: ModuleFederation;
|
|
116
|
-
loaderHook: ModuleFederation["loaderHook"];
|
|
117
|
-
remoteInfo: RemoteInfo;
|
|
118
|
-
remoteEntryExports?: RemoteEntryExports;
|
|
119
|
-
}], void | RemoteEntryExports | Promise<void | RemoteEntryExports>>;
|
|
120
|
-
}>;
|
|
121
|
-
constructor(host: ModuleFederation);
|
|
122
|
-
formatAndRegisterRemote(globalOptions: Options, userOptions: UserOptions): Remote[];
|
|
123
|
-
setIdToRemoteMap(id: string, remoteMatchInfo: LoadRemoteMatch): void;
|
|
124
|
-
loadRemote<T>(id: string, options?: {
|
|
125
|
-
loadFactory?: boolean;
|
|
126
|
-
from: CallFrom;
|
|
127
|
-
}): Promise<T | null>;
|
|
128
|
-
preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
|
|
129
|
-
registerRemotes(remotes: Remote[], options?: {
|
|
130
|
-
force?: boolean;
|
|
131
|
-
}): void;
|
|
132
|
-
getRemoteModuleAndOptions(options: {
|
|
133
|
-
id: string;
|
|
134
|
-
}): Promise<{
|
|
135
|
-
module: Module$1;
|
|
136
|
-
moduleOptions: ModuleOptions;
|
|
137
|
-
remoteMatchInfo: LoadRemoteMatch;
|
|
138
|
-
}>;
|
|
139
|
-
registerRemote(remote: Remote, targetRemotes: Remote[], options?: {
|
|
140
|
-
force?: boolean;
|
|
141
|
-
}): void;
|
|
142
|
-
private removeRemote;
|
|
143
|
-
} //#endregion
|
|
144
|
-
//#endregion
|
|
145
|
-
export { LoadRemoteMatch, RemoteHandler };
|
|
146
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { SyncHook } from "../utils/hooks/syncHook.js";
|
|
2
|
-
import { AsyncHook } from "../utils/hooks/asyncHook.js";
|
|
3
|
-
import { SyncWaterfallHook } from "../utils/hooks/syncWaterfallHook.js";
|
|
4
|
-
import { AsyncWaterfallHook } from "../utils/hooks/asyncWaterfallHooks.js";
|
|
5
|
-
import { PluginSystem } from "../utils/hooks/pluginSystem.js";
|
|
6
|
-
import { CallFrom, InitScope, InitTokens, Options, ShareInfos, ShareScopeMap, ShareStrategy, Shared, UserOptions } from "../type/config.js";
|
|
7
|
-
import { LoadRemoteMatch } from "../remote/index.js";
|
|
8
|
-
import { Federation } from "../global.js";
|
|
9
|
-
import { ModuleFederation } from "../core.js";
|
|
10
|
-
|
|
11
|
-
//#region ../runtime-core/dist/shared/index.d.ts
|
|
12
|
-
//#region src/shared/index.d.ts
|
|
13
|
-
declare class SharedHandler {
|
|
14
|
-
host: ModuleFederation;
|
|
15
|
-
shareScopeMap: ShareScopeMap;
|
|
16
|
-
hooks: PluginSystem<{
|
|
17
|
-
beforeRegisterShare: SyncWaterfallHook<{
|
|
18
|
-
pkgName: string;
|
|
19
|
-
shared: Shared;
|
|
20
|
-
origin: ModuleFederation;
|
|
21
|
-
}>;
|
|
22
|
-
afterResolve: AsyncWaterfallHook<LoadRemoteMatch>;
|
|
23
|
-
beforeLoadShare: AsyncWaterfallHook<{
|
|
24
|
-
pkgName: string;
|
|
25
|
-
shareInfo?: Shared;
|
|
26
|
-
shared: Options["shared"];
|
|
27
|
-
origin: ModuleFederation;
|
|
28
|
-
}>;
|
|
29
|
-
loadShare: AsyncHook<[ModuleFederation, string, ShareInfos], false | void | Promise<false | void>>;
|
|
30
|
-
afterLoadShare: SyncHook<[{
|
|
31
|
-
pkgName: string;
|
|
32
|
-
shareInfo?: Partial<Shared>;
|
|
33
|
-
selectedShared?: Partial<Shared>;
|
|
34
|
-
shared: Options["shared"];
|
|
35
|
-
shareScopeMap: ShareScopeMap;
|
|
36
|
-
lifecycle: "loadShare" | "loadShareSync";
|
|
37
|
-
origin: ModuleFederation;
|
|
38
|
-
}], void>;
|
|
39
|
-
errorLoadShare: SyncHook<[{
|
|
40
|
-
pkgName: string;
|
|
41
|
-
shareInfo?: Partial<Shared>;
|
|
42
|
-
shared: Options["shared"];
|
|
43
|
-
shareScopeMap: ShareScopeMap;
|
|
44
|
-
lifecycle: "loadShare" | "loadShareSync";
|
|
45
|
-
origin: ModuleFederation;
|
|
46
|
-
error?: unknown;
|
|
47
|
-
recovered?: boolean;
|
|
48
|
-
}], void>;
|
|
49
|
-
resolveShare: SyncWaterfallHook<{
|
|
50
|
-
shareScopeMap: ShareScopeMap;
|
|
51
|
-
scope: string;
|
|
52
|
-
pkgName: string;
|
|
53
|
-
version: string;
|
|
54
|
-
shareInfo: Shared;
|
|
55
|
-
GlobalFederation: Federation;
|
|
56
|
-
resolver: () => {
|
|
57
|
-
shared: Shared;
|
|
58
|
-
useTreesShaking: boolean;
|
|
59
|
-
} | undefined;
|
|
60
|
-
}>;
|
|
61
|
-
initContainerShareScopeMap: SyncWaterfallHook<{
|
|
62
|
-
shareScope: ShareScopeMap[string];
|
|
63
|
-
options: Options;
|
|
64
|
-
origin: ModuleFederation;
|
|
65
|
-
scopeName: string;
|
|
66
|
-
hostShareScopeMap?: ShareScopeMap;
|
|
67
|
-
}>;
|
|
68
|
-
}>;
|
|
69
|
-
initTokens: InitTokens;
|
|
70
|
-
constructor(host: ModuleFederation);
|
|
71
|
-
private emitAfterLoadShare;
|
|
72
|
-
private emitErrorLoadShare;
|
|
73
|
-
registerShared(globalOptions: Options, userOptions: UserOptions): {
|
|
74
|
-
newShareInfos: ShareInfos;
|
|
75
|
-
allShareInfos: {
|
|
76
|
-
[pkgName: string]: Shared[];
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
loadShare<T>(pkgName: string, extraOptions?: {
|
|
80
|
-
customShareInfo?: Partial<Shared>;
|
|
81
|
-
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
82
|
-
}): Promise<false | (() => T | undefined)>;
|
|
83
|
-
/**
|
|
84
|
-
* This function initializes the sharing sequence (executed only once per share scope).
|
|
85
|
-
* It accepts one argument, the name of the share scope.
|
|
86
|
-
* If the share scope does not exist, it creates one.
|
|
87
|
-
*/
|
|
88
|
-
initializeSharing(shareScopeName?: string, extraOptions?: {
|
|
89
|
-
initScope?: InitScope;
|
|
90
|
-
from?: CallFrom;
|
|
91
|
-
strategy?: ShareStrategy;
|
|
92
|
-
}): Array<Promise<void>>;
|
|
93
|
-
loadShareSync<T>(pkgName: string, extraOptions?: {
|
|
94
|
-
from?: 'build' | 'runtime';
|
|
95
|
-
customShareInfo?: Partial<Shared>;
|
|
96
|
-
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
97
|
-
}): () => T | never;
|
|
98
|
-
initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string], extraOptions?: {
|
|
99
|
-
hostShareScopeMap?: ShareScopeMap;
|
|
100
|
-
}): void;
|
|
101
|
-
private setShared;
|
|
102
|
-
private _setGlobalShareScopeMap;
|
|
103
|
-
} //#endregion
|
|
104
|
-
//#endregion
|
|
105
|
-
export { SharedHandler };
|
|
106
|
-
//# sourceMappingURL=index.d.ts.map
|