-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: extract structs for downloading tarballs and npm registry packuments #24067
Conversation
…packages at the same time.
pub async fn load_package_info( | ||
&self, | ||
name: &str, | ||
current_runtime_http_client: &Arc<HttpClient>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of this refactor is working towards ensuring we're not sharing HttpClients amongst different runtimes. I'll make this an Rc<HttpClient>
in the future.
fs: Arc<dyn FileSystem>, | ||
fs_resolver: Arc<dyn NpmPackageFsResolver>, | ||
global_npm_cache: Arc<NpmCache>, | ||
resolution: Arc<NpmResolution>, | ||
http_client: Arc<HttpClient>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll work on ensuring this is in an ideal place later on. Just didnt' want to land a massive refactor in one go.
@@ -1,3 +1,2 @@ | |||
Download https://localhost:4260/mkdirp | |||
Download https://localhost:4260/mkdirp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It downloading this multiple times was a cosmetic bug previously from #18622. We already got the latest information from the npm registry, so we don't need to download it again (this is now enforced by the RegistryInfoDownloader
)
|
||
use super::NpmCache; | ||
|
||
// todo(dsherret): create seams and unit test this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "seams" mean in this context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A seam is a place in the code where you can modify the behaviour for testing without modifying the code. I believe it's a term coinded by Michael Feathers from the book "working effectively with legacy code" (probably one of the best books I've read). I kind of view it as a general term for a bunch of different techniques used for making code more testable.
This is part of the work for #24063 where we need to ensure npm installation works properly on many workers.
This extracts out two structs that can be shared amongst the workers. One for downloading and extracting npm tarballs and another for downloading npm registry packuments.