babel-plugin-minify-constant-folding
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -103,3 +103,7 @@ "use strict"; | ||
// TODO: look into evaluating binding too (could result in more code, but gzip?) | ||
Expression(path) { | ||
Expression(path, _ref) { | ||
var _ref$opts = _ref.opts; | ||
_ref$opts = _ref$opts === undefined ? {} : _ref$opts; | ||
var _ref$opts$tdz = _ref$opts.tdz, | ||
tdz = _ref$opts$tdz === undefined ? false : _ref$opts$tdz; | ||
var node = path.node; | ||
@@ -142,3 +146,3 @@ | ||
var res = evaluate(path); | ||
var res = evaluate(path, { tdz }); | ||
if (res.confident) { | ||
@@ -145,0 +149,0 @@ // Avoid fractions because they can be longer than the original expression. |
@@ -32,5 +32,15 @@ "use strict"; | ||
length() { | ||
if (this.elements.some(function (el) { | ||
return t.isSpreadElement(el); | ||
})) { | ||
return; | ||
} | ||
return t.numericLiteral(this.elements.length); | ||
}, | ||
[FALLBACK_HANDLER](i) { | ||
if (this.elements.some(function (el) { | ||
return t.isSpreadElement(el); | ||
})) { | ||
return; | ||
} | ||
if (typeof i === "number" || i.match(/^\d+$/)) { | ||
@@ -37,0 +47,0 @@ return this.elements[i] || undef; |
{ | ||
"name": "babel-plugin-minify-constant-folding", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "", | ||
"homepage": "https://github.com/babel/babili#readme", | ||
"repository": "https://github.com/babel/babili/tree/master/packages/babel-plugin-minify-constant-folding", | ||
"bugs": "https://github.com/babel/babili/issues", | ||
"author": "amasad", | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"keywords": [ | ||
"babel-plugin" | ||
], | ||
"homepage": "https://github.com/babel/minify#readme", | ||
"bugs": "https://github.com/babel/minify/issues", | ||
"license": "MIT", | ||
"author": "amasad", | ||
"main": "lib/index.js", | ||
"repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-constant-folding", | ||
"dependencies": { | ||
"babel-helper-evaluate-path": "^0.1.0" | ||
"babel-helper-evaluate-path": "^0.2.0" | ||
} | ||
} |
@@ -87,1 +87,5 @@ # babel-plugin-minify-constant-folding | ||
``` | ||
## Options | ||
+ `tdz` - Account for TDZ (Temporal Dead Zone) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
12058
294
91
0
+ Addedbabel-helper-evaluate-path@0.2.0(transitive)
- Removedbabel-helper-evaluate-path@0.1.0(transitive)