@theia/remote 1.45.0 → 1.46.0-next.72

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.
Files changed (87) hide show
  1. package/README.md +61 -61
  2. package/lib/electron-browser/remote-electron-file-dialog-service.d.ts +13 -13
  3. package/lib/electron-browser/remote-electron-file-dialog-service.js +57 -57
  4. package/lib/electron-browser/remote-frontend-contribution.d.ts +25 -25
  5. package/lib/electron-browser/remote-frontend-contribution.js +164 -164
  6. package/lib/electron-browser/remote-frontend-module.d.ts +3 -3
  7. package/lib/electron-browser/remote-frontend-module.js +42 -42
  8. package/lib/electron-browser/remote-preferences.d.ts +10 -10
  9. package/lib/electron-browser/remote-preferences.js +48 -48
  10. package/lib/electron-browser/remote-registry-contribution.d.ts +18 -18
  11. package/lib/electron-browser/remote-registry-contribution.js +74 -74
  12. package/lib/electron-browser/remote-service.d.ts +5 -5
  13. package/lib/electron-browser/remote-service.js +37 -37
  14. package/lib/electron-browser/remote-ssh-contribution.d.ts +17 -17
  15. package/lib/electron-browser/remote-ssh-contribution.js +117 -117
  16. package/lib/electron-common/remote-ssh-connection-provider.d.ts +10 -10
  17. package/lib/electron-common/remote-ssh-connection-provider.js +20 -20
  18. package/lib/electron-common/remote-status-service.d.ts +14 -14
  19. package/lib/electron-common/remote-status-service.js +20 -20
  20. package/lib/electron-node/backend-remote-service-impl.d.ts +11 -11
  21. package/lib/electron-node/backend-remote-service-impl.js +50 -50
  22. package/lib/electron-node/remote-backend-module.d.ts +4 -4
  23. package/lib/electron-node/remote-backend-module.js +74 -74
  24. package/lib/electron-node/remote-connection-service.d.ts +14 -14
  25. package/lib/electron-node/remote-connection-service.js +65 -65
  26. package/lib/electron-node/remote-connection-socket-provider.d.ts +8 -8
  27. package/lib/electron-node/remote-connection-socket-provider.js +37 -37
  28. package/lib/electron-node/remote-proxy-server-provider.d.ts +5 -5
  29. package/lib/electron-node/remote-proxy-server-provider.js +43 -43
  30. package/lib/electron-node/remote-status-service.d.ts +6 -6
  31. package/lib/electron-node/remote-status-service.js +54 -54
  32. package/lib/electron-node/remote-types.d.ts +34 -34
  33. package/lib/electron-node/remote-types.js +17 -17
  34. package/lib/electron-node/setup/app-native-dependency-contribution.d.ts +7 -7
  35. package/lib/electron-node/setup/app-native-dependency-contribution.js +57 -57
  36. package/lib/electron-node/setup/main-copy-contribution.d.ts +4 -4
  37. package/lib/electron-node/setup/main-copy-contribution.js +37 -37
  38. package/lib/electron-node/setup/remote-copy-contribution.d.ts +28 -28
  39. package/lib/electron-node/setup/remote-copy-contribution.js +78 -78
  40. package/lib/electron-node/setup/remote-copy-service.d.ts +18 -18
  41. package/lib/electron-node/setup/remote-copy-service.js +126 -126
  42. package/lib/electron-node/setup/remote-native-dependency-contribution.d.ts +34 -34
  43. package/lib/electron-node/setup/remote-native-dependency-contribution.js +34 -34
  44. package/lib/electron-node/setup/remote-native-dependency-service.d.ts +23 -23
  45. package/lib/electron-node/setup/remote-native-dependency-service.js +118 -118
  46. package/lib/electron-node/setup/remote-node-setup-service.d.ts +22 -22
  47. package/lib/electron-node/setup/remote-node-setup-service.js +132 -132
  48. package/lib/electron-node/setup/remote-setup-script-service.d.ts +40 -40
  49. package/lib/electron-node/setup/remote-setup-script-service.js +132 -132
  50. package/lib/electron-node/setup/remote-setup-service.d.ts +28 -28
  51. package/lib/electron-node/setup/remote-setup-service.js +198 -198
  52. package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts +55 -55
  53. package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts.map +1 -1
  54. package/lib/electron-node/ssh/remote-ssh-connection-provider.js +344 -342
  55. package/lib/electron-node/ssh/remote-ssh-connection-provider.js.map +1 -1
  56. package/lib/electron-node/ssh/ssh-identity-file-collector.d.ts +12 -12
  57. package/lib/electron-node/ssh/ssh-identity-file-collector.js +131 -131
  58. package/lib/package.spec.js +25 -25
  59. package/package.json +6 -7
  60. package/src/electron-browser/remote-electron-file-dialog-service.ts +47 -47
  61. package/src/electron-browser/remote-frontend-contribution.ts +145 -145
  62. package/src/electron-browser/remote-frontend-module.ts +49 -49
  63. package/src/electron-browser/remote-preferences.ts +62 -62
  64. package/src/electron-browser/remote-registry-contribution.ts +70 -70
  65. package/src/electron-browser/remote-service.ts +31 -31
  66. package/src/electron-browser/remote-ssh-contribution.ts +102 -102
  67. package/src/electron-common/remote-ssh-connection-provider.ts +29 -29
  68. package/src/electron-common/remote-status-service.ts +35 -35
  69. package/src/electron-node/backend-remote-service-impl.ts +45 -45
  70. package/src/electron-node/remote-backend-module.ts +80 -80
  71. package/src/electron-node/remote-connection-service.ts +55 -55
  72. package/src/electron-node/remote-connection-socket-provider.ts +34 -34
  73. package/src/electron-node/remote-proxy-server-provider.ts +37 -37
  74. package/src/electron-node/remote-status-service.ts +41 -41
  75. package/src/electron-node/remote-types.ts +56 -56
  76. package/src/electron-node/setup/app-native-dependency-contribution.ts +48 -48
  77. package/src/electron-node/setup/main-copy-contribution.ts +28 -28
  78. package/src/electron-node/setup/remote-copy-contribution.ts +90 -90
  79. package/src/electron-node/setup/remote-copy-service.ts +114 -114
  80. package/src/electron-node/setup/remote-native-dependency-contribution.ts +63 -63
  81. package/src/electron-node/setup/remote-native-dependency-service.ts +111 -111
  82. package/src/electron-node/setup/remote-node-setup-service.ts +123 -123
  83. package/src/electron-node/setup/remote-setup-script-service.ts +146 -146
  84. package/src/electron-node/setup/remote-setup-service.ts +197 -197
  85. package/src/electron-node/ssh/remote-ssh-connection-provider.ts +358 -356
  86. package/src/electron-node/ssh/ssh-identity-file-collector.ts +137 -137
  87. package/src/package.spec.ts +29 -29
