12dae2c343c183898d5d736e93d53f1fef33cbc60d80a0485cfb3d3992227f3a070786cff9a6a06df0e32aa97deb103a04063220bca09fdb848e59915872e8 410 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456
  1. "use strict";
  2. var __getOwnPropNames = Object.getOwnPropertyNames;
  3. var __commonJS = (cb, mod) => function __require() {
  4. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  5. };
  6. // ../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/polyfills.js
  7. var require_polyfills = __commonJS({
  8. "../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
  9. var constants = require("constants");
  10. var origCwd = process.cwd;
  11. var cwd = null;
  12. var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
  13. process.cwd = function() {
  14. if (!cwd)
  15. cwd = origCwd.call(process);
  16. return cwd;
  17. };
  18. try {
  19. process.cwd();
  20. } catch (er) {
  21. }
  22. if (typeof process.chdir === "function") {
  23. chdir = process.chdir;
  24. process.chdir = function(d) {
  25. cwd = null;
  26. chdir.call(process, d);
  27. };
  28. if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
  29. }
  30. var chdir;
  31. module2.exports = patch;
  32. function patch(fs) {
  33. if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
  34. patchLchmod(fs);
  35. }
  36. if (!fs.lutimes) {
  37. patchLutimes(fs);
  38. }
  39. fs.chown = chownFix(fs.chown);
  40. fs.fchown = chownFix(fs.fchown);
  41. fs.lchown = chownFix(fs.lchown);
  42. fs.chmod = chmodFix(fs.chmod);
  43. fs.fchmod = chmodFix(fs.fchmod);
  44. fs.lchmod = chmodFix(fs.lchmod);
  45. fs.chownSync = chownFixSync(fs.chownSync);
  46. fs.fchownSync = chownFixSync(fs.fchownSync);
  47. fs.lchownSync = chownFixSync(fs.lchownSync);
  48. fs.chmodSync = chmodFixSync(fs.chmodSync);
  49. fs.fchmodSync = chmodFixSync(fs.fchmodSync);
  50. fs.lchmodSync = chmodFixSync(fs.lchmodSync);
  51. fs.stat = statFix(fs.stat);
  52. fs.fstat = statFix(fs.fstat);
  53. fs.lstat = statFix(fs.lstat);
  54. fs.statSync = statFixSync(fs.statSync);
  55. fs.fstatSync = statFixSync(fs.fstatSync);
  56. fs.lstatSync = statFixSync(fs.lstatSync);
  57. if (fs.chmod && !fs.lchmod) {
  58. fs.lchmod = function(path, mode, cb) {
  59. if (cb) process.nextTick(cb);
  60. };
  61. fs.lchmodSync = function() {
  62. };
  63. }
  64. if (fs.chown && !fs.lchown) {
  65. fs.lchown = function(path, uid, gid, cb) {
  66. if (cb) process.nextTick(cb);
  67. };
  68. fs.lchownSync = function() {
  69. };
  70. }
  71. if (platform === "win32") {
  72. fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
  73. function rename(from, to, cb) {
  74. var start = Date.now();
  75. var backoff = 0;
  76. fs$rename(from, to, function CB(er) {
  77. if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
  78. setTimeout(function() {
  79. fs.stat(to, function(stater, st) {
  80. if (stater && stater.code === "ENOENT")
  81. fs$rename(from, to, CB);
  82. else
  83. cb(er);
  84. });
  85. }, backoff);
  86. if (backoff < 100)
  87. backoff += 10;
  88. return;
  89. }
  90. if (cb) cb(er);
  91. });
  92. }
  93. if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
  94. return rename;
  95. }(fs.rename);
  96. }
  97. fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
  98. function read(fd, buffer, offset, length, position, callback_) {
  99. var callback;
  100. if (callback_ && typeof callback_ === "function") {
  101. var eagCounter = 0;
  102. callback = function(er, _, __) {
  103. if (er && er.code === "EAGAIN" && eagCounter < 10) {
  104. eagCounter++;
  105. return fs$read.call(fs, fd, buffer, offset, length, position, callback);
  106. }
  107. callback_.apply(this, arguments);
  108. };
  109. }
  110. return fs$read.call(fs, fd, buffer, offset, length, position, callback);
  111. }
  112. if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
  113. return read;
  114. }(fs.read);
  115. fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) {
  116. return function(fd, buffer, offset, length, position) {
  117. var eagCounter = 0;
  118. while (true) {
  119. try {
  120. return fs$readSync.call(fs, fd, buffer, offset, length, position);
  121. } catch (er) {
  122. if (er.code === "EAGAIN" && eagCounter < 10) {
  123. eagCounter++;
  124. continue;
  125. }
  126. throw er;
  127. }
  128. }
  129. };
  130. }(fs.readSync);
  131. function patchLchmod(fs2) {
  132. fs2.lchmod = function(path, mode, callback) {
  133. fs2.open(
  134. path,
  135. constants.O_WRONLY | constants.O_SYMLINK,
  136. mode,
  137. function(err, fd) {
  138. if (err) {
  139. if (callback) callback(err);
  140. return;
  141. }
  142. fs2.fchmod(fd, mode, function(err2) {
  143. fs2.close(fd, function(err22) {
  144. if (callback) callback(err2 || err22);
  145. });
  146. });
  147. }
  148. );
  149. };
  150. fs2.lchmodSync = function(path, mode) {
  151. var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
  152. var threw = true;
  153. var ret;
  154. try {
  155. ret = fs2.fchmodSync(fd, mode);
  156. threw = false;
  157. } finally {
  158. if (threw) {
  159. try {
  160. fs2.closeSync(fd);
  161. } catch (er) {
  162. }
  163. } else {
  164. fs2.closeSync(fd);
  165. }
  166. }
  167. return ret;
  168. };
  169. }
  170. function patchLutimes(fs2) {
  171. if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
  172. fs2.lutimes = function(path, at, mt, cb) {
  173. fs2.open(path, constants.O_SYMLINK, function(er, fd) {
  174. if (er) {
  175. if (cb) cb(er);
  176. return;
  177. }
  178. fs2.futimes(fd, at, mt, function(er2) {
  179. fs2.close(fd, function(er22) {
  180. if (cb) cb(er2 || er22);
  181. });
  182. });
  183. });
  184. };
  185. fs2.lutimesSync = function(path, at, mt) {
  186. var fd = fs2.openSync(path, constants.O_SYMLINK);
  187. var ret;
  188. var threw = true;
  189. try {
  190. ret = fs2.futimesSync(fd, at, mt);
  191. threw = false;
  192. } finally {
  193. if (threw) {
  194. try {
  195. fs2.closeSync(fd);
  196. } catch (er) {
  197. }
  198. } else {
  199. fs2.closeSync(fd);
  200. }
  201. }
  202. return ret;
  203. };
  204. } else if (fs2.futimes) {
  205. fs2.lutimes = function(_a, _b, _c, cb) {
  206. if (cb) process.nextTick(cb);
  207. };
  208. fs2.lutimesSync = function() {
  209. };
  210. }
  211. }
  212. function chmodFix(orig) {
  213. if (!orig) return orig;
  214. return function(target, mode, cb) {
  215. return orig.call(fs, target, mode, function(er) {
  216. if (chownErOk(er)) er = null;
  217. if (cb) cb.apply(this, arguments);
  218. });
  219. };
  220. }
  221. function chmodFixSync(orig) {
  222. if (!orig) return orig;
  223. return function(target, mode) {
  224. try {
  225. return orig.call(fs, target, mode);
  226. } catch (er) {
  227. if (!chownErOk(er)) throw er;
  228. }
  229. };
  230. }
  231. function chownFix(orig) {
  232. if (!orig) return orig;
  233. return function(target, uid, gid, cb) {
  234. return orig.call(fs, target, uid, gid, function(er) {
  235. if (chownErOk(er)) er = null;
  236. if (cb) cb.apply(this, arguments);
  237. });
  238. };
  239. }
  240. function chownFixSync(orig) {
  241. if (!orig) return orig;
  242. return function(target, uid, gid) {
  243. try {
  244. return orig.call(fs, target, uid, gid);
  245. } catch (er) {
  246. if (!chownErOk(er)) throw er;
  247. }
  248. };
  249. }
  250. function statFix(orig) {
  251. if (!orig) return orig;
  252. return function(target, options, cb) {
  253. if (typeof options === "function") {
  254. cb = options;
  255. options = null;
  256. }
  257. function callback(er, stats) {
  258. if (stats) {
  259. if (stats.uid < 0) stats.uid += 4294967296;
  260. if (stats.gid < 0) stats.gid += 4294967296;
  261. }
  262. if (cb) cb.apply(this, arguments);
  263. }
  264. return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
  265. };
  266. }
  267. function statFixSync(orig) {
  268. if (!orig) return orig;
  269. return function(target, options) {
  270. var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
  271. if (stats) {
  272. if (stats.uid < 0) stats.uid += 4294967296;
  273. if (stats.gid < 0) stats.gid += 4294967296;
  274. }
  275. return stats;
  276. };
  277. }
  278. function chownErOk(er) {
  279. if (!er)
  280. return true;
  281. if (er.code === "ENOSYS")
  282. return true;
  283. var nonroot = !process.getuid || process.getuid() !== 0;
  284. if (nonroot) {
  285. if (er.code === "EINVAL" || er.code === "EPERM")
  286. return true;
  287. }
  288. return false;
  289. }
  290. }
  291. }
  292. });
  293. // ../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/legacy-streams.js
  294. var require_legacy_streams = __commonJS({
  295. "../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
  296. var Stream = require("stream").Stream;
  297. module2.exports = legacy;
  298. function legacy(fs) {
  299. return {
  300. ReadStream,
  301. WriteStream
  302. };
  303. function ReadStream(path, options) {
  304. if (!(this instanceof ReadStream)) return new ReadStream(path, options);
  305. Stream.call(this);
  306. var self2 = this;
  307. this.path = path;
  308. this.fd = null;
  309. this.readable = true;
  310. this.paused = false;
  311. this.flags = "r";
  312. this.mode = 438;
  313. this.bufferSize = 64 * 1024;
  314. options = options || {};
  315. var keys = Object.keys(options);
  316. for (var index = 0, length = keys.length; index < length; index++) {
  317. var key = keys[index];
  318. this[key] = options[key];
  319. }
  320. if (this.encoding) this.setEncoding(this.encoding);
  321. if (this.start !== void 0) {
  322. if ("number" !== typeof this.start) {
  323. throw TypeError("start must be a Number");
  324. }
  325. if (this.end === void 0) {
  326. this.end = Infinity;
  327. } else if ("number" !== typeof this.end) {
  328. throw TypeError("end must be a Number");
  329. }
  330. if (this.start > this.end) {
  331. throw new Error("start must be <= end");
  332. }
  333. this.pos = this.start;
  334. }
  335. if (this.fd !== null) {
  336. process.nextTick(function() {
  337. self2._read();
  338. });
  339. return;
  340. }
  341. fs.open(this.path, this.flags, this.mode, function(err, fd) {
  342. if (err) {
  343. self2.emit("error", err);
  344. self2.readable = false;
  345. return;
  346. }
  347. self2.fd = fd;
  348. self2.emit("open", fd);
  349. self2._read();
  350. });
  351. }
  352. function WriteStream(path, options) {
  353. if (!(this instanceof WriteStream)) return new WriteStream(path, options);
  354. Stream.call(this);
  355. this.path = path;
  356. this.fd = null;
  357. this.writable = true;
  358. this.flags = "w";
  359. this.encoding = "binary";
  360. this.mode = 438;
  361. this.bytesWritten = 0;
  362. options = options || {};
  363. var keys = Object.keys(options);
  364. for (var index = 0, length = keys.length; index < length; index++) {
  365. var key = keys[index];
  366. this[key] = options[key];
  367. }
  368. if (this.start !== void 0) {
  369. if ("number" !== typeof this.start) {
  370. throw TypeError("start must be a Number");
  371. }
  372. if (this.start < 0) {
  373. throw new Error("start must be >= zero");
  374. }
  375. this.pos = this.start;
  376. }
  377. this.busy = false;
  378. this._queue = [];
  379. if (this.fd === null) {
  380. this._open = fs.open;
  381. this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
  382. this.flush();
  383. }
  384. }
  385. }
  386. }
  387. });
  388. // ../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/clone.js
  389. var require_clone = __commonJS({
  390. "../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/clone.js"(exports2, module2) {
  391. "use strict";
  392. module2.exports = clone;
  393. var getPrototypeOf = Object.getPrototypeOf || function(obj) {
  394. return obj.__proto__;
  395. };
  396. function clone(obj) {
  397. if (obj === null || typeof obj !== "object")
  398. return obj;
  399. if (obj instanceof Object)
  400. var copy = { __proto__: getPrototypeOf(obj) };
  401. else
  402. var copy = /* @__PURE__ */ Object.create(null);
  403. Object.getOwnPropertyNames(obj).forEach(function(key) {
  404. Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
  405. });
  406. return copy;
  407. }
  408. }
  409. });
  410. // ../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/graceful-fs.js
  411. var require_graceful_fs = __commonJS({
  412. "../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
  413. var fs = require("fs");
  414. var polyfills = require_polyfills();
  415. var legacy = require_legacy_streams();
  416. var clone = require_clone();
  417. var util = require("util");
  418. var gracefulQueue;
  419. var previousSymbol;
  420. if (typeof Symbol === "function" && typeof Symbol.for === "function") {
  421. gracefulQueue = Symbol.for("graceful-fs.queue");
  422. previousSymbol = Symbol.for("graceful-fs.previous");
  423. } else {
  424. gracefulQueue = "___graceful-fs.queue";
  425. previousSymbol = "___graceful-fs.previous";
  426. }
  427. function noop() {
  428. }
  429. function publishQueue(context, queue2) {
  430. Object.defineProperty(context, gracefulQueue, {
  431. get: function() {
  432. return queue2;
  433. }
  434. });
  435. }
  436. var debug = noop;
  437. if (util.debuglog)
  438. debug = util.debuglog("gfs4");
  439. else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
  440. debug = function() {
  441. var m = util.format.apply(util, arguments);
  442. m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
  443. console.error(m);
  444. };
  445. if (!fs[gracefulQueue]) {
  446. queue = global[gracefulQueue] || [];
  447. publishQueue(fs, queue);
  448. fs.close = function(fs$close) {
  449. function close(fd, cb) {
  450. return fs$close.call(fs, fd, function(err) {
  451. if (!err) {
  452. resetQueue();
  453. }
  454. if (typeof cb === "function")
  455. cb.apply(this, arguments);
  456. });
  457. }
  458. Object.defineProperty(close, previousSymbol, {
  459. value: fs$close
  460. });
  461. return close;
  462. }(fs.close);
  463. fs.closeSync = function(fs$closeSync) {
  464. function closeSync(fd) {
  465. fs$closeSync.apply(fs, arguments);
  466. resetQueue();
  467. }
  468. Object.defineProperty(closeSync, previousSymbol, {
  469. value: fs$closeSync
  470. });
  471. return closeSync;
  472. }(fs.closeSync);
  473. if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
  474. process.on("exit", function() {
  475. debug(fs[gracefulQueue]);
  476. require("assert").equal(fs[gracefulQueue].length, 0);
  477. });
  478. }
  479. }
  480. var queue;
  481. if (!global[gracefulQueue]) {
  482. publishQueue(global, fs[gracefulQueue]);
  483. }
  484. module2.exports = patch(clone(fs));
  485. if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
  486. module2.exports = patch(fs);
  487. fs.__patched = true;
  488. }
  489. function patch(fs2) {
  490. polyfills(fs2);
  491. fs2.gracefulify = patch;
  492. fs2.createReadStream = createReadStream;
  493. fs2.createWriteStream = createWriteStream;
  494. var fs$readFile = fs2.readFile;
  495. fs2.readFile = readFile;
  496. function readFile(path, options, cb) {
  497. if (typeof options === "function")
  498. cb = options, options = null;
  499. return go$readFile(path, options, cb);
  500. function go$readFile(path2, options2, cb2, startTime) {
  501. return fs$readFile(path2, options2, function(err) {
  502. if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
  503. enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
  504. else {
  505. if (typeof cb2 === "function")
  506. cb2.apply(this, arguments);
  507. }
  508. });
  509. }
  510. }
  511. var fs$writeFile = fs2.writeFile;
  512. fs2.writeFile = writeFile;
  513. function writeFile(path, data, options, cb) {
  514. if (typeof options === "function")
  515. cb = options, options = null;
  516. return go$writeFile(path, data, options, cb);
  517. function go$writeFile(path2, data2, options2, cb2, startTime) {
  518. return fs$writeFile(path2, data2, options2, function(err) {
  519. if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
  520. enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
  521. else {
  522. if (typeof cb2 === "function")
  523. cb2.apply(this, arguments);
  524. }
  525. });
  526. }
  527. }
  528. var fs$appendFile = fs2.appendFile;
  529. if (fs$appendFile)
  530. fs2.appendFile = appendFile;
  531. function appendFile(path, data, options, cb) {
  532. if (typeof options === "function")
  533. cb = options, options = null;
  534. return go$appendFile(path, data, options, cb);
  535. function go$appendFile(path2, data2, options2, cb2, startTime) {
  536. return fs$appendFile(path2, data2, options2, function(err) {
  537. if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
  538. enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
  539. else {
  540. if (typeof cb2 === "function")
  541. cb2.apply(this, arguments);
  542. }
  543. });
  544. }
  545. }
  546. var fs$copyFile = fs2.copyFile;
  547. if (fs$copyFile)
  548. fs2.copyFile = copyFile;
  549. function copyFile(src, dest, flags, cb) {
  550. if (typeof flags === "function") {
  551. cb = flags;
  552. flags = 0;
  553. }
  554. return go$copyFile(src, dest, flags, cb);
  555. function go$copyFile(src2, dest2, flags2, cb2, startTime) {
  556. return fs$copyFile(src2, dest2, flags2, function(err) {
  557. if (err && (err.code === "EMFILE" || err.code === "ENFILE" || err.code === "EBUSY"))
  558. enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
  559. else {
  560. if (typeof cb2 === "function")
  561. cb2.apply(this, arguments);
  562. }
  563. });
  564. }
  565. }
  566. var fs$readdir = fs2.readdir;
  567. fs2.readdir = readdir;
  568. var noReaddirOptionVersions = /^v[0-5]\./;
  569. function readdir(path, options, cb) {
  570. if (typeof options === "function")
  571. cb = options, options = null;
  572. var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) {
  573. return fs$readdir(path2, fs$readdirCallback(
  574. path2,
  575. options2,
  576. cb2,
  577. startTime
  578. ));
  579. } : function go$readdir2(path2, options2, cb2, startTime) {
  580. return fs$readdir(path2, options2, fs$readdirCallback(
  581. path2,
  582. options2,
  583. cb2,
  584. startTime
  585. ));
  586. };
  587. return go$readdir(path, options, cb);
  588. function fs$readdirCallback(path2, options2, cb2, startTime) {
  589. return function(err, files) {
  590. if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
  591. enqueue([
  592. go$readdir,
  593. [path2, options2, cb2],
  594. err,
  595. startTime || Date.now(),
  596. Date.now()
  597. ]);
  598. else {
  599. if (files && files.sort)
  600. files.sort();
  601. if (typeof cb2 === "function")
  602. cb2.call(this, err, files);
  603. }
  604. };
  605. }
  606. }
  607. if (process.version.substr(0, 4) === "v0.8") {
  608. var legStreams = legacy(fs2);
  609. ReadStream = legStreams.ReadStream;
  610. WriteStream = legStreams.WriteStream;
  611. }
  612. var fs$ReadStream = fs2.ReadStream;
  613. if (fs$ReadStream) {
  614. ReadStream.prototype = Object.create(fs$ReadStream.prototype);
  615. ReadStream.prototype.open = ReadStream$open;
  616. }
  617. var fs$WriteStream = fs2.WriteStream;
  618. if (fs$WriteStream) {
  619. WriteStream.prototype = Object.create(fs$WriteStream.prototype);
  620. WriteStream.prototype.open = WriteStream$open;
  621. }
  622. Object.defineProperty(fs2, "ReadStream", {
  623. get: function() {
  624. return ReadStream;
  625. },
  626. set: function(val) {
  627. ReadStream = val;
  628. },
  629. enumerable: true,
  630. configurable: true
  631. });
  632. Object.defineProperty(fs2, "WriteStream", {
  633. get: function() {
  634. return WriteStream;
  635. },
  636. set: function(val) {
  637. WriteStream = val;
  638. },
  639. enumerable: true,
  640. configurable: true
  641. });
  642. var FileReadStream = ReadStream;
  643. Object.defineProperty(fs2, "FileReadStream", {
  644. get: function() {
  645. return FileReadStream;
  646. },
  647. set: function(val) {
  648. FileReadStream = val;
  649. },
  650. enumerable: true,
  651. configurable: true
  652. });
  653. var FileWriteStream = WriteStream;
  654. Object.defineProperty(fs2, "FileWriteStream", {
  655. get: function() {
  656. return FileWriteStream;
  657. },
  658. set: function(val) {
  659. FileWriteStream = val;
  660. },
  661. enumerable: true,
  662. configurable: true
  663. });
  664. function ReadStream(path, options) {
  665. if (this instanceof ReadStream)
  666. return fs$ReadStream.apply(this, arguments), this;
  667. else
  668. return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
  669. }
  670. function ReadStream$open() {
  671. var that = this;
  672. open(that.path, that.flags, that.mode, function(err, fd) {
  673. if (err) {
  674. if (that.autoClose)
  675. that.destroy();
  676. that.emit("error", err);
  677. } else {
  678. that.fd = fd;
  679. that.emit("open", fd);
  680. that.read();
  681. }
  682. });
  683. }
  684. function WriteStream(path, options) {
  685. if (this instanceof WriteStream)
  686. return fs$WriteStream.apply(this, arguments), this;
  687. else
  688. return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
  689. }
  690. function WriteStream$open() {
  691. var that = this;
  692. open(that.path, that.flags, that.mode, function(err, fd) {
  693. if (err) {
  694. that.destroy();
  695. that.emit("error", err);
  696. } else {
  697. that.fd = fd;
  698. that.emit("open", fd);
  699. }
  700. });
  701. }
  702. function createReadStream(path, options) {
  703. return new fs2.ReadStream(path, options);
  704. }
  705. function createWriteStream(path, options) {
  706. return new fs2.WriteStream(path, options);
  707. }
  708. var fs$open = fs2.open;
  709. fs2.open = open;
  710. function open(path, flags, mode, cb) {
  711. if (typeof mode === "function")
  712. cb = mode, mode = null;
  713. return go$open(path, flags, mode, cb);
  714. function go$open(path2, flags2, mode2, cb2, startTime) {
  715. return fs$open(path2, flags2, mode2, function(err, fd) {
  716. if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
  717. enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
  718. else {
  719. if (typeof cb2 === "function")
  720. cb2.apply(this, arguments);
  721. }
  722. });
  723. }
  724. }
  725. return fs2;
  726. }
  727. function enqueue(elem) {
  728. debug("ENQUEUE", elem[0].name, elem[1]);
  729. fs[gracefulQueue].push(elem);
  730. retry();
  731. }
  732. var retryTimer;
  733. function resetQueue() {
  734. var now = Date.now();
  735. for (var i = 0; i < fs[gracefulQueue].length; ++i) {
  736. if (fs[gracefulQueue][i].length > 2) {
  737. fs[gracefulQueue][i][3] = now;
  738. fs[gracefulQueue][i][4] = now;
  739. }
  740. }
  741. retry();
  742. }
  743. function retry() {
  744. clearTimeout(retryTimer);
  745. retryTimer = void 0;
  746. if (fs[gracefulQueue].length === 0)
  747. return;
  748. var elem = fs[gracefulQueue].shift();
  749. var fn = elem[0];
  750. var args = elem[1];
  751. var err = elem[2];
  752. var startTime = elem[3];
  753. var lastTime = elem[4];
  754. if (startTime === void 0) {
  755. debug("RETRY", fn.name, args);
  756. fn.apply(null, args);
  757. } else if (Date.now() - startTime >= 6e4) {
  758. debug("TIMEOUT", fn.name, args);
  759. var cb = args.pop();
  760. if (typeof cb === "function")
  761. cb.call(null, err);
  762. } else {
  763. var sinceAttempt = Date.now() - lastTime;
  764. var sinceStart = Math.max(lastTime - startTime, 1);
  765. var desiredDelay = Math.min(sinceStart * 1.2, 100);
  766. if (sinceAttempt >= desiredDelay) {
  767. debug("RETRY", fn.name, args);
  768. fn.apply(null, args.concat([startTime]));
  769. } else {
  770. fs[gracefulQueue].push(elem);
  771. }
  772. }
  773. if (retryTimer === void 0) {
  774. retryTimer = setTimeout(retry, 0);
  775. }
  776. }
  777. }
  778. });
  779. // ../fs/graceful-fs/lib/index.js
  780. var require_lib = __commonJS({
  781. "../fs/graceful-fs/lib/index.js"(exports2) {
  782. "use strict";
  783. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  784. return mod && mod.__esModule ? mod : { "default": mod };
  785. };
  786. Object.defineProperty(exports2, "__esModule", { value: true });
  787. var util_1 = require("util");
  788. var graceful_fs_12 = __importDefault2(require_graceful_fs());
  789. exports2.default = {
  790. copyFile: (0, util_1.promisify)(graceful_fs_12.default.copyFile),
  791. copyFileSync: graceful_fs_12.default.copyFileSync,
  792. createReadStream: graceful_fs_12.default.createReadStream,
  793. link: (0, util_1.promisify)(graceful_fs_12.default.link),
  794. linkSync: graceful_fs_12.default.linkSync,
  795. readFile: (0, util_1.promisify)(graceful_fs_12.default.readFile),
  796. readFileSync: graceful_fs_12.default.readFileSync,
  797. readdirSync: graceful_fs_12.default.readdirSync,
  798. stat: (0, util_1.promisify)(graceful_fs_12.default.stat),
  799. statSync: graceful_fs_12.default.statSync,
  800. unlinkSync: graceful_fs_12.default.unlinkSync,
  801. writeFile: (0, util_1.promisify)(graceful_fs_12.default.writeFile),
  802. writeFileSync: graceful_fs_12.default.writeFileSync
  803. };
  804. }
  805. });
  806. // ../node_modules/.pnpm/minipass@7.1.2/node_modules/minipass/dist/commonjs/index.js
  807. var require_commonjs = __commonJS({
  808. "../node_modules/.pnpm/minipass@7.1.2/node_modules/minipass/dist/commonjs/index.js"(exports2) {
  809. "use strict";
  810. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  811. return mod && mod.__esModule ? mod : { "default": mod };
  812. };
  813. Object.defineProperty(exports2, "__esModule", { value: true });
  814. exports2.Minipass = exports2.isWritable = exports2.isReadable = exports2.isStream = void 0;
  815. var proc = typeof process === "object" && process ? process : {
  816. stdout: null,
  817. stderr: null
  818. };
  819. var node_events_1 = require("node:events");
  820. var node_stream_1 = __importDefault2(require("node:stream"));
  821. var node_string_decoder_1 = require("node:string_decoder");
  822. var isStream = (s) => !!s && typeof s === "object" && (s instanceof Minipass || s instanceof node_stream_1.default || (0, exports2.isReadable)(s) || (0, exports2.isWritable)(s));
  823. exports2.isStream = isStream;
  824. var isReadable = (s) => !!s && typeof s === "object" && s instanceof node_events_1.EventEmitter && typeof s.pipe === "function" && // node core Writable streams have a pipe() method, but it throws
  825. s.pipe !== node_stream_1.default.Writable.prototype.pipe;
  826. exports2.isReadable = isReadable;
  827. var isWritable = (s) => !!s && typeof s === "object" && s instanceof node_events_1.EventEmitter && typeof s.write === "function" && typeof s.end === "function";
  828. exports2.isWritable = isWritable;
  829. var EOF = Symbol("EOF");
  830. var MAYBE_EMIT_END = Symbol("maybeEmitEnd");
  831. var EMITTED_END = Symbol("emittedEnd");
  832. var EMITTING_END = Symbol("emittingEnd");
  833. var EMITTED_ERROR = Symbol("emittedError");
  834. var CLOSED = Symbol("closed");
  835. var READ = Symbol("read");
  836. var FLUSH = Symbol("flush");
  837. var FLUSHCHUNK = Symbol("flushChunk");
  838. var ENCODING = Symbol("encoding");
  839. var DECODER = Symbol("decoder");
  840. var FLOWING = Symbol("flowing");
  841. var PAUSED = Symbol("paused");
  842. var RESUME = Symbol("resume");
  843. var BUFFER = Symbol("buffer");
  844. var PIPES = Symbol("pipes");
  845. var BUFFERLENGTH = Symbol("bufferLength");
  846. var BUFFERPUSH = Symbol("bufferPush");
  847. var BUFFERSHIFT = Symbol("bufferShift");
  848. var OBJECTMODE = Symbol("objectMode");
  849. var DESTROYED = Symbol("destroyed");
  850. var ERROR = Symbol("error");
  851. var EMITDATA = Symbol("emitData");
  852. var EMITEND = Symbol("emitEnd");
  853. var EMITEND2 = Symbol("emitEnd2");
  854. var ASYNC = Symbol("async");
  855. var ABORT = Symbol("abort");
  856. var ABORTED = Symbol("aborted");
  857. var SIGNAL = Symbol("signal");
  858. var DATALISTENERS = Symbol("dataListeners");
  859. var DISCARDED = Symbol("discarded");
  860. var defer = (fn) => Promise.resolve().then(fn);
  861. var nodefer = (fn) => fn();
  862. var isEndish = (ev) => ev === "end" || ev === "finish" || ev === "prefinish";
  863. var isArrayBufferLike = (b) => b instanceof ArrayBuffer || !!b && typeof b === "object" && b.constructor && b.constructor.name === "ArrayBuffer" && b.byteLength >= 0;
  864. var isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b);
  865. var Pipe = class {
  866. src;
  867. dest;
  868. opts;
  869. ondrain;
  870. constructor(src, dest, opts) {
  871. this.src = src;
  872. this.dest = dest;
  873. this.opts = opts;
  874. this.ondrain = () => src[RESUME]();
  875. this.dest.on("drain", this.ondrain);
  876. }
  877. unpipe() {
  878. this.dest.removeListener("drain", this.ondrain);
  879. }
  880. // only here for the prototype
  881. /* c8 ignore start */
  882. proxyErrors(_er) {
  883. }
  884. /* c8 ignore stop */
  885. end() {
  886. this.unpipe();
  887. if (this.opts.end)
  888. this.dest.end();
  889. }
  890. };
  891. var PipeProxyErrors = class extends Pipe {
  892. unpipe() {
  893. this.src.removeListener("error", this.proxyErrors);
  894. super.unpipe();
  895. }
  896. constructor(src, dest, opts) {
  897. super(src, dest, opts);
  898. this.proxyErrors = (er) => dest.emit("error", er);
  899. src.on("error", this.proxyErrors);
  900. }
  901. };
  902. var isObjectModeOptions = (o) => !!o.objectMode;
  903. var isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== "buffer";
  904. var Minipass = class extends node_events_1.EventEmitter {
  905. [FLOWING] = false;
  906. [PAUSED] = false;
  907. [PIPES] = [];
  908. [BUFFER] = [];
  909. [OBJECTMODE];
  910. [ENCODING];
  911. [ASYNC];
  912. [DECODER];
  913. [EOF] = false;
  914. [EMITTED_END] = false;
  915. [EMITTING_END] = false;
  916. [CLOSED] = false;
  917. [EMITTED_ERROR] = null;
  918. [BUFFERLENGTH] = 0;
  919. [DESTROYED] = false;
  920. [SIGNAL];
  921. [ABORTED] = false;
  922. [DATALISTENERS] = 0;
  923. [DISCARDED] = false;
  924. /**
  925. * true if the stream can be written
  926. */
  927. writable = true;
  928. /**
  929. * true if the stream can be read
  930. */
  931. readable = true;
  932. /**
  933. * If `RType` is Buffer, then options do not need to be provided.
  934. * Otherwise, an options object must be provided to specify either
  935. * {@link Minipass.SharedOptions.objectMode} or
  936. * {@link Minipass.SharedOptions.encoding}, as appropriate.
  937. */
  938. constructor(...args) {
  939. const options = args[0] || {};
  940. super();
  941. if (options.objectMode && typeof options.encoding === "string") {
  942. throw new TypeError("Encoding and objectMode may not be used together");
  943. }
  944. if (isObjectModeOptions(options)) {
  945. this[OBJECTMODE] = true;
  946. this[ENCODING] = null;
  947. } else if (isEncodingOptions(options)) {
  948. this[ENCODING] = options.encoding;
  949. this[OBJECTMODE] = false;
  950. } else {
  951. this[OBJECTMODE] = false;
  952. this[ENCODING] = null;
  953. }
  954. this[ASYNC] = !!options.async;
  955. this[DECODER] = this[ENCODING] ? new node_string_decoder_1.StringDecoder(this[ENCODING]) : null;
  956. if (options && options.debugExposeBuffer === true) {
  957. Object.defineProperty(this, "buffer", { get: () => this[BUFFER] });
  958. }
  959. if (options && options.debugExposePipes === true) {
  960. Object.defineProperty(this, "pipes", { get: () => this[PIPES] });
  961. }
  962. const { signal } = options;
  963. if (signal) {
  964. this[SIGNAL] = signal;
  965. if (signal.aborted) {
  966. this[ABORT]();
  967. } else {
  968. signal.addEventListener("abort", () => this[ABORT]());
  969. }
  970. }
  971. }
  972. /**
  973. * The amount of data stored in the buffer waiting to be read.
  974. *
  975. * For Buffer strings, this will be the total byte length.
  976. * For string encoding streams, this will be the string character length,
  977. * according to JavaScript's `string.length` logic.
  978. * For objectMode streams, this is a count of the items waiting to be
  979. * emitted.
  980. */
  981. get bufferLength() {
  982. return this[BUFFERLENGTH];
  983. }
  984. /**
  985. * The `BufferEncoding` currently in use, or `null`
  986. */
  987. get encoding() {
  988. return this[ENCODING];
  989. }
  990. /**
  991. * @deprecated - This is a read only property
  992. */
  993. set encoding(_enc) {
  994. throw new Error("Encoding must be set at instantiation time");
  995. }
  996. /**
  997. * @deprecated - Encoding may only be set at instantiation time
  998. */
  999. setEncoding(_enc) {
  1000. throw new Error("Encoding must be set at instantiation time");
  1001. }
  1002. /**
  1003. * True if this is an objectMode stream
  1004. */
  1005. get objectMode() {
  1006. return this[OBJECTMODE];
  1007. }
  1008. /**
  1009. * @deprecated - This is a read-only property
  1010. */
  1011. set objectMode(_om) {
  1012. throw new Error("objectMode must be set at instantiation time");
  1013. }
  1014. /**
  1015. * true if this is an async stream
  1016. */
  1017. get ["async"]() {
  1018. return this[ASYNC];
  1019. }
  1020. /**
  1021. * Set to true to make this stream async.
  1022. *
  1023. * Once set, it cannot be unset, as this would potentially cause incorrect
  1024. * behavior. Ie, a sync stream can be made async, but an async stream
  1025. * cannot be safely made sync.
  1026. */
  1027. set ["async"](a) {
  1028. this[ASYNC] = this[ASYNC] || !!a;
  1029. }
  1030. // drop everything and get out of the flow completely
  1031. [ABORT]() {
  1032. this[ABORTED] = true;
  1033. this.emit("abort", this[SIGNAL]?.reason);
  1034. this.destroy(this[SIGNAL]?.reason);
  1035. }
  1036. /**
  1037. * True if the stream has been aborted.
  1038. */
  1039. get aborted() {
  1040. return this[ABORTED];
  1041. }
  1042. /**
  1043. * No-op setter. Stream aborted status is set via the AbortSignal provided
  1044. * in the constructor options.
  1045. */
  1046. set aborted(_) {
  1047. }
  1048. write(chunk, encoding, cb) {
  1049. if (this[ABORTED])
  1050. return false;
  1051. if (this[EOF])
  1052. throw new Error("write after end");
  1053. if (this[DESTROYED]) {
  1054. this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" }));
  1055. return true;
  1056. }
  1057. if (typeof encoding === "function") {
  1058. cb = encoding;
  1059. encoding = "utf8";
  1060. }
  1061. if (!encoding)
  1062. encoding = "utf8";
  1063. const fn = this[ASYNC] ? defer : nodefer;
  1064. if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
  1065. if (isArrayBufferView(chunk)) {
  1066. chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
  1067. } else if (isArrayBufferLike(chunk)) {
  1068. chunk = Buffer.from(chunk);
  1069. } else if (typeof chunk !== "string") {
  1070. throw new Error("Non-contiguous data written to non-objectMode stream");
  1071. }
  1072. }
  1073. if (this[OBJECTMODE]) {
  1074. if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
  1075. this[FLUSH](true);
  1076. if (this[FLOWING])
  1077. this.emit("data", chunk);
  1078. else
  1079. this[BUFFERPUSH](chunk);
  1080. if (this[BUFFERLENGTH] !== 0)
  1081. this.emit("readable");
  1082. if (cb)
  1083. fn(cb);
  1084. return this[FLOWING];
  1085. }
  1086. if (!chunk.length) {
  1087. if (this[BUFFERLENGTH] !== 0)
  1088. this.emit("readable");
  1089. if (cb)
  1090. fn(cb);
  1091. return this[FLOWING];
  1092. }
  1093. if (typeof chunk === "string" && // unless it is a string already ready for us to use
  1094. !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) {
  1095. chunk = Buffer.from(chunk, encoding);
  1096. }
  1097. if (Buffer.isBuffer(chunk) && this[ENCODING]) {
  1098. chunk = this[DECODER].write(chunk);
  1099. }
  1100. if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
  1101. this[FLUSH](true);
  1102. if (this[FLOWING])
  1103. this.emit("data", chunk);
  1104. else
  1105. this[BUFFERPUSH](chunk);
  1106. if (this[BUFFERLENGTH] !== 0)
  1107. this.emit("readable");
  1108. if (cb)
  1109. fn(cb);
  1110. return this[FLOWING];
  1111. }
  1112. /**
  1113. * Low-level explicit read method.
  1114. *
  1115. * In objectMode, the argument is ignored, and one item is returned if
  1116. * available.
  1117. *
  1118. * `n` is the number of bytes (or in the case of encoding streams,
  1119. * characters) to consume. If `n` is not provided, then the entire buffer
  1120. * is returned, or `null` is returned if no data is available.
  1121. *
  1122. * If `n` is greater that the amount of data in the internal buffer,
  1123. * then `null` is returned.
  1124. */
  1125. read(n) {
  1126. if (this[DESTROYED])
  1127. return null;
  1128. this[DISCARDED] = false;
  1129. if (this[BUFFERLENGTH] === 0 || n === 0 || n && n > this[BUFFERLENGTH]) {
  1130. this[MAYBE_EMIT_END]();
  1131. return null;
  1132. }
  1133. if (this[OBJECTMODE])
  1134. n = null;
  1135. if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {
  1136. this[BUFFER] = [
  1137. this[ENCODING] ? this[BUFFER].join("") : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])
  1138. ];
  1139. }
  1140. const ret = this[READ](n || null, this[BUFFER][0]);
  1141. this[MAYBE_EMIT_END]();
  1142. return ret;
  1143. }
  1144. [READ](n, chunk) {
  1145. if (this[OBJECTMODE])
  1146. this[BUFFERSHIFT]();
  1147. else {
  1148. const c = chunk;
  1149. if (n === c.length || n === null)
  1150. this[BUFFERSHIFT]();
  1151. else if (typeof c === "string") {
  1152. this[BUFFER][0] = c.slice(n);
  1153. chunk = c.slice(0, n);
  1154. this[BUFFERLENGTH] -= n;
  1155. } else {
  1156. this[BUFFER][0] = c.subarray(n);
  1157. chunk = c.subarray(0, n);
  1158. this[BUFFERLENGTH] -= n;
  1159. }
  1160. }
  1161. this.emit("data", chunk);
  1162. if (!this[BUFFER].length && !this[EOF])
  1163. this.emit("drain");
  1164. return chunk;
  1165. }
  1166. end(chunk, encoding, cb) {
  1167. if (typeof chunk === "function") {
  1168. cb = chunk;
  1169. chunk = void 0;
  1170. }
  1171. if (typeof encoding === "function") {
  1172. cb = encoding;
  1173. encoding = "utf8";
  1174. }
  1175. if (chunk !== void 0)
  1176. this.write(chunk, encoding);
  1177. if (cb)
  1178. this.once("end", cb);
  1179. this[EOF] = true;
  1180. this.writable = false;
  1181. if (this[FLOWING] || !this[PAUSED])
  1182. this[MAYBE_EMIT_END]();
  1183. return this;
  1184. }
  1185. // don't let the internal resume be overwritten
  1186. [RESUME]() {
  1187. if (this[DESTROYED])
  1188. return;
  1189. if (!this[DATALISTENERS] && !this[PIPES].length) {
  1190. this[DISCARDED] = true;
  1191. }
  1192. this[PAUSED] = false;
  1193. this[FLOWING] = true;
  1194. this.emit("resume");
  1195. if (this[BUFFER].length)
  1196. this[FLUSH]();
  1197. else if (this[EOF])
  1198. this[MAYBE_EMIT_END]();
  1199. else
  1200. this.emit("drain");
  1201. }
  1202. /**
  1203. * Resume the stream if it is currently in a paused state
  1204. *
  1205. * If called when there are no pipe destinations or `data` event listeners,
  1206. * this will place the stream in a "discarded" state, where all data will
  1207. * be thrown away. The discarded state is removed if a pipe destination or
  1208. * data handler is added, if pause() is called, or if any synchronous or
  1209. * asynchronous iteration is started.
  1210. */
  1211. resume() {
  1212. return this[RESUME]();
  1213. }
  1214. /**
  1215. * Pause the stream
  1216. */
  1217. pause() {
  1218. this[FLOWING] = false;
  1219. this[PAUSED] = true;
  1220. this[DISCARDED] = false;
  1221. }
  1222. /**
  1223. * true if the stream has been forcibly destroyed
  1224. */
  1225. get destroyed() {
  1226. return this[DESTROYED];
  1227. }
  1228. /**
  1229. * true if the stream is currently in a flowing state, meaning that
  1230. * any writes will be immediately emitted.
  1231. */
  1232. get flowing() {
  1233. return this[FLOWING];
  1234. }
  1235. /**
  1236. * true if the stream is currently in a paused state
  1237. */
  1238. get paused() {
  1239. return this[PAUSED];
  1240. }
  1241. [BUFFERPUSH](chunk) {
  1242. if (this[OBJECTMODE])
  1243. this[BUFFERLENGTH] += 1;
  1244. else
  1245. this[BUFFERLENGTH] += chunk.length;
  1246. this[BUFFER].push(chunk);
  1247. }
  1248. [BUFFERSHIFT]() {
  1249. if (this[OBJECTMODE])
  1250. this[BUFFERLENGTH] -= 1;
  1251. else
  1252. this[BUFFERLENGTH] -= this[BUFFER][0].length;
  1253. return this[BUFFER].shift();
  1254. }
  1255. [FLUSH](noDrain = false) {
  1256. do {
  1257. } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
  1258. if (!noDrain && !this[BUFFER].length && !this[EOF])
  1259. this.emit("drain");
  1260. }
  1261. [FLUSHCHUNK](chunk) {
  1262. this.emit("data", chunk);
  1263. return this[FLOWING];
  1264. }
  1265. /**
  1266. * Pipe all data emitted by this stream into the destination provided.
  1267. *
  1268. * Triggers the flow of data.
  1269. */
  1270. pipe(dest, opts) {
  1271. if (this[DESTROYED])
  1272. return dest;
  1273. this[DISCARDED] = false;
  1274. const ended = this[EMITTED_END];
  1275. opts = opts || {};
  1276. if (dest === proc.stdout || dest === proc.stderr)
  1277. opts.end = false;
  1278. else
  1279. opts.end = opts.end !== false;
  1280. opts.proxyErrors = !!opts.proxyErrors;
  1281. if (ended) {
  1282. if (opts.end)
  1283. dest.end();
  1284. } else {
  1285. this[PIPES].push(!opts.proxyErrors ? new Pipe(this, dest, opts) : new PipeProxyErrors(this, dest, opts));
  1286. if (this[ASYNC])
  1287. defer(() => this[RESUME]());
  1288. else
  1289. this[RESUME]();
  1290. }
  1291. return dest;
  1292. }
  1293. /**
  1294. * Fully unhook a piped destination stream.
  1295. *
  1296. * If the destination stream was the only consumer of this stream (ie,
  1297. * there are no other piped destinations or `'data'` event listeners)
  1298. * then the flow of data will stop until there is another consumer or
  1299. * {@link Minipass#resume} is explicitly called.
  1300. */
  1301. unpipe(dest) {
  1302. const p = this[PIPES].find((p2) => p2.dest === dest);
  1303. if (p) {
  1304. if (this[PIPES].length === 1) {
  1305. if (this[FLOWING] && this[DATALISTENERS] === 0) {
  1306. this[FLOWING] = false;
  1307. }
  1308. this[PIPES] = [];
  1309. } else
  1310. this[PIPES].splice(this[PIPES].indexOf(p), 1);
  1311. p.unpipe();
  1312. }
  1313. }
  1314. /**
  1315. * Alias for {@link Minipass#on}
  1316. */
  1317. addListener(ev, handler) {
  1318. return this.on(ev, handler);
  1319. }
  1320. /**
  1321. * Mostly identical to `EventEmitter.on`, with the following
  1322. * behavior differences to prevent data loss and unnecessary hangs:
  1323. *
  1324. * - Adding a 'data' event handler will trigger the flow of data
  1325. *
  1326. * - Adding a 'readable' event handler when there is data waiting to be read
  1327. * will cause 'readable' to be emitted immediately.
  1328. *
  1329. * - Adding an 'endish' event handler ('end', 'finish', etc.) which has
  1330. * already passed will cause the event to be emitted immediately and all
  1331. * handlers removed.
  1332. *
  1333. * - Adding an 'error' event handler after an error has been emitted will
  1334. * cause the event to be re-emitted immediately with the error previously
  1335. * raised.
  1336. */
  1337. on(ev, handler) {
  1338. const ret = super.on(ev, handler);
  1339. if (ev === "data") {
  1340. this[DISCARDED] = false;
  1341. this[DATALISTENERS]++;
  1342. if (!this[PIPES].length && !this[FLOWING]) {
  1343. this[RESUME]();
  1344. }
  1345. } else if (ev === "readable" && this[BUFFERLENGTH] !== 0) {
  1346. super.emit("readable");
  1347. } else if (isEndish(ev) && this[EMITTED_END]) {
  1348. super.emit(ev);
  1349. this.removeAllListeners(ev);
  1350. } else if (ev === "error" && this[EMITTED_ERROR]) {
  1351. const h = handler;
  1352. if (this[ASYNC])
  1353. defer(() => h.call(this, this[EMITTED_ERROR]));
  1354. else
  1355. h.call(this, this[EMITTED_ERROR]);
  1356. }
  1357. return ret;
  1358. }
  1359. /**
  1360. * Alias for {@link Minipass#off}
  1361. */
  1362. removeListener(ev, handler) {
  1363. return this.off(ev, handler);
  1364. }
  1365. /**
  1366. * Mostly identical to `EventEmitter.off`
  1367. *
  1368. * If a 'data' event handler is removed, and it was the last consumer
  1369. * (ie, there are no pipe destinations or other 'data' event listeners),
  1370. * then the flow of data will stop until there is another consumer or
  1371. * {@link Minipass#resume} is explicitly called.
  1372. */
  1373. off(ev, handler) {
  1374. const ret = super.off(ev, handler);
  1375. if (ev === "data") {
  1376. this[DATALISTENERS] = this.listeners("data").length;
  1377. if (this[DATALISTENERS] === 0 && !this[DISCARDED] && !this[PIPES].length) {
  1378. this[FLOWING] = false;
  1379. }
  1380. }
  1381. return ret;
  1382. }
  1383. /**
  1384. * Mostly identical to `EventEmitter.removeAllListeners`
  1385. *
  1386. * If all 'data' event handlers are removed, and they were the last consumer
  1387. * (ie, there are no pipe destinations), then the flow of data will stop
  1388. * until there is another consumer or {@link Minipass#resume} is explicitly
  1389. * called.
  1390. */
  1391. removeAllListeners(ev) {
  1392. const ret = super.removeAllListeners(ev);
  1393. if (ev === "data" || ev === void 0) {
  1394. this[DATALISTENERS] = 0;
  1395. if (!this[DISCARDED] && !this[PIPES].length) {
  1396. this[FLOWING] = false;
  1397. }
  1398. }
  1399. return ret;
  1400. }
  1401. /**
  1402. * true if the 'end' event has been emitted
  1403. */
  1404. get emittedEnd() {
  1405. return this[EMITTED_END];
  1406. }
  1407. [MAYBE_EMIT_END]() {
  1408. if (!this[EMITTING_END] && !this[EMITTED_END] && !this[DESTROYED] && this[BUFFER].length === 0 && this[EOF]) {
  1409. this[EMITTING_END] = true;
  1410. this.emit("end");
  1411. this.emit("prefinish");
  1412. this.emit("finish");
  1413. if (this[CLOSED])
  1414. this.emit("close");
  1415. this[EMITTING_END] = false;
  1416. }
  1417. }
  1418. /**
  1419. * Mostly identical to `EventEmitter.emit`, with the following
  1420. * behavior differences to prevent data loss and unnecessary hangs:
  1421. *
  1422. * If the stream has been destroyed, and the event is something other
  1423. * than 'close' or 'error', then `false` is returned and no handlers
  1424. * are called.
  1425. *
  1426. * If the event is 'end', and has already been emitted, then the event
  1427. * is ignored. If the stream is in a paused or non-flowing state, then
  1428. * the event will be deferred until data flow resumes. If the stream is
  1429. * async, then handlers will be called on the next tick rather than
  1430. * immediately.
  1431. *
  1432. * If the event is 'close', and 'end' has not yet been emitted, then
  1433. * the event will be deferred until after 'end' is emitted.
  1434. *
  1435. * If the event is 'error', and an AbortSignal was provided for the stream,
  1436. * and there are no listeners, then the event is ignored, matching the
  1437. * behavior of node core streams in the presense of an AbortSignal.
  1438. *
  1439. * If the event is 'finish' or 'prefinish', then all listeners will be
  1440. * removed after emitting the event, to prevent double-firing.
  1441. */
  1442. emit(ev, ...args) {
  1443. const data = args[0];
  1444. if (ev !== "error" && ev !== "close" && ev !== DESTROYED && this[DESTROYED]) {
  1445. return false;
  1446. } else if (ev === "data") {
  1447. return !this[OBJECTMODE] && !data ? false : this[ASYNC] ? (defer(() => this[EMITDATA](data)), true) : this[EMITDATA](data);
  1448. } else if (ev === "end") {
  1449. return this[EMITEND]();
  1450. } else if (ev === "close") {
  1451. this[CLOSED] = true;
  1452. if (!this[EMITTED_END] && !this[DESTROYED])
  1453. return false;
  1454. const ret2 = super.emit("close");
  1455. this.removeAllListeners("close");
  1456. return ret2;
  1457. } else if (ev === "error") {
  1458. this[EMITTED_ERROR] = data;
  1459. super.emit(ERROR, data);
  1460. const ret2 = !this[SIGNAL] || this.listeners("error").length ? super.emit("error", data) : false;
  1461. this[MAYBE_EMIT_END]();
  1462. return ret2;
  1463. } else if (ev === "resume") {
  1464. const ret2 = super.emit("resume");
  1465. this[MAYBE_EMIT_END]();
  1466. return ret2;
  1467. } else if (ev === "finish" || ev === "prefinish") {
  1468. const ret2 = super.emit(ev);
  1469. this.removeAllListeners(ev);
  1470. return ret2;
  1471. }
  1472. const ret = super.emit(ev, ...args);
  1473. this[MAYBE_EMIT_END]();
  1474. return ret;
  1475. }
  1476. [EMITDATA](data) {
  1477. for (const p of this[PIPES]) {
  1478. if (p.dest.write(data) === false)
  1479. this.pause();
  1480. }
  1481. const ret = this[DISCARDED] ? false : super.emit("data", data);
  1482. this[MAYBE_EMIT_END]();
  1483. return ret;
  1484. }
  1485. [EMITEND]() {
  1486. if (this[EMITTED_END])
  1487. return false;
  1488. this[EMITTED_END] = true;
  1489. this.readable = false;
  1490. return this[ASYNC] ? (defer(() => this[EMITEND2]()), true) : this[EMITEND2]();
  1491. }
  1492. [EMITEND2]() {
  1493. if (this[DECODER]) {
  1494. const data = this[DECODER].end();
  1495. if (data) {
  1496. for (const p of this[PIPES]) {
  1497. p.dest.write(data);
  1498. }
  1499. if (!this[DISCARDED])
  1500. super.emit("data", data);
  1501. }
  1502. }
  1503. for (const p of this[PIPES]) {
  1504. p.end();
  1505. }
  1506. const ret = super.emit("end");
  1507. this.removeAllListeners("end");
  1508. return ret;
  1509. }
  1510. /**
  1511. * Return a Promise that resolves to an array of all emitted data once
  1512. * the stream ends.
  1513. */
  1514. async collect() {
  1515. const buf = Object.assign([], {
  1516. dataLength: 0
  1517. });
  1518. if (!this[OBJECTMODE])
  1519. buf.dataLength = 0;
  1520. const p = this.promise();
  1521. this.on("data", (c) => {
  1522. buf.push(c);
  1523. if (!this[OBJECTMODE])
  1524. buf.dataLength += c.length;
  1525. });
  1526. await p;
  1527. return buf;
  1528. }
  1529. /**
  1530. * Return a Promise that resolves to the concatenation of all emitted data
  1531. * once the stream ends.
  1532. *
  1533. * Not allowed on objectMode streams.
  1534. */
  1535. async concat() {
  1536. if (this[OBJECTMODE]) {
  1537. throw new Error("cannot concat in objectMode");
  1538. }
  1539. const buf = await this.collect();
  1540. return this[ENCODING] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
  1541. }
  1542. /**
  1543. * Return a void Promise that resolves once the stream ends.
  1544. */
  1545. async promise() {
  1546. return new Promise((resolve, reject) => {
  1547. this.on(DESTROYED, () => reject(new Error("stream destroyed")));
  1548. this.on("error", (er) => reject(er));
  1549. this.on("end", () => resolve());
  1550. });
  1551. }
  1552. /**
  1553. * Asynchronous `for await of` iteration.
  1554. *
  1555. * This will continue emitting all chunks until the stream terminates.
  1556. */
  1557. [Symbol.asyncIterator]() {
  1558. this[DISCARDED] = false;
  1559. let stopped = false;
  1560. const stop = async () => {
  1561. this.pause();
  1562. stopped = true;
  1563. return { value: void 0, done: true };
  1564. };
  1565. const next = () => {
  1566. if (stopped)
  1567. return stop();
  1568. const res = this.read();
  1569. if (res !== null)
  1570. return Promise.resolve({ done: false, value: res });
  1571. if (this[EOF])
  1572. return stop();
  1573. let resolve;
  1574. let reject;
  1575. const onerr = (er) => {
  1576. this.off("data", ondata);
  1577. this.off("end", onend);
  1578. this.off(DESTROYED, ondestroy);
  1579. stop();
  1580. reject(er);
  1581. };
  1582. const ondata = (value) => {
  1583. this.off("error", onerr);
  1584. this.off("end", onend);
  1585. this.off(DESTROYED, ondestroy);
  1586. this.pause();
  1587. resolve({ value, done: !!this[EOF] });
  1588. };
  1589. const onend = () => {
  1590. this.off("error", onerr);
  1591. this.off("data", ondata);
  1592. this.off(DESTROYED, ondestroy);
  1593. stop();
  1594. resolve({ done: true, value: void 0 });
  1595. };
  1596. const ondestroy = () => onerr(new Error("stream destroyed"));
  1597. return new Promise((res2, rej) => {
  1598. reject = rej;
  1599. resolve = res2;
  1600. this.once(DESTROYED, ondestroy);
  1601. this.once("error", onerr);
  1602. this.once("end", onend);
  1603. this.once("data", ondata);
  1604. });
  1605. };
  1606. return {
  1607. next,
  1608. throw: stop,
  1609. return: stop,
  1610. [Symbol.asyncIterator]() {
  1611. return this;
  1612. }
  1613. };
  1614. }
  1615. /**
  1616. * Synchronous `for of` iteration.
  1617. *
  1618. * The iteration will terminate when the internal buffer runs out, even
  1619. * if the stream has not yet terminated.
  1620. */
  1621. [Symbol.iterator]() {
  1622. this[DISCARDED] = false;
  1623. let stopped = false;
  1624. const stop = () => {
  1625. this.pause();
  1626. this.off(ERROR, stop);
  1627. this.off(DESTROYED, stop);
  1628. this.off("end", stop);
  1629. stopped = true;
  1630. return { done: true, value: void 0 };
  1631. };
  1632. const next = () => {
  1633. if (stopped)
  1634. return stop();
  1635. const value = this.read();
  1636. return value === null ? stop() : { done: false, value };
  1637. };
  1638. this.once("end", stop);
  1639. this.once(ERROR, stop);
  1640. this.once(DESTROYED, stop);
  1641. return {
  1642. next,
  1643. throw: stop,
  1644. return: stop,
  1645. [Symbol.iterator]() {
  1646. return this;
  1647. }
  1648. };
  1649. }
  1650. /**
  1651. * Destroy a stream, preventing it from being used for any further purpose.
  1652. *
  1653. * If the stream has a `close()` method, then it will be called on
  1654. * destruction.
  1655. *
  1656. * After destruction, any attempt to write data, read data, or emit most
  1657. * events will be ignored.
  1658. *
  1659. * If an error argument is provided, then it will be emitted in an
  1660. * 'error' event.
  1661. */
  1662. destroy(er) {
  1663. if (this[DESTROYED]) {
  1664. if (er)
  1665. this.emit("error", er);
  1666. else
  1667. this.emit(DESTROYED);
  1668. return this;
  1669. }
  1670. this[DESTROYED] = true;
  1671. this[DISCARDED] = true;
  1672. this[BUFFER].length = 0;
  1673. this[BUFFERLENGTH] = 0;
  1674. const wc = this;
  1675. if (typeof wc.close === "function" && !this[CLOSED])
  1676. wc.close();
  1677. if (er)
  1678. this.emit("error", er);
  1679. else
  1680. this.emit(DESTROYED);
  1681. return this;
  1682. }
  1683. /**
  1684. * Alias for {@link isStream}
  1685. *
  1686. * Former export location, maintained for backwards compatibility.
  1687. *
  1688. * @deprecated
  1689. */
  1690. static get isStream() {
  1691. return exports2.isStream;
  1692. }
  1693. };
  1694. exports2.Minipass = Minipass;
  1695. }
  1696. });
  1697. // ../node_modules/.pnpm/ssri@10.0.5/node_modules/ssri/lib/index.js
  1698. var require_lib2 = __commonJS({
  1699. "../node_modules/.pnpm/ssri@10.0.5/node_modules/ssri/lib/index.js"(exports2, module2) {
  1700. "use strict";
  1701. var crypto2 = require("crypto");
  1702. var { Minipass } = require_commonjs();
  1703. var SPEC_ALGORITHMS = ["sha512", "sha384", "sha256"];
  1704. var DEFAULT_ALGORITHMS = ["sha512"];
  1705. var BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i;
  1706. var SRI_REGEX = /^([a-z0-9]+)-([^?]+)([?\S*]*)$/;
  1707. var STRICT_SRI_REGEX = /^([a-z0-9]+)-([A-Za-z0-9+/=]{44,88})(\?[\x21-\x7E]*)?$/;
  1708. var VCHAR_REGEX = /^[\x21-\x7E]+$/;
  1709. var getOptString = (options) => options?.length ? `?${options.join("?")}` : "";
  1710. var IntegrityStream = class extends Minipass {
  1711. #emittedIntegrity;
  1712. #emittedSize;
  1713. #emittedVerified;
  1714. constructor(opts) {
  1715. super();
  1716. this.size = 0;
  1717. this.opts = opts;
  1718. this.#getOptions();
  1719. if (opts?.algorithms) {
  1720. this.algorithms = [...opts.algorithms];
  1721. } else {
  1722. this.algorithms = [...DEFAULT_ALGORITHMS];
  1723. }
  1724. if (this.algorithm !== null && !this.algorithms.includes(this.algorithm)) {
  1725. this.algorithms.push(this.algorithm);
  1726. }
  1727. this.hashes = this.algorithms.map(crypto2.createHash);
  1728. }
  1729. #getOptions() {
  1730. this.sri = this.opts?.integrity ? parse(this.opts?.integrity, this.opts) : null;
  1731. this.expectedSize = this.opts?.size;
  1732. if (!this.sri) {
  1733. this.algorithm = null;
  1734. } else if (this.sri.isHash) {
  1735. this.goodSri = true;
  1736. this.algorithm = this.sri.algorithm;
  1737. } else {
  1738. this.goodSri = !this.sri.isEmpty();
  1739. this.algorithm = this.sri.pickAlgorithm(this.opts);
  1740. }
  1741. this.digests = this.goodSri ? this.sri[this.algorithm] : null;
  1742. this.optString = getOptString(this.opts?.options);
  1743. }
  1744. on(ev, handler) {
  1745. if (ev === "size" && this.#emittedSize) {
  1746. return handler(this.#emittedSize);
  1747. }
  1748. if (ev === "integrity" && this.#emittedIntegrity) {
  1749. return handler(this.#emittedIntegrity);
  1750. }
  1751. if (ev === "verified" && this.#emittedVerified) {
  1752. return handler(this.#emittedVerified);
  1753. }
  1754. return super.on(ev, handler);
  1755. }
  1756. emit(ev, data) {
  1757. if (ev === "end") {
  1758. this.#onEnd();
  1759. }
  1760. return super.emit(ev, data);
  1761. }
  1762. write(data) {
  1763. this.size += data.length;
  1764. this.hashes.forEach((h) => h.update(data));
  1765. return super.write(data);
  1766. }
  1767. #onEnd() {
  1768. if (!this.goodSri) {
  1769. this.#getOptions();
  1770. }
  1771. const newSri = parse(this.hashes.map((h, i) => {
  1772. return `${this.algorithms[i]}-${h.digest("base64")}${this.optString}`;
  1773. }).join(" "), this.opts);
  1774. const match = this.goodSri && newSri.match(this.sri, this.opts);
  1775. if (typeof this.expectedSize === "number" && this.size !== this.expectedSize) {
  1776. const err = new Error(`stream size mismatch when checking ${this.sri}.
  1777. Wanted: ${this.expectedSize}
  1778. Found: ${this.size}`);
  1779. err.code = "EBADSIZE";
  1780. err.found = this.size;
  1781. err.expected = this.expectedSize;
  1782. err.sri = this.sri;
  1783. this.emit("error", err);
  1784. } else if (this.sri && !match) {
  1785. const err = new Error(`${this.sri} integrity checksum failed when using ${this.algorithm}: wanted ${this.digests} but got ${newSri}. (${this.size} bytes)`);
  1786. err.code = "EINTEGRITY";
  1787. err.found = newSri;
  1788. err.expected = this.digests;
  1789. err.algorithm = this.algorithm;
  1790. err.sri = this.sri;
  1791. this.emit("error", err);
  1792. } else {
  1793. this.#emittedSize = this.size;
  1794. this.emit("size", this.size);
  1795. this.#emittedIntegrity = newSri;
  1796. this.emit("integrity", newSri);
  1797. if (match) {
  1798. this.#emittedVerified = match;
  1799. this.emit("verified", match);
  1800. }
  1801. }
  1802. }
  1803. };
  1804. var Hash = class {
  1805. get isHash() {
  1806. return true;
  1807. }
  1808. constructor(hash, opts) {
  1809. const strict = opts?.strict;
  1810. this.source = hash.trim();
  1811. this.digest = "";
  1812. this.algorithm = "";
  1813. this.options = [];
  1814. const match = this.source.match(
  1815. strict ? STRICT_SRI_REGEX : SRI_REGEX
  1816. );
  1817. if (!match) {
  1818. return;
  1819. }
  1820. if (strict && !SPEC_ALGORITHMS.includes(match[1])) {
  1821. return;
  1822. }
  1823. this.algorithm = match[1];
  1824. this.digest = match[2];
  1825. const rawOpts = match[3];
  1826. if (rawOpts) {
  1827. this.options = rawOpts.slice(1).split("?");
  1828. }
  1829. }
  1830. hexDigest() {
  1831. return this.digest && Buffer.from(this.digest, "base64").toString("hex");
  1832. }
  1833. toJSON() {
  1834. return this.toString();
  1835. }
  1836. match(integrity, opts) {
  1837. const other = parse(integrity, opts);
  1838. if (!other) {
  1839. return false;
  1840. }
  1841. if (other.isIntegrity) {
  1842. const algo = other.pickAlgorithm(opts, [this.algorithm]);
  1843. if (!algo) {
  1844. return false;
  1845. }
  1846. const foundHash = other[algo].find((hash) => hash.digest === this.digest);
  1847. if (foundHash) {
  1848. return foundHash;
  1849. }
  1850. return false;
  1851. }
  1852. return other.digest === this.digest ? other : false;
  1853. }
  1854. toString(opts) {
  1855. if (opts?.strict) {
  1856. if (!// The spec has very restricted productions for algorithms.
  1857. // https://www.w3.org/TR/CSP2/#source-list-syntax
  1858. (SPEC_ALGORITHMS.includes(this.algorithm) && // Usually, if someone insists on using a "different" base64, we
  1859. // leave it as-is, since there's multiple standards, and the
  1860. // specified is not a URL-safe variant.
  1861. // https://www.w3.org/TR/CSP2/#base64_value
  1862. this.digest.match(BASE64_REGEX) && // Option syntax is strictly visual chars.
  1863. // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-option-expression
  1864. // https://tools.ietf.org/html/rfc5234#appendix-B.1
  1865. this.options.every((opt) => opt.match(VCHAR_REGEX)))) {
  1866. return "";
  1867. }
  1868. }
  1869. return `${this.algorithm}-${this.digest}${getOptString(this.options)}`;
  1870. }
  1871. };
  1872. function integrityHashToString(toString, sep, opts, hashes) {
  1873. const toStringIsNotEmpty = toString !== "";
  1874. let shouldAddFirstSep = false;
  1875. let complement = "";
  1876. const lastIndex = hashes.length - 1;
  1877. for (let i = 0; i < lastIndex; i++) {
  1878. const hashString = Hash.prototype.toString.call(hashes[i], opts);
  1879. if (hashString) {
  1880. shouldAddFirstSep = true;
  1881. complement += hashString;
  1882. complement += sep;
  1883. }
  1884. }
  1885. const finalHashString = Hash.prototype.toString.call(hashes[lastIndex], opts);
  1886. if (finalHashString) {
  1887. shouldAddFirstSep = true;
  1888. complement += finalHashString;
  1889. }
  1890. if (toStringIsNotEmpty && shouldAddFirstSep) {
  1891. return toString + sep + complement;
  1892. }
  1893. return toString + complement;
  1894. }
  1895. var Integrity = class {
  1896. get isIntegrity() {
  1897. return true;
  1898. }
  1899. toJSON() {
  1900. return this.toString();
  1901. }
  1902. isEmpty() {
  1903. return Object.keys(this).length === 0;
  1904. }
  1905. toString(opts) {
  1906. let sep = opts?.sep || " ";
  1907. let toString = "";
  1908. if (opts?.strict) {
  1909. sep = sep.replace(/\S+/g, " ");
  1910. for (const hash of SPEC_ALGORITHMS) {
  1911. if (this[hash]) {
  1912. toString = integrityHashToString(toString, sep, opts, this[hash]);
  1913. }
  1914. }
  1915. } else {
  1916. for (const hash of Object.keys(this)) {
  1917. toString = integrityHashToString(toString, sep, opts, this[hash]);
  1918. }
  1919. }
  1920. return toString;
  1921. }
  1922. concat(integrity, opts) {
  1923. const other = typeof integrity === "string" ? integrity : stringify(integrity, opts);
  1924. return parse(`${this.toString(opts)} ${other}`, opts);
  1925. }
  1926. hexDigest() {
  1927. return parse(this, { single: true }).hexDigest();
  1928. }
  1929. // add additional hashes to an integrity value, but prevent
  1930. // *changing* an existing integrity hash.
  1931. merge(integrity, opts) {
  1932. const other = parse(integrity, opts);
  1933. for (const algo in other) {
  1934. if (this[algo]) {
  1935. if (!this[algo].find((hash) => other[algo].find((otherhash) => hash.digest === otherhash.digest))) {
  1936. throw new Error("hashes do not match, cannot update integrity");
  1937. }
  1938. } else {
  1939. this[algo] = other[algo];
  1940. }
  1941. }
  1942. }
  1943. match(integrity, opts) {
  1944. const other = parse(integrity, opts);
  1945. if (!other) {
  1946. return false;
  1947. }
  1948. const algo = other.pickAlgorithm(opts, Object.keys(this));
  1949. return !!algo && this[algo] && other[algo] && this[algo].find(
  1950. (hash) => other[algo].find(
  1951. (otherhash) => hash.digest === otherhash.digest
  1952. )
  1953. ) || false;
  1954. }
  1955. // Pick the highest priority algorithm present, optionally also limited to a
  1956. // set of hashes found in another integrity. When limiting it may return
  1957. // nothing.
  1958. pickAlgorithm(opts, hashes) {
  1959. const pickAlgorithm = opts?.pickAlgorithm || getPrioritizedHash;
  1960. const keys = Object.keys(this).filter((k) => {
  1961. if (hashes?.length) {
  1962. return hashes.includes(k);
  1963. }
  1964. return true;
  1965. });
  1966. if (keys.length) {
  1967. return keys.reduce((acc, algo) => pickAlgorithm(acc, algo) || acc);
  1968. }
  1969. return null;
  1970. }
  1971. };
  1972. module2.exports.parse = parse;
  1973. function parse(sri, opts) {
  1974. if (!sri) {
  1975. return null;
  1976. }
  1977. if (typeof sri === "string") {
  1978. return _parse(sri, opts);
  1979. } else if (sri.algorithm && sri.digest) {
  1980. const fullSri = new Integrity();
  1981. fullSri[sri.algorithm] = [sri];
  1982. return _parse(stringify(fullSri, opts), opts);
  1983. } else {
  1984. return _parse(stringify(sri, opts), opts);
  1985. }
  1986. }
  1987. function _parse(integrity, opts) {
  1988. if (opts?.single) {
  1989. return new Hash(integrity, opts);
  1990. }
  1991. const hashes = integrity.trim().split(/\s+/).reduce((acc, string) => {
  1992. const hash = new Hash(string, opts);
  1993. if (hash.algorithm && hash.digest) {
  1994. const algo = hash.algorithm;
  1995. if (!acc[algo]) {
  1996. acc[algo] = [];
  1997. }
  1998. acc[algo].push(hash);
  1999. }
  2000. return acc;
  2001. }, new Integrity());
  2002. return hashes.isEmpty() ? null : hashes;
  2003. }
  2004. module2.exports.stringify = stringify;
  2005. function stringify(obj, opts) {
  2006. if (obj.algorithm && obj.digest) {
  2007. return Hash.prototype.toString.call(obj, opts);
  2008. } else if (typeof obj === "string") {
  2009. return stringify(parse(obj, opts), opts);
  2010. } else {
  2011. return Integrity.prototype.toString.call(obj, opts);
  2012. }
  2013. }
  2014. module2.exports.fromHex = fromHex;
  2015. function fromHex(hexDigest, algorithm, opts) {
  2016. const optString = getOptString(opts?.options);
  2017. return parse(
  2018. `${algorithm}-${Buffer.from(hexDigest, "hex").toString("base64")}${optString}`,
  2019. opts
  2020. );
  2021. }
  2022. module2.exports.fromData = fromData;
  2023. function fromData(data, opts) {
  2024. const algorithms = opts?.algorithms || [...DEFAULT_ALGORITHMS];
  2025. const optString = getOptString(opts?.options);
  2026. return algorithms.reduce((acc, algo) => {
  2027. const digest = crypto2.createHash(algo).update(data).digest("base64");
  2028. const hash = new Hash(
  2029. `${algo}-${digest}${optString}`,
  2030. opts
  2031. );
  2032. if (hash.algorithm && hash.digest) {
  2033. const hashAlgo = hash.algorithm;
  2034. if (!acc[hashAlgo]) {
  2035. acc[hashAlgo] = [];
  2036. }
  2037. acc[hashAlgo].push(hash);
  2038. }
  2039. return acc;
  2040. }, new Integrity());
  2041. }
  2042. module2.exports.fromStream = fromStream;
  2043. function fromStream(stream, opts) {
  2044. const istream = integrityStream(opts);
  2045. return new Promise((resolve, reject) => {
  2046. stream.pipe(istream);
  2047. stream.on("error", reject);
  2048. istream.on("error", reject);
  2049. let sri;
  2050. istream.on("integrity", (s) => {
  2051. sri = s;
  2052. });
  2053. istream.on("end", () => resolve(sri));
  2054. istream.resume();
  2055. });
  2056. }
  2057. module2.exports.checkData = checkData;
  2058. function checkData(data, sri, opts) {
  2059. sri = parse(sri, opts);
  2060. if (!sri || !Object.keys(sri).length) {
  2061. if (opts?.error) {
  2062. throw Object.assign(
  2063. new Error("No valid integrity hashes to check against"),
  2064. {
  2065. code: "EINTEGRITY"
  2066. }
  2067. );
  2068. } else {
  2069. return false;
  2070. }
  2071. }
  2072. const algorithm = sri.pickAlgorithm(opts);
  2073. const digest = crypto2.createHash(algorithm).update(data).digest("base64");
  2074. const newSri = parse({ algorithm, digest });
  2075. const match = newSri.match(sri, opts);
  2076. opts = opts || {};
  2077. if (match || !opts.error) {
  2078. return match;
  2079. } else if (typeof opts.size === "number" && data.length !== opts.size) {
  2080. const err = new Error(`data size mismatch when checking ${sri}.
  2081. Wanted: ${opts.size}
  2082. Found: ${data.length}`);
  2083. err.code = "EBADSIZE";
  2084. err.found = data.length;
  2085. err.expected = opts.size;
  2086. err.sri = sri;
  2087. throw err;
  2088. } else {
  2089. const err = new Error(`Integrity checksum failed when using ${algorithm}: Wanted ${sri}, but got ${newSri}. (${data.length} bytes)`);
  2090. err.code = "EINTEGRITY";
  2091. err.found = newSri;
  2092. err.expected = sri;
  2093. err.algorithm = algorithm;
  2094. err.sri = sri;
  2095. throw err;
  2096. }
  2097. }
  2098. module2.exports.checkStream = checkStream;
  2099. function checkStream(stream, sri, opts) {
  2100. opts = opts || /* @__PURE__ */ Object.create(null);
  2101. opts.integrity = sri;
  2102. sri = parse(sri, opts);
  2103. if (!sri || !Object.keys(sri).length) {
  2104. return Promise.reject(Object.assign(
  2105. new Error("No valid integrity hashes to check against"),
  2106. {
  2107. code: "EINTEGRITY"
  2108. }
  2109. ));
  2110. }
  2111. const checker = integrityStream(opts);
  2112. return new Promise((resolve, reject) => {
  2113. stream.pipe(checker);
  2114. stream.on("error", reject);
  2115. checker.on("error", reject);
  2116. let verified;
  2117. checker.on("verified", (s) => {
  2118. verified = s;
  2119. });
  2120. checker.on("end", () => resolve(verified));
  2121. checker.resume();
  2122. });
  2123. }
  2124. module2.exports.integrityStream = integrityStream;
  2125. function integrityStream(opts = /* @__PURE__ */ Object.create(null)) {
  2126. return new IntegrityStream(opts);
  2127. }
  2128. module2.exports.create = createIntegrity;
  2129. function createIntegrity(opts) {
  2130. const algorithms = opts?.algorithms || [...DEFAULT_ALGORITHMS];
  2131. const optString = getOptString(opts?.options);
  2132. const hashes = algorithms.map(crypto2.createHash);
  2133. return {
  2134. update: function(chunk, enc) {
  2135. hashes.forEach((h) => h.update(chunk, enc));
  2136. return this;
  2137. },
  2138. digest: function(enc) {
  2139. const integrity = algorithms.reduce((acc, algo) => {
  2140. const digest = hashes.shift().digest("base64");
  2141. const hash = new Hash(
  2142. `${algo}-${digest}${optString}`,
  2143. opts
  2144. );
  2145. if (hash.algorithm && hash.digest) {
  2146. const hashAlgo = hash.algorithm;
  2147. if (!acc[hashAlgo]) {
  2148. acc[hashAlgo] = [];
  2149. }
  2150. acc[hashAlgo].push(hash);
  2151. }
  2152. return acc;
  2153. }, new Integrity());
  2154. return integrity;
  2155. }
  2156. };
  2157. }
  2158. var NODE_HASHES = crypto2.getHashes();
  2159. var DEFAULT_PRIORITY = [
  2160. "md5",
  2161. "whirlpool",
  2162. "sha1",
  2163. "sha224",
  2164. "sha256",
  2165. "sha384",
  2166. "sha512",
  2167. // TODO - it's unclear _which_ of these Node will actually use as its name
  2168. // for the algorithm, so we guesswork it based on the OpenSSL names.
  2169. "sha3",
  2170. "sha3-256",
  2171. "sha3-384",
  2172. "sha3-512",
  2173. "sha3_256",
  2174. "sha3_384",
  2175. "sha3_512"
  2176. ].filter((algo) => NODE_HASHES.includes(algo));
  2177. function getPrioritizedHash(algo1, algo2) {
  2178. return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase()) ? algo1 : algo2;
  2179. }
  2180. }
  2181. });
  2182. // ../node_modules/.pnpm/strip-bom@4.0.0/node_modules/strip-bom/index.js
  2183. var require_strip_bom = __commonJS({
  2184. "../node_modules/.pnpm/strip-bom@4.0.0/node_modules/strip-bom/index.js"(exports2, module2) {
  2185. "use strict";
  2186. module2.exports = (string) => {
  2187. if (typeof string !== "string") {
  2188. throw new TypeError(`Expected a string, got ${typeof string}`);
  2189. }
  2190. if (string.charCodeAt(0) === 65279) {
  2191. return string.slice(1);
  2192. }
  2193. return string;
  2194. };
  2195. }
  2196. });
  2197. // ../store/cafs/lib/parseJson.js
  2198. var require_parseJson = __commonJS({
  2199. "../store/cafs/lib/parseJson.js"(exports2) {
  2200. "use strict";
  2201. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  2202. return mod && mod.__esModule ? mod : { "default": mod };
  2203. };
  2204. Object.defineProperty(exports2, "__esModule", { value: true });
  2205. exports2.parseJsonBufferSync = parseJsonBufferSync;
  2206. var strip_bom_1 = __importDefault2(require_strip_bom());
  2207. function parseJsonBufferSync(buffer) {
  2208. return JSON.parse((0, strip_bom_1.default)(buffer.toString()));
  2209. }
  2210. }
  2211. });
  2212. // ../store/cafs/lib/addFilesFromDir.js
  2213. var require_addFilesFromDir = __commonJS({
  2214. "../store/cafs/lib/addFilesFromDir.js"(exports2) {
  2215. "use strict";
  2216. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  2217. return mod && mod.__esModule ? mod : { "default": mod };
  2218. };
  2219. Object.defineProperty(exports2, "__esModule", { value: true });
  2220. exports2.addFilesFromDir = addFilesFromDir2;
  2221. var util_1 = __importDefault2(require("util"));
  2222. var fs_12 = __importDefault2(require("fs"));
  2223. var path_12 = __importDefault2(require("path"));
  2224. var graceful_fs_12 = __importDefault2(require_lib());
  2225. var parseJson_1 = require_parseJson();
  2226. function addFilesFromDir2(addBuffer, dirname, opts = {}) {
  2227. const filesIndex = {};
  2228. let manifest;
  2229. let files;
  2230. if (opts.files) {
  2231. files = [];
  2232. for (const file of opts.files) {
  2233. const absolutePath = path_12.default.join(dirname, file);
  2234. let stat;
  2235. try {
  2236. stat = fs_12.default.statSync(absolutePath);
  2237. } catch (err) {
  2238. if (!(util_1.default.types.isNativeError(err) && "code" in err && err.code === "ENOENT")) {
  2239. throw err;
  2240. }
  2241. continue;
  2242. }
  2243. files.push({
  2244. absolutePath,
  2245. relativePath: file,
  2246. stat
  2247. });
  2248. }
  2249. } else {
  2250. files = findFilesInDir(dirname);
  2251. }
  2252. for (const { absolutePath, relativePath, stat } of files) {
  2253. const buffer = graceful_fs_12.default.readFileSync(absolutePath);
  2254. if (opts.readManifest && relativePath === "package.json") {
  2255. manifest = (0, parseJson_1.parseJsonBufferSync)(buffer);
  2256. }
  2257. const mode = stat.mode & 511;
  2258. filesIndex[relativePath] = {
  2259. mode,
  2260. size: stat.size,
  2261. ...addBuffer(buffer, mode)
  2262. };
  2263. }
  2264. return { manifest, filesIndex };
  2265. }
  2266. function findFilesInDir(dir) {
  2267. const files = [];
  2268. findFiles(files, dir);
  2269. return files;
  2270. }
  2271. function findFiles(filesList, dir, relativeDir = "") {
  2272. const files = fs_12.default.readdirSync(dir, { withFileTypes: true });
  2273. for (const file of files) {
  2274. const relativeSubdir = `${relativeDir}${relativeDir ? "/" : ""}${file.name}`;
  2275. if (file.isDirectory()) {
  2276. if (relativeDir !== "" || file.name !== "node_modules") {
  2277. findFiles(filesList, path_12.default.join(dir, file.name), relativeSubdir);
  2278. }
  2279. continue;
  2280. }
  2281. const absolutePath = path_12.default.join(dir, file.name);
  2282. let stat;
  2283. try {
  2284. stat = fs_12.default.statSync(absolutePath);
  2285. } catch (err) {
  2286. if (err.code !== "ENOENT") {
  2287. throw err;
  2288. }
  2289. continue;
  2290. }
  2291. if (stat.isDirectory()) {
  2292. findFiles(filesList, path_12.default.join(dir, file.name), relativeSubdir);
  2293. continue;
  2294. }
  2295. filesList.push({
  2296. relativePath: relativeSubdir,
  2297. absolutePath,
  2298. stat
  2299. });
  2300. }
  2301. }
  2302. }
  2303. });
  2304. // ../node_modules/.pnpm/is-gzip@2.0.0/node_modules/is-gzip/index.js
  2305. var require_is_gzip = __commonJS({
  2306. "../node_modules/.pnpm/is-gzip@2.0.0/node_modules/is-gzip/index.js"(exports2, module2) {
  2307. "use strict";
  2308. module2.exports = (buf) => {
  2309. if (!buf || buf.length < 3) {
  2310. return false;
  2311. }
  2312. return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
  2313. };
  2314. }
  2315. });
  2316. // ../store/cafs/lib/parseTarball.js
  2317. var require_parseTarball = __commonJS({
  2318. "../store/cafs/lib/parseTarball.js"(exports2) {
  2319. "use strict";
  2320. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  2321. return mod && mod.__esModule ? mod : { "default": mod };
  2322. };
  2323. Object.defineProperty(exports2, "__esModule", { value: true });
  2324. exports2.parseTarball = parseTarball;
  2325. var path_12 = __importDefault2(require("path"));
  2326. var ZERO = "0".charCodeAt(0);
  2327. var FILE_TYPE_HARD_LINK = "1".charCodeAt(0);
  2328. var FILE_TYPE_SYMLINK = "2".charCodeAt(0);
  2329. var FILE_TYPE_DIRECTORY = "5".charCodeAt(0);
  2330. var SPACE = " ".charCodeAt(0);
  2331. var SLASH = "/".charCodeAt(0);
  2332. var BACKSLASH = "\\".charCodeAt(0);
  2333. var FILE_TYPE_PAX_HEADER = "x".charCodeAt(0);
  2334. var FILE_TYPE_PAX_GLOBAL_HEADER = "g".charCodeAt(0);
  2335. var FILE_TYPE_LONGLINK = "L".charCodeAt(0);
  2336. var MODE_OFFSET = 100;
  2337. var FILE_SIZE_OFFSET = 124;
  2338. var CHECKSUM_OFFSET = 148;
  2339. var FILE_TYPE_OFFSET = 156;
  2340. var PREFIX_OFFSET = 345;
  2341. function parseTarball(buffer) {
  2342. const files = /* @__PURE__ */ new Map();
  2343. let pathTrimmed = false;
  2344. let mode = 0;
  2345. let fileSize = 0;
  2346. let fileType = 0;
  2347. let prefix = "";
  2348. let fileName = "";
  2349. let longLinkPath = "";
  2350. let paxHeaderPath = "";
  2351. let paxHeaderFileSize;
  2352. let blockBytes = 0;
  2353. let blockStart = 0;
  2354. while (buffer[blockStart] !== 0) {
  2355. fileType = buffer[blockStart + FILE_TYPE_OFFSET];
  2356. if (paxHeaderFileSize !== void 0) {
  2357. fileSize = paxHeaderFileSize;
  2358. paxHeaderFileSize = void 0;
  2359. } else {
  2360. fileSize = parseOctal(blockStart + FILE_SIZE_OFFSET, 12);
  2361. }
  2362. blockBytes = (fileSize & ~511) + (fileSize & 511 ? 1024 : 512);
  2363. const expectedCheckSum = parseOctal(blockStart + CHECKSUM_OFFSET, 8);
  2364. const actualCheckSum = checkSum(blockStart);
  2365. if (expectedCheckSum !== actualCheckSum) {
  2366. throw new Error(`Invalid checksum for TAR header at offset ${blockStart}. Expected ${expectedCheckSum}, got ${actualCheckSum}`);
  2367. }
  2368. pathTrimmed = false;
  2369. if (longLinkPath) {
  2370. fileName = longLinkPath;
  2371. longLinkPath = "";
  2372. } else if (paxHeaderPath) {
  2373. fileName = paxHeaderPath;
  2374. paxHeaderPath = "";
  2375. } else {
  2376. prefix = parseString(blockStart + PREFIX_OFFSET, 155);
  2377. if (prefix && !pathTrimmed) {
  2378. pathTrimmed = true;
  2379. prefix = "";
  2380. }
  2381. fileName = parseString(blockStart, MODE_OFFSET);
  2382. if (prefix) {
  2383. fileName = `${prefix}/${fileName}`;
  2384. }
  2385. }
  2386. if (fileName.includes("./")) {
  2387. fileName = path_12.default.posix.join("/", fileName).slice(1);
  2388. }
  2389. switch (fileType) {
  2390. case 0:
  2391. case ZERO:
  2392. case FILE_TYPE_HARD_LINK:
  2393. mode = parseOctal(blockStart + MODE_OFFSET, 8);
  2394. files.set(fileName.replaceAll("//", "/"), { offset: blockStart + 512, mode, size: fileSize });
  2395. break;
  2396. case FILE_TYPE_DIRECTORY:
  2397. case FILE_TYPE_SYMLINK:
  2398. break;
  2399. case FILE_TYPE_PAX_HEADER:
  2400. parsePaxHeader(blockStart + 512, fileSize, false);
  2401. break;
  2402. case FILE_TYPE_PAX_GLOBAL_HEADER:
  2403. parsePaxHeader(blockStart + 512, fileSize, true);
  2404. break;
  2405. case FILE_TYPE_LONGLINK: {
  2406. longLinkPath = buffer.toString("utf8", blockStart + 512, blockStart + 512 + fileSize).replace(/\0.*/, "");
  2407. const slashIndex = longLinkPath.indexOf("/");
  2408. if (slashIndex >= 0) {
  2409. longLinkPath = longLinkPath.slice(slashIndex + 1);
  2410. }
  2411. break;
  2412. }
  2413. default:
  2414. throw new Error(`Unsupported file type ${fileType} for file ${fileName}.`);
  2415. }
  2416. blockStart += blockBytes;
  2417. }
  2418. return { files, buffer: buffer.buffer };
  2419. function checkSum(offset) {
  2420. let sum = 256;
  2421. let i = offset;
  2422. const checksumStart = offset + 148;
  2423. const checksumEnd = offset + 156;
  2424. const blockEnd = offset + 512;
  2425. for (; i < checksumStart; i++) {
  2426. sum += buffer[i];
  2427. }
  2428. for (i = checksumEnd; i < blockEnd; i++) {
  2429. sum += buffer[i];
  2430. }
  2431. return sum;
  2432. }
  2433. function parsePaxHeader(offset, length, global2) {
  2434. const end = offset + length;
  2435. let i = offset;
  2436. while (i < end) {
  2437. const lineStart = i;
  2438. while (i < end && buffer[i] !== SPACE) {
  2439. i++;
  2440. }
  2441. const strLen = buffer.toString("utf-8", lineStart, i);
  2442. const len = parseInt(strLen, 10);
  2443. if (!len) {
  2444. throw new Error(`Invalid length in PAX record: ${strLen}`);
  2445. }
  2446. i++;
  2447. const lineEnd = lineStart + len;
  2448. const record = buffer.toString("utf-8", i, lineEnd - 1);
  2449. i = lineEnd;
  2450. const equalSign = record.indexOf("=");
  2451. const keyword = record.slice(0, equalSign);
  2452. if (keyword === "path") {
  2453. const slashIndex = record.indexOf("/", equalSign + 1);
  2454. if (global2) {
  2455. throw new Error(`Unexpected global PAX path: ${record}`);
  2456. }
  2457. paxHeaderPath = record.slice(slashIndex >= 0 ? slashIndex + 1 : equalSign + 1);
  2458. } else if (keyword === "size") {
  2459. const size = parseInt(record.slice(equalSign + 1), 10);
  2460. if (isNaN(size) || size < 0) {
  2461. throw new Error(`Invalid size in PAX record: ${record}`);
  2462. }
  2463. if (global2) {
  2464. throw new Error(`Unexpected global PAX file size: ${record}`);
  2465. }
  2466. paxHeaderFileSize = size;
  2467. } else {
  2468. continue;
  2469. }
  2470. }
  2471. }
  2472. function parseString(offset, length) {
  2473. let end = offset;
  2474. const max = length + offset;
  2475. for (let char = buffer[end]; char !== 0 && end !== max; char = buffer[++end]) {
  2476. if (!pathTrimmed && (char === SLASH || char === BACKSLASH)) {
  2477. pathTrimmed = true;
  2478. offset = end + 1;
  2479. }
  2480. }
  2481. return buffer.toString("utf8", offset, end);
  2482. }
  2483. function parseOctal(offset, length) {
  2484. const val = buffer.subarray(offset, offset + length);
  2485. offset = 0;
  2486. while (offset < val.length && val[offset] === SPACE)
  2487. offset++;
  2488. const end = clamp(indexOf(val, SPACE, offset, val.length), val.length, val.length);
  2489. while (offset < end && val[offset] === 0)
  2490. offset++;
  2491. if (end === offset)
  2492. return 0;
  2493. return parseInt(val.slice(offset, end).toString(), 8);
  2494. }
  2495. }
  2496. function indexOf(block, num, offset, end) {
  2497. for (; offset < end; offset++) {
  2498. if (block[offset] === num)
  2499. return offset;
  2500. }
  2501. return end;
  2502. }
  2503. function clamp(index, len, defaultValue) {
  2504. if (typeof index !== "number")
  2505. return defaultValue;
  2506. index = ~~index;
  2507. if (index >= len)
  2508. return len;
  2509. if (index >= 0)
  2510. return index;
  2511. index += len;
  2512. if (index >= 0)
  2513. return index;
  2514. return 0;
  2515. }
  2516. }
  2517. });
  2518. // ../store/cafs/lib/addFilesFromTarball.js
  2519. var require_addFilesFromTarball = __commonJS({
  2520. "../store/cafs/lib/addFilesFromTarball.js"(exports2) {
  2521. "use strict";
  2522. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  2523. return mod && mod.__esModule ? mod : { "default": mod };
  2524. };
  2525. Object.defineProperty(exports2, "__esModule", { value: true });
  2526. exports2.addFilesFromTarball = addFilesFromTarball;
  2527. var is_gzip_1 = __importDefault2(require_is_gzip());
  2528. var zlib_1 = require("zlib");
  2529. var parseJson_1 = require_parseJson();
  2530. var parseTarball_1 = require_parseTarball();
  2531. function addFilesFromTarball(addBufferToCafs, _ignore, tarballBuffer, readManifest) {
  2532. const ignore = _ignore ?? (() => false);
  2533. const tarContent = (0, is_gzip_1.default)(tarballBuffer) ? (0, zlib_1.gunzipSync)(tarballBuffer) : Buffer.isBuffer(tarballBuffer) ? tarballBuffer : Buffer.from(tarballBuffer);
  2534. const { files } = (0, parseTarball_1.parseTarball)(tarContent);
  2535. const filesIndex = {};
  2536. let manifestBuffer;
  2537. for (const [relativePath, { mode, offset, size }] of files) {
  2538. if (ignore(relativePath))
  2539. continue;
  2540. const fileBuffer = tarContent.subarray(offset, offset + size);
  2541. if (readManifest && relativePath === "package.json") {
  2542. manifestBuffer = fileBuffer;
  2543. }
  2544. filesIndex[relativePath] = {
  2545. mode,
  2546. size,
  2547. ...addBufferToCafs(fileBuffer, mode)
  2548. };
  2549. }
  2550. return {
  2551. filesIndex,
  2552. manifest: manifestBuffer ? (0, parseJson_1.parseJsonBufferSync)(manifestBuffer) : void 0
  2553. };
  2554. }
  2555. }
  2556. });
  2557. // ../node_modules/.pnpm/@zkochan+rimraf@3.0.2/node_modules/@zkochan/rimraf/index.js
  2558. var require_rimraf = __commonJS({
  2559. "../node_modules/.pnpm/@zkochan+rimraf@3.0.2/node_modules/@zkochan/rimraf/index.js"(exports2, module2) {
  2560. var fs = require("fs");
  2561. module2.exports = async (p) => {
  2562. try {
  2563. await fs.promises.rm(p, { recursive: true, force: true, maxRetries: 3 });
  2564. } catch (err) {
  2565. if (err.code === "ENOENT") return;
  2566. throw err;
  2567. }
  2568. };
  2569. module2.exports.sync = (p) => {
  2570. try {
  2571. fs.rmSync(p, { recursive: true, force: true, maxRetries: 3 });
  2572. } catch (err) {
  2573. if (err.code === "ENOENT") return;
  2574. throw err;
  2575. }
  2576. };
  2577. }
  2578. });
  2579. // ../store/cafs/lib/getFilePathInCafs.js
  2580. var require_getFilePathInCafs = __commonJS({
  2581. "../store/cafs/lib/getFilePathInCafs.js"(exports2) {
  2582. "use strict";
  2583. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  2584. return mod && mod.__esModule ? mod : { "default": mod };
  2585. };
  2586. Object.defineProperty(exports2, "__esModule", { value: true });
  2587. exports2.modeIsExecutable = void 0;
  2588. exports2.getFilePathByModeInCafs = getFilePathByModeInCafs;
  2589. exports2.getIndexFilePathInCafs = getIndexFilePathInCafs;
  2590. exports2.contentPathFromHex = contentPathFromHex;
  2591. var path_12 = __importDefault2(require("path"));
  2592. var ssri_1 = __importDefault2(require_lib2());
  2593. var modeIsExecutable = (mode) => (mode & 73) !== 0;
  2594. exports2.modeIsExecutable = modeIsExecutable;
  2595. function getFilePathByModeInCafs(storeDir, integrity, mode) {
  2596. const fileType = (0, exports2.modeIsExecutable)(mode) ? "exec" : "nonexec";
  2597. return path_12.default.join(storeDir, contentPathFromIntegrity(integrity, fileType));
  2598. }
  2599. function getIndexFilePathInCafs(storeDir, integrity, pkgId) {
  2600. const hex = ssri_1.default.parse(integrity, { single: true }).hexDigest().substring(0, 64);
  2601. return path_12.default.join(storeDir, `index/${path_12.default.join(hex.slice(0, 2), hex.slice(2))}-${pkgId.replace(/[\\/:*?"<>|]/g, "+")}.json`);
  2602. }
  2603. function contentPathFromIntegrity(integrity, fileType) {
  2604. const sri = ssri_1.default.parse(integrity, { single: true });
  2605. return contentPathFromHex(fileType, sri.hexDigest());
  2606. }
  2607. function contentPathFromHex(fileType, hex) {
  2608. const p = path_12.default.join("files", hex.slice(0, 2), hex.slice(2));
  2609. switch (fileType) {
  2610. case "exec":
  2611. return `${p}-exec`;
  2612. case "nonexec":
  2613. return p;
  2614. case "index":
  2615. return `${p}-index.json`;
  2616. }
  2617. }
  2618. }
  2619. });
  2620. // ../store/cafs/lib/checkPkgFilesIntegrity.js
  2621. var require_checkPkgFilesIntegrity = __commonJS({
  2622. "../store/cafs/lib/checkPkgFilesIntegrity.js"(exports2) {
  2623. "use strict";
  2624. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  2625. return mod && mod.__esModule ? mod : { "default": mod };
  2626. };
  2627. Object.defineProperty(exports2, "__esModule", { value: true });
  2628. exports2.checkPkgFilesIntegrity = checkPkgFilesIntegrity;
  2629. exports2.verifyFileIntegrity = verifyFileIntegrity;
  2630. var fs_12 = __importDefault2(require("fs"));
  2631. var util_1 = __importDefault2(require("util"));
  2632. var graceful_fs_12 = __importDefault2(require_lib());
  2633. var rimraf_1 = __importDefault2(require_rimraf());
  2634. var ssri_1 = __importDefault2(require_lib2());
  2635. var getFilePathInCafs_1 = require_getFilePathInCafs();
  2636. var parseJson_1 = require_parseJson();
  2637. global["verifiedFileIntegrity"] = 0;
  2638. function checkPkgFilesIntegrity(storeDir, pkgIndex, readManifest) {
  2639. const verifiedFilesCache = /* @__PURE__ */ new Set();
  2640. const _checkFilesIntegrity = checkFilesIntegrity.bind(null, verifiedFilesCache, storeDir);
  2641. const verified = _checkFilesIntegrity(pkgIndex.files, readManifest);
  2642. if (!verified)
  2643. return { passed: false };
  2644. if (pkgIndex.sideEffects) {
  2645. for (const [sideEffectName, { added }] of Object.entries(pkgIndex.sideEffects)) {
  2646. if (added) {
  2647. const { passed } = _checkFilesIntegrity(added);
  2648. if (!passed) {
  2649. delete pkgIndex.sideEffects[sideEffectName];
  2650. }
  2651. }
  2652. }
  2653. }
  2654. return verified;
  2655. }
  2656. function checkFilesIntegrity(verifiedFilesCache, storeDir, files, readManifest) {
  2657. let allVerified = true;
  2658. let manifest;
  2659. for (const [f, fstat] of Object.entries(files)) {
  2660. if (!fstat.integrity) {
  2661. throw new Error(`Integrity checksum is missing for ${f}`);
  2662. }
  2663. const filename = (0, getFilePathInCafs_1.getFilePathByModeInCafs)(storeDir, fstat.integrity, fstat.mode);
  2664. const readFile = readManifest && f === "package.json";
  2665. if (!readFile && verifiedFilesCache.has(filename))
  2666. continue;
  2667. const verifyResult = verifyFile(filename, fstat, readFile);
  2668. if (readFile) {
  2669. manifest = verifyResult.manifest;
  2670. }
  2671. if (verifyResult.passed) {
  2672. verifiedFilesCache.add(filename);
  2673. } else {
  2674. allVerified = false;
  2675. }
  2676. }
  2677. return {
  2678. passed: allVerified,
  2679. manifest
  2680. };
  2681. }
  2682. function verifyFile(filename, fstat, readManifest) {
  2683. const currentFile = checkFile(filename, fstat.checkedAt);
  2684. if (currentFile == null)
  2685. return { passed: false };
  2686. if (currentFile.isModified) {
  2687. if (currentFile.size !== fstat.size) {
  2688. rimraf_1.default.sync(filename);
  2689. return { passed: false };
  2690. }
  2691. return verifyFileIntegrity(filename, fstat, readManifest);
  2692. }
  2693. if (readManifest) {
  2694. return {
  2695. passed: true,
  2696. manifest: (0, parseJson_1.parseJsonBufferSync)(graceful_fs_12.default.readFileSync(filename))
  2697. };
  2698. }
  2699. return { passed: true };
  2700. }
  2701. function verifyFileIntegrity(filename, expectedFile, readManifest) {
  2702. global["verifiedFileIntegrity"]++;
  2703. try {
  2704. const data = graceful_fs_12.default.readFileSync(filename);
  2705. const passed = Boolean(ssri_1.default.checkData(data, expectedFile.integrity));
  2706. if (!passed) {
  2707. graceful_fs_12.default.unlinkSync(filename);
  2708. return { passed };
  2709. } else if (readManifest) {
  2710. return {
  2711. passed,
  2712. manifest: (0, parseJson_1.parseJsonBufferSync)(data)
  2713. };
  2714. }
  2715. return { passed };
  2716. } catch (err) {
  2717. switch (util_1.default.types.isNativeError(err) && "code" in err && err.code) {
  2718. case "ENOENT":
  2719. return { passed: false };
  2720. case "EINTEGRITY": {
  2721. graceful_fs_12.default.unlinkSync(filename);
  2722. return { passed: false };
  2723. }
  2724. }
  2725. throw err;
  2726. }
  2727. }
  2728. function checkFile(filename, checkedAt) {
  2729. try {
  2730. const { mtimeMs, size } = fs_12.default.statSync(filename);
  2731. return {
  2732. isModified: mtimeMs - (checkedAt ?? 0) > 100,
  2733. size
  2734. };
  2735. } catch (err) {
  2736. if (util_1.default.types.isNativeError(err) && "code" in err && err.code === "ENOENT")
  2737. return null;
  2738. throw err;
  2739. }
  2740. }
  2741. }
  2742. });
  2743. // ../store/cafs/lib/readManifestFromStore.js
  2744. var require_readManifestFromStore = __commonJS({
  2745. "../store/cafs/lib/readManifestFromStore.js"(exports2) {
  2746. "use strict";
  2747. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  2748. return mod && mod.__esModule ? mod : { "default": mod };
  2749. };
  2750. Object.defineProperty(exports2, "__esModule", { value: true });
  2751. exports2.readManifestFromStore = readManifestFromStore;
  2752. var graceful_fs_12 = __importDefault2(require_lib());
  2753. var getFilePathInCafs_1 = require_getFilePathInCafs();
  2754. var parseJson_1 = require_parseJson();
  2755. function readManifestFromStore(storeDir, pkgIndex) {
  2756. const pkg = pkgIndex.files["package.json"];
  2757. if (pkg) {
  2758. const fileName = (0, getFilePathInCafs_1.getFilePathByModeInCafs)(storeDir, pkg.integrity, pkg.mode);
  2759. return (0, parseJson_1.parseJsonBufferSync)(graceful_fs_12.default.readFileSync(fileName));
  2760. }
  2761. return void 0;
  2762. }
  2763. }
  2764. });
  2765. // ../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
  2766. var require_universalify = __commonJS({
  2767. "../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports2) {
  2768. "use strict";
  2769. exports2.fromCallback = function(fn) {
  2770. return Object.defineProperty(function(...args) {
  2771. if (typeof args[args.length - 1] === "function") fn.apply(this, args);
  2772. else {
  2773. return new Promise((resolve, reject) => {
  2774. args.push((err, res) => err != null ? reject(err) : resolve(res));
  2775. fn.apply(this, args);
  2776. });
  2777. }
  2778. }, "name", { value: fn.name });
  2779. };
  2780. exports2.fromPromise = function(fn) {
  2781. return Object.defineProperty(function(...args) {
  2782. const cb = args[args.length - 1];
  2783. if (typeof cb !== "function") return fn.apply(this, args);
  2784. else {
  2785. args.pop();
  2786. fn.apply(this, args).then((r) => cb(null, r), cb);
  2787. }
  2788. }, "name", { value: fn.name });
  2789. };
  2790. }
  2791. });
  2792. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/fs/index.js
  2793. var require_fs = __commonJS({
  2794. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/fs/index.js"(exports2) {
  2795. "use strict";
  2796. var u = require_universalify().fromCallback;
  2797. var fs = require_graceful_fs();
  2798. var api = [
  2799. "access",
  2800. "appendFile",
  2801. "chmod",
  2802. "chown",
  2803. "close",
  2804. "copyFile",
  2805. "cp",
  2806. "fchmod",
  2807. "fchown",
  2808. "fdatasync",
  2809. "fstat",
  2810. "fsync",
  2811. "ftruncate",
  2812. "futimes",
  2813. "glob",
  2814. "lchmod",
  2815. "lchown",
  2816. "lutimes",
  2817. "link",
  2818. "lstat",
  2819. "mkdir",
  2820. "mkdtemp",
  2821. "open",
  2822. "opendir",
  2823. "readdir",
  2824. "readFile",
  2825. "readlink",
  2826. "realpath",
  2827. "rename",
  2828. "rm",
  2829. "rmdir",
  2830. "stat",
  2831. "statfs",
  2832. "symlink",
  2833. "truncate",
  2834. "unlink",
  2835. "utimes",
  2836. "writeFile"
  2837. ].filter((key) => {
  2838. return typeof fs[key] === "function";
  2839. });
  2840. Object.assign(exports2, fs);
  2841. api.forEach((method) => {
  2842. exports2[method] = u(fs[method]);
  2843. });
  2844. exports2.exists = function(filename, callback) {
  2845. if (typeof callback === "function") {
  2846. return fs.exists(filename, callback);
  2847. }
  2848. return new Promise((resolve) => {
  2849. return fs.exists(filename, resolve);
  2850. });
  2851. };
  2852. exports2.read = function(fd, buffer, offset, length, position, callback) {
  2853. if (typeof callback === "function") {
  2854. return fs.read(fd, buffer, offset, length, position, callback);
  2855. }
  2856. return new Promise((resolve, reject) => {
  2857. fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
  2858. if (err) return reject(err);
  2859. resolve({ bytesRead, buffer: buffer2 });
  2860. });
  2861. });
  2862. };
  2863. exports2.write = function(fd, buffer, ...args) {
  2864. if (typeof args[args.length - 1] === "function") {
  2865. return fs.write(fd, buffer, ...args);
  2866. }
  2867. return new Promise((resolve, reject) => {
  2868. fs.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
  2869. if (err) return reject(err);
  2870. resolve({ bytesWritten, buffer: buffer2 });
  2871. });
  2872. });
  2873. };
  2874. exports2.readv = function(fd, buffers, ...args) {
  2875. if (typeof args[args.length - 1] === "function") {
  2876. return fs.readv(fd, buffers, ...args);
  2877. }
  2878. return new Promise((resolve, reject) => {
  2879. fs.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
  2880. if (err) return reject(err);
  2881. resolve({ bytesRead, buffers: buffers2 });
  2882. });
  2883. });
  2884. };
  2885. exports2.writev = function(fd, buffers, ...args) {
  2886. if (typeof args[args.length - 1] === "function") {
  2887. return fs.writev(fd, buffers, ...args);
  2888. }
  2889. return new Promise((resolve, reject) => {
  2890. fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
  2891. if (err) return reject(err);
  2892. resolve({ bytesWritten, buffers: buffers2 });
  2893. });
  2894. });
  2895. };
  2896. if (typeof fs.realpath.native === "function") {
  2897. exports2.realpath.native = u(fs.realpath.native);
  2898. } else {
  2899. process.emitWarning(
  2900. "fs.realpath.native is not a function. Is fs being monkey-patched?",
  2901. "Warning",
  2902. "fs-extra-WARN0003"
  2903. );
  2904. }
  2905. }
  2906. });
  2907. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js
  2908. var require_utils = __commonJS({
  2909. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
  2910. "use strict";
  2911. var path = require("path");
  2912. module2.exports.checkPath = function checkPath(pth) {
  2913. if (process.platform === "win32") {
  2914. const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
  2915. if (pathHasInvalidWinCharacters) {
  2916. const error = new Error(`Path contains invalid characters: ${pth}`);
  2917. error.code = "EINVAL";
  2918. throw error;
  2919. }
  2920. }
  2921. };
  2922. }
  2923. });
  2924. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/make-dir.js
  2925. var require_make_dir = __commonJS({
  2926. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
  2927. "use strict";
  2928. var fs = require_fs();
  2929. var { checkPath } = require_utils();
  2930. var getMode = (options) => {
  2931. const defaults = { mode: 511 };
  2932. if (typeof options === "number") return options;
  2933. return { ...defaults, ...options }.mode;
  2934. };
  2935. module2.exports.makeDir = async (dir, options) => {
  2936. checkPath(dir);
  2937. return fs.mkdir(dir, {
  2938. mode: getMode(options),
  2939. recursive: true
  2940. });
  2941. };
  2942. module2.exports.makeDirSync = (dir, options) => {
  2943. checkPath(dir);
  2944. return fs.mkdirSync(dir, {
  2945. mode: getMode(options),
  2946. recursive: true
  2947. });
  2948. };
  2949. }
  2950. });
  2951. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/index.js
  2952. var require_mkdirs = __commonJS({
  2953. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports2, module2) {
  2954. "use strict";
  2955. var u = require_universalify().fromPromise;
  2956. var { makeDir: _makeDir, makeDirSync } = require_make_dir();
  2957. var makeDir = u(_makeDir);
  2958. module2.exports = {
  2959. mkdirs: makeDir,
  2960. mkdirsSync: makeDirSync,
  2961. // alias
  2962. mkdirp: makeDir,
  2963. mkdirpSync: makeDirSync,
  2964. ensureDir: makeDir,
  2965. ensureDirSync: makeDirSync
  2966. };
  2967. }
  2968. });
  2969. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/path-exists/index.js
  2970. var require_path_exists = __commonJS({
  2971. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) {
  2972. "use strict";
  2973. var u = require_universalify().fromPromise;
  2974. var fs = require_fs();
  2975. function pathExists(path) {
  2976. return fs.access(path).then(() => true).catch(() => false);
  2977. }
  2978. module2.exports = {
  2979. pathExists: u(pathExists),
  2980. pathExistsSync: fs.existsSync
  2981. };
  2982. }
  2983. });
  2984. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/utimes.js
  2985. var require_utimes = __commonJS({
  2986. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) {
  2987. "use strict";
  2988. var fs = require_fs();
  2989. var u = require_universalify().fromPromise;
  2990. async function utimesMillis(path, atime, mtime) {
  2991. const fd = await fs.open(path, "r+");
  2992. let closeErr = null;
  2993. try {
  2994. await fs.futimes(fd, atime, mtime);
  2995. } finally {
  2996. try {
  2997. await fs.close(fd);
  2998. } catch (e) {
  2999. closeErr = e;
  3000. }
  3001. }
  3002. if (closeErr) {
  3003. throw closeErr;
  3004. }
  3005. }
  3006. function utimesMillisSync(path, atime, mtime) {
  3007. const fd = fs.openSync(path, "r+");
  3008. fs.futimesSync(fd, atime, mtime);
  3009. return fs.closeSync(fd);
  3010. }
  3011. module2.exports = {
  3012. utimesMillis: u(utimesMillis),
  3013. utimesMillisSync
  3014. };
  3015. }
  3016. });
  3017. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js
  3018. var require_stat = __commonJS({
  3019. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
  3020. "use strict";
  3021. var fs = require_fs();
  3022. var path = require("path");
  3023. var u = require_universalify().fromPromise;
  3024. function getStats(src, dest, opts) {
  3025. const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true });
  3026. return Promise.all([
  3027. statFunc(src),
  3028. statFunc(dest).catch((err) => {
  3029. if (err.code === "ENOENT") return null;
  3030. throw err;
  3031. })
  3032. ]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
  3033. }
  3034. function getStatsSync(src, dest, opts) {
  3035. let destStat;
  3036. const statFunc = opts.dereference ? (file) => fs.statSync(file, { bigint: true }) : (file) => fs.lstatSync(file, { bigint: true });
  3037. const srcStat = statFunc(src);
  3038. try {
  3039. destStat = statFunc(dest);
  3040. } catch (err) {
  3041. if (err.code === "ENOENT") return { srcStat, destStat: null };
  3042. throw err;
  3043. }
  3044. return { srcStat, destStat };
  3045. }
  3046. async function checkPaths(src, dest, funcName, opts) {
  3047. const { srcStat, destStat } = await getStats(src, dest, opts);
  3048. if (destStat) {
  3049. if (areIdentical(srcStat, destStat)) {
  3050. const srcBaseName = path.basename(src);
  3051. const destBaseName = path.basename(dest);
  3052. if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
  3053. return { srcStat, destStat, isChangingCase: true };
  3054. }
  3055. throw new Error("Source and destination must not be the same.");
  3056. }
  3057. if (srcStat.isDirectory() && !destStat.isDirectory()) {
  3058. throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
  3059. }
  3060. if (!srcStat.isDirectory() && destStat.isDirectory()) {
  3061. throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
  3062. }
  3063. }
  3064. if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
  3065. throw new Error(errMsg(src, dest, funcName));
  3066. }
  3067. return { srcStat, destStat };
  3068. }
  3069. function checkPathsSync(src, dest, funcName, opts) {
  3070. const { srcStat, destStat } = getStatsSync(src, dest, opts);
  3071. if (destStat) {
  3072. if (areIdentical(srcStat, destStat)) {
  3073. const srcBaseName = path.basename(src);
  3074. const destBaseName = path.basename(dest);
  3075. if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
  3076. return { srcStat, destStat, isChangingCase: true };
  3077. }
  3078. throw new Error("Source and destination must not be the same.");
  3079. }
  3080. if (srcStat.isDirectory() && !destStat.isDirectory()) {
  3081. throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
  3082. }
  3083. if (!srcStat.isDirectory() && destStat.isDirectory()) {
  3084. throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
  3085. }
  3086. }
  3087. if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
  3088. throw new Error(errMsg(src, dest, funcName));
  3089. }
  3090. return { srcStat, destStat };
  3091. }
  3092. async function checkParentPaths(src, srcStat, dest, funcName) {
  3093. const srcParent = path.resolve(path.dirname(src));
  3094. const destParent = path.resolve(path.dirname(dest));
  3095. if (destParent === srcParent || destParent === path.parse(destParent).root) return;
  3096. let destStat;
  3097. try {
  3098. destStat = await fs.stat(destParent, { bigint: true });
  3099. } catch (err) {
  3100. if (err.code === "ENOENT") return;
  3101. throw err;
  3102. }
  3103. if (areIdentical(srcStat, destStat)) {
  3104. throw new Error(errMsg(src, dest, funcName));
  3105. }
  3106. return checkParentPaths(src, srcStat, destParent, funcName);
  3107. }
  3108. function checkParentPathsSync(src, srcStat, dest, funcName) {
  3109. const srcParent = path.resolve(path.dirname(src));
  3110. const destParent = path.resolve(path.dirname(dest));
  3111. if (destParent === srcParent || destParent === path.parse(destParent).root) return;
  3112. let destStat;
  3113. try {
  3114. destStat = fs.statSync(destParent, { bigint: true });
  3115. } catch (err) {
  3116. if (err.code === "ENOENT") return;
  3117. throw err;
  3118. }
  3119. if (areIdentical(srcStat, destStat)) {
  3120. throw new Error(errMsg(src, dest, funcName));
  3121. }
  3122. return checkParentPathsSync(src, srcStat, destParent, funcName);
  3123. }
  3124. function areIdentical(srcStat, destStat) {
  3125. return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
  3126. }
  3127. function isSrcSubdir(src, dest) {
  3128. const srcArr = path.resolve(src).split(path.sep).filter((i) => i);
  3129. const destArr = path.resolve(dest).split(path.sep).filter((i) => i);
  3130. return srcArr.every((cur, i) => destArr[i] === cur);
  3131. }
  3132. function errMsg(src, dest, funcName) {
  3133. return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
  3134. }
  3135. module2.exports = {
  3136. // checkPaths
  3137. checkPaths: u(checkPaths),
  3138. checkPathsSync,
  3139. // checkParent
  3140. checkParentPaths: u(checkParentPaths),
  3141. checkParentPathsSync,
  3142. // Misc
  3143. isSrcSubdir,
  3144. areIdentical
  3145. };
  3146. }
  3147. });
  3148. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy.js
  3149. var require_copy = __commonJS({
  3150. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
  3151. "use strict";
  3152. var fs = require_fs();
  3153. var path = require("path");
  3154. var { mkdirs } = require_mkdirs();
  3155. var { pathExists } = require_path_exists();
  3156. var { utimesMillis } = require_utimes();
  3157. var stat = require_stat();
  3158. async function copy(src, dest, opts = {}) {
  3159. if (typeof opts === "function") {
  3160. opts = { filter: opts };
  3161. }
  3162. opts.clobber = "clobber" in opts ? !!opts.clobber : true;
  3163. opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
  3164. if (opts.preserveTimestamps && process.arch === "ia32") {
  3165. process.emitWarning(
  3166. "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
  3167. "Warning",
  3168. "fs-extra-WARN0001"
  3169. );
  3170. }
  3171. const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
  3172. await stat.checkParentPaths(src, srcStat, dest, "copy");
  3173. const include = await runFilter(src, dest, opts);
  3174. if (!include) return;
  3175. const destParent = path.dirname(dest);
  3176. const dirExists = await pathExists(destParent);
  3177. if (!dirExists) {
  3178. await mkdirs(destParent);
  3179. }
  3180. await getStatsAndPerformCopy(destStat, src, dest, opts);
  3181. }
  3182. async function runFilter(src, dest, opts) {
  3183. if (!opts.filter) return true;
  3184. return opts.filter(src, dest);
  3185. }
  3186. async function getStatsAndPerformCopy(destStat, src, dest, opts) {
  3187. const statFn = opts.dereference ? fs.stat : fs.lstat;
  3188. const srcStat = await statFn(src);
  3189. if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
  3190. if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
  3191. if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
  3192. if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
  3193. if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
  3194. throw new Error(`Unknown file: ${src}`);
  3195. }
  3196. async function onFile(srcStat, destStat, src, dest, opts) {
  3197. if (!destStat) return copyFile(srcStat, src, dest, opts);
  3198. if (opts.overwrite) {
  3199. await fs.unlink(dest);
  3200. return copyFile(srcStat, src, dest, opts);
  3201. }
  3202. if (opts.errorOnExist) {
  3203. throw new Error(`'${dest}' already exists`);
  3204. }
  3205. }
  3206. async function copyFile(srcStat, src, dest, opts) {
  3207. await fs.copyFile(src, dest);
  3208. if (opts.preserveTimestamps) {
  3209. if (fileIsNotWritable(srcStat.mode)) {
  3210. await makeFileWritable(dest, srcStat.mode);
  3211. }
  3212. const updatedSrcStat = await fs.stat(src);
  3213. await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
  3214. }
  3215. return fs.chmod(dest, srcStat.mode);
  3216. }
  3217. function fileIsNotWritable(srcMode) {
  3218. return (srcMode & 128) === 0;
  3219. }
  3220. function makeFileWritable(dest, srcMode) {
  3221. return fs.chmod(dest, srcMode | 128);
  3222. }
  3223. async function onDir(srcStat, destStat, src, dest, opts) {
  3224. if (!destStat) {
  3225. await fs.mkdir(dest);
  3226. }
  3227. const promises = [];
  3228. for await (const item of await fs.opendir(src)) {
  3229. const srcItem = path.join(src, item.name);
  3230. const destItem = path.join(dest, item.name);
  3231. promises.push(
  3232. runFilter(srcItem, destItem, opts).then((include) => {
  3233. if (include) {
  3234. return stat.checkPaths(srcItem, destItem, "copy", opts).then(({ destStat: destStat2 }) => {
  3235. return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
  3236. });
  3237. }
  3238. })
  3239. );
  3240. }
  3241. await Promise.all(promises);
  3242. if (!destStat) {
  3243. await fs.chmod(dest, srcStat.mode);
  3244. }
  3245. }
  3246. async function onLink(destStat, src, dest, opts) {
  3247. let resolvedSrc = await fs.readlink(src);
  3248. if (opts.dereference) {
  3249. resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
  3250. }
  3251. if (!destStat) {
  3252. return fs.symlink(resolvedSrc, dest);
  3253. }
  3254. let resolvedDest = null;
  3255. try {
  3256. resolvedDest = await fs.readlink(dest);
  3257. } catch (e) {
  3258. if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs.symlink(resolvedSrc, dest);
  3259. throw e;
  3260. }
  3261. if (opts.dereference) {
  3262. resolvedDest = path.resolve(process.cwd(), resolvedDest);
  3263. }
  3264. if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
  3265. throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
  3266. }
  3267. if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
  3268. throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
  3269. }
  3270. await fs.unlink(dest);
  3271. return fs.symlink(resolvedSrc, dest);
  3272. }
  3273. module2.exports = copy;
  3274. }
  3275. });
  3276. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy-sync.js
  3277. var require_copy_sync = __commonJS({
  3278. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
  3279. "use strict";
  3280. var fs = require_graceful_fs();
  3281. var path = require("path");
  3282. var mkdirsSync = require_mkdirs().mkdirsSync;
  3283. var utimesMillisSync = require_utimes().utimesMillisSync;
  3284. var stat = require_stat();
  3285. function copySync(src, dest, opts) {
  3286. if (typeof opts === "function") {
  3287. opts = { filter: opts };
  3288. }
  3289. opts = opts || {};
  3290. opts.clobber = "clobber" in opts ? !!opts.clobber : true;
  3291. opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
  3292. if (opts.preserveTimestamps && process.arch === "ia32") {
  3293. process.emitWarning(
  3294. "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
  3295. "Warning",
  3296. "fs-extra-WARN0002"
  3297. );
  3298. }
  3299. const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
  3300. stat.checkParentPathsSync(src, srcStat, dest, "copy");
  3301. if (opts.filter && !opts.filter(src, dest)) return;
  3302. const destParent = path.dirname(dest);
  3303. if (!fs.existsSync(destParent)) mkdirsSync(destParent);
  3304. return getStats(destStat, src, dest, opts);
  3305. }
  3306. function getStats(destStat, src, dest, opts) {
  3307. const statSync = opts.dereference ? fs.statSync : fs.lstatSync;
  3308. const srcStat = statSync(src);
  3309. if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
  3310. else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
  3311. else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
  3312. else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
  3313. else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
  3314. throw new Error(`Unknown file: ${src}`);
  3315. }
  3316. function onFile(srcStat, destStat, src, dest, opts) {
  3317. if (!destStat) return copyFile(srcStat, src, dest, opts);
  3318. return mayCopyFile(srcStat, src, dest, opts);
  3319. }
  3320. function mayCopyFile(srcStat, src, dest, opts) {
  3321. if (opts.overwrite) {
  3322. fs.unlinkSync(dest);
  3323. return copyFile(srcStat, src, dest, opts);
  3324. } else if (opts.errorOnExist) {
  3325. throw new Error(`'${dest}' already exists`);
  3326. }
  3327. }
  3328. function copyFile(srcStat, src, dest, opts) {
  3329. fs.copyFileSync(src, dest);
  3330. if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
  3331. return setDestMode(dest, srcStat.mode);
  3332. }
  3333. function handleTimestamps(srcMode, src, dest) {
  3334. if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
  3335. return setDestTimestamps(src, dest);
  3336. }
  3337. function fileIsNotWritable(srcMode) {
  3338. return (srcMode & 128) === 0;
  3339. }
  3340. function makeFileWritable(dest, srcMode) {
  3341. return setDestMode(dest, srcMode | 128);
  3342. }
  3343. function setDestMode(dest, srcMode) {
  3344. return fs.chmodSync(dest, srcMode);
  3345. }
  3346. function setDestTimestamps(src, dest) {
  3347. const updatedSrcStat = fs.statSync(src);
  3348. return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
  3349. }
  3350. function onDir(srcStat, destStat, src, dest, opts) {
  3351. if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
  3352. return copyDir(src, dest, opts);
  3353. }
  3354. function mkDirAndCopy(srcMode, src, dest, opts) {
  3355. fs.mkdirSync(dest);
  3356. copyDir(src, dest, opts);
  3357. return setDestMode(dest, srcMode);
  3358. }
  3359. function copyDir(src, dest, opts) {
  3360. const dir = fs.opendirSync(src);
  3361. try {
  3362. let dirent;
  3363. while ((dirent = dir.readSync()) !== null) {
  3364. copyDirItem(dirent.name, src, dest, opts);
  3365. }
  3366. } finally {
  3367. dir.closeSync();
  3368. }
  3369. }
  3370. function copyDirItem(item, src, dest, opts) {
  3371. const srcItem = path.join(src, item);
  3372. const destItem = path.join(dest, item);
  3373. if (opts.filter && !opts.filter(srcItem, destItem)) return;
  3374. const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
  3375. return getStats(destStat, srcItem, destItem, opts);
  3376. }
  3377. function onLink(destStat, src, dest, opts) {
  3378. let resolvedSrc = fs.readlinkSync(src);
  3379. if (opts.dereference) {
  3380. resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
  3381. }
  3382. if (!destStat) {
  3383. return fs.symlinkSync(resolvedSrc, dest);
  3384. } else {
  3385. let resolvedDest;
  3386. try {
  3387. resolvedDest = fs.readlinkSync(dest);
  3388. } catch (err) {
  3389. if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs.symlinkSync(resolvedSrc, dest);
  3390. throw err;
  3391. }
  3392. if (opts.dereference) {
  3393. resolvedDest = path.resolve(process.cwd(), resolvedDest);
  3394. }
  3395. if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
  3396. throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
  3397. }
  3398. if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
  3399. throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
  3400. }
  3401. return copyLink(resolvedSrc, dest);
  3402. }
  3403. }
  3404. function copyLink(resolvedSrc, dest) {
  3405. fs.unlinkSync(dest);
  3406. return fs.symlinkSync(resolvedSrc, dest);
  3407. }
  3408. module2.exports = copySync;
  3409. }
  3410. });
  3411. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/index.js
  3412. var require_copy2 = __commonJS({
  3413. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/index.js"(exports2, module2) {
  3414. "use strict";
  3415. var u = require_universalify().fromPromise;
  3416. module2.exports = {
  3417. copy: u(require_copy()),
  3418. copySync: require_copy_sync()
  3419. };
  3420. }
  3421. });
  3422. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/remove/index.js
  3423. var require_remove = __commonJS({
  3424. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/remove/index.js"(exports2, module2) {
  3425. "use strict";
  3426. var fs = require_graceful_fs();
  3427. var u = require_universalify().fromCallback;
  3428. function remove(path, callback) {
  3429. fs.rm(path, { recursive: true, force: true }, callback);
  3430. }
  3431. function removeSync(path) {
  3432. fs.rmSync(path, { recursive: true, force: true });
  3433. }
  3434. module2.exports = {
  3435. remove: u(remove),
  3436. removeSync
  3437. };
  3438. }
  3439. });
  3440. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/empty/index.js
  3441. var require_empty = __commonJS({
  3442. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/empty/index.js"(exports2, module2) {
  3443. "use strict";
  3444. var u = require_universalify().fromPromise;
  3445. var fs = require_fs();
  3446. var path = require("path");
  3447. var mkdir = require_mkdirs();
  3448. var remove = require_remove();
  3449. var emptyDir = u(async function emptyDir2(dir) {
  3450. let items;
  3451. try {
  3452. items = await fs.readdir(dir);
  3453. } catch {
  3454. return mkdir.mkdirs(dir);
  3455. }
  3456. return Promise.all(items.map((item) => remove.remove(path.join(dir, item))));
  3457. });
  3458. function emptyDirSync(dir) {
  3459. let items;
  3460. try {
  3461. items = fs.readdirSync(dir);
  3462. } catch {
  3463. return mkdir.mkdirsSync(dir);
  3464. }
  3465. items.forEach((item) => {
  3466. item = path.join(dir, item);
  3467. remove.removeSync(item);
  3468. });
  3469. }
  3470. module2.exports = {
  3471. emptyDirSync,
  3472. emptydirSync: emptyDirSync,
  3473. emptyDir,
  3474. emptydir: emptyDir
  3475. };
  3476. }
  3477. });
  3478. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/file.js
  3479. var require_file = __commonJS({
  3480. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
  3481. "use strict";
  3482. var u = require_universalify().fromPromise;
  3483. var path = require("path");
  3484. var fs = require_fs();
  3485. var mkdir = require_mkdirs();
  3486. async function createFile(file) {
  3487. let stats;
  3488. try {
  3489. stats = await fs.stat(file);
  3490. } catch {
  3491. }
  3492. if (stats && stats.isFile()) return;
  3493. const dir = path.dirname(file);
  3494. let dirStats = null;
  3495. try {
  3496. dirStats = await fs.stat(dir);
  3497. } catch (err) {
  3498. if (err.code === "ENOENT") {
  3499. await mkdir.mkdirs(dir);
  3500. await fs.writeFile(file, "");
  3501. return;
  3502. } else {
  3503. throw err;
  3504. }
  3505. }
  3506. if (dirStats.isDirectory()) {
  3507. await fs.writeFile(file, "");
  3508. } else {
  3509. await fs.readdir(dir);
  3510. }
  3511. }
  3512. function createFileSync(file) {
  3513. let stats;
  3514. try {
  3515. stats = fs.statSync(file);
  3516. } catch {
  3517. }
  3518. if (stats && stats.isFile()) return;
  3519. const dir = path.dirname(file);
  3520. try {
  3521. if (!fs.statSync(dir).isDirectory()) {
  3522. fs.readdirSync(dir);
  3523. }
  3524. } catch (err) {
  3525. if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
  3526. else throw err;
  3527. }
  3528. fs.writeFileSync(file, "");
  3529. }
  3530. module2.exports = {
  3531. createFile: u(createFile),
  3532. createFileSync
  3533. };
  3534. }
  3535. });
  3536. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/link.js
  3537. var require_link = __commonJS({
  3538. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
  3539. "use strict";
  3540. var u = require_universalify().fromPromise;
  3541. var path = require("path");
  3542. var fs = require_fs();
  3543. var mkdir = require_mkdirs();
  3544. var { pathExists } = require_path_exists();
  3545. var { areIdentical } = require_stat();
  3546. async function createLink(srcpath, dstpath) {
  3547. let dstStat;
  3548. try {
  3549. dstStat = await fs.lstat(dstpath);
  3550. } catch {
  3551. }
  3552. let srcStat;
  3553. try {
  3554. srcStat = await fs.lstat(srcpath);
  3555. } catch (err) {
  3556. err.message = err.message.replace("lstat", "ensureLink");
  3557. throw err;
  3558. }
  3559. if (dstStat && areIdentical(srcStat, dstStat)) return;
  3560. const dir = path.dirname(dstpath);
  3561. const dirExists = await pathExists(dir);
  3562. if (!dirExists) {
  3563. await mkdir.mkdirs(dir);
  3564. }
  3565. await fs.link(srcpath, dstpath);
  3566. }
  3567. function createLinkSync(srcpath, dstpath) {
  3568. let dstStat;
  3569. try {
  3570. dstStat = fs.lstatSync(dstpath);
  3571. } catch {
  3572. }
  3573. try {
  3574. const srcStat = fs.lstatSync(srcpath);
  3575. if (dstStat && areIdentical(srcStat, dstStat)) return;
  3576. } catch (err) {
  3577. err.message = err.message.replace("lstat", "ensureLink");
  3578. throw err;
  3579. }
  3580. const dir = path.dirname(dstpath);
  3581. const dirExists = fs.existsSync(dir);
  3582. if (dirExists) return fs.linkSync(srcpath, dstpath);
  3583. mkdir.mkdirsSync(dir);
  3584. return fs.linkSync(srcpath, dstpath);
  3585. }
  3586. module2.exports = {
  3587. createLink: u(createLink),
  3588. createLinkSync
  3589. };
  3590. }
  3591. });
  3592. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-paths.js
  3593. var require_symlink_paths = __commonJS({
  3594. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
  3595. "use strict";
  3596. var path = require("path");
  3597. var fs = require_fs();
  3598. var { pathExists } = require_path_exists();
  3599. var u = require_universalify().fromPromise;
  3600. async function symlinkPaths(srcpath, dstpath) {
  3601. if (path.isAbsolute(srcpath)) {
  3602. try {
  3603. await fs.lstat(srcpath);
  3604. } catch (err) {
  3605. err.message = err.message.replace("lstat", "ensureSymlink");
  3606. throw err;
  3607. }
  3608. return {
  3609. toCwd: srcpath,
  3610. toDst: srcpath
  3611. };
  3612. }
  3613. const dstdir = path.dirname(dstpath);
  3614. const relativeToDst = path.join(dstdir, srcpath);
  3615. const exists = await pathExists(relativeToDst);
  3616. if (exists) {
  3617. return {
  3618. toCwd: relativeToDst,
  3619. toDst: srcpath
  3620. };
  3621. }
  3622. try {
  3623. await fs.lstat(srcpath);
  3624. } catch (err) {
  3625. err.message = err.message.replace("lstat", "ensureSymlink");
  3626. throw err;
  3627. }
  3628. return {
  3629. toCwd: srcpath,
  3630. toDst: path.relative(dstdir, srcpath)
  3631. };
  3632. }
  3633. function symlinkPathsSync(srcpath, dstpath) {
  3634. if (path.isAbsolute(srcpath)) {
  3635. const exists2 = fs.existsSync(srcpath);
  3636. if (!exists2) throw new Error("absolute srcpath does not exist");
  3637. return {
  3638. toCwd: srcpath,
  3639. toDst: srcpath
  3640. };
  3641. }
  3642. const dstdir = path.dirname(dstpath);
  3643. const relativeToDst = path.join(dstdir, srcpath);
  3644. const exists = fs.existsSync(relativeToDst);
  3645. if (exists) {
  3646. return {
  3647. toCwd: relativeToDst,
  3648. toDst: srcpath
  3649. };
  3650. }
  3651. const srcExists = fs.existsSync(srcpath);
  3652. if (!srcExists) throw new Error("relative srcpath does not exist");
  3653. return {
  3654. toCwd: srcpath,
  3655. toDst: path.relative(dstdir, srcpath)
  3656. };
  3657. }
  3658. module2.exports = {
  3659. symlinkPaths: u(symlinkPaths),
  3660. symlinkPathsSync
  3661. };
  3662. }
  3663. });
  3664. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-type.js
  3665. var require_symlink_type = __commonJS({
  3666. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
  3667. "use strict";
  3668. var fs = require_fs();
  3669. var u = require_universalify().fromPromise;
  3670. async function symlinkType(srcpath, type) {
  3671. if (type) return type;
  3672. let stats;
  3673. try {
  3674. stats = await fs.lstat(srcpath);
  3675. } catch {
  3676. return "file";
  3677. }
  3678. return stats && stats.isDirectory() ? "dir" : "file";
  3679. }
  3680. function symlinkTypeSync(srcpath, type) {
  3681. if (type) return type;
  3682. let stats;
  3683. try {
  3684. stats = fs.lstatSync(srcpath);
  3685. } catch {
  3686. return "file";
  3687. }
  3688. return stats && stats.isDirectory() ? "dir" : "file";
  3689. }
  3690. module2.exports = {
  3691. symlinkType: u(symlinkType),
  3692. symlinkTypeSync
  3693. };
  3694. }
  3695. });
  3696. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink.js
  3697. var require_symlink = __commonJS({
  3698. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
  3699. "use strict";
  3700. var u = require_universalify().fromPromise;
  3701. var path = require("path");
  3702. var fs = require_fs();
  3703. var { mkdirs, mkdirsSync } = require_mkdirs();
  3704. var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
  3705. var { symlinkType, symlinkTypeSync } = require_symlink_type();
  3706. var { pathExists } = require_path_exists();
  3707. var { areIdentical } = require_stat();
  3708. async function createSymlink(srcpath, dstpath, type) {
  3709. let stats;
  3710. try {
  3711. stats = await fs.lstat(dstpath);
  3712. } catch {
  3713. }
  3714. if (stats && stats.isSymbolicLink()) {
  3715. const [srcStat, dstStat] = await Promise.all([
  3716. fs.stat(srcpath),
  3717. fs.stat(dstpath)
  3718. ]);
  3719. if (areIdentical(srcStat, dstStat)) return;
  3720. }
  3721. const relative = await symlinkPaths(srcpath, dstpath);
  3722. srcpath = relative.toDst;
  3723. const toType = await symlinkType(relative.toCwd, type);
  3724. const dir = path.dirname(dstpath);
  3725. if (!await pathExists(dir)) {
  3726. await mkdirs(dir);
  3727. }
  3728. return fs.symlink(srcpath, dstpath, toType);
  3729. }
  3730. function createSymlinkSync(srcpath, dstpath, type) {
  3731. let stats;
  3732. try {
  3733. stats = fs.lstatSync(dstpath);
  3734. } catch {
  3735. }
  3736. if (stats && stats.isSymbolicLink()) {
  3737. const srcStat = fs.statSync(srcpath);
  3738. const dstStat = fs.statSync(dstpath);
  3739. if (areIdentical(srcStat, dstStat)) return;
  3740. }
  3741. const relative = symlinkPathsSync(srcpath, dstpath);
  3742. srcpath = relative.toDst;
  3743. type = symlinkTypeSync(relative.toCwd, type);
  3744. const dir = path.dirname(dstpath);
  3745. const exists = fs.existsSync(dir);
  3746. if (exists) return fs.symlinkSync(srcpath, dstpath, type);
  3747. mkdirsSync(dir);
  3748. return fs.symlinkSync(srcpath, dstpath, type);
  3749. }
  3750. module2.exports = {
  3751. createSymlink: u(createSymlink),
  3752. createSymlinkSync
  3753. };
  3754. }
  3755. });
  3756. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/index.js
  3757. var require_ensure = __commonJS({
  3758. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/index.js"(exports2, module2) {
  3759. "use strict";
  3760. var { createFile, createFileSync } = require_file();
  3761. var { createLink, createLinkSync } = require_link();
  3762. var { createSymlink, createSymlinkSync } = require_symlink();
  3763. module2.exports = {
  3764. // file
  3765. createFile,
  3766. createFileSync,
  3767. ensureFile: createFile,
  3768. ensureFileSync: createFileSync,
  3769. // link
  3770. createLink,
  3771. createLinkSync,
  3772. ensureLink: createLink,
  3773. ensureLinkSync: createLinkSync,
  3774. // symlink
  3775. createSymlink,
  3776. createSymlinkSync,
  3777. ensureSymlink: createSymlink,
  3778. ensureSymlinkSync: createSymlinkSync
  3779. };
  3780. }
  3781. });
  3782. // ../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js
  3783. var require_utils2 = __commonJS({
  3784. "../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports2, module2) {
  3785. function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
  3786. const EOF = finalEOL ? EOL : "";
  3787. const str = JSON.stringify(obj, replacer, spaces);
  3788. return str.replace(/\n/g, EOL) + EOF;
  3789. }
  3790. function stripBom(content) {
  3791. if (Buffer.isBuffer(content)) content = content.toString("utf8");
  3792. return content.replace(/^\uFEFF/, "");
  3793. }
  3794. module2.exports = { stringify, stripBom };
  3795. }
  3796. });
  3797. // ../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js
  3798. var require_jsonfile = __commonJS({
  3799. "../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports2, module2) {
  3800. var _fs;
  3801. try {
  3802. _fs = require_graceful_fs();
  3803. } catch (_) {
  3804. _fs = require("fs");
  3805. }
  3806. var universalify = require_universalify();
  3807. var { stringify, stripBom } = require_utils2();
  3808. async function _readFile(file, options = {}) {
  3809. if (typeof options === "string") {
  3810. options = { encoding: options };
  3811. }
  3812. const fs = options.fs || _fs;
  3813. const shouldThrow = "throws" in options ? options.throws : true;
  3814. let data = await universalify.fromCallback(fs.readFile)(file, options);
  3815. data = stripBom(data);
  3816. let obj;
  3817. try {
  3818. obj = JSON.parse(data, options ? options.reviver : null);
  3819. } catch (err) {
  3820. if (shouldThrow) {
  3821. err.message = `${file}: ${err.message}`;
  3822. throw err;
  3823. } else {
  3824. return null;
  3825. }
  3826. }
  3827. return obj;
  3828. }
  3829. var readFile = universalify.fromPromise(_readFile);
  3830. function readFileSync(file, options = {}) {
  3831. if (typeof options === "string") {
  3832. options = { encoding: options };
  3833. }
  3834. const fs = options.fs || _fs;
  3835. const shouldThrow = "throws" in options ? options.throws : true;
  3836. try {
  3837. let content = fs.readFileSync(file, options);
  3838. content = stripBom(content);
  3839. return JSON.parse(content, options.reviver);
  3840. } catch (err) {
  3841. if (shouldThrow) {
  3842. err.message = `${file}: ${err.message}`;
  3843. throw err;
  3844. } else {
  3845. return null;
  3846. }
  3847. }
  3848. }
  3849. async function _writeFile(file, obj, options = {}) {
  3850. const fs = options.fs || _fs;
  3851. const str = stringify(obj, options);
  3852. await universalify.fromCallback(fs.writeFile)(file, str, options);
  3853. }
  3854. var writeFile = universalify.fromPromise(_writeFile);
  3855. function writeFileSync(file, obj, options = {}) {
  3856. const fs = options.fs || _fs;
  3857. const str = stringify(obj, options);
  3858. return fs.writeFileSync(file, str, options);
  3859. }
  3860. var jsonfile = {
  3861. readFile,
  3862. readFileSync,
  3863. writeFile,
  3864. writeFileSync
  3865. };
  3866. module2.exports = jsonfile;
  3867. }
  3868. });
  3869. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/jsonfile.js
  3870. var require_jsonfile2 = __commonJS({
  3871. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports2, module2) {
  3872. "use strict";
  3873. var jsonFile = require_jsonfile();
  3874. module2.exports = {
  3875. // jsonfile exports
  3876. readJson: jsonFile.readFile,
  3877. readJsonSync: jsonFile.readFileSync,
  3878. writeJson: jsonFile.writeFile,
  3879. writeJsonSync: jsonFile.writeFileSync
  3880. };
  3881. }
  3882. });
  3883. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/output-file/index.js
  3884. var require_output_file = __commonJS({
  3885. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) {
  3886. "use strict";
  3887. var u = require_universalify().fromPromise;
  3888. var fs = require_fs();
  3889. var path = require("path");
  3890. var mkdir = require_mkdirs();
  3891. var pathExists = require_path_exists().pathExists;
  3892. async function outputFile(file, data, encoding = "utf-8") {
  3893. const dir = path.dirname(file);
  3894. if (!await pathExists(dir)) {
  3895. await mkdir.mkdirs(dir);
  3896. }
  3897. return fs.writeFile(file, data, encoding);
  3898. }
  3899. function outputFileSync(file, ...args) {
  3900. const dir = path.dirname(file);
  3901. if (!fs.existsSync(dir)) {
  3902. mkdir.mkdirsSync(dir);
  3903. }
  3904. fs.writeFileSync(file, ...args);
  3905. }
  3906. module2.exports = {
  3907. outputFile: u(outputFile),
  3908. outputFileSync
  3909. };
  3910. }
  3911. });
  3912. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json.js
  3913. var require_output_json = __commonJS({
  3914. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json.js"(exports2, module2) {
  3915. "use strict";
  3916. var { stringify } = require_utils2();
  3917. var { outputFile } = require_output_file();
  3918. async function outputJson(file, data, options = {}) {
  3919. const str = stringify(data, options);
  3920. await outputFile(file, str, options);
  3921. }
  3922. module2.exports = outputJson;
  3923. }
  3924. });
  3925. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json-sync.js
  3926. var require_output_json_sync = __commonJS({
  3927. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports2, module2) {
  3928. "use strict";
  3929. var { stringify } = require_utils2();
  3930. var { outputFileSync } = require_output_file();
  3931. function outputJsonSync(file, data, options) {
  3932. const str = stringify(data, options);
  3933. outputFileSync(file, str, options);
  3934. }
  3935. module2.exports = outputJsonSync;
  3936. }
  3937. });
  3938. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/index.js
  3939. var require_json = __commonJS({
  3940. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/index.js"(exports2, module2) {
  3941. "use strict";
  3942. var u = require_universalify().fromPromise;
  3943. var jsonFile = require_jsonfile2();
  3944. jsonFile.outputJson = u(require_output_json());
  3945. jsonFile.outputJsonSync = require_output_json_sync();
  3946. jsonFile.outputJSON = jsonFile.outputJson;
  3947. jsonFile.outputJSONSync = jsonFile.outputJsonSync;
  3948. jsonFile.writeJSON = jsonFile.writeJson;
  3949. jsonFile.writeJSONSync = jsonFile.writeJsonSync;
  3950. jsonFile.readJSON = jsonFile.readJson;
  3951. jsonFile.readJSONSync = jsonFile.readJsonSync;
  3952. module2.exports = jsonFile;
  3953. }
  3954. });
  3955. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move.js
  3956. var require_move = __commonJS({
  3957. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
  3958. "use strict";
  3959. var fs = require_fs();
  3960. var path = require("path");
  3961. var { copy } = require_copy2();
  3962. var { remove } = require_remove();
  3963. var { mkdirp } = require_mkdirs();
  3964. var { pathExists } = require_path_exists();
  3965. var stat = require_stat();
  3966. async function move(src, dest, opts = {}) {
  3967. const overwrite = opts.overwrite || opts.clobber || false;
  3968. const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
  3969. await stat.checkParentPaths(src, srcStat, dest, "move");
  3970. const destParent = path.dirname(dest);
  3971. const parsedParentPath = path.parse(destParent);
  3972. if (parsedParentPath.root !== destParent) {
  3973. await mkdirp(destParent);
  3974. }
  3975. return doRename(src, dest, overwrite, isChangingCase);
  3976. }
  3977. async function doRename(src, dest, overwrite, isChangingCase) {
  3978. if (!isChangingCase) {
  3979. if (overwrite) {
  3980. await remove(dest);
  3981. } else if (await pathExists(dest)) {
  3982. throw new Error("dest already exists.");
  3983. }
  3984. }
  3985. try {
  3986. await fs.rename(src, dest);
  3987. } catch (err) {
  3988. if (err.code !== "EXDEV") {
  3989. throw err;
  3990. }
  3991. await moveAcrossDevice(src, dest, overwrite);
  3992. }
  3993. }
  3994. async function moveAcrossDevice(src, dest, overwrite) {
  3995. const opts = {
  3996. overwrite,
  3997. errorOnExist: true,
  3998. preserveTimestamps: true
  3999. };
  4000. await copy(src, dest, opts);
  4001. return remove(src);
  4002. }
  4003. module2.exports = move;
  4004. }
  4005. });
  4006. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move-sync.js
  4007. var require_move_sync = __commonJS({
  4008. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
  4009. "use strict";
  4010. var fs = require_graceful_fs();
  4011. var path = require("path");
  4012. var copySync = require_copy2().copySync;
  4013. var removeSync = require_remove().removeSync;
  4014. var mkdirpSync = require_mkdirs().mkdirpSync;
  4015. var stat = require_stat();
  4016. function moveSync(src, dest, opts) {
  4017. opts = opts || {};
  4018. const overwrite = opts.overwrite || opts.clobber || false;
  4019. const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
  4020. stat.checkParentPathsSync(src, srcStat, dest, "move");
  4021. if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest));
  4022. return doRename(src, dest, overwrite, isChangingCase);
  4023. }
  4024. function isParentRoot(dest) {
  4025. const parent = path.dirname(dest);
  4026. const parsedPath = path.parse(parent);
  4027. return parsedPath.root === parent;
  4028. }
  4029. function doRename(src, dest, overwrite, isChangingCase) {
  4030. if (isChangingCase) return rename(src, dest, overwrite);
  4031. if (overwrite) {
  4032. removeSync(dest);
  4033. return rename(src, dest, overwrite);
  4034. }
  4035. if (fs.existsSync(dest)) throw new Error("dest already exists.");
  4036. return rename(src, dest, overwrite);
  4037. }
  4038. function rename(src, dest, overwrite) {
  4039. try {
  4040. fs.renameSync(src, dest);
  4041. } catch (err) {
  4042. if (err.code !== "EXDEV") throw err;
  4043. return moveAcrossDevice(src, dest, overwrite);
  4044. }
  4045. }
  4046. function moveAcrossDevice(src, dest, overwrite) {
  4047. const opts = {
  4048. overwrite,
  4049. errorOnExist: true,
  4050. preserveTimestamps: true
  4051. };
  4052. copySync(src, dest, opts);
  4053. return removeSync(src);
  4054. }
  4055. module2.exports = moveSync;
  4056. }
  4057. });
  4058. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/index.js
  4059. var require_move2 = __commonJS({
  4060. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/index.js"(exports2, module2) {
  4061. "use strict";
  4062. var u = require_universalify().fromPromise;
  4063. module2.exports = {
  4064. move: u(require_move()),
  4065. moveSync: require_move_sync()
  4066. };
  4067. }
  4068. });
  4069. // ../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/index.js
  4070. var require_lib3 = __commonJS({
  4071. "../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/index.js"(exports2, module2) {
  4072. "use strict";
  4073. module2.exports = {
  4074. // Export promiseified graceful-fs:
  4075. ...require_fs(),
  4076. // Export extra methods:
  4077. ...require_copy2(),
  4078. ...require_empty(),
  4079. ...require_ensure(),
  4080. ...require_json(),
  4081. ...require_mkdirs(),
  4082. ...require_move2(),
  4083. ...require_output_file(),
  4084. ...require_path_exists(),
  4085. ...require_remove()
  4086. };
  4087. }
  4088. });
  4089. // ../node_modules/.pnpm/rename-overwrite@6.0.2/node_modules/rename-overwrite/index.js
  4090. var require_rename_overwrite = __commonJS({
  4091. "../node_modules/.pnpm/rename-overwrite@6.0.2/node_modules/rename-overwrite/index.js"(exports2, module2) {
  4092. "use strict";
  4093. var fs = require("fs");
  4094. var { copySync, copy } = require_lib3();
  4095. var path = require("path");
  4096. var rimraf = require_rimraf();
  4097. module2.exports = async function renameOverwrite(oldPath, newPath, retry = 0) {
  4098. try {
  4099. await fs.promises.rename(oldPath, newPath);
  4100. } catch (err) {
  4101. retry++;
  4102. if (retry > 3) throw err;
  4103. switch (err.code) {
  4104. case "ENOTEMPTY":
  4105. case "EEXIST":
  4106. case "ENOTDIR":
  4107. await rimraf(newPath);
  4108. await renameOverwrite(oldPath, newPath, retry);
  4109. break;
  4110. // Windows Antivirus issues
  4111. case "EPERM":
  4112. case "EACCESS": {
  4113. await rimraf(newPath);
  4114. const start = Date.now();
  4115. let backoff = 0;
  4116. let lastError = err;
  4117. while (Date.now() - start < 6e4 && (lastError.code === "EPERM" || lastError.code === "EACCESS")) {
  4118. await new Promise((resolve) => setTimeout(resolve, backoff));
  4119. try {
  4120. await fs.promises.rename(oldPath, newPath);
  4121. return;
  4122. } catch (err2) {
  4123. lastError = err2;
  4124. }
  4125. if (backoff < 100) {
  4126. backoff += 10;
  4127. }
  4128. }
  4129. throw lastError;
  4130. }
  4131. case "ENOENT":
  4132. try {
  4133. await fs.promises.stat(oldPath);
  4134. } catch (statErr) {
  4135. if (statErr.code === "ENOENT") {
  4136. throw statErr;
  4137. }
  4138. }
  4139. await fs.promises.mkdir(path.dirname(newPath), { recursive: true });
  4140. await renameOverwrite(oldPath, newPath, retry);
  4141. break;
  4142. // Crossing filesystem boundaries so rename is not available
  4143. case "EXDEV":
  4144. try {
  4145. await rimraf(newPath);
  4146. } catch (rimrafErr) {
  4147. if (rimrafErr.code !== "ENOENT") {
  4148. throw rimrafErr;
  4149. }
  4150. }
  4151. await copy(oldPath, newPath);
  4152. await rimraf(oldPath);
  4153. break;
  4154. default:
  4155. throw err;
  4156. }
  4157. }
  4158. };
  4159. module2.exports.sync = function renameOverwriteSync(oldPath, newPath, retry = 0) {
  4160. try {
  4161. fs.renameSync(oldPath, newPath);
  4162. } catch (err) {
  4163. retry++;
  4164. if (retry > 3) throw err;
  4165. switch (err.code) {
  4166. // Windows Antivirus issues
  4167. case "EPERM":
  4168. case "EACCESS": {
  4169. rimraf.sync(newPath);
  4170. const start = Date.now();
  4171. let backoff = 0;
  4172. let lastError = err;
  4173. while (Date.now() - start < 6e4 && (lastError.code === "EPERM" || lastError.code === "EACCESS")) {
  4174. const waitUntil = Date.now() + backoff;
  4175. while (waitUntil > Date.now()) {
  4176. }
  4177. try {
  4178. fs.renameSync(oldPath, newPath);
  4179. return;
  4180. } catch (err2) {
  4181. lastError = err2;
  4182. }
  4183. if (backoff < 100) {
  4184. backoff += 10;
  4185. }
  4186. }
  4187. throw lastError;
  4188. }
  4189. case "ENOTEMPTY":
  4190. case "EEXIST":
  4191. case "ENOTDIR":
  4192. rimraf.sync(newPath);
  4193. fs.renameSync(oldPath, newPath);
  4194. return;
  4195. case "ENOENT":
  4196. fs.mkdirSync(path.dirname(newPath), { recursive: true });
  4197. renameOverwriteSync(oldPath, newPath, retry);
  4198. return;
  4199. // Crossing filesystem boundaries so rename is not available
  4200. case "EXDEV":
  4201. try {
  4202. rimraf.sync(newPath);
  4203. } catch (rimrafErr) {
  4204. if (rimrafErr.code !== "ENOENT") {
  4205. throw rimrafErr;
  4206. }
  4207. }
  4208. copySync(oldPath, newPath);
  4209. rimraf.sync(oldPath);
  4210. break;
  4211. default:
  4212. throw err;
  4213. }
  4214. }
  4215. };
  4216. }
  4217. });
  4218. // ../store/cafs/lib/writeFile.js
  4219. var require_writeFile = __commonJS({
  4220. "../store/cafs/lib/writeFile.js"(exports2) {
  4221. "use strict";
  4222. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  4223. return mod && mod.__esModule ? mod : { "default": mod };
  4224. };
  4225. Object.defineProperty(exports2, "__esModule", { value: true });
  4226. exports2.writeFile = writeFile;
  4227. var fs_12 = __importDefault2(require("fs"));
  4228. var path_12 = __importDefault2(require("path"));
  4229. var dirs = /* @__PURE__ */ new Set();
  4230. function writeFile(fileDest, buffer, mode) {
  4231. makeDirForFile(fileDest);
  4232. fs_12.default.writeFileSync(fileDest, buffer, { mode });
  4233. }
  4234. function makeDirForFile(fileDest) {
  4235. const dir = path_12.default.dirname(fileDest);
  4236. if (!dirs.has(dir)) {
  4237. fs_12.default.mkdirSync(dir, { recursive: true });
  4238. dirs.add(dir);
  4239. }
  4240. }
  4241. }
  4242. });
  4243. // ../store/cafs/lib/writeBufferToCafs.js
  4244. var require_writeBufferToCafs = __commonJS({
  4245. "../store/cafs/lib/writeBufferToCafs.js"(exports2) {
  4246. "use strict";
  4247. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  4248. return mod && mod.__esModule ? mod : { "default": mod };
  4249. };
  4250. Object.defineProperty(exports2, "__esModule", { value: true });
  4251. exports2.writeBufferToCafs = writeBufferToCafs;
  4252. exports2.optimisticRenameOverwrite = optimisticRenameOverwrite;
  4253. exports2.pathTemp = pathTemp;
  4254. var fs_12 = __importDefault2(require("fs"));
  4255. var path_12 = __importDefault2(require("path"));
  4256. var worker_threads_12 = __importDefault2(require("worker_threads"));
  4257. var util_1 = __importDefault2(require("util"));
  4258. var rename_overwrite_1 = __importDefault2(require_rename_overwrite());
  4259. var checkPkgFilesIntegrity_1 = require_checkPkgFilesIntegrity();
  4260. var writeFile_1 = require_writeFile();
  4261. function writeBufferToCafs(locker, storeDir, buffer, fileDest, mode, integrity) {
  4262. fileDest = path_12.default.join(storeDir, fileDest);
  4263. if (locker.has(fileDest)) {
  4264. return {
  4265. checkedAt: locker.get(fileDest),
  4266. filePath: fileDest
  4267. };
  4268. }
  4269. if (existsSame(fileDest, integrity)) {
  4270. return {
  4271. checkedAt: Date.now(),
  4272. filePath: fileDest
  4273. };
  4274. }
  4275. const temp = pathTemp(fileDest);
  4276. (0, writeFile_1.writeFile)(temp, buffer, mode);
  4277. const birthtimeMs = Date.now();
  4278. optimisticRenameOverwrite(temp, fileDest);
  4279. locker.set(fileDest, birthtimeMs);
  4280. return {
  4281. checkedAt: birthtimeMs,
  4282. filePath: fileDest
  4283. };
  4284. }
  4285. function optimisticRenameOverwrite(temp, fileDest) {
  4286. try {
  4287. rename_overwrite_1.default.sync(temp, fileDest);
  4288. } catch (err) {
  4289. if (!(util_1.default.types.isNativeError(err) && "code" in err && err.code === "ENOENT") || !fs_12.default.existsSync(fileDest))
  4290. throw err;
  4291. }
  4292. }
  4293. function pathTemp(file) {
  4294. const basename = removeSuffix(path_12.default.basename(file));
  4295. return path_12.default.join(path_12.default.dirname(file), `${basename}${process.pid}${worker_threads_12.default.threadId}`);
  4296. }
  4297. function removeSuffix(filePath) {
  4298. const dashPosition = filePath.indexOf("-");
  4299. if (dashPosition === -1)
  4300. return filePath;
  4301. const withoutSuffix = filePath.substring(0, dashPosition);
  4302. if (filePath.substring(dashPosition) === "-exec") {
  4303. return `${withoutSuffix}x`;
  4304. }
  4305. return withoutSuffix;
  4306. }
  4307. function existsSame(filename, integrity) {
  4308. const existingFile = fs_12.default.statSync(filename, { throwIfNoEntry: false });
  4309. if (!existingFile)
  4310. return false;
  4311. return (0, checkPkgFilesIntegrity_1.verifyFileIntegrity)(filename, {
  4312. size: existingFile.size,
  4313. integrity
  4314. }).passed;
  4315. }
  4316. }
  4317. });
  4318. // ../store/cafs/lib/index.js
  4319. var require_lib4 = __commonJS({
  4320. "../store/cafs/lib/index.js"(exports2) {
  4321. "use strict";
  4322. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  4323. return mod && mod.__esModule ? mod : { "default": mod };
  4324. };
  4325. Object.defineProperty(exports2, "__esModule", { value: true });
  4326. exports2.optimisticRenameOverwrite = exports2.getIndexFilePathInCafs = exports2.getFilePathByModeInCafs = exports2.readManifestFromStore = exports2.checkPkgFilesIntegrity = void 0;
  4327. exports2.createCafs = createCafs;
  4328. var ssri_1 = __importDefault2(require_lib2());
  4329. var addFilesFromDir_1 = require_addFilesFromDir();
  4330. var addFilesFromTarball_1 = require_addFilesFromTarball();
  4331. var checkPkgFilesIntegrity_1 = require_checkPkgFilesIntegrity();
  4332. Object.defineProperty(exports2, "checkPkgFilesIntegrity", { enumerable: true, get: function() {
  4333. return checkPkgFilesIntegrity_1.checkPkgFilesIntegrity;
  4334. } });
  4335. var readManifestFromStore_1 = require_readManifestFromStore();
  4336. Object.defineProperty(exports2, "readManifestFromStore", { enumerable: true, get: function() {
  4337. return readManifestFromStore_1.readManifestFromStore;
  4338. } });
  4339. var getFilePathInCafs_1 = require_getFilePathInCafs();
  4340. Object.defineProperty(exports2, "getIndexFilePathInCafs", { enumerable: true, get: function() {
  4341. return getFilePathInCafs_1.getIndexFilePathInCafs;
  4342. } });
  4343. Object.defineProperty(exports2, "getFilePathByModeInCafs", { enumerable: true, get: function() {
  4344. return getFilePathInCafs_1.getFilePathByModeInCafs;
  4345. } });
  4346. var writeBufferToCafs_1 = require_writeBufferToCafs();
  4347. Object.defineProperty(exports2, "optimisticRenameOverwrite", { enumerable: true, get: function() {
  4348. return writeBufferToCafs_1.optimisticRenameOverwrite;
  4349. } });
  4350. function createCafs(storeDir, { ignoreFile, cafsLocker: cafsLocker2 } = {}) {
  4351. const _writeBufferToCafs = writeBufferToCafs_1.writeBufferToCafs.bind(null, cafsLocker2 ?? /* @__PURE__ */ new Map(), storeDir);
  4352. const addBuffer = addBufferToCafs.bind(null, _writeBufferToCafs);
  4353. return {
  4354. addFilesFromDir: addFilesFromDir_1.addFilesFromDir.bind(null, addBuffer),
  4355. addFilesFromTarball: addFilesFromTarball_1.addFilesFromTarball.bind(null, addBuffer, ignoreFile ?? null),
  4356. getIndexFilePathInCafs: getFilePathInCafs_1.getIndexFilePathInCafs.bind(null, storeDir),
  4357. getFilePathByModeInCafs: getFilePathInCafs_1.getFilePathByModeInCafs.bind(null, storeDir)
  4358. };
  4359. }
  4360. function addBufferToCafs(writeBufferToCafs, buffer, mode) {
  4361. const integrity = ssri_1.default.fromData(buffer);
  4362. const isExecutable = (0, getFilePathInCafs_1.modeIsExecutable)(mode);
  4363. const fileDest = (0, getFilePathInCafs_1.contentPathFromHex)(isExecutable ? "exec" : "nonexec", integrity.hexDigest());
  4364. const { checkedAt, filePath } = writeBufferToCafs(buffer, fileDest, isExecutable ? 493 : void 0, integrity);
  4365. return { checkedAt, integrity, filePath };
  4366. }
  4367. }
  4368. });
  4369. // ../node_modules/.pnpm/fast-safe-stringify@2.1.1/node_modules/fast-safe-stringify/index.js
  4370. var require_fast_safe_stringify = __commonJS({
  4371. "../node_modules/.pnpm/fast-safe-stringify@2.1.1/node_modules/fast-safe-stringify/index.js"(exports2, module2) {
  4372. module2.exports = stringify;
  4373. stringify.default = stringify;
  4374. stringify.stable = deterministicStringify;
  4375. stringify.stableStringify = deterministicStringify;
  4376. var LIMIT_REPLACE_NODE = "[...]";
  4377. var CIRCULAR_REPLACE_NODE = "[Circular]";
  4378. var arr = [];
  4379. var replacerStack = [];
  4380. function defaultOptions() {
  4381. return {
  4382. depthLimit: Number.MAX_SAFE_INTEGER,
  4383. edgesLimit: Number.MAX_SAFE_INTEGER
  4384. };
  4385. }
  4386. function stringify(obj, replacer, spacer, options) {
  4387. if (typeof options === "undefined") {
  4388. options = defaultOptions();
  4389. }
  4390. decirc(obj, "", 0, [], void 0, 0, options);
  4391. var res;
  4392. try {
  4393. if (replacerStack.length === 0) {
  4394. res = JSON.stringify(obj, replacer, spacer);
  4395. } else {
  4396. res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
  4397. }
  4398. } catch (_) {
  4399. return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
  4400. } finally {
  4401. while (arr.length !== 0) {
  4402. var part = arr.pop();
  4403. if (part.length === 4) {
  4404. Object.defineProperty(part[0], part[1], part[3]);
  4405. } else {
  4406. part[0][part[1]] = part[2];
  4407. }
  4408. }
  4409. }
  4410. return res;
  4411. }
  4412. function setReplace(replace, val, k, parent) {
  4413. var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
  4414. if (propertyDescriptor.get !== void 0) {
  4415. if (propertyDescriptor.configurable) {
  4416. Object.defineProperty(parent, k, { value: replace });
  4417. arr.push([parent, k, val, propertyDescriptor]);
  4418. } else {
  4419. replacerStack.push([val, k, replace]);
  4420. }
  4421. } else {
  4422. parent[k] = replace;
  4423. arr.push([parent, k, val]);
  4424. }
  4425. }
  4426. function decirc(val, k, edgeIndex, stack, parent, depth, options) {
  4427. depth += 1;
  4428. var i;
  4429. if (typeof val === "object" && val !== null) {
  4430. for (i = 0; i < stack.length; i++) {
  4431. if (stack[i] === val) {
  4432. setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
  4433. return;
  4434. }
  4435. }
  4436. if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
  4437. setReplace(LIMIT_REPLACE_NODE, val, k, parent);
  4438. return;
  4439. }
  4440. if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
  4441. setReplace(LIMIT_REPLACE_NODE, val, k, parent);
  4442. return;
  4443. }
  4444. stack.push(val);
  4445. if (Array.isArray(val)) {
  4446. for (i = 0; i < val.length; i++) {
  4447. decirc(val[i], i, i, stack, val, depth, options);
  4448. }
  4449. } else {
  4450. var keys = Object.keys(val);
  4451. for (i = 0; i < keys.length; i++) {
  4452. var key = keys[i];
  4453. decirc(val[key], key, i, stack, val, depth, options);
  4454. }
  4455. }
  4456. stack.pop();
  4457. }
  4458. }
  4459. function compareFunction(a, b) {
  4460. if (a < b) {
  4461. return -1;
  4462. }
  4463. if (a > b) {
  4464. return 1;
  4465. }
  4466. return 0;
  4467. }
  4468. function deterministicStringify(obj, replacer, spacer, options) {
  4469. if (typeof options === "undefined") {
  4470. options = defaultOptions();
  4471. }
  4472. var tmp = deterministicDecirc(obj, "", 0, [], void 0, 0, options) || obj;
  4473. var res;
  4474. try {
  4475. if (replacerStack.length === 0) {
  4476. res = JSON.stringify(tmp, replacer, spacer);
  4477. } else {
  4478. res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
  4479. }
  4480. } catch (_) {
  4481. return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
  4482. } finally {
  4483. while (arr.length !== 0) {
  4484. var part = arr.pop();
  4485. if (part.length === 4) {
  4486. Object.defineProperty(part[0], part[1], part[3]);
  4487. } else {
  4488. part[0][part[1]] = part[2];
  4489. }
  4490. }
  4491. }
  4492. return res;
  4493. }
  4494. function deterministicDecirc(val, k, edgeIndex, stack, parent, depth, options) {
  4495. depth += 1;
  4496. var i;
  4497. if (typeof val === "object" && val !== null) {
  4498. for (i = 0; i < stack.length; i++) {
  4499. if (stack[i] === val) {
  4500. setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
  4501. return;
  4502. }
  4503. }
  4504. try {
  4505. if (typeof val.toJSON === "function") {
  4506. return;
  4507. }
  4508. } catch (_) {
  4509. return;
  4510. }
  4511. if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
  4512. setReplace(LIMIT_REPLACE_NODE, val, k, parent);
  4513. return;
  4514. }
  4515. if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
  4516. setReplace(LIMIT_REPLACE_NODE, val, k, parent);
  4517. return;
  4518. }
  4519. stack.push(val);
  4520. if (Array.isArray(val)) {
  4521. for (i = 0; i < val.length; i++) {
  4522. deterministicDecirc(val[i], i, i, stack, val, depth, options);
  4523. }
  4524. } else {
  4525. var tmp = {};
  4526. var keys = Object.keys(val).sort(compareFunction);
  4527. for (i = 0; i < keys.length; i++) {
  4528. var key = keys[i];
  4529. deterministicDecirc(val[key], key, i, stack, val, depth, options);
  4530. tmp[key] = val[key];
  4531. }
  4532. if (typeof parent !== "undefined") {
  4533. arr.push([parent, k, val]);
  4534. parent[k] = tmp;
  4535. } else {
  4536. return tmp;
  4537. }
  4538. }
  4539. stack.pop();
  4540. }
  4541. }
  4542. function replaceGetterValues(replacer) {
  4543. replacer = typeof replacer !== "undefined" ? replacer : function(k, v) {
  4544. return v;
  4545. };
  4546. return function(key, val) {
  4547. if (replacerStack.length > 0) {
  4548. for (var i = 0; i < replacerStack.length; i++) {
  4549. var part = replacerStack[i];
  4550. if (part[1] === key && part[0] === val) {
  4551. val = part[2];
  4552. replacerStack.splice(i, 1);
  4553. break;
  4554. }
  4555. }
  4556. }
  4557. return replacer.call(this, key, val);
  4558. };
  4559. }
  4560. }
  4561. });
  4562. // ../node_modules/.pnpm/individual@3.0.0/node_modules/individual/index.js
  4563. var require_individual = __commonJS({
  4564. "../node_modules/.pnpm/individual@3.0.0/node_modules/individual/index.js"(exports2, module2) {
  4565. "use strict";
  4566. var root = typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
  4567. module2.exports = Individual;
  4568. function Individual(key, value) {
  4569. if (key in root) {
  4570. return root[key];
  4571. }
  4572. root[key] = value;
  4573. return value;
  4574. }
  4575. }
  4576. });
  4577. // ../node_modules/.pnpm/bole@5.0.17/node_modules/bole/format.js
  4578. var require_format = __commonJS({
  4579. "../node_modules/.pnpm/bole@5.0.17/node_modules/bole/format.js"(exports2, module2) {
  4580. var utilformat = require("util").format;
  4581. function format(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) {
  4582. if (a16 !== void 0) {
  4583. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16);
  4584. }
  4585. if (a15 !== void 0) {
  4586. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15);
  4587. }
  4588. if (a14 !== void 0) {
  4589. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14);
  4590. }
  4591. if (a13 !== void 0) {
  4592. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
  4593. }
  4594. if (a12 !== void 0) {
  4595. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
  4596. }
  4597. if (a11 !== void 0) {
  4598. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
  4599. }
  4600. if (a10 !== void 0) {
  4601. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
  4602. }
  4603. if (a9 !== void 0) {
  4604. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9);
  4605. }
  4606. if (a8 !== void 0) {
  4607. return utilformat(a1, a2, a3, a4, a5, a6, a7, a8);
  4608. }
  4609. if (a7 !== void 0) {
  4610. return utilformat(a1, a2, a3, a4, a5, a6, a7);
  4611. }
  4612. if (a6 !== void 0) {
  4613. return utilformat(a1, a2, a3, a4, a5, a6);
  4614. }
  4615. if (a5 !== void 0) {
  4616. return utilformat(a1, a2, a3, a4, a5);
  4617. }
  4618. if (a4 !== void 0) {
  4619. return utilformat(a1, a2, a3, a4);
  4620. }
  4621. if (a3 !== void 0) {
  4622. return utilformat(a1, a2, a3);
  4623. }
  4624. if (a2 !== void 0) {
  4625. return utilformat(a1, a2);
  4626. }
  4627. return a1;
  4628. }
  4629. module2.exports = format;
  4630. }
  4631. });
  4632. // ../node_modules/.pnpm/bole@5.0.17/node_modules/bole/bole.js
  4633. var require_bole = __commonJS({
  4634. "../node_modules/.pnpm/bole@5.0.17/node_modules/bole/bole.js"(exports2, module2) {
  4635. "use strict";
  4636. var _stringify = require_fast_safe_stringify();
  4637. var individual = require_individual()("$$bole", { fastTime: false });
  4638. var format = require_format();
  4639. var levels = "debug info warn error".split(" ");
  4640. var os = require("os");
  4641. var pid = process.pid;
  4642. var hasObjMode = false;
  4643. var scache = [];
  4644. var hostname;
  4645. try {
  4646. hostname = os.hostname();
  4647. } catch (e) {
  4648. hostname = os.version().indexOf("Windows 7 ") === 0 ? "windows7" : "hostname-unknown";
  4649. }
  4650. var hostnameSt = _stringify(hostname);
  4651. for (const level of levels) {
  4652. scache[level] = ',"hostname":' + hostnameSt + ',"pid":' + pid + ',"level":"' + level;
  4653. Number(scache[level]);
  4654. if (!Array.isArray(individual[level])) {
  4655. individual[level] = [];
  4656. }
  4657. }
  4658. function stackToString(e) {
  4659. let s = e.stack;
  4660. let ce;
  4661. if (typeof e.cause === "function" && (ce = e.cause())) {
  4662. s += "\nCaused by: " + stackToString(ce);
  4663. }
  4664. return s;
  4665. }
  4666. function errorToOut(err, out) {
  4667. out.err = {
  4668. name: err.name,
  4669. message: err.message,
  4670. code: err.code,
  4671. // perhaps
  4672. stack: stackToString(err)
  4673. };
  4674. }
  4675. function requestToOut(req, out) {
  4676. out.req = {
  4677. method: req.method,
  4678. url: req.url,
  4679. headers: req.headers,
  4680. remoteAddress: req.connection.remoteAddress,
  4681. remotePort: req.connection.remotePort
  4682. };
  4683. }
  4684. function objectToOut(obj, out) {
  4685. for (const k in obj) {
  4686. if (Object.prototype.hasOwnProperty.call(obj, k) && obj[k] !== void 0) {
  4687. out[k] = obj[k];
  4688. }
  4689. }
  4690. }
  4691. function objectMode(stream) {
  4692. return stream._writableState && stream._writableState.objectMode === true;
  4693. }
  4694. function stringify(level, name, message, obj) {
  4695. let s = '{"time":' + (individual.fastTime ? Date.now() : '"' + (/* @__PURE__ */ new Date()).toISOString() + '"') + scache[level] + '","name":' + name + (message !== void 0 ? ',"message":' + _stringify(message) : "");
  4696. for (const k in obj) {
  4697. s += "," + _stringify(k) + ":" + _stringify(obj[k]);
  4698. }
  4699. s += "}";
  4700. Number(s);
  4701. return s;
  4702. }
  4703. function extend(level, name, message, obj) {
  4704. const newObj = {
  4705. time: individual.fastTime ? Date.now() : (/* @__PURE__ */ new Date()).toISOString(),
  4706. hostname,
  4707. pid,
  4708. level,
  4709. name
  4710. };
  4711. if (message !== void 0) {
  4712. obj.message = message;
  4713. }
  4714. for (const k in obj) {
  4715. newObj[k] = obj[k];
  4716. }
  4717. return newObj;
  4718. }
  4719. function levelLogger(level, name) {
  4720. const outputs = individual[level];
  4721. const nameSt = _stringify(name);
  4722. return function namedLevelLogger(inp, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) {
  4723. if (outputs.length === 0) {
  4724. return;
  4725. }
  4726. const out = {};
  4727. let objectOut;
  4728. let i = 0;
  4729. const l = outputs.length;
  4730. let stringified;
  4731. let message;
  4732. if (typeof inp === "string" || inp == null) {
  4733. if (!(message = format(inp, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
  4734. message = void 0;
  4735. }
  4736. } else {
  4737. if (inp instanceof Error) {
  4738. if (typeof a2 === "object") {
  4739. objectToOut(a2, out);
  4740. errorToOut(inp, out);
  4741. if (!(message = format(a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
  4742. message = void 0;
  4743. }
  4744. } else {
  4745. errorToOut(inp, out);
  4746. if (!(message = format(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
  4747. message = void 0;
  4748. }
  4749. }
  4750. } else {
  4751. if (!(message = format(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
  4752. message = void 0;
  4753. }
  4754. }
  4755. if (typeof inp === "boolean") {
  4756. message = String(inp);
  4757. } else if (typeof inp === "object" && !(inp instanceof Error)) {
  4758. if (inp.method && inp.url && inp.headers && inp.socket) {
  4759. requestToOut(inp, out);
  4760. } else {
  4761. objectToOut(inp, out);
  4762. }
  4763. }
  4764. }
  4765. if (l === 1 && !hasObjMode) {
  4766. outputs[0].write(Buffer.from(stringify(level, nameSt, message, out) + "\n"));
  4767. return;
  4768. }
  4769. for (; i < l; i++) {
  4770. if (objectMode(outputs[i])) {
  4771. if (objectOut === void 0) {
  4772. objectOut = extend(level, name, message, out);
  4773. }
  4774. outputs[i].write(objectOut);
  4775. } else {
  4776. if (stringified === void 0) {
  4777. stringified = Buffer.from(stringify(level, nameSt, message, out) + "\n");
  4778. }
  4779. outputs[i].write(stringified);
  4780. }
  4781. }
  4782. };
  4783. }
  4784. function bole(name) {
  4785. function boleLogger(subname) {
  4786. return bole(name + ":" + subname);
  4787. }
  4788. function makeLogger(p, level) {
  4789. p[level] = levelLogger(level, name);
  4790. return p;
  4791. }
  4792. return levels.reduce(makeLogger, boleLogger);
  4793. }
  4794. bole.output = function output(opt) {
  4795. let b = false;
  4796. if (Array.isArray(opt)) {
  4797. opt.forEach(bole.output);
  4798. return bole;
  4799. }
  4800. if (typeof opt.level !== "string") {
  4801. throw new TypeError('Must provide a "level" option');
  4802. }
  4803. for (const level of levels) {
  4804. if (!b && level === opt.level) {
  4805. b = true;
  4806. }
  4807. if (b) {
  4808. if (opt.stream && objectMode(opt.stream)) {
  4809. hasObjMode = true;
  4810. }
  4811. individual[level].push(opt.stream);
  4812. }
  4813. }
  4814. return bole;
  4815. };
  4816. bole.reset = function reset() {
  4817. for (const level of levels) {
  4818. individual[level].splice(0, individual[level].length);
  4819. }
  4820. individual.fastTime = false;
  4821. return bole;
  4822. };
  4823. bole.setFastTime = function setFastTime(b) {
  4824. if (!arguments.length) {
  4825. individual.fastTime = true;
  4826. } else {
  4827. individual.fastTime = b;
  4828. }
  4829. return bole;
  4830. };
  4831. module2.exports = bole;
  4832. }
  4833. });
  4834. // ../packages/logger/lib/logger.js
  4835. var require_logger = __commonJS({
  4836. "../packages/logger/lib/logger.js"(exports2) {
  4837. "use strict";
  4838. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  4839. return mod && mod.__esModule ? mod : { "default": mod };
  4840. };
  4841. Object.defineProperty(exports2, "__esModule", { value: true });
  4842. exports2.logger = void 0;
  4843. exports2.globalWarn = globalWarn;
  4844. exports2.globalInfo = globalInfo;
  4845. var bole_1 = __importDefault2(require_bole());
  4846. bole_1.default.setFastTime();
  4847. exports2.logger = (0, bole_1.default)("pnpm");
  4848. var globalLogger = (0, bole_1.default)("pnpm:global");
  4849. function globalWarn(message) {
  4850. globalLogger.warn(message);
  4851. }
  4852. function globalInfo(message) {
  4853. globalLogger.info(message);
  4854. }
  4855. }
  4856. });
  4857. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream.js
  4858. var require_stream = __commonJS({
  4859. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream.js"(exports2, module2) {
  4860. module2.exports = require("stream");
  4861. }
  4862. });
  4863. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/buffer_list.js
  4864. var require_buffer_list = __commonJS({
  4865. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports2, module2) {
  4866. "use strict";
  4867. function ownKeys(object, enumerableOnly) {
  4868. var keys = Object.keys(object);
  4869. if (Object.getOwnPropertySymbols) {
  4870. var symbols = Object.getOwnPropertySymbols(object);
  4871. enumerableOnly && (symbols = symbols.filter(function(sym) {
  4872. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  4873. })), keys.push.apply(keys, symbols);
  4874. }
  4875. return keys;
  4876. }
  4877. function _objectSpread(target) {
  4878. for (var i = 1; i < arguments.length; i++) {
  4879. var source = null != arguments[i] ? arguments[i] : {};
  4880. i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
  4881. _defineProperty(target, key, source[key]);
  4882. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
  4883. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  4884. });
  4885. }
  4886. return target;
  4887. }
  4888. function _defineProperty(obj, key, value) {
  4889. key = _toPropertyKey(key);
  4890. if (key in obj) {
  4891. Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  4892. } else {
  4893. obj[key] = value;
  4894. }
  4895. return obj;
  4896. }
  4897. function _classCallCheck(instance, Constructor) {
  4898. if (!(instance instanceof Constructor)) {
  4899. throw new TypeError("Cannot call a class as a function");
  4900. }
  4901. }
  4902. function _defineProperties(target, props) {
  4903. for (var i = 0; i < props.length; i++) {
  4904. var descriptor = props[i];
  4905. descriptor.enumerable = descriptor.enumerable || false;
  4906. descriptor.configurable = true;
  4907. if ("value" in descriptor) descriptor.writable = true;
  4908. Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
  4909. }
  4910. }
  4911. function _createClass(Constructor, protoProps, staticProps) {
  4912. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  4913. if (staticProps) _defineProperties(Constructor, staticProps);
  4914. Object.defineProperty(Constructor, "prototype", { writable: false });
  4915. return Constructor;
  4916. }
  4917. function _toPropertyKey(arg) {
  4918. var key = _toPrimitive(arg, "string");
  4919. return typeof key === "symbol" ? key : String(key);
  4920. }
  4921. function _toPrimitive(input, hint) {
  4922. if (typeof input !== "object" || input === null) return input;
  4923. var prim = input[Symbol.toPrimitive];
  4924. if (prim !== void 0) {
  4925. var res = prim.call(input, hint || "default");
  4926. if (typeof res !== "object") return res;
  4927. throw new TypeError("@@toPrimitive must return a primitive value.");
  4928. }
  4929. return (hint === "string" ? String : Number)(input);
  4930. }
  4931. var _require = require("buffer");
  4932. var Buffer2 = _require.Buffer;
  4933. var _require2 = require("util");
  4934. var inspect = _require2.inspect;
  4935. var custom = inspect && inspect.custom || "inspect";
  4936. function copyBuffer(src, target, offset) {
  4937. Buffer2.prototype.copy.call(src, target, offset);
  4938. }
  4939. module2.exports = /* @__PURE__ */ function() {
  4940. function BufferList() {
  4941. _classCallCheck(this, BufferList);
  4942. this.head = null;
  4943. this.tail = null;
  4944. this.length = 0;
  4945. }
  4946. _createClass(BufferList, [{
  4947. key: "push",
  4948. value: function push(v) {
  4949. var entry = {
  4950. data: v,
  4951. next: null
  4952. };
  4953. if (this.length > 0) this.tail.next = entry;
  4954. else this.head = entry;
  4955. this.tail = entry;
  4956. ++this.length;
  4957. }
  4958. }, {
  4959. key: "unshift",
  4960. value: function unshift(v) {
  4961. var entry = {
  4962. data: v,
  4963. next: this.head
  4964. };
  4965. if (this.length === 0) this.tail = entry;
  4966. this.head = entry;
  4967. ++this.length;
  4968. }
  4969. }, {
  4970. key: "shift",
  4971. value: function shift() {
  4972. if (this.length === 0) return;
  4973. var ret = this.head.data;
  4974. if (this.length === 1) this.head = this.tail = null;
  4975. else this.head = this.head.next;
  4976. --this.length;
  4977. return ret;
  4978. }
  4979. }, {
  4980. key: "clear",
  4981. value: function clear() {
  4982. this.head = this.tail = null;
  4983. this.length = 0;
  4984. }
  4985. }, {
  4986. key: "join",
  4987. value: function join(s) {
  4988. if (this.length === 0) return "";
  4989. var p = this.head;
  4990. var ret = "" + p.data;
  4991. while (p = p.next) ret += s + p.data;
  4992. return ret;
  4993. }
  4994. }, {
  4995. key: "concat",
  4996. value: function concat(n) {
  4997. if (this.length === 0) return Buffer2.alloc(0);
  4998. var ret = Buffer2.allocUnsafe(n >>> 0);
  4999. var p = this.head;
  5000. var i = 0;
  5001. while (p) {
  5002. copyBuffer(p.data, ret, i);
  5003. i += p.data.length;
  5004. p = p.next;
  5005. }
  5006. return ret;
  5007. }
  5008. // Consumes a specified amount of bytes or characters from the buffered data.
  5009. }, {
  5010. key: "consume",
  5011. value: function consume(n, hasStrings) {
  5012. var ret;
  5013. if (n < this.head.data.length) {
  5014. ret = this.head.data.slice(0, n);
  5015. this.head.data = this.head.data.slice(n);
  5016. } else if (n === this.head.data.length) {
  5017. ret = this.shift();
  5018. } else {
  5019. ret = hasStrings ? this._getString(n) : this._getBuffer(n);
  5020. }
  5021. return ret;
  5022. }
  5023. }, {
  5024. key: "first",
  5025. value: function first() {
  5026. return this.head.data;
  5027. }
  5028. // Consumes a specified amount of characters from the buffered data.
  5029. }, {
  5030. key: "_getString",
  5031. value: function _getString(n) {
  5032. var p = this.head;
  5033. var c = 1;
  5034. var ret = p.data;
  5035. n -= ret.length;
  5036. while (p = p.next) {
  5037. var str = p.data;
  5038. var nb = n > str.length ? str.length : n;
  5039. if (nb === str.length) ret += str;
  5040. else ret += str.slice(0, n);
  5041. n -= nb;
  5042. if (n === 0) {
  5043. if (nb === str.length) {
  5044. ++c;
  5045. if (p.next) this.head = p.next;
  5046. else this.head = this.tail = null;
  5047. } else {
  5048. this.head = p;
  5049. p.data = str.slice(nb);
  5050. }
  5051. break;
  5052. }
  5053. ++c;
  5054. }
  5055. this.length -= c;
  5056. return ret;
  5057. }
  5058. // Consumes a specified amount of bytes from the buffered data.
  5059. }, {
  5060. key: "_getBuffer",
  5061. value: function _getBuffer(n) {
  5062. var ret = Buffer2.allocUnsafe(n);
  5063. var p = this.head;
  5064. var c = 1;
  5065. p.data.copy(ret);
  5066. n -= p.data.length;
  5067. while (p = p.next) {
  5068. var buf = p.data;
  5069. var nb = n > buf.length ? buf.length : n;
  5070. buf.copy(ret, ret.length - n, 0, nb);
  5071. n -= nb;
  5072. if (n === 0) {
  5073. if (nb === buf.length) {
  5074. ++c;
  5075. if (p.next) this.head = p.next;
  5076. else this.head = this.tail = null;
  5077. } else {
  5078. this.head = p;
  5079. p.data = buf.slice(nb);
  5080. }
  5081. break;
  5082. }
  5083. ++c;
  5084. }
  5085. this.length -= c;
  5086. return ret;
  5087. }
  5088. // Make sure the linked list only shows the minimal necessary information.
  5089. }, {
  5090. key: custom,
  5091. value: function value(_, options) {
  5092. return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
  5093. // Only inspect one level.
  5094. depth: 0,
  5095. // It should not recurse.
  5096. customInspect: false
  5097. }));
  5098. }
  5099. }]);
  5100. return BufferList;
  5101. }();
  5102. }
  5103. });
  5104. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js
  5105. var require_destroy = __commonJS({
  5106. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
  5107. "use strict";
  5108. function destroy(err, cb) {
  5109. var _this = this;
  5110. var readableDestroyed = this._readableState && this._readableState.destroyed;
  5111. var writableDestroyed = this._writableState && this._writableState.destroyed;
  5112. if (readableDestroyed || writableDestroyed) {
  5113. if (cb) {
  5114. cb(err);
  5115. } else if (err) {
  5116. if (!this._writableState) {
  5117. process.nextTick(emitErrorNT, this, err);
  5118. } else if (!this._writableState.errorEmitted) {
  5119. this._writableState.errorEmitted = true;
  5120. process.nextTick(emitErrorNT, this, err);
  5121. }
  5122. }
  5123. return this;
  5124. }
  5125. if (this._readableState) {
  5126. this._readableState.destroyed = true;
  5127. }
  5128. if (this._writableState) {
  5129. this._writableState.destroyed = true;
  5130. }
  5131. this._destroy(err || null, function(err2) {
  5132. if (!cb && err2) {
  5133. if (!_this._writableState) {
  5134. process.nextTick(emitErrorAndCloseNT, _this, err2);
  5135. } else if (!_this._writableState.errorEmitted) {
  5136. _this._writableState.errorEmitted = true;
  5137. process.nextTick(emitErrorAndCloseNT, _this, err2);
  5138. } else {
  5139. process.nextTick(emitCloseNT, _this);
  5140. }
  5141. } else if (cb) {
  5142. process.nextTick(emitCloseNT, _this);
  5143. cb(err2);
  5144. } else {
  5145. process.nextTick(emitCloseNT, _this);
  5146. }
  5147. });
  5148. return this;
  5149. }
  5150. function emitErrorAndCloseNT(self2, err) {
  5151. emitErrorNT(self2, err);
  5152. emitCloseNT(self2);
  5153. }
  5154. function emitCloseNT(self2) {
  5155. if (self2._writableState && !self2._writableState.emitClose) return;
  5156. if (self2._readableState && !self2._readableState.emitClose) return;
  5157. self2.emit("close");
  5158. }
  5159. function undestroy() {
  5160. if (this._readableState) {
  5161. this._readableState.destroyed = false;
  5162. this._readableState.reading = false;
  5163. this._readableState.ended = false;
  5164. this._readableState.endEmitted = false;
  5165. }
  5166. if (this._writableState) {
  5167. this._writableState.destroyed = false;
  5168. this._writableState.ended = false;
  5169. this._writableState.ending = false;
  5170. this._writableState.finalCalled = false;
  5171. this._writableState.prefinished = false;
  5172. this._writableState.finished = false;
  5173. this._writableState.errorEmitted = false;
  5174. }
  5175. }
  5176. function emitErrorNT(self2, err) {
  5177. self2.emit("error", err);
  5178. }
  5179. function errorOrDestroy(stream, err) {
  5180. var rState = stream._readableState;
  5181. var wState = stream._writableState;
  5182. if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);
  5183. else stream.emit("error", err);
  5184. }
  5185. module2.exports = {
  5186. destroy,
  5187. undestroy,
  5188. errorOrDestroy
  5189. };
  5190. }
  5191. });
  5192. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors.js
  5193. var require_errors = __commonJS({
  5194. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors.js"(exports2, module2) {
  5195. "use strict";
  5196. var codes = {};
  5197. function createErrorType(code, message, Base) {
  5198. if (!Base) {
  5199. Base = Error;
  5200. }
  5201. function getMessage(arg1, arg2, arg3) {
  5202. if (typeof message === "string") {
  5203. return message;
  5204. } else {
  5205. return message(arg1, arg2, arg3);
  5206. }
  5207. }
  5208. class NodeError extends Base {
  5209. constructor(arg1, arg2, arg3) {
  5210. super(getMessage(arg1, arg2, arg3));
  5211. }
  5212. }
  5213. NodeError.prototype.name = Base.name;
  5214. NodeError.prototype.code = code;
  5215. codes[code] = NodeError;
  5216. }
  5217. function oneOf(expected, thing) {
  5218. if (Array.isArray(expected)) {
  5219. const len = expected.length;
  5220. expected = expected.map((i) => String(i));
  5221. if (len > 2) {
  5222. return `one of ${thing} ${expected.slice(0, len - 1).join(", ")}, or ` + expected[len - 1];
  5223. } else if (len === 2) {
  5224. return `one of ${thing} ${expected[0]} or ${expected[1]}`;
  5225. } else {
  5226. return `of ${thing} ${expected[0]}`;
  5227. }
  5228. } else {
  5229. return `of ${thing} ${String(expected)}`;
  5230. }
  5231. }
  5232. function startsWith(str, search, pos) {
  5233. return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
  5234. }
  5235. function endsWith(str, search, this_len) {
  5236. if (this_len === void 0 || this_len > str.length) {
  5237. this_len = str.length;
  5238. }
  5239. return str.substring(this_len - search.length, this_len) === search;
  5240. }
  5241. function includes(str, search, start) {
  5242. if (typeof start !== "number") {
  5243. start = 0;
  5244. }
  5245. if (start + search.length > str.length) {
  5246. return false;
  5247. } else {
  5248. return str.indexOf(search, start) !== -1;
  5249. }
  5250. }
  5251. createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {
  5252. return 'The value "' + value + '" is invalid for option "' + name + '"';
  5253. }, TypeError);
  5254. createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {
  5255. let determiner;
  5256. if (typeof expected === "string" && startsWith(expected, "not ")) {
  5257. determiner = "must not be";
  5258. expected = expected.replace(/^not /, "");
  5259. } else {
  5260. determiner = "must be";
  5261. }
  5262. let msg;
  5263. if (endsWith(name, " argument")) {
  5264. msg = `The ${name} ${determiner} ${oneOf(expected, "type")}`;
  5265. } else {
  5266. const type = includes(name, ".") ? "property" : "argument";
  5267. msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, "type")}`;
  5268. }
  5269. msg += `. Received type ${typeof actual}`;
  5270. return msg;
  5271. }, TypeError);
  5272. createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
  5273. createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {
  5274. return "The " + name + " method is not implemented";
  5275. });
  5276. createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
  5277. createErrorType("ERR_STREAM_DESTROYED", function(name) {
  5278. return "Cannot call " + name + " after a stream was destroyed";
  5279. });
  5280. createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
  5281. createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
  5282. createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
  5283. createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
  5284. createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
  5285. return "Unknown encoding: " + arg;
  5286. }, TypeError);
  5287. createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
  5288. module2.exports.codes = codes;
  5289. }
  5290. });
  5291. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js
  5292. var require_state = __commonJS({
  5293. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js"(exports2, module2) {
  5294. "use strict";
  5295. var ERR_INVALID_OPT_VALUE = require_errors().codes.ERR_INVALID_OPT_VALUE;
  5296. function highWaterMarkFrom(options, isDuplex, duplexKey) {
  5297. return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
  5298. }
  5299. function getHighWaterMark(state, options, duplexKey, isDuplex) {
  5300. var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
  5301. if (hwm != null) {
  5302. if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
  5303. var name = isDuplex ? duplexKey : "highWaterMark";
  5304. throw new ERR_INVALID_OPT_VALUE(name, hwm);
  5305. }
  5306. return Math.floor(hwm);
  5307. }
  5308. return state.objectMode ? 16 : 16 * 1024;
  5309. }
  5310. module2.exports = {
  5311. getHighWaterMark
  5312. };
  5313. }
  5314. });
  5315. // ../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
  5316. var require_inherits_browser = __commonJS({
  5317. "../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports2, module2) {
  5318. if (typeof Object.create === "function") {
  5319. module2.exports = function inherits(ctor, superCtor) {
  5320. if (superCtor) {
  5321. ctor.super_ = superCtor;
  5322. ctor.prototype = Object.create(superCtor.prototype, {
  5323. constructor: {
  5324. value: ctor,
  5325. enumerable: false,
  5326. writable: true,
  5327. configurable: true
  5328. }
  5329. });
  5330. }
  5331. };
  5332. } else {
  5333. module2.exports = function inherits(ctor, superCtor) {
  5334. if (superCtor) {
  5335. ctor.super_ = superCtor;
  5336. var TempCtor = function() {
  5337. };
  5338. TempCtor.prototype = superCtor.prototype;
  5339. ctor.prototype = new TempCtor();
  5340. ctor.prototype.constructor = ctor;
  5341. }
  5342. };
  5343. }
  5344. }
  5345. });
  5346. // ../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js
  5347. var require_inherits = __commonJS({
  5348. "../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js"(exports2, module2) {
  5349. try {
  5350. util = require("util");
  5351. if (typeof util.inherits !== "function") throw "";
  5352. module2.exports = util.inherits;
  5353. } catch (e) {
  5354. module2.exports = require_inherits_browser();
  5355. }
  5356. var util;
  5357. }
  5358. });
  5359. // ../node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/node.js
  5360. var require_node = __commonJS({
  5361. "../node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/node.js"(exports2, module2) {
  5362. module2.exports = require("util").deprecate;
  5363. }
  5364. });
  5365. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js
  5366. var require_stream_writable = __commonJS({
  5367. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js"(exports2, module2) {
  5368. "use strict";
  5369. module2.exports = Writable;
  5370. function CorkedRequest(state) {
  5371. var _this = this;
  5372. this.next = null;
  5373. this.entry = null;
  5374. this.finish = function() {
  5375. onCorkedFinish(_this, state);
  5376. };
  5377. }
  5378. var Duplex;
  5379. Writable.WritableState = WritableState;
  5380. var internalUtil = {
  5381. deprecate: require_node()
  5382. };
  5383. var Stream = require_stream();
  5384. var Buffer2 = require("buffer").Buffer;
  5385. var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
  5386. };
  5387. function _uint8ArrayToBuffer(chunk) {
  5388. return Buffer2.from(chunk);
  5389. }
  5390. function _isUint8Array(obj) {
  5391. return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
  5392. }
  5393. var destroyImpl = require_destroy();
  5394. var _require = require_state();
  5395. var getHighWaterMark = _require.getHighWaterMark;
  5396. var _require$codes = require_errors().codes;
  5397. var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
  5398. var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
  5399. var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
  5400. var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;
  5401. var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
  5402. var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;
  5403. var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
  5404. var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
  5405. var errorOrDestroy = destroyImpl.errorOrDestroy;
  5406. require_inherits()(Writable, Stream);
  5407. function nop() {
  5408. }
  5409. function WritableState(options, stream, isDuplex) {
  5410. Duplex = Duplex || require_stream_duplex();
  5411. options = options || {};
  5412. if (typeof isDuplex !== "boolean") isDuplex = stream instanceof Duplex;
  5413. this.objectMode = !!options.objectMode;
  5414. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  5415. this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);
  5416. this.finalCalled = false;
  5417. this.needDrain = false;
  5418. this.ending = false;
  5419. this.ended = false;
  5420. this.finished = false;
  5421. this.destroyed = false;
  5422. var noDecode = options.decodeStrings === false;
  5423. this.decodeStrings = !noDecode;
  5424. this.defaultEncoding = options.defaultEncoding || "utf8";
  5425. this.length = 0;
  5426. this.writing = false;
  5427. this.corked = 0;
  5428. this.sync = true;
  5429. this.bufferProcessing = false;
  5430. this.onwrite = function(er) {
  5431. onwrite(stream, er);
  5432. };
  5433. this.writecb = null;
  5434. this.writelen = 0;
  5435. this.bufferedRequest = null;
  5436. this.lastBufferedRequest = null;
  5437. this.pendingcb = 0;
  5438. this.prefinished = false;
  5439. this.errorEmitted = false;
  5440. this.emitClose = options.emitClose !== false;
  5441. this.autoDestroy = !!options.autoDestroy;
  5442. this.bufferedRequestCount = 0;
  5443. this.corkedRequestsFree = new CorkedRequest(this);
  5444. }
  5445. WritableState.prototype.getBuffer = function getBuffer() {
  5446. var current = this.bufferedRequest;
  5447. var out = [];
  5448. while (current) {
  5449. out.push(current);
  5450. current = current.next;
  5451. }
  5452. return out;
  5453. };
  5454. (function() {
  5455. try {
  5456. Object.defineProperty(WritableState.prototype, "buffer", {
  5457. get: internalUtil.deprecate(function writableStateBufferGetter() {
  5458. return this.getBuffer();
  5459. }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
  5460. });
  5461. } catch (_) {
  5462. }
  5463. })();
  5464. var realHasInstance;
  5465. if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
  5466. realHasInstance = Function.prototype[Symbol.hasInstance];
  5467. Object.defineProperty(Writable, Symbol.hasInstance, {
  5468. value: function value(object) {
  5469. if (realHasInstance.call(this, object)) return true;
  5470. if (this !== Writable) return false;
  5471. return object && object._writableState instanceof WritableState;
  5472. }
  5473. });
  5474. } else {
  5475. realHasInstance = function realHasInstance2(object) {
  5476. return object instanceof this;
  5477. };
  5478. }
  5479. function Writable(options) {
  5480. Duplex = Duplex || require_stream_duplex();
  5481. var isDuplex = this instanceof Duplex;
  5482. if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
  5483. this._writableState = new WritableState(options, this, isDuplex);
  5484. this.writable = true;
  5485. if (options) {
  5486. if (typeof options.write === "function") this._write = options.write;
  5487. if (typeof options.writev === "function") this._writev = options.writev;
  5488. if (typeof options.destroy === "function") this._destroy = options.destroy;
  5489. if (typeof options.final === "function") this._final = options.final;
  5490. }
  5491. Stream.call(this);
  5492. }
  5493. Writable.prototype.pipe = function() {
  5494. errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
  5495. };
  5496. function writeAfterEnd(stream, cb) {
  5497. var er = new ERR_STREAM_WRITE_AFTER_END();
  5498. errorOrDestroy(stream, er);
  5499. process.nextTick(cb, er);
  5500. }
  5501. function validChunk(stream, state, chunk, cb) {
  5502. var er;
  5503. if (chunk === null) {
  5504. er = new ERR_STREAM_NULL_VALUES();
  5505. } else if (typeof chunk !== "string" && !state.objectMode) {
  5506. er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
  5507. }
  5508. if (er) {
  5509. errorOrDestroy(stream, er);
  5510. process.nextTick(cb, er);
  5511. return false;
  5512. }
  5513. return true;
  5514. }
  5515. Writable.prototype.write = function(chunk, encoding, cb) {
  5516. var state = this._writableState;
  5517. var ret = false;
  5518. var isBuf = !state.objectMode && _isUint8Array(chunk);
  5519. if (isBuf && !Buffer2.isBuffer(chunk)) {
  5520. chunk = _uint8ArrayToBuffer(chunk);
  5521. }
  5522. if (typeof encoding === "function") {
  5523. cb = encoding;
  5524. encoding = null;
  5525. }
  5526. if (isBuf) encoding = "buffer";
  5527. else if (!encoding) encoding = state.defaultEncoding;
  5528. if (typeof cb !== "function") cb = nop;
  5529. if (state.ending) writeAfterEnd(this, cb);
  5530. else if (isBuf || validChunk(this, state, chunk, cb)) {
  5531. state.pendingcb++;
  5532. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  5533. }
  5534. return ret;
  5535. };
  5536. Writable.prototype.cork = function() {
  5537. this._writableState.corked++;
  5538. };
  5539. Writable.prototype.uncork = function() {
  5540. var state = this._writableState;
  5541. if (state.corked) {
  5542. state.corked--;
  5543. if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  5544. }
  5545. };
  5546. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  5547. if (typeof encoding === "string") encoding = encoding.toLowerCase();
  5548. if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
  5549. this._writableState.defaultEncoding = encoding;
  5550. return this;
  5551. };
  5552. Object.defineProperty(Writable.prototype, "writableBuffer", {
  5553. // making it explicit this property is not enumerable
  5554. // because otherwise some prototype manipulation in
  5555. // userland will fail
  5556. enumerable: false,
  5557. get: function get() {
  5558. return this._writableState && this._writableState.getBuffer();
  5559. }
  5560. });
  5561. function decodeChunk(state, chunk, encoding) {
  5562. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
  5563. chunk = Buffer2.from(chunk, encoding);
  5564. }
  5565. return chunk;
  5566. }
  5567. Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
  5568. // making it explicit this property is not enumerable
  5569. // because otherwise some prototype manipulation in
  5570. // userland will fail
  5571. enumerable: false,
  5572. get: function get() {
  5573. return this._writableState.highWaterMark;
  5574. }
  5575. });
  5576. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  5577. if (!isBuf) {
  5578. var newChunk = decodeChunk(state, chunk, encoding);
  5579. if (chunk !== newChunk) {
  5580. isBuf = true;
  5581. encoding = "buffer";
  5582. chunk = newChunk;
  5583. }
  5584. }
  5585. var len = state.objectMode ? 1 : chunk.length;
  5586. state.length += len;
  5587. var ret = state.length < state.highWaterMark;
  5588. if (!ret) state.needDrain = true;
  5589. if (state.writing || state.corked) {
  5590. var last = state.lastBufferedRequest;
  5591. state.lastBufferedRequest = {
  5592. chunk,
  5593. encoding,
  5594. isBuf,
  5595. callback: cb,
  5596. next: null
  5597. };
  5598. if (last) {
  5599. last.next = state.lastBufferedRequest;
  5600. } else {
  5601. state.bufferedRequest = state.lastBufferedRequest;
  5602. }
  5603. state.bufferedRequestCount += 1;
  5604. } else {
  5605. doWrite(stream, state, false, len, chunk, encoding, cb);
  5606. }
  5607. return ret;
  5608. }
  5609. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  5610. state.writelen = len;
  5611. state.writecb = cb;
  5612. state.writing = true;
  5613. state.sync = true;
  5614. if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED("write"));
  5615. else if (writev) stream._writev(chunk, state.onwrite);
  5616. else stream._write(chunk, encoding, state.onwrite);
  5617. state.sync = false;
  5618. }
  5619. function onwriteError(stream, state, sync, er, cb) {
  5620. --state.pendingcb;
  5621. if (sync) {
  5622. process.nextTick(cb, er);
  5623. process.nextTick(finishMaybe, stream, state);
  5624. stream._writableState.errorEmitted = true;
  5625. errorOrDestroy(stream, er);
  5626. } else {
  5627. cb(er);
  5628. stream._writableState.errorEmitted = true;
  5629. errorOrDestroy(stream, er);
  5630. finishMaybe(stream, state);
  5631. }
  5632. }
  5633. function onwriteStateUpdate(state) {
  5634. state.writing = false;
  5635. state.writecb = null;
  5636. state.length -= state.writelen;
  5637. state.writelen = 0;
  5638. }
  5639. function onwrite(stream, er) {
  5640. var state = stream._writableState;
  5641. var sync = state.sync;
  5642. var cb = state.writecb;
  5643. if (typeof cb !== "function") throw new ERR_MULTIPLE_CALLBACK();
  5644. onwriteStateUpdate(state);
  5645. if (er) onwriteError(stream, state, sync, er, cb);
  5646. else {
  5647. var finished = needFinish(state) || stream.destroyed;
  5648. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  5649. clearBuffer(stream, state);
  5650. }
  5651. if (sync) {
  5652. process.nextTick(afterWrite, stream, state, finished, cb);
  5653. } else {
  5654. afterWrite(stream, state, finished, cb);
  5655. }
  5656. }
  5657. }
  5658. function afterWrite(stream, state, finished, cb) {
  5659. if (!finished) onwriteDrain(stream, state);
  5660. state.pendingcb--;
  5661. cb();
  5662. finishMaybe(stream, state);
  5663. }
  5664. function onwriteDrain(stream, state) {
  5665. if (state.length === 0 && state.needDrain) {
  5666. state.needDrain = false;
  5667. stream.emit("drain");
  5668. }
  5669. }
  5670. function clearBuffer(stream, state) {
  5671. state.bufferProcessing = true;
  5672. var entry = state.bufferedRequest;
  5673. if (stream._writev && entry && entry.next) {
  5674. var l = state.bufferedRequestCount;
  5675. var buffer = new Array(l);
  5676. var holder = state.corkedRequestsFree;
  5677. holder.entry = entry;
  5678. var count = 0;
  5679. var allBuffers = true;
  5680. while (entry) {
  5681. buffer[count] = entry;
  5682. if (!entry.isBuf) allBuffers = false;
  5683. entry = entry.next;
  5684. count += 1;
  5685. }
  5686. buffer.allBuffers = allBuffers;
  5687. doWrite(stream, state, true, state.length, buffer, "", holder.finish);
  5688. state.pendingcb++;
  5689. state.lastBufferedRequest = null;
  5690. if (holder.next) {
  5691. state.corkedRequestsFree = holder.next;
  5692. holder.next = null;
  5693. } else {
  5694. state.corkedRequestsFree = new CorkedRequest(state);
  5695. }
  5696. state.bufferedRequestCount = 0;
  5697. } else {
  5698. while (entry) {
  5699. var chunk = entry.chunk;
  5700. var encoding = entry.encoding;
  5701. var cb = entry.callback;
  5702. var len = state.objectMode ? 1 : chunk.length;
  5703. doWrite(stream, state, false, len, chunk, encoding, cb);
  5704. entry = entry.next;
  5705. state.bufferedRequestCount--;
  5706. if (state.writing) {
  5707. break;
  5708. }
  5709. }
  5710. if (entry === null) state.lastBufferedRequest = null;
  5711. }
  5712. state.bufferedRequest = entry;
  5713. state.bufferProcessing = false;
  5714. }
  5715. Writable.prototype._write = function(chunk, encoding, cb) {
  5716. cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
  5717. };
  5718. Writable.prototype._writev = null;
  5719. Writable.prototype.end = function(chunk, encoding, cb) {
  5720. var state = this._writableState;
  5721. if (typeof chunk === "function") {
  5722. cb = chunk;
  5723. chunk = null;
  5724. encoding = null;
  5725. } else if (typeof encoding === "function") {
  5726. cb = encoding;
  5727. encoding = null;
  5728. }
  5729. if (chunk !== null && chunk !== void 0) this.write(chunk, encoding);
  5730. if (state.corked) {
  5731. state.corked = 1;
  5732. this.uncork();
  5733. }
  5734. if (!state.ending) endWritable(this, state, cb);
  5735. return this;
  5736. };
  5737. Object.defineProperty(Writable.prototype, "writableLength", {
  5738. // making it explicit this property is not enumerable
  5739. // because otherwise some prototype manipulation in
  5740. // userland will fail
  5741. enumerable: false,
  5742. get: function get() {
  5743. return this._writableState.length;
  5744. }
  5745. });
  5746. function needFinish(state) {
  5747. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  5748. }
  5749. function callFinal(stream, state) {
  5750. stream._final(function(err) {
  5751. state.pendingcb--;
  5752. if (err) {
  5753. errorOrDestroy(stream, err);
  5754. }
  5755. state.prefinished = true;
  5756. stream.emit("prefinish");
  5757. finishMaybe(stream, state);
  5758. });
  5759. }
  5760. function prefinish(stream, state) {
  5761. if (!state.prefinished && !state.finalCalled) {
  5762. if (typeof stream._final === "function" && !state.destroyed) {
  5763. state.pendingcb++;
  5764. state.finalCalled = true;
  5765. process.nextTick(callFinal, stream, state);
  5766. } else {
  5767. state.prefinished = true;
  5768. stream.emit("prefinish");
  5769. }
  5770. }
  5771. }
  5772. function finishMaybe(stream, state) {
  5773. var need = needFinish(state);
  5774. if (need) {
  5775. prefinish(stream, state);
  5776. if (state.pendingcb === 0) {
  5777. state.finished = true;
  5778. stream.emit("finish");
  5779. if (state.autoDestroy) {
  5780. var rState = stream._readableState;
  5781. if (!rState || rState.autoDestroy && rState.endEmitted) {
  5782. stream.destroy();
  5783. }
  5784. }
  5785. }
  5786. }
  5787. return need;
  5788. }
  5789. function endWritable(stream, state, cb) {
  5790. state.ending = true;
  5791. finishMaybe(stream, state);
  5792. if (cb) {
  5793. if (state.finished) process.nextTick(cb);
  5794. else stream.once("finish", cb);
  5795. }
  5796. state.ended = true;
  5797. stream.writable = false;
  5798. }
  5799. function onCorkedFinish(corkReq, state, err) {
  5800. var entry = corkReq.entry;
  5801. corkReq.entry = null;
  5802. while (entry) {
  5803. var cb = entry.callback;
  5804. state.pendingcb--;
  5805. cb(err);
  5806. entry = entry.next;
  5807. }
  5808. state.corkedRequestsFree.next = corkReq;
  5809. }
  5810. Object.defineProperty(Writable.prototype, "destroyed", {
  5811. // making it explicit this property is not enumerable
  5812. // because otherwise some prototype manipulation in
  5813. // userland will fail
  5814. enumerable: false,
  5815. get: function get() {
  5816. if (this._writableState === void 0) {
  5817. return false;
  5818. }
  5819. return this._writableState.destroyed;
  5820. },
  5821. set: function set(value) {
  5822. if (!this._writableState) {
  5823. return;
  5824. }
  5825. this._writableState.destroyed = value;
  5826. }
  5827. });
  5828. Writable.prototype.destroy = destroyImpl.destroy;
  5829. Writable.prototype._undestroy = destroyImpl.undestroy;
  5830. Writable.prototype._destroy = function(err, cb) {
  5831. cb(err);
  5832. };
  5833. }
  5834. });
  5835. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js
  5836. var require_stream_duplex = __commonJS({
  5837. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js"(exports2, module2) {
  5838. "use strict";
  5839. var objectKeys = Object.keys || function(obj) {
  5840. var keys2 = [];
  5841. for (var key in obj) keys2.push(key);
  5842. return keys2;
  5843. };
  5844. module2.exports = Duplex;
  5845. var Readable = require_stream_readable();
  5846. var Writable = require_stream_writable();
  5847. require_inherits()(Duplex, Readable);
  5848. {
  5849. keys = objectKeys(Writable.prototype);
  5850. for (v = 0; v < keys.length; v++) {
  5851. method = keys[v];
  5852. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  5853. }
  5854. }
  5855. var keys;
  5856. var method;
  5857. var v;
  5858. function Duplex(options) {
  5859. if (!(this instanceof Duplex)) return new Duplex(options);
  5860. Readable.call(this, options);
  5861. Writable.call(this, options);
  5862. this.allowHalfOpen = true;
  5863. if (options) {
  5864. if (options.readable === false) this.readable = false;
  5865. if (options.writable === false) this.writable = false;
  5866. if (options.allowHalfOpen === false) {
  5867. this.allowHalfOpen = false;
  5868. this.once("end", onend);
  5869. }
  5870. }
  5871. }
  5872. Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
  5873. // making it explicit this property is not enumerable
  5874. // because otherwise some prototype manipulation in
  5875. // userland will fail
  5876. enumerable: false,
  5877. get: function get() {
  5878. return this._writableState.highWaterMark;
  5879. }
  5880. });
  5881. Object.defineProperty(Duplex.prototype, "writableBuffer", {
  5882. // making it explicit this property is not enumerable
  5883. // because otherwise some prototype manipulation in
  5884. // userland will fail
  5885. enumerable: false,
  5886. get: function get() {
  5887. return this._writableState && this._writableState.getBuffer();
  5888. }
  5889. });
  5890. Object.defineProperty(Duplex.prototype, "writableLength", {
  5891. // making it explicit this property is not enumerable
  5892. // because otherwise some prototype manipulation in
  5893. // userland will fail
  5894. enumerable: false,
  5895. get: function get() {
  5896. return this._writableState.length;
  5897. }
  5898. });
  5899. function onend() {
  5900. if (this._writableState.ended) return;
  5901. process.nextTick(onEndNT, this);
  5902. }
  5903. function onEndNT(self2) {
  5904. self2.end();
  5905. }
  5906. Object.defineProperty(Duplex.prototype, "destroyed", {
  5907. // making it explicit this property is not enumerable
  5908. // because otherwise some prototype manipulation in
  5909. // userland will fail
  5910. enumerable: false,
  5911. get: function get() {
  5912. if (this._readableState === void 0 || this._writableState === void 0) {
  5913. return false;
  5914. }
  5915. return this._readableState.destroyed && this._writableState.destroyed;
  5916. },
  5917. set: function set(value) {
  5918. if (this._readableState === void 0 || this._writableState === void 0) {
  5919. return;
  5920. }
  5921. this._readableState.destroyed = value;
  5922. this._writableState.destroyed = value;
  5923. }
  5924. });
  5925. }
  5926. });
  5927. // ../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
  5928. var require_safe_buffer = __commonJS({
  5929. "../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports2, module2) {
  5930. var buffer = require("buffer");
  5931. var Buffer2 = buffer.Buffer;
  5932. function copyProps(src, dst) {
  5933. for (var key in src) {
  5934. dst[key] = src[key];
  5935. }
  5936. }
  5937. if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
  5938. module2.exports = buffer;
  5939. } else {
  5940. copyProps(buffer, exports2);
  5941. exports2.Buffer = SafeBuffer;
  5942. }
  5943. function SafeBuffer(arg, encodingOrOffset, length) {
  5944. return Buffer2(arg, encodingOrOffset, length);
  5945. }
  5946. SafeBuffer.prototype = Object.create(Buffer2.prototype);
  5947. copyProps(Buffer2, SafeBuffer);
  5948. SafeBuffer.from = function(arg, encodingOrOffset, length) {
  5949. if (typeof arg === "number") {
  5950. throw new TypeError("Argument must not be a number");
  5951. }
  5952. return Buffer2(arg, encodingOrOffset, length);
  5953. };
  5954. SafeBuffer.alloc = function(size, fill, encoding) {
  5955. if (typeof size !== "number") {
  5956. throw new TypeError("Argument must be a number");
  5957. }
  5958. var buf = Buffer2(size);
  5959. if (fill !== void 0) {
  5960. if (typeof encoding === "string") {
  5961. buf.fill(fill, encoding);
  5962. } else {
  5963. buf.fill(fill);
  5964. }
  5965. } else {
  5966. buf.fill(0);
  5967. }
  5968. return buf;
  5969. };
  5970. SafeBuffer.allocUnsafe = function(size) {
  5971. if (typeof size !== "number") {
  5972. throw new TypeError("Argument must be a number");
  5973. }
  5974. return Buffer2(size);
  5975. };
  5976. SafeBuffer.allocUnsafeSlow = function(size) {
  5977. if (typeof size !== "number") {
  5978. throw new TypeError("Argument must be a number");
  5979. }
  5980. return buffer.SlowBuffer(size);
  5981. };
  5982. }
  5983. });
  5984. // ../node_modules/.pnpm/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.js
  5985. var require_string_decoder = __commonJS({
  5986. "../node_modules/.pnpm/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.js"(exports2) {
  5987. "use strict";
  5988. var Buffer2 = require_safe_buffer().Buffer;
  5989. var isEncoding = Buffer2.isEncoding || function(encoding) {
  5990. encoding = "" + encoding;
  5991. switch (encoding && encoding.toLowerCase()) {
  5992. case "hex":
  5993. case "utf8":
  5994. case "utf-8":
  5995. case "ascii":
  5996. case "binary":
  5997. case "base64":
  5998. case "ucs2":
  5999. case "ucs-2":
  6000. case "utf16le":
  6001. case "utf-16le":
  6002. case "raw":
  6003. return true;
  6004. default:
  6005. return false;
  6006. }
  6007. };
  6008. function _normalizeEncoding(enc) {
  6009. if (!enc) return "utf8";
  6010. var retried;
  6011. while (true) {
  6012. switch (enc) {
  6013. case "utf8":
  6014. case "utf-8":
  6015. return "utf8";
  6016. case "ucs2":
  6017. case "ucs-2":
  6018. case "utf16le":
  6019. case "utf-16le":
  6020. return "utf16le";
  6021. case "latin1":
  6022. case "binary":
  6023. return "latin1";
  6024. case "base64":
  6025. case "ascii":
  6026. case "hex":
  6027. return enc;
  6028. default:
  6029. if (retried) return;
  6030. enc = ("" + enc).toLowerCase();
  6031. retried = true;
  6032. }
  6033. }
  6034. }
  6035. function normalizeEncoding(enc) {
  6036. var nenc = _normalizeEncoding(enc);
  6037. if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
  6038. return nenc || enc;
  6039. }
  6040. exports2.StringDecoder = StringDecoder;
  6041. function StringDecoder(encoding) {
  6042. this.encoding = normalizeEncoding(encoding);
  6043. var nb;
  6044. switch (this.encoding) {
  6045. case "utf16le":
  6046. this.text = utf16Text;
  6047. this.end = utf16End;
  6048. nb = 4;
  6049. break;
  6050. case "utf8":
  6051. this.fillLast = utf8FillLast;
  6052. nb = 4;
  6053. break;
  6054. case "base64":
  6055. this.text = base64Text;
  6056. this.end = base64End;
  6057. nb = 3;
  6058. break;
  6059. default:
  6060. this.write = simpleWrite;
  6061. this.end = simpleEnd;
  6062. return;
  6063. }
  6064. this.lastNeed = 0;
  6065. this.lastTotal = 0;
  6066. this.lastChar = Buffer2.allocUnsafe(nb);
  6067. }
  6068. StringDecoder.prototype.write = function(buf) {
  6069. if (buf.length === 0) return "";
  6070. var r;
  6071. var i;
  6072. if (this.lastNeed) {
  6073. r = this.fillLast(buf);
  6074. if (r === void 0) return "";
  6075. i = this.lastNeed;
  6076. this.lastNeed = 0;
  6077. } else {
  6078. i = 0;
  6079. }
  6080. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  6081. return r || "";
  6082. };
  6083. StringDecoder.prototype.end = utf8End;
  6084. StringDecoder.prototype.text = utf8Text;
  6085. StringDecoder.prototype.fillLast = function(buf) {
  6086. if (this.lastNeed <= buf.length) {
  6087. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  6088. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  6089. }
  6090. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  6091. this.lastNeed -= buf.length;
  6092. };
  6093. function utf8CheckByte(byte) {
  6094. if (byte <= 127) return 0;
  6095. else if (byte >> 5 === 6) return 2;
  6096. else if (byte >> 4 === 14) return 3;
  6097. else if (byte >> 3 === 30) return 4;
  6098. return byte >> 6 === 2 ? -1 : -2;
  6099. }
  6100. function utf8CheckIncomplete(self2, buf, i) {
  6101. var j = buf.length - 1;
  6102. if (j < i) return 0;
  6103. var nb = utf8CheckByte(buf[j]);
  6104. if (nb >= 0) {
  6105. if (nb > 0) self2.lastNeed = nb - 1;
  6106. return nb;
  6107. }
  6108. if (--j < i || nb === -2) return 0;
  6109. nb = utf8CheckByte(buf[j]);
  6110. if (nb >= 0) {
  6111. if (nb > 0) self2.lastNeed = nb - 2;
  6112. return nb;
  6113. }
  6114. if (--j < i || nb === -2) return 0;
  6115. nb = utf8CheckByte(buf[j]);
  6116. if (nb >= 0) {
  6117. if (nb > 0) {
  6118. if (nb === 2) nb = 0;
  6119. else self2.lastNeed = nb - 3;
  6120. }
  6121. return nb;
  6122. }
  6123. return 0;
  6124. }
  6125. function utf8CheckExtraBytes(self2, buf, p) {
  6126. if ((buf[0] & 192) !== 128) {
  6127. self2.lastNeed = 0;
  6128. return "\uFFFD";
  6129. }
  6130. if (self2.lastNeed > 1 && buf.length > 1) {
  6131. if ((buf[1] & 192) !== 128) {
  6132. self2.lastNeed = 1;
  6133. return "\uFFFD";
  6134. }
  6135. if (self2.lastNeed > 2 && buf.length > 2) {
  6136. if ((buf[2] & 192) !== 128) {
  6137. self2.lastNeed = 2;
  6138. return "\uFFFD";
  6139. }
  6140. }
  6141. }
  6142. }
  6143. function utf8FillLast(buf) {
  6144. var p = this.lastTotal - this.lastNeed;
  6145. var r = utf8CheckExtraBytes(this, buf, p);
  6146. if (r !== void 0) return r;
  6147. if (this.lastNeed <= buf.length) {
  6148. buf.copy(this.lastChar, p, 0, this.lastNeed);
  6149. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  6150. }
  6151. buf.copy(this.lastChar, p, 0, buf.length);
  6152. this.lastNeed -= buf.length;
  6153. }
  6154. function utf8Text(buf, i) {
  6155. var total = utf8CheckIncomplete(this, buf, i);
  6156. if (!this.lastNeed) return buf.toString("utf8", i);
  6157. this.lastTotal = total;
  6158. var end = buf.length - (total - this.lastNeed);
  6159. buf.copy(this.lastChar, 0, end);
  6160. return buf.toString("utf8", i, end);
  6161. }
  6162. function utf8End(buf) {
  6163. var r = buf && buf.length ? this.write(buf) : "";
  6164. if (this.lastNeed) return r + "\uFFFD";
  6165. return r;
  6166. }
  6167. function utf16Text(buf, i) {
  6168. if ((buf.length - i) % 2 === 0) {
  6169. var r = buf.toString("utf16le", i);
  6170. if (r) {
  6171. var c = r.charCodeAt(r.length - 1);
  6172. if (c >= 55296 && c <= 56319) {
  6173. this.lastNeed = 2;
  6174. this.lastTotal = 4;
  6175. this.lastChar[0] = buf[buf.length - 2];
  6176. this.lastChar[1] = buf[buf.length - 1];
  6177. return r.slice(0, -1);
  6178. }
  6179. }
  6180. return r;
  6181. }
  6182. this.lastNeed = 1;
  6183. this.lastTotal = 2;
  6184. this.lastChar[0] = buf[buf.length - 1];
  6185. return buf.toString("utf16le", i, buf.length - 1);
  6186. }
  6187. function utf16End(buf) {
  6188. var r = buf && buf.length ? this.write(buf) : "";
  6189. if (this.lastNeed) {
  6190. var end = this.lastTotal - this.lastNeed;
  6191. return r + this.lastChar.toString("utf16le", 0, end);
  6192. }
  6193. return r;
  6194. }
  6195. function base64Text(buf, i) {
  6196. var n = (buf.length - i) % 3;
  6197. if (n === 0) return buf.toString("base64", i);
  6198. this.lastNeed = 3 - n;
  6199. this.lastTotal = 3;
  6200. if (n === 1) {
  6201. this.lastChar[0] = buf[buf.length - 1];
  6202. } else {
  6203. this.lastChar[0] = buf[buf.length - 2];
  6204. this.lastChar[1] = buf[buf.length - 1];
  6205. }
  6206. return buf.toString("base64", i, buf.length - n);
  6207. }
  6208. function base64End(buf) {
  6209. var r = buf && buf.length ? this.write(buf) : "";
  6210. if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
  6211. return r;
  6212. }
  6213. function simpleWrite(buf) {
  6214. return buf.toString(this.encoding);
  6215. }
  6216. function simpleEnd(buf) {
  6217. return buf && buf.length ? this.write(buf) : "";
  6218. }
  6219. }
  6220. });
  6221. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js
  6222. var require_end_of_stream = __commonJS({
  6223. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2, module2) {
  6224. "use strict";
  6225. var ERR_STREAM_PREMATURE_CLOSE = require_errors().codes.ERR_STREAM_PREMATURE_CLOSE;
  6226. function once(callback) {
  6227. var called = false;
  6228. return function() {
  6229. if (called) return;
  6230. called = true;
  6231. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6232. args[_key] = arguments[_key];
  6233. }
  6234. callback.apply(this, args);
  6235. };
  6236. }
  6237. function noop() {
  6238. }
  6239. function isRequest(stream) {
  6240. return stream.setHeader && typeof stream.abort === "function";
  6241. }
  6242. function eos(stream, opts, callback) {
  6243. if (typeof opts === "function") return eos(stream, null, opts);
  6244. if (!opts) opts = {};
  6245. callback = once(callback || noop);
  6246. var readable = opts.readable || opts.readable !== false && stream.readable;
  6247. var writable = opts.writable || opts.writable !== false && stream.writable;
  6248. var onlegacyfinish = function onlegacyfinish2() {
  6249. if (!stream.writable) onfinish();
  6250. };
  6251. var writableEnded = stream._writableState && stream._writableState.finished;
  6252. var onfinish = function onfinish2() {
  6253. writable = false;
  6254. writableEnded = true;
  6255. if (!readable) callback.call(stream);
  6256. };
  6257. var readableEnded = stream._readableState && stream._readableState.endEmitted;
  6258. var onend = function onend2() {
  6259. readable = false;
  6260. readableEnded = true;
  6261. if (!writable) callback.call(stream);
  6262. };
  6263. var onerror = function onerror2(err) {
  6264. callback.call(stream, err);
  6265. };
  6266. var onclose = function onclose2() {
  6267. var err;
  6268. if (readable && !readableEnded) {
  6269. if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
  6270. return callback.call(stream, err);
  6271. }
  6272. if (writable && !writableEnded) {
  6273. if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
  6274. return callback.call(stream, err);
  6275. }
  6276. };
  6277. var onrequest = function onrequest2() {
  6278. stream.req.on("finish", onfinish);
  6279. };
  6280. if (isRequest(stream)) {
  6281. stream.on("complete", onfinish);
  6282. stream.on("abort", onclose);
  6283. if (stream.req) onrequest();
  6284. else stream.on("request", onrequest);
  6285. } else if (writable && !stream._writableState) {
  6286. stream.on("end", onlegacyfinish);
  6287. stream.on("close", onlegacyfinish);
  6288. }
  6289. stream.on("end", onend);
  6290. stream.on("finish", onfinish);
  6291. if (opts.error !== false) stream.on("error", onerror);
  6292. stream.on("close", onclose);
  6293. return function() {
  6294. stream.removeListener("complete", onfinish);
  6295. stream.removeListener("abort", onclose);
  6296. stream.removeListener("request", onrequest);
  6297. if (stream.req) stream.req.removeListener("finish", onfinish);
  6298. stream.removeListener("end", onlegacyfinish);
  6299. stream.removeListener("close", onlegacyfinish);
  6300. stream.removeListener("finish", onfinish);
  6301. stream.removeListener("end", onend);
  6302. stream.removeListener("error", onerror);
  6303. stream.removeListener("close", onclose);
  6304. };
  6305. }
  6306. module2.exports = eos;
  6307. }
  6308. });
  6309. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/async_iterator.js
  6310. var require_async_iterator = __commonJS({
  6311. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports2, module2) {
  6312. "use strict";
  6313. var _Object$setPrototypeO;
  6314. function _defineProperty(obj, key, value) {
  6315. key = _toPropertyKey(key);
  6316. if (key in obj) {
  6317. Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  6318. } else {
  6319. obj[key] = value;
  6320. }
  6321. return obj;
  6322. }
  6323. function _toPropertyKey(arg) {
  6324. var key = _toPrimitive(arg, "string");
  6325. return typeof key === "symbol" ? key : String(key);
  6326. }
  6327. function _toPrimitive(input, hint) {
  6328. if (typeof input !== "object" || input === null) return input;
  6329. var prim = input[Symbol.toPrimitive];
  6330. if (prim !== void 0) {
  6331. var res = prim.call(input, hint || "default");
  6332. if (typeof res !== "object") return res;
  6333. throw new TypeError("@@toPrimitive must return a primitive value.");
  6334. }
  6335. return (hint === "string" ? String : Number)(input);
  6336. }
  6337. var finished = require_end_of_stream();
  6338. var kLastResolve = Symbol("lastResolve");
  6339. var kLastReject = Symbol("lastReject");
  6340. var kError = Symbol("error");
  6341. var kEnded = Symbol("ended");
  6342. var kLastPromise = Symbol("lastPromise");
  6343. var kHandlePromise = Symbol("handlePromise");
  6344. var kStream = Symbol("stream");
  6345. function createIterResult(value, done) {
  6346. return {
  6347. value,
  6348. done
  6349. };
  6350. }
  6351. function readAndResolve(iter) {
  6352. var resolve = iter[kLastResolve];
  6353. if (resolve !== null) {
  6354. var data = iter[kStream].read();
  6355. if (data !== null) {
  6356. iter[kLastPromise] = null;
  6357. iter[kLastResolve] = null;
  6358. iter[kLastReject] = null;
  6359. resolve(createIterResult(data, false));
  6360. }
  6361. }
  6362. }
  6363. function onReadable(iter) {
  6364. process.nextTick(readAndResolve, iter);
  6365. }
  6366. function wrapForNext(lastPromise, iter) {
  6367. return function(resolve, reject) {
  6368. lastPromise.then(function() {
  6369. if (iter[kEnded]) {
  6370. resolve(createIterResult(void 0, true));
  6371. return;
  6372. }
  6373. iter[kHandlePromise](resolve, reject);
  6374. }, reject);
  6375. };
  6376. }
  6377. var AsyncIteratorPrototype = Object.getPrototypeOf(function() {
  6378. });
  6379. var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
  6380. get stream() {
  6381. return this[kStream];
  6382. },
  6383. next: function next() {
  6384. var _this = this;
  6385. var error = this[kError];
  6386. if (error !== null) {
  6387. return Promise.reject(error);
  6388. }
  6389. if (this[kEnded]) {
  6390. return Promise.resolve(createIterResult(void 0, true));
  6391. }
  6392. if (this[kStream].destroyed) {
  6393. return new Promise(function(resolve, reject) {
  6394. process.nextTick(function() {
  6395. if (_this[kError]) {
  6396. reject(_this[kError]);
  6397. } else {
  6398. resolve(createIterResult(void 0, true));
  6399. }
  6400. });
  6401. });
  6402. }
  6403. var lastPromise = this[kLastPromise];
  6404. var promise;
  6405. if (lastPromise) {
  6406. promise = new Promise(wrapForNext(lastPromise, this));
  6407. } else {
  6408. var data = this[kStream].read();
  6409. if (data !== null) {
  6410. return Promise.resolve(createIterResult(data, false));
  6411. }
  6412. promise = new Promise(this[kHandlePromise]);
  6413. }
  6414. this[kLastPromise] = promise;
  6415. return promise;
  6416. }
  6417. }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {
  6418. return this;
  6419. }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
  6420. var _this2 = this;
  6421. return new Promise(function(resolve, reject) {
  6422. _this2[kStream].destroy(null, function(err) {
  6423. if (err) {
  6424. reject(err);
  6425. return;
  6426. }
  6427. resolve(createIterResult(void 0, true));
  6428. });
  6429. });
  6430. }), _Object$setPrototypeO), AsyncIteratorPrototype);
  6431. var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {
  6432. var _Object$create;
  6433. var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
  6434. value: stream,
  6435. writable: true
  6436. }), _defineProperty(_Object$create, kLastResolve, {
  6437. value: null,
  6438. writable: true
  6439. }), _defineProperty(_Object$create, kLastReject, {
  6440. value: null,
  6441. writable: true
  6442. }), _defineProperty(_Object$create, kError, {
  6443. value: null,
  6444. writable: true
  6445. }), _defineProperty(_Object$create, kEnded, {
  6446. value: stream._readableState.endEmitted,
  6447. writable: true
  6448. }), _defineProperty(_Object$create, kHandlePromise, {
  6449. value: function value(resolve, reject) {
  6450. var data = iterator[kStream].read();
  6451. if (data) {
  6452. iterator[kLastPromise] = null;
  6453. iterator[kLastResolve] = null;
  6454. iterator[kLastReject] = null;
  6455. resolve(createIterResult(data, false));
  6456. } else {
  6457. iterator[kLastResolve] = resolve;
  6458. iterator[kLastReject] = reject;
  6459. }
  6460. },
  6461. writable: true
  6462. }), _Object$create));
  6463. iterator[kLastPromise] = null;
  6464. finished(stream, function(err) {
  6465. if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
  6466. var reject = iterator[kLastReject];
  6467. if (reject !== null) {
  6468. iterator[kLastPromise] = null;
  6469. iterator[kLastResolve] = null;
  6470. iterator[kLastReject] = null;
  6471. reject(err);
  6472. }
  6473. iterator[kError] = err;
  6474. return;
  6475. }
  6476. var resolve = iterator[kLastResolve];
  6477. if (resolve !== null) {
  6478. iterator[kLastPromise] = null;
  6479. iterator[kLastResolve] = null;
  6480. iterator[kLastReject] = null;
  6481. resolve(createIterResult(void 0, true));
  6482. }
  6483. iterator[kEnded] = true;
  6484. });
  6485. stream.on("readable", onReadable.bind(null, iterator));
  6486. return iterator;
  6487. };
  6488. module2.exports = createReadableStreamAsyncIterator;
  6489. }
  6490. });
  6491. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js
  6492. var require_from = __commonJS({
  6493. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
  6494. "use strict";
  6495. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  6496. try {
  6497. var info = gen[key](arg);
  6498. var value = info.value;
  6499. } catch (error) {
  6500. reject(error);
  6501. return;
  6502. }
  6503. if (info.done) {
  6504. resolve(value);
  6505. } else {
  6506. Promise.resolve(value).then(_next, _throw);
  6507. }
  6508. }
  6509. function _asyncToGenerator(fn) {
  6510. return function() {
  6511. var self2 = this, args = arguments;
  6512. return new Promise(function(resolve, reject) {
  6513. var gen = fn.apply(self2, args);
  6514. function _next(value) {
  6515. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  6516. }
  6517. function _throw(err) {
  6518. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  6519. }
  6520. _next(void 0);
  6521. });
  6522. };
  6523. }
  6524. function ownKeys(object, enumerableOnly) {
  6525. var keys = Object.keys(object);
  6526. if (Object.getOwnPropertySymbols) {
  6527. var symbols = Object.getOwnPropertySymbols(object);
  6528. enumerableOnly && (symbols = symbols.filter(function(sym) {
  6529. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  6530. })), keys.push.apply(keys, symbols);
  6531. }
  6532. return keys;
  6533. }
  6534. function _objectSpread(target) {
  6535. for (var i = 1; i < arguments.length; i++) {
  6536. var source = null != arguments[i] ? arguments[i] : {};
  6537. i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
  6538. _defineProperty(target, key, source[key]);
  6539. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
  6540. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  6541. });
  6542. }
  6543. return target;
  6544. }
  6545. function _defineProperty(obj, key, value) {
  6546. key = _toPropertyKey(key);
  6547. if (key in obj) {
  6548. Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  6549. } else {
  6550. obj[key] = value;
  6551. }
  6552. return obj;
  6553. }
  6554. function _toPropertyKey(arg) {
  6555. var key = _toPrimitive(arg, "string");
  6556. return typeof key === "symbol" ? key : String(key);
  6557. }
  6558. function _toPrimitive(input, hint) {
  6559. if (typeof input !== "object" || input === null) return input;
  6560. var prim = input[Symbol.toPrimitive];
  6561. if (prim !== void 0) {
  6562. var res = prim.call(input, hint || "default");
  6563. if (typeof res !== "object") return res;
  6564. throw new TypeError("@@toPrimitive must return a primitive value.");
  6565. }
  6566. return (hint === "string" ? String : Number)(input);
  6567. }
  6568. var ERR_INVALID_ARG_TYPE = require_errors().codes.ERR_INVALID_ARG_TYPE;
  6569. function from(Readable, iterable, opts) {
  6570. var iterator;
  6571. if (iterable && typeof iterable.next === "function") {
  6572. iterator = iterable;
  6573. } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();
  6574. else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();
  6575. else throw new ERR_INVALID_ARG_TYPE("iterable", ["Iterable"], iterable);
  6576. var readable = new Readable(_objectSpread({
  6577. objectMode: true
  6578. }, opts));
  6579. var reading = false;
  6580. readable._read = function() {
  6581. if (!reading) {
  6582. reading = true;
  6583. next();
  6584. }
  6585. };
  6586. function next() {
  6587. return _next2.apply(this, arguments);
  6588. }
  6589. function _next2() {
  6590. _next2 = _asyncToGenerator(function* () {
  6591. try {
  6592. var _yield$iterator$next = yield iterator.next(), value = _yield$iterator$next.value, done = _yield$iterator$next.done;
  6593. if (done) {
  6594. readable.push(null);
  6595. } else if (readable.push(yield value)) {
  6596. next();
  6597. } else {
  6598. reading = false;
  6599. }
  6600. } catch (err) {
  6601. readable.destroy(err);
  6602. }
  6603. });
  6604. return _next2.apply(this, arguments);
  6605. }
  6606. return readable;
  6607. }
  6608. module2.exports = from;
  6609. }
  6610. });
  6611. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_readable.js
  6612. var require_stream_readable = __commonJS({
  6613. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_readable.js"(exports2, module2) {
  6614. "use strict";
  6615. module2.exports = Readable;
  6616. var Duplex;
  6617. Readable.ReadableState = ReadableState;
  6618. var EE = require("events").EventEmitter;
  6619. var EElistenerCount = function EElistenerCount2(emitter, type) {
  6620. return emitter.listeners(type).length;
  6621. };
  6622. var Stream = require_stream();
  6623. var Buffer2 = require("buffer").Buffer;
  6624. var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
  6625. };
  6626. function _uint8ArrayToBuffer(chunk) {
  6627. return Buffer2.from(chunk);
  6628. }
  6629. function _isUint8Array(obj) {
  6630. return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
  6631. }
  6632. var debugUtil = require("util");
  6633. var debug;
  6634. if (debugUtil && debugUtil.debuglog) {
  6635. debug = debugUtil.debuglog("stream");
  6636. } else {
  6637. debug = function debug2() {
  6638. };
  6639. }
  6640. var BufferList = require_buffer_list();
  6641. var destroyImpl = require_destroy();
  6642. var _require = require_state();
  6643. var getHighWaterMark = _require.getHighWaterMark;
  6644. var _require$codes = require_errors().codes;
  6645. var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
  6646. var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;
  6647. var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
  6648. var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
  6649. var StringDecoder;
  6650. var createReadableStreamAsyncIterator;
  6651. var from;
  6652. require_inherits()(Readable, Stream);
  6653. var errorOrDestroy = destroyImpl.errorOrDestroy;
  6654. var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
  6655. function prependListener(emitter, event, fn) {
  6656. if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
  6657. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
  6658. else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);
  6659. else emitter._events[event] = [fn, emitter._events[event]];
  6660. }
  6661. function ReadableState(options, stream, isDuplex) {
  6662. Duplex = Duplex || require_stream_duplex();
  6663. options = options || {};
  6664. if (typeof isDuplex !== "boolean") isDuplex = stream instanceof Duplex;
  6665. this.objectMode = !!options.objectMode;
  6666. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  6667. this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);
  6668. this.buffer = new BufferList();
  6669. this.length = 0;
  6670. this.pipes = null;
  6671. this.pipesCount = 0;
  6672. this.flowing = null;
  6673. this.ended = false;
  6674. this.endEmitted = false;
  6675. this.reading = false;
  6676. this.sync = true;
  6677. this.needReadable = false;
  6678. this.emittedReadable = false;
  6679. this.readableListening = false;
  6680. this.resumeScheduled = false;
  6681. this.paused = true;
  6682. this.emitClose = options.emitClose !== false;
  6683. this.autoDestroy = !!options.autoDestroy;
  6684. this.destroyed = false;
  6685. this.defaultEncoding = options.defaultEncoding || "utf8";
  6686. this.awaitDrain = 0;
  6687. this.readingMore = false;
  6688. this.decoder = null;
  6689. this.encoding = null;
  6690. if (options.encoding) {
  6691. if (!StringDecoder) StringDecoder = require_string_decoder().StringDecoder;
  6692. this.decoder = new StringDecoder(options.encoding);
  6693. this.encoding = options.encoding;
  6694. }
  6695. }
  6696. function Readable(options) {
  6697. Duplex = Duplex || require_stream_duplex();
  6698. if (!(this instanceof Readable)) return new Readable(options);
  6699. var isDuplex = this instanceof Duplex;
  6700. this._readableState = new ReadableState(options, this, isDuplex);
  6701. this.readable = true;
  6702. if (options) {
  6703. if (typeof options.read === "function") this._read = options.read;
  6704. if (typeof options.destroy === "function") this._destroy = options.destroy;
  6705. }
  6706. Stream.call(this);
  6707. }
  6708. Object.defineProperty(Readable.prototype, "destroyed", {
  6709. // making it explicit this property is not enumerable
  6710. // because otherwise some prototype manipulation in
  6711. // userland will fail
  6712. enumerable: false,
  6713. get: function get() {
  6714. if (this._readableState === void 0) {
  6715. return false;
  6716. }
  6717. return this._readableState.destroyed;
  6718. },
  6719. set: function set(value) {
  6720. if (!this._readableState) {
  6721. return;
  6722. }
  6723. this._readableState.destroyed = value;
  6724. }
  6725. });
  6726. Readable.prototype.destroy = destroyImpl.destroy;
  6727. Readable.prototype._undestroy = destroyImpl.undestroy;
  6728. Readable.prototype._destroy = function(err, cb) {
  6729. cb(err);
  6730. };
  6731. Readable.prototype.push = function(chunk, encoding) {
  6732. var state = this._readableState;
  6733. var skipChunkCheck;
  6734. if (!state.objectMode) {
  6735. if (typeof chunk === "string") {
  6736. encoding = encoding || state.defaultEncoding;
  6737. if (encoding !== state.encoding) {
  6738. chunk = Buffer2.from(chunk, encoding);
  6739. encoding = "";
  6740. }
  6741. skipChunkCheck = true;
  6742. }
  6743. } else {
  6744. skipChunkCheck = true;
  6745. }
  6746. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  6747. };
  6748. Readable.prototype.unshift = function(chunk) {
  6749. return readableAddChunk(this, chunk, null, true, false);
  6750. };
  6751. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  6752. debug("readableAddChunk", chunk);
  6753. var state = stream._readableState;
  6754. if (chunk === null) {
  6755. state.reading = false;
  6756. onEofChunk(stream, state);
  6757. } else {
  6758. var er;
  6759. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  6760. if (er) {
  6761. errorOrDestroy(stream, er);
  6762. } else if (state.objectMode || chunk && chunk.length > 0) {
  6763. if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
  6764. chunk = _uint8ArrayToBuffer(chunk);
  6765. }
  6766. if (addToFront) {
  6767. if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
  6768. else addChunk(stream, state, chunk, true);
  6769. } else if (state.ended) {
  6770. errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
  6771. } else if (state.destroyed) {
  6772. return false;
  6773. } else {
  6774. state.reading = false;
  6775. if (state.decoder && !encoding) {
  6776. chunk = state.decoder.write(chunk);
  6777. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);
  6778. else maybeReadMore(stream, state);
  6779. } else {
  6780. addChunk(stream, state, chunk, false);
  6781. }
  6782. }
  6783. } else if (!addToFront) {
  6784. state.reading = false;
  6785. maybeReadMore(stream, state);
  6786. }
  6787. }
  6788. return !state.ended && (state.length < state.highWaterMark || state.length === 0);
  6789. }
  6790. function addChunk(stream, state, chunk, addToFront) {
  6791. if (state.flowing && state.length === 0 && !state.sync) {
  6792. state.awaitDrain = 0;
  6793. stream.emit("data", chunk);
  6794. } else {
  6795. state.length += state.objectMode ? 1 : chunk.length;
  6796. if (addToFront) state.buffer.unshift(chunk);
  6797. else state.buffer.push(chunk);
  6798. if (state.needReadable) emitReadable(stream);
  6799. }
  6800. maybeReadMore(stream, state);
  6801. }
  6802. function chunkInvalid(state, chunk) {
  6803. var er;
  6804. if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
  6805. er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
  6806. }
  6807. return er;
  6808. }
  6809. Readable.prototype.isPaused = function() {
  6810. return this._readableState.flowing === false;
  6811. };
  6812. Readable.prototype.setEncoding = function(enc) {
  6813. if (!StringDecoder) StringDecoder = require_string_decoder().StringDecoder;
  6814. var decoder = new StringDecoder(enc);
  6815. this._readableState.decoder = decoder;
  6816. this._readableState.encoding = this._readableState.decoder.encoding;
  6817. var p = this._readableState.buffer.head;
  6818. var content = "";
  6819. while (p !== null) {
  6820. content += decoder.write(p.data);
  6821. p = p.next;
  6822. }
  6823. this._readableState.buffer.clear();
  6824. if (content !== "") this._readableState.buffer.push(content);
  6825. this._readableState.length = content.length;
  6826. return this;
  6827. };
  6828. var MAX_HWM = 1073741824;
  6829. function computeNewHighWaterMark(n) {
  6830. if (n >= MAX_HWM) {
  6831. n = MAX_HWM;
  6832. } else {
  6833. n--;
  6834. n |= n >>> 1;
  6835. n |= n >>> 2;
  6836. n |= n >>> 4;
  6837. n |= n >>> 8;
  6838. n |= n >>> 16;
  6839. n++;
  6840. }
  6841. return n;
  6842. }
  6843. function howMuchToRead(n, state) {
  6844. if (n <= 0 || state.length === 0 && state.ended) return 0;
  6845. if (state.objectMode) return 1;
  6846. if (n !== n) {
  6847. if (state.flowing && state.length) return state.buffer.head.data.length;
  6848. else return state.length;
  6849. }
  6850. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  6851. if (n <= state.length) return n;
  6852. if (!state.ended) {
  6853. state.needReadable = true;
  6854. return 0;
  6855. }
  6856. return state.length;
  6857. }
  6858. Readable.prototype.read = function(n) {
  6859. debug("read", n);
  6860. n = parseInt(n, 10);
  6861. var state = this._readableState;
  6862. var nOrig = n;
  6863. if (n !== 0) state.emittedReadable = false;
  6864. if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
  6865. debug("read: emitReadable", state.length, state.ended);
  6866. if (state.length === 0 && state.ended) endReadable(this);
  6867. else emitReadable(this);
  6868. return null;
  6869. }
  6870. n = howMuchToRead(n, state);
  6871. if (n === 0 && state.ended) {
  6872. if (state.length === 0) endReadable(this);
  6873. return null;
  6874. }
  6875. var doRead = state.needReadable;
  6876. debug("need readable", doRead);
  6877. if (state.length === 0 || state.length - n < state.highWaterMark) {
  6878. doRead = true;
  6879. debug("length less than watermark", doRead);
  6880. }
  6881. if (state.ended || state.reading) {
  6882. doRead = false;
  6883. debug("reading or ended", doRead);
  6884. } else if (doRead) {
  6885. debug("do read");
  6886. state.reading = true;
  6887. state.sync = true;
  6888. if (state.length === 0) state.needReadable = true;
  6889. this._read(state.highWaterMark);
  6890. state.sync = false;
  6891. if (!state.reading) n = howMuchToRead(nOrig, state);
  6892. }
  6893. var ret;
  6894. if (n > 0) ret = fromList(n, state);
  6895. else ret = null;
  6896. if (ret === null) {
  6897. state.needReadable = state.length <= state.highWaterMark;
  6898. n = 0;
  6899. } else {
  6900. state.length -= n;
  6901. state.awaitDrain = 0;
  6902. }
  6903. if (state.length === 0) {
  6904. if (!state.ended) state.needReadable = true;
  6905. if (nOrig !== n && state.ended) endReadable(this);
  6906. }
  6907. if (ret !== null) this.emit("data", ret);
  6908. return ret;
  6909. };
  6910. function onEofChunk(stream, state) {
  6911. debug("onEofChunk");
  6912. if (state.ended) return;
  6913. if (state.decoder) {
  6914. var chunk = state.decoder.end();
  6915. if (chunk && chunk.length) {
  6916. state.buffer.push(chunk);
  6917. state.length += state.objectMode ? 1 : chunk.length;
  6918. }
  6919. }
  6920. state.ended = true;
  6921. if (state.sync) {
  6922. emitReadable(stream);
  6923. } else {
  6924. state.needReadable = false;
  6925. if (!state.emittedReadable) {
  6926. state.emittedReadable = true;
  6927. emitReadable_(stream);
  6928. }
  6929. }
  6930. }
  6931. function emitReadable(stream) {
  6932. var state = stream._readableState;
  6933. debug("emitReadable", state.needReadable, state.emittedReadable);
  6934. state.needReadable = false;
  6935. if (!state.emittedReadable) {
  6936. debug("emitReadable", state.flowing);
  6937. state.emittedReadable = true;
  6938. process.nextTick(emitReadable_, stream);
  6939. }
  6940. }
  6941. function emitReadable_(stream) {
  6942. var state = stream._readableState;
  6943. debug("emitReadable_", state.destroyed, state.length, state.ended);
  6944. if (!state.destroyed && (state.length || state.ended)) {
  6945. stream.emit("readable");
  6946. state.emittedReadable = false;
  6947. }
  6948. state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
  6949. flow(stream);
  6950. }
  6951. function maybeReadMore(stream, state) {
  6952. if (!state.readingMore) {
  6953. state.readingMore = true;
  6954. process.nextTick(maybeReadMore_, stream, state);
  6955. }
  6956. }
  6957. function maybeReadMore_(stream, state) {
  6958. while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
  6959. var len = state.length;
  6960. debug("maybeReadMore read 0");
  6961. stream.read(0);
  6962. if (len === state.length)
  6963. break;
  6964. }
  6965. state.readingMore = false;
  6966. }
  6967. Readable.prototype._read = function(n) {
  6968. errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
  6969. };
  6970. Readable.prototype.pipe = function(dest, pipeOpts) {
  6971. var src = this;
  6972. var state = this._readableState;
  6973. switch (state.pipesCount) {
  6974. case 0:
  6975. state.pipes = dest;
  6976. break;
  6977. case 1:
  6978. state.pipes = [state.pipes, dest];
  6979. break;
  6980. default:
  6981. state.pipes.push(dest);
  6982. break;
  6983. }
  6984. state.pipesCount += 1;
  6985. debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
  6986. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  6987. var endFn = doEnd ? onend : unpipe;
  6988. if (state.endEmitted) process.nextTick(endFn);
  6989. else src.once("end", endFn);
  6990. dest.on("unpipe", onunpipe);
  6991. function onunpipe(readable, unpipeInfo) {
  6992. debug("onunpipe");
  6993. if (readable === src) {
  6994. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  6995. unpipeInfo.hasUnpiped = true;
  6996. cleanup();
  6997. }
  6998. }
  6999. }
  7000. function onend() {
  7001. debug("onend");
  7002. dest.end();
  7003. }
  7004. var ondrain = pipeOnDrain(src);
  7005. dest.on("drain", ondrain);
  7006. var cleanedUp = false;
  7007. function cleanup() {
  7008. debug("cleanup");
  7009. dest.removeListener("close", onclose);
  7010. dest.removeListener("finish", onfinish);
  7011. dest.removeListener("drain", ondrain);
  7012. dest.removeListener("error", onerror);
  7013. dest.removeListener("unpipe", onunpipe);
  7014. src.removeListener("end", onend);
  7015. src.removeListener("end", unpipe);
  7016. src.removeListener("data", ondata);
  7017. cleanedUp = true;
  7018. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  7019. }
  7020. src.on("data", ondata);
  7021. function ondata(chunk) {
  7022. debug("ondata");
  7023. var ret = dest.write(chunk);
  7024. debug("dest.write", ret);
  7025. if (ret === false) {
  7026. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  7027. debug("false write response, pause", state.awaitDrain);
  7028. state.awaitDrain++;
  7029. }
  7030. src.pause();
  7031. }
  7032. }
  7033. function onerror(er) {
  7034. debug("onerror", er);
  7035. unpipe();
  7036. dest.removeListener("error", onerror);
  7037. if (EElistenerCount(dest, "error") === 0) errorOrDestroy(dest, er);
  7038. }
  7039. prependListener(dest, "error", onerror);
  7040. function onclose() {
  7041. dest.removeListener("finish", onfinish);
  7042. unpipe();
  7043. }
  7044. dest.once("close", onclose);
  7045. function onfinish() {
  7046. debug("onfinish");
  7047. dest.removeListener("close", onclose);
  7048. unpipe();
  7049. }
  7050. dest.once("finish", onfinish);
  7051. function unpipe() {
  7052. debug("unpipe");
  7053. src.unpipe(dest);
  7054. }
  7055. dest.emit("pipe", src);
  7056. if (!state.flowing) {
  7057. debug("pipe resume");
  7058. src.resume();
  7059. }
  7060. return dest;
  7061. };
  7062. function pipeOnDrain(src) {
  7063. return function pipeOnDrainFunctionResult() {
  7064. var state = src._readableState;
  7065. debug("pipeOnDrain", state.awaitDrain);
  7066. if (state.awaitDrain) state.awaitDrain--;
  7067. if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
  7068. state.flowing = true;
  7069. flow(src);
  7070. }
  7071. };
  7072. }
  7073. Readable.prototype.unpipe = function(dest) {
  7074. var state = this._readableState;
  7075. var unpipeInfo = {
  7076. hasUnpiped: false
  7077. };
  7078. if (state.pipesCount === 0) return this;
  7079. if (state.pipesCount === 1) {
  7080. if (dest && dest !== state.pipes) return this;
  7081. if (!dest) dest = state.pipes;
  7082. state.pipes = null;
  7083. state.pipesCount = 0;
  7084. state.flowing = false;
  7085. if (dest) dest.emit("unpipe", this, unpipeInfo);
  7086. return this;
  7087. }
  7088. if (!dest) {
  7089. var dests = state.pipes;
  7090. var len = state.pipesCount;
  7091. state.pipes = null;
  7092. state.pipesCount = 0;
  7093. state.flowing = false;
  7094. for (var i = 0; i < len; i++) dests[i].emit("unpipe", this, {
  7095. hasUnpiped: false
  7096. });
  7097. return this;
  7098. }
  7099. var index = indexOf(state.pipes, dest);
  7100. if (index === -1) return this;
  7101. state.pipes.splice(index, 1);
  7102. state.pipesCount -= 1;
  7103. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  7104. dest.emit("unpipe", this, unpipeInfo);
  7105. return this;
  7106. };
  7107. Readable.prototype.on = function(ev, fn) {
  7108. var res = Stream.prototype.on.call(this, ev, fn);
  7109. var state = this._readableState;
  7110. if (ev === "data") {
  7111. state.readableListening = this.listenerCount("readable") > 0;
  7112. if (state.flowing !== false) this.resume();
  7113. } else if (ev === "readable") {
  7114. if (!state.endEmitted && !state.readableListening) {
  7115. state.readableListening = state.needReadable = true;
  7116. state.flowing = false;
  7117. state.emittedReadable = false;
  7118. debug("on readable", state.length, state.reading);
  7119. if (state.length) {
  7120. emitReadable(this);
  7121. } else if (!state.reading) {
  7122. process.nextTick(nReadingNextTick, this);
  7123. }
  7124. }
  7125. }
  7126. return res;
  7127. };
  7128. Readable.prototype.addListener = Readable.prototype.on;
  7129. Readable.prototype.removeListener = function(ev, fn) {
  7130. var res = Stream.prototype.removeListener.call(this, ev, fn);
  7131. if (ev === "readable") {
  7132. process.nextTick(updateReadableListening, this);
  7133. }
  7134. return res;
  7135. };
  7136. Readable.prototype.removeAllListeners = function(ev) {
  7137. var res = Stream.prototype.removeAllListeners.apply(this, arguments);
  7138. if (ev === "readable" || ev === void 0) {
  7139. process.nextTick(updateReadableListening, this);
  7140. }
  7141. return res;
  7142. };
  7143. function updateReadableListening(self2) {
  7144. var state = self2._readableState;
  7145. state.readableListening = self2.listenerCount("readable") > 0;
  7146. if (state.resumeScheduled && !state.paused) {
  7147. state.flowing = true;
  7148. } else if (self2.listenerCount("data") > 0) {
  7149. self2.resume();
  7150. }
  7151. }
  7152. function nReadingNextTick(self2) {
  7153. debug("readable nexttick read 0");
  7154. self2.read(0);
  7155. }
  7156. Readable.prototype.resume = function() {
  7157. var state = this._readableState;
  7158. if (!state.flowing) {
  7159. debug("resume");
  7160. state.flowing = !state.readableListening;
  7161. resume(this, state);
  7162. }
  7163. state.paused = false;
  7164. return this;
  7165. };
  7166. function resume(stream, state) {
  7167. if (!state.resumeScheduled) {
  7168. state.resumeScheduled = true;
  7169. process.nextTick(resume_, stream, state);
  7170. }
  7171. }
  7172. function resume_(stream, state) {
  7173. debug("resume", state.reading);
  7174. if (!state.reading) {
  7175. stream.read(0);
  7176. }
  7177. state.resumeScheduled = false;
  7178. stream.emit("resume");
  7179. flow(stream);
  7180. if (state.flowing && !state.reading) stream.read(0);
  7181. }
  7182. Readable.prototype.pause = function() {
  7183. debug("call pause flowing=%j", this._readableState.flowing);
  7184. if (this._readableState.flowing !== false) {
  7185. debug("pause");
  7186. this._readableState.flowing = false;
  7187. this.emit("pause");
  7188. }
  7189. this._readableState.paused = true;
  7190. return this;
  7191. };
  7192. function flow(stream) {
  7193. var state = stream._readableState;
  7194. debug("flow", state.flowing);
  7195. while (state.flowing && stream.read() !== null) ;
  7196. }
  7197. Readable.prototype.wrap = function(stream) {
  7198. var _this = this;
  7199. var state = this._readableState;
  7200. var paused = false;
  7201. stream.on("end", function() {
  7202. debug("wrapped end");
  7203. if (state.decoder && !state.ended) {
  7204. var chunk = state.decoder.end();
  7205. if (chunk && chunk.length) _this.push(chunk);
  7206. }
  7207. _this.push(null);
  7208. });
  7209. stream.on("data", function(chunk) {
  7210. debug("wrapped data");
  7211. if (state.decoder) chunk = state.decoder.write(chunk);
  7212. if (state.objectMode && (chunk === null || chunk === void 0)) return;
  7213. else if (!state.objectMode && (!chunk || !chunk.length)) return;
  7214. var ret = _this.push(chunk);
  7215. if (!ret) {
  7216. paused = true;
  7217. stream.pause();
  7218. }
  7219. });
  7220. for (var i in stream) {
  7221. if (this[i] === void 0 && typeof stream[i] === "function") {
  7222. this[i] = /* @__PURE__ */ function methodWrap(method) {
  7223. return function methodWrapReturnFunction() {
  7224. return stream[method].apply(stream, arguments);
  7225. };
  7226. }(i);
  7227. }
  7228. }
  7229. for (var n = 0; n < kProxyEvents.length; n++) {
  7230. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  7231. }
  7232. this._read = function(n2) {
  7233. debug("wrapped _read", n2);
  7234. if (paused) {
  7235. paused = false;
  7236. stream.resume();
  7237. }
  7238. };
  7239. return this;
  7240. };
  7241. if (typeof Symbol === "function") {
  7242. Readable.prototype[Symbol.asyncIterator] = function() {
  7243. if (createReadableStreamAsyncIterator === void 0) {
  7244. createReadableStreamAsyncIterator = require_async_iterator();
  7245. }
  7246. return createReadableStreamAsyncIterator(this);
  7247. };
  7248. }
  7249. Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
  7250. // making it explicit this property is not enumerable
  7251. // because otherwise some prototype manipulation in
  7252. // userland will fail
  7253. enumerable: false,
  7254. get: function get() {
  7255. return this._readableState.highWaterMark;
  7256. }
  7257. });
  7258. Object.defineProperty(Readable.prototype, "readableBuffer", {
  7259. // making it explicit this property is not enumerable
  7260. // because otherwise some prototype manipulation in
  7261. // userland will fail
  7262. enumerable: false,
  7263. get: function get() {
  7264. return this._readableState && this._readableState.buffer;
  7265. }
  7266. });
  7267. Object.defineProperty(Readable.prototype, "readableFlowing", {
  7268. // making it explicit this property is not enumerable
  7269. // because otherwise some prototype manipulation in
  7270. // userland will fail
  7271. enumerable: false,
  7272. get: function get() {
  7273. return this._readableState.flowing;
  7274. },
  7275. set: function set(state) {
  7276. if (this._readableState) {
  7277. this._readableState.flowing = state;
  7278. }
  7279. }
  7280. });
  7281. Readable._fromList = fromList;
  7282. Object.defineProperty(Readable.prototype, "readableLength", {
  7283. // making it explicit this property is not enumerable
  7284. // because otherwise some prototype manipulation in
  7285. // userland will fail
  7286. enumerable: false,
  7287. get: function get() {
  7288. return this._readableState.length;
  7289. }
  7290. });
  7291. function fromList(n, state) {
  7292. if (state.length === 0) return null;
  7293. var ret;
  7294. if (state.objectMode) ret = state.buffer.shift();
  7295. else if (!n || n >= state.length) {
  7296. if (state.decoder) ret = state.buffer.join("");
  7297. else if (state.buffer.length === 1) ret = state.buffer.first();
  7298. else ret = state.buffer.concat(state.length);
  7299. state.buffer.clear();
  7300. } else {
  7301. ret = state.buffer.consume(n, state.decoder);
  7302. }
  7303. return ret;
  7304. }
  7305. function endReadable(stream) {
  7306. var state = stream._readableState;
  7307. debug("endReadable", state.endEmitted);
  7308. if (!state.endEmitted) {
  7309. state.ended = true;
  7310. process.nextTick(endReadableNT, state, stream);
  7311. }
  7312. }
  7313. function endReadableNT(state, stream) {
  7314. debug("endReadableNT", state.endEmitted, state.length);
  7315. if (!state.endEmitted && state.length === 0) {
  7316. state.endEmitted = true;
  7317. stream.readable = false;
  7318. stream.emit("end");
  7319. if (state.autoDestroy) {
  7320. var wState = stream._writableState;
  7321. if (!wState || wState.autoDestroy && wState.finished) {
  7322. stream.destroy();
  7323. }
  7324. }
  7325. }
  7326. }
  7327. if (typeof Symbol === "function") {
  7328. Readable.from = function(iterable, opts) {
  7329. if (from === void 0) {
  7330. from = require_from();
  7331. }
  7332. return from(Readable, iterable, opts);
  7333. };
  7334. }
  7335. function indexOf(xs, x) {
  7336. for (var i = 0, l = xs.length; i < l; i++) {
  7337. if (xs[i] === x) return i;
  7338. }
  7339. return -1;
  7340. }
  7341. }
  7342. });
  7343. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_transform.js
  7344. var require_stream_transform = __commonJS({
  7345. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_transform.js"(exports2, module2) {
  7346. "use strict";
  7347. module2.exports = Transform;
  7348. var _require$codes = require_errors().codes;
  7349. var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
  7350. var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
  7351. var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;
  7352. var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
  7353. var Duplex = require_stream_duplex();
  7354. require_inherits()(Transform, Duplex);
  7355. function afterTransform(er, data) {
  7356. var ts = this._transformState;
  7357. ts.transforming = false;
  7358. var cb = ts.writecb;
  7359. if (cb === null) {
  7360. return this.emit("error", new ERR_MULTIPLE_CALLBACK());
  7361. }
  7362. ts.writechunk = null;
  7363. ts.writecb = null;
  7364. if (data != null)
  7365. this.push(data);
  7366. cb(er);
  7367. var rs = this._readableState;
  7368. rs.reading = false;
  7369. if (rs.needReadable || rs.length < rs.highWaterMark) {
  7370. this._read(rs.highWaterMark);
  7371. }
  7372. }
  7373. function Transform(options) {
  7374. if (!(this instanceof Transform)) return new Transform(options);
  7375. Duplex.call(this, options);
  7376. this._transformState = {
  7377. afterTransform: afterTransform.bind(this),
  7378. needTransform: false,
  7379. transforming: false,
  7380. writecb: null,
  7381. writechunk: null,
  7382. writeencoding: null
  7383. };
  7384. this._readableState.needReadable = true;
  7385. this._readableState.sync = false;
  7386. if (options) {
  7387. if (typeof options.transform === "function") this._transform = options.transform;
  7388. if (typeof options.flush === "function") this._flush = options.flush;
  7389. }
  7390. this.on("prefinish", prefinish);
  7391. }
  7392. function prefinish() {
  7393. var _this = this;
  7394. if (typeof this._flush === "function" && !this._readableState.destroyed) {
  7395. this._flush(function(er, data) {
  7396. done(_this, er, data);
  7397. });
  7398. } else {
  7399. done(this, null, null);
  7400. }
  7401. }
  7402. Transform.prototype.push = function(chunk, encoding) {
  7403. this._transformState.needTransform = false;
  7404. return Duplex.prototype.push.call(this, chunk, encoding);
  7405. };
  7406. Transform.prototype._transform = function(chunk, encoding, cb) {
  7407. cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
  7408. };
  7409. Transform.prototype._write = function(chunk, encoding, cb) {
  7410. var ts = this._transformState;
  7411. ts.writecb = cb;
  7412. ts.writechunk = chunk;
  7413. ts.writeencoding = encoding;
  7414. if (!ts.transforming) {
  7415. var rs = this._readableState;
  7416. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  7417. }
  7418. };
  7419. Transform.prototype._read = function(n) {
  7420. var ts = this._transformState;
  7421. if (ts.writechunk !== null && !ts.transforming) {
  7422. ts.transforming = true;
  7423. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  7424. } else {
  7425. ts.needTransform = true;
  7426. }
  7427. };
  7428. Transform.prototype._destroy = function(err, cb) {
  7429. Duplex.prototype._destroy.call(this, err, function(err2) {
  7430. cb(err2);
  7431. });
  7432. };
  7433. function done(stream, er, data) {
  7434. if (er) return stream.emit("error", er);
  7435. if (data != null)
  7436. stream.push(data);
  7437. if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
  7438. if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
  7439. return stream.push(null);
  7440. }
  7441. }
  7442. });
  7443. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js
  7444. var require_stream_passthrough = __commonJS({
  7445. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js"(exports2, module2) {
  7446. "use strict";
  7447. module2.exports = PassThrough;
  7448. var Transform = require_stream_transform();
  7449. require_inherits()(PassThrough, Transform);
  7450. function PassThrough(options) {
  7451. if (!(this instanceof PassThrough)) return new PassThrough(options);
  7452. Transform.call(this, options);
  7453. }
  7454. PassThrough.prototype._transform = function(chunk, encoding, cb) {
  7455. cb(null, chunk);
  7456. };
  7457. }
  7458. });
  7459. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js
  7460. var require_pipeline = __commonJS({
  7461. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports2, module2) {
  7462. "use strict";
  7463. var eos;
  7464. function once(callback) {
  7465. var called = false;
  7466. return function() {
  7467. if (called) return;
  7468. called = true;
  7469. callback.apply(void 0, arguments);
  7470. };
  7471. }
  7472. var _require$codes = require_errors().codes;
  7473. var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
  7474. var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
  7475. function noop(err) {
  7476. if (err) throw err;
  7477. }
  7478. function isRequest(stream) {
  7479. return stream.setHeader && typeof stream.abort === "function";
  7480. }
  7481. function destroyer(stream, reading, writing, callback) {
  7482. callback = once(callback);
  7483. var closed = false;
  7484. stream.on("close", function() {
  7485. closed = true;
  7486. });
  7487. if (eos === void 0) eos = require_end_of_stream();
  7488. eos(stream, {
  7489. readable: reading,
  7490. writable: writing
  7491. }, function(err) {
  7492. if (err) return callback(err);
  7493. closed = true;
  7494. callback();
  7495. });
  7496. var destroyed = false;
  7497. return function(err) {
  7498. if (closed) return;
  7499. if (destroyed) return;
  7500. destroyed = true;
  7501. if (isRequest(stream)) return stream.abort();
  7502. if (typeof stream.destroy === "function") return stream.destroy();
  7503. callback(err || new ERR_STREAM_DESTROYED("pipe"));
  7504. };
  7505. }
  7506. function call(fn) {
  7507. fn();
  7508. }
  7509. function pipe(from, to) {
  7510. return from.pipe(to);
  7511. }
  7512. function popCallback(streams) {
  7513. if (!streams.length) return noop;
  7514. if (typeof streams[streams.length - 1] !== "function") return noop;
  7515. return streams.pop();
  7516. }
  7517. function pipeline() {
  7518. for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
  7519. streams[_key] = arguments[_key];
  7520. }
  7521. var callback = popCallback(streams);
  7522. if (Array.isArray(streams[0])) streams = streams[0];
  7523. if (streams.length < 2) {
  7524. throw new ERR_MISSING_ARGS("streams");
  7525. }
  7526. var error;
  7527. var destroys = streams.map(function(stream, i) {
  7528. var reading = i < streams.length - 1;
  7529. var writing = i > 0;
  7530. return destroyer(stream, reading, writing, function(err) {
  7531. if (!error) error = err;
  7532. if (err) destroys.forEach(call);
  7533. if (reading) return;
  7534. destroys.forEach(call);
  7535. callback(error);
  7536. });
  7537. });
  7538. return streams.reduce(pipe);
  7539. }
  7540. module2.exports = pipeline;
  7541. }
  7542. });
  7543. // ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/readable.js
  7544. var require_readable = __commonJS({
  7545. "../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/readable.js"(exports2, module2) {
  7546. var Stream = require("stream");
  7547. if (process.env.READABLE_STREAM === "disable" && Stream) {
  7548. module2.exports = Stream.Readable;
  7549. Object.assign(module2.exports, Stream);
  7550. module2.exports.Stream = Stream;
  7551. } else {
  7552. exports2 = module2.exports = require_stream_readable();
  7553. exports2.Stream = Stream || exports2;
  7554. exports2.Readable = exports2;
  7555. exports2.Writable = require_stream_writable();
  7556. exports2.Duplex = require_stream_duplex();
  7557. exports2.Transform = require_stream_transform();
  7558. exports2.PassThrough = require_stream_passthrough();
  7559. exports2.finished = require_end_of_stream();
  7560. exports2.pipeline = require_pipeline();
  7561. }
  7562. }
  7563. });
  7564. // ../node_modules/.pnpm/through2@4.0.2/node_modules/through2/through2.js
  7565. var require_through2 = __commonJS({
  7566. "../node_modules/.pnpm/through2@4.0.2/node_modules/through2/through2.js"(exports2, module2) {
  7567. var { Transform } = require_readable();
  7568. function inherits(fn, sup) {
  7569. fn.super_ = sup;
  7570. fn.prototype = Object.create(sup.prototype, {
  7571. constructor: { value: fn, enumerable: false, writable: true, configurable: true }
  7572. });
  7573. }
  7574. function through2(construct) {
  7575. return (options, transform, flush) => {
  7576. if (typeof options === "function") {
  7577. flush = transform;
  7578. transform = options;
  7579. options = {};
  7580. }
  7581. if (typeof transform !== "function") {
  7582. transform = (chunk, enc, cb) => cb(null, chunk);
  7583. }
  7584. if (typeof flush !== "function") {
  7585. flush = null;
  7586. }
  7587. return construct(options, transform, flush);
  7588. };
  7589. }
  7590. var make = through2((options, transform, flush) => {
  7591. const t2 = new Transform(options);
  7592. t2._transform = transform;
  7593. if (flush) {
  7594. t2._flush = flush;
  7595. }
  7596. return t2;
  7597. });
  7598. var ctor = through2((options, transform, flush) => {
  7599. function Through2(override) {
  7600. if (!(this instanceof Through2)) {
  7601. return new Through2(override);
  7602. }
  7603. this.options = Object.assign({}, options, override);
  7604. Transform.call(this, this.options);
  7605. this._transform = transform;
  7606. if (flush) {
  7607. this._flush = flush;
  7608. }
  7609. }
  7610. inherits(Through2, Transform);
  7611. return Through2;
  7612. });
  7613. var obj = through2(function(options, transform, flush) {
  7614. const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options));
  7615. t2._transform = transform;
  7616. if (flush) {
  7617. t2._flush = flush;
  7618. }
  7619. return t2;
  7620. });
  7621. module2.exports = make;
  7622. module2.exports.ctor = ctor;
  7623. module2.exports.obj = obj;
  7624. }
  7625. });
  7626. // ../node_modules/.pnpm/split2@3.2.2/node_modules/split2/index.js
  7627. var require_split2 = __commonJS({
  7628. "../node_modules/.pnpm/split2@3.2.2/node_modules/split2/index.js"(exports2, module2) {
  7629. "use strict";
  7630. var { Transform } = require_readable();
  7631. var { StringDecoder } = require("string_decoder");
  7632. var kLast = Symbol("last");
  7633. var kDecoder = Symbol("decoder");
  7634. function transform(chunk, enc, cb) {
  7635. var list;
  7636. if (this.overflow) {
  7637. var buf = this[kDecoder].write(chunk);
  7638. list = buf.split(this.matcher);
  7639. if (list.length === 1) return cb();
  7640. list.shift();
  7641. this.overflow = false;
  7642. } else {
  7643. this[kLast] += this[kDecoder].write(chunk);
  7644. list = this[kLast].split(this.matcher);
  7645. }
  7646. this[kLast] = list.pop();
  7647. for (var i = 0; i < list.length; i++) {
  7648. try {
  7649. push(this, this.mapper(list[i]));
  7650. } catch (error) {
  7651. return cb(error);
  7652. }
  7653. }
  7654. this.overflow = this[kLast].length > this.maxLength;
  7655. if (this.overflow && !this.skipOverflow) return cb(new Error("maximum buffer reached"));
  7656. cb();
  7657. }
  7658. function flush(cb) {
  7659. this[kLast] += this[kDecoder].end();
  7660. if (this[kLast]) {
  7661. try {
  7662. push(this, this.mapper(this[kLast]));
  7663. } catch (error) {
  7664. return cb(error);
  7665. }
  7666. }
  7667. cb();
  7668. }
  7669. function push(self2, val) {
  7670. if (val !== void 0) {
  7671. self2.push(val);
  7672. }
  7673. }
  7674. function noop(incoming) {
  7675. return incoming;
  7676. }
  7677. function split(matcher, mapper, options) {
  7678. matcher = matcher || /\r?\n/;
  7679. mapper = mapper || noop;
  7680. options = options || {};
  7681. switch (arguments.length) {
  7682. case 1:
  7683. if (typeof matcher === "function") {
  7684. mapper = matcher;
  7685. matcher = /\r?\n/;
  7686. } else if (typeof matcher === "object" && !(matcher instanceof RegExp)) {
  7687. options = matcher;
  7688. matcher = /\r?\n/;
  7689. }
  7690. break;
  7691. case 2:
  7692. if (typeof matcher === "function") {
  7693. options = mapper;
  7694. mapper = matcher;
  7695. matcher = /\r?\n/;
  7696. } else if (typeof mapper === "object") {
  7697. options = mapper;
  7698. mapper = noop;
  7699. }
  7700. }
  7701. options = Object.assign({}, options);
  7702. options.transform = transform;
  7703. options.flush = flush;
  7704. options.readableObjectMode = true;
  7705. const stream = new Transform(options);
  7706. stream[kLast] = "";
  7707. stream[kDecoder] = new StringDecoder("utf8");
  7708. stream.matcher = matcher;
  7709. stream.mapper = mapper;
  7710. stream.maxLength = options.maxLength;
  7711. stream.skipOverflow = options.skipOverflow;
  7712. stream.overflow = false;
  7713. return stream;
  7714. }
  7715. module2.exports = split;
  7716. }
  7717. });
  7718. // ../node_modules/.pnpm/json-stringify-safe@5.0.1/node_modules/json-stringify-safe/stringify.js
  7719. var require_stringify = __commonJS({
  7720. "../node_modules/.pnpm/json-stringify-safe@5.0.1/node_modules/json-stringify-safe/stringify.js"(exports2, module2) {
  7721. exports2 = module2.exports = stringify;
  7722. exports2.getSerialize = serializer;
  7723. function stringify(obj, replacer, spaces, cycleReplacer) {
  7724. return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
  7725. }
  7726. function serializer(replacer, cycleReplacer) {
  7727. var stack = [], keys = [];
  7728. if (cycleReplacer == null) cycleReplacer = function(key, value) {
  7729. if (stack[0] === value) return "[Circular ~]";
  7730. return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
  7731. };
  7732. return function(key, value) {
  7733. if (stack.length > 0) {
  7734. var thisPos = stack.indexOf(this);
  7735. ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
  7736. ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
  7737. if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value);
  7738. } else stack.push(value);
  7739. return replacer == null ? value : replacer.call(this, key, value);
  7740. };
  7741. }
  7742. }
  7743. });
  7744. // ../node_modules/.pnpm/ndjson@2.0.0/node_modules/ndjson/index.js
  7745. var require_ndjson = __commonJS({
  7746. "../node_modules/.pnpm/ndjson@2.0.0/node_modules/ndjson/index.js"(exports2, module2) {
  7747. var through = require_through2();
  7748. var split = require_split2();
  7749. var { EOL } = require("os");
  7750. var stringify = require_stringify();
  7751. module2.exports.stringify = (opts) => through.obj(opts, (obj, _, cb) => {
  7752. cb(null, stringify(obj) + EOL);
  7753. });
  7754. module2.exports.parse = (opts) => {
  7755. opts = opts || {};
  7756. opts.strict = opts.strict !== false;
  7757. function parseRow(row) {
  7758. try {
  7759. if (row) return JSON.parse(row);
  7760. } catch (e) {
  7761. if (opts.strict) {
  7762. this.emit("error", new Error("Could not parse row " + row.slice(0, 50) + "..."));
  7763. }
  7764. }
  7765. }
  7766. return split(parseRow, opts);
  7767. };
  7768. }
  7769. });
  7770. // ../packages/logger/lib/streamParser.js
  7771. var require_streamParser = __commonJS({
  7772. "../packages/logger/lib/streamParser.js"(exports2) {
  7773. "use strict";
  7774. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  7775. return mod && mod.__esModule ? mod : { "default": mod };
  7776. };
  7777. Object.defineProperty(exports2, "__esModule", { value: true });
  7778. exports2.streamParser = void 0;
  7779. exports2.createStreamParser = createStreamParser;
  7780. var bole_1 = __importDefault2(require_bole());
  7781. var ndjson_1 = __importDefault2(require_ndjson());
  7782. exports2.streamParser = createStreamParser();
  7783. function createStreamParser() {
  7784. const sp = ndjson_1.default.parse();
  7785. bole_1.default.output([
  7786. {
  7787. level: "debug",
  7788. stream: sp
  7789. }
  7790. ]);
  7791. return sp;
  7792. }
  7793. }
  7794. });
  7795. // ../packages/logger/lib/writeToConsole.js
  7796. var require_writeToConsole = __commonJS({
  7797. "../packages/logger/lib/writeToConsole.js"(exports2) {
  7798. "use strict";
  7799. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  7800. return mod && mod.__esModule ? mod : { "default": mod };
  7801. };
  7802. Object.defineProperty(exports2, "__esModule", { value: true });
  7803. exports2.writeToConsole = writeToConsole;
  7804. var bole_1 = __importDefault2(require_bole());
  7805. function writeToConsole() {
  7806. bole_1.default.output([
  7807. {
  7808. level: "debug",
  7809. stream: process.stdout
  7810. }
  7811. ]);
  7812. }
  7813. }
  7814. });
  7815. // ../packages/logger/lib/index.js
  7816. var require_lib5 = __commonJS({
  7817. "../packages/logger/lib/index.js"(exports2) {
  7818. "use strict";
  7819. Object.defineProperty(exports2, "__esModule", { value: true });
  7820. exports2.writeToConsole = exports2.streamParser = exports2.createStreamParser = exports2.globalWarn = exports2.globalInfo = exports2.logger = void 0;
  7821. var logger_1 = require_logger();
  7822. Object.defineProperty(exports2, "logger", { enumerable: true, get: function() {
  7823. return logger_1.logger;
  7824. } });
  7825. Object.defineProperty(exports2, "globalInfo", { enumerable: true, get: function() {
  7826. return logger_1.globalInfo;
  7827. } });
  7828. Object.defineProperty(exports2, "globalWarn", { enumerable: true, get: function() {
  7829. return logger_1.globalWarn;
  7830. } });
  7831. var streamParser_1 = require_streamParser();
  7832. Object.defineProperty(exports2, "createStreamParser", { enumerable: true, get: function() {
  7833. return streamParser_1.createStreamParser;
  7834. } });
  7835. Object.defineProperty(exports2, "streamParser", { enumerable: true, get: function() {
  7836. return streamParser_1.streamParser;
  7837. } });
  7838. var writeToConsole_1 = require_writeToConsole();
  7839. Object.defineProperty(exports2, "writeToConsole", { enumerable: true, get: function() {
  7840. return writeToConsole_1.writeToConsole;
  7841. } });
  7842. }
  7843. });
  7844. // ../packages/core-loggers/lib/contextLogger.js
  7845. var require_contextLogger = __commonJS({
  7846. "../packages/core-loggers/lib/contextLogger.js"(exports2) {
  7847. "use strict";
  7848. Object.defineProperty(exports2, "__esModule", { value: true });
  7849. exports2.contextLogger = void 0;
  7850. var logger_1 = require_lib5();
  7851. exports2.contextLogger = (0, logger_1.logger)("context");
  7852. }
  7853. });
  7854. // ../packages/core-loggers/lib/deprecationLogger.js
  7855. var require_deprecationLogger = __commonJS({
  7856. "../packages/core-loggers/lib/deprecationLogger.js"(exports2) {
  7857. "use strict";
  7858. Object.defineProperty(exports2, "__esModule", { value: true });
  7859. exports2.deprecationLogger = void 0;
  7860. var logger_1 = require_lib5();
  7861. exports2.deprecationLogger = (0, logger_1.logger)("deprecation");
  7862. }
  7863. });
  7864. // ../packages/core-loggers/lib/fetchingProgressLogger.js
  7865. var require_fetchingProgressLogger = __commonJS({
  7866. "../packages/core-loggers/lib/fetchingProgressLogger.js"(exports2) {
  7867. "use strict";
  7868. Object.defineProperty(exports2, "__esModule", { value: true });
  7869. exports2.fetchingProgressLogger = void 0;
  7870. var logger_1 = require_lib5();
  7871. exports2.fetchingProgressLogger = (0, logger_1.logger)("fetching-progress");
  7872. }
  7873. });
  7874. // ../packages/core-loggers/lib/hookLogger.js
  7875. var require_hookLogger = __commonJS({
  7876. "../packages/core-loggers/lib/hookLogger.js"(exports2) {
  7877. "use strict";
  7878. Object.defineProperty(exports2, "__esModule", { value: true });
  7879. exports2.hookLogger = void 0;
  7880. var logger_1 = require_lib5();
  7881. exports2.hookLogger = (0, logger_1.logger)("hook");
  7882. }
  7883. });
  7884. // ../packages/core-loggers/lib/installCheckLogger.js
  7885. var require_installCheckLogger = __commonJS({
  7886. "../packages/core-loggers/lib/installCheckLogger.js"(exports2) {
  7887. "use strict";
  7888. Object.defineProperty(exports2, "__esModule", { value: true });
  7889. exports2.installCheckLogger = void 0;
  7890. var logger_1 = require_lib5();
  7891. exports2.installCheckLogger = (0, logger_1.logger)("install-check");
  7892. }
  7893. });
  7894. // ../packages/core-loggers/lib/installingConfigDeps.js
  7895. var require_installingConfigDeps = __commonJS({
  7896. "../packages/core-loggers/lib/installingConfigDeps.js"(exports2) {
  7897. "use strict";
  7898. Object.defineProperty(exports2, "__esModule", { value: true });
  7899. exports2.installingConfigDepsLogger = void 0;
  7900. var logger_1 = require_lib5();
  7901. exports2.installingConfigDepsLogger = (0, logger_1.logger)("installing-config-deps");
  7902. }
  7903. });
  7904. // ../packages/core-loggers/lib/ignoredScriptsLogger.js
  7905. var require_ignoredScriptsLogger = __commonJS({
  7906. "../packages/core-loggers/lib/ignoredScriptsLogger.js"(exports2) {
  7907. "use strict";
  7908. Object.defineProperty(exports2, "__esModule", { value: true });
  7909. exports2.ignoredScriptsLogger = void 0;
  7910. var logger_1 = require_lib5();
  7911. exports2.ignoredScriptsLogger = (0, logger_1.logger)("ignored-scripts");
  7912. }
  7913. });
  7914. // ../packages/core-loggers/lib/lifecycleLogger.js
  7915. var require_lifecycleLogger = __commonJS({
  7916. "../packages/core-loggers/lib/lifecycleLogger.js"(exports2) {
  7917. "use strict";
  7918. Object.defineProperty(exports2, "__esModule", { value: true });
  7919. exports2.lifecycleLogger = void 0;
  7920. var logger_1 = require_lib5();
  7921. exports2.lifecycleLogger = (0, logger_1.logger)("lifecycle");
  7922. }
  7923. });
  7924. // ../packages/core-loggers/lib/linkLogger.js
  7925. var require_linkLogger = __commonJS({
  7926. "../packages/core-loggers/lib/linkLogger.js"(exports2) {
  7927. "use strict";
  7928. Object.defineProperty(exports2, "__esModule", { value: true });
  7929. exports2.linkLogger = void 0;
  7930. var logger_1 = require_lib5();
  7931. exports2.linkLogger = (0, logger_1.logger)("link");
  7932. }
  7933. });
  7934. // ../packages/core-loggers/lib/packageImportMethodLogger.js
  7935. var require_packageImportMethodLogger = __commonJS({
  7936. "../packages/core-loggers/lib/packageImportMethodLogger.js"(exports2) {
  7937. "use strict";
  7938. Object.defineProperty(exports2, "__esModule", { value: true });
  7939. exports2.packageImportMethodLogger = void 0;
  7940. var logger_1 = require_lib5();
  7941. exports2.packageImportMethodLogger = (0, logger_1.logger)("package-import-method");
  7942. }
  7943. });
  7944. // ../packages/core-loggers/lib/packageManifestLogger.js
  7945. var require_packageManifestLogger = __commonJS({
  7946. "../packages/core-loggers/lib/packageManifestLogger.js"(exports2) {
  7947. "use strict";
  7948. Object.defineProperty(exports2, "__esModule", { value: true });
  7949. exports2.packageManifestLogger = void 0;
  7950. var logger_1 = require_lib5();
  7951. exports2.packageManifestLogger = (0, logger_1.logger)("package-manifest");
  7952. }
  7953. });
  7954. // ../packages/core-loggers/lib/peerDependencyIssues.js
  7955. var require_peerDependencyIssues = __commonJS({
  7956. "../packages/core-loggers/lib/peerDependencyIssues.js"(exports2) {
  7957. "use strict";
  7958. Object.defineProperty(exports2, "__esModule", { value: true });
  7959. exports2.peerDependencyIssuesLogger = void 0;
  7960. var logger_1 = require_lib5();
  7961. exports2.peerDependencyIssuesLogger = (0, logger_1.logger)("peer-dependency-issues");
  7962. }
  7963. });
  7964. // ../packages/core-loggers/lib/progressLogger.js
  7965. var require_progressLogger = __commonJS({
  7966. "../packages/core-loggers/lib/progressLogger.js"(exports2) {
  7967. "use strict";
  7968. Object.defineProperty(exports2, "__esModule", { value: true });
  7969. exports2.progressLogger = void 0;
  7970. var logger_1 = require_lib5();
  7971. exports2.progressLogger = (0, logger_1.logger)("progress");
  7972. }
  7973. });
  7974. // ../packages/core-loggers/lib/registryLogger.js
  7975. var require_registryLogger = __commonJS({
  7976. "../packages/core-loggers/lib/registryLogger.js"(exports2) {
  7977. "use strict";
  7978. Object.defineProperty(exports2, "__esModule", { value: true });
  7979. }
  7980. });
  7981. // ../packages/core-loggers/lib/removalLogger.js
  7982. var require_removalLogger = __commonJS({
  7983. "../packages/core-loggers/lib/removalLogger.js"(exports2) {
  7984. "use strict";
  7985. Object.defineProperty(exports2, "__esModule", { value: true });
  7986. exports2.removalLogger = void 0;
  7987. var logger_1 = require_lib5();
  7988. exports2.removalLogger = (0, logger_1.logger)("removal");
  7989. }
  7990. });
  7991. // ../packages/core-loggers/lib/requestRetryLogger.js
  7992. var require_requestRetryLogger = __commonJS({
  7993. "../packages/core-loggers/lib/requestRetryLogger.js"(exports2) {
  7994. "use strict";
  7995. Object.defineProperty(exports2, "__esModule", { value: true });
  7996. exports2.requestRetryLogger = void 0;
  7997. var logger_1 = require_lib5();
  7998. exports2.requestRetryLogger = (0, logger_1.logger)("request-retry");
  7999. }
  8000. });
  8001. // ../packages/core-loggers/lib/rootLogger.js
  8002. var require_rootLogger = __commonJS({
  8003. "../packages/core-loggers/lib/rootLogger.js"(exports2) {
  8004. "use strict";
  8005. Object.defineProperty(exports2, "__esModule", { value: true });
  8006. exports2.rootLogger = void 0;
  8007. var logger_1 = require_lib5();
  8008. exports2.rootLogger = (0, logger_1.logger)("root");
  8009. }
  8010. });
  8011. // ../packages/core-loggers/lib/scopeLogger.js
  8012. var require_scopeLogger = __commonJS({
  8013. "../packages/core-loggers/lib/scopeLogger.js"(exports2) {
  8014. "use strict";
  8015. Object.defineProperty(exports2, "__esModule", { value: true });
  8016. exports2.scopeLogger = void 0;
  8017. var logger_1 = require_lib5();
  8018. exports2.scopeLogger = (0, logger_1.logger)("scope");
  8019. }
  8020. });
  8021. // ../packages/core-loggers/lib/skippedOptionalDependencyLogger.js
  8022. var require_skippedOptionalDependencyLogger = __commonJS({
  8023. "../packages/core-loggers/lib/skippedOptionalDependencyLogger.js"(exports2) {
  8024. "use strict";
  8025. Object.defineProperty(exports2, "__esModule", { value: true });
  8026. exports2.skippedOptionalDependencyLogger = void 0;
  8027. var logger_1 = require_lib5();
  8028. exports2.skippedOptionalDependencyLogger = (0, logger_1.logger)("skipped-optional-dependency");
  8029. }
  8030. });
  8031. // ../packages/core-loggers/lib/stageLogger.js
  8032. var require_stageLogger = __commonJS({
  8033. "../packages/core-loggers/lib/stageLogger.js"(exports2) {
  8034. "use strict";
  8035. Object.defineProperty(exports2, "__esModule", { value: true });
  8036. exports2.stageLogger = void 0;
  8037. var logger_1 = require_lib5();
  8038. exports2.stageLogger = (0, logger_1.logger)("stage");
  8039. }
  8040. });
  8041. // ../packages/core-loggers/lib/statsLogger.js
  8042. var require_statsLogger = __commonJS({
  8043. "../packages/core-loggers/lib/statsLogger.js"(exports2) {
  8044. "use strict";
  8045. Object.defineProperty(exports2, "__esModule", { value: true });
  8046. exports2.statsLogger = void 0;
  8047. var logger_1 = require_lib5();
  8048. exports2.statsLogger = (0, logger_1.logger)("stats");
  8049. }
  8050. });
  8051. // ../packages/core-loggers/lib/summaryLogger.js
  8052. var require_summaryLogger = __commonJS({
  8053. "../packages/core-loggers/lib/summaryLogger.js"(exports2) {
  8054. "use strict";
  8055. Object.defineProperty(exports2, "__esModule", { value: true });
  8056. exports2.summaryLogger = void 0;
  8057. var logger_1 = require_lib5();
  8058. exports2.summaryLogger = (0, logger_1.logger)("summary");
  8059. }
  8060. });
  8061. // ../packages/core-loggers/lib/updateCheckLogger.js
  8062. var require_updateCheckLogger = __commonJS({
  8063. "../packages/core-loggers/lib/updateCheckLogger.js"(exports2) {
  8064. "use strict";
  8065. Object.defineProperty(exports2, "__esModule", { value: true });
  8066. exports2.updateCheckLogger = void 0;
  8067. var logger_1 = require_lib5();
  8068. exports2.updateCheckLogger = (0, logger_1.logger)("update-check");
  8069. }
  8070. });
  8071. // ../packages/core-loggers/lib/executionTimeLogger.js
  8072. var require_executionTimeLogger = __commonJS({
  8073. "../packages/core-loggers/lib/executionTimeLogger.js"(exports2) {
  8074. "use strict";
  8075. Object.defineProperty(exports2, "__esModule", { value: true });
  8076. exports2.executionTimeLogger = void 0;
  8077. var logger_1 = require_lib5();
  8078. exports2.executionTimeLogger = (0, logger_1.logger)("execution-time");
  8079. }
  8080. });
  8081. // ../packages/core-loggers/lib/all.js
  8082. var require_all = __commonJS({
  8083. "../packages/core-loggers/lib/all.js"(exports2) {
  8084. "use strict";
  8085. var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
  8086. if (k2 === void 0) k2 = k;
  8087. var desc = Object.getOwnPropertyDescriptor(m, k);
  8088. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  8089. desc = { enumerable: true, get: function() {
  8090. return m[k];
  8091. } };
  8092. }
  8093. Object.defineProperty(o, k2, desc);
  8094. } : function(o, m, k, k2) {
  8095. if (k2 === void 0) k2 = k;
  8096. o[k2] = m[k];
  8097. });
  8098. var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
  8099. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p);
  8100. };
  8101. Object.defineProperty(exports2, "__esModule", { value: true });
  8102. __exportStar(require_contextLogger(), exports2);
  8103. __exportStar(require_deprecationLogger(), exports2);
  8104. __exportStar(require_fetchingProgressLogger(), exports2);
  8105. __exportStar(require_hookLogger(), exports2);
  8106. __exportStar(require_installCheckLogger(), exports2);
  8107. __exportStar(require_installingConfigDeps(), exports2);
  8108. __exportStar(require_ignoredScriptsLogger(), exports2);
  8109. __exportStar(require_lifecycleLogger(), exports2);
  8110. __exportStar(require_linkLogger(), exports2);
  8111. __exportStar(require_packageImportMethodLogger(), exports2);
  8112. __exportStar(require_packageManifestLogger(), exports2);
  8113. __exportStar(require_peerDependencyIssues(), exports2);
  8114. __exportStar(require_progressLogger(), exports2);
  8115. __exportStar(require_registryLogger(), exports2);
  8116. __exportStar(require_removalLogger(), exports2);
  8117. __exportStar(require_requestRetryLogger(), exports2);
  8118. __exportStar(require_rootLogger(), exports2);
  8119. __exportStar(require_scopeLogger(), exports2);
  8120. __exportStar(require_skippedOptionalDependencyLogger(), exports2);
  8121. __exportStar(require_stageLogger(), exports2);
  8122. __exportStar(require_statsLogger(), exports2);
  8123. __exportStar(require_summaryLogger(), exports2);
  8124. __exportStar(require_updateCheckLogger(), exports2);
  8125. __exportStar(require_executionTimeLogger(), exports2);
  8126. }
  8127. });
  8128. // ../packages/core-loggers/lib/index.js
  8129. var require_lib6 = __commonJS({
  8130. "../packages/core-loggers/lib/index.js"(exports2) {
  8131. "use strict";
  8132. var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
  8133. if (k2 === void 0) k2 = k;
  8134. var desc = Object.getOwnPropertyDescriptor(m, k);
  8135. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  8136. desc = { enumerable: true, get: function() {
  8137. return m[k];
  8138. } };
  8139. }
  8140. Object.defineProperty(o, k2, desc);
  8141. } : function(o, m, k, k2) {
  8142. if (k2 === void 0) k2 = k;
  8143. o[k2] = m[k];
  8144. });
  8145. var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
  8146. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p);
  8147. };
  8148. Object.defineProperty(exports2, "__esModule", { value: true });
  8149. __exportStar(require_all(), exports2);
  8150. }
  8151. });
  8152. // ../node_modules/.pnpm/make-empty-dir@3.0.2/node_modules/make-empty-dir/index.js
  8153. var require_make_empty_dir = __commonJS({
  8154. "../node_modules/.pnpm/make-empty-dir@3.0.2/node_modules/make-empty-dir/index.js"(exports2, module2) {
  8155. "use strict";
  8156. var fs = require("fs");
  8157. var path = require("path");
  8158. var rimraf = require_rimraf();
  8159. module2.exports = async function makeEmptyDir(dir, opts) {
  8160. if (opts && opts.recursive) {
  8161. await fs.promises.mkdir(path.dirname(dir), { recursive: true });
  8162. }
  8163. try {
  8164. await fs.promises.mkdir(dir);
  8165. return "created";
  8166. } catch (err) {
  8167. if (err.code === "EEXIST") {
  8168. await removeContentsOfDir(dir);
  8169. return "emptied";
  8170. }
  8171. throw err;
  8172. }
  8173. };
  8174. async function removeContentsOfDir(dir) {
  8175. const items = await fs.promises.readdir(dir);
  8176. for (const item of items) {
  8177. await rimraf(path.join(dir, item));
  8178. }
  8179. }
  8180. module2.exports.sync = function makeEmptyDirSync(dir, opts) {
  8181. if (opts && opts.recursive) {
  8182. fs.mkdirSync(path.dirname(dir), { recursive: true });
  8183. }
  8184. try {
  8185. fs.mkdirSync(dir);
  8186. return "created";
  8187. } catch (err) {
  8188. if (err.code === "EEXIST") {
  8189. removeContentsOfDirSync(dir);
  8190. return "emptied";
  8191. }
  8192. throw err;
  8193. }
  8194. };
  8195. function removeContentsOfDirSync(dir) {
  8196. const items = fs.readdirSync(dir);
  8197. for (const item of items) {
  8198. rimraf.sync(path.join(dir, item));
  8199. }
  8200. }
  8201. }
  8202. });
  8203. // ../node_modules/.pnpm/truncate-utf8-bytes@1.0.2/node_modules/truncate-utf8-bytes/lib/truncate.js
  8204. var require_truncate = __commonJS({
  8205. "../node_modules/.pnpm/truncate-utf8-bytes@1.0.2/node_modules/truncate-utf8-bytes/lib/truncate.js"(exports2, module2) {
  8206. "use strict";
  8207. function isHighSurrogate(codePoint) {
  8208. return codePoint >= 55296 && codePoint <= 56319;
  8209. }
  8210. function isLowSurrogate(codePoint) {
  8211. return codePoint >= 56320 && codePoint <= 57343;
  8212. }
  8213. module2.exports = function truncate(getLength, string, byteLength) {
  8214. if (typeof string !== "string") {
  8215. throw new Error("Input must be string");
  8216. }
  8217. var charLength = string.length;
  8218. var curByteLength = 0;
  8219. var codePoint;
  8220. var segment;
  8221. for (var i = 0; i < charLength; i += 1) {
  8222. codePoint = string.charCodeAt(i);
  8223. segment = string[i];
  8224. if (isHighSurrogate(codePoint) && isLowSurrogate(string.charCodeAt(i + 1))) {
  8225. i += 1;
  8226. segment += string[i];
  8227. }
  8228. curByteLength += getLength(segment);
  8229. if (curByteLength === byteLength) {
  8230. return string.slice(0, i + 1);
  8231. } else if (curByteLength > byteLength) {
  8232. return string.slice(0, i - segment.length + 1);
  8233. }
  8234. }
  8235. return string;
  8236. };
  8237. }
  8238. });
  8239. // ../node_modules/.pnpm/truncate-utf8-bytes@1.0.2/node_modules/truncate-utf8-bytes/index.js
  8240. var require_truncate_utf8_bytes = __commonJS({
  8241. "../node_modules/.pnpm/truncate-utf8-bytes@1.0.2/node_modules/truncate-utf8-bytes/index.js"(exports2, module2) {
  8242. "use strict";
  8243. var truncate = require_truncate();
  8244. var getLength = Buffer.byteLength.bind(Buffer);
  8245. module2.exports = truncate.bind(null, getLength);
  8246. }
  8247. });
  8248. // ../node_modules/.pnpm/sanitize-filename@1.6.3/node_modules/sanitize-filename/index.js
  8249. var require_sanitize_filename = __commonJS({
  8250. "../node_modules/.pnpm/sanitize-filename@1.6.3/node_modules/sanitize-filename/index.js"(exports2, module2) {
  8251. "use strict";
  8252. var truncate = require_truncate_utf8_bytes();
  8253. var illegalRe = /[\/\?<>\\:\*\|"]/g;
  8254. var controlRe = /[\x00-\x1f\x80-\x9f]/g;
  8255. var reservedRe = /^\.+$/;
  8256. var windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
  8257. var windowsTrailingRe = /[\. ]+$/;
  8258. function sanitize(input, replacement) {
  8259. if (typeof input !== "string") {
  8260. throw new Error("Input must be string");
  8261. }
  8262. var sanitized = input.replace(illegalRe, replacement).replace(controlRe, replacement).replace(reservedRe, replacement).replace(windowsReservedRe, replacement).replace(windowsTrailingRe, replacement);
  8263. return truncate(sanitized, 255);
  8264. }
  8265. module2.exports = function(input, options) {
  8266. var replacement = options && options.replacement || "";
  8267. var output = sanitize(input, replacement);
  8268. if (replacement === "") {
  8269. return output;
  8270. }
  8271. return sanitize(output, "");
  8272. };
  8273. }
  8274. });
  8275. // ../node_modules/.pnpm/crypto-random-string@2.0.0/node_modules/crypto-random-string/index.js
  8276. var require_crypto_random_string = __commonJS({
  8277. "../node_modules/.pnpm/crypto-random-string@2.0.0/node_modules/crypto-random-string/index.js"(exports2, module2) {
  8278. "use strict";
  8279. var crypto2 = require("crypto");
  8280. module2.exports = (length) => {
  8281. if (!Number.isFinite(length)) {
  8282. throw new TypeError("Expected a finite number");
  8283. }
  8284. return crypto2.randomBytes(Math.ceil(length / 2)).toString("hex").slice(0, length);
  8285. };
  8286. }
  8287. });
  8288. // ../node_modules/.pnpm/unique-string@2.0.0/node_modules/unique-string/index.js
  8289. var require_unique_string = __commonJS({
  8290. "../node_modules/.pnpm/unique-string@2.0.0/node_modules/unique-string/index.js"(exports2, module2) {
  8291. "use strict";
  8292. var cryptoRandomString = require_crypto_random_string();
  8293. module2.exports = () => cryptoRandomString(32);
  8294. }
  8295. });
  8296. // ../node_modules/.pnpm/path-temp@2.1.0/node_modules/path-temp/index.js
  8297. var require_path_temp = __commonJS({
  8298. "../node_modules/.pnpm/path-temp@2.1.0/node_modules/path-temp/index.js"(exports2, module2) {
  8299. "use strict";
  8300. var path = require("path");
  8301. var uniqueString = require_unique_string();
  8302. module2.exports = function pathTemp(folder) {
  8303. return path.join(folder, `_tmp_${process.pid}_${uniqueString()}`);
  8304. };
  8305. module2.exports.fastPathTemp = function pathTempFast(file) {
  8306. return path.join(path.dirname(file), `${path.basename(file)}_tmp_${process.pid}`);
  8307. };
  8308. }
  8309. });
  8310. // ../fs/indexed-pkg-importer/lib/importIndexedDir.js
  8311. var require_importIndexedDir = __commonJS({
  8312. "../fs/indexed-pkg-importer/lib/importIndexedDir.js"(exports2) {
  8313. "use strict";
  8314. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  8315. return mod && mod.__esModule ? mod : { "default": mod };
  8316. };
  8317. Object.defineProperty(exports2, "__esModule", { value: true });
  8318. exports2.importIndexedDir = importIndexedDir;
  8319. var fs_12 = __importDefault2(require("fs"));
  8320. var util_1 = __importDefault2(require("util"));
  8321. var fs_extra_1 = require_lib3();
  8322. var path_12 = __importDefault2(require("path"));
  8323. var logger_1 = require_lib5();
  8324. var rimraf_1 = require_rimraf();
  8325. var make_empty_dir_1 = require_make_empty_dir();
  8326. var sanitize_filename_1 = __importDefault2(require_sanitize_filename());
  8327. var path_temp_1 = require_path_temp();
  8328. var rename_overwrite_1 = __importDefault2(require_rename_overwrite());
  8329. var filenameConflictsLogger = (0, logger_1.logger)("_filename-conflicts");
  8330. function importIndexedDir(importFile, newDir, filenames, opts) {
  8331. const stage = (0, path_temp_1.fastPathTemp)(newDir);
  8332. try {
  8333. tryImportIndexedDir(importFile, stage, filenames);
  8334. if (opts.keepModulesDir) {
  8335. moveOrMergeModulesDirs(path_12.default.join(newDir, "node_modules"), path_12.default.join(stage, "node_modules"));
  8336. }
  8337. rename_overwrite_1.default.sync(stage, newDir);
  8338. } catch (err) {
  8339. try {
  8340. (0, rimraf_1.sync)(stage);
  8341. } catch {
  8342. }
  8343. if (util_1.default.types.isNativeError(err) && "code" in err && err.code === "EEXIST") {
  8344. const { uniqueFileMap, conflictingFileNames } = getUniqueFileMap(filenames);
  8345. if (Object.keys(conflictingFileNames).length === 0)
  8346. throw err;
  8347. filenameConflictsLogger.debug({
  8348. conflicts: conflictingFileNames,
  8349. writingTo: newDir
  8350. });
  8351. (0, logger_1.globalWarn)(`Not all files were linked to "${path_12.default.relative(process.cwd(), newDir)}". Some of the files have equal names in different case, which is an issue on case-insensitive filesystems. The conflicting file names are: ${JSON.stringify(conflictingFileNames)}`);
  8352. importIndexedDir(importFile, newDir, uniqueFileMap, opts);
  8353. return;
  8354. }
  8355. if (util_1.default.types.isNativeError(err) && "code" in err && err.code === "ENOENT") {
  8356. const { sanitizedFilenames, invalidFilenames } = sanitizeFilenames(filenames);
  8357. if (invalidFilenames.length === 0)
  8358. throw err;
  8359. (0, logger_1.globalWarn)(`The package linked to "${path_12.default.relative(process.cwd(), newDir)}" had files with invalid names: ${invalidFilenames.join(", ")}. They were renamed.`);
  8360. importIndexedDir(importFile, newDir, sanitizedFilenames, opts);
  8361. return;
  8362. }
  8363. throw err;
  8364. }
  8365. }
  8366. function sanitizeFilenames(filenames) {
  8367. const sanitizedFilenames = {};
  8368. const invalidFilenames = [];
  8369. for (const [filename, src] of Object.entries(filenames)) {
  8370. const sanitizedFilename = filename.split("/").map((f) => (0, sanitize_filename_1.default)(f)).join("/");
  8371. if (sanitizedFilename !== filename) {
  8372. invalidFilenames.push(filename);
  8373. }
  8374. sanitizedFilenames[sanitizedFilename] = src;
  8375. }
  8376. return { sanitizedFilenames, invalidFilenames };
  8377. }
  8378. function tryImportIndexedDir(importFile, newDir, filenames) {
  8379. (0, make_empty_dir_1.sync)(newDir, { recursive: true });
  8380. const allDirs = /* @__PURE__ */ new Set();
  8381. for (const f in filenames) {
  8382. const dir = path_12.default.dirname(f);
  8383. if (dir === ".")
  8384. continue;
  8385. allDirs.add(dir);
  8386. }
  8387. Array.from(allDirs).sort((d1, d2) => d1.length - d2.length).forEach((dir) => fs_12.default.mkdirSync(path_12.default.join(newDir, dir), { recursive: true }));
  8388. for (const [f, src] of Object.entries(filenames)) {
  8389. const dest = path_12.default.join(newDir, f);
  8390. importFile(src, dest);
  8391. }
  8392. }
  8393. function getUniqueFileMap(fileMap) {
  8394. const lowercaseFiles = /* @__PURE__ */ new Map();
  8395. const conflictingFileNames = {};
  8396. const uniqueFileMap = {};
  8397. for (const filename of Object.keys(fileMap).sort()) {
  8398. const lowercaseFilename = filename.toLowerCase();
  8399. if (lowercaseFiles.has(lowercaseFilename)) {
  8400. conflictingFileNames[filename] = lowercaseFiles.get(lowercaseFilename);
  8401. continue;
  8402. }
  8403. lowercaseFiles.set(lowercaseFilename, filename);
  8404. uniqueFileMap[filename] = fileMap[filename];
  8405. }
  8406. return {
  8407. conflictingFileNames,
  8408. uniqueFileMap
  8409. };
  8410. }
  8411. function moveOrMergeModulesDirs(src, dest) {
  8412. try {
  8413. renameEvenAcrossDevices(src, dest);
  8414. } catch (err) {
  8415. switch (util_1.default.types.isNativeError(err) && "code" in err && err.code) {
  8416. case "ENOENT":
  8417. return;
  8418. case "ENOTEMPTY":
  8419. case "EPERM":
  8420. mergeModulesDirs(src, dest);
  8421. return;
  8422. default:
  8423. throw err;
  8424. }
  8425. }
  8426. }
  8427. function renameEvenAcrossDevices(src, dest) {
  8428. try {
  8429. fs_12.default.renameSync(src, dest);
  8430. } catch (err) {
  8431. if (!(util_1.default.types.isNativeError(err) && "code" in err && err.code === "EXDEV"))
  8432. throw err;
  8433. (0, fs_extra_1.copySync)(src, dest);
  8434. }
  8435. }
  8436. function mergeModulesDirs(src, dest) {
  8437. const srcFiles = fs_12.default.readdirSync(src);
  8438. const destFiles = new Set(fs_12.default.readdirSync(dest));
  8439. const filesToMove = srcFiles.filter((file) => !destFiles.has(file));
  8440. for (const file of filesToMove) {
  8441. renameEvenAcrossDevices(path_12.default.join(src, file), path_12.default.join(dest, file));
  8442. }
  8443. }
  8444. }
  8445. });
  8446. // ../node_modules/.pnpm/@reflink+reflink@0.1.19/node_modules/@reflink/reflink/binding.js
  8447. var require_binding = __commonJS({
  8448. "../node_modules/.pnpm/@reflink+reflink@0.1.19/node_modules/@reflink/reflink/binding.js"(exports2, module2) {
  8449. var { existsSync, readFileSync } = require("fs");
  8450. var { join } = require("path");
  8451. var { platform, arch } = process;
  8452. var nativeBinding = null;
  8453. var localFileExisted = false;
  8454. var loadError = null;
  8455. function isMusl() {
  8456. if (!process.report || typeof process.report.getReport !== "function") {
  8457. try {
  8458. const lddPath = require("child_process").execSync("which ldd").toString().trim();
  8459. return readFileSync(lddPath, "utf8").includes("musl");
  8460. } catch (e) {
  8461. return true;
  8462. }
  8463. } else {
  8464. const { glibcVersionRuntime } = process.report.getReport().header;
  8465. return !glibcVersionRuntime;
  8466. }
  8467. }
  8468. switch (platform) {
  8469. case "android":
  8470. switch (arch) {
  8471. case "arm64":
  8472. localFileExisted = existsSync(join(__dirname, "reflink.android-arm64.node"));
  8473. try {
  8474. if (localFileExisted) {
  8475. nativeBinding = require("./reflink.android-arm64.node");
  8476. } else {
  8477. nativeBinding = require("@reflink/reflink-android-arm64");
  8478. }
  8479. } catch (e) {
  8480. loadError = e;
  8481. }
  8482. break;
  8483. case "arm":
  8484. localFileExisted = existsSync(join(__dirname, "reflink.android-arm-eabi.node"));
  8485. try {
  8486. if (localFileExisted) {
  8487. nativeBinding = require("./reflink.android-arm-eabi.node");
  8488. } else {
  8489. nativeBinding = require("@reflink/reflink-android-arm-eabi");
  8490. }
  8491. } catch (e) {
  8492. loadError = e;
  8493. }
  8494. break;
  8495. default:
  8496. throw new Error(`Unsupported architecture on Android ${arch}`);
  8497. }
  8498. break;
  8499. case "win32":
  8500. switch (arch) {
  8501. case "x64":
  8502. localFileExisted = existsSync(
  8503. join(__dirname, "reflink.win32-x64-msvc.node")
  8504. );
  8505. try {
  8506. if (localFileExisted) {
  8507. nativeBinding = require("./reflink.win32-x64-msvc.node");
  8508. } else {
  8509. nativeBinding = require("./reflink.win32-x64-msvc-J2TZHRQI.node");
  8510. }
  8511. } catch (e) {
  8512. loadError = e;
  8513. }
  8514. break;
  8515. case "ia32":
  8516. localFileExisted = existsSync(
  8517. join(__dirname, "reflink.win32-ia32-msvc.node")
  8518. );
  8519. try {
  8520. if (localFileExisted) {
  8521. nativeBinding = require("./reflink.win32-ia32-msvc.node");
  8522. } else {
  8523. nativeBinding = require("@reflink/reflink-win32-ia32-msvc");
  8524. }
  8525. } catch (e) {
  8526. loadError = e;
  8527. }
  8528. break;
  8529. case "arm64":
  8530. localFileExisted = existsSync(
  8531. join(__dirname, "reflink.win32-arm64-msvc.node")
  8532. );
  8533. try {
  8534. if (localFileExisted) {
  8535. nativeBinding = require("./reflink.win32-arm64-msvc.node");
  8536. } else {
  8537. nativeBinding = require("./reflink.win32-arm64-msvc-Q6BARPPB.node");
  8538. }
  8539. } catch (e) {
  8540. loadError = e;
  8541. }
  8542. break;
  8543. default:
  8544. throw new Error(`Unsupported architecture on Windows: ${arch}`);
  8545. }
  8546. break;
  8547. case "darwin":
  8548. localFileExisted = existsSync(join(__dirname, "reflink.darwin-universal.node"));
  8549. try {
  8550. if (localFileExisted) {
  8551. nativeBinding = require("./reflink.darwin-universal.node");
  8552. } else {
  8553. nativeBinding = require("@reflink/reflink-darwin-universal");
  8554. }
  8555. break;
  8556. } catch {
  8557. }
  8558. switch (arch) {
  8559. case "x64":
  8560. localFileExisted = existsSync(join(__dirname, "reflink.darwin-x64.node"));
  8561. try {
  8562. if (localFileExisted) {
  8563. nativeBinding = require("./reflink.darwin-x64.node");
  8564. } else {
  8565. nativeBinding = require("./reflink.darwin-x64-3G3H6IW4.node");
  8566. }
  8567. } catch (e) {
  8568. loadError = e;
  8569. }
  8570. break;
  8571. case "arm64":
  8572. localFileExisted = existsSync(
  8573. join(__dirname, "reflink.darwin-arm64.node")
  8574. );
  8575. try {
  8576. if (localFileExisted) {
  8577. nativeBinding = require("./reflink.darwin-arm64.node");
  8578. } else {
  8579. nativeBinding = require("./reflink.darwin-arm64-2HJ4WGO6.node");
  8580. }
  8581. } catch (e) {
  8582. loadError = e;
  8583. }
  8584. break;
  8585. default:
  8586. throw new Error(`Unsupported architecture on macOS: ${arch}`);
  8587. }
  8588. break;
  8589. case "freebsd":
  8590. if (arch !== "x64") {
  8591. throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
  8592. }
  8593. localFileExisted = existsSync(join(__dirname, "reflink.freebsd-x64.node"));
  8594. try {
  8595. if (localFileExisted) {
  8596. nativeBinding = require("./reflink.freebsd-x64.node");
  8597. } else {
  8598. nativeBinding = require("@reflink/reflink-freebsd-x64");
  8599. }
  8600. } catch (e) {
  8601. loadError = e;
  8602. }
  8603. break;
  8604. case "linux":
  8605. switch (arch) {
  8606. case "x64":
  8607. if (isMusl()) {
  8608. localFileExisted = existsSync(
  8609. join(__dirname, "reflink.linux-x64-musl.node")
  8610. );
  8611. try {
  8612. if (localFileExisted) {
  8613. nativeBinding = require("./reflink.linux-x64-musl.node");
  8614. } else {
  8615. nativeBinding = require("@reflink/reflink-linux-x64-musl");
  8616. }
  8617. } catch (e) {
  8618. loadError = e;
  8619. }
  8620. } else {
  8621. localFileExisted = existsSync(
  8622. join(__dirname, "reflink.linux-x64-gnu.node")
  8623. );
  8624. try {
  8625. if (localFileExisted) {
  8626. nativeBinding = require("./reflink.linux-x64-gnu.node");
  8627. } else {
  8628. nativeBinding = require("@reflink/reflink-linux-x64-gnu");
  8629. }
  8630. } catch (e) {
  8631. loadError = e;
  8632. }
  8633. }
  8634. break;
  8635. case "arm64":
  8636. if (isMusl()) {
  8637. localFileExisted = existsSync(
  8638. join(__dirname, "reflink.linux-arm64-musl.node")
  8639. );
  8640. try {
  8641. if (localFileExisted) {
  8642. nativeBinding = require("./reflink.linux-arm64-musl.node");
  8643. } else {
  8644. nativeBinding = require("@reflink/reflink-linux-arm64-musl");
  8645. }
  8646. } catch (e) {
  8647. loadError = e;
  8648. }
  8649. } else {
  8650. localFileExisted = existsSync(
  8651. join(__dirname, "reflink.linux-arm64-gnu.node")
  8652. );
  8653. try {
  8654. if (localFileExisted) {
  8655. nativeBinding = require("./reflink.linux-arm64-gnu.node");
  8656. } else {
  8657. nativeBinding = require("@reflink/reflink-linux-arm64-gnu");
  8658. }
  8659. } catch (e) {
  8660. loadError = e;
  8661. }
  8662. }
  8663. break;
  8664. case "arm":
  8665. localFileExisted = existsSync(
  8666. join(__dirname, "reflink.linux-arm-gnueabihf.node")
  8667. );
  8668. try {
  8669. if (localFileExisted) {
  8670. nativeBinding = require("./reflink.linux-arm-gnueabihf.node");
  8671. } else {
  8672. nativeBinding = require("@reflink/reflink-linux-arm-gnueabihf");
  8673. }
  8674. } catch (e) {
  8675. loadError = e;
  8676. }
  8677. break;
  8678. default:
  8679. throw new Error(`Unsupported architecture on Linux: ${arch}`);
  8680. }
  8681. break;
  8682. default:
  8683. throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
  8684. }
  8685. if (!nativeBinding) {
  8686. if (loadError) {
  8687. throw loadError;
  8688. }
  8689. throw new Error(`Failed to load native binding`);
  8690. }
  8691. var { ReflinkError, reflinkFile, reflinkFileSync } = nativeBinding;
  8692. module2.exports.ReflinkError = ReflinkError;
  8693. module2.exports.reflinkFile = reflinkFile;
  8694. module2.exports.reflinkFileSync = reflinkFileSync;
  8695. }
  8696. });
  8697. // ../node_modules/.pnpm/@reflink+reflink@0.1.19/node_modules/@reflink/reflink/index.js
  8698. var require_reflink = __commonJS({
  8699. "../node_modules/.pnpm/@reflink+reflink@0.1.19/node_modules/@reflink/reflink/index.js"(exports2, module2) {
  8700. var binding = require_binding();
  8701. function createReflinkError(reflinkError) {
  8702. const error = new Error(reflinkError.message);
  8703. return Object.assign(error, {
  8704. path: reflinkError.path,
  8705. dest: reflinkError.dest,
  8706. code: reflinkError.code,
  8707. errno: reflinkError.errno
  8708. });
  8709. }
  8710. function handleReflinkResult(result) {
  8711. if (typeof result === "number") {
  8712. return result;
  8713. } else {
  8714. throw createReflinkError(result);
  8715. }
  8716. }
  8717. var reflinkFile = (src, dst) => binding.reflinkFile(src, dst).then(handleReflinkResult);
  8718. var reflinkFileSync = (src, dst) => handleReflinkResult(binding.reflinkFileSync(src, dst));
  8719. module2.exports = {
  8720. reflinkFile,
  8721. reflinkFileSync
  8722. };
  8723. }
  8724. });
  8725. // ../fs/indexed-pkg-importer/lib/index.js
  8726. var require_lib7 = __commonJS({
  8727. "../fs/indexed-pkg-importer/lib/index.js"(exports2) {
  8728. "use strict";
  8729. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  8730. return mod && mod.__esModule ? mod : { "default": mod };
  8731. };
  8732. Object.defineProperty(exports2, "__esModule", { value: true });
  8733. exports2.createIndexedPkgImporter = createIndexedPkgImporter;
  8734. exports2.copyPkg = copyPkg;
  8735. var assert_1 = __importDefault2(require("assert"));
  8736. var fs_12 = require("fs");
  8737. var util_1 = __importDefault2(require("util"));
  8738. var graceful_fs_12 = __importDefault2(require_lib());
  8739. var path_12 = __importDefault2(require("path"));
  8740. var logger_1 = require_lib5();
  8741. var core_loggers_1 = require_lib6();
  8742. var importIndexedDir_1 = require_importIndexedDir();
  8743. function createIndexedPkgImporter(packageImportMethod) {
  8744. const importPackage2 = createImportPackage(packageImportMethod);
  8745. return importPackage2;
  8746. }
  8747. function createImportPackage(packageImportMethod) {
  8748. switch (packageImportMethod ?? "auto") {
  8749. case "clone":
  8750. core_loggers_1.packageImportMethodLogger.debug({ method: "clone" });
  8751. return clonePkg.bind(null, createCloneFunction());
  8752. case "hardlink":
  8753. core_loggers_1.packageImportMethodLogger.debug({ method: "hardlink" });
  8754. return hardlinkPkg.bind(null, linkOrCopy);
  8755. case "auto": {
  8756. return createAutoImporter();
  8757. }
  8758. case "clone-or-copy":
  8759. return createCloneOrCopyImporter();
  8760. case "copy":
  8761. core_loggers_1.packageImportMethodLogger.debug({ method: "copy" });
  8762. return copyPkg;
  8763. default:
  8764. throw new Error(`Unknown package import method ${packageImportMethod}`);
  8765. }
  8766. }
  8767. function createAutoImporter() {
  8768. let auto = initialAuto;
  8769. return (to, opts) => auto(to, opts);
  8770. function initialAuto(to, opts) {
  8771. if (process.platform !== "win32") {
  8772. try {
  8773. const _clonePkg = clonePkg.bind(null, createCloneFunction());
  8774. if (!_clonePkg(to, opts))
  8775. return void 0;
  8776. core_loggers_1.packageImportMethodLogger.debug({ method: "clone" });
  8777. auto = _clonePkg;
  8778. return "clone";
  8779. } catch {
  8780. }
  8781. }
  8782. try {
  8783. if (!hardlinkPkg(graceful_fs_12.default.linkSync, to, opts))
  8784. return void 0;
  8785. core_loggers_1.packageImportMethodLogger.debug({ method: "hardlink" });
  8786. auto = hardlinkPkg.bind(null, linkOrCopy);
  8787. return "hardlink";
  8788. } catch (err) {
  8789. (0, assert_1.default)(util_1.default.types.isNativeError(err));
  8790. if (err.message.startsWith("EXDEV: cross-device link not permitted")) {
  8791. (0, logger_1.globalWarn)(err.message);
  8792. (0, logger_1.globalInfo)("Falling back to copying packages from store");
  8793. core_loggers_1.packageImportMethodLogger.debug({ method: "copy" });
  8794. auto = copyPkg;
  8795. return auto(to, opts);
  8796. }
  8797. core_loggers_1.packageImportMethodLogger.debug({ method: "hardlink" });
  8798. auto = hardlinkPkg.bind(null, linkOrCopy);
  8799. return auto(to, opts);
  8800. }
  8801. }
  8802. }
  8803. function createCloneOrCopyImporter() {
  8804. let auto = initialAuto;
  8805. return (to, opts) => auto(to, opts);
  8806. function initialAuto(to, opts) {
  8807. try {
  8808. const _clonePkg = clonePkg.bind(null, createCloneFunction());
  8809. if (!_clonePkg(to, opts))
  8810. return void 0;
  8811. core_loggers_1.packageImportMethodLogger.debug({ method: "clone" });
  8812. auto = _clonePkg;
  8813. return "clone";
  8814. } catch {
  8815. }
  8816. core_loggers_1.packageImportMethodLogger.debug({ method: "copy" });
  8817. auto = copyPkg;
  8818. return auto(to, opts);
  8819. }
  8820. }
  8821. function clonePkg(clone, to, opts) {
  8822. const pkgJsonPath = path_12.default.join(to, "package.json");
  8823. if (opts.resolvedFrom !== "store" || opts.force || !(0, fs_12.existsSync)(pkgJsonPath)) {
  8824. (0, importIndexedDir_1.importIndexedDir)(clone, to, opts.filesMap, opts);
  8825. return "clone";
  8826. }
  8827. return void 0;
  8828. }
  8829. function createCloneFunction() {
  8830. if (process.platform === "darwin" || process.platform === "win32") {
  8831. const { reflinkFileSync } = require_reflink();
  8832. return (fr, to) => {
  8833. try {
  8834. reflinkFileSync(fr, to);
  8835. } catch (err) {
  8836. if (!util_1.default.types.isNativeError(err) || !("code" in err) || err.code !== "EEXIST")
  8837. throw err;
  8838. }
  8839. };
  8840. }
  8841. return (src, dest) => {
  8842. try {
  8843. graceful_fs_12.default.copyFileSync(src, dest, fs_12.constants.COPYFILE_FICLONE_FORCE);
  8844. } catch (err) {
  8845. if (!(util_1.default.types.isNativeError(err) && "code" in err && err.code === "EEXIST"))
  8846. throw err;
  8847. }
  8848. };
  8849. }
  8850. function hardlinkPkg(importFile, to, opts) {
  8851. if (opts.force || shouldRelinkPkg(to, opts)) {
  8852. (0, importIndexedDir_1.importIndexedDir)(importFile, to, opts.filesMap, opts);
  8853. return "hardlink";
  8854. }
  8855. return void 0;
  8856. }
  8857. function shouldRelinkPkg(to, opts) {
  8858. if (opts.disableRelinkLocalDirDeps && opts.resolvedFrom === "local-dir") {
  8859. try {
  8860. const files = graceful_fs_12.default.readdirSync(to);
  8861. return files.length === 0 || files.length === 1 && files[0] === "node_modules";
  8862. } catch {
  8863. return true;
  8864. }
  8865. }
  8866. return opts.resolvedFrom !== "store" || !pkgLinkedToStore(opts.filesMap, to);
  8867. }
  8868. function linkOrCopy(existingPath, newPath) {
  8869. try {
  8870. graceful_fs_12.default.linkSync(existingPath, newPath);
  8871. } catch (err) {
  8872. if (util_1.default.types.isNativeError(err) && "code" in err && err.code === "EEXIST")
  8873. return;
  8874. graceful_fs_12.default.copyFileSync(existingPath, newPath);
  8875. }
  8876. }
  8877. function pkgLinkedToStore(filesMap, to) {
  8878. if (filesMap["package.json"]) {
  8879. if (isSameFile("package.json", to, filesMap)) {
  8880. return true;
  8881. }
  8882. } else {
  8883. const [anyFile] = Object.keys(filesMap);
  8884. if (isSameFile(anyFile, to, filesMap))
  8885. return true;
  8886. }
  8887. return false;
  8888. }
  8889. function isSameFile(filename, linkedPkgDir, filesMap) {
  8890. const linkedFile = path_12.default.join(linkedPkgDir, filename);
  8891. let stats0;
  8892. try {
  8893. stats0 = graceful_fs_12.default.statSync(linkedFile);
  8894. } catch (err) {
  8895. if (util_1.default.types.isNativeError(err) && "code" in err && err.code === "ENOENT")
  8896. return false;
  8897. }
  8898. const stats1 = graceful_fs_12.default.statSync(filesMap[filename]);
  8899. if (stats0.ino === stats1.ino)
  8900. return true;
  8901. (0, logger_1.globalInfo)(`Relinking ${linkedPkgDir} from the store`);
  8902. return false;
  8903. }
  8904. function copyPkg(to, opts) {
  8905. const pkgJsonPath = path_12.default.join(to, "package.json");
  8906. if (opts.resolvedFrom !== "store" || opts.force || !(0, fs_12.existsSync)(pkgJsonPath)) {
  8907. (0, importIndexedDir_1.importIndexedDir)(graceful_fs_12.default.copyFileSync, to, opts.filesMap, opts);
  8908. return "copy";
  8909. }
  8910. return void 0;
  8911. }
  8912. }
  8913. });
  8914. // ../node_modules/.pnpm/mimic-fn@3.1.0/node_modules/mimic-fn/index.js
  8915. var require_mimic_fn = __commonJS({
  8916. "../node_modules/.pnpm/mimic-fn@3.1.0/node_modules/mimic-fn/index.js"(exports2, module2) {
  8917. "use strict";
  8918. var copyProperty = (to, from, property, ignoreNonConfigurable) => {
  8919. if (property === "length" || property === "prototype") {
  8920. return;
  8921. }
  8922. if (property === "arguments" || property === "caller") {
  8923. return;
  8924. }
  8925. const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
  8926. const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
  8927. if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
  8928. return;
  8929. }
  8930. Object.defineProperty(to, property, fromDescriptor);
  8931. };
  8932. var canCopyProperty = function(toDescriptor, fromDescriptor) {
  8933. return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
  8934. };
  8935. var changePrototype = (to, from) => {
  8936. const fromPrototype = Object.getPrototypeOf(from);
  8937. if (fromPrototype === Object.getPrototypeOf(to)) {
  8938. return;
  8939. }
  8940. Object.setPrototypeOf(to, fromPrototype);
  8941. };
  8942. var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
  8943. ${fromBody}`;
  8944. var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
  8945. var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
  8946. var changeToString = (to, from, name) => {
  8947. const withName = name === "" ? "" : `with ${name.trim()}() `;
  8948. const newToString = wrappedToString.bind(null, withName, from.toString());
  8949. Object.defineProperty(newToString, "name", toStringName);
  8950. Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
  8951. };
  8952. var mimicFn = (to, from, { ignoreNonConfigurable = false } = {}) => {
  8953. const { name } = to;
  8954. for (const property of Reflect.ownKeys(from)) {
  8955. copyProperty(to, from, property, ignoreNonConfigurable);
  8956. }
  8957. changePrototype(to, from);
  8958. changeToString(to, from, name);
  8959. return to;
  8960. };
  8961. module2.exports = mimicFn;
  8962. }
  8963. });
  8964. // ../node_modules/.pnpm/p-defer@1.0.0/node_modules/p-defer/index.js
  8965. var require_p_defer = __commonJS({
  8966. "../node_modules/.pnpm/p-defer@1.0.0/node_modules/p-defer/index.js"(exports2, module2) {
  8967. "use strict";
  8968. module2.exports = () => {
  8969. const ret = {};
  8970. ret.promise = new Promise((resolve, reject) => {
  8971. ret.resolve = resolve;
  8972. ret.reject = reject;
  8973. });
  8974. return ret;
  8975. };
  8976. }
  8977. });
  8978. // ../node_modules/.pnpm/map-age-cleaner@0.1.3/node_modules/map-age-cleaner/dist/index.js
  8979. var require_dist = __commonJS({
  8980. "../node_modules/.pnpm/map-age-cleaner@0.1.3/node_modules/map-age-cleaner/dist/index.js"(exports2, module2) {
  8981. "use strict";
  8982. var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  8983. return new (P || (P = Promise))(function(resolve, reject) {
  8984. function fulfilled(value) {
  8985. try {
  8986. step(generator.next(value));
  8987. } catch (e) {
  8988. reject(e);
  8989. }
  8990. }
  8991. function rejected(value) {
  8992. try {
  8993. step(generator["throw"](value));
  8994. } catch (e) {
  8995. reject(e);
  8996. }
  8997. }
  8998. function step(result) {
  8999. result.done ? resolve(result.value) : new P(function(resolve2) {
  9000. resolve2(result.value);
  9001. }).then(fulfilled, rejected);
  9002. }
  9003. step((generator = generator.apply(thisArg, _arguments || [])).next());
  9004. });
  9005. };
  9006. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  9007. return mod && mod.__esModule ? mod : { "default": mod };
  9008. };
  9009. Object.defineProperty(exports2, "__esModule", { value: true });
  9010. var p_defer_1 = __importDefault2(require_p_defer());
  9011. function mapAgeCleaner(map, property = "maxAge") {
  9012. let processingKey;
  9013. let processingTimer;
  9014. let processingDeferred;
  9015. const cleanup = () => __awaiter(this, void 0, void 0, function* () {
  9016. if (processingKey !== void 0) {
  9017. return;
  9018. }
  9019. const setupTimer = (item) => __awaiter(this, void 0, void 0, function* () {
  9020. processingDeferred = p_defer_1.default();
  9021. const delay = item[1][property] - Date.now();
  9022. if (delay <= 0) {
  9023. map.delete(item[0]);
  9024. processingDeferred.resolve();
  9025. return;
  9026. }
  9027. processingKey = item[0];
  9028. processingTimer = setTimeout(() => {
  9029. map.delete(item[0]);
  9030. if (processingDeferred) {
  9031. processingDeferred.resolve();
  9032. }
  9033. }, delay);
  9034. if (typeof processingTimer.unref === "function") {
  9035. processingTimer.unref();
  9036. }
  9037. return processingDeferred.promise;
  9038. });
  9039. try {
  9040. for (const entry of map) {
  9041. yield setupTimer(entry);
  9042. }
  9043. } catch (_a) {
  9044. }
  9045. processingKey = void 0;
  9046. });
  9047. const reset = () => {
  9048. processingKey = void 0;
  9049. if (processingTimer !== void 0) {
  9050. clearTimeout(processingTimer);
  9051. processingTimer = void 0;
  9052. }
  9053. if (processingDeferred !== void 0) {
  9054. processingDeferred.reject(void 0);
  9055. processingDeferred = void 0;
  9056. }
  9057. };
  9058. const originalSet = map.set.bind(map);
  9059. map.set = (key, value) => {
  9060. if (map.has(key)) {
  9061. map.delete(key);
  9062. }
  9063. const result = originalSet(key, value);
  9064. if (processingKey && processingKey === key) {
  9065. reset();
  9066. }
  9067. cleanup();
  9068. return result;
  9069. };
  9070. cleanup();
  9071. return map;
  9072. }
  9073. exports2.default = mapAgeCleaner;
  9074. module2.exports = mapAgeCleaner;
  9075. module2.exports.default = mapAgeCleaner;
  9076. }
  9077. });
  9078. // ../node_modules/.pnpm/mem@8.1.1/node_modules/mem/dist/index.js
  9079. var require_dist2 = __commonJS({
  9080. "../node_modules/.pnpm/mem@8.1.1/node_modules/mem/dist/index.js"(exports2, module2) {
  9081. "use strict";
  9082. var mimicFn = require_mimic_fn();
  9083. var mapAgeCleaner = require_dist();
  9084. var decoratorInstanceMap = /* @__PURE__ */ new WeakMap();
  9085. var cacheStore = /* @__PURE__ */ new WeakMap();
  9086. var mem = (fn, { cacheKey, cache = /* @__PURE__ */ new Map(), maxAge } = {}) => {
  9087. if (typeof maxAge === "number") {
  9088. mapAgeCleaner(cache);
  9089. }
  9090. const memoized = function(...arguments_) {
  9091. const key = cacheKey ? cacheKey(arguments_) : arguments_[0];
  9092. const cacheItem = cache.get(key);
  9093. if (cacheItem) {
  9094. return cacheItem.data;
  9095. }
  9096. const result = fn.apply(this, arguments_);
  9097. cache.set(key, {
  9098. data: result,
  9099. maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY
  9100. });
  9101. return result;
  9102. };
  9103. mimicFn(memoized, fn, {
  9104. ignoreNonConfigurable: true
  9105. });
  9106. cacheStore.set(memoized, cache);
  9107. return memoized;
  9108. };
  9109. mem.decorator = (options = {}) => (target, propertyKey, descriptor) => {
  9110. const input = target[propertyKey];
  9111. if (typeof input !== "function") {
  9112. throw new TypeError("The decorated value must be a function");
  9113. }
  9114. delete descriptor.value;
  9115. delete descriptor.writable;
  9116. descriptor.get = function() {
  9117. if (!decoratorInstanceMap.has(this)) {
  9118. const value = mem(input, options);
  9119. decoratorInstanceMap.set(this, value);
  9120. return value;
  9121. }
  9122. return decoratorInstanceMap.get(this);
  9123. };
  9124. };
  9125. mem.clear = (fn) => {
  9126. const cache = cacheStore.get(fn);
  9127. if (!cache) {
  9128. throw new TypeError("Can't clear a function that was not memoized!");
  9129. }
  9130. if (typeof cache.clear !== "function") {
  9131. throw new TypeError("The cache Map can't be cleared!");
  9132. }
  9133. cache.clear();
  9134. };
  9135. module2.exports = mem;
  9136. }
  9137. });
  9138. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isPlaceholder.js
  9139. var require_isPlaceholder = __commonJS({
  9140. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isPlaceholder.js"(exports2, module2) {
  9141. function _isPlaceholder(a) {
  9142. return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
  9143. }
  9144. module2.exports = _isPlaceholder;
  9145. }
  9146. });
  9147. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_curry1.js
  9148. var require_curry1 = __commonJS({
  9149. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_curry1.js"(exports2, module2) {
  9150. var _isPlaceholder = require_isPlaceholder();
  9151. function _curry1(fn) {
  9152. return function f1(a) {
  9153. if (arguments.length === 0 || _isPlaceholder(a)) {
  9154. return f1;
  9155. } else {
  9156. return fn.apply(this, arguments);
  9157. }
  9158. };
  9159. }
  9160. module2.exports = _curry1;
  9161. }
  9162. });
  9163. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_curry2.js
  9164. var require_curry2 = __commonJS({
  9165. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_curry2.js"(exports2, module2) {
  9166. var _curry1 = require_curry1();
  9167. var _isPlaceholder = require_isPlaceholder();
  9168. function _curry2(fn) {
  9169. return function f2(a, b) {
  9170. switch (arguments.length) {
  9171. case 0:
  9172. return f2;
  9173. case 1:
  9174. return _isPlaceholder(a) ? f2 : _curry1(function(_b) {
  9175. return fn(a, _b);
  9176. });
  9177. default:
  9178. return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function(_a) {
  9179. return fn(_a, b);
  9180. }) : _isPlaceholder(b) ? _curry1(function(_b) {
  9181. return fn(a, _b);
  9182. }) : fn(a, b);
  9183. }
  9184. };
  9185. }
  9186. module2.exports = _curry2;
  9187. }
  9188. });
  9189. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isArray.js
  9190. var require_isArray = __commonJS({
  9191. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isArray.js"(exports2, module2) {
  9192. module2.exports = Array.isArray || function _isArray(val) {
  9193. return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
  9194. };
  9195. }
  9196. });
  9197. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isTransformer.js
  9198. var require_isTransformer = __commonJS({
  9199. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isTransformer.js"(exports2, module2) {
  9200. function _isTransformer(obj) {
  9201. return obj != null && typeof obj["@@transducer/step"] === "function";
  9202. }
  9203. module2.exports = _isTransformer;
  9204. }
  9205. });
  9206. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_dispatchable.js
  9207. var require_dispatchable = __commonJS({
  9208. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_dispatchable.js"(exports2, module2) {
  9209. var _isArray = require_isArray();
  9210. var _isTransformer = require_isTransformer();
  9211. function _dispatchable(methodNames, transducerCreator, fn) {
  9212. return function() {
  9213. if (arguments.length === 0) {
  9214. return fn();
  9215. }
  9216. var obj = arguments[arguments.length - 1];
  9217. if (!_isArray(obj)) {
  9218. var idx = 0;
  9219. while (idx < methodNames.length) {
  9220. if (typeof obj[methodNames[idx]] === "function") {
  9221. return obj[methodNames[idx]].apply(obj, Array.prototype.slice.call(arguments, 0, -1));
  9222. }
  9223. idx += 1;
  9224. }
  9225. if (_isTransformer(obj)) {
  9226. var transducer = transducerCreator.apply(null, Array.prototype.slice.call(arguments, 0, -1));
  9227. return transducer(obj);
  9228. }
  9229. }
  9230. return fn.apply(this, arguments);
  9231. };
  9232. }
  9233. module2.exports = _dispatchable;
  9234. }
  9235. });
  9236. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_map.js
  9237. var require_map = __commonJS({
  9238. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_map.js"(exports2, module2) {
  9239. function _map(fn, functor) {
  9240. var idx = 0;
  9241. var len = functor.length;
  9242. var result = Array(len);
  9243. while (idx < len) {
  9244. result[idx] = fn(functor[idx]);
  9245. idx += 1;
  9246. }
  9247. return result;
  9248. }
  9249. module2.exports = _map;
  9250. }
  9251. });
  9252. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isString.js
  9253. var require_isString = __commonJS({
  9254. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isString.js"(exports2, module2) {
  9255. function _isString(x) {
  9256. return Object.prototype.toString.call(x) === "[object String]";
  9257. }
  9258. module2.exports = _isString;
  9259. }
  9260. });
  9261. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isArrayLike.js
  9262. var require_isArrayLike = __commonJS({
  9263. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isArrayLike.js"(exports2, module2) {
  9264. var _curry1 = require_curry1();
  9265. var _isArray = require_isArray();
  9266. var _isString = require_isString();
  9267. var _isArrayLike = /* @__PURE__ */ _curry1(function isArrayLike(x) {
  9268. if (_isArray(x)) {
  9269. return true;
  9270. }
  9271. if (!x) {
  9272. return false;
  9273. }
  9274. if (typeof x !== "object") {
  9275. return false;
  9276. }
  9277. if (_isString(x)) {
  9278. return false;
  9279. }
  9280. if (x.length === 0) {
  9281. return true;
  9282. }
  9283. if (x.length > 0) {
  9284. return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
  9285. }
  9286. return false;
  9287. });
  9288. module2.exports = _isArrayLike;
  9289. }
  9290. });
  9291. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_xwrap.js
  9292. var require_xwrap = __commonJS({
  9293. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_xwrap.js"(exports2, module2) {
  9294. var XWrap = /* @__PURE__ */ function() {
  9295. function XWrap2(fn) {
  9296. this.f = fn;
  9297. }
  9298. XWrap2.prototype["@@transducer/init"] = function() {
  9299. throw new Error("init not implemented on XWrap");
  9300. };
  9301. XWrap2.prototype["@@transducer/result"] = function(acc) {
  9302. return acc;
  9303. };
  9304. XWrap2.prototype["@@transducer/step"] = function(acc, x) {
  9305. return this.f(acc, x);
  9306. };
  9307. return XWrap2;
  9308. }();
  9309. function _xwrap(fn) {
  9310. return new XWrap(fn);
  9311. }
  9312. module2.exports = _xwrap;
  9313. }
  9314. });
  9315. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_arity.js
  9316. var require_arity = __commonJS({
  9317. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_arity.js"(exports2, module2) {
  9318. function _arity(n, fn) {
  9319. switch (n) {
  9320. case 0:
  9321. return function() {
  9322. return fn.apply(this, arguments);
  9323. };
  9324. case 1:
  9325. return function(a0) {
  9326. return fn.apply(this, arguments);
  9327. };
  9328. case 2:
  9329. return function(a0, a1) {
  9330. return fn.apply(this, arguments);
  9331. };
  9332. case 3:
  9333. return function(a0, a1, a2) {
  9334. return fn.apply(this, arguments);
  9335. };
  9336. case 4:
  9337. return function(a0, a1, a2, a3) {
  9338. return fn.apply(this, arguments);
  9339. };
  9340. case 5:
  9341. return function(a0, a1, a2, a3, a4) {
  9342. return fn.apply(this, arguments);
  9343. };
  9344. case 6:
  9345. return function(a0, a1, a2, a3, a4, a5) {
  9346. return fn.apply(this, arguments);
  9347. };
  9348. case 7:
  9349. return function(a0, a1, a2, a3, a4, a5, a6) {
  9350. return fn.apply(this, arguments);
  9351. };
  9352. case 8:
  9353. return function(a0, a1, a2, a3, a4, a5, a6, a7) {
  9354. return fn.apply(this, arguments);
  9355. };
  9356. case 9:
  9357. return function(a0, a1, a2, a3, a4, a5, a6, a7, a8) {
  9358. return fn.apply(this, arguments);
  9359. };
  9360. case 10:
  9361. return function(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
  9362. return fn.apply(this, arguments);
  9363. };
  9364. default:
  9365. throw new Error("First argument to _arity must be a non-negative integer no greater than ten");
  9366. }
  9367. }
  9368. module2.exports = _arity;
  9369. }
  9370. });
  9371. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/bind.js
  9372. var require_bind = __commonJS({
  9373. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/bind.js"(exports2, module2) {
  9374. var _arity = require_arity();
  9375. var _curry2 = require_curry2();
  9376. var bind = /* @__PURE__ */ _curry2(function bind2(fn, thisObj) {
  9377. return _arity(fn.length, function() {
  9378. return fn.apply(thisObj, arguments);
  9379. });
  9380. });
  9381. module2.exports = bind;
  9382. }
  9383. });
  9384. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_reduce.js
  9385. var require_reduce = __commonJS({
  9386. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_reduce.js"(exports2, module2) {
  9387. var _isArrayLike = require_isArrayLike();
  9388. var _xwrap = require_xwrap();
  9389. var bind = require_bind();
  9390. function _arrayReduce(xf, acc, list) {
  9391. var idx = 0;
  9392. var len = list.length;
  9393. while (idx < len) {
  9394. acc = xf["@@transducer/step"](acc, list[idx]);
  9395. if (acc && acc["@@transducer/reduced"]) {
  9396. acc = acc["@@transducer/value"];
  9397. break;
  9398. }
  9399. idx += 1;
  9400. }
  9401. return xf["@@transducer/result"](acc);
  9402. }
  9403. function _iterableReduce(xf, acc, iter) {
  9404. var step = iter.next();
  9405. while (!step.done) {
  9406. acc = xf["@@transducer/step"](acc, step.value);
  9407. if (acc && acc["@@transducer/reduced"]) {
  9408. acc = acc["@@transducer/value"];
  9409. break;
  9410. }
  9411. step = iter.next();
  9412. }
  9413. return xf["@@transducer/result"](acc);
  9414. }
  9415. function _methodReduce(xf, acc, obj, methodName) {
  9416. return xf["@@transducer/result"](obj[methodName](bind(xf["@@transducer/step"], xf), acc));
  9417. }
  9418. var symIterator = typeof Symbol !== "undefined" ? Symbol.iterator : "@@iterator";
  9419. function _reduce(fn, acc, list) {
  9420. if (typeof fn === "function") {
  9421. fn = _xwrap(fn);
  9422. }
  9423. if (_isArrayLike(list)) {
  9424. return _arrayReduce(fn, acc, list);
  9425. }
  9426. if (typeof list["fantasy-land/reduce"] === "function") {
  9427. return _methodReduce(fn, acc, list, "fantasy-land/reduce");
  9428. }
  9429. if (list[symIterator] != null) {
  9430. return _iterableReduce(fn, acc, list[symIterator]());
  9431. }
  9432. if (typeof list.next === "function") {
  9433. return _iterableReduce(fn, acc, list);
  9434. }
  9435. if (typeof list.reduce === "function") {
  9436. return _methodReduce(fn, acc, list, "reduce");
  9437. }
  9438. throw new TypeError("reduce: list must be array or iterable");
  9439. }
  9440. module2.exports = _reduce;
  9441. }
  9442. });
  9443. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_xfBase.js
  9444. var require_xfBase = __commonJS({
  9445. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_xfBase.js"(exports2, module2) {
  9446. module2.exports = {
  9447. init: function() {
  9448. return this.xf["@@transducer/init"]();
  9449. },
  9450. result: function(result) {
  9451. return this.xf["@@transducer/result"](result);
  9452. }
  9453. };
  9454. }
  9455. });
  9456. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_xmap.js
  9457. var require_xmap = __commonJS({
  9458. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_xmap.js"(exports2, module2) {
  9459. var _curry2 = require_curry2();
  9460. var _xfBase = require_xfBase();
  9461. var XMap = /* @__PURE__ */ function() {
  9462. function XMap2(f, xf) {
  9463. this.xf = xf;
  9464. this.f = f;
  9465. }
  9466. XMap2.prototype["@@transducer/init"] = _xfBase.init;
  9467. XMap2.prototype["@@transducer/result"] = _xfBase.result;
  9468. XMap2.prototype["@@transducer/step"] = function(result, input) {
  9469. return this.xf["@@transducer/step"](result, this.f(input));
  9470. };
  9471. return XMap2;
  9472. }();
  9473. var _xmap = /* @__PURE__ */ _curry2(function _xmap2(f, xf) {
  9474. return new XMap(f, xf);
  9475. });
  9476. module2.exports = _xmap;
  9477. }
  9478. });
  9479. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_curryN.js
  9480. var require_curryN = __commonJS({
  9481. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_curryN.js"(exports2, module2) {
  9482. var _arity = require_arity();
  9483. var _isPlaceholder = require_isPlaceholder();
  9484. function _curryN(length, received, fn) {
  9485. return function() {
  9486. var combined = [];
  9487. var argsIdx = 0;
  9488. var left = length;
  9489. var combinedIdx = 0;
  9490. while (combinedIdx < received.length || argsIdx < arguments.length) {
  9491. var result;
  9492. if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
  9493. result = received[combinedIdx];
  9494. } else {
  9495. result = arguments[argsIdx];
  9496. argsIdx += 1;
  9497. }
  9498. combined[combinedIdx] = result;
  9499. if (!_isPlaceholder(result)) {
  9500. left -= 1;
  9501. }
  9502. combinedIdx += 1;
  9503. }
  9504. return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
  9505. };
  9506. }
  9507. module2.exports = _curryN;
  9508. }
  9509. });
  9510. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/curryN.js
  9511. var require_curryN2 = __commonJS({
  9512. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/curryN.js"(exports2, module2) {
  9513. var _arity = require_arity();
  9514. var _curry1 = require_curry1();
  9515. var _curry2 = require_curry2();
  9516. var _curryN = require_curryN();
  9517. var curryN = /* @__PURE__ */ _curry2(function curryN2(length, fn) {
  9518. if (length === 1) {
  9519. return _curry1(fn);
  9520. }
  9521. return _arity(length, _curryN(length, [], fn));
  9522. });
  9523. module2.exports = curryN;
  9524. }
  9525. });
  9526. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_has.js
  9527. var require_has = __commonJS({
  9528. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_has.js"(exports2, module2) {
  9529. function _has(prop, obj) {
  9530. return Object.prototype.hasOwnProperty.call(obj, prop);
  9531. }
  9532. module2.exports = _has;
  9533. }
  9534. });
  9535. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isArguments.js
  9536. var require_isArguments = __commonJS({
  9537. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/internal/_isArguments.js"(exports2, module2) {
  9538. var _has = require_has();
  9539. var toString = Object.prototype.toString;
  9540. var _isArguments = /* @__PURE__ */ function() {
  9541. return toString.call(arguments) === "[object Arguments]" ? function _isArguments2(x) {
  9542. return toString.call(x) === "[object Arguments]";
  9543. } : function _isArguments2(x) {
  9544. return _has("callee", x);
  9545. };
  9546. }();
  9547. module2.exports = _isArguments;
  9548. }
  9549. });
  9550. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/keys.js
  9551. var require_keys = __commonJS({
  9552. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/keys.js"(exports2, module2) {
  9553. var _curry1 = require_curry1();
  9554. var _has = require_has();
  9555. var _isArguments = require_isArguments();
  9556. var hasEnumBug = !/* @__PURE__ */ {
  9557. toString: null
  9558. }.propertyIsEnumerable("toString");
  9559. var nonEnumerableProps = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"];
  9560. var hasArgsEnumBug = /* @__PURE__ */ function() {
  9561. "use strict";
  9562. return arguments.propertyIsEnumerable("length");
  9563. }();
  9564. var contains = function contains2(list, item) {
  9565. var idx = 0;
  9566. while (idx < list.length) {
  9567. if (list[idx] === item) {
  9568. return true;
  9569. }
  9570. idx += 1;
  9571. }
  9572. return false;
  9573. };
  9574. var keys = typeof Object.keys === "function" && !hasArgsEnumBug ? /* @__PURE__ */ _curry1(function keys2(obj) {
  9575. return Object(obj) !== obj ? [] : Object.keys(obj);
  9576. }) : /* @__PURE__ */ _curry1(function keys2(obj) {
  9577. if (Object(obj) !== obj) {
  9578. return [];
  9579. }
  9580. var prop, nIdx;
  9581. var ks = [];
  9582. var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
  9583. for (prop in obj) {
  9584. if (_has(prop, obj) && (!checkArgsLength || prop !== "length")) {
  9585. ks[ks.length] = prop;
  9586. }
  9587. }
  9588. if (hasEnumBug) {
  9589. nIdx = nonEnumerableProps.length - 1;
  9590. while (nIdx >= 0) {
  9591. prop = nonEnumerableProps[nIdx];
  9592. if (_has(prop, obj) && !contains(ks, prop)) {
  9593. ks[ks.length] = prop;
  9594. }
  9595. nIdx -= 1;
  9596. }
  9597. }
  9598. return ks;
  9599. });
  9600. module2.exports = keys;
  9601. }
  9602. });
  9603. // ../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/map.js
  9604. var require_map2 = __commonJS({
  9605. "../node_modules/.pnpm/@pnpm+ramda@0.28.1/node_modules/@pnpm/ramda/src/map.js"(exports2, module2) {
  9606. var _curry2 = require_curry2();
  9607. var _dispatchable = require_dispatchable();
  9608. var _map = require_map();
  9609. var _reduce = require_reduce();
  9610. var _xmap = require_xmap();
  9611. var curryN = require_curryN2();
  9612. var keys = require_keys();
  9613. var map = /* @__PURE__ */ _curry2(
  9614. /* @__PURE__ */ _dispatchable(["fantasy-land/map", "map"], _xmap, function map2(fn, functor) {
  9615. switch (Object.prototype.toString.call(functor)) {
  9616. case "[object Function]":
  9617. return curryN(functor.length, function() {
  9618. return fn.call(this, functor.apply(this, arguments));
  9619. });
  9620. case "[object Object]":
  9621. return _reduce(function(acc, key) {
  9622. acc[key] = fn(functor[key]);
  9623. return acc;
  9624. }, {}, keys(functor));
  9625. default:
  9626. return _map(fn, functor);
  9627. }
  9628. })
  9629. );
  9630. module2.exports = map;
  9631. }
  9632. });
  9633. // ../store/create-cafs-store/lib/index.js
  9634. var require_lib8 = __commonJS({
  9635. "../store/create-cafs-store/lib/index.js"(exports2) {
  9636. "use strict";
  9637. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  9638. return mod && mod.__esModule ? mod : { "default": mod };
  9639. };
  9640. Object.defineProperty(exports2, "__esModule", { value: true });
  9641. exports2.createPackageImporterAsync = createPackageImporterAsync;
  9642. exports2.createCafsStore = createCafsStore;
  9643. var fs_12 = require("fs");
  9644. var path_12 = __importDefault2(require("path"));
  9645. var store_cafs_12 = require_lib4();
  9646. var fs_indexed_pkg_importer_1 = require_lib7();
  9647. var mem_1 = __importDefault2(require_dist2());
  9648. var path_temp_1 = __importDefault2(require_path_temp());
  9649. var map_1 = __importDefault2(require_map2());
  9650. function createPackageImporterAsync(opts) {
  9651. const cachedImporterCreator = opts.importIndexedPackage ? () => opts.importIndexedPackage : (0, mem_1.default)(fs_indexed_pkg_importer_1.createIndexedPkgImporter);
  9652. const packageImportMethod = opts.packageImportMethod;
  9653. const gfm = getFlatMap.bind(null, opts.storeDir);
  9654. return async (to, opts2) => {
  9655. const { filesMap, isBuilt } = gfm(opts2.filesResponse, opts2.sideEffectsCacheKey);
  9656. const willBeBuilt = !isBuilt && opts2.requiresBuild;
  9657. const pkgImportMethod = willBeBuilt ? "clone-or-copy" : opts2.filesResponse.packageImportMethod ?? packageImportMethod;
  9658. const impPkg = cachedImporterCreator(pkgImportMethod);
  9659. const importMethod = await impPkg(to, {
  9660. disableRelinkLocalDirDeps: opts2.disableRelinkLocalDirDeps,
  9661. filesMap,
  9662. resolvedFrom: opts2.filesResponse.resolvedFrom,
  9663. force: opts2.force,
  9664. keepModulesDir: Boolean(opts2.keepModulesDir)
  9665. });
  9666. return { importMethod, isBuilt };
  9667. };
  9668. }
  9669. function createPackageImporter(opts) {
  9670. const cachedImporterCreator = opts.importIndexedPackage ? () => opts.importIndexedPackage : (0, mem_1.default)(fs_indexed_pkg_importer_1.createIndexedPkgImporter);
  9671. const packageImportMethod = opts.packageImportMethod;
  9672. const gfm = getFlatMap.bind(null, opts.storeDir);
  9673. return (to, opts2) => {
  9674. const { filesMap, isBuilt } = gfm(opts2.filesResponse, opts2.sideEffectsCacheKey);
  9675. const willBeBuilt = !isBuilt && opts2.requiresBuild;
  9676. const pkgImportMethod = willBeBuilt ? "clone-or-copy" : opts2.filesResponse.packageImportMethod ?? packageImportMethod;
  9677. const impPkg = cachedImporterCreator(pkgImportMethod);
  9678. const importMethod = impPkg(to, {
  9679. disableRelinkLocalDirDeps: opts2.disableRelinkLocalDirDeps,
  9680. filesMap,
  9681. resolvedFrom: opts2.filesResponse.resolvedFrom,
  9682. force: opts2.force,
  9683. keepModulesDir: Boolean(opts2.keepModulesDir)
  9684. });
  9685. return { importMethod, isBuilt };
  9686. };
  9687. }
  9688. function getFlatMap(storeDir, filesResponse, targetEngine) {
  9689. let isBuilt;
  9690. let filesIndex;
  9691. if (targetEngine && filesResponse.sideEffects?.[targetEngine] != null) {
  9692. filesIndex = applySideEffectsDiff(filesResponse.filesIndex, filesResponse.sideEffects?.[targetEngine]);
  9693. isBuilt = true;
  9694. } else if (!filesResponse.unprocessed) {
  9695. return {
  9696. filesMap: filesResponse.filesIndex,
  9697. isBuilt: false
  9698. };
  9699. } else {
  9700. filesIndex = filesResponse.filesIndex;
  9701. isBuilt = false;
  9702. }
  9703. const filesMap = (0, map_1.default)(({ integrity, mode }) => (0, store_cafs_12.getFilePathByModeInCafs)(storeDir, integrity, mode), filesIndex);
  9704. return { filesMap, isBuilt };
  9705. }
  9706. function applySideEffectsDiff(baseFiles, { added, deleted }) {
  9707. const filesWithSideEffects = { ...added };
  9708. for (const fileName in baseFiles) {
  9709. if (!deleted?.includes(fileName) && !filesWithSideEffects[fileName]) {
  9710. filesWithSideEffects[fileName] = baseFiles[fileName];
  9711. }
  9712. }
  9713. return filesWithSideEffects;
  9714. }
  9715. function createCafsStore(storeDir, opts) {
  9716. const baseTempDir = path_12.default.join(storeDir, "tmp");
  9717. const importPackage2 = createPackageImporter({
  9718. importIndexedPackage: opts?.importPackage,
  9719. packageImportMethod: opts?.packageImportMethod,
  9720. storeDir
  9721. });
  9722. return {
  9723. ...(0, store_cafs_12.createCafs)(storeDir, opts),
  9724. storeDir,
  9725. importPackage: importPackage2,
  9726. tempDir: async () => {
  9727. const tmpDir = (0, path_temp_1.default)(baseTempDir);
  9728. await fs_12.promises.mkdir(tmpDir, { recursive: true });
  9729. return tmpDir;
  9730. }
  9731. };
  9732. }
  9733. }
  9734. });
  9735. // ../crypto/polyfill/lib/index.js
  9736. var require_lib9 = __commonJS({
  9737. "../crypto/polyfill/lib/index.js"(exports2) {
  9738. "use strict";
  9739. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  9740. return mod && mod.__esModule ? mod : { "default": mod };
  9741. };
  9742. Object.defineProperty(exports2, "__esModule", { value: true });
  9743. exports2.hash = void 0;
  9744. var crypto_1 = __importDefault2(require("crypto"));
  9745. exports2.hash = // @ts-expect-error -- crypto.hash is supported in Node 21.7.0+, 20.12.0+
  9746. crypto_1.default.hash ?? ((algorithm, data, outputEncoding) => crypto_1.default.createHash(algorithm).update(data).digest(outputEncoding));
  9747. }
  9748. });
  9749. // ../exec/pkg-requires-build/lib/index.js
  9750. var require_lib10 = __commonJS({
  9751. "../exec/pkg-requires-build/lib/index.js"(exports2) {
  9752. "use strict";
  9753. Object.defineProperty(exports2, "__esModule", { value: true });
  9754. exports2.pkgRequiresBuild = pkgRequiresBuild;
  9755. function pkgRequiresBuild(manifest, filesIndex) {
  9756. return Boolean(manifest?.scripts != null && (Boolean(manifest.scripts.preinstall) || Boolean(manifest.scripts.install) || Boolean(manifest.scripts.postinstall)) || filesIncludeInstallScripts(filesIndex));
  9757. }
  9758. function filesIncludeInstallScripts(filesIndex) {
  9759. return filesIndex["binding.gyp"] != null || Object.keys(filesIndex).some((filename) => !(filename.match(/^\.hooks[\\/]/) == null));
  9760. }
  9761. }
  9762. });
  9763. // ../fs/hard-link-dir/lib/index.js
  9764. var require_lib11 = __commonJS({
  9765. "../fs/hard-link-dir/lib/index.js"(exports2) {
  9766. "use strict";
  9767. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  9768. return mod && mod.__esModule ? mod : { "default": mod };
  9769. };
  9770. Object.defineProperty(exports2, "__esModule", { value: true });
  9771. exports2.hardLinkDir = hardLinkDir;
  9772. var assert_1 = __importDefault2(require("assert"));
  9773. var path_12 = __importDefault2(require("path"));
  9774. var util_1 = __importDefault2(require("util"));
  9775. var fs_12 = __importDefault2(require("fs"));
  9776. var logger_1 = require_lib5();
  9777. function hardLinkDir(src, destDirs) {
  9778. if (destDirs.length === 0)
  9779. return;
  9780. destDirs = destDirs.filter((destDir) => path_12.default.relative(destDir, src) !== "");
  9781. _hardLinkDir(src, destDirs, true);
  9782. }
  9783. function _hardLinkDir(src, destDirs, isRoot) {
  9784. let files = [];
  9785. try {
  9786. files = fs_12.default.readdirSync(src);
  9787. } catch (err) {
  9788. if (!isRoot || !(util_1.default.types.isNativeError(err) && "code" in err && err.code === "ENOENT"))
  9789. throw err;
  9790. (0, logger_1.globalWarn)(`Source directory not found when creating hardLinks for: ${src}. Creating destinations as empty: ${destDirs.join(", ")}`);
  9791. for (const dir of destDirs) {
  9792. fs_12.default.mkdirSync(dir, { recursive: true });
  9793. }
  9794. return;
  9795. }
  9796. for (const file of files) {
  9797. if (file === "node_modules")
  9798. continue;
  9799. const srcFile = path_12.default.join(src, file);
  9800. if (fs_12.default.lstatSync(srcFile).isDirectory()) {
  9801. const destSubdirs = destDirs.map((destDir) => {
  9802. const destSubdir = path_12.default.join(destDir, file);
  9803. try {
  9804. fs_12.default.mkdirSync(destSubdir, { recursive: true });
  9805. } catch (err) {
  9806. if (!(util_1.default.types.isNativeError(err) && "code" in err && err.code === "EEXIST"))
  9807. throw err;
  9808. }
  9809. return destSubdir;
  9810. });
  9811. _hardLinkDir(srcFile, destSubdirs);
  9812. continue;
  9813. }
  9814. for (const destDir of destDirs) {
  9815. const destFile = path_12.default.join(destDir, file);
  9816. try {
  9817. linkOrCopyFile(srcFile, destFile);
  9818. } catch (err) {
  9819. if (util_1.default.types.isNativeError(err) && "code" in err && err.code === "ENOENT") {
  9820. continue;
  9821. }
  9822. throw err;
  9823. }
  9824. }
  9825. }
  9826. }
  9827. function linkOrCopyFile(srcFile, destFile) {
  9828. try {
  9829. linkOrCopy(srcFile, destFile);
  9830. } catch (err) {
  9831. (0, assert_1.default)(util_1.default.types.isNativeError(err));
  9832. if ("code" in err && err.code === "ENOENT") {
  9833. fs_12.default.mkdirSync(path_12.default.dirname(destFile), { recursive: true });
  9834. linkOrCopy(srcFile, destFile);
  9835. return;
  9836. }
  9837. if (!("code" in err && err.code === "EEXIST")) {
  9838. throw err;
  9839. }
  9840. }
  9841. }
  9842. function linkOrCopy(srcFile, destFile) {
  9843. try {
  9844. fs_12.default.linkSync(srcFile, destFile);
  9845. } catch (err) {
  9846. if (!(util_1.default.types.isNativeError(err) && "code" in err && err.code === "EXDEV"))
  9847. throw err;
  9848. fs_12.default.copyFileSync(srcFile, destFile);
  9849. }
  9850. }
  9851. }
  9852. });
  9853. // ../node_modules/.pnpm/is-windows@1.0.2/node_modules/is-windows/index.js
  9854. var require_is_windows = __commonJS({
  9855. "../node_modules/.pnpm/is-windows@1.0.2/node_modules/is-windows/index.js"(exports2, module2) {
  9856. (function(factory) {
  9857. if (exports2 && typeof exports2 === "object" && typeof module2 !== "undefined") {
  9858. module2.exports = factory();
  9859. } else if (typeof define === "function" && define.amd) {
  9860. define([], factory);
  9861. } else if (typeof window !== "undefined") {
  9862. window.isWindows = factory();
  9863. } else if (typeof global !== "undefined") {
  9864. global.isWindows = factory();
  9865. } else if (typeof self !== "undefined") {
  9866. self.isWindows = factory();
  9867. } else {
  9868. this.isWindows = factory();
  9869. }
  9870. })(function() {
  9871. "use strict";
  9872. return function isWindows() {
  9873. return process && (process.platform === "win32" || /^(msys|cygwin)$/.test(process.env.OSTYPE));
  9874. };
  9875. });
  9876. }
  9877. });
  9878. // ../node_modules/.pnpm/better-path-resolve@1.0.0/node_modules/better-path-resolve/index.js
  9879. var require_better_path_resolve = __commonJS({
  9880. "../node_modules/.pnpm/better-path-resolve@1.0.0/node_modules/better-path-resolve/index.js"(exports2, module2) {
  9881. "use strict";
  9882. var path = require("path");
  9883. var isWindows = require_is_windows();
  9884. module2.exports = isWindows() ? winResolve : path.resolve;
  9885. function winResolve(p) {
  9886. if (arguments.length === 0) return path.resolve();
  9887. if (typeof p !== "string") {
  9888. return path.resolve(p);
  9889. }
  9890. if (p[1] === ":") {
  9891. const cc = p[0].charCodeAt();
  9892. if (cc < 65 || cc > 90) {
  9893. p = `${p[0].toUpperCase()}${p.substr(1)}`;
  9894. }
  9895. }
  9896. if (p.endsWith(":")) {
  9897. return p;
  9898. }
  9899. return path.resolve(p);
  9900. }
  9901. }
  9902. });
  9903. // ../node_modules/.pnpm/symlink-dir@6.0.5/node_modules/symlink-dir/dist/index.js
  9904. var require_dist3 = __commonJS({
  9905. "../node_modules/.pnpm/symlink-dir@6.0.5/node_modules/symlink-dir/dist/index.js"(exports2, module2) {
  9906. "use strict";
  9907. var betterPathResolve = require_better_path_resolve();
  9908. var fs_12 = require("fs");
  9909. var util = require("util");
  9910. var pathLib = require("path");
  9911. var renameOverwrite = require_rename_overwrite();
  9912. var IS_WINDOWS = process.platform === "win32" || /^(msys|cygwin)$/.test(process.env.OSTYPE);
  9913. var symlinkType = IS_WINDOWS ? "junction" : "dir";
  9914. var resolveSrc = IS_WINDOWS ? resolveSrcOnWin : resolveSrcOnNonWin;
  9915. function resolveSrcOnWin(src, dest) {
  9916. return `${src}\\`;
  9917. }
  9918. function resolveSrcOnNonWin(src, dest) {
  9919. return pathLib.relative(pathLib.dirname(dest), src);
  9920. }
  9921. function symlinkDir(target, path, opts) {
  9922. path = betterPathResolve(path);
  9923. target = betterPathResolve(target);
  9924. if (target === path)
  9925. throw new Error(`Symlink path is the same as the target path (${target})`);
  9926. target = resolveSrc(target, path);
  9927. return forceSymlink(target, path, opts);
  9928. }
  9929. async function forceSymlink(target, path, opts) {
  9930. let initialErr;
  9931. try {
  9932. await fs_12.promises.symlink(target, path, symlinkType);
  9933. return { reused: false };
  9934. } catch (err) {
  9935. switch (err.code) {
  9936. case "ENOENT":
  9937. try {
  9938. await fs_12.promises.mkdir(pathLib.dirname(path), { recursive: true });
  9939. } catch (mkdirError) {
  9940. mkdirError.message = `Error while trying to symlink "${target}" to "${path}". The error happened while trying to create the parent directory for the symlink target. Details: ${mkdirError}`;
  9941. throw mkdirError;
  9942. }
  9943. await forceSymlink(target, path, opts);
  9944. return { reused: false };
  9945. case "EEXIST":
  9946. case "EISDIR":
  9947. initialErr = err;
  9948. break;
  9949. default:
  9950. throw err;
  9951. }
  9952. }
  9953. let linkString;
  9954. try {
  9955. linkString = await fs_12.promises.readlink(path);
  9956. } catch (err) {
  9957. if ((opts === null || opts === void 0 ? void 0 : opts.overwrite) === false) {
  9958. throw initialErr;
  9959. }
  9960. const parentDir = pathLib.dirname(path);
  9961. let warn;
  9962. if (opts === null || opts === void 0 ? void 0 : opts.renameTried) {
  9963. await fs_12.promises.unlink(path);
  9964. warn = `Symlink wanted name was occupied by directory or file. Old entity removed: "${parentDir}${pathLib.sep}{${pathLib.basename(path)}".`;
  9965. } else {
  9966. const ignore = `.ignored_${pathLib.basename(path)}`;
  9967. try {
  9968. await renameOverwrite(path, pathLib.join(parentDir, ignore));
  9969. } catch (error) {
  9970. if (util.types.isNativeError(error) && "code" in error && error.code === "ENOENT") {
  9971. throw initialErr;
  9972. }
  9973. throw error;
  9974. }
  9975. warn = `Symlink wanted name was occupied by directory or file. Old entity moved: "${parentDir}${pathLib.sep}{${pathLib.basename(path)} => ${ignore}".`;
  9976. }
  9977. return {
  9978. ...await forceSymlink(target, path, { ...opts, renameTried: true }),
  9979. warn
  9980. };
  9981. }
  9982. if (pathLib.relative(target, linkString) === "") {
  9983. return { reused: true };
  9984. }
  9985. if ((opts === null || opts === void 0 ? void 0 : opts.overwrite) === false) {
  9986. throw initialErr;
  9987. }
  9988. try {
  9989. await fs_12.promises.unlink(path);
  9990. } catch (error) {
  9991. if (!util.types.isNativeError(error) || !("code" in error) || error.code !== "ENOENT") {
  9992. throw error;
  9993. }
  9994. }
  9995. return await forceSymlink(target, path, opts);
  9996. }
  9997. symlinkDir["default"] = symlinkDir;
  9998. (function(symlinkDir2) {
  9999. function sync(target, path, opts) {
  10000. path = betterPathResolve(path);
  10001. target = betterPathResolve(target);
  10002. if (target === path)
  10003. throw new Error(`Symlink path is the same as the target path (${target})`);
  10004. target = resolveSrc(target, path);
  10005. return forceSymlinkSync(target, path, opts);
  10006. }
  10007. symlinkDir2.sync = sync;
  10008. })(symlinkDir || (symlinkDir = {}));
  10009. function forceSymlinkSync(target, path, opts) {
  10010. let initialErr;
  10011. try {
  10012. (0, fs_12.symlinkSync)(target, path, symlinkType);
  10013. return { reused: false };
  10014. } catch (err) {
  10015. initialErr = err;
  10016. switch (err.code) {
  10017. case "ENOENT":
  10018. try {
  10019. (0, fs_12.mkdirSync)(pathLib.dirname(path), { recursive: true });
  10020. } catch (mkdirError) {
  10021. mkdirError.message = `Error while trying to symlink "${target}" to "${path}". The error happened while trying to create the parent directory for the symlink target. Details: ${mkdirError}`;
  10022. throw mkdirError;
  10023. }
  10024. forceSymlinkSync(target, path, opts);
  10025. return { reused: false };
  10026. case "EEXIST":
  10027. case "EISDIR":
  10028. break;
  10029. default:
  10030. throw err;
  10031. }
  10032. }
  10033. let linkString;
  10034. try {
  10035. linkString = (0, fs_12.readlinkSync)(path);
  10036. } catch (err) {
  10037. if ((opts === null || opts === void 0 ? void 0 : opts.overwrite) === false) {
  10038. throw initialErr;
  10039. }
  10040. const parentDir = pathLib.dirname(path);
  10041. let warn;
  10042. if (opts === null || opts === void 0 ? void 0 : opts.renameTried) {
  10043. (0, fs_12.unlinkSync)(path);
  10044. warn = `Symlink wanted name was occupied by directory or file. Old entity removed: "${parentDir}${pathLib.sep}{${pathLib.basename(path)}".`;
  10045. } else {
  10046. const ignore = `.ignored_${pathLib.basename(path)}`;
  10047. try {
  10048. renameOverwrite.sync(path, pathLib.join(parentDir, ignore));
  10049. } catch (error) {
  10050. if (util.types.isNativeError(error) && "code" in error && error.code === "ENOENT") {
  10051. throw initialErr;
  10052. }
  10053. throw error;
  10054. }
  10055. warn = `Symlink wanted name was occupied by directory or file. Old entity moved: "${parentDir}${pathLib.sep}{${pathLib.basename(path)} => ${ignore}".`;
  10056. }
  10057. return {
  10058. ...forceSymlinkSync(target, path, { ...opts, renameTried: true }),
  10059. warn
  10060. };
  10061. }
  10062. if (pathLib.relative(target, linkString) === "") {
  10063. return { reused: true };
  10064. }
  10065. if ((opts === null || opts === void 0 ? void 0 : opts.overwrite) === false) {
  10066. throw initialErr;
  10067. }
  10068. try {
  10069. (0, fs_12.unlinkSync)(path);
  10070. } catch (error) {
  10071. if (!util.types.isNativeError(error) || !("code" in error) || error.code !== "ENOENT") {
  10072. throw error;
  10073. }
  10074. }
  10075. return forceSymlinkSync(target, path, opts);
  10076. }
  10077. module2.exports = symlinkDir;
  10078. }
  10079. });
  10080. // ../fs/symlink-dependency/lib/symlinkDirectRootDependency.js
  10081. var require_symlinkDirectRootDependency = __commonJS({
  10082. "../fs/symlink-dependency/lib/symlinkDirectRootDependency.js"(exports2) {
  10083. "use strict";
  10084. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  10085. return mod && mod.__esModule ? mod : { "default": mod };
  10086. };
  10087. Object.defineProperty(exports2, "__esModule", { value: true });
  10088. exports2.symlinkDirectRootDependency = symlinkDirectRootDependency;
  10089. var fs_12 = require("fs");
  10090. var path_12 = __importDefault2(require("path"));
  10091. var util_1 = __importDefault2(require("util"));
  10092. var core_loggers_1 = require_lib6();
  10093. var symlink_dir_1 = __importDefault2(require_dist3());
  10094. var DEP_TYPE_BY_DEPS_FIELD_NAME = {
  10095. dependencies: "prod",
  10096. devDependencies: "dev",
  10097. optionalDependencies: "optional"
  10098. };
  10099. async function symlinkDirectRootDependency(dependencyLocation, destModulesDir, importAs, opts) {
  10100. let destModulesDirReal;
  10101. try {
  10102. destModulesDirReal = await fs_12.promises.realpath(destModulesDir);
  10103. } catch (err) {
  10104. if (util_1.default.types.isNativeError(err) && "code" in err && err.code === "ENOENT") {
  10105. await fs_12.promises.mkdir(destModulesDir, { recursive: true });
  10106. destModulesDirReal = await fs_12.promises.realpath(destModulesDir);
  10107. } else {
  10108. throw err;
  10109. }
  10110. }
  10111. const dest = path_12.default.join(destModulesDirReal, importAs);
  10112. const { reused } = await (0, symlink_dir_1.default)(dependencyLocation, dest);
  10113. if (reused)
  10114. return;
  10115. core_loggers_1.rootLogger.debug({
  10116. added: {
  10117. dependencyType: opts.fromDependenciesField && DEP_TYPE_BY_DEPS_FIELD_NAME[opts.fromDependenciesField],
  10118. linkedFrom: dependencyLocation,
  10119. name: importAs,
  10120. realName: opts.linkedPackage.name,
  10121. version: opts.linkedPackage.version
  10122. },
  10123. prefix: opts.prefix
  10124. });
  10125. }
  10126. }
  10127. });
  10128. // ../fs/symlink-dependency/lib/index.js
  10129. var require_lib12 = __commonJS({
  10130. "../fs/symlink-dependency/lib/index.js"(exports2) {
  10131. "use strict";
  10132. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  10133. return mod && mod.__esModule ? mod : { "default": mod };
  10134. };
  10135. Object.defineProperty(exports2, "__esModule", { value: true });
  10136. exports2.symlinkDirectRootDependency = void 0;
  10137. exports2.symlinkDependency = symlinkDependency;
  10138. exports2.symlinkDependencySync = symlinkDependencySync;
  10139. var path_12 = __importDefault2(require("path"));
  10140. var core_loggers_1 = require_lib6();
  10141. var symlink_dir_1 = __importDefault2(require_dist3());
  10142. var symlinkDirectRootDependency_1 = require_symlinkDirectRootDependency();
  10143. Object.defineProperty(exports2, "symlinkDirectRootDependency", { enumerable: true, get: function() {
  10144. return symlinkDirectRootDependency_1.symlinkDirectRootDependency;
  10145. } });
  10146. async function symlinkDependency(dependencyRealLocation, destModulesDir, importAs) {
  10147. const link = path_12.default.join(destModulesDir, importAs);
  10148. core_loggers_1.linkLogger.debug({ target: dependencyRealLocation, link });
  10149. return (0, symlink_dir_1.default)(dependencyRealLocation, link);
  10150. }
  10151. function symlinkDependencySync(dependencyRealLocation, destModulesDir, importAs) {
  10152. const link = path_12.default.join(destModulesDir, importAs);
  10153. core_loggers_1.linkLogger.debug({ target: dependencyRealLocation, link });
  10154. return symlink_dir_1.default.sync(dependencyRealLocation, link);
  10155. }
  10156. }
  10157. });
  10158. // ../node_modules/.pnpm/is-arrayish@0.2.1/node_modules/is-arrayish/index.js
  10159. var require_is_arrayish = __commonJS({
  10160. "../node_modules/.pnpm/is-arrayish@0.2.1/node_modules/is-arrayish/index.js"(exports2, module2) {
  10161. "use strict";
  10162. module2.exports = function isArrayish(obj) {
  10163. if (!obj) {
  10164. return false;
  10165. }
  10166. return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && obj.splice instanceof Function;
  10167. };
  10168. }
  10169. });
  10170. // ../node_modules/.pnpm/error-ex@1.3.2/node_modules/error-ex/index.js
  10171. var require_error_ex = __commonJS({
  10172. "../node_modules/.pnpm/error-ex@1.3.2/node_modules/error-ex/index.js"(exports2, module2) {
  10173. "use strict";
  10174. var util = require("util");
  10175. var isArrayish = require_is_arrayish();
  10176. var errorEx = function errorEx2(name, properties) {
  10177. if (!name || name.constructor !== String) {
  10178. properties = name || {};
  10179. name = Error.name;
  10180. }
  10181. var errorExError = function ErrorEXError(message) {
  10182. if (!this) {
  10183. return new ErrorEXError(message);
  10184. }
  10185. message = message instanceof Error ? message.message : message || this.message;
  10186. Error.call(this, message);
  10187. Error.captureStackTrace(this, errorExError);
  10188. this.name = name;
  10189. Object.defineProperty(this, "message", {
  10190. configurable: true,
  10191. enumerable: false,
  10192. get: function() {
  10193. var newMessage = message.split(/\r?\n/g);
  10194. for (var key in properties) {
  10195. if (!properties.hasOwnProperty(key)) {
  10196. continue;
  10197. }
  10198. var modifier = properties[key];
  10199. if ("message" in modifier) {
  10200. newMessage = modifier.message(this[key], newMessage) || newMessage;
  10201. if (!isArrayish(newMessage)) {
  10202. newMessage = [newMessage];
  10203. }
  10204. }
  10205. }
  10206. return newMessage.join("\n");
  10207. },
  10208. set: function(v) {
  10209. message = v;
  10210. }
  10211. });
  10212. var overwrittenStack = null;
  10213. var stackDescriptor = Object.getOwnPropertyDescriptor(this, "stack");
  10214. var stackGetter = stackDescriptor.get;
  10215. var stackValue = stackDescriptor.value;
  10216. delete stackDescriptor.value;
  10217. delete stackDescriptor.writable;
  10218. stackDescriptor.set = function(newstack) {
  10219. overwrittenStack = newstack;
  10220. };
  10221. stackDescriptor.get = function() {
  10222. var stack = (overwrittenStack || (stackGetter ? stackGetter.call(this) : stackValue)).split(/\r?\n+/g);
  10223. if (!overwrittenStack) {
  10224. stack[0] = this.name + ": " + this.message;
  10225. }
  10226. var lineCount = 1;
  10227. for (var key in properties) {
  10228. if (!properties.hasOwnProperty(key)) {
  10229. continue;
  10230. }
  10231. var modifier = properties[key];
  10232. if ("line" in modifier) {
  10233. var line = modifier.line(this[key]);
  10234. if (line) {
  10235. stack.splice(lineCount++, 0, " " + line);
  10236. }
  10237. }
  10238. if ("stack" in modifier) {
  10239. modifier.stack(this[key], stack);
  10240. }
  10241. }
  10242. return stack.join("\n");
  10243. };
  10244. Object.defineProperty(this, "stack", stackDescriptor);
  10245. };
  10246. if (Object.setPrototypeOf) {
  10247. Object.setPrototypeOf(errorExError.prototype, Error.prototype);
  10248. Object.setPrototypeOf(errorExError, Error);
  10249. } else {
  10250. util.inherits(errorExError, Error);
  10251. }
  10252. return errorExError;
  10253. };
  10254. errorEx.append = function(str, def) {
  10255. return {
  10256. message: function(v, message) {
  10257. v = v || def;
  10258. if (v) {
  10259. message[0] += " " + str.replace("%s", v.toString());
  10260. }
  10261. return message;
  10262. }
  10263. };
  10264. };
  10265. errorEx.line = function(str, def) {
  10266. return {
  10267. line: function(v) {
  10268. v = v || def;
  10269. if (v) {
  10270. return str.replace("%s", v.toString());
  10271. }
  10272. return null;
  10273. }
  10274. };
  10275. };
  10276. module2.exports = errorEx;
  10277. }
  10278. });
  10279. // ../node_modules/.pnpm/json-parse-even-better-errors@2.3.1/node_modules/json-parse-even-better-errors/index.js
  10280. var require_json_parse_even_better_errors = __commonJS({
  10281. "../node_modules/.pnpm/json-parse-even-better-errors@2.3.1/node_modules/json-parse-even-better-errors/index.js"(exports2, module2) {
  10282. "use strict";
  10283. var hexify = (char) => {
  10284. const h = char.charCodeAt(0).toString(16).toUpperCase();
  10285. return "0x" + (h.length % 2 ? "0" : "") + h;
  10286. };
  10287. var parseError = (e, txt, context) => {
  10288. if (!txt) {
  10289. return {
  10290. message: e.message + " while parsing empty string",
  10291. position: 0
  10292. };
  10293. }
  10294. const badToken = e.message.match(/^Unexpected token (.) .*position\s+(\d+)/i);
  10295. const errIdx = badToken ? +badToken[2] : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null;
  10296. const msg = badToken ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
  10297. if (errIdx !== null && errIdx !== void 0) {
  10298. const start = errIdx <= context ? 0 : errIdx - context;
  10299. const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
  10300. const slice = (start === 0 ? "" : "...") + txt.slice(start, end) + (end === txt.length ? "" : "...");
  10301. const near = txt === slice ? "" : "near ";
  10302. return {
  10303. message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
  10304. position: errIdx
  10305. };
  10306. } else {
  10307. return {
  10308. message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
  10309. position: 0
  10310. };
  10311. }
  10312. };
  10313. var JSONParseError = class extends SyntaxError {
  10314. constructor(er, txt, context, caller) {
  10315. context = context || 20;
  10316. const metadata = parseError(er, txt, context);
  10317. super(metadata.message);
  10318. Object.assign(this, metadata);
  10319. this.code = "EJSONPARSE";
  10320. this.systemError = er;
  10321. Error.captureStackTrace(this, caller || this.constructor);
  10322. }
  10323. get name() {
  10324. return this.constructor.name;
  10325. }
  10326. set name(n) {
  10327. }
  10328. get [Symbol.toStringTag]() {
  10329. return this.constructor.name;
  10330. }
  10331. };
  10332. var kIndent = Symbol.for("indent");
  10333. var kNewline = Symbol.for("newline");
  10334. var formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
  10335. var emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
  10336. var parseJson = (txt, reviver, context) => {
  10337. const parseText = stripBOM(txt);
  10338. context = context || 20;
  10339. try {
  10340. const [, newline = "\n", indent = " "] = parseText.match(emptyRE) || parseText.match(formatRE) || [, "", ""];
  10341. const result = JSON.parse(parseText, reviver);
  10342. if (result && typeof result === "object") {
  10343. result[kNewline] = newline;
  10344. result[kIndent] = indent;
  10345. }
  10346. return result;
  10347. } catch (e) {
  10348. if (typeof txt !== "string" && !Buffer.isBuffer(txt)) {
  10349. const isEmptyArray = Array.isArray(txt) && txt.length === 0;
  10350. throw Object.assign(new TypeError(
  10351. `Cannot parse ${isEmptyArray ? "an empty array" : String(txt)}`
  10352. ), {
  10353. code: "EJSONPARSE",
  10354. systemError: e
  10355. });
  10356. }
  10357. throw new JSONParseError(e, parseText, context, parseJson);
  10358. }
  10359. };
  10360. var stripBOM = (txt) => String(txt).replace(/^\uFEFF/, "");
  10361. module2.exports = parseJson;
  10362. parseJson.JSONParseError = JSONParseError;
  10363. parseJson.noExceptions = (txt, reviver) => {
  10364. try {
  10365. return JSON.parse(stripBOM(txt), reviver);
  10366. } catch (e) {
  10367. }
  10368. };
  10369. }
  10370. });
  10371. // ../node_modules/.pnpm/lines-and-columns@1.2.4/node_modules/lines-and-columns/build/index.js
  10372. var require_build = __commonJS({
  10373. "../node_modules/.pnpm/lines-and-columns@1.2.4/node_modules/lines-and-columns/build/index.js"(exports2) {
  10374. "use strict";
  10375. exports2.__esModule = true;
  10376. exports2.LinesAndColumns = void 0;
  10377. var LF = "\n";
  10378. var CR = "\r";
  10379. var LinesAndColumns = (
  10380. /** @class */
  10381. function() {
  10382. function LinesAndColumns2(string) {
  10383. this.string = string;
  10384. var offsets = [0];
  10385. for (var offset = 0; offset < string.length; ) {
  10386. switch (string[offset]) {
  10387. case LF:
  10388. offset += LF.length;
  10389. offsets.push(offset);
  10390. break;
  10391. case CR:
  10392. offset += CR.length;
  10393. if (string[offset] === LF) {
  10394. offset += LF.length;
  10395. }
  10396. offsets.push(offset);
  10397. break;
  10398. default:
  10399. offset++;
  10400. break;
  10401. }
  10402. }
  10403. this.offsets = offsets;
  10404. }
  10405. LinesAndColumns2.prototype.locationForIndex = function(index) {
  10406. if (index < 0 || index > this.string.length) {
  10407. return null;
  10408. }
  10409. var line = 0;
  10410. var offsets = this.offsets;
  10411. while (offsets[line + 1] <= index) {
  10412. line++;
  10413. }
  10414. var column = index - offsets[line];
  10415. return { line, column };
  10416. };
  10417. LinesAndColumns2.prototype.indexForLocation = function(location) {
  10418. var line = location.line, column = location.column;
  10419. if (line < 0 || line >= this.offsets.length) {
  10420. return null;
  10421. }
  10422. if (column < 0 || column > this.lengthOfLine(line)) {
  10423. return null;
  10424. }
  10425. return this.offsets[line] + column;
  10426. };
  10427. LinesAndColumns2.prototype.lengthOfLine = function(line) {
  10428. var offset = this.offsets[line];
  10429. var nextOffset = line === this.offsets.length - 1 ? this.string.length : this.offsets[line + 1];
  10430. return nextOffset - offset;
  10431. };
  10432. return LinesAndColumns2;
  10433. }()
  10434. );
  10435. exports2.LinesAndColumns = LinesAndColumns;
  10436. exports2["default"] = LinesAndColumns;
  10437. }
  10438. });
  10439. // ../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
  10440. var require_picocolors = __commonJS({
  10441. "../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports2, module2) {
  10442. var p = process || {};
  10443. var argv = p.argv || [];
  10444. var env = p.env || {};
  10445. var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
  10446. var formatter = (open, close, replace = open) => (input) => {
  10447. let string = "" + input, index = string.indexOf(close, open.length);
  10448. return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
  10449. };
  10450. var replaceClose = (string, close, replace, index) => {
  10451. let result = "", cursor = 0;
  10452. do {
  10453. result += string.substring(cursor, index) + replace;
  10454. cursor = index + close.length;
  10455. index = string.indexOf(close, cursor);
  10456. } while (~index);
  10457. return result + string.substring(cursor);
  10458. };
  10459. var createColors = (enabled = isColorSupported) => {
  10460. let f = enabled ? formatter : () => String;
  10461. return {
  10462. isColorSupported: enabled,
  10463. reset: f("\x1B[0m", "\x1B[0m"),
  10464. bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
  10465. dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
  10466. italic: f("\x1B[3m", "\x1B[23m"),
  10467. underline: f("\x1B[4m", "\x1B[24m"),
  10468. inverse: f("\x1B[7m", "\x1B[27m"),
  10469. hidden: f("\x1B[8m", "\x1B[28m"),
  10470. strikethrough: f("\x1B[9m", "\x1B[29m"),
  10471. black: f("\x1B[30m", "\x1B[39m"),
  10472. red: f("\x1B[31m", "\x1B[39m"),
  10473. green: f("\x1B[32m", "\x1B[39m"),
  10474. yellow: f("\x1B[33m", "\x1B[39m"),
  10475. blue: f("\x1B[34m", "\x1B[39m"),
  10476. magenta: f("\x1B[35m", "\x1B[39m"),
  10477. cyan: f("\x1B[36m", "\x1B[39m"),
  10478. white: f("\x1B[37m", "\x1B[39m"),
  10479. gray: f("\x1B[90m", "\x1B[39m"),
  10480. bgBlack: f("\x1B[40m", "\x1B[49m"),
  10481. bgRed: f("\x1B[41m", "\x1B[49m"),
  10482. bgGreen: f("\x1B[42m", "\x1B[49m"),
  10483. bgYellow: f("\x1B[43m", "\x1B[49m"),
  10484. bgBlue: f("\x1B[44m", "\x1B[49m"),
  10485. bgMagenta: f("\x1B[45m", "\x1B[49m"),
  10486. bgCyan: f("\x1B[46m", "\x1B[49m"),
  10487. bgWhite: f("\x1B[47m", "\x1B[49m"),
  10488. blackBright: f("\x1B[90m", "\x1B[39m"),
  10489. redBright: f("\x1B[91m", "\x1B[39m"),
  10490. greenBright: f("\x1B[92m", "\x1B[39m"),
  10491. yellowBright: f("\x1B[93m", "\x1B[39m"),
  10492. blueBright: f("\x1B[94m", "\x1B[39m"),
  10493. magentaBright: f("\x1B[95m", "\x1B[39m"),
  10494. cyanBright: f("\x1B[96m", "\x1B[39m"),
  10495. whiteBright: f("\x1B[97m", "\x1B[39m"),
  10496. bgBlackBright: f("\x1B[100m", "\x1B[49m"),
  10497. bgRedBright: f("\x1B[101m", "\x1B[49m"),
  10498. bgGreenBright: f("\x1B[102m", "\x1B[49m"),
  10499. bgYellowBright: f("\x1B[103m", "\x1B[49m"),
  10500. bgBlueBright: f("\x1B[104m", "\x1B[49m"),
  10501. bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
  10502. bgCyanBright: f("\x1B[106m", "\x1B[49m"),
  10503. bgWhiteBright: f("\x1B[107m", "\x1B[49m")
  10504. };
  10505. };
  10506. module2.exports = createColors();
  10507. module2.exports.createColors = createColors;
  10508. }
  10509. });
  10510. // ../node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js
  10511. var require_js_tokens = __commonJS({
  10512. "../node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js"(exports2) {
  10513. Object.defineProperty(exports2, "__esModule", {
  10514. value: true
  10515. });
  10516. exports2.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
  10517. exports2.matchToToken = function(match) {
  10518. var token = { type: "invalid", value: match[0], closed: void 0 };
  10519. if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);
  10520. else if (match[5]) token.type = "comment";
  10521. else if (match[6]) token.type = "comment", token.closed = !!match[7];
  10522. else if (match[8]) token.type = "regex";
  10523. else if (match[9]) token.type = "number";
  10524. else if (match[10]) token.type = "name";
  10525. else if (match[11]) token.type = "punctuator";
  10526. else if (match[12]) token.type = "whitespace";
  10527. return token;
  10528. };
  10529. }
  10530. });
  10531. // ../node_modules/.pnpm/@babel+helper-validator-identifier@7.25.9/node_modules/@babel/helper-validator-identifier/lib/identifier.js
  10532. var require_identifier = __commonJS({
  10533. "../node_modules/.pnpm/@babel+helper-validator-identifier@7.25.9/node_modules/@babel/helper-validator-identifier/lib/identifier.js"(exports2) {
  10534. "use strict";
  10535. Object.defineProperty(exports2, "__esModule", {
  10536. value: true
  10537. });
  10538. exports2.isIdentifierChar = isIdentifierChar;
  10539. exports2.isIdentifierName = isIdentifierName;
  10540. exports2.isIdentifierStart = isIdentifierStart;
  10541. var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
  10542. var nonASCIIidentifierChars = "\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";
  10543. var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  10544. var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  10545. nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  10546. var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
  10547. var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
  10548. function isInAstralSet(code, set) {
  10549. let pos = 65536;
  10550. for (let i = 0, length = set.length; i < length; i += 2) {
  10551. pos += set[i];
  10552. if (pos > code) return false;
  10553. pos += set[i + 1];
  10554. if (pos >= code) return true;
  10555. }
  10556. return false;
  10557. }
  10558. function isIdentifierStart(code) {
  10559. if (code < 65) return code === 36;
  10560. if (code <= 90) return true;
  10561. if (code < 97) return code === 95;
  10562. if (code <= 122) return true;
  10563. if (code <= 65535) {
  10564. return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
  10565. }
  10566. return isInAstralSet(code, astralIdentifierStartCodes);
  10567. }
  10568. function isIdentifierChar(code) {
  10569. if (code < 48) return code === 36;
  10570. if (code < 58) return true;
  10571. if (code < 65) return false;
  10572. if (code <= 90) return true;
  10573. if (code < 97) return code === 95;
  10574. if (code <= 122) return true;
  10575. if (code <= 65535) {
  10576. return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
  10577. }
  10578. return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
  10579. }
  10580. function isIdentifierName(name) {
  10581. let isFirst = true;
  10582. for (let i = 0; i < name.length; i++) {
  10583. let cp = name.charCodeAt(i);
  10584. if ((cp & 64512) === 55296 && i + 1 < name.length) {
  10585. const trail = name.charCodeAt(++i);
  10586. if ((trail & 64512) === 56320) {
  10587. cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
  10588. }
  10589. }
  10590. if (isFirst) {
  10591. isFirst = false;
  10592. if (!isIdentifierStart(cp)) {
  10593. return false;
  10594. }
  10595. } else if (!isIdentifierChar(cp)) {
  10596. return false;
  10597. }
  10598. }
  10599. return !isFirst;
  10600. }
  10601. }
  10602. });
  10603. // ../node_modules/.pnpm/@babel+helper-validator-identifier@7.25.9/node_modules/@babel/helper-validator-identifier/lib/keyword.js
  10604. var require_keyword = __commonJS({
  10605. "../node_modules/.pnpm/@babel+helper-validator-identifier@7.25.9/node_modules/@babel/helper-validator-identifier/lib/keyword.js"(exports2) {
  10606. "use strict";
  10607. Object.defineProperty(exports2, "__esModule", {
  10608. value: true
  10609. });
  10610. exports2.isKeyword = isKeyword;
  10611. exports2.isReservedWord = isReservedWord;
  10612. exports2.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
  10613. exports2.isStrictBindReservedWord = isStrictBindReservedWord;
  10614. exports2.isStrictReservedWord = isStrictReservedWord;
  10615. var reservedWords = {
  10616. keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
  10617. strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
  10618. strictBind: ["eval", "arguments"]
  10619. };
  10620. var keywords = new Set(reservedWords.keyword);
  10621. var reservedWordsStrictSet = new Set(reservedWords.strict);
  10622. var reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
  10623. function isReservedWord(word, inModule) {
  10624. return inModule && word === "await" || word === "enum";
  10625. }
  10626. function isStrictReservedWord(word, inModule) {
  10627. return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
  10628. }
  10629. function isStrictBindOnlyReservedWord(word) {
  10630. return reservedWordsStrictBindSet.has(word);
  10631. }
  10632. function isStrictBindReservedWord(word, inModule) {
  10633. return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
  10634. }
  10635. function isKeyword(word) {
  10636. return keywords.has(word);
  10637. }
  10638. }
  10639. });
  10640. // ../node_modules/.pnpm/@babel+helper-validator-identifier@7.25.9/node_modules/@babel/helper-validator-identifier/lib/index.js
  10641. var require_lib13 = __commonJS({
  10642. "../node_modules/.pnpm/@babel+helper-validator-identifier@7.25.9/node_modules/@babel/helper-validator-identifier/lib/index.js"(exports2) {
  10643. "use strict";
  10644. Object.defineProperty(exports2, "__esModule", {
  10645. value: true
  10646. });
  10647. Object.defineProperty(exports2, "isIdentifierChar", {
  10648. enumerable: true,
  10649. get: function() {
  10650. return _identifier.isIdentifierChar;
  10651. }
  10652. });
  10653. Object.defineProperty(exports2, "isIdentifierName", {
  10654. enumerable: true,
  10655. get: function() {
  10656. return _identifier.isIdentifierName;
  10657. }
  10658. });
  10659. Object.defineProperty(exports2, "isIdentifierStart", {
  10660. enumerable: true,
  10661. get: function() {
  10662. return _identifier.isIdentifierStart;
  10663. }
  10664. });
  10665. Object.defineProperty(exports2, "isKeyword", {
  10666. enumerable: true,
  10667. get: function() {
  10668. return _keyword.isKeyword;
  10669. }
  10670. });
  10671. Object.defineProperty(exports2, "isReservedWord", {
  10672. enumerable: true,
  10673. get: function() {
  10674. return _keyword.isReservedWord;
  10675. }
  10676. });
  10677. Object.defineProperty(exports2, "isStrictBindOnlyReservedWord", {
  10678. enumerable: true,
  10679. get: function() {
  10680. return _keyword.isStrictBindOnlyReservedWord;
  10681. }
  10682. });
  10683. Object.defineProperty(exports2, "isStrictBindReservedWord", {
  10684. enumerable: true,
  10685. get: function() {
  10686. return _keyword.isStrictBindReservedWord;
  10687. }
  10688. });
  10689. Object.defineProperty(exports2, "isStrictReservedWord", {
  10690. enumerable: true,
  10691. get: function() {
  10692. return _keyword.isStrictReservedWord;
  10693. }
  10694. });
  10695. var _identifier = require_identifier();
  10696. var _keyword = require_keyword();
  10697. }
  10698. });
  10699. // ../node_modules/.pnpm/@babel+code-frame@7.26.2/node_modules/@babel/code-frame/lib/index.js
  10700. var require_lib14 = __commonJS({
  10701. "../node_modules/.pnpm/@babel+code-frame@7.26.2/node_modules/@babel/code-frame/lib/index.js"(exports2) {
  10702. "use strict";
  10703. Object.defineProperty(exports2, "__esModule", { value: true });
  10704. var picocolors = require_picocolors();
  10705. var jsTokens = require_js_tokens();
  10706. var helperValidatorIdentifier = require_lib13();
  10707. function isColorSupported() {
  10708. return typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported;
  10709. }
  10710. var compose = (f, g) => (v) => f(g(v));
  10711. function buildDefs(colors) {
  10712. return {
  10713. keyword: colors.cyan,
  10714. capitalized: colors.yellow,
  10715. jsxIdentifier: colors.yellow,
  10716. punctuator: colors.yellow,
  10717. number: colors.magenta,
  10718. string: colors.green,
  10719. regex: colors.magenta,
  10720. comment: colors.gray,
  10721. invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
  10722. gutter: colors.gray,
  10723. marker: compose(colors.red, colors.bold),
  10724. message: compose(colors.red, colors.bold),
  10725. reset: colors.reset
  10726. };
  10727. }
  10728. var defsOn = buildDefs(picocolors.createColors(true));
  10729. var defsOff = buildDefs(picocolors.createColors(false));
  10730. function getDefs(enabled) {
  10731. return enabled ? defsOn : defsOff;
  10732. }
  10733. var sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
  10734. var NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
  10735. var BRACKET = /^[()[\]{}]$/;
  10736. var tokenize;
  10737. {
  10738. const JSX_TAG = /^[a-z][\w-]*$/i;
  10739. const getTokenType = function(token, offset, text) {
  10740. if (token.type === "name") {
  10741. if (helperValidatorIdentifier.isKeyword(token.value) || helperValidatorIdentifier.isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) {
  10742. return "keyword";
  10743. }
  10744. if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
  10745. return "jsxIdentifier";
  10746. }
  10747. if (token.value[0] !== token.value[0].toLowerCase()) {
  10748. return "capitalized";
  10749. }
  10750. }
  10751. if (token.type === "punctuator" && BRACKET.test(token.value)) {
  10752. return "bracket";
  10753. }
  10754. if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
  10755. return "punctuator";
  10756. }
  10757. return token.type;
  10758. };
  10759. tokenize = function* (text) {
  10760. let match;
  10761. while (match = jsTokens.default.exec(text)) {
  10762. const token = jsTokens.matchToToken(match);
  10763. yield {
  10764. type: getTokenType(token, match.index, text),
  10765. value: token.value
  10766. };
  10767. }
  10768. };
  10769. }
  10770. function highlight(text) {
  10771. if (text === "") return "";
  10772. const defs = getDefs(true);
  10773. let highlighted = "";
  10774. for (const {
  10775. type,
  10776. value
  10777. } of tokenize(text)) {
  10778. if (type in defs) {
  10779. highlighted += value.split(NEWLINE$1).map((str) => defs[type](str)).join("\n");
  10780. } else {
  10781. highlighted += value;
  10782. }
  10783. }
  10784. return highlighted;
  10785. }
  10786. var deprecationWarningShown = false;
  10787. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  10788. function getMarkerLines(loc, source, opts) {
  10789. const startLoc = Object.assign({
  10790. column: 0,
  10791. line: -1
  10792. }, loc.start);
  10793. const endLoc = Object.assign({}, startLoc, loc.end);
  10794. const {
  10795. linesAbove = 2,
  10796. linesBelow = 3
  10797. } = opts || {};
  10798. const startLine = startLoc.line;
  10799. const startColumn = startLoc.column;
  10800. const endLine = endLoc.line;
  10801. const endColumn = endLoc.column;
  10802. let start = Math.max(startLine - (linesAbove + 1), 0);
  10803. let end = Math.min(source.length, endLine + linesBelow);
  10804. if (startLine === -1) {
  10805. start = 0;
  10806. }
  10807. if (endLine === -1) {
  10808. end = source.length;
  10809. }
  10810. const lineDiff = endLine - startLine;
  10811. const markerLines = {};
  10812. if (lineDiff) {
  10813. for (let i = 0; i <= lineDiff; i++) {
  10814. const lineNumber = i + startLine;
  10815. if (!startColumn) {
  10816. markerLines[lineNumber] = true;
  10817. } else if (i === 0) {
  10818. const sourceLength = source[lineNumber - 1].length;
  10819. markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
  10820. } else if (i === lineDiff) {
  10821. markerLines[lineNumber] = [0, endColumn];
  10822. } else {
  10823. const sourceLength = source[lineNumber - i].length;
  10824. markerLines[lineNumber] = [0, sourceLength];
  10825. }
  10826. }
  10827. } else {
  10828. if (startColumn === endColumn) {
  10829. if (startColumn) {
  10830. markerLines[startLine] = [startColumn, 0];
  10831. } else {
  10832. markerLines[startLine] = true;
  10833. }
  10834. } else {
  10835. markerLines[startLine] = [startColumn, endColumn - startColumn];
  10836. }
  10837. }
  10838. return {
  10839. start,
  10840. end,
  10841. markerLines
  10842. };
  10843. }
  10844. function codeFrameColumns(rawLines, loc, opts = {}) {
  10845. const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
  10846. const defs = getDefs(shouldHighlight);
  10847. const lines = rawLines.split(NEWLINE);
  10848. const {
  10849. start,
  10850. end,
  10851. markerLines
  10852. } = getMarkerLines(loc, lines, opts);
  10853. const hasColumns = loc.start && typeof loc.start.column === "number";
  10854. const numberMaxWidth = String(end).length;
  10855. const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
  10856. let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index2) => {
  10857. const number = start + 1 + index2;
  10858. const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
  10859. const gutter = ` ${paddedNumber} |`;
  10860. const hasMarker = markerLines[number];
  10861. const lastMarkerLine = !markerLines[number + 1];
  10862. if (hasMarker) {
  10863. let markerLine = "";
  10864. if (Array.isArray(hasMarker)) {
  10865. const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
  10866. const numberOfMarkers = hasMarker[1] || 1;
  10867. markerLine = ["\n ", defs.gutter(gutter.replace(/\d/g, " ")), " ", markerSpacing, defs.marker("^").repeat(numberOfMarkers)].join("");
  10868. if (lastMarkerLine && opts.message) {
  10869. markerLine += " " + defs.message(opts.message);
  10870. }
  10871. }
  10872. return [defs.marker(">"), defs.gutter(gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
  10873. } else {
  10874. return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
  10875. }
  10876. }).join("\n");
  10877. if (opts.message && !hasColumns) {
  10878. frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}
  10879. ${frame}`;
  10880. }
  10881. if (shouldHighlight) {
  10882. return defs.reset(frame);
  10883. } else {
  10884. return frame;
  10885. }
  10886. }
  10887. function index(rawLines, lineNumber, colNumber, opts = {}) {
  10888. if (!deprecationWarningShown) {
  10889. deprecationWarningShown = true;
  10890. const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
  10891. if (process.emitWarning) {
  10892. process.emitWarning(message, "DeprecationWarning");
  10893. } else {
  10894. const deprecationError = new Error(message);
  10895. deprecationError.name = "DeprecationWarning";
  10896. console.warn(new Error(message));
  10897. }
  10898. }
  10899. colNumber = Math.max(colNumber, 0);
  10900. const location = {
  10901. start: {
  10902. column: colNumber,
  10903. line: lineNumber
  10904. }
  10905. };
  10906. return codeFrameColumns(rawLines, location, opts);
  10907. }
  10908. exports2.codeFrameColumns = codeFrameColumns;
  10909. exports2.default = index;
  10910. exports2.highlight = highlight;
  10911. }
  10912. });
  10913. // ../node_modules/.pnpm/parse-json@5.2.0/node_modules/parse-json/index.js
  10914. var require_parse_json = __commonJS({
  10915. "../node_modules/.pnpm/parse-json@5.2.0/node_modules/parse-json/index.js"(exports2, module2) {
  10916. "use strict";
  10917. var errorEx = require_error_ex();
  10918. var fallback = require_json_parse_even_better_errors();
  10919. var { default: LinesAndColumns } = require_build();
  10920. var { codeFrameColumns } = require_lib14();
  10921. var JSONError = errorEx("JSONError", {
  10922. fileName: errorEx.append("in %s"),
  10923. codeFrame: errorEx.append("\n\n%s\n")
  10924. });
  10925. var parseJson = (string, reviver, filename) => {
  10926. if (typeof reviver === "string") {
  10927. filename = reviver;
  10928. reviver = null;
  10929. }
  10930. try {
  10931. try {
  10932. return JSON.parse(string, reviver);
  10933. } catch (error) {
  10934. fallback(string, reviver);
  10935. throw error;
  10936. }
  10937. } catch (error) {
  10938. error.message = error.message.replace(/\n/g, "");
  10939. const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/);
  10940. const jsonError = new JSONError(error);
  10941. if (filename) {
  10942. jsonError.fileName = filename;
  10943. }
  10944. if (indexMatch && indexMatch.length > 0) {
  10945. const lines = new LinesAndColumns(string);
  10946. const index = Number(indexMatch[1]);
  10947. const location = lines.locationForIndex(index);
  10948. const codeFrame = codeFrameColumns(
  10949. string,
  10950. { start: { line: location.line + 1, column: location.column + 1 } },
  10951. { highlightCode: true }
  10952. );
  10953. jsonError.codeFrame = codeFrame;
  10954. }
  10955. throw jsonError;
  10956. }
  10957. };
  10958. parseJson.JSONError = JSONError;
  10959. module2.exports = parseJson;
  10960. }
  10961. });
  10962. // ../node_modules/.pnpm/load-json-file@6.2.0/node_modules/load-json-file/index.js
  10963. var require_load_json_file = __commonJS({
  10964. "../node_modules/.pnpm/load-json-file@6.2.0/node_modules/load-json-file/index.js"(exports2, module2) {
  10965. "use strict";
  10966. var path = require("path");
  10967. var { promisify } = require("util");
  10968. var fs = require_graceful_fs();
  10969. var stripBom = require_strip_bom();
  10970. var parseJson = require_parse_json();
  10971. var parse = (data, filePath, options = {}) => {
  10972. data = stripBom(data);
  10973. if (typeof options.beforeParse === "function") {
  10974. data = options.beforeParse(data);
  10975. }
  10976. return parseJson(data, options.reviver, path.relative(process.cwd(), filePath));
  10977. };
  10978. module2.exports = async (filePath, options) => parse(await promisify(fs.readFile)(filePath, "utf8"), filePath, options);
  10979. module2.exports.sync = (filePath, options) => parse(fs.readFileSync(filePath, "utf8"), filePath, options);
  10980. }
  10981. });
  10982. // ../worker/lib/worker.js
  10983. var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
  10984. if (k2 === void 0) k2 = k;
  10985. var desc = Object.getOwnPropertyDescriptor(m, k);
  10986. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  10987. desc = { enumerable: true, get: function() {
  10988. return m[k];
  10989. } };
  10990. }
  10991. Object.defineProperty(o, k2, desc);
  10992. } : function(o, m, k, k2) {
  10993. if (k2 === void 0) k2 = k;
  10994. o[k2] = m[k];
  10995. });
  10996. var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
  10997. Object.defineProperty(o, "default", { enumerable: true, value: v });
  10998. } : function(o, v) {
  10999. o["default"] = v;
  11000. });
  11001. var __importStar = exports && exports.__importStar || function(mod) {
  11002. if (mod && mod.__esModule) return mod;
  11003. var result = {};
  11004. if (mod != null) {
  11005. for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  11006. }
  11007. __setModuleDefault(result, mod);
  11008. return result;
  11009. };
  11010. var __importDefault = exports && exports.__importDefault || function(mod) {
  11011. return mod && mod.__esModule ? mod : { "default": mod };
  11012. };
  11013. Object.defineProperty(exports, "__esModule", { value: true });
  11014. var path_1 = __importDefault(require("path"));
  11015. var fs_1 = __importDefault(require("fs"));
  11016. var graceful_fs_1 = __importDefault(require_lib());
  11017. var create_cafs_store_1 = require_lib8();
  11018. var crypto = __importStar(require_lib9());
  11019. var exec_pkg_requires_build_1 = require_lib10();
  11020. var fs_hard_link_dir_1 = require_lib11();
  11021. var store_cafs_1 = require_lib4();
  11022. var symlink_dependency_1 = require_lib12();
  11023. var load_json_file_1 = require_load_json_file();
  11024. var worker_threads_1 = require("worker_threads");
  11025. var INTEGRITY_REGEX = /^([^-]+)-([a-z0-9+/=]+)$/i;
  11026. worker_threads_1.parentPort.on("message", handleMessage);
  11027. var cafsCache = /* @__PURE__ */ new Map();
  11028. var cafsStoreCache = /* @__PURE__ */ new Map();
  11029. var cafsLocker = /* @__PURE__ */ new Map();
  11030. async function handleMessage(message) {
  11031. if (message === false) {
  11032. worker_threads_1.parentPort.off("message", handleMessage);
  11033. process.exit(0);
  11034. }
  11035. try {
  11036. switch (message.type) {
  11037. case "extract": {
  11038. worker_threads_1.parentPort.postMessage(addTarballToStore(message));
  11039. break;
  11040. }
  11041. case "link": {
  11042. worker_threads_1.parentPort.postMessage(importPackage(message));
  11043. break;
  11044. }
  11045. case "add-dir": {
  11046. worker_threads_1.parentPort.postMessage(addFilesFromDir(message));
  11047. break;
  11048. }
  11049. case "init-store": {
  11050. worker_threads_1.parentPort.postMessage(initStore(message));
  11051. break;
  11052. }
  11053. case "readPkgFromCafs": {
  11054. let { storeDir, filesIndexFile, readManifest, verifyStoreIntegrity } = message;
  11055. let pkgFilesIndex;
  11056. try {
  11057. pkgFilesIndex = (0, load_json_file_1.sync)(filesIndexFile);
  11058. } catch {
  11059. }
  11060. if (!pkgFilesIndex) {
  11061. worker_threads_1.parentPort.postMessage({
  11062. status: "success",
  11063. value: {
  11064. verified: false,
  11065. pkgFilesIndex: null
  11066. }
  11067. });
  11068. return;
  11069. }
  11070. let verifyResult;
  11071. if (pkgFilesIndex.requiresBuild == null) {
  11072. readManifest = true;
  11073. }
  11074. if (verifyStoreIntegrity) {
  11075. verifyResult = (0, store_cafs_1.checkPkgFilesIntegrity)(storeDir, pkgFilesIndex, readManifest);
  11076. } else {
  11077. verifyResult = {
  11078. passed: true,
  11079. manifest: readManifest ? (0, store_cafs_1.readManifestFromStore)(storeDir, pkgFilesIndex) : void 0
  11080. };
  11081. }
  11082. const requiresBuild = pkgFilesIndex.requiresBuild ?? (0, exec_pkg_requires_build_1.pkgRequiresBuild)(verifyResult.manifest, pkgFilesIndex.files);
  11083. worker_threads_1.parentPort.postMessage({
  11084. status: "success",
  11085. value: {
  11086. verified: verifyResult.passed,
  11087. manifest: verifyResult.manifest,
  11088. pkgFilesIndex,
  11089. requiresBuild
  11090. }
  11091. });
  11092. break;
  11093. }
  11094. case "symlinkAllModules": {
  11095. worker_threads_1.parentPort.postMessage(symlinkAllModules(message));
  11096. break;
  11097. }
  11098. case "hardLinkDir": {
  11099. (0, fs_hard_link_dir_1.hardLinkDir)(message.src, message.destDirs);
  11100. worker_threads_1.parentPort.postMessage({ status: "success" });
  11101. break;
  11102. }
  11103. }
  11104. } catch (e) {
  11105. worker_threads_1.parentPort.postMessage({
  11106. status: "error",
  11107. error: {
  11108. code: e.code,
  11109. message: e.message ?? e.toString()
  11110. }
  11111. });
  11112. }
  11113. }
  11114. function addTarballToStore({ buffer, storeDir, integrity, filesIndexFile }) {
  11115. if (integrity) {
  11116. const [, algo, integrityHash] = integrity.match(INTEGRITY_REGEX);
  11117. const normalizedRemoteHash = Buffer.from(integrityHash, "base64").toString("hex");
  11118. const calculatedHash = crypto.hash(algo, buffer, "hex");
  11119. if (calculatedHash !== normalizedRemoteHash) {
  11120. return {
  11121. status: "error",
  11122. error: {
  11123. type: "integrity_validation_failed",
  11124. algorithm: algo,
  11125. expected: integrity,
  11126. found: `${algo}-${Buffer.from(calculatedHash, "hex").toString("base64")}`
  11127. }
  11128. };
  11129. }
  11130. }
  11131. if (!cafsCache.has(storeDir)) {
  11132. cafsCache.set(storeDir, (0, store_cafs_1.createCafs)(storeDir));
  11133. }
  11134. const cafs = cafsCache.get(storeDir);
  11135. const { filesIndex, manifest } = cafs.addFilesFromTarball(buffer, true);
  11136. const { filesIntegrity, filesMap } = processFilesIndex(filesIndex);
  11137. const requiresBuild = writeFilesIndexFile(filesIndexFile, { manifest: manifest ?? {}, files: filesIntegrity });
  11138. return { status: "success", value: { filesIndex: filesMap, manifest, requiresBuild } };
  11139. }
  11140. function initStore({ storeDir }) {
  11141. fs_1.default.mkdirSync(storeDir, { recursive: true });
  11142. try {
  11143. const hexChars = "0123456789abcdef".split("");
  11144. for (const subDir of ["files", "index"]) {
  11145. const subDirPath = path_1.default.join(storeDir, subDir);
  11146. fs_1.default.mkdirSync(subDirPath);
  11147. for (const hex1 of hexChars) {
  11148. for (const hex2 of hexChars) {
  11149. fs_1.default.mkdirSync(path_1.default.join(subDirPath, `${hex1}${hex2}`));
  11150. }
  11151. }
  11152. }
  11153. } catch {
  11154. }
  11155. return { status: "success" };
  11156. }
  11157. function addFilesFromDir({ dir, storeDir, filesIndexFile, sideEffectsCacheKey, files }) {
  11158. if (!cafsCache.has(storeDir)) {
  11159. cafsCache.set(storeDir, (0, store_cafs_1.createCafs)(storeDir));
  11160. }
  11161. const cafs = cafsCache.get(storeDir);
  11162. const { filesIndex, manifest } = cafs.addFilesFromDir(dir, {
  11163. files,
  11164. readManifest: true
  11165. });
  11166. const { filesIntegrity, filesMap } = processFilesIndex(filesIndex);
  11167. let requiresBuild;
  11168. if (sideEffectsCacheKey) {
  11169. let filesIndex2;
  11170. try {
  11171. filesIndex2 = (0, load_json_file_1.sync)(filesIndexFile);
  11172. } catch {
  11173. return {
  11174. status: "success",
  11175. value: {
  11176. filesIndex: filesMap,
  11177. manifest,
  11178. requiresBuild: (0, exec_pkg_requires_build_1.pkgRequiresBuild)(manifest, filesIntegrity)
  11179. }
  11180. };
  11181. }
  11182. filesIndex2.sideEffects = filesIndex2.sideEffects ?? {};
  11183. filesIndex2.sideEffects[sideEffectsCacheKey] = calculateDiff(filesIndex2.files, filesIntegrity);
  11184. if (filesIndex2.requiresBuild == null) {
  11185. requiresBuild = (0, exec_pkg_requires_build_1.pkgRequiresBuild)(manifest, filesIntegrity);
  11186. } else {
  11187. requiresBuild = filesIndex2.requiresBuild;
  11188. }
  11189. writeJsonFile(filesIndexFile, filesIndex2);
  11190. } else {
  11191. requiresBuild = writeFilesIndexFile(filesIndexFile, { manifest: manifest ?? {}, files: filesIntegrity });
  11192. }
  11193. return { status: "success", value: { filesIndex: filesMap, manifest, requiresBuild } };
  11194. }
  11195. function calculateDiff(baseFiles, sideEffectsFiles) {
  11196. const deleted = [];
  11197. const added = {};
  11198. for (const file of /* @__PURE__ */ new Set([...Object.keys(baseFiles), ...Object.keys(sideEffectsFiles)])) {
  11199. if (!sideEffectsFiles[file]) {
  11200. deleted.push(file);
  11201. } else if (!baseFiles[file] || baseFiles[file].integrity !== sideEffectsFiles[file].integrity || baseFiles[file].mode !== sideEffectsFiles[file].mode) {
  11202. added[file] = sideEffectsFiles[file];
  11203. }
  11204. }
  11205. const diff = {};
  11206. if (deleted.length > 0) {
  11207. diff.deleted = deleted;
  11208. }
  11209. if (Object.keys(added).length > 0) {
  11210. diff.added = added;
  11211. }
  11212. return diff;
  11213. }
  11214. function processFilesIndex(filesIndex) {
  11215. const filesIntegrity = {};
  11216. const filesMap = {};
  11217. for (const [k, { checkedAt, filePath, integrity, mode, size }] of Object.entries(filesIndex)) {
  11218. filesIntegrity[k] = {
  11219. checkedAt,
  11220. integrity: integrity.toString(),
  11221. // TODO: use the raw Integrity object
  11222. mode,
  11223. size
  11224. };
  11225. filesMap[k] = filePath;
  11226. }
  11227. return { filesIntegrity, filesMap };
  11228. }
  11229. function importPackage({ storeDir, packageImportMethod, filesResponse, sideEffectsCacheKey, targetDir, requiresBuild, force, keepModulesDir, disableRelinkLocalDirDeps }) {
  11230. const cacheKey = JSON.stringify({ storeDir, packageImportMethod });
  11231. if (!cafsStoreCache.has(cacheKey)) {
  11232. cafsStoreCache.set(cacheKey, (0, create_cafs_store_1.createCafsStore)(storeDir, { packageImportMethod, cafsLocker }));
  11233. }
  11234. const cafsStore = cafsStoreCache.get(cacheKey);
  11235. const { importMethod, isBuilt } = cafsStore.importPackage(targetDir, {
  11236. filesResponse,
  11237. force,
  11238. disableRelinkLocalDirDeps,
  11239. requiresBuild,
  11240. sideEffectsCacheKey,
  11241. keepModulesDir
  11242. });
  11243. return { status: "success", value: { isBuilt, importMethod } };
  11244. }
  11245. function symlinkAllModules(opts) {
  11246. for (const dep of opts.deps) {
  11247. for (const [alias, pkgDir] of Object.entries(dep.children)) {
  11248. if (alias !== dep.name) {
  11249. (0, symlink_dependency_1.symlinkDependencySync)(pkgDir, dep.modules, alias);
  11250. }
  11251. }
  11252. }
  11253. return { status: "success" };
  11254. }
  11255. function writeFilesIndexFile(filesIndexFile, { manifest, files, sideEffects }) {
  11256. const requiresBuild = (0, exec_pkg_requires_build_1.pkgRequiresBuild)(manifest, files);
  11257. const filesIndex = {
  11258. name: manifest.name,
  11259. version: manifest.version,
  11260. requiresBuild,
  11261. files,
  11262. sideEffects
  11263. };
  11264. writeJsonFile(filesIndexFile, filesIndex);
  11265. return requiresBuild;
  11266. }
  11267. function writeJsonFile(filePath, data) {
  11268. const targetDir = path_1.default.dirname(filePath);
  11269. fs_1.default.mkdirSync(targetDir, { recursive: true });
  11270. const temp = `${filePath.slice(0, -11)}${process.pid}`;
  11271. graceful_fs_1.default.writeFileSync(temp, JSON.stringify(data));
  11272. (0, store_cafs_1.optimisticRenameOverwrite)(temp, filePath);
  11273. }
  11274. process.on("uncaughtException", (err) => {
  11275. console.error(err);
  11276. });
  11277. /*! Bundled license information:
  11278. safe-buffer/index.js:
  11279. (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
  11280. is-windows/index.js:
  11281. (*!
  11282. * is-windows <https://github.com/jonschlinkert/is-windows>
  11283. *
  11284. * Copyright © 2015-2018, Jon Schlinkert.
  11285. * Released under the MIT License.
  11286. *)
  11287. */