Skip to content
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 11 commits into from Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -3,6 +3,6 @@
arr.map(function (x) {
return x * x;
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJhcnIiLCJtYXAiLCJ4Il0sInNvdXJjZXMiOlsic3RkaW4iXSwic291cmNlc0NvbnRlbnQiOlsiYXJyLm1hcCh4ID0+IHggKiB4KTsiXSwibWFwcGluZ3MiOiI7O0FBQUFBLEdBQUcsQ0FBQ0MsR0FBSixDQUFRLFVBQUFDLENBQUM7RUFBQSxPQUFJQSxDQUFDLEdBQUdBLENBQVI7QUFBQSxDQUFUIn0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJhcnIiLCJtYXAiLCJ4Il0sInNvdXJjZXMiOlsic3RkaW4iXSwic291cmNlc0NvbnRlbnQiOlsiYXJyLm1hcCh4ID0+IHggKiB4KTsiXSwibWFwcGluZ3MiOiI7O0FBQUFBLEdBQUcsQ0FBQ0MsR0FBRyxDQUFDLFVBQUFDLENBQUM7RUFBQSxPQUFJQSxDQUFDLEdBQUdBLENBQUM7QUFBQSxFQUFDIn0=

//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Rkb3V0IiwibmFtZXMiOltdLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJtYXBwaW5ncyI6IiJ9
Expand Up @@ -11,5 +11,5 @@
"sourcesContent": [
"arr.map(x => x * x);"
],
"mappings": "AAAAA,GAAG,CAACC,GAAJ,CAAQ,UAAAC,CAAC;EAAA,OAAIA,CAAC,GAAGA,CAAR;AAAA,CAAT"
"mappings": "AAAAA,GAAG,CAACC,GAAG,CAAC,UAAAC,CAAC;EAAA,OAAIA,CAAC,GAAGA,CAAC;AAAA,EAAC"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1,6 +1,6 @@
{
"version": 3,
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsFA;EACAA,kBADA;;EAEAC;IACA;MACAC;IADA;EAGA;;AANA,C",
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsFA;EACAA;;EACAC;IACA;MACAC;IACA;EACA;;AACA",
"names": [
"name",
"data",
Expand Down
Expand Up @@ -55,7 +55,7 @@
"column": 4
},
"original": {
"line": 90,
"line": 92,
"column": 0
}
},
Expand Down
@@ -1,7 +1,11 @@
{
"mappings": "AAAA,UAAU,Y;SAAM;AAAC,CAAjB",
"version": 3,
"mappings": "AAAA,UAAU,Y;SAAM,C;CAAC",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is fine. The ; is no longer mapped to a source location, which really don't matter.

"names": [],
"sources": ["original.js"],
"sourcesContent": ["var foo = () => 4;"],
"version": 3
}
"sources": [
"original.js"
],
"sourcesContent": [
"var foo = () => 4;"
]
}
@@ -1,15 +1,13 @@
{
"version": 3,
"mappings": "AAAC,KCAD;ACAA,K",
"mappings": "AAAC,KAAG;ACAJ,KAAG",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is fine. The ; is mapped to the bar.js file (which fully replaces the input.tsx in the plugin) instead of the input.tsx file. Because nothing refers to the input.tsx file, it's removed from sourcesContent.

"names": [],
"sources": [
"bar.js",
"input.tsx",
"baz.js"
],
"sourcesContent": [
"<bar />",
"foo(1);\nfunction foo(bar: number): never {\n throw new Error('Intentional.');\n}",
"baz();"
]
}
@@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAAC,KCAD;;AACA,SAASA,GAAT,CAAaC,GAAb,EAAwB;EACpB,MAAM,IAAIC,KAAJ,CAAU,cAAV,CAAN;AACH",
"mappings": "AAAC,KAAG;;ACCJ,SAASA,GAAG,CAACC,GAAW;EACpB,MAAM,IAAIC,KAAK,CAAC,cAAc,CAAC;AACnC",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are fine. Same reasoning with the ; pointing to the same file as the expression.

"names": [
"foo",
"bar",
Expand Down
@@ -1,7 +1,11 @@
{
"mappings": "AAAA,UAAU,Y;SAAM;AAAC,CAAjB",
"version": 3,
"mappings": "AAAA,UAAU,Y;SAAM,C;CAAC",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same ; change.

"names": [],
"sources": ["source-maps/input-source-map-same-location/input.js"],
"sourcesContent": ["var foo = () => 4;"],
"version": 3
}
"sources": [
"source-maps/input-source-map-same-location/input.js"
],
"sourcesContent": [
"var foo = () => 4;"
]
}
@@ -1,13 +1,11 @@
{
"version": 3,
"mappings": "AAAC,KCAD",
"mappings": "AAAC,KAAG",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same ; change.

"names": [],
"sources": [
"test.js",
"input.tsx"
"test.js"
],
"sourcesContent": [
"<bar />",
"foo(1);\nfunction foo(bar: number): never {\n throw new Error('Intentional.');\n}"
"<bar />"
]
}
@@ -1,7 +1,11 @@
{
"mappings": "AAAA,UAAU,Y;SAAM;AAAC,CAAjB",
"version": 3,
"mappings": "AAAA,UAAU,Y;SAAM,C;CAAC",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same ; change.

"names": [],
"sources": ["original.js"],
"sourcesContent": ["var foo = () => 4;"],
"version": 3
}
"sources": [
"original.js"
],
"sourcesContent": [
"var foo = () => 4;"
]
}
@@ -1,5 +1,5 @@
{
"mappings": "AAAA;AAEAA,OAAO,CAACC,GAAR,CAAY,eAAZ",
"version": 3,
"names": [
"console",
"log"
Expand All @@ -10,5 +10,5 @@
"sourcesContent": [
"#!env node\n\nconsole.log(\"Hello, world!\");"
],
"version": 3
}
"mappings": "AAAA;AAEAA,OAAO,CAACC,GAAG,CAAC,eAAe,CAAC"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The better maps the ( and ), and includes the same ; change.

}