-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There were a few issues in the old code: 1. UTF-8 maps 1-3 bytes into 1 UTF-16 char, but 4 bytes into 2 UTF-16 chars 2. The starting offset was not recorded when we end the `multibyte_chars` iteration 3. The `mappings` can be unordered, meaning we need to restart UTF-16 offset calculation
- Loading branch information
1 parent
8bee06f
commit a4b8c38
Showing
10 changed files
with
186 additions
and
30 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
crates/swc/tests/fixture/sourcemap/issue-6552/input-map/input/.swcrc
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,20 @@ | ||
{ | ||
"sourceMaps": true, | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es5", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"minify": true, | ||
"isModule": true | ||
} |
4 changes: 4 additions & 0 deletions
4
crates/swc/tests/fixture/sourcemap/issue-6552/input-map/input/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
crates/swc/tests/fixture/sourcemap/issue-6552/input-map/output/index.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 @@ | ||
"use strict";var xxx=", something";console.error("❌ ".concat(message));var bbb=""; |
17 changes: 17 additions & 0 deletions
17
crates/swc/tests/fixture/sourcemap/issue-6552/input-map/output/index.map
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 @@ | ||
{ | ||
"mappings": "AAAA,aAAA,IAAMA,IAAM,cACZC,QAAQC,KAAK,CAAC,AAAC,KAAa,OAARC,UACpB,IAAMC,IAAM", | ||
"names": [ | ||
"xxx", | ||
"console", | ||
"error", | ||
"message", | ||
"bbb" | ||
], | ||
"sources": [ | ||
"../../input/index.js" | ||
], | ||
"sourcesContent": [ | ||
"const xxx = ', something';\nconsole.error(`❌ ${message}`);\nconst bbb = '';\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJ4eHgiLCJjb25zb2xlIiwiZXJyb3IiLCJtZXNzYWdlIiwiYmJiIl0sInNvdXJjZXMiOlsidW5rbm93biJdLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCB4eHggPSAnLCBzb21ldGhpbmcnXG5jb25zb2xlLmVycm9yKGDinYwgJHttZXNzYWdlfWApO1xuXG5jb25zdCBiYmIgPSAnJ1xuIl0sIm1hcHBpbmdzIjoiQUFBQSxNQUFNQSxHQUFHLEdBQUcsYUFBWjtBQUNBQyxPQUFPLENBQUNDLEtBQVIsQ0FBZSxLQUFJQyxPQUFRLEVBQTNCO0FBRUEsTUFBTUMsR0FBRyxHQUFHLEVBQVoifQ==\n" | ||
], | ||
"version": 3 | ||
} |
20 changes: 20 additions & 0 deletions
20
crates/swc/tests/fixture/sourcemap/issue-6552/no-map/input/.swcrc
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,20 @@ | ||
{ | ||
"sourceMaps": true, | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es5", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"minify": true, | ||
"isModule": true | ||
} |
4 changes: 4 additions & 0 deletions
4
crates/swc/tests/fixture/sourcemap/issue-6552/no-map/input/index.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 @@ | ||
const xxx = ', something' | ||
console.error(`❌ ${message}`); | ||
|
||
const bbb = '' |
1 change: 1 addition & 0 deletions
1
crates/swc/tests/fixture/sourcemap/issue-6552/no-map/output/index.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 @@ | ||
"use strict";var xxx=", something";console.error("❌ ".concat(message));var bbb=""; |
17 changes: 17 additions & 0 deletions
17
crates/swc/tests/fixture/sourcemap/issue-6552/no-map/output/index.map
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 @@ | ||
{ | ||
"mappings": "AAAA,aAAA,IAAMA,IAAM,cACZC,QAAQC,KAAK,CAAC,AAAC,KAAa,OAARC,UAEpB,IAAMC,IAAM", | ||
"names": [ | ||
"xxx", | ||
"console", | ||
"error", | ||
"message", | ||
"bbb" | ||
], | ||
"sources": [ | ||
"../../input/index.js" | ||
], | ||
"sourcesContent": [ | ||
"const xxx = ', something'\nconsole.error(`❌ ${message}`);\n\nconst bbb = ''\n" | ||
], | ||
"version": 3 | ||
} |
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