@lvce-editor/shared-process 0.55.1 → 0.55.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 +4 -4
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/FileSystemProcess/FileSystemProcess.js +1 -0
- package/src/parts/IpcId/IpcId.js +8 -7
- package/src/parts/LaunchFileSystemProcess/LaunchFileSystemProcess.js +7 -0
- package/src/parts/ModuleMap/ModuleMap.js +4 -0
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/TemporaryMessagePort/TemporaryMessagePort.ipc.js +3 -0
- package/src/parts/TemporaryMessagePort/TemporaryMessagePort.js +33 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "1.4.0",
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.55.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.55.2",
|
|
22
22
|
"@lvce-editor/ipc": "14.3.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "6.2.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "1.5.0",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
33
|
"@lvce-editor/embeds-process": "4.1.0",
|
|
34
|
-
"@lvce-editor/file-system-process": "
|
|
34
|
+
"@lvce-editor/file-system-process": "3.0.0",
|
|
35
35
|
"@lvce-editor/file-watcher-process": "3.1.0",
|
|
36
36
|
"@lvce-editor/network-process": "5.2.0",
|
|
37
37
|
"@lvce-editor/preload": "1.5.0",
|
|
38
38
|
"@lvce-editor/preview-process": "11.0.0",
|
|
39
39
|
"@lvce-editor/pty-host": "4.2.0",
|
|
40
40
|
"@lvce-editor/search-process": "9.2.0",
|
|
41
|
-
"@lvce-editor/typescript-compile-process": "3.
|
|
41
|
+
"@lvce-editor/typescript-compile-process": "3.1.0",
|
|
42
42
|
"open": "^10.1.2",
|
|
43
43
|
"tail": "^2.2.6",
|
|
44
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', '
|
|
5
|
+
const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '77beaf6', 'extensions');
|
|
6
6
|
return builtinExtensionsPath;
|
|
7
7
|
};
|
package/src/parts/IpcId/IpcId.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
export const
|
|
1
|
+
import { RpcId } from '@lvce-editor/rpc-registry';
|
|
2
|
+
export const EmbedsProcess = RpcId.EmbedsProcess;
|
|
3
|
+
export const EmbedsWorker = RpcId.EmbedsWorker;
|
|
3
4
|
export const ExtensionHostHelperProcess = 3;
|
|
4
|
-
export const MainProcess =
|
|
5
|
+
export const MainProcess = RpcId.MainProcess;
|
|
5
6
|
export const ProcessExplorer = 11;
|
|
6
|
-
export const SearchProcess =
|
|
7
|
+
export const SearchProcess = RpcId.SearchProcess;
|
|
7
8
|
export const SharedProcess = 1;
|
|
8
9
|
export const TerminalProcess = 7;
|
|
9
10
|
export const Unknown = 0;
|
|
10
11
|
export const ProcessExplorerRenderer = 33;
|
|
11
|
-
export const ExtensionHostWorker =
|
|
12
|
-
export const FileSystemProcess =
|
|
12
|
+
export const ExtensionHostWorker = RpcId.ExtensionHostWorker;
|
|
13
|
+
export const FileSystemProcess = RpcId.FileSystemProcess;
|
|
13
14
|
export const FileWatcherProcess = 220;
|
|
14
15
|
export const TypescriptCompileProcess = 221;
|
|
15
|
-
export const ClipBoardProcess =
|
|
16
|
+
export const ClipBoardProcess = RpcId.ClipBoardProcess;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { set } from '@lvce-editor/rpc-registry';
|
|
1
2
|
import * as FileSystemProcessPath from '../FileSystemProcessPath/FileSystemProcessPath.js';
|
|
2
3
|
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
4
|
import * as IsElectron from '../IsElectron/IsElectron.js';
|
|
5
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
4
6
|
import * as LaunchProcess from '../LaunchProcess/LaunchProcess.js';
|
|
5
7
|
export const launchFileSystemProcess = async () => {
|
|
6
8
|
const ipc = await LaunchProcess.launchProcess({
|
|
@@ -10,5 +12,10 @@ export const launchFileSystemProcess = async () => {
|
|
|
10
12
|
isElectron: IsElectron.isElectron,
|
|
11
13
|
settingName: 'develop.fileSystemProcessPath',
|
|
12
14
|
});
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
set(IpcId.FileSystemProcess, ipc);
|
|
17
|
+
// TODO call initialize function, but file system process should create connection to main process
|
|
18
|
+
// TODO maybe call initialize function as part of rpc setup?
|
|
19
|
+
await JsonRpc.invoke(ipc, 'Initialize.initialize');
|
|
13
20
|
return ipc;
|
|
14
21
|
};
|
|
@@ -267,6 +267,10 @@ export const getModuleId = (commandId) => {
|
|
|
267
267
|
case 'HandleMessagePortForFileSystemProcess.handleMessagePortForFileSystemProcess':
|
|
268
268
|
return ModuleId.HandleMessagePortForFileSystemProcess;
|
|
269
269
|
case 'TemporaryMessagePort.handlePorts':
|
|
270
|
+
case 'TemporaryMessagePort.sendTo2':
|
|
271
|
+
case 'TemporaryMessagePort.getPortTuple2':
|
|
272
|
+
case 'TemporaryMessagePort.getPortTuple3':
|
|
273
|
+
case 'TemporaryMessagePort.sendToElectron':
|
|
270
274
|
return ModuleId.TemporaryMessagePort;
|
|
271
275
|
case 'GetElectronFileResponse.getElectronFileResponse':
|
|
272
276
|
return ModuleId.GetElectronFileResponse;
|
|
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
|
|
|
41
41
|
export const getSetupName = () => {
|
|
42
42
|
return 'Lvce-Setup';
|
|
43
43
|
};
|
|
44
|
-
export const version = '0.55.
|
|
45
|
-
export const commit = '
|
|
46
|
-
export const date = '2025-07-
|
|
44
|
+
export const version = '0.55.2';
|
|
45
|
+
export const commit = '77beaf6';
|
|
46
|
+
export const date = '2025-07-08T21:25:00.000Z';
|
|
47
47
|
export const getVersion = () => {
|
|
48
48
|
return version;
|
|
49
49
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as TemporaryMessagePort from './TemporaryMessagePort.js';
|
|
2
2
|
export const name = 'TemporaryMessagePort';
|
|
3
3
|
export const Commands = {
|
|
4
|
+
getPortTuple3: TemporaryMessagePort.getPortTuple3,
|
|
4
5
|
handlePorts: TemporaryMessagePort.handlePorts,
|
|
6
|
+
sendTo2: TemporaryMessagePort.sendTo2,
|
|
7
|
+
sendToElectron: TemporaryMessagePort.sendToElectron,
|
|
5
8
|
};
|
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
import { VError } from '@lvce-editor/verror';
|
|
2
2
|
import * as Assert from '../Assert/Assert.js';
|
|
3
3
|
import * as Id from '../Id/Id.js';
|
|
4
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
5
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
4
6
|
import * as ParentIpc from '../MainProcess/MainProcess.js';
|
|
7
|
+
import { get } from '@lvce-editor/rpc-registry';
|
|
5
8
|
export const state = {
|
|
6
9
|
ports: Object.create(null),
|
|
7
10
|
};
|
|
8
|
-
export const
|
|
9
|
-
const id1 = Id.create();
|
|
10
|
-
const id2 = Id.create();
|
|
11
|
+
export const getPortTuple3 = async (id1, id2, rpcId) => {
|
|
11
12
|
await ParentIpc.invoke('TemporaryMessagePort.createPortTuple', id1, id2);
|
|
12
13
|
const port1 = state.ports[id1];
|
|
13
14
|
const port2 = state.ports[id2];
|
|
14
15
|
delete state.ports[id1];
|
|
15
16
|
delete state.ports[id2];
|
|
17
|
+
if (rpcId === IpcId.SharedProcess) {
|
|
18
|
+
return {
|
|
19
|
+
port1,
|
|
20
|
+
port2,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const ipc = get(rpcId);
|
|
24
|
+
if (!ipc) {
|
|
25
|
+
throw new Error('ipc not found' + rpcId);
|
|
26
|
+
}
|
|
27
|
+
await JsonRpc.invokeAndTransfer(ipc, 'TemporaryMessagePort.handlePorts', port1, port2, id1, id2);
|
|
16
28
|
return {
|
|
17
|
-
port1,
|
|
18
|
-
port2,
|
|
29
|
+
port1: undefined,
|
|
30
|
+
port2: undefined,
|
|
19
31
|
};
|
|
20
32
|
};
|
|
33
|
+
export const getPortTuple = async () => {
|
|
34
|
+
const id1 = Id.create();
|
|
35
|
+
const id2 = Id.create();
|
|
36
|
+
return getPortTuple3(id1, id2, IpcId.SharedProcess);
|
|
37
|
+
};
|
|
21
38
|
export const sendTo = async (name, port, ipcId) => {
|
|
22
39
|
Assert.string(name);
|
|
23
40
|
Assert.object(port);
|
|
@@ -41,3 +58,14 @@ export const handlePorts = (port1, port2, id1, id2) => {
|
|
|
41
58
|
state.ports[id1] = port1;
|
|
42
59
|
state.ports[id2] = port2;
|
|
43
60
|
};
|
|
61
|
+
export const sendToElectron = async (port, targetRpcId, sourceIpcId) => {
|
|
62
|
+
try {
|
|
63
|
+
Assert.object(port);
|
|
64
|
+
Assert.number(targetRpcId);
|
|
65
|
+
Assert.number(sourceIpcId);
|
|
66
|
+
ParentIpc.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', port, sourceIpcId);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
throw new VError(error, `Failed to send message port to main process`);
|
|
70
|
+
}
|
|
71
|
+
};
|