fix: use original JSON for raw JSON AST display#101
Merged
Conversation
Contributor
sxzz
approved these changes
May 7, 2025
graphite-app bot
pushed a commit
to oxc-project/oxc
that referenced
this pull request
May 7, 2025
…on separate lines (#10869) #10820 changed how `BigInt`s and `RegExp`s are fixed in ESTree AST on JS side. It adds a list of fix paths to the end of the JSON. Add line breaks after the inserted header, and before the inserted footer. This will allow playground to easily trim off the header and footer and display the raw JSON instead of converting the AST Object back to JSON with `JSON.stringify`. oxc-project/playground#101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Currently display of AST as raw JSON crashes if the AST contains a
BigInt. This is because currently the display usesJSON.stringifyon the AST Object, andJSON.stringifythrows if it encounters aBigInt.Instead, use the original JSON produced by Oxc, and avoid stringifying.
Depends on oxc-project/oxc#10869. That needs to be merged first.