mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 21:54:36 +03:00
fix(es/codegen): Fix sourcemap (#4062)
This commit is contained in:
parent
94632b6940
commit
9310c39fe9
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3261,6 +3261,7 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"rustc-hash",
|
||||||
"sourcemap",
|
"sourcemap",
|
||||||
"swc_atoms",
|
"swc_atoms",
|
||||||
"swc_common",
|
"swc_common",
|
||||||
|
@ -586,8 +586,9 @@ impl Compiler {
|
|||||||
if cfg!(debug_assertions)
|
if cfg!(debug_assertions)
|
||||||
&& !src_map_buf.is_empty()
|
&& !src_map_buf.is_empty()
|
||||||
&& src_map_buf.iter().all(|(bp, _)| *bp == BytePos(0))
|
&& src_map_buf.iter().all(|(bp, _)| *bp == BytePos(0))
|
||||||
|
&& src.lines().count() >= 3
|
||||||
{
|
{
|
||||||
panic!("The module contains only dummy spans");
|
panic!("The module contains only dummy spans\n{}", src);
|
||||||
}
|
}
|
||||||
|
|
||||||
let (code, map) = match source_map {
|
let (code, map) = match source_map {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAA,MAAM,CAAC,CAAa;SAEXA,CAAC,GAAG,CAAC;IACVC,CAAC,EAAE,CAAC;AACR,CAAC;SAEQA,CAAC,GAAY,CAAC;QAAZC,CAAC,oEAAG,KAAK;IAChB,EAAE,EAAEA,CAAC,EAAE,CAAC;QACJ,KAAK,CAAC,GAAG,CAACC,KAAK,CAAC,CAAO;IAC3B,CAAC;IACDF,CAAC,EAAE,CAAC,CAAC,CAAC;AACV,CAAC;AAEDD,CAAC,EAAE,CAAC",
|
"mappings": "AAAA,OAAO,aAAa,CAAC;AAErB,SAASA,CAAC,GAAG;IACTC,CAAC,EAAE,CAAC;CACP;AAED,SAASA,CAAC,GAAY;QAAXC,CAAC,GAADA,+CAAS,kBAAL,KAAK;IAChB,IAAIA,CAAC,EAAE;QACH,MAAM,IAAIC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC5B;IACDF,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACT;AAEDD,CAAC,EAAE,CAAC",
|
||||||
"names": [
|
"names": [
|
||||||
"a",
|
"a",
|
||||||
"t",
|
"t",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "YAAA;;;EAAA;oBAAA;AAEO,KAAK,CAACA,GAAG,GAAG,CAAC;QAAPA,GAAG,GAAHA,GAAG,AAFhB",
|
"mappings": "AAEA,YAFA;;;EAAA;oBAAA;AAEO,MAAMA,GAAG,GAAG,CAAC,AAAC;QAARA,GAAG,GAAHA,GAAG,AAFhB",
|
||||||
"names": [
|
"names": [
|
||||||
"foo"
|
"foo"
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAA,MAAM,CAAC,GAAK,CAACA,GAAG,GAAG,QACnB,GADyB,CAAC;IACtB,MAAM,CAAC,CAAC;AACZ,CAAC",
|
"mappings": "AAAA,OAAO,IAAMA,GAAG,GAAG,WAAM;IACrB,OAAO,CAAC,CAAC;CACZ,AAAC,CAAA",
|
||||||
"names": [
|
"names": [
|
||||||
"foo"
|
"foo"
|
||||||
],
|
],
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"mappings": "YAAA;AAAA,GAAS;;QACQA,CAAC,MAADA,CAAC,GAAG,EAAE;aACHC,CAAC,GAAG,CAAC;QACjBC,OAAO,CAACC,GAAG,CAACH,CAAC,CAAC,CAAC;IACnB,CAAC;OAFeC,CAAC,GAADA,CAAC,AAFrB;GAAUG,CAAC,KAADA,CAAC,OAAX",
|
"mappings": "AAAA,YAAA;AAAA,IAAUA,CAAC,AAKV;;QAJgBC,CAAC,MAADA,CAAC,GAAG,EAAE,AAAL;IACP,SAASC,CAAC,GAAG;QAChBC,OAAO,CAACC,GAAG,CAACH,CAAC,CAAC,CAAC;KAClB;OAFeC,CAAC,GAADA,CAAC,AAFrB;GAAUF,CAAC,KAADA,CAAC,OAAX",
|
||||||
"names": [
|
"names": [
|
||||||
|
"A",
|
||||||
"v",
|
"v",
|
||||||
"a",
|
"a",
|
||||||
"console",
|
"console",
|
||||||
"log",
|
"log"
|
||||||
"A"
|
|
||||||
],
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
"../../input/index.ts"
|
"../../input/index.ts"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAAA,CAAC,GAAG,EAA6B,AAA7B,yBAA6B,AAA7B,EAA6B,CAA9B,CAA+B",
|
"mappings": "AAAAA,CAAC,EAAE,CAAC,6BAA6B,CAA9B,CAA+B",
|
||||||
"names": [
|
"names": [
|
||||||
"a"
|
"a"
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAAA,CAAC,GAAG,EAA6B,AAA7B,yBAA6B,AAA7B,EAA6B,CAA9B,CAA+B",
|
"mappings": "AAAAA,CAAC,EAAE,CAAC,6BAA6B,CAA9B,CAA+B",
|
||||||
"names": [
|
"names": [
|
||||||
"a"
|
"a"
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAAA,CAAC,EAAD;AAAG,EAAK,AAAL,CAAK,AAAL,EAAK,CAERA,CAAC,GAAE,EAAG,AAAH,CAAG;AAFN;AAIAA,CAAC,EAAE,CAAC,CAAA,EAAK,AAAL,CAAK,AAAL,EAAK;AAETA,CAAC,EAAE,CAAC,CAAA,EAAG,AAAH,CAAG",
|
"mappings": "AAAAA,CAAC,EAAE,AAAH;AAAG,KAAK,CAERA,CAAC,EAAE,CAAA,GAAG;AAFN;AAIAA,CAAC,EAAE,CAAC,CAAA,KAAK;AAETA,CAAC,EAAE,CAAC,CAA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AAC",
|
||||||
"names": [
|
"names": [
|
||||||
"html",
|
"html",
|
||||||
"css",
|
"css",
|
||||||
@ -7,6 +7,7 @@
|
|||||||
"App",
|
"App",
|
||||||
"render",
|
"render",
|
||||||
"name",
|
"name",
|
||||||
|
"constructor",
|
||||||
"styles",
|
"styles",
|
||||||
"properties",
|
"properties",
|
||||||
"type",
|
"type",
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.Button = void 0;
|
|
||||||
var _linaria = require("linaria");
|
|
||||||
const Button = _linaria.css`
|
|
||||||
color: red;
|
|
||||||
`;
|
|
||||||
exports.Button = Button;
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL2lucHV0L2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJsaW5hcmlhXCJcblxuZXhwb3J0IGNvbnN0IEJ1dHRvbiA9IGNzc2BcbiAgICBjb2xvcjogcmVkO1xuYCJdLCJuYW1lcyI6WyJCdXR0b24iLCJjc3MiXSwibWFwcGluZ3MiOiJZOzs7RTt1QjtBQUFvQixHQUFTLENBQVQsUUFBUztBQUV0QixLQUFLLENBQUNBLE1BQU0sR0FBR0MsUUFBRyxLQUFDOztBQUUxQjtRQUZhRCxNQUFNLEdBQU5BLE1BQU0sQSJ9
|
|
@ -9,4 +9,4 @@ const Button = _linaria.css`
|
|||||||
`;
|
`;
|
||||||
exports.Button = Button;
|
exports.Button = Button;
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL2lucHV0L2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJsaW5hcmlhXCJcblxuZXhwb3J0IGNvbnN0IEJ1dHRvbiA9IGNzc2BcbiAgICBjb2xvcjogcmVkO1xuYCJdLCJuYW1lcyI6WyJCdXR0b24iLCJjc3MiXSwibWFwcGluZ3MiOiJZQUFBOzs7RUFBQTt1QkFBQTtBQUFvQixHQUFTLENBQVQsUUFBUztBQUV0QixLQUFLLENBQUNBLE1BQU0sR0FBR0MsUUFBRyxLQUFDOztBQUUxQjtRQUZhRCxNQUFNLEdBQU5BLE1BQU0sQUFGbkIifQ==
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL2lucHV0L2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJsaW5hcmlhXCJcblxuZXhwb3J0IGNvbnN0IEJ1dHRvbiA9IGNzc2BcbiAgICBjb2xvcjogcmVkO1xuYCJdLCJuYW1lcyI6WyJCdXR0b24iLCJjc3MiXSwibWFwcGluZ3MiOiJBQUFBLFlBQUE7OztFQUFBO3VCQUFBO0FBQW9CLElBQUEsUUFBUyxxQkFBQTtBQUV0QixNQUFNQSxNQUFNLEdBQUdDLFFBQUcsSUFBQSxDQUFDOztBQUUxQixDQUFDO1FBRllELE1BQU0sR0FBTkEsTUFBTSxBQUZuQiJ9
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "YAAA;;;EAAA;oBAAA;AAEO,KAAK,CAACA,GAAG,GAAG,CAAC;IAChBC,GAAG,EAAE,CAAC,CAAC;AACX,CAAC;QAFYD,GAAG,GAAHA,GAAG,AAFhB",
|
"mappings": "AAEA,YAFA;;;EAAA;oBAAA;AAEO,MAAMA,GAAG,GAAG;IACfC,GAAG,EAAE,EAAE;CACV,AAAC;QAFWD,GAAG,GAAHA,GAAG,AAFhB",
|
||||||
"names": [
|
"names": [
|
||||||
"foo",
|
"foo",
|
||||||
"arr"
|
"arr"
|
||||||
|
@ -1,5 +1,5 @@
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AAC,CAAC;IAEHF,EAAE,CAAC,OAAO,EAAE,IAAM;QACdC,MAAM,CAAC,KAAK,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC5B,CAAC,CAAC;CACN,CAAC,CAAC",
|
||||||
"names": [
|
"names": [
|
||||||
"describe",
|
"describe",
|
||||||
"it",
|
"it",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "YAAA;AAAA,EAKG,AALH;;;;;CAKG,AALH,EAKG,CACHA,OAAO,CAACC,GAAG,CAAC,GAAG,CAACC,KAAK,GAAGC,KAAK,CAN7B",
|
"mappings": "AAMAA,YANA;AAAA;;;;;GAKG,CACHA,OAAO,CAACC,GAAG,CAAC,IAAIC,KAAK,EAAE,CAACC,KAAK,CAAC,AAN9B",
|
||||||
"names": [
|
"names": [
|
||||||
"console",
|
"console",
|
||||||
"log",
|
"log",
|
||||||
|
8
crates/swc/tests/fixture/sourcemap/010/input/.swcrc
Normal file
8
crates/swc/tests/fixture/sourcemap/010/input/.swcrc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"jsc": {
|
||||||
|
"parser": {
|
||||||
|
"syntax": "typescript"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceMaps": true
|
||||||
|
}
|
5
crates/swc/tests/fixture/sourcemap/010/input/index.ts
Normal file
5
crates/swc/tests/fixture/sourcemap/010/input/index.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export * from './createColors'
|
||||||
|
export * from './createColorsFromMap'
|
||||||
|
export type { Alpha, ColorMap, RGB, RGBA } from './interfaces'
|
||||||
|
export * from './rgbHex'
|
||||||
|
export * from './rgbaString'
|
11
crates/swc/tests/fixture/sourcemap/010/output/index.map
Normal file
11
crates/swc/tests/fixture/sourcemap/010/output/index.map
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"mappings": "AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AAErC,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA",
|
||||||
|
"names": [],
|
||||||
|
"sources": [
|
||||||
|
"../../input/index.ts"
|
||||||
|
],
|
||||||
|
"sourcesContent": [
|
||||||
|
"export * from './createColors'\nexport * from './createColorsFromMap'\nexport type { Alpha, ColorMap, RGB, RGBA } from './interfaces'\nexport * from './rgbHex'\nexport * from './rgbaString'"
|
||||||
|
],
|
||||||
|
"version": 3
|
||||||
|
}
|
4
crates/swc/tests/fixture/sourcemap/010/output/index.ts
Normal file
4
crates/swc/tests/fixture/sourcemap/010/output/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from './createColors';
|
||||||
|
export * from './createColorsFromMap';
|
||||||
|
export * from './rgbHex';
|
||||||
|
export * from './rgbaString';
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAAA,QAAQ,CAAC,CAAK,UAAQ,CAAC;IACnBC,EAAE,CAAC,CAAO,YAAQ,CAAC;QACfC,MAAM,CAAC,KAAK,EAAEC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEHF,EAAE,CAAC,CAAO,YAAQ,CAAC;QACf,KAAK,CAACG,GAAG,IAAI;;MAEf;QAEEF,MAAM,CAAC,KAAK,EAAEC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEHF,EAAE,CAAC,CAAO,YAAQ,CAAC;QACfC,MAAM,CAAC,KAAK,EAAEC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC",
|
"mappings": "AAAAA,QAAQ,CAAC,KAAK,EAAE,IAAM;IAClBC,EAAE,CAAC,OAAO,EAAE,IAAM;QACdC,MAAM,CAAC,KAAK,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC5B,CAAC,CAAC;IAEHF,EAAE,CAAC,OAAO,EAAE,IAAM;QACd,MAAMG,GAAG,GAAG,CAAC;;MAEf,CAAC,AAAC;QAEAF,MAAM,CAAC,KAAK,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC5B,CAAC,CAAC;IAEHF,EAAE,CAAC,OAAO,EAAE,IAAM;QACdC,MAAM,CAAC,KAAK,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC5B,CAAC,CAAC;CACN,CAAC,CAAC",
|
||||||
"names": [
|
"names": [
|
||||||
"describe",
|
"describe",
|
||||||
"it",
|
"it",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAA,EAAE,EAAC,IAAI,EAAC,CAAC;IAAA,GAAG,CAACA,CAAC,GAACC,MAAM,CAACC,GAAG;AAAC,CAAC",
|
"mappings": "AAAA,IAAG,IAAI,EAAC;IAAC,IAAIA,CAAC,GAACC,MAAM,CAACC,GAAG,AAAC;CAAC",
|
||||||
"names": [
|
"names": [
|
||||||
"h",
|
"h",
|
||||||
"Symbol",
|
"Symbol",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAAA,CAAC,GAAE,EAAG,AAAH,CAAG;AAAN",
|
"mappings": "AAAAA,CAAC,EAAE,CAAA,GAAG;AAAN",
|
||||||
"names": [
|
"names": [
|
||||||
"a"
|
"a"
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"mappings": "AAAAA,CAAC,GAAE,EAAK,AAAL,CAAK,AAAL,EAAK,CAAR",
|
"mappings": "AAAAA,CAAC,EAAE,CAAA,KAAK,CAAR",
|
||||||
"names": [
|
"names": [
|
||||||
"a"
|
"a"
|
||||||
],
|
],
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -4,5 +4,5 @@ $DIR/tests/stacktrace/case-1/input/index.js:5
|
|||||||
|
|
||||||
Error: Boom
|
Error: Boom
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/case-1/input/index.js:5:15)
|
at null.<anonymous> ($DIR/tests/stacktrace/case-1/input/index.js:5:15)
|
||||||
at Object.<anonymous> ($DIR/tests/stacktrace/case-1/input/index.js:6:6)
|
at Object.<anonymous> ($DIR/tests/stacktrace/case-1/input/index.js:6:7)
|
||||||
at node:internal/main/run_main_module:17:47
|
at node:internal/main/run_main_module:17:47
|
||||||
|
@ -4,6 +4,6 @@ $DIR/tests/stacktrace/issue-1796/es2015/input/index.js:3
|
|||||||
|
|
||||||
Error: Boom
|
Error: Boom
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2015/input/index.js:3:15)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2015/input/index.js:3:15)
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2015/input/index.js:4:6)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2015/input/index.js:4:7)
|
||||||
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2015/input/index.js:5:2)
|
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2015/input/index.js:5:3)
|
||||||
at node:internal/main/run_main_module:17:47
|
at node:internal/main/run_main_module:17:47
|
||||||
|
@ -4,6 +4,6 @@ $DIR/tests/stacktrace/issue-1796/es2016/input/index.js:3
|
|||||||
|
|
||||||
Error: Boom
|
Error: Boom
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2016/input/index.js:3:15)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2016/input/index.js:3:15)
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2016/input/index.js:4:6)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2016/input/index.js:4:7)
|
||||||
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2016/input/index.js:5:2)
|
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2016/input/index.js:5:3)
|
||||||
at node:internal/main/run_main_module:17:47
|
at node:internal/main/run_main_module:17:47
|
||||||
|
@ -4,6 +4,6 @@ $DIR/tests/stacktrace/issue-1796/es2017/input/index.js:3
|
|||||||
|
|
||||||
Error: Boom
|
Error: Boom
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2017/input/index.js:3:15)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2017/input/index.js:3:15)
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2017/input/index.js:4:6)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2017/input/index.js:4:7)
|
||||||
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2017/input/index.js:5:2)
|
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2017/input/index.js:5:3)
|
||||||
at node:internal/main/run_main_module:17:47
|
at node:internal/main/run_main_module:17:47
|
||||||
|
@ -4,6 +4,6 @@ $DIR/tests/stacktrace/issue-1796/es2018/input/index.js:3
|
|||||||
|
|
||||||
Error: Boom
|
Error: Boom
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2018/input/index.js:3:15)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2018/input/index.js:3:15)
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2018/input/index.js:4:6)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2018/input/index.js:4:7)
|
||||||
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2018/input/index.js:5:2)
|
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2018/input/index.js:5:3)
|
||||||
at node:internal/main/run_main_module:17:47
|
at node:internal/main/run_main_module:17:47
|
||||||
|
@ -4,6 +4,6 @@ $DIR/tests/stacktrace/issue-1796/es2019/input/index.js:3
|
|||||||
|
|
||||||
Error: Boom
|
Error: Boom
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2019/input/index.js:3:15)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2019/input/index.js:3:15)
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2019/input/index.js:4:6)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2019/input/index.js:4:7)
|
||||||
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2019/input/index.js:5:2)
|
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2019/input/index.js:5:3)
|
||||||
at node:internal/main/run_main_module:17:47
|
at node:internal/main/run_main_module:17:47
|
||||||
|
@ -4,6 +4,6 @@ $DIR/tests/stacktrace/issue-1796/es2020/input/index.js:3
|
|||||||
|
|
||||||
Error: Boom
|
Error: Boom
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2020/input/index.js:3:15)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2020/input/index.js:3:15)
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2020/input/index.js:4:6)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2020/input/index.js:4:7)
|
||||||
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2020/input/index.js:5:2)
|
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es2020/input/index.js:5:3)
|
||||||
at node:internal/main/run_main_module:17:47
|
at node:internal/main/run_main_module:17:47
|
||||||
|
@ -4,6 +4,6 @@ $DIR/tests/stacktrace/issue-1796/es5/input/index.js:3
|
|||||||
|
|
||||||
Error: Boom
|
Error: Boom
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es5/input/index.js:3:15)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es5/input/index.js:3:15)
|
||||||
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es5/input/index.js:4:6)
|
at null.<anonymous> ($DIR/tests/stacktrace/issue-1796/es5/input/index.js:4:7)
|
||||||
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es5/input/index.js:5:2)
|
at Object.<anonymous> ($DIR/tests/stacktrace/issue-1796/es5/input/index.js:5:3)
|
||||||
at node:internal/main/run_main_module:17:47
|
at node:internal/main/run_main_module:17:47
|
||||||
|
@ -2,7 +2,7 @@ use std::io;
|
|||||||
|
|
||||||
use anyhow::{Context, Error};
|
use anyhow::{Context, Error};
|
||||||
use crc::{Crc, Digest, CRC_64_ECMA_182};
|
use crc::{Crc, Digest, CRC_64_ECMA_182};
|
||||||
use swc_common::{sync::Lrc, SourceMap, Span};
|
use swc_common::{sync::Lrc, BytePos, SourceMap, Span};
|
||||||
use swc_ecma_ast::{EsVersion, Module};
|
use swc_ecma_ast::{EsVersion, Module};
|
||||||
use swc_ecma_codegen::{text_writer::WriteJs, Emitter};
|
use swc_ecma_codegen::{text_writer::WriteJs, Emitter};
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ impl WriteJs for &mut Hasher<'_> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_comment(&mut self, _: Span, s: &str) -> io::Result<()> {
|
fn write_comment(&mut self, s: &str) -> io::Result<()> {
|
||||||
self.w(s);
|
self.w(s);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -121,4 +121,9 @@ impl WriteJs for &mut Hasher<'_> {
|
|||||||
fn care_about_srcmap(&self) -> bool {
|
fn care_about_srcmap(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn add_srcmap(&mut self, _: BytePos) -> io::Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ bitflags = "1"
|
|||||||
memchr = "2.4.1"
|
memchr = "2.4.1"
|
||||||
num-bigint = { version = "0.4", features = ["serde"] }
|
num-bigint = { version = "0.4", features = ["serde"] }
|
||||||
once_cell = "1.10.0"
|
once_cell = "1.10.0"
|
||||||
|
rustc-hash = "1.1.0"
|
||||||
sourcemap = "6"
|
sourcemap = "6"
|
||||||
swc_atoms = { version = "0.2", path = "../swc_atoms" }
|
swc_atoms = { version = "0.2", path = "../swc_atoms" }
|
||||||
swc_common = { version = "0.17.3", path = "../swc_common" }
|
swc_common = { version = "0.17.3", path = "../swc_common" }
|
||||||
|
@ -13,19 +13,26 @@ macro_rules! write_comments {
|
|||||||
match cmt.kind {
|
match cmt.kind {
|
||||||
CommentKind::Line => {
|
CommentKind::Line => {
|
||||||
if $prefix_space {
|
if $prefix_space {
|
||||||
$e.wr.write_comment(swc_common::DUMMY_SP, " ")?;
|
$e.wr.write_comment(" ")?;
|
||||||
}
|
}
|
||||||
$e.wr.write_comment(cmt.span, "//")?;
|
srcmap!($e, cmt, true);
|
||||||
$e.wr.write_comment(cmt.span, &cmt.text)?;
|
$e.wr.write_comment("//")?;
|
||||||
|
$e.wr.write_comment(&cmt.text)?;
|
||||||
|
srcmap!($e, cmt, false);
|
||||||
$e.wr.write_line()?;
|
$e.wr.write_line()?;
|
||||||
}
|
}
|
||||||
CommentKind::Block => {
|
CommentKind::Block => {
|
||||||
if $prefix_space {
|
if $prefix_space {
|
||||||
$e.wr.write_comment(swc_common::DUMMY_SP, " ")?;
|
$e.wr.write_comment(" ")?;
|
||||||
}
|
}
|
||||||
$e.wr.write_comment(cmt.span, "/*")?;
|
|
||||||
$e.wr.write_lit(cmt.span, &cmt.text)?;
|
srcmap!($e, cmt, true);
|
||||||
$e.wr.write_comment(cmt.span, "*/")?;
|
|
||||||
|
$e.wr.write_comment("/*")?;
|
||||||
|
$e.wr.write_lit(DUMMY_SP, &cmt.text)?;
|
||||||
|
$e.wr.write_comment("*/")?;
|
||||||
|
|
||||||
|
srcmap!($e, cmt, false);
|
||||||
$e.wr.write_space()?;
|
$e.wr.write_space()?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ where
|
|||||||
fn emit_class_decl(&mut self, node: &ClassDecl) -> Result {
|
fn emit_class_decl(&mut self, node: &ClassDecl) -> Result {
|
||||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||||
|
|
||||||
|
srcmap!(node, true);
|
||||||
|
|
||||||
if node.declare {
|
if node.declare {
|
||||||
keyword!("declare");
|
keyword!("declare");
|
||||||
space!();
|
space!();
|
||||||
@ -50,6 +52,8 @@ where
|
|||||||
fn emit_fn_decl(&mut self, node: &FnDecl) -> Result {
|
fn emit_fn_decl(&mut self, node: &FnDecl) -> Result {
|
||||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||||
|
|
||||||
|
srcmap!(node, true);
|
||||||
|
|
||||||
if node.declare {
|
if node.declare {
|
||||||
keyword!("declare");
|
keyword!("declare");
|
||||||
space!();
|
space!();
|
||||||
@ -77,15 +81,14 @@ where
|
|||||||
fn emit_var_decl(&mut self, node: &VarDecl) -> Result {
|
fn emit_var_decl(&mut self, node: &VarDecl) -> Result {
|
||||||
self.emit_leading_comments_of_span(node.span, false)?;
|
self.emit_leading_comments_of_span(node.span, false)?;
|
||||||
|
|
||||||
|
srcmap!(node, true);
|
||||||
|
|
||||||
if node.declare {
|
if node.declare {
|
||||||
keyword!("declare");
|
keyword!("declare");
|
||||||
space!();
|
space!();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
keyword!(node.kind.as_str());
|
||||||
let span = self.cm.span_until_char(node.span, ' ');
|
|
||||||
keyword!(span, node.kind.as_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
let starts_with_ident = match node.decls.first() {
|
let starts_with_ident = match node.decls.first() {
|
||||||
Some(VarDeclarator {
|
Some(VarDeclarator {
|
||||||
@ -105,12 +108,16 @@ where
|
|||||||
Some(&node.decls),
|
Some(&node.decls),
|
||||||
ListFormat::VariableDeclarationList,
|
ListFormat::VariableDeclarationList,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
srcmap!(node, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[emitter]
|
#[emitter]
|
||||||
fn emit_var_declarator(&mut self, node: &VarDeclarator) -> Result {
|
fn emit_var_declarator(&mut self, node: &VarDeclarator) -> Result {
|
||||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||||
|
|
||||||
|
srcmap!(node, true);
|
||||||
|
|
||||||
emit!(node.name);
|
emit!(node.name);
|
||||||
|
|
||||||
if let Some(ref init) = node.init {
|
if let Some(ref init) = node.init {
|
||||||
@ -119,6 +126,8 @@ where
|
|||||||
formatting_space!();
|
formatting_space!();
|
||||||
emit!(init);
|
emit!(init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srcmap!(node, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -99,3 +99,20 @@ macro_rules! semi {
|
|||||||
$emitter.wr.write_semi(None)?;
|
$emitter.wr.write_semi(None)?;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// - `srcmap!(true)` for start (span.lo)
|
||||||
|
/// - `srcmap!(false)` for end (span.hi)
|
||||||
|
macro_rules! srcmap {
|
||||||
|
($emitter:expr, $n:expr, true) => {{
|
||||||
|
let span = $n.span();
|
||||||
|
if !span.is_dummy() {
|
||||||
|
$emitter.wr.add_srcmap(span.lo)?;
|
||||||
|
}
|
||||||
|
}};
|
||||||
|
($emitter:expr, $n:expr, false) => {
|
||||||
|
let span = $n.span();
|
||||||
|
if !span.is_dummy() {
|
||||||
|
$emitter.wr.add_srcmap(span.hi)?;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -37,7 +37,7 @@ pub trait WriteJs {
|
|||||||
fn write_line(&mut self) -> Result;
|
fn write_line(&mut self) -> Result;
|
||||||
|
|
||||||
fn write_lit(&mut self, span: Span, s: &str) -> Result;
|
fn write_lit(&mut self, span: Span, s: &str) -> Result;
|
||||||
fn write_comment(&mut self, span: Span, s: &str) -> Result;
|
fn write_comment(&mut self, s: &str) -> Result;
|
||||||
|
|
||||||
fn write_str_lit(&mut self, span: Span, s: &str) -> Result;
|
fn write_str_lit(&mut self, span: Span, s: &str) -> Result;
|
||||||
fn write_str(&mut self, s: &str) -> Result;
|
fn write_str(&mut self, s: &str) -> Result;
|
||||||
@ -47,6 +47,8 @@ pub trait WriteJs {
|
|||||||
fn write_punct(&mut self, span: Option<Span>, s: &'static str) -> Result;
|
fn write_punct(&mut self, span: Option<Span>, s: &'static str) -> Result;
|
||||||
|
|
||||||
fn care_about_srcmap(&self) -> bool;
|
fn care_about_srcmap(&self) -> bool;
|
||||||
|
|
||||||
|
fn add_srcmap(&mut self, pos: BytePos) -> Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W> WriteJs for Box<W>
|
impl<W> WriteJs for Box<W>
|
||||||
@ -109,8 +111,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write_comment(&mut self, span: Span, s: &str) -> Result {
|
fn write_comment(&mut self, s: &str) -> Result {
|
||||||
(**self).write_comment(span, s)
|
(**self).write_comment(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -137,4 +139,9 @@ where
|
|||||||
fn care_about_srcmap(&self) -> bool {
|
fn care_about_srcmap(&self) -> bool {
|
||||||
(**self).care_about_srcmap()
|
(**self).care_about_srcmap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn add_srcmap(&mut self, pos: BytePos) -> Result {
|
||||||
|
(**self).add_srcmap(pos)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
|
use rustc_hash::FxHashSet;
|
||||||
use swc_common::{sync::Lrc, BytePos, LineCol, SourceMap, Span, DUMMY_SP};
|
use swc_common::{sync::Lrc, BytePos, LineCol, SourceMap, Span, DUMMY_SP};
|
||||||
use swc_ecma_ast::EsVersion;
|
use swc_ecma_ast::EsVersion;
|
||||||
|
|
||||||
@ -18,6 +19,9 @@ pub struct JsWriter<'a, W: Write> {
|
|||||||
line_pos: usize,
|
line_pos: usize,
|
||||||
new_line: &'a str,
|
new_line: &'a str,
|
||||||
srcmap: Option<&'a mut Vec<(BytePos, LineCol)>>,
|
srcmap: Option<&'a mut Vec<(BytePos, LineCol)>>,
|
||||||
|
srcmap_done: FxHashSet<(BytePos, u32, u32)>,
|
||||||
|
/// Used to avoid including whitespaces created by indention.
|
||||||
|
pending_srcmap: Option<BytePos>,
|
||||||
wr: W,
|
wr: W,
|
||||||
target: EsVersion,
|
target: EsVersion,
|
||||||
}
|
}
|
||||||
@ -48,6 +52,8 @@ impl<'a, W: Write> JsWriter<'a, W> {
|
|||||||
srcmap,
|
srcmap,
|
||||||
wr,
|
wr,
|
||||||
target,
|
target,
|
||||||
|
pending_srcmap: Default::default(),
|
||||||
|
srcmap_done: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +81,10 @@ impl<'a, W: Write> JsWriter<'a, W> {
|
|||||||
if self.line_start {
|
if self.line_start {
|
||||||
cnt += self.write_indent_string()?;
|
cnt += self.write_indent_string()?;
|
||||||
self.line_start = false;
|
self.line_start = false;
|
||||||
|
|
||||||
|
if let Some(pending) = self.pending_srcmap.take() {
|
||||||
|
self.srcmap(pending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(span) = span {
|
if let Some(span) = span {
|
||||||
@ -96,18 +106,17 @@ impl<'a, W: Write> JsWriter<'a, W> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn srcmap(&mut self, byte_pos: BytePos) {
|
fn srcmap(&mut self, byte_pos: BytePos) {
|
||||||
if byte_pos.is_reserved_for_comments() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(ref mut srcmap) = self.srcmap {
|
if let Some(ref mut srcmap) = self.srcmap {
|
||||||
srcmap.push((
|
if self
|
||||||
byte_pos,
|
.srcmap_done
|
||||||
LineCol {
|
.insert((byte_pos, self.line_count as _, self.line_pos as _))
|
||||||
|
{
|
||||||
|
let loc = LineCol {
|
||||||
line: self.line_count as _,
|
line: self.line_count as _,
|
||||||
col: self.line_pos as _,
|
col: self.line_pos as _,
|
||||||
},
|
};
|
||||||
))
|
srcmap.push((byte_pos, loc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,11 +179,16 @@ impl<'a, W: Write> WriteJs for JsWriter<'a, W> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn write_line(&mut self) -> Result {
|
fn write_line(&mut self) -> Result {
|
||||||
|
let pending = self.pending_srcmap.take();
|
||||||
if !self.line_start {
|
if !self.line_start {
|
||||||
self.raw_write(self.new_line.as_bytes())?;
|
self.raw_write(self.new_line.as_bytes())?;
|
||||||
self.line_count += 1;
|
self.line_count += 1;
|
||||||
self.line_pos = 0;
|
self.line_pos = 0;
|
||||||
self.line_start = true;
|
self.line_start = true;
|
||||||
|
|
||||||
|
if let Some(pending) = pending {
|
||||||
|
self.srcmap(pending)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -202,8 +216,8 @@ impl<'a, W: Write> WriteJs for JsWriter<'a, W> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_comment(&mut self, span: Span, s: &str) -> Result {
|
fn write_comment(&mut self, s: &str) -> Result {
|
||||||
self.write(Some(span), s)?;
|
self.write(None, s)?;
|
||||||
{
|
{
|
||||||
let line_start_of_s = compute_line_starts(s);
|
let line_start_of_s = compute_line_starts(s);
|
||||||
if line_start_of_s.len() > 1 {
|
if line_start_of_s.len() > 1 {
|
||||||
@ -254,6 +268,15 @@ impl<'a, W: Write> WriteJs for JsWriter<'a, W> {
|
|||||||
fn care_about_srcmap(&self) -> bool {
|
fn care_about_srcmap(&self) -> bool {
|
||||||
self.srcmap.is_some()
|
self.srcmap.is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn add_srcmap(&mut self, pos: BytePos) -> Result {
|
||||||
|
if self.line_start {
|
||||||
|
self.pending_srcmap = Some(pos);
|
||||||
|
} else {
|
||||||
|
self.srcmap(pos);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_line_starts(s: &str) -> Vec<usize> {
|
fn compute_line_starts(s: &str) -> Vec<usize> {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use swc_common::Span;
|
use swc_common::{BytePos, Span};
|
||||||
|
|
||||||
use super::{Result, WriteJs};
|
use super::{Result, WriteJs};
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ impl<W: WriteJs> WriteJs for OmitTrailingSemi<W> {
|
|||||||
|
|
||||||
with_semi!(write_space());
|
with_semi!(write_space());
|
||||||
|
|
||||||
with_semi!(write_comment(span: Span, s: &str));
|
with_semi!(write_comment(s: &str));
|
||||||
|
|
||||||
with_semi!(write_keyword(span: Option<Span>, s: &'static str));
|
with_semi!(write_keyword(span: Option<Span>, s: &'static str));
|
||||||
|
|
||||||
@ -80,6 +80,7 @@ impl<W: WriteJs> WriteJs for OmitTrailingSemi<W> {
|
|||||||
self.inner.write_punct(span, s)
|
self.inner.write_punct(span, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn target(&self) -> swc_ecma_ast::EsVersion {
|
fn target(&self) -> swc_ecma_ast::EsVersion {
|
||||||
self.inner.target()
|
self.inner.target()
|
||||||
}
|
}
|
||||||
@ -88,6 +89,11 @@ impl<W: WriteJs> WriteJs for OmitTrailingSemi<W> {
|
|||||||
fn care_about_srcmap(&self) -> bool {
|
fn care_about_srcmap(&self) -> bool {
|
||||||
self.inner.care_about_srcmap()
|
self.inner.care_about_srcmap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn add_srcmap(&mut self, pos: BytePos) -> Result {
|
||||||
|
self.inner.add_srcmap(pos)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W: WriteJs> OmitTrailingSemi<W> {
|
impl<W: WriteJs> OmitTrailingSemi<W> {
|
||||||
|
@ -103,7 +103,7 @@ impl Fold for InjectSelf {
|
|||||||
|
|
||||||
//TODO: Collect expect and give that list to unexpected
|
//TODO: Collect expect and give that list to unexpected
|
||||||
"keyword" | "emit" | "punct" | "semi" | "formatting_semi" | "space"
|
"keyword" | "emit" | "punct" | "semi" | "formatting_semi" | "space"
|
||||||
| "formatting_space" | "operator" | "opt" | "opt_leading_space" => {
|
| "formatting_space" | "operator" | "opt" | "opt_leading_space" | "srcmap" => {
|
||||||
let tokens = if i.tokens.is_empty() {
|
let tokens = if i.tokens.is_empty() {
|
||||||
quote_spanned!(span => #parser)
|
quote_spanned!(span => #parser)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user