2018-05-14 03:06:09 -04:00
|
|
|
import { main as pb } from "./msg.pb";
|
2018-05-14 01:30:56 -04:00
|
|
|
import "./util";
|
2018-05-14 13:02:47 -04:00
|
|
|
import { compile } from "./compiler";
|
2018-05-14 01:30:56 -04:00
|
|
|
|
2018-05-14 13:02:47 -04:00
|
|
|
function start(cwd: string, argv: string[]): void {
|
|
|
|
// TODO parse arguments.
|
2018-05-14 02:50:55 -04:00
|
|
|
const inputFn = argv[1];
|
2018-05-14 13:02:47 -04:00
|
|
|
compile(cwd, inputFn);
|
2018-05-14 01:30:56 -04:00
|
|
|
}
|
2018-05-13 23:32:01 -04:00
|
|
|
|
2018-05-14 01:19:23 -04:00
|
|
|
V8Worker2.recv((ab: ArrayBuffer) => {
|
2018-05-14 01:30:56 -04:00
|
|
|
const msg = pb.Msg.decode(new Uint8Array(ab));
|
|
|
|
switch (msg.kind) {
|
2018-05-14 13:02:47 -04:00
|
|
|
case pb.Msg.MsgKind.START:
|
2018-05-15 04:39:03 -04:00
|
|
|
start(msg.start.cwd, msg.start.argv);
|
2018-05-14 03:15:21 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
console.log("Unknown message", msg);
|
|
|
|
break;
|
2018-05-14 01:30:56 -04:00
|
|
|
}
|
2018-05-14 00:31:48 -04:00
|
|
|
});
|