@lvce-editor/pty-host 0.15.28 → 0.15.30
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 +2 -2
- package/src/parts/HandleJsonRpcMessage/HandleJsonRpcMessage.js +3 -1
- package/src/parts/IpcChildWithNodeWorker/IpcChildWithNodeWorker.js +2 -1
- package/src/parts/JsonRpcEvent/JsonRpcEvent.js +9 -0
- package/src/parts/JsonRpcRequest/JsonRpcRequest.js +16 -0
- package/src/ptyHostMain.js +1 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/pty-host",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
"ws": "^8.13.0"
|
|
24
24
|
},
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"node-pty": "^0.
|
|
26
|
+
"node-pty": "^1.0.0"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { parentPort } from 'node:worker_threads'
|
|
2
|
+
import { IpcError } from '../IpcError/IpcError.js'
|
|
2
3
|
|
|
3
4
|
export const listen = async () => {
|
|
4
5
|
if (!parentPort) {
|
|
5
|
-
throw new
|
|
6
|
+
throw new IpcError('parentPort is required')
|
|
6
7
|
}
|
|
7
8
|
parentPort.postMessage('ready')
|
|
8
9
|
return parentPort
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as Callback from '../Callback/Callback.js'
|
|
2
|
+
import * as JsonRpcVersion from '../JsonRpcVersion/JsonRpcVersion.js'
|
|
3
|
+
|
|
4
|
+
export const create = (method, params) => {
|
|
5
|
+
const { id, promise } = Callback.registerPromise()
|
|
6
|
+
const message = {
|
|
7
|
+
jsonrpc: JsonRpcVersion.Two,
|
|
8
|
+
method,
|
|
9
|
+
params,
|
|
10
|
+
id,
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
message,
|
|
14
|
+
promise,
|
|
15
|
+
}
|
|
16
|
+
}
|