diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-05-29 16:32:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-29 16:32:15 +0200 |
commit | ad6d2a7734aafb4a64837abc6abd1d1d0fb20017 (patch) | |
tree | 4c0e8714384bc47211a4b68953a925fb54b7a015 /cli/worker.rs | |
parent | b97459b5ae3918aae21f0c02342fd7c18189ad3e (diff) |
refactor: TS compiler and module graph (#5817)
This PR addresses many problems with module graph loading
introduced in #5029, as well as many long standing issues.
"ModuleGraphLoader" has been wired to "ModuleLoader" implemented
on "State" - that means that dependency analysis and fetching is done
before spinning up TS compiler worker.
Basic dependency tracking for TS compilation has been implemented.
Errors caused by import statements are now annotated with import
location.
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/worker.rs')
-rw-r--r-- | cli/worker.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/cli/worker.rs b/cli/worker.rs index 66aa98e60..3e338d933 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -306,7 +306,8 @@ mod tests { ModuleSpecifier::resolve_url_or_path(&p.to_string_lossy()).unwrap(); let global_state = GlobalState::new(flags::Flags::default()).unwrap(); let state = - State::new(global_state, None, module_specifier.clone(), false).unwrap(); + State::new(global_state, None, module_specifier.clone(), None, false) + .unwrap(); let state_ = state.clone(); tokio_util::run_basic(async move { let mut worker = @@ -335,7 +336,8 @@ mod tests { ModuleSpecifier::resolve_url_or_path(&p.to_string_lossy()).unwrap(); let global_state = GlobalState::new(flags::Flags::default()).unwrap(); let state = - State::new(global_state, None, module_specifier.clone(), false).unwrap(); + State::new(global_state, None, module_specifier.clone(), None, false) + .unwrap(); let state_ = state.clone(); tokio_util::run_basic(async move { let mut worker = @@ -350,7 +352,6 @@ mod tests { }); let state = state_.borrow(); - assert_eq!(state.metrics.resolve_count, 1); // Check that we didn't start the compiler. assert_eq!(state.global_state.compiler_starts.load(Ordering::SeqCst), 0); } @@ -372,9 +373,14 @@ mod tests { ..flags::Flags::default() }; let global_state = GlobalState::new(flags).unwrap(); - let state = - State::new(global_state.clone(), None, module_specifier.clone(), false) - .unwrap(); + let state = State::new( + global_state.clone(), + None, + module_specifier.clone(), + None, + false, + ) + .unwrap(); let mut worker = MainWorker::new( "TEST".to_string(), startup_data::deno_isolate_init(), |