Socket
Socket
Sign inDemoInstall

@babel/traverse

Package Overview
Dependencies
Maintainers
5
Versions
180
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.0.0-rc.1 to 7.0.0-rc.2

12

lib/hub.js

@@ -9,8 +9,16 @@ "use strict";

class Hub {
constructor(file) {
this.file = file;
getCode() {}
getScope() {}
addHelper() {
throw new Error("Helpers are not supported by the default hub.");
}
buildError(node, msg, Error = TypeError) {
return new Error(msg);
}
}
exports.default = Hub;

2

lib/path/conversion.js

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

this.get("body").unshiftContainer("body", t().expressionStatement(t().callExpression(this.hub.file.addHelper("newArrowCheck"), [t().thisExpression(), checkBinding ? t().identifier(checkBinding.name) : t().identifier(thisBinding)])));
this.get("body").unshiftContainer("body", t().expressionStatement(t().callExpression(this.hub.addHelper("newArrowCheck"), [t().thisExpression(), checkBinding ? t().identifier(checkBinding.name) : t().identifier(thisBinding)])));
this.replaceWith(t().callExpression(t().memberExpression((0, _helperFunctionName().default)(this, true) || this.node, t().identifier("bind")), [checkBinding ? t().identifier(checkBinding.name) : t().thisExpression()]));

@@ -136,0 +136,0 @@ }

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

buildCodeFrameError(msg, Error = SyntaxError) {
return this.hub.file.buildCodeFrameError(this.node, msg, Error);
return this.hub.buildError(this.node, msg, Error);
}

@@ -160,0 +160,0 @@

@@ -164,6 +164,7 @@ "use strict";

if (node.end) {
return this.hub.file.code.slice(node.start, node.end);
} else {
return "";
const code = this.hub.getCode();
if (code) return code.slice(node.start, node.end);
}
return "";
}

@@ -170,0 +171,0 @@

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

if (duplicate) {
throw this.hub.file.buildCodeFrameError(id, `Duplicate declaration "${name}"`, TypeError);
throw this.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError);
}

@@ -391,4 +391,2 @@ }

toArray(node, i) {
const file = this.hub.file;
if (t().isIdentifier(node)) {

@@ -424,3 +422,3 @@ const binding = this.getBinding(node.name);

return t().callExpression(file.addHelper(helperName), args);
return t().callExpression(this.hub.addHelper(helperName), args);
}

@@ -427,0 +425,0 @@

{
"name": "@babel/traverse",
"version": "7.0.0-rc.1",
"version": "7.0.0-rc.2",
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",

@@ -11,8 +11,8 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"dependencies": {
"@babel/code-frame": "7.0.0-rc.1",
"@babel/generator": "7.0.0-rc.1",
"@babel/helper-function-name": "7.0.0-rc.1",
"@babel/helper-split-export-declaration": "7.0.0-rc.1",
"@babel/parser": "7.0.0-rc.1",
"@babel/types": "7.0.0-rc.1",
"@babel/code-frame": "7.0.0-rc.2",
"@babel/generator": "7.0.0-rc.2",
"@babel/helper-function-name": "7.0.0-rc.2",
"@babel/helper-split-export-declaration": "7.0.0-rc.2",
"@babel/parser": "7.0.0-rc.2",
"@babel/types": "7.0.0-rc.2",
"debug": "^3.1.0",

@@ -23,4 +23,4 @@ "globals": "^11.1.0",

"devDependencies": {
"@babel/helper-plugin-test-runner": "7.0.0-rc.1"
"@babel/helper-plugin-test-runner": "7.0.0-rc.2"
}
}
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