When I found out someone is working on a format-preserving printer for @babel/generate, I also saw in a comment that @babel/parser has a tokens parameter that outputs a CST. Well, kind of; it outputs the AST and then dumps the lexer output as well, so it seems. I haven't yet found a "real" CST-outputting parser for javascript (well, I found this repo but it looks dead). recast supporting babel's output with tokens: true would make it possible to fix issues like this one
When I found out someone is working on a format-preserving printer for @babel/generate, I also saw in a comment that @babel/parser has a
tokens
parameter that outputs a CST. Well, kind of; it outputs the AST and then dumps the lexer output as well, so it seems. I haven't yet found a "real" CST-outputting parser for javascript (well, I found this repo but it looks dead).recast
supporting babel's output withtokens: true
would make it possible to fix issues like this one