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 discrepancies in parser

+16 -18
+16 -18
alias/language/parser.mjs
··· 8 8 import { match, parse as makeParser } from 'reghex'; 9 9 10 10 // 2.1.7: Includes commas, and line comments 11 - const ignored = match()` 12 - ${/([\s,]|#[^\n\r]+)+/} 13 - `; 11 + const ignored = /([\s,]|#[^\n\r]+)+/; 14 12 15 13 // 2.1.9: Limited to ASCII character set, so regex shortcodes are fine 16 14 const name = match(Kind.NAME, (x) => ({ ··· 31 29 kind: x.tag, 32 30 value: x[0] === 'true', 33 31 }))` 34 - ${'true'} | ${'false'} 32 + ${/true|false/} 35 33 `; 36 34 37 35 const variable = match(Kind.VARIABLE, (x) => ({ ··· 73 71 74 72 const list = match(Kind.LIST, (x) => ({ 75 73 kind: x.tag, 76 - values: x, 74 + values: x.slice(), 77 75 }))` 78 - (?: ${'['} ${ignored}?) 76 + :${'['} 79 77 ${value}* 80 - (?: ${']'} ${ignored}?) 78 + (?: ${ignored}? ${']'} ${ignored}?) 81 79 `; 82 80 83 81 const objectField = match(Kind.OBJECT_FIELD, (x) => ({ ··· 85 83 name: x[0], 86 84 value: x[1], 87 85 }))` 86 + :${ignored}? 88 87 ${name} 89 - (?: ${ignored} ${/:/} ${ignored})? 88 + (?: ${ignored}? ${':'}) 90 89 ${value} 91 - (?: ${ignored})? 92 90 `; 93 91 94 92 const object = match(Kind.OBJECT, (x) => ({ 95 93 kind: x.tag, 96 - fields: x, 94 + fields: x.slice(), 97 95 }))` 98 - (?: ${'{'} ${ignored}?) 96 + :${'{'} 99 97 ${objectField}* 100 98 (?: ${'}'} ${ignored}?) 101 99 `; ··· 196 194 kind: Kind.NAMED_TYPE, 197 195 name: x[0], 198 196 }))` 199 - (?: ${ignored} ${'on'} ${ignored}) 197 + (?: ${ignored}? ${'on'} ${ignored}) 200 198 ${name} 201 199 :${ignored}? 202 200 `; ··· 210 208 selectionSet: x[i], 211 209 }; 212 210 })` 213 - (?: ${'...'} ${ignored}?) 211 + :${'...'} 214 212 ${typeCondition}? 215 213 ${directives} 216 214 ${selectionSet} ··· 232 230 kind: x.tag, 233 231 selections: x.slice(), 234 232 }))` 233 + :${ignored}? 235 234 (?: ${'{'} ${ignored}?) 236 235 ( 237 236 ${inlineFragment} | ··· 262 261 `; 263 262 264 263 const varDefinitions = match('vars')` 264 + :${ignored}? 265 265 (?: ${'('} ${ignored}?) 266 266 ${varDefinition}+ 267 267 (?: ${')'} ${ignored}?) ··· 286 286 return { 287 287 kind: x.tag, 288 288 operation: x[0], 289 - name: x.length === 5 ? x[i++] : undefined, 290 - variableDefinitions: x[i].tag === 'vars' ? x[i++].slice() : null, 289 + name: x[i].kind === Kind.NAME ? x[i++] : undefined, 290 + variableDefinitions: x[i].tag === 'vars' ? x[i++].slice() : [], 291 291 directives: x[i++], 292 292 selectionSet: x[i], 293 293 }; 294 294 })` 295 295 :${ignored}? 296 296 ${/query|mutation|subscription/} 297 - ((?: ${ignored}) ${name})? 298 - :${ignored}? 297 + (:${ignored} ${name})? 299 298 ${varDefinitions}? 300 299 ${directives} 301 300 ${selectionSet} ··· 309 308 directives: [], 310 309 selectionSet: x[0], 311 310 }))` 312 - :${ignored}? 313 311 ${selectionSet} 314 312 `; 315 313