@theia/core 1.26.0 → 1.27.0-next.10

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 (164) hide show
  1. package/README.md +6 -7
  2. package/lib/browser/messaging/ws-connection-provider.d.ts +5 -4
  3. package/lib/browser/messaging/ws-connection-provider.d.ts.map +1 -1
  4. package/lib/browser/messaging/ws-connection-provider.js +30 -23
  5. package/lib/browser/messaging/ws-connection-provider.js.map +1 -1
  6. package/lib/browser/progress-status-bar-item.d.ts +1 -1
  7. package/lib/browser/progress-status-bar-item.d.ts.map +1 -1
  8. package/lib/browser/tree/tree-compression/compressed-tree-widget.js +2 -2
  9. package/lib/browser/tree/tree-compression/compressed-tree-widget.js.map +1 -1
  10. package/lib/browser/widgets/select-component.d.ts +4 -1
  11. package/lib/browser/widgets/select-component.d.ts.map +1 -1
  12. package/lib/browser/widgets/select-component.js +30 -16
  13. package/lib/browser/widgets/select-component.js.map +1 -1
  14. package/lib/common/cancellation.d.ts +1 -0
  15. package/lib/common/cancellation.d.ts.map +1 -1
  16. package/lib/common/cancellation.js +8 -0
  17. package/lib/common/cancellation.js.map +1 -1
  18. package/lib/common/index.d.ts +2 -0
  19. package/lib/common/index.d.ts.map +1 -1
  20. package/lib/common/index.js +2 -0
  21. package/lib/common/index.js.map +1 -1
  22. package/lib/common/message-rpc/channel.d.ts +106 -0
  23. package/lib/common/message-rpc/channel.d.ts.map +1 -0
  24. package/lib/common/message-rpc/channel.js +195 -0
  25. package/lib/common/message-rpc/channel.js.map +1 -0
  26. package/lib/common/message-rpc/channel.spec.d.ts +9 -0
  27. package/lib/common/message-rpc/channel.spec.d.ts.map +1 -0
  28. package/lib/common/message-rpc/channel.spec.js +80 -0
  29. package/lib/common/message-rpc/channel.spec.js.map +1 -0
  30. package/lib/common/message-rpc/index.d.ts +4 -0
  31. package/lib/common/message-rpc/index.d.ts.map +1 -0
  32. package/lib/{node/messaging/logger.js → common/message-rpc/index.js} +6 -19
  33. package/lib/common/message-rpc/index.js.map +1 -0
  34. package/lib/common/message-rpc/message-buffer.d.ts +50 -0
  35. package/lib/common/message-rpc/message-buffer.d.ts.map +1 -0
  36. package/lib/common/message-rpc/message-buffer.js +56 -0
  37. package/lib/common/message-rpc/message-buffer.js.map +1 -0
  38. package/lib/common/message-rpc/rpc-message-encoder.d.ts +159 -0
  39. package/lib/common/message-rpc/rpc-message-encoder.d.ts.map +1 -0
  40. package/lib/common/message-rpc/rpc-message-encoder.js +362 -0
  41. package/lib/common/message-rpc/rpc-message-encoder.js.map +1 -0
  42. package/lib/common/message-rpc/rpc-message-encoder.spec.d.ts +2 -0
  43. package/lib/common/message-rpc/rpc-message-encoder.spec.d.ts.map +1 -0
  44. package/lib/common/message-rpc/rpc-message-encoder.spec.js +37 -0
  45. package/lib/common/message-rpc/rpc-message-encoder.spec.js.map +1 -0
  46. package/lib/common/message-rpc/rpc-protocol.d.ts +61 -0
  47. package/lib/common/message-rpc/rpc-protocol.d.ts.map +1 -0
  48. package/lib/common/message-rpc/rpc-protocol.js +183 -0
  49. package/lib/common/message-rpc/rpc-protocol.js.map +1 -0
  50. package/lib/common/message-rpc/uint8-array-message-buffer.d.ts +52 -0
  51. package/lib/common/message-rpc/uint8-array-message-buffer.d.ts.map +1 -0
  52. package/lib/common/message-rpc/uint8-array-message-buffer.js +169 -0
  53. package/lib/common/message-rpc/uint8-array-message-buffer.js.map +1 -0
  54. package/lib/common/message-rpc/uint8-array-message-buffer.spec.d.ts +2 -0
  55. package/lib/common/message-rpc/uint8-array-message-buffer.spec.d.ts.map +1 -0
  56. package/lib/common/message-rpc/uint8-array-message-buffer.spec.js +39 -0
  57. package/lib/common/message-rpc/uint8-array-message-buffer.spec.js.map +1 -0
  58. package/lib/common/messaging/abstract-connection-provider.d.ts +9 -8
  59. package/lib/common/messaging/abstract-connection-provider.d.ts.map +1 -1
  60. package/lib/common/messaging/abstract-connection-provider.js +20 -35
  61. package/lib/common/messaging/abstract-connection-provider.js.map +1 -1
  62. package/lib/common/messaging/connection-error-handler.d.ts +1 -2
  63. package/lib/common/messaging/connection-error-handler.d.ts.map +1 -1
  64. package/lib/common/messaging/connection-error-handler.js +1 -1
  65. package/lib/common/messaging/connection-error-handler.js.map +1 -1
  66. package/lib/common/messaging/handler.d.ts +2 -2
  67. package/lib/common/messaging/handler.d.ts.map +1 -1
  68. package/lib/common/messaging/proxy-factory.d.ts +13 -7
  69. package/lib/common/messaging/proxy-factory.d.ts.map +1 -1
  70. package/lib/common/messaging/proxy-factory.js +18 -13
  71. package/lib/common/messaging/proxy-factory.js.map +1 -1
  72. package/lib/common/messaging/proxy-factory.spec.js +4 -15
  73. package/lib/common/messaging/proxy-factory.spec.js.map +1 -1
  74. package/lib/common/messaging/web-socket-channel.d.ts +54 -48
  75. package/lib/common/messaging/web-socket-channel.d.ts.map +1 -1
  76. package/lib/common/messaging/web-socket-channel.js +41 -105
  77. package/lib/common/messaging/web-socket-channel.js.map +1 -1
  78. package/lib/electron-browser/messaging/electron-ipc-connection-provider.d.ts +2 -2
  79. package/lib/electron-browser/messaging/electron-ipc-connection-provider.d.ts.map +1 -1
  80. package/lib/electron-browser/messaging/electron-ipc-connection-provider.js +18 -7
  81. package/lib/electron-browser/messaging/electron-ipc-connection-provider.js.map +1 -1
  82. package/lib/electron-browser/messaging/electron-ws-connection-provider.d.ts +2 -2
  83. package/lib/electron-browser/messaging/electron-ws-connection-provider.d.ts.map +1 -1
  84. package/lib/electron-browser/messaging/electron-ws-connection-provider.js +5 -7
  85. package/lib/electron-browser/messaging/electron-ws-connection-provider.js.map +1 -1
  86. package/lib/electron-main/messaging/electron-messaging-contribution.d.ts +37 -9
  87. package/lib/electron-main/messaging/electron-messaging-contribution.d.ts.map +1 -1
  88. package/lib/electron-main/messaging/electron-messaging-contribution.js +83 -68
  89. package/lib/electron-main/messaging/electron-messaging-contribution.js.map +1 -1
  90. package/lib/electron-main/messaging/electron-messaging-service.d.ts +2 -8
  91. package/lib/electron-main/messaging/electron-messaging-service.d.ts.map +1 -1
  92. package/lib/electron-main/messaging/electron-messaging-service.js.map +1 -1
  93. package/lib/electron-main/theia-electron-window.d.ts.map +1 -1
  94. package/lib/electron-main/theia-electron-window.js +11 -8
  95. package/lib/electron-main/theia-electron-window.js.map +1 -1
  96. package/lib/node/messaging/binary-message-pipe.d.ts +45 -0
  97. package/lib/node/messaging/binary-message-pipe.d.ts.map +1 -0
  98. package/lib/node/messaging/binary-message-pipe.js +152 -0
  99. package/lib/node/messaging/binary-message-pipe.js.map +1 -0
  100. package/lib/node/messaging/ipc-bootstrap.js +2 -11
  101. package/lib/node/messaging/ipc-bootstrap.js.map +1 -1
  102. package/lib/node/messaging/ipc-channel.d.ts +26 -0
  103. package/lib/node/messaging/ipc-channel.d.ts.map +1 -0
  104. package/lib/node/messaging/ipc-channel.js +86 -0
  105. package/lib/node/messaging/ipc-channel.js.map +1 -0
  106. package/lib/node/messaging/ipc-connection-provider.d.ts +3 -5
  107. package/lib/node/messaging/ipc-connection-provider.d.ts.map +1 -1
  108. package/lib/node/messaging/ipc-connection-provider.js +14 -31
  109. package/lib/node/messaging/ipc-connection-provider.js.map +1 -1
  110. package/lib/node/messaging/ipc-protocol.d.ts +2 -2
  111. package/lib/node/messaging/ipc-protocol.d.ts.map +1 -1
  112. package/lib/node/messaging/messaging-contribution.d.ts +6 -9
  113. package/lib/node/messaging/messaging-contribution.d.ts.map +1 -1
  114. package/lib/node/messaging/messaging-contribution.js +23 -68
  115. package/lib/node/messaging/messaging-contribution.js.map +1 -1
  116. package/lib/node/messaging/messaging-service.d.ts +4 -23
  117. package/lib/node/messaging/messaging-service.d.ts.map +1 -1
  118. package/lib/node/messaging/messaging-service.js +1 -15
  119. package/lib/node/messaging/messaging-service.js.map +1 -1
  120. package/lib/node/messaging/test/test-web-socket-channel.d.ts +4 -2
  121. package/lib/node/messaging/test/test-web-socket-channel.d.ts.map +1 -1
  122. package/lib/node/messaging/test/test-web-socket-channel.js +25 -12
  123. package/lib/node/messaging/test/test-web-socket-channel.js.map +1 -1
  124. package/package.json +5 -8
  125. package/src/browser/messaging/ws-connection-provider.ts +34 -25
  126. package/src/browser/progress-status-bar-item.ts +1 -1
  127. package/src/browser/style/menus.css +1 -0
  128. package/src/browser/tree/tree-compression/compressed-tree-widget.tsx +2 -2
  129. package/src/browser/widgets/select-component.tsx +37 -17
  130. package/src/common/cancellation.ts +8 -0
  131. package/src/common/index.ts +2 -0
  132. package/src/common/message-rpc/channel.spec.ts +88 -0
  133. package/src/common/message-rpc/channel.ts +260 -0
  134. package/src/{node/messaging/logger.ts → common/message-rpc/index.ts} +4 -23
  135. package/src/common/message-rpc/message-buffer.ts +99 -0
  136. package/src/common/message-rpc/rpc-message-encoder.spec.ts +42 -0
  137. package/src/common/message-rpc/rpc-message-encoder.ts +497 -0
  138. package/src/common/message-rpc/rpc-protocol.ts +217 -0
  139. package/src/common/message-rpc/uint8-array-message-buffer.spec.ts +41 -0
  140. package/src/common/message-rpc/uint8-array-message-buffer.ts +206 -0
  141. package/src/common/messaging/abstract-connection-provider.ts +28 -37
  142. package/src/common/messaging/connection-error-handler.ts +1 -2
  143. package/src/common/messaging/handler.ts +2 -2
  144. package/src/common/messaging/proxy-factory.spec.ts +4 -17
  145. package/src/common/messaging/proxy-factory.ts +27 -16
  146. package/src/common/messaging/web-socket-channel.ts +79 -135
  147. package/src/electron-browser/messaging/electron-ipc-connection-provider.ts +21 -7
  148. package/src/electron-browser/messaging/electron-ws-connection-provider.ts +5 -8
  149. package/src/electron-main/messaging/electron-messaging-contribution.ts +87 -65
  150. package/src/electron-main/messaging/electron-messaging-service.ts +2 -8
  151. package/src/electron-main/theia-electron-window.ts +12 -9
  152. package/src/node/messaging/binary-message-pipe.ts +168 -0
  153. package/src/node/messaging/ipc-bootstrap.ts +3 -11
  154. package/src/node/messaging/ipc-channel.ts +97 -0
  155. package/src/node/messaging/ipc-connection-provider.ts +18 -35
  156. package/src/node/messaging/ipc-protocol.ts +2 -2
  157. package/src/node/messaging/messaging-contribution.ts +29 -74
  158. package/src/node/messaging/messaging-service.ts +4 -31
  159. package/src/node/messaging/test/test-web-socket-channel.ts +26 -17
  160. package/lib/node/messaging/logger.d.ts +0 -8
  161. package/lib/node/messaging/logger.d.ts.map +0 -1
  162. package/lib/node/messaging/logger.js.map +0 -1
  163. package/shared/vscode-ws-jsonrpc/index.d.ts +0 -1
  164. package/shared/vscode-ws-jsonrpc/index.js +0 -1
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2022 STMicroelectronics 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
+ exports.BinaryMessagePipe = void 0;
19
+ const common_1 = require("../../common");
20
+ const uint8_array_message_buffer_1 = require("../../common/message-rpc/uint8-array-message-buffer");
21
+ /**
22
+ * A `BinaryMessagePipe` is capable of sending and retrieving binary messages i.e. {@link Uint8Array}s over
23
+ * and underlying streamed process pipe/fd. The message length of individual messages is encoding at the beginning of
24
+ * a new message. This makes it possible to extract messages from the streamed data.
25
+ */
26
+ class BinaryMessagePipe {
27
+ constructor(underlyingPipe) {
28
+ this.underlyingPipe = underlyingPipe;
29
+ this.dataHandler = (chunk) => this.handleChunk(chunk);
30
+ this.onMessageEmitter = new common_1.Emitter();
31
+ this.cachedMessageData = {
32
+ chunks: [],
33
+ missingBytes: 0
34
+ };
35
+ underlyingPipe.on('data', this.dataHandler);
36
+ }
37
+ get onMessage() {
38
+ return this.onMessageEmitter.event;
39
+ }
40
+ send(message) {
41
+ this.underlyingPipe.write(this.encodeMessageStart(message));
42
+ this.underlyingPipe.write(message);
43
+ }
44
+ handleChunk(chunk) {
45
+ if (this.cachedMessageData.missingBytes === 0) {
46
+ // There is no currently streamed message => We expect that the beginning of the chunk is the message start for a new message
47
+ this.handleNewMessage(chunk);
48
+ }
49
+ else {
50
+ // The chunk contains message data intended for the currently cached message
51
+ this.handleMessageContentChunk(chunk);
52
+ }
53
+ }
54
+ handleNewMessage(chunk) {
55
+ if (chunk.byteLength < this.messageStartByteLength) {
56
+ // The chunk only contains a part of the encoded message start
57
+ this.cachedMessageData.partialMessageStart = chunk;
58
+ return;
59
+ }
60
+ const messageLength = this.readMessageStart(chunk);
61
+ if (chunk.length - this.messageStartByteLength > messageLength) {
62
+ // The initial chunk contains more than one binary message => Fire `onMessage` for first message and handle remaining content
63
+ const firstMessage = chunk.slice(this.messageStartByteLength, this.messageStartByteLength + messageLength);
64
+ this.onMessageEmitter.fire(firstMessage);
65
+ this.handleNewMessage(chunk.slice(this.messageStartByteLength + messageLength));
66
+ }
67
+ else if (chunk.length - this.messageStartByteLength === messageLength) {
68
+ // The initial chunk contains exactly one complete message. => Directly fire the `onMessage` event.
69
+ this.onMessageEmitter.fire(chunk.slice(this.messageStartByteLength));
70
+ }
71
+ else {
72
+ // The initial chunk contains only part of the message content => Cache message data
73
+ this.cachedMessageData.chunks = [chunk.slice(this.messageStartByteLength)];
74
+ this.cachedMessageData.missingBytes = messageLength - chunk.byteLength + this.messageStartByteLength;
75
+ }
76
+ }
77
+ handleMessageContentChunk(chunk) {
78
+ if (this.cachedMessageData) {
79
+ if (chunk.byteLength < this.cachedMessageData.missingBytes) {
80
+ // The chunk only contains parts of the missing bytes for the cached message.
81
+ this.cachedMessageData.chunks.push(chunk);
82
+ this.cachedMessageData.missingBytes -= chunk.byteLength;
83
+ }
84
+ else if (chunk.byteLength === this.cachedMessageData.missingBytes) {
85
+ // Chunk contains exactly the missing data for the cached message
86
+ this.cachedMessageData.chunks.push(chunk);
87
+ this.emitCachedMessage();
88
+ }
89
+ else {
90
+ // Chunk contains missing data for the cached message + data for the next message
91
+ const messageEnd = this.cachedMessageData.missingBytes;
92
+ const missingData = chunk.slice(0, messageEnd);
93
+ this.cachedMessageData.chunks.push(missingData);
94
+ this.emitCachedMessage();
95
+ this.handleNewMessage(chunk.slice(messageEnd));
96
+ }
97
+ }
98
+ }
99
+ emitCachedMessage() {
100
+ const message = Buffer.concat(this.cachedMessageData.chunks);
101
+ this.onMessageEmitter.fire(message);
102
+ this.cachedMessageData.chunks = [];
103
+ this.cachedMessageData.missingBytes = 0;
104
+ }
105
+ /**
106
+ * Encodes the start of a new message into a {@link Uint8Array}.
107
+ * The message start consists of a identifier string and the length of the following message.
108
+ * @returns the buffer contains the encoded message start
109
+ */
110
+ encodeMessageStart(message) {
111
+ const writer = new uint8_array_message_buffer_1.Uint8ArrayWriteBuffer()
112
+ .writeString(BinaryMessagePipe.MESSAGE_START_IDENTIFIER)
113
+ .writeUint32(message.length);
114
+ const messageStart = writer.getCurrentContents();
115
+ writer.dispose();
116
+ return messageStart;
117
+ }
118
+ get messageStartByteLength() {
119
+ // 4 bytes for length of id + id string length + 4 bytes for length of message
120
+ return 4 + BinaryMessagePipe.MESSAGE_START_IDENTIFIER.length + 4;
121
+ }
122
+ /**
123
+ * Reads the start of a new message from a stream chunk (or cached message) received from the underlying pipe.
124
+ * The message start is expected to consist of an identifier string and the length of the message.
125
+ * @param chunk The stream chunk.
126
+ * @returns The length of the message content to read.
127
+ * @throws An error if the message start can not be read successfully.
128
+ */
129
+ readMessageStart(chunk) {
130
+ const messageData = this.cachedMessageData.partialMessageStart ? Buffer.concat([this.cachedMessageData.partialMessageStart, chunk]) : chunk;
131
+ this.cachedMessageData.partialMessageStart = undefined;
132
+ const reader = new uint8_array_message_buffer_1.Uint8ArrayReadBuffer(messageData);
133
+ const identifier = reader.readString();
134
+ if (identifier !== BinaryMessagePipe.MESSAGE_START_IDENTIFIER) {
135
+ throw new Error(`Could not read message start. The start identifier should be '${BinaryMessagePipe.MESSAGE_START_IDENTIFIER}' but was '${identifier}`);
136
+ }
137
+ const length = reader.readUint32();
138
+ return length;
139
+ }
140
+ dispose() {
141
+ this.underlyingPipe.removeListener('data', this.dataHandler);
142
+ this.underlyingPipe.end();
143
+ this.onMessageEmitter.dispose();
144
+ this.cachedMessageData = {
145
+ chunks: [],
146
+ missingBytes: 0
147
+ };
148
+ }
149
+ }
150
+ exports.BinaryMessagePipe = BinaryMessagePipe;
151
+ BinaryMessagePipe.MESSAGE_START_IDENTIFIER = '<MessageStart>';
152
+ //# sourceMappingURL=binary-message-pipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary-message-pipe.js","sourceRoot":"","sources":["../../../src/node/messaging/binary-message-pipe.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;AAGhF,yCAA0D;AAC1D,oGAAkH;AAElH;;;;GAIG;AACH,MAAa,iBAAiB;IAc1B,YAA+B,cAAsB;QAAtB,mBAAc,GAAd,cAAc,CAAQ;QAZ3C,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAE7D,qBAAgB,GAAG,IAAI,gBAAO,EAAc,CAAC;QAC7C,sBAAiB,GAAwB;YAC/C,MAAM,EAAE,EAAE;YACV,YAAY,EAAE,CAAC;SAClB,CAAC;QAOE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAND,IAAI,SAAS;QACT,OAAO,IAAI,CA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C3D,MAAM,IAAI,KAAK,CAAC,iEAAiE,iBAAiB,CAAC,wBAAwB,cAAc,UAAU,EAAE,CAAC,CAAC;SAC1J;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,OAAO;QACH,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7D,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG;YACrB,MAAM,EAAE,EAAE;YACV,YAAY,EAAE,CAAC;SAClB,CAAC;IACN,CAAC;;AAvIL,8CAwIC;AAvImB,0CAAwB,GAAG,gBAAgB,CAAC"}
@@ -17,18 +17,9 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  require("reflect-metadata");
19
19
  const dynamic_require_1 = require("../dynamic-require");