@@ -1,119 +1,119 @@
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
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.RemoteNativeDependencyService = exports.DEFAULT_HTTP_OPTIONS = void 0;
28
- const core_1 = require("@theia/core");
29
- const inversify_1 = require("@theia/core/shared/inversify");
30
- const request_1 = require("@theia/core/shared/@theia/request");
31
- const decompress = require("decompress");
32
- const path = require("path");
33
- const fs = require("fs/promises");
34
- const remote_native_dependency_contribution_1 = require("./remote-native-dependency-contribution");
35
- const decompressTar = require('decompress-tar');
36
- const decompressTargz = require('decompress-targz');
37
- const decompressUnzip = require('decompress-unzip');
38
- exports.DEFAULT_HTTP_OPTIONS = {
39
- method: 'GET',
40
- headers: {
41
- Accept: 'application/octet-stream'
42
- },
43
- };
44
- let RemoteNativeDependencyService = class RemoteNativeDependencyService {
45
- async downloadDependencies(remotePlatform, directory) {
46
- const contributionResults = await Promise.all(this.nativeDependencyContributions.getContributions()
47
- .map(async (contribution) => {
48
- const result = await contribution.download({
49
- remotePlatform,
50
- theiaVersion: core_1.THEIA_VERSION,
51
- download: requestInfo => this.downloadDependency(requestInfo)
52
- });
53
- const dependency = await this.storeDependency(result, directory);
54
- return dependency;
55
- }));
56
- return contributionResults.flat();
57
- }
58
- async downloadDependency(downloadURI) {
59
- const options = typeof downloadURI === 'string'
60
- ? { url: downloadURI, ...exports.DEFAULT_HTTP_OPTIONS }
61
- : { ...exports.DEFAULT_HTTP_OPTIONS, ...downloadURI };
62
- const req = await this.requestService.request(options);
63
- if (request_1.RequestContext.isSuccess(req)) {
64
- return Buffer.from(req.buffer);
65
- }
66
- else {
67
- throw new Error('Server error while downloading native dependency from: ' + options.url);
68
- }
69
- }
70
- async storeDependency(dependency, directory) {
71
- if (remote_native_dependency_contribution_1.DirectoryDependencyDownload.is(dependency)) {
72
- const archiveBuffer = dependency.buffer;
73
- const plugins = [];
74
- if (dependency.archive === 'tar') {
75
- plugins.push(decompressTar());
76
- }
77
- else if (dependency.archive === 'tgz') {
78
- plugins.push(decompressTargz());
79
- }
80
- else if (dependency.archive === 'zip') {
81
- plugins.push(decompressUnzip());
82
- }
83
- const files = await decompress(archiveBuffer, directory, { plugins });
84
- const result = await Promise.all(files.map(async (file) => {
85
- const localPath = path.join(directory, file.path);
86
- return {
87
- path: localPath,
88
- target: file.path,
89
- mode: file.mode
90
- };
91
- }));
92
- return result;
93
- }
94
- else {
95
- const fileName = path.basename(dependency.file.path);
96
- const localPath = path.join(directory, fileName);
97
- await fs.writeFile(localPath, dependency.buffer);
98
- return [{
99
- path: localPath,
100
- target: dependency.file.path,
101
- mode: dependency.file.mode
102
- }];
103
- }
104
- }
105
- };
106
- __decorate([
107
- (0, inversify_1.inject)(core_1.ContributionProvider),
108
- (0, inversify_1.named)(remote_native_dependency_contribution_1.RemoteNativeDependencyContribution),
109
- __metadata("design:type", Object)
110
- ], RemoteNativeDependencyService.prototype, "nativeDependencyContributions", void 0);
111
- __decorate([
112
- (0, inversify_1.inject)(request_1.RequestService),
113
- __metadata("design:type", Object)
114
- ], RemoteNativeDependencyService.prototype, "requestService", void 0);
115
- RemoteNativeDependencyService = __decorate([
116
- (0, inversify_1.injectable)()
117
- ], RemoteNativeDependencyService);
118
- exports.RemoteNativeDependencyService = RemoteNativeDependencyService;
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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.RemoteNativeDependencyService = exports.DEFAULT_HTTP_OPTIONS = void 0;
28
+ const core_1 = require("@theia/core");
29
+ const inversify_1 = require("@theia/core/shared/inversify");
30
+ const request_1 = require("@theia/core/shared/@theia/request");
31
+ const decompress = require("decompress");
32
+ const path = require("path");
33
+ const fs = require("fs/promises");
34
+ const remote_native_dependency_contribution_1 = require("./remote-native-dependency-contribution");
35
+ const decompressTar = require('decompress-tar');
36
+ const decompressTargz = require('decompress-targz');
37
+ const decompressUnzip = require('decompress-unzip');
38
+ exports.DEFAULT_HTTP_OPTIONS = {
39
+ method: 'GET',
40
+ headers: {
41
+ Accept: 'application/octet-stream'
42
+ },
43
+ };
44
+ let RemoteNativeDependencyService = class RemoteNativeDependencyService {
45
+ async downloadDependencies(remotePlatform, directory) {
46
+ const contributionResults = await Promise.all(this.nativeDependencyContributions.getContributions()
47
+ .map(async (contribution) => {
48
+ const result = await contribution.download({
49
+ remotePlatform,
50
+ theiaVersion: core_1.THEIA_VERSION,
51
+ download: requestInfo => this.downloadDependency(requestInfo)
52
+ });
53
+ const dependency = await this.storeDependency(result, directory);
54
+ return dependency;
55
+ }));
56
+ return contributionResults.flat();
57
+ }
58
+ async downloadDependency(downloadURI) {
59
+ const options = typeof downloadURI === 'string'
60
+ ? { url: downloadURI, ...exports.DEFAULT_HTTP_OPTIONS }
61
+ : { ...exports.DEFAULT_HTTP_OPTIONS, ...downloadURI };
62
+ const req = await this.requestService.request(options);
63
+ if (request_1.RequestContext.isSuccess(req)) {
64
+ return Buffer.from(req.buffer);
65
+ }
66
+ else {
67
+ throw new Error('Server error while downloading native dependency from: ' + options.url);
68
+ }
69
+ }
70
+ async storeDependency(dependency, directory) {
71
+ if (remote_native_dependency_contribution_1.DirectoryDependencyDownload.is(dependency)) {
72
+ const archiveBuffer = dependency.buffer;
73
+ const plugins = [];
74
+ if (dependency.archive === 'tar') {
75
+ plugins.push(decompressTar());
76
+ }
77
+ else if (dependency.archive === 'tgz') {
78
+ plugins.push(decompressTargz());
79
+ }
80
+ else if (dependency.archive === 'zip') {
81
+ plugins.push(decompressUnzip());
82
+ }
83
+ const files = await decompress(archiveBuffer, directory, { plugins });
84
+ const result = await Promise.all(files.map(async (file) => {
85
+ const localPath = path.join(directory, file.path);
86
+ return {
87
+ path: localPath,
88
+ target: file.path,
89
+ mode: file.mode
90
+ };
91
+ }));
92
+ return result;
93
+ }
94
+ else {
95
+ const fileName = path.basename(dependency.file.path);
96
+ const localPath = path.join(directory, fileName);
97
+ await fs.writeFile(localPath, dependency.buffer);
98
+ return [{
99
+ path: localPath,
100
+ target: dependency.file.path,
101
+ mode: dependency.file.mode
102
+ }];
103
+ }
104
+ }
105
+ };
106
+ __decorate([
107
+ (0, inversify_1.inject)(core_1.ContributionProvider),
108
+ (0, inversify_1.named)(remote_native_dependency_contribution_1.RemoteNativeDependencyContribution),
109
+ __metadata("design:type", Object)
110
+ ], RemoteNativeDependencyService.prototype, "nativeDependencyContributions", void 0);
111
+ __decorate([
112
+ (0, inversify_1.inject)(request_1.RequestService),
113
+ __metadata("design:type", Object)
114
+ ], RemoteNativeDependencyService.prototype, "requestService", void 0);
115
+ RemoteNativeDependencyService = __decorate([
116
+ (0, inversify_1.injectable)()
117
+ ], RemoteNativeDependencyService);
118
+ exports.RemoteNativeDependencyService = RemoteNativeDependencyService;
119
119
  //# sourceMappingURL=remote-native-dependency-service.js.map
