Improper handling of source maps with relative source roots
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- node.js, typescript
- 領域
- devtools
調査の方向性
issue で参照されている transform() の箇所にある src/hooks/instrument.ts から始め、次に WIP ブランチ source-map-relative-root を調べて TypeORM の例を再現します。相対的な sourceRoot が作業ディレクトリではなく source map の URL を基準に解決されることを確認し、結果の location.path が妥当であることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Source maps can have sourceRoot property; it's defined as a string that's prepended to every entry in the sources list. The specification doesn't put any constraints on this field; consequently, this can be a relative directory (eg. ..).
In my understanding, the intended semantics is that it's to be resolved relative to the URL of the source map itself, eg. given { sourceRoot: '..', sources: 'a.js' } and source map at file:///example/source.js.map the resolved source URL should be ../a.js => file:///a.js.
appmap-node does not handle this case correctly. Consider for example typeorm-0.3.20; metadata-args/MetadataArgsStorage.js.map contains:
$ jq '{sources, sourceRoot}' node_modules/typeorm/metadata-args/MetadataArgsStorage.js.map
{
"sources": [
"../../src/metadata-args/MetadataArgsStorage.ts"
],
"sourceRoot": ".."
}
However, when instrumenting the file, relevant location.path in transform() (as determined by the debugger) reads nonsensical ../home/divide/projects/tmp/NestJS-TypeORM-Example/node_modules/typeorm/metadata-args/src/metadata-args/MetadataArgsStorage.ts (note the working directory in this run is /home/divide/projects/tmp/NestJS-TypeORM-Example/).
(The path as indicated by the source map would be incorrect in any case (file:////home/divide/projects/tmp/NestJS-TypeORM-Example/src/metadata-args/MetadataArgsStorage.ts by my reading) which seems to be a bug in typeorm build, but that's beside the point.)
Note: I started working on this issue, here's a WIP branch: https://github.com/getappmap/appmap-node/tree/wip/source-map-relative-root
- 主要言語
- TypeScript
- スター
- 13
- フォーク
- 6
- 平均マージ
- 4日 14時間
- マージ済み PR(30日)
- 5
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getappmap/appmap-node のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
getappmap/appmap-node#183 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
getappmap/appmap-node#182 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
getappmap/appmap-node#180 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
getappmap/appmap-node#179 ·
メンテナーはふだん 1 日以内に返信
-
Support TypeORMオープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
getappmap/appmap-node#178 ·
メンテナーはふだん 1 日以内に返信
getappmap/appmap-node の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
status:approved type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
stage:4
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
ilan-pinto/roaring-lions#598 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Frontmatter next to `src:` is applied to every imported slide, not only the first (undocumented)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信