@lvce-editor/process-explorer-worker 3.6.0 → 3.7.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 +88 -17
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -186,7 +186,7 @@ const {
|
|
|
186
186
|
getCommandIds,
|
|
187
187
|
getKeys: getKeys$1,
|
|
188
188
|
registerCommands,
|
|
189
|
-
set: set$
|
|
189
|
+
set: set$a,
|
|
190
190
|
wrapCommand,
|
|
191
191
|
wrapGetter,
|
|
192
192
|
wrapLoadContent
|
|
@@ -222,7 +222,7 @@ const create$d = (id, _uri, x, y, width, height, args, parentUid, platform = 0,
|
|
|
222
222
|
x,
|
|
223
223
|
y
|
|
224
224
|
};
|
|
225
|
-
set$
|
|
225
|
+
set$a(state.uid, state, state);
|
|
226
226
|
return state;
|
|
227
227
|
};
|
|
228
228
|
|
|
@@ -1423,7 +1423,7 @@ const createMockRpc = ({
|
|
|
1423
1423
|
};
|
|
1424
1424
|
|
|
1425
1425
|
const rpcs = Object.create(null);
|
|
1426
|
-
const set$
|
|
1426
|
+
const set$9 = (id, rpc) => {
|
|
1427
1427
|
rpcs[id] = rpc;
|
|
1428
1428
|
};
|
|
1429
1429
|
const get = id => {
|
|
@@ -1456,7 +1456,7 @@ const create = rpcId => {
|
|
|
1456
1456
|
const mockRpc = createMockRpc({
|
|
1457
1457
|
commandMap
|
|
1458
1458
|
});
|
|
1459
|
-
set$
|
|
1459
|
+
set$9(rpcId, mockRpc);
|
|
1460
1460
|
// @ts-ignore
|
|
1461
1461
|
mockRpc[Symbol.dispose] = () => {
|
|
1462
1462
|
remove(rpcId);
|
|
@@ -1465,7 +1465,7 @@ const create = rpcId => {
|
|
|
1465
1465
|
return mockRpc;
|
|
1466
1466
|
},
|
|
1467
1467
|
set(rpc) {
|
|
1468
|
-
set$
|
|
1468
|
+
set$9(rpcId, rpc);
|
|
1469
1469
|
}
|
|
1470
1470
|
};
|
|
1471
1471
|
};
|
|
@@ -1523,30 +1523,34 @@ const Empty = 0;
|
|
|
1523
1523
|
const FocusExplorer = 13;
|
|
1524
1524
|
|
|
1525
1525
|
const {
|
|
1526
|
-
set: set$
|
|
1526
|
+
set: set$8
|
|
1527
1527
|
} = create(EditorWorker);
|
|
1528
1528
|
|
|
1529
1529
|
const {
|
|
1530
1530
|
invoke: invoke$2,
|
|
1531
|
-
set: set$
|
|
1531
|
+
set: set$7
|
|
1532
1532
|
} = create(ErrorWorker);
|
|
1533
1533
|
const prepare = async error => {
|
|
1534
1534
|
return invoke$2('Errors.prepare', error);
|
|
1535
1535
|
};
|
|
1536
1536
|
|
|
1537
1537
|
const {
|
|
1538
|
-
set: set$
|
|
1538
|
+
set: set$6
|
|
1539
1539
|
} = create(FileSystemWorker$1);
|
|
1540
1540
|
|
|
1541
1541
|
const FileSystemWorker = {
|
|
1542
1542
|
__proto__: null,
|
|
1543
|
-
set: set$
|
|
1543
|
+
set: set$6
|
|
1544
1544
|
};
|
|
1545
1545
|
|
|
1546
1546
|
const {
|
|
1547
|
-
set: set$
|
|
1547
|
+
set: set$5
|
|
1548
1548
|
} = create(OpenerWorker);
|
|
1549
1549
|
|
|
1550
|
+
const {
|
|
1551
|
+
set: set$4
|
|
1552
|
+
} = create(10_001);
|
|
1553
|
+
|
|
1550
1554
|
const {
|
|
1551
1555
|
set: set$3
|
|
1552
1556
|
} = create(IconThemeWorker);
|
|
@@ -1836,6 +1840,10 @@ const sendMessagePortToTextMeasurementWorker = async port => {
|
|
|
1836
1840
|
const command = 'TextMeasurement.handleMessagePort';
|
|
1837
1841
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
|
|
1838
1842
|
};
|
|
1843
|
+
const sendMessagePortToProcessExplorer$1 = async port => {
|
|
1844
|
+
const command = 'ProcessExplorer.handleMessagePort';
|
|
1845
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToProcessExplorer', port, command, 0);
|
|
1846
|
+
};
|
|
1839
1847
|
const sendMessagePortToSourceControlWorker = async port => {
|
|
1840
1848
|
const command = 'SourceControl.handleMessagePort';
|
|
1841
1849
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
|
|
@@ -1968,7 +1976,7 @@ const initializeOpenerWorker = async () => {
|
|
|
1968
1976
|
commandMap: {},
|
|
1969
1977
|
send
|
|
1970
1978
|
});
|
|
1971
|
-
set$
|
|
1979
|
+
set$5(rpc);
|
|
1972
1980
|
};
|
|
1973
1981
|
const send2 = async port => {
|
|
1974
1982
|
await sendMessagePortToEditorWorker(port, TestWorker);
|
|
@@ -1978,7 +1986,7 @@ const initializeEditorWorker = async () => {
|
|
|
1978
1986
|
commandMap: {},
|
|
1979
1987
|
send: send2
|
|
1980
1988
|
});
|
|
1981
|
-
set$
|
|
1989
|
+
set$8(rpc);
|
|
1982
1990
|
};
|
|
1983
1991
|
const send3 = port => {
|
|
1984
1992
|
return sendMessagePortToTextMeasurementWorker(port);
|
|
@@ -1990,6 +1998,16 @@ const initializeTextMeasurementWorker = async () => {
|
|
|
1990
1998
|
});
|
|
1991
1999
|
set$3(rpc);
|
|
1992
2000
|
};
|
|
2001
|
+
const send4 = port => {
|
|
2002
|
+
return sendMessagePortToTextMeasurementWorker(port);
|
|
2003
|
+
};
|
|
2004
|
+
const initializeProcessExplorer$1 = async () => {
|
|
2005
|
+
const rpc = await create$5({
|
|
2006
|
+
commandMap: {},
|
|
2007
|
+
send: send4
|
|
2008
|
+
});
|
|
2009
|
+
set$4(rpc);
|
|
2010
|
+
};
|
|
1993
2011
|
|
|
1994
2012
|
const RendererWorker = {
|
|
1995
2013
|
__proto__: null,
|
|
@@ -2039,6 +2057,7 @@ const RendererWorker = {
|
|
|
2039
2057
|
handleWorkspaceRefresh,
|
|
2040
2058
|
initializeEditorWorker,
|
|
2041
2059
|
initializeOpenerWorker,
|
|
2060
|
+
initializeProcessExplorer: initializeProcessExplorer$1,
|
|
2042
2061
|
initializeTextMeasurementWorker,
|
|
2043
2062
|
installExtension,
|
|
2044
2063
|
invoke: invoke$1,
|
|
@@ -2090,6 +2109,7 @@ const RendererWorker = {
|
|
|
2090
2109
|
sendMessagePortToMainAreaWorker,
|
|
2091
2110
|
sendMessagePortToMarkdownWorker,
|
|
2092
2111
|
sendMessagePortToOpenerWorker,
|
|
2112
|
+
sendMessagePortToProcessExplorer: sendMessagePortToProcessExplorer$1,
|
|
2093
2113
|
sendMessagePortToQuickPickWorker,
|
|
2094
2114
|
sendMessagePortToRendererProcess,
|
|
2095
2115
|
sendMessagePortToSearchProcess,
|
|
@@ -2439,7 +2459,7 @@ const handleContextMenu = async (state, index = state.focusedIndex, x = 0, y = 0
|
|
|
2439
2459
|
focused: false,
|
|
2440
2460
|
focusedIndex: index
|
|
2441
2461
|
};
|
|
2442
|
-
set$
|
|
2462
|
+
set$a(state.uid, state, newState);
|
|
2443
2463
|
await show2(state.uid, ProcessExplorer$1, x, y, {
|
|
2444
2464
|
index,
|
|
2445
2465
|
menuId: ProcessExplorer$1
|
|
@@ -2470,6 +2490,7 @@ const killProcess = async (state, index = state.focusedIndex) => {
|
|
|
2470
2490
|
};
|
|
2471
2491
|
|
|
2472
2492
|
const WindowPid = -1;
|
|
2493
|
+
const QueryOrHashRegex = /[?#]/;
|
|
2473
2494
|
const isValidMemoryValue = value => {
|
|
2474
2495
|
return typeof value === 'number' && Number.isFinite(value) && value >= 0;
|
|
2475
2496
|
};
|
|
@@ -2491,7 +2512,7 @@ const getUrlName = url => {
|
|
|
2491
2512
|
const parts = parsed.pathname.split('/').filter(Boolean);
|
|
2492
2513
|
return parts.at(-1) || parsed.hostname || url;
|
|
2493
2514
|
} catch {
|
|
2494
|
-
const withoutQuery = url.split(
|
|
2515
|
+
const withoutQuery = url.split(QueryOrHashRegex, 1)[0];
|
|
2495
2516
|
const parts = withoutQuery.split('/').filter(Boolean);
|
|
2496
2517
|
return parts.at(-1) || url;
|
|
2497
2518
|
}
|
|
@@ -2628,6 +2649,7 @@ const prepareError = async error => {
|
|
|
2628
2649
|
};
|
|
2629
2650
|
}
|
|
2630
2651
|
};
|
|
2652
|
+
|
|
2631
2653
|
const getFocusedIndex = (oldFocusedIndex, visibleProcesses) => {
|
|
2632
2654
|
if (visibleProcesses.length === 0) {
|
|
2633
2655
|
return -1;
|
|
@@ -2671,9 +2693,14 @@ const refresh = async state => {
|
|
|
2671
2693
|
}
|
|
2672
2694
|
};
|
|
2673
2695
|
|
|
2696
|
+
const hasError$1 = state => {
|
|
2697
|
+
return Boolean(state.errorMessage || state.errorCodeFrame || state.errorStack);
|
|
2698
|
+
};
|
|
2674
2699
|
const loadContent = async state => {
|
|
2675
2700
|
const newState = await refresh(state);
|
|
2676
|
-
|
|
2701
|
+
if (!hasError$1(newState)) {
|
|
2702
|
+
start(newState.uid);
|
|
2703
|
+
}
|
|
2677
2704
|
return {
|
|
2678
2705
|
error: undefined,
|
|
2679
2706
|
state: newState
|
|
@@ -3190,7 +3217,7 @@ const render2 = (uid, diffResult) => {
|
|
|
3190
3217
|
oldState,
|
|
3191
3218
|
scheduledState
|
|
3192
3219
|
} = get$2(uid);
|
|
3193
|
-
set$
|
|
3220
|
+
set$a(uid, scheduledState, scheduledState);
|
|
3194
3221
|
return applyRender(oldState, scheduledState, diffResult);
|
|
3195
3222
|
};
|
|
3196
3223
|
|
|
@@ -3219,6 +3246,49 @@ const renderEventListeners = () => {
|
|
|
3219
3246
|
}];
|
|
3220
3247
|
};
|
|
3221
3248
|
|
|
3249
|
+
const isRawError = value => {
|
|
3250
|
+
return Boolean(value && typeof value === 'object');
|
|
3251
|
+
};
|
|
3252
|
+
const getRawMessage = rawError => {
|
|
3253
|
+
if (typeof rawError.message === 'string') {
|
|
3254
|
+
return rawError.message;
|
|
3255
|
+
}
|
|
3256
|
+
return String(rawError.message);
|
|
3257
|
+
};
|
|
3258
|
+
const toError = rawError => {
|
|
3259
|
+
if (rawError instanceof Error) {
|
|
3260
|
+
return rawError;
|
|
3261
|
+
}
|
|
3262
|
+
if (!isRawError(rawError)) {
|
|
3263
|
+
return new Error(String(rawError));
|
|
3264
|
+
}
|
|
3265
|
+
if (typeof rawError.stack === 'string') {
|
|
3266
|
+
return {
|
|
3267
|
+
code: rawError.code,
|
|
3268
|
+
message: getRawMessage(rawError),
|
|
3269
|
+
stack: rawError.stack
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
3272
|
+
const error = new Error(getRawMessage(rawError));
|
|
3273
|
+
if (typeof rawError.code === 'string') {
|
|
3274
|
+
Object.assign(error, {
|
|
3275
|
+
code: rawError.code
|
|
3276
|
+
});
|
|
3277
|
+
}
|
|
3278
|
+
return error;
|
|
3279
|
+
};
|
|
3280
|
+
const setError = async (state, rawError) => {
|
|
3281
|
+
const error = toError(rawError);
|
|
3282
|
+
const prettyError = await prepareError(error);
|
|
3283
|
+
return {
|
|
3284
|
+
...state,
|
|
3285
|
+
errorCodeFrame: prettyError.codeFrame || '',
|
|
3286
|
+
errorMessage: prettyError.message || getErrorMessage(error),
|
|
3287
|
+
errorStack: prettyError.stack || '',
|
|
3288
|
+
initial: false
|
|
3289
|
+
};
|
|
3290
|
+
};
|
|
3291
|
+
|
|
3222
3292
|
const commandMap = {
|
|
3223
3293
|
'ProcessExplorer.collapseAll': wrapCommand(collapseAll),
|
|
3224
3294
|
'ProcessExplorer.create': create$d,
|
|
@@ -3246,6 +3316,7 @@ const commandMap = {
|
|
|
3246
3316
|
'ProcessExplorer.refresh': wrapCommand(refresh),
|
|
3247
3317
|
'ProcessExplorer.render2': render2,
|
|
3248
3318
|
'ProcessExplorer.renderEventListeners': renderEventListeners,
|
|
3319
|
+
'ProcessExplorer.setError': wrapCommand(setError),
|
|
3249
3320
|
'ProcessExplorer.terminate': terminate,
|
|
3250
3321
|
'ProcessExplorer.update': wrapCommand(refresh)
|
|
3251
3322
|
};
|
|
@@ -3268,7 +3339,7 @@ const createErrorWorkerRpc = async () => {
|
|
|
3268
3339
|
|
|
3269
3340
|
const initializeErrorWorker = async () => {
|
|
3270
3341
|
const rpc = await createErrorWorkerRpc();
|
|
3271
|
-
set$
|
|
3342
|
+
set$7(rpc);
|
|
3272
3343
|
};
|
|
3273
3344
|
|
|
3274
3345
|
const sendMessagePortToFileSystemWorker = async port => {
|