embark-area-51/lib/modules/solidity/solcP.js

19 lines
391 B
JavaScript

let solc;
process.on('message', function (msg) {
if (msg.action === 'loadCompiler') {
solc = require(msg.solcLocation);
process.send({result: "loadedCompiler"});
}
if (msg.action === 'compile') {
let output = solc.compile(msg.obj, msg.optimize);
process.send({result: "compilation", output: output});
}
});
process.on('exit', function () {
process.exit(0);
});