terser 4.3.11 → 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,9 @@
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
+
3
7
  ## v4.3.11
4
8
 
5
9
  - Fixed a problem where `window` was considered safe to access, even though there are situations where it isn't (Node.js, workers...)
package/README.md CHANGED
@@ -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