Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make line counts reflect all line endings (#691)
Summary: **Summary** Metro included a few functions to count source lines, some of which didn't correctly count all [line terminators specified in the ECMAScript standard](https://262.ecma-international.org/12.0/#sec-line-terminators). This PR replaces those implementations with the correct one found in `packages/metro/src/shared/output/RamBundle/util.js`. The user-facing issue which led me to this was that importing a file with CRLF line endings caused `/symbolicate` to return incorrect mappings for all files after that one in the bundle. Metro-transform-worker was double-counting the line endings and getExplodedSourceMap was carrying that erroneous offset through. **Test plan** There's a new test for a variety of line endings, and the several existing tests that exercise countLines pass without modification. Pull Request resolved: #691 Reviewed By: feedthejim Differential Revision: D30607069 Pulled By: motiz88 fbshipit-source-id: c83d5cd87de40b204e9b7ade08ce831360751bf6
- Loading branch information
1 parent
1bde8b9
commit a75e292
Showing
4 changed files
with
29 additions
and
14 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