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, 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); le-telemetry Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/packages/astro/test/fixtures/astro-external-files (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2021-11-19Remove further dependence on vite package (#1906)Gravatar Matthew Phillips 3-5/+9
2021-11-19Version Packages (next) (#1904)astro@0.21.0-next.9Gravatar github-actions[bot] 23-21/+30
2021-11-19Remove OSX \x00 workaround (#1901)Gravatar Matthew Phillips 2-5/+5
2021-11-19Resolve vite client modules to vendored vite (#1903)Gravatar Matthew Phillips 2-2/+7
2021-11-19[ci] yarn formatGravatar matthewp 1-3/+3
2021-11-19Add Debug tests (#1882)Gravatar Matthew Phillips 4-0/+62
2021-11-19[ci] collect statsGravatar FredKSchott 1-0/+1
2021-11-19Version Packages (next) (#1881)astro@0.21.0-next.8@astrojs/renderer-vue@0.2.0-next.2Gravatar github-actions[bot] 25-23/+42
2021-11-18Improve HMR (#1896)Gravatar Drew Powers 2-10/+18
2021-11-18update depsGravatar Fred K. Schott 5-352/+65
2021-11-18fix #1778Gravatar Fred K. Schott 2-1/+8
2021-11-18Update compiler (#1869)Gravatar Nate Moore 3-11/+6
2021-11-18remove unused remark dependency (#1894)Gravatar Fred K. Schott 2-245/+13
2021-11-18Improve error messages (#1875)Gravatar Drew Powers 39-61/+448
2021-11-18pin astro compiler to older versionGravatar Fred K. Schott 2-5/+5
2021-11-18Update yarn.lock to reflect the state of the package.json files (#1892)Gravatar Jonathan Neal 5-1300/+1000
2021-11-19[ci] yarn formatGravatar FredKSchott 1-5/+3