@babel/traverse 7.1.4 → 7.2.3

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.

@@ -324,7 +324,7 @@ function getThisBinding(thisEnvFn, inConstructor) {
324
324
  if (!child.get("callee").isSuper()) return;
325
325
  if (supers.has(child.node)) return;
326
326
  supers.add(child.node);
327
- child.replaceWith(t().assignmentExpression("=", t().identifier(thisBinding), child.node));
327
+ child.replaceWithMultiple([child.node, t().assignmentExpression("=", t().identifier(thisBinding), t().identifier("this"))]);
328
328
  }
329
329
 
330
330
  });
@@ -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,7 +104,9 @@ 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);
107
+ return parentPath.insertAfter(nodes.map(node => {
108
+ return t().isExpression(node) ? t().expressionStatement(node) : node;
109
+ }));
108
110
  } else if (this.isNodeType("Expression") && !this.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
109
111
  if (this.node) {
110
112
  let {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/traverse",
3
- "version": "7.1.4",
3
+ "version": "7.2.3",
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,16 +12,17 @@
12
12
  "main": "lib/index.js",
13
13
  "dependencies": {
14
14
  "@babel/code-frame": "^7.0.0",
15
- "@babel/generator": "^7.1.3",
15
+ "@babel/generator": "^7.2.2",
16
16
  "@babel/helper-function-name": "^7.1.0",
17
17
  "@babel/helper-split-export-declaration": "^7.0.0",
18
- "@babel/parser": "^7.1.3",
19
- "@babel/types": "^7.1.3",
20
- "debug": "^3.1.0",
18
+ "@babel/parser": "^7.2.3",
19
+ "@babel/types": "^7.2.2",
20
+ "debug": "^4.1.0",
21
21
  "globals": "^11.1.0",
22
22
  "lodash": "^4.17.10"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@babel/helper-plugin-test-runner": "^7.0.0"
26
- }
26
+ },
27
+ "gitHead": "d35f2ad92b322c3bb9c6792e2683807afae0b105"
27
28
  }