@wixc3/engine-core-node
Advanced tools
Comparing version 22.1.2 to 22.1.3
/// <reference types="node" /> | ||
import { BaseHost, IDisposable, Message } from '@wixc3/engine-core'; | ||
import type { ChildProcess } from 'child_process'; | ||
export declare const isParentProcess: (process: NodeJS.Process | ChildProcess) => process is NodeJS.Process; | ||
export declare class IPCHost extends BaseHost implements IDisposable { | ||
@@ -5,0 +6,0 @@ private process; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IPCHost = void 0; | ||
exports.IPCHost = exports.isParentProcess = void 0; | ||
const engine_core_1 = require("@wixc3/engine-core"); | ||
const isParentProcess = (process) => { | ||
return !!process.ppid; | ||
}; | ||
exports.isParentProcess = isParentProcess; | ||
class IPCHost extends engine_core_1.BaseHost { | ||
@@ -32,12 +36,17 @@ constructor(process) { | ||
} | ||
if (this.process.killed) { | ||
this.emitMessageHandlers({ | ||
from: data.to, | ||
type: 'dispose', | ||
to: '*', | ||
origin: data.to, | ||
}); | ||
const disposeHandlers = (e) => { | ||
if (e) { | ||
this.emitMessageHandlers({ | ||
from: data.to, | ||
type: 'dispose', | ||
to: '*', | ||
origin: data.to, | ||
}); | ||
} | ||
}; | ||
if ((0, exports.isParentProcess)(this.process)) { | ||
this.process.send(data, undefined, undefined, disposeHandlers); | ||
} | ||
else { | ||
this.process.send(data); | ||
this.process.send(data, disposeHandlers); | ||
} | ||
@@ -44,0 +53,0 @@ } |
{ | ||
"name": "@wixc3/engine-core-node", | ||
"version": "22.1.2", | ||
"version": "22.1.3", | ||
"main": "dist/index.js", | ||
@@ -13,3 +13,3 @@ "types": "dist/index.d.ts", | ||
"create-listening-server": "^1.0.0", | ||
"express": "^4.17.1", | ||
"express": "^4.17.2", | ||
"socket.io": "^4.4.0" | ||
@@ -16,0 +16,0 @@ }, |
import { BaseHost, IDisposable, Message } from '@wixc3/engine-core'; | ||
import type { ChildProcess } from 'child_process'; | ||
export const isParentProcess = (process: NodeJS.Process | ChildProcess): process is NodeJS.Process => { | ||
return !!(process as NodeJS.Process).ppid; | ||
}; | ||
export class IPCHost extends BaseHost implements IDisposable { | ||
@@ -33,11 +37,17 @@ private disposed = false; | ||
} | ||
if ((this.process as ChildProcess).killed) { | ||
this.emitMessageHandlers({ | ||
from: data.to, | ||
type: 'dispose', | ||
to: '*', | ||
origin: data.to, | ||
}); | ||
const disposeHandlers = (e: Error | null) => { | ||
if (e) { | ||
this.emitMessageHandlers({ | ||
from: data.to, | ||
type: 'dispose', | ||
to: '*', | ||
origin: data.to, | ||
}); | ||
} | ||
}; | ||
if (isParentProcess(this.process)) { | ||
this.process.send(data, undefined, undefined, disposeHandlers); | ||
} else { | ||
this.process.send(data); | ||
this.process.send(data, disposeHandlers); | ||
} | ||
@@ -44,0 +54,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24491
405
Updatedexpress@^4.17.2