@lvce-editor/opener-worker 1.2.0 → 1.3.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/openerWorkerMain.js +55 -10
- package/package.json +1 -1
package/dist/openerWorkerMain.js
CHANGED
|
@@ -677,7 +677,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
677
677
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
678
678
|
return create$1(id, errorProperty);
|
|
679
679
|
};
|
|
680
|
-
const create$
|
|
680
|
+
const create$6 = (message, result) => {
|
|
681
681
|
return {
|
|
682
682
|
jsonrpc: Two$1,
|
|
683
683
|
id: message.id,
|
|
@@ -686,7 +686,7 @@ const create$3 = (message, result) => {
|
|
|
686
686
|
};
|
|
687
687
|
const getSuccessResponse = (message, result) => {
|
|
688
688
|
const resultProperty = result ?? null;
|
|
689
|
-
return create$
|
|
689
|
+
return create$6(message, resultProperty);
|
|
690
690
|
};
|
|
691
691
|
const getErrorResponseSimple = (id, error) => {
|
|
692
692
|
return {
|
|
@@ -944,6 +944,26 @@ const PlainMessagePortRpcParent = {
|
|
|
944
944
|
__proto__: null,
|
|
945
945
|
create: create$4
|
|
946
946
|
};
|
|
947
|
+
const create$3 = async ({
|
|
948
|
+
commandMap,
|
|
949
|
+
isMessagePortOpen,
|
|
950
|
+
send
|
|
951
|
+
}) => {
|
|
952
|
+
const {
|
|
953
|
+
port1,
|
|
954
|
+
port2
|
|
955
|
+
} = new MessageChannel();
|
|
956
|
+
await send(port1);
|
|
957
|
+
return create$5({
|
|
958
|
+
commandMap,
|
|
959
|
+
isMessagePortOpen,
|
|
960
|
+
messagePort: port2
|
|
961
|
+
});
|
|
962
|
+
};
|
|
963
|
+
const TransferMessagePortRpcParent = {
|
|
964
|
+
__proto__: null,
|
|
965
|
+
create: create$3
|
|
966
|
+
};
|
|
947
967
|
const create$2 = async ({
|
|
948
968
|
commandMap
|
|
949
969
|
}) => {
|
|
@@ -984,7 +1004,7 @@ const RendererWorker = 1;
|
|
|
984
1004
|
const SharedProcess = 1492;
|
|
985
1005
|
|
|
986
1006
|
const rpcs = Object.create(null);
|
|
987
|
-
const set$
|
|
1007
|
+
const set$3 = (id, rpc) => {
|
|
988
1008
|
rpcs[id] = rpc;
|
|
989
1009
|
};
|
|
990
1010
|
const get$1 = id => {
|
|
@@ -1017,7 +1037,7 @@ const create = rpcId => {
|
|
|
1017
1037
|
const mockRpc = createMockRpc({
|
|
1018
1038
|
commandMap
|
|
1019
1039
|
});
|
|
1020
|
-
set$
|
|
1040
|
+
set$3(rpcId, mockRpc);
|
|
1021
1041
|
// @ts-ignore
|
|
1022
1042
|
mockRpc[Symbol.dispose] = () => {
|
|
1023
1043
|
remove(rpcId);
|
|
@@ -1026,18 +1046,26 @@ const create = rpcId => {
|
|
|
1026
1046
|
return mockRpc;
|
|
1027
1047
|
},
|
|
1028
1048
|
set(rpc) {
|
|
1029
|
-
set$
|
|
1049
|
+
set$3(rpcId, rpc);
|
|
1030
1050
|
}
|
|
1031
1051
|
};
|
|
1032
1052
|
};
|
|
1033
1053
|
|
|
1034
1054
|
const {
|
|
1035
1055
|
invoke: invoke$2,
|
|
1036
|
-
|
|
1056
|
+
invokeAndTransfer,
|
|
1057
|
+
set: set$2
|
|
1037
1058
|
} = create(RendererWorker);
|
|
1059
|
+
const sendMessagePortToSharedProcess = async port => {
|
|
1060
|
+
const command = 'HandleElectronMessagePort.handleElectronMessagePort';
|
|
1061
|
+
// @ts-ignore
|
|
1062
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, 0);
|
|
1063
|
+
};
|
|
1038
1064
|
|
|
1039
1065
|
const {
|
|
1040
|
-
invoke: invoke$1
|
|
1066
|
+
invoke: invoke$1,
|
|
1067
|
+
set: set$1
|
|
1068
|
+
} = create(SharedProcess);
|
|
1041
1069
|
|
|
1042
1070
|
const handleMessagePort = async (port, rpcId) => {
|
|
1043
1071
|
const rpc = await PlainMessagePortRpcParent.create({
|
|
@@ -1045,7 +1073,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
1045
1073
|
messagePort: port
|
|
1046
1074
|
});
|
|
1047
1075
|
if (rpcId) {
|
|
1048
|
-
set$
|
|
1076
|
+
set$3(rpcId, rpc);
|
|
1049
1077
|
}
|
|
1050
1078
|
};
|
|
1051
1079
|
|
|
@@ -1121,23 +1149,40 @@ const enable = () => {
|
|
|
1121
1149
|
return set(true);
|
|
1122
1150
|
};
|
|
1123
1151
|
|
|
1152
|
+
const showSaveDialog = (title, properties) => {
|
|
1153
|
+
return invoke$1('ElectronDialog.showSaveDialog', title, properties);
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1124
1156
|
const commandMap = {
|
|
1125
1157
|
'HandleMessagePort.handleMessagePort': handleMessagePort,
|
|
1126
1158
|
'Open.enableMemoryOpener': enable,
|
|
1127
1159
|
'Open.openExternal': openExternal,
|
|
1128
1160
|
'Open.openUrl': openUrl,
|
|
1129
|
-
'Open.readOpenedUrl': readOpenedMemory
|
|
1161
|
+
'Open.readOpenedUrl': readOpenedMemory,
|
|
1162
|
+
'Open.showSaveDialog': showSaveDialog
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
const send = async port => {
|
|
1166
|
+
await sendMessagePortToSharedProcess(port);
|
|
1167
|
+
};
|
|
1168
|
+
const initializeMainProcess = async () => {
|
|
1169
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
1170
|
+
commandMap: commandMap,
|
|
1171
|
+
send
|
|
1172
|
+
});
|
|
1173
|
+
set$1(rpc);
|
|
1130
1174
|
};
|
|
1131
1175
|
|
|
1132
1176
|
const initializeRendererWorker = async () => {
|
|
1133
1177
|
const rpc = await WebWorkerRpcClient.create({
|
|
1134
1178
|
commandMap: commandMap
|
|
1135
1179
|
});
|
|
1136
|
-
set$
|
|
1180
|
+
set$2(rpc);
|
|
1137
1181
|
};
|
|
1138
1182
|
|
|
1139
1183
|
const listen = async () => {
|
|
1140
1184
|
await initializeRendererWorker();
|
|
1185
|
+
await initializeMainProcess();
|
|
1141
1186
|
};
|
|
1142
1187
|
|
|
1143
1188
|
const main = async () => {
|