@@ -1,23 +1,23 @@
1
- import { RequestService } from '@theia/core/shared/@theia/request';
2
- import { RemoteSetupScriptService } from './remote-setup-script-service';
3
- import { RemotePlatform } from '../remote-types';
4
- /**
5
- * The current node version that Theia recommends.
6
- *
7
- * Native dependencies are compiled against this version.
8
- */
9
- export declare const REMOTE_NODE_VERSION = "18.17.0";
10
- export declare class RemoteNodeSetupService {
11
- protected readonly requestService: RequestService;
12
- protected readonly scriptService: RemoteSetupScriptService;
13
- getNodeDirectoryName(platform: RemotePlatform): string;
14
- protected getPlatformName(platform: RemotePlatform): string;
15
- protected validatePlatform(platform: RemotePlatform): void;
16
- protected throwPlatformError(platform: RemotePlatform, supportedArch: string): never;
17
- protected getNodeFileExtension(platform: RemotePlatform): string;
18
- getNodeFileName(platform: RemotePlatform): string;
19
- downloadNode(platform: RemotePlatform, downloadTemplate?: string): Promise<string>;
20
- generateDownloadScript(platform: RemotePlatform, targetPath: string, downloadTemplate?: string): string;
21
- protected getDownloadPath(platform: RemotePlatform, downloadTemplate?: string): string;
22
- }
1
+ import { RequestService } from '@theia/core/shared/@theia/request';
2
+ import { RemoteSetupScriptService } from './remote-setup-script-service';
3
+ import { RemotePlatform } from '../remote-types';
4
+ /**
5
+ * The current node version that Theia recommends.
6
+ *
7
+ * Native dependencies are compiled against this version.
8
+ */
9
+ export declare const REMOTE_NODE_VERSION = "18.17.0";
10
+ export declare class RemoteNodeSetupService {
11
+ protected readonly requestService: RequestService;
12
+ protected readonly scriptService: RemoteSetupScriptService;
13
+ getNodeDirectoryName(platform: RemotePlatform): string;
14
+ protected getPlatformName(platform: RemotePlatform): string;
15
+ protected validatePlatform(platform: RemotePlatform): void;
16
+ protected throwPlatformError(platform: RemotePlatform, supportedArch: string): never;
17
+ protected getNodeFileExtension(platform: RemotePlatform): string;
18
+ getNodeFileName(platform: RemotePlatform): string;
19
+ downloadNode(platform: RemotePlatform, downloadTemplate?: string): Promise<string>;
20
+ generateDownloadScript(platform: RemotePlatform, targetPath: string, downloadTemplate?: string): string;
21
+ protected getDownloadPath(platform: RemotePlatform, downloadTemplate?: string): string;
22
+ }
23
23
  //# sourceMappingURL=remote-node-setup-service.d.ts.map
