Closed benjamn closed 10 years ago
+1 on this.
From recast README:
The magic of Recast is that it reprints only those parts of the syntax tree that you modify.
So this means that in a lot of cases envify won't change formatting and line numbers!
Ah, fantastic - a few of my transforms have been using escodegen and the reformatting can be pretty frustrating. I'll have a proper look at the changes after work and then it should be good to merge :) It'll probably warrant bumping envify up to 1.0.0 too. Thanks @benjamn!
Glad you like it! Whatever you decide here, I'm curious to know how recast
works for you (for this or anything else).
Looks great, merging and publishing to 1.0.0. Thanks again :) recast
seems like a nice alternative to falafel, especially with source map support. I'm gonna have a closer look at using it for my other transforms soon, will let you know if I run into anything!
The https://github.com/benjamn/recast package is similar in spirit to
falafel
, but it has more convenient tools for checking AST node types and creating new AST nodes, which helps simplify the bigif
-statement incustom.js
and also makes it easier to create the replacementLiteral
nodes.If that's not something you particularly care about, then feel free to close this pull request. Just thought I'd make the suggestion!