Skip to content

feat: try to parse package.json as jsonc#176

Merged
pi0 merged 5 commits into
mainfrom
feat/pkg-jsonc
Apr 18, 2024
Merged

feat: try to parse package.json as jsonc#176
pi0 merged 5 commits into
mainfrom
feat/pkg-jsonc

Conversation

@pi0

@pi0 pi0 commented Apr 17, 2024

Copy link
Copy Markdown
Member

Context: Bun is going to allow package.json with jsonc format (comments and trailing) tweet

Preparing ecosystem takes time and it will be a chicken or egg problem unless we support foundation for adoption.

This PR adds support for package.json with jsonc format using confbox utils.


Implementation notes:

  • Using fallback approach to avoid any perf penalties. jsonc parser will be only used if parsing as json fails so we don't introduce perf penalties.
  • json5 is not used since is not adopted in toolings at least and is way slower (20x vs 2x)
  • when writing package.json, trailing and comments will be dropped

@pi0 pi0 requested a review from danielroe April 17, 2024 15:33

@danielroe danielroe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

❤️

@pi0 pi0 merged commit 44956cc into main Apr 18, 2024
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