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
Improve source map generation #14967
Merged
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
aeab923
source
liuxingbaoyu 4c4ac39
tests
liuxingbaoyu a3038b7
review
liuxingbaoyu d90f6ec
rebase and tests
liuxingbaoyu 7ef541c
review
liuxingbaoyu 28cc7de
review
liuxingbaoyu 2949354
review
liuxingbaoyu 3eaf31c
review
liuxingbaoyu d23bc56
review tests
liuxingbaoyu ca34bac
review
liuxingbaoyu d32a7a8
perf
liuxingbaoyu File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
packages/babel-core/test/fixtures/transformation/source-maps/arrow-function/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,14 @@ | ||
{ | ||
"version": 3, | ||
"names": [ | ||
"t", | ||
"x" | ||
], | ||
"sources": [ | ||
"source-maps/arrow-function/input.js" | ||
], | ||
"sourcesContent": [ | ||
"var t = x => x * x;" | ||
], | ||
"mappings": "AAAA,IAAIA,CAAC,GAAG,SAAJA,CAAC,CAAGC,CAAC;EAAA,OAAIA,CAAC,GAAGA,CAAC;AAAA" | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/babel-core/test/fixtures/transformation/source-maps/class/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,16 @@ | ||
{ | ||
"version": 3, | ||
"names": [ | ||
"Test", | ||
"Error", | ||
"test", | ||
"bar" | ||
], | ||
"sources": [ | ||
"source-maps/class/input.js" | ||
], | ||
"sourcesContent": [ | ||
"class Test {\n get bar() {\n throw new Error(\"wow\");\n }\n}\n\nvar test = new Test;\ntest.bar;" | ||
], | ||
"mappings": "IAAMA,IAAI;EAAA;;EAAA;IAAA;EAAA;;EAAA;IAAA;IAAA,KACR,YAAU;MACR,MAAM,IAAIC,KAAK,CAAC,KAAK,CAAC;IACxB;EAAC;EAAA;AAAA;;AAGH,IAAIC,IAAI,GAAG,IAAIF,IAAI;AACnBE,IAAI,CAACC,GAAG" | ||
} |
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 |
---|---|---|
|
@@ -19,4 +19,5 @@ class A { | |
|
||
private [cm]() | ||
|
||
{}} | ||
{} | ||
} |
3 changes: 2 additions & 1 deletion
3
packages/babel-generator/test/fixtures/regression/11870/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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
class Test { | ||
@TestDecorator | ||
async decorateMe() {}} | ||
async decorateMe() {} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/babel-generator/test/fixtures/sourcemaps/ClassBody-StaticBlock/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,15 @@ | ||
class Foo { | ||
static {} | ||
} | ||
|
||
class A1 { | ||
static{ | ||
foo; | ||
} | ||
} | ||
|
||
class A2 { | ||
static { | ||
foo;bar; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/sourcemaps/ClassBody-StaticBlock/options.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,3 @@ | ||
{ | ||
"sourceMaps": true | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/babel-generator/test/fixtures/sourcemaps/ClassBody-StaticBlock/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,16 @@ | ||
class Foo { | ||
static {} | ||
} | ||
|
||
class A1 { | ||
static { | ||
foo; | ||
} | ||
} | ||
|
||
class A2 { | ||
static { | ||
foo; | ||
bar; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/babel-generator/test/fixtures/sourcemaps/ClassBody-StaticBlock/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,17 @@ | ||
{ | ||
"version": 3, | ||
"names": [ | ||
"Foo", | ||
"A1", | ||
"foo", | ||
"A2", | ||
"bar" | ||
], | ||
"sources": [ | ||
"fixtures/sourcemaps/ClassBody-StaticBlock/input.js" | ||
], | ||
"sourcesContent": [ | ||
"class Foo {\n static {}\n}\n\nclass A1 {\n static{\n foo;\n }\n}\n\nclass A2 {\n static {\n foo;bar;\n }\n}" | ||
], | ||
"mappings": "AAAA,MAAMA,GAAG,CAAC;EACR;AACF;;AAEA,MAAMC,EAAE,CAAC;EACP;IACEC,GAAG;EACL;AACF;;AAEA,MAAMC,EAAE,CAAC;EACP;IACED,GAAG;IAACE,GAAG;EACT;AACF" | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/babel-generator/test/fixtures/sourcemaps/ModuleExpression/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 @@ | ||
const m = module { export const foo = "foo" }; | ||
module { | ||
foo; | ||
bar; | ||
}; | ||
foo(module {}); |
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/sourcemaps/ModuleExpression/options.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,5 @@ | ||
{ | ||
"plugins": ["moduleBlocks"], | ||
"sourceType": "module", | ||
"sourceMaps": true | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/babel-generator/test/fixtures/sourcemaps/ModuleExpression/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,8 @@ | ||
const m = module { | ||
export const foo = "foo"; | ||
}; | ||
module { | ||
foo; | ||
bar; | ||
}; | ||
foo(module {}); |
15 changes: 15 additions & 0 deletions
15
packages/babel-generator/test/fixtures/sourcemaps/ModuleExpression/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,15 @@ | ||
{ | ||
"version": 3, | ||
"names": [ | ||
"m", | ||
"foo", | ||
"bar" | ||
], | ||
"sources": [ | ||
"fixtures/sourcemaps/ModuleExpression/input.js" | ||
], | ||
"sourcesContent": [ | ||
"const m = module { export const foo = \"foo\" };\nmodule {\n foo;\n bar;\n};\nfoo(module {});" | ||
], | ||
"mappings": "AAAA,MAAMA,CAAC,GAAG;EAAS,OAAO,MAAMC,GAAG,GAAG,KAAK;AAAC,CAAC;AAC7C;EACEA,GAAG;EACHC,GAAG;AACL,CAAC;AACDD,GAAG,CAAC,SAAS,CAAC" | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/babel-generator/test/fixtures/sourcemaps/bar-record-tuple/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,2 @@ | ||
let a = [| 1 |]; | ||
let b = {| a: 1 |}; |
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/sourcemaps/bar-record-tuple/options.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,5 @@ | ||
{ | ||
"recordAndTupleSyntaxType": "bar", | ||
"plugins": [["recordAndTuple", { "syntaxType": "bar" }]], | ||
"sourceMaps": true | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/babel-generator/test/fixtures/sourcemaps/bar-record-tuple/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,4 @@ | ||
let a = [|1|]; | ||
let b = {| | ||
a: 1 | ||
|}; |
14 changes: 14 additions & 0 deletions
14
packages/babel-generator/test/fixtures/sourcemaps/bar-record-tuple/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,14 @@ | ||
{ | ||
"version": 3, | ||
"names": [ | ||
"a", | ||
"b" | ||
], | ||
"sources": [ | ||
"fixtures/sourcemaps/bar-record-tuple/input.js" | ||
], | ||
"sourcesContent": [ | ||
"let a = [| 1 |];\nlet b = {| a: 1 |};" | ||
], | ||
"mappings": "AAAA,IAAIA,CAAC,GAAG,EAAG,CAAC,EAAG;AACf,IAAIC,CAAC,GAAG;EAAGD,CAAC,EAAE;AAAC,EAAG" | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/babel-generator/test/fixtures/sourcemaps/hash-record-tuple/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,2 @@ | ||
let a = #[1, 2, 3]; | ||
let b = #{a: 1, b: 2, c: 3}; |
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/sourcemaps/hash-record-tuple/options.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,5 @@ | ||
{ | ||
"recordAndTupleSyntaxType": "hash", | ||
"plugins": [["recordAndTuple", { "syntaxType": "hash" }]], | ||
"sourceMaps": true | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/babel-generator/test/fixtures/sourcemaps/hash-record-tuple/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,6 @@ | ||
let a = #[1, 2, 3]; | ||
let b = #{ | ||
a: 1, | ||
b: 2, | ||
c: 3 | ||
}; |
15 changes: 15 additions & 0 deletions
15
packages/babel-generator/test/fixtures/sourcemaps/hash-record-tuple/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,15 @@ | ||
{ | ||
"version": 3, | ||
"names": [ | ||
"a", | ||
"b", | ||
"c" | ||
], | ||
"sources": [ | ||
"fixtures/sourcemaps/hash-record-tuple/input.js" | ||
], | ||
"sourcesContent": [ | ||
"let a = #[1, 2, 3];\nlet b = #{a: 1, b: 2, c: 3};" | ||
], | ||
"mappings": "AAAA,IAAIA,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAClB,IAAIC,CAAC,GAAG;EAAED,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE;AAAC,CAAC" | ||
} |
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
Oops, something went wrong.
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.
Whops 😬
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.
I also thought it was a throwback when I first saw it, but on closer inspection it wasn't.😃