process: add lineLength to source-map-cache#29863
Closed
bcoe wants to merge 4 commits intonodejs:masterfrom
Closed
process: add lineLength to source-map-cache#29863bcoe wants to merge 4 commits intonodejs:masterfrom
bcoe wants to merge 4 commits intonodejs:masterfrom
Conversation
bcoe
commented
Oct 6, 2019
Contributor
Author
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).
Contributor
Author
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
approved these changes
Oct 6, 2019
Member
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.
richardlau
reviewed
Oct 6, 2019
This comment has been minimized.
This comment has been minimized.
Collaborator
devnexen
approved these changes
Oct 7, 2019
jasnell
approved these changes
Oct 7, 2019
benjamingr
reviewed
Oct 7, 2019
targos
reviewed
Oct 8, 2019
Contributor
Author
|
@targos I believe I've addressed your comments, mind giving this a final look? |
This comment has been minimized.
This comment has been minimized.
added 4 commits
October 11, 2019 16:24
Without the line lengths of in-memory transpiled source, it's not possible to convert from byte ofsets to line/column offsets.
1a5488c to
15994ab
Compare
This comment has been minimized.
This comment has been minimized.
Collaborator
Trott
pushed a commit
that referenced
this pull request
Oct 14, 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>
Member
|
Landed in 4ca61f4 |
targos
pushed a commit
that referenced
this pull request
Nov 8, 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>
targos
pushed a commit
that referenced
this pull request
Nov 10, 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: