@lvce-editor/pty-host 8.9.0 → 8.10.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.
@@ -1570,7 +1570,7 @@ const resize = (ipc, id, columns, rows) => {
1570
1570
  }
1571
1571
  pty.resize(columns, rows);
1572
1572
  };
1573
- const dispose = (ipc, id) => {
1573
+ const dispose$1 = (ipc, id) => {
1574
1574
  const pty = get(ipc, id);
1575
1575
  if (!pty) {
1576
1576
  return;
@@ -1624,13 +1624,25 @@ const requiresSocket = method => {
1624
1624
  return METHODS_THAT_REQUIRE_SOCKET.has(method);
1625
1625
  };
1626
1626
 
1627
- const handleElectronMessagePort = async (messagePort, connectionId) => {
1627
+ const handleMessagePortWithDependencies = async (messagePort, sourceRpcId, connectionId, createRpc) => {
1628
1628
  object(messagePort);
1629
- await connect(messagePort, connectionId, () => create$5({
1629
+ const create = () => createRpc({
1630
1630
  commandMap: {},
1631
1631
  messagePort,
1632
1632
  requiresSocket: requiresSocket
1633
- }));
1633
+ });
1634
+ if (sourceRpcId !== undefined) {
1635
+ // The control port is owned by shared-process, not by a terminal window.
1636
+ setParent(await create());
1637
+ return;
1638
+ }
1639
+ await connect(messagePort, connectionId, create);
1640
+ };
1641
+ const handleTerminalMessagePort = (messagePort, connectionId) => {
1642
+ return handleMessagePortWithDependencies(messagePort, undefined, connectionId, create$5);
1643
+ };
1644
+ const handleElectronMessagePort = (messagePort, sourceRpcId) => {
1645
+ return handleMessagePortWithDependencies(messagePort, sourceRpcId, undefined, create$5);
1634
1646
  };
1635
1647
 
1636
1648
  const NodeWorker = 1;
@@ -1704,6 +1716,10 @@ const handleWebSocket = async (handle, request, connectionId) => {
1704
1716
  }));
1705
1717
  };
1706
1718
 
1719
+ const dispose = () => {
1720
+ setTimeout(() => process.exit(0), 0);
1721
+ };
1722
+
1707
1723
  const HandleElectronMessagePort = 'HandleElectronMessagePort.handleElectronMessagePort';
1708
1724
  const HandleNodeMessagePort = 'HandleNodeMessagePort.handleNodeMessagePort';
1709
1725
  const HandleWebSocket = 'HandleWebSocket.handleWebSocket';
@@ -1714,22 +1730,25 @@ const TerminalWrite = 'Terminal.write';
1714
1730
  const TerminalDispose = 'Terminal.dispose';
1715
1731
 
1716
1732
  const commandMap = {
1733
+ 'HandleElectronMessagePort.handleTerminalMessagePort': handleTerminalMessagePort,
1734
+ 'TerminalProcess.dispose': dispose,
1717
1735
  [HandleElectronMessagePort]: handleElectronMessagePort,
1718
1736
  [HandleNodeMessagePort]: handleNodeMessagePort,
1719
1737
  [HandleWebSocket]: handleWebSocket,
1720
1738
  [TerminalCreate]: create,
1721
- [TerminalDispose]: dispose,
1739
+ [TerminalDispose]: dispose$1,
1722
1740
  [TerminalExecuteShellCommand]: executeShellCommand,
1723
1741
  [TerminalResize]: resize,
1724
1742
  [TerminalWrite]: write
1725
1743
  };
1726
1744
 
1727
1745
  const listen = async () => {
1746
+ const method = Auto();
1728
1747
  const rpc = await listen$1({
1729
- method: Auto(),
1748
+ method,
1730
1749
  requiresSocket: requiresSocket
1731
1750
  });
1732
- setParent(rpc);
1751
+ if (method !== ElectronUtilityProcess) setParent(rpc);
1733
1752
  };
1734
1753
 
1735
1754
  const NewLine$1 = '\n';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/pty-host",
3
- "version": "8.9.0",
3
+ "version": "8.10.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "pty-host"