allow bun add of packages with capital letters (#2095)

This commit is contained in:
Alex Lam S.L
2023-02-18 00:46:07 +02:00
committed by GitHub
parent 56b75dbac3
commit 79f7d29d03
3 changed files with 53 additions and 2 deletions

View File

@@ -94,13 +94,15 @@ pub inline fn isNPMPackageName(target: string) bool {
if (target.len > 214) return false;
const scoped = switch (target[0]) {
'a'...'z', '0'...'9', '$', '-' => false,
// Old packages may have capital letters
'A'...'Z', 'a'...'z', '0'...'9', '$', '-' => false,
'@' => true,
else => return false,
};
var slash_index: usize = 0;
for (target[1..]) |c, i| {
switch (c) {
// Old packages may have capital letters
'A'...'Z', 'a'...'z', '0'...'9', '$', '-', '_', '.' => {},
'/' => {
if (!scoped) return false;