@babel/traverse 7.18.11 → 7.18.13

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.

@@ -267,6 +267,11 @@ function _evaluate(path, state) {
267
267
  state.confident = leftConfident && (!left || rightConfident);
268
268
  if (!state.confident) return;
269
269
  return left && right;
270
+
271
+ case "??":
272
+ state.confident = leftConfident && (left != null || rightConfident);
273
+ if (!state.confident) return;
274
+ return left != null ? left : right;
270
275
  }
271
276
  }
272
277
 
@@ -30,7 +30,7 @@ const hooks = [function (self, parent) {
30
30
  return true;
31
31
  }
32
32
  }, function (self, parent) {
33
- if (parent.isIfStatement() && (self.key === "consequent" || self.key === "alternate") || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) {
33
+ if (parent.isIfStatement() && self.key === "consequent" || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) {
34
34
  self.replaceWith({
35
35
  type: "BlockStatement",
36
36
  body: []
package/lib/visitors.js CHANGED
@@ -159,7 +159,7 @@ function merge(visitors, states = [], wrapper) {
159
159
  visitorType = wrapWithStateOrWrapper(visitorType, state, wrapper);
160
160
  }
161
161
 
162
- const nodeVisitor = rootVisitor[type] = rootVisitor[type] || {};
162
+ const nodeVisitor = rootVisitor[type] || (rootVisitor[type] = {});
163
163
  mergePair(nodeVisitor, visitorType);
164
164
  }
165
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/traverse",
3
- "version": "7.18.11",
3
+ "version": "7.18.13",
4
4
  "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
5
5
  "author": "The Babel Team (https://babel.dev/team)",
6
6
  "homepage": "https://babel.dev/docs/en/next/babel-traverse",
@@ -17,13 +17,13 @@
17
17
  "main": "./lib/index.js",
18
18
  "dependencies": {
19
19
  "@babel/code-frame": "^7.18.6",
20
- "@babel/generator": "^7.18.10",
20
+ "@babel/generator": "^7.18.13",
21
21
  "@babel/helper-environment-visitor": "^7.18.9",
22
22
  "@babel/helper-function-name": "^7.18.9",
23
23
  "@babel/helper-hoist-variables": "^7.18.6",
24
24
  "@babel/helper-split-export-declaration": "^7.18.6",
25
- "@babel/parser": "^7.18.11",
26
- "@babel/types": "^7.18.10",
25
+ "@babel/parser": "^7.18.13",
26
+ "@babel/types": "^7.18.13",
27
27
  "debug": "^4.1.0",
28
28
  "globals": "^11.1.0"
29
29
  },