switch to native ipc to scale down on dependencies
This commit is contained in:
2
dist/index.d.ts
vendored
Normal file
2
dist/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './smartipc.classes.ipcmaster';
|
||||
export * from './smartipc.classes.ipcchild';
|
7
dist/index.js
vendored
Normal file
7
dist/index.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
__export(require("./smartipc.classes.ipcmaster"));
|
||||
__export(require("./smartipc.classes.ipcchild"));
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsa0RBQTRDO0FBQzVDLGlEQUEyQyJ9
|
10
dist/smartipc.classes.ipcchild.d.ts
vendored
Normal file
10
dist/smartipc.classes.ipcchild.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { IpcTarget } from './smartipc.classes.ipctarget';
|
||||
export interface IpcChildConstructorOptions {
|
||||
}
|
||||
/**
|
||||
* class Ipcclient represents the child process
|
||||
*/
|
||||
export declare class IpcChild extends IpcTarget {
|
||||
constructor(optionsArg: IpcChildConstructorOptions);
|
||||
call(ipctarget: any, targetFunction: any, dataArg: any): void;
|
||||
}
|
15
dist/smartipc.classes.ipcchild.js
vendored
Normal file
15
dist/smartipc.classes.ipcchild.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
const smartipc_classes_ipctarget_1 = require("./smartipc.classes.ipctarget");
|
||||
let defaultOptions = {};
|
||||
/**
|
||||
* class Ipcclient represents the child process
|
||||
*/
|
||||
class IpcChild extends smartipc_classes_ipctarget_1.IpcTarget {
|
||||
constructor(optionsArg) {
|
||||
super({ alias: 'child' });
|
||||
}
|
||||
call(ipctarget, targetFunction, dataArg) {
|
||||
}
|
||||
}
|
||||
exports.IpcChild = IpcChild;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRpcGMuY2xhc3Nlcy5pcGNjaGlsZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aXBjLmNsYXNzZXMuaXBjY2hpbGQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLDZFQUF3RDtBQU14RCxJQUFJLGNBQWMsR0FBK0IsRUFFaEQsQ0FBQTtBQUVEOztHQUVHO0FBQ0gsY0FBc0IsU0FBUSxzQ0FBUztJQUNuQyxZQUFZLFVBQXNDO1FBQzlDLEtBQUssQ0FBQyxFQUFDLEtBQUssRUFBRSxPQUFPLEVBQUMsQ0FBQyxDQUFBO0lBQzNCLENBQUM7SUFDRCxJQUFJLENBQUMsU0FBUyxFQUFDLGNBQWMsRUFBQyxPQUFPO0lBRXJDLENBQUM7Q0FDSjtBQVBELDRCQU9DIn0=
|
21
dist/smartipc.classes.ipcmaster.d.ts
vendored
Normal file
21
dist/smartipc.classes.ipcmaster.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
import * as plugins from './smartipc.plugins';
|
||||
import { IpcTarget } from './smartipc.classes.ipctarget';
|
||||
export interface IIpcServeOptions {
|
||||
}
|
||||
export interface IIpcChildProcess {
|
||||
alias: string;
|
||||
filePath: string;
|
||||
childProcess: plugins.childProcess.ChildProcess;
|
||||
}
|
||||
/**
|
||||
* class Ipcserve is represents the master process for any chil processes
|
||||
*/
|
||||
export declare class IpcMaster extends IpcTarget {
|
||||
ipcOptions: IIpcServeOptions;
|
||||
childProcessArray: IIpcChildProcess[];
|
||||
constructor(ipcOptionsArg: IIpcServeOptions);
|
||||
/**
|
||||
* spawns a child process
|
||||
*/
|
||||
spawnProcess(filePath: string, alias: string): void;
|
||||
}
|
30
dist/smartipc.classes.ipcmaster.js
vendored
Normal file
30
dist/smartipc.classes.ipcmaster.js
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
const plugins = require("./smartipc.plugins");
|
||||
const smartipc_classes_ipctarget_1 = require("./smartipc.classes.ipctarget");
|
||||
let defaultOptions = {};
|
||||
/**
|
||||
* class Ipcserve is represents the master process for any chil processes
|
||||
*/
|
||||
class IpcMaster extends smartipc_classes_ipctarget_1.IpcTarget {
|
||||
constructor(ipcOptionsArg) {
|
||||
super({ alias: 'master' });
|
||||
this.ipcOptions = plugins.lodash.merge({}, defaultOptions, ipcOptionsArg);
|
||||
}
|
||||
/**
|
||||
* spawns a child process
|
||||
*/
|
||||
spawnProcess(filePath, alias) {
|
||||
let childProcess = plugins.childProcess.fork('ls', ['-lh', '/usr']);
|
||||
childProcess.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data}`);
|
||||
});
|
||||
childProcess.stderr.on('data', (data) => {
|
||||
console.log(`stderr: ${data}`);
|
||||
});
|
||||
childProcess.on('close', (code) => {
|
||||
console.log(`child process exited with code ${code}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.IpcMaster = IpcMaster;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRpcGMuY2xhc3Nlcy5pcGNtYXN0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGlwYy5jbGFzc2VzLmlwY21hc3Rlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsOENBQTZDO0FBQzdDLDZFQUF3RDtBQU14RCxJQUFJLGNBQWMsR0FBcUIsRUFFdEMsQ0FBQTtBQVFEOztHQUVHO0FBQ0gsZUFBdUIsU0FBUSxzQ0FBUztJQUdwQyxZQUFZLGFBQStCO1FBQ3ZDLEtBQUssQ0FBQyxFQUFDLEtBQUssRUFBRSxRQUFRLEVBQUMsQ0FBQyxDQUFBO1FBQ3hCLElBQUksQ0FBQyxVQUFVLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsRUFBRSxFQUFDLGNBQWMsRUFBQyxhQUFhLENBQUMsQ0FBQTtJQUMzRSxDQUFDO0lBRUQ7O09BRUc7SUFDSCxZQUFZLENBQUMsUUFBZ0IsRUFBRSxLQUFhO1FBRXhDLElBQUksWUFBWSxHQUFHLE9BQU8sQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxDQUFDLEtBQUssRUFBRSxNQUFNLENBQUMsQ0FBQyxDQUFBO1FBRW5FLFlBQVksQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLE1BQU0sRUFBRSxDQUFDLElBQUk7WUFDcEMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxXQUFXLElBQUksRUFBRSxDQUFDLENBQUE7UUFDOUIsQ0FBQyxDQUFDLENBQUE7UUFFRixZQUFZLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxJQUFJO1lBQ3BDLE9BQU8sQ0FBQyxHQUFHLENBQUMsV0FBVyxJQUFJLEVBQUUsQ0FBQyxDQUFBO1FBQzlCLENBQUMsQ0FBQyxDQUFBO1FBRUYsWUFBWSxDQUFDLEVBQUUsQ0FBQyxPQUFPLEVBQUUsQ0FBQyxJQUFJO1lBQzlCLE9BQU8sQ0FBQyxHQUFHLENBQUMsa0NBQWtDLElBQUksRUFBRSxDQUFDLENBQUE7UUFDckQsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDO0NBQ0o7QUEzQkQsOEJBMkJDIn0=
|
15
dist/smartipc.classes.ipctarget.d.ts
vendored
Normal file
15
dist/smartipc.classes.ipctarget.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
export interface ITargetConstructorOptions {
|
||||
alias: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export declare class IpcTarget {
|
||||
alias: string;
|
||||
private funcArray;
|
||||
constructor(optionsArg: ITargetConstructorOptions);
|
||||
/**
|
||||
* registers a function
|
||||
*/
|
||||
register(funcArrayArg: any[]): void;
|
||||
}
|
19
dist/smartipc.classes.ipctarget.js
vendored
Normal file
19
dist/smartipc.classes.ipctarget.js
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class IpcTarget {
|
||||
constructor(optionsArg) {
|
||||
this.alias = optionsArg.alias;
|
||||
}
|
||||
/**
|
||||
* registers a function
|
||||
*/
|
||||
register(funcArrayArg) {
|
||||
for (let funcItem of funcArrayArg) {
|
||||
this.funcArray.push(funcItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.IpcTarget = IpcTarget;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRpcGMuY2xhc3Nlcy5pcGN0YXJnZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGlwYy5jbGFzc2VzLmlwY3RhcmdldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBTUE7O0dBRUc7QUFDSDtJQUlJLFlBQVksVUFBcUM7UUFDN0MsSUFBSSxDQUFDLEtBQUssR0FBRyxVQUFVLENBQUMsS0FBSyxDQUFBO0lBQ2pDLENBQUM7SUFFRDs7T0FFRztJQUNILFFBQVEsQ0FBQyxZQUFtQjtRQUN4QixHQUFHLENBQUMsQ0FBQyxJQUFJLFFBQVEsSUFBSSxZQUFZLENBQUMsQ0FBQSxDQUFDO1lBQy9CLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFBO1FBQ2pDLENBQUM7SUFDTCxDQUFDO0NBRUo7QUFqQkQsOEJBaUJDIn0=
|
4
dist/smartipc.plugins.d.ts
vendored
Normal file
4
dist/smartipc.plugins.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import 'typings-global';
|
||||
export import beautylog = require('beautylog');
|
||||
export import lodash = require('lodash');
|
||||
export import childProcess = require('child_process');
|
6
dist/smartipc.plugins.js
vendored
Normal file
6
dist/smartipc.plugins.js
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.lodash = require("lodash");
|
||||
exports.childProcess = require("child_process");
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRpcGMucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aXBjLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2Qix5Q0FBOEM7QUFDOUMsbUNBQXdDO0FBQ3hDLGdEQUFxRCJ9
|
Reference in New Issue
Block a user