Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return error for invalid exports #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

littledivy
Copy link
Member

@littledivy
Copy link
Member Author

cc @dsherret

(btw i dont have write access to repo)

@littledivy
Copy link
Member Author

littledivy commented Oct 5, 2024

thoughts on merging this crate into deno_config? a change to this crate has to go through 3 PRs (deno_package_json -> deno_config -> deno) to make it into Deno

@@ -59,6 +59,8 @@ pub enum PackageJsonLoadError {
#[source]
source: serde_json::Error,
},
#[error("\"exports\" cannot contains some keys starting with '.' and some not.\nThe exports object must either be an object of package subpath keys\nor an object of main entry condition name keys only.")]
InvalidExports,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we want to do this here. Isn't this error already surfaced during resolution?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it's currently a panic lol

@dsherret
Copy link
Member

dsherret commented Oct 5, 2024

thoughts on merging this crate into deno_config

It's very rare to update this crate and this is used without deno_config in node_resolver. Maybe if we updated the deno_config repo to be able to publish multiple crates, but I think it's not worth the effort atm.

@dsherret dsherret changed the title Return error for invalid exports fix: return error for invalid exports Oct 5, 2024
@littledivy
Copy link
Member Author

@dsherret PTAL

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we investigate shifting this to be done only when resolving the exports? That way we can load invalid package.json files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants