@microsoft/api-extractor 7.56.3 → 7.57.0
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 +29 -0
- package/CHANGELOG.md +8 -1
- package/bin/api-extractor +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 +36 -10
- /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
|
@@ -0,0 +1,476 @@
|
|
|
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 { Sort, InternalError } from '@rushstack/node-core-library';
|
|
5
|
+
import { Colorize } from '@rushstack/terminal';
|
|
6
|
+
import { AstDeclaration } from '../analyzer/AstDeclaration';
|
|
7
|
+
import { ExtractorMessage, ExtractorMessageCategory } from '../api/ExtractorMessage';
|
|
8
|
+
import { allExtractorMessageIds } from '../api/ExtractorMessageId';
|
|
9
|
+
import { ExtractorLogLevel } from '../api/ExtractorLogLevel';
|
|
10
|
+
import { ConsoleMessageId } from '../api/ConsoleMessageId';
|
|
11
|
+
export class MessageRouter {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
// Normalized representation of the routing rules from api-extractor.json
|
|
14
|
+
this._reportingRuleByMessageId = new Map();
|
|
15
|
+
this._compilerDefaultRule = {
|
|
16
|
+
logLevel: ExtractorLogLevel.None,
|
|
17
|
+
addToApiReportFile: false
|
|
18
|
+
};
|
|
19
|
+
this._extractorDefaultRule = {
|
|
20
|
+
logLevel: ExtractorLogLevel.None,
|
|
21
|
+
addToApiReportFile: false
|
|
22
|
+
};
|
|
23
|
+
this._tsdocDefaultRule = { logLevel: ExtractorLogLevel.None, addToApiReportFile: false };
|
|
24
|
+
this.errorCount = 0;
|
|
25
|
+
this.warningCount = 0;
|
|
26
|
+
this._workingPackageFolder = options.workingPackageFolder;
|
|
27
|
+
this._messageCallback = options.messageCallback;
|
|
28
|
+
this._messages = [];
|
|
29
|
+
this._associatedMessagesForAstDeclaration = new Map();
|
|
30
|
+
this._sourceMapper = options.sourceMapper;
|
|
31
|
+
this._tsdocConfiguration = options.tsdocConfiguration;
|
|
32
|
+
// showDiagnostics implies showVerboseMessages
|
|
33
|
+
this.showVerboseMessages = options.showVerboseMessages || options.showDiagnostics;
|
|
34
|
+
this.showDiagnostics = options.showDiagnostics;
|
|
35
|
+
this._applyMessagesConfig(options.messagesConfig);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Read the api-extractor.json configuration and build up the tables of routing rules.
|
|
39
|
+
*/
|
|
40
|
+
_applyMessagesConfig(messagesConfig) {
|
|
41
|
+
if (messagesConfig.compilerMessageReporting) {
|
|
42
|
+
for (const messageId of Object.getOwnPropertyNames(messagesConfig.compilerMessageReporting)) {
|
|
43
|
+
const reportingRule = MessageRouter._getNormalizedRule(messagesConfig.compilerMessageReporting[messageId]);
|
|
44
|
+
if (messageId === 'default') {
|
|
45
|
+
this._compilerDefaultRule = reportingRule;
|
|
46
|
+
}
|
|
47
|
+
else if (!/^TS[0-9]+$/.test(messageId)) {
|
|
48
|
+
throw new Error(`Error in API Extractor config: The messages.compilerMessageReporting table contains` +
|
|
49
|
+
` an invalid entry "${messageId}". The identifier format is "TS" followed by an integer.`);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this._reportingRuleByMessageId.set(messageId, reportingRule);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (messagesConfig.extractorMessageReporting) {
|
|
57
|
+
for (const messageId of Object.getOwnPropertyNames(messagesConfig.extractorMessageReporting)) {
|
|
58
|
+
const reportingRule = MessageRouter._getNormalizedRule(messagesConfig.extractorMessageReporting[messageId]);
|
|
59
|
+
if (messageId === 'default') {
|
|
60
|
+
this._extractorDefaultRule = reportingRule;
|
|
61
|
+
}
|
|
62
|
+
else if (!/^ae-/.test(messageId)) {
|
|
63
|
+
throw new Error(`Error in API Extractor config: The messages.extractorMessageReporting table contains` +
|
|
64
|
+
` an invalid entry "${messageId}". The name should begin with the "ae-" prefix.`);
|
|
65
|
+
}
|
|
66
|
+
else if (!allExtractorMessageIds.has(messageId)) {
|
|
67
|
+
throw new Error(`Error in API Extractor config: The messages.extractorMessageReporting table contains` +
|
|
68
|
+
` an unrecognized identifier "${messageId}". Is it spelled correctly?`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this._reportingRuleByMessageId.set(messageId, reportingRule);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (messagesConfig.tsdocMessageReporting) {
|
|
76
|
+
for (const messageId of Object.getOwnPropertyNames(messagesConfig.tsdocMessageReporting)) {
|
|
77
|
+
const reportingRule = MessageRouter._getNormalizedRule(messagesConfig.tsdocMessageReporting[messageId]);
|
|
78
|
+
if (messageId === 'default') {
|
|
79
|
+
this._tsdocDefaultRule = reportingRule;
|
|
80
|
+
}
|
|
81
|
+
else if (!/^tsdoc-/.test(messageId)) {
|
|
82
|
+
throw new Error(`Error in API Extractor config: The messages.tsdocMessageReporting table contains` +
|
|
83
|
+
` an invalid entry "${messageId}". The name should begin with the "tsdoc-" prefix.`);
|
|
84
|
+
}
|
|
85
|
+
else if (!this._tsdocConfiguration.isKnownMessageId(messageId)) {
|
|
86
|
+
throw new Error(`Error in API Extractor config: The messages.tsdocMessageReporting table contains` +
|
|
87
|
+
` an unrecognized identifier "${messageId}". Is it spelled correctly?`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this._reportingRuleByMessageId.set(messageId, reportingRule);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
static _getNormalizedRule(rule) {
|
|
96
|
+
return {
|
|
97
|
+
logLevel: rule.logLevel || 'none',
|
|
98
|
+
addToApiReportFile: rule.addToApiReportFile || false
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
get messages() {
|
|
102
|
+
return this._messages;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Add a diagnostic message reported by the TypeScript compiler
|
|
106
|
+
*/
|
|
107
|
+
addCompilerDiagnostic(diagnostic) {
|
|
108
|
+
switch (diagnostic.category) {
|
|
109
|
+
case ts.DiagnosticCategory.Suggestion:
|
|
110
|
+
case ts.DiagnosticCategory.Message:
|
|
111
|
+
return; // ignore noise
|
|
112
|
+
}
|
|
113
|
+
const messageText = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
|
114
|
+
const options = {
|
|
115
|
+
category: ExtractorMessageCategory.Compiler,
|
|
116
|
+
messageId: `TS${diagnostic.code}`,
|
|
117
|
+
text: messageText
|
|
118
|
+
};
|
|
119
|
+
if (diagnostic.file) {
|
|
120
|
+
// NOTE: Since compiler errors pertain to issues specific to the .d.ts files,
|
|
121
|
+
// we do not apply source mappings for them.
|
|
122
|
+
const sourceFile = diagnostic.file;
|
|
123
|
+
const sourceLocation = this._sourceMapper.getSourceLocation({
|
|
124
|
+
sourceFile,
|
|
125
|
+
pos: diagnostic.start || 0,
|
|
126
|
+
useDtsLocation: true
|
|
127
|
+
});
|
|
128
|
+
options.sourceFilePath = sourceLocation.sourceFilePath;
|
|
129
|
+
options.sourceFileLine = sourceLocation.sourceFileLine;
|
|
130
|
+
options.sourceFileColumn = sourceLocation.sourceFileColumn;
|
|
131
|
+
}
|
|
132
|
+
this._messages.push(new ExtractorMessage(options));
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Add a message from the API Extractor analysis
|
|
136
|
+
*/
|
|
137
|
+
addAnalyzerIssue(messageId, messageText, astDeclarationOrSymbol, properties) {
|
|
138
|
+
let astDeclaration;
|
|
139
|
+
if (astDeclarationOrSymbol instanceof AstDeclaration) {
|
|
140
|
+
astDeclaration = astDeclarationOrSymbol;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
astDeclaration = astDeclarationOrSymbol.astDeclarations[0];
|
|
144
|
+
}
|
|
145
|
+
const extractorMessage = this.addAnalyzerIssueForPosition(messageId, messageText, astDeclaration.declaration.getSourceFile(), astDeclaration.declaration.getStart(), properties);
|
|
146
|
+
this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Add all messages produced from an invocation of the TSDoc parser, assuming they refer to
|
|
150
|
+
* code in the specified source file.
|
|
151
|
+
*/
|
|
152
|
+
addTsdocMessages(parserContext, sourceFile, astDeclaration) {
|
|
153
|
+
for (const message of parserContext.log.messages) {
|
|
154
|
+
const options = {
|
|
155
|
+
category: ExtractorMessageCategory.TSDoc,
|
|
156
|
+
messageId: message.messageId,
|
|
157
|
+
text: message.unformattedText
|
|
158
|
+
};
|
|
159
|
+
const sourceLocation = this._sourceMapper.getSourceLocation({
|
|
160
|
+
sourceFile,
|
|
161
|
+
pos: message.textRange.pos
|
|
162
|
+
});
|
|
163
|
+
options.sourceFilePath = sourceLocation.sourceFilePath;
|
|
164
|
+
options.sourceFileLine = sourceLocation.sourceFileLine;
|
|
165
|
+
options.sourceFileColumn = sourceLocation.sourceFileColumn;
|
|
166
|
+
const extractorMessage = new ExtractorMessage(options);
|
|
167
|
+
if (astDeclaration) {
|
|
168
|
+
this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);
|
|
169
|
+
}
|
|
170
|
+
this._messages.push(extractorMessage);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Recursively collects the primitive members (numbers, strings, arrays, etc) into an object that
|
|
175
|
+
* is JSON serializable. This is used by the "--diagnostics" feature to dump the state of configuration objects.
|
|
176
|
+
*
|
|
177
|
+
* @returns a JSON serializable object (possibly including `null` values)
|
|
178
|
+
* or `undefined` if the input cannot be represented as JSON
|
|
179
|
+
*/
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
181
|
+
static buildJsonDumpObject(input, options) {
|
|
182
|
+
if (!options) {
|
|
183
|
+
options = {};
|
|
184
|
+
}
|
|
185
|
+
const keyNamesToOmit = new Set(options.keyNamesToOmit);
|
|
186
|
+
return MessageRouter._buildJsonDumpObject(input, keyNamesToOmit);
|
|
187
|
+
}
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
189
|
+
static _buildJsonDumpObject(input, keyNamesToOmit) {
|
|
190
|
+
if (input === null || input === undefined) {
|
|
191
|
+
return null; // JSON uses null instead of undefined
|
|
192
|
+
}
|
|
193
|
+
switch (typeof input) {
|
|
194
|
+
case 'boolean':
|
|
195
|
+
case 'number':
|
|
196
|
+
case 'string':
|
|
197
|
+
return input;
|
|
198
|
+
case 'object':
|
|
199
|
+
if (Array.isArray(input)) {
|
|
200
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
201
|
+
const outputArray = [];
|
|
202
|
+
for (const element of input) {
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
204
|
+
const serializedElement = MessageRouter._buildJsonDumpObject(element, keyNamesToOmit);
|
|
205
|
+
if (serializedElement !== undefined) {
|
|
206
|
+
outputArray.push(serializedElement);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return outputArray;
|
|
210
|
+
}
|
|
211
|
+
const outputObject = {};
|
|
212
|
+
for (const key of Object.getOwnPropertyNames(input)) {
|
|
213
|
+
if (keyNamesToOmit.has(key)) {
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
217
|
+
const value = input[key];
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
219
|
+
const serializedValue = MessageRouter._buildJsonDumpObject(value, keyNamesToOmit);
|
|
220
|
+
if (serializedValue !== undefined) {
|
|
221
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
222
|
+
outputObject[key] = serializedValue;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return outputObject;
|
|
226
|
+
}
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Record this message in _associatedMessagesForAstDeclaration
|
|
231
|
+
*/
|
|
232
|
+
_associateMessageWithAstDeclaration(extractorMessage, astDeclaration) {
|
|
233
|
+
let associatedMessages = this._associatedMessagesForAstDeclaration.get(astDeclaration);
|
|
234
|
+
if (!associatedMessages) {
|
|
235
|
+
associatedMessages = [];
|
|
236
|
+
this._associatedMessagesForAstDeclaration.set(astDeclaration, associatedMessages);
|
|
237
|
+
}
|
|
238
|
+
associatedMessages.push(extractorMessage);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Add a message for a location in an arbitrary source file.
|
|
242
|
+
*/
|
|
243
|
+
addAnalyzerIssueForPosition(messageId, messageText, sourceFile, pos, properties) {
|
|
244
|
+
const options = {
|
|
245
|
+
category: ExtractorMessageCategory.Extractor,
|
|
246
|
+
messageId,
|
|
247
|
+
text: messageText,
|
|
248
|
+
properties
|
|
249
|
+
};
|
|
250
|
+
const sourceLocation = this._sourceMapper.getSourceLocation({
|
|
251
|
+
sourceFile,
|
|
252
|
+
pos
|
|
253
|
+
});
|
|
254
|
+
options.sourceFilePath = sourceLocation.sourceFilePath;
|
|
255
|
+
options.sourceFileLine = sourceLocation.sourceFileLine;
|
|
256
|
+
options.sourceFileColumn = sourceLocation.sourceFileColumn;
|
|
257
|
+
const extractorMessage = new ExtractorMessage(options);
|
|
258
|
+
this._messages.push(extractorMessage);
|
|
259
|
+
return extractorMessage;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* This is used when writing the API report file. It looks up any messages that were configured to get emitted
|
|
263
|
+
* in the API report file and returns them. It also records that they were emitted, which suppresses them from
|
|
264
|
+
* being shown on the console.
|
|
265
|
+
*/
|
|
266
|
+
fetchAssociatedMessagesForReviewFile(astDeclaration) {
|
|
267
|
+
const messagesForApiReportFile = [];
|
|
268
|
+
const associatedMessages = this._associatedMessagesForAstDeclaration.get(astDeclaration) || [];
|
|
269
|
+
for (const associatedMessage of associatedMessages) {
|
|
270
|
+
// Make sure we didn't already report this message for some reason
|
|
271
|
+
if (!associatedMessage.handled) {
|
|
272
|
+
// Is this message type configured to go in the API report file?
|
|
273
|
+
const reportingRule = this._getRuleForMessage(associatedMessage);
|
|
274
|
+
if (reportingRule.addToApiReportFile) {
|
|
275
|
+
// Include it in the result, and record that it went to the API report file
|
|
276
|
+
messagesForApiReportFile.push(associatedMessage);
|
|
277
|
+
associatedMessage.handled = true;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
this._sortMessagesForOutput(messagesForApiReportFile);
|
|
282
|
+
return messagesForApiReportFile;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not
|
|
286
|
+
* retrieved using `fetchAssociatedMessagesForReviewFile()`.
|
|
287
|
+
*/
|
|
288
|
+
fetchUnassociatedMessagesForReviewFile() {
|
|
289
|
+
const messagesForApiReportFile = [];
|
|
290
|
+
for (const unassociatedMessage of this.messages) {
|
|
291
|
+
// Make sure we didn't already report this message for some reason
|
|
292
|
+
if (!unassociatedMessage.handled) {
|
|
293
|
+
// Is this message type configured to go in the API report file?
|
|
294
|
+
const reportingRule = this._getRuleForMessage(unassociatedMessage);
|
|
295
|
+
if (reportingRule.addToApiReportFile) {
|
|
296
|
+
// Include it in the result, and record that it went to the API report file
|
|
297
|
+
messagesForApiReportFile.push(unassociatedMessage);
|
|
298
|
+
unassociatedMessage.handled = true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
this._sortMessagesForOutput(messagesForApiReportFile);
|
|
303
|
+
return messagesForApiReportFile;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* This returns the list of remaining messages that were not already processed by
|
|
307
|
+
* `fetchAssociatedMessagesForReviewFile()` or `fetchUnassociatedMessagesForReviewFile()`.
|
|
308
|
+
* These messages will be shown on the console.
|
|
309
|
+
*/
|
|
310
|
+
handleRemainingNonConsoleMessages() {
|
|
311
|
+
const messagesForLogger = [];
|
|
312
|
+
for (const message of this.messages) {
|
|
313
|
+
// Make sure we didn't already report this message
|
|
314
|
+
if (!message.handled) {
|
|
315
|
+
messagesForLogger.push(message);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
this._sortMessagesForOutput(messagesForLogger);
|
|
319
|
+
for (const message of messagesForLogger) {
|
|
320
|
+
this._handleMessage(message);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
logError(messageId, message, properties) {
|
|
324
|
+
this._handleMessage(new ExtractorMessage({
|
|
325
|
+
category: ExtractorMessageCategory.Console,
|
|
326
|
+
messageId,
|
|
327
|
+
text: message,
|
|
328
|
+
properties,
|
|
329
|
+
logLevel: ExtractorLogLevel.Error
|
|
330
|
+
}));
|
|
331
|
+
}
|
|
332
|
+
logWarning(messageId, message, properties) {
|
|
333
|
+
this._handleMessage(new ExtractorMessage({
|
|
334
|
+
category: ExtractorMessageCategory.Console,
|
|
335
|
+
messageId,
|
|
336
|
+
text: message,
|
|
337
|
+
properties,
|
|
338
|
+
logLevel: ExtractorLogLevel.Warning
|
|
339
|
+
}));
|
|
340
|
+
}
|
|
341
|
+
logInfo(messageId, message, properties) {
|
|
342
|
+
this._handleMessage(new ExtractorMessage({
|
|
343
|
+
category: ExtractorMessageCategory.Console,
|
|
344
|
+
messageId,
|
|
345
|
+
text: message,
|
|
346
|
+
properties,
|
|
347
|
+
logLevel: ExtractorLogLevel.Info
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
logVerbose(messageId, message, properties) {
|
|
351
|
+
this._handleMessage(new ExtractorMessage({
|
|
352
|
+
category: ExtractorMessageCategory.Console,
|
|
353
|
+
messageId,
|
|
354
|
+
text: message,
|
|
355
|
+
properties,
|
|
356
|
+
logLevel: ExtractorLogLevel.Verbose
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
logDiagnosticHeader(title) {
|
|
360
|
+
this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);
|
|
361
|
+
this.logDiagnostic(`DIAGNOSTIC: ` + title);
|
|
362
|
+
this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);
|
|
363
|
+
}
|
|
364
|
+
logDiagnosticFooter() {
|
|
365
|
+
this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE + '\n');
|
|
366
|
+
}
|
|
367
|
+
logDiagnostic(message) {
|
|
368
|
+
if (this.showDiagnostics) {
|
|
369
|
+
this.logVerbose(ConsoleMessageId.Diagnostics, message);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Give the calling application a chance to handle the `ExtractorMessage`, and if not, display it on the console.
|
|
374
|
+
*/
|
|
375
|
+
_handleMessage(message) {
|
|
376
|
+
// Don't tally messages that were already "handled" by writing them into the API report
|
|
377
|
+
if (message.handled) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
// Assign the ExtractorMessage.logLevel; the message callback may adjust it below
|
|
381
|
+
if (message.category === ExtractorMessageCategory.Console) {
|
|
382
|
+
// Console messages have their category log level assigned via logInfo(), logVerbose(), etc.
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
const reportingRule = this._getRuleForMessage(message);
|
|
386
|
+
message.logLevel = reportingRule.logLevel;
|
|
387
|
+
}
|
|
388
|
+
// If there is a callback, allow it to modify and/or handle the message
|
|
389
|
+
if (this._messageCallback) {
|
|
390
|
+
this._messageCallback(message);
|
|
391
|
+
}
|
|
392
|
+
// Update the statistics
|
|
393
|
+
switch (message.logLevel) {
|
|
394
|
+
case ExtractorLogLevel.Error:
|
|
395
|
+
++this.errorCount;
|
|
396
|
+
break;
|
|
397
|
+
case ExtractorLogLevel.Warning:
|
|
398
|
+
++this.warningCount;
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
if (message.handled) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
// The messageCallback did not handle the message, so perform default handling
|
|
405
|
+
message.handled = true;
|
|
406
|
+
if (message.logLevel === ExtractorLogLevel.None) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
let messageText;
|
|
410
|
+
if (message.category === ExtractorMessageCategory.Console) {
|
|
411
|
+
messageText = message.text;
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
messageText = message.formatMessageWithLocation(this._workingPackageFolder);
|
|
415
|
+
}
|
|
416
|
+
switch (message.logLevel) {
|
|
417
|
+
case ExtractorLogLevel.Error:
|
|
418
|
+
console.error(Colorize.red('Error: ' + messageText));
|
|
419
|
+
break;
|
|
420
|
+
case ExtractorLogLevel.Warning:
|
|
421
|
+
console.warn(Colorize.yellow('Warning: ' + messageText));
|
|
422
|
+
break;
|
|
423
|
+
case ExtractorLogLevel.Info:
|
|
424
|
+
console.log(messageText);
|
|
425
|
+
break;
|
|
426
|
+
case ExtractorLogLevel.Verbose:
|
|
427
|
+
if (this.showVerboseMessages) {
|
|
428
|
+
console.log(Colorize.cyan(messageText));
|
|
429
|
+
}
|
|
430
|
+
break;
|
|
431
|
+
default:
|
|
432
|
+
throw new Error(`Invalid logLevel value: ${JSON.stringify(message.logLevel)}`);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* For a given message, determine the IReportingRule based on the rule tables.
|
|
437
|
+
*/
|
|
438
|
+
_getRuleForMessage(message) {
|
|
439
|
+
const reportingRule = this._reportingRuleByMessageId.get(message.messageId);
|
|
440
|
+
if (reportingRule) {
|
|
441
|
+
return reportingRule;
|
|
442
|
+
}
|
|
443
|
+
switch (message.category) {
|
|
444
|
+
case ExtractorMessageCategory.Compiler:
|
|
445
|
+
return this._compilerDefaultRule;
|
|
446
|
+
case ExtractorMessageCategory.Extractor:
|
|
447
|
+
return this._extractorDefaultRule;
|
|
448
|
+
case ExtractorMessageCategory.TSDoc:
|
|
449
|
+
return this._tsdocDefaultRule;
|
|
450
|
+
case ExtractorMessageCategory.Console:
|
|
451
|
+
throw new InternalError('ExtractorMessageCategory.Console is not supported with IReportingRule');
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Sorts an array of messages according to a reasonable ordering
|
|
456
|
+
*/
|
|
457
|
+
_sortMessagesForOutput(messages) {
|
|
458
|
+
messages.sort((a, b) => {
|
|
459
|
+
let diff;
|
|
460
|
+
// First sort by file name
|
|
461
|
+
diff = Sort.compareByValue(a.sourceFilePath, b.sourceFilePath);
|
|
462
|
+
if (diff !== 0) {
|
|
463
|
+
return diff;
|
|
464
|
+
}
|
|
465
|
+
// Then sort by line number
|
|
466
|
+
diff = Sort.compareByValue(a.sourceFileLine, b.sourceFileLine);
|
|
467
|
+
if (diff !== 0) {
|
|
468
|
+
return diff;
|
|
469
|
+
}
|
|
470
|
+
// Then sort by messageId
|
|
471
|
+
return Sort.compareByValue(a.messageId, b.messageId);
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
MessageRouter.DIAGNOSTICS_LINE = '============================================================';
|
|
476
|
+
//# sourceMappingURL=MessageRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageRouter.js","sourceRoot":"","sources":["../../src/collector/MessageRouter.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EAGzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA2B,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAG5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAwB3D,MAAM,OAAO,aAAa;IA0CxB,YAAmB,OAA8B;QAzBjD,yEAAyE;QACjE,8BAAyB,GAAgC,IAAI,GA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AC,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YACD,yBAAyB;YACzB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC;;AAnmBsB,8BAAgB,GACrC,8DAA8D,AADzB,CAC0B","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 * as tsdoc from '@microsoft/tsdoc';\nimport { Sort, InternalError } from '@rushstack/node-core-library';\nimport { Colorize } from '@rushstack/terminal';\n\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { AstSymbol } from '../analyzer/AstSymbol';\nimport {\n ExtractorMessage,\n ExtractorMessageCategory,\n type IExtractorMessageOptions,\n type IExtractorMessageProperties\n} from '../api/ExtractorMessage';\nimport { type ExtractorMessageId, allExtractorMessageIds } from '../api/ExtractorMessageId';\nimport type { IExtractorMessagesConfig, IConfigMessageReportingRule } from '../api/IConfigFile';\nimport type { ISourceLocation, SourceMapper } from './SourceMapper';\nimport { ExtractorLogLevel } from '../api/ExtractorLogLevel';\nimport { ConsoleMessageId } from '../api/ConsoleMessageId';\n\ninterface IReportingRule {\n logLevel: ExtractorLogLevel;\n addToApiReportFile: boolean;\n}\n\nexport interface IMessageRouterOptions {\n workingPackageFolder: string | undefined;\n messageCallback: ((message: ExtractorMessage) => void) | undefined;\n messagesConfig: IExtractorMessagesConfig;\n showVerboseMessages: boolean;\n showDiagnostics: boolean;\n tsdocConfiguration: tsdoc.TSDocConfiguration;\n sourceMapper: SourceMapper;\n}\n\nexport interface IBuildJsonDumpObjectOptions {\n /**\n * {@link MessageRouter.buildJsonDumpObject} will omit any objects keys with these names.\n */\n keyNamesToOmit?: string[];\n}\n\nexport class MessageRouter {\n public static readonly DIAGNOSTICS_LINE: string =\n '============================================================';\n\n private readonly _workingPackageFolder: string | undefined;\n private readonly _messageCallback: ((message: ExtractorMessage) => void) | undefined;\n\n // All messages\n private readonly _messages: ExtractorMessage[];\n\n // For each AstDeclaration, the messages associated with it. This is used when addToApiReportFile=true\n private readonly _associatedMessagesForAstDeclaration: Map<AstDeclaration, ExtractorMessage[]>;\n\n private readonly _sourceMapper: SourceMapper;\n\n private readonly _tsdocConfiguration: tsdoc.TSDocConfiguration;\n\n // Normalized representation of the routing rules from api-extractor.json\n private _reportingRuleByMessageId: Map<string, IReportingRule> = new Map<string, IReportingRule>();\n private _compilerDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _extractorDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _tsdocDefaultRule: IReportingRule = { logLevel: ExtractorLogLevel.None, addToApiReportFile: false };\n\n public errorCount: number = 0;\n public warningCount: number = 0;\n\n /**\n * See {@link IExtractorInvokeOptions.showVerboseMessages}\n */\n public readonly showVerboseMessages: boolean;\n\n /**\n * See {@link IExtractorInvokeOptions.showDiagnostics}\n */\n public readonly showDiagnostics: boolean;\n\n public constructor(options: IMessageRouterOptions) {\n this._workingPackageFolder = options.workingPackageFolder;\n this._messageCallback = options.messageCallback;\n\n this._messages = [];\n this._associatedMessagesForAstDeclaration = new Map<AstDeclaration, ExtractorMessage[]>();\n this._sourceMapper = options.sourceMapper;\n this._tsdocConfiguration = options.tsdocConfiguration;\n\n // showDiagnostics implies showVerboseMessages\n this.showVerboseMessages = options.showVerboseMessages || options.showDiagnostics;\n this.showDiagnostics = options.showDiagnostics;\n\n this._applyMessagesConfig(options.messagesConfig);\n }\n\n /**\n * Read the api-extractor.json configuration and build up the tables of routing rules.\n */\n private _applyMessagesConfig(messagesConfig: IExtractorMessagesConfig): void {\n if (messagesConfig.compilerMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.compilerMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.compilerMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._compilerDefaultRule = reportingRule;\n } else if (!/^TS[0-9]+$/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.compilerMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The identifier format is \"TS\" followed by an integer.`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.extractorMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.extractorMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.extractorMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._extractorDefaultRule = reportingRule;\n } else if (!/^ae-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"ae-\" prefix.`\n );\n } else if (!allExtractorMessageIds.has(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.tsdocMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.tsdocMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.tsdocMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._tsdocDefaultRule = reportingRule;\n } else if (!/^tsdoc-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"tsdoc-\" prefix.`\n );\n } else if (!this._tsdocConfiguration.isKnownMessageId(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n }\n\n private static _getNormalizedRule(rule: IConfigMessageReportingRule): IReportingRule {\n return {\n logLevel: rule.logLevel || 'none',\n addToApiReportFile: rule.addToApiReportFile || false\n };\n }\n\n public get messages(): ReadonlyArray<ExtractorMessage> {\n return this._messages;\n }\n\n /**\n * Add a diagnostic message reported by the TypeScript compiler\n */\n public addCompilerDiagnostic(diagnostic: ts.Diagnostic): void {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Suggestion:\n case ts.DiagnosticCategory.Message:\n return; // ignore noise\n }\n\n const messageText: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Compiler,\n messageId: `TS${diagnostic.code}`,\n text: messageText\n };\n\n if (diagnostic.file) {\n // NOTE: Since compiler errors pertain to issues specific to the .d.ts files,\n // we do not apply source mappings for them.\n const sourceFile: ts.SourceFile = diagnostic.file;\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: diagnostic.start || 0,\n useDtsLocation: true\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n }\n\n this._messages.push(new ExtractorMessage(options));\n }\n\n /**\n * Add a message from the API Extractor analysis\n */\n public addAnalyzerIssue(\n messageId: ExtractorMessageId,\n messageText: string,\n astDeclarationOrSymbol: AstDeclaration | AstSymbol,\n properties?: IExtractorMessageProperties\n ): void {\n let astDeclaration: AstDeclaration;\n if (astDeclarationOrSymbol instanceof AstDeclaration) {\n astDeclaration = astDeclarationOrSymbol;\n } else {\n astDeclaration = astDeclarationOrSymbol.astDeclarations[0];\n }\n\n const extractorMessage: ExtractorMessage = this.addAnalyzerIssueForPosition(\n messageId,\n messageText,\n astDeclaration.declaration.getSourceFile(),\n astDeclaration.declaration.getStart(),\n properties\n );\n\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n /**\n * Add all messages produced from an invocation of the TSDoc parser, assuming they refer to\n * code in the specified source file.\n */\n public addTsdocMessages(\n parserContext: tsdoc.ParserContext,\n sourceFile: ts.SourceFile,\n astDeclaration?: AstDeclaration\n ): void {\n for (const message of parserContext.log.messages) {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.TSDoc,\n messageId: message.messageId,\n text: message.unformattedText\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: message.textRange.pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n if (astDeclaration) {\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n this._messages.push(extractorMessage);\n }\n }\n\n /**\n * Recursively collects the primitive members (numbers, strings, arrays, etc) into an object that\n * is JSON serializable. This is used by the \"--diagnostics\" feature to dump the state of configuration objects.\n *\n * @returns a JSON serializable object (possibly including `null` values)\n * or `undefined` if the input cannot be represented as JSON\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public static buildJsonDumpObject(input: any, options?: IBuildJsonDumpObjectOptions): any | undefined {\n if (!options) {\n options = {};\n }\n\n const keyNamesToOmit: Set<string> = new Set(options.keyNamesToOmit);\n\n return MessageRouter._buildJsonDumpObject(input, keyNamesToOmit);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private static _buildJsonDumpObject(input: any, keyNamesToOmit: Set<string>): any | undefined {\n if (input === null || input === undefined) {\n return null; // JSON uses null instead of undefined\n }\n\n switch (typeof input) {\n case 'boolean':\n case 'number':\n case 'string':\n return input;\n case 'object':\n if (Array.isArray(input)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputArray: any[] = [];\n for (const element of input) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedElement: any = MessageRouter._buildJsonDumpObject(element, keyNamesToOmit);\n if (serializedElement !== undefined) {\n outputArray.push(serializedElement);\n }\n }\n return outputArray;\n }\n\n const outputObject: object = {};\n for (const key of Object.getOwnPropertyNames(input)) {\n if (keyNamesToOmit.has(key)) {\n continue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value: any = input[key];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedValue: any = MessageRouter._buildJsonDumpObject(value, keyNamesToOmit);\n\n if (serializedValue !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (outputObject as any)[key] = serializedValue;\n }\n }\n return outputObject;\n }\n\n return undefined;\n }\n\n /**\n * Record this message in _associatedMessagesForAstDeclaration\n */\n private _associateMessageWithAstDeclaration(\n extractorMessage: ExtractorMessage,\n astDeclaration: AstDeclaration\n ): void {\n let associatedMessages: ExtractorMessage[] | undefined =\n this._associatedMessagesForAstDeclaration.get(astDeclaration);\n\n if (!associatedMessages) {\n associatedMessages = [];\n this._associatedMessagesForAstDeclaration.set(astDeclaration, associatedMessages);\n }\n associatedMessages.push(extractorMessage);\n }\n\n /**\n * Add a message for a location in an arbitrary source file.\n */\n public addAnalyzerIssueForPosition(\n messageId: ExtractorMessageId,\n messageText: string,\n sourceFile: ts.SourceFile,\n pos: number,\n properties?: IExtractorMessageProperties\n ): ExtractorMessage {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Extractor,\n messageId,\n text: messageText,\n properties\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n this._messages.push(extractorMessage);\n return extractorMessage;\n }\n\n /**\n * This is used when writing the API report file. It looks up any messages that were configured to get emitted\n * in the API report file and returns them. It also records that they were emitted, which suppresses them from\n * being shown on the console.\n */\n public fetchAssociatedMessagesForReviewFile(astDeclaration: AstDeclaration): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n const associatedMessages: ExtractorMessage[] =\n this._associatedMessagesForAstDeclaration.get(astDeclaration) || [];\n for (const associatedMessage of associatedMessages) {\n // Make sure we didn't already report this message for some reason\n if (!associatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(associatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(associatedMessage);\n associatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not\n * retrieved using `fetchAssociatedMessagesForReviewFile()`.\n */\n public fetchUnassociatedMessagesForReviewFile(): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n for (const unassociatedMessage of this.messages) {\n // Make sure we didn't already report this message for some reason\n if (!unassociatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(unassociatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(unassociatedMessage);\n unassociatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns the list of remaining messages that were not already processed by\n * `fetchAssociatedMessagesForReviewFile()` or `fetchUnassociatedMessagesForReviewFile()`.\n * These messages will be shown on the console.\n */\n public handleRemainingNonConsoleMessages(): void {\n const messagesForLogger: ExtractorMessage[] = [];\n\n for (const message of this.messages) {\n // Make sure we didn't already report this message\n if (!message.handled) {\n messagesForLogger.push(message);\n }\n }\n\n this._sortMessagesForOutput(messagesForLogger);\n\n for (const message of messagesForLogger) {\n this._handleMessage(message);\n }\n }\n\n public logError(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Error\n })\n );\n }\n\n public logWarning(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Warning\n })\n );\n }\n\n public logInfo(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Info\n })\n );\n }\n\n public logVerbose(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Verbose\n })\n );\n }\n\n public logDiagnosticHeader(title: string): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n this.logDiagnostic(`DIAGNOSTIC: ` + title);\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n }\n\n public logDiagnosticFooter(): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE + '\\n');\n }\n\n public logDiagnostic(message: string): void {\n if (this.showDiagnostics) {\n this.logVerbose(ConsoleMessageId.Diagnostics, message);\n }\n }\n\n /**\n * Give the calling application a chance to handle the `ExtractorMessage`, and if not, display it on the console.\n */\n private _handleMessage(message: ExtractorMessage): void {\n // Don't tally messages that were already \"handled\" by writing them into the API report\n if (message.handled) {\n return;\n }\n\n // Assign the ExtractorMessage.logLevel; the message callback may adjust it below\n if (message.category === ExtractorMessageCategory.Console) {\n // Console messages have their category log level assigned via logInfo(), logVerbose(), etc.\n } else {\n const reportingRule: IReportingRule = this._getRuleForMessage(message);\n message.logLevel = reportingRule.logLevel;\n }\n\n // If there is a callback, allow it to modify and/or handle the message\n if (this._messageCallback) {\n this._messageCallback(message);\n }\n\n // Update the statistics\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n ++this.errorCount;\n break;\n case ExtractorLogLevel.Warning:\n ++this.warningCount;\n break;\n }\n\n if (message.handled) {\n return;\n }\n\n // The messageCallback did not handle the message, so perform default handling\n message.handled = true;\n\n if (message.logLevel === ExtractorLogLevel.None) {\n return;\n }\n\n let messageText: string;\n if (message.category === ExtractorMessageCategory.Console) {\n messageText = message.text;\n } else {\n messageText = message.formatMessageWithLocation(this._workingPackageFolder);\n }\n\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n console.error(Colorize.red('Error: ' + messageText));\n break;\n case ExtractorLogLevel.Warning:\n console.warn(Colorize.yellow('Warning: ' + messageText));\n break;\n case ExtractorLogLevel.Info:\n console.log(messageText);\n break;\n case ExtractorLogLevel.Verbose:\n if (this.showVerboseMessages) {\n console.log(Colorize.cyan(messageText));\n }\n break;\n default:\n throw new Error(`Invalid logLevel value: ${JSON.stringify(message.logLevel)}`);\n }\n }\n\n /**\n * For a given message, determine the IReportingRule based on the rule tables.\n */\n private _getRuleForMessage(message: ExtractorMessage): IReportingRule {\n const reportingRule: IReportingRule | undefined = this._reportingRuleByMessageId.get(message.messageId);\n if (reportingRule) {\n return reportingRule;\n }\n switch (message.category) {\n case ExtractorMessageCategory.Compiler:\n return this._compilerDefaultRule;\n case ExtractorMessageCategory.Extractor:\n return this._extractorDefaultRule;\n case ExtractorMessageCategory.TSDoc:\n return this._tsdocDefaultRule;\n case ExtractorMessageCategory.Console:\n throw new InternalError('ExtractorMessageCategory.Console is not supported with IReportingRule');\n }\n }\n\n /**\n * Sorts an array of messages according to a reasonable ordering\n */\n private _sortMessagesForOutput(messages: ExtractorMessage[]): void {\n messages.sort((a, b) => {\n let diff: number;\n // First sort by file name\n diff = Sort.compareByValue(a.sourceFilePath, b.sourceFilePath);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by line number\n diff = Sort.compareByValue(a.sourceFileLine, b.sourceFileLine);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by messageId\n return Sort.compareByValue(a.messageId, b.messageId);\n });\n }\n}\n"]}
|