@lvce-editor/shared-process 0.15.28 → 0.15.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.29",
|
|
4
4
|
"description": "Utility package for @lvce-editor/server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/code-frame": "^7.22.5",
|
|
20
|
-
"@lvce-editor/extension-host": "0.15.
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.15.
|
|
22
|
-
"@lvce-editor/pty-host": "0.15.
|
|
20
|
+
"@lvce-editor/extension-host": "0.15.29",
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.15.29",
|
|
22
|
+
"@lvce-editor/pty-host": "0.15.29",
|
|
23
23
|
"debug": "^4.3.4",
|
|
24
24
|
"execa": "^7.1.1",
|
|
25
25
|
"exit-hook": "^3.2.0",
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import * as Command from '../Command/Command.js'
|
|
2
1
|
import * as GetErrorResponse from '../GetErrorResponse/GetErrorResponse.js'
|
|
3
2
|
import * as GetSuccessResponse from '../GetSuccessResponse/GetSuccessResponse.js'
|
|
4
3
|
import * as RequiresSocket from '../RequiresSocket/RequiresSocket.js'
|
|
5
4
|
|
|
6
|
-
export const getResponse = async (message, ipc) => {
|
|
5
|
+
export const getResponse = async (message, ipc, execute) => {
|
|
7
6
|
try {
|
|
8
7
|
const result = RequiresSocket.requiresSocket(message.method)
|
|
9
|
-
? await
|
|
10
|
-
: await
|
|
8
|
+
? await execute(message.method, ipc, ...message.params)
|
|
9
|
+
: await execute(message.method, ...message.params)
|
|
11
10
|
return GetSuccessResponse.getSuccessResponse(message, result)
|
|
12
11
|
} catch (error) {
|
|
13
12
|
return GetErrorResponse.getErrorResponse(message, error, ipc)
|
|
@@ -5,7 +5,7 @@ import { JsonRpcError } from '../JsonRpcError/JsonRpcError.js'
|
|
|
5
5
|
export const handleJsonRpcMessage = async (ipc, message, execute, resolve) => {
|
|
6
6
|
if ('id' in message) {
|
|
7
7
|
if ('method' in message) {
|
|
8
|
-
const response = await GetResponse.getResponse(message, execute)
|
|
8
|
+
const response = await GetResponse.getResponse(message, ipc, execute)
|
|
9
9
|
try {
|
|
10
10
|
ipc.send(response)
|
|
11
11
|
} catch (error) {
|
|
@@ -18,7 +18,7 @@ export const handleJsonRpcMessage = async (ipc, message, execute, resolve) => {
|
|
|
18
18
|
return
|
|
19
19
|
}
|
|
20
20
|
if ('method' in message) {
|
|
21
|
-
await GetResponse.getResponse(message, execute)
|
|
21
|
+
await GetResponse.getResponse(message, ipc, execute)
|
|
22
22
|
return
|
|
23
23
|
}
|
|
24
24
|
throw new JsonRpcError('unexpected message')
|
|
@@ -28,14 +28,14 @@ const createTerminal = (ptyHost, socket) => {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export const create = async (
|
|
31
|
+
export const create = async (ipc, id, cwd, command, args) => {
|
|
32
32
|
try {
|
|
33
|
-
Assert.object(
|
|
33
|
+
Assert.object(ipc)
|
|
34
34
|
Assert.number(id)
|
|
35
35
|
Assert.string(cwd)
|
|
36
36
|
// TODO race condition because of await
|
|
37
37
|
const ptyHost = await PtyHost.getOrCreate()
|
|
38
|
-
const terminal = createTerminal(ptyHost,
|
|
38
|
+
const terminal = createTerminal(ptyHost, ipc)
|
|
39
39
|
TerminalState.add(id, terminal)
|
|
40
40
|
// TODO use invoke
|
|
41
41
|
ptyHost.send({
|