@lvce-editor/shared-process 0.16.17 → 0.16.18

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.17",
3
+ "version": "0.16.18",
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.17",
21
- "@lvce-editor/extension-host-helper-process": "0.16.17",
22
- "@lvce-editor/pty-host": "0.16.17",
20
+ "@lvce-editor/extension-host": "0.16.18",
21
+ "@lvce-editor/extension-host-helper-process": "0.16.18",
22
+ "@lvce-editor/pty-host": "0.16.18",
23
23
  "debug": "^4.3.4",
24
24
  "execa": "^7.1.1",
25
25
  "exit-hook": "^3.2.0",
@@ -1,6 +1,10 @@
1
+ import * as IsElectron from '../IsElectron/IsElectron.js'
1
2
  import * as Path from '../Path/Path.js'
2
3
  import * as Root from '../Root/Root.js'
3
4
 
4
5
  export const getElectronRebuildPath = () => {
6
+ if (IsElectron.isElectron()) {
7
+ return Path.join(Root.root, 'packages', 'main-process', 'node_modules', '.bin', 'electron-rebuild.cmd')
8
+ }
5
9
  return Path.join(Root.root, 'packages', 'main-process', 'node_modules', '.bin', 'electron-rebuild')
6
10
  }
@@ -5,8 +5,10 @@ export const getFirstNodeChildProcessEvent = async (childProcess) => {
5
5
  let stderr = ''
6
6
  let stdout = ''
7
7
  const cleanup = (value) => {
8
- childProcess.stderr.off('data', handleStdErrData)
9
- childProcess.stdout.off('data', handleStdoutData)
8
+ if (childProcess.stdout && childProcess.stderr) {
9
+ childProcess.stderr.off('data', handleStdErrData)
10
+ childProcess.stdout.off('data', handleStdoutData)
11
+ }
10
12
  childProcess.off('message', handleMessage)
11
13
  childProcess.off('exit', handleExit)
12
14
  childProcess.off('error', handleError)
@@ -27,8 +29,10 @@ export const getFirstNodeChildProcessEvent = async (childProcess) => {
27
29
  const handleError = (event) => {
28
30
  cleanup({ type: FirstNodeWorkerEventType.Error, event, stdout, stderr })
29
31
  }
30
- childProcess.stderr.on('data', handleStdErrData)
31
- childProcess.stdout.on('data', handleStdoutData)
32
+ if (childProcess.stdout && childProcess.stderr) {
33
+ childProcess.stderr.on('data', handleStdErrData)
34
+ childProcess.stdout.on('data', handleStdoutData)
35
+ }
32
36
  childProcess.on('message', handleMessage)
33
37
  childProcess.on('exit', handleExit)
34
38
  childProcess.on('error', handleError)
@@ -0,0 +1,5 @@
1
+ import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
2
+
3
+ export const isDlOpenError = (error) => {
4
+ return error && error instanceof Error && 'code' in error && error.code === ErrorCodes.ERR_DLOPEN_FAILED
5
+ }
@@ -1,12 +1,12 @@
1
+ import * as IsDlOpenError from '../IsDlOpenError/IsDlOpenError.js'
1
2
  import { VError } from '../VError/VError.js'
2
- import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
3
3
 
4
4
  export const loadWindowProcessTree = async () => {
5
5
  try {
6
6
  // @ts-ignore
7
7
  return await import('@vscode/windows-process-tree')
8
8
  } catch (error) {
9
- if (error && error instanceof Error && 'code' in error && error.code === ErrorCodes.ERR_DLOPEN_FAILED) {
9
+ if (IsDlOpenError.isDlOpenError(error)) {
10
10
  throw new VError(
11
11
  `Failed to load windows process tree: The native module "@vscode/windows-process-tree" is not compatible with this node version and must be compiled against a matching electron version using electron-rebuild`
12
12
  )
@@ -169,11 +169,11 @@ export const getSetupName = () => {
169
169
  return 'Lvce-Setup'
170
170
  }
171
171
 
172
- export const version = '0.16.17'
172
+ export const version = '0.16.18'
173
173
 
174
- export const commit = '6f015ba'
174
+ export const commit = 'd5caee6'
175
175
 
176
- export const date = '2023-07-19T21:49:49.000Z'
176
+ export const date = '2023-07-20T14:53:13.000Z'
177
177
 
178
178
  export const getVersion = () => {
179
179
  return version
@@ -1,5 +1,7 @@
1
1
  import { spawn } from 'node:child_process'
2
+ import * as FirstNodeWorkerEventType from '../FirstNodeWorkerEventType/FirstNodeWorkerEventType.js'
2
3
  import * as GetElectronRebuildPath from '../GetElectronRebuildPath/GetElectronRebuildPath.js'
4
+ import * as GetFirstNodeChildProcessEvent from '../GetFirstNodeChildProcessEvent/GetFirstNodeChildProcessEvent.js'
3
5
  import * as IsElectron from '../IsElectron/IsElectron.js'
4
6
  import * as Path from '../Path/Path.js'
5
7
  import * as Root from '../Root/Root.js'
@@ -18,7 +20,10 @@ const rebuildNodePtyElectron = async (cwd) => {
18
20
  cwd,
19
21
  stdio: 'inherit',
20
22
  })
21
- // TODO wait for child process to be finished
23
+ const { type, event } = await GetFirstNodeChildProcessEvent.getFirstNodeChildProcessEvent(childProcess)
24
+ if (type === FirstNodeWorkerEventType.Error) {
25
+ throw new Error(`Failed to rebuild native module: ${event}`)
26
+ }
22
27
  }
23
28
 
24
29
  /**
@@ -29,6 +34,10 @@ const rebuildNodePtyNode = async (cwd) => {
29
34
  cwd,
30
35
  stdio: 'inherit',
31
36
  })
37
+ const { type, event } = await GetFirstNodeChildProcessEvent.getFirstNodeChildProcessEvent(childProcess)
38
+ if (type === FirstNodeWorkerEventType.Error) {
39
+ throw new Error(`Failed to rebuild native module: ${event}`)
40
+ }
32
41
  }
33
42
 
34
43
  const getFn = () => {