20
- const logger_1 = require("vscode-ws-jsonrpc/lib/logger");
21
- const vscode_ws_jsonrpc_1 = require("vscode-ws-jsonrpc");
20
+ const ipc_channel_1 = require("./ipc-channel");
22
21
  const ipc_protocol_1 = require("./ipc-protocol");
23
22
  (0, ipc_protocol_1.checkParentAlive)();
24
23
  const entryPoint = ipc_protocol_1.IPCEntryPoint.getScriptFromEnv();
25
- const reader = new vscode_ws_jsonrpc_1.IPCMessageReader(process);
26
- const writer = new vscode_ws_jsonrpc_1.IPCMessageWriter(process);
27
- const logger = new logger_1.ConsoleLogger();
28
- const connection = (0, vscode_ws_jsonrpc_1.createMessageConnection)(reader, writer, logger);
29
- connection.trace(vscode_ws_jsonrpc_1.Trace.Off, {
30
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
- log: (message, data) => console.log(message, data)
32
- });
33
- (0, dynamic_require_1.dynamicRequire)(entryPoint).default(connection);
24
+ (0, dynamic_require_1.dynamicRequire)(entryPoint).default(new ipc_channel_1.IPCChannel());
34
25
  //# sourceMappingURL=ipc-bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ipc-bootstrap.js","sourceRoot":"","sources":["../../../src/node/messaging/ipc-bootstrap.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;AAEhF,4BAA0B;AAC1B,wDAAoD;AACpD,yDAA6D;AAC7D,yDAAuG;AACvG,iDAAiE;AAEjE,IAAA,+BAAgB,GAAE,CAAC;AAEnB,MAAM,UAAU,GAAG,4BAAa,CAAC,gBAAgB,EAAE,CAAC;AACpD,MAAM,MAAM,GAAG,IAAI,oCAAgB,CAAC,OAAO,CAAC,CAAC;AAC7C,MAAM,MAAM,GAAG,IAAI,oCAAgB,CAAC,OAAO,CAAC,CAAC;AAC7C,MAAM,MAAM,GAAG,IAAI,sBAAa,EAAE,CAAC;AACnC,MAAM,UAAU,GAAG,IAAA,2CAAuB,EAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACnE,UAAU,CAAC,KAAK,CAAC,yBAAK,CAAC,GAAG,EAAE;IACxB,8DAA8D;IAC9D,GAAG,EAAE,CAAC,OAAY,EAAE,IAAa,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC;CACnE,CAAC,CAAC;AAEH,IAAA,gCAAc,EAA6B,UAAU,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"}
