summaryrefslogtreecommitdiff
path: root/cli/tsc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tsc.rs')
-rw-r--r--cli/tsc.rs34
1 files changed, 22 insertions, 12 deletions
diff --git a/cli/tsc.rs b/cli/tsc.rs
index 1e75b7041..c4102cc42 100644
--- a/cli/tsc.rs
+++ b/cli/tsc.rs
@@ -18,7 +18,7 @@ use crate::module_graph::ModuleGraphLoader;
use crate::ops;
use crate::permissions::Permissions;
use crate::source_maps::SourceMapGetter;
-use crate::state::CliState;
+use crate::state::CliModuleLoader;
use crate::tsc_config;
use crate::version;
use crate::worker::Worker;
@@ -48,7 +48,6 @@ use std::ops::DerefMut;
use std::path::Path;
use std::path::PathBuf;
use std::pin::Pin;
-use std::rc::Rc;
use std::str;
use std::sync::atomic::Ordering;
use std::sync::Arc;
@@ -132,9 +131,25 @@ pub struct CompilerWorker {
}
impl CompilerWorker {
- pub fn new(name: String, state: &Rc<CliState>) -> Self {
- let mut worker =
- Worker::new(name, Some(js::compiler_isolate_init()), state);
+ pub fn new(
+ name: String,
+ permissions: Permissions,
+ global_state: Arc<GlobalState>,
+ ) -> Self {
+ let main_module =
+ ModuleSpecifier::resolve_url_or_path("./$deno$compiler.ts").unwrap();
+ // TODO(bartlomieju): compiler worker shouldn't require any loader/state
+ let loader = CliModuleLoader::new(None);
+ let mut worker = Worker::new(
+ name,
+ Some(js::compiler_isolate_init()),
+ permissions,
+ main_module,
+ global_state,
+ loader,
+ false,
+ true,
+ );
let response = Arc::new(Mutex::new(None));
ops::runtime::init(&mut worker);
ops::errors::init(&mut worker);
@@ -215,17 +230,12 @@ fn create_compiler_worker(
global_state: &Arc<GlobalState>,
permissions: Permissions,
) -> CompilerWorker {
- let entry_point =
- ModuleSpecifier::resolve_url_or_path("./$deno$compiler.ts").unwrap();
- let worker_state =
- CliState::new(&global_state, Some(permissions), entry_point, None, true)
- .expect("Unable to create worker state");
-
// TODO(bartlomieju): this metric is never used anywhere
// Count how many times we start the compiler worker.
global_state.compiler_starts.fetch_add(1, Ordering::SeqCst);
- let mut worker = CompilerWorker::new("TS".to_string(), &worker_state);
+ let mut worker =
+ CompilerWorker::new("TS".to_string(), permissions, global_state.clone());
worker
.execute("globalThis.bootstrapCompilerRuntime()")
.unwrap();