@module-federation/runtime 0.8.6 → 0.8.7
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/core.cjs.d.ts +2 -0
- package/dist/core.cjs.js +15 -0
- package/dist/core.esm.d.ts +2 -0
- package/dist/core.esm.mjs +3 -0
- package/dist/helpers.cjs.js +7 -27
- package/dist/helpers.esm.mjs +7 -27
- package/dist/index.cjs.js +34 -2086
- package/dist/index.esm.mjs +4 -2072
- package/dist/polyfills.cjs.js +0 -14
- package/dist/polyfills.esm.mjs +1 -14
- package/dist/src/core.d.ts +3 -114
- package/dist/src/embedded.d.ts +49 -49
- package/dist/src/helpers.d.ts +23 -29
- package/dist/src/index.d.ts +3 -9
- package/dist/src/types.d.ts +1 -1
- package/dist/src/utils.d.ts +3 -0
- package/dist/types.cjs.js +10 -0
- package/dist/types.esm.mjs +1 -1
- package/dist/utils.cjs.js +26 -0
- package/dist/utils.esm.mjs +24 -0
- package/package.json +12 -3
- package/dist/share.cjs.js +0 -937
- package/dist/share.esm.mjs +0 -896
- package/dist/src/constant.d.ts +0 -2
- package/dist/src/global.d.ts +0 -43
- package/dist/src/module/index.d.ts +0 -21
- package/dist/src/plugins/generate-preload-assets.d.ts +0 -8
- package/dist/src/plugins/snapshot/SnapshotHandler.d.ts +0 -58
- package/dist/src/plugins/snapshot/index.d.ts +0 -5
- package/dist/src/remote/index.d.ts +0 -109
- package/dist/src/shared/index.d.ts +0 -66
- package/dist/src/type/config.d.ts +0 -112
- package/dist/src/type/index.d.ts +0 -3
- package/dist/src/type/plugin.d.ts +0 -34
- package/dist/src/type/preload.d.ts +0 -26
- package/dist/src/utils/env.d.ts +0 -3
- package/dist/src/utils/hooks/asyncHook.d.ts +0 -6
- package/dist/src/utils/hooks/asyncWaterfallHooks.d.ts +0 -10
- package/dist/src/utils/hooks/index.d.ts +0 -6
- package/dist/src/utils/hooks/pluginSystem.d.ts +0 -15
- package/dist/src/utils/hooks/syncHook.d.ts +0 -12
- package/dist/src/utils/hooks/syncWaterfallHook.d.ts +0 -9
- package/dist/src/utils/index.d.ts +0 -6
- package/dist/src/utils/load.d.ts +0 -9
- package/dist/src/utils/logger.d.ts +0 -6
- package/dist/src/utils/manifest.d.ts +0 -7
- package/dist/src/utils/plugin.d.ts +0 -4
- package/dist/src/utils/preload.d.ts +0 -6
- package/dist/src/utils/semver/compare.d.ts +0 -9
- package/dist/src/utils/semver/constants.d.ts +0 -10
- package/dist/src/utils/semver/index.d.ts +0 -2
- package/dist/src/utils/semver/parser.d.ts +0 -9
- package/dist/src/utils/semver/utils.d.ts +0 -11
- package/dist/src/utils/share.d.ts +0 -27
- package/dist/src/utils/tool.d.ts +0 -18
package/dist/polyfills.cjs.js
CHANGED
|
@@ -11,18 +11,4 @@ function _extends() {
|
|
|
11
11
|
return _extends.apply(this, arguments);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function _object_without_properties_loose(source, excluded) {
|
|
15
|
-
if (source == null) return {};
|
|
16
|
-
var target = {};
|
|
17
|
-
var sourceKeys = Object.keys(source);
|
|
18
|
-
var key, i;
|
|
19
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
20
|
-
key = sourceKeys[i];
|
|
21
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
22
|
-
target[key] = source[key];
|
|
23
|
-
}
|
|
24
|
-
return target;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
14
|
exports._extends = _extends;
|
|
28
|
-
exports._object_without_properties_loose = _object_without_properties_loose;
|
package/dist/polyfills.esm.mjs
CHANGED
|
@@ -9,17 +9,4 @@ function _extends() {
|
|
|
9
9
|
return _extends.apply(this, arguments);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
if (source == null) return {};
|
|
14
|
-
var target = {};
|
|
15
|
-
var sourceKeys = Object.keys(source);
|
|
16
|
-
var key, i;
|
|
17
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
18
|
-
key = sourceKeys[i];
|
|
19
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
20
|
-
target[key] = source[key];
|
|
21
|
-
}
|
|
22
|
-
return target;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { _object_without_properties_loose as _, _extends as a };
|
|
12
|
+
export { _extends as _ };
|
package/dist/src/core.d.ts
CHANGED
|
@@ -1,114 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { Module } from './module';
|
|
5
|
-
import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHook } from './utils/hooks';
|
|
6
|
-
import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler';
|
|
7
|
-
import { SharedHandler } from './shared';
|
|
8
|
-
import { RemoteHandler } from './remote';
|
|
9
|
-
export declare class FederationHost {
|
|
10
|
-
options: Options;
|
|
11
|
-
hooks: PluginSystem<{
|
|
12
|
-
beforeInit: SyncWaterfallHook<{
|
|
13
|
-
userOptions: UserOptions;
|
|
14
|
-
options: Options;
|
|
15
|
-
origin: FederationHost;
|
|
16
|
-
shareInfo: ShareInfos;
|
|
17
|
-
}>;
|
|
18
|
-
init: SyncHook<[{
|
|
19
|
-
options: Options;
|
|
20
|
-
origin: FederationHost;
|
|
21
|
-
}], void>;
|
|
22
|
-
beforeInitContainer: AsyncWaterfallHook<{
|
|
23
|
-
shareScope: ShareScopeMap[string];
|
|
24
|
-
initScope: InitScope;
|
|
25
|
-
remoteEntryInitOptions: RemoteEntryInitOptions;
|
|
26
|
-
remoteInfo: RemoteInfo;
|
|
27
|
-
origin: FederationHost;
|
|
28
|
-
}>;
|
|
29
|
-
initContainer: AsyncWaterfallHook<{
|
|
30
|
-
shareScope: ShareScopeMap[string];
|
|
31
|
-
initScope: InitScope;
|
|
32
|
-
remoteEntryInitOptions: RemoteEntryInitOptions;
|
|
33
|
-
remoteInfo: RemoteInfo;
|
|
34
|
-
remoteEntryExports: RemoteEntryExports;
|
|
35
|
-
origin: FederationHost;
|
|
36
|
-
id: string;
|
|
37
|
-
remoteSnapshot?: ModuleInfo;
|
|
38
|
-
}>;
|
|
39
|
-
}>;
|
|
40
|
-
version: string;
|
|
41
|
-
name: string;
|
|
42
|
-
moduleCache: Map<string, Module>;
|
|
43
|
-
snapshotHandler: SnapshotHandler;
|
|
44
|
-
sharedHandler: SharedHandler;
|
|
45
|
-
remoteHandler: RemoteHandler;
|
|
46
|
-
shareScopeMap: ShareScopeMap;
|
|
47
|
-
loaderHook: PluginSystem<{
|
|
48
|
-
getModuleInfo: SyncHook<[{
|
|
49
|
-
target: Record<string, any>;
|
|
50
|
-
key: any;
|
|
51
|
-
}], void | {
|
|
52
|
-
value: any | undefined;
|
|
53
|
-
key: string;
|
|
54
|
-
}>;
|
|
55
|
-
createScript: SyncHook<[{
|
|
56
|
-
url: string;
|
|
57
|
-
attrs?: Record<string, any>;
|
|
58
|
-
}], CreateScriptHookReturn>;
|
|
59
|
-
createLink: SyncHook<[{
|
|
60
|
-
url: string;
|
|
61
|
-
attrs?: Record<string, any>;
|
|
62
|
-
}], void | HTMLLinkElement>;
|
|
63
|
-
fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
64
|
-
loadEntryError: AsyncHook<[{
|
|
65
|
-
getRemoteEntry: typeof getRemoteEntry;
|
|
66
|
-
origin: FederationHost;
|
|
67
|
-
remoteInfo: RemoteInfo;
|
|
68
|
-
remoteEntryExports?: RemoteEntryExports | undefined;
|
|
69
|
-
globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
|
|
70
|
-
uniqueKey: string;
|
|
71
|
-
}], Promise<(() => Promise<RemoteEntryExports | undefined>) | undefined>>;
|
|
72
|
-
getModuleFactory: AsyncHook<[{
|
|
73
|
-
remoteEntryExports: RemoteEntryExports;
|
|
74
|
-
expose: string;
|
|
75
|
-
moduleInfo: RemoteInfo;
|
|
76
|
-
}], Promise<(() => Promise<Module>) | undefined>>;
|
|
77
|
-
}>;
|
|
78
|
-
bridgeHook: PluginSystem<{
|
|
79
|
-
beforeBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
80
|
-
afterBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
81
|
-
beforeBridgeDestroy: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
82
|
-
afterBridgeDestroy: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
83
|
-
}>;
|
|
84
|
-
constructor(userOptions: UserOptions);
|
|
85
|
-
initOptions(userOptions: UserOptions): Options;
|
|
86
|
-
loadShare<T>(pkgName: string, extraOptions?: {
|
|
87
|
-
customShareInfo?: Partial<Shared>;
|
|
88
|
-
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
89
|
-
}): Promise<false | (() => T | undefined)>;
|
|
90
|
-
loadShareSync<T>(pkgName: string, extraOptions?: {
|
|
91
|
-
customShareInfo?: Partial<Shared>;
|
|
92
|
-
from?: 'build' | 'runtime';
|
|
93
|
-
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
94
|
-
}): () => T | never;
|
|
95
|
-
initializeSharing(shareScopeName?: string, extraOptions?: {
|
|
96
|
-
initScope?: InitScope;
|
|
97
|
-
from?: CallFrom;
|
|
98
|
-
strategy?: Shared['strategy'];
|
|
99
|
-
}): Array<Promise<void>>;
|
|
100
|
-
initRawContainer(name: string, url: string, container: RemoteEntryExports): Module;
|
|
101
|
-
loadRemote<T>(id: string, options?: {
|
|
102
|
-
loadFactory?: boolean;
|
|
103
|
-
from: CallFrom;
|
|
104
|
-
}): Promise<T | null>;
|
|
105
|
-
preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
|
|
106
|
-
initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string], extraOptions?: {
|
|
107
|
-
hostShareScopeMap?: ShareScopeMap;
|
|
108
|
-
}): void;
|
|
109
|
-
formatOptions(globalOptions: Options, userOptions: UserOptions): Options;
|
|
110
|
-
registerPlugins(plugins: UserOptions['plugins']): void;
|
|
111
|
-
registerRemotes(remotes: Remote[], options?: {
|
|
112
|
-
force?: boolean;
|
|
113
|
-
}): void;
|
|
114
|
-
}
|
|
1
|
+
import runtimeCore from '@module-federation/runtime-core';
|
|
2
|
+
export * from '@module-federation/runtime-core';
|
|
3
|
+
export default runtimeCore;
|
package/dist/src/embedded.d.ts
CHANGED
|
@@ -17,32 +17,32 @@ export declare class FederationHost implements IndexModule.FederationHost {
|
|
|
17
17
|
private _args;
|
|
18
18
|
constructor(...args: ConstructorParameters<typeof IndexModule.FederationHost>);
|
|
19
19
|
private _getInstance;
|
|
20
|
-
get options(): import("
|
|
21
|
-
set options(value: import("
|
|
22
|
-
get hooks(): import("
|
|
23
|
-
beforeInit: import("
|
|
24
|
-
userOptions: import("
|
|
25
|
-
options: import("
|
|
20
|
+
get options(): import("packages/runtime-core/dist/types.cjs").Options;
|
|
21
|
+
set options(value: import("packages/runtime-core/dist/types.cjs").Options);
|
|
22
|
+
get hooks(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
|
|
23
|
+
beforeInit: import("packages/runtime-core/dist/src/utils/hooks").SyncWaterfallHook<{
|
|
24
|
+
userOptions: import("packages/runtime-core/dist/src").UserOptions;
|
|
25
|
+
options: import("packages/runtime-core/dist/types.cjs").Options;
|
|
26
26
|
origin: IndexModule.FederationHost;
|
|
27
|
-
shareInfo: import("
|
|
27
|
+
shareInfo: import("packages/runtime-core/dist/types.cjs").ShareInfos;
|
|
28
28
|
}>;
|
|
29
|
-
init: import("
|
|
30
|
-
options: import("
|
|
29
|
+
init: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
|
|
30
|
+
options: import("packages/runtime-core/dist/types.cjs").Options;
|
|
31
31
|
origin: IndexModule.FederationHost;
|
|
32
32
|
}], void>;
|
|
33
|
-
beforeInitContainer: import("
|
|
34
|
-
shareScope: import("
|
|
35
|
-
initScope: import("
|
|
36
|
-
remoteEntryInitOptions: import("
|
|
37
|
-
remoteInfo: import("
|
|
33
|
+
beforeInitContainer: import("packages/runtime-core/dist/src/utils/hooks").AsyncWaterfallHook<{
|
|
34
|
+
shareScope: import("packages/runtime-core/dist/types.cjs").ShareScopeMap[string];
|
|
35
|
+
initScope: import("packages/runtime-core/dist/types.cjs").InitScope;
|
|
36
|
+
remoteEntryInitOptions: import("packages/runtime-core/dist/types.cjs").RemoteEntryInitOptions;
|
|
37
|
+
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
38
38
|
origin: IndexModule.FederationHost;
|
|
39
39
|
}>;
|
|
40
|
-
initContainer: import("
|
|
41
|
-
shareScope: import("
|
|
42
|
-
initScope: import("
|
|
43
|
-
remoteEntryInitOptions: import("
|
|
44
|
-
remoteInfo: import("
|
|
45
|
-
remoteEntryExports: import("
|
|
40
|
+
initContainer: import("packages/runtime-core/dist/src/utils/hooks").AsyncWaterfallHook<{
|
|
41
|
+
shareScope: import("packages/runtime-core/dist/types.cjs").ShareScopeMap[string];
|
|
42
|
+
initScope: import("packages/runtime-core/dist/types.cjs").InitScope;
|
|
43
|
+
remoteEntryInitOptions: import("packages/runtime-core/dist/types.cjs").RemoteEntryInitOptions;
|
|
44
|
+
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
45
|
+
remoteEntryExports: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports;
|
|
46
46
|
origin: IndexModule.FederationHost;
|
|
47
47
|
id: string;
|
|
48
48
|
remoteSnapshot?: import("packages/sdk/dist/src").ModuleInfo;
|
|
@@ -51,48 +51,48 @@ export declare class FederationHost implements IndexModule.FederationHost {
|
|
|
51
51
|
get version(): string;
|
|
52
52
|
get name(): string;
|
|
53
53
|
get moduleCache(): Map<string, IndexModule.Module>;
|
|
54
|
-
get snapshotHandler(): import("
|
|
55
|
-
get sharedHandler(): import("
|
|
56
|
-
get remoteHandler(): import("
|
|
57
|
-
get shareScopeMap(): import("
|
|
58
|
-
get loaderHook(): import("
|
|
59
|
-
getModuleInfo: import("
|
|
54
|
+
get snapshotHandler(): import("packages/runtime-core/dist/src/plugins/snapshot/SnapshotHandler").SnapshotHandler;
|
|
55
|
+
get sharedHandler(): import("packages/runtime-core/dist/src/shared").SharedHandler;
|
|
56
|
+
get remoteHandler(): import("packages/runtime-core/dist/src/remote").RemoteHandler;
|
|
57
|
+
get shareScopeMap(): import("packages/runtime-core/dist/types.cjs").ShareScopeMap;
|
|
58
|
+
get loaderHook(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
|
|
59
|
+
getModuleInfo: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
|
|
60
60
|
target: Record<string, any>;
|
|
61
61
|
key: any;
|
|
62
62
|
}], void | {
|
|
63
63
|
value: any | undefined;
|
|
64
64
|
key: string;
|
|
65
65
|
}>;
|
|
66
|
-
createScript: import("
|
|
66
|
+
createScript: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
|
|
67
67
|
url: string;
|
|
68
68
|
attrs?: Record<string, any>;
|
|
69
69
|
}], import("packages/sdk/dist/src").CreateScriptHookReturn>;
|
|
70
|
-
createLink: import("
|
|
70
|
+
createLink: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
|
|
71
71
|
url: string;
|
|
72
72
|
attrs?: Record<string, any>;
|
|
73
73
|
}], void | HTMLLinkElement>;
|
|
74
|
-
fetch: import("
|
|
75
|
-
loadEntryError: import("
|
|
74
|
+
fetch: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
75
|
+
loadEntryError: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[{
|
|
76
76
|
getRemoteEntry: typeof IndexModule.getRemoteEntry;
|
|
77
77
|
origin: IndexModule.FederationHost;
|
|
78
|
-
remoteInfo: import("
|
|
79
|
-
remoteEntryExports?: import("
|
|
80
|
-
globalLoading: Record<string, Promise<void | import("
|
|
78
|
+
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
79
|
+
remoteEntryExports?: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined;
|
|
80
|
+
globalLoading: Record<string, Promise<void | import("packages/runtime-core/dist/types.cjs").RemoteEntryExports> | undefined>;
|
|
81
81
|
uniqueKey: string;
|
|
82
|
-
}], Promise<(() => Promise<import("
|
|
83
|
-
getModuleFactory: import("
|
|
84
|
-
remoteEntryExports: import("
|
|
82
|
+
}], Promise<(() => Promise<import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined>) | undefined>>;
|
|
83
|
+
getModuleFactory: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[{
|
|
84
|
+
remoteEntryExports: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports;
|
|
85
85
|
expose: string;
|
|
86
|
-
moduleInfo: import("
|
|
86
|
+
moduleInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
87
87
|
}], Promise<(() => Promise<IndexModule.Module>) | undefined>>;
|
|
88
88
|
}>;
|
|
89
|
-
get bridgeHook(): import("
|
|
90
|
-
beforeBridgeRender: import("
|
|
91
|
-
afterBridgeRender: import("
|
|
92
|
-
beforeBridgeDestroy: import("
|
|
93
|
-
afterBridgeDestroy: import("
|
|
89
|
+
get bridgeHook(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
|
|
90
|
+
beforeBridgeRender: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
91
|
+
afterBridgeRender: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
92
|
+
beforeBridgeDestroy: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
93
|
+
afterBridgeDestroy: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
94
94
|
}>;
|
|
95
|
-
initOptions(...args: Parameters<IndexModule.FederationHost['initOptions']>): import("
|
|
95
|
+
initOptions(...args: Parameters<IndexModule.FederationHost['initOptions']>): import("packages/runtime-core/dist/types.cjs").Options;
|
|
96
96
|
loadShare<T>(...args: Parameters<IndexModule.FederationHost['loadShare']>): Promise<false | (() => T | undefined)>;
|
|
97
97
|
loadShareSync<T>(...args: Parameters<IndexModule.FederationHost['loadShareSync']>): () => T | never;
|
|
98
98
|
initializeSharing(...args: Parameters<IndexModule.FederationHost['initializeSharing']>): Promise<void>[];
|
|
@@ -102,7 +102,7 @@ export declare class FederationHost implements IndexModule.FederationHost {
|
|
|
102
102
|
initShareScopeMap(...args: Parameters<IndexModule.FederationHost['initShareScopeMap']>): void;
|
|
103
103
|
registerPlugins(...args: Parameters<IndexModule.FederationHost['registerPlugins']>): void;
|
|
104
104
|
registerRemotes(...args: Parameters<IndexModule.FederationHost['registerRemotes']>): void;
|
|
105
|
-
formatOptions(...args: Parameters<IndexModule.FederationHost['formatOptions']>): import("
|
|
105
|
+
formatOptions(...args: Parameters<IndexModule.FederationHost['formatOptions']>): import("packages/runtime-core/dist/types.cjs").Options;
|
|
106
106
|
}
|
|
107
107
|
export interface ModuleInterface {
|
|
108
108
|
remoteInfo: IndexModule.Module['remoteInfo'];
|
|
@@ -117,15 +117,15 @@ export declare class Module implements ModuleInterface {
|
|
|
117
117
|
private _args;
|
|
118
118
|
constructor(...args: ConstructorParameters<typeof IndexModule.Module>);
|
|
119
119
|
private _getInstance;
|
|
120
|
-
get remoteInfo(): import("
|
|
121
|
-
set remoteInfo(value: import("
|
|
120
|
+
get remoteInfo(): import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
121
|
+
set remoteInfo(value: import("packages/runtime-core/dist/types.cjs").RemoteInfo);
|
|
122
122
|
get inited(): boolean;
|
|
123
123
|
set inited(value: boolean);
|
|
124
|
-
get lib(): import("
|
|
125
|
-
set lib(value: import("
|
|
124
|
+
get lib(): import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined;
|
|
125
|
+
set lib(value: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined);
|
|
126
126
|
get host(): IndexModule.FederationHost;
|
|
127
127
|
set host(value: IndexModule.FederationHost);
|
|
128
|
-
getEntry(...args: Parameters<IndexModule.Module['getEntry']>): Promise<import("
|
|
128
|
+
getEntry(...args: Parameters<IndexModule.Module['getEntry']>): Promise<import("packages/runtime-core/dist/types.cjs").RemoteEntryExports>;
|
|
129
129
|
get(...args: Parameters<IndexModule.Module['get']>): Promise<any>;
|
|
130
130
|
private wraperFactory;
|
|
131
131
|
}
|
package/dist/src/helpers.d.ts
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
interface IShareUtils {
|
|
4
|
-
getRegisteredShare: typeof getRegisteredShare;
|
|
5
|
-
getGlobalShareScope: typeof getGlobalShareScope;
|
|
6
|
-
}
|
|
7
|
-
interface IGlobalUtils {
|
|
8
|
-
Global: typeof Global;
|
|
9
|
-
nativeGlobal: typeof global;
|
|
10
|
-
resetFederationGlobalInfo: typeof resetFederationGlobalInfo;
|
|
11
|
-
getGlobalFederationInstance: typeof getGlobalFederationInstance;
|
|
12
|
-
setGlobalFederationInstance: typeof setGlobalFederationInstance;
|
|
13
|
-
getGlobalFederationConstructor: typeof getGlobalFederationConstructor;
|
|
14
|
-
setGlobalFederationConstructor: typeof setGlobalFederationConstructor;
|
|
15
|
-
getInfoWithoutType: typeof getInfoWithoutType;
|
|
16
|
-
getGlobalSnapshot: typeof getGlobalSnapshot;
|
|
17
|
-
getTargetSnapshotInfoByModuleInfo: typeof getTargetSnapshotInfoByModuleInfo;
|
|
18
|
-
getGlobalSnapshotInfoByModuleInfo: typeof getGlobalSnapshotInfoByModuleInfo;
|
|
19
|
-
setGlobalSnapshotInfoByModuleInfo: typeof setGlobalSnapshotInfoByModuleInfo;
|
|
20
|
-
addGlobalSnapshot: typeof addGlobalSnapshot;
|
|
21
|
-
getRemoteEntryExports: typeof getRemoteEntryExports;
|
|
22
|
-
registerGlobalPlugins: typeof registerGlobalPlugins;
|
|
23
|
-
getGlobalHostPlugins: typeof getGlobalHostPlugins;
|
|
24
|
-
getPreloaded: typeof getPreloaded;
|
|
25
|
-
setPreloaded: typeof setPreloaded;
|
|
26
|
-
}
|
|
1
|
+
import { getGlobalFederationInstance } from './utils';
|
|
2
|
+
export type { IGlobalUtils, IShareUtils, } from '@module-federation/runtime-core';
|
|
27
3
|
declare const _default: {
|
|
28
|
-
global:
|
|
29
|
-
|
|
4
|
+
global: {
|
|
5
|
+
getGlobalFederationInstance: typeof getGlobalFederationInstance;
|
|
6
|
+
Global: typeof import("@module-federation/runtime-core").Global;
|
|
7
|
+
nativeGlobal: typeof global;
|
|
8
|
+
resetFederationGlobalInfo: typeof import("@module-federation/runtime-core").resetFederationGlobalInfo;
|
|
9
|
+
setGlobalFederationInstance: typeof import("@module-federation/runtime-core").setGlobalFederationInstance;
|
|
10
|
+
getGlobalFederationConstructor: typeof import("@module-federation/runtime-core").getGlobalFederationConstructor;
|
|
11
|
+
setGlobalFederationConstructor: typeof import("@module-federation/runtime-core").setGlobalFederationConstructor;
|
|
12
|
+
getInfoWithoutType: typeof import("@module-federation/runtime-core").getInfoWithoutType;
|
|
13
|
+
getGlobalSnapshot: typeof import("@module-federation/runtime-core").getGlobalSnapshot;
|
|
14
|
+
getTargetSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").getTargetSnapshotInfoByModuleInfo;
|
|
15
|
+
getGlobalSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").getGlobalSnapshotInfoByModuleInfo;
|
|
16
|
+
setGlobalSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").setGlobalSnapshotInfoByModuleInfo;
|
|
17
|
+
addGlobalSnapshot: typeof import("@module-federation/runtime-core").addGlobalSnapshot;
|
|
18
|
+
getRemoteEntryExports: typeof import("packages/runtime-core/dist/src/global").getRemoteEntryExports;
|
|
19
|
+
registerGlobalPlugins: typeof import("@module-federation/runtime-core").registerGlobalPlugins;
|
|
20
|
+
getGlobalHostPlugins: typeof import("packages/runtime-core/dist/src/global").getGlobalHostPlugins;
|
|
21
|
+
getPreloaded: typeof import("packages/runtime-core/dist/src/global").getPreloaded;
|
|
22
|
+
setPreloaded: typeof import("packages/runtime-core/dist/src/global").setPreloaded;
|
|
23
|
+
};
|
|
24
|
+
share: import("@module-federation/runtime-core").IShareUtils;
|
|
30
25
|
};
|
|
31
26
|
export default _default;
|
|
32
|
-
export type { IGlobalUtils, IShareUtils };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { FederationHost } from '
|
|
2
|
-
|
|
3
|
-
export { FederationHost }
|
|
4
|
-
export { registerGlobalPlugins } from './global';
|
|
5
|
-
export { getRemoteEntry, getRemoteInfo } from './utils';
|
|
6
|
-
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
7
|
-
export { Module } from './module';
|
|
8
|
-
export type { Federation } from './global';
|
|
9
|
-
export type { FederationRuntimePlugin };
|
|
1
|
+
import { FederationHost, type UserOptions } from '@module-federation/runtime-core';
|
|
2
|
+
export { loadScript, loadScriptNode, Module, getRemoteEntry, getRemoteInfo, registerGlobalPlugins, type FederationRuntimePlugin, type Federation, } from '@module-federation/runtime-core';
|
|
3
|
+
export { FederationHost };
|
|
10
4
|
export declare function init(options: UserOptions): FederationHost;
|
|
11
5
|
export declare function loadRemote<T>(...args: Parameters<FederationHost['loadRemote']>): Promise<T | null>;
|
|
12
6
|
export declare function loadShare<T>(...args: Parameters<FederationHost['loadShare']>): Promise<false | (() => T | undefined)>;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '@module-federation/runtime-core/types';
|
package/dist/types.cjs.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var types = require('@module-federation/runtime-core/types');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(types).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return types[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
package/dist/types.esm.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from '@module-federation/runtime-core/types';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var runtimeCore = require('@module-federation/runtime-core');
|
|
4
|
+
|
|
5
|
+
// injected by bundler, so it can not use runtime-core stuff
|
|
6
|
+
function getBuilderId() {
|
|
7
|
+
//@ts-ignore
|
|
8
|
+
return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' ? FEDERATION_BUILD_IDENTIFIER : '';
|
|
9
|
+
}
|
|
10
|
+
function getGlobalFederationInstance(name, version) {
|
|
11
|
+
const buildId = getBuilderId();
|
|
12
|
+
return runtimeCore.CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance)=>{
|
|
13
|
+
if (buildId && GMInstance.options.id === getBuilderId()) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (GMInstance.options.name === name && !GMInstance.options.version && !version) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (GMInstance.options.name === name && version && GMInstance.options.version === version) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.getGlobalFederationInstance = getGlobalFederationInstance;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CurrentGlobal } from '@module-federation/runtime-core';
|
|
2
|
+
|
|
3
|
+
// injected by bundler, so it can not use runtime-core stuff
|
|
4
|
+
function getBuilderId() {
|
|
5
|
+
//@ts-ignore
|
|
6
|
+
return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' ? FEDERATION_BUILD_IDENTIFIER : '';
|
|
7
|
+
}
|
|
8
|
+
function getGlobalFederationInstance(name, version) {
|
|
9
|
+
const buildId = getBuilderId();
|
|
10
|
+
return CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance)=>{
|
|
11
|
+
if (buildId && GMInstance.options.id === getBuilderId()) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (GMInstance.options.name === name && !GMInstance.options.version && !version) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (GMInstance.options.name === name && version && GMInstance.options.version === version) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { getGlobalFederationInstance as g };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.mjs",
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
"import": "./dist/types.esm.mjs",
|
|
35
35
|
"require": "./dist/types.cjs.js"
|
|
36
36
|
},
|
|
37
|
+
"./core": {
|
|
38
|
+
"types": "./dist/core.cjs.d.ts",
|
|
39
|
+
"import": "./dist/core.esm.mjs",
|
|
40
|
+
"require": "./dist/core.cjs.js"
|
|
41
|
+
},
|
|
37
42
|
"./embedded": {
|
|
38
43
|
"types": "./dist/embedded.cjs.d.ts",
|
|
39
44
|
"import": "./dist/embedded.esm.mjs",
|
|
@@ -51,11 +56,15 @@
|
|
|
51
56
|
],
|
|
52
57
|
"types": [
|
|
53
58
|
"./dist/types.cjs.d.ts"
|
|
59
|
+
],
|
|
60
|
+
"core": [
|
|
61
|
+
"./dist/core.cjs.d.ts"
|
|
54
62
|
]
|
|
55
63
|
}
|
|
56
64
|
},
|
|
57
65
|
"dependencies": {
|
|
58
|
-
"@module-federation/sdk": "0.8.
|
|
59
|
-
"@module-federation/error-codes": "0.8.
|
|
66
|
+
"@module-federation/sdk": "0.8.7",
|
|
67
|
+
"@module-federation/error-codes": "0.8.7",
|
|
68
|
+
"@module-federation/runtime-core": "0.6.15"
|
|
60
69
|
}
|
|
61
70
|
}
|