@theia/core 1.45.0 → 1.46.0
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/README.md +6 -6
- package/i18n/nls.cs.json +4 -0
- package/i18n/nls.de.json +4 -0
- package/i18n/nls.es.json +4 -0
- package/i18n/nls.fr.json +4 -0
- package/i18n/nls.hu.json +4 -0
- package/i18n/nls.it.json +4 -0
- package/i18n/nls.ja.json +4 -0
- package/i18n/nls.json +4 -0
- package/i18n/nls.pl.json +4 -0
- package/i18n/nls.pt-br.json +4 -0
- package/i18n/nls.pt-pt.json +4 -0
- package/i18n/nls.ru.json +4 -0
- package/i18n/nls.zh-cn.json +4 -0
- package/lib/browser/browser.d.ts +3 -0
- package/lib/browser/browser.d.ts.map +1 -1
- package/lib/browser/browser.js +5 -1
- package/lib/browser/browser.js.map +1 -1
- package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/common-frontend-contribution.js +3 -3
- package/lib/browser/common-frontend-contribution.js.map +1 -1
- package/lib/browser/frontend-application-module.d.ts.map +1 -1
- package/lib/browser/frontend-application-module.js +2 -1
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/messaging/ws-connection-source.d.ts +2 -0
- package/lib/browser/messaging/ws-connection-source.d.ts.map +1 -1
- package/lib/browser/messaging/ws-connection-source.js +38 -22
- package/lib/browser/messaging/ws-connection-source.js.map +1 -1
- package/lib/browser/tree/index.d.ts +1 -0
- package/lib/browser/tree/index.d.ts.map +1 -1
- package/lib/browser/tree/index.js +1 -0
- package/lib/browser/tree/index.js.map +1 -1
- package/lib/browser/tree/tree-preference.d.ts +11 -0
- package/lib/browser/tree/tree-preference.d.ts.map +1 -0
- package/lib/browser/tree/tree-preference.js +47 -0
- package/lib/browser/tree/tree-preference.js.map +1 -0
- package/lib/browser/tree/tree-widget.d.ts +6 -3
- package/lib/browser/tree/tree-widget.d.ts.map +1 -1
- package/lib/browser/tree/tree-widget.js +24 -3
- package/lib/browser/tree/tree-widget.js.map +1 -1
- package/lib/browser/tree/tree.d.ts.map +1 -1
- package/lib/browser/tree/tree.js +4 -1
- package/lib/browser/tree/tree.js.map +1 -1
- package/lib/browser/widget-manager.d.ts +9 -0
- package/lib/browser/widget-manager.d.ts.map +1 -1
- package/lib/browser/widget-manager.js +23 -0
- package/lib/browser/widget-manager.js.map +1 -1
- package/lib/browser/widgets/select-component.d.ts.map +1 -1
- package/lib/browser/widgets/select-component.js +1 -0
- package/lib/browser/widgets/select-component.js.map +1 -1
- package/lib/browser-only/frontend-only-application-module.d.ts +5 -0
- package/lib/browser-only/frontend-only-application-module.d.ts.map +1 -0
- package/lib/browser-only/frontend-only-application-module.js +115 -0
- package/lib/browser-only/frontend-only-application-module.js.map +1 -0
- package/lib/browser-only/i18n/i18n-frontend-only-module.d.ts +4 -0
- package/lib/browser-only/i18n/i18n-frontend-only-module.d.ts.map +1 -0
- package/lib/browser-only/i18n/i18n-frontend-only-module.js +35 -0
- package/lib/browser-only/i18n/i18n-frontend-only-module.js.map +1 -0
- package/lib/browser-only/logger-frontend-only-module.d.ts +3 -0
- package/lib/browser-only/logger-frontend-only-module.d.ts.map +1 -0
- package/lib/browser-only/logger-frontend-only-module.js +61 -0
- package/lib/browser-only/logger-frontend-only-module.js.map +1 -0
- package/lib/browser-only/messaging/frontend-only-service-connection-provider.d.ts +14 -0
- package/lib/browser-only/messaging/frontend-only-service-connection-provider.d.ts.map +1 -0
- package/lib/browser-only/messaging/frontend-only-service-connection-provider.js +57 -0
- package/lib/browser-only/messaging/frontend-only-service-connection-provider.js.map +1 -0
- package/lib/browser-only/messaging/messaging-frontend-only-module.d.ts +3 -0
- package/lib/browser-only/messaging/messaging-frontend-only-module.d.ts.map +1 -0
- package/lib/browser-only/messaging/messaging-frontend-only-module.js +48 -0
- package/lib/browser-only/messaging/messaging-frontend-only-module.js.map +1 -0
- package/lib/browser-only/preload/frontend-only-preload-module.d.ts +4 -0
- package/lib/browser-only/preload/frontend-only-preload-module.d.ts.map +1 -0
- package/lib/browser-only/preload/frontend-only-preload-module.js +52 -0
- package/lib/browser-only/preload/frontend-only-preload-module.js.map +1 -0
- package/lib/common/application-protocol.d.ts +1 -0
- package/lib/common/application-protocol.d.ts.map +1 -1
- package/lib/common/disposable.d.ts +9 -0
- package/lib/common/disposable.d.ts.map +1 -1
- package/lib/common/disposable.js +26 -1
- package/lib/common/disposable.js.map +1 -1
- package/lib/{node → common}/file-uri.d.ts +1 -1
- package/lib/common/file-uri.d.ts.map +1 -0
- package/lib/{node → common}/file-uri.js +2 -2
- package/lib/common/file-uri.js.map +1 -0
- package/lib/common/menu/menu-model-registry.d.ts +2 -2
- package/lib/common/menu/menu-model-registry.d.ts.map +1 -1
- package/lib/common/menu/menu-model-registry.js +16 -2
- package/lib/common/menu/menu-model-registry.js.map +1 -1
- package/lib/common/menu/menu.spec.js +28 -1
- package/lib/common/menu/menu.spec.js.map +1 -1
- package/lib/common/message-rpc/msg-pack-extension-manager.d.ts +1 -1
- package/lib/common/message-rpc/msg-pack-extension-manager.js +1 -1
- package/lib/common/message-rpc/rpc-protocol.d.ts +3 -1
- package/lib/common/message-rpc/rpc-protocol.d.ts.map +1 -1
- package/lib/common/message-rpc/rpc-protocol.js +19 -1
- package/lib/common/message-rpc/rpc-protocol.js.map +1 -1
- package/lib/common/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/common/messaging/proxy-factory.js +1 -8
- package/lib/common/messaging/proxy-factory.js.map +1 -1
- package/lib/common/quick-pick-service.d.ts +1 -1
- package/lib/common/quick-pick-service.d.ts.map +1 -1
- package/lib/common/uuid.d.ts +6 -0
- package/lib/common/uuid.d.ts.map +1 -1
- package/lib/common/uuid.js +13 -1
- package/lib/common/uuid.js.map +1 -1
- package/lib/electron-main/electron-main-application.js +1 -1
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-main/theia-electron-window.js +1 -1
- package/lib/electron-main/theia-electron-window.js.map +1 -1
- package/lib/node/application-server.d.ts +1 -0
- package/lib/node/application-server.d.ts.map +1 -1
- package/lib/node/application-server.js +7 -1
- package/lib/node/application-server.js.map +1 -1
- package/lib/node/env-variables/env-variables-server.js +1 -1
- package/lib/node/env-variables/env-variables-server.js.map +1 -1
- package/lib/node/file-uri.spec.js +1 -1
- package/lib/node/file-uri.spec.js.map +1 -1
- package/lib/node/index.d.ts +1 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +1 -1
- package/lib/node/index.js.map +1 -1
- package/lib/node/messaging/websocket-frontend-connection-service.d.ts +2 -1
- package/lib/node/messaging/websocket-frontend-connection-service.d.ts.map +1 -1
- package/lib/node/messaging/websocket-frontend-connection-service.js +8 -3
- package/lib/node/messaging/websocket-frontend-connection-service.js.map +1 -1
- package/package.json +10 -6
- package/src/browser/browser.ts +6 -1
- package/src/browser/common-frontend-contribution.ts +3 -3
- package/src/browser/frontend-application-module.ts +2 -1
- package/src/browser/messaging/ws-connection-source.ts +41 -21
- package/src/browser/style/select-component.css +12 -13
- package/src/browser/tree/index.ts +1 -0
- package/src/browser/tree/tree-preference.ts +50 -0
- package/src/browser/tree/tree-widget.tsx +24 -5
- package/src/browser/tree/tree.ts +2 -1
- package/src/browser/widget-manager.ts +25 -0
- package/src/browser/widgets/select-component.tsx +1 -0
- package/src/browser-only/frontend-only-application-module.ts +115 -0
- package/src/browser-only/i18n/i18n-frontend-only-module.ts +37 -0
- package/src/browser-only/logger-frontend-only-module.ts +63 -0
- package/src/browser-only/messaging/frontend-only-service-connection-provider.ts +39 -0
- package/src/browser-only/messaging/messaging-frontend-only-module.ts +42 -0
- package/src/browser-only/preload/frontend-only-preload-module.ts +49 -0
- package/src/common/application-protocol.ts +1 -0
- package/src/common/disposable.ts +25 -0
- package/src/{node → common}/file-uri.ts +2 -2
- package/src/common/menu/menu-model-registry.ts +22 -5
- package/src/common/menu/menu.spec.ts +30 -2
- package/src/common/message-rpc/msg-pack-extension-manager.ts +1 -1
- package/src/common/message-rpc/rpc-protocol.ts +22 -2
- package/src/common/messaging/proxy-factory.ts +1 -8
- package/src/common/quick-pick-service.ts +1 -1
- package/src/common/uuid.ts +13 -0
- package/src/electron-main/electron-main-application.ts +1 -1
- package/src/electron-main/theia-electron-window.ts +1 -1
- package/src/node/application-server.ts +8 -1
- package/src/node/env-variables/env-variables-server.ts +1 -1
- package/src/node/file-uri.spec.ts +1 -1
- package/src/node/index.ts +1 -1
- package/src/node/messaging/websocket-frontend-connection-service.ts +10 -5
- package/lib/node/file-uri.d.ts.map +0 -1
- package/lib/node/file-uri.js.map +0 -1
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { CommandContribution, CommandRegistry } from '../command';
|
|
18
|
-
import { MenuContribution, MenuModelRegistry } from './menu-model-registry';
|
|
19
17
|
import * as chai from 'chai';
|
|
18
|
+
import { CommandContribution, CommandRegistry } from '../command';
|
|
20
19
|
import { CompositeMenuNode } from './composite-menu-node';
|
|
20
|
+
import { MenuContribution, MenuModelRegistry } from './menu-model-registry';
|
|
21
21
|
|
|
22
22
|
const expect = chai.expect;
|
|
23
23
|
|
|
@@ -61,6 +61,25 @@ describe('menu-model-registry', () => {
|
|
|
61
61
|
expect(openGroup.children.length).equals(2);
|
|
62
62
|
expect(openGroup.label).undefined;
|
|
63
63
|
});
|
|
64
|
+
|
|
65
|
+
it('Should not allow to register cyclic menus.', () => {
|
|
66
|
+
const fileMenu = ['main', 'File'];
|
|
67
|
+
const fileOpenMenu = [...fileMenu, '0_open'];
|
|
68
|
+
const fileCloseMenu = [...fileMenu, '1_close'];
|
|
69
|
+
const service = createMenuRegistry({
|
|
70
|
+
registerMenus(menuRegistry: MenuModelRegistry): void {
|
|
71
|
+
menuRegistry.registerSubmenu(fileMenu, 'File');
|
|
72
|
+
// open menu should not be added to open menu
|
|
73
|
+
menuRegistry.linkSubmenu(fileOpenMenu, fileOpenMenu);
|
|
74
|
+
// close menu should be added
|
|
75
|
+
menuRegistry.linkSubmenu(fileOpenMenu, fileCloseMenu);
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
registerCommands(reg: CommandRegistry): void { }
|
|
79
|
+
});
|
|
80
|
+
const all = service.getMenu() as CompositeMenuNode;
|
|
81
|
+
expect(menuStructureToString(all.children[0] as CompositeMenuNode)).equals('File(0_open(1_close),1_close())');
|
|
82
|
+
});
|
|
64
83
|
});
|
|
65
84
|
});
|
|
66
85
|
|
|
@@ -71,3 +90,12 @@ function createMenuRegistry(menuContrib: MenuContribution, commandContrib: Comma
|
|
|
71
90
|
menuReg.onStart();
|
|
72
91
|
return menuReg;
|
|
73
92
|
}
|
|
93
|
+
|
|
94
|
+
function menuStructureToString(node: CompositeMenuNode): string {
|
|
95
|
+
return node.children.map(c => {
|
|
96
|
+
if (c instanceof CompositeMenuNode) {
|
|
97
|
+
return `${c.id}(${menuStructureToString(c)})`;
|
|
98
|
+
}
|
|
99
|
+
return c.id;
|
|
100
|
+
}).join(',');
|
|
101
|
+
}
|
|
@@ -21,7 +21,7 @@ import { addExtension } from 'msgpackr';
|
|
|
21
21
|
* required for the default RPC communication. MsgPackR extensions
|
|
22
22
|
* are installed globally on both ends of the communication channel.
|
|
23
23
|
* (frontend-backend, pluginExt-pluginMain).
|
|
24
|
-
* Is implemented as singleton as it is
|
|
24
|
+
* Is implemented as singleton as it is also used in plugin child processes which have no access to inversify.
|
|
25
25
|
*/
|
|
26
26
|
export class MsgPackExtensionManager {
|
|
27
27
|
private static readonly INSTANCE = new MsgPackExtensionManager();
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
17
17
|
|
|
18
18
|
import { CancellationToken, CancellationTokenSource } from '../cancellation';
|
|
19
|
-
import { Disposable, DisposableCollection } from '../disposable';
|
|
19
|
+
import { DisposableWrapper, Disposable, DisposableCollection } from '../disposable';
|
|
20
20
|
import { Emitter, Event } from '../event';
|
|
21
21
|
import { Deferred } from '../promise-util';
|
|
22
22
|
import { Channel } from './channel';
|
|
@@ -57,6 +57,7 @@ export class RpcProtocol {
|
|
|
57
57
|
static readonly CANCELLATION_TOKEN_KEY = 'add.cancellation.token';
|
|
58
58
|
|
|
59
59
|
protected readonly pendingRequests: Map<number, Deferred<any>> = new Map();
|
|
60
|
+
protected readonly pendingRequestCancellationEventListeners: Map<number, DisposableWrapper> = new Map();
|
|
60
61
|
|
|
61
62
|
protected nextMessageId: number = 0;
|
|
62
63
|
|
|
@@ -80,6 +81,8 @@ export class RpcProtocol {
|
|
|
80
81
|
channel.onClose(event => {
|
|
81
82
|
this.pendingRequests.forEach(pending => pending.reject(new Error(event.reason)));
|
|
82
83
|
this.pendingRequests.clear();
|
|
84
|
+
this.pendingRequestCancellationEventListeners.forEach(disposable => disposable.dispose());
|
|
85
|
+
this.pendingRequestCancellationEventListeners.clear();
|
|
83
86
|
this.toDispose.dispose();
|
|
84
87
|
});
|
|
85
88
|
this.toDispose.push(channel.onMessage(readBuffer => this.handleMessage(this.decoder.parse(readBuffer()))));
|
|
@@ -131,6 +134,7 @@ export class RpcProtocol {
|
|
|
131
134
|
} else {
|
|
132
135
|
throw new Error(`No reply handler for reply with id: ${id}`);
|
|
133
136
|
}
|
|
137
|
+
this.disposeCancellationEventListener(id);
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
protected handleReplyErr(id: number, error: any): void {
|
|
@@ -141,6 +145,15 @@ export class RpcProtocol {
|
|
|
141
145
|
} else {
|
|
142
146
|
throw new Error(`No reply handler for error reply with id: ${id}`);
|
|
143
147
|
}
|
|
148
|
+
this.disposeCancellationEventListener(id);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
protected disposeCancellationEventListener(id: number): void {
|
|
152
|
+
const toDispose = this.pendingRequestCancellationEventListeners.get(id);
|
|
153
|
+
if (toDispose) {
|
|
154
|
+
this.pendingRequestCancellationEventListeners.delete(id);
|
|
155
|
+
toDispose.dispose();
|
|
156
|
+
}
|
|
144
157
|
}
|
|
145
158
|
|
|
146
159
|
sendRequest<T>(method: string, args: any[]): Promise<T> {
|
|
@@ -157,6 +170,10 @@ export class RpcProtocol {
|
|
|
157
170
|
|
|
158
171
|
this.pendingRequests.set(id, reply);
|
|
159
172
|
|
|
173
|
+
// register disposable before output.commit() even when not available yet
|
|
174
|
+
const disposableWrapper = new DisposableWrapper();
|
|
175
|
+
this.pendingRequestCancellationEventListeners.set(id, disposableWrapper);
|
|
176
|
+
|
|
160
177
|
const output = this.channel.getWriteBuffer();
|
|
161
178
|
this.encoder.request(output, id, method, args);
|
|
162
179
|
output.commit();
|
|
@@ -164,7 +181,10 @@ export class RpcProtocol {
|
|
|
164
181
|
if (cancellationToken?.isCancellationRequested) {
|
|
165
182
|
this.sendCancel(id);
|
|
166
183
|
} else {
|
|
167
|
-
cancellationToken?.onCancellationRequested(() => this.sendCancel(id));
|
|
184
|
+
const disposable = cancellationToken?.onCancellationRequested(() => this.sendCancel(id));
|
|
185
|
+
if (disposable) {
|
|
186
|
+
disposableWrapper.set(disposable);
|
|
187
|
+
}
|
|
168
188
|
}
|
|
169
189
|
|
|
170
190
|
return reply.promise;
|
|
@@ -168,14 +168,7 @@ export class RpcProxyFactory<T extends object> implements ProxyHandler<T> {
|
|
|
168
168
|
throw new Error(`no target was set to handle ${method}`);
|
|
169
169
|
}
|
|
170
170
|
} catch (error) {
|
|
171
|
-
|
|
172
|
-
if (e instanceof ResponseError) {
|
|
173
|
-
throw e;
|
|
174
|
-
}
|
|
175
|
-
const reason = e.message || '';
|
|
176
|
-
const stack = e.stack || '';
|
|
177
|
-
console.error(`Request ${method} failed with error: ${reason}`, stack);
|
|
178
|
-
throw e;
|
|
171
|
+
throw this.serializeError(error);
|
|
179
172
|
}
|
|
180
173
|
}
|
|
181
174
|
|
|
@@ -131,7 +131,7 @@ export namespace QuickInputButton {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
export interface QuickInputButtonHandle extends QuickInputButton {
|
|
134
|
-
|
|
134
|
+
handle: number; // index of where the button is in buttons array if QuickInputButton or -1 if QuickInputButtons.Back
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
export enum QuickInputHideReason {
|
package/src/common/uuid.ts
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
|
|
22
22
|
// based on https://github.com/microsoft/vscode/blob/1.72.2/src/vs/base/common/uuid.ts
|
|
23
23
|
|
|
24
|
+
import { v5 } from 'uuid';
|
|
25
|
+
|
|
24
26
|
const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
25
27
|
|
|
26
28
|
export function isUUID(value: string): boolean {
|
|
@@ -97,3 +99,14 @@ export const generateUuid = (function (): () => string {
|
|
|
97
99
|
return result;
|
|
98
100
|
};
|
|
99
101
|
})();
|
|
102
|
+
|
|
103
|
+
const NAMESPACE = '4c90ee4f-d952-44b1-83ca-f04121ab8e05';
|
|
104
|
+
/**
|
|
105
|
+
* This function will hash the given value using SHA1. The result will be a uuid.
|
|
106
|
+
* @param value the string to hash
|
|
107
|
+
* @returns a uuid
|
|
108
|
+
*/
|
|
109
|
+
export function hashValue(value: string): string {
|
|
110
|
+
// as opposed to v4, v5 is deterministic and uses SHA1 hashing
|
|
111
|
+
return v5(value, NAMESPACE);
|
|
112
|
+
}
|
|
@@ -24,7 +24,7 @@ import { existsSync, mkdirSync } from 'fs-extra';
|
|
|
24
24
|
import { fork, ForkOptions } from 'child_process';
|
|
25
25
|
import { DefaultTheme, FrontendApplicationConfig } from '@theia/application-package/lib/application-props';
|
|
26
26
|
import URI from '../common/uri';
|
|
27
|
-
import { FileUri } from '../
|
|
27
|
+
import { FileUri } from '../common/file-uri';
|
|
28
28
|
import { Deferred } from '../common/promise-util';
|
|
29
29
|
import { MaybePromise } from '../common/types';
|
|
30
30
|
import { ContributionProvider } from '../common/contribution-provider';
|
|
@@ -22,7 +22,7 @@ import { ElectronMainApplicationGlobals } from './electron-main-constants';
|
|
|
22
22
|
import { DisposableCollection, Emitter, Event } from '../common';
|
|
23
23
|
import { createDisposableListener } from './event-utils';
|
|
24
24
|
import { URI } from '../common/uri';
|
|
25
|
-
import { FileUri } from '../
|
|
25
|
+
import { FileUri } from '../common/file-uri';
|
|
26
26
|
import { TheiaRendererAPI } from './electron-api-main';
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -37,11 +37,18 @@ export class ApplicationServerImpl implements ApplicationServer {
|
|
|
37
37
|
const name = pck.name;
|
|
38
38
|
const version = pck.version;
|
|
39
39
|
|
|
40
|
-
return Promise.resolve({
|
|
40
|
+
return Promise.resolve({
|
|
41
|
+
name,
|
|
42
|
+
version
|
|
43
|
+
});
|
|
41
44
|
}
|
|
42
45
|
return Promise.resolve(undefined);
|
|
43
46
|
}
|
|
44
47
|
|
|
48
|
+
getApplicationRoot(): Promise<string> {
|
|
49
|
+
return Promise.resolve(this.applicationPackage.projectPath);
|
|
50
|
+
}
|
|
51
|
+
|
|
45
52
|
async getBackendOS(): Promise<OS.Type> {
|
|
46
53
|
return OS.type();
|
|
47
54
|
}
|
|
@@ -21,7 +21,7 @@ import * as drivelist from 'drivelist';
|
|
|
21
21
|
import { pathExists, mkdir } from 'fs-extra';
|
|
22
22
|
import { EnvVariable, EnvVariablesServer } from '../../common/env-variables';
|
|
23
23
|
import { isWindows } from '../../common/os';
|
|
24
|
-
import { FileUri } from '
|
|
24
|
+
import { FileUri } from '../../common/file-uri';
|
|
25
25
|
|
|
26
26
|
@injectable()
|
|
27
27
|
export class EnvVariablesServerImpl implements EnvVariablesServer {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import * as os from 'os';
|
|
18
18
|
import * as path from 'path';
|
|
19
19
|
import * as chai from 'chai';
|
|
20
|
-
import { FileUri } from '
|
|
20
|
+
import { FileUri } from '../common/file-uri';
|
|
21
21
|
import { isWindows } from '../common/os';
|
|
22
22
|
|
|
23
23
|
const expect = chai.expect;
|
package/src/node/index.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
export * from './backend-application';
|
|
18
18
|
export * from './debug';
|
|
19
|
-
export * from '
|
|
19
|
+
export * from '../common/file-uri';
|
|
20
20
|
export * from './messaging';
|
|
21
21
|
export * from './cli';
|
|
22
22
|
export { FileSystemLocking } from './filesystem-locking';
|
|
@@ -51,7 +51,9 @@ export class WebsocketFrontendConnectionService implements FrontendConnectionSer
|
|
|
51
51
|
if (this.connectionsByFrontend.has(frontEndId)) {
|
|
52
52
|
this.closeConnection(frontEndId, 'reconnecting same front end');
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
const channel = this.createConnection(socket, frontEndId);
|
|
55
|
+
this.handleSocketDisconnect(socket, channel, frontEndId);
|
|
56
|
+
channelCreatedHandler(channel);
|
|
55
57
|
socket.emit(ConnectionManagementMessages.INITIAL_CONNECT);
|
|
56
58
|
};
|
|
57
59
|
|
|
@@ -63,6 +65,7 @@ export class WebsocketFrontendConnectionService implements FrontendConnectionSer
|
|
|
63
65
|
console.info(`Reconnecting to front end ${frontEndId}`);
|
|
64
66
|
socket.emit(ConnectionManagementMessages.RECONNECT, true);
|
|
65
67
|
channel.connect(socket);
|
|
68
|
+
this.handleSocketDisconnect(socket, channel, frontEndId);
|
|
66
69
|
const pendingTimeout = this.closeTimeouts.get(frontEndId);
|
|
67
70
|
clearTimeout(pendingTimeout);
|
|
68
71
|
this.closeTimeouts.delete(frontEndId);
|
|
@@ -89,11 +92,16 @@ export class WebsocketFrontendConnectionService implements FrontendConnectionSer
|
|
|
89
92
|
connection.close();
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
protected createConnection(socket: Socket, frontEndId: string):
|
|
95
|
+
protected createConnection(socket: Socket, frontEndId: string): ReconnectableSocketChannel {
|
|
93
96
|
console.info(`creating connection for ${frontEndId}`);
|
|
94
97
|
const channel = new ReconnectableSocketChannel();
|
|
95
98
|
channel.connect(socket);
|
|
96
99
|
|
|
100
|
+
this.connectionsByFrontend.set(frontEndId, channel);
|
|
101
|
+
return channel;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
handleSocketDisconnect(socket: Socket, channel: ReconnectableSocketChannel, frontEndId: string): void {
|
|
97
105
|
socket.on('disconnect', evt => {
|
|
98
106
|
console.info('socked closed');
|
|
99
107
|
channel.disconnect();
|
|
@@ -111,9 +119,6 @@ export class WebsocketFrontendConnectionService implements FrontendConnectionSer
|
|
|
111
119
|
// timeout < 0: never close the back end
|
|
112
120
|
}
|
|
113
121
|
});
|
|
114
|
-
|
|
115
|
-
this.connectionsByFrontend.set(frontEndId, channel);
|
|
116
|
-
return channel;
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
markForClose(channelId: string): void {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-uri.d.ts","sourceRoot":"","sources":["../../src/node/file-uri.ts"],"names":[],"mappings":"AAiBA,OAAO,GAAG,MAAM,eAAe,CAAC;AAGhC,yBAAiB,OAAO,CAAC;IAIrB;;;OAGG;IACH,SAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAE3C;IAED;;;;OAIG;IACH,SAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAqBhD;CAEJ"}
|
package/lib/node/file-uri.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-uri.js","sourceRoot":"","sources":["../../src/node/file-uri.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,2CAAwC;AACxC,uCAAgC;AAChC,qCAAyC;AAEzC,IAAiB,OAAO,CAwCvB;AAxCD,WAAiB,OAAO;IAEpB,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;IAE3C;;;OAGG;IACH,SAAgB,MAAM,CAAC,OAAe;QAClC,OAAO,IAAI,aAAG,CAAC,gBAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACtC,CAAC;IAFe,cAAM,SAErB,CAAA;IAED;;;;OAIG;IACH,SAAgB,MAAM,CAAC,GAAiB;QACpC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YACzB,OAAO,MAAM,CAAC,IAAI,aAAG,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/B;aAAM;YACH;;;;;;eAMG;YACH,8DAA8D;YAC9D,MAAM,mBAAmB,GAAI,GAAW,CAAC,OAAO,CAAC,MAAM,CAAC;YACxD,IAAI,cAAS,EAAE;gBACX,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBACvE,IAAI,kBAAkB,EAAE;oBACpB,OAAO,mBAAmB,GAAG,IAAI,CAAC;iBACrC;aACJ;YACD,OAAO,mBAAmB,CAAC;SAC9B;IACL,CAAC;IArBe,cAAM,SAqBrB,CAAA;AAEL,CAAC,EAxCgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAwCvB"}
|