-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: dynamically ignore files or directories #265
Comments
Hello, @dflupu, Thank you for interesting question 🎉 First, I think that the hook mechanism will help you here. Unfortunately, this mechanism requires a lot of effort and will not appear in the near future (~1 year, i'll create an issue). The problem is that this mechanism will slow down the directory tree crawl. But even in this case, I don't see any ways to add patterns to primary filters on the fly — only in hooks. Second, I see that right now you are doing a primary crawl of the directory tree to search for files ( Additional question:
|
We are affected by the globby performance issue described by @dflupu. We have a monorepo (using rush+pnpm) with a big |
I just hit a scenario where my ignore globs are slowing things down significantly, most of the time is actually spent executing them, and if I just merge them into one it's still slow because they seem to be expanded anyway. If a raw callback were allowed I could just write like |
It would be useful if the user would be able to pass a callback to fast-glob that, when called with paths to files or directories, returns whether or not fast-glob should include them in the results. If the callback returns false for a directory, then the directory is not iterated at all.
One use case for this would be would be improving globby performance when the gitignore option is enabled. Currently, this option works by globbing the given path twice: once with a
**/.gitignore
pattern to find and read the gitignore files, and again with the users' globs. While this could be improved upon, I cannot see a way that both a) avoids the initial glob for gitignore files and b) makes fast-glob not iterate gitignored directories. Adding a callback would make that possible.If I am not aware of some relevant fast-glob feature, let me know.
Globby issue: sindresorhus/globby#50
The text was updated successfully, but these errors were encountered: