@lvce-editor/extension-host-helper-process 0.17.8 → 0.17.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/extension-host-helper-process",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/code-frame": "^7.22.10",
|
|
20
|
+
"@lvce-editor/verror": "^1.0.1",
|
|
20
21
|
"clean-stack": "^5.0.1",
|
|
21
|
-
"execa": "^8.0.
|
|
22
|
+
"execa": "^8.0.1",
|
|
22
23
|
"got": "^13.0.0",
|
|
23
24
|
"lines-and-columns": "^2.0.3",
|
|
24
25
|
"minimist": "^1.2.8",
|
|
25
|
-
"verror": "^1.10.1",
|
|
26
26
|
"ws": "^8.13.0"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as NormalizeErrorLine from '../NormalizeErrorLine/NormalizeErrorLine.js'
|
|
3
|
-
|
|
4
|
-
const getCombinedMessage = (error, message) => {
|
|
5
|
-
const stringifiedError = NormalizeErrorLine.normalizeLine(`${error}`)
|
|
6
|
-
if (message) {
|
|
7
|
-
return `${message}: ${stringifiedError}`
|
|
8
|
-
}
|
|
9
|
-
return stringifiedError
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class VError extends Error {
|
|
13
|
-
constructor(error, message) {
|
|
14
|
-
const combinedMessage = getCombinedMessage(error, message)
|
|
15
|
-
super(combinedMessage)
|
|
16
|
-
this.name = 'VError'
|
|
17
|
-
if (error instanceof Error) {
|
|
18
|
-
this.stack = MergeStacks.mergeStacks(this.stack, error.stack)
|
|
19
|
-
}
|
|
20
|
-
if (error.codeFrame) {
|
|
21
|
-
this.codeFrame = error.codeFrame
|
|
22
|
-
}
|
|
23
|
-
if (error.code) {
|
|
24
|
-
this.code = error.code
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
export * from '@lvce-editor/verror'
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as GetNewLineIndex from '../GetNewLineIndex/GetNewLineIndex.js'
|
|
2
|
-
import * as NormalizeErrorLine from '../NormalizeErrorLine/NormalizeErrorLine.js'
|
|
3
|
-
|
|
4
|
-
export const mergeStacks = (parent, child) => {
|
|
5
|
-
if (!child) {
|
|
6
|
-
return parent
|
|
7
|
-
}
|
|
8
|
-
const parentNewLineIndex = GetNewLineIndex.getNewLineIndex(parent)
|
|
9
|
-
const childNewLineIndex = GetNewLineIndex.getNewLineIndex(child)
|
|
10
|
-
if (childNewLineIndex === -1) {
|
|
11
|
-
return parent
|
|
12
|
-
}
|
|
13
|
-
const parentFirstLine = parent.slice(0, parentNewLineIndex)
|
|
14
|
-
const childRest = child.slice(childNewLineIndex)
|
|
15
|
-
const childFirstLine = NormalizeErrorLine.normalizeLine(child.slice(0, childNewLineIndex))
|
|
16
|
-
if (parentFirstLine.includes(childFirstLine)) {
|
|
17
|
-
return parentFirstLine + childRest
|
|
18
|
-
}
|
|
19
|
-
return child
|
|
20
|
-
}
|