get-port
Advanced tools
Comparing version 6.1.2 to 7.0.0
@@ -1,4 +0,4 @@ | ||
import {ListenOptions} from 'node:net'; | ||
import {type ListenOptions} from 'node:net'; | ||
export interface Options extends Omit<ListenOptions, 'port'> { | ||
export type Options = { | ||
/** | ||
@@ -22,3 +22,3 @@ A preferred port or an iterable of preferred ports to use. | ||
readonly host?: string; | ||
} | ||
} & Omit<ListenOptions, 'port'>; | ||
@@ -25,0 +25,0 @@ /** |
14
index.js
@@ -23,4 +23,4 @@ import net from 'node:net'; | ||
// Lazily create interval on first use | ||
let interval; | ||
// Lazily create timeout on first use | ||
let timeout; | ||
@@ -113,4 +113,6 @@ const getLocalHosts = () => { | ||
if (interval === undefined) { | ||
interval = setInterval(() => { | ||
if (timeout === undefined) { | ||
timeout = setTimeout(() => { | ||
timeout = undefined; | ||
lockedPorts.old = lockedPorts.young; | ||
@@ -121,4 +123,4 @@ lockedPorts.young = new Set(); | ||
// Does not exist in some environments (Electron, Jest jsdom env, browser, etc). | ||
if (interval.unref) { | ||
interval.unref(); | ||
if (timeout.unref) { | ||
timeout.unref(); | ||
} | ||
@@ -125,0 +127,0 @@ } |
{ | ||
"name": "get-port", | ||
"version": "6.1.2", | ||
"version": "7.0.0", | ||
"description": "Get an available port", | ||
@@ -14,5 +14,8 @@ "license": "MIT", | ||
"type": "module", | ||
"exports": "./index.js", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
"node": ">=16" | ||
}, | ||
@@ -44,9 +47,8 @@ "scripts": { | ||
"devDependencies": { | ||
"@types/node": "^16.10.2", | ||
"ava": "^3.15.0", | ||
"tsd": "^0.17.0", | ||
"typescript": "^4.4.3", | ||
"xo": "^0.45.0" | ||
"@types/node": "^20.2.5", | ||
"ava": "^5.3.0", | ||
"tsd": "^0.28.1", | ||
"xo": "^0.54.2" | ||
}, | ||
"sideEffects": false | ||
} |
@@ -106,13 +106,1 @@ # get-port | ||
- [get-port-cli](https://github.com/sindresorhus/get-port-cli) - CLI for this module | ||
--- | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-get-port?utm_source=npm-get-port&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
4
188
10714
106