@lvce-editor/ipc 7.0.0 → 7.1.0

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -35
  2. 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,30 @@ const create$1 = async ({
996
995
  throw new VError(error, `Failed to launch ${name}`);
997
996
  }
998
997
  };
999
-
1000
- // @ts-ignore
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
+ throw new Error('Method not implemented.');
1012
+ }
1013
+ dispose() {
1014
+ this._rawIpc.kill();
1015
+ }
1016
+ }
1001
1017
  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
- };
1018
+ return new IpcParentWithNodeForkedProcess(childProcess);
1032
1019
  };
1033
1020
 
1034
- const IpcParentWithNodeForkedProcess = {
1021
+ const IpcParentWithNodeForkedProcess$1 = {
1035
1022
  __proto__: null,
1036
1023
  create: create$1,
1037
1024
  wrap: wrap$1
@@ -1120,4 +1107,4 @@ const IpcParentWithNodeWorker = {
1120
1107
  wrap
1121
1108
  };
1122
1109
 
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 };
1110
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/ipc",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "Inter Process Communication for Lvce Editor",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",