(p: string)
| 513 | } |
| 514 | |
| 515 | export function platformPathToUrlPath(p: string): string { |
| 516 | p = platformPathToPreferredCase(p); |
| 517 | |
| 518 | if (platform === 'win32') { |
| 519 | if (isUncPath(p)) { |
| 520 | p = p.slice(1); // emit "file:////" and not "file://///" to match what V8 expects |
| 521 | } |
| 522 | return p |
| 523 | .split(/[\\//]/g) |
| 524 | .map((p, i) => (i > 0 ? encodeURIComponent(p) : p)) |
| 525 | .join('/'); |
| 526 | } else { |
| 527 | return p.split('/').map(encodeURIComponent).join('/'); |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | export function platformPathToPreferredCase(p: string): string; |
| 532 | export function platformPathToPreferredCase(p: string | undefined): string | undefined; |
no test coverage detected