terser 5.11.0 → 5.13.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.
- package/CHANGELOG.md +16 -0
- package/README.md +24 -8
- package/dist/bundle.min.js +2360 -731
- package/lib/ast.js +1662 -350
- package/lib/cli.js +13 -9
- package/lib/compress/evaluate.js +4 -3
- package/lib/equivalent-to.js +81 -107
- package/lib/minify.js +49 -1
- package/lib/mozilla-ast.js +474 -81
- package/lib/output.js +3 -2
- package/lib/propmangle.js +1 -1
- package/lib/scope.js +22 -0
- package/package.json +4 -2
- package/tools/domprops.js +11 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v5.13.0
|
4
|
+
|
5
|
+
- All calls to eval() were removed (#1171, #1184)
|
6
|
+
- `source-map` was updated to 0.8.0-beta.0 (#1164)
|
7
|
+
- NavigatorUAData was added to domprops to avoid property mangling (#1166)
|
8
|
+
|
9
|
+
## v5.12.1
|
10
|
+
|
11
|
+
- Fixed an issue with function definitions inside blocks (#1155)
|
12
|
+
- Fixed parens of `new` in some situations (closes #1159)
|
13
|
+
|
14
|
+
## v5.12.0
|
15
|
+
|
16
|
+
- `TERSER_DEBUG_DIR` environment variable
|
17
|
+
- @copyright comments are now preserved with the comments="some" option (#1153)
|
18
|
+
|
3
19
|
## v5.11.0
|
4
20
|
|
5
21
|
- Unicode code point escapes (`\u{abcde}`) are not emitted inside RegExp literals anymore (#1147)
|
package/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
[![Travis Build][travis-image]][travis-url]
|
6
6
|
[![Opencollective financial contributors][opencollective-contributors]][opencollective-url]
|
7
7
|
|
8
|
-
A JavaScript
|
8
|
+
A JavaScript mangler/compressor toolkit for ES6+.
|
9
9
|
|
10
10
|
*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/terser/blob/master/PATRONS.md) for our first-tier patrons.
|
11
11
|
|
@@ -127,8 +127,8 @@ a double dash to prevent input files being used as option arguments:
|
|
127
127
|
as JSON to STDOUT respectively.
|
128
128
|
--comments [filter] Preserve copyright comments in the output. By
|
129
129
|
default this works like Google Closure, keeping
|
130
|
-
JSDoc-style comments that contain "@license"
|
131
|
-
"
|
130
|
+
JSDoc-style comments that contain e.g. "@license",
|
131
|
+
or start with "!". You can optionally pass one of the
|
132
132
|
following arguments to this flag:
|
133
133
|
- "all" to keep all comments
|
134
134
|
- `false` to omit comments in the output
|
@@ -989,8 +989,8 @@ as "output options".
|
|
989
989
|
statement.
|
990
990
|
|
991
991
|
- `comments` (default `"some"`) -- by default it keeps JSDoc-style comments
|
992
|
-
that contain "@license", "@preserve" or start with `!`, pass `true`
|
993
|
-
`"all"` to preserve all comments, `false` to omit comments in the output,
|
992
|
+
that contain "@license", "@copyright", "@preserve" or start with `!`, pass `true`
|
993
|
+
or `"all"` to preserve all comments, `false` to omit comments in the output,
|
994
994
|
a regular expression string (e.g. `/^!/`) or a function.
|
995
995
|
|
996
996
|
- `ecma` (default `5`) -- set desired EcmaScript standard version for output.
|
@@ -1062,9 +1062,9 @@ as "output options".
|
|
1062
1062
|
### Keeping copyright notices or other comments
|
1063
1063
|
|
1064
1064
|
You can pass `--comments` to retain certain comments in the output. By
|
1065
|
-
default it will keep JSDoc-style comments that
|
1066
|
-
"@license" or "@cc_on" (conditional compilation for IE).
|
1067
|
-
`--comments all` to keep all the comments, or a valid JavaScript regexp to
|
1065
|
+
default it will keep comments starting with "!" and JSDoc-style comments that
|
1066
|
+
contain "@preserve", "@copyright", "@license" or "@cc_on" (conditional compilation for IE).
|
1067
|
+
You can pass `--comments all` to keep all the comments, or a valid JavaScript regexp to
|
1068
1068
|
keep only comments that match this regexp. For example `--comments /^!/`
|
1069
1069
|
will keep comments like `/*! Copyright Notice */`.
|
1070
1070
|
|
@@ -1318,6 +1318,22 @@ $ yarn
|
|
1318
1318
|
|
1319
1319
|
In the terser CLI we use [source-map-support](https://npmjs.com/source-map-support) to produce good error stacks. In your own app, you're expected to enable source-map-support (read their docs) to have nice stack traces that will help you write good issues.
|
1320
1320
|
|
1321
|
+
## Obtaining the source code given to Terser
|
1322
|
+
|
1323
|
+
Because users often don't control the call to `await minify()` or its arguments, Terser provides a `TERSER_DEBUG_DIR` environment variable to make terser output some debug logs. If you're using a bundler or a project that includes a bundler and are not sure what went wrong with your code, pass that variable like so:
|
1324
|
+
|
1325
|
+
```
|
1326
|
+
$ TERSER_DEBUG_DIR=/path/to/logs command-that-uses-terser
|
1327
|
+
$ ls /path/to/logs
|
1328
|
+
terser-debug-123456.log
|
1329
|
+
```
|
1330
|
+
|
1331
|
+
If you're not sure how to set an environment variable on your shell (the above example works in bash), you can try using cross-env:
|
1332
|
+
|
1333
|
+
```
|
1334
|
+
> npx cross-env TERSER_DEBUG_DIR=/path/to/logs command-that-uses-terser
|
1335
|
+
```
|
1336
|
+
|
1321
1337
|
# README.md Patrons:
|
1322
1338
|
|
1323
1339
|
*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/terser/blob/master/PATRONS.md) for our first-tier patrons.
|