I was trying to modify JavaScript source code by:
- parse source code with @babel/babylon and get the AST
- traverse AST with babel-traverse and do some modifications where needed
- turn AST back to JavaScript source code
The first two steps is pretty simple. But I stuck on turning AST back to source code.
I did some search, and only find examples to transform AST down to lower version JavaScript code.
Any suggestions?