(filepath: string)
| 499 | const CHAR_FORWARD_SLASH = 47 |
| 500 | |
| 501 | function toFileUrl(filepath: string) { |
| 502 | const outURL = new URL("file://") |
| 503 | let resolved = resolve(filepath) |
| 504 | // path.resolve strips trailing slashes so we must add them back |
| 505 | const filePathLast = filepath.charCodeAt(filepath.length - 1) |
| 506 | if ( |
| 507 | (filePathLast === CHAR_FORWARD_SLASH) && |
| 508 | resolved[resolved.length - 1] !== "/" |
| 509 | ) { |
| 510 | resolved += "/" |
| 511 | } |
| 512 | outURL.pathname = encodePathChars(resolved) |
| 513 | return Effect.succeed(outURL) |
| 514 | } |
| 515 | |
| 516 | const percentRegExp = /%/g |
| 517 | const backslashRegExp = /\\/g |
nothing calls this directly
no test coverage detected