terser 4.0.2 → 4.1.3

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
+ ## v4.1.3
4
+
5
+ - Several issues with the `reduce_vars` option were fixed.
6
+ - Starting this version, we only have a dist/bundle.min.js
7
+
8
+ ## v4.1.2
9
+
10
+ - The hotfix was hotfixed
11
+
12
+ ## v4.1.1
13
+
14
+ - Fixed a bug where toplevel scopes were being mixed up with lambda scopes
15
+
16
+ ## v4.1.0
17
+
18
+ - Internal functions were replaced by `Object.assign`, `Array.prototype.some`, `Array.prototype.find` and `Array.prototype.every`.
19
+ - A serious issue where some ESM-native code was broken was fixed.
20
+ - Performance improvements were made.
21
+ - Support for BigInt was added.
22
+ - Inline efficiency was improved. Functions are now being inlined more proactively instead of being inlined only after another Compressor pass.
23
+
3
24
  ## v4.0.2
4
25
 
5
26
  (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)
package/bin/uglifyjs CHANGED
@@ -11,10 +11,7 @@ var info = require("../package.json");
11
11
  var path = require("path");
12
12
  var program = require("commander");
13
13
 
14
- var bundle_path = __dirname + (process.env.TERSER_NO_BUNDLE ?
15
- "/../dist/bundle.js" :
16
- "/../dist/bundle.min.js");
17
- var UglifyJS = require(bundle_path);
14
+ var UglifyJS = require("..");
18
15
  try {
19
16
  require("source-map-support").install();
20
17
  } catch (err) {}
@@ -58,7 +55,7 @@ program.option("--name-cache <file>", "File to hold mangled name mappings.");
58
55
  program.option("--rename", "Force symbol expansion.");
59
56
  program.option("--no-rename", "Disable symbol expansion.");
60
57
  program.option("--safari10", "Support non-standard Safari 10.");
61
- program.option("--source-map [options]", "Enable source map/specify source map options.", parse_source_map());
58
+ program.option("--source-map [options]", "Enable source map/specify source map options.", parse_js());
62
59
  program.option("--timings", "Display operations run time on STDERR.");
63
60
  program.option("--toplevel", "Compress and/or mangle variables in toplevel scope.");
64
61
  program.option("--verbose", "Print diagnostic messages.");
@@ -196,6 +193,10 @@ function run() {
196
193
  UglifyJS.AST_Node.warn_function = function(msg) {
197
194
  print_error("WARN: " + msg);
198
195
  };
196
+ var content = program.sourceMap && program.sourceMap.content;
197
+ if (content && content !== "inline") {
198
+ options.sourceMap.content = read_file(content, content);
199
+ }
199
200
  if (program.timings) options.timings = true;
200
201
  try {
201
202
  if (program.parse) {
@@ -357,17 +358,9 @@ function parse_js(flag) {
357
358
  return function(value, options) {
358
359
  options = options || {};
359
360
  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) {
361
+ UglifyJS.parse(value, {
362
+ expression: true
363
+ }).walk(new UglifyJS.TreeWalker(function(node) {
371
364
  if (node instanceof UglifyJS.AST_Assign) {
372
365
  var name = node.left.print_to_string();
373
366
  var value = node.right;
@@ -404,18 +397,6 @@ function parse_js(flag) {
404
397
  };
405
398
  }
406
399
 
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
400
  function skip_key(key) {
420
401
  return skip_keys.includes(key);
421
402
  }