terser 4.3.8 → 4.4.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.

Potentially problematic release.


This version of terser might be problematic. Click here for more details.

package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## v4.4.0
4
+
5
+ - Added `/*#__INLINE__*/` and `/*#__NOINLINE__*/` annotations for calls. If a call has one of these, it either forces or forbids inlining.
6
+
7
+ ## v4.3.11
8
+
9
+ - Fixed a problem where `window` was considered safe to access, even though there are situations where it isn't (Node.js, workers...)
10
+ - Fixed an error where `++` and `--` were considered side-effect free
11
+ - `Number(x)` now needs both `unsafe` and and `unsafe_math` to be compressed into `+x` because `x` might be a `BigInt`
12
+ - `keep_fnames` now correctly supports regexes when the function is in a variable declaration
13
+
14
+ ## v4.3.10
15
+
16
+ - Fixed syntax error when repeated semicolons were encountered in classes
17
+ - Fixed invalid output caused by the creation of empty sequences internally
18
+ - Scopes are now updated when scopes are inlined into them
19
+
20
+ ## v4.3.9
21
+ - Fixed issue with mangle's `keep_fnames` option, introduced when adding code to keep variable names of anonymous functions
22
+
3
23
  ## v4.3.8
4
24
 
5
25
  - Typescript typings fix
package/README.md CHANGED
@@ -320,7 +320,7 @@ var x={o:3,t:1,calc:function(){return this.t+this.o},bar_:2};console.log(x.calc(
320
320
  In order for this to be of any use, we avoid mangling standard JS names by
321
321
  default (`--mangle-props builtins` to override).
322
322
 
323
- A default exclusion file is provided in `tools/domprops.json` which should
323
+ A default exclusion file is provided in `tools/domprops.js` which should
324
324
  cover most standard JS and DOM properties defined in various browsers. Pass
325
325
  `--mangle-props domprops` to disable this feature.
326
326
 
@@ -1192,6 +1192,30 @@ var result = Terser.minify(ast, {
1192
1192
  // result.code contains the minified code in string form.
1193
1193
  ```
1194
1194
 
1195
+
1196
+ ### Annotations
1197
+
1198
+ Annotations in Terser are a way to tell it to treat a certain function call differently. The following annotations are available:
1199
+
1200
+ * `/*@__INLINE__*/` - forces a function to be inlined somewhere.
1201
+ * `/*@__NOINLINE__*/` - Makes sure the called function is not inlined into the call site.
1202
+ * `/*@__PURE__*/` - Marks a function call as pure. That means, it can safely be dropped.
1203
+
1204
+ You can use either a `@` sign at the start, or a `#`.
1205
+
1206
+ Here are some examples on how to use them:
1207
+
1208
+ ```javascript
1209
+ /*@__INLINE__*/
1210
+ function_always_inlined_here()
1211
+
1212
+ /*#__NOINLINE__*/
1213
+ function_cant_be_inlined_into_here()
1214
+
1215
+ const x = /*#__PURE__*/i_am_dropped_if_x_is_not_used()
1216
+ ```
1217
+
1218
+
1195
1219
  ### Working with Terser AST
1196
1220
 
1197
1221
  Traversal and transformation of the native AST can be performed through