mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 14:38:20 +08:00
Add babel-webpack-plugin and clean-webpack-plugin
This commit is contained in:
10
types/babel-webpack-plugin/babel-webpack-plugin-tests.ts
Normal file
10
types/babel-webpack-plugin/babel-webpack-plugin-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import BabelWebpackPlugin = require('babel-webpack-plugin');
|
||||
|
||||
new BabelWebpackPlugin();
|
||||
new BabelWebpackPlugin({});
|
||||
new BabelWebpackPlugin({
|
||||
test: /\.js$/,
|
||||
presets: ['es2015'],
|
||||
sourceMaps: false,
|
||||
compact: false
|
||||
});
|
||||
22
types/babel-webpack-plugin/index.d.ts
vendored
Normal file
22
types/babel-webpack-plugin/index.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Type definitions for clean-webpack-plugin 0.1
|
||||
// Project: https://github.com/johnagan/clean-webpack-plugin
|
||||
// Definitions by: Jed Fox <https://github.com/j-f1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
import { TransformOptions } from 'babel-core';
|
||||
|
||||
export = BabelWebpackPlugin;
|
||||
|
||||
declare class BabelWebpackPlugin extends Plugin {
|
||||
constructor(options?: BabelWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace BabelWebpackPlugin {
|
||||
type Matcher = RegExp | string | Array<RegExp | string>;
|
||||
interface Options extends TransformOptions {
|
||||
test?: Matcher;
|
||||
include?: Matcher;
|
||||
exclude?: Matcher;
|
||||
}
|
||||
}
|
||||
23
types/babel-webpack-plugin/tsconfig.json
Normal file
23
types/babel-webpack-plugin/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",
|
||||
"babel-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/babel-webpack-plugin/tslint.json
Normal file
1
types/babel-webpack-plugin/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
17
types/clean-webpack-plugin/clean-webpack-plugin-tests.ts
Normal file
17
types/clean-webpack-plugin/clean-webpack-plugin-tests.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as CleanWebpackPlugin from 'clean-webpack-plugin';
|
||||
|
||||
const paths = [
|
||||
'path',
|
||||
'glob/**/*.js',
|
||||
];
|
||||
|
||||
new CleanWebpackPlugin(paths);
|
||||
new CleanWebpackPlugin(paths, 'root-directory');
|
||||
new CleanWebpackPlugin(paths, {});
|
||||
new CleanWebpackPlugin(paths, {
|
||||
root: 'root-directory',
|
||||
verbose: true,
|
||||
dry: true,
|
||||
watch: true,
|
||||
exclude: ['a, b'],
|
||||
});
|
||||
47
types/clean-webpack-plugin/index.d.ts
vendored
Normal file
47
types/clean-webpack-plugin/index.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
// Type definitions for clean-webpack-plugin 0.1
|
||||
// Project: https://github.com/johnagan/clean-webpack-plugin
|
||||
// Definitions by: Jed Fox <https://github.com/j-f1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
export = CleanWebpackPlugin;
|
||||
|
||||
declare class CleanWebpackPlugin extends Plugin {
|
||||
/**
|
||||
* @param paths A glob or array of globs to delete
|
||||
*/
|
||||
constructor(paths: string | ReadonlyArray<string>, options?: string | CleanWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace CleanWebpackPlugin {
|
||||
interface Options {
|
||||
/**
|
||||
* Absolute path to your webpack root folder (paths appended to this)
|
||||
* Default: root of your package
|
||||
*/
|
||||
root?: string;
|
||||
/**
|
||||
* Write logs to the console.
|
||||
*/
|
||||
verbose?: boolean;
|
||||
/**
|
||||
* Set to `true` to emulate deletion without actually removing any files.
|
||||
*/
|
||||
dry?: boolean;
|
||||
/**
|
||||
* If true, remove files on recompile.
|
||||
*/
|
||||
watch?: boolean;
|
||||
/**
|
||||
* Instead of removing whole path recursively,
|
||||
* remove all path's content with exclusion of provided immediate children.
|
||||
* Good for not removing shared files from build directories.
|
||||
*/
|
||||
exclude?: ReadonlyArray<string>;
|
||||
/**
|
||||
* Allow the plugin to clean folders outside of the webpack root
|
||||
*/
|
||||
allowExternal?: boolean;
|
||||
}
|
||||
}
|
||||
23
types/clean-webpack-plugin/tsconfig.json
Normal file
23
types/clean-webpack-plugin/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",
|
||||
"clean-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/clean-webpack-plugin/tslint.json
Normal file
1
types/clean-webpack-plugin/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user