@lvce-editor/source-control-worker 2.20.0 → 2.23.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/dist/sourceControlWorkerMain.js +138 -104
- package/package.json +2 -2
|
@@ -231,8 +231,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
231
231
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
232
232
|
const message = lines[messageIndex];
|
|
233
233
|
return {
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
235
|
+
message
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
238
|
const isModuleNotFoundError = stderr => {
|
|
@@ -255,14 +255,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
255
255
|
const getNativeModuleErrorMessage = stderr => {
|
|
256
256
|
const message = getMessageCodeBlock(stderr);
|
|
257
257
|
return {
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
259
|
+
message: `Incompatible native node module: ${message}`
|
|
260
260
|
};
|
|
261
261
|
};
|
|
262
262
|
const getModuleSyntaxError = () => {
|
|
263
263
|
return {
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
265
|
+
message: `ES Modules are not supported in electron`
|
|
266
266
|
};
|
|
267
267
|
};
|
|
268
268
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -281,8 +281,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
281
281
|
rest
|
|
282
282
|
} = getDetails(lines);
|
|
283
283
|
return {
|
|
284
|
-
message: actualMessage,
|
|
285
284
|
code: '',
|
|
285
|
+
message: actualMessage,
|
|
286
286
|
stack: rest
|
|
287
287
|
};
|
|
288
288
|
};
|
|
@@ -292,8 +292,8 @@ class IpcError extends VError {
|
|
|
292
292
|
if (stdout || stderr) {
|
|
293
293
|
// @ts-ignore
|
|
294
294
|
const {
|
|
295
|
-
message,
|
|
296
295
|
code,
|
|
296
|
+
message,
|
|
297
297
|
stack
|
|
298
298
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
299
299
|
const cause = new Error(message);
|
|
@@ -354,8 +354,8 @@ const wrap$f = global => {
|
|
|
354
354
|
};
|
|
355
355
|
const waitForFirstMessage = async port => {
|
|
356
356
|
const {
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
promise,
|
|
358
|
+
resolve
|
|
359
359
|
} = Promise.withResolvers();
|
|
360
360
|
port.addEventListener('message', resolve, {
|
|
361
361
|
once: true
|
|
@@ -375,8 +375,8 @@ const listen$6 = async () => {
|
|
|
375
375
|
const type = firstMessage.params[0];
|
|
376
376
|
if (type === 'message-port') {
|
|
377
377
|
parentIpc.send({
|
|
378
|
-
jsonrpc: '2.0',
|
|
379
378
|
id: firstMessage.id,
|
|
379
|
+
jsonrpc: '2.0',
|
|
380
380
|
result: null
|
|
381
381
|
});
|
|
382
382
|
parentIpc.dispose();
|
|
@@ -433,8 +433,8 @@ const removeListener = (emitter, type, callback) => {
|
|
|
433
433
|
};
|
|
434
434
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
435
435
|
const {
|
|
436
|
-
|
|
437
|
-
|
|
436
|
+
promise,
|
|
437
|
+
resolve
|
|
438
438
|
} = Promise.withResolvers();
|
|
439
439
|
const listenerMap = Object.create(null);
|
|
440
440
|
const cleanup = value => {
|
|
@@ -446,8 +446,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
446
446
|
for (const [event, type] of Object.entries(eventMap)) {
|
|
447
447
|
const listener = event => {
|
|
448
448
|
cleanup({
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
event,
|
|
450
|
+
type
|
|
451
451
|
});
|
|
452
452
|
};
|
|
453
453
|
addListener(eventEmitter, event, listener);
|
|
@@ -457,8 +457,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
457
457
|
};
|
|
458
458
|
const Message$1 = 3;
|
|
459
459
|
const create$5$1 = async ({
|
|
460
|
-
|
|
461
|
-
|
|
460
|
+
isMessagePortOpen,
|
|
461
|
+
messagePort
|
|
462
462
|
}) => {
|
|
463
463
|
if (!isMessagePort(messagePort)) {
|
|
464
464
|
throw new IpcError('port must be of type MessagePort');
|
|
@@ -471,8 +471,8 @@ const create$5$1 = async ({
|
|
|
471
471
|
});
|
|
472
472
|
messagePort.start();
|
|
473
473
|
const {
|
|
474
|
-
|
|
475
|
-
|
|
474
|
+
event,
|
|
475
|
+
type
|
|
476
476
|
} = await eventPromise;
|
|
477
477
|
if (type !== Message$1) {
|
|
478
478
|
throw new IpcError('Failed to wait for ipc message');
|
|
@@ -1018,26 +1018,11 @@ const WebWorkerRpcClient = {
|
|
|
1018
1018
|
create: create$2
|
|
1019
1019
|
};
|
|
1020
1020
|
|
|
1021
|
-
const None$1 = 'none';
|
|
1022
|
-
const ToolBar = 'toolbar';
|
|
1023
|
-
const Tree$1 = 'tree';
|
|
1024
|
-
const TreeItem$1 = 'treeitem';
|
|
1025
|
-
|
|
1026
|
-
const Badge = 'Badge';
|
|
1027
|
-
const SourceControlBadge = 'SourceControlBadge';
|
|
1028
|
-
|
|
1029
1021
|
const Directory = 3;
|
|
1030
1022
|
const DirectoryExpanded = 4;
|
|
1031
1023
|
const File = 7;
|
|
1032
1024
|
|
|
1033
|
-
const Button$2 =
|
|
1034
|
-
const Div = 4;
|
|
1035
|
-
const Span = 8;
|
|
1036
|
-
const Text = 12;
|
|
1037
|
-
const Img = 17;
|
|
1038
|
-
const TextArea = 62;
|
|
1039
|
-
|
|
1040
|
-
const Button$1 = 'event.button';
|
|
1025
|
+
const Button$2 = 'event.button';
|
|
1041
1026
|
const ClientX = 'event.clientX';
|
|
1042
1027
|
const ClientY = 'event.clientY';
|
|
1043
1028
|
const DeltaMode = 'event.deltaMode';
|
|
@@ -1045,21 +1030,17 @@ const DeltaY = 'event.deltaY';
|
|
|
1045
1030
|
const TargetName = 'event.target.name';
|
|
1046
1031
|
const TargetValue = 'event.target.value';
|
|
1047
1032
|
|
|
1048
|
-
const Enter = 3;
|
|
1049
|
-
|
|
1050
1033
|
const User = 1;
|
|
1051
1034
|
const Script = 2;
|
|
1052
1035
|
|
|
1053
|
-
const CtrlCmd = 1 << 11 >>> 0;
|
|
1054
|
-
|
|
1055
1036
|
const SourceControl$1 = 22;
|
|
1056
1037
|
|
|
1057
|
-
const None = 0;
|
|
1038
|
+
const None$1 = 0;
|
|
1058
1039
|
|
|
1059
1040
|
const ExtensionHostWorker = 44;
|
|
1041
|
+
const IconThemeWorker = 7009;
|
|
1060
1042
|
const RendererWorker = 1;
|
|
1061
1043
|
const SourceControlWorker = 66;
|
|
1062
|
-
const IconThemeWorker = 7009;
|
|
1063
1044
|
|
|
1064
1045
|
const SetCss = 'Viewlet.setCss';
|
|
1065
1046
|
const SetDom2 = 'Viewlet.setDom2';
|
|
@@ -1067,7 +1048,7 @@ const SetFocusContext = 'Viewlet.setFocusContext';
|
|
|
1067
1048
|
const SetValueByName = 'Viewlet.setValueByName';
|
|
1068
1049
|
|
|
1069
1050
|
const List = 1;
|
|
1070
|
-
const Tree = 2;
|
|
1051
|
+
const Tree$1 = 2;
|
|
1071
1052
|
|
|
1072
1053
|
const FocusSourceControlInput = 24;
|
|
1073
1054
|
|
|
@@ -1081,6 +1062,10 @@ const get$2 = id => {
|
|
|
1081
1062
|
|
|
1082
1063
|
const create$1 = rpcId => {
|
|
1083
1064
|
return {
|
|
1065
|
+
async dispose() {
|
|
1066
|
+
const rpc = get$2(rpcId);
|
|
1067
|
+
await rpc.dispose();
|
|
1068
|
+
},
|
|
1084
1069
|
// @ts-ignore
|
|
1085
1070
|
invoke(method, ...params) {
|
|
1086
1071
|
const rpc = get$2(rpcId);
|
|
@@ -1095,22 +1080,20 @@ const create$1 = rpcId => {
|
|
|
1095
1080
|
},
|
|
1096
1081
|
set(rpc) {
|
|
1097
1082
|
set$4(rpcId, rpc);
|
|
1098
|
-
},
|
|
1099
|
-
async dispose() {
|
|
1100
|
-
const rpc = get$2(rpcId);
|
|
1101
|
-
await rpc.dispose();
|
|
1102
1083
|
}
|
|
1103
1084
|
};
|
|
1104
1085
|
};
|
|
1105
1086
|
|
|
1106
1087
|
const {
|
|
1107
1088
|
invoke: invoke$1,
|
|
1108
|
-
set: set$3
|
|
1089
|
+
set: set$3
|
|
1090
|
+
} = create$1(ExtensionHostWorker);
|
|
1109
1091
|
|
|
1110
1092
|
const {
|
|
1111
1093
|
invoke,
|
|
1112
1094
|
invokeAndTransfer,
|
|
1113
|
-
set: set$2
|
|
1095
|
+
set: set$2
|
|
1096
|
+
} = create$1(RendererWorker);
|
|
1114
1097
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1115
1098
|
number(uid);
|
|
1116
1099
|
number(menuId);
|
|
@@ -1126,8 +1109,8 @@ const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
|
1126
1109
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1127
1110
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1128
1111
|
};
|
|
1129
|
-
const activateByEvent$1 = event => {
|
|
1130
|
-
return invoke('ExtensionHostManagement.activateByEvent', event);
|
|
1112
|
+
const activateByEvent$1 = (event, assetDir, platform) => {
|
|
1113
|
+
return invoke('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
|
|
1131
1114
|
};
|
|
1132
1115
|
const sendMessagePortToTextMeasurementWorker$1 = async port => {
|
|
1133
1116
|
const command = 'TextMeasurement.handleMessagePort';
|
|
@@ -1142,7 +1125,8 @@ const openUri$1 = async (uri, focus, options) => {
|
|
|
1142
1125
|
};
|
|
1143
1126
|
|
|
1144
1127
|
const {
|
|
1145
|
-
set: set$1
|
|
1128
|
+
set: set$1
|
|
1129
|
+
} = create$1(IconThemeWorker);
|
|
1146
1130
|
|
|
1147
1131
|
const toCommandId = key => {
|
|
1148
1132
|
const dotIndex = key.indexOf('.');
|
|
@@ -1381,16 +1365,21 @@ const getFinalDeltaY = (height, itemHeight, itemsLength) => {
|
|
|
1381
1365
|
return finalDeltaY;
|
|
1382
1366
|
};
|
|
1383
1367
|
|
|
1384
|
-
const activateByEvent = event => {
|
|
1385
|
-
|
|
1368
|
+
const activateByEvent = (event, assetDir, platform) => {
|
|
1369
|
+
string(event);
|
|
1370
|
+
string(assetDir);
|
|
1371
|
+
number(platform);
|
|
1372
|
+
return activateByEvent$1(event, assetDir, platform);
|
|
1386
1373
|
};
|
|
1387
1374
|
|
|
1388
1375
|
const executeProvider = async ({
|
|
1376
|
+
assetDir,
|
|
1389
1377
|
event,
|
|
1390
1378
|
method,
|
|
1391
|
-
params
|
|
1379
|
+
params,
|
|
1380
|
+
platform
|
|
1392
1381
|
}) => {
|
|
1393
|
-
await activateByEvent(event);
|
|
1382
|
+
await activateByEvent(event, assetDir, platform);
|
|
1394
1383
|
// @ts-ignore
|
|
1395
1384
|
const result = await invoke$1(method, ...params);
|
|
1396
1385
|
return result;
|
|
@@ -1403,42 +1392,54 @@ const SourceControlGetEnabledProviderIds = 'ExtensionHostSourceControl.getEnable
|
|
|
1403
1392
|
const SourceControlGetFileBefore = 'ExtensionHostSourceControl.getFileBefore';
|
|
1404
1393
|
const SourceControlGetGroups = 'ExtensionHostSourceControl.getGroups';
|
|
1405
1394
|
|
|
1406
|
-
const acceptInput$2 = async (providerId, text) => {
|
|
1395
|
+
const acceptInput$2 = async (providerId, text, assetDir, platform) => {
|
|
1407
1396
|
return executeProvider({
|
|
1397
|
+
assetDir,
|
|
1408
1398
|
event: 'none',
|
|
1409
1399
|
method: SourceControlAcceptInput,
|
|
1410
|
-
params: [providerId, text]
|
|
1400
|
+
params: [providerId, text],
|
|
1401
|
+
platform
|
|
1411
1402
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1412
1403
|
});
|
|
1413
1404
|
};
|
|
1414
|
-
const getFileDecorations$1 = (providerId, uris) => {
|
|
1405
|
+
const getFileDecorations$1 = (providerId, uris, assetDir, platform) => {
|
|
1406
|
+
string(assetDir);
|
|
1407
|
+
number(platform);
|
|
1415
1408
|
return executeProvider({
|
|
1409
|
+
assetDir,
|
|
1416
1410
|
event: 'none',
|
|
1417
1411
|
method: SourceControlGetFileDecorations,
|
|
1418
|
-
params: [providerId, uris]
|
|
1412
|
+
params: [providerId, uris],
|
|
1413
|
+
platform
|
|
1419
1414
|
});
|
|
1420
1415
|
};
|
|
1421
|
-
const getFileBefore$1 = (providerId, path) => {
|
|
1416
|
+
const getFileBefore$1 = (providerId, path, assetDir, platform) => {
|
|
1422
1417
|
return executeProvider({
|
|
1418
|
+
assetDir,
|
|
1423
1419
|
event: 'none',
|
|
1424
1420
|
method: SourceControlGetFileBefore,
|
|
1425
|
-
params: [providerId, path]
|
|
1421
|
+
params: [providerId, path],
|
|
1422
|
+
platform
|
|
1426
1423
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1427
1424
|
});
|
|
1428
1425
|
};
|
|
1429
|
-
const getGroups$2 = (providerId, path) => {
|
|
1426
|
+
const getGroups$2 = (providerId, path, assetDir, platform) => {
|
|
1430
1427
|
return executeProvider({
|
|
1428
|
+
assetDir,
|
|
1431
1429
|
event: 'none',
|
|
1432
1430
|
method: SourceControlGetGroups,
|
|
1433
|
-
params: [providerId, path]
|
|
1431
|
+
params: [providerId, path],
|
|
1432
|
+
platform
|
|
1434
1433
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1435
1434
|
});
|
|
1436
1435
|
};
|
|
1437
|
-
const getEnabledProviderIds$1 = (scheme, root) => {
|
|
1436
|
+
const getEnabledProviderIds$1 = (scheme, root, assetDir, platform) => {
|
|
1438
1437
|
return executeProvider({
|
|
1438
|
+
assetDir,
|
|
1439
1439
|
event: `onSourceControl:${scheme}`,
|
|
1440
1440
|
method: SourceControlGetEnabledProviderIds,
|
|
1441
|
-
params: [scheme, root]
|
|
1441
|
+
params: [scheme, root],
|
|
1442
|
+
platform
|
|
1442
1443
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1443
1444
|
});
|
|
1444
1445
|
};
|
|
@@ -1448,24 +1449,24 @@ const getIconDefinitions$1 = async providerId => {
|
|
|
1448
1449
|
return result;
|
|
1449
1450
|
};
|
|
1450
1451
|
|
|
1451
|
-
const acceptInput$1 = (providerId, text) => {
|
|
1452
|
+
const acceptInput$1 = (providerId, text, assetDir, platform) => {
|
|
1452
1453
|
string(providerId);
|
|
1453
1454
|
string(text);
|
|
1454
|
-
return acceptInput$2(providerId, text);
|
|
1455
|
+
return acceptInput$2(providerId, text, assetDir, platform);
|
|
1455
1456
|
};
|
|
1456
|
-
const getFileDecorations = (providerId, uris) => {
|
|
1457
|
-
return getFileDecorations$1(providerId, uris);
|
|
1457
|
+
const getFileDecorations = (providerId, uris, assetDir, platform) => {
|
|
1458
|
+
return getFileDecorations$1(providerId, uris, assetDir, platform);
|
|
1458
1459
|
};
|
|
1459
|
-
const getFileBefore = (providerId, file) => {
|
|
1460
|
-
return getFileBefore$1(providerId, file);
|
|
1460
|
+
const getFileBefore = (providerId, file, assetDir, platform) => {
|
|
1461
|
+
return getFileBefore$1(providerId, file, assetDir, platform);
|
|
1461
1462
|
};
|
|
1462
|
-
const getEnabledProviderIds = (scheme, root) => {
|
|
1463
|
+
const getEnabledProviderIds = (scheme, root, assetDir, platform) => {
|
|
1463
1464
|
string(scheme);
|
|
1464
1465
|
string(root);
|
|
1465
|
-
return getEnabledProviderIds$1(scheme, root);
|
|
1466
|
+
return getEnabledProviderIds$1(scheme, root, assetDir, platform);
|
|
1466
1467
|
};
|
|
1467
|
-
const getGroups$1 = (providerId, root) => {
|
|
1468
|
-
return getGroups$2(providerId, root);
|
|
1468
|
+
const getGroups$1 = (providerId, root, assetDir, platform) => {
|
|
1469
|
+
return getGroups$2(providerId, root, assetDir, platform);
|
|
1469
1470
|
};
|
|
1470
1471
|
const getIconDefinitions = async providerIds => {
|
|
1471
1472
|
try {
|
|
@@ -1478,11 +1479,10 @@ const getIconDefinitions = async providerIds => {
|
|
|
1478
1479
|
}
|
|
1479
1480
|
};
|
|
1480
1481
|
|
|
1481
|
-
const getGroups = async enabledProviderIds => {
|
|
1482
|
+
const getGroups = async (enabledProviderIds, root, assetDir, platform) => {
|
|
1482
1483
|
const allGroups = [];
|
|
1483
1484
|
for (const providerId of enabledProviderIds) {
|
|
1484
|
-
|
|
1485
|
-
const groups = await getGroups$1(providerId);
|
|
1485
|
+
const groups = await getGroups$1(providerId, root, assetDir, platform);
|
|
1486
1486
|
allGroups.push(...groups);
|
|
1487
1487
|
}
|
|
1488
1488
|
return {
|
|
@@ -1721,12 +1721,16 @@ const loadContent = async (state, savedState) => {
|
|
|
1721
1721
|
const {
|
|
1722
1722
|
inputValue
|
|
1723
1723
|
} = restoreState(savedState);
|
|
1724
|
-
const
|
|
1724
|
+
const {
|
|
1725
|
+
assetDir,
|
|
1726
|
+
platform
|
|
1727
|
+
} = state;
|
|
1728
|
+
const enabledProviderIds = await getEnabledProviderIds(scheme, root, assetDir, platform);
|
|
1725
1729
|
const iconDefinitions = await getIconDefinitions(enabledProviderIds);
|
|
1726
1730
|
const {
|
|
1727
1731
|
allGroups,
|
|
1728
1732
|
gitRoot
|
|
1729
|
-
} = await getGroups(enabledProviderIds);
|
|
1733
|
+
} = await getGroups(enabledProviderIds, root, assetDir, platform);
|
|
1730
1734
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
1731
1735
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
1732
1736
|
const actionsCache = await requestSourceActions();
|
|
@@ -1781,15 +1785,17 @@ const warn = (...args) => {
|
|
|
1781
1785
|
|
|
1782
1786
|
const acceptInput = async state => {
|
|
1783
1787
|
const {
|
|
1788
|
+
assetDir,
|
|
1784
1789
|
enabledProviderIds,
|
|
1785
|
-
inputValue
|
|
1790
|
+
inputValue,
|
|
1791
|
+
platform
|
|
1786
1792
|
} = state;
|
|
1787
1793
|
if (enabledProviderIds.length === 0) {
|
|
1788
1794
|
info('[ViewletSourceControl] no source control provider found');
|
|
1789
1795
|
return state;
|
|
1790
1796
|
}
|
|
1791
1797
|
const providerId = enabledProviderIds[0];
|
|
1792
|
-
await acceptInput$1(providerId, inputValue);
|
|
1798
|
+
await acceptInput$1(providerId, inputValue, assetDir, platform);
|
|
1793
1799
|
const newState = await loadContent(state, {});
|
|
1794
1800
|
return {
|
|
1795
1801
|
...newState,
|
|
@@ -1806,10 +1812,11 @@ const {
|
|
|
1806
1812
|
wrapGetter
|
|
1807
1813
|
} = create();
|
|
1808
1814
|
|
|
1809
|
-
const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
1815
|
+
const create2 = (id, uri, x, y, width, height, workspacePath, platform, assetDir) => {
|
|
1810
1816
|
const state = {
|
|
1811
1817
|
actionsCache: Object.create(null),
|
|
1812
1818
|
allGroups: [],
|
|
1819
|
+
assetDir,
|
|
1813
1820
|
badgeCount: 0,
|
|
1814
1821
|
decorationIcons: [],
|
|
1815
1822
|
deltaY: 0,
|
|
@@ -1846,6 +1853,7 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1846
1853
|
merge: [],
|
|
1847
1854
|
minimumSliderSize: 20,
|
|
1848
1855
|
minLineY: 0,
|
|
1856
|
+
platform,
|
|
1849
1857
|
providerId: '',
|
|
1850
1858
|
root: '',
|
|
1851
1859
|
scrollBarActive: false,
|
|
@@ -1920,6 +1928,25 @@ const getInfo = uid => {
|
|
|
1920
1928
|
return newState.allGroups;
|
|
1921
1929
|
};
|
|
1922
1930
|
|
|
1931
|
+
const None = 'none';
|
|
1932
|
+
const ToolBar = 'toolbar';
|
|
1933
|
+
const Tree = 'tree';
|
|
1934
|
+
const TreeItem$1 = 'treeitem';
|
|
1935
|
+
|
|
1936
|
+
const Badge = 'Badge';
|
|
1937
|
+
const SourceControlBadge = 'SourceControlBadge';
|
|
1938
|
+
|
|
1939
|
+
const Button$1 = 1;
|
|
1940
|
+
const Div = 4;
|
|
1941
|
+
const Span = 8;
|
|
1942
|
+
const Text = 12;
|
|
1943
|
+
const Img = 17;
|
|
1944
|
+
const TextArea = 62;
|
|
1945
|
+
|
|
1946
|
+
const Enter = 3;
|
|
1947
|
+
|
|
1948
|
+
const CtrlCmd = 1 << 11 >>> 0;
|
|
1949
|
+
|
|
1923
1950
|
const mergeClassNames = (...classNames) => {
|
|
1924
1951
|
return classNames.filter(Boolean).join(' ');
|
|
1925
1952
|
};
|
|
@@ -1943,42 +1970,42 @@ const getKeyBindings = () => {
|
|
|
1943
1970
|
const getMenuEntries = () => {
|
|
1944
1971
|
return [{
|
|
1945
1972
|
command: /* TODO */'-1',
|
|
1946
|
-
flags: None,
|
|
1973
|
+
flags: None$1,
|
|
1947
1974
|
id: '',
|
|
1948
1975
|
label: openChanges()
|
|
1949
1976
|
}, {
|
|
1950
1977
|
command: /* TODO */'-1',
|
|
1951
|
-
flags: None,
|
|
1978
|
+
flags: None$1,
|
|
1952
1979
|
id: '',
|
|
1953
1980
|
label: openFile()
|
|
1954
1981
|
}, {
|
|
1955
1982
|
command: /* TODO */'-1',
|
|
1956
|
-
flags: None,
|
|
1983
|
+
flags: None$1,
|
|
1957
1984
|
id: '',
|
|
1958
1985
|
label: openFileHead()
|
|
1959
1986
|
}, {
|
|
1960
1987
|
command: /* TODO */'-1',
|
|
1961
|
-
flags: None,
|
|
1988
|
+
flags: None$1,
|
|
1962
1989
|
id: '',
|
|
1963
1990
|
label: discardChanges()
|
|
1964
1991
|
}, {
|
|
1965
1992
|
command: /* TODO */'-1',
|
|
1966
|
-
flags: None,
|
|
1993
|
+
flags: None$1,
|
|
1967
1994
|
id: '',
|
|
1968
1995
|
label: stageChanges()
|
|
1969
1996
|
}, {
|
|
1970
1997
|
command: /* TODO */'-1',
|
|
1971
|
-
flags: None,
|
|
1998
|
+
flags: None$1,
|
|
1972
1999
|
id: '',
|
|
1973
2000
|
label: addToGitignore()
|
|
1974
2001
|
}, {
|
|
1975
2002
|
command: /* TODO */'-1',
|
|
1976
|
-
flags: None,
|
|
2003
|
+
flags: None$1,
|
|
1977
2004
|
id: '',
|
|
1978
2005
|
label: revealInExplorerView()
|
|
1979
2006
|
}, {
|
|
1980
2007
|
command: /* TODO */'-1',
|
|
1981
|
-
flags: None,
|
|
2008
|
+
flags: None$1,
|
|
1982
2009
|
id: '',
|
|
1983
2010
|
label: openContainingFolder()
|
|
1984
2011
|
}];
|
|
@@ -2000,18 +2027,21 @@ const Refresh$1 = 'Refresh';
|
|
|
2000
2027
|
const refresh = async state => {
|
|
2001
2028
|
const {
|
|
2002
2029
|
actionsCache,
|
|
2030
|
+
assetDir,
|
|
2003
2031
|
enabledProviderIds,
|
|
2004
2032
|
fileIconCache,
|
|
2005
2033
|
height,
|
|
2006
2034
|
iconDefinitions,
|
|
2007
2035
|
itemHeight,
|
|
2008
2036
|
minimumSliderSize,
|
|
2037
|
+
platform,
|
|
2038
|
+
root,
|
|
2009
2039
|
splitButtonEnabled
|
|
2010
2040
|
} = state;
|
|
2011
2041
|
const {
|
|
2012
2042
|
allGroups,
|
|
2013
2043
|
gitRoot
|
|
2014
|
-
} = await getGroups(enabledProviderIds);
|
|
2044
|
+
} = await getGroups(enabledProviderIds, root, assetDir, platform);
|
|
2015
2045
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2016
2046
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2017
2047
|
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
@@ -2045,7 +2075,7 @@ const refresh = async state => {
|
|
|
2045
2075
|
const viewAsTree = state => {
|
|
2046
2076
|
return {
|
|
2047
2077
|
...state,
|
|
2048
|
-
viewMode: Tree
|
|
2078
|
+
viewMode: Tree$1
|
|
2049
2079
|
};
|
|
2050
2080
|
};
|
|
2051
2081
|
|
|
@@ -2064,11 +2094,13 @@ const handleActionClick = async (state, actionName) => {
|
|
|
2064
2094
|
}
|
|
2065
2095
|
};
|
|
2066
2096
|
|
|
2067
|
-
const executeCommand = (id, ...args) => {
|
|
2097
|
+
const executeCommand = (id, assetDir, platform, ...args) => {
|
|
2068
2098
|
return executeProvider({
|
|
2099
|
+
assetDir,
|
|
2069
2100
|
event: `onCommand:${id}`,
|
|
2070
2101
|
method: CommandExecute,
|
|
2071
|
-
params: [id, ...args]
|
|
2102
|
+
params: [id, ...args],
|
|
2103
|
+
platform
|
|
2072
2104
|
});
|
|
2073
2105
|
};
|
|
2074
2106
|
|
|
@@ -2081,7 +2113,7 @@ const handleButtonClick = async (state, clickedIndex) => {
|
|
|
2081
2113
|
if (!button) {
|
|
2082
2114
|
return state;
|
|
2083
2115
|
}
|
|
2084
|
-
await executeCommand(button.command, item.file);
|
|
2116
|
+
await executeCommand(button.command, state.assetDir, state.platform, item.file);
|
|
2085
2117
|
const newState = await loadContent(state, {});
|
|
2086
2118
|
return newState;
|
|
2087
2119
|
};
|
|
@@ -2116,7 +2148,7 @@ const handleClickSourceControlButtons = async (state, index, name) => {
|
|
|
2116
2148
|
const {
|
|
2117
2149
|
file
|
|
2118
2150
|
} = item;
|
|
2119
|
-
await executeCommand(button.command, file);
|
|
2151
|
+
await executeCommand(button.command, state.assetDir, state.platform, file);
|
|
2120
2152
|
const newState = await refresh(state);
|
|
2121
2153
|
return newState;
|
|
2122
2154
|
};
|
|
@@ -2190,13 +2222,15 @@ const openDiffEditor = async (before, afterPath, width) => {
|
|
|
2190
2222
|
|
|
2191
2223
|
const handleClickFile = async (state, item) => {
|
|
2192
2224
|
const {
|
|
2225
|
+
assetDir,
|
|
2193
2226
|
enabledProviderIds,
|
|
2227
|
+
platform,
|
|
2194
2228
|
root
|
|
2195
2229
|
} = state;
|
|
2196
2230
|
const providerId = enabledProviderIds[0];
|
|
2197
2231
|
const absolutePath = `${root}/${item.file}`;
|
|
2198
2232
|
// TODO handle error
|
|
2199
|
-
const [fileBefore] = await Promise.all([getFileBefore(providerId, item.file), readFile(absolutePath)]);
|
|
2233
|
+
const [fileBefore] = await Promise.all([getFileBefore(providerId, item.file, assetDir, platform), readFile(absolutePath)]);
|
|
2200
2234
|
|
|
2201
2235
|
// TODO diff editor should determine width by itself
|
|
2202
2236
|
await openDiffEditor(fileBefore, absolutePath);
|
|
@@ -2510,7 +2544,7 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
2510
2544
|
return {
|
|
2511
2545
|
childCount: 0,
|
|
2512
2546
|
className: `MaskIcon MaskIcon${icon}`,
|
|
2513
|
-
role: None
|
|
2547
|
+
role: None,
|
|
2514
2548
|
type
|
|
2515
2549
|
};
|
|
2516
2550
|
};
|
|
@@ -2526,7 +2560,7 @@ const getButtonVirtualDom = button => {
|
|
|
2526
2560
|
className: SourceControlButton,
|
|
2527
2561
|
name: label,
|
|
2528
2562
|
title: label,
|
|
2529
|
-
type: Button$
|
|
2563
|
+
type: Button$1
|
|
2530
2564
|
}, getIconVirtualDom(icon, Span)];
|
|
2531
2565
|
};
|
|
2532
2566
|
|
|
@@ -2598,7 +2632,7 @@ const getFileIconVirtualDom = icon => {
|
|
|
2598
2632
|
return {
|
|
2599
2633
|
childCount: 0,
|
|
2600
2634
|
className: FileIcon,
|
|
2601
|
-
role: None
|
|
2635
|
+
role: None,
|
|
2602
2636
|
src: icon,
|
|
2603
2637
|
type: Img
|
|
2604
2638
|
};
|
|
@@ -2687,7 +2721,7 @@ const getSourceControlListVirtualDom = items => {
|
|
|
2687
2721
|
onClick: HandleClickAt,
|
|
2688
2722
|
onPointerOut: HandleMouseOutAt,
|
|
2689
2723
|
onPointerOver: HandleMouseOverAt,
|
|
2690
|
-
role: Tree
|
|
2724
|
+
role: Tree,
|
|
2691
2725
|
type: Div
|
|
2692
2726
|
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
2693
2727
|
};
|
|
@@ -2832,7 +2866,7 @@ const getActionButtonVirtualDom = action => {
|
|
|
2832
2866
|
className: IconButton,
|
|
2833
2867
|
name: label,
|
|
2834
2868
|
title: id,
|
|
2835
|
-
type: Button$
|
|
2869
|
+
type: Button$1
|
|
2836
2870
|
}, getIconVirtualDom(icon)];
|
|
2837
2871
|
};
|
|
2838
2872
|
|
|
@@ -2893,7 +2927,7 @@ const renderEventListeners = () => {
|
|
|
2893
2927
|
params: ['handleInput', TargetValue]
|
|
2894
2928
|
}, {
|
|
2895
2929
|
name: HandleContextMenu,
|
|
2896
|
-
params: ['handleContextMenu', Button$
|
|
2930
|
+
params: ['handleContextMenu', Button$2, ClientX, ClientY],
|
|
2897
2931
|
preventDefault: true
|
|
2898
2932
|
}, {
|
|
2899
2933
|
name: HandleWheel,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/source-control-worker",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "Source Control Worker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lvce Editor"
|
|
7
7
|
],
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/lvce-editor/source-control-
|
|
10
|
+
"url": "git+https://github.com/lvce-editor/source-control-view.git"
|
|
11
11
|
},
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"author": "Lvce Editor",
|