Skip to content

Commit

Permalink
feat(Turborepo): support inputs for file hash watching
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Soltis authored and Greg Soltis committed Apr 18, 2024
1 parent 468cdcc commit 2067551
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
Loading

0 comments on commit 2067551

Please sign in to comment.