mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
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>
This commit is contained in:
parent
b97459b5ae
commit
ad6d2a7734
17 changed files with 612 additions and 392 deletions
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue