@babel/traverse 7.12.17 → 7.13.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @babel/traverse might be problematic. Click here for more details.

package/lib/context.js CHANGED
@@ -32,7 +32,7 @@ class TraversalContext {
32
32
  if (opts.enter || opts.exit) return true;
33
33
  if (opts[node.type]) return true;
34
34
  const keys = t.VISITOR_KEYS[node.type];
35
- if (!(keys == null ? void 0 : keys.length)) return false;
35
+ if (!(keys != null && keys.length)) return false;
36
36
 
37
37
  for (const key of keys) {
38
38
  if (node[key]) return true;
package/lib/index.js CHANGED
@@ -101,7 +101,7 @@ function hasDenylistedType(path, state) {
101
101
  }
102
102
 
103
103
  traverse.hasType = function (tree, type, denylistTypes) {
104
- if (denylistTypes == null ? void 0 : denylistTypes.includes(tree.type)) return false;
104
+ if (denylistTypes != null && denylistTypes.includes(tree.type)) return false;
105
105
  if (tree.type === type) return true;
106
106
  const state = {
107
107
  has: false,
@@ -121,6 +121,7 @@ function stop() {
121
121
  function setScope() {
122
122
  if (this.opts && this.opts.noScope) return;
123
123
  let path = this.parentPath;
124
+ if (this.key === "key" && path.isMethod()) path = path.parentPath;
124
125
  let target;
125
126
 
126
127
  while (path && !target) {
@@ -95,17 +95,18 @@ function unwrapFunctionEnvironment() {
95
95
 
96
96
  function arrowFunctionToExpression({
97
97
  allowInsertArrow = true,
98
- specCompliant = false
98
+ specCompliant = false,
99
+ noNewArrows = !specCompliant
99
100
  } = {}) {
100
101
  if (!this.isArrowFunctionExpression()) {
101
102
  throw this.buildCodeFrameError("Cannot convert non-arrow function to a function expression.");
102
103
  }
103
104
 
104
- const thisBinding = hoistFunctionEnvironment(this, specCompliant, allowInsertArrow);
105
+ const thisBinding = hoistFunctionEnvironment(this, noNewArrows, allowInsertArrow);
105
106
  this.ensureBlock();
106
107
  this.node.type = "FunctionExpression";
107
108
 
108
- if (specCompliant) {
109
+ if (!noNewArrows) {
109
110
  const checkBinding = thisBinding ? null : this.parentPath.scope.generateUidIdentifier("arrowCheckId");
110
111
 
111
112
  if (checkBinding) {
@@ -120,7 +121,7 @@ function arrowFunctionToExpression({
120
121
  }
121
122
  }
122
123
 
123
- function hoistFunctionEnvironment(fnPath, specCompliant = false, allowInsertArrow = true) {
124
+ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow = true) {
124
125
  const thisEnvFn = fnPath.findParent(p => {
125
126
  return p.isFunction() && !p.isArrowFunctionExpression() || p.isProgram() || p.isClassProperty({
126
127
  static: false
@@ -230,16 +231,16 @@ function hoistFunctionEnvironment(fnPath, specCompliant = false, allowInsertArro
230
231
 
231
232
  let thisBinding;
232
233
 
233
- if (thisPaths.length > 0 || specCompliant) {
234
+ if (thisPaths.length > 0 || !noNewArrows) {
234
235
  thisBinding = getThisBinding(thisEnvFn, inConstructor);
235
236
 
236
- if (!specCompliant || inConstructor && hasSuperClass(thisEnvFn)) {
237
+ if (noNewArrows || inConstructor && hasSuperClass(thisEnvFn)) {
237
238
  thisPaths.forEach(thisChild => {
238
239
  const thisRef = thisChild.isJSX() ? t.jsxIdentifier(thisBinding) : t.identifier(thisBinding);
239
240
  thisRef.loc = thisChild.node.loc;
240
241
  thisChild.replaceWith(thisRef);
241
242
  });
242
- if (specCompliant) thisBinding = null;
243
+ if (!noNewArrows) thisBinding = null;
243
244
  }
244
245
  }
245
246
 
@@ -129,7 +129,7 @@ function _evaluate(path, state) {
129
129
  return deopt(binding.path, state);
130
130
  }
131
131
 
132
- if (binding == null ? void 0 : binding.hasValue) {
132
+ if (binding != null && binding.hasValue) {
133
133
  return binding.value;
134
134
  } else {
135
135
  if (path.node.name === "undefined") {
@@ -28,6 +28,23 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
28
28
 
29
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
30
 
31
+ const NORMAL_COMPLETION = 0;
32
+ const BREAK_COMPLETION = 1;
33
+
34
+ function NormalCompletion(path) {
35
+ return {
36
+ type: NORMAL_COMPLETION,
37
+ path
38
+ };
39
+ }
40
+
41
+ function BreakCompletion(path) {
42
+ return {
43
+ type: BREAK_COMPLETION,
44
+ path
45
+ };
46
+ }
47
+
31
48
  function getOpposite() {
32
49
  if (this.key === "left") {
33
50
  return this.getSibling("right");
@@ -38,102 +55,163 @@ function getOpposite() {
38
55
  return null;
39
56
  }
40
57
 
41
- function addCompletionRecords(path, paths) {
42
- if (path) return paths.concat(path.getCompletionRecords());
43
- return paths;
58
+ function addCompletionRecords(path, records, context) {
59
+ if (path) return records.concat(_getCompletionRecords(path, context));
60
+ return records;
44
61
  }
45
62
 
46
- function findBreak(statements) {
47
- let breakStatement;
63
+ function completionRecordForSwitch(cases, records, context) {
64
+ let lastNormalCompletions = [];
48
65
 
49
- if (!Array.isArray(statements)) {
50
- statements = [statements];
51
- }
66
+ for (let i = 0; i < cases.length; i++) {
67
+ const casePath = cases[i];
68
+
69
+ const caseCompletions = _getCompletionRecords(casePath, context);
52
70
 
53
- for (const statement of statements) {
54
- if (statement.isDoExpression() || statement.isProgram() || statement.isBlockStatement() || statement.isCatchClause() || statement.isLabeledStatement()) {
55
- breakStatement = findBreak(statement.get("body"));
56
- } else if (statement.isIfStatement()) {
57
- var _findBreak;
71
+ const normalCompletions = [];
72
+ const breakCompletions = [];
58
73
 
59
- breakStatement = (_findBreak = findBreak(statement.get("consequent"))) != null ? _findBreak : findBreak(statement.get("alternate"));
60
- } else if (statement.isTryStatement()) {
61
- var _findBreak2;
74
+ for (const c of caseCompletions) {
75
+ if (c.type === NORMAL_COMPLETION) {
76
+ normalCompletions.push(c);
77
+ }
62
78
 
63
- breakStatement = (_findBreak2 = findBreak(statement.get("block"))) != null ? _findBreak2 : findBreak(statement.get("handler"));
64
- } else if (statement.isBreakStatement()) {
65
- breakStatement = statement;
79
+ if (c.type === BREAK_COMPLETION) {
80
+ breakCompletions.push(c);
81
+ }
66
82
  }
67
83
 
68
- if (breakStatement) {
69
- return breakStatement;
84
+ if (normalCompletions.length) {
85
+ lastNormalCompletions = normalCompletions;
70
86
  }
87
+
88
+ records = records.concat(breakCompletions);
71
89
  }
72
90
 
73
- return null;
91
+ records = records.concat(lastNormalCompletions);
92
+ return records;
74
93
  }
75
94
 
76
- function completionRecordForSwitch(cases, paths) {
77
- let isLastCaseWithConsequent = true;
78
-
79
- for (let i = cases.length - 1; i >= 0; i--) {
80
- const switchCase = cases[i];
81
- const consequent = switchCase.get("consequent");
82
- let breakStatement = findBreak(consequent);
95
+ function normalCompletionToBreak(completions) {
96
+ completions.forEach(c => {
97
+ c.type = BREAK_COMPLETION;
98
+ });
99
+ }
83
100
 
84
- if (breakStatement) {
85
- while (breakStatement.key === 0 && breakStatement.parentPath.isBlockStatement()) {
86
- breakStatement = breakStatement.parentPath;
101
+ function replaceBreakStatementInBreakCompletion(completions, reachable) {
102
+ completions.forEach(c => {
103
+ if (c.path.isBreakStatement({
104
+ label: null
105
+ })) {
106
+ if (reachable) {
107
+ c.path.replaceWith(t.unaryExpression("void", t.numericLiteral(0)));
108
+ } else {
109
+ c.path.remove();
87
110
  }
111
+ }
112
+ });
113
+ }
88
114
 
89
- const prevSibling = breakStatement.getPrevSibling();
115
+ function getStatementListCompletion(paths, context) {
116
+ let completions = [];
90
117
 
91
- if (breakStatement.key > 0 && (prevSibling.isExpressionStatement() || prevSibling.isBlockStatement())) {
92
- paths = addCompletionRecords(prevSibling, paths);
93
- breakStatement.remove();
94
- } else {
95
- breakStatement.replaceWith(breakStatement.scope.buildUndefinedNode());
96
- paths = addCompletionRecords(breakStatement, paths);
118
+ if (context.canHaveBreak) {
119
+ let lastNormalCompletions = [];
120
+
121
+ for (let i = 0; i < paths.length; i++) {
122
+ const path = paths[i];
123
+ const newContext = Object.assign({}, context, {
124
+ inCaseClause: false
125
+ });
126
+
127
+ if (path.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
128
+ newContext.shouldPopulateBreak = true;
129
+ } else {
130
+ newContext.shouldPopulateBreak = false;
97
131
  }
98
- } else if (isLastCaseWithConsequent) {
99
- const statementFinder = statement => !statement.isBlockStatement() || statement.get("body").some(statementFinder);
100
132
 
101
- const hasConsequent = consequent.some(statementFinder);
133
+ const statementCompletions = _getCompletionRecords(path, newContext);
134
+
135
+ if (statementCompletions.length > 0 && statementCompletions.every(c => c.type === BREAK_COMPLETION)) {
136
+ if (lastNormalCompletions.length > 0 && statementCompletions.every(c => c.path.isBreakStatement({
137
+ label: null
138
+ }))) {
139
+ normalCompletionToBreak(lastNormalCompletions);
140
+ completions = completions.concat(lastNormalCompletions);
141
+
142
+ if (lastNormalCompletions.some(c => c.path.isDeclaration())) {
143
+ completions = completions.concat(statementCompletions);
144
+ replaceBreakStatementInBreakCompletion(statementCompletions, true);
145
+ }
102
146
 
103
- if (hasConsequent) {
104
- paths = addCompletionRecords(consequent[consequent.length - 1], paths);
105
- isLastCaseWithConsequent = false;
147
+ replaceBreakStatementInBreakCompletion(statementCompletions, false);
148
+ } else {
149
+ completions = completions.concat(statementCompletions);
150
+
151
+ if (!context.shouldPopulateBreak) {
152
+ replaceBreakStatementInBreakCompletion(statementCompletions, true);
153
+ }
154
+ }
155
+
156
+ break;
157
+ }
158
+
159
+ if (i === paths.length - 1) {
160
+ completions = completions.concat(statementCompletions);
161
+ } else {
162
+ completions = completions.concat(statementCompletions.filter(c => c.type === BREAK_COMPLETION));
163
+ lastNormalCompletions = statementCompletions.filter(c => c.type === NORMAL_COMPLETION);
106
164
  }
107
165
  }
166
+ } else if (paths.length) {
167
+ completions = completions.concat(_getCompletionRecords(paths[paths.length - 1], context));
108
168
  }
109
169
 
110
- return paths;
170
+ return completions;
111
171
  }
112
172
 
113
- function getCompletionRecords() {
114
- let paths = [];
115
-
116
- if (this.isIfStatement()) {
117
- paths = addCompletionRecords(this.get("consequent"), paths);
118
- paths = addCompletionRecords(this.get("alternate"), paths);
119
- } else if (this.isDoExpression() || this.isFor() || this.isWhile()) {
120
- paths = addCompletionRecords(this.get("body"), paths);
121
- } else if (this.isProgram() || this.isBlockStatement()) {
122
- paths = addCompletionRecords(this.get("body").pop(), paths);
123
- } else if (this.isFunction()) {
124
- return this.get("body").getCompletionRecords();
125
- } else if (this.isTryStatement()) {
126
- paths = addCompletionRecords(this.get("block"), paths);
127
- paths = addCompletionRecords(this.get("handler"), paths);
128
- } else if (this.isCatchClause()) {
129
- paths = addCompletionRecords(this.get("body"), paths);
130
- } else if (this.isSwitchStatement()) {
131
- paths = completionRecordForSwitch(this.get("cases"), paths);
173
+ function _getCompletionRecords(path, context) {
174
+ let records = [];
175
+
176
+ if (path.isIfStatement()) {
177
+ records = addCompletionRecords(path.get("consequent"), records, context);
178
+ records = addCompletionRecords(path.get("alternate"), records, context);
179
+ } else if (path.isDoExpression() || path.isFor() || path.isWhile() || path.isLabeledStatement()) {
180
+ records = addCompletionRecords(path.get("body"), records, context);
181
+ } else if (path.isProgram() || path.isBlockStatement()) {
182
+ records = records.concat(getStatementListCompletion(path.get("body"), context));
183
+ } else if (path.isFunction()) {
184
+ return _getCompletionRecords(path.get("body"), context);
185
+ } else if (path.isTryStatement()) {
186
+ records = addCompletionRecords(path.get("block"), records, context);
187
+ records = addCompletionRecords(path.get("handler"), records, context);
188
+ } else if (path.isCatchClause()) {
189
+ records = addCompletionRecords(path.get("body"), records, context);
190
+ } else if (path.isSwitchStatement()) {
191
+ records = completionRecordForSwitch(path.get("cases"), records, context);
192
+ } else if (path.isSwitchCase()) {
193
+ records = records.concat(getStatementListCompletion(path.get("consequent"), {
194
+ canHaveBreak: true,
195
+ shouldPopulateBreak: false,
196
+ inCaseClause: true
197
+ }));
198
+ } else if (path.isBreakStatement()) {
199
+ records.push(BreakCompletion(path));
132
200
  } else {
133
- paths.push(this);
201
+ records.push(NormalCompletion(path));
134
202
  }
135
203
 
136
- return paths;
204
+ return records;
205
+ }
206
+
207
+ function getCompletionRecords() {
208
+ const records = _getCompletionRecords(this, {
209
+ canHaveBreak: false,
210
+ shouldPopulateBreak: false,
211
+ inCaseClause: false
212
+ });
213
+
214
+ return records.map(r => r.path);
137
215
  }
138
216
 
139
217
  function getSibling(key) {
package/lib/path/index.js CHANGED
@@ -7,8 +7,6 @@ exports.default = exports.SHOULD_SKIP = exports.SHOULD_STOP = exports.REMOVED =
7
7
 
8
8
  var virtualTypes = _interopRequireWildcard(require("./lib/virtual-types"));
9
9
 
10
- var _debug = _interopRequireDefault(require("debug"));
11
-
12
10
  var _index = _interopRequireDefault(require("../index"));
13
11
 
14
12
  var _scope = _interopRequireDefault(require("../scope"));
@@ -47,7 +45,9 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
47
45
 
48
46
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
49
47
 
50
- const debug = (0, _debug.default)("babel");
48
+ const buildDebug = require("debug");
49
+
50
+ const debug = buildDebug("babel");
51
51
  const REMOVED = 1 << 0;
52
52
  exports.REMOVED = REMOVED;
53
53
  const SHOULD_STOP = 1 << 1;
@@ -70,7 +70,7 @@ function _getTypeAnnotation() {
70
70
 
71
71
  inferer = inferers[this.parentPath.type];
72
72
 
73
- if ((_inferer = inferer) == null ? void 0 : _inferer.validParent) {
73
+ if ((_inferer = inferer) != null && _inferer.validParent) {
74
74
  return this.parentPath.getTypeAnnotation();
75
75
  }
76
76
  } finally {
@@ -111,7 +111,17 @@ function isStatementOrBlock() {
111
111
  }
112
112
 
113
113
  function referencesImport(moduleSource, importName) {
114
- if (!this.isReferencedIdentifier()) return false;
114
+ if (!this.isReferencedIdentifier()) {
115
+ if ((this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? t.isStringLiteral(this.node.property, {
116
+ value: importName
117
+ }) : this.node.property.name === importName)) {
118
+ const object = this.get("object");
119
+ return object.isReferencedIdentifier() && object.referencesImport(moduleSource, "*");
120
+ }
121
+
122
+ return false;
123
+ }
124
+
115
125
  const binding = this.scope.getBinding(this.node.name);
116
126
  if (!binding || binding.kind !== "module") return false;
117
127
  const path = binding.path;
@@ -27,7 +27,7 @@ function remove() {
27
27
 
28
28
  this.resync();
29
29
 
30
- if (!((_this$opts = this.opts) == null ? void 0 : _this$opts.noScope)) {
30
+ if (!((_this$opts = this.opts) != null && _this$opts.noScope)) {
31
31
  this._removeFromScope();
32
32
  }
33
33
 
@@ -194,6 +194,7 @@ function replaceExpressionWithStatements(nodes) {
194
194
 
195
195
  const functionParent = this.getFunctionParent();
196
196
  const isParentAsync = functionParent == null ? void 0 : functionParent.is("async");
197
+ const isParentGenerator = functionParent == null ? void 0 : functionParent.is("generator");
197
198
  const container = t.arrowFunctionExpression([], t.blockStatement(nodes));
198
199
  this.replaceWith(t.callExpression(container, []));
199
200
  this.traverse(hoistVariablesVisitor);
@@ -224,9 +225,21 @@ function replaceExpressionWithStatements(nodes) {
224
225
  const callee = this.get("callee");
225
226
  callee.arrowFunctionToExpression();
226
227
 
227
- if (isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", t.FUNCTION_TYPES)) {
228
+ const needToAwaitFunction = isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", t.FUNCTION_TYPES);
229
+
230
+ const needToYieldFunction = isParentGenerator && _index.default.hasType(this.get("callee.body").node, "YieldExpression", t.FUNCTION_TYPES);
231
+
232
+ if (needToAwaitFunction) {
228
233
  callee.set("async", true);
229
- this.replaceWith(t.awaitExpression(this.node));
234
+
235
+ if (!needToYieldFunction) {
236
+ this.replaceWith(t.awaitExpression(this.node));
237
+ }
238
+ }
239
+
240
+ if (needToYieldFunction) {
241
+ callee.set("generator", true);
242
+ this.replaceWith(t.yieldExpression(this.node, true));
230
243
  }
231
244
 
232
245
  return callee.get("body.body");
@@ -11,8 +11,6 @@ var _index = _interopRequireDefault(require("../index"));
11
11
 
12
12
  var _binding = _interopRequireDefault(require("./binding"));
13
13
 
14
- var _globals = _interopRequireDefault(require("globals"));
15
-
16
14
  var t = _interopRequireWildcard(require("@babel/types"));
17
15
 
18
16
  var _cache = require("../cache");
@@ -23,6 +21,8 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
23
21
 
24
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
23
 
24
+ const globals = require("globals");
25
+
26
26
  function gatherNodeParts(node, parts) {
27
27
  switch (node == null ? void 0 : node.type) {
28
28
  default:
@@ -310,8 +310,19 @@ class Scope {
310
310
  }
311
311
 
312
312
  get parent() {
313
- const parent = this.path.findParent(p => p.isScope());
314
- return parent == null ? void 0 : parent.scope;
313
+ var _parent;
314
+
315
+ let parent,
316
+ path = this.path;
317
+
318
+ do {
319
+ const isKey = path.key === "key";
320
+ path = path.parentPath;
321
+ if (isKey && path.isMethod()) path = path.parentPath;
322
+ if (path && path.isScope()) parent = path;
323
+ } while (path && !parent);
324
+
325
+ return (_parent = parent) == null ? void 0 : _parent.scope;
315
326
  }
316
327
 
317
328
  get parentBlock() {
@@ -455,11 +466,11 @@ class Scope {
455
466
  console.log(sep);
456
467
  }
457
468
 
458
- toArray(node, i, allowArrayLike) {
469
+ toArray(node, i, arrayLikeIsIterable) {
459
470
  if (t.isIdentifier(node)) {
460
471
  const binding = this.getBinding(node.name);
461
472
 
462
- if ((binding == null ? void 0 : binding.constant) && binding.path.isGenericType("Array")) {
473
+ if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
463
474
  return node;
464
475
  }
465
476
  }
@@ -486,7 +497,7 @@ class Scope {
486
497
  helperName = "toArray";
487
498
  }
488
499
 
489
- if (allowArrayLike) {
500
+ if (arrayLikeIsIterable) {
490
501
  args.unshift(this.hub.addHelper(helperName));
491
502
  helperName = "maybeArrayLike";
492
503
  }
@@ -880,7 +891,7 @@ class Scope {
880
891
  if (binding) {
881
892
  var _previousPath;
882
893
 
883
- if (((_previousPath = previousPath) == null ? void 0 : _previousPath.isPattern()) && binding.kind !== "param") {} else {
894
+ if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param") {} else {
884
895
  return binding;
885
896
  }
886
897
  }
@@ -954,5 +965,5 @@ class Scope {
954
965
  }
955
966
 
956
967
  exports.default = Scope;
957
- Scope.globals = Object.keys(_globals.default.builtin);
968
+ Scope.globals = Object.keys(globals.builtin);
958
969
  Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
@@ -28,7 +28,7 @@ const renameVisitor = {
28
28
 
29
29
  Scope(path, state) {
30
30
  if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
31
- path.skip();
31
+ skipAllButComputedMethodKey(path);
32
32
  }
33
33
  },
34
34
 
@@ -128,4 +128,17 @@ class Renamer {
128
128
 
129
129
  }
130
130
 
131
- exports.default = Renamer;
131
+ exports.default = Renamer;
132
+
133
+ function skipAllButComputedMethodKey(path) {
134
+ if (!path.isMethod() || !path.node.computed) {
135
+ path.skip();
136
+ return;
137
+ }
138
+
139
+ const keys = t.VISITOR_KEYS[path.type];
140
+
141
+ for (const key of keys) {
142
+ if (key !== "key") path.skipKey(key);
143
+ }
144
+ }
package/lib/visitors.js CHANGED
@@ -65,11 +65,11 @@ function explode(visitor) {
65
65
  if (shouldIgnoreKey(nodeType)) continue;
66
66
  const fns = visitor[nodeType];
67
67
  let aliases = t.FLIPPED_ALIAS_KEYS[nodeType];
68
- const deprecratedKey = t.DEPRECATED_KEYS[nodeType];
68
+ const deprecatedKey = t.DEPRECATED_KEYS[nodeType];
69
69
 
70
- if (deprecratedKey) {
71
- console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${deprecratedKey}`);
72
- aliases = [deprecratedKey];
70
+ if (deprecatedKey) {
71
+ console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${deprecatedKey}`);
72
+ aliases = [deprecatedKey];
73
73
  }
74
74
 
75
75
  if (!aliases) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/traverse",
3
- "version": "7.12.17",
3
+ "version": "7.13.17",
4
4
  "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
5
5
  "author": "Sebastian McKenzie <sebmck@gmail.com>",
6
6
  "homepage": "https://babel.dev/docs/en/next/babel-traverse",
@@ -17,16 +17,15 @@
17
17
  "main": "lib/index.js",
18
18
  "dependencies": {
19
19
  "@babel/code-frame": "^7.12.13",
20
- "@babel/generator": "^7.12.17",
20
+ "@babel/generator": "^7.13.16",
21
21
  "@babel/helper-function-name": "^7.12.13",
22
22
  "@babel/helper-split-export-declaration": "^7.12.13",
23
- "@babel/parser": "^7.12.17",
24
- "@babel/types": "^7.12.17",
23
+ "@babel/parser": "^7.13.16",
24
+ "@babel/types": "^7.13.17",
25
25
  "debug": "^4.1.0",
26
- "globals": "^11.1.0",
27
- "lodash": "^4.17.19"
26
+ "globals": "^11.1.0"
28
27
  },
29
28
  "devDependencies": {
30
- "@babel/helper-plugin-test-runner": "7.12.13"
29
+ "@babel/helper-plugin-test-runner": "7.13.10"
31
30
  }
32
31
  }