Skip to content

Commit 8441f95

Browse files
committed
Revert "Add comment for posterity"
This reverts commit 742bace.
1 parent 742bace commit 8441f95

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

Diff for: packages/react-error-overlay/src/utils/unmapper.js

+2-21
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,6 @@ function count(search: string, string: string): number {
2727
return count;
2828
}
2929

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-
4930
/**
5031
* Turns a set of mapped <code>StackFrame</code>s back into their generated code position and enhances them with code.
5132
* @param {string} fileUri The URI of the <code>bundle.js</code> file.
@@ -75,15 +56,15 @@ async function unmap(
7556
}
7657
let { fileName } = frame;
7758
if (fileName) {
78-
fileName = normalizePath(fileName);
59+
fileName = path.normalize(fileName.replace(/[\\]+/g, '/'));
7960
}
8061
if (fileName == null) {
8162
return frame;
8263
}
8364
const fN: string = fileName;
8465
const source = map
8566
.getSources()
86-
.map(normalizePath)
67+
.map(s => s.replace(/[\\]+/g, '/'))
8768
.filter(p => {
8869
p = path.normalize(p);
8970
const i = p.lastIndexOf(fN);

0 commit comments

Comments
 (0)