1 | /**
|
2 | * This module only exists because as of this writing, `graphql-tag` doesn't
|
3 | * support type, field, or argument descriptions. That's a bummer, so this
|
4 | * simple tag is provided instead. It doesn't support any type of interpolation
|
5 | * whatsoever, but will parse the GraphQL document, allow syntax highlighting,
|
6 | * and enable Prettier formatting.
|
7 | */
|
8 | import { parse } from 'graphql'
|
9 |
|
10 | export default function gql(literals, ...interpolations) {
|
11 | if (literals.length !== 1 || interpolations.length) {
|
12 | throw new Error('The gql template tag does not support interpolation.')
|
13 | }
|
14 | return parse(literals[0])
|
15 | }
|