mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
refactor: don't spin up V8 for deno cache
(#8186)
This commit is contained in:
parent
b0482400c9
commit
8d99adb6c4
1 changed files with 9 additions and 6 deletions
15
cli/main.rs
15
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(())
|
||||
|
|
Loading…
Reference in a new issue