@lvce-editor/process-explorer-worker 3.18.0 → 3.20.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/index.js +25 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2376,7 +2376,7 @@ const set$1 = rpc => {
|
|
|
2376
2376
|
state.connected = true;
|
|
2377
2377
|
};
|
|
2378
2378
|
|
|
2379
|
-
const handleMessagePort = async (port, viewletCommandMap) => {
|
|
2379
|
+
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
2380
2380
|
const executeViewletCommand = async (uid, command, ...args) => {
|
|
2381
2381
|
const fn = viewletCommandMap[`ProcessExplorer.${command}`];
|
|
2382
2382
|
if (typeof fn !== 'function') {
|
|
@@ -2391,7 +2391,9 @@ const handleMessagePort = async (port, viewletCommandMap) => {
|
|
|
2391
2391
|
},
|
|
2392
2392
|
messagePort: port
|
|
2393
2393
|
});
|
|
2394
|
-
|
|
2394
|
+
if (setAsRendererProcess) {
|
|
2395
|
+
set$1(rpc);
|
|
2396
|
+
}
|
|
2395
2397
|
};
|
|
2396
2398
|
|
|
2397
2399
|
const killProcess = async (state, index = state.focusedIndex) => {
|
|
@@ -2515,6 +2517,23 @@ const prepareError = async error => {
|
|
|
2515
2517
|
}
|
|
2516
2518
|
};
|
|
2517
2519
|
|
|
2520
|
+
const conceptualChildNames = ['embeds-process', 'file-system-process', 'file-watcher-process', 'process-explorer', 'terminal-process'];
|
|
2521
|
+
const reparentSharedProcessChildren = processes => {
|
|
2522
|
+
const sharedProcess = processes.find(process => process.name === 'shared-process');
|
|
2523
|
+
if (!sharedProcess) {
|
|
2524
|
+
return processes;
|
|
2525
|
+
}
|
|
2526
|
+
return processes.map(process => {
|
|
2527
|
+
if (process.ppid === sharedProcess.pid || !conceptualChildNames.includes(process.name)) {
|
|
2528
|
+
return process;
|
|
2529
|
+
}
|
|
2530
|
+
return {
|
|
2531
|
+
...process,
|
|
2532
|
+
ppid: sharedProcess.pid
|
|
2533
|
+
};
|
|
2534
|
+
});
|
|
2535
|
+
};
|
|
2536
|
+
|
|
2518
2537
|
const getFocusedIndex = (oldFocusedIndex, visibleProcesses) => {
|
|
2519
2538
|
if (visibleProcesses.length === 0) {
|
|
2520
2539
|
return -1;
|
|
@@ -2541,7 +2560,8 @@ const refresh = async state => {
|
|
|
2541
2560
|
const processes = await listProcesses(rootPid, state.platform);
|
|
2542
2561
|
const frontendMemoryProcesses = state.includeFrontendMemoryUsage ? await getFrontendMemoryUsage(rootPid) : [];
|
|
2543
2562
|
const allProcesses = [...processes, ...frontendMemoryProcesses];
|
|
2544
|
-
const
|
|
2563
|
+
const displayedProcesses = state.platform === Electron ? reparentSharedProcessChildren(allProcesses) : allProcesses;
|
|
2564
|
+
const visibleProcesses = getVisibleProcesses(displayedProcesses, state.collapsedPids, rootPid);
|
|
2545
2565
|
return {
|
|
2546
2566
|
...state,
|
|
2547
2567
|
errorCodeFrame: '',
|
|
@@ -2549,7 +2569,7 @@ const refresh = async state => {
|
|
|
2549
2569
|
errorStack: '',
|
|
2550
2570
|
focusedIndex: getFocusedIndex(state.focusedIndex, visibleProcesses),
|
|
2551
2571
|
initial: false,
|
|
2552
|
-
processes:
|
|
2572
|
+
processes: displayedProcesses,
|
|
2553
2573
|
rootPid,
|
|
2554
2574
|
visibleProcesses
|
|
2555
2575
|
};
|
|
@@ -3208,7 +3228,7 @@ const setUpdateInterval = (state, updateInterval) => {
|
|
|
3208
3228
|
};
|
|
3209
3229
|
};
|
|
3210
3230
|
|
|
3211
|
-
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
3231
|
+
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
3212
3232
|
const commandMap = {
|
|
3213
3233
|
'ProcessExplorer.collapseAll': wrapCommand(collapseAll),
|
|
3214
3234
|
'ProcessExplorer.create': create$d,
|