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

Replicate the "main": false patch from Parcel #300

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

benjervis
Copy link
Contributor

Unfortunately, this ecosystem pollution has spread to our world as well, and we've inherited Parcel's problem of not parsing the main field as a boolean.

This PR just replicates Devon's patch into Atlaspack, including his test.

@benjervis benjervis requested a review from a team January 6, 2025 00:09
@benjervis benjervis merged commit 42c8597 into main Jan 6, 2025
17 checks passed
@benjervis benjervis deleted the add-support-for-main-false branch January 6, 2025 01:55
@yamadapc
Copy link
Contributor

yamadapc commented Jan 7, 2025

I think we should consider treating main specifically rather than adding catch-all ok_or_default to the fields.

With this change the following invalid package.json will get parsed:

    let pkg: PackageJson = serde_json::from_str(r#"{"name":1234}"#).unwrap();
    assert_eq!(pkg.name, "");

name will be set to "" which is not a really semantically valid value, a similar problem will happen for the other fields.

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.

3 participants