@lvce-editor/process-explorer-worker 3.7.0 → 3.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.
Files changed (2) hide show
  1. package/index.js +237 -739
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -181,17 +181,19 @@ const collapseAll = state => {
181
181
  };
182
182
 
183
183
  const {
184
- dispose: dispose$3,
184
+ dispose: dispose$4,
185
185
  get: get$2,
186
186
  getCommandIds,
187
187
  getKeys: getKeys$1,
188
188
  registerCommands,
189
- set: set$a,
189
+ set: set$6,
190
190
  wrapCommand,
191
191
  wrapGetter,
192
192
  wrapLoadContent
193
193
  } = create$e();
194
194
 
195
+ const processExplorerUpdateInterval = 1000;
196
+
195
197
  const getIncludeFrontendMemoryUsage = args => {
196
198
  if (!args || typeof args !== 'object') {
197
199
  return false;
@@ -199,6 +201,16 @@ const getIncludeFrontendMemoryUsage = args => {
199
201
  const createArgs = args;
200
202
  return createArgs.includeFrontendMemoryUsage === true;
201
203
  };
204
+ const getUpdateInterval = args => {
205
+ if (!args || typeof args !== 'object') {
206
+ return processExplorerUpdateInterval;
207
+ }
208
+ const createArgs = args;
209
+ if (typeof createArgs.updateInterval !== 'number') {
210
+ return processExplorerUpdateInterval;
211
+ }
212
+ return createArgs.updateInterval;
213
+ };
202
214
  const create$d = (id, _uri, x, y, width, height, args, parentUid, platform = 0, assetDir = '') => {
203
215
  const state = {
204
216
  assetDir,
@@ -215,14 +227,15 @@ const create$d = (id, _uri, x, y, width, height, args, parentUid, platform = 0,
215
227
  parentUid,
216
228
  platform,
217
229
  processes: [],
218
- rootPid: 0,
230
+ rootPid: -1,
219
231
  uid: id,
232
+ updateInterval: getUpdateInterval(args),
220
233
  visibleProcesses: [],
221
234
  width,
222
235
  x,
223
236
  y
224
237
  };
225
- set$a(state.uid, state, state);
238
+ set$6(state.uid, state, state);
226
239
  return state;
227
240
  };
228
241
 
@@ -888,8 +901,10 @@ const getCurrentStack = () => {
888
901
  const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
889
902
  return currentStack;
890
903
  };
891
- const getNewLineIndex = (string, startIndex = undefined) => {
892
- return string.indexOf(NewLine, startIndex);
904
+ const getNewLineIndex = (string, startIndex) => {
905
+ {
906
+ return string.indexOf(NewLine);
907
+ }
893
908
  };
894
909
  const getParentStack = error => {
895
910
  let parentStack = error.stack || error.data || error.message || '';
@@ -900,55 +915,77 @@ const getParentStack = error => {
900
915
  };
901
916
  const MethodNotFound = -32601;
902
917
  const Custom = -32001;
918
+ const restoreExistingError = (error, currentStack) => {
919
+ if (typeof error.stack === 'string') {
920
+ error.stack = error.stack + NewLine + currentStack;
921
+ }
922
+ return error;
923
+ };
924
+ const restoreMethodNotFoundError = (error, currentStack) => {
925
+ const restoredError = new JsonRpcError(error.message);
926
+ const parentStack = getParentStack(error);
927
+ restoredError.stack = parentStack + NewLine + currentStack;
928
+ return restoredError;
929
+ };
930
+ const restoreStackFromData = (restoredError, error, currentStack) => {
931
+ if (error.data.stack && error.data.type && error.message) {
932
+ restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
933
+ return;
934
+ }
935
+ if (error.data.stack) {
936
+ restoredError.stack = error.data.stack;
937
+ }
938
+ };
939
+ const applyDataProperties = (restoredError, error) => {
940
+ if (!error.data) {
941
+ return;
942
+ }
943
+ restoreStackFromData(restoredError, error, getCurrentStack());
944
+ if (error.data.codeFrame) {
945
+ // @ts-ignore
946
+ restoredError.codeFrame = error.data.codeFrame;
947
+ }
948
+ if (error.data.code) {
949
+ // @ts-ignore
950
+ restoredError.code = error.data.code;
951
+ }
952
+ if (error.data.type) {
953
+ // @ts-ignore
954
+ restoredError.name = error.data.type;
955
+ }
956
+ };
957
+ const applyDirectProperties = (restoredError, error) => {
958
+ if (error.stack) {
959
+ const lowerStack = restoredError.stack || '';
960
+ const indexNewLine = getNewLineIndex(lowerStack);
961
+ const parentStack = getParentStack(error);
962
+ // @ts-ignore
963
+ restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
964
+ }
965
+ if (error.codeFrame) {
966
+ // @ts-ignore
967
+ restoredError.codeFrame = error.codeFrame;
968
+ }
969
+ };
970
+ const restoreMessageError = (error, _currentStack) => {
971
+ const restoredError = constructError(error.message, error.type, error.name);
972
+ if (error.data) {
973
+ applyDataProperties(restoredError, error);
974
+ } else {
975
+ applyDirectProperties(restoredError, error);
976
+ }
977
+ return restoredError;
978
+ };
903
979
  const restoreJsonRpcError = error => {
904
980
  const currentStack = getCurrentStack();
905
981
  if (error && error instanceof Error) {
906
- if (typeof error.stack === 'string') {
907
- error.stack = error.stack + NewLine + currentStack;
908
- }
909
- return error;
982
+ return restoreExistingError(error, currentStack);
910
983
  }
911
984
  if (error && error.code && error.code === MethodNotFound) {
912
- const restoredError = new JsonRpcError(error.message);
913
- const parentStack = getParentStack(error);
914
- restoredError.stack = parentStack + NewLine + currentStack;
915
- return restoredError;
985
+ return restoreMethodNotFoundError(error, currentStack);
916
986
  }
917
987
  if (error && error.message) {
918
- const restoredError = constructError(error.message, error.type, error.name);
919
- if (error.data) {
920
- if (error.data.stack && error.data.type && error.message) {
921
- restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
922
- } else if (error.data.stack) {
923
- restoredError.stack = error.data.stack;
924
- }
925
- if (error.data.codeFrame) {
926
- // @ts-ignore
927
- restoredError.codeFrame = error.data.codeFrame;
928
- }
929
- if (error.data.code) {
930
- // @ts-ignore
931
- restoredError.code = error.data.code;
932
- }
933
- if (error.data.type) {
934
- // @ts-ignore
935
- restoredError.name = error.data.type;
936
- }
937
- } else {
938
- if (error.stack) {
939
- const lowerStack = restoredError.stack || '';
940
- // @ts-ignore
941
- const indexNewLine = getNewLineIndex(lowerStack);
942
- const parentStack = getParentStack(error);
943
- // @ts-ignore
944
- restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
945
- }
946
- if (error.codeFrame) {
947
- // @ts-ignore
948
- restoredError.codeFrame = error.codeFrame;
949
- }
950
- }
951
- return restoredError;
988
+ return restoreMessageError(error);
952
989
  }
953
990
  if (typeof error === 'string') {
954
991
  return new Error(`JsonRpc Error: ${error}`);
@@ -1423,7 +1460,7 @@ const createMockRpc = ({
1423
1460
  };
1424
1461
 
1425
1462
  const rpcs = Object.create(null);
1426
- const set$9 = (id, rpc) => {
1463
+ const set$5 = (id, rpc) => {
1427
1464
  rpcs[id] = rpc;
1428
1465
  };
1429
1466
  const get = id => {
@@ -1456,7 +1493,7 @@ const create = rpcId => {
1456
1493
  const mockRpc = createMockRpc({
1457
1494
  commandMap
1458
1495
  });
1459
- set$9(rpcId, mockRpc);
1496
+ set$5(rpcId, mockRpc);
1460
1497
  // @ts-ignore
1461
1498
  mockRpc[Symbol.dispose] = () => {
1462
1499
  remove(rpcId);
@@ -1465,7 +1502,7 @@ const create = rpcId => {
1465
1502
  return mockRpc;
1466
1503
  },
1467
1504
  set(rpc) {
1468
- set$9(rpcId, rpc);
1505
+ set$5(rpcId, rpc);
1469
1506
  }
1470
1507
  };
1471
1508
  };
@@ -1483,7 +1520,6 @@ const Reference = 100;
1483
1520
 
1484
1521
  const ClientX = 'event.clientX';
1485
1522
  const ClientY = 'event.clientY';
1486
- const TargetName = 'event.target.name';
1487
1523
 
1488
1524
  const Enter = 3;
1489
1525
  const Space = 9;
@@ -1496,8 +1532,6 @@ const DownArrow = 16;
1496
1532
  const ContextMenu = 56;
1497
1533
  const Star = 131;
1498
1534
 
1499
- const Script = 2;
1500
-
1501
1535
  const CtrlCmd = 1 << 11 >>> 0;
1502
1536
 
1503
1537
  const None$1 = 0;
@@ -1505,14 +1539,9 @@ const None$1 = 0;
1505
1539
  const Electron = 2;
1506
1540
  const Remote = 3;
1507
1541
 
1508
- const DebugWorker = 55;
1509
- const EditorWorker = 99;
1510
1542
  const ErrorWorker = 3308;
1511
1543
  const FileSystemWorker$1 = 209;
1512
- const IconThemeWorker = 7009;
1513
- const OpenerWorker = 4561;
1514
- const RendererWorker$1 = 1;
1515
- const TestWorker = 9001;
1544
+ const RendererWorker = 1;
1516
1545
 
1517
1546
  const FocusSelector = 'Viewlet.focusSelector';
1518
1547
  const SetDom2 = 'Viewlet.setDom2';
@@ -1522,61 +1551,28 @@ const SetPatches = 'Viewlet.setPatches';
1522
1551
  const Empty = 0;
1523
1552
  const FocusExplorer = 13;
1524
1553
 
1525
- const {
1526
- set: set$8
1527
- } = create(EditorWorker);
1528
-
1529
1554
  const {
1530
1555
  invoke: invoke$2,
1531
- set: set$7
1556
+ set: set$4
1532
1557
  } = create(ErrorWorker);
1533
1558
  const prepare = async error => {
1534
1559
  return invoke$2('Errors.prepare', error);
1535
1560
  };
1536
1561
 
1537
1562
  const {
1538
- set: set$6
1563
+ set: set$3
1539
1564
  } = create(FileSystemWorker$1);
1540
1565
 
1541
1566
  const FileSystemWorker = {
1542
1567
  __proto__: null,
1543
- set: set$6
1544
- };
1545
-
1546
- const {
1547
- set: set$5
1548
- } = create(OpenerWorker);
1549
-
1550
- const {
1551
- set: set$4
1552
- } = create(10_001);
1553
-
1554
- const {
1555
1568
  set: set$3
1556
- } = create(IconThemeWorker);
1569
+ };
1557
1570
 
1558
1571
  const {
1559
- dispose: dispose$2,
1560
1572
  invoke: invoke$1,
1561
1573
  invokeAndTransfer,
1562
- registerMockRpc,
1563
1574
  set: set$2
1564
- } = create(RendererWorker$1);
1565
- const searchFileHtml = async uri => {
1566
- return invoke$1('ExtensionHost.searchFileWithHtml', uri);
1567
- };
1568
- const getFilePathElectron = async file => {
1569
- return invoke$1('FileSystemHandle.getFilePathElectron', file);
1570
- };
1571
- const handleModifiedStatusChange = async (uri, modified) => {
1572
- return invoke$1('Main.handleModifiedStatusChange', uri, modified);
1573
- };
1574
- /**
1575
- * @deprecated
1576
- */
1577
- const showContextMenu = async (x, y, id, ...args) => {
1578
- return invoke$1('ContextMenu.show', x, y, id, ...args);
1579
- };
1575
+ } = create(RendererWorker);
1580
1576
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1581
1577
  number(uid);
1582
1578
  number(menuId);
@@ -1584,565 +1580,18 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1584
1580
  number(y);
1585
1581
  await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1586
1582
  };
1587
- const getElectronVersion = async () => {
1588
- return invoke$1('Process.getElectronVersion');
1589
- };
1590
- const applyBulkReplacement = async bulkEdits => {
1591
- await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
1592
- };
1593
- const setColorTheme = async id => {
1594
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1595
- };
1596
- const getNodeVersion = async () => {
1597
- return invoke$1('Process.getNodeVersion');
1598
- };
1599
- const getBadgeCounts = async () => {
1600
- return invoke$1('Layout.getBadgeCounts');
1601
- };
1602
- const getChromeVersion = async () => {
1603
- return invoke$1('Process.getChromeVersion');
1604
- };
1605
- const getV8Version = async () => {
1606
- return invoke$1('Process.getV8Version');
1607
- };
1608
- const getFileHandles = async fileIds => {
1609
- const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
1610
- return files;
1611
- };
1612
- const setWorkspacePath = async path => {
1613
- await invoke$1('Workspace.setPath', path);
1614
- };
1615
- const registerWebViewInterceptor = async (id, port) => {
1616
- await invokeAndTransfer('WebView.registerInterceptor', id, port);
1617
- };
1618
- const unregisterWebViewInterceptor = async id => {
1619
- await invoke$1('WebView.unregisterInterceptor', id);
1620
- };
1621
- const sendMessagePortToEditorWorker = async (port, rpcId) => {
1622
- const command = 'HandleMessagePort.handleMessagePort';
1623
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1624
- };
1625
- const sendMessagePortToSettingsWorker = async (port, rpcId) => {
1626
- const command = 'HandleMessagePort.handleMessagePort';
1627
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSettingsWorker', port, command, rpcId);
1628
- };
1629
- const sendMessagePortToClipBoardWorker = async (port, rpcId) => {
1630
- const command = 'ClipBoard.handleMessagePort';
1631
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
1632
- };
1633
- const sendMessagePortToOpenerWorker = async (port, rpcId) => {
1634
- const command = 'HandleMessagePort.handleMessagePort';
1635
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
1636
- };
1637
- const sendMessagePortToChatMathWorker = async (port, rpcId) => {
1638
- const command = 'HandleMessagePort.handleMessagePort';
1639
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatMathWorker', port, command, rpcId);
1640
- };
1641
- const sendMessagePortToChatCoordinatorWorker = async (port, rpcId) => {
1642
- const command = 'HandleMessagePort.handleMessagePort';
1643
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatCoordinatorWorker', port, command, rpcId);
1644
- };
1645
- const sendMessagePortToChatMessageParsingWorker = async (port, rpcId) => {
1646
- const command = 'HandleMessagePort.handleMessagePort';
1647
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatMessageParsingWorker', port, command, rpcId);
1648
- };
1649
- const sendMessagePortToMainAreaWorker = async (port, rpcId) => {
1650
- const command = 'HandleMessagePort.handleMessagePort';
1651
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMainAreaWorker', port, command, rpcId);
1652
- };
1653
- const sendMessagePortToTerminalProcess = async (port, rpcId) => {
1654
- const command = 'HandleMessagePortForTerminalProcess.handleMessagePortForTerminalProcess';
1655
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTerminalProcess', port, command, rpcId);
1656
- };
1657
- const sendMessagePortToTextSearchWorker = async (port, rpcId) => {
1658
- const command = 'HandleMessagePort.handleMessagePort';
1659
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextSearchWorker', port, command, rpcId);
1660
- };
1661
- const sendMessagePortToAuthWorker = async (port, rpcId) => {
1662
- const command = 'HandleMessagePort.handleMessagePort';
1663
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToAuthWorker', port, command, rpcId);
1664
- };
1665
- const sendMessagePortToAuthProcess = async (port, rpcId) => {
1666
- const command = 'HandleMessagePortForAuthProcess.handleMessagePortForAuthProcess';
1667
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, rpcId);
1668
- };
1669
1583
  const sendMessagePortToErrorWorker$1 = async (port, rpcId) => {
1670
1584
  const command = 'Errors.handleMessagePort';
1671
1585
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
1672
1586
  };
1673
- const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1674
- const command = 'Markdown.handleMessagePort';
1675
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1676
- };
1677
- const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1678
- const command = 'IconTheme.handleMessagePort';
1679
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1680
- };
1681
1587
  const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
1682
1588
  const command = 'FileSystem.handleMessagePort';
1683
1589
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1684
1590
  };
1685
- const readFile = async uri => {
1686
- return invoke$1('FileSystem.readFile', uri);
1687
- };
1688
- const getWebViewSecret = async key => {
1689
- return invoke$1('WebView.getSecret', key);
1690
- };
1691
- const setWebViewPort = async (uid, port, origin, portType) => {
1692
- return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
1693
- };
1694
- const setFocus = key => {
1695
- return invoke$1('Focus.setFocus', key);
1696
- };
1697
- const getFileIcon = async options => {
1698
- return invoke$1('IconTheme.getFileIcon', options);
1699
- };
1700
- const getColorThemeNames = async () => {
1701
- return invoke$1('ColorTheme.getColorThemeNames');
1702
- };
1703
- const disableExtension = async id => {
1704
- return invoke$1('ExtensionManagement.disable', id);
1705
- };
1706
- const enableExtension = async id => {
1707
- return invoke$1('ExtensionManagement.enable', id);
1708
- };
1709
- const disposeEditor = async uid => {
1710
- return invoke$1('Viewlet.dispose', uid);
1711
- };
1712
- const handleDebugChange = async params => {
1713
- return invoke$1('Run And Debug.handleChange', params);
1714
- };
1715
- const getFolderIcon = async options => {
1716
- return invoke$1('IconTheme.getFolderIcon', options);
1717
- };
1718
- const handleWorkspaceRefresh = async () => {
1719
- return invoke$1('Layout.handleWorkspaceRefresh');
1720
- };
1721
- const closeWidget = async widgetId => {
1722
- return invoke$1('Viewlet.closeWidget', widgetId);
1723
- };
1724
- const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri) => {
1725
- return invoke$1('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
1726
- };
1727
- const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
1728
- const command = 'HandleMessagePort.handleMessagePort2';
1729
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1730
- };
1731
- const getViewletModuleId = async uri => {
1732
- return invoke$1('Layout.getModuleId', uri);
1733
- };
1734
- const showPanel = async () => {
1735
- return invoke$1('Layout.showPanel');
1736
- };
1737
- const showPreview = async () => {
1738
- return invoke$1('Layout.showPreview');
1739
- };
1740
- const saveEditor = async () => {
1741
- return invoke$1('Editor.save');
1742
- };
1743
- const sendMessagePortToFileSearchWorker2 = async (port, rpcId = 0) => {
1744
- const command = 'FileSearch.handleMessagePort';
1745
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSearchWorker', port, command, rpcId);
1746
- };
1747
- const togglePanelView = async id => {
1748
- return invoke$1('Panel.toggleView', id);
1749
- };
1750
- const resizeViewlet = async (uid, dimensions) => {
1751
- return invoke$1('Viewlet.resize', uid, dimensions);
1752
- };
1753
- const sendMessagePortToFileSearchWorker = async (port, rpcId = 0) => {
1754
- const command = 'QuickPick.handleMessagePort';
1755
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSearchWorker', port, command, rpcId);
1756
- };
1757
- const sendMessagePortToQuickPickWorker = async (port, rpcId = 0) => {
1758
- const command = 'QuickPick.handleMessagePort';
1759
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToQuickPickWorker', port, command, rpcId);
1760
- };
1761
- const sendMessagePortToSearchProcess = async port => {
1762
- await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1763
- };
1764
- const sendMessagePortToChatViewModel = async port => {
1765
- await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToChatViewModel', port, 'ViewModel.handleMessagePort');
1766
- };
1767
- const sendMessagePortToChatNetworkWorker = async port => {
1768
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatNetworkWorker', port, 'HandleMessagePort.handleMessagePort');
1769
- };
1770
- const sendMessagePortToChatToolWorker = async port => {
1771
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatToolWorker', port, 'HandleMessagePort.handleMessagePort');
1772
- };
1773
- const sendMessagePortToChatStorageWorker = async (port, rpcId) => {
1774
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatStorageWorker', port, 'HandleMessagePort.handleMessagePort', rpcId);
1775
- };
1776
- const sendMessagePortToChatDebugViewWorker = async port => {
1777
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatDebugViewWorker', port, 'HandleMessagePort.handleMessagePort');
1778
- };
1779
- const confirm = async (message, options) => {
1780
- const result = await invoke$1('ConfirmPrompt.prompt', message, options);
1781
- return result;
1782
- };
1783
- const getRecentlyOpened = async () => {
1784
- return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1785
- };
1786
- const getKeyBindings$1 = async () => {
1787
- return invoke$1('KeyBindingsInitial.getKeyBindings');
1788
- };
1789
- const writeClipBoardText = async text => {
1790
- await invoke$1('ClipBoard.writeText', /* text */text);
1791
- };
1792
- const writeFile = async (uri, text) => {
1793
- await invoke$1('FileSystem.writeFile', uri, text);
1794
- };
1795
- const handleUriChange = async (uri, newUri) => {
1796
- await invoke$1('Main.handleUriChange', uri, newUri);
1797
- };
1798
- const readClipBoardText = async () => {
1799
- return invoke$1('ClipBoard.readText');
1800
- };
1801
- const writeClipBoardImage = async blob => {
1802
- await invoke$1('ClipBoard.writeImage', /* text */blob);
1803
- };
1804
- const searchFileMemory = async uri => {
1805
- return invoke$1('ExtensionHost.searchFileWithMemory', uri);
1806
- };
1807
- const searchFileFetch = async uri => {
1808
- return invoke$1('ExtensionHost.searchFileWithFetch', uri);
1809
- };
1810
- const showMessageBox = async options => {
1811
- return invoke$1('ElectronDialog.showMessageBox', options);
1812
- };
1813
- const handleDebugResumed = async params => {
1814
- await invoke$1('Run And Debug.handleResumed', params);
1815
- };
1816
- const openWidget = async name => {
1817
- await invoke$1('Viewlet.openWidget', name);
1818
- };
1819
- const getIcons = async requests => {
1820
- const icons = await invoke$1('IconTheme.getIcons', requests);
1821
- return icons;
1822
- };
1823
- const activateByEvent = (event, assetDir, platform) => {
1824
- return invoke$1('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
1825
- };
1826
- const setAdditionalFocus = focusKey => {
1827
- return invoke$1('Focus.setAdditionalFocus', focusKey);
1828
- };
1829
- const getActiveEditorId = () => {
1830
- return invoke$1('GetActiveEditor.getActiveEditorId');
1831
- };
1832
- const getWorkspacePath = () => {
1833
- return invoke$1('Workspace.getPath');
1834
- };
1835
- const sendMessagePortToRendererProcess = async port => {
1836
- const command = 'HandleMessagePort.handleMessagePort';
1837
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
1838
- };
1839
- const sendMessagePortToTextMeasurementWorker = async port => {
1840
- const command = 'TextMeasurement.handleMessagePort';
1841
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
1842
- };
1843
1591
  const sendMessagePortToProcessExplorer$1 = async port => {
1844
1592
  const command = 'ProcessExplorer.handleMessagePort';
1845
1593
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToProcessExplorer', port, command, 0);
1846
1594
  };
1847
- const sendMessagePortToSourceControlWorker = async port => {
1848
- const command = 'SourceControl.handleMessagePort';
1849
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
1850
- };
1851
- const sendMessagePortToSharedProcess = async port => {
1852
- const command = 'HandleElectronMessagePort.handleElectronMessagePort';
1853
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, 0);
1854
- };
1855
- const sendMessagePortToFileSystemProcess = async (port, rpcId) => {
1856
- const command = 'HandleMessagePortForFileSystemProcess.handleMessagePortForFileSystemProcess';
1857
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, rpcId);
1858
- };
1859
- const sendMessagePortToIframeWorker = async (port, rpcId) => {
1860
- const command = 'Iframes.handleMessagePort';
1861
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIframeWorker', port, command, rpcId);
1862
- };
1863
- const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
1864
- const command = 'Extensions.handleMessagePort';
1865
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
1866
- };
1867
- const getPreference = async key => {
1868
- return await invoke$1('Preferences.get', key);
1869
- };
1870
- const getAllExtensions = async () => {
1871
- return invoke$1('ExtensionManagement.getAllExtensions');
1872
- };
1873
- const rerenderEditor = async key => {
1874
- return invoke$1('Editor.rerender', key);
1875
- };
1876
- const handleDebugPaused = async params => {
1877
- await invoke$1('Run And Debug.handlePaused', params);
1878
- };
1879
- const openUri = async (uri, focus, options) => {
1880
- await invoke$1('Main.openUri', uri, focus, options);
1881
- };
1882
- const sendMessagePortToSyntaxHighlightingWorker = async port => {
1883
- await invokeAndTransfer('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1884
- };
1885
- const sendMessagePortToBlobWorker = async (port, rpcId = 0) => {
1886
- const command = 'Blob.handleMessagePort';
1887
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToBlobWorker', port, command, rpcId);
1888
- };
1889
- const sendMessagePortToDiffWorker = async (port, rpcId = 0) => {
1890
- const command = 'Diff.handleMessagePort';
1891
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDiffWorker', port, command, rpcId);
1892
- };
1893
- const handleDebugScriptParsed = async script => {
1894
- await invoke$1('Run And Debug.handleScriptParsed', script);
1895
- };
1896
- const getWindowId = async () => {
1897
- return invoke$1('GetWindowId.getWindowId');
1898
- };
1899
- const getBlob = async uri => {
1900
- return invoke$1('FileSystem.getBlob', uri);
1901
- };
1902
- const getExtensionCommands = async () => {
1903
- return invoke$1('ExtensionHost.getCommands');
1904
- };
1905
- const showErrorDialog = async errorInfo => {
1906
- await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
1907
- };
1908
- const getFolderSize = async uri => {
1909
- return await invoke$1('FileSystem.getFolderSize', uri);
1910
- };
1911
- const getExtension = async id => {
1912
- return invoke$1('ExtensionManagement.getExtension', id);
1913
- };
1914
- const getMarkdownDom = async html => {
1915
- return invoke$1('Markdown.getVirtualDom', html);
1916
- };
1917
- const renderMarkdown = async (markdown, options) => {
1918
- return invoke$1('Markdown.renderMarkdown', markdown, options);
1919
- };
1920
- const openNativeFolder = async uri => {
1921
- await invoke$1('OpenNativeFolder.openNativeFolder', uri);
1922
- };
1923
- const uninstallExtension = async id => {
1924
- return invoke$1('ExtensionManagement.uninstall', id);
1925
- };
1926
- const installExtension = async id => {
1927
- return invoke$1('ExtensionManagement.install', id);
1928
- };
1929
- const minimizeWindow = async () => {
1930
- return invoke$1('ElectronWindow.minimize');
1931
- };
1932
- const unmaximizeWindow = async () => {
1933
- return invoke$1('ElectronWindow.unmaximize');
1934
- };
1935
- const maximizeWindow = async () => {
1936
- return invoke$1('ElectronWindow.maximize');
1937
- };
1938
- const showSideBar = async (id, focus) => {
1939
- return invoke$1('SideBar.show', id, focus);
1940
- };
1941
- const closeWindow = async () => {
1942
- return invoke$1('ElectronWindow.close');
1943
- };
1944
- const openExtensionSearch = async () => {
1945
- return invoke$1('SideBar.openViewlet', 'Extensions');
1946
- };
1947
- const setExtensionsSearchValue = async searchValue => {
1948
- return invoke$1('Extensions.handleInput', searchValue, Script);
1949
- };
1950
- const openExternal = async uri => {
1951
- await invoke$1('Open.openExternal', uri);
1952
- };
1953
- const openUrl = async uri => {
1954
- await invoke$1('Open.openUrl', uri);
1955
- };
1956
- const getAllPreferences = async () => {
1957
- return invoke$1('Preferences.getAll');
1958
- };
1959
- const showSaveFilePicker = async () => {
1960
- return invoke$1('FilePicker.showSaveFilePicker');
1961
- };
1962
- const getLogsDir = async () => {
1963
- return invoke$1('PlatformPaths.getLogsDir');
1964
- };
1965
- const measureTextBlockHeight = async (actualInput, fontFamily, fontSize, lineHeightPx, width) => {
1966
- return invoke$1(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
1967
- };
1968
- const refreshOutput = async () => {
1969
- await invoke$1('Output.refresh');
1970
- };
1971
- const send = async (port, sourceId = 0) => {
1972
- await sendMessagePortToOpenerWorker(port, sourceId);
1973
- };
1974
- const initializeOpenerWorker = async () => {
1975
- const rpc = await create$5({
1976
- commandMap: {},
1977
- send
1978
- });
1979
- set$5(rpc);
1980
- };
1981
- const send2 = async port => {
1982
- await sendMessagePortToEditorWorker(port, TestWorker);
1983
- };
1984
- const initializeEditorWorker = async () => {
1985
- const rpc = await create$5({
1986
- commandMap: {},
1987
- send: send2
1988
- });
1989
- set$8(rpc);
1990
- };
1991
- const send3 = port => {
1992
- return sendMessagePortToTextMeasurementWorker(port);
1993
- };
1994
- const initializeTextMeasurementWorker = async () => {
1995
- const rpc = await create$5({
1996
- commandMap: {},
1997
- send: send3
1998
- });
1999
- set$3(rpc);
2000
- };
2001
- const send4 = port => {
2002
- return sendMessagePortToTextMeasurementWorker(port);
2003
- };
2004
- const initializeProcessExplorer$1 = async () => {
2005
- const rpc = await create$5({
2006
- commandMap: {},
2007
- send: send4
2008
- });
2009
- set$4(rpc);
2010
- };
2011
-
2012
- const RendererWorker = {
2013
- __proto__: null,
2014
- activateByEvent,
2015
- applyBulkReplacement,
2016
- closeWidget,
2017
- closeWindow,
2018
- confirm,
2019
- createViewlet,
2020
- disableExtension,
2021
- dispose: dispose$2,
2022
- disposeEditor,
2023
- enableExtension,
2024
- getActiveEditorId,
2025
- getAllExtensions,
2026
- getAllPreferences,
2027
- getBadgeCounts,
2028
- getBlob,
2029
- getChromeVersion,
2030
- getColorThemeNames,
2031
- getElectronVersion,
2032
- getExtension,
2033
- getExtensionCommands,
2034
- getFileHandles,
2035
- getFileIcon,
2036
- getFilePathElectron,
2037
- getFolderIcon,
2038
- getFolderSize,
2039
- getIcons,
2040
- getKeyBindings: getKeyBindings$1,
2041
- getLogsDir,
2042
- getMarkdownDom,
2043
- getNodeVersion,
2044
- getPreference,
2045
- getRecentlyOpened,
2046
- getV8Version,
2047
- getViewletModuleId,
2048
- getWebViewSecret,
2049
- getWindowId,
2050
- getWorkspacePath,
2051
- handleDebugChange,
2052
- handleDebugPaused,
2053
- handleDebugResumed,
2054
- handleDebugScriptParsed,
2055
- handleModifiedStatusChange,
2056
- handleUriChange,
2057
- handleWorkspaceRefresh,
2058
- initializeEditorWorker,
2059
- initializeOpenerWorker,
2060
- initializeProcessExplorer: initializeProcessExplorer$1,
2061
- initializeTextMeasurementWorker,
2062
- installExtension,
2063
- invoke: invoke$1,
2064
- invokeAndTransfer,
2065
- maximizeWindow,
2066
- measureTextBlockHeight,
2067
- minimizeWindow,
2068
- openExtensionSearch,
2069
- openExternal,
2070
- openNativeFolder,
2071
- openUri,
2072
- openUrl,
2073
- openWidget,
2074
- readClipBoardText,
2075
- readFile,
2076
- refreshOutput,
2077
- registerMockRpc,
2078
- registerWebViewInterceptor,
2079
- renderMarkdown,
2080
- rerenderEditor,
2081
- resizeViewlet,
2082
- saveEditor,
2083
- searchFileFetch,
2084
- searchFileHtml,
2085
- searchFileMemory,
2086
- sendMessagePortToAuthProcess,
2087
- sendMessagePortToAuthWorker,
2088
- sendMessagePortToBlobWorker,
2089
- sendMessagePortToChatCoordinatorWorker,
2090
- sendMessagePortToChatDebugViewWorker,
2091
- sendMessagePortToChatMathWorker,
2092
- sendMessagePortToChatMessageParsingWorker,
2093
- sendMessagePortToChatNetworkWorker,
2094
- sendMessagePortToChatStorageWorker,
2095
- sendMessagePortToChatToolWorker,
2096
- sendMessagePortToChatViewModel,
2097
- sendMessagePortToClipBoardWorker,
2098
- sendMessagePortToDiffWorker,
2099
- sendMessagePortToEditorWorker,
2100
- sendMessagePortToErrorWorker: sendMessagePortToErrorWorker$1,
2101
- sendMessagePortToExtensionHostWorker,
2102
- sendMessagePortToExtensionManagementWorker,
2103
- sendMessagePortToFileSearchWorker,
2104
- sendMessagePortToFileSearchWorker2,
2105
- sendMessagePortToFileSystemProcess,
2106
- sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
2107
- sendMessagePortToIconThemeWorker,
2108
- sendMessagePortToIframeWorker,
2109
- sendMessagePortToMainAreaWorker,
2110
- sendMessagePortToMarkdownWorker,
2111
- sendMessagePortToOpenerWorker,
2112
- sendMessagePortToProcessExplorer: sendMessagePortToProcessExplorer$1,
2113
- sendMessagePortToQuickPickWorker,
2114
- sendMessagePortToRendererProcess,
2115
- sendMessagePortToSearchProcess,
2116
- sendMessagePortToSettingsWorker,
2117
- sendMessagePortToSharedProcess,
2118
- sendMessagePortToSourceControlWorker,
2119
- sendMessagePortToSyntaxHighlightingWorker,
2120
- sendMessagePortToTerminalProcess,
2121
- sendMessagePortToTextMeasurementWorker,
2122
- sendMessagePortToTextSearchWorker,
2123
- set: set$2,
2124
- setAdditionalFocus,
2125
- setColorTheme,
2126
- setExtensionsSearchValue,
2127
- setFocus,
2128
- setWebViewPort,
2129
- setWorkspacePath,
2130
- showContextMenu,
2131
- showContextMenu2,
2132
- showErrorDialog,
2133
- showMessageBox,
2134
- showPanel,
2135
- showPreview,
2136
- showSaveFilePicker,
2137
- showSideBar,
2138
- togglePanelView,
2139
- uninstallExtension,
2140
- unmaximizeWindow,
2141
- unregisterWebViewInterceptor,
2142
- writeClipBoardImage,
2143
- writeClipBoardText,
2144
- writeFile
2145
- };
2146
1595
 
2147
1596
  const debugProcess = async (state, index = state.focusedIndex) => {
2148
1597
  const process = state.visibleProcesses[index];
@@ -2188,11 +1637,9 @@ const diff2 = uid => {
2188
1637
  return diff(oldState, scheduledState);
2189
1638
  };
2190
1639
 
2191
- const processExplorerUpdateInterval = 1000;
2192
-
2193
1640
  const intervals = new Map();
2194
1641
  const pending = new Set();
2195
- const dispose$1 = uid => {
1642
+ const dispose$3 = uid => {
2196
1643
  const interval = intervals.get(uid);
2197
1644
  if (interval) {
2198
1645
  clearInterval(interval);
@@ -2202,7 +1649,7 @@ const dispose$1 = uid => {
2202
1649
  };
2203
1650
  const update = async uid => {
2204
1651
  if (!getKeys$1().includes(uid)) {
2205
- dispose$1(uid);
1652
+ dispose$3(uid);
2206
1653
  return;
2207
1654
  }
2208
1655
  if (pending.has(uid)) {
@@ -2218,7 +1665,7 @@ const update = async uid => {
2218
1665
  }
2219
1666
  };
2220
1667
  const start = (uid, interval = processExplorerUpdateInterval) => {
2221
- if (interval === 0 || intervals.has(uid)) {
1668
+ if (interval <= 0 || intervals.has(uid)) {
2222
1669
  return;
2223
1670
  }
2224
1671
  const intervalId = setInterval(() => {
@@ -2226,10 +1673,100 @@ const start = (uid, interval = processExplorerUpdateInterval) => {
2226
1673
  }, interval);
2227
1674
  intervals.set(uid, intervalId);
2228
1675
  };
1676
+ const restart = (uid, interval) => {
1677
+ dispose$3(uid);
1678
+ start(uid, interval);
1679
+ };
1680
+
1681
+ const sendMessagePortToProcessExplorer = async port => {
1682
+ await sendMessagePortToProcessExplorer$1(port);
1683
+ };
1684
+
1685
+ const launchProcessExplorerElectron = async () => {
1686
+ try {
1687
+ const rpc = await create$5({
1688
+ commandMap: {},
1689
+ send: sendMessagePortToProcessExplorer
1690
+ });
1691
+ return rpc;
1692
+ } catch (error) {
1693
+ throw new VError(error, 'Failed to create process explorer electron rpc');
1694
+ }
1695
+ };
2229
1696
 
2230
- const dispose = uid => {
2231
- dispose$1(uid);
1697
+ const launchProcessExplorerNode = async () => {
1698
+ try {
1699
+ const rpc = await create$2({
1700
+ commandMap: {},
1701
+ type: 'process-explorer'
1702
+ });
1703
+ return rpc;
1704
+ } catch (error) {
1705
+ throw new VError(error, 'Failed to create process explorer websocket rpc');
1706
+ }
1707
+ };
1708
+
1709
+ const state$1 = {
1710
+ rpc: undefined
1711
+ };
1712
+ const invoke = async (method, ...params) => {
1713
+ if (!state$1.rpc) {
1714
+ throw new Error('ProcessExplorerModule is not initialized');
1715
+ }
1716
+ return state$1.rpc.invoke(method, ...params);
1717
+ };
1718
+ const set$1 = newRpc => {
1719
+ state$1.rpc = newRpc;
1720
+ };
1721
+ const dispose$2 = async () => {
1722
+ const {
1723
+ rpc
1724
+ } = state$1;
1725
+ state$1.rpc = undefined;
1726
+ await rpc?.dispose();
1727
+ };
1728
+
1729
+ const state = {
1730
+ initializedPlatform: 0
1731
+ };
1732
+ const initializeProcessExplorer = async platform => {
1733
+ if (state.initializedPlatform === platform) {
1734
+ return;
1735
+ }
1736
+ if (platform === Electron) {
1737
+ const rpc = await launchProcessExplorerElectron();
1738
+ set$1(rpc);
1739
+ state.initializedPlatform = platform;
1740
+ return;
1741
+ }
1742
+ if (platform === Remote) {
1743
+ const rpc = await launchProcessExplorerNode();
1744
+ set$1(rpc);
1745
+ state.initializedPlatform = platform;
1746
+ }
1747
+ };
1748
+ const dispose$1 = async () => {
1749
+ state.initializedPlatform = 0;
1750
+ await dispose$2();
1751
+ };
1752
+
1753
+ const dispose = async uid => {
2232
1754
  dispose$3(uid);
1755
+ dispose$4(uid);
1756
+ if (getKeys$1().length === 0) {
1757
+ await dispose$1();
1758
+ }
1759
+ };
1760
+
1761
+ const createE2eFixtureProcess = async (state, marker) => {
1762
+ const pid = await invoke('Process.createE2eFixtureProcess', marker);
1763
+ return {
1764
+ ...state,
1765
+ rootPid: pid
1766
+ };
1767
+ };
1768
+ const disposeE2eFixtureProcess = async (_uid, pidOrMarker) => {
1769
+ await invoke('Process.disposeE2eFixtureProcess', pidOrMarker);
2233
1770
  };
2234
1771
 
2235
1772
  const expandAll = state => {
@@ -2442,7 +1979,7 @@ const handleBlur = state => {
2442
1979
  };
2443
1980
 
2444
1981
  const handleClickAt = (state, index) => {
2445
- return focusIndex(state, index);
1982
+ return focusIndex(state, Number(index));
2446
1983
  };
2447
1984
 
2448
1985
  const show2 = async (uid, menuId, x, y, args) => {
@@ -2450,25 +1987,26 @@ const show2 = async (uid, menuId, x, y, args) => {
2450
1987
  };
2451
1988
 
2452
1989
  const handleContextMenu = async (state, index = state.focusedIndex, x = 0, y = 0) => {
2453
- const process = state.visibleProcesses[index];
1990
+ const numericIndex = Number(index);
1991
+ const process = state.visibleProcesses[numericIndex];
2454
1992
  if (!process) {
2455
1993
  return state;
2456
1994
  }
2457
1995
  const newState = {
2458
1996
  ...state,
2459
1997
  focused: false,
2460
- focusedIndex: index
1998
+ focusedIndex: numericIndex
2461
1999
  };
2462
- set$a(state.uid, state, newState);
2000
+ set$6(state.uid, state, newState);
2463
2001
  await show2(state.uid, ProcessExplorer$1, x, y, {
2464
- index,
2002
+ index: numericIndex,
2465
2003
  menuId: ProcessExplorer$1
2466
2004
  });
2467
2005
  return newState;
2468
2006
  };
2469
2007
 
2470
2008
  const handleDoubleClick = (state, index = state.focusedIndex) => {
2471
- return toggleIndex(state, index);
2009
+ return toggleIndex(state, Number(index));
2472
2010
  };
2473
2011
 
2474
2012
  const handleFocus = state => {
@@ -2478,22 +2016,15 @@ const handleFocus = state => {
2478
2016
  };
2479
2017
  };
2480
2018
 
2481
- const SigTerm = 'SIGTERM';
2482
-
2483
2019
  const killProcess = async (state, index = state.focusedIndex) => {
2484
2020
  const process = state.visibleProcesses[index];
2485
2021
  if (!process) {
2486
2022
  return state;
2487
2023
  }
2488
- await invoke$1('Process.kill', process.pid, SigTerm);
2024
+ await invoke('Process.kill', process.pid);
2489
2025
  return state;
2490
2026
  };
2491
2027
 
2492
- const WindowPid = -1;
2493
- const QueryOrHashRegex = /[?#]/;
2494
- const isValidMemoryValue = value => {
2495
- return typeof value === 'number' && Number.isFinite(value) && value >= 0;
2496
- };
2497
2028
  const getMeasureMemory = () => {
2498
2029
  const {
2499
2030
  measureUserAgentSpecificMemory
@@ -2503,6 +2034,12 @@ const getMeasureMemory = () => {
2503
2034
  }
2504
2035
  return measureUserAgentSpecificMemory.bind(performance);
2505
2036
  };
2037
+
2038
+ const isValidMemoryValue = value => {
2039
+ return typeof value === 'number' && Number.isFinite(value) && value >= 0;
2040
+ };
2041
+
2042
+ const QueryOrHashRegex = /[?#]/;
2506
2043
  const getUrlName = url => {
2507
2044
  if (!url || url === 'cross-origin-url') {
2508
2045
  return url;
@@ -2517,6 +2054,7 @@ const getUrlName = url => {
2517
2054
  return parts.at(-1) || url;
2518
2055
  }
2519
2056
  };
2057
+
2520
2058
  const getAttributionName = attribution => {
2521
2059
  const scope = attribution.scope || 'memory';
2522
2060
  const url = attribution.url ? getUrlName(attribution.url) : '';
@@ -2525,6 +2063,7 @@ const getAttributionName = attribution => {
2525
2063
  }
2526
2064
  return scope;
2527
2065
  };
2066
+
2528
2067
  const getBreakdownName = (entry, index) => {
2529
2068
  if (entry.attribution && entry.attribution.length > 0) {
2530
2069
  return entry.attribution.map(getAttributionName).join(', ');
@@ -2534,6 +2073,9 @@ const getBreakdownName = (entry, index) => {
2534
2073
  }
2535
2074
  return `breakdown ${index + 1}`;
2536
2075
  };
2076
+
2077
+ const WindowPid = -1;
2078
+
2537
2079
  const toBreakdownProcess = (entry, index) => {
2538
2080
  const name = getBreakdownName(entry, index);
2539
2081
  return {
@@ -2545,6 +2087,7 @@ const toBreakdownProcess = (entry, index) => {
2545
2087
  synthetic: true
2546
2088
  };
2547
2089
  };
2090
+
2548
2091
  const getFrontendMemoryUsage = async rootPid => {
2549
2092
  const measureMemory = getMeasureMemory();
2550
2093
  if (!measureMemory) {
@@ -2570,68 +2113,6 @@ const getFrontendMemoryUsage = async rootPid => {
2570
2113
  }
2571
2114
  };
2572
2115
 
2573
- const sendMessagePortToProcessExplorer = async port => {
2574
- const rendererWorker = RendererWorker;
2575
- await rendererWorker.sendMessagePortToProcessExplorer(port);
2576
- };
2577
-
2578
- const launchProcessExplorerElectron = async () => {
2579
- try {
2580
- const rpc = await create$5({
2581
- commandMap: {},
2582
- send: sendMessagePortToProcessExplorer
2583
- });
2584
- return rpc;
2585
- } catch (error) {
2586
- throw new VError(error, 'Failed to create process explorer electron rpc');
2587
- }
2588
- };
2589
-
2590
- const launchProcessExplorerNode = async () => {
2591
- try {
2592
- const rpc = await create$2({
2593
- commandMap: {},
2594
- type: 'process-explorer'
2595
- });
2596
- return rpc;
2597
- } catch (error) {
2598
- throw new VError(error, 'Failed to create process explorer websocket rpc');
2599
- }
2600
- };
2601
-
2602
- const state$1 = {
2603
- rpc: undefined
2604
- };
2605
- const invoke = async (method, ...params) => {
2606
- if (!state$1.rpc) {
2607
- throw new Error('ProcessExplorerModule is not initialized');
2608
- }
2609
- return state$1.rpc.invoke(method, ...params);
2610
- };
2611
- const set$1 = newRpc => {
2612
- state$1.rpc = newRpc;
2613
- };
2614
-
2615
- const state = {
2616
- initializedPlatform: 0
2617
- };
2618
- const initializeProcessExplorer = async platform => {
2619
- if (state.initializedPlatform === platform) {
2620
- return;
2621
- }
2622
- if (platform === Electron) {
2623
- const rpc = await launchProcessExplorerElectron();
2624
- set$1(rpc);
2625
- state.initializedPlatform = platform;
2626
- return;
2627
- }
2628
- if (platform === Remote) {
2629
- const rpc = await launchProcessExplorerNode();
2630
- set$1(rpc);
2631
- state.initializedPlatform = platform;
2632
- }
2633
- };
2634
-
2635
2116
  const getErrorMessage = error => {
2636
2117
  if (error instanceof Error) {
2637
2118
  return error.message;
@@ -2663,9 +2144,9 @@ const refresh = async state => {
2663
2144
  try {
2664
2145
  await initializeProcessExplorer(state.platform);
2665
2146
  const includeElectronData = state.platform === Electron;
2666
- const rootPid = state.rootPid || (await invoke('ProcessId.getMainProcessId', {
2147
+ const rootPid = state.rootPid === -1 ? await invoke('ProcessId.getMainProcessId', {
2667
2148
  includeElectronData
2668
- }));
2149
+ }) : state.rootPid;
2669
2150
  const processes = await invoke('ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage', rootPid, includeElectronData);
2670
2151
  const frontendMemoryProcesses = state.includeFrontendMemoryUsage ? await getFrontendMemoryUsage(rootPid) : [];
2671
2152
  const allProcesses = [...processes, ...frontendMemoryProcesses];
@@ -2699,7 +2180,7 @@ const hasError$1 = state => {
2699
2180
  const loadContent = async state => {
2700
2181
  const newState = await refresh(state);
2701
2182
  if (!hasError$1(newState)) {
2702
- start(newState.uid);
2183
+ start(newState.uid, newState.updateInterval);
2703
2184
  }
2704
2185
  return {
2705
2186
  error: undefined,
@@ -3045,9 +2526,6 @@ const getPaddingLeft = process => {
3045
2526
  return '0';
3046
2527
  }
3047
2528
  const depthCh = (process.depth - 1) * 1.5;
3048
- if (process.flags === None$2) {
3049
- return `calc(${depthCh}ch + 17px)`;
3050
- }
3051
2529
  return `${depthCh}ch`;
3052
2530
  };
3053
2531
  const getAriaExpanded = process => {
@@ -3064,6 +2542,7 @@ const getCellDom = (className, value, index, paddingLeft) => {
3064
2542
  return [{
3065
2543
  childCount: 1,
3066
2544
  className,
2545
+ 'data-index': index,
3067
2546
  name: String(index),
3068
2547
  paddingLeft,
3069
2548
  role: GridCell,
@@ -3217,7 +2696,7 @@ const render2 = (uid, diffResult) => {
3217
2696
  oldState,
3218
2697
  scheduledState
3219
2698
  } = get$2(uid);
3220
- set$a(uid, scheduledState, scheduledState);
2699
+ set$6(uid, scheduledState, scheduledState);
3221
2700
  return applyRender(oldState, scheduledState, diffResult);
3222
2701
  };
3223
2702
 
@@ -3230,19 +2709,19 @@ const renderEventListeners = () => {
3230
2709
  params: ['handleBlur']
3231
2710
  }, {
3232
2711
  name: HandleClick,
3233
- params: ['handleClickAt', TargetName],
2712
+ params: ['handleClickAt', 'event.target.dataset.index'],
3234
2713
  preventDefault: true
3235
2714
  }, {
3236
2715
  name: HandleDoubleClick,
3237
- params: ['handleDoubleClick', TargetName],
2716
+ params: ['handleDoubleClick', 'event.target.dataset.index'],
3238
2717
  preventDefault: true
3239
2718
  }, {
3240
2719
  name: HandleContextMenu,
3241
- params: ['handleContextMenu', TargetName, ClientX, ClientY],
2720
+ params: ['handleContextMenu', 'event.target.dataset.index', ClientX, ClientY],
3242
2721
  preventDefault: true
3243
2722
  }, {
3244
2723
  name: HandlePointerDown,
3245
- params: ['handleClickAt', TargetName]
2724
+ params: ['handleClickAt', 'event.target.dataset.index']
3246
2725
  }];
3247
2726
  };
3248
2727
 
@@ -3289,12 +2768,29 @@ const setError = async (state, rawError) => {
3289
2768
  };
3290
2769
  };
3291
2770
 
2771
+ const setRootProcessId = (state, rootPid) => {
2772
+ return {
2773
+ ...state,
2774
+ rootPid
2775
+ };
2776
+ };
2777
+
2778
+ const setUpdateInterval = (state, updateInterval) => {
2779
+ restart(state.uid, updateInterval);
2780
+ return {
2781
+ ...state,
2782
+ updateInterval
2783
+ };
2784
+ };
2785
+
3292
2786
  const commandMap = {
3293
2787
  'ProcessExplorer.collapseAll': wrapCommand(collapseAll),
3294
2788
  'ProcessExplorer.create': create$d,
2789
+ 'ProcessExplorer.createE2eFixtureProcess': wrapCommand(createE2eFixtureProcess),
3295
2790
  'ProcessExplorer.debugProcess': wrapCommand(debugProcess),
3296
2791
  'ProcessExplorer.diff2': diff2,
3297
2792
  'ProcessExplorer.dispose': dispose,
2793
+ 'ProcessExplorer.disposeE2eFixtureProcess': disposeE2eFixtureProcess,
3298
2794
  'ProcessExplorer.expandAll': wrapCommand(expandAll),
3299
2795
  'ProcessExplorer.focusFirst': wrapCommand(focusFirst),
3300
2796
  'ProcessExplorer.focusLast': wrapCommand(focusLast),
@@ -3317,6 +2813,8 @@ const commandMap = {
3317
2813
  'ProcessExplorer.render2': render2,
3318
2814
  'ProcessExplorer.renderEventListeners': renderEventListeners,
3319
2815
  'ProcessExplorer.setError': wrapCommand(setError),
2816
+ 'ProcessExplorer.setRootProcessId': wrapCommand(setRootProcessId),
2817
+ 'ProcessExplorer.setUpdateInterval': wrapCommand(setUpdateInterval),
3320
2818
  'ProcessExplorer.terminate': terminate,
3321
2819
  'ProcessExplorer.update': wrapCommand(refresh)
3322
2820
  };
@@ -3339,7 +2837,7 @@ const createErrorWorkerRpc = async () => {
3339
2837
 
3340
2838
  const initializeErrorWorker = async () => {
3341
2839
  const rpc = await createErrorWorkerRpc();
3342
- set$7(rpc);
2840
+ set$4(rpc);
3343
2841
  };
3344
2842
 
3345
2843
  const sendMessagePortToFileSystemWorker = async port => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/process-explorer-worker",
3
- "version": "3.7.0",
3
+ "version": "3.10.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",