(file: string)
| 145 | // /@fs/C:/root/id.js => C:/root/id.js |
| 146 | // file:///C:/root/id.js -> C:/root/id.js |
| 147 | export function normalizeModuleId(file: string): string { |
| 148 | if (prefixedBuiltins.has(file)) return file |
| 149 | |
| 150 | // unix style, but Windows path still starts with the drive letter to check the root |
| 151 | const unixFile = slash(file) |
| 152 | .replace(/^\/@fs\//, isWindows ? '' : '/') |
| 153 | .replace(/^node:/, '') |
| 154 | .replace(/^\/+/, '/') |
| 155 | |
| 156 | // if it's not in the root, keep it as a path, not a URL |
| 157 | return unixFile.replace(/^file:\/+/, isWindows ? '' : '/') |
| 158 | } |
no test coverage detected