@lvce-editor/shared-process 0.16.6 → 0.16.8

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.16.6",
3
+ "version": "0.16.8",
4
4
  "description": "Utility package for @lvce-editor/server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,9 +17,9 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/code-frame": "^7.22.5",
20
- "@lvce-editor/extension-host": "0.16.6",
21
- "@lvce-editor/extension-host-helper-process": "0.16.6",
22
- "@lvce-editor/pty-host": "0.16.6",
20
+ "@lvce-editor/extension-host": "0.16.8",
21
+ "@lvce-editor/extension-host-helper-process": "0.16.8",
22
+ "@lvce-editor/pty-host": "0.16.8",
23
23
  "debug": "^4.3.4",
24
24
  "execa": "^7.1.1",
25
25
  "exit-hook": "^3.2.0",
@@ -50,6 +50,27 @@ const getModuleSyntaxError = (stderr) => {
50
50
  }
51
51
  }
52
52
 
53
+ const isModuleNotFoundError = (stderr) => {
54
+ if (!stderr) {
55
+ return false
56
+ }
57
+ return stderr.includes('ERR_MODULE_NOT_FOUND')
58
+ }
59
+
60
+ const isModuleNotFoundMessage = (line) => {
61
+ return line.includes('ERR_MODULE_NOT_FOUND')
62
+ }
63
+
64
+ const getModuleNotFoundError = (stderr) => {
65
+ const lines = stderr.split('\n')
66
+ const messageIndex = lines.findIndex(isModuleNotFoundMessage)
67
+ const message = lines[messageIndex]
68
+ return {
69
+ message,
70
+ code: ErrorCodes.ERR_MODULE_NOT_FOUND,
71
+ }
72
+ }
73
+
53
74
  export const getHelpfulChildProcessError = (stdout, stderr) => {
54
75
  if (isUnhelpfulNativeModuleError(stderr)) {
55
76
  return getNativeModuleErrorMessage(stderr)
@@ -57,6 +78,9 @@ export const getHelpfulChildProcessError = (stdout, stderr) => {
57
78
  if (isModulesSyntaxError(stderr)) {
58
79
  return getModuleSyntaxError(stderr)
59
80
  }
81
+ if (isModuleNotFoundError(stderr)) {
82
+ return getModuleNotFoundError(stderr)
83
+ }
60
84
  return {
61
85
  message: `child process error: ${stderr}`,
62
86
  code: '',
@@ -153,6 +153,7 @@ export const getModuleId = (commandId) => {
153
153
  case 'Platform.getRecentlyOpenedPath':
154
154
  case 'Platform.getTestPath':
155
155
  case 'Platform.getUserSettingsPath':
156
+ case 'Platform.getUserKeyBindingsPath':
156
157
  case 'Platform.getVersion':
157
158
  case 'Platform.setEnvironmentVariables':
158
159
  return ModuleId.Platform
@@ -24,4 +24,5 @@ export const Commands = {
24
24
  getUserSettingsPath: Platform.getUserSettingsPath,
25
25
  getVersion: Platform.getVersion,
26
26
  setEnvironmentVariables: Platform.setEnvironmentVariables,
27
+ getUserKeyBindingsPath: Platform.getUserKeyBindingsPath,
27
28
  }
@@ -76,6 +76,10 @@ export const getUserSettingsPath = () => {
76
76
  return Path.join(configDir, 'settings.json')
77
77
  }
78
78
 
79
+ export const getUserKeyBindingsPath = () => {
80
+ return Path.join(configDir, 'keybindings.json')
81
+ }
82
+
79
83
  export const getExtensionHostPath = async () => {
80
84
  const { extensionHostPath } = await import(
81
85
  '@lvce-editor/extension-host'
@@ -165,11 +169,11 @@ export const getSetupName = () => {
165
169
  return 'Lvce-Setup'
166
170
  }
167
171
 
168
- export const version = '0.16.6'
172
+ export const version = '0.16.8'
169
173
 
170
- export const commit = '68e8dc4'
174
+ export const commit = '2d00a8b'
171
175
 
172
- export const date = '2023-07-06T15:36:10.000Z'
176
+ export const date = '2023-07-08T13:06:49.000Z'
173
177
 
174
178
  export const getVersion = () => {
175
179
  return version
@@ -1,43 +0,0 @@
1
- // parse ps output based on vscode https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/node/ps.ts (License MIT)
2
-
3
- import * as Exec from '../Exec/Exec.js'
4
- import * as SplitLines from '../SplitLines/SplitLines.js'
5
- import * as ParseInt from '../ParseInt/ParseInt.js'
6
-
7
- const PID_CMD = /^\s*(\d+)\s+(\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(.+)$/
8
-
9
- const parsePsOutputLine = (line) => {
10
- const matches = PID_CMD.exec(line.trim())
11
- if (matches && matches.length === 6) {
12
- return {
13
- pid: ParseInt.parseInt(matches[1]),
14
- ppid: ParseInt.parseInt(matches[2]),
15
- cwd: matches[5],
16
- load: ParseInt.parseInt(matches[3]),
17
- mem: ParseInt.parseInt(matches[4]),
18
- }
19
- }
20
- }
21
- const parsePsOutput = (stdout, rootPid) => {
22
- const lines = SplitLines.splitLines(stdout)
23
- return lines.map(parsePsOutputLine)
24
- }
25
-
26
- const getPsOutput = async (rootPid) => {
27
- const { stdout } = await Exec.exec('ps', ['-g', `${rootPid}`, '-a', '-o', 'pid=,ppid=,pcpu=,pmem=,command='], {
28
- shell: true,
29
- })
30
- return stdout
31
- }
32
-
33
- export const listProcessesWithMemoryUsage = async (rootPid) => {
34
- const stdout = await getPsOutput(rootPid)
35
- const parsed = parsePsOutput(stdout, rootPid)
36
- console.log(parsed)
37
- }
38
-
39
- const main = async () => {
40
- await listProcessesWithMemoryUsage(process.pid)
41
- }
42
-
43
- main()