@azure-tools/typespec-apiview
Version:
Library for emitting APIView token files from TypeSpec
87 lines • 3.16 kB
TypeScript
import { Program } from "@typespec/compiler";
import { CodeDiagnostic, CodeFile, NavigationItem, ReviewLine } from "./schemas.js";
import { NamespaceStack } from "./util.js";
export declare class ApiView {
name: string;
packageName: string;
crossLanguagePackageId: string | undefined;
/** Stores the current line. All helper methods append to this. */
currentLine: ReviewLine;
/** Stores the parent of the current line. */
currentParent: ReviewLine | undefined;
/** Stores the stack of parent lines. */
parentStack: ReviewLine[];
reviewLines: ReviewLine[];
navigationItems: NavigationItem[];
diagnostics: CodeDiagnostic[];
packageVersion: string;
namespaceStack: NamespaceStack;
typeDeclarations: Set<string>;
includeGlobalNamespace: boolean;
constructor(name: string, packageName: string, includeGlobalNamespace?: boolean);
/** Compiles the APIView model for output. */
compile(program: Program): void;
private appendDebugInfo;
/** Attempts to resolve any type references marked as __MISSING__. */
resolveMissingTypeReferences(): void;
/** Apply workarounds to the model before output */
private adjustLines;
private adjustLine;
private adjustToken;
/** Output the APIView model to the CodeFile JSON format. */
asCodeFile(): CodeFile;
/** Outputs the APIView model to a string approximation of what will display on the web. */
asString(): string;
private token;
private indent;
private deindent;
/** Set the exact number of desired newlines. */
private blankLines;
private newline;
private getLastLine;
/**
* Places the provided token in the tree based on the provided characters.
* param token The token to snap.
* param characters The characters to snap to.
*/
private snapToken;
private lineMarker;
private punctuation;
private text;
private keyword;
private typeDeclaration;
private typeReference;
private member;
private stringLiteral;
private literal;
private diagnostic;
private shouldEmitNamespace;
private emitHeader;
private tokenize;
private tokenizeTemplateInstantiation;
private buildExpressionString;
/** Constructs a single string with template markers. */
private buildTemplateString;
private tokenizeModelStatement;
private tokenizeScalarStatement;
private tokenizeInterfaceStatement;
private tokenizeEnumStatement;
private tokenizeUnionStatement;
private tokenizeUnionVariant;
private tokenizeModelProperty;
/** Expands and tokenizes a model expression (anonymous model) */
private tokenizeModelExpression;
private tokenizeOperationStatement;
private tokenizeNamespaceModel;
private tokenizeDecoratorsAndDirectives;
private getFullyQualifiedIdentifier;
private tokenizeIdentifier;
private getRawText;
private tokenizeTemplateParameters;
private tokenizeTemplateArgument;
private tokenizeReturnType;
private buildNavigation;
private getNameForNode;
private definitionIdFor;
}
//# sourceMappingURL=apiview.d.ts.map