terser 5.9.0 → 5.12.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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## v5.12.0
4
+
5
+ - `TERSER_DEBUG_DIR` environment variable
6
+ - @copyright comments are now preserved with the comments="some" option (#1153)
7
+
8
+ ## v5.11.0
9
+
10
+ - Unicode code point escapes (`\u{abcde}`) are not emitted inside RegExp literals anymore (#1147)
11
+ - acorn is now a regular dependency
12
+
13
+ ## v5.10.0
14
+
15
+ - Massive optimization to max_line_len (#1109)
16
+ - Basic support for import assertions
17
+ - Marked ES2022 Object.hasOwn as a pure function
18
+ - Fix `delete optional?.property`
19
+ - New CI/CD pipeline with github actions (#1057)
20
+ - Fix reordering of switch branches (#1092), (#1084)
21
+ - Fix error when creating a class property called `get`
22
+ - Acorn dependency is now an optional peerDependency
23
+ - Fix mangling collision with exported variables (#1072)
24
+ - Fix an issue with `return someVariable = (async () => { ... })()` (#1073)
25
+
3
26
  ## v5.9.0
4
27
 
5
28
  - Collapsing switch cases with the same bodies (even if they're not next to each other) (#1070).
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 parser and mangler/compressor toolkit for ES6+.
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
 
@@ -60,6 +60,12 @@ in sequence and apply any compression options. The files are parsed in the
60
60
  same global scope, that is, a reference from a file to some
61
61
  variable/function declared in another file will be matched properly.
62
62
 
63
+ Command line arguments that take options (like --parse, --compress, --mangle and
64
+ --format) can take in a comma-separated list of default option overrides. For
65
+ instance:
66
+
67
+ terser input.js --compress ecma=2015,computed_props=false
68
+
63
69
  If no input file is specified, Terser will read from STDIN.
64
70
 
65
71
  If you wish to pass your options before the input files, separate the two with
@@ -121,8 +127,8 @@ a double dash to prevent input files being used as option arguments:
121
127
  as JSON to STDOUT respectively.
122
128
  --comments [filter] Preserve copyright comments in the output. By
123
129
  default this works like Google Closure, keeping
124
- JSDoc-style comments that contain "@license" or
125
- "@preserve". You can optionally pass one of the
130
+ JSDoc-style comments that contain e.g. "@license",
131
+ or start with "!". You can optionally pass one of the
126
132
  following arguments to this flag:
127
133
  - "all" to keep all comments
128
134
  - `false` to omit comments in the output
@@ -983,8 +989,8 @@ as "output options".
983
989
  statement.
984
990
 
985
991
  - `comments` (default `"some"`) -- by default it keeps JSDoc-style comments
986
- that contain "@license", "@preserve" or start with `!`, pass `true` or
987
- `"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,
988
994
  a regular expression string (e.g. `/^!/`) or a function.
989
995
 
990
996
  - `ecma` (default `5`) -- set desired EcmaScript standard version for output.
@@ -1056,9 +1062,9 @@ as "output options".
1056
1062
  ### Keeping copyright notices or other comments
1057
1063
 
1058
1064
  You can pass `--comments` to retain certain comments in the output. By
1059
- default it will keep JSDoc-style comments that contain "@preserve",
1060
- "@license" or "@cc_on" (conditional compilation for IE). You can pass
1061
- `--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
1062
1068
  keep only comments that match this regexp. For example `--comments /^!/`
1063
1069
  will keep comments like `/*! Copyright Notice */`.
1064
1070
 
@@ -1312,6 +1318,22 @@ $ yarn
1312
1318
 
1313
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.
1314
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
+
1315
1337
  # README.md Patrons:
1316
1338
 
1317
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.