@babel/traverse
Advanced tools
Comparing version 7.0.0-rc.1 to 7.0.0-rc.2
@@ -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; |
@@ -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" | ||
} | ||
} |
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
143146
4284
+ Added@babel/code-frame@7.0.0-rc.2(transitive)
+ Added@babel/generator@7.0.0-rc.2(transitive)
+ Added@babel/helper-function-name@7.0.0-rc.2(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-rc.2(transitive)
+ Added@babel/helper-split-export-declaration@7.0.0-rc.2(transitive)
+ Added@babel/highlight@7.0.0-rc.2(transitive)
+ Added@babel/parser@7.0.0-rc.2(transitive)
+ Added@babel/template@7.0.0-rc.2(transitive)
+ Added@babel/types@7.0.0-rc.2(transitive)
+ Addedjs-tokens@4.0.0(transitive)
- Removed@babel/code-frame@7.0.0-rc.1(transitive)
- Removed@babel/generator@7.0.0-rc.1(transitive)
- Removed@babel/helper-function-name@7.0.0-rc.1(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-rc.1(transitive)
- Removed@babel/helper-split-export-declaration@7.0.0-rc.1(transitive)
- Removed@babel/highlight@7.0.0-rc.1(transitive)
- Removed@babel/parser@7.0.0-rc.1(transitive)
- Removed@babel/template@7.0.0-rc.1(transitive)
- Removed@babel/types@7.0.0-rc.1(transitive)
- Removedjs-tokens@3.0.2(transitive)
Updated@babel/code-frame@7.0.0-rc.2
Updated@babel/generator@7.0.0-rc.2
Updated@babel/parser@7.0.0-rc.2
Updated@babel/types@7.0.0-rc.2