Skip to content

Commit

Permalink
refactor(glob-assets): use 'tinyglobby' instead of 'globby' as depend…
Browse files Browse the repository at this point in the history
…ency

globby@14.0.2 is 26.3kb (minified + gzipped) -> https://bundlephobia.com/package/globby@14.0.2
tinyglobby@0.2.6 is 10.8kb (minified + gzipped) https://bundlephobia.com/package/tinyglobby@0.2.6

and other libraries are opting for it: https://e18e.dev/blog/august-contributions-showcase#tinyglobby-fdir
  • Loading branch information
oscard0m committed Sep 13, 2024
1 parent 7981b08 commit 492f57c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/glob-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ export default async function globAssets({ cwd }, assets) {
if (glob.length <= 1 && glob[0].startsWith("!")) {
debug(
"skipping the negated glob %o as its alone in its group and would retrieve a large amount of files",
glob[0],
glob[0]
);
return [];
}

const globbed = await globby(glob, {
cwd,
expandDirectories: false, // TODO Temporary workaround for https://github.com/mrmlnc/fast-glob/issues/47
gitignore: false,
dot: true,
onlyFiles: false,
});
Expand Down Expand Up @@ -62,7 +61,7 @@ export default async function globAssets({ cwd }, assets) {

// If asset is a String definition but no match is found, output the elements of the original glob (each one will be considered as a missing file)
return glob;
}),
})
// Sort with Object first, to prioritize Object definition over Strings in dedup
)
)
Expand All @@ -71,6 +70,6 @@ export default async function globAssets({ cwd }, assets) {
// Compare `path` property if Object definition, value itself if String
(a, b) =>
resolve(cwd, isPlainObject(a) ? a.path : a) ===
resolve(cwd, isPlainObject(b) ? b.path : b),
resolve(cwd, isPlainObject(b) ? b.path : b)
);
}

0 comments on commit 492f57c

Please sign in to comment.