@lvce-editor/embeds-process 4.0.0 → 4.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.
@@ -1478,7 +1478,9 @@ const targetMessagePort$2 = async (messagePort, message) => {
1478
1478
  commandMap: commandMapRef
1479
1479
  });
1480
1480
  // @ts-ignore
1481
- const ipc = rpc.ipc;
1481
+ const {
1482
+ ipc
1483
+ } = rpc;
1482
1484
  ipc.addEventListener('close', handleIpcClosed);
1483
1485
  return rpc;
1484
1486
  };
@@ -1550,11 +1552,13 @@ const getModule = ipcId => {
1550
1552
  switch (ipcId) {
1551
1553
  case SharedProcess:
1552
1554
  return HandleIpcSharedProcess;
1555
+ // deprecated
1553
1556
  case EmbedsWorker:
1554
1557
  case EmbedsWorkerAlt:
1555
1558
  return HandleIpcEmbedsWorker;
1556
1559
  case MainProcess:
1557
1560
  return HandleIpcMainProcess;
1561
+ // deprecated
1558
1562
  default:
1559
1563
  throw new Error(`Embeds process encountered unexpected incoming ipc ${ipcId}`);
1560
1564
  }
@@ -1579,6 +1583,23 @@ const handleElectronMessagePort = async (messagePort, ipcId) => {
1579
1583
  return handleIncomingIpc(ipcId, messagePort, {});
1580
1584
  };
1581
1585
 
1586
+ const createMainProcessRpc = async port => {
1587
+ try {
1588
+ const rpc = await ElectronMessagePortRpcClient.create({
1589
+ commandMap: {},
1590
+ messagePort: port
1591
+ });
1592
+ return rpc;
1593
+ } catch (error) {
1594
+ throw new VError(error, `Failed to create main process rpc`);
1595
+ }
1596
+ };
1597
+
1598
+ const initialize = async port => {
1599
+ const rpc = await createMainProcessRpc(port);
1600
+ set$2(rpc);
1601
+ };
1602
+
1582
1603
  const commandMap = {
1583
1604
  'ElectronWebContents.handleBrowserViewDestroyed': handleBrowserViewDestroyed,
1584
1605
  'ElectronWebContents.handleContextMenu': handleContextMenu,
@@ -1603,7 +1624,8 @@ const commandMap = {
1603
1624
  'ElectronWebContentsView.setIframeSrc': setIframeSrc,
1604
1625
  'ElectronWebContentsView.setIframeSrcFallback': setIframeSrcFallback,
1605
1626
  'ElectronWebContentsView.show': show,
1606
- 'HandleElectronMessagePort.handleElectronMessagePort': handleElectronMessagePort
1627
+ 'HandleElectronMessagePort.handleElectronMessagePort': handleElectronMessagePort,
1628
+ 'Initialize.initialize': initialize
1607
1629
  };
1608
1630
 
1609
1631
  const listen = async argv => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/embeds-process",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Embeds Process",
5
5
  "keywords": [
6
6
  "Lvce Editor"