perf: add depTreeCache to walkDependencyTree #364
Conversation
Cache dependency tree walk results to avoid re-walking the same subtrees across multiple `transform` calls. Thank you @adrianani for the suggestion!
Add configureServer hook to clear all caches (resolvedCache, file content cache, depTreeCache) when files change, fixing a pre-existing staleness bug where edited files would not be re-analyzed.
Use `${importee}\0${importer}` as the cache key instead of just the
importee string, preventing cross-file collisions where the same
relative import (e.g., "./Counter") from different files could resolve
to different modules.
Allow users to exclude specific directories (e.g., `node_modules`) from the dependency tree walk via the `exclude` option. This is opt-in since walking `node_modules` is by design for detecting island components in npm packages.
|
If I may add some more feedback from a DX point of view based on the vision described in your comment from #208 Even though islands are supposed to come from Maybe I'm going the wrong way about using honox here but in a project with just a few dependencies, all fairly sensible like better-auth, drizzle, pg, @aws-sdk/client-s3, etc... Currently you can either exclude With an opt-in pattern where the whole node_modules is excluded by default you could add in a The exclude option would be nice if it's like a monorepo and you want to exclude other folders beyond node_modules. Hope it makes sense? |
|
Hi @adrianani, Thank you for your feedback! |
Based on the patch created by @adrianani at #208, I made improvements, including addressing the issue of insufficient cache invalidation.