Improper handling of source maps with relative source roots
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- node.js, typescript
- 领域
- devtools
调研方向
从 issue 中引用的 src/hooks/instrument.ts 里的 transform() 位置开始,然后检查 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 小时
- 30 天内合并 PR
- 5
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 一周以上 新手友好度 20/100
getappmap/appmap-node#178 ·
维护者通常 1 天内回复
查看 getappmap/appmap-node 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
needs triage
难度 2/5 1-3 小时 新手友好度 76/100
homarr-labs/homarr#7191 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
AvaProtocol/ava-sdk-js#276 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
apollographql/apollo-client#13493 ·
维护者通常 1 天内回复