summaryrefslogtreecommitdiff
path: root/node_modules/stacktracey/stacktracey.d.ts
blob: bf4e3a4ab5f1eeb1394c995e36a8814b1c97ad84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
declare class StackTracey {

    constructor (input?: Error|string|StackTracey.Entry[], offset?: number)

    items: StackTracey.Entry[]

    extractEntryMetadata (e: StackTracey.Entry): StackTracey.Entry

    shortenPath (relativePath: string): string
    relativePath (fullPath: string): string
    isThirdParty (relativePath: string): boolean

    rawParse (str: string): StackTracey.Entry[]

    withSourceAt (i: number): StackTracey.Entry
    withSourceAsyncAt (i: number): Promise<StackTracey.Entry>

    withSource (entry: StackTracey.Entry): StackTracey.Entry
    withSourceAsync (entry: StackTracey.Entry): Promise<StackTracey.Entry>

    withSources ():        StackTracey
    withSourcesAsync ():   Promise<StackTracey>
    mergeRepeatedLines (): StackTracey

    clean ():              StackTracey
    cleanAsync ():         Promise<StackTracey>

    isClean (entry: StackTracey.Entry, index: number): boolean

    map    (f: (x: StackTracey.Entry, i: number, arr: StackTracey.Entry[]) => StackTracey.Entry):   StackTracey
    filter (f: (x: StackTracey.Entry, i: number, arr: StackTracey.Entry[]) => boolean):             StackTracey
    slice  (from?: number, to?: number):                                                            StackTracey
    concat (...args: StackTracey.Entry[]):                                                          StackTracey

    at (i: number): StackTracey.Entry

    asTable (opts?: { maxColumnWidths?: StackTracey.MaxColumnWidths }): string

    maxColumnWidths (): StackTracey.MaxColumnWidths

    static resetCache (): void
    static locationsEqual (a: StackTracey.Location, b: StackTracey.Location): boolean
}

declare namespace StackTracey {

    interface SourceFile {

        path: string
        text: string
        lines: string[]
        error?: Error
    }
    
    interface Location {
    
        file:    string
        line?:   number
        column?: number
    }
    
    interface Entry extends Location {
    
        beforeParse: string
        callee:      string
        index:       boolean
        native:      boolean
    
        calleeShort:  string
        fileRelative: string
        fileShort:    string
        fileName:     string
        thirdParty:   boolean
    
        hide?:       boolean
        sourceLine?: string
        sourceFile?: SourceFile
        error?:      Error
    }
    
    interface MaxColumnWidths {
        callee:     number
        file:       number
        sourceLine: number
    }
}

export = StackTracey