refactor: drop walk and minimatch#959
Conversation
There was a problem hiding this comment.
Please remove async and promises and just get the paths synchronously like it did before.
There was a problem hiding this comment.
Previous version was not synchronous. Walk emitted events and the main compile export function wouldn't really wait for it.
What's more, even if I make my changes use readdirSync + the main compile func statSync it's still not synchronous due to twig() constructor not calling async: false.
I've made it full sync now by combining the above.
PS. It looks to me like the recursive flags from the options (defaults to false) was and still is a no-op. We could technically now make it work as expected with readdirSync params.
There was a problem hiding this comment.
Good points, I didn't notice that before. Thank you for getting it to work synchronously all the same. It makes it easier to work with in its current state. The package is a weird mix of async and sync that needs to get converted to all async, but until then this is a big help.
0e3071d to
dba836e
Compare
d7f1c26 to
90722b2
Compare
There was a problem hiding this comment.
Good points, I didn't notice that before. Thank you for getting it to work synchronously all the same. It makes it easier to work with in its current state. The package is a weird mix of async and sync that needs to get converted to all async, but until then this is a big help.
|
@slagiewka thank you so much for your work on this. I made a couple of last tweaks to clean up a couple of things. |
This commit drops the combined use of walk and minimatch by using fs.readdir and path.matchesGlob. The baseline for this commit is node v22.5.
- `readdirSync` does not have a callback argument.
- This was leftover from the CLI version of the package before automatic directory walking was added.
adfe7d3 to
ab24fc3
Compare
This commit drops the combined use of walk and minimatch by using fs.readdir and path.matchesGlob.
The baseline for this commit is node v22.5.
Closes #955
Closes #956
PS. I run this on 22.4 to confirm it faling. Then it turns out that you can't run the test suite without
NODE_OPTIONS="--experimental-require-module"due tochokidarbeing ESM-only.