From 2597a12fad86f583d19d26a506a004c5586349cf Mon Sep 17 00:00:00 2001 From: jdecroock Date: Thu, 31 Oct 2024 13:30:18 +0100 Subject: [PATCH] Apply fix --- alias/language/parser.mjs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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) {