@module-federation/runtime-core 0.0.0-next-20250703030214 → 0.0.0-next-20250703101410

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.
@@ -3015,6 +3015,11 @@ class ModuleFederation {
3015
3015
  registerRemotes(remotes, options) {
3016
3016
  return this.remoteHandler.registerRemotes(remotes, options);
3017
3017
  }
3018
+ registerShared(shared) {
3019
+ this.sharedHandler.registerShared(this.options, polyfills._extends({}, this.options, {
3020
+ shared
3021
+ }));
3022
+ }
3018
3023
  constructor(userOptions){
3019
3024
  this.hooks = new PluginSystem({
3020
3025
  beforeInit: new SyncWaterfallHook('beforeInit'),
package/dist/index.esm.js CHANGED
@@ -3014,6 +3014,11 @@ class ModuleFederation {
3014
3014
  registerRemotes(remotes, options) {
3015
3015
  return this.remoteHandler.registerRemotes(remotes, options);
3016
3016
  }
3017
+ registerShared(shared) {
3018
+ this.sharedHandler.registerShared(this.options, _extends({}, this.options, {
3019
+ shared
3020
+ }));
3021
+ }
3017
3022
  constructor(userOptions){
3018
3023
  this.hooks = new PluginSystem({
3019
3024
  beforeInit: new SyncWaterfallHook('beforeInit'),
@@ -111,4 +111,5 @@ export declare class ModuleFederation {
111
111
  registerRemotes(remotes: Remote[], options?: {
112
112
  force?: boolean;
113
113
  }): void;
114
+ registerShared(shared: UserOptions['shared']): void;
114
115
  }
@@ -1,9 +1,9 @@
1
1
  import { ModuleFederation } from './core';
2
2
  import { RemoteEntryExports, GlobalShareScopeMap, Remote, Optional } from './type';
3
3
  import { GlobalModuleInfo, ModuleInfo } from '@module-federation/sdk';
4
- import { FederationRuntimePlugin } from './type/plugin';
4
+ import { ModuleFederationRuntimePlugin } from './type/plugin';
5
5
  export interface Federation {
6
- __GLOBAL_PLUGIN__: Array<FederationRuntimePlugin>;
6
+ __GLOBAL_PLUGIN__: Array<ModuleFederationRuntimePlugin>;
7
7
  __DEBUG_CONSTRUCTOR_VERSION__?: string;
8
8
  moduleInfo: GlobalModuleInfo;
9
9
  __DEBUG_CONSTRUCTOR__?: typeof ModuleFederation;
@@ -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<FederationRuntimePlugin>) => void;
40
- export declare const getGlobalHostPlugins: () => Array<FederationRuntimePlugin>;
39
+ export declare const registerGlobalPlugins: (plugins: Array<ModuleFederationRuntimePlugin>) => void;
40
+ export declare const getGlobalHostPlugins: () => Array<ModuleFederationRuntimePlugin>;
41
41
  export declare const getPreloaded: (id: string) => boolean | undefined;
42
42
  export declare const setPreloaded: (id: string) => Map<string, boolean>;
@@ -1,7 +1,7 @@
1
1
  import helpers, { type IGlobalUtils, type IShareUtils } from './helpers';
2
2
  export { ModuleFederation } from './core';
3
3
  export { type Federation, CurrentGlobal, Global, getGlobalFederationConstructor, setGlobalFederationInstance, setGlobalFederationConstructor, resetFederationGlobalInfo, addGlobalSnapshot, getGlobalSnapshot, getInfoWithoutType, } from './global';
4
- export type { UserOptions, FederationRuntimePlugin } from './type';
4
+ export type { UserOptions, ModuleFederationRuntimePlugin } 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,8 +1,8 @@
1
1
  import { GlobalModuleInfo, ModuleInfo } from '@module-federation/sdk';
2
- import { FederationRuntimePlugin, PreloadAssets, PreloadOptions, RemoteInfoOptionalVersion } from '../type';
2
+ import { ModuleFederationRuntimePlugin, PreloadAssets, PreloadOptions, RemoteInfoOptionalVersion } from '../type';
3
3
  import { ModuleFederation } from '../core';
4
4
  declare global {
5
5
  var __INIT_VMOK_DEPLOY_GLOBAL_DATA__: boolean | undefined;
6
6
  }
7
7
  export declare function generatePreloadAssets(origin: ModuleFederation, preloadOptions: PreloadOptions[number], remote: RemoteInfoOptionalVersion, globalSnapshot: GlobalModuleInfo, remoteSnapshot: ModuleInfo): PreloadAssets;
8
- export declare const generatePreloadAssetsPlugin: () => FederationRuntimePlugin;
8
+ export declare const generatePreloadAssetsPlugin: () => ModuleFederationRuntimePlugin;
@@ -1,5 +1,5 @@
1
1
  import { ModuleInfo } from '@module-federation/sdk';
2
- import { FederationRuntimePlugin } from '../../type/plugin';
2
+ import { ModuleFederationRuntimePlugin } from '../../type/plugin';
3
3
  import { RemoteInfo } from '../../type';
4
4
  export declare function assignRemoteInfo(remoteInfo: RemoteInfo, remoteSnapshot: ModuleInfo): void;
5
- export declare function snapshotPlugin(): FederationRuntimePlugin;
5
+ export declare function snapshotPlugin(): ModuleFederationRuntimePlugin;
@@ -1,5 +1,5 @@
1
1
  import type { RemoteWithEntry, RemoteWithVersion, Module, RemoteEntryType } from '@module-federation/sdk';
2
- import { FederationRuntimePlugin } from './plugin';
2
+ import { ModuleFederationRuntimePlugin } from './plugin';
3
3
  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];
@@ -88,7 +88,7 @@ export interface Options {
88
88
  version?: string;
89
89
  remotes: Array<Remote>;
90
90
  shared: ShareInfos;
91
- plugins: Array<FederationRuntimePlugin>;
91
+ plugins: Array<ModuleFederationRuntimePlugin>;
92
92
  inBrowser: boolean;
93
93
  shareStrategy?: ShareStrategy;
94
94
  }
@@ -27,7 +27,7 @@ type RemoteLifeCycle = RemoteHandler['hooks']['lifecycle'];
27
27
  type RemoteLifeCycleCyclePartial = Partial<{
28
28
  [k in keyof RemoteLifeCycle]: Parameters<RemoteLifeCycle[k]['on']>[0];
29
29
  }>;
30
- export type FederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & ModuleBridgeLifeCycleCyclePartial & {
30
+ export type ModuleFederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & ModuleBridgeLifeCycleCyclePartial & {
31
31
  name: string;
32
32
  version?: string;
33
33
  };
@@ -1,4 +1,4 @@
1
1
  import { ModuleFederation } from '../core';
2
2
  import { UserOptions } from '../type';
3
3
  import { Module } from '../module';
4
- export declare function registerPlugins(plugins: UserOptions['plugins'], hookInstances: Array<ModuleFederation['hooks'] | ModuleFederation['snapshotHandler']['hooks'] | ModuleFederation['sharedHandler']['hooks'] | ModuleFederation['remoteHandler']['hooks'] | Module['host']['loaderHook'] | Module['host']['bridgeHook']>): import("../type").FederationRuntimePlugin[] | undefined;
4
+ export declare function registerPlugins(plugins: UserOptions['plugins'], hookInstances: Array<ModuleFederation['hooks'] | ModuleFederation['snapshotHandler']['hooks'] | ModuleFederation['sharedHandler']['hooks'] | ModuleFederation['remoteHandler']['hooks'] | Module['host']['loaderHook'] | Module['host']['bridgeHook']>): import("../type").ModuleFederationRuntimePlugin[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime-core",
3
- "version": "0.0.0-next-20250703030214",
3
+ "version": "0.0.0-next-20250703101410",
4
4
  "type": "module",
5
5
  "author": "zhouxiao <codingzx@gmail.com>",
6
6
  "main": "./dist/index.cjs.cjs",
@@ -52,7 +52,7 @@
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
- "@module-federation/sdk": "0.0.0-next-20250703030214",
56
- "@module-federation/error-codes": "0.0.0-next-20250703030214"
55
+ "@module-federation/sdk": "0.0.0-next-20250703101410",
56
+ "@module-federation/error-codes": "0.0.0-next-20250703101410"
57
57
  }
58
58
  }