@lvce-editor/extension-host-worker 5.8.0 → 5.9.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.
@@ -834,6 +834,14 @@ const pause = async protocol => {
834
834
  throw new VError(error, 'Failed to execute debug provider');
835
835
  }
836
836
  };
837
+ const getScriptSource = async (protocol, scriptId) => {
838
+ try {
839
+ const provider = getDebugProvider(protocol);
840
+ return await provider.getScriptSource(scriptId);
841
+ } catch (error) {
842
+ throw new VError(error, 'Failed to execute debug provider');
843
+ }
844
+ };
837
845
  const stepInto = async protocol => {
838
846
  try {
839
847
  const provider = getDebugProvider(protocol);
@@ -1730,6 +1738,16 @@ const constructError = (message, type, name) => {
1730
1738
  }
1731
1739
  return new ErrorConstructor(message);
1732
1740
  };
1741
+ const joinLines = lines => {
1742
+ return lines.join(NewLine$1);
1743
+ };
1744
+ const splitLines$1 = lines => {
1745
+ return lines.split(NewLine$1);
1746
+ };
1747
+ const getCurrentStack = () => {
1748
+ const currentStack = joinLines(splitLines$1(new Error().stack || '').slice(2));
1749
+ return currentStack;
1750
+ };
1733
1751
  const getNewLineIndex = (string, startIndex = undefined) => {
1734
1752
  return string.indexOf(NewLine$1, startIndex);
1735
1753
  };
@@ -1740,19 +1758,16 @@ const getParentStack = error => {
1740
1758
  }
1741
1759
  return parentStack;
1742
1760
  };
1743
- const joinLines = lines => {
1744
- return lines.join(NewLine$1);
1745
- };
1746
1761
  const MethodNotFound = -32601;
1747
1762
  const Custom = -32001;
1748
- const splitLines$1 = lines => {
1749
- return lines.split(NewLine$1);
1750
- };
1751
1763
  const restoreJsonRpcError = error => {
1764
+ const currentStack = getCurrentStack();
1752
1765
  if (error && error instanceof Error) {
1766
+ if (typeof error.stack === 'string') {
1767
+ error.stack = error.stack + NewLine$1 + currentStack;
1768
+ }
1753
1769
  return error;
1754
1770
  }
1755
- const currentStack = joinLines(splitLines$1(new Error().stack || '').slice(1));
1756
1771
  if (error && error.code && error.code === MethodNotFound) {
1757
1772
  const restoredError = new JsonRpcError(error.message);
1758
1773
  const parentStack = getParentStack(error);
@@ -5587,6 +5602,7 @@ const commandMap = {
5587
5602
  'ExecuteExternalCommand.executeExternalCommand': executeExternalCommand,
5588
5603
  'ExtensionHostDebug.evaluate': evaluate,
5589
5604
  'ExtensionHostDebug.getProperties': getProperties,
5605
+ 'ExtensionHostDebug.getScriptSource': getScriptSource,
5590
5606
  'ExtensionHostDebug.listProcesses': listProcesses,
5591
5607
  'ExtensionHostDebug.pause': pause,
5592
5608
  'ExtensionHostDebug.resume': resume,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "5.8.0",
3
+ "version": "5.9.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"