Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make an accompanying sourcemap for transform? #83

Open
trusktr opened this issue Jan 22, 2017 · 0 comments
Open

How to make an accompanying sourcemap for transform? #83

trusktr opened this issue Jan 22, 2017 · 0 comments

Comments

@trusktr
Copy link

trusktr commented Jan 22, 2017

I posted a question on SO, but then thought I might also ask here.

Does estraverse support making a source map? Something like estraverse.replace(ast, transform, sourceMap) would be awesome. Maybe in the returned AST object the root node can have a sourceMap property? Or something along the lines of being able to supply a source map for the original AST in order to get the resulting source map. If no sourcemap is provided, then it would just return a sourcemap as if this is the first transform on the given code.

Would something like that be doable? What are the limitations? For example, I know the AST doesn't contain info about semi colons or the number and ordering of whitespace characters, so it may be difficult to map that.

Is there any existing recommended way to handle source maps with esprima+estraverse?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant