@lvce-editor/about-view 5.6.0 → 5.7.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.
@@ -378,7 +378,7 @@ const create$4 = (method, params) => {
378
378
  };
379
379
  };
380
380
  const callbacks = Object.create(null);
381
- const set$2 = (id, fn) => {
381
+ const set$3 = (id, fn) => {
382
382
  callbacks[id] = fn;
383
383
  };
384
384
  const get$2 = id => {
@@ -397,7 +397,7 @@ const registerPromise = () => {
397
397
  resolve,
398
398
  promise
399
399
  } = Promise.withResolvers();
400
- set$2(id, resolve);
400
+ set$3(id, resolve);
401
401
  return {
402
402
  id,
403
403
  promise
@@ -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.stack,
606
+ stack: getStack(prettyError),
589
607
  codeFrame: prettyError.codeFrame,
590
608
  type: getErrorType(prettyError),
591
609
  code: prettyError.code,
@@ -995,13 +1013,12 @@ const getKeyBindings = () => {
995
1013
  };
996
1014
 
997
1015
  const rpcs = Object.create(null);
998
- const set$6 = (id, rpc) => {
1016
+ const set$b = (id, rpc) => {
999
1017
  rpcs[id] = rpc;
1000
1018
  };
1001
1019
  const get = id => {
1002
1020
  return rpcs[id];
1003
1021
  };
1004
- const RendererWorker$1 = 1;
1005
1022
 
1006
1023
  /* eslint-disable @typescript-eslint/explicit-function-return-type */
1007
1024
 
@@ -1009,29 +1026,30 @@ const create = rpcId => {
1009
1026
  return {
1010
1027
  // @ts-ignore
1011
1028
  invoke(method, ...params) {
1012
- const rpc = get(RendererWorker$1);
1029
+ const rpc = get(rpcId);
1013
1030
  // @ts-ignore
1014
1031
  return rpc.invoke(method, ...params);
1015
1032
  },
1016
1033
  // @ts-ignore
1017
1034
  invokeAndTransfer(method, ...params) {
1018
- const rpc = get(RendererWorker$1);
1035
+ const rpc = get(rpcId);
1019
1036
  // @ts-ignore
1020
- return rpc.invoke(method, ...params);
1037
+ return rpc.invokeAndTransfer(method, ...params);
1021
1038
  },
1022
1039
  set(rpc) {
1023
- set$6(rpcId, rpc);
1040
+ set$b(rpcId, rpc);
1024
1041
  }
1025
1042
  };
1026
1043
  };
1044
+ const RendererWorker$1 = 1;
1027
1045
  const {
1028
- invoke: invoke$3,
1029
- set: set$3
1046
+ invoke: invoke$2,
1047
+ set: set$2
1030
1048
  } = create(RendererWorker$1);
1031
1049
  const RendererWorker = {
1032
1050
  __proto__: null,
1033
- invoke: invoke$3,
1034
- set: set$3
1051
+ invoke: invoke$2,
1052
+ set: set$2
1035
1053
  };
1036
1054
 
1037
1055
  const {
@@ -1522,12 +1540,10 @@ const DialogIcon$1 = 'DialogIcon';
1522
1540
  const DialogInfoIcon = 'DialogInfoIcon';
1523
1541
  const MaskIconInfo = 'MaskIconInfo';
1524
1542
 
1525
- const HandleClickClose = 'handleClickClose';
1526
- const HandleClickCopy = 'handleClickCopy';
1527
- const HandleClickOk = 'handleClickOk';
1528
- const HandleClickButton = 'handleClickButton';
1529
- const HandleContextMenu = 'handleContextMenu';
1530
- const HandleFocusIn = 'handleFocusIn';
1543
+ const HandleClickClose = 1;
1544
+ const HandleClickButton = 4;
1545
+ const HandleContextMenu = 5;
1546
+ const HandleFocusIn = 6;
1531
1547
 
1532
1548
  const Button$1 = 1;
1533
1549
  const Div = 4;
@@ -1570,7 +1586,7 @@ const True = 'true';
1570
1586
  const Button = 'button';
1571
1587
  const Dialog = 'dialog';
1572
1588
 
1573
- const getPrimaryButtonVirtualDom = (message, onClick, name) => {
1589
+ const getPrimaryButtonVirtualDom = (message, name) => {
1574
1590
  return [{
1575
1591
  type: Button$1,
1576
1592
  className: mergeClassNames(Button$2, ButtonPrimary),
@@ -1580,7 +1596,7 @@ const getPrimaryButtonVirtualDom = (message, onClick, name) => {
1580
1596
  }, text(message)];
1581
1597
  };
1582
1598
 
1583
- const getSecondaryButtonVirtualDom = (message, onClick, name) => {
1599
+ const getSecondaryButtonVirtualDom = (message, name) => {
1584
1600
  return [{
1585
1601
  type: Button$1,
1586
1602
  className: mergeClassNames(Button$2, ButtonSecondary),
@@ -1647,7 +1663,7 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
1647
1663
  type: Div,
1648
1664
  className: DialogButtonsRow,
1649
1665
  childCount: 2
1650
- }, ...getSecondaryButtonVirtualDom(okMessage, HandleClickOk, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, HandleClickCopy, Copy$1)];
1666
+ }, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
1651
1667
  return dom;
1652
1668
  };
1653
1669
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"