From 11f225ef7d8d51a048c11c57f47674e1c5bb6f3e Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 13 Mar 2023 10:03:19 -0400 Subject: fix: ensure no node_modules directory is created when a package.json exists and no npm dependencies are used (#18134) Closes #18133 Closes #18038 --- cli/npm/resolution/snapshot.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli/npm/resolution/snapshot.rs') diff --git a/cli/npm/resolution/snapshot.rs b/cli/npm/resolution/snapshot.rs index e986294ec..e8df8286e 100644 --- a/cli/npm/resolution/snapshot.rs +++ b/cli/npm/resolution/snapshot.rs @@ -127,6 +127,11 @@ mod map_to_vec { } impl NpmResolutionSnapshot { + /// Gets if this snapshot is empty. + pub fn is_empty(&self) -> bool { + self.packages.is_empty() && self.pending_unresolved_packages.is_empty() + } + /// Resolve a package from a package requirement. pub fn resolve_pkg_from_pkg_req( &self, -- cgit v1.2.3