[bun install] some things install

This commit is contained in:
Jarred Sumner
2021-11-15 05:15:21 -08:00
parent b5fd121f26
commit 1610ff33ea
9 changed files with 339 additions and 190 deletions

12
.vscode/launch.json vendored
View File

@@ -314,6 +314,18 @@
"cwd": "${workspaceFolder}/integration/snippets",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Install",
"program": "bun-debug",
"args": ["install"],
"cwd": "/tmp/wow-such-npm",
"env": {
"GOMAXPROCS": "1"
},
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",

View File

@@ -546,7 +546,7 @@ struct Semver {
uint32 major;
uint32 minor;
uint32 patch;
qualifier SemverQualifier;
SemverQualifier qualifier;
}
enum NPMPackageDataKind {

View File

@@ -664,7 +664,9 @@ pub const Command = struct {
return;
},
.InstallCommand => {
try InstallCommand.exec(allocator);
const ctx = try Command.Context.create(allocator, log, .BuildCommand);
try InstallCommand.exec(ctx);
return;
},
.GetCompletionsCommand => {

View File

@@ -58,6 +58,7 @@ pub const Output = struct {
}
pub fn configureThread() void {
if (source_set) return;
std.debug.assert(stdout_stream_set);
source = Source.init(stdout_stream, stderr_stream);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1060,7 +1060,7 @@ pub const E = struct {
pub inline fn toU64(self: Number) u64 {
@setRuntimeSafety(false);
return @floatToInt(u64, @maximum(@floor(self.value), 0));
return @floatToInt(u64, @maximum(@trunc(self.value), 0));
}
pub fn jsonStringify(self: *const Number, opts: anytype, o: anytype) !void {

View File

@@ -540,7 +540,7 @@ pub const Archive = struct {
var archive = stream.archive;
var count: u32 = 0;
const dir: std.fs.Dir = brk: {
var dir: std.fs.Dir = brk: {
const cwd = std.fs.cwd();
cwd.makePath(
root,

View File

@@ -9,11 +9,17 @@ pub inline fn s2nassert(value: c_int) void {
std.debug.assert(value == 0);
}
var booted_any: bool = false;
pub fn boot(allcoator: *std.mem.Allocator) void {
if (!booted_any) {
s2nassert(s2n_disable_atexit());
s2nassert(s2n_init());
Allocator.allocator = allcoator;
CacheStore.instance = CacheStore{ .allocator = allcoator, .map = @TypeOf(CacheStore.instance.map).init(allcoator) };
}
booted_any = true;
if (booted) return;
booted = true;
Allocator.allocator = allcoator;
CacheStore.instance = CacheStore{ .allocator = allcoator, .map = @TypeOf(CacheStore.instance.map).init(allcoator) };
// Important for any website using Cloudflare.
// Do to our modifications in the library, this must be called _first_
@@ -43,8 +49,6 @@ pub fn boot(allcoator: *std.mem.Allocator) void {
// Also, the implementation
// s2nassert(s2n_mem_set_callbacks(Allocator.initCallback, Allocator.deinitCallback, Allocator.mallocCallback, Allocator.freeCallback));
s2nassert(s2n_disable_atexit());
s2nassert(s2n_init());
global_s2n_config = s2n_fetch_default_config();
// s2nassert(s2n_config_set_verify_host_callback(global_s2n_config, verify_host_callback, null));
// s2nassert(s2n_config_set_check_stapled_ocsp_response(global_s2n_config, 0));
@@ -546,8 +550,8 @@ pub const s2n_offered_psk_list = struct_s2n_offered_psk_list;
pub const s2n_async_pkey_op = struct_s2n_async_pkey_op;
pub const s2n_offered_early_data = struct_s2n_offered_early_data;
var booted = false;
pub var global_s2n_config: *s2n_config = undefined;
threadlocal var booted = false;
pub threadlocal var global_s2n_config: *s2n_config = undefined;
const unexpectedErrno = std.os.unexpectedErrno;
const S2NError = error{ Closed, WouldBlock, Alert, Protocol, Internal, Usage };
pub inline fn s2nErrorNo(rc: c_int) S2NError!std.os.system.E {

View File

@@ -257,8 +257,8 @@ pub inline fn endsWith(self: string, str: string) bool {
return str.len == 0 or @call(.{ .modifier = .always_inline }, std.mem.endsWith, .{ u8, self, str });
}
pub inline fn endsWithComptime(self: string, comptime str: antype) bool {
return self.len >= str.len and strings.eqlComptimeIgnoreLen(self[self.len - str.len .. self.len], comptime str);
pub inline fn endsWithComptime(self: string, comptime str: anytype) bool {
return self.len >= str.len and eqlComptimeIgnoreLen(self[self.len - str.len .. self.len], comptime str);
}
pub inline fn startsWithChar(self: string, char: u8) bool {