@module-federation/runtime 0.0.0-next-20240508024041 → 0.0.0-next-20240511023318

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.11",
3
+ "version": "0.1.12",
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.11";
193
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.12";
194
194
  }
195
195
  }
196
196
  // eslint-disable-next-line @typescript-eslint/ban-types
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.11";
191
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.12";
192
192
  }
193
193
  }
194
194
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1,28 +1,9 @@
1
- import type { ModuleInfo } from '@module-federation/sdk';
2
1
  import { Options, PreloadRemoteArgs, RemoteEntryExports, Remote, Shared, ShareInfos, UserOptions, RemoteInfo, ShareScopeMap, InitScope, RemoteEntryInitOptions } from './type';
3
- import { Module, ModuleOptions } from './module';
2
+ import { Module } from './module';
4
3
  import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHook } from './utils/hooks';
5
4
  import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler';
6
5
  import { SharedHandler } from './shared';
7
6
  import { RemoteHandler } from './remote';
8
- export interface LoadRemoteMatch {
9
- id: string;
10
- pkgNameOrAlias: string;
11
- expose: string;
12
- remote: Remote;
13
- options: Options;
14
- origin: FederationHost;
15
- remoteInfo: RemoteInfo;
16
- remoteSnapshot?: ModuleInfo;
17
- }
18
- export declare function getRemoteModuleAndOptions(options: {
19
- id: string;
20
- origin: FederationHost;
21
- }): Promise<{
22
- module: Module;
23
- moduleOptions: ModuleOptions;
24
- remoteMatchInfo: LoadRemoteMatch;
25
- }>;
26
7
  export declare class FederationHost {
27
8
  options: Options;
28
9
  hooks: PluginSystem<{
@@ -3,7 +3,18 @@ import { Options, UserOptions, PreloadAssets, PreloadOptions, PreloadRemoteArgs,
3
3
  import { FederationHost } from '../core';
4
4
  import { PluginSystem, AsyncHook, AsyncWaterfallHook, SyncHook } from '../utils/hooks';
5
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
+ }
6
16
  export declare class RemoteHandler {
17
+ host: FederationHost;
7
18
  hooks: PluginSystem<{
8
19
  beforeRequest: AsyncWaterfallHook<{
9
20
  id: string;
@@ -56,17 +67,25 @@ export declare class RemoteHandler {
56
67
  origin: FederationHost;
57
68
  }, false | void | Promise<false | void>>;
58
69
  }>;
59
- formatRemote(origin: FederationHost, globalOptions: Options, userOptions: UserOptions): Remote[];
60
- loadRemote<T>(origin: FederationHost, id: string, options?: {
70
+ constructor(host: FederationHost);
71
+ formatAndRegisterRemote(globalOptions: Options, userOptions: UserOptions): Remote[];
72
+ loadRemote<T>(id: string, options?: {
61
73
  loadFactory?: boolean;
62
74
  from: 'build' | 'runtime';
63
75
  }): Promise<T | null>;
64
- preloadRemote(origin: FederationHost, preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
65
- registerRemotes(origin: FederationHost, remotes: Remote[], options?: {
76
+ preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
77
+ registerRemotes(remotes: Remote[], options?: {
66
78
  force?: boolean;
67
79
  }): void;
68
- private removeRemote;
69
- registerRemote(origin: FederationHost, remote: Remote, targetRemotes: Remote[], options?: {
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?: {
70
88
  force?: boolean;
71
89
  }): void;
90
+ private removeRemote;
72
91
  }
@@ -1,8 +1,10 @@
1
1
  import { Federation } from '../global';
2
2
  import { Options, ShareScopeMap, ShareInfos, Shared, UserOptions } from '../type';
3
- import { LoadRemoteMatch, FederationHost } from '../core';
3
+ import { FederationHost } from '../core';
4
4
  import { PluginSystem, AsyncHook, AsyncWaterfallHook, SyncWaterfallHook } from '../utils/hooks';
5
+ import { LoadRemoteMatch } from '../remote';
5
6
  export declare class SharedHandler {
7
+ host: FederationHost;
6
8
  shareScopeMap: ShareScopeMap;
7
9
  hooks: PluginSystem<{
8
10
  afterResolve: AsyncWaterfallHook<LoadRemoteMatch>;
@@ -27,7 +29,7 @@ export declare class SharedHandler {
27
29
  origin: FederationHost;
28
30
  }>;
29
31
  }>;
30
- constructor(hostOptions: Options);
32
+ constructor(host: FederationHost);
31
33
  formatShareConfigs(globalOptions: Options, userOptions: UserOptions): {
32
34
  shared: {
33
35
  [x: string]: Shared[];
@@ -35,7 +37,7 @@ export declare class SharedHandler {
35
37
  shareInfos: ShareInfos;
36
38
  };
37
39
  registerShared(shareInfos: ShareInfos, userOptions: UserOptions): void;
38
- loadShare<T>(origin: FederationHost, pkgName: string, extraOptions?: {
40
+ loadShare<T>(pkgName: string, extraOptions?: {
39
41
  customShareInfo?: Partial<Shared>;
40
42
  resolver?: (sharedOptions: ShareInfos[string]) => Shared;
41
43
  }): Promise<false | (() => T | undefined)>;
@@ -44,12 +46,12 @@ export declare class SharedHandler {
44
46
  * It accepts one argument, the name of the share scope.
45
47
  * If the share scope does not exist, it creates one.
46
48
  */
47
- initializeSharing(origin: FederationHost, shareScopeName?: string, strategy?: Shared['strategy']): Array<Promise<void>>;
48
- loadShareSync<T>(origin: FederationHost, pkgName: string, extraOptions?: {
49
+ initializeSharing(shareScopeName?: string, strategy?: Shared['strategy']): Array<Promise<void>>;
50
+ loadShareSync<T>(pkgName: string, extraOptions?: {
49
51
  customShareInfo?: Partial<Shared>;
50
52
  resolver?: (sharedOptions: ShareInfos[string]) => Shared;
51
53
  }): () => T | never;
52
- initShareScopeMap(origin: FederationHost, scopeName: string, shareScope: ShareScopeMap[string]): void;
54
+ initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string]): void;
53
55
  private setShared;
54
56
  private _setGlobalShareScopeMap;
55
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20240508024041",
3
+ "version": "0.0.0-next-20240511023318",
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.0.0-next-20240508024041"
48
+ "@module-federation/sdk": "0.0.0-next-20240511023318"
49
49
  }
50
50
  }