(origin: string)
| 2955 | }); |
| 2956 | |
| 2957 | const portFromOrigin = (origin: string): number | null => { |
| 2958 | try { |
| 2959 | const url = new URL(origin); |
| 2960 | if (!url.port) return url.protocol === "https:" ? 443 : 80; |
| 2961 | const port = Number.parseInt(url.port, 10); |
| 2962 | return Number.isInteger(port) && port > 0 ? port : null; |
| 2963 | } catch { |
| 2964 | return null; |
| 2965 | } |
| 2966 | }; |
| 2967 | |
| 2968 | const servicePortOption = () => |
| 2969 | Options.integer("port") |
no outgoing calls
no test coverage detected