-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(core): implement metadata fetching for Node.js and Bun #6230
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
Changes from all commits
b5de99a
cc36a2c
346f12e
5d9fb9c
4c13ad5
0ec2891
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||||||||
| use crate::backend::{Backend, VersionCacheManager}; | ||||||||||||||||||||
| use crate::backend::{Backend, VersionCacheManager, platform_target::PlatformTarget}; | ||||||||||||||||||||
| use crate::build_time::built_info; | ||||||||||||||||||||
| use crate::cache::CacheManagerBuilder; | ||||||||||||||||||||
| use crate::cli::args::BackendArg; | ||||||||||||||||||||
|
|
@@ -534,6 +534,75 @@ impl Backend for NodePlugin { | |||||||||||||||||||
| }) | ||||||||||||||||||||
| .clone() | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // ========== Lockfile Metadata Fetching Implementation ========== | ||||||||||||||||||||
|
Comment on lines
+537
to
+538
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| async fn get_tarball_url( | ||||||||||||||||||||
| &self, | ||||||||||||||||||||
| tv: &ToolVersion, | ||||||||||||||||||||
| target: &PlatformTarget, | ||||||||||||||||||||
| ) -> Result<Option<String>> { | ||||||||||||||||||||
| let version = &tv.version; | ||||||||||||||||||||
| let settings = Settings::get(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Build platform-specific filename like Node.js does | ||||||||||||||||||||
| let slug = self.build_platform_slug(version, target); | ||||||||||||||||||||
| let filename = if target.os_name() == "windows" { | ||||||||||||||||||||
| format!("{slug}.zip") | ||||||||||||||||||||
| } else { | ||||||||||||||||||||
| format!("{slug}.tar.gz") | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Use Node.js mirror URL to construct download URL | ||||||||||||||||||||
| let url = settings | ||||||||||||||||||||
| .node | ||||||||||||||||||||
| .mirror_url() | ||||||||||||||||||||
| .join(&format!("v{version}/{filename}")) | ||||||||||||||||||||
| .map_err(|e| eyre::eyre!("Failed to construct Node.js download URL: {e}"))?; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Ok(Some(url.to_string())) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| impl NodePlugin { | ||||||||||||||||||||
| /// Map OS name from Platform to Node.js convention | ||||||||||||||||||||
| fn map_os(os_name: &str) -> &str { | ||||||||||||||||||||
| match os_name { | ||||||||||||||||||||
| "macos" => "darwin", | ||||||||||||||||||||
| "linux" => "linux", | ||||||||||||||||||||
| "windows" => "win", | ||||||||||||||||||||
| other => other, | ||||||||||||||||||||
|
||||||||||||||||||||
| other => other, | |
| other => { | |
| eprintln!( | |
| "Warning: Unknown OS name '{}' encountered in Node.js platform mapping. Passing through as-is.", | |
| other | |
| ); | |
| other | |
| }, |
Copilot
AI
Sep 7, 2025
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.
[nitpick] Consider logging a warning when encountering unknown architecture names to help with debugging platform mapping issues.
| other => other, | |
| other => { | |
| eprintln!( | |
| "Warning: Unknown architecture name '{}' encountered in build_platform_slug for target: {:?}. Using as-is.", | |
| other, | |
| target | |
| ); | |
| other | |
| }, |
Uh oh!
There was an error while loading. Please reload this page.