Braced groups do not support ** wildcards consistently
I originally raised this as a behaviour difference in a consumer project as a difference after switching to tinyglobby https://github.com/webpack-contrib/copy-webpack-plugin/issues/788#issuecomment-3207429950, but I was asked to raise it upstream since it's perceived to be a possible bug.
Using braced groups with initial ** wildcards behaves inconsistently. In my particular case:
Folder structure:
.well-known
- b.txt
regular
- c.txt
index.mjs
package.json
console.log(await glob('{.well-known/**/*,**/*}', { ignore: ['node_modules'] }));
// -> ['.well-known/b.txt', 'regular/c.txt']
i.e. the **/* part of the pattern is unable to detect top-level files like it would if not inside {}.
This applies regardless of the order of the branches.
A more contrived example shows that this inability to match ** with the top-level directory applies to all branches:
console.log(await glob('{**/*.mjs,**/*.json}', { ignore: ['node_modules'] }));
// -> []
thanks for reporting this, seems to be a picomatch issue, so we'd have to likely report it in there :P (and hope that maintainers look at it)
oddly enough, the issue affects micromatch too, but fast-glob which uses it doesn't have the issue 🤔
It was reported upstream in 2022!! https://github.com/micromatch/picomatch/issues/115 I tried to fix it with https://github.com/micromatch/picomatch/pull/150
fast-glob sidestep the issue by expand braces with micromatch before matching