@lvce-editor/shared-process 0.51.4 → 0.52.1

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.51.4",
3
+ "version": "0.52.1",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,26 +18,27 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "1.3.0",
21
- "@lvce-editor/extension-host-helper-process": "0.51.4",
22
- "@lvce-editor/ipc": "13.8.0",
21
+ "@lvce-editor/extension-host-helper-process": "0.52.1",
22
+ "@lvce-editor/ipc": "14.1.0",
23
23
  "@lvce-editor/json-rpc": "5.4.0",
24
24
  "@lvce-editor/jsonc-parser": "1.5.0",
25
25
  "@lvce-editor/pretty-error": "2.0.0",
26
+ "@lvce-editor/rpc-registry": "2.11.0",
26
27
  "@lvce-editor/verror": "1.6.0",
27
28
  "debug": "^4.4.0",
28
29
  "is-object": "^1.0.2",
29
30
  "xdg-basedir": "^5.1.0"
30
31
  },
31
32
  "optionalDependencies": {
32
- "@lvce-editor/embeds-process": "2.0.0",
33
- "@lvce-editor/file-watcher-process": "3.0.0",
33
+ "@lvce-editor/embeds-process": "3.1.0",
34
+ "@lvce-editor/file-system-process": "2.0.0",
35
+ "@lvce-editor/file-watcher-process": "3.1.0",
34
36
  "@lvce-editor/network-process": "4.0.0",
35
37
  "@lvce-editor/preload": "1.5.0",
36
- "@lvce-editor/preview-process": "10.0.0",
38
+ "@lvce-editor/preview-process": "11.0.0",
37
39
  "@lvce-editor/pty-host": "4.0.0",
38
- "@lvce-editor/search-process": "7.0.0",
40
+ "@lvce-editor/search-process": "8.1.0",
39
41
  "@lvce-editor/typescript-compile-process": "3.0.0",
40
- "@lvce-editor/file-system-process": "1.2.0",
41
42
  "open": "^10.1.2",
42
43
  "tail": "^2.2.6",
43
44
  "tmp-promise": "^3.0.3",
@@ -2,6 +2,6 @@ import { join } from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  export const getBuiltinExtensionsPath = () => {
4
4
  const staticServerPath = fileURLToPath(import.meta.resolve('@lvce-editor/static-server'));
5
- const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', 'edd3a0e', 'extensions');
5
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', 'ad88831', 'extensions');
6
6
  return builtinExtensionsPath;
7
7
  };
@@ -0,0 +1,6 @@
1
+ import * as ParentIpc from '../ParentIpc/ParentIpc.js';
2
+ export const createUtilityProcessRpc = async (options) => {
3
+ await ParentIpc.invoke('CreateUtilityProcessRpc.createUtilityProcessRpc', {
4
+ ...options,
5
+ });
6
+ };
@@ -10,3 +10,5 @@ export const Unknown = 0;
10
10
  export const ProcessExplorerRenderer = 33;
11
11
  export const ExtensionHostWorker = 218;
12
12
  export const FileSystemProcess = 219;
13
+ export const FileWatcherProcess = 220;
14
+ export const TypescriptCompileProcess = 221;
@@ -1,19 +1,19 @@
1
+ import * as CreateUtilityProcessRpc from '../CreateUtilityProcessRpc/CreateUtilityProcessRpc.js';
1
2
  import * as FixElectronParameters from '../FixElectronParameters/FixElectronParameters.js';
2
3
  import * as GetPortTuple from '../GetPortTuple/GetPortTuple.js';
3
4
  import * as ParentIpc from '../ParentIpc/ParentIpc.js';
4
5
  import * as TemporaryMessagePort from '../TemporaryMessagePort/TemporaryMessagePort.js';
5
- const ElectronUtilityProcess = 3;
6
6
  export const create = async (options) => {
7
7
  // TODO how to launch process without race condition?
8
8
  // when promise resolves, process might have already exited
9
- await ParentIpc.invoke('IpcParent.create', {
10
- ...options,
11
- method: ElectronUtilityProcess,
12
- noReturn: true,
13
- });
9
+ if (!options.rpcId && !options.targetRpcId) {
10
+ // TODO make targetRpcId required
11
+ options.targetRpcId = Math.random();
12
+ }
13
+ await CreateUtilityProcessRpc.createUtilityProcessRpc(options);
14
14
  const { port1, port2 } = await GetPortTuple.getPortTuple();
15
15
  // TODO use uuid instead of name
16
- await TemporaryMessagePort.sendTo(options.name, port2, options.ipcId);
16
+ await TemporaryMessagePort.sendTo2(port2, options.targetRpcId, options.ipcId);
17
17
  port1.start();
18
18
  return port1;
19
19
  };
@@ -12,6 +12,7 @@ export const launchEmbedsProcess = async () => {
12
12
  stdio: 'inherit',
13
13
  name: 'Embeds Process',
14
14
  ipcId: IpcId.SharedProcess,
15
+ targetRpcId: IpcId.EmbedsProcess,
15
16
  });
16
17
  HandleIpc.handleIpc(ipc);
17
18
  await ConnectIpcToElectron.connectIpcToElectron(ipc, IpcId.EmbedsProcess);
@@ -1,5 +1,6 @@
1
1
  import * as FileSystemProcessPath from '../FileSystemProcessPath/FileSystemProcessPath.js';
2
2
  import * as HandleIpc from '../HandleIpc/HandleIpc.js';
3
+ import * as IpcId from '../IpcId/IpcId.js';
3
4
  import * as IpcParent from '../IpcParent/IpcParent.js';
4
5
  import * as IpcParentType from '../IpcParentType/IpcParentType.js';
5
6
  import * as IsElectron from '../IsElectron/IsElectron.js';
