Rush StackShopBlogEvents
Skip to main content

Home > @microsoft/api-extractor > ExtractorConfig

ExtractorConfig class

The ExtractorConfig class loads, validates, interprets, and represents the api-extractor.json config file.

Signature:

/** @sealed */
export declare class ExtractorConfig

Properties

Property

Modifiers

Type

Description

alphaTrimmedFilePath

readonly

string

Specifies the output path for a .d.ts rollup file to be generated with trimming for an "alpha" release.

apiJsonFilePath

readonly

string

The output path for the doc model file. The file extension should be ".api.json".

apiReportEnabled

readonly

boolean

Whether to generate an API report.

apiReportIncludeForgottenExports

readonly

boolean

Whether "forgotten exports" should be included in the API report file.

betaTrimmedFilePath

readonly

string

Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.

bundledPackages

readonly

string[]

A list of NPM package names whose exports should be treated as part of this package.

docModelGenerationOptions

readonly

IApiModelGenerationOptions | undefined

(BETA) If specified, the doc model is enabled and the specified options will be used.

docModelIncludeForgottenExports

readonly

boolean

Whether "forgotten exports" should be included in the doc model file.

enumMemberOrder

readonly

EnumMemberOrder

Specifies how API Extractor sorts members of an enum when generating the .api.json file.

FILENAME

static

readonly

'api-extractor.json'

The config file name "api-extractor.json".

jsonSchema

static

readonly

JsonSchema

The JSON Schema for API Extractor config file (api-extractor.schema.json).

mainEntryPointFilePath

readonly

string

Specifies the .d.ts file to be used as the starting point for analysis. API Extractor analyzes the symbols exported by this module.

messages

readonly

IExtractorMessagesConfig

Configures how API Extractor reports error and warning messages produced during analysis.

newlineKind

readonly

NewlineKind

Specifies what type of newlines API Extractor should use when writing output files. By default, the output files will be written with Windows-style newlines.

omitTrimmingComments

readonly

boolean

When a declaration is trimmed, by default it will be replaced by a code comment such as "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the declaration completely.

overrideTsconfig

readonly

{} | undefined

Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.

packageFolder

readonly

string | undefined

The absolute path of the folder containing the package.json file for the working package, or undefined if API Extractor was invoked without a package.json file.

packageJson

readonly

INodePackageJson | undefined

The parsed package.json file for the working package, or undefined if API Extractor was invoked without a package.json file.

projectFolder

readonly

string

Determines the <projectFolder> token that can be used with other config file settings. The project folder typically contains the tsconfig.json and package.json config files, but the path is user-defined.

projectFolderUrl

readonly

string | undefined

The base URL where the project's source code can be viewed on a website such as GitHub or Azure DevOps. This URL path corresponds to the <projectFolder> path on disk.

publicTrimmedFilePath

readonly

string

Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.

reportConfigs

readonly

readonly IExtractorConfigApiReport[]

List of configurations for report files to be generated.

reportFilePath

readonly

string

Gets the file path for the "complete" (default) report configuration, if one was specified. Otherwise, returns an empty string.

reportFolder

readonly

string

Specifies the folder where the API report file is written. The file name portion is determined by the reportFileName setting.

reportTempFilePath

readonly

string

Gets the temp file path for the "complete" (default) report configuration, if one was specified. Otherwise, returns an empty string.

reportTempFolder

readonly

string

Specifies the folder where the temporary report file is written. The file name portion is determined by the reportFileName setting.

rollupEnabled

readonly

boolean

Whether to generate the .d.ts rollup file.

skipLibCheck

readonly

boolean

This option causes the compiler to be invoked with the --skipLibCheck option.

tagsToReport

readonly

Readonly<Record<`@${string}`, boolean>>

Specifies a list of TSDoc tags that should be reported in the API report file for items whose documentation contains them.

testMode

readonly

boolean

Set to true when invoking API Extractor's test harness.

tsconfigFilePath

readonly

string

Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.

tsdocConfigFile

readonly

TSDocConfigFile

The tsdoc.json configuration that will be used when parsing doc comments.

tsdocConfiguration

readonly

TSDocConfiguration

The TSDocConfiguration loaded from ExtractorConfig.tsdocConfigFile.

tsdocMetadataEnabled

readonly

boolean

Whether to generate the tsdoc-metadata.json file.

tsdocMetadataFilePath

readonly

string

Specifies where the TSDoc metadata file should be written.

untrimmedFilePath

readonly

string

Specifies the output path for a .d.ts rollup file to be generated without any trimming.

Methods

Method

Modifiers

Description

getDiagnosticDump()

Returns a JSON-like string representing the ExtractorConfig state, which can be printed to a console for diagnostic purposes.

hasDtsFileExtension(filePath)

static

Returns true if the specified file path has the ".d.ts" file extension.

loadFile(jsonFilePath)

static

Performs only the first half of ExtractorConfig.loadFileAndPrepare(), providing an opportunity to modify the object before it is passed to ExtractorConfig.prepare().

loadFileAndPrepare(configJsonFilePath)

static

Loads the api-extractor.json config file from the specified file path, and prepares an ExtractorConfig object.

prepare(options)

static

Prepares an ExtractorConfig object using a configuration that is provided as a runtime object, rather than reading it from disk. This allows configurations to be constructed programmatically, loaded from an alternate source, and/or customized after loading.

tryLoadForFolder(options)

static

Searches for the api-extractor.json config file associated with the specified starting folder, and loads the file if found. This lookup supports rig packages.