Skip to content

Conversation

tornqvist
Copy link
Member

@tornqvist tornqvist commented Nov 5, 2020

This is quite the rewrite and I'm fully aware it may not be well received. I was about to create something along the lines of nanographql before I knew it even existed. But as I started looking into parsing GraphQL queries with RegExp I realized we can do much more than just deriving the operation name. This did however bring a significant increase in size, from 15 LOC to ~200, so it may not be legitimately "nano" anymore.

Since I'm not currently a user of nanographql I'd really appreciate some feedback from people using it. If the changes are not welcome I'll just publish it under a different name. Alternately, the cache and fetching bits could be split out to another package, e.g. choo-graphql or something. However, these changes do address all issues and PRs currently open in this project.

These changes address:

  • Expressions: strings, and even other queries (fragments), can be interpolated to create dynamic queries (Expressions support #1)
  • Inspection: the return value from a query is an object with methods to serialize it in many different ways (toString, toJSON) and even iterate over its properties (variables must be a object #7)
  • Fragments: fragments are supported and can even be interpolated from other queries (support fragment? #8)
  • Caching: results are cached per query, which allows for maintaining state between queries and mutations (What about some cache mechanism? #11)
  • Update standard: standard recently introduced the no-var rule in a major update

See README for complete documentation of new functionality.

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.

1 participant