(origin: string)
| 2975 | }); |
| 2976 | |
| 2977 | const portFromOrigin = (origin: string): number | null => { |
| 2978 | try { |
| 2979 | const url = new URL(origin); |
| 2980 | if (!url.port) return url.protocol === "https:" ? 443 : 80; |
| 2981 | const port = Number.parseInt(url.port, 10); |
| 2982 | return Number.isInteger(port) && port > 0 ? port : null; |
| 2983 | } catch { |
| 2984 | return null; |
| 2985 | } |
| 2986 | }; |
| 2987 | |
| 2988 | const servicePortOption = () => |
| 2989 | Options.integer("port") |
no outgoing calls
no test coverage detected