mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Make ExpectError locations same for TS 3.8 Error locations changed for some object literals in TS 3.8. This breaks tests that use ExpectError since the ExpectError needs to be closer to the actual error. To fix this, I merged a lot of multi-line object literals into one-line literals. * remove stray edit
71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
import { Configuration } from 'webpack';
|
|
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({
|
|
algorithm: "gzip",
|
|
cache: true,
|
|
filename: "[path].gz[query]",
|
|
minRatio: 0.8,
|
|
test: /\.js$|\.html$/,
|
|
threshold: 10240,
|
|
deleteOriginalAssets: true
|
|
})
|
|
]
|
|
};
|
|
|
|
const configDefaultAlgo = new CompressionPlugin({
|
|
compressionOptions: { level: 7 }
|
|
});
|
|
|
|
// $ExpectError
|
|
new CompressionPlugin({ asset: "[path].gz[query]" });
|
|
|
|
const zlib: Configuration = {
|
|
plugins: [
|
|
new CompressionPlugin({
|
|
algorithm: "deflate",
|
|
compressionOptions: {
|
|
flush: 5,
|
|
windowBits: 20,
|
|
level: 7
|
|
}
|
|
})
|
|
]
|
|
};
|
|
|
|
const badZlib: Configuration = {
|
|
plugins: [
|
|
// $ExpectError
|
|
new CompressionPlugin({ algorithm: "deflate", compressionOptions: 5 })
|
|
]
|
|
};
|
|
|
|
function customAlgorithm(input: string, options: number, callback: (err: Error, result: Buffer) => void) {
|
|
}
|
|
|
|
const custom: Configuration = {
|
|
plugins: [
|
|
new CompressionPlugin({
|
|
algorithm: customAlgorithm,
|
|
compressionOptions: 5
|
|
})
|
|
]
|
|
};
|
|
|
|
const badCustom: Configuration = {
|
|
plugins: [
|
|
// $ExpectError
|
|
new CompressionPlugin({ algorithm: customAlgorithm, compressionOptions: { flush: 5 } })
|
|
]
|
|
};
|