@module-federation/runtime-core 0.0.0-next-20250707074728 → 0.0.0-next-20250708104625

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,5 +1,5 @@
1
1
  import { _ as _extends, a as _object_without_properties_loose } from './polyfills.esm.js';
2
- import { createLogger, isBrowserEnv, isReactNativeEnv, isDebugMode, composeKeyWithSeparator, loadScriptNode, loadScript, safeToString, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
2
+ import { createLogger, isBrowserEnv, isReactNativeEnv, isDebugMode, composeKeyWithSeparator, loadScriptNode, loadScript, createLink, createScript, safeToString, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
3
3
  export { loadScript, loadScriptNode } from '@module-federation/sdk';
4
4
  import { getShortErrorMsg, RUNTIME_008, runtimeDescMap, RUNTIME_001, RUNTIME_002, RUNTIME_007, RUNTIME_003, RUNTIME_005, RUNTIME_006, RUNTIME_004 } from '@module-federation/error-codes';
5
5
 
@@ -942,34 +942,6 @@ function getTargetSharedOptions(options) {
942
942
  return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
943
943
  }
944
944
 
945
- const ShareUtils = {
946
- getRegisteredShare,
947
- getGlobalShareScope
948
- };
949
- const GlobalUtils = {
950
- Global,
951
- nativeGlobal,
952
- resetFederationGlobalInfo,
953
- setGlobalFederationInstance,
954
- getGlobalFederationConstructor,
955
- setGlobalFederationConstructor,
956
- getInfoWithoutType,
957
- getGlobalSnapshot,
958
- getTargetSnapshotInfoByModuleInfo,
959
- getGlobalSnapshotInfoByModuleInfo,
960
- setGlobalSnapshotInfoByModuleInfo,
961
- addGlobalSnapshot,
962
- getRemoteEntryExports,
963
- registerGlobalPlugins,
964
- getGlobalHostPlugins,
965
- getPreloaded,
966
- setPreloaded
967
- };
968
- var helpers = {
969
- global: GlobalUtils,
970
- share: ShareUtils
971
- };
972
-
973
945
  function getBuilderId() {
974
946
  //@ts-ignore
975
947
  return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' ? FEDERATION_BUILD_IDENTIFIER : '';
@@ -1039,8 +1011,16 @@ function matchRemote(remotes, nameOrAlias) {
1039
1011
  return;
1040
1012
  }
1041
1013
 
1042
- function registerPlugins(plugins, hookInstances) {
1014
+ function registerPlugins(plugins, instance) {
1043
1015
  const globalPlugins = getGlobalHostPlugins();
1016
+ const hookInstances = [
1017
+ instance.hooks,
1018
+ instance.remoteHandler.hooks,
1019
+ instance.sharedHandler.hooks,
1020
+ instance.snapshotHandler.hooks,
1021
+ instance.loaderHook,
1022
+ instance.bridgeHook
1023
+ ];
1044
1024
  // Incorporate global plugins
1045
1025
  if (globalPlugins.length > 0) {
1046
1026
  globalPlugins.forEach((plugin)=>{
@@ -1052,7 +1032,7 @@ function registerPlugins(plugins, hookInstances) {
1052
1032
  if (plugins && plugins.length > 0) {
1053
1033
  plugins.forEach((plugin)=>{
1054
1034
  hookInstances.forEach((hookInstance)=>{
1055
- hookInstance.applyPlugin(plugin);
1035
+ hookInstance.applyPlugin(plugin, instance);
1056
1036
  });
1057
1037
  });
1058
1038
  }
@@ -1239,6 +1219,202 @@ function getRemoteInfo(remote) {
1239
1219
  });
1240
1220
  }
1241
1221
 
1222
+ function defaultPreloadArgs(preloadConfig) {
1223
+ return _extends({
1224
+ resourceCategory: 'sync',
1225
+ share: true,
1226
+ depsRemote: true,
1227
+ prefetchInterface: false
1228
+ }, preloadConfig);
1229
+ }
1230
+ function formatPreloadArgs(remotes, preloadArgs) {
1231
+ return preloadArgs.map((args)=>{
1232
+ const remoteInfo = matchRemote(remotes, args.nameOrAlias);
1233
+ assert(remoteInfo, `Unable to preload ${args.nameOrAlias} as it is not included in ${!remoteInfo && safeToString({
1234
+ remoteInfo,
1235
+ remotes
1236
+ })}`);
1237
+ return {
1238
+ remote: remoteInfo,
1239
+ preloadConfig: defaultPreloadArgs(args)
1240
+ };
1241
+ });
1242
+ }
1243
+ function normalizePreloadExposes(exposes) {
1244
+ if (!exposes) {
1245
+ return [];
1246
+ }
1247
+ return exposes.map((expose)=>{
1248
+ if (expose === '.') {
1249
+ return expose;
1250
+ }
1251
+ if (expose.startsWith('./')) {
1252
+ return expose.replace('./', '');
1253
+ }
1254
+ return expose;
1255
+ });
1256
+ }
1257
+ function preloadAssets(remoteInfo, host, assets, // It is used to distinguish preload from load remote parallel loading
1258
+ useLinkPreload = true) {
1259
+ const { cssAssets, jsAssetsWithoutEntry, entryAssets } = assets;
1260
+ if (host.options.inBrowser) {
1261
+ entryAssets.forEach((asset)=>{
1262
+ const { moduleInfo } = asset;
1263
+ const module = host.moduleCache.get(remoteInfo.name);
1264
+ if (module) {
1265
+ getRemoteEntry({
1266
+ origin: host,
1267
+ remoteInfo: moduleInfo,
1268
+ remoteEntryExports: module.remoteEntryExports
1269
+ });
1270
+ } else {
1271
+ getRemoteEntry({
1272
+ origin: host,
1273
+ remoteInfo: moduleInfo,
1274
+ remoteEntryExports: undefined
1275
+ });
1276
+ }
1277
+ });
1278
+ if (useLinkPreload) {
1279
+ const defaultAttrs = {
1280
+ rel: 'preload',
1281
+ as: 'style'
1282
+ };
1283
+ cssAssets.forEach((cssUrl)=>{
1284
+ const { link: cssEl, needAttach } = createLink({
1285
+ url: cssUrl,
1286
+ cb: ()=>{
1287
+ // noop
1288
+ },
1289
+ attrs: defaultAttrs,
1290
+ createLinkHook: (url, attrs)=>{
1291
+ const res = host.loaderHook.lifecycle.createLink.emit({
1292
+ url,
1293
+ attrs
1294
+ });
1295
+ if (res instanceof HTMLLinkElement) {
1296
+ return res;
1297
+ }
1298
+ return;
1299
+ }
1300
+ });
1301
+ needAttach && document.head.appendChild(cssEl);
1302
+ });
1303
+ } else {
1304
+ const defaultAttrs = {
1305
+ rel: 'stylesheet',
1306
+ type: 'text/css'
1307
+ };
1308
+ cssAssets.forEach((cssUrl)=>{
1309
+ const { link: cssEl, needAttach } = createLink({
1310
+ url: cssUrl,
1311
+ cb: ()=>{
1312
+ // noop
1313
+ },
1314
+ attrs: defaultAttrs,
1315
+ createLinkHook: (url, attrs)=>{
1316
+ const res = host.loaderHook.lifecycle.createLink.emit({
1317
+ url,
1318
+ attrs
1319
+ });
1320
+ if (res instanceof HTMLLinkElement) {
1321
+ return res;
1322
+ }
1323
+ return;
1324
+ },
1325
+ needDeleteLink: false
1326
+ });
1327
+ needAttach && document.head.appendChild(cssEl);
1328
+ });
1329
+ }
1330
+ if (useLinkPreload) {
1331
+ const defaultAttrs = {
1332
+ rel: 'preload',
1333
+ as: 'script'
1334
+ };
1335
+ jsAssetsWithoutEntry.forEach((jsUrl)=>{
1336
+ const { link: linkEl, needAttach } = createLink({
1337
+ url: jsUrl,
1338
+ cb: ()=>{
1339
+ // noop
1340
+ },
1341
+ attrs: defaultAttrs,
1342
+ createLinkHook: (url, attrs)=>{
1343
+ const res = host.loaderHook.lifecycle.createLink.emit({
1344
+ url,
1345
+ attrs
1346
+ });
1347
+ if (res instanceof HTMLLinkElement) {
1348
+ return res;
1349
+ }
1350
+ return;
1351
+ }
1352
+ });
1353
+ needAttach && document.head.appendChild(linkEl);
1354
+ });
1355
+ } else {
1356
+ const defaultAttrs = {
1357
+ fetchpriority: 'high',
1358
+ type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
1359
+ };
1360
+ jsAssetsWithoutEntry.forEach((jsUrl)=>{
1361
+ const { script: scriptEl, needAttach } = createScript({
1362
+ url: jsUrl,
1363
+ cb: ()=>{
1364
+ // noop
1365
+ },
1366
+ attrs: defaultAttrs,
1367
+ createScriptHook: (url, attrs)=>{
1368
+ const res = host.loaderHook.lifecycle.createScript.emit({
1369
+ url,
1370
+ attrs
1371
+ });
1372
+ if (res instanceof HTMLScriptElement) {
1373
+ return res;
1374
+ }
1375
+ return;
1376
+ },
1377
+ needDeleteScript: true
1378
+ });
1379
+ needAttach && document.head.appendChild(scriptEl);
1380
+ });
1381
+ }
1382
+ }
1383
+ }
1384
+
1385
+ const ShareUtils = {
1386
+ getRegisteredShare,
1387
+ getGlobalShareScope
1388
+ };
1389
+ const GlobalUtils = {
1390
+ Global,
1391
+ nativeGlobal,
1392
+ resetFederationGlobalInfo,
1393
+ setGlobalFederationInstance,
1394
+ getGlobalFederationConstructor,
1395
+ setGlobalFederationConstructor,
1396
+ getInfoWithoutType,
1397
+ getGlobalSnapshot,
1398
+ getTargetSnapshotInfoByModuleInfo,
1399
+ getGlobalSnapshotInfoByModuleInfo,
1400
+ setGlobalSnapshotInfoByModuleInfo,
1401
+ addGlobalSnapshot,
1402
+ getRemoteEntryExports,
1403
+ registerGlobalPlugins,
1404
+ getGlobalHostPlugins,
1405
+ getPreloaded,
1406
+ setPreloaded
1407
+ };
1408
+ var helpers = {
1409
+ global: GlobalUtils,
1410
+ share: ShareUtils,
1411
+ utils: {
1412
+ matchRemoteWithNameAndExpose,
1413
+ preloadAssets,
1414
+ getRemoteInfo
1415
+ }
1416
+ };
1417
+
1242
1418
  let Module = class Module {
1243
1419
  async getEntry() {
1244
1420
  if (this.remoteEntryExports) {
@@ -1519,13 +1695,14 @@ class AsyncWaterfallHook extends SyncHook {
1519
1695
  }
1520
1696
 
1521
1697
  class PluginSystem {
1522
- applyPlugin(plugin) {
1698
+ applyPlugin(plugin, instance) {
1523
1699
  assert(isPlainObject(plugin), 'Plugin configuration is invalid.');
1524
1700
  // The plugin's name is mandatory and must be unique
1525
1701
  const pluginName = plugin.name;
1526
1702
  assert(pluginName, 'A name must be provided by the plugin.');
1527
1703
  if (!this.registerPlugins[pluginName]) {
1528
1704
  this.registerPlugins[pluginName] = plugin;
1705
+ plugin.apply == null ? void 0 : plugin.apply.call(plugin, instance);
1529
1706
  Object.keys(this.lifecycle).forEach((key)=>{
1530
1707
  const pluginLife = plugin[key];
1531
1708
  if (pluginLife) {
@@ -1544,17 +1721,6 @@ class PluginSystem {
1544
1721
  }
1545
1722
  });
1546
1723
  }
1547
- // eslint-disable-next-line @typescript-eslint/no-shadow
1548
- inherit({ lifecycle, registerPlugins }) {
1549
- Object.keys(lifecycle).forEach((hookName)=>{
1550
- assert(!this.lifecycle[hookName], `The hook "${hookName}" has a conflict and cannot be inherited.`);
1551
- this.lifecycle[hookName] = lifecycle[hookName];
1552
- });
1553
- Object.keys(registerPlugins).forEach((pluginName)=>{
1554
- assert(!this.registerPlugins[pluginName], `The plugin "${pluginName}" has a conflict and cannot be inherited.`);
1555
- this.applyPlugin(registerPlugins[pluginName]);
1556
- });
1557
- }
1558
1724
  constructor(lifecycle){
1559
1725
  this.registerPlugins = {};
1560
1726
  this.lifecycle = lifecycle;
@@ -1562,169 +1728,6 @@ class PluginSystem {
1562
1728
  }
1563
1729
  }
1564
1730
 
1565
- function defaultPreloadArgs(preloadConfig) {
1566
- return _extends({
1567
- resourceCategory: 'sync',
1568
- share: true,
1569
- depsRemote: true,
1570
- prefetchInterface: false
1571
- }, preloadConfig);
1572
- }
1573
- function formatPreloadArgs(remotes, preloadArgs) {
1574
- return preloadArgs.map((args)=>{
1575
- const remoteInfo = matchRemote(remotes, args.nameOrAlias);
1576
- assert(remoteInfo, `Unable to preload ${args.nameOrAlias} as it is not included in ${!remoteInfo && safeToString({
1577
- remoteInfo,
1578
- remotes
1579
- })}`);
1580
- return {
1581
- remote: remoteInfo,
1582
- preloadConfig: defaultPreloadArgs(args)
1583
- };
1584
- });
1585
- }
1586
- function normalizePreloadExposes(exposes) {
1587
- if (!exposes) {
1588
- return [];
1589
- }
1590
- return exposes.map((expose)=>{
1591
- if (expose === '.') {
1592
- return expose;
1593
- }
1594
- if (expose.startsWith('./')) {
1595
- return expose.replace('./', '');
1596
- }
1597
- return expose;
1598
- });
1599
- }
1600
- function preloadAssets(remoteInfo, host, assets, // It is used to distinguish preload from load remote parallel loading
1601
- useLinkPreload = true) {
1602
- const { cssAssets, jsAssetsWithoutEntry, entryAssets } = assets;
1603
- if (host.options.inBrowser) {
1604
- entryAssets.forEach((asset)=>{
1605
- const { moduleInfo } = asset;
1606
- const module = host.moduleCache.get(remoteInfo.name);
1607
- if (module) {
1608
- getRemoteEntry({
1609
- origin: host,
1610
- remoteInfo: moduleInfo,
1611
- remoteEntryExports: module.remoteEntryExports
1612
- });
1613
- } else {
1614
- getRemoteEntry({
1615
- origin: host,
1616
- remoteInfo: moduleInfo,
1617
- remoteEntryExports: undefined
1618
- });
1619
- }
1620
- });
1621
- if (useLinkPreload) {
1622
- const defaultAttrs = {
1623
- rel: 'preload',
1624
- as: 'style'
1625
- };
1626
- cssAssets.forEach((cssUrl)=>{
1627
- const { link: cssEl, needAttach } = createLink({
1628
- url: cssUrl,
1629
- cb: ()=>{
1630
- // noop
1631
- },
1632
- attrs: defaultAttrs,
1633
- createLinkHook: (url, attrs)=>{
1634
- const res = host.loaderHook.lifecycle.createLink.emit({
1635
- url,
1636
- attrs
1637
- });
1638
- if (res instanceof HTMLLinkElement) {
1639
- return res;
1640
- }
1641
- return;
1642
- }
1643
- });
1644
- needAttach && document.head.appendChild(cssEl);
1645
- });
1646
- } else {
1647
- const defaultAttrs = {
1648
- rel: 'stylesheet',
1649
- type: 'text/css'
1650
- };
1651
- cssAssets.forEach((cssUrl)=>{
1652
- const { link: cssEl, needAttach } = createLink({
1653
- url: cssUrl,
1654
- cb: ()=>{
1655
- // noop
1656
- },
1657
- attrs: defaultAttrs,
1658
- createLinkHook: (url, attrs)=>{
1659
- const res = host.loaderHook.lifecycle.createLink.emit({
1660
- url,
1661
- attrs
1662
- });
1663
- if (res instanceof HTMLLinkElement) {
1664
- return res;
1665
- }
1666
- return;
1667
- },
1668
- needDeleteLink: false
1669
- });
1670
- needAttach && document.head.appendChild(cssEl);
1671
- });
1672
- }
1673
- if (useLinkPreload) {
1674
- const defaultAttrs = {
1675
- rel: 'preload',
1676
- as: 'script'
1677
- };
1678
- jsAssetsWithoutEntry.forEach((jsUrl)=>{
1679
- const { link: linkEl, needAttach } = createLink({
1680
- url: jsUrl,
1681
- cb: ()=>{
1682
- // noop
1683
- },
1684
- attrs: defaultAttrs,
1685
- createLinkHook: (url, attrs)=>{
1686
- const res = host.loaderHook.lifecycle.createLink.emit({
1687
- url,
1688
- attrs
1689
- });
1690
- if (res instanceof HTMLLinkElement) {
1691
- return res;
1692
- }
1693
- return;
1694
- }
1695
- });
1696
- needAttach && document.head.appendChild(linkEl);
1697
- });
1698
- } else {
1699
- const defaultAttrs = {
1700
- fetchpriority: 'high',
1701
- type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
1702
- };
1703
- jsAssetsWithoutEntry.forEach((jsUrl)=>{
1704
- const { script: scriptEl, needAttach } = createScript({
1705
- url: jsUrl,
1706
- cb: ()=>{
1707
- // noop
1708
- },
1709
- attrs: defaultAttrs,
1710
- createScriptHook: (url, attrs)=>{
1711
- const res = host.loaderHook.lifecycle.createScript.emit({
1712
- url,
1713
- attrs
1714
- });
1715
- if (res instanceof HTMLScriptElement) {
1716
- return res;
1717
- }
1718
- return;
1719
- },
1720
- needDeleteScript: true
1721
- });
1722
- needAttach && document.head.appendChild(scriptEl);
1723
- });
1724
- }
1725
- }
1726
- }
1727
-
1728
1731
  function assignRemoteInfo(remoteInfo, remoteSnapshot) {
1729
1732
  const remoteEntryInfo = getRemoteEntryInfoFromSnapshot(remoteSnapshot);
1730
1733
  if (!remoteEntryInfo.url) {
@@ -2917,7 +2920,7 @@ class RemoteHandler {
2917
2920
  }
2918
2921
 
2919
2922
  const USE_SNAPSHOT = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN === 'boolean' ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : true; // Default to true (use snapshot) when not explicitly defined
2920
- class ModuleFederation {
2923
+ class FederationHost {
2921
2924
  initOptions(userOptions) {
2922
2925
  this.registerPlugins(userOptions.plugins);
2923
2926
  const options = this.formatOptions(this.options, userOptions);
@@ -2994,14 +2997,7 @@ class ModuleFederation {
2994
2997
  return optionsRes;
2995
2998
  }
2996
2999
  registerPlugins(plugins) {
2997
- const pluginRes = registerPlugins(plugins, [
2998
- this.hooks,
2999
- this.remoteHandler.hooks,
3000
- this.sharedHandler.hooks,
3001
- this.snapshotHandler.hooks,
3002
- this.loaderHook,
3003
- this.bridgeHook
3004
- ]);
3000
+ const pluginRes = registerPlugins(plugins, this);
3005
3001
  // Merge plugin
3006
3002
  this.options.plugins = this.options.plugins.reduce((res, plugin)=>{
3007
3003
  if (!plugin) return res;
@@ -3014,11 +3010,6 @@ class ModuleFederation {
3014
3010
  registerRemotes(remotes, options) {
3015
3011
  return this.remoteHandler.registerRemotes(remotes, options);
3016
3012
  }
3017
- registerShared(shared) {
3018
- this.sharedHandler.registerShared(this.options, _extends({}, this.options, {
3019
- shared
3020
- }));
3021
- }
3022
3013
  constructor(userOptions){
3023
3014
  this.hooks = new PluginSystem({
3024
3015
  beforeInit: new SyncWaterfallHook('beforeInit'),
@@ -3077,4 +3068,4 @@ var index = /*#__PURE__*/Object.freeze({
3077
3068
  __proto__: null
3078
3069
  });
3079
3070
 
3080
- export { CurrentGlobal, Global, Module, ModuleFederation, addGlobalSnapshot, assert, getGlobalFederationConstructor, getGlobalSnapshot, getInfoWithoutType, getRegisteredShare, getRemoteEntry, getRemoteInfo, helpers, isStaticResourcesEqual, matchRemoteWithNameAndExpose, registerGlobalPlugins, resetFederationGlobalInfo, safeWrapper, satisfy, setGlobalFederationConstructor, setGlobalFederationInstance, index as types };
3071
+ export { CurrentGlobal, FederationHost, Global, Module, addGlobalSnapshot, assert, getGlobalFederationConstructor, getGlobalSnapshot, getInfoWithoutType, getRegisteredShare, getRemoteEntry, getRemoteInfo, helpers, isStaticResourcesEqual, matchRemoteWithNameAndExpose, registerGlobalPlugins, resetFederationGlobalInfo, safeWrapper, satisfy, setGlobalFederationConstructor, setGlobalFederationInstance, index as types };
@@ -6,25 +6,25 @@ import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHoo
6
6
  import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler';
7
7
  import { SharedHandler } from './shared';
8
8
  import { RemoteHandler } from './remote';
9
- export declare class ModuleFederation {
9
+ export declare class FederationHost {
10
10
  options: Options;
11
11
  hooks: PluginSystem<{
12
12
  beforeInit: SyncWaterfallHook<{
13
13
  userOptions: UserOptions;
14
14
  options: Options;
15
- origin: ModuleFederation;
15
+ origin: FederationHost;
16
16
  shareInfo: ShareInfos;
17
17
  }>;
18
18
  init: SyncHook<[{
19
19
  options: Options;
20
- origin: ModuleFederation;
20
+ origin: FederationHost;
21
21
  }], void>;
22
22
  beforeInitContainer: AsyncWaterfallHook<{
23
23
  shareScope: ShareScopeMap[string];
24
24
  initScope: InitScope;
25
25
  remoteEntryInitOptions: RemoteEntryInitOptions;
26
26
  remoteInfo: RemoteInfo;
27
- origin: ModuleFederation;
27
+ origin: FederationHost;
28
28
  }>;
29
29
  initContainer: AsyncWaterfallHook<{
30
30
  shareScope: ShareScopeMap[string];
@@ -32,7 +32,7 @@ export declare class ModuleFederation {
32
32
  remoteEntryInitOptions: RemoteEntryInitOptions;
33
33
  remoteInfo: RemoteInfo;
34
34
  remoteEntryExports: RemoteEntryExports;
35
- origin: ModuleFederation;
35
+ origin: FederationHost;
36
36
  id: string;
37
37
  remoteSnapshot?: ModuleInfo;
38
38
  }>;
@@ -63,7 +63,7 @@ export declare class ModuleFederation {
63
63
  fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
64
64
  loadEntryError: AsyncHook<[{
65
65
  getRemoteEntry: typeof getRemoteEntry;
66
- origin: ModuleFederation;
66
+ origin: FederationHost;
67
67
  remoteInfo: RemoteInfo;
68
68
  remoteEntryExports?: RemoteEntryExports | undefined;
69
69
  globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
@@ -111,5 +111,4 @@ export declare class ModuleFederation {
111
111
  registerRemotes(remotes: Remote[], options?: {
112
112
  force?: boolean;
113
113
  }): void;
114
- registerShared(shared: UserOptions['shared']): void;
115
114
  }
@@ -1,13 +1,13 @@
1
- import { ModuleFederation } from './core';
1
+ import { FederationHost } from './core';
2
2
  import { RemoteEntryExports, GlobalShareScopeMap, Remote, Optional } from './type';
3
3
  import { GlobalModuleInfo, ModuleInfo } from '@module-federation/sdk';
4
- import { ModuleFederationRuntimePlugin } from './type/plugin';
4
+ import { FederationRuntimePlugin } from './type/plugin';
5
5
  export interface Federation {
6
- __GLOBAL_PLUGIN__: Array<ModuleFederationRuntimePlugin>;
6
+ __GLOBAL_PLUGIN__: Array<FederationRuntimePlugin>;
7
7
  __DEBUG_CONSTRUCTOR_VERSION__?: string;
8
8
  moduleInfo: GlobalModuleInfo;
9
- __DEBUG_CONSTRUCTOR__?: typeof ModuleFederation;
10
- __INSTANCES__: Array<ModuleFederation>;
9
+ __DEBUG_CONSTRUCTOR__?: typeof FederationHost;
10
+ __INSTANCES__: Array<FederationHost>;
11
11
  __SHARE__: GlobalShareScopeMap;
12
12
  __MANIFEST_LOADING__: Record<string, Promise<ModuleInfo>>;
13
13
  __PRELOADED_MAP__: Map<string, boolean>;
@@ -20,9 +20,9 @@ declare global {
20
20
  }
21
21
  export declare const globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
22
22
  export declare function resetFederationGlobalInfo(): void;
23
- export declare function setGlobalFederationInstance(FederationInstance: ModuleFederation): void;
24
- export declare function getGlobalFederationConstructor(): typeof ModuleFederation | undefined;
25
- export declare function setGlobalFederationConstructor(FederationConstructor: typeof ModuleFederation | undefined, isDebug?: boolean): void;
23
+ export declare function setGlobalFederationInstance(FederationInstance: FederationHost): void;
24
+ export declare function getGlobalFederationConstructor(): typeof FederationHost | undefined;
25
+ export declare function setGlobalFederationConstructor(FederationConstructor: typeof FederationHost | undefined, isDebug?: boolean): void;
26
26
  export declare function getInfoWithoutType<T extends object>(target: T, key: keyof T): {
27
27
  value: T[keyof T] | undefined;
28
28
  key: string;
@@ -36,7 +36,7 @@ export declare const getRemoteEntryExports: (name: string, globalName: string |
36
36
  remoteEntryKey: string;
37
37
  entryExports: RemoteEntryExports | undefined;
38
38
  };
39
- export declare const registerGlobalPlugins: (plugins: Array<ModuleFederationRuntimePlugin>) => void;
40
- export declare const getGlobalHostPlugins: () => Array<ModuleFederationRuntimePlugin>;
39
+ export declare const registerGlobalPlugins: (plugins: Array<FederationRuntimePlugin>) => void;
40
+ export declare const getGlobalHostPlugins: () => Array<FederationRuntimePlugin>;
41
41
  export declare const getPreloaded: (id: string) => boolean | undefined;
42
42
  export declare const setPreloaded: (id: string) => Map<string, boolean>;
@@ -1,5 +1,7 @@
1
1
  import { resetFederationGlobalInfo, 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 { getRemoteInfo, matchRemoteWithNameAndExpose } from './utils';
4
+ import { preloadAssets } from './utils/preload';
3
5
  interface IShareUtils {
4
6
  getRegisteredShare: typeof getRegisteredShare;
5
7
  getGlobalShareScope: typeof getGlobalShareScope;
@@ -26,6 +28,11 @@ interface IGlobalUtils {
26
28
  declare const _default: {
27
29
  global: IGlobalUtils;
28
30
  share: IShareUtils;
31
+ utils: {
32
+ matchRemoteWithNameAndExpose: typeof matchRemoteWithNameAndExpose;
33
+ preloadAssets: typeof preloadAssets;
34
+ getRemoteInfo: typeof getRemoteInfo;
35
+ };
29
36
  };
30
37
  export default _default;
31
38
  export type { IGlobalUtils, IShareUtils };
@@ -1,7 +1,7 @@
1
1
  import helpers, { type IGlobalUtils, type IShareUtils } from './helpers';
2
- export { ModuleFederation } from './core';
2
+ export { FederationHost } from './core';
3
3
  export { type Federation, CurrentGlobal, Global, getGlobalFederationConstructor, setGlobalFederationInstance, setGlobalFederationConstructor, resetFederationGlobalInfo, addGlobalSnapshot, getGlobalSnapshot, getInfoWithoutType, } from './global';
4
- export type { UserOptions, ModuleFederationRuntimePlugin } from './type';
4
+ export type { UserOptions, FederationRuntimePlugin } from './type';
5
5
  export { assert } from './utils/logger';
6
6
  export { registerGlobalPlugins } from './global';
7
7
  export { getRemoteEntry, getRemoteInfo, isStaticResourcesEqual, matchRemoteWithNameAndExpose, safeWrapper, } from './utils';
@@ -1,5 +1,5 @@
1
1
  import { ModuleInfo } from '@module-federation/sdk';
2
- import { ModuleFederation } from '../core';
2
+ import { FederationHost } from '../core';
3
3
  import { RemoteEntryExports, RemoteInfo } from '../type';
4
4
  export type ModuleOptions = ConstructorParameters<typeof Module>[0];
5
5
  declare class Module {
@@ -7,10 +7,10 @@ declare class Module {
7
7
  inited: boolean;
8
8
  remoteEntryExports?: RemoteEntryExports;
9
9
  lib: RemoteEntryExports | undefined;
10
- host: ModuleFederation;
10
+ host: FederationHost;
11
11
  constructor({ remoteInfo, host, }: {
12
12
  remoteInfo: RemoteInfo;
13
- host: ModuleFederation;
13
+ host: FederationHost;
14
14
  });
15
15
  getEntry(): Promise<RemoteEntryExports>;
16
16
  get(id: string, expose: string, options?: {
@@ -1,8 +1,8 @@
1
1
  import { GlobalModuleInfo, ModuleInfo } from '@module-federation/sdk';
2
- import { ModuleFederationRuntimePlugin, PreloadAssets, PreloadOptions, RemoteInfoOptionalVersion } from '../type';
3
- import { ModuleFederation } from '../core';
2
+ import { FederationRuntimePlugin, PreloadAssets, PreloadOptions, RemoteInfoOptionalVersion } from '../type';
3
+ import { FederationHost } from '../core';
4
4
  declare global {
5
5
  var __INIT_VMOK_DEPLOY_GLOBAL_DATA__: boolean | undefined;
6
6
  }
7
- export declare function generatePreloadAssets(origin: ModuleFederation, preloadOptions: PreloadOptions[number], remote: RemoteInfoOptionalVersion, globalSnapshot: GlobalModuleInfo, remoteSnapshot: ModuleInfo): PreloadAssets;
8
- export declare const generatePreloadAssetsPlugin: () => ModuleFederationRuntimePlugin;
7
+ export declare function generatePreloadAssets(origin: FederationHost, preloadOptions: PreloadOptions[number], remote: RemoteInfoOptionalVersion, globalSnapshot: GlobalModuleInfo, remoteSnapshot: ModuleInfo): PreloadAssets;
8
+ export declare const generatePreloadAssetsPlugin: () => FederationRuntimePlugin;