UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

78 lines (77 loc) 3.93 kB
import ts from 'typescript'; export interface TypeElementInSource { name: string; node: ts.Node; kind: 'interface' | 'type' | 'enum' | 'class' | 'variable'; extends: string[]; generics: string[]; filePath: string; lineNumber: number; comments?: string[]; readonly properties?: string[]; } export declare function getTypeScriptSourceFiles(fileNames: readonly string[]): { files: ts.SourceFile[]; program: ts.Program; }; export declare function dropGenericsFromTypeName(type: string): string; export declare function removeCommentSymbolsFromTypeScriptComment(comment: string): string; export declare function getTextualCommentsFromTypeScript(node: ts.Node): string[]; export declare function getStartLineOfTypeScriptNode(node: ts.Node, sourceFile: ts.SourceFile): number; export declare function getType(node: ts.Node, typeChecker: ts.TypeChecker): string; export declare function followTypeReference(type: ts.TypeReferenceNode, sourceFile: ts.SourceFile): string[]; export declare function getTypePathForTypeScript({ filePath }: Pick<TypeElementInSource, 'filePath'>): string; export declare function getTypePathLink(elem: Pick<TypeElementInSource, 'filePath' | 'lineNumber'>, prefix?: string): string; export interface GetTypesAsMermaidOption { readonly rootFolder?: string; readonly files?: readonly string[]; /** if you request a type name, we will generate a mermaid diagram for that type */ readonly typeNameForMermaid?: string; readonly inlineTypes?: readonly string[]; } export interface TypeReport { /** if you request a type name this will include the mermaid diagram for the type */ mermaid: string | undefined; info: TypeElementInSource[]; program: ts.Program; } export declare function getTypesFromFolder(options: GetTypesAsMermaidOption & { typeNameForMermaid: string; }): (TypeReport & { mermaid: string; }); export declare function getTypesFromFolder(options: GetTypesAsMermaidOption & { typeNameForMermaid?: undefined; }): (TypeReport & { mermaid: undefined; }); export declare function getTypesFromFolder(options: GetTypesAsMermaidOption): TypeReport; export declare function implSnippet(node: TypeElementInSource | undefined, program: ts.Program, showName?: boolean, nesting?: number, open?: boolean): string; export interface PrintHierarchyArguments { readonly program: ts.Program; readonly info: TypeElementInSource[]; readonly root: string; readonly collapseFromNesting?: number; readonly initialNesting?: number; readonly maxDepth?: number; readonly openTop?: boolean; } export declare const mermaidHide: string[]; export declare function printHierarchy({ program, info, root, collapseFromNesting, initialNesting, maxDepth, openTop }: PrintHierarchyArguments): string; interface FnInfo { info: TypeElementInSource[]; program: ts.Program; } export declare function printCodeOfElement({ program, info }: FnInfo, name: string): string; /** * Create a short link to a type in the documentation * @param name - The name of the type, e.g. `MyType`, may include a container, e.g.,`MyContainer::MyType` (this works with function nestings too) * Use `:::` if you want to access a scoped function, but the name should be displayed without the scope * @param hierarchy - The hierarchy of types to search in * @param codeStyle - Whether to use code style for the link * @param realNameWrapper - How to highlight the function in name in the `x::y` format? */ export declare function shortLink(name: string, hierarchy: readonly TypeElementInSource[], codeStyle?: boolean, realNameWrapper?: string): string; export declare function shortLinkFile(name: string, hierarchy: readonly TypeElementInSource[]): string; export declare function getDocumentationForType(name: string, hierarchy: TypeElementInSource[], prefix?: string, fuzzy?: boolean): string; export {};