import { CreateScriptHookReturn, GlobalModuleInfo, Manifest, Module, ModuleInfo, RemoteEntryType, RemoteWithEntry, RemoteWithVersion, TreeShakingStatus } from "@module-federation/sdk"; //#region ../runtime-core/dist/utils/hooks/syncHook.d.ts //#region src/utils/hooks/syncHook.d.ts type Callback = (...args: ArgsType) => K; type ArgsType = T extends Array ? T : Array; declare class SyncHook { type: string; listeners: Set>; constructor(type?: string); on(fn: Callback): void; once(fn: Callback): void; emit(...data: ArgsType): void | K | Promise; remove(fn: Callback): void; removeAll(): void; } //#endregion //#endregion //#region ../runtime-core/dist/utils/hooks/asyncHook.d.ts //#region src/utils/hooks/asyncHook.d.ts type CallbackReturnType$1 = void | false | Promise; declare class AsyncHook extends SyncHook { emit(...data: ArgsType): Promise; } //#endregion //#endregion //#region ../runtime-core/dist/utils/hooks/syncWaterfallHook.d.ts //#region src/utils/hooks/syncWaterfallHook.d.ts declare class SyncWaterfallHook> extends SyncHook<[T], T> { onerror: (errMsg: string | Error | unknown) => void; constructor(type: string); emit(data: T): T; } //#endregion //#endregion //#region ../runtime-core/dist/utils/hooks/asyncWaterfallHooks.d.ts //#region src/utils/hooks/asyncWaterfallHooks.d.ts type CallbackReturnType = T | Promise; declare class AsyncWaterfallHook> extends SyncHook<[T], CallbackReturnType> { onerror: (errMsg: string | Error | unknown) => void; constructor(type: string); emit(data: T): Promise; } //#endregion //#endregion //#region ../runtime-core/dist/utils/hooks/pluginSystem.d.ts //#region src/utils/hooks/pluginSystem.d.ts type Plugin> = { [k in keyof T]?: Parameters[0] } & { name: string; version?: string; apply?: (instance: ModuleFederation) => void; }; declare class PluginSystem> { lifecycle: T; lifecycleKeys: Array; registerPlugins: Record>; constructor(lifecycle: T); applyPlugin(plugin: Plugin, instance: ModuleFederation): void; removePlugin(pluginName: string): void; } //#endregion //#endregion //#region ../runtime-core/dist/type/config.d.ts //#region src/type/config.d.ts type Optional = Omit & Partial; interface RemoteInfoCommon { alias?: string; shareScope?: string | string[]; type?: RemoteEntryType; entryGlobalName?: string; } type Remote = (RemoteWithEntry | RemoteWithVersion) & RemoteInfoCommon; interface RemoteInfo { alias?: string; name: string; version?: string; buildVersion?: string; entry: string; type: RemoteEntryType; entryGlobalName: string; shareScope: string | string[]; } interface SharedConfig { singleton?: boolean; requiredVersion: false | string; eager?: boolean; strictVersion?: boolean; layer?: string | null; } type TreeShakingArgs = { usedExports?: string[]; get?: SharedGetter; lib?: () => Module; status?: TreeShakingStatus; mode?: 'server-calc' | 'runtime-infer'; loading?: null | Promise; loaded?: boolean; useIn?: Array; }; type SharedBaseArgs = { version?: string; shareConfig?: SharedConfig; scope?: string | Array; deps?: Array; strategy?: 'version-first' | 'loaded-first'; loaded?: boolean; treeShaking?: TreeShakingArgs; }; type SharedGetter = (() => () => Module) | (() => Promise<() => Module>); type ShareArgs = (SharedBaseArgs & { get: SharedGetter; }) | (SharedBaseArgs & { lib: () => Module; }) | SharedBaseArgs; type ShareStrategy = 'version-first' | 'loaded-first'; type Shared = { version: string; get: SharedGetter; shareConfig: SharedConfig; scope: Array; useIn: Array; from: string; deps: Array; lib?: () => Module; loaded?: boolean; loading?: null | Promise; eager?: boolean; /** * @deprecated set in initOptions.shareStrategy instead */ strategy: ShareStrategy; treeShaking?: TreeShakingArgs; }; type ShareScopeMap = { [scope: string]: { [pkgName: string]: { [sharedVersion: string]: Shared; }; }; }; type GlobalShareScopeMap = { [instanceName: string]: ShareScopeMap; }; type ShareInfos = { [pkgName: string]: Shared[]; }; interface Options { id?: string; name: string; version?: string; remotes: Array; shared: ShareInfos; plugins: Array; inBrowser: boolean; shareStrategy?: ShareStrategy; } type UserOptions = Omit, 'shared' | 'inBrowser'> & { shared?: { [pkgName: string]: ShareArgs | ShareArgs[]; }; }; type RemoteEntryInitOptions = { version: string; shareScopeMap?: ShareScopeMap; shareScopeKeys: string | string[]; }; type InitTokens = Record>; type InitScope = InitTokens[]; type CallFrom = 'build' | 'runtime'; type RemoteEntryExports = { get: (id: string) => () => Promise; init: (shareScope: ShareScopeMap[string], initScope?: InitScope, remoteEntryInitOPtions?: RemoteEntryInitOptions) => void | Promise; }; //#endregion //#endregion //#region ../runtime-core/dist/type/preload.d.ts //#region src/type/preload.d.ts type depsPreloadArg = Omit; interface PreloadRemoteArgs { nameOrAlias: string; exposes?: Array; resourceCategory?: 'all' | 'sync'; share?: boolean; depsRemote?: boolean | Array; filter?: (assetUrl: string) => boolean; prefetchInterface?: boolean; } type PreloadConfig = PreloadRemoteArgs; type PreloadOptions = Array<{ remote: Remote; preloadConfig: PreloadConfig; }>; type EntryAssets = { name: string; url: string; moduleInfo: RemoteInfo; }; interface PreloadAssets { cssAssets: Array; jsAssetsWithoutEntry: Array; entryAssets: Array; } //#endregion //#endregion //#region ../runtime-core/dist/remote/index.d.ts //#region src/remote/index.d.ts interface LoadRemoteMatch { id: string; pkgNameOrAlias: string; expose: string; remote: Remote; options: Options; origin: ModuleFederation; remoteInfo: RemoteInfo; remoteSnapshot?: ModuleInfo; } declare class RemoteHandler { host: ModuleFederation; idToRemoteMap: Record; hooks: PluginSystem<{ beforeRegisterRemote: SyncWaterfallHook<{ remote: Remote; origin: ModuleFederation; }>; registerRemote: SyncWaterfallHook<{ remote: Remote; origin: ModuleFederation; }>; beforeRequest: AsyncWaterfallHook<{ id: string; options: Options; origin: ModuleFederation; }>; onLoad: AsyncHook<[{ id: string; expose: string; pkgNameOrAlias: string; remote: Remote; options: ModuleOptions; origin: ModuleFederation; exposeModule: any; exposeModuleFactory: any; moduleInstance: Module$1; }], void>; handlePreloadModule: SyncHook<[{ id: string; name: string; remote: Remote; remoteSnapshot: ModuleInfo; preloadConfig: PreloadRemoteArgs; origin: ModuleFederation; }], void>; errorLoadRemote: AsyncHook<[{ id: string; error: unknown; options?: any; from: CallFrom; lifecycle: "beforeRequest" | "beforeLoadShare" | "afterResolve" | "onLoad"; origin: ModuleFederation; }], unknown>; beforePreloadRemote: AsyncHook<[{ preloadOps: Array; options: Options; origin: ModuleFederation; }], false | void | Promise>; generatePreloadAssets: AsyncHook<[{ origin: ModuleFederation; preloadOptions: PreloadOptions[number]; remote: Remote; remoteInfo: RemoteInfo; remoteSnapshot: ModuleInfo; globalSnapshot: GlobalModuleInfo; }], Promise>; afterPreloadRemote: AsyncHook<{ preloadOps: Array; options: Options; origin: ModuleFederation; }, false | void | Promise>; loadEntry: AsyncHook<[{ loaderHook: ModuleFederation["loaderHook"]; remoteInfo: RemoteInfo; remoteEntryExports?: RemoteEntryExports; }], Promise>; }>; constructor(host: ModuleFederation); formatAndRegisterRemote(globalOptions: Options, userOptions: UserOptions): Remote[]; setIdToRemoteMap(id: string, remoteMatchInfo: LoadRemoteMatch): void; loadRemote(id: string, options?: { loadFactory?: boolean; from: CallFrom; }): Promise; preloadRemote(preloadOptions: Array): Promise; registerRemotes(remotes: Remote[], options?: { force?: boolean; }): void; getRemoteModuleAndOptions(options: { id: string; }): Promise<{ module: Module$1; moduleOptions: ModuleOptions; remoteMatchInfo: LoadRemoteMatch; }>; registerRemote(remote: Remote, targetRemotes: Remote[], options?: { force?: boolean; }): void; private removeRemote; } //#endregion //#endregion //#region ../runtime-core/dist/shared/index.d.ts //#region src/shared/index.d.ts declare class SharedHandler { host: ModuleFederation; shareScopeMap: ShareScopeMap; hooks: PluginSystem<{ beforeRegisterShare: SyncWaterfallHook<{ pkgName: string; shared: Shared; origin: ModuleFederation; }>; afterResolve: AsyncWaterfallHook; beforeLoadShare: AsyncWaterfallHook<{ pkgName: string; shareInfo?: Shared; shared: Options["shared"]; origin: ModuleFederation; }>; loadShare: AsyncHook<[ModuleFederation, string, ShareInfos], false | void | Promise>; resolveShare: SyncWaterfallHook<{ shareScopeMap: ShareScopeMap; scope: string; pkgName: string; version: string; shareInfo: Shared; GlobalFederation: Federation; resolver: () => { shared: Shared; useTreesShaking: boolean; } | undefined; }>; initContainerShareScopeMap: SyncWaterfallHook<{ shareScope: ShareScopeMap[string]; options: Options; origin: ModuleFederation; scopeName: string; hostShareScopeMap?: ShareScopeMap; }>; }>; initTokens: InitTokens; constructor(host: ModuleFederation); registerShared(globalOptions: Options, userOptions: UserOptions): { newShareInfos: ShareInfos; allShareInfos: { [pkgName: string]: Shared[]; }; }; loadShare(pkgName: string, extraOptions?: { customShareInfo?: Partial; resolver?: (sharedOptions: ShareInfos[string]) => Shared; }): Promise T | undefined)>; /** * This function initializes the sharing sequence (executed only once per share scope). * It accepts one argument, the name of the share scope. * If the share scope does not exist, it creates one. */ initializeSharing(shareScopeName?: string, extraOptions?: { initScope?: InitScope; from?: CallFrom; strategy?: ShareStrategy; }): Array>; loadShareSync(pkgName: string, extraOptions?: { from?: 'build' | 'runtime'; customShareInfo?: Partial; resolver?: (sharedOptions: ShareInfos[string]) => Shared; }): () => T | never; initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string], extraOptions?: { hostShareScopeMap?: ShareScopeMap; }): void; private setShared; private _setGlobalShareScopeMap; } //#endregion //#endregion //#region ../runtime-core/dist/type/plugin.d.ts //#region src/type/plugin.d.ts type CoreLifeCycle = ModuleFederation['hooks']['lifecycle']; type CoreLifeCyclePartial = Partial<{ [k in keyof CoreLifeCycle]: Parameters[0] }>; type SnapshotLifeCycle = SnapshotHandler['hooks']['lifecycle']; type SnapshotLifeCycleCyclePartial = Partial<{ [k in keyof SnapshotLifeCycle]: Parameters[0] }>; type ModuleLifeCycle = Module$1['host']['loaderHook']['lifecycle']; type ModuleLifeCycleCyclePartial = Partial<{ [k in keyof ModuleLifeCycle]: Parameters[0] }>; type ModuleBridgeLifeCycle = Module$1['host']['bridgeHook']['lifecycle']; type ModuleBridgeLifeCycleCyclePartial = Partial<{ [k in keyof ModuleBridgeLifeCycle]: Parameters[0] }>; type SharedLifeCycle = SharedHandler['hooks']['lifecycle']; type SharedLifeCycleCyclePartial = Partial<{ [k in keyof SharedLifeCycle]: Parameters[0] }>; type RemoteLifeCycle = RemoteHandler['hooks']['lifecycle']; type RemoteLifeCycleCyclePartial = Partial<{ [k in keyof RemoteLifeCycle]: Parameters[0] }>; type ModuleFederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & ModuleBridgeLifeCycleCyclePartial & { name: string; version?: string; apply?: (instance: ModuleFederation) => void; }; //#endregion //#endregion //#region ../runtime-core/dist/global.d.ts //#region src/global.d.ts interface Federation { __GLOBAL_PLUGIN__: Array; __DEBUG_CONSTRUCTOR_VERSION__?: string; moduleInfo: GlobalModuleInfo; __DEBUG_CONSTRUCTOR__?: typeof ModuleFederation; __INSTANCES__: Array; __SHARE__: GlobalShareScopeMap; __MANIFEST_LOADING__: Record>; __PRELOADED_MAP__: Map; } declare global { var __FEDERATION__: Federation, __VMOK__: Federation, __GLOBAL_LOADING_REMOTE_ENTRY__: Record>; } declare const getGlobalSnapshot: () => GlobalModuleInfo; //#endregion //#region ../runtime-core/dist/plugins/snapshot/SnapshotHandler.d.ts //#region src/plugins/snapshot/SnapshotHandler.d.ts declare class SnapshotHandler { loadingHostSnapshot: Promise | null; HostInstance: ModuleFederation; manifestCache: Map; hooks: PluginSystem<{ beforeLoadRemoteSnapshot: AsyncHook<[{ options: Options; moduleInfo: Remote; }], void>; loadSnapshot: AsyncWaterfallHook<{ options: Options; moduleInfo: Remote; hostGlobalSnapshot: GlobalModuleInfo[string] | undefined; globalSnapshot: ReturnType; remoteSnapshot?: GlobalModuleInfo[string] | undefined; }>; loadRemoteSnapshot: AsyncWaterfallHook<{ options: Options; moduleInfo: Remote; manifestJson?: Manifest; manifestUrl?: string; remoteSnapshot: ModuleInfo; from: "global" | "manifest"; }>; afterLoadSnapshot: AsyncWaterfallHook<{ id?: string; host: ModuleFederation; options: Options; moduleInfo: Remote; remoteSnapshot: ModuleInfo; }>; }>; loaderHook: ModuleFederation['loaderHook']; manifestLoading: Record>; constructor(HostInstance: ModuleFederation); loadRemoteSnapshotInfo({ moduleInfo, id, expose }: { moduleInfo: Remote; id?: string; expose?: string; }): Promise<{ remoteSnapshot: ModuleInfo; globalSnapshot: GlobalModuleInfo; }> | never; getGlobalRemoteInfo(moduleInfo: Remote): { hostGlobalSnapshot: ModuleInfo | undefined; globalSnapshot: ReturnType; remoteSnapshot: GlobalModuleInfo[string] | undefined; }; private getManifestJson; } //#endregion //#endregion //#region ../runtime-core/dist/utils/load.d.ts //#region src/utils/load.d.ts declare function getRemoteEntry(params: { origin: ModuleFederation; remoteInfo: RemoteInfo; remoteEntryExports?: RemoteEntryExports | undefined; getEntryUrl?: (url: string) => string; _inErrorHandling?: boolean; }): Promise; //#endregion //#region ../runtime-core/dist/core.d.ts //#region src/core.d.ts declare class ModuleFederation { options: Options; hooks: PluginSystem<{ beforeInit: SyncWaterfallHook<{ userOptions: UserOptions; options: Options; origin: ModuleFederation; /** * @deprecated shareInfo will be removed soon, please use userOptions directly! */ shareInfo: ShareInfos; }>; init: SyncHook<[{ options: Options; origin: ModuleFederation; }], void>; beforeInitContainer: AsyncWaterfallHook<{ shareScope: ShareScopeMap[string]; initScope: InitScope; remoteEntryInitOptions: RemoteEntryInitOptions; remoteInfo: RemoteInfo; origin: ModuleFederation; }>; initContainer: AsyncWaterfallHook<{ shareScope: ShareScopeMap[string]; initScope: InitScope; remoteEntryInitOptions: RemoteEntryInitOptions; remoteInfo: RemoteInfo; remoteEntryExports: RemoteEntryExports; origin: ModuleFederation; id?: string; remoteSnapshot?: ModuleInfo; }>; }>; version: string; name: string; moduleCache: Map; snapshotHandler: SnapshotHandler; sharedHandler: SharedHandler; remoteHandler: RemoteHandler; shareScopeMap: ShareScopeMap; loaderHook: PluginSystem<{ getModuleInfo: SyncHook<[{ target: Record; key: any; }], void | { value: any | undefined; key: string; }>; createScript: SyncHook<[{ url: string; attrs?: Record; }], CreateScriptHookReturn>; createLink: SyncHook<[{ url: string; attrs?: Record; }], void | HTMLLinkElement>; fetch: AsyncHook<[string, RequestInit], false | void | Promise>; loadEntryError: AsyncHook<[{ getRemoteEntry: typeof getRemoteEntry; origin: ModuleFederation; remoteInfo: RemoteInfo; remoteEntryExports?: RemoteEntryExports | undefined; globalLoading: Record | undefined>; uniqueKey: string; }], Promise | undefined>>; getModuleFactory: AsyncHook<[{ remoteEntryExports: RemoteEntryExports; expose: string; moduleInfo: RemoteInfo; }], Promise<(() => Promise) | undefined>>; }>; bridgeHook: PluginSystem<{ beforeBridgeRender: SyncHook<[Record], void | Record>; afterBridgeRender: SyncHook<[Record], void | Record>; beforeBridgeDestroy: SyncHook<[Record], void | Record>; afterBridgeDestroy: SyncHook<[Record], void | Record>; }>; moduleInfo?: GlobalModuleInfo[string]; constructor(userOptions: UserOptions); initOptions(userOptions: UserOptions): Options; loadShare(pkgName: string, extraOptions?: { customShareInfo?: Partial; resolver?: (sharedOptions: ShareInfos[string]) => Shared; }): Promise T | undefined)>; loadShareSync(pkgName: string, extraOptions?: { customShareInfo?: Partial; from?: 'build' | 'runtime'; resolver?: (sharedOptions: ShareInfos[string]) => Shared; }): () => T | never; initializeSharing(shareScopeName?: string, extraOptions?: { initScope?: InitScope; from?: CallFrom; strategy?: Shared['strategy']; }): Array>; initRawContainer(name: string, url: string, container: RemoteEntryExports): Module$1; loadRemote(id: string, options?: { loadFactory?: boolean; from: CallFrom; }): Promise; preloadRemote(preloadOptions: Array): Promise; initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string], extraOptions?: { hostShareScopeMap?: ShareScopeMap; }): void; formatOptions(globalOptions: Options, userOptions: UserOptions): Options; registerPlugins(plugins: UserOptions['plugins']): void; registerRemotes(remotes: Remote[], options?: { force?: boolean; }): void; registerShared(shared: UserOptions['shared']): void; } //#endregion //#endregion //#region ../runtime-core/dist/module/index.d.ts //#region src/module/index.d.ts type ModuleOptions = ConstructorParameters[0]; declare class Module$1 { remoteInfo: RemoteInfo; inited: boolean; initing: boolean; initPromise?: Promise; remoteEntryExports?: RemoteEntryExports; lib: RemoteEntryExports | undefined; host: ModuleFederation; constructor({ remoteInfo, host }: { remoteInfo: RemoteInfo; host: ModuleFederation; }); getEntry(): Promise; init(id?: string, remoteSnapshot?: ModuleInfo, rawInitScope?: InitScope): Promise; get(id: string, expose: string, options?: { loadFactory?: boolean; }, remoteSnapshot?: ModuleInfo): Promise; private wraperFactory; } //#endregion //#endregion //#region src/runtime-plugins/dynamic-remote-type-hints-plugin.d.ts declare function dynamicRemoteTypeHintsPlugin(): ModuleFederationRuntimePlugin; export = dynamicRemoteTypeHintsPlugin;