diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-10-29 14:19:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 14:19:55 +0100 |
commit | 8d99adb6c481d1450b4b01dba5d7a193c51d71d1 (patch) | |
tree | 159cba5df648524b71cbb77927b247e770064d33 /cli/main.rs | |
parent | b0482400c96476946514f03f27f139dd505b06fb (diff) |
refactor: don't spin up V8 for `deno cache` (#8186)
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cli/main.rs b/cli/main.rs index 109f88202..0d67286c4 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -242,16 +242,19 @@ async fn cache_command( flags: Flags, files: Vec<String>, ) -> Result<(), AnyError> { - let main_module = - ModuleSpecifier::resolve_url_or_path("./$deno$cache.ts").unwrap(); let program_state = ProgramState::new(flags)?; - let mut worker = MainWorker::new(&program_state, main_module.clone()); for file in files { let specifier = ModuleSpecifier::resolve_url_or_path(&file)?; - // TODO(bartlomieju): don't use `preload_module` in favor of calling "ProgramState::prepare_module_load()" - // explicitly? Seems wasteful to create multiple worker just to run TS compiler - worker.preload_module(&specifier).await.map(|_| ())?; + program_state + .prepare_module_load( + specifier, + tsc::TargetLib::Main, + Permissions::allow_all(), + false, + program_state.maybe_import_map.clone(), + ) + .await?; } Ok(()) |