@lvce-editor/shared-process 0.19.1 → 0.19.2

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.19.1",
3
+ "version": "0.19.2",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/code-frame": "^7.22.13",
21
- "@lvce-editor/extension-host": "0.19.1",
22
- "@lvce-editor/extension-host-helper-process": "0.19.1",
21
+ "@lvce-editor/extension-host": "0.19.2",
22
+ "@lvce-editor/extension-host-helper-process": "0.19.2",
23
23
  "@lvce-editor/jsonc-parser": "^1.1.0",
24
24
  "@lvce-editor/pretty-error": "^1.2.1",
25
- "@lvce-editor/pty-host": "0.19.1",
25
+ "@lvce-editor/pty-host": "0.19.2",
26
26
  "@lvce-editor/verror": "^1.1.1",
27
27
  "debug": "^4.3.4",
28
28
  "execa": "^8.0.1",
@@ -31,7 +31,7 @@
31
31
  "is-object": "^1.0.2",
32
32
  "lines-and-columns": "^2.0.3",
33
33
  "p-queue": "^7.4.1",
34
- "parse-json": "^7.1.0",
34
+ "parse-json": "^7.1.1",
35
35
  "tar-fs": "^3.0.4",
36
36
  "ws": "^8.14.2",
37
37
  "xdg-basedir": "^5.1.0"
@@ -0,0 +1,8 @@
1
+ import * as FileSystem from '../FileSystem/FileSystem.js'
2
+ import * as BulkReplacementContent from '../BulkReplacementContent/BulkReplacementContent.js'
3
+
4
+ export const applyEdit = async (path, ranges, replacement) => {
5
+ const content = await FileSystem.readFile(path)
6
+ const newContent = BulkReplacementContent.getNewContent(content, ranges, replacement)
7
+ await FileSystem.writeFile(path, newContent)
8
+ }
@@ -1,20 +1,18 @@
1
- import * as FileSystem from '../FileSystem/FileSystem.js'
2
- import * as BulkReplacementContent from '../BulkReplacementContent/BulkReplacementContent.js'
3
-
4
- const applyEdit = async (path, ranges, replacement) => {
5
- const content = await FileSystem.readFile(path)
6
- const newContent = BulkReplacementContent.getNewContent(content, ranges, replacement)
7
- await FileSystem.writeFile(path, newContent)
8
- }
1
+ import * as ApplyEdit from '../ApplyEdit/ApplyEdit.js'
2
+ import { VError } from '../VError/VError.js'
9
3
 
10
4
  export const applyBulkReplacement = async (files, ranges, replacement) => {
11
- let rangeIndex = 0
12
- for (const file of files) {
13
- const rangeLength = ranges[rangeIndex]
14
- const rangeStartIndex = rangeIndex + 1
15
- const rangeEndIndex = rangeStartIndex + rangeLength
16
- const fileRanges = ranges.slice(rangeStartIndex, rangeEndIndex)
17
- await applyEdit(file, fileRanges, replacement)
18
- rangeIndex = rangeEndIndex
5
+ try {
6
+ let rangeIndex = 0
7
+ for (const file of files) {
8
+ const rangeLength = ranges[rangeIndex]
9
+ const rangeStartIndex = rangeIndex + 1
10
+ const rangeEndIndex = rangeStartIndex + rangeLength
11
+ const fileRanges = ranges.slice(rangeStartIndex, rangeEndIndex)
12
+ await ApplyEdit.applyEdit(file, fileRanges, replacement)
13
+ rangeIndex = rangeEndIndex
14
+ }
15
+ } catch (error) {
16
+ throw new VError(error, `Bulk replacement failed`)
19
17
  }
20
18
  }
@@ -19,7 +19,10 @@ const getErrorProperty = (error, prettyError) => {
19
19
  code: JsonRpcErrorCode.Custom,
20
20
  message: `${error}`,
21
21
  data: {
22
- code: error.code,
22
+ stack: prettyError.stack,
23
+ codeFrame: prettyError.codeFrame,
24
+ type: prettyError.type,
25
+ code: prettyError.code,
23
26
  },
24
27
  }
25
28
  }
@@ -51,11 +51,11 @@ export const getSetupName = () => {
51
51
  return 'Lvce-Setup'
52
52
  }
53
53
 
54
- export const version = '0.19.1'
54
+ export const version = '0.19.2'
55
55
 
56
- export const commit = '9ce1299'
56
+ export const commit = 'c2cba50'
57
57
 
58
- export const date = '2023-10-28T07:23:34.000Z'
58
+ export const date = '2023-10-29T19:31:17.000Z'
59
59
 
60
60
  export const getVersion = () => {
61
61
  return version