import IndexedDBAsync from 'indexed-db-async'; import { versionLt, satisfy } from './semver'; import { batchReplace } from './remote'; type ShareModule = { name: string, id: string|number, var?: string, version?: string, shareCommon?: boolean, getVersion?: (this: ShareModule, hostModule: any, selfModule: any, modules: Record) => string }; type ExternalItem = { id: string|number, name: string, var: string, path: string } type SourcemapCallback = ( scopeName: string, host?: string, publicPath: string, href: string, source: string, )=> string; type BatchReplaceItem = [string|RegExp, string|((substring: string, ...args: any[]) => string)]; type BeforeSourceOptions = { isEval?: boolean, }; type BeforeSourceCallback = (source: string, type: 'js'|'css', href: string, options?: BeforeSourceOptions) => string; type ImportRemoteCache = { _rs?: Record>, _json?: Record>, _fetched?: Record>, } & { [key: string]: { manifest: null|RemoteManifest, result: Promise } } interface RemoteRuntimeManifest { timestamp: number, host: string, hot: boolean, jsChunks: Record, cssChunks: Record, entrys: Record, nodeModulesPath: string } type RemoteModuleWebpack = { __moduleManifests__: Record, cached: ImportRemoteCache, cacheDB: boolean, db: IndexedDBAsync, shareModules: Record }; type RemoteWindowProxy = { doc: { body: HTMLElement, createElement(tagName: string, options?: ElementCreationOptions): HTMLElement, getElementById(elementId: string, scoped?: boolean): HTMLElement | null; head: HTMLElement, html: HTMLElement, }, globals: Record, __REACT_ERROR_OVERLAY_GLOBAL_HOOK__: any } type RemoteModuleRuntime = { require(moduleId: string|number, entryFile?: string): T, webpackHotUpdate(chunkId: string|number, moreModules: Record, runtime: RemoteModuleRuntime): void, window: Window, __context__: RemoteModuleRuntime, __wp__: RemoteWindowProxy, __windowProxy__: RemoteWindowProxy, _cx_: RemoteModuleRuntime, _wp_: RemoteWindowProxy, readonly webpackChunk: [string[], Record[]][], readonly __HOST__: string readonly __remoteModuleWebpack__: RemoteModuleWebpack, [key: string]: any } type ScopeNameFunction = (url: string, options: RemoteOptions) => string|void; interface RemoteOptions { scopeName?: string|ScopeNameFunction, timeout?: number, externals?: Record, globals?: Record, getManifestCallback?: (manifest: RemoteManifest) => any|Promise, onRuntimeChanged?: (newManifest: RemoteManifest, oldManifest: RemoteManifest) => any|Promise, afterCreateRuntime?: (webpack_require: any, ctx: RemoteModuleRuntime) => void, host?: string, sync?: boolean, cacheDB?: boolean, sourcemapHost?: string|SourcemapCallback, beforeSource?: BeforeSourceCallback, method?: string, windowProxy?: { document?: { html: HTMLElement, body: HTMLElement, head: HTMLElement } }, isCommonModule?: boolean, useEsModuleDefault?: boolean, meta?: Record } type CommonModule = { url: string|((this: CommonModule, options: RemoteOptions, manifest: RemoteManifest) => string), name?: string|((this: CommonModule, options: RemoteOptions, manifest: RemoteManifest) => string), host?: string, scoped?: boolean } interface RemoteManifest { timestamp: number, name: string, version: number, webpackVersion: number, mode: 'production'|'development', devtool: boolean, moduleVersion: string, hash: string, hot: boolean, nodeModulesPath: string, entryFile: string, entryId: string|number, windowObject: string, globalObject: string, jsonpFunction: string, hotUpdateGlobal: string, uniqueName: string, scopeName: string, publicPath: string, shareModules: ShareModule[], remotes: { hasJsMatcher?: (chunkId: string|number) => boolean, chunkMapping?: Record, idToExternalAndNameMapping: Record|0 }>, initCodePerScope: Record, initialConsumes: Record, moduleIdToSourceMapping: Record, chunkToModuleMapping: Record, runtimeName: string }, externals: ExternalItem[], jsChunks: Record, cssChunks: Record, entrys: { css: string[], js: string[] ids: (string|number)[] }, meta: Record, globalToScopes?: string[], batchReplaces?: BatchReplaceItem[], commonModules?: CommonModule[], sourcemapHost?: string| SourcemapCallback, beforeSource?: ( source: string, type: 'js'|'css', href: string, options: BeforeSourceOptions, utils: { versionLt: typeof versionLt, satisfy: typeof satisfy, batchReplace: typeof batchReplace, checkOffset: (source: string, offset: number, match: string, replaceStr: string) => string } ) => ReturnType, } interface EntriesInfo { name: string, version: string, timestamp: number, entries: { [key: string]: { chunks: string[], meta: Record } }, [key: string]: any } export { ExternalItem, ShareModule, CommonModule, RemoteOptions, SourcemapCallback, BeforeSourceCallback, RemoteManifest, EntriesInfo, ImportRemoteCache, RemoteRuntimeManifest, RemoteModuleWebpack, RemoteModuleRuntime };