@lvce-editor/process-explorer 3.14.0 → 3.16.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/README.md +5 -0
- package/dist/configuredProcessNames.json +6 -0
- package/dist/index.js +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
# Lvce Editor Process Explorer
|
|
2
2
|
|
|
3
3
|
Process Explorer.
|
|
4
|
+
|
|
5
|
+
Friendly names for executable paths can be added to
|
|
6
|
+
`packages/process-explorer/src/parts/ConfiguredProcessNames/configuredProcessNames.json`.
|
|
7
|
+
Each entry contains a `pathRegex` matched against the full process command and the
|
|
8
|
+
`displayName` shown in Process Explorer.
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import require$$2 from 'util';
|
|
|
14
14
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
15
15
|
import { readFile } from 'node:fs/promises';
|
|
16
16
|
import { join } from 'node:path';
|
|
17
|
+
import { readFileSync } from 'node:fs';
|
|
17
18
|
|
|
18
19
|
const normalizeLine = line => {
|
|
19
20
|
if (line.startsWith('Error: ')) {
|
|
@@ -6151,6 +6152,20 @@ const getProcessList = async (rootPid, flags) => {
|
|
|
6151
6152
|
return promise;
|
|
6152
6153
|
};
|
|
6153
6154
|
|
|
6155
|
+
const configuredProcessNames = JSON.parse(readFileSync(new URL('configuredProcessNames.json', import.meta.url), 'utf8'));
|
|
6156
|
+
const compiledProcessNames = configuredProcessNames.map(({
|
|
6157
|
+
displayName,
|
|
6158
|
+
pathRegex
|
|
6159
|
+
}) => ({
|
|
6160
|
+
displayName,
|
|
6161
|
+
pathRegex: new RegExp(pathRegex)
|
|
6162
|
+
}));
|
|
6163
|
+
const getConfiguredProcessName = cmd => {
|
|
6164
|
+
return compiledProcessNames.find(({
|
|
6165
|
+
pathRegex
|
|
6166
|
+
}) => pathRegex.test(cmd))?.displayName || '';
|
|
6167
|
+
};
|
|
6168
|
+
|
|
6154
6169
|
const fallbackProcessNamePatterns = [{
|
|
6155
6170
|
matches: cmd => cmd.includes('--type=renderer'),
|
|
6156
6171
|
name: 'renderer'
|
|
@@ -6232,6 +6247,10 @@ const getName = (pid, cmd, rootPid, pidMap) => {
|
|
|
6232
6247
|
if (patternName) {
|
|
6233
6248
|
return patternName;
|
|
6234
6249
|
}
|
|
6250
|
+
const configuredProcessName = getConfiguredProcessName(cmd);
|
|
6251
|
+
if (configuredProcessName) {
|
|
6252
|
+
return configuredProcessName;
|
|
6253
|
+
}
|
|
6235
6254
|
if (pid in pidMap) {
|
|
6236
6255
|
return pidMap[pid] || '<unknown>';
|
|
6237
6256
|
}
|