@lvce-editor/source-control-worker 3.11.0 → 3.13.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 +95 -35
- package/package.json +1 -1
|
@@ -1075,7 +1075,7 @@ const createMockRpc = ({
|
|
|
1075
1075
|
};
|
|
1076
1076
|
|
|
1077
1077
|
const rpcs = Object.create(null);
|
|
1078
|
-
const set$
|
|
1078
|
+
const set$7 = (id, rpc) => {
|
|
1079
1079
|
rpcs[id] = rpc;
|
|
1080
1080
|
};
|
|
1081
1081
|
const get$2 = id => {
|
|
@@ -1108,7 +1108,7 @@ const create$1 = rpcId => {
|
|
|
1108
1108
|
const mockRpc = createMockRpc({
|
|
1109
1109
|
commandMap
|
|
1110
1110
|
});
|
|
1111
|
-
set$
|
|
1111
|
+
set$7(rpcId, mockRpc);
|
|
1112
1112
|
// @ts-ignore
|
|
1113
1113
|
mockRpc[Symbol.dispose] = () => {
|
|
1114
1114
|
remove(rpcId);
|
|
@@ -1117,7 +1117,7 @@ const create$1 = rpcId => {
|
|
|
1117
1117
|
return mockRpc;
|
|
1118
1118
|
},
|
|
1119
1119
|
set(rpc) {
|
|
1120
|
-
set$
|
|
1120
|
+
set$7(rpcId, rpc);
|
|
1121
1121
|
}
|
|
1122
1122
|
};
|
|
1123
1123
|
};
|
|
@@ -1125,40 +1125,46 @@ const create$1 = rpcId => {
|
|
|
1125
1125
|
const ExtensionHostWorker = 44;
|
|
1126
1126
|
const ExtensionManagementWorker = 9006;
|
|
1127
1127
|
const IconThemeWorker = 7009;
|
|
1128
|
+
const RendererProcess = 1670;
|
|
1128
1129
|
const RendererWorker = 1;
|
|
1129
1130
|
const SourceControlWorker = 66;
|
|
1130
1131
|
|
|
1131
1132
|
const {
|
|
1132
|
-
invoke: invoke$
|
|
1133
|
-
set: set$
|
|
1133
|
+
invoke: invoke$4,
|
|
1134
|
+
set: set$6
|
|
1134
1135
|
} = create$1(ExtensionHostWorker);
|
|
1135
1136
|
|
|
1136
1137
|
const {
|
|
1137
|
-
invoke: invoke$
|
|
1138
|
-
set: set$
|
|
1138
|
+
invoke: invoke$3,
|
|
1139
|
+
set: set$5
|
|
1139
1140
|
} = create$1(ExtensionManagementWorker);
|
|
1140
1141
|
|
|
1141
1142
|
const {
|
|
1142
|
-
invoke,
|
|
1143
|
+
invoke: invoke$2,
|
|
1144
|
+
set: set$4
|
|
1145
|
+
} = create$1(RendererProcess);
|
|
1146
|
+
|
|
1147
|
+
const {
|
|
1148
|
+
invoke: invoke$1,
|
|
1143
1149
|
invokeAndTransfer,
|
|
1144
|
-
set: set$
|
|
1150
|
+
set: set$3
|
|
1145
1151
|
} = create$1(RendererWorker);
|
|
1146
1152
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1147
1153
|
number(uid);
|
|
1148
1154
|
number(menuId);
|
|
1149
1155
|
number(x);
|
|
1150
1156
|
number(y);
|
|
1151
|
-
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1157
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1152
1158
|
};
|
|
1153
1159
|
const readFile$1 = async uri => {
|
|
1154
|
-
return invoke('FileSystem.readFile', uri);
|
|
1160
|
+
return invoke$1('FileSystem.readFile', uri);
|
|
1155
1161
|
};
|
|
1156
1162
|
const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
1157
1163
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1158
1164
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1159
1165
|
};
|
|
1160
1166
|
const activateByEvent$1 = (event, assetDir, platform) => {
|
|
1161
|
-
return invoke('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
|
|
1167
|
+
return invoke$1('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
|
|
1162
1168
|
};
|
|
1163
1169
|
const sendMessagePortToTextMeasurementWorker$1 = async port => {
|
|
1164
1170
|
const command = 'TextMeasurement.handleMessagePort';
|
|
@@ -1169,14 +1175,14 @@ const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
|
1169
1175
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1170
1176
|
};
|
|
1171
1177
|
const getPreference = async key => {
|
|
1172
|
-
return await invoke('Preferences.get', key);
|
|
1178
|
+
return await invoke$1('Preferences.get', key);
|
|
1173
1179
|
};
|
|
1174
1180
|
const openUri$1 = async (uri, focus, options) => {
|
|
1175
|
-
await invoke('Main.openUri', uri, focus, options);
|
|
1181
|
+
await invoke$1('Main.openUri', uri, focus, options);
|
|
1176
1182
|
};
|
|
1177
1183
|
|
|
1178
1184
|
const {
|
|
1179
|
-
set: set$
|
|
1185
|
+
set: set$2
|
|
1180
1186
|
} = create$1(IconThemeWorker);
|
|
1181
1187
|
|
|
1182
1188
|
const toCommandId = key => {
|
|
@@ -1473,7 +1479,7 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
|
1473
1479
|
};
|
|
1474
1480
|
|
|
1475
1481
|
const requestFileIcons = async requests => {
|
|
1476
|
-
const results = await invoke('IconTheme.getIcons', requests);
|
|
1482
|
+
const results = await invoke$1('IconTheme.getIcons', requests);
|
|
1477
1483
|
return results;
|
|
1478
1484
|
};
|
|
1479
1485
|
|
|
@@ -1521,7 +1527,7 @@ const executeProvider = async ({
|
|
|
1521
1527
|
}) => {
|
|
1522
1528
|
await activateByEvent(event, assetDir, platform);
|
|
1523
1529
|
// @ts-ignore
|
|
1524
|
-
const result = await invoke$
|
|
1530
|
+
const result = await invoke$4(method, ...params);
|
|
1525
1531
|
return result;
|
|
1526
1532
|
};
|
|
1527
1533
|
|
|
@@ -1629,7 +1635,7 @@ const isCompatible = (extension, platform) => {
|
|
|
1629
1635
|
return platform !== Web || extension?.compatibility?.web !== false;
|
|
1630
1636
|
};
|
|
1631
1637
|
const getExtensions = async (assetDir, platform) => {
|
|
1632
|
-
const extensions = await invoke$
|
|
1638
|
+
const extensions = await invoke$3('Extensions.getAllExtensions', assetDir, platform);
|
|
1633
1639
|
return extensions.filter(extension => isCompatible(extension, platform));
|
|
1634
1640
|
};
|
|
1635
1641
|
|
|
@@ -1779,7 +1785,7 @@ const getTextHeight = async (input, width, fontFamily, fontSize, fontWeight, let
|
|
|
1779
1785
|
// TODO line height could also be like 1.5
|
|
1780
1786
|
const lineHeightPx = `${lineHeight}px`;
|
|
1781
1787
|
// @ts-ignore
|
|
1782
|
-
const height = await invoke(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
|
|
1788
|
+
const height = await invoke$1(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
|
|
1783
1789
|
return height + inputPadding * 2;
|
|
1784
1790
|
} catch {
|
|
1785
1791
|
// fallback
|
|
@@ -1907,7 +1913,7 @@ const isSourceControlExtension = extension => {
|
|
|
1907
1913
|
};
|
|
1908
1914
|
const getSourceControlUnavailableMessage = async (assetDir, platform) => {
|
|
1909
1915
|
try {
|
|
1910
|
-
const extensions = await invoke$
|
|
1916
|
+
const extensions = await invoke$3('Extensions.getAllExtensions', assetDir, platform);
|
|
1911
1917
|
const sourceControlExtensions = extensions.filter(isSourceControlExtension);
|
|
1912
1918
|
if (sourceControlExtensions.length === 0) {
|
|
1913
1919
|
return noSourceControlExtensionsInstalled();
|
|
@@ -2234,7 +2240,7 @@ const {
|
|
|
2234
2240
|
get,
|
|
2235
2241
|
getCommandIds,
|
|
2236
2242
|
registerCommands,
|
|
2237
|
-
set,
|
|
2243
|
+
set: set$1,
|
|
2238
2244
|
wrapCommand,
|
|
2239
2245
|
wrapGetter
|
|
2240
2246
|
} = create();
|
|
@@ -2254,7 +2260,7 @@ const create2 = (id, _uri, x, y, width, height, workspacePath, platform, assetDi
|
|
|
2254
2260
|
x,
|
|
2255
2261
|
y
|
|
2256
2262
|
};
|
|
2257
|
-
set(id, {
|
|
2263
|
+
set$1(id, {
|
|
2258
2264
|
...state,
|
|
2259
2265
|
initial: true,
|
|
2260
2266
|
loading: false
|
|
@@ -2631,7 +2637,7 @@ const getKeyBindings = () => {
|
|
|
2631
2637
|
}];
|
|
2632
2638
|
};
|
|
2633
2639
|
|
|
2634
|
-
const getMenuEntries =
|
|
2640
|
+
const getMenuEntries = uri => {
|
|
2635
2641
|
return [{
|
|
2636
2642
|
command: /* TODO */'-1',
|
|
2637
2643
|
flags: None,
|
|
@@ -2663,9 +2669,10 @@ const getMenuEntries = () => {
|
|
|
2663
2669
|
id: '',
|
|
2664
2670
|
label: addToGitignore()
|
|
2665
2671
|
}, {
|
|
2666
|
-
|
|
2672
|
+
args: [uri],
|
|
2673
|
+
command: 'Source Control.revealInExplorer',
|
|
2667
2674
|
flags: None,
|
|
2668
|
-
id: '',
|
|
2675
|
+
id: 'revealInExplorerView',
|
|
2669
2676
|
label: revealInExplorerView()
|
|
2670
2677
|
}, {
|
|
2671
2678
|
command: /* TODO */'-1',
|
|
@@ -2675,8 +2682,8 @@ const getMenuEntries = () => {
|
|
|
2675
2682
|
}];
|
|
2676
2683
|
};
|
|
2677
2684
|
|
|
2678
|
-
const getMenuEntries2 = state => {
|
|
2679
|
-
return getMenuEntries();
|
|
2685
|
+
const getMenuEntries2 = (state, props) => {
|
|
2686
|
+
return getMenuEntries(props.uri);
|
|
2680
2687
|
};
|
|
2681
2688
|
|
|
2682
2689
|
const getMenuIds = () => {
|
|
@@ -3009,10 +3016,16 @@ const show2 = async (uid, menuId, x, y, args) => {
|
|
|
3009
3016
|
|
|
3010
3017
|
const handleContextMenu = async (state, button, x, y) => {
|
|
3011
3018
|
const {
|
|
3012
|
-
id
|
|
3019
|
+
id,
|
|
3020
|
+
items,
|
|
3021
|
+
root
|
|
3013
3022
|
} = state;
|
|
3023
|
+
const index = getIndex(state, x, y);
|
|
3024
|
+
const item = items[index];
|
|
3025
|
+
const uri = item?.file ? `${root}/${item.file}` : '';
|
|
3014
3026
|
await show2(id, SourceControl$1, x, y, {
|
|
3015
|
-
menuId: SourceControl$1
|
|
3027
|
+
menuId: SourceControl$1,
|
|
3028
|
+
uri
|
|
3016
3029
|
});
|
|
3017
3030
|
return state;
|
|
3018
3031
|
};
|
|
@@ -3072,6 +3085,31 @@ const handleMouseOverAt = async (state, eventX, eventY) => {
|
|
|
3072
3085
|
return handleMouseOver(state, index);
|
|
3073
3086
|
};
|
|
3074
3087
|
|
|
3088
|
+
const state = {
|
|
3089
|
+
connected: false
|
|
3090
|
+
};
|
|
3091
|
+
const isConnected = () => {
|
|
3092
|
+
const {
|
|
3093
|
+
connected
|
|
3094
|
+
} = state;
|
|
3095
|
+
return connected;
|
|
3096
|
+
};
|
|
3097
|
+
const invoke = (method, ...params) => {
|
|
3098
|
+
return invoke$2(method, ...params);
|
|
3099
|
+
};
|
|
3100
|
+
const set = rpc => {
|
|
3101
|
+
set$4(rpc);
|
|
3102
|
+
state.connected = true;
|
|
3103
|
+
};
|
|
3104
|
+
|
|
3105
|
+
const handleRendererProcessMessagePort = async port => {
|
|
3106
|
+
const rpc = await create$4({
|
|
3107
|
+
commandMap: {},
|
|
3108
|
+
messagePort: port
|
|
3109
|
+
});
|
|
3110
|
+
set(rpc);
|
|
3111
|
+
};
|
|
3112
|
+
|
|
3075
3113
|
const handleScrollBarCaptureLost = state => {
|
|
3076
3114
|
return {
|
|
3077
3115
|
...state,
|
|
@@ -3250,7 +3288,7 @@ const createExtensionManagementWorkerRpc = async () => {
|
|
|
3250
3288
|
const initializeExtensionManagementWorker = async () => {
|
|
3251
3289
|
try {
|
|
3252
3290
|
const rpc = await createExtensionManagementWorkerRpc();
|
|
3253
|
-
set$
|
|
3291
|
+
set$5(rpc);
|
|
3254
3292
|
} catch {
|
|
3255
3293
|
// ignore
|
|
3256
3294
|
}
|
|
@@ -3258,8 +3296,8 @@ const initializeExtensionManagementWorker = async () => {
|
|
|
3258
3296
|
|
|
3259
3297
|
const initialize = async () => {
|
|
3260
3298
|
const [extensionHostRpc, textRpc] = await Promise.all([createExtensionHostRpc(), createTextMeasurementWorkerRpc(), initializeExtensionManagementWorker()]);
|
|
3261
|
-
set$
|
|
3262
|
-
set$
|
|
3299
|
+
set$6(extensionHostRpc);
|
|
3300
|
+
set$2(textRpc);
|
|
3263
3301
|
};
|
|
3264
3302
|
|
|
3265
3303
|
const getIndentRule = indent => {
|
|
@@ -3756,14 +3794,23 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
3756
3794
|
return commands;
|
|
3757
3795
|
};
|
|
3758
3796
|
|
|
3797
|
+
const renderDirect = async (uid, commands) => {
|
|
3798
|
+
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
3799
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
3800
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
3801
|
+
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
3802
|
+
};
|
|
3759
3803
|
const render2 = (uid, diffResult) => {
|
|
3760
3804
|
const {
|
|
3761
3805
|
newState,
|
|
3762
3806
|
oldState
|
|
3763
3807
|
} = get(uid);
|
|
3764
|
-
set(uid, newState, newState);
|
|
3808
|
+
set$1(uid, newState, newState);
|
|
3765
3809
|
const commands = applyRender(oldState, newState, diffResult);
|
|
3766
|
-
|
|
3810
|
+
if (!isConnected()) {
|
|
3811
|
+
return commands;
|
|
3812
|
+
}
|
|
3813
|
+
return renderDirect(uid, commands);
|
|
3767
3814
|
};
|
|
3768
3815
|
|
|
3769
3816
|
const Button = 1;
|
|
@@ -3912,6 +3959,17 @@ const renderEventListeners = () => {
|
|
|
3912
3959
|
}];
|
|
3913
3960
|
};
|
|
3914
3961
|
|
|
3962
|
+
const revealInExplorer = async (state, uri) => {
|
|
3963
|
+
await invoke$1('SideBar.show', 'Explorer');
|
|
3964
|
+
const states = await invoke$1('Viewlet.getAllStates');
|
|
3965
|
+
const viewlets = Object.values(states);
|
|
3966
|
+
const sideBar = viewlets.find(viewlet => viewlet.currentViewletId === 'Explorer');
|
|
3967
|
+
const explorerUid = Math.max(...viewlets.filter(viewlet => viewlet.parentUid === sideBar.uid).map(viewlet => viewlet.uid));
|
|
3968
|
+
await invoke$1('Viewlet.executeViewletCommand', explorerUid, 'reveal', uri);
|
|
3969
|
+
await invoke$1('Viewlet.executeViewletCommand', explorerUid, 'refresh');
|
|
3970
|
+
return state;
|
|
3971
|
+
};
|
|
3972
|
+
|
|
3915
3973
|
const saveState = uid => {
|
|
3916
3974
|
number(uid);
|
|
3917
3975
|
const value = get(uid);
|
|
@@ -3984,6 +4042,7 @@ const commandMap = {
|
|
|
3984
4042
|
'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
|
|
3985
4043
|
'SourceControl.handleMouseOver': wrapCommand(handleMouseOver),
|
|
3986
4044
|
'SourceControl.handleMouseOverAt': wrapCommand(handleMouseOverAt),
|
|
4045
|
+
'SourceControl.handleRendererProcessMessagePort': handleRendererProcessMessagePort,
|
|
3987
4046
|
'SourceControl.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
3988
4047
|
'SourceControl.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
3989
4048
|
'SourceControl.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
@@ -3996,6 +4055,7 @@ const commandMap = {
|
|
|
3996
4055
|
'SourceControl.renderActions': wrapGetter(renderActions),
|
|
3997
4056
|
'SourceControl.renderActions2': renderActions,
|
|
3998
4057
|
'SourceControl.renderEventListeners': renderEventListeners,
|
|
4058
|
+
'SourceControl.revealInExplorer': wrapCommand(revealInExplorer),
|
|
3999
4059
|
'SourceControl.saveState': saveState,
|
|
4000
4060
|
'SourceControl.selectIndex': wrapCommand(selectIndex),
|
|
4001
4061
|
'SourceControl.setDeltaY': wrapCommand(setDeltaY),
|
|
@@ -4010,7 +4070,7 @@ const listen = async () => {
|
|
|
4010
4070
|
const rpc = await create$2({
|
|
4011
4071
|
commandMap: commandMap
|
|
4012
4072
|
});
|
|
4013
|
-
set$
|
|
4073
|
+
set$3(rpc);
|
|
4014
4074
|
};
|
|
4015
4075
|
|
|
4016
4076
|
const main = async () => {
|