@module-federation/runtime 0.0.0-next-20240412182228 → 0.0.0-next-20240415101817
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/README.md +5 -784
- package/dist/helpers.esm.js +1 -1
- package/dist/index.cjs.js +76 -36
- package/dist/index.esm.js +78 -38
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +37 -7
- package/dist/share.esm.js +36 -8
- package/dist/src/core.d.ts +8 -2
- package/dist/src/type/config.d.ts +8 -4
- package/dist/src/utils/plugin.d.ts +1 -1
- package/dist/src/utils/share.d.ts +11 -5
- package/dist/src/utils/tool.d.ts +1 -0
- package/package.json +2 -2
|
@@ -15,6 +15,10 @@ export type RemoteInfoOptionalVersion = {
|
|
|
15
15
|
version?: string;
|
|
16
16
|
} & RemoteInfoCommon;
|
|
17
17
|
export type Remote = (RemoteWithEntry | RemoteWithVersion) & RemoteInfoCommon;
|
|
18
|
+
export type LoadShareExtraOptions = {
|
|
19
|
+
customShareInfo?: Partial<Shared>;
|
|
20
|
+
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
21
|
+
};
|
|
18
22
|
export interface RemoteInfo {
|
|
19
23
|
name: string;
|
|
20
24
|
version?: string;
|
|
@@ -32,7 +36,7 @@ export interface SharedConfig {
|
|
|
32
36
|
strictVersion?: boolean;
|
|
33
37
|
}
|
|
34
38
|
type SharedBaseArgs = {
|
|
35
|
-
version
|
|
39
|
+
version?: string;
|
|
36
40
|
shareConfig?: SharedConfig;
|
|
37
41
|
scope?: string | Array<string>;
|
|
38
42
|
deps?: Array<string>;
|
|
@@ -43,7 +47,7 @@ export type ShareArgs = (SharedBaseArgs & {
|
|
|
43
47
|
get: SharedGetter;
|
|
44
48
|
}) | (SharedBaseArgs & {
|
|
45
49
|
lib: () => Module;
|
|
46
|
-
});
|
|
50
|
+
}) | SharedBaseArgs;
|
|
47
51
|
export type Shared = {
|
|
48
52
|
version: string;
|
|
49
53
|
get: SharedGetter;
|
|
@@ -69,7 +73,7 @@ export type GlobalShareScopeMap = {
|
|
|
69
73
|
[instanceName: string]: ShareScopeMap;
|
|
70
74
|
};
|
|
71
75
|
export type ShareInfos = {
|
|
72
|
-
[pkgName: string]: Shared;
|
|
76
|
+
[pkgName: string]: Shared[];
|
|
73
77
|
};
|
|
74
78
|
export interface Options {
|
|
75
79
|
id?: string;
|
|
@@ -82,7 +86,7 @@ export interface Options {
|
|
|
82
86
|
}
|
|
83
87
|
export type UserOptions = Omit<Optional<Options, 'plugins'>, 'shared' | 'inBrowser'> & {
|
|
84
88
|
shared?: {
|
|
85
|
-
[pkgName: string]: ShareArgs;
|
|
89
|
+
[pkgName: string]: ShareArgs | ShareArgs[];
|
|
86
90
|
};
|
|
87
91
|
};
|
|
88
92
|
export type LoadModuleOptions = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
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<FederationHost['hooks'] | FederationHost['snapshotHandler']['hooks'] | Module['host']['loaderHook']>):
|
|
4
|
+
export declare function registerPlugins(plugins: UserOptions['plugins'], hookInstances: Array<FederationHost['hooks'] | FederationHost['snapshotHandler']['hooks'] | Module['host']['loaderHook']>): import("../type").FederationRuntimePlugin[] | undefined;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Federation } from '../global';
|
|
2
|
-
import { GlobalShareScopeMap, Shared, ShareArgs, ShareInfos, ShareScopeMap } from '../type';
|
|
2
|
+
import { GlobalShareScopeMap, Shared, ShareArgs, ShareInfos, ShareScopeMap, LoadShareExtraOptions, UserOptions } from '../type';
|
|
3
3
|
import { SyncWaterfallHook } from './hooks';
|
|
4
4
|
export declare function formatShare(shareArgs: ShareArgs, from: string): Shared;
|
|
5
|
-
export declare function formatShareConfigs(shareArgs:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare
|
|
5
|
+
export declare function formatShareConfigs(shareArgs: UserOptions['shared'], from: string): ShareInfos;
|
|
6
|
+
export declare function versionLt(a: string, b: string): boolean;
|
|
7
|
+
export declare const findVersion: (shareVersionMap: ShareScopeMap[string][string], cb?: ((prev: string, cur: string) => boolean) | undefined) => string;
|
|
8
|
+
export declare const isLoaded: (shared: Shared) => boolean;
|
|
9
|
+
export declare function getRegisteredShare(localShareScopeMap: ShareScopeMap, pkgName: string, shareInfo: Shared, resolveShare: SyncWaterfallHook<{
|
|
9
10
|
shareScopeMap: ShareScopeMap;
|
|
10
11
|
scope: string;
|
|
11
12
|
pkgName: string;
|
|
@@ -14,3 +15,8 @@ export declare function getRegisteredShare(localShareScopeMap: ShareScopeMap, pk
|
|
|
14
15
|
resolver: () => Shared | undefined;
|
|
15
16
|
}>): Shared | void;
|
|
16
17
|
export declare function getGlobalShareScope(): GlobalShareScopeMap;
|
|
18
|
+
export declare function getTargetSharedOptions(options: {
|
|
19
|
+
pkgName: string;
|
|
20
|
+
extraOptions?: LoadShareExtraOptions;
|
|
21
|
+
shareInfos: ShareInfos;
|
|
22
|
+
}): Shared & Partial<Shared>;
|
package/dist/src/utils/tool.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export declare function isObject(val: any): boolean;
|
|
|
10
10
|
export declare const objectToString: () => string;
|
|
11
11
|
export declare function isPlainObject(val: any): val is object;
|
|
12
12
|
export declare function isStaticResourcesEqual(url1: string, url2: string): boolean;
|
|
13
|
+
export declare function arrayOptions<T>(options: T | Array<T>): Array<T>;
|
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-20240415101817",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
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-20240415101817"
|
|
49
49
|
}
|
|
50
50
|
}
|