diff options
author | 2023-05-08 21:29:19 -0700 | |
---|---|---|
committer | 2023-05-08 21:29:19 -0700 | |
commit | 4a2d89d8653be1ec8db2322b89dae35cc8affe07 (patch) | |
tree | f89cfa32c974385eeb1859eac3e8a731cd09ee50 | |
parent | e422c849d5ef3d5ba40a02f2fe3c1409075640a0 (diff) | |
download | bun-4a2d89d8653be1ec8db2322b89dae35cc8affe07.tar.gz bun-4a2d89d8653be1ec8db2322b89dae35cc8affe07.tar.zst bun-4a2d89d8653be1ec8db2322b89dae35cc8affe07.zip |
:scissors: some dead code
-rw-r--r-- | src/fs.zig | 45 | ||||
-rw-r--r-- | src/node_module_bundle.zig | 6 |
2 files changed, 0 insertions, 51 deletions
diff --git a/src/fs.zig b/src/fs.zig index 8d6392751..ee2fdff54 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -33,51 +33,6 @@ pub const Preallocate = struct { }; }; -pub const BytecodeCacheFetcher = struct { - fd: ?StoredFileDescriptorType = null, - - pub const Available = enum { - Unknown, - Available, - NotAvailable, - - pub inline fn determine(fd: ?StoredFileDescriptorType) Available { - if (!comptime FeatureFlags.enable_bytecode_caching) return .NotAvailable; - - const _fd = fd orelse return .Unknown; - return if (_fd > 0) .Available else return .NotAvailable; - } - }; - - pub fn fetch(this: *BytecodeCacheFetcher, sourcename: string, fs: *FileSystem.RealFS) ?StoredFileDescriptorType { - switch (Available.determine(this.fd)) { - .Available => { - return this.fd.?; - }, - .NotAvailable => { - return null; - }, - .Unknown => { - var basename_buf: [512]u8 = undefined; - var pathname = Fs.PathName.init(sourcename); - bun.copy(u8, &basename_buf, pathname.base); - bun.copy(u8, basename_buf[pathname.base.len..], ".bytecode"); - const basename = basename_buf[0 .. pathname.base.len + ".bytecode".len]; - - if (fs.fetchCacheFile(basename)) |cache_file| { - this.fd = @truncate(StoredFileDescriptorType, cache_file.handle); - return @truncate(StoredFileDescriptorType, cache_file.handle); - } else |err| { - Output.prettyWarnln("<r><yellow>Warn<r>: Bytecode caching unavailable due to error: {s}", .{@errorName(err)}); - Output.flush(); - this.fd = 0; - return null; - } - }, - } - } -}; - pub const FileSystem = struct { top_level_dir: string = "/", diff --git a/src/node_module_bundle.zig b/src/node_module_bundle.zig index 26e755257..c70a58419 100644 --- a/src/node_module_bundle.zig +++ b/src/node_module_bundle.zig @@ -54,8 +54,6 @@ pub const NodeModuleBundle = struct { code_string: ?AllocatedString = null, - bytecode_cache_fetcher: Fs.BytecodeCacheFetcher = Fs.BytecodeCacheFetcher{}, - pub const magic_bytes = "#!/usr/bin/env bun\n\n"; threadlocal var jsbundle_prefix: [magic_bytes.len + 5]u8 = undefined; @@ -64,10 +62,6 @@ pub const NodeModuleBundle = struct { return this.package_name_map.contains("react-refresh"); } - pub inline fn fetchByteCodeCache(this: *NodeModuleBundle, basename: string, fs: *Fs.FileSystem.RealFS) ?StoredFileDescriptorType { - return this.bytecode_cache_fetcher.fetch(basename, fs); - } - pub fn readCodeAsStringSlow(this: *NodeModuleBundle, allocator: std.mem.Allocator) !string { if (this.code_string) |code| { return code.str; |