@babel/traverse 8.0.0-alpha.8 → 8.0.0-alpha.9

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.
package/lib/index.js CHANGED
@@ -169,10 +169,10 @@ function isFlow() {
169
169
  }
170
170
  }
171
171
  function isRestProperty() {
172
- return nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectPattern();
172
+ return nodeIsRestElement(this.node) && this.parentPath?.isObjectPattern();
173
173
  }
174
174
  function isSpreadProperty() {
175
- return nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectExpression();
175
+ return nodeIsRestElement(this.node) && this.parentPath?.isObjectExpression();
176
176
  }
177
177
  function isForAwaitStatement() {
178
178
  return isForOfStatement(this.node, {
@@ -213,7 +213,7 @@ function isVirtualType(type) {
213
213
  function isExplodedVisitor(visitor) {
214
214
  return visitor?._exploded;
215
215
  }
216
- function explode(visitor) {
216
+ function explode$1(visitor) {
217
217
  if (isExplodedVisitor(visitor)) return visitor;
218
218
  visitor._exploded = true;
219
219
  for (const nodeType of Object.keys(visitor)) {
@@ -226,7 +226,7 @@ function explode(visitor) {
226
226
  visitor[part] = fns;
227
227
  }
228
228
  }
229
- verify(visitor);
229
+ verify$1(visitor);
230
230
  delete visitor.__esModule;
231
231
  ensureEntranceObjects(visitor);
232
232
  ensureCallbackArrays(visitor);
@@ -281,7 +281,7 @@ function explode(visitor) {
281
281
  }
282
282
  return visitor;
283
283
  }
284
- function verify(visitor) {
284
+ function verify$1(visitor) {
285
285
  if (visitor._verified) return;
286
286
  if (typeof visitor === "function") {
287
287
  throw new Error("You passed `traverse()` a function when it expected a visitor object, " + "are you sure you didn't mean `{ enter: Function }`?");
@@ -318,7 +318,7 @@ function validateVisitorMethods(path, val) {
318
318
  function merge(visitors, states = [], wrapper) {
319
319
  const mergedVisitor = {};
320
320
  for (let i = 0; i < visitors.length; i++) {
321
- const visitor = explode(visitors[i]);
321
+ const visitor = explode$1(visitors[i]);
322
322
  const state = states[i];
323
323
  let topVisitor = visitor;
324
324
  if (state || wrapper) {
@@ -409,10 +409,10 @@ function mergePair(dest, src) {
409
409
 
410
410
  var visitors = /*#__PURE__*/Object.freeze({
411
411
  __proto__: null,
412
- explode: explode,
412
+ explode: explode$1,
413
413
  isExplodedVisitor: isExplodedVisitor,
414
414
  merge: merge,
415
- verify: verify
415
+ verify: verify$1
416
416
  });
417
417
 
418
418
  let pathsCache = new WeakMap();
@@ -475,7 +475,6 @@ const renameVisitor = {
475
475
  } = node.key;
476
476
  if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) {
477
477
  node.shorthand = false;
478
- if (node.extra?.shorthand) node.extra.shorthand = false;
479
478
  }
480
479
  },
481
480
  "AssignmentExpression|Declaration|VariableDeclarator"(path, state) {
@@ -534,7 +533,7 @@ class Renamer {
534
533
  }
535
534
  }
536
535
  const blockToTraverse = scope.block;
537
- traverseNode(blockToTraverse, explode(renameVisitor), scope, this, scope.path, {
536
+ traverseNode(blockToTraverse, explode$1(renameVisitor), scope, this, scope.path, {
538
537
  discriminant: true
539
538
  });
540
539
  {
@@ -887,6 +886,9 @@ const collectorVisitor = {
887
886
  if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
888
887
  path.scope.registerBinding("local", path);
889
888
  }
889
+ },
890
+ TSTypeAnnotation(path) {
891
+ path.skip();
890
892
  }
891
893
  };
892
894
  let uid = 0;
@@ -926,7 +928,7 @@ class Scope {
926
928
  const shouldSkip = path.key === "key" || path.listKey === "decorators";
927
929
  path = path.parentPath;
928
930
  if (shouldSkip && path.isMethod()) path = path.parentPath;
929
- if (path && path.isScope()) parent = path;
931
+ if (path?.isScope()) parent = path;
930
932
  } while (path && !parent);
931
933
  return parent?.scope;
932
934
  }
@@ -1621,20 +1623,6 @@ function inType(...candidateTypes) {
1621
1623
  return false;
1622
1624
  }
1623
1625
 
1624
- var NodePath_ancestry = /*#__PURE__*/Object.freeze({
1625
- __proto__: null,
1626
- find: find,
1627
- findParent: findParent,
1628
- getAncestry: getAncestry,
1629
- getDeepestCommonAncestorFrom: getDeepestCommonAncestorFrom,
1630
- getEarliestCommonAncestorFrom: getEarliestCommonAncestorFrom,
1631
- getFunctionParent: getFunctionParent,
1632
- getStatementParent: getStatementParent,
1633
- inType: inType,
1634
- isAncestor: isAncestor,
1635
- isDescendant: isDescendant
1636
- });
1637
-
1638
1626
  const {
1639
1627
  createFlowUnionType,
1640
1628
  createTSUnionType,
@@ -2130,16 +2118,6 @@ function isGenericType(genericName) {
2130
2118
  });
2131
2119
  }
2132
2120
 
2133
- var NodePath_inference = /*#__PURE__*/Object.freeze({
2134
- __proto__: null,
2135
- _getTypeAnnotation: _getTypeAnnotation,
2136
- baseTypeStrictlyMatches: baseTypeStrictlyMatches,
2137
- couldBeBaseType: couldBeBaseType,
2138
- getTypeAnnotation: getTypeAnnotation,
2139
- isBaseType: isBaseType,
2140
- isGenericType: isGenericType
2141
- });
2142
-
2143
2121
  const {
2144
2122
  FUNCTION_TYPES,
2145
2123
  arrowFunctionExpression: arrowFunctionExpression$2,
@@ -2213,7 +2191,7 @@ function replaceWith(replacementPath) {
2213
2191
  if (this.removed) {
2214
2192
  throw new Error("You can't replace this node, we've already removed it");
2215
2193
  }
2216
- let replacement = replacementPath instanceof NodePath ? replacementPath.node : replacementPath;
2194
+ let replacement = replacementPath instanceof NodePath_Final ? replacementPath.node : replacementPath;
2217
2195
  if (!replacement) {
2218
2196
  throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");
2219
2197
  }
@@ -2383,16 +2361,6 @@ function replaceInline(nodes) {
2383
2361
  }
2384
2362
  }
2385
2363
 
2386
- var NodePath_replacement = /*#__PURE__*/Object.freeze({
2387
- __proto__: null,
2388
- _replaceWith: _replaceWith,
2389
- replaceExpressionWithStatements: replaceExpressionWithStatements,
2390
- replaceInline: replaceInline,
2391
- replaceWith: replaceWith,
2392
- replaceWithMultiple: replaceWithMultiple,
2393
- replaceWithSourceString: replaceWithSourceString
2394
- });
2395
-
2396
2364
  const VALID_OBJECT_CALLEES = ["Number", "String", "Math"];
2397
2365
  const VALID_IDENTIFIER_CALLEES = ["isFinite", "isNaN", "parseFloat", "parseInt", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "btoa", "atob"];
2398
2366
  const INVALID_METHODS = ["random"];
@@ -2732,12 +2700,6 @@ function evaluate() {
2732
2700
  };
2733
2701
  }
2734
2702
 
2735
- var NodePath_evaluation = /*#__PURE__*/Object.freeze({
2736
- __proto__: null,
2737
- evaluate: evaluate,
2738
- evaluateTruthy: evaluateTruthy
2739
- });
2740
-
2741
2703
  const {
2742
2704
  arrowFunctionExpression: arrowFunctionExpression$1,
2743
2705
  assignmentExpression: assignmentExpression$1,
@@ -3185,14 +3147,6 @@ function getScopeInformation(fnPath) {
3185
3147
  };
3186
3148
  }
3187
3149
 
3188
- var NodePath_conversion = /*#__PURE__*/Object.freeze({
3189
- __proto__: null,
3190
- arrowFunctionToExpression: arrowFunctionToExpression,
3191
- ensureBlock: ensureBlock,
3192
- toComputedKey: toComputedKey,
3193
- unwrapFunctionEnvironment: unwrapFunctionEnvironment
3194
- });
3195
-
3196
3150
  const {
3197
3151
  STATEMENT_OR_BLOCK_KEYS,
3198
3152
  VISITOR_KEYS: VISITOR_KEYS$3,
@@ -3208,7 +3162,7 @@ function matchesPattern(pattern, allowPartial) {
3208
3162
  return _matchesPattern(this.node, pattern, allowPartial);
3209
3163
  }
3210
3164
  function has(key) {
3211
- const val = this.node && this.node[key];
3165
+ const val = this.node?.[key];
3212
3166
  if (val && Array.isArray(val)) {
3213
3167
  return !!val.length;
3214
3168
  } else {
@@ -3563,29 +3517,6 @@ function isInStrictMode() {
3563
3517
  return !!strictParent;
3564
3518
  }
3565
3519
 
3566
- var NodePath_introspection = /*#__PURE__*/Object.freeze({
3567
- __proto__: null,
3568
- _guessExecutionStatusRelativeTo: _guessExecutionStatusRelativeTo,
3569
- _resolve: _resolve,
3570
- canHaveVariableDeclarationOrExpression: canHaveVariableDeclarationOrExpression,
3571
- canSwapBetweenExpressionAndStatement: canSwapBetweenExpressionAndStatement,
3572
- equals: equals,
3573
- getSource: getSource,
3574
- has: has,
3575
- is: is,
3576
- isCompletionRecord: isCompletionRecord,
3577
- isConstantExpression: isConstantExpression,
3578
- isInStrictMode: isInStrictMode,
3579
- isNodeType: isNodeType,
3580
- isStatementOrBlock: isStatementOrBlock,
3581
- isStatic: isStatic,
3582
- isnt: isnt,
3583
- matchesPattern: matchesPattern,
3584
- referencesImport: referencesImport,
3585
- resolve: resolve,
3586
- willIMaybeExecuteBefore: willIMaybeExecuteBefore
3587
- });
3588
-
3589
3520
  function call(key) {
3590
3521
  const opts = this.opts;
3591
3522
  this.debug(key);
@@ -3776,31 +3707,6 @@ function _getQueueContexts() {
3776
3707
  return contexts;
3777
3708
  }
3778
3709
 
3779
- var NodePath_context = /*#__PURE__*/Object.freeze({
3780
- __proto__: null,
3781
- _call: _call,
3782
- _getQueueContexts: _getQueueContexts,
3783
- _resyncKey: _resyncKey,
3784
- _resyncList: _resyncList,
3785
- _resyncParent: _resyncParent,
3786
- _resyncRemoved: _resyncRemoved,
3787
- call: call,
3788
- isBlacklisted: isDenylisted,
3789
- isDenylisted: isDenylisted,
3790
- popContext: popContext,
3791
- pushContext: pushContext,
3792
- requeue: requeue,
3793
- resync: resync,
3794
- setContext: setContext,
3795
- setKey: setKey,
3796
- setScope: setScope,
3797
- setup: setup,
3798
- skip: skip,
3799
- skipKey: skipKey,
3800
- stop: stop,
3801
- visit: visit
3802
- });
3803
-
3804
3710
  const hooks = [function (self, parent) {
3805
3711
  const removeParent = self.key === "test" && (parent.isWhile() || parent.isSwitchCase()) || self.key === "declaration" && parent.isExportDeclaration() || self.key === "body" && parent.isLabeledStatement() || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1 || self.key === "expression" && parent.isExpressionStatement();
3806
3712
  if (removeParent) {
@@ -3880,16 +3786,6 @@ function _assertUnremoved() {
3880
3786
  }
3881
3787
  }
3882
3788
 
3883
- var NodePath_removal = /*#__PURE__*/Object.freeze({
3884
- __proto__: null,
3885
- _assertUnremoved: _assertUnremoved,
3886
- _callRemovalHooks: _callRemovalHooks,
3887
- _markRemoved: _markRemoved,
3888
- _remove: _remove,
3889
- _removeFromScope: _removeFromScope,
3890
- remove: remove
3891
- });
3892
-
3893
3789
  const {
3894
3790
  react
3895
3791
  } = _t;
@@ -4145,18 +4041,19 @@ function insertAfter(nodes_) {
4145
4041
  return isExpression(node) ? expressionStatement(node) : node;
4146
4042
  }));
4147
4043
  } else if (this.isNodeType("Expression") && !this.isJSXElement() && !parentPath.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
4148
- if (this.node) {
4149
- const node = this.node;
4044
+ const self = this;
4045
+ if (self.node) {
4046
+ const node = self.node;
4150
4047
  let {
4151
4048
  scope
4152
4049
  } = this;
4153
4050
  if (scope.path.isPattern()) {
4154
4051
  assertExpression(node);
4155
- this.replaceWith(callExpression(arrowFunctionExpression([], node), []));
4156
- this.get("callee.body").insertAfter(nodes);
4157
- return [this];
4052
+ self.replaceWith(callExpression(arrowFunctionExpression([], node), []));
4053
+ self.get("callee.body").insertAfter(nodes);
4054
+ return [self];
4158
4055
  }
4159
- if (isHiddenInSequenceExpression(this)) {
4056
+ if (isHiddenInSequenceExpression(self)) {
4160
4057
  nodes.unshift(node);
4161
4058
  } else if (isCallExpression(node) && isSuper(node.callee)) {
4162
4059
  nodes.unshift(node);
@@ -4215,7 +4112,7 @@ function _verifyNodeList(nodes) {
4215
4112
  msg = "contains a non-object node";
4216
4113
  } else if (!node.type) {
4217
4114
  msg = "without a type";
4218
- } else if (node instanceof NodePath) {
4115
+ } else if (node instanceof NodePath_Final) {
4219
4116
  msg = "has a NodePath when it expected a raw object";
4220
4117
  }
4221
4118
  if (msg) {
@@ -4228,7 +4125,7 @@ function _verifyNodeList(nodes) {
4228
4125
  function unshiftContainer(listKey, nodes) {
4229
4126
  this._assertUnremoved();
4230
4127
  nodes = this._verifyNodeList(nodes);
4231
- const path = NodePath.get({
4128
+ const path = NodePath_Final.get({
4232
4129
  parentPath: this,
4233
4130
  parent: this.node,
4234
4131
  container: this.node[listKey],
@@ -4241,7 +4138,7 @@ function pushContainer(listKey, nodes) {
4241
4138
  this._assertUnremoved();
4242
4139
  const verifiedNodes = this._verifyNodeList(nodes);
4243
4140
  const container = this.node[listKey];
4244
- const path = NodePath.get({
4141
+ const path = NodePath_Final.get({
4245
4142
  parentPath: this,
4246
4143
  parent: this.node,
4247
4144
  container: container,
@@ -4255,24 +4152,9 @@ function hoist(scope = this.scope) {
4255
4152
  return hoister.run();
4256
4153
  }
4257
4154
 
4258
- var NodePath_modification = /*#__PURE__*/Object.freeze({
4259
- __proto__: null,
4260
- _containerInsert: _containerInsert,
4261
- _containerInsertAfter: _containerInsertAfter,
4262
- _containerInsertBefore: _containerInsertBefore,
4263
- _verifyNodeList: _verifyNodeList,
4264
- hoist: hoist,
4265
- insertAfter: insertAfter,
4266
- insertBefore: insertBefore,
4267
- pushContainer: pushContainer,
4268
- unshiftContainer: unshiftContainer,
4269
- updateSiblingKeys: updateSiblingKeys
4270
- });
4271
-
4272
4155
  const {
4273
4156
  getBindingIdentifiers: _getBindingIdentifiers,
4274
4157
  getOuterBindingIdentifiers: _getOuterBindingIdentifiers,
4275
- isDeclaration,
4276
4158
  numericLiteral,
4277
4159
  unaryExpression
4278
4160
  } = _t;
@@ -4445,7 +4327,7 @@ function getCompletionRecords() {
4445
4327
  return records.map(r => r.path);
4446
4328
  }
4447
4329
  function getSibling(key) {
4448
- return NodePath.get({
4330
+ return NodePath_Final.get({
4449
4331
  parentPath: this.parentPath,
4450
4332
  parent: this.parent,
4451
4333
  container: this.container,
@@ -4493,7 +4375,7 @@ function _getKey(key, context) {
4493
4375
  const container = node[key];
4494
4376
  if (Array.isArray(container)) {
4495
4377
  return container.map((_, i) => {
4496
- return NodePath.get({
4378
+ return NodePath_Final.get({
4497
4379
  listKey: key,
4498
4380
  parentPath: this,
4499
4381
  parent: node,
@@ -4502,7 +4384,7 @@ function _getKey(key, context) {
4502
4384
  }).setContext(context);
4503
4385
  });
4504
4386
  } else {
4505
- return NodePath.get({
4387
+ return NodePath_Final.get({
4506
4388
  parentPath: this,
4507
4389
  parent: node,
4508
4390
  container: node,
@@ -4551,7 +4433,7 @@ function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
4551
4433
  }
4552
4434
  if (id.isExportDeclaration()) {
4553
4435
  const declaration = id.get("declaration");
4554
- if (isDeclaration(declaration)) {
4436
+ if (declaration.isDeclaration()) {
4555
4437
  search.push(declaration);
4556
4438
  }
4557
4439
  continue;
@@ -4583,24 +4465,6 @@ function getOuterBindingIdentifierPaths(duplicates = false) {
4583
4465
  return this.getBindingIdentifierPaths(duplicates, true);
4584
4466
  }
4585
4467
 
4586
- var NodePath_family = /*#__PURE__*/Object.freeze({
4587
- __proto__: null,
4588
- _getKey: _getKey,
4589
- _getPattern: _getPattern,
4590
- get: get,
4591
- getAllNextSiblings: getAllNextSiblings,
4592
- getAllPrevSiblings: getAllPrevSiblings,
4593
- getBindingIdentifierPaths: getBindingIdentifierPaths,
4594
- getBindingIdentifiers: getBindingIdentifiers,
4595
- getCompletionRecords: getCompletionRecords,
4596
- getNextSibling: getNextSibling,
4597
- getOpposite: getOpposite,
4598
- getOuterBindingIdentifierPaths: getOuterBindingIdentifierPaths,
4599
- getOuterBindingIdentifiers: getOuterBindingIdentifiers,
4600
- getPrevSibling: getPrevSibling,
4601
- getSibling: getSibling
4602
- });
4603
-
4604
4468
  const {
4605
4469
  addComment: _addComment,
4606
4470
  addComments: _addComments
@@ -4643,13 +4507,6 @@ function addComments(type, comments) {
4643
4507
  _addComments(this.node, type, comments);
4644
4508
  }
4645
4509
 
4646
- var NodePath_comments = /*#__PURE__*/Object.freeze({
4647
- __proto__: null,
4648
- addComment: addComment,
4649
- addComments: addComments,
4650
- shareCommentsWithSiblings: shareCommentsWithSiblings
4651
- });
4652
-
4653
4510
  const {
4654
4511
  validate
4655
4512
  } = _t;
@@ -4657,7 +4514,7 @@ const debug = buildDebug("babel");
4657
4514
  const REMOVED = 1 << 0;
4658
4515
  const SHOULD_STOP = 1 << 1;
4659
4516
  const SHOULD_SKIP = 1 << 2;
4660
- class NodePath {
4517
+ const NodePath_Final = class NodePath {
4661
4518
  constructor(hub, parent) {
4662
4519
  this.parent = parent;
4663
4520
  this.hub = hub;
@@ -4669,6 +4526,24 @@ class NodePath {
4669
4526
  state = null;
4670
4527
  opts = null;
4671
4528
  _traverseFlags = 0;
4529
+ get removed() {
4530
+ return (this._traverseFlags & 1) > 0;
4531
+ }
4532
+ set removed(v) {
4533
+ if (v) this._traverseFlags |= 1;else this._traverseFlags &= -2;
4534
+ }
4535
+ get shouldStop() {
4536
+ return (this._traverseFlags & 2) > 0;
4537
+ }
4538
+ set shouldStop(v) {
4539
+ if (v) this._traverseFlags |= 2;else this._traverseFlags &= -3;
4540
+ }
4541
+ get shouldSkip() {
4542
+ return (this._traverseFlags & 4) > 0;
4543
+ }
4544
+ set shouldSkip(v) {
4545
+ if (v) this._traverseFlags |= 4;else this._traverseFlags &= -5;
4546
+ }
4672
4547
  skipKeys = null;
4673
4548
  parentPath = null;
4674
4549
  container = null;
@@ -4758,51 +4633,124 @@ class NodePath {
4758
4633
  get parentKey() {
4759
4634
  return this.listKey || this.key;
4760
4635
  }
4761
- get shouldSkip() {
4762
- return !!(this._traverseFlags & SHOULD_SKIP);
4763
- }
4764
- set shouldSkip(v) {
4765
- if (v) {
4766
- this._traverseFlags |= SHOULD_SKIP;
4767
- } else {
4768
- this._traverseFlags &= ~SHOULD_SKIP;
4769
- }
4770
- }
4771
- get shouldStop() {
4772
- return !!(this._traverseFlags & SHOULD_STOP);
4773
- }
4774
- set shouldStop(v) {
4775
- if (v) {
4776
- this._traverseFlags |= SHOULD_STOP;
4777
- } else {
4778
- this._traverseFlags &= ~SHOULD_STOP;
4779
- }
4780
- }
4781
- get removed() {
4782
- return !!(this._traverseFlags & REMOVED);
4783
- }
4784
- set removed(v) {
4785
- if (v) {
4786
- this._traverseFlags |= REMOVED;
4787
- } else {
4788
- this._traverseFlags &= ~REMOVED;
4789
- }
4790
- }
4791
- }
4792
- 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);
4636
+ };
4637
+ const methods = {
4638
+ findParent: findParent,
4639
+ find: find,
4640
+ getFunctionParent: getFunctionParent,
4641
+ getStatementParent: getStatementParent,
4642
+ getEarliestCommonAncestorFrom: getEarliestCommonAncestorFrom,
4643
+ getDeepestCommonAncestorFrom: getDeepestCommonAncestorFrom,
4644
+ getAncestry: getAncestry,
4645
+ isAncestor: isAncestor,
4646
+ isDescendant: isDescendant,
4647
+ inType: inType,
4648
+ getTypeAnnotation: getTypeAnnotation,
4649
+ _getTypeAnnotation: _getTypeAnnotation,
4650
+ isBaseType: isBaseType,
4651
+ couldBeBaseType: couldBeBaseType,
4652
+ baseTypeStrictlyMatches: baseTypeStrictlyMatches,
4653
+ isGenericType: isGenericType,
4654
+ replaceWithMultiple: replaceWithMultiple,
4655
+ replaceWithSourceString: replaceWithSourceString,
4656
+ replaceWith: replaceWith,
4657
+ _replaceWith: _replaceWith,
4658
+ replaceExpressionWithStatements: replaceExpressionWithStatements,
4659
+ replaceInline: replaceInline,
4660
+ evaluateTruthy: evaluateTruthy,
4661
+ evaluate: evaluate,
4662
+ toComputedKey: toComputedKey,
4663
+ ensureBlock: ensureBlock,
4664
+ unwrapFunctionEnvironment: unwrapFunctionEnvironment,
4665
+ arrowFunctionToExpression: arrowFunctionToExpression,
4666
+ matchesPattern: matchesPattern,
4667
+ has: has,
4668
+ isStatic: isStatic,
4669
+ is: is,
4670
+ isnt: isnt,
4671
+ equals: equals,
4672
+ isNodeType: isNodeType,
4673
+ canHaveVariableDeclarationOrExpression: canHaveVariableDeclarationOrExpression,
4674
+ canSwapBetweenExpressionAndStatement: canSwapBetweenExpressionAndStatement,
4675
+ isCompletionRecord: isCompletionRecord,
4676
+ isStatementOrBlock: isStatementOrBlock,
4677
+ referencesImport: referencesImport,
4678
+ getSource: getSource,
4679
+ willIMaybeExecuteBefore: willIMaybeExecuteBefore,
4680
+ _guessExecutionStatusRelativeTo: _guessExecutionStatusRelativeTo,
4681
+ resolve: resolve,
4682
+ _resolve: _resolve,
4683
+ isConstantExpression: isConstantExpression,
4684
+ isInStrictMode: isInStrictMode,
4685
+ call: call,
4686
+ _call: _call,
4687
+ isDenylisted: isDenylisted,
4688
+ isBlacklisted: isDenylisted,
4689
+ visit: visit,
4690
+ skip: skip,
4691
+ skipKey: skipKey,
4692
+ stop: stop,
4693
+ setScope: setScope,
4694
+ setContext: setContext,
4695
+ resync: resync,
4696
+ _resyncParent: _resyncParent,
4697
+ _resyncKey: _resyncKey,
4698
+ _resyncList: _resyncList,
4699
+ _resyncRemoved: _resyncRemoved,
4700
+ popContext: popContext,
4701
+ pushContext: pushContext,
4702
+ setup: setup,
4703
+ setKey: setKey,
4704
+ requeue: requeue,
4705
+ _getQueueContexts: _getQueueContexts,
4706
+ remove: remove,
4707
+ _removeFromScope: _removeFromScope,
4708
+ _callRemovalHooks: _callRemovalHooks,
4709
+ _remove: _remove,
4710
+ _markRemoved: _markRemoved,
4711
+ _assertUnremoved: _assertUnremoved,
4712
+ insertBefore: insertBefore,
4713
+ _containerInsert: _containerInsert,
4714
+ _containerInsertBefore: _containerInsertBefore,
4715
+ _containerInsertAfter: _containerInsertAfter,
4716
+ insertAfter: insertAfter,
4717
+ updateSiblingKeys: updateSiblingKeys,
4718
+ _verifyNodeList: _verifyNodeList,
4719
+ unshiftContainer: unshiftContainer,
4720
+ pushContainer: pushContainer,
4721
+ hoist: hoist,
4722
+ getOpposite: getOpposite,
4723
+ getCompletionRecords: getCompletionRecords,
4724
+ getSibling: getSibling,
4725
+ getPrevSibling: getPrevSibling,
4726
+ getNextSibling: getNextSibling,
4727
+ getAllNextSiblings: getAllNextSiblings,
4728
+ getAllPrevSiblings: getAllPrevSiblings,
4729
+ get: get,
4730
+ _getKey: _getKey,
4731
+ _getPattern: _getPattern,
4732
+ getBindingIdentifiers: getBindingIdentifiers,
4733
+ getOuterBindingIdentifiers: getOuterBindingIdentifiers,
4734
+ getBindingIdentifierPaths: getBindingIdentifierPaths,
4735
+ getOuterBindingIdentifierPaths: getOuterBindingIdentifierPaths,
4736
+ shareCommentsWithSiblings: shareCommentsWithSiblings,
4737
+ addComment: addComment,
4738
+ addComments: addComments
4739
+ };
4740
+ Object.assign(NodePath_Final.prototype, methods);
4793
4741
  for (const type of _t.TYPES) {
4794
4742
  const typeKey = `is${type}`;
4795
4743
  const fn = _t[typeKey];
4796
- NodePath.prototype[typeKey] = function (opts) {
4744
+ NodePath_Final.prototype[typeKey] = function (opts) {
4797
4745
  return fn(this.node, opts);
4798
4746
  };
4799
- NodePath.prototype[`assert${type}`] = function (opts) {
4747
+ NodePath_Final.prototype[`assert${type}`] = function (opts) {
4800
4748
  if (!fn(this.node, opts)) {
4801
4749
  throw new TypeError(`Expected node path of type ${type}`);
4802
4750
  }
4803
4751
  };
4804
4752
  }
4805
- Object.assign(NodePath.prototype, NodePath_virtual_types_validator);
4753
+ Object.assign(NodePath_Final.prototype, NodePath_virtual_types_validator);
4806
4754
  for (const type of Object.keys(virtualTypes)) {
4807
4755
  if (type[0] === "_") continue;
4808
4756
  if (!_t.TYPES.includes(type)) _t.TYPES.push(type);
@@ -4834,7 +4782,7 @@ class TraversalContext {
4834
4782
  return false;
4835
4783
  }
4836
4784
  create(node, container, key, listKey) {
4837
- return NodePath.get({
4785
+ return NodePath_Final.get({
4838
4786
  parentPath: this.parentPath,
4839
4787
  parent: node,
4840
4788
  container,
@@ -4965,12 +4913,12 @@ function traverse(parent, opts = {}, scope, state, parentPath, visitSelf) {
4965
4913
  if (!VISITOR_KEYS[parent.type]) {
4966
4914
  return;
4967
4915
  }
4968
- explode(opts);
4916
+ explode$1(opts);
4969
4917
  traverseNode(parent, opts, scope, state, parentPath, null, visitSelf);
4970
4918
  }
4971
4919
  traverse.visitors = visitors;
4972
- traverse.verify = verify;
4973
- traverse.explode = explode;
4920
+ traverse.verify = verify$1;
4921
+ traverse.explode = explode$1;
4974
4922
  traverse.cheap = function (node, enter) {
4975
4923
  traverseFast(node, enter);
4976
4924
  return;
@@ -5007,5 +4955,5 @@ traverse.hasType = function (tree, type, denylistTypes) {
5007
4955
  };
5008
4956
  traverse.cache = cache;
5009
4957
 
5010
- export { Hub, NodePath, Scope, traverse as default, visitors };
4958
+ export { Hub, NodePath_Final as NodePath, Scope, traverse as default, visitors };
5011
4959
  //# sourceMappingURL=index.js.map