pickPrimaryPort
pickPrimaryPort(
ports,httpProbe?):Promise<number|null>
Defined in: src/preview.ts:348
Pick the primary dev-server port from a set of listening ports, using this rule:
- If any port from the curated list is present, return the one that appears FIRST in CURATED_PORTS (list-order priority, NOT numeric). No HTTP probe for curated ports.
- Otherwise, among non-curated ports, return the numerically LOWEST that passes the HTTP liveness probe.
- If nothing answers → null.
Parameters
Section titled “Parameters”number[]
Listening ports detected in the worktree (any order).
httpProbe?
Section titled “httpProbe?”(port) => Promise<boolean>
Injectable probe; defaults to real network call.
Returns
Section titled “Returns”Promise<number | null>