[api-extractor] Source map segment without a source crashes SourceMapper with "Target is a folder, not a file"
Maintainer thường phản hồi trong vòng 1 ngày
Đá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ệ
- node.js, typescript
Hướng nghiên cứu
Bắt đầu trong apps/api-extractor/src/collector/SourceMapper.ts, đặc biệt là ở #getMappedSourceLocation, rồi theo dõi cách xử lý các đoạn source map không có nguồn. Issue cung cấp một trường hợp tái hiện tối giản bằng .d.ts.map và nêu rõ phương án dự phòng mong đợi: dùng vị trí khai báo ban đầu khi không có nguồn được ánh xạ. Chạy trường hợp tái hiện bằng API Extractor 7.59.4; hoàn tất nghĩa là chạy xong và báo ae-missing-release-tag cho foo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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) |
- Ngôn ngữ chính
- TypeScript
- Star
- 6.5k
- Fork
- 710
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 36
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không 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 microsoft/rushstack
-
[rush-serve-plugin] The auto-picked port never reaches the port parameter: `_value` is ignored since ts-command-line uses `#value`Có thể đã có người làm @b84330808 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/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 68/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 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 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[rush] Upgrade the pnpm-sync-lib dependency to 0.3.5.Có thể đã có người làm @martinnaj đã nhận 21 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
microsoft/rushstack#5971 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/rushstack
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
paperclipai/paperclip#17151 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
AgoraIO-Extensions/agent-infra#3159 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
blocklist addition
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
MetaMask/eth-phishing-detect#304596 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
friction
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
kentcdodds/kody#4142 ·
-
[Bug] Statistics | Task statistics are always empty on MikroORM with MySQL or SQLiteCó thể đã có người làm @NdekoCode đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ever-co/ever-gauzy#11214 ·
Maintainer thường phản hồi trong vòng 1 ngày