knip icon indicating copy to clipboard operation
knip copied to clipboard

Replace fast-glob with tinyglobby

Open gameroman opened this issue 1 month ago • 6 comments

Closes #1446

gameroman avatar Jan 06 '26 16:01 gameroman

Open in StackBlitz

npm i https://pkg.pr.new/knip@1447

commit: 6ef9df8

pkg-pr-new[bot] avatar Jan 06 '26 16:01 pkg-pr-new[bot]

Thanks for bringing this up again, and the efforts already put in. I'm going to change the title to make it clear that we should really only merge if we can get this right.

webpro avatar Jan 06 '26 17:01 webpro

looks like there are 4 places where the firstGlob function is used

https://github.com/webpro-nl/knip/blob/5b98269b0ce28890a8a16559846188dd2016bf25/packages/knip/src/plugins/yarn/index.ts#L10

https://github.com/webpro-nl/knip/blob/5b98269b0ce28890a8a16559846188dd2016bf25/packages/knip/src/plugins/taskfile/index.ts#L21

https://github.com/webpro-nl/knip/blob/5b98269b0ce28890a8a16559846188dd2016bf25/packages/knip/src/plugins/github-actions/index.ts#L15

https://github.com/webpro-nl/knip/blob/5b98269b0ce28890a8a16559846188dd2016bf25/packages/knip/src/plugins/pnpm/index.ts#L11

gameroman avatar Jan 06 '26 17:01 gameroman

@webpro I removed 2 of the usages and will see if I can deal with the other 2

gameroman avatar Jan 06 '26 22:01 gameroman

removed another one

gameroman avatar Jan 06 '26 23:01 gameroman

removed the last one

gameroman avatar Jan 06 '26 23:01 gameroman

Could use fsPromises.glob as well, given that it's available in Node 22 and greater which matches the minimum version of this module.

silverwind avatar Jan 13 '26 16:01 silverwind

Knip requires at least Node.js v18, tinyglobby v12. And I don't expect Knip to reach the fs.glob threshold too soon, as it might be helpful in legacy projects trying to keep up. That said, using built-ins is usually a good idea once we can (but tbh haven't looked into differences here recently).

webpro avatar Jan 13 '26 17:01 webpro

Ah sorry, I was looking at the wrong package.json, carry on :D

silverwind avatar Jan 13 '26 18:01 silverwind

#1462

gameroman avatar Jan 18 '26 13:01 gameroman