terser 4.3.11 → 4.4.3

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## v4.4.3
4
+
5
+ - Number and BigInt parsing has been fixed
6
+ - `/*#__INLINE__*/` annotation fixed for arrow functions with non-block bodies.
7
+ - Functional tests have been added, using [this repository](https://github.com/terser/terser-functional-tests).
8
+ - A memory leak, where the entire AST lives on after compression, has been plugged.
9
+
10
+ ## v4.4.2
11
+
12
+ - Fixed a problem with inlining identity functions
13
+
14
+ ## v4.4.1
15
+
16
+ *note:* This introduced a feature, therefore it should have been a minor release.
17
+
18
+ - Fixed a crash when `unsafe` was enabled.
19
+ - An issue has been fixed where `let` statements might be collapsed out of their scope.
20
+ - Some error messages have been improved by adding quotes around variable names.
21
+
22
+ ## v4.4.0
23
+
24
+ - Added `/*#__INLINE__*/` and `/*#__NOINLINE__*/` annotations for calls. If a call has one of these, it either forces or forbids inlining.
25
+
3
26
  ## v4.3.11
4
27
 
5
28
  - Fixed a problem where `window` was considered safe to access, even though there are situations where it isn't (Node.js, workers...)
package/PATRONS.md CHANGED
@@ -4,6 +4,7 @@ These are the first-tier patrons from [Patreon](https://www.patreon.com/fabiosan
4
4
 
5
5
  * 38elements
6
6
  * Alan Orozco
7
+ * Aria Buckles
7
8
  * CKEditor
8
9
  * Mariusz Nowak
9
10
  * Nakshatra Mukhopadhyay
@@ -11,3 +12,4 @@ These are the first-tier patrons from [Patreon](https://www.patreon.com/fabiosan
11
12
  * Piotrek Koszuliński
12
13
  * Serhiy Shyyko
13
14
  * Viktor Hubert
15
+ * 龙腾道
package/README.md CHANGED
@@ -121,6 +121,7 @@ a double dash to prevent input files being used as option arguments:
121
121
  "@preserve". You can optionally pass one of the
122
122
  following arguments to this flag:
123
123
  - "all" to keep all comments
124
+ - `false` to omit comments in the output
124
125
  - a valid JS RegExp like `/foo/` or `/^!/` to
125
126
  keep only matching comments.
126
127
  Note that currently not *all* comments can be
@@ -975,8 +976,9 @@ can pass additional arguments that control the code output:
975
976
  `do`, `while` or `with` statements, even if their body is a single
976
977
  statement.
977
978
 
978
- - `comments` (default `false`) -- pass `true` or `"all"` to preserve all
979
- comments, `"some"` to preserve some comments, a regular expression string
979
+ - `comments` (default `"some"`) -- by default it keeps JSDoc-style comments
980
+ that contain "@license" or "@preserve", pass `true` or `"all"` to preserve all
981
+ comments, `false` to omit comments in the output, a regular expression string
980
982
  (e.g. `/^!/`) or a function.
981
983
 
982
984
  - `ecma` (default `5`) -- set output printing mode. Set `ecma` to `6` or
@@ -1192,6 +1194,30 @@ var result = Terser.minify(ast, {
1192
1194
  // result.code contains the minified code in string form.
1193
1195
  ```
1194
1196
 
1197
+
1198
+ ### Annotations
1199
+
1200
+ Annotations in Terser are a way to tell it to treat a certain function call differently. The following annotations are available:
1201
+
1202
+ * `/*@__INLINE__*/` - forces a function to be inlined somewhere.
1203
+ * `/*@__NOINLINE__*/` - Makes sure the called function is not inlined into the call site.
1204
+ * `/*@__PURE__*/` - Marks a function call as pure. That means, it can safely be dropped.
1205
+
1206
+ You can use either a `@` sign at the start, or a `#`.
1207
+
1208
+ Here are some examples on how to use them:
1209
+
1210
+ ```javascript
1211
+ /*@__INLINE__*/
1212
+ function_always_inlined_here()
1213
+
1214
+ /*#__NOINLINE__*/
1215
+ function_cant_be_inlined_into_here()
1216
+
1217
+ const x = /*#__PURE__*/i_am_dropped_if_x_is_not_used()
1218
+ ```
1219
+
1220
+
1195
1221
  ### Working with Terser AST
1196
1222
 
1197
1223
  Traversal and transformation of the native AST can be performed through