esbuild-plugin-compress
Version:
ESBuild plugin for output compression
43 lines (40 loc) • 1.05 kB
TypeScript
import { Plugin } from 'esbuild';
import { ZlibOptions, BrotliOptions } from 'zlib';
interface CompressOptions {
/**
* enable gzip compress
* @default true
*/
gzip?: boolean;
/**
* gzip compress options passed to zlib.gzipSync
*/
gzipOptions?: ZlibOptions;
/**
* enable brotli compress
* @default true
*/
brotli?: boolean;
/**
* brotli compress options passed to zlib.brotliCompressSync
*/
brotliOptions?: BrotliOptions;
/**
* should write origin file
* @default true
*/
emitOrigin?: boolean;
/**
* the output of compressed file
* if not specified, will resolve from outdir or outfile options
*/
outputDir?: string;
/**
* exclude files from compression
* works as micromatch.isMatch(outputPath, excludePatterns) under the hood
* @default []
*/
exclude?: string | string[];
}
declare const compress: (options?: CompressOptions) => Plugin;
export { CompressOptions, compress, compress as default };