[Pkg-javascript-commits] [node-recast] 01/05: New upstream version 0.12.5

Julien Puydt julien.puydt at laposte.net
Fri Jul 7 04:39:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-recast.

commit eabe1082e2444160cd39e4469b876e22edd65cd5
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Tue Jun 27 13:40:18 2017 +0200

    New upstream version 0.12.5
---
 .travis.yml     |  1 +
 lib/patcher.js  |  7 +++++--
 package.json    |  8 ++++----
 test/babylon.js | 12 ++++++++++++
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 83ec23f..45a7297 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,6 @@
 language: node_js
 node_js:
+  - "8"
   - "7"
   - "6"
   - "5"
diff --git a/lib/patcher.js b/lib/patcher.js
index ce66b12..cf58835 100644
--- a/lib/patcher.js
+++ b/lib/patcher.js
@@ -2,6 +2,7 @@ var assert = require("assert");
 var linesModule = require("./lines");
 var types = require("./types");
 var getFieldValue = types.getFieldValue;
+var Node = types.namedTypes.Node;
 var Printable = types.namedTypes.Printable;
 var Expression = types.namedTypes.Expression;
 var ReturnStatement = types.namedTypes.ReturnStatement;
@@ -498,10 +499,12 @@ function findChildReprints(newPath, oldPath, reprints) {
   // path.needsParens() && !hasParens(oldNode) check below, the absence of
   // a closing parenthesis after the FunctionExpression would trigger
   // pretty-printing unnecessarily.
-  if (!newPath.canBeFirstInStatement() &&
+  if (Node.check(newNode) &&
+      !newPath.canBeFirstInStatement() &&
       newPath.firstInStatement() &&
-      !hasOpeningParen(oldPath))
+      !hasOpeningParen(oldPath)) {
     return false;
+  }
 
   // If this node needs parentheses and will not be wrapped with
   // parentheses when reprinted, then return false to skip reprinting and
diff --git a/package.json b/package.json
index 6812770..6cf60a3 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
     "parsing",
     "pretty-printing"
   ],
-  "version": "0.12.3",
+  "version": "0.12.5",
   "homepage": "http://github.com/benjamn/recast",
   "repository": {
     "type": "git",
@@ -37,10 +37,10 @@
   "devDependencies": {
     "babel-core": "^6.23.1",
     "babel-preset-es2015": "^6.22.0",
-    "babylon": "~6.16.1",
+    "babylon": "~6.17.0",
     "esprima-fb": "^15001.1001.0-dev-harmony-fb",
-    "mocha": "~3.2.0",
-    "reify": "^0.6.2",
+    "mocha": "~3.4.2",
+    "reify": "^0.11.21",
     "semver": "^5.3.0"
   },
   "engines": {
diff --git a/test/babylon.js b/test/babylon.js
index 5630220..0f32fe7 100644
--- a/test/babylon.js
+++ b/test/babylon.js
@@ -136,6 +136,18 @@ describe("decorators", function () {
     assert.strictEqual(output, code);
   });
 
+  it("babel 6: should not wrap IIFE when reusing nodes", function () {
+    var code = [
+      '(function(...c) {',
+      '  c();',
+      '})();',
+    ].join(eol);
+
+    var ast = recast.parse(code, parseOptions);
+    var output = recast.print(ast, { tabWidth: 2 }).code;
+    assert.strictEqual(output, code);
+  });
+
   it("should not disappear when surrounding code changes", function () {
     var code = [
       'import foo from "foo";',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-recast.git



More information about the Pkg-javascript-commits mailing list