terser 4.0.1 → 4.1.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+
4
+ ## v4.1.2
5
+
6
+ - The hotfix was hotfixed
7
+
8
+ ## v4.1.1
9
+
10
+ - Fixed a bug where toplevel scopes were being mixed up with lambda scopes
11
+
12
+ ## v4.1.0
13
+
14
+ - Internal functions were replaced by `Object.assign`, `Array.prototype.some`, `Array.prototype.find` and `Array.prototype.every`.
15
+ - A serious issue where some ESM-native code was broken was fixed.
16
+ - Performance improvements were made.
17
+ - Support for BigInt was added.
18
+ - Inline efficiency was improved. Functions are now being inlined more proactively instead of being inlined only after another Compressor pass.
19
+
20
+ ## v4.0.2
21
+
22
+ (Hotfix release. Reverts unmapped segments PR [#342](https://github.com/terser-js/terser/pull/342), which will be put back on Terser when the upstream issue is resolved)
23
+
3
24
  ## v4.0.1
4
25
 
5
26
  - Collisions between the arguments of inlined functions and names in the outer scope are now being avoided while inlining
package/bin/uglifyjs CHANGED
@@ -58,7 +58,7 @@ program.option("--name-cache <file>", "File to hold mangled name mappings.");
58
58
  program.option("--rename", "Force symbol expansion.");
59
59
  program.option("--no-rename", "Disable symbol expansion.");
60
60
  program.option("--safari10", "Support non-standard Safari 10.");
61
- program.option("--source-map [options]", "Enable source map/specify source map options.", parse_source_map());
61
+ program.option("--source-map [options]", "Enable source map/specify source map options.", parse_js());
62
62
  program.option("--timings", "Display operations run time on STDERR.");
63
63
  program.option("--toplevel", "Compress and/or mangle variables in toplevel scope.");
64
64
  program.option("--verbose", "Print diagnostic messages.");
@@ -196,6 +196,10 @@ function run() {
196
196
  UglifyJS.AST_Node.warn_function = function(msg) {
197
197
  print_error("WARN: " + msg);
198
198
  };
199
+ var content = program.sourceMap && program.sourceMap.content;
200
+ if (content && content !== "inline") {
201
+ options.sourceMap.content = read_file(content, content);
202
+ }
199
203
  if (program.timings) options.timings = true;
200
204
  try {
201
205
  if (program.parse) {
@@ -357,17 +361,9 @@ function parse_js(flag) {
357
361
  return function(value, options) {
358
362
  options = options || {};
359
363
  try {
360
- UglifyJS.minify(value, {
361
- parse: {
362
- expression: true
363
- },
364
- compress: false,
365
- mangle: false,
366
- output: {
367
- ast: true,
368
- code: false
369
- }
370
- }).ast.walk(new UglifyJS.TreeWalker(function(node) {
364
+ UglifyJS.parse(value, {
365
+ expression: true
366
+ }).walk(new UglifyJS.TreeWalker(function(node) {
371
367
  if (node instanceof UglifyJS.AST_Assign) {
372
368
  var name = node.left.print_to_string();
373
369
  var value = node.right;
@@ -404,18 +400,6 @@ function parse_js(flag) {
404
400
  };
405
401
  }
406
402
 
407
- function parse_source_map() {
408
- var parse = parse_js();
409
- return function(value, options) {
410
- var hasContent = options && "content" in options;
411
- var settings = parse(value, options);
412
- if (!hasContent && settings.content && settings.content != "inline") {
413
- settings.content = read_file(settings.content, settings.content);
414
- }
415
- return settings;
416
- };
417
- }
418
-
419
403
  function skip_key(key) {
420
404
  return skip_keys.includes(key);
421
405
  }