@lvce-editor/about-view 5.6.0 → 5.8.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/aboutWorkerMain.js +60 -29
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
@@ -470,6 +470,16 @@ const constructError = (message, type, name) => {
|
|
470
470
|
}
|
471
471
|
return new ErrorConstructor(message);
|
472
472
|
};
|
473
|
+
const joinLines$1 = lines => {
|
474
|
+
return lines.join(NewLine$1);
|
475
|
+
};
|
476
|
+
const splitLines = lines => {
|
477
|
+
return lines.split(NewLine$1);
|
478
|
+
};
|
479
|
+
const getCurrentStack = () => {
|
480
|
+
const currentStack = joinLines$1(splitLines(new Error().stack || '').slice(2));
|
481
|
+
return currentStack;
|
482
|
+
};
|
473
483
|
const getNewLineIndex = (string, startIndex = undefined) => {
|
474
484
|
return string.indexOf(NewLine$1, startIndex);
|
475
485
|
};
|
@@ -480,19 +490,16 @@ const getParentStack = error => {
|
|
480
490
|
}
|
481
491
|
return parentStack;
|
482
492
|
};
|
483
|
-
const joinLines$1 = lines => {
|
484
|
-
return lines.join(NewLine$1);
|
485
|
-
};
|
486
493
|
const MethodNotFound = -32601;
|
487
494
|
const Custom = -32001;
|
488
|
-
const splitLines = lines => {
|
489
|
-
return lines.split(NewLine$1);
|
490
|
-
};
|
491
495
|
const restoreJsonRpcError = error => {
|
496
|
+
const currentStack = getCurrentStack();
|
492
497
|
if (error && error instanceof Error) {
|
498
|
+
if (typeof error.stack === 'string') {
|
499
|
+
error.stack = error.stack + NewLine$1 + currentStack;
|
500
|
+
}
|
493
501
|
return error;
|
494
502
|
}
|
495
|
-
const currentStack = joinLines$1(splitLines(new Error().stack || '').slice(1));
|
496
503
|
if (error && error.code && error.code === MethodNotFound) {
|
497
504
|
const restoredError = new JsonRpcError(error.message);
|
498
505
|
const parentStack = getParentStack(error);
|
@@ -573,6 +580,17 @@ const getErrorType = prettyError => {
|
|
573
580
|
}
|
574
581
|
return undefined;
|
575
582
|
};
|
583
|
+
const isAlreadyStack = line => {
|
584
|
+
return line.trim().startsWith('at ');
|
585
|
+
};
|
586
|
+
const getStack = prettyError => {
|
587
|
+
const stackString = prettyError.stack || '';
|
588
|
+
const newLineIndex = stackString.indexOf('\n');
|
589
|
+
if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
|
590
|
+
return stackString.slice(newLineIndex + 1);
|
591
|
+
}
|
592
|
+
return stackString;
|
593
|
+
};
|
576
594
|
const getErrorProperty = (error, prettyError) => {
|
577
595
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
578
596
|
return {
|
@@ -585,7 +603,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
585
603
|
code: Custom,
|
586
604
|
message: prettyError.message,
|
587
605
|
data: {
|
588
|
-
stack: prettyError
|
606
|
+
stack: getStack(prettyError),
|
589
607
|
codeFrame: prettyError.codeFrame,
|
590
608
|
type: getErrorType(prettyError),
|
591
609
|
code: prettyError.code,
|
@@ -593,18 +611,18 @@ const getErrorProperty = (error, prettyError) => {
|
|
593
611
|
}
|
594
612
|
};
|
595
613
|
};
|
596
|
-
const create$1$1 = (
|
614
|
+
const create$1$1 = (id, error) => {
|
597
615
|
return {
|
598
616
|
jsonrpc: Two,
|
599
|
-
id
|
617
|
+
id,
|
600
618
|
error
|
601
619
|
};
|
602
620
|
};
|
603
|
-
const getErrorResponse = (
|
621
|
+
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
604
622
|
const prettyError = preparePrettyError(error);
|
605
623
|
logError(error, prettyError);
|
606
624
|
const errorProperty = getErrorProperty(error, prettyError);
|
607
|
-
return create$1$1(
|
625
|
+
return create$1$1(id, errorProperty);
|
608
626
|
};
|
609
627
|
const create$5 = (message, result) => {
|
610
628
|
return {
|
@@ -617,12 +635,27 @@ const getSuccessResponse = (message, result) => {
|
|
617
635
|
const resultProperty = result ?? null;
|
618
636
|
return create$5(message, resultProperty);
|
619
637
|
};
|
638
|
+
const getErrorResponseSimple = (id, error) => {
|
639
|
+
return {
|
640
|
+
jsonrpc: Two,
|
641
|
+
id,
|
642
|
+
error: {
|
643
|
+
code: Custom,
|
644
|
+
// @ts-ignore
|
645
|
+
message: error.message,
|
646
|
+
data: error
|
647
|
+
}
|
648
|
+
};
|
649
|
+
};
|
620
650
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
621
651
|
try {
|
622
652
|
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
623
653
|
return getSuccessResponse(message, result);
|
624
654
|
} catch (error) {
|
625
|
-
|
655
|
+
if (ipc.canUseSimpleErrorResponse) {
|
656
|
+
return getErrorResponseSimple(message.id, error);
|
657
|
+
}
|
658
|
+
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
626
659
|
}
|
627
660
|
};
|
628
661
|
const defaultPreparePrettyError = error => {
|
@@ -677,7 +710,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
677
710
|
try {
|
678
711
|
ipc.send(response);
|
679
712
|
} catch (error) {
|
680
|
-
const errorResponse = getErrorResponse(message, error, preparePrettyError, logError);
|
713
|
+
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
681
714
|
ipc.send(errorResponse);
|
682
715
|
}
|
683
716
|
return;
|
@@ -995,13 +1028,12 @@ const getKeyBindings = () => {
|
|
995
1028
|
};
|
996
1029
|
|
997
1030
|
const rpcs = Object.create(null);
|
998
|
-
const set$
|
1031
|
+
const set$d = (id, rpc) => {
|
999
1032
|
rpcs[id] = rpc;
|
1000
1033
|
};
|
1001
1034
|
const get = id => {
|
1002
1035
|
return rpcs[id];
|
1003
1036
|
};
|
1004
|
-
const RendererWorker$1 = 1;
|
1005
1037
|
|
1006
1038
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
1007
1039
|
|
@@ -1009,21 +1041,22 @@ const create = rpcId => {
|
|
1009
1041
|
return {
|
1010
1042
|
// @ts-ignore
|
1011
1043
|
invoke(method, ...params) {
|
1012
|
-
const rpc = get(
|
1044
|
+
const rpc = get(rpcId);
|
1013
1045
|
// @ts-ignore
|
1014
1046
|
return rpc.invoke(method, ...params);
|
1015
1047
|
},
|
1016
1048
|
// @ts-ignore
|
1017
1049
|
invokeAndTransfer(method, ...params) {
|
1018
|
-
const rpc = get(
|
1050
|
+
const rpc = get(rpcId);
|
1019
1051
|
// @ts-ignore
|
1020
|
-
return rpc.
|
1052
|
+
return rpc.invokeAndTransfer(method, ...params);
|
1021
1053
|
},
|
1022
1054
|
set(rpc) {
|
1023
|
-
set$
|
1055
|
+
set$d(rpcId, rpc);
|
1024
1056
|
}
|
1025
1057
|
};
|
1026
1058
|
};
|
1059
|
+
const RendererWorker$1 = 1;
|
1027
1060
|
const {
|
1028
1061
|
invoke: invoke$3,
|
1029
1062
|
set: set$3
|
@@ -1522,12 +1555,10 @@ const DialogIcon$1 = 'DialogIcon';
|
|
1522
1555
|
const DialogInfoIcon = 'DialogInfoIcon';
|
1523
1556
|
const MaskIconInfo = 'MaskIconInfo';
|
1524
1557
|
|
1525
|
-
const HandleClickClose =
|
1526
|
-
const
|
1527
|
-
const
|
1528
|
-
const
|
1529
|
-
const HandleContextMenu = 'handleContextMenu';
|
1530
|
-
const HandleFocusIn = 'handleFocusIn';
|
1558
|
+
const HandleClickClose = 1;
|
1559
|
+
const HandleClickButton = 4;
|
1560
|
+
const HandleContextMenu = 5;
|
1561
|
+
const HandleFocusIn = 6;
|
1531
1562
|
|
1532
1563
|
const Button$1 = 1;
|
1533
1564
|
const Div = 4;
|
@@ -1570,7 +1601,7 @@ const True = 'true';
|
|
1570
1601
|
const Button = 'button';
|
1571
1602
|
const Dialog = 'dialog';
|
1572
1603
|
|
1573
|
-
const getPrimaryButtonVirtualDom = (message,
|
1604
|
+
const getPrimaryButtonVirtualDom = (message, name) => {
|
1574
1605
|
return [{
|
1575
1606
|
type: Button$1,
|
1576
1607
|
className: mergeClassNames(Button$2, ButtonPrimary),
|
@@ -1580,7 +1611,7 @@ const getPrimaryButtonVirtualDom = (message, onClick, name) => {
|
|
1580
1611
|
}, text(message)];
|
1581
1612
|
};
|
1582
1613
|
|
1583
|
-
const getSecondaryButtonVirtualDom = (message,
|
1614
|
+
const getSecondaryButtonVirtualDom = (message, name) => {
|
1584
1615
|
return [{
|
1585
1616
|
type: Button$1,
|
1586
1617
|
className: mergeClassNames(Button$2, ButtonSecondary),
|
@@ -1647,7 +1678,7 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
1647
1678
|
type: Div,
|
1648
1679
|
className: DialogButtonsRow,
|
1649
1680
|
childCount: 2
|
1650
|
-
}, ...getSecondaryButtonVirtualDom(okMessage,
|
1681
|
+
}, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
|
1651
1682
|
return dom;
|
1652
1683
|
};
|
1653
1684
|
|