diff --git a/alias/language/parser.mjs b/alias/language/parser.mjs index bb07ff3..933867e 100644 --- a/alias/language/parser.mjs +++ b/alias/language/parser.mjs @@ -323,7 +323,29 @@ const _parseType = makeParser(type); export function parse(input) { const result = _parse(input); if (result == null) throw new GraphQLError('Syntax Error'); - return result; + let loc; + return { + ...result, + set loc(_loc) { + loc = _loc; + }, + get loc() { + if (!loc) { + loc = { + start: 0, + end: input.length, + startToken: undefined, + endToken: undefined, + source: { + body: input, + name: 'graphql-web-lite', + locationOffset: { line: 1, column: 1 }, + }, + }; + } + return loc; + }, + }; } export function parseValue(input) {