babel-traverse
Advanced tools
Comparing version 6.23.0 to 6.23.1
@@ -9,23 +9,12 @@ "use strict"; | ||
var _scope = require("./scope"); | ||
var _scope2 = _interopRequireDefault(_scope); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var Hub = function () { | ||
function Hub() { | ||
(0, _classCallCheck3.default)(this, Hub); | ||
} | ||
var Hub = function Hub(file, options) { | ||
(0, _classCallCheck3.default)(this, Hub); | ||
Hub.prototype.buildError = function buildError(node, msg) { | ||
var BuildError = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TypeError; | ||
this.file = file; | ||
this.options = options; | ||
}; | ||
return new BuildError(msg); | ||
}; | ||
return Hub; | ||
}(); | ||
exports.default = Hub; | ||
module.exports = exports["default"]; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.Hub = exports.Scope = exports.NodePath = exports.visitors = undefined; | ||
exports.visitors = exports.Hub = exports.Scope = exports.NodePath = undefined; | ||
@@ -10,2 +10,28 @@ var _getIterator2 = require("babel-runtime/core-js/get-iterator"); | ||
var _path = require("./path"); | ||
Object.defineProperty(exports, "NodePath", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_path).default; | ||
} | ||
}); | ||
var _scope = require("./scope"); | ||
Object.defineProperty(exports, "Scope", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_scope).default; | ||
} | ||
}); | ||
var _hub = require("./hub"); | ||
Object.defineProperty(exports, "Hub", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_hub).default; | ||
} | ||
}); | ||
exports.default = traverse; | ||
@@ -37,14 +63,2 @@ | ||
var _path = require("./path"); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _scope = require("./scope"); | ||
var _scope2 = _interopRequireDefault(_scope); | ||
var _hub = require("./hub"); | ||
var _hub2 = _interopRequireDefault(_hub); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -55,5 +69,2 @@ | ||
exports.visitors = visitors; | ||
exports.NodePath = _path2.default; | ||
exports.Scope = _scope2.default; | ||
exports.Hub = _hub2.default; | ||
function traverse(parent, opts, scope, state, parentPath) { | ||
@@ -78,5 +89,5 @@ if (!parent) return; | ||
traverse.NodePath = _path2.default; | ||
traverse.Scope = _scope2.default; | ||
traverse.Hub = _hub2.default; | ||
traverse.NodePath = require("./path"); | ||
traverse.Scope = require("./scope"); | ||
traverse.Hub = require("./hub"); | ||
@@ -83,0 +94,0 @@ traverse.cheap = function (node, enter) { |
@@ -140,3 +140,3 @@ "use strict"; | ||
return this.hub.buildError(this.node, msg, Error); | ||
return this.hub.file.buildCodeFrameError(this.node, msg, Error); | ||
}; | ||
@@ -149,5 +149,7 @@ | ||
NodePath.prototype.mark = function mark(type, message) { | ||
if (this.hub.mark) { | ||
this.hub.mark(type, message, this.node.loc); | ||
} | ||
this.hub.file.metadata.marked.push({ | ||
type: type, | ||
message: message, | ||
loc: this.node.loc | ||
}); | ||
}; | ||
@@ -154,0 +156,0 @@ |
@@ -197,8 +197,6 @@ "use strict"; | ||
if (node.end) { | ||
var code = this.hub.getCode(); | ||
if (code) { | ||
return code.slice(node.start, node.end); | ||
} | ||
return this.hub.file.code.slice(node.start, node.end); | ||
} else { | ||
return ""; | ||
} | ||
return ""; | ||
} | ||
@@ -205,0 +203,0 @@ |
@@ -398,4 +398,3 @@ "use strict"; | ||
if (duplicate) { | ||
var errorMsg = messages.get("scopeDuplicateDeclaration", name); | ||
throw this.hub.buildError ? this.hub.buildError(id, errorMsg, TypeError) : new TypeError(errorMsg); | ||
throw this.hub.file.buildCodeFrameError(id, messages.get("scopeDuplicateDeclaration", name), TypeError); | ||
} | ||
@@ -439,2 +438,4 @@ }; | ||
Scope.prototype.toArray = function toArray(node, i) { | ||
var file = this.hub.file; | ||
if (t.isIdentifier(node)) { | ||
@@ -461,3 +462,3 @@ var binding = this.getBinding(node.name); | ||
} | ||
return t.callExpression(this.hub.addHelper(helperName), args); | ||
return t.callExpression(file.addHelper(helperName), args); | ||
}; | ||
@@ -464,0 +465,0 @@ |
{ | ||
"name": "babel-traverse", | ||
"version": "6.23.0", | ||
"version": "6.23.1", | ||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
@@ -5,0 +5,0 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", |
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
4248
151130