@@ -1,133 +1,133 @@
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
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.RemoteNodeSetupService = exports.REMOTE_NODE_VERSION = void 0;
28
- const path = require("path");
29
- const fs = require("@theia/core/shared/fs-extra");
30
- const os = require("os");
31
- const inversify_1 = require("@theia/core/shared/inversify");
32
- const request_1 = require("@theia/core/shared/@theia/request");
33
- const remote_setup_script_service_1 = require("./remote-setup-script-service");
34
- const core_1 = require("@theia/core");
35
- /**
36
- * The current node version that Theia recommends.
37
- *
38
- * Native dependencies are compiled against this version.
39
- */
40
- exports.REMOTE_NODE_VERSION = '18.17.0';
41
- let RemoteNodeSetupService = class RemoteNodeSetupService {
42
- getNodeDirectoryName(platform) {
43
- return `node-v${exports.REMOTE_NODE_VERSION}-${this.getPlatformName(platform)}-${platform.arch}`;
44
- }
45
- getPlatformName(platform) {
46
- let platformId;
47
- if (platform.os === core_1.OS.Type.Windows) {
48
- platformId = 'win';
49
- }
50
- else if (platform.os === core_1.OS.Type.OSX) {
51
- platformId = 'darwin';
52
- }
53
- else {
54
- platformId = 'linux';
55
- }
56
- return platformId;
57
- }
58
- validatePlatform(platform) {
59
- if (platform.os === core_1.OS.Type.Windows && !platform.arch.match(/^x(64|86)$/)) {
60
- this.throwPlatformError(platform, 'x64 and x86');
61
- }
62
- else if (platform.os === core_1.OS.Type.Linux && !platform.arch.match(/^(x64|armv7l|arm64)$/)) {
63
- this.throwPlatformError(platform, 'x64, armv7l and arm64');
64
- }
65
- else if (platform.os === core_1.OS.Type.OSX && !platform.arch.match(/^(x64|arm64)$/)) {
66
- this.throwPlatformError(platform, 'x64 and arm64');
67
- }
68
- }
69
- throwPlatformError(platform, supportedArch) {
70
- throw new Error(`Invalid architecture for ${platform.os}: '${platform.arch}'. Only ${supportedArch} are supported.`);
71
- }
72
- getNodeFileExtension(platform) {
73
- let fileExtension;
74
- if (platform.os === core_1.OS.Type.Windows) {
75
- fileExtension = 'zip';
76
- }
77
- else if (platform.os === core_1.OS.Type.OSX) {
78
- fileExtension = 'tar.gz';
79
- }
80
- else {
81
- fileExtension = 'tar.xz';
82
- }
83
- return fileExtension;
84
- }
85
- getNodeFileName(platform) {
86
- return `${this.getNodeDirectoryName(platform)}.${this.getNodeFileExtension(platform)}`;
87
- }
88
- async downloadNode(platform, downloadTemplate) {
89
- this.validatePlatform(platform);
90
- const fileName = this.getNodeFileName(platform);
91
- const tmpdir = os.tmpdir();
92
- const localPath = path.join(tmpdir, fileName);
93
- if (!await fs.pathExists(localPath)) {
94
- const downloadPath = this.getDownloadPath(platform, downloadTemplate);
95
- const downloadResult = await this.requestService.request({
96
- url: downloadPath
97
- });
98
- await fs.writeFile(localPath, downloadResult.buffer);
99
- }
100
- return localPath;
101
- }
102
- generateDownloadScript(platform, targetPath, downloadTemplate) {
103
- this.validatePlatform(platform);
104
- const fileName = this.getNodeFileName(platform);
105
- const downloadPath = this.getDownloadPath(platform, downloadTemplate);
106
- const zipPath = this.scriptService.joinPath(platform, targetPath, fileName);
107
- const download = this.scriptService.downloadFile(platform, downloadPath, zipPath);
108
- const unzip = this.scriptService.unzip(platform, zipPath, targetPath);
109
- return this.scriptService.joinScript(platform, download, unzip);
110
- }
111
- getDownloadPath(platform, downloadTemplate) {
112
- const template = downloadTemplate || 'https://nodejs.org/dist/v{version}/node-v{version}-{os}-{arch}.{ext}';
113
- const downloadPath = template
114
- .replace(/{version}/g, exports.REMOTE_NODE_VERSION)
115
- .replace(/{os}/g, this.getPlatformName(platform))
116
- .replace(/{arch}/g, platform.arch)
117
- .replace(/{ext}/g, this.getNodeFileExtension(platform));
118
- return downloadPath;
119
- }
120
- };
121
- __decorate([
122
- (0, inversify_1.inject)(request_1.RequestService),
123
- __metadata("design:type", Object)
124
- ], RemoteNodeSetupService.prototype, "requestService", void 0);
125
- __decorate([
126
- (0, inversify_1.inject)(remote_setup_script_service_1.RemoteSetupScriptService),
127
- __metadata("design:type", remote_setup_script_service_1.RemoteSetupScriptService)
128
- ], RemoteNodeSetupService.prototype, "scriptService", void 0);
129
- RemoteNodeSetupService = __decorate([
130
- (0, inversify_1.injectable)()
131
- ], RemoteNodeSetupService);
132
- exports.RemoteNodeSetupService = RemoteNodeSetupService;
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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.RemoteNodeSetupService = exports.REMOTE_NODE_VERSION = void 0;
28
+ const path = require("path");
29
+ const fs = require("@theia/core/shared/fs-extra");
30
+ const os = require("os");
31
+ const inversify_1 = require("@theia/core/shared/inversify");
32
+ const request_1 = require("@theia/core/shared/@theia/request");
33
+ const remote_setup_script_service_1 = require("./remote-setup-script-service");
34
+ const core_1 = require("@theia/core");
35
+ /**
36
+ * The current node version that Theia recommends.
37
+ *
38
+ * Native dependencies are compiled against this version.
39
+ */
40
+ exports.REMOTE_NODE_VERSION = '18.17.0';
41
+ let RemoteNodeSetupService = class RemoteNodeSetupService {
42
+ getNodeDirectoryName(platform) {
43
+ return `node-v${exports.REMOTE_NODE_VERSION}-${this.getPlatformName(platform)}-${platform.arch}`;
44
+ }
45
+ getPlatformName(platform) {
46
+ let platformId;
47
+ if (platform.os === core_1.OS.Type.Windows) {
48
+ platformId = 'win';
49
+ }
50
+ else if (platform.os === core_1.OS.Type.OSX) {
51
+ platformId = 'darwin';
52
+ }
53
+ else {
54
+ platformId = 'linux';
55
+ }
56
+ return platformId;
57
+ }
58
+ validatePlatform(platform) {
59
+ if (platform.os === core_1.OS.Type.Windows && !platform.arch.match(/^x(64|86)$/)) {
60
+ this.throwPlatformError(platform, 'x64 and x86');
61
+ }
62
+ else if (platform.os === core_1.OS.Type.Linux && !platform.arch.match(/^(x64|armv7l|arm64)$/)) {
63
+ this.throwPlatformError(platform, 'x64, armv7l and arm64');
64
+ }
65
+ else if (platform.os === core_1.OS.Type.OSX && !platform.arch.match(/^(x64|arm64)$/)) {
66
+ this.throwPlatformError(platform, 'x64 and arm64');
67
+ }
68
+ }
69
+ throwPlatformError(platform, supportedArch) {
70
+ throw new Error(`Invalid architecture for ${platform.os}: '${platform.arch}'. Only ${supportedArch} are supported.`);
71
+ }
72
+ getNodeFileExtension(platform) {
73
+ let fileExtension;
74
+ if (platform.os === core_1.OS.Type.Windows) {
75
+ fileExtension = 'zip';
76
+ }
77
+ else if (platform.os === core_1.OS.Type.OSX) {
78
+ fileExtension = 'tar.gz';
79
+ }
80
+ else {
81
+ fileExtension = 'tar.xz';
82
+ }
83
+ return fileExtension;
84
+ }
85
+ getNodeFileName(platform) {
86
+ return `${this.getNodeDirectoryName(platform)}.${this.getNodeFileExtension(platform)}`;
87
+ }
88
+ async downloadNode(platform, downloadTemplate) {
89
+ this.validatePlatform(platform);
90
+ const fileName = this.getNodeFileName(platform);
91
+ const tmpdir = os.tmpdir();
92
+ const localPath = path.join(tmpdir, fileName);
93
+ if (!await fs.pathExists(localPath)) {
94
+ const downloadPath = this.getDownloadPath(platform, downloadTemplate);
95
+ const downloadResult = await this.requestService.request({
96
+ url: downloadPath
97
+ });
98
+ await fs.writeFile(localPath, downloadResult.buffer);
99
+ }
100
+ return localPath;
101
+ }
102
+ generateDownloadScript(platform, targetPath, downloadTemplate) {
103
+ this.validatePlatform(platform);
104
+ const fileName = this.getNodeFileName(platform);
105
+ const downloadPath = this.getDownloadPath(platform, downloadTemplate);
106
+ const zipPath = this.scriptService.joinPath(platform, targetPath, fileName);
107
+ const download = this.scriptService.downloadFile(platform, downloadPath, zipPath);
108
+ const unzip = this.scriptService.unzip(platform, zipPath, targetPath);
109
+ return this.scriptService.joinScript(platform, download, unzip);
110
+ }
111
+ getDownloadPath(platform, downloadTemplate) {
112
+ const template = downloadTemplate || 'https://nodejs.org/dist/v{version}/node-v{version}-{os}-{arch}.{ext}';
113
+ const downloadPath = template
114
+ .replace(/{version}/g, exports.REMOTE_NODE_VERSION)
115
+ .replace(/{os}/g, this.getPlatformName(platform))
116
+ .replace(/{arch}/g, platform.arch)
117
+ .replace(/{ext}/g, this.getNodeFileExtension(platform));
118
+ return downloadPath;
119
+ }
120
+ };
121
+ __decorate([
122
+ (0, inversify_1.inject)(request_1.RequestService),
123
+ __metadata("design:type", Object)
124
+ ], RemoteNodeSetupService.prototype, "requestService", void 0);
125
+ __decorate([
126
+ (0, inversify_1.inject)(remote_setup_script_service_1.RemoteSetupScriptService),
127
+ __metadata("design:type", remote_setup_script_service_1.RemoteSetupScriptService)
128
+ ], RemoteNodeSetupService.prototype, "scriptService", void 0);
129
+ RemoteNodeSetupService = __decorate([
130
+ (0, inversify_1.injectable)()
131
+ ], RemoteNodeSetupService);
132
+ exports.RemoteNodeSetupService = RemoteNodeSetupService;
133
133
  //# sourceMappingURL=remote-node-setup-service.js.map
