(input: string)
| 79 | }) |
| 80 | |
| 81 | function url(input: string) { |
| 82 | const value = input.trim() |
| 83 | if (!value) return undefined |
| 84 | |
| 85 | try { |
| 86 | const parsed = new URL(value) |
| 87 | if (parsed.protocol === "file:") return undefined |
| 88 | return parts(parsed.hostname, parsed.pathname) |
| 89 | } catch { |
| 90 | const scp = value.match(/^([^@/:]+@)?([^/:]+):(.+)$/) |
| 91 | if (scp) return parts(scp[2], scp[3]) |
| 92 | return undefined |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | function parts(host: string, name: string) { |
| 97 | const pathname = name |
no test coverage detected