@module-federation/runtime 0.0.0-next-20240104103738 → 0.0.0-next-20240105113752

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/index.cjs.js CHANGED
@@ -249,8 +249,15 @@ let Module = class Module {
249
249
  const remoteEntryInitOptions = {
250
250
  version: this.remoteInfo.version || ''
251
251
  };
252
+ // Help to find host instance
253
+ Object.defineProperty(remoteEntryInitOptions, 'hostId', {
254
+ value: this.host.options.id || this.host.name,
255
+ // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
256
+ enumerable: false
257
+ });
252
258
  const initContainerOptions = await this.host.hooks.lifecycle.beforeInitContainer.emit({
253
259
  shareScope,
260
+ // @ts-ignore hostId will be set by Object.defineProperty
254
261
  remoteEntryInitOptions,
255
262
  initScope,
256
263
  remoteInfo: this.remoteInfo,
package/dist/index.esm.js CHANGED
@@ -247,8 +247,15 @@ let Module = class Module {
247
247
  const remoteEntryInitOptions = {
248
248
  version: this.remoteInfo.version || ''
249
249
  };
250
+ // Help to find host instance
251
+ Object.defineProperty(remoteEntryInitOptions, 'hostId', {
252
+ value: this.host.options.id || this.host.name,
253
+ // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
254
+ enumerable: false
255
+ });
250
256
  const initContainerOptions = await this.host.hooks.lifecycle.beforeInitContainer.emit({
251
257
  shareScope,
258
+ // @ts-ignore hostId will be set by Object.defineProperty
252
259
  remoteEntryInitOptions,
253
260
  initScope,
254
261
  remoteInfo: this.remoteInfo,
@@ -90,6 +90,7 @@ export type LoadModuleOptions = {
90
90
  };
91
91
  export type RemoteEntryInitOptions = {
92
92
  version: string;
93
+ hostId: string;
93
94
  };
94
95
  export type InitScope = Array<Record<string, never>>;
95
96
  export type RemoteEntryExports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20240104103738",
3
+ "version": "0.0.0-next-20240105113752",
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-20240104103738"
48
+ "@module-federation/sdk": "0.0.0-next-20240105113752"
49
49
  }
50
50
  }