@lvce-editor/pty-host 3.0.0 → 3.2.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 +55 -3
- package/package.json +12 -14
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);
|
|
@@ -130,12 +182,14 @@ class DataEvent extends Event {
|
|
|
130
182
|
this.data = data;
|
|
131
183
|
}
|
|
132
184
|
}
|
|
185
|
+
|
|
133
186
|
class ExitEvent extends Event {
|
|
134
187
|
constructor(data) {
|
|
135
188
|
super('exit');
|
|
136
189
|
this.data = data;
|
|
137
190
|
}
|
|
138
191
|
}
|
|
192
|
+
|
|
139
193
|
class Pty extends EventTarget {
|
|
140
194
|
/**
|
|
141
195
|
*
|
|
@@ -353,8 +407,6 @@ const firstErrorLine = error => {
|
|
|
353
407
|
}
|
|
354
408
|
return `${error}`;
|
|
355
409
|
};
|
|
356
|
-
|
|
357
|
-
// @ts-ignore
|
|
358
410
|
const handleUncaughtExceptionMonitor$1 = error$1 => {
|
|
359
411
|
info(`[pty host] uncaught exception: ${firstErrorLine(error$1)}`);
|
|
360
412
|
if (isIgnoredError(error$1)) {
|
package/package.json
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/pty-host",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "dist/ptyHostMain.js",
|
|
6
|
-
"bin": "bin/ptyHost.js",
|
|
7
|
-
"type": "module",
|
|
8
5
|
"keywords": [
|
|
9
6
|
"lvce-editor",
|
|
10
7
|
"pty-host"
|
|
11
8
|
],
|
|
12
|
-
"author": "Lvce Editor",
|
|
13
|
-
"license": "MIT",
|
|
14
9
|
"repository": {
|
|
15
10
|
"type": "git",
|
|
16
11
|
"url": "https://github.com/lvce-editor/pty-host.git"
|
|
17
12
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Lvce Editor",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "dist/ptyHostMain.js",
|
|
17
|
+
"bin": "bin/ptyHost.js",
|
|
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.
|
|
26
|
-
"@lvce-editor/pretty-error": "^
|
|
21
|
+
"@lvce-editor/ipc": "^13.8.0",
|
|
22
|
+
"@lvce-editor/json-rpc": "^5.4.0",
|
|
23
|
+
"@lvce-editor/pretty-error": "^2.0.0",
|
|
24
|
+
"@lvce-editor/rpc": "^1.27.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-beta34"
|
|
32
30
|
}
|
|
33
31
|
}
|