UNPKG

@microsoft/api-extractor

Version:

Validate, document, and review the exported API for a TypeScript library

44 lines (43 loc) 2.54 kB
import { ExtractorContext } from '../ExtractorContext'; import AstStructuredType from '../ast/AstStructuredType'; import AstEnum from '../ast/AstEnum'; import AstEnumValue from '../ast/AstEnumValue'; import AstFunction from '../ast/AstFunction'; import AstItem from '../ast/AstItem'; import AstItemVisitor from './AstItemVisitor'; import AstPackage from '../ast/AstPackage'; import AstProperty from '../ast/AstProperty'; import AstMember from '../ast/AstMember'; import AstNamespace from '../ast/AstNamespace'; import AstModuleVariable from '../ast/AstModuleVariable'; import AstMethod from '../ast/AstMethod'; /** * For a library such as "example-package", ApiFileGenerator generates the "example-package.api.json" * file which represents the API surface for that package. This file should be published as part * of the library's NPM package. API Extractor will read this file later when it is analyzing * another project that consumes the library. (Otherwise, API Extractor would have to re-analyze all * the *.d.ts files, which would be bad because the compiler definitions might not be available for * a published package, or the results of the analysis might be different somehow.) Documentation * tools such as api-documenter can also use the *.api.json files. * * @public */ export default class ApiJsonGenerator extends AstItemVisitor { private static _methodCounter; private static _MEMBERS_KEY; private static _EXPORTS_KEY; protected jsonOutput: Object; writeJsonFile(reportFilename: string, context: ExtractorContext): void; protected visit(astItem: AstItem, refObject?: Object): void; protected visitAstStructuredType(astStructuredType: AstStructuredType, refObject?: Object): void; protected visitAstEnum(astEnum: AstEnum, refObject?: Object): void; protected visitAstEnumValue(astEnumValue: AstEnumValue, refObject?: Object): void; protected visitAstFunction(astFunction: AstFunction, refObject?: Object): void; protected visitAstPackage(astPackage: AstPackage, refObject?: Object): void; protected visitAstNamespace(astNamespace: AstNamespace, refObject?: Object): void; protected visitAstMember(astMember: AstMember, refObject?: Object): void; protected visitAstProperty(astProperty: AstProperty, refObject?: Object): void; protected visitAstModuleVariable(astModuleVariable: AstModuleVariable, refObject?: Object): void; protected visitAstMethod(astMethod: AstMethod, refObject?: Object): void; private _createParameters(astFunction); }