完成世界书、骰子、apiconfig页面处理
This commit is contained in:
17
frontend/node_modules/vscode-jsonrpc/lib/browser/main.d.ts
generated
vendored
Normal file
17
frontend/node_modules/vscode-jsonrpc/lib/browser/main.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { AbstractMessageReader, DataCallback, AbstractMessageWriter, Message, Disposable, ConnectionStrategy, ConnectionOptions, MessageReader, MessageWriter, Logger, MessageConnection } from '../common/api';
|
||||
export * from '../common/api';
|
||||
export declare class BrowserMessageReader extends AbstractMessageReader implements MessageReader {
|
||||
private _onData;
|
||||
private _messageListener;
|
||||
constructor(port: MessagePort | Worker | DedicatedWorkerGlobalScope);
|
||||
listen(callback: DataCallback): Disposable;
|
||||
}
|
||||
export declare class BrowserMessageWriter extends AbstractMessageWriter implements MessageWriter {
|
||||
private port;
|
||||
private errorCount;
|
||||
constructor(port: MessagePort | Worker | DedicatedWorkerGlobalScope);
|
||||
write(msg: Message): Promise<void>;
|
||||
private handleError;
|
||||
end(): void;
|
||||
}
|
||||
export declare function createMessageConnection(reader: MessageReader, writer: MessageWriter, logger?: Logger, options?: ConnectionStrategy | ConnectionOptions): MessageConnection;
|
||||
81
frontend/node_modules/vscode-jsonrpc/lib/common/api.js
generated
vendored
Normal file
81
frontend/node_modules/vscode-jsonrpc/lib/common/api.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
/// <reference path="../../typings/thenable.d.ts" />
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ProgressType = exports.ProgressToken = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.AbstractMessageBuffer = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.LRUCache = exports.Touch = exports.LinkedMap = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.Message = exports.RAL = void 0;
|
||||
exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = void 0;
|
||||
const messages_1 = require("./messages");
|
||||
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return messages_1.Message; } });
|
||||
Object.defineProperty(exports, "RequestType", { enumerable: true, get: function () { return messages_1.RequestType; } });
|
||||
Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function () { return messages_1.RequestType0; } });
|
||||
Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function () { return messages_1.RequestType1; } });
|
||||
Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function () { return messages_1.RequestType2; } });
|
||||
Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function () { return messages_1.RequestType3; } });
|
||||
Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function () { return messages_1.RequestType4; } });
|
||||
Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function () { return messages_1.RequestType5; } });
|
||||
Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function () { return messages_1.RequestType6; } });
|
||||
Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function () { return messages_1.RequestType7; } });
|
||||
Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function () { return messages_1.RequestType8; } });
|
||||
Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function () { return messages_1.RequestType9; } });
|
||||
Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function () { return messages_1.ResponseError; } });
|
||||
Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function () { return messages_1.ErrorCodes; } });
|
||||
Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function () { return messages_1.NotificationType; } });
|
||||
Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function () { return messages_1.NotificationType0; } });
|
||||
Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function () { return messages_1.NotificationType1; } });
|
||||
Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function () { return messages_1.NotificationType2; } });
|
||||
Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function () { return messages_1.NotificationType3; } });
|
||||
Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function () { return messages_1.NotificationType4; } });
|
||||
Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function () { return messages_1.NotificationType5; } });
|
||||
Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function () { return messages_1.NotificationType6; } });
|
||||
Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function () { return messages_1.NotificationType7; } });
|
||||
Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function () { return messages_1.NotificationType8; } });
|
||||
Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function () { return messages_1.NotificationType9; } });
|
||||
Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function () { return messages_1.ParameterStructures; } });
|
||||
const linkedMap_1 = require("./linkedMap");
|
||||
Object.defineProperty(exports, "LinkedMap", { enumerable: true, get: function () { return linkedMap_1.LinkedMap; } });
|
||||
Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function () { return linkedMap_1.LRUCache; } });
|
||||
Object.defineProperty(exports, "Touch", { enumerable: true, get: function () { return linkedMap_1.Touch; } });
|
||||
const disposable_1 = require("./disposable");
|
||||
Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return disposable_1.Disposable; } });
|
||||
const events_1 = require("./events");
|
||||
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return events_1.Event; } });
|
||||
Object.defineProperty(exports, "Emitter", { enumerable: true, get: function () { return events_1.Emitter; } });
|
||||
const cancellation_1 = require("./cancellation");
|
||||
Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function () { return cancellation_1.CancellationTokenSource; } });
|
||||
Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return cancellation_1.CancellationToken; } });
|
||||
const sharedArrayCancellation_1 = require("./sharedArrayCancellation");
|
||||
Object.defineProperty(exports, "SharedArraySenderStrategy", { enumerable: true, get: function () { return sharedArrayCancellation_1.SharedArraySenderStrategy; } });
|
||||
Object.defineProperty(exports, "SharedArrayReceiverStrategy", { enumerable: true, get: function () { return sharedArrayCancellation_1.SharedArrayReceiverStrategy; } });
|
||||
const messageReader_1 = require("./messageReader");
|
||||
Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function () { return messageReader_1.MessageReader; } });
|
||||
Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function () { return messageReader_1.AbstractMessageReader; } });
|
||||
Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function () { return messageReader_1.ReadableStreamMessageReader; } });
|
||||
const messageWriter_1 = require("./messageWriter");
|
||||
Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function () { return messageWriter_1.MessageWriter; } });
|
||||
Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function () { return messageWriter_1.AbstractMessageWriter; } });
|
||||
Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function () { return messageWriter_1.WriteableStreamMessageWriter; } });
|
||||
const messageBuffer_1 = require("./messageBuffer");
|
||||
Object.defineProperty(exports, "AbstractMessageBuffer", { enumerable: true, get: function () { return messageBuffer_1.AbstractMessageBuffer; } });
|
||||
const connection_1 = require("./connection");
|
||||
Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function () { return connection_1.ConnectionStrategy; } });
|
||||
Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function () { return connection_1.ConnectionOptions; } });
|
||||
Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function () { return connection_1.NullLogger; } });
|
||||
Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function () { return connection_1.createMessageConnection; } });
|
||||
Object.defineProperty(exports, "ProgressToken", { enumerable: true, get: function () { return connection_1.ProgressToken; } });
|
||||
Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function () { return connection_1.ProgressType; } });
|
||||
Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return connection_1.Trace; } });
|
||||
Object.defineProperty(exports, "TraceValues", { enumerable: true, get: function () { return connection_1.TraceValues; } });
|
||||
Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function () { return connection_1.TraceFormat; } });
|
||||
Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function () { return connection_1.SetTraceNotification; } });
|
||||
Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function () { return connection_1.LogTraceNotification; } });
|
||||
Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function () { return connection_1.ConnectionErrors; } });
|
||||
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return connection_1.ConnectionError; } });
|
||||
Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function () { return connection_1.CancellationReceiverStrategy; } });
|
||||
Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function () { return connection_1.CancellationSenderStrategy; } });
|
||||
Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function () { return connection_1.CancellationStrategy; } });
|
||||
Object.defineProperty(exports, "MessageStrategy", { enumerable: true, get: function () { return connection_1.MessageStrategy; } });
|
||||
const ral_1 = require("./ral");
|
||||
exports.RAL = ral_1.default;
|
||||
32
frontend/node_modules/vscode-jsonrpc/lib/common/cancellation.d.ts
generated
vendored
Normal file
32
frontend/node_modules/vscode-jsonrpc/lib/common/cancellation.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Event } from './events';
|
||||
import { Disposable } from './disposable';
|
||||
/**
|
||||
* Defines a CancellationToken. This interface is not
|
||||
* intended to be implemented. A CancellationToken must
|
||||
* be created via a CancellationTokenSource.
|
||||
*/
|
||||
export interface CancellationToken {
|
||||
/**
|
||||
* Is `true` when the token has been cancelled, `false` otherwise.
|
||||
*/
|
||||
readonly isCancellationRequested: boolean;
|
||||
/**
|
||||
* An {@link Event event} which fires upon cancellation.
|
||||
*/
|
||||
readonly onCancellationRequested: Event<any>;
|
||||
}
|
||||
export declare namespace CancellationToken {
|
||||
const None: CancellationToken;
|
||||
const Cancelled: CancellationToken;
|
||||
function is(value: any): value is CancellationToken;
|
||||
}
|
||||
export interface AbstractCancellationTokenSource extends Disposable {
|
||||
token: CancellationToken;
|
||||
cancel(): void;
|
||||
}
|
||||
export declare class CancellationTokenSource implements AbstractCancellationTokenSource {
|
||||
private _token;
|
||||
get token(): CancellationToken;
|
||||
cancel(): void;
|
||||
dispose(): void;
|
||||
}
|
||||
1212
frontend/node_modules/vscode-jsonrpc/lib/common/connection.js
generated
vendored
Normal file
1212
frontend/node_modules/vscode-jsonrpc/lib/common/connection.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
frontend/node_modules/vscode-jsonrpc/lib/common/is.d.ts
generated
vendored
Normal file
7
frontend/node_modules/vscode-jsonrpc/lib/common/is.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export declare function boolean(value: any): value is boolean;
|
||||
export declare function string(value: any): value is string;
|
||||
export declare function number(value: any): value is number;
|
||||
export declare function error(value: any): value is Error;
|
||||
export declare function func(value: any): value is Function;
|
||||
export declare function array<T>(value: any): value is T[];
|
||||
export declare function stringArray(value: any): value is string[];
|
||||
35
frontend/node_modules/vscode-jsonrpc/lib/common/is.js
generated
vendored
Normal file
35
frontend/node_modules/vscode-jsonrpc/lib/common/is.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
|
||||
function boolean(value) {
|
||||
return value === true || value === false;
|
||||
}
|
||||
exports.boolean = boolean;
|
||||
function string(value) {
|
||||
return typeof value === 'string' || value instanceof String;
|
||||
}
|
||||
exports.string = string;
|
||||
function number(value) {
|
||||
return typeof value === 'number' || value instanceof Number;
|
||||
}
|
||||
exports.number = number;
|
||||
function error(value) {
|
||||
return value instanceof Error;
|
||||
}
|
||||
exports.error = error;
|
||||
function func(value) {
|
||||
return typeof value === 'function';
|
||||
}
|
||||
exports.func = func;
|
||||
function array(value) {
|
||||
return Array.isArray(value);
|
||||
}
|
||||
exports.array = array;
|
||||
function stringArray(value) {
|
||||
return array(value) && value.every(elem => string(elem));
|
||||
}
|
||||
exports.stringArray = stringArray;
|
||||
53
frontend/node_modules/vscode-jsonrpc/lib/common/linkedMap.d.ts
generated
vendored
Normal file
53
frontend/node_modules/vscode-jsonrpc/lib/common/linkedMap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
export declare namespace Touch {
|
||||
const None: 0;
|
||||
const First: 1;
|
||||
const AsOld: 1;
|
||||
const Last: 2;
|
||||
const AsNew: 2;
|
||||
}
|
||||
export type Touch = 0 | 1 | 2;
|
||||
export declare class LinkedMap<K, V> implements Map<K, V> {
|
||||
readonly [Symbol.toStringTag] = "LinkedMap";
|
||||
private _map;
|
||||
private _head;
|
||||
private _tail;
|
||||
private _size;
|
||||
private _state;
|
||||
constructor();
|
||||
clear(): void;
|
||||
isEmpty(): boolean;
|
||||
get size(): number;
|
||||
get first(): V | undefined;
|
||||
get last(): V | undefined;
|
||||
has(key: K): boolean;
|
||||
get(key: K, touch?: Touch): V | undefined;
|
||||
set(key: K, value: V, touch?: Touch): this;
|
||||
delete(key: K): boolean;
|
||||
remove(key: K): V | undefined;
|
||||
shift(): V | undefined;
|
||||
forEach(callbackfn: (value: V, key: K, map: LinkedMap<K, V>) => void, thisArg?: any): void;
|
||||
keys(): IterableIterator<K>;
|
||||
values(): IterableIterator<V>;
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
protected trimOld(newSize: number): void;
|
||||
private addItemFirst;
|
||||
private addItemLast;
|
||||
private removeItem;
|
||||
private touch;
|
||||
toJSON(): [K, V][];
|
||||
fromJSON(data: [K, V][]): void;
|
||||
}
|
||||
export declare class LRUCache<K, V> extends LinkedMap<K, V> {
|
||||
private _limit;
|
||||
private _ratio;
|
||||
constructor(limit: number, ratio?: number);
|
||||
get limit(): number;
|
||||
set limit(limit: number);
|
||||
get ratio(): number;
|
||||
set ratio(ratio: number);
|
||||
get(key: K, touch?: Touch): V | undefined;
|
||||
peek(key: K): V | undefined;
|
||||
set(key: K, value: V): this;
|
||||
private checkTrim;
|
||||
}
|
||||
77
frontend/node_modules/vscode-jsonrpc/lib/common/messageReader.d.ts
generated
vendored
Normal file
77
frontend/node_modules/vscode-jsonrpc/lib/common/messageReader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
import RAL from './ral';
|
||||
import { Event } from './events';
|
||||
import { Message } from './messages';
|
||||
import { ContentDecoder, ContentTypeDecoder } from './encoding';
|
||||
import { Disposable } from './api';
|
||||
/**
|
||||
* A callback that receives each incoming JSON-RPC message.
|
||||
*/
|
||||
export interface DataCallback {
|
||||
(data: Message): void;
|
||||
}
|
||||
export interface PartialMessageInfo {
|
||||
readonly messageToken: number;
|
||||
readonly waitingTime: number;
|
||||
}
|
||||
/** Reads JSON-RPC messages from some underlying transport. */
|
||||
export interface MessageReader {
|
||||
/** Raised whenever an error occurs while reading a message. */
|
||||
readonly onError: Event<Error>;
|
||||
/** An event raised when the end of the underlying transport has been reached. */
|
||||
readonly onClose: Event<void>;
|
||||
/**
|
||||
* An event that *may* be raised to inform the owner that only part of a message has been received.
|
||||
* A MessageReader implementation may choose to raise this event after a timeout elapses while waiting for more of a partially received message to be received.
|
||||
*/
|
||||
readonly onPartialMessage: Event<PartialMessageInfo>;
|
||||
/**
|
||||
* Begins listening for incoming messages. To be called at most once.
|
||||
* @param callback A callback for receiving decoded messages.
|
||||
*/
|
||||
listen(callback: DataCallback): Disposable;
|
||||
/** Releases resources incurred from reading or raising events. Does NOT close the underlying transport, if any. */
|
||||
dispose(): void;
|
||||
}
|
||||
export declare namespace MessageReader {
|
||||
function is(value: any): value is MessageReader;
|
||||
}
|
||||
export declare abstract class AbstractMessageReader implements MessageReader {
|
||||
private errorEmitter;
|
||||
private closeEmitter;
|
||||
private partialMessageEmitter;
|
||||
constructor();
|
||||
dispose(): void;
|
||||
get onError(): Event<Error>;
|
||||
protected fireError(error: any): void;
|
||||
get onClose(): Event<void>;
|
||||
protected fireClose(): void;
|
||||
get onPartialMessage(): Event<PartialMessageInfo>;
|
||||
protected firePartialMessage(info: PartialMessageInfo): void;
|
||||
private asError;
|
||||
abstract listen(callback: DataCallback): Disposable;
|
||||
}
|
||||
export interface MessageReaderOptions {
|
||||
charset?: RAL.MessageBufferEncoding;
|
||||
contentDecoder?: ContentDecoder;
|
||||
contentDecoders?: ContentDecoder[];
|
||||
contentTypeDecoder?: ContentTypeDecoder;
|
||||
contentTypeDecoders?: ContentTypeDecoder[];
|
||||
}
|
||||
export declare class ReadableStreamMessageReader extends AbstractMessageReader {
|
||||
private readable;
|
||||
private options;
|
||||
private callback;
|
||||
private nextMessageLength;
|
||||
private messageToken;
|
||||
private buffer;
|
||||
private partialMessageTimer;
|
||||
private _partialMessageTimeout;
|
||||
private readSemaphore;
|
||||
constructor(readable: RAL.ReadableStream, options?: RAL.MessageBufferEncoding | MessageReaderOptions);
|
||||
set partialMessageTimeout(timeout: number);
|
||||
get partialMessageTimeout(): number;
|
||||
listen(callback: DataCallback): Disposable;
|
||||
private onData;
|
||||
private clearPartialMessageTimer;
|
||||
private setPartialMessageTimer;
|
||||
}
|
||||
197
frontend/node_modules/vscode-jsonrpc/lib/common/messageReader.js
generated
vendored
Normal file
197
frontend/node_modules/vscode-jsonrpc/lib/common/messageReader.js
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0;
|
||||
const ral_1 = require("./ral");
|
||||
const Is = require("./is");
|
||||
const events_1 = require("./events");
|
||||
const semaphore_1 = require("./semaphore");
|
||||
var MessageReader;
|
||||
(function (MessageReader) {
|
||||
function is(value) {
|
||||
let candidate = value;
|
||||
return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
|
||||
Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
|
||||
}
|
||||
MessageReader.is = is;
|
||||
})(MessageReader || (exports.MessageReader = MessageReader = {}));
|
||||
class AbstractMessageReader {
|
||||
constructor() {
|
||||
this.errorEmitter = new events_1.Emitter();
|
||||
this.closeEmitter = new events_1.Emitter();
|
||||
this.partialMessageEmitter = new events_1.Emitter();
|
||||
}
|
||||
dispose() {
|
||||
this.errorEmitter.dispose();
|
||||
this.closeEmitter.dispose();
|
||||
}
|
||||
get onError() {
|
||||
return this.errorEmitter.event;
|
||||
}
|
||||
fireError(error) {
|
||||
this.errorEmitter.fire(this.asError(error));
|
||||
}
|
||||
get onClose() {
|
||||
return this.closeEmitter.event;
|
||||
}
|
||||
fireClose() {
|
||||
this.closeEmitter.fire(undefined);
|
||||
}
|
||||
get onPartialMessage() {
|
||||
return this.partialMessageEmitter.event;
|
||||
}
|
||||
firePartialMessage(info) {
|
||||
this.partialMessageEmitter.fire(info);
|
||||
}
|
||||
asError(error) {
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
else {
|
||||
return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.AbstractMessageReader = AbstractMessageReader;
|
||||
var ResolvedMessageReaderOptions;
|
||||
(function (ResolvedMessageReaderOptions) {
|
||||
function fromOptions(options) {
|
||||
let charset;
|
||||
let result;
|
||||
let contentDecoder;
|
||||
const contentDecoders = new Map();
|
||||
let contentTypeDecoder;
|
||||
const contentTypeDecoders = new Map();
|
||||
if (options === undefined || typeof options === 'string') {
|
||||
charset = options ?? 'utf-8';
|
||||
}
|
||||
else {
|
||||
charset = options.charset ?? 'utf-8';
|
||||
if (options.contentDecoder !== undefined) {
|
||||
contentDecoder = options.contentDecoder;
|
||||
contentDecoders.set(contentDecoder.name, contentDecoder);
|
||||
}
|
||||
if (options.contentDecoders !== undefined) {
|
||||
for (const decoder of options.contentDecoders) {
|
||||
contentDecoders.set(decoder.name, decoder);
|
||||
}
|
||||
}
|
||||
if (options.contentTypeDecoder !== undefined) {
|
||||
contentTypeDecoder = options.contentTypeDecoder;
|
||||
contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
|
||||
}
|
||||
if (options.contentTypeDecoders !== undefined) {
|
||||
for (const decoder of options.contentTypeDecoders) {
|
||||
contentTypeDecoders.set(decoder.name, decoder);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (contentTypeDecoder === undefined) {
|
||||
contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder;
|
||||
contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
|
||||
}
|
||||
return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };
|
||||
}
|
||||
ResolvedMessageReaderOptions.fromOptions = fromOptions;
|
||||
})(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
|
||||
class ReadableStreamMessageReader extends AbstractMessageReader {
|
||||
constructor(readable, options) {
|
||||
super();
|
||||
this.readable = readable;
|
||||
this.options = ResolvedMessageReaderOptions.fromOptions(options);
|
||||
this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset);
|
||||
this._partialMessageTimeout = 10000;
|
||||
this.nextMessageLength = -1;
|
||||
this.messageToken = 0;
|
||||
this.readSemaphore = new semaphore_1.Semaphore(1);
|
||||
}
|
||||
set partialMessageTimeout(timeout) {
|
||||
this._partialMessageTimeout = timeout;
|
||||
}
|
||||
get partialMessageTimeout() {
|
||||
return this._partialMessageTimeout;
|
||||
}
|
||||
listen(callback) {
|
||||
this.nextMessageLength = -1;
|
||||
this.messageToken = 0;
|
||||
this.partialMessageTimer = undefined;
|
||||
this.callback = callback;
|
||||
const result = this.readable.onData((data) => {
|
||||
this.onData(data);
|
||||
});
|
||||
this.readable.onError((error) => this.fireError(error));
|
||||
this.readable.onClose(() => this.fireClose());
|
||||
return result;
|
||||
}
|
||||
onData(data) {
|
||||
try {
|
||||
this.buffer.append(data);
|
||||
while (true) {
|
||||
if (this.nextMessageLength === -1) {
|
||||
const headers = this.buffer.tryReadHeaders(true);
|
||||
if (!headers) {
|
||||
return;
|
||||
}
|
||||
const contentLength = headers.get('content-length');
|
||||
if (!contentLength) {
|
||||
this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(headers))}`));
|
||||
return;
|
||||
}
|
||||
const length = parseInt(contentLength);
|
||||
if (isNaN(length)) {
|
||||
this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`));
|
||||
return;
|
||||
}
|
||||
this.nextMessageLength = length;
|
||||
}
|
||||
const body = this.buffer.tryReadBody(this.nextMessageLength);
|
||||
if (body === undefined) {
|
||||
/** We haven't received the full message yet. */
|
||||
this.setPartialMessageTimer();
|
||||
return;
|
||||
}
|
||||
this.clearPartialMessageTimer();
|
||||
this.nextMessageLength = -1;
|
||||
// Make sure that we convert one received message after the
|
||||
// other. Otherwise it could happen that a decoding of a second
|
||||
// smaller message finished before the decoding of a first larger
|
||||
// message and then we would deliver the second message first.
|
||||
this.readSemaphore.lock(async () => {
|
||||
const bytes = this.options.contentDecoder !== undefined
|
||||
? await this.options.contentDecoder.decode(body)
|
||||
: body;
|
||||
const message = await this.options.contentTypeDecoder.decode(bytes, this.options);
|
||||
this.callback(message);
|
||||
}).catch((error) => {
|
||||
this.fireError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
this.fireError(error);
|
||||
}
|
||||
}
|
||||
clearPartialMessageTimer() {
|
||||
if (this.partialMessageTimer) {
|
||||
this.partialMessageTimer.dispose();
|
||||
this.partialMessageTimer = undefined;
|
||||
}
|
||||
}
|
||||
setPartialMessageTimer() {
|
||||
this.clearPartialMessageTimer();
|
||||
if (this._partialMessageTimeout <= 0) {
|
||||
return;
|
||||
}
|
||||
this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token, timeout) => {
|
||||
this.partialMessageTimer = undefined;
|
||||
if (token === this.messageToken) {
|
||||
this.firePartialMessage({ messageToken: token, waitingTime: timeout });
|
||||
this.setPartialMessageTimer();
|
||||
}
|
||||
}, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
|
||||
}
|
||||
}
|
||||
exports.ReadableStreamMessageReader = ReadableStreamMessageReader;
|
||||
115
frontend/node_modules/vscode-jsonrpc/lib/common/messageWriter.js
generated
vendored
Normal file
115
frontend/node_modules/vscode-jsonrpc/lib/common/messageWriter.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0;
|
||||
const ral_1 = require("./ral");
|
||||
const Is = require("./is");
|
||||
const semaphore_1 = require("./semaphore");
|
||||
const events_1 = require("./events");
|
||||
const ContentLength = 'Content-Length: ';
|
||||
const CRLF = '\r\n';
|
||||
var MessageWriter;
|
||||
(function (MessageWriter) {
|
||||
function is(value) {
|
||||
let candidate = value;
|
||||
return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
|
||||
Is.func(candidate.onError) && Is.func(candidate.write);
|
||||
}
|
||||
MessageWriter.is = is;
|
||||
})(MessageWriter || (exports.MessageWriter = MessageWriter = {}));
|
||||
class AbstractMessageWriter {
|
||||
constructor() {
|
||||
this.errorEmitter = new events_1.Emitter();
|
||||
this.closeEmitter = new events_1.Emitter();
|
||||
}
|
||||
dispose() {
|
||||
this.errorEmitter.dispose();
|
||||
this.closeEmitter.dispose();
|
||||
}
|
||||
get onError() {
|
||||
return this.errorEmitter.event;
|
||||
}
|
||||
fireError(error, message, count) {
|
||||
this.errorEmitter.fire([this.asError(error), message, count]);
|
||||
}
|
||||
get onClose() {
|
||||
return this.closeEmitter.event;
|
||||
}
|
||||
fireClose() {
|
||||
this.closeEmitter.fire(undefined);
|
||||
}
|
||||
asError(error) {
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
else {
|
||||
return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.AbstractMessageWriter = AbstractMessageWriter;
|
||||
var ResolvedMessageWriterOptions;
|
||||
(function (ResolvedMessageWriterOptions) {
|
||||
function fromOptions(options) {
|
||||
if (options === undefined || typeof options === 'string') {
|
||||
return { charset: options ?? 'utf-8', contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder };
|
||||
}
|
||||
else {
|
||||
return { charset: options.charset ?? 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: options.contentTypeEncoder ?? (0, ral_1.default)().applicationJson.encoder };
|
||||
}
|
||||
}
|
||||
ResolvedMessageWriterOptions.fromOptions = fromOptions;
|
||||
})(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
|
||||
class WriteableStreamMessageWriter extends AbstractMessageWriter {
|
||||
constructor(writable, options) {
|
||||
super();
|
||||
this.writable = writable;
|
||||
this.options = ResolvedMessageWriterOptions.fromOptions(options);
|
||||
this.errorCount = 0;
|
||||
this.writeSemaphore = new semaphore_1.Semaphore(1);
|
||||
this.writable.onError((error) => this.fireError(error));
|
||||
this.writable.onClose(() => this.fireClose());
|
||||
}
|
||||
async write(msg) {
|
||||
return this.writeSemaphore.lock(async () => {
|
||||
const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
|
||||
if (this.options.contentEncoder !== undefined) {
|
||||
return this.options.contentEncoder.encode(buffer);
|
||||
}
|
||||
else {
|
||||
return buffer;
|
||||
}
|
||||
});
|
||||
return payload.then((buffer) => {
|
||||
const headers = [];
|
||||
headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
|
||||
headers.push(CRLF);
|
||||
return this.doWrite(msg, headers, buffer);
|
||||
}, (error) => {
|
||||
this.fireError(error);
|
||||
throw error;
|
||||
});
|
||||
});
|
||||
}
|
||||
async doWrite(msg, headers, data) {
|
||||
try {
|
||||
await this.writable.write(headers.join(''), 'ascii');
|
||||
return this.writable.write(data);
|
||||
}
|
||||
catch (error) {
|
||||
this.handleError(error, msg);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
handleError(error, msg) {
|
||||
this.errorCount++;
|
||||
this.fireError(error, msg, this.errorCount);
|
||||
}
|
||||
end() {
|
||||
this.writable.end();
|
||||
}
|
||||
}
|
||||
exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
|
||||
306
frontend/node_modules/vscode-jsonrpc/lib/common/messages.js
generated
vendored
Normal file
306
frontend/node_modules/vscode-jsonrpc/lib/common/messages.js
generated
vendored
Normal file
@@ -0,0 +1,306 @@
|
||||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Message = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0;
|
||||
const is = require("./is");
|
||||
/**
|
||||
* Predefined error codes.
|
||||
*/
|
||||
var ErrorCodes;
|
||||
(function (ErrorCodes) {
|
||||
// Defined by JSON RPC
|
||||
ErrorCodes.ParseError = -32700;
|
||||
ErrorCodes.InvalidRequest = -32600;
|
||||
ErrorCodes.MethodNotFound = -32601;
|
||||
ErrorCodes.InvalidParams = -32602;
|
||||
ErrorCodes.InternalError = -32603;
|
||||
/**
|
||||
* This is the start range of JSON RPC reserved error codes.
|
||||
* It doesn't denote a real error code. No application error codes should
|
||||
* be defined between the start and end range. For backwards
|
||||
* compatibility the `ServerNotInitialized` and the `UnknownErrorCode`
|
||||
* are left in the range.
|
||||
*
|
||||
* @since 3.16.0
|
||||
*/
|
||||
ErrorCodes.jsonrpcReservedErrorRangeStart = -32099;
|
||||
/** @deprecated use jsonrpcReservedErrorRangeStart */
|
||||
ErrorCodes.serverErrorStart = -32099;
|
||||
/**
|
||||
* An error occurred when write a message to the transport layer.
|
||||
*/
|
||||
ErrorCodes.MessageWriteError = -32099;
|
||||
/**
|
||||
* An error occurred when reading a message from the transport layer.
|
||||
*/
|
||||
ErrorCodes.MessageReadError = -32098;
|
||||
/**
|
||||
* The connection got disposed or lost and all pending responses got
|
||||
* rejected.
|
||||
*/
|
||||
ErrorCodes.PendingResponseRejected = -32097;
|
||||
/**
|
||||
* The connection is inactive and a use of it failed.
|
||||
*/
|
||||
ErrorCodes.ConnectionInactive = -32096;
|
||||
/**
|
||||
* Error code indicating that a server received a notification or
|
||||
* request before the server has received the `initialize` request.
|
||||
*/
|
||||
ErrorCodes.ServerNotInitialized = -32002;
|
||||
ErrorCodes.UnknownErrorCode = -32001;
|
||||
/**
|
||||
* This is the end range of JSON RPC reserved error codes.
|
||||
* It doesn't denote a real error code.
|
||||
*
|
||||
* @since 3.16.0
|
||||
*/
|
||||
ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000;
|
||||
/** @deprecated use jsonrpcReservedErrorRangeEnd */
|
||||
ErrorCodes.serverErrorEnd = -32000;
|
||||
})(ErrorCodes || (exports.ErrorCodes = ErrorCodes = {}));
|
||||
/**
|
||||
* An error object return in a response in case a request
|
||||
* has failed.
|
||||
*/
|
||||
class ResponseError extends Error {
|
||||
constructor(code, message, data) {
|
||||
super(message);
|
||||
this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
|
||||
this.data = data;
|
||||
Object.setPrototypeOf(this, ResponseError.prototype);
|
||||
}
|
||||
toJson() {
|
||||
const result = {
|
||||
code: this.code,
|
||||
message: this.message
|
||||
};
|
||||
if (this.data !== undefined) {
|
||||
result.data = this.data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
exports.ResponseError = ResponseError;
|
||||
class ParameterStructures {
|
||||
constructor(kind) {
|
||||
this.kind = kind;
|
||||
}
|
||||
static is(value) {
|
||||
return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;
|
||||
}
|
||||
toString() {
|
||||
return this.kind;
|
||||
}
|
||||
}
|
||||
exports.ParameterStructures = ParameterStructures;
|
||||
/**
|
||||
* The parameter structure is automatically inferred on the number of parameters
|
||||
* and the parameter type in case of a single param.
|
||||
*/
|
||||
ParameterStructures.auto = new ParameterStructures('auto');
|
||||
/**
|
||||
* Forces `byPosition` parameter structure. This is useful if you have a single
|
||||
* parameter which has a literal type.
|
||||
*/
|
||||
ParameterStructures.byPosition = new ParameterStructures('byPosition');
|
||||
/**
|
||||
* Forces `byName` parameter structure. This is only useful when having a single
|
||||
* parameter. The library will report errors if used with a different number of
|
||||
* parameters.
|
||||
*/
|
||||
ParameterStructures.byName = new ParameterStructures('byName');
|
||||
/**
|
||||
* An abstract implementation of a MessageType.
|
||||
*/
|
||||
class AbstractMessageSignature {
|
||||
constructor(method, numberOfParams) {
|
||||
this.method = method;
|
||||
this.numberOfParams = numberOfParams;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return ParameterStructures.auto;
|
||||
}
|
||||
}
|
||||
exports.AbstractMessageSignature = AbstractMessageSignature;
|
||||
/**
|
||||
* Classes to type request response pairs
|
||||
*/
|
||||
class RequestType0 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 0);
|
||||
}
|
||||
}
|
||||
exports.RequestType0 = RequestType0;
|
||||
class RequestType extends AbstractMessageSignature {
|
||||
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
||||
super(method, 1);
|
||||
this._parameterStructures = _parameterStructures;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return this._parameterStructures;
|
||||
}
|
||||
}
|
||||
exports.RequestType = RequestType;
|
||||
class RequestType1 extends AbstractMessageSignature {
|
||||
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
||||
super(method, 1);
|
||||
this._parameterStructures = _parameterStructures;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return this._parameterStructures;
|
||||
}
|
||||
}
|
||||
exports.RequestType1 = RequestType1;
|
||||
class RequestType2 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 2);
|
||||
}
|
||||
}
|
||||
exports.RequestType2 = RequestType2;
|
||||
class RequestType3 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 3);
|
||||
}
|
||||
}
|
||||
exports.RequestType3 = RequestType3;
|
||||
class RequestType4 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 4);
|
||||
}
|
||||
}
|
||||
exports.RequestType4 = RequestType4;
|
||||
class RequestType5 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 5);
|
||||
}
|
||||
}
|
||||
exports.RequestType5 = RequestType5;
|
||||
class RequestType6 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 6);
|
||||
}
|
||||
}
|
||||
exports.RequestType6 = RequestType6;
|
||||
class RequestType7 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 7);
|
||||
}
|
||||
}
|
||||
exports.RequestType7 = RequestType7;
|
||||
class RequestType8 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 8);
|
||||
}
|
||||
}
|
||||
exports.RequestType8 = RequestType8;
|
||||
class RequestType9 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 9);
|
||||
}
|
||||
}
|
||||
exports.RequestType9 = RequestType9;
|
||||
class NotificationType extends AbstractMessageSignature {
|
||||
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
||||
super(method, 1);
|
||||
this._parameterStructures = _parameterStructures;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return this._parameterStructures;
|
||||
}
|
||||
}
|
||||
exports.NotificationType = NotificationType;
|
||||
class NotificationType0 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 0);
|
||||
}
|
||||
}
|
||||
exports.NotificationType0 = NotificationType0;
|
||||
class NotificationType1 extends AbstractMessageSignature {
|
||||
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
||||
super(method, 1);
|
||||
this._parameterStructures = _parameterStructures;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return this._parameterStructures;
|
||||
}
|
||||
}
|
||||
exports.NotificationType1 = NotificationType1;
|
||||
class NotificationType2 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 2);
|
||||
}
|
||||
}
|
||||
exports.NotificationType2 = NotificationType2;
|
||||
class NotificationType3 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 3);
|
||||
}
|
||||
}
|
||||
exports.NotificationType3 = NotificationType3;
|
||||
class NotificationType4 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 4);
|
||||
}
|
||||
}
|
||||
exports.NotificationType4 = NotificationType4;
|
||||
class NotificationType5 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 5);
|
||||
}
|
||||
}
|
||||
exports.NotificationType5 = NotificationType5;
|
||||
class NotificationType6 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 6);
|
||||
}
|
||||
}
|
||||
exports.NotificationType6 = NotificationType6;
|
||||
class NotificationType7 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 7);
|
||||
}
|
||||
}
|
||||
exports.NotificationType7 = NotificationType7;
|
||||
class NotificationType8 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 8);
|
||||
}
|
||||
}
|
||||
exports.NotificationType8 = NotificationType8;
|
||||
class NotificationType9 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 9);
|
||||
}
|
||||
}
|
||||
exports.NotificationType9 = NotificationType9;
|
||||
var Message;
|
||||
(function (Message) {
|
||||
/**
|
||||
* Tests if the given message is a request message
|
||||
*/
|
||||
function isRequest(message) {
|
||||
const candidate = message;
|
||||
return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
|
||||
}
|
||||
Message.isRequest = isRequest;
|
||||
/**
|
||||
* Tests if the given message is a notification message
|
||||
*/
|
||||
function isNotification(message) {
|
||||
const candidate = message;
|
||||
return candidate && is.string(candidate.method) && message.id === void 0;
|
||||
}
|
||||
Message.isNotification = isNotification;
|
||||
/**
|
||||
* Tests if the given message is a response message
|
||||
*/
|
||||
function isResponse(message) {
|
||||
const candidate = message;
|
||||
return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
|
||||
}
|
||||
Message.isResponse = isResponse;
|
||||
})(Message || (exports.Message = Message = {}));
|
||||
23
frontend/node_modules/vscode-jsonrpc/lib/common/ral.js
generated
vendored
Normal file
23
frontend/node_modules/vscode-jsonrpc/lib/common/ral.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let _ral;
|
||||
function RAL() {
|
||||
if (_ral === undefined) {
|
||||
throw new Error(`No runtime abstraction layer installed`);
|
||||
}
|
||||
return _ral;
|
||||
}
|
||||
(function (RAL) {
|
||||
function install(ral) {
|
||||
if (ral === undefined) {
|
||||
throw new Error(`No runtime abstraction layer provided`);
|
||||
}
|
||||
_ral = ral;
|
||||
}
|
||||
RAL.install = install;
|
||||
})(RAL || (RAL = {}));
|
||||
exports.default = RAL;
|
||||
15
frontend/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts
generated
vendored
Normal file
15
frontend/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { RequestMessage } from './messages';
|
||||
import { AbstractCancellationTokenSource } from './cancellation';
|
||||
import { CancellationId, RequestCancellationReceiverStrategy, CancellationSenderStrategy, MessageConnection } from './connection';
|
||||
export declare class SharedArraySenderStrategy implements CancellationSenderStrategy {
|
||||
private readonly buffers;
|
||||
constructor();
|
||||
enableCancellation(request: RequestMessage): void;
|
||||
sendCancellation(_conn: MessageConnection, id: CancellationId): Promise<void>;
|
||||
cleanup(id: CancellationId): void;
|
||||
dispose(): void;
|
||||
}
|
||||
export declare class SharedArrayReceiverStrategy implements RequestCancellationReceiverStrategy {
|
||||
readonly kind: "request";
|
||||
createCancellationTokenSource(request: RequestMessage): AbstractCancellationTokenSource;
|
||||
}
|
||||
161
frontend/node_modules/vscode-jsonrpc/lib/node/ril.js
generated
vendored
Normal file
161
frontend/node_modules/vscode-jsonrpc/lib/node/ril.js
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const util_1 = require("util");
|
||||
const api_1 = require("../common/api");
|
||||
class MessageBuffer extends api_1.AbstractMessageBuffer {
|
||||
constructor(encoding = 'utf-8') {
|
||||
super(encoding);
|
||||
}
|
||||
emptyBuffer() {
|
||||
return MessageBuffer.emptyBuffer;
|
||||
}
|
||||
fromString(value, encoding) {
|
||||
return Buffer.from(value, encoding);
|
||||
}
|
||||
toString(value, encoding) {
|
||||
if (value instanceof Buffer) {
|
||||
return value.toString(encoding);
|
||||
}
|
||||
else {
|
||||
return new util_1.TextDecoder(encoding).decode(value);
|
||||
}
|
||||
}
|
||||
asNative(buffer, length) {
|
||||
if (length === undefined) {
|
||||
return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
|
||||
}
|
||||
else {
|
||||
return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
|
||||
}
|
||||
}
|
||||
allocNative(length) {
|
||||
return Buffer.allocUnsafe(length);
|
||||
}
|
||||
}
|
||||
MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
|
||||
class ReadableStreamWrapper {
|
||||
constructor(stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
onClose(listener) {
|
||||
this.stream.on('close', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('close', listener));
|
||||
}
|
||||
onError(listener) {
|
||||
this.stream.on('error', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('error', listener));
|
||||
}
|
||||
onEnd(listener) {
|
||||
this.stream.on('end', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('end', listener));
|
||||
}
|
||||
onData(listener) {
|
||||
this.stream.on('data', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('data', listener));
|
||||
}
|
||||
}
|
||||
class WritableStreamWrapper {
|
||||
constructor(stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
onClose(listener) {
|
||||
this.stream.on('close', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('close', listener));
|
||||
}
|
||||
onError(listener) {
|
||||
this.stream.on('error', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('error', listener));
|
||||
}
|
||||
onEnd(listener) {
|
||||
this.stream.on('end', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('end', listener));
|
||||
}
|
||||
write(data, encoding) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const callback = (error) => {
|
||||
if (error === undefined || error === null) {
|
||||
resolve();
|
||||
}
|
||||
else {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
if (typeof data === 'string') {
|
||||
this.stream.write(data, encoding, callback);
|
||||
}
|
||||
else {
|
||||
this.stream.write(data, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
end() {
|
||||
this.stream.end();
|
||||
}
|
||||
}
|
||||
const _ril = Object.freeze({
|
||||
messageBuffer: Object.freeze({
|
||||
create: (encoding) => new MessageBuffer(encoding)
|
||||
}),
|
||||
applicationJson: Object.freeze({
|
||||
encoder: Object.freeze({
|
||||
name: 'application/json',
|
||||
encode: (msg, options) => {
|
||||
try {
|
||||
return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset));
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
}
|
||||
}),
|
||||
decoder: Object.freeze({
|
||||
name: 'application/json',
|
||||
decode: (buffer, options) => {
|
||||
try {
|
||||
if (buffer instanceof Buffer) {
|
||||
return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
|
||||
}
|
||||
else {
|
||||
return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
}
|
||||
})
|
||||
}),
|
||||
stream: Object.freeze({
|
||||
asReadableStream: (stream) => new ReadableStreamWrapper(stream),
|
||||
asWritableStream: (stream) => new WritableStreamWrapper(stream)
|
||||
}),
|
||||
console: console,
|
||||
timer: Object.freeze({
|
||||
setTimeout(callback, ms, ...args) {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
},
|
||||
setImmediate(callback, ...args) {
|
||||
const handle = setImmediate(callback, ...args);
|
||||
return { dispose: () => clearImmediate(handle) };
|
||||
},
|
||||
setInterval(callback, ms, ...args) {
|
||||
const handle = setInterval(callback, ms, ...args);
|
||||
return { dispose: () => clearInterval(handle) };
|
||||
}
|
||||
})
|
||||
});
|
||||
function RIL() {
|
||||
return _ril;
|
||||
}
|
||||
(function (RIL) {
|
||||
function install() {
|
||||
api_1.RAL.install(_ril);
|
||||
}
|
||||
RIL.install = install;
|
||||
})(RIL || (RIL = {}));
|
||||
exports.default = RIL;
|
||||
Reference in New Issue
Block a user