-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: decorate async stack trace in source maps
Decorate stack frame with 'async' and 'new' keywords based on the type of the call site info.
- Loading branch information
1 parent
6ba0af1
commit 69c5b63
Showing
11 changed files
with
160 additions
and
45 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
13 changes: 13 additions & 0 deletions
13
test/fixtures/source-map/output/source_map_throw_async_stack_trace.mjs
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,13 @@ | ||
// Flags: --enable-source-maps | ||
import '../../../common/index.mjs'; | ||
async function Throw() { | ||
await 0; | ||
throw new Error('message'); | ||
} | ||
(async function main() { | ||
await Promise.all([0, 1, 2, Throw()]); | ||
})(); | ||
// To recreate: | ||
// | ||
// npx --package typescript tsc --module nodenext --target esnext --outDir test/fixtures/source-map/output --sourceMap test/fixtures/source-map/output/source_map_throw_async_stack_trace.mts | ||
//# sourceMappingURL=source_map_throw_async_stack_trace.mjs.map |
1 change: 1 addition & 0 deletions
1
test/fixtures/source-map/output/source_map_throw_async_stack_trace.mjs.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
test/fixtures/source-map/output/source_map_throw_async_stack_trace.mts
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,22 @@ | ||
// Flags: --enable-source-maps | ||
|
||
import '../../../common/index.mjs'; | ||
|
||
interface Foo { | ||
/** line | ||
* | ||
* blocks */ | ||
} | ||
|
||
async function Throw() { | ||
await 0; | ||
throw new Error('message') | ||
} | ||
|
||
(async function main() { | ||
await Promise.all([0, 1, 2, Throw()]); | ||
})() | ||
|
||
// To recreate: | ||
// | ||
// npx --package typescript tsc --module nodenext --target esnext --outDir test/fixtures/source-map/output --sourceMap test/fixtures/source-map/output/source_map_throw_async_stack_trace.mts |
11 changes: 11 additions & 0 deletions
11
test/fixtures/source-map/output/source_map_throw_async_stack_trace.snapshot
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,11 @@ | ||
*output*source_map_throw_async_stack_trace.mts:13 | ||
throw new Error('message') | ||
^ | ||
|
||
|
||
Error: message | ||
at Throw (*output*source_map_throw_async_stack_trace.mts:13:9) | ||
at async Promise.all (index 3) | ||
at async main (*output*source_map_throw_async_stack_trace.mts:17:3) | ||
|
||
Node.js * |
11 changes: 11 additions & 0 deletions
11
test/fixtures/source-map/output/source_map_throw_construct.mjs
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,11 @@ | ||
class Foo { | ||
constructor() { | ||
throw new Error('message'); | ||
} | ||
} | ||
new Foo(); | ||
export {}; | ||
// To recreate: | ||
// | ||
// npx --package typescript tsc --module nodenext --target esnext --outDir test/fixtures/source-map/output --sourceMap test/fixtures/source-map/output/source_map_throw_construct.mts | ||
//# sourceMappingURL=source_map_throw_construct.mjs.map |
1 change: 1 addition & 0 deletions
1
test/fixtures/source-map/output/source_map_throw_construct.mjs.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
test/fixtures/source-map/output/source_map_throw_construct.mts
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 @@ | ||
interface Block { | ||
/** line | ||
* | ||
* blocks */ | ||
} | ||
|
||
class Foo { | ||
constructor() { | ||
throw new Error('message'); | ||
} | ||
} | ||
|
||
new Foo(); | ||
|
||
// To recreate: | ||
// | ||
// npx --package typescript tsc --module nodenext --target esnext --outDir test/fixtures/source-map/output --sourceMap test/fixtures/source-map/output/source_map_throw_construct.mts |
12 changes: 12 additions & 0 deletions
12
test/fixtures/source-map/output/source_map_throw_construct.snapshot
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,12 @@ | ||
file:**output*source_map_throw_construct.mjs:3 | ||
throw new Error('message'); | ||
^ | ||
|
||
Error: message | ||
at new Foo (file:**output*source_map_throw_construct.mjs:3:15) | ||
at file:**output*source_map_throw_construct.mjs:6:1 | ||
* | ||
* | ||
* | ||
|
||
Node.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
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