1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 13:00:36 -05:00
denoland-deno/main.ts
2018-05-17 21:19:49 -04:00

24 lines
611 B
TypeScript

import { main as pb } from "./msg.pb";
import "./util";
import * as runtime from "./runtime";
import * as path from "path";
function start(cwd: string, argv: string[]): void {
// TODO parse arguments.
const inputFn = argv[1];
const fn = path.resolve(cwd, inputFn);
const m = runtime.FileModule.load(fn);
m.compileAndRun();
}
V8Worker2.recv((ab: ArrayBuffer) => {
const msg = pb.Msg.decode(new Uint8Array(ab));
switch (msg.kind) {
case pb.Msg.MsgKind.START:
start(msg.start.cwd, msg.start.argv);
break;
default:
console.log("Unknown message", msg);
break;
}
});