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

vscode-jsonrpc

Package Overview
Dependencies
Maintainers
11
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-jsonrpc - npm Package Compare versions

Comparing version 3.6.2 to 3.7.0-next.1

2

lib/events.d.ts

@@ -31,3 +31,3 @@ export interface Disposable {

export declare class Emitter<T> {
private _options;
private _options?;
private static _noop;

@@ -34,0 +34,0 @@ private _event;

@@ -25,6 +25,6 @@ export declare namespace Touch {

keys(): K[];
private addItemFirst(item);
private addItemLast(item);
private removeItem(item);
private touch(item, touch);
private addItemFirst;
private addItemLast;
private removeItem;
private touch;
}

@@ -101,3 +101,3 @@ /// <reference path="thenable.d.ts" />

Messages = 1,
Verbose = 2,
Verbose = 2
}

@@ -109,2 +109,13 @@ export declare type TraceValues = 'off' | 'messages' | 'verbose';

}
export declare enum TraceFormat {
Text = "text",
JSON = "json"
}
export declare namespace TraceFormat {
function fromString(value: string): TraceFormat;
}
export interface TraceOptions {
sendNotification?: boolean;
traceFormat?: TraceFormat;
}
export interface SetTraceParams {

@@ -124,2 +135,3 @@ value: TraceValues;

export interface Tracer {
log(dataObject: any): void;
log(message: string, data?: string): void;

@@ -139,3 +151,3 @@ }

*/
AlreadyListening = 3,
AlreadyListening = 3
}

