Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. // Type definitions for istanbul-lib-report 3.0
  2. // Project: https://istanbul.js.org, https://github.com/istanbuljs/istanbuljs
  3. // Definitions by: Jason Cheatham <https://github.com/jason0x43>
  4. // Zacharias Björngren <https://github.com/zache>
  5. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
  6. // TypeScript Version: 2.4
  7. import { CoverageMap, FileCoverage, CoverageSummary } from 'istanbul-lib-coverage';
  8. /**
  9. * returns a reporting context for the supplied options
  10. */
  11. export function createContext(options?: Partial<ContextOptions>): Context;
  12. /**
  13. * returns the default watermarks that would be used when not
  14. * overridden
  15. */
  16. export function getDefaultWatermarks(): Watermarks;
  17. export class ReportBase {
  18. constructor(options?: Partial<ReportBaseOptions>);
  19. execute(context: Context): void;
  20. }
  21. export interface ReportBaseOptions {
  22. summarizer: Summarizers;
  23. }
  24. export type Summarizers = 'flat' | 'nested' | 'pkg' | 'defaultSummarizer';
  25. export interface ContextOptions {
  26. coverageMap: CoverageMap;
  27. defaultSummarizer: Summarizers;
  28. dir: string;
  29. watermarks: Partial<Watermarks>;
  30. sourceFinder(filepath: string): string;
  31. }
  32. export interface Context {
  33. data: any;
  34. dir: string;
  35. sourceFinder(filepath: string): string;
  36. watermarks: Watermarks;
  37. writer: FileWriter;
  38. /**
  39. * returns the coverage class given a coverage
  40. * types and a percentage value.
  41. */
  42. classForPercent(type: keyof Watermarks, value: number): string;
  43. /**
  44. * returns the source code for the specified file path or throws if
  45. * the source could not be found.
  46. */
  47. getSource(filepath: string): string;
  48. getTree(summarizer?: Summarizers): Tree;
  49. /**
  50. * returns a full visitor given a partial one.
  51. */
  52. getVisitor<N extends Node = Node>(visitor: Partial<Visitor<N>>): Visitor<N>;
  53. /**
  54. * returns a FileWriter implementation for reporting use. Also available
  55. * as the `writer` property on the context.
  56. */
  57. getWriter(): FileWriter;
  58. /**
  59. * returns an XML writer for the supplied content writer
  60. */
  61. getXmlWriter(contentWriter: ContentWriter): XmlWriter;
  62. }
  63. /**
  64. * Base class for writing content
  65. */
  66. export class ContentWriter {
  67. /**
  68. * returns the colorized version of a string. Typically,
  69. * content writers that write to files will return the
  70. * same string and ones writing to a tty will wrap it in
  71. * appropriate escape sequences.
  72. */
  73. colorize(str: string, clazz?: string): string;
  74. /**
  75. * writes a string appended with a newline to the destination
  76. */
  77. println(str: string): void;
  78. /**
  79. * closes this content writer. Should be called after all writes are complete.
  80. */
  81. close(): void;
  82. }
  83. /**
  84. * a content writer that writes to a file
  85. */
  86. export class FileContentWriter extends ContentWriter {
  87. constructor(fileDescriptor: number);
  88. write(str: string): void;
  89. }
  90. /**
  91. * a content writer that writes to the console
  92. */
  93. export class ConsoleWriter extends ContentWriter {
  94. write(str: string): void;
  95. }
  96. /**
  97. * utility for writing files under a specific directory
  98. */
  99. export class FileWriter {
  100. constructor(baseDir: string);
  101. static startCapture(): void;
  102. static stopCapture(): void;
  103. static getOutput(): string;
  104. static resetOutput(): void;
  105. /**
  106. * returns a FileWriter that is rooted at the supplied subdirectory
  107. */
  108. writeForDir(subdir: string): FileWriter;
  109. /**
  110. * copies a file from a source directory to a destination name
  111. */
  112. copyFile(source: string, dest: string, header?: string): void;
  113. /**
  114. * returns a content writer for writing content to the supplied file.
  115. */
  116. writeFile(file: string | null): ContentWriter;
  117. }
  118. export interface XmlWriter {
  119. indent(str: string): string;
  120. /**
  121. * writes the opening XML tag with the supplied attributes
  122. */
  123. openTag(name: string, attrs?: any): void;
  124. /**
  125. * closes an open XML tag.
  126. */
  127. closeTag(name: string): void;
  128. /**
  129. * writes a tag and its value opening and closing it at the same time
  130. */
  131. inlineTag(name: string, attrs?: any, content?: string): void;
  132. /**
  133. * closes all open tags and ends the document
  134. */
  135. closeAll(): void;
  136. }
  137. export type Watermark = [number, number];
  138. export interface Watermarks {
  139. statements: Watermark;
  140. functions: Watermark;
  141. branches: Watermark;
  142. lines: Watermark;
  143. }
  144. export interface Node {
  145. isRoot(): boolean;
  146. visit(visitor: Visitor, state: any): void;
  147. }
  148. export interface ReportNode extends Node {
  149. path: string;
  150. parent: ReportNode | null;
  151. fileCoverage: FileCoverage;
  152. children: ReportNode[];
  153. addChild(child: ReportNode): void;
  154. asRelative(p: string): string;
  155. getQualifiedName(): string;
  156. getRelativeName(): string;
  157. getParent(): Node;
  158. getChildren(): Node[];
  159. isSummary(): boolean;
  160. getFileCoverage(): FileCoverage;
  161. getCoverageSummary(filesOnly: boolean): CoverageSummary;
  162. visit(visitor: Visitor<ReportNode>, state: any): void;
  163. }
  164. export interface Visitor<N extends Node = Node> {
  165. onStart(root: N, state: any): void;
  166. onSummary(root: N, state: any): void;
  167. onDetail(root: N, state: any): void;
  168. onSummaryEnd(root: N, state: any): void;
  169. onEnd(root: N, state: any): void;
  170. }
  171. export interface Tree<N extends Node = Node> {
  172. getRoot(): N;
  173. visit(visitor: Partial<Visitor<N>>, state: any): void;
  174. }