Socket
Socket
Sign inDemoInstall

uglify-js

Package Overview
Dependencies
0
Maintainers
3
Versions
283
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.12.6 to 3.12.7

28

lib/ast.js

@@ -1421,2 +1421,30 @@ /***********************************************************************

var AST_Template = DEFNODE("Template", "expressions strings tag", {
$documentation: "A template literal, i.e. tag`str1${expr1}...strN${exprN}strN+1`",
$propdoc: {
expressions: "[AST_Node*] the placeholder expressions",
strings: "[string*] the raw text segments",
tag: "[AST_Node] tag function, or null if absent",
},
walk: function(visitor) {
var node = this;
visitor.visit(node, function() {
if (node.tag) node.tag.walk(visitor);
node.expressions.forEach(function(expr) {
expr.walk(visitor);
});
});
},
_validate: function() {
if (this.expressions.length + 1 != this.strings.length) {
throw new Error("malformed template with " + this.expressions.length + " placeholder(s) but " + this.strings.length + " text segment(s)");
}
must_be_expressions(this, "expressions");
this.strings.forEach(function(string) {
if (typeof string != "string") throw new Error("strings must contain string");
});
if (this.tag != null) must_be_expression(this, "tag");
},
});
var AST_Constant = DEFNODE("Constant", null, {

@@ -1423,0 +1451,0 @@ $documentation: "Base class for all constants",

19

lib/output.js

@@ -783,3 +783,5 @@ /***********************************************************************

// (new Date).getTime(), (new Date)["getTime"]()
return p instanceof AST_PropAccess;
if (p instanceof AST_PropAccess) return true;
// (new foo)`bar`
if (p instanceof AST_Template) return p.tag === this;
});

@@ -806,2 +808,4 @@

if (p instanceof AST_PropAccess) return p.expression === self;
// (a = foo)`bar`
if (p instanceof AST_Template) return p.tag === self;
// !(a = false) → true

@@ -1491,2 +1495,15 @@ if (p instanceof AST_Unary) return true;

});
DEFPRINT(AST_Template, function(output) {
var self = this;
if (self.tag) self.tag.print(output);
output.print("`");
for (var i = 0; i < self.expressions.length; i++) {
output.print(self.strings[i]);
output.print("${");
self.expressions[i].print(output);
output.print("}");
}
output.print(self.strings[i]);
output.print("`");
});
DEFPRINT(AST_Constant, function(output) {

@@ -1493,0 +1510,0 @@ output.print(this.value);

@@ -104,2 +104,10 @@ /***********************************************************************

function is_lhs(node, parent) {
if (parent instanceof AST_Assign) return parent.left === node && node;
if (parent instanceof AST_DefaultValue) return parent.name === node && node;
if (parent instanceof AST_Destructured) return node;
if (parent instanceof AST_DestructuredKeyVal) return node;
if (parent instanceof AST_Unary) return unary_side_effects[parent.operator] && parent.expression;
}
AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {

@@ -273,4 +281,3 @@ options = defaults(options, {

var parent = tw.parent();
if (parent instanceof AST_Assign && parent.left === node
|| parent instanceof AST_Unary && unary_side_effects[parent.operator]) {
if (is_lhs(node, parent)) {
sym.scope.uses_arguments = 3;

@@ -277,0 +284,0 @@ } else if (sym.scope.uses_arguments < 2

@@ -204,2 +204,6 @@ /***********************************************************************

});
DEF(AST_Template, function(self, tw) {
if (self.tag) self.tag = self.tag.transform(tw);
self.expressions = do_list(self.expressions, tw);
});
})(function(node, descend) {

@@ -206,0 +210,0 @@ node.DEFMETHOD("transform", function(tw, in_list) {

@@ -258,2 +258,4 @@ /***********************************************************************

return p.body === node;
} else if (p instanceof AST_Template) {
if (p.tag === node) continue;
} else if (p instanceof AST_UnaryPostfix) {

@@ -260,0 +262,0 @@ if (p.expression === node) continue;

2

package.json

@@ -6,3 +6,3 @@ {

"license": "BSD-2-Clause",
"version": "3.12.6",
"version": "3.12.7",
"engines": {

@@ -9,0 +9,0 @@ "node": ">=0.8.0"

@@ -772,2 +772,5 @@ UglifyJS 3

- `templates` (default: `true`) -- compact template literals by embedding expressions
and/or converting to string literals, e.g. `` `foo ${42}` → "foo 42"``
- `top_retain` (default: `null`) -- prevent specific toplevel functions and

@@ -1264,1 +1267,8 @@ variables from `unused` removal (can be array, comma-separated, RegExp or

UglifyJS may modify the input which in turn may suppress those errors.
- Some versions of JavaScript will throw `SyntaxError` with the
following:
```javascript
console.log(String.raw`\uFo`);
// SyntaxError: Invalid Unicode escape sequence
```
UglifyJS may modify the input which in turn may suppress those errors.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc