mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Add type definition for webpack-subresource-integrity plugin. (#30157)
This commit is contained in:
committed by
John Reilly
parent
d105be18dc
commit
3db545b2e2
28
types/webpack-subresource-integrity/index.d.ts
vendored
Normal file
28
types/webpack-subresource-integrity/index.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Type definitions for webpack-subresource-integrity 1.2
|
||||
// Project: https://github.com/waysact/webpack-subresource-integrity
|
||||
// Definitions by: Jeow Li Huan <https://github.com/huan086>
|
||||
// Definitions: https://github.com/huan086/webpack-subresource-integrity-typings
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
declare namespace WebpackSubresourceIntegrityPlugin {
|
||||
interface Options {
|
||||
/**
|
||||
* Default value: true
|
||||
* When this value is falsy, the plugin doesn't run and no integrity values are calculated. It is recommended to disable the plugin in development mode.
|
||||
*/
|
||||
enabled?: boolean;
|
||||
|
||||
/**
|
||||
* An array of strings, each specifying the name of a hash function to be used for calculating integrity hash values. For example, ['sha256', 'sha512'].
|
||||
*/
|
||||
hashFuncNames: string[];
|
||||
}
|
||||
}
|
||||
|
||||
declare class WebpackSubresourceIntegrityPlugin extends Plugin {
|
||||
constructor(options?: WebpackSubresourceIntegrityPlugin.Options);
|
||||
}
|
||||
|
||||
export = WebpackSubresourceIntegrityPlugin;
|
||||
23
types/webpack-subresource-integrity/tsconfig.json
Normal file
23
types/webpack-subresource-integrity/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"webpack-subresource-integrity-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/webpack-subresource-integrity/tslint.json
Normal file
1
types/webpack-subresource-integrity/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as webpack from 'webpack';
|
||||
import SriPlugin = require('webpack-subresource-integrity');
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
plugins: [
|
||||
new SriPlugin(),
|
||||
new SriPlugin({
|
||||
hashFuncNames: ['sha256', 'sha384']
|
||||
}),
|
||||
new SriPlugin({
|
||||
enabled: false,
|
||||
hashFuncNames: ['sha256']
|
||||
})
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user