@babel/traverse 7.6.0 → 7.7.2

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.

@@ -5,70 +5,32 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- function _includes() {
9
- const data = _interopRequireDefault(require("lodash/includes"));
8
+ var _includes = _interopRequireDefault(require("lodash/includes"));
10
9
 
11
- _includes = function () {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function _repeat() {
19
- const data = _interopRequireDefault(require("lodash/repeat"));
20
-
21
- _repeat = function () {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
10
+ var _repeat = _interopRequireDefault(require("lodash/repeat"));
27
11
 
28
12
  var _renamer = _interopRequireDefault(require("./lib/renamer"));
29
13
 
30
14
  var _index = _interopRequireDefault(require("../index"));
31
15
 
32
- function _defaults() {
33
- const data = _interopRequireDefault(require("lodash/defaults"));
34
-
35
- _defaults = function () {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
16
+ var _defaults = _interopRequireDefault(require("lodash/defaults"));
41
17
 
42
18
  var _binding = _interopRequireDefault(require("./binding"));
43
19
 
44
- function _globals() {
45
- const data = _interopRequireDefault(require("globals"));
46
-
47
- _globals = function () {
48
- return data;
49
- };
50
-
51
- return data;
52
- }
53
-
54
- function t() {
55
- const data = _interopRequireWildcard(require("@babel/types"));
56
-
57
- t = function () {
58
- return data;
59
- };
20
+ var _globals = _interopRequireDefault(require("globals"));
60
21
 
61
- return data;
62
- }
22
+ var t = _interopRequireWildcard(require("@babel/types"));
63
23
 
64
24
  var _cache = require("../cache");
65
25
 
66
- 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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
26
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
27
+
28
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { 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; }
67
29
 
68
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
69
31
 
70
32
  function gatherNodeParts(node, parts) {
71
- if (t().isModuleDeclaration(node)) {
33
+ if (t.isModuleDeclaration(node)) {
72
34
  if (node.source) {
73
35
  gatherNodeParts(node.source, parts);
74
36
  } else if (node.specifiers && node.specifiers.length) {
@@ -78,33 +40,33 @@ function gatherNodeParts(node, parts) {
78
40
  } else if (node.declaration) {
79
41
  gatherNodeParts(node.declaration, parts);
80
42
  }
81
- } else if (t().isModuleSpecifier(node)) {
43
+ } else if (t.isModuleSpecifier(node)) {
82
44
  gatherNodeParts(node.local, parts);
83
- } else if (t().isMemberExpression(node)) {
45
+ } else if (t.isMemberExpression(node)) {
84
46
  gatherNodeParts(node.object, parts);
85
47
  gatherNodeParts(node.property, parts);
86
- } else if (t().isIdentifier(node)) {
48
+ } else if (t.isIdentifier(node)) {
87
49
  parts.push(node.name);
88
- } else if (t().isLiteral(node)) {
50
+ } else if (t.isLiteral(node)) {
89
51
  parts.push(node.value);
90
- } else if (t().isCallExpression(node)) {
52
+ } else if (t.isCallExpression(node)) {
91
53
  gatherNodeParts(node.callee, parts);
92
- } else if (t().isObjectExpression(node) || t().isObjectPattern(node)) {
54
+ } else if (t.isObjectExpression(node) || t.isObjectPattern(node)) {
93
55
  for (const prop of node.properties) {
94
56
  gatherNodeParts(prop.key || prop.argument, parts);
95
57
  }
96
- } else if (t().isPrivateName(node)) {
58
+ } else if (t.isPrivateName(node)) {
97
59
  gatherNodeParts(node.id, parts);
98
- } else if (t().isThisExpression(node)) {
60
+ } else if (t.isThisExpression(node)) {
99
61
  parts.push("this");
100
- } else if (t().isSuper(node)) {
62
+ } else if (t.isSuper(node)) {
101
63
  parts.push("super");
102
64
  }
103
65
  }
104
66
 
105
67
  const collectorVisitor = {
106
68
  For(path) {
107
- for (const key of t().FOR_INIT_KEYS) {
69
+ for (const key of t.FOR_INIT_KEYS) {
108
70
  const declar = path.get(key);
109
71
 
110
72
  if (declar.isVar()) {
@@ -145,14 +107,14 @@ const collectorVisitor = {
145
107
  } = path;
146
108
  const declar = node.declaration;
147
109
 
148
- if (t().isClassDeclaration(declar) || t().isFunctionDeclaration(declar)) {
110
+ if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
149
111
  const id = declar.id;
150
112
  if (!id) return;
151
113
  const binding = scope.getBinding(id.name);
152
114
  if (binding) binding.reference(path);
153
- } else if (t().isVariableDeclaration(declar)) {
115
+ } else if (t.isVariableDeclaration(declar)) {
154
116
  for (const decl of declar.declarations) {
155
- for (const name of Object.keys(t().getBindingIdentifiers(decl))) {
117
+ for (const name of Object.keys(t.getBindingIdentifiers(decl))) {
156
118
  const binding = scope.getBinding(name);
157
119
  if (binding) binding.reference(path);
158
120
  }
@@ -249,15 +211,15 @@ class Scope {
249
211
  this.push({
250
212
  id
251
213
  });
252
- return t().cloneNode(id);
214
+ return t.cloneNode(id);
253
215
  }
254
216
 
255
217
  generateUidIdentifier(name) {
256
- return t().identifier(this.generateUid(name));
218
+ return t.identifier(this.generateUid(name));
257
219
  }
258
220
 
259
221
  generateUid(name = "temp") {
260
- name = t().toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
222
+ name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
261
223
  let uid;
262
224
  let i = 0;
263
225
 
@@ -281,11 +243,11 @@ class Scope {
281
243
  generateUidBasedOnNode(parent, defaultName) {
282
244
  let node = parent;
283
245
 
284
- if (t().isAssignmentExpression(parent)) {
246
+ if (t.isAssignmentExpression(parent)) {
285
247
  node = parent.left;
286
- } else if (t().isVariableDeclarator(parent)) {
248
+ } else if (t.isVariableDeclarator(parent)) {
287
249
  node = parent.id;
288
- } else if (t().isObjectProperty(node) || t().isObjectMethod(node)) {
250
+ } else if (t.isObjectProperty(node) || t.isObjectMethod(node)) {
289
251
  node = node.key;
290
252
  }
291
253
 
@@ -297,15 +259,15 @@ class Scope {
297
259
  }
298
260
 
299
261
  generateUidIdentifierBasedOnNode(parent, defaultName) {
300
- return t().identifier(this.generateUidBasedOnNode(parent, defaultName));
262
+ return t.identifier(this.generateUidBasedOnNode(parent, defaultName));
301
263
  }
302
264
 
303
265
  isStatic(node) {
304
- if (t().isThisExpression(node) || t().isSuper(node)) {
266
+ if (t.isThisExpression(node) || t.isSuper(node)) {
305
267
  return true;
306
268
  }
307
269
 
308
- if (t().isIdentifier(node)) {
270
+ if (t.isIdentifier(node)) {
309
271
  const binding = this.getBinding(node.name);
310
272
 
311
273
  if (binding) {
@@ -328,7 +290,7 @@ class Scope {
328
290
  this.push({
329
291
  id
330
292
  });
331
- return t().cloneNode(id);
293
+ return t.cloneNode(id);
332
294
  }
333
295
 
334
296
  return id;
@@ -362,7 +324,7 @@ class Scope {
362
324
  }
363
325
 
364
326
  dump() {
365
- const sep = (0, _repeat().default)("-", 60);
327
+ const sep = (0, _repeat.default)("-", 60);
366
328
  console.log(sep);
367
329
  let scope = this;
368
330
 
@@ -384,7 +346,7 @@ class Scope {
384
346
  }
385
347
 
386
348
  toArray(node, i) {
387
- if (t().isIdentifier(node)) {
349
+ if (t.isIdentifier(node)) {
388
350
  const binding = this.getBinding(node.name);
389
351
 
390
352
  if (binding && binding.constant && binding.path.isGenericType("Array")) {
@@ -392,14 +354,14 @@ class Scope {
392
354
  }
393
355
  }
394
356
 
395
- if (t().isArrayExpression(node)) {
357
+ if (t.isArrayExpression(node)) {
396
358
  return node;
397
359
  }
398
360
 
399
- if (t().isIdentifier(node, {
361
+ if (t.isIdentifier(node, {
400
362
  name: "arguments"
401
363
  })) {
402
- return t().callExpression(t().memberExpression(t().memberExpression(t().memberExpression(t().identifier("Array"), t().identifier("prototype")), t().identifier("slice")), t().identifier("call")), [node]);
364
+ return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Array"), t.identifier("prototype")), t.identifier("slice")), t.identifier("call")), [node]);
403
365
  }
404
366
 
405
367
  let helperName;
@@ -408,13 +370,13 @@ class Scope {
408
370
  if (i === true) {
409
371
  helperName = "toConsumableArray";
410
372
  } else if (i) {
411
- args.push(t().numericLiteral(i));
373
+ args.push(t.numericLiteral(i));
412
374
  helperName = "slicedToArray";
413
375
  } else {
414
376
  helperName = "toArray";
415
377
  }
416
378
 
417
- return t().callExpression(this.hub.addHelper(helperName), args);
379
+ return t.callExpression(this.hub.addHelper(helperName), args);
418
380
  }
419
381
 
420
382
  hasLabel(name) {
@@ -460,7 +422,7 @@ class Scope {
460
422
  }
461
423
 
462
424
  buildUndefinedNode() {
463
- return t().unaryExpression("void", t().numericLiteral(0), true);
425
+ return t.unaryExpression("void", t.numericLiteral(0), true);
464
426
  }
465
427
 
466
428
  registerConstantViolation(path) {
@@ -548,56 +510,56 @@ class Scope {
548
510
  }
549
511
 
550
512
  isPure(node, constantsOnly) {
551
- if (t().isIdentifier(node)) {
513
+ if (t.isIdentifier(node)) {
552
514
  const binding = this.getBinding(node.name);
553
515
  if (!binding) return false;
554
516
  if (constantsOnly) return binding.constant;
555
517
  return true;
556
- } else if (t().isClass(node)) {
518
+ } else if (t.isClass(node)) {
557
519
  if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {
558
520
  return false;
559
521
  }
560
522
 
561
523
  return this.isPure(node.body, constantsOnly);
562
- } else if (t().isClassBody(node)) {
524
+ } else if (t.isClassBody(node)) {
563
525
  for (const method of node.body) {
564
526
  if (!this.isPure(method, constantsOnly)) return false;
565
527
  }
566
528
 
567
529
  return true;
568
- } else if (t().isBinary(node)) {
530
+ } else if (t.isBinary(node)) {
569
531
  return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
570
- } else if (t().isArrayExpression(node)) {
532
+ } else if (t.isArrayExpression(node)) {
571
533
  for (const elem of node.elements) {
572
534
  if (!this.isPure(elem, constantsOnly)) return false;
573
535
  }
574
536
 
575
537
  return true;
576
- } else if (t().isObjectExpression(node)) {
538
+ } else if (t.isObjectExpression(node)) {
577
539
  for (const prop of node.properties) {
578
540
  if (!this.isPure(prop, constantsOnly)) return false;
579
541
  }
580
542
 
581
543
  return true;
582
- } else if (t().isClassMethod(node)) {
544
+ } else if (t.isClassMethod(node)) {
583
545
  if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
584
546
  if (node.kind === "get" || node.kind === "set") return false;
585
547
  return true;
586
- } else if (t().isProperty(node)) {
548
+ } else if (t.isProperty(node)) {
587
549
  if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
588
550
  return this.isPure(node.value, constantsOnly);
589
- } else if (t().isUnaryExpression(node)) {
551
+ } else if (t.isUnaryExpression(node)) {
590
552
  return this.isPure(node.argument, constantsOnly);
591
- } else if (t().isTaggedTemplateExpression(node)) {
592
- return t().matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
593
- } else if (t().isTemplateLiteral(node)) {
553
+ } else if (t.isTaggedTemplateExpression(node)) {
554
+ return t.matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
555
+ } else if (t.isTemplateLiteral(node)) {
594
556
  for (const expression of node.expressions) {
595
557
  if (!this.isPure(expression, constantsOnly)) return false;
596
558
  }
597
559
 
598
560
  return true;
599
561
  } else {
600
- return t().isPureish(node);
562
+ return t.isPureish(node);
601
563
  }
602
564
  }
603
565
 
@@ -636,20 +598,20 @@ class Scope {
636
598
  this.data = Object.create(null);
637
599
 
638
600
  if (path.isLoop()) {
639
- for (const key of t().FOR_INIT_KEYS) {
601
+ for (const key of t.FOR_INIT_KEYS) {
640
602
  const node = path.get(key);
641
603
  if (node.isBlockScoped()) this.registerBinding(node.node.kind, node);
642
604
  }
643
605
  }
644
606
 
645
607
  if (path.isFunctionExpression() && path.has("id")) {
646
- if (!path.get("id").node[t().NOT_LOCAL_BINDING]) {
608
+ if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
647
609
  this.registerBinding("local", path.get("id"), path);
648
610
  }
649
611
  }
650
612
 
651
613
  if (path.isClassExpression() && path.has("id")) {
652
- if (!path.get("id").node[t().NOT_LOCAL_BINDING]) {
614
+ if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
653
615
  this.registerBinding("local", path);
654
616
  }
655
617
  }
@@ -728,13 +690,13 @@ class Scope {
728
690
  let declarPath = !unique && path.getData(dataKey);
729
691
 
730
692
  if (!declarPath) {
731
- const declar = t().variableDeclaration(kind, []);
693
+ const declar = t.variableDeclaration(kind, []);
732
694
  declar._blockHoist = blockHoist;
733
695
  [declarPath] = path.unshiftContainer("body", [declar]);
734
696
  if (!unique) path.setData(dataKey, declarPath);
735
697
  }
736
698
 
737
- const declarator = t().variableDeclarator(opts.id, opts.init);
699
+ const declarator = t.variableDeclarator(opts.id, opts.init);
738
700
  declarPath.node.declarations.push(declarator);
739
701
  this.registerBinding(kind, declarPath.get("declarations").pop());
740
702
  }
@@ -780,7 +742,7 @@ class Scope {
780
742
  let scope = this;
781
743
 
782
744
  do {
783
- (0, _defaults().default)(ids, scope.bindings);
745
+ (0, _defaults.default)(ids, scope.bindings);
784
746
  scope = scope.parent;
785
747
  } while (scope);
786
748
 
@@ -842,8 +804,8 @@ class Scope {
842
804
  if (this.hasOwnBinding(name)) return true;
843
805
  if (this.parentHasBinding(name, noGlobals)) return true;
844
806
  if (this.hasUid(name)) return true;
845
- if (!noGlobals && (0, _includes().default)(Scope.globals, name)) return true;
846
- if (!noGlobals && (0, _includes().default)(Scope.contextVariables, name)) return true;
807
+ if (!noGlobals && (0, _includes.default)(Scope.globals, name)) return true;
808
+ if (!noGlobals && (0, _includes.default)(Scope.contextVariables, name)) return true;
847
809
  return false;
848
810
  }
849
811
 
@@ -884,5 +846,5 @@ class Scope {
884
846
  }
885
847
 
886
848
  exports.default = Scope;
887
- Scope.globals = Object.keys(_globals().default.builtin);
849
+ Scope.globals = Object.keys(_globals.default.builtin);
888
850
  Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
@@ -7,27 +7,13 @@ exports.default = void 0;
7
7
 
8
8
  var _binding = _interopRequireDefault(require("../binding"));
9
9
 
10
- function _helperSplitExportDeclaration() {
11
- const data = _interopRequireDefault(require("@babel/helper-split-export-declaration"));
10
+ var _helperSplitExportDeclaration = _interopRequireDefault(require("@babel/helper-split-export-declaration"));
12
11
 
13
- _helperSplitExportDeclaration = function () {
14
- return data;
15
- };
12
+ var t = _interopRequireWildcard(require("@babel/types"));
16
13
 
17
- return data;
18
- }
19
-
20
- function t() {
21
- const data = _interopRequireWildcard(require("@babel/types"));
22
-
23
- t = function () {
24
- return data;
25
- };
26
-
27
- return data;
28
- }
14
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
29
15
 
30
- 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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
16
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { 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; }
31
17
 
32
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
19
 
@@ -74,27 +60,27 @@ class Renamer {
74
60
  return;
75
61
  }
76
62
 
77
- (0, _helperSplitExportDeclaration().default)(maybeExportDeclar);
63
+ (0, _helperSplitExportDeclaration.default)(maybeExportDeclar);
78
64
  }
79
65
 
80
66
  maybeConvertFromClassFunctionDeclaration(path) {
81
67
  return;
82
68
  if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;
83
69
  if (this.binding.kind !== "hoisted") return;
84
- path.node.id = t().identifier(this.oldName);
70
+ path.node.id = t.identifier(this.oldName);
85
71
  path.node._blockHoist = 3;
86
- path.replaceWith(t().variableDeclaration("let", [t().variableDeclarator(t().identifier(this.newName), t().toExpression(path.node))]));
72
+ path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node))]));
87
73
  }
88
74
 
89
75
  maybeConvertFromClassFunctionExpression(path) {
90
76
  return;
91
77
  if (!path.isFunctionExpression() && !path.isClassExpression()) return;
92
78
  if (this.binding.kind !== "local") return;
93
- path.node.id = t().identifier(this.oldName);
79
+ path.node.id = t.identifier(this.oldName);
94
80
  this.binding.scope.parent.push({
95
- id: t().identifier(this.newName)
81
+ id: t.identifier(this.newName)
96
82
  });
97
- path.replaceWith(t().assignmentExpression("=", t().identifier(this.newName), path.node));
83
+ path.replaceWith(t.assignmentExpression("=", t.identifier(this.newName), path.node));
98
84
  }
99
85
 
100
86
  rename(block) {
package/lib/visitors.js CHANGED
@@ -9,29 +9,15 @@ exports.merge = merge;
9
9
 
10
10
  var virtualTypes = _interopRequireWildcard(require("./path/lib/virtual-types"));
11
11
 
12
- function t() {
13
- const data = _interopRequireWildcard(require("@babel/types"));
12
+ var t = _interopRequireWildcard(require("@babel/types"));
14
13
 
15
- t = function () {
16
- return data;
17
- };
18
-
19
- return data;
20
- }
21
-
22
- function _clone() {
23
- const data = _interopRequireDefault(require("lodash/clone"));
24
-
25
- _clone = function () {
26
- return data;
27
- };
28
-
29
- return data;
30
- }
14
+ var _clone = _interopRequireDefault(require("lodash/clone"));
31
15
 
32
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
17
 
34
- 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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
18
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
19
+
20
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { 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; }
35
21
 
36
22
  function explode(visitor) {
37
23
  if (visitor._exploded) return visitor;
@@ -82,8 +68,8 @@ function explode(visitor) {
82
68
  for (const nodeType of Object.keys(visitor)) {
83
69
  if (shouldIgnoreKey(nodeType)) continue;
84
70
  const fns = visitor[nodeType];
85
- let aliases = t().FLIPPED_ALIAS_KEYS[nodeType];
86
- const deprecratedKey = t().DEPRECATED_KEYS[nodeType];
71
+ let aliases = t.FLIPPED_ALIAS_KEYS[nodeType];
72
+ const deprecratedKey = t.DEPRECATED_KEYS[nodeType];
87
73
 
88
74
  if (deprecratedKey) {
89
75
  console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${deprecratedKey}`);
@@ -99,7 +85,7 @@ function explode(visitor) {
99
85
  if (existing) {
100
86
  mergePair(existing, fns);
101
87
  } else {
102
- visitor[alias] = (0, _clone().default)(fns);
88
+ visitor[alias] = (0, _clone.default)(fns);
103
89
  }
104
90
  }
105
91
  }
@@ -126,7 +112,7 @@ function verify(visitor) {
126
112
 
127
113
  if (shouldIgnoreKey(nodeType)) continue;
128
114
 
129
- if (t().TYPES.indexOf(nodeType) < 0) {
115
+ if (t.TYPES.indexOf(nodeType) < 0) {
130
116
  throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type`);
131
117
  }
132
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/traverse",
3
- "version": "7.6.0",
3
+ "version": "7.7.2",
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://babeljs.io/",
@@ -12,11 +12,11 @@
12
12
  "main": "lib/index.js",
13
13
  "dependencies": {
14
14
  "@babel/code-frame": "^7.5.5",
15
- "@babel/generator": "^7.6.0",
16
- "@babel/helper-function-name": "^7.1.0",
17
- "@babel/helper-split-export-declaration": "^7.4.4",
18
- "@babel/parser": "^7.6.0",
19
- "@babel/types": "^7.6.0",
15
+ "@babel/generator": "^7.7.2",
16
+ "@babel/helper-function-name": "^7.7.0",
17
+ "@babel/helper-split-export-declaration": "^7.7.0",
18
+ "@babel/parser": "^7.7.2",
19
+ "@babel/types": "^7.7.2",
20
20
  "debug": "^4.1.0",
21
21
  "globals": "^11.1.0",
22
22
  "lodash": "^4.17.13"
@@ -24,5 +24,5 @@
24
24
  "devDependencies": {
25
25
  "@babel/helper-plugin-test-runner": "^7.0.0"
26
26
  },
27
- "gitHead": "cbd5a26e57758e3f748174ff84aa570e8780e85d"
27
+ "gitHead": "35f4d1276310bac6fede4a6f86a5c76f951e179e"
28
28
  }