[api-extractor] Fails to parse `bundledPackages` declarations from dir import
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Start in ExportAnalyzer.ts, focusing on TypeScriptInternals.getResolvedModule and how the resolved module data is used for bundledPackages checks. Use the linked reproduction repository with the bundledPackages and directory-import example, then verify that the generated declaration contains an inlined export declaration rather than an import from './bar-dir'.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When using bundledPackages options, import declaration from dir generates incorrect dts result.
e.g. configure "bundledPackages": ["foo"], with following foo package files:
- index.d.ts
export { Bar } from './bar-dir'; - bar-dir/index.d.ts
export interface Bar {}
and following entry dts file:
export * from "foo";
generates dts result:
import { Bar } from './bar-dir';
export { Bar }
Repro steps
Expected result:
Previous example should generate:
export declare interface Bar {}
or reproduce by: https://github.com/adventure-yunfei/api-extractor-issue--bundledPackages
Details
Debugged and found the reason, introduced by #3321. For import declaration from dir (e.g., import { A } from "./a", while resolved file is a/index.d.ts), TypeScriptInternals.getResolvedModule (in ExportAnalyzer.ts) returns the result without packageId data, thus bundledPackages check is skipped (cause bug here).
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.53.1 |
| Operating system? | Mac |
| API Extractor scenario? | rollups (.d.ts) |
| Would you consider contributing a PR? | No |
| TypeScript compiler version? | 5.8.2 |
Node.js version (node -v)? |
v16.20.0 |
- Ngôn ngữ chính
- TypeScript
- Star
- 6.5k
- Fork
- 708
- Merge trung bình
- 4 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 62
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
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
-
security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
IBM/node-sdk-core#373 ·
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100