@microsoft/api-extractor
Version:
Validate, document, and review the exported API for a TypeScript library
44 lines (43 loc) • 1.75 kB
TypeScript
import { PackageJsonLookup, IPackageJson } from '@microsoft/node-core-library';
/**
* Represents analyzed information for a package.json file.
* This object is constructed and returned by PackageMetadataManager.
*/
export declare class PackageMetadata {
/**
* The absolute path to the package.json file being analyzed.
*/
readonly packageJsonPath: string;
/**
* The parsed contents of package.json. Note that PackageJsonLookup
* only includes essential fields.
*/
readonly packageJson: IPackageJson;
/**
* If true, then the package's documentation comments can be assumed
* to contain API Extractor compatible TSDoc tags.
*/
readonly aedocSupported: boolean;
private readonly _packageJsonLookup;
constructor(packageJsonPath: string, packageJsonLookup: PackageJsonLookup);
}
/**
* This class maintains a cache of analyzed information obtained from package.json
* files. It is built on top of the PackageJsonLookup class.
*/
export declare class PackageMetadataManager {
private readonly _packageJsonLookup;
private readonly _packageMetadataByPackageJsonPath;
constructor(packageJsonLookup: PackageJsonLookup);
/**
* Finds the package.json in a parent folder of the specified source file, and
* returns a PackageMetadata object. If no package.json was found, then undefined
* is returned. The results are cached.
*/
tryFetchPackageMetadata(sourceFilePath: string): PackageMetadata | undefined;
/**
* Returns true if the source file has an associated PackageMetadata object
* with aedocSupported=true.
*/
isAedocSupportedFor(sourceFilePath: string): boolean;
}