UNPKG

2.55 kBTypeScriptView Raw
1import { type ApiModel, type ApiItem, ApiItemKind } from '@microsoft/api-extractor-model';
2import { type DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
3import type { IYamlItem } from '../yaml/IYamlApiFile';
4import type { IYamlTocFile, IYamlTocItem } from '../yaml/IYamlTocFile';
5/**
6 * Writes documentation in the Universal Reference YAML file format, as defined by typescript.schema.json.
7 */
8export declare class YamlDocumenter {
9 protected readonly newDocfxNamespaces: boolean;
10 private readonly _yamlFormat;
11 private readonly _apiModel;
12 private readonly _markdownEmitter;
13 private _apiItemsByCanonicalReference;
14 private _yamlReferences;
15 constructor(apiModel: ApiModel, newDocfxNamespaces?: boolean, yamlFormat?: string);
16 /** @virtual */
17 generateFiles(outputFolder: string): void;
18 /** @virtual */
19 protected onGetTocRoot(): IYamlTocItem;
20 /** @virtual */
21 protected onCustomizeYamlItem(yamlItem: IYamlItem): void;
22 private _visitApiItems;
23 protected _getLogicalChildren(apiItem: ApiItem): ApiItem[];
24 private _flattenNamespaces;
25 /**
26 * Write the table of contents
27 */
28 private _writeTocFile;
29 /** @virtual */
30 protected buildYamlTocFile(apiItems: ReadonlyArray<ApiItem>): IYamlTocFile;
31 private _buildTocItems;
32 /** @virtual */
33 protected _getTocItemName(apiItem: ApiItem): string;
34 protected _shouldEmbed(apiItemKind: ApiItemKind): boolean;
35 protected _shouldInclude(apiItemKind: ApiItemKind): boolean;
36 private _generateYamlItem;
37 private _populateYamlTypeParameters;
38 private _populateYamlClassOrInterface;
39 private _populateYamlFunctionLike;
40 private _populateYamlProperty;
41 private _populateYamlVariable;
42 private _populateYamlTypeAlias;
43 private _renderMarkdown;
44 private _writeYamlFile;
45 /**
46 * Calculate the DocFX "uid" for the ApiItem
47 * Example: `node-core-library!JsonFile#load`
48 */
49 protected _getUid(apiItem: ApiItem): string;
50 protected _getUidObject(apiItem: ApiItem): DeclarationReference;
51 /**
52 * Initialize the _apiItemsByCanonicalReference data structure.
53 */
54 private _initApiItems;
55 /**
56 * Helper for _initApiItems()
57 */
58 private _initApiItemsRecursive;
59 private _ensureYamlReferences;
60 private _renderInheritance;
61 private _renderType;
62 private _recordYamlReference;
63 private _getYamlItemName;
64 private _getYamlFilePath;
65 private _deleteOldOutputFiles;
66}
67//# sourceMappingURL=YamlDocumenter.d.ts.map
\No newline at end of file