@codingame/monaco-languageclient-wrapper 5.0.0-next.0 → 5.0.0-update-monaco.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +29 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js +50 -0
- package/dist/_virtual/api.js +2 -0
- package/dist/_virtual/api2.js +2 -0
- package/dist/_virtual/cancellation.js +2 -0
- package/dist/_virtual/connection.js +2 -0
- package/dist/_virtual/connection2.js +2 -0
- package/dist/_virtual/disposable.js +2 -0
- package/dist/_virtual/events.js +2 -0
- package/dist/_virtual/is.js +2 -0
- package/dist/_virtual/is2.js +2 -0
- package/dist/_virtual/linkedMap.js +2 -0
- package/dist/_virtual/main.js +2 -0
- package/dist/_virtual/main2.js +2 -0
- package/dist/_virtual/main3.js +4 -0
- package/dist/_virtual/messageBuffer.js +2 -0
- package/dist/_virtual/messageReader.js +2 -0
- package/dist/_virtual/messageWriter.js +2 -0
- package/dist/_virtual/messages.js +2 -0
- package/dist/_virtual/messages2.js +2 -0
- package/dist/_virtual/once.js +2 -0
- package/dist/_virtual/protocol.callHierarchy.js +2 -0
- package/dist/_virtual/protocol.colorProvider.js +2 -0
- package/dist/_virtual/protocol.configuration.js +2 -0
- package/dist/_virtual/protocol.declaration.js +2 -0
- package/dist/_virtual/protocol.diagnostic.js +2 -0
- package/dist/_virtual/protocol.fileOperations.js +2 -0
- package/dist/_virtual/protocol.foldingRange.js +2 -0
- package/dist/_virtual/protocol.implementation.js +2 -0
- package/dist/_virtual/protocol.inlayHint.js +2 -0
- package/dist/_virtual/protocol.inlineCompletion.js +2 -0
- package/dist/_virtual/protocol.inlineValue.js +2 -0
- package/dist/_virtual/protocol.js +2 -0
- package/dist/_virtual/protocol.linkedEditingRange.js +2 -0
- package/dist/_virtual/protocol.moniker.js +2 -0
- package/dist/_virtual/protocol.notebook.js +2 -0
- package/dist/_virtual/protocol.progress.js +2 -0
- package/dist/_virtual/protocol.selectionRange.js +2 -0
- package/dist/_virtual/protocol.semanticTokens.js +2 -0
- package/dist/_virtual/protocol.showDocument.js +2 -0
- package/dist/_virtual/protocol.typeDefinition.js +2 -0
- package/dist/_virtual/protocol.typeHierarchy.js +2 -0
- package/dist/_virtual/protocol.workspaceFolder.js +2 -0
- package/dist/_virtual/ral.js +2 -0
- package/dist/_virtual/ril.js +2 -0
- package/dist/_virtual/semaphore.js +2 -0
- package/dist/_virtual/sharedArrayCancellation.js +2 -0
- package/dist/extensions/java/commands.js +74 -0
- package/dist/extensions/java/extension.js +13 -0
- package/dist/extensions/java/inlayHintsProvider.js +58 -0
- package/dist/extensions/java/protocol.js +68 -0
- package/dist/{java.js → extensions/java/sourceAction.js} +7 -245
- package/dist/index.d.ts +133 -9214
- package/dist/index.js +5 -1
- package/dist/node_modules/delay/index.js +45 -0
- package/dist/node_modules/once/once.js +44 -0
- package/dist/node_modules/tslib/tslib.es6.js +14 -0
- package/dist/node_modules/vscode-jsonrpc/browser.js +4 -0
- package/dist/node_modules/vscode-jsonrpc/lib/browser/main.js +77 -0
- package/dist/node_modules/vscode-jsonrpc/lib/browser/ril.js +153 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/api.js +96 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/cancellation.js +95 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +1182 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/disposable.js +19 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/events.js +121 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/is.js +38 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +386 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +149 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageReader.js +198 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +122 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messages.js +240 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/ral.js +26 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/semaphore.js +72 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +80 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/browser/main.js +30 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/api.js +44 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/connection.js +14 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/messages.js +43 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +25 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +19 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +46 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +48 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +19 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +25 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +19 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +566 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +27 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +190 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +30 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +43 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +25 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +19 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +40 -0
- package/dist/node_modules/vscode-languageserver-types/lib/esm/main.js +1608 -0
- package/dist/node_modules/wrappy/wrappy.js +25 -0
- package/dist/src/createLanguageClient.js +132 -0
- package/dist/src/customRequests.js +21 -0
- package/dist/src/extensionConfiguration.js +5 -0
- package/dist/{cobol.js → src/extensions/cobol.js} +4 -3
- package/dist/{csharp.js → src/extensions/csharp.js} +3 -2
- package/dist/src/extensions/java.js +36 -0
- package/dist/{tools.js → src/extensions/tools.js} +7 -3
- package/dist/src/extensions.js +173 -0
- package/dist/src/infrastructure.js +83 -0
- package/dist/src/languageClient.js +306 -0
- package/dist/src/languageClientOptions.js +17 -0
- package/dist/src/services.js +8 -0
- package/dist/src/staticOptions.js +441 -0
- package/package.json +56 -53
- package/stats.html +32 -28
- package/dist/index2.js +0 -17150
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __exports as disposable } from '../../../../_virtual/disposable.js';
|
|
2
|
+
var hasRequiredDisposable;
|
|
3
|
+
function requireDisposable () {
|
|
4
|
+
if (hasRequiredDisposable) return disposable;
|
|
5
|
+
hasRequiredDisposable = 1;
|
|
6
|
+
Object.defineProperty(disposable, "__esModule", { value: true });
|
|
7
|
+
disposable.Disposable = void 0;
|
|
8
|
+
var Disposable;
|
|
9
|
+
(function (Disposable) {
|
|
10
|
+
function create(func) {
|
|
11
|
+
return {
|
|
12
|
+
dispose: func
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
Disposable.create = create;
|
|
16
|
+
})(Disposable || (disposable.Disposable = Disposable = {}));
|
|
17
|
+
return disposable;
|
|
18
|
+
}
|
|
19
|
+
export { requireDisposable as __require };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { __exports as events } from '../../../../_virtual/events.js';
|
|
2
|
+
import { __require as requireRal } from './ral.js';
|
|
3
|
+
var hasRequiredEvents;
|
|
4
|
+
function requireEvents () {
|
|
5
|
+
if (hasRequiredEvents) return events;
|
|
6
|
+
hasRequiredEvents = 1;
|
|
7
|
+
Object.defineProperty(events, "__esModule", { value: true });
|
|
8
|
+
events.Emitter = events.Event = void 0;
|
|
9
|
+
const ral_1 = requireRal();
|
|
10
|
+
var Event;
|
|
11
|
+
(function (Event) {
|
|
12
|
+
const _disposable = { dispose() { } };
|
|
13
|
+
Event.None = function () { return _disposable; };
|
|
14
|
+
})(Event || (events.Event = Event = {}));
|
|
15
|
+
class CallbackList {
|
|
16
|
+
add(callback, context = null, bucket) {
|
|
17
|
+
if (!this._callbacks) {
|
|
18
|
+
this._callbacks = [];
|
|
19
|
+
this._contexts = [];
|
|
20
|
+
}
|
|
21
|
+
this._callbacks.push(callback);
|
|
22
|
+
this._contexts.push(context);
|
|
23
|
+
if (Array.isArray(bucket)) {
|
|
24
|
+
bucket.push({ dispose: () => this.remove(callback, context) });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
remove(callback, context = null) {
|
|
28
|
+
if (!this._callbacks) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let foundCallbackWithDifferentContext = false;
|
|
32
|
+
for (let i = 0, len = this._callbacks.length; i < len; i++) {
|
|
33
|
+
if (this._callbacks[i] === callback) {
|
|
34
|
+
if (this._contexts[i] === context) {
|
|
35
|
+
this._callbacks.splice(i, 1);
|
|
36
|
+
this._contexts.splice(i, 1);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
foundCallbackWithDifferentContext = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (foundCallbackWithDifferentContext) {
|
|
45
|
+
throw new Error('When adding a listener with a context, you should remove it with the same context');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
invoke(...args) {
|
|
49
|
+
if (!this._callbacks) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
|
|
53
|
+
for (let i = 0, len = callbacks.length; i < len; i++) {
|
|
54
|
+
try {
|
|
55
|
+
ret.push(callbacks[i].apply(contexts[i], args));
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
(0, ral_1.default)().console.error(e);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return ret;
|
|
62
|
+
}
|
|
63
|
+
isEmpty() {
|
|
64
|
+
return !this._callbacks || this._callbacks.length === 0;
|
|
65
|
+
}
|
|
66
|
+
dispose() {
|
|
67
|
+
this._callbacks = undefined;
|
|
68
|
+
this._contexts = undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class Emitter {
|
|
72
|
+
constructor(_options) {
|
|
73
|
+
this._options = _options;
|
|
74
|
+
}
|
|
75
|
+
get event() {
|
|
76
|
+
if (!this._event) {
|
|
77
|
+
this._event = (listener, thisArgs, disposables) => {
|
|
78
|
+
if (!this._callbacks) {
|
|
79
|
+
this._callbacks = new CallbackList();
|
|
80
|
+
}
|
|
81
|
+
if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
|
|
82
|
+
this._options.onFirstListenerAdd(this);
|
|
83
|
+
}
|
|
84
|
+
this._callbacks.add(listener, thisArgs);
|
|
85
|
+
const result = {
|
|
86
|
+
dispose: () => {
|
|
87
|
+
if (!this._callbacks) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this._callbacks.remove(listener, thisArgs);
|
|
91
|
+
result.dispose = Emitter._noop;
|
|
92
|
+
if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
|
|
93
|
+
this._options.onLastListenerRemove(this);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
if (Array.isArray(disposables)) {
|
|
98
|
+
disposables.push(result);
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return this._event;
|
|
104
|
+
}
|
|
105
|
+
fire(event) {
|
|
106
|
+
if (this._callbacks) {
|
|
107
|
+
this._callbacks.invoke.call(this._callbacks, event);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
dispose() {
|
|
111
|
+
if (this._callbacks) {
|
|
112
|
+
this._callbacks.dispose();
|
|
113
|
+
this._callbacks = undefined;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
events.Emitter = Emitter;
|
|
118
|
+
Emitter._noop = function () { };
|
|
119
|
+
return events;
|
|
120
|
+
}
|
|
121
|
+
export { requireEvents as __require };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { __exports as is } from '../../../../_virtual/is2.js';
|
|
2
|
+
var hasRequiredIs;
|
|
3
|
+
function requireIs () {
|
|
4
|
+
if (hasRequiredIs) return is;
|
|
5
|
+
hasRequiredIs = 1;
|
|
6
|
+
Object.defineProperty(is, "__esModule", { value: true });
|
|
7
|
+
is.stringArray = is.array = is.func = is.error = is.number = is.string = is.boolean = void 0;
|
|
8
|
+
function boolean(value) {
|
|
9
|
+
return value === true || value === false;
|
|
10
|
+
}
|
|
11
|
+
is.boolean = boolean;
|
|
12
|
+
function string(value) {
|
|
13
|
+
return typeof value === 'string' || value instanceof String;
|
|
14
|
+
}
|
|
15
|
+
is.string = string;
|
|
16
|
+
function number(value) {
|
|
17
|
+
return typeof value === 'number' || value instanceof Number;
|
|
18
|
+
}
|
|
19
|
+
is.number = number;
|
|
20
|
+
function error(value) {
|
|
21
|
+
return value instanceof Error;
|
|
22
|
+
}
|
|
23
|
+
is.error = error;
|
|
24
|
+
function func(value) {
|
|
25
|
+
return typeof value === 'function';
|
|
26
|
+
}
|
|
27
|
+
is.func = func;
|
|
28
|
+
function array(value) {
|
|
29
|
+
return Array.isArray(value);
|
|
30
|
+
}
|
|
31
|
+
is.array = array;
|
|
32
|
+
function stringArray(value) {
|
|
33
|
+
return array(value) && value.every(elem => string(elem));
|
|
34
|
+
}
|
|
35
|
+
is.stringArray = stringArray;
|
|
36
|
+
return is;
|
|
37
|
+
}
|
|
38
|
+
export { requireIs as __require };
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { __exports as linkedMap } from '../../../../_virtual/linkedMap.js';
|
|
2
|
+
var hasRequiredLinkedMap;
|
|
3
|
+
function requireLinkedMap () {
|
|
4
|
+
if (hasRequiredLinkedMap) return linkedMap;
|
|
5
|
+
hasRequiredLinkedMap = 1;
|
|
6
|
+
var _a;
|
|
7
|
+
Object.defineProperty(linkedMap, "__esModule", { value: true });
|
|
8
|
+
linkedMap.LRUCache = linkedMap.LinkedMap = linkedMap.Touch = void 0;
|
|
9
|
+
var Touch;
|
|
10
|
+
(function (Touch) {
|
|
11
|
+
Touch.None = 0;
|
|
12
|
+
Touch.First = 1;
|
|
13
|
+
Touch.AsOld = Touch.First;
|
|
14
|
+
Touch.Last = 2;
|
|
15
|
+
Touch.AsNew = Touch.Last;
|
|
16
|
+
})(Touch || (linkedMap.Touch = Touch = {}));
|
|
17
|
+
class LinkedMap {
|
|
18
|
+
constructor() {
|
|
19
|
+
this[_a] = 'LinkedMap';
|
|
20
|
+
this._map = new Map();
|
|
21
|
+
this._head = undefined;
|
|
22
|
+
this._tail = undefined;
|
|
23
|
+
this._size = 0;
|
|
24
|
+
this._state = 0;
|
|
25
|
+
}
|
|
26
|
+
clear() {
|
|
27
|
+
this._map.clear();
|
|
28
|
+
this._head = undefined;
|
|
29
|
+
this._tail = undefined;
|
|
30
|
+
this._size = 0;
|
|
31
|
+
this._state++;
|
|
32
|
+
}
|
|
33
|
+
isEmpty() {
|
|
34
|
+
return !this._head && !this._tail;
|
|
35
|
+
}
|
|
36
|
+
get size() {
|
|
37
|
+
return this._size;
|
|
38
|
+
}
|
|
39
|
+
get first() {
|
|
40
|
+
return this._head?.value;
|
|
41
|
+
}
|
|
42
|
+
get last() {
|
|
43
|
+
return this._tail?.value;
|
|
44
|
+
}
|
|
45
|
+
has(key) {
|
|
46
|
+
return this._map.has(key);
|
|
47
|
+
}
|
|
48
|
+
get(key, touch = Touch.None) {
|
|
49
|
+
const item = this._map.get(key);
|
|
50
|
+
if (!item) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (touch !== Touch.None) {
|
|
54
|
+
this.touch(item, touch);
|
|
55
|
+
}
|
|
56
|
+
return item.value;
|
|
57
|
+
}
|
|
58
|
+
set(key, value, touch = Touch.None) {
|
|
59
|
+
let item = this._map.get(key);
|
|
60
|
+
if (item) {
|
|
61
|
+
item.value = value;
|
|
62
|
+
if (touch !== Touch.None) {
|
|
63
|
+
this.touch(item, touch);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
item = { key, value, next: undefined, previous: undefined };
|
|
68
|
+
switch (touch) {
|
|
69
|
+
case Touch.None:
|
|
70
|
+
this.addItemLast(item);
|
|
71
|
+
break;
|
|
72
|
+
case Touch.First:
|
|
73
|
+
this.addItemFirst(item);
|
|
74
|
+
break;
|
|
75
|
+
case Touch.Last:
|
|
76
|
+
this.addItemLast(item);
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
this.addItemLast(item);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
this._map.set(key, item);
|
|
83
|
+
this._size++;
|
|
84
|
+
}
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
delete(key) {
|
|
88
|
+
return !!this.remove(key);
|
|
89
|
+
}
|
|
90
|
+
remove(key) {
|
|
91
|
+
const item = this._map.get(key);
|
|
92
|
+
if (!item) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
this._map.delete(key);
|
|
96
|
+
this.removeItem(item);
|
|
97
|
+
this._size--;
|
|
98
|
+
return item.value;
|
|
99
|
+
}
|
|
100
|
+
shift() {
|
|
101
|
+
if (!this._head && !this._tail) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
if (!this._head || !this._tail) {
|
|
105
|
+
throw new Error('Invalid list');
|
|
106
|
+
}
|
|
107
|
+
const item = this._head;
|
|
108
|
+
this._map.delete(item.key);
|
|
109
|
+
this.removeItem(item);
|
|
110
|
+
this._size--;
|
|
111
|
+
return item.value;
|
|
112
|
+
}
|
|
113
|
+
forEach(callbackfn, thisArg) {
|
|
114
|
+
const state = this._state;
|
|
115
|
+
let current = this._head;
|
|
116
|
+
while (current) {
|
|
117
|
+
if (thisArg) {
|
|
118
|
+
callbackfn.bind(thisArg)(current.value, current.key, this);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
callbackfn(current.value, current.key, this);
|
|
122
|
+
}
|
|
123
|
+
if (this._state !== state) {
|
|
124
|
+
throw new Error(`LinkedMap got modified during iteration.`);
|
|
125
|
+
}
|
|
126
|
+
current = current.next;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
keys() {
|
|
130
|
+
const state = this._state;
|
|
131
|
+
let current = this._head;
|
|
132
|
+
const iterator = {
|
|
133
|
+
[Symbol.iterator]: () => {
|
|
134
|
+
return iterator;
|
|
135
|
+
},
|
|
136
|
+
next: () => {
|
|
137
|
+
if (this._state !== state) {
|
|
138
|
+
throw new Error(`LinkedMap got modified during iteration.`);
|
|
139
|
+
}
|
|
140
|
+
if (current) {
|
|
141
|
+
const result = { value: current.key, done: false };
|
|
142
|
+
current = current.next;
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return { value: undefined, done: true };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
return iterator;
|
|
151
|
+
}
|
|
152
|
+
values() {
|
|
153
|
+
const state = this._state;
|
|
154
|
+
let current = this._head;
|
|
155
|
+
const iterator = {
|
|
156
|
+
[Symbol.iterator]: () => {
|
|
157
|
+
return iterator;
|
|
158
|
+
},
|
|
159
|
+
next: () => {
|
|
160
|
+
if (this._state !== state) {
|
|
161
|
+
throw new Error(`LinkedMap got modified during iteration.`);
|
|
162
|
+
}
|
|
163
|
+
if (current) {
|
|
164
|
+
const result = { value: current.value, done: false };
|
|
165
|
+
current = current.next;
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
return { value: undefined, done: true };
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
return iterator;
|
|
174
|
+
}
|
|
175
|
+
entries() {
|
|
176
|
+
const state = this._state;
|
|
177
|
+
let current = this._head;
|
|
178
|
+
const iterator = {
|
|
179
|
+
[Symbol.iterator]: () => {
|
|
180
|
+
return iterator;
|
|
181
|
+
},
|
|
182
|
+
next: () => {
|
|
183
|
+
if (this._state !== state) {
|
|
184
|
+
throw new Error(`LinkedMap got modified during iteration.`);
|
|
185
|
+
}
|
|
186
|
+
if (current) {
|
|
187
|
+
const result = { value: [current.key, current.value], done: false };
|
|
188
|
+
current = current.next;
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
return { value: undefined, done: true };
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
return iterator;
|
|
197
|
+
}
|
|
198
|
+
[(_a = Symbol.toStringTag, Symbol.iterator)]() {
|
|
199
|
+
return this.entries();
|
|
200
|
+
}
|
|
201
|
+
trimOld(newSize) {
|
|
202
|
+
if (newSize >= this.size) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (newSize === 0) {
|
|
206
|
+
this.clear();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
let current = this._head;
|
|
210
|
+
let currentSize = this.size;
|
|
211
|
+
while (current && currentSize > newSize) {
|
|
212
|
+
this._map.delete(current.key);
|
|
213
|
+
current = current.next;
|
|
214
|
+
currentSize--;
|
|
215
|
+
}
|
|
216
|
+
this._head = current;
|
|
217
|
+
this._size = currentSize;
|
|
218
|
+
if (current) {
|
|
219
|
+
current.previous = undefined;
|
|
220
|
+
}
|
|
221
|
+
this._state++;
|
|
222
|
+
}
|
|
223
|
+
addItemFirst(item) {
|
|
224
|
+
if (!this._head && !this._tail) {
|
|
225
|
+
this._tail = item;
|
|
226
|
+
}
|
|
227
|
+
else if (!this._head) {
|
|
228
|
+
throw new Error('Invalid list');
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
item.next = this._head;
|
|
232
|
+
this._head.previous = item;
|
|
233
|
+
}
|
|
234
|
+
this._head = item;
|
|
235
|
+
this._state++;
|
|
236
|
+
}
|
|
237
|
+
addItemLast(item) {
|
|
238
|
+
if (!this._head && !this._tail) {
|
|
239
|
+
this._head = item;
|
|
240
|
+
}
|
|
241
|
+
else if (!this._tail) {
|
|
242
|
+
throw new Error('Invalid list');
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
item.previous = this._tail;
|
|
246
|
+
this._tail.next = item;
|
|
247
|
+
}
|
|
248
|
+
this._tail = item;
|
|
249
|
+
this._state++;
|
|
250
|
+
}
|
|
251
|
+
removeItem(item) {
|
|
252
|
+
if (item === this._head && item === this._tail) {
|
|
253
|
+
this._head = undefined;
|
|
254
|
+
this._tail = undefined;
|
|
255
|
+
}
|
|
256
|
+
else if (item === this._head) {
|
|
257
|
+
if (!item.next) {
|
|
258
|
+
throw new Error('Invalid list');
|
|
259
|
+
}
|
|
260
|
+
item.next.previous = undefined;
|
|
261
|
+
this._head = item.next;
|
|
262
|
+
}
|
|
263
|
+
else if (item === this._tail) {
|
|
264
|
+
if (!item.previous) {
|
|
265
|
+
throw new Error('Invalid list');
|
|
266
|
+
}
|
|
267
|
+
item.previous.next = undefined;
|
|
268
|
+
this._tail = item.previous;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
const next = item.next;
|
|
272
|
+
const previous = item.previous;
|
|
273
|
+
if (!next || !previous) {
|
|
274
|
+
throw new Error('Invalid list');
|
|
275
|
+
}
|
|
276
|
+
next.previous = previous;
|
|
277
|
+
previous.next = next;
|
|
278
|
+
}
|
|
279
|
+
item.next = undefined;
|
|
280
|
+
item.previous = undefined;
|
|
281
|
+
this._state++;
|
|
282
|
+
}
|
|
283
|
+
touch(item, touch) {
|
|
284
|
+
if (!this._head || !this._tail) {
|
|
285
|
+
throw new Error('Invalid list');
|
|
286
|
+
}
|
|
287
|
+
if ((touch !== Touch.First && touch !== Touch.Last)) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (touch === Touch.First) {
|
|
291
|
+
if (item === this._head) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const next = item.next;
|
|
295
|
+
const previous = item.previous;
|
|
296
|
+
if (item === this._tail) {
|
|
297
|
+
previous.next = undefined;
|
|
298
|
+
this._tail = previous;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
next.previous = previous;
|
|
302
|
+
previous.next = next;
|
|
303
|
+
}
|
|
304
|
+
item.previous = undefined;
|
|
305
|
+
item.next = this._head;
|
|
306
|
+
this._head.previous = item;
|
|
307
|
+
this._head = item;
|
|
308
|
+
this._state++;
|
|
309
|
+
}
|
|
310
|
+
else if (touch === Touch.Last) {
|
|
311
|
+
if (item === this._tail) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const next = item.next;
|
|
315
|
+
const previous = item.previous;
|
|
316
|
+
if (item === this._head) {
|
|
317
|
+
next.previous = undefined;
|
|
318
|
+
this._head = next;
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
next.previous = previous;
|
|
322
|
+
previous.next = next;
|
|
323
|
+
}
|
|
324
|
+
item.next = undefined;
|
|
325
|
+
item.previous = this._tail;
|
|
326
|
+
this._tail.next = item;
|
|
327
|
+
this._tail = item;
|
|
328
|
+
this._state++;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
toJSON() {
|
|
332
|
+
const data = [];
|
|
333
|
+
this.forEach((value, key) => {
|
|
334
|
+
data.push([key, value]);
|
|
335
|
+
});
|
|
336
|
+
return data;
|
|
337
|
+
}
|
|
338
|
+
fromJSON(data) {
|
|
339
|
+
this.clear();
|
|
340
|
+
for (const [key, value] of data) {
|
|
341
|
+
this.set(key, value);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
linkedMap.LinkedMap = LinkedMap;
|
|
346
|
+
class LRUCache extends LinkedMap {
|
|
347
|
+
constructor(limit, ratio = 1) {
|
|
348
|
+
super();
|
|
349
|
+
this._limit = limit;
|
|
350
|
+
this._ratio = Math.min(Math.max(0, ratio), 1);
|
|
351
|
+
}
|
|
352
|
+
get limit() {
|
|
353
|
+
return this._limit;
|
|
354
|
+
}
|
|
355
|
+
set limit(limit) {
|
|
356
|
+
this._limit = limit;
|
|
357
|
+
this.checkTrim();
|
|
358
|
+
}
|
|
359
|
+
get ratio() {
|
|
360
|
+
return this._ratio;
|
|
361
|
+
}
|
|
362
|
+
set ratio(ratio) {
|
|
363
|
+
this._ratio = Math.min(Math.max(0, ratio), 1);
|
|
364
|
+
this.checkTrim();
|
|
365
|
+
}
|
|
366
|
+
get(key, touch = Touch.AsNew) {
|
|
367
|
+
return super.get(key, touch);
|
|
368
|
+
}
|
|
369
|
+
peek(key) {
|
|
370
|
+
return super.get(key, Touch.None);
|
|
371
|
+
}
|
|
372
|
+
set(key, value) {
|
|
373
|
+
super.set(key, value, Touch.Last);
|
|
374
|
+
this.checkTrim();
|
|
375
|
+
return this;
|
|
376
|
+
}
|
|
377
|
+
checkTrim() {
|
|
378
|
+
if (this.size > this._limit) {
|
|
379
|
+
this.trimOld(Math.round(this._limit * this._ratio));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
linkedMap.LRUCache = LRUCache;
|
|
384
|
+
return linkedMap;
|
|
385
|
+
}
|
|
386
|
+
export { requireLinkedMap as __require };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { __exports as messageBuffer } from '../../../../_virtual/messageBuffer.js';
|
|
2
|
+
var hasRequiredMessageBuffer;
|
|
3
|
+
function requireMessageBuffer () {
|
|
4
|
+
if (hasRequiredMessageBuffer) return messageBuffer;
|
|
5
|
+
hasRequiredMessageBuffer = 1;
|
|
6
|
+
Object.defineProperty(messageBuffer, "__esModule", { value: true });
|
|
7
|
+
messageBuffer.AbstractMessageBuffer = void 0;
|
|
8
|
+
const CR = 13;
|
|
9
|
+
const LF = 10;
|
|
10
|
+
const CRLF = '\r\n';
|
|
11
|
+
class AbstractMessageBuffer {
|
|
12
|
+
constructor(encoding = 'utf-8') {
|
|
13
|
+
this._encoding = encoding;
|
|
14
|
+
this._chunks = [];
|
|
15
|
+
this._totalLength = 0;
|
|
16
|
+
}
|
|
17
|
+
get encoding() {
|
|
18
|
+
return this._encoding;
|
|
19
|
+
}
|
|
20
|
+
append(chunk) {
|
|
21
|
+
const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk;
|
|
22
|
+
this._chunks.push(toAppend);
|
|
23
|
+
this._totalLength += toAppend.byteLength;
|
|
24
|
+
}
|
|
25
|
+
tryReadHeaders(lowerCaseKeys = false) {
|
|
26
|
+
if (this._chunks.length === 0) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
let state = 0;
|
|
30
|
+
let chunkIndex = 0;
|
|
31
|
+
let offset = 0;
|
|
32
|
+
let chunkBytesRead = 0;
|
|
33
|
+
row: while (chunkIndex < this._chunks.length) {
|
|
34
|
+
const chunk = this._chunks[chunkIndex];
|
|
35
|
+
offset = 0;
|
|
36
|
+
while (offset < chunk.length) {
|
|
37
|
+
const value = chunk[offset];
|
|
38
|
+
switch (value) {
|
|
39
|
+
case CR:
|
|
40
|
+
switch (state) {
|
|
41
|
+
case 0:
|
|
42
|
+
state = 1;
|
|
43
|
+
break;
|
|
44
|
+
case 2:
|
|
45
|
+
state = 3;
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
state = 0;
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case LF:
|
|
52
|
+
switch (state) {
|
|
53
|
+
case 1:
|
|
54
|
+
state = 2;
|
|
55
|
+
break;
|
|
56
|
+
case 3:
|
|
57
|
+
state = 4;
|
|
58
|
+
offset++;
|
|
59
|
+
break row;
|
|
60
|
+
default:
|
|
61
|
+
state = 0;
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
state = 0;
|
|
66
|
+
}
|
|
67
|
+
offset++;
|
|
68
|
+
}
|
|
69
|
+
chunkBytesRead += chunk.byteLength;
|
|
70
|
+
chunkIndex++;
|
|
71
|
+
}
|
|
72
|
+
if (state !== 4) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const buffer = this._read(chunkBytesRead + offset);
|
|
76
|
+
const result = new Map();
|
|
77
|
+
const headers = this.toString(buffer, 'ascii').split(CRLF);
|
|
78
|
+
if (headers.length < 2) {
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
for (let i = 0; i < headers.length - 2; i++) {
|
|
82
|
+
const header = headers[i];
|
|
83
|
+
const index = header.indexOf(':');
|
|
84
|
+
if (index === -1) {
|
|
85
|
+
throw new Error(`Message header must separate key and value using ':'\n${header}`);
|
|
86
|
+
}
|
|
87
|
+
const key = header.substr(0, index);
|
|
88
|
+
const value = header.substr(index + 1).trim();
|
|
89
|
+
result.set(lowerCaseKeys ? key.toLowerCase() : key, value);
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
tryReadBody(length) {
|
|
94
|
+
if (this._totalLength < length) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
return this._read(length);
|
|
98
|
+
}
|
|
99
|
+
get numberOfBytes() {
|
|
100
|
+
return this._totalLength;
|
|
101
|
+
}
|
|
102
|
+
_read(byteCount) {
|
|
103
|
+
if (byteCount === 0) {
|
|
104
|
+
return this.emptyBuffer();
|
|
105
|
+
}
|
|
106
|
+
if (byteCount > this._totalLength) {
|
|
107
|
+
throw new Error(`Cannot read so many bytes!`);
|
|
108
|
+
}
|
|
109
|
+
if (this._chunks[0].byteLength === byteCount) {
|
|
110
|
+
const chunk = this._chunks[0];
|
|
111
|
+
this._chunks.shift();
|
|
112
|
+
this._totalLength -= byteCount;
|
|
113
|
+
return this.asNative(chunk);
|
|
114
|
+
}
|
|
115
|
+
if (this._chunks[0].byteLength > byteCount) {
|
|
116
|
+
const chunk = this._chunks[0];
|
|
117
|
+
const result = this.asNative(chunk, byteCount);
|
|
118
|
+
this._chunks[0] = chunk.slice(byteCount);
|
|
119
|
+
this._totalLength -= byteCount;
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
const result = this.allocNative(byteCount);
|
|
123
|
+
let resultOffset = 0;
|
|
124
|
+
let chunkIndex = 0;
|
|
125
|
+
while (byteCount > 0) {
|
|
126
|
+
const chunk = this._chunks[chunkIndex];
|
|
127
|
+
if (chunk.byteLength > byteCount) {
|
|
128
|
+
const chunkPart = chunk.slice(0, byteCount);
|
|
129
|
+
result.set(chunkPart, resultOffset);
|
|
130
|
+
resultOffset += byteCount;
|
|
131
|
+
this._chunks[chunkIndex] = chunk.slice(byteCount);
|
|
132
|
+
this._totalLength -= byteCount;
|
|
133
|
+
byteCount -= byteCount;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
result.set(chunk, resultOffset);
|
|
137
|
+
resultOffset += chunk.byteLength;
|
|
138
|
+
this._chunks.shift();
|
|
139
|
+
this._totalLength -= chunk.byteLength;
|
|
140
|
+
byteCount -= chunk.byteLength;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
messageBuffer.AbstractMessageBuffer = AbstractMessageBuffer;
|
|
147
|
+
return messageBuffer;
|
|
148
|
+
}
|
|
149
|
+
export { requireMessageBuffer as __require };
|