export = TerserPlugin; /** * @template [T=TerserOptions] */ declare class TerserPlugin { /** * @private * @param {any} input * @returns {boolean} */ private static isSourceMap; /** * @private * @param {unknown} warning * @param {string} file * @returns {Error} */ private static buildWarning; /** * @private * @param {any} error * @param {string} file * @param {TraceMap} [sourceMap] * @param {Compilation["requestShortener"]} [requestShortener] * @returns {Error} */ private static buildError; /** * @private * @param {Parallel} parallel * @returns {number} */ private static getAvailableNumberOfCores; /** * @private * @param {any} environment * @returns {TerserECMA} */ private static getEcmaVersion; /** * @param {BasePluginOptions & DefinedDefaultMinimizerAndOptions} [options] */ constructor( options?: | (BasePluginOptions & DefinedDefaultMinimizerAndOptions) | undefined ); /** * @private * @type {InternalPluginOptions} */ private options; /** * @private * @param {Compiler} compiler * @param {Compilation} compilation * @param {Record} assets * @param {{availableNumberOfCores: number}} optimizeOptions * @returns {Promise} */ private optimize; /** * @param {Compiler} compiler * @returns {void} */ apply(compiler: Compiler): void; } declare namespace TerserPlugin { export { terserMinify, uglifyJsMinify, swcMinify, esbuildMinify, Schema, Compiler, Compilation, WebpackError, Asset, TerserECMA, TerserOptions, JestWorker, SourceMapInput, TraceMap, Rule, Rules, ExtractCommentsFunction, ExtractCommentsCondition, ExtractCommentsFilename, ExtractCommentsBanner, ExtractCommentsObject, ExtractCommentsOptions, MinimizedResult, Input, CustomOptions, InferDefaultType, PredefinedOptions, MinimizerOptions, BasicMinimizerImplementation, MinimizeFunctionHelpers, MinimizerImplementation, InternalOptions, MinimizerWorker, Parallel, BasePluginOptions, DefinedDefaultMinimizerAndOptions, InternalPluginOptions, }; } type Compiler = import("webpack").Compiler; type BasePluginOptions = { test?: Rules | undefined; include?: Rules | undefined; exclude?: Rules | undefined; extractComments?: ExtractCommentsOptions | undefined; parallel?: Parallel; }; type DefinedDefaultMinimizerAndOptions = T extends TerserOptions ? { minify?: MinimizerImplementation | undefined; terserOptions?: MinimizerOptions | undefined; } : { minify: MinimizerImplementation; terserOptions?: MinimizerOptions | undefined; }; import { terserMinify } from "./utils"; import { uglifyJsMinify } from "./utils"; import { swcMinify } from "./utils"; import { esbuildMinify } from "./utils"; type Schema = import("schema-utils/declarations/validate").Schema; type Compilation = import("webpack").Compilation; type WebpackError = import("webpack").WebpackError; type Asset = import("webpack").Asset; type TerserECMA = import("./utils.js").TerserECMA; type TerserOptions = import("./utils.js").TerserOptions; type JestWorker = import("jest-worker").Worker; type SourceMapInput = import("@jridgewell/trace-mapping").SourceMapInput; type TraceMap = import("@jridgewell/trace-mapping").TraceMap; type Rule = RegExp | string; type Rules = Rule[] | Rule; type ExtractCommentsFunction = ( astNode: any, comment: { value: string; type: "comment1" | "comment2" | "comment3" | "comment4"; pos: number; line: number; col: number; } ) => boolean; type ExtractCommentsCondition = | boolean | "all" | "some" | RegExp | ExtractCommentsFunction; type ExtractCommentsFilename = string | ((fileData: any) => string); type ExtractCommentsBanner = | string | boolean | ((commentsFile: string) => string); type ExtractCommentsObject = { condition?: ExtractCommentsCondition | undefined; filename?: ExtractCommentsFilename | undefined; banner?: ExtractCommentsBanner | undefined; }; type ExtractCommentsOptions = ExtractCommentsCondition | ExtractCommentsObject; type MinimizedResult = { code: string; map?: import("@jridgewell/trace-mapping").SourceMapInput | undefined; errors?: (string | Error)[] | undefined; warnings?: (string | Error)[] | undefined; extractedComments?: string[] | undefined; }; type Input = { [file: string]: string; }; type CustomOptions = { [key: string]: any; }; type InferDefaultType = T extends infer U ? U : CustomOptions; type PredefinedOptions = { module?: boolean | undefined; ecma?: import("terser").ECMA | undefined; }; type MinimizerOptions = PredefinedOptions & InferDefaultType; type BasicMinimizerImplementation = ( input: Input, sourceMap: SourceMapInput | undefined, minifyOptions: MinimizerOptions, extractComments: ExtractCommentsOptions | undefined ) => Promise; type MinimizeFunctionHelpers = { getMinimizerVersion?: (() => string | undefined) | undefined; }; type MinimizerImplementation = BasicMinimizerImplementation & MinimizeFunctionHelpers; type InternalOptions = { name: string; input: string; inputSourceMap: SourceMapInput | undefined; extractComments: ExtractCommentsOptions | undefined; minimizer: { implementation: MinimizerImplementation; options: MinimizerOptions; }; }; type MinimizerWorker = import("jest-worker").Worker & { transform: (options: string) => MinimizedResult; minify: (options: InternalOptions) => MinimizedResult; }; type Parallel = undefined | boolean | number; type InternalPluginOptions = BasePluginOptions & { minimizer: { implementation: MinimizerImplementation; options: MinimizerOptions; }; }; import { minify } from "./minify";