terser 3.17.0 → 4.0.0
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 +12 -0
- package/PATRONS.md +6 -0
- package/README.md +17 -10
- package/bin/uglifyjs +10 -2
- package/dist/bundle.js +286 -444
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +1 -2
- package/dist/bundle.min.js.map +1 -1
- package/package.json +5 -4
- package/tools/node.js +14 -17
- package/tools/terser.d.ts +6 -16
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v4.0.0
|
4
|
+
|
5
|
+
- **breaking change**: The `variables` property of all scopes has become a standard JavaScript `Map` as opposed to the old bespoke `Dictionary` object.
|
6
|
+
- Typescript definitions were fixed
|
7
|
+
- `terser --help` was fixed
|
8
|
+
- The public interface was cleaned up
|
9
|
+
- Fixed optimisation of `Array` and `new Array`
|
10
|
+
- Added the `keep_quoted=strict` mode to mangle_props, which behaves more like Google Closure Compiler by mangling all unquoted property names, instead of reserving quoted property names automatically.
|
11
|
+
- Fixed parent functions' parameters being shadowed in some cases
|
12
|
+
- Allowed Terser to run in a situation where there are custom functions attached to Object.prototype
|
13
|
+
- And more bug fixes, optimisations and internal changes
|
14
|
+
|
3
15
|
## v3.17.0
|
4
16
|
|
5
17
|
- More DOM properties added to --mangle-properties's DOM property list
|
package/PATRONS.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
# Our patrons
|
2
|
+
|
3
|
+
These are the first-tier patrons from [Patreon](https://www.patreon.com/fabiosantoscode). My appreciation goes to everyone on this list for supporting the project!
|
4
|
+
|
1
5
|
* 38elements
|
6
|
+
* Alan Orozco
|
2
7
|
* CKEditor
|
8
|
+
* Mariusz Nowak
|
3
9
|
* Philippe Léger
|
4
10
|
* Piotrek Koszuliński
|
5
11
|
* Viktor Hubert
|
package/README.md
CHANGED
@@ -5,7 +5,7 @@ terser
|
|
5
5
|
|
6
6
|
A JavaScript parser and mangler/compressor toolkit for ES6+.
|
7
7
|
|
8
|
-
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/fabiosantoscode"><img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" alt="patron" width="100px" height="auto"></a>. Check out PATRONS.md for our first-tier patrons.
|
8
|
+
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/fabiosantoscode"><img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" alt="patron" width="100px" height="auto"></a>. Check out [PATRONS.md](https://github.com/terser-js/terser/blob/master/PATRONS.md) for our first-tier patrons.
|
9
9
|
|
10
10
|
Terser recommends you use RollupJS to bundle your modules, as that produces smaller code overall.
|
11
11
|
|
@@ -23,7 +23,7 @@ Why choose terser?
|
|
23
23
|
|
24
24
|
`uglify-es` is [no longer maintained](https://github.com/mishoo/UglifyJS2/issues/3156#issuecomment-392943058) and `uglify-js` does not support ES6+.
|
25
25
|
|
26
|
-
**`terser`** is a fork of `uglify-es` that retains API and CLI compatibility
|
26
|
+
**`terser`** is a fork of `uglify-es` that mostly retains API and CLI compatibility
|
27
27
|
with `uglify-es` and `uglify-js@3`.
|
28
28
|
|
29
29
|
Install
|
@@ -86,7 +86,10 @@ a double dash to prevent input files being used as option arguments:
|
|
86
86
|
`debug` Add debug prefix and suffix.
|
87
87
|
`domprops` Mangle property names that overlaps
|
88
88
|
with DOM properties.
|
89
|
-
`keep_quoted` Only mangle unquoted properties
|
89
|
+
`keep_quoted` Only mangle unquoted properties, quoted
|
90
|
+
properties are automatically reserved.
|
91
|
+
`strict` disables quoted properties
|
92
|
+
being automatically reserved.
|
90
93
|
`regex` Only mangle matched property names.
|
91
94
|
`reserved` List of names that should not be mangled.
|
92
95
|
-b, --beautify [options] Specify output options:
|
@@ -928,18 +931,21 @@ Terser.minify(code, { mangle: { toplevel: true } }).code;
|
|
928
931
|
|
929
932
|
### Mangle properties options
|
930
933
|
|
931
|
-
- `builtins` (default: `false`)
|
934
|
+
- `builtins` (default: `false`) — Use `true` to allow the mangling of builtin
|
932
935
|
DOM properties. Not recommended to override this setting.
|
933
936
|
|
934
|
-
- `debug` (default: `false`)
|
937
|
+
- `debug` (default: `false`) — Mangle names with the original name still present.
|
935
938
|
Pass an empty string `""` to enable, or a non-empty string to set the debug suffix.
|
936
939
|
|
937
|
-
- `keep_quoted` (default: `false`)
|
940
|
+
- `keep_quoted` (default: `false`) — Only mangle unquoted property names.
|
941
|
+
- `true` -- Quoted property names are automatically reserved and any unquoted
|
942
|
+
property names will not be mangled.
|
943
|
+
- `"strict"` -- Advanced, all unquoted property names are mangled unless
|
944
|
+
explicitly reserved.
|
938
945
|
|
939
|
-
- `regex` (default: `null`)
|
940
|
-
names matching the regular expression.
|
946
|
+
- `regex` (default: `null`) — Pass a [RegExp literal or pattern string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) to only mangle property matching the regular expression.
|
941
947
|
|
942
|
-
- `reserved` (default: `[]`)
|
948
|
+
- `reserved` (default: `[]`) — Do not mangle property names listed in the
|
943
949
|
`reserved` array.
|
944
950
|
|
945
951
|
## Output options
|
@@ -1298,8 +1304,9 @@ In the terser CLI we use [source-map-support](https://npmjs.com/source-map-suppo
|
|
1298
1304
|
|
1299
1305
|
# README.md Patrons:
|
1300
1306
|
|
1301
|
-
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/
|
1307
|
+
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/fabiosantoscode"><img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" alt="patron" width="100px" height="auto"></a>. Check out [PATRONS.md](https://github.com/terser-js/terser/blob/master/PATRONS.md) for our first-tier patrons.
|
1302
1308
|
|
1309
|
+
These are the second-tier patrons. Great thanks for your support!
|
1303
1310
|
|
1304
1311
|
* CKEditor 
|
1305
1312
|
* 38elements 
|
package/bin/uglifyjs
CHANGED
@@ -261,11 +261,11 @@ function run() {
|
|
261
261
|
case "variables":
|
262
262
|
case "functions":
|
263
263
|
case "globals":
|
264
|
-
return value.size
|
264
|
+
return value.size ? collect_from_map(value, symdef) : undefined;
|
265
265
|
}
|
266
266
|
if (skip_key(key)) return;
|
267
267
|
if (value instanceof UglifyJS.AST_Token) return;
|
268
|
-
if (value instanceof
|
268
|
+
if (value instanceof Map) return;
|
269
269
|
if (value instanceof UglifyJS.AST_Node) {
|
270
270
|
var result = {
|
271
271
|
_class: "AST_" + value.TYPE
|
@@ -426,6 +426,14 @@ function symdef(def) {
|
|
426
426
|
return ret;
|
427
427
|
}
|
428
428
|
|
429
|
+
function collect_from_map(map, callback) {
|
430
|
+
var result = [];
|
431
|
+
map.forEach(function (def) {
|
432
|
+
result.push(callback(def));
|
433
|
+
});
|
434
|
+
return result;
|
435
|
+
}
|
436
|
+
|
429
437
|
function format_object(obj) {
|
430
438
|
var lines = [];
|
431
439
|
var padding = "";
|