diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps inline/out-files/lib/bar/bar.js b/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps inline/out-files/lib/bar/bar.js
index 475e871fca10..40d76e5535b2 100644
--- a/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps inline/out-files/lib/bar/bar.js
+++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps inline/out-files/lib/bar/bar.js
@@ -3,4 +3,4 @@
(function () {
return 42;
});
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Jhci9iYXIuanMiXSwic291cmNlc0NvbnRlbnQiOlsiKCgpID0+IDQyKSJdLCJtYXBwaW5ncyI6Ijs7QUFBQSxDQUFDO0VBQUEsT0FBTSxFQUFOO0FBQUEsQ0FBRCJ9
\ No newline at end of file
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Jhci9iYXIuanMiXSwic291cmNlc0NvbnRlbnQiOlsiKCgpID0+IDQyKSJdLCJtYXBwaW5ncyI6Ijs7QUFBQSxDQUFDO0VBQUEsT0FBTSxFQUFFO0FBQUEifQ==
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps inline/out-files/lib/foo.js b/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps inline/out-files/lib/foo.js
index 6915f5c70848..f72d4eedae70 100644
--- a/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps inline/out-files/lib/foo.js
+++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps inline/out-files/lib/foo.js
@@ -3,4 +3,4 @@
arr.map(function (x) {
return x * MULTIPLIER;
});
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJhcnIiLCJtYXAiLCJ4IiwiTVVMVElQTElFUiJdLCJzb3VyY2VzIjpbIi4uL3NyYy9mb28uanMiXSwic291cmNlc0NvbnRlbnQiOlsiYXJyLm1hcCh4ID0+IHggKiBNVUxUSVBMSUVSKTsiXSwibWFwcGluZ3MiOiI7O0FBQUFBLEdBQUcsQ0FBQ0MsR0FBSixDQUFRLFVBQUFDLENBQUM7RUFBQSxPQUFJQSxDQUFDLEdBQUdDLFVBQVI7QUFBQSxDQUFUIn0=
\ No newline at end of file
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJhcnIiLCJtYXAiLCJ4IiwiTVVMVElQTElFUiJdLCJzb3VyY2VzIjpbIi4uL3NyYy9mb28uanMiXSwic291cmNlc0NvbnRlbnQiOlsiYXJyLm1hcCh4ID0+IHggKiBNVUxUSVBMSUVSKTsiXSwibWFwcGluZ3MiOiI7O0FBQUFBLEdBQUcsQ0FBQ0MsR0FBRyxDQUFDLFVBQUFDLENBQUM7RUFBQSxPQUFJQSxDQUFDLEdBQUdDLFVBQVU7QUFBQSxFQUFDIn0=
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps/out-files/lib/bar/bar.js.map b/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps/out-files/lib/bar/bar.js.map
index f7447a76f04e..57dfb0cd4ac1 100644
--- a/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps/out-files/lib/bar/bar.js.map
+++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps/out-files/lib/bar/bar.js.map
@@ -1 +1 @@
-{"version":3,"file":"bar.js","names":[],"sources":["../../src/bar/bar.js"],"sourcesContent":["(() => 42)"],"mappings":";;AAAA,CAAC;EAAA,OAAM,EAAN;AAAA,CAAD"}
\ No newline at end of file
+{"version":3,"file":"bar.js","names":[],"sources":["../../src/bar/bar.js"],"sourcesContent":["(() => 42)"],"mappings":";;AAAA,CAAC;EAAA,OAAM,EAAE;AAAA"}
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps/out-files/lib/foo.js.map b/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps/out-files/lib/foo.js.map
index 7e7ba2c03a92..632758421a8b 100644
--- a/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps/out-files/lib/foo.js.map
+++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --source-maps/out-files/lib/foo.js.map
@@ -1 +1 @@
-{"version":3,"file":"foo.js","names":["arr","map","x","MULTIPLIER"],"sources":["../src/foo.js"],"sourcesContent":["arr.map(x => x * MULTIPLIER);"],"mappings":";;AAAAA,GAAG,CAACC,GAAJ,CAAQ,UAAAC,CAAC;EAAA,OAAIA,CAAC,GAAGC,UAAR;AAAA,CAAT"}
\ No newline at end of file
+{"version":3,"file":"foo.js","names":["arr","map","x","MULTIPLIER"],"sources":["../src/foo.js"],"sourcesContent":["arr.map(x => x * MULTIPLIER);"],"mappings":";;AAAAA,GAAG,CAACC,GAAG,CAAC,UAAAC,CAAC;EAAA,OAAIA,CAAC,GAAGC,UAAU;AAAA,EAAC"}
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file --source-maps inline/out-files/script2.js b/packages/babel-cli/test/fixtures/babel/filename --out-file --source-maps inline/out-files/script2.js
index fe9df475388f..598cb7acdfa8 100644
--- a/packages/babel-cli/test/fixtures/babel/filename --out-file --source-maps inline/out-files/script2.js
+++ b/packages/babel-cli/test/fixtures/babel/filename --out-file --source-maps inline/out-files/script2.js
@@ -4,4 +4,4 @@ arr.map(function (x) {
return x * MULTIPLIER;
});
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NyaXB0Mi5qcyIsIm5hbWVzIjpbImFyciIsIm1hcCIsIngiLCJNVUxUSVBMSUVSIl0sInNvdXJjZXMiOlsic2NyaXB0LmpzIl0sInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogTVVMVElQTElFUik7Il0sIm1hcHBpbmdzIjoiOztBQUFBQSxHQUFHLENBQUNDLEdBQUosQ0FBUSxVQUFBQyxDQUFDO0VBQUEsT0FBSUEsQ0FBQyxHQUFHQyxVQUFSO0FBQUEsQ0FBVCJ9
\ No newline at end of file
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NyaXB0Mi5qcyIsIm5hbWVzIjpbImFyciIsIm1hcCIsIngiLCJNVUxUSVBMSUVSIl0sInNvdXJjZXMiOlsic2NyaXB0LmpzIl0sInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogTVVMVElQTElFUik7Il0sIm1hcHBpbmdzIjoiOztBQUFBQSxHQUFHLENBQUNDLEdBQUcsQ0FBQyxVQUFBQyxDQUFDO0VBQUEsT0FBSUEsQ0FBQyxHQUFHQyxVQUFVO0FBQUEsRUFBQyJ9
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/filename-sourcemap --out-file --source-maps inline/out-files/script2.js b/packages/babel-cli/test/fixtures/babel/filename-sourcemap --out-file --source-maps inline/out-files/script2.js
index 6d70837d0ea2..c25911f046e9 100644
--- a/packages/babel-cli/test/fixtures/babel/filename-sourcemap --out-file --source-maps inline/out-files/script2.js
+++ b/packages/babel-cli/test/fixtures/babel/filename-sourcemap --out-file --source-maps inline/out-files/script2.js
@@ -4,4 +4,4 @@ arr.map(function (x) {
return x * MULTIPLIER;
});
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NyaXB0Mi5qcyIsIm5hbWVzIjpbImFyciIsIngiXSwic291cmNlcyI6WyJvcmlnaW5hbC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZm9vID0gKCkgPT4gNDsiXSwibWFwcGluZ3MiOiI7O0FBQUFBO0VBQUEsT0FBVUMsY0FBVjtBQUFBIn0=
\ No newline at end of file
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NyaXB0Mi5qcyIsIm5hbWVzIjpbImFyciIsIngiXSwic291cmNlcyI6WyJvcmlnaW5hbC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZm9vID0gKCkgPT4gNDsiXSwibWFwcGluZ3MiOiI7O0FBQUFBO0VBQUEsT0FBVUMsYyJ9
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps inline/out-files/script3.js b/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps inline/out-files/script3.js
index 6ec5a3e83f21..7c0f7a650a8d 100644
--- a/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps inline/out-files/script3.js
+++ b/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps inline/out-files/script3.js
@@ -9,4 +9,4 @@ arr.map(function (x) {
return x * MULTIPLIER;
});
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NyaXB0My5qcyIsIm5hbWVzIjpbImFyciIsIm1hcCIsIngiLCJNVUxUSVBMSUVSIl0sInNvdXJjZXMiOlsic2NyaXB0LmpzIiwic2NyaXB0Mi5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIoKCkgPT4gNDIpIiwiYXJyLm1hcCh4ID0+IHggKiBNVUxUSVBMSUVSKTsiXSwibWFwcGluZ3MiOiI7O0FBQUEsQ0FBQztFQUFBLE9BQU0sRUFBTjtBQUFBLENBQUQ7OztBQ0FBQSxHQUFHLENBQUNDLEdBQUosQ0FBUSxVQUFBQyxDQUFDO0VBQUEsT0FBSUEsQ0FBQyxHQUFHQyxVQUFSO0FBQUEsQ0FBVCJ9
\ No newline at end of file
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NyaXB0My5qcyIsIm5hbWVzIjpbImFyciIsIm1hcCIsIngiLCJNVUxUSVBMSUVSIl0sInNvdXJjZXMiOlsic2NyaXB0LmpzIiwic2NyaXB0Mi5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIoKCkgPT4gNDIpIiwiYXJyLm1hcCh4ID0+IHggKiBNVUxUSVBMSUVSKTsiXSwibWFwcGluZ3MiOiI7O0FBQUEsQ0FBQztFQUFBLE9BQU0sRUFBRTtBQUFBOzs7QUNBVEEsR0FBRyxDQUFDQyxHQUFHLENBQUMsVUFBQUMsQ0FBQztFQUFBLE9BQUlBLENBQUMsR0FBR0MsVUFBVTtBQUFBLEVBQUMifQ==
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps/out-files/script3.js.map b/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps/out-files/script3.js.map
index a17b280ac01a..92ee347fe7c0 100644
--- a/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps/out-files/script3.js.map
+++ b/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps/out-files/script3.js.map
@@ -1 +1 @@
-{"version":3,"file":"script3.js","names":["arr","map","x","MULTIPLIER"],"sources":["script.js","script2.js"],"sourcesContent":["(() => 42)\n\n// some comments","arr.map(x => x * MULTIPLIER);"],"mappings":";;AAAA,CAAC;EAAA,OAAM,EAAN;AAAA,CAAD,E,CAEA;;;ACFAA,GAAG,CAACC,GAAJ,CAAQ,UAAAC,CAAC;EAAA,OAAIA,CAAC,GAAGC,UAAR;AAAA,CAAT"}
\ No newline at end of file
+{"version":3,"file":"script3.js","names":["arr","map","x","MULTIPLIER"],"sources":["script.js","script2.js"],"sourcesContent":["(() => 42)\n\n// some comments","arr.map(x => x * MULTIPLIER);"],"mappings":";;AAAA,CAAC;EAAA,OAAM,EAAE;AAAA,GAAC,CAEV;;;ACFAA,GAAG,CAACC,GAAG,CAAC,UAAAC,CAAC;EAAA,OAAIA,CAAC,GAAGC,UAAU;AAAA,EAAC"}
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/stdin --out-file --source-maps/out-files/test.js.map b/packages/babel-cli/test/fixtures/babel/stdin --out-file --source-maps/out-files/test.js.map
index e0a6d6c85f4a..f2513784d3e8 100644
--- a/packages/babel-cli/test/fixtures/babel/stdin --out-file --source-maps/out-files/test.js.map
+++ b/packages/babel-cli/test/fixtures/babel/stdin --out-file --source-maps/out-files/test.js.map
@@ -1 +1 @@
-{"version":3,"file":"test.js","names":["arr","map","x"],"sources":["stdin"],"sourcesContent":["arr.map(x => x * x);"],"mappings":";;AAAAA,GAAG,CAACC,GAAJ,CAAQ,UAAAC,CAAC;EAAA,OAAIA,CAAC,GAAGA,CAAR;AAAA,CAAT"}
\ No newline at end of file
+{"version":3,"file":"test.js","names":["arr","map","x"],"sources":["stdin"],"sourcesContent":["arr.map(x => x * x);"],"mappings":";;AAAAA,GAAG,CAACC,GAAG,CAAC,UAAAC,CAAC;EAAA,OAAIA,CAAC,GAAGA,CAAC;AAAA,EAAC"}
\ No newline at end of file
diff --git a/packages/babel-cli/test/fixtures/babel/stdin --source-maps inline/stdout.txt b/packages/babel-cli/test/fixtures/babel/stdin --source-maps inline/stdout.txt
index db57d03f3c0a..3b81510c3fbd 100644
--- a/packages/babel-cli/test/fixtures/babel/stdin --source-maps inline/stdout.txt
+++ b/packages/babel-cli/test/fixtures/babel/stdin --source-maps inline/stdout.txt
@@ -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
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/full/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/full/source-map.json
index b5dfb95a4e3f..fb099c40af8d 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/full/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/full/source-map.json
@@ -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"
}
\ No newline at end of file
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/inline/output.js b/packages/babel-core/test/fixtures/transformation/source-maps/inline/output.js
index 5b37b2b86a1d..0ff1eab8b6ca 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/inline/output.js
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/inline/output.js
@@ -1,4 +1,4 @@
arr.map(function (x) {
return x * x;
});
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJhcnIiLCJtYXAiLCJ4Il0sInNvdXJjZXMiOlsic291cmNlLW1hcHMvaW5saW5lL2lucHV0LmpzIl0sInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogeCk7Il0sIm1hcHBpbmdzIjoiQUFBQUEsR0FBRyxDQUFDQyxHQUFKLENBQVEsVUFBQUMsQ0FBQztFQUFBLE9BQUlBLENBQUMsR0FBR0EsQ0FBUjtBQUFBLENBQVQifQ==
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJhcnIiLCJtYXAiLCJ4Il0sInNvdXJjZXMiOlsic291cmNlLW1hcHMvaW5saW5lL2lucHV0LmpzIl0sInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogeCk7Il0sIm1hcHBpbmdzIjoiQUFBQUEsR0FBRyxDQUFDQyxHQUFHLENBQUMsVUFBQUMsQ0FBQztFQUFBLE9BQUlBLENBQUMsR0FBR0EsQ0FBQztBQUFBLEVBQUMifQ==
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-map.json
index 24e9b62b706d..f37e715c9e79 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-map.json
@@ -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",
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-mappings.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-mappings.json
index fe0fa3321505..f41b80a82318 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-mappings.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-mappings.json
@@ -55,7 +55,7 @@
"column": 4
},
"original": {
- "line": 90,
+ "line": 92,
"column": 0
}
},
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json
index 748a24a3a8b6..1b9392bc5377 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json
@@ -1,7 +1,11 @@
{
- "mappings": "AAAA,UAAU,Y;SAAM;AAAC,CAAjB",
+ "version": 3,
+ "mappings": "AAAA,UAAU,Y;SAAM,C;CAAC",
"names": [],
- "sources": ["original.js"],
- "sourcesContent": ["var foo = () => 4;"],
- "version": 3
-}
+ "sources": [
+ "original.js"
+ ],
+ "sourcesContent": [
+ "var foo = () => 4;"
+ ]
+}
\ No newline at end of file
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources-complete-replace/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources-complete-replace/source-map.json
index 81a440f3e2b8..050799fd70f9 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources-complete-replace/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources-complete-replace/source-map.json
@@ -1,15 +1,13 @@
{
"version": 3,
- "mappings": "AAAC,KCAD;ACAA,K",
+ "mappings": "AAAC,KAAG;ACAJ,KAAG",
"names": [],
"sources": [
"bar.js",
- "input.tsx",
"baz.js"
],
"sourcesContent": [
"",
- "foo(1);\nfunction foo(bar: number): never {\n throw new Error('Intentional.');\n}",
"baz();"
]
}
\ No newline at end of file
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources/source-map.json
index 0c76c1a5ef2f..5e932eee0d4c 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources/source-map.json
@@ -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",
"names": [
"foo",
"bar",
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-same-location/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-same-location/source-map.json
index f538878eed17..0dde70b60b7c 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-same-location/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-same-location/source-map.json
@@ -1,7 +1,11 @@
{
- "mappings": "AAAA,UAAU,Y;SAAM;AAAC,CAAjB",
+ "version": 3,
+ "mappings": "AAAA,UAAU,Y;SAAM,C;CAAC",
"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;"
+ ]
+}
\ No newline at end of file
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-sources-complete-replace/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-sources-complete-replace/source-map.json
index c58a997a828d..4a26e2136a38 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-sources-complete-replace/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-sources-complete-replace/source-map.json
@@ -1,13 +1,11 @@
{
"version": 3,
- "mappings": "AAAC,KCAD",
+ "mappings": "AAAC,KAAG",
"names": [],
"sources": [
- "test.js",
- "input.tsx"
+ "test.js"
],
"sourcesContent": [
- "",
- "foo(1);\nfunction foo(bar: number): never {\n throw new Error('Intentional.');\n}"
+ ""
]
}
\ No newline at end of file
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json
index 748a24a3a8b6..1b9392bc5377 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json
@@ -1,7 +1,11 @@
{
- "mappings": "AAAA,UAAU,Y;SAAM;AAAC,CAAjB",
+ "version": 3,
+ "mappings": "AAAA,UAAU,Y;SAAM,C;CAAC",
"names": [],
- "sources": ["original.js"],
- "sourcesContent": ["var foo = () => 4;"],
- "version": 3
-}
+ "sources": [
+ "original.js"
+ ],
+ "sourcesContent": [
+ "var foo = () => 4;"
+ ]
+}
\ No newline at end of file
diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/interpreter-directive-prefix/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/interpreter-directive-prefix/source-map.json
index cb9c3ee27571..959b94b15038 100644
--- a/packages/babel-core/test/fixtures/transformation/source-maps/interpreter-directive-prefix/source-map.json
+++ b/packages/babel-core/test/fixtures/transformation/source-maps/interpreter-directive-prefix/source-map.json
@@ -1,5 +1,5 @@
{
- "mappings": "AAAA;AAEAA,OAAO,CAACC,GAAR,CAAY,eAAZ",
+ "version": 3,
"names": [
"console",
"log"
@@ -10,5 +10,5 @@
"sourcesContent": [
"#!env node\n\nconsole.log(\"Hello, world!\");"
],
- "version": 3
-}
+ "mappings": "AAAA;AAEAA,OAAO,CAACC,GAAG,CAAC,eAAe,CAAC"
+}
\ No newline at end of file
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/call-identifiers/options.json b/packages/babel-generator/test/fixtures/sourcemaps/call-identifiers/options.json
new file mode 100644
index 000000000000..381b90bf7391
--- /dev/null
+++ b/packages/babel-generator/test/fixtures/sourcemaps/call-identifiers/options.json
@@ -0,0 +1,4 @@
+{
+ "plugins": ["typescript"],
+ "sourceMaps": true
+}
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/call-identifiers/source-map.json b/packages/babel-generator/test/fixtures/sourcemaps/call-identifiers/source-map.json
index 31627242a891..912ec14f6d8a 100644
--- a/packages/babel-generator/test/fixtures/sourcemaps/call-identifiers/source-map.json
+++ b/packages/babel-generator/test/fixtures/sourcemaps/call-identifiers/source-map.json
@@ -11,5 +11,5 @@
"sourcesContent": [
"foo;\nfoo();\nfoo().bar;\nobj.foo;\nobj.foo();\nobj.foo.bar;\nobj.foo().bar;\n{\n foo;\n foo();\n foo().bar;\n obj.foo;\n obj.foo();\n obj.foo.bar;\n obj.foo().bar;\n}"
],
- "mappings": "AAAAA,GAAG;AACHA,GAAG;AACHA,GAAG,GAAGC,GAAN;AACAC,GAAG,CAACF,GAAJ;AACAE,GAAG,CAACF,GAAJ;AACAE,GAAG,CAACF,GAAJ,CAAQC,GAAR;AACAC,GAAG,CAACF,GAAJ,GAAUC,GAAV;AACA;EACED,GAAG;EACHA,GAAG;EACHA,GAAG,GAAGC,GAAN;EACAC,GAAG,CAACF,GAAJ;EACAE,GAAG,CAACF,GAAJ;EACAE,GAAG,CAACF,GAAJ,CAAQC,GAAR;EACAC,GAAG,CAACF,GAAJ,GAAUC,GAAV;AACD"
+ "mappings": "AAAAA,GAAG;AACHA,GAAG,EAAE;AACLA,GAAG,EAAE,CAACC,GAAG;AACTC,GAAG,CAACF,GAAG;AACPE,GAAG,CAACF,GAAG,EAAE;AACTE,GAAG,CAACF,GAAG,CAACC,GAAG;AACXC,GAAG,CAACF,GAAG,EAAE,CAACC,GAAG;AACb;EACED,GAAG;EACHA,GAAG,EAAE;EACLA,GAAG,EAAE,CAACC,GAAG;EACTC,GAAG,CAACF,GAAG;EACPE,GAAG,CAACF,GAAG,EAAE;EACTE,GAAG,CAACF,GAAG,CAACC,GAAG;EACXC,GAAG,CAACF,GAAG,EAAE,CAACC,GAAG;AACf"
}
\ No newline at end of file
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/input.ts b/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/input.ts
new file mode 100644
index 000000000000..14e63c070ab0
--- /dev/null
+++ b/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/input.ts
@@ -0,0 +1,168 @@
+// From packages\babel-cli\src\babel\watcher.ts
+
+import { createRequire } from "module";
+import path from "path";
+import type { WatchOptions, FSWatcher } from "chokidar";
+
+const fileToDeps = new Map>();
+const depToFiles = new Map>();
+
+let isWatchMode = false;
+let watcher: FSWatcher;
+const watchQueue = new Set();
+let hasStarted = false;
+
+export function enable({ enableGlobbing }: { enableGlobbing: boolean }) {
+ isWatchMode = true;
+
+ const { FSWatcher } = requireChokidar();
+
+ const options: WatchOptions = {
+ disableGlobbing: !enableGlobbing,
+ persistent: true,
+ ignoreInitial: true,
+ awaitWriteFinish: {
+ stabilityThreshold: 50,
+ pollInterval: 10,
+ },
+ };
+ watcher = new FSWatcher(options);
+
+ watcher.on("unlink", unwatchFile);
+}
+
+export function startWatcher() {
+ hasStarted = true;
+
+ for (const dep of watchQueue) {
+ watcher.add(dep);
+ }
+ watchQueue.clear();
+
+ watcher.on("ready", () => {
+ console.log("The watcher is ready.");
+ });
+}
+
+export function watch(filename: string): void {
+ if (!isWatchMode) {
+ throw new Error(
+ "Internal Babel error: .watch called when not in watch mode.",
+ );
+ }
+
+ if (!hasStarted) {
+ watchQueue.add(path.resolve(filename));
+ } else {
+ watcher.add(path.resolve(filename));
+ }
+}
+
+/**
+ * Call @param callback whenever a dependency (source file)/
+ * external dependency (non-source file) changes.
+ *
+ * Handles mapping external dependencies to their corresponding
+ * dependencies.
+ */
+export function onFilesChange(
+ callback: (filenames: string[], event: string, cause: string) => void,
+): void {
+ if (!isWatchMode) {
+ throw new Error(
+ "Internal Babel error: .onFilesChange called when not in watch mode.",
+ );
+ }
+
+ watcher.on("all", (event, filename) => {
+ if (event !== "change" && event !== "add") return;
+
+ const absoluteFile = path.resolve(filename);
+ callback(
+ [absoluteFile, ...(depToFiles.get(absoluteFile) ?? [])],
+ event,
+ absoluteFile,
+ );
+ });
+}
+
+export function updateExternalDependencies(
+ filename: string,
+ dependencies: Set,
+) {
+ if (!isWatchMode) return;
+
+ // Use absolute paths
+ const absFilename = path.resolve(filename);
+ const absDependencies = new Set(
+ Array.from(dependencies, dep => path.resolve(dep)),
+ );
+
+ const deps = fileToDeps.get(absFilename);
+ if (deps) {
+ for (const dep of deps) {
+ if (!absDependencies.has(dep)) {
+ removeFileDependency(absFilename, dep);
+ }
+ }
+ }
+ for (const dep of absDependencies) {
+ let deps = depToFiles.get(dep);
+ if (!deps) {
+ depToFiles.set(dep, (deps = new Set()));
+
+ if (!hasStarted) {
+ watchQueue.add(dep);
+ } else {
+ watcher.add(dep);
+ }
+ }
+
+ deps.add(absFilename);
+ }
+
+ fileToDeps.set(absFilename, absDependencies);
+}
+
+function removeFileDependency(filename: string, dep: string) {
+ const deps = depToFiles.get(dep) as Set;
+ deps.delete(filename);
+
+ if (deps.size === 0) {
+ depToFiles.delete(dep);
+
+ if (!hasStarted) {
+ watchQueue.delete(dep);
+ } else {
+ watcher.unwatch(dep);
+ }
+ }
+}
+
+function unwatchFile(filename: string) {
+ const deps = fileToDeps.get(filename);
+ if (!deps) return;
+
+ for (const dep of deps) {
+ removeFileDependency(filename, dep);
+ }
+ fileToDeps.delete(filename);
+}
+
+function requireChokidar(): any {
+ const require = createRequire(import.meta.url);
+
+ try {
+ return process.env.BABEL_8_BREAKING
+ ? require("chokidar")
+ : parseInt(process.versions.node) >= 8
+ ? require("chokidar")
+ : require("@nicolo-ribaudo/chokidar-2");
+ } catch (err) {
+ console.error(
+ "The optional dependency chokidar failed to install and is required for " +
+ "--watch. Chokidar is likely not supported on your platform.",
+ );
+ throw err;
+ }
+}
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/options.json b/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/options.json
new file mode 100644
index 000000000000..381b90bf7391
--- /dev/null
+++ b/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/options.json
@@ -0,0 +1,4 @@
+{
+ "plugins": ["typescript"],
+ "sourceMaps": true
+}
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/output.js b/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/output.js
new file mode 100644
index 000000000000..9fdbf2c3f072
--- /dev/null
+++ b/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/output.js
@@ -0,0 +1,143 @@
+// From packages\babel-cli\src\babel\watcher.ts
+import { createRequire } from "module";
+import path from "path";
+import type { WatchOptions, FSWatcher } from "chokidar";
+const fileToDeps = new Map>();
+const depToFiles = new Map>();
+let isWatchMode = false;
+let watcher: FSWatcher;
+const watchQueue = new Set();
+let hasStarted = false;
+export function enable({
+ enableGlobbing
+}: {
+ enableGlobbing: boolean;
+}) {
+ isWatchMode = true;
+ const {
+ FSWatcher
+ } = requireChokidar();
+ const options: WatchOptions = {
+ disableGlobbing: !enableGlobbing,
+ persistent: true,
+ ignoreInitial: true,
+ awaitWriteFinish: {
+ stabilityThreshold: 50,
+ pollInterval: 10
+ }
+ };
+ watcher = new FSWatcher(options);
+ watcher.on("unlink", unwatchFile);
+}
+export function startWatcher() {
+ hasStarted = true;
+
+ for (const dep of watchQueue) {
+ watcher.add(dep);
+ }
+
+ watchQueue.clear();
+ watcher.on("ready", () => {
+ console.log("The watcher is ready.");
+ });
+}
+export function watch(filename: string): void {
+ if (!isWatchMode) {
+ throw new Error("Internal Babel error: .watch called when not in watch mode.");
+ }
+
+ if (!hasStarted) {
+ watchQueue.add(path.resolve(filename));
+ } else {
+ watcher.add(path.resolve(filename));
+ }
+}
+/**
+ * Call @param callback whenever a dependency (source file)/
+ * external dependency (non-source file) changes.
+ *
+ * Handles mapping external dependencies to their corresponding
+ * dependencies.
+ */
+
+export function onFilesChange(callback: (filenames: string[], event: string, cause: string) => void): void {
+ if (!isWatchMode) {
+ throw new Error("Internal Babel error: .onFilesChange called when not in watch mode.");
+ }
+
+ watcher.on("all", (event, filename) => {
+ if (event !== "change" && event !== "add") return;
+ const absoluteFile = path.resolve(filename);
+ callback([absoluteFile, ...(depToFiles.get(absoluteFile) ?? [])], event, absoluteFile);
+ });
+}
+export function updateExternalDependencies(filename: string, dependencies: Set) {
+ if (!isWatchMode) return; // Use absolute paths
+
+ const absFilename = path.resolve(filename);
+ const absDependencies = new Set(Array.from(dependencies, dep => path.resolve(dep)));
+ const deps = fileToDeps.get(absFilename);
+
+ if (deps) {
+ for (const dep of deps) {
+ if (!absDependencies.has(dep)) {
+ removeFileDependency(absFilename, dep);
+ }
+ }
+ }
+
+ for (const dep of absDependencies) {
+ let deps = depToFiles.get(dep);
+
+ if (!deps) {
+ depToFiles.set(dep, deps = new Set());
+
+ if (!hasStarted) {
+ watchQueue.add(dep);
+ } else {
+ watcher.add(dep);
+ }
+ }
+
+ deps.add(absFilename);
+ }
+
+ fileToDeps.set(absFilename, absDependencies);
+}
+
+function removeFileDependency(filename: string, dep: string) {
+ const deps = (depToFiles.get(dep) as Set);
+ deps.delete(filename);
+
+ if (deps.size === 0) {
+ depToFiles.delete(dep);
+
+ if (!hasStarted) {
+ watchQueue.delete(dep);
+ } else {
+ watcher.unwatch(dep);
+ }
+ }
+}
+
+function unwatchFile(filename: string) {
+ const deps = fileToDeps.get(filename);
+ if (!deps) return;
+
+ for (const dep of deps) {
+ removeFileDependency(filename, dep);
+ }
+
+ fileToDeps.delete(filename);
+}
+
+function requireChokidar(): any {
+ const require = createRequire(import.meta.url);
+
+ try {
+ return process.env.BABEL_8_BREAKING ? require("chokidar") : parseInt(process.versions.node) >= 8 ? require("chokidar") : require("@nicolo-ribaudo/chokidar-2");
+ } catch (err) {
+ console.error("The optional dependency chokidar failed to install and is required for " + "--watch. Chokidar is likely not supported on your platform.");
+ throw err;
+ }
+}
\ No newline at end of file
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/source-map.json b/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/source-map.json
new file mode 100644
index 000000000000..3648e38e3b22
--- /dev/null
+++ b/packages/babel-generator/test/fixtures/sourcemaps/real-world-babel-file1/source-map.json
@@ -0,0 +1,78 @@
+{
+ "version": 3,
+ "names": [
+ "createRequire",
+ "path",
+ "WatchOptions",
+ "FSWatcher",
+ "fileToDeps",
+ "Map",
+ "Set",
+ "depToFiles",
+ "isWatchMode",
+ "watcher",
+ "watchQueue",
+ "hasStarted",
+ "enable",
+ "enableGlobbing",
+ "requireChokidar",
+ "options",
+ "disableGlobbing",
+ "persistent",
+ "ignoreInitial",
+ "awaitWriteFinish",
+ "stabilityThreshold",
+ "pollInterval",
+ "on",
+ "unwatchFile",
+ "startWatcher",
+ "dep",
+ "add",
+ "clear",
+ "console",
+ "log",
+ "watch",
+ "filename",
+ "Error",
+ "resolve",
+ "onFilesChange",
+ "callback",
+ "filenames",
+ "event",
+ "cause",
+ "absoluteFile",
+ "get",
+ "updateExternalDependencies",
+ "dependencies",
+ "absFilename",
+ "absDependencies",
+ "Array",
+ "from",
+ "deps",
+ "has",
+ "removeFileDependency",
+ "set",
+ "delete",
+ "size",
+ "unwatch",
+ "require",
+ "import",
+ "meta",
+ "url",
+ "process",
+ "env",
+ "BABEL_8_BREAKING",
+ "parseInt",
+ "versions",
+ "node",
+ "err",
+ "error"
+ ],
+ "sources": [
+ "fixtures/sourcemaps/real-world-babel-file1/input.ts"
+ ],
+ "sourcesContent": [
+ "// From packages\\babel-cli\\src\\babel\\watcher.ts\n\nimport { createRequire } from \"module\";\nimport path from \"path\";\nimport type { WatchOptions, FSWatcher } from \"chokidar\";\n\nconst fileToDeps = new Map>();\nconst depToFiles = new Map>();\n\nlet isWatchMode = false;\nlet watcher: FSWatcher;\nconst watchQueue = new Set();\nlet hasStarted = false;\n\nexport function enable({ enableGlobbing }: { enableGlobbing: boolean }) {\n isWatchMode = true;\n\n const { FSWatcher } = requireChokidar();\n\n const options: WatchOptions = {\n disableGlobbing: !enableGlobbing,\n persistent: true,\n ignoreInitial: true,\n awaitWriteFinish: {\n stabilityThreshold: 50,\n pollInterval: 10,\n },\n };\n watcher = new FSWatcher(options);\n\n watcher.on(\"unlink\", unwatchFile);\n}\n\nexport function startWatcher() {\n hasStarted = true;\n\n for (const dep of watchQueue) {\n watcher.add(dep);\n }\n watchQueue.clear();\n\n watcher.on(\"ready\", () => {\n console.log(\"The watcher is ready.\");\n });\n}\n\nexport function watch(filename: string): void {\n if (!isWatchMode) {\n throw new Error(\n \"Internal Babel error: .watch called when not in watch mode.\",\n );\n }\n\n if (!hasStarted) {\n watchQueue.add(path.resolve(filename));\n } else {\n watcher.add(path.resolve(filename));\n }\n}\n\n/**\n * Call @param callback whenever a dependency (source file)/\n * external dependency (non-source file) changes.\n *\n * Handles mapping external dependencies to their corresponding\n * dependencies.\n */\nexport function onFilesChange(\n callback: (filenames: string[], event: string, cause: string) => void,\n): void {\n if (!isWatchMode) {\n throw new Error(\n \"Internal Babel error: .onFilesChange called when not in watch mode.\",\n );\n }\n\n watcher.on(\"all\", (event, filename) => {\n if (event !== \"change\" && event !== \"add\") return;\n\n const absoluteFile = path.resolve(filename);\n callback(\n [absoluteFile, ...(depToFiles.get(absoluteFile) ?? [])],\n event,\n absoluteFile,\n );\n });\n}\n\nexport function updateExternalDependencies(\n filename: string,\n dependencies: Set,\n) {\n if (!isWatchMode) return;\n\n // Use absolute paths\n const absFilename = path.resolve(filename);\n const absDependencies = new Set(\n Array.from(dependencies, dep => path.resolve(dep)),\n );\n\n const deps = fileToDeps.get(absFilename);\n if (deps) {\n for (const dep of deps) {\n if (!absDependencies.has(dep)) {\n removeFileDependency(absFilename, dep);\n }\n }\n }\n for (const dep of absDependencies) {\n let deps = depToFiles.get(dep);\n if (!deps) {\n depToFiles.set(dep, (deps = new Set()));\n\n if (!hasStarted) {\n watchQueue.add(dep);\n } else {\n watcher.add(dep);\n }\n }\n\n deps.add(absFilename);\n }\n\n fileToDeps.set(absFilename, absDependencies);\n}\n\nfunction removeFileDependency(filename: string, dep: string) {\n const deps = depToFiles.get(dep) as Set;\n deps.delete(filename);\n\n if (deps.size === 0) {\n depToFiles.delete(dep);\n\n if (!hasStarted) {\n watchQueue.delete(dep);\n } else {\n watcher.unwatch(dep);\n }\n }\n}\n\nfunction unwatchFile(filename: string) {\n const deps = fileToDeps.get(filename);\n if (!deps) return;\n\n for (const dep of deps) {\n removeFileDependency(filename, dep);\n }\n fileToDeps.delete(filename);\n}\n\nfunction requireChokidar(): any {\n const require = createRequire(import.meta.url);\n\n try {\n return process.env.BABEL_8_BREAKING\n ? require(\"chokidar\")\n : parseInt(process.versions.node) >= 8\n ? require(\"chokidar\")\n : require(\"@nicolo-ribaudo/chokidar-2\");\n } catch (err) {\n console.error(\n \"The optional dependency chokidar failed to install and is required for \" +\n \"--watch. Chokidar is likely not supported on your platform.\",\n );\n throw err;\n }\n}"
+ ],
+ "mappings": "AAAA;AAEA,SAASA,aAAa,QAAQ,QAAQ;AACtC,OAAOC,IAAI,MAAM,MAAM;AACvB,cAAcC,YAAY,EAAEC,SAAS,QAAQ,UAAU;AAEvD,MAAMC,UAAU,GAAG,IAAIC,GAAG,CA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;MACLhB,OAAO,CAAC4C,OAAO,CAAC5B,GAAG,CAAC;IACtB;EACF;AACF;;AAEA,SAASF,WAAW,CAACQ,QAAQ,EAAE,MAAM,EAAE;EACrC,MAAMgB,IAAI,GAAG3C,UAAU,CAACoC,GAAG,CAACT,QAAQ,CAAC;EACrC,IAAI,CAACgB,IAAI,EAAE;;EAEX,KAAK,MAAMtB,GAAG,IAAIsB,IAAI,EAAE;IACtBE,oBAAoB,CAAClB,QAAQ,EAAEN,GAAG,CAAC;EACrC;;EACArB,UAAU,CAAC+C,MAAM,CAACpB,QAAQ,CAAC;AAC7B;;AAEA,SAASjB,eAAe,EAAE,EAAE,GAAG,CAAC;EAC9B,MAAMwC,OAAO,GAAGtD,aAAa,CAACuD,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;;EAE9C,IAAI;IACF,OAAOC,OAAO,CAACC,GAAG,CAACC,gBAAgB,GAC/BN,OAAO,CAAC,UAAU,CAAC,GACnBO,QAAQ,CAACH,OAAO,CAACI,QAAQ,CAACC,IAAI,CAAC,IAAI,CAAC,GACpCT,OAAO,CAAC,UAAU,CAAC,GACnBA,OAAO,CAAC,4BAA4B,CAAC;EAC3C,CAAC,CAAC,OAAOU,GAAG,EAAE;IACZpC,OAAO,CAACqC,KAAK,CACX,yEAAyE,GACvE,6DAA6D,CAChE;IACD,MAAMD,GAAG;EACX;AACF"
+}
\ No newline at end of file
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/options.json b/packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/options.json
new file mode 100644
index 000000000000..381b90bf7391
--- /dev/null
+++ b/packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/options.json
@@ -0,0 +1,4 @@
+{
+ "plugins": ["typescript"],
+ "sourceMaps": true
+}
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/source-map.json b/packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/source-map.json
index b2fc354d8f32..3878c17e0fca 100644
--- a/packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/source-map.json
+++ b/packages/babel-generator/test/fixtures/sourcemaps/string-literal-newline/source-map.json
@@ -1,9 +1,11 @@
{
- "mappings": "AAAA;AACA,MADA;AAGA;AACA;AACA,MAFA",
+ "version": 3,
"names": [],
- "sources": ["fixtures/sourcemaps/string-literal-newline/input.js"],
+ "sources": [
+ "fixtures/sourcemaps/string-literal-newline/input.js"
+ ],
"sourcesContent": [
"\"before\\\nafter\";\n\n\"before\\\n\\\nafter\";"
],
- "version": 3
-}
+ "mappings": "AAAA;AACA,MAAM;AAEN;AACA;AACA,MAAM"
+}
\ No newline at end of file
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/options.json b/packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/options.json
new file mode 100644
index 000000000000..381b90bf7391
--- /dev/null
+++ b/packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/options.json
@@ -0,0 +1,4 @@
+{
+ "plugins": ["typescript"],
+ "sourceMaps": true
+}
diff --git a/packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/source-map.json b/packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/source-map.json
index 083336baf672..13f42974df3d 100644
--- a/packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/source-map.json
+++ b/packages/babel-generator/test/fixtures/sourcemaps/template-literal-newline/source-map.json
@@ -1,9 +1,11 @@
{
- "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",
+ "version": 3,
"names": [],
- "sources": ["fixtures/sourcemaps/template-literal-newline/input.js"],
+ "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
-}
+ "mappings": "AAAA;AACC;AACD,MAAM,CAAC,CAEP;;AACC;AACD;AACA,MAAM,CAAC,CAEP;;AACC;AACD;AACA,MAAM,CAAC,CAEP;;AACC;AACD,MAAM,CAAC,CAEP;;AACC;AACD;AACA,MAAM,CAAC,CAEP;;AACC;AACD;AACA,MAAM"
+}
\ No newline at end of file
diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js
index b32847f2cdfe..6d167346a957 100644
--- a/packages/babel-generator/test/index.js
+++ b/packages/babel-generator/test/index.js
@@ -41,7 +41,7 @@ describe("generation", function () {
version: 3,
sources: ["a.js", "b.js"],
mappings:
- "AAAA,SAASA,EAAT,CAAaC,GAAb,EAAkB;EAAEC,OAAO,CAACC,GAAR,CAAYF,GAAZ;AAAmB;;ACAvCD,EAAE,CAAC,OAAD,CAAF",
+ "AAAA,SAASA,EAAE,CAAEC,GAAG,EAAE;EAAEC,OAAO,CAACC,GAAG,CAACF,GAAG,CAAC;AAAE;;ACAtCD,EAAE,CAAC,OAAO,CAAC",
names: ["hi", "msg", "console", "log"],
sourcesContent: [
"function hi (msg) { console.log(msg); }\n",
@@ -69,7 +69,7 @@ describe("generation", function () {
name: undefined,
generated: { line: 1, column: 11 },
source: "a.js",
- original: { line: 1, column: 0 },
+ original: { line: 1, column: 11 },
},
{
name: "msg",
@@ -81,7 +81,7 @@ describe("generation", function () {
name: undefined,
generated: { line: 1, column: 15 },
source: "a.js",
- original: { line: 1, column: 0 },
+ original: { line: 1, column: 16 },
},
{
name: undefined,
@@ -111,7 +111,7 @@ describe("generation", function () {
name: undefined,
generated: { line: 2, column: 13 },
source: "a.js",
- original: { line: 1, column: 20 },
+ original: { line: 1, column: 31 },
},
{
name: "msg",
@@ -123,13 +123,19 @@ describe("generation", function () {
name: undefined,
generated: { line: 2, column: 17 },
source: "a.js",
- original: { line: 1, column: 20 },
+ original: { line: 1, column: 35 },
+ },
+ {
+ name: undefined,
+ generated: { line: 2, column: 18 },
+ source: "a.js",
+ original: { line: 1, column: 36 },
},
{
name: undefined,
generated: { line: 3, column: 0 },
source: "a.js",
- original: { line: 1, column: 39 },
+ original: { line: 1, column: 38 },
},
{
name: "hi",
@@ -153,13 +159,13 @@ describe("generation", function () {
name: undefined,
generated: { line: 5, column: 10 },
source: "b.js",
- original: { line: 1, column: 2 },
+ original: { line: 1, column: 10 },
},
{
name: undefined,
generated: { line: 5, column: 11 },
source: "b.js",
- original: { line: 1, column: 0 },
+ original: { line: 1, column: 11 },
},
],
"raw mappings were incorrectly generated",
@@ -199,7 +205,7 @@ describe("generation", function () {
version: 3,
sources: ["inline"],
names: ["foo", "bar"],
- mappings: "AAAA,SAASA,IAAT,GAAe;EAAEC,IAAG;AAAG",
+ mappings: "AAAA,SAASA,IAAG,GAAG;EAAEC,IAAG;AAAE",
sourcesContent: ["function foo() { bar; }\n"],
},
"sourcemap was incorrectly generated",
@@ -223,7 +229,7 @@ describe("generation", function () {
name: undefined,
generated: { line: 1, column: 13 },
source: "inline",
- original: { line: 1, column: 0 },
+ original: { line: 1, column: 12 },
},
{
name: undefined,
@@ -247,7 +253,7 @@ describe("generation", function () {
name: undefined,
generated: { line: 3, column: 0 },
source: "inline",
- original: { line: 1, column: 23 },
+ original: { line: 1, column: 22 },
},
],
"raw mappings were incorrectly generated",
@@ -844,7 +850,7 @@ suites.forEach(function (testSuite) {
try {
expect(result.map).toEqual(task.sourceMap);
} catch (e) {
- if (!process.env.OVERWRITE || !task.sourceMapFile) throw e;
+ if (!process.env.OVERWRITE && task.sourceMap) throw e;
console.log(`Updated test file: ${task.sourceMapFile.loc}`);
fs.writeFileSync(
task.sourceMapFile.loc,
diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/source-mappings.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/source-mappings.json
index 47777660b580..c3b1a71b09c2 100644
--- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/source-mappings.json
+++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/source-mappings.json
@@ -1,43 +1,62 @@
-[{
- "original": {
- "line": 6, "column": 0
+[
+ {
+ "original": {
+ "line": 6,
+ "column": 0
+ },
+ "generated": {
+ "line": 4,
+ "column": 0
+ }
},
- "generated": {
- "line": 4, "column": 0
- }
-},{
- "original": {
- "line": 6, "column": 0
- },
- "generated": {
- "line": 4, "column": 12
- }
-},{
- "original": {
- "line": 8, "column": 0
+ {
+ "original": {
+ "line": 6,
+ "column": 3
+ },
+ "generated": {
+ "line": 4,
+ "column": 12
+ }
},
- "generated": {
- "line": 6, "column": 0
- }
-},{
- "original": {
- "line": 8, "column": 0
+ {
+ "original": {
+ "line": 8,
+ "column": 0
+ },
+ "generated": {
+ "line": 6,
+ "column": 3
+ }
},
- "generated": {
- "line": 6, "column": 9
- }
-},{
- "original": {
- "line": 9, "column": 0
+ {
+ "original": {
+ "line": 8,
+ "column": 4
+ },
+ "generated": {
+ "line": 6,
+ "column": 9
+ }
},
- "generated": {
- "line": 7, "column": 0
- }
-},{
- "original": {
- "line": 9, "column": 0
+ {
+ "original": {
+ "line": 9,
+ "column": 0
+ },
+ "generated": {
+ "line": 7,
+ "column": 0
+ }
},
- "generated": {
- "line": 7, "column": 9
+ {
+ "original": {
+ "line": 9,
+ "column": 0
+ },
+ "generated": {
+ "line": 7,
+ "column": 9
+ }
}
-}]
+]