790.index.js 259 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672
  1. exports.id = 790;
  2. exports.ids = [790];
  3. exports.modules = {
  4. /***/ 10292:
  5. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  6. "use strict";
  7. const MiniPass = __webpack_require__(84075)
  8. const EE = __webpack_require__(28614).EventEmitter
  9. const fs = __webpack_require__(35747)
  10. let writev = fs.writev
  11. /* istanbul ignore next */
  12. if (!writev) {
  13. // This entire block can be removed if support for earlier than Node.js
  14. // 12.9.0 is not needed.
  15. const binding = process.binding('fs')
  16. const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback
  17. writev = (fd, iovec, pos, cb) => {
  18. const done = (er, bw) => cb(er, bw, iovec)
  19. const req = new FSReqWrap()
  20. req.oncomplete = done
  21. binding.writeBuffers(fd, iovec, pos, req)
  22. }
  23. }
  24. const _autoClose = Symbol('_autoClose')
  25. const _close = Symbol('_close')
  26. const _ended = Symbol('_ended')
  27. const _fd = Symbol('_fd')
  28. const _finished = Symbol('_finished')
  29. const _flags = Symbol('_flags')
  30. const _flush = Symbol('_flush')
  31. const _handleChunk = Symbol('_handleChunk')
  32. const _makeBuf = Symbol('_makeBuf')
  33. const _mode = Symbol('_mode')
  34. const _needDrain = Symbol('_needDrain')
  35. const _onerror = Symbol('_onerror')
  36. const _onopen = Symbol('_onopen')
  37. const _onread = Symbol('_onread')
  38. const _onwrite = Symbol('_onwrite')
  39. const _open = Symbol('_open')
  40. const _path = Symbol('_path')
  41. const _pos = Symbol('_pos')
  42. const _queue = Symbol('_queue')
  43. const _read = Symbol('_read')
  44. const _readSize = Symbol('_readSize')
  45. const _reading = Symbol('_reading')
  46. const _remain = Symbol('_remain')
  47. const _size = Symbol('_size')
  48. const _write = Symbol('_write')
  49. const _writing = Symbol('_writing')
  50. const _defaultFlag = Symbol('_defaultFlag')
  51. const _errored = Symbol('_errored')
  52. class ReadStream extends MiniPass {
  53. constructor (path, opt) {
  54. opt = opt || {}
  55. super(opt)
  56. this.readable = true
  57. this.writable = false
  58. if (typeof path !== 'string')
  59. throw new TypeError('path must be a string')
  60. this[_errored] = false
  61. this[_fd] = typeof opt.fd === 'number' ? opt.fd : null
  62. this[_path] = path
  63. this[_readSize] = opt.readSize || 16*1024*1024
  64. this[_reading] = false
  65. this[_size] = typeof opt.size === 'number' ? opt.size : Infinity
  66. this[_remain] = this[_size]
  67. this[_autoClose] = typeof opt.autoClose === 'boolean' ?
  68. opt.autoClose : true
  69. if (typeof this[_fd] === 'number')
  70. this[_read]()
  71. else
  72. this[_open]()
  73. }
  74. get fd () { return this[_fd] }
  75. get path () { return this[_path] }
  76. write () {
  77. throw new TypeError('this is a readable stream')
  78. }
  79. end () {
  80. throw new TypeError('this is a readable stream')
  81. }
  82. [_open] () {
  83. fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))
  84. }
  85. [_onopen] (er, fd) {
  86. if (er)
  87. this[_onerror](er)
  88. else {
  89. this[_fd] = fd
  90. this.emit('open', fd)
  91. this[_read]()
  92. }
  93. }
  94. [_makeBuf] () {
  95. return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))
  96. }
  97. [_read] () {
  98. if (!this[_reading]) {
  99. this[_reading] = true
  100. const buf = this[_makeBuf]()
  101. /* istanbul ignore if */
  102. if (buf.length === 0)
  103. return process.nextTick(() => this[_onread](null, 0, buf))
  104. fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) =>
  105. this[_onread](er, br, buf))
  106. }
  107. }
  108. [_onread] (er, br, buf) {
  109. this[_reading] = false
  110. if (er)
  111. this[_onerror](er)
  112. else if (this[_handleChunk](br, buf))
  113. this[_read]()
  114. }
  115. [_close] () {
  116. if (this[_autoClose] && typeof this[_fd] === 'number') {
  117. const fd = this[_fd]
  118. this[_fd] = null
  119. fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'))
  120. }
  121. }
  122. [_onerror] (er) {
  123. this[_reading] = true
  124. this[_close]()
  125. this.emit('error', er)
  126. }
  127. [_handleChunk] (br, buf) {
  128. let ret = false
  129. // no effect if infinite
  130. this[_remain] -= br
  131. if (br > 0)
  132. ret = super.write(br < buf.length ? buf.slice(0, br) : buf)
  133. if (br === 0 || this[_remain] <= 0) {
  134. ret = false
  135. this[_close]()
  136. super.end()
  137. }
  138. return ret
  139. }
  140. emit (ev, data) {
  141. switch (ev) {
  142. case 'prefinish':
  143. case 'finish':
  144. break
  145. case 'drain':
  146. if (typeof this[_fd] === 'number')
  147. this[_read]()
  148. break
  149. case 'error':
  150. if (this[_errored])
  151. return
  152. this[_errored] = true
  153. return super.emit(ev, data)
  154. default:
  155. return super.emit(ev, data)
  156. }
  157. }
  158. }
  159. class ReadStreamSync extends ReadStream {
  160. [_open] () {
  161. let threw = true
  162. try {
  163. this[_onopen](null, fs.openSync(this[_path], 'r'))
  164. threw = false
  165. } finally {
  166. if (threw)
  167. this[_close]()
  168. }
  169. }
  170. [_read] () {
  171. let threw = true
  172. try {
  173. if (!this[_reading]) {
  174. this[_reading] = true
  175. do {
  176. const buf = this[_makeBuf]()
  177. /* istanbul ignore next */
  178. const br = buf.length === 0 ? 0
  179. : fs.readSync(this[_fd], buf, 0, buf.length, null)
  180. if (!this[_handleChunk](br, buf))
  181. break
  182. } while (true)
  183. this[_reading] = false
  184. }
  185. threw = false
  186. } finally {
  187. if (threw)
  188. this[_close]()
  189. }
  190. }
  191. [_close] () {
  192. if (this[_autoClose] && typeof this[_fd] === 'number') {
  193. const fd = this[_fd]
  194. this[_fd] = null
  195. fs.closeSync(fd)
  196. this.emit('close')
  197. }
  198. }
  199. }
  200. class WriteStream extends EE {
  201. constructor (path, opt) {
  202. opt = opt || {}
  203. super(opt)
  204. this.readable = false
  205. this.writable = true
  206. this[_errored] = false
  207. this[_writing] = false
  208. this[_ended] = false
  209. this[_needDrain] = false
  210. this[_queue] = []
  211. this[_path] = path
  212. this[_fd] = typeof opt.fd === 'number' ? opt.fd : null
  213. this[_mode] = opt.mode === undefined ? 0o666 : opt.mode
  214. this[_pos] = typeof opt.start === 'number' ? opt.start : null
  215. this[_autoClose] = typeof opt.autoClose === 'boolean' ?
  216. opt.autoClose : true
  217. // truncating makes no sense when writing into the middle
  218. const defaultFlag = this[_pos] !== null ? 'r+' : 'w'
  219. this[_defaultFlag] = opt.flags === undefined
  220. this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags
  221. if (this[_fd] === null)
  222. this[_open]()
  223. }
  224. emit (ev, data) {
  225. if (ev === 'error') {
  226. if (this[_errored])
  227. return
  228. this[_errored] = true
  229. }
  230. return super.emit(ev, data)
  231. }
  232. get fd () { return this[_fd] }
  233. get path () { return this[_path] }
  234. [_onerror] (er) {
  235. this[_close]()
  236. this[_writing] = true
  237. this.emit('error', er)
  238. }
  239. [_open] () {
  240. fs.open(this[_path], this[_flags], this[_mode],
  241. (er, fd) => this[_onopen](er, fd))
  242. }
  243. [_onopen] (er, fd) {
  244. if (this[_defaultFlag] &&
  245. this[_flags] === 'r+' &&
  246. er && er.code === 'ENOENT') {
  247. this[_flags] = 'w'
  248. this[_open]()
  249. } else if (er)
  250. this[_onerror](er)
  251. else {
  252. this[_fd] = fd
  253. this.emit('open', fd)
  254. this[_flush]()
  255. }
  256. }
  257. end (buf, enc) {
  258. if (buf)
  259. this.write(buf, enc)
  260. this[_ended] = true
  261. // synthetic after-write logic, where drain/finish live
  262. if (!this[_writing] && !this[_queue].length &&
  263. typeof this[_fd] === 'number')
  264. this[_onwrite](null, 0)
  265. return this
  266. }
  267. write (buf, enc) {
  268. if (typeof buf === 'string')
  269. buf = Buffer.from(buf, enc)
  270. if (this[_ended]) {
  271. this.emit('error', new Error('write() after end()'))
  272. return false
  273. }
  274. if (this[_fd] === null || this[_writing] || this[_queue].length) {
  275. this[_queue].push(buf)
  276. this[_needDrain] = true
  277. return false
  278. }
  279. this[_writing] = true
  280. this[_write](buf)
  281. return true
  282. }
  283. [_write] (buf) {
  284. fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) =>
  285. this[_onwrite](er, bw))
  286. }
  287. [_onwrite] (er, bw) {
  288. if (er)
  289. this[_onerror](er)
  290. else {
  291. if (this[_pos] !== null)
  292. this[_pos] += bw
  293. if (this[_queue].length)
  294. this[_flush]()
  295. else {
  296. this[_writing] = false
  297. if (this[_ended] && !this[_finished]) {
  298. this[_finished] = true
  299. this[_close]()
  300. this.emit('finish')
  301. } else if (this[_needDrain]) {
  302. this[_needDrain] = false
  303. this.emit('drain')
  304. }
  305. }
  306. }
  307. }
  308. [_flush] () {
  309. if (this[_queue].length === 0) {
  310. if (this[_ended])
  311. this[_onwrite](null, 0)
  312. } else if (this[_queue].length === 1)
  313. this[_write](this[_queue].pop())
  314. else {
  315. const iovec = this[_queue]
  316. this[_queue] = []
  317. writev(this[_fd], iovec, this[_pos],
  318. (er, bw) => this[_onwrite](er, bw))
  319. }
  320. }
  321. [_close] () {
  322. if (this[_autoClose] && typeof this[_fd] === 'number') {
  323. const fd = this[_fd]
  324. this[_fd] = null
  325. fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'))
  326. }
  327. }
  328. }
  329. class WriteStreamSync extends WriteStream {
  330. [_open] () {
  331. let fd
  332. // only wrap in a try{} block if we know we'll retry, to avoid
  333. // the rethrow obscuring the error's source frame in most cases.
  334. if (this[_defaultFlag] && this[_flags] === 'r+') {
  335. try {
  336. fd = fs.openSync(this[_path], this[_flags], this[_mode])
  337. } catch (er) {
  338. if (er.code === 'ENOENT') {
  339. this[_flags] = 'w'
  340. return this[_open]()
  341. } else
  342. throw er
  343. }
  344. } else
  345. fd = fs.openSync(this[_path], this[_flags], this[_mode])
  346. this[_onopen](null, fd)
  347. }
  348. [_close] () {
  349. if (this[_autoClose] && typeof this[_fd] === 'number') {
  350. const fd = this[_fd]
  351. this[_fd] = null
  352. fs.closeSync(fd)
  353. this.emit('close')
  354. }
  355. }
  356. [_write] (buf) {
  357. // throw the original, but try to close if it fails
  358. let threw = true
  359. try {
  360. this[_onwrite](null,
  361. fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos]))
  362. threw = false
  363. } finally {
  364. if (threw)
  365. try { this[_close]() } catch (_) {}
  366. }
  367. }
  368. }
  369. exports.ReadStream = ReadStream
  370. exports.ReadStreamSync = ReadStreamSync
  371. exports.WriteStream = WriteStream
  372. exports.WriteStreamSync = WriteStreamSync
  373. /***/ }),
  374. /***/ 84075:
  375. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  376. "use strict";
  377. const EE = __webpack_require__(28614)
  378. const Stream = __webpack_require__(92413)
  379. const Yallist = __webpack_require__(20315)
  380. const SD = __webpack_require__(24304).StringDecoder
  381. const EOF = Symbol('EOF')
  382. const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
  383. const EMITTED_END = Symbol('emittedEnd')
  384. const EMITTING_END = Symbol('emittingEnd')
  385. const CLOSED = Symbol('closed')
  386. const READ = Symbol('read')
  387. const FLUSH = Symbol('flush')
  388. const FLUSHCHUNK = Symbol('flushChunk')
  389. const ENCODING = Symbol('encoding')
  390. const DECODER = Symbol('decoder')
  391. const FLOWING = Symbol('flowing')
  392. const PAUSED = Symbol('paused')
  393. const RESUME = Symbol('resume')
  394. const BUFFERLENGTH = Symbol('bufferLength')
  395. const BUFFERPUSH = Symbol('bufferPush')
  396. const BUFFERSHIFT = Symbol('bufferShift')
  397. const OBJECTMODE = Symbol('objectMode')
  398. const DESTROYED = Symbol('destroyed')
  399. // TODO remove when Node v8 support drops
  400. const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
  401. const ASYNCITERATOR = doIter && Symbol.asyncIterator
  402. || Symbol('asyncIterator not implemented')
  403. const ITERATOR = doIter && Symbol.iterator
  404. || Symbol('iterator not implemented')
  405. // events that mean 'the stream is over'
  406. // these are treated specially, and re-emitted
  407. // if they are listened for after emitting.
  408. const isEndish = ev =>
  409. ev === 'end' ||
  410. ev === 'finish' ||
  411. ev === 'prefinish'
  412. const isArrayBuffer = b => b instanceof ArrayBuffer ||
  413. typeof b === 'object' &&
  414. b.constructor &&
  415. b.constructor.name === 'ArrayBuffer' &&
  416. b.byteLength >= 0
  417. const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
  418. module.exports = class Minipass extends Stream {
  419. constructor (options) {
  420. super()
  421. this[FLOWING] = false
  422. // whether we're explicitly paused
  423. this[PAUSED] = false
  424. this.pipes = new Yallist()
  425. this.buffer = new Yallist()
  426. this[OBJECTMODE] = options && options.objectMode || false
  427. if (this[OBJECTMODE])
  428. this[ENCODING] = null
  429. else
  430. this[ENCODING] = options && options.encoding || null
  431. if (this[ENCODING] === 'buffer')
  432. this[ENCODING] = null
  433. this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
  434. this[EOF] = false
  435. this[EMITTED_END] = false
  436. this[EMITTING_END] = false
  437. this[CLOSED] = false
  438. this.writable = true
  439. this.readable = true
  440. this[BUFFERLENGTH] = 0
  441. this[DESTROYED] = false
  442. }
  443. get bufferLength () { return this[BUFFERLENGTH] }
  444. get encoding () { return this[ENCODING] }
  445. set encoding (enc) {
  446. if (this[OBJECTMODE])
  447. throw new Error('cannot set encoding in objectMode')
  448. if (this[ENCODING] && enc !== this[ENCODING] &&
  449. (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH]))
  450. throw new Error('cannot change encoding')
  451. if (this[ENCODING] !== enc) {
  452. this[DECODER] = enc ? new SD(enc) : null
  453. if (this.buffer.length)
  454. this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk))
  455. }
  456. this[ENCODING] = enc
  457. }
  458. setEncoding (enc) {
  459. this.encoding = enc
  460. }
  461. get objectMode () { return this[OBJECTMODE] }
  462. set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om }
  463. write (chunk, encoding, cb) {
  464. if (this[EOF])
  465. throw new Error('write after end')
  466. if (this[DESTROYED]) {
  467. this.emit('error', Object.assign(
  468. new Error('Cannot call write after a stream was destroyed'),
  469. { code: 'ERR_STREAM_DESTROYED' }
  470. ))
  471. return true
  472. }
  473. if (typeof encoding === 'function')
  474. cb = encoding, encoding = 'utf8'
  475. if (!encoding)
  476. encoding = 'utf8'
  477. // convert array buffers and typed array views into buffers
  478. // at some point in the future, we may want to do the opposite!
  479. // leave strings and buffers as-is
  480. // anything else switches us into object mode
  481. if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
  482. if (isArrayBufferView(chunk))
  483. chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
  484. else if (isArrayBuffer(chunk))
  485. chunk = Buffer.from(chunk)
  486. else if (typeof chunk !== 'string')
  487. // use the setter so we throw if we have encoding set
  488. this.objectMode = true
  489. }
  490. // this ensures at this point that the chunk is a buffer or string
  491. // don't buffer it up or send it to the decoder
  492. if (!this.objectMode && !chunk.length) {
  493. if (this[BUFFERLENGTH] !== 0)
  494. this.emit('readable')
  495. if (cb)
  496. cb()
  497. return this.flowing
  498. }
  499. // fast-path writing strings of same encoding to a stream with
  500. // an empty buffer, skipping the buffer/decoder dance
  501. if (typeof chunk === 'string' && !this[OBJECTMODE] &&
  502. // unless it is a string already ready for us to use
  503. !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) {
  504. chunk = Buffer.from(chunk, encoding)
  505. }
  506. if (Buffer.isBuffer(chunk) && this[ENCODING])
  507. chunk = this[DECODER].write(chunk)
  508. if (this.flowing) {
  509. // if we somehow have something in the buffer, but we think we're
  510. // flowing, then we need to flush all that out first, or we get
  511. // chunks coming in out of order. Can't emit 'drain' here though,
  512. // because we're mid-write, so that'd be bad.
  513. if (this[BUFFERLENGTH] !== 0)
  514. this[FLUSH](true)
  515. this.emit('data', chunk)
  516. } else
  517. this[BUFFERPUSH](chunk)
  518. if (this[BUFFERLENGTH] !== 0)
  519. this.emit('readable')
  520. if (cb)
  521. cb()
  522. return this.flowing
  523. }
  524. read (n) {
  525. if (this[DESTROYED])
  526. return null
  527. try {
  528. if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH])
  529. return null
  530. if (this[OBJECTMODE])
  531. n = null
  532. if (this.buffer.length > 1 && !this[OBJECTMODE]) {
  533. if (this.encoding)
  534. this.buffer = new Yallist([
  535. Array.from(this.buffer).join('')
  536. ])
  537. else
  538. this.buffer = new Yallist([
  539. Buffer.concat(Array.from(this.buffer), this[BUFFERLENGTH])
  540. ])
  541. }
  542. return this[READ](n || null, this.buffer.head.value)
  543. } finally {
  544. this[MAYBE_EMIT_END]()
  545. }
  546. }
  547. [READ] (n, chunk) {
  548. if (n === chunk.length || n === null)
  549. this[BUFFERSHIFT]()
  550. else {
  551. this.buffer.head.value = chunk.slice(n)
  552. chunk = chunk.slice(0, n)
  553. this[BUFFERLENGTH] -= n
  554. }
  555. this.emit('data', chunk)
  556. if (!this.buffer.length && !this[EOF])
  557. this.emit('drain')
  558. return chunk
  559. }
  560. end (chunk, encoding, cb) {
  561. if (typeof chunk === 'function')
  562. cb = chunk, chunk = null
  563. if (typeof encoding === 'function')
  564. cb = encoding, encoding = 'utf8'
  565. if (chunk)
  566. this.write(chunk, encoding)
  567. if (cb)
  568. this.once('end', cb)
  569. this[EOF] = true
  570. this.writable = false
  571. // if we haven't written anything, then go ahead and emit,
  572. // even if we're not reading.
  573. // we'll re-emit if a new 'end' listener is added anyway.
  574. // This makes MP more suitable to write-only use cases.
  575. if (this.flowing || !this[PAUSED])
  576. this[MAYBE_EMIT_END]()
  577. return this
  578. }
  579. // don't let the internal resume be overwritten
  580. [RESUME] () {
  581. if (this[DESTROYED])
  582. return
  583. this[PAUSED] = false
  584. this[FLOWING] = true
  585. this.emit('resume')
  586. if (this.buffer.length)
  587. this[FLUSH]()
  588. else if (this[EOF])
  589. this[MAYBE_EMIT_END]()
  590. else
  591. this.emit('drain')
  592. }
  593. resume () {
  594. return this[RESUME]()
  595. }
  596. pause () {
  597. this[FLOWING] = false
  598. this[PAUSED] = true
  599. }
  600. get destroyed () {
  601. return this[DESTROYED]
  602. }
  603. get flowing () {
  604. return this[FLOWING]
  605. }
  606. get paused () {
  607. return this[PAUSED]
  608. }
  609. [BUFFERPUSH] (chunk) {
  610. if (this[OBJECTMODE])
  611. this[BUFFERLENGTH] += 1
  612. else
  613. this[BUFFERLENGTH] += chunk.length
  614. return this.buffer.push(chunk)
  615. }
  616. [BUFFERSHIFT] () {
  617. if (this.buffer.length) {
  618. if (this[OBJECTMODE])
  619. this[BUFFERLENGTH] -= 1
  620. else
  621. this[BUFFERLENGTH] -= this.buffer.head.value.length
  622. }
  623. return this.buffer.shift()
  624. }
  625. [FLUSH] (noDrain) {
  626. do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()))
  627. if (!noDrain && !this.buffer.length && !this[EOF])
  628. this.emit('drain')
  629. }
  630. [FLUSHCHUNK] (chunk) {
  631. return chunk ? (this.emit('data', chunk), this.flowing) : false
  632. }
  633. pipe (dest, opts) {
  634. if (this[DESTROYED])
  635. return
  636. const ended = this[EMITTED_END]
  637. opts = opts || {}
  638. if (dest === process.stdout || dest === process.stderr)
  639. opts.end = false
  640. else
  641. opts.end = opts.end !== false
  642. const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() }
  643. this.pipes.push(p)
  644. dest.on('drain', p.ondrain)
  645. this[RESUME]()
  646. // piping an ended stream ends immediately
  647. if (ended && p.opts.end)
  648. p.dest.end()
  649. return dest
  650. }
  651. addListener (ev, fn) {
  652. return this.on(ev, fn)
  653. }
  654. on (ev, fn) {
  655. try {
  656. return super.on(ev, fn)
  657. } finally {
  658. if (ev === 'data' && !this.pipes.length && !this.flowing)
  659. this[RESUME]()
  660. else if (isEndish(ev) && this[EMITTED_END]) {
  661. super.emit(ev)
  662. this.removeAllListeners(ev)
  663. }
  664. }
  665. }
  666. get emittedEnd () {
  667. return this[EMITTED_END]
  668. }
  669. [MAYBE_EMIT_END] () {
  670. if (!this[EMITTING_END] &&
  671. !this[EMITTED_END] &&
  672. !this[DESTROYED] &&
  673. this.buffer.length === 0 &&
  674. this[EOF]) {
  675. this[EMITTING_END] = true
  676. this.emit('end')
  677. this.emit('prefinish')
  678. this.emit('finish')
  679. if (this[CLOSED])
  680. this.emit('close')
  681. this[EMITTING_END] = false
  682. }
  683. }
  684. emit (ev, data) {
  685. // error and close are only events allowed after calling destroy()
  686. if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
  687. return
  688. else if (ev === 'data') {
  689. if (!data)
  690. return
  691. if (this.pipes.length)
  692. this.pipes.forEach(p =>
  693. p.dest.write(data) === false && this.pause())
  694. } else if (ev === 'end') {
  695. // only actual end gets this treatment
  696. if (this[EMITTED_END] === true)
  697. return
  698. this[EMITTED_END] = true
  699. this.readable = false
  700. if (this[DECODER]) {
  701. data = this[DECODER].end()
  702. if (data) {
  703. this.pipes.forEach(p => p.dest.write(data))
  704. super.emit('data', data)
  705. }
  706. }
  707. this.pipes.forEach(p => {
  708. p.dest.removeListener('drain', p.ondrain)
  709. if (p.opts.end)
  710. p.dest.end()
  711. })
  712. } else if (ev === 'close') {
  713. this[CLOSED] = true
  714. // don't emit close before 'end' and 'finish'
  715. if (!this[EMITTED_END] && !this[DESTROYED])
  716. return
  717. }
  718. // TODO: replace with a spread operator when Node v4 support drops
  719. const args = new Array(arguments.length)
  720. args[0] = ev
  721. args[1] = data
  722. if (arguments.length > 2) {
  723. for (let i = 2; i < arguments.length; i++) {
  724. args[i] = arguments[i]
  725. }
  726. }
  727. try {
  728. return super.emit.apply(this, args)
  729. } finally {
  730. if (!isEndish(ev))
  731. this[MAYBE_EMIT_END]()
  732. else
  733. this.removeAllListeners(ev)
  734. }
  735. }
  736. // const all = await stream.collect()
  737. collect () {
  738. const buf = []
  739. if (!this[OBJECTMODE])
  740. buf.dataLength = 0
  741. // set the promise first, in case an error is raised
  742. // by triggering the flow here.
  743. const p = this.promise()
  744. this.on('data', c => {
  745. buf.push(c)
  746. if (!this[OBJECTMODE])
  747. buf.dataLength += c.length
  748. })
  749. return p.then(() => buf)
  750. }
  751. // const data = await stream.concat()
  752. concat () {
  753. return this[OBJECTMODE]
  754. ? Promise.reject(new Error('cannot concat in objectMode'))
  755. : this.collect().then(buf =>
  756. this[OBJECTMODE]
  757. ? Promise.reject(new Error('cannot concat in objectMode'))
  758. : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength))
  759. }
  760. // stream.promise().then(() => done, er => emitted error)
  761. promise () {
  762. return new Promise((resolve, reject) => {
  763. this.on(DESTROYED, () => reject(new Error('stream destroyed')))
  764. this.on('end', () => resolve())
  765. this.on('error', er => reject(er))
  766. })
  767. }
  768. // for await (let chunk of stream)
  769. [ASYNCITERATOR] () {
  770. const next = () => {
  771. const res = this.read()
  772. if (res !== null)
  773. return Promise.resolve({ done: false, value: res })
  774. if (this[EOF])
  775. return Promise.resolve({ done: true })
  776. let resolve = null
  777. let reject = null
  778. const onerr = er => {
  779. this.removeListener('data', ondata)
  780. this.removeListener('end', onend)
  781. reject(er)
  782. }
  783. const ondata = value => {
  784. this.removeListener('error', onerr)
  785. this.removeListener('end', onend)
  786. this.pause()
  787. resolve({ value: value, done: !!this[EOF] })
  788. }
  789. const onend = () => {
  790. this.removeListener('error', onerr)
  791. this.removeListener('data', ondata)
  792. resolve({ done: true })
  793. }
  794. const ondestroy = () => onerr(new Error('stream destroyed'))
  795. return new Promise((res, rej) => {
  796. reject = rej
  797. resolve = res
  798. this.once(DESTROYED, ondestroy)
  799. this.once('error', onerr)
  800. this.once('end', onend)
  801. this.once('data', ondata)
  802. })
  803. }
  804. return { next }
  805. }
  806. // for (let chunk of stream)
  807. [ITERATOR] () {
  808. const next = () => {
  809. const value = this.read()
  810. const done = value === null
  811. return { value, done }
  812. }
  813. return { next }
  814. }
  815. destroy (er) {
  816. if (this[DESTROYED]) {
  817. if (er)
  818. this.emit('error', er)
  819. else
  820. this.emit(DESTROYED)
  821. return this
  822. }
  823. this[DESTROYED] = true
  824. // throw away all buffered data, it's never coming out
  825. this.buffer = new Yallist()
  826. this[BUFFERLENGTH] = 0
  827. if (typeof this.close === 'function' && !this[CLOSED])
  828. this.close()
  829. if (er)
  830. this.emit('error', er)
  831. else // if no error to emit, still reject pending promises
  832. this.emit(DESTROYED)
  833. return this
  834. }
  835. static isStream (s) {
  836. return !!s && (s instanceof Minipass || s instanceof Stream ||
  837. s instanceof EE && (
  838. typeof s.pipe === 'function' || // readable
  839. (typeof s.write === 'function' && typeof s.end === 'function') // writable
  840. ))
  841. }
  842. }
  843. /***/ }),
  844. /***/ 21465:
  845. /***/ ((module) => {
  846. "use strict";
  847. module.exports = function (Yallist) {
  848. Yallist.prototype[Symbol.iterator] = function* () {
  849. for (let walker = this.head; walker; walker = walker.next) {
  850. yield walker.value
  851. }
  852. }
  853. }
  854. /***/ }),
  855. /***/ 20315:
  856. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  857. "use strict";
  858. module.exports = Yallist
  859. Yallist.Node = Node
  860. Yallist.create = Yallist
  861. function Yallist (list) {
  862. var self = this
  863. if (!(self instanceof Yallist)) {
  864. self = new Yallist()
  865. }
  866. self.tail = null
  867. self.head = null
  868. self.length = 0
  869. if (list && typeof list.forEach === 'function') {
  870. list.forEach(function (item) {
  871. self.push(item)
  872. })
  873. } else if (arguments.length > 0) {
  874. for (var i = 0, l = arguments.length; i < l; i++) {
  875. self.push(arguments[i])
  876. }
  877. }
  878. return self
  879. }
  880. Yallist.prototype.removeNode = function (node) {
  881. if (node.list !== this) {
  882. throw new Error('removing node which does not belong to this list')
  883. }
  884. var next = node.next
  885. var prev = node.prev
  886. if (next) {
  887. next.prev = prev
  888. }
  889. if (prev) {
  890. prev.next = next
  891. }
  892. if (node === this.head) {
  893. this.head = next
  894. }
  895. if (node === this.tail) {
  896. this.tail = prev
  897. }
  898. node.list.length--
  899. node.next = null
  900. node.prev = null
  901. node.list = null
  902. return next
  903. }
  904. Yallist.prototype.unshiftNode = function (node) {
  905. if (node === this.head) {
  906. return
  907. }
  908. if (node.list) {
  909. node.list.removeNode(node)
  910. }
  911. var head = this.head
  912. node.list = this
  913. node.next = head
  914. if (head) {
  915. head.prev = node
  916. }
  917. this.head = node
  918. if (!this.tail) {
  919. this.tail = node
  920. }
  921. this.length++
  922. }
  923. Yallist.prototype.pushNode = function (node) {
  924. if (node === this.tail) {
  925. return
  926. }
  927. if (node.list) {
  928. node.list.removeNode(node)
  929. }
  930. var tail = this.tail
  931. node.list = this
  932. node.prev = tail
  933. if (tail) {
  934. tail.next = node
  935. }
  936. this.tail = node
  937. if (!this.head) {
  938. this.head = node
  939. }
  940. this.length++
  941. }
  942. Yallist.prototype.push = function () {
  943. for (var i = 0, l = arguments.length; i < l; i++) {
  944. push(this, arguments[i])
  945. }
  946. return this.length
  947. }
  948. Yallist.prototype.unshift = function () {
  949. for (var i = 0, l = arguments.length; i < l; i++) {
  950. unshift(this, arguments[i])
  951. }
  952. return this.length
  953. }
  954. Yallist.prototype.pop = function () {
  955. if (!this.tail) {
  956. return undefined
  957. }
  958. var res = this.tail.value
  959. this.tail = this.tail.prev
  960. if (this.tail) {
  961. this.tail.next = null
  962. } else {
  963. this.head = null
  964. }
  965. this.length--
  966. return res
  967. }
  968. Yallist.prototype.shift = function () {
  969. if (!this.head) {
  970. return undefined
  971. }
  972. var res = this.head.value
  973. this.head = this.head.next
  974. if (this.head) {
  975. this.head.prev = null
  976. } else {
  977. this.tail = null
  978. }
  979. this.length--
  980. return res
  981. }
  982. Yallist.prototype.forEach = function (fn, thisp) {
  983. thisp = thisp || this
  984. for (var walker = this.head, i = 0; walker !== null; i++) {
  985. fn.call(thisp, walker.value, i, this)
  986. walker = walker.next
  987. }
  988. }
  989. Yallist.prototype.forEachReverse = function (fn, thisp) {
  990. thisp = thisp || this
  991. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  992. fn.call(thisp, walker.value, i, this)
  993. walker = walker.prev
  994. }
  995. }
  996. Yallist.prototype.get = function (n) {
  997. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  998. // abort out of the list early if we hit a cycle
  999. walker = walker.next
  1000. }
  1001. if (i === n && walker !== null) {
  1002. return walker.value
  1003. }
  1004. }
  1005. Yallist.prototype.getReverse = function (n) {
  1006. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  1007. // abort out of the list early if we hit a cycle
  1008. walker = walker.prev
  1009. }
  1010. if (i === n && walker !== null) {
  1011. return walker.value
  1012. }
  1013. }
  1014. Yallist.prototype.map = function (fn, thisp) {
  1015. thisp = thisp || this
  1016. var res = new Yallist()
  1017. for (var walker = this.head; walker !== null;) {
  1018. res.push(fn.call(thisp, walker.value, this))
  1019. walker = walker.next
  1020. }
  1021. return res
  1022. }
  1023. Yallist.prototype.mapReverse = function (fn, thisp) {
  1024. thisp = thisp || this
  1025. var res = new Yallist()
  1026. for (var walker = this.tail; walker !== null;) {
  1027. res.push(fn.call(thisp, walker.value, this))
  1028. walker = walker.prev
  1029. }
  1030. return res
  1031. }
  1032. Yallist.prototype.reduce = function (fn, initial) {
  1033. var acc
  1034. var walker = this.head
  1035. if (arguments.length > 1) {
  1036. acc = initial
  1037. } else if (this.head) {
  1038. walker = this.head.next
  1039. acc = this.head.value
  1040. } else {
  1041. throw new TypeError('Reduce of empty list with no initial value')
  1042. }
  1043. for (var i = 0; walker !== null; i++) {
  1044. acc = fn(acc, walker.value, i)
  1045. walker = walker.next
  1046. }
  1047. return acc
  1048. }
  1049. Yallist.prototype.reduceReverse = function (fn, initial) {
  1050. var acc
  1051. var walker = this.tail
  1052. if (arguments.length > 1) {
  1053. acc = initial
  1054. } else if (this.tail) {
  1055. walker = this.tail.prev
  1056. acc = this.tail.value
  1057. } else {
  1058. throw new TypeError('Reduce of empty list with no initial value')
  1059. }
  1060. for (var i = this.length - 1; walker !== null; i--) {
  1061. acc = fn(acc, walker.value, i)
  1062. walker = walker.prev
  1063. }
  1064. return acc
  1065. }
  1066. Yallist.prototype.toArray = function () {
  1067. var arr = new Array(this.length)
  1068. for (var i = 0, walker = this.head; walker !== null; i++) {
  1069. arr[i] = walker.value
  1070. walker = walker.next
  1071. }
  1072. return arr
  1073. }
  1074. Yallist.prototype.toArrayReverse = function () {
  1075. var arr = new Array(this.length)
  1076. for (var i = 0, walker = this.tail; walker !== null; i++) {
  1077. arr[i] = walker.value
  1078. walker = walker.prev
  1079. }
  1080. return arr
  1081. }
  1082. Yallist.prototype.slice = function (from, to) {
  1083. to = to || this.length
  1084. if (to < 0) {
  1085. to += this.length
  1086. }
  1087. from = from || 0
  1088. if (from < 0) {
  1089. from += this.length
  1090. }
  1091. var ret = new Yallist()
  1092. if (to < from || to < 0) {
  1093. return ret
  1094. }
  1095. if (from < 0) {
  1096. from = 0
  1097. }
  1098. if (to > this.length) {
  1099. to = this.length
  1100. }
  1101. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  1102. walker = walker.next
  1103. }
  1104. for (; walker !== null && i < to; i++, walker = walker.next) {
  1105. ret.push(walker.value)
  1106. }
  1107. return ret
  1108. }
  1109. Yallist.prototype.sliceReverse = function (from, to) {
  1110. to = to || this.length
  1111. if (to < 0) {
  1112. to += this.length
  1113. }
  1114. from = from || 0
  1115. if (from < 0) {
  1116. from += this.length
  1117. }
  1118. var ret = new Yallist()
  1119. if (to < from || to < 0) {
  1120. return ret
  1121. }
  1122. if (from < 0) {
  1123. from = 0
  1124. }
  1125. if (to > this.length) {
  1126. to = this.length
  1127. }
  1128. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  1129. walker = walker.prev
  1130. }
  1131. for (; walker !== null && i > from; i--, walker = walker.prev) {
  1132. ret.push(walker.value)
  1133. }
  1134. return ret
  1135. }
  1136. Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
  1137. if (start > this.length) {
  1138. start = this.length - 1
  1139. }
  1140. if (start < 0) {
  1141. start = this.length + start;
  1142. }
  1143. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  1144. walker = walker.next
  1145. }
  1146. var ret = []
  1147. for (var i = 0; walker && i < deleteCount; i++) {
  1148. ret.push(walker.value)
  1149. walker = this.removeNode(walker)
  1150. }
  1151. if (walker === null) {
  1152. walker = this.tail
  1153. }
  1154. if (walker !== this.head && walker !== this.tail) {
  1155. walker = walker.prev
  1156. }
  1157. for (var i = 0; i < nodes.length; i++) {
  1158. walker = insert(this, walker, nodes[i])
  1159. }
  1160. return ret;
  1161. }
  1162. Yallist.prototype.reverse = function () {
  1163. var head = this.head
  1164. var tail = this.tail
  1165. for (var walker = head; walker !== null; walker = walker.prev) {
  1166. var p = walker.prev
  1167. walker.prev = walker.next
  1168. walker.next = p
  1169. }
  1170. this.head = tail
  1171. this.tail = head
  1172. return this
  1173. }
  1174. function insert (self, node, value) {
  1175. var inserted = node === self.head ?
  1176. new Node(value, null, node, self) :
  1177. new Node(value, node, node.next, self)
  1178. if (inserted.next === null) {
  1179. self.tail = inserted
  1180. }
  1181. if (inserted.prev === null) {
  1182. self.head = inserted
  1183. }
  1184. self.length++
  1185. return inserted
  1186. }
  1187. function push (self, item) {
  1188. self.tail = new Node(item, self.tail, null, self)
  1189. if (!self.head) {
  1190. self.head = self.tail
  1191. }
  1192. self.length++
  1193. }
  1194. function unshift (self, item) {
  1195. self.head = new Node(item, null, self.head, self)
  1196. if (!self.tail) {
  1197. self.tail = self.head
  1198. }
  1199. self.length++
  1200. }
  1201. function Node (value, prev, next, list) {
  1202. if (!(this instanceof Node)) {
  1203. return new Node(value, prev, next, list)
  1204. }
  1205. this.list = list
  1206. this.value = value
  1207. if (prev) {
  1208. prev.next = this
  1209. this.prev = prev
  1210. } else {
  1211. this.prev = null
  1212. }
  1213. if (next) {
  1214. next.prev = this
  1215. this.next = next
  1216. } else {
  1217. this.next = null
  1218. }
  1219. }
  1220. try {
  1221. // add if support for Symbol.iterator is present
  1222. __webpack_require__(21465)(Yallist)
  1223. } catch (er) {}
  1224. /***/ }),
  1225. /***/ 20883:
  1226. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1227. // Update with any zlib constants that are added or changed in the future.
  1228. // Node v6 didn't export this, so we just hard code the version and rely
  1229. // on all the other hard-coded values from zlib v4736. When node v6
  1230. // support drops, we can just export the realZlibConstants object.
  1231. const realZlibConstants = __webpack_require__(78761).constants ||
  1232. /* istanbul ignore next */ { ZLIB_VERNUM: 4736 }
  1233. module.exports = Object.freeze(Object.assign(Object.create(null), {
  1234. Z_NO_FLUSH: 0,
  1235. Z_PARTIAL_FLUSH: 1,
  1236. Z_SYNC_FLUSH: 2,
  1237. Z_FULL_FLUSH: 3,
  1238. Z_FINISH: 4,
  1239. Z_BLOCK: 5,
  1240. Z_OK: 0,
  1241. Z_STREAM_END: 1,
  1242. Z_NEED_DICT: 2,
  1243. Z_ERRNO: -1,
  1244. Z_STREAM_ERROR: -2,
  1245. Z_DATA_ERROR: -3,
  1246. Z_MEM_ERROR: -4,
  1247. Z_BUF_ERROR: -5,
  1248. Z_VERSION_ERROR: -6,
  1249. Z_NO_COMPRESSION: 0,
  1250. Z_BEST_SPEED: 1,
  1251. Z_BEST_COMPRESSION: 9,
  1252. Z_DEFAULT_COMPRESSION: -1,
  1253. Z_FILTERED: 1,
  1254. Z_HUFFMAN_ONLY: 2,
  1255. Z_RLE: 3,
  1256. Z_FIXED: 4,
  1257. Z_DEFAULT_STRATEGY: 0,
  1258. DEFLATE: 1,
  1259. INFLATE: 2,
  1260. GZIP: 3,
  1261. GUNZIP: 4,
  1262. DEFLATERAW: 5,
  1263. INFLATERAW: 6,
  1264. UNZIP: 7,
  1265. BROTLI_DECODE: 8,
  1266. BROTLI_ENCODE: 9,
  1267. Z_MIN_WINDOWBITS: 8,
  1268. Z_MAX_WINDOWBITS: 15,
  1269. Z_DEFAULT_WINDOWBITS: 15,
  1270. Z_MIN_CHUNK: 64,
  1271. Z_MAX_CHUNK: Infinity,
  1272. Z_DEFAULT_CHUNK: 16384,
  1273. Z_MIN_MEMLEVEL: 1,
  1274. Z_MAX_MEMLEVEL: 9,
  1275. Z_DEFAULT_MEMLEVEL: 8,
  1276. Z_MIN_LEVEL: -1,
  1277. Z_MAX_LEVEL: 9,
  1278. Z_DEFAULT_LEVEL: -1,
  1279. BROTLI_OPERATION_PROCESS: 0,
  1280. BROTLI_OPERATION_FLUSH: 1,
  1281. BROTLI_OPERATION_FINISH: 2,
  1282. BROTLI_OPERATION_EMIT_METADATA: 3,
  1283. BROTLI_MODE_GENERIC: 0,
  1284. BROTLI_MODE_TEXT: 1,
  1285. BROTLI_MODE_FONT: 2,
  1286. BROTLI_DEFAULT_MODE: 0,
  1287. BROTLI_MIN_QUALITY: 0,
  1288. BROTLI_MAX_QUALITY: 11,
  1289. BROTLI_DEFAULT_QUALITY: 11,
  1290. BROTLI_MIN_WINDOW_BITS: 10,
  1291. BROTLI_MAX_WINDOW_BITS: 24,
  1292. BROTLI_LARGE_MAX_WINDOW_BITS: 30,
  1293. BROTLI_DEFAULT_WINDOW: 22,
  1294. BROTLI_MIN_INPUT_BLOCK_BITS: 16,
  1295. BROTLI_MAX_INPUT_BLOCK_BITS: 24,
  1296. BROTLI_PARAM_MODE: 0,
  1297. BROTLI_PARAM_QUALITY: 1,
  1298. BROTLI_PARAM_LGWIN: 2,
  1299. BROTLI_PARAM_LGBLOCK: 3,
  1300. BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
  1301. BROTLI_PARAM_SIZE_HINT: 5,
  1302. BROTLI_PARAM_LARGE_WINDOW: 6,
  1303. BROTLI_PARAM_NPOSTFIX: 7,
  1304. BROTLI_PARAM_NDIRECT: 8,
  1305. BROTLI_DECODER_RESULT_ERROR: 0,
  1306. BROTLI_DECODER_RESULT_SUCCESS: 1,
  1307. BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
  1308. BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
  1309. BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
  1310. BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
  1311. BROTLI_DECODER_NO_ERROR: 0,
  1312. BROTLI_DECODER_SUCCESS: 1,
  1313. BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
  1314. BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
  1315. BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
  1316. BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
  1317. BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
  1318. BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
  1319. BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
  1320. BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
  1321. BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
  1322. BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
  1323. BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
  1324. BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
  1325. BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
  1326. BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
  1327. BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
  1328. BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
  1329. BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
  1330. BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
  1331. BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
  1332. BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
  1333. BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
  1334. BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
  1335. BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
  1336. BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
  1337. BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
  1338. BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
  1339. BROTLI_DECODER_ERROR_UNREACHABLE: -31,
  1340. }, realZlibConstants))
  1341. /***/ }),
  1342. /***/ 31650:
  1343. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1344. "use strict";
  1345. const assert = __webpack_require__(42357)
  1346. const Buffer = __webpack_require__(64293).Buffer
  1347. const realZlib = __webpack_require__(78761)
  1348. const constants = exports.constants = __webpack_require__(20883)
  1349. const Minipass = __webpack_require__(30454)
  1350. const OriginalBufferConcat = Buffer.concat
  1351. const _superWrite = Symbol('_superWrite')
  1352. class ZlibError extends Error {
  1353. constructor (err) {
  1354. super('zlib: ' + err.message)
  1355. this.code = err.code
  1356. this.errno = err.errno
  1357. /* istanbul ignore if */
  1358. if (!this.code)
  1359. this.code = 'ZLIB_ERROR'
  1360. this.message = 'zlib: ' + err.message
  1361. Error.captureStackTrace(this, this.constructor)
  1362. }
  1363. get name () {
  1364. return 'ZlibError'
  1365. }
  1366. }
  1367. // the Zlib class they all inherit from
  1368. // This thing manages the queue of requests, and returns
  1369. // true or false if there is anything in the queue when
  1370. // you call the .write() method.
  1371. const _opts = Symbol('opts')
  1372. const _flushFlag = Symbol('flushFlag')
  1373. const _finishFlushFlag = Symbol('finishFlushFlag')
  1374. const _fullFlushFlag = Symbol('fullFlushFlag')
  1375. const _handle = Symbol('handle')
  1376. const _onError = Symbol('onError')
  1377. const _sawError = Symbol('sawError')
  1378. const _level = Symbol('level')
  1379. const _strategy = Symbol('strategy')
  1380. const _ended = Symbol('ended')
  1381. const _defaultFullFlush = Symbol('_defaultFullFlush')
  1382. class ZlibBase extends Minipass {
  1383. constructor (opts, mode) {
  1384. if (!opts || typeof opts !== 'object')
  1385. throw new TypeError('invalid options for ZlibBase constructor')
  1386. super(opts)
  1387. this[_sawError] = false
  1388. this[_ended] = false
  1389. this[_opts] = opts
  1390. this[_flushFlag] = opts.flush
  1391. this[_finishFlushFlag] = opts.finishFlush
  1392. // this will throw if any options are invalid for the class selected
  1393. try {
  1394. this[_handle] = new realZlib[mode](opts)
  1395. } catch (er) {
  1396. // make sure that all errors get decorated properly
  1397. throw new ZlibError(er)
  1398. }
  1399. this[_onError] = (err) => {
  1400. // no sense raising multiple errors, since we abort on the first one.
  1401. if (this[_sawError])
  1402. return
  1403. this[_sawError] = true
  1404. // there is no way to cleanly recover.
  1405. // continuing only obscures problems.
  1406. this.close()
  1407. this.emit('error', err)
  1408. }
  1409. this[_handle].on('error', er => this[_onError](new ZlibError(er)))
  1410. this.once('end', () => this.close)
  1411. }
  1412. close () {
  1413. if (this[_handle]) {
  1414. this[_handle].close()
  1415. this[_handle] = null
  1416. this.emit('close')
  1417. }
  1418. }
  1419. reset () {
  1420. if (!this[_sawError]) {
  1421. assert(this[_handle], 'zlib binding closed')
  1422. return this[_handle].reset()
  1423. }
  1424. }
  1425. flush (flushFlag) {
  1426. if (this.ended)
  1427. return
  1428. if (typeof flushFlag !== 'number')
  1429. flushFlag = this[_fullFlushFlag]
  1430. this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))
  1431. }
  1432. end (chunk, encoding, cb) {
  1433. if (chunk)
  1434. this.write(chunk, encoding)
  1435. this.flush(this[_finishFlushFlag])
  1436. this[_ended] = true
  1437. return super.end(null, null, cb)
  1438. }
  1439. get ended () {
  1440. return this[_ended]
  1441. }
  1442. write (chunk, encoding, cb) {
  1443. // process the chunk using the sync process
  1444. // then super.write() all the outputted chunks
  1445. if (typeof encoding === 'function')
  1446. cb = encoding, encoding = 'utf8'
  1447. if (typeof chunk === 'string')
  1448. chunk = Buffer.from(chunk, encoding)
  1449. if (this[_sawError])
  1450. return
  1451. assert(this[_handle], 'zlib binding closed')
  1452. // _processChunk tries to .close() the native handle after it's done, so we
  1453. // intercept that by temporarily making it a no-op.
  1454. const nativeHandle = this[_handle]._handle
  1455. const originalNativeClose = nativeHandle.close
  1456. nativeHandle.close = () => {}
  1457. const originalClose = this[_handle].close
  1458. this[_handle].close = () => {}
  1459. // It also calls `Buffer.concat()` at the end, which may be convenient
  1460. // for some, but which we are not interested in as it slows us down.
  1461. Buffer.concat = (args) => args
  1462. let result
  1463. try {
  1464. const flushFlag = typeof chunk[_flushFlag] === 'number'
  1465. ? chunk[_flushFlag] : this[_flushFlag]
  1466. result = this[_handle]._processChunk(chunk, flushFlag)
  1467. // if we don't throw, reset it back how it was
  1468. Buffer.concat = OriginalBufferConcat
  1469. } catch (err) {
  1470. // or if we do, put Buffer.concat() back before we emit error
  1471. // Error events call into user code, which may call Buffer.concat()
  1472. Buffer.concat = OriginalBufferConcat
  1473. this[_onError](new ZlibError(err))
  1474. } finally {
  1475. if (this[_handle]) {
  1476. // Core zlib resets `_handle` to null after attempting to close the
  1477. // native handle. Our no-op handler prevented actual closure, but we
  1478. // need to restore the `._handle` property.
  1479. this[_handle]._handle = nativeHandle
  1480. nativeHandle.close = originalNativeClose
  1481. this[_handle].close = originalClose
  1482. // `_processChunk()` adds an 'error' listener. If we don't remove it
  1483. // after each call, these handlers start piling up.
  1484. this[_handle].removeAllListeners('error')
  1485. // make sure OUR error listener is still attached tho
  1486. }
  1487. }
  1488. if (this[_handle])
  1489. this[_handle].on('error', er => this[_onError](new ZlibError(er)))
  1490. let writeReturn
  1491. if (result) {
  1492. if (Array.isArray(result) && result.length > 0) {
  1493. // The first buffer is always `handle._outBuffer`, which would be
  1494. // re-used for later invocations; so, we always have to copy that one.
  1495. writeReturn = this[_superWrite](Buffer.from(result[0]))
  1496. for (let i = 1; i < result.length; i++) {
  1497. writeReturn = this[_superWrite](result[i])
  1498. }
  1499. } else {
  1500. writeReturn = this[_superWrite](Buffer.from(result))
  1501. }
  1502. }
  1503. if (cb)
  1504. cb()
  1505. return writeReturn
  1506. }
  1507. [_superWrite] (data) {
  1508. return super.write(data)
  1509. }
  1510. }
  1511. class Zlib extends ZlibBase {
  1512. constructor (opts, mode) {
  1513. opts = opts || {}
  1514. opts.flush = opts.flush || constants.Z_NO_FLUSH
  1515. opts.finishFlush = opts.finishFlush || constants.Z_FINISH
  1516. super(opts, mode)
  1517. this[_fullFlushFlag] = constants.Z_FULL_FLUSH
  1518. this[_level] = opts.level
  1519. this[_strategy] = opts.strategy
  1520. }
  1521. params (level, strategy) {
  1522. if (this[_sawError])
  1523. return
  1524. if (!this[_handle])
  1525. throw new Error('cannot switch params when binding is closed')
  1526. // no way to test this without also not supporting params at all
  1527. /* istanbul ignore if */
  1528. if (!this[_handle].params)
  1529. throw new Error('not supported in this implementation')
  1530. if (this[_level] !== level || this[_strategy] !== strategy) {
  1531. this.flush(constants.Z_SYNC_FLUSH)
  1532. assert(this[_handle], 'zlib binding closed')
  1533. // .params() calls .flush(), but the latter is always async in the
  1534. // core zlib. We override .flush() temporarily to intercept that and
  1535. // flush synchronously.
  1536. const origFlush = this[_handle].flush
  1537. this[_handle].flush = (flushFlag, cb) => {
  1538. this.flush(flushFlag)
  1539. cb()
  1540. }
  1541. try {
  1542. this[_handle].params(level, strategy)
  1543. } finally {
  1544. this[_handle].flush = origFlush
  1545. }
  1546. /* istanbul ignore else */
  1547. if (this[_handle]) {
  1548. this[_level] = level
  1549. this[_strategy] = strategy
  1550. }
  1551. }
  1552. }
  1553. }
  1554. // minimal 2-byte header
  1555. class Deflate extends Zlib {
  1556. constructor (opts) {
  1557. super(opts, 'Deflate')
  1558. }
  1559. }
  1560. class Inflate extends Zlib {
  1561. constructor (opts) {
  1562. super(opts, 'Inflate')
  1563. }
  1564. }
  1565. // gzip - bigger header, same deflate compression
  1566. const _portable = Symbol('_portable')
  1567. class Gzip extends Zlib {
  1568. constructor (opts) {
  1569. super(opts, 'Gzip')
  1570. this[_portable] = opts && !!opts.portable
  1571. }
  1572. [_superWrite] (data) {
  1573. if (!this[_portable])
  1574. return super[_superWrite](data)
  1575. // we'll always get the header emitted in one first chunk
  1576. // overwrite the OS indicator byte with 0xFF
  1577. this[_portable] = false
  1578. data[9] = 255
  1579. return super[_superWrite](data)
  1580. }
  1581. }
  1582. class Gunzip extends Zlib {
  1583. constructor (opts) {
  1584. super(opts, 'Gunzip')
  1585. }
  1586. }
  1587. // raw - no header
  1588. class DeflateRaw extends Zlib {
  1589. constructor (opts) {
  1590. super(opts, 'DeflateRaw')
  1591. }
  1592. }
  1593. class InflateRaw extends Zlib {
  1594. constructor (opts) {
  1595. super(opts, 'InflateRaw')
  1596. }
  1597. }
  1598. // auto-detect header.
  1599. class Unzip extends Zlib {
  1600. constructor (opts) {
  1601. super(opts, 'Unzip')
  1602. }
  1603. }
  1604. class Brotli extends ZlibBase {
  1605. constructor (opts, mode) {
  1606. opts = opts || {}
  1607. opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS
  1608. opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH
  1609. super(opts, mode)
  1610. this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH
  1611. }
  1612. }
  1613. class BrotliCompress extends Brotli {
  1614. constructor (opts) {
  1615. super(opts, 'BrotliCompress')
  1616. }
  1617. }
  1618. class BrotliDecompress extends Brotli {
  1619. constructor (opts) {
  1620. super(opts, 'BrotliDecompress')
  1621. }
  1622. }
  1623. exports.Deflate = Deflate
  1624. exports.Inflate = Inflate
  1625. exports.Gzip = Gzip
  1626. exports.Gunzip = Gunzip
  1627. exports.DeflateRaw = DeflateRaw
  1628. exports.InflateRaw = InflateRaw
  1629. exports.Unzip = Unzip
  1630. /* istanbul ignore else */
  1631. if (typeof realZlib.BrotliCompress === 'function') {
  1632. exports.BrotliCompress = BrotliCompress
  1633. exports.BrotliDecompress = BrotliDecompress
  1634. } else {
  1635. exports.BrotliCompress = exports.BrotliDecompress = class {
  1636. constructor () {
  1637. throw new Error('Brotli is not supported in this version of Node.js')
  1638. }
  1639. }
  1640. }
  1641. /***/ }),
  1642. /***/ 30454:
  1643. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1644. "use strict";
  1645. const EE = __webpack_require__(28614)
  1646. const Stream = __webpack_require__(92413)
  1647. const Yallist = __webpack_require__(16666)
  1648. const SD = __webpack_require__(24304).StringDecoder
  1649. const EOF = Symbol('EOF')
  1650. const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
  1651. const EMITTED_END = Symbol('emittedEnd')
  1652. const EMITTING_END = Symbol('emittingEnd')
  1653. const CLOSED = Symbol('closed')
  1654. const READ = Symbol('read')
  1655. const FLUSH = Symbol('flush')
  1656. const FLUSHCHUNK = Symbol('flushChunk')
  1657. const ENCODING = Symbol('encoding')
  1658. const DECODER = Symbol('decoder')
  1659. const FLOWING = Symbol('flowing')
  1660. const PAUSED = Symbol('paused')
  1661. const RESUME = Symbol('resume')
  1662. const BUFFERLENGTH = Symbol('bufferLength')
  1663. const BUFFERPUSH = Symbol('bufferPush')
  1664. const BUFFERSHIFT = Symbol('bufferShift')
  1665. const OBJECTMODE = Symbol('objectMode')
  1666. const DESTROYED = Symbol('destroyed')
  1667. // TODO remove when Node v8 support drops
  1668. const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
  1669. const ASYNCITERATOR = doIter && Symbol.asyncIterator
  1670. || Symbol('asyncIterator not implemented')
  1671. const ITERATOR = doIter && Symbol.iterator
  1672. || Symbol('iterator not implemented')
  1673. // events that mean 'the stream is over'
  1674. // these are treated specially, and re-emitted
  1675. // if they are listened for after emitting.
  1676. const isEndish = ev =>
  1677. ev === 'end' ||
  1678. ev === 'finish' ||
  1679. ev === 'prefinish'
  1680. const isArrayBuffer = b => b instanceof ArrayBuffer ||
  1681. typeof b === 'object' &&
  1682. b.constructor &&
  1683. b.constructor.name === 'ArrayBuffer' &&
  1684. b.byteLength >= 0
  1685. const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
  1686. module.exports = class Minipass extends Stream {
  1687. constructor (options) {
  1688. super()
  1689. this[FLOWING] = false
  1690. // whether we're explicitly paused
  1691. this[PAUSED] = false
  1692. this.pipes = new Yallist()
  1693. this.buffer = new Yallist()
  1694. this[OBJECTMODE] = options && options.objectMode || false
  1695. if (this[OBJECTMODE])
  1696. this[ENCODING] = null
  1697. else
  1698. this[ENCODING] = options && options.encoding || null
  1699. if (this[ENCODING] === 'buffer')
  1700. this[ENCODING] = null
  1701. this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
  1702. this[EOF] = false
  1703. this[EMITTED_END] = false
  1704. this[EMITTING_END] = false
  1705. this[CLOSED] = false
  1706. this.writable = true
  1707. this.readable = true
  1708. this[BUFFERLENGTH] = 0
  1709. this[DESTROYED] = false
  1710. }
  1711. get bufferLength () { return this[BUFFERLENGTH] }
  1712. get encoding () { return this[ENCODING] }
  1713. set encoding (enc) {
  1714. if (this[OBJECTMODE])
  1715. throw new Error('cannot set encoding in objectMode')
  1716. if (this[ENCODING] && enc !== this[ENCODING] &&
  1717. (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH]))
  1718. throw new Error('cannot change encoding')
  1719. if (this[ENCODING] !== enc) {
  1720. this[DECODER] = enc ? new SD(enc) : null
  1721. if (this.buffer.length)
  1722. this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk))
  1723. }
  1724. this[ENCODING] = enc
  1725. }
  1726. setEncoding (enc) {
  1727. this.encoding = enc
  1728. }
  1729. get objectMode () { return this[OBJECTMODE] }
  1730. set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om }
  1731. write (chunk, encoding, cb) {
  1732. if (this[EOF])
  1733. throw new Error('write after end')
  1734. if (this[DESTROYED]) {
  1735. this.emit('error', Object.assign(
  1736. new Error('Cannot call write after a stream was destroyed'),
  1737. { code: 'ERR_STREAM_DESTROYED' }
  1738. ))
  1739. return true
  1740. }
  1741. if (typeof encoding === 'function')
  1742. cb = encoding, encoding = 'utf8'
  1743. if (!encoding)
  1744. encoding = 'utf8'
  1745. // convert array buffers and typed array views into buffers
  1746. // at some point in the future, we may want to do the opposite!
  1747. // leave strings and buffers as-is
  1748. // anything else switches us into object mode
  1749. if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
  1750. if (isArrayBufferView(chunk))
  1751. chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
  1752. else if (isArrayBuffer(chunk))
  1753. chunk = Buffer.from(chunk)
  1754. else if (typeof chunk !== 'string')
  1755. // use the setter so we throw if we have encoding set
  1756. this.objectMode = true
  1757. }
  1758. // this ensures at this point that the chunk is a buffer or string
  1759. // don't buffer it up or send it to the decoder
  1760. if (!this.objectMode && !chunk.length) {
  1761. if (this[BUFFERLENGTH] !== 0)
  1762. this.emit('readable')
  1763. if (cb)
  1764. cb()
  1765. return this.flowing
  1766. }
  1767. // fast-path writing strings of same encoding to a stream with
  1768. // an empty buffer, skipping the buffer/decoder dance
  1769. if (typeof chunk === 'string' && !this[OBJECTMODE] &&
  1770. // unless it is a string already ready for us to use
  1771. !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) {
  1772. chunk = Buffer.from(chunk, encoding)
  1773. }
  1774. if (Buffer.isBuffer(chunk) && this[ENCODING])
  1775. chunk = this[DECODER].write(chunk)
  1776. if (this.flowing) {
  1777. // if we somehow have something in the buffer, but we think we're
  1778. // flowing, then we need to flush all that out first, or we get
  1779. // chunks coming in out of order. Can't emit 'drain' here though,
  1780. // because we're mid-write, so that'd be bad.
  1781. if (this[BUFFERLENGTH] !== 0)
  1782. this[FLUSH](true)
  1783. this.emit('data', chunk)
  1784. } else
  1785. this[BUFFERPUSH](chunk)
  1786. if (this[BUFFERLENGTH] !== 0)
  1787. this.emit('readable')
  1788. if (cb)
  1789. cb()
  1790. return this.flowing
  1791. }
  1792. read (n) {
  1793. if (this[DESTROYED])
  1794. return null
  1795. try {
  1796. if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH])
  1797. return null
  1798. if (this[OBJECTMODE])
  1799. n = null
  1800. if (this.buffer.length > 1 && !this[OBJECTMODE]) {
  1801. if (this.encoding)
  1802. this.buffer = new Yallist([
  1803. Array.from(this.buffer).join('')
  1804. ])
  1805. else
  1806. this.buffer = new Yallist([
  1807. Buffer.concat(Array.from(this.buffer), this[BUFFERLENGTH])
  1808. ])
  1809. }
  1810. return this[READ](n || null, this.buffer.head.value)
  1811. } finally {
  1812. this[MAYBE_EMIT_END]()
  1813. }
  1814. }
  1815. [READ] (n, chunk) {
  1816. if (n === chunk.length || n === null)
  1817. this[BUFFERSHIFT]()
  1818. else {
  1819. this.buffer.head.value = chunk.slice(n)
  1820. chunk = chunk.slice(0, n)
  1821. this[BUFFERLENGTH] -= n
  1822. }
  1823. this.emit('data', chunk)
  1824. if (!this.buffer.length && !this[EOF])
  1825. this.emit('drain')
  1826. return chunk
  1827. }
  1828. end (chunk, encoding, cb) {
  1829. if (typeof chunk === 'function')
  1830. cb = chunk, chunk = null
  1831. if (typeof encoding === 'function')
  1832. cb = encoding, encoding = 'utf8'
  1833. if (chunk)
  1834. this.write(chunk, encoding)
  1835. if (cb)
  1836. this.once('end', cb)
  1837. this[EOF] = true
  1838. this.writable = false
  1839. // if we haven't written anything, then go ahead and emit,
  1840. // even if we're not reading.
  1841. // we'll re-emit if a new 'end' listener is added anyway.
  1842. // This makes MP more suitable to write-only use cases.
  1843. if (this.flowing || !this[PAUSED])
  1844. this[MAYBE_EMIT_END]()
  1845. return this
  1846. }
  1847. // don't let the internal resume be overwritten
  1848. [RESUME] () {
  1849. if (this[DESTROYED])
  1850. return
  1851. this[PAUSED] = false
  1852. this[FLOWING] = true
  1853. this.emit('resume')
  1854. if (this.buffer.length)
  1855. this[FLUSH]()
  1856. else if (this[EOF])
  1857. this[MAYBE_EMIT_END]()
  1858. else
  1859. this.emit('drain')
  1860. }
  1861. resume () {
  1862. return this[RESUME]()
  1863. }
  1864. pause () {
  1865. this[FLOWING] = false
  1866. this[PAUSED] = true
  1867. }
  1868. get destroyed () {
  1869. return this[DESTROYED]
  1870. }
  1871. get flowing () {
  1872. return this[FLOWING]
  1873. }
  1874. get paused () {
  1875. return this[PAUSED]
  1876. }
  1877. [BUFFERPUSH] (chunk) {
  1878. if (this[OBJECTMODE])
  1879. this[BUFFERLENGTH] += 1
  1880. else
  1881. this[BUFFERLENGTH] += chunk.length
  1882. return this.buffer.push(chunk)
  1883. }
  1884. [BUFFERSHIFT] () {
  1885. if (this.buffer.length) {
  1886. if (this[OBJECTMODE])
  1887. this[BUFFERLENGTH] -= 1
  1888. else
  1889. this[BUFFERLENGTH] -= this.buffer.head.value.length
  1890. }
  1891. return this.buffer.shift()
  1892. }
  1893. [FLUSH] (noDrain) {
  1894. do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()))
  1895. if (!noDrain && !this.buffer.length && !this[EOF])
  1896. this.emit('drain')
  1897. }
  1898. [FLUSHCHUNK] (chunk) {
  1899. return chunk ? (this.emit('data', chunk), this.flowing) : false
  1900. }
  1901. pipe (dest, opts) {
  1902. if (this[DESTROYED])
  1903. return
  1904. const ended = this[EMITTED_END]
  1905. opts = opts || {}
  1906. if (dest === process.stdout || dest === process.stderr)
  1907. opts.end = false
  1908. else
  1909. opts.end = opts.end !== false
  1910. const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() }
  1911. this.pipes.push(p)
  1912. dest.on('drain', p.ondrain)
  1913. this[RESUME]()
  1914. // piping an ended stream ends immediately
  1915. if (ended && p.opts.end)
  1916. p.dest.end()
  1917. return dest
  1918. }
  1919. addListener (ev, fn) {
  1920. return this.on(ev, fn)
  1921. }
  1922. on (ev, fn) {
  1923. try {
  1924. return super.on(ev, fn)
  1925. } finally {
  1926. if (ev === 'data' && !this.pipes.length && !this.flowing)
  1927. this[RESUME]()
  1928. else if (isEndish(ev) && this[EMITTED_END]) {
  1929. super.emit(ev)
  1930. this.removeAllListeners(ev)
  1931. }
  1932. }
  1933. }
  1934. get emittedEnd () {
  1935. return this[EMITTED_END]
  1936. }
  1937. [MAYBE_EMIT_END] () {
  1938. if (!this[EMITTING_END] &&
  1939. !this[EMITTED_END] &&
  1940. !this[DESTROYED] &&
  1941. this.buffer.length === 0 &&
  1942. this[EOF]) {
  1943. this[EMITTING_END] = true
  1944. this.emit('end')
  1945. this.emit('prefinish')
  1946. this.emit('finish')
  1947. if (this[CLOSED])
  1948. this.emit('close')
  1949. this[EMITTING_END] = false
  1950. }
  1951. }
  1952. emit (ev, data) {
  1953. // error and close are only events allowed after calling destroy()
  1954. if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
  1955. return
  1956. else if (ev === 'data') {
  1957. if (!data)
  1958. return
  1959. if (this.pipes.length)
  1960. this.pipes.forEach(p =>
  1961. p.dest.write(data) === false && this.pause())
  1962. } else if (ev === 'end') {
  1963. // only actual end gets this treatment
  1964. if (this[EMITTED_END] === true)
  1965. return
  1966. this[EMITTED_END] = true
  1967. this.readable = false
  1968. if (this[DECODER]) {
  1969. data = this[DECODER].end()
  1970. if (data) {
  1971. this.pipes.forEach(p => p.dest.write(data))
  1972. super.emit('data', data)
  1973. }
  1974. }
  1975. this.pipes.forEach(p => {
  1976. p.dest.removeListener('drain', p.ondrain)
  1977. if (p.opts.end)
  1978. p.dest.end()
  1979. })
  1980. } else if (ev === 'close') {
  1981. this[CLOSED] = true
  1982. // don't emit close before 'end' and 'finish'
  1983. if (!this[EMITTED_END] && !this[DESTROYED])
  1984. return
  1985. }
  1986. // TODO: replace with a spread operator when Node v4 support drops
  1987. const args = new Array(arguments.length)
  1988. args[0] = ev
  1989. args[1] = data
  1990. if (arguments.length > 2) {
  1991. for (let i = 2; i < arguments.length; i++) {
  1992. args[i] = arguments[i]
  1993. }
  1994. }
  1995. try {
  1996. return super.emit.apply(this, args)
  1997. } finally {
  1998. if (!isEndish(ev))
  1999. this[MAYBE_EMIT_END]()
  2000. else
  2001. this.removeAllListeners(ev)
  2002. }
  2003. }
  2004. // const all = await stream.collect()
  2005. collect () {
  2006. const buf = []
  2007. if (!this[OBJECTMODE])
  2008. buf.dataLength = 0
  2009. // set the promise first, in case an error is raised
  2010. // by triggering the flow here.
  2011. const p = this.promise()
  2012. this.on('data', c => {
  2013. buf.push(c)
  2014. if (!this[OBJECTMODE])
  2015. buf.dataLength += c.length
  2016. })
  2017. return p.then(() => buf)
  2018. }
  2019. // const data = await stream.concat()
  2020. concat () {
  2021. return this[OBJECTMODE]
  2022. ? Promise.reject(new Error('cannot concat in objectMode'))
  2023. : this.collect().then(buf =>
  2024. this[OBJECTMODE]
  2025. ? Promise.reject(new Error('cannot concat in objectMode'))
  2026. : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength))
  2027. }
  2028. // stream.promise().then(() => done, er => emitted error)
  2029. promise () {
  2030. return new Promise((resolve, reject) => {
  2031. this.on(DESTROYED, () => reject(new Error('stream destroyed')))
  2032. this.on('end', () => resolve())
  2033. this.on('error', er => reject(er))
  2034. })
  2035. }
  2036. // for await (let chunk of stream)
  2037. [ASYNCITERATOR] () {
  2038. const next = () => {
  2039. const res = this.read()
  2040. if (res !== null)
  2041. return Promise.resolve({ done: false, value: res })
  2042. if (this[EOF])
  2043. return Promise.resolve({ done: true })
  2044. let resolve = null
  2045. let reject = null
  2046. const onerr = er => {
  2047. this.removeListener('data', ondata)
  2048. this.removeListener('end', onend)
  2049. reject(er)
  2050. }
  2051. const ondata = value => {
  2052. this.removeListener('error', onerr)
  2053. this.removeListener('end', onend)
  2054. this.pause()
  2055. resolve({ value: value, done: !!this[EOF] })
  2056. }
  2057. const onend = () => {
  2058. this.removeListener('error', onerr)
  2059. this.removeListener('data', ondata)
  2060. resolve({ done: true })
  2061. }
  2062. const ondestroy = () => onerr(new Error('stream destroyed'))
  2063. return new Promise((res, rej) => {
  2064. reject = rej
  2065. resolve = res
  2066. this.once(DESTROYED, ondestroy)
  2067. this.once('error', onerr)
  2068. this.once('end', onend)
  2069. this.once('data', ondata)
  2070. })
  2071. }
  2072. return { next }
  2073. }
  2074. // for (let chunk of stream)
  2075. [ITERATOR] () {
  2076. const next = () => {
  2077. const value = this.read()
  2078. const done = value === null
  2079. return { value, done }
  2080. }
  2081. return { next }
  2082. }
  2083. destroy (er) {
  2084. if (this[DESTROYED]) {
  2085. if (er)
  2086. this.emit('error', er)
  2087. else
  2088. this.emit(DESTROYED)
  2089. return this
  2090. }
  2091. this[DESTROYED] = true
  2092. // throw away all buffered data, it's never coming out
  2093. this.buffer = new Yallist()
  2094. this[BUFFERLENGTH] = 0
  2095. if (typeof this.close === 'function' && !this[CLOSED])
  2096. this.close()
  2097. if (er)
  2098. this.emit('error', er)
  2099. else // if no error to emit, still reject pending promises
  2100. this.emit(DESTROYED)
  2101. return this
  2102. }
  2103. static isStream (s) {
  2104. return !!s && (s instanceof Minipass || s instanceof Stream ||
  2105. s instanceof EE && (
  2106. typeof s.pipe === 'function' || // readable
  2107. (typeof s.write === 'function' && typeof s.end === 'function') // writable
  2108. ))
  2109. }
  2110. }
  2111. /***/ }),
  2112. /***/ 87332:
  2113. /***/ ((module) => {
  2114. "use strict";
  2115. module.exports = function (Yallist) {
  2116. Yallist.prototype[Symbol.iterator] = function* () {
  2117. for (let walker = this.head; walker; walker = walker.next) {
  2118. yield walker.value
  2119. }
  2120. }
  2121. }
  2122. /***/ }),
  2123. /***/ 16666:
  2124. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2125. "use strict";
  2126. module.exports = Yallist
  2127. Yallist.Node = Node
  2128. Yallist.create = Yallist
  2129. function Yallist (list) {
  2130. var self = this
  2131. if (!(self instanceof Yallist)) {
  2132. self = new Yallist()
  2133. }
  2134. self.tail = null
  2135. self.head = null
  2136. self.length = 0
  2137. if (list && typeof list.forEach === 'function') {
  2138. list.forEach(function (item) {
  2139. self.push(item)
  2140. })
  2141. } else if (arguments.length > 0) {
  2142. for (var i = 0, l = arguments.length; i < l; i++) {
  2143. self.push(arguments[i])
  2144. }
  2145. }
  2146. return self
  2147. }
  2148. Yallist.prototype.removeNode = function (node) {
  2149. if (node.list !== this) {
  2150. throw new Error('removing node which does not belong to this list')
  2151. }
  2152. var next = node.next
  2153. var prev = node.prev
  2154. if (next) {
  2155. next.prev = prev
  2156. }
  2157. if (prev) {
  2158. prev.next = next
  2159. }
  2160. if (node === this.head) {
  2161. this.head = next
  2162. }
  2163. if (node === this.tail) {
  2164. this.tail = prev
  2165. }
  2166. node.list.length--
  2167. node.next = null
  2168. node.prev = null
  2169. node.list = null
  2170. return next
  2171. }
  2172. Yallist.prototype.unshiftNode = function (node) {
  2173. if (node === this.head) {
  2174. return
  2175. }
  2176. if (node.list) {
  2177. node.list.removeNode(node)
  2178. }
  2179. var head = this.head
  2180. node.list = this
  2181. node.next = head
  2182. if (head) {
  2183. head.prev = node
  2184. }
  2185. this.head = node
  2186. if (!this.tail) {
  2187. this.tail = node
  2188. }
  2189. this.length++
  2190. }
  2191. Yallist.prototype.pushNode = function (node) {
  2192. if (node === this.tail) {
  2193. return
  2194. }
  2195. if (node.list) {
  2196. node.list.removeNode(node)
  2197. }
  2198. var tail = this.tail
  2199. node.list = this
  2200. node.prev = tail
  2201. if (tail) {
  2202. tail.next = node
  2203. }
  2204. this.tail = node
  2205. if (!this.head) {
  2206. this.head = node
  2207. }
  2208. this.length++
  2209. }
  2210. Yallist.prototype.push = function () {
  2211. for (var i = 0, l = arguments.length; i < l; i++) {
  2212. push(this, arguments[i])
  2213. }
  2214. return this.length
  2215. }
  2216. Yallist.prototype.unshift = function () {
  2217. for (var i = 0, l = arguments.length; i < l; i++) {
  2218. unshift(this, arguments[i])
  2219. }
  2220. return this.length
  2221. }
  2222. Yallist.prototype.pop = function () {
  2223. if (!this.tail) {
  2224. return undefined
  2225. }
  2226. var res = this.tail.value
  2227. this.tail = this.tail.prev
  2228. if (this.tail) {
  2229. this.tail.next = null
  2230. } else {
  2231. this.head = null
  2232. }
  2233. this.length--
  2234. return res
  2235. }
  2236. Yallist.prototype.shift = function () {
  2237. if (!this.head) {
  2238. return undefined
  2239. }
  2240. var res = this.head.value
  2241. this.head = this.head.next
  2242. if (this.head) {
  2243. this.head.prev = null
  2244. } else {
  2245. this.tail = null
  2246. }
  2247. this.length--
  2248. return res
  2249. }
  2250. Yallist.prototype.forEach = function (fn, thisp) {
  2251. thisp = thisp || this
  2252. for (var walker = this.head, i = 0; walker !== null; i++) {
  2253. fn.call(thisp, walker.value, i, this)
  2254. walker = walker.next
  2255. }
  2256. }
  2257. Yallist.prototype.forEachReverse = function (fn, thisp) {
  2258. thisp = thisp || this
  2259. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  2260. fn.call(thisp, walker.value, i, this)
  2261. walker = walker.prev
  2262. }
  2263. }
  2264. Yallist.prototype.get = function (n) {
  2265. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  2266. // abort out of the list early if we hit a cycle
  2267. walker = walker.next
  2268. }
  2269. if (i === n && walker !== null) {
  2270. return walker.value
  2271. }
  2272. }
  2273. Yallist.prototype.getReverse = function (n) {
  2274. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  2275. // abort out of the list early if we hit a cycle
  2276. walker = walker.prev
  2277. }
  2278. if (i === n && walker !== null) {
  2279. return walker.value
  2280. }
  2281. }
  2282. Yallist.prototype.map = function (fn, thisp) {
  2283. thisp = thisp || this
  2284. var res = new Yallist()
  2285. for (var walker = this.head; walker !== null;) {
  2286. res.push(fn.call(thisp, walker.value, this))
  2287. walker = walker.next
  2288. }
  2289. return res
  2290. }
  2291. Yallist.prototype.mapReverse = function (fn, thisp) {
  2292. thisp = thisp || this
  2293. var res = new Yallist()
  2294. for (var walker = this.tail; walker !== null;) {
  2295. res.push(fn.call(thisp, walker.value, this))
  2296. walker = walker.prev
  2297. }
  2298. return res
  2299. }
  2300. Yallist.prototype.reduce = function (fn, initial) {
  2301. var acc
  2302. var walker = this.head
  2303. if (arguments.length > 1) {
  2304. acc = initial
  2305. } else if (this.head) {
  2306. walker = this.head.next
  2307. acc = this.head.value
  2308. } else {
  2309. throw new TypeError('Reduce of empty list with no initial value')
  2310. }
  2311. for (var i = 0; walker !== null; i++) {
  2312. acc = fn(acc, walker.value, i)
  2313. walker = walker.next
  2314. }
  2315. return acc
  2316. }
  2317. Yallist.prototype.reduceReverse = function (fn, initial) {
  2318. var acc
  2319. var walker = this.tail
  2320. if (arguments.length > 1) {
  2321. acc = initial
  2322. } else if (this.tail) {
  2323. walker = this.tail.prev
  2324. acc = this.tail.value
  2325. } else {
  2326. throw new TypeError('Reduce of empty list with no initial value')
  2327. }
  2328. for (var i = this.length - 1; walker !== null; i--) {
  2329. acc = fn(acc, walker.value, i)
  2330. walker = walker.prev
  2331. }
  2332. return acc
  2333. }
  2334. Yallist.prototype.toArray = function () {
  2335. var arr = new Array(this.length)
  2336. for (var i = 0, walker = this.head; walker !== null; i++) {
  2337. arr[i] = walker.value
  2338. walker = walker.next
  2339. }
  2340. return arr
  2341. }
  2342. Yallist.prototype.toArrayReverse = function () {
  2343. var arr = new Array(this.length)
  2344. for (var i = 0, walker = this.tail; walker !== null; i++) {
  2345. arr[i] = walker.value
  2346. walker = walker.prev
  2347. }
  2348. return arr
  2349. }
  2350. Yallist.prototype.slice = function (from, to) {
  2351. to = to || this.length
  2352. if (to < 0) {
  2353. to += this.length
  2354. }
  2355. from = from || 0
  2356. if (from < 0) {
  2357. from += this.length
  2358. }
  2359. var ret = new Yallist()
  2360. if (to < from || to < 0) {
  2361. return ret
  2362. }
  2363. if (from < 0) {
  2364. from = 0
  2365. }
  2366. if (to > this.length) {
  2367. to = this.length
  2368. }
  2369. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  2370. walker = walker.next
  2371. }
  2372. for (; walker !== null && i < to; i++, walker = walker.next) {
  2373. ret.push(walker.value)
  2374. }
  2375. return ret
  2376. }
  2377. Yallist.prototype.sliceReverse = function (from, to) {
  2378. to = to || this.length
  2379. if (to < 0) {
  2380. to += this.length
  2381. }
  2382. from = from || 0
  2383. if (from < 0) {
  2384. from += this.length
  2385. }
  2386. var ret = new Yallist()
  2387. if (to < from || to < 0) {
  2388. return ret
  2389. }
  2390. if (from < 0) {
  2391. from = 0
  2392. }
  2393. if (to > this.length) {
  2394. to = this.length
  2395. }
  2396. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  2397. walker = walker.prev
  2398. }
  2399. for (; walker !== null && i > from; i--, walker = walker.prev) {
  2400. ret.push(walker.value)
  2401. }
  2402. return ret
  2403. }
  2404. Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
  2405. if (start > this.length) {
  2406. start = this.length - 1
  2407. }
  2408. if (start < 0) {
  2409. start = this.length + start;
  2410. }
  2411. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  2412. walker = walker.next
  2413. }
  2414. var ret = []
  2415. for (var i = 0; walker && i < deleteCount; i++) {
  2416. ret.push(walker.value)
  2417. walker = this.removeNode(walker)
  2418. }
  2419. if (walker === null) {
  2420. walker = this.tail
  2421. }
  2422. if (walker !== this.head && walker !== this.tail) {
  2423. walker = walker.prev
  2424. }
  2425. for (var i = 0; i < nodes.length; i++) {
  2426. walker = insert(this, walker, nodes[i])
  2427. }
  2428. return ret;
  2429. }
  2430. Yallist.prototype.reverse = function () {
  2431. var head = this.head
  2432. var tail = this.tail
  2433. for (var walker = head; walker !== null; walker = walker.prev) {
  2434. var p = walker.prev
  2435. walker.prev = walker.next
  2436. walker.next = p
  2437. }
  2438. this.head = tail
  2439. this.tail = head
  2440. return this
  2441. }
  2442. function insert (self, node, value) {
  2443. var inserted = node === self.head ?
  2444. new Node(value, null, node, self) :
  2445. new Node(value, node, node.next, self)
  2446. if (inserted.next === null) {
  2447. self.tail = inserted
  2448. }
  2449. if (inserted.prev === null) {
  2450. self.head = inserted
  2451. }
  2452. self.length++
  2453. return inserted
  2454. }
  2455. function push (self, item) {
  2456. self.tail = new Node(item, self.tail, null, self)
  2457. if (!self.head) {
  2458. self.head = self.tail
  2459. }
  2460. self.length++
  2461. }
  2462. function unshift (self, item) {
  2463. self.head = new Node(item, null, self.head, self)
  2464. if (!self.tail) {
  2465. self.tail = self.head
  2466. }
  2467. self.length++
  2468. }
  2469. function Node (value, prev, next, list) {
  2470. if (!(this instanceof Node)) {
  2471. return new Node(value, prev, next, list)
  2472. }
  2473. this.list = list
  2474. this.value = value
  2475. if (prev) {
  2476. prev.next = this
  2477. this.prev = prev
  2478. } else {
  2479. this.prev = null
  2480. }
  2481. if (next) {
  2482. next.prev = this
  2483. this.next = next
  2484. } else {
  2485. this.next = null
  2486. }
  2487. }
  2488. try {
  2489. // add if support for Symbol.iterator is present
  2490. __webpack_require__(87332)(Yallist)
  2491. } catch (er) {}
  2492. /***/ }),
  2493. /***/ 47724:
  2494. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  2495. "use strict";
  2496. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2497. exports.capitalize = exports.getColorBySeverity = exports.leftPad = void 0;
  2498. const chalk = __webpack_require__(97502);
  2499. function leftPad(text, padding = 4) {
  2500. return padding <= 0 ? text : ' '.repeat(padding) + text;
  2501. }
  2502. exports.leftPad = leftPad;
  2503. function getColorBySeverity(severity) {
  2504. switch (severity) {
  2505. case 'low':
  2506. return chalk.blueBright;
  2507. case 'medium':
  2508. return chalk.yellowBright;
  2509. case 'high':
  2510. return chalk.redBright;
  2511. case 'critical':
  2512. return chalk.magentaBright;
  2513. default:
  2514. return chalk.whiteBright;
  2515. }
  2516. }
  2517. exports.getColorBySeverity = getColorBySeverity;
  2518. function capitalize(str) {
  2519. return str.charAt(0).toUpperCase() + str.slice(1);
  2520. }
  2521. exports.capitalize = capitalize;
  2522. //# sourceMappingURL=common.js.map
  2523. /***/ }),
  2524. /***/ 98466:
  2525. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2526. "use strict";
  2527. /* module decorator */ module = __webpack_require__.nmd(module);
  2528. const wrapAnsi16 = (fn, offset) => (...args) => {
  2529. const code = fn(...args);
  2530. return `\u001B[${code + offset}m`;
  2531. };
  2532. const wrapAnsi256 = (fn, offset) => (...args) => {
  2533. const code = fn(...args);
  2534. return `\u001B[${38 + offset};5;${code}m`;
  2535. };
  2536. const wrapAnsi16m = (fn, offset) => (...args) => {
  2537. const rgb = fn(...args);
  2538. return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  2539. };
  2540. const ansi2ansi = n => n;
  2541. const rgb2rgb = (r, g, b) => [r, g, b];
  2542. const setLazyProperty = (object, property, get) => {
  2543. Object.defineProperty(object, property, {
  2544. get: () => {
  2545. const value = get();
  2546. Object.defineProperty(object, property, {
  2547. value,
  2548. enumerable: true,
  2549. configurable: true
  2550. });
  2551. return value;
  2552. },
  2553. enumerable: true,
  2554. configurable: true
  2555. });
  2556. };
  2557. /** @type {typeof import('color-convert')} */
  2558. let colorConvert;
  2559. const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
  2560. if (colorConvert === undefined) {
  2561. colorConvert = __webpack_require__(37050);
  2562. }
  2563. const offset = isBackground ? 10 : 0;
  2564. const styles = {};
  2565. for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
  2566. const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
  2567. if (sourceSpace === targetSpace) {
  2568. styles[name] = wrap(identity, offset);
  2569. } else if (typeof suite === 'object') {
  2570. styles[name] = wrap(suite[targetSpace], offset);
  2571. }
  2572. }
  2573. return styles;
  2574. };
  2575. function assembleStyles() {
  2576. const codes = new Map();
  2577. const styles = {
  2578. modifier: {
  2579. reset: [0, 0],
  2580. // 21 isn't widely supported and 22 does the same thing
  2581. bold: [1, 22],
  2582. dim: [2, 22],
  2583. italic: [3, 23],
  2584. underline: [4, 24],
  2585. inverse: [7, 27],
  2586. hidden: [8, 28],
  2587. strikethrough: [9, 29]
  2588. },
  2589. color: {
  2590. black: [30, 39],
  2591. red: [31, 39],
  2592. green: [32, 39],
  2593. yellow: [33, 39],
  2594. blue: [34, 39],
  2595. magenta: [35, 39],
  2596. cyan: [36, 39],
  2597. white: [37, 39],
  2598. // Bright color
  2599. blackBright: [90, 39],
  2600. redBright: [91, 39],
  2601. greenBright: [92, 39],
  2602. yellowBright: [93, 39],
  2603. blueBright: [94, 39],
  2604. magentaBright: [95, 39],
  2605. cyanBright: [96, 39],
  2606. whiteBright: [97, 39]
  2607. },
  2608. bgColor: {
  2609. bgBlack: [40, 49],
  2610. bgRed: [41, 49],
  2611. bgGreen: [42, 49],
  2612. bgYellow: [43, 49],
  2613. bgBlue: [44, 49],
  2614. bgMagenta: [45, 49],
  2615. bgCyan: [46, 49],
  2616. bgWhite: [47, 49],
  2617. // Bright color
  2618. bgBlackBright: [100, 49],
  2619. bgRedBright: [101, 49],
  2620. bgGreenBright: [102, 49],
  2621. bgYellowBright: [103, 49],
  2622. bgBlueBright: [104, 49],
  2623. bgMagentaBright: [105, 49],
  2624. bgCyanBright: [106, 49],
  2625. bgWhiteBright: [107, 49]
  2626. }
  2627. };
  2628. // Alias bright black as gray (and grey)
  2629. styles.color.gray = styles.color.blackBright;
  2630. styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
  2631. styles.color.grey = styles.color.blackBright;
  2632. styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
  2633. for (const [groupName, group] of Object.entries(styles)) {
  2634. for (const [styleName, style] of Object.entries(group)) {
  2635. styles[styleName] = {
  2636. open: `\u001B[${style[0]}m`,
  2637. close: `\u001B[${style[1]}m`
  2638. };
  2639. group[styleName] = styles[styleName];
  2640. codes.set(style[0], style[1]);
  2641. }
  2642. Object.defineProperty(styles, groupName, {
  2643. value: group,
  2644. enumerable: false
  2645. });
  2646. }
  2647. Object.defineProperty(styles, 'codes', {
  2648. value: codes,
  2649. enumerable: false
  2650. });
  2651. styles.color.close = '\u001B[39m';
  2652. styles.bgColor.close = '\u001B[49m';
  2653. setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
  2654. setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
  2655. setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
  2656. setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
  2657. setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
  2658. setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
  2659. return styles;
  2660. }
  2661. // Make the export immutable
  2662. Object.defineProperty(module, 'exports', {
  2663. enumerable: true,
  2664. get: assembleStyles
  2665. });
  2666. /***/ }),
  2667. /***/ 97502:
  2668. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2669. "use strict";
  2670. const ansiStyles = __webpack_require__(98466);
  2671. const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(12500);
  2672. const {
  2673. stringReplaceAll,
  2674. stringEncaseCRLFWithFirstIndex
  2675. } = __webpack_require__(4762);
  2676. const {isArray} = Array;
  2677. // `supportsColor.level` → `ansiStyles.color[name]` mapping
  2678. const levelMapping = [
  2679. 'ansi',
  2680. 'ansi',
  2681. 'ansi256',
  2682. 'ansi16m'
  2683. ];
  2684. const styles = Object.create(null);
  2685. const applyOptions = (object, options = {}) => {
  2686. if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
  2687. throw new Error('The `level` option should be an integer from 0 to 3');
  2688. }
  2689. // Detect level if not set manually
  2690. const colorLevel = stdoutColor ? stdoutColor.level : 0;
  2691. object.level = options.level === undefined ? colorLevel : options.level;
  2692. };
  2693. class ChalkClass {
  2694. constructor(options) {
  2695. // eslint-disable-next-line no-constructor-return
  2696. return chalkFactory(options);
  2697. }
  2698. }
  2699. const chalkFactory = options => {
  2700. const chalk = {};
  2701. applyOptions(chalk, options);
  2702. chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
  2703. Object.setPrototypeOf(chalk, Chalk.prototype);
  2704. Object.setPrototypeOf(chalk.template, chalk);
  2705. chalk.template.constructor = () => {
  2706. throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
  2707. };
  2708. chalk.template.Instance = ChalkClass;
  2709. return chalk.template;
  2710. };
  2711. function Chalk(options) {
  2712. return chalkFactory(options);
  2713. }
  2714. for (const [styleName, style] of Object.entries(ansiStyles)) {
  2715. styles[styleName] = {
  2716. get() {
  2717. const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
  2718. Object.defineProperty(this, styleName, {value: builder});
  2719. return builder;
  2720. }
  2721. };
  2722. }
  2723. styles.visible = {
  2724. get() {
  2725. const builder = createBuilder(this, this._styler, true);
  2726. Object.defineProperty(this, 'visible', {value: builder});
  2727. return builder;
  2728. }
  2729. };
  2730. const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
  2731. for (const model of usedModels) {
  2732. styles[model] = {
  2733. get() {
  2734. const {level} = this;
  2735. return function (...arguments_) {
  2736. const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
  2737. return createBuilder(this, styler, this._isEmpty);
  2738. };
  2739. }
  2740. };
  2741. }
  2742. for (const model of usedModels) {
  2743. const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
  2744. styles[bgModel] = {
  2745. get() {
  2746. const {level} = this;
  2747. return function (...arguments_) {
  2748. const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
  2749. return createBuilder(this, styler, this._isEmpty);
  2750. };
  2751. }
  2752. };
  2753. }
  2754. const proto = Object.defineProperties(() => {}, {
  2755. ...styles,
  2756. level: {
  2757. enumerable: true,
  2758. get() {
  2759. return this._generator.level;
  2760. },
  2761. set(level) {
  2762. this._generator.level = level;
  2763. }
  2764. }
  2765. });
  2766. const createStyler = (open, close, parent) => {
  2767. let openAll;
  2768. let closeAll;
  2769. if (parent === undefined) {
  2770. openAll = open;
  2771. closeAll = close;
  2772. } else {
  2773. openAll = parent.openAll + open;
  2774. closeAll = close + parent.closeAll;
  2775. }
  2776. return {
  2777. open,
  2778. close,
  2779. openAll,
  2780. closeAll,
  2781. parent
  2782. };
  2783. };
  2784. const createBuilder = (self, _styler, _isEmpty) => {
  2785. const builder = (...arguments_) => {
  2786. if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
  2787. // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
  2788. return applyStyle(builder, chalkTag(builder, ...arguments_));
  2789. }
  2790. // Single argument is hot path, implicit coercion is faster than anything
  2791. // eslint-disable-next-line no-implicit-coercion
  2792. return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
  2793. };
  2794. // We alter the prototype because we must return a function, but there is
  2795. // no way to create a function with a different prototype
  2796. Object.setPrototypeOf(builder, proto);
  2797. builder._generator = self;
  2798. builder._styler = _styler;
  2799. builder._isEmpty = _isEmpty;
  2800. return builder;
  2801. };
  2802. const applyStyle = (self, string) => {
  2803. if (self.level <= 0 || !string) {
  2804. return self._isEmpty ? '' : string;
  2805. }
  2806. let styler = self._styler;
  2807. if (styler === undefined) {
  2808. return string;
  2809. }
  2810. const {openAll, closeAll} = styler;
  2811. if (string.indexOf('\u001B') !== -1) {
  2812. while (styler !== undefined) {
  2813. // Replace any instances already present with a re-opening code
  2814. // otherwise only the part of the string until said closing code
  2815. // will be colored, and the rest will simply be 'plain'.
  2816. string = stringReplaceAll(string, styler.close, styler.open);
  2817. styler = styler.parent;
  2818. }
  2819. }
  2820. // We can move both next actions out of loop, because remaining actions in loop won't have
  2821. // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
  2822. // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
  2823. const lfIndex = string.indexOf('\n');
  2824. if (lfIndex !== -1) {
  2825. string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
  2826. }
  2827. return openAll + string + closeAll;
  2828. };
  2829. let template;
  2830. const chalkTag = (chalk, ...strings) => {
  2831. const [firstString] = strings;
  2832. if (!isArray(firstString) || !isArray(firstString.raw)) {
  2833. // If chalk() was called by itself or with a string,
  2834. // return the string itself as a string.
  2835. return strings.join(' ');
  2836. }
  2837. const arguments_ = strings.slice(1);
  2838. const parts = [firstString.raw[0]];
  2839. for (let i = 1; i < firstString.length; i++) {
  2840. parts.push(
  2841. String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
  2842. String(firstString.raw[i])
  2843. );
  2844. }
  2845. if (template === undefined) {
  2846. template = __webpack_require__(41455);
  2847. }
  2848. return template(chalk, parts.join(''));
  2849. };
  2850. Object.defineProperties(Chalk.prototype, styles);
  2851. const chalk = Chalk(); // eslint-disable-line new-cap
  2852. chalk.supportsColor = stdoutColor;
  2853. chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
  2854. chalk.stderr.supportsColor = stderrColor;
  2855. module.exports = chalk;
  2856. /***/ }),
  2857. /***/ 41455:
  2858. /***/ ((module) => {
  2859. "use strict";
  2860. const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  2861. const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  2862. const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  2863. const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
  2864. const ESCAPES = new Map([
  2865. ['n', '\n'],
  2866. ['r', '\r'],
  2867. ['t', '\t'],
  2868. ['b', '\b'],
  2869. ['f', '\f'],
  2870. ['v', '\v'],
  2871. ['0', '\0'],
  2872. ['\\', '\\'],
  2873. ['e', '\u001B'],
  2874. ['a', '\u0007']
  2875. ]);
  2876. function unescape(c) {
  2877. const u = c[0] === 'u';
  2878. const bracket = c[1] === '{';
  2879. if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
  2880. return String.fromCharCode(parseInt(c.slice(1), 16));
  2881. }
  2882. if (u && bracket) {
  2883. return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
  2884. }
  2885. return ESCAPES.get(c) || c;
  2886. }
  2887. function parseArguments(name, arguments_) {
  2888. const results = [];
  2889. const chunks = arguments_.trim().split(/\s*,\s*/g);
  2890. let matches;
  2891. for (const chunk of chunks) {
  2892. const number = Number(chunk);
  2893. if (!Number.isNaN(number)) {
  2894. results.push(number);
  2895. } else if ((matches = chunk.match(STRING_REGEX))) {
  2896. results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
  2897. } else {
  2898. throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
  2899. }
  2900. }
  2901. return results;
  2902. }
  2903. function parseStyle(style) {
  2904. STYLE_REGEX.lastIndex = 0;
  2905. const results = [];
  2906. let matches;
  2907. while ((matches = STYLE_REGEX.exec(style)) !== null) {
  2908. const name = matches[1];
  2909. if (matches[2]) {
  2910. const args = parseArguments(name, matches[2]);
  2911. results.push([name].concat(args));
  2912. } else {
  2913. results.push([name]);
  2914. }
  2915. }
  2916. return results;
  2917. }
  2918. function buildStyle(chalk, styles) {
  2919. const enabled = {};
  2920. for (const layer of styles) {
  2921. for (const style of layer.styles) {
  2922. enabled[style[0]] = layer.inverse ? null : style.slice(1);
  2923. }
  2924. }
  2925. let current = chalk;
  2926. for (const [styleName, styles] of Object.entries(enabled)) {
  2927. if (!Array.isArray(styles)) {
  2928. continue;
  2929. }
  2930. if (!(styleName in current)) {
  2931. throw new Error(`Unknown Chalk style: ${styleName}`);
  2932. }
  2933. current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
  2934. }
  2935. return current;
  2936. }
  2937. module.exports = (chalk, temporary) => {
  2938. const styles = [];
  2939. const chunks = [];
  2940. let chunk = [];
  2941. // eslint-disable-next-line max-params
  2942. temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
  2943. if (escapeCharacter) {
  2944. chunk.push(unescape(escapeCharacter));
  2945. } else if (style) {
  2946. const string = chunk.join('');
  2947. chunk = [];
  2948. chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
  2949. styles.push({inverse, styles: parseStyle(style)});
  2950. } else if (close) {
  2951. if (styles.length === 0) {
  2952. throw new Error('Found extraneous } in Chalk template literal');
  2953. }
  2954. chunks.push(buildStyle(chalk, styles)(chunk.join('')));
  2955. chunk = [];
  2956. styles.pop();
  2957. } else {
  2958. chunk.push(character);
  2959. }
  2960. });
  2961. chunks.push(chunk.join(''));
  2962. if (styles.length > 0) {
  2963. const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
  2964. throw new Error(errMessage);
  2965. }
  2966. return chunks.join('');
  2967. };
  2968. /***/ }),
  2969. /***/ 4762:
  2970. /***/ ((module) => {
  2971. "use strict";
  2972. const stringReplaceAll = (string, substring, replacer) => {
  2973. let index = string.indexOf(substring);
  2974. if (index === -1) {
  2975. return string;
  2976. }
  2977. const substringLength = substring.length;
  2978. let endIndex = 0;
  2979. let returnValue = '';
  2980. do {
  2981. returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
  2982. endIndex = index + substringLength;
  2983. index = string.indexOf(substring, endIndex);
  2984. } while (index !== -1);
  2985. returnValue += string.substr(endIndex);
  2986. return returnValue;
  2987. };
  2988. const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
  2989. let endIndex = 0;
  2990. let returnValue = '';
  2991. do {
  2992. const gotCR = string[index - 1] === '\r';
  2993. returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
  2994. endIndex = index + 1;
  2995. index = string.indexOf('\n', endIndex);
  2996. } while (index !== -1);
  2997. returnValue += string.substr(endIndex);
  2998. return returnValue;
  2999. };
  3000. module.exports = {
  3001. stringReplaceAll,
  3002. stringEncaseCRLFWithFirstIndex
  3003. };
  3004. /***/ }),
  3005. /***/ 1434:
  3006. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3007. /* MIT license */
  3008. /* eslint-disable no-mixed-operators */
  3009. const cssKeywords = __webpack_require__(55063);
  3010. // NOTE: conversions should only return primitive values (i.e. arrays, or
  3011. // values that give correct `typeof` results).
  3012. // do not use box values types (i.e. Number(), String(), etc.)
  3013. const reverseKeywords = {};
  3014. for (const key of Object.keys(cssKeywords)) {
  3015. reverseKeywords[cssKeywords[key]] = key;
  3016. }
  3017. const convert = {
  3018. rgb: {channels: 3, labels: 'rgb'},
  3019. hsl: {channels: 3, labels: 'hsl'},
  3020. hsv: {channels: 3, labels: 'hsv'},
  3021. hwb: {channels: 3, labels: 'hwb'},
  3022. cmyk: {channels: 4, labels: 'cmyk'},
  3023. xyz: {channels: 3, labels: 'xyz'},
  3024. lab: {channels: 3, labels: 'lab'},
  3025. lch: {channels: 3, labels: 'lch'},
  3026. hex: {channels: 1, labels: ['hex']},
  3027. keyword: {channels: 1, labels: ['keyword']},
  3028. ansi16: {channels: 1, labels: ['ansi16']},
  3029. ansi256: {channels: 1, labels: ['ansi256']},
  3030. hcg: {channels: 3, labels: ['h', 'c', 'g']},
  3031. apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
  3032. gray: {channels: 1, labels: ['gray']}
  3033. };
  3034. module.exports = convert;
  3035. // Hide .channels and .labels properties
  3036. for (const model of Object.keys(convert)) {
  3037. if (!('channels' in convert[model])) {
  3038. throw new Error('missing channels property: ' + model);
  3039. }
  3040. if (!('labels' in convert[model])) {
  3041. throw new Error('missing channel labels property: ' + model);
  3042. }
  3043. if (convert[model].labels.length !== convert[model].channels) {
  3044. throw new Error('channel and label counts mismatch: ' + model);
  3045. }
  3046. const {channels, labels} = convert[model];
  3047. delete convert[model].channels;
  3048. delete convert[model].labels;
  3049. Object.defineProperty(convert[model], 'channels', {value: channels});
  3050. Object.defineProperty(convert[model], 'labels', {value: labels});
  3051. }
  3052. convert.rgb.hsl = function (rgb) {
  3053. const r = rgb[0] / 255;
  3054. const g = rgb[1] / 255;
  3055. const b = rgb[2] / 255;
  3056. const min = Math.min(r, g, b);
  3057. const max = Math.max(r, g, b);
  3058. const delta = max - min;
  3059. let h;
  3060. let s;
  3061. if (max === min) {
  3062. h = 0;
  3063. } else if (r === max) {
  3064. h = (g - b) / delta;
  3065. } else if (g === max) {
  3066. h = 2 + (b - r) / delta;
  3067. } else if (b === max) {
  3068. h = 4 + (r - g) / delta;
  3069. }
  3070. h = Math.min(h * 60, 360);
  3071. if (h < 0) {
  3072. h += 360;
  3073. }
  3074. const l = (min + max) / 2;
  3075. if (max === min) {
  3076. s = 0;
  3077. } else if (l <= 0.5) {
  3078. s = delta / (max + min);
  3079. } else {
  3080. s = delta / (2 - max - min);
  3081. }
  3082. return [h, s * 100, l * 100];
  3083. };
  3084. convert.rgb.hsv = function (rgb) {
  3085. let rdif;
  3086. let gdif;
  3087. let bdif;
  3088. let h;
  3089. let s;
  3090. const r = rgb[0] / 255;
  3091. const g = rgb[1] / 255;
  3092. const b = rgb[2] / 255;
  3093. const v = Math.max(r, g, b);
  3094. const diff = v - Math.min(r, g, b);
  3095. const diffc = function (c) {
  3096. return (v - c) / 6 / diff + 1 / 2;
  3097. };
  3098. if (diff === 0) {
  3099. h = 0;
  3100. s = 0;
  3101. } else {
  3102. s = diff / v;
  3103. rdif = diffc(r);
  3104. gdif = diffc(g);
  3105. bdif = diffc(b);
  3106. if (r === v) {
  3107. h = bdif - gdif;
  3108. } else if (g === v) {
  3109. h = (1 / 3) + rdif - bdif;
  3110. } else if (b === v) {
  3111. h = (2 / 3) + gdif - rdif;
  3112. }
  3113. if (h < 0) {
  3114. h += 1;
  3115. } else if (h > 1) {
  3116. h -= 1;
  3117. }
  3118. }
  3119. return [
  3120. h * 360,
  3121. s * 100,
  3122. v * 100
  3123. ];
  3124. };
  3125. convert.rgb.hwb = function (rgb) {
  3126. const r = rgb[0];
  3127. const g = rgb[1];
  3128. let b = rgb[2];
  3129. const h = convert.rgb.hsl(rgb)[0];
  3130. const w = 1 / 255 * Math.min(r, Math.min(g, b));
  3131. b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
  3132. return [h, w * 100, b * 100];
  3133. };
  3134. convert.rgb.cmyk = function (rgb) {
  3135. const r = rgb[0] / 255;
  3136. const g = rgb[1] / 255;
  3137. const b = rgb[2] / 255;
  3138. const k = Math.min(1 - r, 1 - g, 1 - b);
  3139. const c = (1 - r - k) / (1 - k) || 0;
  3140. const m = (1 - g - k) / (1 - k) || 0;
  3141. const y = (1 - b - k) / (1 - k) || 0;
  3142. return [c * 100, m * 100, y * 100, k * 100];
  3143. };
  3144. function comparativeDistance(x, y) {
  3145. /*
  3146. See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
  3147. */
  3148. return (
  3149. ((x[0] - y[0]) ** 2) +
  3150. ((x[1] - y[1]) ** 2) +
  3151. ((x[2] - y[2]) ** 2)
  3152. );
  3153. }
  3154. convert.rgb.keyword = function (rgb) {
  3155. const reversed = reverseKeywords[rgb];
  3156. if (reversed) {
  3157. return reversed;
  3158. }
  3159. let currentClosestDistance = Infinity;
  3160. let currentClosestKeyword;
  3161. for (const keyword of Object.keys(cssKeywords)) {
  3162. const value = cssKeywords[keyword];
  3163. // Compute comparative distance
  3164. const distance = comparativeDistance(rgb, value);
  3165. // Check if its less, if so set as closest
  3166. if (distance < currentClosestDistance) {
  3167. currentClosestDistance = distance;
  3168. currentClosestKeyword = keyword;
  3169. }
  3170. }
  3171. return currentClosestKeyword;
  3172. };
  3173. convert.keyword.rgb = function (keyword) {
  3174. return cssKeywords[keyword];
  3175. };
  3176. convert.rgb.xyz = function (rgb) {
  3177. let r = rgb[0] / 255;
  3178. let g = rgb[1] / 255;
  3179. let b = rgb[2] / 255;
  3180. // Assume sRGB
  3181. r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
  3182. g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
  3183. b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
  3184. const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
  3185. const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
  3186. const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
  3187. return [x * 100, y * 100, z * 100];
  3188. };
  3189. convert.rgb.lab = function (rgb) {
  3190. const xyz = convert.rgb.xyz(rgb);
  3191. let x = xyz[0];
  3192. let y = xyz[1];
  3193. let z = xyz[2];
  3194. x /= 95.047;
  3195. y /= 100;
  3196. z /= 108.883;
  3197. x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
  3198. y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
  3199. z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
  3200. const l = (116 * y) - 16;
  3201. const a = 500 * (x - y);
  3202. const b = 200 * (y - z);
  3203. return [l, a, b];
  3204. };
  3205. convert.hsl.rgb = function (hsl) {
  3206. const h = hsl[0] / 360;
  3207. const s = hsl[1] / 100;
  3208. const l = hsl[2] / 100;
  3209. let t2;
  3210. let t3;
  3211. let val;
  3212. if (s === 0) {
  3213. val = l * 255;
  3214. return [val, val, val];
  3215. }
  3216. if (l < 0.5) {
  3217. t2 = l * (1 + s);
  3218. } else {
  3219. t2 = l + s - l * s;
  3220. }
  3221. const t1 = 2 * l - t2;
  3222. const rgb = [0, 0, 0];
  3223. for (let i = 0; i < 3; i++) {
  3224. t3 = h + 1 / 3 * -(i - 1);
  3225. if (t3 < 0) {
  3226. t3++;
  3227. }
  3228. if (t3 > 1) {
  3229. t3--;
  3230. }
  3231. if (6 * t3 < 1) {
  3232. val = t1 + (t2 - t1) * 6 * t3;
  3233. } else if (2 * t3 < 1) {
  3234. val = t2;
  3235. } else if (3 * t3 < 2) {
  3236. val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
  3237. } else {
  3238. val = t1;
  3239. }
  3240. rgb[i] = val * 255;
  3241. }
  3242. return rgb;
  3243. };
  3244. convert.hsl.hsv = function (hsl) {
  3245. const h = hsl[0];
  3246. let s = hsl[1] / 100;
  3247. let l = hsl[2] / 100;
  3248. let smin = s;
  3249. const lmin = Math.max(l, 0.01);
  3250. l *= 2;
  3251. s *= (l <= 1) ? l : 2 - l;
  3252. smin *= lmin <= 1 ? lmin : 2 - lmin;
  3253. const v = (l + s) / 2;
  3254. const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
  3255. return [h, sv * 100, v * 100];
  3256. };
  3257. convert.hsv.rgb = function (hsv) {
  3258. const h = hsv[0] / 60;
  3259. const s = hsv[1] / 100;
  3260. let v = hsv[2] / 100;
  3261. const hi = Math.floor(h) % 6;
  3262. const f = h - Math.floor(h);
  3263. const p = 255 * v * (1 - s);
  3264. const q = 255 * v * (1 - (s * f));
  3265. const t = 255 * v * (1 - (s * (1 - f)));
  3266. v *= 255;
  3267. switch (hi) {
  3268. case 0:
  3269. return [v, t, p];
  3270. case 1:
  3271. return [q, v, p];
  3272. case 2:
  3273. return [p, v, t];
  3274. case 3:
  3275. return [p, q, v];
  3276. case 4:
  3277. return [t, p, v];
  3278. case 5:
  3279. return [v, p, q];
  3280. }
  3281. };
  3282. convert.hsv.hsl = function (hsv) {
  3283. const h = hsv[0];
  3284. const s = hsv[1] / 100;
  3285. const v = hsv[2] / 100;
  3286. const vmin = Math.max(v, 0.01);
  3287. let sl;
  3288. let l;
  3289. l = (2 - s) * v;
  3290. const lmin = (2 - s) * vmin;
  3291. sl = s * vmin;
  3292. sl /= (lmin <= 1) ? lmin : 2 - lmin;
  3293. sl = sl || 0;
  3294. l /= 2;
  3295. return [h, sl * 100, l * 100];
  3296. };
  3297. // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
  3298. convert.hwb.rgb = function (hwb) {
  3299. const h = hwb[0] / 360;
  3300. let wh = hwb[1] / 100;
  3301. let bl = hwb[2] / 100;
  3302. const ratio = wh + bl;
  3303. let f;
  3304. // Wh + bl cant be > 1
  3305. if (ratio > 1) {
  3306. wh /= ratio;
  3307. bl /= ratio;
  3308. }
  3309. const i = Math.floor(6 * h);
  3310. const v = 1 - bl;
  3311. f = 6 * h - i;
  3312. if ((i & 0x01) !== 0) {
  3313. f = 1 - f;
  3314. }
  3315. const n = wh + f * (v - wh); // Linear interpolation
  3316. let r;
  3317. let g;
  3318. let b;
  3319. /* eslint-disable max-statements-per-line,no-multi-spaces */
  3320. switch (i) {
  3321. default:
  3322. case 6:
  3323. case 0: r = v; g = n; b = wh; break;
  3324. case 1: r = n; g = v; b = wh; break;
  3325. case 2: r = wh; g = v; b = n; break;
  3326. case 3: r = wh; g = n; b = v; break;
  3327. case 4: r = n; g = wh; b = v; break;
  3328. case 5: r = v; g = wh; b = n; break;
  3329. }
  3330. /* eslint-enable max-statements-per-line,no-multi-spaces */
  3331. return [r * 255, g * 255, b * 255];
  3332. };
  3333. convert.cmyk.rgb = function (cmyk) {
  3334. const c = cmyk[0] / 100;
  3335. const m = cmyk[1] / 100;
  3336. const y = cmyk[2] / 100;
  3337. const k = cmyk[3] / 100;
  3338. const r = 1 - Math.min(1, c * (1 - k) + k);
  3339. const g = 1 - Math.min(1, m * (1 - k) + k);
  3340. const b = 1 - Math.min(1, y * (1 - k) + k);
  3341. return [r * 255, g * 255, b * 255];
  3342. };
  3343. convert.xyz.rgb = function (xyz) {
  3344. const x = xyz[0] / 100;
  3345. const y = xyz[1] / 100;
  3346. const z = xyz[2] / 100;
  3347. let r;
  3348. let g;
  3349. let b;
  3350. r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
  3351. g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
  3352. b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
  3353. // Assume sRGB
  3354. r = r > 0.0031308
  3355. ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
  3356. : r * 12.92;
  3357. g = g > 0.0031308
  3358. ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
  3359. : g * 12.92;
  3360. b = b > 0.0031308
  3361. ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
  3362. : b * 12.92;
  3363. r = Math.min(Math.max(0, r), 1);
  3364. g = Math.min(Math.max(0, g), 1);
  3365. b = Math.min(Math.max(0, b), 1);
  3366. return [r * 255, g * 255, b * 255];
  3367. };
  3368. convert.xyz.lab = function (xyz) {
  3369. let x = xyz[0];
  3370. let y = xyz[1];
  3371. let z = xyz[2];
  3372. x /= 95.047;
  3373. y /= 100;
  3374. z /= 108.883;
  3375. x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
  3376. y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
  3377. z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
  3378. const l = (116 * y) - 16;
  3379. const a = 500 * (x - y);
  3380. const b = 200 * (y - z);
  3381. return [l, a, b];
  3382. };
  3383. convert.lab.xyz = function (lab) {
  3384. const l = lab[0];
  3385. const a = lab[1];
  3386. const b = lab[2];
  3387. let x;
  3388. let y;
  3389. let z;
  3390. y = (l + 16) / 116;
  3391. x = a / 500 + y;
  3392. z = y - b / 200;
  3393. const y2 = y ** 3;
  3394. const x2 = x ** 3;
  3395. const z2 = z ** 3;
  3396. y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
  3397. x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
  3398. z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
  3399. x *= 95.047;
  3400. y *= 100;
  3401. z *= 108.883;
  3402. return [x, y, z];
  3403. };
  3404. convert.lab.lch = function (lab) {
  3405. const l = lab[0];
  3406. const a = lab[1];
  3407. const b = lab[2];
  3408. let h;
  3409. const hr = Math.atan2(b, a);
  3410. h = hr * 360 / 2 / Math.PI;
  3411. if (h < 0) {
  3412. h += 360;
  3413. }
  3414. const c = Math.sqrt(a * a + b * b);
  3415. return [l, c, h];
  3416. };
  3417. convert.lch.lab = function (lch) {
  3418. const l = lch[0];
  3419. const c = lch[1];
  3420. const h = lch[2];
  3421. const hr = h / 360 * 2 * Math.PI;
  3422. const a = c * Math.cos(hr);
  3423. const b = c * Math.sin(hr);
  3424. return [l, a, b];
  3425. };
  3426. convert.rgb.ansi16 = function (args, saturation = null) {
  3427. const [r, g, b] = args;
  3428. let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
  3429. value = Math.round(value / 50);
  3430. if (value === 0) {
  3431. return 30;
  3432. }
  3433. let ansi = 30
  3434. + ((Math.round(b / 255) << 2)
  3435. | (Math.round(g / 255) << 1)
  3436. | Math.round(r / 255));
  3437. if (value === 2) {
  3438. ansi += 60;
  3439. }
  3440. return ansi;
  3441. };
  3442. convert.hsv.ansi16 = function (args) {
  3443. // Optimization here; we already know the value and don't need to get
  3444. // it converted for us.
  3445. return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
  3446. };
  3447. convert.rgb.ansi256 = function (args) {
  3448. const r = args[0];
  3449. const g = args[1];
  3450. const b = args[2];
  3451. // We use the extended greyscale palette here, with the exception of
  3452. // black and white. normal palette only has 4 greyscale shades.
  3453. if (r === g && g === b) {
  3454. if (r < 8) {
  3455. return 16;
  3456. }
  3457. if (r > 248) {
  3458. return 231;
  3459. }
  3460. return Math.round(((r - 8) / 247) * 24) + 232;
  3461. }
  3462. const ansi = 16
  3463. + (36 * Math.round(r / 255 * 5))
  3464. + (6 * Math.round(g / 255 * 5))
  3465. + Math.round(b / 255 * 5);
  3466. return ansi;
  3467. };
  3468. convert.ansi16.rgb = function (args) {
  3469. let color = args % 10;
  3470. // Handle greyscale
  3471. if (color === 0 || color === 7) {
  3472. if (args > 50) {
  3473. color += 3.5;
  3474. }
  3475. color = color / 10.5 * 255;
  3476. return [color, color, color];
  3477. }
  3478. const mult = (~~(args > 50) + 1) * 0.5;
  3479. const r = ((color & 1) * mult) * 255;
  3480. const g = (((color >> 1) & 1) * mult) * 255;
  3481. const b = (((color >> 2) & 1) * mult) * 255;
  3482. return [r, g, b];
  3483. };
  3484. convert.ansi256.rgb = function (args) {
  3485. // Handle greyscale
  3486. if (args >= 232) {
  3487. const c = (args - 232) * 10 + 8;
  3488. return [c, c, c];
  3489. }
  3490. args -= 16;
  3491. let rem;
  3492. const r = Math.floor(args / 36) / 5 * 255;
  3493. const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
  3494. const b = (rem % 6) / 5 * 255;
  3495. return [r, g, b];
  3496. };
  3497. convert.rgb.hex = function (args) {
  3498. const integer = ((Math.round(args[0]) & 0xFF) << 16)
  3499. + ((Math.round(args[1]) & 0xFF) << 8)
  3500. + (Math.round(args[2]) & 0xFF);
  3501. const string = integer.toString(16).toUpperCase();
  3502. return '000000'.substring(string.length) + string;
  3503. };
  3504. convert.hex.rgb = function (args) {
  3505. const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  3506. if (!match) {
  3507. return [0, 0, 0];
  3508. }
  3509. let colorString = match[0];
  3510. if (match[0].length === 3) {
  3511. colorString = colorString.split('').map(char => {
  3512. return char + char;
  3513. }).join('');
  3514. }
  3515. const integer = parseInt(colorString, 16);
  3516. const r = (integer >> 16) & 0xFF;
  3517. const g = (integer >> 8) & 0xFF;
  3518. const b = integer & 0xFF;
  3519. return [r, g, b];
  3520. };
  3521. convert.rgb.hcg = function (rgb) {
  3522. const r = rgb[0] / 255;
  3523. const g = rgb[1] / 255;
  3524. const b = rgb[2] / 255;
  3525. const max = Math.max(Math.max(r, g), b);
  3526. const min = Math.min(Math.min(r, g), b);
  3527. const chroma = (max - min);
  3528. let grayscale;
  3529. let hue;
  3530. if (chroma < 1) {
  3531. grayscale = min / (1 - chroma);
  3532. } else {
  3533. grayscale = 0;
  3534. }
  3535. if (chroma <= 0) {
  3536. hue = 0;
  3537. } else
  3538. if (max === r) {
  3539. hue = ((g - b) / chroma) % 6;
  3540. } else
  3541. if (max === g) {
  3542. hue = 2 + (b - r) / chroma;
  3543. } else {
  3544. hue = 4 + (r - g) / chroma;
  3545. }
  3546. hue /= 6;
  3547. hue %= 1;
  3548. return [hue * 360, chroma * 100, grayscale * 100];
  3549. };
  3550. convert.hsl.hcg = function (hsl) {
  3551. const s = hsl[1] / 100;
  3552. const l = hsl[2] / 100;
  3553. const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
  3554. let f = 0;
  3555. if (c < 1.0) {
  3556. f = (l - 0.5 * c) / (1.0 - c);
  3557. }
  3558. return [hsl[0], c * 100, f * 100];
  3559. };
  3560. convert.hsv.hcg = function (hsv) {
  3561. const s = hsv[1] / 100;
  3562. const v = hsv[2] / 100;
  3563. const c = s * v;
  3564. let f = 0;
  3565. if (c < 1.0) {
  3566. f = (v - c) / (1 - c);
  3567. }
  3568. return [hsv[0], c * 100, f * 100];
  3569. };
  3570. convert.hcg.rgb = function (hcg) {
  3571. const h = hcg[0] / 360;
  3572. const c = hcg[1] / 100;
  3573. const g = hcg[2] / 100;
  3574. if (c === 0.0) {
  3575. return [g * 255, g * 255, g * 255];
  3576. }
  3577. const pure = [0, 0, 0];
  3578. const hi = (h % 1) * 6;
  3579. const v = hi % 1;
  3580. const w = 1 - v;
  3581. let mg = 0;
  3582. /* eslint-disable max-statements-per-line */
  3583. switch (Math.floor(hi)) {
  3584. case 0:
  3585. pure[0] = 1; pure[1] = v; pure[2] = 0; break;
  3586. case 1:
  3587. pure[0] = w; pure[1] = 1; pure[2] = 0; break;
  3588. case 2:
  3589. pure[0] = 0; pure[1] = 1; pure[2] = v; break;
  3590. case 3:
  3591. pure[0] = 0; pure[1] = w; pure[2] = 1; break;
  3592. case 4:
  3593. pure[0] = v; pure[1] = 0; pure[2] = 1; break;
  3594. default:
  3595. pure[0] = 1; pure[1] = 0; pure[2] = w;
  3596. }
  3597. /* eslint-enable max-statements-per-line */
  3598. mg = (1.0 - c) * g;
  3599. return [
  3600. (c * pure[0] + mg) * 255,
  3601. (c * pure[1] + mg) * 255,
  3602. (c * pure[2] + mg) * 255
  3603. ];
  3604. };
  3605. convert.hcg.hsv = function (hcg) {
  3606. const c = hcg[1] / 100;
  3607. const g = hcg[2] / 100;
  3608. const v = c + g * (1.0 - c);
  3609. let f = 0;
  3610. if (v > 0.0) {
  3611. f = c / v;
  3612. }
  3613. return [hcg[0], f * 100, v * 100];
  3614. };
  3615. convert.hcg.hsl = function (hcg) {
  3616. const c = hcg[1] / 100;
  3617. const g = hcg[2] / 100;
  3618. const l = g * (1.0 - c) + 0.5 * c;
  3619. let s = 0;
  3620. if (l > 0.0 && l < 0.5) {
  3621. s = c / (2 * l);
  3622. } else
  3623. if (l >= 0.5 && l < 1.0) {
  3624. s = c / (2 * (1 - l));
  3625. }
  3626. return [hcg[0], s * 100, l * 100];
  3627. };
  3628. convert.hcg.hwb = function (hcg) {
  3629. const c = hcg[1] / 100;
  3630. const g = hcg[2] / 100;
  3631. const v = c + g * (1.0 - c);
  3632. return [hcg[0], (v - c) * 100, (1 - v) * 100];
  3633. };
  3634. convert.hwb.hcg = function (hwb) {
  3635. const w = hwb[1] / 100;
  3636. const b = hwb[2] / 100;
  3637. const v = 1 - b;
  3638. const c = v - w;
  3639. let g = 0;
  3640. if (c < 1) {
  3641. g = (v - c) / (1 - c);
  3642. }
  3643. return [hwb[0], c * 100, g * 100];
  3644. };
  3645. convert.apple.rgb = function (apple) {
  3646. return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
  3647. };
  3648. convert.rgb.apple = function (rgb) {
  3649. return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
  3650. };
  3651. convert.gray.rgb = function (args) {
  3652. return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  3653. };
  3654. convert.gray.hsl = function (args) {
  3655. return [0, 0, args[0]];
  3656. };
  3657. convert.gray.hsv = convert.gray.hsl;
  3658. convert.gray.hwb = function (gray) {
  3659. return [0, 100, gray[0]];
  3660. };
  3661. convert.gray.cmyk = function (gray) {
  3662. return [0, 0, 0, gray[0]];
  3663. };
  3664. convert.gray.lab = function (gray) {
  3665. return [gray[0], 0, 0];
  3666. };
  3667. convert.gray.hex = function (gray) {
  3668. const val = Math.round(gray[0] / 100 * 255) & 0xFF;
  3669. const integer = (val << 16) + (val << 8) + val;
  3670. const string = integer.toString(16).toUpperCase();
  3671. return '000000'.substring(string.length) + string;
  3672. };
  3673. convert.rgb.gray = function (rgb) {
  3674. const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
  3675. return [val / 255 * 100];
  3676. };
  3677. /***/ }),
  3678. /***/ 37050:
  3679. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3680. const conversions = __webpack_require__(1434);
  3681. const route = __webpack_require__(55406);
  3682. const convert = {};
  3683. const models = Object.keys(conversions);
  3684. function wrapRaw(fn) {
  3685. const wrappedFn = function (...args) {
  3686. const arg0 = args[0];
  3687. if (arg0 === undefined || arg0 === null) {
  3688. return arg0;
  3689. }
  3690. if (arg0.length > 1) {
  3691. args = arg0;
  3692. }
  3693. return fn(args);
  3694. };
  3695. // Preserve .conversion property if there is one
  3696. if ('conversion' in fn) {
  3697. wrappedFn.conversion = fn.conversion;
  3698. }
  3699. return wrappedFn;
  3700. }
  3701. function wrapRounded(fn) {
  3702. const wrappedFn = function (...args) {
  3703. const arg0 = args[0];
  3704. if (arg0 === undefined || arg0 === null) {
  3705. return arg0;
  3706. }
  3707. if (arg0.length > 1) {
  3708. args = arg0;
  3709. }
  3710. const result = fn(args);
  3711. // We're assuming the result is an array here.
  3712. // see notice in conversions.js; don't use box types
  3713. // in conversion functions.
  3714. if (typeof result === 'object') {
  3715. for (let len = result.length, i = 0; i < len; i++) {
  3716. result[i] = Math.round(result[i]);
  3717. }
  3718. }
  3719. return result;
  3720. };
  3721. // Preserve .conversion property if there is one
  3722. if ('conversion' in fn) {
  3723. wrappedFn.conversion = fn.conversion;
  3724. }
  3725. return wrappedFn;
  3726. }
  3727. models.forEach(fromModel => {
  3728. convert[fromModel] = {};
  3729. Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
  3730. Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
  3731. const routes = route(fromModel);
  3732. const routeModels = Object.keys(routes);
  3733. routeModels.forEach(toModel => {
  3734. const fn = routes[toModel];
  3735. convert[fromModel][toModel] = wrapRounded(fn);
  3736. convert[fromModel][toModel].raw = wrapRaw(fn);
  3737. });
  3738. });
  3739. module.exports = convert;
  3740. /***/ }),
  3741. /***/ 55406:
  3742. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3743. const conversions = __webpack_require__(1434);
  3744. /*
  3745. This function routes a model to all other models.
  3746. all functions that are routed have a property `.conversion` attached
  3747. to the returned synthetic function. This property is an array
  3748. of strings, each with the steps in between the 'from' and 'to'
  3749. color models (inclusive).
  3750. conversions that are not possible simply are not included.
  3751. */
  3752. function buildGraph() {
  3753. const graph = {};
  3754. // https://jsperf.com/object-keys-vs-for-in-with-closure/3
  3755. const models = Object.keys(conversions);
  3756. for (let len = models.length, i = 0; i < len; i++) {
  3757. graph[models[i]] = {
  3758. // http://jsperf.com/1-vs-infinity
  3759. // micro-opt, but this is simple.
  3760. distance: -1,
  3761. parent: null
  3762. };
  3763. }
  3764. return graph;
  3765. }
  3766. // https://en.wikipedia.org/wiki/Breadth-first_search
  3767. function deriveBFS(fromModel) {
  3768. const graph = buildGraph();
  3769. const queue = [fromModel]; // Unshift -> queue -> pop
  3770. graph[fromModel].distance = 0;
  3771. while (queue.length) {
  3772. const current = queue.pop();
  3773. const adjacents = Object.keys(conversions[current]);
  3774. for (let len = adjacents.length, i = 0; i < len; i++) {
  3775. const adjacent = adjacents[i];
  3776. const node = graph[adjacent];
  3777. if (node.distance === -1) {
  3778. node.distance = graph[current].distance + 1;
  3779. node.parent = current;
  3780. queue.unshift(adjacent);
  3781. }
  3782. }
  3783. }
  3784. return graph;
  3785. }
  3786. function link(from, to) {
  3787. return function (args) {
  3788. return to(from(args));
  3789. };
  3790. }
  3791. function wrapConversion(toModel, graph) {
  3792. const path = [graph[toModel].parent, toModel];
  3793. let fn = conversions[graph[toModel].parent][toModel];
  3794. let cur = graph[toModel].parent;
  3795. while (graph[cur].parent) {
  3796. path.unshift(graph[cur].parent);
  3797. fn = link(conversions[graph[cur].parent][cur], fn);
  3798. cur = graph[cur].parent;
  3799. }
  3800. fn.conversion = path;
  3801. return fn;
  3802. }
  3803. module.exports = function (fromModel) {
  3804. const graph = deriveBFS(fromModel);
  3805. const conversion = {};
  3806. const models = Object.keys(graph);
  3807. for (let len = models.length, i = 0; i < len; i++) {
  3808. const toModel = models[i];
  3809. const node = graph[toModel];
  3810. if (node.parent === null) {
  3811. // No possible conversion, or this node is the source model.
  3812. continue;
  3813. }
  3814. conversion[toModel] = wrapConversion(toModel, graph);
  3815. }
  3816. return conversion;
  3817. };
  3818. /***/ }),
  3819. /***/ 55063:
  3820. /***/ ((module) => {
  3821. "use strict";
  3822. module.exports = {
  3823. "aliceblue": [240, 248, 255],
  3824. "antiquewhite": [250, 235, 215],
  3825. "aqua": [0, 255, 255],
  3826. "aquamarine": [127, 255, 212],
  3827. "azure": [240, 255, 255],
  3828. "beige": [245, 245, 220],
  3829. "bisque": [255, 228, 196],
  3830. "black": [0, 0, 0],
  3831. "blanchedalmond": [255, 235, 205],
  3832. "blue": [0, 0, 255],
  3833. "blueviolet": [138, 43, 226],
  3834. "brown": [165, 42, 42],
  3835. "burlywood": [222, 184, 135],
  3836. "cadetblue": [95, 158, 160],
  3837. "chartreuse": [127, 255, 0],
  3838. "chocolate": [210, 105, 30],
  3839. "coral": [255, 127, 80],
  3840. "cornflowerblue": [100, 149, 237],
  3841. "cornsilk": [255, 248, 220],
  3842. "crimson": [220, 20, 60],
  3843. "cyan": [0, 255, 255],
  3844. "darkblue": [0, 0, 139],
  3845. "darkcyan": [0, 139, 139],
  3846. "darkgoldenrod": [184, 134, 11],
  3847. "darkgray": [169, 169, 169],
  3848. "darkgreen": [0, 100, 0],
  3849. "darkgrey": [169, 169, 169],
  3850. "darkkhaki": [189, 183, 107],
  3851. "darkmagenta": [139, 0, 139],
  3852. "darkolivegreen": [85, 107, 47],
  3853. "darkorange": [255, 140, 0],
  3854. "darkorchid": [153, 50, 204],
  3855. "darkred": [139, 0, 0],
  3856. "darksalmon": [233, 150, 122],
  3857. "darkseagreen": [143, 188, 143],
  3858. "darkslateblue": [72, 61, 139],
  3859. "darkslategray": [47, 79, 79],
  3860. "darkslategrey": [47, 79, 79],
  3861. "darkturquoise": [0, 206, 209],
  3862. "darkviolet": [148, 0, 211],
  3863. "deeppink": [255, 20, 147],
  3864. "deepskyblue": [0, 191, 255],
  3865. "dimgray": [105, 105, 105],
  3866. "dimgrey": [105, 105, 105],
  3867. "dodgerblue": [30, 144, 255],
  3868. "firebrick": [178, 34, 34],
  3869. "floralwhite": [255, 250, 240],
  3870. "forestgreen": [34, 139, 34],
  3871. "fuchsia": [255, 0, 255],
  3872. "gainsboro": [220, 220, 220],
  3873. "ghostwhite": [248, 248, 255],
  3874. "gold": [255, 215, 0],
  3875. "goldenrod": [218, 165, 32],
  3876. "gray": [128, 128, 128],
  3877. "green": [0, 128, 0],
  3878. "greenyellow": [173, 255, 47],
  3879. "grey": [128, 128, 128],
  3880. "honeydew": [240, 255, 240],
  3881. "hotpink": [255, 105, 180],
  3882. "indianred": [205, 92, 92],
  3883. "indigo": [75, 0, 130],
  3884. "ivory": [255, 255, 240],
  3885. "khaki": [240, 230, 140],
  3886. "lavender": [230, 230, 250],
  3887. "lavenderblush": [255, 240, 245],
  3888. "lawngreen": [124, 252, 0],
  3889. "lemonchiffon": [255, 250, 205],
  3890. "lightblue": [173, 216, 230],
  3891. "lightcoral": [240, 128, 128],
  3892. "lightcyan": [224, 255, 255],
  3893. "lightgoldenrodyellow": [250, 250, 210],
  3894. "lightgray": [211, 211, 211],
  3895. "lightgreen": [144, 238, 144],
  3896. "lightgrey": [211, 211, 211],
  3897. "lightpink": [255, 182, 193],
  3898. "lightsalmon": [255, 160, 122],
  3899. "lightseagreen": [32, 178, 170],
  3900. "lightskyblue": [135, 206, 250],
  3901. "lightslategray": [119, 136, 153],
  3902. "lightslategrey": [119, 136, 153],
  3903. "lightsteelblue": [176, 196, 222],
  3904. "lightyellow": [255, 255, 224],
  3905. "lime": [0, 255, 0],
  3906. "limegreen": [50, 205, 50],
  3907. "linen": [250, 240, 230],
  3908. "magenta": [255, 0, 255],
  3909. "maroon": [128, 0, 0],
  3910. "mediumaquamarine": [102, 205, 170],
  3911. "mediumblue": [0, 0, 205],
  3912. "mediumorchid": [186, 85, 211],
  3913. "mediumpurple": [147, 112, 219],
  3914. "mediumseagreen": [60, 179, 113],
  3915. "mediumslateblue": [123, 104, 238],
  3916. "mediumspringgreen": [0, 250, 154],
  3917. "mediumturquoise": [72, 209, 204],
  3918. "mediumvioletred": [199, 21, 133],
  3919. "midnightblue": [25, 25, 112],
  3920. "mintcream": [245, 255, 250],
  3921. "mistyrose": [255, 228, 225],
  3922. "moccasin": [255, 228, 181],
  3923. "navajowhite": [255, 222, 173],
  3924. "navy": [0, 0, 128],
  3925. "oldlace": [253, 245, 230],
  3926. "olive": [128, 128, 0],
  3927. "olivedrab": [107, 142, 35],
  3928. "orange": [255, 165, 0],
  3929. "orangered": [255, 69, 0],
  3930. "orchid": [218, 112, 214],
  3931. "palegoldenrod": [238, 232, 170],
  3932. "palegreen": [152, 251, 152],
  3933. "paleturquoise": [175, 238, 238],
  3934. "palevioletred": [219, 112, 147],
  3935. "papayawhip": [255, 239, 213],
  3936. "peachpuff": [255, 218, 185],
  3937. "peru": [205, 133, 63],
  3938. "pink": [255, 192, 203],
  3939. "plum": [221, 160, 221],
  3940. "powderblue": [176, 224, 230],
  3941. "purple": [128, 0, 128],
  3942. "rebeccapurple": [102, 51, 153],
  3943. "red": [255, 0, 0],
  3944. "rosybrown": [188, 143, 143],
  3945. "royalblue": [65, 105, 225],
  3946. "saddlebrown": [139, 69, 19],
  3947. "salmon": [250, 128, 114],
  3948. "sandybrown": [244, 164, 96],
  3949. "seagreen": [46, 139, 87],
  3950. "seashell": [255, 245, 238],
  3951. "sienna": [160, 82, 45],
  3952. "silver": [192, 192, 192],
  3953. "skyblue": [135, 206, 235],
  3954. "slateblue": [106, 90, 205],
  3955. "slategray": [112, 128, 144],
  3956. "slategrey": [112, 128, 144],
  3957. "snow": [255, 250, 250],
  3958. "springgreen": [0, 255, 127],
  3959. "steelblue": [70, 130, 180],
  3960. "tan": [210, 180, 140],
  3961. "teal": [0, 128, 128],
  3962. "thistle": [216, 191, 216],
  3963. "tomato": [255, 99, 71],
  3964. "turquoise": [64, 224, 208],
  3965. "violet": [238, 130, 238],
  3966. "wheat": [245, 222, 179],
  3967. "white": [255, 255, 255],
  3968. "whitesmoke": [245, 245, 245],
  3969. "yellow": [255, 255, 0],
  3970. "yellowgreen": [154, 205, 50]
  3971. };
  3972. /***/ }),
  3973. /***/ 87584:
  3974. /***/ ((module) => {
  3975. "use strict";
  3976. module.exports = (flag, argv = process.argv) => {
  3977. const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
  3978. const position = argv.indexOf(prefix + flag);
  3979. const terminatorPosition = argv.indexOf('--');
  3980. return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
  3981. };
  3982. /***/ }),
  3983. /***/ 12500:
  3984. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3985. "use strict";
  3986. const os = __webpack_require__(12087);
  3987. const tty = __webpack_require__(33867);
  3988. const hasFlag = __webpack_require__(87584);
  3989. const {env} = process;
  3990. let forceColor;
  3991. if (hasFlag('no-color') ||
  3992. hasFlag('no-colors') ||
  3993. hasFlag('color=false') ||
  3994. hasFlag('color=never')) {
  3995. forceColor = 0;
  3996. } else if (hasFlag('color') ||
  3997. hasFlag('colors') ||
  3998. hasFlag('color=true') ||
  3999. hasFlag('color=always')) {
  4000. forceColor = 1;
  4001. }
  4002. if ('FORCE_COLOR' in env) {
  4003. if (env.FORCE_COLOR === 'true') {
  4004. forceColor = 1;
  4005. } else if (env.FORCE_COLOR === 'false') {
  4006. forceColor = 0;
  4007. } else {
  4008. forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
  4009. }
  4010. }
  4011. function translateLevel(level) {
  4012. if (level === 0) {
  4013. return false;
  4014. }
  4015. return {
  4016. level,
  4017. hasBasic: true,
  4018. has256: level >= 2,
  4019. has16m: level >= 3
  4020. };
  4021. }
  4022. function supportsColor(haveStream, streamIsTTY) {
  4023. if (forceColor === 0) {
  4024. return 0;
  4025. }
  4026. if (hasFlag('color=16m') ||
  4027. hasFlag('color=full') ||
  4028. hasFlag('color=truecolor')) {
  4029. return 3;
  4030. }
  4031. if (hasFlag('color=256')) {
  4032. return 2;
  4033. }
  4034. if (haveStream && !streamIsTTY && forceColor === undefined) {
  4035. return 0;
  4036. }
  4037. const min = forceColor || 0;
  4038. if (env.TERM === 'dumb') {
  4039. return min;
  4040. }
  4041. if (process.platform === 'win32') {
  4042. // Windows 10 build 10586 is the first Windows release that supports 256 colors.
  4043. // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
  4044. const osRelease = os.release().split('.');
  4045. if (
  4046. Number(osRelease[0]) >= 10 &&
  4047. Number(osRelease[2]) >= 10586
  4048. ) {
  4049. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  4050. }
  4051. return 1;
  4052. }
  4053. if ('CI' in env) {
  4054. if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
  4055. return 1;
  4056. }
  4057. return min;
  4058. }
  4059. if ('TEAMCITY_VERSION' in env) {
  4060. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  4061. }
  4062. if (env.COLORTERM === 'truecolor') {
  4063. return 3;
  4064. }
  4065. if ('TERM_PROGRAM' in env) {
  4066. const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
  4067. switch (env.TERM_PROGRAM) {
  4068. case 'iTerm.app':
  4069. return version >= 3 ? 3 : 2;
  4070. case 'Apple_Terminal':
  4071. return 2;
  4072. // No default
  4073. }
  4074. }
  4075. if (/-256(color)?$/i.test(env.TERM)) {
  4076. return 2;
  4077. }
  4078. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  4079. return 1;
  4080. }
  4081. if ('COLORTERM' in env) {
  4082. return 1;
  4083. }
  4084. return min;
  4085. }
  4086. function getSupportLevel(stream) {
  4087. const level = supportsColor(stream, stream && stream.isTTY);
  4088. return translateLevel(level);
  4089. }
  4090. module.exports = {
  4091. supportsColor: getSupportLevel,
  4092. stdout: translateLevel(supportsColor(true, tty.isatty(1))),
  4093. stderr: translateLevel(supportsColor(true, tty.isatty(2)))
  4094. };
  4095. /***/ }),
  4096. /***/ 97998:
  4097. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  4098. "use strict";
  4099. // high-level commands
  4100. exports.c = exports.create = __webpack_require__(74629)
  4101. exports.r = exports.replace = __webpack_require__(71746)
  4102. exports.t = exports.list = __webpack_require__(6473)
  4103. exports.u = exports.update = __webpack_require__(45997)
  4104. exports.x = exports.extract = __webpack_require__(30769)
  4105. // classes
  4106. exports.Pack = __webpack_require__(48042)
  4107. exports.Unpack = __webpack_require__(42699)
  4108. exports.Parse = __webpack_require__(26824)
  4109. exports.ReadEntry = __webpack_require__(16277)
  4110. exports.WriteEntry = __webpack_require__(17620)
  4111. exports.Header = __webpack_require__(37134)
  4112. exports.Pax = __webpack_require__(64747)
  4113. exports.types = __webpack_require__(86753)
  4114. /***/ }),
  4115. /***/ 74629:
  4116. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4117. "use strict";
  4118. // tar -c
  4119. const hlo = __webpack_require__(32093)
  4120. const Pack = __webpack_require__(48042)
  4121. const fsm = __webpack_require__(10292)
  4122. const t = __webpack_require__(6473)
  4123. const path = __webpack_require__(85622)
  4124. module.exports = (opt_, files, cb) => {
  4125. if (typeof files === 'function')
  4126. cb = files
  4127. if (Array.isArray(opt_))
  4128. files = opt_, opt_ = {}
  4129. if (!files || !Array.isArray(files) || !files.length)
  4130. throw new TypeError('no files or directories specified')
  4131. files = Array.from(files)
  4132. const opt = hlo(opt_)
  4133. if (opt.sync && typeof cb === 'function')
  4134. throw new TypeError('callback not supported for sync tar functions')
  4135. if (!opt.file && typeof cb === 'function')
  4136. throw new TypeError('callback only supported with file option')
  4137. return opt.file && opt.sync ? createFileSync(opt, files)
  4138. : opt.file ? createFile(opt, files, cb)
  4139. : opt.sync ? createSync(opt, files)
  4140. : create(opt, files)
  4141. }
  4142. const createFileSync = (opt, files) => {
  4143. const p = new Pack.Sync(opt)
  4144. const stream = new fsm.WriteStreamSync(opt.file, {
  4145. mode: opt.mode || 0o666,
  4146. })
  4147. p.pipe(stream)
  4148. addFilesSync(p, files)
  4149. }
  4150. const createFile = (opt, files, cb) => {
  4151. const p = new Pack(opt)
  4152. const stream = new fsm.WriteStream(opt.file, {
  4153. mode: opt.mode || 0o666,
  4154. })
  4155. p.pipe(stream)
  4156. const promise = new Promise((res, rej) => {
  4157. stream.on('error', rej)
  4158. stream.on('close', res)
  4159. p.on('error', rej)
  4160. })
  4161. addFilesAsync(p, files)
  4162. return cb ? promise.then(cb, cb) : promise
  4163. }
  4164. const addFilesSync = (p, files) => {
  4165. files.forEach(file => {
  4166. if (file.charAt(0) === '@') {
  4167. t({
  4168. file: path.resolve(p.cwd, file.substr(1)),
  4169. sync: true,
  4170. noResume: true,
  4171. onentry: entry => p.add(entry),
  4172. })
  4173. } else
  4174. p.add(file)
  4175. })
  4176. p.end()
  4177. }
  4178. const addFilesAsync = (p, files) => {
  4179. while (files.length) {
  4180. const file = files.shift()
  4181. if (file.charAt(0) === '@') {
  4182. return t({
  4183. file: path.resolve(p.cwd, file.substr(1)),
  4184. noResume: true,
  4185. onentry: entry => p.add(entry),
  4186. }).then(_ => addFilesAsync(p, files))
  4187. } else
  4188. p.add(file)
  4189. }
  4190. p.end()
  4191. }
  4192. const createSync = (opt, files) => {
  4193. const p = new Pack.Sync(opt)
  4194. addFilesSync(p, files)
  4195. return p
  4196. }
  4197. const create = (opt, files) => {
  4198. const p = new Pack(opt)
  4199. addFilesAsync(p, files)
  4200. return p
  4201. }
  4202. /***/ }),
  4203. /***/ 30769:
  4204. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4205. "use strict";
  4206. // tar -x
  4207. const hlo = __webpack_require__(32093)
  4208. const Unpack = __webpack_require__(42699)
  4209. const fs = __webpack_require__(35747)
  4210. const fsm = __webpack_require__(10292)
  4211. const path = __webpack_require__(85622)
  4212. const stripSlash = __webpack_require__(64922)
  4213. module.exports = (opt_, files, cb) => {
  4214. if (typeof opt_ === 'function')
  4215. cb = opt_, files = null, opt_ = {}
  4216. else if (Array.isArray(opt_))
  4217. files = opt_, opt_ = {}
  4218. if (typeof files === 'function')
  4219. cb = files, files = null
  4220. if (!files)
  4221. files = []
  4222. else
  4223. files = Array.from(files)
  4224. const opt = hlo(opt_)
  4225. if (opt.sync && typeof cb === 'function')
  4226. throw new TypeError('callback not supported for sync tar functions')
  4227. if (!opt.file && typeof cb === 'function')
  4228. throw new TypeError('callback only supported with file option')
  4229. if (files.length)
  4230. filesFilter(opt, files)
  4231. return opt.file && opt.sync ? extractFileSync(opt)
  4232. : opt.file ? extractFile(opt, cb)
  4233. : opt.sync ? extractSync(opt)
  4234. : extract(opt)
  4235. }
  4236. // construct a filter that limits the file entries listed
  4237. // include child entries if a dir is included
  4238. const filesFilter = (opt, files) => {
  4239. const map = new Map(files.map(f => [stripSlash(f), true]))
  4240. const filter = opt.filter
  4241. const mapHas = (file, r) => {
  4242. const root = r || path.parse(file).root || '.'
  4243. const ret = file === root ? false
  4244. : map.has(file) ? map.get(file)
  4245. : mapHas(path.dirname(file), root)
  4246. map.set(file, ret)
  4247. return ret
  4248. }
  4249. opt.filter = filter
  4250. ? (file, entry) => filter(file, entry) && mapHas(stripSlash(file))
  4251. : file => mapHas(stripSlash(file))
  4252. }
  4253. const extractFileSync = opt => {
  4254. const u = new Unpack.Sync(opt)
  4255. const file = opt.file
  4256. const stat = fs.statSync(file)
  4257. // This trades a zero-byte read() syscall for a stat
  4258. // However, it will usually result in less memory allocation
  4259. const readSize = opt.maxReadSize || 16 * 1024 * 1024
  4260. const stream = new fsm.ReadStreamSync(file, {
  4261. readSize: readSize,
  4262. size: stat.size,
  4263. })
  4264. stream.pipe(u)
  4265. }
  4266. const extractFile = (opt, cb) => {
  4267. const u = new Unpack(opt)
  4268. const readSize = opt.maxReadSize || 16 * 1024 * 1024
  4269. const file = opt.file
  4270. const p = new Promise((resolve, reject) => {
  4271. u.on('error', reject)
  4272. u.on('close', resolve)
  4273. // This trades a zero-byte read() syscall for a stat
  4274. // However, it will usually result in less memory allocation
  4275. fs.stat(file, (er, stat) => {
  4276. if (er)
  4277. reject(er)
  4278. else {
  4279. const stream = new fsm.ReadStream(file, {
  4280. readSize: readSize,
  4281. size: stat.size,
  4282. })
  4283. stream.on('error', reject)
  4284. stream.pipe(u)
  4285. }
  4286. })
  4287. })
  4288. return cb ? p.then(cb, cb) : p
  4289. }
  4290. const extractSync = opt => new Unpack.Sync(opt)
  4291. const extract = opt => new Unpack(opt)
  4292. /***/ }),
  4293. /***/ 35879:
  4294. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4295. // Get the appropriate flag to use for creating files
  4296. // We use fmap on Windows platforms for files less than
  4297. // 512kb. This is a fairly low limit, but avoids making
  4298. // things slower in some cases. Since most of what this
  4299. // library is used for is extracting tarballs of many
  4300. // relatively small files in npm packages and the like,
  4301. // it can be a big boost on Windows platforms.
  4302. // Only supported in Node v12.9.0 and above.
  4303. const platform = process.env.__FAKE_PLATFORM__ || process.platform
  4304. const isWindows = platform === 'win32'
  4305. const fs = global.__FAKE_TESTING_FS__ || __webpack_require__(35747)
  4306. /* istanbul ignore next */
  4307. const { O_CREAT, O_TRUNC, O_WRONLY, UV_FS_O_FILEMAP = 0 } = fs.constants
  4308. const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP
  4309. const fMapLimit = 512 * 1024
  4310. const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY
  4311. module.exports = !fMapEnabled ? () => 'w'
  4312. : size => size < fMapLimit ? fMapFlag : 'w'
  4313. /***/ }),
  4314. /***/ 37134:
  4315. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4316. "use strict";
  4317. // parse a 512-byte header block to a data object, or vice-versa
  4318. // encode returns `true` if a pax extended header is needed, because
  4319. // the data could not be faithfully encoded in a simple header.
  4320. // (Also, check header.needPax to see if it needs a pax header.)
  4321. const types = __webpack_require__(86753)
  4322. const pathModule = __webpack_require__(85622).posix
  4323. const large = __webpack_require__(69678)
  4324. const SLURP = Symbol('slurp')
  4325. const TYPE = Symbol('type')
  4326. class Header {
  4327. constructor (data, off, ex, gex) {
  4328. this.cksumValid = false
  4329. this.needPax = false
  4330. this.nullBlock = false
  4331. this.block = null
  4332. this.path = null
  4333. this.mode = null
  4334. this.uid = null
  4335. this.gid = null
  4336. this.size = null
  4337. this.mtime = null
  4338. this.cksum = null
  4339. this[TYPE] = '0'
  4340. this.linkpath = null
  4341. this.uname = null
  4342. this.gname = null
  4343. this.devmaj = 0
  4344. this.devmin = 0
  4345. this.atime = null
  4346. this.ctime = null
  4347. if (Buffer.isBuffer(data))
  4348. this.decode(data, off || 0, ex, gex)
  4349. else if (data)
  4350. this.set(data)
  4351. }
  4352. decode (buf, off, ex, gex) {
  4353. if (!off)
  4354. off = 0
  4355. if (!buf || !(buf.length >= off + 512))
  4356. throw new Error('need 512 bytes for header')
  4357. this.path = decString(buf, off, 100)
  4358. this.mode = decNumber(buf, off + 100, 8)
  4359. this.uid = decNumber(buf, off + 108, 8)
  4360. this.gid = decNumber(buf, off + 116, 8)
  4361. this.size = decNumber(buf, off + 124, 12)
  4362. this.mtime = decDate(buf, off + 136, 12)
  4363. this.cksum = decNumber(buf, off + 148, 12)
  4364. // if we have extended or global extended headers, apply them now
  4365. // See https://github.com/npm/node-tar/pull/187
  4366. this[SLURP](ex)
  4367. this[SLURP](gex, true)
  4368. // old tar versions marked dirs as a file with a trailing /
  4369. this[TYPE] = decString(buf, off + 156, 1)
  4370. if (this[TYPE] === '')
  4371. this[TYPE] = '0'
  4372. if (this[TYPE] === '0' && this.path.substr(-1) === '/')
  4373. this[TYPE] = '5'
  4374. // tar implementations sometimes incorrectly put the stat(dir).size
  4375. // as the size in the tarball, even though Directory entries are
  4376. // not able to have any body at all. In the very rare chance that
  4377. // it actually DOES have a body, we weren't going to do anything with
  4378. // it anyway, and it'll just be a warning about an invalid header.
  4379. if (this[TYPE] === '5')
  4380. this.size = 0
  4381. this.linkpath = decString(buf, off + 157, 100)
  4382. if (buf.slice(off + 257, off + 265).toString() === 'ustar\u000000') {
  4383. this.uname = decString(buf, off + 265, 32)
  4384. this.gname = decString(buf, off + 297, 32)
  4385. this.devmaj = decNumber(buf, off + 329, 8)
  4386. this.devmin = decNumber(buf, off + 337, 8)
  4387. if (buf[off + 475] !== 0) {
  4388. // definitely a prefix, definitely >130 chars.
  4389. const prefix = decString(buf, off + 345, 155)
  4390. this.path = prefix + '/' + this.path
  4391. } else {
  4392. const prefix = decString(buf, off + 345, 130)
  4393. if (prefix)
  4394. this.path = prefix + '/' + this.path
  4395. this.atime = decDate(buf, off + 476, 12)
  4396. this.ctime = decDate(buf, off + 488, 12)
  4397. }
  4398. }
  4399. let sum = 8 * 0x20
  4400. for (let i = off; i < off + 148; i++)
  4401. sum += buf[i]
  4402. for (let i = off + 156; i < off + 512; i++)
  4403. sum += buf[i]
  4404. this.cksumValid = sum === this.cksum
  4405. if (this.cksum === null && sum === 8 * 0x20)
  4406. this.nullBlock = true
  4407. }
  4408. [SLURP] (ex, global) {
  4409. for (const k in ex) {
  4410. // we slurp in everything except for the path attribute in
  4411. // a global extended header, because that's weird.
  4412. if (ex[k] !== null && ex[k] !== undefined &&
  4413. !(global && k === 'path'))
  4414. this[k] = ex[k]
  4415. }
  4416. }
  4417. encode (buf, off) {
  4418. if (!buf) {
  4419. buf = this.block = Buffer.alloc(512)
  4420. off = 0
  4421. }
  4422. if (!off)
  4423. off = 0
  4424. if (!(buf.length >= off + 512))
  4425. throw new Error('need 512 bytes for header')
  4426. const prefixSize = this.ctime || this.atime ? 130 : 155
  4427. const split = splitPrefix(this.path || '', prefixSize)
  4428. const path = split[0]
  4429. const prefix = split[1]
  4430. this.needPax = split[2]
  4431. this.needPax = encString(buf, off, 100, path) || this.needPax
  4432. this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax
  4433. this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax
  4434. this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax
  4435. this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax
  4436. this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax
  4437. buf[off + 156] = this[TYPE].charCodeAt(0)
  4438. this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax
  4439. buf.write('ustar\u000000', off + 257, 8)
  4440. this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax
  4441. this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax
  4442. this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax
  4443. this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax
  4444. this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax
  4445. if (buf[off + 475] !== 0)
  4446. this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax
  4447. else {
  4448. this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax
  4449. this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax
  4450. this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax
  4451. }
  4452. let sum = 8 * 0x20
  4453. for (let i = off; i < off + 148; i++)
  4454. sum += buf[i]
  4455. for (let i = off + 156; i < off + 512; i++)
  4456. sum += buf[i]
  4457. this.cksum = sum
  4458. encNumber(buf, off + 148, 8, this.cksum)
  4459. this.cksumValid = true
  4460. return this.needPax
  4461. }
  4462. set (data) {
  4463. for (const i in data) {
  4464. if (data[i] !== null && data[i] !== undefined)
  4465. this[i] = data[i]
  4466. }
  4467. }
  4468. get type () {
  4469. return types.name.get(this[TYPE]) || this[TYPE]
  4470. }
  4471. get typeKey () {
  4472. return this[TYPE]
  4473. }
  4474. set type (type) {
  4475. if (types.code.has(type))
  4476. this[TYPE] = types.code.get(type)
  4477. else
  4478. this[TYPE] = type
  4479. }
  4480. }
  4481. const splitPrefix = (p, prefixSize) => {
  4482. const pathSize = 100
  4483. let pp = p
  4484. let prefix = ''
  4485. let ret
  4486. const root = pathModule.parse(p).root || '.'
  4487. if (Buffer.byteLength(pp) < pathSize)
  4488. ret = [pp, prefix, false]
  4489. else {
  4490. // first set prefix to the dir, and path to the base
  4491. prefix = pathModule.dirname(pp)
  4492. pp = pathModule.basename(pp)
  4493. do {
  4494. // both fit!
  4495. if (Buffer.byteLength(pp) <= pathSize &&
  4496. Buffer.byteLength(prefix) <= prefixSize)
  4497. ret = [pp, prefix, false]
  4498. // prefix fits in prefix, but path doesn't fit in path
  4499. else if (Buffer.byteLength(pp) > pathSize &&
  4500. Buffer.byteLength(prefix) <= prefixSize)
  4501. ret = [pp.substr(0, pathSize - 1), prefix, true]
  4502. else {
  4503. // make path take a bit from prefix
  4504. pp = pathModule.join(pathModule.basename(prefix), pp)
  4505. prefix = pathModule.dirname(prefix)
  4506. }
  4507. } while (prefix !== root && !ret)
  4508. // at this point, found no resolution, just truncate
  4509. if (!ret)
  4510. ret = [p.substr(0, pathSize - 1), '', true]
  4511. }
  4512. return ret
  4513. }
  4514. const decString = (buf, off, size) =>
  4515. buf.slice(off, off + size).toString('utf8').replace(/\0.*/, '')
  4516. const decDate = (buf, off, size) =>
  4517. numToDate(decNumber(buf, off, size))
  4518. const numToDate = num => num === null ? null : new Date(num * 1000)
  4519. const decNumber = (buf, off, size) =>
  4520. buf[off] & 0x80 ? large.parse(buf.slice(off, off + size))
  4521. : decSmallNumber(buf, off, size)
  4522. const nanNull = value => isNaN(value) ? null : value
  4523. const decSmallNumber = (buf, off, size) =>
  4524. nanNull(parseInt(
  4525. buf.slice(off, off + size)
  4526. .toString('utf8').replace(/\0.*$/, '').trim(), 8))
  4527. // the maximum encodable as a null-terminated octal, by field size
  4528. const MAXNUM = {
  4529. 12: 0o77777777777,
  4530. 8: 0o7777777,
  4531. }
  4532. const encNumber = (buf, off, size, number) =>
  4533. number === null ? false :
  4534. number > MAXNUM[size] || number < 0
  4535. ? (large.encode(number, buf.slice(off, off + size)), true)
  4536. : (encSmallNumber(buf, off, size, number), false)
  4537. const encSmallNumber = (buf, off, size, number) =>
  4538. buf.write(octalString(number, size), off, size, 'ascii')
  4539. const octalString = (number, size) =>
  4540. padOctal(Math.floor(number).toString(8), size)
  4541. const padOctal = (string, size) =>
  4542. (string.length === size - 1 ? string
  4543. : new Array(size - string.length - 1).join('0') + string + ' ') + '\0'
  4544. const encDate = (buf, off, size, date) =>
  4545. date === null ? false :
  4546. encNumber(buf, off, size, date.getTime() / 1000)
  4547. // enough to fill the longest string we've got
  4548. const NULLS = new Array(156).join('\0')
  4549. // pad with nulls, return true if it's longer or non-ascii
  4550. const encString = (buf, off, size, string) =>
  4551. string === null ? false :
  4552. (buf.write(string + NULLS, off, size, 'utf8'),
  4553. string.length !== Buffer.byteLength(string) || string.length > size)
  4554. module.exports = Header
  4555. /***/ }),
  4556. /***/ 32093:
  4557. /***/ ((module) => {
  4558. "use strict";
  4559. // turn tar(1) style args like `C` into the more verbose things like `cwd`
  4560. const argmap = new Map([
  4561. ['C', 'cwd'],
  4562. ['f', 'file'],
  4563. ['z', 'gzip'],
  4564. ['P', 'preservePaths'],
  4565. ['U', 'unlink'],
  4566. ['strip-components', 'strip'],
  4567. ['stripComponents', 'strip'],
  4568. ['keep-newer', 'newer'],
  4569. ['keepNewer', 'newer'],
  4570. ['keep-newer-files', 'newer'],
  4571. ['keepNewerFiles', 'newer'],
  4572. ['k', 'keep'],
  4573. ['keep-existing', 'keep'],
  4574. ['keepExisting', 'keep'],
  4575. ['m', 'noMtime'],
  4576. ['no-mtime', 'noMtime'],
  4577. ['p', 'preserveOwner'],
  4578. ['L', 'follow'],
  4579. ['h', 'follow'],
  4580. ])
  4581. module.exports = opt => opt ? Object.keys(opt).map(k => [
  4582. argmap.has(k) ? argmap.get(k) : k, opt[k],
  4583. ]).reduce((set, kv) => (set[kv[0]] = kv[1], set), Object.create(null)) : {}
  4584. /***/ }),
  4585. /***/ 69678:
  4586. /***/ ((module) => {
  4587. "use strict";
  4588. // Tar can encode large and negative numbers using a leading byte of
  4589. // 0xff for negative, and 0x80 for positive.
  4590. const encode = (num, buf) => {
  4591. if (!Number.isSafeInteger(num))
  4592. // The number is so large that javascript cannot represent it with integer
  4593. // precision.
  4594. throw Error('cannot encode number outside of javascript safe integer range')
  4595. else if (num < 0)
  4596. encodeNegative(num, buf)
  4597. else
  4598. encodePositive(num, buf)
  4599. return buf
  4600. }
  4601. const encodePositive = (num, buf) => {
  4602. buf[0] = 0x80
  4603. for (var i = buf.length; i > 1; i--) {
  4604. buf[i - 1] = num & 0xff
  4605. num = Math.floor(num / 0x100)
  4606. }
  4607. }
  4608. const encodeNegative = (num, buf) => {
  4609. buf[0] = 0xff
  4610. var flipped = false
  4611. num = num * -1
  4612. for (var i = buf.length; i > 1; i--) {
  4613. var byte = num & 0xff
  4614. num = Math.floor(num / 0x100)
  4615. if (flipped)
  4616. buf[i - 1] = onesComp(byte)
  4617. else if (byte === 0)
  4618. buf[i - 1] = 0
  4619. else {
  4620. flipped = true
  4621. buf[i - 1] = twosComp(byte)
  4622. }
  4623. }
  4624. }
  4625. const parse = (buf) => {
  4626. const pre = buf[0]
  4627. const value = pre === 0x80 ? pos(buf.slice(1, buf.length))
  4628. : pre === 0xff ? twos(buf)
  4629. : null
  4630. if (value === null)
  4631. throw Error('invalid base256 encoding')
  4632. if (!Number.isSafeInteger(value))
  4633. // The number is so large that javascript cannot represent it with integer
  4634. // precision.
  4635. throw Error('parsed number outside of javascript safe integer range')
  4636. return value
  4637. }
  4638. const twos = (buf) => {
  4639. var len = buf.length
  4640. var sum = 0
  4641. var flipped = false
  4642. for (var i = len - 1; i > -1; i--) {
  4643. var byte = buf[i]
  4644. var f
  4645. if (flipped)
  4646. f = onesComp(byte)
  4647. else if (byte === 0)
  4648. f = byte
  4649. else {
  4650. flipped = true
  4651. f = twosComp(byte)
  4652. }
  4653. if (f !== 0)
  4654. sum -= f * Math.pow(256, len - i - 1)
  4655. }
  4656. return sum
  4657. }
  4658. const pos = (buf) => {
  4659. var len = buf.length
  4660. var sum = 0
  4661. for (var i = len - 1; i > -1; i--) {
  4662. var byte = buf[i]
  4663. if (byte !== 0)
  4664. sum += byte * Math.pow(256, len - i - 1)
  4665. }
  4666. return sum
  4667. }
  4668. const onesComp = byte => (0xff ^ byte) & 0xff
  4669. const twosComp = byte => ((0xff ^ byte) + 1) & 0xff
  4670. module.exports = {
  4671. encode,
  4672. parse,
  4673. }
  4674. /***/ }),
  4675. /***/ 6473:
  4676. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4677. "use strict";
  4678. // XXX: This shares a lot in common with extract.js
  4679. // maybe some DRY opportunity here?
  4680. // tar -t
  4681. const hlo = __webpack_require__(32093)
  4682. const Parser = __webpack_require__(26824)
  4683. const fs = __webpack_require__(35747)
  4684. const fsm = __webpack_require__(10292)
  4685. const path = __webpack_require__(85622)
  4686. const stripSlash = __webpack_require__(64922)
  4687. module.exports = (opt_, files, cb) => {
  4688. if (typeof opt_ === 'function')
  4689. cb = opt_, files = null, opt_ = {}
  4690. else if (Array.isArray(opt_))
  4691. files = opt_, opt_ = {}
  4692. if (typeof files === 'function')
  4693. cb = files, files = null
  4694. if (!files)
  4695. files = []
  4696. else
  4697. files = Array.from(files)
  4698. const opt = hlo(opt_)
  4699. if (opt.sync && typeof cb === 'function')
  4700. throw new TypeError('callback not supported for sync tar functions')
  4701. if (!opt.file && typeof cb === 'function')
  4702. throw new TypeError('callback only supported with file option')
  4703. if (files.length)
  4704. filesFilter(opt, files)
  4705. if (!opt.noResume)
  4706. onentryFunction(opt)
  4707. return opt.file && opt.sync ? listFileSync(opt)
  4708. : opt.file ? listFile(opt, cb)
  4709. : list(opt)
  4710. }
  4711. const onentryFunction = opt => {
  4712. const onentry = opt.onentry
  4713. opt.onentry = onentry ? e => {
  4714. onentry(e)
  4715. e.resume()
  4716. } : e => e.resume()
  4717. }
  4718. // construct a filter that limits the file entries listed
  4719. // include child entries if a dir is included
  4720. const filesFilter = (opt, files) => {
  4721. const map = new Map(files.map(f => [stripSlash(f), true]))
  4722. const filter = opt.filter
  4723. const mapHas = (file, r) => {
  4724. const root = r || path.parse(file).root || '.'
  4725. const ret = file === root ? false
  4726. : map.has(file) ? map.get(file)
  4727. : mapHas(path.dirname(file), root)
  4728. map.set(file, ret)
  4729. return ret
  4730. }
  4731. opt.filter = filter
  4732. ? (file, entry) => filter(file, entry) && mapHas(stripSlash(file))
  4733. : file => mapHas(stripSlash(file))
  4734. }
  4735. const listFileSync = opt => {
  4736. const p = list(opt)
  4737. const file = opt.file
  4738. let threw = true
  4739. let fd
  4740. try {
  4741. const stat = fs.statSync(file)
  4742. const readSize = opt.maxReadSize || 16 * 1024 * 1024
  4743. if (stat.size < readSize)
  4744. p.end(fs.readFileSync(file))
  4745. else {
  4746. let pos = 0
  4747. const buf = Buffer.allocUnsafe(readSize)
  4748. fd = fs.openSync(file, 'r')
  4749. while (pos < stat.size) {
  4750. const bytesRead = fs.readSync(fd, buf, 0, readSize, pos)
  4751. pos += bytesRead
  4752. p.write(buf.slice(0, bytesRead))
  4753. }
  4754. p.end()
  4755. }
  4756. threw = false
  4757. } finally {
  4758. if (threw && fd) {
  4759. try {
  4760. fs.closeSync(fd)
  4761. } catch (er) {}
  4762. }
  4763. }
  4764. }
  4765. const listFile = (opt, cb) => {
  4766. const parse = new Parser(opt)
  4767. const readSize = opt.maxReadSize || 16 * 1024 * 1024
  4768. const file = opt.file
  4769. const p = new Promise((resolve, reject) => {
  4770. parse.on('error', reject)
  4771. parse.on('end', resolve)
  4772. fs.stat(file, (er, stat) => {
  4773. if (er)
  4774. reject(er)
  4775. else {
  4776. const stream = new fsm.ReadStream(file, {
  4777. readSize: readSize,
  4778. size: stat.size,
  4779. })
  4780. stream.on('error', reject)
  4781. stream.pipe(parse)
  4782. }
  4783. })
  4784. })
  4785. return cb ? p.then(cb, cb) : p
  4786. }
  4787. const list = opt => new Parser(opt)
  4788. /***/ }),
  4789. /***/ 53248:
  4790. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4791. "use strict";
  4792. // wrapper around mkdirp for tar's needs.
  4793. // TODO: This should probably be a class, not functionally
  4794. // passing around state in a gazillion args.
  4795. const mkdirp = __webpack_require__(76318)
  4796. const fs = __webpack_require__(35747)
  4797. const path = __webpack_require__(85622)
  4798. const chownr = __webpack_require__(85608)
  4799. const normPath = __webpack_require__(22905)
  4800. class SymlinkError extends Error {
  4801. constructor (symlink, path) {
  4802. super('Cannot extract through symbolic link')
  4803. this.path = path
  4804. this.symlink = symlink
  4805. }
  4806. get name () {
  4807. return 'SylinkError'
  4808. }
  4809. }
  4810. class CwdError extends Error {
  4811. constructor (path, code) {
  4812. super(code + ': Cannot cd into \'' + path + '\'')
  4813. this.path = path
  4814. this.code = code
  4815. }
  4816. get name () {
  4817. return 'CwdError'
  4818. }
  4819. }
  4820. const cGet = (cache, key) => cache.get(normPath(key))
  4821. const cSet = (cache, key, val) => cache.set(normPath(key), val)
  4822. const checkCwd = (dir, cb) => {
  4823. fs.stat(dir, (er, st) => {
  4824. if (er || !st.isDirectory())
  4825. er = new CwdError(dir, er && er.code || 'ENOTDIR')
  4826. cb(er)
  4827. })
  4828. }
  4829. module.exports = (dir, opt, cb) => {
  4830. dir = normPath(dir)
  4831. // if there's any overlap between mask and mode,
  4832. // then we'll need an explicit chmod
  4833. const umask = opt.umask
  4834. const mode = opt.mode | 0o0700
  4835. const needChmod = (mode & umask) !== 0
  4836. const uid = opt.uid
  4837. const gid = opt.gid
  4838. const doChown = typeof uid === 'number' &&
  4839. typeof gid === 'number' &&
  4840. (uid !== opt.processUid || gid !== opt.processGid)
  4841. const preserve = opt.preserve
  4842. const unlink = opt.unlink
  4843. const cache = opt.cache
  4844. const cwd = normPath(opt.cwd)
  4845. const done = (er, created) => {
  4846. if (er)
  4847. cb(er)
  4848. else {
  4849. cSet(cache, dir, true)
  4850. if (created && doChown)
  4851. chownr(created, uid, gid, er => done(er))
  4852. else if (needChmod)
  4853. fs.chmod(dir, mode, cb)
  4854. else
  4855. cb()
  4856. }
  4857. }
  4858. if (cache && cGet(cache, dir) === true)
  4859. return done()
  4860. if (dir === cwd)
  4861. return checkCwd(dir, done)
  4862. if (preserve)
  4863. return mkdirp(dir, {mode}).then(made => done(null, made), done)
  4864. const sub = normPath(path.relative(cwd, dir))
  4865. const parts = sub.split('/')
  4866. mkdir_(cwd, parts, mode, cache, unlink, cwd, null, done)
  4867. }
  4868. const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => {
  4869. if (!parts.length)
  4870. return cb(null, created)
  4871. const p = parts.shift()
  4872. const part = normPath(path.resolve(base + '/' + p))
  4873. if (cGet(cache, part))
  4874. return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
  4875. fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
  4876. }
  4877. const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => {
  4878. if (er) {
  4879. fs.lstat(part, (statEr, st) => {
  4880. if (statEr) {
  4881. statEr.path = statEr.path && normPath(statEr.path)
  4882. cb(statEr)
  4883. } else if (st.isDirectory())
  4884. mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
  4885. else if (unlink) {
  4886. fs.unlink(part, er => {
  4887. if (er)
  4888. return cb(er)
  4889. fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
  4890. })
  4891. } else if (st.isSymbolicLink())
  4892. return cb(new SymlinkError(part, part + '/' + parts.join('/')))
  4893. else
  4894. cb(er)
  4895. })
  4896. } else {
  4897. created = created || part
  4898. mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
  4899. }
  4900. }
  4901. const checkCwdSync = dir => {
  4902. let ok = false
  4903. let code = 'ENOTDIR'
  4904. try {
  4905. ok = fs.statSync(dir).isDirectory()
  4906. } catch (er) {
  4907. code = er.code
  4908. } finally {
  4909. if (!ok)
  4910. throw new CwdError(dir, code)
  4911. }
  4912. }
  4913. module.exports.sync = (dir, opt) => {
  4914. dir = normPath(dir)
  4915. // if there's any overlap between mask and mode,
  4916. // then we'll need an explicit chmod
  4917. const umask = opt.umask
  4918. const mode = opt.mode | 0o0700
  4919. const needChmod = (mode & umask) !== 0
  4920. const uid = opt.uid
  4921. const gid = opt.gid
  4922. const doChown = typeof uid === 'number' &&
  4923. typeof gid === 'number' &&
  4924. (uid !== opt.processUid || gid !== opt.processGid)
  4925. const preserve = opt.preserve
  4926. const unlink = opt.unlink
  4927. const cache = opt.cache
  4928. const cwd = normPath(opt.cwd)
  4929. const done = (created) => {
  4930. cSet(cache, dir, true)
  4931. if (created && doChown)
  4932. chownr.sync(created, uid, gid)
  4933. if (needChmod)
  4934. fs.chmodSync(dir, mode)
  4935. }
  4936. if (cache && cGet(cache, dir) === true)
  4937. return done()
  4938. if (dir === cwd) {
  4939. checkCwdSync(cwd)
  4940. return done()
  4941. }
  4942. if (preserve)
  4943. return done(mkdirp.sync(dir, mode))
  4944. const sub = normPath(path.relative(cwd, dir))
  4945. const parts = sub.split('/')
  4946. let created = null
  4947. for (let p = parts.shift(), part = cwd;
  4948. p && (part += '/' + p);
  4949. p = parts.shift()) {
  4950. part = normPath(path.resolve(part))
  4951. if (cGet(cache, part))
  4952. continue
  4953. try {
  4954. fs.mkdirSync(part, mode)
  4955. created = created || part
  4956. cSet(cache, part, true)
  4957. } catch (er) {
  4958. const st = fs.lstatSync(part)
  4959. if (st.isDirectory()) {
  4960. cSet(cache, part, true)
  4961. continue
  4962. } else if (unlink) {
  4963. fs.unlinkSync(part)
  4964. fs.mkdirSync(part, mode)
  4965. created = created || part
  4966. cSet(cache, part, true)
  4967. continue
  4968. } else if (st.isSymbolicLink())
  4969. return new SymlinkError(part, part + '/' + parts.join('/'))
  4970. }
  4971. }
  4972. return done(created)
  4973. }
  4974. /***/ }),
  4975. /***/ 27716:
  4976. /***/ ((module) => {
  4977. "use strict";
  4978. module.exports = (mode, isDir, portable) => {
  4979. mode &= 0o7777
  4980. // in portable mode, use the minimum reasonable umask
  4981. // if this system creates files with 0o664 by default
  4982. // (as some linux distros do), then we'll write the
  4983. // archive with 0o644 instead. Also, don't ever create
  4984. // a file that is not readable/writable by the owner.
  4985. if (portable)
  4986. mode = (mode | 0o600) & ~0o22
  4987. // if dirs are readable, then they should be listable
  4988. if (isDir) {
  4989. if (mode & 0o400)
  4990. mode |= 0o100
  4991. if (mode & 0o40)
  4992. mode |= 0o10
  4993. if (mode & 0o4)
  4994. mode |= 0o1
  4995. }
  4996. return mode
  4997. }
  4998. /***/ }),
  4999. /***/ 31946:
  5000. /***/ ((module) => {
  5001. // warning: extremely hot code path.
  5002. // This has been meticulously optimized for use
  5003. // within npm install on large package trees.
  5004. // Do not edit without careful benchmarking.
  5005. const normalizeCache = Object.create(null)
  5006. const {hasOwnProperty} = Object.prototype
  5007. module.exports = s => {
  5008. if (!hasOwnProperty.call(normalizeCache, s))
  5009. normalizeCache[s] = s.normalize('NFKD')
  5010. return normalizeCache[s]
  5011. }
  5012. /***/ }),
  5013. /***/ 22905:
  5014. /***/ ((module) => {
  5015. // on windows, either \ or / are valid directory separators.
  5016. // on unix, \ is a valid character in filenames.
  5017. // so, on windows, and only on windows, we replace all \ chars with /,
  5018. // so that we can use / as our one and only directory separator char.
  5019. const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform
  5020. module.exports = platform !== 'win32' ? p => p
  5021. : p => p && p.replace(/\\/g, '/')
  5022. /***/ }),
  5023. /***/ 48042:
  5024. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5025. "use strict";
  5026. // A readable tar stream creator
  5027. // Technically, this is a transform stream that you write paths into,
  5028. // and tar format comes out of.
  5029. // The `add()` method is like `write()` but returns this,
  5030. // and end() return `this` as well, so you can
  5031. // do `new Pack(opt).add('files').add('dir').end().pipe(output)
  5032. // You could also do something like:
  5033. // streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))
  5034. class PackJob {
  5035. constructor (path, absolute) {
  5036. this.path = path || './'
  5037. this.absolute = absolute
  5038. this.entry = null
  5039. this.stat = null
  5040. this.readdir = null
  5041. this.pending = false
  5042. this.ignore = false
  5043. this.piped = false
  5044. }
  5045. }
  5046. const MiniPass = __webpack_require__(74577)
  5047. const zlib = __webpack_require__(31650)
  5048. const ReadEntry = __webpack_require__(16277)
  5049. const WriteEntry = __webpack_require__(17620)
  5050. const WriteEntrySync = WriteEntry.Sync
  5051. const WriteEntryTar = WriteEntry.Tar
  5052. const Yallist = __webpack_require__(51234)
  5053. const EOF = Buffer.alloc(1024)
  5054. const ONSTAT = Symbol('onStat')
  5055. const ENDED = Symbol('ended')
  5056. const QUEUE = Symbol('queue')
  5057. const CURRENT = Symbol('current')
  5058. const PROCESS = Symbol('process')
  5059. const PROCESSING = Symbol('processing')
  5060. const PROCESSJOB = Symbol('processJob')
  5061. const JOBS = Symbol('jobs')
  5062. const JOBDONE = Symbol('jobDone')
  5063. const ADDFSENTRY = Symbol('addFSEntry')
  5064. const ADDTARENTRY = Symbol('addTarEntry')
  5065. const STAT = Symbol('stat')
  5066. const READDIR = Symbol('readdir')
  5067. const ONREADDIR = Symbol('onreaddir')
  5068. const PIPE = Symbol('pipe')
  5069. const ENTRY = Symbol('entry')
  5070. const ENTRYOPT = Symbol('entryOpt')
  5071. const WRITEENTRYCLASS = Symbol('writeEntryClass')
  5072. const WRITE = Symbol('write')
  5073. const ONDRAIN = Symbol('ondrain')
  5074. const fs = __webpack_require__(35747)
  5075. const path = __webpack_require__(85622)
  5076. const warner = __webpack_require__(7902)
  5077. const normPath = __webpack_require__(22905)
  5078. const Pack = warner(class Pack extends MiniPass {
  5079. constructor (opt) {
  5080. super(opt)
  5081. opt = opt || Object.create(null)
  5082. this.opt = opt
  5083. this.file = opt.file || ''
  5084. this.cwd = opt.cwd || process.cwd()
  5085. this.maxReadSize = opt.maxReadSize
  5086. this.preservePaths = !!opt.preservePaths
  5087. this.strict = !!opt.strict
  5088. this.noPax = !!opt.noPax
  5089. this.prefix = normPath(opt.prefix || '')
  5090. this.linkCache = opt.linkCache || new Map()
  5091. this.statCache = opt.statCache || new Map()
  5092. this.readdirCache = opt.readdirCache || new Map()
  5093. this[WRITEENTRYCLASS] = WriteEntry
  5094. if (typeof opt.onwarn === 'function')
  5095. this.on('warn', opt.onwarn)
  5096. this.portable = !!opt.portable
  5097. this.zip = null
  5098. if (opt.gzip) {
  5099. if (typeof opt.gzip !== 'object')
  5100. opt.gzip = {}
  5101. if (this.portable)
  5102. opt.gzip.portable = true
  5103. this.zip = new zlib.Gzip(opt.gzip)
  5104. this.zip.on('data', chunk => super.write(chunk))
  5105. this.zip.on('end', _ => super.end())
  5106. this.zip.on('drain', _ => this[ONDRAIN]())
  5107. this.on('resume', _ => this.zip.resume())
  5108. } else
  5109. this.on('drain', this[ONDRAIN])
  5110. this.noDirRecurse = !!opt.noDirRecurse
  5111. this.follow = !!opt.follow
  5112. this.noMtime = !!opt.noMtime
  5113. this.mtime = opt.mtime || null
  5114. this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true
  5115. this[QUEUE] = new Yallist()
  5116. this[JOBS] = 0
  5117. this.jobs = +opt.jobs || 4
  5118. this[PROCESSING] = false
  5119. this[ENDED] = false
  5120. }
  5121. [WRITE] (chunk) {
  5122. return super.write(chunk)
  5123. }
  5124. add (path) {
  5125. this.write(path)
  5126. return this
  5127. }
  5128. end (path) {
  5129. if (path)
  5130. this.write(path)
  5131. this[ENDED] = true
  5132. this[PROCESS]()
  5133. return this
  5134. }
  5135. write (path) {
  5136. if (this[ENDED])
  5137. throw new Error('write after end')
  5138. if (path instanceof ReadEntry)
  5139. this[ADDTARENTRY](path)
  5140. else
  5141. this[ADDFSENTRY](path)
  5142. return this.flowing
  5143. }
  5144. [ADDTARENTRY] (p) {
  5145. const absolute = normPath(path.resolve(this.cwd, p.path))
  5146. // in this case, we don't have to wait for the stat
  5147. if (!this.filter(p.path, p))
  5148. p.resume()
  5149. else {
  5150. const job = new PackJob(p.path, absolute, false)
  5151. job.entry = new WriteEntryTar(p, this[ENTRYOPT](job))
  5152. job.entry.on('end', _ => this[JOBDONE](job))
  5153. this[JOBS] += 1
  5154. this[QUEUE].push(job)
  5155. }
  5156. this[PROCESS]()
  5157. }
  5158. [ADDFSENTRY] (p) {
  5159. const absolute = normPath(path.resolve(this.cwd, p))
  5160. this[QUEUE].push(new PackJob(p, absolute))
  5161. this[PROCESS]()
  5162. }
  5163. [STAT] (job) {
  5164. job.pending = true
  5165. this[JOBS] += 1
  5166. const stat = this.follow ? 'stat' : 'lstat'
  5167. fs[stat](job.absolute, (er, stat) => {
  5168. job.pending = false
  5169. this[JOBS] -= 1
  5170. if (er)
  5171. this.emit('error', er)
  5172. else
  5173. this[ONSTAT](job, stat)
  5174. })
  5175. }
  5176. [ONSTAT] (job, stat) {
  5177. this.statCache.set(job.absolute, stat)
  5178. job.stat = stat
  5179. // now we have the stat, we can filter it.
  5180. if (!this.filter(job.path, stat))
  5181. job.ignore = true
  5182. this[PROCESS]()
  5183. }
  5184. [READDIR] (job) {
  5185. job.pending = true
  5186. this[JOBS] += 1
  5187. fs.readdir(job.absolute, (er, entries) => {
  5188. job.pending = false
  5189. this[JOBS] -= 1
  5190. if (er)
  5191. return this.emit('error', er)
  5192. this[ONREADDIR](job, entries)
  5193. })
  5194. }
  5195. [ONREADDIR] (job, entries) {
  5196. this.readdirCache.set(job.absolute, entries)
  5197. job.readdir = entries
  5198. this[PROCESS]()
  5199. }
  5200. [PROCESS] () {
  5201. if (this[PROCESSING])
  5202. return
  5203. this[PROCESSING] = true
  5204. for (let w = this[QUEUE].head;
  5205. w !== null && this[JOBS] < this.jobs;
  5206. w = w.next) {
  5207. this[PROCESSJOB](w.value)
  5208. if (w.value.ignore) {
  5209. const p = w.next
  5210. this[QUEUE].removeNode(w)
  5211. w.next = p
  5212. }
  5213. }
  5214. this[PROCESSING] = false
  5215. if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {
  5216. if (this.zip)
  5217. this.zip.end(EOF)
  5218. else {
  5219. super.write(EOF)
  5220. super.end()
  5221. }
  5222. }
  5223. }
  5224. get [CURRENT] () {
  5225. return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value
  5226. }
  5227. [JOBDONE] (job) {
  5228. this[QUEUE].shift()
  5229. this[JOBS] -= 1
  5230. this[PROCESS]()
  5231. }
  5232. [PROCESSJOB] (job) {
  5233. if (job.pending)
  5234. return
  5235. if (job.entry) {
  5236. if (job === this[CURRENT] && !job.piped)
  5237. this[PIPE](job)
  5238. return
  5239. }
  5240. if (!job.stat) {
  5241. if (this.statCache.has(job.absolute))
  5242. this[ONSTAT](job, this.statCache.get(job.absolute))
  5243. else
  5244. this[STAT](job)
  5245. }
  5246. if (!job.stat)
  5247. return
  5248. // filtered out!
  5249. if (job.ignore)
  5250. return
  5251. if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) {
  5252. if (this.readdirCache.has(job.absolute))
  5253. this[ONREADDIR](job, this.readdirCache.get(job.absolute))
  5254. else
  5255. this[READDIR](job)
  5256. if (!job.readdir)
  5257. return
  5258. }
  5259. // we know it doesn't have an entry, because that got checked above
  5260. job.entry = this[ENTRY](job)
  5261. if (!job.entry) {
  5262. job.ignore = true
  5263. return
  5264. }
  5265. if (job === this[CURRENT] && !job.piped)
  5266. this[PIPE](job)
  5267. }
  5268. [ENTRYOPT] (job) {
  5269. return {
  5270. onwarn: (code, msg, data) => this.warn(code, msg, data),
  5271. noPax: this.noPax,
  5272. cwd: this.cwd,
  5273. absolute: job.absolute,
  5274. preservePaths: this.preservePaths,
  5275. maxReadSize: this.maxReadSize,
  5276. strict: this.strict,
  5277. portable: this.portable,
  5278. linkCache: this.linkCache,
  5279. statCache: this.statCache,
  5280. noMtime: this.noMtime,
  5281. mtime: this.mtime,
  5282. prefix: this.prefix,
  5283. }
  5284. }
  5285. [ENTRY] (job) {
  5286. this[JOBS] += 1
  5287. try {
  5288. return new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job))
  5289. .on('end', () => this[JOBDONE](job))
  5290. .on('error', er => this.emit('error', er))
  5291. } catch (er) {
  5292. this.emit('error', er)
  5293. }
  5294. }
  5295. [ONDRAIN] () {
  5296. if (this[CURRENT] && this[CURRENT].entry)
  5297. this[CURRENT].entry.resume()
  5298. }
  5299. // like .pipe() but using super, because our write() is special
  5300. [PIPE] (job) {
  5301. job.piped = true
  5302. if (job.readdir) {
  5303. job.readdir.forEach(entry => {
  5304. const p = job.path
  5305. const base = p === './' ? '' : p.replace(/\/*$/, '/')
  5306. this[ADDFSENTRY](base + entry)
  5307. })
  5308. }
  5309. const source = job.entry
  5310. const zip = this.zip
  5311. if (zip) {
  5312. source.on('data', chunk => {
  5313. if (!zip.write(chunk))
  5314. source.pause()
  5315. })
  5316. } else {
  5317. source.on('data', chunk => {
  5318. if (!super.write(chunk))
  5319. source.pause()
  5320. })
  5321. }
  5322. }
  5323. pause () {
  5324. if (this.zip)
  5325. this.zip.pause()
  5326. return super.pause()
  5327. }
  5328. })
  5329. class PackSync extends Pack {
  5330. constructor (opt) {
  5331. super(opt)
  5332. this[WRITEENTRYCLASS] = WriteEntrySync
  5333. }
  5334. // pause/resume are no-ops in sync streams.
  5335. pause () {}
  5336. resume () {}
  5337. [STAT] (job) {
  5338. const stat = this.follow ? 'statSync' : 'lstatSync'
  5339. this[ONSTAT](job, fs[stat](job.absolute))
  5340. }
  5341. [READDIR] (job, stat) {
  5342. this[ONREADDIR](job, fs.readdirSync(job.absolute))
  5343. }
  5344. // gotta get it all in this tick
  5345. [PIPE] (job) {
  5346. const source = job.entry
  5347. const zip = this.zip
  5348. if (job.readdir) {
  5349. job.readdir.forEach(entry => {
  5350. const p = job.path
  5351. const base = p === './' ? '' : p.replace(/\/*$/, '/')
  5352. this[ADDFSENTRY](base + entry)
  5353. })
  5354. }
  5355. if (zip) {
  5356. source.on('data', chunk => {
  5357. zip.write(chunk)
  5358. })
  5359. } else {
  5360. source.on('data', chunk => {
  5361. super[WRITE](chunk)
  5362. })
  5363. }
  5364. }
  5365. }
  5366. Pack.Sync = PackSync
  5367. module.exports = Pack
  5368. /***/ }),
  5369. /***/ 26824:
  5370. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5371. "use strict";
  5372. // this[BUFFER] is the remainder of a chunk if we're waiting for
  5373. // the full 512 bytes of a header to come in. We will Buffer.concat()
  5374. // it to the next write(), which is a mem copy, but a small one.
  5375. //
  5376. // this[QUEUE] is a Yallist of entries that haven't been emitted
  5377. // yet this can only get filled up if the user keeps write()ing after
  5378. // a write() returns false, or does a write() with more than one entry
  5379. //
  5380. // We don't buffer chunks, we always parse them and either create an
  5381. // entry, or push it into the active entry. The ReadEntry class knows
  5382. // to throw data away if .ignore=true
  5383. //
  5384. // Shift entry off the buffer when it emits 'end', and emit 'entry' for
  5385. // the next one in the list.
  5386. //
  5387. // At any time, we're pushing body chunks into the entry at WRITEENTRY,
  5388. // and waiting for 'end' on the entry at READENTRY
  5389. //
  5390. // ignored entries get .resume() called on them straight away
  5391. const warner = __webpack_require__(7902)
  5392. const Header = __webpack_require__(37134)
  5393. const EE = __webpack_require__(28614)
  5394. const Yallist = __webpack_require__(51234)
  5395. const maxMetaEntrySize = 1024 * 1024
  5396. const Entry = __webpack_require__(16277)
  5397. const Pax = __webpack_require__(64747)
  5398. const zlib = __webpack_require__(31650)
  5399. const gzipHeader = Buffer.from([0x1f, 0x8b])
  5400. const STATE = Symbol('state')
  5401. const WRITEENTRY = Symbol('writeEntry')
  5402. const READENTRY = Symbol('readEntry')
  5403. const NEXTENTRY = Symbol('nextEntry')
  5404. const PROCESSENTRY = Symbol('processEntry')
  5405. const EX = Symbol('extendedHeader')
  5406. const GEX = Symbol('globalExtendedHeader')
  5407. const META = Symbol('meta')
  5408. const EMITMETA = Symbol('emitMeta')
  5409. const BUFFER = Symbol('buffer')
  5410. const QUEUE = Symbol('queue')
  5411. const ENDED = Symbol('ended')
  5412. const EMITTEDEND = Symbol('emittedEnd')
  5413. const EMIT = Symbol('emit')
  5414. const UNZIP = Symbol('unzip')
  5415. const CONSUMECHUNK = Symbol('consumeChunk')
  5416. const CONSUMECHUNKSUB = Symbol('consumeChunkSub')
  5417. const CONSUMEBODY = Symbol('consumeBody')
  5418. const CONSUMEMETA = Symbol('consumeMeta')
  5419. const CONSUMEHEADER = Symbol('consumeHeader')
  5420. const CONSUMING = Symbol('consuming')
  5421. const BUFFERCONCAT = Symbol('bufferConcat')
  5422. const MAYBEEND = Symbol('maybeEnd')
  5423. const WRITING = Symbol('writing')
  5424. const ABORTED = Symbol('aborted')
  5425. const DONE = Symbol('onDone')
  5426. const SAW_VALID_ENTRY = Symbol('sawValidEntry')
  5427. const SAW_NULL_BLOCK = Symbol('sawNullBlock')
  5428. const SAW_EOF = Symbol('sawEOF')
  5429. const noop = _ => true
  5430. module.exports = warner(class Parser extends EE {
  5431. constructor (opt) {
  5432. opt = opt || {}
  5433. super(opt)
  5434. this.file = opt.file || ''
  5435. // set to boolean false when an entry starts. 1024 bytes of \0
  5436. // is technically a valid tarball, albeit a boring one.
  5437. this[SAW_VALID_ENTRY] = null
  5438. // these BADARCHIVE errors can't be detected early. listen on DONE.
  5439. this.on(DONE, _ => {
  5440. if (this[STATE] === 'begin' || this[SAW_VALID_ENTRY] === false) {
  5441. // either less than 1 block of data, or all entries were invalid.
  5442. // Either way, probably not even a tarball.
  5443. this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format')
  5444. }
  5445. })
  5446. if (opt.ondone)
  5447. this.on(DONE, opt.ondone)
  5448. else {
  5449. this.on(DONE, _ => {
  5450. this.emit('prefinish')
  5451. this.emit('finish')
  5452. this.emit('end')
  5453. this.emit('close')
  5454. })
  5455. }
  5456. this.strict = !!opt.strict
  5457. this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize
  5458. this.filter = typeof opt.filter === 'function' ? opt.filter : noop
  5459. // have to set this so that streams are ok piping into it
  5460. this.writable = true
  5461. this.readable = false
  5462. this[QUEUE] = new Yallist()
  5463. this[BUFFER] = null
  5464. this[READENTRY] = null
  5465. this[WRITEENTRY] = null
  5466. this[STATE] = 'begin'
  5467. this[META] = ''
  5468. this[EX] = null
  5469. this[GEX] = null
  5470. this[ENDED] = false
  5471. this[UNZIP] = null
  5472. this[ABORTED] = false
  5473. this[SAW_NULL_BLOCK] = false
  5474. this[SAW_EOF] = false
  5475. if (typeof opt.onwarn === 'function')
  5476. this.on('warn', opt.onwarn)
  5477. if (typeof opt.onentry === 'function')
  5478. this.on('entry', opt.onentry)
  5479. }
  5480. [CONSUMEHEADER] (chunk, position) {
  5481. if (this[SAW_VALID_ENTRY] === null)
  5482. this[SAW_VALID_ENTRY] = false
  5483. let header
  5484. try {
  5485. header = new Header(chunk, position, this[EX], this[GEX])
  5486. } catch (er) {
  5487. return this.warn('TAR_ENTRY_INVALID', er)
  5488. }
  5489. if (header.nullBlock) {
  5490. if (this[SAW_NULL_BLOCK]) {
  5491. this[SAW_EOF] = true
  5492. // ending an archive with no entries. pointless, but legal.
  5493. if (this[STATE] === 'begin')
  5494. this[STATE] = 'header'
  5495. this[EMIT]('eof')
  5496. } else {
  5497. this[SAW_NULL_BLOCK] = true
  5498. this[EMIT]('nullBlock')
  5499. }
  5500. } else {
  5501. this[SAW_NULL_BLOCK] = false
  5502. if (!header.cksumValid)
  5503. this.warn('TAR_ENTRY_INVALID', 'checksum failure', {header})
  5504. else if (!header.path)
  5505. this.warn('TAR_ENTRY_INVALID', 'path is required', {header})
  5506. else {
  5507. const type = header.type
  5508. if (/^(Symbolic)?Link$/.test(type) && !header.linkpath)
  5509. this.warn('TAR_ENTRY_INVALID', 'linkpath required', {header})
  5510. else if (!/^(Symbolic)?Link$/.test(type) && header.linkpath)
  5511. this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', {header})
  5512. else {
  5513. const entry = this[WRITEENTRY] = new Entry(header, this[EX], this[GEX])
  5514. // we do this for meta & ignored entries as well, because they
  5515. // are still valid tar, or else we wouldn't know to ignore them
  5516. if (!this[SAW_VALID_ENTRY]) {
  5517. if (entry.remain) {
  5518. // this might be the one!
  5519. const onend = () => {
  5520. if (!entry.invalid)
  5521. this[SAW_VALID_ENTRY] = true
  5522. }
  5523. entry.on('end', onend)
  5524. } else
  5525. this[SAW_VALID_ENTRY] = true
  5526. }
  5527. if (entry.meta) {
  5528. if (entry.size > this.maxMetaEntrySize) {
  5529. entry.ignore = true
  5530. this[EMIT]('ignoredEntry', entry)
  5531. this[STATE] = 'ignore'
  5532. entry.resume()
  5533. } else if (entry.size > 0) {
  5534. this[META] = ''
  5535. entry.on('data', c => this[META] += c)
  5536. this[STATE] = 'meta'
  5537. }
  5538. } else {
  5539. this[EX] = null
  5540. entry.ignore = entry.ignore || !this.filter(entry.path, entry)
  5541. if (entry.ignore) {
  5542. // probably valid, just not something we care about
  5543. this[EMIT]('ignoredEntry', entry)
  5544. this[STATE] = entry.remain ? 'ignore' : 'header'
  5545. entry.resume()
  5546. } else {
  5547. if (entry.remain)
  5548. this[STATE] = 'body'
  5549. else {
  5550. this[STATE] = 'header'
  5551. entry.end()
  5552. }
  5553. if (!this[READENTRY]) {
  5554. this[QUEUE].push(entry)
  5555. this[NEXTENTRY]()
  5556. } else
  5557. this[QUEUE].push(entry)
  5558. }
  5559. }
  5560. }
  5561. }
  5562. }
  5563. }
  5564. [PROCESSENTRY] (entry) {
  5565. let go = true
  5566. if (!entry) {
  5567. this[READENTRY] = null
  5568. go = false
  5569. } else if (Array.isArray(entry))
  5570. this.emit.apply(this, entry)
  5571. else {
  5572. this[READENTRY] = entry
  5573. this.emit('entry', entry)
  5574. if (!entry.emittedEnd) {
  5575. entry.on('end', _ => this[NEXTENTRY]())
  5576. go = false
  5577. }
  5578. }
  5579. return go
  5580. }
  5581. [NEXTENTRY] () {
  5582. do {} while (this[PROCESSENTRY](this[QUEUE].shift()))
  5583. if (!this[QUEUE].length) {
  5584. // At this point, there's nothing in the queue, but we may have an
  5585. // entry which is being consumed (readEntry).
  5586. // If we don't, then we definitely can handle more data.
  5587. // If we do, and either it's flowing, or it has never had any data
  5588. // written to it, then it needs more.
  5589. // The only other possibility is that it has returned false from a
  5590. // write() call, so we wait for the next drain to continue.
  5591. const re = this[READENTRY]
  5592. const drainNow = !re || re.flowing || re.size === re.remain
  5593. if (drainNow) {
  5594. if (!this[WRITING])
  5595. this.emit('drain')
  5596. } else
  5597. re.once('drain', _ => this.emit('drain'))
  5598. }
  5599. }
  5600. [CONSUMEBODY] (chunk, position) {
  5601. // write up to but no more than writeEntry.blockRemain
  5602. const entry = this[WRITEENTRY]
  5603. const br = entry.blockRemain
  5604. const c = (br >= chunk.length && position === 0) ? chunk
  5605. : chunk.slice(position, position + br)
  5606. entry.write(c)
  5607. if (!entry.blockRemain) {
  5608. this[STATE] = 'header'
  5609. this[WRITEENTRY] = null
  5610. entry.end()
  5611. }
  5612. return c.length
  5613. }
  5614. [CONSUMEMETA] (chunk, position) {
  5615. const entry = this[WRITEENTRY]
  5616. const ret = this[CONSUMEBODY](chunk, position)
  5617. // if we finished, then the entry is reset
  5618. if (!this[WRITEENTRY])
  5619. this[EMITMETA](entry)
  5620. return ret
  5621. }
  5622. [EMIT] (ev, data, extra) {
  5623. if (!this[QUEUE].length && !this[READENTRY])
  5624. this.emit(ev, data, extra)
  5625. else
  5626. this[QUEUE].push([ev, data, extra])
  5627. }
  5628. [EMITMETA] (entry) {
  5629. this[EMIT]('meta', this[META])
  5630. switch (entry.type) {
  5631. case 'ExtendedHeader':
  5632. case 'OldExtendedHeader':
  5633. this[EX] = Pax.parse(this[META], this[EX], false)
  5634. break
  5635. case 'GlobalExtendedHeader':
  5636. this[GEX] = Pax.parse(this[META], this[GEX], true)
  5637. break
  5638. case 'NextFileHasLongPath':
  5639. case 'OldGnuLongPath':
  5640. this[EX] = this[EX] || Object.create(null)
  5641. this[EX].path = this[META].replace(/\0.*/, '')
  5642. break
  5643. case 'NextFileHasLongLinkpath':
  5644. this[EX] = this[EX] || Object.create(null)
  5645. this[EX].linkpath = this[META].replace(/\0.*/, '')
  5646. break
  5647. /* istanbul ignore next */
  5648. default: throw new Error('unknown meta: ' + entry.type)
  5649. }
  5650. }
  5651. abort (error) {
  5652. this[ABORTED] = true
  5653. this.emit('abort', error)
  5654. // always throws, even in non-strict mode
  5655. this.warn('TAR_ABORT', error, { recoverable: false })
  5656. }
  5657. write (chunk) {
  5658. if (this[ABORTED])
  5659. return
  5660. // first write, might be gzipped
  5661. if (this[UNZIP] === null && chunk) {
  5662. if (this[BUFFER]) {
  5663. chunk = Buffer.concat([this[BUFFER], chunk])
  5664. this[BUFFER] = null
  5665. }
  5666. if (chunk.length < gzipHeader.length) {
  5667. this[BUFFER] = chunk
  5668. return true
  5669. }
  5670. for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) {
  5671. if (chunk[i] !== gzipHeader[i])
  5672. this[UNZIP] = false
  5673. }
  5674. if (this[UNZIP] === null) {
  5675. const ended = this[ENDED]
  5676. this[ENDED] = false
  5677. this[UNZIP] = new zlib.Unzip()
  5678. this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk))
  5679. this[UNZIP].on('error', er => this.abort(er))
  5680. this[UNZIP].on('end', _ => {
  5681. this[ENDED] = true
  5682. this[CONSUMECHUNK]()
  5683. })
  5684. this[WRITING] = true
  5685. const ret = this[UNZIP][ended ? 'end' : 'write'](chunk)
  5686. this[WRITING] = false
  5687. return ret
  5688. }
  5689. }
  5690. this[WRITING] = true
  5691. if (this[UNZIP])
  5692. this[UNZIP].write(chunk)
  5693. else
  5694. this[CONSUMECHUNK](chunk)
  5695. this[WRITING] = false
  5696. // return false if there's a queue, or if the current entry isn't flowing
  5697. const ret =
  5698. this[QUEUE].length ? false :
  5699. this[READENTRY] ? this[READENTRY].flowing :
  5700. true
  5701. // if we have no queue, then that means a clogged READENTRY
  5702. if (!ret && !this[QUEUE].length)
  5703. this[READENTRY].once('drain', _ => this.emit('drain'))
  5704. return ret
  5705. }
  5706. [BUFFERCONCAT] (c) {
  5707. if (c && !this[ABORTED])
  5708. this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c
  5709. }
  5710. [MAYBEEND] () {
  5711. if (this[ENDED] &&
  5712. !this[EMITTEDEND] &&
  5713. !this[ABORTED] &&
  5714. !this[CONSUMING]) {
  5715. this[EMITTEDEND] = true
  5716. const entry = this[WRITEENTRY]
  5717. if (entry && entry.blockRemain) {
  5718. // truncated, likely a damaged file
  5719. const have = this[BUFFER] ? this[BUFFER].length : 0
  5720. this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${
  5721. entry.blockRemain} more bytes, only ${have} available)`, {entry})
  5722. if (this[BUFFER])
  5723. entry.write(this[BUFFER])
  5724. entry.end()
  5725. }
  5726. this[EMIT](DONE)
  5727. }
  5728. }
  5729. [CONSUMECHUNK] (chunk) {
  5730. if (this[CONSUMING])
  5731. this[BUFFERCONCAT](chunk)
  5732. else if (!chunk && !this[BUFFER])
  5733. this[MAYBEEND]()
  5734. else {
  5735. this[CONSUMING] = true
  5736. if (this[BUFFER]) {
  5737. this[BUFFERCONCAT](chunk)
  5738. const c = this[BUFFER]
  5739. this[BUFFER] = null
  5740. this[CONSUMECHUNKSUB](c)
  5741. } else
  5742. this[CONSUMECHUNKSUB](chunk)
  5743. while (this[BUFFER] &&
  5744. this[BUFFER].length >= 512 &&
  5745. !this[ABORTED] &&
  5746. !this[SAW_EOF]) {
  5747. const c = this[BUFFER]
  5748. this[BUFFER] = null
  5749. this[CONSUMECHUNKSUB](c)
  5750. }
  5751. this[CONSUMING] = false
  5752. }
  5753. if (!this[BUFFER] || this[ENDED])
  5754. this[MAYBEEND]()
  5755. }
  5756. [CONSUMECHUNKSUB] (chunk) {
  5757. // we know that we are in CONSUMING mode, so anything written goes into
  5758. // the buffer. Advance the position and put any remainder in the buffer.
  5759. let position = 0
  5760. const length = chunk.length
  5761. while (position + 512 <= length && !this[ABORTED] && !this[SAW_EOF]) {
  5762. switch (this[STATE]) {
  5763. case 'begin':
  5764. case 'header':
  5765. this[CONSUMEHEADER](chunk, position)
  5766. position += 512
  5767. break
  5768. case 'ignore':
  5769. case 'body':
  5770. position += this[CONSUMEBODY](chunk, position)
  5771. break
  5772. case 'meta':
  5773. position += this[CONSUMEMETA](chunk, position)
  5774. break
  5775. /* istanbul ignore next */
  5776. default:
  5777. throw new Error('invalid state: ' + this[STATE])
  5778. }
  5779. }
  5780. if (position < length) {
  5781. if (this[BUFFER])
  5782. this[BUFFER] = Buffer.concat([chunk.slice(position), this[BUFFER]])
  5783. else
  5784. this[BUFFER] = chunk.slice(position)
  5785. }
  5786. }
  5787. end (chunk) {
  5788. if (!this[ABORTED]) {
  5789. if (this[UNZIP])
  5790. this[UNZIP].end(chunk)
  5791. else {
  5792. this[ENDED] = true
  5793. this.write(chunk)
  5794. }
  5795. }
  5796. }
  5797. })
  5798. /***/ }),
  5799. /***/ 10:
  5800. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5801. // A path exclusive reservation system
  5802. // reserve([list, of, paths], fn)
  5803. // When the fn is first in line for all its paths, it
  5804. // is called with a cb that clears the reservation.
  5805. //
  5806. // Used by async unpack to avoid clobbering paths in use,
  5807. // while still allowing maximal safe parallelization.
  5808. const assert = __webpack_require__(42357)
  5809. const normalize = __webpack_require__(31946)
  5810. const stripSlashes = __webpack_require__(64922)
  5811. const { join } = __webpack_require__(85622)
  5812. const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform
  5813. const isWindows = platform === 'win32'
  5814. module.exports = () => {
  5815. // path => [function or Set]
  5816. // A Set object means a directory reservation
  5817. // A fn is a direct reservation on that path
  5818. const queues = new Map()
  5819. // fn => {paths:[path,...], dirs:[path, ...]}
  5820. const reservations = new Map()
  5821. // return a set of parent dirs for a given path
  5822. // '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']
  5823. const getDirs = path => {
  5824. const dirs = path.split('/').slice(0, -1).reduce((set, path) => {
  5825. if (set.length)
  5826. path = join(set[set.length - 1], path)
  5827. set.push(path || '/')
  5828. return set
  5829. }, [])
  5830. return dirs
  5831. }
  5832. // functions currently running
  5833. const running = new Set()
  5834. // return the queues for each path the function cares about
  5835. // fn => {paths, dirs}
  5836. const getQueues = fn => {
  5837. const res = reservations.get(fn)
  5838. /* istanbul ignore if - unpossible */
  5839. if (!res)
  5840. throw new Error('function does not have any path reservations')
  5841. return {
  5842. paths: res.paths.map(path => queues.get(path)),
  5843. dirs: [...res.dirs].map(path => queues.get(path)),
  5844. }
  5845. }
  5846. // check if fn is first in line for all its paths, and is
  5847. // included in the first set for all its dir queues
  5848. const check = fn => {
  5849. const {paths, dirs} = getQueues(fn)
  5850. return paths.every(q => q[0] === fn) &&
  5851. dirs.every(q => q[0] instanceof Set && q[0].has(fn))
  5852. }
  5853. // run the function if it's first in line and not already running
  5854. const run = fn => {
  5855. if (running.has(fn) || !check(fn))
  5856. return false
  5857. running.add(fn)
  5858. fn(() => clear(fn))
  5859. return true
  5860. }
  5861. const clear = fn => {
  5862. if (!running.has(fn))
  5863. return false
  5864. const { paths, dirs } = reservations.get(fn)
  5865. const next = new Set()
  5866. paths.forEach(path => {
  5867. const q = queues.get(path)
  5868. assert.equal(q[0], fn)
  5869. if (q.length === 1)
  5870. queues.delete(path)
  5871. else {
  5872. q.shift()
  5873. if (typeof q[0] === 'function')
  5874. next.add(q[0])
  5875. else
  5876. q[0].forEach(fn => next.add(fn))
  5877. }
  5878. })
  5879. dirs.forEach(dir => {
  5880. const q = queues.get(dir)
  5881. assert(q[0] instanceof Set)
  5882. if (q[0].size === 1 && q.length === 1)
  5883. queues.delete(dir)
  5884. else if (q[0].size === 1) {
  5885. q.shift()
  5886. // must be a function or else the Set would've been reused
  5887. next.add(q[0])
  5888. } else
  5889. q[0].delete(fn)
  5890. })
  5891. running.delete(fn)
  5892. next.forEach(fn => run(fn))
  5893. return true
  5894. }
  5895. const reserve = (paths, fn) => {
  5896. // collide on matches across case and unicode normalization
  5897. // On windows, thanks to the magic of 8.3 shortnames, it is fundamentally
  5898. // impossible to determine whether two paths refer to the same thing on
  5899. // disk, without asking the kernel for a shortname.
  5900. // So, we just pretend that every path matches every other path here,
  5901. // effectively removing all parallelization on windows.
  5902. paths = isWindows ? ['win32 parallelization disabled'] : paths.map(p => {
  5903. // don't need normPath, because we skip this entirely for windows
  5904. return normalize(stripSlashes(join(p))).toLowerCase()
  5905. })
  5906. const dirs = new Set(
  5907. paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))
  5908. )
  5909. reservations.set(fn, {dirs, paths})
  5910. paths.forEach(path => {
  5911. const q = queues.get(path)
  5912. if (!q)
  5913. queues.set(path, [fn])
  5914. else
  5915. q.push(fn)
  5916. })
  5917. dirs.forEach(dir => {
  5918. const q = queues.get(dir)
  5919. if (!q)
  5920. queues.set(dir, [new Set([fn])])
  5921. else if (q[q.length - 1] instanceof Set)
  5922. q[q.length - 1].add(fn)
  5923. else
  5924. q.push(new Set([fn]))
  5925. })
  5926. return run(fn)
  5927. }
  5928. return { check, reserve }
  5929. }
  5930. /***/ }),
  5931. /***/ 64747:
  5932. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5933. "use strict";
  5934. const Header = __webpack_require__(37134)
  5935. const path = __webpack_require__(85622)
  5936. class Pax {
  5937. constructor (obj, global) {
  5938. this.atime = obj.atime || null
  5939. this.charset = obj.charset || null
  5940. this.comment = obj.comment || null
  5941. this.ctime = obj.ctime || null
  5942. this.gid = obj.gid || null
  5943. this.gname = obj.gname || null
  5944. this.linkpath = obj.linkpath || null
  5945. this.mtime = obj.mtime || null
  5946. this.path = obj.path || null
  5947. this.size = obj.size || null
  5948. this.uid = obj.uid || null
  5949. this.uname = obj.uname || null
  5950. this.dev = obj.dev || null
  5951. this.ino = obj.ino || null
  5952. this.nlink = obj.nlink || null
  5953. this.global = global || false
  5954. }
  5955. encode () {
  5956. const body = this.encodeBody()
  5957. if (body === '')
  5958. return null
  5959. const bodyLen = Buffer.byteLength(body)
  5960. // round up to 512 bytes
  5961. // add 512 for header
  5962. const bufLen = 512 * Math.ceil(1 + bodyLen / 512)
  5963. const buf = Buffer.allocUnsafe(bufLen)
  5964. // 0-fill the header section, it might not hit every field
  5965. for (let i = 0; i < 512; i++)
  5966. buf[i] = 0
  5967. new Header({
  5968. // XXX split the path
  5969. // then the path should be PaxHeader + basename, but less than 99,
  5970. // prepend with the dirname
  5971. path: ('PaxHeader/' + path.basename(this.path)).slice(0, 99),
  5972. mode: this.mode || 0o644,
  5973. uid: this.uid || null,
  5974. gid: this.gid || null,
  5975. size: bodyLen,
  5976. mtime: this.mtime || null,
  5977. type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',
  5978. linkpath: '',
  5979. uname: this.uname || '',
  5980. gname: this.gname || '',
  5981. devmaj: 0,
  5982. devmin: 0,
  5983. atime: this.atime || null,
  5984. ctime: this.ctime || null,
  5985. }).encode(buf)
  5986. buf.write(body, 512, bodyLen, 'utf8')
  5987. // null pad after the body
  5988. for (let i = bodyLen + 512; i < buf.length; i++)
  5989. buf[i] = 0
  5990. return buf
  5991. }
  5992. encodeBody () {
  5993. return (
  5994. this.encodeField('path') +
  5995. this.encodeField('ctime') +
  5996. this.encodeField('atime') +
  5997. this.encodeField('dev') +
  5998. this.encodeField('ino') +
  5999. this.encodeField('nlink') +
  6000. this.encodeField('charset') +
  6001. this.encodeField('comment') +
  6002. this.encodeField('gid') +
  6003. this.encodeField('gname') +
  6004. this.encodeField('linkpath') +
  6005. this.encodeField('mtime') +
  6006. this.encodeField('size') +
  6007. this.encodeField('uid') +
  6008. this.encodeField('uname')
  6009. )
  6010. }
  6011. encodeField (field) {
  6012. if (this[field] === null || this[field] === undefined)
  6013. return ''
  6014. const v = this[field] instanceof Date ? this[field].getTime() / 1000
  6015. : this[field]
  6016. const s = ' ' +
  6017. (field === 'dev' || field === 'ino' || field === 'nlink'
  6018. ? 'SCHILY.' : '') +
  6019. field + '=' + v + '\n'
  6020. const byteLen = Buffer.byteLength(s)
  6021. // the digits includes the length of the digits in ascii base-10
  6022. // so if it's 9 characters, then adding 1 for the 9 makes it 10
  6023. // which makes it 11 chars.
  6024. let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1
  6025. if (byteLen + digits >= Math.pow(10, digits))
  6026. digits += 1
  6027. const len = digits + byteLen
  6028. return len + s
  6029. }
  6030. }
  6031. Pax.parse = (string, ex, g) => new Pax(merge(parseKV(string), ex), g)
  6032. const merge = (a, b) =>
  6033. b ? Object.keys(a).reduce((s, k) => (s[k] = a[k], s), b) : a
  6034. const parseKV = string =>
  6035. string
  6036. .replace(/\n$/, '')
  6037. .split('\n')
  6038. .reduce(parseKVLine, Object.create(null))
  6039. const parseKVLine = (set, line) => {
  6040. const n = parseInt(line, 10)
  6041. // XXX Values with \n in them will fail this.
  6042. // Refactor to not be a naive line-by-line parse.
  6043. if (n !== Buffer.byteLength(line) + 1)
  6044. return set
  6045. line = line.substr((n + ' ').length)
  6046. const kv = line.split('=')
  6047. const k = kv.shift().replace(/^SCHILY\.(dev|ino|nlink)/, '$1')
  6048. if (!k)
  6049. return set
  6050. const v = kv.join('=')
  6051. set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k)
  6052. ? new Date(v * 1000)
  6053. : /^[0-9]+$/.test(v) ? +v
  6054. : v
  6055. return set
  6056. }
  6057. module.exports = Pax
  6058. /***/ }),
  6059. /***/ 16277:
  6060. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6061. "use strict";
  6062. const MiniPass = __webpack_require__(74577)
  6063. const normPath = __webpack_require__(22905)
  6064. const SLURP = Symbol('slurp')
  6065. module.exports = class ReadEntry extends MiniPass {
  6066. constructor (header, ex, gex) {
  6067. super()
  6068. // read entries always start life paused. this is to avoid the
  6069. // situation where Minipass's auto-ending empty streams results
  6070. // in an entry ending before we're ready for it.
  6071. this.pause()
  6072. this.extended = ex
  6073. this.globalExtended = gex
  6074. this.header = header
  6075. this.startBlockSize = 512 * Math.ceil(header.size / 512)
  6076. this.blockRemain = this.startBlockSize
  6077. this.remain = header.size
  6078. this.type = header.type
  6079. this.meta = false
  6080. this.ignore = false
  6081. switch (this.type) {
  6082. case 'File':
  6083. case 'OldFile':
  6084. case 'Link':
  6085. case 'SymbolicLink':
  6086. case 'CharacterDevice':
  6087. case 'BlockDevice':
  6088. case 'Directory':
  6089. case 'FIFO':
  6090. case 'ContiguousFile':
  6091. case 'GNUDumpDir':
  6092. break
  6093. case 'NextFileHasLongLinkpath':
  6094. case 'NextFileHasLongPath':
  6095. case 'OldGnuLongPath':
  6096. case 'GlobalExtendedHeader':
  6097. case 'ExtendedHeader':
  6098. case 'OldExtendedHeader':
  6099. this.meta = true
  6100. break
  6101. // NOTE: gnutar and bsdtar treat unrecognized types as 'File'
  6102. // it may be worth doing the same, but with a warning.
  6103. default:
  6104. this.ignore = true
  6105. }
  6106. this.path = normPath(header.path)
  6107. this.mode = header.mode
  6108. if (this.mode)
  6109. this.mode = this.mode & 0o7777
  6110. this.uid = header.uid
  6111. this.gid = header.gid
  6112. this.uname = header.uname
  6113. this.gname = header.gname
  6114. this.size = header.size
  6115. this.mtime = header.mtime
  6116. this.atime = header.atime
  6117. this.ctime = header.ctime
  6118. this.linkpath = normPath(header.linkpath)
  6119. this.uname = header.uname
  6120. this.gname = header.gname
  6121. if (ex)
  6122. this[SLURP](ex)
  6123. if (gex)
  6124. this[SLURP](gex, true)
  6125. }
  6126. write (data) {
  6127. const writeLen = data.length
  6128. if (writeLen > this.blockRemain)
  6129. throw new Error('writing more to entry than is appropriate')
  6130. const r = this.remain
  6131. const br = this.blockRemain
  6132. this.remain = Math.max(0, r - writeLen)
  6133. this.blockRemain = Math.max(0, br - writeLen)
  6134. if (this.ignore)
  6135. return true
  6136. if (r >= writeLen)
  6137. return super.write(data)
  6138. // r < writeLen
  6139. return super.write(data.slice(0, r))
  6140. }
  6141. [SLURP] (ex, global) {
  6142. for (const k in ex) {
  6143. // we slurp in everything except for the path attribute in
  6144. // a global extended header, because that's weird.
  6145. if (ex[k] !== null && ex[k] !== undefined &&
  6146. !(global && k === 'path'))
  6147. this[k] = k === 'path' || k === 'linkpath' ? normPath(ex[k]) : ex[k]
  6148. }
  6149. }
  6150. }
  6151. /***/ }),
  6152. /***/ 71746:
  6153. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6154. "use strict";
  6155. // tar -r
  6156. const hlo = __webpack_require__(32093)
  6157. const Pack = __webpack_require__(48042)
  6158. const fs = __webpack_require__(35747)
  6159. const fsm = __webpack_require__(10292)
  6160. const t = __webpack_require__(6473)
  6161. const path = __webpack_require__(85622)
  6162. // starting at the head of the file, read a Header
  6163. // If the checksum is invalid, that's our position to start writing
  6164. // If it is, jump forward by the specified size (round up to 512)
  6165. // and try again.
  6166. // Write the new Pack stream starting there.
  6167. const Header = __webpack_require__(37134)
  6168. module.exports = (opt_, files, cb) => {
  6169. const opt = hlo(opt_)
  6170. if (!opt.file)
  6171. throw new TypeError('file is required')
  6172. if (opt.gzip)
  6173. throw new TypeError('cannot append to compressed archives')
  6174. if (!files || !Array.isArray(files) || !files.length)
  6175. throw new TypeError('no files or directories specified')
  6176. files = Array.from(files)
  6177. return opt.sync ? replaceSync(opt, files)
  6178. : replace(opt, files, cb)
  6179. }
  6180. const replaceSync = (opt, files) => {
  6181. const p = new Pack.Sync(opt)
  6182. let threw = true
  6183. let fd
  6184. let position
  6185. try {
  6186. try {
  6187. fd = fs.openSync(opt.file, 'r+')
  6188. } catch (er) {
  6189. if (er.code === 'ENOENT')
  6190. fd = fs.openSync(opt.file, 'w+')
  6191. else
  6192. throw er
  6193. }
  6194. const st = fs.fstatSync(fd)
  6195. const headBuf = Buffer.alloc(512)
  6196. POSITION: for (position = 0; position < st.size; position += 512) {
  6197. for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {
  6198. bytes = fs.readSync(
  6199. fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos
  6200. )
  6201. if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b)
  6202. throw new Error('cannot append to compressed archives')
  6203. if (!bytes)
  6204. break POSITION
  6205. }
  6206. const h = new Header(headBuf)
  6207. if (!h.cksumValid)
  6208. break
  6209. const entryBlockSize = 512 * Math.ceil(h.size / 512)
  6210. if (position + entryBlockSize + 512 > st.size)
  6211. break
  6212. // the 512 for the header we just parsed will be added as well
  6213. // also jump ahead all the blocks for the body
  6214. position += entryBlockSize
  6215. if (opt.mtimeCache)
  6216. opt.mtimeCache.set(h.path, h.mtime)
  6217. }
  6218. threw = false
  6219. streamSync(opt, p, position, fd, files)
  6220. } finally {
  6221. if (threw) {
  6222. try {
  6223. fs.closeSync(fd)
  6224. } catch (er) {}
  6225. }
  6226. }
  6227. }
  6228. const streamSync = (opt, p, position, fd, files) => {
  6229. const stream = new fsm.WriteStreamSync(opt.file, {
  6230. fd: fd,
  6231. start: position,
  6232. })
  6233. p.pipe(stream)
  6234. addFilesSync(p, files)
  6235. }
  6236. const replace = (opt, files, cb) => {
  6237. files = Array.from(files)
  6238. const p = new Pack(opt)
  6239. const getPos = (fd, size, cb_) => {
  6240. const cb = (er, pos) => {
  6241. if (er)
  6242. fs.close(fd, _ => cb_(er))
  6243. else
  6244. cb_(null, pos)
  6245. }
  6246. let position = 0
  6247. if (size === 0)
  6248. return cb(null, 0)
  6249. let bufPos = 0
  6250. const headBuf = Buffer.alloc(512)
  6251. const onread = (er, bytes) => {
  6252. if (er)
  6253. return cb(er)
  6254. bufPos += bytes
  6255. if (bufPos < 512 && bytes) {
  6256. return fs.read(
  6257. fd, headBuf, bufPos, headBuf.length - bufPos,
  6258. position + bufPos, onread
  6259. )
  6260. }
  6261. if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b)
  6262. return cb(new Error('cannot append to compressed archives'))
  6263. // truncated header
  6264. if (bufPos < 512)
  6265. return cb(null, position)
  6266. const h = new Header(headBuf)
  6267. if (!h.cksumValid)
  6268. return cb(null, position)
  6269. const entryBlockSize = 512 * Math.ceil(h.size / 512)
  6270. if (position + entryBlockSize + 512 > size)
  6271. return cb(null, position)
  6272. position += entryBlockSize + 512
  6273. if (position >= size)
  6274. return cb(null, position)
  6275. if (opt.mtimeCache)
  6276. opt.mtimeCache.set(h.path, h.mtime)
  6277. bufPos = 0
  6278. fs.read(fd, headBuf, 0, 512, position, onread)
  6279. }
  6280. fs.read(fd, headBuf, 0, 512, position, onread)
  6281. }
  6282. const promise = new Promise((resolve, reject) => {
  6283. p.on('error', reject)
  6284. let flag = 'r+'
  6285. const onopen = (er, fd) => {
  6286. if (er && er.code === 'ENOENT' && flag === 'r+') {
  6287. flag = 'w+'
  6288. return fs.open(opt.file, flag, onopen)
  6289. }
  6290. if (er)
  6291. return reject(er)
  6292. fs.fstat(fd, (er, st) => {
  6293. if (er)
  6294. return fs.close(fd, () => reject(er))
  6295. getPos(fd, st.size, (er, position) => {
  6296. if (er)
  6297. return reject(er)
  6298. const stream = new fsm.WriteStream(opt.file, {
  6299. fd: fd,
  6300. start: position,
  6301. })
  6302. p.pipe(stream)
  6303. stream.on('error', reject)
  6304. stream.on('close', resolve)
  6305. addFilesAsync(p, files)
  6306. })
  6307. })
  6308. }
  6309. fs.open(opt.file, flag, onopen)
  6310. })
  6311. return cb ? promise.then(cb, cb) : promise
  6312. }
  6313. const addFilesSync = (p, files) => {
  6314. files.forEach(file => {
  6315. if (file.charAt(0) === '@') {
  6316. t({
  6317. file: path.resolve(p.cwd, file.substr(1)),
  6318. sync: true,
  6319. noResume: true,
  6320. onentry: entry => p.add(entry),
  6321. })
  6322. } else
  6323. p.add(file)
  6324. })
  6325. p.end()
  6326. }
  6327. const addFilesAsync = (p, files) => {
  6328. while (files.length) {
  6329. const file = files.shift()
  6330. if (file.charAt(0) === '@') {
  6331. return t({
  6332. file: path.resolve(p.cwd, file.substr(1)),
  6333. noResume: true,
  6334. onentry: entry => p.add(entry),
  6335. }).then(_ => addFilesAsync(p, files))
  6336. } else
  6337. p.add(file)
  6338. }
  6339. p.end()
  6340. }
  6341. /***/ }),
  6342. /***/ 2214:
  6343. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6344. // unix absolute paths are also absolute on win32, so we use this for both
  6345. const { isAbsolute, parse } = __webpack_require__(85622).win32
  6346. // returns [root, stripped]
  6347. // Note that windows will think that //x/y/z/a has a "root" of //x/y, and in
  6348. // those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip /
  6349. // explicitly if it's the first character.
  6350. // drive-specific relative paths on Windows get their root stripped off even
  6351. // though they are not absolute, so `c:../foo` becomes ['c:', '../foo']
  6352. module.exports = path => {
  6353. let r = ''
  6354. let parsed = parse(path)
  6355. while (isAbsolute(path) || parsed.root) {
  6356. // windows will think that //x/y/z has a "root" of //x/y/
  6357. // but strip the //?/C:/ off of //?/C:/path
  6358. const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? '/'
  6359. : parsed.root
  6360. path = path.substr(root.length)
  6361. r += root
  6362. parsed = parse(path)
  6363. }
  6364. return [r, path]
  6365. }
  6366. /***/ }),
  6367. /***/ 64922:
  6368. /***/ ((module) => {
  6369. // warning: extremely hot code path.
  6370. // This has been meticulously optimized for use
  6371. // within npm install on large package trees.
  6372. // Do not edit without careful benchmarking.
  6373. module.exports = str => {
  6374. let i = str.length - 1
  6375. let slashesStart = -1
  6376. while (i > -1 && str.charAt(i) === '/') {
  6377. slashesStart = i
  6378. i--
  6379. }
  6380. return slashesStart === -1 ? str : str.slice(0, slashesStart)
  6381. }
  6382. /***/ }),
  6383. /***/ 86753:
  6384. /***/ ((__unused_webpack_module, exports) => {
  6385. "use strict";
  6386. // map types from key to human-friendly name
  6387. exports.name = new Map([
  6388. ['0', 'File'],
  6389. // same as File
  6390. ['', 'OldFile'],
  6391. ['1', 'Link'],
  6392. ['2', 'SymbolicLink'],
  6393. // Devices and FIFOs aren't fully supported
  6394. // they are parsed, but skipped when unpacking
  6395. ['3', 'CharacterDevice'],
  6396. ['4', 'BlockDevice'],
  6397. ['5', 'Directory'],
  6398. ['6', 'FIFO'],
  6399. // same as File
  6400. ['7', 'ContiguousFile'],
  6401. // pax headers
  6402. ['g', 'GlobalExtendedHeader'],
  6403. ['x', 'ExtendedHeader'],
  6404. // vendor-specific stuff
  6405. // skip
  6406. ['A', 'SolarisACL'],
  6407. // like 5, but with data, which should be skipped
  6408. ['D', 'GNUDumpDir'],
  6409. // metadata only, skip
  6410. ['I', 'Inode'],
  6411. // data = link path of next file
  6412. ['K', 'NextFileHasLongLinkpath'],
  6413. // data = path of next file
  6414. ['L', 'NextFileHasLongPath'],
  6415. // skip
  6416. ['M', 'ContinuationFile'],
  6417. // like L
  6418. ['N', 'OldGnuLongPath'],
  6419. // skip
  6420. ['S', 'SparseFile'],
  6421. // skip
  6422. ['V', 'TapeVolumeHeader'],
  6423. // like x
  6424. ['X', 'OldExtendedHeader'],
  6425. ])
  6426. // map the other direction
  6427. exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]]))
  6428. /***/ }),
  6429. /***/ 42699:
  6430. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6431. "use strict";
  6432. // the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.
  6433. // but the path reservations are required to avoid race conditions where
  6434. // parallelized unpack ops may mess with one another, due to dependencies
  6435. // (like a Link depending on its target) or destructive operations (like
  6436. // clobbering an fs object to create one of a different type.)
  6437. const assert = __webpack_require__(42357)
  6438. const Parser = __webpack_require__(26824)
  6439. const fs = __webpack_require__(35747)
  6440. const fsm = __webpack_require__(10292)
  6441. const path = __webpack_require__(85622)
  6442. const mkdir = __webpack_require__(53248)
  6443. const wc = __webpack_require__(30619)
  6444. const pathReservations = __webpack_require__(10)
  6445. const stripAbsolutePath = __webpack_require__(2214)
  6446. const normPath = __webpack_require__(22905)
  6447. const stripSlash = __webpack_require__(64922)
  6448. const normalize = __webpack_require__(31946)
  6449. const ONENTRY = Symbol('onEntry')
  6450. const CHECKFS = Symbol('checkFs')
  6451. const CHECKFS2 = Symbol('checkFs2')
  6452. const PRUNECACHE = Symbol('pruneCache')
  6453. const ISREUSABLE = Symbol('isReusable')
  6454. const MAKEFS = Symbol('makeFs')
  6455. const FILE = Symbol('file')
  6456. const DIRECTORY = Symbol('directory')
  6457. const LINK = Symbol('link')
  6458. const SYMLINK = Symbol('symlink')
  6459. const HARDLINK = Symbol('hardlink')
  6460. const UNSUPPORTED = Symbol('unsupported')
  6461. const CHECKPATH = Symbol('checkPath')
  6462. const MKDIR = Symbol('mkdir')
  6463. const ONERROR = Symbol('onError')
  6464. const PENDING = Symbol('pending')
  6465. const PEND = Symbol('pend')
  6466. const UNPEND = Symbol('unpend')
  6467. const ENDED = Symbol('ended')
  6468. const MAYBECLOSE = Symbol('maybeClose')
  6469. const SKIP = Symbol('skip')
  6470. const DOCHOWN = Symbol('doChown')
  6471. const UID = Symbol('uid')
  6472. const GID = Symbol('gid')
  6473. const CHECKED_CWD = Symbol('checkedCwd')
  6474. const crypto = __webpack_require__(76417)
  6475. const getFlag = __webpack_require__(35879)
  6476. const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform
  6477. const isWindows = platform === 'win32'
  6478. // Unlinks on Windows are not atomic.
  6479. //
  6480. // This means that if you have a file entry, followed by another
  6481. // file entry with an identical name, and you cannot re-use the file
  6482. // (because it's a hardlink, or because unlink:true is set, or it's
  6483. // Windows, which does not have useful nlink values), then the unlink
  6484. // will be committed to the disk AFTER the new file has been written
  6485. // over the old one, deleting the new file.
  6486. //
  6487. // To work around this, on Windows systems, we rename the file and then
  6488. // delete the renamed file. It's a sloppy kludge, but frankly, I do not
  6489. // know of a better way to do this, given windows' non-atomic unlink
  6490. // semantics.
  6491. //
  6492. // See: https://github.com/npm/node-tar/issues/183
  6493. /* istanbul ignore next */
  6494. const unlinkFile = (path, cb) => {
  6495. if (!isWindows)
  6496. return fs.unlink(path, cb)
  6497. const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex')
  6498. fs.rename(path, name, er => {
  6499. if (er)
  6500. return cb(er)
  6501. fs.unlink(name, cb)
  6502. })
  6503. }
  6504. /* istanbul ignore next */
  6505. const unlinkFileSync = path => {
  6506. if (!isWindows)
  6507. return fs.unlinkSync(path)
  6508. const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex')
  6509. fs.renameSync(path, name)
  6510. fs.unlinkSync(name)
  6511. }
  6512. // this.gid, entry.gid, this.processUid
  6513. const uint32 = (a, b, c) =>
  6514. a === a >>> 0 ? a
  6515. : b === b >>> 0 ? b
  6516. : c
  6517. // clear the cache if it's a case-insensitive unicode-squashing match.
  6518. // we can't know if the current file system is case-sensitive or supports
  6519. // unicode fully, so we check for similarity on the maximally compatible
  6520. // representation. Err on the side of pruning, since all it's doing is
  6521. // preventing lstats, and it's not the end of the world if we get a false
  6522. // positive.
  6523. // Note that on windows, we always drop the entire cache whenever a
  6524. // symbolic link is encountered, because 8.3 filenames are impossible
  6525. // to reason about, and collisions are hazards rather than just failures.
  6526. const cacheKeyNormalize = path => normalize(stripSlash(normPath(path)))
  6527. .toLowerCase()
  6528. const pruneCache = (cache, abs) => {
  6529. abs = cacheKeyNormalize(abs)
  6530. for (const path of cache.keys()) {
  6531. const pnorm = cacheKeyNormalize(path)
  6532. if (pnorm === abs || pnorm.indexOf(abs + '/') === 0)
  6533. cache.delete(path)
  6534. }
  6535. }
  6536. const dropCache = cache => {
  6537. for (const key of cache.keys())
  6538. cache.delete(key)
  6539. }
  6540. class Unpack extends Parser {
  6541. constructor (opt) {
  6542. if (!opt)
  6543. opt = {}
  6544. opt.ondone = _ => {
  6545. this[ENDED] = true
  6546. this[MAYBECLOSE]()
  6547. }
  6548. super(opt)
  6549. this[CHECKED_CWD] = false
  6550. this.reservations = pathReservations()
  6551. this.transform = typeof opt.transform === 'function' ? opt.transform : null
  6552. this.writable = true
  6553. this.readable = false
  6554. this[PENDING] = 0
  6555. this[ENDED] = false
  6556. this.dirCache = opt.dirCache || new Map()
  6557. if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {
  6558. // need both or neither
  6559. if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number')
  6560. throw new TypeError('cannot set owner without number uid and gid')
  6561. if (opt.preserveOwner) {
  6562. throw new TypeError(
  6563. 'cannot preserve owner in archive and also set owner explicitly')
  6564. }
  6565. this.uid = opt.uid
  6566. this.gid = opt.gid
  6567. this.setOwner = true
  6568. } else {
  6569. this.uid = null
  6570. this.gid = null
  6571. this.setOwner = false
  6572. }
  6573. // default true for root
  6574. if (opt.preserveOwner === undefined && typeof opt.uid !== 'number')
  6575. this.preserveOwner = process.getuid && process.getuid() === 0
  6576. else
  6577. this.preserveOwner = !!opt.preserveOwner
  6578. this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ?
  6579. process.getuid() : null
  6580. this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ?
  6581. process.getgid() : null
  6582. // mostly just for testing, but useful in some cases.
  6583. // Forcibly trigger a chown on every entry, no matter what
  6584. this.forceChown = opt.forceChown === true
  6585. // turn ><?| in filenames into 0xf000-higher encoded forms
  6586. this.win32 = !!opt.win32 || isWindows
  6587. // do not unpack over files that are newer than what's in the archive
  6588. this.newer = !!opt.newer
  6589. // do not unpack over ANY files
  6590. this.keep = !!opt.keep
  6591. // do not set mtime/atime of extracted entries
  6592. this.noMtime = !!opt.noMtime
  6593. // allow .., absolute path entries, and unpacking through symlinks
  6594. // without this, warn and skip .., relativize absolutes, and error
  6595. // on symlinks in extraction path
  6596. this.preservePaths = !!opt.preservePaths
  6597. // unlink files and links before writing. This breaks existing hard
  6598. // links, and removes symlink directories rather than erroring
  6599. this.unlink = !!opt.unlink
  6600. this.cwd = normPath(path.resolve(opt.cwd || process.cwd()))
  6601. this.strip = +opt.strip || 0
  6602. // if we're not chmodding, then we don't need the process umask
  6603. this.processUmask = opt.noChmod ? 0 : process.umask()
  6604. this.umask = typeof opt.umask === 'number' ? opt.umask : this.processUmask
  6605. // default mode for dirs created as parents
  6606. this.dmode = opt.dmode || (0o0777 & (~this.umask))
  6607. this.fmode = opt.fmode || (0o0666 & (~this.umask))
  6608. this.on('entry', entry => this[ONENTRY](entry))
  6609. }
  6610. // a bad or damaged archive is a warning for Parser, but an error
  6611. // when extracting. Mark those errors as unrecoverable, because
  6612. // the Unpack contract cannot be met.
  6613. warn (code, msg, data = {}) {
  6614. if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT')
  6615. data.recoverable = false
  6616. return super.warn(code, msg, data)
  6617. }
  6618. [MAYBECLOSE] () {
  6619. if (this[ENDED] && this[PENDING] === 0) {
  6620. this.emit('prefinish')
  6621. this.emit('finish')
  6622. this.emit('end')
  6623. this.emit('close')
  6624. }
  6625. }
  6626. [CHECKPATH] (entry) {
  6627. if (this.strip) {
  6628. const parts = normPath(entry.path).split('/')
  6629. if (parts.length < this.strip)
  6630. return false
  6631. entry.path = parts.slice(this.strip).join('/')
  6632. if (entry.type === 'Link') {
  6633. const linkparts = normPath(entry.linkpath).split('/')
  6634. if (linkparts.length >= this.strip)
  6635. entry.linkpath = linkparts.slice(this.strip).join('/')
  6636. else
  6637. return false
  6638. }
  6639. }
  6640. if (!this.preservePaths) {
  6641. const p = normPath(entry.path)
  6642. const parts = p.split('/')
  6643. if (parts.includes('..') || isWindows && /^[a-z]:\.\.$/i.test(parts[0])) {
  6644. this.warn('TAR_ENTRY_ERROR', `path contains '..'`, {
  6645. entry,
  6646. path: p,
  6647. })
  6648. return false
  6649. }
  6650. // strip off the root
  6651. const [root, stripped] = stripAbsolutePath(p)
  6652. if (root) {
  6653. entry.path = stripped
  6654. this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, {
  6655. entry,
  6656. path: p,
  6657. })
  6658. }
  6659. }
  6660. if (path.isAbsolute(entry.path))
  6661. entry.absolute = normPath(path.resolve(entry.path))
  6662. else
  6663. entry.absolute = normPath(path.resolve(this.cwd, entry.path))
  6664. // if we somehow ended up with a path that escapes the cwd, and we are
  6665. // not in preservePaths mode, then something is fishy! This should have
  6666. // been prevented above, so ignore this for coverage.
  6667. /* istanbul ignore if - defense in depth */
  6668. if (!this.preservePaths &&
  6669. entry.absolute.indexOf(this.cwd + '/') !== 0 &&
  6670. entry.absolute !== this.cwd) {
  6671. this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {
  6672. entry,
  6673. path: normPath(entry.path),
  6674. resolvedPath: entry.absolute,
  6675. cwd: this.cwd,
  6676. })
  6677. return false
  6678. }
  6679. // an archive can set properties on the extraction directory, but it
  6680. // may not replace the cwd with a different kind of thing entirely.
  6681. if (entry.absolute === this.cwd &&
  6682. entry.type !== 'Directory' &&
  6683. entry.type !== 'GNUDumpDir')
  6684. return false
  6685. // only encode : chars that aren't drive letter indicators
  6686. if (this.win32) {
  6687. const { root: aRoot } = path.win32.parse(entry.absolute)
  6688. entry.absolute = aRoot + wc.encode(entry.absolute.substr(aRoot.length))
  6689. const { root: pRoot } = path.win32.parse(entry.path)
  6690. entry.path = pRoot + wc.encode(entry.path.substr(pRoot.length))
  6691. }
  6692. return true
  6693. }
  6694. [ONENTRY] (entry) {
  6695. if (!this[CHECKPATH](entry))
  6696. return entry.resume()
  6697. assert.equal(typeof entry.absolute, 'string')
  6698. switch (entry.type) {
  6699. case 'Directory':
  6700. case 'GNUDumpDir':
  6701. if (entry.mode)
  6702. entry.mode = entry.mode | 0o700
  6703. case 'File':
  6704. case 'OldFile':
  6705. case 'ContiguousFile':
  6706. case 'Link':
  6707. case 'SymbolicLink':
  6708. return this[CHECKFS](entry)
  6709. case 'CharacterDevice':
  6710. case 'BlockDevice':
  6711. case 'FIFO':
  6712. default:
  6713. return this[UNSUPPORTED](entry)
  6714. }
  6715. }
  6716. [ONERROR] (er, entry) {
  6717. // Cwd has to exist, or else nothing works. That's serious.
  6718. // Other errors are warnings, which raise the error in strict
  6719. // mode, but otherwise continue on.
  6720. if (er.name === 'CwdError')
  6721. this.emit('error', er)
  6722. else {
  6723. this.warn('TAR_ENTRY_ERROR', er, {entry})
  6724. this[UNPEND]()
  6725. entry.resume()
  6726. }
  6727. }
  6728. [MKDIR] (dir, mode, cb) {
  6729. mkdir(normPath(dir), {
  6730. uid: this.uid,
  6731. gid: this.gid,
  6732. processUid: this.processUid,
  6733. processGid: this.processGid,
  6734. umask: this.processUmask,
  6735. preserve: this.preservePaths,
  6736. unlink: this.unlink,
  6737. cache: this.dirCache,
  6738. cwd: this.cwd,
  6739. mode: mode,
  6740. noChmod: this.noChmod,
  6741. }, cb)
  6742. }
  6743. [DOCHOWN] (entry) {
  6744. // in preserve owner mode, chown if the entry doesn't match process
  6745. // in set owner mode, chown if setting doesn't match process
  6746. return this.forceChown ||
  6747. this.preserveOwner &&
  6748. (typeof entry.uid === 'number' && entry.uid !== this.processUid ||
  6749. typeof entry.gid === 'number' && entry.gid !== this.processGid)
  6750. ||
  6751. (typeof this.uid === 'number' && this.uid !== this.processUid ||
  6752. typeof this.gid === 'number' && this.gid !== this.processGid)
  6753. }
  6754. [UID] (entry) {
  6755. return uint32(this.uid, entry.uid, this.processUid)
  6756. }
  6757. [GID] (entry) {
  6758. return uint32(this.gid, entry.gid, this.processGid)
  6759. }
  6760. [FILE] (entry, fullyDone) {
  6761. const mode = entry.mode & 0o7777 || this.fmode
  6762. const stream = new fsm.WriteStream(entry.absolute, {
  6763. flags: getFlag(entry.size),
  6764. mode: mode,
  6765. autoClose: false,
  6766. })
  6767. stream.on('error', er => {
  6768. if (stream.fd)
  6769. fs.close(stream.fd, () => {})
  6770. // flush all the data out so that we aren't left hanging
  6771. // if the error wasn't actually fatal. otherwise the parse
  6772. // is blocked, and we never proceed.
  6773. stream.write = () => true
  6774. this[ONERROR](er, entry)
  6775. fullyDone()
  6776. })
  6777. let actions = 1
  6778. const done = er => {
  6779. if (er) {
  6780. /* istanbul ignore else - we should always have a fd by now */
  6781. if (stream.fd)
  6782. fs.close(stream.fd, () => {})
  6783. this[ONERROR](er, entry)
  6784. fullyDone()
  6785. return
  6786. }
  6787. if (--actions === 0) {
  6788. fs.close(stream.fd, er => {
  6789. if (er)
  6790. this[ONERROR](er, entry)
  6791. else
  6792. this[UNPEND]()
  6793. fullyDone()
  6794. })
  6795. }
  6796. }
  6797. stream.on('finish', _ => {
  6798. // if futimes fails, try utimes
  6799. // if utimes fails, fail with the original error
  6800. // same for fchown/chown
  6801. const abs = entry.absolute
  6802. const fd = stream.fd
  6803. if (entry.mtime && !this.noMtime) {
  6804. actions++
  6805. const atime = entry.atime || new Date()
  6806. const mtime = entry.mtime
  6807. fs.futimes(fd, atime, mtime, er =>
  6808. er ? fs.utimes(abs, atime, mtime, er2 => done(er2 && er))
  6809. : done())
  6810. }
  6811. if (this[DOCHOWN](entry)) {
  6812. actions++
  6813. const uid = this[UID](entry)
  6814. const gid = this[GID](entry)
  6815. fs.fchown(fd, uid, gid, er =>
  6816. er ? fs.chown(abs, uid, gid, er2 => done(er2 && er))
  6817. : done())
  6818. }
  6819. done()
  6820. })
  6821. const tx = this.transform ? this.transform(entry) || entry : entry
  6822. if (tx !== entry) {
  6823. tx.on('error', er => {
  6824. this[ONERROR](er, entry)
  6825. fullyDone()
  6826. })
  6827. entry.pipe(tx)
  6828. }
  6829. tx.pipe(stream)
  6830. }
  6831. [DIRECTORY] (entry, fullyDone) {
  6832. const mode = entry.mode & 0o7777 || this.dmode
  6833. this[MKDIR](entry.absolute, mode, er => {
  6834. if (er) {
  6835. this[ONERROR](er, entry)
  6836. fullyDone()
  6837. return
  6838. }
  6839. let actions = 1
  6840. const done = _ => {
  6841. if (--actions === 0) {
  6842. fullyDone()
  6843. this[UNPEND]()
  6844. entry.resume()
  6845. }
  6846. }
  6847. if (entry.mtime && !this.noMtime) {
  6848. actions++
  6849. fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, done)
  6850. }
  6851. if (this[DOCHOWN](entry)) {
  6852. actions++
  6853. fs.chown(entry.absolute, this[UID](entry), this[GID](entry), done)
  6854. }
  6855. done()
  6856. })
  6857. }
  6858. [UNSUPPORTED] (entry) {
  6859. entry.unsupported = true
  6860. this.warn('TAR_ENTRY_UNSUPPORTED',
  6861. `unsupported entry type: ${entry.type}`, {entry})
  6862. entry.resume()
  6863. }
  6864. [SYMLINK] (entry, done) {
  6865. this[LINK](entry, entry.linkpath, 'symlink', done)
  6866. }
  6867. [HARDLINK] (entry, done) {
  6868. const linkpath = normPath(path.resolve(this.cwd, entry.linkpath))
  6869. this[LINK](entry, linkpath, 'link', done)
  6870. }
  6871. [PEND] () {
  6872. this[PENDING]++
  6873. }
  6874. [UNPEND] () {
  6875. this[PENDING]--
  6876. this[MAYBECLOSE]()
  6877. }
  6878. [SKIP] (entry) {
  6879. this[UNPEND]()
  6880. entry.resume()
  6881. }
  6882. // Check if we can reuse an existing filesystem entry safely and
  6883. // overwrite it, rather than unlinking and recreating
  6884. // Windows doesn't report a useful nlink, so we just never reuse entries
  6885. [ISREUSABLE] (entry, st) {
  6886. return entry.type === 'File' &&
  6887. !this.unlink &&
  6888. st.isFile() &&
  6889. st.nlink <= 1 &&
  6890. !isWindows
  6891. }
  6892. // check if a thing is there, and if so, try to clobber it
  6893. [CHECKFS] (entry) {
  6894. this[PEND]()
  6895. const paths = [entry.path]
  6896. if (entry.linkpath)
  6897. paths.push(entry.linkpath)
  6898. this.reservations.reserve(paths, done => this[CHECKFS2](entry, done))
  6899. }
  6900. [PRUNECACHE] (entry) {
  6901. // if we are not creating a directory, and the path is in the dirCache,
  6902. // then that means we are about to delete the directory we created
  6903. // previously, and it is no longer going to be a directory, and neither
  6904. // is any of its children.
  6905. // If a symbolic link is encountered, all bets are off. There is no
  6906. // reasonable way to sanitize the cache in such a way we will be able to
  6907. // avoid having filesystem collisions. If this happens with a non-symlink
  6908. // entry, it'll just fail to unpack, but a symlink to a directory, using an
  6909. // 8.3 shortname or certain unicode attacks, can evade detection and lead
  6910. // to arbitrary writes to anywhere on the system.
  6911. if (entry.type === 'SymbolicLink')
  6912. dropCache(this.dirCache)
  6913. else if (entry.type !== 'Directory')
  6914. pruneCache(this.dirCache, entry.absolute)
  6915. }
  6916. [CHECKFS2] (entry, fullyDone) {
  6917. this[PRUNECACHE](entry)
  6918. const done = er => {
  6919. this[PRUNECACHE](entry)
  6920. fullyDone(er)
  6921. }
  6922. const checkCwd = () => {
  6923. this[MKDIR](this.cwd, this.dmode, er => {
  6924. if (er) {
  6925. this[ONERROR](er, entry)
  6926. done()
  6927. return
  6928. }
  6929. this[CHECKED_CWD] = true
  6930. start()
  6931. })
  6932. }
  6933. const start = () => {
  6934. if (entry.absolute !== this.cwd) {
  6935. const parent = normPath(path.dirname(entry.absolute))
  6936. if (parent !== this.cwd) {
  6937. return this[MKDIR](parent, this.dmode, er => {
  6938. if (er) {
  6939. this[ONERROR](er, entry)
  6940. done()
  6941. return
  6942. }
  6943. afterMakeParent()
  6944. })
  6945. }
  6946. }
  6947. afterMakeParent()
  6948. }
  6949. const afterMakeParent = () => {
  6950. fs.lstat(entry.absolute, (lstatEr, st) => {
  6951. if (st && (this.keep || this.newer && st.mtime > entry.mtime)) {
  6952. this[SKIP](entry)
  6953. done()
  6954. return
  6955. }
  6956. if (lstatEr || this[ISREUSABLE](entry, st))
  6957. return this[MAKEFS](null, entry, done)
  6958. if (st.isDirectory()) {
  6959. if (entry.type === 'Directory') {
  6960. const needChmod = !this.noChmod &&
  6961. entry.mode &&
  6962. (st.mode & 0o7777) !== entry.mode
  6963. const afterChmod = er => this[MAKEFS](er, entry, done)
  6964. if (!needChmod)
  6965. return afterChmod()
  6966. return fs.chmod(entry.absolute, entry.mode, afterChmod)
  6967. }
  6968. // Not a dir entry, have to remove it.
  6969. // NB: the only way to end up with an entry that is the cwd
  6970. // itself, in such a way that == does not detect, is a
  6971. // tricky windows absolute path with UNC or 8.3 parts (and
  6972. // preservePaths:true, or else it will have been stripped).
  6973. // In that case, the user has opted out of path protections
  6974. // explicitly, so if they blow away the cwd, c'est la vie.
  6975. if (entry.absolute !== this.cwd) {
  6976. return fs.rmdir(entry.absolute, er =>
  6977. this[MAKEFS](er, entry, done))
  6978. }
  6979. }
  6980. // not a dir, and not reusable
  6981. // don't remove if the cwd, we want that error
  6982. if (entry.absolute === this.cwd)
  6983. return this[MAKEFS](null, entry, done)
  6984. unlinkFile(entry.absolute, er =>
  6985. this[MAKEFS](er, entry, done))
  6986. })
  6987. }
  6988. if (this[CHECKED_CWD])
  6989. start()
  6990. else
  6991. checkCwd()
  6992. }
  6993. [MAKEFS] (er, entry, done) {
  6994. if (er) {
  6995. this[ONERROR](er, entry)
  6996. done()
  6997. return
  6998. }
  6999. switch (entry.type) {
  7000. case 'File':
  7001. case 'OldFile':
  7002. case 'ContiguousFile':
  7003. return this[FILE](entry, done)
  7004. case 'Link':
  7005. return this[HARDLINK](entry, done)
  7006. case 'SymbolicLink':
  7007. return this[SYMLINK](entry, done)
  7008. case 'Directory':
  7009. case 'GNUDumpDir':
  7010. return this[DIRECTORY](entry, done)
  7011. }
  7012. }
  7013. [LINK] (entry, linkpath, link, done) {
  7014. // XXX: get the type ('symlink' or 'junction') for windows
  7015. fs[link](linkpath, entry.absolute, er => {
  7016. if (er)
  7017. this[ONERROR](er, entry)
  7018. else {
  7019. this[UNPEND]()
  7020. entry.resume()
  7021. }
  7022. done()
  7023. })
  7024. }
  7025. }
  7026. const callSync = fn => {
  7027. try {
  7028. return [null, fn()]
  7029. } catch (er) {
  7030. return [er, null]
  7031. }
  7032. }
  7033. class UnpackSync extends Unpack {
  7034. [MAKEFS] (er, entry) {
  7035. return super[MAKEFS](er, entry, () => {})
  7036. }
  7037. [CHECKFS] (entry) {
  7038. this[PRUNECACHE](entry)
  7039. if (!this[CHECKED_CWD]) {
  7040. const er = this[MKDIR](this.cwd, this.dmode)
  7041. if (er)
  7042. return this[ONERROR](er, entry)
  7043. this[CHECKED_CWD] = true
  7044. }
  7045. // don't bother to make the parent if the current entry is the cwd,
  7046. // we've already checked it.
  7047. if (entry.absolute !== this.cwd) {
  7048. const parent = normPath(path.dirname(entry.absolute))
  7049. if (parent !== this.cwd) {
  7050. const mkParent = this[MKDIR](parent, this.dmode)
  7051. if (mkParent)
  7052. return this[ONERROR](mkParent, entry)
  7053. }
  7054. }
  7055. const [lstatEr, st] = callSync(() => fs.lstatSync(entry.absolute))
  7056. if (st && (this.keep || this.newer && st.mtime > entry.mtime))
  7057. return this[SKIP](entry)
  7058. if (lstatEr || this[ISREUSABLE](entry, st))
  7059. return this[MAKEFS](null, entry)
  7060. if (st.isDirectory()) {
  7061. if (entry.type === 'Directory') {
  7062. const needChmod = !this.noChmod &&
  7063. entry.mode &&
  7064. (st.mode & 0o7777) !== entry.mode
  7065. const [er] = needChmod ? callSync(() => {
  7066. fs.chmodSync(entry.absolute, entry.mode)
  7067. }) : []
  7068. return this[MAKEFS](er, entry)
  7069. }
  7070. // not a dir entry, have to remove it
  7071. const [er] = callSync(() => fs.rmdirSync(entry.absolute))
  7072. this[MAKEFS](er, entry)
  7073. }
  7074. // not a dir, and not reusable.
  7075. // don't remove if it's the cwd, since we want that error.
  7076. const [er] = entry.absolute === this.cwd ? []
  7077. : callSync(() => unlinkFileSync(entry.absolute))
  7078. this[MAKEFS](er, entry)
  7079. }
  7080. [FILE] (entry, done) {
  7081. const mode = entry.mode & 0o7777 || this.fmode
  7082. const oner = er => {
  7083. let closeError
  7084. try {
  7085. fs.closeSync(fd)
  7086. } catch (e) {
  7087. closeError = e
  7088. }
  7089. if (er || closeError)
  7090. this[ONERROR](er || closeError, entry)
  7091. done()
  7092. }
  7093. let fd
  7094. try {
  7095. fd = fs.openSync(entry.absolute, getFlag(entry.size), mode)
  7096. } catch (er) {
  7097. return oner(er)
  7098. }
  7099. const tx = this.transform ? this.transform(entry) || entry : entry
  7100. if (tx !== entry) {
  7101. tx.on('error', er => this[ONERROR](er, entry))
  7102. entry.pipe(tx)
  7103. }
  7104. tx.on('data', chunk => {
  7105. try {
  7106. fs.writeSync(fd, chunk, 0, chunk.length)
  7107. } catch (er) {
  7108. oner(er)
  7109. }
  7110. })
  7111. tx.on('end', _ => {
  7112. let er = null
  7113. // try both, falling futimes back to utimes
  7114. // if either fails, handle the first error
  7115. if (entry.mtime && !this.noMtime) {
  7116. const atime = entry.atime || new Date()
  7117. const mtime = entry.mtime
  7118. try {
  7119. fs.futimesSync(fd, atime, mtime)
  7120. } catch (futimeser) {
  7121. try {
  7122. fs.utimesSync(entry.absolute, atime, mtime)
  7123. } catch (utimeser) {
  7124. er = futimeser
  7125. }
  7126. }
  7127. }
  7128. if (this[DOCHOWN](entry)) {
  7129. const uid = this[UID](entry)
  7130. const gid = this[GID](entry)
  7131. try {
  7132. fs.fchownSync(fd, uid, gid)
  7133. } catch (fchowner) {
  7134. try {
  7135. fs.chownSync(entry.absolute, uid, gid)
  7136. } catch (chowner) {
  7137. er = er || fchowner
  7138. }
  7139. }
  7140. }
  7141. oner(er)
  7142. })
  7143. }
  7144. [DIRECTORY] (entry, done) {
  7145. const mode = entry.mode & 0o7777 || this.dmode
  7146. const er = this[MKDIR](entry.absolute, mode)
  7147. if (er) {
  7148. this[ONERROR](er, entry)
  7149. done()
  7150. return
  7151. }
  7152. if (entry.mtime && !this.noMtime) {
  7153. try {
  7154. fs.utimesSync(entry.absolute, entry.atime || new Date(), entry.mtime)
  7155. } catch (er) {}
  7156. }
  7157. if (this[DOCHOWN](entry)) {
  7158. try {
  7159. fs.chownSync(entry.absolute, this[UID](entry), this[GID](entry))
  7160. } catch (er) {}
  7161. }
  7162. done()
  7163. entry.resume()
  7164. }
  7165. [MKDIR] (dir, mode) {
  7166. try {
  7167. return mkdir.sync(normPath(dir), {
  7168. uid: this.uid,
  7169. gid: this.gid,
  7170. processUid: this.processUid,
  7171. processGid: this.processGid,
  7172. umask: this.processUmask,
  7173. preserve: this.preservePaths,
  7174. unlink: this.unlink,
  7175. cache: this.dirCache,
  7176. cwd: this.cwd,
  7177. mode: mode,
  7178. })
  7179. } catch (er) {
  7180. return er
  7181. }
  7182. }
  7183. [LINK] (entry, linkpath, link, done) {
  7184. try {
  7185. fs[link + 'Sync'](linkpath, entry.absolute)
  7186. done()
  7187. entry.resume()
  7188. } catch (er) {
  7189. return this[ONERROR](er, entry)
  7190. }
  7191. }
  7192. }
  7193. Unpack.Sync = UnpackSync
  7194. module.exports = Unpack
  7195. /***/ }),
  7196. /***/ 45997:
  7197. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  7198. "use strict";
  7199. // tar -u
  7200. const hlo = __webpack_require__(32093)
  7201. const r = __webpack_require__(71746)
  7202. // just call tar.r with the filter and mtimeCache
  7203. module.exports = (opt_, files, cb) => {
  7204. const opt = hlo(opt_)
  7205. if (!opt.file)
  7206. throw new TypeError('file is required')
  7207. if (opt.gzip)
  7208. throw new TypeError('cannot append to compressed archives')
  7209. if (!files || !Array.isArray(files) || !files.length)
  7210. throw new TypeError('no files or directories specified')
  7211. files = Array.from(files)
  7212. mtimeFilter(opt)
  7213. return r(opt, files, cb)
  7214. }
  7215. const mtimeFilter = opt => {
  7216. const filter = opt.filter
  7217. if (!opt.mtimeCache)
  7218. opt.mtimeCache = new Map()
  7219. opt.filter = filter ? (path, stat) =>
  7220. filter(path, stat) && !(opt.mtimeCache.get(path) > stat.mtime)
  7221. : (path, stat) => !(opt.mtimeCache.get(path) > stat.mtime)
  7222. }
  7223. /***/ }),
  7224. /***/ 7902:
  7225. /***/ ((module) => {
  7226. "use strict";
  7227. module.exports = Base => class extends Base {
  7228. warn (code, message, data = {}) {
  7229. if (this.file)
  7230. data.file = this.file
  7231. if (this.cwd)
  7232. data.cwd = this.cwd
  7233. data.code = message instanceof Error && message.code || code
  7234. data.tarCode = code
  7235. if (!this.strict && data.recoverable !== false) {
  7236. if (message instanceof Error) {
  7237. data = Object.assign(message, data)
  7238. message = message.message
  7239. }
  7240. this.emit('warn', data.tarCode, message, data)
  7241. } else if (message instanceof Error)
  7242. this.emit('error', Object.assign(message, data))
  7243. else
  7244. this.emit('error', Object.assign(new Error(`${code}: ${message}`), data))
  7245. }
  7246. }
  7247. /***/ }),
  7248. /***/ 30619:
  7249. /***/ ((module) => {
  7250. "use strict";
  7251. // When writing files on Windows, translate the characters to their
  7252. // 0xf000 higher-encoded versions.
  7253. const raw = [
  7254. '|',
  7255. '<',
  7256. '>',
  7257. '?',
  7258. ':',
  7259. ]
  7260. const win = raw.map(char =>
  7261. String.fromCharCode(0xf000 + char.charCodeAt(0)))
  7262. const toWin = new Map(raw.map((char, i) => [char, win[i]]))
  7263. const toRaw = new Map(win.map((char, i) => [char, raw[i]]))
  7264. module.exports = {
  7265. encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s),
  7266. decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s),
  7267. }
  7268. /***/ }),
  7269. /***/ 17620:
  7270. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  7271. "use strict";
  7272. const MiniPass = __webpack_require__(74577)
  7273. const Pax = __webpack_require__(64747)
  7274. const Header = __webpack_require__(37134)
  7275. const fs = __webpack_require__(35747)
  7276. const path = __webpack_require__(85622)
  7277. const normPath = __webpack_require__(22905)
  7278. const stripSlash = __webpack_require__(64922)
  7279. const prefixPath = (path, prefix) => {
  7280. if (!prefix)
  7281. return normPath(path)
  7282. path = normPath(path).replace(/^\.(\/|$)/, '')
  7283. return stripSlash(prefix) + '/' + path
  7284. }
  7285. const maxReadSize = 16 * 1024 * 1024
  7286. const PROCESS = Symbol('process')
  7287. const FILE = Symbol('file')
  7288. const DIRECTORY = Symbol('directory')
  7289. const SYMLINK = Symbol('symlink')
  7290. const HARDLINK = Symbol('hardlink')
  7291. const HEADER = Symbol('header')
  7292. const READ = Symbol('read')
  7293. const LSTAT = Symbol('lstat')
  7294. const ONLSTAT = Symbol('onlstat')
  7295. const ONREAD = Symbol('onread')
  7296. const ONREADLINK = Symbol('onreadlink')
  7297. const OPENFILE = Symbol('openfile')
  7298. const ONOPENFILE = Symbol('onopenfile')
  7299. const CLOSE = Symbol('close')
  7300. const MODE = Symbol('mode')
  7301. const AWAITDRAIN = Symbol('awaitDrain')
  7302. const ONDRAIN = Symbol('ondrain')
  7303. const PREFIX = Symbol('prefix')
  7304. const HAD_ERROR = Symbol('hadError')
  7305. const warner = __webpack_require__(7902)
  7306. const winchars = __webpack_require__(30619)
  7307. const stripAbsolutePath = __webpack_require__(2214)
  7308. const modeFix = __webpack_require__(27716)
  7309. const WriteEntry = warner(class WriteEntry extends MiniPass {
  7310. constructor (p, opt) {
  7311. opt = opt || {}
  7312. super(opt)
  7313. if (typeof p !== 'string')
  7314. throw new TypeError('path is required')
  7315. this.path = normPath(p)
  7316. // suppress atime, ctime, uid, gid, uname, gname
  7317. this.portable = !!opt.portable
  7318. // until node has builtin pwnam functions, this'll have to do
  7319. this.myuid = process.getuid && process.getuid() || 0
  7320. this.myuser = process.env.USER || ''
  7321. this.maxReadSize = opt.maxReadSize || maxReadSize
  7322. this.linkCache = opt.linkCache || new Map()
  7323. this.statCache = opt.statCache || new Map()
  7324. this.preservePaths = !!opt.preservePaths
  7325. this.cwd = normPath(opt.cwd || process.cwd())
  7326. this.strict = !!opt.strict
  7327. this.noPax = !!opt.noPax
  7328. this.noMtime = !!opt.noMtime
  7329. this.mtime = opt.mtime || null
  7330. this.prefix = opt.prefix ? normPath(opt.prefix) : null
  7331. this.fd = null
  7332. this.blockLen = null
  7333. this.blockRemain = null
  7334. this.buf = null
  7335. this.offset = null
  7336. this.length = null
  7337. this.pos = null
  7338. this.remain = null
  7339. if (typeof opt.onwarn === 'function')
  7340. this.on('warn', opt.onwarn)
  7341. let pathWarn = false
  7342. if (!this.preservePaths) {
  7343. const [root, stripped] = stripAbsolutePath(this.path)
  7344. if (root) {
  7345. this.path = stripped
  7346. pathWarn = root
  7347. }
  7348. }
  7349. this.win32 = !!opt.win32 || process.platform === 'win32'
  7350. if (this.win32) {
  7351. // force the \ to / normalization, since we might not *actually*
  7352. // be on windows, but want \ to be considered a path separator.
  7353. this.path = winchars.decode(this.path.replace(/\\/g, '/'))
  7354. p = p.replace(/\\/g, '/')
  7355. }
  7356. this.absolute = normPath(opt.absolute || path.resolve(this.cwd, p))
  7357. if (this.path === '')
  7358. this.path = './'
  7359. if (pathWarn) {
  7360. this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
  7361. entry: this,
  7362. path: pathWarn + this.path,
  7363. })
  7364. }
  7365. if (this.statCache.has(this.absolute))
  7366. this[ONLSTAT](this.statCache.get(this.absolute))
  7367. else
  7368. this[LSTAT]()
  7369. }
  7370. emit (ev, ...data) {
  7371. if (ev === 'error')
  7372. this[HAD_ERROR] = true
  7373. return super.emit(ev, ...data)
  7374. }
  7375. [LSTAT] () {
  7376. fs.lstat(this.absolute, (er, stat) => {
  7377. if (er)
  7378. return this.emit('error', er)
  7379. this[ONLSTAT](stat)
  7380. })
  7381. }
  7382. [ONLSTAT] (stat) {
  7383. this.statCache.set(this.absolute, stat)
  7384. this.stat = stat
  7385. if (!stat.isFile())
  7386. stat.size = 0
  7387. this.type = getType(stat)
  7388. this.emit('stat', stat)
  7389. this[PROCESS]()
  7390. }
  7391. [PROCESS] () {
  7392. switch (this.type) {
  7393. case 'File': return this[FILE]()
  7394. case 'Directory': return this[DIRECTORY]()
  7395. case 'SymbolicLink': return this[SYMLINK]()
  7396. // unsupported types are ignored.
  7397. default: return this.end()
  7398. }
  7399. }
  7400. [MODE] (mode) {
  7401. return modeFix(mode, this.type === 'Directory', this.portable)
  7402. }
  7403. [PREFIX] (path) {
  7404. return prefixPath(path, this.prefix)
  7405. }
  7406. [HEADER] () {
  7407. if (this.type === 'Directory' && this.portable)
  7408. this.noMtime = true
  7409. this.header = new Header({
  7410. path: this[PREFIX](this.path),
  7411. // only apply the prefix to hard links.
  7412. linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)
  7413. : this.linkpath,
  7414. // only the permissions and setuid/setgid/sticky bitflags
  7415. // not the higher-order bits that specify file type
  7416. mode: this[MODE](this.stat.mode),
  7417. uid: this.portable ? null : this.stat.uid,
  7418. gid: this.portable ? null : this.stat.gid,
  7419. size: this.stat.size,
  7420. mtime: this.noMtime ? null : this.mtime || this.stat.mtime,
  7421. type: this.type,
  7422. uname: this.portable ? null :
  7423. this.stat.uid === this.myuid ? this.myuser : '',
  7424. atime: this.portable ? null : this.stat.atime,
  7425. ctime: this.portable ? null : this.stat.ctime,
  7426. })
  7427. if (this.header.encode() && !this.noPax) {
  7428. super.write(new Pax({
  7429. atime: this.portable ? null : this.header.atime,
  7430. ctime: this.portable ? null : this.header.ctime,
  7431. gid: this.portable ? null : this.header.gid,
  7432. mtime: this.noMtime ? null : this.mtime || this.header.mtime,
  7433. path: this[PREFIX](this.path),
  7434. linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)
  7435. : this.linkpath,
  7436. size: this.header.size,
  7437. uid: this.portable ? null : this.header.uid,
  7438. uname: this.portable ? null : this.header.uname,
  7439. dev: this.portable ? null : this.stat.dev,
  7440. ino: this.portable ? null : this.stat.ino,
  7441. nlink: this.portable ? null : this.stat.nlink,
  7442. }).encode())
  7443. }
  7444. super.write(this.header.block)
  7445. }
  7446. [DIRECTORY] () {
  7447. if (this.path.substr(-1) !== '/')
  7448. this.path += '/'
  7449. this.stat.size = 0
  7450. this[HEADER]()
  7451. this.end()
  7452. }
  7453. [SYMLINK] () {
  7454. fs.readlink(this.absolute, (er, linkpath) => {
  7455. if (er)
  7456. return this.emit('error', er)
  7457. this[ONREADLINK](linkpath)
  7458. })
  7459. }
  7460. [ONREADLINK] (linkpath) {
  7461. this.linkpath = normPath(linkpath)
  7462. this[HEADER]()
  7463. this.end()
  7464. }
  7465. [HARDLINK] (linkpath) {
  7466. this.type = 'Link'
  7467. this.linkpath = normPath(path.relative(this.cwd, linkpath))
  7468. this.stat.size = 0
  7469. this[HEADER]()
  7470. this.end()
  7471. }
  7472. [FILE] () {
  7473. if (this.stat.nlink > 1) {
  7474. const linkKey = this.stat.dev + ':' + this.stat.ino
  7475. if (this.linkCache.has(linkKey)) {
  7476. const linkpath = this.linkCache.get(linkKey)
  7477. if (linkpath.indexOf(this.cwd) === 0)
  7478. return this[HARDLINK](linkpath)
  7479. }
  7480. this.linkCache.set(linkKey, this.absolute)
  7481. }
  7482. this[HEADER]()
  7483. if (this.stat.size === 0)
  7484. return this.end()
  7485. this[OPENFILE]()
  7486. }
  7487. [OPENFILE] () {
  7488. fs.open(this.absolute, 'r', (er, fd) => {
  7489. if (er)
  7490. return this.emit('error', er)
  7491. this[ONOPENFILE](fd)
  7492. })
  7493. }
  7494. [ONOPENFILE] (fd) {
  7495. this.fd = fd
  7496. if (this[HAD_ERROR])
  7497. return this[CLOSE]()
  7498. this.blockLen = 512 * Math.ceil(this.stat.size / 512)
  7499. this.blockRemain = this.blockLen
  7500. const bufLen = Math.min(this.blockLen, this.maxReadSize)
  7501. this.buf = Buffer.allocUnsafe(bufLen)
  7502. this.offset = 0
  7503. this.pos = 0
  7504. this.remain = this.stat.size
  7505. this.length = this.buf.length
  7506. this[READ]()
  7507. }
  7508. [READ] () {
  7509. const { fd, buf, offset, length, pos } = this
  7510. fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {
  7511. if (er) {
  7512. // ignoring the error from close(2) is a bad practice, but at
  7513. // this point we already have an error, don't need another one
  7514. return this[CLOSE](() => this.emit('error', er))
  7515. }
  7516. this[ONREAD](bytesRead)
  7517. })
  7518. }
  7519. [CLOSE] (cb) {
  7520. fs.close(this.fd, cb)
  7521. }
  7522. [ONREAD] (bytesRead) {
  7523. if (bytesRead <= 0 && this.remain > 0) {
  7524. const er = new Error('encountered unexpected EOF')
  7525. er.path = this.absolute
  7526. er.syscall = 'read'
  7527. er.code = 'EOF'
  7528. return this[CLOSE](() => this.emit('error', er))
  7529. }
  7530. if (bytesRead > this.remain) {
  7531. const er = new Error('did not encounter expected EOF')
  7532. er.path = this.absolute
  7533. er.syscall = 'read'
  7534. er.code = 'EOF'
  7535. return this[CLOSE](() => this.emit('error', er))
  7536. }
  7537. // null out the rest of the buffer, if we could fit the block padding
  7538. // at the end of this loop, we've incremented bytesRead and this.remain
  7539. // to be incremented up to the blockRemain level, as if we had expected
  7540. // to get a null-padded file, and read it until the end. then we will
  7541. // decrement both remain and blockRemain by bytesRead, and know that we
  7542. // reached the expected EOF, without any null buffer to append.
  7543. if (bytesRead === this.remain) {
  7544. for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) {
  7545. this.buf[i + this.offset] = 0
  7546. bytesRead++
  7547. this.remain++
  7548. }
  7549. }
  7550. const writeBuf = this.offset === 0 && bytesRead === this.buf.length ?
  7551. this.buf : this.buf.slice(this.offset, this.offset + bytesRead)
  7552. const flushed = this.write(writeBuf)
  7553. if (!flushed)
  7554. this[AWAITDRAIN](() => this[ONDRAIN]())
  7555. else
  7556. this[ONDRAIN]()
  7557. }
  7558. [AWAITDRAIN] (cb) {
  7559. this.once('drain', cb)
  7560. }
  7561. write (writeBuf) {
  7562. if (this.blockRemain < writeBuf.length) {
  7563. const er = new Error('writing more data than expected')
  7564. er.path = this.absolute
  7565. return this.emit('error', er)
  7566. }
  7567. this.remain -= writeBuf.length
  7568. this.blockRemain -= writeBuf.length
  7569. this.pos += writeBuf.length
  7570. this.offset += writeBuf.length
  7571. return super.write(writeBuf)
  7572. }
  7573. [ONDRAIN] () {
  7574. if (!this.remain) {
  7575. if (this.blockRemain)
  7576. super.write(Buffer.alloc(this.blockRemain))
  7577. return this[CLOSE](er => er ? this.emit('error', er) : this.end())
  7578. }
  7579. if (this.offset >= this.length) {
  7580. // if we only have a smaller bit left to read, alloc a smaller buffer
  7581. // otherwise, keep it the same length it was before.
  7582. this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length))
  7583. this.offset = 0
  7584. }
  7585. this.length = this.buf.length - this.offset
  7586. this[READ]()
  7587. }
  7588. })
  7589. class WriteEntrySync extends WriteEntry {
  7590. [LSTAT] () {
  7591. this[ONLSTAT](fs.lstatSync(this.absolute))
  7592. }
  7593. [SYMLINK] () {
  7594. this[ONREADLINK](fs.readlinkSync(this.absolute))
  7595. }
  7596. [OPENFILE] () {
  7597. this[ONOPENFILE](fs.openSync(this.absolute, 'r'))
  7598. }
  7599. [READ] () {
  7600. let threw = true
  7601. try {
  7602. const { fd, buf, offset, length, pos } = this
  7603. const bytesRead = fs.readSync(fd, buf, offset, length, pos)
  7604. this[ONREAD](bytesRead)
  7605. threw = false
  7606. } finally {
  7607. // ignoring the error from close(2) is a bad practice, but at
  7608. // this point we already have an error, don't need another one
  7609. if (threw) {
  7610. try {
  7611. this[CLOSE](() => {})
  7612. } catch (er) {}
  7613. }
  7614. }
  7615. }
  7616. [AWAITDRAIN] (cb) {
  7617. cb()
  7618. }
  7619. [CLOSE] (cb) {
  7620. fs.closeSync(this.fd)
  7621. cb()
  7622. }
  7623. }
  7624. const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
  7625. constructor (readEntry, opt) {
  7626. opt = opt || {}
  7627. super(opt)
  7628. this.preservePaths = !!opt.preservePaths
  7629. this.portable = !!opt.portable
  7630. this.strict = !!opt.strict
  7631. this.noPax = !!opt.noPax
  7632. this.noMtime = !!opt.noMtime
  7633. this.readEntry = readEntry
  7634. this.type = readEntry.type
  7635. if (this.type === 'Directory' && this.portable)
  7636. this.noMtime = true
  7637. this.prefix = opt.prefix || null
  7638. this.path = normPath(readEntry.path)
  7639. this.mode = this[MODE](readEntry.mode)
  7640. this.uid = this.portable ? null : readEntry.uid
  7641. this.gid = this.portable ? null : readEntry.gid
  7642. this.uname = this.portable ? null : readEntry.uname
  7643. this.gname = this.portable ? null : readEntry.gname
  7644. this.size = readEntry.size
  7645. this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime
  7646. this.atime = this.portable ? null : readEntry.atime
  7647. this.ctime = this.portable ? null : readEntry.ctime
  7648. this.linkpath = normPath(readEntry.linkpath)
  7649. if (typeof opt.onwarn === 'function')
  7650. this.on('warn', opt.onwarn)
  7651. let pathWarn = false
  7652. if (!this.preservePaths) {
  7653. const [root, stripped] = stripAbsolutePath(this.path)
  7654. if (root) {
  7655. this.path = stripped
  7656. pathWarn = root
  7657. }
  7658. }
  7659. this.remain = readEntry.size
  7660. this.blockRemain = readEntry.startBlockSize
  7661. this.header = new Header({
  7662. path: this[PREFIX](this.path),
  7663. linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)
  7664. : this.linkpath,
  7665. // only the permissions and setuid/setgid/sticky bitflags
  7666. // not the higher-order bits that specify file type
  7667. mode: this.mode,
  7668. uid: this.portable ? null : this.uid,
  7669. gid: this.portable ? null : this.gid,
  7670. size: this.size,
  7671. mtime: this.noMtime ? null : this.mtime,
  7672. type: this.type,
  7673. uname: this.portable ? null : this.uname,
  7674. atime: this.portable ? null : this.atime,
  7675. ctime: this.portable ? null : this.ctime,
  7676. })
  7677. if (pathWarn) {
  7678. this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
  7679. entry: this,
  7680. path: pathWarn + this.path,
  7681. })
  7682. }
  7683. if (this.header.encode() && !this.noPax) {
  7684. super.write(new Pax({
  7685. atime: this.portable ? null : this.atime,
  7686. ctime: this.portable ? null : this.ctime,
  7687. gid: this.portable ? null : this.gid,
  7688. mtime: this.noMtime ? null : this.mtime,
  7689. path: this[PREFIX](this.path),
  7690. linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)
  7691. : this.linkpath,
  7692. size: this.size,
  7693. uid: this.portable ? null : this.uid,
  7694. uname: this.portable ? null : this.uname,
  7695. dev: this.portable ? null : this.readEntry.dev,
  7696. ino: this.portable ? null : this.readEntry.ino,
  7697. nlink: this.portable ? null : this.readEntry.nlink,
  7698. }).encode())
  7699. }
  7700. super.write(this.header.block)
  7701. readEntry.pipe(this)
  7702. }
  7703. [PREFIX] (path) {
  7704. return prefixPath(path, this.prefix)
  7705. }
  7706. [MODE] (mode) {
  7707. return modeFix(mode, this.type === 'Directory', this.portable)
  7708. }
  7709. write (data) {
  7710. const writeLen = data.length
  7711. if (writeLen > this.blockRemain)
  7712. throw new Error('writing more to entry than is appropriate')
  7713. this.blockRemain -= writeLen
  7714. return super.write(data)
  7715. }
  7716. end () {
  7717. if (this.blockRemain)
  7718. super.write(Buffer.alloc(this.blockRemain))
  7719. return super.end()
  7720. }
  7721. })
  7722. WriteEntry.Sync = WriteEntrySync
  7723. WriteEntry.Tar = WriteEntryTar
  7724. const getType = stat =>
  7725. stat.isFile() ? 'File'
  7726. : stat.isDirectory() ? 'Directory'
  7727. : stat.isSymbolicLink() ? 'SymbolicLink'
  7728. : 'Unsupported'
  7729. module.exports = WriteEntry
  7730. /***/ }),
  7731. /***/ 85608:
  7732. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  7733. "use strict";
  7734. const fs = __webpack_require__(35747)
  7735. const path = __webpack_require__(85622)
  7736. /* istanbul ignore next */
  7737. const LCHOWN = fs.lchown ? 'lchown' : 'chown'
  7738. /* istanbul ignore next */
  7739. const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync'
  7740. /* istanbul ignore next */
  7741. const needEISDIRHandled = fs.lchown &&
  7742. !process.version.match(/v1[1-9]+\./) &&
  7743. !process.version.match(/v10\.[6-9]/)
  7744. const lchownSync = (path, uid, gid) => {
  7745. try {
  7746. return fs[LCHOWNSYNC](path, uid, gid)
  7747. } catch (er) {
  7748. if (er.code !== 'ENOENT')
  7749. throw er
  7750. }
  7751. }
  7752. /* istanbul ignore next */
  7753. const chownSync = (path, uid, gid) => {
  7754. try {
  7755. return fs.chownSync(path, uid, gid)
  7756. } catch (er) {
  7757. if (er.code !== 'ENOENT')
  7758. throw er
  7759. }
  7760. }
  7761. /* istanbul ignore next */
  7762. const handleEISDIR =
  7763. needEISDIRHandled ? (path, uid, gid, cb) => er => {
  7764. // Node prior to v10 had a very questionable implementation of
  7765. // fs.lchown, which would always try to call fs.open on a directory
  7766. // Fall back to fs.chown in those cases.
  7767. if (!er || er.code !== 'EISDIR')
  7768. cb(er)
  7769. else
  7770. fs.chown(path, uid, gid, cb)
  7771. }
  7772. : (_, __, ___, cb) => cb
  7773. /* istanbul ignore next */
  7774. const handleEISDirSync =
  7775. needEISDIRHandled ? (path, uid, gid) => {
  7776. try {
  7777. return lchownSync(path, uid, gid)
  7778. } catch (er) {
  7779. if (er.code !== 'EISDIR')
  7780. throw er
  7781. chownSync(path, uid, gid)
  7782. }
  7783. }
  7784. : (path, uid, gid) => lchownSync(path, uid, gid)
  7785. // fs.readdir could only accept an options object as of node v6
  7786. const nodeVersion = process.version
  7787. let readdir = (path, options, cb) => fs.readdir(path, options, cb)
  7788. let readdirSync = (path, options) => fs.readdirSync(path, options)
  7789. /* istanbul ignore next */
  7790. if (/^v4\./.test(nodeVersion))
  7791. readdir = (path, options, cb) => fs.readdir(path, cb)
  7792. const chown = (cpath, uid, gid, cb) => {
  7793. fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, er => {
  7794. // Skip ENOENT error
  7795. cb(er && er.code !== 'ENOENT' ? er : null)
  7796. }))
  7797. }
  7798. const chownrKid = (p, child, uid, gid, cb) => {
  7799. if (typeof child === 'string')
  7800. return fs.lstat(path.resolve(p, child), (er, stats) => {
  7801. // Skip ENOENT error
  7802. if (er)
  7803. return cb(er.code !== 'ENOENT' ? er : null)
  7804. stats.name = child
  7805. chownrKid(p, stats, uid, gid, cb)
  7806. })
  7807. if (child.isDirectory()) {
  7808. chownr(path.resolve(p, child.name), uid, gid, er => {
  7809. if (er)
  7810. return cb(er)
  7811. const cpath = path.resolve(p, child.name)
  7812. chown(cpath, uid, gid, cb)
  7813. })
  7814. } else {
  7815. const cpath = path.resolve(p, child.name)
  7816. chown(cpath, uid, gid, cb)
  7817. }
  7818. }
  7819. const chownr = (p, uid, gid, cb) => {
  7820. readdir(p, { withFileTypes: true }, (er, children) => {
  7821. // any error other than ENOTDIR or ENOTSUP means it's not readable,
  7822. // or doesn't exist. give up.
  7823. if (er) {
  7824. if (er.code === 'ENOENT')
  7825. return cb()
  7826. else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
  7827. return cb(er)
  7828. }
  7829. if (er || !children.length)
  7830. return chown(p, uid, gid, cb)
  7831. let len = children.length
  7832. let errState = null
  7833. const then = er => {
  7834. if (errState)
  7835. return
  7836. if (er)
  7837. return cb(errState = er)
  7838. if (-- len === 0)
  7839. return chown(p, uid, gid, cb)
  7840. }
  7841. children.forEach(child => chownrKid(p, child, uid, gid, then))
  7842. })
  7843. }
  7844. const chownrKidSync = (p, child, uid, gid) => {
  7845. if (typeof child === 'string') {
  7846. try {
  7847. const stats = fs.lstatSync(path.resolve(p, child))
  7848. stats.name = child
  7849. child = stats
  7850. } catch (er) {
  7851. if (er.code === 'ENOENT')
  7852. return
  7853. else
  7854. throw er
  7855. }
  7856. }
  7857. if (child.isDirectory())
  7858. chownrSync(path.resolve(p, child.name), uid, gid)
  7859. handleEISDirSync(path.resolve(p, child.name), uid, gid)
  7860. }
  7861. const chownrSync = (p, uid, gid) => {
  7862. let children
  7863. try {
  7864. children = readdirSync(p, { withFileTypes: true })
  7865. } catch (er) {
  7866. if (er.code === 'ENOENT')
  7867. return
  7868. else if (er.code === 'ENOTDIR' || er.code === 'ENOTSUP')
  7869. return handleEISDirSync(p, uid, gid)
  7870. else
  7871. throw er
  7872. }
  7873. if (children && children.length)
  7874. children.forEach(child => chownrKidSync(p, child, uid, gid))
  7875. return handleEISDirSync(p, uid, gid)
  7876. }
  7877. module.exports = chownr
  7878. chownr.sync = chownrSync
  7879. /***/ }),
  7880. /***/ 74577:
  7881. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  7882. "use strict";
  7883. const EE = __webpack_require__(28614)
  7884. const Stream = __webpack_require__(92413)
  7885. const Yallist = __webpack_require__(51234)
  7886. const SD = __webpack_require__(24304).StringDecoder
  7887. const EOF = Symbol('EOF')
  7888. const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
  7889. const EMITTED_END = Symbol('emittedEnd')
  7890. const EMITTING_END = Symbol('emittingEnd')
  7891. const CLOSED = Symbol('closed')
  7892. const READ = Symbol('read')
  7893. const FLUSH = Symbol('flush')
  7894. const FLUSHCHUNK = Symbol('flushChunk')
  7895. const ENCODING = Symbol('encoding')
  7896. const DECODER = Symbol('decoder')
  7897. const FLOWING = Symbol('flowing')
  7898. const PAUSED = Symbol('paused')
  7899. const RESUME = Symbol('resume')
  7900. const BUFFERLENGTH = Symbol('bufferLength')
  7901. const BUFFERPUSH = Symbol('bufferPush')
  7902. const BUFFERSHIFT = Symbol('bufferShift')
  7903. const OBJECTMODE = Symbol('objectMode')
  7904. const DESTROYED = Symbol('destroyed')
  7905. // TODO remove when Node v8 support drops
  7906. const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
  7907. const ASYNCITERATOR = doIter && Symbol.asyncIterator
  7908. || Symbol('asyncIterator not implemented')
  7909. const ITERATOR = doIter && Symbol.iterator
  7910. || Symbol('iterator not implemented')
  7911. // events that mean 'the stream is over'
  7912. // these are treated specially, and re-emitted
  7913. // if they are listened for after emitting.
  7914. const isEndish = ev =>
  7915. ev === 'end' ||
  7916. ev === 'finish' ||
  7917. ev === 'prefinish'
  7918. const isArrayBuffer = b => b instanceof ArrayBuffer ||
  7919. typeof b === 'object' &&
  7920. b.constructor &&
  7921. b.constructor.name === 'ArrayBuffer' &&
  7922. b.byteLength >= 0
  7923. const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
  7924. module.exports = class Minipass extends Stream {
  7925. constructor (options) {
  7926. super()
  7927. this[FLOWING] = false
  7928. // whether we're explicitly paused
  7929. this[PAUSED] = false
  7930. this.pipes = new Yallist()
  7931. this.buffer = new Yallist()
  7932. this[OBJECTMODE] = options && options.objectMode || false
  7933. if (this[OBJECTMODE])
  7934. this[ENCODING] = null
  7935. else
  7936. this[ENCODING] = options && options.encoding || null
  7937. if (this[ENCODING] === 'buffer')
  7938. this[ENCODING] = null
  7939. this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
  7940. this[EOF] = false
  7941. this[EMITTED_END] = false
  7942. this[EMITTING_END] = false
  7943. this[CLOSED] = false
  7944. this.writable = true
  7945. this.readable = true
  7946. this[BUFFERLENGTH] = 0
  7947. this[DESTROYED] = false
  7948. }
  7949. get bufferLength () { return this[BUFFERLENGTH] }
  7950. get encoding () { return this[ENCODING] }
  7951. set encoding (enc) {
  7952. if (this[OBJECTMODE])
  7953. throw new Error('cannot set encoding in objectMode')
  7954. if (this[ENCODING] && enc !== this[ENCODING] &&
  7955. (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH]))
  7956. throw new Error('cannot change encoding')
  7957. if (this[ENCODING] !== enc) {
  7958. this[DECODER] = enc ? new SD(enc) : null
  7959. if (this.buffer.length)
  7960. this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk))
  7961. }
  7962. this[ENCODING] = enc
  7963. }
  7964. setEncoding (enc) {
  7965. this.encoding = enc
  7966. }
  7967. get objectMode () { return this[OBJECTMODE] }
  7968. set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om }
  7969. write (chunk, encoding, cb) {
  7970. if (this[EOF])
  7971. throw new Error('write after end')
  7972. if (this[DESTROYED]) {
  7973. this.emit('error', Object.assign(
  7974. new Error('Cannot call write after a stream was destroyed'),
  7975. { code: 'ERR_STREAM_DESTROYED' }
  7976. ))
  7977. return true
  7978. }
  7979. if (typeof encoding === 'function')
  7980. cb = encoding, encoding = 'utf8'
  7981. if (!encoding)
  7982. encoding = 'utf8'
  7983. // convert array buffers and typed array views into buffers
  7984. // at some point in the future, we may want to do the opposite!
  7985. // leave strings and buffers as-is
  7986. // anything else switches us into object mode
  7987. if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
  7988. if (isArrayBufferView(chunk))
  7989. chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
  7990. else if (isArrayBuffer(chunk))
  7991. chunk = Buffer.from(chunk)
  7992. else if (typeof chunk !== 'string')
  7993. // use the setter so we throw if we have encoding set
  7994. this.objectMode = true
  7995. }
  7996. // this ensures at this point that the chunk is a buffer or string
  7997. // don't buffer it up or send it to the decoder
  7998. if (!this.objectMode && !chunk.length) {
  7999. if (this[BUFFERLENGTH] !== 0)
  8000. this.emit('readable')
  8001. if (cb)
  8002. cb()
  8003. return this.flowing
  8004. }
  8005. // fast-path writing strings of same encoding to a stream with
  8006. // an empty buffer, skipping the buffer/decoder dance
  8007. if (typeof chunk === 'string' && !this[OBJECTMODE] &&
  8008. // unless it is a string already ready for us to use
  8009. !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) {
  8010. chunk = Buffer.from(chunk, encoding)
  8011. }
  8012. if (Buffer.isBuffer(chunk) && this[ENCODING])
  8013. chunk = this[DECODER].write(chunk)
  8014. if (this.flowing) {
  8015. // if we somehow have something in the buffer, but we think we're
  8016. // flowing, then we need to flush all that out first, or we get
  8017. // chunks coming in out of order. Can't emit 'drain' here though,
  8018. // because we're mid-write, so that'd be bad.
  8019. if (this[BUFFERLENGTH] !== 0)
  8020. this[FLUSH](true)
  8021. this.emit('data', chunk)
  8022. } else
  8023. this[BUFFERPUSH](chunk)
  8024. if (this[BUFFERLENGTH] !== 0)
  8025. this.emit('readable')
  8026. if (cb)
  8027. cb()
  8028. return this.flowing
  8029. }
  8030. read (n) {
  8031. if (this[DESTROYED])
  8032. return null
  8033. try {
  8034. if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH])
  8035. return null
  8036. if (this[OBJECTMODE])
  8037. n = null
  8038. if (this.buffer.length > 1 && !this[OBJECTMODE]) {
  8039. if (this.encoding)
  8040. this.buffer = new Yallist([
  8041. Array.from(this.buffer).join('')
  8042. ])
  8043. else
  8044. this.buffer = new Yallist([
  8045. Buffer.concat(Array.from(this.buffer), this[BUFFERLENGTH])
  8046. ])
  8047. }
  8048. return this[READ](n || null, this.buffer.head.value)
  8049. } finally {
  8050. this[MAYBE_EMIT_END]()
  8051. }
  8052. }
  8053. [READ] (n, chunk) {
  8054. if (n === chunk.length || n === null)
  8055. this[BUFFERSHIFT]()
  8056. else {
  8057. this.buffer.head.value = chunk.slice(n)
  8058. chunk = chunk.slice(0, n)
  8059. this[BUFFERLENGTH] -= n
  8060. }
  8061. this.emit('data', chunk)
  8062. if (!this.buffer.length && !this[EOF])
  8063. this.emit('drain')
  8064. return chunk
  8065. }
  8066. end (chunk, encoding, cb) {
  8067. if (typeof chunk === 'function')
  8068. cb = chunk, chunk = null
  8069. if (typeof encoding === 'function')
  8070. cb = encoding, encoding = 'utf8'
  8071. if (chunk)
  8072. this.write(chunk, encoding)
  8073. if (cb)
  8074. this.once('end', cb)
  8075. this[EOF] = true
  8076. this.writable = false
  8077. // if we haven't written anything, then go ahead and emit,
  8078. // even if we're not reading.
  8079. // we'll re-emit if a new 'end' listener is added anyway.
  8080. // This makes MP more suitable to write-only use cases.
  8081. if (this.flowing || !this[PAUSED])
  8082. this[MAYBE_EMIT_END]()
  8083. return this
  8084. }
  8085. // don't let the internal resume be overwritten
  8086. [RESUME] () {
  8087. if (this[DESTROYED])
  8088. return
  8089. this[PAUSED] = false
  8090. this[FLOWING] = true
  8091. this.emit('resume')
  8092. if (this.buffer.length)
  8093. this[FLUSH]()
  8094. else if (this[EOF])
  8095. this[MAYBE_EMIT_END]()
  8096. else
  8097. this.emit('drain')
  8098. }
  8099. resume () {
  8100. return this[RESUME]()
  8101. }
  8102. pause () {
  8103. this[FLOWING] = false
  8104. this[PAUSED] = true
  8105. }
  8106. get destroyed () {
  8107. return this[DESTROYED]
  8108. }
  8109. get flowing () {
  8110. return this[FLOWING]
  8111. }
  8112. get paused () {
  8113. return this[PAUSED]
  8114. }
  8115. [BUFFERPUSH] (chunk) {
  8116. if (this[OBJECTMODE])
  8117. this[BUFFERLENGTH] += 1
  8118. else
  8119. this[BUFFERLENGTH] += chunk.length
  8120. return this.buffer.push(chunk)
  8121. }
  8122. [BUFFERSHIFT] () {
  8123. if (this.buffer.length) {
  8124. if (this[OBJECTMODE])
  8125. this[BUFFERLENGTH] -= 1
  8126. else
  8127. this[BUFFERLENGTH] -= this.buffer.head.value.length
  8128. }
  8129. return this.buffer.shift()
  8130. }
  8131. [FLUSH] (noDrain) {
  8132. do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()))
  8133. if (!noDrain && !this.buffer.length && !this[EOF])
  8134. this.emit('drain')
  8135. }
  8136. [FLUSHCHUNK] (chunk) {
  8137. return chunk ? (this.emit('data', chunk), this.flowing) : false
  8138. }
  8139. pipe (dest, opts) {
  8140. if (this[DESTROYED])
  8141. return
  8142. const ended = this[EMITTED_END]
  8143. opts = opts || {}
  8144. if (dest === process.stdout || dest === process.stderr)
  8145. opts.end = false
  8146. else
  8147. opts.end = opts.end !== false
  8148. const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() }
  8149. this.pipes.push(p)
  8150. dest.on('drain', p.ondrain)
  8151. this[RESUME]()
  8152. // piping an ended stream ends immediately
  8153. if (ended && p.opts.end)
  8154. p.dest.end()
  8155. return dest
  8156. }
  8157. addListener (ev, fn) {
  8158. return this.on(ev, fn)
  8159. }
  8160. on (ev, fn) {
  8161. try {
  8162. return super.on(ev, fn)
  8163. } finally {
  8164. if (ev === 'data' && !this.pipes.length && !this.flowing)
  8165. this[RESUME]()
  8166. else if (isEndish(ev) && this[EMITTED_END]) {
  8167. super.emit(ev)
  8168. this.removeAllListeners(ev)
  8169. }
  8170. }
  8171. }
  8172. get emittedEnd () {
  8173. return this[EMITTED_END]
  8174. }
  8175. [MAYBE_EMIT_END] () {
  8176. if (!this[EMITTING_END] &&
  8177. !this[EMITTED_END] &&
  8178. !this[DESTROYED] &&
  8179. this.buffer.length === 0 &&
  8180. this[EOF]) {
  8181. this[EMITTING_END] = true
  8182. this.emit('end')
  8183. this.emit('prefinish')
  8184. this.emit('finish')
  8185. if (this[CLOSED])
  8186. this.emit('close')
  8187. this[EMITTING_END] = false
  8188. }
  8189. }
  8190. emit (ev, data) {
  8191. // error and close are only events allowed after calling destroy()
  8192. if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
  8193. return
  8194. else if (ev === 'data') {
  8195. if (!data)
  8196. return
  8197. if (this.pipes.length)
  8198. this.pipes.forEach(p =>
  8199. p.dest.write(data) === false && this.pause())
  8200. } else if (ev === 'end') {
  8201. // only actual end gets this treatment
  8202. if (this[EMITTED_END] === true)
  8203. return
  8204. this[EMITTED_END] = true
  8205. this.readable = false
  8206. if (this[DECODER]) {
  8207. data = this[DECODER].end()
  8208. if (data) {
  8209. this.pipes.forEach(p => p.dest.write(data))
  8210. super.emit('data', data)
  8211. }
  8212. }
  8213. this.pipes.forEach(p => {
  8214. p.dest.removeListener('drain', p.ondrain)
  8215. if (p.opts.end)
  8216. p.dest.end()
  8217. })
  8218. } else if (ev === 'close') {
  8219. this[CLOSED] = true
  8220. // don't emit close before 'end' and 'finish'
  8221. if (!this[EMITTED_END] && !this[DESTROYED])
  8222. return
  8223. }
  8224. // TODO: replace with a spread operator when Node v4 support drops
  8225. const args = new Array(arguments.length)
  8226. args[0] = ev
  8227. args[1] = data
  8228. if (arguments.length > 2) {
  8229. for (let i = 2; i < arguments.length; i++) {
  8230. args[i] = arguments[i]
  8231. }
  8232. }
  8233. try {
  8234. return super.emit.apply(this, args)
  8235. } finally {
  8236. if (!isEndish(ev))
  8237. this[MAYBE_EMIT_END]()
  8238. else
  8239. this.removeAllListeners(ev)
  8240. }
  8241. }
  8242. // const all = await stream.collect()
  8243. collect () {
  8244. const buf = []
  8245. if (!this[OBJECTMODE])
  8246. buf.dataLength = 0
  8247. // set the promise first, in case an error is raised
  8248. // by triggering the flow here.
  8249. const p = this.promise()
  8250. this.on('data', c => {
  8251. buf.push(c)
  8252. if (!this[OBJECTMODE])
  8253. buf.dataLength += c.length
  8254. })
  8255. return p.then(() => buf)
  8256. }
  8257. // const data = await stream.concat()
  8258. concat () {
  8259. return this[OBJECTMODE]
  8260. ? Promise.reject(new Error('cannot concat in objectMode'))
  8261. : this.collect().then(buf =>
  8262. this[OBJECTMODE]
  8263. ? Promise.reject(new Error('cannot concat in objectMode'))
  8264. : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength))
  8265. }
  8266. // stream.promise().then(() => done, er => emitted error)
  8267. promise () {
  8268. return new Promise((resolve, reject) => {
  8269. this.on(DESTROYED, () => reject(new Error('stream destroyed')))
  8270. this.on('end', () => resolve())
  8271. this.on('error', er => reject(er))
  8272. })
  8273. }
  8274. // for await (let chunk of stream)
  8275. [ASYNCITERATOR] () {
  8276. const next = () => {
  8277. const res = this.read()
  8278. if (res !== null)
  8279. return Promise.resolve({ done: false, value: res })
  8280. if (this[EOF])
  8281. return Promise.resolve({ done: true })
  8282. let resolve = null
  8283. let reject = null
  8284. const onerr = er => {
  8285. this.removeListener('data', ondata)
  8286. this.removeListener('end', onend)
  8287. reject(er)
  8288. }
  8289. const ondata = value => {
  8290. this.removeListener('error', onerr)
  8291. this.removeListener('end', onend)
  8292. this.pause()
  8293. resolve({ value: value, done: !!this[EOF] })
  8294. }
  8295. const onend = () => {
  8296. this.removeListener('error', onerr)
  8297. this.removeListener('data', ondata)
  8298. resolve({ done: true })
  8299. }
  8300. const ondestroy = () => onerr(new Error('stream destroyed'))
  8301. return new Promise((res, rej) => {
  8302. reject = rej
  8303. resolve = res
  8304. this.once(DESTROYED, ondestroy)
  8305. this.once('error', onerr)
  8306. this.once('end', onend)
  8307. this.once('data', ondata)
  8308. })
  8309. }
  8310. return { next }
  8311. }
  8312. // for (let chunk of stream)
  8313. [ITERATOR] () {
  8314. const next = () => {
  8315. const value = this.read()
  8316. const done = value === null
  8317. return { value, done }
  8318. }
  8319. return { next }
  8320. }
  8321. destroy (er) {
  8322. if (this[DESTROYED]) {
  8323. if (er)
  8324. this.emit('error', er)
  8325. else
  8326. this.emit(DESTROYED)
  8327. return this
  8328. }
  8329. this[DESTROYED] = true
  8330. // throw away all buffered data, it's never coming out
  8331. this.buffer = new Yallist()
  8332. this[BUFFERLENGTH] = 0
  8333. if (typeof this.close === 'function' && !this[CLOSED])
  8334. this.close()
  8335. if (er)
  8336. this.emit('error', er)
  8337. else // if no error to emit, still reject pending promises
  8338. this.emit(DESTROYED)
  8339. return this
  8340. }
  8341. static isStream (s) {
  8342. return !!s && (s instanceof Minipass || s instanceof Stream ||
  8343. s instanceof EE && (
  8344. typeof s.pipe === 'function' || // readable
  8345. (typeof s.write === 'function' && typeof s.end === 'function') // writable
  8346. ))
  8347. }
  8348. }
  8349. /***/ }),
  8350. /***/ 76318:
  8351. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8352. const optsArg = __webpack_require__(2736)
  8353. const pathArg = __webpack_require__(7543)
  8354. const {mkdirpNative, mkdirpNativeSync} = __webpack_require__(15612)
  8355. const {mkdirpManual, mkdirpManualSync} = __webpack_require__(1175)
  8356. const {useNative, useNativeSync} = __webpack_require__(52589)
  8357. const mkdirp = (path, opts) => {
  8358. path = pathArg(path)
  8359. opts = optsArg(opts)
  8360. return useNative(opts)
  8361. ? mkdirpNative(path, opts)
  8362. : mkdirpManual(path, opts)
  8363. }
  8364. const mkdirpSync = (path, opts) => {
  8365. path = pathArg(path)
  8366. opts = optsArg(opts)
  8367. return useNativeSync(opts)
  8368. ? mkdirpNativeSync(path, opts)
  8369. : mkdirpManualSync(path, opts)
  8370. }
  8371. mkdirp.sync = mkdirpSync
  8372. mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts))
  8373. mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts))
  8374. mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts))
  8375. mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts))
  8376. module.exports = mkdirp
  8377. /***/ }),
  8378. /***/ 31139:
  8379. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8380. const {dirname} = __webpack_require__(85622)
  8381. const findMade = (opts, parent, path = undefined) => {
  8382. // we never want the 'made' return value to be a root directory
  8383. if (path === parent)
  8384. return Promise.resolve()
  8385. return opts.statAsync(parent).then(
  8386. st => st.isDirectory() ? path : undefined, // will fail later
  8387. er => er.code === 'ENOENT'
  8388. ? findMade(opts, dirname(parent), parent)
  8389. : undefined
  8390. )
  8391. }
  8392. const findMadeSync = (opts, parent, path = undefined) => {
  8393. if (path === parent)
  8394. return undefined
  8395. try {
  8396. return opts.statSync(parent).isDirectory() ? path : undefined
  8397. } catch (er) {
  8398. return er.code === 'ENOENT'
  8399. ? findMadeSync(opts, dirname(parent), parent)
  8400. : undefined
  8401. }
  8402. }
  8403. module.exports = {findMade, findMadeSync}
  8404. /***/ }),
  8405. /***/ 1175:
  8406. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8407. const {dirname} = __webpack_require__(85622)
  8408. const mkdirpManual = (path, opts, made) => {
  8409. opts.recursive = false
  8410. const parent = dirname(path)
  8411. if (parent === path) {
  8412. return opts.mkdirAsync(path, opts).catch(er => {
  8413. // swallowed by recursive implementation on posix systems
  8414. // any other error is a failure
  8415. if (er.code !== 'EISDIR')
  8416. throw er
  8417. })
  8418. }
  8419. return opts.mkdirAsync(path, opts).then(() => made || path, er => {
  8420. if (er.code === 'ENOENT')
  8421. return mkdirpManual(parent, opts)
  8422. .then(made => mkdirpManual(path, opts, made))
  8423. if (er.code !== 'EEXIST' && er.code !== 'EROFS')
  8424. throw er
  8425. return opts.statAsync(path).then(st => {
  8426. if (st.isDirectory())
  8427. return made
  8428. else
  8429. throw er
  8430. }, () => { throw er })
  8431. })
  8432. }
  8433. const mkdirpManualSync = (path, opts, made) => {
  8434. const parent = dirname(path)
  8435. opts.recursive = false
  8436. if (parent === path) {
  8437. try {
  8438. return opts.mkdirSync(path, opts)
  8439. } catch (er) {
  8440. // swallowed by recursive implementation on posix systems
  8441. // any other error is a failure
  8442. if (er.code !== 'EISDIR')
  8443. throw er
  8444. else
  8445. return
  8446. }
  8447. }
  8448. try {
  8449. opts.mkdirSync(path, opts)
  8450. return made || path
  8451. } catch (er) {
  8452. if (er.code === 'ENOENT')
  8453. return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))
  8454. if (er.code !== 'EEXIST' && er.code !== 'EROFS')
  8455. throw er
  8456. try {
  8457. if (!opts.statSync(path).isDirectory())
  8458. throw er
  8459. } catch (_) {
  8460. throw er
  8461. }
  8462. }
  8463. }
  8464. module.exports = {mkdirpManual, mkdirpManualSync}
  8465. /***/ }),
  8466. /***/ 15612:
  8467. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8468. const {dirname} = __webpack_require__(85622)
  8469. const {findMade, findMadeSync} = __webpack_require__(31139)
  8470. const {mkdirpManual, mkdirpManualSync} = __webpack_require__(1175)
  8471. const mkdirpNative = (path, opts) => {
  8472. opts.recursive = true
  8473. const parent = dirname(path)
  8474. if (parent === path)
  8475. return opts.mkdirAsync(path, opts)
  8476. return findMade(opts, path).then(made =>
  8477. opts.mkdirAsync(path, opts).then(() => made)
  8478. .catch(er => {
  8479. if (er.code === 'ENOENT')
  8480. return mkdirpManual(path, opts)
  8481. else
  8482. throw er
  8483. }))
  8484. }
  8485. const mkdirpNativeSync = (path, opts) => {
  8486. opts.recursive = true
  8487. const parent = dirname(path)
  8488. if (parent === path)
  8489. return opts.mkdirSync(path, opts)
  8490. const made = findMadeSync(opts, path)
  8491. try {
  8492. opts.mkdirSync(path, opts)
  8493. return made
  8494. } catch (er) {
  8495. if (er.code === 'ENOENT')
  8496. return mkdirpManualSync(path, opts)
  8497. else
  8498. throw er
  8499. }
  8500. }
  8501. module.exports = {mkdirpNative, mkdirpNativeSync}
  8502. /***/ }),
  8503. /***/ 2736:
  8504. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8505. const { promisify } = __webpack_require__(31669)
  8506. const fs = __webpack_require__(35747)
  8507. const optsArg = opts => {
  8508. if (!opts)
  8509. opts = { mode: 0o777, fs }
  8510. else if (typeof opts === 'object')
  8511. opts = { mode: 0o777, fs, ...opts }
  8512. else if (typeof opts === 'number')
  8513. opts = { mode: opts, fs }
  8514. else if (typeof opts === 'string')
  8515. opts = { mode: parseInt(opts, 8), fs }
  8516. else
  8517. throw new TypeError('invalid options argument')
  8518. opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir
  8519. opts.mkdirAsync = promisify(opts.mkdir)
  8520. opts.stat = opts.stat || opts.fs.stat || fs.stat
  8521. opts.statAsync = promisify(opts.stat)
  8522. opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync
  8523. opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync
  8524. return opts
  8525. }
  8526. module.exports = optsArg
  8527. /***/ }),
  8528. /***/ 7543:
  8529. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8530. const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform
  8531. const { resolve, parse } = __webpack_require__(85622)
  8532. const pathArg = path => {
  8533. if (/\0/.test(path)) {
  8534. // simulate same failure that node raises
  8535. throw Object.assign(
  8536. new TypeError('path must be a string without null bytes'),
  8537. {
  8538. path,
  8539. code: 'ERR_INVALID_ARG_VALUE',
  8540. }
  8541. )
  8542. }
  8543. path = resolve(path)
  8544. if (platform === 'win32') {
  8545. const badWinChars = /[*|"<>?:]/
  8546. const {root} = parse(path)
  8547. if (badWinChars.test(path.substr(root.length))) {
  8548. throw Object.assign(new Error('Illegal characters in path.'), {
  8549. path,
  8550. code: 'EINVAL',
  8551. })
  8552. }
  8553. }
  8554. return path
  8555. }
  8556. module.exports = pathArg
  8557. /***/ }),
  8558. /***/ 52589:
  8559. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8560. const fs = __webpack_require__(35747)
  8561. const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
  8562. const versArr = version.replace(/^v/, '').split('.')
  8563. const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12
  8564. const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
  8565. const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync
  8566. module.exports = {useNative, useNativeSync}
  8567. /***/ }),
  8568. /***/ 36307:
  8569. /***/ ((module) => {
  8570. "use strict";
  8571. module.exports = function (Yallist) {
  8572. Yallist.prototype[Symbol.iterator] = function* () {
  8573. for (let walker = this.head; walker; walker = walker.next) {
  8574. yield walker.value
  8575. }
  8576. }
  8577. }
  8578. /***/ }),
  8579. /***/ 51234:
  8580. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8581. "use strict";
  8582. module.exports = Yallist
  8583. Yallist.Node = Node
  8584. Yallist.create = Yallist
  8585. function Yallist (list) {
  8586. var self = this
  8587. if (!(self instanceof Yallist)) {
  8588. self = new Yallist()
  8589. }
  8590. self.tail = null
  8591. self.head = null
  8592. self.length = 0
  8593. if (list && typeof list.forEach === 'function') {
  8594. list.forEach(function (item) {
  8595. self.push(item)
  8596. })
  8597. } else if (arguments.length > 0) {
  8598. for (var i = 0, l = arguments.length; i < l; i++) {
  8599. self.push(arguments[i])
  8600. }
  8601. }
  8602. return self
  8603. }
  8604. Yallist.prototype.removeNode = function (node) {
  8605. if (node.list !== this) {
  8606. throw new Error('removing node which does not belong to this list')
  8607. }
  8608. var next = node.next
  8609. var prev = node.prev
  8610. if (next) {
  8611. next.prev = prev
  8612. }
  8613. if (prev) {
  8614. prev.next = next
  8615. }
  8616. if (node === this.head) {
  8617. this.head = next
  8618. }
  8619. if (node === this.tail) {
  8620. this.tail = prev
  8621. }
  8622. node.list.length--
  8623. node.next = null
  8624. node.prev = null
  8625. node.list = null
  8626. return next
  8627. }
  8628. Yallist.prototype.unshiftNode = function (node) {
  8629. if (node === this.head) {
  8630. return
  8631. }
  8632. if (node.list) {
  8633. node.list.removeNode(node)
  8634. }
  8635. var head = this.head
  8636. node.list = this
  8637. node.next = head
  8638. if (head) {
  8639. head.prev = node
  8640. }
  8641. this.head = node
  8642. if (!this.tail) {
  8643. this.tail = node
  8644. }
  8645. this.length++
  8646. }
  8647. Yallist.prototype.pushNode = function (node) {
  8648. if (node === this.tail) {
  8649. return
  8650. }
  8651. if (node.list) {
  8652. node.list.removeNode(node)
  8653. }
  8654. var tail = this.tail
  8655. node.list = this
  8656. node.prev = tail
  8657. if (tail) {
  8658. tail.next = node
  8659. }
  8660. this.tail = node
  8661. if (!this.head) {
  8662. this.head = node
  8663. }
  8664. this.length++
  8665. }
  8666. Yallist.prototype.push = function () {
  8667. for (var i = 0, l = arguments.length; i < l; i++) {
  8668. push(this, arguments[i])
  8669. }
  8670. return this.length
  8671. }
  8672. Yallist.prototype.unshift = function () {
  8673. for (var i = 0, l = arguments.length; i < l; i++) {
  8674. unshift(this, arguments[i])
  8675. }
  8676. return this.length
  8677. }
  8678. Yallist.prototype.pop = function () {
  8679. if (!this.tail) {
  8680. return undefined
  8681. }
  8682. var res = this.tail.value
  8683. this.tail = this.tail.prev
  8684. if (this.tail) {
  8685. this.tail.next = null
  8686. } else {
  8687. this.head = null
  8688. }
  8689. this.length--
  8690. return res
  8691. }
  8692. Yallist.prototype.shift = function () {
  8693. if (!this.head) {
  8694. return undefined
  8695. }
  8696. var res = this.head.value
  8697. this.head = this.head.next
  8698. if (this.head) {
  8699. this.head.prev = null
  8700. } else {
  8701. this.tail = null
  8702. }
  8703. this.length--
  8704. return res
  8705. }
  8706. Yallist.prototype.forEach = function (fn, thisp) {
  8707. thisp = thisp || this
  8708. for (var walker = this.head, i = 0; walker !== null; i++) {
  8709. fn.call(thisp, walker.value, i, this)
  8710. walker = walker.next
  8711. }
  8712. }
  8713. Yallist.prototype.forEachReverse = function (fn, thisp) {
  8714. thisp = thisp || this
  8715. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  8716. fn.call(thisp, walker.value, i, this)
  8717. walker = walker.prev
  8718. }
  8719. }
  8720. Yallist.prototype.get = function (n) {
  8721. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  8722. // abort out of the list early if we hit a cycle
  8723. walker = walker.next
  8724. }
  8725. if (i === n && walker !== null) {
  8726. return walker.value
  8727. }
  8728. }
  8729. Yallist.prototype.getReverse = function (n) {
  8730. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  8731. // abort out of the list early if we hit a cycle
  8732. walker = walker.prev
  8733. }
  8734. if (i === n && walker !== null) {
  8735. return walker.value
  8736. }
  8737. }
  8738. Yallist.prototype.map = function (fn, thisp) {
  8739. thisp = thisp || this
  8740. var res = new Yallist()
  8741. for (var walker = this.head; walker !== null;) {
  8742. res.push(fn.call(thisp, walker.value, this))
  8743. walker = walker.next
  8744. }
  8745. return res
  8746. }
  8747. Yallist.prototype.mapReverse = function (fn, thisp) {
  8748. thisp = thisp || this
  8749. var res = new Yallist()
  8750. for (var walker = this.tail; walker !== null;) {
  8751. res.push(fn.call(thisp, walker.value, this))
  8752. walker = walker.prev
  8753. }
  8754. return res
  8755. }
  8756. Yallist.prototype.reduce = function (fn, initial) {
  8757. var acc
  8758. var walker = this.head
  8759. if (arguments.length > 1) {
  8760. acc = initial
  8761. } else if (this.head) {
  8762. walker = this.head.next
  8763. acc = this.head.value
  8764. } else {
  8765. throw new TypeError('Reduce of empty list with no initial value')
  8766. }
  8767. for (var i = 0; walker !== null; i++) {
  8768. acc = fn(acc, walker.value, i)
  8769. walker = walker.next
  8770. }
  8771. return acc
  8772. }
  8773. Yallist.prototype.reduceReverse = function (fn, initial) {
  8774. var acc
  8775. var walker = this.tail
  8776. if (arguments.length > 1) {
  8777. acc = initial
  8778. } else if (this.tail) {
  8779. walker = this.tail.prev
  8780. acc = this.tail.value
  8781. } else {
  8782. throw new TypeError('Reduce of empty list with no initial value')
  8783. }
  8784. for (var i = this.length - 1; walker !== null; i--) {
  8785. acc = fn(acc, walker.value, i)
  8786. walker = walker.prev
  8787. }
  8788. return acc
  8789. }
  8790. Yallist.prototype.toArray = function () {
  8791. var arr = new Array(this.length)
  8792. for (var i = 0, walker = this.head; walker !== null; i++) {
  8793. arr[i] = walker.value
  8794. walker = walker.next
  8795. }
  8796. return arr
  8797. }
  8798. Yallist.prototype.toArrayReverse = function () {
  8799. var arr = new Array(this.length)
  8800. for (var i = 0, walker = this.tail; walker !== null; i++) {
  8801. arr[i] = walker.value
  8802. walker = walker.prev
  8803. }
  8804. return arr
  8805. }
  8806. Yallist.prototype.slice = function (from, to) {
  8807. to = to || this.length
  8808. if (to < 0) {
  8809. to += this.length
  8810. }
  8811. from = from || 0
  8812. if (from < 0) {
  8813. from += this.length
  8814. }
  8815. var ret = new Yallist()
  8816. if (to < from || to < 0) {
  8817. return ret
  8818. }
  8819. if (from < 0) {
  8820. from = 0
  8821. }
  8822. if (to > this.length) {
  8823. to = this.length
  8824. }
  8825. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  8826. walker = walker.next
  8827. }
  8828. for (; walker !== null && i < to; i++, walker = walker.next) {
  8829. ret.push(walker.value)
  8830. }
  8831. return ret
  8832. }
  8833. Yallist.prototype.sliceReverse = function (from, to) {
  8834. to = to || this.length
  8835. if (to < 0) {
  8836. to += this.length
  8837. }
  8838. from = from || 0
  8839. if (from < 0) {
  8840. from += this.length
  8841. }
  8842. var ret = new Yallist()
  8843. if (to < from || to < 0) {
  8844. return ret
  8845. }
  8846. if (from < 0) {
  8847. from = 0
  8848. }
  8849. if (to > this.length) {
  8850. to = this.length
  8851. }
  8852. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  8853. walker = walker.prev
  8854. }
  8855. for (; walker !== null && i > from; i--, walker = walker.prev) {
  8856. ret.push(walker.value)
  8857. }
  8858. return ret
  8859. }
  8860. Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
  8861. if (start > this.length) {
  8862. start = this.length - 1
  8863. }
  8864. if (start < 0) {
  8865. start = this.length + start;
  8866. }
  8867. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  8868. walker = walker.next
  8869. }
  8870. var ret = []
  8871. for (var i = 0; walker && i < deleteCount; i++) {
  8872. ret.push(walker.value)
  8873. walker = this.removeNode(walker)
  8874. }
  8875. if (walker === null) {
  8876. walker = this.tail
  8877. }
  8878. if (walker !== this.head && walker !== this.tail) {
  8879. walker = walker.prev
  8880. }
  8881. for (var i = 0; i < nodes.length; i++) {
  8882. walker = insert(this, walker, nodes[i])
  8883. }
  8884. return ret;
  8885. }
  8886. Yallist.prototype.reverse = function () {
  8887. var head = this.head
  8888. var tail = this.tail
  8889. for (var walker = head; walker !== null; walker = walker.prev) {
  8890. var p = walker.prev
  8891. walker.prev = walker.next
  8892. walker.next = p
  8893. }
  8894. this.head = tail
  8895. this.tail = head
  8896. return this
  8897. }
  8898. function insert (self, node, value) {
  8899. var inserted = node === self.head ?
  8900. new Node(value, null, node, self) :
  8901. new Node(value, node, node.next, self)
  8902. if (inserted.next === null) {
  8903. self.tail = inserted
  8904. }
  8905. if (inserted.prev === null) {
  8906. self.head = inserted
  8907. }
  8908. self.length++
  8909. return inserted
  8910. }
  8911. function push (self, item) {
  8912. self.tail = new Node(item, self.tail, null, self)
  8913. if (!self.head) {
  8914. self.head = self.tail
  8915. }
  8916. self.length++
  8917. }
  8918. function unshift (self, item) {
  8919. self.head = new Node(item, null, self.head, self)
  8920. if (!self.tail) {
  8921. self.tail = self.head
  8922. }
  8923. self.length++
  8924. }
  8925. function Node (value, prev, next, list) {
  8926. if (!(this instanceof Node)) {
  8927. return new Node(value, prev, next, list)
  8928. }
  8929. this.list = list
  8930. this.value = value
  8931. if (prev) {
  8932. prev.next = this
  8933. this.prev = prev
  8934. } else {
  8935. this.prev = null
  8936. }
  8937. if (next) {
  8938. next.prev = this
  8939. this.next = next
  8940. } else {
  8941. this.next = null
  8942. }
  8943. }
  8944. try {
  8945. // add if support for Symbol.iterator is present
  8946. __webpack_require__(36307)(Yallist)
  8947. } catch (er) {}
  8948. /***/ })
  8949. };
  8950. ;
  8951. //# sourceMappingURL=790.index.js.map