@theia/terminal 1.34.2 → 1.34.3

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 (121) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +30 -30
  3. package/lib/browser/base/terminal-service.d.ts +34 -34
  4. package/lib/browser/base/terminal-service.js +7 -7
  5. package/lib/browser/base/terminal-widget.d.ts +184 -184
  6. package/lib/browser/base/terminal-widget.js +34 -34
  7. package/lib/browser/index.d.ts +1 -1
  8. package/lib/browser/index.js +28 -28
  9. package/lib/browser/search/terminal-search-container.d.ts +3 -3
  10. package/lib/browser/search/terminal-search-container.js +28 -28
  11. package/lib/browser/search/terminal-search-widget.d.ts +30 -30
  12. package/lib/browser/search/terminal-search-widget.js +147 -147
  13. package/lib/browser/shell-terminal-profile.d.ts +19 -19
  14. package/lib/browser/shell-terminal-profile.js +39 -39
  15. package/lib/browser/terminal-contribution.d.ts +3 -3
  16. package/lib/browser/terminal-contribution.js +20 -20
  17. package/lib/browser/terminal-copy-on-selection-handler.d.ts +10 -10
  18. package/lib/browser/terminal-copy-on-selection-handler.js +103 -103
  19. package/lib/browser/terminal-file-link-provider.d.ts +24 -24
  20. package/lib/browser/terminal-file-link-provider.js +200 -200
  21. package/lib/browser/terminal-frontend-contribution.d.ts +112 -112
  22. package/lib/browser/terminal-frontend-contribution.js +994 -994
  23. package/lib/browser/terminal-frontend-module.d.ts +5 -5
  24. package/lib/browser/terminal-frontend-module.js +115 -115
  25. package/lib/browser/terminal-keybinding-contexts.d.ts +15 -15
  26. package/lib/browser/terminal-keybinding-contexts.js +71 -71
  27. package/lib/browser/terminal-link-helpers.d.ts +27 -27
  28. package/lib/browser/terminal-link-helpers.js +155 -155
  29. package/lib/browser/terminal-link-provider.d.ts +51 -51
  30. package/lib/browser/terminal-link-provider.js +197 -197
  31. package/lib/browser/terminal-preferences.d.ts +61 -61
  32. package/lib/browser/terminal-preferences.js +329 -329
  33. package/lib/browser/terminal-profile-service.d.ts +55 -55
  34. package/lib/browser/terminal-profile-service.js +149 -149
  35. package/lib/browser/terminal-quick-open-service.d.ts +36 -36
  36. package/lib/browser/terminal-quick-open-service.js +137 -137
  37. package/lib/browser/terminal-theme-service.d.ts +21 -21
  38. package/lib/browser/terminal-theme-service.js +218 -218
  39. package/lib/browser/terminal-url-link-provider.d.ts +11 -11
  40. package/lib/browser/terminal-url-link-provider.js +76 -76
  41. package/lib/browser/terminal-widget-impl.d.ts +173 -173
  42. package/lib/browser/terminal-widget-impl.js +769 -769
  43. package/lib/common/base-terminal-protocol.d.ts +100 -100
  44. package/lib/common/base-terminal-protocol.js +88 -88
  45. package/lib/common/shell-terminal-protocol.d.ts +29 -29
  46. package/lib/common/shell-terminal-protocol.js +22 -22
  47. package/lib/common/terminal-common-module.d.ts +7 -7
  48. package/lib/common/terminal-common-module.js +31 -31
  49. package/lib/common/terminal-protocol.d.ts +12 -12
  50. package/lib/common/terminal-protocol.js +21 -21
  51. package/lib/common/terminal-watcher.d.ts +13 -13
  52. package/lib/common/terminal-watcher.js +70 -70
  53. package/lib/node/base-terminal-server.d.ts +36 -36
  54. package/lib/node/base-terminal-server.js +252 -252
  55. package/lib/node/buffering-stream.d.ts +39 -39
  56. package/lib/node/buffering-stream.js +75 -75
  57. package/lib/node/buffering-stream.spec.d.ts +1 -1
  58. package/lib/node/buffering-stream.spec.js +43 -43
  59. package/lib/node/index.d.ts +1 -1
  60. package/lib/node/index.js +28 -28
  61. package/lib/node/shell-process.d.ts +26 -26
  62. package/lib/node/shell-process.js +106 -106
  63. package/lib/node/shell-terminal-server.d.ts +14 -14
  64. package/lib/node/shell-terminal-server.js +114 -114
  65. package/lib/node/shell-terminal-server.spec.d.ts +1 -1
  66. package/lib/node/shell-terminal-server.spec.js +35 -35
  67. package/lib/node/terminal-backend-contribution.d.ts +9 -9
  68. package/lib/node/terminal-backend-contribution.js +75 -75
  69. package/lib/node/terminal-backend-contribution.slow-spec.d.ts +1 -1
  70. package/lib/node/terminal-backend-contribution.slow-spec.js +54 -54
  71. package/lib/node/terminal-backend-module.d.ts +11 -11
  72. package/lib/node/terminal-backend-module.js +69 -69
  73. package/lib/node/terminal-server.d.ts +9 -9
  74. package/lib/node/terminal-server.js +64 -64
  75. package/lib/node/terminal-server.spec.d.ts +1 -1
  76. package/lib/node/terminal-server.spec.js +41 -41
  77. package/lib/node/test/terminal-test-container.d.ts +2 -2
  78. package/lib/node/test/terminal-test-container.js +40 -40
  79. package/lib/package.spec.js +25 -25
  80. package/package.json +9 -9
  81. package/src/browser/base/terminal-service.ts +60 -60
  82. package/src/browser/base/terminal-widget.ts +244 -244
  83. package/src/browser/index.ts +17 -17
  84. package/src/browser/search/terminal-search-container.ts +28 -28
  85. package/src/browser/search/terminal-search-widget.tsx +161 -161
  86. package/src/browser/shell-terminal-profile.ts +40 -40
  87. package/src/browser/style/terminal-search.css +93 -93
  88. package/src/browser/style/terminal.css +33 -33
  89. package/src/browser/terminal-contribution.ts +19 -19
  90. package/src/browser/terminal-copy-on-selection-handler.ts +92 -92
  91. package/src/browser/terminal-file-link-provider.ts +200 -200
  92. package/src/browser/terminal-frontend-contribution.ts +1048 -1048
  93. package/src/browser/terminal-frontend-module.ts +139 -139
  94. package/src/browser/terminal-keybinding-contexts.ts +52 -52
  95. package/src/browser/terminal-link-helpers.ts +187 -187
  96. package/src/browser/terminal-link-provider.ts +203 -203
  97. package/src/browser/terminal-preferences.ts +427 -427
  98. package/src/browser/terminal-profile-service.ts +170 -170
  99. package/src/browser/terminal-quick-open-service.ts +132 -132
  100. package/src/browser/terminal-theme-service.ts +209 -209
  101. package/src/browser/terminal-url-link-provider.ts +66 -66
  102. package/src/browser/terminal-widget-impl.ts +827 -827
  103. package/src/common/base-terminal-protocol.ts +183 -183
  104. package/src/common/shell-terminal-protocol.ts +50 -50
  105. package/src/common/terminal-common-module.ts +30 -30
  106. package/src/common/terminal-protocol.ts +32 -32
  107. package/src/common/terminal-watcher.ts +69 -69
  108. package/src/node/base-terminal-server.ts +279 -279
  109. package/src/node/buffering-stream.spec.ts +46 -46
  110. package/src/node/buffering-stream.ts +95 -95
  111. package/src/node/index.ts +17 -17
  112. package/src/node/shell-process.ts +101 -101
  113. package/src/node/shell-terminal-server.spec.ts +40 -40
  114. package/src/node/shell-terminal-server.ts +95 -95
  115. package/src/node/terminal-backend-contribution.slow-spec.ts +63 -63
  116. package/src/node/terminal-backend-contribution.ts +60 -60
  117. package/src/node/terminal-backend-module.ts +82 -82
  118. package/src/node/terminal-server.spec.ts +47 -47
  119. package/src/node/terminal-server.ts +52 -52
  120. package/src/node/test/terminal-test-container.ts +39 -39
  121. package/src/package.spec.ts +28 -28
