@microsoft/api-extractor
Version:
Validate, document, and review the exported API for a TypeScript library
73 lines (72 loc) • 2.6 kB
TypeScript
import * as ts from 'typescript';
import { JsonSchema } from '@microsoft/node-core-library';
import { IExtractorConfig, IExtractorProjectConfig } from './IExtractorConfig';
import { ILogger } from './ILogger';
/**
* Options for {@link Extractor.processProject}.
* @public
*/
export interface IAnalyzeProjectOptions {
/**
* If omitted, then the {@link IExtractorConfig.project} config will be used by default.
*/
projectConfig?: IExtractorProjectConfig;
}
/**
* Runtime options for Extractor.
*
* @public
*/
export interface IExtractorOptions {
/**
* If IExtractorConfig.project.configType = 'runtime', then the TypeScript compiler state
* must be provided via this option.
*/
compilerProgram?: ts.Program;
/**
* Allows the caller to handle API Extractor errors; otherwise, they will be logged
* to the console.
*/
customLogger?: Partial<ILogger>;
/**
* Indicates that API Extractor is running as part of a local build, e.g. on developer's
* machine. This disables certain validation that would normally be performed
* for a ship/production build. For example, the *.api.ts review file is
* automatically local in a debug build.
*
* The default value is false.
*/
localBuild?: boolean;
}
/**
* Used to invoke the API Extractor tool.
* @public
*/
export declare class Extractor {
/**
* The JSON Schema for API Extractor config file (api-extractor-config.schema.json).
*/
static jsonSchema: JsonSchema;
private static _defaultConfig;
private static _defaultLogger;
private readonly _config;
private readonly _program;
private readonly _localBuild;
private readonly _monitoredLogger;
private readonly _absoluteRootFolder;
private static _applyConfigDefaults(config);
constructor(config: IExtractorConfig, options?: IExtractorOptions);
/**
* Invokes the API Extractor engine, using the configuration that was passed to the constructor.
* @deprecated Use {@link Extractor.processProject} instead.
*/
analyzeProject(options?: IAnalyzeProjectOptions): void;
/**
* Invokes the API Extractor engine, using the configuration that was passed to the constructor.
* @param options - provides additional runtime state that is NOT part of the API Extractor
* config file.
* @returns true if there were no errors or warnings; false if the tool chain should fail the build
*/
processProject(options?: IAnalyzeProjectOptions): boolean;
private _getShortFilePath(absolutePath);
}