@lvce-editor/pty-host 3.0.0 → 3.1.0
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/dist/ptyHostMain.js +53 -1
- package/package.json +6 -8
package/dist/ptyHostMain.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { execute, register } from '@lvce-editor/command';
|
|
2
|
-
import { object, string, array, number } from '@lvce-editor/assert';
|
|
3
2
|
import { handleJsonRpcMessage, resolve } from '@lvce-editor/json-rpc';
|
|
4
3
|
import { IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess, IpcChildWithWebSocket, IpcChildWithNodeWorker, IpcChildWithNodeForkedProcess } from '@lvce-editor/ipc';
|
|
5
4
|
import debugModule from 'debug';
|
|
@@ -10,6 +9,59 @@ import { createWriteStream } from 'node:fs';
|
|
|
10
9
|
import { tmpdir } from 'node:os';
|
|
11
10
|
import { prepare } from '@lvce-editor/pretty-error';
|
|
12
11
|
|
|
12
|
+
class AssertionError extends Error {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'AssertionError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const getType = value => {
|
|
19
|
+
switch (typeof value) {
|
|
20
|
+
case 'number':
|
|
21
|
+
return 'number';
|
|
22
|
+
case 'function':
|
|
23
|
+
return 'function';
|
|
24
|
+
case 'string':
|
|
25
|
+
return 'string';
|
|
26
|
+
case 'object':
|
|
27
|
+
if (value === null) {
|
|
28
|
+
return 'null';
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
return 'array';
|
|
32
|
+
}
|
|
33
|
+
return 'object';
|
|
34
|
+
case 'boolean':
|
|
35
|
+
return 'boolean';
|
|
36
|
+
default:
|
|
37
|
+
return 'unknown';
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const object = value => {
|
|
41
|
+
const type = getType(value);
|
|
42
|
+
if (type !== 'object') {
|
|
43
|
+
throw new AssertionError('expected value to be of type object');
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const number = value => {
|
|
47
|
+
const type = getType(value);
|
|
48
|
+
if (type !== 'number') {
|
|
49
|
+
throw new AssertionError('expected value to be of type number');
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const array = value => {
|
|
53
|
+
const type = getType(value);
|
|
54
|
+
if (type !== 'array') {
|
|
55
|
+
throw new AssertionError('expected value to be of type array');
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const string = value => {
|
|
59
|
+
const type = getType(value);
|
|
60
|
+
if (type !== 'string') {
|
|
61
|
+
throw new AssertionError('expected value to be of type string');
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
13
65
|
const METHODS_THAT_REQUIRE_SOCKET = new Set(['Terminal.create']);
|
|
14
66
|
const requiresSocket = method => {
|
|
15
67
|
return METHODS_THAT_REQUIRE_SOCKET.has(method);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/pty-host",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/ptyHostMain.js",
|
|
6
6
|
"bin": "bin/ptyHost.js",
|
|
@@ -15,19 +15,17 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "https://github.com/lvce-editor/pty-host.git"
|
|
17
17
|
},
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=18"
|
|
20
|
-
},
|
|
21
18
|
"dependencies": {
|
|
22
19
|
"@lvce-editor/assert": "^1.3.0",
|
|
23
20
|
"@lvce-editor/command": "^1.2.0",
|
|
24
|
-
"@lvce-editor/ipc": "^
|
|
25
|
-
"@lvce-editor/json-rpc": "^5.
|
|
21
|
+
"@lvce-editor/ipc": "^13.6.0",
|
|
22
|
+
"@lvce-editor/json-rpc": "^5.4.0",
|
|
26
23
|
"@lvce-editor/pretty-error": "^1.6.0",
|
|
24
|
+
"@lvce-editor/rpc": "^1.21.0",
|
|
27
25
|
"@lvce-editor/verror": "^1.6.0",
|
|
28
|
-
"debug": "^4.
|
|
26
|
+
"debug": "^4.4.0"
|
|
29
27
|
},
|
|
30
28
|
"optionalDependencies": {
|
|
31
|
-
"node-pty": "^1.1.0-
|
|
29
|
+
"node-pty": "^1.1.0-beta27"
|
|
32
30
|
}
|
|
33
31
|
}
|