tinyglobby icon indicating copy to clipboard operation
tinyglobby copied to clipboard

Accept `string[]` for `expandDirectories`

Open benmccann opened this issue 7 months ago • 1 comments
trafficstars

If you define an Array it will only glob files that matches the patterns inside the Array

Needed to migrate Docusaurus:

https://github.com/facebook/docusaurus/blob/37d8844506d066a2bb07a5b19ccc4cfd39b6385c/packages/docusaurus/src/commands/writeHeadingIds.ts#L53

I don't think globs in files are explicitly supported: https://docusaurus.io/docs/cli#docusaurus-write-heading-ids-sitedir

I guess getPathsToWatch could return a directory rather than a file or glob though they don't give any examples of that being done.

https://github.com/facebook/docusaurus/blob/dae29a27825f75aaa2d08843360da0684f8282ec/website/versioned_docs/version-2.x/api/plugin-methods/extend-infrastructure.mdx#getpathstowatch-getpathstowatch

I think though that it would be rather hard to try to accomplish this by modifying the input patterns because we don't necessarily know what is a file and what is a directory. It's possible this could only be done either with the option in tinyglobby or possibly by requiring different input from users as a breaking change in Docusaurus v4.

benmccann avatar Mar 27 '25 13:03 benmccann

Perhaps this won't be required: https://github.com/facebook/docusaurus/pull/11020#issuecomment-2760582428

I've sent a PR: https://github.com/facebook/docusaurus/pull/11042

benmccann avatar Mar 28 '25 17:03 benmccann