patterns being sorted
Check https://github.com/unplugin/unplugin-vue-components/issues/831, fast-glob seems to respect the patterns while tinyglobby applies a sort to the patterns.
Is there something we can do to respect patterns order?
both tinyglobby and fast-glob return results in an arbitrary order, which is documented at https://superchupu.dev/tinyglobby/comparison#ordering, you shouldn't rely on the results being sorted in any particular way on either of the libraries. so the only thing that can be done is for a user to sort it themselves sadly
@SuperchupuDev any chance to add some new option here to allow sort results by patterns? Maybe I can contribute, otherwise I need to add picomatch and some of the logic here at unplugin-vue-components to do the sort:
private sortPathsByGlobPrecedence(files: string[]) {
const sortedResults = []
const processedFiles = new Set()
const { globs, ...rest } = this.options
for (const glob of globs) {
const isMatch = picomatch(glob, rest) // <=== here we need to include some normalization done at tinyglobby
for (const file of files) {
if (!processedFiles.has(file) && isMatch(file)) {
sortedResults.push(file)
processedFiles.add(file)
}
}
}
return sortedResults
}