@lvce-editor/iframe-worker 5.31.0 → 5.33.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 +20 -22
- package/package.json +1 -1
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -303,22 +303,11 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
303
303
|
const wrap$f = global => {
|
|
304
304
|
return new IpcChildWithModuleWorker(global);
|
|
305
305
|
};
|
|
306
|
-
const withResolvers = () => {
|
|
307
|
-
let _resolve;
|
|
308
|
-
const promise = new Promise(resolve => {
|
|
309
|
-
_resolve = resolve;
|
|
310
|
-
});
|
|
311
|
-
return {
|
|
312
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
313
|
-
resolve: _resolve,
|
|
314
|
-
promise
|
|
315
|
-
};
|
|
316
|
-
};
|
|
317
306
|
const waitForFirstMessage = async port => {
|
|
318
307
|
const {
|
|
319
308
|
resolve,
|
|
320
309
|
promise
|
|
321
|
-
} = withResolvers();
|
|
310
|
+
} = Promise.withResolvers();
|
|
322
311
|
port.addEventListener('message', resolve, {
|
|
323
312
|
once: true
|
|
324
313
|
});
|
|
@@ -397,7 +386,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
397
386
|
const {
|
|
398
387
|
resolve,
|
|
399
388
|
promise
|
|
400
|
-
} = withResolvers();
|
|
389
|
+
} = Promise.withResolvers();
|
|
401
390
|
const listenerMap = Object.create(null);
|
|
402
391
|
const cleanup = value => {
|
|
403
392
|
for (const event of Object.keys(eventMap)) {
|
|
@@ -508,7 +497,7 @@ const registerPromise = () => {
|
|
|
508
497
|
promise
|
|
509
498
|
};
|
|
510
499
|
};
|
|
511
|
-
const create$2
|
|
500
|
+
const create$2 = (method, params) => {
|
|
512
501
|
const {
|
|
513
502
|
id,
|
|
514
503
|
promise
|
|
@@ -698,7 +687,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
698
687
|
}
|
|
699
688
|
};
|
|
700
689
|
};
|
|
701
|
-
const create$1$
|
|
690
|
+
const create$1$2 = (message, error) => {
|
|
702
691
|
return {
|
|
703
692
|
jsonrpc: Two,
|
|
704
693
|
id: message.id,
|
|
@@ -709,7 +698,7 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
|
|
|
709
698
|
const prettyError = preparePrettyError(error);
|
|
710
699
|
logError(error, prettyError);
|
|
711
700
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
712
|
-
return create$1$
|
|
701
|
+
return create$1$2(message, errorProperty);
|
|
713
702
|
};
|
|
714
703
|
const create$5 = (message, result) => {
|
|
715
704
|
return {
|
|
@@ -800,7 +789,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
800
789
|
const {
|
|
801
790
|
message,
|
|
802
791
|
promise
|
|
803
|
-
} = create$2
|
|
792
|
+
} = create$2(method, params);
|
|
804
793
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
805
794
|
ipc.sendAndTransfer(message);
|
|
806
795
|
} else {
|
|
@@ -850,6 +839,9 @@ const createRpc = ipc => {
|
|
|
850
839
|
},
|
|
851
840
|
invokeAndTransfer(method, ...params) {
|
|
852
841
|
return invokeAndTransfer$4(ipc, method, ...params);
|
|
842
|
+
},
|
|
843
|
+
async dispose() {
|
|
844
|
+
await ipc?.dispose();
|
|
853
845
|
}
|
|
854
846
|
};
|
|
855
847
|
return rpc;
|
|
@@ -884,7 +876,7 @@ const listen$1 = async (module, options) => {
|
|
|
884
876
|
const ipc = module.wrap(rawIpc);
|
|
885
877
|
return ipc;
|
|
886
878
|
};
|
|
887
|
-
const create$
|
|
879
|
+
const create$a = async ({
|
|
888
880
|
commandMap,
|
|
889
881
|
messagePort,
|
|
890
882
|
isMessagePortOpen
|
|
@@ -902,9 +894,9 @@ const create$6 = async ({
|
|
|
902
894
|
};
|
|
903
895
|
const MessagePortRpcParent = {
|
|
904
896
|
__proto__: null,
|
|
905
|
-
create: create$
|
|
897
|
+
create: create$a
|
|
906
898
|
};
|
|
907
|
-
const create$
|
|
899
|
+
const create$1$1 = async ({
|
|
908
900
|
commandMap
|
|
909
901
|
}) => {
|
|
910
902
|
// TODO create a commandMap per rpc instance
|
|
@@ -916,7 +908,7 @@ const create$2 = async ({
|
|
|
916
908
|
};
|
|
917
909
|
const WebWorkerRpcClient = {
|
|
918
910
|
__proto__: null,
|
|
919
|
-
create: create$
|
|
911
|
+
create: create$1$1
|
|
920
912
|
};
|
|
921
913
|
|
|
922
914
|
const RendererWorker = 1;
|
|
@@ -1702,6 +1694,7 @@ const getWebViewWorkerRpc = async rpcInfo => {
|
|
|
1702
1694
|
|
|
1703
1695
|
const createWebViewRpc$1 = async (rpcInfo, webView, savedState, uri, portId, webViewUid, origin) => {
|
|
1704
1696
|
// deprecated below
|
|
1697
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1705
1698
|
const rpc = await getWebViewWorkerRpc(rpcInfo);
|
|
1706
1699
|
const webViewInfo = {
|
|
1707
1700
|
rpc,
|
|
@@ -1850,6 +1843,10 @@ const create3 = async ({
|
|
|
1850
1843
|
};
|
|
1851
1844
|
};
|
|
1852
1845
|
|
|
1846
|
+
const executeCommand = (method, ...params) => {
|
|
1847
|
+
return invoke$4('ExecuteExternalCommand.executeExternalCommand', method, ...params);
|
|
1848
|
+
};
|
|
1849
|
+
|
|
1853
1850
|
const getSecret = async key => {
|
|
1854
1851
|
return invoke('WebView.getSecret', key);
|
|
1855
1852
|
};
|
|
@@ -1900,7 +1897,8 @@ const commandMap = {
|
|
|
1900
1897
|
'WebView.getSecret': getSecret,
|
|
1901
1898
|
'WebView.getWebViewInfo': getWebViewInfo,
|
|
1902
1899
|
'WebView.registerInterceptor': registerInterceptor,
|
|
1903
|
-
'WebView.unregisterInterceptor': unregisterInterceptor
|
|
1900
|
+
'WebView.unregisterInterceptor': unregisterInterceptor,
|
|
1901
|
+
'WebView.executeExternalCommand': executeCommand
|
|
1904
1902
|
};
|
|
1905
1903
|
|
|
1906
1904
|
const listen = async () => {
|