@babel/traverse 7.6.2 → 7.7.4

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