@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
|
@@ -0,0 +1,801 @@
|
|
|
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 path from 'node:path';
|
|
4
|
+
import * as resolve from 'resolve';
|
|
5
|
+
import { EnumMemberOrder, ReleaseTag } from '@microsoft/api-extractor-model';
|
|
6
|
+
import { TSDocConfiguration, TSDocTagDefinition } from '@microsoft/tsdoc';
|
|
7
|
+
import { TSDocConfigFile } from '@microsoft/tsdoc-config';
|
|
8
|
+
import { RigConfig } from '@rushstack/rig-package';
|
|
9
|
+
import { JsonFile, JsonSchema, FileSystem, PackageJsonLookup, PackageName, Text, InternalError, Path, NewlineKind } from '@rushstack/node-core-library';
|
|
10
|
+
import { PackageMetadataManager } from '../analyzer/PackageMetadataManager';
|
|
11
|
+
import { MessageRouter } from '../collector/MessageRouter';
|
|
12
|
+
import apiExtractorSchema from '../schemas/api-extractor.schema.json';
|
|
13
|
+
/** Default {@link IConfigApiReport.reportVariants} */
|
|
14
|
+
const defaultApiReportVariants = ['complete'];
|
|
15
|
+
/**
|
|
16
|
+
* Default {@link IConfigApiReport.tagsToReport}.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Note that this list is externally documented, and directly affects report output.
|
|
20
|
+
* Also note that the order of tags in this list is significant, as it determines the order of tags in the report.
|
|
21
|
+
* Any changes to this list should be considered breaking.
|
|
22
|
+
*/
|
|
23
|
+
const defaultTagsToReport = {
|
|
24
|
+
'@sealed': true,
|
|
25
|
+
'@virtual': true,
|
|
26
|
+
'@override': true,
|
|
27
|
+
'@eventProperty': true,
|
|
28
|
+
'@deprecated': true
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The `ExtractorConfig` class loads, validates, interprets, and represents the api-extractor.json config file.
|
|
32
|
+
* @sealed
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export class ExtractorConfig {
|
|
36
|
+
/**
|
|
37
|
+
* Gets the file path for the "complete" (default) report configuration, if one was specified.
|
|
38
|
+
* Otherwise, returns an empty string.
|
|
39
|
+
* @deprecated Use {@link ExtractorConfig.reportConfigs} to access all report configurations.
|
|
40
|
+
*/
|
|
41
|
+
get reportFilePath() {
|
|
42
|
+
const completeConfig = this._getCompleteReportConfig();
|
|
43
|
+
return completeConfig === undefined ? '' : path.join(this.reportFolder, completeConfig.fileName);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the temp file path for the "complete" (default) report configuration, if one was specified.
|
|
47
|
+
* Otherwise, returns an empty string.
|
|
48
|
+
* @deprecated Use {@link ExtractorConfig.reportConfigs} to access all report configurations.
|
|
49
|
+
*/
|
|
50
|
+
get reportTempFilePath() {
|
|
51
|
+
const completeConfig = this._getCompleteReportConfig();
|
|
52
|
+
return completeConfig === undefined ? '' : path.join(this.reportTempFolder, completeConfig.fileName);
|
|
53
|
+
}
|
|
54
|
+
constructor({ projectFolder, packageJson, packageFolder, mainEntryPointFilePath, bundledPackages, tsconfigFilePath, overrideTsconfig, skipLibCheck, apiReportEnabled, apiReportIncludeForgottenExports, reportConfigs, reportFolder, reportTempFolder, tagsToReport, docModelGenerationOptions, apiJsonFilePath, docModelIncludeForgottenExports, projectFolderUrl, rollupEnabled, untrimmedFilePath, alphaTrimmedFilePath, betaTrimmedFilePath, publicTrimmedFilePath, omitTrimmingComments, tsdocMetadataEnabled, tsdocMetadataFilePath, tsdocConfigFile, tsdocConfiguration, newlineKind, messages, testMode, enumMemberOrder }) {
|
|
55
|
+
this.projectFolder = projectFolder;
|
|
56
|
+
this.packageJson = packageJson;
|
|
57
|
+
this.packageFolder = packageFolder;
|
|
58
|
+
this.mainEntryPointFilePath = mainEntryPointFilePath;
|
|
59
|
+
this.bundledPackages = bundledPackages;
|
|
60
|
+
this.tsconfigFilePath = tsconfigFilePath;
|
|
61
|
+
this.overrideTsconfig = overrideTsconfig;
|
|
62
|
+
this.skipLibCheck = skipLibCheck;
|
|
63
|
+
this.apiReportEnabled = apiReportEnabled;
|
|
64
|
+
this.apiReportIncludeForgottenExports = apiReportIncludeForgottenExports;
|
|
65
|
+
this.reportConfigs = reportConfigs;
|
|
66
|
+
this.reportFolder = reportFolder;
|
|
67
|
+
this.reportTempFolder = reportTempFolder;
|
|
68
|
+
this.tagsToReport = tagsToReport;
|
|
69
|
+
this.docModelGenerationOptions = docModelGenerationOptions;
|
|
70
|
+
this.apiJsonFilePath = apiJsonFilePath;
|
|
71
|
+
this.docModelIncludeForgottenExports = docModelIncludeForgottenExports;
|
|
72
|
+
this.projectFolderUrl = projectFolderUrl;
|
|
73
|
+
this.rollupEnabled = rollupEnabled;
|
|
74
|
+
this.untrimmedFilePath = untrimmedFilePath;
|
|
75
|
+
this.alphaTrimmedFilePath = alphaTrimmedFilePath;
|
|
76
|
+
this.betaTrimmedFilePath = betaTrimmedFilePath;
|
|
77
|
+
this.publicTrimmedFilePath = publicTrimmedFilePath;
|
|
78
|
+
this.omitTrimmingComments = omitTrimmingComments;
|
|
79
|
+
this.tsdocMetadataEnabled = tsdocMetadataEnabled;
|
|
80
|
+
this.tsdocMetadataFilePath = tsdocMetadataFilePath;
|
|
81
|
+
this.tsdocConfigFile = tsdocConfigFile;
|
|
82
|
+
this.tsdocConfiguration = tsdocConfiguration;
|
|
83
|
+
this.newlineKind = newlineKind;
|
|
84
|
+
this.messages = messages;
|
|
85
|
+
this.testMode = testMode;
|
|
86
|
+
this.enumMemberOrder = enumMemberOrder;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns a JSON-like string representing the `ExtractorConfig` state, which can be printed to a console
|
|
90
|
+
* for diagnostic purposes.
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* This is used by the "--diagnostics" command-line option. The string is not intended to be deserialized;
|
|
94
|
+
* its format may be changed at any time.
|
|
95
|
+
*/
|
|
96
|
+
getDiagnosticDump() {
|
|
97
|
+
// Handle the simple JSON-serializable properties using buildJsonDumpObject()
|
|
98
|
+
const result = MessageRouter.buildJsonDumpObject(this, {
|
|
99
|
+
keyNamesToOmit: ['tsdocConfigFile', 'tsdocConfiguration']
|
|
100
|
+
});
|
|
101
|
+
// Implement custom formatting for tsdocConfigFile and tsdocConfiguration
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
+
result.tsdocConfigFile = {
|
|
104
|
+
filePath: this.tsdocConfigFile.filePath,
|
|
105
|
+
log: this.tsdocConfigFile.log.messages.map((x) => x.toString())
|
|
106
|
+
};
|
|
107
|
+
return JSON.stringify(result, undefined, 2);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Returns a simplified file path for use in error messages.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
_getShortFilePath(absolutePath) {
|
|
114
|
+
if (!path.isAbsolute(absolutePath)) {
|
|
115
|
+
throw new InternalError('Expected absolute path: ' + absolutePath);
|
|
116
|
+
}
|
|
117
|
+
if (Path.isUnderOrEqual(absolutePath, this.projectFolder)) {
|
|
118
|
+
return Path.convertToSlashes(path.relative(this.projectFolder, absolutePath));
|
|
119
|
+
}
|
|
120
|
+
return absolutePath;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Searches for the api-extractor.json config file associated with the specified starting folder,
|
|
124
|
+
* and loads the file if found. This lookup supports
|
|
125
|
+
* {@link https://www.npmjs.com/package/@rushstack/rig-package | rig packages}.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* The search will first look for a package.json file in a parent folder of the starting folder;
|
|
129
|
+
* if found, that will be used as the base folder instead of the starting folder. If the config
|
|
130
|
+
* file is not found in `<baseFolder>/api-extractor.json` or `<baseFolder>/config/api-extractor.json`,
|
|
131
|
+
* then `<baseFolder/config/rig.json` will be checked to see whether a
|
|
132
|
+
* {@link https://www.npmjs.com/package/@rushstack/rig-package | rig package} is referenced; if so then
|
|
133
|
+
* the rig's api-extractor.json file will be used instead. If a config file is found, it will be loaded
|
|
134
|
+
* and returned with the `IExtractorConfigPrepareOptions` object. Otherwise, `undefined` is returned
|
|
135
|
+
* to indicate that API Extractor does not appear to be configured for the specified folder.
|
|
136
|
+
*
|
|
137
|
+
* @returns An options object that can be passed to {@link ExtractorConfig.prepare}, or `undefined`
|
|
138
|
+
* if not api-extractor.json file was found.
|
|
139
|
+
*/
|
|
140
|
+
static tryLoadForFolder(options) {
|
|
141
|
+
const packageJsonLookup = options.packageJsonLookup || new PackageJsonLookup();
|
|
142
|
+
const startingFolder = options.startingFolder;
|
|
143
|
+
// Figure out which project we're in and look for the config file at the project root
|
|
144
|
+
const packageJsonFullPath = packageJsonLookup.tryGetPackageJsonFilePathFor(startingFolder);
|
|
145
|
+
const packageFolder = packageJsonFullPath
|
|
146
|
+
? path.dirname(packageJsonFullPath)
|
|
147
|
+
: undefined;
|
|
148
|
+
// If there is no package, then just use the starting folder
|
|
149
|
+
const baseFolder = packageFolder || startingFolder;
|
|
150
|
+
let projectFolderLookupToken = undefined;
|
|
151
|
+
// First try the standard "config" subfolder:
|
|
152
|
+
let configFilename = path.join(baseFolder, 'config', ExtractorConfig.FILENAME);
|
|
153
|
+
if (FileSystem.exists(configFilename)) {
|
|
154
|
+
if (FileSystem.exists(path.join(baseFolder, ExtractorConfig.FILENAME))) {
|
|
155
|
+
throw new Error(`Found conflicting ${ExtractorConfig.FILENAME} files in "." and "./config" folders`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// Otherwise try the top-level folder
|
|
160
|
+
configFilename = path.join(baseFolder, ExtractorConfig.FILENAME);
|
|
161
|
+
if (!FileSystem.exists(configFilename)) {
|
|
162
|
+
// If We didn't find it in <packageFolder>/api-extractor.json or <packageFolder>/config/api-extractor.json
|
|
163
|
+
// then check for a rig package
|
|
164
|
+
if (packageFolder) {
|
|
165
|
+
let rigConfig;
|
|
166
|
+
if (options.rigConfig) {
|
|
167
|
+
// The caller provided an already solved RigConfig. Double-check that it is for the right project.
|
|
168
|
+
if (!Path.isEqual(options.rigConfig.projectFolderPath, packageFolder)) {
|
|
169
|
+
throw new Error('The provided ILoadForFolderOptions.rigConfig is for the wrong project folder:\n' +
|
|
170
|
+
'\nExpected path: ' +
|
|
171
|
+
packageFolder +
|
|
172
|
+
'\nProvided path: ' +
|
|
173
|
+
options.rigConfig.projectFolderOriginalPath);
|
|
174
|
+
}
|
|
175
|
+
rigConfig = options.rigConfig;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
rigConfig = RigConfig.loadForProjectFolder({
|
|
179
|
+
projectFolderPath: packageFolder
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (rigConfig.rigFound) {
|
|
183
|
+
configFilename = path.join(rigConfig.getResolvedProfileFolder(), ExtractorConfig.FILENAME);
|
|
184
|
+
// If the "projectFolder" setting isn't specified in api-extractor.json, it defaults to the
|
|
185
|
+
// "<lookup>" token which will probe for the tsconfig.json nearest to the api-extractor.json path.
|
|
186
|
+
// But this won't work if api-extractor.json belongs to the rig. So instead "<lookup>" should be
|
|
187
|
+
// the "<packageFolder>" that referenced the rig.
|
|
188
|
+
projectFolderLookupToken = packageFolder;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (!FileSystem.exists(configFilename)) {
|
|
192
|
+
// API Extractor does not seem to be configured for this folder
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const configObjectFullPath = path.resolve(configFilename);
|
|
198
|
+
const configObject = ExtractorConfig.loadFile(configObjectFullPath);
|
|
199
|
+
return {
|
|
200
|
+
configObject,
|
|
201
|
+
configObjectFullPath,
|
|
202
|
+
packageJsonFullPath,
|
|
203
|
+
projectFolderLookupToken
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Loads the api-extractor.json config file from the specified file path, and prepares an `ExtractorConfig` object.
|
|
208
|
+
*
|
|
209
|
+
* @remarks
|
|
210
|
+
* Loads the api-extractor.json config file from the specified file path. If the "extends" field is present,
|
|
211
|
+
* the referenced file(s) will be merged. For any omitted fields, the API Extractor default values are merged.
|
|
212
|
+
*
|
|
213
|
+
* The result is prepared using `ExtractorConfig.prepare()`.
|
|
214
|
+
*/
|
|
215
|
+
static loadFileAndPrepare(configJsonFilePath) {
|
|
216
|
+
const configObjectFullPath = path.resolve(configJsonFilePath);
|
|
217
|
+
const configObject = ExtractorConfig.loadFile(configObjectFullPath);
|
|
218
|
+
const packageJsonLookup = new PackageJsonLookup();
|
|
219
|
+
const packageJsonFullPath = packageJsonLookup.tryGetPackageJsonFilePathFor(configObjectFullPath);
|
|
220
|
+
const extractorConfig = ExtractorConfig.prepare({
|
|
221
|
+
configObject,
|
|
222
|
+
configObjectFullPath,
|
|
223
|
+
packageJsonFullPath
|
|
224
|
+
});
|
|
225
|
+
return extractorConfig;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Performs only the first half of {@link ExtractorConfig.loadFileAndPrepare}, providing an opportunity to
|
|
229
|
+
* modify the object before it is passed to {@link ExtractorConfig.prepare}.
|
|
230
|
+
*
|
|
231
|
+
* @remarks
|
|
232
|
+
* Loads the api-extractor.json config file from the specified file path. If the "extends" field is present,
|
|
233
|
+
* the referenced file(s) will be merged. For any omitted fields, the API Extractor default values are merged.
|
|
234
|
+
*/
|
|
235
|
+
static loadFile(jsonFilePath) {
|
|
236
|
+
// Set to keep track of config files which have been processed.
|
|
237
|
+
const visitedPaths = new Set();
|
|
238
|
+
let currentConfigFilePath = path.resolve(jsonFilePath);
|
|
239
|
+
let configObject = {};
|
|
240
|
+
// Lodash merges array values by default, which is unintuitive for config files (and makes it impossible for derived configurations to overwrite arrays).
|
|
241
|
+
// For example, given a base config containing an array property with value ["foo", "bar"] and a derived config that specifies ["baz"] for that property, lodash will produce ["baz", "bar"], which is unintuitive.
|
|
242
|
+
// This customizer function ensures that arrays are always overwritten.
|
|
243
|
+
const mergeCustomizer = (objValue, srcValue) => {
|
|
244
|
+
if (Array.isArray(srcValue)) {
|
|
245
|
+
return srcValue;
|
|
246
|
+
}
|
|
247
|
+
// Fall back to default merge behavior.
|
|
248
|
+
return undefined;
|
|
249
|
+
};
|
|
250
|
+
try {
|
|
251
|
+
do {
|
|
252
|
+
// Check if this file was already processed.
|
|
253
|
+
if (visitedPaths.has(currentConfigFilePath)) {
|
|
254
|
+
throw new Error(`The API Extractor "extends" setting contains a cycle.` +
|
|
255
|
+
` This file is included twice: "${currentConfigFilePath}"`);
|
|
256
|
+
}
|
|
257
|
+
visitedPaths.add(currentConfigFilePath);
|
|
258
|
+
const currentConfigFolderPath = path.dirname(currentConfigFilePath);
|
|
259
|
+
// Load the extractor config defined in extends property.
|
|
260
|
+
const baseConfig = JsonFile.load(currentConfigFilePath);
|
|
261
|
+
let extendsField = baseConfig.extends || '';
|
|
262
|
+
// Delete the "extends" field so it doesn't get merged
|
|
263
|
+
delete baseConfig.extends;
|
|
264
|
+
if (extendsField) {
|
|
265
|
+
if (extendsField.match(/^\.\.?[\\/]/)) {
|
|
266
|
+
// EXAMPLE: "./subfolder/api-extractor-base.json"
|
|
267
|
+
extendsField = path.resolve(currentConfigFolderPath, extendsField);
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
// EXAMPLE: "my-package/api-extractor-base.json"
|
|
271
|
+
//
|
|
272
|
+
// Resolve "my-package" from the perspective of the current folder.
|
|
273
|
+
try {
|
|
274
|
+
extendsField = resolve.sync(extendsField, {
|
|
275
|
+
basedir: currentConfigFolderPath
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
throw new Error(`Error resolving NodeJS path "${extendsField}": ${e.message}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// This step has to be performed in advance, since the currentConfigFolderPath information will be lost
|
|
284
|
+
// after lodash.merge() is performed.
|
|
285
|
+
ExtractorConfig._resolveConfigFileRelativePaths(baseConfig, currentConfigFolderPath);
|
|
286
|
+
// Merge extractorConfig into baseConfig, mutating baseConfig
|
|
287
|
+
lodash.mergeWith(baseConfig, configObject, mergeCustomizer);
|
|
288
|
+
configObject = baseConfig;
|
|
289
|
+
currentConfigFilePath = extendsField;
|
|
290
|
+
} while (currentConfigFilePath);
|
|
291
|
+
}
|
|
292
|
+
catch (e) {
|
|
293
|
+
throw new Error(`Error loading ${currentConfigFilePath}:\n` + e.message);
|
|
294
|
+
}
|
|
295
|
+
// Lastly, apply the defaults
|
|
296
|
+
configObject = lodash.mergeWith(lodash.cloneDeep(ExtractorConfig._defaultConfig), configObject, mergeCustomizer);
|
|
297
|
+
ExtractorConfig.jsonSchema.validateObject(configObject, jsonFilePath);
|
|
298
|
+
// The schema validation should ensure that this object conforms to IConfigFile
|
|
299
|
+
return configObject;
|
|
300
|
+
}
|
|
301
|
+
static _resolveConfigFileRelativePaths(configFile, currentConfigFolderPath) {
|
|
302
|
+
if (configFile.projectFolder) {
|
|
303
|
+
configFile.projectFolder = ExtractorConfig._resolveConfigFileRelativePath('projectFolder', configFile.projectFolder, currentConfigFolderPath);
|
|
304
|
+
}
|
|
305
|
+
if (configFile.mainEntryPointFilePath) {
|
|
306
|
+
configFile.mainEntryPointFilePath = ExtractorConfig._resolveConfigFileRelativePath('mainEntryPointFilePath', configFile.mainEntryPointFilePath, currentConfigFolderPath);
|
|
307
|
+
}
|
|
308
|
+
if (configFile.compiler) {
|
|
309
|
+
if (configFile.compiler.tsconfigFilePath) {
|
|
310
|
+
configFile.compiler.tsconfigFilePath = ExtractorConfig._resolveConfigFileRelativePath('tsconfigFilePath', configFile.compiler.tsconfigFilePath, currentConfigFolderPath);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (configFile.apiReport) {
|
|
314
|
+
if (configFile.apiReport.reportFolder) {
|
|
315
|
+
configFile.apiReport.reportFolder = ExtractorConfig._resolveConfigFileRelativePath('reportFolder', configFile.apiReport.reportFolder, currentConfigFolderPath);
|
|
316
|
+
}
|
|
317
|
+
if (configFile.apiReport.reportTempFolder) {
|
|
318
|
+
configFile.apiReport.reportTempFolder = ExtractorConfig._resolveConfigFileRelativePath('reportTempFolder', configFile.apiReport.reportTempFolder, currentConfigFolderPath);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (configFile.docModel) {
|
|
322
|
+
if (configFile.docModel.apiJsonFilePath) {
|
|
323
|
+
configFile.docModel.apiJsonFilePath = ExtractorConfig._resolveConfigFileRelativePath('apiJsonFilePath', configFile.docModel.apiJsonFilePath, currentConfigFolderPath);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (configFile.dtsRollup) {
|
|
327
|
+
if (configFile.dtsRollup.untrimmedFilePath) {
|
|
328
|
+
configFile.dtsRollup.untrimmedFilePath = ExtractorConfig._resolveConfigFileRelativePath('untrimmedFilePath', configFile.dtsRollup.untrimmedFilePath, currentConfigFolderPath);
|
|
329
|
+
}
|
|
330
|
+
if (configFile.dtsRollup.alphaTrimmedFilePath) {
|
|
331
|
+
configFile.dtsRollup.alphaTrimmedFilePath = ExtractorConfig._resolveConfigFileRelativePath('alphaTrimmedFilePath', configFile.dtsRollup.alphaTrimmedFilePath, currentConfigFolderPath);
|
|
332
|
+
}
|
|
333
|
+
if (configFile.dtsRollup.betaTrimmedFilePath) {
|
|
334
|
+
configFile.dtsRollup.betaTrimmedFilePath = ExtractorConfig._resolveConfigFileRelativePath('betaTrimmedFilePath', configFile.dtsRollup.betaTrimmedFilePath, currentConfigFolderPath);
|
|
335
|
+
}
|
|
336
|
+
if (configFile.dtsRollup.publicTrimmedFilePath) {
|
|
337
|
+
configFile.dtsRollup.publicTrimmedFilePath = ExtractorConfig._resolveConfigFileRelativePath('publicTrimmedFilePath', configFile.dtsRollup.publicTrimmedFilePath, currentConfigFolderPath);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (configFile.tsdocMetadata) {
|
|
341
|
+
if (configFile.tsdocMetadata.tsdocMetadataFilePath) {
|
|
342
|
+
configFile.tsdocMetadata.tsdocMetadataFilePath = ExtractorConfig._resolveConfigFileRelativePath('tsdocMetadataFilePath', configFile.tsdocMetadata.tsdocMetadataFilePath, currentConfigFolderPath);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
static _resolveConfigFileRelativePath(fieldName, fieldValue, currentConfigFolderPath) {
|
|
347
|
+
if (!path.isAbsolute(fieldValue)) {
|
|
348
|
+
if (fieldValue.indexOf('<projectFolder>') !== 0) {
|
|
349
|
+
// If the path is not absolute and does not start with "<projectFolder>", then resolve it relative
|
|
350
|
+
// to the folder of the config file that it appears in
|
|
351
|
+
return path.join(currentConfigFolderPath, fieldValue);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return fieldValue;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Prepares an `ExtractorConfig` object using a configuration that is provided as a runtime object,
|
|
358
|
+
* rather than reading it from disk. This allows configurations to be constructed programmatically,
|
|
359
|
+
* loaded from an alternate source, and/or customized after loading.
|
|
360
|
+
*/
|
|
361
|
+
static prepare(options) {
|
|
362
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
363
|
+
const filenameForErrors = options.configObjectFullPath || 'the configuration object';
|
|
364
|
+
const configObject = options.configObject;
|
|
365
|
+
if (configObject.extends) {
|
|
366
|
+
throw new Error('The IConfigFile.extends field must be expanded before calling ExtractorConfig.prepare()');
|
|
367
|
+
}
|
|
368
|
+
if (options.configObjectFullPath) {
|
|
369
|
+
if (!path.isAbsolute(options.configObjectFullPath)) {
|
|
370
|
+
throw new Error('The "configObjectFullPath" setting must be an absolute path');
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
ExtractorConfig.jsonSchema.validateObject(configObject, filenameForErrors);
|
|
374
|
+
const packageJsonFullPath = options.packageJsonFullPath;
|
|
375
|
+
let packageFolder = undefined;
|
|
376
|
+
let packageJson = undefined;
|
|
377
|
+
if (packageJsonFullPath) {
|
|
378
|
+
if (!/.json$/i.test(packageJsonFullPath)) {
|
|
379
|
+
// Catch common mistakes e.g. where someone passes a folder path instead of a file path
|
|
380
|
+
throw new Error('The "packageJsonFullPath" setting does not have a .json file extension');
|
|
381
|
+
}
|
|
382
|
+
if (!path.isAbsolute(packageJsonFullPath)) {
|
|
383
|
+
throw new Error('The "packageJsonFullPath" setting must be an absolute path');
|
|
384
|
+
}
|
|
385
|
+
if (options.packageJson) {
|
|
386
|
+
packageJson = options.packageJson;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
const packageJsonLookup = new PackageJsonLookup();
|
|
390
|
+
packageJson = packageJsonLookup.loadNodePackageJson(packageJsonFullPath);
|
|
391
|
+
}
|
|
392
|
+
packageFolder = path.dirname(packageJsonFullPath);
|
|
393
|
+
}
|
|
394
|
+
// "tsdocConfigFile" and "tsdocConfiguration" are prepared outside the try-catch block,
|
|
395
|
+
// so that if exceptions are thrown, it will not get the "Error parsing api-extractor.json:" header
|
|
396
|
+
let extractorConfigParameters;
|
|
397
|
+
try {
|
|
398
|
+
if (!configObject.compiler) {
|
|
399
|
+
// A merged configuration should have this
|
|
400
|
+
throw new Error('The "compiler" section is missing');
|
|
401
|
+
}
|
|
402
|
+
if (!configObject.projectFolder) {
|
|
403
|
+
// A merged configuration should have this
|
|
404
|
+
throw new Error('The "projectFolder" setting is missing');
|
|
405
|
+
}
|
|
406
|
+
let projectFolder;
|
|
407
|
+
if (configObject.projectFolder.trim() === '<lookup>') {
|
|
408
|
+
if (options.projectFolderLookupToken) {
|
|
409
|
+
// Use the manually specified "<lookup>" value
|
|
410
|
+
projectFolder = options.projectFolderLookupToken;
|
|
411
|
+
if (!FileSystem.exists(options.projectFolderLookupToken)) {
|
|
412
|
+
throw new Error('The specified "projectFolderLookupToken" path does not exist: ' +
|
|
413
|
+
options.projectFolderLookupToken);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
if (!options.configObjectFullPath) {
|
|
418
|
+
throw new Error('The "projectFolder" setting uses the "<lookup>" token, but it cannot be expanded because' +
|
|
419
|
+
' the "configObjectFullPath" setting was not specified');
|
|
420
|
+
}
|
|
421
|
+
// "The default value for `projectFolder` is the token `<lookup>`, which means the folder is determined
|
|
422
|
+
// by traversing parent folders, starting from the folder containing api-extractor.json, and stopping
|
|
423
|
+
// at the first folder that contains a tsconfig.json file. If a tsconfig.json file cannot be found in
|
|
424
|
+
// this way, then an error will be reported."
|
|
425
|
+
let currentFolder = path.dirname(options.configObjectFullPath);
|
|
426
|
+
for (;;) {
|
|
427
|
+
const tsconfigPath = path.join(currentFolder, 'tsconfig.json');
|
|
428
|
+
if (FileSystem.exists(tsconfigPath)) {
|
|
429
|
+
projectFolder = currentFolder;
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
const parentFolder = path.dirname(currentFolder);
|
|
433
|
+
if (parentFolder === '' || parentFolder === currentFolder) {
|
|
434
|
+
throw new Error('The "projectFolder" setting uses the "<lookup>" token, but a tsconfig.json file cannot be' +
|
|
435
|
+
' found in this folder or any parent folder.');
|
|
436
|
+
}
|
|
437
|
+
currentFolder = parentFolder;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
ExtractorConfig._rejectAnyTokensInPath(configObject.projectFolder, 'projectFolder');
|
|
443
|
+
if (!FileSystem.exists(configObject.projectFolder)) {
|
|
444
|
+
throw new Error('The specified "projectFolder" path does not exist: ' + configObject.projectFolder);
|
|
445
|
+
}
|
|
446
|
+
projectFolder = configObject.projectFolder;
|
|
447
|
+
}
|
|
448
|
+
const tokenContext = {
|
|
449
|
+
unscopedPackageName: 'unknown-package',
|
|
450
|
+
packageName: 'unknown-package',
|
|
451
|
+
projectFolder: projectFolder
|
|
452
|
+
};
|
|
453
|
+
if (packageJson) {
|
|
454
|
+
tokenContext.packageName = packageJson.name;
|
|
455
|
+
tokenContext.unscopedPackageName = PackageName.getUnscopedName(packageJson.name);
|
|
456
|
+
}
|
|
457
|
+
if (!configObject.mainEntryPointFilePath) {
|
|
458
|
+
// A merged configuration should have this
|
|
459
|
+
throw new Error('The "mainEntryPointFilePath" setting is missing');
|
|
460
|
+
}
|
|
461
|
+
const mainEntryPointFilePath = ExtractorConfig._resolvePathWithTokens('mainEntryPointFilePath', configObject.mainEntryPointFilePath, tokenContext);
|
|
462
|
+
if (!ExtractorConfig.hasDtsFileExtension(mainEntryPointFilePath)) {
|
|
463
|
+
throw new Error('The "mainEntryPointFilePath" value is not a declaration file: ' + mainEntryPointFilePath);
|
|
464
|
+
}
|
|
465
|
+
if (!options.ignoreMissingEntryPoint && !FileSystem.exists(mainEntryPointFilePath)) {
|
|
466
|
+
throw new Error('The "mainEntryPointFilePath" path does not exist: ' + mainEntryPointFilePath);
|
|
467
|
+
}
|
|
468
|
+
const bundledPackages = configObject.bundledPackages || [];
|
|
469
|
+
// Note: we cannot fully validate package name patterns, as the strings may contain wildcards.
|
|
470
|
+
// We won't know if the entries are valid until we can compare them against the package.json "dependencies" contents.
|
|
471
|
+
const tsconfigFilePath = ExtractorConfig._resolvePathWithTokens('tsconfigFilePath', configObject.compiler.tsconfigFilePath, tokenContext);
|
|
472
|
+
if (configObject.compiler.overrideTsconfig === undefined) {
|
|
473
|
+
if (!tsconfigFilePath) {
|
|
474
|
+
throw new Error('Either the "tsconfigFilePath" or "overrideTsconfig" setting must be specified');
|
|
475
|
+
}
|
|
476
|
+
if (!FileSystem.exists(tsconfigFilePath)) {
|
|
477
|
+
throw new Error('The file referenced by "tsconfigFilePath" does not exist: ' + tsconfigFilePath);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if ((_a = configObject.apiReport) === null || _a === void 0 ? void 0 : _a.tagsToReport) {
|
|
481
|
+
_validateTagsToReport(configObject.apiReport.tagsToReport);
|
|
482
|
+
}
|
|
483
|
+
const apiReportEnabled = (_c = (_b = configObject.apiReport) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : false;
|
|
484
|
+
const apiReportIncludeForgottenExports = (_e = (_d = configObject.apiReport) === null || _d === void 0 ? void 0 : _d.includeForgottenExports) !== null && _e !== void 0 ? _e : false;
|
|
485
|
+
let reportFolder = tokenContext.projectFolder;
|
|
486
|
+
let reportTempFolder = tokenContext.projectFolder;
|
|
487
|
+
const reportConfigs = [];
|
|
488
|
+
let tagsToReport = {};
|
|
489
|
+
if (apiReportEnabled) {
|
|
490
|
+
// Undefined case checked above where we assign `apiReportEnabled`
|
|
491
|
+
const apiReportConfig = configObject.apiReport;
|
|
492
|
+
const reportFileNameSuffix = '.api.md';
|
|
493
|
+
let reportFileNameBase;
|
|
494
|
+
if (apiReportConfig.reportFileName) {
|
|
495
|
+
if (apiReportConfig.reportFileName.indexOf('/') >= 0 ||
|
|
496
|
+
apiReportConfig.reportFileName.indexOf('\\') >= 0) {
|
|
497
|
+
throw new Error(`The "reportFileName" setting contains invalid characters: "${apiReportConfig.reportFileName}"`);
|
|
498
|
+
}
|
|
499
|
+
if (!apiReportConfig.reportFileName.endsWith(reportFileNameSuffix)) {
|
|
500
|
+
// `.api.md` extension was not specified. Use provided file name base as is.
|
|
501
|
+
reportFileNameBase = apiReportConfig.reportFileName;
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
// The system previously asked users to specify their filenames in a form containing the `.api.md` extension.
|
|
505
|
+
// This guidance has changed, but to maintain backwards compatibility, we will temporarily support input
|
|
506
|
+
// that ends with the `.api.md` extension specially, by stripping it out.
|
|
507
|
+
// This should be removed in version 8, possibly replaced with an explicit error to help users
|
|
508
|
+
// migrate their configs.
|
|
509
|
+
reportFileNameBase = apiReportConfig.reportFileName.slice(0, -reportFileNameSuffix.length);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
// Default value
|
|
514
|
+
reportFileNameBase = '<unscopedPackageName>';
|
|
515
|
+
}
|
|
516
|
+
const reportVariantKinds = (_f = apiReportConfig.reportVariants) !== null && _f !== void 0 ? _f : defaultApiReportVariants;
|
|
517
|
+
for (const reportVariantKind of reportVariantKinds) {
|
|
518
|
+
// Omit the variant kind from the "complete" report file name for simplicity and for backwards compatibility.
|
|
519
|
+
const fileNameWithTokens = `${reportFileNameBase}${reportVariantKind === 'complete' ? '' : `.${reportVariantKind}`}${reportFileNameSuffix}`;
|
|
520
|
+
const normalizedFileName = ExtractorConfig._expandStringWithTokens('reportFileName', fileNameWithTokens, tokenContext);
|
|
521
|
+
reportConfigs.push({
|
|
522
|
+
fileName: normalizedFileName,
|
|
523
|
+
variant: reportVariantKind
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
if (apiReportConfig.reportFolder) {
|
|
527
|
+
reportFolder = ExtractorConfig._resolvePathWithTokens('reportFolder', apiReportConfig.reportFolder, tokenContext);
|
|
528
|
+
}
|
|
529
|
+
if (apiReportConfig.reportTempFolder) {
|
|
530
|
+
reportTempFolder = ExtractorConfig._resolvePathWithTokens('reportTempFolder', apiReportConfig.reportTempFolder, tokenContext);
|
|
531
|
+
}
|
|
532
|
+
tagsToReport = {
|
|
533
|
+
...defaultTagsToReport,
|
|
534
|
+
...apiReportConfig.tagsToReport
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
let docModelGenerationOptions = undefined;
|
|
538
|
+
let apiJsonFilePath = '';
|
|
539
|
+
let docModelIncludeForgottenExports = false;
|
|
540
|
+
let projectFolderUrl;
|
|
541
|
+
if ((_g = configObject.docModel) === null || _g === void 0 ? void 0 : _g.enabled) {
|
|
542
|
+
apiJsonFilePath = ExtractorConfig._resolvePathWithTokens('apiJsonFilePath', configObject.docModel.apiJsonFilePath, tokenContext);
|
|
543
|
+
docModelIncludeForgottenExports = !!configObject.docModel.includeForgottenExports;
|
|
544
|
+
projectFolderUrl = configObject.docModel.projectFolderUrl;
|
|
545
|
+
const releaseTagsToTrim = new Set();
|
|
546
|
+
const releaseTagsToTrimOption = configObject.docModel.releaseTagsToTrim || ['@internal'];
|
|
547
|
+
for (const releaseTagToTrim of releaseTagsToTrimOption) {
|
|
548
|
+
let releaseTag;
|
|
549
|
+
switch (releaseTagToTrim) {
|
|
550
|
+
case '@internal': {
|
|
551
|
+
releaseTag = ReleaseTag.Internal;
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
case '@alpha': {
|
|
555
|
+
releaseTag = ReleaseTag.Alpha;
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
case '@beta': {
|
|
559
|
+
releaseTag = ReleaseTag.Beta;
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
case '@public': {
|
|
563
|
+
releaseTag = ReleaseTag.Public;
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
default: {
|
|
567
|
+
throw new Error(`The release tag "${releaseTagToTrim}" is not supported`);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
releaseTagsToTrim.add(releaseTag);
|
|
571
|
+
}
|
|
572
|
+
docModelGenerationOptions = {
|
|
573
|
+
releaseTagsToTrim
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
let tsdocMetadataEnabled = false;
|
|
577
|
+
let tsdocMetadataFilePath = '';
|
|
578
|
+
if (configObject.tsdocMetadata) {
|
|
579
|
+
tsdocMetadataEnabled = !!configObject.tsdocMetadata.enabled;
|
|
580
|
+
if (tsdocMetadataEnabled) {
|
|
581
|
+
tsdocMetadataFilePath = configObject.tsdocMetadata.tsdocMetadataFilePath || '';
|
|
582
|
+
if (tsdocMetadataFilePath.trim() === '<lookup>') {
|
|
583
|
+
if (!packageJson) {
|
|
584
|
+
throw new Error('The "<lookup>" token cannot be used with the "tsdocMetadataFilePath" setting because' +
|
|
585
|
+
' the "packageJson" option was not provided');
|
|
586
|
+
}
|
|
587
|
+
if (!packageJsonFullPath) {
|
|
588
|
+
throw new Error('The "<lookup>" token cannot be used with "tsdocMetadataFilePath" because' +
|
|
589
|
+
'the "packageJsonFullPath" option was not provided');
|
|
590
|
+
}
|
|
591
|
+
tsdocMetadataFilePath = PackageMetadataManager.resolveTsdocMetadataPath(path.dirname(packageJsonFullPath), packageJson);
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
tsdocMetadataFilePath = ExtractorConfig._resolvePathWithTokens('tsdocMetadataFilePath', configObject.tsdocMetadata.tsdocMetadataFilePath, tokenContext);
|
|
595
|
+
}
|
|
596
|
+
if (!tsdocMetadataFilePath) {
|
|
597
|
+
throw new Error('The "tsdocMetadata.enabled" setting is enabled,' +
|
|
598
|
+
' but "tsdocMetadataFilePath" is not specified');
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
let rollupEnabled = false;
|
|
603
|
+
let untrimmedFilePath = '';
|
|
604
|
+
let betaTrimmedFilePath = '';
|
|
605
|
+
let alphaTrimmedFilePath = '';
|
|
606
|
+
let publicTrimmedFilePath = '';
|
|
607
|
+
let omitTrimmingComments = false;
|
|
608
|
+
if (configObject.dtsRollup) {
|
|
609
|
+
rollupEnabled = !!configObject.dtsRollup.enabled;
|
|
610
|
+
untrimmedFilePath = ExtractorConfig._resolvePathWithTokens('untrimmedFilePath', configObject.dtsRollup.untrimmedFilePath, tokenContext);
|
|
611
|
+
alphaTrimmedFilePath = ExtractorConfig._resolvePathWithTokens('alphaTrimmedFilePath', configObject.dtsRollup.alphaTrimmedFilePath, tokenContext);
|
|
612
|
+
betaTrimmedFilePath = ExtractorConfig._resolvePathWithTokens('betaTrimmedFilePath', configObject.dtsRollup.betaTrimmedFilePath, tokenContext);
|
|
613
|
+
publicTrimmedFilePath = ExtractorConfig._resolvePathWithTokens('publicTrimmedFilePath', configObject.dtsRollup.publicTrimmedFilePath, tokenContext);
|
|
614
|
+
omitTrimmingComments = !!configObject.dtsRollup.omitTrimmingComments;
|
|
615
|
+
}
|
|
616
|
+
let newlineKind;
|
|
617
|
+
switch (configObject.newlineKind) {
|
|
618
|
+
case 'lf':
|
|
619
|
+
newlineKind = NewlineKind.Lf;
|
|
620
|
+
break;
|
|
621
|
+
case 'os':
|
|
622
|
+
newlineKind = NewlineKind.OsDefault;
|
|
623
|
+
break;
|
|
624
|
+
default:
|
|
625
|
+
newlineKind = NewlineKind.CrLf;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
const enumMemberOrder = (_h = configObject.enumMemberOrder) !== null && _h !== void 0 ? _h : EnumMemberOrder.ByName;
|
|
629
|
+
extractorConfigParameters = {
|
|
630
|
+
projectFolder: projectFolder,
|
|
631
|
+
packageJson,
|
|
632
|
+
packageFolder,
|
|
633
|
+
mainEntryPointFilePath,
|
|
634
|
+
bundledPackages,
|
|
635
|
+
tsconfigFilePath,
|
|
636
|
+
overrideTsconfig: configObject.compiler.overrideTsconfig,
|
|
637
|
+
skipLibCheck: !!configObject.compiler.skipLibCheck,
|
|
638
|
+
apiReportEnabled,
|
|
639
|
+
reportConfigs,
|
|
640
|
+
reportFolder,
|
|
641
|
+
reportTempFolder,
|
|
642
|
+
apiReportIncludeForgottenExports,
|
|
643
|
+
tagsToReport,
|
|
644
|
+
docModelGenerationOptions,
|
|
645
|
+
apiJsonFilePath,
|
|
646
|
+
docModelIncludeForgottenExports,
|
|
647
|
+
projectFolderUrl,
|
|
648
|
+
rollupEnabled,
|
|
649
|
+
untrimmedFilePath,
|
|
650
|
+
alphaTrimmedFilePath,
|
|
651
|
+
betaTrimmedFilePath,
|
|
652
|
+
publicTrimmedFilePath,
|
|
653
|
+
omitTrimmingComments,
|
|
654
|
+
tsdocMetadataEnabled,
|
|
655
|
+
tsdocMetadataFilePath,
|
|
656
|
+
newlineKind,
|
|
657
|
+
messages: configObject.messages || {},
|
|
658
|
+
testMode: !!configObject.testMode,
|
|
659
|
+
enumMemberOrder
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
catch (e) {
|
|
663
|
+
throw new Error(`Error parsing ${filenameForErrors}:\n` + e.message);
|
|
664
|
+
}
|
|
665
|
+
let tsdocConfigFile = options.tsdocConfigFile;
|
|
666
|
+
if (!tsdocConfigFile) {
|
|
667
|
+
// Example: "my-project/tsdoc.json"
|
|
668
|
+
let packageTSDocConfigPath = TSDocConfigFile.findConfigPathForFolder(extractorConfigParameters.projectFolder);
|
|
669
|
+
if (!packageTSDocConfigPath || !FileSystem.exists(packageTSDocConfigPath)) {
|
|
670
|
+
// If the project does not have a tsdoc.json config file, then use API Extractor's base file.
|
|
671
|
+
packageTSDocConfigPath = ExtractorConfig._tsdocBaseFilePath;
|
|
672
|
+
if (!FileSystem.exists(packageTSDocConfigPath)) {
|
|
673
|
+
throw new InternalError('Unable to load the built-in TSDoc config file: ' + packageTSDocConfigPath);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
tsdocConfigFile = TSDocConfigFile.loadFile(packageTSDocConfigPath);
|
|
677
|
+
}
|
|
678
|
+
// IMPORTANT: After calling TSDocConfigFile.loadFile(), we need to check for errors.
|
|
679
|
+
if (tsdocConfigFile.hasErrors) {
|
|
680
|
+
throw new Error(tsdocConfigFile.getErrorSummary());
|
|
681
|
+
}
|
|
682
|
+
const tsdocConfiguration = new TSDocConfiguration();
|
|
683
|
+
tsdocConfigFile.configureParser(tsdocConfiguration);
|
|
684
|
+
// IMPORTANT: After calling TSDocConfigFile.configureParser(), we need to check for errors a second time.
|
|
685
|
+
if (tsdocConfigFile.hasErrors) {
|
|
686
|
+
throw new Error(tsdocConfigFile.getErrorSummary());
|
|
687
|
+
}
|
|
688
|
+
return new ExtractorConfig({ ...extractorConfigParameters, tsdocConfigFile, tsdocConfiguration });
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Gets the report configuration for the "complete" (default) report configuration, if one was specified.
|
|
692
|
+
*/
|
|
693
|
+
_getCompleteReportConfig() {
|
|
694
|
+
return this.reportConfigs.find((x) => x.variant === 'complete');
|
|
695
|
+
}
|
|
696
|
+
static _resolvePathWithTokens(fieldName, value, tokenContext) {
|
|
697
|
+
value = ExtractorConfig._expandStringWithTokens(fieldName, value, tokenContext);
|
|
698
|
+
if (value !== '') {
|
|
699
|
+
value = path.resolve(tokenContext.projectFolder, value);
|
|
700
|
+
}
|
|
701
|
+
return value;
|
|
702
|
+
}
|
|
703
|
+
static _expandStringWithTokens(fieldName, value, tokenContext) {
|
|
704
|
+
value = value ? value.trim() : '';
|
|
705
|
+
if (value !== '') {
|
|
706
|
+
value = Text.replaceAll(value, '<unscopedPackageName>', tokenContext.unscopedPackageName);
|
|
707
|
+
value = Text.replaceAll(value, '<packageName>', tokenContext.packageName);
|
|
708
|
+
const projectFolderToken = '<projectFolder>';
|
|
709
|
+
if (value.indexOf(projectFolderToken) === 0) {
|
|
710
|
+
// Replace "<projectFolder>" at the start of a string
|
|
711
|
+
value = path.join(tokenContext.projectFolder, value.substr(projectFolderToken.length));
|
|
712
|
+
}
|
|
713
|
+
if (value.indexOf(projectFolderToken) >= 0) {
|
|
714
|
+
// If after all replacements, "<projectFolder>" appears somewhere in the string, report an error
|
|
715
|
+
throw new Error(`The "${fieldName}" value incorrectly uses the "<projectFolder>" token.` +
|
|
716
|
+
` It must appear at the start of the string.`);
|
|
717
|
+
}
|
|
718
|
+
if (value.indexOf('<lookup>') >= 0) {
|
|
719
|
+
throw new Error(`The "${fieldName}" value incorrectly uses the "<lookup>" token`);
|
|
720
|
+
}
|
|
721
|
+
ExtractorConfig._rejectAnyTokensInPath(value, fieldName);
|
|
722
|
+
}
|
|
723
|
+
return value;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Returns true if the specified file path has the ".d.ts" file extension.
|
|
727
|
+
*/
|
|
728
|
+
static hasDtsFileExtension(filePath) {
|
|
729
|
+
return ExtractorConfig._declarationFileExtensionRegExp.test(filePath);
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Given a path string that may have originally contained expandable tokens such as `<projectFolder>"`
|
|
733
|
+
* this reports an error if any token-looking substrings remain after expansion (e.g. `c:\blah\<invalid>\blah`).
|
|
734
|
+
*/
|
|
735
|
+
static _rejectAnyTokensInPath(value, fieldName) {
|
|
736
|
+
if (value.indexOf('<') < 0 && value.indexOf('>') < 0) {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
// Can we determine the name of a token?
|
|
740
|
+
const tokenRegExp = /(\<[^<]*?\>)/;
|
|
741
|
+
const match = tokenRegExp.exec(value);
|
|
742
|
+
if (match) {
|
|
743
|
+
throw new Error(`The "${fieldName}" value contains an unrecognized token "${match[1]}"`);
|
|
744
|
+
}
|
|
745
|
+
throw new Error(`The "${fieldName}" value contains extra token characters ("<" or ">"): ${value}`);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* The JSON Schema for API Extractor config file (api-extractor.schema.json).
|
|
750
|
+
*/
|
|
751
|
+
ExtractorConfig.jsonSchema = JsonSchema.fromLoadedObject(apiExtractorSchema);
|
|
752
|
+
/**
|
|
753
|
+
* The config file name "api-extractor.json".
|
|
754
|
+
*/
|
|
755
|
+
ExtractorConfig.FILENAME = 'api-extractor.json';
|
|
756
|
+
/**
|
|
757
|
+
* The full path to `extends/tsdoc-base.json` which contains the standard TSDoc configuration
|
|
758
|
+
* for API Extractor.
|
|
759
|
+
* @internal
|
|
760
|
+
*/
|
|
761
|
+
ExtractorConfig._tsdocBaseFilePath = path.resolve(__dirname, '../../extends/tsdoc-base.json');
|
|
762
|
+
ExtractorConfig._defaultConfig = JsonFile.load(path.join(__dirname, '../schemas/api-extractor-defaults.json'));
|
|
763
|
+
/** Match all three flavors for type declaration files (.d.ts, .d.mts, .d.cts) */
|
|
764
|
+
ExtractorConfig._declarationFileExtensionRegExp = /\.d\.(c|m)?ts$/i;
|
|
765
|
+
const releaseTags = new Set(['@public', '@alpha', '@beta', '@internal']);
|
|
766
|
+
/**
|
|
767
|
+
* Validate {@link ExtractorConfig.tagsToReport}.
|
|
768
|
+
*/
|
|
769
|
+
function _validateTagsToReport(tagsToReport) {
|
|
770
|
+
const includedReleaseTags = [];
|
|
771
|
+
const invalidTags = []; // tag name, error
|
|
772
|
+
for (const tag of Object.keys(tagsToReport)) {
|
|
773
|
+
if (releaseTags.has(tag)) {
|
|
774
|
+
// If a release tags is specified, regardless of whether it is enabled, we will throw an error.
|
|
775
|
+
// Release tags must not be specified.
|
|
776
|
+
includedReleaseTags.push(tag);
|
|
777
|
+
}
|
|
778
|
+
// If the tag is invalid, generate an error string from the inner error message.
|
|
779
|
+
try {
|
|
780
|
+
TSDocTagDefinition.validateTSDocTagName(tag);
|
|
781
|
+
}
|
|
782
|
+
catch (error) {
|
|
783
|
+
invalidTags.push([tag, error.message]);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
const errorMessages = [];
|
|
787
|
+
for (const includedReleaseTag of includedReleaseTags) {
|
|
788
|
+
errorMessages.push(`${includedReleaseTag}: Release tags are always included in API reports and must not be specified`);
|
|
789
|
+
}
|
|
790
|
+
for (const [invalidTag, innerError] of invalidTags) {
|
|
791
|
+
errorMessages.push(`${invalidTag}: ${innerError}`);
|
|
792
|
+
}
|
|
793
|
+
if (errorMessages.length > 0) {
|
|
794
|
+
const errorMessage = [
|
|
795
|
+
`"tagsToReport" contained one or more invalid tags:`,
|
|
796
|
+
...errorMessages
|
|
797
|
+
].join('\n\t- ');
|
|
798
|
+
throw new Error(errorMessage);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
//# sourceMappingURL=ExtractorConfig.js.map
|