1 | import { ZlibOptions } from 'zlib';
|
2 | import { Plugin } from 'rollup';
|
3 | export type StringMappingOption = (originalString: string) => string;
|
4 | export type CustomCompressionOption = (content: string | Buffer) => string | Buffer | Promise<string | Buffer>;
|
5 | export interface GzipPluginOptions {
|
6 | |
7 |
|
8 |
|
9 |
|
10 |
|
11 | filter?: RegExp | ((fileName: string) => boolean);
|
12 | /**
|
13 | * GZIP compression options, see https://nodejs.org/api/zlib.html#zlib_class_options
|
14 | */
|
15 | gzipOptions?: ZlibOptions;
|
16 | /**
|
17 | * Specified the minimum size in Bytes for a file to get compressed.
|
18 | * Files that are smaller than this threshold will not be compressed.
|
19 | * This does not apply to the files specified through `additionalFiles`!
|
20 | */
|
21 | minSize?: number;
|
22 | /**
|
23 | * This option allows you to compress additional files outside of the main rollup bundling process.
|
24 | * The processing is delayed to make sure the files are written on disk; the delay is controlled
|
25 | * through `additionalFilesDelay`.
|
26 | */
|
27 | additionalFiles?: string[];
|
28 | /**
|
29 | * This options sets a delay (ms) before the plugin compresses the files specified through `additionalFiles`.
|
30 | * Increase this value if your artifacts take a long time to generate.
|
31 | *
|
32 | * Defaults to `0`
|
33 | */
|
34 | additionalFilesDelay?: number;
|
35 | /**
|
36 | * Set a custom compression algorithm. The function can either return the compressed contents synchronously,
|
37 | * or otherwise return a promise for asynchronous processing.
|
38 | */
|
39 | customCompression?: CustomCompressionOption;
|
40 | /**
|
41 | * Set a custom file name convention for the compressed files. Can be a suffix string or a function
|
42 | * returning the file name.
|
43 | *
|
44 | * Defaults to `.gz`
|
45 | */
|
46 | fileName?: string | StringMappingOption;
|
47 | }
|
48 | declare function gzipPlugin(explicitOptions?: GzipPluginOptions): Plugin;
|
49 | export default gzipPlugin;
|
50 |
|
\ | No newline at end of file |