Skip to content

Commit

Permalink
Revert "Add comment for posterity"
Browse files Browse the repository at this point in the history
This reverts commit 742bace.
  • Loading branch information
Timer committed Sep 6, 2017
1 parent 742bace commit 8441f95
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions packages/react-error-overlay/src/utils/unmapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,6 @@ function count(search: string, string: string): number {
return count;
}

function normalizePath(_path: string): string {
// `path.normalize` cleans a file path, (e.g. /foo//baz/..//bar/ becomes
// /foo/bar/).
// The web version of this module only provides POSIX support, so Windows
// paths like C:\foo\\baz\..\\bar\ cannot be normalized.
// A simple solution to this is to replace all `\` with `/`, then normalize
// afterwards.
//
// Note:
// `path.normalize` supports POSIX forward slashes on Windows, but not the
// other way around. Converting all backslashes to forward slashes before
// normalizing makes this cross platform if it were isomorphic (used server
// side).
return path.normalize(
// Match contiguous backslashes
_path.replace(/[\\]+/g, '/')
);
}

/**
* Turns a set of mapped <code>StackFrame</code>s back into their generated code position and enhances them with code.
* @param {string} fileUri The URI of the <code>bundle.js</code> file.
Expand Down Expand Up @@ -75,15 +56,15 @@ async function unmap(
}
let { fileName } = frame;
if (fileName) {
fileName = normalizePath(fileName);
fileName = path.normalize(fileName.replace(/[\\]+/g, '/'));
}
if (fileName == null) {
return frame;
}
const fN: string = fileName;
const source = map
.getSources()
.map(normalizePath)
.map(s => s.replace(/[\\]+/g, '/'))
.filter(p => {
p = path.normalize(p);
const i = p.lastIndexOf(fN);
Expand Down

0 comments on commit 8441f95

Please sign in to comment.