Open coderaiser opened 2 years ago
Thanks for the report!
One thing that would help a lot in debugging this would be to have a way to reproduce it without needing to install any additional libraries (like escover/plugin
or putout
.)
Can you make a version of your test example that replaces the transform
call with some explicit modifications to the AST? Like in the style seen here: https://github.com/benjamn/recast#usage . Or if you search through test/printer.ts
for the string "ast.program", you'll find a number of examples of test cases that take some AST and then print it.
I got case that may be relevant to https://github.com/benjamn/recast/pull/1057, since it's about
SequenceExpressions
. For such code:After instrumenting by coverage tool π©ESCover I receive next results.
β
@babel/generate
produces correct result:β
recast
produces incorrect result:Because if
__c4['π§¨']
calls are removed, code looks like this:Which is absolutely wrong. Here is code (+ what inslide a
fix
function) of πPutout plugin that does transforms with Babel API.Here is test example:
Only transformed made by π
Putout
,parse
andprint
it's recast.Looks like it is related to