@@ -1,115 +1,115 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2017 Ericsson 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 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
- var __param = (this && this.__param) || function (paramIndex, decorator) {
27
- return function (target, key) { decorator(target, key, paramIndex); }
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.ShellTerminalServer = void 0;
31
- const inversify_1 = require("@theia/core/shared/inversify");
32
- const logger_1 = require("@theia/core/lib/common/logger");
33
- const environment_utils_1 = require("@theia/core/lib/node/environment-utils");
34
- const base_terminal_server_1 = require("./base-terminal-server");
35
- const shell_process_1 = require("./shell-process");
36
- const node_1 = require("@theia/process/lib/node");
37
- const os_1 = require("@theia/core/lib/common/os");
38
- const cp = require("child_process");
39
- let ShellTerminalServer = class ShellTerminalServer extends base_terminal_server_1.BaseTerminalServer {
40
- constructor(shellFactory, processManager, logger) {
41
- super(processManager, logger);
42
- this.shellFactory = shellFactory;
43
- }
44
- async create(options) {
45
- try {
46
- if (options.strictEnv !== true) {
47
- options.env = this.environmentUtils.mergeProcessEnv(options.env);
48
- this.mergedCollection.applyToProcessEnvironment(options.env);
49
- }
50
- const term = this.shellFactory(options);
51
- this.postCreate(term);
52
- return term.id;
53
- }
54
- catch (error) {
55
- this.logger.error('Error while creating terminal', error);
56
- return -1;
57
- }
58
- }
59
- // copied and modified from https://github.com/microsoft/vscode/blob/4636be2b71c87bfb0bfe3c94278b447a5efcc1f1/src/vs/workbench/contrib/debug/node/terminals.ts#L32-L75
60
- spawnAsPromised(command, args) {
61
- return new Promise((resolve, reject) => {
62
- let stdout = '';
63
- const child = cp.spawn(command, args);
64
- if (child.pid) {
65
- child.stdout.on('data', (data) => {
66
- stdout += data.toString();
67
- });
68
- }
69
- child.on('error', err => {
70
- reject(err);
71
- });
72
- child.on('close', code => {
73
- resolve(stdout);
74
- });
75
- });
76
- }
77
- hasChildProcesses(processId) {
78
- if (processId) {
79
- // if shell has at least one child process, assume that shell is busy
80
- if (os_1.isWindows) {
81
- return this.spawnAsPromised('wmic', ['process', 'get', 'ParentProcessId']).then(stdout => {
82
- const pids = stdout.split('\r\n');
83
- return pids.some(p => parseInt(p) === processId);
84
- }, error => true);
85
- }
86
- else {
87
- return this.spawnAsPromised('/usr/bin/pgrep', ['-lP', String(processId)]).then(stdout => {
88
- const r = stdout.trim();
89
- if (r.length === 0 || r.indexOf(' tmux') >= 0) { // ignore 'tmux';
90
- return false;
91
- }
92
- else {
93
- return true;
94
- }
95
- }, error => true);
96
- }
97
- }
98
- // fall back to safe side
99
- return Promise.resolve(true);
100
- }
101
- };
102
- __decorate([
103
- (0, inversify_1.inject)(environment_utils_1.EnvironmentUtils),
104
- __metadata("design:type", environment_utils_1.EnvironmentUtils)
105
- ], ShellTerminalServer.prototype, "environmentUtils", void 0);
106
- ShellTerminalServer = __decorate([
107
- (0, inversify_1.injectable)(),
108
- __param(0, (0, inversify_1.inject)(shell_process_1.ShellProcessFactory)),
109
- __param(1, (0, inversify_1.inject)(node_1.ProcessManager)),
110
- __param(2, (0, inversify_1.inject)(logger_1.ILogger)),
111
- __param(2, (0, inversify_1.named)('terminal')),
112
- __metadata("design:paramtypes", [Function, node_1.ProcessManager, Object])
113
- ], ShellTerminalServer);
114
- exports.ShellTerminalServer = ShellTerminalServer;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017 Ericsson 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 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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
27
+ return function (target, key) { decorator(target, key, paramIndex); }
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.ShellTerminalServer = void 0;
31
+ const inversify_1 = require("@theia/core/shared/inversify");
32
+ const logger_1 = require("@theia/core/lib/common/logger");
33
+ const environment_utils_1 = require("@theia/core/lib/node/environment-utils");
34
+ const base_terminal_server_1 = require("./base-terminal-server");
35
+ const shell_process_1 = require("./shell-process");
36
+ const node_1 = require("@theia/process/lib/node");
37
+ const os_1 = require("@theia/core/lib/common/os");
38
+ const cp = require("child_process");
39
+ let ShellTerminalServer = class ShellTerminalServer extends base_terminal_server_1.BaseTerminalServer {
40
+ constructor(shellFactory, processManager, logger) {
41
+ super(processManager, logger);
42
+ this.shellFactory = shellFactory;
43
+ }
44
+ async create(options) {
45
+ try {
46
+ if (options.strictEnv !== true) {
47
+ options.env = this.environmentUtils.mergeProcessEnv(options.env);
48
+ this.mergedCollection.applyToProcessEnvironment(options.env);
49
+ }
50
+ const term = this.shellFactory(options);
51
+ this.postCreate(term);
52
+ return term.id;
53
+ }
54
+ catch (error) {
55
+ this.logger.error('Error while creating terminal', error);
56
+ return -1;
57
+ }
58
+ }
59
+ // copied and modified from https://github.com/microsoft/vscode/blob/4636be2b71c87bfb0bfe3c94278b447a5efcc1f1/src/vs/workbench/contrib/debug/node/terminals.ts#L32-L75
60
+ spawnAsPromised(command, args) {
61
+ return new Promise((resolve, reject) => {
62
+ let stdout = '';
63
+ const child = cp.spawn(command, args);
64
+ if (child.pid) {
65
+ child.stdout.on('data', (data) => {
66
+ stdout += data.toString();
67
+ });
68
+ }
69
+ child.on('error', err => {
70
+ reject(err);
71
+ });
72
+ child.on('close', code => {
73
+ resolve(stdout);
74
+ });
75
+ });
76
+ }
77
+ hasChildProcesses(processId) {
78
+ if (processId) {
79
+ // if shell has at least one child process, assume that shell is busy
80
+ if (os_1.isWindows) {
81
+ return this.spawnAsPromised('wmic', ['process', 'get', 'ParentProcessId']).then(stdout => {
82
+ const pids = stdout.split('\r\n');
83
+ return pids.some(p => parseInt(p) === processId);
84
+ }, error => true);
85
+ }
86
+ else {
87
+ return this.spawnAsPromised('/usr/bin/pgrep', ['-lP', String(processId)]).then(stdout => {
88
+ const r = stdout.trim();
89
+ if (r.length === 0 || r.indexOf(' tmux') >= 0) { // ignore 'tmux';
90
+ return false;
91
+ }
92
+ else {
93
+ return true;
94
+ }
95
+ }, error => true);
96
+ }
97
+ }
98
+ // fall back to safe side
99
+ return Promise.resolve(true);
100
+ }
101
+ };
102
+ __decorate([
103
+ (0, inversify_1.inject)(environment_utils_1.EnvironmentUtils),
104
+ __metadata("design:type", environment_utils_1.EnvironmentUtils)
105
+ ], ShellTerminalServer.prototype, "environmentUtils", void 0);
106
+ ShellTerminalServer = __decorate([
107
+ (0, inversify_1.injectable)(),
108
+ __param(0, (0, inversify_1.inject)(shell_process_1.ShellProcessFactory)),
109
+ __param(1, (0, inversify_1.inject)(node_1.ProcessManager)),
110
+ __param(2, (0, inversify_1.inject)(logger_1.ILogger)),
111
+ __param(2, (0, inversify_1.named)('terminal')),
112
+ __metadata("design:paramtypes", [Function, node_1.ProcessManager, Object])
113
+ ], ShellTerminalServer);
114
+ exports.ShellTerminalServer = ShellTerminalServer;
115
115
  //# sourceMappingURL=shell-terminal-server.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=shell-terminal-server.spec.d.ts.map
@@ -1,36 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // *****************************************************************************
4
- // Copyright (C) 2017 Ericsson and others.
5
- //
6
- // This program and the accompanying materials are made available under the
7
- // terms of the Eclipse Public License v. 2.0 which is available at
8
- // http://www.eclipse.org/legal/epl-2.0.
9
- //
10
- // This Source Code may also be made available under the following Secondary
11
- // Licenses when the conditions for such availability set forth in the Eclipse
12
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
13
- // with the GNU Classpath Exception which is available at
14
- // https://www.gnu.org/software/classpath/license.html.
15
- //
16
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
17
- // *****************************************************************************
18
- const chai = require("chai");
19
- const terminal_test_container_1 = require("./test/terminal-test-container");
20
- const shell_terminal_protocol_1 = require("../common/shell-terminal-protocol");
21
- /**
22
- * Globals
23
- */
24
- const expect = chai.expect;
25
- describe('ShellServer', function () {
26
- this.timeout(5000);
27
- let shellTerminalServer;
28
- beforeEach(() => {
29
- shellTerminalServer = (0, terminal_test_container_1.createTerminalTestContainer)().get(shell_terminal_protocol_1.IShellTerminalServer);
30
- });
31
- it('test shell terminal create', async function () {
32
- const createResult = shellTerminalServer.create({});
33
- expect(await createResult).to.be.greaterThan(-1);
34
- });
35
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // *****************************************************************************
4
+ // Copyright (C) 2017 Ericsson and others.
5
+ //
6
+ // This program and the accompanying materials are made available under the
7
+ // terms of the Eclipse Public License v. 2.0 which is available at
8
+ // http://www.eclipse.org/legal/epl-2.0.
9
+ //
10
+ // This Source Code may also be made available under the following Secondary
11
+ // Licenses when the conditions for such availability set forth in the Eclipse
12
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
13
+ // with the GNU Classpath Exception which is available at
14
+ // https://www.gnu.org/software/classpath/license.html.
15
+ //
16
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
17
+ // *****************************************************************************
18
+ const chai = require("chai");
19
+ const terminal_test_container_1 = require("./test/terminal-test-container");
20
+ const shell_terminal_protocol_1 = require("../common/shell-terminal-protocol");
21
+ /**
22
+ * Globals
23
+ */
24
+ const expect = chai.expect;
25
+ describe('ShellServer', function () {
26
+ this.timeout(5000);
27
+ let shellTerminalServer;
28
+ beforeEach(() => {
29
+ shellTerminalServer = (0, terminal_test_container_1.createTerminalTestContainer)().get(shell_terminal_protocol_1.IShellTerminalServer);
30
+ });
31
+ it('test shell terminal create', async function () {
32
+ const createResult = shellTerminalServer.create({});
33
+ expect(await createResult).to.be.greaterThan(-1);
34
+ });
35
+ });
36
36
  //# sourceMappingURL=shell-terminal-server.spec.js.map
@@ -1,10 +1,10 @@
1
- import { ILogger } from '@theia/core/lib/common';
2
- import { ProcessManager } from '@theia/process/lib/node';
3
- import { MessagingService } from '@theia/core/lib/node/messaging/messaging-service';
4
- export declare class TerminalBackendContribution implements MessagingService.Contribution {
5
- protected readonly decoder: TextDecoder;
6
- protected readonly processManager: ProcessManager;
7
- protected readonly logger: ILogger;
8
- configure(service: MessagingService): void;
9
- }
1
+ import { ILogger } from '@theia/core/lib/common';
2
+ import { ProcessManager } from '@theia/process/lib/node';
3
+ import { MessagingService } from '@theia/core/lib/node/messaging/messaging-service';
4
+ export declare class TerminalBackendContribution implements MessagingService.Contribution {
5
+ protected readonly decoder: TextDecoder;
6
+ protected readonly processManager: ProcessManager;
7
+ protected readonly logger: ILogger;
8
+ configure(service: MessagingService): void;
9
+ }
10
10
  //# sourceMappingURL=terminal-backend-contribution.d.ts.map
@@ -1,76 +1,76 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2017 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 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.TerminalBackendContribution = void 0;
28
- const inversify_1 = require("@theia/core/shared/inversify");
29
- const common_1 = require("@theia/core/lib/common");
30
- const node_1 = require("@theia/process/lib/node");
31
- const terminal_protocol_1 = require("../common/terminal-protocol");
32
- const buffering_stream_1 = require("./buffering-stream");
33
- let TerminalBackendContribution = class TerminalBackendContribution {
34
- constructor() {
35
- this.decoder = new TextDecoder('utf-8');
36
- }
37
- configure(service) {
38
- service.wsChannel(`${terminal_protocol_1.terminalsPath}/:id`, (params, channel) => {
39
- const id = parseInt(params.id, 10);
40
- const termProcess = this.processManager.get(id);
41
- if (termProcess instanceof node_1.TerminalProcess) {
42
- const output = termProcess.createOutputStream();
43
- // Create a RPC connection to the terminal process
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
- channel.onMessage(e => {
46
- termProcess.write(e().readString());
47
- });
48
- const buffer = new buffering_stream_1.StringBufferingStream();
49
- buffer.onData(chunk => {
50
- channel.getWriteBuffer().writeString(chunk).commit();
51
- });
52
- output.on('data', chunk => {
53
- buffer.push(chunk);
54
- });
55
- channel.onClose(() => {
56
- buffer.dispose();
57
- output.dispose();
58
- });
59
- }
60
- });
61
- }
62
- };
63
- __decorate([
64
- (0, inversify_1.inject)(node_1.ProcessManager),
65
- __metadata("design:type", node_1.ProcessManager)
66
- ], TerminalBackendContribution.prototype, "processManager", void 0);
67
- __decorate([
68
- (0, inversify_1.inject)(common_1.ILogger),
69
- (0, inversify_1.named)('terminal'),
70
- __metadata("design:type", Object)
71
- ], TerminalBackendContribution.prototype, "logger", void 0);
72
- TerminalBackendContribution = __decorate([
73
- (0, inversify_1.injectable)()
74
- ], TerminalBackendContribution);
75
- exports.TerminalBackendContribution = TerminalBackendContribution;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017 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 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.TerminalBackendContribution = void 0;
28
+ const inversify_1 = require("@theia/core/shared/inversify");
29
+ const common_1 = require("@theia/core/lib/common");
30
+ const node_1 = require("@theia/process/lib/node");
31
+ const terminal_protocol_1 = require("../common/terminal-protocol");
32
+ const buffering_stream_1 = require("./buffering-stream");
33
+ let TerminalBackendContribution = class TerminalBackendContribution {
34
+ constructor() {
35
+ this.decoder = new TextDecoder('utf-8');
36
+ }
37
+ configure(service) {
38
+ service.wsChannel(`${terminal_protocol_1.terminalsPath}/:id`, (params, channel) => {
39
+ const id = parseInt(params.id, 10);
40
+ const termProcess = this.processManager.get(id);
41
+ if (termProcess instanceof node_1.TerminalProcess) {
42
+ const output = termProcess.createOutputStream();
43
+ // Create a RPC connection to the terminal process
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ channel.onMessage(e => {
46
+ termProcess.write(e().readString());
47
+ });
48
+ const buffer = new buffering_stream_1.StringBufferingStream();
49
+ buffer.onData(chunk => {
50
+ channel.getWriteBuffer().writeString(chunk).commit();
51
+ });
52
+ output.on('data', chunk => {
53
+ buffer.push(chunk);
54
+ });
55
+ channel.onClose(() => {
56
+ buffer.dispose();
57
+ output.dispose();
58
+ });
59
+ }
60
+ });
61
+ }
62
+ };
63
+ __decorate([
64
+ (0, inversify_1.inject)(node_1.ProcessManager),
65
+ __metadata("design:type", node_1.ProcessManager)
66
+ ], TerminalBackendContribution.prototype, "processManager", void 0);
67
+ __decorate([
68
+ (0, inversify_1.inject)(common_1.ILogger),
69
+ (0, inversify_1.named)('terminal'),
70
+ __metadata("design:type", Object)
71
+ ], TerminalBackendContribution.prototype, "logger", void 0);
72
+ TerminalBackendContribution = __decorate([
73
+ (0, inversify_1.injectable)()
74
+ ], TerminalBackendContribution);
75
+ exports.TerminalBackendContribution = TerminalBackendContribution;
76
76
  //# sourceMappingURL=terminal-backend-contribution.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=terminal-backend-contribution.slow-spec.d.ts.map
@@ -1,55 +1,55 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 Ericsson 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 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const terminal_test_container_1 = require("./test/terminal-test-container");
19
- const backend_application_1 = require("@theia/core/lib/node/backend-application");
20
- const shell_terminal_protocol_1 = require("../common/shell-terminal-protocol");
21
- const terminal_protocol_1 = require("../common/terminal-protocol");
22
- const test_web_socket_channel_1 = require("@theia/core/lib/node/messaging/test/test-web-socket-channel");
23
- describe('Terminal Backend Contribution', function () {
24
- this.timeout(10000);
25
- let server;
26
- let shellTerminalServer;
27
- beforeEach(async () => {
28
- const container = (0, terminal_test_container_1.createTerminalTestContainer)();
29
- const application = container.get(backend_application_1.BackendApplication);
30
- shellTerminalServer = container.get(shell_terminal_protocol_1.IShellTerminalServer);
31
- server = await application.start();
32
- });
33
- afterEach(() => {
34
- const s = server;
35
- server = undefined;
36
- shellTerminalServer = undefined;
37
- s.close();
38
- });
39
- it('is data received from the terminal ws server', async () => {
40
- const terminalId = await shellTerminalServer.create({});
41
- await new Promise((resolve, reject) => {
42
- const path = `${terminal_protocol_1.terminalsPath}/${terminalId}`;
43
- const { channel, multiplexer } = new test_web_socket_channel_1.TestWebSocketChannelSetup({ server, path });
44
- channel.onError(reject);
45
- channel.onClose(event => reject(new Error(`channel is closed with '${event.code}' code and '${event.reason}' reason}`)));
46
- multiplexer.onDidOpenChannel(event => {
47
- if (event.id === path) {
48
- resolve();
49
- channel.close();
50
- }
51
- });
52
- });
53
- });
54
- });
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 Ericsson 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 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const terminal_test_container_1 = require("./test/terminal-test-container");
19
+ const backend_application_1 = require("@theia/core/lib/node/backend-application");
20
+ const shell_terminal_protocol_1 = require("../common/shell-terminal-protocol");
21
+ const terminal_protocol_1 = require("../common/terminal-protocol");
22
+ const test_web_socket_channel_1 = require("@theia/core/lib/node/messaging/test/test-web-socket-channel");
23
+ describe('Terminal Backend Contribution', function () {
24
+ this.timeout(10000);
25
+ let server;
26
+ let shellTerminalServer;
27
+ beforeEach(async () => {
28
+ const container = (0, terminal_test_container_1.createTerminalTestContainer)();
29
+ const application = container.get(backend_application_1.BackendApplication);
30
+ shellTerminalServer = container.get(shell_terminal_protocol_1.IShellTerminalServer);
31
+ server = await application.start();
32
+ });
33
+ afterEach(() => {
34
+ const s = server;
35
+ server = undefined;
36
+ shellTerminalServer = undefined;
37
+ s.close();
38
+ });
39
+ it('is data received from the terminal ws server', async () => {
40
+ const terminalId = await shellTerminalServer.create({});
41
+ await new Promise((resolve, reject) => {
42
+ const path = `${terminal_protocol_1.terminalsPath}/${terminalId}`;
43
+ const { channel, multiplexer } = new test_web_socket_channel_1.TestWebSocketChannelSetup({ server, path });
44
+ channel.onError(reject);
45
+ channel.onClose(event => reject(new Error(`channel is closed with '${event.code}' code and '${event.reason}' reason}`)));
46
+ multiplexer.onDidOpenChannel(event => {
47
+ if (event.id === path) {
48
+ resolve();
49
+ channel.close();
50
+ }
51
+ });
52
+ });
53
+ });
54
+ });
55
55
  //# sourceMappingURL=terminal-backend-contribution.slow-spec.js.map
@@ -1,12 +1,12 @@
1
- import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
2
- import { IBaseTerminalServer } from '../common/base-terminal-protocol';
3
- export declare function bindTerminalServer(bind: interfaces.Bind, { path, identifier, constructor }: {
4
- path: string;
5
- identifier: interfaces.ServiceIdentifier<IBaseTerminalServer>;
6
- constructor: {
7
- new (...args: any[]): IBaseTerminalServer;
8
- };
9
- }): void;
10
- declare const _default: ContainerModule;
11
- export default _default;
1
+ import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
2
+ import { IBaseTerminalServer } from '../common/base-terminal-protocol';
3
+ export declare function bindTerminalServer(bind: interfaces.Bind, { path, identifier, constructor }: {
4
+ path: string;
5
+ identifier: interfaces.ServiceIdentifier<IBaseTerminalServer>;
6
+ constructor: {
7
+ new (...args: any[]): IBaseTerminalServer;
8
+ };
9
+ }): void;
10
+ declare const _default: ContainerModule;
11
+ export default _default;
12
12
  //# sourceMappingURL=terminal-backend-module.d.ts.map