evanw / evanw/node-source-map-support

Node 12 "async" annotations are lost when using this package

Abierto
#243 3 comentarios 6 reacciones 0 asignados Ver en GitHub
bug help wanted
Lenguaje dominante
JavaScript
Estrellas
2.2k
Forks
223
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con la reproducción en Node 12 del issue y sigue la ruta de formateo del stack trace de source-map-support para encontrar dónde se elimina la anotación async. Se considera terminado cuando los stack traces mapeados conservan el marcador async mostrado por Node, con pruebas que cubran el ejemplo proporcionado y el comportamiento existente de los stack traces.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, node.js
Área
devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.