mirror of
https://github.com/denoland/deno.git
synced 2025-10-02 23:24:37 +00:00
parent
c5bb412933
commit
e7cab71574
18 changed files with 1154 additions and 396 deletions
14
js/main.ts
14
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}/`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue