microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.93k stars 595 forks source link

[api-extractor] api report generation fails if entry point resolves to file without exports #2806

Open devversion opened 3 years ago

devversion commented 3 years ago

Summary

Consider a library that has multiple entry-points. e.g.

@angular/cdk | no exports
@angular/cdk/a11y | has exports

If I want to set up API report tests for these entry-points of my NPM package, then the @angular/cdk primary entry-point API report generation fails since @angular/cdk/index.d.ts does not have any exports and is not considered a TypeScript module. e.g.

InternalError: Internal Error: Unable to determine module for <...>
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
    at ExportAnalyzer._getModuleSymbolFromSourceFile (C:\users\paul\_bazel_paul\ne4zsv7p\external\npm\node_modules\@microsoft\api-extractor
\lib\analyzer\ExportAnalyzer.js:170:15)
    at ExportAnalyzer.fetchAstModuleFromSourceFile (C:\users\paul\_bazel_paul\ne4zsv7p\external\npm\node_modules\@microsoft\api-extractor\l
ib\analyzer\ExportAnalyzer.js:64:35)
    at AstSymbolTable.fetchAstModuleFromWorkingPackage (C:\users\paul\_bazel_paul\ne4zsv7p\external\npm\node_modules\@microsoft\api-extract
or\lib\analyzer\AstSymbolTable.js:79:37)
    at Collector.analyze (C:\users\paul\_bazel_paul\ne4zsv7p\external\npm\node_modules\@microsoft\api-extractor\lib\collector\Collector.js:
139:51)

Expected result: An API report file to be generated that does not contain any exports. This helps ensuring that no exports are accidentally introduced..

Actual result: A runtime error.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.18.1
TypeScript compiler version? 4.3
Rambou commented 2 years ago

Any news on this?