@lvce-editor/pty-host 5.5.0 → 7.0.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 +27 -28
- package/package.json +1 -1
package/dist/ptyHostMain.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import debugModule from 'debug';
|
|
2
1
|
import { Console } from 'node:console';
|
|
3
2
|
import { createWriteStream, readFileSync } from 'node:fs';
|
|
4
3
|
import { tmpdir } from 'node:os';
|
|
@@ -1266,6 +1265,9 @@ const Auto = () => {
|
|
|
1266
1265
|
if (argv.includes('--ipc-type=node-forked-process')) {
|
|
1267
1266
|
return NodeForkedProcess;
|
|
1268
1267
|
}
|
|
1268
|
+
if (argv.includes('--ipc-type=websocket')) {
|
|
1269
|
+
return WebSocket;
|
|
1270
|
+
}
|
|
1269
1271
|
if (argv.includes('--ipc-type=electron-utility-process')) {
|
|
1270
1272
|
return ElectronUtilityProcess;
|
|
1271
1273
|
}
|
|
@@ -1274,14 +1276,14 @@ const Auto = () => {
|
|
|
1274
1276
|
|
|
1275
1277
|
const getModule = method => {
|
|
1276
1278
|
switch (method) {
|
|
1279
|
+
case ElectronMessagePort:
|
|
1280
|
+
return ElectronMessagePortRpcClient;
|
|
1281
|
+
case ElectronUtilityProcess:
|
|
1282
|
+
return ElectronUtilityProcessRpcClient;
|
|
1277
1283
|
case NodeForkedProcess:
|
|
1278
1284
|
return NodeForkedProcessRpcClient;
|
|
1279
1285
|
case WebSocket:
|
|
1280
1286
|
return NodeWebSocketRpcClient;
|
|
1281
|
-
case ElectronUtilityProcess:
|
|
1282
|
-
return ElectronUtilityProcessRpcClient;
|
|
1283
|
-
case ElectronMessagePort:
|
|
1284
|
-
return ElectronMessagePortRpcClient;
|
|
1285
1287
|
default:
|
|
1286
1288
|
throw new Error('unexpected ipc type');
|
|
1287
1289
|
}
|
|
@@ -1299,8 +1301,8 @@ const listen$1 = async ({
|
|
|
1299
1301
|
|
|
1300
1302
|
const handleNodeMessagePort = async messagePort => {
|
|
1301
1303
|
await listen$1({
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
+
messagePort,
|
|
1305
|
+
method: NodeMessagePort
|
|
1304
1306
|
});
|
|
1305
1307
|
};
|
|
1306
1308
|
|
|
@@ -1315,8 +1317,6 @@ const handleWebSocket = async (handle, request) => {
|
|
|
1315
1317
|
});
|
|
1316
1318
|
};
|
|
1317
1319
|
|
|
1318
|
-
const debug = debugModule('pty-host');
|
|
1319
|
-
|
|
1320
1320
|
class DataEvent extends Event {
|
|
1321
1321
|
constructor(data) {
|
|
1322
1322
|
super('data');
|
|
@@ -1365,9 +1365,9 @@ class Pty extends EventTarget {
|
|
|
1365
1365
|
* @returns {Promise<any>}
|
|
1366
1366
|
*/
|
|
1367
1367
|
const create$1 = async ({
|
|
1368
|
-
|
|
1368
|
+
args,
|
|
1369
1369
|
command,
|
|
1370
|
-
|
|
1370
|
+
cwd
|
|
1371
1371
|
} = {}) => {
|
|
1372
1372
|
try {
|
|
1373
1373
|
string(cwd);
|
|
@@ -1377,8 +1377,8 @@ const create$1 = async ({
|
|
|
1377
1377
|
spawn
|
|
1378
1378
|
} = await import('node-pty');
|
|
1379
1379
|
const pty = spawn(command, args, {
|
|
1380
|
-
|
|
1381
|
-
|
|
1380
|
+
cwd,
|
|
1381
|
+
encoding: null
|
|
1382
1382
|
// cols: 10,
|
|
1383
1383
|
// rows: 10,
|
|
1384
1384
|
});
|
|
@@ -1409,12 +1409,11 @@ const create = async (ipc, id, cwd, command, args) => {
|
|
|
1409
1409
|
string(command);
|
|
1410
1410
|
array(args);
|
|
1411
1411
|
object(ipc);
|
|
1412
|
-
debug(`create ${id} ${cwd}`);
|
|
1413
1412
|
// @ts-ignore
|
|
1414
1413
|
const pty = await create$1({
|
|
1415
|
-
|
|
1414
|
+
args,
|
|
1416
1415
|
command,
|
|
1417
|
-
|
|
1416
|
+
cwd
|
|
1418
1417
|
});
|
|
1419
1418
|
const handleData = event => {
|
|
1420
1419
|
ipc.send({
|
|
@@ -1462,9 +1461,9 @@ const commandMap = {
|
|
|
1462
1461
|
[HandleNodeMessagePort]: handleNodeMessagePort,
|
|
1463
1462
|
[HandleWebSocket]: handleWebSocket,
|
|
1464
1463
|
[TerminalCreate]: create,
|
|
1464
|
+
[TerminalDispose]: dispose,
|
|
1465
1465
|
[TerminalResize]: resize,
|
|
1466
|
-
[TerminalWrite]: write
|
|
1467
|
-
[TerminalDispose]: dispose
|
|
1466
|
+
[TerminalWrite]: write
|
|
1468
1467
|
};
|
|
1469
1468
|
|
|
1470
1469
|
const listen = async () => {
|
|
@@ -1776,54 +1775,54 @@ var hasRequiredLib$1;
|
|
|
1776
1775
|
function requireLib$1 () {
|
|
1777
1776
|
if (hasRequiredLib$1) return lib;
|
|
1778
1777
|
hasRequiredLib$1 = 1;
|
|
1779
|
-
(function (exports) {
|
|
1778
|
+
(function (exports$1) {
|
|
1780
1779
|
|
|
1781
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1780
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
1782
1781
|
value: true
|
|
1783
1782
|
});
|
|
1784
|
-
Object.defineProperty(exports, "isIdentifierChar", {
|
|
1783
|
+
Object.defineProperty(exports$1, "isIdentifierChar", {
|
|
1785
1784
|
enumerable: true,
|
|
1786
1785
|
get: function () {
|
|
1787
1786
|
return _identifier.isIdentifierChar;
|
|
1788
1787
|
}
|
|
1789
1788
|
});
|
|
1790
|
-
Object.defineProperty(exports, "isIdentifierName", {
|
|
1789
|
+
Object.defineProperty(exports$1, "isIdentifierName", {
|
|
1791
1790
|
enumerable: true,
|
|
1792
1791
|
get: function () {
|
|
1793
1792
|
return _identifier.isIdentifierName;
|
|
1794
1793
|
}
|
|
1795
1794
|
});
|
|
1796
|
-
Object.defineProperty(exports, "isIdentifierStart", {
|
|
1795
|
+
Object.defineProperty(exports$1, "isIdentifierStart", {
|
|
1797
1796
|
enumerable: true,
|
|
1798
1797
|
get: function () {
|
|
1799
1798
|
return _identifier.isIdentifierStart;
|
|
1800
1799
|
}
|
|
1801
1800
|
});
|
|
1802
|
-
Object.defineProperty(exports, "isKeyword", {
|
|
1801
|
+
Object.defineProperty(exports$1, "isKeyword", {
|
|
1803
1802
|
enumerable: true,
|
|
1804
1803
|
get: function () {
|
|
1805
1804
|
return _keyword.isKeyword;
|
|
1806
1805
|
}
|
|
1807
1806
|
});
|
|
1808
|
-
Object.defineProperty(exports, "isReservedWord", {
|
|
1807
|
+
Object.defineProperty(exports$1, "isReservedWord", {
|
|
1809
1808
|
enumerable: true,
|
|
1810
1809
|
get: function () {
|
|
1811
1810
|
return _keyword.isReservedWord;
|
|
1812
1811
|
}
|
|
1813
1812
|
});
|
|
1814
|
-
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
|
1813
|
+
Object.defineProperty(exports$1, "isStrictBindOnlyReservedWord", {
|
|
1815
1814
|
enumerable: true,
|
|
1816
1815
|
get: function () {
|
|
1817
1816
|
return _keyword.isStrictBindOnlyReservedWord;
|
|
1818
1817
|
}
|
|
1819
1818
|
});
|
|
1820
|
-
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
|
1819
|
+
Object.defineProperty(exports$1, "isStrictBindReservedWord", {
|
|
1821
1820
|
enumerable: true,
|
|
1822
1821
|
get: function () {
|
|
1823
1822
|
return _keyword.isStrictBindReservedWord;
|
|
1824
1823
|
}
|
|
1825
1824
|
});
|
|
1826
|
-
Object.defineProperty(exports, "isStrictReservedWord", {
|
|
1825
|
+
Object.defineProperty(exports$1, "isStrictReservedWord", {
|
|
1827
1826
|
enumerable: true,
|
|
1828
1827
|
get: function () {
|
|
1829
1828
|
return _keyword.isStrictReservedWord;
|