@babel/traverse 7.1.0 → 7.1.6

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.

@@ -251,23 +251,15 @@ function _evaluate(path, state) {
251
251
  state.confident = wasConfident;
252
252
  const right = evaluateCached(path.get("right"), state);
253
253
  const rightConfident = state.confident;
254
- state.confident = leftConfident && rightConfident;
255
254
 
256
255
  switch (node.operator) {
257
256
  case "||":
258
- if (left && leftConfident) {
259
- state.confident = true;
260
- return left;
261
- }
262
-
257
+ state.confident = leftConfident && (!!left || rightConfident);
263
258
  if (!state.confident) return;
264
259
  return left || right;
265
260
 
266
261
  case "&&":
267
- if (!left && leftConfident || !right && rightConfident) {
268
- state.confident = true;
269
- }
270
-
262
+ state.confident = leftConfident && (!left || rightConfident);
271
263
  if (!state.confident) return;
272
264
  return left && right;
273
265
  }
@@ -104,8 +104,10 @@ function insertAfter(nodes) {
104
104
  } = this;
105
105
 
106
106
  if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
107
- return parentPath.insertAfter(nodes);
108
- } else if (this.isNodeType("Expression") || parentPath.isForStatement() && this.key === "init") {
107
+ return parentPath.insertAfter(nodes.map(node => {
108
+ return t().isExpression(node) ? t().expressionStatement(node) : node;
109
+ }));
110
+ } else if (this.isNodeType("Expression") && !this.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
109
111
  if (this.node) {
110
112
  let {
111
113
  scope
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/traverse",
3
- "version": "7.1.0",
3
+ "version": "7.1.6",
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,12 +12,12 @@
12
12
  "main": "lib/index.js",
13
13
  "dependencies": {
14
14
  "@babel/code-frame": "^7.0.0",
15
- "@babel/generator": "^7.0.0",
15
+ "@babel/generator": "^7.1.6",
16
16
  "@babel/helper-function-name": "^7.1.0",
17
17
  "@babel/helper-split-export-declaration": "^7.0.0",
18
- "@babel/parser": "^7.1.0",
19
- "@babel/types": "^7.0.0",
20
- "debug": "^3.1.0",
18
+ "@babel/parser": "^7.1.6",
19
+ "@babel/types": "^7.1.6",
20
+ "debug": "^4.1.0",
21
21
  "globals": "^11.1.0",
22
22
  "lodash": "^4.17.10"
23
23
  },