@module-federation/sdk 0.0.0-next-20250926024003 → 0.0.0-perf-devtools-20260107043700

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.esm.js CHANGED
@@ -1,29 +1,27 @@
1
- import { _ as _extends } from './polyfills.esm.js';
2
-
3
1
  const FederationModuleManifest = 'federation-manifest.json';
4
2
  const MANIFEST_EXT = '.json';
5
3
  const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';
6
4
  const NameTransformSymbol = {
7
5
  AT: '@',
8
6
  HYPHEN: '-',
9
- SLASH: '/'
7
+ SLASH: '/',
10
8
  };
11
9
  const NameTransformMap = {
12
10
  [NameTransformSymbol.AT]: 'scope_',
13
11
  [NameTransformSymbol.HYPHEN]: '_',
14
- [NameTransformSymbol.SLASH]: '__'
12
+ [NameTransformSymbol.SLASH]: '__',
15
13
  };
16
14
  const EncodedNameTransformMap = {
17
15
  [NameTransformMap[NameTransformSymbol.AT]]: NameTransformSymbol.AT,
18
16
  [NameTransformMap[NameTransformSymbol.HYPHEN]]: NameTransformSymbol.HYPHEN,
19
- [NameTransformMap[NameTransformSymbol.SLASH]]: NameTransformSymbol.SLASH
17
+ [NameTransformMap[NameTransformSymbol.SLASH]]: NameTransformSymbol.SLASH,
20
18
  };
21
19
  const SEPARATOR = ':';
22
20
  const ManifestFileName = 'mf-manifest.json';
23
21
  const StatsFileName = 'mf-stats.json';
24
22
  const MFModuleType = {
25
23
  NPM: 'npm',
26
- APP: 'app'
24
+ APP: 'app',
27
25
  };
28
26
  const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
29
27
  const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
@@ -33,13 +31,25 @@ const MFPrefetchCommon = {
33
31
  globalKey: '__PREFETCH__',
34
32
  library: 'mf-data-prefetch',
35
33
  exportsKey: '__PREFETCH_EXPORTS__',
36
- fileName: 'bootstrap.js'
34
+ fileName: 'bootstrap.js',
37
35
  };
38
36
 
37
+ /*
38
+ * This file was automatically generated.
39
+ * DO NOT MODIFY BY HAND.
40
+ * Run `yarn special-lint-fix` to update
41
+ */
42
+
39
43
  var ContainerPlugin = /*#__PURE__*/Object.freeze({
40
44
  __proto__: null
41
45
  });
42
46
 
47
+ /*
48
+ * This file was automatically generated.
49
+ * DO NOT MODIFY BY HAND.
50
+ * Run `yarn special-lint-fix` to update
51
+ */
52
+
43
53
  var ContainerReferencePlugin = /*#__PURE__*/Object.freeze({
44
54
  __proto__: null
45
55
  });
@@ -48,29 +58,37 @@ var ModuleFederationPlugin = /*#__PURE__*/Object.freeze({
48
58
  __proto__: null
49
59
  });
50
60
 
61
+ /*
62
+ * This file was automatically generated.
63
+ * DO NOT MODIFY BY HAND.
64
+ * Run `yarn special-lint-fix` to update
65
+ */
66
+
51
67
  var SharePlugin = /*#__PURE__*/Object.freeze({
52
68
  __proto__: null
53
69
  });
54
70
 
55
71
  function isBrowserEnv() {
56
- return typeof window !== 'undefined' && typeof window.document !== 'undefined';
72
+ return (typeof window !== 'undefined' && typeof window.document !== 'undefined');
57
73
  }
58
74
  function isReactNativeEnv() {
59
- var _navigator;
60
- return typeof navigator !== 'undefined' && ((_navigator = navigator) == null ? void 0 : _navigator.product) === 'ReactNative';
75
+ return (typeof navigator !== 'undefined' && navigator?.product === 'ReactNative');
61
76
  }
62
77
  function isBrowserDebug() {
63
78
  try {
64
79
  if (isBrowserEnv() && window.localStorage) {
65
80
  return Boolean(localStorage.getItem(BROWSER_LOG_KEY));
66
81
  }
67
- } catch (error) {
82
+ }
83
+ catch (error) {
68
84
  return false;
69
85
  }
70
86
  return false;
71
87
  }
