1 | /*
|
2 | * Copyright (c) Jupyter Development Team.
|
3 | * Distributed under the terms of the Modified BSD License.
|
4 | */
|
5 |
|
6 | // Type definitions for duplicate-package-checker-webpack-plugin 2.1
|
7 | // Project: https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin#readme
|
8 | // Definitions by: Matt Traynham <https://github.com/mtraynham>
|
9 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
10 | // TypeScript Version: 2.3
|
11 |
|
12 | // Modified to work with Webpack 5 typings by Jason Grout <https://github.com/jasongrout>
|
13 |
|
14 | /* eslint-disable @typescript-eslint/naming-convention */
|
15 |
|
16 | // Once to get a typed module first.
|
17 | declare module 'duplicate-package-checker-webpack-plugin';
|
18 |
|
19 | // Then we expand the definition with the things we use.
|
20 | declare module 'duplicate-package-checker-webpack-plugin' {
|
21 | import * as webpack from 'webpack';
|
22 |
|
23 | export = DuplicatePackageCheckerWebpackPlugin;
|
24 |
|
25 | class DuplicatePackageCheckerWebpackPlugin {
|
26 | constructor(options?: DuplicatePackageCheckerWebpackPlugin.Options);
|
27 | apply(compiler: webpack.Compiler): void;
|
28 | }
|
29 |
|
30 | namespace DuplicatePackageCheckerWebpackPlugin {
|
31 | /** The properties of the instance of a package */
|
32 | interface PackageInstanceProperties {
|
33 | /** The name of the package */
|
34 | name: string;
|
35 | /** The version of the package */
|
36 | version: string;
|
37 | /** Absolute path to the package */
|
38 | path: string;
|
39 | /** Absolute path to the module that requested the package */
|
40 | issuer?: string;
|
41 | }
|
42 |
|
43 | /** The configurable options for the plugin */
|
44 | interface Options {
|
45 | /** Also show module that is requiring each duplicate package (default: false) */
|
46 | verbose?: boolean;
|
47 | /** Emit errors instead of warnings (default: false) */
|
48 | emitError?: boolean;
|
49 | /** Show help message if duplicate packages are found (default: true) */
|
50 | showHelp?: boolean;
|
51 | /** Warn also if major versions differ (default: true) */
|
52 | strict?: boolean;
|
53 |
|
54 | /**
|
55 | * Exclude instances of packages from the results.
|
56 | * If all instances of a package are excluded, or all instances except one,
|
57 | * then the package is no longer considered duplicated and won't be emitted as a warning/error.
|
58 | * @param instance The instance of a package being evaluated for exclusion.
|
59 | * @returns true to exclude the instance, false otherwise
|
60 | */
|
61 | exclude?: (instance: PackageInstanceProperties) => boolean;
|
62 | }
|
63 | }
|
64 | }
|