mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add definition for brotli-webpack-plugin (#42009)
This commit is contained in:
parent
d02802bd23
commit
df90a9baed
22
types/brotli-webpack-plugin/brotli-webpack-plugin-tests.ts
Normal file
22
types/brotli-webpack-plugin/brotli-webpack-plugin-tests.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import * as webpack from 'webpack';
|
||||
import BrotliWebpackPlugin = require('brotli-webpack-plugin');
|
||||
|
||||
new BrotliWebpackPlugin(); // $ExpectType BrotliWebpackPlugin
|
||||
|
||||
const optionsEmpty: BrotliWebpackPlugin.Options = {};
|
||||
|
||||
const optionsFull: BrotliWebpackPlugin.Options = {
|
||||
asset: '[path].br[query]',
|
||||
test: /\.js$/,
|
||||
threshold: 1024,
|
||||
minRatio: 0.9,
|
||||
deleteOriginalAssets: true,
|
||||
};
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
plugins: [
|
||||
new BrotliWebpackPlugin(),
|
||||
new BrotliWebpackPlugin(optionsEmpty),
|
||||
new BrotliWebpackPlugin(optionsFull),
|
||||
]
|
||||
};
|
||||
44
types/brotli-webpack-plugin/index.d.ts
vendored
Normal file
44
types/brotli-webpack-plugin/index.d.ts
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
// Type definitions for brotli-webpack-plugin 1.1
|
||||
// Project: https://github.com/mynameiswhm/brotli-webpack-plugin
|
||||
// Definitions by: Karol Majewski <https://github.com/karol-majewski>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
declare class BrotliWebpackPlugin extends webpack.Plugin {
|
||||
constructor(options?: BrotliWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace BrotliWebpackPlugin {
|
||||
interface Options {
|
||||
/**
|
||||
* The target asset name. Defaults to `'[path].br[query]'`.
|
||||
*
|
||||
* - `[file]` is replaced with the original asset file name.
|
||||
* - `[fileWithoutExt]` is replaced with the file name minus its extension, e.g. the `style` of `style.css`.
|
||||
* - `[ext]` is replaced with the file name extension, e.g. the `css` of `style.css`.
|
||||
* - `[path]` is replaced with the path of the original asset.
|
||||
* - `[query]` is replaced with the query.
|
||||
*/
|
||||
asset?: string;
|
||||
/**
|
||||
* All assets matching this RegExp are processed. Defaults to every asset.
|
||||
*/
|
||||
test?: RegExp;
|
||||
/**
|
||||
* Only assets bigger than this size (in bytes) are processed. Defaults to `0`.
|
||||
*/
|
||||
threshold?: number;
|
||||
/**
|
||||
* Only assets that compress better that this ratio are processed. Defaults to `0.8`.
|
||||
*/
|
||||
minRatio?: number;
|
||||
/**
|
||||
* Remove original files that were compressed with brotli. Default: `false`.
|
||||
*/
|
||||
deleteOriginalAssets?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = BrotliWebpackPlugin;
|
||||
23
types/brotli-webpack-plugin/tsconfig.json
Normal file
23
types/brotli-webpack-plugin/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"brotli-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/brotli-webpack-plugin/tslint.json
Normal file
1
types/brotli-webpack-plugin/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user