evanw / evanw/node-source-map-support

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

オープン
#243 コメント 3 件 リアクション 6 件 担当者 0 名 GitHub で見る
bug help wanted
主要言語
JavaScript
スター
2.2k
フォーク
223
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

issue にある Node 12 の再現手順から始め、source-map-support のスタックトレースフォーマット処理を追って、async アノテーションが削除される箇所を見つけてください。完了条件は、マップ済みスタックトレースが Node に表示される async マーカーを保持し、提示された例と既存のスタックトレースの動作をテストでカバーすることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。