diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-05-01 14:35:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 14:35:23 -0400 |
commit | 9efed4c7a3d32de62e9c9b5e0c6712ce97637abb (patch) | |
tree | aa370f95df93c71f6c57d6a01a50b4df1955ee57 /cli/tools/fmt.rs | |
parent | 30628288ce2b411ca3def46129a4606073e16bac (diff) |
refactor(cli): remove ProcState - add CliFactory (#18900)
This removes `ProcState` and replaces it with a new `CliFactory` which
initializes our "service structs" on demand. This isn't a performance
improvement at the moment for `deno run`, but might unlock performance
improvements in the future.
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r-- | cli/tools/fmt.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index 41accacba..70d2bd639 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -12,8 +12,8 @@ use crate::args::FilesConfig; use crate::args::FmtOptions; use crate::args::FmtOptionsConfig; use crate::args::ProseWrap; -use crate::cache::Caches; use crate::colors; +use crate::factory::CliFactory; use crate::util::diff::diff; use crate::util::file_watcher; use crate::util::file_watcher::ResolutionResult; @@ -101,11 +101,12 @@ pub async fn format( } } }; - let deno_dir = &cli_options.resolve_deno_dir()?; - let caches = Caches::default(); + let factory = CliFactory::from_cli_options(Arc::new(cli_options)); + let cli_options = factory.cli_options(); + let caches = factory.caches()?; let operation = |(paths, fmt_options): (Vec<PathBuf>, FmtOptionsConfig)| async { let incremental_cache = Arc::new(IncrementalCache::new( - caches.fmt_incremental_cache_db(deno_dir), + caches.fmt_incremental_cache_db(), &fmt_options, &paths, )); |