-
-
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.
fix(es/codegen): Fix regression of source maps (#7523)
**Related issue:** - Closes #7506.
- Loading branch information
Showing
48 changed files
with
219 additions
and
79 deletions.
There are no files selected for viewing
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
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
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,19 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"tsx": true | ||
}, | ||
"target": "es2020", | ||
"transform": { | ||
"hidden": { | ||
"jest": true | ||
} | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"minify": false, | ||
"sourceMaps": true | ||
} |
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,15 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { getStackTrace } from 'common/get-stack-trace'; | ||
|
||
describe('get-stack-trace', () => { | ||
it("should include the calling function's name in third line", () => { | ||
let stack: string[] | undefined; | ||
function namedCallingFunction() { | ||
stack = getStackTrace(); | ||
} | ||
namedCallingFunction(); | ||
|
||
expect(stack[2]).toContain('namedCallingFunction'); | ||
}); | ||
}); |
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,8 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
export function getStackTrace(): string[] { | ||
const rawStack = new Error().stack!; | ||
|
||
return rawStack.split('\n'); | ||
} |
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,19 @@ | ||
{ | ||
"mappings": "AAAA,4DAA4D;AAC5D,kCAAkC;;;;;+BACJ;AAE9BA,SAAS,mBAAmB;IACxBC,GAAG,4DAA4D;QAC3D,IAAIC;QACJ,SAASC;YACLD,QAAQE,IAAAA,4BAAa;QACzB;QACAD;QAEAE,OAAOH,KAAK,CAAC,EAAE,EAAEI,SAAS,CAAC;IAC/B;AACJ", | ||
"names": [ | ||
"describe", | ||
"it", | ||
"stack", | ||
"namedCallingFunction", | ||
"getStackTrace", | ||
"expect", | ||
"toContain" | ||
], | ||
"sources": [ | ||
"../../input/index.ts" | ||
], | ||
"sourcesContent": [ | ||
"// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\nimport { getStackTrace } from 'common/get-stack-trace';\n\ndescribe('get-stack-trace', () => {\n it(\"should include the calling function's name in third line\", () => {\n let stack: string[] | undefined;\n function namedCallingFunction() {\n stack = getStackTrace();\n }\n namedCallingFunction();\n\n expect(stack[2]).toContain('namedCallingFunction');\n });\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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
const _getstacktrace = require("common/get-stack-trace"); | ||
describe('get-stack-trace', ()=>{ | ||
it("should include the calling function's name in third line", ()=>{ | ||
let stack; | ||
function namedCallingFunction() { | ||
stack = (0, _getstacktrace.getStackTrace)(); | ||
} | ||
namedCallingFunction(); | ||
expect(stack[2]).toContain('namedCallingFunction'); | ||
}); | ||
}); |
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,4DAA4D;AAC5D,kCAAkC;;;;;+BAElBA;;;eAAAA;;;AAAT,SAASA;IACZ,MAAMC,WAAW,IAAIC,QAAQC,KAAK;IAElC,OAAOF,SAASG,KAAK,CAAC;AAC1B", | ||
"names": [ | ||
"getStackTrace", | ||
"rawStack", | ||
"Error", | ||
"stack", | ||
"split" | ||
], | ||
"sources": [ | ||
"../../input/util.ts" | ||
], | ||
"sourcesContent": [ | ||
"// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nexport function getStackTrace(): string[] {\n const rawStack = new Error().stack!;\n\n return rawStack.split('\\n');\n}\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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "getStackTrace", { | ||
enumerable: true, | ||
get: function() { | ||
return getStackTrace; | ||
} | ||
}); | ||
function getStackTrace() { | ||
const rawStack = new Error().stack; | ||
return rawStack.split('\n'); | ||
} |
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
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
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
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
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
2 changes: 1 addition & 1 deletion
2
crates/swc/tests/fixture/sourcemap/011/output/CommentControlller.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
Oops, something went wrong.
f27838d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/bugs-1
317042
ns/iter (± 7753
)362382
ns/iter (± 10397
)0.87
es/full/minify/libraries/antd
1492830900
ns/iter (± 28797005
)1916091353
ns/iter (± 31364945
)0.78
es/full/minify/libraries/d3
323177948
ns/iter (± 6486912
)377576489
ns/iter (± 5472133
)0.86
es/full/minify/libraries/echarts
1251407043
ns/iter (± 25688308
)1488394291
ns/iter (± 19952624
)0.84
es/full/minify/libraries/jquery
95637290
ns/iter (± 289119
)111500116
ns/iter (± 1801640
)0.86
es/full/minify/libraries/lodash
113125586
ns/iter (± 237849
)135677345
ns/iter (± 1393366
)0.83
es/full/minify/libraries/moment
55908784
ns/iter (± 406839
)65193964
ns/iter (± 548449
)0.86
es/full/minify/libraries/react
19933956
ns/iter (± 114751
)23195684
ns/iter (± 250469
)0.86
es/full/minify/libraries/terser
248905908
ns/iter (± 1444078
)301872481
ns/iter (± 5804087
)0.82
es/full/minify/libraries/three
445902266
ns/iter (± 4048498
)541153828
ns/iter (± 5879298
)0.82
es/full/minify/libraries/typescript
3023212183
ns/iter (± 13882931
)3621698227
ns/iter (± 26753594
)0.83
es/full/minify/libraries/victory
654525186
ns/iter (± 8979780
)807135252
ns/iter (± 15741302
)0.81
es/full/minify/libraries/vue
138219102
ns/iter (± 524785
)162684684
ns/iter (± 1555408
)0.85
es/full/codegen/es3
36048
ns/iter (± 48
)41185
ns/iter (± 129
)0.88
es/full/codegen/es5
36145
ns/iter (± 37
)41259
ns/iter (± 69
)0.88
es/full/codegen/es2015
36096
ns/iter (± 34
)41318
ns/iter (± 56
)0.87
es/full/codegen/es2016
36120
ns/iter (± 59
)41305
ns/iter (± 73
)0.87
es/full/codegen/es2017
36140
ns/iter (± 38
)41353
ns/iter (± 109
)0.87
es/full/codegen/es2018
36085
ns/iter (± 25
)41283
ns/iter (± 95
)0.87
es/full/codegen/es2019
36120
ns/iter (± 60
)41346
ns/iter (± 59
)0.87
es/full/codegen/es2020
36109
ns/iter (± 62
)41311
ns/iter (± 45
)0.87
es/full/all/es3
184918253
ns/iter (± 610525
)215538472
ns/iter (± 2341141
)0.86
es/full/all/es5
174343686
ns/iter (± 425514
)204686645
ns/iter (± 2844796
)0.85
es/full/all/es2015
129807947
ns/iter (± 2246396
)158962833
ns/iter (± 1933175
)0.82
es/full/all/es2016
128029222
ns/iter (± 5940546
)159456915
ns/iter (± 1624156
)0.80
es/full/all/es2017
127699044
ns/iter (± 400908
)158298718
ns/iter (± 1506890
)0.81
es/full/all/es2018
125105612
ns/iter (± 1053662
)155594361
ns/iter (± 3612315
)0.80
es/full/all/es2019
124150425
ns/iter (± 2117545
)155226768
ns/iter (± 2285104
)0.80
es/full/all/es2020
118057402
ns/iter (± 718165
)149552370
ns/iter (± 2854429
)0.79
es/full/parser
518214
ns/iter (± 6002
)608081
ns/iter (± 9934
)0.85
es/full/base/fixer
19063
ns/iter (± 96
)24836
ns/iter (± 54
)0.77
es/full/base/resolver_and_hygiene
97591
ns/iter (± 177
)105758
ns/iter (± 162
)0.92
serialization of serde
322
ns/iter (± 0
)282
ns/iter (± 0
)1.14
css/minify/libraries/bootstrap
30778258
ns/iter (± 56926
)36355423
ns/iter (± 356584
)0.85
css/visitor/compare/clone
2150104
ns/iter (± 22458
)2388199
ns/iter (± 3704
)0.90
css/visitor/compare/visit_mut_span
2277019
ns/iter (± 13137
)2586602
ns/iter (± 5632
)0.88
css/visitor/compare/visit_mut_span_panic
2350969
ns/iter (± 9275
)2669033
ns/iter (± 26604
)0.88
css/visitor/compare/fold_span
3073902
ns/iter (± 14027
)3523427
ns/iter (± 106736
)0.87
css/visitor/compare/fold_span_panic
3261584
ns/iter (± 17434
)3548968
ns/iter (± 55854
)0.92
css/lexer/bootstrap_5_1_3
4825486
ns/iter (± 5044
)5532891
ns/iter (± 24584
)0.87
css/lexer/foundation_6_7_4
4046287
ns/iter (± 3373
)4702527
ns/iter (± 3839
)0.86
css/lexer/tailwind_3_1_1
766194
ns/iter (± 661
)892164
ns/iter (± 1036
)0.86
css/parser/bootstrap_5_1_3
20501078
ns/iter (± 39359
)23912868
ns/iter (± 85228
)0.86
css/parser/foundation_6_7_4
16491020
ns/iter (± 21278
)19033619
ns/iter (± 84422
)0.87
css/parser/tailwind_3_1_1
3181845
ns/iter (± 5075
)3685666
ns/iter (± 7093
)0.86
es/codegen/colors
747936
ns/iter (± 406847
)735345
ns/iter (± 396694
)1.02
es/codegen/large
2994136
ns/iter (± 1567729
)3127745
ns/iter (± 1637899
)0.96
es/codegen/with-parser/colors
49013
ns/iter (± 240
)57996
ns/iter (± 425
)0.85
es/codegen/with-parser/large
523244
ns/iter (± 1907
)572867
ns/iter (± 2071
)0.91
es/minify/libraries/antd
1344682343
ns/iter (± 15284231
)1685680890
ns/iter (± 21161731
)0.80
es/minify/libraries/d3
283031686
ns/iter (± 2319135
)329796102
ns/iter (± 4294006
)0.86
es/minify/libraries/echarts
1068231984
ns/iter (± 8804745
)1272608747
ns/iter (± 13562365
)0.84
es/minify/libraries/jquery
83633708
ns/iter (± 1390727
)97380440
ns/iter (± 958183
)0.86
es/minify/libraries/lodash
102590159
ns/iter (± 705025
)121261696
ns/iter (± 1252408
)0.85
es/minify/libraries/moment
49316130
ns/iter (± 295781
)56690506
ns/iter (± 469029
)0.87
es/minify/libraries/react
17995774
ns/iter (± 51998
)20494582
ns/iter (± 127145
)0.88
es/minify/libraries/terser
213972857
ns/iter (± 3017575
)249704543
ns/iter (± 2288762
)0.86
es/minify/libraries/three
372907889
ns/iter (± 4552952
)450150374
ns/iter (± 6900443
)0.83
es/minify/libraries/typescript
2628873243
ns/iter (± 35774795
)3181569012
ns/iter (± 41542540
)0.83
es/minify/libraries/victory
561996173
ns/iter (± 6159853
)740282721
ns/iter (± 14039737
)0.76
es/minify/libraries/vue
124315160
ns/iter (± 680230
)146528959
ns/iter (± 1518628
)0.85
es/visitor/compare/clone
2080928
ns/iter (± 6410
)2404077
ns/iter (± 11844
)0.87
es/visitor/compare/visit_mut_span
2425487
ns/iter (± 5337
)2791415
ns/iter (± 16225
)0.87
es/visitor/compare/visit_mut_span_panic
2458516
ns/iter (± 31563
)2849323
ns/iter (± 23823
)0.86
es/visitor/compare/fold_span
3510927
ns/iter (± 6169
)3976715
ns/iter (± 26790
)0.88
es/visitor/compare/fold_span_panic
3640449
ns/iter (± 10566
)4091717
ns/iter (± 131502
)0.89
es/lexer/colors
12953
ns/iter (± 59
)14805
ns/iter (± 25
)0.87
es/lexer/angular
6171042
ns/iter (± 11526
)6920084
ns/iter (± 1891
)0.89
es/lexer/backbone
815149
ns/iter (± 1369
)847217
ns/iter (± 351
)0.96
es/lexer/jquery
4554987
ns/iter (± 9265
)4751563
ns/iter (± 6377
)0.96
es/lexer/jquery mobile
6968123
ns/iter (± 3817
)7353122
ns/iter (± 4531
)0.95
es/lexer/mootools
3608441
ns/iter (± 5999
)3734358
ns/iter (± 4865
)0.97
es/lexer/underscore
672431
ns/iter (± 1975
)701916
ns/iter (± 363
)0.96
es/lexer/three
21201018
ns/iter (± 82732
)22355464
ns/iter (± 24663
)0.95
es/lexer/yui
3970518
ns/iter (± 23423
)4282141
ns/iter (± 4706
)0.93
es/parser/colors
28972
ns/iter (± 78
)33723
ns/iter (± 89
)0.86
es/parser/angular
14525690
ns/iter (± 95800
)17126992
ns/iter (± 120762
)0.85
es/parser/backbone
2171687
ns/iter (± 11438
)2432059
ns/iter (± 12147
)0.89
es/parser/jquery
11811699
ns/iter (± 67566
)13432445
ns/iter (± 189636
)0.88
es/parser/jquery mobile
17945633
ns/iter (± 132165
)21292495
ns/iter (± 316226
)0.84
es/parser/mootools
9025152
ns/iter (± 18455
)10036239
ns/iter (± 33271
)0.90
es/parser/underscore
1874348
ns/iter (± 16099
)2074270
ns/iter (± 12145
)0.90
es/parser/three
50774988
ns/iter (± 328351
)60141888
ns/iter (± 930192
)0.84
es/parser/yui
9119998
ns/iter (± 34178
)10213732
ns/iter (± 61609
)0.89
es/preset-env/usage/builtin_type
148074
ns/iter (± 32503
)153746
ns/iter (± 33848
)0.96
es/preset-env/usage/property
20003
ns/iter (± 127
)29928
ns/iter (± 41
)0.67
es/resolver/typescript
95664899
ns/iter (± 616146
)128362342
ns/iter (± 2740605
)0.75
es/fixer/typescript
66521012
ns/iter (± 469027
)87464985
ns/iter (± 1451632
)0.76
es/hygiene/typescript
144064813
ns/iter (± 667238
)201346083
ns/iter (± 1563609
)0.72
es/resolver_with_hygiene/typescript
304884344
ns/iter (± 1858128
)404285960
ns/iter (± 5582976
)0.75
es/visitor/base-perf/module_clone
61007
ns/iter (± 251
)85855
ns/iter (± 502
)0.71
es/visitor/base-perf/fold_empty
65188
ns/iter (± 585
)95135
ns/iter (± 559
)0.69
es/visitor/base-perf/fold_noop_impl_all
65262
ns/iter (± 382
)95603
ns/iter (± 486
)0.68
es/visitor/base-perf/fold_noop_impl_vec
64948
ns/iter (± 190
)96192
ns/iter (± 468
)0.68
es/visitor/base-perf/boxing_boxed_clone
56
ns/iter (± 0
)60
ns/iter (± 0
)0.93
es/visitor/base-perf/boxing_unboxed_clone
40
ns/iter (± 0
)44
ns/iter (± 0
)0.91
es/visitor/base-perf/boxing_boxed
110
ns/iter (± 0
)106
ns/iter (± 0
)1.04
es/visitor/base-perf/boxing_unboxed
79
ns/iter (± 0
)81
ns/iter (± 0
)0.98
es/visitor/base-perf/visit_empty
0
ns/iter (± 0
)es/visitor/base-perf/visit_contains_this
2584
ns/iter (± 5
)3271
ns/iter (± 63
)0.79
es/base/parallel/resolver/typescript
4487328989
ns/iter (± 280791301
)7508091120
ns/iter (± 452858155
)0.60
es/base/parallel/hygiene/typescript
1585503298
ns/iter (± 18656642
)2406401579
ns/iter (± 33241578
)0.66
misc/visitors/time-complexity/time 5
109
ns/iter (± 0
)105
ns/iter (± 0
)1.04
misc/visitors/time-complexity/time 10
287
ns/iter (± 0
)355
ns/iter (± 8
)0.81
misc/visitors/time-complexity/time 15
560
ns/iter (± 0
)678
ns/iter (± 10
)0.83
misc/visitors/time-complexity/time 20
1048
ns/iter (± 13
)1281
ns/iter (± 24
)0.82
misc/visitors/time-complexity/time 40
3821
ns/iter (± 323
)6813
ns/iter (± 24
)0.56
misc/visitors/time-complexity/time 60
9572
ns/iter (± 7
)17564
ns/iter (± 103
)0.54
es/full-target/es2016
240902
ns/iter (± 560
)270553
ns/iter (± 343
)0.89
es/full-target/es2017
228909
ns/iter (± 1062
)260825
ns/iter (± 391
)0.88
es/full-target/es2018
217202
ns/iter (± 1530
)250015
ns/iter (± 455
)0.87
es2020_nullish_coalescing
72858
ns/iter (± 490
)98690
ns/iter (± 372
)0.74
es2020_optional_chaining
89401
ns/iter (± 316
)121631
ns/iter (± 484
)0.74
es2022_class_properties
121969
ns/iter (± 531
)157410
ns/iter (± 232
)0.77
es2018_object_rest_spread
77166
ns/iter (± 148
)100851
ns/iter (± 197
)0.77
es2019_optional_catch_binding
65565
ns/iter (± 274
)88948
ns/iter (± 286
)0.74
es2017_async_to_generator
65917
ns/iter (± 209
)89469
ns/iter (± 156
)0.74
es2016_exponentiation
71254
ns/iter (± 319
)96324
ns/iter (± 376
)0.74
es2015_arrow
74296
ns/iter (± 170
)99610
ns/iter (± 343
)0.75
es2015_block_scoped_fn
70933
ns/iter (± 232
)97321
ns/iter (± 375
)0.73
es2015_block_scoping
134190
ns/iter (± 318
)184897
ns/iter (± 244
)0.73
This comment was automatically generated by workflow using github-action-benchmark.