From f2e30a6f7999fa6ce4ab789266927e3abbb48e3f Mon Sep 17 00:00:00 2001 From: Yusuke Tanaka Date: Tue, 8 Aug 2023 10:07:29 -0700 Subject: refactor(cli): move `snapshot_from_lockfile` function to `deno_npm` (#20024) This commit moves `snapshot_from_lockfile` function to [deno_npm crate](https://github.com/denoland/deno_npm). This allows this function to be called outside Deno CLI (in particular, Deno Deploy). --- cli/args/mod.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'cli/args/mod.rs') diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 31a09216f..f7f73fd4a 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -818,16 +818,17 @@ impl CliOptions { if let Some(lockfile) = self.maybe_lockfile() { if !lockfile.lock().overwrite { - return Ok(Some( - snapshot_from_lockfile(lockfile.clone(), api) - .await - .with_context(|| { - format!( - "failed reading lockfile '{}'", - lockfile.lock().filename.display() - ) - })?, - )); + let snapshot = snapshot_from_lockfile(lockfile.clone(), api) + .await + .with_context(|| { + format!( + "failed reading lockfile '{}'", + lockfile.lock().filename.display() + ) + })?; + // clear the memory cache to reduce memory usage + api.clear_memory_cache(); + return Ok(Some(snapshot)); } } -- cgit v1.2.3