Skip to content

Commit

Permalink
Backport GraphQL-Tag fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Oct 30, 2024
1 parent 0e92930 commit 259bd6b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ function operationDefinition(
}
}

function document(): ast.DocumentNode {
function document(input: string): ast.DocumentNode {
let match: string | undefined;
let definition: ast.OperationDefinitionNode | undefined;
ignored();
Expand All @@ -501,6 +501,16 @@ function document(): ast.DocumentNode {
return {
kind: 'Document' as Kind.DOCUMENT,
definitions,
loc: {
start: 0,
end: input.length,
// @ts-ignore
source: {
body: input,
name: 'graphql.web',
locationOffset: { line: 1, column: 1 },
},
},
};
}

Expand All @@ -514,7 +524,7 @@ export function parse(
): ast.DocumentNode {
input = typeof string.body === 'string' ? string.body : string;
idx = 0;
return document();
return document(input);
}

export function parseValue(
Expand Down

0 comments on commit 259bd6b

Please sign in to comment.