clean-webpack-plugin.d.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { Compiler, Stats, compilation as compilationType } from 'webpack';
  2. declare type Compilation = compilationType.Compilation;
  3. export interface Options {
  4. /**
  5. * Simulate the removal of files
  6. *
  7. * default: false
  8. */
  9. dry?: boolean;
  10. /**
  11. * Write Logs to Console
  12. * (Always enabled when dry is true)
  13. *
  14. * default: false
  15. */
  16. verbose?: boolean;
  17. /**
  18. * Automatically remove all unused webpack assets on rebuild
  19. *
  20. * default: true
  21. */
  22. cleanStaleWebpackAssets?: boolean;
  23. /**
  24. * Do not allow removal of current webpack assets
  25. *
  26. * default: true
  27. */
  28. protectWebpackAssets?: boolean;
  29. /**
  30. * Removes files once prior to Webpack compilation
  31. * Not included in rebuilds (watch mode)
  32. *
  33. * Use !negative patterns to exclude files
  34. *
  35. * default: ['**\/*']
  36. */
  37. cleanOnceBeforeBuildPatterns?: string[];
  38. /**
  39. * Removes files after every build (including watch mode) that match this pattern.
  40. * Used for files that are not created directly by Webpack.
  41. *
  42. * Use !negative patterns to exclude files
  43. *
  44. * default: []
  45. */
  46. cleanAfterEveryBuildPatterns?: string[];
  47. /**
  48. * Allow clean patterns outside of process.cwd()
  49. *
  50. * requires dry option to be explicitly set
  51. *
  52. * default: false
  53. */
  54. dangerouslyAllowCleanPatternsOutsideProject?: boolean;
  55. }
  56. declare class CleanWebpackPlugin {
  57. private readonly dry;
  58. private readonly verbose;
  59. private readonly cleanStaleWebpackAssets;
  60. private readonly protectWebpackAssets;
  61. private readonly cleanAfterEveryBuildPatterns;
  62. private readonly cleanOnceBeforeBuildPatterns;
  63. private readonly dangerouslyAllowCleanPatternsOutsideProject;
  64. private currentAssets;
  65. private initialClean;
  66. private outputPath;
  67. constructor(options?: Options);
  68. apply(compiler: Compiler): void;
  69. /**
  70. * Initially remove files from output directory prior to build.
  71. *
  72. * Only happens once.
  73. *
  74. * Warning: It is recommended to initially clean your build directory outside of webpack to minimize unexpected behavior.
  75. */
  76. handleInitial(compilation: Compilation): void;
  77. handleDone(stats: Stats): void;
  78. removeFiles(patterns: string[]): void;
  79. }
  80. export { CleanWebpackPlugin };
  81. //# sourceMappingURL=clean-webpack-plugin.d.ts.map