forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
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. PR-URL: nodejs#53860 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
- Loading branch information
1 parent
ffd1ecc
commit f324d3d
Showing
11 changed files
with
166 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 * |
12 changes: 12 additions & 0 deletions
12
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,12 @@ | ||
// Flags: --enable-source-maps | ||
import '../../../common/index.mjs'; | ||
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 | ||
//# 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.
21 changes: 21 additions & 0 deletions
21
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,21 @@ | ||
// Flags: --enable-source-maps | ||
|
||
import '../../../common/index.mjs'; | ||
|
||
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 |
13 changes: 13 additions & 0 deletions
13
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,13 @@ | ||
*output*source_map_throw_construct.mts:13 | ||
throw new Error('message'); | ||
^ | ||
|
||
|
||
Error: message | ||
at new Foo (*output*source_map_throw_construct.mts:13:11) | ||
at <anonymous> (*output*source_map_throw_construct.mts:17: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