@lvce-editor/process-explorer-worker 3.16.0 → 3.17.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 +89 -51
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -240,7 +240,7 @@ const {
|
|
|
240
240
|
getCommandIds,
|
|
241
241
|
getKeys: getKeys$1,
|
|
242
242
|
registerCommands,
|
|
243
|
-
set: set$
|
|
243
|
+
set: set$9,
|
|
244
244
|
wrapCommand,
|
|
245
245
|
wrapGetter,
|
|
246
246
|
wrapLoadContent
|
|
@@ -289,7 +289,7 @@ const create$d = (id, _uri, x, y, width, height, args, parentUid, platform = 0,
|
|
|
289
289
|
x,
|
|
290
290
|
y
|
|
291
291
|
};
|
|
292
|
-
set$
|
|
292
|
+
set$9(state.uid, state, state);
|
|
293
293
|
return state;
|
|
294
294
|
};
|
|
295
295
|
|
|
@@ -1268,7 +1268,7 @@ const createMockRpc = ({
|
|
|
1268
1268
|
};
|
|
1269
1269
|
|
|
1270
1270
|
const rpcs = Object.create(null);
|
|
1271
|
-
const set$
|
|
1271
|
+
const set$8 = (id, rpc) => {
|
|
1272
1272
|
rpcs[id] = rpc;
|
|
1273
1273
|
};
|
|
1274
1274
|
const get = id => {
|
|
@@ -1301,7 +1301,7 @@ const create$a = rpcId => {
|
|
|
1301
1301
|
const mockRpc = createMockRpc({
|
|
1302
1302
|
commandMap
|
|
1303
1303
|
});
|
|
1304
|
-
set$
|
|
1304
|
+
set$8(rpcId, mockRpc);
|
|
1305
1305
|
// @ts-ignore
|
|
1306
1306
|
mockRpc[Symbol.dispose] = () => {
|
|
1307
1307
|
remove(rpcId);
|
|
@@ -1310,7 +1310,7 @@ const create$a = rpcId => {
|
|
|
1310
1310
|
return mockRpc;
|
|
1311
1311
|
},
|
|
1312
1312
|
set(rpc) {
|
|
1313
|
-
set$
|
|
1313
|
+
set$8(rpcId, rpc);
|
|
1314
1314
|
}
|
|
1315
1315
|
};
|
|
1316
1316
|
};
|
|
@@ -1509,6 +1509,7 @@ const ErrorWorker = 3308;
|
|
|
1509
1509
|
const FileSystemWorker$1 = 209;
|
|
1510
1510
|
const MainProcess = -5;
|
|
1511
1511
|
const ProcessExplorerRenderer = 33;
|
|
1512
|
+
const RendererProcess = 1670;
|
|
1512
1513
|
const RendererWorker = 1;
|
|
1513
1514
|
|
|
1514
1515
|
const FocusSelector = 'Viewlet.focusSelector';
|
|
@@ -1520,39 +1521,44 @@ const Empty = 0;
|
|
|
1520
1521
|
const FocusExplorer = 13;
|
|
1521
1522
|
|
|
1522
1523
|
const {
|
|
1523
|
-
invoke: invoke$
|
|
1524
|
-
set: set$
|
|
1524
|
+
invoke: invoke$5,
|
|
1525
|
+
set: set$7
|
|
1525
1526
|
} = create$a(ErrorWorker);
|
|
1526
1527
|
const prepare = async error => {
|
|
1527
|
-
return invoke$
|
|
1528
|
+
return invoke$5('Errors.prepare', error);
|
|
1528
1529
|
};
|
|
1529
1530
|
|
|
1530
1531
|
const {
|
|
1531
|
-
set: set$
|
|
1532
|
+
set: set$6
|
|
1532
1533
|
} = create$a(FileSystemWorker$1);
|
|
1533
1534
|
|
|
1534
1535
|
const FileSystemWorker = {
|
|
1535
1536
|
__proto__: null,
|
|
1536
|
-
set: set$
|
|
1537
|
+
set: set$6
|
|
1537
1538
|
};
|
|
1538
1539
|
|
|
1539
1540
|
const {
|
|
1540
1541
|
dispose: dispose$4,
|
|
1541
|
-
invoke: invoke$
|
|
1542
|
-
set: set$
|
|
1542
|
+
invoke: invoke$4,
|
|
1543
|
+
set: set$5
|
|
1543
1544
|
} = create$a(MainProcess);
|
|
1544
1545
|
|
|
1545
1546
|
const {
|
|
1546
|
-
invoke: invoke$
|
|
1547
|
+
invoke: invoke$3,
|
|
1548
|
+
set: set$4
|
|
1549
|
+
} = create$a(RendererProcess);
|
|
1550
|
+
|
|
1551
|
+
const {
|
|
1552
|
+
invoke: invoke$2,
|
|
1547
1553
|
invokeAndTransfer,
|
|
1548
|
-
set: set$
|
|
1554
|
+
set: set$3
|
|
1549
1555
|
} = create$a(RendererWorker);
|
|
1550
1556
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1551
1557
|
number(uid);
|
|
1552
1558
|
number(menuId);
|
|
1553
1559
|
number(x);
|
|
1554
1560
|
number(y);
|
|
1555
|
-
await invoke$
|
|
1561
|
+
await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1556
1562
|
};
|
|
1557
1563
|
const sendMessagePortToErrorWorker$1 = async (port, rpcId) => {
|
|
1558
1564
|
const command = 'Errors.handleMessagePort';
|
|
@@ -1572,7 +1578,7 @@ const debugProcess = async (state, index = state.focusedIndex) => {
|
|
|
1572
1578
|
if (!process) {
|
|
1573
1579
|
return state;
|
|
1574
1580
|
}
|
|
1575
|
-
await invoke$
|
|
1581
|
+
await invoke$2('AttachDebugger.attachDebugger', process.pid);
|
|
1576
1582
|
return state;
|
|
1577
1583
|
};
|
|
1578
1584
|
|
|
@@ -1631,7 +1637,7 @@ const update = async uid => {
|
|
|
1631
1637
|
}
|
|
1632
1638
|
pending.add(uid);
|
|
1633
1639
|
try {
|
|
1634
|
-
await invoke$
|
|
1640
|
+
await invoke$2('ProcessExplorer.update');
|
|
1635
1641
|
} catch (error) {
|
|
1636
1642
|
console.error(error);
|
|
1637
1643
|
} finally {
|
|
@@ -1675,11 +1681,11 @@ const handleProcessExplorerRpcClose = async () => {
|
|
|
1675
1681
|
scheduledState
|
|
1676
1682
|
} = viewletState;
|
|
1677
1683
|
const newState = toProcessExplorerRpcClosedState(scheduledState);
|
|
1678
|
-
set$
|
|
1684
|
+
set$9(uid, oldState, newState);
|
|
1679
1685
|
didUpdate = true;
|
|
1680
1686
|
}
|
|
1681
1687
|
if (didUpdate) {
|
|
1682
|
-
await invoke$
|
|
1688
|
+
await invoke$2('ProcessExplorer.rerender');
|
|
1683
1689
|
}
|
|
1684
1690
|
};
|
|
1685
1691
|
|
|
@@ -2001,7 +2007,7 @@ const launchProcessExplorerNode = async onClose => {
|
|
|
2001
2007
|
const {
|
|
2002
2008
|
protocols,
|
|
2003
2009
|
url
|
|
2004
|
-
} = await invoke$
|
|
2010
|
+
} = await invoke$2('WebSocketCapability.create', 'process-explorer');
|
|
2005
2011
|
const webSocket = new WebSocket(url, protocols);
|
|
2006
2012
|
webSocket.addEventListener('close', onClose);
|
|
2007
2013
|
return await create$3({
|
|
@@ -2024,39 +2030,39 @@ const launchProcessExplorerNode = async onClose => {
|
|
|
2024
2030
|
}
|
|
2025
2031
|
};
|
|
2026
2032
|
|
|
2027
|
-
const state$
|
|
2033
|
+
const state$2 = {
|
|
2028
2034
|
rpc: undefined
|
|
2029
2035
|
};
|
|
2030
|
-
const invoke = async (method, ...params) => {
|
|
2031
|
-
if (!state$
|
|
2036
|
+
const invoke$1 = async (method, ...params) => {
|
|
2037
|
+
if (!state$2.rpc) {
|
|
2032
2038
|
throw new Error('ProcessExplorerModule is not initialized');
|
|
2033
2039
|
}
|
|
2034
|
-
return state$
|
|
2040
|
+
return state$2.rpc.invoke(method, ...params);
|
|
2035
2041
|
};
|
|
2036
|
-
const set$
|
|
2037
|
-
state$
|
|
2042
|
+
const set$2 = newRpc => {
|
|
2043
|
+
state$2.rpc = newRpc;
|
|
2038
2044
|
};
|
|
2039
2045
|
const clear = () => {
|
|
2040
|
-
state$
|
|
2046
|
+
state$2.rpc = undefined;
|
|
2041
2047
|
};
|
|
2042
2048
|
const dispose$2 = async () => {
|
|
2043
2049
|
const {
|
|
2044
2050
|
rpc
|
|
2045
|
-
} = state$
|
|
2046
|
-
state$
|
|
2051
|
+
} = state$2;
|
|
2052
|
+
state$2.rpc = undefined;
|
|
2047
2053
|
await rpc?.dispose();
|
|
2048
2054
|
};
|
|
2049
2055
|
|
|
2050
|
-
const state = {
|
|
2056
|
+
const state$1 = {
|
|
2051
2057
|
initializedPlatform: 0
|
|
2052
2058
|
};
|
|
2053
2059
|
const handleClose = async () => {
|
|
2054
|
-
state.initializedPlatform = 0;
|
|
2060
|
+
state$1.initializedPlatform = 0;
|
|
2055
2061
|
clear();
|
|
2056
2062
|
await handleProcessExplorerRpcClose();
|
|
2057
2063
|
};
|
|
2058
2064
|
const initializeProcessExplorer = async platform => {
|
|
2059
|
-
if (state.initializedPlatform === platform) {
|
|
2065
|
+
if (state$1.initializedPlatform === platform) {
|
|
2060
2066
|
return;
|
|
2061
2067
|
}
|
|
2062
2068
|
if (platform === Electron) {
|
|
@@ -2064,24 +2070,24 @@ const initializeProcessExplorer = async platform => {
|
|
|
2064
2070
|
mainProcessRpc,
|
|
2065
2071
|
processExplorerRpc
|
|
2066
2072
|
} = await launchProcessExplorerElectron();
|
|
2067
|
-
set$
|
|
2068
|
-
set$
|
|
2069
|
-
state.initializedPlatform = platform;
|
|
2073
|
+
set$5(mainProcessRpc);
|
|
2074
|
+
set$2(processExplorerRpc);
|
|
2075
|
+
state$1.initializedPlatform = platform;
|
|
2070
2076
|
return;
|
|
2071
2077
|
}
|
|
2072
2078
|
if (platform === Remote) {
|
|
2073
2079
|
const rpc = await launchProcessExplorerNode(() => {
|
|
2074
2080
|
void handleClose();
|
|
2075
2081
|
});
|
|
2076
|
-
set$
|
|
2077
|
-
state.initializedPlatform = platform;
|
|
2082
|
+
set$2(rpc);
|
|
2083
|
+
state$1.initializedPlatform = platform;
|
|
2078
2084
|
}
|
|
2079
2085
|
};
|
|
2080
2086
|
const dispose$1 = async () => {
|
|
2081
2087
|
const {
|
|
2082
2088
|
initializedPlatform
|
|
2083
|
-
} = state;
|
|
2084
|
-
state.initializedPlatform = 0;
|
|
2089
|
+
} = state$1;
|
|
2090
|
+
state$1.initializedPlatform = 0;
|
|
2085
2091
|
if (initializedPlatform === Electron) {
|
|
2086
2092
|
await Promise.all([dispose$4(), dispose$2()]);
|
|
2087
2093
|
return;
|
|
@@ -2098,14 +2104,14 @@ const dispose = async uid => {
|
|
|
2098
2104
|
};
|
|
2099
2105
|
|
|
2100
2106
|
const createE2eFixtureProcess = async (state, marker) => {
|
|
2101
|
-
const pid = await invoke('Process.createE2eFixtureProcess', marker);
|
|
2107
|
+
const pid = await invoke$1('Process.createE2eFixtureProcess', marker);
|
|
2102
2108
|
return {
|
|
2103
2109
|
...state,
|
|
2104
2110
|
rootPid: pid
|
|
2105
2111
|
};
|
|
2106
2112
|
};
|
|
2107
2113
|
const disposeE2eFixtureProcess = async (_uid, pidOrMarker) => {
|
|
2108
|
-
await invoke('Process.disposeE2eFixtureProcess', pidOrMarker);
|
|
2114
|
+
await invoke$1('Process.disposeE2eFixtureProcess', pidOrMarker);
|
|
2109
2115
|
};
|
|
2110
2116
|
|
|
2111
2117
|
const expandAll = state => {
|
|
@@ -2336,7 +2342,7 @@ const handleContextMenu = async (state, index = state.focusedIndex, x = 0, y = 0
|
|
|
2336
2342
|
focused: false,
|
|
2337
2343
|
focusedIndex: numericIndex
|
|
2338
2344
|
};
|
|
2339
|
-
set$
|
|
2345
|
+
set$9(state.uid, state, newState);
|
|
2340
2346
|
await show2(state.uid, ProcessExplorer$1, x, y, {
|
|
2341
2347
|
index: numericIndex,
|
|
2342
2348
|
menuId: ProcessExplorer$1
|
|
@@ -2355,12 +2361,35 @@ const handleFocus = state => {
|
|
|
2355
2361
|
};
|
|
2356
2362
|
};
|
|
2357
2363
|
|
|
2364
|
+
const state = {
|
|
2365
|
+
connected: false
|
|
2366
|
+
};
|
|
2367
|
+
const isConnected = () => {
|
|
2368
|
+
const {
|
|
2369
|
+
connected
|
|
2370
|
+
} = state;
|
|
2371
|
+
return connected;
|
|
2372
|
+
};
|
|
2373
|
+
const invoke = (method, ...params) => invoke$3(method, ...params);
|
|
2374
|
+
const set$1 = rpc => {
|
|
2375
|
+
set$4(rpc);
|
|
2376
|
+
state.connected = true;
|
|
2377
|
+
};
|
|
2378
|
+
|
|
2379
|
+
const handleMessagePort = async port => {
|
|
2380
|
+
const rpc = await create$6({
|
|
2381
|
+
commandMap: {},
|
|
2382
|
+
messagePort: port
|
|
2383
|
+
});
|
|
2384
|
+
set$1(rpc);
|
|
2385
|
+
};
|
|
2386
|
+
|
|
2358
2387
|
const killProcess = async (state, index = state.focusedIndex) => {
|
|
2359
2388
|
const process = state.visibleProcesses[index];
|
|
2360
2389
|
if (!process) {
|
|
2361
2390
|
return state;
|
|
2362
2391
|
}
|
|
2363
|
-
const killPromise = invoke('Process.kill', process.pid);
|
|
2392
|
+
const killPromise = invoke$1('Process.kill', process.pid);
|
|
2364
2393
|
if (process.name === 'process-explorer') {
|
|
2365
2394
|
dispose$3(state.uid);
|
|
2366
2395
|
void killPromise.catch(() => {});
|
|
@@ -2487,16 +2516,16 @@ const getFocusedIndex = (oldFocusedIndex, visibleProcesses) => {
|
|
|
2487
2516
|
};
|
|
2488
2517
|
const listProcesses = async (rootPid, platform) => {
|
|
2489
2518
|
if (platform === Electron) {
|
|
2490
|
-
const pidMap = await invoke$
|
|
2491
|
-
return invoke('ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage', rootPid, false, pidMap);
|
|
2519
|
+
const pidMap = await invoke$4('CreatePidMap.createPidMap');
|
|
2520
|
+
return invoke$1('ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage', rootPid, false, pidMap);
|
|
2492
2521
|
}
|
|
2493
|
-
return invoke('ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage', rootPid, false);
|
|
2522
|
+
return invoke$1('ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage', rootPid, false);
|
|
2494
2523
|
};
|
|
2495
2524
|
const refresh = async state => {
|
|
2496
2525
|
try {
|
|
2497
2526
|
await initializeProcessExplorer(state.platform);
|
|
2498
2527
|
const includeElectronData = state.platform === Electron;
|
|
2499
|
-
const rootPid = state.rootPid === -1 ? await invoke('ProcessId.getMainProcessId', {
|
|
2528
|
+
const rootPid = state.rootPid === -1 ? await invoke$1('ProcessId.getMainProcessId', {
|
|
2500
2529
|
includeElectronData
|
|
2501
2530
|
}) : state.rootPid;
|
|
2502
2531
|
const processes = await listProcesses(rootPid, state.platform);
|
|
@@ -3070,8 +3099,16 @@ const render2 = (uid, diffResult) => {
|
|
|
3070
3099
|
oldState,
|
|
3071
3100
|
scheduledState
|
|
3072
3101
|
} = get$2(uid);
|
|
3073
|
-
set$
|
|
3074
|
-
|
|
3102
|
+
set$9(uid, scheduledState, scheduledState);
|
|
3103
|
+
const commands = applyRender(oldState, scheduledState, diffResult);
|
|
3104
|
+
if (!isConnected()) return commands;
|
|
3105
|
+
return renderDirect(uid, commands);
|
|
3106
|
+
};
|
|
3107
|
+
const renderDirect = async (uid, commands) => {
|
|
3108
|
+
const rendererWorkerCommands = commands.filter(command => command[0] === 'Viewlet.setFocusContext');
|
|
3109
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== 'Viewlet.setFocusContext');
|
|
3110
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
3111
|
+
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
3075
3112
|
};
|
|
3076
3113
|
|
|
3077
3114
|
const renderEventListeners = () => {
|
|
@@ -3185,6 +3222,7 @@ const commandMap = {
|
|
|
3185
3222
|
'ProcessExplorer.handleContextMenu': wrapCommand(handleContextMenu),
|
|
3186
3223
|
'ProcessExplorer.handleDoubleClick': wrapCommand(handleDoubleClick),
|
|
3187
3224
|
'ProcessExplorer.handleFocus': wrapCommand(handleFocus),
|
|
3225
|
+
'ProcessExplorer.handleMessagePort': handleMessagePort,
|
|
3188
3226
|
'ProcessExplorer.killProcess': wrapCommand(killProcess),
|
|
3189
3227
|
'ProcessExplorer.loadContent': wrapLoadContent(loadContent),
|
|
3190
3228
|
'ProcessExplorer.refresh': wrapCommand(refresh),
|
|
@@ -3216,7 +3254,7 @@ const createErrorWorkerRpc = async () => {
|
|
|
3216
3254
|
|
|
3217
3255
|
const initializeErrorWorker = async () => {
|
|
3218
3256
|
const rpc = await createErrorWorkerRpc();
|
|
3219
|
-
set$
|
|
3257
|
+
set$7(rpc);
|
|
3220
3258
|
};
|
|
3221
3259
|
|
|
3222
3260
|
const sendMessagePortToFileSystemWorker = async port => {
|
|
@@ -3248,7 +3286,7 @@ const initializeRendererWorker = async () => {
|
|
|
3248
3286
|
const rpc = await create({
|
|
3249
3287
|
commandMap: commandMap
|
|
3250
3288
|
});
|
|
3251
|
-
set$
|
|
3289
|
+
set$3(rpc);
|
|
3252
3290
|
};
|
|
3253
3291
|
|
|
3254
3292
|
const listen = async () => {
|