diff options
author | Yusuke Tanaka <yusuktan@maguro.dev> | 2023-08-08 10:07:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-08 10:07:29 -0700 |
commit | f2e30a6f7999fa6ce4ab789266927e3abbb48e3f (patch) | |
tree | 9d941906a651fedf62818e3e9e8a782cf50d91ce /cli/args/mod.rs | |
parent | 05f838a57cc5b5e7b262e1640baa4d93dfb0df28 (diff) |
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).
Diffstat (limited to 'cli/args/mod.rs')
-rw-r--r-- | cli/args/mod.rs | 21 |
1 files changed, 11 insertions, 10 deletions
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)); } } |