Skip to content

Commit 1ae1ea3

Browse files
committed
refactor(runtime): rename remote module handler
1 parent aca6c35 commit 1ae1ea3

5 files changed

Lines changed: 14 additions & 12 deletions

File tree

apps/website-new/docs/zh/guide/advanced/runtime-size-optimization.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ optimization: {
143143

144144
| 配置 | 原始大小 | 减少 |
145145
| --------------------- | -------: | --------: |
146-
| 保留远程和共享能力 | 72,953 B | - |
147-
| `disableRemote: true` | 58,486 B | 约 19.83% |
148-
| `disableShared: true` | 64,744 B | 约 11.25% |
146+
| 保留远程和共享能力 | 72,974 B | - |
147+
| `disableRemote: true` | 58,498 B | 约 19.84% |
148+
| `disableShared: true` | 64,756 B | 约 11.26% |
149149

150150
### 3. 跑真实业务流程
151151

packages/runtime-core/src/core.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ import { SharedHandler } from './shared';
4343
import { DisabledSharedHandler } from './shared/disabled';
4444
import { RemoteHandler } from './remote';
4545
import { DisabledRemoteHandler } from './remote/disabled';
46-
import { ExposeHandler } from './expose';
47-
import { DisabledExposeHandler } from './expose/disabled';
46+
import { RemoteModuleHandler } from './remote-module';
47+
import { DisabledRemoteModuleHandler } from './remote-module/disabled';
4848
import { formatShareConfigs } from './utils/share';
4949

5050
// Declare the global constant that will be defined by DefinePlugin
@@ -119,7 +119,7 @@ export class ModuleFederation {
119119
snapshotHandler: SnapshotHandler;
120120
sharedHandler: SharedHandler;
121121
remoteHandler: RemoteHandler;
122-
exposeHandler: ExposeHandler;
122+
remoteModuleHandler: RemoteModuleHandler;
123123
shareScopeMap: ShareScopeMap;
124124
loaderHook = new PluginSystem({
125125
// FIXME: may not be suitable , not open to the public yet
@@ -331,9 +331,11 @@ export class ModuleFederation {
331331
this.remoteHandler = (
332332
USE_REMOTE ? new RemoteHandler(this) : new DisabledRemoteHandler()
333333
) as RemoteHandler;
334-
this.exposeHandler = (
335-
USE_REMOTE_MODULE ? new ExposeHandler() : new DisabledExposeHandler()
336-
) as ExposeHandler;
334+
this.remoteModuleHandler = (
335+
USE_REMOTE_MODULE
336+
? new RemoteModuleHandler()
337+
: new DisabledRemoteModuleHandler()
338+
) as RemoteModuleHandler;
337339
this.shareScopeMap = this.sharedHandler.shareScopeMap;
338340
this.registerPlugins([
339341
...defaultOptions.plugins,

packages/runtime-core/src/module/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class Module {
267267
options?: { loadFactory?: boolean },
268268
remoteSnapshot?: ModuleInfo,
269269
) {
270-
return this.host.exposeHandler.get(
270+
return this.host.remoteModuleHandler.get(
271271
this,
272272
id,
273273
expose,

packages/runtime-core/src/expose/disabled.ts renamed to packages/runtime-core/src/remote-module/disabled.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export class DisabledExposeHandler {
1+
export class DisabledRemoteModuleHandler {
22
get(): never {
33
throw new Error(
44
'Remote loading is disabled by experiments.optimization.disableRemote.',

packages/runtime-core/src/expose/index.ts renamed to packages/runtime-core/src/remote-module/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function wrapModuleFactory(moduleFactory: RemoteModuleFactory, id: string) {
5151
};
5252
}
5353

54-
export class ExposeHandler {
54+
export class RemoteModuleHandler {
5555
async get(
5656
module: Module,
5757
id: string,

0 commit comments

Comments
 (0)