Option to disable fallback to line
krisselden opened this issue · comments
There is an issue when sorcery
a low resolution map for generated source like a magic-string
edit tracing back through a higher resolution map like one produced by uglify
or typescript
. It will loose lots of mappings.
The workaround in rollup
is to generate mappings for all AST nodes and then only keep them if the trace back to something, thus the extra resolution drops out.
The problem with that approach is the extra mappings will be mapped back to the start of the line, this not only confuses the debugger but is massively confusing if the start of the line has a name entry.
https://github.com/Rich-Harris/sorcery/blob/master/src/Node.js#L156
I'd rather sorcery be able to assume the low res map just has the edits and use that to offset the mappings in the previous map instead of having to get all the sources at the exact same resolution.
Also, is there a reason code isn't shared between rollup
and sorcery
? It looks roughly about the same.
I'd rather sorcery be able to assume the low res map just has the edits and use that to offset the mappings in the previous map instead of having to get all the sources at the exact same resolution.
Give this a test drive if you get the chance. Thanks!