mjeanroy / rollup-plugin-license

Rollup plugin to add license banner to the final bundle and output third party licenses
MIT License
111 stars 21 forks source link

feat: drop glob usage #1742

Closed 43081j closed 3 months ago

43081j commented 3 months ago

Removes glob and uses fdir instead with a basic directory traversal (no globs).

Reduces the complexity of the file reading logic and the install size (~3MB glob vs 56KB fdir).

43081j commented 3 months ago

@mjeanroy any chance you can take a look at this?

it'll reduce install size upstream in a fair few packages (which ill contribute the version bump to once/if this lands)

mjeanroy commented 3 months ago

Hi @43081j,

Thanks for the PR! Could you elaborate a bit more on what benefits it would bring?

I'm not against changing one dependency to another, but I'd like to understand pros & cons before, if you can give a bit more details that would be great.

43081j commented 3 months ago

sure 👍

this is partly related to the ecosystem cleanup im leading

in this particular case, we're only using glob for case-insensitive file matching and wildcard extensions. so we don't actually need a glob implementation to do what we want to do

glob libraries come at a cost (mostly package size and general cpu performance). by switching to something like fdir, we will see some perf gains and reduce the install footprint a fair chunk

for example, if you look at the tree, fdir has 0 dependencies while glob pulls in 15+ packages. this adds up in the wider picture

every little helps. this will improve some dependents which will gain from other cleanups i've been doing around other packages too

mjeanroy commented 3 months ago

Thanks for all the details! I think it's worth replacing it, thanks for that!

Sorry for the delay, I have a lot of work these days :)