@theia/remote 1.77.0-next.99 → 1.77.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/lib/electron-browser/local-backend-services.js +21 -26
- package/lib/electron-browser/local-backend-services.js.map +1 -1
- package/lib/electron-browser/port-forwarding/port-forwading-contribution.d.ts +1 -1
- package/lib/electron-browser/port-forwarding/port-forwading-contribution.d.ts.map +1 -1
- package/lib/electron-browser/port-forwarding/port-forwading-contribution.js +14 -18
- package/lib/electron-browser/port-forwarding/port-forwading-contribution.js.map +1 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-service.d.ts +1 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-service.d.ts.map +1 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-service.js +14 -21
- package/lib/electron-browser/port-forwarding/port-forwarding-service.js.map +1 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-widget.d.ts +1 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-widget.d.ts.map +1 -1
- package/lib/electron-browser/port-forwarding/port-forwarding-widget.js +34 -43
- package/lib/electron-browser/port-forwarding/port-forwarding-widget.js.map +1 -1
- package/lib/electron-browser/remote-cli-args-collector.js +13 -18
- package/lib/electron-browser/remote-cli-args-collector.js.map +1 -1
- package/lib/electron-browser/remote-cli-args-collector.spec.js +5 -7
- package/lib/electron-browser/remote-cli-args-collector.spec.js.map +1 -1
- package/lib/electron-browser/remote-electron-file-dialog-service.d.ts +1 -1
- package/lib/electron-browser/remote-electron-file-dialog-service.d.ts.map +1 -1
- package/lib/electron-browser/remote-electron-file-dialog-service.js +17 -21
- package/lib/electron-browser/remote-electron-file-dialog-service.js.map +1 -1
- package/lib/electron-browser/remote-frontend-contribution.d.ts +3 -3
- package/lib/electron-browser/remote-frontend-contribution.d.ts.map +1 -1
- package/lib/electron-browser/remote-frontend-contribution.js +38 -48
- package/lib/electron-browser/remote-frontend-contribution.js.map +1 -1
- package/lib/electron-browser/remote-frontend-module.js +61 -63
- package/lib/electron-browser/remote-frontend-module.js.map +1 -1
- package/lib/electron-browser/remote-local-workspace-contribution.d.ts +1 -1
- package/lib/electron-browser/remote-local-workspace-contribution.d.ts.map +1 -1
- package/lib/electron-browser/remote-local-workspace-contribution.js +26 -33
- package/lib/electron-browser/remote-local-workspace-contribution.js.map +1 -1
- package/lib/electron-browser/remote-registry-contribution.js +12 -17
- package/lib/electron-browser/remote-registry-contribution.js.map +1 -1
- package/lib/electron-browser/remote-service.js +5 -8
- package/lib/electron-browser/remote-service.js.map +1 -1
- package/lib/electron-browser/remote-ssh-contribution.d.ts +3 -3
- package/lib/electron-browser/remote-ssh-contribution.d.ts.map +1 -1
- package/lib/electron-browser/remote-ssh-contribution.js +41 -47
- package/lib/electron-browser/remote-ssh-contribution.js.map +1 -1
- package/lib/electron-browser/remote-user-storage-provider.d.ts +2 -2
- package/lib/electron-browser/remote-user-storage-provider.d.ts.map +1 -1
- package/lib/electron-browser/remote-user-storage-provider.js +23 -33
- package/lib/electron-browser/remote-user-storage-provider.js.map +1 -1
- package/lib/electron-common/remote-port-forwarding-provider.js +2 -5
- package/lib/electron-common/remote-port-forwarding-provider.js.map +1 -1
- package/lib/electron-common/remote-preferences.js +20 -24
- package/lib/electron-common/remote-preferences.js.map +1 -1
- package/lib/electron-common/remote-ssh-connection-provider.js +2 -5
- package/lib/electron-common/remote-ssh-connection-provider.js.map +1 -1
- package/lib/electron-common/remote-status-service.js +2 -5
- package/lib/electron-common/remote-status-service.js.map +1 -1
- package/lib/electron-node/backend-remote-service-impl.js +10 -13
- package/lib/electron-node/backend-remote-service-impl.js.map +1 -1
- package/lib/electron-node/remote-auto-shutdown-service.js +15 -19
- package/lib/electron-node/remote-auto-shutdown-service.js.map +1 -1
- package/lib/electron-node/remote-auto-shutdown-service.spec.js +28 -30
- package/lib/electron-node/remote-auto-shutdown-service.spec.js.map +1 -1
- package/lib/electron-node/remote-backend-module.js +69 -72
- package/lib/electron-node/remote-backend-module.js.map +1 -1
- package/lib/electron-node/remote-connection-service.d.ts +3 -3
- package/lib/electron-node/remote-connection-service.d.ts.map +1 -1
- package/lib/electron-node/remote-connection-service.js +13 -18
- package/lib/electron-node/remote-connection-service.js.map +1 -1
- package/lib/electron-node/remote-connection-socket-provider.js +7 -10
- package/lib/electron-node/remote-connection-socket-provider.js.map +1 -1
- package/lib/electron-node/remote-port-forwarding-provider.d.ts +3 -3
- package/lib/electron-node/remote-port-forwarding-provider.d.ts.map +1 -1
- package/lib/electron-node/remote-port-forwarding-provider.js +10 -14
- package/lib/electron-node/remote-port-forwarding-provider.js.map +1 -1
- package/lib/electron-node/remote-proxy-server-provider.js +8 -11
- package/lib/electron-node/remote-proxy-server-provider.js.map +1 -1
- package/lib/electron-node/remote-status-service.d.ts +2 -2
- package/lib/electron-node/remote-status-service.d.ts.map +1 -1
- package/lib/electron-node/remote-status-service.js +8 -12
- package/lib/electron-node/remote-status-service.js.map +1 -1
- package/lib/electron-node/remote-types.js +1 -2
- package/lib/electron-node/remote-types.js.map +1 -1
- package/lib/electron-node/setup/app-native-dependency-contribution.d.ts +1 -1
- package/lib/electron-node/setup/app-native-dependency-contribution.d.ts.map +1 -1
- package/lib/electron-node/setup/app-native-dependency-contribution.js +13 -16
- package/lib/electron-node/setup/app-native-dependency-contribution.js.map +1 -1
- package/lib/electron-node/setup/app-native-dependency-contribution.spec.js +14 -16
- package/lib/electron-node/setup/app-native-dependency-contribution.spec.js.map +1 -1
- package/lib/electron-node/setup/main-copy-contribution.d.ts.map +1 -1
- package/lib/electron-node/setup/main-copy-contribution.js +8 -8
- package/lib/electron-node/setup/main-copy-contribution.js.map +1 -1
- package/lib/electron-node/setup/main-copy-contribution.spec.d.ts +2 -0
- package/lib/electron-node/setup/main-copy-contribution.spec.d.ts.map +1 -0
- package/lib/electron-node/setup/main-copy-contribution.spec.js +54 -0
- package/lib/electron-node/setup/main-copy-contribution.spec.js.map +1 -0
- package/lib/electron-node/setup/remote-copy-contribution.d.ts.map +1 -1
- package/lib/electron-node/setup/remote-copy-contribution.js +13 -16
- package/lib/electron-node/setup/remote-copy-contribution.js.map +1 -1
- package/lib/electron-node/setup/remote-copy-service.d.ts +3 -3
- package/lib/electron-node/setup/remote-copy-service.d.ts.map +1 -1
- package/lib/electron-node/setup/remote-copy-service.js +24 -31
- package/lib/electron-node/setup/remote-copy-service.js.map +1 -1
- package/lib/electron-node/setup/remote-native-dependency-contribution.js +8 -11
- package/lib/electron-node/setup/remote-native-dependency-contribution.js.map +1 -1
- package/lib/electron-node/setup/remote-native-dependency-service.d.ts +3 -1
- package/lib/electron-node/setup/remote-native-dependency-service.d.ts.map +1 -1
- package/lib/electron-node/setup/remote-native-dependency-service.js +30 -50
- package/lib/electron-node/setup/remote-native-dependency-service.js.map +1 -1
- package/lib/electron-node/setup/remote-native-dependency-service.spec.d.ts +2 -0
- package/lib/electron-node/setup/remote-native-dependency-service.spec.d.ts.map +1 -0
- package/lib/electron-node/setup/remote-native-dependency-service.spec.js +96 -0
- package/lib/electron-node/setup/remote-native-dependency-service.spec.js.map +1 -0
- package/lib/electron-node/setup/remote-node-setup-service.d.ts +1 -1
- package/lib/electron-node/setup/remote-node-setup-service.d.ts.map +1 -1
- package/lib/electron-node/setup/remote-node-setup-service.js +25 -30
- package/lib/electron-node/setup/remote-node-setup-service.js.map +1 -1
- package/lib/electron-node/setup/remote-setup-script-service.js +17 -22
- package/lib/electron-node/setup/remote-setup-script-service.js.map +1 -1
- package/lib/electron-node/setup/remote-setup-service.d.ts +5 -5
- package/lib/electron-node/setup/remote-setup-service.d.ts.map +1 -1
- package/lib/electron-node/setup/remote-setup-service.js +33 -42
- package/lib/electron-node/setup/remote-setup-service.js.map +1 -1
- package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts +12 -9
- package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts.map +1 -1
- package/lib/electron-node/ssh/remote-ssh-connection-provider.js +43 -51
- package/lib/electron-node/ssh/remote-ssh-connection-provider.js.map +1 -1
- package/lib/electron-node/ssh/remote-ssh-connection-provider.spec.js +26 -27
- package/lib/electron-node/ssh/remote-ssh-connection-provider.spec.js.map +1 -1
- package/lib/electron-node/ssh/ssh-identity-file-collector.d.ts.map +1 -1
- package/lib/electron-node/ssh/ssh-identity-file-collector.js +15 -18
- package/lib/electron-node/ssh/ssh-identity-file-collector.js.map +1 -1
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.js +1 -1
- package/lib/package.spec.js.map +1 -1
- package/package.json +16 -13
- package/src/electron-browser/port-forwarding/port-forwading-contribution.ts +1 -1
- 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/src/electron-browser/remote-cli-args-collector.spec.ts +1 -1
- package/src/electron-browser/remote-electron-file-dialog-service.ts +2 -2
- package/src/electron-browser/remote-frontend-contribution.ts +3 -3
- package/src/electron-browser/remote-frontend-module.ts +16 -16
- package/src/electron-browser/remote-local-workspace-contribution.ts +2 -2
- package/src/electron-browser/remote-ssh-contribution.ts +7 -4
- package/src/electron-browser/remote-user-storage-provider.ts +2 -2
- package/src/electron-node/remote-auto-shutdown-service.spec.ts +1 -1
- package/src/electron-node/remote-backend-module.ts +22 -22
- package/src/electron-node/remote-connection-service.ts +3 -3
- package/src/electron-node/remote-port-forwarding-provider.ts +3 -3
- package/src/electron-node/remote-status-service.ts +2 -2
- package/src/electron-node/setup/app-native-dependency-contribution.spec.ts +1 -1
- package/src/electron-node/setup/app-native-dependency-contribution.ts +1 -1
- package/src/electron-node/setup/main-copy-contribution.spec.ts +62 -0
- package/src/electron-node/setup/main-copy-contribution.ts +3 -0
- package/src/electron-node/setup/remote-copy-contribution.ts +3 -2
- package/src/electron-node/setup/remote-copy-service.ts +3 -3
- package/src/electron-node/setup/remote-native-dependency-service.spec.ts +106 -0
- package/src/electron-node/setup/remote-native-dependency-service.ts +10 -24
- package/src/electron-node/setup/remote-node-setup-service.ts +1 -1
- package/src/electron-node/setup/remote-setup-service.ts +5 -5
- package/src/electron-node/ssh/remote-ssh-connection-provider.spec.ts +6 -2
- package/src/electron-node/ssh/remote-ssh-connection-provider.ts +14 -9
- package/src/electron-node/ssh/ssh-identity-file-collector.ts +2 -2
- package/src/typings/decompress-plugins.d.ts +30 -0
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { RemoteNativeDependencyContribution, DownloadOptions, DependencyDownload } from './remote-native-dependency-contribution';
|
|
18
|
+
import { RemoteNativeDependencyContribution, DownloadOptions, DependencyDownload } from './remote-native-dependency-contribution.js';
|
|
19
19
|
import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
|
|
20
20
|
import { OS } from '@theia/core';
|
|
21
21
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource 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
|
+
|
|
17
|
+
import { expect } from 'chai';
|
|
18
|
+
import { RemoteCopyOptions, RemoteCopyRegistry, RemoteFile } from '@theia/core/lib/node/remote/remote-copy-contribution';
|
|
19
|
+
import { MainCopyContribution } from './main-copy-contribution.js';
|
|
20
|
+
|
|
21
|
+
class RecordingRemoteCopyRegistry implements RemoteCopyRegistry {
|
|
22
|
+
readonly files: RemoteFile[] = [];
|
|
23
|
+
readonly globs: string[] = [];
|
|
24
|
+
readonly directories: string[] = [];
|
|
25
|
+
|
|
26
|
+
getFiles(): RemoteFile[] {
|
|
27
|
+
return this.files;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async glob(pattern: string): Promise<void> {
|
|
31
|
+
this.globs.push(pattern);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
file(file: string, target?: string, options?: RemoteCopyOptions): void {
|
|
35
|
+
this.files.push({ path: file, target: target ?? file, options });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async directory(dir: string): Promise<void> {
|
|
39
|
+
this.directories.push(dir);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
describe('MainCopyContribution', () => {
|
|
44
|
+
let registry: RecordingRemoteCopyRegistry;
|
|
45
|
+
|
|
46
|
+
beforeEach(async () => {
|
|
47
|
+
registry = new RecordingRemoteCopyRegistry();
|
|
48
|
+
await new MainCopyContribution().copy(registry);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should copy the backend module type marker lib/backend/package.json', () => {
|
|
52
|
+
const marker = registry.getFiles().find(file => file.path === 'lib/backend/package.json');
|
|
53
|
+
expect(marker).to.not.be.undefined;
|
|
54
|
+
expect(marker?.target).to.equal('lib/backend/package.json');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should still copy the root package.json and the backend bundle', () => {
|
|
58
|
+
expect(registry.getFiles().map(file => file.path)).to.include('package.json');
|
|
59
|
+
expect(registry.globs).to.include('lib/backend/**/*.js');
|
|
60
|
+
expect(registry.directories).to.include.members(['lib/frontend', 'lib/webview']);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -21,6 +21,9 @@ import { RemoteCopyContribution, RemoteCopyRegistry } from '@theia/core/lib/node
|
|
|
21
21
|
export class MainCopyContribution implements RemoteCopyContribution {
|
|
22
22
|
async copy(registry: RemoteCopyRegistry): Promise<void> {
|
|
23
23
|
registry.file('package.json');
|
|
24
|
+
// The bundler emits lib/backend/package.json ({ "type": "module" }); without it Node treats the
|
|
25
|
+
// ESM backend bundle as typeless, re-parses every file and prints a MODULE_TYPELESS_PACKAGE_JSON warning on stderr.
|
|
26
|
+
registry.file('lib/backend/package.json');
|
|
24
27
|
await registry.glob('lib/backend/**/*.js');
|
|
25
28
|
await registry.directory('lib/frontend');
|
|
26
29
|
await registry.directory('lib/webview');
|
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
|
|
18
18
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
19
|
import { RemoteCopyRegistry, RemoteFile, RemoteCopyOptions } from '@theia/core/lib/node/remote/remote-copy-contribution';
|
|
20
|
-
|
|
20
|
+
// A CommonJS module whose exports cannot be detected statically, so it is imported as a whole.
|
|
21
|
+
import glob from 'glob';
|
|
21
22
|
import { promisify } from 'util';
|
|
22
23
|
import * as path from 'path';
|
|
23
24
|
|
|
24
|
-
const promiseGlob = promisify(
|
|
25
|
+
const promiseGlob = promisify(glob);
|
|
25
26
|
|
|
26
27
|
@injectable()
|
|
27
28
|
export class RemoteCopyRegistryImpl implements RemoteCopyRegistry {
|
|
@@ -20,11 +20,11 @@ import * as fs from 'fs';
|
|
|
20
20
|
import * as os from 'os';
|
|
21
21
|
import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
|
|
22
22
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
23
|
-
import { RemoteConnection } from '../remote-types';
|
|
23
|
+
import { RemoteConnection } from '../remote-types.js';
|
|
24
24
|
import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
|
|
25
|
-
import { RemoteNativeDependencyService } from './remote-native-dependency-service';
|
|
25
|
+
import { RemoteNativeDependencyService } from './remote-native-dependency-service.js';
|
|
26
26
|
import { ContributionProvider } from '@theia/core';
|
|
27
|
-
import { RemoteCopyRegistryImpl } from './remote-copy-contribution';
|
|
27
|
+
import { RemoteCopyRegistryImpl } from './remote-copy-contribution.js';
|
|
28
28
|
import { RemoteCopyContribution, RemoteFile } from '@theia/core/lib/node/remote/remote-copy-contribution';
|
|
29
29
|
|
|
30
30
|
@injectable()
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource GmbH 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
|
+
|
|
17
|
+
import * as fs from 'fs';
|
|
18
|
+
import * as os from 'os';
|
|
19
|
+
import * as path from 'path';
|
|
20
|
+
import { expect } from 'chai';
|
|
21
|
+
import { ArchiveExtractorImpl } from '@theia/filesystem/lib/node/archive/archive-extractor';
|
|
22
|
+
import { createTestTar, createTestZip } from '@theia/filesystem/lib/node/archive/test/test-archives';
|
|
23
|
+
import { DependencyDownload } from './remote-native-dependency-contribution.js';
|
|
24
|
+
import { NativeDependencyFile, RemoteNativeDependencyService } from './remote-native-dependency-service.js';
|
|
25
|
+
|
|
26
|
+
class TestableRemoteNativeDependencyService extends RemoteNativeDependencyService {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.archiveExtractor = new ArchiveExtractorImpl();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
publicStoreDependency(dependency: DependencyDownload, directory: string): Promise<NativeDependencyFile[]> {
|
|
33
|
+
return this.storeDependency(dependency, directory);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('RemoteNativeDependencyService', () => {
|
|
38
|
+
|
|
39
|
+
const service = new TestableRemoteNativeDependencyService();
|
|
40
|
+
let directory: string;
|
|
41
|
+
|
|
42
|
+
beforeEach(async () => {
|
|
43
|
+
directory = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'remote-native-dependency-'));
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
afterEach(async () => {
|
|
47
|
+
await fs.promises.rm(directory, { recursive: true, force: true });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('extracts a zip archive and lists its entries with their target and mode', async () => {
|
|
51
|
+
const files = await service.publicStoreDependency({
|
|
52
|
+
archive: 'zip',
|
|
53
|
+
buffer: createTestZip([
|
|
54
|
+
{ name: 'lib/', mode: 0o040755 },
|
|
55
|
+
{ name: 'lib/native.node', mode: 0o100755, data: 'binary' },
|
|
56
|
+
{ name: 'lib/README.md', mode: 0o100644, data: 'readme' }
|
|
57
|
+
])
|
|
58
|
+
}, directory);
|
|
59
|
+
expect(files).to.deep.equal([
|
|
60
|
+
{ path: path.join(directory, 'lib'), target: 'lib', mode: 0o755 },
|
|
61
|
+
{ path: path.join(directory, 'lib', 'native.node'), target: 'lib/native.node', mode: 0o755 },
|
|
62
|
+
{ path: path.join(directory, 'lib', 'README.md'), target: 'lib/README.md', mode: 0o644 }
|
|
63
|
+
]);
|
|
64
|
+
expect(await fs.promises.readFile(path.join(directory, 'lib', 'native.node'), 'utf8')).to.equal('binary');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
for (const archive of ['tar', 'tgz'] as const) {
|
|
68
|
+
it(`extracts a ${archive} archive`, async () => {
|
|
69
|
+
const files = await service.publicStoreDependency({
|
|
70
|
+
archive,
|
|
71
|
+
buffer: await createTestTar([{ name: 'bin/tool', mode: 0o755, data: 'tool' }], archive === 'tgz')
|
|
72
|
+
}, directory);
|
|
73
|
+
expect(files).to.deep.equal([{ path: path.join(directory, 'bin', 'tool'), target: 'bin/tool', mode: 0o755 }]);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
it('uses the declared archive format', async () => {
|
|
78
|
+
let error: unknown;
|
|
79
|
+
try {
|
|
80
|
+
await service.publicStoreDependency({ archive: 'tgz', buffer: createTestZip([{ name: 'file.txt' }]) }, directory);
|
|
81
|
+
} catch (e) {
|
|
82
|
+
error = e;
|
|
83
|
+
}
|
|
84
|
+
expect(String(error)).to.match(/incorrect header check/);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('rejects an archive with an entry that leaves the directory', async () => {
|
|
88
|
+
let error: unknown;
|
|
89
|
+
try {
|
|
90
|
+
await service.publicStoreDependency({ archive: 'zip', buffer: createTestZip([{ name: '../evil.txt', data: 'evil' }]) }, directory);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
error = e;
|
|
93
|
+
}
|
|
94
|
+
expect(String(error)).to.match(/invalid relative path|leaves the extraction directory/);
|
|
95
|
+
expect(fs.existsSync(path.join(path.dirname(directory), 'evil.txt'))).to.be.false;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('stores a single file as is', async () => {
|
|
99
|
+
const files = await service.publicStoreDependency({
|
|
100
|
+
file: { path: 'bin/tool', mode: 0o755 },
|
|
101
|
+
buffer: Buffer.from('tool')
|
|
102
|
+
}, directory);
|
|
103
|
+
expect(files).to.deep.equal([{ path: path.join(directory, 'tool'), target: 'bin/tool', mode: 0o755 }]);
|
|
104
|
+
expect(await fs.promises.readFile(path.join(directory, 'tool'), 'utf8')).to.equal('tool');
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -17,15 +17,11 @@
|
|
|
17
17
|
import { ContributionProvider, THEIA_VERSION } from '@theia/core';
|
|
18
18
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
19
19
|
import { RequestContext, RequestService, RequestOptions } from '@theia/core/shared/@theia/request';
|
|
20
|
-
import decompress from 'decompress';
|
|
21
20
|
import * as path from 'path';
|
|
22
21
|
import * as fs from 'fs/promises';
|
|
23
|
-
import { DependencyDownload, DirectoryDependencyDownload, RemoteNativeDependencyContribution } from './remote-native-dependency-contribution';
|
|
22
|
+
import { DependencyDownload, DirectoryDependencyDownload, RemoteNativeDependencyContribution } from './remote-native-dependency-contribution.js';
|
|
24
23
|
import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
|
|
25
|
-
|
|
26
|
-
const decompressTar = require('decompress-tar');
|
|
27
|
-
const decompressTargz = require('decompress-targz');
|
|
28
|
-
const decompressUnzip = require('decompress-unzip');
|
|
24
|
+
import { ArchiveExtractor } from '@theia/filesystem/lib/node/archive/archive-extractor';
|
|
29
25
|
|
|
30
26
|
export const DEFAULT_HTTP_OPTIONS = {
|
|
31
27
|
method: 'GET',
|
|
@@ -49,6 +45,9 @@ export class RemoteNativeDependencyService {
|
|
|
49
45
|
@inject(RequestService)
|
|
50
46
|
protected requestService: RequestService;
|
|
51
47
|
|
|
48
|
+
@inject(ArchiveExtractor)
|
|
49
|
+
protected archiveExtractor: ArchiveExtractor;
|
|
50
|
+
|
|
52
51
|
async downloadDependencies(remotePlatform: RemotePlatform, directory: string): Promise<NativeDependencyFile[]> {
|
|
53
52
|
const contributionResults = await Promise.all(this.nativeDependencyContributions.getContributions()
|
|
54
53
|
.map(async contribution => {
|
|
@@ -81,25 +80,12 @@ export class RemoteNativeDependencyService {
|
|
|
81
80
|
|
|
82
81
|
protected async storeDependency(dependency: DependencyDownload, directory: string): Promise<NativeDependencyFile[]> {
|
|
83
82
|
if (DirectoryDependencyDownload.is(dependency)) {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
plugins.push(decompressTargz());
|
|
90
|
-
} else if (dependency.archive === 'zip') {
|
|
91
|
-
plugins.push(decompressUnzip());
|
|
92
|
-
}
|
|
93
|
-
const files = await decompress(archiveBuffer, directory, { plugins });
|
|
94
|
-
const result: NativeDependencyFile[] = await Promise.all(files.map(async file => {
|
|
95
|
-
const localPath = path.join(directory, file.path);
|
|
96
|
-
return {
|
|
97
|
-
path: localPath,
|
|
98
|
-
target: file.path,
|
|
99
|
-
mode: file.mode
|
|
100
|
-
};
|
|
83
|
+
const entries = await this.archiveExtractor.extract(dependency.buffer, directory, { format: dependency.archive });
|
|
84
|
+
return entries.map(entry => ({
|
|
85
|
+
path: path.join(directory, entry.path),
|
|
86
|
+
target: entry.path,
|
|
87
|
+
mode: entry.mode
|
|
101
88
|
}));
|
|
102
|
-
return result;
|
|
103
89
|
} else {
|
|
104
90
|
const fileName = path.basename(dependency.file.path);
|
|
105
91
|
const localPath = path.join(directory, fileName);
|
|
@@ -20,7 +20,7 @@ import * as os from 'os';
|
|
|
20
20
|
|
|
21
21
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
22
22
|
import { RequestService } from '@theia/core/shared/@theia/request';
|
|
23
|
-
import { RemoteSetupScriptService } from './remote-setup-script-service';
|
|
23
|
+
import { RemoteSetupScriptService } from './remote-setup-script-service.js';
|
|
24
24
|
import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
|
|
25
25
|
import { OS } from '@theia/core';
|
|
26
26
|
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
18
|
-
import { RemoteConnection, RemoteExecResult, RemoteStatusReport } from '../remote-types';
|
|
18
|
+
import { RemoteConnection, RemoteExecResult, RemoteStatusReport } from '../remote-types.js';
|
|
19
19
|
import { RemoteCliContext, RemoteCliContribution, RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
|
|
20
20
|
import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
|
|
21
|
-
import { RemoteCopyService } from './remote-copy-service';
|
|
22
|
-
import { RemoteNativeDependencyService } from './remote-native-dependency-service';
|
|
21
|
+
import { RemoteCopyService } from './remote-copy-service.js';
|
|
22
|
+
import { RemoteNativeDependencyService } from './remote-native-dependency-service.js';
|
|
23
23
|
import { ContributionProvider, OS, THEIA_VERSION } from '@theia/core';
|
|
24
|
-
import { RemoteNodeSetupService } from './remote-node-setup-service';
|
|
25
|
-
import { RemoteSetupScriptService } from './remote-setup-script-service';
|
|
24
|
+
import { RemoteNodeSetupService } from './remote-node-setup-service.js';
|
|
25
|
+
import { RemoteSetupScriptService } from './remote-setup-script-service.js';
|
|
26
26
|
|
|
27
27
|
export interface RemoteSetupOptions {
|
|
28
28
|
connection: RemoteConnection;
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { expect } from 'chai';
|
|
18
|
-
import
|
|
19
|
-
import { RemoteSSHConnectionProviderImpl } from './remote-ssh-connection-provider';
|
|
18
|
+
import SshConfigModule from 'ssh-config';
|
|
19
|
+
import { RemoteSSHConnectionProviderImpl } from './remote-ssh-connection-provider.js';
|
|
20
|
+
|
|
21
|
+
// `ssh-config` is a CommonJS module that provides the class as `default` export of `module.exports`.
|
|
22
|
+
const SshConfig = SshConfigModule.default;
|
|
23
|
+
type SshConfig = SshConfigModule.default;
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Parses the SSH config from an in-memory string instead of a file,
|
|
@@ -14,22 +14,27 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// A CommonJS module whose exports cannot be detected statically, so it is imported as a whole.
|
|
18
|
+
import ssh2 from 'ssh2';
|
|
18
19
|
import * as net from 'net';
|
|
19
20
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
20
|
-
import SftpClient
|
|
21
|
-
import
|
|
21
|
+
import SftpClient from 'ssh2-sftp-client';
|
|
22
|
+
import SshConfigModule from 'ssh-config';
|
|
22
23
|
import { Emitter, Event, MessageService, QuickInputService, ILogger } from '@theia/core';
|
|
23
24
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
24
|
-
import { RemoteSSHConnectionProvider, RemoteSSHConnectionProviderOptions, SSHConfig } from '../../electron-common/remote-ssh-connection-provider';
|
|
25
|
-
import { RemoteConnectionService } from '../remote-connection-service';
|
|
26
|
-
import { RemoteProxyServerProvider } from '../remote-proxy-server-provider';
|
|
27
|
-
import { RemoteConnection, RemoteExecOptions, RemoteExecResult, RemoteExecTester, RemoteStatusReport } from '../remote-types';
|
|
25
|
+
import { RemoteSSHConnectionProvider, RemoteSSHConnectionProviderOptions, SSHConfig } from '../../electron-common/remote-ssh-connection-provider.js';
|
|
26
|
+
import { RemoteConnectionService } from '../remote-connection-service.js';
|
|
27
|
+
import { RemoteProxyServerProvider } from '../remote-proxy-server-provider.js';
|
|
28
|
+
import { RemoteConnection, RemoteExecOptions, RemoteExecResult, RemoteExecTester, RemoteStatusReport } from '../remote-types.js';
|
|
28
29
|
import { Deferred, timeout } from '@theia/core/lib/common/promise-util';
|
|
29
|
-
import { SSHIdentityFileCollector, SSHKey } from './ssh-identity-file-collector';
|
|
30
|
-
import { RemoteSetupService } from '../setup/remote-setup-service';
|
|
30
|
+
import { SSHIdentityFileCollector, SSHKey } from './ssh-identity-file-collector.js';
|
|
31
|
+
import { RemoteSetupService } from '../setup/remote-setup-service.js';
|
|
31
32
|
import { generateUuid } from '@theia/core/lib/common/uuid';
|
|
32
33
|
|
|
34
|
+
// `ssh-config` is a CommonJS module that provides the class as `default` export of `module.exports`.
|
|
35
|
+
const SshConfig = SshConfigModule.default;
|
|
36
|
+
type SshConfig = SshConfigModule.default;
|
|
37
|
+
|
|
33
38
|
@injectable()
|
|
34
39
|
export class RemoteSSHConnectionProviderImpl implements RemoteSSHConnectionProvider {
|
|
35
40
|
|
|
@@ -18,8 +18,8 @@ import * as fs from '@theia/core/shared/fs-extra';
|
|
|
18
18
|
import * as os from 'os';
|
|
19
19
|
import * as path from 'path';
|
|
20
20
|
import * as crypto from 'crypto';
|
|
21
|
-
import { ParsedKey } from 'ssh2';
|
|
22
|
-
|
|
21
|
+
import ssh2, { ParsedKey } from 'ssh2';
|
|
22
|
+
// A CommonJS module whose exports cannot be detected statically, so it is imported as a whole.
|
|
23
23
|
import { injectable, inject, named } from '@theia/core/shared/inversify';
|
|
24
24
|
import { ILogger } from '@theia/core';
|
|
25
25
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource 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
|
+
|
|
17
|
+
declare module 'decompress-tar' {
|
|
18
|
+
function decompressTar(): (input: Buffer) => Promise<import('decompress').File[]>;
|
|
19
|
+
export = decompressTar;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare module 'decompress-targz' {
|
|
23
|
+
function decompressTargz(): (input: Buffer) => Promise<import('decompress').File[]>;
|
|
24
|
+
export = decompressTargz;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare module 'decompress-unzip' {
|
|
28
|
+
function decompressUnzip(): (input: Buffer) => Promise<import('decompress').File[]>;
|
|
29
|
+
export = decompressUnzip;
|
|
30
|
+
}
|