UNPKG

@0no-co/graphqlsp

Version:

TypeScript LSP plugin that finds GraphQL documents in your code and provides hints and auto-generates types.

1 lines 283 kB
{"version":3,"file":"api-chunk.mjs","sources":["../../src/ts/index.js","../../../../node_modules/.pnpm/graphql-language-service@5.2.0_graphql@16.8.1/node_modules/graphql-language-service/esm/parser/CharacterStream.js","../../../../node_modules/.pnpm/graphql-language-service@5.2.0_graphql@16.8.1/node_modules/graphql-language-service/esm/parser/RuleHelpers.js","../../../../node_modules/.pnpm/graphql-language-service@5.2.0_graphql@16.8.1/node_modules/graphql-language-service/esm/parser/Rules.js","../../../../node_modules/.pnpm/graphql-language-service@5.2.0_graphql@16.8.1/node_modules/graphql-language-service/esm/parser/onlineParser.js","../../../../node_modules/.pnpm/graphql-language-service@5.2.0_graphql@16.8.1/node_modules/graphql-language-service/esm/utils/Range.js","../../../../node_modules/.pnpm/graphql-language-service@5.2.0_graphql@16.8.1/node_modules/graphql-language-service/esm/utils/validateWithCustomRules.js","../../../../node_modules/.pnpm/graphql-language-service@5.2.0_graphql@16.8.1/node_modules/graphql-language-service/esm/interface/getDiagnostics.js","../../../../node_modules/.pnpm/@0no-co+graphql.web@1.0.4_graphql@16.8.1/node_modules/@0no-co/graphql.web/dist/graphql.web.mjs","../../src/ast/templates.ts","../../src/ast/checks.ts","../../src/ast/declaration.ts","../../src/ast/resolve.ts","../../src/ast/index.ts","../../../../node_modules/.pnpm/lru-cache@10.0.1/node_modules/lru-cache/dist/mjs/index.js","../../../../node_modules/.pnpm/@sindresorhus+fnv1a@2.0.0/node_modules/@sindresorhus/fnv1a/index.js","../../src/fieldUsage.ts","../../src/checkImports.ts","../../src/persisted.ts","../../src/diagnostics.ts"],"sourcesContent":["export var ts;\nexport function init(modules) {\n ts = modules.typescript;\n}\n","export default class CharacterStream {\n constructor(sourceText) {\n this._start = 0;\n this._pos = 0;\n this.getStartOfToken = () => this._start;\n this.getCurrentPosition = () => this._pos;\n this.eol = () => this._sourceText.length === this._pos;\n this.sol = () => this._pos === 0;\n this.peek = () => {\n return this._sourceText.charAt(this._pos) || null;\n };\n this.next = () => {\n const char = this._sourceText.charAt(this._pos);\n this._pos++;\n return char;\n };\n this.eat = (pattern) => {\n const isMatched = this._testNextCharacter(pattern);\n if (isMatched) {\n this._start = this._pos;\n this._pos++;\n return this._sourceText.charAt(this._pos - 1);\n }\n return undefined;\n };\n this.eatWhile = (match) => {\n let isMatched = this._testNextCharacter(match);\n let didEat = false;\n if (isMatched) {\n didEat = isMatched;\n this._start = this._pos;\n }\n while (isMatched) {\n this._pos++;\n isMatched = this._testNextCharacter(match);\n didEat = true;\n }\n return didEat;\n };\n this.eatSpace = () => this.eatWhile(/[\\s\\u00a0]/);\n this.skipToEnd = () => {\n this._pos = this._sourceText.length;\n };\n this.skipTo = (position) => {\n this._pos = position;\n };\n this.match = (pattern, consume = true, caseFold = false) => {\n let token = null;\n let match = null;\n if (typeof pattern === 'string') {\n const regex = new RegExp(pattern, caseFold ? 'i' : 'g');\n match = regex.test(this._sourceText.slice(this._pos, this._pos + pattern.length));\n token = pattern;\n }\n else if (pattern instanceof RegExp) {\n match = this._sourceText.slice(this._pos).match(pattern);\n token = match === null || match === void 0 ? void 0 : match[0];\n }\n if (match != null &&\n (typeof pattern === 'string' ||\n (match instanceof Array &&\n this._sourceText.startsWith(match[0], this._pos)))) {\n if (consume) {\n this._start = this._pos;\n if (token && token.length) {\n this._pos += token.length;\n }\n }\n return match;\n }\n return false;\n };\n this.backUp = (num) => {\n this._pos -= num;\n };\n this.column = () => this._pos;\n this.indentation = () => {\n const match = this._sourceText.match(/\\s*/);\n let indent = 0;\n if (match && match.length !== 0) {\n const whiteSpaces = match[0];\n let pos = 0;\n while (whiteSpaces.length > pos) {\n if (whiteSpaces.charCodeAt(pos) === 9) {\n indent += 2;\n }\n else {\n indent++;\n }\n pos++;\n }\n }\n return indent;\n };\n this.current = () => this._sourceText.slice(this._start, this._pos);\n this._sourceText = sourceText;\n }\n _testNextCharacter(pattern) {\n const character = this._sourceText.charAt(this._pos);\n let isMatched = false;\n if (typeof pattern === 'string') {\n isMatched = character === pattern;\n }\n else {\n isMatched =\n pattern instanceof RegExp\n ? pattern.test(character)\n : pattern(character);\n }\n return isMatched;\n }\n}\n//# sourceMappingURL=CharacterStream.js.map","export function opt(ofRule) {\n return { ofRule };\n}\nexport function list(ofRule, separator) {\n return { ofRule, isList: true, separator };\n}\nexport function butNot(rule, exclusions) {\n const ruleMatch = rule.match;\n rule.match = token => {\n let check = false;\n if (ruleMatch) {\n check = ruleMatch(token);\n }\n return (check &&\n exclusions.every(exclusion => exclusion.match && !exclusion.match(token)));\n };\n return rule;\n}\nexport function t(kind, style) {\n return { style, match: (token) => token.kind === kind };\n}\nexport function p(value, style) {\n return {\n style: style || 'punctuation',\n match: (token) => token.kind === 'Punctuation' && token.value === value,\n };\n}\n//# sourceMappingURL=RuleHelpers.js.map","import { opt, list, butNot, t, p } from './RuleHelpers';\nimport { Kind } from 'graphql';\nexport const isIgnored = (ch) => ch === ' ' ||\n ch === '\\t' ||\n ch === ',' ||\n ch === '\\n' ||\n ch === '\\r' ||\n ch === '\\uFEFF' ||\n ch === '\\u00A0';\nexport const LexRules = {\n Name: /^[_A-Za-z][_0-9A-Za-z]*/,\n Punctuation: /^(?:!|\\$|\\(|\\)|\\.\\.\\.|:|=|&|@|\\[|]|\\{|\\||\\})/,\n Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,\n String: /^(?:\"\"\"(?:\\\\\"\"\"|[^\"]|\"[^\"]|\"\"[^\"])*(?:\"\"\")?|\"(?:[^\"\\\\]|\\\\(?:\"|\\/|\\\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*\"?)/,\n Comment: /^#.*/,\n};\nexport const ParseRules = {\n Document: [list('Definition')],\n Definition(token) {\n switch (token.value) {\n case '{':\n return 'ShortQuery';\n case 'query':\n return 'Query';\n case 'mutation':\n return 'Mutation';\n case 'subscription':\n return 'Subscription';\n case 'fragment':\n return Kind.FRAGMENT_DEFINITION;\n case 'schema':\n return 'SchemaDef';\n case 'scalar':\n return 'ScalarDef';\n case 'type':\n return 'ObjectTypeDef';\n case 'interface':\n return 'InterfaceDef';\n case 'union':\n return 'UnionDef';\n case 'enum':\n return 'EnumDef';\n case 'input':\n return 'InputDef';\n case 'extend':\n return 'ExtendDef';\n case 'directive':\n return 'DirectiveDef';\n }\n },\n ShortQuery: ['SelectionSet'],\n Query: [\n word('query'),\n opt(name('def')),\n opt('VariableDefinitions'),\n list('Directive'),\n 'SelectionSet',\n ],\n Mutation: [\n word('mutation'),\n opt(name('def')),\n opt('VariableDefinitions'),\n list('Directive'),\n 'SelectionSet',\n ],\n Subscription: [\n word('subscription'),\n opt(name('def')),\n opt('VariableDefinitions'),\n list('Directive'),\n 'SelectionSet',\n ],\n VariableDefinitions: [p('('), list('VariableDefinition'), p(')')],\n VariableDefinition: ['Variable', p(':'), 'Type', opt('DefaultValue')],\n Variable: [p('$', 'variable'), name('variable')],\n DefaultValue: [p('='), 'Value'],\n SelectionSet: [p('{'), list('Selection'), p('}')],\n Selection(token, stream) {\n return token.value === '...'\n ? stream.match(/[\\s\\u00a0,]*(on\\b|@|{)/, false)\n ? 'InlineFragment'\n : 'FragmentSpread'\n : stream.match(/[\\s\\u00a0,]*:/, false)\n ? 'AliasedField'\n : 'Field';\n },\n AliasedField: [\n name('property'),\n p(':'),\n name('qualifier'),\n opt('Arguments'),\n list('Directive'),\n opt('SelectionSet'),\n ],\n Field: [\n name('property'),\n opt('Arguments'),\n list('Directive'),\n opt('SelectionSet'),\n ],\n Arguments: [p('('), list('Argument'), p(')')],\n Argument: [name('attribute'), p(':'), 'Value'],\n FragmentSpread: [p('...'), name('def'), list('Directive')],\n InlineFragment: [\n p('...'),\n opt('TypeCondition'),\n list('Directive'),\n 'SelectionSet',\n ],\n FragmentDefinition: [\n word('fragment'),\n opt(butNot(name('def'), [word('on')])),\n 'TypeCondition',\n list('Directive'),\n 'SelectionSet',\n ],\n TypeCondition: [word('on'), 'NamedType'],\n Value(token) {\n switch (token.kind) {\n case 'Number':\n return 'NumberValue';\n case 'String':\n return 'StringValue';\n case 'Punctuation':\n switch (token.value) {\n case '[':\n return 'ListValue';\n case '{':\n return 'ObjectValue';\n case '$':\n return 'Variable';\n case '&':\n return 'NamedType';\n }\n return null;\n case 'Name':\n switch (token.value) {\n case 'true':\n case 'false':\n return 'BooleanValue';\n }\n if (token.value === 'null') {\n return 'NullValue';\n }\n return 'EnumValue';\n }\n },\n NumberValue: [t('Number', 'number')],\n StringValue: [\n {\n style: 'string',\n match: (token) => token.kind === 'String',\n update(state, token) {\n if (token.value.startsWith('\"\"\"')) {\n state.inBlockstring = !token.value.slice(3).endsWith('\"\"\"');\n }\n },\n },\n ],\n BooleanValue: [t('Name', 'builtin')],\n NullValue: [t('Name', 'keyword')],\n EnumValue: [name('string-2')],\n ListValue: [p('['), list('Value'), p(']')],\n ObjectValue: [p('{'), list('ObjectField'), p('}')],\n ObjectField: [name('attribute'), p(':'), 'Value'],\n Type(token) {\n return token.value === '[' ? 'ListType' : 'NonNullType';\n },\n ListType: [p('['), 'Type', p(']'), opt(p('!'))],\n NonNullType: ['NamedType', opt(p('!'))],\n NamedType: [type('atom')],\n Directive: [p('@', 'meta'), name('meta'), opt('Arguments')],\n DirectiveDef: [\n word('directive'),\n p('@', 'meta'),\n name('meta'),\n opt('ArgumentsDef'),\n word('on'),\n list('DirectiveLocation', p('|')),\n ],\n InterfaceDef: [\n word('interface'),\n name('atom'),\n opt('Implements'),\n list('Directive'),\n p('{'),\n list('FieldDef'),\n p('}'),\n ],\n Implements: [word('implements'), list('NamedType', p('&'))],\n DirectiveLocation: [name('string-2')],\n SchemaDef: [\n word('schema'),\n list('Directive'),\n p('{'),\n list('OperationTypeDef'),\n p('}'),\n ],\n OperationTypeDef: [name('keyword'), p(':'), name('atom')],\n ScalarDef: [word('scalar'), name('atom'), list('Directive')],\n ObjectTypeDef: [\n word('type'),\n name('atom'),\n opt('Implements'),\n list('Directive'),\n p('{'),\n list('FieldDef'),\n p('}'),\n ],\n FieldDef: [\n name('property'),\n opt('ArgumentsDef'),\n p(':'),\n 'Type',\n list('Directive'),\n ],\n ArgumentsDef: [p('('), list('InputValueDef'), p(')')],\n InputValueDef: [\n name('attribute'),\n p(':'),\n 'Type',\n opt('DefaultValue'),\n list('Directive'),\n ],\n UnionDef: [\n word('union'),\n name('atom'),\n list('Directive'),\n p('='),\n list('UnionMember', p('|')),\n ],\n UnionMember: ['NamedType'],\n EnumDef: [\n word('enum'),\n name('atom'),\n list('Directive'),\n p('{'),\n list('EnumValueDef'),\n p('}'),\n ],\n EnumValueDef: [name('string-2'), list('Directive')],\n InputDef: [\n word('input'),\n name('atom'),\n list('Directive'),\n p('{'),\n list('InputValueDef'),\n p('}'),\n ],\n ExtendDef: [word('extend'), 'ExtensionDefinition'],\n ExtensionDefinition(token) {\n switch (token.value) {\n case 'schema':\n return Kind.SCHEMA_EXTENSION;\n case 'scalar':\n return Kind.SCALAR_TYPE_EXTENSION;\n case 'type':\n return Kind.OBJECT_TYPE_EXTENSION;\n case 'interface':\n return Kind.INTERFACE_TYPE_EXTENSION;\n case 'union':\n return Kind.UNION_TYPE_EXTENSION;\n case 'enum':\n return Kind.ENUM_TYPE_EXTENSION;\n case 'input':\n return Kind.INPUT_OBJECT_TYPE_EXTENSION;\n }\n },\n [Kind.SCHEMA_EXTENSION]: ['SchemaDef'],\n [Kind.SCALAR_TYPE_EXTENSION]: ['ScalarDef'],\n [Kind.OBJECT_TYPE_EXTENSION]: ['ObjectTypeDef'],\n [Kind.INTERFACE_TYPE_EXTENSION]: ['InterfaceDef'],\n [Kind.UNION_TYPE_EXTENSION]: ['UnionDef'],\n [Kind.ENUM_TYPE_EXTENSION]: ['EnumDef'],\n [Kind.INPUT_OBJECT_TYPE_EXTENSION]: ['InputDef'],\n};\nfunction word(value) {\n return {\n style: 'keyword',\n match: (token) => token.kind === 'Name' && token.value === value,\n };\n}\nfunction name(style) {\n return {\n style,\n match: (token) => token.kind === 'Name',\n update(state, token) {\n state.name = token.value;\n },\n };\n}\nfunction type(style) {\n return {\n style,\n match: (token) => token.kind === 'Name',\n update(state, token) {\n var _a;\n if ((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.prevState) {\n state.name = token.value;\n state.prevState.prevState.type = token.value;\n }\n },\n };\n}\n//# sourceMappingURL=Rules.js.map","import { LexRules, ParseRules, isIgnored } from './Rules';\nimport { Kind } from 'graphql';\nexport default function onlineParser(options = {\n eatWhitespace: stream => stream.eatWhile(isIgnored),\n lexRules: LexRules,\n parseRules: ParseRules,\n editorConfig: {},\n}) {\n return {\n startState() {\n const initialState = {\n level: 0,\n step: 0,\n name: null,\n kind: null,\n type: null,\n rule: null,\n needsSeparator: false,\n prevState: null,\n };\n pushRule(options.parseRules, initialState, Kind.DOCUMENT);\n return initialState;\n },\n token(stream, state) {\n return getToken(stream, state, options);\n },\n };\n}\nfunction getToken(stream, state, options) {\n var _a;\n if (state.inBlockstring) {\n if (stream.match(/.*\"\"\"/)) {\n state.inBlockstring = false;\n return 'string';\n }\n stream.skipToEnd();\n return 'string';\n }\n const { lexRules, parseRules, eatWhitespace, editorConfig } = options;\n if (state.rule && state.rule.length === 0) {\n popRule(state);\n }\n else if (state.needsAdvance) {\n state.needsAdvance = false;\n advanceRule(state, true);\n }\n if (stream.sol()) {\n const tabSize = (editorConfig === null || editorConfig === void 0 ? void 0 : editorConfig.tabSize) || 2;\n state.indentLevel = Math.floor(stream.indentation() / tabSize);\n }\n if (eatWhitespace(stream)) {\n return 'ws';\n }\n const token = lex(lexRules, stream);\n if (!token) {\n const matchedSomething = stream.match(/\\S+/);\n if (!matchedSomething) {\n stream.match(/\\s/);\n }\n pushRule(SpecialParseRules, state, 'Invalid');\n return 'invalidchar';\n }\n if (token.kind === 'Comment') {\n pushRule(SpecialParseRules, state, 'Comment');\n return 'comment';\n }\n const backupState = assign({}, state);\n if (token.kind === 'Punctuation') {\n if (/^[{([]/.test(token.value)) {\n if (state.indentLevel !== undefined) {\n state.levels = (state.levels || []).concat(state.indentLevel + 1);\n }\n }\n else if (/^[})\\]]/.test(token.value)) {\n const levels = (state.levels = (state.levels || []).slice(0, -1));\n if (state.indentLevel &&\n levels.length > 0 &&\n levels.at(-1) < state.indentLevel) {\n state.indentLevel = levels.at(-1);\n }\n }\n }\n while (state.rule) {\n let expected = typeof state.rule === 'function'\n ? state.step === 0\n ? state.rule(token, stream)\n : null\n : state.rule[state.step];\n if (state.needsSeparator) {\n expected = expected === null || expected === void 0 ? void 0 : expected.separator;\n }\n if (expected) {\n if (expected.ofRule) {\n expected = expected.ofRule;\n }\n if (typeof expected === 'string') {\n pushRule(parseRules, state, expected);\n continue;\n }\n if ((_a = expected.match) === null || _a === void 0 ? void 0 : _a.call(expected, token)) {\n if (expected.update) {\n expected.update(state, token);\n }\n if (token.kind === 'Punctuation') {\n advanceRule(state, true);\n }\n else {\n state.needsAdvance = true;\n }\n return expected.style;\n }\n }\n unsuccessful(state);\n }\n assign(state, backupState);\n pushRule(SpecialParseRules, state, 'Invalid');\n return 'invalidchar';\n}\nfunction assign(to, from) {\n const keys = Object.keys(from);\n for (let i = 0; i < keys.length; i++) {\n to[keys[i]] = from[keys[i]];\n }\n return to;\n}\nconst SpecialParseRules = {\n Invalid: [],\n Comment: [],\n};\nfunction pushRule(rules, state, ruleKind) {\n if (!rules[ruleKind]) {\n throw new TypeError('Unknown rule: ' + ruleKind);\n }\n state.prevState = Object.assign({}, state);\n state.kind = ruleKind;\n state.name = null;\n state.type = null;\n state.rule = rules[ruleKind];\n state.step = 0;\n state.needsSeparator = false;\n}\nfunction popRule(state) {\n if (!state.prevState) {\n return;\n }\n state.kind = state.prevState.kind;\n state.name = state.prevState.name;\n state.type = state.prevState.type;\n state.rule = state.prevState.rule;\n state.step = state.prevState.step;\n state.needsSeparator = state.prevState.needsSeparator;\n state.prevState = state.prevState.prevState;\n}\nfunction advanceRule(state, successful) {\n var _a;\n if (isList(state) && state.rule) {\n const step = state.rule[state.step];\n if (step.separator) {\n const { separator } = step;\n state.needsSeparator = !state.needsSeparator;\n if (!state.needsSeparator && separator.ofRule) {\n return;\n }\n }\n if (successful) {\n return;\n }\n }\n state.needsSeparator = false;\n state.step++;\n while (state.rule &&\n !(Array.isArray(state.rule) && state.step < state.rule.length)) {\n popRule(state);\n if (state.rule) {\n if (isList(state)) {\n if ((_a = state.rule) === null || _a === void 0 ? void 0 : _a[state.step].separator) {\n state.needsSeparator = !state.needsSeparator;\n }\n }\n else {\n state.needsSeparator = false;\n state.step++;\n }\n }\n }\n}\nfunction isList(state) {\n const step = Array.isArray(state.rule) &&\n typeof state.rule[state.step] !== 'string' &&\n state.rule[state.step];\n return step && step.isList;\n}\nfunction unsuccessful(state) {\n while (state.rule &&\n !(Array.isArray(state.rule) && state.rule[state.step].ofRule)) {\n popRule(state);\n }\n if (state.rule) {\n advanceRule(state, false);\n }\n}\nfunction lex(lexRules, stream) {\n const kinds = Object.keys(lexRules);\n for (let i = 0; i < kinds.length; i++) {\n const match = stream.match(lexRules[kinds[i]]);\n if (match && match instanceof Array) {\n return { kind: kinds[i], value: match[0] };\n }\n }\n}\n//# sourceMappingURL=onlineParser.js.map","export class Range {\n constructor(start, end) {\n this.containsPosition = (position) => {\n if (this.start.line === position.line) {\n return this.start.character <= position.character;\n }\n if (this.end.line === position.line) {\n return this.end.character >= position.character;\n }\n return this.start.line <= position.line && this.end.line >= position.line;\n };\n this.start = start;\n this.end = end;\n }\n setStart(line, character) {\n this.start = new Position(line, character);\n }\n setEnd(line, character) {\n this.end = new Position(line, character);\n }\n}\nexport class Position {\n constructor(line, character) {\n this.lessThanOrEqualTo = (position) => this.line < position.line ||\n (this.line === position.line && this.character <= position.character);\n this.line = line;\n this.character = character;\n }\n setLine(line) {\n this.line = line;\n }\n setCharacter(character) {\n this.character = character;\n }\n}\nexport function offsetToPosition(text, loc) {\n const EOL = '\\n';\n const buf = text.slice(0, loc);\n const lines = buf.split(EOL).length - 1;\n const lastLineIndex = buf.lastIndexOf(EOL);\n return new Position(lines, loc - lastLineIndex - 1);\n}\nexport function locToRange(text, loc) {\n const start = offsetToPosition(text, loc.start);\n const end = offsetToPosition(text, loc.end);\n return new Range(start, end);\n}\n//# sourceMappingURL=Range.js.map","import { specifiedRules, validate, NoUnusedFragmentsRule, KnownFragmentNamesRule, Kind, ExecutableDefinitionsRule, LoneSchemaDefinitionRule, UniqueOperationTypesRule, UniqueTypeNamesRule, UniqueEnumValueNamesRule, UniqueFieldDefinitionNamesRule, UniqueDirectiveNamesRule, KnownTypeNamesRule, KnownDirectivesRule, UniqueDirectivesPerLocationRule, PossibleTypeExtensionsRule, UniqueArgumentNamesRule, UniqueInputFieldNamesRule, } from 'graphql';\nconst specifiedSDLRules = [\n LoneSchemaDefinitionRule,\n UniqueOperationTypesRule,\n UniqueTypeNamesRule,\n UniqueEnumValueNamesRule,\n UniqueFieldDefinitionNamesRule,\n UniqueDirectiveNamesRule,\n KnownTypeNamesRule,\n KnownDirectivesRule,\n UniqueDirectivesPerLocationRule,\n PossibleTypeExtensionsRule,\n UniqueArgumentNamesRule,\n UniqueInputFieldNamesRule,\n];\nexport function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode, isSchemaDocument) {\n const rules = specifiedRules.filter(rule => {\n if (rule === NoUnusedFragmentsRule || rule === ExecutableDefinitionsRule) {\n return false;\n }\n if (isRelayCompatMode && rule === KnownFragmentNamesRule) {\n return false;\n }\n return true;\n });\n if (customRules) {\n Array.prototype.push.apply(rules, customRules);\n }\n if (isSchemaDocument) {\n Array.prototype.push.apply(rules, specifiedSDLRules);\n }\n const errors = validate(schema, ast, rules);\n return errors.filter(error => {\n if (error.message.includes('Unknown directive') && error.nodes) {\n const node = error.nodes[0];\n if (node && node.kind === Kind.DIRECTIVE) {\n const name = node.name.value;\n if (name === 'arguments' || name === 'argumentDefinitions') {\n return false;\n }\n }\n }\n return true;\n });\n}\n//# sourceMappingURL=validateWithCustomRules.js.map","import { GraphQLError, print, validate, NoDeprecatedCustomRule, parse, } from 'graphql';\nimport { CharacterStream, onlineParser } from '../parser';\nimport { Range, validateWithCustomRules, Position } from '../utils';\nexport const SEVERITY = {\n Error: 'Error',\n Warning: 'Warning',\n Information: 'Information',\n Hint: 'Hint',\n};\nexport const DIAGNOSTIC_SEVERITY = {\n [SEVERITY.Error]: 1,\n [SEVERITY.Warning]: 2,\n [SEVERITY.Information]: 3,\n [SEVERITY.Hint]: 4,\n};\nconst invariant = (condition, message) => {\n if (!condition) {\n throw new Error(message);\n }\n};\nexport function getDiagnostics(query, schema = null, customRules, isRelayCompatMode, externalFragments) {\n var _a, _b;\n let ast = null;\n let fragments = '';\n if (externalFragments) {\n fragments =\n typeof externalFragments === 'string'\n ? externalFragments\n : externalFragments.reduce((acc, node) => acc + print(node) + '\\n\\n', '');\n }\n const enhancedQuery = fragments ? `${query}\\n\\n${fragments}` : query;\n try {\n ast = parse(enhancedQuery);\n }\n catch (error) {\n if (error instanceof GraphQLError) {\n const range = getRange((_b = (_a = error.locations) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : { line: 0, column: 0 }, enhancedQuery);\n return [\n {\n severity: DIAGNOSTIC_SEVERITY.Error,\n message: error.message,\n source: 'GraphQL: Syntax',\n range,\n },\n ];\n }\n throw error;\n }\n return validateQuery(ast, schema, customRules, isRelayCompatMode);\n}\nexport function validateQuery(ast, schema = null, customRules, isRelayCompatMode) {\n if (!schema) {\n return [];\n }\n const validationErrorAnnotations = validateWithCustomRules(schema, ast, customRules, isRelayCompatMode).flatMap(error => annotations(error, DIAGNOSTIC_SEVERITY.Error, 'Validation'));\n const deprecationWarningAnnotations = validate(schema, ast, [\n NoDeprecatedCustomRule,\n ]).flatMap(error => annotations(error, DIAGNOSTIC_SEVERITY.Warning, 'Deprecation'));\n return validationErrorAnnotations.concat(deprecationWarningAnnotations);\n}\nfunction annotations(error, severity, type) {\n if (!error.nodes) {\n return [];\n }\n const highlightedNodes = [];\n for (const [i, node] of error.nodes.entries()) {\n const highlightNode = node.kind !== 'Variable' && 'name' in node && node.name !== undefined\n ? node.name\n : 'variable' in node && node.variable !== undefined\n ? node.variable\n : node;\n if (highlightNode) {\n invariant(error.locations, 'GraphQL validation error requires locations.');\n const loc = error.locations[i];\n const highlightLoc = getLocation(highlightNode);\n const end = loc.column + (highlightLoc.end - highlightLoc.start);\n highlightedNodes.push({\n source: `GraphQL: ${type}`,\n message: error.message,\n severity,\n range: new Range(new Position(loc.line - 1, loc.column - 1), new Position(loc.line - 1, end)),\n });\n }\n }\n return highlightedNodes;\n}\nexport function getRange(location, queryText) {\n const parser = onlineParser();\n const state = parser.startState();\n const lines = queryText.split('\\n');\n invariant(lines.length >= location.line, 'Query text must have more lines than where the error happened');\n let stream = null;\n for (let i = 0; i < location.line; i++) {\n stream = new CharacterStream(lines[i]);\n while (!stream.eol()) {\n const style = parser.token(stream, state);\n if (style === 'invalidchar') {\n break;\n }\n }\n }\n invariant(stream, 'Expected Parser stream to be available.');\n const line = location.line - 1;\n const start = stream.getStartOfToken();\n const end = stream.getCurrentPosition();\n return new Range(new Position(line, start), new Position(line, end));\n}\nfunction getLocation(node) {\n const typeCastedNode = node;\n const location = typeCastedNode.loc;\n invariant(location, 'Expected ASTNode to have a location.');\n return location;\n}\n//# sourceMappingURL=getDiagnostics.js.map","var e = {\n NAME: \"Name\",\n DOCUMENT: \"Document\",\n OPERATION_DEFINITION: \"OperationDefinition\",\n VARIABLE_DEFINITION: \"VariableDefinition\",\n SELECTION_SET: \"SelectionSet\",\n FIELD: \"Field\",\n ARGUMENT: \"Argument\",\n FRAGMENT_SPREAD: \"FragmentSpread\",\n INLINE_FRAGMENT: \"InlineFragment\",\n FRAGMENT_DEFINITION: \"FragmentDefinition\",\n VARIABLE: \"Variable\",\n INT: \"IntValue\",\n FLOAT: \"FloatValue\",\n STRING: \"StringValue\",\n BOOLEAN: \"BooleanValue\",\n NULL: \"NullValue\",\n ENUM: \"EnumValue\",\n LIST: \"ListValue\",\n OBJECT: \"ObjectValue\",\n OBJECT_FIELD: \"ObjectField\",\n DIRECTIVE: \"Directive\",\n NAMED_TYPE: \"NamedType\",\n LIST_TYPE: \"ListType\",\n NON_NULL_TYPE: \"NonNullType\"\n};\n\nvar r = {\n QUERY: \"query\",\n MUTATION: \"mutation\",\n SUBSCRIPTION: \"subscription\"\n};\n\nclass GraphQLError extends Error {\n constructor(e, r, i, n, a, t, o) {\n super(e);\n this.name = \"GraphQLError\";\n this.message = e;\n if (a) {\n this.path = a;\n }\n if (r) {\n this.nodes = Array.isArray(r) ? r : [ r ];\n }\n if (i) {\n this.source = i;\n }\n if (n) {\n this.positions = n;\n }\n if (t) {\n this.originalError = t;\n }\n var l = o;\n if (!l && t) {\n var u = t.extensions;\n if (u && \"object\" == typeof u) {\n l = u;\n }\n }\n this.extensions = l || {};\n }\n toJSON() {\n return {\n ...this,\n message: this.message\n };\n }\n toString() {\n return this.message;\n }\n get [Symbol.toStringTag]() {\n return \"GraphQLError\";\n }\n}\n\nvar i;\n\nvar n;\n\nfunction error(e) {\n return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e}`);\n}\n\nfunction advance(e) {\n e.lastIndex = n;\n if (e.test(i)) {\n return i.slice(n, n = e.lastIndex);\n }\n}\n\nvar a = / +(?=[^\\s])/y;\n\nfunction blockString(e) {\n var r = e.split(\"\\n\");\n var i = \"\";\n var n = 0;\n var t = 0;\n var o = r.length - 1;\n for (var l = 0; l < r.length; l++) {\n a.lastIndex = 0;\n if (a.test(r[l])) {\n if (l && (!n || a.lastIndex < n)) {\n n = a.lastIndex;\n }\n t = t || l;\n o = l;\n }\n }\n for (var u = t; u <= o; u++) {\n if (u !== t) {\n i += \"\\n\";\n }\n i += r[u].slice(n).replace(/\\\\\"\"\"/g, '\"\"\"');\n }\n return i;\n}\n\nfunction ignored() {\n for (var e = 0 | i.charCodeAt(n++); 9 === e || 10 === e || 13 === e || 32 === e || 35 === e || 44 === e || 65279 === e; e = 0 | i.charCodeAt(n++)) {\n if (35 === e) {\n while (10 !== (e = i.charCodeAt(n++)) && 13 !== e) {}\n }\n }\n n--;\n}\n\nvar t = /[_A-Za-z]\\w*/y;\n\nfunction name() {\n var e;\n if (e = advance(t)) {\n return {\n kind: \"Name\",\n value: e\n };\n }\n}\n\nvar o = /(?:null|true|false)/y;\n\nvar l = /\\$[_A-Za-z]\\w*/y;\n\nvar u = /-?\\d+/y;\n\nvar v = /(?:\\.\\d+)?[eE][+-]?\\d+|\\.\\d+/y;\n\nvar d = /\\\\/g;\n\nvar s = /\"\"\"(?:\"\"\"|(?:[\\s\\S]*?[^\\\\])\"\"\")/y;\n\nvar c = /\"(?:\"|[^\\r\\n]*?[^\\\\]\")/y;\n\nfunction value(e) {\n var r;\n var a;\n if (a = advance(o)) {\n r = \"null\" === a ? {\n kind: \"NullValue\"\n } : {\n kind: \"BooleanValue\",\n value: \"true\" === a\n };\n } else if (!e && (a = advance(l))) {\n r = {\n kind: \"Variable\",\n name: {\n kind: \"Name\",\n value: a.slice(1)\n }\n };\n } else if (a = advance(u)) {\n var f = a;\n if (a = advance(v)) {\n r = {\n kind: \"FloatValue\",\n value: f + a\n };\n } else {\n r = {\n kind: \"IntValue\",\n value: f\n };\n }\n } else if (a = advance(t)) {\n r = {\n kind: \"EnumValue\",\n value: a\n };\n } else if (a = advance(s)) {\n r = {\n kind: \"StringValue\",\n value: blockString(a.slice(3, -3)),\n block: !0\n };\n } else if (a = advance(c)) {\n r = {\n kind: \"StringValue\",\n value: d.test(a) ? JSON.parse(a) : a.slice(1, -1),\n block: !1\n };\n } else if (r = function list(e) {\n var r;\n if (91 === i.charCodeAt(n)) {\n n++;\n ignored();\n var a = [];\n while (r = value(e)) {\n a.push(r);\n }\n if (93 !== i.charCodeAt(n++)) {\n throw error(\"ListValue\");\n }\n ignored();\n return {\n kind: \"ListValue\",\n values: a\n };\n }\n }(e) || function object(e) {\n if (123 === i.charCodeAt(n)) {\n n++;\n ignored();\n var r = [];\n var a;\n while (a = name()) {\n ignored();\n if (58 !== i.charCodeAt(n++)) {\n throw error(\"ObjectField\");\n }\n ignored();\n var t = value(e);\n if (!t) {\n throw error(\"ObjectField\");\n }\n r.push({\n kind: \"ObjectField\",\n name: a,\n value: t\n });\n }\n if (125 !== i.charCodeAt(n++)) {\n throw error(\"ObjectValue\");\n }\n ignored();\n return {\n kind: \"ObjectValue\",\n fields: r\n };\n }\n }(e)) {\n return r;\n }\n ignored();\n return r;\n}\n\nfunction arguments_(e) {\n var r = [];\n ignored();\n if (40 === i.charCodeAt(n)) {\n n++;\n ignored();\n var a;\n while (a = name()) {\n ignored();\n if (58 !== i.charCodeAt(n++)) {\n throw error(\"Argument\");\n }\n ignored();\n var t = value(e);\n if (!t) {\n throw error(\"Argument\");\n }\n r.push({\n kind: \"Argument\",\n name: a,\n value: t\n });\n }\n if (!r.length || 41 !== i.charCodeAt(n++)) {\n throw error(\"Argument\");\n }\n ignored();\n }\n return r;\n}\n\nfunction directives(e) {\n var r = [];\n ignored();\n while (64 === i.charCodeAt(n)) {\n n++;\n var a = name();\n if (!a) {\n throw error(\"Directive\");\n }\n ignored();\n r.push({\n kind: \"Directive\",\n name: a,\n arguments: arguments_(e)\n });\n }\n return r;\n}\n\nfunction field() {\n var e = name();\n if (e) {\n ignored();\n var r;\n if (58 === i.charCodeAt(n)) {\n n++;\n ignored();\n r = e;\n if (!(e = name())) {\n throw error(\"Field\");\n }\n ignored();\n }\n return {\n kind: \"Field\",\n alias: r,\n name: e,\n arguments: arguments_(!1),\n directives: directives(!1),\n selectionSet: selectionSet()\n };\n }\n}\n\nfunction type() {\n var e;\n ignored();\n if (91 === i.charCodeAt(n)) {\n n++;\n ignored();\n var r = type();\n if (!r || 93 !== i.charCodeAt(n++)) {\n throw error(\"ListType\");\n }\n e = {\n kind: \"ListType\",\n type: r\n };\n } else if (e = name()) {\n e = {\n kind: \"NamedType\",\n name: e\n };\n } else {\n throw error(\"NamedType\");\n }\n ignored();\n if (33 === i.charCodeAt(n)) {\n n++;\n ignored();\n return {\n kind: \"NonNullType\",\n type: e\n };\n } else {\n return e;\n }\n}\n\nvar f = /on/y;\n\nfunction typeCondition() {\n if (advance(f)) {\n ignored();\n var e = name();\n if (!e) {\n throw error(\"NamedType\");\n }\n ignored();\n return {\n kind: \"NamedType\",\n name: e\n };\n }\n}\n\nvar p = /\\.\\.\\./y;\n\nfunction fragmentSpread() {\n if (advance(p)) {\n ignored();\n var e = n;\n var r;\n if ((r = name()) && \"on\" !== r.value) {\n return {\n kind: \"FragmentSpread\",\n name: r,\n directives: directives(!1)\n };\n } else {\n n = e;\n var i = typeCondition();\n var a = directives(!1);\n var t = selectionSet();\n if (!t) {\n throw error(\"InlineFragment\");\n }\n return {\n kind: \"InlineFragment\",\n typeCondition: i,\n directives: a,\n selectionSet: t\n };\n }\n }\n}\n\nfunction selectionSet() {\n var e;\n ignored();\n if (123 === i.charCodeAt(n)) {\n n++;\n ignored();\n var r = [];\n while (e = fragmentSpread() || field()) {\n r.push(e);\n }\n if (!r.length || 125 !== i.charCodeAt(n++)) {\n throw error(\"SelectionSet\");\n }\n ignored();\n return {\n kind: \"SelectionSet\",\n selections: r\n };\n }\n}\n\nvar m = /fragment/y;\n\nfunction fragmentDefinition() {\n if (advance(m)) {\n ignored();\n var e = name();\n if (!e) {\n throw error(\"FragmentDefinition\");\n }\n ignored();\n var r = typeCondition();\n if (!r) {\n throw error(\"FragmentDefinition\");\n }\n var i = directives(!1);\n var n = selectionSet();\n if (!n) {\n throw error(\"FragmentDefinition\");\n }\n return {\n kind: \"FragmentDefinition\",\n name: e,\n typeCondition: r,\n directives: i,\n selectionSet: n\n };\n }\n}\n\nvar g = /(?:query|mutation|subscription)/y;\n\nfunction operationDefinition() {\n var e;\n var r;\n var a = [];\n var t = [];\n if (e = advance(g)) {\n ignored();\n r = name();\n a = function variableDefinitions() {\n var e;\n var r = [];\n ignored();\n if (40 === i.charCodeAt(n)) {\n n++;\n ignored();\n while (e = advance(l)) {\n ignored();\n if (58 !== i.charCodeAt(n++)) {\n throw error(\"VariableDefinition\");\n }\n var a = type();\n var t = void 0;\n if (61 === i.charCodeAt(n)) {\n n++;\n ignored();\n if (!(t = value(!0))) {\n throw error(\"VariableDefinition\");\n }\n }\n ignored();\n r.push({\n kind: \"VariableDefinition\",\n variable: {\n kind: \"Variable\",\n name: {\n kind: \"Name\",\n value: e.slice(1)\n }\n },\n type: a,\n defaultValue: t,\n directives: directives(!0)\n });\n }\n if (41 !== i.charCodeAt(n++)) {\n throw error(\"VariableDefinition\");\n }\n ignored();\n }\n return r;\n }();\n t = directives(!1);\n }\n var o = selectionSet();\n if (o) {\n return {\n kind: \"OperationDefinition\",\n operation: e || \"query\",\n name: r,\n variableDefinitions: a,\n directives: t,\n selectionSet: o\n };\n }\n}\n\nfunction parse(e, r) {\n i = \"string\" == typeof e.body ? e.body : e;\n n = 0;\n return function document() {\n var e;\n ignored();\n var r = [];\n while (e = fragmentDefinition() || operationDefinition()) {\n r.push(e);\n }\n return {\n kind: \"Document\",\n definitions: r\n };\n }();\n}\n\nfunction parseValue(e, r) {\n i = \"string\" == typeof e.body ? e.body : e;\n n = 0;\n ignored();\n var a = value(!1);\n if (!a) {\n throw error(\"ValueNode\");\n }\n return a;\n}\n\nfunction parseType(e, r) {\n i = \"string\" == typeof e.body ? e.body : e;\n n = 0;\n return type();\n}\n\nvar h = {};\n\nfunction visit(e, r) {\n var i = [];\n var n = [];\n try {\n var a = function traverse(e, a, t) {\n var o = !1;\n var l = r[e.kind] && r[e.kind].enter || r[e.kind] || r.enter;\n var u = l && l.call(r, e, a, t, n, i);\n if (!1 === u) {\n return e;\n } else if (null === u) {\n return null;\n } else if (u === h) {\n throw h;\n } else if (u && \"string\" == typeof u.kind) {\n o = u !== e;\n e = u;\n }\n if (t) {\n i.push(t);\n }\n var v;\n var d = {\n ...e\n };\n for (var s in e) {\n n.push(s);\n var c = e[s];\n if (Array.isArray(c)) {\n var f = [];\n for (var p = 0; p < c.length; p++) {\n if (null != c[p] && \"string\" == typeof c[p].kind) {\n i.push(e);\n n.push(p);\n v = traverse(c[p], p, c);\n n.pop();\n i.pop();\n if (null == v) {\n o = !0;\n } else {\n o = o || v !== c[p];\n f.push(v);\n }\n }\n }\n c = f;\n } else if (null != c && \"string\" == typeof c.kind) {\n if (void 0 !== (v = traverse(c, s, e))) {\n o = o || c !== v;\n c = v;\n }\n }\n n.pop();\n if (o) {\n d[s] = c;\n }\n }\n if (t) {\n i.pop();\n }\n var m = r[e.kind] && r[e.kind].leave || r.leave;\n var g = m && m.call(r, e, a, t, n, i);\n if (g === h) {\n throw h;\n } else if (void 0 !== g) {\n return g;\n } else if (void 0 !== u) {\n return o ? d : u;\n } else {\n return o ? d : e;\n }\n }(e);\n return void 0 !== a && !1 !== a ? a : e;\n } catch (r) {\n if (r !== h) {\n throw r;\n }\n return e;\n }\n}\n\nfunction printString(e) {\n return JSON.stringify(e);\n}\n\nfunction printBlockString(e) {\n return '\"\"\"\\n' + e.replace(/\"\"\"/g, '\\\\\"\"\"') + '\\n\"\"\"';\n}\n\nvar hasItems = e => !(!e || !e.length);\n\nvar y = {\n OperationDefinition(e) {\n if (\"query\" === e.operation && !e.name && !hasItems(e.variableDefinitions) && !hasItems(e.directives)) {\n return y.SelectionSet(e.selectionSet);\n }\n var r = e.operation;\n if (e.name) {\n r += \" \" + e.name.value;\n }\n if (hasItems(e.variableDefinitions)) {\n if (!e.name) {\n r += \" \";\n }\n r += \"(\" + e.variableDefinitions.map(y.VariableDefinition).join(\", \") + \")\";\n }\n if (hasItems(e.directives)) {\n r += \" \" + e.directives.map(y.Directive).join(\" \");\n }\n return r + \" \" + y.SelectionSet(e.selectionSet);\n },\n VariableDefinition(e) {\n var r = y.Variable(e.variable) + \": \" + print(e.type);\n if (e.defaultValue) {\n r += \" = \" + print(e.defaultValue);\n }\n if (hasItems(e.directives)) {\n r += \" \" + e.directives.map(y.Directive).join(\" \");\n }\n return r;\n },\n Field(e) {\n var r = (e.alias ? e.alias.value + \": \" : \"\") + e.name.value;\n if (hasItems(e.arguments)) {\n var i = e.arguments.map(y.Argument);\n var n = r + \"(\" + i.join(\", \") + \")\";\n r = n.length > 80 ? r + \"(\\n \" + i.join(\"\\n\").replace(/\\n/g, \"\\n \") + \"\\n)\" : n;\n }\n if (hasItems(e.directives)) {\n r += \" \" + e.directives.map(y.Directive).join(\" \");\n }\n return e.selectionSet ? r + \" \" + y.SelectionSet(e.selectionSet) : r;\n },\n StringValue: e => e.block ? printBlockString(e.value) : printString(e.value),\n BooleanValue: e => \"\" + e.value,\n NullValue: e => \"null\",\n IntValue: e => e.value,\n FloatValue: e => e.value,\n EnumValue: e => e.value,\n Name: e => e.value,\n Variable: e => \"$\" + e.name.value,\n ListValue: e => \"[\" + e.values.map(print).join(\", \") + \"]\",\n ObjectValue: e => \"{\" + e.fields.map(y.ObjectField).join(\", \") + \"}\",\n ObjectField: e => e.name.value + \": \" + print(e.value),\n Document: e => hasItems(e.definitions) ? e.definitions.map(print).join(\"\\n\\n\") : \"\",\n SelectionSet: e => \"{\\n \" + e.selections.map(print).join(\"\\n\").replace(/\\n/g, \"\\n \") + \"\\n}\",\n Argument: e => e.name.value + \": \" + print(e.value),\n FragmentSpread(e) {\n var r = \"...\" + e.name.value;\n if (hasItems(e.directives)) {\n r += \" \" + e.directives.map(y.Directive).join(\" \");\n }\n return r;\n },\n InlineFragment(e) {\n var r = \"...\";\n if (e.typeCondition) {\n r += \" on \" + e.typeCondition.name.value;\n }\n if (hasItems(e.directives)) {\n r += \" \" + e.directives.map(y.Directive).join(\" \");\n }\n return r + \" \" + print(e.selectionSet);\n },\n FragmentDefinition(e) {\n var r = \"fragment \" + e.name.value;\n r += \" on \" + e.typeCondition.name.value;\n if (hasItems(e.directives)) {\n r += \" \" + e.directives.map(y.Directive).join(\" \");\n }\n return r + \" \" + print(e.selectionSet);\n },\n Directive(e) {\n var r = \"@\" + e.name.value;\n if (hasItems(e.arguments)) {\n r += \"(\" + e.arguments.map(y.Argument).join(\", \") + \")\";\n }\n return r;\n },\n NamedType: e => e.name.value,\n ListType: e => \"[\" + print(e.type) + \"]\",\n NonNullType: e => print(e.type) + \"!\"\n};\n\nfunction print(e) {\n return y[e.kind] ? y[e.kind](e) : \"\";\n}\n\nfunction valueFromASTUntyped(e, r) {\n switch (e.kind) {\n case \"NullValue\":\n return null;\n\n case \"IntValue\":\n return parseInt(e.value, 10);\n\n case \"FloatValue\":\n return parseFloat(e.value);\n\n case \"StringValue\":\n case \"EnumValue\":\n case \"BooleanValue\":\n return e.value;\n\n case \"ListValue\":\n var i = [];\n for (var n = 0, a = e.values; n < a.length; n += 1) {\n i.push(valueFromASTUntyped(a[n], r));\n }\n return i;\n\n case \"ObjectValue\":\n var t = Object.create(null);\n for (var o = 0, l = e.fields; o < l.length; o += 1) {\n var u = l[o];\n t[u.name.value] = valueFromASTUntyped(u.value, r);\n }\n return t;\n\n case \"Variable\":\n return r && r[e.name.value];\n }\n}\n\nfunction valueFromTypeNode(e, r, i) {\n if (\"Variable\" === e.kind) {\n return i ? valueFromTypeNode(i[e.name.value], r, i) : void 0;\n } else if (\"NonNullType\" === r.kind) {\n return \"NullValue\" !== e.kind ? valueFromTypeNode(e, r, i) : void 0;\n } else if (\"NullValue\" === e.kind) {\n return null;\n } else if (\"ListType\" === r.kind) {\n if (\"ListValue\" === e.kind) {\n var n = [];\n for (var a = 0, t = e.values; a < t.length; a += 1) {\n var o = valueFromTypeNode(t[a], r.type, i);\n if (void 0 === o) {\n return;\n } else {\n n.push(o);\n }\n }\n return n;\n }\n } else if (\"NamedType\" === r.kind) {\n switch (r.name.value) {\n case \"Int\":\n case \"Float\":\n case \"String\":\n case \"Bool\":\n return r.name.value + \"Value\" === e.kind ? valueFromASTUntyped(e, i) : void 0;\n\n default:\n return valueFromASTUntyped(e, i);\n }\n }\n}\n\nexport { h as BREAK, GraphQLError, e as Kind, r as OperationTypeNode, parse, parseType, parseValue, print, printBlockString, printString, valueFromASTUntyped, valueFromTypeNode, visit };\n//# sourceMappingURL=graphql.web.mjs.map\n","export const templates = new Set(['gql', 'graphql']);\n","import { ts } from '../ts';\nimport {