Mirror: The small sibling of the graphql package, slimmed down for client-side libraries.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix up parsing bugs in Variable and Field nodes

+37 -18
+32 -13
alias/language/parser.mjs
··· 4 4 * in graphql.js it will only parse the query language, but not the schema 5 5 * language. 6 6 */ 7 - import { Kind } from 'graphql'; 7 + import { Kind, GraphQLError } from 'graphql'; 8 8 import { match, parse as makeParser } from 'reghex'; 9 9 10 10 // 2.1.7: Includes commas, and line comments ··· 36 36 37 37 const variable = match(Kind.VARIABLE, x => ({ 38 38 kind: x.tag, 39 - value: x[0] 39 + name: x[0] 40 40 }))` 41 41 :${'$'} ${name} 42 42 `; ··· 127 127 `; 128 128 129 129 const args = match('_argumentset')` 130 + :${ignored}? 130 131 ( 131 132 (?: ${'('} ${ignored}?) 132 133 ${arg}+ ··· 153 154 let i = 0; 154 155 return { 155 156 kind: x.tag, 156 - alias: x[1].kind === 'Name' ? x[i++] : undefined, 157 + alias: x[1].kind === Kind.NAME ? x[i++] : undefined, 157 158 name: x[i++], 158 159 arguments: x[i++], 159 160 directives: x[i++], 160 161 selectionSet: x[i++], 161 162 }; 162 163 })` 164 + :${ignored}? 163 165 ${name} 164 - :${ignored}? 165 - ((?: ${':'} ${ignored}?) ${name})? 166 - :${ignored}? 166 + ( 167 + (?: ${ignored}? ${':'} ${ignored}?) 168 + ${name} 169 + )? 167 170 ${args} 168 171 ${directives} 169 172 ${selectionSet}? ··· 194 197 kind: Kind.NAMED_TYPE, 195 198 name: x[0] 196 199 }))` 197 - (?: ${'on'} ${ignored}) 200 + (?: ${ignored} ${'on'} ${ignored}) 198 201 ${name} 199 202 :${ignored}? 200 203 `; ··· 272 275 directives: x[2], 273 276 selectionSet: x[3], 274 277 }))` 275 - (?: ${'fragment'} ${ignored}) 276 - !${'on'} 278 + (?: ${ignored}? ${'fragment'} ${ignored}) 277 279 ${name} 278 - :${ignored} 279 280 ${typeCondition} 280 281 ${directives} 281 282 ${selectionSet} ··· 322 323 | (${operationDefinition} | ${fragmentDefinition})+ 323 324 `; 324 325 325 - export const parse = makeParser(root); 326 - export const parseValue = makeParser(value); 327 - export const parseType = makeParser(type); 326 + const _parse = makeParser(root); 327 + const _parseValue = makeParser(value); 328 + const _parseType = makeParser(type); 329 + 330 + export function parse(input) { 331 + const result = _parse(input); 332 + if (result == null) throw new GraphQLError('Syntax Error'); 333 + return result; 334 + } 335 + 336 + export function parseValue(input) { 337 + const result = _parseValue(input); 338 + if (result == null) throw new GraphQLError('Syntax Error'); 339 + return result; 340 + } 341 + 342 + export function parseType(input) { 343 + const result = _parseType(input); 344 + if (result == null) throw new GraphQLError('Syntax Error'); 345 + return result; 346 + }
+1 -1
package.json
··· 24 24 "babel-plugin-modular-graphql": "^1.0.1", 25 25 "graphql": "^16.0.0-alpha.5", 26 26 "jest": "^27.0.6", 27 - "reghex": "^3.0.0", 27 + "reghex": "^3.0.1", 28 28 "rollup": "^2.56.2", 29 29 "rollup-plugin-terser": "^7.0.2" 30 30 }
+4 -4
yarn.lock
··· 2300 2300 unicode-match-property-ecmascript "^1.0.4" 2301 2301 unicode-match-property-value-ecmascript "^1.1.0" 2302 2302 2303 - reghex@^3.0.0: 2304 - version "3.0.0" 2305 - resolved "https://registry.yarnpkg.com/reghex/-/reghex-3.0.0.tgz#8121a96a75c81bd3996e94255760f98db0d7f3c0" 2306 - integrity sha512-CWL9oEFQBq1PF3iT4GjSz7Te/OuLFYYHWS5/lCyxmMFncsr4Cxi/aapgmEF1AiqodEHI16t0cu1A/B/O78NUcA== 2303 + reghex@^3.0.1: 2304 + version "3.0.1" 2305 + resolved "https://registry.yarnpkg.com/reghex/-/reghex-3.0.1.tgz#76dd93c0ebef17dfbff0ea6705e9ee764eb36717" 2306 + integrity sha512-4EVlR7D9BMSUcCVtU2LO6iRzcxwgwlQgHa2MBMlHu39SGswa2FueAqVV+LtUNmpm1+eySVeH+04vI4Zaqg9Q2A== 2307 2307 2308 2308 regjsgen@^0.5.0: 2309 2309 version "0.5.2"