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

@babel/traverse

Package Overview
Dependencies
Maintainers
4
Versions
183
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 7.20.5 to 7.20.7

9

lib/path/introspection.js

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

function getOuterFunction(path) {
return (path.scope.getFunctionParent() || path.scope.getProgramParent()).path;
return (path.parentPath.scope.getFunctionParent() || path.parentPath.scope.getProgramParent()).path;
}

@@ -271,4 +271,9 @@ function isExecutionUncertain(type, key) {

function _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache) {
if (!target.isFunctionDeclaration() || target.parentPath.isExportDeclaration()) {
if (!target.isFunctionDeclaration()) {
if (base._guessExecutionStatusRelativeTo(target) === "before") {
return "before";
}
return "unknown";
} else if (target.parentPath.isExportDeclaration()) {
return "unknown";
}

@@ -275,0 +280,0 @@

@@ -32,3 +32,2 @@ "use strict";

isMethod,
isModuleDeclaration,
isModuleSpecifier,

@@ -58,3 +57,4 @@ isNullLiteral,

isMetaProperty,
isPrivateName
isPrivateName,
isExportDeclaration
} = _t;

@@ -64,3 +64,3 @@ function gatherNodeParts(node, parts) {

default:
if (isModuleDeclaration(node)) {
if (isImportDeclaration(node) || isExportDeclaration(node)) {
if ((isExportAllDeclaration(node) || isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.source) {

@@ -514,5 +514,7 @@ gatherNodeParts(node.source, parts);

} else if (path.isImportDeclaration()) {
const isTypeDeclaration = path.node.importKind === "type" || path.node.importKind === "typeof";
const specifiers = path.get("specifiers");
for (const specifier of specifiers) {
this.registerBinding("module", specifier);
const isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof");
this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier);
}

@@ -870,14 +872,21 @@ } else if (path.isExportDeclaration()) {

}
hasBinding(name, noGlobals) {
hasBinding(name, opts) {
var _opts, _opts2, _opts3;
if (!name) return false;
if (this.hasOwnBinding(name)) return true;
if (this.parentHasBinding(name, noGlobals)) return true;
if (this.hasUid(name)) return true;
if (!noGlobals && Scope.globals.includes(name)) return true;
if (!noGlobals && Scope.contextVariables.includes(name)) return true;
{
if (typeof opts === "boolean") opts = {
noGlobals: opts
};
}
if (this.parentHasBinding(name, opts)) return true;
if (!((_opts = opts) != null && _opts.noUids) && this.hasUid(name)) return true;
if (!((_opts2 = opts) != null && _opts2.noGlobals) && Scope.globals.includes(name)) return true;
if (!((_opts3 = opts) != null && _opts3.noGlobals) && Scope.contextVariables.includes(name)) return true;
return false;
}
parentHasBinding(name, noGlobals) {
parentHasBinding(name, opts) {
var _this$parent;
return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, noGlobals);
return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, opts);
}

@@ -884,0 +893,0 @@

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

var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
var _traverseNode = require("../../traverse-node");
var _visitors = require("../../visitors");
const renameVisitor = {

@@ -86,10 +88,6 @@ ReferencedIdentifier({

}
const blockToTraverse = block || scope.block;
if ((blockToTraverse == null ? void 0 : blockToTraverse.type) === "SwitchStatement") {
blockToTraverse.cases.forEach(c => {
scope.traverse(c, renameVisitor, this);
});
} else {
scope.traverse(blockToTraverse, renameVisitor, this);
}
(0, _traverseNode.traverseNode)(block || scope.block, (0, _visitors.explode)(renameVisitor), scope, this, scope.path,
{
discriminant: true
});
if (!block) {

@@ -96,0 +94,0 @@ scope.removeOwnBinding(oldName);

{
"name": "@babel/traverse",
"version": "7.20.5",
"version": "7.20.7",
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",

@@ -20,3 +20,3 @@ "author": "The Babel Team (https://babel.dev/team)",

"@babel/code-frame": "^7.18.6",
"@babel/generator": "^7.20.5",
"@babel/generator": "^7.20.7",
"@babel/helper-environment-visitor": "^7.18.9",

@@ -26,4 +26,4 @@ "@babel/helper-function-name": "^7.19.0",

"@babel/helper-split-export-declaration": "^7.18.6",
"@babel/parser": "^7.20.5",
"@babel/types": "^7.20.5",
"@babel/parser": "^7.20.7",
"@babel/types": "^7.20.7",
"debug": "^4.1.0",

@@ -30,0 +30,0 @@ "globals": "^11.1.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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