diff --git a/package.json b/package.json index 651c17a7..cf74f0e0 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "micromatch": "^3.1.10", "neo-async": "^2.5.0", "node-dir": "^0.1.17", - "recast": "^0.18.1", + "recast": "^0.20.3", "temp": "^0.8.1", "write-file-atomic": "^2.3.0" }, diff --git a/src/template.js b/src/template.js index 71e51941..d2c0f0d2 100644 --- a/src/template.js +++ b/src/template.js @@ -136,10 +136,17 @@ module.exports = function withParser(parser) { template[template.length - 1] += ')'; } - return statement.apply( + const expression = statement.apply( null, [template].concat(Array.from(arguments).slice(1)) ).expression; + + // Remove added parens + if (expression.extra) { + expression.extra.parenthesized = false; + } + + return expression; } return {statements, statement, expression}; diff --git a/yarn.lock b/yarn.lock index 9665fb82..d8da231d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -593,10 +593,12 @@ assign-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= -ast-types@0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.2.tgz#df39b677a911a83f3a049644fb74fdded23cea48" - integrity sha512-uWMHxJxtfj/1oZClOxDEV1sQ1HCDkA4MG8Gr69KKeBjEVH0R84WlejZ0y2DcwyBlpAEMltmVYkVgqfLFb2oyiA== +ast-types@0.14.1: + version "0.14.1" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.14.1.tgz#0b415043770d7a2cbe4b2770271cbd7d2c9f61b9" + integrity sha512-pfSiukbt23P1qMhNnsozLzhMLBs7EEeXqPyvPmnuZM+RMfwfqwDbSVKYflgGuVI7/VehR4oMks0igzdNAg4VeQ== + dependencies: + tslib "^2.0.1" astral-regex@^1.0.0: version "1.0.0" @@ -1667,9 +1669,9 @@ flatted@^2.0.0: integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== flow-parser@0.*: - version "0.124.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.124.0.tgz#b0ff07cba91ffe5f58a95867fb86cf0d1bdc37ff" - integrity sha512-ftEG23+ieFYxpBnwJXLZiSmAjrtVU7J2NmEqv7OZbwPWgqsqKsSD73RwBxdEFhUdyfvceDRZ7GbQrYZJ0YKuFg== + version "0.132.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.132.0.tgz#68c9aea4cfd84577337559a6f121ef3ab687a251" + integrity sha512-y1P37zDCPSdphlk+w+roCqcOar6iQdNaAJldJ6xx5/2r4ZRv4KHO+qL+AXwPWp+34eN+oPxPjWnU7GybJnyISQ== for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" @@ -3535,15 +3537,16 @@ readable-stream@^2.0.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" -recast@^0.18.1: - version "0.18.2" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.18.2.tgz#ada263677edc70c45408caf20e6ae990958fdea8" - integrity sha512-MbuHc1lzIDIn7bpxaqIAGwwtyaokkzPqINf1Vm/LA0BSyVrTgXNVTTT7RzWC9kP+vqrUoYVpd6wHhI8x75ej8w== +recast@^0.20.3: + version "0.20.3" + resolved "https://registry.yarnpkg.com/recast/-/recast-0.20.3.tgz#ac9387e4a59e5c8caef9057a35e306646287a7ef" + integrity sha512-jrEPzRV5B7wfRiN0UYMtjgIx1Hp8MRHdLcMYqMNd0DoOe1CB5JmPL/04I7WPuuApCs7LCSisYK/FfKnPEaJrzw== dependencies: - ast-types "0.13.2" + ast-types "0.14.1" esprima "~4.0.0" private "^0.1.8" source-map "~0.6.1" + tslib "^2.0.1" regenerator-runtime@^0.11.0: version "0.11.1" @@ -4197,6 +4200,11 @@ tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== +tslib@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e" + integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ== + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"