react-native-flip
Version:
1,158 lines (1,065 loc) • 102 kB
TypeScript
// Type definitions for webpack 4.41
// Project: https://github.com/webpack/webpack
// Definitions by: Qubo <https://github.com/tkqubo>
// Benjamin Lim <https://github.com/bumbleblym>
// Boris Cherny <https://github.com/bcherny>
// Tommy Troy Lin <https://github.com/tommytroylin>
// Mohsen Azimi <https://github.com/mohsen1>
// Jonathan Creamer <https://github.com/jcreamer898>
// Alan Agius <https://github.com/alan-agius4>
// Dennis George <https://github.com/dennispg>
// Christophe Hurpeau <https://github.com/christophehurpeau>
// ZSkycat <https://github.com/ZSkycat>
// John Reilly <https://github.com/johnnyreilly>
// Ryan Waskiewicz <https://github.com/rwaskiewicz>
// Kyle Uehlein <https://github.com/kuehlein>
// Grgur Grisogono <https://github.com/grgur>
// Rubens Pinheiro Gonçalves Cavalcante <https://github.com/rubenspgcavalcante>
// Anders Kaseorg <https://github.com/andersk>
// Felix Haus <https://github.com/ofhouse>
// Daniel Chin <https://github.com/danielthank>
// Daiki Ihara <https://github.com/sasurau4>
// Dion Shi <https://github.com/dionshihk>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Michał Grzegorzewski <https://github.com/spamshaker>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.7
/// <reference types="node" />
import { Hash as CryptoHash } from 'crypto';
import {
Tapable,
HookMap,
SyncBailHook,
SyncHook,
SyncLoopHook,
SyncWaterfallHook,
AsyncParallelBailHook,
AsyncParallelHook,
AsyncSeriesBailHook,
AsyncSeriesHook,
AsyncSeriesWaterfallHook,
} from 'tapable';
import * as UglifyJS from 'uglify-js';
import * as anymatch from 'anymatch';
import { RawSourceMap } from 'source-map';
import { Source, ConcatSource } from 'webpack-sources';
export = webpack;
declare function webpack(
options:
| webpack.Configuration
| webpack.ConfigurationFactory,
handler: webpack.Compiler.Handler,
): webpack.Compiler.Watching | webpack.Compiler;
declare function webpack(options?: webpack.Configuration): webpack.Compiler;
declare function webpack(
options:
| webpack.Configuration[]
| webpack.MultiConfigurationFactory,
handler: webpack.MultiCompiler.Handler
): webpack.MultiWatching | webpack.MultiCompiler;
declare function webpack(options: webpack.Configuration[]): webpack.MultiCompiler;
declare namespace webpack {
/** Webpack package version. */
const version: string | undefined;
interface Configuration {
/** Enable production optimizations or development hints. */
mode?: "development" | "production" | "none" | undefined;
/** Name of the configuration. Used when loading multiple configurations. */
name?: string | undefined;
/**
* The base directory (absolute path!) for resolving the `entry` option.
* If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
*/
context?: string | undefined;
entry?: string | string[] | Entry | EntryFunc | undefined;
/** Choose a style of source mapping to enhance the debugging process. These values can affect build and rebuild speed dramatically. */
devtool?: Options.Devtool | undefined;
/** Options affecting the output. */
output?: Output | undefined;
/** Options affecting the normal modules (NormalModuleFactory) */
module?: Module | undefined;
/** Options affecting the resolving of modules. */
resolve?: Resolve | undefined;
/** Like resolve but for loaders. */
resolveLoader?: ResolveLoader | undefined;
/**
* Specify dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle.
* The kind of the dependency depends on output.libraryTarget.
*/
externals?: ExternalsElement | ExternalsElement[] | undefined;
/**
* - "web" Compile for usage in a browser-like environment (default).
* - "webworker" Compile as WebWorker.
* - "node" Compile for usage in a node.js-like environment (use require to load chunks).
* - "async-node" Compile for usage in a node.js-like environment (use fs and vm to load chunks async).
* - "node-webkit" Compile for usage in webkit, uses jsonp chunk loading but also supports builtin node.js modules plus require(“nw.gui”) (experimental)
* - "atom" Compile for usage in electron (formerly known as atom-shell), supports require for modules necessary to run Electron.
* - "electron-renderer" Compile for Electron for renderer process, providing a target using JsonpTemplatePlugin, FunctionModulePlugin for browser
* environments and NodeTargetPlugin and ExternalsPlugin for CommonJS and Electron built-in modules.
* - "electron-preload" Compile for Electron for renderer process, providing a target using NodeTemplatePlugin with asyncChunkLoading set to true,
* FunctionModulePlugin for browser environments and NodeTargetPlugin and ExternalsPlugin for CommonJS and Electron built-in modules.
* - "electron-main" Compile for Electron for main process.
* - "atom" Alias for electron-main.
* - "electron" Alias for electron-main.
*/
target?: 'web'
| 'webworker'
| 'node'
| 'async-node'
| 'node-webkit'
| 'atom'
| 'electron'
| 'electron-renderer'
| 'electron-preload'
| 'electron-main'
| ((compiler?: any) => void)
| undefined;
/** Report the first error as a hard error instead of tolerating it. */
bail?: boolean | undefined;
/** Capture timing information for each module. */
profile?: boolean | undefined;
/** Cache generated modules and chunks to improve performance for multiple incremental builds. */
cache?: boolean | object | undefined;
/** Enter watch mode, which rebuilds on file change. */
watch?: boolean | undefined;
watchOptions?: Options.WatchOptions | undefined;
/** Include polyfills or mocks for various node stuff */
node?: Node | false | undefined;
/** Set the value of require.amd and define.amd. */
amd?: { [moduleName: string]: boolean } | undefined;
/** Used for recordsInputPath and recordsOutputPath */
recordsPath?: string | undefined;
/** Load compiler state from a json file. */
recordsInputPath?: string | undefined;
/** Store compiler state to a json file. */
recordsOutputPath?: string | undefined;
/** Add additional plugins to the compiler. */
plugins?: Plugin[] | undefined;
/** Stats options for logging */
stats?: Options.Stats | undefined;
/** Performance options */
performance?: Options.Performance | false | undefined;
/** Limit the number of parallel processed modules. Can be used to fine tune performance or to get more reliable profiling results */
parallelism?: number | undefined;
/** Optimization options */
optimization?: Options.Optimization | undefined;
/** Options for infrastructure level logging */
infrastructureLogging?: Options.InfrastructureLogging | undefined;
}
interface CliConfigOptions {
config?: string | undefined;
mode?: Configuration["mode"] | undefined;
env?: string | undefined;
'config-register'?: string | undefined;
configRegister?: string | undefined;
'config-name'?: string | undefined;
configName?: string | undefined;
}
type ConfigurationFactory = ((
env: string | Record<string, boolean | number | string> | undefined,
args: CliConfigOptions,
) => Configuration | Promise<Configuration>);
type MultiConfigurationFactory = ((
env: string | Record<string, boolean | number | string> | undefined,
args: CliConfigOptions,
) => Configuration[] | Promise<Configuration[]>);
interface Entry {
[name: string]: string | string[];
}
type EntryFunc = () => (string | string[] | Entry | Promise<string | string[] | Entry>);
interface DevtoolModuleFilenameTemplateInfo {
identifier: string;
shortIdentifier: string;
resource: any;
resourcePath: string;
absoluteResourcePath: string;
allLoaders: any[];
query: string;
moduleId: string;
hash: string;
}
interface Output {
/** When used in tandem with output.library and output.libraryTarget, this option allows users to insert comments within the export wrapper. */
auxiliaryComment?: string | AuxiliaryCommentObject | undefined;
/** The filename of the entry chunk as relative path inside the output.path directory. */
filename?: string | ((chunkData: ChunkData) => string) | undefined;
/** The filename of non-entry chunks as relative path inside the output.path directory. */
chunkFilename?: string | undefined;
/** Number of milliseconds before chunk request expires, defaults to 120,000. */
chunkLoadTimeout?: number | undefined;
/** This option enables cross-origin loading of chunks. */
crossOriginLoading?: string | boolean | undefined;
/** The JSONP function used by webpack for asnyc loading of chunks. */
jsonpFunction?: string | undefined;
/** Allows customization of the script type webpack injects script tags into the DOM to download async chunks. */
jsonpScriptType?: 'text/javascript' | 'module' | undefined;
/** Filename template string of function for the sources array in a generated SourceMap. */
devtoolModuleFilenameTemplate?: string | ((info: DevtoolModuleFilenameTemplateInfo) => string) | undefined;
/** Similar to output.devtoolModuleFilenameTemplate, but used in the case of duplicate module identifiers. */
devtoolFallbackModuleFilenameTemplate?: string | ((info: DevtoolModuleFilenameTemplateInfo) => string) | undefined;
/**
* Enable line to line mapped mode for all/specified modules.
* Line to line mapped mode uses a simple SourceMap where each line of the generated source is mapped to the same line of the original source.
* It’s a performance optimization. Only use it if your performance need to be better and you are sure that input lines match which generated lines.
* true enables it for all modules (not recommended)
*/
devtoolLineToLine?: boolean | undefined;
/** This option determines the modules namespace used with the output.devtoolModuleFilenameTemplate. */
devtoolNamespace?: string | undefined;
/** The filename of the Hot Update Chunks. They are inside the output.path directory. */
hotUpdateChunkFilename?: string | undefined;
/** The JSONP function used by webpack for async loading of hot update chunks. */
hotUpdateFunction?: string | undefined;
/** The filename of the Hot Update Main File. It is inside the output.path directory. */
hotUpdateMainFilename?: string | undefined;
/** If set, export the bundle as library. output.library is the name. */
library?: string | string[] | {[key: string]: string} | undefined;
/**
* Which format to export the library:
* - "var" - Export by setting a variable: var Library = xxx (default)
* - "this" - Export by setting a property of this: this["Library"] = xxx
* - "commonjs" - Export by setting a property of exports: exports["Library"] = xxx
* - "commonjs2" - Export by setting module.exports: module.exports = xxx
* - "amd" - Export to AMD (optionally named)
* - "umd" - Export to AMD, CommonJS2 or as property in root
* - "window" - Assign to window
* - "assign" - Assign to a global variable
* - "jsonp" - Generate Webpack JSONP module
* - "system" - Generate a SystemJS module
*/
libraryTarget?: LibraryTarget | undefined;
/** Configure which module or modules will be exposed via the `libraryTarget` */
libraryExport?: string | string[] | undefined;
/** If output.libraryTarget is set to umd and output.library is set, setting this to true will name the AMD module. */
umdNamedDefine?: boolean | undefined;
/** The output directory as absolute path. */
path?: string | undefined;
/** Include comments with information about the modules. */
pathinfo?: boolean | undefined;
/** The output.path from the view of the Javascript / HTML page. */
publicPath?: string | undefined;
/** The filename of the SourceMaps for the JavaScript files. They are inside the output.path directory. */
sourceMapFilename?: string | undefined;
/** Prefixes every line of the source in the bundle with this string. */
sourcePrefix?: string | undefined;
/** The encoding to use when generating the hash, defaults to 'hex' */
hashDigest?: 'hex' | 'latin1' | 'base64' | undefined;
/** The prefix length of the hash digest to use, defaults to 20. */
hashDigestLength?: number | undefined;
/** Algorithm used for generation the hash (see node.js crypto package) */
hashFunction?: string | ((algorithm: string, options?: any) => any) | undefined;
/** An optional salt to update the hash via Node.JS' hash.update. */
hashSalt?: string | undefined;
/** An expression which is used to address the global object/scope in runtime code. */
globalObject?: string | undefined;
/**
* Use the future version of asset emitting logic, which allows freeing memory of assets after emitting.
* It could break plugins which assume that assets are still readable after they were emitted.
* @deprecated - will be removed in webpack v5.0.0 and this behaviour will become the new default.
*/
futureEmitAssets?: boolean | undefined;
}
type LibraryTarget = 'var' | 'assign' | 'this' | 'window' | 'global' | 'commonjs' | 'commonjs2' | 'amd' | 'umd' | 'jsonp' | 'system';
type AuxiliaryCommentObject = { [P in LibraryTarget]: string };
interface ChunkData {
chunk: compilation.Chunk;
}
interface Module {
/** A RegExp or an array of RegExps. Don’t parse files matching. */
noParse?: RegExp | RegExp[] | ((content: string) => boolean) | undefined;
unknownContextRequest?: string | undefined;
unknownContextRecursive?: boolean | undefined;
unknownContextRegExp?: RegExp | undefined;
unknownContextCritical?: boolean | undefined;
exprContextRequest?: string | undefined;
exprContextRegExp?: RegExp | undefined;
exprContextRecursive?: boolean | undefined;
exprContextCritical?: boolean | undefined;
wrappedContextRegExp?: RegExp | undefined;
wrappedContextRecursive?: boolean | undefined;
wrappedContextCritical?: boolean | undefined;
strictExportPresence?: boolean | undefined;
/** An array of rules applied for modules. */
rules: RuleSetRule[];
}
interface Resolve {
/**
* A list of directories to resolve modules from.
*
* Absolute paths will be searched once.
*
* If an entry is relative, will be resolved using node's resolution algorithm
* relative to the requested file.
*
* Defaults to `["node_modules"]`
*/
modules?: string[] | undefined;
/**
* A list of package description files to search for.
*
* Defaults to `["package.json"]`
*/
descriptionFiles?: string[] | undefined;
/**
* A list of fields in a package description object to use for finding
* the entry point.
*
* Defaults to `["browser", "module", "main"]` or `["module", "main"]`,
* depending on the value of the `target` `Configuration` value.
*/
mainFields?: string[] | string[][] | undefined;
/**
* A list of fields in a package description object to try to parse
* in the same format as the `alias` resolve option.
*
* Defaults to `["browser"]` or `[]`, depending on the value of the
* `target` `Configuration` value.
*
* @see alias
*/
aliasFields?: string[] | string[][] | undefined;
/**
* A list of file names to search for when requiring directories that
* don't contain a package description file.
*
* Defaults to `["index"]`.
*/
mainFiles?: string[] | undefined;
/**
* A list of file extensions to try when requesting files.
*
* An empty string is considered invalid.
*/
extensions?: string[] | undefined;
/**
* If true, requires that all requested paths must use an extension
* from `extensions`.
*/
enforceExtension?: boolean | undefined;
/**
* Replace the given module requests with other modules or paths.
*
* @see aliasFields
*/
alias?: { [key: string]: string; } | undefined;
/**
* Whether to use a cache for resolving, or the specific object
* to use for caching. Sharing objects may be useful when running
* multiple webpack compilers.
*
* Defaults to `true`.
*/
unsafeCache?: {} | boolean | undefined;
/**
* A function used to decide whether to cache the given resolve request.
*
* Defaults to `() => true`.
*/
cachePredicate?(data: { path: string, request: string }): boolean;
/**
* A list of additional resolve plugins which should be applied.
*/
plugins?: ResolvePlugin[] | undefined;
/**
* Whether to resolve symlinks to their symlinked location.
*
* Defaults to `true`
*/
symlinks?: boolean | undefined;
/**
* If unsafe cache is enabled, includes request.context in the cache key.
* This option is taken into account by the enhanced-resolve module.
* Since webpack 3.1.0 context in resolve caching is ignored when resolve or resolveLoader plugins are provided.
* This addresses a performance regression.
*/
cacheWithContext?: boolean | undefined;
/**
* A list of directories where requests of server-relative URLs
* (starting with '/') are resolved, defaults to context configuration option.
* On non-Windows systems these requests are resolved as an absolute path first.
*/
roots?: string[] | undefined;
}
interface ResolveLoader extends Resolve {
/**
* List of strings to append to a loader's name when trying to resolve it.
*/
moduleExtensions?: string[] | undefined;
enforceModuleExtension?: boolean | undefined;
}
type ExternalsElement = string | RegExp | ExternalsObjectElement | ExternalsFunctionElement;
interface ExternalsObjectElement {
[key: string]: boolean | string | string[] | Record<string, string | string[]>;
}
interface ExternalsFunctionCallback {
/**
* Invoke with no arguments to not externalize
*/
(): void;
/**
* Callback with an Error
*/
(error: {}): void; /* tslint:disable-line:unified-signatures */
/**
* Externalize the dependency
*/
(error: null, result: string | string[] | ExternalsObjectElement, type?: string): void;
}
type ExternalsFunctionElement = (context: any, request: any, callback: ExternalsFunctionCallback) => any;
interface Node {
console?: boolean | 'mock' | undefined;
process?: boolean | 'mock' | undefined;
global?: boolean | undefined;
__filename?: boolean | 'mock' | undefined;
__dirname?: boolean | 'mock' | undefined;
Buffer?: boolean | 'mock' | undefined;
setImmediate?: boolean | 'mock' | 'empty' | undefined;
[nodeBuiltin: string]: boolean | 'mock' | 'empty' | undefined;
}
interface NewLoader {
loader: string;
options?: { [name: string]: any } | undefined;
}
type Loader = string | NewLoader;
interface ParserOptions {
[optName: string]: any;
system?: boolean | undefined;
}
type RuleSetCondition =
| RegExp
| string
| ((path: string) => boolean)
| RuleSetConditions
| {
/**
* Logical AND
*/
and?: RuleSetCondition[] | undefined;
/**
* Exclude all modules matching any of these conditions
*/
exclude?: RuleSetCondition | undefined;
/**
* Exclude all modules matching not any of these conditions
*/
include?: RuleSetCondition | undefined;
/**
* Logical NOT
*/
not?: RuleSetCondition[] | undefined;
/**
* Logical OR
*/
or?: RuleSetCondition[] | undefined;
/**
* Exclude all modules matching any of these conditions
*/
test?: RuleSetCondition | undefined;
};
// A hack around circular type referencing
interface RuleSetConditions extends Array<RuleSetCondition> {}
interface RuleSetRule {
/**
* Enforce this rule as pre or post step
*/
enforce?: "pre" | "post" | undefined;
/**
* Shortcut for resource.exclude
*/
exclude?: RuleSetCondition | undefined;
/**
* Shortcut for resource.include
*/
include?: RuleSetCondition | undefined;
/**
* Match the issuer of the module (The module pointing to this module)
*/
issuer?: RuleSetCondition | undefined;
/**
* Shortcut for use.loader
*/
loader?: RuleSetUse | undefined;
/**
* Shortcut for use.loader
*/
loaders?: RuleSetUse | undefined;
/**
* Only execute the first matching rule in this array
*/
oneOf?: RuleSetRule[] | undefined;
/**
* Shortcut for use.options
*/
options?: RuleSetQuery | undefined;
/**
* Options for parsing
*/
parser?: { [k: string]: any } | undefined;
/**
* Options for the resolver
*/
resolve?: Resolve | undefined;
/**
* Flags a module as with or without side effects
*/
sideEffects?: boolean | undefined;
/**
* Shortcut for use.query
*/
query?: RuleSetQuery | undefined;
/**
* Module type to use for the module
*/
type?: "javascript/auto" | "javascript/dynamic" | "javascript/esm" | "json" | "webassembly/experimental" | undefined;
/**
* Match the resource path of the module
*/
resource?: RuleSetCondition | undefined;
/**
* Match the resource query of the module
*/
resourceQuery?: RuleSetCondition | undefined;
/**
* Match the child compiler name
*/
compiler?: RuleSetCondition | undefined;
/**
* Match and execute these rules when this rule is matched
*/
rules?: RuleSetRule[] | undefined;
/**
* Shortcut for resource.test
*/
test?: RuleSetCondition | undefined;
/**
* Modifiers applied to the module when rule is matched
*/
use?: RuleSetUse | undefined;
}
type RuleSetUse =
| RuleSetUseItem
| RuleSetUseItem[]
| ((data: any) => RuleSetUseItem | RuleSetUseItem[]);
interface RuleSetLoader {
/**
* Loader name
*/
loader?: string | undefined;
/**
* Loader options
*/
options?: RuleSetQuery | undefined;
/**
* Unique loader identifier
*/
ident?: string | undefined;
/**
* Loader query
*/
query?: RuleSetQuery | undefined;
}
type RuleSetUseItem =
| string
| RuleSetLoader
| ((data: any) => string | RuleSetLoader);
type RuleSetQuery =
| string
| { [k: string]: any };
/**
* @deprecated Use RuleSetCondition instead
*/
type Condition = RuleSetCondition;
/**
* @deprecated Use RuleSetRule instead
*/
type Rule = RuleSetRule;
namespace Options {
type Devtool = 'eval' | 'inline-source-map' | 'cheap-eval-source-map' | 'cheap-source-map' | 'cheap-module-eval-source-map' | 'cheap-module-source-map' | 'eval-source-map'
| 'source-map' | 'nosources-source-map' | 'hidden-source-map' | 'nosources-source-map' | 'inline-cheap-source-map' | 'inline-cheap-module-source-map' | '@eval'
| '@inline-source-map' | '@cheap-eval-source-map' | '@cheap-source-map' | '@cheap-module-eval-source-map' | '@cheap-module-source-map' | '@eval-source-map'
| '@source-map' | '@nosources-source-map' | '@hidden-source-map' | '@nosources-source-map' | '#eval' | '#inline-source-map' | '#cheap-eval-source-map'
| '#cheap-source-map' | '#cheap-module-eval-source-map' | '#cheap-module-source-map' | '#eval-source-map' | '#source-map' | '#nosources-source-map'
| '#hidden-source-map' | '#nosources-source-map' | '#@eval' | '#@inline-source-map' | '#@cheap-eval-source-map' | '#@cheap-source-map' | '#@cheap-module-eval-source-map'
| '#@cheap-module-source-map' | '#@eval-source-map' | '#@source-map' | '#@nosources-source-map' | '#@hidden-source-map' | '#@nosources-source-map' | boolean | string;
interface Performance {
/** This property allows webpack to control what files are used to calculate performance hints. */
assetFilter?(assetFilename: string): boolean;
/**
* Turns hints on/off. In addition, tells webpack to throw either an error or a warning when hints are
* found. This property is set to "warning" by default.
*/
hints?: 'warning' | 'error' | false | undefined;
/**
* An asset is any emitted file from webpack. This option controls when webpack emits a performance hint
* based on individual asset size. The default value is 250000 (bytes).
*/
maxAssetSize?: number | undefined;
/**
* An entrypoint represents all assets that would be utilized during initial load time for a specific entry.
* This option controls when webpack should emit performance hints based on the maximum entrypoint size.
* The default value is 250000 (bytes).
*/
maxEntrypointSize?: number | undefined;
}
type Stats = Stats.ToStringOptions;
type WatchOptions = ICompiler.WatchOptions;
interface CacheGroupsOptions {
/** Assign modules to a cache group */
test?: ((...args: any[]) => boolean) | string | RegExp | undefined;
/** Select chunks for determining cache group content (defaults to \"initial\", \"initial\" and \"all\" requires adding these chunks to the HTML) */
chunks?: "initial" | "async" | "all" | ((chunk: compilation.Chunk) => boolean) | undefined;
/** Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group */
enforce?: boolean | undefined;
/** Priority of this cache group */
priority?: number | undefined;
/** Minimal size for the created chunk */
minSize?: number | undefined;
/** Maximum size for the created chunk */
maxSize?: number | undefined;
/** Minimum number of times a module has to be duplicated until it's considered for splitting */
minChunks?: number | undefined;
/** Maximum number of requests which are accepted for on-demand loading */
maxAsyncRequests?: number | undefined;
/** Maximum number of initial chunks which are accepted for an entry point */
maxInitialRequests?: number | undefined;
/** Try to reuse existing chunk (with name) when it has matching modules */
reuseExistingChunk?: boolean | undefined;
/** Give chunks created a name (chunks with equal name are merged) */
name?: boolean | string | ((...args: any[]) => any) | undefined;
}
interface SplitChunksOptions {
/** Select chunks for determining shared modules (defaults to \"async\", \"initial\" and \"all\" requires adding these chunks to the HTML) */
chunks?: "initial" | "async" | "all" | ((chunk: compilation.Chunk) => boolean) | undefined;
/** Minimal size for the created chunk */
minSize?: number | undefined;
/** Maximum size for the created chunk */
maxSize?: number | undefined;
/** Minimum number of times a module has to be duplicated until it's considered for splitting */
minChunks?: number | undefined;
/** Maximum number of requests which are accepted for on-demand loading */
maxAsyncRequests?: number | undefined;
/** Maximum number of initial chunks which are accepted for an entry point */
maxInitialRequests?: number | undefined;
/** Give chunks created a name (chunks with equal name are merged) */
name?: boolean | string | ((...args: any[]) => any) | undefined;
/** Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks) */
cacheGroups?: false | string | ((...args: any[]) => any) | RegExp | { [key: string]: CacheGroupsOptions | false } | undefined;
/** Override the default name separator (~) when generating names automatically (name: true) */
automaticNameDelimiter?: string | undefined;
}
interface RuntimeChunkOptions {
/** The name or name factory for the runtime chunks. */
name?: string | ((...args: any[]) => any) | undefined;
}
interface Optimization {
/**
* Modules are removed from chunks when they are already available in all parent chunk groups.
* This reduces asset size. Smaller assets also result in faster builds since less code generation has to be performed.
*/
removeAvailableModules?: boolean | undefined;
/** Empty chunks are removed. This reduces load in filesystem and results in faster builds. */
removeEmptyChunks?: boolean | undefined;
/** Equal chunks are merged. This results in less code generation and faster builds. */
mergeDuplicateChunks?: boolean | undefined;
/** Chunks which are subsets of other chunks are determined and flagged in a way that subsets don’t have to be loaded when the bigger chunk has been loaded. */
flagIncludedChunks?: boolean | undefined;
/** Give more often used ids smaller (shorter) values. */
occurrenceOrder?: boolean | undefined;
/** Determine exports for each module when possible. This information is used by other optimizations or code generation. I. e. to generate more efficient code for export * from. */
providedExports?: boolean | undefined;
/**
* Determine used exports for each module. This depends on optimization.providedExports. This information is used by other optimizations or code generation.
* I. e. exports are not generated for unused exports, export names are mangled to single char identifiers when all usages are compatible.
* DCE in minimizers will benefit from this and can remove unused exports.
*/
usedExports?: boolean | undefined;
/**
* Recognise the sideEffects flag in package.json or rules to eliminate modules. This depends on optimization.providedExports and optimization.usedExports.
* These dependencies have a cost, but eliminating modules has positive impact on performance because of less code generation. It depends on your codebase.
* Try it for possible performance wins.
*/
sideEffects?: boolean | undefined;
/** Tries to find segments of the module graph which can be safely concatenated into a single module. Depends on optimization.providedExports and optimization.usedExports. */
concatenateModules?: boolean | undefined;
/** Finds modules which are shared between chunk and splits them into separate chunks to reduce duplication or separate vendor modules from application modules. */
splitChunks?: SplitChunksOptions | false | undefined;
/** Create a separate chunk for the webpack runtime code and chunk hash maps. This chunk should be inlined into the HTML */
runtimeChunk?: boolean | "single" | "multiple" | RuntimeChunkOptions | undefined;
/** Avoid emitting assets when errors occur. */
noEmitOnErrors?: boolean | undefined;
/** Instead of numeric ids, give modules readable names for better debugging. */
namedModules?: boolean | undefined;
/** Instead of numeric ids, give chunks readable names for better debugging. */
namedChunks?: boolean | undefined;
/** Tells webpack which algorithm to use when choosing module ids. Default false. */
moduleIds?: boolean | "natural" | "named" | "hashed" | "size" | "total-size" | undefined;
/** Tells webpack which algorithm to use when choosing chunk ids. Default false. */
chunkIds?: boolean | "natural" | "named" | "size" | "total-size" | undefined;
/** Defines the process.env.NODE_ENV constant to a compile-time-constant value. This allows to remove development only code from code. */
nodeEnv?: string | false | undefined;
/** Use the minimizer (optimization.minimizer, by default uglify-js) to minimize output assets. */
minimize?: boolean | undefined;
/** Minimizer(s) to use for minimizing the output */
minimizer?: Array<Plugin | Tapable.Plugin> | undefined;
/** Generate records with relative paths to be able to move the context folder". */
portableRecords?: boolean | undefined;
}
interface InfrastructureLogging {
/** Log level */
level?: "none" | "error" | "warn" | "info" | "log" | "verbose" | undefined;
/** Enable debug logging for specific loggers */
debug?: string | RegExp | ((name: string) => boolean) | Array<string | RegExp | ((name: string) => boolean)> | undefined;
}
}
/**
* @see https://webpack.js.org/api/logging/
* @since 4.39.0
*/
interface Logger {
error(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
info(message?: any, ...optionalParams: any[]): void;
log(message?: any, ...optionalParams: any[]): void;
debug(message?: any, ...optionalParams: any[]): void;
trace(message?: any, ...optionalParams: any[]): void;
group(...label: any[]): void;
groupEnd(): void;
groupCollapsed(...label: any[]): void;
status(message?: any, ...optionalParams: any[]): void;
clear(): void;
profile(label?: string): void;
profileEnd(label?: string): void;
}
namespace debug {
interface ProfilingPluginOptions {
/** A relative path to a custom output file (json) */
outputPath?: string | undefined;
}
/**
* Generate Chrome profile file which includes timings of plugins execution. Outputs `events.json` file by
* default. It is possible to provide custom file path using `outputPath` option.
*
* In order to view the profile file:
* * Run webpack with ProfilingPlugin.
* * Go to Chrome, open the Profile Tab.
* * Drag and drop generated file (events.json by default) into the profiler.
*
* It will then display timeline stats and calls per plugin!
*/
class ProfilingPlugin extends Plugin {
constructor(options?: ProfilingPluginOptions);
}
}
type LibraryExport = string | string[];
interface AssetInfo {
/**
* true, if the asset can be long term cached forever (contains a hash)
*/
immutable?: boolean | undefined;
/**
* the value(s) of the full hash used for this asset
*/
fullhash?: LibraryExport | undefined;
/**
* the value(s) of the chunk hash used for this asset
*/
chunkhash?: LibraryExport | undefined;
/**
* the value(s) of the module hash used for this asset
*/
modulehash?: LibraryExport | undefined;
/**
* the value(s) of the content hash used for this asset
*/
contenthash?: LibraryExport | undefined;
/**
* size in bytes, only set after asset has been emitted
*/
size?: number | undefined;
/**
* true, when asset is only used for development and doesn't count towards user-facing assets
*/
development?: boolean | undefined;
/**
* true, when asset ships data for updating an existing application (HMR)
*/
hotModuleReplacement?: boolean | undefined;
/**
* object of pointers to other assets, keyed by type of relation (only points from parent to child)
*/
related?: Record<string, LibraryExport> | undefined;
}
namespace compilation {
class Asset {
/**
* the filename of the asset
*/
name: string;
/**
* source of the asset
*/
source: Source;
/**
* info about the asset
*/
info: AssetInfo;
}
class DependenciesBlock {
}
class Module extends DependenciesBlock {
constructor(type: string, context?: string);
type: string;
context: string | null;
debugId: number;
hash: string | undefined;
renderedHash: string | undefined;
resolveOptions: any;
factoryMeta: any;
warnings: any[];
errors: any[];
buildMeta: any;
buildInfo: any;
reasons: any[];
_chunks: SortableSet<Chunk>;
id: number | string | null;
index: number | null;
index2: number | null;
depth: number | null;
issuer: Module | null;
profile: any;
prefetched: boolean;
built: boolean;
used: null | boolean;
usedExports: false | true | string[] | null;
optimizationBailout: string | any[];
_rewriteChunkInReasons: {
oldChunk: Chunk, newChunks: Chunk[]
} | undefined;
useSourceMap: boolean;
_source: any;
exportsArgument: string | 'exports';
moduleArgument: string | 'module';
disconnect(): void;
unseal(): void;
setChunks(chunks: Chunk[]): void;
addChunk(chunk: Chunk): boolean;
removeChunk(chunk: Chunk): boolean;
isInChunk(chunk: Chunk): boolean;
isEntryModule(): boolean;
optional: boolean;
getChunks(): Chunk[];
getNumberOfChunks: number;
chunksIterable: SortableSet<Chunk>;
hasEqualsChunks(module: Module): boolean;
addReason(module: Module, dependency: any, explanation: any): void;
removeReason(module: Module, dependency: any): boolean;
hasReasonForChunk(chunk: Chunk): boolean;
hasReasons(): boolean;
rewriteChunkInReasons(oldChunk: Chunk, newChunks: Chunk[]): void;
_doRewriteChunkInReasons(oldChunk: Chunk, newChunks: Chunk[]): void;
isUsed(exportName?: string): boolean | string;
isProvided(exportName: string): boolean | null;
toString(): string;
needRebuild(fileTimestamps: any, contextTimestamps: any): boolean;
updateHash(hash: any): void;
sortItems(sortChunks?: boolean): void;
unbuild(): void;
}
class Record {
}
class Chunk {
constructor(name?: string);
id: number | null;
ids: number[] | null;
debugId: number;
name: string;
preventIntegration: boolean;
entryModule: Module | undefined;
_modules: SortableSet<Module>;
filenameTemplate: string | undefined;
_groups: SortableSet<ChunkGroup>;
files: string[];
rendered: boolean;
hash: string | undefined;
contentHash: object;
renderedHash: string | undefined;
chunkReason: string | undefined;
extraAsync: boolean;
removedModules: any;
hasRuntime(): boolean;
canBeInitial(): boolean;
isOnlyInitial(): boolean;
hasEntryModule(): boolean;
addModule(module: Module): boolean;
removeModule(module: Module): boolean;
setModules(modules: Module[]): void;
getNumberOfModules(): number;
// Internally returns this._modules
// So it should have the same type as this._modules
modulesIterable: SortableSet<Module>;
addGroup(chunkGroup: ChunkGroup): boolean;
removeGroup(chunkGroup: ChunkGroup): boolean;
isInGroup(chunkGroup: ChunkGroup): boolean;
getNumberOfGroups(): number;
// Internally returns this._groups
// So it should have the same type as this._groups
groupsIterable: SortableSet<ChunkGroup>;
compareTo(otherChunk: Chunk): -1 | 0 | 1;
containsModule(module: Module): boolean;
getModules(): Module[];
getModulesIdent(): any[];
remove(reason?: string): void;
moveModule(module: Module, otherChunk: Chunk): void;
integrate(otherChunk: Chunk, reason: string): boolean;
split(newChunk: Chunk): void;
isEmpty(): boolean;
updateHash(hash: any): void;
canBeIntegrated(otherChunk: Chunk): boolean;
addMultiplierAndOverhead(
size: number,
options: {
chunkOverhead?: number | undefined;
entryChunkMultiplicator?: number | undefined
},
): number;
modulesSize(): number;
size(options?: {
chunkOverhead?: number | undefined;
entryChunkMultiplicator?: number | undefined
}): number;
integratedSize(otherChunk: Chunk, options: any): number | false;
sortModules(
sortByFn: (module1: Module, module2: Module) => -1 | 0 | 1
): void;
sortItems(): void;
getAllAsyncChunks(): Set<Chunk>;
getChunkMaps(realHash: boolean): {
hash: any;
contentHash: any;
name: any;
};
getChildIdsByOrders(): any;
getChildIdsByOrdersMap(includeDirectChildren?: boolean): any;
// tslint:disable-next-line:ban-types
getChunkModuleMaps(filterFn: Function): { id: any; hash: any };
hasModuleInGraph(
filterFn: (module: Module) => boolean,
filterChunkFn: (chunk: Chunk) => boolean
): boolean;
toString(): string;
}
type GroupOptions = string | { name?: string | undefined; };
class ChunkGroup {
chunks: Chunk[];
childrenIterable: SortableSet<ChunkGroup>;
parentsIterable: SortableSet<ChunkGroup>;
insertChunk(chunk: Chunk, before: Chunk): boolean;
getNumberOfChildren(): number;
setModuleIndex(module: Module, index: number): void;
getModuleIndex(module: Module): number | undefined;
setModuleIndex2(module: Module, index: number): void;
getModuleIndex2(module: Module): number | undefined;
addChild(chunk: ChunkGroup): boolean;
removeChild(chunk: ChunkGroup): boolean;
setParents(newParents: Iterable<ChunkGroup>): void;
}
class ChunkHash {
update(data: string | Buffer, inputEncoding?: string): ChunkHash;
}
interface SourcePosition {
line: number;
column?: number | undefined;
}
interface RealDependencyLocation {
start: SourcePosition;
end?: SourcePosition | undefined;
index?: number | undefined;
}
interface SynteticDependencyLocation {
name: string;
index?: number | undefined;
}
type DependencyLocation = SynteticDependencyLocation | RealDependencyLocation;
class Dependency {
constructor();
getResourceIdentifier(): any;
getReference(): any;
getExports(): any;
getWarnings(): any;
getErrors(): any;
updateHash(hash: any): void;
disconnect(): void;
static compare(a: any, b: any): any;
}
interface NormalModuleFactoryHooks {
resolver: SyncWaterfallHook;
factory: SyncWaterfallHook;
beforeResolve: AsyncSeriesWaterfallHook;
afterResolve: AsyncSeriesWaterfallHook;
createModule: SyncBailHook;
module: SyncWaterfallHook;
createParser: HookMap;
parser: HookMap<normalModuleFactory.Parser>;
createGenerator: HookMap;
generator: HookMap;
}
class NormalModuleFactory extends Tapable {
hooks: NormalModuleFactoryHooks;
}
namespace normalModuleFactory {
interface ParserHooks {
evaluateTypeof: HookMap;
evaluate: HookMap;
evaluateIdentifier: HookMap;
evaluateDefinedIdentifier: HookMap;
evaluateCallExpressionMember: HookMap;
statement: SyncBailHook;
statementIf: SyncBailHook;
label: HookMap;
import: SyncBailHook;
importSpecifier: SyncBailHook;
export: SyncBailHook;
exportImport: SyncBailHook;
exportDeclaration: SyncBailHook;
exportExpression: SyncBailHook;
exportSpecifier: SyncBailHook;
exportImportSpecifier: SyncBailHook;
varDeclaration: SyncBailHook;
varDeclarationLet: HookMap;
varDeclarationConst: HookMap;
varDeclarationVar: HookMap;
canRename: HookMap;
rename: HookMap;
assigned: HookMap;
typeof: HookMap;
importCall: SyncBailHook;
call: HookMap;
callAnyMember: HookMap;
new: HookMap;
expression: HookMap;
expressionAnyMember: HookMap;
expressionConditionalOperator: SyncBailHook;
expressionLogicalOperator: SyncBailHook;
program: SyncBailHook;
}
class Parser extends Tapable {
hooks: ParserHooks;
}
}
interface ContextModuleFactoryHooks {
beforeResolve: AsyncSeriesWaterfallHook;
afterResolve: AsyncSeriesWaterfallHook;
contextModuleFiles: SyncWaterfallHook;
alternatives: AsyncSeriesWaterfallHook;
}
class ContextModuleFactory extends Tapable {
hooks: ContextModuleFactoryHooks;
}
class DllModuleFactory extends Tapable {
hooks: {};
}
interface CompilationHooks {
buildModule: SyncHook<Module>;
rebuildModule: SyncHook<Module>;
failedModule: SyncHook<Module, Error>;
succeedModule: SyncHook<Modu