@lvce-editor/shared-process 0.21.8 → 0.21.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/shared-process",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.10",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -17,21 +17,19 @@
|
|
|
17
17
|
"node": ">=18"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@babel/code-frame": "^7.23.5",
|
|
21
20
|
"@lvce-editor/assert": "^1.0.1",
|
|
22
|
-
"@lvce-editor/extension-host": "0.21.
|
|
23
|
-
"@lvce-editor/extension-host-helper-process": "0.21.
|
|
24
|
-
"@lvce-editor/json-rpc": "^0.
|
|
21
|
+
"@lvce-editor/extension-host": "0.21.10",
|
|
22
|
+
"@lvce-editor/extension-host-helper-process": "0.21.10",
|
|
23
|
+
"@lvce-editor/json-rpc": "^1.0.0",
|
|
25
24
|
"@lvce-editor/jsonc-parser": "^1.1.0",
|
|
26
25
|
"@lvce-editor/pretty-error": "^1.3.0",
|
|
27
|
-
"@lvce-editor/pty-host": "0.21.
|
|
26
|
+
"@lvce-editor/pty-host": "0.21.10",
|
|
28
27
|
"@lvce-editor/verror": "^1.1.2",
|
|
29
28
|
"debug": "^4.3.4",
|
|
30
29
|
"execa": "^8.0.1",
|
|
31
30
|
"exit-hook": "^4.0.0",
|
|
32
31
|
"got": "^13.0.0",
|
|
33
32
|
"is-object": "^1.0.2",
|
|
34
|
-
"lines-and-columns": "^2.0.4",
|
|
35
33
|
"p-queue": "^8.0.1",
|
|
36
34
|
"parse-json": "^8.1.0",
|
|
37
35
|
"tar-fs": "^3.0.4",
|
|
@@ -39,10 +37,9 @@
|
|
|
39
37
|
"xdg-basedir": "^5.1.0"
|
|
40
38
|
},
|
|
41
39
|
"optionalDependencies": {
|
|
42
|
-
"@lvce-editor/ripgrep": "^1.0.
|
|
40
|
+
"@lvce-editor/ripgrep": "^1.0.2",
|
|
43
41
|
"extract-zip": "^2.0.1",
|
|
44
|
-
"open": "^10.0.
|
|
45
|
-
"symlink-dir": "^5.2.1",
|
|
42
|
+
"open": "^10.0.2",
|
|
46
43
|
"tail": "^2.2.6",
|
|
47
44
|
"tmp-promise": "^3.0.3",
|
|
48
45
|
"trash": "^8.1.1"
|
package/src/parts/Json/Json.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// parsing error handling based on https://github.com/sindresorhus/parse-json/blob/main/index.js
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { VError } from '../VError/VError.js'
|
|
4
4
|
import * as Character from '../Character/Character.js'
|
|
5
|
+
import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
|
|
5
6
|
|
|
6
7
|
export const parse = async (string, filePath) => {
|
|
7
8
|
try {
|
|
8
9
|
return JSON.parse(string)
|
|
9
10
|
} catch (error) {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const betterError = new VError(error, `Failed to parse json at ${filePath}`)
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
betterError.code = ErrorCodes.E_JSON_PARSE
|
|
14
|
+
throw betterError
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -61,11 +61,11 @@ export const getSetupName = () => {
|
|
|
61
61
|
return 'Lvce-Setup'
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export const version = '0.21.
|
|
64
|
+
export const version = '0.21.10'
|
|
65
65
|
|
|
66
|
-
export const commit = '
|
|
66
|
+
export const commit = '09a5bdd'
|
|
67
67
|
|
|
68
|
-
export const date = '2023-12-
|
|
68
|
+
export const date = '2023-12-31T11:01:11.000Z'
|
|
69
69
|
|
|
70
70
|
export const getVersion = () => {
|
|
71
71
|
return version
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { codeFrameColumns } from '@babel/code-frame'
|
|
2
|
-
import { LinesAndColumns } from 'lines-and-columns'
|
|
3
|
-
|
|
4
|
-
// parsing error handling based on https://github.com/sindresorhus/parse-json/blob/main/index.js
|
|
5
|
-
|
|
6
|
-
const emptyError = {
|
|
7
|
-
message: '',
|
|
8
|
-
stack: '',
|
|
9
|
-
codeFrame: '',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const RE_POSITION = /in JSON at position (\d+)/
|
|
13
|
-
|
|
14
|
-
export const getErrorPropsFromError = (error, string, filePath) => {
|
|
15
|
-
const indexMatch = error.message.match(RE_POSITION)
|
|
16
|
-
if (indexMatch && indexMatch.length > 0) {
|
|
17
|
-
const lines = new LinesAndColumns(string)
|
|
18
|
-
const index = Number(indexMatch[1])
|
|
19
|
-
const location = lines.locationForIndex(index)
|
|
20
|
-
if (location) {
|
|
21
|
-
const line = location.line + 1
|
|
22
|
-
const column = location.column + 1
|
|
23
|
-
const codeFrame = codeFrameColumns(string, { start: { line, column } }, { highlightCode: false })
|
|
24
|
-
return {
|
|
25
|
-
codeFrame,
|
|
26
|
-
message: 'Json Parsing Error',
|
|
27
|
-
stack: ` at ${filePath}:${line}:${column}`,
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (string.length === 0) {
|
|
32
|
-
return {
|
|
33
|
-
codeFrame: ``,
|
|
34
|
-
message: 'Json Parsing Error: Cannot parse empty string',
|
|
35
|
-
stack: ` at ${filePath}`,
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (error.message === 'Unexpected end of JSON input') {
|
|
40
|
-
const lines = new LinesAndColumns(string)
|
|
41
|
-
const index = string.length - 1
|
|
42
|
-
const location = lines.locationForIndex(index)
|
|
43
|
-
if (location) {
|
|
44
|
-
const codeFrame = codeFrameColumns(string, { start: { line: location.line + 1, column: location.column + 1 } }, { highlightCode: false })
|
|
45
|
-
return {
|
|
46
|
-
codeFrame,
|
|
47
|
-
message: 'Json Parsing Error',
|
|
48
|
-
stack: ` at ${filePath}`,
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
codeFrame: ``,
|
|
54
|
-
message: 'Json Parsing Error',
|
|
55
|
-
stack: ` at ${filePath}`,
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export const getErrorProps = (string, filePath) => {
|
|
60
|
-
try {
|
|
61
|
-
JSON.parse(string)
|
|
62
|
-
return emptyError
|
|
63
|
-
} catch (error) {
|
|
64
|
-
return getErrorPropsFromError(error, string, filePath)
|
|
65
|
-
}
|
|
66
|
-
}
|