Skip to content

Commit 6de6d58

Browse files
authored
fix: source maps for manually added multi-line content (#15365)
Fixes #15363
1 parent 112169c commit 6de6d58

27 files changed

Lines changed: 82 additions & 23 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"sourceMap": "inline"
3-
}
2+
"sourceMaps": "inline"
3+
}

packages/babel-core/test/fixtures/transformation/source-maps/add-multi-line-comments/index.js.map

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
line1
3+
line2
4+
*/
5+
const myConst = 'ANY CODE OR NO CODE AT ALL';
6+
export { myConst };
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sourceType": "module",
3+
"inputSourceMap": true,
4+
"plugins": ["./plugin.js"]
5+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*line1
2+
line2*/
3+
/*
4+
line1
5+
line2
6+
*/
7+
const myConst = 'ANY CODE OR NO CODE AT ALL';
8+
export { myConst };
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = function () {
2+
return {
3+
visitor: {
4+
Program(path) {
5+
path.addComment("leading", "line1\nline2");
6+
},
7+
},
8+
};
9+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 3,
3+
"names": [
4+
"myConst"
5+
],
6+
"sources": [
7+
"source-maps/add-multi-line-comments/input.js"
8+
],
9+
"sourcesContent": [
10+
"/*\nline1\nline2\n*/\nconst myConst = 'ANY CODE OR NO CODE AT ALL';\nexport { myConst };"
11+
],
12+
"mappings": ";;AAAA;AACA;AACA;AACA;AACA,MAAMA,OAAO,GAAG,4BAA4B;AAC5C,SAASA,OAAO"
13+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"plugins": ["transform-arrow-functions", "transform-function-name"],
3-
"sourceMap": true
3+
"sourceMaps": true
44
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"plugins": ["transform-classes", "transform-block-scoping"],
3-
"sourceMap": true
3+
"sourceMaps": true
44
}

packages/babel-core/test/fixtures/transformation/source-maps/class/source-map.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"sourcesContent": [
1313
"class Test {\n get bar() {\n throw new Error(\"wow\");\n }\n}\n\nvar test = new Test;\ntest.bar;"
1414
],
15-
"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"
15+
"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"
1616
}

0 commit comments

Comments
 (0)