mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Add type definitions for webpack-chunk-hash plugin (#20145)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
ab5cdaf0ac
commit
4603024201
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for webpack-chunk-hash 0.4
|
||||
// Project: https://github.com/alexindigo/webpack-chunk-hash#readme
|
||||
// Definitions by: Matt Traynham <https://github.com/mtraynham>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import webpack = require('webpack');
|
||||
|
||||
export = WebpackChunkHash;
|
||||
|
||||
declare class WebpackChunkHash extends webpack.Plugin {
|
||||
constructor(options?: WebpackChunkHash.Options);
|
||||
}
|
||||
|
||||
declare namespace WebpackChunkHash {
|
||||
interface Options {
|
||||
/**
|
||||
* @default 'md5'
|
||||
* @description The hash algorithm to use
|
||||
* @see {@link https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options}
|
||||
*/
|
||||
algorithm?: string;
|
||||
/**
|
||||
* @default 'hex'
|
||||
* @description The digest enconding to use
|
||||
* @see {@link https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options}
|
||||
*/
|
||||
digest?: 'hex' | 'latin1' | 'base64';
|
||||
/**
|
||||
* @default null
|
||||
* @description A callback to add more content to the resulting hash
|
||||
*/
|
||||
additionalHashContent?(chunk: any): string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"webpack-chunk-hash-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,15 @@
|
||||
import webpack = require('webpack');
|
||||
import WebpackChunkHashPlugin = require('webpack-chunk-hash');
|
||||
|
||||
const a: webpack.Configuration = {
|
||||
entry: 'test.js',
|
||||
plugins: [
|
||||
new WebpackChunkHashPlugin()
|
||||
]
|
||||
};
|
||||
const b: webpack.Configuration = {
|
||||
entry: 'test.js',
|
||||
plugins: [
|
||||
new WebpackChunkHashPlugin({algorithm: 'sha-256', digest: 'latin1', additionalHashContent: () => 'test'})
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user