third-party-libs.js.flow 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /**
  2. * Basic declarations for the npm modules we use.
  3. */
  4. declare module "micromatch" {
  5. declare module.exports: {
  6. (Array<string>, Array<string>, ?{ nocase: boolean }): Array<string>,
  7. };
  8. }
  9. declare module "resolve" {
  10. declare export default {
  11. sync: (string, {| basedir: string |}) => string;
  12. };
  13. }
  14. declare module "json5" {
  15. declare export default {
  16. parse: (string) => mixed,
  17. };
  18. }
  19. declare module "lodash/defaults" {
  20. declare export default <T: Object>(T, Object) => T;
  21. }
  22. declare module "lodash/clone" {
  23. declare export default <T>(obj: T) => T;
  24. }
  25. declare module "lodash/merge" {
  26. declare export default <T: Object>(T, Object) => T;
  27. }
  28. declare module "source-map" {
  29. declare export type SourceMap = {
  30. version: 3,
  31. file: ?string,
  32. sourceRoot: ?string,
  33. sources: [?string],
  34. sourcesContent: [?string],
  35. names: [?string],
  36. mappings: string,
  37. };
  38. declare module.exports: {
  39. SourceMapConsumer: typeof SourceMapConsumer,
  40. SourceMapGenerator: typeof SourceMapGenerator,
  41. }
  42. declare class SourceMapConsumer {
  43. static GENERATED_ORDER: 1;
  44. static ORIGINAL_ORDER: 2;
  45. file: string | null;
  46. sourceRoot: string | null;
  47. sources: Array<string>;
  48. constructor(?SourceMap): this;
  49. computeColumnSpans(): string;
  50. originalPositionFor({
  51. line: number,
  52. column: number,
  53. }): {|
  54. source: string,
  55. line: number,
  56. column: number,
  57. name: string | null
  58. |} | {|
  59. source: null,
  60. line: null,
  61. column: null,
  62. name: null
  63. |};
  64. generatedPositionFor({
  65. source: string,
  66. line: number,
  67. column: number,
  68. }): {|
  69. line: number,
  70. column: number,
  71. lastColumn: number | null | void,
  72. |} | {|
  73. line: null,
  74. column: null,
  75. lastColumn: null | void,
  76. |};
  77. allGeneratedPositionsFor({
  78. source: string,
  79. line: number,
  80. column: number,
  81. }): Array<{|
  82. line: number,
  83. column: number,
  84. lastColumn: number,
  85. |}>;
  86. sourceContentFor(string, boolean | void): string | null;
  87. eachMapping(
  88. ({|
  89. generatedLine: number,
  90. generatedColumn: number,
  91. source: string,
  92. originalLine: number,
  93. originalColumn: number,
  94. name: string | null,
  95. |} | {|
  96. generatedLine: number,
  97. generatedColumn: number,
  98. source: null,
  99. originalLine: null,
  100. originalColumn: null,
  101. name: null,
  102. |}) => mixed,
  103. context: mixed,
  104. order: ?(1 | 2),
  105. ): void;
  106. }
  107. declare class SourceMapGenerator {
  108. constructor(?{
  109. file?: string | null,
  110. sourceRoot?: string | null,
  111. skipValidation?: boolean | null,
  112. }): this;
  113. addMapping({
  114. generated: {
  115. line: number,
  116. column: number,
  117. }
  118. }): void;
  119. setSourceContent(string, string): void;
  120. toJSON(): SourceMap;
  121. }
  122. }
  123. declare module "convert-source-map" {
  124. import type { SourceMap } from "source-map";
  125. declare class Converter {
  126. toJSON(): string;
  127. toBase64(): string;
  128. toComment(): string;
  129. toObject(): SourceMap
  130. }
  131. declare module.exports: {
  132. SourceMap: SourceMap,
  133. Converter: Converter,
  134. fromObject(obj: SourceMap): Converter,
  135. fromJSON(str: string): Converter,
  136. fromBase64(str: string): Converter,
  137. fromComment(str: string): Converter,
  138. fromMapFileComment(str: string): Converter,
  139. fromSource(str: string): Converter,
  140. fromMapFileSource(str: string): Converter,
  141. removeComments(str: string): string,
  142. removeMapFileComments(str: string): string,
  143. generateMapFileComment(path: string, options?: ?{ multiline: boolean }): string,
  144. };
  145. }