@lvce-editor/extension-host-worker 1.10.0 → 1.11.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.
@@ -36,7 +36,7 @@ let AssertionError$1 = class AssertionError extends Error {
36
36
  this.name = 'AssertionError';
37
37
  }
38
38
  };
39
- const getType$3 = value => {
39
+ const getType$2 = value => {
40
40
  switch (typeof value) {
41
41
  case 'number':
42
42
  return 'number';
@@ -59,31 +59,31 @@ const getType$3 = value => {
59
59
  }
60
60
  };
61
61
  const object = value => {
62
- const type = getType$3(value);
62
+ const type = getType$2(value);
63
63
  if (type !== 'object') {
64
64
  throw new AssertionError$1('expected value to be of type object');
65
65
  }
66
66
  };
67
67
  const number$1 = value => {
68
- const type = getType$3(value);
68
+ const type = getType$2(value);
69
69
  if (type !== 'number') {
70
70
  throw new AssertionError$1('expected value to be of type number');
71
71
  }
72
72
  };
73
73
  const array = value => {
74
- const type = getType$3(value);
74
+ const type = getType$2(value);
75
75
  if (type !== 'array') {
76
76
  throw new AssertionError$1('expected value to be of type array');
77
77
  }
78
78
  };
79
79
  const string = value => {
80
- const type = getType$3(value);
80
+ const type = getType$2(value);
81
81
  if (type !== 'string') {
82
82
  throw new AssertionError$1('expected value to be of type string');
83
83
  }
84
84
  };
85
85
  const fn = value => {
86
- const type = getType$3(value);
86
+ const type = getType$2(value);
87
87
  if (type !== 'function') {
88
88
  throw new AssertionError$1('expected value to be of type function');
89
89
  }
@@ -386,7 +386,7 @@ let VError$1 = class VError extends Error {
386
386
  }
387
387
  };
388
388
 
389
- const getType$2 = value => {
389
+ const getType$1 = value => {
390
390
  switch (typeof value) {
391
391
  case 'number':
392
392
  return 'number';
@@ -417,7 +417,7 @@ const validateResultObject = (result, resultShape) => {
417
417
  for (const [key, value] of Object.entries(resultShape.properties)) {
418
418
  // @ts-ignore
419
419
  const expectedType = value.type;
420
- const actualType = getType$2(result[key]);
420
+ const actualType = getType$1(result[key]);
421
421
  if (expectedType !== actualType) {
422
422
  return `item.${key} must be of type ${expectedType}`;
423
423
  }
@@ -426,7 +426,7 @@ const validateResultObject = (result, resultShape) => {
426
426
  };
427
427
  const validateResultArray = (result, resultShape) => {
428
428
  for (const item of result) {
429
- const actualType = getType$2(item);
429
+ const actualType = getType$1(item);
430
430
  const expectedType = resultShape.items.type;
431
431
  if (actualType !== expectedType) {
432
432
  return `expected result to be of type ${expectedType} but was of type ${actualType}`;
@@ -447,7 +447,7 @@ const getPreviewString = item => {
447
447
  return `"${item}"`;
448
448
  };
449
449
  const getPreview = item => {
450
- const type = getType$2(item);
450
+ const type = getType$1(item);
451
451
  switch (type) {
452
452
  case 'object':
453
453
  return getPreviewObject();
@@ -460,7 +460,7 @@ const getPreview = item => {
460
460
  }
461
461
  };
462
462
  const validate = (item, schema) => {
463
- const actualType = getType$2(item);
463
+ const actualType = getType$1(item);
464
464
  const expectedType = schema.type;
465
465
  if (actualType !== expectedType) {
466
466
  if (schema.allowUndefined && (item === undefined || item === null)) {
@@ -772,7 +772,7 @@ class AssertionError extends Error {
772
772
  this.name = 'AssertionError';
773
773
  }
774
774
  }
775
- const getType$1 = value => {
775
+ const getType = value => {
776
776
  switch (typeof value) {
777
777
  case 'number':
778
778
  return 'number';
@@ -795,7 +795,7 @@ const getType$1 = value => {
795
795
  }
796
796
  };
797
797
  const number = value => {
798
- const type = getType$1(value);
798
+ const type = getType(value);
799
799
  if (type !== 'number') {
800
800
  throw new AssertionError('expected value to be of type number');
801
801
  }
@@ -821,25 +821,12 @@ const create$3$1 = () => {
821
821
  const warn = (...args) => {
822
822
  console.warn(...args);
823
823
  };
824
- const withResolvers$2 = () => {
825
- /**
826
- * @type {any}
827
- */
828
- let _resolve;
829
- const promise = new Promise(resolve => {
830
- _resolve = resolve;
831
- });
832
- return {
833
- resolve: _resolve,
834
- promise
835
- };
836
- };
837
824
  const registerPromise = () => {
838
825
  const id = create$3$1();
839
826
  const {
840
827
  resolve,
841
828
  promise
842
- } = withResolvers$2();
829
+ } = Promise.withResolvers();
843
830
  set$4(id, resolve);
844
831
  return {
845
832
  id,
@@ -1005,7 +992,7 @@ const unwrapJsonRpcResult = responseMessage => {
1005
992
  throw new JsonRpcError('unexpected response message');
1006
993
  };
1007
994
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
1008
- const getType = prettyError => {
995
+ const getErrorType = prettyError => {
1009
996
  if (prettyError && prettyError.type) {
1010
997
  return prettyError.type;
1011
998
  }
@@ -1028,7 +1015,7 @@ const getErrorProperty = (error, prettyError) => {
1028
1015
  data: {
1029
1016
  stack: prettyError.stack,
1030
1017
  codeFrame: prettyError.codeFrame,
1031
- type: getType(prettyError),
1018
+ type: getErrorType(prettyError),
1032
1019
  code: prettyError.code,
1033
1020
  name: prettyError.name
1034
1021
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "main": "dist/extensionHostWorkerMain.js",
6
6
  "type": "module",