Merge pull request #3451 from loganfsmyth/sourcemap-no-source
Handle input source mappings with no original location.
This commit is contained in:
commit
9cfb8cb172
@ -43,9 +43,9 @@ module.exports = function (commander, filenames, opts) {
|
||||
map._mappings.add({
|
||||
generatedLine: mapping.generatedLine + offset,
|
||||
generatedColumn: mapping.generatedColumn,
|
||||
originalLine: mapping.originalLine,
|
||||
originalColumn: mapping.originalColumn,
|
||||
source: sourceFilename
|
||||
originalLine: mapping.source == null ? null : mapping.originalLine,
|
||||
originalColumn: mapping.source == null ? null : mapping.originalColumn,
|
||||
source: mapping.source == null ? null : sourceFilename
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"inlineSourceMap": true
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
var foo = function () {
|
||||
return 4;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9yaWdpbmFsLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFVBQVUsWTtTQUFNLEM7Q0FBQyIsInNvdXJjZXNDb250ZW50IjpbInZhciBmb28gPSAoKSA9PiA0OyJdfQ==
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["script.js", "--source-maps", "inline", "--out-file", "script2.js"]
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var foo = function foo() {
|
||||
return 4;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBO1MsQUFBZ0IsQUFBQyxFO0NBQVAiLCJmaWxlIjoic2NyaXB0Mi5qcyIsInNvdXJjZXNDb250ZW50IjpbInZhciBmb28gPSBmdW5jdGlvbiAoKSB7XG4gIHJldHVybiA0O1xufTtcblxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZGF0YTphcHBsaWNhdGlvbi9qc29uO2Jhc2U2NCxleUoyWlhKemFXOXVJam96TENKemIzVnlZMlZ6SWpwYkltOXlhV2RwYm1Gc0xtcHpJbDBzSW01aGJXVnpJanBiWFN3aWJXRndjR2x1WjNNaU9pSkJRVUZCTEZWQlFWVXNXVHRUUVVGTkxFTTdRMEZCUXlJc0luTnZkWEpqWlhORGIyNTBaVzUwSWpwYkluWmhjaUJtYjI4Z1BTQW9LU0E5UGlBME95SmRmUT09Il19
|
||||
@ -391,7 +391,7 @@ export default class File extends Store {
|
||||
mergedGenerator.addMapping({
|
||||
source: mapping.source,
|
||||
|
||||
original: {
|
||||
original: mapping.source == null ? null : {
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn
|
||||
},
|
||||
|
||||
5
packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/actual.js
vendored
Normal file
5
packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/actual.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
var foo = function () {
|
||||
return 4;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9yaWdpbmFsLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFVBQVUsWTtTQUFNLEM7Q0FBQyIsInNvdXJjZXNDb250ZW50IjpbInZhciBmb28gPSAoKSA9PiA0OyJdfQ==
|
||||
3
packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/expected.js
vendored
Normal file
3
packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/expected.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
var foo = function () {
|
||||
return 4;
|
||||
};
|
||||
3
packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/options.json
vendored
Normal file
3
packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"inputSourceMap": true
|
||||
}
|
||||
11
packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json
vendored
Normal file
11
packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 3,
|
||||
"mappings": "AAAA;SAAgB,A,AAAC,E;CAAP",
|
||||
"names": [],
|
||||
"sources": [
|
||||
"original.js"
|
||||
],
|
||||
"sourcesContent": [
|
||||
"var foo = () => 4;"
|
||||
]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user