@babel/traverse
Advanced tools
Comparing version 7.9.6 to 7.10.0
@@ -34,3 +34,3 @@ "use strict"; | ||
const keys = t.VISITOR_KEYS[node.type]; | ||
if (!keys || !keys.length) return false; | ||
if (!(keys == null ? void 0 : keys.length)) return false; | ||
@@ -37,0 +37,0 @@ for (const key of keys) { |
@@ -224,5 +224,7 @@ "use strict"; | ||
function setKey(key) { | ||
var _this$node; | ||
this.key = key; | ||
this.node = this.container[this.key]; | ||
this.type = this.node && this.node.type; | ||
this.type = (_this$node = this.node) == null ? void 0 : _this$node.type; | ||
} | ||
@@ -229,0 +231,0 @@ |
@@ -130,3 +130,3 @@ "use strict"; | ||
}); | ||
const inConstructor = thisEnvFn && thisEnvFn.node.kind === "constructor"; | ||
const inConstructor = (thisEnvFn == null ? void 0 : thisEnvFn.node.kind) === "constructor"; | ||
@@ -133,0 +133,0 @@ if (thisEnvFn.isClassProperty()) { |
@@ -135,3 +135,3 @@ "use strict"; | ||
if (binding && binding.hasValue) { | ||
if (binding == null ? void 0 : binding.hasValue) { | ||
return binding.value; | ||
@@ -138,0 +138,0 @@ } else { |
@@ -29,2 +29,4 @@ "use strict"; | ||
function _getTypeAnnotation() { | ||
var _inferer; | ||
const node = this.node; | ||
@@ -63,3 +65,3 @@ | ||
if (inferer && inferer.validParent) { | ||
if ((_inferer = inferer) == null ? void 0 : _inferer.validParent) { | ||
return this.parentPath.getTypeAnnotation(); | ||
@@ -66,0 +68,0 @@ } |
@@ -47,2 +47,4 @@ "use strict"; | ||
function VariableDeclarator() { | ||
var _type; | ||
const id = this.get("id"); | ||
@@ -53,3 +55,3 @@ if (!id.isIdentifier()) return; | ||
if (type && type.type === "AnyTypeAnnotation") { | ||
if (((_type = type) == null ? void 0 : _type.type) === "AnyTypeAnnotation") { | ||
if (init.isCallExpression() && init.get("callee").isIdentifier({ | ||
@@ -56,0 +58,0 @@ name: "Array" |
@@ -18,2 +18,4 @@ "use strict"; | ||
function remove() { | ||
var _this$opts; | ||
this._assertUnremoved(); | ||
@@ -23,3 +25,3 @@ | ||
if (!this.opts || !this.opts.noScope) { | ||
if (!((_this$opts = this.opts) == null ? void 0 : _this$opts.noScope)) { | ||
this._removeFromScope(); | ||
@@ -26,0 +28,0 @@ } |
@@ -175,3 +175,3 @@ "use strict"; | ||
this.debug(`Replace with ${node && node.type}`); | ||
this.debug(`Replace with ${node == null ? void 0 : node.type}`); | ||
this.node = this.container[this.key] = node; | ||
@@ -189,3 +189,3 @@ } | ||
const functionParent = this.getFunctionParent(); | ||
const isParentAsync = functionParent && functionParent.is("async"); | ||
const isParentAsync = functionParent == null ? void 0 : functionParent.is("async"); | ||
const container = t.arrowFunctionExpression([], t.blockStatement(nodes)); | ||
@@ -192,0 +192,0 @@ this.replaceWith(t.callExpression(container, [])); |
@@ -308,3 +308,3 @@ "use strict"; | ||
if (cached && cached.path === path) { | ||
if ((cached == null ? void 0 : cached.path) === path) { | ||
return cached; | ||
@@ -324,3 +324,3 @@ } | ||
const parent = this.path.findParent(p => p.isScope()); | ||
return parent && parent.scope; | ||
return parent == null ? void 0 : parent.scope; | ||
} | ||
@@ -469,7 +469,7 @@ | ||
toArray(node, i) { | ||
toArray(node, i, allowArrayLike) { | ||
if (t.isIdentifier(node)) { | ||
const binding = this.getBinding(node.name); | ||
if (binding && binding.constant && binding.path.isGenericType("Array")) { | ||
if ((binding == null ? void 0 : binding.constant) && binding.path.isGenericType("Array")) { | ||
return node; | ||
@@ -501,2 +501,7 @@ } | ||
if (allowArrayLike) { | ||
args.unshift(this.hub.addHelper(helperName)); | ||
helperName = "maybeArrayLike"; | ||
} | ||
return t.callExpression(this.hub.addHelper(helperName), args); | ||
@@ -896,4 +901,5 @@ } | ||
getBindingIdentifier(name) { | ||
const info = this.getBinding(name); | ||
return info && info.identifier; | ||
var _this$getBinding; | ||
return (_this$getBinding = this.getBinding(name)) == null ? void 0 : _this$getBinding.identifier; | ||
} | ||
@@ -903,3 +909,3 @@ | ||
const binding = this.bindings[name]; | ||
return binding && binding.identifier; | ||
return binding == null ? void 0 : binding.identifier; | ||
} | ||
@@ -922,3 +928,5 @@ | ||
parentHasBinding(name, noGlobals) { | ||
return this.parent && this.parent.hasBinding(name, noGlobals); | ||
var _this$parent; | ||
return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, noGlobals); | ||
} | ||
@@ -941,8 +949,5 @@ | ||
removeBinding(name) { | ||
const info = this.getBinding(name); | ||
var _this$getBinding2; | ||
if (info) { | ||
info.scope.removeOwnBinding(name); | ||
} | ||
(_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.scope.removeOwnBinding(name); | ||
let scope = this; | ||
@@ -949,0 +954,0 @@ |
@@ -35,3 +35,4 @@ "use strict"; | ||
"AssignmentExpression|Declaration"(path, state) { | ||
"AssignmentExpression|Declaration|VariableDeclarator"(path, state) { | ||
if (path.isVariableDeclaration()) return; | ||
const ids = path.getOuterBindingIdentifiers(); | ||
@@ -38,0 +39,0 @@ |
{ | ||
"name": "@babel/traverse", | ||
"version": "7.9.6", | ||
"version": "7.10.0", | ||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
@@ -15,7 +15,7 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"@babel/code-frame": "^7.8.3", | ||
"@babel/generator": "^7.9.6", | ||
"@babel/generator": "^7.10.0", | ||
"@babel/helper-function-name": "^7.9.5", | ||
"@babel/helper-split-export-declaration": "^7.8.3", | ||
"@babel/parser": "^7.9.6", | ||
"@babel/types": "^7.9.6", | ||
"@babel/parser": "^7.10.0", | ||
"@babel/types": "^7.10.0", | ||
"debug": "^4.1.0", | ||
@@ -28,3 +28,3 @@ "globals": "^11.1.0", | ||
}, | ||
"gitHead": "9c2846bcacc75aa931ea9d556950c2113765d43d" | ||
"gitHead": "5da2440adff6f25579fb6e9a018062291c89416f" | ||
} |
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
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
157542
4393
Updated@babel/generator@^7.10.0
Updated@babel/parser@^7.10.0
Updated@babel/types@^7.10.0