terser 3.13.0 → 3.14.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/README.md +9 -23
- package/bin/uglifyjs +0 -3
- package/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -1
- package/lib/compress.js +37 -5
- package/lib/output.js +1 -8
- package/lib/propmangle.js +5 -3
- package/lib/utils.js +1 -0
- package/package.json +3 -3
- package/tools/{domprops.json → domprops.js} +1 -1
- package/tools/node.js +1 -0
- package/tools/props.html +1 -1
package/README.md
CHANGED
@@ -3,13 +3,15 @@ terser
|
|
3
3
|
|
4
4
|

|
5
5
|
|
6
|
+
A JavaScript parser and mangler/compressor toolkit for ES6+.
|
7
|
+
|
6
8
|
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/terser_jscomp_maintainer"><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.
|
7
|
-
=======
|
8
|
-
*Note:* Support this project with patreon by clicking [here](https://www.patreon.com/terser_jscomp_maintainer) and becoming a patron.
|
9
9
|
|
10
|
-
|
10
|
+
Terser recommends you use RollupJS to bundle your modules, as that produces smaller code overall.
|
11
|
+
|
12
|
+
*Beautification* has been undocumented and is *being removed* from terser, we recommend you use [prettier](https://npmjs.com/package/prettier).
|
11
13
|
|
12
|
-
|
14
|
+
[](https://travis-ci.org/terser-js/terser) [](https://coveralls.io/github/terser-js/terser?branch=master)
|
13
15
|
|
14
16
|
|
15
17
|
Why choose terser?
|
@@ -83,8 +85,6 @@ a double dash to prevent input files being used as option arguments:
|
|
83
85
|
`keep_quoted` Only mangle unquoted properties.
|
84
86
|
`regex` Only mangle matched property names.
|
85
87
|
`reserved` List of names that should not be mangled.
|
86
|
-
-b, --beautify [options] Beautify output/specify output options:
|
87
|
-
`beautify` Enabled with `--beautify` by default.
|
88
88
|
`preamble` Preamble to prepend to the output. You
|
89
89
|
can use this to insert a comment, for
|
90
90
|
example for licensing information.
|
@@ -237,7 +237,7 @@ to prevent the `require`, `exports` and `$` names from being changed.
|
|
237
237
|
|
238
238
|
### CLI mangling property names (`--mangle-props`)
|
239
239
|
|
240
|
-
**Note:** THIS
|
240
|
+
**Note:** THIS *MIGHT* BREAK YOUR CODE. Mangling property names
|
241
241
|
is a separate step, different from variable name mangling. Pass
|
242
242
|
`--mangle-props` to enable it. It will mangle all properties in the
|
243
243
|
input code with the exception of built in DOM properties and properties
|
@@ -459,7 +459,6 @@ var options = {
|
|
459
459
|
passes: 2
|
460
460
|
},
|
461
461
|
output: {
|
462
|
-
beautify: false,
|
463
462
|
preamble: "/* minified */"
|
464
463
|
}
|
465
464
|
};
|
@@ -917,18 +916,12 @@ Terser.minify(code, { mangle: { toplevel: true } }).code;
|
|
917
916
|
|
918
917
|
## Output options
|
919
918
|
|
920
|
-
The code generator tries to output shortest code possible
|
921
|
-
case you want beautified output, pass `--beautify` (`-b`). Optionally you
|
919
|
+
The code generator tries to output shortest code possible. Optionally you
|
922
920
|
can pass additional arguments that control the code output:
|
923
921
|
|
924
922
|
- `ascii_only` (default `false`) -- escape Unicode characters in strings and
|
925
923
|
regexps (affects directives with non-ascii characters becoming invalid)
|
926
924
|
|
927
|
-
- `beautify` (default `true`) -- whether to actually beautify the output.
|
928
|
-
Passing `-b` will set this to true, but you might need to pass `-b` even
|
929
|
-
when you want to generate minified code, in order to specify additional
|
930
|
-
arguments, so you can use `-b beautify=false` to override it.
|
931
|
-
|
932
925
|
- `braces` (default `false`) -- always insert braces in `if`, `for`,
|
933
926
|
`do`, `while` or `with` statements, even if their body is a single
|
934
927
|
statement.
|
@@ -939,8 +932,7 @@ can pass additional arguments that control the code output:
|
|
939
932
|
|
940
933
|
- `ecma` (default `5`) -- set output printing mode. Set `ecma` to `6` or
|
941
934
|
greater to emit shorthand object properties - i.e.: `{a}` instead of `{a: a}`.
|
942
|
-
|
943
|
-
beautifier. Non-compatible features in the abstract syntax tree will still
|
935
|
+
Non-compatible features in the abstract syntax tree will still
|
944
936
|
be output as is. For example: an `ecma` setting of `5` will **not** convert
|
945
937
|
ES6+ code to ES5.
|
946
938
|
|
@@ -986,12 +978,6 @@ can pass additional arguments that control the code output:
|
|
986
978
|
- `webkit` (default `false`) -- enable workarounds for WebKit bugs.
|
987
979
|
PhantomJS users should set this option to `true`.
|
988
980
|
|
989
|
-
- `width` (default `80`) -- only takes effect when beautification is on, this
|
990
|
-
specifies an (orientative) line width that the beautifier will try to
|
991
|
-
obey. It refers to the width of the line text (excluding indentation).
|
992
|
-
It doesn't work very well currently, but it does make the code generated
|
993
|
-
by Terser more readable.
|
994
|
-
|
995
981
|
- `wrap_iife` (default `false`) -- pass `true` to wrap immediately invoked
|
996
982
|
function expressions. See
|
997
983
|
[#640](https://github.com/mishoo/UglifyJS2/issues/640) for more details.
|
package/bin/uglifyjs
CHANGED
@@ -120,9 +120,6 @@ if (program.mangleProps) {
|
|
120
120
|
} else {
|
121
121
|
if (typeof program.mangleProps != "object") program.mangleProps = {};
|
122
122
|
if (!Array.isArray(program.mangleProps.reserved)) program.mangleProps.reserved = [];
|
123
|
-
require("../tools/domprops.json").forEach(function(name) {
|
124
|
-
UglifyJS.push_uniq(program.mangleProps.reserved, name);
|
125
|
-
});
|
126
123
|
}
|
127
124
|
if (typeof options.mangle != "object") options.mangle = {};
|
128
125
|
options.mangle.properties = program.mangleProps;
|