UNPKG

1.04 kBTypeScriptView Raw
1import { Plugin, OutputOptions } from "rollup";
2import { partial } from "filesize";
3
4export interface FileSizeInfo {
5 minSize: string;
6 gzipSize: string;
7 brotliSize: string;
8 bundleSize: string;
9 fileName: string;
10 lastVersion?: string;
11 bundleSizeBefore?: string;
12 brotliSizeBefore?: string;
13 minSizeBefore?: string;
14 gzipSizeBefore?: string;
15}
16
17export type FileSizeRender<T> = (
18 options: FileSizeOptions,
19 outputOptions: OutputOptions,
20 info: FileSizeInfo
21) => T;
22
23export interface FileSizeOptions {
24 showMinifiedSize?: boolean;
25 showGzippedSize?: boolean;
26 showBrotliSize?: boolean;
27 showBeforeSizes?: "release" | "build" | "none";
28 format?: Parameters<typeof partial>[0];
29 render?: FileSizeRender<string>;
30 theme?: "dark" | "light";
31}
32
33export type FileSizeReporter =
34 | "boxen"
35 | FileSizeRender<string | Promise<string>>;
36
37export interface FileSizePluginOptions extends FileSizeOptions {
38 reporter?: FileSizeReporter | FileSizeReporter[];
39}
40
41declare const filesize: (options?: FileSizePluginOptions) => Plugin;
42
43export default filesize;