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

@babel/traverse

Package Overview
Dependencies
Maintainers
5
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.0.0-beta.47 to 7.0.0-beta.48

44

lib/context.js

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

t = function t() {
t = function () {
return data;

@@ -43,15 +43,3 @@ };

for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
const key = _ref;
for (const key of keys) {
if (node[key]) return true;

@@ -116,15 +104,3 @@ }

for (var _iterator2 = queue, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
const path = _ref2;
for (const path of queue) {
path.resync();

@@ -158,15 +134,3 @@

for (var _iterator3 = queue, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
const path = _ref3;
for (const path of queue) {
path.popContext();

@@ -173,0 +137,0 @@ }

24

lib/index.js

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

enumerable: true,
get: function get() {
get: function () {
return _path.default;

@@ -16,3 +16,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _scope.default;

@@ -23,3 +23,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _hub.default;

@@ -39,3 +39,3 @@ }

_includes = function _includes() {
_includes = function () {
return data;

@@ -50,3 +50,3 @@ };

t = function t() {
t = function () {
return data;

@@ -97,15 +97,3 @@ };

for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
const key = _ref;
for (const key of keys) {
if (skipKeys && skipKeys[key]) continue;

@@ -112,0 +100,0 @@ if (context.visit(node, key)) return;

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

t = function t() {
t = function () {
return data;

@@ -80,6 +80,4 @@ };

const keys = t().VISITOR_KEYS[deepest.type];
var _arr = ancestries;
for (var _i = 0; _i < _arr.length; _i++) {
const ancestry = _arr[_i];
for (const ancestry of ancestries) {
const path = ancestry[i + 1];

@@ -139,7 +137,4 @@

const shouldMatch = first[i];
var _arr2 = ancestries;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
const ancestry = _arr2[_i2];
for (const ancestry of ancestries) {
if (ancestry[i] !== shouldMatch) {

@@ -188,6 +183,3 @@ break depthLoop;

while (path) {
var _arr3 = arguments;
for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
const type = _arr3[_i3];
for (const type of arguments) {
if (path.node.type === type) return true;

@@ -194,0 +186,0 @@ }

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

t = function t() {
t = function () {
return data;

@@ -16,0 +16,0 @@ };

@@ -49,15 +49,3 @@ "use strict";

for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
const fn = _ref;
for (const fn of fns) {
if (!fn) continue;

@@ -242,15 +230,3 @@ const node = this.node;

for (var _iterator2 = contexts, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
const context = _ref2;
for (const context of contexts) {
context.maybeQueue(pathToQueue);

@@ -257,0 +233,0 @@ }

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

t = function t() {
t = function () {
return data;

@@ -26,3 +26,3 @@ };

_helperFunctionName = function _helperFunctionName() {
_helperFunctionName = function () {
return data;

@@ -152,8 +152,9 @@ };

const _getScopeInformation = getScopeInformation(fnPath),
thisPaths = _getScopeInformation.thisPaths,
argumentsPaths = _getScopeInformation.argumentsPaths,
newTargetPaths = _getScopeInformation.newTargetPaths,
superProps = _getScopeInformation.superProps,
superCalls = _getScopeInformation.superCalls;
const {
thisPaths,
argumentsPaths,
newTargetPaths,
superProps,
superCalls
} = getScopeInformation(fnPath);

@@ -160,0 +161,0 @@ if (inConstructor && superCalls.length > 0) {

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

function evaluateCached(path, state) {
const node = path.node;
const seen = state.seen;
const {
node
} = path;
const {
seen
} = state;

@@ -55,3 +59,5 @@ if (seen.has(node)) {

if (!state.confident) return;
const node = path.node;
const {
node
} = path;

@@ -77,3 +83,7 @@ if (path.isSequenceExpression()) {

const object = path.get("tag.object");
const name = object.node.name;
const {
node: {
name
}
} = object;
const property = path.get("tag.property");

@@ -187,15 +197,3 @@

for (var _iterator = elems, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
const elem = _ref;
for (const elem of elems) {
const elemValue = elem.evaluate();

@@ -217,16 +215,3 @@

for (var _iterator2 = props, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
const prop = _ref2;
for (const prop of props) {
if (prop.isObjectMethod() || prop.isSpreadElement()) {

@@ -408,15 +393,3 @@ return deopt(prop, state);

for (var _iterator3 = quasis, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
const elem = _ref3;
for (const elem of quasis) {
if (!state.confident) break;

@@ -423,0 +396,0 @@ str += raw ? elem.value.raw : elem.value.cooked;

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

t = function t() {
t = function () {
return data;

@@ -157,7 +157,4 @@ };

let path = this;
var _arr = parts;
for (var _i = 0; _i < _arr.length; _i++) {
const part = _arr[_i];
for (const part of parts) {
if (part === ".") {

@@ -164,0 +161,0 @@ path = path.parentPath;

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

_debug = function _debug() {
_debug = function () {
return data;

@@ -24,3 +24,3 @@ };

_invariant = function _invariant() {
_invariant = function () {
return data;

@@ -39,3 +39,3 @@ };

t = function t() {
t = function () {
return data;

@@ -52,3 +52,3 @@ };

_generator = function _generator() {
_generator = function () {
return data;

@@ -206,6 +206,4 @@ };

Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments);
var _arr = t().TYPES;
for (var _i = 0; _i < _arr.length; _i++) {
const type = _arr[_i];
for (const type of t().TYPES) {
const typeKey = `is${type}`;

@@ -212,0 +210,0 @@ const fn = t()[typeKey];

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

t = function t() {
t = function () {
return data;

@@ -107,7 +107,3 @@ };

if (t().isUnionTypeAnnotation(type)) {
var _arr = type.types;
for (var _i = 0; _i < _arr.length; _i++) {
const type2 = _arr[_i];
for (const type2 of type.types) {
if (t().isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {

@@ -114,0 +110,0 @@ return true;

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

t = function t() {
t = function () {
return data;

@@ -54,6 +54,4 @@ };

constantViolations = constantViolations.concat(functionConstantViolations);
var _arr = constantViolations;
for (var _i = 0; _i < _arr.length; _i++) {
const violation = _arr[_i];
for (const violation of constantViolations) {
types.push(violation.getTypeAnnotation());

@@ -60,0 +58,0 @@ }

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

enumerable: true,
get: function get() {
get: function () {
return _infererReference.default;

@@ -39,3 +39,3 @@ }

t = function t() {
t = function () {
return data;

@@ -189,3 +189,5 @@ };

function CallExpression() {
const callee = this.node.callee;
const {
callee
} = this.node;

@@ -192,0 +194,0 @@ if (isObjectKeys(callee)) {

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

_includes = function _includes() {
_includes = function () {
return data;

@@ -41,3 +41,3 @@ };

t = function t() {
t = function () {
return data;

@@ -235,16 +235,3 @@ };

for (var _iterator = referencePaths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
const path = _ref;
for (const path of referencePaths) {
if (path.key !== "callee" || !path.parentPath.isCallExpression()) {

@@ -257,15 +244,3 @@ return;

for (var _iterator2 = referencePaths, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
const path = _ref2;
for (const path of referencePaths) {
const childOfFunction = !!path.find(path => path.node === targetFuncPath.node);

@@ -320,6 +295,4 @@ if (childOfFunction) continue;

const props = target.get("properties");
var _arr = props;
for (var _i3 = 0; _i3 < _arr.length; _i3++) {
const prop = _arr[_i3];
for (const prop of props) {
if (!prop.isProperty()) continue;

@@ -394,19 +367,8 @@ const key = prop.get("key");

let node = path.node;
let {
node
} = path;
if (path.isFunction()) node = node.body;
for (var _iterator3 = node.directives, _isArray3 = Array.isArray(_iterator3), _i4 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i4 >= _iterator3.length) break;
_ref3 = _iterator3[_i4++];
} else {
_i4 = _iterator3.next();
if (_i4.done) break;
_ref3 = _i4.value;
}
const directive = _ref3;
for (const directive of node.directives) {
if (directive.value.value === "use strict") {

@@ -413,0 +375,0 @@ return true;

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

t = function t() {
t = function () {
return data;

@@ -109,7 +109,4 @@ };

path = binding.path;
var _arr = binding.constantViolations;
for (var _i = 0; _i < _arr.length; _i++) {
const violationPath = _arr[_i];
for (const violationPath of binding.constantViolations) {
if (this.getAttachmentParentForPath(violationPath).key > path.key) {

@@ -180,6 +177,3 @@ path = violationPath;

const insertFn = this.attachAfter ? "insertAfter" : "insertBefore";
const _attachTo$insertFn = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t().variableDeclaration("var", [declarator])]),
attached = _attachTo$insertFn[0];
const [attached] = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t().variableDeclaration("var", [declarator])]);
const parent = this.path.parentPath;

@@ -186,0 +180,0 @@

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

t = function t() {
t = function () {
return data;

@@ -14,0 +14,0 @@ };

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

t = function t() {
t = function () {
return data;

@@ -42,3 +42,5 @@ };

nodes = this._verifyNodeList(nodes);
const parentPath = this.parentPath;
const {
parentPath
} = this;

@@ -78,20 +80,7 @@ if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {

for (var _i = 0; _i < paths.length; _i++) {
const path = paths[_i];
for (const path of paths) {
path.setScope();
path.debug("Inserted.");
for (var _iterator = contexts, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i2 >= _iterator.length) break;
_ref = _iterator[_i2++];
} else {
_i2 = _iterator.next();
if (_i2.done) break;
_ref = _i2.value;
}
const context = _ref;
for (const context of contexts) {
context.maybeQueue(path, true);

@@ -116,3 +105,5 @@ }

nodes = this._verifyNodeList(nodes);
const parentPath = this.parentPath;
const {
parentPath
} = this;

@@ -123,3 +114,5 @@ if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {

if (this.node) {
let scope = this.scope;
let {
scope
} = this;

@@ -126,0 +119,0 @@ if (parentPath.isMethod({

@@ -41,6 +41,3 @@ "use strict";

function _callRemovalHooks() {
var _arr = _removalHooks.hooks;
for (var _i = 0; _i < _arr.length; _i++) {
const fn = _arr[_i];
for (const fn of _removalHooks.hooks) {
if (fn(this, this.parentPath)) return true;

@@ -47,0 +44,0 @@ }

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

_codeFrame = function _codeFrame() {
_codeFrame = function () {
return data;

@@ -28,6 +28,6 @@ };

function _babylon() {
const data = require("babylon");
function _parser() {
const data = require("@babel/parser");
_babylon = function _babylon() {
_parser = function () {
return data;

@@ -42,3 +42,3 @@ };

t = function t() {
t = function () {
return data;

@@ -70,7 +70,4 @@ };

const exprs = [];
var _arr = path.node.declarations;
for (var _i = 0; _i < _arr.length; _i++) {
const declar = _arr[_i];
for (const declar of path.node.declarations) {
if (declar.init) {

@@ -108,3 +105,3 @@ exprs.push(t().expressionStatement(t().assignmentExpression("=", declar.id, declar.init)));

replacement = `(${replacement})`;
replacement = (0, _babylon().parse)(replacement);
replacement = (0, _parser().parse)(replacement);
} catch (err) {

@@ -222,15 +219,3 @@ const loc = err.loc;

for (var _iterator = completionRecords, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i2 >= _iterator.length) break;
_ref = _iterator[_i2++];
} else {
_i2 = _iterator.next();
if (_i2.done) break;
_ref = _i2.value;
}
const path = _ref;
for (const path of completionRecords) {
if (!path.isExpressionStatement()) continue;

@@ -237,0 +222,0 @@ const loop = path.findParent(path => path.isLoop());

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

_includes = function _includes() {
_includes = function () {
return data;

@@ -22,3 +22,3 @@ };

_repeat = function _repeat() {
_repeat = function () {
return data;

@@ -37,3 +37,3 @@ };

_defaults = function _defaults() {
_defaults = function () {
return data;

@@ -50,3 +50,3 @@ };

_globals = function _globals() {
_globals = function () {
return data;

@@ -61,3 +61,3 @@ };

t = function t() {
t = function () {
return data;

@@ -80,6 +80,3 @@ };

} else if (node.specifiers && node.specifiers.length) {
var _arr = node.specifiers;
for (var _i = 0; _i < _arr.length; _i++) {
const specifier = _arr[_i];
for (const specifier of node.specifiers) {
gatherNodeParts(specifier, parts);

@@ -102,6 +99,3 @@ }

} else if (t().isObjectExpression(node) || t().isObjectPattern(node)) {
var _arr2 = node.properties;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
const prop = _arr2[_i2];
for (const prop of node.properties) {
gatherNodeParts(prop.key || prop.argument, parts);

@@ -120,6 +114,3 @@ }

For(path) {
var _arr3 = t().FOR_INIT_KEYS;
for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
const key = _arr3[_i3];
for (const key of t().FOR_INIT_KEYS) {
const declar = path.get(key);

@@ -159,4 +150,6 @@

exit(path) {
const node = path.node,
scope = path.scope;
const {
node,
scope
} = path;
const declar = node.declaration;

@@ -170,6 +163,3 @@

} else if (t().isVariableDeclaration(declar)) {
var _arr4 = declar.declarations;
for (var _i4 = 0; _i4 < _arr4.length; _i4++) {
const decl = _arr4[_i4];
for (const decl of declar.declarations) {
const ids = t().getBindingIdentifiers(decl);

@@ -221,7 +211,4 @@

const paths = path.get("body");
var _arr5 = paths;
for (var _i5 = 0; _i5 < _arr5.length; _i5++) {
const bodyPath = _arr5[_i5];
for (const bodyPath of paths) {
if (bodyPath.isFunctionDeclaration()) {

@@ -238,3 +225,5 @@ path.scope.getBlockParent().registerDeclaration(bodyPath);

constructor(path) {
const node = path.node;
const {
node
} = path;

@@ -461,4 +450,2 @@ const cached = _cache.scope.get(node);

registerDeclaration(path) {
if (path.isFlow()) return;
if (path.isLabeledStatement()) {

@@ -470,6 +457,4 @@ this.registerLabel(path);

const declarations = path.get("declarations");
var _arr6 = declarations;
for (var _i6 = 0; _i6 < _arr6.length; _i6++) {
const declar = _arr6[_i6];
for (const declar of declarations) {
this.registerBinding(path.node.kind, declar);

@@ -481,6 +466,4 @@ }

const specifiers = path.get("specifiers");
var _arr7 = specifiers;
for (var _i7 = 0; _i7 < _arr7.length; _i7++) {
const specifier = _arr7[_i7];
for (const specifier of specifiers) {
this.registerBinding("module", specifier);

@@ -522,15 +505,3 @@ }

for (var _iterator = declarators, _isArray = Array.isArray(_iterator), _i8 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i8 >= _iterator.length) break;
_ref = _iterator[_i8++];
} else {
_i8 = _iterator.next();
if (_i8.done) break;
_ref = _i8.value;
}
const declar = _ref;
for (const declar of declarators) {
this.registerBinding(kind, declar);

@@ -546,6 +517,3 @@ }

for (const name in ids) {
var _arr8 = ids[name];
for (var _i9 = 0; _i9 < _arr8.length; _i9++) {
const id = _arr8[_i9];
for (const id of ids[name]) {
const local = this.getOwnBinding(name);

@@ -621,15 +589,3 @@

} else if (t().isClassBody(node)) {
for (var _iterator2 = node.body, _isArray2 = Array.isArray(_iterator2), _i10 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i10 >= _iterator2.length) break;
_ref2 = _iterator2[_i10++];
} else {
_i10 = _iterator2.next();
if (_i10.done) break;
_ref2 = _i10.value;
}
const method = _ref2;
for (const method of node.body) {
if (!this.isPure(method, constantsOnly)) return false;

@@ -642,6 +598,3 @@ }

} else if (t().isArrayExpression(node)) {
var _arr9 = node.elements;
for (var _i11 = 0; _i11 < _arr9.length; _i11++) {
const elem = _arr9[_i11];
for (const elem of node.elements) {
if (!this.isPure(elem, constantsOnly)) return false;

@@ -652,6 +605,3 @@ }

} else if (t().isObjectExpression(node)) {
var _arr10 = node.properties;
for (var _i12 = 0; _i12 < _arr10.length; _i12++) {
const prop = _arr10[_i12];
for (const prop of node.properties) {
if (!this.isPure(prop, constantsOnly)) return false;

@@ -673,6 +623,3 @@ }

} else if (t().isTemplateLiteral(node)) {
var _arr11 = node.expressions;
for (var _i13 = 0; _i13 < _arr11.length; _i13++) {
const expression = _arr11[_i13];
for (const expression of node.expressions) {
if (!this.isPure(expression, constantsOnly)) return false;

@@ -722,6 +669,3 @@ }

if (path.isLoop()) {
var _arr12 = t().FOR_INIT_KEYS;
for (var _i14 = 0; _i14 < _arr12.length; _i14++) {
const key = _arr12[_i14];
for (const key of t().FOR_INIT_KEYS) {
const node = path.get(key);

@@ -747,15 +691,3 @@ if (node.isBlockScoped()) this.registerBinding(node.node.kind, node);

for (var _iterator3 = params, _isArray3 = Array.isArray(_iterator3), _i15 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i15 >= _iterator3.length) break;
_ref3 = _iterator3[_i15++];
} else {
_i15 = _iterator3.next();
if (_i15.done) break;
_ref3 = _i15.value;
}
const param = _ref3;
for (const param of params) {
this.registerBinding("param", param);

@@ -780,15 +712,3 @@ }

for (var _iterator4 = state.assignments, _isArray4 = Array.isArray(_iterator4), _i16 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref4;
if (_isArray4) {
if (_i16 >= _iterator4.length) break;
_ref4 = _iterator4[_i16++];
} else {
_i16 = _iterator4.next();
if (_i16.done) break;
_ref4 = _i16.value;
}
const path = _ref4;
for (const path of state.assignments) {
const ids = path.getBindingIdentifiers();

@@ -806,15 +726,3 @@ let programParent;

for (var _iterator5 = state.references, _isArray5 = Array.isArray(_iterator5), _i17 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
var _ref5;
if (_isArray5) {
if (_i17 >= _iterator5.length) break;
_ref5 = _iterator5[_i17++];
} else {
_i17 = _iterator5.next();
if (_i17.done) break;
_ref5 = _i17.value;
}
const ref = _ref5;
for (const ref of state.references) {
const binding = ref.scope.getBinding(ref.node.name);

@@ -829,15 +737,3 @@

for (var _iterator6 = state.constantViolations, _isArray6 = Array.isArray(_iterator6), _i18 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
var _ref6;
if (_isArray6) {
if (_i18 >= _iterator6.length) break;
_ref6 = _iterator6[_i18++];
} else {
_i18 = _iterator6.next();
if (_i18.done) break;
_ref6 = _i18.value;
}
const path = _ref6;
for (const path of state.constantViolations) {
path.scope.registerConstantViolation(path);

@@ -872,6 +768,3 @@ }

declar._blockHoist = blockHoist;
var _path$unshiftContaine = path.unshiftContainer("body", [declar]);
declarPath = _path$unshiftContaine[0];
[declarPath] = path.unshiftContainer("body", [declar]);
if (!unique) path.setData(dataKey, declarPath);

@@ -935,6 +828,4 @@ }

const ids = Object.create(null);
var _arr13 = arguments;
for (var _i19 = 0; _i19 < _arr13.length; _i19++) {
const kind = _arr13[_i19];
for (const kind of arguments) {
let scope = this;

@@ -941,0 +832,0 @@

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

_helperSplitExportDeclaration = function _helperSplitExportDeclaration() {
_helperSplitExportDeclaration = function () {
return data;

@@ -24,3 +24,3 @@ };

t = function t() {
t = function () {
return data;

@@ -103,7 +103,11 @@ };

rename(block) {
const binding = this.binding,
oldName = this.oldName,
newName = this.newName;
const scope = binding.scope,
path = binding.path;
const {
binding,
oldName,
newName
} = this;
const {
scope,
path
} = binding;
const parentDeclar = path.find(path => path.isDeclaration() || path.isFunctionExpression() || path.isClassExpression());

@@ -110,0 +114,0 @@

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

t = function t() {
t = function () {
return data;

@@ -26,3 +26,3 @@ };

_clone = function _clone() {
_clone = function () {
return data;

@@ -49,15 +49,3 @@ };

for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
const part = _ref;
for (const part of parts) {
visitor[part] = fns;

@@ -72,6 +60,3 @@ }

var _arr = Object.keys(visitor);
for (var _i2 = 0; _i2 < _arr.length; _i2++) {
const nodeType = _arr[_i2];
for (const nodeType of Object.keys(visitor)) {
if (shouldIgnoreKey(nodeType)) continue;

@@ -89,7 +74,3 @@ const wrapper = virtualTypes[nodeType];

if (wrapper.types) {
var _arr2 = wrapper.types;
for (var _i4 = 0; _i4 < _arr2.length; _i4++) {
const type = _arr2[_i4];
for (const type of wrapper.types) {
if (visitor[type]) {

@@ -120,15 +101,3 @@ mergePair(visitor[type], fns);

for (var _iterator2 = aliases, _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i3 >= _iterator2.length) break;
_ref2 = _iterator2[_i3++];
} else {
_i3 = _iterator2.next();
if (_i3.done) break;
_ref2 = _i3.value;
}
const alias = _ref2;
for (const alias of aliases) {
const existing = visitor[alias];

@@ -189,16 +158,3 @@

for (var _iterator3 = fns, _isArray3 = Array.isArray(_iterator3), _i5 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i5 >= _iterator3.length) break;
_ref3 = _iterator3[_i5++];
} else {
_i5 = _iterator3.next();
if (_i5.done) break;
_ref3 = _i5.value;
}
const fn = _ref3;
for (const fn of fns) {
if (typeof fn !== "function") {

@@ -243,3 +199,3 @@ throw new TypeError(`Non-function found defined in ${path} with type ${typeof fn}`);

if (state) {
newFn = function newFn(path) {
newFn = function (path) {
return fn.call(state, path, state);

@@ -280,3 +236,3 @@ };

function wrapCheck(wrapper, fn) {
const newFn = function newFn(path) {
const newFn = function (path) {
if (wrapper.checkPath(path)) {

@@ -283,0 +239,0 @@ return fn.apply(this, arguments);

{
"name": "@babel/traverse",
"version": "7.0.0-beta.47",
"version": "7.0.0-beta.48",
"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-beta.47",
"@babel/generator": "7.0.0-beta.47",
"@babel/helper-function-name": "7.0.0-beta.47",
"@babel/helper-split-export-declaration": "7.0.0-beta.47",
"@babel/types": "7.0.0-beta.47",
"babylon": "7.0.0-beta.47",
"@babel/code-frame": "7.0.0-beta.48",
"@babel/generator": "7.0.0-beta.48",
"@babel/helper-function-name": "7.0.0-beta.48",
"@babel/helper-split-export-declaration": "7.0.0-beta.48",
"@babel/parser": "7.0.0-beta.48",
"@babel/types": "7.0.0-beta.48",
"debug": "^3.1.0",

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

"devDependencies": {
"@babel/helper-plugin-test-runner": "7.0.0-beta.47"
"@babel/helper-plugin-test-runner": "7.0.0-beta.48"
}
}

@@ -13,6 +13,6 @@ # @babel/traverse

We can use it alongside Babylon to traverse and update nodes:
We can use it alongside the babel parser to traverse and update nodes:
```js
import * as babylon from "babylon";
import * as parser from "@babel/parser";
import traverse from "@babel/traverse";

@@ -24,3 +24,3 @@

const ast = babylon.parse(code);
const ast = parser.parse(code);

@@ -27,0 +27,0 @@ traverse(ast, {

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