-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
improve and completely rework exclude optimizer #76
Conversation
commit: |
Co-authored-by: Joachim Viide <[email protected]>
67d9549
to
1aa688f
Compare
while the tests do pass now thanks to the new fdir version fixing excluding symlinks, this implementation doesn't handle patterns that have test('dynamic patterns that include slashes inside parts', async () => {
const files = await glob({ patterns: ['{.a/a,a}/a.txt'], cwd });
// files ends up being []
assert.deepEqual(files.sort(), ['a/a.txt', '.a/a/a.txt']);
}); it's easy to see why it fails but hard to properly fix. |
Would it help to have |
maybe but i'm not sure if it's optimal |
didn't want to do this, but this pr is important and a release is being delayed too much. thankfully, it seems like almost no one uses patterns like that. any optimizations here are welcome
globbing update: this PR breaks some use cases of broken parentheses, because for some weird reason globbing unescaped parentheses also matches literal parentheses. i really wish we could get a partial option on picomatch |
the optimizer was completely rewritten again! the above comment no longer applies. should be ready to go :-) will test some more |
also add more partial tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a little nitpick :D.
Also a "question" regarding your use of regexes. I learned, that regexes need to be compiled. So creating them via /regex/
on the fly might double up work. If the regexes are likely to be used anyway (and more than once), define them on the module level so the compile step is only done once
shorter and probably faster implementation 🎉 also improves optimization for patterns that end with
**
needs some work, this implementation (and the previous one) don't work well with patterns that wrapdisabled optimizations in those cases for now/
in things like*(src/index.ts)
. see #76 (comment)also closes #79 once the above is solved, and makes tests from #80 work :-)
EDIT: REWRITTEN FROM THE GROUND UP with a different approach to avoid the many edge cases it used to have