@lvce-editor/editor-worker 8.0.0 → 8.1.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/editorWorkerMain.js +451 -139
- package/package.json +5 -2
package/dist/editorWorkerMain.js
CHANGED
|
@@ -539,7 +539,7 @@ const create$4$2 = (method, params) => {
|
|
|
539
539
|
};
|
|
540
540
|
};
|
|
541
541
|
const callbacks = Object.create(null);
|
|
542
|
-
const set$
|
|
542
|
+
const set$d = (id, fn) => {
|
|
543
543
|
callbacks[id] = fn;
|
|
544
544
|
};
|
|
545
545
|
const get$7 = id => {
|
|
@@ -558,7 +558,7 @@ const registerPromise = () => {
|
|
|
558
558
|
resolve,
|
|
559
559
|
promise
|
|
560
560
|
} = Promise.withResolvers();
|
|
561
|
-
set$
|
|
561
|
+
set$d(id, resolve);
|
|
562
562
|
return {
|
|
563
563
|
id,
|
|
564
564
|
promise
|
|
@@ -903,10 +903,10 @@ const send = (transport, method, ...params) => {
|
|
|
903
903
|
const message = create$4$2(method, params);
|
|
904
904
|
transport.send(message);
|
|
905
905
|
};
|
|
906
|
-
const invoke$
|
|
906
|
+
const invoke$c = (ipc, method, ...params) => {
|
|
907
907
|
return invokeHelper(ipc, method, params, false);
|
|
908
908
|
};
|
|
909
|
-
const invokeAndTransfer$
|
|
909
|
+
const invokeAndTransfer$4 = (ipc, method, ...params) => {
|
|
910
910
|
return invokeHelper(ipc, method, params, true);
|
|
911
911
|
};
|
|
912
912
|
|
|
@@ -942,10 +942,10 @@ const createRpc = ipc => {
|
|
|
942
942
|
send(ipc, method, ...params);
|
|
943
943
|
},
|
|
944
944
|
invoke(method, ...params) {
|
|
945
|
-
return invoke$
|
|
945
|
+
return invoke$c(ipc, method, ...params);
|
|
946
946
|
},
|
|
947
947
|
invokeAndTransfer(method, ...params) {
|
|
948
|
-
return invokeAndTransfer$
|
|
948
|
+
return invokeAndTransfer$4(ipc, method, ...params);
|
|
949
949
|
},
|
|
950
950
|
async dispose() {
|
|
951
951
|
await ipc?.dispose();
|
|
@@ -1046,17 +1046,46 @@ const WebWorkerRpcClient = {
|
|
|
1046
1046
|
__proto__: null,
|
|
1047
1047
|
create: create$a
|
|
1048
1048
|
};
|
|
1049
|
+
const createMockRpc = ({
|
|
1050
|
+
commandMap
|
|
1051
|
+
}) => {
|
|
1052
|
+
const invocations = [];
|
|
1053
|
+
const invoke = (method, ...params) => {
|
|
1054
|
+
invocations.push([method, ...params]);
|
|
1055
|
+
const command = commandMap[method];
|
|
1056
|
+
return command(...params);
|
|
1057
|
+
};
|
|
1058
|
+
const mockRpc = {
|
|
1059
|
+
invoke,
|
|
1060
|
+
invokeAndTransfer: invoke,
|
|
1061
|
+
invocations
|
|
1062
|
+
};
|
|
1063
|
+
return mockRpc;
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
const DebugWorker = 55;
|
|
1067
|
+
const EditorWorker = 99;
|
|
1068
|
+
const ExtensionHostWorker = 44;
|
|
1069
|
+
const MarkdownWorker = 300;
|
|
1070
|
+
const RendererWorker$1 = 1;
|
|
1071
|
+
|
|
1072
|
+
const CodeGenerator = 1;
|
|
1073
|
+
const ColorPicker$1 = 2;
|
|
1074
|
+
const Completion = 3;
|
|
1075
|
+
const CompletionDetail = 4;
|
|
1076
|
+
const Find = 5;
|
|
1077
|
+
const Hover = 6;
|
|
1078
|
+
const Rename$1 = 7;
|
|
1079
|
+
const SourceAction$1 = 8;
|
|
1049
1080
|
|
|
1050
1081
|
const rpcs = Object.create(null);
|
|
1051
|
-
const set$
|
|
1082
|
+
const set$c = (id, rpc) => {
|
|
1052
1083
|
rpcs[id] = rpc;
|
|
1053
1084
|
};
|
|
1054
1085
|
const get$6 = id => {
|
|
1055
1086
|
return rpcs[id];
|
|
1056
1087
|
};
|
|
1057
1088
|
|
|
1058
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1059
|
-
|
|
1060
1089
|
const create$9 = rpcId => {
|
|
1061
1090
|
return {
|
|
1062
1091
|
// @ts-ignore
|
|
@@ -1072,7 +1101,7 @@ const create$9 = rpcId => {
|
|
|
1072
1101
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1073
1102
|
},
|
|
1074
1103
|
set(rpc) {
|
|
1075
|
-
set$
|
|
1104
|
+
set$c(rpcId, rpc);
|
|
1076
1105
|
},
|
|
1077
1106
|
async dispose() {
|
|
1078
1107
|
const rpc = get$6(rpcId);
|
|
@@ -1080,85 +1109,407 @@ const create$9 = rpcId => {
|
|
|
1080
1109
|
}
|
|
1081
1110
|
};
|
|
1082
1111
|
};
|
|
1083
|
-
|
|
1084
|
-
const ClipBoardWorker$1 = 3400;
|
|
1085
|
-
const ColorPickerWorker = 302;
|
|
1086
|
-
const CompletionWorker = 301;
|
|
1087
|
-
const DebugWorker$1 = 55;
|
|
1088
|
-
const EditorWorker$1 = 99;
|
|
1089
|
-
const EmbedsProcess$1 = 207;
|
|
1090
|
-
const EmbedsWorker = 208;
|
|
1091
|
-
const ErrorWorker$1 = 3308;
|
|
1092
|
-
const ExtensionDetailWorker = 3402;
|
|
1093
|
-
const ExtensionHostWorker = 44;
|
|
1094
|
-
const FileSystemProcess$1 = 210;
|
|
1095
|
-
const FileSystemWorker$1 = 209;
|
|
1096
|
-
const MainProcess$1 = -5;
|
|
1097
|
-
const MarkdownWorker$1 = 300;
|
|
1098
|
-
const OutputWorker = 7001;
|
|
1099
|
-
const ProblemsWorker = 3403;
|
|
1100
|
-
const RendererProcess$1 = 1670;
|
|
1101
|
-
const RendererWorker$1 = 1;
|
|
1102
|
-
const SearchProcess$1 = 77;
|
|
1103
|
-
const SearchProcessElectron = 2;
|
|
1104
|
-
const SharedProcess$1 = 1;
|
|
1105
|
-
const SourceActionWorker = 303;
|
|
1106
|
-
const SourceControlWorker = 66;
|
|
1107
|
-
const SyntaxHighlightingWorker$1 = 3309;
|
|
1108
|
-
const TestWorker = 9001;
|
|
1109
|
-
const RpcId = {
|
|
1110
|
-
__proto__: null,
|
|
1111
|
-
ClipBoardProcess: ClipBoardProcess$1,
|
|
1112
|
-
ClipBoardWorker: ClipBoardWorker$1,
|
|
1113
|
-
ColorPickerWorker,
|
|
1114
|
-
CompletionWorker,
|
|
1115
|
-
DebugWorker: DebugWorker$1,
|
|
1116
|
-
EditorWorker: EditorWorker$1,
|
|
1117
|
-
EmbedsProcess: EmbedsProcess$1,
|
|
1118
|
-
EmbedsWorker,
|
|
1119
|
-
ErrorWorker: ErrorWorker$1,
|
|
1120
|
-
ExtensionDetailWorker,
|
|
1121
|
-
ExtensionHostWorker,
|
|
1122
|
-
FileSystemProcess: FileSystemProcess$1,
|
|
1123
|
-
FileSystemWorker: FileSystemWorker$1,
|
|
1124
|
-
MainProcess: MainProcess$1,
|
|
1125
|
-
MarkdownWorker: MarkdownWorker$1,
|
|
1126
|
-
OutputWorker,
|
|
1127
|
-
ProblemsWorker,
|
|
1128
|
-
RendererProcess: RendererProcess$1,
|
|
1129
|
-
RendererWorker: RendererWorker$1,
|
|
1130
|
-
SearchProcess: SearchProcess$1,
|
|
1131
|
-
SearchProcessElectron,
|
|
1132
|
-
SharedProcess: SharedProcess$1,
|
|
1133
|
-
SourceActionWorker,
|
|
1134
|
-
SourceControlWorker,
|
|
1135
|
-
SyntaxHighlightingWorker: SyntaxHighlightingWorker$1,
|
|
1136
|
-
TestWorker
|
|
1137
|
-
};
|
|
1112
|
+
|
|
1138
1113
|
const {
|
|
1139
|
-
invoke: invoke$
|
|
1140
|
-
|
|
1114
|
+
invoke: invoke$b,
|
|
1115
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1116
|
+
set: set$b,
|
|
1117
|
+
dispose: dispose$2
|
|
1118
|
+
} = create$9(ExtensionHostWorker);
|
|
1119
|
+
const executeReferenceProvider = async (id, offset) => {
|
|
1120
|
+
// @ts-ignore
|
|
1121
|
+
return invoke$b('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
1122
|
+
};
|
|
1123
|
+
const executeFileReferenceProvider = async id => {
|
|
1124
|
+
// @ts-ignore
|
|
1125
|
+
return invoke$b('ExtensionHostReference.executeFileReferenceProvider', id);
|
|
1126
|
+
};
|
|
1127
|
+
const getRuntimeStatus = async extensionId => {
|
|
1128
|
+
// @ts-ignore
|
|
1129
|
+
return invoke$b('ExtensionHost.getRuntimeStatus', extensionId);
|
|
1130
|
+
};
|
|
1131
|
+
const registerMockRpc$1 = commandMap => {
|
|
1132
|
+
const mockRpc = createMockRpc({
|
|
1133
|
+
commandMap
|
|
1134
|
+
});
|
|
1135
|
+
set$b(mockRpc);
|
|
1136
|
+
return mockRpc;
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1141
1139
|
const ExtensionHost = {
|
|
1142
1140
|
__proto__: null,
|
|
1143
|
-
|
|
1144
|
-
|
|
1141
|
+
dispose: dispose$2,
|
|
1142
|
+
executeFileReferenceProvider,
|
|
1143
|
+
executeReferenceProvider,
|
|
1144
|
+
getRuntimeStatus,
|
|
1145
|
+
invoke: invoke$b,
|
|
1146
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1147
|
+
registerMockRpc: registerMockRpc$1,
|
|
1148
|
+
set: set$b
|
|
1145
1149
|
};
|
|
1150
|
+
|
|
1146
1151
|
const {
|
|
1147
|
-
invoke: invoke$
|
|
1148
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1149
|
-
set: set$
|
|
1152
|
+
invoke: invoke$a,
|
|
1153
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1154
|
+
set: set$a,
|
|
1155
|
+
dispose: dispose$1
|
|
1156
|
+
} = create$9(RendererWorker$1);
|
|
1157
|
+
const searchFileHtml = async uri => {
|
|
1158
|
+
return invoke$a('ExtensionHost.searchFileWithHtml', uri);
|
|
1159
|
+
};
|
|
1160
|
+
const getFilePathElectron = async file => {
|
|
1161
|
+
return invoke$a('FileSystemHandle.getFilePathElectron', file);
|
|
1162
|
+
};
|
|
1163
|
+
const showContextMenu = async (x, y, id, ...args) => {
|
|
1164
|
+
return invoke$a('ContextMenu.show', x, y, id, ...args);
|
|
1165
|
+
};
|
|
1166
|
+
const getElectronVersion = async () => {
|
|
1167
|
+
return invoke$a('Process.getElectronVersion');
|
|
1168
|
+
};
|
|
1169
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
1170
|
+
await invoke$a('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1171
|
+
};
|
|
1172
|
+
const setColorTheme = async id => {
|
|
1173
|
+
// @ts-ignore
|
|
1174
|
+
return invoke$a(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1175
|
+
};
|
|
1176
|
+
const getNodeVersion = async () => {
|
|
1177
|
+
return invoke$a('Process.getNodeVersion');
|
|
1178
|
+
};
|
|
1179
|
+
const getChromeVersion = async () => {
|
|
1180
|
+
return invoke$a('Process.getChromeVersion');
|
|
1181
|
+
};
|
|
1182
|
+
const getV8Version = async () => {
|
|
1183
|
+
return invoke$a('Process.getV8Version');
|
|
1184
|
+
};
|
|
1185
|
+
const getFileHandles = async fileIds => {
|
|
1186
|
+
const files = await invoke$a('FileSystemHandle.getFileHandles', fileIds);
|
|
1187
|
+
return files;
|
|
1188
|
+
};
|
|
1189
|
+
const setWorkspacePath = async path => {
|
|
1190
|
+
await invoke$a('Workspace.setPath', path);
|
|
1191
|
+
};
|
|
1192
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
1193
|
+
await invokeAndTransfer$2('WebView.registerInterceptor', id, port);
|
|
1194
|
+
};
|
|
1195
|
+
const unregisterWebViewInterceptor = async id => {
|
|
1196
|
+
await invoke$a('WebView.unregisterInterceptor', id);
|
|
1197
|
+
};
|
|
1198
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1199
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1200
|
+
// @ts-ignore
|
|
1201
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1202
|
+
};
|
|
1203
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1204
|
+
const command = 'Errors.handleMessagePort';
|
|
1205
|
+
// @ts-ignore
|
|
1206
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1207
|
+
};
|
|
1208
|
+
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1209
|
+
const command = 'Markdown.handleMessagePort';
|
|
1210
|
+
// @ts-ignore
|
|
1211
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1212
|
+
};
|
|
1213
|
+
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1214
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1215
|
+
// @ts-ignore
|
|
1216
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1217
|
+
};
|
|
1218
|
+
const readFile = async uri => {
|
|
1219
|
+
return invoke$a('FileSystem.readFile', uri);
|
|
1220
|
+
};
|
|
1221
|
+
const getWebViewSecret = async key => {
|
|
1222
|
+
// @ts-ignore
|
|
1223
|
+
return invoke$a('WebView.getSecret', key);
|
|
1224
|
+
};
|
|
1225
|
+
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1226
|
+
return invokeAndTransfer$2('WebView.setPort', uid, port, origin, portType);
|
|
1227
|
+
};
|
|
1228
|
+
const setFocus$1 = key => {
|
|
1229
|
+
return invoke$a('Focus.setFocus', key);
|
|
1230
|
+
};
|
|
1231
|
+
const getFileIcon = async options => {
|
|
1232
|
+
return invoke$a('IconTheme.getFileIcon', options);
|
|
1233
|
+
};
|
|
1234
|
+
const getColorThemeNames = async () => {
|
|
1235
|
+
return invoke$a('ColorTheme.getColorThemeNames');
|
|
1236
|
+
};
|
|
1237
|
+
const disableExtension = async id => {
|
|
1238
|
+
// @ts-ignore
|
|
1239
|
+
return invoke$a('ExtensionManagement.disable', id);
|
|
1240
|
+
};
|
|
1241
|
+
const enableExtension = async id => {
|
|
1242
|
+
// @ts-ignore
|
|
1243
|
+
return invoke$a('ExtensionManagement.enable', id);
|
|
1244
|
+
};
|
|
1245
|
+
const handleDebugChange = async params => {
|
|
1246
|
+
// @ts-ignore
|
|
1247
|
+
return invoke$a('Run And Debug.handleChange', params);
|
|
1248
|
+
};
|
|
1249
|
+
const getFolderIcon = async options => {
|
|
1250
|
+
return invoke$a('IconTheme.getFolderIcon', options);
|
|
1251
|
+
};
|
|
1252
|
+
const closeWidget = async widgetId => {
|
|
1253
|
+
return invoke$a('Viewlet.closeWidget', widgetId);
|
|
1254
|
+
};
|
|
1255
|
+
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1256
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1257
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1258
|
+
};
|
|
1259
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
1260
|
+
await invokeAndTransfer$2('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1261
|
+
};
|
|
1262
|
+
const confirm = async (message, options) => {
|
|
1263
|
+
// @ts-ignore
|
|
1264
|
+
const result = await invoke$a('ConfirmPrompt.prompt', message, options);
|
|
1265
|
+
return result;
|
|
1266
|
+
};
|
|
1267
|
+
const getRecentlyOpened = async () => {
|
|
1268
|
+
return invoke$a(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1269
|
+
};
|
|
1270
|
+
const getKeyBindings$1 = async () => {
|
|
1271
|
+
return invoke$a('KeyBindingsInitial.getKeyBindings');
|
|
1272
|
+
};
|
|
1273
|
+
const writeClipBoardText = async text => {
|
|
1274
|
+
await invoke$a('ClipBoard.writeText', /* text */text);
|
|
1275
|
+
};
|
|
1276
|
+
const writeClipBoardImage = async blob => {
|
|
1277
|
+
// @ts-ignore
|
|
1278
|
+
await invoke$a('ClipBoard.writeImage', /* text */blob);
|
|
1279
|
+
};
|
|
1280
|
+
const searchFileMemory = async uri => {
|
|
1281
|
+
// @ts-ignore
|
|
1282
|
+
return invoke$a('ExtensionHost.searchFileWithMemory', uri);
|
|
1283
|
+
};
|
|
1284
|
+
const searchFileFetch = async uri => {
|
|
1285
|
+
return invoke$a('ExtensionHost.searchFileWithFetch', uri);
|
|
1286
|
+
};
|
|
1287
|
+
const showMessageBox = async options => {
|
|
1288
|
+
return invoke$a('ElectronDialog.showMessageBox', options);
|
|
1289
|
+
};
|
|
1290
|
+
const handleDebugResumed = async params => {
|
|
1291
|
+
await invoke$a('Run And Debug.handleResumed', params);
|
|
1292
|
+
};
|
|
1293
|
+
const openWidget = async name => {
|
|
1294
|
+
await invoke$a('Viewlet.openWidget', name);
|
|
1295
|
+
};
|
|
1296
|
+
const getIcons = async requests => {
|
|
1297
|
+
const icons = await invoke$a('IconTheme.getIcons', requests);
|
|
1298
|
+
return icons;
|
|
1299
|
+
};
|
|
1300
|
+
const activateByEvent$1 = event => {
|
|
1301
|
+
return invoke$a('ExtensionHostManagement.activateByEvent', event);
|
|
1302
|
+
};
|
|
1303
|
+
const setAdditionalFocus$1 = focusKey => {
|
|
1304
|
+
// @ts-ignore
|
|
1305
|
+
return invoke$a('Focus.setAdditionalFocus', focusKey);
|
|
1306
|
+
};
|
|
1307
|
+
const getActiveEditorId = () => {
|
|
1308
|
+
// @ts-ignore
|
|
1309
|
+
return invoke$a('GetActiveEditor.getActiveEditorId');
|
|
1310
|
+
};
|
|
1311
|
+
const getWorkspacePath = () => {
|
|
1312
|
+
return invoke$a('Workspace.getPath');
|
|
1313
|
+
};
|
|
1314
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
1315
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1316
|
+
// @ts-ignore
|
|
1317
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1318
|
+
};
|
|
1319
|
+
const getPreference = async key => {
|
|
1320
|
+
return await invoke$a('Preferences.get', key);
|
|
1321
|
+
};
|
|
1322
|
+
const getAllExtensions = async () => {
|
|
1323
|
+
return invoke$a('ExtensionManagement.getAllExtensions');
|
|
1324
|
+
};
|
|
1325
|
+
const rerenderEditor = async key => {
|
|
1326
|
+
// @ts-ignore
|
|
1327
|
+
return invoke$a('Editor.rerender', key);
|
|
1328
|
+
};
|
|
1329
|
+
const handleDebugPaused = async params => {
|
|
1330
|
+
await invoke$a('Run And Debug.handlePaused', params);
|
|
1331
|
+
};
|
|
1332
|
+
const openUri = async (uri, focus, options) => {
|
|
1333
|
+
await invoke$a('Main.openUri', uri, focus, options);
|
|
1334
|
+
};
|
|
1335
|
+
const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
|
|
1336
|
+
await invokeAndTransfer$2(
|
|
1337
|
+
// @ts-ignore
|
|
1338
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1339
|
+
};
|
|
1340
|
+
const handleDebugScriptParsed = async script => {
|
|
1341
|
+
await invoke$a('Run And Debug.handleScriptParsed', script);
|
|
1342
|
+
};
|
|
1343
|
+
const getWindowId = async () => {
|
|
1344
|
+
return invoke$a('GetWindowId.getWindowId');
|
|
1345
|
+
};
|
|
1346
|
+
const getBlob = async uri => {
|
|
1347
|
+
// @ts-ignore
|
|
1348
|
+
return invoke$a('FileSystem.getBlob', uri);
|
|
1349
|
+
};
|
|
1350
|
+
const getExtensionCommands = async () => {
|
|
1351
|
+
return invoke$a('ExtensionHost.getCommands');
|
|
1352
|
+
};
|
|
1353
|
+
const showErrorDialog = async errorInfo => {
|
|
1354
|
+
// @ts-ignore
|
|
1355
|
+
await invoke$a('ErrorHandling.showErrorDialog', errorInfo);
|
|
1356
|
+
};
|
|
1357
|
+
const getFolderSize = async uri => {
|
|
1358
|
+
// @ts-ignore
|
|
1359
|
+
return await invoke$a('FileSystem.getFolderSize', uri);
|
|
1360
|
+
};
|
|
1361
|
+
const getExtension = async id => {
|
|
1362
|
+
// @ts-ignore
|
|
1363
|
+
return invoke$a('ExtensionManagement.getExtension', id);
|
|
1364
|
+
};
|
|
1365
|
+
const getMarkdownDom = async html => {
|
|
1366
|
+
// @ts-ignore
|
|
1367
|
+
return invoke$a('Markdown.getVirtualDom', html);
|
|
1368
|
+
};
|
|
1369
|
+
const renderMarkdown = async (markdown, options) => {
|
|
1370
|
+
// @ts-ignore
|
|
1371
|
+
return invoke$a('Markdown.renderMarkdown', markdown, options);
|
|
1372
|
+
};
|
|
1373
|
+
const openNativeFolder = async uri => {
|
|
1374
|
+
// @ts-ignore
|
|
1375
|
+
await invoke$a('OpenNativeFolder.openNativeFolder', uri);
|
|
1376
|
+
};
|
|
1377
|
+
const uninstallExtension = async id => {
|
|
1378
|
+
return invoke$a('ExtensionManagement.uninstall', id);
|
|
1379
|
+
};
|
|
1380
|
+
const installExtension = async id => {
|
|
1381
|
+
// @ts-ignore
|
|
1382
|
+
return invoke$a('ExtensionManagement.install', id);
|
|
1383
|
+
};
|
|
1384
|
+
const openExtensionSearch = async () => {
|
|
1385
|
+
// @ts-ignore
|
|
1386
|
+
return invoke$a('SideBar.openViewlet', 'Extensions');
|
|
1387
|
+
};
|
|
1388
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
1389
|
+
// @ts-ignore
|
|
1390
|
+
return invoke$a('Extensions.handleInput', searchValue);
|
|
1391
|
+
};
|
|
1392
|
+
const openExternal = async uri => {
|
|
1393
|
+
// @ts-ignore
|
|
1394
|
+
await invoke$a('Open.openExternal', uri);
|
|
1395
|
+
};
|
|
1396
|
+
const openUrl = async uri => {
|
|
1397
|
+
// @ts-ignore
|
|
1398
|
+
await invoke$a('Open.openUrl', uri);
|
|
1399
|
+
};
|
|
1400
|
+
const getAllPreferences = async () => {
|
|
1401
|
+
// @ts-ignore
|
|
1402
|
+
return invoke$a('Preferences.getAll');
|
|
1403
|
+
};
|
|
1404
|
+
const showSaveFilePicker = async () => {
|
|
1405
|
+
// @ts-ignore
|
|
1406
|
+
return invoke$a('FilePicker.showSaveFilePicker');
|
|
1407
|
+
};
|
|
1408
|
+
const getLogsDir = async () => {
|
|
1409
|
+
// @ts-ignore
|
|
1410
|
+
return invoke$a('PlatformPaths.getLogsDir');
|
|
1411
|
+
};
|
|
1412
|
+
const registerMockRpc = commandMap => {
|
|
1413
|
+
const mockRpc = createMockRpc({
|
|
1414
|
+
commandMap
|
|
1415
|
+
});
|
|
1416
|
+
set$a(mockRpc);
|
|
1417
|
+
return mockRpc;
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1150
1420
|
const RendererWorker = {
|
|
1151
1421
|
__proto__: null,
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1422
|
+
activateByEvent: activateByEvent$1,
|
|
1423
|
+
applyBulkReplacement,
|
|
1424
|
+
closeWidget,
|
|
1425
|
+
confirm,
|
|
1426
|
+
disableExtension,
|
|
1427
|
+
dispose: dispose$1,
|
|
1428
|
+
enableExtension,
|
|
1429
|
+
getActiveEditorId,
|
|
1430
|
+
getAllExtensions,
|
|
1431
|
+
getAllPreferences,
|
|
1432
|
+
getBlob,
|
|
1433
|
+
getChromeVersion,
|
|
1434
|
+
getColorThemeNames,
|
|
1435
|
+
getElectronVersion,
|
|
1436
|
+
getExtension,
|
|
1437
|
+
getExtensionCommands,
|
|
1438
|
+
getFileHandles,
|
|
1439
|
+
getFileIcon,
|
|
1440
|
+
getFilePathElectron,
|
|
1441
|
+
getFolderIcon,
|
|
1442
|
+
getFolderSize,
|
|
1443
|
+
getIcons,
|
|
1444
|
+
getKeyBindings: getKeyBindings$1,
|
|
1445
|
+
getLogsDir,
|
|
1446
|
+
getMarkdownDom,
|
|
1447
|
+
getNodeVersion,
|
|
1448
|
+
getPreference,
|
|
1449
|
+
getRecentlyOpened,
|
|
1450
|
+
getV8Version,
|
|
1451
|
+
getWebViewSecret,
|
|
1452
|
+
getWindowId,
|
|
1453
|
+
getWorkspacePath,
|
|
1454
|
+
handleDebugChange,
|
|
1455
|
+
handleDebugPaused,
|
|
1456
|
+
handleDebugResumed,
|
|
1457
|
+
handleDebugScriptParsed,
|
|
1458
|
+
installExtension,
|
|
1156
1459
|
invoke: invoke$a,
|
|
1157
|
-
|
|
1460
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1461
|
+
openExtensionSearch,
|
|
1462
|
+
openExternal,
|
|
1463
|
+
openNativeFolder,
|
|
1464
|
+
openUri,
|
|
1465
|
+
openUrl,
|
|
1466
|
+
openWidget,
|
|
1467
|
+
readFile,
|
|
1468
|
+
registerMockRpc,
|
|
1469
|
+
registerWebViewInterceptor,
|
|
1470
|
+
renderMarkdown,
|
|
1471
|
+
rerenderEditor,
|
|
1472
|
+
searchFileFetch,
|
|
1473
|
+
searchFileHtml,
|
|
1474
|
+
searchFileMemory,
|
|
1475
|
+
sendMessagePortToEditorWorker,
|
|
1476
|
+
sendMessagePortToErrorWorker,
|
|
1477
|
+
sendMessagePortToExtensionHostWorker,
|
|
1478
|
+
sendMessagePortToFileSystemWorker,
|
|
1479
|
+
sendMessagePortToMarkdownWorker,
|
|
1480
|
+
sendMessagePortToRendererProcess,
|
|
1481
|
+
sendMessagePortToSearchProcess,
|
|
1482
|
+
sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
|
|
1483
|
+
set: set$a,
|
|
1484
|
+
setAdditionalFocus: setAdditionalFocus$1,
|
|
1485
|
+
setColorTheme,
|
|
1486
|
+
setExtensionsSearchValue,
|
|
1487
|
+
setFocus: setFocus$1,
|
|
1488
|
+
setWebViewPort,
|
|
1489
|
+
setWorkspacePath,
|
|
1490
|
+
showContextMenu,
|
|
1491
|
+
showErrorDialog,
|
|
1492
|
+
showMessageBox,
|
|
1493
|
+
showSaveFilePicker,
|
|
1494
|
+
uninstallExtension,
|
|
1495
|
+
unregisterWebViewInterceptor,
|
|
1496
|
+
writeClipBoardImage,
|
|
1497
|
+
writeClipBoardText
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1500
|
+
const {
|
|
1501
|
+
invoke: invoke$9,
|
|
1502
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1503
|
+
set: set$9,
|
|
1504
|
+
dispose
|
|
1505
|
+
} = create$9(MarkdownWorker);
|
|
1506
|
+
|
|
1158
1507
|
const SyntaxHighlightingWorker = {
|
|
1159
1508
|
__proto__: null,
|
|
1160
|
-
|
|
1161
|
-
|
|
1509
|
+
dispose,
|
|
1510
|
+
invoke: invoke$9,
|
|
1511
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1512
|
+
set: set$9
|
|
1162
1513
|
};
|
|
1163
1514
|
|
|
1164
1515
|
const {
|
|
@@ -1267,7 +1618,7 @@ const IndentLess = 'indentLess';
|
|
|
1267
1618
|
const IndentMore = 'indentMore';
|
|
1268
1619
|
const InsertLineBreak = 'insertLineBreak';
|
|
1269
1620
|
const LineComment = 'lineComment';
|
|
1270
|
-
const Rename
|
|
1621
|
+
const Rename = 'rename';
|
|
1271
1622
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1272
1623
|
|
|
1273
1624
|
const map$1 = Object.create(null);
|
|
@@ -2188,7 +2539,7 @@ const {
|
|
|
2188
2539
|
set: set$5,
|
|
2189
2540
|
invoke: invoke$6} = ExtensionHost;
|
|
2190
2541
|
|
|
2191
|
-
const ColorPicker
|
|
2542
|
+
const ColorPicker = 41;
|
|
2192
2543
|
const EditorCompletion = 9;
|
|
2193
2544
|
const Empty = 0;
|
|
2194
2545
|
const FindWidget = 16;
|
|
@@ -2573,7 +2924,7 @@ const getTextChanges = (editor, changes) => {
|
|
|
2573
2924
|
end: endPosition,
|
|
2574
2925
|
inserted: [edit.inserted],
|
|
2575
2926
|
deleted,
|
|
2576
|
-
origin: Rename
|
|
2927
|
+
origin: Rename
|
|
2577
2928
|
};
|
|
2578
2929
|
textChanges.push(textChange);
|
|
2579
2930
|
}
|
|
@@ -2941,15 +3292,6 @@ const removeEditorWidget = (widgets, id) => {
|
|
|
2941
3292
|
return newWidgets;
|
|
2942
3293
|
};
|
|
2943
3294
|
|
|
2944
|
-
const CodeGenerator = 1;
|
|
2945
|
-
const ColorPicker = 2;
|
|
2946
|
-
const Completion = 3;
|
|
2947
|
-
const CompletionDetail = 4;
|
|
2948
|
-
const Find = 5;
|
|
2949
|
-
const Hover = 6;
|
|
2950
|
-
const Rename = 7;
|
|
2951
|
-
const SourceAction$1 = 8;
|
|
2952
|
-
|
|
2953
3295
|
const isMatchingWidget$2 = widget => {
|
|
2954
3296
|
return widget.id === CodeGenerator;
|
|
2955
3297
|
};
|
|
@@ -3010,7 +3352,7 @@ const invoke$5 = async (method, ...params) => {
|
|
|
3010
3352
|
|
|
3011
3353
|
// TODO duplicate code
|
|
3012
3354
|
const isRenameWidget = widget => {
|
|
3013
|
-
return widget.id === Rename;
|
|
3355
|
+
return widget.id === Rename$1;
|
|
3014
3356
|
};
|
|
3015
3357
|
const closeRename = async editor => {
|
|
3016
3358
|
const {
|
|
@@ -3113,7 +3455,7 @@ const create$7 = () => {
|
|
|
3113
3455
|
const create$6 = () => {
|
|
3114
3456
|
const completionUid = create$7();
|
|
3115
3457
|
const widget = {
|
|
3116
|
-
id: ColorPicker,
|
|
3458
|
+
id: ColorPicker$1,
|
|
3117
3459
|
oldState: {
|
|
3118
3460
|
uid: completionUid,
|
|
3119
3461
|
x: 0,
|
|
@@ -3138,7 +3480,7 @@ const newStateGenerator$6 = (state, parentUid) => {
|
|
|
3138
3480
|
return loadContent$2(state, parentUid);
|
|
3139
3481
|
};
|
|
3140
3482
|
const openColorPicker = async editor => {
|
|
3141
|
-
return addWidgetToEditor(ColorPicker, ColorPicker
|
|
3483
|
+
return addWidgetToEditor(ColorPicker$1, ColorPicker, editor, create$6, newStateGenerator$6);
|
|
3142
3484
|
};
|
|
3143
3485
|
|
|
3144
3486
|
const state$6 = {
|
|
@@ -5384,7 +5726,7 @@ const newStateGenerator$3 = (state, parentUid) => {
|
|
|
5384
5726
|
};
|
|
5385
5727
|
const openFind2 = async editor => {
|
|
5386
5728
|
const fullFocus = true;
|
|
5387
|
-
return addWidgetToEditor(ColorPicker, FindWidget, editor, create$3, newStateGenerator$3, fullFocus);
|
|
5729
|
+
return addWidgetToEditor(ColorPicker$1, FindWidget, editor, create$3, newStateGenerator$3, fullFocus);
|
|
5388
5730
|
};
|
|
5389
5731
|
|
|
5390
5732
|
const openFind = async state => {
|
|
@@ -5410,7 +5752,7 @@ const getPositionAtCursor$1 = editor => {
|
|
|
5410
5752
|
const create$2 = () => {
|
|
5411
5753
|
const completionUid = create$7();
|
|
5412
5754
|
const renameWidget = {
|
|
5413
|
-
id: Rename,
|
|
5755
|
+
id: Rename$1,
|
|
5414
5756
|
oldState: {
|
|
5415
5757
|
uid: completionUid,
|
|
5416
5758
|
x: 0,
|
|
@@ -5466,7 +5808,7 @@ const openRename = async editor => {
|
|
|
5466
5808
|
return editor;
|
|
5467
5809
|
}
|
|
5468
5810
|
const fullFocus = true;
|
|
5469
|
-
return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$2, newStateGenerator$2, fullFocus);
|
|
5811
|
+
return addWidgetToEditor(Rename$1, FocusEditorRename$1, editor, create$2, newStateGenerator$2, fullFocus);
|
|
5470
5812
|
};
|
|
5471
5813
|
|
|
5472
5814
|
const getOrganizeImportEdits = async editor => {
|
|
@@ -7502,8 +7844,8 @@ const editorUnindent = editor => {
|
|
|
7502
7844
|
|
|
7503
7845
|
const isFunctional = widgetId => {
|
|
7504
7846
|
switch (widgetId) {
|
|
7505
|
-
case ColorPicker:
|
|
7506
|
-
case Rename:
|
|
7847
|
+
case ColorPicker$1:
|
|
7848
|
+
case Rename$1:
|
|
7507
7849
|
case Completion:
|
|
7508
7850
|
case Find:
|
|
7509
7851
|
case SourceAction$1:
|
|
@@ -7546,13 +7888,13 @@ const addWidget$1 = (widget, id, render) => {
|
|
|
7546
7888
|
|
|
7547
7889
|
const getWidgetInvoke = widgetId => {
|
|
7548
7890
|
switch (widgetId) {
|
|
7549
|
-
case ColorPicker:
|
|
7891
|
+
case ColorPicker$1:
|
|
7550
7892
|
return invoke$7;
|
|
7551
7893
|
case Completion:
|
|
7552
7894
|
return invoke$4;
|
|
7553
7895
|
case Find:
|
|
7554
7896
|
return invoke$3;
|
|
7555
|
-
case Rename:
|
|
7897
|
+
case Rename$1:
|
|
7556
7898
|
return invoke$5;
|
|
7557
7899
|
case SourceAction$1:
|
|
7558
7900
|
return invoke$1;
|
|
@@ -7997,7 +8339,7 @@ const {
|
|
|
7997
8339
|
handleInput,
|
|
7998
8340
|
close: close$1,
|
|
7999
8341
|
accept
|
|
8000
|
-
} = createFns(['handleInput', 'close', 'accept'], 'Rename', Rename);
|
|
8342
|
+
} = createFns(['handleInput', 'close', 'accept'], 'Rename', Rename$1);
|
|
8001
8343
|
|
|
8002
8344
|
const EditorRenameWidget = {
|
|
8003
8345
|
__proto__: null,
|
|
@@ -8840,7 +9182,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
8840
9182
|
commandMap: {}
|
|
8841
9183
|
});
|
|
8842
9184
|
if (rpcId) {
|
|
8843
|
-
set$
|
|
9185
|
+
set$c(rpcId, rpc);
|
|
8844
9186
|
}
|
|
8845
9187
|
};
|
|
8846
9188
|
|
|
@@ -8869,7 +9211,7 @@ const createExtensionHostRpc = async () => {
|
|
|
8869
9211
|
} = getPortTuple();
|
|
8870
9212
|
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
8871
9213
|
// TODO use transfer rpc
|
|
8872
|
-
await sendMessagePortToExtensionHostWorker2(port2, initialCommand,
|
|
9214
|
+
await sendMessagePortToExtensionHostWorker2(port2, initialCommand, EditorWorker);
|
|
8873
9215
|
const rpc = await PlainMessagePortRpcParent.create({
|
|
8874
9216
|
commandMap: {},
|
|
8875
9217
|
messagePort: port1
|
|
@@ -9876,7 +10218,7 @@ const setDebugEnabled = (state, enabled) => {
|
|
|
9876
10218
|
};
|
|
9877
10219
|
|
|
9878
10220
|
const invoke = async (method, ...params) => {
|
|
9879
|
-
const worker = get$6(
|
|
10221
|
+
const worker = get$6(DebugWorker);
|
|
9880
10222
|
return worker.invoke(method, ...params);
|
|
9881
10223
|
};
|
|
9882
10224
|
|
|
@@ -9943,38 +10285,8 @@ const wrapWidgetCommand = (widgetId, fn) => {
|
|
|
9943
10285
|
};
|
|
9944
10286
|
|
|
9945
10287
|
const widgetCommands = {
|
|
9946
|
-
'ColorPicker.handleSliderPointerDown': ColorPicker,
|
|
9947
|
-
'ColorPicker.handleSliderPointerMove': ColorPicker
|
|
9948
|
-
// 'FindWidget.focusNext': WidgetId.Find,
|
|
9949
|
-
// 'FindWidget.focusPrevious': WidgetId.Find,
|
|
9950
|
-
'FindWidget.close': Find,
|
|
9951
|
-
// 'FindWidget.focusIndex': WidgetId.Find,
|
|
9952
|
-
// 'FindWidget.focusFirst': WidgetId.Find,
|
|
9953
|
-
// 'FindWidget.focusLast': WidgetId.Find,
|
|
9954
|
-
'FindWidget.toggleReplace': Find,
|
|
9955
|
-
'FindWidget.handleFocus': Find,
|
|
9956
|
-
'FindWidget.handleBlur': Find,
|
|
9957
|
-
'FindWidget.handleToggleReplaceFocus': Find,
|
|
9958
|
-
'FindWidget.handleInput': Find,
|
|
9959
|
-
'FindWidget.handleReplaceInput': Find,
|
|
9960
|
-
'FindWidget.handleReplaceFocus': Find,
|
|
9961
|
-
'FindWidget.focusFind': Find,
|
|
9962
|
-
'FindWidget.focusToggleReplace': Find,
|
|
9963
|
-
'FindWidget.focusReplace': Find,
|
|
9964
|
-
'FindWidget.focusReplaceButton': Find,
|
|
9965
|
-
'FindWidget.focusReplaceAllButton': Find,
|
|
9966
|
-
'FindWidget.focusNextMatchButton': Find,
|
|
9967
|
-
'FindWidget.focusPreviousMatchButton': Find,
|
|
9968
|
-
'FindWidget.focusCloseButton': Find
|
|
9969
|
-
|
|
9970
|
-
// 'EditorCompletion.handleWheel': WidgetId.Completion,
|
|
9971
|
-
// 'EditorCompletion.focusFirst': WidgetId.Completion,
|
|
9972
|
-
// 'EditorCompletion.focusNext': WidgetId.Completion,
|
|
9973
|
-
// 'EditorCompletion.focusPrevious': WidgetId.Completion,
|
|
9974
|
-
// 'EditorCompletion.focusIndex': WidgetId.Completion,
|
|
9975
|
-
// 'EditorCompletion.focusLast': WidgetId.Completion,
|
|
9976
|
-
// 'EditorCompletion.selectCurrent': WidgetId.Completion,
|
|
9977
|
-
// 'EditorCompletion.selectIndex': WidgetId.Completion,
|
|
10288
|
+
'ColorPicker.handleSliderPointerDown': ColorPicker$1,
|
|
10289
|
+
'ColorPicker.handleSliderPointerMove': ColorPicker$1
|
|
9978
10290
|
};
|
|
9979
10291
|
|
|
9980
10292
|
// TODO wrap commands globally, not per editor
|
|
@@ -10528,12 +10840,12 @@ const EditorHoverWidget = {
|
|
|
10528
10840
|
};
|
|
10529
10841
|
|
|
10530
10842
|
const registerWidgets = () => {
|
|
10531
|
-
set$7(ColorPicker, EditorColorPickerWidget);
|
|
10843
|
+
set$7(ColorPicker$1, EditorColorPickerWidget);
|
|
10532
10844
|
set$7(Completion, EditorCompletionWidget);
|
|
10533
10845
|
set$7(CompletionDetail, EditorCompletionDetailWidget);
|
|
10534
10846
|
set$7(Find, EditorFindWidget);
|
|
10535
10847
|
set$7(Hover, EditorHoverWidget);
|
|
10536
|
-
set$7(Rename, EditorRenameWidget);
|
|
10848
|
+
set$7(Rename$1, EditorRenameWidget);
|
|
10537
10849
|
set$7(SourceAction$1, EditorSourceActionWidget);
|
|
10538
10850
|
set$7(CodeGenerator, EditorCodeGeneratorWidget);
|
|
10539
10851
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/editor-worker",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Lvce Editor",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"main": "dist/editorWorkerMain.js"
|
|
7
|
+
"main": "dist/editorWorkerMain.js",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@lvce-editor/constants": "^1.9.0"
|
|
10
|
+
}
|
|
8
11
|
}
|