rescript-relay 0.23.0 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/cli/cli.js +1 -1
- package/compiler.js +11 -0
- package/package.json +3 -10
- package/postinstall.js +40 -13
- package/relay-compiler-linux-x64/relay +0 -0
- package/relay-compiler-macos-arm64/relay +0 -0
- package/relay-compiler-macos-x64/relay +0 -0
- package/src/RescriptRelay.res +2 -0
- package/src/RescriptRelay.resi +2 -0
- package/src/experimental-router/RescriptRelayRouter.bs.js +12 -1
- package/src/experimental-router/RescriptRelayRouter.res +10 -1
- package/src/experimental-router/RescriptRelayRouter.resi +2 -0
- package/src/utils.js +182 -190
- package/bin-darwin +0 -0
- package/bin-linux +0 -0
- package/compiler/compiler-cli.js +0 -54
- package/language-plugin/dist/index.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,49 @@
|
|
|
1
1
|
# master
|
|
2
2
|
|
|
3
|
+
# 1.0.0-beta.4
|
|
4
|
+
|
|
5
|
+
_[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/5831c2f1f0f13eedc1cb60468c32fd32b2dc01d3)_
|
|
6
|
+
|
|
7
|
+
The time has finally come - RescriptRelay `1.0.0` is in beta! The one, big major thing this release brings is that the ReScript type generation for the Relay compiler has been completely rewritten, and fully integrated into the new Relay Rust compiler. The RescriptRelay fork of the compiler is available and maintained [here])(https://github.com/zth/relay/tree/rescript-relay).
|
|
8
|
+
|
|
9
|
+
## Remove Packages
|
|
10
|
+
|
|
11
|
+
You can go ahead and remove these packages, that are no longer needed, as the compiler is now shipped in the main package:
|
|
12
|
+
|
|
13
|
+
- `relay-config`
|
|
14
|
+
- `relay-compiler`
|
|
15
|
+
- `graphql` (if you don't use it for anything else)
|
|
16
|
+
|
|
17
|
+
## Breaking Changes
|
|
18
|
+
|
|
19
|
+
- The compiler expects the `__generated__` folder to always exist, so if you're not committing your artifacts to source control, make sure you add a `.gitkeep` to the generated folder so git keeps it around.
|
|
20
|
+
|
|
21
|
+
## Improvements
|
|
22
|
+
|
|
23
|
+
- The compiler itself should be _much_ faster than the old one. An order of magnitude faster. Especially for incremental compilation in watch mode.
|
|
24
|
+
- There's no longer any need to manually select `__typename` on interfaces and unions for RescriptRelay's sake, unless you actually want to use it yourself.
|
|
25
|
+
- We now support the `@required` directive from Relay, which is a new directive that lets you force non-nullability for nullable fields on the client side. You can then choose to throw an error if null values are encountered, or let the null value bubble up. Docs are coming soon, and you'll need to do `RescriptRelay.relayFeatureFlags.enableRequiredDirective = true` somewhere in your code to enable it for now.
|
|
26
|
+
- The errors reported by the compiler is now quite a lot better.
|
|
27
|
+
|
|
28
|
+
## Beta fix changelog
|
|
29
|
+
|
|
30
|
+
### beta.4
|
|
31
|
+
|
|
32
|
+
- Revert JSON.parse micro optimization experiment.
|
|
33
|
+
|
|
34
|
+
### beta.3
|
|
35
|
+
|
|
36
|
+
- Fix issue with duplicate keys being printed in the conversion instructions.
|
|
37
|
+
- Get rid of the need of nullability conversion instructions, and infer them instead.
|
|
38
|
+
|
|
39
|
+
### beta.2
|
|
40
|
+
|
|
41
|
+
- Fix issue with recursive input objects not being converted correctly.
|
|
42
|
+
|
|
3
43
|
# 0.23.0
|
|
4
44
|
|
|
45
|
+
_[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/6e96dfafaec918b1d4e9519d3fcbf5e5c46be6c0)_
|
|
46
|
+
|
|
5
47
|
Finally, a new release! This brings the Relay version to 12, and the React version to 18 (in rc.0 at the time of writing). This release has a few breaking changes which are necessary as we're slowly approaching version 1.0.0 of RescriptRelay. Check the new "Migrations" section below for a few scripts you can run to help the migration.
|
|
6
48
|
|
|
7
49
|
## Upgrade versions
|
package/cli/cli.js
CHANGED
|
@@ -475,4 +475,4 @@ var BE=OT(4293);var LE=BE.Buffer;function copyProps(pT,xT){for(var OT in pT){xT[
|
|
|
475
475
|
*
|
|
476
476
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
477
477
|
* Released under the MIT License.
|
|
478
|
-
*/const BE=OT(5680);const toRegexRange=(pT,xT,OT)=>{if(BE(pT)===false){throw new TypeError("toRegexRange: expected the first argument to be a number")}if(xT===void 0||pT===xT){return String(pT)}if(BE(xT)===false){throw new TypeError("toRegexRange: expected the second argument to be a number.")}let LE={relaxZeros:true,...OT};if(typeof LE.strictZeros==="boolean"){LE.relaxZeros=LE.strictZeros===false}let RE=String(LE.relaxZeros);let ME=String(LE.shorthand);let jE=String(LE.capture);let VE=String(LE.wrap);let UE=pT+":"+xT+"="+RE+ME+jE+VE;if(toRegexRange.cache.hasOwnProperty(UE)){return toRegexRange.cache[UE].result}let JE=Math.min(pT,xT);let qE=Math.max(pT,xT);if(Math.abs(JE-qE)===1){let OT=pT+"|"+xT;if(LE.capture){return`(${OT})`}if(LE.wrap===false){return OT}return`(?:${OT})`}let KE=hasPadding(pT)||hasPadding(xT);let zE={min:pT,max:xT,a:JE,b:qE};let GE=[];let $E=[];if(KE){zE.isPadded=KE;zE.maxLen=String(zE.max).length}if(JE<0){let pT=qE<0?Math.abs(qE):1;$E=splitToPatterns(pT,Math.abs(JE),zE,LE);JE=zE.a=0}if(qE>=0){GE=splitToPatterns(JE,qE,zE,LE)}zE.negatives=$E;zE.positives=GE;zE.result=collatePatterns($E,GE,LE);if(LE.capture===true){zE.result=`(${zE.result})`}else if(LE.wrap!==false&&GE.length+$E.length>1){zE.result=`(?:${zE.result})`}toRegexRange.cache[UE]=zE;return zE.result};function collatePatterns(pT,xT,OT){let BE=filterPatterns(pT,xT,"-",false,OT)||[];let LE=filterPatterns(xT,pT,"",false,OT)||[];let RE=filterPatterns(pT,xT,"-?",true,OT)||[];let ME=BE.concat(RE).concat(LE);return ME.join("|")}function splitToRanges(pT,xT){let OT=1;let BE=1;let LE=countNines(pT,OT);let RE=new Set([xT]);while(pT<=LE&&LE<=xT){RE.add(LE);OT+=1;LE=countNines(pT,OT)}LE=countZeros(xT+1,BE)-1;while(pT<LE&&LE<=xT){RE.add(LE);BE+=1;LE=countZeros(xT+1,BE)-1}RE=[...RE];RE.sort(compare);return RE}function rangeToPattern(pT,xT,OT){if(pT===xT){return{pattern:pT,count:[],digits:0}}let BE=zip(pT,xT);let LE=BE.length;let RE="";let ME=0;for(let pT=0;pT<LE;pT++){let[xT,LE]=BE[pT];if(xT===LE){RE+=xT}else if(xT!=="0"||LE!=="9"){RE+=toCharacterClass(xT,LE,OT)}else{ME++}}if(ME){RE+=OT.shorthand===true?"\\d":"[0-9]"}return{pattern:RE,count:[ME],digits:LE}}function splitToPatterns(pT,xT,OT,BE){let LE=splitToRanges(pT,xT);let RE=[];let ME=pT;let jE;for(let pT=0;pT<LE.length;pT++){let xT=LE[pT];let VE=rangeToPattern(String(ME),String(xT),BE);let UE="";if(!OT.isPadded&&jE&&jE.pattern===VE.pattern){if(jE.count.length>1){jE.count.pop()}jE.count.push(VE.count[0]);jE.string=jE.pattern+toQuantifier(jE.count);ME=xT+1;continue}if(OT.isPadded){UE=padZeros(xT,OT,BE)}VE.string=UE+VE.pattern+toQuantifier(VE.count);RE.push(VE);ME=xT+1;jE=VE}return RE}function filterPatterns(pT,xT,OT,BE,LE){let RE=[];for(let LE of pT){let{string:pT}=LE;if(!BE&&!contains(xT,"string",pT)){RE.push(OT+pT)}if(BE&&contains(xT,"string",pT)){RE.push(OT+pT)}}return RE}function zip(pT,xT){let OT=[];for(let BE=0;BE<pT.length;BE++)OT.push([pT[BE],xT[BE]]);return OT}function compare(pT,xT){return pT>xT?1:xT>pT?-1:0}function contains(pT,xT,OT){return pT.some((pT=>pT[xT]===OT))}function countNines(pT,xT){return Number(String(pT).slice(0,-xT)+"9".repeat(xT))}function countZeros(pT,xT){return pT-pT%Math.pow(10,xT)}function toQuantifier(pT){let[xT=0,OT=""]=pT;if(OT||xT>1){return`{${xT+(OT?","+OT:"")}}`}return""}function toCharacterClass(pT,xT,OT){return`[${pT}${xT-pT===1?"":"-"}${xT}]`}function hasPadding(pT){return/^-?(0+)\d/.test(pT)}function padZeros(pT,xT,OT){if(!xT.isPadded){return pT}let BE=Math.abs(xT.maxLen-String(pT).length);let LE=OT.relaxZeros!==false;switch(BE){case 0:return"";case 1:return LE?"0?":"0";case 2:return LE?"0{0,2}":"00";default:{return LE?`0{0,${BE}}`:`0{${BE}}`}}}toRegexRange.cache={};toRegexRange.clearCache=()=>toRegexRange.cache={};pT.exports=toRegexRange},5278:(pT,xT,OT)=>{pT.exports=OT(1669).deprecate},4383:pT=>{pT.exports=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]]},5917:(pT,xT,OT)=>{"use strict";var BE=OT(732);var LE=OT(4383);var RE={nul:0,control:0};pT.exports=function wcwidth(pT){return wcswidth(pT,RE)};pT.exports.config=function(pT){pT=BE(pT||{},RE);return function wcwidth(xT){return wcswidth(xT,pT)}};function wcswidth(pT,xT){if(typeof pT!=="string")return wcwidth(pT,xT);var OT=0;for(var BE=0;BE<pT.length;BE++){var LE=wcwidth(pT.charCodeAt(BE),xT);if(LE<0)return-1;OT+=LE}return OT}function wcwidth(pT,xT){if(pT===0)return xT.nul;if(pT<32||pT>=127&&pT<160)return xT.control;if(bisearch(pT))return 0;return 1+(pT>=4352&&(pT<=4447||pT==9001||pT==9002||pT>=11904&&pT<=42191&&pT!=12351||pT>=44032&&pT<=55203||pT>=63744&&pT<=64255||pT>=65040&&pT<=65049||pT>=65072&&pT<=65135||pT>=65280&&pT<=65376||pT>=65504&&pT<=65510||pT>=131072&&pT<=196605||pT>=196608&&pT<=262141))}function bisearch(pT){var xT=0;var OT=LE.length-1;var BE;if(pT<LE[0][0]||pT>LE[OT][1])return false;while(OT>=xT){BE=Math.floor((xT+OT)/2);if(pT>LE[BE][1])xT=BE+1;else if(pT<LE[BE][0])OT=BE-1;else return true}return false}},6615:pT=>{"use strict";pT.exports=JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},"dots2":{"interval":80,"frames":["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},"dots3":{"interval":80,"frames":["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},"dots4":{"interval":80,"frames":["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},"dots5":{"interval":80,"frames":["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},"dots6":{"interval":80,"frames":["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},"dots7":{"interval":80,"frames":["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},"dots8":{"interval":80,"frames":["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},"dots9":{"interval":80,"frames":["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},"dots10":{"interval":80,"frames":["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},"dots11":{"interval":100,"frames":["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},"dots12":{"interval":80,"frames":["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},"dots8Bit":{"interval":80,"frames":["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},"line":{"interval":130,"frames":["-","\\\\","|","/"]},"line2":{"interval":100,"frames":["⠂","-","–","—","–","-"]},"pipe":{"interval":100,"frames":["┤","┘","┴","└","├","┌","┬","┐"]},"simpleDots":{"interval":400,"frames":[". ",".. ","..."," "]},"simpleDotsScrolling":{"interval":200,"frames":[". ",".. ","..."," .."," ."," "]},"star":{"interval":70,"frames":["✶","✸","✹","✺","✹","✷"]},"star2":{"interval":80,"frames":["+","x","*"]},"flip":{"interval":70,"frames":["_","_","_","-","`","`","\'","´","-","_","_","_"]},"hamburger":{"interval":100,"frames":["☱","☲","☴"]},"growVertical":{"interval":120,"frames":["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},"growHorizontal":{"interval":120,"frames":["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},"balloon":{"interval":140,"frames":[" ",".","o","O","@","*"," "]},"balloon2":{"interval":120,"frames":[".","o","O","°","O","o","."]},"noise":{"interval":100,"frames":["▓","▒","░"]},"bounce":{"interval":120,"frames":["⠁","⠂","⠄","⠂"]},"boxBounce":{"interval":120,"frames":["▖","▘","▝","▗"]},"boxBounce2":{"interval":100,"frames":["▌","▀","▐","▄"]},"triangle":{"interval":50,"frames":["◢","◣","◤","◥"]},"arc":{"interval":100,"frames":["◜","◠","◝","◞","◡","◟"]},"circle":{"interval":120,"frames":["◡","⊙","◠"]},"squareCorners":{"interval":180,"frames":["◰","◳","◲","◱"]},"circleQuarters":{"interval":120,"frames":["◴","◷","◶","◵"]},"circleHalves":{"interval":50,"frames":["◐","◓","◑","◒"]},"squish":{"interval":100,"frames":["╫","╪"]},"toggle":{"interval":250,"frames":["⊶","⊷"]},"toggle2":{"interval":80,"frames":["▫","▪"]},"toggle3":{"interval":120,"frames":["□","■"]},"toggle4":{"interval":100,"frames":["■","□","▪","▫"]},"toggle5":{"interval":100,"frames":["▮","▯"]},"toggle6":{"interval":300,"frames":["ဝ","၀"]},"toggle7":{"interval":80,"frames":["⦾","⦿"]},"toggle8":{"interval":100,"frames":["◍","◌"]},"toggle9":{"interval":100,"frames":["◉","◎"]},"toggle10":{"interval":100,"frames":["㊂","㊀","㊁"]},"toggle11":{"interval":50,"frames":["⧇","⧆"]},"toggle12":{"interval":120,"frames":["☗","☖"]},"toggle13":{"interval":80,"frames":["=","*","-"]},"arrow":{"interval":100,"frames":["←","↖","↑","↗","→","↘","↓","↙"]},"arrow2":{"interval":80,"frames":["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},"arrow3":{"interval":120,"frames":["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},"bouncingBar":{"interval":80,"frames":["[ ]","[= ]","[== ]","[=== ]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},"bouncingBall":{"interval":80,"frames":["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},"smiley":{"interval":200,"frames":["😄 ","😝 "]},"monkey":{"interval":300,"frames":["🙈 ","🙈 ","🙉 ","🙊 "]},"hearts":{"interval":100,"frames":["💛 ","💙 ","💜 ","💚 ","❤️ "]},"clock":{"interval":100,"frames":["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},"earth":{"interval":180,"frames":["🌍 ","🌎 ","🌏 "]},"material":{"interval":17,"frames":["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███████▁▁▁▁▁▁▁▁▁▁▁▁▁","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","██████████▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","█████████████▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁██████████████▁▁▁▁","▁▁▁██████████████▁▁▁","▁▁▁▁█████████████▁▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁▁▁████████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","██████▁▁▁▁▁▁▁▁▁▁▁▁▁█","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁▁█████████████▁▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁▁███████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁▁█████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"]},"moon":{"interval":80,"frames":["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},"runner":{"interval":140,"frames":["🚶 ","🏃 "]},"pong":{"interval":80,"frames":["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},"shark":{"interval":120,"frames":["▐|\\\\____________▌","▐_|\\\\___________▌","▐__|\\\\__________▌","▐___|\\\\_________▌","▐____|\\\\________▌","▐_____|\\\\_______▌","▐______|\\\\______▌","▐_______|\\\\_____▌","▐________|\\\\____▌","▐_________|\\\\___▌","▐__________|\\\\__▌","▐___________|\\\\_▌","▐____________|\\\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},"dqpb":{"interval":100,"frames":["d","q","p","b"]},"weather":{"interval":100,"frames":["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},"christmas":{"interval":400,"frames":["🌲","🎄"]},"grenade":{"interval":80,"frames":["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},"point":{"interval":125,"frames":["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},"layer":{"interval":150,"frames":["-","=","≡"]},"betaWave":{"interval":80,"frames":["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]},"fingerDance":{"interval":160,"frames":["🤘 ","🤟 ","🖖 ","✋ ","🤚 ","👆 "]},"fistBump":{"interval":80,"frames":["🤜 🤛 ","🤜 🤛 ","🤜 🤛 "," 🤜 🤛 "," 🤜🤛 "," 🤜✨🤛 ","🤜 ✨ 🤛 "]},"soccerHeader":{"interval":80,"frames":[" 🧑⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 "]},"mindblown":{"interval":160,"frames":["😐 ","😐 ","😮 ","😮 ","😦 ","😦 ","😧 ","😧 ","🤯 ","💥 ","✨ "," "," "," "]},"speaker":{"interval":160,"frames":["🔈 ","🔉 ","🔊 ","🔉 "]},"orangePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 "]},"bluePulse":{"interval":100,"frames":["🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"orangeBluePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 ","🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"timeTravel":{"interval":100,"frames":["🕛 ","🕚 ","🕙 ","🕘 ","🕗 ","🕖 ","🕕 ","🕔 ","🕓 ","🕒 ","🕑 ","🕐 "]},"aesthetic":{"interval":80,"frames":["▰▱▱▱▱▱▱","▰▰▱▱▱▱▱","▰▰▰▱▱▱▱","▰▰▰▰▱▱▱","▰▰▰▰▰▱▱","▰▰▰▰▰▰▱","▰▰▰▰▰▰▰","▰▱▱▱▱▱▱"]}}')},2357:pT=>{"use strict";pT.exports=require("assert")},4293:pT=>{"use strict";pT.exports=require("buffer")},3129:pT=>{"use strict";pT.exports=require("child_process")},8614:pT=>{"use strict";pT.exports=require("events")},5747:pT=>{"use strict";pT.exports=require("fs")},2282:pT=>{"use strict";pT.exports=require("module")},2087:pT=>{"use strict";pT.exports=require("os")},5622:pT=>{"use strict";pT.exports=require("path")},1058:pT=>{"use strict";pT.exports=require("readline")},2413:pT=>{"use strict";pT.exports=require("stream")},3867:pT=>{"use strict";pT.exports=require("tty")},1669:pT=>{"use strict";pT.exports=require("util")}};var xT={};function __nccwpck_require__(OT){var BE=xT[OT];if(BE!==undefined){return BE.exports}var LE=xT[OT]={id:OT,loaded:false,exports:{}};var RE=true;try{pT[OT].call(LE.exports,LE,LE.exports,__nccwpck_require__);RE=false}finally{if(RE)delete xT[OT]}LE.loaded=true;return LE.exports}(()=>{__nccwpck_require__.n=pT=>{var xT=pT&&pT.__esModule?()=>pT["default"]:()=>pT;__nccwpck_require__.d(xT,{a:xT});return xT}})();(()=>{__nccwpck_require__.d=(pT,xT)=>{for(var OT in xT){if(__nccwpck_require__.o(xT,OT)&&!__nccwpck_require__.o(pT,OT)){Object.defineProperty(pT,OT,{enumerable:true,get:xT[OT]})}}}})();(()=>{__nccwpck_require__.o=(pT,xT)=>Object.prototype.hasOwnProperty.call(pT,xT)})();(()=>{__nccwpck_require__.r=pT=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(pT,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(pT,"__esModule",{value:true})}})();(()=>{__nccwpck_require__.nmd=pT=>{pT.paths=[];if(!pT.children)pT.children=[];return pT}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var OT={};(()=>{"use strict";__nccwpck_require__.r(OT);var pT=__nccwpck_require__(1904);var xT=__nccwpck_require__(970);var BE=__nccwpck_require__.n(xT);var LE=__nccwpck_require__(5622);var RE=__nccwpck_require__.n(LE);var ME=__nccwpck_require__(5747);var jE=__nccwpck_require__.n(ME);var VE=__nccwpck_require__(6155);var UE=__nccwpck_require__(7314);var JE=__nccwpck_require__(9882);var qE=__nccwpck_require__(5655);let makeExtractTagsFromSource=pT=>xT=>{const OT=(0,UE.getLocator)(xT);const BE=[];let LE;while((LE=pT.exec(xT))!==null){let pT=OT(LE.index);let xT=OT(LE.index+LE[0].length);BE.push({content:LE[0],start:pT.character,end:xT.character})}return BE};const KE=new RegExp(/(?<=\%relay\([\s]*`)[\s\S.]+?(?=`[\s]*\))/g);const zE=makeExtractTagsFromSource(KE);function prettify(pT){return(0,JE.format)(pT,{parser:"graphql",plugins:[qE]}).replace(/^\s+|\s+$/g,"")}const padOperation=(pT,xT)=>pT.split("\n").map((pT=>" ".repeat(xT)+pT)).join("\n");const GE=new RegExp(/^[\s]*(?=[\w])/g);const $E=new RegExp(/[\s]*$/g);const findOperationPadding=pT=>{const xT=(pT.match(GE)||[]).pop();const OT=(xT||"").split("\n").pop();return OT?OT.length:0};const restoreOperationPadding=(pT,xT)=>{const OT=(xT.match($E)||[]).join("");return"\n"+padOperation(pT,findOperationPadding(xT))+OT};const isNodeInterfaceWithSingleMember=pT=>{var xT;const OT=pT.selectionSet.selections.find((pT=>pT.kind==="Field"&&pT.name.value==="node"));if((OT===null||OT===void 0?void 0:OT.kind)==="Field"){const pT=(xT=OT.selectionSet)===null||xT===void 0?void 0:xT.selections.filter((pT=>pT.kind==="InlineFragment"));return(pT===null||pT===void 0?void 0:pT.length)===1}return false};const namedPathOfAncestors=pT=>(pT||[]).reduce(((pT,xT)=>{var OT,BE;if(Array.isArray(xT)){return pT}const LE=xT;switch(LE.kind){case"Field":return[...pT,LE.name.value];case"InlineFragment":return[...pT,(BE=(OT=LE.typeCondition)===null||OT===void 0?void 0:OT.name.value)!==null&&BE!==void 0?BE:""];default:return pT}}),[]).join("_");const getPathAssets=({unusedFieldPaths:pT,fieldName:xT,ancestors:OT})=>{const BE=namedPathOfAncestors(OT);const LE=BE===""?xT:[namedPathOfAncestors(OT),xT].join("_");const RE=`${LE}.`;const ME=pT.filter((pT=>pT.startsWith(RE))).map((pT=>pT.slice(RE.length)));return{fieldsToRemove:ME,shouldRemoveFullSelection:pT.includes(LE),path:LE,ancestorPath:BE}};const removeUnusedFieldsFromOperation=({definition:pT,unusedFieldPaths:xT})=>{let OT=false;const BE=(0,VE.Vn3)(pT,{InlineFragment(OT,BE,LE,RE,ME){if(OT.typeCondition==null)return OT;const jE=namedPathOfAncestors(ME);const VE=jE==="node"&&isNodeInterfaceWithSingleMember(pT);const UE=VE?jE:[jE,OT.typeCondition.name.value].filter((pT=>pT!=="")).join("_");const JE=`${UE}.`;const qE=xT.filter((pT=>pT.startsWith(JE))).map((pT=>pT.slice(JE.length)));if(qE.length>0){const pT=qE.includes("fragmentRefs");const xT=Object.assign(Object.assign({},OT.selectionSet),{selections:OT.selectionSet.selections.filter((xT=>{var OT,BE;if(xT.kind==="FragmentSpread"&&pT){return false}if(xT.kind==="Field"){const pT=(BE=(OT=xT.alias)===null||OT===void 0?void 0:OT.value)!==null&&BE!==void 0?BE:xT.name.value;return!qE.includes(pT)}return true}))});if(xT.selections.length===0){return null}return Object.assign(Object.assign({},OT),{selectionSet:xT})}return OT},FragmentDefinition(pT){const BE=xT.filter((pT=>!pT.includes(".")));const LE=BE.includes("fragmentRefs");if(BE.length>0){const xT=Object.assign(Object.assign({},pT.selectionSet),{selections:pT.selectionSet.selections.filter((pT=>{var xT,OT;if(pT.kind==="FragmentSpread"&&LE){return false}if(pT.kind==="Field"){const LE=(OT=(xT=pT.alias)===null||xT===void 0?void 0:xT.value)!==null&&OT!==void 0?OT:pT.name.value;return!BE.includes(LE)}return true}))});if(xT.selections.length===0){OT=true;return VE.$_X}return Object.assign(Object.assign({},pT),{selectionSet:xT})}return pT},OperationDefinition(pT){if(pT.operation!=="query"){return pT}const BE=xT.filter((pT=>!pT.includes(".")));const LE=BE.includes("fragmentRefs");if(BE.length>0){const xT=Object.assign(Object.assign({},pT.selectionSet),{selections:pT.selectionSet.selections.filter((pT=>{var xT,OT;if(pT.kind==="FragmentSpread"&&LE){return false}if(pT.kind==="Field"){const LE=(OT=(xT=pT.alias)===null||xT===void 0?void 0:xT.value)!==null&&OT!==void 0?OT:pT.name.value;return!BE.includes(LE)}return true}))});if(xT.selections.length===0){OT=true;return VE.$_X}return Object.assign(Object.assign({},pT),{selectionSet:xT})}return pT},Field(pT,OT,BE,LE,RE){var ME,jE,VE,UE;const JE=(jE=(ME=pT.alias)===null||ME===void 0?void 0:ME.value)!==null&&jE!==void 0?jE:pT.name.value;const{fieldsToRemove:qE,shouldRemoveFullSelection:KE}=getPathAssets({unusedFieldPaths:xT,fieldName:JE,ancestors:RE});if(KE){return null}if(qE.length>0){const xT=qE.includes("fragmentRefs");const OT=(UE=(VE=pT.selectionSet)===null||VE===void 0?void 0:VE.selections)===null||UE===void 0?void 0:UE.filter((pT=>{var OT,BE;if(pT.kind==="FragmentSpread"&&xT){return false}if(pT.kind==="Field"){const xT=(BE=(OT=pT.alias)===null||OT===void 0?void 0:OT.value)!==null&&BE!==void 0?BE:pT.name.value;return!qE.includes(xT)}return true}));const BE={kind:"Field",name:{kind:"Name",value:"__typename"}};return Object.assign(Object.assign({},pT),{selectionSet:{kind:"SelectionSet",selections:(OT===null||OT===void 0?void 0:OT.length)===0?[BE]:OT}})}return pT}});if(OT){return null}return BE};const WE=new RegExp(/(?<=__generated__\/)[A-Za-z_0-9]+(?=_graphql\.res)/g);const YE=new RegExp(/(?<=Types\.(fragment|response)[_.])[A-Za-z_.0-9]+(?= )/g);const HE=new RegExp(/Types\.(fragment|response)/g);const processReanalyzeOutput=pT=>{const xT=pT.split(/\n\n/g).filter((pT=>pT.match(HE))).reduce(((pT,xT)=>{var OT,BE;const LE=xT.includes("Types.fragment")?"fragment":"query";const RE=(OT=xT.match(WE))===null||OT===void 0?void 0:OT[0];const ME=RE==null?null:`${RE}_graphql.res`;const jE=(BE=xT.match(YE))===null||BE===void 0?void 0:BE[0];if(LE==="query"&&!(RE===null||RE===void 0?void 0:RE.toLowerCase().endsWith("query"))){return pT}if(jE==="id"){return pT}if(jE===null||jE===void 0?void 0:jE.endsWith("__typename")){return pT}if(RE==null||jE==null||ME==null){return pT}pT[ME]=pT[ME]||{type:LE,graphqlName:RE,unusedFieldPaths:[]};pT[ME].unusedFieldPaths.push(jE);return pT}),{});return xT};const maybePluralize=(pT,xT)=>{if(xT===1){return`${xT} ${pT}`}return`${xT} ${pT}s`};var XE=__nccwpck_require__(7519);var QE=__nccwpck_require__.n(XE);var ZE=__nccwpck_require__(6743);var eC=__nccwpck_require__.n(ZE);var tC=undefined&&undefined.__awaiter||function(pT,xT,OT,BE){function adopt(pT){return pT instanceof OT?pT:new OT((function(xT){xT(pT)}))}return new(OT||(OT=Promise))((function(OT,LE){function fulfilled(pT){try{step(BE.next(pT))}catch(pT){LE(pT)}}function rejected(pT){try{step(BE["throw"](pT))}catch(pT){LE(pT)}}function step(pT){pT.done?OT(pT.value):adopt(pT.value).then(fulfilled,rejected)}step((BE=BE.apply(pT,xT||[])).next())}))};const loadRelayConfig=()=>{const pT=eC().loadConfig();if(!pT){console.error("Could not find relay.config.js. You must configure Relay through relay.config.js for RescriptRelay to work.");process.exit(1)}if(!pT.artifactDirectory){console.error("RescriptRelay requires you to define 'artifactDirectory' (for outputing generated files in a single directory) in your relay.config.js. Please define it and re-run this command.");process.exit(1)}return pT};const getRelayArtifactDirectoryLocation=pT=>{const xT=RE().resolve(RE().join(process.cwd(),pT.artifactDirectory));return xT};const getAllGeneratedFiles=pT=>tC(void 0,void 0,void 0,(function*(){const xT=yield QE()(`${pT}/*.res`,{absolute:true,onlyFiles:true});return xT}));const rC=new RegExp(/(?<=\/\* @sourceLoc )[A-Za-z_.0-9]+(?= \*\/)/g);const findAllSourceFilesFromGeneratedFiles=(pT,xT)=>tC(void 0,void 0,void 0,(function*(){const OT=yield Promise.all(pT.map((pT=>tC(void 0,void 0,void 0,(function*(){var OT;if(xT!=null){xT.text=`Checking ${RE().basename(pT)}...`}const BE=yield jE().promises.readFile(pT,{encoding:"utf-8"});return(OT=BE.match(rC))===null||OT===void 0?void 0:OT[0]})))));const BE=OT.reduce(((pT,xT)=>{if(xT!=null){const OT=xT;if(!pT.includes(OT)){pT.push(OT)}return pT}return pT}),[]);return BE}));const getSrcCwd=pT=>RE().resolve(RE().join(process.cwd(),pT));const findSourceFiles=(pT,xT)=>tC(void 0,void 0,void 0,(function*(){const OT=getSrcCwd(xT);const BE=yield QE()(pT.map((pT=>`**/${pT}`)),{cwd:OT,absolute:true,onlyFiles:true});return BE}));const formatOperationsInDocument=pT=>{const xT=zE(pT);if(xT.length===0){return pT}let OT="";for(let BE=0;BE<=xT.length-1;BE+=1){const LE=xT[BE];const RE=xT[BE-1];const ME=RE==null?0:RE.end;OT+=pT.slice(ME,LE.start);OT+=restoreOperationPadding(prettify(LE.content),LE.content)}const BE=xT[xT.length-1];OT+=pT.slice(BE.end);return OT};var nC=undefined&&undefined.__awaiter||function(pT,xT,OT,BE){function adopt(pT){return pT instanceof OT?pT:new OT((function(xT){xT(pT)}))}return new(OT||(OT=Promise))((function(OT,LE){function fulfilled(pT){try{step(BE.next(pT))}catch(pT){LE(pT)}}function rejected(pT){try{step(BE["throw"](pT))}catch(pT){LE(pT)}}function step(pT){pT.done?OT(pT.value):adopt(pT.value).then(fulfilled,rejected)}step((BE=BE.apply(pT,xT||[])).next())}))};const addFormatGraphQLCommands=pT=>{pT.command("format-all-graphql").option("--ci","CI mode: Exit if unformatted files are encountered.").description("Format all GraphQL operations in project.").action((({ci:pT})=>nC(void 0,void 0,void 0,(function*(){const xT=loadRelayConfig();const OT=getRelayArtifactDirectoryLocation(xT);const LE=BE()("Findings files to format").start();const ME=yield getAllGeneratedFiles(OT);const VE=yield findAllSourceFilesFromGeneratedFiles(ME,LE);LE.text=`Searching for ${maybePluralize("source file",VE.length)}.`;const UE=yield findSourceFiles(VE,xT.src);const JE=yield Promise.all(UE.map((xT=>nC(void 0,void 0,void 0,(function*(){LE.text=`${pT?"Checking":"Formatting"} "${RE().basename(xT)}".`;const OT=yield jE().promises.readFile(xT,{encoding:"utf-8"});const BE=formatOperationsInDocument(OT);if(OT!==BE&&!pT){yield jE().promises.writeFile(xT,BE)}return OT!==BE})))));const qE=JE.filter((pT=>pT===true)).length;if(pT){if(qE===0){LE.succeed(`Done! None of ${maybePluralize("file",UE.length)} in need of formatting.`);process.exit(0)}else{LE.fail(`${maybePluralize("file",qE)} needs formatting.`);process.exit(1)}}else{if(qE===0){LE.succeed(`Done! None of ${maybePluralize("scanned file",UE.length)} needed formatting.`)}else{LE.succeed(`Done! Formatted ${maybePluralize("file",qE)} of ${maybePluralize("scanned file",UE.length)}.`)}}}))));pT.command("format-single-graphql").description("Format GraphQL operations in single file.").argument("<file>","Path to file to format. Must be absolute.").action((pT=>nC(void 0,void 0,void 0,(function*(){const xT=BE()("Formatting file..").start();const OT=yield jE().promises.stat(pT,{throwIfNoEntry:false});if(OT==null){xT.fail("File does not exist.");process.exit(1)}try{const OT=yield jE().promises.readFile(pT,{encoding:"utf-8"});const BE=formatOperationsInDocument(OT);if(OT!==BE){yield jE().promises.writeFile(pT,BE);xT.succeed("Successfully formatted file.")}else{xT.succeed("File already formatted.")}}catch(pT){xT.fail("Could not format file.");process.exit(1)}}))))};var iC=undefined&&undefined.__awaiter||function(pT,xT,OT,BE){function adopt(pT){return pT instanceof OT?pT:new OT((function(xT){xT(pT)}))}return new(OT||(OT=Promise))((function(OT,LE){function fulfilled(pT){try{step(BE.next(pT))}catch(pT){LE(pT)}}function rejected(pT){try{step(BE["throw"](pT))}catch(pT){LE(pT)}}function step(pT){pT.done?OT(pT.value):adopt(pT.value).then(fulfilled,rejected)}step((BE=BE.apply(pT,xT||[])).next())}))};const addDebugCommand=pT=>{pT.command("debug").description("Prints debug information for the CLI.").action((()=>iC(void 0,void 0,void 0,(function*(){const pT=loadRelayConfig();const xT=getRelayArtifactDirectoryLocation(pT);console.log(`Artifact directory location: ${xT}\n`);console.log("Getting all generated files...\n");const OT=yield getAllGeneratedFiles(xT);console.log(`Number of generated files found in artifact directory: ${OT.length}\n`);console.log("Looking up source files\n");const BE=yield findAllSourceFilesFromGeneratedFiles(OT);console.log(`Found ${BE.length} source locations with explicit definitions.\n`);console.log("Looking up source files..\n");const LE=yield findSourceFiles(BE,pT.src);console.log(`Found ${LE.length} actual source files, when looking in ${getSrcCwd(pT.src)}.\n`);console.log("Done!")}))))};var aC=__nccwpck_require__(3129);var oC=__nccwpck_require__.n(aC);var sC=undefined&&undefined.__awaiter||function(pT,xT,OT,BE){function adopt(pT){return pT instanceof OT?pT:new OT((function(xT){xT(pT)}))}return new(OT||(OT=Promise))((function(OT,LE){function fulfilled(pT){try{step(BE.next(pT))}catch(pT){LE(pT)}}function rejected(pT){try{step(BE["throw"](pT))}catch(pT){LE(pT)}}function step(pT){pT.done?OT(pT.value):adopt(pT.value).then(fulfilled,rejected)}step((BE=BE.apply(pT,xT||[])).next())}))};const addRemoveUnusedFieldsCommand=pT=>{pT.command("remove-unused-fields").option("--verbose","Verbose mode").option("--debug","Debug mode").option("--ci","CI mode: Exit if unused fields exist, but don't remove them.").description("Remove unused GraphQL selections in fragments in current project.").action((({ci:pT,verbose:xT,debug:OT})=>{var LE;const ME=loadRelayConfig();const UE=getRelayArtifactDirectoryLocation(ME);const JE=BE()("Analyzing ReScript project").start();const qE=oC().spawn("npx",["reanalyze","-dce"]);if(qE.stdout==null){console.error("Something went wrong.");process.exit(1)}let KE="";qE.stdout.on("data",(pT=>{KE+=pT}));(LE=qE.stderr)===null||LE===void 0?void 0:LE.on("data",(pT=>{if(pT.includes("End_of_file")){JE.fail(`Something went wrong trying to analyze the ReScript project. Try cleaning your ReScript project and rebuilding it from scratch before trying again.`)}else{JE.fail(`Something went wrong trying to analyze the ReScript project.`)}if(OT){console.error(pT)}process.exit(1)}));qE.on("close",(()=>sC(void 0,void 0,void 0,(function*(){JE.text="Analyzing GraphQL usage";const BE=processReanalyzeOutput(KE);if(OT){console.log(`Found ${maybePluralize("file",Object.keys(BE).length)} with potentially missing fields.`)}const LE=[];JE.text="Scanning fragment files";if(OT){console.log(`Extracing source locations for ${maybePluralize("files",Object.keys(BE).length)}.`)}yield Promise.all(Object.entries(BE).map((([pT,xT])=>sC(void 0,void 0,void 0,(function*(){var OT;const BE=RE().resolve(UE,pT);try{const pT=yield jE().promises.readFile(BE,{encoding:"utf-8"});const RE=(OT=pT.match(rC))===null||OT===void 0?void 0:OT[0];if(RE!=null){LE.push(Object.assign(Object.assign({},xT),{sourceLocation:RE}))}}catch(pT){console.error(pT)}})))));if(xT&&LE.length>0){console.log(`\n\n------\nUnused fields: \n`,LE.map((pT=>`${pT.type==="fragment"?"Fragment":"Query"} "${pT.graphqlName}" in ${pT.sourceLocation}: \n ${pT.unusedFieldPaths.join("\n ")}`)).join("\n\n"),`\n------\n\n`)}if(pT){if(LE.length===0){JE.succeed("No unused fields found.");process.exit(0)}else{JE.fail(`Found ${LE.length} file(s) with unused fields.`);process.exit(1)}}JE.text=`Findings files to modify`;const qE=LE.map((pT=>({path:pT.sourceLocation,graphqlName:pT.graphqlName})));const GE=yield findSourceFiles(qE.map((pT=>pT.path)),ME.src);const $E=GE.map((pT=>{const xT=LE.find((xT=>pT.endsWith(xT.sourceLocation)));if(xT!=null){return Object.assign(Object.assign({},xT),{absoluteFilePath:pT})}}));JE.text=`Removing unused fields`;yield Promise.all($E.map((pT=>sC(void 0,void 0,void 0,(function*(){var xT;if(pT==null)return;try{const OT=yield jE().promises.readFile(pT.absoluteFilePath,{encoding:"utf-8"});const BE=zE(OT);let LE=null;let RE=null;for(const OT of BE){const BE=(0,VE.Qc3)(OT.content);const ME=BE.definitions[0];if(ME==null){continue}if((ME.kind==="OperationDefinition"||ME.kind==="FragmentDefinition")&&((xT=ME.name)===null||xT===void 0?void 0:xT.value)===pT.graphqlName){LE=BE;RE=OT;break}}if(LE==null||RE==null)return;const ME=LE.definitions[0];if(ME==null||!(ME.kind==="FragmentDefinition"||ME.kind==="OperationDefinition")){return}const UE=removeUnusedFieldsFromOperation({definition:ME,unusedFieldPaths:pT.unusedFieldPaths});const JE=UE==null?"# This module is unused and can be removed":restoreOperationPadding(prettify((0,VE.S0v)(UE)),RE.content);yield jE().promises.writeFile(pT.absoluteFilePath,`${OT.slice(0,RE.start)}${JE}${OT.slice(RE.end)}`)}catch(pT){console.error(pT)}})))));const WE=$E.reduce(((pT,xT)=>{var OT;return pT+((OT=xT===null||xT===void 0?void 0:xT.unusedFieldPaths.length)!==null&&OT!==void 0?OT:0)}),0);if(WE===0){JE.succeed("Done! No unused fields found.")}else{JE.succeed(`Done! Removed ${maybePluralize("field",WE)} from ${maybePluralize("file",$E.length)}.`)}}))))}))};pT.program.version("0.1.0");addFormatGraphQLCommands(pT.program);addDebugCommand(pT.program);addRemoveUnusedFieldsCommand(pT.program);pT.program.parse(process.argv)})();module.exports=OT})();
|
|
478
|
+
*/const BE=OT(5680);const toRegexRange=(pT,xT,OT)=>{if(BE(pT)===false){throw new TypeError("toRegexRange: expected the first argument to be a number")}if(xT===void 0||pT===xT){return String(pT)}if(BE(xT)===false){throw new TypeError("toRegexRange: expected the second argument to be a number.")}let LE={relaxZeros:true,...OT};if(typeof LE.strictZeros==="boolean"){LE.relaxZeros=LE.strictZeros===false}let RE=String(LE.relaxZeros);let ME=String(LE.shorthand);let jE=String(LE.capture);let VE=String(LE.wrap);let UE=pT+":"+xT+"="+RE+ME+jE+VE;if(toRegexRange.cache.hasOwnProperty(UE)){return toRegexRange.cache[UE].result}let JE=Math.min(pT,xT);let qE=Math.max(pT,xT);if(Math.abs(JE-qE)===1){let OT=pT+"|"+xT;if(LE.capture){return`(${OT})`}if(LE.wrap===false){return OT}return`(?:${OT})`}let KE=hasPadding(pT)||hasPadding(xT);let zE={min:pT,max:xT,a:JE,b:qE};let GE=[];let $E=[];if(KE){zE.isPadded=KE;zE.maxLen=String(zE.max).length}if(JE<0){let pT=qE<0?Math.abs(qE):1;$E=splitToPatterns(pT,Math.abs(JE),zE,LE);JE=zE.a=0}if(qE>=0){GE=splitToPatterns(JE,qE,zE,LE)}zE.negatives=$E;zE.positives=GE;zE.result=collatePatterns($E,GE,LE);if(LE.capture===true){zE.result=`(${zE.result})`}else if(LE.wrap!==false&&GE.length+$E.length>1){zE.result=`(?:${zE.result})`}toRegexRange.cache[UE]=zE;return zE.result};function collatePatterns(pT,xT,OT){let BE=filterPatterns(pT,xT,"-",false,OT)||[];let LE=filterPatterns(xT,pT,"",false,OT)||[];let RE=filterPatterns(pT,xT,"-?",true,OT)||[];let ME=BE.concat(RE).concat(LE);return ME.join("|")}function splitToRanges(pT,xT){let OT=1;let BE=1;let LE=countNines(pT,OT);let RE=new Set([xT]);while(pT<=LE&&LE<=xT){RE.add(LE);OT+=1;LE=countNines(pT,OT)}LE=countZeros(xT+1,BE)-1;while(pT<LE&&LE<=xT){RE.add(LE);BE+=1;LE=countZeros(xT+1,BE)-1}RE=[...RE];RE.sort(compare);return RE}function rangeToPattern(pT,xT,OT){if(pT===xT){return{pattern:pT,count:[],digits:0}}let BE=zip(pT,xT);let LE=BE.length;let RE="";let ME=0;for(let pT=0;pT<LE;pT++){let[xT,LE]=BE[pT];if(xT===LE){RE+=xT}else if(xT!=="0"||LE!=="9"){RE+=toCharacterClass(xT,LE,OT)}else{ME++}}if(ME){RE+=OT.shorthand===true?"\\d":"[0-9]"}return{pattern:RE,count:[ME],digits:LE}}function splitToPatterns(pT,xT,OT,BE){let LE=splitToRanges(pT,xT);let RE=[];let ME=pT;let jE;for(let pT=0;pT<LE.length;pT++){let xT=LE[pT];let VE=rangeToPattern(String(ME),String(xT),BE);let UE="";if(!OT.isPadded&&jE&&jE.pattern===VE.pattern){if(jE.count.length>1){jE.count.pop()}jE.count.push(VE.count[0]);jE.string=jE.pattern+toQuantifier(jE.count);ME=xT+1;continue}if(OT.isPadded){UE=padZeros(xT,OT,BE)}VE.string=UE+VE.pattern+toQuantifier(VE.count);RE.push(VE);ME=xT+1;jE=VE}return RE}function filterPatterns(pT,xT,OT,BE,LE){let RE=[];for(let LE of pT){let{string:pT}=LE;if(!BE&&!contains(xT,"string",pT)){RE.push(OT+pT)}if(BE&&contains(xT,"string",pT)){RE.push(OT+pT)}}return RE}function zip(pT,xT){let OT=[];for(let BE=0;BE<pT.length;BE++)OT.push([pT[BE],xT[BE]]);return OT}function compare(pT,xT){return pT>xT?1:xT>pT?-1:0}function contains(pT,xT,OT){return pT.some((pT=>pT[xT]===OT))}function countNines(pT,xT){return Number(String(pT).slice(0,-xT)+"9".repeat(xT))}function countZeros(pT,xT){return pT-pT%Math.pow(10,xT)}function toQuantifier(pT){let[xT=0,OT=""]=pT;if(OT||xT>1){return`{${xT+(OT?","+OT:"")}}`}return""}function toCharacterClass(pT,xT,OT){return`[${pT}${xT-pT===1?"":"-"}${xT}]`}function hasPadding(pT){return/^-?(0+)\d/.test(pT)}function padZeros(pT,xT,OT){if(!xT.isPadded){return pT}let BE=Math.abs(xT.maxLen-String(pT).length);let LE=OT.relaxZeros!==false;switch(BE){case 0:return"";case 1:return LE?"0?":"0";case 2:return LE?"0{0,2}":"00";default:{return LE?`0{0,${BE}}`:`0{${BE}}`}}}toRegexRange.cache={};toRegexRange.clearCache=()=>toRegexRange.cache={};pT.exports=toRegexRange},5278:(pT,xT,OT)=>{pT.exports=OT(1669).deprecate},4383:pT=>{pT.exports=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]]},5917:(pT,xT,OT)=>{"use strict";var BE=OT(732);var LE=OT(4383);var RE={nul:0,control:0};pT.exports=function wcwidth(pT){return wcswidth(pT,RE)};pT.exports.config=function(pT){pT=BE(pT||{},RE);return function wcwidth(xT){return wcswidth(xT,pT)}};function wcswidth(pT,xT){if(typeof pT!=="string")return wcwidth(pT,xT);var OT=0;for(var BE=0;BE<pT.length;BE++){var LE=wcwidth(pT.charCodeAt(BE),xT);if(LE<0)return-1;OT+=LE}return OT}function wcwidth(pT,xT){if(pT===0)return xT.nul;if(pT<32||pT>=127&&pT<160)return xT.control;if(bisearch(pT))return 0;return 1+(pT>=4352&&(pT<=4447||pT==9001||pT==9002||pT>=11904&&pT<=42191&&pT!=12351||pT>=44032&&pT<=55203||pT>=63744&&pT<=64255||pT>=65040&&pT<=65049||pT>=65072&&pT<=65135||pT>=65280&&pT<=65376||pT>=65504&&pT<=65510||pT>=131072&&pT<=196605||pT>=196608&&pT<=262141))}function bisearch(pT){var xT=0;var OT=LE.length-1;var BE;if(pT<LE[0][0]||pT>LE[OT][1])return false;while(OT>=xT){BE=Math.floor((xT+OT)/2);if(pT>LE[BE][1])xT=BE+1;else if(pT<LE[BE][0])OT=BE-1;else return true}return false}},6615:pT=>{"use strict";pT.exports=JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},"dots2":{"interval":80,"frames":["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},"dots3":{"interval":80,"frames":["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},"dots4":{"interval":80,"frames":["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},"dots5":{"interval":80,"frames":["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},"dots6":{"interval":80,"frames":["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},"dots7":{"interval":80,"frames":["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},"dots8":{"interval":80,"frames":["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},"dots9":{"interval":80,"frames":["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},"dots10":{"interval":80,"frames":["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},"dots11":{"interval":100,"frames":["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},"dots12":{"interval":80,"frames":["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},"dots8Bit":{"interval":80,"frames":["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},"line":{"interval":130,"frames":["-","\\\\","|","/"]},"line2":{"interval":100,"frames":["⠂","-","–","—","–","-"]},"pipe":{"interval":100,"frames":["┤","┘","┴","└","├","┌","┬","┐"]},"simpleDots":{"interval":400,"frames":[". ",".. ","..."," "]},"simpleDotsScrolling":{"interval":200,"frames":[". ",".. ","..."," .."," ."," "]},"star":{"interval":70,"frames":["✶","✸","✹","✺","✹","✷"]},"star2":{"interval":80,"frames":["+","x","*"]},"flip":{"interval":70,"frames":["_","_","_","-","`","`","\'","´","-","_","_","_"]},"hamburger":{"interval":100,"frames":["☱","☲","☴"]},"growVertical":{"interval":120,"frames":["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},"growHorizontal":{"interval":120,"frames":["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},"balloon":{"interval":140,"frames":[" ",".","o","O","@","*"," "]},"balloon2":{"interval":120,"frames":[".","o","O","°","O","o","."]},"noise":{"interval":100,"frames":["▓","▒","░"]},"bounce":{"interval":120,"frames":["⠁","⠂","⠄","⠂"]},"boxBounce":{"interval":120,"frames":["▖","▘","▝","▗"]},"boxBounce2":{"interval":100,"frames":["▌","▀","▐","▄"]},"triangle":{"interval":50,"frames":["◢","◣","◤","◥"]},"arc":{"interval":100,"frames":["◜","◠","◝","◞","◡","◟"]},"circle":{"interval":120,"frames":["◡","⊙","◠"]},"squareCorners":{"interval":180,"frames":["◰","◳","◲","◱"]},"circleQuarters":{"interval":120,"frames":["◴","◷","◶","◵"]},"circleHalves":{"interval":50,"frames":["◐","◓","◑","◒"]},"squish":{"interval":100,"frames":["╫","╪"]},"toggle":{"interval":250,"frames":["⊶","⊷"]},"toggle2":{"interval":80,"frames":["▫","▪"]},"toggle3":{"interval":120,"frames":["□","■"]},"toggle4":{"interval":100,"frames":["■","□","▪","▫"]},"toggle5":{"interval":100,"frames":["▮","▯"]},"toggle6":{"interval":300,"frames":["ဝ","၀"]},"toggle7":{"interval":80,"frames":["⦾","⦿"]},"toggle8":{"interval":100,"frames":["◍","◌"]},"toggle9":{"interval":100,"frames":["◉","◎"]},"toggle10":{"interval":100,"frames":["㊂","㊀","㊁"]},"toggle11":{"interval":50,"frames":["⧇","⧆"]},"toggle12":{"interval":120,"frames":["☗","☖"]},"toggle13":{"interval":80,"frames":["=","*","-"]},"arrow":{"interval":100,"frames":["←","↖","↑","↗","→","↘","↓","↙"]},"arrow2":{"interval":80,"frames":["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},"arrow3":{"interval":120,"frames":["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},"bouncingBar":{"interval":80,"frames":["[ ]","[= ]","[== ]","[=== ]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},"bouncingBall":{"interval":80,"frames":["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},"smiley":{"interval":200,"frames":["😄 ","😝 "]},"monkey":{"interval":300,"frames":["🙈 ","🙈 ","🙉 ","🙊 "]},"hearts":{"interval":100,"frames":["💛 ","💙 ","💜 ","💚 ","❤️ "]},"clock":{"interval":100,"frames":["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},"earth":{"interval":180,"frames":["🌍 ","🌎 ","🌏 "]},"material":{"interval":17,"frames":["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███████▁▁▁▁▁▁▁▁▁▁▁▁▁","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","██████████▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","█████████████▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁██████████████▁▁▁▁","▁▁▁██████████████▁▁▁","▁▁▁▁█████████████▁▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁▁▁████████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","██████▁▁▁▁▁▁▁▁▁▁▁▁▁█","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁▁█████████████▁▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁▁███████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁▁█████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"]},"moon":{"interval":80,"frames":["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},"runner":{"interval":140,"frames":["🚶 ","🏃 "]},"pong":{"interval":80,"frames":["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},"shark":{"interval":120,"frames":["▐|\\\\____________▌","▐_|\\\\___________▌","▐__|\\\\__________▌","▐___|\\\\_________▌","▐____|\\\\________▌","▐_____|\\\\_______▌","▐______|\\\\______▌","▐_______|\\\\_____▌","▐________|\\\\____▌","▐_________|\\\\___▌","▐__________|\\\\__▌","▐___________|\\\\_▌","▐____________|\\\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},"dqpb":{"interval":100,"frames":["d","q","p","b"]},"weather":{"interval":100,"frames":["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},"christmas":{"interval":400,"frames":["🌲","🎄"]},"grenade":{"interval":80,"frames":["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},"point":{"interval":125,"frames":["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},"layer":{"interval":150,"frames":["-","=","≡"]},"betaWave":{"interval":80,"frames":["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]},"fingerDance":{"interval":160,"frames":["🤘 ","🤟 ","🖖 ","✋ ","🤚 ","👆 "]},"fistBump":{"interval":80,"frames":["🤜 🤛 ","🤜 🤛 ","🤜 🤛 "," 🤜 🤛 "," 🤜🤛 "," 🤜✨🤛 ","🤜 ✨ 🤛 "]},"soccerHeader":{"interval":80,"frames":[" 🧑⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 "]},"mindblown":{"interval":160,"frames":["😐 ","😐 ","😮 ","😮 ","😦 ","😦 ","😧 ","😧 ","🤯 ","💥 ","✨ "," "," "," "]},"speaker":{"interval":160,"frames":["🔈 ","🔉 ","🔊 ","🔉 "]},"orangePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 "]},"bluePulse":{"interval":100,"frames":["🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"orangeBluePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 ","🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"timeTravel":{"interval":100,"frames":["🕛 ","🕚 ","🕙 ","🕘 ","🕗 ","🕖 ","🕕 ","🕔 ","🕓 ","🕒 ","🕑 ","🕐 "]},"aesthetic":{"interval":80,"frames":["▰▱▱▱▱▱▱","▰▰▱▱▱▱▱","▰▰▰▱▱▱▱","▰▰▰▰▱▱▱","▰▰▰▰▰▱▱","▰▰▰▰▰▰▱","▰▰▰▰▰▰▰","▰▱▱▱▱▱▱"]}}')},2357:pT=>{"use strict";pT.exports=require("assert")},4293:pT=>{"use strict";pT.exports=require("buffer")},3129:pT=>{"use strict";pT.exports=require("child_process")},8614:pT=>{"use strict";pT.exports=require("events")},5747:pT=>{"use strict";pT.exports=require("fs")},2282:pT=>{"use strict";pT.exports=require("module")},2087:pT=>{"use strict";pT.exports=require("os")},5622:pT=>{"use strict";pT.exports=require("path")},1058:pT=>{"use strict";pT.exports=require("readline")},2413:pT=>{"use strict";pT.exports=require("stream")},3867:pT=>{"use strict";pT.exports=require("tty")},1669:pT=>{"use strict";pT.exports=require("util")}};var xT={};function __nccwpck_require__(OT){var BE=xT[OT];if(BE!==undefined){return BE.exports}var LE=xT[OT]={id:OT,loaded:false,exports:{}};var RE=true;try{pT[OT].call(LE.exports,LE,LE.exports,__nccwpck_require__);RE=false}finally{if(RE)delete xT[OT]}LE.loaded=true;return LE.exports}(()=>{__nccwpck_require__.n=pT=>{var xT=pT&&pT.__esModule?()=>pT["default"]:()=>pT;__nccwpck_require__.d(xT,{a:xT});return xT}})();(()=>{__nccwpck_require__.d=(pT,xT)=>{for(var OT in xT){if(__nccwpck_require__.o(xT,OT)&&!__nccwpck_require__.o(pT,OT)){Object.defineProperty(pT,OT,{enumerable:true,get:xT[OT]})}}}})();(()=>{__nccwpck_require__.o=(pT,xT)=>Object.prototype.hasOwnProperty.call(pT,xT)})();(()=>{__nccwpck_require__.r=pT=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(pT,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(pT,"__esModule",{value:true})}})();(()=>{__nccwpck_require__.nmd=pT=>{pT.paths=[];if(!pT.children)pT.children=[];return pT}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var OT={};(()=>{"use strict";__nccwpck_require__.r(OT);var pT=__nccwpck_require__(1904);var xT=__nccwpck_require__(970);var BE=__nccwpck_require__.n(xT);var LE=__nccwpck_require__(5622);var RE=__nccwpck_require__.n(LE);var ME=__nccwpck_require__(5747);var jE=__nccwpck_require__.n(ME);var VE=__nccwpck_require__(6155);var UE=__nccwpck_require__(7314);var JE=__nccwpck_require__(9882);var qE=__nccwpck_require__(5655);let makeExtractTagsFromSource=pT=>xT=>{const OT=(0,UE.getLocator)(xT);const BE=[];let LE;while((LE=pT.exec(xT))!==null){let pT=OT(LE.index);let xT=OT(LE.index+LE[0].length);BE.push({content:LE[0],start:pT.character,end:xT.character})}return BE};const KE=new RegExp(/(?<=\%relay\([\s]*`)[\s\S.]+?(?=`[\s]*\))/g);const zE=makeExtractTagsFromSource(KE);function prettify(pT){return(0,JE.format)(pT,{parser:"graphql",plugins:[qE]}).replace(/^\s+|\s+$/g,"")}const padOperation=(pT,xT)=>pT.split("\n").map((pT=>" ".repeat(xT)+pT)).join("\n");const GE=new RegExp(/^[\s]*(?=[\w])/g);const $E=new RegExp(/[\s]*$/g);const findOperationPadding=pT=>{const xT=(pT.match(GE)||[]).pop();const OT=(xT||"").split("\n").pop();return OT?OT.length:0};const restoreOperationPadding=(pT,xT)=>{const OT=(xT.match($E)||[]).join("");return"\n"+padOperation(pT,findOperationPadding(xT))+OT};const isNodeInterfaceWithSingleMember=pT=>{var xT;const OT=pT.selectionSet.selections.find((pT=>pT.kind==="Field"&&pT.name.value==="node"));if((OT===null||OT===void 0?void 0:OT.kind)==="Field"){const pT=(xT=OT.selectionSet)===null||xT===void 0?void 0:xT.selections.filter((pT=>pT.kind==="InlineFragment"));return(pT===null||pT===void 0?void 0:pT.length)===1}return false};const namedPathOfAncestors=pT=>(pT||[]).reduce(((pT,xT)=>{var OT,BE;if(Array.isArray(xT)){return pT}const LE=xT;switch(LE.kind){case"Field":return[...pT,LE.name.value];case"InlineFragment":return[...pT,(BE=(OT=LE.typeCondition)===null||OT===void 0?void 0:OT.name.value)!==null&&BE!==void 0?BE:""];default:return pT}}),[]).join("_");const getPathAssets=({unusedFieldPaths:pT,fieldName:xT,ancestors:OT})=>{const BE=namedPathOfAncestors(OT);const LE=BE===""?xT:[namedPathOfAncestors(OT),xT].join("_");const RE=`${LE}.`;const ME=pT.filter((pT=>pT.startsWith(RE))).map((pT=>pT.slice(RE.length)));return{fieldsToRemove:ME,shouldRemoveFullSelection:pT.includes(LE),path:LE,ancestorPath:BE}};const removeUnusedFieldsFromOperation=({definition:pT,unusedFieldPaths:xT})=>{let OT=false;const BE=(0,VE.Vn3)(pT,{InlineFragment(OT,BE,LE,RE,ME){if(OT.typeCondition==null)return OT;const jE=namedPathOfAncestors(ME);const VE=jE==="node"&&isNodeInterfaceWithSingleMember(pT);const UE=VE?jE:[jE,OT.typeCondition.name.value].filter((pT=>pT!=="")).join("_");const JE=`${UE}.`;const qE=xT.filter((pT=>pT.startsWith(JE))).map((pT=>pT.slice(JE.length)));if(qE.length>0){const pT=qE.includes("fragmentRefs");const xT=Object.assign(Object.assign({},OT.selectionSet),{selections:OT.selectionSet.selections.filter((xT=>{var OT,BE;if(xT.kind==="FragmentSpread"&&pT){return false}if(xT.kind==="Field"){const pT=(BE=(OT=xT.alias)===null||OT===void 0?void 0:OT.value)!==null&&BE!==void 0?BE:xT.name.value;return!qE.includes(pT)}return true}))});if(xT.selections.length===0){return null}return Object.assign(Object.assign({},OT),{selectionSet:xT})}return OT},FragmentDefinition(pT){const BE=xT.filter((pT=>!pT.includes(".")));const LE=BE.includes("fragmentRefs");if(BE.length>0){const xT=Object.assign(Object.assign({},pT.selectionSet),{selections:pT.selectionSet.selections.filter((pT=>{var xT,OT;if(pT.kind==="FragmentSpread"&&LE){return false}if(pT.kind==="Field"){const LE=(OT=(xT=pT.alias)===null||xT===void 0?void 0:xT.value)!==null&&OT!==void 0?OT:pT.name.value;return!BE.includes(LE)}return true}))});if(xT.selections.length===0){OT=true;return VE.$_X}return Object.assign(Object.assign({},pT),{selectionSet:xT})}return pT},OperationDefinition(pT){if(pT.operation!=="query"){return pT}const BE=xT.filter((pT=>!pT.includes(".")));const LE=BE.includes("fragmentRefs");if(BE.length>0){const xT=Object.assign(Object.assign({},pT.selectionSet),{selections:pT.selectionSet.selections.filter((pT=>{var xT,OT;if(pT.kind==="FragmentSpread"&&LE){return false}if(pT.kind==="Field"){const LE=(OT=(xT=pT.alias)===null||xT===void 0?void 0:xT.value)!==null&&OT!==void 0?OT:pT.name.value;return!BE.includes(LE)}return true}))});if(xT.selections.length===0){OT=true;return VE.$_X}return Object.assign(Object.assign({},pT),{selectionSet:xT})}return pT},Field(pT,OT,BE,LE,RE){var ME,jE,VE,UE;const JE=(jE=(ME=pT.alias)===null||ME===void 0?void 0:ME.value)!==null&&jE!==void 0?jE:pT.name.value;const{fieldsToRemove:qE,shouldRemoveFullSelection:KE}=getPathAssets({unusedFieldPaths:xT,fieldName:JE,ancestors:RE});if(KE){return null}if(qE.length>0){const xT=qE.includes("fragmentRefs");const OT=(UE=(VE=pT.selectionSet)===null||VE===void 0?void 0:VE.selections)===null||UE===void 0?void 0:UE.filter((pT=>{var OT,BE;if(pT.kind==="FragmentSpread"&&xT){return false}if(pT.kind==="Field"){const xT=(BE=(OT=pT.alias)===null||OT===void 0?void 0:OT.value)!==null&&BE!==void 0?BE:pT.name.value;return!qE.includes(xT)}return true}));const BE={kind:"Field",name:{kind:"Name",value:"__typename"}};return Object.assign(Object.assign({},pT),{selectionSet:{kind:"SelectionSet",selections:(OT===null||OT===void 0?void 0:OT.length)===0?[BE]:OT}})}return pT}});if(OT){return null}return BE};const WE=new RegExp(/(?<=__generated__\/)[A-Za-z_0-9]+(?=_graphql\.res)/g);const YE=new RegExp(/(?<=Types\.(fragment|response)[_.])[A-Za-z_.0-9]+(?= )/g);const HE=new RegExp(/Types\.(fragment|response)/g);const processReanalyzeOutput=pT=>{const xT=pT.split(/\n\n/g).filter((pT=>pT.match(HE))).reduce(((pT,xT)=>{var OT,BE;const LE=xT.includes("Types.fragment")?"fragment":"query";const RE=(OT=xT.match(WE))===null||OT===void 0?void 0:OT[0];const ME=RE==null?null:`${RE}_graphql.res`;const jE=(BE=xT.match(YE))===null||BE===void 0?void 0:BE[0];if(LE==="query"&&!(RE===null||RE===void 0?void 0:RE.toLowerCase().endsWith("query"))){return pT}if(jE==="id"){return pT}if(jE===null||jE===void 0?void 0:jE.endsWith("__typename")){return pT}if(RE==null||jE==null||ME==null){return pT}pT[ME]=pT[ME]||{type:LE,graphqlName:RE,unusedFieldPaths:[]};pT[ME].unusedFieldPaths.push(jE);return pT}),{});return xT};const maybePluralize=(pT,xT)=>{if(xT===1){return`${xT} ${pT}`}return`${xT} ${pT}s`};var XE=__nccwpck_require__(7519);var QE=__nccwpck_require__.n(XE);var ZE=__nccwpck_require__(6743);var eC=__nccwpck_require__.n(ZE);var tC=undefined&&undefined.__awaiter||function(pT,xT,OT,BE){function adopt(pT){return pT instanceof OT?pT:new OT((function(xT){xT(pT)}))}return new(OT||(OT=Promise))((function(OT,LE){function fulfilled(pT){try{step(BE.next(pT))}catch(pT){LE(pT)}}function rejected(pT){try{step(BE["throw"](pT))}catch(pT){LE(pT)}}function step(pT){pT.done?OT(pT.value):adopt(pT.value).then(fulfilled,rejected)}step((BE=BE.apply(pT,xT||[])).next())}))};const loadRelayConfig=()=>{const pT=eC().loadConfig();if(!pT){console.error("Could not find relay.config.js. You must configure Relay through relay.config.js for RescriptRelay to work.");process.exit(1)}if(!pT.artifactDirectory){console.error("RescriptRelay requires you to define 'artifactDirectory' (for outputing generated files in a single directory) in your relay.config.js. Please define it and re-run this command.");process.exit(1)}return pT};const getRelayArtifactDirectoryLocation=pT=>{const xT=RE().resolve(RE().join(process.cwd(),pT.artifactDirectory));return xT};const getAllGeneratedFiles=pT=>tC(void 0,void 0,void 0,(function*(){const xT=yield QE()(`${pT}/*.res`,{absolute:true,onlyFiles:true});return xT}));const rC=new RegExp(/(?<=\/\* @sourceLoc )[A-Za-z_.0-9]+(?= \*\/)/g);const findAllSourceFilesFromGeneratedFiles=(pT,xT)=>tC(void 0,void 0,void 0,(function*(){const OT=yield Promise.all(pT.map((pT=>tC(void 0,void 0,void 0,(function*(){var OT;if(xT!=null){xT.text=`Checking ${RE().basename(pT)}...`}const BE=yield jE().promises.readFile(pT,{encoding:"utf-8"});return(OT=BE.match(rC))===null||OT===void 0?void 0:OT[0]})))));const BE=OT.reduce(((pT,xT)=>{if(xT!=null){const OT=xT;if(!pT.includes(OT)){pT.push(OT)}return pT}return pT}),[]);return BE}));const getSrcCwd=pT=>RE().resolve(RE().join(process.cwd(),pT));const findSourceFiles=(pT,xT)=>tC(void 0,void 0,void 0,(function*(){const OT=getSrcCwd(xT);const BE=yield QE()(pT.map((pT=>`**/${pT}`)),{cwd:OT,absolute:true,onlyFiles:true});return BE}));const formatOperationsInDocument=pT=>{const xT=zE(pT);if(xT.length===0){return pT}let OT="";for(let BE=0;BE<=xT.length-1;BE+=1){const LE=xT[BE];const RE=xT[BE-1];const ME=RE==null?0:RE.end;OT+=pT.slice(ME,LE.start);OT+=restoreOperationPadding(prettify(LE.content),LE.content)}const BE=xT[xT.length-1];OT+=pT.slice(BE.end);return OT};var nC=undefined&&undefined.__awaiter||function(pT,xT,OT,BE){function adopt(pT){return pT instanceof OT?pT:new OT((function(xT){xT(pT)}))}return new(OT||(OT=Promise))((function(OT,LE){function fulfilled(pT){try{step(BE.next(pT))}catch(pT){LE(pT)}}function rejected(pT){try{step(BE["throw"](pT))}catch(pT){LE(pT)}}function step(pT){pT.done?OT(pT.value):adopt(pT.value).then(fulfilled,rejected)}step((BE=BE.apply(pT,xT||[])).next())}))};const addFormatGraphQLCommands=pT=>{pT.command("format-all-graphql").option("--ci","CI mode: Exit if unformatted files are encountered.").description("Format all GraphQL operations in project.").action((({ci:pT})=>nC(void 0,void 0,void 0,(function*(){const xT=loadRelayConfig();const OT=getRelayArtifactDirectoryLocation(xT);const LE=BE()("Findings files to format").start();const ME=yield getAllGeneratedFiles(OT);const VE=yield findAllSourceFilesFromGeneratedFiles(ME,LE);LE.text=`Searching for ${maybePluralize("source file",VE.length)}.`;const UE=yield findSourceFiles(VE,xT.src);const JE=yield Promise.all(UE.map((xT=>nC(void 0,void 0,void 0,(function*(){LE.text=`${pT?"Checking":"Formatting"} "${RE().basename(xT)}".`;const OT=yield jE().promises.readFile(xT,{encoding:"utf-8"});const BE=formatOperationsInDocument(OT);if(OT!==BE&&!pT){yield jE().promises.writeFile(xT,BE)}return OT!==BE})))));const qE=JE.filter((pT=>pT===true)).length;if(pT){if(qE===0){LE.succeed(`Done! None of ${maybePluralize("file",UE.length)} in need of formatting.`);process.exit(0)}else{LE.fail(`${maybePluralize("file",qE)} needs formatting.`);process.exit(1)}}else{if(qE===0){LE.succeed(`Done! None of ${maybePluralize("scanned file",UE.length)} needed formatting.`)}else{LE.succeed(`Done! Formatted ${maybePluralize("file",qE)} of ${maybePluralize("scanned file",UE.length)}.`)}}}))));pT.command("format-single-graphql").description("Format GraphQL operations in single file.").argument("<file>","Path to file to format. Must be absolute.").action((pT=>nC(void 0,void 0,void 0,(function*(){const xT=BE()("Formatting file..").start();const OT=yield jE().promises.stat(pT,{throwIfNoEntry:false});if(OT==null){xT.fail("File does not exist.");process.exit(1)}try{const OT=yield jE().promises.readFile(pT,{encoding:"utf-8"});const BE=formatOperationsInDocument(OT);if(OT!==BE){yield jE().promises.writeFile(pT,BE);xT.succeed("Successfully formatted file.")}else{xT.succeed("File already formatted.")}}catch(pT){xT.fail("Could not format file.");process.exit(1)}}))))};var iC=undefined&&undefined.__awaiter||function(pT,xT,OT,BE){function adopt(pT){return pT instanceof OT?pT:new OT((function(xT){xT(pT)}))}return new(OT||(OT=Promise))((function(OT,LE){function fulfilled(pT){try{step(BE.next(pT))}catch(pT){LE(pT)}}function rejected(pT){try{step(BE["throw"](pT))}catch(pT){LE(pT)}}function step(pT){pT.done?OT(pT.value):adopt(pT.value).then(fulfilled,rejected)}step((BE=BE.apply(pT,xT||[])).next())}))};const addDebugCommand=pT=>{pT.command("debug").description("Prints debug information for the CLI.").action((()=>iC(void 0,void 0,void 0,(function*(){const pT=loadRelayConfig();const xT=getRelayArtifactDirectoryLocation(pT);console.log(`Artifact directory location: ${xT}\n`);console.log("Getting all generated files...\n");const OT=yield getAllGeneratedFiles(xT);console.log(`Number of generated files found in artifact directory: ${OT.length}\n`);console.log("Looking up source files\n");const BE=yield findAllSourceFilesFromGeneratedFiles(OT);console.log(`Found ${BE.length} source locations with explicit definitions.\n`);console.log("Looking up source files..\n");const LE=yield findSourceFiles(BE,pT.src);console.log(`Found ${LE.length} actual source files, when looking in ${getSrcCwd(pT.src)}.\n`);console.log("Done!")}))))};var aC=__nccwpck_require__(3129);var oC=__nccwpck_require__.n(aC);var sC=undefined&&undefined.__awaiter||function(pT,xT,OT,BE){function adopt(pT){return pT instanceof OT?pT:new OT((function(xT){xT(pT)}))}return new(OT||(OT=Promise))((function(OT,LE){function fulfilled(pT){try{step(BE.next(pT))}catch(pT){LE(pT)}}function rejected(pT){try{step(BE["throw"](pT))}catch(pT){LE(pT)}}function step(pT){pT.done?OT(pT.value):adopt(pT.value).then(fulfilled,rejected)}step((BE=BE.apply(pT,xT||[])).next())}))};const addRemoveUnusedFieldsCommand=pT=>{pT.command("remove-unused-fields").option("--verbose","Verbose mode").option("--debug","Debug mode").option("--ci","CI mode: Exit if unused fields exist, but don't remove them.").description("Remove unused GraphQL selections in fragments in current project.").action((({ci:pT,verbose:xT,debug:OT})=>{var LE;const ME=loadRelayConfig();const UE=getRelayArtifactDirectoryLocation(ME);const JE=BE()("Analyzing ReScript project").start();const qE=oC().spawn("npx",["reanalyze","-dce"]);if(qE.stdout==null){console.error("Something went wrong.");process.exit(1)}let KE="";qE.stdout.on("data",(pT=>{KE+=pT}));(LE=qE.stderr)===null||LE===void 0?void 0:LE.on("data",(pT=>{if(pT.includes("End_of_file")){JE.fail(`Something went wrong trying to analyze the ReScript project. Try cleaning your ReScript project and rebuilding it from scratch before trying again.`)}else{JE.fail(`Something went wrong trying to analyze the ReScript project.`)}if(OT){console.error(pT)}process.exit(1)}));qE.on("close",(()=>sC(void 0,void 0,void 0,(function*(){JE.text="Analyzing GraphQL usage";const BE=processReanalyzeOutput(KE);if(OT){console.log(`Found ${maybePluralize("file",Object.keys(BE).length)} with potentially missing fields.`)}const LE=[];JE.text="Scanning fragment files";if(OT){console.log(`Extracing source locations for ${maybePluralize("files",Object.keys(BE).length)}.`)}yield Promise.all(Object.entries(BE).map((([pT,xT])=>sC(void 0,void 0,void 0,(function*(){var OT;const BE=RE().resolve(UE,pT);try{const pT=yield jE().promises.readFile(BE,{encoding:"utf-8"});const RE=(OT=pT.match(rC))===null||OT===void 0?void 0:OT[0];if(RE!=null){LE.push(Object.assign(Object.assign({},xT),{sourceLocation:RE}))}}catch(pT){console.error(pT)}})))));JE.text=`Findings files`;const qE=LE.map((pT=>({path:pT.sourceLocation,graphqlName:pT.graphqlName})));const GE=yield findSourceFiles(qE.map((pT=>pT.path)),ME.src);const $E=GE.map((pT=>{const xT=LE.find((xT=>pT.endsWith(xT.sourceLocation)));if(xT!=null){return Object.assign(Object.assign({},xT),{absoluteFilePath:pT})}}));JE.text=`Analyzing found files`;const WE=[];yield Promise.all($E.map((pT=>sC(void 0,void 0,void 0,(function*(){var xT;if(pT==null)return;try{const OT=yield jE().promises.readFile(pT.absoluteFilePath,{encoding:"utf-8"});const BE=zE(OT);let LE=null;let RE=null;for(const OT of BE){const BE=(0,VE.Qc3)(OT.content);const ME=BE.definitions[0];if(ME==null){continue}if((ME.kind==="OperationDefinition"||ME.kind==="FragmentDefinition")&&((xT=ME.name)===null||xT===void 0?void 0:xT.value)===pT.graphqlName){LE=BE;RE=OT;break}}if(LE==null||RE==null)return;const ME=LE.definitions[0];if(ME==null||!(ME.kind==="FragmentDefinition"||ME.kind==="OperationDefinition")){return}WE.push(Object.assign({targetDef:ME,fileContents:OT,targetTag:RE},pT))}catch(pT){console.error(pT)}})))));if(xT&&LE.length>0){console.log(`\n\n------\nUnused fields: \n`,WE.map((pT=>`${pT.type==="fragment"?"Fragment":"Query"} "${pT.graphqlName}" in ${pT.sourceLocation}: \n ${pT.unusedFieldPaths.join("\n ")}`)).join("\n\n"),`\n------\n\n`)}if(pT){if(WE.length===0){JE.succeed("No unused fields found.");process.exit(0)}else{JE.fail(`Found ${WE.length} file(s) with unused fields.`);process.exit(1)}}JE.text=`Removing unused fields`;yield Promise.all(WE.map((({targetDef:pT,unusedFieldPaths:xT,targetTag:OT,absoluteFilePath:BE,fileContents:LE})=>sC(void 0,void 0,void 0,(function*(){const RE=removeUnusedFieldsFromOperation({definition:pT,unusedFieldPaths:xT});const ME=RE==null?"# This module is unused and can be removed":restoreOperationPadding(prettify((0,VE.S0v)(RE)),OT.content);yield jE().promises.writeFile(BE,`${LE.slice(0,OT.start)}${ME}${LE.slice(OT.end)}`)})))));const YE=WE.reduce(((pT,xT)=>{var OT;return pT+((OT=xT===null||xT===void 0?void 0:xT.unusedFieldPaths.length)!==null&&OT!==void 0?OT:0)}),0);if(YE===0){JE.succeed("Done! No unused fields found.")}else{JE.succeed(`Done! Removed ${maybePluralize("field",YE)} from ${maybePluralize("file",WE.length)}.`)}}))))}))};pT.program.version("0.1.0");addFormatGraphQLCommands(pT.program);addDebugCommand(pT.program);addRemoveUnusedFieldsCommand(pT.program);pT.program.parse(process.argv)})();module.exports=OT})();
|
package/compiler.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var spawn = require("child_process").spawn;
|
|
5
|
+
var path = require("path");
|
|
6
|
+
|
|
7
|
+
var input = process.argv.slice(2);
|
|
8
|
+
|
|
9
|
+
spawn(path.join(__dirname, "rescript-relay-compiler.exe"), input, {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
}).on("exit", process.exit);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rescript-relay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"main": "src/RescriptRelay.res",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gabriel Nordeborn",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"rescript"
|
|
21
21
|
],
|
|
22
22
|
"bin": {
|
|
23
|
-
"rescript-relay-compiler": "compiler
|
|
23
|
+
"rescript-relay-compiler": "compiler.js",
|
|
24
24
|
"rescript-relay-cli": "cli/cli.js"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "rescript build -with-deps",
|
|
28
|
-
"build:test": "compiler
|
|
28
|
+
"build:test": "./build-compiler-dev.sh && ./rescript-relay-compiler",
|
|
29
29
|
"postinstall": "node postinstall.js",
|
|
30
30
|
"test": "jest",
|
|
31
31
|
"test:ci": "jest --ci --runInBand"
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"@testing-library/jest-dom": "^5.16.1",
|
|
36
36
|
"@testing-library/react": "^13.0.0-alpha.5",
|
|
37
37
|
"bs-fetch": "^0.5.0",
|
|
38
|
-
"graphql": "14.5.0",
|
|
39
38
|
"graphql-query-test-mock": "^0.12.1",
|
|
40
39
|
"jest": "^27.2.4",
|
|
41
40
|
"nock": "^11.7.0",
|
|
@@ -43,21 +42,15 @@
|
|
|
43
42
|
"react": "^18.0.0-rc.0",
|
|
44
43
|
"react-dom": "^18.0.0-rc.0",
|
|
45
44
|
"react-relay": "12.0.0",
|
|
46
|
-
"relay-compiler": "12.0.0",
|
|
47
|
-
"relay-config": "12.0.0",
|
|
48
45
|
"relay-runtime": "12.0.0"
|
|
49
46
|
},
|
|
50
47
|
"peerDependencies": {
|
|
51
48
|
"@rescript/react": "*",
|
|
52
|
-
"graphql": "*",
|
|
53
49
|
"react-relay": "*",
|
|
54
|
-
"relay-compiler": "*",
|
|
55
|
-
"relay-config": "*",
|
|
56
50
|
"relay-runtime": "*",
|
|
57
51
|
"rescript": "^9.1.2"
|
|
58
52
|
},
|
|
59
53
|
"dependencies": {
|
|
60
|
-
"mkdirp-sync": "^0.0.3",
|
|
61
54
|
"rescript": "^9.1.2"
|
|
62
55
|
},
|
|
63
56
|
"resolutions": {
|
package/postinstall.js
CHANGED
|
@@ -10,16 +10,27 @@
|
|
|
10
10
|
var path = require("path");
|
|
11
11
|
var cp = require("child_process");
|
|
12
12
|
var fs = require("fs");
|
|
13
|
-
var os = require("os");
|
|
14
13
|
var platform = process.platform;
|
|
15
14
|
|
|
15
|
+
function getRelayCompilerPlatformSuffix() {
|
|
16
|
+
if (process.platform === "darwin" && process.arch === "x64") {
|
|
17
|
+
return "macos-x64";
|
|
18
|
+
} else if (process.platform === "darwin" && process.arch === "arm64") {
|
|
19
|
+
return "macos-arm64";
|
|
20
|
+
} else if (process.platform === "linux" && process.arch === "x64") {
|
|
21
|
+
return "linux-x64";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return "linux-x64";
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
/**
|
|
17
28
|
* Since os.arch returns node binary's target arch, not
|
|
18
29
|
* the system arch.
|
|
19
30
|
* Credits: https://github.com/feross/arch/blob/af080ff61346315559451715c5393d8e86a6d33c/index.js#L10-L58
|
|
20
31
|
*/
|
|
21
32
|
|
|
22
|
-
function
|
|
33
|
+
function ppxArch() {
|
|
23
34
|
/**
|
|
24
35
|
* Use Rosetta for ARM on macOS
|
|
25
36
|
*/
|
|
@@ -80,39 +91,55 @@ function arch() {
|
|
|
80
91
|
}
|
|
81
92
|
|
|
82
93
|
function copyPlatformBinaries(platform) {
|
|
94
|
+
/**
|
|
95
|
+
* Copy the PPX
|
|
96
|
+
*/
|
|
83
97
|
fs.copyFileSync(
|
|
84
98
|
path.join(__dirname, "ppx-" + platform),
|
|
85
99
|
path.join(__dirname, "ppx")
|
|
86
100
|
);
|
|
87
101
|
fs.chmodSync(path.join(__dirname, "ppx"), 0777);
|
|
88
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Copy the Relay compiler
|
|
105
|
+
*/
|
|
106
|
+
|
|
89
107
|
fs.copyFileSync(
|
|
90
|
-
path.join(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
108
|
+
path.join(
|
|
109
|
+
__dirname,
|
|
110
|
+
"relay-compiler-" + getRelayCompilerPlatformSuffix(),
|
|
111
|
+
"relay"
|
|
112
|
+
),
|
|
113
|
+
path.join(__dirname, "rescript-relay-compiler.exe")
|
|
96
114
|
);
|
|
115
|
+
fs.chmodSync(path.join(__dirname, "rescript-relay-compiler.exe"), 0777);
|
|
97
116
|
}
|
|
98
117
|
|
|
99
118
|
function removeInitialBinaries() {
|
|
100
119
|
fs.unlinkSync(path.join(__dirname, "ppx-darwin"));
|
|
101
120
|
fs.unlinkSync(path.join(__dirname, "ppx-linux"));
|
|
102
|
-
fs.
|
|
103
|
-
|
|
121
|
+
fs.rmSync(path.join(__dirname, "relay-compiler-linux-x64"), {
|
|
122
|
+
recursive: true,
|
|
123
|
+
force: true,
|
|
124
|
+
});
|
|
125
|
+
fs.rmSync(path.join(__dirname, "relay-compiler-macos-x64"), {
|
|
126
|
+
recursive: true,
|
|
127
|
+
force: true,
|
|
128
|
+
});
|
|
129
|
+
fs.rmSync(path.join(__dirname, "relay-compiler-macos-arm64"), {
|
|
130
|
+
recursive: true,
|
|
131
|
+
force: true,
|
|
132
|
+
});
|
|
104
133
|
}
|
|
105
134
|
|
|
106
135
|
switch (platform) {
|
|
107
136
|
case "win32": {
|
|
108
|
-
if (
|
|
137
|
+
if (ppxArch() !== "x64") {
|
|
109
138
|
console.warn("error: x86 is currently not supported on Windows");
|
|
110
139
|
process.exit(1);
|
|
111
140
|
}
|
|
112
141
|
|
|
113
142
|
throw new Error("Windows currently not supported.");
|
|
114
|
-
copyPlatformBinaries("windows");
|
|
115
|
-
break;
|
|
116
143
|
}
|
|
117
144
|
case "linux":
|
|
118
145
|
case "darwin":
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/RescriptRelay.res
CHANGED
|
@@ -39,6 +39,8 @@ type featureFlags = {
|
|
|
39
39
|
mutable enableRelayContainersSuspense: bool,
|
|
40
40
|
@as("ENABLE_PRECISE_TYPE_REFINEMENT")
|
|
41
41
|
mutable enablePrecisTypeRefinement: bool,
|
|
42
|
+
@as("ENABLE_REQUIRED_DIRECTIVES")
|
|
43
|
+
mutable enableRequiredDirective: bool,
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
@module("relay-runtime")
|
package/src/RescriptRelay.resi
CHANGED
|
@@ -98,6 +98,8 @@ type featureFlags = {
|
|
|
98
98
|
mutable enableRelayContainersSuspense: bool,
|
|
99
99
|
@as("ENABLE_PRECISE_TYPE_REFINEMENT")
|
|
100
100
|
mutable enablePrecisTypeRefinement: bool,
|
|
101
|
+
@as("ENABLE_REQUIRED_DIRECTIVES")
|
|
102
|
+
mutable enableRequiredDirective: bool,
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
@ocaml.doc(
|
|
@@ -315,10 +315,12 @@ function RescriptRelayRouter$Link(Props) {
|
|
|
315
315
|
var className = Props.className;
|
|
316
316
|
var classNameDynamic = Props.classNameDynamic;
|
|
317
317
|
var browserTarget = Props.target;
|
|
318
|
+
var tabIndex = Props.tabIndex;
|
|
318
319
|
var mode = Props.mode;
|
|
319
320
|
var render = Props.render;
|
|
320
321
|
var preloadOnHover = Props.preloadOnHover;
|
|
321
322
|
var children = Props.children;
|
|
323
|
+
var onClick = Props.onClick;
|
|
322
324
|
var router = React.useContext(context);
|
|
323
325
|
var url = RescriptReactRouter.useUrl(undefined, undefined);
|
|
324
326
|
var changeRoute = React.useCallback((function (e) {
|
|
@@ -369,7 +371,13 @@ function RescriptRelayRouter$Link(Props) {
|
|
|
369
371
|
target: browserTarget !== undefined ? (
|
|
370
372
|
browserTarget === "blank" ? "_blank" : "_self"
|
|
371
373
|
) : "",
|
|
372
|
-
onClick:
|
|
374
|
+
onClick: (function (e) {
|
|
375
|
+
Curry._1(changeRoute, e);
|
|
376
|
+
if (onClick !== undefined) {
|
|
377
|
+
return Curry._1(onClick, undefined);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
}),
|
|
373
381
|
onMouseDown: (function (param) {
|
|
374
382
|
return Curry._1(preload, undefined);
|
|
375
383
|
}),
|
|
@@ -386,6 +394,9 @@ function RescriptRelayRouter$Link(Props) {
|
|
|
386
394
|
if (id !== undefined) {
|
|
387
395
|
tmp.id = Caml_option.valFromOption(id);
|
|
388
396
|
}
|
|
397
|
+
if (tabIndex !== undefined) {
|
|
398
|
+
tmp.tabIndex = Caml_option.valFromOption(tabIndex);
|
|
399
|
+
}
|
|
389
400
|
if (title !== undefined) {
|
|
390
401
|
tmp.title = Caml_option.valFromOption(title);
|
|
391
402
|
}
|
|
@@ -306,10 +306,12 @@ module Link = {
|
|
|
306
306
|
~className=?,
|
|
307
307
|
~classNameDynamic=?,
|
|
308
308
|
~target as browserTarget=?,
|
|
309
|
+
~tabIndex=?,
|
|
309
310
|
~mode=?,
|
|
310
311
|
~render=?,
|
|
311
312
|
~preloadOnHover=?,
|
|
312
313
|
~children,
|
|
314
|
+
~onClick=?,
|
|
313
315
|
(),
|
|
314
316
|
) => {
|
|
315
317
|
let router = use()
|
|
@@ -350,12 +352,19 @@ module Link = {
|
|
|
350
352
|
}}
|
|
351
353
|
?title
|
|
352
354
|
?id
|
|
355
|
+
?tabIndex
|
|
353
356
|
className={className->Belt.Option.getWithDefault("") ++
|
|
354
357
|
switch classNameDynamic {
|
|
355
358
|
| Some(f) => " " ++ f(url, to_->Url.make)
|
|
356
359
|
| None => ""
|
|
357
360
|
}}
|
|
358
|
-
onClick=
|
|
361
|
+
onClick={e => {
|
|
362
|
+
changeRoute(e)
|
|
363
|
+
switch onClick {
|
|
364
|
+
| None => ()
|
|
365
|
+
| Some(onClick) => onClick()
|
|
366
|
+
}
|
|
367
|
+
}}
|
|
359
368
|
onMouseDown={_ => preload()}
|
|
360
369
|
onTouchStart={_ => preload()}
|
|
361
370
|
onMouseEnter={_ =>
|
|
@@ -56,6 +56,7 @@ module Link: {
|
|
|
56
56
|
~className: string=?,
|
|
57
57
|
~classNameDynamic: (RescriptReactRouter.url, RescriptReactRouter.url) => string=?,
|
|
58
58
|
~target: [#self | #blank]=?,
|
|
59
|
+
~tabIndex: int=?,
|
|
59
60
|
~mode: [#push | #replace]=?,
|
|
60
61
|
~render: (
|
|
61
62
|
~preload: unit => unit,
|
|
@@ -65,6 +66,7 @@ module Link: {
|
|
|
65
66
|
) => React.element=?,
|
|
66
67
|
~preloadOnHover: bool=?,
|
|
67
68
|
~children: React.element,
|
|
69
|
+
~onClick: unit => unit=?,
|
|
68
70
|
unit,
|
|
69
71
|
) => React.element
|
|
70
72
|
}
|
package/src/utils.js
CHANGED
|
@@ -24,6 +24,10 @@ function traverse(
|
|
|
24
24
|
instructionPaths,
|
|
25
25
|
addFragmentOnRoot
|
|
26
26
|
) {
|
|
27
|
+
// We lazily set up a new object for each "level", as we don't want to mutate
|
|
28
|
+
// what comes back from the Relay store, and nor do we want to create new
|
|
29
|
+
// objects unless we need to. And we only need to when we need to change
|
|
30
|
+
// something.
|
|
27
31
|
var newObj;
|
|
28
32
|
|
|
29
33
|
if (addFragmentOnRoot) {
|
|
@@ -39,193 +43,168 @@ function traverse(
|
|
|
39
43
|
var thisPath = makeNewPath(currentPath, [key]);
|
|
40
44
|
var path = getPathName(thisPath);
|
|
41
45
|
|
|
42
|
-
var instructions = instructionMap[path];
|
|
46
|
+
var instructions = instructionMap[path] || {};
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
if (currentObj[key] == null) {
|
|
49
|
+
newObj = getNewObj(newObj, currentObj);
|
|
50
|
+
newObj[key] = nullableValue;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
newObj = getNewObj(newObj, currentObj);
|
|
53
|
-
newObj[key] = nullableValue;
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
var shouldConvertRootObj =
|
|
57
|
-
typeof instructions["r"] === "string" &&
|
|
58
|
-
fullInstructionMap[instructions["r"]];
|
|
54
|
+
var shouldConvertRootObj =
|
|
55
|
+
typeof instructions["r"] === "string" &&
|
|
56
|
+
fullInstructionMap[instructions["r"]];
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
var shouldAddFragmentFn = instructions["f"] === "";
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
!!converters[instructions["e"]];
|
|
60
|
+
var shouldConvertEnum =
|
|
61
|
+
typeof instructions["e"] === "string" && !!converters[instructions["e"]];
|
|
65
62
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
!!converters[instructions["c"]];
|
|
63
|
+
var shouldConvertCustomField =
|
|
64
|
+
typeof instructions["c"] === "string" && !!converters[instructions["c"]];
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
!!converters[instructions["u"]];
|
|
66
|
+
var shouldConvertUnion =
|
|
67
|
+
typeof instructions["u"] === "string" && !!converters[instructions["u"]];
|
|
73
68
|
|
|
74
|
-
|
|
69
|
+
var isTopLevelNodeField = typeof instructions["tnf"] === "string";
|
|
75
70
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (shouldConvertRootObj) {
|
|
87
|
-
return traverser(
|
|
88
|
-
v,
|
|
89
|
-
fullInstructionMap,
|
|
90
|
-
converters,
|
|
91
|
-
nullableValue,
|
|
92
|
-
instructions["r"]
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (shouldConvertEnum) {
|
|
97
|
-
return converters[instructions["e"]](v);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (shouldConvertCustomField) {
|
|
101
|
-
return converters[instructions["c"]](v);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
shouldConvertUnion &&
|
|
106
|
-
typeof v === "object" &&
|
|
107
|
-
typeof v.__typename === "string"
|
|
108
|
-
) {
|
|
109
|
-
isUnion = true;
|
|
110
|
-
|
|
111
|
-
var newPath = makeNewPath(currentPath, [
|
|
112
|
-
key,
|
|
113
|
-
v.__typename.toLowerCase(),
|
|
114
|
-
]);
|
|
115
|
-
|
|
116
|
-
var unionRootHasFragment =
|
|
117
|
-
(instructionMap[getPathName(newPath)] || {}).f === "";
|
|
118
|
-
|
|
119
|
-
var traversedValue = traverse(
|
|
120
|
-
fullInstructionMap,
|
|
121
|
-
newPath,
|
|
122
|
-
v,
|
|
123
|
-
instructionMap,
|
|
124
|
-
converters,
|
|
125
|
-
nullableValue,
|
|
126
|
-
instructionPaths,
|
|
127
|
-
unionRootHasFragment
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
return converters[instructions["u"]](traversedValue);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (shouldAddFragmentFn && typeof v === "object") {
|
|
134
|
-
var objWithFragmentFn = Object.assign({}, v);
|
|
135
|
-
objWithFragmentFn.fragmentRefs = Object.assign(
|
|
136
|
-
{},
|
|
137
|
-
objWithFragmentFn
|
|
138
|
-
);
|
|
139
|
-
return objWithFragmentFn;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return v;
|
|
143
|
-
});
|
|
144
|
-
} else {
|
|
145
|
-
/**
|
|
146
|
-
* Handle normal values.
|
|
147
|
-
*/
|
|
148
|
-
var v = currentObj[key];
|
|
149
|
-
|
|
150
|
-
if (shouldConvertRootObj) {
|
|
151
|
-
newObj = getNewObj(newObj, currentObj);
|
|
152
|
-
newObj[key] = traverser(
|
|
153
|
-
v,
|
|
154
|
-
fullInstructionMap,
|
|
155
|
-
converters,
|
|
156
|
-
nullableValue,
|
|
157
|
-
instructions["r"]
|
|
158
|
-
);
|
|
159
|
-
}
|
|
71
|
+
/**
|
|
72
|
+
* Handle arrays
|
|
73
|
+
*/
|
|
74
|
+
if (Array.isArray(currentObj[key])) {
|
|
75
|
+
newObj = getNewObj(newObj, currentObj);
|
|
76
|
+
newObj[key] = currentObj[key].map(function (v) {
|
|
77
|
+
if (v == null) {
|
|
78
|
+
return nullableValue;
|
|
79
|
+
}
|
|
160
80
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
81
|
+
if (shouldConvertRootObj) {
|
|
82
|
+
return traverser(
|
|
83
|
+
v,
|
|
84
|
+
fullInstructionMap,
|
|
85
|
+
converters,
|
|
86
|
+
nullableValue,
|
|
87
|
+
instructions["r"]
|
|
88
|
+
);
|
|
89
|
+
}
|
|
171
90
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
91
|
+
if (shouldConvertEnum) {
|
|
92
|
+
return converters[instructions["e"]](v);
|
|
93
|
+
}
|
|
176
94
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
95
|
+
if (shouldConvertCustomField) {
|
|
96
|
+
return converters[instructions["c"]](v);
|
|
97
|
+
}
|
|
181
98
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
99
|
+
if (
|
|
100
|
+
shouldConvertUnion &&
|
|
101
|
+
typeof v === "object" &&
|
|
102
|
+
typeof v.__typename === "string"
|
|
103
|
+
) {
|
|
104
|
+
isUnion = true;
|
|
105
|
+
|
|
106
|
+
var newPath = makeNewPath(currentPath, [key, v.__typename]);
|
|
107
|
+
|
|
108
|
+
var unionRootHasFragment =
|
|
109
|
+
(instructionMap[getPathName(newPath)] || {}).f === "";
|
|
110
|
+
|
|
111
|
+
var traversedValue = traverse(
|
|
112
|
+
fullInstructionMap,
|
|
113
|
+
newPath,
|
|
114
|
+
v,
|
|
115
|
+
instructionMap,
|
|
116
|
+
converters,
|
|
117
|
+
nullableValue,
|
|
118
|
+
instructionPaths,
|
|
119
|
+
unionRootHasFragment
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
return converters[instructions["u"]](traversedValue);
|
|
123
|
+
}
|
|
188
124
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
125
|
+
if (shouldAddFragmentFn && typeof v === "object") {
|
|
126
|
+
var objWithFragmentFn = Object.assign({}, v);
|
|
127
|
+
objWithFragmentFn.fragmentRefs = Object.assign({}, objWithFragmentFn);
|
|
128
|
+
return objWithFragmentFn;
|
|
129
|
+
}
|
|
193
130
|
|
|
194
|
-
|
|
195
|
-
|
|
131
|
+
return v;
|
|
132
|
+
});
|
|
133
|
+
} else {
|
|
134
|
+
/**
|
|
135
|
+
* Handle normal values.
|
|
136
|
+
*/
|
|
137
|
+
var v = currentObj[key];
|
|
196
138
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
139
|
+
if (shouldConvertRootObj) {
|
|
140
|
+
newObj = getNewObj(newObj, currentObj);
|
|
141
|
+
newObj[key] = traverser(
|
|
142
|
+
v,
|
|
143
|
+
fullInstructionMap,
|
|
144
|
+
converters,
|
|
145
|
+
nullableValue,
|
|
146
|
+
instructions["r"]
|
|
147
|
+
);
|
|
148
|
+
}
|
|
207
149
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
150
|
+
if (isTopLevelNodeField) {
|
|
151
|
+
if (
|
|
152
|
+
v == null ||
|
|
153
|
+
!v.hasOwnProperty("__typename") ||
|
|
154
|
+
v.__typename !== instructions["tnf"]
|
|
155
|
+
) {
|
|
156
|
+
newObj = getNewObj(newObj, currentObj);
|
|
157
|
+
newObj[key] = nullableValue;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
211
160
|
|
|
212
|
-
|
|
213
|
-
|
|
161
|
+
if (shouldConvertEnum) {
|
|
162
|
+
newObj = getNewObj(newObj, currentObj);
|
|
163
|
+
newObj[key] = converters[instructions["e"]](v);
|
|
164
|
+
}
|
|
214
165
|
|
|
215
|
-
|
|
166
|
+
if (shouldConvertCustomField) {
|
|
167
|
+
newObj = getNewObj(newObj, currentObj);
|
|
168
|
+
newObj[key] = converters[instructions["c"]](v);
|
|
169
|
+
}
|
|
216
170
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
171
|
+
if (
|
|
172
|
+
shouldConvertUnion &&
|
|
173
|
+
v != null &&
|
|
174
|
+
typeof v === "object" &&
|
|
175
|
+
typeof v.__typename === "string"
|
|
176
|
+
) {
|
|
177
|
+
isUnion = true;
|
|
221
178
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
179
|
+
var newPath = makeNewPath(currentPath, [key, v.__typename]);
|
|
180
|
+
|
|
181
|
+
var unionRootHasFragment =
|
|
182
|
+
(instructionMap[getPathName(newPath)] || {}).f === "";
|
|
183
|
+
|
|
184
|
+
var traversedValue = traverse(
|
|
185
|
+
fullInstructionMap,
|
|
186
|
+
newPath,
|
|
187
|
+
v,
|
|
188
|
+
instructionMap,
|
|
189
|
+
converters,
|
|
190
|
+
nullableValue,
|
|
191
|
+
instructionPaths,
|
|
192
|
+
unionRootHasFragment
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
newObj = getNewObj(newObj, currentObj);
|
|
196
|
+
newObj[key] = converters[instructions["u"]](traversedValue);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (shouldAddFragmentFn && typeof v === "object") {
|
|
200
|
+
newObj = getNewObj(newObj, currentObj);
|
|
201
|
+
var objWithFragmentFn = Object.assign({}, v);
|
|
202
|
+
objWithFragmentFn.fragmentRefs = Object.assign({}, objWithFragmentFn);
|
|
203
|
+
newObj[key] = objWithFragmentFn;
|
|
225
204
|
}
|
|
226
205
|
}
|
|
227
206
|
|
|
228
|
-
if (
|
|
207
|
+
if (originalValue != null && !isUnion) {
|
|
229
208
|
var nextObj = (newObj && newObj[key]) || currentObj[key];
|
|
230
209
|
|
|
231
210
|
if (typeof nextObj === "object" && !Array.isArray(originalValue)) {
|
|
@@ -246,17 +225,21 @@ function traverse(
|
|
|
246
225
|
} else if (Array.isArray(originalValue)) {
|
|
247
226
|
newObj = getNewObj(newObj, currentObj);
|
|
248
227
|
newObj[key] = nextObj.map(function (o) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
228
|
+
if (typeof o === "object" && o != null) {
|
|
229
|
+
return traverse(
|
|
230
|
+
fullInstructionMap,
|
|
231
|
+
thisPath,
|
|
232
|
+
o,
|
|
233
|
+
instructionMap,
|
|
234
|
+
converters,
|
|
235
|
+
nullableValue,
|
|
236
|
+
instructionPaths
|
|
237
|
+
);
|
|
238
|
+
} else if (o == null) {
|
|
239
|
+
return nullableValue;
|
|
240
|
+
} else {
|
|
241
|
+
return o;
|
|
242
|
+
}
|
|
260
243
|
});
|
|
261
244
|
}
|
|
262
245
|
}
|
|
@@ -276,7 +259,7 @@ function traverse(
|
|
|
276
259
|
*/
|
|
277
260
|
function traverser(
|
|
278
261
|
root,
|
|
279
|
-
|
|
262
|
+
instructionMaps_,
|
|
280
263
|
theConverters,
|
|
281
264
|
nullableValue,
|
|
282
265
|
rootObjectKey
|
|
@@ -285,22 +268,12 @@ function traverser(
|
|
|
285
268
|
return nullableValue;
|
|
286
269
|
}
|
|
287
270
|
|
|
288
|
-
var instructionMaps =
|
|
289
|
-
var instructionMap = instructionMaps[rootObjectKey || "__root"];
|
|
290
|
-
|
|
291
|
-
// No instructions
|
|
292
|
-
if (!instructionMap) {
|
|
293
|
-
return root;
|
|
294
|
-
}
|
|
271
|
+
var instructionMaps = instructionMaps_ || {};
|
|
272
|
+
var instructionMap = instructionMaps[rootObjectKey || "__root"] || {};
|
|
295
273
|
|
|
296
274
|
var converters = theConverters == null ? {} : theConverters;
|
|
297
275
|
var instructionPaths = Object.keys(instructionMap);
|
|
298
276
|
|
|
299
|
-
// Nothing to convert, bail early
|
|
300
|
-
if (instructionPaths.length === 0) {
|
|
301
|
-
return root;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
277
|
// We'll add the fragmentRefs reference to the root if needed here.
|
|
305
278
|
var fragmentsOnRoot = (instructionMap[""] || {}).f === "";
|
|
306
279
|
var unionRootConverter = converters[(instructionMap[""] || {}).u];
|
|
@@ -311,9 +284,19 @@ function traverser(
|
|
|
311
284
|
return nullableValue;
|
|
312
285
|
}
|
|
313
286
|
|
|
287
|
+
var n = [];
|
|
288
|
+
|
|
289
|
+
// Since a root level union is treated as a "new root level", we'll need
|
|
290
|
+
// to do a separate check here of whether there's a fragment on the root
|
|
291
|
+
// we need to account for, or not.
|
|
292
|
+
if (unionRootConverter != null) {
|
|
293
|
+
n = [v.__typename];
|
|
294
|
+
fragmentsOnRoot = (instructionMap[v.__typename] || {}).f === "";
|
|
295
|
+
}
|
|
296
|
+
|
|
314
297
|
var traversedObj = traverse(
|
|
315
298
|
instructionMaps,
|
|
316
|
-
|
|
299
|
+
n,
|
|
317
300
|
v,
|
|
318
301
|
instructionMap,
|
|
319
302
|
converters,
|
|
@@ -330,9 +313,18 @@ function traverser(
|
|
|
330
313
|
|
|
331
314
|
var newObj = Object.assign({}, root);
|
|
332
315
|
|
|
316
|
+
var n = [];
|
|
317
|
+
|
|
318
|
+
// Same as in the union array check above - if there's a fragment in the new
|
|
319
|
+
// root created by the union, we need to account for that separately here.
|
|
320
|
+
if (unionRootConverter != null) {
|
|
321
|
+
n = [newObj.__typename];
|
|
322
|
+
fragmentsOnRoot = (instructionMap[newObj.__typename] || {}).f === "";
|
|
323
|
+
}
|
|
324
|
+
|
|
333
325
|
var v = traverse(
|
|
334
326
|
instructionMaps,
|
|
335
|
-
|
|
327
|
+
n,
|
|
336
328
|
newObj,
|
|
337
329
|
instructionMap,
|
|
338
330
|
converters,
|
package/bin-darwin
DELETED
|
Binary file
|
package/bin-linux
DELETED
|
Binary file
|
package/compiler/compiler-cli.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const { spawn } = require("child_process");
|
|
4
|
-
|
|
5
|
-
let relayConfig = require("relay-config").loadConfig();
|
|
6
|
-
|
|
7
|
-
if (!relayConfig) {
|
|
8
|
-
console.error(
|
|
9
|
-
"Could not find relay.config.js. You must configure Relay through relay.config.js for RescriptRelay to work."
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (!relayConfig.artifactDirectory) {
|
|
16
|
-
console.error(
|
|
17
|
-
"RescriptRelay requires you to define 'artifactDirectory' (for outputing generated files in a single directory) in your relay.config.js. Please define it and re-run this command."
|
|
18
|
-
);
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function runRelayCompiler(args) {
|
|
23
|
-
const proc = spawn("relay-compiler", args, {
|
|
24
|
-
stdio: "inherit",
|
|
25
|
-
})
|
|
26
|
-
// Propagate the relay compiler's exit code.
|
|
27
|
-
.on("close", process.exit.bind(process));
|
|
28
|
-
|
|
29
|
-
process.on("SIGINT", () => {
|
|
30
|
-
proc.kill("SIGINT");
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function findArg(name) {
|
|
35
|
-
return relayConfig[name];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function runCompiler() {
|
|
39
|
-
const schemaPath = findArg("schema");
|
|
40
|
-
|
|
41
|
-
if (schemaPath) {
|
|
42
|
-
runRelayCompiler(
|
|
43
|
-
[
|
|
44
|
-
"--language",
|
|
45
|
-
path.resolve(__dirname + "/../language-plugin/dist/index.js"),
|
|
46
|
-
process.argv.find((a) => a === "--watch"),
|
|
47
|
-
].filter(Boolean)
|
|
48
|
-
);
|
|
49
|
-
} else {
|
|
50
|
-
runRelayCompiler(["--help"]);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
runCompiler();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=(()=>{"use strict";var e={338:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.find=void 0,t.find=function(e,t){return function(e,t){if(!e.includes("%relay"))return[];const n=e.match(/(?<=\[%relay)([\s\S]*?)(?=];)/g);if(n)return n.map((e=>({template:e.replace(/({\||\|})/g,""),keyName:null,sourceLocationOffset:{line:1,column:1}})));const r=e.match(/(?<=\%relay\([\s]*`)[\s\S.]+?(?=`[\s]*\))/g);return r?r.map((e=>({template:e,keyName:null,sourceLocationOffset:{line:1,column:1}}))):[]}(e)}},189:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateFromFlowTypes=void 0;const r=n(129),o=n(622);t.generateFromFlowTypes=e=>{var t;const n=r.spawnSync(o.resolve(o.join(__dirname,"../RescriptRelayBin.exe")),["generate-from-flow"],{cwd:__dirname,stdio:"pipe",encoding:"utf-8",input:JSON.stringify(e)});if(0!==n.status)throw null!==(t=n.error)&&void 0!==t?t:new Error("Error generating types");return n.output.filter(Boolean).join("")}},571:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.transforms=t.generate=void 0;const r=n(791),o=n(224),a=n(148),i=n(354),s=n(189),l=n(602);function c(e){const t=Object.assign({Int:"int",Float:"float"},e);return Object.keys(t).forEach((e=>{t[e]=l.maskDots(t[e])})),t}t.generate=function(e,t,n){var a;let i=r.generate(e,t,Object.assign(Object.assign({},n),{customScalars:c(n.customScalars)}));const l=o.makeOperationDescriptor(t),d=o.extractOperationInfo(t);return s.generateFromFlowTypes({content:i,operation_type:["Query","Mutation","Subscription"].includes(l.tag)?{operation:l.tag,operation_value:l.value}:{operation:"Fragment",fragment_value:l.value},print_config:{variables_holding_connection_ids:null!==(a=d.variablesHoldingConnectionIds)&&void 0!==a?a:null,connection:d.connection?{at_object_path:d.connection.atObjectPath,field_name:d.connection.fieldName,key:d.connection.key}:null}})},t.transforms=[i.transform,a.transform,...r.transforms]},942:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const r=n(366),o=n(622);e.exports=({moduleName:e,documentType:t,concreteText:n,typeText:a,definition:i})=>{let s=null;"Source"===i.loc.kind&&(s=o.basename(i.loc.source.name));const l="ConcreteRequest"===t&&e.toLowerCase().endsWith("query_graphql")?"include RescriptRelay.MakeLoadQuery({\n type variables = Types.variables\n type loadedQueryRef = queryRef\n type response = Types.response\n type node = relayOperationNode\n let query = node\n let convertVariables = Internal.convertVariables\n });":"",{processedText:c,referencedNodes:d}=r.processConcreteText(n),u=`%raw(json\` ${c} \`)`;return[s?`/* @sourceLoc ${s} */`:null,a||"",...d.length>0?[`%%private(let makeNode = (${d.map((({identifier:e})=>e)).join(", ")}): operationType => {`,...d.map((({identifier:e})=>` ignore(${e})`)),` ${u}`,"})",`let node: operationType = makeNode(${d.map((({moduleName:e})=>`${e}_graphql.node`)).join(", ")})`]:[`let node: operationType = ${u}`],"",l,""].filter((e=>null!=e)).join("\n")}},602:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unmaskDots=t.maskDots=void 0,t.maskDots=e=>e.split(".").join("__oo__"),t.unmaskDots=e=>e.split("__oo__").join(".")},607:(e,t,n)=>{const r=n(571),o=n(942),{find:a}=n(338),i=n(622),s=n(747);function l(e){return t=>{const n=i.join(e,t.relPath);let r="";try{r=s.readFileSync(n,"utf8")}catch(e){return console.warn(`RelaySourceModuleParser: Unable to read the file "${n}". Looks like it was removed.`),!1}return r.indexOf("%relay")>=0}}e.exports=()=>({inputExtensions:["re","res"],outputExtension:"res",schemaExtensions:[],typeGenerator:r,formatModule:o,findGraphQLTags:a,isGeneratedFile:e=>e.endsWith("_graphql.res")||e.endsWith(".js")||e.endsWith(".mjs"),keepExtraFile:e=>e.endsWith(".js")||e.endsWith(".mjs"),getFileFilter:l,getModuleName:e=>`${e}_graphql`})},224:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeOperationDescriptor=t.extractOperationInfo=void 0;const r=n(195);function o(e,t,n){if("Root"===e.kind&&["mutation","subscription"].includes(e.operation)){const e=t.directives.filter((e=>["appendNode","prependNode","appendEdge","prependEdge","deleteEdge"].includes(e.name)));e.length>0&&e.forEach((e=>{const t=e.args.find((e=>"connections"===e.name)),r=null==t?void 0:t.value;r&&"Variable"===r.kind&&(n.variablesHoldingConnectionIds?n.variablesHoldingConnectionIds.push(r.variableName):n.variablesHoldingConnectionIds=[r.variableName])}))}}t.extractOperationInfo=function(e){let t={};const n="Fragment"===e.kind?"fragment":"response";return n?(function e(n,a){r.IRVisitor.visit(a,{ScalarField(e){o(a,e,t)},LinkedField(e){const r=e.directives.find((e=>"connection"===e.name));if(r&&!t.connection){let o=null;r.args.forEach((e=>{"key"===e.name&&"Literal"===e.value.kind&&(o=e.value.value)})),o&&(t=Object.assign(Object.assign({},t),{connection:{key:o,atObjectPath:[...n],fieldName:e.alias}}))}o(a,e,t),n.push(e.alias)},InlineFragment(t){t.typeCondition.name&&t.selections.forEach((r=>{e([...n,t.typeCondition.name.toLowerCase()],r)}))}})}([n],e),t):t},t.makeOperationDescriptor=function(e){if("Root"===e.kind)switch(e.operation){case"mutation":return{tag:"Mutation",value:e.name};case"query":return{tag:"Query",value:e.name};case"subscription":return{tag:"Subscription",value:e.name}}else if("Fragment"==e.kind)return{tag:"Fragment",value:[e.name,Boolean(e.metadata&&e.metadata.plural)]};throw new Error("Could not map root node. This should not happen.")}},148:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.transform=void 0;const r=n(724),{createUserError:o}=n(182),a=["and","as","asr","assert","begin","class","constraint","do","while","for","done","while","for","downto","else","end","exception","external","false","for","fun","function","functor","if","in","include","inherit","initializer","land","lazy","let","lor","lsl","lsr","lxor","match","method","mod","module","open","mutable","new","nonrec","object","of","open","open!","or","private","rec","let","module","sig","struct","then","to","true","try","type","val","virtual","val","method","class","when","while","with","switch"];let i=["fragment","t_fragment","subscription","mutation","response","variables","refetchVariables","t","fragmentRef","fragmentRefs","fragmentRefSelector","operationType"];function s(e){if(e.alias){let{disallowed:t,message:n}=function(e){let t=e[0];return/[A-Z]/.test(t)?{disallowed:!0,message:`Field names may not start with an uppercase letter. Please alias the '${e}' field to something starting with a lowercase letter.`}:a.includes(e)?{disallowed:!0,message:`'${e}' is a reserved keyword in ReasonML and therefore cannot be used as a field name. Please alias your field to something else.`}:i.includes(e)?{disallowed:!0,message:`'${e}' is a reserved keyword in RescriptRelay and therefore cannot be used as a field name. Please alias your field to something else.`}:{disallowed:!1,message:""}}(e.alias);if(t)throw o("Found an invalid field name: "+n,[e.loc])}e.selections&&e.selections.forEach(s)}function l(e){return s(e),e}t.transform=function(e){return r.transform(e,{ScalarField:l,LinkedField:l})}},354:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.transform=void 0;const r=n(724),{createUserError:o}=n(182),{hasUnaliasedSelection:a}=n(124);function i(e){const t=this.getContext().getSchema();let n=this.traverse(e);if(t.isAbstractType(t.getRawType(n.type))&&!a(n,"__typename"))throw o('Unions and interfaces must have the field __typename explicitly selected. Please add __typename to the fields selected by "'+e.alias+'" in your operation.',[e.loc]);return n}t.transform=function(e){return r.transform(e,{LinkedField:i})}},366:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.processConcreteText=void 0,t.processConcreteText=function(e){let t=/(require\('.\/)([A-Za-z_.0-9/]+)(.graphql'\))/gm,n=e;const r=[];let o;for(;null!==(o=t.exec(e));){let[e,t,a]=o;const i=`node_${a}`;r.push({moduleName:a,identifier:i}),n=n.replace(e,`node_${a}`)}return{processedText:n,referencedNodes:r}}},129:e=>{e.exports=require("child_process")},747:e=>{e.exports=require("fs")},622:e=>{e.exports=require("path")},195:e=>{e.exports=require("relay-compiler")},182:e=>{e.exports=require("relay-compiler/lib/core/CompilerError")},724:e=>{e.exports=require("relay-compiler/lib/core/IRTransformer")},791:e=>{e.exports=require("relay-compiler/lib/language/javascript/RelayFlowGenerator")},124:e=>{e.exports=require("relay-compiler/lib/transforms/TransformUtils")}},t={};return function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(607)})();
|