stacktracey.d.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. declare class StackTracey {
  2. constructor (input?: Error|string|StackTracey.Entry[], offset?: number)
  3. items: StackTracey.Entry[]
  4. extractEntryMetadata (e: StackTracey.Entry): StackTracey.Entry
  5. shortenPath (relativePath: string): string
  6. relativePath (fullPath: string): string
  7. isThirdParty (relativePath: string): boolean
  8. rawParse (str: string): StackTracey.Entry[]
  9. withSourceAt (i: number): StackTracey.Entry
  10. withSourceAsyncAt (i: number): Promise<StackTracey.Entry>
  11. withSource (entry: StackTracey.Entry): StackTracey.Entry
  12. withSourceAsync (entry: StackTracey.Entry): Promise<StackTracey.Entry>
  13. withSources (): StackTracey
  14. withSourcesAsync (): Promise<StackTracey>
  15. mergeRepeatedLines (): StackTracey
  16. clean (): StackTracey
  17. cleanAsync (): Promise<StackTracey>
  18. isClean (entry: StackTracey.Entry, index: number): boolean
  19. map (f: (x: StackTracey.Entry, i: number, arr: StackTracey.Entry[]) => StackTracey.Entry): StackTracey
  20. filter (f: (x: StackTracey.Entry, i: number, arr: StackTracey.Entry[]) => boolean): StackTracey
  21. slice (from?: number, to?: number): StackTracey
  22. concat (...args: StackTracey.Entry[]): StackTracey
  23. at (i: number): StackTracey.Entry
  24. asTable (opts?: { maxColumnWidths?: StackTracey.MaxColumnWidths }): string
  25. maxColumnWidths (): StackTracey.MaxColumnWidths
  26. static resetCache (): void
  27. static locationsEqual (a: StackTracey.Location, b: StackTracey.Location): boolean
  28. }
  29. declare namespace StackTracey {
  30. interface SourceFile {
  31. path: string
  32. text: string
  33. lines: string[]
  34. error?: Error
  35. }
  36. interface Location {
  37. file: string
  38. line?: number
  39. column?: number
  40. }
  41. interface Entry extends Location {
  42. beforeParse: string
  43. callee: string
  44. index: boolean
  45. native: boolean
  46. calleeShort: string
  47. fileRelative: string
  48. fileShort: string
  49. fileName: string
  50. thirdParty: boolean
  51. hide?: boolean
  52. sourceLine?: string
  53. sourceFile?: SourceFile
  54. error?: Error
  55. }
  56. interface MaxColumnWidths {
  57. callee: number
  58. file: number
  59. sourceLine: number
  60. }
  61. }
  62. export = StackTracey