sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.2k stars 194 forks source link

Drop `fast-glob` dependency from `svelte-check` #2397

Closed benmccann closed 6 days ago

benmccann commented 2 months ago

Description

Removing it would remove 18 dependencies: https://npmgraph.js.org/?q=fast-glob

It would still be pulled in via chokidar in the short-term, but chokidar 4 will remove it.

svelte-check pulling in fast-glob is responsible for 16% of the dependencies in a new SvelteKit project

Proposed solution

The usage looks pretty simple and I don't think we need a library to help

Alternatives

Use tiny-glob, which SvelteKit already uses. That won't add dependencies since the user is already downloading tiny-glob. Or maybe switch to fdir

Additional Information, eg. Screenshots

No response

jasonlyu123 commented 2 months ago

It actually should be a devDependencies because it's bundled by rollup. But It can also be removed as part of https://github.com/sveltejs/language-tools/issues/2364 since fast-glob doesn't handle it.

jasonlyu123 commented 2 months ago

Found one problem. Although we didn't mention the --ignore option can be a glob in the doc. But because it is directly passed to fast-glob, it can be.

https://github.com/sveltejs/language-tools/blob/b49270391d22d6d1cd12f6a473d4b3b4cc6f3787/packages/svelte-check/src/index.ts#L35

Not sure if we consider this as a breaking change. tiny-glob also doesn't have options for ignore so we can't replace it with it. Or we can replace it with typescript's ts.sys.readDirectory. it only supports limited glob patterns but I doubt anyone would use complex glob patterns here.