Uh oh!
There was an error while loading. Please reload this page.
process: add lineLength to source-map-cache - #29863
Conversation
There was a problem hiding this comment.
I pulled prepare_stack_trace.js into its own file, because it seemed like it wasn't directly related to the source map caching functionality (and source_map_cache.js was starting to get a bit confusing).
There was a problem hiding this comment.
It's getting to the point where we write quite a bit of data to disk (and memory) -- we don't actually need the url field, if we've successfully parsed the map, so let's avoid storing it.
devsnek
left a comment
There was a problem hiding this comment.
i can't really comment on the changes to the source map logic but everything else looks ok
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
commented
Oct 7, 2019
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bcoe
commented
Oct 11, 2019
@targos I believe I've addressed your comments, mind giving this a final look? |
This comment has been minimized.
This comment has been minimized.
Without the line lengths of in-memory transpiled source, it's not possible to convert from byte ofsets to line/column offsets.
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
commented
Oct 12, 2019
Without the line lengths of in-memory transpiled source, it's not possible to convert from byte ofsets to line/column offsets. PR-URL: #29863 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Trott
commented
Oct 14, 2019
Landed in 4ca61f4 |
Without the line lengths of in-memory transpiled source, it's not possible to convert from byte ofsets to line/column offsets. PR-URL: #29863 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Without the line lengths of in-memory transpiled source, it's not possible to convert from byte ofsets to line/column offsets. PR-URL: #29863 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesProblem
I realized when integrating source-map functionality with coverage that we're missing a piece of information necessary to support tools like ts-node:
require.extensions) we lack enough information to translate from bytes to lines/columns.we end up with a bad reports that look like this, due to missing information:
👆 note that exactly the wrong code is highlighted 😆
Solution
If we track the line lengths of the source file that source maps were extracted from, this provides enough information to remap from byte offset to line/column offset.
I've introduced an additional value into the cache,
lineLengths, to facilitate this.we can now generate the following report: