mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #28033 from walkerburgin/master
Add Orderable methods to webpack-chain typings
This commit is contained in:
Vendored
+15
-2
@@ -85,10 +85,14 @@ declare namespace Config {
|
||||
|
||||
class Plugins<Parent> extends TypedChainedMap<Parent, Plugin<Parent>> {}
|
||||
|
||||
class Plugin<Parent> extends ChainedMap<Parent> {
|
||||
class Plugin<Parent> extends ChainedMap<Parent> implements Orderable {
|
||||
init(value: (plugin: PluginClass, args: any[]) => webpack.Plugin): this;
|
||||
use(plugin: PluginClass, args?: any[]): this;
|
||||
tap(f: (args: any[]) => any[]): this;
|
||||
|
||||
// Orderable
|
||||
before(name: string): this;
|
||||
after(name: string): this;
|
||||
}
|
||||
|
||||
class Module extends ChainedMap<Config> {
|
||||
@@ -231,11 +235,15 @@ declare namespace Config {
|
||||
|
||||
interface LoaderOptions { [name: string]: any; }
|
||||
|
||||
class Use extends ChainedMap<Rule> {
|
||||
class Use extends ChainedMap<Rule> implements Orderable {
|
||||
loader(value: string): this;
|
||||
options(value: LoaderOptions): this;
|
||||
|
||||
tap(f: (options: LoaderOptions) => LoaderOptions): this;
|
||||
|
||||
// Orderable
|
||||
before(name: string): this;
|
||||
after(name: string): this;
|
||||
}
|
||||
|
||||
type DevTool = 'eval' | 'inline-source-map' | 'cheap-eval-source-map' | 'cheap-source-map' |
|
||||
@@ -255,4 +263,9 @@ declare namespace Config {
|
||||
interface PluginClass {
|
||||
new (...opts: any[]): webpack.Plugin;
|
||||
}
|
||||
|
||||
interface Orderable {
|
||||
before(name: string): this;
|
||||
after(name: string): this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,20 @@ config
|
||||
.use(webpack.DefinePlugin, [])
|
||||
.end()
|
||||
|
||||
.plugin('bar')
|
||||
.use(webpack.DefinePlugin, [])
|
||||
.before('foo')
|
||||
.end()
|
||||
|
||||
.plugin('baz')
|
||||
.use(webpack.DefinePlugin, [])
|
||||
.after('bar')
|
||||
.end()
|
||||
|
||||
.plugins
|
||||
.delete('foo')
|
||||
.delete('bar')
|
||||
.delete('baz')
|
||||
.end()
|
||||
|
||||
.devServer
|
||||
@@ -107,8 +119,14 @@ config
|
||||
.loader('babel-loader')
|
||||
.options({})
|
||||
.end()
|
||||
.use('eslint')
|
||||
.loader('eslint-loader')
|
||||
.options({})
|
||||
.after('babel')
|
||||
.end()
|
||||
.uses
|
||||
.delete('babel')
|
||||
.delete('eslint')
|
||||
.end()
|
||||
.pre()
|
||||
.post()
|
||||
|
||||
Reference in New Issue
Block a user