clean-webpack-plugin.d.ts 2.3 KB

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