Skip to content
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

Support more matching capabilties #59

Open
lstrojny opened this issue Mar 18, 2022 · 3 comments
Open

Support more matching capabilties #59

lstrojny opened this issue Mar 18, 2022 · 3 comments
Labels
enhancement New feature or request ready This issue is ready for us to code on it

Comments

@lstrojny
Copy link

https://github.com/axtgr/wildcard-match is used for matching the onlyOn attribute. Unfortunately wildcard-match does not support features like brace expansion (e.g. **/*.{js,ts} to match .js and .ts files). Maybe it would be an alternative to adopt something like https://github.com/micromatch/micromatch to provide a bit more features.

@LMaxence
Copy link
Member

LMaxence commented Mar 18, 2022

Indeed, I don't really like the way the onlyOn feature is implemented so far:

  • It relies on some random js library and I am highly reluctant to that. I just don't have enough knowledge on the matter yet to come up with a nicer solution... Any inputs are welcome for this !
  • It definitely lacks matching features like regexp vs patterns, brace expansion as you mentioned it

I'll look into the library you mentioned and it's companions so that I can decide if it's possible to add it

@LMaxence LMaxence added the help wanted Extra attention is needed label Mar 19, 2022
@LMaxence LMaxence added enhancement New feature or request ready This issue is ready for us to code on it and removed help wanted Extra attention is needed labels Jan 29, 2023
@dtothefp
Copy link

I'm struggling with this as well trying to do a negative lookahead.

const matcher = require('wildcard-match');

const globs = [
  '**/*.jsx',
  '**/*.js',
  '(?!dont-match/)/**/*',
];
const match = matcher(globs)

console.log(match.regexp)

// /^(?:^(?:[^/\\]*?[/\\]+?)*?[^/\\]*?\.jsx[/\\]*?$|^(?:[^/\\]*?[/\\]+?)*?[^/\\]*?\.js[/\\]*?$|^\([^/\\]!dont\-match[/\\]+?\)[/\\]+?(?:[^/\\]*?[/\\]+?)*?[^/\\]*?[/\\]*?$)$/

maybe it's possible but I'm not sure 🤷

@axtgr
Copy link

axtgr commented Apr 16, 2023

Hi!

I'm the author of wildcard-match. The library is indeed very basic and doesn't support many features. I have a more feature-packed library: outmatch. It has brace expansion, negation and other advanced features and should work as a drop-in replacement.

I understand the reluctance to use random libraries. In case you decide to stick to the more established ones, either micromatch or picomatch are a good choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready This issue is ready for us to code on it
Projects
None yet
Development

No branches or pull requests

4 participants