Skip to content

Commit

Permalink
feat(Turborepo): support inputs for file hash watching (#7907)
Browse files Browse the repository at this point in the history
### Description

 - adds support for `inputs` that are contained within a package to daemon file hashing. `inputs` are tracked after the first request for them.

### Testing Instructions

Added tests that use `inputs`.

Closes TURBO-2762
  • Loading branch information
gsoltis committed Apr 24, 2024
1 parent 9783846 commit db0eaf2
Show file tree
Hide file tree
Showing 3 changed files with 284 additions and 45 deletions.
14 changes: 14 additions & 0 deletions crates/turborepo-filewatch/src/globwatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ impl GlobSet {
inputs.extend(self.exclude_raw.iter().cloned());
inputs
}

pub fn matches(&self, input: &RelativeUnixPath) -> bool {
self.include.values().any(|glob| glob.is_match(input)) && !self.exclude.is_match(input)
}
}

impl std::fmt::Debug for GlobSet {
Expand Down Expand Up @@ -133,6 +137,16 @@ impl GlobSet {
};
Self::from_raw(includes, excludes)
}

pub fn is_package_local(&self) -> bool {
self.include
.keys()
.all(|raw_glob| !raw_glob.starts_with("../"))
&& self
.exclude_raw
.iter()
.all(|raw_glob| !raw_glob.starts_with("../"))
}
}

#[derive(Debug, Error)]
Expand Down

0 comments on commit db0eaf2

Please sign in to comment.