New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ensure-port

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ensure-port - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

6

dist/cjs/ensure-port.d.ts

@@ -24,3 +24,3 @@ import type { IFileSystem } from '@file-services/types';

*/
ensurePort(): Promise<number>;
ensure(): Promise<number>;
/**

@@ -31,3 +31,3 @@ * Un-mark a ports as used.

*/
releasePorts(currentPorts?: number[]): Promise<void>;
release(currentPorts?: number[]): Promise<void>;
/**

@@ -39,3 +39,3 @@ *

*/
setPort(port: number): Promise<void>;
set(port: number): Promise<void>;
/**

@@ -42,0 +42,0 @@ * Releases all the ports.

@@ -34,3 +34,3 @@ "use strict";

*/
async ensurePort() {
async ensure() {
if (this.initialEdges.reached) {

@@ -45,3 +45,3 @@ throw new Error(`All ports are used between ${this.initialEdges.start} and ${this.initialEdges.end}`);

if (port !== preferredPort) {
await this.setPort(port);
await this.set(port);
}

@@ -57,3 +57,3 @@ await new Promise((resolve, reject) => httpServer.close((error) => (error ? reject(error) : resolve(void 0))));

*/
async releasePorts(currentPorts) {
async release(currentPorts) {
await this.updatePersistentPorts((ports) => {

@@ -72,3 +72,3 @@ for (const port of [...(currentPorts !== null && currentPorts !== void 0 ? currentPorts : this.localPorts)]) {

*/
async setPort(port) {
async set(port) {
await this.updatePersistentPorts((ports) => {

@@ -94,3 +94,3 @@ this.localPorts.add(port);

const port = await this.getNextPort();
await this.setPort(port);
await this.set(port);
return port;

@@ -97,0 +97,0 @@ }

@@ -24,3 +24,3 @@ import type { IFileSystem } from '@file-services/types';

*/
ensurePort(): Promise<number>;
ensure(): Promise<number>;
/**

@@ -31,3 +31,3 @@ * Un-mark a ports as used.

*/
releasePorts(currentPorts?: number[]): Promise<void>;
release(currentPorts?: number[]): Promise<void>;
/**

@@ -39,3 +39,3 @@ *

*/
setPort(port: number): Promise<void>;
set(port: number): Promise<void>;
/**

@@ -42,0 +42,0 @@ * Releases all the ports.

@@ -31,3 +31,3 @@ import { nodeFs } from '@file-services/node';

*/
async ensurePort() {
async ensure() {
if (this.initialEdges.reached) {

@@ -42,3 +42,3 @@ throw new Error(`All ports are used between ${this.initialEdges.start} and ${this.initialEdges.end}`);

if (port !== preferredPort) {
await this.setPort(port);
await this.set(port);
}

@@ -54,3 +54,3 @@ await new Promise((resolve, reject) => httpServer.close((error) => (error ? reject(error) : resolve(void 0))));

*/
async releasePorts(currentPorts) {
async release(currentPorts) {
await this.updatePersistentPorts((ports) => {

@@ -69,3 +69,3 @@ for (const port of [...(currentPorts !== null && currentPorts !== void 0 ? currentPorts : this.localPorts)]) {

*/
async setPort(port) {
async set(port) {
await this.updatePersistentPorts((ports) => {

@@ -91,3 +91,3 @@ this.localPorts.add(port);

const port = await this.getNextPort();
await this.setPort(port);
await this.set(port);
return port;

@@ -94,0 +94,0 @@ }

{
"name": "ensure-port",
"version": "0.0.1",
"version": "1.0.0",
"description": "Makes sure you get an available port",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

@@ -27,3 +27,3 @@ # Ensure Port

const port = await ports.ensurePort(); // This would be a random port between 8000 and 9000 that is not used (validated again file-system and http server)
const port = await ports.ensure(); // This would be a random port between 8000 and 9000 that is not used (validated again file-system and http server)

@@ -30,0 +30,0 @@ // When you finish - remove watcher

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc