aboutsummaryrefslogtreecommitdiff
path: root/src/string_immutable.zig
diff options
context:
space:
mode:
authorGravatar Alex Lam S.L <alexlamsl@gmail.com> 2023-02-18 00:46:07 +0200
committerGravatar GitHub <noreply@github.com> 2023-02-17 14:46:07 -0800
commit79f7d29d034586b352a44a71bd10ffc47112545f (patch)
treee4c5e05d503776e7daaa341b9d7a54788e945312 /src/string_immutable.zig
parent56b75dbac32233b49b33c12ce25a07c9e9083dee (diff)
downloadbun-79f7d29d034586b352a44a71bd10ffc47112545f.tar.gz
bun-79f7d29d034586b352a44a71bd10ffc47112545f.tar.zst
bun-79f7d29d034586b352a44a71bd10ffc47112545f.zip
allow `bun add` of packages with capital letters (#2095)
Diffstat (limited to 'src/string_immutable.zig')
-rw-r--r--src/string_immutable.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index 5f5b943d6..869235fcb 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -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;