terser 3.14.0-beta → 3.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of terser might be problematic. Click here for more details.
- package/CHANGELOG.md +19 -0
- package/PATRONS.md +5 -0
- package/README.md +19 -26
- package/bin/uglifyjs +8 -10
- package/dist/bundle.js +21945 -0
- package/dist/bundle.js.map +1 -0
- package/dist/bundle.min.js +2 -0
- package/dist/bundle.min.js.map +1 -0
- package/package.json +22 -12
- package/tools/domprops.js +1 -1
- package/tools/node.js +3 -36
- package/lib/ast.js +0 -1260
- package/lib/compress.js +0 -6801
- package/lib/minify.js +0 -260
- package/lib/mozilla-ast.js +0 -1087
- package/lib/output.js +0 -1939
- package/lib/parse.js +0 -2986
- package/lib/propmangle.js +0 -267
- package/lib/scope.js +0 -723
- package/lib/sourcemap.js +0 -97
- package/lib/transform.js +0 -275
- package/lib/utils.js +0 -350
- package/tools/exports.js +0 -14
package/lib/sourcemap.js
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
/***********************************************************************
|
2
|
-
|
3
|
-
A JavaScript tokenizer / parser / beautifier / compressor.
|
4
|
-
https://github.com/mishoo/UglifyJS2
|
5
|
-
|
6
|
-
-------------------------------- (C) ---------------------------------
|
7
|
-
|
8
|
-
Author: Mihai Bazon
|
9
|
-
<mihai.bazon@gmail.com>
|
10
|
-
http://mihai.bazon.net/blog
|
11
|
-
|
12
|
-
Distributed under the BSD license:
|
13
|
-
|
14
|
-
Copyright 2012 (c) Mihai Bazon <mihai.bazon@gmail.com>
|
15
|
-
|
16
|
-
Redistribution and use in source and binary forms, with or without
|
17
|
-
modification, are permitted provided that the following conditions
|
18
|
-
are met:
|
19
|
-
|
20
|
-
* Redistributions of source code must retain the above
|
21
|
-
copyright notice, this list of conditions and the following
|
22
|
-
disclaimer.
|
23
|
-
|
24
|
-
* Redistributions in binary form must reproduce the above
|
25
|
-
copyright notice, this list of conditions and the following
|
26
|
-
disclaimer in the documentation and/or other materials
|
27
|
-
provided with the distribution.
|
28
|
-
|
29
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
|
30
|
-
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
31
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
32
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
|
33
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
34
|
-
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
35
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
36
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
37
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
38
|
-
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
39
|
-
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
40
|
-
SUCH DAMAGE.
|
41
|
-
|
42
|
-
***********************************************************************/
|
43
|
-
|
44
|
-
"use strict";
|
45
|
-
|
46
|
-
// a small wrapper around fitzgen's source-map library
|
47
|
-
function SourceMap(options) {
|
48
|
-
options = defaults(options, {
|
49
|
-
file : null,
|
50
|
-
root : null,
|
51
|
-
orig : null,
|
52
|
-
|
53
|
-
orig_line_diff : 0,
|
54
|
-
dest_line_diff : 0,
|
55
|
-
});
|
56
|
-
var generator = new MOZ_SourceMap.SourceMapGenerator({
|
57
|
-
file : options.file,
|
58
|
-
sourceRoot : options.root
|
59
|
-
});
|
60
|
-
var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig);
|
61
|
-
|
62
|
-
if (orig_map && Array.isArray(options.orig.sources)) {
|
63
|
-
orig_map._sources.toArray().forEach(function(source) {
|
64
|
-
var sourceContent = orig_map.sourceContentFor(source, true);
|
65
|
-
if (sourceContent) {
|
66
|
-
generator.setSourceContent(source, sourceContent);
|
67
|
-
}
|
68
|
-
});
|
69
|
-
}
|
70
|
-
|
71
|
-
function add(source, gen_line, gen_col, orig_line, orig_col, name) {
|
72
|
-
if (orig_map) {
|
73
|
-
var info = orig_map.originalPositionFor({
|
74
|
-
line: orig_line,
|
75
|
-
column: orig_col
|
76
|
-
});
|
77
|
-
if (info.source === null) {
|
78
|
-
return;
|
79
|
-
}
|
80
|
-
source = info.source;
|
81
|
-
orig_line = info.line;
|
82
|
-
orig_col = info.column;
|
83
|
-
name = info.name || name;
|
84
|
-
}
|
85
|
-
generator.addMapping({
|
86
|
-
generated : { line: gen_line + options.dest_line_diff, column: gen_col },
|
87
|
-
original : { line: orig_line + options.orig_line_diff, column: orig_col },
|
88
|
-
source : source,
|
89
|
-
name : name
|
90
|
-
});
|
91
|
-
}
|
92
|
-
return {
|
93
|
-
add : add,
|
94
|
-
get : function() { return generator; },
|
95
|
-
toString : function() { return JSON.stringify(generator.toJSON()); }
|
96
|
-
};
|
97
|
-
}
|
package/lib/transform.js
DELETED
@@ -1,275 +0,0 @@
|
|
1
|
-
/***********************************************************************
|
2
|
-
|
3
|
-
A JavaScript tokenizer / parser / beautifier / compressor.
|
4
|
-
https://github.com/mishoo/UglifyJS2
|
5
|
-
|
6
|
-
-------------------------------- (C) ---------------------------------
|
7
|
-
|
8
|
-
Author: Mihai Bazon
|
9
|
-
<mihai.bazon@gmail.com>
|
10
|
-
http://mihai.bazon.net/blog
|
11
|
-
|
12
|
-
Distributed under the BSD license:
|
13
|
-
|
14
|
-
Copyright 2012 (c) Mihai Bazon <mihai.bazon@gmail.com>
|
15
|
-
|
16
|
-
Redistribution and use in source and binary forms, with or without
|
17
|
-
modification, are permitted provided that the following conditions
|
18
|
-
are met:
|
19
|
-
|
20
|
-
* Redistributions of source code must retain the above
|
21
|
-
copyright notice, this list of conditions and the following
|
22
|
-
disclaimer.
|
23
|
-
|
24
|
-
* Redistributions in binary form must reproduce the above
|
25
|
-
copyright notice, this list of conditions and the following
|
26
|
-
disclaimer in the documentation and/or other materials
|
27
|
-
provided with the distribution.
|
28
|
-
|
29
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
|
30
|
-
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
31
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
32
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
|
33
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
34
|
-
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
35
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
36
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
37
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
38
|
-
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
39
|
-
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
40
|
-
SUCH DAMAGE.
|
41
|
-
|
42
|
-
***********************************************************************/
|
43
|
-
|
44
|
-
"use strict";
|
45
|
-
|
46
|
-
// Tree transformer helpers.
|
47
|
-
|
48
|
-
function TreeTransformer(before, after) {
|
49
|
-
TreeWalker.call(this);
|
50
|
-
this.before = before;
|
51
|
-
this.after = after;
|
52
|
-
}
|
53
|
-
TreeTransformer.prototype = new TreeWalker;
|
54
|
-
|
55
|
-
(function(undefined) {
|
56
|
-
|
57
|
-
function _(node, descend) {
|
58
|
-
node.DEFMETHOD("transform", function(tw, in_list) {
|
59
|
-
var x, y;
|
60
|
-
tw.push(this);
|
61
|
-
if (tw.before) x = tw.before(this, descend, in_list);
|
62
|
-
if (x === undefined) {
|
63
|
-
x = this;
|
64
|
-
descend(x, tw);
|
65
|
-
if (tw.after) {
|
66
|
-
y = tw.after(x, in_list);
|
67
|
-
if (y !== undefined) x = y;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
tw.pop();
|
71
|
-
return x;
|
72
|
-
});
|
73
|
-
}
|
74
|
-
|
75
|
-
function do_list(list, tw) {
|
76
|
-
return MAP(list, function(node) {
|
77
|
-
return node.transform(tw, true);
|
78
|
-
});
|
79
|
-
}
|
80
|
-
|
81
|
-
_(AST_Node, noop);
|
82
|
-
|
83
|
-
_(AST_LabeledStatement, function(self, tw) {
|
84
|
-
self.label = self.label.transform(tw);
|
85
|
-
self.body = self.body.transform(tw);
|
86
|
-
});
|
87
|
-
|
88
|
-
_(AST_SimpleStatement, function(self, tw) {
|
89
|
-
self.body = self.body.transform(tw);
|
90
|
-
});
|
91
|
-
|
92
|
-
_(AST_Block, function(self, tw) {
|
93
|
-
self.body = do_list(self.body, tw);
|
94
|
-
});
|
95
|
-
|
96
|
-
_(AST_Do, function(self, tw) {
|
97
|
-
self.body = self.body.transform(tw);
|
98
|
-
self.condition = self.condition.transform(tw);
|
99
|
-
});
|
100
|
-
|
101
|
-
_(AST_While, function(self, tw) {
|
102
|
-
self.condition = self.condition.transform(tw);
|
103
|
-
self.body = self.body.transform(tw);
|
104
|
-
});
|
105
|
-
|
106
|
-
_(AST_For, function(self, tw) {
|
107
|
-
if (self.init) self.init = self.init.transform(tw);
|
108
|
-
if (self.condition) self.condition = self.condition.transform(tw);
|
109
|
-
if (self.step) self.step = self.step.transform(tw);
|
110
|
-
self.body = self.body.transform(tw);
|
111
|
-
});
|
112
|
-
|
113
|
-
_(AST_ForIn, function(self, tw) {
|
114
|
-
self.init = self.init.transform(tw);
|
115
|
-
self.object = self.object.transform(tw);
|
116
|
-
self.body = self.body.transform(tw);
|
117
|
-
});
|
118
|
-
|
119
|
-
_(AST_With, function(self, tw) {
|
120
|
-
self.expression = self.expression.transform(tw);
|
121
|
-
self.body = self.body.transform(tw);
|
122
|
-
});
|
123
|
-
|
124
|
-
_(AST_Exit, function(self, tw) {
|
125
|
-
if (self.value) self.value = self.value.transform(tw);
|
126
|
-
});
|
127
|
-
|
128
|
-
_(AST_LoopControl, function(self, tw) {
|
129
|
-
if (self.label) self.label = self.label.transform(tw);
|
130
|
-
});
|
131
|
-
|
132
|
-
_(AST_If, function(self, tw) {
|
133
|
-
self.condition = self.condition.transform(tw);
|
134
|
-
self.body = self.body.transform(tw);
|
135
|
-
if (self.alternative) self.alternative = self.alternative.transform(tw);
|
136
|
-
});
|
137
|
-
|
138
|
-
_(AST_Switch, function(self, tw) {
|
139
|
-
self.expression = self.expression.transform(tw);
|
140
|
-
self.body = do_list(self.body, tw);
|
141
|
-
});
|
142
|
-
|
143
|
-
_(AST_Case, function(self, tw) {
|
144
|
-
self.expression = self.expression.transform(tw);
|
145
|
-
self.body = do_list(self.body, tw);
|
146
|
-
});
|
147
|
-
|
148
|
-
_(AST_Try, function(self, tw) {
|
149
|
-
self.body = do_list(self.body, tw);
|
150
|
-
if (self.bcatch) self.bcatch = self.bcatch.transform(tw);
|
151
|
-
if (self.bfinally) self.bfinally = self.bfinally.transform(tw);
|
152
|
-
});
|
153
|
-
|
154
|
-
_(AST_Catch, function(self, tw) {
|
155
|
-
if (self.argname) self.argname = self.argname.transform(tw);
|
156
|
-
self.body = do_list(self.body, tw);
|
157
|
-
});
|
158
|
-
|
159
|
-
_(AST_Definitions, function(self, tw) {
|
160
|
-
self.definitions = do_list(self.definitions, tw);
|
161
|
-
});
|
162
|
-
|
163
|
-
_(AST_VarDef, function(self, tw) {
|
164
|
-
self.name = self.name.transform(tw);
|
165
|
-
if (self.value) self.value = self.value.transform(tw);
|
166
|
-
});
|
167
|
-
|
168
|
-
_(AST_Destructuring, function(self, tw) {
|
169
|
-
self.names = do_list(self.names, tw);
|
170
|
-
});
|
171
|
-
|
172
|
-
_(AST_Lambda, function(self, tw) {
|
173
|
-
if (self.name) self.name = self.name.transform(tw);
|
174
|
-
self.argnames = do_list(self.argnames, tw);
|
175
|
-
if (self.body instanceof AST_Node) {
|
176
|
-
self.body = self.body.transform(tw);
|
177
|
-
} else {
|
178
|
-
self.body = do_list(self.body, tw);
|
179
|
-
}
|
180
|
-
});
|
181
|
-
|
182
|
-
_(AST_Call, function(self, tw) {
|
183
|
-
self.expression = self.expression.transform(tw);
|
184
|
-
self.args = do_list(self.args, tw);
|
185
|
-
});
|
186
|
-
|
187
|
-
_(AST_Sequence, function(self, tw) {
|
188
|
-
self.expressions = do_list(self.expressions, tw);
|
189
|
-
});
|
190
|
-
|
191
|
-
_(AST_Dot, function(self, tw) {
|
192
|
-
self.expression = self.expression.transform(tw);
|
193
|
-
});
|
194
|
-
|
195
|
-
_(AST_Sub, function(self, tw) {
|
196
|
-
self.expression = self.expression.transform(tw);
|
197
|
-
self.property = self.property.transform(tw);
|
198
|
-
});
|
199
|
-
|
200
|
-
_(AST_Yield, function(self, tw) {
|
201
|
-
if (self.expression) self.expression = self.expression.transform(tw);
|
202
|
-
});
|
203
|
-
|
204
|
-
_(AST_Await, function(self, tw) {
|
205
|
-
self.expression = self.expression.transform(tw);
|
206
|
-
});
|
207
|
-
|
208
|
-
_(AST_Unary, function(self, tw) {
|
209
|
-
self.expression = self.expression.transform(tw);
|
210
|
-
});
|
211
|
-
|
212
|
-
_(AST_Binary, function(self, tw) {
|
213
|
-
self.left = self.left.transform(tw);
|
214
|
-
self.right = self.right.transform(tw);
|
215
|
-
});
|
216
|
-
|
217
|
-
_(AST_Conditional, function(self, tw) {
|
218
|
-
self.condition = self.condition.transform(tw);
|
219
|
-
self.consequent = self.consequent.transform(tw);
|
220
|
-
self.alternative = self.alternative.transform(tw);
|
221
|
-
});
|
222
|
-
|
223
|
-
_(AST_Array, function(self, tw) {
|
224
|
-
self.elements = do_list(self.elements, tw);
|
225
|
-
});
|
226
|
-
|
227
|
-
_(AST_Object, function(self, tw) {
|
228
|
-
self.properties = do_list(self.properties, tw);
|
229
|
-
});
|
230
|
-
|
231
|
-
_(AST_ObjectProperty, function(self, tw) {
|
232
|
-
if (self.key instanceof AST_Node) {
|
233
|
-
self.key = self.key.transform(tw);
|
234
|
-
}
|
235
|
-
self.value = self.value.transform(tw);
|
236
|
-
});
|
237
|
-
|
238
|
-
_(AST_Class, function(self, tw) {
|
239
|
-
if (self.name) self.name = self.name.transform(tw);
|
240
|
-
if (self.extends) self.extends = self.extends.transform(tw);
|
241
|
-
self.properties = do_list(self.properties, tw);
|
242
|
-
});
|
243
|
-
|
244
|
-
_(AST_Expansion, function(self, tw) {
|
245
|
-
self.expression = self.expression.transform(tw);
|
246
|
-
});
|
247
|
-
|
248
|
-
_(AST_NameMapping, function(self, tw) {
|
249
|
-
self.foreign_name = self.foreign_name.transform(tw);
|
250
|
-
self.name = self.name.transform(tw);
|
251
|
-
});
|
252
|
-
|
253
|
-
_(AST_Import, function(self, tw) {
|
254
|
-
if (self.imported_name) self.imported_name = self.imported_name.transform(tw);
|
255
|
-
if (self.imported_names) do_list(self.imported_names, tw);
|
256
|
-
self.module_name = self.module_name.transform(tw);
|
257
|
-
});
|
258
|
-
|
259
|
-
_(AST_Export, function(self, tw) {
|
260
|
-
if (self.exported_definition) self.exported_definition = self.exported_definition.transform(tw);
|
261
|
-
if (self.exported_value) self.exported_value = self.exported_value.transform(tw);
|
262
|
-
if (self.exported_names) do_list(self.exported_names, tw);
|
263
|
-
if (self.module_name) self.module_name = self.module_name.transform(tw);
|
264
|
-
});
|
265
|
-
|
266
|
-
_(AST_TemplateString, function(self, tw) {
|
267
|
-
self.segments = do_list(self.segments, tw);
|
268
|
-
});
|
269
|
-
|
270
|
-
_(AST_PrefixedTemplateString, function(self, tw) {
|
271
|
-
self.prefix = self.prefix.transform(tw);
|
272
|
-
self.template_string = self.template_string.transform(tw);
|
273
|
-
});
|
274
|
-
|
275
|
-
})();
|