@@ -1,41 +1,41 @@
1
- import { RemotePlatform } from '../remote-types';
2
- export interface RemoteScriptStrategy {
3
- exec(): string;
4
- downloadFile(url: string, output: string): string;
5
- unzip(file: string, directory: string): string;
6
- mkdir(path: string): string;
7
- home(): string;
8
- joinPath(...segments: string[]): string;
9
- joinScript(...segments: string[]): string;
10
- }
11
- export declare class RemoteWindowsScriptStrategy implements RemoteScriptStrategy {
12
- home(): string;
13
- exec(): string;
14
- downloadFile(url: string, output: string): string;
15
- unzip(file: string, directory: string): string;
16
- mkdir(path: string): string;
17
- joinPath(...segments: string[]): string;
18
- joinScript(...segments: string[]): string;
19
- }
20
- export declare class RemotePosixScriptStrategy implements RemoteScriptStrategy {
21
- home(): string;
22
- exec(): string;
23
- downloadFile(url: string, output: string): string;
24
- unzip(file: string, directory: string): string;
25
- mkdir(path: string): string;
26
- joinPath(...segments: string[]): string;
27
- joinScript(...segments: string[]): string;
28
- }
29
- export declare class RemoteSetupScriptService {
30
- protected windowsStrategy: RemoteWindowsScriptStrategy;
31
- protected posixStrategy: RemotePosixScriptStrategy;
32
- protected getStrategy(platform: RemotePlatform): RemoteScriptStrategy;
33
- home(platform: RemotePlatform): string;
34
- exec(platform: RemotePlatform): string;
35
- downloadFile(platform: RemotePlatform, url: string, output: string): string;
36
- unzip(platform: RemotePlatform, file: string, directory: string): string;
37
- mkdir(platform: RemotePlatform, path: string): string;
38
- joinPath(platform: RemotePlatform, ...segments: string[]): string;
39
- joinScript(platform: RemotePlatform, ...segments: string[]): string;
40
- }
1
+ import { RemotePlatform } from '../remote-types';
2
+ export interface RemoteScriptStrategy {
3
+ exec(): string;
4
+ downloadFile(url: string, output: string): string;
5
+ unzip(file: string, directory: string): string;
6
+ mkdir(path: string): string;
7
+ home(): string;
8
+ joinPath(...segments: string[]): string;
9
+ joinScript(...segments: string[]): string;
10
+ }
11
+ export declare class RemoteWindowsScriptStrategy implements RemoteScriptStrategy {
12
+ home(): string;
13
+ exec(): string;
14
+ downloadFile(url: string, output: string): string;
15
+ unzip(file: string, directory: string): string;
16
+ mkdir(path: string): string;
17
+ joinPath(...segments: string[]): string;
18
+ joinScript(...segments: string[]): string;
19
+ }
20
+ export declare class RemotePosixScriptStrategy implements RemoteScriptStrategy {
21
+ home(): string;
22
+ exec(): string;
23
+ downloadFile(url: string, output: string): string;
24
+ unzip(file: string, directory: string): string;
25
+ mkdir(path: string): string;
26
+ joinPath(...segments: string[]): string;
27
+ joinScript(...segments: string[]): string;
28
+ }
29
+ export declare class RemoteSetupScriptService {
30
+ protected windowsStrategy: RemoteWindowsScriptStrategy;
31
+ protected posixStrategy: RemotePosixScriptStrategy;
32
+ protected getStrategy(platform: RemotePlatform): RemoteScriptStrategy;
33
+ home(platform: RemotePlatform): string;
34
+ exec(platform: RemotePlatform): string;
35
+ downloadFile(platform: RemotePlatform, url: string, output: string): string;
36
+ unzip(platform: RemotePlatform, file: string, directory: string): string;
37
+ mkdir(platform: RemotePlatform, path: string): string;
38
+ joinPath(platform: RemotePlatform, ...segments: string[]): string;
39
+ joinScript(platform: RemotePlatform, ...segments: string[]): string;
40
+ }
41
41
  //# sourceMappingURL=remote-setup-script-service.d.ts.map