microsoft / graphitation

GraphQL tooling & runtime support needed for MS Teams and beyond
https://microsoft.github.io/graphitation/
MIT License
137 stars 30 forks source link

A fork of graphql-tools/webpack-loader with supermassive SDL encoding support #403

Closed vladar closed 4 months ago

vladar commented 4 months ago

This is a fork of graphql-tools/webpack-loader with one additional option: supermassiveSDL. When set the following SDL file will be exported with supermassive-ready encoding:

Source SDL:

    type Query {
      foo: String
    }

Loader output with supermassiveSDL=true:

    var doc = JSON.parse('[{"types":{"Query":[2,{"foo":1}]}}]');
    module.exports = doc;

When the option is disabled, exported value contains a regular graphql AST. When enabled, the option also doesn't affect graphql operations - they are still exported as AST. Only schema definitions are converted to supermassive encoding.