@lvce-editor/output-view 1.7.0 → 1.8.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/outputViewWorkerMain.js +291 -377
- package/package.json +1 -1
|
@@ -368,9 +368,103 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
368
368
|
listen: listen$6,
|
|
369
369
|
wrap: wrap$e
|
|
370
370
|
};
|
|
371
|
+
const addListener = (emitter, type, callback) => {
|
|
372
|
+
if ('addEventListener' in emitter) {
|
|
373
|
+
emitter.addEventListener(type, callback);
|
|
374
|
+
} else {
|
|
375
|
+
emitter.on(type, callback);
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
const removeListener = (emitter, type, callback) => {
|
|
379
|
+
if ('removeEventListener' in emitter) {
|
|
380
|
+
emitter.removeEventListener(type, callback);
|
|
381
|
+
} else {
|
|
382
|
+
emitter.off(type, callback);
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
386
|
+
const {
|
|
387
|
+
resolve,
|
|
388
|
+
promise
|
|
389
|
+
} = Promise.withResolvers();
|
|
390
|
+
const listenerMap = Object.create(null);
|
|
391
|
+
const cleanup = value => {
|
|
392
|
+
for (const event of Object.keys(eventMap)) {
|
|
393
|
+
removeListener(eventEmitter, event, listenerMap[event]);
|
|
394
|
+
}
|
|
395
|
+
resolve(value);
|
|
396
|
+
};
|
|
397
|
+
for (const [event, type] of Object.entries(eventMap)) {
|
|
398
|
+
const listener = event => {
|
|
399
|
+
cleanup({
|
|
400
|
+
type,
|
|
401
|
+
event
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
addListener(eventEmitter, event, listener);
|
|
405
|
+
listenerMap[event] = listener;
|
|
406
|
+
}
|
|
407
|
+
return promise;
|
|
408
|
+
};
|
|
409
|
+
const Message$1 = 3;
|
|
410
|
+
const create$5$1 = async ({
|
|
411
|
+
messagePort,
|
|
412
|
+
isMessagePortOpen
|
|
413
|
+
}) => {
|
|
414
|
+
if (!isMessagePort(messagePort)) {
|
|
415
|
+
throw new IpcError('port must be of type MessagePort');
|
|
416
|
+
}
|
|
417
|
+
if (isMessagePortOpen) {
|
|
418
|
+
return messagePort;
|
|
419
|
+
}
|
|
420
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
421
|
+
message: Message$1
|
|
422
|
+
});
|
|
423
|
+
messagePort.start();
|
|
424
|
+
const {
|
|
425
|
+
type,
|
|
426
|
+
event
|
|
427
|
+
} = await eventPromise;
|
|
428
|
+
if (type !== Message$1) {
|
|
429
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
430
|
+
}
|
|
431
|
+
if (event.data !== readyMessage) {
|
|
432
|
+
throw new IpcError('unexpected first message');
|
|
433
|
+
}
|
|
434
|
+
return messagePort;
|
|
435
|
+
};
|
|
436
|
+
const signal$1 = messagePort => {
|
|
437
|
+
messagePort.start();
|
|
438
|
+
};
|
|
439
|
+
class IpcParentWithMessagePort extends Ipc {
|
|
440
|
+
getData = getData$2;
|
|
441
|
+
send(message) {
|
|
442
|
+
this._rawIpc.postMessage(message);
|
|
443
|
+
}
|
|
444
|
+
sendAndTransfer(message) {
|
|
445
|
+
const transfer = getTransferrables(message);
|
|
446
|
+
this._rawIpc.postMessage(message, transfer);
|
|
447
|
+
}
|
|
448
|
+
dispose() {
|
|
449
|
+
this._rawIpc.close();
|
|
450
|
+
}
|
|
451
|
+
onMessage(callback) {
|
|
452
|
+
this._rawIpc.addEventListener('message', callback);
|
|
453
|
+
}
|
|
454
|
+
onClose(callback) {}
|
|
455
|
+
}
|
|
456
|
+
const wrap$5 = messagePort => {
|
|
457
|
+
return new IpcParentWithMessagePort(messagePort);
|
|
458
|
+
};
|
|
459
|
+
const IpcParentWithMessagePort$1 = {
|
|
460
|
+
__proto__: null,
|
|
461
|
+
create: create$5$1,
|
|
462
|
+
signal: signal$1,
|
|
463
|
+
wrap: wrap$5
|
|
464
|
+
};
|
|
371
465
|
|
|
372
466
|
const Two = '2.0';
|
|
373
|
-
const create$4 = (method, params) => {
|
|
467
|
+
const create$4$1 = (method, params) => {
|
|
374
468
|
return {
|
|
375
469
|
jsonrpc: Two,
|
|
376
470
|
method,
|
|
@@ -378,7 +472,7 @@ const create$4 = (method, params) => {
|
|
|
378
472
|
};
|
|
379
473
|
};
|
|
380
474
|
const callbacks = Object.create(null);
|
|
381
|
-
const set$
|
|
475
|
+
const set$4 = (id, fn) => {
|
|
382
476
|
callbacks[id] = fn;
|
|
383
477
|
};
|
|
384
478
|
const get$2 = id => {
|
|
@@ -397,7 +491,7 @@ const registerPromise = () => {
|
|
|
397
491
|
resolve,
|
|
398
492
|
promise
|
|
399
493
|
} = Promise.withResolvers();
|
|
400
|
-
set$
|
|
494
|
+
set$4(id, resolve);
|
|
401
495
|
return {
|
|
402
496
|
id,
|
|
403
497
|
promise
|
|
@@ -625,7 +719,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
625
719
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
626
720
|
return create$1$1(id, errorProperty);
|
|
627
721
|
};
|
|
628
|
-
const create$
|
|
722
|
+
const create$6 = (message, result) => {
|
|
629
723
|
return {
|
|
630
724
|
jsonrpc: Two,
|
|
631
725
|
id: message.id,
|
|
@@ -634,7 +728,7 @@ const create$5 = (message, result) => {
|
|
|
634
728
|
};
|
|
635
729
|
const getSuccessResponse = (message, result) => {
|
|
636
730
|
const resultProperty = result ?? null;
|
|
637
|
-
return create$
|
|
731
|
+
return create$6(message, resultProperty);
|
|
638
732
|
};
|
|
639
733
|
const getErrorResponseSimple = (id, error) => {
|
|
640
734
|
return {
|
|
@@ -739,7 +833,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
739
833
|
return unwrapJsonRpcResult(responseMessage);
|
|
740
834
|
};
|
|
741
835
|
const send = (transport, method, ...params) => {
|
|
742
|
-
const message = create$4(method, params);
|
|
836
|
+
const message = create$4$1(method, params);
|
|
743
837
|
transport.send(message);
|
|
744
838
|
};
|
|
745
839
|
const invoke = (ipc, method, ...params) => {
|
|
@@ -822,7 +916,41 @@ const listen$1 = async (module, options) => {
|
|
|
822
916
|
const ipc = module.wrap(rawIpc);
|
|
823
917
|
return ipc;
|
|
824
918
|
};
|
|
919
|
+
const create$5 = async ({
|
|
920
|
+
commandMap,
|
|
921
|
+
messagePort
|
|
922
|
+
}) => {
|
|
923
|
+
// TODO create a commandMap per rpc instance
|
|
924
|
+
register(commandMap);
|
|
925
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
926
|
+
messagePort,
|
|
927
|
+
isMessagePortOpen: true
|
|
928
|
+
});
|
|
929
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
930
|
+
handleIpc(ipc);
|
|
931
|
+
const rpc = createRpc(ipc);
|
|
932
|
+
messagePort.start();
|
|
933
|
+
return rpc;
|
|
934
|
+
};
|
|
825
935
|
const create$3 = async ({
|
|
936
|
+
commandMap,
|
|
937
|
+
send
|
|
938
|
+
}) => {
|
|
939
|
+
const {
|
|
940
|
+
port1,
|
|
941
|
+
port2
|
|
942
|
+
} = new MessageChannel();
|
|
943
|
+
await send(port1);
|
|
944
|
+
return create$5({
|
|
945
|
+
commandMap,
|
|
946
|
+
messagePort: port2
|
|
947
|
+
});
|
|
948
|
+
};
|
|
949
|
+
const TransferMessagePortRpcParent = {
|
|
950
|
+
__proto__: null,
|
|
951
|
+
create: create$3
|
|
952
|
+
};
|
|
953
|
+
const create$4 = async ({
|
|
826
954
|
commandMap
|
|
827
955
|
}) => {
|
|
828
956
|
// TODO create a commandMap per rpc instance
|
|
@@ -834,7 +962,7 @@ const create$3 = async ({
|
|
|
834
962
|
};
|
|
835
963
|
const WebWorkerRpcClient = {
|
|
836
964
|
__proto__: null,
|
|
837
|
-
create: create$
|
|
965
|
+
create: create$4
|
|
838
966
|
};
|
|
839
967
|
|
|
840
968
|
const toCommandId$1 = key => {
|
|
@@ -933,7 +1061,7 @@ const Script = 2;
|
|
|
933
1061
|
|
|
934
1062
|
const {
|
|
935
1063
|
get: get$1,
|
|
936
|
-
set: set$
|
|
1064
|
+
set: set$2,
|
|
937
1065
|
wrapCommand,
|
|
938
1066
|
wrapGetter
|
|
939
1067
|
} = create$2();
|
|
@@ -961,9 +1089,10 @@ const create$1 = (id, uri, x, y, width, height, workspaceUri) => {
|
|
|
961
1089
|
options: [],
|
|
962
1090
|
error: '',
|
|
963
1091
|
errorCode: 0,
|
|
964
|
-
buttons: []
|
|
1092
|
+
buttons: [],
|
|
1093
|
+
filteredItems: []
|
|
965
1094
|
};
|
|
966
|
-
set$
|
|
1095
|
+
set$2(id, state, state);
|
|
967
1096
|
};
|
|
968
1097
|
|
|
969
1098
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -1070,7 +1199,7 @@ const text = data => {
|
|
|
1070
1199
|
|
|
1071
1200
|
const FocusProblems = 19;
|
|
1072
1201
|
|
|
1073
|
-
const getKeyBindings
|
|
1202
|
+
const getKeyBindings = () => {
|
|
1074
1203
|
return [{
|
|
1075
1204
|
key: KeyCode.DownArrow,
|
|
1076
1205
|
command: 'Problems.focusNext',
|
|
@@ -1118,34 +1247,6 @@ const getKeyBindings$1 = () => {
|
|
|
1118
1247
|
}];
|
|
1119
1248
|
};
|
|
1120
1249
|
|
|
1121
|
-
const handleButtonClick = async (state, name) => {
|
|
1122
|
-
// TODO
|
|
1123
|
-
return {
|
|
1124
|
-
...state
|
|
1125
|
-
};
|
|
1126
|
-
};
|
|
1127
|
-
|
|
1128
|
-
const handleData = async state => {
|
|
1129
|
-
// TODO
|
|
1130
|
-
return {
|
|
1131
|
-
...state
|
|
1132
|
-
};
|
|
1133
|
-
};
|
|
1134
|
-
|
|
1135
|
-
const handleError = async state => {
|
|
1136
|
-
// TODO
|
|
1137
|
-
return {
|
|
1138
|
-
...state
|
|
1139
|
-
};
|
|
1140
|
-
};
|
|
1141
|
-
|
|
1142
|
-
const handleFilterInput = async (state, value) => {
|
|
1143
|
-
return {
|
|
1144
|
-
...state,
|
|
1145
|
-
filterValue: value
|
|
1146
|
-
};
|
|
1147
|
-
};
|
|
1148
|
-
|
|
1149
1250
|
const rpcs = Object.create(null);
|
|
1150
1251
|
const set$g = (id, rpc) => {
|
|
1151
1252
|
rpcs[id] = rpc;
|
|
@@ -1179,336 +1280,41 @@ const create = rpcId => {
|
|
|
1179
1280
|
}
|
|
1180
1281
|
};
|
|
1181
1282
|
};
|
|
1182
|
-
const DebugWorker$1 = 55;
|
|
1183
1283
|
const RendererWorker$1 = 1;
|
|
1284
|
+
const FileSystemWorker$1 = 209;
|
|
1184
1285
|
const {
|
|
1185
|
-
invoke: invoke$
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
} = create(RendererWorker$1);
|
|
1190
|
-
const searchFileHtml = async uri => {
|
|
1191
|
-
return invoke$3('ExtensionHost.searchFileWithHtml', uri);
|
|
1192
|
-
};
|
|
1193
|
-
const getFilePathElectron = async file => {
|
|
1194
|
-
return invoke$3('FileSystemHandle.getFilePathElectron', file);
|
|
1195
|
-
};
|
|
1196
|
-
const showContextMenu = async (x, y, id, ...args) => {
|
|
1197
|
-
return invoke$3('ContextMenu.show', x, y, id, ...args);
|
|
1198
|
-
};
|
|
1199
|
-
const getElectronVersion = async () => {
|
|
1200
|
-
return invoke$3('Process.getElectronVersion');
|
|
1201
|
-
};
|
|
1202
|
-
const applyBulkReplacement = async bulkEdits => {
|
|
1203
|
-
await invoke$3('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1204
|
-
};
|
|
1205
|
-
const setColorTheme = async id => {
|
|
1206
|
-
// @ts-ignore
|
|
1207
|
-
return invoke$3(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1286
|
+
invoke: invoke$7,
|
|
1287
|
+
set: set$7} = create(FileSystemWorker$1);
|
|
1288
|
+
const readFile$1 = async uri => {
|
|
1289
|
+
return invoke$7('FileSystem.readFile', uri);
|
|
1208
1290
|
};
|
|
1209
|
-
const
|
|
1210
|
-
return invoke$
|
|
1211
|
-
};
|
|
1212
|
-
const getChromeVersion = async () => {
|
|
1213
|
-
return invoke$3('Process.getChromeVersion');
|
|
1214
|
-
};
|
|
1215
|
-
const getV8Version = async () => {
|
|
1216
|
-
return invoke$3('Process.getV8Version');
|
|
1217
|
-
};
|
|
1218
|
-
const getFileHandles = async fileIds => {
|
|
1219
|
-
const files = await invoke$3('FileSystemHandle.getFileHandles', fileIds);
|
|
1220
|
-
return files;
|
|
1221
|
-
};
|
|
1222
|
-
const setWorkspacePath = async path => {
|
|
1223
|
-
await invoke$3('Workspace.setPath', path);
|
|
1224
|
-
};
|
|
1225
|
-
const registerWebViewInterceptor = async (id, port) => {
|
|
1226
|
-
await invokeAndTransfer$3('WebView.registerInterceptor', id, port);
|
|
1227
|
-
};
|
|
1228
|
-
const unregisterWebViewInterceptor = async id => {
|
|
1229
|
-
await invoke$3('WebView.unregisterInterceptor', id);
|
|
1230
|
-
};
|
|
1231
|
-
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1232
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1233
|
-
// @ts-ignore
|
|
1234
|
-
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1291
|
+
const writeFile$1 = async (uri, content) => {
|
|
1292
|
+
return invoke$7('FileSystem.writeFile', uri, content);
|
|
1235
1293
|
};
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1242
|
-
const command = 'Markdown.handleMessagePort';
|
|
1243
|
-
// @ts-ignore
|
|
1244
|
-
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1294
|
+
const FileSystemWorker = {
|
|
1295
|
+
__proto__: null,
|
|
1296
|
+
readFile: readFile$1,
|
|
1297
|
+
set: set$7,
|
|
1298
|
+
writeFile: writeFile$1
|
|
1245
1299
|
};
|
|
1246
|
-
const
|
|
1300
|
+
const {
|
|
1301
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1302
|
+
set: set$3} = create(RendererWorker$1);
|
|
1303
|
+
const sendMessagePortToFileSystemWorker$2 = async (port, rpcId) => {
|
|
1247
1304
|
const command = 'FileSystem.handleMessagePort';
|
|
1248
1305
|
// @ts-ignore
|
|
1249
1306
|
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1250
1307
|
};
|
|
1251
|
-
const readFile = async uri => {
|
|
1252
|
-
return invoke$3('FileSystem.readFile', uri);
|
|
1253
|
-
};
|
|
1254
|
-
const getWebViewSecret = async key => {
|
|
1255
|
-
// @ts-ignore
|
|
1256
|
-
return invoke$3('WebView.getSecret', key);
|
|
1257
|
-
};
|
|
1258
|
-
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1259
|
-
return invokeAndTransfer$3('WebView.setPort', uid, port, origin, portType);
|
|
1260
|
-
};
|
|
1261
|
-
const setFocus = key => {
|
|
1262
|
-
return invoke$3('Focus.setFocus', key);
|
|
1263
|
-
};
|
|
1264
|
-
const getFileIcon = async options => {
|
|
1265
|
-
return invoke$3('IconTheme.getFileIcon', options);
|
|
1266
|
-
};
|
|
1267
|
-
const getColorThemeNames = async () => {
|
|
1268
|
-
return invoke$3('ColorTheme.getColorThemeNames');
|
|
1269
|
-
};
|
|
1270
|
-
const disableExtension = async id => {
|
|
1271
|
-
return invoke$3('ExtensionManagement.disable', id);
|
|
1272
|
-
};
|
|
1273
|
-
const enableExtension = async id => {
|
|
1274
|
-
// @ts-ignore
|
|
1275
|
-
return invoke$3('ExtensionManagement.enable', id);
|
|
1276
|
-
};
|
|
1277
|
-
const handleDebugChange = async params => {
|
|
1278
|
-
// @ts-ignore
|
|
1279
|
-
return invoke$3('Run And Debug.handleChange', params);
|
|
1280
|
-
};
|
|
1281
|
-
const getFolderIcon = async options => {
|
|
1282
|
-
return invoke$3('IconTheme.getFolderIcon', options);
|
|
1283
|
-
};
|
|
1284
|
-
const closeWidget = async widgetId => {
|
|
1285
|
-
return invoke$3('Viewlet.closeWidget', widgetId);
|
|
1286
|
-
};
|
|
1287
|
-
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1288
|
-
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1289
|
-
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1290
|
-
};
|
|
1291
|
-
const sendMessagePortToSearchProcess = async port => {
|
|
1292
|
-
await invokeAndTransfer$3('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1293
|
-
};
|
|
1294
|
-
const confirm = async (message, options) => {
|
|
1295
|
-
// @ts-ignore
|
|
1296
|
-
const result = await invoke$3('Confirmprompt.prompt', message, options);
|
|
1297
|
-
return result;
|
|
1298
|
-
};
|
|
1299
|
-
const getRecentlyOpened = async () => {
|
|
1300
|
-
return invoke$3(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1301
|
-
};
|
|
1302
|
-
const getKeyBindings = async () => {
|
|
1303
|
-
return invoke$3('KeyBindingsInitial.getKeyBindings');
|
|
1304
|
-
};
|
|
1305
|
-
const writeClipBoardText = async text => {
|
|
1306
|
-
await invoke$3('ClipBoard.writeText', /* text */text);
|
|
1307
|
-
};
|
|
1308
|
-
const writeClipBoardImage = async blob => {
|
|
1309
|
-
// @ts-ignore
|
|
1310
|
-
await invoke$3('ClipBoard.writeImage', /* text */blob);
|
|
1311
|
-
};
|
|
1312
|
-
const searchFileMemory = async uri => {
|
|
1313
|
-
// @ts-ignore
|
|
1314
|
-
return invoke$3('ExtensionHost.searchFileWithMemory', uri);
|
|
1315
|
-
};
|
|
1316
|
-
const searchFileFetch = async uri => {
|
|
1317
|
-
return invoke$3('ExtensionHost.searchFileWithFetch', uri);
|
|
1318
|
-
};
|
|
1319
|
-
const showMessageBox = async options => {
|
|
1320
|
-
return invoke$3('ElectronDialog.showMessageBox', options);
|
|
1321
|
-
};
|
|
1322
|
-
const handleDebugResumed = async params => {
|
|
1323
|
-
await invoke$3('Run And Debug.handleResumed', params);
|
|
1324
|
-
};
|
|
1325
|
-
const openWidget = async name => {
|
|
1326
|
-
await invoke$3('Viewlet.openWidget', name);
|
|
1327
|
-
};
|
|
1328
|
-
const getIcons = async requests => {
|
|
1329
|
-
const icons = await invoke$3('IconTheme.getIcons', requests);
|
|
1330
|
-
return icons;
|
|
1331
|
-
};
|
|
1332
|
-
const activateByEvent = event => {
|
|
1333
|
-
return invoke$3('ExtensionHostManagement.activateByEvent', event);
|
|
1334
|
-
};
|
|
1335
|
-
const setAdditionalFocus = focusKey => {
|
|
1336
|
-
// @ts-ignore
|
|
1337
|
-
return invoke$3('Focus.setAdditionalFocus', focusKey);
|
|
1338
|
-
};
|
|
1339
|
-
const getActiveEditorId = () => {
|
|
1340
|
-
// @ts-ignore
|
|
1341
|
-
return invoke$3('GetActiveEditor.getActiveEditorId');
|
|
1342
|
-
};
|
|
1343
|
-
const getWorkspacePath = () => {
|
|
1344
|
-
return invoke$3('Workspace.getPath');
|
|
1345
|
-
};
|
|
1346
|
-
const sendMessagePortToRendererProcess = async port => {
|
|
1347
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1348
|
-
// @ts-ignore
|
|
1349
|
-
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker$1);
|
|
1350
|
-
};
|
|
1351
|
-
const getPreference = async key => {
|
|
1352
|
-
return await invoke$3('Preferences.get', key);
|
|
1353
|
-
};
|
|
1354
|
-
const getAllExtensions = async () => {
|
|
1355
|
-
return invoke$3('ExtensionManagement.getAllExtensions');
|
|
1356
|
-
};
|
|
1357
|
-
const rerenderEditor = async key => {
|
|
1358
|
-
// @ts-ignore
|
|
1359
|
-
return invoke$3('Editor.rerender', key);
|
|
1360
|
-
};
|
|
1361
|
-
const handleDebugPaused = async params => {
|
|
1362
|
-
await invoke$3('Run And Debug.handlePaused', params);
|
|
1363
|
-
};
|
|
1364
|
-
const openUri = async (uri, focus, options) => {
|
|
1365
|
-
await invoke$3('Main.openUri', uri, focus, options);
|
|
1366
|
-
};
|
|
1367
|
-
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1368
|
-
await invokeAndTransfer$3(
|
|
1369
|
-
// @ts-ignore
|
|
1370
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1371
|
-
};
|
|
1372
|
-
const handleDebugScriptParsed = async script => {
|
|
1373
|
-
await invoke$3('Run And Debug.handleScriptParsed', script);
|
|
1374
|
-
};
|
|
1375
|
-
const getWindowId = async () => {
|
|
1376
|
-
return invoke$3('GetWindowId.getWindowId');
|
|
1377
|
-
};
|
|
1378
|
-
const getBlob = async uri => {
|
|
1379
|
-
// @ts-ignore
|
|
1380
|
-
return invoke$3('FileSystem.getBlob', uri);
|
|
1381
|
-
};
|
|
1382
|
-
const getExtensionCommands = async () => {
|
|
1383
|
-
return invoke$3('ExtensionHost.getCommands');
|
|
1384
|
-
};
|
|
1385
|
-
const showErrorDialog = async errorInfo => {
|
|
1386
|
-
// @ts-ignore
|
|
1387
|
-
await invoke$3('ErrorHandling.showErrorDialog', errorInfo);
|
|
1388
|
-
};
|
|
1389
|
-
const getFolderSize = async uri => {
|
|
1390
|
-
// @ts-ignore
|
|
1391
|
-
return await invoke$3('FileSystem.getFolderSize', uri);
|
|
1392
|
-
};
|
|
1393
|
-
const getExtension = async id => {
|
|
1394
|
-
// @ts-ignore
|
|
1395
|
-
return invoke$3('ExtensionManagement.getExtension', id);
|
|
1396
|
-
};
|
|
1397
|
-
const getMarkdownDom = async html => {
|
|
1398
|
-
// @ts-ignore
|
|
1399
|
-
return invoke$3('Markdown.getVirtualDom', html);
|
|
1400
|
-
};
|
|
1401
|
-
const renderMarkdown = async (markdown, options) => {
|
|
1402
|
-
// @ts-ignore
|
|
1403
|
-
return invoke$3('Markdown.renderMarkdown', markdown, options);
|
|
1404
|
-
};
|
|
1405
|
-
const openNativeFolder = async uri => {
|
|
1406
|
-
// @ts-ignore
|
|
1407
|
-
await invoke$3('OpenNativeFolder.openNativeFolder', uri);
|
|
1408
|
-
};
|
|
1409
|
-
const uninstallExtension = async id => {
|
|
1410
|
-
return invoke$3('ExtensionManagement.uninstall', id);
|
|
1411
|
-
};
|
|
1412
|
-
const installExtension = async id => {
|
|
1413
|
-
// @ts-ignore
|
|
1414
|
-
return invoke$3('ExtensionManagement.install', id);
|
|
1415
|
-
};
|
|
1416
|
-
const openExtensionSearch = async () => {
|
|
1417
|
-
// @ts-ignore
|
|
1418
|
-
return invoke$3('SideBar.openViewlet', 'Extensions');
|
|
1419
|
-
};
|
|
1420
|
-
const setExtensionsSearchValue = async searchValue => {
|
|
1421
|
-
// @ts-ignore
|
|
1422
|
-
return invoke$3('Extensions.handleInput', searchValue);
|
|
1423
|
-
};
|
|
1424
|
-
const openExternal = async uri => {
|
|
1425
|
-
// @ts-ignore
|
|
1426
|
-
await invoke$3('Open.openExternal', uri);
|
|
1427
|
-
};
|
|
1428
|
-
const openUrl = async uri => {
|
|
1429
|
-
// @ts-ignore
|
|
1430
|
-
await invoke$3('Open.openUrl', uri);
|
|
1431
|
-
};
|
|
1432
|
-
const getAllPreferences = async () => {
|
|
1433
|
-
// @ts-ignore
|
|
1434
|
-
return invoke$3('Preferences.getAll');
|
|
1435
|
-
};
|
|
1436
1308
|
const RendererWorker = {
|
|
1437
1309
|
__proto__: null,
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
dispose: dispose$3,
|
|
1444
|
-
enableExtension,
|
|
1445
|
-
getActiveEditorId,
|
|
1446
|
-
getAllExtensions,
|
|
1447
|
-
getAllPreferences,
|
|
1448
|
-
getBlob,
|
|
1449
|
-
getChromeVersion,
|
|
1450
|
-
getColorThemeNames,
|
|
1451
|
-
getElectronVersion,
|
|
1452
|
-
getExtension,
|
|
1453
|
-
getExtensionCommands,
|
|
1454
|
-
getFileHandles,
|
|
1455
|
-
getFileIcon,
|
|
1456
|
-
getFilePathElectron,
|
|
1457
|
-
getFolderIcon,
|
|
1458
|
-
getFolderSize,
|
|
1459
|
-
getIcons,
|
|
1460
|
-
getKeyBindings,
|
|
1461
|
-
getMarkdownDom,
|
|
1462
|
-
getNodeVersion,
|
|
1463
|
-
getPreference,
|
|
1464
|
-
getRecentlyOpened,
|
|
1465
|
-
getV8Version,
|
|
1466
|
-
getWebViewSecret,
|
|
1467
|
-
getWindowId,
|
|
1468
|
-
getWorkspacePath,
|
|
1469
|
-
handleDebugChange,
|
|
1470
|
-
handleDebugPaused,
|
|
1471
|
-
handleDebugResumed,
|
|
1472
|
-
handleDebugScriptParsed,
|
|
1473
|
-
installExtension,
|
|
1474
|
-
invoke: invoke$3,
|
|
1475
|
-
invokeAndTransfer: invokeAndTransfer$3,
|
|
1476
|
-
openExtensionSearch,
|
|
1477
|
-
openExternal,
|
|
1478
|
-
openNativeFolder,
|
|
1479
|
-
openUri,
|
|
1480
|
-
openUrl,
|
|
1481
|
-
openWidget,
|
|
1310
|
+
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
|
|
1311
|
+
set: set$3};
|
|
1312
|
+
|
|
1313
|
+
const {
|
|
1314
|
+
set: set$1,
|
|
1482
1315
|
readFile,
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
rerenderEditor,
|
|
1486
|
-
searchFileFetch,
|
|
1487
|
-
searchFileHtml,
|
|
1488
|
-
searchFileMemory,
|
|
1489
|
-
sendMessagePortToEditorWorker,
|
|
1490
|
-
sendMessagePortToErrorWorker,
|
|
1491
|
-
sendMessagePortToExtensionHostWorker,
|
|
1492
|
-
sendMessagePortToFileSystemWorker,
|
|
1493
|
-
sendMessagePortToMarkdownWorker,
|
|
1494
|
-
sendMessagePortToRendererProcess,
|
|
1495
|
-
sendMessagePortToSearchProcess,
|
|
1496
|
-
sendMessagePortToSyntaxHighlightingWorker,
|
|
1497
|
-
set: set$3,
|
|
1498
|
-
setAdditionalFocus,
|
|
1499
|
-
setColorTheme,
|
|
1500
|
-
setExtensionsSearchValue,
|
|
1501
|
-
setFocus,
|
|
1502
|
-
setWebViewPort,
|
|
1503
|
-
setWorkspacePath,
|
|
1504
|
-
showContextMenu,
|
|
1505
|
-
showErrorDialog,
|
|
1506
|
-
showMessageBox,
|
|
1507
|
-
uninstallExtension,
|
|
1508
|
-
unregisterWebViewInterceptor,
|
|
1509
|
-
writeClipBoardImage,
|
|
1510
|
-
writeClipBoardText
|
|
1511
|
-
};
|
|
1316
|
+
writeFile
|
|
1317
|
+
} = FileSystemWorker;
|
|
1512
1318
|
|
|
1513
1319
|
const isFileNotFoundError = error => {
|
|
1514
1320
|
return error.message.includes('File not found');
|
|
@@ -1517,7 +1323,7 @@ const isFileNotFoundError = error => {
|
|
|
1517
1323
|
const loadLines = async uri => {
|
|
1518
1324
|
try {
|
|
1519
1325
|
// TODO use log stream, updating the output when the file is changed
|
|
1520
|
-
const content = await
|
|
1326
|
+
const content = await readFile(uri);
|
|
1521
1327
|
const lines = content.split('\n');
|
|
1522
1328
|
return {
|
|
1523
1329
|
error: '',
|
|
@@ -1540,6 +1346,90 @@ const loadLines = async uri => {
|
|
|
1540
1346
|
}
|
|
1541
1347
|
};
|
|
1542
1348
|
|
|
1349
|
+
const clear = async state => {
|
|
1350
|
+
const {
|
|
1351
|
+
selectedOption,
|
|
1352
|
+
options
|
|
1353
|
+
} = state;
|
|
1354
|
+
const option = options.find(option => option.id === selectedOption);
|
|
1355
|
+
if (!option) {
|
|
1356
|
+
return state;
|
|
1357
|
+
}
|
|
1358
|
+
const {
|
|
1359
|
+
uri
|
|
1360
|
+
} = option;
|
|
1361
|
+
await writeFile(uri, '');
|
|
1362
|
+
const {
|
|
1363
|
+
lines,
|
|
1364
|
+
code,
|
|
1365
|
+
error
|
|
1366
|
+
} = await loadLines(uri);
|
|
1367
|
+
return {
|
|
1368
|
+
...state,
|
|
1369
|
+
listItems: lines,
|
|
1370
|
+
error,
|
|
1371
|
+
errorCode: code
|
|
1372
|
+
};
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1375
|
+
const Filter = 'filter';
|
|
1376
|
+
const Output$2 = 'output';
|
|
1377
|
+
const MainProcess = 'MainProcess';
|
|
1378
|
+
const SharedProcess = 'SharedProcess';
|
|
1379
|
+
const Clear = 'Clear';
|
|
1380
|
+
const Settings = 'Settings';
|
|
1381
|
+
const ScrollLock = 'ScrollLock';
|
|
1382
|
+
|
|
1383
|
+
const noop = async state => {
|
|
1384
|
+
return state;
|
|
1385
|
+
};
|
|
1386
|
+
const getClickHandler = name => {
|
|
1387
|
+
switch (name) {
|
|
1388
|
+
case Clear:
|
|
1389
|
+
return clear;
|
|
1390
|
+
default:
|
|
1391
|
+
return noop;
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
const handleButtonClick = async (state, name) => {
|
|
1396
|
+
const fn = getClickHandler(name);
|
|
1397
|
+
return fn(state);
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1400
|
+
const handleData = async state => {
|
|
1401
|
+
// TODO
|
|
1402
|
+
return {
|
|
1403
|
+
...state
|
|
1404
|
+
};
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
const handleError = async state => {
|
|
1408
|
+
// TODO
|
|
1409
|
+
return {
|
|
1410
|
+
...state
|
|
1411
|
+
};
|
|
1412
|
+
};
|
|
1413
|
+
|
|
1414
|
+
const filterItems = (items, filterValue) => {
|
|
1415
|
+
if (!filterValue) {
|
|
1416
|
+
return items;
|
|
1417
|
+
}
|
|
1418
|
+
return items.filter(item => item.includes(filterValue));
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
const handleFilterInput = async (state, value) => {
|
|
1422
|
+
const {
|
|
1423
|
+
listItems
|
|
1424
|
+
} = state;
|
|
1425
|
+
const filteredItems = filterItems(listItems, value);
|
|
1426
|
+
return {
|
|
1427
|
+
...state,
|
|
1428
|
+
filterValue: value,
|
|
1429
|
+
filteredItems: filteredItems
|
|
1430
|
+
};
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1543
1433
|
const handleSelect = async (state, id) => {
|
|
1544
1434
|
const {
|
|
1545
1435
|
options
|
|
@@ -1562,33 +1452,55 @@ const handleSelect = async (state, id) => {
|
|
|
1562
1452
|
};
|
|
1563
1453
|
};
|
|
1564
1454
|
|
|
1565
|
-
const
|
|
1455
|
+
const {
|
|
1456
|
+
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
|
|
1457
|
+
set} = RendererWorker;
|
|
1458
|
+
|
|
1459
|
+
const sendMessagePortToFileSystemWorker = async port => {
|
|
1460
|
+
await sendMessagePortToFileSystemWorker$1(port, 0);
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1463
|
+
const createFileSystemWorkerRpc = async () => {
|
|
1464
|
+
try {
|
|
1465
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
1466
|
+
commandMap: {},
|
|
1467
|
+
send: sendMessagePortToFileSystemWorker
|
|
1468
|
+
});
|
|
1469
|
+
return rpc;
|
|
1470
|
+
} catch (error) {
|
|
1471
|
+
throw new VError(error, `Failed to create file system worker rpc`);
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
|
|
1475
|
+
const initializeFileSystemWorker = async () => {
|
|
1476
|
+
const rpc = await createFileSystemWorkerRpc();
|
|
1477
|
+
set$1(rpc);
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1480
|
+
const initialize = async () => {
|
|
1481
|
+
await initializeFileSystemWorker();
|
|
1482
|
+
};
|
|
1566
1483
|
|
|
1567
1484
|
const getSelectedItem = platform => {
|
|
1568
|
-
return
|
|
1485
|
+
return MainProcess;
|
|
1569
1486
|
};
|
|
1570
1487
|
|
|
1571
1488
|
const loadButtons = () => {
|
|
1572
1489
|
return [{
|
|
1573
|
-
id:
|
|
1490
|
+
id: Clear,
|
|
1574
1491
|
label: 'Clear',
|
|
1575
1492
|
icon: 'MaskIconClearAll'
|
|
1576
1493
|
}, {
|
|
1577
|
-
id:
|
|
1494
|
+
id: ScrollLock,
|
|
1578
1495
|
label: 'Scroll Lock',
|
|
1579
1496
|
icon: 'MaskIconListFlat'
|
|
1580
1497
|
}, {
|
|
1581
|
-
id:
|
|
1498
|
+
id: Settings,
|
|
1582
1499
|
label: 'Settings',
|
|
1583
1500
|
icon: 'MaskIconListFlat'
|
|
1584
1501
|
}];
|
|
1585
1502
|
};
|
|
1586
1503
|
|
|
1587
|
-
const Filter = 'filter';
|
|
1588
|
-
const Output$2 = 'output';
|
|
1589
|
-
const MainProcess = 'MainProcess';
|
|
1590
|
-
const SharedProcess = 'SharedProcess';
|
|
1591
|
-
|
|
1592
1504
|
const loadOptions = async platform => {
|
|
1593
1505
|
return [{
|
|
1594
1506
|
id: MainProcess,
|
|
@@ -1612,13 +1524,17 @@ const getSavedCollapsedUris = savedState => {
|
|
|
1612
1524
|
};
|
|
1613
1525
|
const loadContent = async (state, savedState) => {
|
|
1614
1526
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
1615
|
-
const
|
|
1527
|
+
const selectedId = getSelectedItem();
|
|
1616
1528
|
const options = await loadOptions();
|
|
1529
|
+
const uri = options.find(option => option.id === selectedId)?.uri;
|
|
1530
|
+
if (!uri) {
|
|
1531
|
+
throw new Error('option not found');
|
|
1532
|
+
}
|
|
1617
1533
|
const {
|
|
1618
1534
|
lines,
|
|
1619
1535
|
error,
|
|
1620
1536
|
code
|
|
1621
|
-
} = await loadLines(
|
|
1537
|
+
} = await loadLines(uri);
|
|
1622
1538
|
const buttons = loadButtons();
|
|
1623
1539
|
return {
|
|
1624
1540
|
...state,
|
|
@@ -1627,8 +1543,9 @@ const loadContent = async (state, savedState) => {
|
|
|
1627
1543
|
errorCode: code,
|
|
1628
1544
|
inputSource: Script,
|
|
1629
1545
|
listItems: lines,
|
|
1546
|
+
filteredItems: lines,
|
|
1630
1547
|
options,
|
|
1631
|
-
selectedOption:
|
|
1548
|
+
selectedOption: selectedId,
|
|
1632
1549
|
buttons
|
|
1633
1550
|
};
|
|
1634
1551
|
};
|
|
@@ -1778,7 +1695,7 @@ const getOutputVirtualDom = (lines, errorCode, error) => {
|
|
|
1778
1695
|
};
|
|
1779
1696
|
|
|
1780
1697
|
const renderItems = (oldState, newState) => {
|
|
1781
|
-
const dom = getOutputVirtualDom(newState.
|
|
1698
|
+
const dom = getOutputVirtualDom(newState.filteredItems, newState.errorCode, newState.error);
|
|
1782
1699
|
return ['Viewlet.setDom2', dom];
|
|
1783
1700
|
};
|
|
1784
1701
|
|
|
@@ -1807,7 +1724,7 @@ const render2 = (uid, diffResult) => {
|
|
|
1807
1724
|
oldState,
|
|
1808
1725
|
newState
|
|
1809
1726
|
} = get$1(uid);
|
|
1810
|
-
set$
|
|
1727
|
+
set$2(uid, newState, newState);
|
|
1811
1728
|
const commands = applyRender(oldState, newState, diffResult);
|
|
1812
1729
|
return commands;
|
|
1813
1730
|
};
|
|
@@ -1963,7 +1880,7 @@ const commandMap = {
|
|
|
1963
1880
|
'Output.diff2': diff2,
|
|
1964
1881
|
'Output.focusIndex': wrapCommand(focusIndex),
|
|
1965
1882
|
'Output.getCommandIds': getCommandIds,
|
|
1966
|
-
'Output.getKeyBindings': getKeyBindings
|
|
1883
|
+
'Output.getKeyBindings': getKeyBindings,
|
|
1967
1884
|
'Output.handleData': wrapCommand(handleData),
|
|
1968
1885
|
'Output.handleError': wrapCommand(handleError),
|
|
1969
1886
|
'Output.initialize': initialize,
|
|
@@ -1982,9 +1899,6 @@ const commandMap = {
|
|
|
1982
1899
|
'Output.handleButtonClick': wrapCommand(handleButtonClick)
|
|
1983
1900
|
};
|
|
1984
1901
|
|
|
1985
|
-
const {
|
|
1986
|
-
set} = RendererWorker;
|
|
1987
|
-
|
|
1988
1902
|
const listen = async () => {
|
|
1989
1903
|
Object.assign(commandMapRef, commandMap);
|
|
1990
1904
|
const rpc = await WebWorkerRpcClient.create({
|