summaryrefslogtreecommitdiff
path: root/js/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/main.ts')
-rw-r--r--js/main.ts14
1 files changed, 5 insertions, 9 deletions
diff --git a/js/main.ts b/js/main.ts
index d035f9ba6..740003049 100644
--- a/js/main.ts
+++ b/js/main.ts
@@ -1,10 +1,9 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import { flatbuffers } from "flatbuffers";
import { deno as fbs } from "gen/msg_generated";
-import { assert, log, assignCmdId } from "./util";
-import * as util from "./util";
+import { assert, assignCmdId, log, setLogDebug } from "./util";
import * as os from "./os";
-import * as runtime from "./runtime";
+import { DenoCompiler } from "./compiler";
import { libdeno } from "./globals";
import * as timers from "./timers";
import { onFetchRes } from "./fetch";
@@ -47,7 +46,7 @@ function onMessage(ui8: Uint8Array) {
/* tslint:disable-next-line:no-default-export */
export default function denoMain() {
libdeno.recv(onMessage);
- runtime.setup();
+ const compiler = DenoCompiler.instance();
// First we send an empty "Start" message to let the privlaged side know we
// are ready. The response should be a "StartRes" message containing the CLI
@@ -69,7 +68,7 @@ export default function denoMain() {
const startResMsg = new fbs.StartRes();
assert(base.msg(startResMsg) != null);
- util.setLogDebug(startResMsg.debugFlag());
+ setLogDebug(startResMsg.debugFlag());
const cwd = startResMsg.cwd();
log("cwd", cwd);
@@ -86,8 +85,5 @@ export default function denoMain() {
os.exit(1);
}
- const mod = runtime.resolveModule(inputFn, `${cwd}/`);
- assert(mod != null);
- // TypeScript does not track assert, therefore not null assertion
- mod!.compileAndRun();
+ compiler.run(inputFn, `${cwd}/`);
}