get-port-please
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -11,6 +11,14 @@ interface GetPortOptions { | ||
declare type GetPortInput = Partial<GetPortOptions> | number | string; | ||
declare function getPort(config?: GetPortInput): Promise<number>; | ||
declare function checkPorts(ports: number[], host?: string): Promise<number>; | ||
declare function checkPort(port: number, host?: string): Promise<number | false>; | ||
declare type HostAddress = undefined | string; | ||
declare type PortNumber = number; | ||
declare function getPort(config?: GetPortInput): Promise<PortNumber>; | ||
declare function getRandomPort(host: HostAddress): Promise<number>; | ||
declare function checkPort(port: PortNumber, host?: HostAddress | HostAddress[]): Promise<PortNumber | false>; | ||
interface WaitForPortOptions { | ||
host?: HostAddress; | ||
delay?: number; | ||
retries?: number; | ||
} | ||
declare function waitForPort(port: PortNumber, opts?: WaitForPortOptions): Promise<void>; | ||
export { GetPortInput, GetPortOptions, checkPort, checkPorts, getPort }; | ||
export { GetPortInput, GetPortOptions, HostAddress, PortNumber, WaitForPortOptions, checkPort, getPort, getRandomPort, waitForPort }; |
{ | ||
"name": "get-port-please", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "Get an available TCP port to listen", | ||
@@ -23,3 +23,3 @@ "repository": "unjs/get-port-please", | ||
"release": "yarn build && standard-version && npm publish && git push --follow-tags", | ||
"test": "jest" | ||
"test": "vitest" | ||
}, | ||
@@ -31,12 +31,10 @@ "dependencies": { | ||
"@nuxtjs/eslint-config-typescript": "latest", | ||
"@types/jest": "latest", | ||
"@types/node": "latest", | ||
"c8": "latest", | ||
"eslint": "latest", | ||
"jest": "latest", | ||
"standard-version": "latest", | ||
"ts-jest": "latest", | ||
"ts-node": "latest", | ||
"typescript": "latest", | ||
"unbuild": "latest" | ||
"unbuild": "latest", | ||
"vitest": "^0.5.5" | ||
} | ||
} |
@@ -21,10 +21,13 @@ ![get-port-please](https://user-images.githubusercontent.com/904724/101664848-9bc16380-3a4c-11eb-9e3a-faad60c86b2e.png) | ||
```js | ||
const { getPort, checkPort } = require('get-port-please') | ||
// or | ||
import { getPort, checkPort } from 'get-port-please' | ||
// ESM | ||
import { getPort, checkPort, getRandomPort, waitForPort } from 'get-port-please' | ||
// CommonJS | ||
const { getPort, checkPort, getRandomPort, waitForPort } = require('get-port-please') | ||
``` | ||
```ts | ||
function getPort(options?: GetPortOptions): Promise<number> | ||
function checkPort(port: number, host?: string): Promise<number | false> | ||
getPort(options?: GetPortOptions): Promise<number> | ||
checkPort(port: number, host?: string): Promise<number | false> | ||
waitForPort(port: number, options): Promise<number | false> | ||
``` | ||
@@ -68,3 +71,3 @@ | ||
The host to check. Default is `process.env.HOST || '0.0.0.0'` | ||
The host to check. Default is `process.env.HOST` otherwise all available hosts will be checked. | ||
@@ -71,0 +74,0 @@ ### `memoDir` / `memoName` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10621
8
239
82
7
2