[api-extractor] Source map segment without a source crashes SourceMapper with "Target is a folder, not a file"
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
調査の方向性
apps/api-extractor/src/collector/SourceMapper.ts、特に #getMappedSourceLocation から始め、ソースのないソースマップのセグメントがどのように処理されるかを追ってください。issue には最小限の .d.ts.map 再現例があり、期待されるフォールバックも示されています。マップされたソースがない場合は、元の宣言位置を使います。API Extractor 7.59.4 で再現例を実行してください。完了の条件は、処理が終了し、foo に対して ae-missing-release-tag を報告することです。
索引モデルが issue の本文から書いたものです。
説明
Summary
API Extractor crashes when a .d.ts.map contains a mapping segment that has only a generated column and no source. The source map spec allows these segments, and rolldown 1.2.14 now emits them in declaration maps (rolldown/rolldown#11170). We hit this upgrading rolldown in https://github.com/sanity-io/sdk/pull/1445.
Repro steps
- Create these files:
package.json
{"name":"ae-repro","version":"1.0.0","types":"dist/index.d.ts"}
src/index.ts
export const foo: string = "foo"
dist/index.d.ts
export declare const foo: string
dist/index.d.ts.map (the second segment, qB, has one field: a generated column with no source)
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":"AAAA,qB"}
api-extractor.json
{
"projectFolder": ".",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
"apiReport": {"enabled": true, "reportFolder": "<projectFolder>/etc/"},
"docModel": {"enabled": false},
"dtsRollup": {"enabled": false},
"compiler": {"overrideTsconfig": {"compilerOptions": {"strict": true}}}
}
mkdir etc && npx @microsoft/[email protected] run --local
Expected result: The run completes and reports ae-missing-release-tag for foo. It does when the mappings are AAAA,qBAAqB.
Actual result:
ERROR: Target is a folder, not a file: undefined
Target is a folder, not a file: undefined
EISDIR: illegal operation on a directory, read
at Object.readFileSync (node:fs)
at FileSystem.readFile (@rushstack/node-core-library/src/FileSystem.ts:1066:12)
at SourceMapper.#getMappedSourceLocation (@microsoft/api-extractor/src/collector/SourceMapper.ts:130:56)
Details
SourceMapper.#getMappedSourceLocation takes the nearest mapping item and runs path.resolve(path.dirname(sourceFilePath), nearestMappingItem.source). For a source-less segment source is empty, so the path resolves to the .d.ts file's folder. FileSystem.exists returns true for it, and the read fails.
Treating a mapping item with no source as "no mapping" would fix it, so the original .d.ts location is used.
Standard questions
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.59.4 |
| Operating system? | Mac (also Linux in GitHub Actions) |
| API Extractor scenario? | reporting (.api.md) |
| Would you consider contributing a PR? | No |
| TypeScript compiler version? | 5.9.3 (bundled); also 6.0.3 in our project |
Node.js version (node -v)? |
24.12.0 (also 22 in CI) |
- 主要言語
- TypeScript
- スター
- 6.5k
- フォーク
- 710
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 36
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/rushstack のほかの issue
-
[rush-serve-plugin] The auto-picked port never reaches the port parameter: `_value` is ignored since ts-command-line uses `#value`対応中かも @b84330808 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[rush] Upgrade the pnpm-sync-lib dependency to 0.3.5.対応中かも @martinnaj が 22 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/rushstack#5971 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/rushstack の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
phivk/rubiks-lab#33 ·
メンテナーはふだん 1 日以内に返信
-
BUG:Edit Album strips spaces from the password so albums with a leading/trailing space in the password can't be edited対応中かも @ManyaJain111 が今日担当しました。 オープンbug enhancement possible-duplicate
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
AOSSIE-Org/PictoPy#1637 · コメント 4 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chaitin/MonkeyCode#1437 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
area:cards enhancement migration ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
fil-donadoni/tolaria#6309 ·
メンテナーはふだん 1 日以内に返信