aboutsummaryrefslogtreecommitdiff
path: root/src/resolver/dir_info.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolver/dir_info.zig')
-rw-r--r--src/resolver/dir_info.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/resolver/dir_info.zig b/src/resolver/dir_info.zig
index 5d3c53f96..ba108b1b9 100644
--- a/src/resolver/dir_info.zig
+++ b/src/resolver/dir_info.zig
@@ -15,14 +15,22 @@ 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,
+enclosing_package_json: ?*const PackageJSON = null,
+enclosing_tsconfig_json: ?*const TSConfigJSON = 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;