@lvce-editor/renderer-process 10.37.0 → 10.39.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/README.md +1 -1
- package/dist/rendererProcessMain.js +95 -95
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Renderer Process
|
|
@@ -3516,27 +3516,6 @@ class VError extends Error {
|
|
|
3516
3516
|
}
|
|
3517
3517
|
}
|
|
3518
3518
|
|
|
3519
|
-
const walkValue = (value, transferrables, isTransferrable) => {
|
|
3520
|
-
if (!value) {
|
|
3521
|
-
return;
|
|
3522
|
-
}
|
|
3523
|
-
if (isTransferrable(value)) {
|
|
3524
|
-
transferrables.push(value);
|
|
3525
|
-
return;
|
|
3526
|
-
}
|
|
3527
|
-
if (Array.isArray(value)) {
|
|
3528
|
-
for (const item of value) {
|
|
3529
|
-
walkValue(item, transferrables, isTransferrable);
|
|
3530
|
-
}
|
|
3531
|
-
return;
|
|
3532
|
-
}
|
|
3533
|
-
if (typeof value === 'object') {
|
|
3534
|
-
for (const property of Object.values(value)) {
|
|
3535
|
-
walkValue(property, transferrables, isTransferrable);
|
|
3536
|
-
}
|
|
3537
|
-
return;
|
|
3538
|
-
}
|
|
3539
|
-
};
|
|
3540
3519
|
const isMessagePort = value => {
|
|
3541
3520
|
return value && value instanceof MessagePort;
|
|
3542
3521
|
};
|
|
@@ -3561,6 +3540,27 @@ const isTransferrable = value => {
|
|
|
3561
3540
|
}
|
|
3562
3541
|
return false;
|
|
3563
3542
|
};
|
|
3543
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
3544
|
+
if (!value) {
|
|
3545
|
+
return;
|
|
3546
|
+
}
|
|
3547
|
+
if (isTransferrable(value)) {
|
|
3548
|
+
transferrables.push(value);
|
|
3549
|
+
return;
|
|
3550
|
+
}
|
|
3551
|
+
if (Array.isArray(value)) {
|
|
3552
|
+
for (const item of value) {
|
|
3553
|
+
walkValue(item, transferrables, isTransferrable);
|
|
3554
|
+
}
|
|
3555
|
+
return;
|
|
3556
|
+
}
|
|
3557
|
+
if (typeof value === 'object') {
|
|
3558
|
+
for (const property of Object.values(value)) {
|
|
3559
|
+
walkValue(property, transferrables, isTransferrable);
|
|
3560
|
+
}
|
|
3561
|
+
return;
|
|
3562
|
+
}
|
|
3563
|
+
};
|
|
3564
3564
|
const getTransferrables = value => {
|
|
3565
3565
|
const transferrables = [];
|
|
3566
3566
|
walkValue(value, transferrables, isTransferrable);
|
|
@@ -3629,30 +3629,35 @@ const NewLine = '\n';
|
|
|
3629
3629
|
const joinLines = lines => {
|
|
3630
3630
|
return lines.join(NewLine);
|
|
3631
3631
|
};
|
|
3632
|
-
const
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
3632
|
+
const RE_AT = /^\s+at/;
|
|
3633
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
3634
|
+
const isNormalStackLine = line => {
|
|
3635
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
3637
3636
|
};
|
|
3638
|
-
const
|
|
3639
|
-
const
|
|
3640
|
-
|
|
3641
|
-
|
|
3637
|
+
const getDetails = lines => {
|
|
3638
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
3639
|
+
if (index === -1) {
|
|
3640
|
+
return {
|
|
3641
|
+
actualMessage: joinLines(lines),
|
|
3642
|
+
rest: []
|
|
3643
|
+
};
|
|
3644
|
+
}
|
|
3645
|
+
let lastIndex = index - 1;
|
|
3646
|
+
while (++lastIndex < lines.length) {
|
|
3647
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
3648
|
+
break;
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3642
3651
|
return {
|
|
3643
|
-
|
|
3644
|
-
|
|
3652
|
+
actualMessage: lines[index - 1],
|
|
3653
|
+
rest: lines.slice(index, lastIndex)
|
|
3645
3654
|
};
|
|
3646
3655
|
};
|
|
3647
|
-
const
|
|
3648
|
-
|
|
3656
|
+
const splitLines = lines => {
|
|
3657
|
+
return lines.split(NewLine);
|
|
3658
|
+
};
|
|
3649
3659
|
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
3650
3660
|
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
3651
|
-
const RE_AT = /^\s+at/;
|
|
3652
|
-
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
3653
|
-
const isUnhelpfulNativeModuleError = stderr => {
|
|
3654
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
3655
|
-
};
|
|
3656
3661
|
const isMessageCodeBlockStartIndex = line => {
|
|
3657
3662
|
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
3658
3663
|
};
|
|
@@ -3667,51 +3672,46 @@ const getMessageCodeBlock = stderr => {
|
|
|
3667
3672
|
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
3668
3673
|
return relevantMessage;
|
|
3669
3674
|
};
|
|
3670
|
-
const
|
|
3671
|
-
|
|
3675
|
+
const isModuleNotFoundMessage = line => {
|
|
3676
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
3677
|
+
};
|
|
3678
|
+
const getModuleNotFoundError = stderr => {
|
|
3679
|
+
const lines = splitLines(stderr);
|
|
3680
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
3681
|
+
const message = lines[messageIndex];
|
|
3672
3682
|
return {
|
|
3673
|
-
message
|
|
3674
|
-
code:
|
|
3683
|
+
message,
|
|
3684
|
+
code: ERR_MODULE_NOT_FOUND
|
|
3675
3685
|
};
|
|
3676
3686
|
};
|
|
3677
|
-
const
|
|
3687
|
+
const isModuleNotFoundError = stderr => {
|
|
3678
3688
|
if (!stderr) {
|
|
3679
3689
|
return false;
|
|
3680
3690
|
}
|
|
3681
|
-
return stderr.includes('
|
|
3682
|
-
};
|
|
3683
|
-
const getModuleSyntaxError = () => {
|
|
3684
|
-
return {
|
|
3685
|
-
message: `ES Modules are not supported in electron`,
|
|
3686
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
3687
|
-
};
|
|
3691
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
3688
3692
|
};
|
|
3689
|
-
const
|
|
3693
|
+
const isModulesSyntaxError = stderr => {
|
|
3690
3694
|
if (!stderr) {
|
|
3691
3695
|
return false;
|
|
3692
3696
|
}
|
|
3693
|
-
return stderr.includes('
|
|
3697
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
3694
3698
|
};
|
|
3695
|
-
const
|
|
3696
|
-
|
|
3699
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
3700
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
3701
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
3702
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
3697
3703
|
};
|
|
3698
|
-
const
|
|
3699
|
-
const
|
|
3700
|
-
if (index === -1) {
|
|
3701
|
-
return {
|
|
3702
|
-
actualMessage: joinLines(lines),
|
|
3703
|
-
rest: []
|
|
3704
|
-
};
|
|
3705
|
-
}
|
|
3706
|
-
let lastIndex = index - 1;
|
|
3707
|
-
while (++lastIndex < lines.length) {
|
|
3708
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
3709
|
-
break;
|
|
3710
|
-
}
|
|
3711
|
-
}
|
|
3704
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
3705
|
+
const message = getMessageCodeBlock(stderr);
|
|
3712
3706
|
return {
|
|
3713
|
-
|
|
3714
|
-
|
|
3707
|
+
message: `Incompatible native node module: ${message}`,
|
|
3708
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
3709
|
+
};
|
|
3710
|
+
};
|
|
3711
|
+
const getModuleSyntaxError = () => {
|
|
3712
|
+
return {
|
|
3713
|
+
message: `ES Modules are not supported in electron`,
|
|
3714
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
3715
3715
|
};
|
|
3716
3716
|
};
|
|
3717
3717
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -3730,7 +3730,7 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
3730
3730
|
rest
|
|
3731
3731
|
} = getDetails(lines);
|
|
3732
3732
|
return {
|
|
3733
|
-
message:
|
|
3733
|
+
message: actualMessage,
|
|
3734
3734
|
code: '',
|
|
3735
3735
|
stack: rest
|
|
3736
3736
|
};
|
|
@@ -3768,7 +3768,7 @@ const getData$2 = event => {
|
|
|
3768
3768
|
const listen$9 = () => {
|
|
3769
3769
|
return window;
|
|
3770
3770
|
};
|
|
3771
|
-
const signal$
|
|
3771
|
+
const signal$a = global => {
|
|
3772
3772
|
global.postMessage(readyMessage);
|
|
3773
3773
|
};
|
|
3774
3774
|
class IpcChildWithElectronWindow extends Ipc {
|
|
@@ -3805,27 +3805,24 @@ class IpcChildWithElectronWindow extends Ipc {
|
|
|
3805
3805
|
this._rawIpc.addEventListener('message', wrapped);
|
|
3806
3806
|
}
|
|
3807
3807
|
}
|
|
3808
|
-
const wrap$
|
|
3808
|
+
const wrap$h = window => {
|
|
3809
3809
|
return new IpcChildWithElectronWindow(window);
|
|
3810
3810
|
};
|
|
3811
3811
|
const IpcChildWithElectronWindow$1 = {
|
|
3812
3812
|
__proto__: null,
|
|
3813
3813
|
listen: listen$9,
|
|
3814
|
-
signal: signal$
|
|
3815
|
-
wrap: wrap$
|
|
3814
|
+
signal: signal$a,
|
|
3815
|
+
wrap: wrap$h
|
|
3816
3816
|
};
|
|
3817
3817
|
const listen$8 = ({
|
|
3818
3818
|
port
|
|
3819
3819
|
}) => {
|
|
3820
3820
|
return port;
|
|
3821
3821
|
};
|
|
3822
|
-
const signal$
|
|
3822
|
+
const signal$9 = port => {
|
|
3823
3823
|
port.postMessage(readyMessage);
|
|
3824
3824
|
};
|
|
3825
3825
|
class IpcChildWithMessagePort extends Ipc {
|
|
3826
|
-
constructor(port) {
|
|
3827
|
-
super(port);
|
|
3828
|
-
}
|
|
3829
3826
|
getData(event) {
|
|
3830
3827
|
return getData$2(event);
|
|
3831
3828
|
}
|
|
@@ -3847,14 +3844,14 @@ class IpcChildWithMessagePort extends Ipc {
|
|
|
3847
3844
|
this._rawIpc.start();
|
|
3848
3845
|
}
|
|
3849
3846
|
}
|
|
3850
|
-
const wrap$
|
|
3847
|
+
const wrap$g = port => {
|
|
3851
3848
|
return new IpcChildWithMessagePort(port);
|
|
3852
3849
|
};
|
|
3853
3850
|
const IpcChildWithMessagePort$1 = {
|
|
3854
3851
|
__proto__: null,
|
|
3855
3852
|
listen: listen$8,
|
|
3856
|
-
signal: signal$
|
|
3857
|
-
wrap: wrap$
|
|
3853
|
+
signal: signal$9,
|
|
3854
|
+
wrap: wrap$g
|
|
3858
3855
|
};
|
|
3859
3856
|
const listen$7 = () => {
|
|
3860
3857
|
// @ts-ignore
|
|
@@ -3863,7 +3860,7 @@ const listen$7 = () => {
|
|
|
3863
3860
|
}
|
|
3864
3861
|
return globalThis;
|
|
3865
3862
|
};
|
|
3866
|
-
const signal$
|
|
3863
|
+
const signal$8 = global => {
|
|
3867
3864
|
global.postMessage(readyMessage);
|
|
3868
3865
|
};
|
|
3869
3866
|
class IpcChildWithModuleWorker extends Ipc {
|
|
@@ -3889,14 +3886,14 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
3889
3886
|
this._rawIpc.addEventListener('message', callback);
|
|
3890
3887
|
}
|
|
3891
3888
|
}
|
|
3892
|
-
const wrap$
|
|
3889
|
+
const wrap$f = global => {
|
|
3893
3890
|
return new IpcChildWithModuleWorker(global);
|
|
3894
3891
|
};
|
|
3895
3892
|
const IpcChildWithModuleWorker$1 = {
|
|
3896
3893
|
__proto__: null,
|
|
3897
3894
|
listen: listen$7,
|
|
3898
|
-
signal: signal$
|
|
3899
|
-
wrap: wrap$
|
|
3895
|
+
signal: signal$8,
|
|
3896
|
+
wrap: wrap$f
|
|
3900
3897
|
};
|
|
3901
3898
|
const withResolvers = () => {
|
|
3902
3899
|
let _resolve;
|
|
@@ -3904,6 +3901,7 @@ const withResolvers = () => {
|
|
|
3904
3901
|
_resolve = resolve;
|
|
3905
3902
|
});
|
|
3906
3903
|
return {
|
|
3904
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3907
3905
|
resolve: _resolve,
|
|
3908
3906
|
promise
|
|
3909
3907
|
};
|
|
@@ -3922,8 +3920,8 @@ const waitForFirstMessage = async port => {
|
|
|
3922
3920
|
};
|
|
3923
3921
|
const listen$6 = async () => {
|
|
3924
3922
|
const parentIpcRaw = listen$7();
|
|
3925
|
-
signal$
|
|
3926
|
-
const parentIpc = wrap$
|
|
3923
|
+
signal$8(parentIpcRaw);
|
|
3924
|
+
const parentIpc = wrap$f(parentIpcRaw);
|
|
3927
3925
|
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
3928
3926
|
if (firstMessage.method !== 'initialize') {
|
|
3929
3927
|
throw new IpcError('unexpected first message');
|
|
@@ -3942,9 +3940,6 @@ const listen$6 = async () => {
|
|
|
3942
3940
|
return globalThis;
|
|
3943
3941
|
};
|
|
3944
3942
|
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
3945
|
-
constructor(port) {
|
|
3946
|
-
super(port);
|
|
3947
|
-
}
|
|
3948
3943
|
getData(event) {
|
|
3949
3944
|
return getData$2(event);
|
|
3950
3945
|
}
|
|
@@ -3968,13 +3963,13 @@ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
|
3968
3963
|
this._rawIpc.start();
|
|
3969
3964
|
}
|
|
3970
3965
|
}
|
|
3971
|
-
const wrap$
|
|
3966
|
+
const wrap$e = port => {
|
|
3972
3967
|
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
3973
3968
|
};
|
|
3974
3969
|
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
3975
3970
|
__proto__: null,
|
|
3976
3971
|
listen: listen$6,
|
|
3977
|
-
wrap: wrap$
|
|
3972
|
+
wrap: wrap$e
|
|
3978
3973
|
};
|
|
3979
3974
|
|
|
3980
3975
|
// TODO use handleIncomingIpc function
|
|
@@ -6549,12 +6544,14 @@ const listen = async ({
|
|
|
6549
6544
|
...options
|
|
6550
6545
|
}) => {
|
|
6551
6546
|
const module = await getModule(method);
|
|
6547
|
+
// @ts-ignore
|
|
6552
6548
|
const rawIpc = await module.listen(options);
|
|
6553
6549
|
// @ts-ignore
|
|
6554
6550
|
if (module.signal) {
|
|
6555
6551
|
// @ts-ignore
|
|
6556
6552
|
module.signal(rawIpc);
|
|
6557
6553
|
}
|
|
6554
|
+
// @ts-ignore
|
|
6558
6555
|
const ipc = module.wrap(rawIpc);
|
|
6559
6556
|
return ipc;
|
|
6560
6557
|
};
|
|
@@ -6626,7 +6623,7 @@ const waitForFrameToLoad = $Frame => {
|
|
|
6626
6623
|
};
|
|
6627
6624
|
|
|
6628
6625
|
// TODO could use browser view when running in electron
|
|
6629
|
-
const create$w = async (uid, src, sandbox, csp, credentialless, permissionPolicy) => {
|
|
6626
|
+
const create$w = async (uid, src, sandbox, csp, credentialless, permissionPolicy, title) => {
|
|
6630
6627
|
const $Iframe = document.createElement('iframe');
|
|
6631
6628
|
setIframeCredentialless($Iframe, credentialless);
|
|
6632
6629
|
setIframeCsp($Iframe, csp);
|
|
@@ -6635,6 +6632,9 @@ const create$w = async (uid, src, sandbox, csp, credentialless, permissionPolicy
|
|
|
6635
6632
|
set($Iframe, permissionPolicy);
|
|
6636
6633
|
// TODO set classname from iframe worker
|
|
6637
6634
|
$Iframe.className = 'E2eTestIframe WebViewIframe';
|
|
6635
|
+
if (title) {
|
|
6636
|
+
$Iframe.title = title;
|
|
6637
|
+
}
|
|
6638
6638
|
set$2(uid, $Iframe);
|
|
6639
6639
|
// TODO make make waitForFrameToLoad a separate command
|
|
6640
6640
|
};
|