/** How many consecutive ports to try before giving up. */ export declare const MAX_PORT_FALLBACK_ATTEMPTS = 10; /** The highest port a TCP listener can bind. */ export declare const MAX_TCP_PORT = 65535; /** True when `error` means "that port is taken", on either Deno or Node. */ export declare function isPortInUseError(error: unknown): boolean; /** * True when `error` means "this host has no address in that family at all", * rather than "that port is taken". * * The two have to be told apart, because probing a family a host does not have * must not make every port look busy: an IPv4-only CI container or a machine * with IPv6 disabled would otherwise never find a free port to fall back to. */ export declare function isAddressFamilyUnavailableError(error: unknown): boolean; /** * Binds `port` on every loopback family the dev server might use, and releases * it again, to see whether the dev server could have it. * * A port counts as available only when nothing holds it on *any* of those * addresses - see `PROBE_HOSTNAMES` for why one family is not enough. A family * the host does not have is skipped rather than counted as a collision. * * The Deno runtime is read through `getDenoRuntime()` rather than through the * `Deno` global directly: dnt rewrites every bare `Deno.` reference in the * published npm build into `@deno/shim-deno`, whose Node-backed `listen()` * reads `server._handle.fd` - null under Deno's `node:net`. A CLI installed * with `deno install -gArf npm:veryfront` runs that build on a real Deno, so * the shim was reached and `veryfront dev` died on "Cannot read properties of * null (reading 'fd')" before it ever printed a URL. */ export declare function isPortAvailable(port: number): Promise; /** * Returns `requestedPort`, or the first free port after it. * * Port 0 means "any free port", but it cannot be passed through: everything * downstream - the MCP port, `VERYFRONT_DEV_PORT`, the module server URL, the * printed `http://localhost:` - is derived from the number the dev server * is handed, so handing it 0 lets the OS pick a port nothing else is told * about. It is resolved to a concrete ephemeral port here instead, and checked * with `probe` like any other candidate because the OS pool is per address * family while the dev server needs the port free on all of them. * * The scan stops at `MAX_TCP_PORT`: a runtime rejects port 65536 as an invalid * port rather than as an address in use, so scanning past the end of the range * would let that raw error escape instead of the `PORT_IN_USE` below. * `requestedPort` itself is always probed, so an out-of-range `--port` still * surfaces the runtime's own complaint about the value the user passed. * * Throws `PORT_IN_USE` - whose suggestion names `--port` - once the whole scan * range is taken. */ export declare function findAvailablePort(requestedPort: number, maxAttempts?: number, probe?: (port: number) => Promise): Promise; //# sourceMappingURL=port-fallback.d.ts.map