vscode-ws-jsonrpc
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -9,2 +9,2 @@ import { MessageReader, MessageWriter, Disposable, Message } from 'vscode-jsonrpc'; | ||
} | ||
export declare function createConnection(reader: MessageReader, writer: MessageWriter, onDispose: () => void): IConnection; | ||
export declare function createConnection<T extends {}>(reader: MessageReader, writer: MessageWriter, onDispose: () => void, extensions?: T): IConnection & T; |
@@ -16,8 +16,7 @@ "use strict"; | ||
exports.forward = forward; | ||
function createConnection(reader, writer, onDispose) { | ||
function createConnection(reader, writer, onDispose, extensions = {}) { | ||
const disposeOnClose = new disposable_1.DisposableCollection(); | ||
reader.onClose(() => disposeOnClose.dispose()); | ||
writer.onClose(() => disposeOnClose.dispose()); | ||
return { | ||
reader, writer, | ||
return Object.assign({ reader, writer, | ||
forward(to, map = (message) => message) { | ||
@@ -31,7 +30,5 @@ reader.listen(input => { | ||
return disposeOnClose.push(vscode_jsonrpc_1.Disposable.create(callback)); | ||
}, | ||
dispose: () => onDispose() | ||
}; | ||
}, dispose: () => onDispose() }, extensions); | ||
} | ||
exports.createConnection = createConnection; | ||
//# sourceMappingURL=connection.js.map |
@@ -6,5 +6,5 @@ /// <reference types="node" /> | ||
import { IConnection } from "./connection"; | ||
import { IWebSocket } from '../socket'; | ||
import { IWebSocket, IWebSocketConnection } from '../socket'; | ||
export declare function createServerProcess(serverName: string, command: string, args?: string[], options?: cp.SpawnOptions): IConnection; | ||
export declare function createWebSocketConnection(socket: IWebSocket): IConnection; | ||
export declare function createWebSocketConnection(socket: IWebSocket): IWebSocketConnection; | ||
export declare function createProcessSocketConnection(process: cp.ChildProcess, outSocket: net.Socket, inSocket?: net.Socket): IConnection; | ||
@@ -11,0 +11,0 @@ export declare function createSocketConnection(outSocket: net.Socket, inSocket: net.Socket, onDispose: () => void): IConnection; |
@@ -21,3 +21,3 @@ "use strict"; | ||
const writer = new socket_1.WebSocketMessageWriter(socket); | ||
return connection_1.createConnection(reader, writer, () => socket.dispose()); | ||
return connection_1.createConnection(reader, writer, () => socket.dispose(), { socket }); | ||
} | ||
@@ -24,0 +24,0 @@ exports.createWebSocketConnection = createWebSocketConnection; |
import { Disposable } from "../disposable"; | ||
import { IConnection } from "../server/connection"; | ||
export interface IWebSocket extends Disposable { | ||
@@ -8,1 +9,4 @@ send(content: string): void; | ||
} | ||
export interface IWebSocketConnection extends IConnection { | ||
readonly socket: IWebSocket; | ||
} |
{ | ||
"name": "vscode-ws-jsonrpc", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "VSCode JSON RPC over WebSocket", | ||
@@ -17,8 +17,8 @@ "author": "TypeFox GmbH (http://www.typefox.io)", | ||
"devDependencies": { | ||
"@types/node": "^7.0.56", | ||
"@types/node": "10.17.14", | ||
"rimraf": "^2.6.2", | ||
"typescript": "^2.7.2" | ||
"typescript": "3.7.5" | ||
}, | ||
"dependencies": { | ||
"vscode-jsonrpc": "^4.1.0-next" | ||
"vscode-jsonrpc": "^5.0.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "scripts": { |
@@ -22,3 +22,4 @@ /* -------------------------------------------------------------------------------------------- | ||
export function createConnection(reader: MessageReader, writer: MessageWriter, onDispose: () => void): IConnection { | ||
export function createConnection<T extends {}>(reader: MessageReader, writer: MessageWriter, onDispose: () => void, | ||
extensions: T = {} as T): IConnection & T { | ||
const disposeOnClose = new DisposableCollection(); | ||
@@ -38,4 +39,5 @@ reader.onClose(() => disposeOnClose.dispose()); | ||
}, | ||
dispose: () => onDispose() | ||
} | ||
dispose: () => onDispose(), | ||
...extensions | ||
}; | ||
} |
@@ -11,3 +11,3 @@ /* -------------------------------------------------------------------------------------------- | ||
import { IConnection, createConnection } from "./connection"; | ||
import { IWebSocket, WebSocketMessageReader, WebSocketMessageWriter } from '../socket'; | ||
import { IWebSocket, WebSocketMessageReader, WebSocketMessageWriter, IWebSocketConnection } from '../socket'; | ||
@@ -25,6 +25,6 @@ export function createServerProcess(serverName: string, command: string, args?: string[], options?: cp.SpawnOptions): IConnection { | ||
export function createWebSocketConnection(socket: IWebSocket): IConnection { | ||
export function createWebSocketConnection(socket: IWebSocket): IWebSocketConnection { | ||
const reader = new WebSocketMessageReader(socket); | ||
const writer = new WebSocketMessageWriter(socket); | ||
return createConnection(reader, writer, () => socket.dispose()); | ||
return createConnection(reader, writer, () => socket.dispose(), { socket }); | ||
} | ||
@@ -31,0 +31,0 @@ |
@@ -6,2 +6,3 @@ /* -------------------------------------------------------------------------------------------- | ||
import { Disposable } from "../disposable"; | ||
import { IConnection } from "../server/connection"; | ||
@@ -14,1 +15,5 @@ export interface IWebSocket extends Disposable { | ||
} | ||
export interface IWebSocketConnection extends IConnection { | ||
readonly socket: IWebSocket; | ||
} |
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
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
45493
53
701
+ Addedvscode-jsonrpc@5.0.1(transitive)
- Removedvscode-jsonrpc@4.1.0-next.3(transitive)
Updatedvscode-jsonrpc@^5.0.0