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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // TypeScript Version: 3.0
  2. import * as Unist from 'unist'
  3. import * as vfileMessage from 'vfile-message'
  4. declare namespace vfile {
  5. /**
  6. * Encodings supported by the buffer class
  7. *
  8. * @remarks
  9. * This is a copy of the typing from Node, copied to prevent Node globals from being needed.
  10. * Copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a2bc1d868d81733a8969236655fa600bd3651a7b/types/node/globals.d.ts#L174
  11. */
  12. type BufferEncoding =
  13. | 'ascii'
  14. | 'utf8'
  15. | 'utf-8'
  16. | 'utf16le'
  17. | 'ucs2'
  18. | 'ucs-2'
  19. | 'base64'
  20. | 'latin1'
  21. | 'binary'
  22. | 'hex'
  23. /**
  24. * VFileContents can either be text, or a Buffer like structure
  25. * @remarks
  26. * This does not directly use type `Buffer, because it can also be used in a browser context.
  27. * Instead this leverages `Uint8Array` which is the base type for `Buffer`, and a native JavaScript construct.
  28. */
  29. type VFileContents = string | Uint8Array
  30. type VFileCompatible = VFile | VFileOptions | VFileContents
  31. interface Settings {
  32. [key: string]: unknown
  33. }
  34. type VFileReporter<T = Settings> = (files: VFile[], options: T) => string
  35. interface VFileOptions {
  36. contents?: VFileContents
  37. path?: string
  38. basename?: string
  39. stem?: string
  40. extname?: string
  41. dirname?: string
  42. cwd?: string
  43. data?: any
  44. [key: string]: any
  45. }
  46. interface VFile {
  47. /**
  48. * Create a new virtual file. If `options` is `string` or `Buffer`, treats it as `{contents: options}`.
  49. * If `options` is a `VFile`, returns it. All other options are set on the newly created `vfile`.
  50. *
  51. * Path related properties are set in the following order (least specific to most specific): `history`, `path`, `basename`, `stem`, `extname`, `dirname`.
  52. *
  53. * It’s not possible to set either `dirname` or `extname` without setting either `history`, `path`, `basename`, or `stem` as well.
  54. *
  55. * @param options If `options` is `string` or `Buffer`, treats it as `{contents: options}`. If `options` is a `VFile`, returns it. All other options are set on the newly created `vfile`.
  56. */
  57. <F extends VFile>(input?: VFileContents | F | VFileOptions): F
  58. /**
  59. * List of file-paths the file moved between.
  60. */
  61. history: string[]
  62. /**
  63. * Place to store custom information.
  64. * It's OK to store custom data directly on the `vfile`, moving it to `data` gives a little more privacy.
  65. */
  66. data: unknown
  67. /**
  68. * List of messages associated with the file.
  69. */
  70. messages: vfileMessage.VFileMessage[]
  71. /**
  72. * Raw value.
  73. */
  74. contents: VFileContents
  75. /**
  76. * Path of `vfile`.
  77. * Cannot be nullified.
  78. */
  79. path?: string
  80. /**
  81. * Path to parent directory of `vfile`.
  82. * Cannot be set if there's no `path` yet.
  83. */
  84. dirname?: string
  85. /**
  86. * Current name (including extension) of `vfile`.
  87. * Cannot contain path separators.
  88. * Cannot be nullified either (use `file.path = file.dirname` instead).
  89. */
  90. basename?: string
  91. /**
  92. * Name (without extension) of `vfile`.
  93. * Cannot be nullified, and cannot contain path separators.
  94. */
  95. stem?: string
  96. /**
  97. * Extension (with dot) of `vfile`.
  98. * Cannot be set if there's no `path` yet and cannot contain path separators.
  99. */
  100. extname?: string
  101. /**
  102. * Base of `path`.
  103. * Defaults to `process.cwd()`.
  104. */
  105. cwd: string
  106. /**
  107. * Convert contents of `vfile` to string.
  108. * @param encoding If `contents` is a buffer, `encoding` is used to stringify buffers (default: `'utf8'`).
  109. */
  110. toString: (encoding?: BufferEncoding) => string
  111. /**
  112. * Associates a message with the file for `reason` at `position`.
  113. * When an error is passed in as `reason`, copies the stack.
  114. * Each message has a `fatal` property which by default is set to `false` (ie. `warning`).
  115. * @param reason Reason for message. Uses the stack and message of the error if given.
  116. * @param position Place at which the message occurred in `vfile`.
  117. * @param ruleId Category of message.
  118. */
  119. message: (
  120. reason: string,
  121. position?: Unist.Point | Unist.Position | Unist.Node,
  122. ruleId?: string
  123. ) => vfileMessage.VFileMessage
  124. /**
  125. * Associates a fatal message with the file, then immediately throws it.
  126. * Note: fatal errors mean a file is no longer processable.
  127. * Calls `message()` internally.
  128. * @param reason Reason for message. Uses the stack and message of the error if given.
  129. * @param position Place at which the message occurred in `vfile`.
  130. * @param ruleId Category of message.
  131. */
  132. fail: (
  133. reason: string,
  134. position?: Unist.Point | Unist.Position | Unist.Node,
  135. ruleId?: string
  136. ) => never
  137. /**
  138. * Associates an informational message with the file, where `fatal` is set to `null`.
  139. * Calls `message()` internally.
  140. * @param reason Reason for message. Uses the stack and message of the error if given.
  141. * @param position Place at which the message occurred in `vfile`.
  142. * @param ruleId Category of message.
  143. */
  144. info: (
  145. reason: string,
  146. position?: Unist.Point | Unist.Position | Unist.Node,
  147. ruleId?: string
  148. ) => vfileMessage.VFileMessage
  149. [key: string]: unknown
  150. }
  151. }
  152. declare const vfile: vfile.VFile
  153. export = vfile