esbuild-plugin-clean
Version:
ESBuild plugin for cleaning up assets before building.
60 lines (57 loc) • 1.36 kB
TypeScript
import { Plugin } from 'esbuild';
import { Options } from 'del';
interface CleanOptions {
/**
* file clean patterns (passed to `del`)
*
* @default: []
*/
patterns?: string | string[];
/**
* file clean patterns(in onStart only) (passed to `del`)
*
* @default: []
*/
cleanOnStartPatterns?: string | string[];
/**
* file clean patterns(in onEnd only) (passed to `del`)
*
* @default: []
*/
cleanOnEndPatterns?: string | string[];
/**
* use dry-run mode to see what's going to happen
*
* this option will enable verbose option automatically
*
* @default: false
*/
dryRun?: boolean;
/**
* extra options passed to `del`
*
* @default {}
*/
options?: Options;
/**
* execute clean sync or async (use `del` or `del.sync` for cleaning up)
*
* @default: true
*/
sync?: boolean;
/**
* do cleaning in start / end / both
* maybe in some strange cases you will need it ? :P
*
* @default: "start"
*/
cleanOn?: 'start' | 'end' | 'both';
/**
* enable verbose logging to see what's happening
*
* @default false
*/
verbose?: boolean;
}
declare const clean: (options?: CleanOptions) => Plugin;
export { CleanOptions, clean, clean as default };