Merged
Conversation
Swatinem
approved these changes
Nov 2, 2023
Contributor
Swatinem
left a comment
There was a problem hiding this comment.
can you add a test that makes sure the get_source() accessor still works when parsing a sourcemap from JSON?
I had a hard time following the code to make sure this case is actually handled correctly.
Contributor
|
Or maybe such a test already exists? Which might be even better :-) |
Contributor
Author
|
Fair point. I'll have a look to see if this case is already covered. |
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.
This changes sourcemap parsing so that source names are not automatically prefixed with the
sourceRootfield. The problem with doing that is that reading and then immediately writing a sourcemap would result in the source names changing.Instead,
SourceMapnow maintains a copy of the vector of source names with thesourceRootprefix prepended. Obviously this copy needs to be kept in sync with the original source names whenever a source name or thesourceRootchanges.Note that this PR changes the behavior of
SourceMapBuildersomewhat. Now, there is no difference between parsing a sourcemap like{ "sourceRoot": "root", "sources": ["foo.js", "bar.js"], [...]}and constructing it with a builder:
Before, the parsed version would've contained the sources
"root/foo.js"and"root/bar.js", while the constructed version would've had"foo.js"and"bar.js"