-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Replace "source-map" library with "source-map-js" #22126
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ import type { | |
MixedSourceMap, | ||
} from './SourceMapTypes'; | ||
import type {HookMap} from './generateHookMap'; | ||
import * as util from 'source-map/lib/util'; | ||
import * as util from 'source-map-js/lib/util'; | ||
import {decodeHookMap} from './generateHookMap'; | ||
import {getHookNameForLocation} from './getHookNameForLocation'; | ||
|
||
jstejada marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -27,10 +27,9 @@ const REACT_SOURCES_EXTENSION_KEY = 'x_react_sources'; | |
const FB_SOURCES_EXTENSION_KEY = 'x_facebook_sources'; | ||
|
||
/** | ||
* Extracted from the logic in [email protected]'s SourceMapConsumer. | ||
* By default, source names are normalized using the same logic that the | ||
* `[email protected]` package uses internally. This is crucial for keeping the | ||
* sources list in sync with a `SourceMapConsumer` instance. | ||
* Extracted from the logic in [email protected]'s SourceMapConsumer. | ||
* By default, source names are normalized using the same logic that the `[email protected]` package uses internally. | ||
* This is crucial for keeping the sources list in sync with a `SourceMapConsumer` instance. | ||
*/ | ||
function normalizeSourcePath( | ||
sourceInput: string, | ||
|
@@ -41,6 +40,18 @@ function normalizeSourcePath( | |
|
||
// eslint-disable-next-line react-internal/no-primitive-constructors | ||
source = String(source); | ||
// Some source maps produce relative source paths like "./foo.js" instead of | ||
// "foo.js". Normalize these first so that future comparisons will succeed. | ||
// See bugzil.la/1090768. | ||
source = util.normalize(source); | ||
// Always ensure that absolute sources are internally stored relative to | ||
// the source root, if the source root is absolute. Not doing this would | ||
// be particularly problematic when the source root is a prefix of the | ||
// source (valid, but why??). See github issue #199 and bugzil.la/1188982. | ||
source = | ||
sourceRoot != null && util.isAbsolute(sourceRoot) && util.isAbsolute(source) | ||
? util.relative(sourceRoot, source) | ||
: source; | ||
return util.computeSourceURL(sourceRoot, source); | ||
} | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so glad we can get rid of this