Indexed column spans ignore section line offsets when clipping at the next section
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript
- 領域
- tooling
調査の方向性
再現スクリプトから始めてください。このスクリプトは、オフセットが4行目にある2つのインデックス付きセクションを持つ SourceMapConsumer を使用しています。computeColumnSpans() を呼び出し、generatedPositionFor、allGeneratedPositionsFor、eachMapping を確認します。バグは、オフセットが適用される前に、セクションローカルの生成行を次のセクションの絶対行と比較するセクション境界チェックにあります。最初のマッピングがカラム9で終わり、3つのAPIすべての回帰テストが通れば完了です。後のローカル行に境界がある場合のテストも含まれます。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- JavaScript
- スター
- 3.7k
- フォーク
- 374
- 平均マージ
- 4日 18時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mozilla/source-map のほかの issue
-
wasm-mappings fail to build with Rust 1.96+対応中かも @MatrixNeoKozak が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
mozilla/source-map#530 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
mozilla/source-map#527 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
mozilla/source-map#524 · コメント 6 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
mozilla/source-map#516 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
mozilla/source-map#510 · リアクション 1 件 ·
mozilla/source-map の issue をすべて見る
似ている issue
-
[BUG]: Prompt compressor crashes with TypeError when a past chat has a non-string response.text対応中かも @ManojDevarajulu が今日担当しました。 オープンpossible bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Mintplex-Labs/anything-llm#6737 ·
メンテナーはふだん 1 日以内に返信
-
check:passed feeds:add
難易度 2/5 1時間未満 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
motiondivision/motion#3935 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
codex-team/editor.js#3037 ·
-
No Code Attached Yet
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
joomla/joomla-cms#48626 ·
メンテナーはふだん 1 日以内に返信