usingnamespace @import("../global.zig"); const allocators = @import("../allocators.zig"); const DirInfo = @This(); const Fs = @import("../fs.zig"); const TSConfigJSON = @import("./tsconfig_json.zig").TSConfigJSON; const PackageJSON = @import("./package_json.zig").PackageJSON; pub const Index = allocators.IndexType; // These objects are immutable, so we can just point to the parent directory // and avoid having to lock the cache again parent: Index = allocators.NotFound, // A pointer to the enclosing dirInfo with a valid "browser" field in // package.json. We need this to remap paths after they have been resolved. enclosing_browser_scope: Index = allocators.NotFound, package_json_for_browser_field: ?*const PackageJSON = null, enclosing_tsconfig_json: ?*const TSConfigJSON = null, /// package.json used for bundling /// it's the deepest one in the hierarchy with a "name" field enclosing_package_json: ?*PackageJSON = null, abs_path: string = "", entries: Index = undefined, has_node_modules: bool = false, // Is there a "node_modules" subdirectory? is_node_modules: bool = false, // Is this a "node_modules" directory? package_json: ?*PackageJSON = null, // Is there a "package.json" file? tsconfig_json: ?*TSConfigJSON = null, // Is there a "tsconfig.json" file in this directory or a parent directory? abs_real_path: string = "", // If non-empty, this is the real absolute path resolving any symlinks pub fn hasParentPackage(this: *const DirInfo) bool { const parent = this.getParent() orelse return false; return !parent.is_node_modules; } pub fn getFileDescriptor(dirinfo: *const DirInfo) StoredFileDescriptorType { if (!FeatureFlags.store_file_descriptors) { return 0; } if (dirinfo.getEntries()) |entries| { return entries.fd; } else { return 0; } } pub fn getEntries(dirinfo: *const DirInfo) ?*Fs.FileSystem.DirEntry { var entries_ptr = Fs.FileSystem.instance.fs.entries.atIndex(dirinfo.entries) orelse return null; switch (entries_ptr.*) { .entries => |entr| { return &entries_ptr.entries; }, .err => { return null; }, } } pub fn getEntriesConst(dirinfo: *const DirInfo) ?*const Fs.FileSystem.DirEntry { const entries_ptr = Fs.FileSystem.instance.fs.entries.atIndex(dirinfo.entries) orelse return null; switch (entries_ptr.*) { .entries => |entr| { return &entries_ptr.entries; }, .err => { return null; }, } } pub fn getParent(i: *const DirInfo) ?*DirInfo { return HashMap.instance.atIndex(i.parent); } pub fn getEnclosingBrowserScope(i: *const DirInfo) ?*DirInfo { return HashMap.instance.atIndex(i.enclosing_browser_scope); } // Goal: Really fast, low allocation directory map exploiting cache locality where we don't worry about lifetimes much. // 1. Don't store the keys or values of directories that don't exist // 2. Don't expect a provided key to exist after it's queried // 3. Store whether a directory has been queried and whether that query was successful. // 4. Allocate onto the https://en.wikipedia.org/wiki/.bss#BSS_in_C instead of the heap, so we can avoid memory leaks pub const HashMap = allocators.BSSMap(DirInfo, Fs.Preallocate.Counts.dir_entry, false, 128, true); ion> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/integration/snippets/styledcomponents-output.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-01-05Fix crash that sometimes happens after 30 secondsGravatar Jarred Sumner 5-106/+185
2022-01-05[bun bun][bun dev] Fix crash affecting large projectsGravatar Jarred Sumner 1-26/+119
2022-01-05move some code aroundGravatar Jarred Sumner 2-281/+284
2022-01-05we want the opposite of thisGravatar Jarred Sumner 1-1/+0
2022-01-05[JS Parser] Reduce memory usage by ~8%Gravatar Jarred Sumner 6-7/+42
2022-01-05minimal integration tests for macrosGravatar Jarred Sumner 4-0/+47
2022-01-05Update resolver.zigGravatar Jarred Sumner 1-3/+0
2022-01-05Update options.zigGravatar Jarred Sumner 1-2/+25
2022-01-05Update http.zigGravatar Jarred Sumner 1-1/+1
2022-01-05Add module condition to the node platform (#104)Gravatar Mateusz Burzyński 1-1/+4
2022-01-05Drop redundant comments (#103)Gravatar Mateusz Burzyński 1-23/+0
2022-01-05Tweak default main fields for the bun platform to match other popular bundler...Gravatar Mateusz Burzyński 1-10/+7
2022-01-04:skull: dead codeGravatar Jarred Sumner 1-13/+0
2022-01-04[bun dev] Print error in status line textGravatar Jarred Sumner 1-3/+13
2022-01-04noramlize some errorsGravatar Jarred Sumner 3-3/+4
2022-01-04[Bun.js][bun dev] Support macros inside of Bun.jsGravatar Jarred Sumner 5-51/+103
2022-01-04[bun bun] Fix error when regenerating node_modules.bun after moving itGravatar Jarred Sumner 1-1/+17
2022-01-04Improve how we detect if terminal colors are supportedGravatar Jarred Sumner 3-11/+66
2022-01-04Improve error handling when out of file handlesGravatar Jarred Sumner 5-58/+248
2022-01-04Update build-idGravatar Jarred Sumner 1-1/+1
2022-01-04Downgrade mimalloc due to crashesGravatar Jarred Sumner 1-0/+0
2022-01-04Upload compressed `.dSYM` for every releaseGravatar Jarred Sumner 2-4/+34
2022-01-04Update .gitignoreGravatar Jarred Sumner 1-0/+3
2022-01-04[bun install] Fix more cases where bytes are printed instead of stringsGravatar Jarred Sumner 1-10/+38
2022-01-04minor perf optimization: remove this loop on macOSGravatar Jarred Sumner 2-4/+8
2022-01-03Update crash_reporter_linux.zigbun-v0.0.66Gravatar Jarred Sumner 1-1/+1
2022-01-03:confused:Gravatar Jarred Sumner 5-0/+1
2022-01-03:nail_care:Gravatar Jarred Sumner 3-1652/+1826
2022-01-03Update crash_reporter_linux.zigGravatar Jarred Sumner 1-1/+1
2022-01-03Update PLCrashReport.mGravatar Jarred Sumner 1-1/+1
2022-01-03Update PLCrashReport.mGravatar Jarred Sumner 1-2/+1
2022-01-03:lock:Gravatar Jarred Sumner 4-1/+1
2022-01-03dead codeGravatar Jarred Sumner 13-1881/+1660