Indexed source maps: allGeneratedPositionsFor only returns positions from the first section that contains the source
维护者通常 5 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 30/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- devtools
调研方向
Start at IndexedSourceMapConsumer.prototype.allGeneratedPositionsFor and compare how it searches sections with how eachMapping reports mappings from both. Reproduce the example with two sections listing shared.js, then check that the result contains positions from both sections: lines 1 and 3, with columns 0 and 4. An open pull request (#565) is already linked to this issue.
由索引模型根据 Issue 内容生成。
描述
IndexedSourceMapConsumer.prototype.allGeneratedPositionsFor looks up the first section whose map lists the requested source and returns positions from that section only. When the same original source appears in more than one section, for example a shared helper module that two concatenated chunks both include, positions in the later sections are missing from the result. Tools that use this method to set breakpoints on an original line miss those generated locations.
Steps to reproduce
const { SourceMapConsumer } = require("source-map");
(async () => {
const map = await new SourceMapConsumer({
version: 3,
file: "min.js",
sections: [
{
offset: { line: 0, column: 0 },
map: { version: 3, sources: ["shared.js"], names: [], mappings: "AAAA" },
},
{
offset: { line: 2, column: 4 },
map: { version: 3, sources: ["shared.js"], names: [], mappings: "AAAA" },
},
],
});
console.log(
map.allGeneratedPositionsFor({ source: "shared.js", line: 1, column: 0 })
);
map.destroy();
})();
Expected result
[ { line: 1, column: 0, lastColumn: null }, { line: 3, column: 4, lastColumn: null } ]
Actual result
[ { line: 1, column: 0, lastColumn: null } ]
map.sources lists shared.js twice, and eachMapping reports both mappings, so only allGeneratedPositionsFor drops the second one.
Reproduced on master at 8c668f3.
- 主要语言
- JavaScript
- 星标
- 3.7k
- 派生
- 392
- 平均合并
- 4 天 18 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mozilla/source-map 的其他 Issue
-
SourceMapConsumer.fromSourceMap ignores its sourceMapUrl argument可能已有人在做 @sebxt 于 17 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
mozilla/source-map#544 ·
维护者通常 5 天内回复
-
Indexed source maps: lastColumn is not clamped to the next section when the section does not start on line 1可能已有人在做 @sebxt 于 19 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
mozilla/source-map#542 ·
维护者通常 5 天内回复
-
Indexed column spans ignore section line offsets when clipping at the next section可能已有人在做 @NUAAwqy 于 24 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
mozilla/source-map#539 ·
维护者通常 5 天内回复
-
wasm-mappings fail to build with Rust 1.96+可能已有人在做 @MatrixNeoKozak 于 25 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
mozilla/source-map#530 ·
维护者通常 5 天内回复
-
allow wasm to be bundled可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 4/5 3-5 天 新手友好度 55/100
mozilla/source-map#527 ·
维护者通常 5 天内回复
查看 mozilla/source-map 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
Fei-Away/Codex-Dream-Skin#449 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
outline/outline#14489 · 1 条评论 ·
维护者通常 1 天内回复
-
Claude Code plugin does not wire the edit-time Floor hook可能已有人在做 @dgr8akki 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
Administration: required plugin configuration field stays invalid after restoring its saved value未关闭needs-triage Platform(Default)
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复