Add disabled status to ESM resolution

This commit is contained in:
Jarred Sumner
2021-09-22 02:17:13 -07:00
parent 8f460a9be3
commit 53c0a4b568

View File

@@ -886,6 +886,9 @@ pub const ESModule = struct {
// The resolved path corresponds to a directory, which is not a supported target for module imports.
UnsupportedDirectoryImport,
// When a package path is explicitly set to null, that means it's not exported.
PackagePathDisabled,
pub inline fn isUndefined(this: Status) bool {
return switch (this) {
.Undefined, .UndefinedNoConditionsMatch => true,
@@ -1022,6 +1025,10 @@ pub const ESModule = struct {
if (result.status != .Null and result.status != .Undefined) {
return result;
}
if (result.status == .Null) {
return Resolution{ .status = .PackagePathDisabled, .debug = .{ .token = exports.first_token } };
}
}
if (r.debug_logs) |logs| {