@lvce-editor/ipc 7.0.0 → 7.1.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/dist/index.js +21 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -964,7 +964,6 @@ const create$1 = async ({
|
|
|
964
964
|
stdio = 'inherit',
|
|
965
965
|
name = 'child process'
|
|
966
966
|
}) => {
|
|
967
|
-
// @ts-ignore
|
|
968
967
|
try {
|
|
969
968
|
string(path);
|
|
970
969
|
const actualArgv = ['--ipc-type=node-forked-process', ...argv];
|
|
@@ -996,42 +995,29 @@ const create$1 = async ({
|
|
|
996
995
|
throw new VError(error, `Failed to launch ${name}`);
|
|
997
996
|
}
|
|
998
997
|
};
|
|
999
|
-
|
|
1000
|
-
|
|
998
|
+
class IpcParentWithNodeForkedProcess extends Ipc {
|
|
999
|
+
constructor(childProcess) {
|
|
1000
|
+
super(childProcess);
|
|
1001
|
+
this.pid = childProcess.pid;
|
|
1002
|
+
}
|
|
1003
|
+
getData(message) {
|
|
1004
|
+
return message;
|
|
1005
|
+
}
|
|
1006
|
+
send(message) {
|
|
1007
|
+
this._rawIpc.send(message);
|
|
1008
|
+
}
|
|
1009
|
+
sendAndTransfer(message, transfer) {
|
|
1010
|
+
this._rawIpc.send(message, transfer);
|
|
1011
|
+
}
|
|
1012
|
+
dispose() {
|
|
1013
|
+
this._rawIpc.kill();
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1001
1016
|
const wrap$1 = childProcess => {
|
|
1002
|
-
return
|
|
1003
|
-
childProcess,
|
|
1004
|
-
// @ts-ignore
|
|
1005
|
-
on(event, listener) {
|
|
1006
|
-
const wrappedListener = message => {
|
|
1007
|
-
const syntheticEvent = {
|
|
1008
|
-
data: message,
|
|
1009
|
-
target: this
|
|
1010
|
-
};
|
|
1011
|
-
listener(syntheticEvent);
|
|
1012
|
-
};
|
|
1013
|
-
this.childProcess.on(event, wrappedListener);
|
|
1014
|
-
},
|
|
1015
|
-
// @ts-ignore
|
|
1016
|
-
off(event, listener) {
|
|
1017
|
-
this.childProcess.off(event, listener);
|
|
1018
|
-
},
|
|
1019
|
-
// @ts-ignore
|
|
1020
|
-
send(message) {
|
|
1021
|
-
this.childProcess.send(message);
|
|
1022
|
-
},
|
|
1023
|
-
// @ts-ignore
|
|
1024
|
-
sendAndTransfer(message, handle) {
|
|
1025
|
-
this.childProcess.send(message, handle);
|
|
1026
|
-
},
|
|
1027
|
-
dispose() {
|
|
1028
|
-
this.childProcess.kill();
|
|
1029
|
-
},
|
|
1030
|
-
pid: childProcess.pid
|
|
1031
|
-
};
|
|
1017
|
+
return new IpcParentWithNodeForkedProcess(childProcess);
|
|
1032
1018
|
};
|
|
1033
1019
|
|
|
1034
|
-
const IpcParentWithNodeForkedProcess = {
|
|
1020
|
+
const IpcParentWithNodeForkedProcess$1 = {
|
|
1035
1021
|
__proto__: null,
|
|
1036
1022
|
create: create$1,
|
|
1037
1023
|
wrap: wrap$1
|
|
@@ -1120,4 +1106,4 @@ const IpcParentWithNodeWorker = {
|
|
|
1120
1106
|
wrap
|
|
1121
1107
|
};
|
|
1122
1108
|
|
|
1123
|
-
export { IpcChildWithElectronMessagePort$1 as IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess$1 as IpcChildWithElectronUtilityProcess, IpcChildWithModuleWorker$1 as IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort$1 as IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess, IpcChildWithNodeMessagePort, IpcChildWithNodeWorker, IpcChildWithWebSocket, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
|
|
1109
|
+
export { IpcChildWithElectronMessagePort$1 as IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess$1 as IpcChildWithElectronUtilityProcess, IpcChildWithModuleWorker$1 as IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort$1 as IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess, IpcChildWithNodeMessagePort, IpcChildWithNodeWorker, IpcChildWithWebSocket, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
|