mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
feat(webpack-clean): new type definition (#44995)
- definition file for Webpack plugin - tests https://github.com/allexcd/webpack-clean https://github.com/allexcd/webpack-clean#api Thanks!
This commit is contained in:
parent
39e59b3186
commit
0d8a27fbbd
43
types/webpack-clean/index.d.ts
vendored
Normal file
43
types/webpack-clean/index.d.ts
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
// Type definitions for webpack-clean 1.2
|
||||
// Project: https://github.com/allexcd/webpack-clean#readme
|
||||
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
declare namespace WebpackCleanPlugin {
|
||||
interface Options {
|
||||
/**
|
||||
* directory to be resolved to
|
||||
* @default null;
|
||||
*/
|
||||
basePath?: string | null;
|
||||
/**
|
||||
* specify if the .map files should be automatically removed
|
||||
* @default false
|
||||
*/
|
||||
removeMaps?: boolean;
|
||||
/**
|
||||
* specify if the files should be force deleted in case of compile errors.
|
||||
* If forceDelete is not enabled, the compile errors will be logged to stdout but the deletion of the files will not take place
|
||||
* @default false
|
||||
*/
|
||||
forceDelete?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A webpack plugin to clean specified files after build
|
||||
*/
|
||||
declare class WebpackCleanPlugin extends Plugin {
|
||||
/**
|
||||
* @param files array of files or string for a single file relative to the basePath
|
||||
* or to the context of your config (if the basePath param is not specified)
|
||||
*/
|
||||
constructor(files: string | string[], options?: WebpackCleanPlugin.Options);
|
||||
}
|
||||
|
||||
/**
|
||||
* A webpack plugin to clean specified files after build
|
||||
*/
|
||||
export = WebpackCleanPlugin;
|
||||
23
types/webpack-clean/tsconfig.json
Normal file
23
types/webpack-clean/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",
|
||||
"webpack-clean-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/webpack-clean/tslint.json
Normal file
1
types/webpack-clean/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
38
types/webpack-clean/webpack-clean-tests.ts
Normal file
38
types/webpack-clean/webpack-clean-tests.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import WebpackCleanPlugin = require('webpack-clean');
|
||||
import path = require('path');
|
||||
|
||||
module.exports = {
|
||||
context: path.join(__dirname, './'),
|
||||
entry: './src/index.js',
|
||||
output: {
|
||||
filename: 'bundle.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
},
|
||||
plugins: [new WebpackCleanPlugin(['dist/test1.js', 'dist/test2.js'])],
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
plugins: [new WebpackCleanPlugin('dist/fileA.js', { basePath: path.join(__dirname, './') })],
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
plugins: [new WebpackCleanPlugin(['fileA.js', 'fileB.js'], { basePath: path.join(__dirname, 'dist') })],
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new WebpackCleanPlugin(['fileA.js', 'fileB.js'], { basePath: path.join(__dirname, 'dist'), removeMaps: true }),
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new WebpackCleanPlugin(['fileA.js', 'fileB.js'], {
|
||||
basePath: path.join(__dirname, 'dist'),
|
||||
removeMaps: true,
|
||||
forceDelete: true,
|
||||
}),
|
||||
],
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user