@module-federation/webpack-bundler-runtime 0.0.0-next-20250925034616 → 0.0.0-refactor-manifest-20251013103938

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.
@@ -18,24 +18,168 @@ function _interopNamespaceDefault(e) {
18
18
  var runtime__namespace = /*#__PURE__*/_interopNamespaceDefault(runtime);
19
19
 
20
20
  function attachShareScopeMap(webpackRequire) {
21
- if (!webpackRequire.S || webpackRequire.federation.hasAttachShareScopeMap || !webpackRequire.federation.instance || !webpackRequire.federation.instance.shareScopeMap) {
21
+ if (!webpackRequire.S ||
22
+ webpackRequire.federation.hasAttachShareScopeMap ||
23
+ !webpackRequire.federation.instance ||
24
+ !webpackRequire.federation.instance.shareScopeMap) {
22
25
  return;
23
26
  }
24
27
  webpackRequire.S = webpackRequire.federation.instance.shareScopeMap;
25
28
  webpackRequire.federation.hasAttachShareScopeMap = true;
26
29
  }
27
30
 
31
+ function updateConsumeOptions(options) {
32
+ const { webpackRequire, moduleToHandlerMapping } = options;
33
+ const { consumesLoadingData, initializeSharingData } = webpackRequire;
34
+ if (consumesLoadingData && !consumesLoadingData._updated) {
35
+ const { moduleIdToConsumeDataMapping: updatedModuleIdToConsumeDataMapping = {}, initialConsumes: updatedInitialConsumes = [], chunkMapping: updatedChunkMapping = {}, } = consumesLoadingData;
36
+ Object.entries(updatedModuleIdToConsumeDataMapping).forEach(([id, data]) => {
37
+ if (!moduleToHandlerMapping[id]) {
38
+ moduleToHandlerMapping[id] = {
39
+ getter: data.fallback,
40
+ shareInfo: {
41
+ shareConfig: {
42
+ requiredVersion: data.requiredVersion,
43
+ strictVersion: data.strictVersion,
44
+ singleton: data.singleton,
45
+ eager: data.eager,
46
+ layer: data.layer,
47
+ },
48
+ scope: Array.isArray(data.shareScope)
49
+ ? data.shareScope
50
+ : [data.shareScope || 'default'],
51
+ },
52
+ shareKey: data.shareKey,
53
+ };
54
+ }
55
+ });
56
+ if ('initialConsumes' in options) {
57
+ const { initialConsumes = [] } = options;
58
+ updatedInitialConsumes.forEach((id) => {
59
+ if (!initialConsumes.includes(id)) {
60
+ initialConsumes.push(id);
61
+ }
62
+ });
63
+ }
64
+ if ('chunkMapping' in options) {
65
+ const { chunkMapping = {} } = options;
66
+ Object.entries(updatedChunkMapping).forEach(([id, chunkModules]) => {
67
+ if (!chunkMapping[id]) {
68
+ chunkMapping[id] = [];
69
+ }
70
+ chunkModules.forEach((moduleId) => {
71
+ if (!chunkMapping[id].includes(moduleId)) {
72
+ chunkMapping[id].push(moduleId);
73
+ }
74
+ });
75
+ });
76
+ }
77
+ consumesLoadingData._updated = 1;
78
+ }
79
+ if (initializeSharingData && !initializeSharingData._updated) {
80
+ const { federation } = webpackRequire;
81
+ if (!federation.instance ||
82
+ !initializeSharingData.scopeToSharingDataMapping) {
83
+ return;
84
+ }
85
+ const shared = {};
86
+ for (let [scope, stages] of Object.entries(initializeSharingData.scopeToSharingDataMapping)) {
87
+ for (let stage of stages) {
88
+ if (typeof stage === 'object' && stage !== null) {
89
+ const { name, version, factory, eager, singleton, requiredVersion, strictVersion, } = stage;
90
+ const shareConfig = {
91
+ requiredVersion: `^${version}`,
92
+ };
93
+ const isValidValue = function (val) {
94
+ return typeof val !== 'undefined';
95
+ };
96
+ if (isValidValue(singleton)) {
97
+ shareConfig.singleton = singleton;
98
+ }
99
+ if (isValidValue(requiredVersion)) {
100
+ shareConfig.requiredVersion = requiredVersion;
101
+ }
102
+ if (isValidValue(eager)) {
103
+ shareConfig.eager = eager;
104
+ }
105
+ if (isValidValue(strictVersion)) {
106
+ shareConfig.strictVersion = strictVersion;
107
+ }
108
+ const options = {
109
+ version,
110
+ scope: [scope],
111
+ shareConfig,
112
+ get: factory,
113
+ };
114
+ if (shared[name]) {
115
+ shared[name].push(options);
116
+ }
117
+ else {
118
+ shared[name] = [options];
119
+ }
120
+ }
121
+ }
122
+ }
123
+ federation.instance.registerShared(shared);
124
+ initializeSharingData._updated = 1;
125
+ }
126
+ }
127
+ function updateRemoteOptions(options) {
128
+ const { webpackRequire, idToExternalAndNameMapping = {}, idToRemoteMap = {}, chunkMapping = {}, } = options;
129
+ const { remotesLoadingData } = webpackRequire;
130
+ const remoteInfos = webpackRequire.federation?.bundlerRuntimeOptions?.remotes?.remoteInfos;
131
+ if (!remotesLoadingData || remotesLoadingData._updated || !remoteInfos) {
132
+ return;
133
+ }
134
+ const { chunkMapping: updatedChunkMapping, moduleIdToRemoteDataMapping } = remotesLoadingData;
135
+ if (!updatedChunkMapping || !moduleIdToRemoteDataMapping) {
136
+ return;
137
+ }
138
+ for (let [moduleId, data] of Object.entries(moduleIdToRemoteDataMapping)) {
139
+ if (!idToExternalAndNameMapping[moduleId]) {
140
+ idToExternalAndNameMapping[moduleId] = [
141
+ data.shareScope,
142
+ data.name,
143
+ data.externalModuleId,
144
+ ];
145
+ }
146
+ if (!idToRemoteMap[moduleId] && remoteInfos[data.remoteName]) {
147
+ const items = remoteInfos[data.remoteName];
148
+ idToRemoteMap[moduleId] ||= [];
149
+ items.forEach((item) => {
150
+ if (!idToRemoteMap[moduleId].includes(item)) {
151
+ idToRemoteMap[moduleId].push(item);
152
+ }
153
+ });
154
+ }
155
+ }
156
+ if (chunkMapping) {
157
+ Object.entries(updatedChunkMapping).forEach(([id, chunkModules]) => {
158
+ if (!chunkMapping[id]) {
159
+ chunkMapping[id] = [];
160
+ }
161
+ chunkModules.forEach((moduleId) => {
162
+ if (!chunkMapping[id].includes(moduleId)) {
163
+ chunkMapping[id].push(moduleId);
164
+ }
165
+ });
166
+ });
167
+ }
168
+ remotesLoadingData._updated = 1;
169
+ }
170
+
28
171
  function remotes(options) {
29
- const { chunkId, promises, chunkMapping, idToExternalAndNameMapping, webpackRequire, idToRemoteMap } = options;
172
+ updateRemoteOptions(options);
173
+ const { chunkId, promises, webpackRequire, chunkMapping, idToExternalAndNameMapping, idToRemoteMap, } = options;
30
174
  attachShareScopeMap(webpackRequire);
31
175
  if (webpackRequire.o(chunkMapping, chunkId)) {
32
- chunkMapping[chunkId].forEach((id)=>{
176
+ chunkMapping[chunkId].forEach((id) => {
33
177
  let getScope = webpackRequire.R;
34
178
  if (!getScope) {
35
179
  getScope = [];
36
180
  }
37
181
  const data = idToExternalAndNameMapping[id];
38
- const remoteInfos = idToRemoteMap[id];
182
+ const remoteInfos = idToRemoteMap[id] || [];
39
183
  // @ts-ignore seems not work
40
184
  if (getScope.indexOf(data) >= 0) {
41
185
  return;
@@ -45,68 +189,77 @@ function remotes(options) {
45
189
  if (data.p) {
46
190
  return promises.push(data.p);
47
191
  }
48
- const onError = (error)=>{
192
+ const onError = (error) => {
49
193
  if (!error) {
50
194
  error = new Error('Container missing');
51
195
  }
52
196
  if (typeof error.message === 'string') {
53
197
  error.message += `\nwhile loading "${data[1]}" from ${data[2]}`;
54
198
  }
55
- webpackRequire.m[id] = ()=>{
199
+ webpackRequire.m[id] = () => {
56
200
  throw error;
57
201
  };
58
202
  data.p = 0;
59
203
  };
60
- const handleFunction = (fn, arg1, arg2, d, next, first)=>{
204
+ const handleFunction = (fn, arg1, arg2, d, next, first) => {
61
205
  try {
62
206
  const promise = fn(arg1, arg2);
63
207
  if (promise && promise.then) {
64
- const p = promise.then((result)=>next(result, d), onError);
208
+ const p = promise.then((result) => next(result, d), onError);
65
209
  if (first) {
66
- promises.push(data.p = p);
67
- } else {
210
+ promises.push((data.p = p));
211
+ }
212
+ else {
68
213
  return p;
69
214
  }
70
- } else {
215
+ }
216
+ else {
71
217
  return next(promise, d, first);
72
218
  }
73
- } catch (error) {
219
+ }
220
+ catch (error) {
74
221
  onError(error);
75
222
  }
76
223
  };
77
- const onExternal = (external, _, first)=>external ? handleFunction(webpackRequire.I, data[0], 0, external, onInitialized, first) : onError();
224
+ const onExternal = (external, _, first) => external
225
+ ? handleFunction(webpackRequire.I, data[0], 0, external, onInitialized, first)
226
+ : onError();
78
227
  // eslint-disable-next-line no-var
79
- var onInitialized = (_, external, first)=>handleFunction(external.get, data[1], getScope, 0, onFactory, first);
228
+ var onInitialized = (_, external, first) => handleFunction(external.get, data[1], getScope, 0, onFactory, first);
80
229
  // eslint-disable-next-line no-var
81
- var onFactory = (factory)=>{
230
+ var onFactory = (factory) => {
82
231
  data.p = 1;
83
- webpackRequire.m[id] = (module)=>{
232
+ webpackRequire.m[id] = (module) => {
84
233
  module.exports = factory();
85
234
  };
86
235
  };
87
- const onRemoteLoaded = ()=>{
236
+ const onRemoteLoaded = () => {
88
237
  try {
89
238
  const remoteName = sdk.decodeName(remoteInfos[0].name, sdk.ENCODE_NAME_PREFIX);
90
239
  const remoteModuleName = remoteName + data[1].slice(1);
91
240
  const instance = webpackRequire.federation.instance;
92
- const loadRemote = ()=>webpackRequire.federation.instance.loadRemote(remoteModuleName, {
93
- loadFactory: false,
94
- from: 'build'
95
- });
241
+ const loadRemote = () => webpackRequire.federation.instance.loadRemote(remoteModuleName, {
242
+ loadFactory: false,
243
+ from: 'build',
244
+ });
96
245
  if (instance.options.shareStrategy === 'version-first') {
97
- return Promise.all(instance.sharedHandler.initializeSharing(data[0])).then(()=>{
246
+ return Promise.all(instance.sharedHandler.initializeSharing(data[0])).then(() => {
98
247
  return loadRemote();
99
248
  });
100
249
  }
101
250
  return loadRemote();
102
- } catch (error) {
251
+ }
252
+ catch (error) {
103
253
  onError(error);
104
254
  }
105
255
  };
106
- const useRuntimeLoad = remoteInfos.length === 1 && constant.FEDERATION_SUPPORTED_TYPES.includes(remoteInfos[0].externalType) && remoteInfos[0].name;
256
+ const useRuntimeLoad = remoteInfos.length === 1 &&
257
+ constant.FEDERATION_SUPPORTED_TYPES.includes(remoteInfos[0].externalType) &&
258
+ remoteInfos[0].name;
107
259
  if (useRuntimeLoad) {
108
260
  handleFunction(onRemoteLoaded, data[2], 0, 0, onFactory, 1);
109
- } else {
261
+ }
262
+ else {
110
263
  handleFunction(webpackRequire, data[2], 0, 0, onExternal, 1);
111
264
  }
112
265
  });
@@ -114,42 +267,41 @@ function remotes(options) {
114
267
  }
115
268
 
116
269
  function consumes(options) {
117
- const { chunkId, promises, installedModules, webpackRequire } = options;
118
- const { consumesLoadingData } = webpackRequire;
119
- if (!consumesLoadingData) {
120
- return;
121
- }
122
- const { moduleIdToConsumeDataMapping, chunkMapping } = consumesLoadingData;
270
+ updateConsumeOptions(options);
271
+ const { chunkId, promises, installedModules, webpackRequire, chunkMapping, moduleToHandlerMapping, } = options;
123
272
  attachShareScopeMap(webpackRequire);
124
273
  if (webpackRequire.o(chunkMapping, chunkId)) {
125
- chunkMapping[chunkId].forEach((id)=>{
274
+ chunkMapping[chunkId].forEach((id) => {
126
275
  if (webpackRequire.o(installedModules, id)) {
127
276
  return promises.push(installedModules[id]);
128
277
  }
129
- const onFactory = (factory)=>{
278
+ const onFactory = (factory) => {
130
279
  installedModules[id] = 0;
131
- webpackRequire.m[id] = (module)=>{
132
- var _shareInfo_shareConfig;
280
+ webpackRequire.m[id] = (module) => {
133
281
  delete webpackRequire.c[id];
134
282
  const result = factory();
135
283
  // Add layer property from shareConfig if available
136
- const { shareInfo } = moduleIdToConsumeDataMapping[id];
137
- if ((shareInfo == null ? void 0 : (_shareInfo_shareConfig = shareInfo.shareConfig) == null ? void 0 : _shareInfo_shareConfig.layer) && result && typeof result === 'object') {
284
+ const { shareInfo } = moduleToHandlerMapping[id];
285
+ if (shareInfo?.shareConfig?.layer &&
286
+ result &&
287
+ typeof result === 'object') {
138
288
  try {
139
289
  // Only set layer if it's not already defined or if it's undefined
140
- if (!result.hasOwnProperty('layer') || result.layer === undefined) {
290
+ if (!result.hasOwnProperty('layer') ||
291
+ result.layer === undefined) {
141
292
  result.layer = shareInfo.shareConfig.layer;
142
293
  }
143
- } catch (e) {
144
- // Ignore if layer property is read-only
294
+ }
295
+ catch (e) {
296
+ // Ignore if layer property is read-only
145
297
  }
146
298
  }
147
299
  module.exports = result;
148
300
  };
149
301
  };
150
- const onError = (error)=>{
302
+ const onError = (error) => {
151
303
  delete installedModules[id];
152
- webpackRequire.m[id] = (module)=>{
304
+ webpackRequire.m[id] = (module) => {
153
305
  delete webpackRequire.c[id];
154
306
  throw error;
155
307
  };
@@ -159,79 +311,90 @@ function consumes(options) {
159
311
  if (!federationInstance) {
160
312
  throw new Error('Federation instance not found!');
161
313
  }
162
- const { shareKey, getter, shareInfo } = moduleIdToConsumeDataMapping[id];
163
- const promise = federationInstance.loadShare(shareKey, {
164
- customShareInfo: shareInfo
165
- }).then((factory)=>{
314
+ const { shareKey, getter, shareInfo } = moduleToHandlerMapping[id];
315
+ const promise = federationInstance
316
+ .loadShare(shareKey, { customShareInfo: shareInfo })
317
+ .then((factory) => {
166
318
  if (factory === false) {
167
319
  return getter();
168
320
  }
169
321
  return factory;
170
322
  });
171
323
  if (promise.then) {
172
- promises.push(installedModules[id] = promise.then(onFactory).catch(onError));
173
- } else {
324
+ promises.push((installedModules[id] = promise.then(onFactory).catch(onError)));
325
+ }
326
+ else {
174
327
  // @ts-ignore maintain previous logic
175
328
  onFactory(promise);
176
329
  }
177
- } catch (e) {
330
+ }
331
+ catch (e) {
178
332
  onError(e);
179
333
  }
180
334
  });
181
335
  }
182
336
  }
183
337
 
184
- function initializeSharing({ shareScopeName, webpackRequire, initPromises, initTokens, initScope }) {
185
- const shareScopeKeys = Array.isArray(shareScopeName) ? shareScopeName : [
186
- shareScopeName
187
- ];
338
+ function initializeSharing({ shareScopeName, webpackRequire, initPromises, initTokens, initScope, }) {
339
+ const shareScopeKeys = Array.isArray(shareScopeName)
340
+ ? shareScopeName
341
+ : [shareScopeName];
188
342
  var initializeSharingPromises = [];
189
- var _initializeSharing = function(shareScopeKey) {
190
- if (!initScope) initScope = [];
343
+ var _initializeSharing = function (shareScopeKey) {
344
+ if (!initScope)
345
+ initScope = [];
191
346
  const mfInstance = webpackRequire.federation.instance;
192
347
  // handling circular init calls
193
348
  var initToken = initTokens[shareScopeKey];
194
- if (!initToken) initToken = initTokens[shareScopeKey] = {
195
- from: mfInstance.name
196
- };
197
- if (initScope.indexOf(initToken) >= 0) return;
349
+ if (!initToken)
350
+ initToken = initTokens[shareScopeKey] = { from: mfInstance.name };
351
+ if (initScope.indexOf(initToken) >= 0)
352
+ return;
198
353
  initScope.push(initToken);
199
354
  const promise = initPromises[shareScopeKey];
200
- if (promise) return promise;
201
- var warn = (msg)=>typeof console !== 'undefined' && console.warn && console.warn(msg);
202
- var initExternal = (id)=>{
203
- var handleError = (err)=>warn('Initialization of sharing external failed: ' + err);
355
+ if (promise)
356
+ return promise;
357
+ var warn = (msg) => typeof console !== 'undefined' && console.warn && console.warn(msg);
358
+ var initExternal = (id) => {
359
+ var handleError = (err) => warn('Initialization of sharing external failed: ' + err);
204
360
  try {
205
361
  var module = webpackRequire(id);
206
- if (!module) return;
207
- var initFn = (module)=>module && module.init && // @ts-ignore compat legacy mf shared behavior
362
+ if (!module)
363
+ return;
364
+ var initFn = (module) => module &&
365
+ module.init &&
366
+ // @ts-ignore compat legacy mf shared behavior
208
367
  module.init(webpackRequire.S[shareScopeKey], initScope, {
209
368
  shareScopeMap: webpackRequire.S || {},
210
- shareScopeKeys: shareScopeName
369
+ shareScopeKeys: shareScopeName,
211
370
  });
212
- if (module.then) return promises.push(module.then(initFn, handleError));
371
+ if (module.then)
372
+ return promises.push(module.then(initFn, handleError));
213
373
  var initResult = initFn(module);
214
374
  // @ts-ignore
215
- if (initResult && typeof initResult !== 'boolean' && initResult.then) // @ts-ignore
216
- return promises.push(initResult['catch'](handleError));
217
- } catch (err) {
375
+ if (initResult && typeof initResult !== 'boolean' && initResult.then)
376
+ // @ts-ignore
377
+ return promises.push(initResult['catch'](handleError));
378
+ }
379
+ catch (err) {
218
380
  handleError(err);
219
381
  }
220
382
  };
221
383
  const promises = mfInstance.initializeSharing(shareScopeKey, {
222
384
  strategy: mfInstance.options.shareStrategy,
223
385
  initScope,
224
- from: 'build'
386
+ from: 'build',
225
387
  });
226
388
  attachShareScopeMap(webpackRequire);
227
389
  const bundlerRuntimeRemotesOptions = webpackRequire.federation.bundlerRuntimeOptions.remotes;
228
390
  if (bundlerRuntimeRemotesOptions) {
229
- Object.keys(bundlerRuntimeRemotesOptions.idToRemoteMap).forEach((moduleId)=>{
391
+ Object.keys(bundlerRuntimeRemotesOptions.idToRemoteMap).forEach((moduleId) => {
230
392
  const info = bundlerRuntimeRemotesOptions.idToRemoteMap[moduleId];
231
393
  const externalModuleId = bundlerRuntimeRemotesOptions.idToExternalAndNameMapping[moduleId][2];
232
394
  if (info.length > 1) {
233
395
  initExternal(externalModuleId);
234
- } else if (info.length === 1) {
396
+ }
397
+ else if (info.length === 1) {
235
398
  const remoteInfo = info[0];
236
399
  if (!constant.FEDERATION_SUPPORTED_TYPES.includes(remoteInfo.externalType)) {
237
400
  initExternal(externalModuleId);
@@ -240,65 +403,66 @@ function initializeSharing({ shareScopeName, webpackRequire, initPromises, initT
240
403
  });
241
404
  }
242
405
  if (!promises.length) {
243
- return initPromises[shareScopeKey] = true;
406
+ return (initPromises[shareScopeKey] = true);
244
407
  }
245
- return initPromises[shareScopeKey] = Promise.all(promises).then(()=>initPromises[shareScopeKey] = true);
408
+ return (initPromises[shareScopeKey] = Promise.all(promises).then(() => (initPromises[shareScopeKey] = true)));
246
409
  };
247
- shareScopeKeys.forEach((key)=>{
410
+ shareScopeKeys.forEach((key) => {
248
411
  initializeSharingPromises.push(_initializeSharing(key));
249
412
  });
250
- return Promise.all(initializeSharingPromises).then(()=>true);
413
+ return Promise.all(initializeSharingPromises).then(() => true);
251
414
  }
252
415
 
253
416
  function handleInitialConsumes(options) {
254
- const { moduleId, moduleIdToConsumeDataMapping, webpackRequire } = options;
417
+ const { moduleId, moduleToHandlerMapping, webpackRequire } = options;
255
418
  const federationInstance = webpackRequire.federation.instance;
256
419
  if (!federationInstance) {
257
420
  throw new Error('Federation instance not found!');
258
421
  }
259
- const { shareKey, shareInfo } = moduleIdToConsumeDataMapping[moduleId];
422
+ const { shareKey, shareInfo } = moduleToHandlerMapping[moduleId];
260
423
  try {
261
424
  return federationInstance.loadShareSync(shareKey, {
262
- customShareInfo: shareInfo
425
+ customShareInfo: shareInfo,
263
426
  });
264
- } catch (err) {
427
+ }
428
+ catch (err) {
265
429
  console.error('loadShareSync failed! The function should not be called unless you set "eager:true". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.');
266
430
  console.error('The original error message is as follows: ');
267
431
  throw err;
268
432
  }
269
433
  }
270
434
  function installInitialConsumes(options) {
271
- const { webpackRequire, installedModules } = options;
272
- const { consumesLoadingData } = webpackRequire;
273
- if (!consumesLoadingData) {
274
- return;
275
- }
276
- const { moduleIdToConsumeDataMapping, initialConsumes } = consumesLoadingData;
277
- initialConsumes.forEach((id)=>{
278
- webpackRequire.m[id] = (module)=>{
279
- var _shareInfo_shareConfig;
435
+ const { webpackRequire } = options;
436
+ updateConsumeOptions(options);
437
+ const { initialConsumes, moduleToHandlerMapping, installedModules } = options;
438
+ initialConsumes.forEach((id) => {
439
+ webpackRequire.m[id] = (module) => {
280
440
  // Handle scenario when module is used synchronously
281
441
  installedModules[id] = 0;
282
442
  delete webpackRequire.c[id];
283
443
  const factory = handleInitialConsumes({
284
444
  moduleId: id,
445
+ moduleToHandlerMapping,
285
446
  webpackRequire,
286
- moduleIdToConsumeDataMapping
287
447
  });
288
448
  if (typeof factory !== 'function') {
289
449
  throw new Error(`Shared module is not available for eager consumption: ${id}`);
290
450
  }
291
451
  const result = factory();
292
452
  // Add layer property from shareConfig if available
293
- const { shareInfo } = moduleIdToConsumeDataMapping[id];
294
- if ((shareInfo == null ? void 0 : (_shareInfo_shareConfig = shareInfo.shareConfig) == null ? void 0 : _shareInfo_shareConfig.layer) && result && typeof result === 'object') {
453
+ const { shareInfo } = moduleToHandlerMapping[id];
454
+ if (shareInfo?.shareConfig?.layer &&
455
+ result &&
456
+ typeof result === 'object') {
295
457
  try {
296
458
  // Only set layer if it's not already defined or if it's undefined
297
- if (!result.hasOwnProperty('layer') || result.layer === undefined) {
459
+ if (!result.hasOwnProperty('layer') ||
460
+ result.layer === undefined) {
298
461
  result.layer = shareInfo.shareConfig.layer;
299
462
  }
300
- } catch (e) {
301
- // Ignore if layer property is read-only
463
+ }
464
+ catch (e) {
465
+ // Ignore if layer property is read-only
302
466
  }
303
467
  }
304
468
  module.exports = result;
@@ -306,28 +470,22 @@ function installInitialConsumes(options) {
306
470
  });
307
471
  }
308
472
 
309
- function _extends() {
310
- _extends = Object.assign || function assign(target) {
311
- for(var i = 1; i < arguments.length; i++){
312
- var source = arguments[i];
313
- for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
314
- }
315
- return target;
316
- };
317
- return _extends.apply(this, arguments);
318
- }
319
-
320
473
  function initContainerEntry(options) {
321
- const { webpackRequire, shareScope, initScope, shareScopeKey, remoteEntryInitOptions } = options;
322
- if (!webpackRequire.S) return;
323
- if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
474
+ const { webpackRequire, shareScope, initScope, shareScopeKey, remoteEntryInitOptions, } = options;
475
+ if (!webpackRequire.S)
476
+ return;
477
+ if (!webpackRequire.federation ||
478
+ !webpackRequire.federation.instance ||
479
+ !webpackRequire.federation.initOptions)
480
+ return;
324
481
  const federationInstance = webpackRequire.federation.instance;
325
- federationInstance.initOptions(_extends({
482
+ federationInstance.initOptions({
326
483
  name: webpackRequire.federation.initOptions.name,
327
- remotes: []
328
- }, remoteEntryInitOptions));
329
- const hostShareScopeKeys = remoteEntryInitOptions == null ? void 0 : remoteEntryInitOptions.shareScopeKeys;
330
- const hostShareScopeMap = remoteEntryInitOptions == null ? void 0 : remoteEntryInitOptions.shareScopeMap;
484
+ remotes: [],
485
+ ...remoteEntryInitOptions,
486
+ });
487
+ const hostShareScopeKeys = remoteEntryInitOptions?.shareScopeKeys;
488
+ const hostShareScopeMap = remoteEntryInitOptions?.shareScopeMap;
331
489
  // host: 'default' remote: 'default' remote['default'] = hostShareScopeMap['default']
332
490
  // host: ['default', 'scope1'] remote: 'default' remote['default'] = hostShareScopeMap['default']; remote['scope1'] = hostShareScopeMap['scop1']
333
491
  // host: 'default' remote: ['default','scope1'] remote['default'] = hostShareScopeMap['default']; remote['scope1'] = hostShareScopeMap['scope1'] = {}
@@ -342,25 +500,27 @@ function initContainerEntry(options) {
342
500
  // federationInstance.initShareScopeMap(key, sc, {
343
501
  // hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},
344
502
  // });
345
- hostShareScopeKeys.forEach((hostKey)=>{
503
+ hostShareScopeKeys.forEach((hostKey) => {
346
504
  if (!hostShareScopeMap[hostKey]) {
347
505
  hostShareScopeMap[hostKey] = {};
348
506
  }
349
507
  const sc = hostShareScopeMap[hostKey];
350
508
  federationInstance.initShareScopeMap(hostKey, sc, {
351
- hostShareScopeMap: (remoteEntryInitOptions == null ? void 0 : remoteEntryInitOptions.shareScopeMap) || {}
509
+ hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},
352
510
  });
353
511
  });
354
- } else {
512
+ }
513
+ else {
355
514
  federationInstance.initShareScopeMap(key, shareScope, {
356
- hostShareScopeMap: (remoteEntryInitOptions == null ? void 0 : remoteEntryInitOptions.shareScopeMap) || {}
515
+ hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},
357
516
  });
358
517
  }
359
- } else {
360
- shareScopeKey.forEach((key)=>{
518
+ }
519
+ else {
520
+ shareScopeKey.forEach((key) => {
361
521
  if (!hostShareScopeKeys || !hostShareScopeMap) {
362
522
  federationInstance.initShareScopeMap(key, shareScope, {
363
- hostShareScopeMap: (remoteEntryInitOptions == null ? void 0 : remoteEntryInitOptions.shareScopeMap) || {}
523
+ hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},
364
524
  });
365
525
  return;
366
526
  }
@@ -369,7 +529,7 @@ function initContainerEntry(options) {
369
529
  }
370
530
  const sc = hostShareScopeMap[key];
371
531
  federationInstance.initShareScopeMap(key, sc, {
372
- hostShareScopeMap: (remoteEntryInitOptions == null ? void 0 : remoteEntryInitOptions.shareScopeMap) || {}
532
+ hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},
373
533
  });
374
534
  });
375
535
  }
@@ -389,10 +549,10 @@ function initContainerEntry(options) {
389
549
  return webpackRequire.I(shareScopeKey, initScope);
390
550
  }
391
551
  // @ts-ignore
392
- return Promise.all(shareScopeKey.map((key)=>{
552
+ return Promise.all(shareScopeKey.map((key) => {
393
553
  // @ts-ignore
394
554
  return webpackRequire.I(key, initScope);
395
- })).then(()=>true);
555
+ })).then(() => true);
396
556
  }
397
557
 
398
558
  const federation = {
@@ -405,10 +565,10 @@ const federation = {
405
565
  I: initializeSharing,
406
566
  S: {},
407
567
  installInitialConsumes,
408
- initContainerEntry
568
+ initContainerEntry,
409
569
  },
410
570
  attachShareScopeMap,
411
- bundlerRuntimeOptions: {}
571
+ bundlerRuntimeOptions: {},
412
572
  };
413
573
 
414
574
  module.exports = federation;