next.js
e22f3f80 - Add a new `fs` method to track a glob. (#78686)

Commit
263 days ago
Add a new `fs` method to track a glob. (#78686) This will ensure that the caller is invalidated whenever any directory or file matching the glob changes. Happy for feedback on the name! In addition to creating this fast path for the webpack.rs loader, also optimize the way paths are constructed in `read_dir` to use `new_normalized` instead of `join`. This allows us to skip some cpu intensive string manipulation that is unneeded when composing paths returned from a `readdir` operation. Before: ![before.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/AwJ29EfoPcPdLSwCZxAz/6e0ce683-da94-40ad-aeec-99e381d8dc26.png) We can see the `read_glob` and `dir_dependency` calls which happened sequentially. After: ![after.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/AwJ29EfoPcPdLSwCZxAz/988ed4ca-78a4-4849-b070-445981f018de.png) We can see the same time spent in `read file` but we have saved a lot of time in `FileSystemPath::join` (eliminated!) and we eliminated the redundant traversal of `dir_dependency`.
Author
Parents
Loading