aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-22 02:17:13 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-22 02:17:13 -0700
commit53c0a4b5685908abc2f8ebdfa511925edb6b4110 (patch)
treebe5064791ed5544013c78dba3be22cdd850d0441
parent8f460a9be3d954d6be555d1bcd382383d23d9280 (diff)
downloadbun-jarred/exports-map.tar.gz
bun-jarred/exports-map.tar.zst
bun-jarred/exports-map.zip
Add disabled status to ESM resolutionjarred/exports-map
-rw-r--r--src/resolver/package_json.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/resolver/package_json.zig b/src/resolver/package_json.zig
index d98784c2b..fa8603569 100644
--- a/src/resolver/package_json.zig
+++ b/src/resolver/package_json.zig
@@ -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| {