Skip to content

Commit fa3c8ac

Browse files
committed
add PackageQueryArgs::is_empty()
1 parent 86cf493 commit fa3c8ac

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/vite_workspace/src/package_filter.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ Match packages by name, directory, or glob pattern.
245245
}
246246

247247
impl PackageQueryArgs {
248+
/// Returns `true` if no package selection flags are set.
249+
///
250+
/// This is used to determine whether to use the current process's cwd (empty flags)
251+
/// or the package paths (non-empty flags) as the cwd of spawned processes.
252+
pub fn is_empty(&self) -> bool {
253+
!self.recursive && !self.transitive && !self.workspace_root && self.filter.is_empty()
254+
}
255+
248256
/// Convert CLI arguments into an opaque [`PackageQuery`].
249257
///
250258
/// `package_name` is the optional package name from a `package#task` specifier.

0 commit comments

Comments
 (0)