@@ -205,2 +217,3 @@ export declare class ConnectionError extends Error {

trace(value: Trace, tracer: Tracer, sendNotification?: boolean): void;
trace(value: Trace, tracer: Tracer, traceOptions?: TraceOptions): void;
onError: Event<[Error, Message | undefined, number | undefined]>;

@@ -207,0 +220,0 @@ onClose: Event<void>;

@@ -112,2 +112,19 @@ /* --------------------------------------------------------------------------------------------

})(Trace = exports.Trace || (exports.Trace = {}));
var TraceFormat;
(function (TraceFormat) {
TraceFormat["Text"] = "text";
TraceFormat["JSON"] = "json";
})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
(function (TraceFormat) {
function fromString(value) {
value = value.toLowerCase();
if (value === 'json') {
return TraceFormat.JSON;
}
else {
return TraceFormat.Text;
}
}
TraceFormat.fromString = fromString;
})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
var SetTraceNotification;

@@ -176,2 +193,3 @@ (function (SetTraceNotification) {

var trace = Trace.Off;
var traceFormat = TraceFormat.Text;
var tracer;

@@ -521,22 +539,32 @@ var state = ConnectionState.New;

}
var data = undefined;
if (trace === Trace.Verbose && message.params) {
data = "Params: " + JSON.stringify(message.params, null, 4) + "\n\n";
if (traceFormat === TraceFormat.Text) {
var data = undefined;
if (trace === Trace.Verbose && message.params) {
data = "Params: " + JSON.stringify(message.params, null, 4) + "\n\n";
}
tracer.log("Sending request '" + message.method + " - (" + message.id + ")'.", data);
}
tracer.log("Sending request '" + message.method + " - (" + message.id + ")'.", data);
else {
logLSPMessage('send-request', message);
}
}
function traceSendNotification(message) {
function traceSendingNotification(message) {
if (trace === Trace.Off || !tracer) {
return;
}
var data = undefined;
if (trace === Trace.Verbose) {
if (message.params) {
data = "Params: " + JSON.stringify(message.params, null, 4) + "\n\n";
if (traceFormat === TraceFormat.Text) {
var data = undefined;
if (trace === Trace.Verbose) {
if (message.params) {
data = "Params: " + JSON.stringify(message.params, null, 4) + "\n\n";
}
else {
data = 'No parameters provided.\n\n';
}
}
else {
data = 'No parameters provided.\n\n';
}
tracer.log("Sending notification '" + message.method + "'.", data);
}
tracer.log("Sending notification '" + message.method + "'.", data);
else {
logLSPMessage('send-notification', message);
}
}

@@ -547,17 +575,22 @@ function traceSendingResponse(message, method, startTime) {

}
var data = undefined;
if (trace === Trace.Verbose) {
if (message.error && message.error.data) {
data = "Error data: " + JSON.stringify(message.error.data, null, 4) + "\n\n";
}
else {
if (message.result) {
data = "Result: " + JSON.stringify(message.result, null, 4) + "\n\n";
if (traceFormat === TraceFormat.Text) {
var data = undefined;
if (trace === Trace.Verbose) {
if (message.error && message.error.data) {
data = "Error data: " + JSON.stringify(message.error.data, null, 4) + "\n\n";
}
else if (message.error === void 0) {
data = 'No result returned.\n\n';
else {
if (message.result) {
data = "Result: " + JSON.stringify(message.result, null, 4) + "\n\n";
}
else if (message.error === void 0) {
data = 'No result returned.\n\n';
}
}
}
tracer.log("Sending response '" + method + " - (" + message.id + ")'. Processing request took " + (Date.now() - startTime) + "ms", data);
}
tracer.log("Sending response '" + method + " - (" + message.id + ")'. Processing request took " + (Date.now() - startTime) + "ms", data);
else {
logLSPMessage('send-response', message);
}
}

@@ -568,7 +601,12 @@ function traceReceivedRequest(message) {

}
var data = undefined;
if (trace === Trace.Verbose && message.params) {
data = "Params: " + JSON.stringify(message.params, null, 4) + "\n\n";
if (traceFormat === TraceFormat.Text) {
var data = undefined;
if (trace === Trace.Verbose && message.params) {
data = "Params: " + JSON.stringify(message.params, null, 4) + "\n\n";
}
tracer.log("Received request '" + message.method + " - (" + message.id + ")'.", data);
}
tracer.log("Received request '" + message.method + " - (" + message.id + ")'.", data);
else {
logLSPMessage('receive-request', message);
}
}

@@ -579,12 +617,17 @@ function traceReceivedNotification(message) {

}
var data = undefined;
if (trace === Trace.Verbose) {
if (message.params) {
data = "Params: " + JSON.stringify(message.params, null, 4) + "\n\n";
if (traceFormat === TraceFormat.Text) {
var data = undefined;
if (trace === Trace.Verbose) {
if (message.params) {
data = "Params: " + JSON.stringify(message.params, null, 4) + "\n\n";
}
else {
data = 'No parameters provided.\n\n';
}
}
else {
data = 'No parameters provided.\n\n';
}
tracer.log("Received notification '" + message.method + "'.", data);
}
tracer.log("Received notification '" + message.method + "'.", data);
else {
logLSPMessage('receive-notification', message);
}
}

@@ -595,24 +638,41 @@ function traceReceivedResponse(message, responsePromise) {

}
var data = undefined;
if (trace === Trace.Verbose) {
if (message.error && message.error.data) {
data = "Error data: " + JSON.stringify(message.error.data, null, 4) + "\n\n";
}
else {
if (message.result) {
data = "Result: " + JSON.stringify(message.result, null, 4) + "\n\n";
if (traceFormat === TraceFormat.Text) {
var data = undefined;
if (trace === Trace.Verbose) {
if (message.error && message.error.data) {
data = "Error data: " + JSON.stringify(message.error.data, null, 4) + "\n\n";
}
else if (message.error === void 0) {
data = 'No result returned.\n\n';
else {
if (message.result) {
data = "Result: " + JSON.stringify(message.result, null, 4) + "\n\n";
}
else if (message.error === void 0) {
data = 'No result returned.\n\n';
}
}
}
if (responsePromise) {
var error = message.error ? " Request failed: " + message.error.message + " (" + message.error.code + ")." : '';
tracer.log("Received response '" + responsePromise.method + " - (" + message.id + ")' in " + (Date.now() - responsePromise.timerStart) + "ms." + error, data);
}
else {
tracer.log("Received response " + message.id + " without active response promise.", data);
}
}
if (responsePromise) {
var error = message.error ? " Request failed: " + message.error.message + " (" + message.error.code + ")." : '';
tracer.log("Received response '" + responsePromise.method + " - (" + message.id + ")' in " + (Date.now() - responsePromise.timerStart) + "ms." + error, data);
}
else {
tracer.log("Received response " + message.id + " without active response promise.", data);
logLSPMessage('receive-response', message);
}
}
function logLSPMessage(type, message) {
if (!tracer || trace === Trace.Off) {
return;
}
var lspMessage = {
isLSPMessage: true,
type: type,
message: message,
timestamp: Date.now()
};
tracer.log(lspMessage);
}
function throwIfClosedOrDisposed() {

@@ -700,3 +760,3 @@ if (isClosed()) {

};
traceSendNotification(notificationMessage);
traceSendingNotification(notificationMessage);
messageWriter.write(notificationMessage);

@@ -810,5 +870,16 @@ },

},
trace: function (_value, _tracer, sendNotification) {
if (sendNotification === void 0) { sendNotification = false; }
trace: function (_value, _tracer, sendNotificationOrTraceOptions) {
var _sendNotification = false;
var _traceFormat = TraceFormat.Text;
if (sendNotificationOrTraceOptions !== void 0) {
if (Is.boolean(sendNotificationOrTraceOptions)) {
_sendNotification = sendNotificationOrTraceOptions;
}
else {
_sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
_traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
}
}
trace = _value;
traceFormat = _traceFormat;
if (trace === Trace.Off) {

@@ -820,3 +891,3 @@ tracer = undefined;

}
if (sendNotification && !isClosed() && !isDisposed()) {
if (_sendNotification && !isClosed() && !isDisposed()) {
connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });

@@ -823,0 +894,0 @@ }

@@ -35,3 +35,3 @@ /// <reference types="node" />

protected firePartialMessage(info: PartialMessageInfo): void;
private asError(error);
private asError;
}

@@ -49,5 +49,5 @@ export declare class StreamMessageReader extends AbstractMessageReader implements MessageReader {

listen(callback: DataCallback): void;
private onData(data);
private clearPartialMessageTimer();
private setPartialMessageTimer();
private onData;
private clearPartialMessageTimer;
private setPartialMessageTimer;
}

@@ -54,0 +54,0 @@ export declare class IPCMessageReader extends AbstractMessageReader implements MessageReader {

@@ -85,2 +85,11 @@ /**

/**
* A LSP Log Entry.
*/
export declare type LSPMessageType = 'send-request' | 'receive-request' | 'send-response' | 'receive-response' | 'send-notification' | 'receive-notification';
export interface LSPLogMessage {
type: LSPMessageType;
message: RequestMessage | ResponseMessage | NotificationMessage;
timestamp: number;
}
/**
* An interface to type messages.

@@ -87,0 +96,0 @@ */

@@ -24,3 +24,3 @@ /// <reference types="node" />

protected fireClose(): void;
private asError(error);
private asError;
}

