evanw / evanw/node-source-map-support
Node 12 "async" annotations are lost when using this package
- Langage dominant
- JavaScript
- Étoiles
- 2.2k
- Forks
- 223
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Node 12 added some limited support for async stack traces. I'm impressed that this package supports them, but it removes a useful annotation from them:
Given this file:
```js
function p() {
return new Promise(resolve => setTimeout(resolve, 0))
}
async function f() {
await p()
throw Error("")
}
async function main() {
await f()
}
main()
.catch(console.error)
```
The stack traces without registering `source-map-support` is:
```
Error
at f (/private/tmp/async-stack-traces/index.js:9:9)
at async main (/private/tmp/async-stack-traces/index.js:13:3)
```
With `source-map-support` registered is:
```
Error:
at f (/private/tmp/async-stack-traces/index.js:9:9)
at main (/private/tmp/async-stack-traces/index.js:13:3)
```
I think the `async` annotation there is useful, as this stack trace is not the actual one as seen by v8, but an augmented one. This augmentation doesn't always work, and it would be surprising to the user if they look like normal stack traces.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par la reproduction avec Node 12 dans l’issue et suivez le chemin de formatage de la stack trace de source-map-support pour trouver où l’annotation async est supprimée. C’est terminé lorsque les stack traces mappées conservent le marqueur async affiché par Node, avec des tests couvrant l’exemple fourni et le comportement existant des stack traces.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, node.js
- Domaine
- devtools
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100