Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sourcemap markings for each line of a string (#12086)
* Add sourcemap markings for each line of a string Fixes #12083 * Fix for multiple newlines * Optimize with indexOf * Comment explaining newline search
- Loading branch information
1 parent
a4a14ca
commit f49234a
Showing
8 changed files
with
164 additions
and
19 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
6 changes: 6 additions & 0 deletions
6
packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/input.js
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"before\ | ||
after"; | ||
|
||
"before\ | ||
\ | ||
after"; |
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/output.js
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"before\ | ||
after"; | ||
"before\ | ||
\ | ||
after"; |
9 changes: 9 additions & 0 deletions
9
packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/source-map.json
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"mappings": "AAAA;AACA,MADA;AAGA;AACA;AACA,MAFA", | ||
"names": [], | ||
"sources": ["fixtures/sourcemaps/string-literal-newline/input.js"], | ||
"sourcesContent": [ | ||
"\"before\\\nafter\";\n\n\"before\\\n\\\nafter\";" | ||
], | ||
"version": 3 | ||
} |
27 changes: 27 additions & 0 deletions
27
packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/input.js
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Newline | ||
`before | ||
after`; | ||
|
||
// Newline newline | ||
`before | ||
after`; | ||
|
||
// Newline LineContinuation | ||
`before | ||
\ | ||
after`; | ||
|
||
// LineContinuation | ||
`before\ | ||
after`; | ||
|
||
// LineContinuation newline | ||
`before\ | ||
after`; | ||
|
||
// LineContinuation LineContinuation | ||
`before\ | ||
\ | ||
after`; |
22 changes: 22 additions & 0 deletions
22
packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/output.js
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Newline | ||
`before | ||
after`; // Newline newline | ||
|
||
`before | ||
after`; // Newline LineContinuation | ||
|
||
`before | ||
\ | ||
after`; // LineContinuation | ||
|
||
`before\ | ||
after`; // LineContinuation newline | ||
|
||
`before\ | ||
after`; // LineContinuation LineContinuation | ||
|
||
`before\ | ||
\ | ||
after`; |
9 changes: 9 additions & 0 deletions
9
packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/source-map.json
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"mappings": "AAAA;AACC;AACD,MADA,C,CAGA;;AACC;AACD;AACA,MAFA,C,CAIA;;AACC;AACD;AACA,MAFA,C,CAIA;;AACC;AACD,MADA,C,CAGA;;AACC;AACD;AACA,MAFA,C,CAIA;;AACC;AACD;AACA,MAFA", | ||
"names": [], | ||
"sources": ["fixtures/sourcemaps/template-literal-newline/input.js"], | ||
"sourcesContent": [ | ||
"// Newline\n`before\nafter`;\n\n// Newline newline\n`before\n\nafter`;\n\n// Newline LineContinuation\n`before\n\\\nafter`;\n\n// LineContinuation\n`before\\\nafter`;\n\n// LineContinuation newline\n`before\\\n\nafter`;\n\n// LineContinuation LineContinuation\n`before\\\n\\\nafter`;" | ||
], | ||
"version": 3 | ||
} |
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