terser 4.3.10 → 4.4.2
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 +23 -0
- package/PATRONS.md +2 -0
- package/README.md +29 -3
- package/dist/bundle.min.js +1 -1
- package/dist/bundle.min.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v4.4.2
|
4
|
+
|
5
|
+
- Fixed a problem with inlining identity functions
|
6
|
+
|
7
|
+
## v4.4.1
|
8
|
+
|
9
|
+
*note:* This introduced a feature, therefore it should have been a minor release.
|
10
|
+
|
11
|
+
- Fixed a crash when `unsafe` was enabled.
|
12
|
+
- An issue has been fixed where `let` statements might be collapsed out of their scope.
|
13
|
+
- Some error messages have been improved by adding quotes around variable names.
|
14
|
+
|
15
|
+
## v4.4.0
|
16
|
+
|
17
|
+
- Added `/*#__INLINE__*/` and `/*#__NOINLINE__*/` annotations for calls. If a call has one of these, it either forces or forbids inlining.
|
18
|
+
|
19
|
+
## v4.3.11
|
20
|
+
|
21
|
+
- Fixed a problem where `window` was considered safe to access, even though there are situations where it isn't (Node.js, workers...)
|
22
|
+
- Fixed an error where `++` and `--` were considered side-effect free
|
23
|
+
- `Number(x)` now needs both `unsafe` and and `unsafe_math` to be compressed into `+x` because `x` might be a `BigInt`
|
24
|
+
- `keep_fnames` now correctly supports regexes when the function is in a variable declaration
|
25
|
+
|
3
26
|
## v4.3.10
|
4
27
|
|
5
28
|
- Fixed syntax error when repeated semicolons were encountered in classes
|
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
|
@@ -320,7 +321,7 @@ var x={o:3,t:1,calc:function(){return this.t+this.o},bar_:2};console.log(x.calc(
|
|
320
321
|
In order for this to be of any use, we avoid mangling standard JS names by
|
321
322
|
default (`--mangle-props builtins` to override).
|
322
323
|
|
323
|
-
A default exclusion file is provided in `tools/domprops.
|
324
|
+
A default exclusion file is provided in `tools/domprops.js` which should
|
324
325
|
cover most standard JS and DOM properties defined in various browsers. Pass
|
325
326
|
`--mangle-props domprops` to disable this feature.
|
326
327
|
|
@@ -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 `
|
979
|
-
|
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
|