@theia/remote 1.67.0-next.13 → 1.67.0-next.56
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 +1 -1
- package/package.json +6 -6
- package/src/electron-browser/port-forwarding/port-forwarding-service.ts +1 -1
- package/src/electron-browser/port-forwarding/port-forwarding-widget.tsx +1 -1
- package/lib/electron-browser/local-backend-services.d.ts +0 -11
- package/lib/electron-browser/local-backend-services.d.ts.map +0 -1
- package/lib/electron-browser/local-backend-services.js +0 -37
- package/lib/electron-browser/local-backend-services.js.map +0 -1
- package/lib/electron-browser/port-forwarding/port-forwading-contribution.d.ts +0 -6
- package/lib/electron-browser/port-forwarding/port-forwading-contribution.d.ts.map +0 -1
- package/lib/electron-browser/port-forwarding/port-forwading-contribution.js +0 -40
- package/lib/electron-browser/port-forwarding/port-forwading-contribution.js.map +0 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-service.d.ts +0 -20
- package/lib/electron-browser/port-forwarding/port-forwarding-service.d.ts.map +0 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-service.js +0 -89
- package/lib/electron-browser/port-forwarding/port-forwarding-service.js.map +0 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-widget.d.ts +0 -17
- package/lib/electron-browser/port-forwarding/port-forwarding-widget.d.ts.map +0 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-widget.js +0 -125
- package/lib/electron-browser/port-forwarding/port-forwarding-widget.js.map +0 -1
- package/lib/electron-browser/remote-electron-file-dialog-service.d.ts +0 -14
- package/lib/electron-browser/remote-electron-file-dialog-service.d.ts.map +0 -1
- package/lib/electron-browser/remote-electron-file-dialog-service.js +0 -50
- package/lib/electron-browser/remote-electron-file-dialog-service.js.map +0 -1
- package/lib/electron-browser/remote-frontend-contribution.d.ts +0 -26
- package/lib/electron-browser/remote-frontend-contribution.d.ts.map +0 -1
- package/lib/electron-browser/remote-frontend-contribution.js +0 -160
- package/lib/electron-browser/remote-frontend-contribution.js.map +0 -1
- package/lib/electron-browser/remote-frontend-module.d.ts +0 -5
- package/lib/electron-browser/remote-frontend-module.d.ts.map +0 -1
- package/lib/electron-browser/remote-frontend-module.js +0 -70
- package/lib/electron-browser/remote-frontend-module.js.map +0 -1
- package/lib/electron-browser/remote-registry-contribution.d.ts +0 -19
- package/lib/electron-browser/remote-registry-contribution.d.ts.map +0 -1
- package/lib/electron-browser/remote-registry-contribution.js +0 -70
- package/lib/electron-browser/remote-registry-contribution.js.map +0 -1
- package/lib/electron-browser/remote-service.d.ts +0 -6
- package/lib/electron-browser/remote-service.d.ts.map +0 -1
- package/lib/electron-browser/remote-service.js +0 -33
- package/lib/electron-browser/remote-service.js.map +0 -1
- package/lib/electron-browser/remote-ssh-contribution.d.ts +0 -23
- package/lib/electron-browser/remote-ssh-contribution.d.ts.map +0 -1
- package/lib/electron-browser/remote-ssh-contribution.js +0 -183
- package/lib/electron-browser/remote-ssh-contribution.js.map +0 -1
- package/lib/electron-browser/remote-user-storage-provider.d.ts +0 -21
- package/lib/electron-browser/remote-user-storage-provider.d.ts.map +0 -1
- package/lib/electron-browser/remote-user-storage-provider.js +0 -75
- package/lib/electron-browser/remote-user-storage-provider.js.map +0 -1
- package/lib/electron-common/remote-port-forwarding-provider.d.ts +0 -12
- package/lib/electron-common/remote-port-forwarding-provider.d.ts.map +0 -1
- package/lib/electron-common/remote-port-forwarding-provider.js +0 -21
- package/lib/electron-common/remote-port-forwarding-provider.js.map +0 -1
- package/lib/electron-common/remote-preferences.d.ts +0 -13
- package/lib/electron-common/remote-preferences.d.ts.map +0 -1
- package/lib/electron-common/remote-preferences.js +0 -54
- package/lib/electron-common/remote-preferences.js.map +0 -1
- package/lib/electron-common/remote-ssh-connection-provider.d.ts +0 -16
- package/lib/electron-common/remote-ssh-connection-provider.d.ts.map +0 -1
- package/lib/electron-common/remote-ssh-connection-provider.js +0 -21
- package/lib/electron-common/remote-ssh-connection-provider.js.map +0 -1
- package/lib/electron-common/remote-status-service.d.ts +0 -16
- package/lib/electron-common/remote-status-service.d.ts.map +0 -1
- package/lib/electron-common/remote-status-service.js +0 -21
- package/lib/electron-common/remote-status-service.js.map +0 -1
- package/lib/electron-node/backend-remote-service-impl.d.ts +0 -12
- package/lib/electron-node/backend-remote-service-impl.d.ts.map +0 -1
- package/lib/electron-node/backend-remote-service-impl.js +0 -46
- package/lib/electron-node/backend-remote-service-impl.js.map +0 -1
- package/lib/electron-node/remote-backend-module.d.ts +0 -5
- package/lib/electron-node/remote-backend-module.d.ts.map +0 -1
- package/lib/electron-node/remote-backend-module.js +0 -83
- package/lib/electron-node/remote-backend-module.js.map +0 -1
- package/lib/electron-node/remote-connection-service.d.ts +0 -15
- package/lib/electron-node/remote-connection-service.d.ts.map +0 -1
- package/lib/electron-node/remote-connection-service.js +0 -64
- package/lib/electron-node/remote-connection-service.js.map +0 -1
- package/lib/electron-node/remote-connection-socket-provider.d.ts +0 -9
- package/lib/electron-node/remote-connection-socket-provider.d.ts.map +0 -1
- package/lib/electron-node/remote-connection-socket-provider.js +0 -33
- package/lib/electron-node/remote-connection-socket-provider.js.map +0 -1
- package/lib/electron-node/remote-port-forwarding-provider.d.ts +0 -19
- package/lib/electron-node/remote-port-forwarding-provider.d.ts.map +0 -1
- package/lib/electron-node/remote-port-forwarding-provider.js +0 -59
- package/lib/electron-node/remote-port-forwarding-provider.js.map +0 -1
- package/lib/electron-node/remote-proxy-server-provider.d.ts +0 -6
- package/lib/electron-node/remote-proxy-server-provider.d.ts.map +0 -1
- package/lib/electron-node/remote-proxy-server-provider.js +0 -39
- package/lib/electron-node/remote-proxy-server-provider.js.map +0 -1
- package/lib/electron-node/remote-status-service.d.ts +0 -8
- package/lib/electron-node/remote-status-service.d.ts.map +0 -1
- package/lib/electron-node/remote-status-service.js +0 -53
- package/lib/electron-node/remote-status-service.js.map +0 -1
- package/lib/electron-node/remote-types.d.ts +0 -49
- package/lib/electron-node/remote-types.d.ts.map +0 -1
- package/lib/electron-node/remote-types.js +0 -18
- package/lib/electron-node/remote-types.js.map +0 -1
- package/lib/electron-node/setup/app-native-dependency-contribution.d.ts +0 -8
- package/lib/electron-node/setup/app-native-dependency-contribution.d.ts.map +0 -1
- package/lib/electron-node/setup/app-native-dependency-contribution.js +0 -53
- package/lib/electron-node/setup/app-native-dependency-contribution.js.map +0 -1
- package/lib/electron-node/setup/main-copy-contribution.d.ts +0 -5
- package/lib/electron-node/setup/main-copy-contribution.d.ts.map +0 -1
- package/lib/electron-node/setup/main-copy-contribution.js +0 -33
- package/lib/electron-node/setup/main-copy-contribution.js.map +0 -1
- package/lib/electron-node/setup/remote-copy-contribution.d.ts +0 -13
- package/lib/electron-node/setup/remote-copy-contribution.d.ts.map +0 -1
- package/lib/electron-node/setup/remote-copy-contribution.js +0 -74
- package/lib/electron-node/setup/remote-copy-contribution.js.map +0 -1
- package/lib/electron-node/setup/remote-copy-service.d.ts +0 -21
- package/lib/electron-node/setup/remote-copy-service.d.ts.map +0 -1
- package/lib/electron-node/setup/remote-copy-service.js +0 -120
- package/lib/electron-node/setup/remote-copy-service.js.map +0 -1
- package/lib/electron-node/setup/remote-native-dependency-contribution.d.ts +0 -36
- package/lib/electron-node/setup/remote-native-dependency-contribution.d.ts.map +0 -1
- package/lib/electron-node/setup/remote-native-dependency-contribution.js +0 -35
- package/lib/electron-node/setup/remote-native-dependency-contribution.js.map +0 -1
- package/lib/electron-node/setup/remote-native-dependency-service.d.ts +0 -25
- package/lib/electron-node/setup/remote-native-dependency-service.d.ts.map +0 -1
- package/lib/electron-node/setup/remote-native-dependency-service.js +0 -116
- package/lib/electron-node/setup/remote-native-dependency-service.js.map +0 -1
- package/lib/electron-node/setup/remote-node-setup-service.d.ts +0 -23
- package/lib/electron-node/setup/remote-node-setup-service.d.ts.map +0 -1
- package/lib/electron-node/setup/remote-node-setup-service.js +0 -125
- package/lib/electron-node/setup/remote-node-setup-service.js.map +0 -1
- package/lib/electron-node/setup/remote-setup-script-service.d.ts +0 -41
- package/lib/electron-node/setup/remote-setup-script-service.d.ts.map +0 -1
- package/lib/electron-node/setup/remote-setup-script-service.js +0 -125
- package/lib/electron-node/setup/remote-setup-script-service.js.map +0 -1
- package/lib/electron-node/setup/remote-setup-service.d.ts +0 -36
- package/lib/electron-node/setup/remote-setup-service.d.ts.map +0 -1
- package/lib/electron-node/setup/remote-setup-service.js +0 -215
- package/lib/electron-node/setup/remote-setup-service.js.map +0 -1
- package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts +0 -60
- package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts.map +0 -1
- package/lib/electron-node/ssh/remote-ssh-connection-provider.js +0 -394
- package/lib/electron-node/ssh/remote-ssh-connection-provider.js.map +0 -1
- package/lib/electron-node/ssh/ssh-identity-file-collector.d.ts +0 -13
- package/lib/electron-node/ssh/ssh-identity-file-collector.d.ts.map +0 -1
- package/lib/electron-node/ssh/ssh-identity-file-collector.js +0 -127
- package/lib/electron-node/ssh/ssh-identity-file-collector.js.map +0 -1
- package/lib/package.spec.d.ts +0 -1
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2023 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.RemoteSSHConnection = exports.RemoteSSHConnectionProviderImpl = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const ssh2 = require("ssh2");
|
|
21
|
-
const fs = require("@theia/core/shared/fs-extra");
|
|
22
|
-
const SftpClient = require("ssh2-sftp-client");
|
|
23
|
-
const ssh_config_1 = require("ssh-config");
|
|
24
|
-
const core_1 = require("@theia/core");
|
|
25
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
-
const remote_connection_service_1 = require("../remote-connection-service");
|
|
27
|
-
const remote_proxy_server_provider_1 = require("../remote-proxy-server-provider");
|
|
28
|
-
const promise_util_1 = require("@theia/core/lib/common/promise-util");
|
|
29
|
-
const ssh_identity_file_collector_1 = require("./ssh-identity-file-collector");
|
|
30
|
-
const remote_setup_service_1 = require("../setup/remote-setup-service");
|
|
31
|
-
const uuid_1 = require("@theia/core/lib/common/uuid");
|
|
32
|
-
let RemoteSSHConnectionProviderImpl = class RemoteSSHConnectionProviderImpl {
|
|
33
|
-
constructor() {
|
|
34
|
-
this.passwordRetryCount = 3;
|
|
35
|
-
this.passphraseRetryCount = 3;
|
|
36
|
-
}
|
|
37
|
-
async matchSSHConfigHost(host, user, customConfigFile) {
|
|
38
|
-
const sshConfig = await this.doGetSSHConfig(customConfigFile);
|
|
39
|
-
const host2 = host.trim().split(':');
|
|
40
|
-
const record = Object.fromEntries(Object.entries(sshConfig.compute(host2[0])).map(([k, v]) => [k.toLowerCase(), v]));
|
|
41
|
-
// Generate a regexp to find wildcards and process the hostname with the wildcards
|
|
42
|
-
if (record.host) {
|
|
43
|
-
const checkHost = new RegExp('^' + record.host
|
|
44
|
-
.replace(/([^\w\*\?])/g, '\\$1')
|
|
45
|
-
.replace(/([\?]+)/g, (...m) => '(' + '.'.repeat(m[1].length) + ')')
|
|
46
|
-
.replace(/\*/g, '(.+)') + '$');
|
|
47
|
-
const match = host2[0].match(checkHost);
|
|
48
|
-
if (match) {
|
|
49
|
-
if (record.hostname) {
|
|
50
|
-
record.hostname = record.hostname.replace('%h', match[1]);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (host2[1]) {
|
|
54
|
-
record.port = host2[1];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return record;
|
|
58
|
-
}
|
|
59
|
-
async getSSHConfig(customConfigFile) {
|
|
60
|
-
return this.doGetSSHConfig(customConfigFile);
|
|
61
|
-
}
|
|
62
|
-
async doGetSSHConfig(customConfigFile) {
|
|
63
|
-
const empty = new ssh_config_1.default();
|
|
64
|
-
if (!customConfigFile) {
|
|
65
|
-
return empty;
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
const buff = await fs.promises.readFile(customConfigFile);
|
|
69
|
-
const sshConfig = ssh_config_1.default.parse(buff.toString());
|
|
70
|
-
return sshConfig;
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
return empty;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async establishConnection(options) {
|
|
77
|
-
const progress = await this.messageService.showProgress({
|
|
78
|
-
text: 'Remote SSH'
|
|
79
|
-
});
|
|
80
|
-
const report = message => progress.report({ message });
|
|
81
|
-
report('Connecting to remote system...');
|
|
82
|
-
try {
|
|
83
|
-
const remote = await this.establishSSHConnection(options.host, options.user, options.customConfigFile);
|
|
84
|
-
await this.remoteSetup.setup({
|
|
85
|
-
connection: remote,
|
|
86
|
-
report,
|
|
87
|
-
nodeDownloadTemplate: options.nodeDownloadTemplate
|
|
88
|
-
});
|
|
89
|
-
const registration = this.remoteConnectionService.register(remote);
|
|
90
|
-
const server = await this.serverProvider.getProxyServer(socket => {
|
|
91
|
-
remote.forwardOut(socket);
|
|
92
|
-
});
|
|
93
|
-
remote.onDidDisconnect(() => {
|
|
94
|
-
server.close();
|
|
95
|
-
registration.dispose();
|
|
96
|
-
});
|
|
97
|
-
const localPort = server.address().port;
|
|
98
|
-
remote.localPort = localPort;
|
|
99
|
-
return localPort.toString();
|
|
100
|
-
}
|
|
101
|
-
finally {
|
|
102
|
-
progress.cancel();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async establishSSHConnection(host, user, customConfigFile) {
|
|
106
|
-
const deferred = new promise_util_1.Deferred();
|
|
107
|
-
const sshClient = new ssh2.Client();
|
|
108
|
-
const sshHostConfig = await this.matchSSHConfigHost(host, user, customConfigFile);
|
|
109
|
-
const identityFiles = await this.identityFileCollector.gatherIdentityFiles(undefined, sshHostConfig === null || sshHostConfig === void 0 ? void 0 : sshHostConfig.identityfile);
|
|
110
|
-
let algorithms = undefined;
|
|
111
|
-
if (sshHostConfig) {
|
|
112
|
-
if (!user && sshHostConfig.user) {
|
|
113
|
-
user = sshHostConfig.user;
|
|
114
|
-
}
|
|
115
|
-
if (sshHostConfig.hostname) {
|
|
116
|
-
host = sshHostConfig.hostname + ':' + (sshHostConfig.port || '22');
|
|
117
|
-
}
|
|
118
|
-
else if (sshHostConfig.port) {
|
|
119
|
-
host = sshHostConfig.host + ':' + (sshHostConfig.port || '22');
|
|
120
|
-
}
|
|
121
|
-
if (sshHostConfig.compression && sshHostConfig.compression.toLowerCase() === 'yes') {
|
|
122
|
-
algorithms = { compress: ['zlib@openssh.com', 'zlib'] };
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const hostUrl = new URL(`ssh://${host}`);
|
|
126
|
-
const sshAuthHandler = this.getAuthHandler(user, hostUrl.hostname, identityFiles);
|
|
127
|
-
sshClient
|
|
128
|
-
.on('ready', async () => {
|
|
129
|
-
const connection = new RemoteSSHConnection({
|
|
130
|
-
client: sshClient,
|
|
131
|
-
id: (0, uuid_1.generateUuid)(),
|
|
132
|
-
name: hostUrl.hostname,
|
|
133
|
-
type: 'SSH'
|
|
134
|
-
});
|
|
135
|
-
try {
|
|
136
|
-
await this.testConnection(connection);
|
|
137
|
-
deferred.resolve(connection);
|
|
138
|
-
}
|
|
139
|
-
catch (err) {
|
|
140
|
-
deferred.reject(err);
|
|
141
|
-
}
|
|
142
|
-
}).on('end', () => {
|
|
143
|
-
console.log(`Ended remote connection to host '${user}@${hostUrl.hostname}'`);
|
|
144
|
-
}).on('error', err => {
|
|
145
|
-
deferred.reject(err);
|
|
146
|
-
}).connect({
|
|
147
|
-
host: hostUrl.hostname,
|
|
148
|
-
port: hostUrl.port ? parseInt(hostUrl.port, 10) : undefined,
|
|
149
|
-
username: user,
|
|
150
|
-
algorithms: algorithms,
|
|
151
|
-
authHandler: (methodsLeft, successes, callback) => (sshAuthHandler(methodsLeft, successes, callback), undefined)
|
|
152
|
-
});
|
|
153
|
-
return deferred.promise;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Sometimes, ssh2.exec will not execute and retrieve any data right after the `ready` event fired.
|
|
157
|
-
* In this method, we just perform `echo hello` in a loop to ensure that the connection is really ready.
|
|
158
|
-
* See also https://github.com/mscdex/ssh2/issues/48
|
|
159
|
-
*/
|
|
160
|
-
async testConnection(connection) {
|
|
161
|
-
for (let i = 0; i < 100; i++) {
|
|
162
|
-
const result = await connection.exec('echo hello');
|
|
163
|
-
if (result.stdout.includes('hello')) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
await (0, promise_util_1.timeout)(50);
|
|
167
|
-
}
|
|
168
|
-
throw new Error('SSH connection failed testing. Could not execute "echo"');
|
|
169
|
-
}
|
|
170
|
-
getAuthHandler(user, host, identityKeys) {
|
|
171
|
-
let passwordRetryCount = this.passwordRetryCount;
|
|
172
|
-
let keyboardRetryCount = this.passphraseRetryCount;
|
|
173
|
-
// `false` is a valid return value, indicating that the authentication has failed
|
|
174
|
-
const END_AUTH = false;
|
|
175
|
-
// `null` indicates that we just want to continue with the next auth type
|
|
176
|
-
// eslint-disable-next-line no-null/no-null
|
|
177
|
-
const NEXT_AUTH = null;
|
|
178
|
-
return async (methodsLeft, _partialSuccess, callback) => {
|
|
179
|
-
if (!methodsLeft) {
|
|
180
|
-
return callback({
|
|
181
|
-
type: 'none',
|
|
182
|
-
username: user,
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
if (methodsLeft && methodsLeft.includes('publickey') && identityKeys.length) {
|
|
186
|
-
const identityKey = identityKeys.shift();
|
|
187
|
-
if (identityKey.isPrivate) {
|
|
188
|
-
return callback({
|
|
189
|
-
type: 'publickey',
|
|
190
|
-
username: user,
|
|
191
|
-
key: identityKey.parsedKey
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (!await fs.pathExists(identityKey.filename)) {
|
|
195
|
-
// Try next identity file
|
|
196
|
-
return callback(NEXT_AUTH);
|
|
197
|
-
}
|
|
198
|
-
const keyBuffer = await fs.promises.readFile(identityKey.filename);
|
|
199
|
-
let result = ssh2.utils.parseKey(keyBuffer); // First try without passphrase
|
|
200
|
-
if (result instanceof Error && result.message.match(/no passphrase given/)) {
|
|
201
|
-
let passphraseRetryCount = this.passphraseRetryCount;
|
|
202
|
-
while (result instanceof Error && passphraseRetryCount > 0) {
|
|
203
|
-
const passphrase = await this.quickInputService.input({
|
|
204
|
-
title: `Enter passphrase for ${identityKey.filename}`,
|
|
205
|
-
password: true
|
|
206
|
-
});
|
|
207
|
-
if (!passphrase) {
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
result = ssh2.utils.parseKey(keyBuffer, passphrase);
|
|
211
|
-
passphraseRetryCount--;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
if (!result || result instanceof Error) {
|
|
215
|
-
// Try next identity file
|
|
216
|
-
return callback(NEXT_AUTH);
|
|
217
|
-
}
|
|
218
|
-
const key = Array.isArray(result) ? result[0] : result;
|
|
219
|
-
return callback({
|
|
220
|
-
type: 'publickey',
|
|
221
|
-
username: user,
|
|
222
|
-
key
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
if (methodsLeft && methodsLeft.includes('password') && passwordRetryCount > 0) {
|
|
226
|
-
const password = await this.quickInputService.input({
|
|
227
|
-
title: `Enter password for ${user}@${host}`,
|
|
228
|
-
password: true
|
|
229
|
-
});
|
|
230
|
-
passwordRetryCount--;
|
|
231
|
-
return callback(password
|
|
232
|
-
? {
|
|
233
|
-
type: 'password',
|
|
234
|
-
username: user,
|
|
235
|
-
password
|
|
236
|
-
}
|
|
237
|
-
: END_AUTH);
|
|
238
|
-
}
|
|
239
|
-
if (methodsLeft && methodsLeft.includes('keyboard-interactive') && keyboardRetryCount > 0) {
|
|
240
|
-
return callback({
|
|
241
|
-
type: 'keyboard-interactive',
|
|
242
|
-
username: user,
|
|
243
|
-
prompt: async (_name, _instructions, _instructionsLang, prompts, finish) => {
|
|
244
|
-
const responses = [];
|
|
245
|
-
for (const prompt of prompts) {
|
|
246
|
-
const response = await this.quickInputService.input({
|
|
247
|
-
title: `(${user}@${host}) ${prompt.prompt}`,
|
|
248
|
-
password: !prompt.echo
|
|
249
|
-
});
|
|
250
|
-
if (response === undefined) {
|
|
251
|
-
keyboardRetryCount = 0;
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
responses.push(response);
|
|
255
|
-
}
|
|
256
|
-
keyboardRetryCount--;
|
|
257
|
-
finish(responses);
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
callback(END_AUTH);
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
exports.RemoteSSHConnectionProviderImpl = RemoteSSHConnectionProviderImpl;
|
|
266
|
-
tslib_1.__decorate([
|
|
267
|
-
(0, inversify_1.inject)(remote_connection_service_1.RemoteConnectionService),
|
|
268
|
-
tslib_1.__metadata("design:type", remote_connection_service_1.RemoteConnectionService)
|
|
269
|
-
], RemoteSSHConnectionProviderImpl.prototype, "remoteConnectionService", void 0);
|
|
270
|
-
tslib_1.__decorate([
|
|
271
|
-
(0, inversify_1.inject)(remote_proxy_server_provider_1.RemoteProxyServerProvider),
|
|
272
|
-
tslib_1.__metadata("design:type", remote_proxy_server_provider_1.RemoteProxyServerProvider)
|
|
273
|
-
], RemoteSSHConnectionProviderImpl.prototype, "serverProvider", void 0);
|
|
274
|
-
tslib_1.__decorate([
|
|
275
|
-
(0, inversify_1.inject)(ssh_identity_file_collector_1.SSHIdentityFileCollector),
|
|
276
|
-
tslib_1.__metadata("design:type", ssh_identity_file_collector_1.SSHIdentityFileCollector)
|
|
277
|
-
], RemoteSSHConnectionProviderImpl.prototype, "identityFileCollector", void 0);
|
|
278
|
-
tslib_1.__decorate([
|
|
279
|
-
(0, inversify_1.inject)(remote_setup_service_1.RemoteSetupService),
|
|
280
|
-
tslib_1.__metadata("design:type", remote_setup_service_1.RemoteSetupService)
|
|
281
|
-
], RemoteSSHConnectionProviderImpl.prototype, "remoteSetup", void 0);
|
|
282
|
-
tslib_1.__decorate([
|
|
283
|
-
(0, inversify_1.inject)(core_1.QuickInputService),
|
|
284
|
-
tslib_1.__metadata("design:type", Object)
|
|
285
|
-
], RemoteSSHConnectionProviderImpl.prototype, "quickInputService", void 0);
|
|
286
|
-
tslib_1.__decorate([
|
|
287
|
-
(0, inversify_1.inject)(core_1.MessageService),
|
|
288
|
-
tslib_1.__metadata("design:type", core_1.MessageService)
|
|
289
|
-
], RemoteSSHConnectionProviderImpl.prototype, "messageService", void 0);
|
|
290
|
-
exports.RemoteSSHConnectionProviderImpl = RemoteSSHConnectionProviderImpl = tslib_1.__decorate([
|
|
291
|
-
(0, inversify_1.injectable)()
|
|
292
|
-
], RemoteSSHConnectionProviderImpl);
|
|
293
|
-
class RemoteSSHConnection {
|
|
294
|
-
get onDidDisconnect() {
|
|
295
|
-
return this.onDidDisconnectEmitter.event;
|
|
296
|
-
}
|
|
297
|
-
constructor(options) {
|
|
298
|
-
this.localPort = 0;
|
|
299
|
-
this.remotePort = 0;
|
|
300
|
-
this.onDidDisconnectEmitter = new core_1.Emitter();
|
|
301
|
-
this.id = options.id;
|
|
302
|
-
this.type = options.type;
|
|
303
|
-
this.name = options.name;
|
|
304
|
-
this.client = options.client;
|
|
305
|
-
this.onDidDisconnect(() => this.dispose());
|
|
306
|
-
this.client.on('end', () => {
|
|
307
|
-
this.onDidDisconnectEmitter.fire();
|
|
308
|
-
});
|
|
309
|
-
this.sftpClientPromise = this.setupSftpClient();
|
|
310
|
-
}
|
|
311
|
-
async setupSftpClient() {
|
|
312
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
313
|
-
const sftpClient = new SftpClient();
|
|
314
|
-
// A hack to set the internal ssh2 client of the sftp client
|
|
315
|
-
// That way, we don't have to create a second connection
|
|
316
|
-
sftpClient.client = this.client;
|
|
317
|
-
// Calling this function establishes the sftp connection on the ssh client
|
|
318
|
-
await sftpClient.getSftpChannel();
|
|
319
|
-
return sftpClient;
|
|
320
|
-
}
|
|
321
|
-
forwardOut(socket, port) {
|
|
322
|
-
this.client.forwardOut(socket.localAddress, socket.localPort, '127.0.0.1', port !== null && port !== void 0 ? port : this.remotePort, (err, stream) => {
|
|
323
|
-
if (err) {
|
|
324
|
-
console.debug('Proxy message rejected', err);
|
|
325
|
-
}
|
|
326
|
-
else {
|
|
327
|
-
stream.pipe(socket).pipe(stream);
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
async copy(localPath, remotePath) {
|
|
332
|
-
const sftpClient = await this.sftpClientPromise;
|
|
333
|
-
await sftpClient.put(localPath, remotePath);
|
|
334
|
-
}
|
|
335
|
-
exec(cmd, args, options = {}) {
|
|
336
|
-
const deferred = new promise_util_1.Deferred();
|
|
337
|
-
cmd = this.buildCmd(cmd, args);
|
|
338
|
-
this.client.exec(cmd, options, (err, stream) => {
|
|
339
|
-
if (err) {
|
|
340
|
-
return deferred.reject(err);
|
|
341
|
-
}
|
|
342
|
-
let stdout = '';
|
|
343
|
-
let stderr = '';
|
|
344
|
-
stream.on('close', () => {
|
|
345
|
-
deferred.resolve({ stdout, stderr });
|
|
346
|
-
}).on('data', (data) => {
|
|
347
|
-
stdout += data.toString();
|
|
348
|
-
}).stderr.on('data', (data) => {
|
|
349
|
-
stderr += data.toString();
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
return deferred.promise;
|
|
353
|
-
}
|
|
354
|
-
execPartial(cmd, tester, args, options = {}) {
|
|
355
|
-
const deferred = new promise_util_1.Deferred();
|
|
356
|
-
cmd = this.buildCmd(cmd, args);
|
|
357
|
-
this.client.exec(cmd, {
|
|
358
|
-
...options,
|
|
359
|
-
// Ensure that the process on the remote ends when the connection is closed
|
|
360
|
-
pty: true
|
|
361
|
-
}, (err, stream) => {
|
|
362
|
-
if (err) {
|
|
363
|
-
return deferred.reject(err);
|
|
364
|
-
}
|
|
365
|
-
// in pty mode we only have an stdout stream
|
|
366
|
-
// return stdout as stderr as well
|
|
367
|
-
let stdout = '';
|
|
368
|
-
stream.on('close', () => {
|
|
369
|
-
if (deferred.state === 'unresolved') {
|
|
370
|
-
deferred.resolve({ stdout, stderr: stdout });
|
|
371
|
-
}
|
|
372
|
-
}).on('data', (data) => {
|
|
373
|
-
if (deferred.state === 'unresolved') {
|
|
374
|
-
stdout += data.toString();
|
|
375
|
-
if (tester(stdout, stdout)) {
|
|
376
|
-
deferred.resolve({ stdout, stderr: stdout });
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
});
|
|
381
|
-
return deferred.promise;
|
|
382
|
-
}
|
|
383
|
-
buildCmd(cmd, args) {
|
|
384
|
-
const escapedArgs = (args === null || args === void 0 ? void 0 : args.map(arg => `"${arg.replace(/"/g, '\\"')}"`)) || [];
|
|
385
|
-
const fullCmd = cmd + (escapedArgs.length > 0 ? (' ' + escapedArgs.join(' ')) : '');
|
|
386
|
-
return fullCmd;
|
|
387
|
-
}
|
|
388
|
-
dispose() {
|
|
389
|
-
this.client.end();
|
|
390
|
-
this.client.destroy();
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
exports.RemoteSSHConnection = RemoteSSHConnection;
|
|
394
|
-
//# sourceMappingURL=remote-ssh-connection-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-ssh-connection-provider.js","sourceRoot":"","sources":["../../../src/electron-node/ssh/remote-ssh-connection-provider.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,6BAA6B;AAE7B,kDAAkD;AAClD,+CAAgD;AAChD,2CAAmC;AACnC,sCAAgF;AAChF,4DAAkE;AAElE,4EAAuE;AACvE,kFAA4E;AAE5E,sEAAwE;AACxE,+EAAiF;AACjF,wEAAmE;AACnE,sDAA2D;AAGpD,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAArC;QAoBO,uBAAkB,GAAG,CAAC,CAAC;QACvB,yBAAoB,GAAG,CAAC,CAAC;IAmPvC,CAAC;IAjPG,KAAK,CAAC,kBAAkB,CAAC,IAAY,EAAE,IAAa,EAAE,gBAAyB;QAC3E,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;QAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAErC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAC7B,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CACpF,CAAC;QAEF,kFAAkF;QAClF,IAAI,MAAM,CAAC,IAAI,EAAE,CA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K,CAAC,GAAG,CAAC,KAAI,EAAE,CAAC;QAC5E,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACpF,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,OAAO;QACH,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CAEJ;AArHD,kDAqHC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ParsedKey } from 'ssh2';
|
|
2
|
-
export interface SSHKey {
|
|
3
|
-
filename: string;
|
|
4
|
-
parsedKey: ParsedKey;
|
|
5
|
-
fingerprint: string;
|
|
6
|
-
agentSupport?: boolean;
|
|
7
|
-
isPrivate?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare class SSHIdentityFileCollector {
|
|
10
|
-
protected getDefaultIdentityFiles(): string[];
|
|
11
|
-
gatherIdentityFiles(sshAgentSock?: string, overrideIdentityFiles?: string[]): Promise<SSHKey[]>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ssh-identity-file-collector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ssh-identity-file-collector.d.ts","sourceRoot":"","sources":["../../../src/electron-node/ssh/ssh-identity-file-collector.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAIjC,MAAM,WAAW,MAAM;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,qBACa,wBAAwB;IAEjC,SAAS,CAAC,uBAAuB,IAAI,MAAM,EAAE;IAqBvC,mBAAmB,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,qBAAqB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAgFxG"}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2023 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.SSHIdentityFileCollector = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const fs = require("@theia/core/shared/fs-extra");
|
|
21
|
-
const os = require("os");
|
|
22
|
-
const path = require("path");
|
|
23
|
-
const crypto = require("crypto");
|
|
24
|
-
const ssh2 = require("ssh2");
|
|
25
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
-
let SSHIdentityFileCollector = class SSHIdentityFileCollector {
|
|
27
|
-
getDefaultIdentityFiles() {
|
|
28
|
-
const homeDir = os.homedir();
|
|
29
|
-
const PATH_SSH_CLIENT_ID_DSA = path.join(homeDir, '.ssh', '/id_dsa');
|
|
30
|
-
const PATH_SSH_CLIENT_ID_ECDSA = path.join(homeDir, '.ssh', '/id_ecdsa');
|
|
31
|
-
const PATH_SSH_CLIENT_ID_RSA = path.join(homeDir, '.ssh', '/id_rsa');
|
|
32
|
-
const PATH_SSH_CLIENT_ID_ED25519 = path.join(homeDir, '.ssh', '/id_ed25519');
|
|
33
|
-
const PATH_SSH_CLIENT_ID_XMSS = path.join(homeDir, '.ssh', '/id_xmss');
|
|
34
|
-
const PATH_SSH_CLIENT_ID_ECDSA_SK = path.join(homeDir, '.ssh', '/id_ecdsa_sk');
|
|
35
|
-
const PATH_SSH_CLIENT_ID_ED25519_SK = path.join(homeDir, '.ssh', '/id_ed25519_sk');
|
|
36
|
-
return [
|
|
37
|
-
PATH_SSH_CLIENT_ID_DSA,
|
|
38
|
-
PATH_SSH_CLIENT_ID_ECDSA,
|
|
39
|
-
PATH_SSH_CLIENT_ID_ECDSA_SK,
|
|
40
|
-
PATH_SSH_CLIENT_ID_ED25519,
|
|
41
|
-
PATH_SSH_CLIENT_ID_ED25519_SK,
|
|
42
|
-
PATH_SSH_CLIENT_ID_RSA,
|
|
43
|
-
PATH_SSH_CLIENT_ID_XMSS
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
async gatherIdentityFiles(sshAgentSock, overrideIdentityFiles) {
|
|
47
|
-
const identityFiles = overrideIdentityFiles || this.getDefaultIdentityFiles();
|
|
48
|
-
const identityFileContentsResult = await Promise.allSettled(identityFiles.map(async (keyPath) => {
|
|
49
|
-
keyPath = await fs.pathExists(keyPath + '.pub') ? keyPath + '.pub' : keyPath;
|
|
50
|
-
return fs.promises.readFile(keyPath);
|
|
51
|
-
}));
|
|
52
|
-
const fileKeys = identityFileContentsResult.map((result, i) => {
|
|
53
|
-
if (result.status === 'rejected') {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
const parsedResult = ssh2.utils.parseKey(result.value);
|
|
57
|
-
if (parsedResult instanceof Error || !parsedResult) {
|
|
58
|
-
console.log(`Error while parsing SSH public key ${identityFiles[i]}:`, parsedResult);
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
const parsedKey = Array.isArray(parsedResult) ? parsedResult[0] : parsedResult;
|
|
62
|
-
const fingerprint = crypto.createHash('sha256').update(parsedKey.getPublicSSH()).digest('base64');
|
|
63
|
-
return {
|
|
64
|
-
filename: identityFiles[i],
|
|
65
|
-
parsedKey,
|
|
66
|
-
fingerprint
|
|
67
|
-
};
|
|
68
|
-
}).filter((v) => !!v);
|
|
69
|
-
let sshAgentParsedKeys = [];
|
|
70
|
-
if (sshAgentSock) {
|
|
71
|
-
sshAgentParsedKeys = await new Promise((resolve, reject) => {
|
|
72
|
-
const sshAgent = new ssh2.OpenSSHAgent(sshAgentSock);
|
|
73
|
-
sshAgent.getIdentities((err, publicKeys) => {
|
|
74
|
-
if (err) {
|
|
75
|
-
reject(err);
|
|
76
|
-
}
|
|
77
|
-
else if (publicKeys) {
|
|
78
|
-
resolve(publicKeys.map(key => {
|
|
79
|
-
if ('pubKey' in key) {
|
|
80
|
-
const pubKey = key.pubKey;
|
|
81
|
-
if ('pubKey' in pubKey) {
|
|
82
|
-
return pubKey.pubKey;
|
|
83
|
-
}
|
|
84
|
-
return pubKey;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
return key;
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
resolve([]);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
const sshAgentKeys = sshAgentParsedKeys.map(parsedKey => {
|
|
98
|
-
const fingerprint = crypto.createHash('sha256').update(parsedKey.getPublicSSH()).digest('base64');
|
|
99
|
-
return {
|
|
100
|
-
filename: parsedKey.comment,
|
|
101
|
-
parsedKey,
|
|
102
|
-
fingerprint,
|
|
103
|
-
agentSupport: true
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
const agentKeys = [];
|
|
107
|
-
const preferredIdentityKeys = [];
|
|
108
|
-
for (const agentKey of sshAgentKeys) {
|
|
109
|
-
const foundIdx = fileKeys.findIndex(k => agentKey.parsedKey.type === k.parsedKey.type && agentKey.fingerprint === k.fingerprint);
|
|
110
|
-
if (foundIdx >= 0) {
|
|
111
|
-
preferredIdentityKeys.push({ ...fileKeys[foundIdx], agentSupport: true });
|
|
112
|
-
fileKeys.splice(foundIdx, 1);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
agentKeys.push(agentKey);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
preferredIdentityKeys.push(...agentKeys);
|
|
119
|
-
preferredIdentityKeys.push(...fileKeys);
|
|
120
|
-
return preferredIdentityKeys;
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
exports.SSHIdentityFileCollector = SSHIdentityFileCollector;
|
|
124
|
-
exports.SSHIdentityFileCollector = SSHIdentityFileCollector = tslib_1.__decorate([
|
|
125
|
-
(0, inversify_1.injectable)()
|
|
126
|
-
], SSHIdentityFileCollector);
|
|
127
|
-
//# sourceMappingURL=ssh-identity-file-collector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ssh-identity-file-collector.js","sourceRoot":"","sources":["../../../src/electron-node/ssh/ssh-identity-file-collector.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,kDAAkD;AAClD,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AAEjC,6BAA6B;AAC7B,4DAA0D;AAWnD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEvB,uBAAuB;QAC7B,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;QAC7B,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C,CAAC,SAAS,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC;YACjI,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAChB,qBAAqB,CAAC,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC1E,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACJ,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC7B,CAAC;QACL,CAAC;QACD,qBAAqB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QACzC,qBAAqB,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;QAExC,OAAO,qBAAqB,CAAC;IACjC,CAAC;CACJ,CAAA;AAvGY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAuGpC"}
|
package/lib/package.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
|
package/lib/package.spec.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
/* note: this bogus test file is required so that
|
|
17
|
-
we are able to run mocha unit tests on this
|
|
18
|
-
package, without having any actual unit tests in it.
|
|
19
|
-
This way a coverage report will be generated,
|
|
20
|
-
showing 0% coverage, instead of no report.
|
|
21
|
-
This file can be removed once we have real unit
|
|
22
|
-
tests in place. */
|
|
23
|
-
describe('remote package', () => {
|
|
24
|
-
it('support code coverage statistics', () => true);
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=package.spec.js.map
|
package/lib/package.spec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.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;;;;;;qBAMqB;AAErB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAE5B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAEvD,CAAC,CAAC,CAAC"}
|