summaryrefslogtreecommitdiff
path: root/cli/global_state.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-05-08 16:18:00 +0200
committerGitHub <noreply@github.com>2020-05-08 16:18:00 +0200
commitf9f10229a41d000ae9e96f0907ca321f9ffdeea7 (patch)
tree57e935dc1199373ac841cfd0359ab1b1541bc55f /cli/global_state.rs
parent6b73e0caff9673965df7a096c360ac336eb1cba0 (diff)
refactor: Remove cli::compilers module (#5138)
This PR removes "cli/compilers/" directory. "cli/compilers/ts.rs" has been renamed to "cli/tsc.rs"
Diffstat (limited to 'cli/global_state.rs')
-rw-r--r--cli/global_state.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/cli/global_state.rs b/cli/global_state.rs
index 460203364..b91ba5b10 100644
--- a/cli/global_state.rs
+++ b/cli/global_state.rs
@@ -1,8 +1,4 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-use crate::compilers::CompiledModule;
-use crate::compilers::JsCompiler;
-use crate::compilers::TargetLib;
-use crate::compilers::TsCompiler;
use crate::deno_dir;
use crate::file_fetcher::SourceFileFetcher;
use crate::flags;
@@ -10,6 +6,9 @@ use crate::http_cache;
use crate::lockfile::Lockfile;
use crate::msg;
use crate::permissions::Permissions;
+use crate::tsc::CompiledModule;
+use crate::tsc::TargetLib;
+use crate::tsc::TsCompiler;
use deno_core::ErrBox;
use deno_core::ModuleSpecifier;
use std::env;
@@ -33,7 +32,6 @@ pub struct GlobalStateInner {
pub permissions: Permissions,
pub dir: deno_dir::DenoDir,
pub file_fetcher: SourceFileFetcher,
- pub js_compiler: JsCompiler,
pub ts_compiler: TsCompiler,
pub lockfile: Option<Mutex<Lockfile>>,
pub compiler_starts: AtomicUsize,
@@ -84,7 +82,6 @@ impl GlobalState {
flags,
file_fetcher,
ts_compiler,
- js_compiler: JsCompiler {},
lockfile,
compiler_starts: AtomicUsize::new(0),
compile_lock: AsyncMutex::new(()),
@@ -140,10 +137,16 @@ impl GlobalState {
.ok();
};
- state1.js_compiler.compile(out).await
+ Ok(CompiledModule {
+ code: String::from_utf8(out.source_code)?,
+ name: out.url.to_string(),
+ })
}
}
- _ => state1.js_compiler.compile(out).await,
+ _ => Ok(CompiledModule {
+ code: String::from_utf8(out.source_code)?,
+ name: out.url.to_string(),
+ }),
}?;
drop(compile_lock);