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.

Improve output of GraphQL parser replacement

+20 -20
+15 -15
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('_ignored')` 11 + const ignored = match()` 12 12 ${/([\s,]|#[^\n\r]+)+/} 13 13 `; 14 14 ··· 52 52 53 53 // 2.9.1-2: These combine both number values for the sake of simplicity. 54 54 // It allows for leading zeroes, unlike graphql.js, which shouldn't matter; 55 - const number = match('_number', x => ({ 55 + const number = match(null, x => ({ 56 56 kind: x.length === 1 ? Kind.INT : Kind.FLOAT, 57 57 value: x.join('') 58 58 }))` ··· 101 101 `; 102 102 103 103 // 2.9: This matches the spec closely and is complete 104 - const value = match('_value', x => x[0])` 104 + const value = match(null, x => x[0])` 105 105 :${ignored}? 106 106 ( 107 107 ${null_} ··· 126 126 ${value} 127 127 `; 128 128 129 - const args = match('_argumentset')` 129 + const args = match()` 130 130 :${ignored}? 131 131 ( 132 132 (?: ${'('} ${ignored}?) ··· 145 145 :${ignored}? 146 146 `; 147 147 148 - const directives = match('_directiveset')` 148 + const directives = match()` 149 149 :${ignored}? 150 150 ${directive}* 151 151 `; ··· 174 174 175 175 // 2.11: The type declarations may be simplified since there's little room 176 176 // for error in this limited type system. 177 - const type = match('_type', x => { 177 + const type = match(null, x => { 178 178 const node = x[0].kind === 'Name' 179 179 ? { kind: Kind.NAMED_TYPE, name: x[0] } 180 180 : { kind: Kind.LIST_TYPE, type: x[0] } ··· 193 193 :${ignored}? 194 194 `; 195 195 196 - const typeCondition = match('_typecondition', x => ({ 196 + const typeCondition = match(null, x => ({ 197 197 kind: Kind.NAMED_TYPE, 198 198 name: x[0] 199 199 }))` ··· 206 206 let i = 0; 207 207 return { 208 208 kind: x.tag, 209 - typeCondition: x[i].tag === '_typecondition' ? x[i++] : undefined, 209 + typeCondition: x[i].kind === Kind.NAMED_TYPE ? x[i++] : undefined, 210 210 directives: x[i++], 211 211 selectionSet: x[i] 212 212 }; ··· 231 231 232 232 const selectionSet = match(Kind.SELECTION_SET, x => ({ 233 233 kind: x.tag, 234 - selections:x, 234 + selections: x.slice(), 235 235 }))` 236 236 (?: ${'{'} ${ignored}?) 237 237 ( ··· 242 242 (?: ${'}'} ${ignored}?) 243 243 `; 244 244 245 - const varDefinitionDefault = match('_defaultvariable', x => x[0])` 245 + const varDefinitionDefault = match(null, x => x[0])` 246 246 (?: ${'='} ${ignored}?) 247 247 ${value} 248 248 `; ··· 251 251 kind: x.tag, 252 252 variable: x[0], 253 253 type: x[1], 254 - defaultValue: !x[2].tag ? x[2] : undefined, 255 - directives: x[2].tag ? x[2] : x[3], 254 + defaultValue: x[2].kind ? x[2] : undefined, 255 + directives: !x[2].kind ? x[2] : x[3], 256 256 }))` 257 257 ${variable} 258 258 (?: ${ignored}? ${':'} ${ignored}?) ··· 262 262 :${ignored}? 263 263 `; 264 264 265 - const varDefinitions = match('_variabledefinitionset')` 265 + const varDefinitions = match('vars')` 266 266 (?: ${'('} ${ignored}?) 267 267 ${varDefinition}+ 268 268 (?: ${')'} ${ignored}?) ··· 288 288 kind: x.tag, 289 289 operation: x[0], 290 290 name: x.length === 5 ? x[i++] : undefined, 291 - variableDefinitions: x[i].tag === '_variabledefinitionset' ? x[i++] : null, 291 + variableDefinitions: x[i].tag === 'vars' ? x[i++].slice() : null, 292 292 directives: x[i++], 293 293 selectionSet: x[i], 294 294 }; ··· 316 316 317 317 const root = match(Kind.DOCUMENT, x => ( 318 318 x.length 319 - ? { kind: x.tag, definitions: x } 319 + ? { kind: x.tag, definitions: x.slice() } 320 320 : undefined 321 321 ))` 322 322 ${queryShorthand}
+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.1", 27 + "reghex": "^3.0.2", 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.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== 2303 + reghex@^3.0.2: 2304 + version "3.0.2" 2305 + resolved "https://registry.yarnpkg.com/reghex/-/reghex-3.0.2.tgz#984045126642ee0709c3e10727e7041112281330" 2306 + integrity sha512-Zb9DJ5u6GhgqRSBnxV2QSnLqEwcKxHWFA1N2yUa4ZUAO1P8jlWKYtWZ6/ooV6yylspGXJX0O/uNzEv0xrCtwaA== 2307 2307 2308 2308 regjsgen@^0.5.0: 2309 2309 version "0.5.2"