source: frontend/node_modules/terser/tools/terser.d.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 6.4 KB
Line 
1/// <reference lib="es2015" />
2
3import { SectionedSourceMapInput, EncodedSourceMap, DecodedSourceMap } from '@jridgewell/source-map';
4
5export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025;
6
7export type ConsoleProperty = keyof typeof console;
8type DropConsoleOption = boolean | ConsoleProperty[];
9
10export interface ParseOptions {
11 bare_returns?: boolean;
12 /** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
13 ecma?: ECMA;
14 html5_comments?: boolean;
15 shebang?: boolean;
16}
17
18export interface CompressOptions {
19 arguments?: boolean;
20 arrows?: boolean;
21 booleans_as_integers?: boolean;
22 booleans?: boolean;
23 collapse_vars?: boolean;
24 comparisons?: boolean;
25 computed_props?: boolean;
26 conditionals?: boolean;
27 dead_code?: boolean;
28 defaults?: boolean;
29 directives?: boolean;
30 drop_console?: DropConsoleOption;
31 drop_debugger?: boolean;
32 ecma?: ECMA;
33 builtins_ecma?: ECMA;
34 builtins_pure?: boolean;
35 evaluate?: boolean;
36 expression?: boolean;
37 global_defs?: object;
38 hoist_funs?: boolean;
39 hoist_props?: boolean;
40 hoist_vars?: boolean;
41 ie8?: boolean;
42 if_return?: boolean;
43 inline?: boolean | InlineFunctions;
44 join_vars?: boolean;
45 keep_classnames?: boolean | RegExp;
46 keep_fargs?: boolean;
47 keep_fnames?: boolean | RegExp;
48 keep_infinity?: boolean;
49 lhs_constants?: boolean;
50 loops?: boolean;
51 module?: boolean;
52 negate_iife?: boolean;
53 passes?: number;
54 properties?: boolean;
55 pure_funcs?: string[];
56 pure_new?: boolean;
57 pure_getters?: boolean | 'strict';
58 reduce_funcs?: boolean;
59 reduce_vars?: boolean;
60 sequences?: boolean | number;
61 side_effects?: boolean;
62 switches?: boolean;
63 toplevel?: boolean;
64 top_retain?: null | string | string[] | RegExp;
65 typeofs?: boolean;
66 unsafe_arrows?: boolean;
67 unsafe?: boolean;
68 unsafe_comps?: boolean;
69 unsafe_Function?: boolean;
70 unsafe_math?: boolean;
71 unsafe_symbols?: boolean;
72 unsafe_methods?: boolean;
73 unsafe_proto?: boolean;
74 unsafe_regexp?: boolean;
75 unsafe_undefined?: boolean;
76 unused?: boolean;
77}
78
79export enum InlineFunctions {
80 Disabled = 0,
81 SimpleFunctions = 1,
82 WithArguments = 2,
83 WithArgumentsAndVariables = 3
84}
85
86export interface MangleOptions {
87 eval?: boolean;
88 keep_classnames?: boolean | RegExp;
89 keep_fnames?: boolean | RegExp;
90 module?: boolean;
91 nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler;
92 properties?: boolean | ManglePropertiesOptions;
93 reserved?: string[];
94 safari10?: boolean;
95 toplevel?: boolean;
96}
97
98/**
99 * An identifier mangler for which the output is invariant with respect to the source code.
100 */
101export interface SimpleIdentifierMangler {
102 /**
103 * Obtains the nth most favored (usually shortest) identifier to rename a variable to.
104 * The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word.
105 * This function is expected to be stable; Evaluating get(n) === get(n) should always return true.
106 * @param n The ordinal of the identifier.
107 */
108 get(n: number): string;
109}
110
111/**
112 * An identifier mangler that leverages character frequency analysis to determine identifier precedence.
113 */
114export interface WeightedIdentifierMangler extends SimpleIdentifierMangler {
115 /**
116 * Modifies the internal weighting of the input characters by the specified delta.
117 * Will be invoked on the entire printed AST, and then deduct mangleable identifiers.
118 * @param chars The characters to modify the weighting of.
119 * @param delta The numeric weight to add to the characters.
120 */
121 consider(chars: string, delta: number): number;
122 /**
123 * Resets character weights.
124 */
125 reset(): void;
126 /**
127 * Sorts identifiers by character frequency, in preparation for calls to get(n).
128 */
129 sort(): void;
130}
131
132export interface ManglePropertiesOptions {
133 builtins?: boolean;
134 debug?: boolean;
135 keep_quoted?: boolean | 'strict';
136 nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler;
137 regex?: RegExp | string;
138 reserved?: string[];
139}
140
141export interface FormatOptions {
142 ascii_only?: boolean;
143 /** @deprecated Not implemented anymore */
144 beautify?: boolean;
145 braces?: boolean;
146 comments?: boolean | 'all' | 'some' | RegExp | ( (node: any, comment: {
147 value: string,
148 type: 'comment1' | 'comment2' | 'comment3' | 'comment4',
149 pos: number,
150 line: number,
151 col: number,
152 }) => boolean );
153 ecma?: ECMA;
154 ie8?: boolean;
155 keep_numbers?: boolean;
156 indent_level?: number;
157 indent_start?: number;
158 inline_script?: boolean;
159 keep_quoted_props?: boolean;
160 max_line_len?: number | false;
161 preamble?: string;
162 preserve_annotations?: boolean;
163 quote_keys?: boolean;
164 quote_style?: OutputQuoteStyle;
165 safari10?: boolean;
166 semicolons?: boolean;
167 shebang?: boolean;
168 shorthand?: boolean;
169 source_map?: SourceMapOptions;
170 webkit?: boolean;
171 width?: number;
172 wrap_iife?: boolean;
173 wrap_func_args?: boolean;
174}
175
176export enum OutputQuoteStyle {
177 PreferDouble = 0,
178 AlwaysSingle = 1,
179 AlwaysDouble = 2,
180 AlwaysOriginal = 3
181}
182
183export interface MinifyOptions {
184 compress?: boolean | CompressOptions;
185 ecma?: ECMA;
186 enclose?: boolean | string;
187 ie8?: boolean;
188 keep_classnames?: boolean | RegExp;
189 keep_fnames?: boolean | RegExp;
190 mangle?: boolean | MangleOptions;
191 module?: boolean;
192 nameCache?: object;
193 format?: FormatOptions;
194 /** @deprecated */
195 output?: FormatOptions;
196 parse?: ParseOptions;
197 safari10?: boolean;
198 sourceMap?: boolean | SourceMapOptions;
199 toplevel?: boolean;
200}
201
202export interface MinifyOutput {
203 code?: string;
204 map?: EncodedSourceMap | string;
205 decoded_map?: DecodedSourceMap | null;
206}
207
208export interface SourceMapOptions {
209 /** Source map object, 'inline' or source map file content */
210 content?: SectionedSourceMapInput | string;
211 includeSources?: boolean;
212 filename?: string;
213 root?: string;
214 asObject?: boolean;
215 url?: string | 'inline';
216}
217
218export function minify(files: string | string[] | { [file: string]: string }, options?: MinifyOptions): Promise<MinifyOutput>;
219export function minify_sync(files: string | string[] | { [file: string]: string }, options?: MinifyOptions): MinifyOutput;
Note: See TracBrowser for help on using the repository browser.