@@ -27,25 +27,6 @@ function count(search: string, string: string): number {
27
27
return count ;
28
28
}
29
29
30
- function normalizePath ( _path : string ) : string {
31
- // `path.normalize` cleans a file path, (e.g. /foo//baz/..//bar/ becomes
32
- // /foo/bar/).
33
- // The web version of this module only provides POSIX support, so Windows
34
- // paths like C:\foo\\baz\..\\bar\ cannot be normalized.
35
- // A simple solution to this is to replace all `\` with `/`, then normalize
36
- // afterwards.
37
- //
38
- // Note:
39
- // `path.normalize` supports POSIX forward slashes on Windows, but not the
40
- // other way around. Converting all backslashes to forward slashes before
41
- // normalizing makes this cross platform if it were isomorphic (used server
42
- // side).
43
- return path . normalize (
44
- // Match contiguous backslashes
45
- _path . replace ( / [ \\ ] + / g, '/' )
46
- ) ;
47
- }
48
-
49
30
/**
50
31
* Turns a set of mapped <code>StackFrame</code>s back into their generated code position and enhances them with code.
51
32
* @param {string } fileUri The URI of the <code>bundle.js</code> file.
@@ -75,15 +56,15 @@ async function unmap(
75
56
}
76
57
let { fileName } = frame ;
77
58
if ( fileName ) {
78
- fileName = normalizePath ( fileName ) ;
59
+ fileName = path . normalize ( fileName . replace ( / [ \\ ] + / g , '/' ) ) ;
79
60
}
80
61
if ( fileName == null ) {
81
62
return frame ;
82
63
}
83
64
const fN : string = fileName ;
84
65
const source = map
85
66
. getSources ( )
86
- . map ( normalizePath )
67
+ . map ( s => s . replace ( / [ \\ ] + / g , '/' ) )
87
68
. filter ( p => {
88
69
p = path . normalize ( p ) ;
89
70
const i = p . lastIndexOf ( fN ) ;
0 commit comments