Indexed column spans ignore section line offsets when clipping at the next section
Đá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
- 72/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
- tooling
Hướng nghiên cứu
Bắt đầu từ script tái tạo lỗi, script này dùng SourceMapConsumer với hai section có chỉ mục mà offset nằm ở dòng 4. Gọi computeColumnSpans() và kiểm tra generatedPositionFor, allGeneratedPositionsFor và eachMapping. Lỗi nằm ở chỗ kiểm tra ranh giới section so sánh dòng được tạo cục bộ trong section với dòng tuyệt đối của section tiếp theo trước khi offset được áp dụng. Công việc được coi là xong khi mapping đầu tiên kết thúc ở cột 9 và các test hồi quy cho cả ba API đều pass, bao gồm một trường hợp có ranh giới ở dòng cục bộ phía sau.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Indexed maps whose first section has a nonzero line offset return a column span that extends into the next section on the same generated line.
Minimal reproduction on master (8c668f3):
const { SourceMapConsumer } = require("source-map");
(async () => {
const consumer = await new SourceMapConsumer({
version: 3,
sections: [
{
offset: { line: 4, column: 3 },
map: { version: 3, sources: ["first.js"], names: [], mappings: "AAAA" },
},
{
offset: { line: 4, column: 10 },
map: { version: 3, sources: ["second.js"], names: [], mappings: "AAAA" },
},
],
});
try {
consumer.computeColumnSpans();
console.log(consumer.generatedPositionFor({
source: "first.js", line: 1, column: 0,
}));
console.log(consumer.allGeneratedPositionsFor({
source: "first.js", line: 1, column: 0,
}));
consumer.eachMapping(console.log);
} finally {
consumer.destroy();
}
})();
Expected: the first mapping is at generated line 5, column 3, with an inclusive last column of 9 because the second section starts at column 10.
Actual: both position queries return lastColumn: Infinity, and eachMapping returns lastGeneratedColumn: Infinity for that mapping.
The section-boundary check compares a section-local generated line to the next section's absolute generated line before applying the line offset. The same ordering occurs in all three APIs. A boundary on a later local line is affected too; a zero line offset hides the problem.
I have a focused fix and regression tests ready. All 202 tests and lint pass with the fix; the three affected API tests fail on the original code.
- Ngôn ngữ chính
- JavaScript
- Star
- 3.7k
- Fork
- 374
- 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
-
wasm-mappings fail to build with Rust 1.96+Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đ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 ·
-
allow wasm to be bundledĐ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 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
mozilla/source-map#524 · 6 bình luận ·
-
source map seems like not work, is there some hints from the perspective of source-map tool?Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
mozilla/source-map#516 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
mozilla/source-map#510 · 1 reaction ·
Tất cả issue của mozilla/source-map
Issue tương tự
-
Add: Tooncast brazil feedĐang mởcheck:passed feeds:add
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 62/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
codex-team/editor.js#3037 ·
-
No Code Attached Yet
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
joomla/joomla-cms#48626 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
complexity: trivial good first issue impact: low
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
ueberdosis/tiptap#8522 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
internal os specific
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
frostney/GocciaScript#1688 ·
Maintainer thường phản hồi trong vòng 1 ngày