-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Introduce bun install --analyze <files...>
#17035
base: main
Are you sure you want to change the base?
Conversation
Updated 9:46 PM PT - Feb 5th, 2025
❌ @Jarred-Sumner, your commit 0569304 has 1 failures in
🧪 try this PR locally: bunx bun-pr 17035 |
Ideas for flag name: |
} else if (strings.indexOfChar(record.path.text, '/')) |slash_index| { | ||
if (slash_index > 0) { | ||
package_path = record.path.text[0..slash_index]; | ||
} | ||
} else { | ||
package_path = record.path.text; | ||
} |
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.
} else if (strings.indexOfChar(record.path.text, '/')) |slash_index| { | |
if (slash_index > 0) { | |
package_path = record.path.text[0..slash_index]; | |
} | |
} else { | |
package_path = record.path.text; | |
} | |
} else if (!strings.containsChar(record.path.text, '/')) { | |
package_path = record.path.text; | |
} |
Reasoning: the package shouldn't contain /
if it doesn't start with @
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.
or, this could just be else { package_path = record.path.text }
and let strings.isNPMPackageName
handle invalid name
@@ -1487,6 +1546,11 @@ pub const BundleV2 = struct { | |||
const reachable_files = try this.findReachableFiles(); | |||
reachable_files_count.* = reachable_files.len -| 1; // - 1 for the runtime | |||
|
|||
if (fetcher) |fetch| { | |||
try this.getAllDependencies(reachable_files, fetch); | |||
return std.ArrayList(options.OutputFile).init(allocator); |
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.
return std.ArrayList(options.OutputFile).init(allocator); | |
.init(allocator); |
Not important
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.
Needs tests
What does this PR do?
bun install --analyze <files ...>
scans imported packages from source files using Bun's bundler and adds any missing ones to package.jsonHow did you verify your code works?
WIP