///
export default CompressionPlugin;
export type Schema = import("schema-utils/declarations/validate").Schema;
export type Compiler = import("webpack").Compiler;
export type Compilation = import("webpack").Compilation;
export type Source = import("webpack").sources.Source;
export type Asset = import("webpack").Asset;
export type WebpackError = import("webpack").WebpackError;
export type Rule = RegExp | string;
export type Rules = Rule[] | Rule;
export type CustomOptions = {
[key: string]: any;
};
export type InferDefaultType = T extends infer U ? U : CustomOptions;
export type CompressionOptions = InferDefaultType;
export type AlgorithmFunction = (
input: Buffer,
options: CompressionOptions,
callback: (error: Error, result: string | Buffer) => void
) => any;
export type PathData = {
[key: string]: any;
};
export type Filename = string | ((fileData: PathData) => string);
export type DeleteOriginalAssets = boolean | "keep-source-map";
export type BasePluginOptions = {
test?: Rules | undefined;
include?: Rules | undefined;
exclude?: Rules | undefined;
algorithm?: string | AlgorithmFunction | undefined;
compressionOptions?: InferDefaultType | undefined;
threshold?: number | undefined;
minRatio?: number | undefined;
deleteOriginalAssets?: DeleteOriginalAssets | undefined;
filename?: Filename | undefined;
};
export type InternalPluginOptions = BasePluginOptions & {
compressionOptions: CompressionOptions;
threshold: number;
minRatio: number;
deleteOriginalAssets: DeleteOriginalAssets;
filename: Filename;
};
export type ZlibOptions = import("zlib").ZlibOptions;
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").sources.Source} Source */
/** @typedef {import("webpack").Asset} Asset */
/** @typedef {import("webpack").WebpackError} WebpackError */
/** @typedef {RegExp | string} Rule */
/** @typedef {Rule[] | Rule} Rules */
/**
* @typedef {{ [key: string]: any }} CustomOptions
*/
/**
* @template T
* @typedef {T extends infer U ? U : CustomOptions} InferDefaultType
*/
/**
* @template T
* @typedef {InferDefaultType} CompressionOptions
*/
/**
* @template T
* @callback AlgorithmFunction
* @param {Buffer} input
* @param {CompressionOptions} options
* @param {(error: Error, result: string | Buffer) => void} callback
*/
/**
* @typedef {{[key: string]: any}} PathData
*/
/**
* @typedef {string | ((fileData: PathData) => string)} Filename
*/
/**
* @typedef {boolean | "keep-source-map"} DeleteOriginalAssets
*/
/**
* @template T
* @typedef {Object} BasePluginOptions
* @property {Rules} [test]
* @property {Rules} [include]
* @property {Rules} [exclude]
* @property {string | AlgorithmFunction} [algorithm]
* @property {CompressionOptions} [compressionOptions]
* @property {number} [threshold]
* @property {number} [minRatio]
* @property {DeleteOriginalAssets} [deleteOriginalAssets]
* @property {Filename} [filename]
*/
/**
* @template T
* @typedef {BasePluginOptions & { compressionOptions: CompressionOptions, threshold: number, minRatio: number, deleteOriginalAssets: DeleteOriginalAssets, filename: Filename }} InternalPluginOptions
*/
/**
* @typedef {import("zlib").ZlibOptions} ZlibOptions
*/
/**
* @template [T=ZlibOptions]
*/
declare class CompressionPlugin {
/**
* @param {BasePluginOptions} [options]
*/
constructor(options?: BasePluginOptions | undefined);
/**
* @private
* @type {InternalPluginOptions}
*/
private options;
/**
* @private
* @type {AlgorithmFunction}
*/
private algorithm;
/**
* @private
* @param {Buffer} input
* @returns {Promise}
*/
private runCompressionAlgorithm;
/**
* @private
* @param {Compiler} compiler
* @param {Compilation} compilation
* @param {Record} assets
* @returns {Promise}
*/
private compress;
/**
* @param {Compiler} compiler
* @returns {void}
*/
apply(compiler: Compiler): void;
}