Skip to content

Braced groups do not support ** wildcards consistently #160

@davidje13

Description

@davidje13

I originally raised this as a behaviour difference in a consumer project as a difference after switching to tinyglobby webpack/copy-webpack-plugin#788 (comment), 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'] }));
// -> []

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstreamNeeds work upstream

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions