@lvce-editor/iframe-worker 5.33.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 +450 -44
- 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,22 +482,22 @@ 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
|
|
498
498
|
};
|
|
499
499
|
};
|
|
500
|
-
const create$2 = (method, params) => {
|
|
500
|
+
const create$2$1 = (method, params) => {
|
|
501
501
|
const {
|
|
502
502
|
id,
|
|
503
503
|
promise
|
|
@@ -564,6 +564,17 @@ const constructError = (message, type, name) => {
|
|
|
564
564
|
}
|
|
565
565
|
return new ErrorConstructor(message);
|
|
566
566
|
};
|
|
567
|
+
const joinLines = lines => {
|
|
568
|
+
return lines.join(NewLine);
|
|
569
|
+
};
|
|
570
|
+
const splitLines = lines => {
|
|
571
|
+
return lines.split(NewLine);
|
|
572
|
+
};
|
|
573
|
+
const getCurrentStack = () => {
|
|
574
|
+
const stackLinesToSkip = 3;
|
|
575
|
+
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
576
|
+
return currentStack;
|
|
577
|
+
};
|
|
567
578
|
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
568
579
|
return string.indexOf(NewLine, startIndex);
|
|
569
580
|
};
|
|
@@ -574,19 +585,16 @@ const getParentStack = error => {
|
|
|
574
585
|
}
|
|
575
586
|
return parentStack;
|
|
576
587
|
};
|
|
577
|
-
const joinLines = lines => {
|
|
578
|
-
return lines.join(NewLine);
|
|
579
|
-
};
|
|
580
588
|
const MethodNotFound = -32601;
|
|
581
589
|
const Custom = -32001;
|
|
582
|
-
const splitLines = lines => {
|
|
583
|
-
return lines.split(NewLine);
|
|
584
|
-
};
|
|
585
590
|
const restoreJsonRpcError = error => {
|
|
591
|
+
const currentStack = getCurrentStack();
|
|
586
592
|
if (error && error instanceof Error) {
|
|
593
|
+
if (typeof error.stack === 'string') {
|
|
594
|
+
error.stack = error.stack + NewLine + currentStack;
|
|
595
|
+
}
|
|
587
596
|
return error;
|
|
588
597
|
}
|
|
589
|
-
const currentStack = joinLines(splitLines(new Error().stack || '').slice(1));
|
|
590
598
|
if (error && error.code && error.code === MethodNotFound) {
|
|
591
599
|
const restoredError = new JsonRpcError(error.message);
|
|
592
600
|
const parentStack = getParentStack(error);
|
|
@@ -667,6 +675,17 @@ const getErrorType = prettyError => {
|
|
|
667
675
|
}
|
|
668
676
|
return undefined;
|
|
669
677
|
};
|
|
678
|
+
const isAlreadyStack = line => {
|
|
679
|
+
return line.trim().startsWith('at ');
|
|
680
|
+
};
|
|
681
|
+
const getStack = prettyError => {
|
|
682
|
+
const stackString = prettyError.stack || '';
|
|
683
|
+
const newLineIndex = stackString.indexOf('\n');
|
|
684
|
+
if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
|
|
685
|
+
return stackString.slice(newLineIndex + 1);
|
|
686
|
+
}
|
|
687
|
+
return stackString;
|
|
688
|
+
};
|
|
670
689
|
const getErrorProperty = (error, prettyError) => {
|
|
671
690
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
672
691
|
return {
|
|
@@ -679,7 +698,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
679
698
|
code: Custom,
|
|
680
699
|
message: prettyError.message,
|
|
681
700
|
data: {
|
|
682
|
-
stack: prettyError
|
|
701
|
+
stack: getStack(prettyError),
|
|
683
702
|
codeFrame: prettyError.codeFrame,
|
|
684
703
|
type: getErrorType(prettyError),
|
|
685
704
|
code: prettyError.code,
|
|
@@ -687,18 +706,18 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
687
706
|
}
|
|
688
707
|
};
|
|
689
708
|
};
|
|
690
|
-
const create$1$
|
|
709
|
+
const create$1$1 = (id, error) => {
|
|
691
710
|
return {
|
|
692
711
|
jsonrpc: Two,
|
|
693
|
-
id
|
|
712
|
+
id,
|
|
694
713
|
error
|
|
695
714
|
};
|
|
696
715
|
};
|
|
697
|
-
const getErrorResponse = (
|
|
716
|
+
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
698
717
|
const prettyError = preparePrettyError(error);
|
|
699
718
|
logError(error, prettyError);
|
|
700
719
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
701
|
-
return create$1$
|
|
720
|
+
return create$1$1(id, errorProperty);
|
|
702
721
|
};
|
|
703
722
|
const create$5 = (message, result) => {
|
|
704
723
|
return {
|
|
@@ -711,12 +730,27 @@ const getSuccessResponse = (message, result) => {
|
|
|
711
730
|
const resultProperty = result ?? null;
|
|
712
731
|
return create$5(message, resultProperty);
|
|
713
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
|
+
};
|
|
714
745
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
715
746
|
try {
|
|
716
747
|
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
|
717
748
|
return getSuccessResponse(message, result);
|
|
718
749
|
} catch (error) {
|
|
719
|
-
|
|
750
|
+
if (ipc.canUseSimpleErrorResponse) {
|
|
751
|
+
return getErrorResponseSimple(message.id, error);
|
|
752
|
+
}
|
|
753
|
+
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
720
754
|
}
|
|
721
755
|
};
|
|
722
756
|
const defaultPreparePrettyError = error => {
|
|
@@ -771,7 +805,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
771
805
|
try {
|
|
772
806
|
ipc.send(response);
|
|
773
807
|
} catch (error) {
|
|
774
|
-
const errorResponse = getErrorResponse(message, error, preparePrettyError, logError);
|
|
808
|
+
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
775
809
|
ipc.send(errorResponse);
|
|
776
810
|
}
|
|
777
811
|
return;
|
|
@@ -789,7 +823,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
789
823
|
const {
|
|
790
824
|
message,
|
|
791
825
|
promise
|
|
792
|
-
} = create$2(method, params);
|
|
826
|
+
} = create$2$1(method, params);
|
|
793
827
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
794
828
|
ipc.sendAndTransfer(message);
|
|
795
829
|
} else {
|
|
@@ -802,13 +836,19 @@ const send = (transport, method, ...params) => {
|
|
|
802
836
|
const message = create$4(method, params);
|
|
803
837
|
transport.send(message);
|
|
804
838
|
};
|
|
805
|
-
const invoke$
|
|
839
|
+
const invoke$6 = (ipc, method, ...params) => {
|
|
806
840
|
return invokeHelper(ipc, method, params, false);
|
|
807
841
|
};
|
|
808
|
-
const invokeAndTransfer$
|
|
842
|
+
const invokeAndTransfer$5 = (ipc, method, ...params) => {
|
|
809
843
|
return invokeHelper(ipc, method, params, true);
|
|
810
844
|
};
|
|
811
845
|
|
|
846
|
+
class CommandNotFoundError extends Error {
|
|
847
|
+
constructor(command) {
|
|
848
|
+
super(`Command not found ${command}`);
|
|
849
|
+
this.name = 'CommandNotFoundError';
|
|
850
|
+
}
|
|
851
|
+
}
|
|
812
852
|
const commands = Object.create(null);
|
|
813
853
|
const register$4 = commandMap => {
|
|
814
854
|
Object.assign(commands, commandMap);
|
|
@@ -819,7 +859,7 @@ const getCommand = key => {
|
|
|
819
859
|
const execute = (command, ...args) => {
|
|
820
860
|
const fn = getCommand(command);
|
|
821
861
|
if (!fn) {
|
|
822
|
-
throw new
|
|
862
|
+
throw new CommandNotFoundError(command);
|
|
823
863
|
}
|
|
824
864
|
return fn(...args);
|
|
825
865
|
};
|
|
@@ -835,10 +875,10 @@ const createRpc = ipc => {
|
|
|
835
875
|
send(ipc, method, ...params);
|
|
836
876
|
},
|
|
837
877
|
invoke(method, ...params) {
|
|
838
|
-
return invoke$
|
|
878
|
+
return invoke$6(ipc, method, ...params);
|
|
839
879
|
},
|
|
840
880
|
invokeAndTransfer(method, ...params) {
|
|
841
|
-
return invokeAndTransfer$
|
|
881
|
+
return invokeAndTransfer$5(ipc, method, ...params);
|
|
842
882
|
},
|
|
843
883
|
async dispose() {
|
|
844
884
|
await ipc?.dispose();
|
|
@@ -876,7 +916,7 @@ const listen$1 = async (module, options) => {
|
|
|
876
916
|
const ipc = module.wrap(rawIpc);
|
|
877
917
|
return ipc;
|
|
878
918
|
};
|
|
879
|
-
const create$
|
|
919
|
+
const create$e = async ({
|
|
880
920
|
commandMap,
|
|
881
921
|
messagePort,
|
|
882
922
|
isMessagePortOpen
|
|
@@ -894,9 +934,9 @@ const create$a = async ({
|
|
|
894
934
|
};
|
|
895
935
|
const MessagePortRpcParent = {
|
|
896
936
|
__proto__: null,
|
|
897
|
-
create: create$
|
|
937
|
+
create: create$e
|
|
898
938
|
};
|
|
899
|
-
const create$
|
|
939
|
+
const create$3 = async ({
|
|
900
940
|
commandMap
|
|
901
941
|
}) => {
|
|
902
942
|
// TODO create a commandMap per rpc instance
|
|
@@ -908,32 +948,396 @@ const create$1$1 = async ({
|
|
|
908
948
|
};
|
|
909
949
|
const WebWorkerRpcClient = {
|
|
910
950
|
__proto__: null,
|
|
911
|
-
create: create$
|
|
951
|
+
create: create$3
|
|
912
952
|
};
|
|
913
953
|
|
|
914
|
-
const
|
|
954
|
+
const DebugWorker = 55;
|
|
955
|
+
const RendererWorker$1 = 1;
|
|
915
956
|
|
|
916
957
|
const rpcs$1 = Object.create(null);
|
|
917
|
-
const set$
|
|
958
|
+
const set$2 = (id, rpc) => {
|
|
918
959
|
rpcs$1[id] = rpc;
|
|
919
960
|
};
|
|
920
961
|
const get$1 = id => {
|
|
921
962
|
return rpcs$1[id];
|
|
922
963
|
};
|
|
923
964
|
|
|
924
|
-
const
|
|
925
|
-
|
|
926
|
-
|
|
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);
|
|
927
1089
|
};
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1090
|
+
const closeWidget = async widgetId => {
|
|
1091
|
+
return invoke$5('Viewlet.closeWidget', widgetId);
|
|
931
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);
|
|
1113
|
+
};
|
|
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');
|
|
1249
|
+
};
|
|
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;
|
|
932
1334
|
|
|
933
1335
|
const invoke$3 = async (method, ...params) => {
|
|
1336
|
+
// @ts-ignore
|
|
934
1337
|
return invoke$4('WebView.compatExtensionHostWorkerInvoke', method, ...params);
|
|
935
1338
|
};
|
|
936
1339
|
const invokeAndTransfer$2 = async (method, ...params) => {
|
|
1340
|
+
// @ts-ignore
|
|
937
1341
|
return invokeAndTransfer$3('WebView.compatExtensionHostWorkerInvokeAndTransfer', method, ...params);
|
|
938
1342
|
};
|
|
939
1343
|
|
|
@@ -1145,6 +1549,7 @@ const getPortTuple = () => {
|
|
|
1145
1549
|
};
|
|
1146
1550
|
|
|
1147
1551
|
const getSavedState = async () => {
|
|
1552
|
+
// @ts-ignore
|
|
1148
1553
|
return invoke$4('WebView.getSavedState');
|
|
1149
1554
|
};
|
|
1150
1555
|
|
|
@@ -1214,6 +1619,7 @@ const getIframePermissionPolicy = webView => {
|
|
|
1214
1619
|
};
|
|
1215
1620
|
|
|
1216
1621
|
const getWebViews = async () => {
|
|
1622
|
+
// @ts-ignore
|
|
1217
1623
|
return invoke$4('WebView.getWebViews');
|
|
1218
1624
|
};
|
|
1219
1625
|
|
|
@@ -1263,20 +1669,22 @@ const getPort = () => {
|
|
|
1263
1669
|
};
|
|
1264
1670
|
|
|
1265
1671
|
const invoke$2 = async (method, ...params) => {
|
|
1672
|
+
// @ts-ignore
|
|
1266
1673
|
return invoke$4('WebView.compatRendererProcessInvoke', method, ...params);
|
|
1267
1674
|
};
|
|
1268
1675
|
const invokeAndTransfer$1 = async (method, ...params) => {
|
|
1676
|
+
// @ts-ignore
|
|
1269
1677
|
return invokeAndTransfer$3('WebView.compatRendererProcessInvokeAndTransfer', method, ...params);
|
|
1270
1678
|
};
|
|
1271
1679
|
|
|
1272
1680
|
const WebView = 'lvce-oss-webview';
|
|
1273
1681
|
|
|
1274
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1275
1682
|
const setPort = async (uid, port, origin, portType) => {
|
|
1276
1683
|
await invokeAndTransfer$1('WebView.setPort', uid, port, origin, portType);
|
|
1277
1684
|
};
|
|
1278
1685
|
|
|
1279
1686
|
const invoke$1 = async (method, ...params) => {
|
|
1687
|
+
// @ts-ignore
|
|
1280
1688
|
return invoke$4('WebView.compatSharedProcessInvoke', method, ...params);
|
|
1281
1689
|
};
|
|
1282
1690
|
|
|
@@ -1433,13 +1841,14 @@ const createAndLoadWebView = async (id, iframeSrc, sandbox, iframeCsp, credentia
|
|
|
1433
1841
|
};
|
|
1434
1842
|
|
|
1435
1843
|
const invoke = async (method, ...params) => {
|
|
1844
|
+
// @ts-ignore
|
|
1436
1845
|
return invoke$4('WebView.compatRendererWorkerInvoke', method, ...params);
|
|
1437
1846
|
};
|
|
1438
1847
|
const invokeAndTransfer = async (method, ...params) => {
|
|
1848
|
+
// @ts-ignore
|
|
1439
1849
|
return invokeAndTransfer$3('WebView.compatRendererWorkerInvokeAndTransfer', method, ...params);
|
|
1440
1850
|
};
|
|
1441
1851
|
|
|
1442
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1443
1852
|
const createSecondaryWebViewConnection = async (uid, origin, port) => {
|
|
1444
1853
|
const portType = 'application';
|
|
1445
1854
|
await invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
@@ -1590,8 +1999,6 @@ const getWebViewWorkerRpc2 = async rpcInfo => {
|
|
|
1590
1999
|
// compared to direct connections
|
|
1591
2000
|
|
|
1592
2001
|
const interceptors = Object.create(null);
|
|
1593
|
-
|
|
1594
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1595
2002
|
const add = (id, port) => {
|
|
1596
2003
|
interceptors[id] = port;
|
|
1597
2004
|
};
|
|
@@ -1620,7 +2027,6 @@ const notifyInterceptors = message => {
|
|
|
1620
2027
|
}
|
|
1621
2028
|
};
|
|
1622
2029
|
|
|
1623
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1624
2030
|
const proxyPorts = (port1, port2) => {
|
|
1625
2031
|
port1.addEventListener('message', event => {
|
|
1626
2032
|
port2.postMessage(event.data);
|
|
@@ -1844,6 +2250,7 @@ const create3 = async ({
|
|
|
1844
2250
|
};
|
|
1845
2251
|
|
|
1846
2252
|
const executeCommand = (method, ...params) => {
|
|
2253
|
+
// @ts-ignore
|
|
1847
2254
|
return invoke$4('ExecuteExternalCommand.executeExternalCommand', method, ...params);
|
|
1848
2255
|
};
|
|
1849
2256
|
|
|
@@ -1882,7 +2289,6 @@ const saveState = async () => {
|
|
|
1882
2289
|
return serialized;
|
|
1883
2290
|
};
|
|
1884
2291
|
|
|
1885
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1886
2292
|
const registerInterceptor = async (id, port) => {
|
|
1887
2293
|
add(id, port);
|
|
1888
2294
|
};
|
|
@@ -1905,7 +2311,7 @@ const listen = async () => {
|
|
|
1905
2311
|
const rpc = await WebWorkerRpcClient.create({
|
|
1906
2312
|
commandMap: commandMap
|
|
1907
2313
|
});
|
|
1908
|
-
set$1(
|
|
2314
|
+
set$1(rpc);
|
|
1909
2315
|
};
|
|
1910
2316
|
|
|
1911
2317
|
const main = async () => {
|