File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change 1
- import { createHash } from "crypto" ;
2
-
3
- /** Matches any line containing 'tsserver.js' followed by line numbers. */
4
- const serverLinePattern = / t s s e r v e r \. j s : ( \d + ) (?: : ( \d + ) ) ? / i;
1
+ import { createHash } from "crypto" ;
5
2
6
3
export function getHash ( methods : string [ ] ) : string {
7
4
const lines = methods . join ( "\n" ) ;
8
5
return createHash ( "md5" ) . update ( lines ) . digest ( "hex" ) ;
9
6
}
10
7
11
8
export function getHashForStack ( stack : string ) : string {
12
- const stackLines = stack . split ( / \r ? \n | \r / ) ;
13
-
14
- const errorMessage = stackLines [ 1 ] ;
9
+ const stackLines = stack . split ( / \r ? \n / ) ;
15
10
16
- // We will only match methods that contains tsserver. Everything else is ignored.
17
- return getHash ( [ errorMessage , ...stackLines . filter ( l => serverLinePattern . exec ( l ) ) ] ) ;
11
+ return getHash ( stackLines ) ;
18
12
}
19
13
20
14
export function getErrorMessageFromStack ( stack : string ) : string {
21
- const stackLines = stack . split ( / \r ? \n | \r / , 2 ) ;
15
+ const stackLines = stack . split ( / \r ? \n / , 2 ) ;
22
16
23
17
return stackLines [ 1 ] ;
24
18
}
You can’t perform that action at this time.
0 commit comments