@lvce-editor/process-explorer-worker 3.10.0 → 3.12.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/index.js +775 -409
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3,8 +3,28 @@ const toCommandId = key => {
|
|
|
3
3
|
return key.slice(dotIndex + 1);
|
|
4
4
|
};
|
|
5
5
|
const create$e = () => {
|
|
6
|
+
const generations = Object.create(null);
|
|
6
7
|
const states = Object.create(null);
|
|
7
8
|
const commandMapRef = {};
|
|
9
|
+
const getGeneration = uid => generations[uid] || 0;
|
|
10
|
+
const isCurrentGeneration = (uid, generation) => {
|
|
11
|
+
return states[uid] !== undefined && getGeneration(uid) === generation;
|
|
12
|
+
};
|
|
13
|
+
const updateState = (uid, generation, fallbackState, updater) => {
|
|
14
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
15
|
+
return Promise.resolve(fallbackState);
|
|
16
|
+
}
|
|
17
|
+
const current = states[uid];
|
|
18
|
+
const updatedState = updater(current.newState);
|
|
19
|
+
if (updatedState !== current.newState) {
|
|
20
|
+
states[uid] = {
|
|
21
|
+
newState: updatedState,
|
|
22
|
+
oldState: current.oldState,
|
|
23
|
+
scheduledState: updatedState
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return Promise.resolve(updatedState);
|
|
27
|
+
};
|
|
8
28
|
return {
|
|
9
29
|
clear() {
|
|
10
30
|
for (const key of Object.keys(states)) {
|
|
@@ -43,14 +63,39 @@ const create$e = () => {
|
|
|
43
63
|
Object.assign(commandMapRef, commandMap);
|
|
44
64
|
},
|
|
45
65
|
set(uid, oldState, newState, scheduledState) {
|
|
66
|
+
const current = states[uid];
|
|
67
|
+
if (!current || oldState === newState && newState !== current.newState) {
|
|
68
|
+
generations[uid] = getGeneration(uid) + 1;
|
|
69
|
+
}
|
|
46
70
|
states[uid] = {
|
|
47
71
|
newState,
|
|
48
72
|
oldState,
|
|
49
73
|
scheduledState: scheduledState ?? newState
|
|
50
74
|
};
|
|
51
75
|
},
|
|
76
|
+
wrapAsyncCommand(fn) {
|
|
77
|
+
const wrapped = async (uid, ...args) => {
|
|
78
|
+
const generation = getGeneration(uid);
|
|
79
|
+
let latestState = states[uid].newState;
|
|
80
|
+
const context = {
|
|
81
|
+
getState: () => {
|
|
82
|
+
if (isCurrentGeneration(uid, generation)) {
|
|
83
|
+
latestState = states[uid].newState;
|
|
84
|
+
}
|
|
85
|
+
return latestState;
|
|
86
|
+
},
|
|
87
|
+
updateState: async updater => {
|
|
88
|
+
latestState = await updateState(uid, generation, latestState, updater);
|
|
89
|
+
return latestState;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
await fn(context, ...args);
|
|
93
|
+
};
|
|
94
|
+
return wrapped;
|
|
95
|
+
},
|
|
52
96
|
wrapCommand(fn) {
|
|
53
97
|
const wrapped = async (uid, ...args) => {
|
|
98
|
+
const generation = getGeneration(uid);
|
|
54
99
|
const {
|
|
55
100
|
newState,
|
|
56
101
|
oldState
|
|
@@ -59,6 +104,9 @@ const create$e = () => {
|
|
|
59
104
|
if (oldState === newerState || newState === newerState) {
|
|
60
105
|
return;
|
|
61
106
|
}
|
|
107
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
62
110
|
const latestOld = states[uid];
|
|
63
111
|
const latestNew = {
|
|
64
112
|
...latestOld.newState,
|
|
@@ -83,6 +131,7 @@ const create$e = () => {
|
|
|
83
131
|
},
|
|
84
132
|
wrapLoadContent(fn) {
|
|
85
133
|
const wrapped = async (uid, ...args) => {
|
|
134
|
+
const generation = getGeneration(uid);
|
|
86
135
|
const {
|
|
87
136
|
newState,
|
|
88
137
|
oldState
|
|
@@ -97,6 +146,11 @@ const create$e = () => {
|
|
|
97
146
|
error
|
|
98
147
|
};
|
|
99
148
|
}
|
|
149
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
150
|
+
return {
|
|
151
|
+
error
|
|
152
|
+
};
|
|
153
|
+
}
|
|
100
154
|
const latestOld = states[uid];
|
|
101
155
|
const latestNew = {
|
|
102
156
|
...latestOld.newState,
|
|
@@ -181,12 +235,12 @@ const collapseAll = state => {
|
|
|
181
235
|
};
|
|
182
236
|
|
|
183
237
|
const {
|
|
184
|
-
dispose: dispose$
|
|
238
|
+
dispose: dispose$5,
|
|
185
239
|
get: get$2,
|
|
186
240
|
getCommandIds,
|
|
187
241
|
getKeys: getKeys$1,
|
|
188
242
|
registerCommands,
|
|
189
|
-
set: set$
|
|
243
|
+
set: set$7,
|
|
190
244
|
wrapCommand,
|
|
191
245
|
wrapGetter,
|
|
192
246
|
wrapLoadContent
|
|
@@ -235,7 +289,7 @@ const create$d = (id, _uri, x, y, width, height, args, parentUid, platform = 0,
|
|
|
235
289
|
x,
|
|
236
290
|
y
|
|
237
291
|
};
|
|
238
|
-
set$
|
|
292
|
+
set$7(state.uid, state, state);
|
|
239
293
|
return state;
|
|
240
294
|
};
|
|
241
295
|
|
|
@@ -380,7 +434,6 @@ const walkValue = (value, transferrables, isTransferrable) => {
|
|
|
380
434
|
for (const property of Object.values(value)) {
|
|
381
435
|
walkValue(property, transferrables, isTransferrable);
|
|
382
436
|
}
|
|
383
|
-
return;
|
|
384
437
|
}
|
|
385
438
|
};
|
|
386
439
|
const getTransferrables = value => {
|
|
@@ -534,7 +587,14 @@ class IpcError extends VError {
|
|
|
534
587
|
const cause = new Error(message);
|
|
535
588
|
// @ts-ignore
|
|
536
589
|
cause.code = code;
|
|
537
|
-
|
|
590
|
+
if (stack) {
|
|
591
|
+
Object.defineProperty(cause, 'stack', {
|
|
592
|
+
configurable: true,
|
|
593
|
+
enumerable: false,
|
|
594
|
+
value: stack,
|
|
595
|
+
writable: true
|
|
596
|
+
});
|
|
597
|
+
}
|
|
538
598
|
super(cause, betterMessage);
|
|
539
599
|
} else {
|
|
540
600
|
super(betterMessage);
|
|
@@ -884,7 +944,10 @@ const constructError = (message, type, name) => {
|
|
|
884
944
|
if (ErrorConstructor === Error) {
|
|
885
945
|
const error = new Error(message);
|
|
886
946
|
if (name && name !== 'VError') {
|
|
887
|
-
error
|
|
947
|
+
Object.defineProperty(error, 'name', {
|
|
948
|
+
configurable: true,
|
|
949
|
+
value: name
|
|
950
|
+
});
|
|
888
951
|
}
|
|
889
952
|
return error;
|
|
890
953
|
}
|
|
@@ -915,31 +978,45 @@ const getParentStack = error => {
|
|
|
915
978
|
};
|
|
916
979
|
const MethodNotFound = -32601;
|
|
917
980
|
const Custom = -32001;
|
|
981
|
+
const setStack = (error, stack) => {
|
|
982
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
|
|
983
|
+
if (descriptor) {
|
|
984
|
+
if (!descriptor.configurable && !descriptor.writable) {
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
if (!descriptor.configurable && descriptor.writable) {
|
|
988
|
+
error.stack = stack;
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
Object.defineProperty(error, 'stack', {
|
|
993
|
+
configurable: true,
|
|
994
|
+
value: stack,
|
|
995
|
+
writable: true
|
|
996
|
+
});
|
|
997
|
+
};
|
|
918
998
|
const restoreExistingError = (error, currentStack) => {
|
|
919
999
|
if (typeof error.stack === 'string') {
|
|
920
|
-
error
|
|
1000
|
+
setStack(error, `${error.stack}${NewLine}${currentStack}`);
|
|
921
1001
|
}
|
|
922
1002
|
return error;
|
|
923
1003
|
};
|
|
924
1004
|
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
925
1005
|
const restoredError = new JsonRpcError(error.message);
|
|
926
1006
|
const parentStack = getParentStack(error);
|
|
927
|
-
restoredError
|
|
1007
|
+
setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
|
|
928
1008
|
return restoredError;
|
|
929
1009
|
};
|
|
930
1010
|
const restoreStackFromData = (restoredError, error, currentStack) => {
|
|
931
1011
|
if (error.data.stack && error.data.type && error.message) {
|
|
932
|
-
restoredError
|
|
1012
|
+
setStack(restoredError, `${error.data.type}: ${error.message}${NewLine}${error.data.stack}${NewLine}${currentStack}`);
|
|
933
1013
|
return;
|
|
934
1014
|
}
|
|
935
1015
|
if (error.data.stack) {
|
|
936
|
-
restoredError
|
|
1016
|
+
setStack(restoredError, error.data.stack);
|
|
937
1017
|
}
|
|
938
1018
|
};
|
|
939
1019
|
const applyDataProperties = (restoredError, error) => {
|
|
940
|
-
if (!error.data) {
|
|
941
|
-
return;
|
|
942
|
-
}
|
|
943
1020
|
restoreStackFromData(restoredError, error, getCurrentStack());
|
|
944
1021
|
if (error.data.codeFrame) {
|
|
945
1022
|
// @ts-ignore
|
|
@@ -960,7 +1037,7 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
960
1037
|
const indexNewLine = getNewLineIndex(lowerStack);
|
|
961
1038
|
const parentStack = getParentStack(error);
|
|
962
1039
|
// @ts-ignore
|
|
963
|
-
restoredError
|
|
1040
|
+
setStack(restoredError, `${parentStack}${lowerStack.slice(indexNewLine)}`);
|
|
964
1041
|
}
|
|
965
1042
|
if (error.codeFrame) {
|
|
966
1043
|
// @ts-ignore
|
|
@@ -1170,128 +1247,564 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
1170
1247
|
throw new JsonRpcError('unexpected message');
|
|
1171
1248
|
};
|
|
1172
1249
|
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
method,
|
|
1179
|
-
|
|
1250
|
+
const createMockRpc = ({
|
|
1251
|
+
commandMap
|
|
1252
|
+
}) => {
|
|
1253
|
+
const invocations = [];
|
|
1254
|
+
const invoke = (method, ...params) => {
|
|
1255
|
+
invocations.push([method, ...params]);
|
|
1256
|
+
const command = commandMap[method];
|
|
1257
|
+
if (!command) {
|
|
1258
|
+
throw new Error(`command ${method} not found`);
|
|
1259
|
+
}
|
|
1260
|
+
return command(...params);
|
|
1180
1261
|
};
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
id,
|
|
1186
|
-
jsonrpc: Two,
|
|
1187
|
-
method,
|
|
1188
|
-
params
|
|
1262
|
+
const mockRpc = {
|
|
1263
|
+
invocations,
|
|
1264
|
+
invoke,
|
|
1265
|
+
invokeAndTransfer: invoke
|
|
1189
1266
|
};
|
|
1190
|
-
return
|
|
1267
|
+
return mockRpc;
|
|
1191
1268
|
};
|
|
1192
1269
|
|
|
1193
|
-
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1270
|
+
const rpcs = Object.create(null);
|
|
1271
|
+
const set$6 = (id, rpc) => {
|
|
1272
|
+
rpcs[id] = rpc;
|
|
1196
1273
|
};
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
const id = create$8();
|
|
1200
|
-
const {
|
|
1201
|
-
promise,
|
|
1202
|
-
resolve
|
|
1203
|
-
} = Promise.withResolvers();
|
|
1204
|
-
map[id] = resolve;
|
|
1205
|
-
return {
|
|
1206
|
-
id,
|
|
1207
|
-
promise
|
|
1208
|
-
};
|
|
1274
|
+
const get = id => {
|
|
1275
|
+
return rpcs[id];
|
|
1209
1276
|
};
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
const {
|
|
1213
|
-
id,
|
|
1214
|
-
promise
|
|
1215
|
-
} = registerPromise(callbacks);
|
|
1216
|
-
const message = create$9(id, method, params);
|
|
1217
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1218
|
-
ipc.sendAndTransfer(message);
|
|
1219
|
-
} else {
|
|
1220
|
-
ipc.send(message);
|
|
1221
|
-
}
|
|
1222
|
-
const responseMessage = await promise;
|
|
1223
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
1277
|
+
const remove = id => {
|
|
1278
|
+
delete rpcs[id];
|
|
1224
1279
|
};
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
if (!fn) {
|
|
1230
|
-
console.warn(`callback ${id} may already be disposed`);
|
|
1231
|
-
return;
|
|
1232
|
-
}
|
|
1233
|
-
fn(response);
|
|
1234
|
-
delete callbacks[id];
|
|
1235
|
-
};
|
|
1236
|
-
const rpc = {
|
|
1280
|
+
|
|
1281
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1282
|
+
const create$a = rpcId => {
|
|
1283
|
+
return {
|
|
1237
1284
|
async dispose() {
|
|
1238
|
-
|
|
1285
|
+
const rpc = get(rpcId);
|
|
1286
|
+
await rpc.dispose();
|
|
1239
1287
|
},
|
|
1288
|
+
// @ts-ignore
|
|
1240
1289
|
invoke(method, ...params) {
|
|
1241
|
-
|
|
1290
|
+
const rpc = get(rpcId);
|
|
1291
|
+
// @ts-ignore
|
|
1292
|
+
return rpc.invoke(method, ...params);
|
|
1242
1293
|
},
|
|
1294
|
+
// @ts-ignore
|
|
1243
1295
|
invokeAndTransfer(method, ...params) {
|
|
1244
|
-
|
|
1296
|
+
const rpc = get(rpcId);
|
|
1297
|
+
// @ts-ignore
|
|
1298
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1245
1299
|
},
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1300
|
+
registerMockRpc(commandMap) {
|
|
1301
|
+
const mockRpc = createMockRpc({
|
|
1302
|
+
commandMap
|
|
1303
|
+
});
|
|
1304
|
+
set$6(rpcId, mockRpc);
|
|
1305
|
+
// @ts-ignore
|
|
1306
|
+
mockRpc[Symbol.dispose] = () => {
|
|
1307
|
+
remove(rpcId);
|
|
1308
|
+
};
|
|
1309
|
+
// @ts-ignore
|
|
1310
|
+
return mockRpc;
|
|
1311
|
+
},
|
|
1312
|
+
set(rpc) {
|
|
1313
|
+
set$6(rpcId, rpc);
|
|
1254
1314
|
}
|
|
1255
1315
|
};
|
|
1256
|
-
return rpc;
|
|
1257
1316
|
};
|
|
1258
1317
|
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1318
|
+
const Audio = 0;
|
|
1319
|
+
const Button = 1;
|
|
1320
|
+
const Col = 2;
|
|
1321
|
+
const ColGroup = 3;
|
|
1322
|
+
const Div = 4;
|
|
1323
|
+
const H1 = 5;
|
|
1324
|
+
const Input = 6;
|
|
1325
|
+
const Kbd = 7;
|
|
1326
|
+
const Span = 8;
|
|
1327
|
+
const Table$1 = 9;
|
|
1328
|
+
const TBody = 10;
|
|
1329
|
+
const Td = 11;
|
|
1330
|
+
const Text = 12;
|
|
1331
|
+
const Th = 13;
|
|
1332
|
+
const THead = 14;
|
|
1333
|
+
const Tr = 15;
|
|
1334
|
+
const I = 16;
|
|
1335
|
+
const Img = 17;
|
|
1336
|
+
const Root = 0;
|
|
1337
|
+
const Ins = 20;
|
|
1338
|
+
const Del = 21;
|
|
1339
|
+
const H2 = 22;
|
|
1340
|
+
const H3 = 23;
|
|
1341
|
+
const H4 = 24;
|
|
1342
|
+
const H5 = 25;
|
|
1343
|
+
const H6 = 26;
|
|
1344
|
+
const Article = 27;
|
|
1345
|
+
const Aside = 28;
|
|
1346
|
+
const Footer = 29;
|
|
1347
|
+
const Header = 30;
|
|
1348
|
+
const Nav = 40;
|
|
1349
|
+
const Section = 41;
|
|
1350
|
+
const Search = 42;
|
|
1351
|
+
const Dd = 43;
|
|
1352
|
+
const Dl = 44;
|
|
1353
|
+
const Figcaption = 45;
|
|
1354
|
+
const Figure = 46;
|
|
1355
|
+
const Hr = 47;
|
|
1356
|
+
const Li = 48;
|
|
1357
|
+
const Ol = 49;
|
|
1358
|
+
const P = 50;
|
|
1359
|
+
const Pre = 51;
|
|
1360
|
+
const A = 53;
|
|
1361
|
+
const Abbr = 54;
|
|
1362
|
+
const Br = 55;
|
|
1363
|
+
const Cite = 56;
|
|
1364
|
+
const Data = 57;
|
|
1365
|
+
const Time = 58;
|
|
1366
|
+
const Tfoot = 59;
|
|
1367
|
+
const Ul = 60;
|
|
1368
|
+
const Video = 61;
|
|
1369
|
+
const TextArea = 62;
|
|
1370
|
+
const Select = 63;
|
|
1371
|
+
const Option = 64;
|
|
1372
|
+
const Code = 65;
|
|
1373
|
+
const Label = 66;
|
|
1374
|
+
const Dt = 67;
|
|
1375
|
+
const Iframe = 68;
|
|
1376
|
+
const Main = 69;
|
|
1377
|
+
const Strong = 70;
|
|
1378
|
+
const Em = 71;
|
|
1379
|
+
const Style = 72;
|
|
1380
|
+
const Html = 73;
|
|
1381
|
+
const Head = 74;
|
|
1382
|
+
const Title = 75;
|
|
1383
|
+
const Meta = 76;
|
|
1384
|
+
const Canvas = 77;
|
|
1385
|
+
const Form = 78;
|
|
1386
|
+
const BlockQuote = 79;
|
|
1387
|
+
const Quote = 80;
|
|
1388
|
+
const Circle = 81;
|
|
1389
|
+
const Defs = 82;
|
|
1390
|
+
const Ellipse = 83;
|
|
1391
|
+
const G = 84;
|
|
1392
|
+
const Line = 85;
|
|
1393
|
+
const Path = 86;
|
|
1394
|
+
const Polygon = 87;
|
|
1395
|
+
const Polyline = 88;
|
|
1396
|
+
const Rect = 89;
|
|
1397
|
+
const Svg = 90;
|
|
1398
|
+
const Use = 91;
|
|
1399
|
+
const Reference = 100;
|
|
1400
|
+
|
|
1401
|
+
const VirtualDomElements = {
|
|
1402
|
+
__proto__: null,
|
|
1403
|
+
A,
|
|
1404
|
+
Abbr,
|
|
1405
|
+
Article,
|
|
1406
|
+
Aside,
|
|
1407
|
+
Audio,
|
|
1408
|
+
BlockQuote,
|
|
1409
|
+
Br,
|
|
1410
|
+
Button,
|
|
1411
|
+
Canvas,
|
|
1412
|
+
Circle,
|
|
1413
|
+
Cite,
|
|
1414
|
+
Code,
|
|
1415
|
+
Col,
|
|
1416
|
+
ColGroup,
|
|
1417
|
+
Data,
|
|
1418
|
+
Dd,
|
|
1419
|
+
Defs,
|
|
1420
|
+
Del,
|
|
1421
|
+
Div,
|
|
1422
|
+
Dl,
|
|
1423
|
+
Dt,
|
|
1424
|
+
Ellipse,
|
|
1425
|
+
Em,
|
|
1426
|
+
Figcaption,
|
|
1427
|
+
Figure,
|
|
1428
|
+
Footer,
|
|
1429
|
+
Form,
|
|
1430
|
+
G,
|
|
1431
|
+
H1,
|
|
1432
|
+
H2,
|
|
1433
|
+
H3,
|
|
1434
|
+
H4,
|
|
1435
|
+
H5,
|
|
1436
|
+
H6,
|
|
1437
|
+
Head,
|
|
1438
|
+
Header,
|
|
1439
|
+
Hr,
|
|
1440
|
+
Html,
|
|
1441
|
+
I,
|
|
1442
|
+
Iframe,
|
|
1443
|
+
Img,
|
|
1444
|
+
Input,
|
|
1445
|
+
Ins,
|
|
1446
|
+
Kbd,
|
|
1447
|
+
Label,
|
|
1448
|
+
Li,
|
|
1449
|
+
Line,
|
|
1450
|
+
Main,
|
|
1451
|
+
Meta,
|
|
1452
|
+
Nav,
|
|
1453
|
+
Ol,
|
|
1454
|
+
Option,
|
|
1455
|
+
P,
|
|
1456
|
+
Path,
|
|
1457
|
+
Polygon,
|
|
1458
|
+
Polyline,
|
|
1459
|
+
Pre,
|
|
1460
|
+
Quote,
|
|
1461
|
+
Rect,
|
|
1462
|
+
Reference,
|
|
1463
|
+
Root,
|
|
1464
|
+
Search,
|
|
1465
|
+
Section,
|
|
1466
|
+
Select,
|
|
1467
|
+
Span,
|
|
1468
|
+
Strong,
|
|
1469
|
+
Style,
|
|
1470
|
+
Svg,
|
|
1471
|
+
TBody,
|
|
1472
|
+
THead,
|
|
1473
|
+
Table: Table$1,
|
|
1474
|
+
Td,
|
|
1475
|
+
Text,
|
|
1476
|
+
TextArea,
|
|
1477
|
+
Tfoot,
|
|
1478
|
+
Th,
|
|
1479
|
+
Time,
|
|
1480
|
+
Title,
|
|
1481
|
+
Tr,
|
|
1482
|
+
Ul,
|
|
1483
|
+
Use,
|
|
1484
|
+
Video
|
|
1261
1485
|
};
|
|
1262
|
-
|
|
1263
|
-
|
|
1486
|
+
|
|
1487
|
+
const ClientX = 'event.clientX';
|
|
1488
|
+
const ClientY = 'event.clientY';
|
|
1489
|
+
|
|
1490
|
+
const Enter = 3;
|
|
1491
|
+
const Space = 9;
|
|
1492
|
+
const End = 255;
|
|
1493
|
+
const Home = 12;
|
|
1494
|
+
const LeftArrow = 13;
|
|
1495
|
+
const UpArrow = 14;
|
|
1496
|
+
const RightArrow = 15;
|
|
1497
|
+
const DownArrow = 16;
|
|
1498
|
+
const ContextMenu = 56;
|
|
1499
|
+
const Star = 131;
|
|
1500
|
+
|
|
1501
|
+
const CtrlCmd = 1 << 11 >>> 0;
|
|
1502
|
+
|
|
1503
|
+
const None$1 = 0;
|
|
1504
|
+
|
|
1505
|
+
const Electron = 2;
|
|
1506
|
+
const Remote = 3;
|
|
1507
|
+
|
|
1508
|
+
const ErrorWorker = 3308;
|
|
1509
|
+
const FileSystemWorker$1 = 209;
|
|
1510
|
+
const MainProcess = -5;
|
|
1511
|
+
const ProcessExplorerRenderer = 33;
|
|
1512
|
+
const RendererWorker = 1;
|
|
1513
|
+
|
|
1514
|
+
const FocusSelector = 'Viewlet.focusSelector';
|
|
1515
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
1516
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1517
|
+
const SetPatches = 'Viewlet.setPatches';
|
|
1518
|
+
|
|
1519
|
+
const Empty = 0;
|
|
1520
|
+
const FocusExplorer = 13;
|
|
1521
|
+
|
|
1522
|
+
const {
|
|
1523
|
+
invoke: invoke$3,
|
|
1524
|
+
set: set$5
|
|
1525
|
+
} = create$a(ErrorWorker);
|
|
1526
|
+
const prepare = async error => {
|
|
1527
|
+
return invoke$3('Errors.prepare', error);
|
|
1264
1528
|
};
|
|
1265
|
-
|
|
1266
|
-
|
|
1529
|
+
|
|
1530
|
+
const {
|
|
1531
|
+
set: set$4
|
|
1532
|
+
} = create$a(FileSystemWorker$1);
|
|
1533
|
+
|
|
1534
|
+
const FileSystemWorker = {
|
|
1535
|
+
__proto__: null,
|
|
1536
|
+
set: set$4
|
|
1267
1537
|
};
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1538
|
+
|
|
1539
|
+
const {
|
|
1540
|
+
dispose: dispose$4,
|
|
1541
|
+
invoke: invoke$2,
|
|
1542
|
+
set: set$3
|
|
1543
|
+
} = create$a(MainProcess);
|
|
1544
|
+
|
|
1545
|
+
const {
|
|
1546
|
+
invoke: invoke$1,
|
|
1547
|
+
invokeAndTransfer,
|
|
1548
|
+
set: set$2
|
|
1549
|
+
} = create$a(RendererWorker);
|
|
1550
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1551
|
+
number(uid);
|
|
1552
|
+
number(menuId);
|
|
1553
|
+
number(x);
|
|
1554
|
+
number(y);
|
|
1555
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1556
|
+
};
|
|
1557
|
+
const sendMessagePortToErrorWorker$1 = async (port, rpcId) => {
|
|
1558
|
+
const command = 'Errors.handleMessagePort';
|
|
1559
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1560
|
+
};
|
|
1561
|
+
const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
|
|
1562
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1563
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1564
|
+
};
|
|
1565
|
+
const sendMessagePortToProcessExplorer$1 = async port => {
|
|
1566
|
+
const command = 'ProcessExplorer.handleMessagePort';
|
|
1567
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToProcessExplorer', port, command, 0);
|
|
1272
1568
|
};
|
|
1273
1569
|
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
// deprecated
|
|
1279
|
-
ipc.on('message', handleMessage);
|
|
1570
|
+
const debugProcess = async (state, index = state.focusedIndex) => {
|
|
1571
|
+
const process = state.visibleProcesses[index];
|
|
1572
|
+
if (!process) {
|
|
1573
|
+
return state;
|
|
1280
1574
|
}
|
|
1575
|
+
await invoke$1('AttachDebugger.attachDebugger', process.pid);
|
|
1576
|
+
return state;
|
|
1281
1577
|
};
|
|
1282
1578
|
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1285
|
-
if (module.signal) {
|
|
1286
|
-
module.signal(rawIpc);
|
|
1287
|
-
}
|
|
1288
|
-
const ipc = module.wrap(rawIpc);
|
|
1289
|
-
return ipc;
|
|
1579
|
+
const isEqual$1 = (oldState, newState) => {
|
|
1580
|
+
return oldState.focused === newState.focused && oldState.focusedIndex === newState.focusedIndex;
|
|
1290
1581
|
};
|
|
1291
1582
|
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1294
|
-
|
|
1583
|
+
const isEqual = (oldState, newState) => {
|
|
1584
|
+
return oldState.initial === newState.initial && oldState.errorCodeFrame === newState.errorCodeFrame && oldState.errorMessage === newState.errorMessage && oldState.errorStack === newState.errorStack && oldState.focusedIndex === newState.focusedIndex && oldState.visibleProcesses === newState.visibleProcesses;
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
const RenderItems = 1;
|
|
1588
|
+
const RenderFocus = 2;
|
|
1589
|
+
const RenderFocusContext = 3;
|
|
1590
|
+
const RenderIncremental = 4;
|
|
1591
|
+
|
|
1592
|
+
const modules = [isEqual, isEqual$1, isEqual$1];
|
|
1593
|
+
const numbers = [RenderIncremental, RenderFocus, RenderFocusContext];
|
|
1594
|
+
|
|
1595
|
+
const diff = (oldState, newState) => {
|
|
1596
|
+
const diffResult = [];
|
|
1597
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1598
|
+
const fn = modules[i];
|
|
1599
|
+
if (!fn(oldState, newState)) {
|
|
1600
|
+
diffResult.push(numbers[i]);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
return diffResult;
|
|
1604
|
+
};
|
|
1605
|
+
|
|
1606
|
+
const diff2 = uid => {
|
|
1607
|
+
const {
|
|
1608
|
+
oldState,
|
|
1609
|
+
scheduledState
|
|
1610
|
+
} = get$2(uid);
|
|
1611
|
+
return diff(oldState, scheduledState);
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
const intervals = new Map();
|
|
1615
|
+
const pending = new Set();
|
|
1616
|
+
const dispose$3 = uid => {
|
|
1617
|
+
const interval = intervals.get(uid);
|
|
1618
|
+
if (interval) {
|
|
1619
|
+
clearInterval(interval);
|
|
1620
|
+
intervals.delete(uid);
|
|
1621
|
+
}
|
|
1622
|
+
pending.delete(uid);
|
|
1623
|
+
};
|
|
1624
|
+
const update = async uid => {
|
|
1625
|
+
if (!getKeys$1().includes(uid)) {
|
|
1626
|
+
dispose$3(uid);
|
|
1627
|
+
return;
|
|
1628
|
+
}
|
|
1629
|
+
if (pending.has(uid)) {
|
|
1630
|
+
return;
|
|
1631
|
+
}
|
|
1632
|
+
pending.add(uid);
|
|
1633
|
+
try {
|
|
1634
|
+
await invoke$1('ProcessExplorer.update');
|
|
1635
|
+
} catch (error) {
|
|
1636
|
+
console.error(error);
|
|
1637
|
+
} finally {
|
|
1638
|
+
pending.delete(uid);
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
const start = (uid, interval = processExplorerUpdateInterval) => {
|
|
1642
|
+
if (interval <= 0 || intervals.has(uid)) {
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
const intervalId = setInterval(() => {
|
|
1646
|
+
void update(uid);
|
|
1647
|
+
}, interval);
|
|
1648
|
+
intervals.set(uid, intervalId);
|
|
1649
|
+
};
|
|
1650
|
+
const restart = (uid, interval) => {
|
|
1651
|
+
dispose$3(uid);
|
|
1652
|
+
start(uid, interval);
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1655
|
+
const processExplorerRpcClosedMessage = 'Process explorer RPC connection was closed';
|
|
1656
|
+
const toProcessExplorerRpcClosedState = state => {
|
|
1657
|
+
return {
|
|
1658
|
+
...state,
|
|
1659
|
+
errorCodeFrame: '',
|
|
1660
|
+
errorMessage: processExplorerRpcClosedMessage,
|
|
1661
|
+
errorStack: '',
|
|
1662
|
+
initial: false
|
|
1663
|
+
};
|
|
1664
|
+
};
|
|
1665
|
+
const handleProcessExplorerRpcClose = async () => {
|
|
1666
|
+
let didUpdate = false;
|
|
1667
|
+
for (const uid of getKeys$1()) {
|
|
1668
|
+
const viewletState = get$2(uid);
|
|
1669
|
+
if (!viewletState) {
|
|
1670
|
+
continue;
|
|
1671
|
+
}
|
|
1672
|
+
dispose$3(uid);
|
|
1673
|
+
const {
|
|
1674
|
+
oldState,
|
|
1675
|
+
scheduledState
|
|
1676
|
+
} = viewletState;
|
|
1677
|
+
const newState = toProcessExplorerRpcClosedState(scheduledState);
|
|
1678
|
+
set$7(uid, oldState, newState);
|
|
1679
|
+
didUpdate = true;
|
|
1680
|
+
}
|
|
1681
|
+
if (didUpdate) {
|
|
1682
|
+
await invoke$1('ProcessExplorer.rerender');
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
|
|
1686
|
+
const Two = '2.0';
|
|
1687
|
+
|
|
1688
|
+
const create$9 = (method, params) => {
|
|
1689
|
+
return {
|
|
1690
|
+
jsonrpc: Two,
|
|
1691
|
+
method,
|
|
1692
|
+
params
|
|
1693
|
+
};
|
|
1694
|
+
};
|
|
1695
|
+
|
|
1696
|
+
const create$8 = (id, method, params) => {
|
|
1697
|
+
const message = {
|
|
1698
|
+
id,
|
|
1699
|
+
jsonrpc: Two,
|
|
1700
|
+
method,
|
|
1701
|
+
params
|
|
1702
|
+
};
|
|
1703
|
+
return message;
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
let id = 0;
|
|
1707
|
+
const create$7 = () => {
|
|
1708
|
+
return ++id;
|
|
1709
|
+
};
|
|
1710
|
+
|
|
1711
|
+
const registerPromise = map => {
|
|
1712
|
+
const id = create$7();
|
|
1713
|
+
const {
|
|
1714
|
+
promise,
|
|
1715
|
+
resolve
|
|
1716
|
+
} = Promise.withResolvers();
|
|
1717
|
+
map[id] = resolve;
|
|
1718
|
+
return {
|
|
1719
|
+
id,
|
|
1720
|
+
promise
|
|
1721
|
+
};
|
|
1722
|
+
};
|
|
1723
|
+
|
|
1724
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
1725
|
+
const {
|
|
1726
|
+
id,
|
|
1727
|
+
promise
|
|
1728
|
+
} = registerPromise(callbacks);
|
|
1729
|
+
const message = create$8(id, method, params);
|
|
1730
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1731
|
+
ipc.sendAndTransfer(message);
|
|
1732
|
+
} else {
|
|
1733
|
+
ipc.send(message);
|
|
1734
|
+
}
|
|
1735
|
+
const responseMessage = await promise;
|
|
1736
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
1737
|
+
};
|
|
1738
|
+
const createRpc$1 = ipc => {
|
|
1739
|
+
const callbacks = Object.create(null);
|
|
1740
|
+
ipc._resolve = (id, response) => {
|
|
1741
|
+
const fn = callbacks[id];
|
|
1742
|
+
if (!fn) {
|
|
1743
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
1744
|
+
return;
|
|
1745
|
+
}
|
|
1746
|
+
fn(response);
|
|
1747
|
+
delete callbacks[id];
|
|
1748
|
+
};
|
|
1749
|
+
const rpc = {
|
|
1750
|
+
async dispose() {
|
|
1751
|
+
await ipc?.dispose();
|
|
1752
|
+
},
|
|
1753
|
+
invoke(method, ...params) {
|
|
1754
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
1755
|
+
},
|
|
1756
|
+
invokeAndTransfer(method, ...params) {
|
|
1757
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
1758
|
+
},
|
|
1759
|
+
// @ts-ignore
|
|
1760
|
+
ipc,
|
|
1761
|
+
/**
|
|
1762
|
+
* @deprecated
|
|
1763
|
+
*/
|
|
1764
|
+
send(method, ...params) {
|
|
1765
|
+
const message = create$9(method, params);
|
|
1766
|
+
ipc.send(message);
|
|
1767
|
+
}
|
|
1768
|
+
};
|
|
1769
|
+
return rpc;
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
const requiresSocket = () => {
|
|
1773
|
+
return false;
|
|
1774
|
+
};
|
|
1775
|
+
const preparePrettyError = error => {
|
|
1776
|
+
return error;
|
|
1777
|
+
};
|
|
1778
|
+
const logError = () => {
|
|
1779
|
+
// handled by renderer worker
|
|
1780
|
+
};
|
|
1781
|
+
const handleMessage = event => {
|
|
1782
|
+
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1783
|
+
const actualExecute = event?.target?.execute || execute;
|
|
1784
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
1785
|
+
};
|
|
1786
|
+
|
|
1787
|
+
const handleIpc = ipc => {
|
|
1788
|
+
if ('addEventListener' in ipc) {
|
|
1789
|
+
ipc.addEventListener('message', handleMessage);
|
|
1790
|
+
} else if ('on' in ipc) {
|
|
1791
|
+
// deprecated
|
|
1792
|
+
ipc.on('message', handleMessage);
|
|
1793
|
+
}
|
|
1794
|
+
};
|
|
1795
|
+
|
|
1796
|
+
const listen$1 = async (module, options) => {
|
|
1797
|
+
const rawIpc = await module.listen(options);
|
|
1798
|
+
if (module.signal) {
|
|
1799
|
+
module.signal(rawIpc);
|
|
1800
|
+
}
|
|
1801
|
+
const ipc = module.wrap(rawIpc);
|
|
1802
|
+
return ipc;
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
const create$6 = async ({
|
|
1806
|
+
commandMap,
|
|
1807
|
+
isMessagePortOpen = true,
|
|
1295
1808
|
messagePort
|
|
1296
1809
|
}) => {
|
|
1297
1810
|
// TODO create a commandMap per rpc instance
|
|
@@ -1302,12 +1815,12 @@ const create$7 = async ({
|
|
|
1302
1815
|
});
|
|
1303
1816
|
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1304
1817
|
handleIpc(ipc);
|
|
1305
|
-
const rpc = createRpc(ipc);
|
|
1818
|
+
const rpc = createRpc$1(ipc);
|
|
1306
1819
|
messagePort.start();
|
|
1307
1820
|
return rpc;
|
|
1308
1821
|
};
|
|
1309
1822
|
|
|
1310
|
-
const create$
|
|
1823
|
+
const create$5 = async ({
|
|
1311
1824
|
commandMap,
|
|
1312
1825
|
isMessagePortOpen,
|
|
1313
1826
|
send
|
|
@@ -1317,7 +1830,7 @@ const create$6 = async ({
|
|
|
1317
1830
|
port2
|
|
1318
1831
|
} = new MessageChannel();
|
|
1319
1832
|
await send(port1);
|
|
1320
|
-
return create$
|
|
1833
|
+
return create$6({
|
|
1321
1834
|
commandMap,
|
|
1322
1835
|
isMessagePortOpen,
|
|
1323
1836
|
messagePort: port2
|
|
@@ -1352,13 +1865,13 @@ const createSharedLazyRpc = factory => {
|
|
|
1352
1865
|
};
|
|
1353
1866
|
};
|
|
1354
1867
|
|
|
1355
|
-
const create$
|
|
1868
|
+
const create$4 = async ({
|
|
1356
1869
|
commandMap,
|
|
1357
1870
|
isMessagePortOpen,
|
|
1358
1871
|
send
|
|
1359
1872
|
}) => {
|
|
1360
1873
|
return createSharedLazyRpc(() => {
|
|
1361
|
-
return create$
|
|
1874
|
+
return create$5({
|
|
1362
1875
|
commandMap,
|
|
1363
1876
|
isMessagePortOpen,
|
|
1364
1877
|
send
|
|
@@ -1386,318 +1899,106 @@ const getProtocol = () => {
|
|
|
1386
1899
|
return location.protocol;
|
|
1387
1900
|
};
|
|
1388
1901
|
|
|
1389
|
-
const create$
|
|
1902
|
+
const create$3 = async ({
|
|
1390
1903
|
commandMap,
|
|
1391
1904
|
webSocket
|
|
1392
1905
|
}) => {
|
|
1393
1906
|
// TODO create a commandMap per rpc instance
|
|
1394
1907
|
register(commandMap);
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1908
|
+
let rawIpc;
|
|
1909
|
+
try {
|
|
1910
|
+
rawIpc = await IpcParentWithWebSocket$1.create({
|
|
1911
|
+
webSocket
|
|
1912
|
+
});
|
|
1913
|
+
} catch (error) {
|
|
1914
|
+
throw new VError(error, 'Failed to create rpc connection');
|
|
1915
|
+
}
|
|
1398
1916
|
const ipc = IpcParentWithWebSocket$1.wrap(rawIpc);
|
|
1399
1917
|
handleIpc(ipc);
|
|
1400
|
-
const rpc = createRpc(ipc);
|
|
1918
|
+
const rpc = createRpc$1(ipc);
|
|
1401
1919
|
return rpc;
|
|
1402
1920
|
};
|
|
1403
1921
|
|
|
1404
|
-
const create$
|
|
1922
|
+
const create$2 = async ({
|
|
1405
1923
|
commandMap,
|
|
1924
|
+
onClose,
|
|
1406
1925
|
type
|
|
1407
1926
|
}) => {
|
|
1408
1927
|
const host = getHost();
|
|
1409
1928
|
const protocol = getProtocol();
|
|
1410
1929
|
const wsUrl = getWebSocketUrl(type, host, protocol);
|
|
1411
1930
|
const webSocket = new WebSocket(wsUrl);
|
|
1412
|
-
|
|
1931
|
+
if (onClose) {
|
|
1932
|
+
webSocket.addEventListener('close', onClose, {
|
|
1933
|
+
once: true
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
const rpc = await create$3({
|
|
1413
1937
|
commandMap,
|
|
1414
1938
|
webSocket
|
|
1415
1939
|
});
|
|
1416
1940
|
return rpc;
|
|
1417
1941
|
};
|
|
1418
1942
|
|
|
1419
|
-
const create$
|
|
1943
|
+
const create$1 = async ({
|
|
1420
1944
|
commandMap,
|
|
1945
|
+
onClose,
|
|
1421
1946
|
type
|
|
1422
1947
|
}) => {
|
|
1423
1948
|
return createSharedLazyRpc(() => {
|
|
1424
|
-
return create$
|
|
1949
|
+
return create$2({
|
|
1425
1950
|
commandMap,
|
|
1951
|
+
onClose,
|
|
1426
1952
|
type
|
|
1427
1953
|
});
|
|
1428
1954
|
});
|
|
1429
1955
|
};
|
|
1430
1956
|
|
|
1431
|
-
const create
|
|
1957
|
+
const create = async ({
|
|
1432
1958
|
commandMap
|
|
1433
1959
|
}) => {
|
|
1434
1960
|
// TODO create a commandMap per rpc instance
|
|
1435
1961
|
register(commandMap);
|
|
1436
1962
|
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
1437
1963
|
handleIpc(ipc);
|
|
1438
|
-
const rpc = createRpc(ipc);
|
|
1964
|
+
const rpc = createRpc$1(ipc);
|
|
1439
1965
|
return rpc;
|
|
1440
1966
|
};
|
|
1441
1967
|
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1444
|
-
}) => {
|
|
1445
|
-
const invocations = [];
|
|
1446
|
-
const invoke = (method, ...params) => {
|
|
1447
|
-
invocations.push([method, ...params]);
|
|
1448
|
-
const command = commandMap[method];
|
|
1449
|
-
if (!command) {
|
|
1450
|
-
throw new Error(`command ${method} not found`);
|
|
1451
|
-
}
|
|
1452
|
-
return command(...params);
|
|
1453
|
-
};
|
|
1454
|
-
const mockRpc = {
|
|
1455
|
-
invocations,
|
|
1456
|
-
invoke,
|
|
1457
|
-
invokeAndTransfer: invoke
|
|
1458
|
-
};
|
|
1459
|
-
return mockRpc;
|
|
1460
|
-
};
|
|
1461
|
-
|
|
1462
|
-
const rpcs = Object.create(null);
|
|
1463
|
-
const set$5 = (id, rpc) => {
|
|
1464
|
-
rpcs[id] = rpc;
|
|
1465
|
-
};
|
|
1466
|
-
const get = id => {
|
|
1467
|
-
return rpcs[id];
|
|
1468
|
-
};
|
|
1469
|
-
const remove = id => {
|
|
1470
|
-
delete rpcs[id];
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1474
|
-
const create = rpcId => {
|
|
1475
|
-
return {
|
|
1476
|
-
async dispose() {
|
|
1477
|
-
const rpc = get(rpcId);
|
|
1478
|
-
await rpc.dispose();
|
|
1479
|
-
},
|
|
1480
|
-
// @ts-ignore
|
|
1481
|
-
invoke(method, ...params) {
|
|
1482
|
-
const rpc = get(rpcId);
|
|
1483
|
-
// @ts-ignore
|
|
1484
|
-
return rpc.invoke(method, ...params);
|
|
1485
|
-
},
|
|
1486
|
-
// @ts-ignore
|
|
1487
|
-
invokeAndTransfer(method, ...params) {
|
|
1488
|
-
const rpc = get(rpcId);
|
|
1489
|
-
// @ts-ignore
|
|
1490
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1491
|
-
},
|
|
1492
|
-
registerMockRpc(commandMap) {
|
|
1493
|
-
const mockRpc = createMockRpc({
|
|
1494
|
-
commandMap
|
|
1495
|
-
});
|
|
1496
|
-
set$5(rpcId, mockRpc);
|
|
1497
|
-
// @ts-ignore
|
|
1498
|
-
mockRpc[Symbol.dispose] = () => {
|
|
1499
|
-
remove(rpcId);
|
|
1500
|
-
};
|
|
1501
|
-
// @ts-ignore
|
|
1502
|
-
return mockRpc;
|
|
1503
|
-
},
|
|
1504
|
-
set(rpc) {
|
|
1505
|
-
set$5(rpcId, rpc);
|
|
1506
|
-
}
|
|
1507
|
-
};
|
|
1508
|
-
};
|
|
1509
|
-
|
|
1510
|
-
const Div = 4;
|
|
1511
|
-
const Table$1 = 9;
|
|
1512
|
-
const TBody = 10;
|
|
1513
|
-
const Td = 11;
|
|
1514
|
-
const Text = 12;
|
|
1515
|
-
const Th = 13;
|
|
1516
|
-
const THead = 14;
|
|
1517
|
-
const Tr = 15;
|
|
1518
|
-
const Pre = 51;
|
|
1519
|
-
const Reference = 100;
|
|
1520
|
-
|
|
1521
|
-
const ClientX = 'event.clientX';
|
|
1522
|
-
const ClientY = 'event.clientY';
|
|
1523
|
-
|
|
1524
|
-
const Enter = 3;
|
|
1525
|
-
const Space = 9;
|
|
1526
|
-
const End = 255;
|
|
1527
|
-
const Home = 12;
|
|
1528
|
-
const LeftArrow = 13;
|
|
1529
|
-
const UpArrow = 14;
|
|
1530
|
-
const RightArrow = 15;
|
|
1531
|
-
const DownArrow = 16;
|
|
1532
|
-
const ContextMenu = 56;
|
|
1533
|
-
const Star = 131;
|
|
1534
|
-
|
|
1535
|
-
const CtrlCmd = 1 << 11 >>> 0;
|
|
1536
|
-
|
|
1537
|
-
const None$1 = 0;
|
|
1538
|
-
|
|
1539
|
-
const Electron = 2;
|
|
1540
|
-
const Remote = 3;
|
|
1541
|
-
|
|
1542
|
-
const ErrorWorker = 3308;
|
|
1543
|
-
const FileSystemWorker$1 = 209;
|
|
1544
|
-
const RendererWorker = 1;
|
|
1545
|
-
|
|
1546
|
-
const FocusSelector = 'Viewlet.focusSelector';
|
|
1547
|
-
const SetDom2 = 'Viewlet.setDom2';
|
|
1548
|
-
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1549
|
-
const SetPatches = 'Viewlet.setPatches';
|
|
1550
|
-
|
|
1551
|
-
const Empty = 0;
|
|
1552
|
-
const FocusExplorer = 13;
|
|
1553
|
-
|
|
1554
|
-
const {
|
|
1555
|
-
invoke: invoke$2,
|
|
1556
|
-
set: set$4
|
|
1557
|
-
} = create(ErrorWorker);
|
|
1558
|
-
const prepare = async error => {
|
|
1559
|
-
return invoke$2('Errors.prepare', error);
|
|
1560
|
-
};
|
|
1561
|
-
|
|
1562
|
-
const {
|
|
1563
|
-
set: set$3
|
|
1564
|
-
} = create(FileSystemWorker$1);
|
|
1565
|
-
|
|
1566
|
-
const FileSystemWorker = {
|
|
1567
|
-
__proto__: null,
|
|
1568
|
-
set: set$3
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
const {
|
|
1572
|
-
invoke: invoke$1,
|
|
1573
|
-
invokeAndTransfer,
|
|
1574
|
-
set: set$2
|
|
1575
|
-
} = create(RendererWorker);
|
|
1576
|
-
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1577
|
-
number(uid);
|
|
1578
|
-
number(menuId);
|
|
1579
|
-
number(x);
|
|
1580
|
-
number(y);
|
|
1581
|
-
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1582
|
-
};
|
|
1583
|
-
const sendMessagePortToErrorWorker$1 = async (port, rpcId) => {
|
|
1584
|
-
const command = 'Errors.handleMessagePort';
|
|
1585
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1586
|
-
};
|
|
1587
|
-
const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
|
|
1588
|
-
const command = 'FileSystem.handleMessagePort';
|
|
1589
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1590
|
-
};
|
|
1591
|
-
const sendMessagePortToProcessExplorer$1 = async port => {
|
|
1592
|
-
const command = 'ProcessExplorer.handleMessagePort';
|
|
1593
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToProcessExplorer', port, command, 0);
|
|
1594
|
-
};
|
|
1595
|
-
|
|
1596
|
-
const debugProcess = async (state, index = state.focusedIndex) => {
|
|
1597
|
-
const process = state.visibleProcesses[index];
|
|
1598
|
-
if (!process) {
|
|
1599
|
-
return state;
|
|
1600
|
-
}
|
|
1601
|
-
await invoke$1('AttachDebugger.attachDebugger', process.pid);
|
|
1602
|
-
return state;
|
|
1603
|
-
};
|
|
1604
|
-
|
|
1605
|
-
const isEqual$1 = (oldState, newState) => {
|
|
1606
|
-
return oldState.focused === newState.focused && oldState.focusedIndex === newState.focusedIndex;
|
|
1607
|
-
};
|
|
1608
|
-
|
|
1609
|
-
const isEqual = (oldState, newState) => {
|
|
1610
|
-
return oldState.initial === newState.initial && oldState.errorCodeFrame === newState.errorCodeFrame && oldState.errorMessage === newState.errorMessage && oldState.errorStack === newState.errorStack && oldState.focusedIndex === newState.focusedIndex && oldState.visibleProcesses === newState.visibleProcesses;
|
|
1611
|
-
};
|
|
1612
|
-
|
|
1613
|
-
const RenderItems = 1;
|
|
1614
|
-
const RenderFocus = 2;
|
|
1615
|
-
const RenderFocusContext = 3;
|
|
1616
|
-
const RenderIncremental = 4;
|
|
1617
|
-
|
|
1618
|
-
const modules = [isEqual, isEqual$1, isEqual$1];
|
|
1619
|
-
const numbers = [RenderIncremental, RenderFocus, RenderFocusContext];
|
|
1620
|
-
|
|
1621
|
-
const diff = (oldState, newState) => {
|
|
1622
|
-
const diffResult = [];
|
|
1623
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1624
|
-
const fn = modules[i];
|
|
1625
|
-
if (!fn(oldState, newState)) {
|
|
1626
|
-
diffResult.push(numbers[i]);
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
return diffResult;
|
|
1630
|
-
};
|
|
1631
|
-
|
|
1632
|
-
const diff2 = uid => {
|
|
1633
|
-
const {
|
|
1634
|
-
oldState,
|
|
1635
|
-
scheduledState
|
|
1636
|
-
} = get$2(uid);
|
|
1637
|
-
return diff(oldState, scheduledState);
|
|
1638
|
-
};
|
|
1639
|
-
|
|
1640
|
-
const intervals = new Map();
|
|
1641
|
-
const pending = new Set();
|
|
1642
|
-
const dispose$3 = uid => {
|
|
1643
|
-
const interval = intervals.get(uid);
|
|
1644
|
-
if (interval) {
|
|
1645
|
-
clearInterval(interval);
|
|
1646
|
-
intervals.delete(uid);
|
|
1647
|
-
}
|
|
1648
|
-
pending.delete(uid);
|
|
1649
|
-
};
|
|
1650
|
-
const update = async uid => {
|
|
1651
|
-
if (!getKeys$1().includes(uid)) {
|
|
1652
|
-
dispose$3(uid);
|
|
1653
|
-
return;
|
|
1654
|
-
}
|
|
1655
|
-
if (pending.has(uid)) {
|
|
1656
|
-
return;
|
|
1657
|
-
}
|
|
1658
|
-
pending.add(uid);
|
|
1659
|
-
try {
|
|
1660
|
-
await invoke$1('ProcessExplorer.update');
|
|
1661
|
-
} catch (error) {
|
|
1662
|
-
console.error(error);
|
|
1663
|
-
} finally {
|
|
1664
|
-
pending.delete(uid);
|
|
1665
|
-
}
|
|
1666
|
-
};
|
|
1667
|
-
const start = (uid, interval = processExplorerUpdateInterval) => {
|
|
1668
|
-
if (interval <= 0 || intervals.has(uid)) {
|
|
1669
|
-
return;
|
|
1670
|
-
}
|
|
1671
|
-
const intervalId = setInterval(() => {
|
|
1672
|
-
void update(uid);
|
|
1673
|
-
}, interval);
|
|
1674
|
-
intervals.set(uid, intervalId);
|
|
1675
|
-
};
|
|
1676
|
-
const restart = (uid, interval) => {
|
|
1677
|
-
dispose$3(uid);
|
|
1678
|
-
start(uid, interval);
|
|
1968
|
+
const sendMessagePortToMainProcess = async port => {
|
|
1969
|
+
await invokeAndTransfer('SendMessagePortToMainProcess.sendMessagePortToMainProcess', port, 'HandleElectronMessagePort.handleElectronMessagePort', ProcessExplorerRenderer);
|
|
1679
1970
|
};
|
|
1680
1971
|
|
|
1681
1972
|
const sendMessagePortToProcessExplorer = async port => {
|
|
1682
1973
|
await sendMessagePortToProcessExplorer$1(port);
|
|
1683
1974
|
};
|
|
1684
1975
|
|
|
1976
|
+
const createRpc = async send => {
|
|
1977
|
+
return create$4({
|
|
1978
|
+
commandMap: {},
|
|
1979
|
+
send
|
|
1980
|
+
});
|
|
1981
|
+
};
|
|
1685
1982
|
const launchProcessExplorerElectron = async () => {
|
|
1983
|
+
let processExplorerRpc;
|
|
1686
1984
|
try {
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1985
|
+
processExplorerRpc = await createRpc(sendMessagePortToProcessExplorer);
|
|
1986
|
+
const mainProcessRpc = await createRpc(sendMessagePortToMainProcess);
|
|
1987
|
+
return {
|
|
1988
|
+
mainProcessRpc,
|
|
1989
|
+
processExplorerRpc
|
|
1990
|
+
};
|
|
1692
1991
|
} catch (error) {
|
|
1693
|
-
|
|
1992
|
+
await processExplorerRpc?.dispose();
|
|
1993
|
+
throw new VError(error, 'Failed to create process explorer electron rpcs');
|
|
1694
1994
|
}
|
|
1695
1995
|
};
|
|
1696
1996
|
|
|
1697
|
-
const launchProcessExplorerNode = async
|
|
1997
|
+
const launchProcessExplorerNode = async onClose => {
|
|
1698
1998
|
try {
|
|
1699
|
-
const rpc = await create$
|
|
1999
|
+
const rpc = await create$1({
|
|
1700
2000
|
commandMap: {},
|
|
2001
|
+
onClose,
|
|
1701
2002
|
type: 'process-explorer'
|
|
1702
2003
|
});
|
|
1703
2004
|
return rpc;
|
|
@@ -1718,6 +2019,9 @@ const invoke = async (method, ...params) => {
|
|
|
1718
2019
|
const set$1 = newRpc => {
|
|
1719
2020
|
state$1.rpc = newRpc;
|
|
1720
2021
|
};
|
|
2022
|
+
const clear = () => {
|
|
2023
|
+
state$1.rpc = undefined;
|
|
2024
|
+
};
|
|
1721
2025
|
const dispose$2 = async () => {
|
|
1722
2026
|
const {
|
|
1723
2027
|
rpc
|
|
@@ -1729,30 +2033,48 @@ const dispose$2 = async () => {
|
|
|
1729
2033
|
const state = {
|
|
1730
2034
|
initializedPlatform: 0
|
|
1731
2035
|
};
|
|
2036
|
+
const handleClose = async () => {
|
|
2037
|
+
state.initializedPlatform = 0;
|
|
2038
|
+
clear();
|
|
2039
|
+
await handleProcessExplorerRpcClose();
|
|
2040
|
+
};
|
|
1732
2041
|
const initializeProcessExplorer = async platform => {
|
|
1733
2042
|
if (state.initializedPlatform === platform) {
|
|
1734
2043
|
return;
|
|
1735
2044
|
}
|
|
1736
2045
|
if (platform === Electron) {
|
|
1737
|
-
const
|
|
1738
|
-
|
|
2046
|
+
const {
|
|
2047
|
+
mainProcessRpc,
|
|
2048
|
+
processExplorerRpc
|
|
2049
|
+
} = await launchProcessExplorerElectron();
|
|
2050
|
+
set$3(mainProcessRpc);
|
|
2051
|
+
set$1(processExplorerRpc);
|
|
1739
2052
|
state.initializedPlatform = platform;
|
|
1740
2053
|
return;
|
|
1741
2054
|
}
|
|
1742
2055
|
if (platform === Remote) {
|
|
1743
|
-
const rpc = await launchProcessExplorerNode()
|
|
2056
|
+
const rpc = await launchProcessExplorerNode(() => {
|
|
2057
|
+
void handleClose();
|
|
2058
|
+
});
|
|
1744
2059
|
set$1(rpc);
|
|
1745
2060
|
state.initializedPlatform = platform;
|
|
1746
2061
|
}
|
|
1747
2062
|
};
|
|
1748
2063
|
const dispose$1 = async () => {
|
|
2064
|
+
const {
|
|
2065
|
+
initializedPlatform
|
|
2066
|
+
} = state;
|
|
1749
2067
|
state.initializedPlatform = 0;
|
|
2068
|
+
if (initializedPlatform === Electron) {
|
|
2069
|
+
await Promise.all([dispose$4(), dispose$2()]);
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
1750
2072
|
await dispose$2();
|
|
1751
2073
|
};
|
|
1752
2074
|
|
|
1753
2075
|
const dispose = async uid => {
|
|
1754
2076
|
dispose$3(uid);
|
|
1755
|
-
dispose$
|
|
2077
|
+
dispose$5(uid);
|
|
1756
2078
|
if (getKeys$1().length === 0) {
|
|
1757
2079
|
await dispose$1();
|
|
1758
2080
|
}
|
|
@@ -1997,7 +2319,7 @@ const handleContextMenu = async (state, index = state.focusedIndex, x = 0, y = 0
|
|
|
1997
2319
|
focused: false,
|
|
1998
2320
|
focusedIndex: numericIndex
|
|
1999
2321
|
};
|
|
2000
|
-
set$
|
|
2322
|
+
set$7(state.uid, state, newState);
|
|
2001
2323
|
await show2(state.uid, ProcessExplorer$1, x, y, {
|
|
2002
2324
|
index: numericIndex,
|
|
2003
2325
|
menuId: ProcessExplorer$1
|
|
@@ -2021,7 +2343,13 @@ const killProcess = async (state, index = state.focusedIndex) => {
|
|
|
2021
2343
|
if (!process) {
|
|
2022
2344
|
return state;
|
|
2023
2345
|
}
|
|
2024
|
-
|
|
2346
|
+
const killPromise = invoke('Process.kill', process.pid);
|
|
2347
|
+
if (process.name === 'process-explorer') {
|
|
2348
|
+
dispose$3(state.uid);
|
|
2349
|
+
void killPromise.catch(() => {});
|
|
2350
|
+
return toProcessExplorerRpcClosedState(state);
|
|
2351
|
+
}
|
|
2352
|
+
await killPromise;
|
|
2025
2353
|
return state;
|
|
2026
2354
|
};
|
|
2027
2355
|
|
|
@@ -2140,6 +2468,13 @@ const getFocusedIndex = (oldFocusedIndex, visibleProcesses) => {
|
|
|
2140
2468
|
}
|
|
2141
2469
|
return Math.min(oldFocusedIndex, visibleProcesses.length - 1);
|
|
2142
2470
|
};
|
|
2471
|
+
const listProcesses = async (rootPid, platform) => {
|
|
2472
|
+
if (platform === Electron) {
|
|
2473
|
+
const pidMap = await invoke$2('CreatePidMap.createPidMap');
|
|
2474
|
+
return invoke('ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage', rootPid, false, pidMap);
|
|
2475
|
+
}
|
|
2476
|
+
return invoke('ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage', rootPid, false);
|
|
2477
|
+
};
|
|
2143
2478
|
const refresh = async state => {
|
|
2144
2479
|
try {
|
|
2145
2480
|
await initializeProcessExplorer(state.platform);
|
|
@@ -2147,7 +2482,7 @@ const refresh = async state => {
|
|
|
2147
2482
|
const rootPid = state.rootPid === -1 ? await invoke('ProcessId.getMainProcessId', {
|
|
2148
2483
|
includeElectronData
|
|
2149
2484
|
}) : state.rootPid;
|
|
2150
|
-
const processes = await
|
|
2485
|
+
const processes = await listProcesses(rootPid, state.platform);
|
|
2151
2486
|
const frontendMemoryProcesses = state.includeFrontendMemoryUsage ? await getFrontendMemoryUsage(rootPid) : [];
|
|
2152
2487
|
const allProcesses = [...processes, ...frontendMemoryProcesses];
|
|
2153
2488
|
const visibleProcesses = getVisibleProcesses(allProcesses, state.collapsedPids, rootPid);
|
|
@@ -2205,6 +2540,10 @@ const renderFocusContext = (oldState, newState) => {
|
|
|
2205
2540
|
return [SetFocusContext, newState.uid, newState.focused ? FocusExplorer : Empty];
|
|
2206
2541
|
};
|
|
2207
2542
|
|
|
2543
|
+
const mergeClassNames = (...classNames) => {
|
|
2544
|
+
return classNames.filter(Boolean).join(' ');
|
|
2545
|
+
};
|
|
2546
|
+
|
|
2208
2547
|
const text = data => {
|
|
2209
2548
|
return {
|
|
2210
2549
|
childCount: 0,
|
|
@@ -2213,6 +2552,8 @@ const text = data => {
|
|
|
2213
2552
|
};
|
|
2214
2553
|
};
|
|
2215
2554
|
|
|
2555
|
+
new Set(Object.values(VirtualDomElements));
|
|
2556
|
+
|
|
2216
2557
|
const SetText = 1;
|
|
2217
2558
|
const Replace = 2;
|
|
2218
2559
|
const SetAttribute = 3;
|
|
@@ -2515,9 +2856,28 @@ const formatMemory = memory => {
|
|
|
2515
2856
|
return `${(memory / 1000 ** 4).toFixed(1)} TB`;
|
|
2516
2857
|
};
|
|
2517
2858
|
|
|
2859
|
+
const Focusable = 0;
|
|
2860
|
+
|
|
2861
|
+
const tableHeadNode = {
|
|
2862
|
+
childCount: 1,
|
|
2863
|
+
className: TableHead,
|
|
2864
|
+
role: RowGroup,
|
|
2865
|
+
type: THead
|
|
2866
|
+
};
|
|
2867
|
+
const headerRowNode = {
|
|
2868
|
+
childCount: 3,
|
|
2869
|
+
className: Row,
|
|
2870
|
+
role: Row$1,
|
|
2871
|
+
type: Tr
|
|
2872
|
+
};
|
|
2873
|
+
const headerCellNode = {
|
|
2874
|
+
childCount: 1,
|
|
2875
|
+
className: HeaderCell,
|
|
2876
|
+
type: Th
|
|
2877
|
+
};
|
|
2518
2878
|
const getRowClassName = focused => {
|
|
2519
2879
|
if (focused) {
|
|
2520
|
-
return
|
|
2880
|
+
return mergeClassNames(Row, RowFocused);
|
|
2521
2881
|
}
|
|
2522
2882
|
return Row;
|
|
2523
2883
|
};
|
|
@@ -2551,25 +2911,10 @@ const getCellDom = (className, value, index, paddingLeft) => {
|
|
|
2551
2911
|
}, text(value)];
|
|
2552
2912
|
};
|
|
2553
2913
|
const getHeaderDom = () => {
|
|
2554
|
-
return [
|
|
2555
|
-
childCount: 1,
|
|
2556
|
-
className: TableHead,
|
|
2557
|
-
role: RowGroup,
|
|
2558
|
-
type: THead
|
|
2559
|
-
}, {
|
|
2560
|
-
childCount: 3,
|
|
2561
|
-
className: Row,
|
|
2562
|
-
role: Row$1,
|
|
2563
|
-
type: Tr
|
|
2564
|
-
}, ...['Name', 'PID', 'Memory'].flatMap(label => [{
|
|
2565
|
-
childCount: 1,
|
|
2566
|
-
className: HeaderCell,
|
|
2567
|
-
type: Th
|
|
2568
|
-
}, text(label)])];
|
|
2914
|
+
return [tableHeadNode, headerRowNode, ...['Name', 'PID', 'Memory'].flatMap(label => [headerCellNode, text(label)])];
|
|
2569
2915
|
};
|
|
2570
2916
|
const getRowDom = (process, index, focused) => {
|
|
2571
2917
|
return [{
|
|
2572
|
-
ariaDescription: '',
|
|
2573
2918
|
ariaExpanded: getAriaExpanded(process),
|
|
2574
2919
|
ariaLevel: process.depth,
|
|
2575
2920
|
childCount: 3,
|
|
@@ -2580,7 +2925,7 @@ const getRowDom = (process, index, focused) => {
|
|
|
2580
2925
|
tabIndex: focused ? 0 : -1,
|
|
2581
2926
|
title: process.cmd,
|
|
2582
2927
|
type: Tr
|
|
2583
|
-
}, ...getCellDom(
|
|
2928
|
+
}, ...getCellDom(mergeClassNames(Cell, NameCell), process.name, index, getPaddingLeft(process)), ...getCellDom(Cell, String(process.pid), index), ...getCellDom(Cell, formatMemory(process.memory), index)];
|
|
2584
2929
|
};
|
|
2585
2930
|
const getBodyDom = state => {
|
|
2586
2931
|
const {
|
|
@@ -2604,16 +2949,26 @@ const getErrorSectionDom = (value, type) => {
|
|
|
2604
2949
|
}, text(value)];
|
|
2605
2950
|
};
|
|
2606
2951
|
const hasError = state => {
|
|
2607
|
-
|
|
2952
|
+
const {
|
|
2953
|
+
errorCodeFrame,
|
|
2954
|
+
errorMessage,
|
|
2955
|
+
errorStack
|
|
2956
|
+
} = state;
|
|
2957
|
+
return Boolean(errorMessage || errorCodeFrame || errorStack);
|
|
2608
2958
|
};
|
|
2609
2959
|
const getErrorDom = state => {
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2612
|
-
|
|
2960
|
+
const {
|
|
2961
|
+
errorCodeFrame,
|
|
2962
|
+
errorMessage,
|
|
2963
|
+
errorStack
|
|
2964
|
+
} = state;
|
|
2965
|
+
const messageDom = getErrorSectionDom(errorMessage, Div);
|
|
2966
|
+
const codeFrameDom = getErrorSectionDom(errorCodeFrame, Pre);
|
|
2967
|
+
const stackDom = getErrorSectionDom(errorStack, Pre);
|
|
2613
2968
|
const childCount = messageDom.length / 2 + codeFrameDom.length / 2 + stackDom.length / 2;
|
|
2614
2969
|
return [{
|
|
2615
2970
|
childCount: 1,
|
|
2616
|
-
className:
|
|
2971
|
+
className: mergeClassNames(Viewlet, ProcessExplorer),
|
|
2617
2972
|
role: None,
|
|
2618
2973
|
type: Div
|
|
2619
2974
|
}, {
|
|
@@ -2623,14 +2978,17 @@ const getErrorDom = state => {
|
|
|
2623
2978
|
}, ...messageDom, ...codeFrameDom, ...stackDom];
|
|
2624
2979
|
};
|
|
2625
2980
|
const getTableDom = state => {
|
|
2981
|
+
const {
|
|
2982
|
+
visibleProcesses
|
|
2983
|
+
} = state;
|
|
2626
2984
|
return [{
|
|
2627
2985
|
childCount: 1,
|
|
2628
|
-
className:
|
|
2986
|
+
className: mergeClassNames(Viewlet, ProcessExplorer),
|
|
2629
2987
|
role: None,
|
|
2630
2988
|
type: Div
|
|
2631
2989
|
}, {
|
|
2632
2990
|
ariaLabel: 'Process Explorer',
|
|
2633
|
-
ariaRowCount:
|
|
2991
|
+
ariaRowCount: visibleProcesses.length + 1,
|
|
2634
2992
|
childCount: 2,
|
|
2635
2993
|
className: Table,
|
|
2636
2994
|
onBlur: HandleBlur,
|
|
@@ -2640,12 +2998,15 @@ const getTableDom = state => {
|
|
|
2640
2998
|
onFocus: HandleFocus,
|
|
2641
2999
|
onPointerDown: HandlePointerDown,
|
|
2642
3000
|
role: Grid,
|
|
2643
|
-
tabIndex:
|
|
3001
|
+
tabIndex: Focusable,
|
|
2644
3002
|
type: Table$1
|
|
2645
3003
|
}, ...getHeaderDom(), ...getBodyDom(state)];
|
|
2646
3004
|
};
|
|
2647
3005
|
const getDom = state => {
|
|
2648
|
-
|
|
3006
|
+
const {
|
|
3007
|
+
initial
|
|
3008
|
+
} = state;
|
|
3009
|
+
if (initial) {
|
|
2649
3010
|
return [];
|
|
2650
3011
|
}
|
|
2651
3012
|
if (hasError(state)) {
|
|
@@ -2696,7 +3057,7 @@ const render2 = (uid, diffResult) => {
|
|
|
2696
3057
|
oldState,
|
|
2697
3058
|
scheduledState
|
|
2698
3059
|
} = get$2(uid);
|
|
2699
|
-
set$
|
|
3060
|
+
set$7(uid, scheduledState, scheduledState);
|
|
2700
3061
|
return applyRender(oldState, scheduledState, diffResult);
|
|
2701
3062
|
};
|
|
2702
3063
|
|
|
@@ -2725,6 +3086,10 @@ const renderEventListeners = () => {
|
|
|
2725
3086
|
}];
|
|
2726
3087
|
};
|
|
2727
3088
|
|
|
3089
|
+
const rerender = state => {
|
|
3090
|
+
return state;
|
|
3091
|
+
};
|
|
3092
|
+
|
|
2728
3093
|
const isRawError = value => {
|
|
2729
3094
|
return Boolean(value && typeof value === 'object');
|
|
2730
3095
|
};
|
|
@@ -2812,6 +3177,7 @@ const commandMap = {
|
|
|
2812
3177
|
'ProcessExplorer.refresh': wrapCommand(refresh),
|
|
2813
3178
|
'ProcessExplorer.render2': render2,
|
|
2814
3179
|
'ProcessExplorer.renderEventListeners': renderEventListeners,
|
|
3180
|
+
'ProcessExplorer.rerender': wrapCommand(rerender),
|
|
2815
3181
|
'ProcessExplorer.setError': wrapCommand(setError),
|
|
2816
3182
|
'ProcessExplorer.setRootProcessId': wrapCommand(setRootProcessId),
|
|
2817
3183
|
'ProcessExplorer.setUpdateInterval': wrapCommand(setUpdateInterval),
|
|
@@ -2825,7 +3191,7 @@ const sendMessagePortToErrorWorker = async port => {
|
|
|
2825
3191
|
|
|
2826
3192
|
const createErrorWorkerRpc = async () => {
|
|
2827
3193
|
try {
|
|
2828
|
-
const rpc = await create$
|
|
3194
|
+
const rpc = await create$4({
|
|
2829
3195
|
commandMap: {},
|
|
2830
3196
|
send: sendMessagePortToErrorWorker
|
|
2831
3197
|
});
|
|
@@ -2837,7 +3203,7 @@ const createErrorWorkerRpc = async () => {
|
|
|
2837
3203
|
|
|
2838
3204
|
const initializeErrorWorker = async () => {
|
|
2839
3205
|
const rpc = await createErrorWorkerRpc();
|
|
2840
|
-
set$
|
|
3206
|
+
set$5(rpc);
|
|
2841
3207
|
};
|
|
2842
3208
|
|
|
2843
3209
|
const sendMessagePortToFileSystemWorker = async port => {
|
|
@@ -2846,7 +3212,7 @@ const sendMessagePortToFileSystemWorker = async port => {
|
|
|
2846
3212
|
|
|
2847
3213
|
const createFileSystemWorkerRpc = async () => {
|
|
2848
3214
|
try {
|
|
2849
|
-
const rpc = await create$
|
|
3215
|
+
const rpc = await create$4({
|
|
2850
3216
|
commandMap: {},
|
|
2851
3217
|
send: sendMessagePortToFileSystemWorker
|
|
2852
3218
|
});
|
|
@@ -2866,7 +3232,7 @@ const initializeFileSystemWorker = async () => {
|
|
|
2866
3232
|
};
|
|
2867
3233
|
|
|
2868
3234
|
const initializeRendererWorker = async () => {
|
|
2869
|
-
const rpc = await create
|
|
3235
|
+
const rpc = await create({
|
|
2870
3236
|
commandMap: commandMap
|
|
2871
3237
|
});
|
|
2872
3238
|
set$2(rpc);
|