@module-federation/runtime 0.1.12 → 0.1.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
package/dist/share.cjs.js CHANGED
@@ -190,7 +190,7 @@ function getGlobalFederationConstructor() {
190
190
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
191
191
  if (isDebug) {
192
192
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
193
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.12";
193
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.14";
194
194
  }
195
195
  }
196
196
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -697,11 +697,10 @@ function formatShare(shareArgs, from, name) {
697
697
  strategy: shareArgs.strategy || 'version-first'
698
698
  });
699
699
  }
700
- function formatShareConfigs(shareArgs, from) {
701
- if (!shareArgs) {
702
- return {};
703
- }
704
- return Object.keys(shareArgs).reduce((res, pkgName)=>{
700
+ function formatShareConfigs(globalOptions, userOptions) {
701
+ const shareArgs = userOptions.shared || {};
702
+ const from = userOptions.name;
703
+ const shareInfos = Object.keys(shareArgs).reduce((res, pkgName)=>{
705
704
  const arrayShareArgs = arrayOptions(shareArgs[pkgName]);
706
705
  res[pkgName] = res[pkgName] || [];
707
706
  arrayShareArgs.forEach((shareConfig)=>{
@@ -709,6 +708,23 @@ function formatShareConfigs(shareArgs, from) {
709
708
  });
710
709
  return res;
711
710
  }, {});
711
+ const shared = _extends({}, globalOptions.shared);
712
+ Object.keys(shareInfos).forEach((shareKey)=>{
713
+ if (!shared[shareKey]) {
714
+ shared[shareKey] = shareInfos[shareKey];
715
+ } else {
716
+ shareInfos[shareKey].forEach((newUserSharedOptions)=>{
717
+ const isSameVersion = shared[shareKey].find((sharedVal)=>sharedVal.version === newUserSharedOptions.version);
718
+ if (!isSameVersion) {
719
+ shared[shareKey].push(newUserSharedOptions);
720
+ }
721
+ });
722
+ }
723
+ });
724
+ return {
725
+ shared,
726
+ shareInfos
727
+ };
712
728
  }
713
729
  function versionLt(a, b) {
714
730
  const transformInvalidVersion = (version)=>{
package/dist/share.esm.js CHANGED
@@ -188,7 +188,7 @@ function getGlobalFederationConstructor() {
188
188
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
189
189
  if (isDebug) {
190
190
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
191
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.12";
191
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.14";
192
192
  }
193
193
  }
194
194
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -695,11 +695,10 @@ function formatShare(shareArgs, from, name) {
695
695
  strategy: shareArgs.strategy || 'version-first'
696
696
  });
697
697
  }
698
- function formatShareConfigs(shareArgs, from) {
699
- if (!shareArgs) {
700
- return {};
701
- }
702
- return Object.keys(shareArgs).reduce((res, pkgName)=>{
698
+ function formatShareConfigs(globalOptions, userOptions) {
699
+ const shareArgs = userOptions.shared || {};
700
+ const from = userOptions.name;
701
+ const shareInfos = Object.keys(shareArgs).reduce((res, pkgName)=>{
703
702
  const arrayShareArgs = arrayOptions(shareArgs[pkgName]);
704
703
  res[pkgName] = res[pkgName] || [];
705
704
  arrayShareArgs.forEach((shareConfig)=>{
@@ -707,6 +706,23 @@ function formatShareConfigs(shareArgs, from) {
707
706
  });
708
707
  return res;
709
708
  }, {});
709
+ const shared = _extends({}, globalOptions.shared);
710
+ Object.keys(shareInfos).forEach((shareKey)=>{
711
+ if (!shared[shareKey]) {
712
+ shared[shareKey] = shareInfos[shareKey];
713
+ } else {
714
+ shareInfos[shareKey].forEach((newUserSharedOptions)=>{
715
+ const isSameVersion = shared[shareKey].find((sharedVal)=>sharedVal.version === newUserSharedOptions.version);
716
+ if (!isSameVersion) {
717
+ shared[shareKey].push(newUserSharedOptions);
718
+ }
719
+ });
720
+ }
721
+ });
722
+ return {
723
+ shared,
724
+ shareInfos
725
+ };
710
726
  }
711
727
  function versionLt(a, b) {
712
728
  const transformInvalidVersion = (version)=>{
@@ -854,4 +870,4 @@ function getTargetSharedOptions(options) {
854
870
  return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
855
871
  }
856
872
 
857
- export { isBrowserEnv as A, addUniqueItem as B, setGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, getGlobalFederationInstance as E, getGlobalFederationConstructor as F, Global as G, setGlobalFederationInstance as H, registerGlobalPlugins as I, nativeGlobal as J, resetFederationGlobalInfo as K, getTargetSnapshotInfoByModuleInfo as L, globalLoading as a, DEFAULT_SCOPE as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getInfoWithoutType as l, getPreloaded as m, setPreloaded as n, getRegisteredShare as o, arrayOptions as p, getGlobalSnapshotInfoByModuleInfo as q, addGlobalSnapshot as r, safeToString as s, setGlobalSnapshotInfoByModuleInfo as t, getGlobalSnapshot as u, getGlobalShareScope as v, warn as w, getTargetSharedOptions as x, formatShareConfigs as y, getBuilderId as z };
873
+ export { getBuilderId as A, isBrowserEnv as B, setGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, getGlobalFederationInstance as E, getGlobalFederationConstructor as F, Global as G, setGlobalFederationInstance as H, registerGlobalPlugins as I, nativeGlobal as J, resetFederationGlobalInfo as K, getTargetSnapshotInfoByModuleInfo as L, globalLoading as a, DEFAULT_SCOPE as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getInfoWithoutType as l, getPreloaded as m, setPreloaded as n, getRegisteredShare as o, arrayOptions as p, getGlobalSnapshotInfoByModuleInfo as q, addGlobalSnapshot as r, safeToString as s, setGlobalSnapshotInfoByModuleInfo as t, getGlobalSnapshot as u, formatShareConfigs as v, warn as w, getTargetSharedOptions as x, getGlobalShareScope as y, addUniqueItem as z };
@@ -1,19 +1,10 @@
1
- import type { ModuleInfo, GlobalModuleInfo } from '@module-federation/sdk';
2
- import { Options, PreloadAssets, PreloadOptions, PreloadRemoteArgs, RemoteEntryExports, Remote, Shared, ShareInfos, UserOptions, RemoteInfo, ShareScopeMap, InitScope, RemoteEntryInitOptions } from './type';
3
- import { Module, ModuleOptions } from './module';
1
+ import type { CreateScriptHookReturn } from '@module-federation/sdk';
2
+ import { Options, PreloadRemoteArgs, RemoteEntryExports, Remote, Shared, ShareInfos, UserOptions, RemoteInfo, ShareScopeMap, InitScope, RemoteEntryInitOptions } from './type';
3
+ import { Module } from './module';
4
4
  import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHook } from './utils/hooks';
5
- import { Federation } from './global';
6
5
  import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler';
7
- interface LoadRemoteMatch {
8
- id: string;
9
- pkgNameOrAlias: string;
10
- expose: string;
11
- remote: Remote;
12
- options: Options;
13
- origin: FederationHost;
14
- remoteInfo: RemoteInfo;
15
- remoteSnapshot?: ModuleInfo;
16
- }
6
+ import { SharedHandler } from './shared';
7
+ import { RemoteHandler } from './remote';
17
8
  export declare class FederationHost {
18
9
  options: Options;
19
10
  hooks: PluginSystem<{
@@ -27,12 +18,6 @@ export declare class FederationHost {
27
18
  options: Options;
28
19
  origin: FederationHost;
29
20
  }], void>;
30
- beforeRequest: AsyncWaterfallHook<{
31
- id: string;
32
- options: Options;
33
- origin: FederationHost;
34
- }>;
35
- afterResolve: AsyncWaterfallHook<LoadRemoteMatch>;
36
21
  beforeInitContainer: AsyncWaterfallHook<{
37
22
  shareScope: ShareScopeMap[string];
38
23
  initScope: InitScope;
@@ -40,11 +25,6 @@ export declare class FederationHost {
40
25
  remoteInfo: RemoteInfo;
41
26
  origin: FederationHost;
42
27
  }>;
43
- initContainerShareScopeMap: AsyncWaterfallHook<{
44
- shareScope: ShareScopeMap[string];
45
- options: Options;
46
- origin: FederationHost;
47
- }>;
48
28
  initContainer: AsyncWaterfallHook<{
49
29
  shareScope: ShareScopeMap[string];
50
30
  initScope: InitScope;
@@ -53,71 +33,13 @@ export declare class FederationHost {
53
33
  remoteEntryExports: RemoteEntryExports;
54
34
  origin: FederationHost;
55
35
  }>;
56
- onLoad: AsyncHook<[{
57
- id: string;
58
- expose: string;
59
- pkgNameOrAlias: string;
60
- remote: Remote;
61
- options: ModuleOptions;
62
- origin: FederationHost;
63
- exposeModule: any;
64
- exposeModuleFactory: any;
65
- moduleInstance: Module;
66
- }], void>;
67
- handlePreloadModule: SyncHook<{
68
- id: string;
69
- name: string;
70
- remote: Remote;
71
- remoteSnapshot: ModuleInfo;
72
- preloadConfig: PreloadRemoteArgs;
73
- origin: FederationHost;
74
- }, void>;
75
- errorLoadRemote: AsyncHook<[{
76
- id: string;
77
- error: unknown;
78
- options?: any;
79
- from: 'build' | 'runtime';
80
- lifecycle: 'onLoad' | 'beforeRequest';
81
- origin: FederationHost;
82
- }], unknown>;
83
- beforeLoadShare: AsyncWaterfallHook<{
84
- pkgName: string;
85
- shareInfo?: Shared | undefined;
86
- shared: Options['shared'];
87
- origin: FederationHost;
88
- }>;
89
- loadShare: AsyncHook<[FederationHost, string, ShareInfos], false | void | Promise<false | void>>;
90
- resolveShare: SyncWaterfallHook<{
91
- shareScopeMap: ShareScopeMap;
92
- scope: string;
93
- pkgName: string;
94
- version: string;
95
- GlobalFederation: Federation;
96
- resolver: () => Shared | undefined;
97
- }>;
98
- beforePreloadRemote: AsyncHook<{
99
- preloadOps: Array<PreloadRemoteArgs>;
100
- options: Options;
101
- origin: FederationHost;
102
- }, false | void | Promise<false | void>>;
103
- generatePreloadAssets: AsyncHook<[{
104
- origin: FederationHost;
105
- preloadOptions: PreloadOptions[number];
106
- remote: Remote;
107
- remoteInfo: RemoteInfo;
108
- remoteSnapshot: ModuleInfo;
109
- globalSnapshot: GlobalModuleInfo;
110
- }], Promise<PreloadAssets>>;
111
- afterPreloadRemote: AsyncHook<{
112
- preloadOps: Array<PreloadRemoteArgs>;
113
- options: Options;
114
- origin: FederationHost;
115
- }, false | void | Promise<false | void>>;
116
36
  }>;
117
37
  version: string;
118
38
  name: string;
119
39
  moduleCache: Map<string, Module>;
120
40
  snapshotHandler: SnapshotHandler;
41
+ sharedHandler: SharedHandler;
42
+ remoteHandler: RemoteHandler;
121
43
  shareScopeMap: ShareScopeMap;
122
44
  loaderHook: PluginSystem<{
123
45
  getModuleInfo: SyncHook<[{
@@ -129,14 +51,13 @@ export declare class FederationHost {
129
51
  }>;
130
52
  createScript: SyncHook<[{
131
53
  url: string;
132
- }], void | HTMLScriptElement>;
54
+ }], CreateScriptHookReturn>;
133
55
  createLink: SyncHook<[{
134
56
  url: string;
135
57
  }], void | HTMLLinkElement>;
136
58
  fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
137
59
  }>;
138
60
  constructor(userOptions: UserOptions);
139
- private _setGlobalShareScopeMap;
140
61
  initOptions(userOptions: UserOptions): Options;
141
62
  loadShare<T>(pkgName: string, extraOptions?: {
142
63
  customShareInfo?: Partial<Shared>;
@@ -146,27 +67,17 @@ export declare class FederationHost {
146
67
  customShareInfo?: Partial<Shared>;
147
68
  resolver?: (sharedOptions: ShareInfos[string]) => Shared;
148
69
  }): () => T | never;
70
+ initializeSharing(shareScopeName?: string, strategy?: Shared['strategy']): Array<Promise<void>>;
149
71
  initRawContainer(name: string, url: string, container: RemoteEntryExports): Module;
150
- private _getRemoteModuleAndOptions;
151
72
  loadRemote<T>(id: string, options?: {
152
73
  loadFactory?: boolean;
153
74
  from: 'build' | 'runtime';
154
75
  }): Promise<T | null>;
155
76
  preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
156
- /**
157
- * This function initializes the sharing sequence (executed only once per share scope).
158
- * It accepts one argument, the name of the share scope.
159
- * If the share scope does not exist, it creates one.
160
- */
161
- initializeSharing(shareScopeName?: string, strategy?: Shared['strategy']): Array<Promise<void>>;
162
77
  initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string]): void;
163
78
  private formatOptions;
164
79
  registerPlugins(plugins: UserOptions['plugins']): void;
165
- private setShared;
166
- private removeRemote;
167
- private registerRemote;
168
80
  registerRemotes(remotes: Remote[], options?: {
169
81
  force?: boolean;
170
82
  }): void;
171
83
  }
172
- export {};
@@ -0,0 +1,91 @@
1
+ import { type ModuleInfo, type GlobalModuleInfo } from '@module-federation/sdk';
2
+ import { Options, UserOptions, PreloadAssets, PreloadOptions, PreloadRemoteArgs, Remote, RemoteInfo } from '../type';
3
+ import { FederationHost } from '../core';
4
+ import { PluginSystem, AsyncHook, AsyncWaterfallHook, SyncHook } from '../utils/hooks';
5
+ import { Module, ModuleOptions } from '../module';
6
+ export interface LoadRemoteMatch {
7
+ id: string;
8
+ pkgNameOrAlias: string;
9
+ expose: string;
10
+ remote: Remote;
11
+ options: Options;
12
+ origin: FederationHost;
13
+ remoteInfo: RemoteInfo;
14
+ remoteSnapshot?: ModuleInfo;
15
+ }
16
+ export declare class RemoteHandler {
17
+ host: FederationHost;
18
+ hooks: PluginSystem<{
19
+ beforeRequest: AsyncWaterfallHook<{
20
+ id: string;
21
+ options: Options;
22
+ origin: FederationHost;
23
+ }>;
24
+ onLoad: AsyncHook<[{
25
+ id: string;
26
+ expose: string;
27
+ pkgNameOrAlias: string;
28
+ remote: Remote;
29
+ options: ModuleOptions;
30
+ origin: FederationHost;
31
+ exposeModule: any;
32
+ exposeModuleFactory: any;
33
+ moduleInstance: Module;
34
+ }], void>;
35
+ handlePreloadModule: SyncHook<{
36
+ id: string;
37
+ name: string;
38
+ remote: Remote;
39
+ remoteSnapshot: ModuleInfo;
40
+ preloadConfig: PreloadRemoteArgs;
41
+ origin: FederationHost;
42
+ }, void>;
43
+ errorLoadRemote: AsyncHook<[{
44
+ id: string;
45
+ error: unknown;
46
+ options?: any;
47
+ from: 'build' | 'runtime';
48
+ lifecycle: 'onLoad' | 'beforeRequest';
49
+ origin: FederationHost;
50
+ }], unknown>;
51
+ beforePreloadRemote: AsyncHook<{
52
+ preloadOps: Array<PreloadRemoteArgs>;
53
+ options: Options;
54
+ origin: FederationHost;
55
+ }, false | void | Promise<false | void>>;
56
+ generatePreloadAssets: AsyncHook<[{
57
+ origin: FederationHost;
58
+ preloadOptions: PreloadOptions[number];
59
+ remote: Remote;
60
+ remoteInfo: RemoteInfo;
61
+ remoteSnapshot: ModuleInfo;
62
+ globalSnapshot: GlobalModuleInfo;
63
+ }], Promise<PreloadAssets>>;
64
+ afterPreloadRemote: AsyncHook<{
65
+ preloadOps: Array<PreloadRemoteArgs>;
66
+ options: Options;
67
+ origin: FederationHost;
68
+ }, false | void | Promise<false | void>>;
69
+ }>;
70
+ constructor(host: FederationHost);
71
+ formatAndRegisterRemote(globalOptions: Options, userOptions: UserOptions): Remote[];
72
+ loadRemote<T>(id: string, options?: {
73
+ loadFactory?: boolean;
74
+ from: 'build' | 'runtime';
75
+ }): Promise<T | null>;
76
+ preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
77
+ registerRemotes(remotes: Remote[], options?: {
78
+ force?: boolean;
79
+ }): void;
80
+ getRemoteModuleAndOptions(options: {
81
+ id: string;
82
+ }): Promise<{
83
+ module: Module;
84
+ moduleOptions: ModuleOptions;
85
+ remoteMatchInfo: LoadRemoteMatch;
86
+ }>;
87
+ registerRemote(remote: Remote, targetRemotes: Remote[], options?: {
88
+ force?: boolean;
89
+ }): void;
90
+ private removeRemote;
91
+ }
@@ -0,0 +1,56 @@
1
+ import { Federation } from '../global';
2
+ import { Options, ShareScopeMap, ShareInfos, Shared, UserOptions } from '../type';
3
+ import { FederationHost } from '../core';
4
+ import { PluginSystem, AsyncHook, AsyncWaterfallHook, SyncWaterfallHook } from '../utils/hooks';
5
+ import { LoadRemoteMatch } from '../remote';
6
+ export declare class SharedHandler {
7
+ host: FederationHost;
8
+ shareScopeMap: ShareScopeMap;
9
+ hooks: PluginSystem<{
10
+ afterResolve: AsyncWaterfallHook<LoadRemoteMatch>;
11
+ beforeLoadShare: AsyncWaterfallHook<{
12
+ pkgName: string;
13
+ shareInfo?: Shared | undefined;
14
+ shared: Options['shared'];
15
+ origin: FederationHost;
16
+ }>;
17
+ loadShare: AsyncHook<[FederationHost, string, ShareInfos], false | void | Promise<false | void>>;
18
+ resolveShare: SyncWaterfallHook<{
19
+ shareScopeMap: ShareScopeMap;
20
+ scope: string;
21
+ pkgName: string;
22
+ version: string;
23
+ GlobalFederation: Federation;
24
+ resolver: () => Shared | undefined;
25
+ }>;
26
+ initContainerShareScopeMap: AsyncWaterfallHook<{
27
+ shareScope: ShareScopeMap[string];
28
+ options: Options;
29
+ origin: FederationHost;
30
+ }>;
31
+ }>;
32
+ constructor(host: FederationHost);
33
+ registerShared(globalOptions: Options, userOptions: UserOptions): {
34
+ shareInfos: ShareInfos;
35
+ shared: {
36
+ [x: string]: Shared[];
37
+ };
38
+ };
39
+ loadShare<T>(pkgName: string, extraOptions?: {
40
+ customShareInfo?: Partial<Shared>;
41
+ resolver?: (sharedOptions: ShareInfos[string]) => Shared;
42
+ }): Promise<false | (() => T | undefined)>;
43
+ /**
44
+ * This function initializes the sharing sequence (executed only once per share scope).
45
+ * It accepts one argument, the name of the share scope.
46
+ * If the share scope does not exist, it creates one.
47
+ */
48
+ initializeSharing(shareScopeName?: string, strategy?: Shared['strategy']): Array<Promise<void>>;
49
+ loadShareSync<T>(pkgName: string, extraOptions?: {
50
+ customShareInfo?: Partial<Shared>;
51
+ resolver?: (sharedOptions: ShareInfos[string]) => Shared;
52
+ }): () => T | never;
53
+ initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string]): void;
54
+ private setShared;
55
+ private _setGlobalShareScopeMap;
56
+ }
@@ -1,6 +1,8 @@
1
1
  import { FederationHost } from '../core';
2
2
  import { Module } from '../module';
3
3
  import { SnapshotHandler } from '../plugins/snapshot/SnapshotHandler';
4
+ import { SharedHandler } from '../shared';
5
+ import { RemoteHandler } from '../remote';
4
6
  type CoreLifeCycle = FederationHost['hooks']['lifecycle'];
5
7
  type CoreLifeCyclePartial = Partial<{
6
8
  [k in keyof CoreLifeCycle]: Parameters<CoreLifeCycle[k]['on']>[0];
@@ -13,7 +15,15 @@ type ModuleLifeCycle = Module['host']['loaderHook']['lifecycle'];
13
15
  type ModuleLifeCycleCyclePartial = Partial<{
14
16
  [k in keyof ModuleLifeCycle]: Parameters<ModuleLifeCycle[k]['on']>[0];
15
17
  }>;
16
- export type FederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & {
18
+ type SharedLifeCycle = SharedHandler['hooks']['lifecycle'];
19
+ type SharedLifeCycleCyclePartial = Partial<{
20
+ [k in keyof SharedLifeCycle]: Parameters<SharedLifeCycle[k]['on']>[0];
21
+ }>;
22
+ type RemoteLifeCycle = RemoteHandler['hooks']['lifecycle'];
23
+ type RemoteLifeCycleCyclePartial = Partial<{
24
+ [k in keyof RemoteLifeCycle]: Parameters<RemoteLifeCycle[k]['on']>[0];
25
+ }>;
26
+ export type FederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & {
17
27
  name: string;
18
28
  version?: string;
19
29
  };
@@ -1,3 +1,4 @@
1
+ import { CreateScriptHookReturn } from '@module-federation/sdk';
1
2
  import { Remote, RemoteEntryExports, RemoteInfo } from '../type';
2
3
  export declare function loadEsmEntry({ entry, remoteEntryExports, }: {
3
4
  entry: string;
@@ -7,12 +8,12 @@ export declare function loadEntryScript({ name, globalName, entry, createScriptH
7
8
  name: string;
8
9
  globalName: string;
9
10
  entry: string;
10
- createScriptHook?: (url: string) => HTMLScriptElement | void;
11
+ createScriptHook?: (url: string) => CreateScriptHookReturn;
11
12
  }): Promise<RemoteEntryExports>;
12
13
  export declare function getRemoteEntryUniqueKey(remoteInfo: RemoteInfo): string;
13
14
  export declare function getRemoteEntry({ remoteEntryExports, remoteInfo, createScriptHook, }: {
14
15
  remoteInfo: RemoteInfo;
15
16
  remoteEntryExports?: RemoteEntryExports | undefined;
16
- createScriptHook?: (url: string) => HTMLScriptElement | void;
17
+ createScriptHook?: (url: string) => CreateScriptHookReturn;
17
18
  }): Promise<RemoteEntryExports | void>;
18
19
  export declare function getRemoteInfo(remote: Remote): RemoteInfo;
@@ -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']>): import("../type").FederationRuntimePlugin[] | undefined;
4
+ export declare function registerPlugins(plugins: UserOptions['plugins'], hookInstances: Array<FederationHost['hooks'] | FederationHost['snapshotHandler']['hooks'] | FederationHost['sharedHandler']['hooks'] | FederationHost['remoteHandler']['hooks'] | Module['host']['loaderHook']>): import("../type").FederationRuntimePlugin[] | undefined;
@@ -1,8 +1,13 @@
1
1
  import { Federation } from '../global';
2
- import { GlobalShareScopeMap, Shared, ShareArgs, ShareInfos, ShareScopeMap, LoadShareExtraOptions, UserOptions } from '../type';
2
+ import { GlobalShareScopeMap, Shared, ShareArgs, ShareInfos, ShareScopeMap, LoadShareExtraOptions, UserOptions, Options } from '../type';
3
3
  import { SyncWaterfallHook } from './hooks';
4
4
  export declare function formatShare(shareArgs: ShareArgs, from: string, name: string): Shared;
5
- export declare function formatShareConfigs(shareArgs: UserOptions['shared'], from: string): ShareInfos;
5
+ export declare function formatShareConfigs(globalOptions: Options, userOptions: UserOptions): {
6
+ shared: {
7
+ [x: string]: Shared[];
8
+ };
9
+ shareInfos: ShareInfos;
10
+ };
6
11
  export declare function versionLt(a: string, b: string): boolean;
7
12
  export declare const findVersion: (shareVersionMap: ShareScopeMap[string][string], cb?: ((prev: string, cur: string) => boolean) | undefined) => string;
8
13
  export declare const isLoaded: (shared: Shared) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
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.1.12"
48
+ "@module-federation/sdk": "0.1.14"
49
49
  }
50
50
  }