UNPKG

webpack

Version:

Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.

2,291 lines (2,038 loc) 570 kB
/* * This file was automatically generated. * DO NOT MODIFY BY HAND. * Run `yarn fix:special` to update */ import { Parser as ParserImport } from "acorn"; import { Buffer } from "buffer"; import { Scope } from "eslint-scope"; import { ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BlockStatement, BreakStatement, CatchClause, ChainExpression, ClassBody, ClassDeclaration, ClassExpression, Comment as CommentImport, ConditionalExpression, ContinueStatement, DebuggerStatement, Directive, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, ExportSpecifier, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportExpression as ImportExpressionImport, ImportNamespaceSpecifier, ImportSpecifier, LabeledStatement, LogicalExpression, MaybeNamedClassDeclaration, MaybeNamedFunctionDeclaration, MemberExpression, MetaProperty, MethodDefinition, NewExpression, ObjectExpression, ObjectPattern, PrivateIdentifier, Program, Property, PropertyDefinition, RegExpLiteral, RestElement, ReturnStatement, SequenceExpression, SimpleCallExpression, SimpleLiteral, SourceLocation, SpreadElement, StaticBlock, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateElement, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression } from "estree"; import { IncomingMessage, Server as ServerImportHttp, ServerOptions as ServerOptionsImportHttp } from "http"; import { Server as ServerImportHttps, ServerOptions as ServerOptionsImportHttps } from "https"; import { Session as SessionImportInspectorClass_1, Session as SessionImportInspectorClass_2 } from "inspector"; import { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema"; import { ListenOptions } from "net"; import { ExtendedSchema, ValidationErrorConfiguration, validate as validateFunction } from "schema-utils"; import { default as ValidationError } from "schema-utils/declarations/ValidationError"; import { AsArray, AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook, HookMap, IfSet, MultiHook, SyncBailHook, SyncHook, SyncWaterfallHook, TapOptions, TypedHookMap } from "tapable"; import { URL } from "url"; import { Context as ContextImport } from "vm"; declare interface Abortable { signal?: AbortSignal; } declare class AbstractLibraryPlugin<T> { /** * Creates an instance of AbstractLibraryPlugin. */ constructor(__0: AbstractLibraryPluginOptions); /** * Applies the plugin by registering its hooks on the compiler. */ apply(compiler: Compiler): void; /** * Returns preprocess as needed by overriding. */ parseOptions(library: LibraryOptions): T; /** * Finish entry module. */ finishEntryModule( module: Module, entryName: string, libraryContext: LibraryContext<T> ): void; /** * Embed in runtime bailout. */ embedInRuntimeBailout( module: Module, renderContext: RenderContextJavascriptModulesPlugin, libraryContext: LibraryContext<T> ): undefined | string; /** * Strict runtime bailout. */ strictRuntimeBailout( renderContext: RenderContextJavascriptModulesPlugin, libraryContext: LibraryContext<T> ): undefined | string; /** * Processes the provided chunk. */ runtimeRequirements( chunk: Chunk, set: Set<string>, libraryContext: LibraryContext<T> ): void; /** * Returns source with library export. */ render( source: Source, renderContext: RenderContextJavascriptModulesPlugin, libraryContext: LibraryContext<T> ): Source; /** * Renders source with library export. */ renderStartup( source: Source, module: Module, renderContext: StartupRenderContext, libraryContext: LibraryContext<T> ): Source; /** * Renders module content. */ renderModuleContent( source: Source, module: Module, renderContext: ModuleRenderContext, libraryContext: Omit<LibraryContext<T>, "options"> ): Source; /** * Processes the provided chunk. */ chunkHash( chunk: Chunk, hash: Hash, chunkHashContext: ChunkHashContext, libraryContext: LibraryContext<T> ): void; static COMMON_LIBRARY_NAME_MESSAGE: string; } declare interface AbstractLibraryPluginOptions { /** * name of the plugin */ pluginName: string; /** * used library type */ type: string; } declare interface AdditionalData { [index: string]: any; webpackAST: object; } type AfterContextResolveData = ContextResolveData & ContextOptions & { resource: string | string[]; resourceQuery?: string; resourceFragment?: string; resolveDependencies: ( fs: InputFileSystem, options: ContextModuleOptions, callback: ( err: null | Error, dependencies?: ContextElementDependency[] ) => void ) => void; }; declare class AggressiveMergingPlugin { /** * Creates an instance of AggressiveMergingPlugin. */ constructor(options?: AggressiveMergingPluginOptions); options: AggressiveMergingPluginOptions; /** * Applies the plugin by registering its hooks on the compiler. */ apply(compiler: Compiler): void; } declare interface AggressiveMergingPluginOptions { /** * minimal size reduction to trigger merging */ minSizeReduce?: number; } declare class AggressiveSplittingPlugin { /** * Creates an instance of AggressiveSplittingPlugin. */ constructor(options?: AggressiveSplittingPluginOptions); options: AggressiveSplittingPluginOptions; /** * Applies the plugin by registering its hooks on the compiler. */ apply(compiler: Compiler): void; /** * Was chunk recorded. */ static wasChunkRecorded(chunk: Chunk): boolean; } declare interface AggressiveSplittingPluginOptions { /** * Extra cost for each chunk (Default: 9.8kiB). */ chunkOverhead?: number; /** * Extra cost multiplicator for entry chunks (Default: 10). */ entryChunkMultiplicator?: number; /** * Byte, max size of per file (Default: 50kiB). */ maxSize?: number; /** * Byte, split point. (Default: 30kiB). */ minSize?: number; } type Alias = string | false | string[]; declare interface AliasOption { alias: Alias; name: string; onlyModule?: boolean; } type AliasOptionNewRequest = string | false | string[]; declare interface AliasOptions { [index: string]: AliasOptionNewRequest; } declare interface AllCodeGenerationSchemas { /** * top level declarations for javascript modules */ topLevelDeclarations: Set<string>; /** * chunk init fragments for javascript modules */ chunkInitFragments: InitFragment<any>[]; /** * url for css and javascript modules */ url: { javascript?: string; "css-url"?: string }; /** * a filename for asset modules */ filename: string; /** * an asset info for asset modules */ assetInfo: AssetInfo; /** * a full content hash for asset modules */ fullContentHash: string; /** * share-init for modules federation */ "share-init": [{ shareScope: string; initStage: number; init: string }]; } type AnyLoaderContext = NormalModuleLoaderContext<any> & LoaderRunnerLoaderContext<any> & LoaderPluginLoaderContext & HotModuleReplacementPluginLoaderContext; declare abstract class AppendOnlyStackedSet<T> { /** * Adds a value to the current scope layer, creating that layer lazily when * the first write occurs. */ add(el: T): void; /** * Checks whether a value is present in any scope layer currently visible to * this stacked set. */ has(el: T): boolean; /** * Removes every scope layer and any values accumulated in them. */ clear(): void; /** * Creates a child stacked set that shares the existing scope history while * allowing subsequent additions to be recorded in its own new layer. */ createChild(): AppendOnlyStackedSet<T>; /** * Iterates over the stacked sets from newest to oldest so consumers can * inspect recently added values first. */ [Symbol.iterator](): Iterator<T>; } /** * Returns object of arguments. */ declare interface Argument { description?: string; simpleType: SimpleType; multiple: boolean; configs: ArgumentConfig[]; } /** * Returns object of arguments. */ declare interface ArgumentConfig { description?: string; negatedDescription?: string; path: string; multiple: boolean; type: "string" | "number" | "boolean" | "path" | "enum" | "RegExp" | "reset"; values?: EnumValue[]; } declare interface Asset { /** * the filename of the asset */ name: string; /** * source of the asset */ source: Source; /** * info about the asset */ info: AssetInfo; } declare abstract class AssetBytesGenerator extends Generator { /** * Generates fallback output for the provided error condition. */ generateError( error: Error, module: NormalModule, generateContext: GenerateContext ): null | Source; } declare abstract class AssetBytesParser extends ParserClass {} declare interface AssetDependencyMeta { sourceType: "css-url"; } /** * Checks whether this object is sorted. */ declare interface AssetEmittedInfo { content: Buffer; source: Source; compilation: Compilation; outputPath: string; targetPath: string; } type AssetFilterItemTypes = | string | RegExp | ((name: string, asset: StatsAsset) => boolean); declare abstract class AssetGenerator extends Generator { dataUrlOptions?: | AssetGeneratorDataUrlOptions | (( source: string | Buffer, context: { filename: string; module: Module } ) => string); filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string); publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string); outputPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string); emit?: boolean; /** * Returns mime type. */ getMimeType(module: NormalModule): string; /** * Generates data uri. */ generateDataUri(module: NormalModule): string; /** * Generates fallback output for the provided error condition. */ generateError( error: Error, module: NormalModule, generateContext: GenerateContext ): null | Source; } /** * Options object for data url generation. */ declare interface AssetGeneratorDataUrlOptions { /** * Asset encoding (defaults to base64). */ encoding?: false | "base64"; /** * Asset mimetype (getting from file extension by default). */ mimetype?: string; } type AssetGeneratorOptions = AssetInlineGeneratorOptions & AssetResourceGeneratorOptions; type AssetInfo = KnownAssetInfo & Record<string, any>; /** * Generator options for asset/inline modules. */ declare interface AssetInlineGeneratorOptions { /** * Whether or not this asset module should be considered binary. This can be set to 'false' to treat this asset module as text. */ binary?: boolean; /** * The options for data url generator. */ dataUrl?: | AssetGeneratorDataUrlOptions | (( source: string | Buffer, context: { filename: string; module: Module } ) => string); } declare abstract class AssetParser extends ParserClass { dataUrlCondition?: | boolean | AssetParserDataUrlOptions | (( source: string | Buffer, context: { filename: string; module: Module } ) => boolean); } /** * Options object for DataUrl condition. */ declare interface AssetParserDataUrlOptions { /** * Maximum size of asset that should be inline as modules. Default: 8kb. */ maxSize?: number; } /** * Parser options for asset modules. */ declare interface AssetParserOptions { /** * The condition for inlining the asset as DataUrl. */ dataUrlCondition?: | AssetParserDataUrlOptions | (( source: string | Buffer, context: { filename: string; module: Module } ) => boolean); } /** * Generator options for asset/resource modules. */ declare interface AssetResourceGeneratorOptions { /** * Whether or not this asset module should be considered binary. This can be set to 'false' to treat this asset module as text. */ binary?: boolean; /** * Emit an output asset from this asset module. This can be set to 'false' to omit emitting e. g. for SSR. */ emit?: boolean; /** * Specifies the filename template of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk. */ filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string); /** * Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there. */ outputPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string); /** * The 'publicPath' specifies the public URL address of the output files when referenced in a browser. */ publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string); } declare abstract class AssetSourceGenerator extends Generator { /** * Generates fallback output for the provided error condition. */ generateError( error: Error, module: NormalModule, generateContext: GenerateContext ): null | Source; } declare abstract class AssetSourceParser extends ParserClass {} declare class AsyncDependenciesBlock extends DependenciesBlock { constructor( groupOptions: null | string | GroupOptionsAsyncDependenciesBlock, loc?: null | SyntheticDependencyLocation | RealDependencyLocation, request?: null | string ); groupOptions: GroupOptionsAsyncDependenciesBlock; loc?: null | SyntheticDependencyLocation | RealDependencyLocation; request?: null | string; chunkName?: null | string; get circular(): boolean; module: any; } declare abstract class AsyncQueue<T, K, R> { hooks: { beforeAdd: AsyncSeriesHook<[T]>; added: SyncHook<[T]>; beforeStart: AsyncSeriesHook<[T]>; started: SyncHook<[T]>; result: SyncHook< [T, undefined | null | WebpackError, undefined | null | R] >; }; /** * Returns context of execution. */ getContext(): string; /** * Updates context using the provided value. */ setContext(value: string): void; /** * Processes the provided item. */ add(item: T, callback: CallbackAsyncQueue<R>): void; /** * Processes the provided item. */ invalidate(item: T): void; /** * Waits for an already started item */ waitFor(item: T, callback: CallbackAsyncQueue<R>): void; /** * Describes how this stop operation behaves. */ stop(): void; /** * Increase parallelism. */ increaseParallelism(): void; /** * Decrease parallelism. */ decreaseParallelism(): void; /** * Checks whether this async queue is processing. */ isProcessing(item: T): boolean; /** * Checks whether this async queue is queued. */ isQueued(item: T): boolean; /** * Checks whether this async queue is done. */ isDone(item: T): boolean; clear(): void; } declare class AsyncWebAssemblyModulesPlugin { /** * Creates an instance of AsyncWebAssemblyModulesPlugin. */ constructor(options: AsyncWebAssemblyModulesPluginOptions); options: AsyncWebAssemblyModulesPluginOptions; /** * Applies the plugin by registering its hooks on the compiler. */ apply(compiler: Compiler): void; /** * Renders the newly generated source from rendering. */ renderModule( module: Module, renderContext: WebAssemblyRenderContext, hooks: CompilationHooksAsyncWebAssemblyModulesPlugin ): Source; /** * Returns the attached hooks. */ static getCompilationHooks( compilation: Compilation ): CompilationHooksAsyncWebAssemblyModulesPlugin; } declare interface AsyncWebAssemblyModulesPluginOptions { /** * mangle imports */ mangleImports?: boolean; } declare abstract class AsyncWebAssemblyParser extends ParserClass {} declare class AutomaticPrefetchPlugin { constructor(); /** * Registers hooks that remember previously built normal modules and enqueue * them as `PrefetchDependency` requests during the next make phase. */ apply(compiler: Compiler): void; } type AuxiliaryComment = string | LibraryCustomUmdCommentObject; declare interface BackendApi { dispose: (callback: (err?: null | Error) => void) => void; module: (module: Module) => ModuleResult; } declare class BannerPlugin { /** * Normalizes banner options and compiles the configured banner source into a * function that can render per-asset banner text. */ constructor(options: BannerPluginArgument); options: BannerPluginOptions; banner: (data: { hash?: string; chunk: Chunk; filename: string }) => string; /** * Validates the configured options and injects rendered banner comments into * matching compilation assets at the configured process-assets stage. */ apply(compiler: Compiler): void; } type BannerPluginArgument = | string | BannerPluginOptions | ((data: { hash?: string; chunk: Chunk; filename: string }) => string); declare interface BannerPluginOptions { /** * Specifies the banner. */ banner: | string | ((data: { hash?: string; chunk: Chunk; filename: string }) => string); /** * If true, the banner will only be added to the entry chunks. */ entryOnly?: boolean; /** * Exclude all modules matching any of these conditions. */ exclude?: string | RegExp | ((str: string) => boolean) | Rule[]; /** * If true, banner will be placed at the end of the output. */ footer?: boolean; /** * Include all modules matching any of these conditions. */ include?: string | RegExp | ((str: string) => boolean) | Rule[]; /** * If true, banner will not be wrapped in a comment. */ raw?: boolean; /** * Specifies the stage when add a banner. */ stage?: number; /** * Include all modules that pass test assertion. */ test?: string | RegExp | ((str: string) => boolean) | Rule[]; } declare interface BaseResolveRequest { /** * path */ path: string | false; /** * content */ context?: ContextTypes; /** * description file path */ descriptionFilePath?: string; /** * description file root */ descriptionFileRoot?: string; /** * description file data */ descriptionFileData?: JsonObjectTypes; /** * tsconfig paths map */ tsconfigPathsMap?: null | TsconfigPathsMap; /** * relative path */ relativePath?: string; /** * true when need to ignore symlinks, otherwise false */ ignoreSymlinks?: boolean; /** * true when full specified, otherwise false */ fullySpecified?: boolean; /** * inner request for internal usage */ __innerRequest?: string; /** * inner request for internal usage */ __innerRequest_request?: string; /** * inner relative path for internal usage */ __innerRequest_relativePath?: string; } declare abstract class BasicEvaluatedExpression { type: number; range?: [number, number]; falsy: boolean; truthy: boolean; nullish?: boolean; sideEffects: boolean; bool?: boolean; number?: number; bigint?: bigint; regExp?: RegExp; string?: string; quasis?: BasicEvaluatedExpression[]; parts?: BasicEvaluatedExpression[]; array?: any[]; items?: BasicEvaluatedExpression[]; options?: BasicEvaluatedExpression[]; prefix?: null | BasicEvaluatedExpression; postfix?: null | BasicEvaluatedExpression; wrappedInnerExpressions?: BasicEvaluatedExpression[]; identifier?: string | VariableInfo; rootInfo?: string | VariableInfo; getMembers?: () => string[]; getMembersOptionals?: () => boolean[]; getMemberRanges?: () => [number, number][]; expression?: | Program | ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpressionImport | UnaryExpression | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UpdateExpression | YieldExpression | SpreadElement | PrivateIdentifier | Super | FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | ExportDefaultDeclaration | MethodDefinition | PropertyDefinition | VariableDeclarator | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | SwitchCase | CatchClause | Property | AssignmentProperty | ClassBody | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | TemplateElement; isUnknown(): boolean; isNull(): boolean; isUndefined(): boolean; isString(): boolean; isNumber(): boolean; isBigInt(): boolean; isBoolean(): boolean; isRegExp(): boolean; isConditional(): boolean; isArray(): boolean; isConstArray(): boolean; isIdentifier(): boolean; isWrapped(): boolean; isTemplateString(): boolean; /** * Is expression a primitive or an object type value? */ isPrimitiveType(): undefined | boolean; /** * Is expression a runtime or compile-time value? */ isCompileTimeValue(): boolean; /** * As compile time value. */ asCompileTimeValue(): | undefined | null | string | number | bigint | boolean | RegExp | any[]; isTruthy(): boolean; isFalsy(): boolean; isNullish(): undefined | boolean; /** * Can this expression have side effects? */ couldHaveSideEffects(): boolean; /** * Creates a boolean representation of this evaluated expression. */ asBool(): undefined | boolean; /** * Creates a nullish coalescing representation of this evaluated expression. */ asNullish(): undefined | boolean; /** * Creates a string representation of this evaluated expression. */ asString(): undefined | string; /** * Updates string using the provided string. */ setString(string: string): BasicEvaluatedExpression; setUndefined(): BasicEvaluatedExpression; setNull(): BasicEvaluatedExpression; /** * Set's the value of this expression to a number */ setNumber(number: number): BasicEvaluatedExpression; /** * Set's the value of this expression to a BigInt */ setBigInt(bigint: bigint): BasicEvaluatedExpression; /** * Set's the value of this expression to a boolean */ setBoolean(bool: boolean): BasicEvaluatedExpression; /** * Set's the value of this expression to a regular expression */ setRegExp(regExp: RegExp): BasicEvaluatedExpression; /** * Set's the value of this expression to a particular identifier and its members. */ setIdentifier( identifier: string | VariableInfo, rootInfo: string | VariableInfo, getMembers: () => string[], getMembersOptionals?: () => boolean[], getMemberRanges?: () => [number, number][] ): BasicEvaluatedExpression; /** * Wraps an array of expressions with a prefix and postfix expression. */ setWrapped( prefix?: null | BasicEvaluatedExpression, postfix?: null | BasicEvaluatedExpression, innerExpressions?: BasicEvaluatedExpression[] ): BasicEvaluatedExpression; /** * Stores the options of a conditional expression. */ setOptions(options: BasicEvaluatedExpression[]): BasicEvaluatedExpression; /** * Adds the provided basic evaluated expression to the basic evaluated expression. */ addOptions(options: BasicEvaluatedExpression[]): BasicEvaluatedExpression; /** * Set's the value of this expression to an array of expressions. */ setItems(items: BasicEvaluatedExpression[]): BasicEvaluatedExpression; /** * Set's the value of this expression to an array of strings. */ setArray(array: string[]): BasicEvaluatedExpression; /** * Set's the value of this expression to a processed/unprocessed template string. Used * for evaluating TemplateLiteral expressions in the JavaScript Parser. */ setTemplateString( quasis: BasicEvaluatedExpression[], parts: BasicEvaluatedExpression[], kind: "cooked" | "raw" ): BasicEvaluatedExpression; templateStringKind?: "cooked" | "raw"; setTruthy(): BasicEvaluatedExpression; setFalsy(): BasicEvaluatedExpression; /** * Set's the value of the expression to nullish. */ setNullish(value: boolean): BasicEvaluatedExpression; /** * Set's the range for the expression. */ setRange(range: [number, number]): BasicEvaluatedExpression; /** * Set whether or not the expression has side effects. */ setSideEffects(sideEffects?: boolean): BasicEvaluatedExpression; /** * Set the expression node for the expression. */ setExpression( expression?: | Program | ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpressionImport | UnaryExpression | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UpdateExpression | YieldExpression | SpreadElement | PrivateIdentifier | Super | FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | ExportDefaultDeclaration | MethodDefinition | PropertyDefinition | VariableDeclarator | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | SwitchCase | CatchClause | Property | AssignmentProperty | ClassBody | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | TemplateElement ): BasicEvaluatedExpression; } type BeforeContextResolveData = ContextResolveData & ContextOptions; declare interface Bootstrap { header: string[]; beforeStartup: string[]; startup: string[]; afterStartup: string[]; allowInlineStartup: boolean; } type BufferEncoding = | "ascii" | "utf8" | "utf-8" | "utf16le" | "utf-16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"; type BufferEncodingOption = "buffer" | { encoding: "buffer" }; declare interface BufferEntry { map?: null | RawSourceMap; bufferedMap?: null | BufferedMap; } declare interface BufferedMap { /** * version */ version: number; /** * sources */ sources: string[]; /** * name */ names: string[]; /** * source root */ sourceRoot?: string; /** * sources content */ sourcesContent?: ("" | Buffer)[]; /** * mappings */ mappings?: Buffer; /** * file */ file: string; } type BuildInfo = KnownBuildInfo & Record<string, any>; type BuildMeta = KnownBuildMeta & Record<string, any>; declare abstract class ByTypeGenerator extends Generator { map: { [index: string]: undefined | Generator }; generateError?: ( error: Error, module: NormalModule, generateContext: GenerateContext ) => null | Source; } declare const CIRCULAR_CONNECTION: unique symbol; declare class CacheClass { /** * Initializes the cache lifecycle hooks implemented by cache backends. */ constructor(); hooks: { get: AsyncSeriesBailHook<[string, null | Etag, GotHandler<any>[]], any>; store: AsyncParallelHook<[string, null | Etag, any]>; storeBuildDependencies: AsyncParallelHook<[Iterable<string>]>; beginIdle: SyncHook<[]>; endIdle: AsyncParallelHook<[]>; shutdown: AsyncParallelHook<[]>; }; /** * Retrieves a cached value and lets registered `gotHandlers` observe the * result before the caller receives it. */ get<T>( identifier: string, etag: null | Etag, callback: CallbackCacheCache<T> ): void; /** * Stores a cache entry for the identifier and etag through the registered * cache backend hooks. */ store<T>( identifier: string, etag: null | Etag, data: T, callback: CallbackCacheCache<void> ): void; /** * Persists the set of build dependencies required to determine whether the * cache can be restored in a future compilation. */ storeBuildDependencies( dependencies: Iterable<string>, callback: CallbackCacheCache<void> ): void; /** * Signals that webpack is entering an idle phase and cache backends may flush * or compact pending work. */ beginIdle(): void; /** * Signals that webpack is leaving the idle phase and waits for cache * backends to finish any asynchronous resume work. */ endIdle(callback: CallbackCacheCache<void>): void; /** * Shuts down every registered cache backend and waits for cleanup to finish. */ shutdown(callback: CallbackCacheCache<void>): void; static STAGE_MEMORY: number; static STAGE_DEFAULT: number; static STAGE_DISK: number; static STAGE_NETWORK: number; } declare abstract class CacheFacade { /** * Returns child cache. */ getChildCache(name: string): CacheFacade; /** * Returns item cache. */ getItemCache(identifier: string, etag: null | Etag): ItemCacheFacade; /** * Gets lazy hashed etag. */ getLazyHashedEtag(obj: HashableObject): Etag; /** * Merges the provided values into a single result. */ mergeEtags(a: Etag, b: Etag): Etag; /** * Returns value. */ get<T>( identifier: string, etag: null | Etag, callback: CallbackCacheCacheFacade<T> ): void; /** * Returns promise with the data. */ getPromise<T>(identifier: string, etag: null | Etag): Promise<T>; /** * Processes the provided identifier. */ store<T>( identifier: string, etag: null | Etag, data: T, callback: CallbackCacheCacheFacade<void> ): void; /** * Stores the provided identifier. */ storePromise<T>( identifier: string, etag: null | Etag, data: T ): Promise<void>; /** * Processes the provided identifier. */ provide<T>( identifier: string, etag: null | Etag, computer: (callback: CallbackNormalErrorCache<T>) => void, callback: CallbackNormalErrorCache<T> ): void; /** * Returns promise with the data. */ providePromise<T>( identifier: string, etag: null | Etag, computer: () => T | Promise<T> ): Promise<T>; } declare interface CacheGroupSource { key: string; priority?: number; getName?: ( module: Module, chunks: Chunk[], key: string ) => undefined | string; chunksFilter?: (chunk: Chunk) => undefined | boolean; enforce?: boolean; minSize: SplitChunksSizes; minSizeReduction: SplitChunksSizes; minRemainingSize: SplitChunksSizes; enforceSizeThreshold: SplitChunksSizes; maxAsyncSize: SplitChunksSizes; maxInitialSize: SplitChunksSizes; minChunks?: number; maxAsyncRequests?: number; maxInitialRequests?: number; filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string); idHint?: string; automaticNameDelimiter?: string; reuseExistingChunk?: boolean; usedExports?: boolean; } declare interface CacheGroupsContext { moduleGraph: ModuleGraph; chunkGraph: ChunkGraph; } type CacheOptionsNormalized = false | FileCacheOptions | MemoryCacheOptions; declare interface CacheTypes { [index: string]: undefined | ResolveRequest | ResolveRequest[]; } declare interface CachedData { /** * source */ source?: boolean; /** * buffer */ buffer: Buffer; /** * size */ size?: number; /** * maps */ maps: Map<string, BufferEntry>; /** * hash */ hash?: (string | Buffer)[]; } declare class CachedSource extends Source { constructor(source: Source | (() => Source), cachedData?: CachedData); getCachedData(): CachedData; originalLazy(): Source | (() => Source); original(): Source; streamChunks( options: StreamChunksOptions, onChunk: ( chunk: undefined | string, generatedLine: number, generatedColumn: number, sourceIndex: number, originalLine: number, originalColumn: number, nameIndex: number ) => void, onSource: ( sourceIndex: number, source: null | string, sourceContent?: string ) => void, onName: (nameIndex: number, name: string) => void ): GeneratedSourceInfo; } declare interface CalculatedStringResult { range?: [number, number]; value: string; code: boolean; conditional: false | CalculatedStringResult[]; } type CallExpression = SimpleCallExpression | NewExpression; declare interface CallExpressionInfo { type: "call"; call: CallExpression; calleeName: string; rootInfo: string | VariableInfo; getCalleeMembers: () => string[]; name: string; getMembers: () => string[]; getMembersOptionals: () => boolean[]; getMemberRanges: () => [number, number][]; } declare interface CallbackAsyncQueue<T> { (err?: null | WebpackError, result?: null | T): void; } /** * Creates a callback wrapper that waits for a fixed number of completions and * forwards the first error immediately. */ declare interface CallbackCacheCache<T> { /** * Creates a callback wrapper that waits for a fixed number of completions and * forwards the first error immediately. */ (err: null | WebpackError, result?: T): void; } declare interface CallbackCacheCacheFacade<T> { (err?: null | Error, result?: null | T): void; } declare interface CallbackNormalErrorCache<T> { (err?: null | Error, result?: T): void; } /** * Creates a multi compiler. */ declare interface CallbackWebpackFunction_1<T> { /** * Creates a multi compiler. */ (err: null | Error, result?: T): void; } /** * Creates a multi compiler. */ declare interface CallbackWebpackFunction_2<T, R = void> { /** * Creates a multi compiler. */ (err: null | Error, result?: T): R; } type Cell<T> = undefined | T; declare class Chunk { /** * Creates an instance of Chunk. */ constructor(name?: null | string, backCompat?: boolean); id: null | string | number; ids: null | ChunkId[]; debugId: number; name?: null | string; idNameHints: SortableSet<string>; preventIntegration: boolean; filenameTemplate?: | string | ((pathData: PathData, assetInfo?: AssetInfo) => string); cssFilenameTemplate?: | string | ((pathData: PathData, assetInfo?: AssetInfo) => string); runtime: RuntimeSpec; files: Set<string>; auxiliaryFiles: Set<string>; rendered: boolean; hash?: string; contentHash: Record<string, string>; renderedHash?: string; chunkReason?: string; extraAsync: boolean; /** * Returns entry module. * @deprecated */ get entryModule(): Module; /** * Checks whether this chunk has an entry module. * @deprecated */ hasEntryModule(): boolean; /** * Adds the provided module to the chunk. * @deprecated */ addModule(module: Module): boolean; /** * Removes the provided module from the chunk. * @deprecated */ removeModule(module: Module): void; /** * Gets the number of modules in this chunk. * @deprecated */ getNumberOfModules(): number; /** * @deprecated */ get modulesIterable(): Iterable<Module>; /** * Compares this chunk with another chunk. * @deprecated */ compareTo(otherChunk: Chunk): 0 | 1 | -1; /** * Checks whether this chunk contains the module. * @deprecated */ containsModule(module: Module): boolean; /** * Returns the modules for this chunk. * @deprecated */ getModules(): Module[]; /** * Removes this chunk from the chunk graph and chunk groups. * @deprecated */ remove(): void; /** * Moves a module from this chunk to another chunk. * @deprecated */ moveModule(module: Module, otherChunk: Chunk): void; /** * Integrates another chunk into this chunk when possible. * @deprecated */ integrate(otherChunk: Chunk): boolean; /** * Checks whether this chunk can be integrated with another chunk. * @deprecated */ canBeIntegrated(otherChunk: Chunk): boolean; /** * Checks whether this chunk is empty. * @deprecated */ isEmpty(): boolean; /** * Returns the total size of all modules in this chunk. * @deprecated */ modulesSize(): number; /** * Returns the estimated size for the requested source type. * @deprecated */ size(options?: ChunkSizeOptions): number; /** * Returns the integrated size with another chunk. * @deprecated */ integratedSize(otherChunk: Chunk, options: ChunkSizeOptions): number; /** * Gets chunk module maps. * @deprecated */ getChunkModuleMaps(filterFn: (m: Module) => boolean): ChunkModuleMaps; /** * Checks whether this chunk contains a matching module in the graph. * @deprecated */ hasModuleInGraph( filterFn: (m: Module) => boolean, filterChunkFn?: (c: Chunk, chunkGraph: ChunkGraph) => boolean ): boolean; /** * Returns the chunk map information. * @deprecated */ getChunkMaps(realHash: boolean): ChunkMaps; /** * Checks whether this chunk has runtime. */ hasRuntime(): boolean; /** * Checks whether it can be initial. */ canBeInitial(): boolean; /** * Checks whether this chunk is only initial. */ isOnlyInitial(): boolean; /** * Gets entry options. */ getEntryOptions(): undefined | EntryOptions; /** * Adds the provided chunk group to the chunk. */ addGroup(chunkGroup: ChunkGroup): void; /** * Removes the provided chunk group from the chunk. */ removeGroup(chunkGroup: ChunkGroup): void; /** * Checks whether this chunk is in group. */ isInGroup(chunkGroup: ChunkGroup): boolean; /** * Gets number of groups. */ getNumberOfGroups(): number; /** * Gets groups iterable. */ get groupsIterable(): SortableSet<ChunkGroup>; /** * Disconnects from groups. */ disconnectFromGroups(): void; /** * Processes the provided new chunk. */ split(newChunk: Chunk): void; /** * Updates the hash with the data contributed by this instance. */ updateHash(hash: Hash, chunkGraph: ChunkGraph): void; /** * Gets all async chunks. */ getAllAsyncChunks(): Set<Chunk>; /** * Gets all initial chunks. */ getAllInitialChunks(): Set<Chunk>; /** * Gets all referenced chunks. */ getAllReferencedChunks(): Set<Chunk>; /** * Gets all referenced async entrypoints. */ getAllReferencedAsyncEntrypoints(): Set<Entrypoint>; /** * Checks whether this chunk has async chunks. */ hasAsyncChunks(): boolean; /** * Gets child ids by orders. */ getChildIdsByOrders( chunkGraph: ChunkGraph, filterFn?: (c: Chunk, chunkGraph: ChunkGraph) => boolean ): Record<string, ChunkId[]>; /** * Gets children of type in order. */ getChildrenOfTypeInOrder( chunkGraph: ChunkGraph, type: string ): undefined | ChunkChildOfTypeInOrder[]; /** * Gets child ids by orders map. */ getChildIdsByOrdersMap( chunkGraph: ChunkGraph, includeDirectChildren?: boolean, filterFn?: (c: Chunk, chunkGraph: ChunkGraph) => boolean ): ChunkChildIdsByOrdersMapByData; /** * Checks whether this chunk contains the chunk graph. */ hasChildByOrder( chunkGraph: ChunkGraph, type: string, includeDirectChildren?: boolean, filterFn?: (c: Chunk, chunkGraph: ChunkGraph) => boolean ): boolean; } declare interface ChunkChildIdsByOrdersMap { [index: string]: ChunkId[]; } declare interface ChunkChildIdsByOrdersMapByData { [index: string]: ChunkChildIdsByOrdersMap; } declare interface ChunkChildOfTypeInOrder { onChunks: Chunk[]; chunks: Set<Chunk>; } declare interface ChunkConditionMap { [index: number]: boolean; [index: string]: boolean; } declare class ChunkGraph { /** * Creates an instance of ChunkGraph. */ constructor(moduleGraph: ModuleGraph, hashFunction?: HashFunction); moduleGraph: ModuleGraph; /** * Connects chunk and module. */ connectChunkAndModule(chunk: Chunk, module: Module): void; /** * Disconnects chunk and module. */ disconnectChunkAndModule(chunk: Chunk, module: Module): void; /** * Processes the provided chunk. */ disconnectChunk(chunk: Chunk): void; /** * Processes the provided chunk. */ attachModules(chunk: Chunk, modules: Iterable<Module>): void; /** * Attach runtime modules. */ attachRuntimeModules(chunk: Chunk, modules: Iterable<RuntimeModule>): void; /** * Attach full hash modules. */ attachFullHashModules(chunk: Chunk, modules: Iterable<RuntimeModule>): void; /** * Attach dependent hash modules. */ attachDependentHashModules( chunk: Chunk, modules: Iterable<RuntimeModule> ): void; /** * Processes the provided old module. */ replaceModule(oldModule: Module, newModule: Module): void; /** * Checks whether this chunk graph is module in chunk. */ isModuleInChunk(module: Module, chunk: Chunk): boolean; /** * Checks whether this chunk graph is module in chunk group. */ isModuleInChunkGroup(module: Module, chunkGroup: ChunkGroup): boolean; /** * Checks whether this chunk graph is entry module. */ isEntryModule(module: Module): boolean; /** * Gets module chunks iterable. */ getModuleChunksIterable(module: Module): Iterable<Chunk>; /** * Gets ordered module chunks iterable. */ getOrderedModuleChunksIterable( module: Module, sortFn: (a: Chunk, b: Chunk) => 0 | 1 | -1 ): Iterable<Chunk>; /** * Gets module chunks. */ getModuleChunks(module: Module): Chunk[]; /** * Gets number of module chunks. */ getNumberOfModuleChunks(module: Module): number; /** * Gets module runtimes. */ getModuleRuntimes(module: Module): RuntimeSpecSet; /** * Gets number of chunk modules. */ getNumberOfChunkModules(chunk: Chunk): number; /** * Gets number of chunk full hash modules. */ getNumberOfChunkFullHashModules(chunk: Chunk): number; /** * Gets chunk modules iterable. */ getChunkModulesIterable(chunk: Chunk): Iterable<Module>; /** * Gets chunk modules iterable by source type. */ getChunkModulesIterableBySourceType( chunk: Chunk, sourceType: string ): undefined | Iterable<Module>; /** * Sets chunk module source types. */ setChunkModuleSourceTypes( chunk: Chunk, module: Module, sourceTypes: ReadonlySet<string> ): void; /** * Gets chunk module source types. */ getChunkModuleSourceTypes(chunk: Chunk, module: Module): ReadonlySet<string>; /** * Gets module source types. */ getModuleSourceTypes(module: Module): ReadonlySet<string>; /** * Gets ordered chunk modules iterable. */ getOrderedChunkModulesIterable( chunk: Chunk, comparator: (a: Module, b: Module) => 0 | 1 | -1 ): Iterable<Module>; /** * Gets ordered chunk modules iterable by source type. */ getOrderedChunkModulesIterableBySourceType( chunk: Chunk, sourceType: string, comparator: (a: Module, b: Module) => 0 | 1 | -1 ): undefined | Iterable<Module>; /** * Gets chunk modules. */ getChunkModules(chunk: Chunk): Module[]; /** * Gets ordered chunk modules. */ getOrderedChunkModules( chunk: Chunk, comparator: (a: Module, b: Module) => 0 | 1 | -1 ): Module[]; /** * Gets chunk module id map. */ getChunkModuleIdMap( chunk: Chunk, filterFn: (m: Module) => boolean, includeAllChunks?: boolean ): ChunkModuleIdMapEs5Alias_2; /** * Gets chunk module rendered hash map. */ getChunkModuleRenderedHashMap( chunk: Chunk, filterFn: (m: Module) => boolean, hashLength?: number, includeAllChunks?: boolean ): ChunkModuleHashMap; /** * Gets chunk condition map. */ getChunkConditionMap( chunk: Chunk, filterFn: (c: Chunk, chunkGraph: ChunkGraph) => boolean ): ChunkConditionMap; /** * Checks whether this chunk graph contains the chunk. */ hasModuleInGraph( chunk: Chunk, filterFn: (m: Module) => boolean, filterChunkFn?: (c: Chunk, chunkGraph: ChunkGraph) => boolean ): boolean; /** * Compares the provided values and returns their ordering. */ compareChunks(chunkA: Chunk, chunkB: Chunk): 0 | 1 | -1; /** * Gets chunk modules size. */ getChunkModulesSize(chunk: Chunk): number; /** * Gets chunk modules sizes. */ getChunkModulesSizes(chunk: Chunk): Record<string, number>; /** * Gets chunk root modules. */ getChunkRootModules(chunk: Chunk): Module[]; /** * Returns total size of the chunk. */ getChunkSize(chunk: Chunk, options?: ChunkSizeOptions): number; /** * Gets integrated chunks size. */ getIntegratedChunksSize( chunkA: Chunk, chunkB: Chunk, options?: ChunkSizeOptions ): number; /** * Checks whether it can chunks be integrated. */ canChunksBeIntegrated(chunkA: Chunk, chunkB: Chunk): boolean; /** * Processes the provided chunk a. */ integrateChunks(chunkA: Chunk, chunkB: Chunk): void; /** * Upgrade dependent to full hash modules. */ upgradeDependentToFullHashModules(chunk: Chunk): void; /** * Checks whether this chunk graph is entry module in chunk. */ isEntryModuleInChunk(module: Module, chunk: Chunk): boolean; /** * Connects chunk and entry module. */ connectChunkAndEntryModule( chunk: Chunk, module: Module, entrypoint: Entrypoint ): void; /** * Connects chunk and runtime module. */ connectChunkAndRuntimeModule(chunk: Chunk, module: RuntimeModule): void; /** * Adds full hash module to chunk. */ addFullHashModuleToChunk(chunk: Chunk, module: RuntimeModule): void; /** * Adds dependent hash module to chunk. */ addDependentHashModuleToChunk(chunk: Chunk, module: RuntimeModule): void; /** * Disconnects chunk and entry module. */ disconnectChunkAndEntryModule(chunk: Chunk, module: Module): void; /** * Disconnects chunk and runtime module. */ disconnectChunkAndRuntimeModule(chunk: Chunk, module: RuntimeModule): void; /** * Disconnects entry module. */ disconnectEntryModule(module: Module): void; /** * Disconnects entries. */ disconnectEntries(chunk: Chunk): void; /** * Gets number of entry modules. */ getNumberOfEntryModules(chunk: Chunk): number; /** * Gets number of runtime modules. */ getNumberOfRuntimeModules(chunk: Chunk): number; /** * Gets chunk entry modules iterable. */ getChunkEntryModulesIterable(chunk: Chunk): Iterable<Module>; /** * Gets chunk entry dependent chunks iterable. */ getChunkEntryDependentChunksIterable(chunk: Chunk): Iterable<Chunk>; /** * Gets runtime chunk dependent chunks iterable. */ getRuntimeChunkDependentChunksIterable(chunk: Chunk): Iterable<Chunk>; /** * Checks whether this chunk graph contains the chunk. */ hasChunkEntryDependentChunks(chunk: Chunk): boolean; /** * Gets chunk runtime modules iterable. */ getChunkRuntimeModulesIterable(chunk: Chunk): Iterable<RuntimeModule>; /** * Gets chunk runtime modules in order. */ getChunkRuntimeModulesInOrder(chunk: Chunk): RuntimeModule[]; /** * Gets chunk full hash modules iterable. */ getChunkFullHashModulesIterable( chunk: Chunk ): undefined | Iterable<RuntimeModule>; /** * Gets chunk full hash modules set. */ getChunkFullHashModulesSet( chunk: Chunk ): undefined | ReadonlySet<RuntimeModule>; /** * Gets chunk dependent hash modules iterable. */ getChunkDependentHashModulesIterable( chunk: Chunk ): undefined | Iterable<RuntimeModule>; /** * Gets chunk entry modules with chunk group iterable. */ getChunkEntryModulesWithChunkGroupIterable( chunk: Chunk ): Iterable<[Module, undefined | Entrypoint]>; /** * Gets block chunk group. */ getBlockChunkGroup(depBlock: AsyncDependenciesBlock): undefined | ChunkGroup; /** * Connects block and chunk group. */ connectBlockAndChunkGroup( depBlock: AsyncDependenciesBlock, chunkGroup: ChunkGroup ): void; /** * Disconnects chunk group. */ disconnectChunkGroup(chunkGroup: ChunkGroup): void; /** * Returns the id of the module. */ getModuleId(module: Module): null | string | number; /** * Updates module id using the provided module. */ setModuleId(module: Module, id: ModuleId): void; /** * Returns the id of the runtime. */ getRuntimeId(runtime: string): RuntimeId; /** * Updates runtime id using the provided runtime. */ setRuntimeId(runtime: string, id: RuntimeId): void; /** * Checks whether this chunk graph contains the module. */ hasModuleHashes(module: Module, runtime: RuntimeSpec): boolean; /** * Returns hash. */ getModuleHash(module: Module, runtime: RuntimeSpec): string; /** * Gets rendered module hash. */ getRenderedModuleHash(module: Module, runtime: RuntimeSpec): string; /** * Sets module hashes. */ setModuleHashes( module: Module, runtime: RuntimeSpec, hash: string, renderedHash: string ): void; /** * Adds module runtime requirements. */ addModuleRuntimeRequirements( module: Module, runtime: RuntimeSpec, items: Set<string>, transferOwnership?: boolean ): void; /** * Adds chunk runtime requirements. */ addChunkRuntimeRequirements(chunk: Chunk, items: Set<string>): void; /** * Adds tree runtime requirements. */ addTreeRuntimeRequirements(chunk: Chunk, items: Iterable<string>): void; /** * Gets module runtime requirements. */ getModuleRuntimeRequirements( module: Module, runtime: RuntimeSpec ): ReadonlySet<string>; /** * Gets chunk runtime requirements. */ getChunkRuntimeRequirements(chunk: Chunk): ReadonlySet<string>; /** * Gets module graph hash.