@microsoft/api-extractor 7.56.3 → 7.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +58 -0
- package/CHANGELOG.md +15 -1
- package/bin/api-extractor +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-esm/aedoc/PackageDocComment.js +56 -0
- package/lib-esm/aedoc/PackageDocComment.js.map +1 -0
- package/lib-esm/analyzer/AstDeclaration.js +214 -0
- package/lib-esm/analyzer/AstDeclaration.js.map +1 -0
- package/lib-esm/analyzer/AstEntity.js +35 -0
- package/lib-esm/analyzer/AstEntity.js.map +1 -0
- package/lib-esm/analyzer/AstImport.js +76 -0
- package/lib-esm/analyzer/AstImport.js.map +1 -0
- package/lib-esm/analyzer/AstModule.js +22 -0
- package/lib-esm/analyzer/AstModule.js.map +1 -0
- package/lib-esm/analyzer/AstNamespaceExport.js +38 -0
- package/lib-esm/analyzer/AstNamespaceExport.js.map +1 -0
- package/lib-esm/analyzer/AstNamespaceImport.js +57 -0
- package/lib-esm/analyzer/AstNamespaceImport.js.map +1 -0
- package/lib-esm/analyzer/AstReferenceResolver.js +202 -0
- package/lib-esm/analyzer/AstReferenceResolver.js.map +1 -0
- package/lib-esm/analyzer/AstSymbol.js +104 -0
- package/lib-esm/analyzer/AstSymbol.js.map +1 -0
- package/lib-esm/analyzer/AstSymbolTable.js +524 -0
- package/lib-esm/analyzer/AstSymbolTable.js.map +1 -0
- package/lib-esm/analyzer/ExportAnalyzer.js +725 -0
- package/lib-esm/analyzer/ExportAnalyzer.js.map +1 -0
- package/lib-esm/analyzer/PackageMetadataManager.js +235 -0
- package/lib-esm/analyzer/PackageMetadataManager.js.map +1 -0
- package/lib-esm/analyzer/SourceFileLocationFormatter.js +44 -0
- package/lib-esm/analyzer/SourceFileLocationFormatter.js.map +1 -0
- package/lib-esm/analyzer/Span.js +545 -0
- package/lib-esm/analyzer/Span.js.map +1 -0
- package/lib-esm/analyzer/SyntaxHelpers.js +72 -0
- package/lib-esm/analyzer/SyntaxHelpers.js.map +1 -0
- package/lib-esm/analyzer/TypeScriptHelpers.js +242 -0
- package/lib-esm/analyzer/TypeScriptHelpers.js.map +1 -0
- package/lib-esm/analyzer/TypeScriptInternals.js +114 -0
- package/lib-esm/analyzer/TypeScriptInternals.js.map +1 -0
- package/lib-esm/api/CompilerState.js +149 -0
- package/lib-esm/api/CompilerState.js.map +1 -0
- package/lib-esm/api/ConsoleMessageId.js +82 -0
- package/lib-esm/api/ConsoleMessageId.js.map +1 -0
- package/lib-esm/api/Extractor.js +290 -0
- package/lib-esm/api/Extractor.js.map +1 -0
- package/lib-esm/api/ExtractorConfig.js +801 -0
- package/lib-esm/api/ExtractorConfig.js.map +1 -0
- package/lib-esm/api/ExtractorLogLevel.js +46 -0
- package/lib-esm/api/ExtractorLogLevel.js.map +1 -0
- package/lib-esm/api/ExtractorMessage.js +140 -0
- package/lib-esm/api/ExtractorMessage.js.map +1 -0
- package/lib-esm/api/ExtractorMessageId.js +128 -0
- package/lib-esm/api/ExtractorMessageId.js.map +1 -0
- package/lib-esm/api/IConfigFile.js +4 -0
- package/lib-esm/api/IConfigFile.js.map +1 -0
- package/lib-esm/cli/ApiExtractorCommandLine.js +51 -0
- package/lib-esm/cli/ApiExtractorCommandLine.js.map +1 -0
- package/lib-esm/cli/InitAction.js +35 -0
- package/lib-esm/cli/InitAction.js.map +1 -0
- package/lib-esm/cli/RunAction.js +123 -0
- package/lib-esm/cli/RunAction.js.map +1 -0
- package/lib-esm/collector/ApiItemMetadata.js +55 -0
- package/lib-esm/collector/ApiItemMetadata.js.map +1 -0
- package/lib-esm/collector/Collector.js +794 -0
- package/lib-esm/collector/Collector.js.map +1 -0
- package/lib-esm/collector/CollectorEntity.js +219 -0
- package/lib-esm/collector/CollectorEntity.js.map +1 -0
- package/lib-esm/collector/DeclarationMetadata.js +24 -0
- package/lib-esm/collector/DeclarationMetadata.js.map +1 -0
- package/lib-esm/collector/MessageRouter.js +476 -0
- package/lib-esm/collector/MessageRouter.js.map +1 -0
- package/lib-esm/collector/SourceMapper.js +171 -0
- package/lib-esm/collector/SourceMapper.js.map +1 -0
- package/lib-esm/collector/SymbolMetadata.js +12 -0
- package/lib-esm/collector/SymbolMetadata.js.map +1 -0
- package/lib-esm/collector/VisitorState.js +23 -0
- package/lib-esm/collector/VisitorState.js.map +1 -0
- package/lib-esm/collector/WorkingPackage.js +30 -0
- package/lib-esm/collector/WorkingPackage.js.map +1 -0
- package/lib-esm/enhancers/DocCommentEnhancer.js +213 -0
- package/lib-esm/enhancers/DocCommentEnhancer.js.map +1 -0
- package/lib-esm/enhancers/ValidationEnhancer.js +217 -0
- package/lib-esm/enhancers/ValidationEnhancer.js.map +1 -0
- package/lib-esm/generators/ApiModelGenerator.js +852 -0
- package/lib-esm/generators/ApiModelGenerator.js.map +1 -0
- package/lib-esm/generators/ApiReportGenerator.js +518 -0
- package/lib-esm/generators/ApiReportGenerator.js.map +1 -0
- package/lib-esm/generators/DeclarationReferenceGenerator.js +292 -0
- package/lib-esm/generators/DeclarationReferenceGenerator.js.map +1 -0
- package/lib-esm/generators/DtsEmitHelpers.js +227 -0
- package/lib-esm/generators/DtsEmitHelpers.js.map +1 -0
- package/lib-esm/generators/DtsRollupGenerator.js +391 -0
- package/lib-esm/generators/DtsRollupGenerator.js.map +1 -0
- package/lib-esm/generators/ExcerptBuilder.js +259 -0
- package/lib-esm/generators/ExcerptBuilder.js.map +1 -0
- package/lib-esm/generators/IndentedWriter.js +238 -0
- package/lib-esm/generators/IndentedWriter.js.map +1 -0
- package/lib-esm/index.js +17 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/schemas/api-extractor-defaults.json +94 -0
- package/lib-esm/schemas/api-extractor-template.json +454 -0
- package/lib-esm/schemas/api-extractor.schema.json +257 -0
- package/lib-esm/start.js +14 -0
- package/lib-esm/start.js.map +1 -0
- package/package.json +37 -9
- /package/{lib → lib-commonjs}/aedoc/PackageDocComment.js +0 -0
- /package/{lib → lib-commonjs}/aedoc/PackageDocComment.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstDeclaration.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstDeclaration.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstEntity.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstEntity.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstImport.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstImport.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstModule.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstModule.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstNamespaceExport.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstNamespaceExport.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstNamespaceImport.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstNamespaceImport.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstReferenceResolver.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstReferenceResolver.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstSymbol.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstSymbol.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstSymbolTable.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/AstSymbolTable.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/ExportAnalyzer.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/ExportAnalyzer.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/PackageMetadataManager.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/PackageMetadataManager.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/SourceFileLocationFormatter.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/SourceFileLocationFormatter.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/Span.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/Span.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/SyntaxHelpers.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/SyntaxHelpers.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/TypeScriptHelpers.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/TypeScriptHelpers.js.map +0 -0
- /package/{lib → lib-commonjs}/analyzer/TypeScriptInternals.js +0 -0
- /package/{lib → lib-commonjs}/analyzer/TypeScriptInternals.js.map +0 -0
- /package/{lib → lib-commonjs}/api/CompilerState.js +0 -0
- /package/{lib → lib-commonjs}/api/CompilerState.js.map +0 -0
- /package/{lib → lib-commonjs}/api/ConsoleMessageId.js +0 -0
- /package/{lib → lib-commonjs}/api/ConsoleMessageId.js.map +0 -0
- /package/{lib → lib-commonjs}/api/Extractor.js +0 -0
- /package/{lib → lib-commonjs}/api/Extractor.js.map +0 -0
- /package/{lib → lib-commonjs}/api/ExtractorConfig.js +0 -0
- /package/{lib → lib-commonjs}/api/ExtractorConfig.js.map +0 -0
- /package/{lib → lib-commonjs}/api/ExtractorLogLevel.js +0 -0
- /package/{lib → lib-commonjs}/api/ExtractorLogLevel.js.map +0 -0
- /package/{lib → lib-commonjs}/api/ExtractorMessage.js +0 -0
- /package/{lib → lib-commonjs}/api/ExtractorMessage.js.map +0 -0
- /package/{lib → lib-commonjs}/api/ExtractorMessageId.js +0 -0
- /package/{lib → lib-commonjs}/api/ExtractorMessageId.js.map +0 -0
- /package/{lib → lib-commonjs}/api/IConfigFile.js +0 -0
- /package/{lib → lib-commonjs}/api/IConfigFile.js.map +0 -0
- /package/{lib → lib-commonjs}/cli/ApiExtractorCommandLine.js +0 -0
- /package/{lib → lib-commonjs}/cli/ApiExtractorCommandLine.js.map +0 -0
- /package/{lib → lib-commonjs}/cli/InitAction.js +0 -0
- /package/{lib → lib-commonjs}/cli/InitAction.js.map +0 -0
- /package/{lib → lib-commonjs}/cli/RunAction.js +0 -0
- /package/{lib → lib-commonjs}/cli/RunAction.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/ApiItemMetadata.js +0 -0
- /package/{lib → lib-commonjs}/collector/ApiItemMetadata.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/Collector.js +0 -0
- /package/{lib → lib-commonjs}/collector/Collector.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/CollectorEntity.js +0 -0
- /package/{lib → lib-commonjs}/collector/CollectorEntity.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/DeclarationMetadata.js +0 -0
- /package/{lib → lib-commonjs}/collector/DeclarationMetadata.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/MessageRouter.js +0 -0
- /package/{lib → lib-commonjs}/collector/MessageRouter.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/SourceMapper.js +0 -0
- /package/{lib → lib-commonjs}/collector/SourceMapper.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/SymbolMetadata.js +0 -0
- /package/{lib → lib-commonjs}/collector/SymbolMetadata.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/VisitorState.js +0 -0
- /package/{lib → lib-commonjs}/collector/VisitorState.js.map +0 -0
- /package/{lib → lib-commonjs}/collector/WorkingPackage.js +0 -0
- /package/{lib → lib-commonjs}/collector/WorkingPackage.js.map +0 -0
- /package/{lib → lib-commonjs}/enhancers/DocCommentEnhancer.js +0 -0
- /package/{lib → lib-commonjs}/enhancers/DocCommentEnhancer.js.map +0 -0
- /package/{lib → lib-commonjs}/enhancers/ValidationEnhancer.js +0 -0
- /package/{lib → lib-commonjs}/enhancers/ValidationEnhancer.js.map +0 -0
- /package/{lib → lib-commonjs}/generators/ApiModelGenerator.js +0 -0
- /package/{lib → lib-commonjs}/generators/ApiModelGenerator.js.map +0 -0
- /package/{lib → lib-commonjs}/generators/ApiReportGenerator.js +0 -0
- /package/{lib → lib-commonjs}/generators/ApiReportGenerator.js.map +0 -0
- /package/{lib → lib-commonjs}/generators/DeclarationReferenceGenerator.js +0 -0
- /package/{lib → lib-commonjs}/generators/DeclarationReferenceGenerator.js.map +0 -0
- /package/{lib → lib-commonjs}/generators/DtsEmitHelpers.js +0 -0
- /package/{lib → lib-commonjs}/generators/DtsEmitHelpers.js.map +0 -0
- /package/{lib → lib-commonjs}/generators/DtsRollupGenerator.js +0 -0
- /package/{lib → lib-commonjs}/generators/DtsRollupGenerator.js.map +0 -0
- /package/{lib → lib-commonjs}/generators/ExcerptBuilder.js +0 -0
- /package/{lib → lib-commonjs}/generators/ExcerptBuilder.js.map +0 -0
- /package/{lib → lib-commonjs}/generators/IndentedWriter.js +0 -0
- /package/{lib → lib-commonjs}/generators/IndentedWriter.js.map +0 -0
- /package/{lib → lib-commonjs}/index.js +0 -0
- /package/{lib → lib-commonjs}/index.js.map +0 -0
- /package/{lib → lib-commonjs}/schemas/api-extractor-defaults.json +0 -0
- /package/{lib → lib-commonjs}/schemas/api-extractor-template.json +0 -0
- /package/{lib → lib-commonjs}/schemas/api-extractor.schema.json +0 -0
- /package/{lib → lib-commonjs}/start.js +0 -0
- /package/{lib → lib-commonjs}/start.js.map +0 -0
- /package/{lib → lib-dts}/aedoc/PackageDocComment.d.ts +0 -0
- /package/{lib → lib-dts}/aedoc/PackageDocComment.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstDeclaration.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstDeclaration.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstEntity.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstEntity.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstImport.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstImport.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstModule.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstModule.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstNamespaceExport.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstNamespaceExport.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstNamespaceImport.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstNamespaceImport.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstReferenceResolver.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstReferenceResolver.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstSymbol.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstSymbol.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/AstSymbolTable.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/AstSymbolTable.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/ExportAnalyzer.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/ExportAnalyzer.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/PackageMetadataManager.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/PackageMetadataManager.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/SourceFileLocationFormatter.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/SourceFileLocationFormatter.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/Span.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/Span.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/SyntaxHelpers.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/SyntaxHelpers.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/TypeScriptHelpers.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/TypeScriptHelpers.d.ts.map +0 -0
- /package/{lib → lib-dts}/analyzer/TypeScriptInternals.d.ts +0 -0
- /package/{lib → lib-dts}/analyzer/TypeScriptInternals.d.ts.map +0 -0
- /package/{lib → lib-dts}/api/CompilerState.d.ts +0 -0
- /package/{lib → lib-dts}/api/CompilerState.d.ts.map +0 -0
- /package/{lib → lib-dts}/api/ConsoleMessageId.d.ts +0 -0
- /package/{lib → lib-dts}/api/ConsoleMessageId.d.ts.map +0 -0
- /package/{lib → lib-dts}/api/Extractor.d.ts +0 -0
- /package/{lib → lib-dts}/api/Extractor.d.ts.map +0 -0
- /package/{lib → lib-dts}/api/ExtractorConfig.d.ts +0 -0
- /package/{lib → lib-dts}/api/ExtractorConfig.d.ts.map +0 -0
- /package/{lib → lib-dts}/api/ExtractorLogLevel.d.ts +0 -0
- /package/{lib → lib-dts}/api/ExtractorLogLevel.d.ts.map +0 -0
- /package/{lib → lib-dts}/api/ExtractorMessage.d.ts +0 -0
- /package/{lib → lib-dts}/api/ExtractorMessage.d.ts.map +0 -0
- /package/{lib → lib-dts}/api/ExtractorMessageId.d.ts +0 -0
- /package/{lib → lib-dts}/api/ExtractorMessageId.d.ts.map +0 -0
- /package/{lib → lib-dts}/api/IConfigFile.d.ts +0 -0
- /package/{lib → lib-dts}/api/IConfigFile.d.ts.map +0 -0
- /package/{lib → lib-dts}/cli/ApiExtractorCommandLine.d.ts +0 -0
- /package/{lib → lib-dts}/cli/ApiExtractorCommandLine.d.ts.map +0 -0
- /package/{lib → lib-dts}/cli/InitAction.d.ts +0 -0
- /package/{lib → lib-dts}/cli/InitAction.d.ts.map +0 -0
- /package/{lib → lib-dts}/cli/RunAction.d.ts +0 -0
- /package/{lib → lib-dts}/cli/RunAction.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/ApiItemMetadata.d.ts +0 -0
- /package/{lib → lib-dts}/collector/ApiItemMetadata.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/Collector.d.ts +0 -0
- /package/{lib → lib-dts}/collector/Collector.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/CollectorEntity.d.ts +0 -0
- /package/{lib → lib-dts}/collector/CollectorEntity.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/DeclarationMetadata.d.ts +0 -0
- /package/{lib → lib-dts}/collector/DeclarationMetadata.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/MessageRouter.d.ts +0 -0
- /package/{lib → lib-dts}/collector/MessageRouter.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/SourceMapper.d.ts +0 -0
- /package/{lib → lib-dts}/collector/SourceMapper.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/SymbolMetadata.d.ts +0 -0
- /package/{lib → lib-dts}/collector/SymbolMetadata.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/VisitorState.d.ts +0 -0
- /package/{lib → lib-dts}/collector/VisitorState.d.ts.map +0 -0
- /package/{lib → lib-dts}/collector/WorkingPackage.d.ts +0 -0
- /package/{lib → lib-dts}/collector/WorkingPackage.d.ts.map +0 -0
- /package/{lib → lib-dts}/enhancers/DocCommentEnhancer.d.ts +0 -0
- /package/{lib → lib-dts}/enhancers/DocCommentEnhancer.d.ts.map +0 -0
- /package/{lib → lib-dts}/enhancers/ValidationEnhancer.d.ts +0 -0
- /package/{lib → lib-dts}/enhancers/ValidationEnhancer.d.ts.map +0 -0
- /package/{lib → lib-dts}/generators/ApiModelGenerator.d.ts +0 -0
- /package/{lib → lib-dts}/generators/ApiModelGenerator.d.ts.map +0 -0
- /package/{lib → lib-dts}/generators/ApiReportGenerator.d.ts +0 -0
- /package/{lib → lib-dts}/generators/ApiReportGenerator.d.ts.map +0 -0
- /package/{lib → lib-dts}/generators/DeclarationReferenceGenerator.d.ts +0 -0
- /package/{lib → lib-dts}/generators/DeclarationReferenceGenerator.d.ts.map +0 -0
- /package/{lib → lib-dts}/generators/DtsEmitHelpers.d.ts +0 -0
- /package/{lib → lib-dts}/generators/DtsEmitHelpers.d.ts.map +0 -0
- /package/{lib → lib-dts}/generators/DtsRollupGenerator.d.ts +0 -0
- /package/{lib → lib-dts}/generators/DtsRollupGenerator.d.ts.map +0 -0
- /package/{lib → lib-dts}/generators/ExcerptBuilder.d.ts +0 -0
- /package/{lib → lib-dts}/generators/ExcerptBuilder.d.ts.map +0 -0
- /package/{lib → lib-dts}/generators/IndentedWriter.d.ts +0 -0
- /package/{lib → lib-dts}/generators/IndentedWriter.d.ts.map +0 -0
- /package/{lib → lib-dts}/index.d.ts +0 -0
- /package/{lib → lib-dts}/index.d.ts.map +0 -0
- /package/{lib → lib-dts}/start.d.ts +0 -0
- /package/{lib → lib-dts}/start.d.ts.map +0 -0
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/api-extractor",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "7.57.1",
|
|
6
|
+
"tag": "@microsoft/api-extractor_v7.57.1",
|
|
7
|
+
"date": "Fri, 20 Feb 2026 00:15:03 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@microsoft/api-extractor-model\" to `7.33.1`"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.20.1`"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"comment": "Updating dependency \"@rushstack/rig-package\" to `0.7.1`"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.22.1`"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.3.1`"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"version": "7.57.0",
|
|
35
|
+
"tag": "@microsoft/api-extractor_v7.57.0",
|
|
36
|
+
"date": "Thu, 19 Feb 2026 00:04:52 GMT",
|
|
37
|
+
"comments": {
|
|
38
|
+
"minor": [
|
|
39
|
+
{
|
|
40
|
+
"comment": "Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `\"exports\"` field in `package.json`."
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"dependency": [
|
|
44
|
+
{
|
|
45
|
+
"comment": "Updating dependency \"@microsoft/api-extractor-model\" to `7.33.0`"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.20.0`"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"comment": "Updating dependency \"@rushstack/rig-package\" to `0.7.0`"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.22.0`"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.3.0`"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
4
62
|
{
|
|
5
63
|
"version": "7.56.3",
|
|
6
64
|
"tag": "@microsoft/api-extractor_v7.56.3",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log - @microsoft/api-extractor
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 20 Feb 2026 00:15:03 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 7.57.1
|
|
6
|
+
Fri, 20 Feb 2026 00:15:03 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Add `"node"` condition before `"import"` in the `"exports"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `"import"`. Fixes https://github.com/microsoft/rushstack/issues/5644.
|
|
11
|
+
|
|
12
|
+
## 7.57.0
|
|
13
|
+
Thu, 19 Feb 2026 00:04:52 GMT
|
|
14
|
+
|
|
15
|
+
### Minor changes
|
|
16
|
+
|
|
17
|
+
- Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `"exports"` field in `package.json`.
|
|
4
18
|
|
|
5
19
|
## 7.56.3
|
|
6
20
|
Sat, 07 Feb 2026 01:13:26 GMT
|
package/bin/api-extractor
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('../lib/start.js');
|
|
2
|
+
require('../lib-commonjs/start.js');
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as ts from 'typescript';
|
|
4
|
+
import { ExtractorMessageId } from '../api/ExtractorMessageId';
|
|
5
|
+
export class PackageDocComment {
|
|
6
|
+
/**
|
|
7
|
+
* For the given source file, see if it starts with a TSDoc comment containing the `@packageDocumentation` tag.
|
|
8
|
+
*/
|
|
9
|
+
static tryFindInSourceFile(sourceFile, collector) {
|
|
10
|
+
// The @packageDocumentation comment is special because it is not attached to an AST
|
|
11
|
+
// definition. Instead, it is part of the "trivia" tokens that the compiler treats
|
|
12
|
+
// as irrelevant white space.
|
|
13
|
+
//
|
|
14
|
+
// WARNING: If the comment doesn't precede an export statement, the compiler will omit
|
|
15
|
+
// it from the *.d.ts file, and API Extractor won't find it. If this happens, you need
|
|
16
|
+
// to rearrange your statements to ensure it is passed through.
|
|
17
|
+
//
|
|
18
|
+
// This implementation assumes that the "@packageDocumentation" will be in the first TSDoc comment
|
|
19
|
+
// that appears in the entry point *.d.ts file. We could possibly look in other places,
|
|
20
|
+
// but the above warning suggests enforcing a standardized layout. This design choice is open
|
|
21
|
+
// to feedback.
|
|
22
|
+
let packageCommentRange = undefined; // empty string
|
|
23
|
+
for (const commentRange of ts.getLeadingCommentRanges(sourceFile.text, sourceFile.getFullStart()) || []) {
|
|
24
|
+
if (commentRange.kind === ts.SyntaxKind.MultiLineCommentTrivia) {
|
|
25
|
+
const commentBody = sourceFile.text.substring(commentRange.pos, commentRange.end);
|
|
26
|
+
// Choose the first JSDoc-style comment
|
|
27
|
+
if (/^\s*\/\*\*/.test(commentBody)) {
|
|
28
|
+
// But only if it looks like it's trying to be @packageDocumentation
|
|
29
|
+
// (The TSDoc parser will validate this more rigorously)
|
|
30
|
+
if (/\@packageDocumentation/i.test(commentBody)) {
|
|
31
|
+
packageCommentRange = commentRange;
|
|
32
|
+
}
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!packageCommentRange) {
|
|
38
|
+
// If we didn't find the @packageDocumentation tag in the expected place, is it in some
|
|
39
|
+
// wrong place? This sanity check helps people to figure out why there comment isn't working.
|
|
40
|
+
for (const statement of sourceFile.statements) {
|
|
41
|
+
const ranges = [];
|
|
42
|
+
ranges.push(...(ts.getLeadingCommentRanges(sourceFile.text, statement.getFullStart()) || []));
|
|
43
|
+
ranges.push(...(ts.getTrailingCommentRanges(sourceFile.text, statement.getEnd()) || []));
|
|
44
|
+
for (const commentRange of ranges) {
|
|
45
|
+
const commentBody = sourceFile.text.substring(commentRange.pos, commentRange.end);
|
|
46
|
+
if (/\@packageDocumentation/i.test(commentBody)) {
|
|
47
|
+
collector.messageRouter.addAnalyzerIssueForPosition(ExtractorMessageId.MisplacedPackageTag, 'The @packageDocumentation comment must appear at the top of entry point *.d.ts file', sourceFile, commentRange.pos);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return packageCommentRange;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=PackageDocComment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageDocComment.js","sourceRoot":"","sources":["../../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EAAE,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,uBAAuB,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC9F,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,wBAAwB,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAEzF,KAAK,MAAM,YAAY,IAAI,MAAM,EAAE,CAAC;oBAClC,MAAM,WAAW,GAAW,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;oBAE1F,IAAI,yBAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;wBAChD,SAAS,CAAC,aAAa,CAAC,2BAA2B,CACjD,kBAAkB,CAAC,mBAAmB,EACtC,qFAAqF,EACrF,UAAU,EACV,YAAY,CAAC,GAAG,CACjB,CAAC;wBACF,MAAM;oBACR,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\n\nimport type { Collector } from '../collector/Collector';\nimport { ExtractorMessageId } from '../api/ExtractorMessageId';\n\nexport class PackageDocComment {\n /**\n * For the given source file, see if it starts with a TSDoc comment containing the `@packageDocumentation` tag.\n */\n public static tryFindInSourceFile(\n sourceFile: ts.SourceFile,\n collector: Collector\n ): ts.TextRange | undefined {\n // The @packageDocumentation comment is special because it is not attached to an AST\n // definition. Instead, it is part of the \"trivia\" tokens that the compiler treats\n // as irrelevant white space.\n //\n // WARNING: If the comment doesn't precede an export statement, the compiler will omit\n // it from the *.d.ts file, and API Extractor won't find it. If this happens, you need\n // to rearrange your statements to ensure it is passed through.\n //\n // This implementation assumes that the \"@packageDocumentation\" will be in the first TSDoc comment\n // that appears in the entry point *.d.ts file. We could possibly look in other places,\n // but the above warning suggests enforcing a standardized layout. This design choice is open\n // to feedback.\n let packageCommentRange: ts.TextRange | undefined = undefined; // empty string\n\n for (const commentRange of ts.getLeadingCommentRanges(sourceFile.text, sourceFile.getFullStart()) || []) {\n if (commentRange.kind === ts.SyntaxKind.MultiLineCommentTrivia) {\n const commentBody: string = sourceFile.text.substring(commentRange.pos, commentRange.end);\n\n // Choose the first JSDoc-style comment\n if (/^\\s*\\/\\*\\*/.test(commentBody)) {\n // But only if it looks like it's trying to be @packageDocumentation\n // (The TSDoc parser will validate this more rigorously)\n if (/\\@packageDocumentation/i.test(commentBody)) {\n packageCommentRange = commentRange;\n }\n break;\n }\n }\n }\n\n if (!packageCommentRange) {\n // If we didn't find the @packageDocumentation tag in the expected place, is it in some\n // wrong place? This sanity check helps people to figure out why there comment isn't working.\n for (const statement of sourceFile.statements) {\n const ranges: ts.CommentRange[] = [];\n ranges.push(...(ts.getLeadingCommentRanges(sourceFile.text, statement.getFullStart()) || []));\n ranges.push(...(ts.getTrailingCommentRanges(sourceFile.text, statement.getEnd()) || []));\n\n for (const commentRange of ranges) {\n const commentBody: string = sourceFile.text.substring(commentRange.pos, commentRange.end);\n\n if (/\\@packageDocumentation/i.test(commentBody)) {\n collector.messageRouter.addAnalyzerIssueForPosition(\n ExtractorMessageId.MisplacedPackageTag,\n 'The @packageDocumentation comment must appear at the top of entry point *.d.ts file',\n sourceFile,\n commentRange.pos\n );\n break;\n }\n }\n }\n }\n\n return packageCommentRange;\n }\n}\n"]}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as ts from 'typescript';
|
|
4
|
+
import { InternalError } from '@rushstack/node-core-library';
|
|
5
|
+
import { Span } from './Span';
|
|
6
|
+
/**
|
|
7
|
+
* The AstDeclaration and AstSymbol classes are API Extractor's equivalent of the compiler's
|
|
8
|
+
* ts.Declaration and ts.Symbol objects. They are created by the `AstSymbolTable` class.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The AstDeclaration represents one or more syntax components of a symbol. Usually there is
|
|
12
|
+
* only one AstDeclaration per AstSymbol, but certain TypeScript constructs can have multiple
|
|
13
|
+
* declarations (e.g. overloaded functions, merged declarations, etc.).
|
|
14
|
+
*
|
|
15
|
+
* Because of this, the `AstDeclaration` manages the parent/child nesting hierarchy (e.g. with
|
|
16
|
+
* declaration merging, each declaration has its own children) and becomes the main focus
|
|
17
|
+
* of analyzing AEDoc and emitting *.d.ts files.
|
|
18
|
+
*
|
|
19
|
+
* The AstDeclarations correspond to items from the compiler's ts.Node hierarchy, but
|
|
20
|
+
* omitting/skipping any nodes that don't match the AstDeclaration.isSupportedSyntaxKind()
|
|
21
|
+
* criteria. This simplification makes the other API Extractor stages easier to implement.
|
|
22
|
+
*/
|
|
23
|
+
export class AstDeclaration {
|
|
24
|
+
constructor(options) {
|
|
25
|
+
// NOTE: This array becomes immutable after astSymbol.analyze() sets astSymbol.analyzed=true
|
|
26
|
+
this._analyzedChildren = [];
|
|
27
|
+
this._analyzedReferencedAstEntitiesSet = new Set();
|
|
28
|
+
// Reverse lookup used by findChildrenWithName()
|
|
29
|
+
this._childrenByName = undefined;
|
|
30
|
+
this.declaration = options.declaration;
|
|
31
|
+
this.astSymbol = options.astSymbol;
|
|
32
|
+
this.parent = options.parent;
|
|
33
|
+
this.astSymbol._notifyDeclarationAttach(this);
|
|
34
|
+
if (this.parent) {
|
|
35
|
+
this.parent._notifyChildAttach(this);
|
|
36
|
+
}
|
|
37
|
+
this.modifierFlags = ts.getCombinedModifierFlags(this.declaration);
|
|
38
|
+
// Check for ECMAScript private fields, for example:
|
|
39
|
+
//
|
|
40
|
+
// class Person { #name: string; }
|
|
41
|
+
//
|
|
42
|
+
const declarationName = ts.getNameOfDeclaration(this.declaration);
|
|
43
|
+
if (declarationName) {
|
|
44
|
+
if (ts.isPrivateIdentifier(declarationName)) {
|
|
45
|
+
// eslint-disable-next-line no-bitwise
|
|
46
|
+
this.modifierFlags |= ts.ModifierFlags.Private;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Returns the children for this AstDeclaration.
|
|
52
|
+
* @remarks
|
|
53
|
+
* The collection will be empty until AstSymbol.analyzed is true.
|
|
54
|
+
*/
|
|
55
|
+
get children() {
|
|
56
|
+
return this.astSymbol.analyzed ? this._analyzedChildren : [];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns the AstEntity objects referenced by this node.
|
|
60
|
+
* @remarks
|
|
61
|
+
* NOTE: The collection will be empty until AstSymbol.analyzed is true.
|
|
62
|
+
*
|
|
63
|
+
* Since we assume references are always collected by a traversal starting at the
|
|
64
|
+
* root of the nesting declarations, this array omits the following items because they
|
|
65
|
+
* would be redundant:
|
|
66
|
+
* - symbols corresponding to parents of this declaration (e.g. a method that returns its own class)
|
|
67
|
+
* - symbols already listed in the referencedAstSymbols property for parents of this declaration
|
|
68
|
+
* (e.g. a method that returns its own class's base class)
|
|
69
|
+
* - symbols that are referenced only by nested children of this declaration
|
|
70
|
+
* (e.g. if a method returns an enum, this doesn't imply that the method's class references that enum)
|
|
71
|
+
*/
|
|
72
|
+
get referencedAstEntities() {
|
|
73
|
+
return this.astSymbol.analyzed ? [...this._analyzedReferencedAstEntitiesSet] : [];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* This is an internal callback used when the AstSymbolTable attaches a new
|
|
77
|
+
* child AstDeclaration to this object.
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
_notifyChildAttach(child) {
|
|
81
|
+
if (child.parent !== this) {
|
|
82
|
+
throw new InternalError('Invalid call to notifyChildAttach()');
|
|
83
|
+
}
|
|
84
|
+
if (this.astSymbol.analyzed) {
|
|
85
|
+
throw new InternalError('_notifyChildAttach() called after analysis is already complete');
|
|
86
|
+
}
|
|
87
|
+
this._analyzedChildren.push(child);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns a diagnostic dump of the tree, which reports the hierarchy of
|
|
91
|
+
* AstDefinition objects.
|
|
92
|
+
*/
|
|
93
|
+
getDump(indent = '') {
|
|
94
|
+
const declarationKind = ts.SyntaxKind[this.declaration.kind];
|
|
95
|
+
let result = indent + `+ ${this.astSymbol.localName} (${declarationKind})`;
|
|
96
|
+
if (this.astSymbol.nominalAnalysis) {
|
|
97
|
+
result += ' (nominal)';
|
|
98
|
+
}
|
|
99
|
+
result += '\n';
|
|
100
|
+
for (const referencedAstEntity of this._analyzedReferencedAstEntitiesSet.values()) {
|
|
101
|
+
result += indent + ` ref: ${referencedAstEntity.localName}\n`;
|
|
102
|
+
}
|
|
103
|
+
for (const child of this.children) {
|
|
104
|
+
result += child.getDump(indent + ' ');
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Returns a diagnostic dump using Span.getDump(), which reports the detailed
|
|
110
|
+
* compiler structure.
|
|
111
|
+
*/
|
|
112
|
+
getSpanDump(indent = '') {
|
|
113
|
+
const span = new Span(this.declaration);
|
|
114
|
+
return span.getDump(indent);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* This is an internal callback used when AstSymbolTable.analyze() discovers a new
|
|
118
|
+
* type reference associated with this declaration.
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
_notifyReferencedAstEntity(referencedAstEntity) {
|
|
122
|
+
if (this.astSymbol.analyzed) {
|
|
123
|
+
throw new InternalError('_notifyReferencedAstEntity() called after analysis is already complete');
|
|
124
|
+
}
|
|
125
|
+
for (let current = this; current; current = current.parent) {
|
|
126
|
+
// Don't add references to symbols that are already referenced by a parent
|
|
127
|
+
if (current._analyzedReferencedAstEntitiesSet.has(referencedAstEntity)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
// Don't add the symbols of parents either
|
|
131
|
+
if (referencedAstEntity === current.astSymbol) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
this._analyzedReferencedAstEntitiesSet.add(referencedAstEntity);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Visits all the current declaration and all children recursively in a depth-first traversal,
|
|
139
|
+
* and performs the specified action for each one.
|
|
140
|
+
*/
|
|
141
|
+
forEachDeclarationRecursive(action) {
|
|
142
|
+
action(this);
|
|
143
|
+
for (const child of this.children) {
|
|
144
|
+
child.forEachDeclarationRecursive(action);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Returns the list of child declarations whose `AstSymbol.localName` matches the provided `name`.
|
|
149
|
+
*
|
|
150
|
+
* @remarks
|
|
151
|
+
* This is an efficient O(1) lookup.
|
|
152
|
+
*/
|
|
153
|
+
findChildrenWithName(name) {
|
|
154
|
+
// The children property returns:
|
|
155
|
+
//
|
|
156
|
+
// return this.astSymbol.analyzed ? this._analyzedChildren : [];
|
|
157
|
+
//
|
|
158
|
+
if (!this.astSymbol.analyzed || this._analyzedChildren.length === 0) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
if (this._childrenByName === undefined) {
|
|
162
|
+
// Build the lookup table
|
|
163
|
+
const childrenByName = new Map();
|
|
164
|
+
for (const child of this._analyzedChildren) {
|
|
165
|
+
const childName = child.astSymbol.localName;
|
|
166
|
+
let array = childrenByName.get(childName);
|
|
167
|
+
if (array === undefined) {
|
|
168
|
+
array = [];
|
|
169
|
+
childrenByName.set(childName, array);
|
|
170
|
+
}
|
|
171
|
+
array.push(child);
|
|
172
|
+
}
|
|
173
|
+
this._childrenByName = childrenByName;
|
|
174
|
+
}
|
|
175
|
+
return this._childrenByName.get(name) || [];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* This function determines which ts.Node kinds will generate an AstDeclaration.
|
|
179
|
+
* These correspond to the definitions that we can add AEDoc to.
|
|
180
|
+
*/
|
|
181
|
+
static isSupportedSyntaxKind(kind) {
|
|
182
|
+
// (alphabetical order)
|
|
183
|
+
switch (kind) {
|
|
184
|
+
case ts.SyntaxKind.CallSignature:
|
|
185
|
+
case ts.SyntaxKind.ClassDeclaration:
|
|
186
|
+
case ts.SyntaxKind.ConstructSignature: // Example: "new(x: number): IMyClass"
|
|
187
|
+
case ts.SyntaxKind.Constructor: // Example: "constructor(x: number)"
|
|
188
|
+
case ts.SyntaxKind.EnumDeclaration:
|
|
189
|
+
case ts.SyntaxKind.EnumMember:
|
|
190
|
+
case ts.SyntaxKind.FunctionDeclaration: // Example: "(x: number): number"
|
|
191
|
+
case ts.SyntaxKind.GetAccessor:
|
|
192
|
+
case ts.SyntaxKind.SetAccessor:
|
|
193
|
+
case ts.SyntaxKind.IndexSignature: // Example: "[key: string]: string"
|
|
194
|
+
case ts.SyntaxKind.InterfaceDeclaration:
|
|
195
|
+
case ts.SyntaxKind.MethodDeclaration:
|
|
196
|
+
case ts.SyntaxKind.MethodSignature:
|
|
197
|
+
case ts.SyntaxKind.ModuleDeclaration: // Used for both "module" and "namespace" declarations
|
|
198
|
+
case ts.SyntaxKind.PropertyDeclaration:
|
|
199
|
+
case ts.SyntaxKind.PropertySignature:
|
|
200
|
+
case ts.SyntaxKind.TypeAliasDeclaration: // Example: "type Shape = Circle | Square"
|
|
201
|
+
case ts.SyntaxKind.VariableDeclaration:
|
|
202
|
+
return true;
|
|
203
|
+
// NOTE: Prior to TypeScript 3.7, in the emitted .d.ts files, the compiler would merge a GetAccessor/SetAccessor
|
|
204
|
+
// pair into a single PropertyDeclaration.
|
|
205
|
+
// NOTE: In contexts where a source file is treated as a module, we do create "nominal analysis"
|
|
206
|
+
// AstSymbol objects corresponding to a ts.SyntaxKind.SourceFile node. However, a source file
|
|
207
|
+
// is NOT considered a nesting structure, and it does NOT act as a root for the declarations
|
|
208
|
+
// appearing in the file. This is because the *.d.ts generator is in the business of rolling up
|
|
209
|
+
// source files, and thus wants to ignore them in general.
|
|
210
|
+
}
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=AstDeclaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstDeclaration.js","sourceRoot":"","sources":["../../src/analyzer/AstDeclaration.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAY9B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAc;IAqCzB,YAAmB,OAA+B;QARlD,4FAA4F;QAC3E,sBAAiB,GAAqB,EAAE,CAAC;QAEzC,sCAAiC,GAAmB,IAAI,GAAG,EAAa,CAAC;QAE1F,gDAAgD;QACxC,oBAAe,GAA8C,SAAS,CAAC;QAG7E,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE7B,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEnE,oDAAoD;QACpD,EAAE;QACF,qCAAqC;QACrC,EAAE;QACF,MAAM,eA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C,UAAU,CAAC,gBAAgB,CAAC;YACpC,KAAK,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,sCAAsC;YAC7E,KAAK,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,oCAAoC;YACpE,KAAK,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC;YACnC,KAAK,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;YAC9B,KAAK,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,iCAAiC;YACzE,KAAK,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;YAC/B,KAAK,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;YAC/B,KAAK,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,mCAAmC;YACtE,KAAK,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC;YACxC,KAAK,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC;YACrC,KAAK,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC;YACnC,KAAK,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,sDAAsD;YAC5F,KAAK,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC;YACvC,KAAK,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC;YACrC,KAAK,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,0CAA0C;YACnF,KAAK,EAAE,CAAC,UAAU,CAAC,mBAAmB;gBACpC,OAAO,IAAI,CAAC;YAEd,gHAAgH;YAChH,0CAA0C;YAE1C,gGAAgG;YAChG,8FAA8F;YAC9F,4FAA4F;YAC5F,gGAAgG;YAChG,0DAA0D;QAC5D,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\n\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport type { AstSymbol } from './AstSymbol';\nimport { Span } from './Span';\nimport type { AstEntity } from './AstEntity';\n\n/**\n * Constructor options for AstDeclaration\n */\nexport interface IAstDeclarationOptions {\n readonly declaration: ts.Declaration;\n readonly astSymbol: AstSymbol;\n readonly parent: AstDeclaration | undefined;\n}\n\n/**\n * The AstDeclaration and AstSymbol classes are API Extractor's equivalent of the compiler's\n * ts.Declaration and ts.Symbol objects. They are created by the `AstSymbolTable` class.\n *\n * @remarks\n * The AstDeclaration represents one or more syntax components of a symbol. Usually there is\n * only one AstDeclaration per AstSymbol, but certain TypeScript constructs can have multiple\n * declarations (e.g. overloaded functions, merged declarations, etc.).\n *\n * Because of this, the `AstDeclaration` manages the parent/child nesting hierarchy (e.g. with\n * declaration merging, each declaration has its own children) and becomes the main focus\n * of analyzing AEDoc and emitting *.d.ts files.\n *\n * The AstDeclarations correspond to items from the compiler's ts.Node hierarchy, but\n * omitting/skipping any nodes that don't match the AstDeclaration.isSupportedSyntaxKind()\n * criteria. This simplification makes the other API Extractor stages easier to implement.\n */\nexport class AstDeclaration {\n public readonly declaration: ts.Declaration;\n\n public readonly astSymbol: AstSymbol;\n\n /**\n * The parent, if this object is nested inside another AstDeclaration.\n */\n public readonly parent: AstDeclaration | undefined;\n\n /**\n * A bit set of TypeScript modifiers such as \"private\", \"protected\", etc.\n */\n public readonly modifierFlags: ts.ModifierFlags;\n\n /**\n * Additional information that is calculated later by the `Collector`. The actual type is `DeclarationMetadata`,\n * but we declare it as `unknown` because consumers must obtain this object by calling\n * `Collector.fetchDeclarationMetadata()`.\n */\n public declarationMetadata: unknown;\n\n /**\n * Additional information that is calculated later by the `Collector`. The actual type is `ApiItemMetadata`,\n * but we declare it as `unknown` because consumers must obtain this object by calling\n * `Collector.fetchApiItemMetadata()`.\n */\n public apiItemMetadata: unknown;\n\n // NOTE: This array becomes immutable after astSymbol.analyze() sets astSymbol.analyzed=true\n private readonly _analyzedChildren: AstDeclaration[] = [];\n\n private readonly _analyzedReferencedAstEntitiesSet: Set<AstEntity> = new Set<AstEntity>();\n\n // Reverse lookup used by findChildrenWithName()\n private _childrenByName: Map<string, AstDeclaration[]> | undefined = undefined;\n\n public constructor(options: IAstDeclarationOptions) {\n this.declaration = options.declaration;\n this.astSymbol = options.astSymbol;\n this.parent = options.parent;\n\n this.astSymbol._notifyDeclarationAttach(this);\n\n if (this.parent) {\n this.parent._notifyChildAttach(this);\n }\n\n this.modifierFlags = ts.getCombinedModifierFlags(this.declaration);\n\n // Check for ECMAScript private fields, for example:\n //\n // class Person { #name: string; }\n //\n const declarationName: ts.DeclarationName | undefined = ts.getNameOfDeclaration(this.declaration);\n if (declarationName) {\n if (ts.isPrivateIdentifier(declarationName)) {\n // eslint-disable-next-line no-bitwise\n this.modifierFlags |= ts.ModifierFlags.Private;\n }\n }\n }\n\n /**\n * Returns the children for this AstDeclaration.\n * @remarks\n * The collection will be empty until AstSymbol.analyzed is true.\n */\n public get children(): ReadonlyArray<AstDeclaration> {\n return this.astSymbol.analyzed ? this._analyzedChildren : [];\n }\n\n /**\n * Returns the AstEntity objects referenced by this node.\n * @remarks\n * NOTE: The collection will be empty until AstSymbol.analyzed is true.\n *\n * Since we assume references are always collected by a traversal starting at the\n * root of the nesting declarations, this array omits the following items because they\n * would be redundant:\n * - symbols corresponding to parents of this declaration (e.g. a method that returns its own class)\n * - symbols already listed in the referencedAstSymbols property for parents of this declaration\n * (e.g. a method that returns its own class's base class)\n * - symbols that are referenced only by nested children of this declaration\n * (e.g. if a method returns an enum, this doesn't imply that the method's class references that enum)\n */\n public get referencedAstEntities(): ReadonlyArray<AstEntity> {\n return this.astSymbol.analyzed ? [...this._analyzedReferencedAstEntitiesSet] : [];\n }\n\n /**\n * This is an internal callback used when the AstSymbolTable attaches a new\n * child AstDeclaration to this object.\n * @internal\n */\n public _notifyChildAttach(child: AstDeclaration): void {\n if (child.parent !== this) {\n throw new InternalError('Invalid call to notifyChildAttach()');\n }\n\n if (this.astSymbol.analyzed) {\n throw new InternalError('_notifyChildAttach() called after analysis is already complete');\n }\n\n this._analyzedChildren.push(child);\n }\n\n /**\n * Returns a diagnostic dump of the tree, which reports the hierarchy of\n * AstDefinition objects.\n */\n public getDump(indent: string = ''): string {\n const declarationKind: string = ts.SyntaxKind[this.declaration.kind];\n let result: string = indent + `+ ${this.astSymbol.localName} (${declarationKind})`;\n if (this.astSymbol.nominalAnalysis) {\n result += ' (nominal)';\n }\n result += '\\n';\n\n for (const referencedAstEntity of this._analyzedReferencedAstEntitiesSet.values()) {\n result += indent + ` ref: ${referencedAstEntity.localName}\\n`;\n }\n\n for (const child of this.children) {\n result += child.getDump(indent + ' ');\n }\n\n return result;\n }\n\n /**\n * Returns a diagnostic dump using Span.getDump(), which reports the detailed\n * compiler structure.\n */\n public getSpanDump(indent: string = ''): string {\n const span: Span = new Span(this.declaration);\n return span.getDump(indent);\n }\n\n /**\n * This is an internal callback used when AstSymbolTable.analyze() discovers a new\n * type reference associated with this declaration.\n * @internal\n */\n public _notifyReferencedAstEntity(referencedAstEntity: AstEntity): void {\n if (this.astSymbol.analyzed) {\n throw new InternalError('_notifyReferencedAstEntity() called after analysis is already complete');\n }\n\n for (let current: AstDeclaration | undefined = this; current; current = current.parent) {\n // Don't add references to symbols that are already referenced by a parent\n if (current._analyzedReferencedAstEntitiesSet.has(referencedAstEntity)) {\n return;\n }\n // Don't add the symbols of parents either\n if (referencedAstEntity === current.astSymbol) {\n return;\n }\n }\n\n this._analyzedReferencedAstEntitiesSet.add(referencedAstEntity);\n }\n\n /**\n * Visits all the current declaration and all children recursively in a depth-first traversal,\n * and performs the specified action for each one.\n */\n public forEachDeclarationRecursive(action: (astDeclaration: AstDeclaration) => void): void {\n action(this);\n for (const child of this.children) {\n child.forEachDeclarationRecursive(action);\n }\n }\n\n /**\n * Returns the list of child declarations whose `AstSymbol.localName` matches the provided `name`.\n *\n * @remarks\n * This is an efficient O(1) lookup.\n */\n public findChildrenWithName(name: string): ReadonlyArray<AstDeclaration> {\n // The children property returns:\n //\n // return this.astSymbol.analyzed ? this._analyzedChildren : [];\n //\n if (!this.astSymbol.analyzed || this._analyzedChildren.length === 0) {\n return [];\n }\n\n if (this._childrenByName === undefined) {\n // Build the lookup table\n const childrenByName: Map<string, AstDeclaration[]> = new Map<string, AstDeclaration[]>();\n\n for (const child of this._analyzedChildren) {\n const childName: string = child.astSymbol.localName;\n let array: AstDeclaration[] | undefined = childrenByName.get(childName);\n if (array === undefined) {\n array = [];\n childrenByName.set(childName, array);\n }\n array.push(child);\n }\n this._childrenByName = childrenByName;\n }\n\n return this._childrenByName.get(name) || [];\n }\n\n /**\n * This function determines which ts.Node kinds will generate an AstDeclaration.\n * These correspond to the definitions that we can add AEDoc to.\n */\n public static isSupportedSyntaxKind(kind: ts.SyntaxKind): boolean {\n // (alphabetical order)\n switch (kind) {\n case ts.SyntaxKind.CallSignature:\n case ts.SyntaxKind.ClassDeclaration:\n case ts.SyntaxKind.ConstructSignature: // Example: \"new(x: number): IMyClass\"\n case ts.SyntaxKind.Constructor: // Example: \"constructor(x: number)\"\n case ts.SyntaxKind.EnumDeclaration:\n case ts.SyntaxKind.EnumMember:\n case ts.SyntaxKind.FunctionDeclaration: // Example: \"(x: number): number\"\n case ts.SyntaxKind.GetAccessor:\n case ts.SyntaxKind.SetAccessor:\n case ts.SyntaxKind.IndexSignature: // Example: \"[key: string]: string\"\n case ts.SyntaxKind.InterfaceDeclaration:\n case ts.SyntaxKind.MethodDeclaration:\n case ts.SyntaxKind.MethodSignature:\n case ts.SyntaxKind.ModuleDeclaration: // Used for both \"module\" and \"namespace\" declarations\n case ts.SyntaxKind.PropertyDeclaration:\n case ts.SyntaxKind.PropertySignature:\n case ts.SyntaxKind.TypeAliasDeclaration: // Example: \"type Shape = Circle | Square\"\n case ts.SyntaxKind.VariableDeclaration:\n return true;\n\n // NOTE: Prior to TypeScript 3.7, in the emitted .d.ts files, the compiler would merge a GetAccessor/SetAccessor\n // pair into a single PropertyDeclaration.\n\n // NOTE: In contexts where a source file is treated as a module, we do create \"nominal analysis\"\n // AstSymbol objects corresponding to a ts.SyntaxKind.SourceFile node. However, a source file\n // is NOT considered a nesting structure, and it does NOT act as a root for the declarations\n // appearing in the file. This is because the *.d.ts generator is in the business of rolling up\n // source files, and thus wants to ignore them in general.\n }\n\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
/**
|
|
4
|
+
* `AstEntity` is the abstract base class for analyzer objects that can become a `CollectorEntity`.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
*
|
|
8
|
+
* The subclasses are:
|
|
9
|
+
* ```
|
|
10
|
+
* - AstEntity
|
|
11
|
+
* - AstSymbol
|
|
12
|
+
* - AstSyntheticEntity
|
|
13
|
+
* - AstImport
|
|
14
|
+
* - AstNamespaceImport
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export class AstEntity {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `AstSyntheticEntity` is the abstract base class for analyzer objects whose emitted declarations
|
|
21
|
+
* are not text transformations performed by the `Span` helper.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Most of API Extractor's output is produced by using the using the `Span` utility to regurgitate strings from
|
|
25
|
+
* the input .d.ts files. If we need to rename an identifier, the `Span` visitor can pick out an interesting
|
|
26
|
+
* node and rewrite its string, but otherwise the transformation operates on dumb text and not compiler concepts.
|
|
27
|
+
* (Historically we did this because the compiler's emitter was an internal API, but it still has some advantages,
|
|
28
|
+
* for example preserving syntaxes generated by an older compiler to avoid incompatibilities.)
|
|
29
|
+
*
|
|
30
|
+
* This strategy does not work for cases where the output looks very different from the input. Today these
|
|
31
|
+
* cases are always kinds of `import` statements, but that may change in the future.
|
|
32
|
+
*/
|
|
33
|
+
export class AstSyntheticEntity extends AstEntity {
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=AstEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstEntity.js","sourceRoot":"","sources":["../../src/analyzer/AstEntity.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAgB,SAAS;CAY9B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,SAAS;CAAG","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * `AstEntity` is the abstract base class for analyzer objects that can become a `CollectorEntity`.\n *\n * @remarks\n *\n * The subclasses are:\n * ```\n * - AstEntity\n * - AstSymbol\n * - AstSyntheticEntity\n * - AstImport\n * - AstNamespaceImport\n * ```\n */\nexport abstract class AstEntity {\n /**\n * The original name of the symbol, as exported from the module (i.e. source file)\n * containing the original TypeScript definition. Constructs such as\n * `import { X as Y } from` may introduce other names that differ from the local name.\n *\n * @remarks\n * For the most part, `localName` corresponds to `followedSymbol.name`, but there\n * are some edge cases. For example, the ts.Symbol.name for `export default class X { }`\n * is actually `\"default\"`, not `\"X\"`.\n */\n public abstract readonly localName: string;\n}\n\n/**\n * `AstSyntheticEntity` is the abstract base class for analyzer objects whose emitted declarations\n * are not text transformations performed by the `Span` helper.\n *\n * @remarks\n * Most of API Extractor's output is produced by using the using the `Span` utility to regurgitate strings from\n * the input .d.ts files. If we need to rename an identifier, the `Span` visitor can pick out an interesting\n * node and rewrite its string, but otherwise the transformation operates on dumb text and not compiler concepts.\n * (Historically we did this because the compiler's emitter was an internal API, but it still has some advantages,\n * for example preserving syntaxes generated by an older compiler to avoid incompatibilities.)\n *\n * This strategy does not work for cases where the output looks very different from the input. Today these\n * cases are always kinds of `import` statements, but that may change in the future.\n */\nexport abstract class AstSyntheticEntity extends AstEntity {}\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { InternalError } from '@rushstack/node-core-library';
|
|
4
|
+
import { AstSyntheticEntity } from './AstEntity';
|
|
5
|
+
/**
|
|
6
|
+
* Indicates the import kind for an `AstImport`.
|
|
7
|
+
*/
|
|
8
|
+
export var AstImportKind;
|
|
9
|
+
(function (AstImportKind) {
|
|
10
|
+
/**
|
|
11
|
+
* An import statement such as `import X from "y";`.
|
|
12
|
+
*/
|
|
13
|
+
AstImportKind[AstImportKind["DefaultImport"] = 0] = "DefaultImport";
|
|
14
|
+
/**
|
|
15
|
+
* An import statement such as `import { X } from "y";`.
|
|
16
|
+
*/
|
|
17
|
+
AstImportKind[AstImportKind["NamedImport"] = 1] = "NamedImport";
|
|
18
|
+
/**
|
|
19
|
+
* An import statement such as `import * as x from "y";`.
|
|
20
|
+
*/
|
|
21
|
+
AstImportKind[AstImportKind["StarImport"] = 2] = "StarImport";
|
|
22
|
+
/**
|
|
23
|
+
* An import statement such as `import x = require("y");`.
|
|
24
|
+
*/
|
|
25
|
+
AstImportKind[AstImportKind["EqualsImport"] = 3] = "EqualsImport";
|
|
26
|
+
/**
|
|
27
|
+
* An import statement such as `interface foo { foo: import("bar").a.b.c }`.
|
|
28
|
+
*/
|
|
29
|
+
AstImportKind[AstImportKind["ImportType"] = 4] = "ImportType";
|
|
30
|
+
})(AstImportKind || (AstImportKind = {}));
|
|
31
|
+
/**
|
|
32
|
+
* For a symbol that was imported from an external package, this tracks the import
|
|
33
|
+
* statement that was used to reach it.
|
|
34
|
+
*/
|
|
35
|
+
export class AstImport extends AstSyntheticEntity {
|
|
36
|
+
constructor(options) {
|
|
37
|
+
super();
|
|
38
|
+
this.importKind = options.importKind;
|
|
39
|
+
this.modulePath = options.modulePath;
|
|
40
|
+
this.exportName = options.exportName;
|
|
41
|
+
// We start with this assumption, but it may get changed later if non-type-only import is encountered.
|
|
42
|
+
this.isTypeOnlyEverywhere = options.isTypeOnly;
|
|
43
|
+
this.key = AstImport.getKey(options);
|
|
44
|
+
}
|
|
45
|
+
/** {@inheritdoc} */
|
|
46
|
+
get localName() {
|
|
47
|
+
// abstract
|
|
48
|
+
return this.exportName;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Calculates the lookup key used with `AstImport.key`
|
|
52
|
+
*/
|
|
53
|
+
static getKey(options) {
|
|
54
|
+
switch (options.importKind) {
|
|
55
|
+
case AstImportKind.DefaultImport:
|
|
56
|
+
return `${options.modulePath}:${options.exportName}`;
|
|
57
|
+
case AstImportKind.NamedImport:
|
|
58
|
+
return `${options.modulePath}:${options.exportName}`;
|
|
59
|
+
case AstImportKind.StarImport:
|
|
60
|
+
return `${options.modulePath}:*`;
|
|
61
|
+
case AstImportKind.EqualsImport:
|
|
62
|
+
return `${options.modulePath}:=`;
|
|
63
|
+
case AstImportKind.ImportType: {
|
|
64
|
+
const subKey = !options.exportName
|
|
65
|
+
? '*' // Equivalent to StarImport
|
|
66
|
+
: options.exportName.includes('.') // Equivalent to a named export
|
|
67
|
+
? options.exportName.split('.')[0]
|
|
68
|
+
: options.exportName;
|
|
69
|
+
return `${options.modulePath}:${subKey}`;
|
|
70
|
+
}
|
|
71
|
+
default:
|
|
72
|
+
throw new InternalError('Unknown AstImportKind');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=AstImport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstImport.js","sourceRoot":"","sources":["../../src/analyzer/AstImport.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAN,IAAY,aAyBX;AAzBD,WAAY,aAAa;IACvB;;OAEG;IACH,mEAA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AC,OAAO,CAAC,UAAU;oBACxC,CAAC,CAAC,GAAG,CAAC,2BAA2B;oBACjC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,+BAA+B;wBAChE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;wBAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;gBACzB,OAAO,GAAG,OAAO,CAAC,UAAU,IAAI,MAAM,EAAE,CAAC;YAC3C,CAAC;YACD;gBACE,MAAM,IAAI,aAAa,CAAC,uBAAuB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport type { AstSymbol } from './AstSymbol';\nimport { AstSyntheticEntity } from './AstEntity';\n\n/**\n * Indicates the import kind for an `AstImport`.\n */\nexport enum AstImportKind {\n /**\n * An import statement such as `import X from \"y\";`.\n */\n DefaultImport,\n\n /**\n * An import statement such as `import { X } from \"y\";`.\n */\n NamedImport,\n\n /**\n * An import statement such as `import * as x from \"y\";`.\n */\n StarImport,\n\n /**\n * An import statement such as `import x = require(\"y\");`.\n */\n EqualsImport,\n\n /**\n * An import statement such as `interface foo { foo: import(\"bar\").a.b.c }`.\n */\n ImportType\n}\n\n/**\n * Constructor parameters for AstImport\n *\n * @privateRemarks\n * Our naming convention is to use I____Parameters for constructor options and\n * I____Options for general function options. However the word \"parameters\" is\n * confusingly similar to the terminology for function parameters modeled by API Extractor,\n * so we use I____Options for both cases in this code base.\n */\nexport interface IAstImportOptions {\n readonly importKind: AstImportKind;\n readonly modulePath: string;\n readonly exportName: string;\n readonly isTypeOnly: boolean;\n}\n\n/**\n * For a symbol that was imported from an external package, this tracks the import\n * statement that was used to reach it.\n */\nexport class AstImport extends AstSyntheticEntity {\n public readonly importKind: AstImportKind;\n\n /**\n * The name of the external package (and possibly module path) that this definition\n * was imported from.\n *\n * Example: \"@rushstack/node-core-library/lib/FileSystem\"\n */\n public readonly modulePath: string;\n\n /**\n * The name of the symbol being imported.\n *\n * @remarks\n *\n * The name depends on the type of import:\n *\n * ```ts\n * // For AstImportKind.DefaultImport style, exportName would be \"X\" in this example:\n * import X from \"y\";\n *\n * // For AstImportKind.NamedImport style, exportName would be \"X\" in this example:\n * import { X } from \"y\";\n *\n * // For AstImportKind.StarImport style, exportName would be \"x\" in this example:\n * import * as x from \"y\";\n *\n * // For AstImportKind.EqualsImport style, exportName would be \"x\" in this example:\n * import x = require(\"y\");\n *\n * // For AstImportKind.ImportType style, exportName would be \"a.b.c\" in this example:\n * interface foo { foo: import('bar').a.b.c };\n * ```\n */\n public readonly exportName: string;\n\n /**\n * Whether it is a type-only import, for example:\n *\n * ```ts\n * import type { X } from \"y\";\n * ```\n *\n * This is set to true ONLY if the type-only form is used in *every* reference to this AstImport.\n */\n public isTypeOnlyEverywhere: boolean;\n\n /**\n * If this import statement refers to an API from an external package that is tracked by API Extractor\n * (according to `PackageMetadataManager.isAedocSupportedFor()`), then this property will return the\n * corresponding AstSymbol. Otherwise, it is undefined.\n */\n public astSymbol: AstSymbol | undefined;\n\n /**\n * If modulePath and exportName are defined, then this is a dictionary key\n * that combines them with a colon (\":\").\n *\n * Example: \"@rushstack/node-core-library/lib/FileSystem:FileSystem\"\n */\n public readonly key: string;\n\n public constructor(options: IAstImportOptions) {\n super();\n\n this.importKind = options.importKind;\n this.modulePath = options.modulePath;\n this.exportName = options.exportName;\n\n // We start with this assumption, but it may get changed later if non-type-only import is encountered.\n this.isTypeOnlyEverywhere = options.isTypeOnly;\n\n this.key = AstImport.getKey(options);\n }\n\n /** {@inheritdoc} */\n public get localName(): string {\n // abstract\n return this.exportName;\n }\n\n /**\n * Calculates the lookup key used with `AstImport.key`\n */\n public static getKey(options: IAstImportOptions): string {\n switch (options.importKind) {\n case AstImportKind.DefaultImport:\n return `${options.modulePath}:${options.exportName}`;\n case AstImportKind.NamedImport:\n return `${options.modulePath}:${options.exportName}`;\n case AstImportKind.StarImport:\n return `${options.modulePath}:*`;\n case AstImportKind.EqualsImport:\n return `${options.modulePath}:=`;\n case AstImportKind.ImportType: {\n const subKey: string = !options.exportName\n ? '*' // Equivalent to StarImport\n : options.exportName.includes('.') // Equivalent to a named export\n ? options.exportName.split('.')[0]\n : options.exportName;\n return `${options.modulePath}:${subKey}`;\n }\n default:\n throw new InternalError('Unknown AstImportKind');\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
/**
|
|
4
|
+
* An internal data structure that represents a source file that is analyzed by AstSymbolTable.
|
|
5
|
+
*/
|
|
6
|
+
export class AstModule {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.sourceFile = options.sourceFile;
|
|
9
|
+
this.moduleSymbol = options.moduleSymbol;
|
|
10
|
+
this.externalModulePath = options.externalModulePath;
|
|
11
|
+
this.starExportedModules = new Set();
|
|
12
|
+
this.cachedExportedEntities = new Map();
|
|
13
|
+
this.astModuleExportInfo = undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* If false, then this source file is part of the working package being processed by the `Collector`.
|
|
17
|
+
*/
|
|
18
|
+
get isExternal() {
|
|
19
|
+
return this.externalModulePath !== undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=AstModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstModule.js","sourceRoot":"","sources":["../../src/analyzer/AstModule.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AA+B3D;;GAEG;AACH,MAAM,OAAO,SAAS;IAkCpB,YAAmB,OAA0B;QAC3C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QAEzC,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QAErD,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAa,CAAC;QAEhD,IAAI,CAAC,sBAAsB,GAAG,IAAI,GAAG,EAAqB,CAAC;QAE3D,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,kBAAkB,KAAK,SAAS,CAAC;IAC/C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as ts from 'typescript';\n\nimport type { AstSymbol } from './AstSymbol';\nimport type { AstEntity } from './AstEntity';\n\n/**\n * Represents information collected by {@link AstSymbolTable.fetchAstModuleExportInfo}\n */\nexport interface IAstModuleExportInfo {\n readonly visitedAstModules: Set<AstModule>;\n readonly exportedLocalEntities: Map<string, AstEntity>;\n readonly starExportedExternalModules: Set<AstModule>;\n}\n\n/**\n * Constructor parameters for AstModule\n *\n * @privateRemarks\n * Our naming convention is to use I____Parameters for constructor options and\n * I____Options for general function options. However the word \"parameters\" is\n * confusingly similar to the terminology for function parameters modeled by API Extractor,\n * so we use I____Options for both cases in this code base.\n */\nexport interface IAstModuleOptions {\n sourceFile: ts.SourceFile;\n moduleSymbol: ts.Symbol;\n externalModulePath: string | undefined;\n}\n\n/**\n * An internal data structure that represents a source file that is analyzed by AstSymbolTable.\n */\nexport class AstModule {\n /**\n * The source file that declares this TypeScript module. In most cases, the source file's\n * top-level exports constitute the module.\n */\n public readonly sourceFile: ts.SourceFile;\n\n /**\n * The symbol for the module. Typically this corresponds to ts.SourceFile itself, however\n * in some cases the ts.SourceFile may contain multiple modules declared using the `module` keyword.\n */\n public readonly moduleSymbol: ts.Symbol;\n\n /**\n * Example: \"@rushstack/node-core-library/lib/FileSystem\"\n * but never: \"./FileSystem\"\n */\n public readonly externalModulePath: string | undefined;\n\n /**\n * A list of other `AstModule` objects that appear in `export * from \"___\";` statements.\n */\n public readonly starExportedModules: Set<AstModule>;\n\n /**\n * A partial map of entities exported by this module. The key is the exported name.\n */\n public readonly cachedExportedEntities: Map<string, AstEntity>; // exportName --> entity\n\n /**\n * Additional state calculated by `AstSymbolTable.fetchWorkingPackageModule()`.\n */\n public astModuleExportInfo: IAstModuleExportInfo | undefined;\n\n public constructor(options: IAstModuleOptions) {\n this.sourceFile = options.sourceFile;\n this.moduleSymbol = options.moduleSymbol;\n\n this.externalModulePath = options.externalModulePath;\n\n this.starExportedModules = new Set<AstModule>();\n\n this.cachedExportedEntities = new Map<string, AstSymbol>();\n\n this.astModuleExportInfo = undefined;\n }\n\n /**\n * If false, then this source file is part of the working package being processed by the `Collector`.\n */\n public get isExternal(): boolean {\n return this.externalModulePath !== undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { AstNamespaceImport } from './AstNamespaceImport';
|
|
4
|
+
/**
|
|
5
|
+
* `AstNamespaceExport` represents a namespace that is created implicitly and exported by a statement
|
|
6
|
+
* such as `export * as example from "./file";`
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
*
|
|
10
|
+
* A typical input looks like this:
|
|
11
|
+
* ```ts
|
|
12
|
+
* // Suppose that example.ts exports two functions f1() and f2().
|
|
13
|
+
* export * as example from "./file";
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* API Extractor's .d.ts rollup will transform it into an explicit namespace, like this:
|
|
17
|
+
* ```ts
|
|
18
|
+
* declare f1(): void;
|
|
19
|
+
* declare f2(): void;
|
|
20
|
+
*
|
|
21
|
+
* export declare namespace example {
|
|
22
|
+
* export {
|
|
23
|
+
* f1,
|
|
24
|
+
* f2
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* The current implementation does not attempt to relocate f1()/f2() to be inside the `namespace`
|
|
30
|
+
* because other type signatures may reference them directly (without using the namespace qualifier).
|
|
31
|
+
* The AstNamespaceExports behaves the same as AstNamespaceImport, it just also has the inline export for the craeted namespace.
|
|
32
|
+
*/
|
|
33
|
+
export class AstNamespaceExport extends AstNamespaceImport {
|
|
34
|
+
constructor(options) {
|
|
35
|
+
super(options);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=AstNamespaceExport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstNamespaceExport.js","sourceRoot":"","sources":["../../src/analyzer/AstNamespaceExport.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,kBAAkB,EAAmC,MAAM,sBAAsB,CAAC;AAI3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IACxD,YAAmB,OAAmC;QACpD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { AstNamespaceImport, type IAstNamespaceImportOptions } from './AstNamespaceImport';\n\nexport interface IAstNamespaceExportOptions extends IAstNamespaceImportOptions {}\n\n/**\n * `AstNamespaceExport` represents a namespace that is created implicitly and exported by a statement\n * such as `export * as example from \"./file\";`\n *\n * @remarks\n *\n * A typical input looks like this:\n * ```ts\n * // Suppose that example.ts exports two functions f1() and f2().\n * export * as example from \"./file\";\n * ```\n *\n * API Extractor's .d.ts rollup will transform it into an explicit namespace, like this:\n * ```ts\n * declare f1(): void;\n * declare f2(): void;\n *\n * export declare namespace example {\n * export {\n * f1,\n * f2\n * }\n * }\n * ```\n *\n * The current implementation does not attempt to relocate f1()/f2() to be inside the `namespace`\n * because other type signatures may reference them directly (without using the namespace qualifier).\n * The AstNamespaceExports behaves the same as AstNamespaceImport, it just also has the inline export for the craeted namespace.\n */\n\nexport class AstNamespaceExport extends AstNamespaceImport {\n public constructor(options: IAstNamespaceExportOptions) {\n super(options);\n }\n}\n"]}
|