@@ -52,3 +52,3 @@ export declare class StreamMessageWriter extends AbstractMessageWriter implements MessageWriter {

doWriteMessage(msg: Message): void;
private handleError(error, msg);
private handleError;
}

@@ -0,0 +0,0 @@ Copyright (c) Microsoft Corporation

{
"name": "vscode-jsonrpc",
"description": "A json rpc implementation over streams",
"version": "3.6.2",
"version": "3.7.0-next.1",
"author": "Microsoft Corporation",

@@ -20,8 +20,10 @@ "license": "MIT",

"scripts": {
"prepublishOnly": "npm run compile && npm test",
"prepublishOnly": "npm run clean && npm run compile && npm test",
"postpublish": "node ../build/npm/post-publish.js",
"compile": "node ../build/bin/tsc -p ./tsconfig.json",
"watch": "node ../build/bin/tsc -w -p ./tsconfig.json",
"test": "node ../node_modules/mocha/bin/_mocha"
"test": "node ../node_modules/mocha/bin/_mocha",
"clean": "node ../node_modules/rimraf/bin.js lib",
"preversion": "npm test"
}
}

@@ -0,0 +0,0 @@ # VSCode JSON RPC

@@ -0,0 +0,0 @@ THIRD-PARTY SOFTWARE NOTICES AND INFORMATION

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