@module-federation/webpack-bundler-runtime 0.0.0-next-20240104103738 → 0.0.0-next-20240105121713

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
@@ -254,7 +254,38 @@ function installInitialConsumes(options) {
254
254
  });
255
255
  }
256
256
 
257
- function isLegacyHost(shareScope) {
257
+ function _define_property(obj, key, value) {
258
+ if (key in obj) {
259
+ Object.defineProperty(obj, key, {
260
+ value: value,
261
+ enumerable: true,
262
+ configurable: true,
263
+ writable: true
264
+ });
265
+ } else {
266
+ obj[key] = value;
267
+ }
268
+ return obj;
269
+ }
270
+ function _object_spread(target) {
271
+ for(var i = 1; i < arguments.length; i++){
272
+ var source = arguments[i] != null ? arguments[i] : {};
273
+ var ownKeys = Object.keys(source);
274
+ if (typeof Object.getOwnPropertySymbols === "function") {
275
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
276
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
277
+ }));
278
+ }
279
+ ownKeys.forEach(function(key) {
280
+ _define_property(target, key, source[key]);
281
+ });
282
+ }
283
+ return target;
284
+ }
285
+ function isLegacyHost(shareScope, remoteEntryInitOptions) {
286
+ if (remoteEntryInitOptions && typeof remoteEntryInitOptions === "object" && remoteEntryInitOptions.hostId) {
287
+ return false;
288
+ }
258
289
  if ("version" in shareScope && typeof shareScope["version"] !== "object") {
259
290
  return true;
260
291
  }
@@ -264,15 +295,15 @@ function isLegacyHost(shareScope) {
264
295
  return false;
265
296
  }
266
297
  function initContainerEntry(options) {
267
- var webpackRequire = options.webpackRequire, shareScope = options.shareScope, initScope = options.initScope, shareScopeKey = options.shareScopeKey;
298
+ var webpackRequire = options.webpackRequire, shareScope = options.shareScope, initScope = options.initScope, shareScopeKey = options.shareScopeKey, remoteEntryInitOptions = options.remoteEntryInitOptions;
268
299
  if (!webpackRequire.S) return;
269
300
  if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
270
301
  var name = shareScopeKey || "default";
271
- webpackRequire.federation.instance.initOptions({
302
+ webpackRequire.federation.instance.initOptions(_object_spread({
272
303
  name: webpackRequire.federation.initOptions.name,
273
304
  remotes: []
274
- });
275
- if (isLegacyHost(shareScope)) {
305
+ }, remoteEntryInitOptions));
306
+ if (isLegacyHost(shareScope, remoteEntryInitOptions)) {
276
307
  var prevShareScope = globalThis.__FEDERATION__.__SHARE__["default"];
277
308
  if (prevShareScope) {
278
309
  webpackRequire.federation.instance.initShareScopeMap(name, prevShareScope);
package/dist/index.esm.js CHANGED
@@ -232,7 +232,38 @@ function installInitialConsumes(options) {
232
232
  });
233
233
  }
234
234
 
235
- function isLegacyHost(shareScope) {
235
+ function _define_property(obj, key, value) {
236
+ if (key in obj) {
237
+ Object.defineProperty(obj, key, {
238
+ value: value,
239
+ enumerable: true,
240
+ configurable: true,
241
+ writable: true
242
+ });
243
+ } else {
244
+ obj[key] = value;
245
+ }
246
+ return obj;
247
+ }
248
+ function _object_spread(target) {
249
+ for(var i = 1; i < arguments.length; i++){
250
+ var source = arguments[i] != null ? arguments[i] : {};
251
+ var ownKeys = Object.keys(source);
252
+ if (typeof Object.getOwnPropertySymbols === "function") {
253
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
254
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
255
+ }));
256
+ }
257
+ ownKeys.forEach(function(key) {
258
+ _define_property(target, key, source[key]);
259
+ });
260
+ }
261
+ return target;
262
+ }
263
+ function isLegacyHost(shareScope, remoteEntryInitOptions) {
264
+ if (remoteEntryInitOptions && typeof remoteEntryInitOptions === "object" && remoteEntryInitOptions.hostId) {
265
+ return false;
266
+ }
236
267
  if ("version" in shareScope && typeof shareScope["version"] !== "object") {
237
268
  return true;
238
269
  }
@@ -242,15 +273,15 @@ function isLegacyHost(shareScope) {
242
273
  return false;
243
274
  }
244
275
  function initContainerEntry(options) {
245
- var webpackRequire = options.webpackRequire, shareScope = options.shareScope, initScope = options.initScope, shareScopeKey = options.shareScopeKey;
276
+ var webpackRequire = options.webpackRequire, shareScope = options.shareScope, initScope = options.initScope, shareScopeKey = options.shareScopeKey, remoteEntryInitOptions = options.remoteEntryInitOptions;
246
277
  if (!webpackRequire.S) return;
247
278
  if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
248
279
  var name = shareScopeKey || "default";
249
- webpackRequire.federation.instance.initOptions({
280
+ webpackRequire.federation.instance.initOptions(_object_spread({
250
281
  name: webpackRequire.federation.initOptions.name,
251
282
  remotes: []
252
- });
253
- if (isLegacyHost(shareScope)) {
283
+ }, remoteEntryInitOptions));
284
+ if (isLegacyHost(shareScope, remoteEntryInitOptions)) {
254
285
  var prevShareScope = globalThis.__FEDERATION__.__SHARE__["default"];
255
286
  if (prevShareScope) {
256
287
  webpackRequire.federation.instance.initShareScopeMap(name, prevShareScope);
@@ -1,4 +1,5 @@
1
1
  import * as runtime from '@module-federation/runtime';
2
+ import type { RemoteEntryInitOptions } from '@module-federation/runtime/types';
2
3
  import { initializeSharing } from './initializeSharing';
3
4
  import { attachShareScopeMap } from './attachShareScopeMap';
4
5
  import { initContainerEntry } from './initContainerEntry';
@@ -86,6 +87,7 @@ export interface InitContainerEntryOptions {
86
87
  shareScope: ShareScopeMap[string];
87
88
  shareScopeKey: string;
88
89
  webpackRequire: WebpackRequire;
90
+ remoteEntryInitOptions?: RemoteEntryInitOptions;
89
91
  initScope?: InitializeSharingOptions['initScope'];
90
92
  }
91
93
  export interface Federation {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "@module-federation/webpack-bundler-runtime",
4
- "version": "0.0.0-next-20240104103738",
4
+ "version": "0.0.0-next-20240105121713",
5
5
  "license": "MIT",
6
6
  "description": "Module Federation Runtime for webpack",
7
7
  "keywords": [
@@ -20,8 +20,8 @@
20
20
  "module": "./dist/index.esm.js",
21
21
  "types": "./dist/index.cjs.d.ts",
22
22
  "dependencies": {
23
- "@module-federation/runtime": "0.0.0-next-20240104103738",
24
- "@module-federation/sdk": "0.0.0-next-20240104103738"
23
+ "@module-federation/runtime": "0.0.0-next-20240105121713",
24
+ "@module-federation/sdk": "0.0.0-next-20240105121713"
25
25
  },
26
26
  "exports": {
27
27
  ".": {