@module-federation/runtime 0.0.0-next-20241101093646 → 0.0.0-next-20241104024700

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/share.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var sdk = require('@module-federation/sdk');
4
3
  var polyfills = require('./polyfills.cjs.js');
4
+ var sdk = require('@module-federation/sdk');
5
5
 
6
6
  function getBuilderId() {
7
7
  //@ts-ignore
@@ -9,6 +9,8 @@ function getBuilderId() {
9
9
  }
10
10
 
11
11
  const LOG_CATEGORY = '[ Federation Runtime ]';
12
+ // FIXME: pre-bundle ?
13
+ const logger = sdk.createLogger(LOG_CATEGORY);
12
14
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
13
15
  function assert(condition, msg) {
14
16
  if (!condition) {
@@ -25,9 +27,9 @@ function error(msg) {
25
27
  function warn(msg) {
26
28
  if (msg instanceof Error) {
27
29
  msg.message = `${LOG_CATEGORY}: ${msg.message}`;
28
- console.warn(msg);
30
+ logger.warn(msg);
29
31
  } else {
30
- console.warn(`${LOG_CATEGORY}: ${msg}`);
32
+ logger.warn(msg);
31
33
  }
32
34
  }
33
35
 
@@ -87,25 +89,13 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
87
89
  }
88
90
  return defaultRemoteEntryInfo;
89
91
  }
90
- const processModuleAlias = (name, subPath)=>{
91
- // @host/ ./button -> @host/button
92
- let moduleName;
93
- if (name.endsWith('/')) {
94
- moduleName = name.slice(0, -1);
95
- } else {
96
- moduleName = name;
97
- }
98
- if (subPath.startsWith('.')) {
99
- subPath = subPath.slice(1);
100
- }
101
- moduleName = moduleName + subPath;
102
- return moduleName;
103
- };
104
92
 
105
93
  const nativeGlobal = (()=>{
106
94
  try {
107
- return new Function('return this')();
95
+ // get real window (incase of sandbox)
96
+ return document.defaultView;
108
97
  } catch (e) {
98
+ // node env
109
99
  return globalThis;
110
100
  }
111
101
  })();
@@ -189,7 +179,7 @@ function getGlobalFederationConstructor() {
189
179
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
190
180
  if (isDebug) {
191
181
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
192
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.11";
182
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.15";
193
183
  }
194
184
  }
195
185
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -289,214 +279,9 @@ const getGlobalHostPlugins = ()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__;
289
279
  const getPreloaded = (id)=>globalThis.__FEDERATION__.__PRELOADED_MAP__.get(id);
290
280
  const setPreloaded = (id)=>globalThis.__FEDERATION__.__PRELOADED_MAP__.set(id, true);
291
281
 
292
- function registerPlugins(plugins, hookInstances) {
293
- const globalPlugins = getGlobalHostPlugins();
294
- // Incorporate global plugins
295
- if (globalPlugins.length > 0) {
296
- globalPlugins.forEach((plugin)=>{
297
- if (plugins == null ? void 0 : plugins.find((item)=>item.name !== plugin.name)) {
298
- plugins.push(plugin);
299
- }
300
- });
301
- }
302
- if (plugins && plugins.length > 0) {
303
- plugins.forEach((plugin)=>{
304
- hookInstances.forEach((hookInstance)=>{
305
- hookInstance.applyPlugin(plugin);
306
- });
307
- });
308
- }
309
- return plugins;
310
- }
311
-
312
282
  const DEFAULT_SCOPE = 'default';
313
283
  const DEFAULT_REMOTE_TYPE = 'global';
314
284
 
315
- class SyncHook {
316
- on(fn) {
317
- if (typeof fn === 'function') {
318
- this.listeners.add(fn);
319
- }
320
- }
321
- once(fn) {
322
- // eslint-disable-next-line @typescript-eslint/no-this-alias
323
- const self = this;
324
- this.on(function wrapper(...args) {
325
- self.remove(wrapper);
326
- // eslint-disable-next-line prefer-spread
327
- return fn.apply(null, args);
328
- });
329
- }
330
- emit(...data) {
331
- let result;
332
- if (this.listeners.size > 0) {
333
- // eslint-disable-next-line prefer-spread
334
- this.listeners.forEach((fn)=>{
335
- result = fn(...data);
336
- });
337
- }
338
- return result;
339
- }
340
- remove(fn) {
341
- this.listeners.delete(fn);
342
- }
343
- removeAll() {
344
- this.listeners.clear();
345
- }
346
- constructor(type){
347
- this.type = '';
348
- this.listeners = new Set();
349
- if (type) {
350
- this.type = type;
351
- }
352
- }
353
- }
354
-
355
- class AsyncHook extends SyncHook {
356
- emit(...data) {
357
- let result;
358
- const ls = Array.from(this.listeners);
359
- if (ls.length > 0) {
360
- let i = 0;
361
- const call = (prev)=>{
362
- if (prev === false) {
363
- return false; // Abort process
364
- } else if (i < ls.length) {
365
- return Promise.resolve(ls[i++].apply(null, data)).then(call);
366
- } else {
367
- return prev;
368
- }
369
- };
370
- result = call();
371
- }
372
- return Promise.resolve(result);
373
- }
374
- }
375
-
376
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
377
- function checkReturnData(originalData, returnedData) {
378
- if (!isObject(returnedData)) {
379
- return false;
380
- }
381
- if (originalData !== returnedData) {
382
- // eslint-disable-next-line no-restricted-syntax
383
- for(const key in originalData){
384
- if (!(key in returnedData)) {
385
- return false;
386
- }
387
- }
388
- }
389
- return true;
390
- }
391
- class SyncWaterfallHook extends SyncHook {
392
- emit(data) {
393
- if (!isObject(data)) {
394
- error(`The data for the "${this.type}" hook should be an object.`);
395
- }
396
- for (const fn of this.listeners){
397
- try {
398
- const tempData = fn(data);
399
- if (checkReturnData(data, tempData)) {
400
- data = tempData;
401
- } else {
402
- this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
403
- break;
404
- }
405
- } catch (e) {
406
- warn(e);
407
- this.onerror(e);
408
- }
409
- }
410
- return data;
411
- }
412
- constructor(type){
413
- super(), this.onerror = error;
414
- this.type = type;
415
- }
416
- }
417
-
418
- class AsyncWaterfallHook extends SyncHook {
419
- emit(data) {
420
- if (!isObject(data)) {
421
- error(`The response data for the "${this.type}" hook must be an object.`);
422
- }
423
- const ls = Array.from(this.listeners);
424
- if (ls.length > 0) {
425
- let i = 0;
426
- const processError = (e)=>{
427
- warn(e);
428
- this.onerror(e);
429
- return data;
430
- };
431
- const call = (prevData)=>{
432
- if (checkReturnData(data, prevData)) {
433
- data = prevData;
434
- if (i < ls.length) {
435
- try {
436
- return Promise.resolve(ls[i++](data)).then(call, processError);
437
- } catch (e) {
438
- return processError(e);
439
- }
440
- }
441
- } else {
442
- this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
443
- }
444
- return data;
445
- };
446
- return Promise.resolve(call(data));
447
- }
448
- return Promise.resolve(data);
449
- }
450
- constructor(type){
451
- super(), this.onerror = error;
452
- this.type = type;
453
- }
454
- }
455
-
456
- class PluginSystem {
457
- applyPlugin(plugin) {
458
- assert(isPlainObject(plugin), 'Plugin configuration is invalid.');
459
- // The plugin's name is mandatory and must be unique
460
- const pluginName = plugin.name;
461
- assert(pluginName, 'A name must be provided by the plugin.');
462
- if (!this.registerPlugins[pluginName]) {
463
- this.registerPlugins[pluginName] = plugin;
464
- Object.keys(this.lifecycle).forEach((key)=>{
465
- const pluginLife = plugin[key];
466
- if (pluginLife) {
467
- this.lifecycle[key].on(pluginLife);
468
- }
469
- });
470
- }
471
- }
472
- removePlugin(pluginName) {
473
- assert(pluginName, 'A name is required.');
474
- const plugin = this.registerPlugins[pluginName];
475
- assert(plugin, `The plugin "${pluginName}" is not registered.`);
476
- Object.keys(plugin).forEach((key)=>{
477
- if (key !== 'name') {
478
- this.lifecycle[key].remove(plugin[key]);
479
- }
480
- });
481
- }
482
- // eslint-disable-next-line @typescript-eslint/no-shadow
483
- inherit({ lifecycle, registerPlugins }) {
484
- Object.keys(lifecycle).forEach((hookName)=>{
485
- assert(!this.lifecycle[hookName], `The hook "${hookName}" has a conflict and cannot be inherited.`);
486
- this.lifecycle[hookName] = lifecycle[hookName];
487
- });
488
- Object.keys(registerPlugins).forEach((pluginName)=>{
489
- assert(!this.registerPlugins[pluginName], `The plugin "${pluginName}" has a conflict and cannot be inherited.`);
490
- this.applyPlugin(registerPlugins[pluginName]);
491
- });
492
- }
493
- constructor(lifecycle){
494
- this.registerPlugins = {};
495
- this.lifecycle = lifecycle;
496
- this.lifecycleKeys = Object.keys(lifecycle);
497
- }
498
- }
499
-
500
285
  // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
501
286
  // those constants are based on https://www.rubydoc.info/gems/semantic_range/3.0.0/SemanticRange#BUILDIDENTIFIER-constant
502
287
  // Copyright (c)
@@ -1086,14 +871,9 @@ function getTargetSharedOptions(options) {
1086
871
  return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
1087
872
  }
1088
873
 
1089
- exports.AsyncHook = AsyncHook;
1090
- exports.AsyncWaterfallHook = AsyncWaterfallHook;
1091
874
  exports.DEFAULT_REMOTE_TYPE = DEFAULT_REMOTE_TYPE;
1092
875
  exports.DEFAULT_SCOPE = DEFAULT_SCOPE;
1093
876
  exports.Global = Global;
1094
- exports.PluginSystem = PluginSystem;
1095
- exports.SyncHook = SyncHook;
1096
- exports.SyncWaterfallHook = SyncWaterfallHook;
1097
877
  exports.addGlobalSnapshot = addGlobalSnapshot;
1098
878
  exports.addUniqueItem = addUniqueItem;
1099
879
  exports.arrayOptions = arrayOptions;
@@ -1116,14 +896,16 @@ exports.getRemoteEntryInfoFromSnapshot = getRemoteEntryInfoFromSnapshot;
1116
896
  exports.getTargetSharedOptions = getTargetSharedOptions;
1117
897
  exports.getTargetSnapshotInfoByModuleInfo = getTargetSnapshotInfoByModuleInfo;
1118
898
  exports.globalLoading = globalLoading;
899
+ exports.isObject = isObject;
900
+ exports.isPlainObject = isPlainObject;
1119
901
  exports.isPureRemoteEntry = isPureRemoteEntry;
1120
902
  exports.isRemoteInfoWithEntry = isRemoteInfoWithEntry;
903
+ exports.logger = logger;
1121
904
  exports.nativeGlobal = nativeGlobal;
1122
- exports.processModuleAlias = processModuleAlias;
1123
905
  exports.registerGlobalPlugins = registerGlobalPlugins;
1124
- exports.registerPlugins = registerPlugins;
1125
906
  exports.resetFederationGlobalInfo = resetFederationGlobalInfo;
1126
907
  exports.setGlobalFederationConstructor = setGlobalFederationConstructor;
1127
908
  exports.setGlobalFederationInstance = setGlobalFederationInstance;
1128
909
  exports.setGlobalSnapshotInfoByModuleInfo = setGlobalSnapshotInfoByModuleInfo;
1129
910
  exports.setPreloaded = setPreloaded;
911
+ exports.warn = warn;
package/dist/share.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { isBrowserEnv, isDebugMode } from '@module-federation/sdk';
2
- import { a as _object_without_properties_loose, _ as _extends } from './polyfills.esm.js';
1
+ import { _ as _object_without_properties_loose, a as _extends } from './polyfills.esm.js';
2
+ import { createLogger, isBrowserEnv, isDebugMode } from '@module-federation/sdk';
3
3
 
4
4
  function getBuilderId() {
5
5
  //@ts-ignore
@@ -7,6 +7,8 @@ function getBuilderId() {
7
7
  }
8
8
 
9
9
  const LOG_CATEGORY = '[ Federation Runtime ]';
10
+ // FIXME: pre-bundle ?
11
+ const logger = createLogger(LOG_CATEGORY);
10
12
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
11
13
  function assert(condition, msg) {
12
14
  if (!condition) {
@@ -23,9 +25,9 @@ function error(msg) {
23
25
  function warn(msg) {
24
26
  if (msg instanceof Error) {
25
27
  msg.message = `${LOG_CATEGORY}: ${msg.message}`;
26
- console.warn(msg);
28
+ logger.warn(msg);
27
29
  } else {
28
- console.warn(`${LOG_CATEGORY}: ${msg}`);
30
+ logger.warn(msg);
29
31
  }
30
32
  }
31
33
 
@@ -85,25 +87,13 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
85
87
  }
86
88
  return defaultRemoteEntryInfo;
87
89
  }
88
- const processModuleAlias = (name, subPath)=>{
89
- // @host/ ./button -> @host/button
90
- let moduleName;
91
- if (name.endsWith('/')) {
92
- moduleName = name.slice(0, -1);
93
- } else {
94
- moduleName = name;
95
- }
96
- if (subPath.startsWith('.')) {
97
- subPath = subPath.slice(1);
98
- }
99
- moduleName = moduleName + subPath;
100
- return moduleName;
101
- };
102
90
 
103
91
  const nativeGlobal = (()=>{
104
92
  try {
105
- return new Function('return this')();
93
+ // get real window (incase of sandbox)
94
+ return document.defaultView;
106
95
  } catch (e) {
96
+ // node env
107
97
  return globalThis;
108
98
  }
109
99
  })();
@@ -187,7 +177,7 @@ function getGlobalFederationConstructor() {
187
177
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
188
178
  if (isDebug) {
189
179
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
190
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.11";
180
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.15";
191
181
  }
192
182
  }
193
183
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -287,214 +277,9 @@ const getGlobalHostPlugins = ()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__;
287
277
  const getPreloaded = (id)=>globalThis.__FEDERATION__.__PRELOADED_MAP__.get(id);
288
278
  const setPreloaded = (id)=>globalThis.__FEDERATION__.__PRELOADED_MAP__.set(id, true);
289
279
 
290
- function registerPlugins(plugins, hookInstances) {
291
- const globalPlugins = getGlobalHostPlugins();
292
- // Incorporate global plugins
293
- if (globalPlugins.length > 0) {
294
- globalPlugins.forEach((plugin)=>{
295
- if (plugins == null ? void 0 : plugins.find((item)=>item.name !== plugin.name)) {
296
- plugins.push(plugin);
297
- }
298
- });
299
- }
300
- if (plugins && plugins.length > 0) {
301
- plugins.forEach((plugin)=>{
302
- hookInstances.forEach((hookInstance)=>{
303
- hookInstance.applyPlugin(plugin);
304
- });
305
- });
306
- }
307
- return plugins;
308
- }
309
-
310
280
  const DEFAULT_SCOPE = 'default';
311
281
  const DEFAULT_REMOTE_TYPE = 'global';
312
282
 
313
- class SyncHook {
314
- on(fn) {
315
- if (typeof fn === 'function') {
316
- this.listeners.add(fn);
317
- }
318
- }
319
- once(fn) {
320
- // eslint-disable-next-line @typescript-eslint/no-this-alias
321
- const self = this;
322
- this.on(function wrapper(...args) {
323
- self.remove(wrapper);
324
- // eslint-disable-next-line prefer-spread
325
- return fn.apply(null, args);
326
- });
327
- }
328
- emit(...data) {
329
- let result;
330
- if (this.listeners.size > 0) {
331
- // eslint-disable-next-line prefer-spread
332
- this.listeners.forEach((fn)=>{
333
- result = fn(...data);
334
- });
335
- }
336
- return result;
337
- }
338
- remove(fn) {
339
- this.listeners.delete(fn);
340
- }
341
- removeAll() {
342
- this.listeners.clear();
343
- }
344
- constructor(type){
345
- this.type = '';
346
- this.listeners = new Set();
347
- if (type) {
348
- this.type = type;
349
- }
350
- }
351
- }
352
-
353
- class AsyncHook extends SyncHook {
354
- emit(...data) {
355
- let result;
356
- const ls = Array.from(this.listeners);
357
- if (ls.length > 0) {
358
- let i = 0;
359
- const call = (prev)=>{
360
- if (prev === false) {
361
- return false; // Abort process
362
- } else if (i < ls.length) {
363
- return Promise.resolve(ls[i++].apply(null, data)).then(call);
364
- } else {
365
- return prev;
366
- }
367
- };
368
- result = call();
369
- }
370
- return Promise.resolve(result);
371
- }
372
- }
373
-
374
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
375
- function checkReturnData(originalData, returnedData) {
376
- if (!isObject(returnedData)) {
377
- return false;
378
- }
379
- if (originalData !== returnedData) {
380
- // eslint-disable-next-line no-restricted-syntax
381
- for(const key in originalData){
382
- if (!(key in returnedData)) {
383
- return false;
384
- }
385
- }
386
- }
387
- return true;
388
- }
389
- class SyncWaterfallHook extends SyncHook {
390
- emit(data) {
391
- if (!isObject(data)) {
392
- error(`The data for the "${this.type}" hook should be an object.`);
393
- }
394
- for (const fn of this.listeners){
395
- try {
396
- const tempData = fn(data);
397
- if (checkReturnData(data, tempData)) {
398
- data = tempData;
399
- } else {
400
- this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
401
- break;
402
- }
403
- } catch (e) {
404
- warn(e);
405
- this.onerror(e);
406
- }
407
- }
408
- return data;
409
- }
410
- constructor(type){
411
- super(), this.onerror = error;
412
- this.type = type;
413
- }
414
- }
415
-
416
- class AsyncWaterfallHook extends SyncHook {
417
- emit(data) {
418
- if (!isObject(data)) {
419
- error(`The response data for the "${this.type}" hook must be an object.`);
420
- }
421
- const ls = Array.from(this.listeners);
422
- if (ls.length > 0) {
423
- let i = 0;
424
- const processError = (e)=>{
425
- warn(e);
426
- this.onerror(e);
427
- return data;
428
- };
429
- const call = (prevData)=>{
430
- if (checkReturnData(data, prevData)) {
431
- data = prevData;
432
- if (i < ls.length) {
433
- try {
434
- return Promise.resolve(ls[i++](data)).then(call, processError);
435
- } catch (e) {
436
- return processError(e);
437
- }
438
- }
439
- } else {
440
- this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
441
- }
442
- return data;
443
- };
444
- return Promise.resolve(call(data));
445
- }
446
- return Promise.resolve(data);
447
- }
448
- constructor(type){
449
- super(), this.onerror = error;
450
- this.type = type;
451
- }
452
- }
453
-
454
- class PluginSystem {
455
- applyPlugin(plugin) {
456
- assert(isPlainObject(plugin), 'Plugin configuration is invalid.');
457
- // The plugin's name is mandatory and must be unique
458
- const pluginName = plugin.name;
459
- assert(pluginName, 'A name must be provided by the plugin.');
460
- if (!this.registerPlugins[pluginName]) {
461
- this.registerPlugins[pluginName] = plugin;
462
- Object.keys(this.lifecycle).forEach((key)=>{
463
- const pluginLife = plugin[key];
464
- if (pluginLife) {
465
- this.lifecycle[key].on(pluginLife);
466
- }
467
- });
468
- }
469
- }
470
- removePlugin(pluginName) {
471
- assert(pluginName, 'A name is required.');
472
- const plugin = this.registerPlugins[pluginName];
473
- assert(plugin, `The plugin "${pluginName}" is not registered.`);
474
- Object.keys(plugin).forEach((key)=>{
475
- if (key !== 'name') {
476
- this.lifecycle[key].remove(plugin[key]);
477
- }
478
- });
479
- }
480
- // eslint-disable-next-line @typescript-eslint/no-shadow
481
- inherit({ lifecycle, registerPlugins }) {
482
- Object.keys(lifecycle).forEach((hookName)=>{
483
- assert(!this.lifecycle[hookName], `The hook "${hookName}" has a conflict and cannot be inherited.`);
484
- this.lifecycle[hookName] = lifecycle[hookName];
485
- });
486
- Object.keys(registerPlugins).forEach((pluginName)=>{
487
- assert(!this.registerPlugins[pluginName], `The plugin "${pluginName}" has a conflict and cannot be inherited.`);
488
- this.applyPlugin(registerPlugins[pluginName]);
489
- });
490
- }
491
- constructor(lifecycle){
492
- this.registerPlugins = {};
493
- this.lifecycle = lifecycle;
494
- this.lifecycleKeys = Object.keys(lifecycle);
495
- }
496
- }
497
-
498
283
  // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
499
284
  // those constants are based on https://www.rubydoc.info/gems/semantic_range/3.0.0/SemanticRange#BUILDIDENTIFIER-constant
500
285
  // Copyright (c)
@@ -1084,4 +869,4 @@ function getTargetSharedOptions(options) {
1084
869
  return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
1085
870
  }
1086
871
 
1087
- export { AsyncHook as A, processModuleAlias as B, isRemoteInfoWithEntry as C, DEFAULT_REMOTE_TYPE as D, isPureRemoteEntry as E, getRemoteEntryInfoFromSnapshot as F, Global as G, error as H, arrayOptions as I, formatShareConfigs as J, getTargetSharedOptions as K, addUniqueItem as L, getBuilderId as M, PluginSystem as P, SyncHook as S, AsyncWaterfallHook as a, SyncWaterfallHook as b, getGlobalShareScope as c, getGlobalFederationInstance as d, getGlobalFederationConstructor as e, setGlobalFederationConstructor as f, getRegisteredShare as g, getInfoWithoutType as h, getGlobalSnapshot as i, getTargetSnapshotInfoByModuleInfo as j, getGlobalSnapshotInfoByModuleInfo as k, setGlobalSnapshotInfoByModuleInfo as l, addGlobalSnapshot as m, nativeGlobal as n, getRemoteEntryExports as o, registerGlobalPlugins as p, getGlobalHostPlugins as q, resetFederationGlobalInfo as r, setGlobalFederationInstance as s, getPreloaded as t, setPreloaded as u, registerPlugins as v, globalLoading as w, DEFAULT_SCOPE as x, assert as y, getFMId as z };
872
+ export { warn as A, isPlainObject as B, isRemoteInfoWithEntry as C, DEFAULT_REMOTE_TYPE as D, isPureRemoteEntry as E, getRemoteEntryInfoFromSnapshot as F, Global as G, arrayOptions as H, formatShareConfigs as I, getTargetSharedOptions as J, addUniqueItem as K, getBuilderId as L, getGlobalShareScope as a, getGlobalFederationInstance as b, getGlobalFederationConstructor as c, setGlobalFederationConstructor as d, getInfoWithoutType as e, getGlobalSnapshot as f, getRegisteredShare as g, getTargetSnapshotInfoByModuleInfo as h, getGlobalSnapshotInfoByModuleInfo as i, setGlobalSnapshotInfoByModuleInfo as j, addGlobalSnapshot as k, getRemoteEntryExports as l, registerGlobalPlugins as m, nativeGlobal as n, getGlobalHostPlugins as o, getPreloaded as p, setPreloaded as q, resetFederationGlobalInfo as r, setGlobalFederationInstance as s, globalLoading as t, DEFAULT_SCOPE as u, assert as v, logger as w, getFMId as x, isObject as y, error as z };
@@ -60,12 +60,11 @@ export declare class FederationHost {
60
60
  attrs?: Record<string, any>;
61
61
  }], void | HTMLLinkElement>;
62
62
  fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
63
- }>;
64
- bridgeHook: PluginSystem<{
65
- beforeBridgeRender: SyncHook<[Record<string, any>], any>;
66
- afterBridgeRender: SyncHook<[Record<string, any>], any>;
67
- beforeBridgeDestroy: SyncHook<[Record<string, any>], any>;
68
- afterBridgeDestroy: SyncHook<[Record<string, any>], any>;
63
+ getModuleFactory: AsyncHook<[{
64
+ remoteEntryExports: RemoteEntryExports;
65
+ expose: string;
66
+ moduleInfo: RemoteInfo;
67
+ }], Promise<(() => Promise<Module>) | undefined>>;
69
68
  }>;
70
69
  constructor(userOptions: UserOptions);
71
70
  initOptions(userOptions: UserOptions): Options;
@@ -72,12 +72,11 @@ export declare class FederationHost implements IndexModule.FederationHost {
72
72
  attrs?: Record<string, any>;
73
73
  }], void | HTMLLinkElement>;
74
74
  fetch: import("./utils/hooks").AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
75
- }>;
76
- get bridgeHook(): import("./utils/hooks").PluginSystem<{
77
- beforeBridgeRender: import("./utils/hooks").SyncHook<[Record<string, any>], any>;
78
- afterBridgeRender: import("./utils/hooks").SyncHook<[Record<string, any>], any>;
79
- beforeBridgeDestroy: import("./utils/hooks").SyncHook<[Record<string, any>], any>;
80
- afterBridgeDestroy: import("./utils/hooks").SyncHook<[Record<string, any>], any>;
75
+ getModuleFactory: import("./utils/hooks").AsyncHook<[{
76
+ remoteEntryExports: import("./type").RemoteEntryExports;
77
+ expose: string;
78
+ moduleInfo: import("./type").RemoteInfo;
79
+ }], Promise<(() => Promise<IndexModule.Module>) | undefined>>;
81
80
  }>;