@@ -23,6 +24,8 @@ export const launchFileSystemProcess = async () => {
23
24
  argv: [],
24
25
  stdio: 'inherit',
25
26
  name: 'File System Process',
27
+ ipcId: IpcId.SharedProcess,
28
+ targetRpcId: IpcId.FileSystemProcess,
26
29
  });
27
30
  HandleIpc.handleIpc(fileSystemProcess);
28
31
  return fileSystemProcess;
@@ -3,6 +3,7 @@ import * as HandleIpc from '../HandleIpc/HandleIpc.js';
3
3
  import * as IpcParent from '../IpcParent/IpcParent.js';
4
4
  import * as IpcParentType from '../IpcParentType/IpcParentType.js';
5
5
  import * as IsElectron from '../IsElectron/IsElectron.js';
6
+ import * as IpcId from '../IpcId/IpcId.js';
6
7
  export const launchFileWatcherProcess = async () => {
7
8
  const method = IsElectron.isElectron ? IpcParentType.ElectronUtilityProcess : IpcParentType.NodeForkedProcess;
8
9
  const ipc = await IpcParent.create({
@@ -11,6 +12,8 @@ export const launchFileWatcherProcess = async () => {
11
12
  argv: [],
12
13
  stdio: 'inherit',
13
14
  name: 'File Watcher Process',
15
+ ipcId: IpcId.SharedProcess,
16
+ targetRpcId: IpcId.FileWatcherProcess,
14
17
  });
15
18
  HandleIpc.handleIpc(ipc);
16
19
  return ipc;
@@ -1,25 +1,18 @@
1
+ import * as IpcId from '../IpcId/IpcId.js';
1
2
  import * as IpcParent from '../IpcParent/IpcParent.js';
2
3
  import * as PtyHostPath from '../PtyHostPath/PtyHostPath.js';
3
4
  import * as PtyHostState from '../PtyHostState/PtyHostState.js';
4
5
  export const launchPtyHost = async (method) => {
5
- const ptyHostPath = await PtyHostPath.ptyHostPath;
6
+ const ptyHostPath = PtyHostPath.ptyHostPath;
6
7
  const ptyHost = await IpcParent.create({
7
8
  method,
8
9
  path: ptyHostPath,
9
10
  argv: [],
10
11
  stdio: 'inherit',
11
12
  name: 'Terminal Process',
13
+ ipcId: IpcId.SharedProcess,
14
+ targetRpcId: IpcId.TerminalProcess,
12
15
  });
13
- // HandleIpc.handleIpc(ptyHost)
14
- // TODO
15
- // const handleClose = () => {
16
- // // @ts-ignore
17
- // ptyHost._rawIpc.off('close', handleClose)
18
- // PtyHostState.state.ipc = undefined
19
- // PtyHostState.state.ptyHostPromise = undefined
20
- // }
21
- // // @ts-ignore
22
- // ptyHost._rawIpc.on('close', handleClose)
23
16
  PtyHostState.state.ipc = ptyHost;
24
17
  return ptyHost;
25
18
  };
@@ -3,6 +3,7 @@ import * as IpcParent from '../IpcParent/IpcParent.js';
3
3
  import * as IpcParentType from '../IpcParentType/IpcParentType.js';
4
4
  import * as IsElectron from '../IsElectron/IsElectron.js';
5
5
  import * as GetTypeScriptPath from '../GetTypeScriptPath/GetTypeScriptPath.js';
6
+ import * as IpcId from '../IpcId/IpcId.js';
6
7
  import * as JsonRpc from '../JsonRpc/JsonRpc.js';
7
8
  export const launchTypeScriptCompileProcess = async () => {
8
9
  const method = IsElectron.isElectron ? IpcParentType.ElectronUtilityProcess : IpcParentType.NodeForkedProcess;
@@ -13,6 +14,8 @@ export const launchTypeScriptCompileProcess = async () => {
13
14
  argv: [],
14
15
  stdio: 'inherit',
15
16
  name: 'TypeScript Compile Process',
17
+ ipcId: IpcId.SharedProcess,
18
+ targetRpcId: IpcId.TypescriptCompileProcess,
16
19
  });
17
20
  HandleIpc.handleIpc(typescriptCompileProcess);
18
21
  const typeScriptPath = GetTypeScriptPath.getTypeScriptUri();
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.51.4';
45
- export const commit = 'edd3a0e';
46
- export const date = '2025-05-04T22:04:40.000Z';
44
+ export const version = '0.52.1';
45
+ export const commit = 'ad88831';
46
+ export const date = '2025-05-10T22:38:42.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };
@@ -1,3 +1,4 @@
1
+ import { VError } from '@lvce-editor/verror';
1
2
  import * as Assert from '../Assert/Assert.js';
2
3
  import * as Id from '../Id/Id.js';
3
4
  import * as ParentIpc from '../ParentIpc/ParentIpc.js';
@@ -22,6 +23,16 @@ export const sendTo = async (name, port, ipcId) => {
22
23
  Assert.object(port);
23
24
  await ParentIpc.invokeAndTransfer('TemporaryMessagePort.sendTo', port, name, ipcId);
24
25
  };
26
+ export const sendTo2 = async (port, targetRpcId, sourceIpcId) => {
27
+ try {
28
+ Assert.object(port);
29
+ Assert.number(targetRpcId);
30
+ await ParentIpc.invokeAndTransfer('TemporaryMessagePort.sendTo2', port, targetRpcId, sourceIpcId);
31
+ }
32
+ catch (error) {
33
+ throw new VError(error, `Failed to send message port to electron utility process`);
34
+ }
35
+ };
25
36
  export const handlePorts = (port1, port2, id1, id2) => {
26
37
  Assert.number(id1);
27
38
  Assert.number(id2);