[api-extractor] Keep separate d.ts files but filter public API
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Start by reviewing API Extractor's reporting, rollups, and docs scenarios, especially dtsRollup, alongside TypeScript's per-module .d.ts output and the package.json exports mapping. Define how modules are crawled, public exports are filtered, and matching output files are generated. Done means separate non-empty .d.ts files preserve the source hierarchy, with discrepancies reported.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
I'd like to use the API extractor functionalities to track my public API and filter anything non-public from my d.ts files.
At the same time I want to keep separate d.ts files (one for every .mjs just like typescript prints it).
Unfortunately the dtsRollup works in a "bundle/barrel module" mindset where you only have a single library file.
Details
In the era of ESM the practice of "bundling" when publishing packages seem to vanish to support features like tree-shaking better. Same applies for "barrel modules" which contain all exports of your library.
Following this strategy it would be great if api-extractor could do it's magic without expecting a single barrel d.ts.
Imagine a tsc output of .mjs and .d.ts files matching the .ts file hierarchy. I'd expect:
- api-extractor to crawl the modules of my project and build the public API surface.
- Potentially the
exportsproperty of the package.json is consulted to filter what's really public from an NPM perspective (mapping might be tricky though). - api-extractor writes the output
d.tsfiles with the same hierarchy to a given output directory (empty d.ts files are omitted). - Any warnings on discrepancies of exports are reported (e.g. a public api exposes a filtered private one).
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.53.3 |
| Operating system? | Any |
| API Extractor scenario? | reporting (.api.md) / rollups (.d.ts) / docs (.api.json) |
| Would you consider contributing a PR? | Maybe, depends on the efforts |
| TypeScript compiler version? | 5.9.3 |
Node.js version (node -v)? |
v24.11.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 84/100
receptron/mulmoterminal#2264 ·
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
components-web-app/docs#96 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
simonsobs/tileviewer#114 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100