UNPKG

@microsoft/api-extractor

Version:

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

53 lines (52 loc) 2.81 kB
import { IApiPackage } from './api/ApiItem'; import { ApiDefinitionReference } from './ApiDefinitionReference'; import { AstPackage } from './ast/AstPackage'; import { ResolvedApiItem } from './ResolvedApiItem'; import { IReferenceResolver } from './aedoc/ApiDocumentation'; /** * A loader for locating the ApiItem associated with a given project and API item, or * for locating an AstItem locally. * No processing on the ApiItem orAstItem should be done in this class, this class is only * concerned with communicating state. * The ApiItem can then be used to enforce correct API usage, like enforcing internal. * To use DocItemLoader: provide a projectFolder to construct a instance of the DocItemLoader, * then use DocItemLoader.getItem to retrieve the ApiItem of a particular API item. */ export declare class DocItemLoader implements IReferenceResolver { private _cache; private _projectFolder; /** * The projectFolder is the top-level folder containing package.json for a project * that we are compiling. */ constructor(projectFolder: string); /** * {@inheritdoc IReferenceResolver.resolve} */ resolve(apiDefinitionRef: ApiDefinitionReference, astPackage: AstPackage, warnings: string[]): ResolvedApiItem | undefined; /** * Resolution of API definition references in the scenario that the reference given indicates * that we should search within the current AstPackage to resolve. * No processing on the AstItem should be done here, this class is only concerned * with communicating state. */ resolveLocalReferences(apiDefinitionRef: ApiDefinitionReference, astPackage: AstPackage, warnings: string[]): ResolvedApiItem | undefined; /** * Resolution of API definition references in the scenario that the reference given indicates * that we should search outside of this AstPackage and instead search within the JSON API file * that is associated with the apiDefinitionRef. */ resolveJsonReferences(apiDefinitionRef: ApiDefinitionReference, warnings: string[]): ResolvedApiItem | undefined; /** * Attempts to locate and load the IApiPackage object from the project folder's * node modules. If the package already exists in the cache, nothing is done. * * @param apiDefinitionRef - interface with properties pertaining to the API definition reference */ getPackage(apiDefinitionRef: ApiDefinitionReference): IApiPackage | undefined; /** * Loads the API documentation json file and validates that it conforms to our schema. If it does, * then the json file is saved in the cache and returned. */ loadPackageIntoCache(apiJsonFilePath: string, cachePackageName: string): IApiPackage; }