82
81
  initOptions(...args: Parameters<IndexModule.FederationHost['initOptions']>): import("./type").Options;
83
82
  loadShare<T>(...args: Parameters<IndexModule.FederationHost['loadShare']>): Promise<false | (() => T | undefined)>;
@@ -1,7 +1,5 @@
1
1
  import { resetFederationGlobalInfo, getGlobalFederationInstance, setGlobalFederationInstance, getGlobalFederationConstructor, setGlobalFederationConstructor, getInfoWithoutType, getGlobalSnapshot, getTargetSnapshotInfoByModuleInfo, getGlobalSnapshotInfoByModuleInfo, setGlobalSnapshotInfoByModuleInfo, addGlobalSnapshot, getRemoteEntryExports, registerGlobalPlugins, getGlobalHostPlugins, getPreloaded, setPreloaded, Global } from './global';
2
2
  import { getRegisteredShare, getGlobalShareScope } from './utils/share';
3
- import * as pluginHelper from './utils/hooks';
4
- import { registerPlugins } from './utils';
5
3
  interface IShareUtils {
6
4
  getRegisteredShare: typeof getRegisteredShare;
7
5
  getGlobalShareScope: typeof getGlobalShareScope;
@@ -25,8 +23,6 @@ interface IGlobalUtils {
25
23
  getGlobalHostPlugins: typeof getGlobalHostPlugins;
26
24
  getPreloaded: typeof getPreloaded;
27
25
  setPreloaded: typeof setPreloaded;
28
- registerPlugins: typeof registerPlugins;
29
- pluginHelper: typeof pluginHelper;
30
26
  }
31
27
  declare const _default: {
32
28
  global: IGlobalUtils;
@@ -32,11 +32,6 @@ export declare class SnapshotHandler {
32
32
  remoteSnapshot: ModuleInfo;
33
33
  from: "global" | "manifest";
34
34
  }>;
35
- afterLoadSnapshot: AsyncWaterfallHook<{
36
- options: Options;
37
- moduleInfo: Remote;
38
- remoteSnapshot: ModuleInfo;
39
- }>;
40
35
  }>;
41
36
  loaderHook: FederationHost['loaderHook'];
42
37
  manifestLoading: Record<string, Promise<ModuleInfo>>;
@@ -4,7 +4,7 @@ export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
4
4
  export type PartialOptional<T, K extends keyof T> = Omit<T, K> & {
5
5
  [P in K]-?: T[P];
6
6
  };
7
- export interface RemoteInfoCommon {
7
+ interface RemoteInfoCommon {
8
8
  alias?: string;
9
9
  shareScope?: string;
10
10
  type?: RemoteEntryType;