@@ -6,7 +6,7 @@ const fetchContent = (url: string) => fetch(url).then((r) => r.text());
6
6
const findSourceMap = async ( fileSource : string , filename : string ) => {
7
7
try {
8
8
// Prefer to get it via filename + '.map'.
9
- const mapUrl = filename + ' .map' ;
9
+ const mapUrl = ` ${ filename } .map` ;
10
10
return await fetchContent ( mapUrl ) ;
11
11
} catch ( e ) {
12
12
const mapUrl = fileSource . match ( / \/ \/ # s o u r c e M a p p i n g U R L = ( .* ) $ / ) ?. [ 1 ] ;
@@ -33,7 +33,7 @@ const escapeHTML = (str: string) =>
33
33
const formatSourceCode = ( sourceCode : string , pos : any ) => {
34
34
// Note that the line starts at 1, not 0.
35
35
const { line : crtLine , column, name } = pos ;
36
- let lines = sourceCode . split ( '\n' ) ;
36
+ const lines = sourceCode . split ( '\n' ) ;
37
37
38
38
// Display up to 6 lines of source code
39
39
const lineCount = Math . min ( lines . length , 6 ) ;
@@ -51,12 +51,7 @@ const formatSourceCode = (sourceCode: string, pos: any) => {
51
51
52
52
// When the sourcemap information includes specific column details, add an error hint below the error line.
53
53
if ( line === crtLine && column > 0 ) {
54
- const errorLine =
55
- ' ' . repeat ( prefix . length + column ) +
56
- '<span style="color: #fc5e5e;">' +
57
- '^' . repeat ( name ?. length || 1 ) +
58
- '</span>' ;
59
-
54
+ const errorLine = `${ ' ' . repeat ( prefix . length + column ) } <span style="color: #fc5e5e;">${ '^' . repeat ( name ?. length || 1 ) } </span>` ;
60
55
result . push ( errorLine ) ;
61
56
}
62
57
}
@@ -78,8 +73,8 @@ export const findSourceCode = async (sourceInfo: any) => {
78
73
79
74
// Use sourcemap to find the source code location
80
75
const pos = consumer . originalPositionFor ( {
81
- line : parseInt ( line , 10 ) ,
82
- column : parseInt ( column , 10 ) ,
76
+ line : Number . parseInt ( line , 10 ) ,
77
+ column : Number . parseInt ( column , 10 ) ,
83
78
} ) ;
84
79
85
80
const url = `${ pos . source } :${ pos . line } :${ pos . column } ` ;
0 commit comments