1
+ {"version":3,"file":"ipc-bootstrap.js","sourceRoot":"","sources":["../../../src/node/messaging/ipc-bootstrap.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;AAEhF,4BAA0B;AAC1B,wDAAoD;AACpD,+CAA2C;AAC3C,iDAAiE;AAEjE,IAAA,+BAAgB,GAAE,CAAC;AAEnB,MAAM,UAAU,GAAG,4BAAa,CAAC,gBAAgB,EAAE,CAAC;AAEpD,IAAA,gCAAc,EAA6B,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,wBAAU,EAAE,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ import * as cp from 'child_process';
3
+ import { Channel, ChannelCloseEvent, DisposableCollection, Emitter, Event, MessageProvider, WriteBuffer } from '../../common';
4
+ import { BinaryMessagePipe } from './binary-message-pipe';
5
+ /**
6
+ * A {@link Channel} to send messages between two processes using a dedicated pipe/fd for binary messages.
7
+ * This fd is opened as 5th channel in addition to the default stdios (stdin,stdout,stderr, ipc). This means the default channels
8
+ * are not blocked and can be used by the respective process for additional custom message handling.
9
+ */
10
+ export declare class IPCChannel implements Channel {
11
+ protected readonly onCloseEmitter: Emitter<ChannelCloseEvent>;
12
+ get onClose(): Event<ChannelCloseEvent>;
13
+ protected readonly onMessageEmitter: Emitter<MessageProvider>;
14
+ get onMessage(): Event<MessageProvider>;
15
+ protected readonly onErrorEmitter: Emitter<unknown>;
16
+ get onError(): Event<unknown>;
17
+ protected messagePipe: BinaryMessagePipe;
18
+ protected toDispose: DisposableCollection;
19
+ protected ipcErrorListener: (error: Error) => void;
20
+ constructor(childProcess?: cp.ChildProcess);
21
+ protected setupChildProcess(childProcess: cp.ChildProcess): void;
22
+ protected setupProcess(): void;
23
+ getWriteBuffer(): WriteBuffer;
24
+ close(): void;
25
+ }
26
+ //# sourceMappingURL=ipc-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ipc-channel.d.ts","sourceRoot":"","sources":["../../../src/node/messaging/ipc-channel.ts"],"names":[],"mappings":";AAiBA,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAc,oBAAoB,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE1I,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,UAAW,YAAW,OAAO;IAEtC,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAiB;IAC9E,IAAI,OAAO,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAEtC;IAED,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC,eAAe,CAAC,CAAiB;IAC9E,IAAI,SAAS,IAAI,KAAK,CAAC,eAAe,CAAC,CAEtC;IAED,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,CAAiB;IACpE,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAE5B;IAED,SAAS,CAAC,WAAW,EAAE,iBAAiB,CAAC;IACzC,SAAS,CAAC,SAAS,uBAA8B;IAEjD,SAAS,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAA4C;gBAElF,YAAY,CAAC,EAAE,EAAE,CAAC,YAAY;IAY1C,SAAS,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,GAAG,IAAI;IAUhE,SAAS,CAAC,YAAY,IAAI,IAAI;IAU9B,cAAc,IAAI,WAAW;IAS7B,KAAK,IAAI,IAAI;CAIhB"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2022 STMicroelectronics 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
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.IPCChannel = void 0;
20
+ const net_1 = require("net");
21
+ const common_1 = require("../../common");
22
+ const uint8_array_message_buffer_1 = require("../../common/message-rpc/uint8-array-message-buffer");
23
+ const binary_message_pipe_1 = require("./binary-message-pipe");
24
+ /**
25
+ * A {@link Channel} to send messages between two processes using a dedicated pipe/fd for binary messages.
26
+ * This fd is opened as 5th channel in addition to the default stdios (stdin,stdout,stderr, ipc). This means the default channels
27
+ * are not blocked and can be used by the respective process for additional custom message handling.
28
+ */
29
+ class IPCChannel {
30
+ constructor(childProcess) {
31
+ this.onCloseEmitter = new common_1.Emitter();
32
+ this.onMessageEmitter = new common_1.Emitter();
33
+ this.onErrorEmitter = new common_1.Emitter();
34
+ this.toDispose = new common_1.DisposableCollection();
35
+ this.ipcErrorListener = error => this.onErrorEmitter.fire(error);
36
+ if (childProcess) {
37
+ this.setupChildProcess(childProcess);
38
+ }
39
+ else {
40
+ this.setupProcess();
41
+ }
42
+ this.messagePipe.onMessage(message => {
43
+ this.onMessageEmitter.fire(() => new uint8_array_message_buffer_1.Uint8ArrayReadBuffer(message));
44
+ });
45
+ this.toDispose.pushAll([this.onCloseEmitter, this.onMessageEmitter, this.onErrorEmitter]);
46
+ }
47
+ get onClose() {
48
+ return this.onCloseEmitter.event;
49
+ }
50
+ get onMessage() {
51
+ return this.onMessageEmitter.event;
52
+ }
53
+ get onError() {
54
+ return this.onErrorEmitter.event;
55
+ }
56
+ setupChildProcess(childProcess) {
57
+ childProcess.once('exit', code => this.onCloseEmitter.fire({ reason: 'Child process has been terminated', code: code !== null && code !== void 0 ? code : undefined }));
58
+ this.messagePipe = new binary_message_pipe_1.BinaryMessagePipe(childProcess.stdio[4]);
59
+ childProcess.on('error', this.ipcErrorListener);
60
+ this.toDispose.push(common_1.Disposable.create(() => {
61
+ childProcess.removeListener('error', this.ipcErrorListener);
62
+ this.messagePipe.dispose();
63
+ }));
64
+ }
65
+ setupProcess() {
66
+ process.once('beforeExit', code => this.onCloseEmitter.fire({ reason: 'Process is about to be terminated', code }));
67
+ this.messagePipe = new binary_message_pipe_1.BinaryMessagePipe(new net_1.Socket({ fd: 4 }));
68
+ process.on('uncaughtException', this.ipcErrorListener);
69
+ this.toDispose.push(common_1.Disposable.create(() => {
70
+ process.removeListener('uncaughtException', this.ipcErrorListener);
71
+ this.messagePipe.dispose();
72
+ }));
73
+ }
74
+ getWriteBuffer() {
75
+ const result = new uint8_array_message_buffer_1.Uint8ArrayWriteBuffer();
76
+ result.onCommit(buffer => {
77
+ this.messagePipe.send(buffer);
78
+ });
79
+ return result;
80
+ }
81
+ close() {
82
+ this.toDispose.dispose();
83
+ }
84
+ }
85
+ exports.IPCChannel = IPCChannel;
86
+ //# sourceMappingURL=ipc-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ipc-channel.js","sourceRoot":"","sources":["../../../src/node/messaging/ipc-channel.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,uDAAuD;;;AAGvD,6BAA6B;AAE7B,yCAA0I;AAC1I,oGAAkH;AAClH,+DAA0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AAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CAEJ;AAnED,gCAmEC"}
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import * as cp from 'child_process';
3
- import { MessageConnection } from 'vscode-ws-jsonrpc';
4
- import { ILogger, ConnectionErrorHandler, Disposable } from '../../common';
3
+ import { Channel, ConnectionErrorHandler, Disposable, ILogger } from '../../common';
5
4
  export interface ResolvedIPCConnectionOptions {
6
5
  readonly serverName: string;
7
6
  readonly entryPoint: string;
@@ -16,9 +15,8 @@ export declare type IPCConnectionOptions = Partial<ResolvedIPCConnectionOptions>
16
15
  };
17
16
  export declare class IPCConnectionProvider {
18
17
  protected readonly logger: ILogger;
19
- listen(options: IPCConnectionOptions, acceptor: (connection: MessageConnection) => void): Disposable;
20
- protected doListen(options: ResolvedIPCConnectionOptions, acceptor: (connection: MessageConnection) => void): Disposable;
21
- protected createConnection(childProcess: cp.ChildProcess, options: ResolvedIPCConnectionOptions): MessageConnection;
18
+ listen(options: IPCConnectionOptions, acceptor: (connection: Channel) => void): Disposable;
19
+ protected doListen(options: ResolvedIPCConnectionOptions, acceptor: (connection: Channel) => void): Disposable;
22
20
  protected fork(options: ResolvedIPCConnectionOptions): cp.ChildProcess;
23
21
  }
24
22
  //# sourceMappingURL=ipc-connection-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ipc-connection-provider.d.ts","sourceRoot":"","sources":["../../../src/node/messaging/ipc-connection-provider.ts"],"names":[],"mappings":";AAgBA,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAA8E,iBAAiB,EAAW,MAAM,mBAAmB,CAAC;AAC3I,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAwB,UAAU,EAAE,MAAM,cAAc,CAAC;AAGj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,4BAA4B;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,sBAAsB,CAAA;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CACnC;AACD,oBAAY,oBAAoB,GAAG,OAAO,CAAC,4BAA4B,CAAC,GAAG;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC9B,CAAC;AAEF,qBACa,qBAAqB;IAG9B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnC,MAAM,CAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,GAAG,UAAU;IAQ1F,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,GAAG,UAAU;IA4B9G,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,4BAA4B,GAAG,EAAE,CAAC,YAAY;CAuBzE"}
@@ -26,10 +26,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.IPCConnectionProvider = void 0;
28
28
  const cp = require("child_process");
29
- const path = require("path");
30
29
  const inversify_1 = require("inversify");
31
- const vscode_ws_jsonrpc_1 = require("vscode-ws-jsonrpc");
30
+ const path = require("path");
31
+ const readline_1 = require("readline");
32
32
  const common_1 = require("../../common");
33
+ const ipc_channel_1 = require("./ipc-channel");
33
34
  const ipc_protocol_1 = require("./ipc-protocol");
34
35
  let IPCConnectionProvider = class IPCConnectionProvider {
35
36
  listen(options, acceptor) {
@@ -37,17 +38,19 @@ let IPCConnectionProvider = class IPCConnectionProvider {
37
38
  }
38
39
  doListen(options, acceptor) {
39
40
  const childProcess = this.fork(options);
40
- const connection = this.createConnection(childProcess, options);
41
+ const channel = new ipc_channel_1.IPCChannel(childProcess);
41
42
  const toStop = new common_1.DisposableCollection();
42
43
  const toCancelStop = toStop.push(common_1.Disposable.create(() => childProcess.kill()));
43
44
  const errorHandler = options.errorHandler;
44
45
  if (errorHandler) {
45
- connection.onError((e) => {
46
- if (errorHandler.shouldStop(e[0], e[1], e[2])) {
46
+ let errorCount = 0;
47
+ channel.onError((err) => {
48
+ errorCount++;
49
+ if (errorHandler.shouldStop(err, errorCount)) {
47
50
  toStop.dispose();
48
51
  }
49
52
  });
50
- connection.onClose(() => {
53
+ channel.onClose(() => {
51
54
  if (toStop.disposed) {
52
55
  return;
53
56
  }
@@ -57,34 +60,14 @@ let IPCConnectionProvider = class IPCConnectionProvider {
57
60
  }
58
61
  });
59
62
  }
60
- acceptor(connection);
63
+ acceptor(channel);
61
64
  return toStop;
62
65
  }
63
- createConnection(childProcess, options) {
64
- const reader = new vscode_ws_jsonrpc_1.IPCMessageReader(childProcess);
65
- const writer = new vscode_ws_jsonrpc_1.IPCMessageWriter(childProcess);
66
- const connection = (0, vscode_ws_jsonrpc_1.createMessageConnection)(reader, writer, {
67
- error: (message) => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${message}`),
68
- warn: (message) => this.logger.warn(`[${options.serverName}: ${childProcess.pid}] ${message}`),
69
- info: (message) => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${message}`),
70
- log: (message) => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${message}`)
71
- });
72
- const tracer = {
73
- log: (message, data) => this.logger.debug(`[${options.serverName}: ${childProcess.pid}] ${message}` + (typeof data === 'string' ? ' ' + data : ''))
74
- };
75
- connection.trace(vscode_ws_jsonrpc_1.Trace.Verbose, tracer);
76
- this.logger.isDebug().then(isDebug => {
77
- if (!isDebug) {
78
- connection.trace(vscode_ws_jsonrpc_1.Trace.Off, tracer);
79
- }
80
- });
81
- return connection;
82
- }
83
66
  fork(options) {
84
67
  const forkOptions = {
85
- silent: true,
86
68
  env: (0, ipc_protocol_1.createIpcEnv)(options),
87
- execArgv: []
69
+ execArgv: [],
70
+ stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'pipe']
88
71
  };
89
72
  const inspectArgPrefix = `--${options.serverName}-inspect`;
90
73
  const inspectArg = process.argv.find(v => v.startsWith(inspectArgPrefix));
@@ -92,8 +75,8 @@ let IPCConnectionProvider = class IPCConnectionProvider {
92
75
  forkOptions.execArgv = ['--nolazy', `--inspect${inspectArg.substr(inspectArgPrefix.length)}`];
93
76
  }
94
77
  const childProcess = cp.fork(path.join(__dirname, 'ipc-bootstrap'), options.args, forkOptions);
95
- childProcess.stdout.on('data', data => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
96
- childProcess.stderr.on('data', data => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
78
+ (0, readline_1.createInterface)(childProcess.stdout).on('line', line => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${line}`));
79
+ (0, readline_1.createInterface)(childProcess.stderr).on('line', line => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${line}`));
97
80
  this.logger.debug(`[${options.serverName}: ${childProcess.pid}] IPC started`);
98
81
  childProcess.once('exit', () => this.logger.debug(`[${options.serverName}: ${childProcess.pid}] IPC exited`));
99
82
  return childProcess;
@@ -1 +1 @@
1
- {"version":3,"file":"ipc-connection-provider.js","sourceRoot":"","sources":["../../../src/node/messaging/ipc-connection-provider.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD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,UAAU,KAAK,YAAY,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QAEpI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,UAAU,KAAK,YAAY,CAAC,GAAG,eAAe,CAAC,CAAC;QAC9E,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,UAAU,KAAK,YAAY,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;QAE9G,OAAO,YAAY,CAAC;IACxB,CAAC;CAEJ,CAAA;AA7DG;IADC,IAAA,kBAAM,EAAC,gBAAO,CAAC;;qDACmB;AAH1B,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CAgEjC;AAhEY,sDAAqB"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { MessageConnection } from 'vscode-ws-jsonrpc';
2
+ import { Channel } from '../../common/message-rpc/channel';
3
3
  export declare const ipcEntryPoint: string | undefined;
4
- export declare type IPCEntryPoint = (connection: MessageConnection) => void;
4
+ export declare type IPCEntryPoint = (connection: Channel) => void;
5
5
  export declare namespace IPCEntryPoint {
6
6
  /**
7
7
  * Throws if `THEIA_ENTRY_POINT` is undefined or empty.
@@ -1 +1 @@
1
- {"version":3,"file":"ipc-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/messaging/ipc-protocol.ts"],"names":[],"mappings":";AAiBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKtD,eAAO,MAAM,aAAa,EAAE,MAAM,GAAG,SAA0C,CAAC;AAEhF,oBAAY,aAAa,GAAG,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;AACpE,yBAAiB,aAAa,CAAC;IAC3B;;OAEG;IACH,SAAgB,gBAAgB,IAAI,MAAM,CAKzC;CACJ;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAevC;AAED,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE;IACnC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAC1B,GAAG,MAAM,CAAC,UAAU,CAcpB"}
1
+ {"version":3,"file":"ipc-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/messaging/ipc-protocol.ts"],"names":[],"mappings":";AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAK3D,eAAO,MAAM,aAAa,EAAE,MAAM,GAAG,SAA0C,CAAC;AAEhF,oBAAY,aAAa,GAAG,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;AAC1D,yBAAiB,aAAa,CAAC;IAC3B;;OAEG;IACH,SAAgB,gBAAgB,IAAI,MAAM,CAKzC;CACJ;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAevC;AAED,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE;IACnC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAC1B,GAAG,MAAM,CAAC,UAAU,CAcpB"}
@@ -3,14 +3,13 @@ import * as http from 'http';
3
3
  import * as https from 'https';
4
4
  import { Socket } from 'socket.io';
5
5
  import { interfaces, Container } from 'inversify';
6
- import { MessageConnection } from 'vscode-ws-jsonrpc';
7
- import { IConnection } from 'vscode-ws-jsonrpc/lib/server/connection';
8
6
  import { ContributionProvider } from '../../common';
9
- import { WebSocketChannel } from '../../common/messaging/web-socket-channel';
7
+ import { IWebSocket } from '../../common/messaging/web-socket-channel';
10
8
  import { BackendApplicationContribution } from '../backend-application';
11
9
  import { MessagingService } from './messaging-service';
12
10
  import { WsRequestValidator } from '../ws-request-validators';
13
11
  import { MessagingListener } from './messaging-listeners';
12
+ import { Channel } from '../../common/message-rpc/channel';
14
13
  export declare const MessagingContainer: unique symbol;
15
14
  export declare class MessagingContribution implements BackendApplicationContribution, MessagingService {
16
15
  protected readonly container: interfaces.Container;
@@ -19,11 +18,9 @@ export declare class MessagingContribution implements BackendApplicationContribu
19
18
  protected readonly wsRequestValidator: WsRequestValidator;
20
19
  protected readonly messagingListener: MessagingListener;
21
20
  protected readonly wsHandlers: MessagingContribution.ConnectionHandlers<Socket<import("socket.io/dist/typed-events").DefaultEventsMap, import("socket.io/dist/typed-events").DefaultEventsMap, import("socket.io/dist/typed-events").DefaultEventsMap, any>>;
22
- protected readonly channelHandlers: MessagingContribution.ConnectionHandlers<WebSocketChannel>;
21
+ protected readonly channelHandlers: MessagingContribution.ConnectionHandlers<Channel>;
23
22
  protected init(): void;
24
- listen(spec: string, callback: (params: MessagingService.PathParams, connection: MessageConnection) => void): void;
25
- forward(spec: string, callback: (params: MessagingService.PathParams, connection: IConnection) => void): void;
26
- wsChannel(spec: string, callback: (params: MessagingService.PathParams, channel: WebSocketChannel) => void): void;
23
+ wsChannel(spec: string, callback: (params: MessagingService.PathParams, channel: Channel) => void): void;
27
24
  ws(spec: string, callback: (params: MessagingService.PathParams, socket: Socket) => void): void;
28
25
  protected checkAliveTimeout: number;
29
26
  protected maxHttpBufferSize: number;
@@ -31,9 +28,9 @@ export declare class MessagingContribution implements BackendApplicationContribu
31
28
  protected handleConnection(socket: Socket): void;
32
29
  protected allowConnect(request: http.IncomingMessage): Promise<boolean>;
33
30
  protected handleChannels(socket: Socket): void;
31
+ protected toIWebSocket(socket: Socket): IWebSocket;
34
32
  protected createSocketContainer(socket: Socket): Container;
35
- protected getConnectionChannelHandlers(socket: Socket): MessagingContribution.ConnectionHandlers<WebSocketChannel>;
36
- protected createChannel(id: number, socket: Socket): WebSocketChannel;
33
+ protected getConnectionChannelHandlers(socket: Socket): MessagingContribution.ConnectionHandlers<Channel>;
37
34
  }
38
35
  export declare namespace MessagingContribution {
39
36
  class ConnectionHandlers<T> {
@@ -1 +1 @@
1
- {"version":3,"file":"messaging-contribution.d.ts","sourceRo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