You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For Biome's multi-file analysis efforts, I want to use oxc-resolver to resolve arbitrary imports from JS files. However, we'll be persisting an in-memory cache of projects as a whole, and I'd like to use this cache to be used for resolving as well.
Great, you say, there's a FileSystem trait, and it can be used to implement in-memory file systems, so why not let the cache implement FileSystem?
Two reasons:
Our cache contains parsed information extracted from package.json and the likes. Implementing FileSystem means that we have the supply the contents of such files as strings. Not impossible, but inefficient.
Implementing FileSystem::read_to_string() means that we would need to implement support for reading arbitrary files. But upon closer inspection, it seems that it is only used for package.json and tsconfig.json files. This makes quite a difference for how we would implement this functionality: arbitrary file content is stored in a different cache than what we call "project layout" information. It would greatly simplify things for us if we only needed to pull information from the latter.
My suggestion: Replace FileSystem::read_to_string() with two methods FileSystem::read_package_json() and FileSystem::read_tsconfig_json().
I realize these requirements are very Biome-specific, so I understand if we may need to fork and go our own way. But I wanted to ask if there's any interest in following the same approach as Biome for oxc-resolver, in which case I'll be happy to contribute back our changes. Happy to hear your thoughts!
The text was updated successfully, but these errors were encountered:
Would you like to make the changes with Biome integrated? I'm happy to integrate your changes back to oxlint and rolldown. Perhaps this will also help us work towards #236.
Yeah, sounds like the requirements for #236 and this are quite similar indeed. I'm indeed first trying it out in Biome to validate the changes. If that works out I'll create a PR 👍
For Biome's multi-file analysis efforts, I want to use
oxc-resolver
to resolve arbitrary imports from JS files. However, we'll be persisting an in-memory cache of projects as a whole, and I'd like to use this cache to be used for resolving as well.Great, you say, there's a
FileSystem
trait, and it can be used to implement in-memory file systems, so why not let the cache implementFileSystem
?Two reasons:
package.json
and the likes. ImplementingFileSystem
means that we have the supply the contents of such files as strings. Not impossible, but inefficient.FileSystem::read_to_string()
means that we would need to implement support for reading arbitrary files. But upon closer inspection, it seems that it is only used forpackage.json
andtsconfig.json
files. This makes quite a difference for how we would implement this functionality: arbitrary file content is stored in a different cache than what we call "project layout" information. It would greatly simplify things for us if we only needed to pull information from the latter.My suggestion: Replace
FileSystem::read_to_string()
with two methodsFileSystem::read_package_json()
andFileSystem::read_tsconfig_json()
.I realize these requirements are very Biome-specific, so I understand if we may need to fork and go our own way. But I wanted to ask if there's any interest in following the same approach as Biome for
oxc-resolver
, in which case I'll be happy to contribute back our changes. Happy to hear your thoughts!The text was updated successfully, but these errors were encountered: