You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
recast ability to take previous source maps fixes the problem of multistage sourcemaps in the different transforms. I propose creating issues to tackle each transform independently.
I tried updated all in one shot and it was bananas
- ES6 to AMD
- CJS to AMD
- AMD to Slim ?
** Also, we need to figure out how to validate a generated sourcemap.
Long story:
I was able to replicate with the code below, sourcemap-to-ast is unable to update the esprima ast correctly based on babel's source map; babel's ast has some deviations from ASTree and I think that causes the problem.
I tried recast, that uses esprima under the hood and has a bunch of code to keep track of the AST changes and it fixes the problem reported in steal-tools.
But replacing esprima with recast in transpile is a lot more work than I expected:
The expected file tests need all to be updated, recast.print format is different than escodegen's
Some transpile transforms access the AST directly without using a traverse function, this transforms break with recast since a "File" node wrapper is used to keep track of line numbers and stuff like that. (unwrapping the "program" node causes the recast printer to fail due to line number mismatches)
Ref: stealjs/steal-tools#832
TL; DR
recast ability to take previous source maps fixes the problem of multistage sourcemaps in the different transforms. I propose creating issues to tackle each transform independently.
I tried updated all in one shot and it was bananas
** Also, we need to figure out how to validate a generated sourcemap.
Long story:
I was able to replicate with the code below,
sourcemap-to-ast
is unable to update the esprima ast correctly based on babel's source map; babel's ast has some deviations from ASTree and I think that causes the problem.I tried recast, that uses esprima under the hood and has a bunch of code to keep track of the AST changes and it fixes the problem reported in steal-tools.
But replacing esprima with recast in transpile is a lot more work than I expected:
The code replicating the issue:
The text was updated successfully, but these errors were encountered: