forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace "source-map" library with "source-map-js" (facebook#22126)
- Loading branch information
Showing
10 changed files
with
32 additions
and
70 deletions.
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'; | ||
|
||
|
@@ -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