terser 4.3.4 → 4.3.8
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 +20 -0
- package/README.md +10 -10
- package/bin/terser +4 -1
- package/dist/bundle.min.js +1 -1
- package/dist/bundle.min.js.map +1 -1
- package/package.json +1 -1
- package/tools/terser.d.ts +4 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v4.3.8
|
4
|
+
|
5
|
+
- Typescript typings fix
|
6
|
+
|
7
|
+
## v4.3.7
|
8
|
+
|
9
|
+
- Parsing of regex options in the CLI (which broke in v4.3.5) was fixed.
|
10
|
+
- typescript definition updates
|
11
|
+
|
12
|
+
## v4.3.6
|
13
|
+
|
14
|
+
(crash hotfix)
|
15
|
+
|
16
|
+
## v4.3.5
|
17
|
+
|
18
|
+
- Fixed an issue with DOS line endings strings separated by `\` and a new line.
|
19
|
+
- Improved fix for the output size regression related to unused references within the extends section of a class.
|
20
|
+
- Variable names of anonymous functions (eg: `const x = () => { ... }` or `var func = function () {...}`) are now preserved when keep_fnames is true.
|
21
|
+
- Fixed performance degradation introduced for large payloads in v4.2.0
|
22
|
+
|
3
23
|
## v4.3.4
|
4
24
|
|
5
25
|
- Fixed a regression where the output size was increased when unused classes were referred to in the extends clause of a class.
|
package/README.md
CHANGED
@@ -261,7 +261,7 @@ way to use this is to use the `regex` option like so:
|
|
261
261
|
terser example.js -c -m --mangle-props regex=/_$/
|
262
262
|
```
|
263
263
|
|
264
|
-
This will mangle all properties that
|
264
|
+
This will mangle all properties that end with an
|
265
265
|
underscore. So you can use it to mangle internal methods.
|
266
266
|
|
267
267
|
By default, it will mangle all properties in the
|
@@ -289,32 +289,32 @@ console.log(x.calc());
|
|
289
289
|
```
|
290
290
|
Mangle all properties (except for JavaScript `builtins`) (**very** unsafe):
|
291
291
|
```bash
|
292
|
-
$ terser example.js -c -m --mangle-props
|
292
|
+
$ terser example.js -c passes=2 -m --mangle-props
|
293
293
|
```
|
294
294
|
```javascript
|
295
|
-
var x={o:
|
295
|
+
var x={o:3,t:1,i:function(){return this.t+this.o},s:2};console.log(x.i());
|
296
296
|
```
|
297
297
|
Mangle all properties except for `reserved` properties (still very unsafe):
|
298
298
|
```bash
|
299
|
-
$ terser example.js -c -m --mangle-props reserved=[foo_,bar_]
|
299
|
+
$ terser example.js -c passes=2 -m --mangle-props reserved=[foo_,bar_]
|
300
300
|
```
|
301
301
|
```javascript
|
302
|
-
var x={o:
|
302
|
+
var x={o:3,foo_:1,t:function(){return this.foo_+this.o},bar_:2};console.log(x.t());
|
303
303
|
```
|
304
304
|
Mangle all properties matching a `regex` (not as unsafe but still unsafe):
|
305
305
|
```bash
|
306
|
-
$ terser example.js -c -m --mangle-props regex=/_$/
|
306
|
+
$ terser example.js -c passes=2 -m --mangle-props regex=/_$/
|
307
307
|
```
|
308
308
|
```javascript
|
309
|
-
var x={o:
|
309
|
+
var x={o:3,t:1,calc:function(){return this.t+this.o},i:2};console.log(x.calc());
|
310
310
|
```
|
311
311
|
|
312
312
|
Combining mangle properties options:
|
313
313
|
```bash
|
314
|
-
$ terser example.js -c -m --mangle-props regex=/_$/,reserved=[bar_]
|
314
|
+
$ terser example.js -c passes=2 -m --mangle-props regex=/_$/,reserved=[bar_]
|
315
315
|
```
|
316
316
|
```javascript
|
317
|
-
var x={o:
|
317
|
+
var x={o:3,t:1,calc:function(){return this.t+this.o},bar_:2};console.log(x.calc());
|
318
318
|
```
|
319
319
|
|
320
320
|
In order for this to be of any use, we avoid mangling standard JS names by
|
@@ -820,7 +820,7 @@ If you happen to need the source map as a raw object, set `sourceMap.asObject` t
|
|
820
820
|
case a value of `20` or less is recommended.
|
821
821
|
|
822
822
|
- `side_effects` (default: `true`) -- Pass `false` to disable potentially dropping
|
823
|
-
|
823
|
+
function calls marked as "pure". A function call is marked as "pure" if a comment
|
824
824
|
annotation `/*@__PURE__*/` or `/*#__PURE__*/` immediately precedes the call. For
|
825
825
|
example: `/*@__PURE__*/foo();`
|
826
826
|
|
package/bin/terser
CHANGED
@@ -16,7 +16,7 @@ try {
|
|
16
16
|
require("source-map-support").install();
|
17
17
|
} catch (err) {}
|
18
18
|
|
19
|
-
const skip_keys = new Set([ "cname", "parent_scope", "scope", "uses_eval", "uses_with" ]);
|
19
|
+
const skip_keys = new Set([ "cname", "parent_scope", "scope", "uses_eval", "uses_with", "_var_name_cache" ]);
|
20
20
|
var files = {};
|
21
21
|
var options = {
|
22
22
|
compress: false,
|
@@ -368,6 +368,9 @@ function parse_js(flag) {
|
|
368
368
|
options[name] = value;
|
369
369
|
} else if (value instanceof Terser.AST_Array) {
|
370
370
|
options[name] = value.elements.map(to_string);
|
371
|
+
} else if (value instanceof Terser.AST_RegExp) {
|
372
|
+
value = value.value;
|
373
|
+
options[name] = new RegExp(value.source, value.flags);
|
371
374
|
} else {
|
372
375
|
options[name] = to_string(value);
|
373
376
|
}
|