From c03e0f3853490e804fe30fc566b45150061badc9 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 6 Dec 2022 14:12:51 -0500 Subject: 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 --- cli/args/lockfile.rs | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'cli/args') 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>>, - ) -> Option>> { - lockfile.as_ref().map(|lf| { - Rc::new(RefCell::new(Locker(Some(lf.clone())))) - as Rc> - }) - } - 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>>); - -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 { - let lock_file = self.0.as_ref()?.lock(); - lock_file.filename.to_str().map(|s| s.to_string()) - } -} - #[cfg(test)] mod tests { use super::*; -- cgit v1.2.3