Skip to content

Fix JSON Serialization for source #2864

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

Closed

Conversation

lifeiscontent
Copy link

@lifeiscontent lifeiscontent commented Dec 2, 2020

The Type definitions say that source should be exposed, but when its transformed into JSON its not there.

@lifeiscontent lifeiscontent force-pushed the chore/fix-json-serialization branch from bb146ef to 0fabdba Compare December 2, 2020 22:14
@lifeiscontent
Copy link
Author

@IvanGoncharov is it possible to backport this fix to v14?

@lifeiscontent lifeiscontent force-pushed the chore/fix-json-serialization branch from 0fabdba to 4f49ffb Compare December 3, 2020 00:40
@IvanGoncharov
Copy link
Member

@lifeiscontent Sadly this change will make AST dumps unreadable.
Since every node will include the source.
That's why tests are falling on your PR.

@IvanGoncharov
Copy link
Member

I need to think more about this one.
Also, it would help if someone do research on how other tools store filenames in AST.

@IvanGoncharov IvanGoncharov added this to the post-16.0.0 milestone Jan 4, 2021
@lifeiscontent
Copy link
Author

lifeiscontent commented Jan 4, 2021

@IvanGoncharov I've been working on https://github.com/lifeiscontent/storybook-addon-apollo-client

The only way I've managed to get the formatter to display code consistently is by dynamically injecting babel-plugin-graphql-tag into the storybook runtime to then parse all the code which seems to be including the source as I need (without it, the source is missing as this PR would fix) in order to display it to the user in the panel.

If you have a better suggestion on how to achieve this, please let me know.

Base automatically changed from master to main January 27, 2021 11:10
@lifeiscontent
Copy link
Author

Ping @IvanGoncharov

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