Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Indexed column spans ignore section line offsets when clipping at the next section

オープン 初心者向け
#539 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@NUAAwqy がすでに取り組んでいます。

2026年10月13日 から。

  • #540 @NUAAwqy による — オープン

評価

難易度
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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mozilla/source-map のほかの issue

mozilla/source-map の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。