@microsoft/api-extractor
Version:
Validate, document, and review the exported API for a TypeScript library
68 lines (67 loc) • 2.59 kB
TypeScript
import { ExtractorContext } from '../../ExtractorContext';
/**
* Used with DtsRollupGenerator.writeTypingsFile()
*/
export declare enum DtsRollupKind {
/**
* Generate a *.d.ts file for an internal release, or for the trimming=false mode.
* This output file will contain all definitions that are reachable from the entry point.
*/
InternalRelease = 0,
/**
* Generate a *.d.ts file for a preview release.
* This output file will contain all definitions that are reachable from the entry point,
* except definitions marked as \@alpha or \@internal.
*/
BetaRelease = 1,
/**
* Generate a *.d.ts file for a public release.
* This output file will contain all definitions that are reachable from the entry point,
* except definitions marked as \@beta, \@alpha, or \@internal.
*/
PublicRelease = 2,
}
export declare class DtsRollupGenerator {
private _context;
private _typeChecker;
private _tsdocParser;
private _astSymbolTable;
private _astEntryPoint;
private _dtsEntries;
private _dtsEntriesByAstSymbol;
private _dtsEntriesBySymbol;
private _releaseTagByAstSymbol;
/**
* A list of names (e.g. "example-library") that should appear in a reference like this:
*
* /// <reference types="example-library" />
*/
private _dtsTypeDefinitionReferences;
constructor(context: ExtractorContext);
/**
* Perform the analysis. This must be called before writeTypingsFile().
*/
analyze(): void;
/**
* Generates the typings file and writes it to disk.
*
* @param dtsFilename - The *.d.ts output filename
*/
writeTypingsFile(dtsFilename: string, dtsKind: DtsRollupKind): void;
private readonly astEntryPoint;
private _createDtsEntryForSymbol(astSymbol, exportedName);
private _createDtsEntryForIndirectReferences(astSymbol, alreadySeenAstSymbols);
/**
* Ensures a unique name for each item in the package typings file.
*/
private _makeUniqueNames();
private _generateTypingsFileContent(indentedWriter, dtsKind);
/**
* Before writing out a declaration, _modifySpan() applies various fixups to make it nice.
*/
private _modifySpan(span, dtsEntry, astDeclaration, dtsKind);
private _shouldIncludeReleaseTag(releaseTag, dtsKind);
private _getReleaseTagForAstSymbol(astSymbol);
private _getReleaseTagForDeclaration(declaration);
private _collectTypeDefinitionReferences(astSymbol);
}