@lvce-editor/shared-process 0.15.23 → 0.15.25

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.15.23",
3
+ "version": "0.15.25",
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.21.4",
20
- "@lvce-editor/extension-host": "0.15.23",
21
- "@lvce-editor/extension-host-helper-process": "0.15.23",
22
- "@lvce-editor/pty-host": "0.15.23",
20
+ "@lvce-editor/extension-host": "0.15.25",
21
+ "@lvce-editor/extension-host-helper-process": "0.15.25",
22
+ "@lvce-editor/pty-host": "0.15.25",
23
23
  "debug": "^4.3.4",
24
24
  "execa": "^7.1.1",
25
25
  "exit-hook": "^3.2.0",
@@ -0,0 +1,7 @@
1
+ import * as HandleCliArgs from './HandleCliArgs.js'
2
+
3
+ export const name = 'HandleCliArgs'
4
+
5
+ export const Commands = {
6
+ handleCliArgs: HandleCliArgs.handleCliArgs,
7
+ }
@@ -0,0 +1,12 @@
1
+ import * as Assert from '../Assert/Assert.js'
2
+ import * as Cli from '../Cli/Cli.js'
3
+ import { VError } from '../VError/VError.js'
4
+
5
+ export const handleCliArgs = async (argv) => {
6
+ try {
7
+ Assert.array(argv)
8
+ await Cli.handleCliArgs(argv)
9
+ } catch (error) {
10
+ throw new VError(error, `Failed to execute cli command`)
11
+ }
12
+ }
@@ -1,7 +1,5 @@
1
- import * as ErrorHandling from '../ErrorHandling/ErrorHandling.js'
2
1
  import * as GetErrorResponse from '../GetErrorResponse/GetErrorResponse.js'
3
2
  import * as GetResponse from '../GetResponse/GetResponse.js'
4
- import * as Logger from '../Logger/Logger.js'
5
3
  import { JsonRpcError } from '../JsonRpcError/JsonRpcError.js'
6
4
 
7
5
  export const handleJsonRpcMessage = async (ipc, message, execute, resolve) => {
@@ -68,6 +68,8 @@ export const load = (moduleId) => {
68
68
  return import('../HandleNodeMessagePort/HandleNodeMessagePort.ipc.js')
69
69
  case ModuleId.GetTerminalSpawnOptions:
70
70
  return import('../GetTerminalSpawnOptions/GetTerminalSpawnOptions.ipc.js')
71
+ case ModuleId.HandleCliArgs:
72
+ return import('../HandleCliArgs/HandleCliArgs.ipc.js')
71
73
  default:
72
74
  throw new Error(`module ${moduleId} not found`)
73
75
  }
@@ -31,3 +31,4 @@ export const AttachDebugger = 30
31
31
  export const HandleElectronMessagePort = 31
32
32
  export const HandleNodeMessagePort = 32
33
33
  export const GetTerminalSpawnOptions = 33
34
+ export const HandleCliArgs = 34
@@ -175,6 +175,8 @@ export const getModuleId = (commandId) => {
175
175
  return ModuleId.HandleElectronMessagePort
176
176
  case 'GetTerminalSpawnOptions.getTerminalSpawnOptions':
177
177
  return ModuleId.GetTerminalSpawnOptions
178
+ case 'HandleCliArgs.handleCliArgs':
179
+ return ModuleId.HandleCliArgs
178
180
  default:
179
181
  throw new CommandNotFoundError(commandId)
180
182
  }
@@ -1,5 +1,5 @@
1
1
  import { homedir, tmpdir } from 'node:os'
2
- import { join, resolve, sep } from 'node:path'
2
+ import { isAbsolute, join, resolve, sep } from 'node:path'
3
3
  import { pathToFileURL } from 'node:url'
4
4
  import { xdgCache, xdgConfig, xdgData, xdgState } from 'xdg-basedir'
5
5
  import * as Path from '../Path/Path.js'
@@ -105,7 +105,8 @@ export const setEnvironmentVariables = (variables) => {
105
105
 
106
106
  export const getTestPath = () => {
107
107
  if (env.TEST_PATH) {
108
- const testPath = '/remote' + pathToFileURL(Path.join(process.cwd(), env.TEST_PATH)).toString().slice(7)
108
+ const absolutePath = isAbsolute(env.TEST_PATH) ? env.TEST_PATH : Path.join(process.cwd(), env.TEST_PATH)
109
+ const testPath = '/remote' + pathToFileURL(absolutePath).toString().slice(7)
109
110
  return testPath
110
111
  }
111
112
  return '/packages/extension-host-worker-tests'
@@ -23,17 +23,8 @@ const handleSigTerm = () => {
23
23
  Process.exit(ExitCode.Success)
24
24
  }
25
25
 
26
- const knownCliArgs = ['install', 'list', 'link', 'unlink']
27
-
28
26
  const main = async () => {
29
27
  Command.setLoad(Module.load)
30
- const argv = Process.argv.slice(2)
31
- const argv0 = argv[0]
32
- if (knownCliArgs.includes(argv0)) {
33
- const module = await import('./parts/Cli/Cli.js')
34
- await module.handleCliArgs(argv)
35
- return
36
- }
37
28
  // process.on('beforeExit', handleBeforeExit)
38
29
  process.on('disconnect', handleDisconnect)
39
30
  process.on(Signal.SIGTERM, handleSigTerm)