summaryrefslogtreecommitdiff
path: root/cli/args/lockfile.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-12-06 14:12:51 -0500
committerGitHub <noreply@github.com>2022-12-06 14:12:51 -0500
commitc03e0f3853490e804fe30fc566b45150061badc9 (patch)
tree0f23dad9542c8cf80d0861c2932e2eb1b9e6fc3a /cli/args/lockfile.rs
parent3e47a27f4fa528b91ac60b07ee6931f47fed0bc5 (diff)
refactor: remove `deno_graph::Locker` usage (#16877)
This is just a straight refactor and doesn't make any improvements to the code that could now be made. Closes #16493
Diffstat (limited to 'cli/args/lockfile.rs')
-rw-r--r--cli/args/lockfile.rs41
1 files changed, 0 insertions, 41 deletions
diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs
index 73a075f81..0d3b2f249 100644
--- a/cli/args/lockfile.rs
+++ b/cli/args/lockfile.rs
@@ -2,18 +2,13 @@
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
-use deno_core::parking_lot::Mutex;
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json;
-use deno_core::ModuleSpecifier;
use log::debug;
-use std::cell::RefCell;
use std::collections::BTreeMap;
use std::io::Write;
use std::path::PathBuf;
-use std::rc::Rc;
-use std::sync::Arc;
use crate::args::ConfigFile;
use crate::npm::NpmPackageId;
@@ -96,15 +91,6 @@ pub struct Lockfile {
}
impl Lockfile {
- pub fn as_maybe_locker(
- lockfile: Option<Arc<Mutex<Lockfile>>>,
- ) -> Option<Rc<RefCell<dyn deno_graph::source::Locker>>> {
- lockfile.as_ref().map(|lf| {
- Rc::new(RefCell::new(Locker(Some(lf.clone()))))
- as Rc<RefCell<dyn deno_graph::source::Locker>>
- })
- }
-
pub fn discover(
flags: &Flags,
maybe_config_file: Option<&ConfigFile>,
@@ -342,33 +328,6 @@ Use \"--lock-write\" flag to regenerate the lockfile at \"{}\".",
}
}
-#[derive(Debug)]
-pub struct Locker(Option<Arc<Mutex<Lockfile>>>);
-
-impl deno_graph::source::Locker for Locker {
- fn check_or_insert(
- &mut self,
- specifier: &ModuleSpecifier,
- source: &str,
- ) -> bool {
- if let Some(lock_file) = &self.0 {
- let mut lock_file = lock_file.lock();
- lock_file.check_or_insert_remote(specifier.as_str(), source)
- } else {
- true
- }
- }
-
- fn get_checksum(&self, content: &str) -> String {
- util::checksum::gen(&[content.as_bytes()])
- }
-
- fn get_filename(&self) -> Option<String> {
- let lock_file = self.0.as_ref()?.lock();
- lock_file.filename.to_str().map(|s| s.to_string())
- }
-}
-
#[cfg(test)]
mod tests {
use super::*;