2018-09-17 17:41:13 -07:00
|
|
|
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
2018-07-23 14:13:12 -04:00
|
|
|
extern crate flatbuffers;
|
2018-10-03 23:58:29 -04:00
|
|
|
#[macro_use]
|
2018-08-09 12:17:08 -07:00
|
|
|
extern crate futures;
|
2018-08-15 20:57:36 -04:00
|
|
|
extern crate hyper;
|
2018-07-26 17:54:22 -04:00
|
|
|
extern crate libc;
|
2018-09-09 19:21:22 -04:00
|
|
|
extern crate msg_rs as msg;
|
2018-08-24 00:36:45 +02:00
|
|
|
extern crate rand;
|
2018-07-24 01:45:23 -04:00
|
|
|
extern crate tempfile;
|
2018-08-09 12:17:08 -07:00
|
|
|
extern crate tokio;
|
2018-09-18 11:53:16 -07:00
|
|
|
extern crate tokio_executor;
|
2018-09-27 00:56:39 -04:00
|
|
|
extern crate tokio_fs;
|
|
|
|
extern crate tokio_io;
|
2018-09-22 04:42:07 -04:00
|
|
|
extern crate tokio_threadpool;
|
2018-07-23 14:13:12 -04:00
|
|
|
extern crate url;
|
2018-07-26 17:54:22 -04:00
|
|
|
#[macro_use]
|
2018-09-24 19:51:37 -04:00
|
|
|
extern crate lazy_static;
|
|
|
|
#[macro_use]
|
2018-07-26 17:54:22 -04:00
|
|
|
extern crate log;
|
2018-09-13 23:04:02 -07:00
|
|
|
extern crate dirs;
|
2018-08-28 13:49:19 -04:00
|
|
|
extern crate hyper_rustls;
|
2018-09-10 20:40:03 -07:00
|
|
|
extern crate remove_dir_all;
|
2018-08-28 13:49:19 -04:00
|
|
|
extern crate ring;
|
2018-07-26 17:54:22 -04:00
|
|
|
|
|
|
|
mod deno_dir;
|
2018-08-15 23:36:48 -04:00
|
|
|
mod errors;
|
2018-08-17 16:34:30 -04:00
|
|
|
mod flags;
|
2018-07-26 17:54:22 -04:00
|
|
|
mod fs;
|
|
|
|
pub mod handlers;
|
2018-09-24 19:51:37 -04:00
|
|
|
mod http;
|
2018-09-17 17:41:13 -07:00
|
|
|
mod isolate;
|
2018-09-04 18:56:12 -04:00
|
|
|
mod libdeno;
|
2018-10-01 19:37:18 -04:00
|
|
|
mod resources;
|
2018-09-18 11:53:16 -07:00
|
|
|
mod tokio_util;
|
2018-08-17 16:34:30 -04:00
|
|
|
mod version;
|
2018-07-04 14:50:28 -04:00
|
|
|
|
2018-07-25 18:27:27 -07:00
|
|
|
use std::env;
|
2018-07-26 17:37:09 -04:00
|
|
|
|
|
|
|
static LOGGER: Logger = Logger;
|
|
|
|
|
|
|
|
struct Logger;
|
|
|
|
|
|
|
|
impl log::Log for Logger {
|
|
|
|
fn enabled(&self, metadata: &log::Metadata) -> bool {
|
2018-08-07 13:33:36 -04:00
|
|
|
metadata.level() <= log::max_level()
|
2018-07-26 17:37:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
fn log(&self, record: &log::Record) {
|
|
|
|
if self.enabled(record.metadata()) {
|
2018-08-17 16:34:30 -04:00
|
|
|
println!("{} RS - {}", record.level(), record.args());
|
2018-07-26 17:37:09 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fn flush(&self) {}
|
|
|
|
}
|
|
|
|
|
2018-06-16 01:43:23 +02:00
|
|
|
fn main() {
|
2018-07-26 17:37:09 -04:00
|
|
|
log::set_logger(&LOGGER).unwrap();
|
2018-09-22 01:03:24 -04:00
|
|
|
let args = env::args().collect();
|
2018-09-18 11:53:16 -07:00
|
|
|
let mut isolate = isolate::Isolate::new(args, handlers::msg_from_js);
|
|
|
|
flags::process(&isolate.state.flags);
|
|
|
|
tokio_util::init(|| {
|
|
|
|
isolate
|
|
|
|
.execute("deno_main.js", "denoMain();")
|
|
|
|
.unwrap_or_else(|err| {
|
|
|
|
error!("{}", err);
|
|
|
|
std::process::exit(1);
|
|
|
|
});
|
|
|
|
isolate.event_loop();
|
|
|
|
});
|
2018-06-16 01:43:23 +02:00
|
|
|
}
|