@codingame/monaco-languageclient-wrapper 5.0.0-next.0 → 5.0.0-next.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 +32 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js +50 -0
- package/dist/_virtual/_vscode.js +4 -0
- package/dist/_virtual/api.js +2 -0
- package/dist/_virtual/api2.js +2 -0
- package/dist/_virtual/api3.js +2 -0
- package/dist/_virtual/async.js +2 -0
- package/dist/_virtual/callHierarchy.js +2 -0
- package/dist/_virtual/cancellation.js +2 -0
- package/dist/_virtual/client.js +2 -0
- package/dist/_virtual/codeAction.js +2 -0
- package/dist/_virtual/codeConverter.js +2 -0
- package/dist/_virtual/codeLens.js +2 -0
- package/dist/_virtual/colorProvider.js +2 -0
- package/dist/_virtual/completion.js +2 -0
- package/dist/_virtual/configuration.js +2 -0
- package/dist/_virtual/connection.js +2 -0
- package/dist/_virtual/connection2.js +2 -0
- package/dist/_virtual/declaration.js +2 -0
- package/dist/_virtual/definition.js +2 -0
- package/dist/_virtual/diagnostic.js +2 -0
- package/dist/_virtual/disposable.js +2 -0
- package/dist/_virtual/documentHighlight.js +2 -0
- package/dist/_virtual/documentLink.js +2 -0
- package/dist/_virtual/documentSymbol.js +2 -0
- package/dist/_virtual/events.js +2 -0
- package/dist/_virtual/executeCommand.js +2 -0
- package/dist/_virtual/features.js +2 -0
- package/dist/_virtual/fileOperations.js +2 -0
- package/dist/_virtual/fileSystemWatcher.js +2 -0
- package/dist/_virtual/foldingRange.js +2 -0
- package/dist/_virtual/formatting.js +2 -0
- package/dist/_virtual/hover.js +2 -0
- package/dist/_virtual/implementation.js +2 -0
- package/dist/_virtual/inlayHint.js +2 -0
- package/dist/_virtual/inlineValue.js +2 -0
- package/dist/_virtual/is.js +2 -0
- package/dist/_virtual/is2.js +2 -0
- package/dist/_virtual/is3.js +2 -0
- package/dist/_virtual/linkedEditingRange.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 +2 -0
- package/dist/_virtual/main4.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/notebook.js +2 -0
- package/dist/_virtual/once.js +2 -0
- package/dist/_virtual/path.js +4 -0
- package/dist/_virtual/progress.js +2 -0
- package/dist/_virtual/progressPart.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.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/protocolCallHierarchyItem.js +2 -0
- package/dist/_virtual/protocolCodeAction.js +2 -0
- package/dist/_virtual/protocolCodeLens.js +2 -0
- package/dist/_virtual/protocolCompletionItem.js +2 -0
- package/dist/_virtual/protocolConverter.js +2 -0
- package/dist/_virtual/protocolDiagnostic.js +2 -0
- package/dist/_virtual/protocolDocumentLink.js +2 -0
- package/dist/_virtual/protocolInlayHint.js +2 -0
- package/dist/_virtual/protocolTypeHierarchyItem.js +2 -0
- package/dist/_virtual/protocolWorkspaceSymbol.js +2 -0
- package/dist/_virtual/ral.js +2 -0
- package/dist/_virtual/reference.js +2 -0
- package/dist/_virtual/rename.js +2 -0
- package/dist/_virtual/ril.js +2 -0
- package/dist/_virtual/selectionRange.js +2 -0
- package/dist/_virtual/semanticTokens.js +2 -0
- package/dist/_virtual/semaphore.js +2 -0
- package/dist/_virtual/sharedArrayCancellation.js +2 -0
- package/dist/_virtual/signatureHelp.js +2 -0
- package/dist/_virtual/textSynchronization.js +2 -0
- package/dist/_virtual/typeDefinition.js +2 -0
- package/dist/_virtual/typeHierarchy.js +2 -0
- package/dist/_virtual/uuid.js +2 -0
- package/dist/_virtual/workspaceFolder.js +2 -0
- package/dist/_virtual/workspaceSymbol.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 +59 -0
- package/dist/extensions/java/protocol.js +69 -0
- package/dist/{java.js → extensions/java/sourceAction.js} +6 -244
- package/dist/index.d.ts +1 -2
- package/dist/index.js +5 -1
- package/dist/node_modules/balanced-match/index.js +52 -0
- package/dist/node_modules/delay/index.js +46 -0
- package/dist/node_modules/monaco-languageclient/lib/monaco-language-client.js +127 -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 +97 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +1180 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/disposable.js +20 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/events.js +122 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/is.js +38 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +388 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +149 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageReader.js +194 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +123 -0
- package/dist/node_modules/vscode-jsonrpc/lib/common/messages.js +241 -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-languageclient/lib/browser/main.js +49 -0
- package/dist/node_modules/vscode-languageclient/lib/common/api.js +51 -0
- package/dist/node_modules/vscode-languageclient/lib/common/callHierarchy.js +98 -0
- package/dist/node_modules/vscode-languageclient/lib/common/client.js +1527 -0
- package/dist/node_modules/vscode-languageclient/lib/common/codeAction.js +92 -0
- package/dist/node_modules/vscode-languageclient/lib/common/codeConverter.js +881 -0
- package/dist/node_modules/vscode-languageclient/lib/common/codeLens.js +84 -0
- package/dist/node_modules/vscode-languageclient/lib/common/colorProvider.js +77 -0
- package/dist/node_modules/vscode-languageclient/lib/common/completion.js +105 -0
- package/dist/node_modules/vscode-languageclient/lib/common/configuration.js +214 -0
- package/dist/node_modules/vscode-languageclient/lib/common/declaration.js +59 -0
- package/dist/node_modules/vscode-languageclient/lib/common/definition.js +62 -0
- package/dist/node_modules/vscode-languageclient/lib/common/diagnostic.js +839 -0
- package/dist/node_modules/vscode-languageclient/lib/common/documentHighlight.js +57 -0
- package/dist/node_modules/vscode-languageclient/lib/common/documentLink.js +74 -0
- package/dist/node_modules/vscode-languageclient/lib/common/documentSymbol.js +82 -0
- package/dist/node_modules/vscode-languageclient/lib/common/executeCommand.js +83 -0
- package/dist/node_modules/vscode-languageclient/lib/common/features.js +310 -0
- package/dist/node_modules/vscode-languageclient/lib/common/fileOperations.js +319 -0
- package/dist/node_modules/vscode-languageclient/lib/common/fileSystemWatcher.js +104 -0
- package/dist/node_modules/vscode-languageclient/lib/common/foldingRange.js +66 -0
- package/dist/node_modules/vscode-languageclient/lib/common/formatting.js +165 -0
- package/dist/node_modules/vscode-languageclient/lib/common/hover.js +62 -0
- package/dist/node_modules/vscode-languageclient/lib/common/implementation.js +59 -0
- package/dist/node_modules/vscode-languageclient/lib/common/inlayHint.js +94 -0
- package/dist/node_modules/vscode-languageclient/lib/common/inlineValue.js +73 -0
- package/dist/node_modules/vscode-languageclient/lib/common/linkedEditingRange.js +58 -0
- package/dist/node_modules/vscode-languageclient/lib/common/notebook.js +858 -0
- package/dist/node_modules/vscode-languageclient/lib/common/progress.js +51 -0
- package/dist/node_modules/vscode-languageclient/lib/common/progressPart.js +107 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCallHierarchyItem.js +15 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCodeAction.js +13 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCodeLens.js +12 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCompletionItem.js +12 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolConverter.js +1129 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolDiagnostic.js +27 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolDocumentLink.js +12 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolInlayHint.js +12 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolTypeHierarchyItem.js +15 -0
- package/dist/node_modules/vscode-languageclient/lib/common/protocolWorkspaceSymbol.js +17 -0
- package/dist/node_modules/vscode-languageclient/lib/common/reference.js +60 -0
- package/dist/node_modules/vscode-languageclient/lib/common/rename.js +112 -0
- package/dist/node_modules/vscode-languageclient/lib/common/selectionRange.js +62 -0
- package/dist/node_modules/vscode-languageclient/lib/common/semanticTokens.js +144 -0
- package/dist/node_modules/vscode-languageclient/lib/common/signatureHelp.js +78 -0
- package/dist/node_modules/vscode-languageclient/lib/common/textSynchronization.js +422 -0
- package/dist/node_modules/vscode-languageclient/lib/common/typeDefinition.js +60 -0
- package/dist/node_modules/vscode-languageclient/lib/common/typeHierarchy.js +97 -0
- package/dist/node_modules/vscode-languageclient/lib/common/utils/async.js +269 -0
- package/dist/node_modules/vscode-languageclient/lib/common/utils/is.js +54 -0
- package/dist/node_modules/vscode-languageclient/lib/common/utils/uuid.js +51 -0
- package/dist/node_modules/vscode-languageclient/lib/common/workspaceFolder.js +154 -0
- package/dist/node_modules/vscode-languageclient/lib/common/workspaceSymbol.js +87 -0
- package/dist/node_modules/vscode-languageclient/node_modules/brace-expansion/index.js +160 -0
- package/dist/node_modules/vscode-languageclient/node_modules/minimatch/lib/path.js +2 -0
- package/dist/node_modules/vscode-languageclient/node_modules/minimatch/minimatch.js +567 -0
- package/dist/node_modules/vscode-languageserver-protocol/browser.js +4 -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 +43 -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 +23 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +18 -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 +42 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +42 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +13 -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 +23 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +18 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +494 -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 +25 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +185 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +28 -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 +39 -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 +23 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +18 -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 +1583 -0
- package/dist/node_modules/wrappy/wrappy.js +25 -0
- package/dist/src/createLanguageClient.js +107 -0
- package/dist/src/customRequests.js +21 -0
- package/dist/src/extensionConfiguration.js +5 -0
- package/dist/{cobol.js → src/extensions/cobol.js} +3 -2
- 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} +2 -2
- package/dist/src/extensions.js +170 -0
- package/dist/src/infrastructure.js +68 -0
- package/dist/src/languageClient.js +308 -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 +31 -32
- package/stats.html +1 -1
- package/dist/index2.js +0 -17150
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __exports as disposable } from '../../../../_virtual/disposable.js';
|
|
2
|
+
var hasRequiredDisposable;
|
|
3
|
+
function requireDisposable () {
|
|
4
|
+
if (hasRequiredDisposable) return disposable;
|
|
5
|
+
hasRequiredDisposable = 1;
|
|
6
|
+
(function (exports) {
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Disposable = void 0;
|
|
9
|
+
(function (Disposable) {
|
|
10
|
+
function create(func) {
|
|
11
|
+
return {
|
|
12
|
+
dispose: func
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
Disposable.create = create;
|
|
16
|
+
})(exports.Disposable || (exports.Disposable = {}));
|
|
17
|
+
} (disposable));
|
|
18
|
+
return disposable;
|
|
19
|
+
}
|
|
20
|
+
export { requireDisposable as __require };
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
(function (exports) {
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Emitter = exports.Event = void 0;
|
|
10
|
+
const ral_1 = requireRal();
|
|
11
|
+
(function (Event) {
|
|
12
|
+
const _disposable = { dispose() { } };
|
|
13
|
+
Event.None = function () { return _disposable; };
|
|
14
|
+
})(exports.Event || (exports.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
|
+
exports.Emitter = Emitter;
|
|
118
|
+
Emitter._noop = function () { };
|
|
119
|
+
} (events));
|
|
120
|
+
return events;
|
|
121
|
+
}
|
|
122
|
+
export { requireEvents as __require };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { __exports as is } from '../../../../_virtual/is3.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,388 @@
|
|
|
1
|
+
import { __exports as linkedMap } from '../../../../_virtual/linkedMap.js';
|
|
2
|
+
var hasRequiredLinkedMap;
|
|
3
|
+
function requireLinkedMap () {
|
|
4
|
+
if (hasRequiredLinkedMap) return linkedMap;
|
|
5
|
+
hasRequiredLinkedMap = 1;
|
|
6
|
+
(function (exports) {
|
|
7
|
+
var _a;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LRUCache = exports.LinkedMap = exports.Touch = void 0;
|
|
10
|
+
var Touch;
|
|
11
|
+
(function (Touch) {
|
|
12
|
+
Touch.None = 0;
|
|
13
|
+
Touch.First = 1;
|
|
14
|
+
Touch.AsOld = Touch.First;
|
|
15
|
+
Touch.Last = 2;
|
|
16
|
+
Touch.AsNew = Touch.Last;
|
|
17
|
+
})(Touch = exports.Touch || (exports.Touch = {}));
|
|
18
|
+
class LinkedMap {
|
|
19
|
+
constructor() {
|
|
20
|
+
this[_a] = 'LinkedMap';
|
|
21
|
+
this._map = new Map();
|
|
22
|
+
this._head = undefined;
|
|
23
|
+
this._tail = undefined;
|
|
24
|
+
this._size = 0;
|
|
25
|
+
this._state = 0;
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
this._map.clear();
|
|
29
|
+
this._head = undefined;
|
|
30
|
+
this._tail = undefined;
|
|
31
|
+
this._size = 0;
|
|
32
|
+
this._state++;
|
|
33
|
+
}
|
|
34
|
+
isEmpty() {
|
|
35
|
+
return !this._head && !this._tail;
|
|
36
|
+
}
|
|
37
|
+
get size() {
|
|
38
|
+
return this._size;
|
|
39
|
+
}
|
|
40
|
+
get first() {
|
|
41
|
+
return this._head?.value;
|
|
42
|
+
}
|
|
43
|
+
get last() {
|
|
44
|
+
return this._tail?.value;
|
|
45
|
+
}
|
|
46
|
+
has(key) {
|
|
47
|
+
return this._map.has(key);
|
|
48
|
+
}
|
|
49
|
+
get(key, touch = Touch.None) {
|
|
50
|
+
const item = this._map.get(key);
|
|
51
|
+
if (!item) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
if (touch !== Touch.None) {
|
|
55
|
+
this.touch(item, touch);
|
|
56
|
+
}
|
|
57
|
+
return item.value;
|
|
58
|
+
}
|
|
59
|
+
set(key, value, touch = Touch.None) {
|
|
60
|
+
let item = this._map.get(key);
|
|
61
|
+
if (item) {
|
|
62
|
+
item.value = value;
|
|
63
|
+
if (touch !== Touch.None) {
|
|
64
|
+
this.touch(item, touch);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
item = { key, value, next: undefined, previous: undefined };
|
|
69
|
+
switch (touch) {
|
|
70
|
+
case Touch.None:
|
|
71
|
+
this.addItemLast(item);
|
|
72
|
+
break;
|
|
73
|
+
case Touch.First:
|
|
74
|
+
this.addItemFirst(item);
|
|
75
|
+
break;
|
|
76
|
+
case Touch.Last:
|
|
77
|
+
this.addItemLast(item);
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
this.addItemLast(item);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
this._map.set(key, item);
|
|
84
|
+
this._size++;
|
|
85
|
+
}
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
delete(key) {
|
|
89
|
+
return !!this.remove(key);
|
|
90
|
+
}
|
|
91
|
+
remove(key) {
|
|
92
|
+
const item = this._map.get(key);
|
|
93
|
+
if (!item) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
this._map.delete(key);
|
|
97
|
+
this.removeItem(item);
|
|
98
|
+
this._size--;
|
|
99
|
+
return item.value;
|
|
100
|
+
}
|
|
101
|
+
shift() {
|
|
102
|
+
if (!this._head && !this._tail) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
if (!this._head || !this._tail) {
|
|
106
|
+
throw new Error('Invalid list');
|
|
107
|
+
}
|
|
108
|
+
const item = this._head;
|
|
109
|
+
this._map.delete(item.key);
|
|
110
|
+
this.removeItem(item);
|
|
111
|
+
this._size--;
|
|
112
|
+
return item.value;
|
|
113
|
+
}
|
|
114
|
+
forEach(callbackfn, thisArg) {
|
|
115
|
+
const state = this._state;
|
|
116
|
+
let current = this._head;
|
|
117
|
+
while (current) {
|
|
118
|
+
if (thisArg) {
|
|
119
|
+
callbackfn.bind(thisArg)(current.value, current.key, this);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
callbackfn(current.value, current.key, this);
|
|
123
|
+
}
|
|
124
|
+
if (this._state !== state) {
|
|
125
|
+
throw new Error(`LinkedMap got modified during iteration.`);
|
|
126
|
+
}
|
|
127
|
+
current = current.next;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
keys() {
|
|
131
|
+
const state = this._state;
|
|
132
|
+
let current = this._head;
|
|
133
|
+
const iterator = {
|
|
134
|
+
[Symbol.iterator]: () => {
|
|
135
|
+
return iterator;
|
|
136
|
+
},
|
|
137
|
+
next: () => {
|
|
138
|
+
if (this._state !== state) {
|
|
139
|
+
throw new Error(`LinkedMap got modified during iteration.`);
|
|
140
|
+
}
|
|
141
|
+
if (current) {
|
|
142
|
+
const result = { value: current.key, done: false };
|
|
143
|
+
current = current.next;
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
return { value: undefined, done: true };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
return iterator;
|
|
152
|
+
}
|
|
153
|
+
values() {
|
|
154
|
+
const state = this._state;
|
|
155
|
+
let current = this._head;
|
|
156
|
+
const iterator = {
|
|
157
|
+
[Symbol.iterator]: () => {
|
|
158
|
+
return iterator;
|
|
159
|
+
},
|
|
160
|
+
next: () => {
|
|
161
|
+
if (this._state !== state) {
|
|
162
|
+
throw new Error(`LinkedMap got modified during iteration.`);
|
|
163
|
+
}
|
|
164
|
+
if (current) {
|
|
165
|
+
const result = { value: current.value, done: false };
|
|
166
|
+
current = current.next;
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
return { value: undefined, done: true };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
return iterator;
|
|
175
|
+
}
|
|
176
|
+
entries() {
|
|
177
|
+
const state = this._state;
|
|
178
|
+
let current = this._head;
|
|
179
|
+
const iterator = {
|
|
180
|
+
[Symbol.iterator]: () => {
|
|
181
|
+
return iterator;
|
|
182
|
+
},
|
|
183
|
+
next: () => {
|
|
184
|
+
if (this._state !== state) {
|
|
185
|
+
throw new Error(`LinkedMap got modified during iteration.`);
|
|
186
|
+
}
|
|
187
|
+
if (current) {
|
|
188
|
+
const result = { value: [current.key, current.value], done: false };
|
|
189
|
+
current = current.next;
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
return { value: undefined, done: true };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
return iterator;
|
|
198
|
+
}
|
|
199
|
+
[(_a = Symbol.toStringTag, Symbol.iterator)]() {
|
|
200
|
+
return this.entries();
|
|
201
|
+
}
|
|
202
|
+
trimOld(newSize) {
|
|
203
|
+
if (newSize >= this.size) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (newSize === 0) {
|
|
207
|
+
this.clear();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
let current = this._head;
|
|
211
|
+
let currentSize = this.size;
|
|
212
|
+
while (current && currentSize > newSize) {
|
|
213
|
+
this._map.delete(current.key);
|
|
214
|
+
current = current.next;
|
|
215
|
+
currentSize--;
|
|
216
|
+
}
|
|
217
|
+
this._head = current;
|
|
218
|
+
this._size = currentSize;
|
|
219
|
+
if (current) {
|
|
220
|
+
current.previous = undefined;
|
|
221
|
+
}
|
|
222
|
+
this._state++;
|
|
223
|
+
}
|
|
224
|
+
addItemFirst(item) {
|
|
225
|
+
if (!this._head && !this._tail) {
|
|
226
|
+
this._tail = item;
|
|
227
|
+
}
|
|
228
|
+
else if (!this._head) {
|
|
229
|
+
throw new Error('Invalid list');
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
item.next = this._head;
|
|
233
|
+
this._head.previous = item;
|
|
234
|
+
}
|
|
235
|
+
this._head = item;
|
|
236
|
+
this._state++;
|
|
237
|
+
}
|
|
238
|
+
addItemLast(item) {
|
|
239
|
+
if (!this._head && !this._tail) {
|
|
240
|
+
this._head = item;
|
|
241
|
+
}
|
|
242
|
+
else if (!this._tail) {
|
|
243
|
+
throw new Error('Invalid list');
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
item.previous = this._tail;
|
|
247
|
+
this._tail.next = item;
|
|
248
|
+
}
|
|
249
|
+
this._tail = item;
|
|
250
|
+
this._state++;
|
|
251
|
+
}
|
|
252
|
+
removeItem(item) {
|
|
253
|
+
if (item === this._head && item === this._tail) {
|
|
254
|
+
this._head = undefined;
|
|
255
|
+
this._tail = undefined;
|
|
256
|
+
}
|
|
257
|
+
else if (item === this._head) {
|
|
258
|
+
if (!item.next) {
|
|
259
|
+
throw new Error('Invalid list');
|
|
260
|
+
}
|
|
261
|
+
item.next.previous = undefined;
|
|
262
|
+
this._head = item.next;
|
|
263
|
+
}
|
|
264
|
+
else if (item === this._tail) {
|
|
265
|
+
if (!item.previous) {
|
|
266
|
+
throw new Error('Invalid list');
|
|
267
|
+
}
|
|
268
|
+
item.previous.next = undefined;
|
|
269
|
+
this._tail = item.previous;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
const next = item.next;
|
|
273
|
+
const previous = item.previous;
|
|
274
|
+
if (!next || !previous) {
|
|
275
|
+
throw new Error('Invalid list');
|
|
276
|
+
}
|
|
277
|
+
next.previous = previous;
|
|
278
|
+
previous.next = next;
|
|
279
|
+
}
|
|
280
|
+
item.next = undefined;
|
|
281
|
+
item.previous = undefined;
|
|
282
|
+
this._state++;
|
|
283
|
+
}
|
|
284
|
+
touch(item, touch) {
|
|
285
|
+
if (!this._head || !this._tail) {
|
|
286
|
+
throw new Error('Invalid list');
|
|
287
|
+
}
|
|
288
|
+
if ((touch !== Touch.First && touch !== Touch.Last)) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (touch === Touch.First) {
|
|
292
|
+
if (item === this._head) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const next = item.next;
|
|
296
|
+
const previous = item.previous;
|
|
297
|
+
if (item === this._tail) {
|
|
298
|
+
previous.next = undefined;
|
|
299
|
+
this._tail = previous;
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
next.previous = previous;
|
|
303
|
+
previous.next = next;
|
|
304
|
+
}
|
|
305
|
+
item.previous = undefined;
|
|
306
|
+
item.next = this._head;
|
|
307
|
+
this._head.previous = item;
|
|
308
|
+
this._head = item;
|
|
309
|
+
this._state++;
|
|
310
|
+
}
|
|
311
|
+
else if (touch === Touch.Last) {
|
|
312
|
+
if (item === this._tail) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const next = item.next;
|
|
316
|
+
const previous = item.previous;
|
|
317
|
+
if (item === this._head) {
|
|
318
|
+
next.previous = undefined;
|
|
319
|
+
this._head = next;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
next.previous = previous;
|
|
323
|
+
previous.next = next;
|
|
324
|
+
}
|
|
325
|
+
item.next = undefined;
|
|
326
|
+
item.previous = this._tail;
|
|
327
|
+
this._tail.next = item;
|
|
328
|
+
this._tail = item;
|
|
329
|
+
this._state++;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
toJSON() {
|
|
333
|
+
const data = [];
|
|
334
|
+
this.forEach((value, key) => {
|
|
335
|
+
data.push([key, value]);
|
|
336
|
+
});
|
|
337
|
+
return data;
|
|
338
|
+
}
|
|
339
|
+
fromJSON(data) {
|
|
340
|
+
this.clear();
|
|
341
|
+
for (const [key, value] of data) {
|
|
342
|
+
this.set(key, value);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
exports.LinkedMap = LinkedMap;
|
|
347
|
+
class LRUCache extends LinkedMap {
|
|
348
|
+
constructor(limit, ratio = 1) {
|
|
349
|
+
super();
|
|
350
|
+
this._limit = limit;
|
|
351
|
+
this._ratio = Math.min(Math.max(0, ratio), 1);
|
|
352
|
+
}
|
|
353
|
+
get limit() {
|
|
354
|
+
return this._limit;
|
|
355
|
+
}
|
|
356
|
+
set limit(limit) {
|
|
357
|
+
this._limit = limit;
|
|
358
|
+
this.checkTrim();
|
|
359
|
+
}
|
|
360
|
+
get ratio() {
|
|
361
|
+
return this._ratio;
|
|
362
|
+
}
|
|
363
|
+
set ratio(ratio) {
|
|
364
|
+
this._ratio = Math.min(Math.max(0, ratio), 1);
|
|
365
|
+
this.checkTrim();
|
|
366
|
+
}
|
|
367
|
+
get(key, touch = Touch.AsNew) {
|
|
368
|
+
return super.get(key, touch);
|
|
369
|
+
}
|
|
370
|
+
peek(key) {
|
|
371
|
+
return super.get(key, Touch.None);
|
|
372
|
+
}
|
|
373
|
+
set(key, value) {
|
|
374
|
+
super.set(key, value, Touch.Last);
|
|
375
|
+
this.checkTrim();
|
|
376
|
+
return this;
|
|
377
|
+
}
|
|
378
|
+
checkTrim() {
|
|
379
|
+
if (this.size > this._limit) {
|
|
380
|
+
this.trimOld(Math.round(this._limit * this._ratio));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
exports.LRUCache = LRUCache;
|
|
385
|
+
} (linkedMap));
|
|
386
|
+
return linkedMap;
|
|
387
|
+
}
|
|
388
|
+
export { requireLinkedMap as __require };
|