@lvce-editor/iframe-worker 5.34.0 → 5.35.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/iframeWorkerMain.js +423 -35
- package/package.json +1 -1
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -472,7 +472,7 @@ const create$4 = (method, params) => {
|
|
|
472
472
|
};
|
|
473
473
|
};
|
|
474
474
|
const callbacks = Object.create(null);
|
|
475
|
-
const set$
|
|
475
|
+
const set$3 = (id, fn) => {
|
|
476
476
|
callbacks[id] = fn;
|
|
477
477
|
};
|
|
478
478
|
const get$2 = id => {
|
|
@@ -482,16 +482,16 @@ const remove$1 = id => {
|
|
|
482
482
|
delete callbacks[id];
|
|
483
483
|
};
|
|
484
484
|
let id = 0;
|
|
485
|
-
const create$3 = () => {
|
|
485
|
+
const create$3$1 = () => {
|
|
486
486
|
return ++id;
|
|
487
487
|
};
|
|
488
488
|
const registerPromise = () => {
|
|
489
|
-
const id = create$3();
|
|
489
|
+
const id = create$3$1();
|
|
490
490
|
const {
|
|
491
491
|
resolve,
|
|
492
492
|
promise
|
|
493
493
|
} = Promise.withResolvers();
|
|
494
|
-
set$
|
|
494
|
+
set$3(id, resolve);
|
|
495
495
|
return {
|
|
496
496
|
id,
|
|
497
497
|
promise
|
|
@@ -571,7 +571,8 @@ const splitLines = lines => {
|
|
|
571
571
|
return lines.split(NewLine);
|
|
572
572
|
};
|
|
573
573
|
const getCurrentStack = () => {
|
|
574
|
-
const
|
|
574
|
+
const stackLinesToSkip = 3;
|
|
575
|
+
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
575
576
|
return currentStack;
|
|
576
577
|
};
|
|
577
578
|
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
@@ -705,18 +706,18 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
705
706
|
}
|
|
706
707
|
};
|
|
707
708
|
};
|
|
708
|
-
const create$1$1 = (
|
|
709
|
+
const create$1$1 = (id, error) => {
|
|
709
710
|
return {
|
|
710
711
|
jsonrpc: Two,
|
|
711
|
-
id
|
|
712
|
+
id,
|
|
712
713
|
error
|
|
713
714
|
};
|
|
714
715
|
};
|
|
715
|
-
const getErrorResponse = (
|
|
716
|
+
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
716
717
|
const prettyError = preparePrettyError(error);
|
|
717
718
|
logError(error, prettyError);
|
|
718
719
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
719
|
-
return create$1$1(
|
|
720
|
+
return create$1$1(id, errorProperty);
|
|
720
721
|
};
|
|
721
722
|
const create$5 = (message, result) => {
|
|
722
723
|
return {
|
|
@@ -729,12 +730,27 @@ const getSuccessResponse = (message, result) => {
|
|
|
729
730
|
const resultProperty = result ?? null;
|
|
730
731
|
return create$5(message, resultProperty);
|
|
731
732
|
};
|
|
733
|
+
const getErrorResponseSimple = (id, error) => {
|
|
734
|
+
return {
|
|
735
|
+
jsonrpc: Two,
|
|
736
|
+
id,
|
|
737
|
+
error: {
|
|
738
|
+
code: Custom,
|
|
739
|
+
// @ts-ignore
|
|
740
|
+
message: error.message,
|
|
741
|
+
data: error
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
};
|
|
732
745
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
733
746
|
try {
|
|
734
747
|
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
|
735
748
|
return getSuccessResponse(message, result);
|
|
736
749
|
} catch (error) {
|
|
737
|
-
|
|
750
|
+
if (ipc.canUseSimpleErrorResponse) {
|
|
751
|
+
return getErrorResponseSimple(message.id, error);
|
|
752
|
+
}
|
|
753
|
+
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
738
754
|
}
|
|
739
755
|
};
|
|
740
756
|
const defaultPreparePrettyError = error => {
|
|
@@ -789,7 +805,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
789
805
|
try {
|
|
790
806
|
ipc.send(response);
|
|
791
807
|
} catch (error) {
|
|
792
|
-
const errorResponse = getErrorResponse(message, error, preparePrettyError, logError);
|
|
808
|
+
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
793
809
|
ipc.send(errorResponse);
|
|
794
810
|
}
|
|
795
811
|
return;
|
|
@@ -820,13 +836,19 @@ const send = (transport, method, ...params) => {
|
|
|
820
836
|
const message = create$4(method, params);
|
|
821
837
|
transport.send(message);
|
|
822
838
|
};
|
|
823
|
-
const invoke$
|
|
839
|
+
const invoke$6 = (ipc, method, ...params) => {
|
|
824
840
|
return invokeHelper(ipc, method, params, false);
|
|
825
841
|
};
|
|
826
|
-
const invokeAndTransfer$
|
|
842
|
+
const invokeAndTransfer$5 = (ipc, method, ...params) => {
|
|
827
843
|
return invokeHelper(ipc, method, params, true);
|
|
828
844
|
};
|
|
829
845
|
|
|
846
|
+
class CommandNotFoundError extends Error {
|
|
847
|
+
constructor(command) {
|
|
848
|
+
super(`Command not found ${command}`);
|
|
849
|
+
this.name = 'CommandNotFoundError';
|
|
850
|
+
}
|
|
851
|
+
}
|
|
830
852
|
const commands = Object.create(null);
|
|
831
853
|
const register$4 = commandMap => {
|
|
832
854
|
Object.assign(commands, commandMap);
|
|
@@ -837,7 +859,7 @@ const getCommand = key => {
|
|
|
837
859
|
const execute = (command, ...args) => {
|
|
838
860
|
const fn = getCommand(command);
|
|
839
861
|
if (!fn) {
|
|
840
|
-
throw new
|
|
862
|
+
throw new CommandNotFoundError(command);
|
|
841
863
|
}
|
|
842
864
|
return fn(...args);
|
|
843
865
|
};
|
|
@@ -853,10 +875,10 @@ const createRpc = ipc => {
|
|
|
853
875
|
send(ipc, method, ...params);
|
|
854
876
|
},
|
|
855
877
|
invoke(method, ...params) {
|
|
856
|
-
return invoke$
|
|
878
|
+
return invoke$6(ipc, method, ...params);
|
|
857
879
|
},
|
|
858
880
|
invokeAndTransfer(method, ...params) {
|
|
859
|
-
return invokeAndTransfer$
|
|
881
|
+
return invokeAndTransfer$5(ipc, method, ...params);
|
|
860
882
|
},
|
|
861
883
|
async dispose() {
|
|
862
884
|
await ipc?.dispose();
|
|
@@ -894,7 +916,7 @@ const listen$1 = async (module, options) => {
|
|
|
894
916
|
const ipc = module.wrap(rawIpc);
|
|
895
917
|
return ipc;
|
|
896
918
|
};
|
|
897
|
-
const create$
|
|
919
|
+
const create$e = async ({
|
|
898
920
|
commandMap,
|
|
899
921
|
messagePort,
|
|
900
922
|
isMessagePortOpen
|
|
@@ -912,9 +934,9 @@ const create$9 = async ({
|
|
|
912
934
|
};
|
|
913
935
|
const MessagePortRpcParent = {
|
|
914
936
|
__proto__: null,
|
|
915
|
-
create: create$
|
|
937
|
+
create: create$e
|
|
916
938
|
};
|
|
917
|
-
const create$
|
|
939
|
+
const create$3 = async ({
|
|
918
940
|
commandMap
|
|
919
941
|
}) => {
|
|
920
942
|
// TODO create a commandMap per rpc instance
|
|
@@ -926,32 +948,396 @@ const create$2 = async ({
|
|
|
926
948
|
};
|
|
927
949
|
const WebWorkerRpcClient = {
|
|
928
950
|
__proto__: null,
|
|
929
|
-
create: create$
|
|
951
|
+
create: create$3
|
|
930
952
|
};
|
|
931
953
|
|
|
932
|
-
const
|
|
954
|
+
const DebugWorker = 55;
|
|
955
|
+
const RendererWorker$1 = 1;
|
|
933
956
|
|
|
934
957
|
const rpcs$1 = Object.create(null);
|
|
935
|
-
const set$
|
|
958
|
+
const set$2 = (id, rpc) => {
|
|
936
959
|
rpcs$1[id] = rpc;
|
|
937
960
|
};
|
|
938
961
|
const get$1 = id => {
|
|
939
962
|
return rpcs$1[id];
|
|
940
963
|
};
|
|
941
964
|
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
|
|
965
|
+
const create$2 = rpcId => {
|
|
966
|
+
return {
|
|
967
|
+
// @ts-ignore
|
|
968
|
+
invoke(method, ...params) {
|
|
969
|
+
const rpc = get$1(rpcId);
|
|
970
|
+
// @ts-ignore
|
|
971
|
+
return rpc.invoke(method, ...params);
|
|
972
|
+
},
|
|
973
|
+
// @ts-ignore
|
|
974
|
+
invokeAndTransfer(method, ...params) {
|
|
975
|
+
const rpc = get$1(rpcId);
|
|
976
|
+
// @ts-ignore
|
|
977
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
978
|
+
},
|
|
979
|
+
set(rpc) {
|
|
980
|
+
set$2(rpcId, rpc);
|
|
981
|
+
},
|
|
982
|
+
async dispose() {
|
|
983
|
+
const rpc = get$1(rpcId);
|
|
984
|
+
await rpc.dispose();
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
const {
|
|
990
|
+
invoke: invoke$5,
|
|
991
|
+
invokeAndTransfer: invokeAndTransfer$4,
|
|
992
|
+
set: set$1,
|
|
993
|
+
dispose
|
|
994
|
+
} = create$2(RendererWorker$1);
|
|
995
|
+
const searchFileHtml = async uri => {
|
|
996
|
+
return invoke$5('ExtensionHost.searchFileWithHtml', uri);
|
|
997
|
+
};
|
|
998
|
+
const getFilePathElectron = async file => {
|
|
999
|
+
return invoke$5('FileSystemHandle.getFilePathElectron', file);
|
|
1000
|
+
};
|
|
1001
|
+
const showContextMenu = async (x, y, id, ...args) => {
|
|
1002
|
+
return invoke$5('ContextMenu.show', x, y, id, ...args);
|
|
1003
|
+
};
|
|
1004
|
+
const getElectronVersion = async () => {
|
|
1005
|
+
return invoke$5('Process.getElectronVersion');
|
|
1006
|
+
};
|
|
1007
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
1008
|
+
await invoke$5('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1009
|
+
};
|
|
1010
|
+
const setColorTheme = async id => {
|
|
1011
|
+
// @ts-ignore
|
|
1012
|
+
return invoke$5(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1013
|
+
};
|
|
1014
|
+
const getNodeVersion = async () => {
|
|
1015
|
+
return invoke$5('Process.getNodeVersion');
|
|
1016
|
+
};
|
|
1017
|
+
const getChromeVersion = async () => {
|
|
1018
|
+
return invoke$5('Process.getChromeVersion');
|
|
1019
|
+
};
|
|
1020
|
+
const getV8Version = async () => {
|
|
1021
|
+
return invoke$5('Process.getV8Version');
|
|
1022
|
+
};
|
|
1023
|
+
const getFileHandles = async fileIds => {
|
|
1024
|
+
const files = await invoke$5('FileSystemHandle.getFileHandles', fileIds);
|
|
1025
|
+
return files;
|
|
1026
|
+
};
|
|
1027
|
+
const setWorkspacePath = async path => {
|
|
1028
|
+
await invoke$5('Workspace.setPath', path);
|
|
1029
|
+
};
|
|
1030
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
1031
|
+
await invokeAndTransfer$4('WebView.registerInterceptor', id, port);
|
|
1032
|
+
};
|
|
1033
|
+
const unregisterWebViewInterceptor = async id => {
|
|
1034
|
+
await invoke$5('WebView.unregisterInterceptor', id);
|
|
1035
|
+
};
|
|
1036
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1037
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1038
|
+
// @ts-ignore
|
|
1039
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1040
|
+
};
|
|
1041
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1042
|
+
const command = 'Errors.handleMessagePort';
|
|
1043
|
+
// @ts-ignore
|
|
1044
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1045
|
+
};
|
|
1046
|
+
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1047
|
+
const command = 'Markdown.handleMessagePort';
|
|
1048
|
+
// @ts-ignore
|
|
1049
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1050
|
+
};
|
|
1051
|
+
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1052
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1053
|
+
// @ts-ignore
|
|
1054
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1055
|
+
};
|
|
1056
|
+
const readFile$1 = async uri => {
|
|
1057
|
+
return invoke$5('FileSystem.readFile', uri);
|
|
1058
|
+
};
|
|
1059
|
+
const getWebViewSecret = async key => {
|
|
1060
|
+
// @ts-ignore
|
|
1061
|
+
return invoke$5('WebView.getSecret', key);
|
|
1062
|
+
};
|
|
1063
|
+
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1064
|
+
return invokeAndTransfer$4('WebView.setPort', uid, port, origin, portType);
|
|
1065
|
+
};
|
|
1066
|
+
const setFocus = key => {
|
|
1067
|
+
return invoke$5('Focus.setFocus', key);
|
|
1068
|
+
};
|
|
1069
|
+
const getFileIcon = async options => {
|
|
1070
|
+
return invoke$5('IconTheme.getFileIcon', options);
|
|
1071
|
+
};
|
|
1072
|
+
const getColorThemeNames = async () => {
|
|
1073
|
+
return invoke$5('ColorTheme.getColorThemeNames');
|
|
1074
|
+
};
|
|
1075
|
+
const disableExtension = async id => {
|
|
1076
|
+
// @ts-ignore
|
|
1077
|
+
return invoke$5('ExtensionManagement.disable', id);
|
|
1078
|
+
};
|
|
1079
|
+
const enableExtension = async id => {
|
|
1080
|
+
// @ts-ignore
|
|
1081
|
+
return invoke$5('ExtensionManagement.enable', id);
|
|
1082
|
+
};
|
|
1083
|
+
const handleDebugChange = async params => {
|
|
1084
|
+
// @ts-ignore
|
|
1085
|
+
return invoke$5('Run And Debug.handleChange', params);
|
|
1086
|
+
};
|
|
1087
|
+
const getFolderIcon = async options => {
|
|
1088
|
+
return invoke$5('IconTheme.getFolderIcon', options);
|
|
1089
|
+
};
|
|
1090
|
+
const closeWidget = async widgetId => {
|
|
1091
|
+
return invoke$5('Viewlet.closeWidget', widgetId);
|
|
1092
|
+
};
|
|
1093
|
+
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1094
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1095
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1096
|
+
};
|
|
1097
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
1098
|
+
await invokeAndTransfer$4('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1099
|
+
};
|
|
1100
|
+
const confirm = async (message, options) => {
|
|
1101
|
+
// @ts-ignore
|
|
1102
|
+
const result = await invoke$5('ConfirmPrompt.prompt', message, options);
|
|
1103
|
+
return result;
|
|
1104
|
+
};
|
|
1105
|
+
const getRecentlyOpened = async () => {
|
|
1106
|
+
return invoke$5(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1107
|
+
};
|
|
1108
|
+
const getKeyBindings = async () => {
|
|
1109
|
+
return invoke$5('KeyBindingsInitial.getKeyBindings');
|
|
1110
|
+
};
|
|
1111
|
+
const writeClipBoardText = async text => {
|
|
1112
|
+
await invoke$5('ClipBoard.writeText', /* text */text);
|
|
945
1113
|
};
|
|
946
|
-
const
|
|
947
|
-
|
|
948
|
-
|
|
1114
|
+
const writeClipBoardImage = async blob => {
|
|
1115
|
+
// @ts-ignore
|
|
1116
|
+
await invoke$5('ClipBoard.writeImage', /* text */blob);
|
|
1117
|
+
};
|
|
1118
|
+
const searchFileMemory = async uri => {
|
|
1119
|
+
// @ts-ignore
|
|
1120
|
+
return invoke$5('ExtensionHost.searchFileWithMemory', uri);
|
|
1121
|
+
};
|
|
1122
|
+
const searchFileFetch = async uri => {
|
|
1123
|
+
return invoke$5('ExtensionHost.searchFileWithFetch', uri);
|
|
1124
|
+
};
|
|
1125
|
+
const showMessageBox = async options => {
|
|
1126
|
+
return invoke$5('ElectronDialog.showMessageBox', options);
|
|
1127
|
+
};
|
|
1128
|
+
const handleDebugResumed = async params => {
|
|
1129
|
+
await invoke$5('Run And Debug.handleResumed', params);
|
|
1130
|
+
};
|
|
1131
|
+
const openWidget = async name => {
|
|
1132
|
+
await invoke$5('Viewlet.openWidget', name);
|
|
1133
|
+
};
|
|
1134
|
+
const getIcons = async requests => {
|
|
1135
|
+
const icons = await invoke$5('IconTheme.getIcons', requests);
|
|
1136
|
+
return icons;
|
|
1137
|
+
};
|
|
1138
|
+
const activateByEvent = event => {
|
|
1139
|
+
return invoke$5('ExtensionHostManagement.activateByEvent', event);
|
|
1140
|
+
};
|
|
1141
|
+
const setAdditionalFocus = focusKey => {
|
|
1142
|
+
// @ts-ignore
|
|
1143
|
+
return invoke$5('Focus.setAdditionalFocus', focusKey);
|
|
1144
|
+
};
|
|
1145
|
+
const getActiveEditorId = () => {
|
|
1146
|
+
// @ts-ignore
|
|
1147
|
+
return invoke$5('GetActiveEditor.getActiveEditorId');
|
|
1148
|
+
};
|
|
1149
|
+
const getWorkspacePath = () => {
|
|
1150
|
+
return invoke$5('Workspace.getPath');
|
|
1151
|
+
};
|
|
1152
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
1153
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1154
|
+
// @ts-ignore
|
|
1155
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1156
|
+
};
|
|
1157
|
+
const getPreference = async key => {
|
|
1158
|
+
return await invoke$5('Preferences.get', key);
|
|
1159
|
+
};
|
|
1160
|
+
const getAllExtensions = async () => {
|
|
1161
|
+
return invoke$5('ExtensionManagement.getAllExtensions');
|
|
1162
|
+
};
|
|
1163
|
+
const rerenderEditor = async key => {
|
|
1164
|
+
// @ts-ignore
|
|
1165
|
+
return invoke$5('Editor.rerender', key);
|
|
1166
|
+
};
|
|
1167
|
+
const handleDebugPaused = async params => {
|
|
1168
|
+
await invoke$5('Run And Debug.handlePaused', params);
|
|
1169
|
+
};
|
|
1170
|
+
const openUri = async (uri, focus, options) => {
|
|
1171
|
+
await invoke$5('Main.openUri', uri, focus, options);
|
|
1172
|
+
};
|
|
1173
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1174
|
+
await invokeAndTransfer$4(
|
|
1175
|
+
// @ts-ignore
|
|
1176
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1177
|
+
};
|
|
1178
|
+
const handleDebugScriptParsed = async script => {
|
|
1179
|
+
await invoke$5('Run And Debug.handleScriptParsed', script);
|
|
1180
|
+
};
|
|
1181
|
+
const getWindowId = async () => {
|
|
1182
|
+
return invoke$5('GetWindowId.getWindowId');
|
|
1183
|
+
};
|
|
1184
|
+
const getBlob = async uri => {
|
|
1185
|
+
// @ts-ignore
|
|
1186
|
+
return invoke$5('FileSystem.getBlob', uri);
|
|
1187
|
+
};
|
|
1188
|
+
const getExtensionCommands = async () => {
|
|
1189
|
+
return invoke$5('ExtensionHost.getCommands');
|
|
1190
|
+
};
|
|
1191
|
+
const showErrorDialog = async errorInfo => {
|
|
1192
|
+
// @ts-ignore
|
|
1193
|
+
await invoke$5('ErrorHandling.showErrorDialog', errorInfo);
|
|
1194
|
+
};
|
|
1195
|
+
const getFolderSize = async uri => {
|
|
1196
|
+
// @ts-ignore
|
|
1197
|
+
return await invoke$5('FileSystem.getFolderSize', uri);
|
|
1198
|
+
};
|
|
1199
|
+
const getExtension = async id => {
|
|
1200
|
+
// @ts-ignore
|
|
1201
|
+
return invoke$5('ExtensionManagement.getExtension', id);
|
|
1202
|
+
};
|
|
1203
|
+
const getMarkdownDom = async html => {
|
|
1204
|
+
// @ts-ignore
|
|
1205
|
+
return invoke$5('Markdown.getVirtualDom', html);
|
|
1206
|
+
};
|
|
1207
|
+
const renderMarkdown = async (markdown, options) => {
|
|
1208
|
+
// @ts-ignore
|
|
1209
|
+
return invoke$5('Markdown.renderMarkdown', markdown, options);
|
|
1210
|
+
};
|
|
1211
|
+
const openNativeFolder = async uri => {
|
|
1212
|
+
// @ts-ignore
|
|
1213
|
+
await invoke$5('OpenNativeFolder.openNativeFolder', uri);
|
|
1214
|
+
};
|
|
1215
|
+
const uninstallExtension = async id => {
|
|
1216
|
+
return invoke$5('ExtensionManagement.uninstall', id);
|
|
1217
|
+
};
|
|
1218
|
+
const installExtension = async id => {
|
|
1219
|
+
// @ts-ignore
|
|
1220
|
+
return invoke$5('ExtensionManagement.install', id);
|
|
1221
|
+
};
|
|
1222
|
+
const openExtensionSearch = async () => {
|
|
1223
|
+
// @ts-ignore
|
|
1224
|
+
return invoke$5('SideBar.openViewlet', 'Extensions');
|
|
1225
|
+
};
|
|
1226
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
1227
|
+
// @ts-ignore
|
|
1228
|
+
return invoke$5('Extensions.handleInput', searchValue);
|
|
1229
|
+
};
|
|
1230
|
+
const openExternal = async uri => {
|
|
1231
|
+
// @ts-ignore
|
|
1232
|
+
await invoke$5('Open.openExternal', uri);
|
|
1233
|
+
};
|
|
1234
|
+
const openUrl = async uri => {
|
|
1235
|
+
// @ts-ignore
|
|
1236
|
+
await invoke$5('Open.openUrl', uri);
|
|
1237
|
+
};
|
|
1238
|
+
const getAllPreferences = async () => {
|
|
1239
|
+
// @ts-ignore
|
|
1240
|
+
return invoke$5('Preferences.getAll');
|
|
1241
|
+
};
|
|
1242
|
+
const showSaveFilePicker = async () => {
|
|
1243
|
+
// @ts-ignore
|
|
1244
|
+
return invoke$5('FilePicker.showSaveFilePicker');
|
|
1245
|
+
};
|
|
1246
|
+
const getLogsDir = async () => {
|
|
1247
|
+
// @ts-ignore
|
|
1248
|
+
return invoke$5('PlatformPaths.getLogsDir');
|
|
949
1249
|
};
|
|
950
1250
|
|
|
1251
|
+
const RendererWorker = {
|
|
1252
|
+
__proto__: null,
|
|
1253
|
+
activateByEvent,
|
|
1254
|
+
applyBulkReplacement,
|
|
1255
|
+
closeWidget,
|
|
1256
|
+
confirm,
|
|
1257
|
+
disableExtension,
|
|
1258
|
+
dispose,
|
|
1259
|
+
enableExtension,
|
|
1260
|
+
getActiveEditorId,
|
|
1261
|
+
getAllExtensions,
|
|
1262
|
+
getAllPreferences,
|
|
1263
|
+
getBlob,
|
|
1264
|
+
getChromeVersion,
|
|
1265
|
+
getColorThemeNames,
|
|
1266
|
+
getElectronVersion,
|
|
1267
|
+
getExtension,
|
|
1268
|
+
getExtensionCommands,
|
|
1269
|
+
getFileHandles,
|
|
1270
|
+
getFileIcon,
|
|
1271
|
+
getFilePathElectron,
|
|
1272
|
+
getFolderIcon,
|
|
1273
|
+
getFolderSize,
|
|
1274
|
+
getIcons,
|
|
1275
|
+
getKeyBindings,
|
|
1276
|
+
getLogsDir,
|
|
1277
|
+
getMarkdownDom,
|
|
1278
|
+
getNodeVersion,
|
|
1279
|
+
getPreference,
|
|
1280
|
+
getRecentlyOpened,
|
|
1281
|
+
getV8Version,
|
|
1282
|
+
getWebViewSecret,
|
|
1283
|
+
getWindowId,
|
|
1284
|
+
getWorkspacePath,
|
|
1285
|
+
handleDebugChange,
|
|
1286
|
+
handleDebugPaused,
|
|
1287
|
+
handleDebugResumed,
|
|
1288
|
+
handleDebugScriptParsed,
|
|
1289
|
+
installExtension,
|
|
1290
|
+
invoke: invoke$5,
|
|
1291
|
+
invokeAndTransfer: invokeAndTransfer$4,
|
|
1292
|
+
openExtensionSearch,
|
|
1293
|
+
openExternal,
|
|
1294
|
+
openNativeFolder,
|
|
1295
|
+
openUri,
|
|
1296
|
+
openUrl,
|
|
1297
|
+
openWidget,
|
|
1298
|
+
readFile: readFile$1,
|
|
1299
|
+
registerWebViewInterceptor,
|
|
1300
|
+
renderMarkdown,
|
|
1301
|
+
rerenderEditor,
|
|
1302
|
+
searchFileFetch,
|
|
1303
|
+
searchFileHtml,
|
|
1304
|
+
searchFileMemory,
|
|
1305
|
+
sendMessagePortToEditorWorker,
|
|
1306
|
+
sendMessagePortToErrorWorker,
|
|
1307
|
+
sendMessagePortToExtensionHostWorker,
|
|
1308
|
+
sendMessagePortToFileSystemWorker,
|
|
1309
|
+
sendMessagePortToMarkdownWorker,
|
|
1310
|
+
sendMessagePortToRendererProcess,
|
|
1311
|
+
sendMessagePortToSearchProcess,
|
|
1312
|
+
sendMessagePortToSyntaxHighlightingWorker,
|
|
1313
|
+
set: set$1,
|
|
1314
|
+
setAdditionalFocus,
|
|
1315
|
+
setColorTheme,
|
|
1316
|
+
setExtensionsSearchValue,
|
|
1317
|
+
setFocus,
|
|
1318
|
+
setWebViewPort,
|
|
1319
|
+
setWorkspacePath,
|
|
1320
|
+
showContextMenu,
|
|
1321
|
+
showErrorDialog,
|
|
1322
|
+
showMessageBox,
|
|
1323
|
+
showSaveFilePicker,
|
|
1324
|
+
uninstallExtension,
|
|
1325
|
+
unregisterWebViewInterceptor,
|
|
1326
|
+
writeClipBoardImage,
|
|
1327
|
+
writeClipBoardText
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
const {
|
|
1331
|
+
invoke: invoke$4,
|
|
1332
|
+
invokeAndTransfer: invokeAndTransfer$3
|
|
1333
|
+
} = RendererWorker;
|
|
1334
|
+
|
|
951
1335
|
const invoke$3 = async (method, ...params) => {
|
|
1336
|
+
// @ts-ignore
|
|
952
1337
|
return invoke$4('WebView.compatExtensionHostWorkerInvoke', method, ...params);
|
|
953
1338
|
};
|
|
954
1339
|
const invokeAndTransfer$2 = async (method, ...params) => {
|
|
1340
|
+
// @ts-ignore
|
|
955
1341
|
return invokeAndTransfer$3('WebView.compatExtensionHostWorkerInvokeAndTransfer', method, ...params);
|
|
956
1342
|
};
|
|
957
1343
|
|
|
@@ -1163,6 +1549,7 @@ const getPortTuple = () => {
|
|
|
1163
1549
|
};
|
|
1164
1550
|
|
|
1165
1551
|
const getSavedState = async () => {
|
|
1552
|
+
// @ts-ignore
|
|
1166
1553
|
return invoke$4('WebView.getSavedState');
|
|
1167
1554
|
};
|
|
1168
1555
|
|
|
@@ -1232,6 +1619,7 @@ const getIframePermissionPolicy = webView => {
|
|
|
1232
1619
|
};
|
|
1233
1620
|
|
|
1234
1621
|
const getWebViews = async () => {
|
|
1622
|
+
// @ts-ignore
|
|
1235
1623
|
return invoke$4('WebView.getWebViews');
|
|
1236
1624
|
};
|
|
1237
1625
|
|
|
@@ -1281,20 +1669,22 @@ const getPort = () => {
|
|
|
1281
1669
|
};
|
|
1282
1670
|
|
|
1283
1671
|
const invoke$2 = async (method, ...params) => {
|
|
1672
|
+
// @ts-ignore
|
|
1284
1673
|
return invoke$4('WebView.compatRendererProcessInvoke', method, ...params);
|
|
1285
1674
|
};
|
|
1286
1675
|
const invokeAndTransfer$1 = async (method, ...params) => {
|
|
1676
|
+
// @ts-ignore
|
|
1287
1677
|
return invokeAndTransfer$3('WebView.compatRendererProcessInvokeAndTransfer', method, ...params);
|
|
1288
1678
|
};
|
|
1289
1679
|
|
|
1290
1680
|
const WebView = 'lvce-oss-webview';
|
|
1291
1681
|
|
|
1292
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1293
1682
|
const setPort = async (uid, port, origin, portType) => {
|
|
1294
1683
|
await invokeAndTransfer$1('WebView.setPort', uid, port, origin, portType);
|
|
1295
1684
|
};
|
|
1296
1685
|
|
|
1297
1686
|
const invoke$1 = async (method, ...params) => {
|
|
1687
|
+
// @ts-ignore
|
|
1298
1688
|
return invoke$4('WebView.compatSharedProcessInvoke', method, ...params);
|
|
1299
1689
|
};
|
|
1300
1690
|
|
|
@@ -1451,13 +1841,14 @@ const createAndLoadWebView = async (id, iframeSrc, sandbox, iframeCsp, credentia
|
|
|
1451
1841
|
};
|
|
1452
1842
|
|
|
1453
1843
|
const invoke = async (method, ...params) => {
|
|
1844
|
+
// @ts-ignore
|
|
1454
1845
|
return invoke$4('WebView.compatRendererWorkerInvoke', method, ...params);
|
|
1455
1846
|
};
|
|
1456
1847
|
const invokeAndTransfer = async (method, ...params) => {
|
|
1848
|
+
// @ts-ignore
|
|
1457
1849
|
return invokeAndTransfer$3('WebView.compatRendererWorkerInvokeAndTransfer', method, ...params);
|
|
1458
1850
|
};
|
|
1459
1851
|
|
|
1460
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1461
1852
|
const createSecondaryWebViewConnection = async (uid, origin, port) => {
|
|
1462
1853
|
const portType = 'application';
|
|
1463
1854
|
await invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
@@ -1608,8 +1999,6 @@ const getWebViewWorkerRpc2 = async rpcInfo => {
|
|
|
1608
1999
|
// compared to direct connections
|
|
1609
2000
|
|
|
1610
2001
|
const interceptors = Object.create(null);
|
|
1611
|
-
|
|
1612
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1613
2002
|
const add = (id, port) => {
|
|
1614
2003
|
interceptors[id] = port;
|
|
1615
2004
|
};
|
|
@@ -1638,7 +2027,6 @@ const notifyInterceptors = message => {
|
|
|
1638
2027
|
}
|
|
1639
2028
|
};
|
|
1640
2029
|
|
|
1641
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1642
2030
|
const proxyPorts = (port1, port2) => {
|
|
1643
2031
|
port1.addEventListener('message', event => {
|
|
1644
2032
|
port2.postMessage(event.data);
|
|
@@ -1862,6 +2250,7 @@ const create3 = async ({
|
|
|
1862
2250
|
};
|
|
1863
2251
|
|
|
1864
2252
|
const executeCommand = (method, ...params) => {
|
|
2253
|
+
// @ts-ignore
|
|
1865
2254
|
return invoke$4('ExecuteExternalCommand.executeExternalCommand', method, ...params);
|
|
1866
2255
|
};
|
|
1867
2256
|
|
|
@@ -1900,7 +2289,6 @@ const saveState = async () => {
|
|
|
1900
2289
|
return serialized;
|
|
1901
2290
|
};
|
|
1902
2291
|
|
|
1903
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1904
2292
|
const registerInterceptor = async (id, port) => {
|
|
1905
2293
|
add(id, port);
|
|
1906
2294
|
};
|
|
@@ -1923,7 +2311,7 @@ const listen = async () => {
|
|
|
1923
2311
|
const rpc = await WebWorkerRpcClient.create({
|
|
1924
2312
|
commandMap: commandMap
|
|
1925
2313
|
});
|
|
1926
|
-
set$1(
|
|
2314
|
+
set$1(rpc);
|
|
1927
2315
|
};
|
|
1928
2316
|
|
|
1929
2317
|
const main = async () => {
|