MCPcopy Create free account
hub / github.com/webpack/less-loader / removeCWD

Function removeCWD

test/helpers/normalizeErrors.js:5–18  ·  view source on GitHub ↗

* @param {string} str str * @returns {string} str without cwd

(str)

Source from the content-addressed store, hash-verified

3 * @returns {string} str without cwd
4 */
5function removeCWD(str) {
6 const isWin = process.platform === "win32";
7 let cwd = process.cwd();
8
9 if (isWin) {
10 str = str.replaceAll("\\", "/");
11
12 cwd = cwd.replaceAll("\\", "/");
13 }
14
15 return str
16 .replace(/\(from .*?\)/, "(from `replaced original path`)")
17 .replaceAll(new RegExp(cwd, "g"), "");
18}
19
20export default (errors) =>
21 errors.map((error) =>

Callers 1

normalizeErrors.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…