1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | export namespace Terser {
|
38 | export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
39 |
|
40 | export interface ParseOptions {
|
41 | bare_returns?: boolean
|
42 | ecma?: ECMA
|
43 | html5_comments?: boolean
|
44 | shebang?: boolean
|
45 | }
|
46 |
|
47 | export interface CompressOptions {
|
48 | arguments?: boolean
|
49 | arrows?: boolean
|
50 | booleans_as_integers?: boolean
|
51 | booleans?: boolean
|
52 | collapse_vars?: boolean
|
53 | comparisons?: boolean
|
54 | computed_props?: boolean
|
55 | conditionals?: boolean
|
56 | dead_code?: boolean
|
57 | defaults?: boolean
|
58 | directives?: boolean
|
59 | drop_console?: boolean
|
60 | drop_debugger?: boolean
|
61 | ecma?: ECMA
|
62 | evaluate?: boolean
|
63 | expression?: boolean
|
64 | global_defs?: object
|
65 | hoist_funs?: boolean
|
66 | hoist_props?: boolean
|
67 | hoist_vars?: boolean
|
68 | ie8?: boolean
|
69 | if_return?: boolean
|
70 | inline?: boolean | InlineFunctions
|
71 | join_vars?: boolean
|
72 | keep_classnames?: boolean | RegExp
|
73 | keep_fargs?: boolean
|
74 | keep_fnames?: boolean | RegExp
|
75 | keep_infinity?: boolean
|
76 | loops?: boolean
|
77 | module?: boolean
|
78 | negate_iife?: boolean
|
79 | passes?: number
|
80 | properties?: boolean
|
81 | pure_funcs?: string[]
|
82 | pure_getters?: boolean | 'strict'
|
83 | reduce_funcs?: boolean
|
84 | reduce_vars?: boolean
|
85 | sequences?: boolean | number
|
86 | side_effects?: boolean
|
87 | switches?: boolean
|
88 | toplevel?: boolean
|
89 | top_retain?: null | string | string[] | RegExp
|
90 | typeofs?: boolean
|
91 | unsafe_arrows?: boolean
|
92 | unsafe?: boolean
|
93 | unsafe_comps?: boolean
|
94 | unsafe_Function?: boolean
|
95 | unsafe_math?: boolean
|
96 | unsafe_symbols?: boolean
|
97 | unsafe_methods?: boolean
|
98 | unsafe_proto?: boolean
|
99 | unsafe_regexp?: boolean
|
100 | unsafe_undefined?: boolean
|
101 | unused?: boolean
|
102 | }
|
103 |
|
104 | export enum InlineFunctions {
|
105 | Disabled = 0,
|
106 | SimpleFunctions = 1,
|
107 | WithArguments = 2,
|
108 | WithArgumentsAndVariables = 3
|
109 | }
|
110 |
|
111 | export interface MangleOptions {
|
112 | eval?: boolean
|
113 | keep_classnames?: boolean | RegExp
|
114 | keep_fnames?: boolean | RegExp
|
115 | module?: boolean
|
116 | properties?: boolean | ManglePropertiesOptions
|
117 | reserved?: string[]
|
118 | safari10?: boolean
|
119 | toplevel?: boolean
|
120 | }
|
121 |
|
122 | export interface ManglePropertiesOptions {
|
123 | builtins?: boolean
|
124 | debug?: boolean
|
125 | keep_quoted?: boolean | 'strict'
|
126 | regex?: RegExp | string
|
127 | reserved?: string[]
|
128 | }
|
129 |
|
130 | export interface FormatOptions {
|
131 | ascii_only?: boolean
|
132 | beautify?: boolean
|
133 | braces?: boolean
|
134 | comments?:
|
135 | | boolean
|
136 | | 'all'
|
137 | | 'some'
|
138 | | RegExp
|
139 | | ((
|
140 | node: any,
|
141 | comment: {
|
142 | value: string
|
143 | type: 'comment1' | 'comment2' | 'comment3' | 'comment4'
|
144 | pos: number
|
145 | line: number
|
146 | col: number
|
147 | }
|
148 | ) => boolean)
|
149 | ecma?: ECMA
|
150 | ie8?: boolean
|
151 | indent_level?: number
|
152 | indent_start?: number
|
153 | inline_script?: boolean
|
154 | keep_quoted_props?: boolean
|
155 | max_line_len?: number | false
|
156 | preamble?: string
|
157 | preserve_annotations?: boolean
|
158 | quote_keys?: boolean
|
159 | quote_style?: OutputQuoteStyle
|
160 | safari10?: boolean
|
161 | semicolons?: boolean
|
162 | shebang?: boolean
|
163 | shorthand?: boolean
|
164 | source_map?: SourceMapOptions
|
165 | webkit?: boolean
|
166 | width?: number
|
167 | wrap_iife?: boolean
|
168 | wrap_func_args?: boolean
|
169 | }
|
170 |
|
171 | export enum OutputQuoteStyle {
|
172 | PreferDouble = 0,
|
173 | AlwaysSingle = 1,
|
174 | AlwaysDouble = 2,
|
175 | AlwaysOriginal = 3
|
176 | }
|
177 |
|
178 | export interface MinifyOptions {
|
179 | compress?: boolean | CompressOptions
|
180 | ecma?: ECMA
|
181 | ie8?: boolean
|
182 | keep_classnames?: boolean | RegExp
|
183 | keep_fnames?: boolean | RegExp
|
184 | mangle?: boolean | MangleOptions
|
185 | module?: boolean
|
186 | nameCache?: object
|
187 | format?: FormatOptions
|
188 | /** @deprecated use format instead */
|
189 | output?: FormatOptions
|
190 | parse?: ParseOptions
|
191 | safari10?: boolean
|
192 | sourceMap?: boolean | SourceMapOptions
|
193 | toplevel?: boolean
|
194 | }
|
195 |
|
196 | export interface MinifyOutput {
|
197 | code?: string
|
198 | map?: object | string
|
199 | }
|
200 |
|
201 | export interface SourceMapOptions {
|
202 |
|
203 | content?: object | string
|
204 | includeSources?: boolean
|
205 | filename?: string
|
206 | root?: string
|
207 | url?: string | 'inline'
|
208 | }
|
209 | }
|