Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-traverse

Package Overview
Dependencies
Maintainers
6
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-traverse - npm Package Compare versions

Comparing version 6.20.0 to 6.21.0

2

lib/path/comments.js

@@ -8,2 +8,4 @@ "use strict";

function shareCommentsWithSiblings() {
if (typeof this.key === "string") return;
var node = this.node;

@@ -10,0 +12,0 @@ if (!node) return;

20

lib/path/lib/hoister.js

@@ -110,3 +110,3 @@ "use strict";

if (binding.path.getStatementParent().key > path.key) return;
if (this.getAttachmentParentForPath(binding.path).key > path.key) return;
}

@@ -130,14 +130,20 @@ }

} else {
return this.getNextScopeStatementParent();
return this.getNextScopeAttachmentParent();
}
} else if (scope.path.isProgram()) {
return this.getNextScopeStatementParent();
return this.getNextScopeAttachmentParent();
}
};
PathHoister.prototype.getNextScopeStatementParent = function getNextScopeStatementParent() {
PathHoister.prototype.getNextScopeAttachmentParent = function getNextScopeAttachmentParent() {
var scope = this.scopes.pop();
if (scope) return scope.path.getStatementParent();
if (scope) return this.getAttachmentParentForPath(scope.path);
};
PathHoister.prototype.getAttachmentParentForPath = function getAttachmentParentForPath(path) {
do {
if (!path.parentPath || Array.isArray(path.container) && path.isStatement() || path.isVariableDeclarator() && path.parentPath.node.declarations.length > 1) return path;
} while (path = path.parentPath);
};
PathHoister.prototype.hasOwnParamBindings = function hasOwnParamBindings(scope) {

@@ -168,4 +174,6 @@ for (var name in this.bindings) {

var uid = attachTo.scope.generateUidIdentifier("ref");
attachTo.insertBefore([t.variableDeclaration("var", [t.variableDeclarator(uid, this.path.node)])]);
var declarator = t.variableDeclarator(uid, this.path.node);
attachTo.insertBefore([attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator])]);
var parent = this.path.parentPath;

@@ -172,0 +180,0 @@ if (parent.isJSXElement() && this.path.container === parent.node.children) {

{
"name": "babel-traverse",
"version": "6.20.0",
"version": "6.21.0",
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",

@@ -14,3 +14,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"babel-runtime": "^6.20.0",
"babel-types": "^6.20.0",
"babel-types": "^6.21.0",
"babylon": "^6.11.0",

@@ -17,0 +17,0 @@ "debug": "^2.2.0",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc