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 於 19 天前認領。 未關閉
難度 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 於 21 天前認領。 未關閉
難度 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 於 27 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
mozilla/source-map#539 ·
維護者通常 5 天內回覆
-
wasm-mappings fail to build with Rust 1.96+可能已有人在做 @MatrixNeoKozak 於 27 天前認領。 未關閉
難度 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
-
area:models enhancement
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
status: ready
難度 2/5 1-3 小時 新手友好度 68/100
melodic-software/claude-code-plugins#14389 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 72/100
-
難度 2/5 1-3 小時 新手友好度 78/100