summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/args/lockfile.rs6
-rw-r--r--cli/lsp/language_server.rs4
-rw-r--r--cli/module_loader.rs2
-rw-r--r--cli/tools/info.rs2
-rw-r--r--cli/tools/installer.rs2
-rw-r--r--cli/worker.rs2
6 files changed, 10 insertions, 8 deletions
diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs
index 79d139487..30e91eb92 100644
--- a/cli/args/lockfile.rs
+++ b/cli/args/lockfile.rs
@@ -77,7 +77,7 @@ pub fn read_lockfile_at_path(filename: PathBuf) -> Result<Lockfile, AnyError> {
}
pub fn write_lockfile_if_has_changes(
- lockfile: &Lockfile,
+ lockfile: &mut Lockfile,
) -> Result<(), AnyError> {
let Some(bytes) = lockfile.resolve_write_bytes() else {
return Ok(()); // nothing to do
@@ -85,5 +85,7 @@ pub fn write_lockfile_if_has_changes(
// do an atomic write to reduce the chance of multiple deno
// processes corrupting the file
atomic_write_file(&lockfile.filename, bytes, cache::CACHE_PERM)
- .context("Failed writing lockfile.")
+ .context("Failed writing lockfile.")?;
+ lockfile.has_content_changed = false;
+ Ok(())
}
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs
index 9abefb141..137ae4b46 100644
--- a/cli/lsp/language_server.rs
+++ b/cli/lsp/language_server.rs
@@ -272,8 +272,8 @@ impl LanguageServer {
// Update the lockfile on the file system with anything new
// found after caching
if let Some(lockfile) = cli_options.maybe_lockfile() {
- let lockfile = lockfile.lock();
- if let Err(err) = write_lockfile_if_has_changes(&lockfile) {
+ let mut lockfile = lockfile.lock();
+ if let Err(err) = write_lockfile_if_has_changes(&mut lockfile) {
lsp_warn!("{:#}", err);
}
}
diff --git a/cli/module_loader.rs b/cli/module_loader.rs
index 9be1ceff2..593868687 100644
--- a/cli/module_loader.rs
+++ b/cli/module_loader.rs
@@ -175,7 +175,7 @@ impl ModuleLoadPreparer {
// write the lockfile if there is one
if let Some(lockfile) = &self.lockfile {
- write_lockfile_if_has_changes(&lockfile.lock())?;
+ write_lockfile_if_has_changes(&mut lockfile.lock())?;
}
drop(_pb_clear_guard);
diff --git a/cli/tools/info.rs b/cli/tools/info.rs
index b023970f8..17e854519 100644
--- a/cli/tools/info.rs
+++ b/cli/tools/info.rs
@@ -71,7 +71,7 @@ pub async fn info(flags: Flags, info_flags: InfoFlags) -> Result<(), AnyError> {
// write out the lockfile if there is one
if let Some(lockfile) = &maybe_lockfile {
graph_exit_lock_errors(&graph);
- write_lockfile_if_has_changes(&lockfile.lock())?;
+ write_lockfile_if_has_changes(&mut lockfile.lock())?;
}
if info_flags.json {
diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs
index 2b518f46f..f810e9ca0 100644
--- a/cli/tools/installer.rs
+++ b/cli/tools/installer.rs
@@ -267,7 +267,7 @@ async fn install_local(
crate::module_loader::load_top_level_deps(&factory).await?;
if let Some(lockfile) = factory.cli_options().maybe_lockfile() {
- write_lockfile_if_has_changes(&lockfile.lock())?;
+ write_lockfile_if_has_changes(&mut lockfile.lock())?;
}
Ok(())
diff --git a/cli/worker.rs b/cli/worker.rs
index 833f3d543..7efa84369 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -533,7 +533,7 @@ impl CliMainWorkerFactory {
// For npm binary commands, ensure that the lockfile gets updated
// so that we can re-use the npm resolution the next time it runs
// for better performance
- write_lockfile_if_has_changes(&lockfile.lock())?;
+ write_lockfile_if_has_changes(&mut lockfile.lock())?;
}
(node_resolution.into_url(), is_main_cjs)