| declare const constants: { | ||
| CONNECTING: number | ||
| CONNECTED: number | ||
| BINDING: number | ||
| BOUND: number | ||
| READING: number | ||
| CLOSING: number | ||
| READABLE: number | ||
| WRITABLE: number | ||
| } | ||
| export = constants |
| declare class PipeError extends Error { | ||
| static PIPE_ALREADY_CONNECTED(msg: string): PipeError | ||
| static SERVER_ALREADY_LISTENING(msg: string): PipeError | ||
| static SERVER_IS_CLOSED(msg: string): PipeError | ||
| } | ||
| export = PipeError |
+1
-1
@@ -769,3 +769,3 @@ #include <assert.h> | ||
| uv_file fds[2]; | ||
| err = uv_pipe(fds, 0, 0); | ||
| err = uv_pipe(fds, UV_NONBLOCK_PIPE, UV_NONBLOCK_PIPE); | ||
| assert(err == 0); | ||
@@ -772,0 +772,0 @@ |
+23
-33
| import EventEmitter, { EventMap } from 'bare-events' | ||
| import { Duplex, DuplexEvents } from 'bare-stream' | ||
| import PipeError from './lib/errors' | ||
| import constants from './lib/constants' | ||
@@ -45,3 +47,3 @@ interface PipeEvents extends DuplexEvents { | ||
| interface ServerEvents extends EventMap { | ||
| interface PipeServerEvents extends EventMap { | ||
| close: [] | ||
@@ -53,3 +55,3 @@ connection: [pipe: Pipe] | ||
| interface ServerOptions { | ||
| interface PipeServerOptions { | ||
| readBufferSize?: number | ||
@@ -59,3 +61,3 @@ allowHalfOpen?: boolean | ||
| interface ServerListenOptions { | ||
| interface PipeServerListenOptions { | ||
| path?: string | ||
@@ -65,3 +67,3 @@ backlog?: number | ||
| interface Server<M extends ServerEvents = ServerEvents> | ||
| interface PipeServer<M extends PipeServerEvents = PipeServerEvents> | ||
| extends EventEmitter<M> { | ||
@@ -75,3 +77,3 @@ readonly listening: boolean | ||
| backlog?: number, | ||
| opts?: ServerListenOptions, | ||
| opts?: PipeServerListenOptions, | ||
| onlistening?: () => void | ||
@@ -84,3 +86,3 @@ ): this | ||
| listen(opts: ServerListenOptions): this | ||
| listen(opts: PipeServerListenOptions): this | ||
@@ -94,6 +96,6 @@ close(onclose?: () => void): void | ||
| declare class Server< | ||
| M extends ServerEvents = ServerEvents | ||
| declare class PipeServer< | ||
| M extends PipeServerEvents = PipeServerEvents | ||
| > extends EventEmitter<M> { | ||
| constructor(opts?: ServerOptions, onconnection?: () => void) | ||
| constructor(opts?: PipeServerOptions, onconnection?: () => void) | ||
@@ -103,8 +105,2 @@ constructor(onconnection: () => void) | ||
| declare class PipeError extends Error { | ||
| static PIPE_ALREADY_CONNECTED(msg: string): PipeError | ||
| static SERVER_ALREADY_LISTENING(msg: string): PipeError | ||
| static SERVER_IS_CLOSED(msg: string): PipeError | ||
| } | ||
| declare namespace Pipe { | ||
@@ -129,27 +125,21 @@ export interface CreateConnectionOptions | ||
| export function createServer( | ||
| opts?: ServerOptions, | ||
| opts?: PipeServerOptions, | ||
| onconnection?: () => void | ||
| ): Server | ||
| ): PipeServer | ||
| export function pipe(): [read: number, write: number] | ||
| export const constants: { | ||
| CONNECTING: number | ||
| CONNECTED: number | ||
| BINDING: number | ||
| BOUND: number | ||
| READING: number | ||
| CLOSING: number | ||
| READABLE: number | ||
| WRITABLE: number | ||
| } | ||
| export { | ||
| type PipeEvents, | ||
| type PipeOptions, | ||
| Pipe, | ||
| PipeEvents, | ||
| PipeOptions, | ||
| PipeConnectOptions, | ||
| type PipeConnectOptions, | ||
| type PipeServerEvents, | ||
| type PipeServerOptions, | ||
| type PipeServerListenOptions, | ||
| type PipeServer, | ||
| PipeServer as Server, | ||
| type PipeError, | ||
| PipeError as errors, | ||
| ServerEvents, | ||
| ServerOptions | ||
| constants | ||
| } | ||
@@ -156,0 +146,0 @@ } |
+10
-4
| { | ||
| "name": "bare-pipe", | ||
| "version": "4.0.3", | ||
| "version": "4.0.4", | ||
| "description": "Native I/O pipes for JavaScript", | ||
| "exports": { | ||
| "./package": "./package.json", | ||
| ".": { | ||
@@ -10,5 +11,10 @@ "types": "./index.d.ts", | ||
| }, | ||
| "./package": "./package.json", | ||
| "./constants": "./lib/constants.js", | ||
| "./errors": "./lib/errors.js" | ||
| "./constants": { | ||
| "types": "./lib/constants.d.ts", | ||
| "default": "./lib/constants.js" | ||
| }, | ||
| "./errors": { | ||
| "types": "./lib/errors.d.ts", | ||
| "default": "./lib/errors.js" | ||
| } | ||
| }, | ||
@@ -15,0 +21,0 @@ "files": [ |
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
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
Sorry, the diff of this file is not supported yet
25
8.7%563
1.62%431474
-2.85%