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

inline graphql-js' printer #4692

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

cometkim
Copy link

@cometkim cometkim commented May 4, 2024

See #3628 and #4226

@captbaritone
Copy link
Contributor

This seems sensible to me. Feel free to ping me when this diff is ready for review (I see it's still marked as Draft).

@captbaritone
Copy link
Contributor

I wonder if there's a sensible way to add some tests which assert that the compiler and this code arrive at the same hash?

@cometkim
Copy link
Author

cometkim commented May 8, 2024

That's is easy if we can run the printer standalone. Or, it would be ideal to publish to NPM and directly use its WASM or NAPI distribution

@cometkim
Copy link
Author

Workaround: Commit md5 hashes for all the fixtures in the graphql-text-printer crate test suite. Then we can compare it when running the babel plugin tests.

@cometkim cometkim force-pushed the js-printer branch 3 times, most recently from 8df33f3 to cd480da Compare May 13, 2024 18:15
@cometkim
Copy link
Author

@captbaritone I added idempotency testing using compiler-side fixtures. Fixed 4 failures related to spaces between multiple definitions and it all passes.

@cometkim cometkim marked this pull request as ready for review May 13, 2024 18:21
return fixtures;
}

function parsePrintFixture(name: string, content: string): PrinterFixture {
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this. Brilliant solution. When I merge I think I'll add a note in the Rust tests so that people know the fixtures are serving double duty.

@facebook-github-bot
Copy link
Contributor

@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

cometkim added a commit to cometkim/vite-plugin-relay-lite that referenced this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants