Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vscode-ws-jsonrpc

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-ws-jsonrpc - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1-dev.0

dist/cjs/connection.d.ts

17

lib/connection.js

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,5 +5,3 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSocket = exports.listen = void 0;
const socket_1 = require("./socket");
import { createWebSocketConnection } from './socket';
/* --------------------------------------------------------------------------------------------

@@ -14,14 +11,13 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
const logger_1 = require("./logger");
function listen(options) {
import { ConsoleLogger } from './logger';
export function listen(options) {
const { webSocket, onConnection } = options;
const logger = options.logger || new logger_1.ConsoleLogger();
const logger = options.logger || new ConsoleLogger();
webSocket.onopen = () => {
const socket = toSocket(webSocket);
const connection = (0, socket_1.createWebSocketConnection)(socket, logger);
const connection = createWebSocketConnection(socket, logger);
onConnection(connection);
};
}
exports.listen = listen;
function toSocket(webSocket) {
export function toSocket(webSocket) {
return {

@@ -45,3 +41,2 @@ send: content => webSocket.send(content),

}
exports.toSocket = toSocket;
//# sourceMappingURL=connection.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,7 +5,4 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Disposable = exports.DisposableCollection = void 0;
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return vscode_jsonrpc_1.Disposable; } });
class DisposableCollection {
import { Disposable } from 'vscode-jsonrpc';
export class DisposableCollection {
constructor() {

@@ -33,3 +29,3 @@ this.disposables = [];

}
exports.DisposableCollection = DisposableCollection;
export { Disposable };
//# sourceMappingURL=disposable.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,10 +5,8 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("vscode-jsonrpc"), exports);
tslib_1.__exportStar(require("vscode-jsonrpc/lib/common/messages"), exports);
tslib_1.__exportStar(require("./disposable"), exports);
tslib_1.__exportStar(require("./socket"), exports);
tslib_1.__exportStar(require("./logger"), exports);
tslib_1.__exportStar(require("./connection"), exports);
export * from 'vscode-jsonrpc';
export * from 'vscode-jsonrpc/lib/common/messages';
export * from './disposable';
export * from './socket';
export * from './logger';
export * from './connection';
//# sourceMappingURL=index.js.map

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConsoleLogger = void 0;
class ConsoleLogger {
export class ConsoleLogger {
error(message) {

@@ -21,3 +18,2 @@ console.error(message);

}
exports.ConsoleLogger = ConsoleLogger;
//# sourceMappingURL=logger.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,7 +5,5 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConnection = exports.forward = void 0;
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
const disposable_1 = require("../disposable");
function forward(clientConnection, serverConnection, map) {
import { Disposable } from 'vscode-jsonrpc';
import { DisposableCollection } from '../disposable';
export function forward(clientConnection, serverConnection, map) {
clientConnection.forward(serverConnection, map);

@@ -17,8 +14,8 @@ serverConnection.forward(clientConnection, map);

}
exports.forward = forward;
function createConnection(reader, writer, onDispose, extensions = {}) {
const disposeOnClose = new disposable_1.DisposableCollection();
export function createConnection(reader, writer, onDispose, extensions = {}) {
const disposeOnClose = new DisposableCollection();
reader.onClose(() => disposeOnClose.dispose());
writer.onClose(() => disposeOnClose.dispose());
return Object.assign({ reader,
return {
reader,
writer,

@@ -32,6 +29,8 @@ forward(to, map = (message) => message) {

onClose(callback) {
return disposeOnClose.push(vscode_jsonrpc_1.Disposable.create(callback));
}, dispose: () => onDispose() }, extensions);
return disposeOnClose.push(Disposable.create(callback));
},
dispose: () => onDispose(),
...extensions
};
}
exports.createConnection = createConnection;
//# sourceMappingURL=connection.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,6 +5,4 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./connection"), exports);
tslib_1.__exportStar(require("./launch"), exports);
export * from './connection';
export * from './launch';
//# sourceMappingURL=index.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,10 +5,7 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.createStreamConnection = exports.createProcessStreamConnection = exports.createSocketConnection = exports.createProcessSocketConnection = exports.createWebSocketConnection = exports.createServerProcess = void 0;
const tslib_1 = require("tslib");
const cp = tslib_1.__importStar(require("child_process"));
const node_1 = require("vscode-jsonrpc/node");
const connection_1 = require("./connection");
const socket_1 = require("../socket");
function createServerProcess(serverName, command, args, options) {
import * as cp from 'child_process';
import { StreamMessageReader, StreamMessageWriter, SocketMessageReader, SocketMessageWriter } from 'vscode-jsonrpc/node';
import { createConnection } from './connection';
import { WebSocketMessageReader, WebSocketMessageWriter } from '../socket';
export function createServerProcess(serverName, command, args, options) {
const serverProcess = cp.spawn(command, args || [], options || {});

@@ -22,20 +18,16 @@ serverProcess.on('error', error => console.error(`Launching ${serverName} Server failed: ${error}`));

}
exports.createServerProcess = createServerProcess;
function createWebSocketConnection(socket) {
const reader = new socket_1.WebSocketMessageReader(socket);
const writer = new socket_1.WebSocketMessageWriter(socket);
return (0, connection_1.createConnection)(reader, writer, () => socket.dispose(), { socket });
export function createWebSocketConnection(socket) {
const reader = new WebSocketMessageReader(socket);
const writer = new WebSocketMessageWriter(socket);
return createConnection(reader, writer, () => socket.dispose(), { socket });
}
exports.createWebSocketConnection = createWebSocketConnection;
function createProcessSocketConnection(process, outSocket, inSocket = outSocket) {
export function createProcessSocketConnection(process, outSocket, inSocket = outSocket) {
return createSocketConnection(outSocket, inSocket, () => process.kill());
}
exports.createProcessSocketConnection = createProcessSocketConnection;
function createSocketConnection(outSocket, inSocket, onDispose) {
const reader = new node_1.SocketMessageReader(outSocket);
const writer = new node_1.SocketMessageWriter(inSocket);
return (0, connection_1.createConnection)(reader, writer, onDispose);
export function createSocketConnection(outSocket, inSocket, onDispose) {
const reader = new SocketMessageReader(outSocket);
const writer = new SocketMessageWriter(inSocket);
return createConnection(reader, writer, onDispose);
}
exports.createSocketConnection = createSocketConnection;
function createProcessStreamConnection(process) {
export function createProcessStreamConnection(process) {
if (process.stdout !== null && process.stdin !== null) {

@@ -48,9 +40,7 @@ return createStreamConnection(process.stdout, process.stdin, () => process.kill());

}
exports.createProcessStreamConnection = createProcessStreamConnection;
function createStreamConnection(outStream, inStream, onDispose) {
const reader = new node_1.StreamMessageReader(outStream);
const writer = new node_1.StreamMessageWriter(inStream);
return (0, connection_1.createConnection)(reader, writer, onDispose);
export function createStreamConnection(outStream, inStream, onDispose) {
const reader = new StreamMessageReader(outStream);
const writer = new StreamMessageWriter(inStream);
return createConnection(reader, writer, onDispose);
}
exports.createStreamConnection = createStreamConnection;
//# sourceMappingURL=launch.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,15 +5,12 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.createWebSocketConnection = void 0;
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
const reader_1 = require("./reader");
const writer_1 = require("./writer");
function createWebSocketConnection(socket, logger) {
const messageReader = new reader_1.WebSocketMessageReader(socket);
const messageWriter = new writer_1.WebSocketMessageWriter(socket);
const connection = (0, vscode_jsonrpc_1.createMessageConnection)(messageReader, messageWriter, logger);
import { createMessageConnection } from 'vscode-jsonrpc';
import { WebSocketMessageReader } from './reader';
import { WebSocketMessageWriter } from './writer';
export function createWebSocketConnection(socket, logger) {
const messageReader = new WebSocketMessageReader(socket);
const messageWriter = new WebSocketMessageWriter(socket);
const connection = createMessageConnection(messageReader, messageWriter, logger);
connection.onClose(() => connection.dispose());
return connection;
}
exports.createWebSocketConnection = createWebSocketConnection;
//# sourceMappingURL=connection.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,8 +5,6 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./socket"), exports);
tslib_1.__exportStar(require("./reader"), exports);
tslib_1.__exportStar(require("./writer"), exports);
tslib_1.__exportStar(require("./connection"), exports);
export * from './socket';
export * from './reader';
export * from './writer';
export * from './connection';
//# sourceMappingURL=index.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,6 +5,4 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketMessageReader = void 0;
const messageReader_1 = require("vscode-jsonrpc/lib/common/messageReader");
class WebSocketMessageReader extends messageReader_1.AbstractMessageReader {
import { AbstractMessageReader } from 'vscode-jsonrpc/lib/common/messageReader';
export class WebSocketMessageReader extends AbstractMessageReader {
constructor(socket) {

@@ -81,3 +78,2 @@ super();

}
exports.WebSocketMessageReader = WebSocketMessageReader;
//# sourceMappingURL=reader.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,3 +5,3 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=socket.js.map

@@ -1,2 +0,1 @@

"use strict";
/* --------------------------------------------------------------------------------------------

@@ -6,6 +5,4 @@ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.

* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketMessageWriter = void 0;
const messageWriter_1 = require("vscode-jsonrpc/lib/common/messageWriter");
class WebSocketMessageWriter extends messageWriter_1.AbstractMessageWriter {
import { AbstractMessageWriter } from 'vscode-jsonrpc/lib/common/messageWriter';
export class WebSocketMessageWriter extends AbstractMessageWriter {
constructor(socket) {

@@ -29,3 +26,2 @@ super();

}
exports.WebSocketMessageWriter = WebSocketMessageWriter;
//# sourceMappingURL=writer.js.map
{
"name": "vscode-ws-jsonrpc",
"version": "1.0.0",
"version": "1.0.1-dev.0",
"description": "VSCode JSON RPC over WebSocket",

@@ -15,4 +15,32 @@ "author": "TypeFox GmbH (http://www.typefox.io)",

"main": "./lib/index.js",
"module": "./lib/index.js",
"types": "./lib/index.d.ts",
"exports": {
".": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"./cjs": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"./server": {
"types": "./lib/server/index.d.ts",
"default": "./lib/server/index.js"
},
"./server/cjs": {
"types": "./dist/cjs/server/index.d.ts",
"default": "./dist/cjs/server/index.js"
},
"./socket": {
"types": "./lib/socket/index.d.ts",
"default": "./lib/socket/index.js"
},
"./socket/cjs": {
"types": "./dist/cjs/socket/index.d.ts",
"default": "./dist/cjs/socket/index.js"
}
},
"files": [
"dist/cjs",
"lib",

@@ -32,8 +60,10 @@ "src",

"clean": "npx shx rm -fr lib tsconfig.tsbuildinfo",
"clean:cjs": "npx shx rm -fr dist/cjs dist/tsconfig.tsbuildinfo",
"lint": "eslint src --ext .ts",
"compile": "tsc",
"watch": "tsc -w",
"build": "npm run clean && npm run compile"
"build:cjs": "npm run clean:cjs && tsc --outDir dist/cjs --module commonjs --declarationDir dist/cjs --declaration",
"build": "npm run clean && npm run compile && npm run build:cjs"
},
"homepage": "https://github.com/TypeFox/vscode-ws-jsonrpc/blob/main/packages/vscode-ws-jsonrpc/README.md",
"homepage": "https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/README.md",
"directories": {

@@ -40,0 +70,0 @@ "lib": "lib"

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

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