@lvce-editor/extension-host-worker 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.
@@ -30,6 +30,21 @@ const getJson$1 = async url => {
30
30
  throw new DepecratedError(`vscode.getJson is deprecated, use createNodeRpc instead`);
31
31
  };
32
32
 
33
+ class NonError extends Error {
34
+ name = 'NonError';
35
+ constructor(message) {
36
+ super(message);
37
+ }
38
+ }
39
+
40
+ // ensureError based on https://github.com/sindresorhus/ensure-error/blob/main/index.ts (License MIT)
41
+ const ensureError = input => {
42
+ if (!(input instanceof Error)) {
43
+ return new NonError(input);
44
+ }
45
+ return input;
46
+ };
47
+
33
48
  class AssertionError extends Error {
34
49
  constructor(message) {
35
50
  super(message);
@@ -510,20 +525,6 @@ const improveValidationError = (name, validationError) => {
510
525
  const post = improveValidationErrorPostMessage(validationError, camelCaseName);
511
526
  return pre + ': ' + post;
512
527
  };
513
- class NonError extends Error {
514
- name = 'NonError';
515
- constructor(message) {
516
- super(message);
517
- }
518
- }
519
-
520
- // ensureError based on https://github.com/sindresorhus/ensure-error/blob/main/index.ts (License MIT)
521
- const ensureError = input => {
522
- if (!(input instanceof Error)) {
523
- return new NonError(input);
524
- }
525
- return input;
526
- };
527
528
  const registerMethod = ({
528
529
  context,
529
530
  providers,
@@ -550,7 +551,6 @@ const registerMethod = ({
550
551
  const error = validate(result, resultShape);
551
552
  if (error) {
552
553
  const improvedError = improveValidationError(name, error);
553
- // @ts-ignore
554
554
  throw new VError(improvedError);
555
555
  }
556
556
  return result;
@@ -560,11 +560,9 @@ const registerMethod = ({
560
560
  if (actualError && actualError.message) {
561
561
  if (actualError.message === 'provider[methodName] is not a function') {
562
562
  const camelCaseName = toCamelCase(name);
563
- // @ts-ignore
564
563
  throw new VError(`Failed to execute ${spacedOutName} provider: VError: ${camelCaseName}Provider.${methodName} is not a function`);
565
564
  }
566
- const message = actualError.name === 'Error' ? actualError.message : `${actualError.name}: ${actualError.message}`;
567
- actualError.message = `Failed to execute ${spacedOutName} provider: ${message}`;
565
+ throw new VError(actualError, `Failed to execute ${spacedOutName} provider`);
568
566
  }
569
567
  throw actualError;
570
568
  }
@@ -756,7 +754,7 @@ const setConfigurations = preferences => {
756
754
  };
757
755
 
758
756
  const rpcs$2 = Object.create(null);
759
- const set$5$1 = (id, rpc) => {
757
+ const set$a = (id, rpc) => {
760
758
  rpcs$2[id] = rpc;
761
759
  };
762
760
  const get$a = id => {
@@ -1835,6 +1833,17 @@ const getErrorType = prettyError => {
1835
1833
  }
1836
1834
  return undefined;
1837
1835
  };
1836
+ const isAlreadyStack = line => {
1837
+ return line.trim().startsWith('at ');
1838
+ };
1839
+ const getStack = prettyError => {
1840
+ const stackString = prettyError.stack || '';
1841
+ const newLineIndex = stackString.indexOf('\n');
1842
+ if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
1843
+ return stackString.slice(newLineIndex + 1);
1844
+ }
1845
+ return stackString;
1846
+ };
1838
1847
  const getErrorProperty = (error, prettyError) => {
1839
1848
  if (error && error.code === E_COMMAND_NOT_FOUND) {
1840
1849
  return {
@@ -1847,7 +1856,7 @@ const getErrorProperty = (error, prettyError) => {
1847
1856
  code: Custom,
1848
1857
  message: prettyError.message,
1849
1858
  data: {
1850
- stack: prettyError.stack,
1859
+ stack: getStack(prettyError),
1851
1860
  codeFrame: prettyError.codeFrame,
1852
1861
  type: getErrorType(prettyError),
1853
1862
  code: prettyError.code,
@@ -5002,7 +5011,7 @@ const handleMessagePort2 = async (port, rpcId) => {
5002
5011
  commandMap: {}
5003
5012
  });
5004
5013
  if (rpcId) {
5005
- set$5$1(rpcId, rpc);
5014
+ set$a(rpcId, rpc);
5006
5015
  }
5007
5016
  };
5008
5017
 
@@ -5012,7 +5021,7 @@ const handleMessagePort = async (port, rpcId) => {
5012
5021
  commandMap: {}
5013
5022
  });
5014
5023
  if (rpcId) {
5015
- set$5$1(rpcId, rpc);
5024
+ set$a(rpcId, rpc);
5016
5025
  }
5017
5026
  };
5018
5027
 
@@ -5688,7 +5697,7 @@ const listen = async () => {
5688
5697
  const rpc = await WebWorkerRpcClient.create({
5689
5698
  commandMap: commandMap
5690
5699
  });
5691
- set$5$1(RendererWorker, rpc);
5700
+ set$a(RendererWorker, rpc);
5692
5701
  };
5693
5702
 
5694
5703
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "5.6.0",
3
+ "version": "5.8.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"