diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-06-28 17:18:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-28 17:18:21 -0700 |
commit | bc8a0e6e68547cf07a246b8b6c886de155dc8282 (patch) | |
tree | a3540b01218c4674c399eb770c0f08e5ba594793 /cli/graph_util.rs | |
parent | 2ddae872f956ddd84656a302aa5f6b752f6a6ab5 (diff) |
refactor(cli): Create wrapper around `deno_lockfile::Lockfile` (#24366)
As suggested in
https://github.com/denoland/deno/pull/24355#discussion_r1657875422.
I wasn't able to hide the mutex stuff as much as I'd like (ended up just
adding an escape hatch `inner()` method that locks the inner mutex),
because you can't return references to the inner fields through a mutex.
This is mostly motivated by the frozen lockfile changes
Diffstat (limited to 'cli/graph_util.rs')
-rw-r--r-- | cli/graph_util.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/graph_util.rs b/cli/graph_util.rs index 14f0aaace..f1e98e7c6 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -1,8 +1,8 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. use crate::args::jsr_url; +use crate::args::CliLockfile; use crate::args::CliOptions; -use crate::args::Lockfile; use crate::args::DENO_DISABLE_PEDANTIC_NODE_WARNINGS; use crate::cache; use crate::cache::GlobalHttpCache; @@ -354,7 +354,7 @@ pub struct ModuleGraphBuilder { npm_resolver: Arc<dyn CliNpmResolver>, module_info_cache: Arc<ModuleInfoCache>, parsed_source_cache: Arc<ParsedSourceCache>, - lockfile: Option<Arc<Mutex<Lockfile>>>, + lockfile: Option<Arc<CliLockfile>>, maybe_file_watcher_reporter: Option<FileWatcherReporter>, emit_cache: cache::EmitCache, file_fetcher: Arc<FileFetcher>, @@ -371,7 +371,7 @@ impl ModuleGraphBuilder { npm_resolver: Arc<dyn CliNpmResolver>, module_info_cache: Arc<ModuleInfoCache>, parsed_source_cache: Arc<ParsedSourceCache>, - lockfile: Option<Arc<Mutex<Lockfile>>>, + lockfile: Option<Arc<CliLockfile>>, maybe_file_watcher_reporter: Option<FileWatcherReporter>, emit_cache: cache::EmitCache, file_fetcher: Arc<FileFetcher>, @@ -412,7 +412,7 @@ impl ModuleGraphBuilder { } } - struct LockfileLocker<'a>(&'a Mutex<Lockfile>); + struct LockfileLocker<'a>(&'a CliLockfile); impl<'a> deno_graph::source::Locker for LockfileLocker<'a> { fn get_remote_checksum( |