@azure/static-web-apps-cli
Version:
Azure Static Web Apps CLI
63 lines • 2.51 kB
TypeScript
/**
* Check if a given remote address and port are accepting TCP connections.
* @param Object host and port of the server to check.
* @returns The resolved port number if the given server does not accept TCP connections. 0 if the port is already taken.
*/
export declare function isAcceptingTcpConnections({ host, port }: {
host?: string;
port?: number;
}): Promise<number>;
/**
* Ask if the user wants to use a new port number, and if yes return the new port number.
* @returns A new port number if the user accepts or 0 if he refuses.
*/
export declare function askNewPort(): Promise<number>;
/**
* Check if a given URL string is a valid URL.
* @param url The URL string to check.
* @returns True if the URL string is a valid URL. False otherwise.
*/
export declare function isHttpUrl(url: string | undefined): boolean;
/**
* Check if a given URL string is a valid https URL.
* @param url The URL string to check.
* @returns True if the URL string is a valid https URL. False otherwise.
*/
export declare function isHttpsUrl(url: string | undefined): boolean;
/**
* Checks if a given server is up and accepting connection.
* @param url An HTTP URL.
* @param timeout Maximum time in ms to wait before exiting with failure (1) code,
default Infinity.
*/
export declare function validateDevServerConfig(url: string | undefined, timeout: number | undefined): Promise<void>;
/**
* Parse a given URL and return its protocol, port, host and hostname.
* @param url The URL string to check.
* @returns Protocol, port, host and hostname extracted from the URL.
*/
export declare function parseUrl(url: string | undefined): {
protocol: string;
port: number;
host: string;
hostname: string;
};
/**
* Construct a valid URL string from a host, port and protocol.
* @param host A host address.
* @param port (optional) A host port.
* @param protocol (optional) A host protocol.
* @throws {Error} if the URL is malformed.
* @returns
*/
export declare function address(host: string | undefined, port?: number | string, protocol?: string): string;
export declare function response({ status, headers, cookies, body }: ResponseOptions): {
status: number;
cookies: any;
headers: any;
body: any;
};
export declare function parsePort(port: string): number;
export declare function hostnameToIpAdress(hostnameOrIpAddress: string | undefined): string | undefined;
export declare function isValidIpAddress(ip: string): number;
//# sourceMappingURL=net.d.ts.map