UNPKG

2.96 kBTypeScriptView Raw
1import { Plugin, OutputOptions } from "rollup";
2import opn from "open";
3import { TemplateType } from "./template-types";
4import { Filter } from "../shared/create-filter";
5export interface PluginVisualizerOptions {
6 /**
7 * The path to the template file to use. Or just a name of a file.
8 *
9 * @default "stats.html"
10 */
11 filename?: string;
12 /**
13 * If plugin should emit json file with visualizer data. It can be used with plugin CLI
14 *
15 * @default false
16 * @deprecated use template 'raw-data'
17 */
18 json?: boolean;
19 /**
20 * HTML <title> value in generated file. Ignored when `json` is true.
21 *
22 * @default "Rollup Visualizer"
23 */
24 title?: string;
25 /**
26 * If plugin should open browser with generated file. Ignored when `json` or `emitFile` is true.
27 *
28 * @default false
29 */
30 open?: boolean;
31 openOptions?: opn.Options;
32 /**
33 * Which diagram to generate. 'sunburst' or 'treemap' can help find big dependencies or if they are repeated.
34 * 'network' can answer you why something was included
35 *
36 * @default 'treemap'
37 */
38 template?: TemplateType;
39 /**
40 * If plugin should also calculate sizes of gzipped files.
41 *
42 * @default false
43 */
44 gzipSize?: boolean;
45 /**
46 * If plugin should also calculate sizes of brotlied files.
47 *
48 * @default false
49 */
50 brotliSize?: boolean;
51 /**
52 * If plugin should use sourcemap to calculate sizes of modules. By idea it will present more accurate results.
53 * `gzipSize` and `brotliSize` does not make much sense with this option.
54 *
55 * @default false
56 */
57 sourcemap?: boolean;
58 /**
59 * Absolute path where project is located. It is used to cut prefix from file's paths.
60 *
61 * @default process.cwd()
62 */
63 projectRoot?: string | RegExp;
64 /**
65 * Use rollup .emitFile API to generate files. Could be usefull if you want to output to configured by rollup output dir.
66 * When this set to true, filename options must be filename and not a path.
67 *
68 * @default false
69 */
70 emitFile?: boolean;
71 /**
72 * A valid picomatch pattern, or array of patterns. If options.include is omitted or has zero length, filter will return true by
73 * default. Otherwise, an ID must match one or more of the picomatch patterns, and must not match any of the options.exclude patterns.
74 */
75 include?: Filter | Filter[];
76 /**
77 * A valid picomatch pattern, or array of patterns. If options.include is omitted or has zero length, filter will return true by
78 * default. Otherwise, an ID must match one or more of the picomatch patterns, and must not match any of the options.exclude patterns.
79 */
80 exclude?: Filter | Filter[];
81}
82export declare const visualizer: (opts?: PluginVisualizerOptions | ((outputOptions: OutputOptions) => PluginVisualizerOptions)) => Plugin;
83export default visualizer;