Skip to content

fix: use original JSON for raw JSON AST display#101

Merged
sxzz merged 1 commit intomainfrom
05-07-fix_use_original_json_for_raw_json_ast_display
May 7, 2025
Merged

fix: use original JSON for raw JSON AST display#101
sxzz merged 1 commit intomainfrom
05-07-fix_use_original_json_for_raw_json_ast_display

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 7, 2025

Currently display of AST as raw JSON crashes if the AST contains a BigInt. This is because currently the display uses JSON.stringify on the AST Object, and JSON.stringify throws if it encounters a BigInt.

Instead, use the original JSON produced by Oxc, and avoid stringifying.

Depends on oxc-project/oxc#10869. That needs to be merged first.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

@sxzz sxzz merged commit 6e56398 into main May 7, 2025
6 checks passed
@sxzz sxzz deleted the 05-07-fix_use_original_json_for_raw_json_ast_display branch May 7, 2025 14:45
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
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