mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
compression-webpack-plugin: Update options
- Add `include`/`exclude` - Remove `regExp` which was undocumented (possibly always wrong?) - Add `deleteOriginalAssets` - Prefer `ReadonlyArray` for string/regex options
This commit is contained in:
parent
3fc7e12463
commit
d747999875
@ -3,15 +3,22 @@ import CompressionPlugin = require('compression-webpack-plugin');
|
||||
|
||||
new CompressionPlugin();
|
||||
|
||||
new CompressionPlugin({
|
||||
include: ["a"] as ReadonlyArray<string>,
|
||||
exclude: [/a/g] as ReadonlyArray<RegExp>,
|
||||
test: "a",
|
||||
});
|
||||
|
||||
const config: Configuration = {
|
||||
plugins: [
|
||||
new CompressionPlugin({
|
||||
filename: "[path].gz[query]",
|
||||
algorithm: "gzip",
|
||||
cache: true,
|
||||
filename: "[path].gz[query]",
|
||||
minRatio: 0.8,
|
||||
test: /\.js$|\.html$/,
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
deleteOriginalAssets: true
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
13
types/compression-webpack-plugin/index.d.ts
vendored
13
types/compression-webpack-plugin/index.d.ts
vendored
@ -17,16 +17,19 @@ declare namespace CompressionPlugin {
|
||||
type AlgorithmCallback = (error: Error | null, result: Buffer) => void;
|
||||
type Algorithm<O> = (source: string, options: O, callback: AlgorithmCallback) => void;
|
||||
|
||||
// NOTE: These are the compression algorithms exported by zlib.
|
||||
// NOTE: These are the async compression algorithms on the zlib object.
|
||||
type ZlibAlgorithm = 'deflate' | 'deflateRaw' | 'gzip';
|
||||
type Pattern = string | RegExp | ReadonlyArray<RegExp> | ReadonlyArray<string>;
|
||||
|
||||
interface BaseOptions {
|
||||
filename?: string;
|
||||
cache?: boolean | string;
|
||||
test?: RegExp | RegExp[];
|
||||
regExp?: RegExp | RegExp[];
|
||||
threshold?: number;
|
||||
deleteOriginalAssets?: boolean;
|
||||
exclude?: Pattern;
|
||||
filename?: string;
|
||||
include?: Pattern;
|
||||
minRatio?: number;
|
||||
test?: Pattern;
|
||||
threshold?: number;
|
||||
}
|
||||
|
||||
interface ZlibOptions extends BaseOptions {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user