Indexed source maps: lastColumn is not clamped to the next section when the section does not start on line 1
Maintainer thường phản hồi trong vòng 5 ngày
@sebxt đang làm issue này rồi.
Từ ngày 18/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript
- Lĩnh vực
- devtools
Hướng nghiên cứu
Đọc IndexedSourceMapConsumer và kiểm tra các phép so sánh của generatedPositionFor, allGeneratedPositionsFor và eachMapping với dòng được tạo của section tiếp theo. Tái hiện vấn đề bằng source map gồm ba section được cung cấp, rồi chạy các bài kiểm thử source map liên quan. Công việc hoàn tất khi cả ba API giới hạn cột cuối cùng của section ở ranh giới section tiếp theo nếu section bắt đầu sau dòng 1.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
After computeColumnSpans(), IndexedSourceMapConsumer is supposed to clamp a mapping's lastColumn (or lastGeneratedColumn) so it ends where the next section begins on the same generated line. This only works for the first section, or more precisely for sections whose offset line is 0. For any later section the clamp is skipped, and in some layouts it is applied to the wrong line.
Repro:
const { SourceMapConsumer } = require("source-map");
const section = source => ({ version: 3, sources: [source], names: [], mappings: "AAAA" });
const map = await new SourceMapConsumer({
version: 3,
sections: [
{ offset: { line: 0, column: 0 }, map: section("a.js") },
{ offset: { line: 2, column: 0 }, map: section("b.js") },
{ offset: { line: 2, column: 10 }, map: section("c.js") },
],
});
map.computeColumnSpans();
map.generatedPositionFor({ source: "b.js", line: 1, column: 0 });
// actual: { line: 3, column: 0, lastColumn: Infinity }
// expected: { line: 3, column: 0, lastColumn: 9 }
allGeneratedPositionsFor and eachMapping (lastGeneratedColumn) return the same wrong value.
Root cause: in generatedPositionFor, allGeneratedPositionsFor and eachMapping of IndexedSourceMapConsumer, the comparison line === nextSection.generatedOffset.generatedLine runs before lineShift is added, so a section relative line is compared with an absolute line from the next section's offset. It only lines up when lineShift is 0. Adding the shift before the comparison fixes it.
- Ngôn ngữ chính
- JavaScript
- Star
- 3.7k
- Fork
- 392
- Merge trung bình
- 4 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mozilla/source-map
-
SourceMapConsumer.fromSourceMap ignores its sourceMapUrl argumentCó thể đã có người làm @sebxt đã nhận 17 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mozilla/source-map#544 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Indexed column spans ignore section line offsets when clipping at the next sectionCó thể đã có người làm @NUAAwqy đã nhận 24 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mozilla/source-map#539 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
wasm-mappings fail to build with Rust 1.96+Có thể đã có người làm @MatrixNeoKozak đã nhận 24 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
mozilla/source-map#530 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Indexed source maps: allGeneratedPositionsFor only returns positions from the first section that contains the sourceCó thể đã có người làm @RaphaelFakhri đã nhận 2 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
mozilla/source-map#564 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
allow wasm to be bundledCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
mozilla/source-map#527 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của mozilla/source-map
Issue tương tự
-
chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
idean3885/claude-ops-agent#910 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
S: triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
oskarrough/agent-ide#29 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Trinitas TV LogoĐang mởcheck:passed logos:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
WikiEducationFoundation/WikiEduDashboard#7258 ·
Maintainer thường phản hồi trong vòng 1 ngày