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

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