terser 5.24.0 → 5.25.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.
- package/CHANGELOG.md +4 -0
- package/README.md +3 -0
- package/dist/bundle.min.js +8 -2
- package/lib/compress/index.js +1 -0
- package/lib/compress/inference.js +3 -0
- package/package.json +1 -1
- package/tools/domprops.js +2 -0
- package/tools/terser.d.ts +1 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v5.25.0
|
4
|
+
- Regex properties added to reserved property mangler (#1471)
|
5
|
+
- `pure_new` option added to drop unused `new` expressions.
|
6
|
+
|
3
7
|
## v5.24.0
|
4
8
|
- Improve formatting performance in V8 by keeping a small work string and a large output string
|
5
9
|
|
package/README.md
CHANGED
@@ -820,6 +820,9 @@ If you happen to need the source map as a raw object, set `sourceMap.asObject` t
|
|
820
820
|
Specify `"strict"` to treat `foo.bar` as side-effect-free only when
|
821
821
|
`foo` is certain to not throw, i.e. not `null` or `undefined`.
|
822
822
|
|
823
|
+
- `pure_new` (default: `false`) -- Set to `true` to assume `new X()` never has
|
824
|
+
side effects.
|
825
|
+
|
823
826
|
- `reduce_vars` (default: `true`) -- Improve optimization on variables assigned with and
|
824
827
|
used as constant values.
|
825
828
|
|
package/dist/bundle.min.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/source-map')) :
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/source-map'], factory) :
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Terser = {}, global.sourceMap));
|
5
|
-
}
|
5
|
+
}(this, (function (exports, sourceMap) { 'use strict';
|
6
6
|
|
7
7
|
/***********************************************************************
|
8
8
|
|
@@ -14170,6 +14170,9 @@ AST_Call.DEFMETHOD("is_callee_pure", function(compressor) {
|
|
14170
14170
|
return true;
|
14171
14171
|
}
|
14172
14172
|
}
|
14173
|
+
if ((this instanceof AST_New) && compressor.option("pure_new")) {
|
14174
|
+
return true;
|
14175
|
+
}
|
14173
14176
|
return !!has_annotation(this, _PURE) || !compressor.pure_funcs(this);
|
14174
14177
|
});
|
14175
14178
|
|
@@ -18390,6 +18393,7 @@ class Compressor extends TreeWalker {
|
|
18390
18393
|
properties : !false_by_default,
|
18391
18394
|
pure_getters : !false_by_default && "strict",
|
18392
18395
|
pure_funcs : null,
|
18396
|
+
pure_new : false,
|
18393
18397
|
reduce_funcs : !false_by_default,
|
18394
18398
|
reduce_vars : !false_by_default,
|
18395
18399
|
sequences : !false_by_default,
|
@@ -26841,6 +26845,7 @@ var domprops = [
|
|
26841
26845
|
"gridTemplateRows",
|
26842
26846
|
"gripSpace",
|
26843
26847
|
"group",
|
26848
|
+
"groups",
|
26844
26849
|
"groupCollapsed",
|
26845
26850
|
"groupEnd",
|
26846
26851
|
"groupId",
|
@@ -26948,6 +26953,7 @@ var domprops = [
|
|
26948
26953
|
"indexOf",
|
26949
26954
|
"indexedDB",
|
26950
26955
|
"indicate",
|
26956
|
+
"indices",
|
26951
26957
|
"inert",
|
26952
26958
|
"inertiaDestinationX",
|
26953
26959
|
"inertiaDestinationY",
|
@@ -31315,4 +31321,4 @@ exports._default_options = _default_options;
|
|
31315
31321
|
exports._run_cli = run_cli;
|
31316
31322
|
exports.minify = minify;
|
31317
31323
|
|
31318
|
-
}));
|
31324
|
+
})));
|
package/lib/compress/index.js
CHANGED
@@ -251,6 +251,7 @@ class Compressor extends TreeWalker {
|
|
251
251
|
properties : !false_by_default,
|
252
252
|
pure_getters : !false_by_default && "strict",
|
253
253
|
pure_funcs : null,
|
254
|
+
pure_new : false,
|
254
255
|
reduce_funcs : !false_by_default,
|
255
256
|
reduce_vars : !false_by_default,
|
256
257
|
sequences : !false_by_default,
|
@@ -828,6 +828,9 @@ AST_Call.DEFMETHOD("is_callee_pure", function(compressor) {
|
|
828
828
|
return true;
|
829
829
|
}
|
830
830
|
}
|
831
|
+
if ((this instanceof AST_New) && compressor.option("pure_new")) {
|
832
|
+
return true;
|
833
|
+
}
|
831
834
|
return !!has_annotation(this, _PURE) || !compressor.pure_funcs(this);
|
832
835
|
});
|
833
836
|
|
package/package.json
CHANGED
package/tools/domprops.js
CHANGED
@@ -4771,6 +4771,7 @@ export var domprops = [
|
|
4771
4771
|
"gridTemplateRows",
|
4772
4772
|
"gripSpace",
|
4773
4773
|
"group",
|
4774
|
+
"groups",
|
4774
4775
|
"groupCollapsed",
|
4775
4776
|
"groupEnd",
|
4776
4777
|
"groupId",
|
@@ -4878,6 +4879,7 @@ export var domprops = [
|
|
4878
4879
|
"indexOf",
|
4879
4880
|
"indexedDB",
|
4880
4881
|
"indicate",
|
4882
|
+
"indices",
|
4881
4883
|
"inert",
|
4882
4884
|
"inertiaDestinationX",
|
4883
4885
|
"inertiaDestinationY",
|