mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Update webpack ProgressPlugin definition, to support both object/function options (#43375)
* Update webpack ProgressPlugin definition, to support both options of object and function. * Re-order webpack.ProgressPlugin parameter ordering to trigger CI. * Tune webpack ProgressPlugin definition for current v4 version, and also add comments. * Fix webpack ProgressPlugin default value comment for current v4 version, and also update handler function interface according to official document.
This commit is contained in:
Vendored
+40
-1
@@ -21,6 +21,7 @@
|
||||
// Felix Haus <https://github.com/ofhouse>
|
||||
// Daniel Chin <https://github.com/danielthank>
|
||||
// Daiki Ihara <https://github.com/sasurau4>
|
||||
// Dion Shi <https://github.com/dionshihk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -1832,7 +1833,45 @@ declare namespace webpack {
|
||||
}
|
||||
|
||||
class ProgressPlugin extends Plugin {
|
||||
constructor(options?: (percentage: number, msg: string, moduleProgress?: string, activeModules?: string, moduleName?: string) => void);
|
||||
constructor(options?: ProgressPlugin.Options | ProgressPlugin.Handler);
|
||||
}
|
||||
|
||||
namespace ProgressPlugin {
|
||||
/**
|
||||
* A handler function which will be called when webpack hooks report progress
|
||||
*/
|
||||
type Handler = (percentage: number, msg: string, ...args: string[]) => void;
|
||||
interface Options {
|
||||
/**
|
||||
* Show active modules count and one active module in progress message
|
||||
* Default: true
|
||||
*/
|
||||
activeModules?: boolean;
|
||||
/**
|
||||
* Show entries count in progress message
|
||||
* Default: false
|
||||
*/
|
||||
entries?: boolean;
|
||||
/**
|
||||
* Function that executes for every progress step
|
||||
*/
|
||||
handler?: Handler;
|
||||
/**
|
||||
* Show modules count in progress message
|
||||
* Default: true
|
||||
*/
|
||||
modules?: boolean;
|
||||
/**
|
||||
* Minimum modules count to start with, only for mode = modules
|
||||
* Default: 500
|
||||
*/
|
||||
modulesCount?: number;
|
||||
/**
|
||||
* Collect profile data for progress steps
|
||||
* Default: false
|
||||
*/
|
||||
profile?: boolean | null;
|
||||
}
|
||||
}
|
||||
|
||||
class EnvironmentPlugin extends Plugin {
|
||||
|
||||
@@ -508,6 +508,8 @@ plugin = new webpack.EnvironmentPlugin(['a', 'b']);
|
||||
plugin = new webpack.EnvironmentPlugin({ a: true, b: 'c' });
|
||||
plugin = new webpack.ProgressPlugin((percent: number, message: string) => { });
|
||||
plugin = new webpack.ProgressPlugin((percent: number, message: string, moduleProgress?: string, activeModules?: string, moduleName?: string) => { });
|
||||
plugin = new webpack.ProgressPlugin({ profile: true });
|
||||
plugin = new webpack.ProgressPlugin({ activeModules: true, entries: false });
|
||||
plugin = new webpack.HashedModuleIdsPlugin();
|
||||
plugin = new webpack.HashedModuleIdsPlugin({
|
||||
hashFunction: 'sha256',
|
||||
|
||||
Reference in New Issue
Block a user