fix semver edge cases and buffer used for prerelease comparisons (#6981)

* use different buf for group and manifest versions

* tests

* tests for installs that should fail

* allow `<=<prerelease-version`

* `Bun.semver.satisfies`

* one

* stringify

* symbol tests

* deinit

* arena

* more tests

* fix test

* version always on the left

* `Bun.semver.order`

* handle more edge cases, more tests

* whitespace

* more
This commit is contained in:
Dylan Conway
2023-11-08 03:36:17 -08:00
committed by GitHub
parent 6d5c513195
commit f7f6233ea8
19 changed files with 1416 additions and 190 deletions

View File

@@ -4367,6 +4367,19 @@ pub fn trim(slice: anytype, comptime values_to_strip: []const u8) @TypeOf(slice)
return slice[begin..end];
}
pub fn lengthOfLeadingWhitespaceASCII(slice: string) usize {
for (slice) |*c| {
switch (c.*) {
' ', '\t', '\n', '\r', std.ascii.control_code.vt, std.ascii.control_code.ff => {},
else => {
return @intFromPtr(c) - @intFromPtr(slice.ptr);
},
}
}
return slice.len;
}
pub fn containsNonBmpCodePointUTF16(_text: []const u16) bool {
const n = _text.len;
if (n > 0) {