aboutsummaryrefslogtreecommitdiff
path: root/src/install/npm.zig
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-10-11 02:27:07 -0700
committerGravatar GitHub <noreply@github.com> 2023-10-11 02:27:07 -0700
commit1bf28e0d77a8b2261befbdb708cefd03e0126960 (patch)
tree1d1120922f2fd935be47ab4255ac57455a0bede8 /src/install/npm.zig
parent6a17ebe6696ebdf5c20de9de3281d308959c13b5 (diff)
downloadbun-1bf28e0d77a8b2261befbdb708cefd03e0126960.tar.gz
bun-1bf28e0d77a8b2261befbdb708cefd03e0126960.tar.zst
bun-1bf28e0d77a8b2261befbdb708cefd03e0126960.zip
feat(install): automatically migrate package-lock.json to bun.lockb (#6352)bun-v1.0.5
* work so far * stuff * a * basics work * stuff * yoo * build lockfile * correct * f * a * install fixture havent tested * i made it worse * lol * be more reasonable * make the test easier to pass because bun install doesn't handle obscure lockfile edge cases :/ * a * works now * ok * a * a * cool * nah * fix stuff * l * a * idfk * LAME * prettier errors * does this fix tests? * Add more safety checks to Integrity * Add another check * More careful lifetime handling * Fix linux debugger issue * a * tmp dir and snapshot test --------- Co-authored-by: Jarred SUmner <jarred@jarredsumner.com>
Diffstat (limited to 'src/install/npm.zig')
-rw-r--r--src/install/npm.zig14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/install/npm.zig b/src/install/npm.zig
index 78d0f6061..75945ba74 100644
--- a/src/install/npm.zig
+++ b/src/install/npm.zig
@@ -327,12 +327,18 @@ pub const OperatingSystem = enum(u16) {
return (@intFromEnum(this) & linux) != 0;
} else if (comptime Environment.isMac) {
return (@intFromEnum(this) & darwin) != 0;
+ } else if (comptime Environment.isWindows) {
+ return (@intFromEnum(this) & win32) != 0;
} else {
return false;
}
}
- const NameMap = ComptimeStringMap(u16, .{
+ pub inline fn has(this: OperatingSystem, other: u16) bool {
+ return (@intFromEnum(this) & other) != 0;
+ }
+
+ pub const NameMap = ComptimeStringMap(u16, .{
.{ "aix", aix },
.{ "darwin", darwin },
.{ "freebsd", freebsd },
@@ -383,7 +389,7 @@ pub const Architecture = enum(u16) {
pub const all_value: u16 = arm | arm64 | ia32 | mips | mipsel | ppc | ppc64 | s390 | s390x | x32 | x64;
- const NameMap = ComptimeStringMap(u16, .{
+ pub const NameMap = ComptimeStringMap(u16, .{
.{ "arm", arm },
.{ "arm64", arm64 },
.{ "ia32", ia32 },
@@ -397,6 +403,10 @@ pub const Architecture = enum(u16) {
.{ "x64", x64 },
});
+ pub inline fn has(this: Architecture, other: u16) bool {
+ return (@intFromEnum(this) & other) != 0;
+ }
+
pub fn isMatch(this: Architecture) bool {
if (comptime Environment.isAarch64) {
return (@intFromEnum(this) & arm64) != 0;