Update duplicate-package-checker-webpack-plugin types to 2.1

This commit is contained in:
Adam Reineke
2018-06-25 15:34:12 -07:00
parent 43a9a3a482
commit 7ce769d376
2 changed files with 35 additions and 4 deletions

View File

@@ -18,7 +18,12 @@ const c: webpack.Configuration = {
plugins: [
new DuplicatePackageCheckerWebpackPlugin({
verbose: true,
emitError: true
emitError: true,
showHelp: false,
strict: false,
exclude(instance) {
return instance.name === "fbjs";
}
})
]
};

View File

@@ -1,4 +1,4 @@
// Type definitions for duplicate-package-checker-webpack-plugin 1.2
// Type definitions for duplicate-package-checker-webpack-plugin 2.1
// Project: https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin#readme
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -13,10 +13,36 @@ declare class DuplicatePackageCheckerWebpackPlugin extends Plugin {
}
declare namespace DuplicatePackageCheckerWebpackPlugin {
/** The properties of the instance of a package */
interface PackageInstanceProperties {
/** The name of the package */
name: string;
/** The version of the package */
version: string;
/** Absolute path to the package */
path: string;
/** Absolute path to the module that requested the package */
issuer?: string;
}
/** The configurable options for the plugin */
interface Options {
// Also show module that is requiring each duplicate package
/** Also show module that is requiring each duplicate package (default: false) */
verbose?: boolean;
// Emit errors instead of warnings
/** Emit errors instead of warnings (default: false) */
emitError?: boolean;
/** Show help message if duplicate packages are found (default: true) */
showHelp?: boolean;
/** Warn also if major versions differ (default: true) */
strict?: boolean;
/**
* Exclude instances of packages from the results.
* If all instances of a package are excluded, or all instances except one,
* then the package is no longer considered duplicated and won't be emitted as a warning/error.
* @param instance The instance of a package being evaluated for exclusion.
* @returns true to exclude the instance, false otherwise
*/
exclude?: (instance: PackageInstanceProperties) => boolean;
}
}