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/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## v3.16.1
|
4
|
+
|
5
|
+
- Fixed issue where Terser being imported with `import` would cause it not to work due to the `__esModule` property.
|
6
|
+
|
7
|
+
## v3.16.0
|
8
|
+
|
9
|
+
- No longer leaves names like Array or Object or window as a SimpleStatement (statement which is just a single expression).
|
10
|
+
- Add support for sections sourcemaps (IndexedSourceMapConsumer)
|
11
|
+
- Drops node.js v4 and starts using commonJS
|
12
|
+
- Is now built with rollup
|
13
|
+
|
14
|
+
## v3.15.0
|
15
|
+
|
16
|
+
- Inlined spread syntax (`[...[1, 2, 3], 4, 5] => [1, 2, 3, 4, 5]`) in arrays and objects.
|
17
|
+
- Fixed typo in compressor warning
|
18
|
+
- Fixed inline source map input bug
|
19
|
+
- Fixed parsing of template literals with unnecessary escapes (Like `\\a`)
|
package/PATRONS.md
ADDED
package/README.md
CHANGED
@@ -3,13 +3,17 @@ terser
|
|
3
3
|
|
4
4
|

|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
*
|
6
|
+
A JavaScript parser and mangler/compressor toolkit for ES6+.
|
7
|
+
|
8
|
+
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/terser_ecmacomp_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.
|
9
|
+
|
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).
|
9
13
|
|
10
14
|
[](https://travis-ci.org/terser-js/terser) [](https://coveralls.io/github/terser-js/terser?branch=master)
|
11
15
|
|
12
|
-
|
16
|
+
Find the changelog in [CHANGELOG.md](https://github.com/terser-js/terser/blob/master/CHANGELOG.md)
|
13
17
|
|
14
18
|
|
15
19
|
Why choose terser?
|
@@ -83,8 +87,6 @@ a double dash to prevent input files being used as option arguments:
|
|
83
87
|
`keep_quoted` Only mangle unquoted properties.
|
84
88
|
`regex` Only mangle matched property names.
|
85
89
|
`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
90
|
`preamble` Preamble to prepend to the output. You
|
89
91
|
can use this to insert a comment, for
|
90
92
|
example for licensing information.
|
@@ -237,7 +239,7 @@ to prevent the `require`, `exports` and `$` names from being changed.
|
|
237
239
|
|
238
240
|
### CLI mangling property names (`--mangle-props`)
|
239
241
|
|
240
|
-
**Note:** THIS
|
242
|
+
**Note:** THIS *MIGHT* BREAK YOUR CODE. Mangling property names
|
241
243
|
is a separate step, different from variable name mangling. Pass
|
242
244
|
`--mangle-props` to enable it. It will mangle all properties in the
|
243
245
|
input code with the exception of built in DOM properties and properties
|
@@ -367,6 +369,11 @@ like this:
|
|
367
369
|
```javascript
|
368
370
|
var Terser = require("terser");
|
369
371
|
```
|
372
|
+
Browser loading is also supported:
|
373
|
+
```html
|
374
|
+
<script src="node_modules/source-map/dist/source-map.min.js"></script>
|
375
|
+
<script src="dist/bundle.min.js"></script>
|
376
|
+
```
|
370
377
|
|
371
378
|
There is a single high level function, **`minify(code, options)`**,
|
372
379
|
which will perform all minification [phases](#minify-options) in a configurable
|
@@ -459,7 +466,6 @@ var options = {
|
|
459
466
|
passes: 2
|
460
467
|
},
|
461
468
|
output: {
|
462
|
-
beautify: false,
|
463
469
|
preamble: "/* minified */"
|
464
470
|
}
|
465
471
|
};
|
@@ -917,18 +923,12 @@ Terser.minify(code, { mangle: { toplevel: true } }).code;
|
|
917
923
|
|
918
924
|
## Output options
|
919
925
|
|
920
|
-
The code generator tries to output shortest code possible
|
921
|
-
case you want beautified output, pass `--beautify` (`-b`). Optionally you
|
926
|
+
The code generator tries to output shortest code possible. Optionally you
|
922
927
|
can pass additional arguments that control the code output:
|
923
928
|
|
924
929
|
- `ascii_only` (default `false`) -- escape Unicode characters in strings and
|
925
930
|
regexps (affects directives with non-ascii characters becoming invalid)
|
926
931
|
|
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
932
|
- `braces` (default `false`) -- always insert braces in `if`, `for`,
|
933
933
|
`do`, `while` or `with` statements, even if their body is a single
|
934
934
|
statement.
|
@@ -939,8 +939,7 @@ can pass additional arguments that control the code output:
|
|
939
939
|
|
940
940
|
- `ecma` (default `5`) -- set output printing mode. Set `ecma` to `6` or
|
941
941
|
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
|
942
|
+
Non-compatible features in the abstract syntax tree will still
|
944
943
|
be output as is. For example: an `ecma` setting of `5` will **not** convert
|
945
944
|
ES6+ code to ES5.
|
946
945
|
|
@@ -986,12 +985,6 @@ can pass additional arguments that control the code output:
|
|
986
985
|
- `webkit` (default `false`) -- enable workarounds for WebKit bugs.
|
987
986
|
PhantomJS users should set this option to `true`.
|
988
987
|
|
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
988
|
- `wrap_iife` (default `false`) -- pass `true` to wrap immediately invoked
|
996
989
|
function expressions. See
|
997
990
|
[#640](https://github.com/mishoo/UglifyJS2/issues/640) for more details.
|
@@ -1277,8 +1270,8 @@ In the terser CLI we use [source-map-support](https://npmjs.com/source-map-suppo
|
|
1277
1270
|
|
1278
1271
|
# README.md Patrons:
|
1279
1272
|
|
1280
|
-
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/
|
1281
|
-
|
1273
|
+
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/terser_ecmacomp_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.
|
1282
1274
|
|
1283
|
-
* CKEditor 
|
1284
1275
|
|
1276
|
+
* CKEditor 
|
1277
|
+
* 38elements 
|
package/bin/uglifyjs
CHANGED
@@ -10,15 +10,13 @@ var info = require("../package.json");
|
|
10
10
|
var path = require("path");
|
11
11
|
var program = require("commander");
|
12
12
|
|
13
|
-
var bundle_path = __dirname +
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
20
|
-
var UglifyJS = require("../tools/node.js");
|
21
|
-
}
|
13
|
+
var bundle_path = __dirname + (process.env.TERSER_NO_BUNDLE ?
|
14
|
+
"/../dist/bundle.js" :
|
15
|
+
"/../dist/bundle.min.js");
|
16
|
+
var UglifyJS = require(bundle_path);
|
17
|
+
try {
|
18
|
+
require("source-map-support").install();
|
19
|
+
} catch (err) {}
|
22
20
|
|
23
21
|
var skip_keys = [ "cname", "inlined", "parent_scope", "scope", "uses_eval", "uses_with" ];
|
24
22
|
var files = {};
|
@@ -312,7 +310,7 @@ function simple_glob(glob) {
|
|
312
310
|
if (Array.isArray(glob)) {
|
313
311
|
return [].concat.apply([], glob.map(simple_glob));
|
314
312
|
}
|
315
|
-
if (glob && glob.match(
|
313
|
+
if (glob && glob.match(/[*?]/)) {
|
316
314
|
var dir = path.dirname(glob);
|
317
315
|
try {
|
318
316
|
var entries = fs.readdirSync(dir);
|