(path: string)
| 73 | } |
| 74 | |
| 75 | export function normalizePathSlash(path: string) { |
| 76 | // MIT https://github.com/sindresorhus/slash/blob/main/license |
| 77 | // Convert Windows backslash paths to slash paths: foo\\bar ➔ foo/bar |
| 78 | const isExtendedLengthPath = /^\\\\\?\\/.test(path); |
| 79 | const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex |
| 80 | |
| 81 | if (isExtendedLengthPath || hasNonAscii) { |
| 82 | return path; |
| 83 | } |
| 84 | |
| 85 | path = path.replace(/\\/g, '/'); |
| 86 | if (path.endsWith('/')) { |
| 87 | path = path.slice(0, path.length - 1); |
| 88 | } |
| 89 | return path; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Creates an id for the module, based on its path. |
no outgoing calls
no test coverage detected
searching dependent graphs…