@lvce-editor/shared-process 0.25.12 → 0.26.1
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/package.json +4 -4
- package/src/parts/ConnectIpcToElectron/ConnectIpcToElectron.js +8 -0
- package/src/parts/ContentSecurityPolicyEmbedsWorker/ContentSecurityPolicyEmbedsWorker.js +2 -0
- package/src/parts/EmbedsProcess/EmbedsProcess.js +22 -0
- package/src/parts/EmbedsProcessPath/EmbedsProcessPath.js +3 -0
- package/src/parts/GetHeaders/GetHeaders.js +4 -0
- package/src/parts/GetHeadersEmbedsWorker/GetHeadersEmbedsWorker.js +9 -0
- package/src/parts/GetPortTuple/GetPortTuple.js +6 -0
- package/src/parts/HandleElectronMessagePort/HandleElectronMessagePort.js +7 -0
- package/src/parts/HandleIpc/HandleIpc.js +2 -20
- package/src/parts/HandleMessage/HandleMessage.js +16 -0
- package/src/parts/HandleMessagePortForEmbedsProcess/HandleMessagePortForEmbedsProcess.ipc.js +5 -0
- package/src/parts/HandleMessagePortForEmbedsProcess/HandleMessagePortForEmbedsProcess.js +8 -0
- package/src/parts/HandleMessagePortForProcessExplorer/HandleMessagePortForProcessExplorer.ipc.js +5 -0
- package/src/parts/HandleMessagePortForProcessExplorer/HandleMessagePortForProcessExplorer.js +8 -0
- package/src/parts/HandleMessagePortForSearchProcess/HandleMessagePortForSearchProcess.ipc.js +5 -0
- package/src/parts/HandleMessagePortForSearchProcess/HandleMessagePortForSearchProcess.js +8 -0
- package/src/parts/IpcChildWithElectronMessagePort/IpcChildWithElectronMessagePort.js +3 -0
- package/src/parts/IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js +8 -3
- package/src/parts/LaunchEmbedsProcess/LaunchEmbedsProcess.js +17 -0
- package/src/parts/LaunchProcessExplorer/LaunchProcessExplorer.js +17 -0
- package/src/parts/LaunchPtyHost/LaunchPtyHost.js +37 -0
- package/src/parts/LaunchSearchProcess/LaunchSearchProcess.js +15 -0
- package/src/parts/Module/Module.js +6 -16
- package/src/parts/ModuleId/ModuleId.js +3 -7
- package/src/parts/ModuleMap/ModuleMap.js +6 -50
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/ProcessExplorer/ProcessExplorer.js +13 -0
- package/src/parts/ProcessExplorerPath/ProcessExplorerPath.js +3 -0
- package/src/parts/PtyHost/PtyHost.js +2 -36
- package/src/parts/SearchProcess/SearchProcess.js +18 -0
- package/src/parts/SearchProcessPath/SearchProcessPath.js +3 -0
- package/src/parts/TemporaryMessagePort/TemporaryMessagePort.js +17 -0
- package/src/parts/AddAccurateMemoryUsage/AddAccurateMemoryUsage.js +0 -8
- package/src/parts/CreatePidMap/CreatePidMap.js +0 -5
- package/src/parts/ElectronBrowserView/ElectronBrowserView.ipc.js +0 -6
- package/src/parts/ElectronBrowserView/ElectronBrowserView.js +0 -21
- package/src/parts/ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.ipc.js +0 -18
- package/src/parts/ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.js +0 -35
- package/src/parts/ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js +0 -15
- package/src/parts/ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.ipc.js +0 -6
- package/src/parts/ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.js +0 -7
- package/src/parts/ElectronBrowserViewState/ElectronBrowserViewState.js +0 -12
- package/src/parts/ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.ipc.js +0 -7
- package/src/parts/ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.js +0 -10
- package/src/parts/ElectronWebContents/ElectronWebContents.ipc.js +0 -12
- package/src/parts/ElectronWebContents/ElectronWebContents.js +0 -61
- package/src/parts/ElectronWebContentsView/ElectronWebContentsView.ipc.js +0 -6
- package/src/parts/ElectronWebContentsView/ElectronWebContentsView.js +0 -18
- package/src/parts/ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.ipc.js +0 -18
- package/src/parts/ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.js +0 -35
- package/src/parts/GetAccurateMemoryUsage/GetAccurateMemoryUsage.js +0 -39
- package/src/parts/GetPsOutput/GetPsOutput.js +0 -18
- package/src/parts/ListProcessGetName/ListProcessGetName.js +0 -56
- package/src/parts/ListProcessesWithMemoryUsage/ListProcessesWithMemoryUsage.ipc.js +0 -5
- package/src/parts/ListProcessesWithMemoryUsage/ListProcessesWithMemoryUsage.js +0 -11
- package/src/parts/ListProcessesWithMemoryUsageUnix/ListProcessesWithMemoryUsageUnix.js +0 -20
- package/src/parts/ListProcessesWithMemoryUsageWindows/ListProcessesWithMemoryUsageWindows.js +0 -48
- package/src/parts/LoadWindowsProcessTree/LoadWindowsProcessTree.js +0 -13
- package/src/parts/ParseMemory/ParseMemory.js +0 -10
- package/src/parts/ParsePsOutput/ParsePsOutput.js +0 -47
- package/src/parts/WindowsProcessTree/WindowsProcessTree.js +0 -26
- package/src/parts/WindowsProcessTreeDataFlag/WindowsProcessTreeDataFlag.js +0 -3
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// parse ps output based on vscode https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/node/ps.ts (License MIT)
|
|
2
|
-
import * as Assert from '../Assert/Assert.js';
|
|
3
|
-
import * as Character from '../Character/Character.js';
|
|
4
|
-
import * as ListProcessGetName from '../ListProcessGetName/ListProcessGetName.js';
|
|
5
|
-
import * as SplitLines from '../SplitLines/SplitLines.js';
|
|
6
|
-
const PID_CMD = /^\s*(\d+)\s+(\d+)\s+([\d.]+)\s+([\d.]+)\s+(.+)$/s;
|
|
7
|
-
const parsePsOutputLine = (line) => {
|
|
8
|
-
Assert.string(line);
|
|
9
|
-
const matches = PID_CMD.exec(line.trim());
|
|
10
|
-
if (matches && matches.length === 6) {
|
|
11
|
-
return {
|
|
12
|
-
pid: Number.parseInt(matches[1]),
|
|
13
|
-
ppid: Number.parseInt(matches[2]),
|
|
14
|
-
cmd: matches[5],
|
|
15
|
-
// load: parseInt(matches[3]),
|
|
16
|
-
// mem: parseInt(matches[4]),
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
throw new Error(`line could not be parsed: ${line}`);
|
|
20
|
-
};
|
|
21
|
-
export const parsePsOutput = (stdout, rootPid, pidMap) => {
|
|
22
|
-
Assert.string(stdout);
|
|
23
|
-
Assert.number(rootPid);
|
|
24
|
-
Assert.object(pidMap);
|
|
25
|
-
if (stdout === Character.EmptyString) {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
const lines = SplitLines.splitLines(stdout);
|
|
29
|
-
const result = [];
|
|
30
|
-
const depthMap = Object.create(null);
|
|
31
|
-
depthMap[rootPid] = 1;
|
|
32
|
-
const parsedLines = lines.map(parsePsOutputLine);
|
|
33
|
-
for (const parsedLine of parsedLines) {
|
|
34
|
-
const { pid, ppid, cmd } = parsedLine;
|
|
35
|
-
const depth = pid === rootPid ? 1 : depthMap[ppid];
|
|
36
|
-
if (!depth) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
result.push({
|
|
40
|
-
...parsedLine,
|
|
41
|
-
depth,
|
|
42
|
-
name: ListProcessGetName.getName(pid, cmd, rootPid, pidMap),
|
|
43
|
-
});
|
|
44
|
-
depthMap[pid] = depth + 1;
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import * as LoadWindowsProcessTree from '../LoadWindowsProcessTree/LoadWindowsProcessTree.js';
|
|
3
|
-
import * as Promises from '../Promises/Promises.js';
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param {number} rootPid
|
|
7
|
-
* @param {WindowsProcessTree.ProcessDataFlag} flags
|
|
8
|
-
* @returns {Promise<WindowsProcessTree.IProcessInfo[] | undefined>}
|
|
9
|
-
*/
|
|
10
|
-
export const getProcessList = async (rootPid, flags) => {
|
|
11
|
-
const WindowsProcessTree = await LoadWindowsProcessTree.loadWindowProcessTree();
|
|
12
|
-
const { resolve, promise } = Promises.withResolvers();
|
|
13
|
-
WindowsProcessTree.getProcessList(rootPid, resolve, flags);
|
|
14
|
-
return promise;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {WindowsProcessTree.IProcessInfo[]} processList
|
|
19
|
-
* @returns Promise< WindowsProcessTree.IProcessCpuInfo[]>
|
|
20
|
-
*/
|
|
21
|
-
export const addCpuUsage = async (processList) => {
|
|
22
|
-
const WindowsProcessTree = await LoadWindowsProcessTree.loadWindowProcessTree();
|
|
23
|
-
const { resolve, promise } = Promises.withResolvers();
|
|
24
|
-
WindowsProcessTree.getProcessCpuUsage(processList, resolve);
|
|
25
|
-
return promise;
|
|
26
|
-
};
|