72
88
  function isDebugMode() {
73
- if (typeof process !== 'undefined' && process.env && process.env['FEDERATION_DEBUG']) {
89
+ if (typeof process !== 'undefined' &&
90
+ process.env &&
91
+ process.env['FEDERATION_DEBUG']) {
74
92
  return Boolean(process.env['FEDERATION_DEBUG']);
75
93
  }
76
94
  if (typeof FEDERATION_DEBUG !== 'undefined' && Boolean(FEDERATION_DEBUG)) {
@@ -78,18 +96,18 @@ function isDebugMode() {
78
96
  }
79
97
  return isBrowserDebug();
80
98
  }
81
- const getProcessEnv = function() {
99
+ const getProcessEnv = function () {
82
100
  return typeof process !== 'undefined' && process.env ? process.env : {};
83
101
  };
84
102
 
85
103
  const LOG_CATEGORY = '[ Federation Runtime ]';
86
104
  // entry: name:version version : 1.0.0 | ^1.2.3
87
105
  // entry: name:entry entry: https://localhost:9000/federation-manifest.json
88
- const parseEntry = (str, devVerOrUrl, separator = SEPARATOR)=>{
106
+ const parseEntry = (str, devVerOrUrl, separator = SEPARATOR) => {
89
107
  const strSplit = str.split(separator);
90
108
  const devVersionOrUrl = getProcessEnv()['NODE_ENV'] === 'development' && devVerOrUrl;
91
109
  const defaultVersion = '*';
92
- const isEntry = (s)=>s.startsWith('http') || s.includes(MANIFEST_EXT);
110
+ const isEntry = (s) => s.startsWith('http') || s.includes(MANIFEST_EXT);
93
111
  // Check if the string starts with a type
94
112
  if (strSplit.length >= 2) {
95
113
  let [name, ...versionOrEntryArr] = strSplit;
@@ -97,44 +115,47 @@ const parseEntry = (str, devVerOrUrl, separator = SEPARATOR)=>{
97
115
  if (str.startsWith(separator)) {
98
116
  name = strSplit.slice(0, 2).join(separator);
99
117
  versionOrEntryArr = [
100
- devVersionOrUrl || strSplit.slice(2).join(separator)
118
+ devVersionOrUrl || strSplit.slice(2).join(separator),
101
119
  ];
102
120
  }
103
121
  let versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(separator);
104
122
  if (isEntry(versionOrEntry)) {
105
123
  return {
106
124
  name,
107
- entry: versionOrEntry
125
+ entry: versionOrEntry,
108
126
  };
109
- } else {
127
+ }
128
+ else {
110
129
  // Apply version rule
111
130
  // devVersionOrUrl => inputVersion => defaultVersion
112
131
  return {
113
132
  name,
114
- version: versionOrEntry || defaultVersion
133
+ version: versionOrEntry || defaultVersion,
115
134
  };
116
135
  }
117
- } else if (strSplit.length === 1) {
136
+ }
137
+ else if (strSplit.length === 1) {
118
138
  const [name] = strSplit;
119
139
  if (devVersionOrUrl && isEntry(devVersionOrUrl)) {
120
140
  return {
121
141
  name,
122
- entry: devVersionOrUrl
142
+ entry: devVersionOrUrl,
123
143
  };
124
144
  }
125
145
  return {
126
146
  name,
127
- version: devVersionOrUrl || defaultVersion
147
+ version: devVersionOrUrl || defaultVersion,
128
148
  };
129
- } else {
149
+ }
150
+ else {
130
151
  throw `Invalid entry value: ${str}`;
131
152
  }
132
153
  };
133
- const composeKeyWithSeparator = function(...args) {
154
+ const composeKeyWithSeparator = function (...args) {
134
155
  if (!args.length) {
135
156
  return '';
136
157
  }
137
- return args.reduce((sum, cur)=>{
158
+ return args.reduce((sum, cur) => {
138
159
  if (!cur) {
139
160
  return sum;
140
161
  }
@@ -144,15 +165,19 @@ const composeKeyWithSeparator = function(...args) {
144
165
  return `${sum}${SEPARATOR}${cur}`;
145
166
  }, '');
146
167
  };
147
- const encodeName = function(name, prefix = '', withExt = false) {
168
+ const encodeName = function (name, prefix = '', withExt = false) {
148
169
  try {
149
170
  const ext = withExt ? '.js' : '';
150
- return `${prefix}${name.replace(new RegExp(`${NameTransformSymbol.AT}`, 'g'), NameTransformMap[NameTransformSymbol.AT]).replace(new RegExp(`${NameTransformSymbol.HYPHEN}`, 'g'), NameTransformMap[NameTransformSymbol.HYPHEN]).replace(new RegExp(`${NameTransformSymbol.SLASH}`, 'g'), NameTransformMap[NameTransformSymbol.SLASH])}${ext}`;
151
- } catch (err) {
171
+ return `${prefix}${name
172
+ .replace(new RegExp(`${NameTransformSymbol.AT}`, 'g'), NameTransformMap[NameTransformSymbol.AT])
173
+ .replace(new RegExp(`${NameTransformSymbol.HYPHEN}`, 'g'), NameTransformMap[NameTransformSymbol.HYPHEN])
174
+ .replace(new RegExp(`${NameTransformSymbol.SLASH}`, 'g'), NameTransformMap[NameTransformSymbol.SLASH])}${ext}`;
175
+ }
176
+ catch (err) {
152
177
  throw err;
153
178
  }
154
179
  };
155
- const decodeName = function(name, prefix, withExt) {
180
+ const decodeName = function (name, prefix, withExt) {
156
181
  try {
157
182
  let decodedName = name;
158
183
  if (prefix) {
@@ -161,16 +186,20 @@ const decodeName = function(name, prefix, withExt) {
161
186
  }
162
187
  decodedName = decodedName.replace(new RegExp(prefix, 'g'), '');
163
188
  }
164
- decodedName = decodedName.replace(new RegExp(`${NameTransformMap[NameTransformSymbol.AT]}`, 'g'), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.AT]]).replace(new RegExp(`${NameTransformMap[NameTransformSymbol.SLASH]}`, 'g'), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.SLASH]]).replace(new RegExp(`${NameTransformMap[NameTransformSymbol.HYPHEN]}`, 'g'), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.HYPHEN]]);
189
+ decodedName = decodedName
190
+ .replace(new RegExp(`${NameTransformMap[NameTransformSymbol.AT]}`, 'g'), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.AT]])
191
+ .replace(new RegExp(`${NameTransformMap[NameTransformSymbol.SLASH]}`, 'g'), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.SLASH]])
192
+ .replace(new RegExp(`${NameTransformMap[NameTransformSymbol.HYPHEN]}`, 'g'), EncodedNameTransformMap[NameTransformMap[NameTransformSymbol.HYPHEN]]);
165
193
  if (withExt) {
166
194
  decodedName = decodedName.replace('.js', '');
167
195
  }
168
196
  return decodedName;
169
- } catch (err) {
197
+ }
198
+ catch (err) {
170
199
  throw err;
171
200
  }
172
201
  };
173
- const generateExposeFilename = (exposeName, withExt)=>{
202
+ const generateExposeFilename = (exposeName, withExt) => {
174
203
  if (!exposeName) {
175
204
  return '';
176
205
  }
@@ -183,47 +212,51 @@ const generateExposeFilename = (exposeName, withExt)=>{
183
212
  }
184
213
  return encodeName(expose, '__federation_expose_', withExt);
185
214
  };
186
- const generateShareFilename = (pkgName, withExt)=>{
215
+ const generateShareFilename = (pkgName, withExt) => {
187
216
  if (!pkgName) {
188
217
  return '';
189
218
  }
190
219
  return encodeName(pkgName, '__federation_shared_', withExt);
191
220
  };
192
- const getResourceUrl = (module, sourceUrl)=>{
221
+ const getResourceUrl = (module, sourceUrl) => {
193
222
  if ('getPublicPath' in module) {
194
223
  let publicPath;
195
224
  if (!module.getPublicPath.startsWith('function')) {
196
225
  publicPath = new Function(module.getPublicPath)();
197
- } else {
226
+ }
227
+ else {
198
228
  publicPath = new Function('return ' + module.getPublicPath)()();
199
229
  }
200
230
  return `${publicPath}${sourceUrl}`;
201
- } else if ('publicPath' in module) {
231
+ }
232
+ else if ('publicPath' in module) {
202
233
  if (!isBrowserEnv() && !isReactNativeEnv() && 'ssrPublicPath' in module) {
203
234
  return `${module.ssrPublicPath}${sourceUrl}`;
204
235
  }
205
236
  return `${module.publicPath}${sourceUrl}`;
206
- } else {
237
+ }
238
+ else {
207
239
  console.warn('Cannot get resource URL. If in debug mode, please ignore.', module, sourceUrl);
208
240
  return '';
209
241
  }
210
242
  };
211
243
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
212
- const assert = (condition, msg)=>{
244
+ const assert = (condition, msg) => {
213
245
  if (!condition) {
214
246
  error(msg);
215
247
  }
216
248
  };
217
- const error = (msg)=>{
249
+ const error = (msg) => {
218
250
  throw new Error(`${LOG_CATEGORY}: ${msg}`);
219
251
  };
220
- const warn = (msg)=>{
252
+ const warn = (msg) => {
221
253
  console.warn(`${LOG_CATEGORY}: ${msg}`);
222
254
  };
223
255
  function safeToString(info) {
224
256
  try {
225
257
  return JSON.stringify(info, null, 2);
226
- } catch (e) {
258
+ }
259
+ catch (e) {
227
260
  return '';
228
261
  }
229
262
  }
@@ -233,11 +266,11 @@ function isRequiredVersion(str) {
233
266
  return VERSION_PATTERN_REGEXP.test(str);
234
267
  }
235
268
 
236
- const simpleJoinRemoteEntry = (rPath, rName)=>{
269
+ const simpleJoinRemoteEntry = (rPath, rName) => {
237
270
  if (!rPath) {
238
271
  return rName;
239
272
  }
240
- const transformPath = (str)=>{
273
+ const transformPath = (str) => {
241
274
  if (str === '.') {
242
275
  return '';
243
276
  }
@@ -263,22 +296,25 @@ const simpleJoinRemoteEntry = (rPath, rName)=>{
263
296
  return `${transformedPath}/${rName}`;
264
297
  };
265
298
  function inferAutoPublicPath(url) {
266
- return url.replace(/#.*$/, '').replace(/\?.*$/, '').replace(/\/[^\/]+$/, '/');
299
+ return url
300
+ .replace(/#.*$/, '')
301
+ .replace(/\?.*$/, '')
302
+ .replace(/\/[^\/]+$/, '/');
267
303
  }
268
304
  // Priority: overrides > remotes
269
305
  // eslint-disable-next-line max-lines-per-function
270
306
  function generateSnapshotFromManifest(manifest, options = {}) {
271
- var _manifest_metaData, _manifest_metaData1;
272
307
  const { remotes = {}, overrides = {}, version } = options;
273
308
  let remoteSnapshot;
274
- const getPublicPath = ()=>{
309
+ const getPublicPath = () => {
275
310
  if ('publicPath' in manifest.metaData) {
276
311
  if (manifest.metaData.publicPath === 'auto' && version) {
277
312
  // use same implementation as publicPath auto runtime module implements
278
313
  return inferAutoPublicPath(version);
279
314
  }
280
315
  return manifest.metaData.publicPath;
281
- } else {
316
+ }
317
+ else {
282
318
  return manifest.metaData.getPublicPath;
283
319
  }
284
320
  };
@@ -286,32 +322,36 @@ function generateSnapshotFromManifest(manifest, options = {}) {
286
322
  let remotesInfo = {};
287
323
  // If remotes are not provided, only the remotes in the manifest will be read
288
324
  if (!Object.keys(remotes).length) {
289
- var _manifest_remotes;
290
- remotesInfo = ((_manifest_remotes = manifest.remotes) == null ? void 0 : _manifest_remotes.reduce((res, next)=>{
291
- let matchedVersion;
292
- const name = next.federationContainerName;
293
- // overrides have higher priority
294
- if (overridesKeys.includes(name)) {
295
- matchedVersion = overrides[name];
296
- } else {
297
- if ('version' in next) {
298
- matchedVersion = next.version;
299
- } else {
300
- matchedVersion = next.entry;
325
+ remotesInfo =
326
+ manifest.remotes?.reduce((res, next) => {
327
+ let matchedVersion;
328
+ const name = next.federationContainerName;
329
+ // overrides have higher priority
330
+ if (overridesKeys.includes(name)) {
331
+ matchedVersion = overrides[name];
301
332
  }
302
- }
303
- res[name] = {
304
- matchedVersion
305
- };
306
- return res;
307
- }, {})) || {};
333
+ else {
334
+ if ('version' in next) {
335
+ matchedVersion = next.version;
336
+ }
337
+ else {
338
+ matchedVersion = next.entry;
339
+ }
340
+ }
341
+ res[name] = {
342
+ matchedVersion,
343
+ };
344
+ return res;
345
+ }, {}) || {};
308
346
  }
309
347
  // If remotes (deploy scenario) are specified, they need to be traversed again
310
- Object.keys(remotes).forEach((key)=>remotesInfo[key] = {
311
- // overrides will override dependencies
312
- matchedVersion: overridesKeys.includes(key) ? overrides[key] : remotes[key]
313
- });
314
- const { remoteEntry: { path: remoteEntryPath, name: remoteEntryName, type: remoteEntryType }, types: remoteTypes, buildInfo: { buildVersion }, globalName, ssrRemoteEntry } = manifest.metaData;
348
+ Object.keys(remotes).forEach((key) => (remotesInfo[key] = {
349
+ // overrides will override dependencies
350
+ matchedVersion: overridesKeys.includes(key)
351
+ ? overrides[key]
352
+ : remotes[key],
353
+ }));
354
+ const { remoteEntry: { path: remoteEntryPath, name: remoteEntryName, type: remoteEntryType, }, types: remoteTypes = { path: '', name: '', zip: '', api: '' }, buildInfo: { buildVersion }, globalName, ssrRemoteEntry, } = manifest.metaData;
315
355
  const { exposes } = manifest;
316
356
  let basicRemoteSnapshot = {
317
357
  version: version ? version : '',
@@ -323,98 +363,238 @@ function generateSnapshotFromManifest(manifest, options = {}) {
323
363
  remoteTypesZip: remoteTypes.zip || '',
324
364
  remoteTypesAPI: remoteTypes.api || '',
325
365
  remotesInfo,
326
- shared: manifest == null ? void 0 : manifest.shared.map((item)=>({
327
- assets: item.assets,
328
- sharedName: item.name,
329
- version: item.version
330
- })),
331
- modules: exposes == null ? void 0 : exposes.map((expose)=>({
332
- moduleName: expose.name,
333
- modulePath: expose.path,
334
- assets: expose.assets
335
- }))
366
+ shared: manifest?.shared.map((item) => ({
367
+ assets: item.assets,
368
+ sharedName: item.name,
369
+ version: item.version,
370
+ })),
371
+ modules: exposes?.map((expose) => ({
372
+ moduleName: expose.name,
373
+ modulePath: expose.path,
374
+ assets: expose.assets,
375
+ })),
336
376
  };
337
- if ((_manifest_metaData = manifest.metaData) == null ? void 0 : _manifest_metaData.prefetchInterface) {
377
+ if (manifest.metaData?.prefetchInterface) {
338
378
  const prefetchInterface = manifest.metaData.prefetchInterface;
339
- basicRemoteSnapshot = _extends({}, basicRemoteSnapshot, {
340
- prefetchInterface
341
- });
379
+ basicRemoteSnapshot = {
380
+ ...basicRemoteSnapshot,
381
+ prefetchInterface,
382
+ };
342
383
  }
343
- if ((_manifest_metaData1 = manifest.metaData) == null ? void 0 : _manifest_metaData1.prefetchEntry) {
384
+ if (manifest.metaData?.prefetchEntry) {
344
385
  const { path, name, type } = manifest.metaData.prefetchEntry;
345
- basicRemoteSnapshot = _extends({}, basicRemoteSnapshot, {
386
+ basicRemoteSnapshot = {
387
+ ...basicRemoteSnapshot,
346
388
  prefetchEntry: simpleJoinRemoteEntry(path, name),
347
- prefetchEntryType: type
348
- });
389
+ prefetchEntryType: type,
390
+ };
349
391
  }
350
392
  if ('publicPath' in manifest.metaData) {
351
- remoteSnapshot = _extends({}, basicRemoteSnapshot, {
393
+ remoteSnapshot = {
394
+ ...basicRemoteSnapshot,
352
395
  publicPath: getPublicPath(),
353
- ssrPublicPath: manifest.metaData.ssrPublicPath
354
- });
355
- } else {
356
- remoteSnapshot = _extends({}, basicRemoteSnapshot, {
357
- getPublicPath: getPublicPath()
358
- });
396
+ ssrPublicPath: manifest.metaData.ssrPublicPath,
397
+ };
398
+ }
399
+ else {
400
+ remoteSnapshot = {
401
+ ...basicRemoteSnapshot,
402
+ getPublicPath: getPublicPath(),
403
+ };
359
404
  }
360
405
  if (ssrRemoteEntry) {
361
406
  const fullSSRRemoteEntry = simpleJoinRemoteEntry(ssrRemoteEntry.path, ssrRemoteEntry.name);
362
407
  remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
363
- remoteSnapshot.ssrRemoteEntryType = ssrRemoteEntry.type || 'commonjs-module';
408
+ remoteSnapshot.ssrRemoteEntryType =
409
+ ssrRemoteEntry.type || 'commonjs-module';
364
410
  }
365
411
  return remoteSnapshot;
366
412
  }
367
413
  function isManifestProvider(moduleInfo) {
368
- if ('remoteEntry' in moduleInfo && moduleInfo.remoteEntry.includes(MANIFEST_EXT)) {
414
+ if ('remoteEntry' in moduleInfo &&
415
+ moduleInfo.remoteEntry.includes(MANIFEST_EXT)) {
369
416
  return true;
370
- } else {
417
+ }
418
+ else {
371
419
  return false;
372
420
  }
373
421
  }
422
+ function getManifestFileName(manifestOptions) {
423
+ if (!manifestOptions) {
424
+ return {
425
+ statsFileName: StatsFileName,
426
+ manifestFileName: ManifestFileName,
427
+ };
428
+ }
429
+ let filePath = typeof manifestOptions === 'boolean' ? '' : manifestOptions.filePath || '';
430
+ let fileName = typeof manifestOptions === 'boolean' ? '' : manifestOptions.fileName || '';
431
+ const JSON_EXT = '.json';
432
+ const addExt = (name) => {
433
+ if (name.endsWith(JSON_EXT)) {
434
+ return name;
435
+ }
436
+ return `${name}${JSON_EXT}`;
437
+ };
438
+ const insertSuffix = (name, suffix) => {
439
+ return name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
440
+ };
441
+ const manifestFileName = fileName ? addExt(fileName) : ManifestFileName;
442
+ const statsFileName = fileName
443
+ ? insertSuffix(manifestFileName, '-stats')
444
+ : StatsFileName;
445
+ return {
446
+ statsFileName: simpleJoinRemoteEntry(filePath, statsFileName),
447
+ manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName),
448
+ };
449
+ }
374
450
 
375
451
  const PREFIX = '[ Module Federation ]';
376
- let Logger = class Logger {
452
+ const DEFAULT_DELEGATE = console;
453
+ const LOGGER_STACK_SKIP_TOKENS = [
454
+ 'logger.ts',
455
+ 'logger.js',
456
+ 'captureStackTrace',
457
+ 'Logger.emit',
458
+ 'Logger.log',
459
+ 'Logger.info',
460
+ 'Logger.warn',
461
+ 'Logger.error',
462
+ 'Logger.debug',
463
+ ];
464
+ function captureStackTrace() {
465
+ try {
466
+ const stack = new Error().stack;
467
+ if (!stack) {
468
+ return undefined;
469
+ }
470
+ const [, ...rawLines] = stack.split('\n');
471
+ const filtered = rawLines.filter((line) => !LOGGER_STACK_SKIP_TOKENS.some((token) => line.includes(token)));
472
+ if (!filtered.length) {
473
+ return undefined;
474
+ }
475
+ const stackPreview = filtered.slice(0, 5).join('\n');
476
+ return `Stack trace:\n${stackPreview}`;
477
+ }
478
+ catch {
479
+ return undefined;
480
+ }
481
+ }
482
+ class Logger {
483
+ constructor(prefix, delegate = DEFAULT_DELEGATE) {
484
+ this.prefix = prefix;
485
+ this.delegate = delegate ?? DEFAULT_DELEGATE;
486
+ }
377
487
  setPrefix(prefix) {
378
488
  this.prefix = prefix;
379
489
  }
490
+ setDelegate(delegate) {
491
+ this.delegate = delegate ?? DEFAULT_DELEGATE;
492
+ }
493
+ emit(method, args) {
494
+ const delegate = this.delegate;
495
+ const debugMode = isDebugMode();
496
+ const stackTrace = debugMode ? captureStackTrace() : undefined;
497
+ const enrichedArgs = stackTrace ? [...args, stackTrace] : args;
498
+ const order = (() => {
499
+ switch (method) {
500
+ case 'log':
501
+ return ['log', 'info'];
502
+ case 'info':
503
+ return ['info', 'log'];
504
+ case 'warn':
505
+ return ['warn', 'info', 'log'];
506
+ case 'error':
507
+ return ['error', 'warn', 'log'];
508
+ case 'debug':
509
+ default:
510
+ return ['debug', 'log'];
511
+ }
512
+ })();
513
+ for (const candidate of order) {
514
+ const handler = delegate[candidate];
515
+ if (typeof handler === 'function') {
516
+ handler.call(delegate, this.prefix, ...enrichedArgs);
517
+ return;
518
+ }
519
+ }
520
+ for (const candidate of order) {
521
+ const handler = DEFAULT_DELEGATE[candidate];
522
+ if (typeof handler === 'function') {
523
+ handler.call(DEFAULT_DELEGATE, this.prefix, ...enrichedArgs);
524
+ return;
525
+ }
526
+ }
527
+ }
380
528
  log(...args) {
381
- console.log(this.prefix, ...args);
529
+ this.emit('log', args);
382
530
  }
383
531
  warn(...args) {
384
- console.log(this.prefix, ...args);
532
+ this.emit('warn', args);
385
533
  }
386
534
  error(...args) {
387
- console.log(this.prefix, ...args);
535
+ this.emit('error', args);
388
536
  }
389
537
  success(...args) {
390
- console.log(this.prefix, ...args);
538
+ this.emit('info', args);
391
539
  }
392
540
  info(...args) {
393
- console.log(this.prefix, ...args);
541
+ this.emit('info', args);
394
542
  }
395
543
  ready(...args) {
396
- console.log(this.prefix, ...args);
544
+ this.emit('info', args);
397
545
  }
398
546
  debug(...args) {
399
547
  if (isDebugMode()) {
400
- console.log(this.prefix, ...args);
548
+ this.emit('debug', args);
401
549
  }
402
550
  }
403
- constructor(prefix){
404
- this.prefix = prefix;
405
- }
406
- };
551
+ }
407
552
  function createLogger(prefix) {
408
553
  return new Logger(prefix);
409
554
  }
555
+ function createInfrastructureLogger(prefix) {
556
+ const infrastructureLogger = new Logger(prefix);
557
+ Object.defineProperty(infrastructureLogger, '__mf_infrastructure_logger__', {
558
+ value: true,
559
+ enumerable: false,
560
+ configurable: false,
561
+ });
562
+ return infrastructureLogger;
563
+ }
564
+ function bindLoggerToCompiler(loggerInstance, compiler, name) {
565
+ if (!loggerInstance
566
+ .__mf_infrastructure_logger__) {
567
+ return;
568
+ }
569
+ if (!compiler?.getInfrastructureLogger) {
570
+ return;
571
+ }
572
+ try {
573
+ const infrastructureLogger = compiler.getInfrastructureLogger(name);
574
+ if (infrastructureLogger &&
575
+ typeof infrastructureLogger === 'object' &&
576
+ (typeof infrastructureLogger.log === 'function' ||
577
+ typeof infrastructureLogger.info === 'function' ||
578
+ typeof infrastructureLogger.warn === 'function' ||
579
+ typeof infrastructureLogger.error === 'function')) {
580
+ loggerInstance.setDelegate(infrastructureLogger);
581
+ }
582
+ }
583
+ catch {
584
+ // If the bundler throws (older versions), fall back to default console logger.
585
+ loggerInstance.setDelegate(undefined);
586
+ }
587
+ }
410
588
  const logger = createLogger(PREFIX);
589
+ const infrastructureLogger = createInfrastructureLogger(PREFIX);
411
590
 
412
591
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
413
592
  async function safeWrapper(callback, disableWarn) {
414
593
  try {
415
594
  const res = await callback();
416
595
  return res;
417
- } catch (e) {
596
+ }
597
+ catch (e) {
418
598
  !disableWarn && warn(e);
419
599
  return;
420
600
  }
@@ -434,7 +614,7 @@ function createScript(info) {
434
614
  let timeout = 20000;
435
615
  let timeoutId;
436
616
  const scripts = document.getElementsByTagName('script');
437
- for(let i = 0; i < scripts.length; i++){
617
+ for (let i = 0; i < scripts.length; i++) {
438
618
  const s = scripts[i];
439
619
  const scriptSrc = s.getAttribute('src');
440
620
  if (scriptSrc && isStaticResourcesEqual(scriptSrc, info.url)) {
@@ -446,13 +626,14 @@ function createScript(info) {
446
626
  if (!script) {
447
627
  const attrs = info.attrs;
448
628
  script = document.createElement('script');
449
- script.type = (attrs == null ? void 0 : attrs['type']) === 'module' ? 'module' : 'text/javascript';
629
+ script.type = attrs?.['type'] === 'module' ? 'module' : 'text/javascript';
450
630
  let createScriptRes = undefined;
451
631
  if (info.createScriptHook) {
452
632
  createScriptRes = info.createScriptHook(info.url, info.attrs);
453
633
  if (createScriptRes instanceof HTMLScriptElement) {
454
634
  script = createScriptRes;
455
- } else if (typeof createScriptRes === 'object') {
635
+ }
636
+ else if (typeof createScriptRes === 'object') {
456
637
  if ('script' in createScriptRes && createScriptRes.script) {
457
638
  script = createScriptRes.script;
458
639
  }
@@ -465,36 +646,39 @@ function createScript(info) {
465
646
  script.src = info.url;
466
647
  }
467
648
  if (attrs && !createScriptRes) {
468
- Object.keys(attrs).forEach((name)=>{
649
+ Object.keys(attrs).forEach((name) => {
469
650
  if (script) {
470
651
  if (name === 'async' || name === 'defer') {
471
652
  script[name] = attrs[name];
472
- // Attributes that do not exist are considered overridden
473
- } else if (!script.getAttribute(name)) {
653
+ // Attributes that do not exist are considered overridden
654
+ }
655
+ else if (!script.getAttribute(name)) {
474
656
  script.setAttribute(name, attrs[name]);
475
657
  }
476
658
  }
477
659
  });
478
660
  }
479
661
  }
480
- const onScriptComplete = async (prev, // eslint-disable-next-line @typescript-eslint/no-explicit-any
481
- event)=>{
662
+ const onScriptComplete = async (prev,
663
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
664
+ event) => {
482
665
  clearTimeout(timeoutId);
483
- const onScriptCompleteCallback = ()=>{
484
- if ((event == null ? void 0 : event.type) === 'error') {
485
- (info == null ? void 0 : info.onErrorCallback) && (info == null ? void 0 : info.onErrorCallback(event));
486
- } else {
487
- (info == null ? void 0 : info.cb) && (info == null ? void 0 : info.cb());
666
+ const onScriptCompleteCallback = () => {
667
+ if (event?.type === 'error') {
668
+ info?.onErrorCallback && info?.onErrorCallback(event);
669
+ }
670
+ else {
671
+ info?.cb && info?.cb();
488
672
  }
489
673
  };
490
674
  // Prevent memory leaks in IE.
491
675
  if (script) {
492
676
  script.onerror = null;
493
677
  script.onload = null;
494
- safeWrapper(()=>{
678
+ safeWrapper(() => {
495
679
  const { needDeleteScript = true } = info;
496
680
  if (needDeleteScript) {
497
- (script == null ? void 0 : script.parentNode) && script.parentNode.removeChild(script);
681
+ script?.parentNode && script.parentNode.removeChild(script);
498
682
  }
499
683
  });
500
684
  if (prev && typeof prev === 'function') {
@@ -512,13 +696,10 @@ function createScript(info) {
512
696
  };
513
697
  script.onerror = onScriptComplete.bind(null, script.onerror);
514
698
  script.onload = onScriptComplete.bind(null, script.onload);
515
- timeoutId = setTimeout(()=>{
699
+ timeoutId = setTimeout(() => {
516
700
  onScriptComplete(null, new Error(`Remote script "${info.url}" time-outed.`));
517
701
  }, timeout);
518
- return {
519
- script,
520
- needAttach
521
- };
702
+ return { script, needAttach };
522
703
  }
523
704
  function createLink(info) {
524
705
  // <link rel="preload" href="script.js" as="script">
@@ -526,11 +707,13 @@ function createLink(info) {
526
707
  let link = null;
527
708
  let needAttach = true;
528
709
  const links = document.getElementsByTagName('link');
529
- for(let i = 0; i < links.length; i++){
710
+ for (let i = 0; i < links.length; i++) {
530
711
  const l = links[i];
531
712
  const linkHref = l.getAttribute('href');
532
713
  const linkRel = l.getAttribute('rel');
533
- if (linkHref && isStaticResourcesEqual(linkHref, info.url) && linkRel === info.attrs['rel']) {
714
+ if (linkHref &&
715
+ isStaticResourcesEqual(linkHref, info.url) &&
716
+ linkRel === info.attrs['rel']) {
534
717
  link = l;
535
718
  needAttach = false;
536
719
  break;
@@ -548,30 +731,32 @@ function createLink(info) {
548
731
  }
549
732
  }
550
733
  if (attrs && !createLinkRes) {
551
- Object.keys(attrs).forEach((name)=>{
734
+ Object.keys(attrs).forEach((name) => {
552
735
  if (link && !link.getAttribute(name)) {
553
736
  link.setAttribute(name, attrs[name]);
554
737
  }
555
738
  });
556
739
  }
557
740
  }
558
- const onLinkComplete = (prev, // eslint-disable-next-line @typescript-eslint/no-explicit-any
559
- event)=>{
560
- const onLinkCompleteCallback = ()=>{
561
- if ((event == null ? void 0 : event.type) === 'error') {
562
- (info == null ? void 0 : info.onErrorCallback) && (info == null ? void 0 : info.onErrorCallback(event));
563
- } else {
564
- (info == null ? void 0 : info.cb) && (info == null ? void 0 : info.cb());
741
+ const onLinkComplete = (prev,
742
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
743
+ event) => {
744
+ const onLinkCompleteCallback = () => {
745
+ if (event?.type === 'error') {
746
+ info?.onErrorCallback && info?.onErrorCallback(event);
747
+ }
748
+ else {
749
+ info?.cb && info?.cb();
565
750
  }
566
751
  };
567
752
  // Prevent memory leaks in IE.
568
753
  if (link) {
569
754
  link.onerror = null;
570
755
  link.onload = null;
571
- safeWrapper(()=>{
756
+ safeWrapper(() => {
572
757
  const { needDeleteLink = true } = info;
573
758
  if (needDeleteLink) {
574
- (link == null ? void 0 : link.parentNode) && link.parentNode.removeChild(link);
759
+ link?.parentNode && link.parentNode.removeChild(link);
575
760
  }
576
761
  });
577
762
  if (prev) {
@@ -585,23 +770,21 @@ function createLink(info) {
585
770
  };
586
771
  link.onerror = onLinkComplete.bind(null, link.onerror);
587
772
  link.onload = onLinkComplete.bind(null, link.onload);
588
- return {
589
- link,
590
- needAttach
591
- };
773
+ return { link, needAttach };
592
774
  }
593
775
  function loadScript(url, info) {
594
776
  const { attrs = {}, createScriptHook } = info;
595
- return new Promise((resolve, reject)=>{
777
+ return new Promise((resolve, reject) => {
596
778
  const { script, needAttach } = createScript({
597
779
  url,
598
780
  cb: resolve,
599
781
  onErrorCallback: reject,
600
- attrs: _extends({
601
- fetchpriority: 'high'
602
- }, attrs),
782
+ attrs: {
783
+ fetchpriority: 'high',
784
+ ...attrs,
785
+ },
603
786
  createScriptHook,
604
- needDeleteScript: true
787
+ needDeleteScript: true,
605
788
  });
606
789
  needAttach && document.head.appendChild(script);
607
790
  });
@@ -617,7 +800,9 @@ function importNodeModule(name) {
617
800
  return sdkImportCache.get(name);
618
801
  }
619
802
  const importModule = new Function('name', `return import(name)`);
620
- const promise = importModule(name).then((res)=>res).catch((error)=>{
803
+ const promise = importModule(name)
804
+ .then((res) => res)
805
+ .catch((error) => {
621
806
  console.error(`Error importing module ${name}:`, error);
622
807
  // Remove from cache on error so it can be retried
623
808
  sdkImportCache.delete(name);
@@ -627,12 +812,12 @@ function importNodeModule(name) {
627
812
  sdkImportCache.set(name, promise);
628
813
  return promise;
629
814
  }
630
- const loadNodeFetch = async ()=>{
815
+ const loadNodeFetch = async () => {
631
816
  const fetchModule = await importNodeModule('node-fetch');
632
- return fetchModule.default || fetchModule;
817
+ return (fetchModule.default || fetchModule);
633
818
  };
634
- const lazyLoaderHookFetch = async (input, init, loaderHook)=>{
635
- const hook = (url, init)=>{
819
+ const lazyLoaderHookFetch = async (input, init, loaderHook) => {
820
+ const hook = (url, init) => {
636
821
  return loaderHook.lifecycle.fetch.emit(url, init);
637
822
  };
638
823
  const res = await hook(input, init || {});
@@ -642,116 +827,132 @@ const lazyLoaderHookFetch = async (input, init, loaderHook)=>{
642
827
  }
643
828
  return res;
644
829
  };
645
- const createScriptNode = typeof ENV_TARGET === 'undefined' || ENV_TARGET !== 'web' ? (url, cb, attrs, loaderHook)=>{
646
- if (loaderHook == null ? void 0 : loaderHook.createScriptHook) {
647
- const hookResult = loaderHook.createScriptHook(url);
648
- if (hookResult && typeof hookResult === 'object' && 'url' in hookResult) {
649
- url = hookResult.url;
650
- }
651
- }
652
- let urlObj;
653
- try {
654
- urlObj = new URL(url);
655
- } catch (e) {
656
- console.error('Error constructing URL:', e);
657
- cb(new Error(`Invalid URL: ${e}`));
658
- return;
659
- }
660
- const getFetch = async ()=>{
661
- if (loaderHook == null ? void 0 : loaderHook.fetch) {
662
- return (input, init)=>lazyLoaderHookFetch(input, init, loaderHook);
830
+ const createScriptNode = typeof ENV_TARGET === 'undefined' || ENV_TARGET !== 'web'
831
+ ? (url, cb, attrs, loaderHook) => {
832
+ if (loaderHook?.createScriptHook) {
833
+ const hookResult = loaderHook.createScriptHook(url);
834
+ if (hookResult &&
835
+ typeof hookResult === 'object' &&
836
+ 'url' in hookResult) {
837
+ url = hookResult.url;
838
+ }
663
839
  }
664
- return typeof fetch === 'undefined' ? loadNodeFetch() : fetch;
665
- };
666
- const handleScriptFetch = async (f, urlObj)=>{
840
+ let urlObj;
667
841
  try {
668
- var //@ts-ignore
669
- _vm_constants;
670
- const res = await f(urlObj.href);
671
- const data = await res.text();
672
- const [path, vm] = await Promise.all([
673
- importNodeModule('path'),
674
- importNodeModule('vm')
675
- ]);
676
- const scriptContext = {
677
- exports: {},
678
- module: {
679
- exports: {}
680
- }
681
- };
682
- const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/');
683
- const filename = path.basename(urlObj.pathname);
684
- var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;
685
- const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, {
686
- filename,
687
- importModuleDynamically: (_vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER = (_vm_constants = vm.constants) == null ? void 0 : _vm_constants.USE_MAIN_CONTEXT_DEFAULT_LOADER) != null ? _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER : importNodeModule
688
- });
689
- script.runInThisContext()(scriptContext.exports, scriptContext.module, eval('require'), urlDirname, filename);
690
- const exportedInterface = scriptContext.module.exports || scriptContext.exports;
691
- if (attrs && exportedInterface && attrs['globalName']) {
692
- const container = exportedInterface[attrs['globalName']] || exportedInterface;
693
- cb(undefined, container);
694
- return;
695
- }
696
- cb(undefined, exportedInterface);
697
- } catch (e) {
698
- cb(e instanceof Error ? e : new Error(`Script execution error: ${e}`));
842
+ urlObj = new URL(url);
699
843
  }
700
- };
701
- getFetch().then(async (f)=>{
702
- if ((attrs == null ? void 0 : attrs['type']) === 'esm' || (attrs == null ? void 0 : attrs['type']) === 'module') {
703
- return loadModule(urlObj.href, {
704
- fetch: f,
705
- vm: await importNodeModule('vm')
706
- }).then(async (module)=>{
707
- await module.evaluate();
708
- cb(undefined, module.namespace);
709
- }).catch((e)=>{
710
- cb(e instanceof Error ? e : new Error(`Script execution error: ${e}`));
711
- });
844
+ catch (e) {
845
+ console.error('Error constructing URL:', e);
846
+ cb(new Error(`Invalid URL: ${e}`));
847
+ return;
712
848
  }
713
- handleScriptFetch(f, urlObj);
714
- }).catch((err)=>{
715
- cb(err);
716
- });
717
- } : (url, cb, attrs, loaderHook)=>{
718
- cb(new Error('createScriptNode is disabled in non-Node.js environment'));
719
- };
720
- const loadScriptNode = typeof ENV_TARGET === 'undefined' || ENV_TARGET !== 'web' ? (url, info)=>{
721
- return new Promise((resolve, reject)=>{
722
- createScriptNode(url, (error, scriptContext)=>{
723
- if (error) {
724
- reject(error);
725
- } else {
726
- var _info_attrs, _info_attrs1;
727
- const remoteEntryKey = (info == null ? void 0 : (_info_attrs = info.attrs) == null ? void 0 : _info_attrs['globalName']) || `__FEDERATION_${info == null ? void 0 : (_info_attrs1 = info.attrs) == null ? void 0 : _info_attrs1['name']}:custom__`;
728
- const entryExports = globalThis[remoteEntryKey] = scriptContext;
729
- resolve(entryExports);
849
+ const getFetch = async () => {
850
+ if (loaderHook?.fetch) {
851
+ return (input, init) => lazyLoaderHookFetch(input, init, loaderHook);
730
852
  }
731
- }, info.attrs, info.loaderHook);
732
- });
733
- } : (url, info)=>{
734
- throw new Error('loadScriptNode is disabled in non-Node.js environment');
735
- };
853
+ return typeof fetch === 'undefined' ? loadNodeFetch() : fetch;
854
+ };
855
+ const handleScriptFetch = async (f, urlObj) => {
856
+ try {
857
+ const res = await f(urlObj.href);
858
+ const data = await res.text();
859
+ const [path, vm] = await Promise.all([
860
+ importNodeModule('path'),
861
+ importNodeModule('vm'),
862
+ ]);
863
+ const scriptContext = { exports: {}, module: { exports: {} } };
864
+ const urlDirname = urlObj.pathname
865
+ .split('/')
866
+ .slice(0, -1)
867
+ .join('/');
868
+ const filename = path.basename(urlObj.pathname);
869
+ const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, {
870
+ filename,
871
+ importModuleDynamically:
872
+ //@ts-ignore
873
+ vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ??
874
+ importNodeModule,
875
+ });
876
+ script.runInThisContext()(scriptContext.exports, scriptContext.module, eval('require'), urlDirname, filename);
877
+ const exportedInterface = scriptContext.module.exports || scriptContext.exports;
878
+ if (attrs && exportedInterface && attrs['globalName']) {
879
+ const container = exportedInterface[attrs['globalName']] || exportedInterface;
880
+ cb(undefined, container);
881
+ return;
882
+ }
883
+ cb(undefined, exportedInterface);
884
+ }
885
+ catch (e) {
886
+ cb(e instanceof Error
887
+ ? e
888
+ : new Error(`Script execution error: ${e}`));
889
+ }
890
+ };
891
+ getFetch()
892
+ .then(async (f) => {
893
+ if (attrs?.['type'] === 'esm' || attrs?.['type'] === 'module') {
894
+ return loadModule(urlObj.href, {
895
+ fetch: f,
896
+ vm: await importNodeModule('vm'),
897
+ })
898
+ .then(async (module) => {
899
+ await module.evaluate();
900
+ cb(undefined, module.namespace);
901
+ })
902
+ .catch((e) => {
903
+ cb(e instanceof Error
904
+ ? e
905
+ : new Error(`Script execution error: ${e}`));
906
+ });
907
+ }
908
+ handleScriptFetch(f, urlObj);
909
+ })
910
+ .catch((err) => {
911
+ cb(err);
912
+ });
913
+ }
914
+ : (url, cb, attrs, loaderHook) => {
915
+ cb(new Error('createScriptNode is disabled in non-Node.js environment'));
916
+ };
917
+ const loadScriptNode = typeof ENV_TARGET === 'undefined' || ENV_TARGET !== 'web'
918
+ ? (url, info) => {
919
+ return new Promise((resolve, reject) => {
920
+ createScriptNode(url, (error, scriptContext) => {
921
+ if (error) {
922
+ reject(error);
923
+ }
924
+ else {
925
+ const remoteEntryKey = info?.attrs?.['globalName'] ||
926
+ `__FEDERATION_${info?.attrs?.['name']}:custom__`;
927
+ const entryExports = (globalThis[remoteEntryKey] =
928
+ scriptContext);
929
+ resolve(entryExports);
930
+ }
931
+ }, info.attrs, info.loaderHook);
932
+ });
933
+ }
934
+ : (url, info) => {
935
+ throw new Error('loadScriptNode is disabled in non-Node.js environment');
936
+ };
736
937
  const esmModuleCache = new Map();
737
938
  async function loadModule(url, options) {
738
939
  // Check cache to prevent infinite recursion in ESM loading
739
940
  if (esmModuleCache.has(url)) {
740
941
  return esmModuleCache.get(url);
741
942
  }
742
- const { fetch: fetch1, vm } = options;
743
- const response = await fetch1(url);
943
+ const { fetch, vm } = options;
944
+ const response = await fetch(url);
744
945
  const code = await response.text();
745
946
  const module = new vm.SourceTextModule(code, {
746
947
  // @ts-ignore
747
- importModuleDynamically: async (specifier, script)=>{
948
+ importModuleDynamically: async (specifier, script) => {
748
949
  const resolvedUrl = new URL(specifier, url).href;
749
950
  return loadModule(resolvedUrl, options);
750
- }
951
+ },
751
952
  });
752
953
  // Cache the module before linking to prevent cycles
753
954
  esmModuleCache.set(url, module);
754
- await module.link(async (specifier)=>{
955
+ await module.link(async (specifier) => {
755
956
  const resolvedUrl = new URL(specifier, url).href;
756
957
  const module = await loadModule(resolvedUrl, options);
757
958
  return module;
@@ -760,14 +961,15 @@ async function loadModule(url, options) {
760
961
  }
761
962
 
762
963
  function normalizeOptions(enableDefault, defaultOptions, key) {
763
- return function(options) {
964
+ return function (options) {
764
965
  if (options === false) {
765
966
  return false;
766
967
  }
767
968
  if (typeof options === 'undefined') {
768
969
  if (enableDefault) {
769
970
  return defaultOptions;
770
- } else {
971
+ }
972
+ else {
771
973
  return false;
772
974
  }
773
975
  }
@@ -775,15 +977,18 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
775
977
  return defaultOptions;
776
978
  }
777
979
  if (options && typeof options === 'object') {
778
- return _extends({}, defaultOptions, options);
980
+ return {
981
+ ...defaultOptions,
982
+ ...options,
983
+ };
779
984
  }
780
985
  throw new Error(`Unexpected type for \`${key}\`, expect boolean/undefined/object, got: ${typeof options}`);
781
986
  };
782
987
  }
783
988
 
784
- const createModuleFederationConfig = (options)=>{
989
+ const createModuleFederationConfig = (options) => {
785
990
  return options;
786
991
  };
787
992
 
788
- export { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink, createLogger, createModuleFederationConfig, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, inferAutoPublicPath, isBrowserEnv, isDebugMode, isManifestProvider, isReactNativeEnv, isRequiredVersion, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry, safeToString, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
993
+ export { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, assert, bindLoggerToCompiler, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createInfrastructureLogger, createLink, createLogger, createModuleFederationConfig, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getManifestFileName, getProcessEnv, getResourceUrl, inferAutoPublicPath, infrastructureLogger, isBrowserEnv, isDebugMode, isManifestProvider, isReactNativeEnv, isRequiredVersion, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry, safeToString, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
789
994
  //# sourceMappingURL=index.esm.js.map