12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136 |
- "use strict";
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
- };
- // node_modules/core-js/internals/global.js
- var require_global = __commonJS({
- "node_modules/core-js/internals/global.js"(exports2, module2) {
- var check = function(it) {
- return it && it.Math == Math && it;
- };
- module2.exports = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof global == "object" && global) || function() {
- return this;
- }() || Function("return this")();
- }
- });
- // node_modules/core-js/internals/fails.js
- var require_fails = __commonJS({
- "node_modules/core-js/internals/fails.js"(exports2, module2) {
- module2.exports = function(exec) {
- try {
- return !!exec();
- } catch (error) {
- return true;
- }
- };
- }
- });
- // node_modules/core-js/internals/descriptors.js
- var require_descriptors = __commonJS({
- "node_modules/core-js/internals/descriptors.js"(exports2, module2) {
- var fails = require_fails();
- module2.exports = !fails(function() {
- return Object.defineProperty({}, 1, { get: function() {
- return 7;
- } })[1] != 7;
- });
- }
- });
- // node_modules/core-js/internals/function-bind-native.js
- var require_function_bind_native = __commonJS({
- "node_modules/core-js/internals/function-bind-native.js"(exports2, module2) {
- var fails = require_fails();
- module2.exports = !fails(function() {
- var test = function() {
- }.bind();
- return typeof test != "function" || test.hasOwnProperty("prototype");
- });
- }
- });
- // node_modules/core-js/internals/function-call.js
- var require_function_call = __commonJS({
- "node_modules/core-js/internals/function-call.js"(exports2, module2) {
- var NATIVE_BIND = require_function_bind_native();
- var call = Function.prototype.call;
- module2.exports = NATIVE_BIND ? call.bind(call) : function() {
- return call.apply(call, arguments);
- };
- }
- });
- // node_modules/core-js/internals/object-property-is-enumerable.js
- var require_object_property_is_enumerable = __commonJS({
- "node_modules/core-js/internals/object-property-is-enumerable.js"(exports2) {
- "use strict";
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
- exports2.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
- var descriptor = getOwnPropertyDescriptor(this, V);
- return !!descriptor && descriptor.enumerable;
- } : $propertyIsEnumerable;
- }
- });
- // node_modules/core-js/internals/create-property-descriptor.js
- var require_create_property_descriptor = __commonJS({
- "node_modules/core-js/internals/create-property-descriptor.js"(exports2, module2) {
- module2.exports = function(bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value
- };
- };
- }
- });
- // node_modules/core-js/internals/function-uncurry-this.js
- var require_function_uncurry_this = __commonJS({
- "node_modules/core-js/internals/function-uncurry-this.js"(exports2, module2) {
- var NATIVE_BIND = require_function_bind_native();
- var FunctionPrototype = Function.prototype;
- var bind = FunctionPrototype.bind;
- var call = FunctionPrototype.call;
- var uncurryThis = NATIVE_BIND && bind.bind(call, call);
- module2.exports = NATIVE_BIND ? function(fn) {
- return fn && uncurryThis(fn);
- } : function(fn) {
- return fn && function() {
- return call.apply(fn, arguments);
- };
- };
- }
- });
- // node_modules/core-js/internals/classof-raw.js
- var require_classof_raw = __commonJS({
- "node_modules/core-js/internals/classof-raw.js"(exports2, module2) {
- var uncurryThis = require_function_uncurry_this();
- var toString = uncurryThis({}.toString);
- var stringSlice = uncurryThis("".slice);
- module2.exports = function(it) {
- return stringSlice(toString(it), 8, -1);
- };
- }
- });
- // node_modules/core-js/internals/indexed-object.js
- var require_indexed_object = __commonJS({
- "node_modules/core-js/internals/indexed-object.js"(exports2, module2) {
- var global2 = require_global();
- var uncurryThis = require_function_uncurry_this();
- var fails = require_fails();
- var classof = require_classof_raw();
- var Object2 = global2.Object;
- var split = uncurryThis("".split);
- module2.exports = fails(function() {
- return !Object2("z").propertyIsEnumerable(0);
- }) ? function(it) {
- return classof(it) == "String" ? split(it, "") : Object2(it);
- } : Object2;
- }
- });
- // node_modules/core-js/internals/require-object-coercible.js
- var require_require_object_coercible = __commonJS({
- "node_modules/core-js/internals/require-object-coercible.js"(exports2, module2) {
- var global2 = require_global();
- var TypeError2 = global2.TypeError;
- module2.exports = function(it) {
- if (it == void 0)
- throw TypeError2("Can't call method on " + it);
- return it;
- };
- }
- });
- // node_modules/core-js/internals/to-indexed-object.js
- var require_to_indexed_object = __commonJS({
- "node_modules/core-js/internals/to-indexed-object.js"(exports2, module2) {
- var IndexedObject = require_indexed_object();
- var requireObjectCoercible = require_require_object_coercible();
- module2.exports = function(it) {
- return IndexedObject(requireObjectCoercible(it));
- };
- }
- });
- // node_modules/core-js/internals/is-callable.js
- var require_is_callable = __commonJS({
- "node_modules/core-js/internals/is-callable.js"(exports2, module2) {
- module2.exports = function(argument) {
- return typeof argument == "function";
- };
- }
- });
- // node_modules/core-js/internals/is-object.js
- var require_is_object = __commonJS({
- "node_modules/core-js/internals/is-object.js"(exports2, module2) {
- var isCallable = require_is_callable();
- module2.exports = function(it) {
- return typeof it == "object" ? it !== null : isCallable(it);
- };
- }
- });
- // node_modules/core-js/internals/get-built-in.js
- var require_get_built_in = __commonJS({
- "node_modules/core-js/internals/get-built-in.js"(exports2, module2) {
- var global2 = require_global();
- var isCallable = require_is_callable();
- var aFunction = function(argument) {
- return isCallable(argument) ? argument : void 0;
- };
- module2.exports = function(namespace, method) {
- return arguments.length < 2 ? aFunction(global2[namespace]) : global2[namespace] && global2[namespace][method];
- };
- }
- });
- // node_modules/core-js/internals/object-is-prototype-of.js
- var require_object_is_prototype_of = __commonJS({
- "node_modules/core-js/internals/object-is-prototype-of.js"(exports2, module2) {
- var uncurryThis = require_function_uncurry_this();
- module2.exports = uncurryThis({}.isPrototypeOf);
- }
- });
- // node_modules/core-js/internals/engine-user-agent.js
- var require_engine_user_agent = __commonJS({
- "node_modules/core-js/internals/engine-user-agent.js"(exports2, module2) {
- var getBuiltIn = require_get_built_in();
- module2.exports = getBuiltIn("navigator", "userAgent") || "";
- }
- });
- // node_modules/core-js/internals/engine-v8-version.js
- var require_engine_v8_version = __commonJS({
- "node_modules/core-js/internals/engine-v8-version.js"(exports2, module2) {
- var global2 = require_global();
- var userAgent = require_engine_user_agent();
- var process2 = global2.process;
- var Deno = global2.Deno;
- var versions = process2 && process2.versions || Deno && Deno.version;
- var v8 = versions && versions.v8;
- var match;
- var version;
- if (v8) {
- match = v8.split(".");
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
- }
- if (!version && userAgent) {
- match = userAgent.match(/Edge\/(\d+)/);
- if (!match || match[1] >= 74) {
- match = userAgent.match(/Chrome\/(\d+)/);
- if (match)
- version = +match[1];
- }
- }
- module2.exports = version;
- }
- });
- // node_modules/core-js/internals/native-symbol.js
- var require_native_symbol = __commonJS({
- "node_modules/core-js/internals/native-symbol.js"(exports2, module2) {
- var V8_VERSION = require_engine_v8_version();
- var fails = require_fails();
- module2.exports = !!Object.getOwnPropertySymbols && !fails(function() {
- var symbol = Symbol();
- return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
- });
- }
- });
- // node_modules/core-js/internals/use-symbol-as-uid.js
- var require_use_symbol_as_uid = __commonJS({
- "node_modules/core-js/internals/use-symbol-as-uid.js"(exports2, module2) {
- var NATIVE_SYMBOL = require_native_symbol();
- module2.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol";
- }
- });
- // node_modules/core-js/internals/is-symbol.js
- var require_is_symbol = __commonJS({
- "node_modules/core-js/internals/is-symbol.js"(exports2, module2) {
- var global2 = require_global();
- var getBuiltIn = require_get_built_in();
- var isCallable = require_is_callable();
- var isPrototypeOf = require_object_is_prototype_of();
- var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
- var Object2 = global2.Object;
- module2.exports = USE_SYMBOL_AS_UID ? function(it) {
- return typeof it == "symbol";
- } : function(it) {
- var $Symbol = getBuiltIn("Symbol");
- return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object2(it));
- };
- }
- });
- // node_modules/core-js/internals/try-to-string.js
- var require_try_to_string = __commonJS({
- "node_modules/core-js/internals/try-to-string.js"(exports2, module2) {
- var global2 = require_global();
- var String2 = global2.String;
- module2.exports = function(argument) {
- try {
- return String2(argument);
- } catch (error) {
- return "Object";
- }
- };
- }
- });
- // node_modules/core-js/internals/a-callable.js
- var require_a_callable = __commonJS({
- "node_modules/core-js/internals/a-callable.js"(exports2, module2) {
- var global2 = require_global();
- var isCallable = require_is_callable();
- var tryToString = require_try_to_string();
- var TypeError2 = global2.TypeError;
- module2.exports = function(argument) {
- if (isCallable(argument))
- return argument;
- throw TypeError2(tryToString(argument) + " is not a function");
- };
- }
- });
- // node_modules/core-js/internals/get-method.js
- var require_get_method = __commonJS({
- "node_modules/core-js/internals/get-method.js"(exports2, module2) {
- var aCallable = require_a_callable();
- module2.exports = function(V, P) {
- var func = V[P];
- return func == null ? void 0 : aCallable(func);
- };
- }
- });
- // node_modules/core-js/internals/ordinary-to-primitive.js
- var require_ordinary_to_primitive = __commonJS({
- "node_modules/core-js/internals/ordinary-to-primitive.js"(exports2, module2) {
- var global2 = require_global();
- var call = require_function_call();
- var isCallable = require_is_callable();
- var isObject = require_is_object();
- var TypeError2 = global2.TypeError;
- module2.exports = function(input, pref) {
- var fn, val;
- if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
- return val;
- if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
- return val;
- if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
- return val;
- throw TypeError2("Can't convert object to primitive value");
- };
- }
- });
- // node_modules/core-js/internals/is-pure.js
- var require_is_pure = __commonJS({
- "node_modules/core-js/internals/is-pure.js"(exports2, module2) {
- module2.exports = false;
- }
- });
- // node_modules/core-js/internals/set-global.js
- var require_set_global = __commonJS({
- "node_modules/core-js/internals/set-global.js"(exports2, module2) {
- var global2 = require_global();
- var defineProperty = Object.defineProperty;
- module2.exports = function(key, value) {
- try {
- defineProperty(global2, key, { value, configurable: true, writable: true });
- } catch (error) {
- global2[key] = value;
- }
- return value;
- };
- }
- });
- // node_modules/core-js/internals/shared-store.js
- var require_shared_store = __commonJS({
- "node_modules/core-js/internals/shared-store.js"(exports2, module2) {
- var global2 = require_global();
- var setGlobal = require_set_global();
- var SHARED = "__core-js_shared__";
- var store = global2[SHARED] || setGlobal(SHARED, {});
- module2.exports = store;
- }
- });
- // node_modules/core-js/internals/shared.js
- var require_shared = __commonJS({
- "node_modules/core-js/internals/shared.js"(exports2, module2) {
- var IS_PURE = require_is_pure();
- var store = require_shared_store();
- (module2.exports = function(key, value) {
- return store[key] || (store[key] = value !== void 0 ? value : {});
- })("versions", []).push({
- version: "3.22.2",
- mode: IS_PURE ? "pure" : "global",
- copyright: "\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",
- license: "https://github.com/zloirock/core-js/blob/v3.22.2/LICENSE",
- source: "https://github.com/zloirock/core-js"
- });
- }
- });
- // node_modules/core-js/internals/to-object.js
- var require_to_object = __commonJS({
- "node_modules/core-js/internals/to-object.js"(exports2, module2) {
- var global2 = require_global();
- var requireObjectCoercible = require_require_object_coercible();
- var Object2 = global2.Object;
- module2.exports = function(argument) {
- return Object2(requireObjectCoercible(argument));
- };
- }
- });
- // node_modules/core-js/internals/has-own-property.js
- var require_has_own_property = __commonJS({
- "node_modules/core-js/internals/has-own-property.js"(exports2, module2) {
- var uncurryThis = require_function_uncurry_this();
- var toObject = require_to_object();
- var hasOwnProperty = uncurryThis({}.hasOwnProperty);
- module2.exports = Object.hasOwn || function hasOwn(it, key) {
- return hasOwnProperty(toObject(it), key);
- };
- }
- });
- // node_modules/core-js/internals/uid.js
- var require_uid = __commonJS({
- "node_modules/core-js/internals/uid.js"(exports2, module2) {
- var uncurryThis = require_function_uncurry_this();
- var id = 0;
- var postfix = Math.random();
- var toString = uncurryThis(1 .toString);
- module2.exports = function(key) {
- return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString(++id + postfix, 36);
- };
- }
- });
- // node_modules/core-js/internals/well-known-symbol.js
- var require_well_known_symbol = __commonJS({
- "node_modules/core-js/internals/well-known-symbol.js"(exports2, module2) {
- var global2 = require_global();
- var shared = require_shared();
- var hasOwn = require_has_own_property();
- var uid = require_uid();
- var NATIVE_SYMBOL = require_native_symbol();
- var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
- var WellKnownSymbolsStore = shared("wks");
- var Symbol2 = global2.Symbol;
- var symbolFor = Symbol2 && Symbol2["for"];
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol2 : Symbol2 && Symbol2.withoutSetter || uid;
- module2.exports = function(name) {
- if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == "string")) {
- var description = "Symbol." + name;
- if (NATIVE_SYMBOL && hasOwn(Symbol2, name)) {
- WellKnownSymbolsStore[name] = Symbol2[name];
- } else if (USE_SYMBOL_AS_UID && symbolFor) {
- WellKnownSymbolsStore[name] = symbolFor(description);
- } else {
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
- }
- }
- return WellKnownSymbolsStore[name];
- };
- }
- });
- // node_modules/core-js/internals/to-primitive.js
- var require_to_primitive = __commonJS({
- "node_modules/core-js/internals/to-primitive.js"(exports2, module2) {
- var global2 = require_global();
- var call = require_function_call();
- var isObject = require_is_object();
- var isSymbol = require_is_symbol();
- var getMethod = require_get_method();
- var ordinaryToPrimitive = require_ordinary_to_primitive();
- var wellKnownSymbol = require_well_known_symbol();
- var TypeError2 = global2.TypeError;
- var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
- module2.exports = function(input, pref) {
- if (!isObject(input) || isSymbol(input))
- return input;
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
- var result;
- if (exoticToPrim) {
- if (pref === void 0)
- pref = "default";
- result = call(exoticToPrim, input, pref);
- if (!isObject(result) || isSymbol(result))
- return result;
- throw TypeError2("Can't convert object to primitive value");
- }
- if (pref === void 0)
- pref = "number";
- return ordinaryToPrimitive(input, pref);
- };
- }
- });
- // node_modules/core-js/internals/to-property-key.js
- var require_to_property_key = __commonJS({
- "node_modules/core-js/internals/to-property-key.js"(exports2, module2) {
- var toPrimitive = require_to_primitive();
- var isSymbol = require_is_symbol();
- module2.exports = function(argument) {
- var key = toPrimitive(argument, "string");
- return isSymbol(key) ? key : key + "";
- };
- }
- });
- // node_modules/core-js/internals/document-create-element.js
- var require_document_create_element = __commonJS({
- "node_modules/core-js/internals/document-create-element.js"(exports2, module2) {
- var global2 = require_global();
- var isObject = require_is_object();
- var document = global2.document;
- var EXISTS = isObject(document) && isObject(document.createElement);
- module2.exports = function(it) {
- return EXISTS ? document.createElement(it) : {};
- };
- }
- });
- // node_modules/core-js/internals/ie8-dom-define.js
- var require_ie8_dom_define = __commonJS({
- "node_modules/core-js/internals/ie8-dom-define.js"(exports2, module2) {
- var DESCRIPTORS = require_descriptors();
- var fails = require_fails();
- var createElement = require_document_create_element();
- module2.exports = !DESCRIPTORS && !fails(function() {
- return Object.defineProperty(createElement("div"), "a", {
- get: function() {
- return 7;
- }
- }).a != 7;
- });
- }
- });
- // node_modules/core-js/internals/object-get-own-property-descriptor.js
- var require_object_get_own_property_descriptor = __commonJS({
- "node_modules/core-js/internals/object-get-own-property-descriptor.js"(exports2) {
- var DESCRIPTORS = require_descriptors();
- var call = require_function_call();
- var propertyIsEnumerableModule = require_object_property_is_enumerable();
- var createPropertyDescriptor = require_create_property_descriptor();
- var toIndexedObject = require_to_indexed_object();
- var toPropertyKey = require_to_property_key();
- var hasOwn = require_has_own_property();
- var IE8_DOM_DEFINE = require_ie8_dom_define();
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- exports2.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
- O = toIndexedObject(O);
- P = toPropertyKey(P);
- if (IE8_DOM_DEFINE)
- try {
- return $getOwnPropertyDescriptor(O, P);
- } catch (error) {
- }
- if (hasOwn(O, P))
- return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
- };
- }
- });
- // node_modules/core-js/internals/v8-prototype-define-bug.js
- var require_v8_prototype_define_bug = __commonJS({
- "node_modules/core-js/internals/v8-prototype-define-bug.js"(exports2, module2) {
- var DESCRIPTORS = require_descriptors();
- var fails = require_fails();
- module2.exports = DESCRIPTORS && fails(function() {
- return Object.defineProperty(function() {
- }, "prototype", {
- value: 42,
- writable: false
- }).prototype != 42;
- });
- }
- });
- // node_modules/core-js/internals/an-object.js
- var require_an_object = __commonJS({
- "node_modules/core-js/internals/an-object.js"(exports2, module2) {
- var global2 = require_global();
- var isObject = require_is_object();
- var String2 = global2.String;
- var TypeError2 = global2.TypeError;
- module2.exports = function(argument) {
- if (isObject(argument))
- return argument;
- throw TypeError2(String2(argument) + " is not an object");
- };
- }
- });
- // node_modules/core-js/internals/object-define-property.js
- var require_object_define_property = __commonJS({
- "node_modules/core-js/internals/object-define-property.js"(exports2) {
- var global2 = require_global();
- var DESCRIPTORS = require_descriptors();
- var IE8_DOM_DEFINE = require_ie8_dom_define();
- var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug();
- var anObject = require_an_object();
- var toPropertyKey = require_to_property_key();
- var TypeError2 = global2.TypeError;
- var $defineProperty = Object.defineProperty;
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- var ENUMERABLE = "enumerable";
- var CONFIGURABLE = "configurable";
- var WRITABLE = "writable";
- exports2.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
- var current = $getOwnPropertyDescriptor(O, P);
- if (current && current[WRITABLE]) {
- O[P] = Attributes.value;
- Attributes = {
- configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
- writable: false
- };
- }
- }
- return $defineProperty(O, P, Attributes);
- } : $defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (IE8_DOM_DEFINE)
- try {
- return $defineProperty(O, P, Attributes);
- } catch (error) {
- }
- if ("get" in Attributes || "set" in Attributes)
- throw TypeError2("Accessors not supported");
- if ("value" in Attributes)
- O[P] = Attributes.value;
- return O;
- };
- }
- });
- // node_modules/core-js/internals/create-non-enumerable-property.js
- var require_create_non_enumerable_property = __commonJS({
- "node_modules/core-js/internals/create-non-enumerable-property.js"(exports2, module2) {
- var DESCRIPTORS = require_descriptors();
- var definePropertyModule = require_object_define_property();
- var createPropertyDescriptor = require_create_property_descriptor();
- module2.exports = DESCRIPTORS ? function(object, key, value) {
- return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
- } : function(object, key, value) {
- object[key] = value;
- return object;
- };
- }
- });
- // node_modules/core-js/internals/inspect-source.js
- var require_inspect_source = __commonJS({
- "node_modules/core-js/internals/inspect-source.js"(exports2, module2) {
- var uncurryThis = require_function_uncurry_this();
- var isCallable = require_is_callable();
- var store = require_shared_store();
- var functionToString = uncurryThis(Function.toString);
- if (!isCallable(store.inspectSource)) {
- store.inspectSource = function(it) {
- return functionToString(it);
- };
- }
- module2.exports = store.inspectSource;
- }
- });
- // node_modules/core-js/internals/native-weak-map.js
- var require_native_weak_map = __commonJS({
- "node_modules/core-js/internals/native-weak-map.js"(exports2, module2) {
- var global2 = require_global();
- var isCallable = require_is_callable();
- var inspectSource = require_inspect_source();
- var WeakMap2 = global2.WeakMap;
- module2.exports = isCallable(WeakMap2) && /native code/.test(inspectSource(WeakMap2));
- }
- });
- // node_modules/core-js/internals/shared-key.js
- var require_shared_key = __commonJS({
- "node_modules/core-js/internals/shared-key.js"(exports2, module2) {
- var shared = require_shared();
- var uid = require_uid();
- var keys = shared("keys");
- module2.exports = function(key) {
- return keys[key] || (keys[key] = uid(key));
- };
- }
- });
- // node_modules/core-js/internals/hidden-keys.js
- var require_hidden_keys = __commonJS({
- "node_modules/core-js/internals/hidden-keys.js"(exports2, module2) {
- module2.exports = {};
- }
- });
- // node_modules/core-js/internals/internal-state.js
- var require_internal_state = __commonJS({
- "node_modules/core-js/internals/internal-state.js"(exports2, module2) {
- var NATIVE_WEAK_MAP = require_native_weak_map();
- var global2 = require_global();
- var uncurryThis = require_function_uncurry_this();
- var isObject = require_is_object();
- var createNonEnumerableProperty = require_create_non_enumerable_property();
- var hasOwn = require_has_own_property();
- var shared = require_shared_store();
- var sharedKey = require_shared_key();
- var hiddenKeys = require_hidden_keys();
- var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
- var TypeError2 = global2.TypeError;
- var WeakMap2 = global2.WeakMap;
- var set;
- var get;
- var has;
- var enforce = function(it) {
- return has(it) ? get(it) : set(it, {});
- };
- var getterFor = function(TYPE) {
- return function(it) {
- var state;
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
- throw TypeError2("Incompatible receiver, " + TYPE + " required");
- }
- return state;
- };
- };
- if (NATIVE_WEAK_MAP || shared.state) {
- store = shared.state || (shared.state = new WeakMap2());
- wmget = uncurryThis(store.get);
- wmhas = uncurryThis(store.has);
- wmset = uncurryThis(store.set);
- set = function(it, metadata) {
- if (wmhas(store, it))
- throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- wmset(store, it, metadata);
- return metadata;
- };
- get = function(it) {
- return wmget(store, it) || {};
- };
- has = function(it) {
- return wmhas(store, it);
- };
- } else {
- STATE = sharedKey("state");
- hiddenKeys[STATE] = true;
- set = function(it, metadata) {
- if (hasOwn(it, STATE))
- throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- createNonEnumerableProperty(it, STATE, metadata);
- return metadata;
- };
- get = function(it) {
- return hasOwn(it, STATE) ? it[STATE] : {};
- };
- has = function(it) {
- return hasOwn(it, STATE);
- };
- }
- var store;
- var wmget;
- var wmhas;
- var wmset;
- var STATE;
- module2.exports = {
- set,
- get,
- has,
- enforce,
- getterFor
- };
- }
- });
- // node_modules/core-js/internals/function-name.js
- var require_function_name = __commonJS({
- "node_modules/core-js/internals/function-name.js"(exports2, module2) {
- var DESCRIPTORS = require_descriptors();
- var hasOwn = require_has_own_property();
- var FunctionPrototype = Function.prototype;
- var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
- var EXISTS = hasOwn(FunctionPrototype, "name");
- var PROPER = EXISTS && function something() {
- }.name === "something";
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
- module2.exports = {
- EXISTS,
- PROPER,
- CONFIGURABLE
- };
- }
- });
- // node_modules/core-js/internals/redefine.js
- var require_redefine = __commonJS({
- "node_modules/core-js/internals/redefine.js"(exports2, module2) {
- var global2 = require_global();
- var isCallable = require_is_callable();
- var hasOwn = require_has_own_property();
- var createNonEnumerableProperty = require_create_non_enumerable_property();
- var setGlobal = require_set_global();
- var inspectSource = require_inspect_source();
- var InternalStateModule = require_internal_state();
- var CONFIGURABLE_FUNCTION_NAME = require_function_name().CONFIGURABLE;
- var getInternalState = InternalStateModule.get;
- var enforceInternalState = InternalStateModule.enforce;
- var TEMPLATE = String(String).split("String");
- (module2.exports = function(O, key, value, options) {
- var unsafe = options ? !!options.unsafe : false;
- var simple = options ? !!options.enumerable : false;
- var noTargetGet = options ? !!options.noTargetGet : false;
- var name = options && options.name !== void 0 ? options.name : key;
- var state;
- if (isCallable(value)) {
- if (String(name).slice(0, 7) === "Symbol(") {
- name = "[" + String(name).replace(/^Symbol\(([^)]*)\)/, "$1") + "]";
- }
- if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
- createNonEnumerableProperty(value, "name", name);
- }
- state = enforceInternalState(value);
- if (!state.source) {
- state.source = TEMPLATE.join(typeof name == "string" ? name : "");
- }
- }
- if (O === global2) {
- if (simple)
- O[key] = value;
- else
- setGlobal(key, value);
- return;
- } else if (!unsafe) {
- delete O[key];
- } else if (!noTargetGet && O[key]) {
- simple = true;
- }
- if (simple)
- O[key] = value;
- else
- createNonEnumerableProperty(O, key, value);
- })(Function.prototype, "toString", function toString() {
- return isCallable(this) && getInternalState(this).source || inspectSource(this);
- });
- }
- });
- // node_modules/core-js/internals/to-integer-or-infinity.js
- var require_to_integer_or_infinity = __commonJS({
- "node_modules/core-js/internals/to-integer-or-infinity.js"(exports2, module2) {
- var ceil = Math.ceil;
- var floor = Math.floor;
- module2.exports = function(argument) {
- var number = +argument;
- return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
- };
- }
- });
- // node_modules/core-js/internals/to-absolute-index.js
- var require_to_absolute_index = __commonJS({
- "node_modules/core-js/internals/to-absolute-index.js"(exports2, module2) {
- var toIntegerOrInfinity = require_to_integer_or_infinity();
- var max = Math.max;
- var min = Math.min;
- module2.exports = function(index, length) {
- var integer = toIntegerOrInfinity(index);
- return integer < 0 ? max(integer + length, 0) : min(integer, length);
- };
- }
- });
- // node_modules/core-js/internals/to-length.js
- var require_to_length = __commonJS({
- "node_modules/core-js/internals/to-length.js"(exports2, module2) {
- var toIntegerOrInfinity = require_to_integer_or_infinity();
- var min = Math.min;
- module2.exports = function(argument) {
- return argument > 0 ? min(toIntegerOrInfinity(argument), 9007199254740991) : 0;
- };
- }
- });
- // node_modules/core-js/internals/length-of-array-like.js
- var require_length_of_array_like = __commonJS({
- "node_modules/core-js/internals/length-of-array-like.js"(exports2, module2) {
- var toLength = require_to_length();
- module2.exports = function(obj) {
- return toLength(obj.length);
- };
- }
- });
- // node_modules/core-js/internals/array-includes.js
- var require_array_includes = __commonJS({
- "node_modules/core-js/internals/array-includes.js"(exports2, module2) {
- var toIndexedObject = require_to_indexed_object();
- var toAbsoluteIndex = require_to_absolute_index();
- var lengthOfArrayLike = require_length_of_array_like();
- var createMethod = function(IS_INCLUDES) {
- return function($this, el, fromIndex) {
- var O = toIndexedObject($this);
- var length = lengthOfArrayLike(O);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- if (IS_INCLUDES && el != el)
- while (length > index) {
- value = O[index++];
- if (value != value)
- return true;
- }
- else
- for (; length > index; index++) {
- if ((IS_INCLUDES || index in O) && O[index] === el)
- return IS_INCLUDES || index || 0;
- }
- return !IS_INCLUDES && -1;
- };
- };
- module2.exports = {
- includes: createMethod(true),
- indexOf: createMethod(false)
- };
- }
- });
- // node_modules/core-js/internals/object-keys-internal.js
- var require_object_keys_internal = __commonJS({
- "node_modules/core-js/internals/object-keys-internal.js"(exports2, module2) {
- var uncurryThis = require_function_uncurry_this();
- var hasOwn = require_has_own_property();
- var toIndexedObject = require_to_indexed_object();
- var indexOf = require_array_includes().indexOf;
- var hiddenKeys = require_hidden_keys();
- var push = uncurryThis([].push);
- module2.exports = function(object, names) {
- var O = toIndexedObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O)
- !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
- while (names.length > i)
- if (hasOwn(O, key = names[i++])) {
- ~indexOf(result, key) || push(result, key);
- }
- return result;
- };
- }
- });
- // node_modules/core-js/internals/enum-bug-keys.js
- var require_enum_bug_keys = __commonJS({
- "node_modules/core-js/internals/enum-bug-keys.js"(exports2, module2) {
- module2.exports = [
- "constructor",
- "hasOwnProperty",
- "isPrototypeOf",
- "propertyIsEnumerable",
- "toLocaleString",
- "toString",
- "valueOf"
- ];
- }
- });
- // node_modules/core-js/internals/object-get-own-property-names.js
- var require_object_get_own_property_names = __commonJS({
- "node_modules/core-js/internals/object-get-own-property-names.js"(exports2) {
- var internalObjectKeys = require_object_keys_internal();
- var enumBugKeys = require_enum_bug_keys();
- var hiddenKeys = enumBugKeys.concat("length", "prototype");
- exports2.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return internalObjectKeys(O, hiddenKeys);
- };
- }
- });
- // node_modules/core-js/internals/object-get-own-property-symbols.js
- var require_object_get_own_property_symbols = __commonJS({
- "node_modules/core-js/internals/object-get-own-property-symbols.js"(exports2) {
- exports2.f = Object.getOwnPropertySymbols;
- }
- });
- // node_modules/core-js/internals/own-keys.js
- var require_own_keys = __commonJS({
- "node_modules/core-js/internals/own-keys.js"(exports2, module2) {
- var getBuiltIn = require_get_built_in();
- var uncurryThis = require_function_uncurry_this();
- var getOwnPropertyNamesModule = require_object_get_own_property_names();
- var getOwnPropertySymbolsModule = require_object_get_own_property_symbols();
- var anObject = require_an_object();
- var concat = uncurryThis([].concat);
- module2.exports = getBuiltIn("Reflect", "ownKeys") || function ownKeys(it) {
- var keys = getOwnPropertyNamesModule.f(anObject(it));
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
- };
- }
- });
- // node_modules/core-js/internals/copy-constructor-properties.js
- var require_copy_constructor_properties = __commonJS({
- "node_modules/core-js/internals/copy-constructor-properties.js"(exports2, module2) {
- var hasOwn = require_has_own_property();
- var ownKeys = require_own_keys();
- var getOwnPropertyDescriptorModule = require_object_get_own_property_descriptor();
- var definePropertyModule = require_object_define_property();
- module2.exports = function(target, source, exceptions) {
- var keys = ownKeys(source);
- var defineProperty = definePropertyModule.f;
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
- }
- }
- };
- }
- });
- // node_modules/core-js/internals/is-forced.js
- var require_is_forced = __commonJS({
- "node_modules/core-js/internals/is-forced.js"(exports2, module2) {
- var fails = require_fails();
- var isCallable = require_is_callable();
- var replacement = /#|\.prototype\./;
- var isForced = function(feature, detection) {
- var value = data[normalize(feature)];
- return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
- };
- var normalize = isForced.normalize = function(string) {
- return String(string).replace(replacement, ".").toLowerCase();
- };
- var data = isForced.data = {};
- var NATIVE = isForced.NATIVE = "N";
- var POLYFILL = isForced.POLYFILL = "P";
- module2.exports = isForced;
- }
- });
- // node_modules/core-js/internals/export.js
- var require_export = __commonJS({
- "node_modules/core-js/internals/export.js"(exports2, module2) {
- var global2 = require_global();
- var getOwnPropertyDescriptor = require_object_get_own_property_descriptor().f;
- var createNonEnumerableProperty = require_create_non_enumerable_property();
- var redefine = require_redefine();
- var setGlobal = require_set_global();
- var copyConstructorProperties = require_copy_constructor_properties();
- var isForced = require_is_forced();
- module2.exports = function(options, source) {
- var TARGET = options.target;
- var GLOBAL = options.global;
- var STATIC = options.stat;
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
- if (GLOBAL) {
- target = global2;
- } else if (STATIC) {
- target = global2[TARGET] || setGlobal(TARGET, {});
- } else {
- target = (global2[TARGET] || {}).prototype;
- }
- if (target)
- for (key in source) {
- sourceProperty = source[key];
- if (options.noTargetGet) {
- descriptor = getOwnPropertyDescriptor(target, key);
- targetProperty = descriptor && descriptor.value;
- } else
- targetProperty = target[key];
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
- if (!FORCED && targetProperty !== void 0) {
- if (typeof sourceProperty == typeof targetProperty)
- continue;
- copyConstructorProperties(sourceProperty, targetProperty);
- }
- if (options.sham || targetProperty && targetProperty.sham) {
- createNonEnumerableProperty(sourceProperty, "sham", true);
- }
- redefine(target, key, sourceProperty, options);
- }
- };
- }
- });
- // node_modules/core-js/internals/function-bind-context.js
- var require_function_bind_context = __commonJS({
- "node_modules/core-js/internals/function-bind-context.js"(exports2, module2) {
- var uncurryThis = require_function_uncurry_this();
- var aCallable = require_a_callable();
- var NATIVE_BIND = require_function_bind_native();
- var bind = uncurryThis(uncurryThis.bind);
- module2.exports = function(fn, that) {
- aCallable(fn);
- return that === void 0 ? fn : NATIVE_BIND ? bind(fn, that) : function() {
- return fn.apply(that, arguments);
- };
- };
- }
- });
- // node_modules/core-js/internals/iterators.js
- var require_iterators = __commonJS({
- "node_modules/core-js/internals/iterators.js"(exports2, module2) {
- module2.exports = {};
- }
- });
- // node_modules/core-js/internals/is-array-iterator-method.js
- var require_is_array_iterator_method = __commonJS({
- "node_modules/core-js/internals/is-array-iterator-method.js"(exports2, module2) {
- var wellKnownSymbol = require_well_known_symbol();
- var Iterators = require_iterators();
- var ITERATOR = wellKnownSymbol("iterator");
- var ArrayPrototype = Array.prototype;
- module2.exports = function(it) {
- return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
- };
- }
- });
- // node_modules/core-js/internals/to-string-tag-support.js
- var require_to_string_tag_support = __commonJS({
- "node_modules/core-js/internals/to-string-tag-support.js"(exports2, module2) {
- var wellKnownSymbol = require_well_known_symbol();
- var TO_STRING_TAG = wellKnownSymbol("toStringTag");
- var test = {};
- test[TO_STRING_TAG] = "z";
- module2.exports = String(test) === "[object z]";
- }
- });
- // node_modules/core-js/internals/classof.js
- var require_classof = __commonJS({
- "node_modules/core-js/internals/classof.js"(exports2, module2) {
- var global2 = require_global();
- var TO_STRING_TAG_SUPPORT = require_to_string_tag_support();
- var isCallable = require_is_callable();
- var classofRaw = require_classof_raw();
- var wellKnownSymbol = require_well_known_symbol();
- var TO_STRING_TAG = wellKnownSymbol("toStringTag");
- var Object2 = global2.Object;
- var CORRECT_ARGUMENTS = classofRaw(function() {
- return arguments;
- }()) == "Arguments";
- var tryGet = function(it, key) {
- try {
- return it[key];
- } catch (error) {
- }
- };
- module2.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
- var O, tag, result;
- return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = Object2(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == "Object" && isCallable(O.callee) ? "Arguments" : result;
- };
- }
- });
- // node_modules/core-js/internals/get-iterator-method.js
- var require_get_iterator_method = __commonJS({
- "node_modules/core-js/internals/get-iterator-method.js"(exports2, module2) {
- var classof = require_classof();
- var getMethod = require_get_method();
- var Iterators = require_iterators();
- var wellKnownSymbol = require_well_known_symbol();
- var ITERATOR = wellKnownSymbol("iterator");
- module2.exports = function(it) {
- if (it != void 0)
- return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
- };
- }
- });
- // node_modules/core-js/internals/get-iterator.js
- var require_get_iterator = __commonJS({
- "node_modules/core-js/internals/get-iterator.js"(exports2, module2) {
- var global2 = require_global();
- var call = require_function_call();
- var aCallable = require_a_callable();
- var anObject = require_an_object();
- var tryToString = require_try_to_string();
- var getIteratorMethod = require_get_iterator_method();
- var TypeError2 = global2.TypeError;
- module2.exports = function(argument, usingIterator) {
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
- if (aCallable(iteratorMethod))
- return anObject(call(iteratorMethod, argument));
- throw TypeError2(tryToString(argument) + " is not iterable");
- };
- }
- });
- // node_modules/core-js/internals/iterator-close.js
- var require_iterator_close = __commonJS({
- "node_modules/core-js/internals/iterator-close.js"(exports2, module2) {
- var call = require_function_call();
- var anObject = require_an_object();
- var getMethod = require_get_method();
- module2.exports = function(iterator, kind, value) {
- var innerResult, innerError;
- anObject(iterator);
- try {
- innerResult = getMethod(iterator, "return");
- if (!innerResult) {
- if (kind === "throw")
- throw value;
- return value;
- }
- innerResult = call(innerResult, iterator);
- } catch (error) {
- innerError = true;
- innerResult = error;
- }
- if (kind === "throw")
- throw value;
- if (innerError)
- throw innerResult;
- anObject(innerResult);
- return value;
- };
- }
- });
- // node_modules/core-js/internals/iterate.js
- var require_iterate = __commonJS({
- "node_modules/core-js/internals/iterate.js"(exports2, module2) {
- var global2 = require_global();
- var bind = require_function_bind_context();
- var call = require_function_call();
- var anObject = require_an_object();
- var tryToString = require_try_to_string();
- var isArrayIteratorMethod = require_is_array_iterator_method();
- var lengthOfArrayLike = require_length_of_array_like();
- var isPrototypeOf = require_object_is_prototype_of();
- var getIterator = require_get_iterator();
- var getIteratorMethod = require_get_iterator_method();
- var iteratorClose = require_iterator_close();
- var TypeError2 = global2.TypeError;
- var Result = function(stopped, result) {
- this.stopped = stopped;
- this.result = result;
- };
- var ResultPrototype = Result.prototype;
- module2.exports = function(iterable, unboundFunction, options) {
- var that = options && options.that;
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
- var INTERRUPTED = !!(options && options.INTERRUPTED);
- var fn = bind(unboundFunction, that);
- var iterator, iterFn, index, length, result, next, step;
- var stop = function(condition) {
- if (iterator)
- iteratorClose(iterator, "normal", condition);
- return new Result(true, condition);
- };
- var callFn = function(value) {
- if (AS_ENTRIES) {
- anObject(value);
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
- }
- return INTERRUPTED ? fn(value, stop) : fn(value);
- };
- if (IS_ITERATOR) {
- iterator = iterable;
- } else {
- iterFn = getIteratorMethod(iterable);
- if (!iterFn)
- throw TypeError2(tryToString(iterable) + " is not iterable");
- if (isArrayIteratorMethod(iterFn)) {
- for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
- result = callFn(iterable[index]);
- if (result && isPrototypeOf(ResultPrototype, result))
- return result;
- }
- return new Result(false);
- }
- iterator = getIterator(iterable, iterFn);
- }
- next = iterator.next;
- while (!(step = call(next, iterator)).done) {
- try {
- result = callFn(step.value);
- } catch (error) {
- iteratorClose(iterator, "throw", error);
- }
- if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result))
- return result;
- }
- return new Result(false);
- };
- }
- });
- // node_modules/core-js/internals/create-property.js
- var require_create_property = __commonJS({
- "node_modules/core-js/internals/create-property.js"(exports2, module2) {
- "use strict";
- var toPropertyKey = require_to_property_key();
- var definePropertyModule = require_object_define_property();
- var createPropertyDescriptor = require_create_property_descriptor();
- module2.exports = function(object, key, value) {
- var propertyKey = toPropertyKey(key);
- if (propertyKey in object)
- definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
- else
- object[propertyKey] = value;
- };
- }
- });
- // node_modules/core-js/modules/es.object.from-entries.js
- var require_es_object_from_entries = __commonJS({
- "node_modules/core-js/modules/es.object.from-entries.js"() {
- var $ = require_export();
- var iterate = require_iterate();
- var createProperty = require_create_property();
- $({ target: "Object", stat: true }, {
- fromEntries: function fromEntries(iterable) {
- var obj = {};
- iterate(iterable, function(k, v) {
- createProperty(obj, k, v);
- }, { AS_ENTRIES: true });
- return obj;
- }
- });
- }
- });
- // node_modules/core-js/internals/is-array.js
- var require_is_array = __commonJS({
- "node_modules/core-js/internals/is-array.js"(exports2, module2) {
- var classof = require_classof_raw();
- module2.exports = Array.isArray || function isArray(argument) {
- return classof(argument) == "Array";
- };
- }
- });
- // node_modules/core-js/internals/flatten-into-array.js
- var require_flatten_into_array = __commonJS({
- "node_modules/core-js/internals/flatten-into-array.js"(exports2, module2) {
- "use strict";
- var global2 = require_global();
- var isArray = require_is_array();
- var lengthOfArrayLike = require_length_of_array_like();
- var bind = require_function_bind_context();
- var TypeError2 = global2.TypeError;
- var flattenIntoArray = function(target, original, source, sourceLen, start, depth, mapper, thisArg) {
- var targetIndex = start;
- var sourceIndex = 0;
- var mapFn = mapper ? bind(mapper, thisArg) : false;
- var element, elementLen;
- while (sourceIndex < sourceLen) {
- if (sourceIndex in source) {
- element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
- if (depth > 0 && isArray(element)) {
- elementLen = lengthOfArrayLike(element);
- targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
- } else {
- if (targetIndex >= 9007199254740991)
- throw TypeError2("Exceed the acceptable array length");
- target[targetIndex] = element;
- }
- targetIndex++;
- }
- sourceIndex++;
- }
- return targetIndex;
- };
- module2.exports = flattenIntoArray;
- }
- });
- // node_modules/core-js/internals/is-constructor.js
- var require_is_constructor = __commonJS({
- "node_modules/core-js/internals/is-constructor.js"(exports2, module2) {
- var uncurryThis = require_function_uncurry_this();
- var fails = require_fails();
- var isCallable = require_is_callable();
- var classof = require_classof();
- var getBuiltIn = require_get_built_in();
- var inspectSource = require_inspect_source();
- var noop = function() {
- };
- var empty = [];
- var construct = getBuiltIn("Reflect", "construct");
- var constructorRegExp = /^\s*(?:class|function)\b/;
- var exec = uncurryThis(constructorRegExp.exec);
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
- var isConstructorModern = function isConstructor(argument) {
- if (!isCallable(argument))
- return false;
- try {
- construct(noop, empty, argument);
- return true;
- } catch (error) {
- return false;
- }
- };
- var isConstructorLegacy = function isConstructor(argument) {
- if (!isCallable(argument))
- return false;
- switch (classof(argument)) {
- case "AsyncFunction":
- case "GeneratorFunction":
- case "AsyncGeneratorFunction":
- return false;
- }
- try {
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
- } catch (error) {
- return true;
- }
- };
- isConstructorLegacy.sham = true;
- module2.exports = !construct || fails(function() {
- var called;
- return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() {
- called = true;
- }) || called;
- }) ? isConstructorLegacy : isConstructorModern;
- }
- });
- // node_modules/core-js/internals/array-species-constructor.js
- var require_array_species_constructor = __commonJS({
- "node_modules/core-js/internals/array-species-constructor.js"(exports2, module2) {
- var global2 = require_global();
- var isArray = require_is_array();
- var isConstructor = require_is_constructor();
- var isObject = require_is_object();
- var wellKnownSymbol = require_well_known_symbol();
- var SPECIES = wellKnownSymbol("species");
- var Array2 = global2.Array;
- module2.exports = function(originalArray) {
- var C;
- if (isArray(originalArray)) {
- C = originalArray.constructor;
- if (isConstructor(C) && (C === Array2 || isArray(C.prototype)))
- C = void 0;
- else if (isObject(C)) {
- C = C[SPECIES];
- if (C === null)
- C = void 0;
- }
- }
- return C === void 0 ? Array2 : C;
- };
- }
- });
- // node_modules/core-js/internals/array-species-create.js
- var require_array_species_create = __commonJS({
- "node_modules/core-js/internals/array-species-create.js"(exports2, module2) {
- var arraySpeciesConstructor = require_array_species_constructor();
- module2.exports = function(originalArray, length) {
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
- };
- }
- });
- // node_modules/core-js/modules/es.array.flat-map.js
- var require_es_array_flat_map = __commonJS({
- "node_modules/core-js/modules/es.array.flat-map.js"() {
- "use strict";
- var $ = require_export();
- var flattenIntoArray = require_flatten_into_array();
- var aCallable = require_a_callable();
- var toObject = require_to_object();
- var lengthOfArrayLike = require_length_of_array_like();
- var arraySpeciesCreate = require_array_species_create();
- $({ target: "Array", proto: true }, {
- flatMap: function flatMap(callbackfn) {
- var O = toObject(this);
- var sourceLen = lengthOfArrayLike(O);
- var A;
- aCallable(callbackfn);
- A = arraySpeciesCreate(O, 0);
- A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : void 0);
- return A;
- }
- });
- }
- });
- // node_modules/core-js/modules/es.array.flat.js
- var require_es_array_flat = __commonJS({
- "node_modules/core-js/modules/es.array.flat.js"() {
- "use strict";
- var $ = require_export();
- var flattenIntoArray = require_flatten_into_array();
- var toObject = require_to_object();
- var lengthOfArrayLike = require_length_of_array_like();
- var toIntegerOrInfinity = require_to_integer_or_infinity();
- var arraySpeciesCreate = require_array_species_create();
- $({ target: "Array", proto: true }, {
- flat: function flat() {
- var depthArg = arguments.length ? arguments[0] : void 0;
- var O = toObject(this);
- var sourceLen = lengthOfArrayLike(O);
- var A = arraySpeciesCreate(O, 0);
- A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === void 0 ? 1 : toIntegerOrInfinity(depthArg));
- return A;
- }
- });
- }
- });
- // dist/_cli.js.cjs.js
- require_es_object_from_entries();
- require_es_array_flat_map();
- require_es_array_flat();
- var __create = Object.create;
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
- var __getProtoOf = Object.getPrototypeOf;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __esm = (fn, res) => function __init() {
- return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
- };
- var __commonJS2 = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = {
- exports: {}
- }).exports, mod), mod.exports;
- };
- var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, {
- get: all[name],
- enumerable: true
- });
- };
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames2(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, {
- get: () => from[key],
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
- });
- }
- return to;
- };
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
- value: mod,
- enumerable: true
- }) : target, mod));
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", {
- value: true
- }), mod);
- var require_fast_json_stable_stringify = __commonJS2({
- "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
- "use strict";
- module2.exports = function(data, opts) {
- if (!opts)
- opts = {};
- if (typeof opts === "function")
- opts = {
- cmp: opts
- };
- var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
- var cmp = opts.cmp && function(f) {
- return function(node) {
- return function(a, b) {
- var aobj = {
- key: a,
- value: node[a]
- };
- var bobj = {
- key: b,
- value: node[b]
- };
- return f(aobj, bobj);
- };
- };
- }(opts.cmp);
- var seen = [];
- return function stringify2(node) {
- if (node && node.toJSON && typeof node.toJSON === "function") {
- node = node.toJSON();
- }
- if (node === void 0)
- return;
- if (typeof node == "number")
- return isFinite(node) ? "" + node : "null";
- if (typeof node !== "object")
- return JSON.stringify(node);
- var i, out;
- if (Array.isArray(node)) {
- out = "[";
- for (i = 0; i < node.length; i++) {
- if (i)
- out += ",";
- out += stringify2(node[i]) || "null";
- }
- return out + "]";
- }
- if (node === null)
- return "null";
- if (seen.indexOf(node) !== -1) {
- if (cycles)
- return JSON.stringify("__cycle__");
- throw new TypeError("Converting circular structure to JSON");
- }
- var seenIndex = seen.push(node) - 1;
- var keys = Object.keys(node).sort(cmp && cmp(node));
- out = "";
- for (i = 0; i < keys.length; i++) {
- var key = keys[i];
- var value = stringify2(node[key]);
- if (!value)
- continue;
- if (out)
- out += ",";
- out += JSON.stringify(key) + ":" + value;
- }
- seen.splice(seenIndex, 1);
- return "{" + out + "}";
- }(data);
- };
- }
- });
- var require_clone = __commonJS2({
- "node_modules/clone/clone.js"(exports2, module2) {
- var clone = function() {
- "use strict";
- function clone2(parent, circular, depth, prototype) {
- var filter;
- if (typeof circular === "object") {
- depth = circular.depth;
- prototype = circular.prototype;
- filter = circular.filter;
- circular = circular.circular;
- }
- var allParents = [];
- var allChildren = [];
- var useBuffer = typeof Buffer != "undefined";
- if (typeof circular == "undefined")
- circular = true;
- if (typeof depth == "undefined")
- depth = Infinity;
- function _clone(parent2, depth2) {
- if (parent2 === null)
- return null;
- if (depth2 == 0)
- return parent2;
- var child;
- var proto2;
- if (typeof parent2 != "object") {
- return parent2;
- }
- if (clone2.__isArray(parent2)) {
- child = [];
- } else if (clone2.__isRegExp(parent2)) {
- child = new RegExp(parent2.source, __getRegExpFlags(parent2));
- if (parent2.lastIndex)
- child.lastIndex = parent2.lastIndex;
- } else if (clone2.__isDate(parent2)) {
- child = new Date(parent2.getTime());
- } else if (useBuffer && Buffer.isBuffer(parent2)) {
- if (Buffer.allocUnsafe) {
- child = Buffer.allocUnsafe(parent2.length);
- } else {
- child = new Buffer(parent2.length);
- }
- parent2.copy(child);
- return child;
- } else {
- if (typeof prototype == "undefined") {
- proto2 = Object.getPrototypeOf(parent2);
- child = Object.create(proto2);
- } else {
- child = Object.create(prototype);
- proto2 = prototype;
- }
- }
- if (circular) {
- var index = allParents.indexOf(parent2);
- if (index != -1) {
- return allChildren[index];
- }
- allParents.push(parent2);
- allChildren.push(child);
- }
- for (var i in parent2) {
- var attrs;
- if (proto2) {
- attrs = Object.getOwnPropertyDescriptor(proto2, i);
- }
- if (attrs && attrs.set == null) {
- continue;
- }
- child[i] = _clone(parent2[i], depth2 - 1);
- }
- return child;
- }
- return _clone(parent, depth);
- }
- clone2.clonePrototype = function clonePrototype(parent) {
- if (parent === null)
- return null;
- var c = function() {
- };
- c.prototype = parent;
- return new c();
- };
- function __objToStr(o) {
- return Object.prototype.toString.call(o);
- }
- ;
- clone2.__objToStr = __objToStr;
- function __isDate(o) {
- return typeof o === "object" && __objToStr(o) === "[object Date]";
- }
- ;
- clone2.__isDate = __isDate;
- function __isArray(o) {
- return typeof o === "object" && __objToStr(o) === "[object Array]";
- }
- ;
- clone2.__isArray = __isArray;
- function __isRegExp(o) {
- return typeof o === "object" && __objToStr(o) === "[object RegExp]";
- }
- ;
- clone2.__isRegExp = __isRegExp;
- function __getRegExpFlags(re) {
- var flags = "";
- if (re.global)
- flags += "g";
- if (re.ignoreCase)
- flags += "i";
- if (re.multiline)
- flags += "m";
- return flags;
- }
- ;
- clone2.__getRegExpFlags = __getRegExpFlags;
- return clone2;
- }();
- if (typeof module2 === "object" && module2.exports) {
- module2.exports = clone;
- }
- }
- });
- var require_defaults = __commonJS2({
- "node_modules/defaults/index.js"(exports2, module2) {
- var clone = require_clone();
- module2.exports = function(options, defaults) {
- options = options || {};
- Object.keys(defaults).forEach(function(key) {
- if (typeof options[key] === "undefined") {
- options[key] = clone(defaults[key]);
- }
- });
- return options;
- };
- }
- });
- var require_combining = __commonJS2({
- "node_modules/wcwidth/combining.js"(exports2, module2) {
- module2.exports = [[768, 879], [1155, 1158], [1160, 1161], [1425, 1469], [1471, 1471], [1473, 1474], [1476, 1477], [1479, 1479], [1536, 1539], [1552, 1557], [1611, 1630], [1648, 1648], [1750, 1764], [1767, 1768], [1770, 1773], [1807, 1807], [1809, 1809], [1840, 1866], [1958, 1968], [2027, 2035], [2305, 2306], [2364, 2364], [2369, 2376], [2381, 2381], [2385, 2388], [2402, 2403], [2433, 2433], [2492, 2492], [2497, 2500], [2509, 2509], [2530, 2531], [2561, 2562], [2620, 2620], [2625, 2626], [2631, 2632], [2635, 2637], [2672, 2673], [2689, 2690], [2748, 2748], [2753, 2757], [2759, 2760], [2765, 2765], [2786, 2787], [2817, 2817], [2876, 2876], [2879, 2879], [2881, 2883], [2893, 2893], [2902, 2902], [2946, 2946], [3008, 3008], [3021, 3021], [3134, 3136], [3142, 3144], [3146, 3149], [3157, 3158], [3260, 3260], [3263, 3263], [3270, 3270], [3276, 3277], [3298, 3299], [3393, 3395], [3405, 3405], [3530, 3530], [3538, 3540], [3542, 3542], [3633, 3633], [3636, 3642], [3655, 3662], [3761, 3761], [3764, 3769], [3771, 3772], [3784, 3789], [3864, 3865], [3893, 3893], [3895, 3895], [3897, 3897], [3953, 3966], [3968, 3972], [3974, 3975], [3984, 3991], [3993, 4028], [4038, 4038], [4141, 4144], [4146, 4146], [4150, 4151], [4153, 4153], [4184, 4185], [4448, 4607], [4959, 4959], [5906, 5908], [5938, 5940], [5970, 5971], [6002, 6003], [6068, 6069], [6071, 6077], [6086, 6086], [6089, 6099], [6109, 6109], [6155, 6157], [6313, 6313], [6432, 6434], [6439, 6440], [6450, 6450], [6457, 6459], [6679, 6680], [6912, 6915], [6964, 6964], [6966, 6970], [6972, 6972], [6978, 6978], [7019, 7027], [7616, 7626], [7678, 7679], [8203, 8207], [8234, 8238], [8288, 8291], [8298, 8303], [8400, 8431], [12330, 12335], [12441, 12442], [43014, 43014], [43019, 43019], [43045, 43046], [64286, 64286], [65024, 65039], [65056, 65059], [65279, 65279], [65529, 65531], [68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [917505, 917505], [917536, 917631], [917760, 917999]];
- }
- });
- var require_wcwidth = __commonJS2({
- "node_modules/wcwidth/index.js"(exports2, module2) {
- "use strict";
- var defaults = require_defaults();
- var combining = require_combining();
- var DEFAULTS = {
- nul: 0,
- control: 0
- };
- module2.exports = function wcwidth2(str) {
- return wcswidth(str, DEFAULTS);
- };
- module2.exports.config = function(opts) {
- opts = defaults(opts || {}, DEFAULTS);
- return function wcwidth2(str) {
- return wcswidth(str, opts);
- };
- };
- function wcswidth(str, opts) {
- if (typeof str !== "string")
- return wcwidth(str, opts);
- var s = 0;
- for (var i = 0; i < str.length; i++) {
- var n = wcwidth(str.charCodeAt(i), opts);
- if (n < 0)
- return -1;
- s += n;
- }
- return s;
- }
- function wcwidth(ucs, opts) {
- if (ucs === 0)
- return opts.nul;
- if (ucs < 32 || ucs >= 127 && ucs < 160)
- return opts.control;
- if (bisearch(ucs))
- return 0;
- return 1 + (ucs >= 4352 && (ucs <= 4447 || ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || ucs >= 44032 && ucs <= 55203 || ucs >= 63744 && ucs <= 64255 || ucs >= 65040 && ucs <= 65049 || ucs >= 65072 && ucs <= 65135 || ucs >= 65280 && ucs <= 65376 || ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141));
- }
- function bisearch(ucs) {
- var min = 0;
- var max = combining.length - 1;
- var mid;
- if (ucs < combining[0][0] || ucs > combining[max][1])
- return false;
- while (max >= min) {
- mid = Math.floor((min + max) / 2);
- if (ucs > combining[mid][1])
- min = mid + 1;
- else if (ucs < combining[mid][0])
- max = mid - 1;
- else
- return true;
- }
- return false;
- }
- }
- });
- function ansiRegex({
- onlyFirst = false
- } = {}) {
- const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
- }
- var init_ansi_regex = __esm({
- "node_modules/strip-ansi/node_modules/ansi-regex/index.js"() {
- }
- });
- var strip_ansi_exports = {};
- __export(strip_ansi_exports, {
- default: () => stripAnsi
- });
- function stripAnsi(string) {
- if (typeof string !== "string") {
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
- }
- return string.replace(ansiRegex(), "");
- }
- var init_strip_ansi = __esm({
- "node_modules/strip-ansi/index.js"() {
- init_ansi_regex();
- }
- });
- function assembleStyles() {
- const codes = /* @__PURE__ */ new Map();
- const styles2 = {
- modifier: {
- reset: [0, 0],
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- overline: [53, 55],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29]
- },
- color: {
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- blackBright: [90, 39],
- redBright: [91, 39],
- greenBright: [92, 39],
- yellowBright: [93, 39],
- blueBright: [94, 39],
- magentaBright: [95, 39],
- cyanBright: [96, 39],
- whiteBright: [97, 39]
- },
- bgColor: {
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- };
- styles2.color.gray = styles2.color.blackBright;
- styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
- styles2.color.grey = styles2.color.blackBright;
- styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
- for (const [groupName, group] of Object.entries(styles2)) {
- for (const [styleName, style] of Object.entries(group)) {
- styles2[styleName] = {
- open: `\x1B[${style[0]}m`,
- close: `\x1B[${style[1]}m`
- };
- group[styleName] = styles2[styleName];
- codes.set(style[0], style[1]);
- }
- Object.defineProperty(styles2, groupName, {
- value: group,
- enumerable: false
- });
- }
- Object.defineProperty(styles2, "codes", {
- value: codes,
- enumerable: false
- });
- styles2.color.close = "\x1B[39m";
- styles2.bgColor.close = "\x1B[49m";
- styles2.color.ansi = wrapAnsi16();
- styles2.color.ansi256 = wrapAnsi256();
- styles2.color.ansi16m = wrapAnsi16m();
- styles2.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
- styles2.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
- styles2.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
- Object.defineProperties(styles2, {
- rgbToAnsi256: {
- value: (red, green, blue) => {
- if (red === green && green === blue) {
- if (red < 8) {
- return 16;
- }
- if (red > 248) {
- return 231;
- }
- return Math.round((red - 8) / 247 * 24) + 232;
- }
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
- },
- enumerable: false
- },
- hexToRgb: {
- value: (hex) => {
- const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
- if (!matches) {
- return [0, 0, 0];
- }
- let {
- colorString
- } = matches.groups;
- if (colorString.length === 3) {
- colorString = [...colorString].map((character) => character + character).join("");
- }
- const integer = Number.parseInt(colorString, 16);
- return [integer >> 16 & 255, integer >> 8 & 255, integer & 255];
- },
- enumerable: false
- },
- hexToAnsi256: {
- value: (hex) => styles2.rgbToAnsi256(...styles2.hexToRgb(hex)),
- enumerable: false
- },
- ansi256ToAnsi: {
- value: (code) => {
- if (code < 8) {
- return 30 + code;
- }
- if (code < 16) {
- return 90 + (code - 8);
- }
- let red;
- let green;
- let blue;
- if (code >= 232) {
- red = ((code - 232) * 10 + 8) / 255;
- green = red;
- blue = red;
- } else {
- code -= 16;
- const remainder = code % 36;
- red = Math.floor(code / 36) / 5;
- green = Math.floor(remainder / 6) / 5;
- blue = remainder % 6 / 5;
- }
- const value = Math.max(red, green, blue) * 2;
- if (value === 0) {
- return 30;
- }
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
- if (value === 2) {
- result += 60;
- }
- return result;
- },
- enumerable: false
- },
- rgbToAnsi: {
- value: (red, green, blue) => styles2.ansi256ToAnsi(styles2.rgbToAnsi256(red, green, blue)),
- enumerable: false
- },
- hexToAnsi: {
- value: (hex) => styles2.ansi256ToAnsi(styles2.hexToAnsi256(hex)),
- enumerable: false
- }
- });
- return styles2;
- }
- var ANSI_BACKGROUND_OFFSET;
- var wrapAnsi16;
- var wrapAnsi256;
- var wrapAnsi16m;
- var ansiStyles;
- var ansi_styles_default;
- var init_ansi_styles = __esm({
- "node_modules/chalk/source/vendor/ansi-styles/index.js"() {
- ANSI_BACKGROUND_OFFSET = 10;
- wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
- wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
- wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
- ansiStyles = assembleStyles();
- ansi_styles_default = ansiStyles;
- }
- });
- function hasFlag(flag, argv = import_node_process.default.argv) {
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
- const position = argv.indexOf(prefix + flag);
- const terminatorPosition = argv.indexOf("--");
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
- }
- function envForceColor() {
- if ("FORCE_COLOR" in env) {
- if (env.FORCE_COLOR === "true") {
- return 1;
- }
- if (env.FORCE_COLOR === "false") {
- return 0;
- }
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
- }
- }
- function translateLevel(level) {
- if (level === 0) {
- return false;
- }
- return {
- level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3
- };
- }
- function _supportsColor(haveStream, {
- streamIsTTY,
- sniffFlags = true
- } = {}) {
- const noFlagForceColor = envForceColor();
- if (noFlagForceColor !== void 0) {
- flagForceColor = noFlagForceColor;
- }
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
- if (forceColor === 0) {
- return 0;
- }
- if (sniffFlags) {
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
- return 3;
- }
- if (hasFlag("color=256")) {
- return 2;
- }
- }
- if (haveStream && !streamIsTTY && forceColor === void 0) {
- return 0;
- }
- const min = forceColor || 0;
- if (env.TERM === "dumb") {
- return min;
- }
- if (import_node_process.default.platform === "win32") {
- const osRelease = import_node_os.default.release().split(".");
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
- }
- return 1;
- }
- if ("CI" in env) {
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
- return 1;
- }
- return min;
- }
- if ("TEAMCITY_VERSION" in env) {
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
- }
- if ("TF_BUILD" in env && "AGENT_NAME" in env) {
- return 1;
- }
- if (env.COLORTERM === "truecolor") {
- return 3;
- }
- if ("TERM_PROGRAM" in env) {
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
- switch (env.TERM_PROGRAM) {
- case "iTerm.app":
- return version >= 3 ? 3 : 2;
- case "Apple_Terminal":
- return 2;
- }
- }
- if (/-256(color)?$/i.test(env.TERM)) {
- return 2;
- }
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
- return 1;
- }
- if ("COLORTERM" in env) {
- return 1;
- }
- return min;
- }
- function createSupportsColor(stream, options = {}) {
- const level = _supportsColor(stream, Object.assign({
- streamIsTTY: stream && stream.isTTY
- }, options));
- return translateLevel(level);
- }
- var import_node_process;
- var import_node_os;
- var import_node_tty;
- var env;
- var flagForceColor;
- var supportsColor;
- var supports_color_default;
- var init_supports_color = __esm({
- "node_modules/chalk/source/vendor/supports-color/index.js"() {
- import_node_process = __toESM(require("process"), 1);
- import_node_os = __toESM(require("os"), 1);
- import_node_tty = __toESM(require("tty"), 1);
- ({
- env
- } = import_node_process.default);
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
- flagForceColor = 0;
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
- flagForceColor = 1;
- }
- supportsColor = {
- stdout: createSupportsColor({
- isTTY: import_node_tty.default.isatty(1)
- }),
- stderr: createSupportsColor({
- isTTY: import_node_tty.default.isatty(2)
- })
- };
- supports_color_default = supportsColor;
- }
- });
- function stringReplaceAll(string, substring, replacer) {
- let index = string.indexOf(substring);
- if (index === -1) {
- return string;
- }
- const substringLength = substring.length;
- let endIndex = 0;
- let returnValue = "";
- do {
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
- endIndex = index + substringLength;
- index = string.indexOf(substring, endIndex);
- } while (index !== -1);
- returnValue += string.slice(endIndex);
- return returnValue;
- }
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
- let endIndex = 0;
- let returnValue = "";
- do {
- const gotCR = string[index - 1] === "\r";
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
- endIndex = index + 1;
- index = string.indexOf("\n", endIndex);
- } while (index !== -1);
- returnValue += string.slice(endIndex);
- return returnValue;
- }
- var init_utilities = __esm({
- "node_modules/chalk/source/utilities.js"() {
- }
- });
- var source_exports = {};
- __export(source_exports, {
- Chalk: () => Chalk,
- chalkStderr: () => chalkStderr,
- default: () => source_default,
- supportsColor: () => stdoutColor,
- supportsColorStderr: () => stderrColor
- });
- function createChalk(options) {
- return chalkFactory(options);
- }
- var stdoutColor;
- var stderrColor;
- var GENERATOR;
- var STYLER;
- var IS_EMPTY;
- var levelMapping;
- var styles;
- var applyOptions;
- var Chalk;
- var chalkFactory;
- var getModelAnsi;
- var usedModels;
- var proto;
- var createStyler;
- var createBuilder;
- var applyStyle;
- var chalk;
- var chalkStderr;
- var source_default;
- var init_source = __esm({
- "node_modules/chalk/source/index.js"() {
- init_ansi_styles();
- init_supports_color();
- init_utilities();
- ({
- stdout: stdoutColor,
- stderr: stderrColor
- } = supports_color_default);
- GENERATOR = Symbol("GENERATOR");
- STYLER = Symbol("STYLER");
- IS_EMPTY = Symbol("IS_EMPTY");
- levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
- styles = /* @__PURE__ */ Object.create(null);
- applyOptions = (object, options = {}) => {
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
- throw new Error("The `level` option should be an integer from 0 to 3");
- }
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
- object.level = options.level === void 0 ? colorLevel : options.level;
- };
- Chalk = class {
- constructor(options) {
- return chalkFactory(options);
- }
- };
- chalkFactory = (options) => {
- const chalk2 = (...strings) => strings.join(" ");
- applyOptions(chalk2, options);
- Object.setPrototypeOf(chalk2, createChalk.prototype);
- return chalk2;
- };
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
- for (const [styleName, style] of Object.entries(ansi_styles_default)) {
- styles[styleName] = {
- get() {
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
- Object.defineProperty(this, styleName, {
- value: builder
- });
- return builder;
- }
- };
- }
- styles.visible = {
- get() {
- const builder = createBuilder(this, this[STYLER], true);
- Object.defineProperty(this, "visible", {
- value: builder
- });
- return builder;
- }
- };
- getModelAnsi = (model, level, type, ...arguments_) => {
- if (model === "rgb") {
- if (level === "ansi16m") {
- return ansi_styles_default[type].ansi16m(...arguments_);
- }
- if (level === "ansi256") {
- return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
- }
- return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
- }
- if (model === "hex") {
- return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
- }
- return ansi_styles_default[type][model](...arguments_);
- };
- usedModels = ["rgb", "hex", "ansi256"];
- for (const model of usedModels) {
- styles[model] = {
- get() {
- const {
- level
- } = this;
- return function(...arguments_) {
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
- return createBuilder(this, styler, this[IS_EMPTY]);
- };
- }
- };
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
- styles[bgModel] = {
- get() {
- const {
- level
- } = this;
- return function(...arguments_) {
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
- return createBuilder(this, styler, this[IS_EMPTY]);
- };
- }
- };
- }
- proto = Object.defineProperties(() => {
- }, Object.assign(Object.assign({}, styles), {}, {
- level: {
- enumerable: true,
- get() {
- return this[GENERATOR].level;
- },
- set(level) {
- this[GENERATOR].level = level;
- }
- }
- }));
- createStyler = (open, close, parent) => {
- let openAll;
- let closeAll;
- if (parent === void 0) {
- openAll = open;
- closeAll = close;
- } else {
- openAll = parent.openAll + open;
- closeAll = close + parent.closeAll;
- }
- return {
- open,
- close,
- openAll,
- closeAll,
- parent
- };
- };
- createBuilder = (self2, _styler, _isEmpty) => {
- const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
- Object.setPrototypeOf(builder, proto);
- builder[GENERATOR] = self2;
- builder[STYLER] = _styler;
- builder[IS_EMPTY] = _isEmpty;
- return builder;
- };
- applyStyle = (self2, string) => {
- if (self2.level <= 0 || !string) {
- return self2[IS_EMPTY] ? "" : string;
- }
- let styler = self2[STYLER];
- if (styler === void 0) {
- return string;
- }
- const {
- openAll,
- closeAll
- } = styler;
- if (string.includes("\x1B")) {
- while (styler !== void 0) {
- string = stringReplaceAll(string, styler.close, styler.open);
- styler = styler.parent;
- }
- }
- const lfIndex = string.indexOf("\n");
- if (lfIndex !== -1) {
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
- }
- return openAll + string + closeAll;
- };
- Object.defineProperties(createChalk.prototype, styles);
- chalk = createChalk();
- chalkStderr = createChalk({
- level: stderrColor ? stderrColor.level : 0
- });
- source_default = chalk;
- }
- });
- var require_logger = __commonJS2({
- "src/cli/logger.js"(exports2, module2) {
- "use strict";
- var readline = require("readline");
- var wcwidth = require_wcwidth();
- var {
- default: stripAnsi2
- } = (init_strip_ansi(), __toCommonJS(strip_ansi_exports));
- var {
- default: chalk2,
- chalkStderr: chalkStderr2
- } = (init_source(), __toCommonJS(source_exports));
- var countLines = (stream, text) => {
- const columns = stream.columns || 80;
- let lineCount = 0;
- for (const line of stripAnsi2(text).split("\n")) {
- lineCount += Math.max(1, Math.ceil(wcwidth(line) / columns));
- }
- return lineCount;
- };
- var clear = (stream, text) => () => {
- const lineCount = countLines(stream, text);
- for (let line = 0; line < lineCount; line++) {
- if (line > 0) {
- readline.moveCursor(stream, 0, -1);
- }
- readline.clearLine(stream, 0);
- readline.cursorTo(stream, 0);
- }
- };
- var emptyLogResult = {
- clear() {
- }
- };
- function createLogger2(logLevel = "log") {
- return {
- logLevel,
- warn: createLogFunc("warn", "yellow"),
- error: createLogFunc("error", "red"),
- debug: createLogFunc("debug", "blue"),
- log: createLogFunc("log")
- };
- function createLogFunc(loggerName, color) {
- if (!shouldLog(loggerName)) {
- return () => emptyLogResult;
- }
- const stream = process[loggerName === "log" ? "stdout" : "stderr"];
- const chalkInstance = loggerName === "log" ? chalk2 : chalkStderr2;
- const prefix = color ? `[${chalkInstance[color](loggerName)}] ` : "";
- return (message, options) => {
- options = Object.assign({
- newline: true,
- clearable: false
- }, options);
- message = message.replace(/^/gm, prefix) + (options.newline ? "\n" : "");
- stream.write(message);
- if (options.clearable) {
- return {
- clear: clear(stream, message)
- };
- }
- };
- }
- function shouldLog(loggerName) {
- switch (logLevel) {
- case "silent":
- return false;
- case "debug":
- if (loggerName === "debug") {
- return true;
- }
- case "log":
- if (loggerName === "log") {
- return true;
- }
- case "warn":
- if (loggerName === "warn") {
- return true;
- }
- case "error":
- return loggerName === "error";
- }
- }
- }
- module2.exports = createLogger2;
- }
- });
- var require_prettier_internal = __commonJS2({
- "src/cli/prettier-internal.js"(exports2, module2) {
- "use strict";
- module2.exports = require("./index.js").__internal;
- }
- });
- var require_lib = __commonJS2({
- "node_modules/outdent/lib/index.js"(exports2, module2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.outdent = void 0;
- function noop() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- }
- function createWeakMap() {
- if (typeof WeakMap !== "undefined") {
- return /* @__PURE__ */ new WeakMap();
- } else {
- return fakeSetOrMap();
- }
- }
- function fakeSetOrMap() {
- return {
- add: noop,
- delete: noop,
- get: noop,
- set: noop,
- has: function(k) {
- return false;
- }
- };
- }
- var hop = Object.prototype.hasOwnProperty;
- var has = function(obj, prop) {
- return hop.call(obj, prop);
- };
- function extend(target, source) {
- for (var prop in source) {
- if (has(source, prop)) {
- target[prop] = source[prop];
- }
- }
- return target;
- }
- var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
- var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
- var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
- var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
- var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
- function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
- var indentationLevel = 0;
- var match = strings[0].match(reDetectIndentation);
- if (match) {
- indentationLevel = match[1].length;
- }
- var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
- var reMatchIndent = new RegExp(reSource, "g");
- if (firstInterpolatedValueSetsIndentationLevel) {
- strings = strings.slice(1);
- }
- var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
- var normalizeNewlines = typeof newline === "string";
- var l = strings.length;
- var outdentedStrings = strings.map(function(v, i) {
- v = v.replace(reMatchIndent, "$1");
- if (i === 0 && trimLeadingNewline) {
- v = v.replace(reLeadingNewline, "");
- }
- if (i === l - 1 && trimTrailingNewline) {
- v = v.replace(reTrailingNewline, "");
- }
- if (normalizeNewlines) {
- v = v.replace(/\r\n|\n|\r/g, function(_) {
- return newline;
- });
- }
- return v;
- });
- return outdentedStrings;
- }
- function concatStringsAndValues(strings, values) {
- var ret = "";
- for (var i = 0, l = strings.length; i < l; i++) {
- ret += strings[i];
- if (i < l - 1) {
- ret += values[i];
- }
- }
- return ret;
- }
- function isTemplateStringsArray(v) {
- return has(v, "raw") && has(v, "length");
- }
- function createInstance(options) {
- var arrayAutoIndentCache = createWeakMap();
- var arrayFirstInterpSetsIndentCache = createWeakMap();
- function outdent(stringsOrOptions) {
- var values = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- values[_i - 1] = arguments[_i];
- }
- if (isTemplateStringsArray(stringsOrOptions)) {
- var strings = stringsOrOptions;
- var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
- var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
- var renderedArray = cache.get(strings);
- if (!renderedArray) {
- renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
- cache.set(strings, renderedArray);
- }
- if (values.length === 0) {
- return renderedArray[0];
- }
- var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
- return rendered;
- } else {
- return createInstance(extend(extend({}, options), stringsOrOptions || {}));
- }
- }
- var fullOutdent = extend(outdent, {
- string: function(str) {
- return _outdentArray([str], false, options)[0];
- }
- });
- return fullOutdent;
- }
- var defaultOutdent = createInstance({
- trimLeadingNewline: true,
- trimTrailingNewline: true
- });
- exports2.outdent = defaultOutdent;
- exports2.default = defaultOutdent;
- if (typeof module2 !== "undefined") {
- try {
- module2.exports = defaultOutdent;
- Object.defineProperty(defaultOutdent, "__esModule", {
- value: true
- });
- defaultOutdent.default = defaultOutdent;
- defaultOutdent.outdent = defaultOutdent;
- } catch (e) {
- }
- }
- }
- });
- var require_constant = __commonJS2({
- "src/cli/constant.js"(exports2, module2) {
- "use strict";
- var {
- outdent
- } = require_lib();
- var {
- coreOptions
- } = require_prettier_internal();
- var categoryOrder = [coreOptions.CATEGORY_OUTPUT, coreOptions.CATEGORY_FORMAT, coreOptions.CATEGORY_CONFIG, coreOptions.CATEGORY_EDITOR, coreOptions.CATEGORY_OTHER];
- var options = {
- cache: {
- default: false,
- description: "Only format changed files. Cannot use with --stdin-filepath.",
- type: "boolean"
- },
- "cache-location": {
- description: "Path to the cache file.",
- type: "path"
- },
- "cache-strategy": {
- choices: [{
- description: "Use the file metadata such as timestamps as cache keys",
- value: "metadata"
- }, {
- description: "Use the file content as cache keys",
- value: "content"
- }],
- description: "Strategy for the cache to use for detecting changed files.",
- type: "choice"
- },
- check: {
- alias: "c",
- category: coreOptions.CATEGORY_OUTPUT,
- description: outdent`
- Check if the given files are formatted, print a human-friendly summary
- message and paths to unformatted files (see also --list-different).
- `,
- type: "boolean"
- },
- color: {
- default: true,
- description: "Colorize error messages.",
- oppositeDescription: "Do not colorize error messages.",
- type: "boolean"
- },
- config: {
- category: coreOptions.CATEGORY_CONFIG,
- description: "Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js).",
- exception: (value) => value === false,
- oppositeDescription: "Do not look for a configuration file.",
- type: "path"
- },
- "config-precedence": {
- category: coreOptions.CATEGORY_CONFIG,
- choices: [{
- description: "CLI options take precedence over config file",
- value: "cli-override"
- }, {
- description: "Config file take precedence over CLI options",
- value: "file-override"
- }, {
- description: outdent`
- If a config file is found will evaluate it and ignore other CLI options.
- If no config file is found CLI options will evaluate as normal.
- `,
- value: "prefer-file"
- }],
- default: "cli-override",
- description: "Define in which order config files and CLI options should be evaluated.",
- type: "choice"
- },
- "debug-benchmark": {
- type: "boolean"
- },
- "debug-check": {
- type: "boolean"
- },
- "debug-print-ast": {
- type: "boolean"
- },
- "debug-print-comments": {
- type: "boolean"
- },
- "debug-print-doc": {
- type: "boolean"
- },
- "debug-repeat": {
- default: 0,
- type: "int"
- },
- editorconfig: {
- category: coreOptions.CATEGORY_CONFIG,
- default: true,
- description: "Take .editorconfig into account when parsing configuration.",
- oppositeDescription: "Don't take .editorconfig into account when parsing configuration.",
- type: "boolean"
- },
- "error-on-unmatched-pattern": {
- oppositeDescription: "Prevent errors when pattern is unmatched.",
- type: "boolean"
- },
- "file-info": {
- description: outdent`
- Extract the following info (as JSON) for a given file path. Reported fields:
- * ignored (boolean) - true if file path is filtered by --ignore-path
- * inferredParser (string | null) - name of parser inferred from file path
- `,
- type: "path"
- },
- "find-config-path": {
- category: coreOptions.CATEGORY_CONFIG,
- description: "Find and print the path to a configuration file for the given input file.",
- type: "path"
- },
- help: {
- alias: "h",
- description: outdent`
- Show CLI usage, or details about the given flag.
- Example: --help write
- `,
- exception: (value) => value === "",
- type: "flag"
- },
- "ignore-path": {
- category: coreOptions.CATEGORY_CONFIG,
- default: ".prettierignore",
- description: "Path to a file with patterns describing files to ignore.",
- type: "path"
- },
- "ignore-unknown": {
- alias: "u",
- description: "Ignore unknown files.",
- type: "boolean"
- },
- "list-different": {
- alias: "l",
- category: coreOptions.CATEGORY_OUTPUT,
- description: "Print the names of files that are different from Prettier's formatting (see also --check).",
- type: "boolean"
- },
- loglevel: {
- choices: ["silent", "error", "warn", "log", "debug"],
- default: "log",
- description: "What level of logs to report.",
- type: "choice"
- },
- "plugin-search": {
- oppositeDescription: "Disable plugin autoloading.",
- type: "boolean"
- },
- "support-info": {
- description: "Print support information as JSON.",
- type: "boolean"
- },
- version: {
- alias: "v",
- description: "Print Prettier version.",
- type: "boolean"
- },
- "with-node-modules": {
- category: coreOptions.CATEGORY_CONFIG,
- description: "Process files inside 'node_modules' directory.",
- type: "boolean"
- },
- write: {
- alias: "w",
- category: coreOptions.CATEGORY_OUTPUT,
- description: "Edit files in-place. (Beware!)",
- type: "boolean"
- }
- };
- var usageSummary = outdent`
- Usage: prettier [options] [file/dir/glob ...]
- By default, output is written to stdout.
- Stdin is read if it is piped to Prettier and no files are given.
- `;
- module2.exports = {
- categoryOrder,
- options,
- usageSummary
- };
- }
- });
- var require_dashify = __commonJS2({
- "node_modules/dashify/index.js"(exports2, module2) {
- "use strict";
- module2.exports = (str, options) => {
- if (typeof str !== "string")
- throw new TypeError("expected a string");
- return str.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/\W/g, (m) => /[À-ž]/.test(m) ? m : "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, (m) => options && options.condense ? "-" : m).toLowerCase();
- };
- }
- });
- var require_option_map = __commonJS2({
- "src/cli/options/option-map.js"(exports2, module2) {
- "use strict";
- var dashify = require_dashify();
- var {
- coreOptions
- } = require_prettier_internal();
- function normalizeDetailedOption(name, option) {
- return Object.assign(Object.assign({
- category: coreOptions.CATEGORY_OTHER
- }, option), {}, {
- choices: option.choices && option.choices.map((choice) => {
- const newChoice = Object.assign({
- description: "",
- deprecated: false
- }, typeof choice === "object" ? choice : {
- value: choice
- });
- if (newChoice.value === true) {
- newChoice.value = "";
- }
- return newChoice;
- })
- });
- }
- function normalizeDetailedOptionMap(detailedOptionMap) {
- return Object.fromEntries(Object.entries(detailedOptionMap).sort(([leftName], [rightName]) => leftName.localeCompare(rightName)).map(([name, option]) => [name, normalizeDetailedOption(name, option)]));
- }
- function createDetailedOptionMap(supportOptions) {
- return Object.fromEntries(supportOptions.map((option) => {
- const newOption = Object.assign(Object.assign({}, option), {}, {
- name: option.cliName || dashify(option.name),
- description: option.cliDescription || option.description,
- category: option.cliCategory || coreOptions.CATEGORY_FORMAT,
- forwardToApi: option.name
- });
- if (option.deprecated) {
- delete newOption.forwardToApi;
- delete newOption.description;
- delete newOption.oppositeDescription;
- newOption.deprecated = true;
- }
- return [newOption.name, newOption];
- }));
- }
- module2.exports = {
- normalizeDetailedOptionMap,
- createDetailedOptionMap
- };
- }
- });
- var require_get_context_options = __commonJS2({
- "src/cli/options/get-context-options.js"(exports2, module2) {
- "use strict";
- var prettier2 = require("./index.js");
- var {
- optionsModule,
- utils: {
- arrayify
- }
- } = require_prettier_internal();
- var constant = require_constant();
- var {
- normalizeDetailedOptionMap,
- createDetailedOptionMap
- } = require_option_map();
- function getContextOptions(plugins, pluginSearchDirs) {
- const {
- options: supportOptions,
- languages
- } = prettier2.getSupportInfo({
- showDeprecated: true,
- showUnreleased: true,
- showInternal: true,
- plugins,
- pluginSearchDirs
- });
- const detailedOptionMap = normalizeDetailedOptionMap(Object.assign(Object.assign({}, createDetailedOptionMap(supportOptions)), constant.options));
- const detailedOptions = arrayify(detailedOptionMap, "name");
- const apiDefaultOptions = Object.assign(Object.assign({}, optionsModule.hiddenDefaults), Object.fromEntries(supportOptions.filter(({
- deprecated
- }) => !deprecated).map((option) => [option.name, option.default])));
- return {
- supportOptions,
- detailedOptions,
- detailedOptionMap,
- apiDefaultOptions,
- languages
- };
- }
- module2.exports = getContextOptions;
- }
- });
- var require_camelcase = __commonJS2({
- "node_modules/camelcase/index.js"(exports2, module2) {
- "use strict";
- var UPPERCASE = /[\p{Lu}]/u;
- var LOWERCASE = /[\p{Ll}]/u;
- var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
- var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
- var SEPARATORS = /[_.\- ]+/;
- var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
- var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
- var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
- var preserveCamelCase = (string, toLowerCase, toUpperCase) => {
- let isLastCharLower = false;
- let isLastCharUpper = false;
- let isLastLastCharUpper = false;
- for (let i = 0; i < string.length; i++) {
- const character = string[i];
- if (isLastCharLower && UPPERCASE.test(character)) {
- string = string.slice(0, i) + "-" + string.slice(i);
- isLastCharLower = false;
- isLastLastCharUpper = isLastCharUpper;
- isLastCharUpper = true;
- i++;
- } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) {
- string = string.slice(0, i - 1) + "-" + string.slice(i - 1);
- isLastLastCharUpper = isLastCharUpper;
- isLastCharUpper = false;
- isLastCharLower = true;
- } else {
- isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
- isLastLastCharUpper = isLastCharUpper;
- isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
- }
- }
- return string;
- };
- var preserveConsecutiveUppercase = (input, toLowerCase) => {
- LEADING_CAPITAL.lastIndex = 0;
- return input.replace(LEADING_CAPITAL, (m1) => toLowerCase(m1));
- };
- var postProcess = (input, toUpperCase) => {
- SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
- NUMBERS_AND_IDENTIFIER.lastIndex = 0;
- return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
- };
- var camelCase = (input, options) => {
- if (!(typeof input === "string" || Array.isArray(input))) {
- throw new TypeError("Expected the input to be `string | string[]`");
- }
- options = Object.assign({
- pascalCase: false,
- preserveConsecutiveUppercase: false
- }, options);
- if (Array.isArray(input)) {
- input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
- } else {
- input = input.trim();
- }
- if (input.length === 0) {
- return "";
- }
- const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
- const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
- if (input.length === 1) {
- return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
- }
- const hasUpperCase = input !== toLowerCase(input);
- if (hasUpperCase) {
- input = preserveCamelCase(input, toLowerCase, toUpperCase);
- }
- input = input.replace(LEADING_SEPARATORS, "");
- if (options.preserveConsecutiveUppercase) {
- input = preserveConsecutiveUppercase(input, toLowerCase);
- } else {
- input = toLowerCase(input);
- }
- if (options.pascalCase) {
- input = toUpperCase(input.charAt(0)) + input.slice(1);
- }
- return postProcess(input, toUpperCase);
- };
- module2.exports = camelCase;
- module2.exports.default = camelCase;
- }
- });
- var sdbm_exports = {};
- __export(sdbm_exports, {
- default: () => sdbm
- });
- function sdbm(string) {
- let hash = 0;
- for (let i = 0; i < string.length; i++) {
- hash = string.charCodeAt(i) + (hash << 6) + (hash << 16) - hash;
- }
- return hash >>> 0;
- }
- var init_sdbm = __esm({
- "node_modules/sdbm/index.js"() {
- }
- });
- var require_utils = __commonJS2({
- "src/cli/utils.js"(exports2, module2) {
- "use strict";
- var {
- promises: fs
- } = require("fs");
- var {
- default: sdbm2
- } = (init_sdbm(), __toCommonJS(sdbm_exports));
- var printToScreen2 = console.log.bind(console);
- function groupBy(array2, iteratee) {
- const result = /* @__PURE__ */ Object.create(null);
- for (const value of array2) {
- const key = iteratee(value);
- if (Array.isArray(result[key])) {
- result[key].push(value);
- } else {
- result[key] = [value];
- }
- }
- return result;
- }
- function pick(object, keys) {
- const entries = keys.map((key) => [key, object[key]]);
- return Object.fromEntries(entries);
- }
- function createHash(source) {
- return String(sdbm2(source));
- }
- async function statSafe(filePath) {
- try {
- return await fs.stat(filePath);
- } catch (error) {
- if (error.code !== "ENOENT") {
- throw error;
- }
- }
- }
- function isJson(value) {
- try {
- JSON.parse(value);
- return true;
- } catch {
- return false;
- }
- }
- module2.exports = {
- printToScreen: printToScreen2,
- groupBy,
- pick,
- createHash,
- statSafe,
- isJson
- };
- }
- });
- var require_minimist = __commonJS2({
- "node_modules/minimist/index.js"(exports2, module2) {
- module2.exports = function(args, opts) {
- if (!opts)
- opts = {};
- var flags = {
- bools: {},
- strings: {},
- unknownFn: null
- };
- if (typeof opts["unknown"] === "function") {
- flags.unknownFn = opts["unknown"];
- }
- if (typeof opts["boolean"] === "boolean" && opts["boolean"]) {
- flags.allBools = true;
- } else {
- [].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
- flags.bools[key2] = true;
- });
- }
- var aliases = {};
- Object.keys(opts.alias || {}).forEach(function(key2) {
- aliases[key2] = [].concat(opts.alias[key2]);
- aliases[key2].forEach(function(x) {
- aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
- return x !== y;
- }));
- });
- });
- [].concat(opts.string).filter(Boolean).forEach(function(key2) {
- flags.strings[key2] = true;
- if (aliases[key2]) {
- flags.strings[aliases[key2]] = true;
- }
- });
- var defaults = opts["default"] || {};
- var argv = {
- _: []
- };
- Object.keys(flags.bools).forEach(function(key2) {
- setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
- });
- var notFlags = [];
- if (args.indexOf("--") !== -1) {
- notFlags = args.slice(args.indexOf("--") + 1);
- args = args.slice(0, args.indexOf("--"));
- }
- function argDefined(key2, arg2) {
- return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
- }
- function setArg(key2, val, arg2) {
- if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
- if (flags.unknownFn(arg2) === false)
- return;
- }
- var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
- setKey(argv, key2.split("."), value2);
- (aliases[key2] || []).forEach(function(x) {
- setKey(argv, x.split("."), value2);
- });
- }
- function setKey(obj, keys, value2) {
- var o = obj;
- for (var i2 = 0; i2 < keys.length - 1; i2++) {
- var key2 = keys[i2];
- if (isConstructorOrProto(o, key2))
- return;
- if (o[key2] === void 0)
- o[key2] = {};
- if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype)
- o[key2] = {};
- if (o[key2] === Array.prototype)
- o[key2] = [];
- o = o[key2];
- }
- var key2 = keys[keys.length - 1];
- if (isConstructorOrProto(o, key2))
- return;
- if (o === Object.prototype || o === Number.prototype || o === String.prototype)
- o = {};
- if (o === Array.prototype)
- o = [];
- if (o[key2] === void 0 || flags.bools[key2] || typeof o[key2] === "boolean") {
- o[key2] = value2;
- } else if (Array.isArray(o[key2])) {
- o[key2].push(value2);
- } else {
- o[key2] = [o[key2], value2];
- }
- }
- function aliasIsBoolean(key2) {
- return aliases[key2].some(function(x) {
- return flags.bools[x];
- });
- }
- for (var i = 0; i < args.length; i++) {
- var arg = args[i];
- if (/^--.+=/.test(arg)) {
- var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
- var key = m[1];
- var value = m[2];
- if (flags.bools[key]) {
- value = value !== "false";
- }
- setArg(key, value, arg);
- } else if (/^--no-.+/.test(arg)) {
- var key = arg.match(/^--no-(.+)/)[1];
- setArg(key, false, arg);
- } else if (/^--.+/.test(arg)) {
- var key = arg.match(/^--(.+)/)[1];
- var next = args[i + 1];
- if (next !== void 0 && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
- setArg(key, next, arg);
- i++;
- } else if (/^(true|false)$/.test(next)) {
- setArg(key, next === "true", arg);
- i++;
- } else {
- setArg(key, flags.strings[key] ? "" : true, arg);
- }
- } else if (/^-[^-]+/.test(arg)) {
- var letters = arg.slice(1, -1).split("");
- var broken = false;
- for (var j = 0; j < letters.length; j++) {
- var next = arg.slice(j + 2);
- if (next === "-") {
- setArg(letters[j], next, arg);
- continue;
- }
- if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
- setArg(letters[j], next.split("=")[1], arg);
- broken = true;
- break;
- }
- if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
- setArg(letters[j], next, arg);
- broken = true;
- break;
- }
- if (letters[j + 1] && letters[j + 1].match(/\W/)) {
- setArg(letters[j], arg.slice(j + 2), arg);
- broken = true;
- break;
- } else {
- setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
- }
- }
- var key = arg.slice(-1)[0];
- if (!broken && key !== "-") {
- if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
- setArg(key, args[i + 1], arg);
- i++;
- } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
- setArg(key, args[i + 1] === "true", arg);
- i++;
- } else {
- setArg(key, flags.strings[key] ? "" : true, arg);
- }
- }
- } else {
- if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
- argv._.push(flags.strings["_"] || !isNumber(arg) ? arg : Number(arg));
- }
- if (opts.stopEarly) {
- argv._.push.apply(argv._, args.slice(i + 1));
- break;
- }
- }
- }
- Object.keys(defaults).forEach(function(key2) {
- if (!hasKey(argv, key2.split("."))) {
- setKey(argv, key2.split("."), defaults[key2]);
- (aliases[key2] || []).forEach(function(x) {
- setKey(argv, x.split("."), defaults[key2]);
- });
- }
- });
- if (opts["--"]) {
- argv["--"] = new Array();
- notFlags.forEach(function(key2) {
- argv["--"].push(key2);
- });
- } else {
- notFlags.forEach(function(key2) {
- argv._.push(key2);
- });
- }
- return argv;
- };
- function hasKey(obj, keys) {
- var o = obj;
- keys.slice(0, -1).forEach(function(key2) {
- o = o[key2] || {};
- });
- var key = keys[keys.length - 1];
- return key in o;
- }
- function isNumber(x) {
- if (typeof x === "number")
- return true;
- if (/^0x[0-9a-f]+$/i.test(x))
- return true;
- return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
- }
- function isConstructorOrProto(obj, key) {
- return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
- }
- }
- });
- var require_minimist2 = __commonJS2({
- "src/cli/options/minimist.js"(exports2, module2) {
- "use strict";
- var minimist = require_minimist();
- var PLACEHOLDER = null;
- module2.exports = function(args, options) {
- const boolean = options.boolean || [];
- const defaults = options.default || {};
- const booleanWithoutDefault = boolean.filter((key) => !(key in defaults));
- const newDefaults = Object.assign(Object.assign({}, defaults), Object.fromEntries(booleanWithoutDefault.map((key) => [key, PLACEHOLDER])));
- const parsed = minimist(args, Object.assign(Object.assign({}, options), {}, {
- default: newDefaults
- }));
- return Object.fromEntries(Object.entries(parsed).filter(([, value]) => value !== PLACEHOLDER));
- };
- }
- });
- var require_create_minimist_options = __commonJS2({
- "src/cli/options/create-minimist-options.js"(exports2, module2) {
- "use strict";
- var {
- utils: {
- partition
- }
- } = require_prettier_internal();
- module2.exports = function createMinimistOptions(detailedOptions) {
- const [boolean, string] = partition(detailedOptions, ({
- type
- }) => type === "boolean").map((detailedOptions2) => detailedOptions2.flatMap(({
- name,
- alias
- }) => alias ? [name, alias] : [name]));
- const defaults = Object.fromEntries(detailedOptions.filter((option) => !option.deprecated && (!option.forwardToApi || option.name === "plugin" || option.name === "plugin-search-dir") && option.default !== void 0).map((option) => [option.name, option.default]));
- return {
- alias: {},
- boolean,
- string,
- default: defaults
- };
- };
- }
- });
- var leven_exports = {};
- __export(leven_exports, {
- default: () => leven
- });
- function leven(first, second) {
- if (first === second) {
- return 0;
- }
- const swap = first;
- if (first.length > second.length) {
- first = second;
- second = swap;
- }
- let firstLength = first.length;
- let secondLength = second.length;
- while (firstLength > 0 && first.charCodeAt(~-firstLength) === second.charCodeAt(~-secondLength)) {
- firstLength--;
- secondLength--;
- }
- let start = 0;
- while (start < firstLength && first.charCodeAt(start) === second.charCodeAt(start)) {
- start++;
- }
- firstLength -= start;
- secondLength -= start;
- if (firstLength === 0) {
- return secondLength;
- }
- let bCharacterCode;
- let result;
- let temporary;
- let temporary2;
- let index = 0;
- let index2 = 0;
- while (index < firstLength) {
- characterCodeCache[index] = first.charCodeAt(start + index);
- array[index] = ++index;
- }
- while (index2 < secondLength) {
- bCharacterCode = second.charCodeAt(start + index2);
- temporary = index2++;
- result = index2;
- for (index = 0; index < firstLength; index++) {
- temporary2 = bCharacterCode === characterCodeCache[index] ? temporary : temporary + 1;
- temporary = array[index];
- result = array[index] = temporary > result ? temporary2 > result ? result + 1 : temporary2 : temporary2 > temporary ? temporary + 1 : temporary2;
- }
- }
- return result;
- }
- var array;
- var characterCodeCache;
- var init_leven = __esm({
- "node_modules/leven/index.js"() {
- array = [];
- characterCodeCache = [];
- }
- });
- var require_normalize_cli_options = __commonJS2({
- "src/cli/options/normalize-cli-options.js"(exports2, module2) {
- "use strict";
- var {
- default: chalk2
- } = (init_source(), __toCommonJS(source_exports));
- var {
- default: leven2
- } = (init_leven(), __toCommonJS(leven_exports));
- var {
- optionsNormalizer
- } = require_prettier_internal();
- function normalizeCliOptions(options, optionInfos, opts) {
- return optionsNormalizer.normalizeCliOptions(options, optionInfos, Object.assign({
- colorsModule: chalk2,
- levenshteinDistance: leven2
- }, opts));
- }
- module2.exports = normalizeCliOptions;
- }
- });
- var require_parse_cli_arguments = __commonJS2({
- "src/cli/options/parse-cli-arguments.js"(exports2, module2) {
- "use strict";
- var camelCase = require_camelcase();
- var {
- pick
- } = require_utils();
- var getContextOptions = require_get_context_options();
- var minimist = require_minimist2();
- var createMinimistOptions = require_create_minimist_options();
- var normalizeCliOptions = require_normalize_cli_options();
- function parseArgv(rawArguments, detailedOptions, logger, keys) {
- const minimistOptions = createMinimistOptions(detailedOptions);
- let argv = minimist(rawArguments, minimistOptions);
- if (keys) {
- if (keys.includes("plugin-search-dir") && !keys.includes("plugin-search")) {
- keys.push("plugin-search");
- }
- detailedOptions = detailedOptions.filter((option) => keys.includes(option.name));
- argv = pick(argv, keys);
- }
- const normalized = normalizeCliOptions(argv, detailedOptions, {
- logger
- });
- return Object.assign(Object.assign({}, Object.fromEntries(Object.entries(normalized).map(([key, value]) => {
- const option = detailedOptions.find(({
- name
- }) => name === key) || {};
- return [option.forwardToApi || camelCase(key), value];
- }))), {}, {
- get __raw() {
- return argv;
- }
- });
- }
- var detailedOptionsWithoutPlugins = getContextOptions([], false).detailedOptions;
- function parseArgvWithoutPlugins2(rawArguments, logger, keys) {
- return parseArgv(rawArguments, detailedOptionsWithoutPlugins, logger, typeof keys === "string" ? [keys] : keys);
- }
- module2.exports = {
- parseArgv,
- parseArgvWithoutPlugins: parseArgvWithoutPlugins2
- };
- }
- });
- var require_context = __commonJS2({
- "src/cli/context.js"(exports2, module2) {
- "use strict";
- var {
- utils: {
- getLast
- }
- } = require_prettier_internal();
- var getContextOptions = require_get_context_options();
- var {
- parseArgv,
- parseArgvWithoutPlugins: parseArgvWithoutPlugins2
- } = require_parse_cli_arguments();
- var Context2 = class {
- constructor({
- rawArguments,
- logger
- }) {
- this.rawArguments = rawArguments;
- this.logger = logger;
- this.stack = [];
- const {
- plugins,
- pluginSearchDirs
- } = parseArgvWithoutPlugins2(rawArguments, logger, ["plugin", "plugin-search-dir"]);
- this.pushContextPlugins(plugins, pluginSearchDirs);
- const argv = parseArgv(rawArguments, this.detailedOptions, logger);
- this.argv = argv;
- this.filePatterns = argv._.map(String);
- }
- pushContextPlugins(plugins, pluginSearchDirs) {
- const options = getContextOptions(plugins, pluginSearchDirs);
- this.stack.push(options);
- Object.assign(this, options);
- }
- popContextPlugins() {
- this.stack.pop();
- Object.assign(this, getLast(this.stack));
- }
- get performanceTestFlag() {
- const {
- debugBenchmark,
- debugRepeat
- } = this.argv;
- if (debugBenchmark) {
- return {
- name: "--debug-benchmark",
- debugBenchmark: true
- };
- }
- if (debugRepeat > 0) {
- return {
- name: "--debug-repeat",
- debugRepeat
- };
- }
- const {
- PRETTIER_PERF_REPEAT
- } = process.env;
- if (PRETTIER_PERF_REPEAT && /^\d+$/.test(PRETTIER_PERF_REPEAT)) {
- return {
- name: "PRETTIER_PERF_REPEAT (environment variable)",
- debugRepeat: Number(PRETTIER_PERF_REPEAT)
- };
- }
- }
- };
- module2.exports = Context2;
- }
- });
- var require_usage = __commonJS2({
- "src/cli/usage.js"(exports2, module2) {
- "use strict";
- var camelCase = require_camelcase();
- var constant = require_constant();
- var {
- groupBy
- } = require_utils();
- var OPTION_USAGE_THRESHOLD = 25;
- var CHOICE_USAGE_MARGIN = 3;
- var CHOICE_USAGE_INDENTATION = 2;
- function indent(str, spaces) {
- return str.replace(/^/gm, " ".repeat(spaces));
- }
- function createDefaultValueDisplay(value) {
- return Array.isArray(value) ? `[${value.map(createDefaultValueDisplay).join(", ")}]` : value;
- }
- function getOptionDefaultValue(context, optionName) {
- if (!(optionName in context.detailedOptionMap)) {
- return;
- }
- const option = context.detailedOptionMap[optionName];
- if (option.default !== void 0) {
- return option.default;
- }
- const optionCamelName = camelCase(optionName);
- if (optionCamelName in context.apiDefaultOptions) {
- return context.apiDefaultOptions[optionCamelName];
- }
- }
- function createOptionUsageHeader(option) {
- const name = `--${option.name}`;
- const alias = option.alias ? `-${option.alias},` : null;
- const type = createOptionUsageType(option);
- return [alias, name, type].filter(Boolean).join(" ");
- }
- function createOptionUsageRow(header, content, threshold) {
- const separator = header.length >= threshold ? `
- ${" ".repeat(threshold)}` : " ".repeat(threshold - header.length);
- const description = content.replace(/\n/g, `
- ${" ".repeat(threshold)}`);
- return `${header}${separator}${description}`;
- }
- function createOptionUsageType(option) {
- switch (option.type) {
- case "boolean":
- return null;
- case "choice":
- return `<${option.choices.filter((choice) => !choice.deprecated && choice.since !== null).map((choice) => choice.value).join("|")}>`;
- default:
- return `<${option.type}>`;
- }
- }
- function createChoiceUsages(choices, margin, indentation) {
- const activeChoices = choices.filter((choice) => !choice.deprecated && choice.since !== null);
- const threshold = Math.max(0, ...activeChoices.map((choice) => choice.value.length)) + margin;
- return activeChoices.map((choice) => indent(createOptionUsageRow(choice.value, choice.description, threshold), indentation));
- }
- function createOptionUsage(context, option, threshold) {
- const header = createOptionUsageHeader(option);
- const optionDefaultValue = getOptionDefaultValue(context, option.name);
- return createOptionUsageRow(header, `${option.description}${optionDefaultValue === void 0 ? "" : `
- Defaults to ${createDefaultValueDisplay(optionDefaultValue)}.`}`, threshold);
- }
- function getOptionsWithOpposites(options) {
- const optionsWithOpposites = options.map((option) => [option.description ? option : null, option.oppositeDescription ? Object.assign(Object.assign({}, option), {}, {
- name: `no-${option.name}`,
- type: "boolean",
- description: option.oppositeDescription
- }) : null]);
- return optionsWithOpposites.flat().filter(Boolean);
- }
- function createUsage2(context) {
- const options = getOptionsWithOpposites(context.detailedOptions).filter((option) => !(option.type === "boolean" && option.oppositeDescription && !option.name.startsWith("no-")));
- const groupedOptions = groupBy(options, (option) => option.category);
- const firstCategories = constant.categoryOrder.slice(0, -1);
- const lastCategories = constant.categoryOrder.slice(-1);
- const restCategories = Object.keys(groupedOptions).filter((category) => !constant.categoryOrder.includes(category));
- const allCategories = [...firstCategories, ...restCategories, ...lastCategories];
- const optionsUsage = allCategories.map((category) => {
- const categoryOptions = groupedOptions[category].map((option) => createOptionUsage(context, option, OPTION_USAGE_THRESHOLD)).join("\n");
- return `${category} options:
- ${indent(categoryOptions, 2)}`;
- });
- return [constant.usageSummary, ...optionsUsage, ""].join("\n\n");
- }
- function createDetailedUsage2(context, flag) {
- const option = getOptionsWithOpposites(context.detailedOptions).find((option2) => option2.name === flag || option2.alias === flag);
- const header = createOptionUsageHeader(option);
- const description = `
- ${indent(option.description, 2)}`;
- const choices = option.type !== "choice" ? "" : `
- Valid options:
- ${createChoiceUsages(option.choices, CHOICE_USAGE_MARGIN, CHOICE_USAGE_INDENTATION).join("\n")}`;
- const optionDefaultValue = getOptionDefaultValue(context, option.name);
- const defaults = optionDefaultValue !== void 0 ? `
- Default: ${createDefaultValueDisplay(optionDefaultValue)}` : "";
- const pluginDefaults = option.pluginDefaults && Object.keys(option.pluginDefaults).length > 0 ? `
- Plugin defaults:${Object.entries(option.pluginDefaults).map(([key, value]) => `
- * ${key}: ${createDefaultValueDisplay(value)}`)}` : "";
- return `${header}${description}${choices}${defaults}${pluginDefaults}`;
- }
- module2.exports = {
- createUsage: createUsage2,
- createDetailedUsage: createDetailedUsage2
- };
- }
- });
- var require_array = __commonJS2({
- "node_modules/fast-glob/out/utils/array.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.splitWhen = exports2.flatten = void 0;
- function flatten(items) {
- return items.reduce((collection, item) => [].concat(collection, item), []);
- }
- exports2.flatten = flatten;
- function splitWhen(items, predicate) {
- const result = [[]];
- let groupIndex = 0;
- for (const item of items) {
- if (predicate(item)) {
- groupIndex++;
- result[groupIndex] = [];
- } else {
- result[groupIndex].push(item);
- }
- }
- return result;
- }
- exports2.splitWhen = splitWhen;
- }
- });
- var require_errno = __commonJS2({
- "node_modules/fast-glob/out/utils/errno.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.isEnoentCodeError = void 0;
- function isEnoentCodeError(error) {
- return error.code === "ENOENT";
- }
- exports2.isEnoentCodeError = isEnoentCodeError;
- }
- });
- var require_fs = __commonJS2({
- "node_modules/fast-glob/out/utils/fs.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.createDirentFromStats = void 0;
- var DirentFromStats = class {
- constructor(name, stats) {
- this.name = name;
- this.isBlockDevice = stats.isBlockDevice.bind(stats);
- this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
- this.isDirectory = stats.isDirectory.bind(stats);
- this.isFIFO = stats.isFIFO.bind(stats);
- this.isFile = stats.isFile.bind(stats);
- this.isSocket = stats.isSocket.bind(stats);
- this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
- }
- };
- function createDirentFromStats(name, stats) {
- return new DirentFromStats(name, stats);
- }
- exports2.createDirentFromStats = createDirentFromStats;
- }
- });
- var require_path = __commonJS2({
- "node_modules/fast-glob/out/utils/path.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.removeLeadingDotSegment = exports2.escape = exports2.makeAbsolute = exports2.unixify = void 0;
- var path = require("path");
- var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
- var UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
- function unixify(filepath) {
- return filepath.replace(/\\/g, "/");
- }
- exports2.unixify = unixify;
- function makeAbsolute(cwd, filepath) {
- return path.resolve(cwd, filepath);
- }
- exports2.makeAbsolute = makeAbsolute;
- function escape(pattern) {
- return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
- }
- exports2.escape = escape;
- function removeLeadingDotSegment(entry) {
- if (entry.charAt(0) === ".") {
- const secondCharactery = entry.charAt(1);
- if (secondCharactery === "/" || secondCharactery === "\\") {
- return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
- }
- }
- return entry;
- }
- exports2.removeLeadingDotSegment = removeLeadingDotSegment;
- }
- });
- var require_is_extglob = __commonJS2({
- "node_modules/is-extglob/index.js"(exports2, module2) {
- module2.exports = function isExtglob(str) {
- if (typeof str !== "string" || str === "") {
- return false;
- }
- var match;
- while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
- if (match[2])
- return true;
- str = str.slice(match.index + match[0].length);
- }
- return false;
- };
- }
- });
- var require_is_glob = __commonJS2({
- "node_modules/is-glob/index.js"(exports2, module2) {
- var isExtglob = require_is_extglob();
- var chars = {
- "{": "}",
- "(": ")",
- "[": "]"
- };
- var strictCheck = function(str) {
- if (str[0] === "!") {
- return true;
- }
- var index = 0;
- var pipeIndex = -2;
- var closeSquareIndex = -2;
- var closeCurlyIndex = -2;
- var closeParenIndex = -2;
- var backSlashIndex = -2;
- while (index < str.length) {
- if (str[index] === "*") {
- return true;
- }
- if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) {
- return true;
- }
- if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") {
- if (closeSquareIndex < index) {
- closeSquareIndex = str.indexOf("]", index);
- }
- if (closeSquareIndex > index) {
- if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
- return true;
- }
- backSlashIndex = str.indexOf("\\", index);
- if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
- return true;
- }
- }
- }
- if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") {
- closeCurlyIndex = str.indexOf("}", index);
- if (closeCurlyIndex > index) {
- backSlashIndex = str.indexOf("\\", index);
- if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
- return true;
- }
- }
- }
- if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") {
- closeParenIndex = str.indexOf(")", index);
- if (closeParenIndex > index) {
- backSlashIndex = str.indexOf("\\", index);
- if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
- return true;
- }
- }
- }
- if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") {
- if (pipeIndex < index) {
- pipeIndex = str.indexOf("|", index);
- }
- if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") {
- closeParenIndex = str.indexOf(")", pipeIndex);
- if (closeParenIndex > pipeIndex) {
- backSlashIndex = str.indexOf("\\", pipeIndex);
- if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
- return true;
- }
- }
- }
- }
- if (str[index] === "\\") {
- var open = str[index + 1];
- index += 2;
- var close = chars[open];
- if (close) {
- var n = str.indexOf(close, index);
- if (n !== -1) {
- index = n + 1;
- }
- }
- if (str[index] === "!") {
- return true;
- }
- } else {
- index++;
- }
- }
- return false;
- };
- var relaxedCheck = function(str) {
- if (str[0] === "!") {
- return true;
- }
- var index = 0;
- while (index < str.length) {
- if (/[*?{}()[\]]/.test(str[index])) {
- return true;
- }
- if (str[index] === "\\") {
- var open = str[index + 1];
- index += 2;
- var close = chars[open];
- if (close) {
- var n = str.indexOf(close, index);
- if (n !== -1) {
- index = n + 1;
- }
- }
- if (str[index] === "!") {
- return true;
- }
- } else {
- index++;
- }
- }
- return false;
- };
- module2.exports = function isGlob(str, options) {
- if (typeof str !== "string" || str === "") {
- return false;
- }
- if (isExtglob(str)) {
- return true;
- }
- var check = strictCheck;
- if (options && options.strict === false) {
- check = relaxedCheck;
- }
- return check(str);
- };
- }
- });
- var require_glob_parent = __commonJS2({
- "node_modules/glob-parent/index.js"(exports2, module2) {
- "use strict";
- var isGlob = require_is_glob();
- var pathPosixDirname = require("path").posix.dirname;
- var isWin32 = require("os").platform() === "win32";
- var slash = "/";
- var backslash = /\\/g;
- var enclosure = /[\{\[].*[\}\]]$/;
- var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
- var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
- module2.exports = function globParent(str, opts) {
- var options = Object.assign({
- flipBackslashes: true
- }, opts);
- if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
- str = str.replace(backslash, slash);
- }
- if (enclosure.test(str)) {
- str += slash;
- }
- str += "a";
- do {
- str = pathPosixDirname(str);
- } while (isGlob(str) || globby.test(str));
- return str.replace(escaped, "$1");
- };
- }
- });
- var require_utils2 = __commonJS2({
- "node_modules/braces/lib/utils.js"(exports2) {
- "use strict";
- exports2.isInteger = (num) => {
- if (typeof num === "number") {
- return Number.isInteger(num);
- }
- if (typeof num === "string" && num.trim() !== "") {
- return Number.isInteger(Number(num));
- }
- return false;
- };
- exports2.find = (node, type) => node.nodes.find((node2) => node2.type === type);
- exports2.exceedsLimit = (min, max, step = 1, limit) => {
- if (limit === false)
- return false;
- if (!exports2.isInteger(min) || !exports2.isInteger(max))
- return false;
- return (Number(max) - Number(min)) / Number(step) >= limit;
- };
- exports2.escapeNode = (block, n = 0, type) => {
- let node = block.nodes[n];
- if (!node)
- return;
- if (type && node.type === type || node.type === "open" || node.type === "close") {
- if (node.escaped !== true) {
- node.value = "\\" + node.value;
- node.escaped = true;
- }
- }
- };
- exports2.encloseBrace = (node) => {
- if (node.type !== "brace")
- return false;
- if (node.commas >> 0 + node.ranges >> 0 === 0) {
- node.invalid = true;
- return true;
- }
- return false;
- };
- exports2.isInvalidBrace = (block) => {
- if (block.type !== "brace")
- return false;
- if (block.invalid === true || block.dollar)
- return true;
- if (block.commas >> 0 + block.ranges >> 0 === 0) {
- block.invalid = true;
- return true;
- }
- if (block.open !== true || block.close !== true) {
- block.invalid = true;
- return true;
- }
- return false;
- };
- exports2.isOpenOrClose = (node) => {
- if (node.type === "open" || node.type === "close") {
- return true;
- }
- return node.open === true || node.close === true;
- };
- exports2.reduce = (nodes) => nodes.reduce((acc, node) => {
- if (node.type === "text")
- acc.push(node.value);
- if (node.type === "range")
- node.type = "text";
- return acc;
- }, []);
- exports2.flatten = (...args) => {
- const result = [];
- const flat = (arr) => {
- for (let i = 0; i < arr.length; i++) {
- let ele = arr[i];
- Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
- }
- return result;
- };
- flat(args);
- return result;
- };
- }
- });
- var require_stringify = __commonJS2({
- "node_modules/braces/lib/stringify.js"(exports2, module2) {
- "use strict";
- var utils = require_utils2();
- module2.exports = (ast, options = {}) => {
- let stringify2 = (node, parent = {}) => {
- let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
- let output = "";
- if (node.value) {
- if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
- return "\\" + node.value;
- }
- return node.value;
- }
- if (node.value) {
- return node.value;
- }
- if (node.nodes) {
- for (let child of node.nodes) {
- output += stringify2(child);
- }
- }
- return output;
- };
- return stringify2(ast);
- };
- }
- });
- var require_is_number = __commonJS2({
- "node_modules/is-number/index.js"(exports2, module2) {
- "use strict";
- module2.exports = function(num) {
- if (typeof num === "number") {
- return num - num === 0;
- }
- if (typeof num === "string" && num.trim() !== "") {
- return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
- }
- return false;
- };
- }
- });
- var require_to_regex_range = __commonJS2({
- "node_modules/to-regex-range/index.js"(exports2, module2) {
- "use strict";
- var isNumber = require_is_number();
- var toRegexRange = (min, max, options) => {
- if (isNumber(min) === false) {
- throw new TypeError("toRegexRange: expected the first argument to be a number");
- }
- if (max === void 0 || min === max) {
- return String(min);
- }
- if (isNumber(max) === false) {
- throw new TypeError("toRegexRange: expected the second argument to be a number.");
- }
- let opts = Object.assign({
- relaxZeros: true
- }, options);
- if (typeof opts.strictZeros === "boolean") {
- opts.relaxZeros = opts.strictZeros === false;
- }
- let relax = String(opts.relaxZeros);
- let shorthand = String(opts.shorthand);
- let capture = String(opts.capture);
- let wrap = String(opts.wrap);
- let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
- if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
- return toRegexRange.cache[cacheKey].result;
- }
- let a = Math.min(min, max);
- let b = Math.max(min, max);
- if (Math.abs(a - b) === 1) {
- let result = min + "|" + max;
- if (opts.capture) {
- return `(${result})`;
- }
- if (opts.wrap === false) {
- return result;
- }
- return `(?:${result})`;
- }
- let isPadded = hasPadding(min) || hasPadding(max);
- let state = {
- min,
- max,
- a,
- b
- };
- let positives = [];
- let negatives = [];
- if (isPadded) {
- state.isPadded = isPadded;
- state.maxLen = String(state.max).length;
- }
- if (a < 0) {
- let newMin = b < 0 ? Math.abs(b) : 1;
- negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
- a = state.a = 0;
- }
- if (b >= 0) {
- positives = splitToPatterns(a, b, state, opts);
- }
- state.negatives = negatives;
- state.positives = positives;
- state.result = collatePatterns(negatives, positives, opts);
- if (opts.capture === true) {
- state.result = `(${state.result})`;
- } else if (opts.wrap !== false && positives.length + negatives.length > 1) {
- state.result = `(?:${state.result})`;
- }
- toRegexRange.cache[cacheKey] = state;
- return state.result;
- };
- function collatePatterns(neg, pos, options) {
- let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
- let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
- let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
- let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
- return subpatterns.join("|");
- }
- function splitToRanges(min, max) {
- let nines = 1;
- let zeros = 1;
- let stop = countNines(min, nines);
- let stops = /* @__PURE__ */ new Set([max]);
- while (min <= stop && stop <= max) {
- stops.add(stop);
- nines += 1;
- stop = countNines(min, nines);
- }
- stop = countZeros(max + 1, zeros) - 1;
- while (min < stop && stop <= max) {
- stops.add(stop);
- zeros += 1;
- stop = countZeros(max + 1, zeros) - 1;
- }
- stops = [...stops];
- stops.sort(compare);
- return stops;
- }
- function rangeToPattern(start, stop, options) {
- if (start === stop) {
- return {
- pattern: start,
- count: [],
- digits: 0
- };
- }
- let zipped = zip(start, stop);
- let digits = zipped.length;
- let pattern = "";
- let count = 0;
- for (let i = 0; i < digits; i++) {
- let [startDigit, stopDigit] = zipped[i];
- if (startDigit === stopDigit) {
- pattern += startDigit;
- } else if (startDigit !== "0" || stopDigit !== "9") {
- pattern += toCharacterClass(startDigit, stopDigit, options);
- } else {
- count++;
- }
- }
- if (count) {
- pattern += options.shorthand === true ? "\\d" : "[0-9]";
- }
- return {
- pattern,
- count: [count],
- digits
- };
- }
- function splitToPatterns(min, max, tok, options) {
- let ranges = splitToRanges(min, max);
- let tokens = [];
- let start = min;
- let prev;
- for (let i = 0; i < ranges.length; i++) {
- let max2 = ranges[i];
- let obj = rangeToPattern(String(start), String(max2), options);
- let zeros = "";
- if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
- if (prev.count.length > 1) {
- prev.count.pop();
- }
- prev.count.push(obj.count[0]);
- prev.string = prev.pattern + toQuantifier(prev.count);
- start = max2 + 1;
- continue;
- }
- if (tok.isPadded) {
- zeros = padZeros(max2, tok, options);
- }
- obj.string = zeros + obj.pattern + toQuantifier(obj.count);
- tokens.push(obj);
- start = max2 + 1;
- prev = obj;
- }
- return tokens;
- }
- function filterPatterns(arr, comparison, prefix, intersection, options) {
- let result = [];
- for (let ele of arr) {
- let {
- string
- } = ele;
- if (!intersection && !contains(comparison, "string", string)) {
- result.push(prefix + string);
- }
- if (intersection && contains(comparison, "string", string)) {
- result.push(prefix + string);
- }
- }
- return result;
- }
- function zip(a, b) {
- let arr = [];
- for (let i = 0; i < a.length; i++)
- arr.push([a[i], b[i]]);
- return arr;
- }
- function compare(a, b) {
- return a > b ? 1 : b > a ? -1 : 0;
- }
- function contains(arr, key, val) {
- return arr.some((ele) => ele[key] === val);
- }
- function countNines(min, len) {
- return Number(String(min).slice(0, -len) + "9".repeat(len));
- }
- function countZeros(integer, zeros) {
- return integer - integer % Math.pow(10, zeros);
- }
- function toQuantifier(digits) {
- let [start = 0, stop = ""] = digits;
- if (stop || start > 1) {
- return `{${start + (stop ? "," + stop : "")}}`;
- }
- return "";
- }
- function toCharacterClass(a, b, options) {
- return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
- }
- function hasPadding(str) {
- return /^-?(0+)\d/.test(str);
- }
- function padZeros(value, tok, options) {
- if (!tok.isPadded) {
- return value;
- }
- let diff = Math.abs(tok.maxLen - String(value).length);
- let relax = options.relaxZeros !== false;
- switch (diff) {
- case 0:
- return "";
- case 1:
- return relax ? "0?" : "0";
- case 2:
- return relax ? "0{0,2}" : "00";
- default: {
- return relax ? `0{0,${diff}}` : `0{${diff}}`;
- }
- }
- }
- toRegexRange.cache = {};
- toRegexRange.clearCache = () => toRegexRange.cache = {};
- module2.exports = toRegexRange;
- }
- });
- var require_fill_range = __commonJS2({
- "node_modules/fill-range/index.js"(exports2, module2) {
- "use strict";
- var util = require("util");
- var toRegexRange = require_to_regex_range();
- var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
- var transform = (toNumber) => {
- return (value) => toNumber === true ? Number(value) : String(value);
- };
- var isValidValue = (value) => {
- return typeof value === "number" || typeof value === "string" && value !== "";
- };
- var isNumber = (num) => Number.isInteger(+num);
- var zeros = (input) => {
- let value = `${input}`;
- let index = -1;
- if (value[0] === "-")
- value = value.slice(1);
- if (value === "0")
- return false;
- while (value[++index] === "0")
- ;
- return index > 0;
- };
- var stringify2 = (start, end, options) => {
- if (typeof start === "string" || typeof end === "string") {
- return true;
- }
- return options.stringify === true;
- };
- var pad = (input, maxLength, toNumber) => {
- if (maxLength > 0) {
- let dash = input[0] === "-" ? "-" : "";
- if (dash)
- input = input.slice(1);
- input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
- }
- if (toNumber === false) {
- return String(input);
- }
- return input;
- };
- var toMaxLen = (input, maxLength) => {
- let negative = input[0] === "-" ? "-" : "";
- if (negative) {
- input = input.slice(1);
- maxLength--;
- }
- while (input.length < maxLength)
- input = "0" + input;
- return negative ? "-" + input : input;
- };
- var toSequence = (parts, options) => {
- parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
- parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
- let prefix = options.capture ? "" : "?:";
- let positives = "";
- let negatives = "";
- let result;
- if (parts.positives.length) {
- positives = parts.positives.join("|");
- }
- if (parts.negatives.length) {
- negatives = `-(${prefix}${parts.negatives.join("|")})`;
- }
- if (positives && negatives) {
- result = `${positives}|${negatives}`;
- } else {
- result = positives || negatives;
- }
- if (options.wrap) {
- return `(${prefix}${result})`;
- }
- return result;
- };
- var toRange = (a, b, isNumbers, options) => {
- if (isNumbers) {
- return toRegexRange(a, b, Object.assign({
- wrap: false
- }, options));
- }
- let start = String.fromCharCode(a);
- if (a === b)
- return start;
- let stop = String.fromCharCode(b);
- return `[${start}-${stop}]`;
- };
- var toRegex = (start, end, options) => {
- if (Array.isArray(start)) {
- let wrap = options.wrap === true;
- let prefix = options.capture ? "" : "?:";
- return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
- }
- return toRegexRange(start, end, options);
- };
- var rangeError = (...args) => {
- return new RangeError("Invalid range arguments: " + util.inspect(...args));
- };
- var invalidRange = (start, end, options) => {
- if (options.strictRanges === true)
- throw rangeError([start, end]);
- return [];
- };
- var invalidStep = (step, options) => {
- if (options.strictRanges === true) {
- throw new TypeError(`Expected step "${step}" to be a number`);
- }
- return [];
- };
- var fillNumbers = (start, end, step = 1, options = {}) => {
- let a = Number(start);
- let b = Number(end);
- if (!Number.isInteger(a) || !Number.isInteger(b)) {
- if (options.strictRanges === true)
- throw rangeError([start, end]);
- return [];
- }
- if (a === 0)
- a = 0;
- if (b === 0)
- b = 0;
- let descending = a > b;
- let startString = String(start);
- let endString = String(end);
- let stepString = String(step);
- step = Math.max(Math.abs(step), 1);
- let padded = zeros(startString) || zeros(endString) || zeros(stepString);
- let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
- let toNumber = padded === false && stringify2(start, end, options) === false;
- let format = options.transform || transform(toNumber);
- if (options.toRegex && step === 1) {
- return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
- }
- let parts = {
- negatives: [],
- positives: []
- };
- let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
- let range = [];
- let index = 0;
- while (descending ? a >= b : a <= b) {
- if (options.toRegex === true && step > 1) {
- push(a);
- } else {
- range.push(pad(format(a, index), maxLen, toNumber));
- }
- a = descending ? a - step : a + step;
- index++;
- }
- if (options.toRegex === true) {
- return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({
- wrap: false
- }, options));
- }
- return range;
- };
- var fillLetters = (start, end, step = 1, options = {}) => {
- if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
- return invalidRange(start, end, options);
- }
- let format = options.transform || ((val) => String.fromCharCode(val));
- let a = `${start}`.charCodeAt(0);
- let b = `${end}`.charCodeAt(0);
- let descending = a > b;
- let min = Math.min(a, b);
- let max = Math.max(a, b);
- if (options.toRegex && step === 1) {
- return toRange(min, max, false, options);
- }
- let range = [];
- let index = 0;
- while (descending ? a >= b : a <= b) {
- range.push(format(a, index));
- a = descending ? a - step : a + step;
- index++;
- }
- if (options.toRegex === true) {
- return toRegex(range, null, {
- wrap: false,
- options
- });
- }
- return range;
- };
- var fill = (start, end, step, options = {}) => {
- if (end == null && isValidValue(start)) {
- return [start];
- }
- if (!isValidValue(start) || !isValidValue(end)) {
- return invalidRange(start, end, options);
- }
- if (typeof step === "function") {
- return fill(start, end, 1, {
- transform: step
- });
- }
- if (isObject(step)) {
- return fill(start, end, 0, step);
- }
- let opts = Object.assign({}, options);
- if (opts.capture === true)
- opts.wrap = true;
- step = step || opts.step || 1;
- if (!isNumber(step)) {
- if (step != null && !isObject(step))
- return invalidStep(step, opts);
- return fill(start, end, 1, step);
- }
- if (isNumber(start) && isNumber(end)) {
- return fillNumbers(start, end, step, opts);
- }
- return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
- };
- module2.exports = fill;
- }
- });
- var require_compile = __commonJS2({
- "node_modules/braces/lib/compile.js"(exports2, module2) {
- "use strict";
- var fill = require_fill_range();
- var utils = require_utils2();
- var compile = (ast, options = {}) => {
- let walk = (node, parent = {}) => {
- let invalidBlock = utils.isInvalidBrace(parent);
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
- let invalid = invalidBlock === true || invalidNode === true;
- let prefix = options.escapeInvalid === true ? "\\" : "";
- let output = "";
- if (node.isOpen === true) {
- return prefix + node.value;
- }
- if (node.isClose === true) {
- return prefix + node.value;
- }
- if (node.type === "open") {
- return invalid ? prefix + node.value : "(";
- }
- if (node.type === "close") {
- return invalid ? prefix + node.value : ")";
- }
- if (node.type === "comma") {
- return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
- }
- if (node.value) {
- return node.value;
- }
- if (node.nodes && node.ranges > 0) {
- let args = utils.reduce(node.nodes);
- let range = fill(...args, Object.assign(Object.assign({}, options), {}, {
- wrap: false,
- toRegex: true
- }));
- if (range.length !== 0) {
- return args.length > 1 && range.length > 1 ? `(${range})` : range;
- }
- }
- if (node.nodes) {
- for (let child of node.nodes) {
- output += walk(child, node);
- }
- }
- return output;
- };
- return walk(ast);
- };
- module2.exports = compile;
- }
- });
- var require_expand = __commonJS2({
- "node_modules/braces/lib/expand.js"(exports2, module2) {
- "use strict";
- var fill = require_fill_range();
- var stringify2 = require_stringify();
- var utils = require_utils2();
- var append = (queue = "", stash = "", enclose = false) => {
- let result = [];
- queue = [].concat(queue);
- stash = [].concat(stash);
- if (!stash.length)
- return queue;
- if (!queue.length) {
- return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
- }
- for (let item of queue) {
- if (Array.isArray(item)) {
- for (let value of item) {
- result.push(append(value, stash, enclose));
- }
- } else {
- for (let ele of stash) {
- if (enclose === true && typeof ele === "string")
- ele = `{${ele}}`;
- result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
- }
- }
- }
- return utils.flatten(result);
- };
- var expand = (ast, options = {}) => {
- let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
- let walk = (node, parent = {}) => {
- node.queue = [];
- let p = parent;
- let q = parent.queue;
- while (p.type !== "brace" && p.type !== "root" && p.parent) {
- p = p.parent;
- q = p.queue;
- }
- if (node.invalid || node.dollar) {
- q.push(append(q.pop(), stringify2(node, options)));
- return;
- }
- if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
- q.push(append(q.pop(), ["{}"]));
- return;
- }
- if (node.nodes && node.ranges > 0) {
- let args = utils.reduce(node.nodes);
- if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
- throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
- }
- let range = fill(...args, options);
- if (range.length === 0) {
- range = stringify2(node, options);
- }
- q.push(append(q.pop(), range));
- node.nodes = [];
- return;
- }
- let enclose = utils.encloseBrace(node);
- let queue = node.queue;
- let block = node;
- while (block.type !== "brace" && block.type !== "root" && block.parent) {
- block = block.parent;
- queue = block.queue;
- }
- for (let i = 0; i < node.nodes.length; i++) {
- let child = node.nodes[i];
- if (child.type === "comma" && node.type === "brace") {
- if (i === 1)
- queue.push("");
- queue.push("");
- continue;
- }
- if (child.type === "close") {
- q.push(append(q.pop(), queue, enclose));
- continue;
- }
- if (child.value && child.type !== "open") {
- queue.push(append(queue.pop(), child.value));
- continue;
- }
- if (child.nodes) {
- walk(child, node);
- }
- }
- return queue;
- };
- return utils.flatten(walk(ast));
- };
- module2.exports = expand;
- }
- });
- var require_constants = __commonJS2({
- "node_modules/braces/lib/constants.js"(exports2, module2) {
- "use strict";
- module2.exports = {
- MAX_LENGTH: 1024 * 64,
- CHAR_0: "0",
- CHAR_9: "9",
- CHAR_UPPERCASE_A: "A",
- CHAR_LOWERCASE_A: "a",
- CHAR_UPPERCASE_Z: "Z",
- CHAR_LOWERCASE_Z: "z",
- CHAR_LEFT_PARENTHESES: "(",
- CHAR_RIGHT_PARENTHESES: ")",
- CHAR_ASTERISK: "*",
- CHAR_AMPERSAND: "&",
- CHAR_AT: "@",
- CHAR_BACKSLASH: "\\",
- CHAR_BACKTICK: "`",
- CHAR_CARRIAGE_RETURN: "\r",
- CHAR_CIRCUMFLEX_ACCENT: "^",
- CHAR_COLON: ":",
- CHAR_COMMA: ",",
- CHAR_DOLLAR: "$",
- CHAR_DOT: ".",
- CHAR_DOUBLE_QUOTE: '"',
- CHAR_EQUAL: "=",
- CHAR_EXCLAMATION_MARK: "!",
- CHAR_FORM_FEED: "\f",
- CHAR_FORWARD_SLASH: "/",
- CHAR_HASH: "#",
- CHAR_HYPHEN_MINUS: "-",
- CHAR_LEFT_ANGLE_BRACKET: "<",
- CHAR_LEFT_CURLY_BRACE: "{",
- CHAR_LEFT_SQUARE_BRACKET: "[",
- CHAR_LINE_FEED: "\n",
- CHAR_NO_BREAK_SPACE: "\xA0",
- CHAR_PERCENT: "%",
- CHAR_PLUS: "+",
- CHAR_QUESTION_MARK: "?",
- CHAR_RIGHT_ANGLE_BRACKET: ">",
- CHAR_RIGHT_CURLY_BRACE: "}",
- CHAR_RIGHT_SQUARE_BRACKET: "]",
- CHAR_SEMICOLON: ";",
- CHAR_SINGLE_QUOTE: "'",
- CHAR_SPACE: " ",
- CHAR_TAB: " ",
- CHAR_UNDERSCORE: "_",
- CHAR_VERTICAL_LINE: "|",
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
- };
- }
- });
- var require_parse = __commonJS2({
- "node_modules/braces/lib/parse.js"(exports2, module2) {
- "use strict";
- var stringify2 = require_stringify();
- var {
- MAX_LENGTH,
- CHAR_BACKSLASH,
- CHAR_BACKTICK,
- CHAR_COMMA,
- CHAR_DOT,
- CHAR_LEFT_PARENTHESES,
- CHAR_RIGHT_PARENTHESES,
- CHAR_LEFT_CURLY_BRACE,
- CHAR_RIGHT_CURLY_BRACE,
- CHAR_LEFT_SQUARE_BRACKET,
- CHAR_RIGHT_SQUARE_BRACKET,
- CHAR_DOUBLE_QUOTE,
- CHAR_SINGLE_QUOTE,
- CHAR_NO_BREAK_SPACE,
- CHAR_ZERO_WIDTH_NOBREAK_SPACE
- } = require_constants();
- var parse = (input, options = {}) => {
- if (typeof input !== "string") {
- throw new TypeError("Expected a string");
- }
- let opts = options || {};
- let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
- if (input.length > max) {
- throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
- }
- let ast = {
- type: "root",
- input,
- nodes: []
- };
- let stack = [ast];
- let block = ast;
- let prev = ast;
- let brackets = 0;
- let length = input.length;
- let index = 0;
- let depth = 0;
- let value;
- let memo = {};
- const advance = () => input[index++];
- const push = (node) => {
- if (node.type === "text" && prev.type === "dot") {
- prev.type = "text";
- }
- if (prev && prev.type === "text" && node.type === "text") {
- prev.value += node.value;
- return;
- }
- block.nodes.push(node);
- node.parent = block;
- node.prev = prev;
- prev = node;
- return node;
- };
- push({
- type: "bos"
- });
- while (index < length) {
- block = stack[stack.length - 1];
- value = advance();
- if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
- continue;
- }
- if (value === CHAR_BACKSLASH) {
- push({
- type: "text",
- value: (options.keepEscaping ? value : "") + advance()
- });
- continue;
- }
- if (value === CHAR_RIGHT_SQUARE_BRACKET) {
- push({
- type: "text",
- value: "\\" + value
- });
- continue;
- }
- if (value === CHAR_LEFT_SQUARE_BRACKET) {
- brackets++;
- let closed = true;
- let next;
- while (index < length && (next = advance())) {
- value += next;
- if (next === CHAR_LEFT_SQUARE_BRACKET) {
- brackets++;
- continue;
- }
- if (next === CHAR_BACKSLASH) {
- value += advance();
- continue;
- }
- if (next === CHAR_RIGHT_SQUARE_BRACKET) {
- brackets--;
- if (brackets === 0) {
- break;
- }
- }
- }
- push({
- type: "text",
- value
- });
- continue;
- }
- if (value === CHAR_LEFT_PARENTHESES) {
- block = push({
- type: "paren",
- nodes: []
- });
- stack.push(block);
- push({
- type: "text",
- value
- });
- continue;
- }
- if (value === CHAR_RIGHT_PARENTHESES) {
- if (block.type !== "paren") {
- push({
- type: "text",
- value
- });
- continue;
- }
- block = stack.pop();
- push({
- type: "text",
- value
- });
- block = stack[stack.length - 1];
- continue;
- }
- if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
- let open = value;
- let next;
- if (options.keepQuotes !== true) {
- value = "";
- }
- while (index < length && (next = advance())) {
- if (next === CHAR_BACKSLASH) {
- value += next + advance();
- continue;
- }
- if (next === open) {
- if (options.keepQuotes === true)
- value += next;
- break;
- }
- value += next;
- }
- push({
- type: "text",
- value
- });
- continue;
- }
- if (value === CHAR_LEFT_CURLY_BRACE) {
- depth++;
- let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
- let brace = {
- type: "brace",
- open: true,
- close: false,
- dollar,
- depth,
- commas: 0,
- ranges: 0,
- nodes: []
- };
- block = push(brace);
- stack.push(block);
- push({
- type: "open",
- value
- });
- continue;
- }
- if (value === CHAR_RIGHT_CURLY_BRACE) {
- if (block.type !== "brace") {
- push({
- type: "text",
- value
- });
- continue;
- }
- let type = "close";
- block = stack.pop();
- block.close = true;
- push({
- type,
- value
- });
- depth--;
- block = stack[stack.length - 1];
- continue;
- }
- if (value === CHAR_COMMA && depth > 0) {
- if (block.ranges > 0) {
- block.ranges = 0;
- let open = block.nodes.shift();
- block.nodes = [open, {
- type: "text",
- value: stringify2(block)
- }];
- }
- push({
- type: "comma",
- value
- });
- block.commas++;
- continue;
- }
- if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
- let siblings = block.nodes;
- if (depth === 0 || siblings.length === 0) {
- push({
- type: "text",
- value
- });
- continue;
- }
- if (prev.type === "dot") {
- block.range = [];
- prev.value += value;
- prev.type = "range";
- if (block.nodes.length !== 3 && block.nodes.length !== 5) {
- block.invalid = true;
- block.ranges = 0;
- prev.type = "text";
- continue;
- }
- block.ranges++;
- block.args = [];
- continue;
- }
- if (prev.type === "range") {
- siblings.pop();
- let before = siblings[siblings.length - 1];
- before.value += prev.value + value;
- prev = before;
- block.ranges--;
- continue;
- }
- push({
- type: "dot",
- value
- });
- continue;
- }
- push({
- type: "text",
- value
- });
- }
- do {
- block = stack.pop();
- if (block.type !== "root") {
- block.nodes.forEach((node) => {
- if (!node.nodes) {
- if (node.type === "open")
- node.isOpen = true;
- if (node.type === "close")
- node.isClose = true;
- if (!node.nodes)
- node.type = "text";
- node.invalid = true;
- }
- });
- let parent = stack[stack.length - 1];
- let index2 = parent.nodes.indexOf(block);
- parent.nodes.splice(index2, 1, ...block.nodes);
- }
- } while (stack.length > 0);
- push({
- type: "eos"
- });
- return ast;
- };
- module2.exports = parse;
- }
- });
- var require_braces = __commonJS2({
- "node_modules/braces/index.js"(exports2, module2) {
- "use strict";
- var stringify2 = require_stringify();
- var compile = require_compile();
- var expand = require_expand();
- var parse = require_parse();
- var braces = (input, options = {}) => {
- let output = [];
- if (Array.isArray(input)) {
- for (let pattern of input) {
- let result = braces.create(pattern, options);
- if (Array.isArray(result)) {
- output.push(...result);
- } else {
- output.push(result);
- }
- }
- } else {
- output = [].concat(braces.create(input, options));
- }
- if (options && options.expand === true && options.nodupes === true) {
- output = [...new Set(output)];
- }
- return output;
- };
- braces.parse = (input, options = {}) => parse(input, options);
- braces.stringify = (input, options = {}) => {
- if (typeof input === "string") {
- return stringify2(braces.parse(input, options), options);
- }
- return stringify2(input, options);
- };
- braces.compile = (input, options = {}) => {
- if (typeof input === "string") {
- input = braces.parse(input, options);
- }
- return compile(input, options);
- };
- braces.expand = (input, options = {}) => {
- if (typeof input === "string") {
- input = braces.parse(input, options);
- }
- let result = expand(input, options);
- if (options.noempty === true) {
- result = result.filter(Boolean);
- }
- if (options.nodupes === true) {
- result = [...new Set(result)];
- }
- return result;
- };
- braces.create = (input, options = {}) => {
- if (input === "" || input.length < 3) {
- return [input];
- }
- return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
- };
- module2.exports = braces;
- }
- });
- var require_constants2 = __commonJS2({
- "node_modules/picomatch/lib/constants.js"(exports2, module2) {
- "use strict";
- var path = require("path");
- var WIN_SLASH = "\\\\/";
- var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
- var DOT_LITERAL = "\\.";
- var PLUS_LITERAL = "\\+";
- var QMARK_LITERAL = "\\?";
- var SLASH_LITERAL = "\\/";
- var ONE_CHAR = "(?=.)";
- var QMARK = "[^/]";
- var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
- var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
- var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
- var NO_DOT = `(?!${DOT_LITERAL})`;
- var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
- var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
- var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
- var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
- var STAR = `${QMARK}*?`;
- var POSIX_CHARS = {
- DOT_LITERAL,
- PLUS_LITERAL,
- QMARK_LITERAL,
- SLASH_LITERAL,
- ONE_CHAR,
- QMARK,
- END_ANCHOR,
- DOTS_SLASH,
- NO_DOT,
- NO_DOTS,
- NO_DOT_SLASH,
- NO_DOTS_SLASH,
- QMARK_NO_DOT,
- STAR,
- START_ANCHOR
- };
- var WINDOWS_CHARS = Object.assign(Object.assign({}, POSIX_CHARS), {}, {
- SLASH_LITERAL: `[${WIN_SLASH}]`,
- QMARK: WIN_NO_SLASH,
- STAR: `${WIN_NO_SLASH}*?`,
- DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
- NO_DOT: `(?!${DOT_LITERAL})`,
- NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
- NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
- NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
- QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
- START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
- END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
- });
- var POSIX_REGEX_SOURCE = {
- alnum: "a-zA-Z0-9",
- alpha: "a-zA-Z",
- ascii: "\\x00-\\x7F",
- blank: " \\t",
- cntrl: "\\x00-\\x1F\\x7F",
- digit: "0-9",
- graph: "\\x21-\\x7E",
- lower: "a-z",
- print: "\\x20-\\x7E ",
- punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
- space: " \\t\\r\\n\\v\\f",
- upper: "A-Z",
- word: "A-Za-z0-9_",
- xdigit: "A-Fa-f0-9"
- };
- module2.exports = {
- MAX_LENGTH: 1024 * 64,
- POSIX_REGEX_SOURCE,
- REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
- REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
- REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
- REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
- REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
- REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
- REPLACEMENTS: {
- "***": "*",
- "**/**": "**",
- "**/**/**": "**"
- },
- CHAR_0: 48,
- CHAR_9: 57,
- CHAR_UPPERCASE_A: 65,
- CHAR_LOWERCASE_A: 97,
- CHAR_UPPERCASE_Z: 90,
- CHAR_LOWERCASE_Z: 122,
- CHAR_LEFT_PARENTHESES: 40,
- CHAR_RIGHT_PARENTHESES: 41,
- CHAR_ASTERISK: 42,
- CHAR_AMPERSAND: 38,
- CHAR_AT: 64,
- CHAR_BACKWARD_SLASH: 92,
- CHAR_CARRIAGE_RETURN: 13,
- CHAR_CIRCUMFLEX_ACCENT: 94,
- CHAR_COLON: 58,
- CHAR_COMMA: 44,
- CHAR_DOT: 46,
- CHAR_DOUBLE_QUOTE: 34,
- CHAR_EQUAL: 61,
- CHAR_EXCLAMATION_MARK: 33,
- CHAR_FORM_FEED: 12,
- CHAR_FORWARD_SLASH: 47,
- CHAR_GRAVE_ACCENT: 96,
- CHAR_HASH: 35,
- CHAR_HYPHEN_MINUS: 45,
- CHAR_LEFT_ANGLE_BRACKET: 60,
- CHAR_LEFT_CURLY_BRACE: 123,
- CHAR_LEFT_SQUARE_BRACKET: 91,
- CHAR_LINE_FEED: 10,
- CHAR_NO_BREAK_SPACE: 160,
- CHAR_PERCENT: 37,
- CHAR_PLUS: 43,
- CHAR_QUESTION_MARK: 63,
- CHAR_RIGHT_ANGLE_BRACKET: 62,
- CHAR_RIGHT_CURLY_BRACE: 125,
- CHAR_RIGHT_SQUARE_BRACKET: 93,
- CHAR_SEMICOLON: 59,
- CHAR_SINGLE_QUOTE: 39,
- CHAR_SPACE: 32,
- CHAR_TAB: 9,
- CHAR_UNDERSCORE: 95,
- CHAR_VERTICAL_LINE: 124,
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
- SEP: path.sep,
- extglobChars(chars) {
- return {
- "!": {
- type: "negate",
- open: "(?:(?!(?:",
- close: `))${chars.STAR})`
- },
- "?": {
- type: "qmark",
- open: "(?:",
- close: ")?"
- },
- "+": {
- type: "plus",
- open: "(?:",
- close: ")+"
- },
- "*": {
- type: "star",
- open: "(?:",
- close: ")*"
- },
- "@": {
- type: "at",
- open: "(?:",
- close: ")"
- }
- };
- },
- globChars(win32) {
- return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
- }
- };
- }
- });
- var require_utils3 = __commonJS2({
- "node_modules/picomatch/lib/utils.js"(exports2) {
- "use strict";
- var path = require("path");
- var win32 = process.platform === "win32";
- var {
- REGEX_BACKSLASH,
- REGEX_REMOVE_BACKSLASH,
- REGEX_SPECIAL_CHARS,
- REGEX_SPECIAL_CHARS_GLOBAL
- } = require_constants2();
- exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
- exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
- exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
- exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
- exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
- exports2.removeBackslashes = (str) => {
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
- return match === "\\" ? "" : match;
- });
- };
- exports2.supportsLookbehinds = () => {
- const segs = process.version.slice(1).split(".").map(Number);
- if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
- return true;
- }
- return false;
- };
- exports2.isWindows = (options) => {
- if (options && typeof options.windows === "boolean") {
- return options.windows;
- }
- return win32 === true || path.sep === "\\";
- };
- exports2.escapeLast = (input, char, lastIdx) => {
- const idx = input.lastIndexOf(char, lastIdx);
- if (idx === -1)
- return input;
- if (input[idx - 1] === "\\")
- return exports2.escapeLast(input, char, idx - 1);
- return `${input.slice(0, idx)}\\${input.slice(idx)}`;
- };
- exports2.removePrefix = (input, state = {}) => {
- let output = input;
- if (output.startsWith("./")) {
- output = output.slice(2);
- state.prefix = "./";
- }
- return output;
- };
- exports2.wrapOutput = (input, state = {}, options = {}) => {
- const prepend = options.contains ? "" : "^";
- const append = options.contains ? "" : "$";
- let output = `${prepend}(?:${input})${append}`;
- if (state.negated === true) {
- output = `(?:^(?!${output}).*$)`;
- }
- return output;
- };
- }
- });
- var require_scan = __commonJS2({
- "node_modules/picomatch/lib/scan.js"(exports2, module2) {
- "use strict";
- var utils = require_utils3();
- var {
- CHAR_ASTERISK,
- CHAR_AT,
- CHAR_BACKWARD_SLASH,
- CHAR_COMMA,
- CHAR_DOT,
- CHAR_EXCLAMATION_MARK,
- CHAR_FORWARD_SLASH,
- CHAR_LEFT_CURLY_BRACE,
- CHAR_LEFT_PARENTHESES,
- CHAR_LEFT_SQUARE_BRACKET,
- CHAR_PLUS,
- CHAR_QUESTION_MARK,
- CHAR_RIGHT_CURLY_BRACE,
- CHAR_RIGHT_PARENTHESES,
- CHAR_RIGHT_SQUARE_BRACKET
- } = require_constants2();
- var isPathSeparator = (code) => {
- return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
- };
- var depth = (token) => {
- if (token.isPrefix !== true) {
- token.depth = token.isGlobstar ? Infinity : 1;
- }
- };
- var scan = (input, options) => {
- const opts = options || {};
- const length = input.length - 1;
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
- const slashes = [];
- const tokens = [];
- const parts = [];
- let str = input;
- let index = -1;
- let start = 0;
- let lastIndex = 0;
- let isBrace = false;
- let isBracket = false;
- let isGlob = false;
- let isExtglob = false;
- let isGlobstar = false;
- let braceEscaped = false;
- let backslashes = false;
- let negated = false;
- let negatedExtglob = false;
- let finished = false;
- let braces = 0;
- let prev;
- let code;
- let token = {
- value: "",
- depth: 0,
- isGlob: false
- };
- const eos = () => index >= length;
- const peek = () => str.charCodeAt(index + 1);
- const advance = () => {
- prev = code;
- return str.charCodeAt(++index);
- };
- while (index < length) {
- code = advance();
- let next;
- if (code === CHAR_BACKWARD_SLASH) {
- backslashes = token.backslashes = true;
- code = advance();
- if (code === CHAR_LEFT_CURLY_BRACE) {
- braceEscaped = true;
- }
- continue;
- }
- if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
- braces++;
- while (eos() !== true && (code = advance())) {
- if (code === CHAR_BACKWARD_SLASH) {
- backslashes = token.backslashes = true;
- advance();
- continue;
- }
- if (code === CHAR_LEFT_CURLY_BRACE) {
- braces++;
- continue;
- }
- if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
- isBrace = token.isBrace = true;
- isGlob = token.isGlob = true;
- finished = true;
- if (scanToEnd === true) {
- continue;
- }
- break;
- }
- if (braceEscaped !== true && code === CHAR_COMMA) {
- isBrace = token.isBrace = true;
- isGlob = token.isGlob = true;
- finished = true;
- if (scanToEnd === true) {
- continue;
- }
- break;
- }
- if (code === CHAR_RIGHT_CURLY_BRACE) {
- braces--;
- if (braces === 0) {
- braceEscaped = false;
- isBrace = token.isBrace = true;
- finished = true;
- break;
- }
- }
- }
- if (scanToEnd === true) {
- continue;
- }
- break;
- }
- if (code === CHAR_FORWARD_SLASH) {
- slashes.push(index);
- tokens.push(token);
- token = {
- value: "",
- depth: 0,
- isGlob: false
- };
- if (finished === true)
- continue;
- if (prev === CHAR_DOT && index === start + 1) {
- start += 2;
- continue;
- }
- lastIndex = index + 1;
- continue;
- }
- if (opts.noext !== true) {
- const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
- if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
- isGlob = token.isGlob = true;
- isExtglob = token.isExtglob = true;
- finished = true;
- if (code === CHAR_EXCLAMATION_MARK && index === start) {
- negatedExtglob = true;
- }
- if (scanToEnd === true) {
- while (eos() !== true && (code = advance())) {
- if (code === CHAR_BACKWARD_SLASH) {
- backslashes = token.backslashes = true;
- code = advance();
- continue;
- }
- if (code === CHAR_RIGHT_PARENTHESES) {
- isGlob = token.isGlob = true;
- finished = true;
- break;
- }
- }
- continue;
- }
- break;
- }
- }
- if (code === CHAR_ASTERISK) {
- if (prev === CHAR_ASTERISK)
- isGlobstar = token.isGlobstar = true;
- isGlob = token.isGlob = true;
- finished = true;
- if (scanToEnd === true) {
- continue;
- }
- break;
- }
- if (code === CHAR_QUESTION_MARK) {
- isGlob = token.isGlob = true;
- finished = true;
- if (scanToEnd === true) {
- continue;
- }
- break;
- }
- if (code === CHAR_LEFT_SQUARE_BRACKET) {
- while (eos() !== true && (next = advance())) {
- if (next === CHAR_BACKWARD_SLASH) {
- backslashes = token.backslashes = true;
- advance();
- continue;
- }
- if (next === CHAR_RIGHT_SQUARE_BRACKET) {
- isBracket = token.isBracket = true;
- isGlob = token.isGlob = true;
- finished = true;
- break;
- }
- }
- if (scanToEnd === true) {
- continue;
- }
- break;
- }
- if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
- negated = token.negated = true;
- start++;
- continue;
- }
- if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
- isGlob = token.isGlob = true;
- if (scanToEnd === true) {
- while (eos() !== true && (code = advance())) {
- if (code === CHAR_LEFT_PARENTHESES) {
- backslashes = token.backslashes = true;
- code = advance();
- continue;
- }
- if (code === CHAR_RIGHT_PARENTHESES) {
- finished = true;
- break;
- }
- }
- continue;
- }
- break;
- }
- if (isGlob === true) {
- finished = true;
- if (scanToEnd === true) {
- continue;
- }
- break;
- }
- }
- if (opts.noext === true) {
- isExtglob = false;
- isGlob = false;
- }
- let base = str;
- let prefix = "";
- let glob = "";
- if (start > 0) {
- prefix = str.slice(0, start);
- str = str.slice(start);
- lastIndex -= start;
- }
- if (base && isGlob === true && lastIndex > 0) {
- base = str.slice(0, lastIndex);
- glob = str.slice(lastIndex);
- } else if (isGlob === true) {
- base = "";
- glob = str;
- } else {
- base = str;
- }
- if (base && base !== "" && base !== "/" && base !== str) {
- if (isPathSeparator(base.charCodeAt(base.length - 1))) {
- base = base.slice(0, -1);
- }
- }
- if (opts.unescape === true) {
- if (glob)
- glob = utils.removeBackslashes(glob);
- if (base && backslashes === true) {
- base = utils.removeBackslashes(base);
- }
- }
- const state = {
- prefix,
- input,
- start,
- base,
- glob,
- isBrace,
- isBracket,
- isGlob,
- isExtglob,
- isGlobstar,
- negated,
- negatedExtglob
- };
- if (opts.tokens === true) {
- state.maxDepth = 0;
- if (!isPathSeparator(code)) {
- tokens.push(token);
- }
- state.tokens = tokens;
- }
- if (opts.parts === true || opts.tokens === true) {
- let prevIndex;
- for (let idx = 0; idx < slashes.length; idx++) {
- const n = prevIndex ? prevIndex + 1 : start;
- const i = slashes[idx];
- const value = input.slice(n, i);
- if (opts.tokens) {
- if (idx === 0 && start !== 0) {
- tokens[idx].isPrefix = true;
- tokens[idx].value = prefix;
- } else {
- tokens[idx].value = value;
- }
- depth(tokens[idx]);
- state.maxDepth += tokens[idx].depth;
- }
- if (idx !== 0 || value !== "") {
- parts.push(value);
- }
- prevIndex = i;
- }
- if (prevIndex && prevIndex + 1 < input.length) {
- const value = input.slice(prevIndex + 1);
- parts.push(value);
- if (opts.tokens) {
- tokens[tokens.length - 1].value = value;
- depth(tokens[tokens.length - 1]);
- state.maxDepth += tokens[tokens.length - 1].depth;
- }
- }
- state.slashes = slashes;
- state.parts = parts;
- }
- return state;
- };
- module2.exports = scan;
- }
- });
- var require_parse2 = __commonJS2({
- "node_modules/picomatch/lib/parse.js"(exports2, module2) {
- "use strict";
- var constants = require_constants2();
- var utils = require_utils3();
- var {
- MAX_LENGTH,
- POSIX_REGEX_SOURCE,
- REGEX_NON_SPECIAL_CHARS,
- REGEX_SPECIAL_CHARS_BACKREF,
- REPLACEMENTS
- } = constants;
- var expandRange = (args, options) => {
- if (typeof options.expandRange === "function") {
- return options.expandRange(...args, options);
- }
- args.sort();
- const value = `[${args.join("-")}]`;
- try {
- new RegExp(value);
- } catch (ex) {
- return args.map((v) => utils.escapeRegex(v)).join("..");
- }
- return value;
- };
- var syntaxError = (type, char) => {
- return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
- };
- var parse = (input, options) => {
- if (typeof input !== "string") {
- throw new TypeError("Expected a string");
- }
- input = REPLACEMENTS[input] || input;
- const opts = Object.assign({}, options);
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
- let len = input.length;
- if (len > max) {
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
- }
- const bos = {
- type: "bos",
- value: "",
- output: opts.prepend || ""
- };
- const tokens = [bos];
- const capture = opts.capture ? "" : "?:";
- const win32 = utils.isWindows(options);
- const PLATFORM_CHARS = constants.globChars(win32);
- const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
- const {
- DOT_LITERAL,
- PLUS_LITERAL,
- SLASH_LITERAL,
- ONE_CHAR,
- DOTS_SLASH,
- NO_DOT,
- NO_DOT_SLASH,
- NO_DOTS_SLASH,
- QMARK,
- QMARK_NO_DOT,
- STAR,
- START_ANCHOR
- } = PLATFORM_CHARS;
- const globstar = (opts2) => {
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
- };
- const nodot = opts.dot ? "" : NO_DOT;
- const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
- let star = opts.bash === true ? globstar(opts) : STAR;
- if (opts.capture) {
- star = `(${star})`;
- }
- if (typeof opts.noext === "boolean") {
- opts.noextglob = opts.noext;
- }
- const state = {
- input,
- index: -1,
- start: 0,
- dot: opts.dot === true,
- consumed: "",
- output: "",
- prefix: "",
- backtrack: false,
- negated: false,
- brackets: 0,
- braces: 0,
- parens: 0,
- quotes: 0,
- globstar: false,
- tokens
- };
- input = utils.removePrefix(input, state);
- len = input.length;
- const extglobs = [];
- const braces = [];
- const stack = [];
- let prev = bos;
- let value;
- const eos = () => state.index === len - 1;
- const peek = state.peek = (n = 1) => input[state.index + n];
- const advance = state.advance = () => input[++state.index] || "";
- const remaining = () => input.slice(state.index + 1);
- const consume = (value2 = "", num = 0) => {
- state.consumed += value2;
- state.index += num;
- };
- const append = (token) => {
- state.output += token.output != null ? token.output : token.value;
- consume(token.value);
- };
- const negate = () => {
- let count = 1;
- while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
- advance();
- state.start++;
- count++;
- }
- if (count % 2 === 0) {
- return false;
- }
- state.negated = true;
- state.start++;
- return true;
- };
- const increment = (type) => {
- state[type]++;
- stack.push(type);
- };
- const decrement = (type) => {
- state[type]--;
- stack.pop();
- };
- const push = (tok) => {
- if (prev.type === "globstar") {
- const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
- const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
- if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
- state.output = state.output.slice(0, -prev.output.length);
- prev.type = "star";
- prev.value = "*";
- prev.output = star;
- state.output += prev.output;
- }
- }
- if (extglobs.length && tok.type !== "paren") {
- extglobs[extglobs.length - 1].inner += tok.value;
- }
- if (tok.value || tok.output)
- append(tok);
- if (prev && prev.type === "text" && tok.type === "text") {
- prev.value += tok.value;
- prev.output = (prev.output || "") + tok.value;
- return;
- }
- tok.prev = prev;
- tokens.push(tok);
- prev = tok;
- };
- const extglobOpen = (type, value2) => {
- const token = Object.assign(Object.assign({}, EXTGLOB_CHARS[value2]), {}, {
- conditions: 1,
- inner: ""
- });
- token.prev = prev;
- token.parens = state.parens;
- token.output = state.output;
- const output = (opts.capture ? "(" : "") + token.open;
- increment("parens");
- push({
- type,
- value: value2,
- output: state.output ? "" : ONE_CHAR
- });
- push({
- type: "paren",
- extglob: true,
- value: advance(),
- output
- });
- extglobs.push(token);
- };
- const extglobClose = (token) => {
- let output = token.close + (opts.capture ? ")" : "");
- let rest;
- if (token.type === "negate") {
- let extglobStar = star;
- if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
- extglobStar = globstar(opts);
- }
- if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
- output = token.close = `)$))${extglobStar}`;
- }
- if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
- const expression = parse(rest, Object.assign(Object.assign({}, options), {}, {
- fastpaths: false
- })).output;
- output = token.close = `)${expression})${extglobStar})`;
- }
- if (token.prev.type === "bos") {
- state.negatedExtglob = true;
- }
- }
- push({
- type: "paren",
- extglob: true,
- value,
- output
- });
- decrement("parens");
- };
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
- let backslashes = false;
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
- if (first === "\\") {
- backslashes = true;
- return m;
- }
- if (first === "?") {
- if (esc) {
- return esc + first + (rest ? QMARK.repeat(rest.length) : "");
- }
- if (index === 0) {
- return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
- }
- return QMARK.repeat(chars.length);
- }
- if (first === ".") {
- return DOT_LITERAL.repeat(chars.length);
- }
- if (first === "*") {
- if (esc) {
- return esc + first + (rest ? star : "");
- }
- return star;
- }
- return esc ? m : `\\${m}`;
- });
- if (backslashes === true) {
- if (opts.unescape === true) {
- output = output.replace(/\\/g, "");
- } else {
- output = output.replace(/\\+/g, (m) => {
- return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
- });
- }
- }
- if (output === input && opts.contains === true) {
- state.output = input;
- return state;
- }
- state.output = utils.wrapOutput(output, state, options);
- return state;
- }
- while (!eos()) {
- value = advance();
- if (value === "\0") {
- continue;
- }
- if (value === "\\") {
- const next = peek();
- if (next === "/" && opts.bash !== true) {
- continue;
- }
- if (next === "." || next === ";") {
- continue;
- }
- if (!next) {
- value += "\\";
- push({
- type: "text",
- value
- });
- continue;
- }
- const match = /^\\+/.exec(remaining());
- let slashes = 0;
- if (match && match[0].length > 2) {
- slashes = match[0].length;
- state.index += slashes;
- if (slashes % 2 !== 0) {
- value += "\\";
- }
- }
- if (opts.unescape === true) {
- value = advance();
- } else {
- value += advance();
- }
- if (state.brackets === 0) {
- push({
- type: "text",
- value
- });
- continue;
- }
- }
- if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
- if (opts.posix !== false && value === ":") {
- const inner = prev.value.slice(1);
- if (inner.includes("[")) {
- prev.posix = true;
- if (inner.includes(":")) {
- const idx = prev.value.lastIndexOf("[");
- const pre = prev.value.slice(0, idx);
- const rest2 = prev.value.slice(idx + 2);
- const posix = POSIX_REGEX_SOURCE[rest2];
- if (posix) {
- prev.value = pre + posix;
- state.backtrack = true;
- advance();
- if (!bos.output && tokens.indexOf(prev) === 1) {
- bos.output = ONE_CHAR;
- }
- continue;
- }
- }
- }
- }
- if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
- value = `\\${value}`;
- }
- if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
- value = `\\${value}`;
- }
- if (opts.posix === true && value === "!" && prev.value === "[") {
- value = "^";
- }
- prev.value += value;
- append({
- value
- });
- continue;
- }
- if (state.quotes === 1 && value !== '"') {
- value = utils.escapeRegex(value);
- prev.value += value;
- append({
- value
- });
- continue;
- }
- if (value === '"') {
- state.quotes = state.quotes === 1 ? 0 : 1;
- if (opts.keepQuotes === true) {
- push({
- type: "text",
- value
- });
- }
- continue;
- }
- if (value === "(") {
- increment("parens");
- push({
- type: "paren",
- value
- });
- continue;
- }
- if (value === ")") {
- if (state.parens === 0 && opts.strictBrackets === true) {
- throw new SyntaxError(syntaxError("opening", "("));
- }
- const extglob = extglobs[extglobs.length - 1];
- if (extglob && state.parens === extglob.parens + 1) {
- extglobClose(extglobs.pop());
- continue;
- }
- push({
- type: "paren",
- value,
- output: state.parens ? ")" : "\\)"
- });
- decrement("parens");
- continue;
- }
- if (value === "[") {
- if (opts.nobracket === true || !remaining().includes("]")) {
- if (opts.nobracket !== true && opts.strictBrackets === true) {
- throw new SyntaxError(syntaxError("closing", "]"));
- }
- value = `\\${value}`;
- } else {
- increment("brackets");
- }
- push({
- type: "bracket",
- value
- });
- continue;
- }
- if (value === "]") {
- if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
- push({
- type: "text",
- value,
- output: `\\${value}`
- });
- continue;
- }
- if (state.brackets === 0) {
- if (opts.strictBrackets === true) {
- throw new SyntaxError(syntaxError("opening", "["));
- }
- push({
- type: "text",
- value,
- output: `\\${value}`
- });
- continue;
- }
- decrement("brackets");
- const prevValue = prev.value.slice(1);
- if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
- value = `/${value}`;
- }
- prev.value += value;
- append({
- value
- });
- if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
- continue;
- }
- const escaped = utils.escapeRegex(prev.value);
- state.output = state.output.slice(0, -prev.value.length);
- if (opts.literalBrackets === true) {
- state.output += escaped;
- prev.value = escaped;
- continue;
- }
- prev.value = `(${capture}${escaped}|${prev.value})`;
- state.output += prev.value;
- continue;
- }
- if (value === "{" && opts.nobrace !== true) {
- increment("braces");
- const open = {
- type: "brace",
- value,
- output: "(",
- outputIndex: state.output.length,
- tokensIndex: state.tokens.length
- };
- braces.push(open);
- push(open);
- continue;
- }
- if (value === "}") {
- const brace = braces[braces.length - 1];
- if (opts.nobrace === true || !brace) {
- push({
- type: "text",
- value,
- output: value
- });
- continue;
- }
- let output = ")";
- if (brace.dots === true) {
- const arr = tokens.slice();
- const range = [];
- for (let i = arr.length - 1; i >= 0; i--) {
- tokens.pop();
- if (arr[i].type === "brace") {
- break;
- }
- if (arr[i].type !== "dots") {
- range.unshift(arr[i].value);
- }
- }
- output = expandRange(range, opts);
- state.backtrack = true;
- }
- if (brace.comma !== true && brace.dots !== true) {
- const out = state.output.slice(0, brace.outputIndex);
- const toks = state.tokens.slice(brace.tokensIndex);
- brace.value = brace.output = "\\{";
- value = output = "\\}";
- state.output = out;
- for (const t of toks) {
- state.output += t.output || t.value;
- }
- }
- push({
- type: "brace",
- value,
- output
- });
- decrement("braces");
- braces.pop();
- continue;
- }
- if (value === "|") {
- if (extglobs.length > 0) {
- extglobs[extglobs.length - 1].conditions++;
- }
- push({
- type: "text",
- value
- });
- continue;
- }
- if (value === ",") {
- let output = value;
- const brace = braces[braces.length - 1];
- if (brace && stack[stack.length - 1] === "braces") {
- brace.comma = true;
- output = "|";
- }
- push({
- type: "comma",
- value,
- output
- });
- continue;
- }
- if (value === "/") {
- if (prev.type === "dot" && state.index === state.start + 1) {
- state.start = state.index + 1;
- state.consumed = "";
- state.output = "";
- tokens.pop();
- prev = bos;
- continue;
- }
- push({
- type: "slash",
- value,
- output: SLASH_LITERAL
- });
- continue;
- }
- if (value === ".") {
- if (state.braces > 0 && prev.type === "dot") {
- if (prev.value === ".")
- prev.output = DOT_LITERAL;
- const brace = braces[braces.length - 1];
- prev.type = "dots";
- prev.output += value;
- prev.value += value;
- brace.dots = true;
- continue;
- }
- if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
- push({
- type: "text",
- value,
- output: DOT_LITERAL
- });
- continue;
- }
- push({
- type: "dot",
- value,
- output: DOT_LITERAL
- });
- continue;
- }
- if (value === "?") {
- const isGroup = prev && prev.value === "(";
- if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
- extglobOpen("qmark", value);
- continue;
- }
- if (prev && prev.type === "paren") {
- const next = peek();
- let output = value;
- if (next === "<" && !utils.supportsLookbehinds()) {
- throw new Error("Node.js v10 or higher is required for regex lookbehinds");
- }
- if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
- output = `\\${value}`;
- }
- push({
- type: "text",
- value,
- output
- });
- continue;
- }
- if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
- push({
- type: "qmark",
- value,
- output: QMARK_NO_DOT
- });
- continue;
- }
- push({
- type: "qmark",
- value,
- output: QMARK
- });
- continue;
- }
- if (value === "!") {
- if (opts.noextglob !== true && peek() === "(") {
- if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
- extglobOpen("negate", value);
- continue;
- }
- }
- if (opts.nonegate !== true && state.index === 0) {
- negate();
- continue;
- }
- }
- if (value === "+") {
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
- extglobOpen("plus", value);
- continue;
- }
- if (prev && prev.value === "(" || opts.regex === false) {
- push({
- type: "plus",
- value,
- output: PLUS_LITERAL
- });
- continue;
- }
- if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
- push({
- type: "plus",
- value
- });
- continue;
- }
- push({
- type: "plus",
- value: PLUS_LITERAL
- });
- continue;
- }
- if (value === "@") {
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
- push({
- type: "at",
- extglob: true,
- value,
- output: ""
- });
- continue;
- }
- push({
- type: "text",
- value
- });
- continue;
- }
- if (value !== "*") {
- if (value === "$" || value === "^") {
- value = `\\${value}`;
- }
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
- if (match) {
- value += match[0];
- state.index += match[0].length;
- }
- push({
- type: "text",
- value
- });
- continue;
- }
- if (prev && (prev.type === "globstar" || prev.star === true)) {
- prev.type = "star";
- prev.star = true;
- prev.value += value;
- prev.output = star;
- state.backtrack = true;
- state.globstar = true;
- consume(value);
- continue;
- }
- let rest = remaining();
- if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
- extglobOpen("star", value);
- continue;
- }
- if (prev.type === "star") {
- if (opts.noglobstar === true) {
- consume(value);
- continue;
- }
- const prior = prev.prev;
- const before = prior.prev;
- const isStart = prior.type === "slash" || prior.type === "bos";
- const afterStar = before && (before.type === "star" || before.type === "globstar");
- if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
- push({
- type: "star",
- value,
- output: ""
- });
- continue;
- }
- const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
- const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
- if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
- push({
- type: "star",
- value,
- output: ""
- });
- continue;
- }
- while (rest.slice(0, 3) === "/**") {
- const after = input[state.index + 4];
- if (after && after !== "/") {
- break;
- }
- rest = rest.slice(3);
- consume("/**", 3);
- }
- if (prior.type === "bos" && eos()) {
- prev.type = "globstar";
- prev.value += value;
- prev.output = globstar(opts);
- state.output = prev.output;
- state.globstar = true;
- consume(value);
- continue;
- }
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
- prior.output = `(?:${prior.output}`;
- prev.type = "globstar";
- prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
- prev.value += value;
- state.globstar = true;
- state.output += prior.output + prev.output;
- consume(value);
- continue;
- }
- if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
- const end = rest[1] !== void 0 ? "|$" : "";
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
- prior.output = `(?:${prior.output}`;
- prev.type = "globstar";
- prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
- prev.value += value;
- state.output += prior.output + prev.output;
- state.globstar = true;
- consume(value + advance());
- push({
- type: "slash",
- value: "/",
- output: ""
- });
- continue;
- }
- if (prior.type === "bos" && rest[0] === "/") {
- prev.type = "globstar";
- prev.value += value;
- prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
- state.output = prev.output;
- state.globstar = true;
- consume(value + advance());
- push({
- type: "slash",
- value: "/",
- output: ""
- });
- continue;
- }
- state.output = state.output.slice(0, -prev.output.length);
- prev.type = "globstar";
- prev.output = globstar(opts);
- prev.value += value;
- state.output += prev.output;
- state.globstar = true;
- consume(value);
- continue;
- }
- const token = {
- type: "star",
- value,
- output: star
- };
- if (opts.bash === true) {
- token.output = ".*?";
- if (prev.type === "bos" || prev.type === "slash") {
- token.output = nodot + token.output;
- }
- push(token);
- continue;
- }
- if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
- token.output = value;
- push(token);
- continue;
- }
- if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
- if (prev.type === "dot") {
- state.output += NO_DOT_SLASH;
- prev.output += NO_DOT_SLASH;
- } else if (opts.dot === true) {
- state.output += NO_DOTS_SLASH;
- prev.output += NO_DOTS_SLASH;
- } else {
- state.output += nodot;
- prev.output += nodot;
- }
- if (peek() !== "*") {
- state.output += ONE_CHAR;
- prev.output += ONE_CHAR;
- }
- }
- push(token);
- }
- while (state.brackets > 0) {
- if (opts.strictBrackets === true)
- throw new SyntaxError(syntaxError("closing", "]"));
- state.output = utils.escapeLast(state.output, "[");
- decrement("brackets");
- }
- while (state.parens > 0) {
- if (opts.strictBrackets === true)
- throw new SyntaxError(syntaxError("closing", ")"));
- state.output = utils.escapeLast(state.output, "(");
- decrement("parens");
- }
- while (state.braces > 0) {
- if (opts.strictBrackets === true)
- throw new SyntaxError(syntaxError("closing", "}"));
- state.output = utils.escapeLast(state.output, "{");
- decrement("braces");
- }
- if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
- push({
- type: "maybe_slash",
- value: "",
- output: `${SLASH_LITERAL}?`
- });
- }
- if (state.backtrack === true) {
- state.output = "";
- for (const token of state.tokens) {
- state.output += token.output != null ? token.output : token.value;
- if (token.suffix) {
- state.output += token.suffix;
- }
- }
- }
- return state;
- };
- parse.fastpaths = (input, options) => {
- const opts = Object.assign({}, options);
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
- const len = input.length;
- if (len > max) {
- throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
- }
- input = REPLACEMENTS[input] || input;
- const win32 = utils.isWindows(options);
- const {
- DOT_LITERAL,
- SLASH_LITERAL,
- ONE_CHAR,
- DOTS_SLASH,
- NO_DOT,
- NO_DOTS,
- NO_DOTS_SLASH,
- STAR,
- START_ANCHOR
- } = constants.globChars(win32);
- const nodot = opts.dot ? NO_DOTS : NO_DOT;
- const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
- const capture = opts.capture ? "" : "?:";
- const state = {
- negated: false,
- prefix: ""
- };
- let star = opts.bash === true ? ".*?" : STAR;
- if (opts.capture) {
- star = `(${star})`;
- }
- const globstar = (opts2) => {
- if (opts2.noglobstar === true)
- return star;
- return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
- };
- const create = (str) => {
- switch (str) {
- case "*":
- return `${nodot}${ONE_CHAR}${star}`;
- case ".*":
- return `${DOT_LITERAL}${ONE_CHAR}${star}`;
- case "*.*":
- return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
- case "*/*":
- return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
- case "**":
- return nodot + globstar(opts);
- case "**/*":
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
- case "**/*.*":
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
- case "**/.*":
- return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
- default: {
- const match = /^(.*?)\.(\w+)$/.exec(str);
- if (!match)
- return;
- const source2 = create(match[1]);
- if (!source2)
- return;
- return source2 + DOT_LITERAL + match[2];
- }
- }
- };
- const output = utils.removePrefix(input, state);
- let source = create(output);
- if (source && opts.strictSlashes !== true) {
- source += `${SLASH_LITERAL}?`;
- }
- return source;
- };
- module2.exports = parse;
- }
- });
- var require_picomatch = __commonJS2({
- "node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
- "use strict";
- var path = require("path");
- var scan = require_scan();
- var parse = require_parse2();
- var utils = require_utils3();
- var constants = require_constants2();
- var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
- var picomatch = (glob, options, returnState = false) => {
- if (Array.isArray(glob)) {
- const fns = glob.map((input) => picomatch(input, options, returnState));
- const arrayMatcher = (str) => {
- for (const isMatch of fns) {
- const state2 = isMatch(str);
- if (state2)
- return state2;
- }
- return false;
- };
- return arrayMatcher;
- }
- const isState = isObject(glob) && glob.tokens && glob.input;
- if (glob === "" || typeof glob !== "string" && !isState) {
- throw new TypeError("Expected pattern to be a non-empty string");
- }
- const opts = options || {};
- const posix = utils.isWindows(options);
- const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
- const state = regex.state;
- delete regex.state;
- let isIgnored = () => false;
- if (opts.ignore) {
- const ignoreOpts = Object.assign(Object.assign({}, options), {}, {
- ignore: null,
- onMatch: null,
- onResult: null
- });
- isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
- }
- const matcher = (input, returnObject = false) => {
- const {
- isMatch,
- match,
- output
- } = picomatch.test(input, regex, options, {
- glob,
- posix
- });
- const result = {
- glob,
- state,
- regex,
- posix,
- input,
- output,
- match,
- isMatch
- };
- if (typeof opts.onResult === "function") {
- opts.onResult(result);
- }
- if (isMatch === false) {
- result.isMatch = false;
- return returnObject ? result : false;
- }
- if (isIgnored(input)) {
- if (typeof opts.onIgnore === "function") {
- opts.onIgnore(result);
- }
- result.isMatch = false;
- return returnObject ? result : false;
- }
- if (typeof opts.onMatch === "function") {
- opts.onMatch(result);
- }
- return returnObject ? result : true;
- };
- if (returnState) {
- matcher.state = state;
- }
- return matcher;
- };
- picomatch.test = (input, regex, options, {
- glob,
- posix
- } = {}) => {
- if (typeof input !== "string") {
- throw new TypeError("Expected input to be a string");
- }
- if (input === "") {
- return {
- isMatch: false,
- output: ""
- };
- }
- const opts = options || {};
- const format = opts.format || (posix ? utils.toPosixSlashes : null);
- let match = input === glob;
- let output = match && format ? format(input) : input;
- if (match === false) {
- output = format ? format(input) : input;
- match = output === glob;
- }
- if (match === false || opts.capture === true) {
- if (opts.matchBase === true || opts.basename === true) {
- match = picomatch.matchBase(input, regex, options, posix);
- } else {
- match = regex.exec(output);
- }
- }
- return {
- isMatch: Boolean(match),
- match,
- output
- };
- };
- picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
- const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
- return regex.test(path.basename(input));
- };
- picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
- picomatch.parse = (pattern, options) => {
- if (Array.isArray(pattern))
- return pattern.map((p) => picomatch.parse(p, options));
- return parse(pattern, Object.assign(Object.assign({}, options), {}, {
- fastpaths: false
- }));
- };
- picomatch.scan = (input, options) => scan(input, options);
- picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
- if (returnOutput === true) {
- return state.output;
- }
- const opts = options || {};
- const prepend = opts.contains ? "" : "^";
- const append = opts.contains ? "" : "$";
- let source = `${prepend}(?:${state.output})${append}`;
- if (state && state.negated === true) {
- source = `^(?!${source}).*$`;
- }
- const regex = picomatch.toRegex(source, options);
- if (returnState === true) {
- regex.state = state;
- }
- return regex;
- };
- picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
- if (!input || typeof input !== "string") {
- throw new TypeError("Expected a non-empty string");
- }
- let parsed = {
- negated: false,
- fastpaths: true
- };
- if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
- parsed.output = parse.fastpaths(input, options);
- }
- if (!parsed.output) {
- parsed = parse(input, options);
- }
- return picomatch.compileRe(parsed, options, returnOutput, returnState);
- };
- picomatch.toRegex = (source, options) => {
- try {
- const opts = options || {};
- return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
- } catch (err) {
- if (options && options.debug === true)
- throw err;
- return /$^/;
- }
- };
- picomatch.constants = constants;
- module2.exports = picomatch;
- }
- });
- var require_picomatch2 = __commonJS2({
- "node_modules/picomatch/index.js"(exports2, module2) {
- "use strict";
- module2.exports = require_picomatch();
- }
- });
- var require_micromatch = __commonJS2({
- "node_modules/micromatch/index.js"(exports2, module2) {
- "use strict";
- var util = require("util");
- var braces = require_braces();
- var picomatch = require_picomatch2();
- var utils = require_utils3();
- var isEmptyString = (val) => val === "" || val === "./";
- var micromatch = (list, patterns, options) => {
- patterns = [].concat(patterns);
- list = [].concat(list);
- let omit = /* @__PURE__ */ new Set();
- let keep = /* @__PURE__ */ new Set();
- let items = /* @__PURE__ */ new Set();
- let negatives = 0;
- let onResult = (state) => {
- items.add(state.output);
- if (options && options.onResult) {
- options.onResult(state);
- }
- };
- for (let i = 0; i < patterns.length; i++) {
- let isMatch = picomatch(String(patterns[i]), Object.assign(Object.assign({}, options), {}, {
- onResult
- }), true);
- let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
- if (negated)
- negatives++;
- for (let item of list) {
- let matched = isMatch(item, true);
- let match = negated ? !matched.isMatch : matched.isMatch;
- if (!match)
- continue;
- if (negated) {
- omit.add(matched.output);
- } else {
- omit.delete(matched.output);
- keep.add(matched.output);
- }
- }
- }
- let result = negatives === patterns.length ? [...items] : [...keep];
- let matches = result.filter((item) => !omit.has(item));
- if (options && matches.length === 0) {
- if (options.failglob === true) {
- throw new Error(`No matches found for "${patterns.join(", ")}"`);
- }
- if (options.nonull === true || options.nullglob === true) {
- return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
- }
- }
- return matches;
- };
- micromatch.match = micromatch;
- micromatch.matcher = (pattern, options) => picomatch(pattern, options);
- micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
- micromatch.any = micromatch.isMatch;
- micromatch.not = (list, patterns, options = {}) => {
- patterns = [].concat(patterns).map(String);
- let result = /* @__PURE__ */ new Set();
- let items = [];
- let onResult = (state) => {
- if (options.onResult)
- options.onResult(state);
- items.push(state.output);
- };
- let matches = new Set(micromatch(list, patterns, Object.assign(Object.assign({}, options), {}, {
- onResult
- })));
- for (let item of items) {
- if (!matches.has(item)) {
- result.add(item);
- }
- }
- return [...result];
- };
- micromatch.contains = (str, pattern, options) => {
- if (typeof str !== "string") {
- throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
- }
- if (Array.isArray(pattern)) {
- return pattern.some((p) => micromatch.contains(str, p, options));
- }
- if (typeof pattern === "string") {
- if (isEmptyString(str) || isEmptyString(pattern)) {
- return false;
- }
- if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
- return true;
- }
- }
- return micromatch.isMatch(str, pattern, Object.assign(Object.assign({}, options), {}, {
- contains: true
- }));
- };
- micromatch.matchKeys = (obj, patterns, options) => {
- if (!utils.isObject(obj)) {
- throw new TypeError("Expected the first argument to be an object");
- }
- let keys = micromatch(Object.keys(obj), patterns, options);
- let res = {};
- for (let key of keys)
- res[key] = obj[key];
- return res;
- };
- micromatch.some = (list, patterns, options) => {
- let items = [].concat(list);
- for (let pattern of [].concat(patterns)) {
- let isMatch = picomatch(String(pattern), options);
- if (items.some((item) => isMatch(item))) {
- return true;
- }
- }
- return false;
- };
- micromatch.every = (list, patterns, options) => {
- let items = [].concat(list);
- for (let pattern of [].concat(patterns)) {
- let isMatch = picomatch(String(pattern), options);
- if (!items.every((item) => isMatch(item))) {
- return false;
- }
- }
- return true;
- };
- micromatch.all = (str, patterns, options) => {
- if (typeof str !== "string") {
- throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
- }
- return [].concat(patterns).every((p) => picomatch(p, options)(str));
- };
- micromatch.capture = (glob, input, options) => {
- let posix = utils.isWindows(options);
- let regex = picomatch.makeRe(String(glob), Object.assign(Object.assign({}, options), {}, {
- capture: true
- }));
- let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
- if (match) {
- return match.slice(1).map((v) => v === void 0 ? "" : v);
- }
- };
- micromatch.makeRe = (...args) => picomatch.makeRe(...args);
- micromatch.scan = (...args) => picomatch.scan(...args);
- micromatch.parse = (patterns, options) => {
- let res = [];
- for (let pattern of [].concat(patterns || [])) {
- for (let str of braces(String(pattern), options)) {
- res.push(picomatch.parse(str, options));
- }
- }
- return res;
- };
- micromatch.braces = (pattern, options) => {
- if (typeof pattern !== "string")
- throw new TypeError("Expected a string");
- if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
- return [pattern];
- }
- return braces(pattern, options);
- };
- micromatch.braceExpand = (pattern, options) => {
- if (typeof pattern !== "string")
- throw new TypeError("Expected a string");
- return micromatch.braces(pattern, Object.assign(Object.assign({}, options), {}, {
- expand: true
- }));
- };
- module2.exports = micromatch;
- }
- });
- var require_pattern = __commonJS2({
- "node_modules/fast-glob/out/utils/pattern.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.matchAny = exports2.convertPatternsToRe = exports2.makeRe = exports2.getPatternParts = exports2.expandBraceExpansion = exports2.expandPatternsWithBraceExpansion = exports2.isAffectDepthOfReadingPattern = exports2.endsWithSlashGlobStar = exports2.hasGlobStar = exports2.getBaseDirectory = exports2.isPatternRelatedToParentDirectory = exports2.getPatternsOutsideCurrentDirectory = exports2.getPatternsInsideCurrentDirectory = exports2.getPositivePatterns = exports2.getNegativePatterns = exports2.isPositivePattern = exports2.isNegativePattern = exports2.convertToNegativePattern = exports2.convertToPositivePattern = exports2.isDynamicPattern = exports2.isStaticPattern = void 0;
- var path = require("path");
- var globParent = require_glob_parent();
- var micromatch = require_micromatch();
- var GLOBSTAR = "**";
- var ESCAPE_SYMBOL = "\\";
- var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
- var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
- var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
- var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
- var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
- function isStaticPattern(pattern, options = {}) {
- return !isDynamicPattern(pattern, options);
- }
- exports2.isStaticPattern = isStaticPattern;
- function isDynamicPattern(pattern, options = {}) {
- if (pattern === "") {
- return false;
- }
- if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
- return true;
- }
- if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
- return true;
- }
- if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
- return true;
- }
- if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
- return true;
- }
- return false;
- }
- exports2.isDynamicPattern = isDynamicPattern;
- function hasBraceExpansion(pattern) {
- const openingBraceIndex = pattern.indexOf("{");
- if (openingBraceIndex === -1) {
- return false;
- }
- const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
- if (closingBraceIndex === -1) {
- return false;
- }
- const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
- return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
- }
- function convertToPositivePattern(pattern) {
- return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
- }
- exports2.convertToPositivePattern = convertToPositivePattern;
- function convertToNegativePattern(pattern) {
- return "!" + pattern;
- }
- exports2.convertToNegativePattern = convertToNegativePattern;
- function isNegativePattern(pattern) {
- return pattern.startsWith("!") && pattern[1] !== "(";
- }
- exports2.isNegativePattern = isNegativePattern;
- function isPositivePattern(pattern) {
- return !isNegativePattern(pattern);
- }
- exports2.isPositivePattern = isPositivePattern;
- function getNegativePatterns(patterns) {
- return patterns.filter(isNegativePattern);
- }
- exports2.getNegativePatterns = getNegativePatterns;
- function getPositivePatterns(patterns) {
- return patterns.filter(isPositivePattern);
- }
- exports2.getPositivePatterns = getPositivePatterns;
- function getPatternsInsideCurrentDirectory(patterns) {
- return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
- }
- exports2.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
- function getPatternsOutsideCurrentDirectory(patterns) {
- return patterns.filter(isPatternRelatedToParentDirectory);
- }
- exports2.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
- function isPatternRelatedToParentDirectory(pattern) {
- return pattern.startsWith("..") || pattern.startsWith("./..");
- }
- exports2.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
- function getBaseDirectory(pattern) {
- return globParent(pattern, {
- flipBackslashes: false
- });
- }
- exports2.getBaseDirectory = getBaseDirectory;
- function hasGlobStar(pattern) {
- return pattern.includes(GLOBSTAR);
- }
- exports2.hasGlobStar = hasGlobStar;
- function endsWithSlashGlobStar(pattern) {
- return pattern.endsWith("/" + GLOBSTAR);
- }
- exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
- function isAffectDepthOfReadingPattern(pattern) {
- const basename = path.basename(pattern);
- return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
- }
- exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
- function expandPatternsWithBraceExpansion(patterns) {
- return patterns.reduce((collection, pattern) => {
- return collection.concat(expandBraceExpansion(pattern));
- }, []);
- }
- exports2.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
- function expandBraceExpansion(pattern) {
- return micromatch.braces(pattern, {
- expand: true,
- nodupes: true
- });
- }
- exports2.expandBraceExpansion = expandBraceExpansion;
- function getPatternParts(pattern, options) {
- let {
- parts
- } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), {
- parts: true
- }));
- if (parts.length === 0) {
- parts = [pattern];
- }
- if (parts[0].startsWith("/")) {
- parts[0] = parts[0].slice(1);
- parts.unshift("");
- }
- return parts;
- }
- exports2.getPatternParts = getPatternParts;
- function makeRe(pattern, options) {
- return micromatch.makeRe(pattern, options);
- }
- exports2.makeRe = makeRe;
- function convertPatternsToRe(patterns, options) {
- return patterns.map((pattern) => makeRe(pattern, options));
- }
- exports2.convertPatternsToRe = convertPatternsToRe;
- function matchAny(entry, patternsRe) {
- return patternsRe.some((patternRe) => patternRe.test(entry));
- }
- exports2.matchAny = matchAny;
- }
- });
- var require_merge2 = __commonJS2({
- "node_modules/merge2/index.js"(exports2, module2) {
- "use strict";
- var Stream = require("stream");
- var PassThrough = Stream.PassThrough;
- var slice = Array.prototype.slice;
- module2.exports = merge2;
- function merge2() {
- const streamsQueue = [];
- const args = slice.call(arguments);
- let merging = false;
- let options = args[args.length - 1];
- if (options && !Array.isArray(options) && options.pipe == null) {
- args.pop();
- } else {
- options = {};
- }
- const doEnd = options.end !== false;
- const doPipeError = options.pipeError === true;
- if (options.objectMode == null) {
- options.objectMode = true;
- }
- if (options.highWaterMark == null) {
- options.highWaterMark = 64 * 1024;
- }
- const mergedStream = PassThrough(options);
- function addStream() {
- for (let i = 0, len = arguments.length; i < len; i++) {
- streamsQueue.push(pauseStreams(arguments[i], options));
- }
- mergeStream();
- return this;
- }
- function mergeStream() {
- if (merging) {
- return;
- }
- merging = true;
- let streams = streamsQueue.shift();
- if (!streams) {
- process.nextTick(endStream);
- return;
- }
- if (!Array.isArray(streams)) {
- streams = [streams];
- }
- let pipesCount = streams.length + 1;
- function next() {
- if (--pipesCount > 0) {
- return;
- }
- merging = false;
- mergeStream();
- }
- function pipe(stream) {
- function onend() {
- stream.removeListener("merge2UnpipeEnd", onend);
- stream.removeListener("end", onend);
- if (doPipeError) {
- stream.removeListener("error", onerror);
- }
- next();
- }
- function onerror(err) {
- mergedStream.emit("error", err);
- }
- if (stream._readableState.endEmitted) {
- return next();
- }
- stream.on("merge2UnpipeEnd", onend);
- stream.on("end", onend);
- if (doPipeError) {
- stream.on("error", onerror);
- }
- stream.pipe(mergedStream, {
- end: false
- });
- stream.resume();
- }
- for (let i = 0; i < streams.length; i++) {
- pipe(streams[i]);
- }
- next();
- }
- function endStream() {
- merging = false;
- mergedStream.emit("queueDrain");
- if (doEnd) {
- mergedStream.end();
- }
- }
- mergedStream.setMaxListeners(0);
- mergedStream.add = addStream;
- mergedStream.on("unpipe", function(stream) {
- stream.emit("merge2UnpipeEnd");
- });
- if (args.length) {
- addStream.apply(null, args);
- }
- return mergedStream;
- }
- function pauseStreams(streams, options) {
- if (!Array.isArray(streams)) {
- if (!streams._readableState && streams.pipe) {
- streams = streams.pipe(PassThrough(options));
- }
- if (!streams._readableState || !streams.pause || !streams.pipe) {
- throw new Error("Only readable stream can be merged.");
- }
- streams.pause();
- } else {
- for (let i = 0, len = streams.length; i < len; i++) {
- streams[i] = pauseStreams(streams[i], options);
- }
- }
- return streams;
- }
- }
- });
- var require_stream = __commonJS2({
- "node_modules/fast-glob/out/utils/stream.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.merge = void 0;
- var merge2 = require_merge2();
- function merge(streams) {
- const mergedStream = merge2(streams);
- streams.forEach((stream) => {
- stream.once("error", (error) => mergedStream.emit("error", error));
- });
- mergedStream.once("close", () => propagateCloseEventToSources(streams));
- mergedStream.once("end", () => propagateCloseEventToSources(streams));
- return mergedStream;
- }
- exports2.merge = merge;
- function propagateCloseEventToSources(streams) {
- streams.forEach((stream) => stream.emit("close"));
- }
- }
- });
- var require_string = __commonJS2({
- "node_modules/fast-glob/out/utils/string.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.isEmpty = exports2.isString = void 0;
- function isString(input) {
- return typeof input === "string";
- }
- exports2.isString = isString;
- function isEmpty(input) {
- return input === "";
- }
- exports2.isEmpty = isEmpty;
- }
- });
- var require_utils4 = __commonJS2({
- "node_modules/fast-glob/out/utils/index.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.string = exports2.stream = exports2.pattern = exports2.path = exports2.fs = exports2.errno = exports2.array = void 0;
- var array2 = require_array();
- exports2.array = array2;
- var errno = require_errno();
- exports2.errno = errno;
- var fs = require_fs();
- exports2.fs = fs;
- var path = require_path();
- exports2.path = path;
- var pattern = require_pattern();
- exports2.pattern = pattern;
- var stream = require_stream();
- exports2.stream = stream;
- var string = require_string();
- exports2.string = string;
- }
- });
- var require_tasks = __commonJS2({
- "node_modules/fast-glob/out/managers/tasks.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.convertPatternGroupToTask = exports2.convertPatternGroupsToTasks = exports2.groupPatternsByBaseDirectory = exports2.getNegativePatternsAsPositive = exports2.getPositivePatterns = exports2.convertPatternsToTasks = exports2.generate = void 0;
- var utils = require_utils4();
- function generate(patterns, settings) {
- const positivePatterns = getPositivePatterns(patterns);
- const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
- const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
- const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
- const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, false);
- const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true);
- return staticTasks.concat(dynamicTasks);
- }
- exports2.generate = generate;
- function convertPatternsToTasks(positive, negative, dynamic) {
- const tasks = [];
- const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
- const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
- const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
- const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
- tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
- if ("." in insideCurrentDirectoryGroup) {
- tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
- } else {
- tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
- }
- return tasks;
- }
- exports2.convertPatternsToTasks = convertPatternsToTasks;
- function getPositivePatterns(patterns) {
- return utils.pattern.getPositivePatterns(patterns);
- }
- exports2.getPositivePatterns = getPositivePatterns;
- function getNegativePatternsAsPositive(patterns, ignore) {
- const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
- const positive = negative.map(utils.pattern.convertToPositivePattern);
- return positive;
- }
- exports2.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
- function groupPatternsByBaseDirectory(patterns) {
- const group = {};
- return patterns.reduce((collection, pattern) => {
- const base = utils.pattern.getBaseDirectory(pattern);
- if (base in collection) {
- collection[base].push(pattern);
- } else {
- collection[base] = [pattern];
- }
- return collection;
- }, group);
- }
- exports2.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
- function convertPatternGroupsToTasks(positive, negative, dynamic) {
- return Object.keys(positive).map((base) => {
- return convertPatternGroupToTask(base, positive[base], negative, dynamic);
- });
- }
- exports2.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
- function convertPatternGroupToTask(base, positive, negative, dynamic) {
- return {
- dynamic,
- positive,
- negative,
- base,
- patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
- };
- }
- exports2.convertPatternGroupToTask = convertPatternGroupToTask;
- }
- });
- var require_patterns = __commonJS2({
- "node_modules/fast-glob/out/managers/patterns.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.removeDuplicateSlashes = exports2.transform = void 0;
- var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
- function transform(patterns) {
- return patterns.map((pattern) => removeDuplicateSlashes(pattern));
- }
- exports2.transform = transform;
- function removeDuplicateSlashes(pattern) {
- return pattern.replace(DOUBLE_SLASH_RE, "/");
- }
- exports2.removeDuplicateSlashes = removeDuplicateSlashes;
- }
- });
- var require_async = __commonJS2({
- "node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.read = void 0;
- function read(path, settings, callback) {
- settings.fs.lstat(path, (lstatError, lstat) => {
- if (lstatError !== null) {
- callFailureCallback(callback, lstatError);
- return;
- }
- if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
- callSuccessCallback(callback, lstat);
- return;
- }
- settings.fs.stat(path, (statError, stat) => {
- if (statError !== null) {
- if (settings.throwErrorOnBrokenSymbolicLink) {
- callFailureCallback(callback, statError);
- return;
- }
- callSuccessCallback(callback, lstat);
- return;
- }
- if (settings.markSymbolicLink) {
- stat.isSymbolicLink = () => true;
- }
- callSuccessCallback(callback, stat);
- });
- });
- }
- exports2.read = read;
- function callFailureCallback(callback, error) {
- callback(error);
- }
- function callSuccessCallback(callback, result) {
- callback(null, result);
- }
- }
- });
- var require_sync = __commonJS2({
- "node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.read = void 0;
- function read(path, settings) {
- const lstat = settings.fs.lstatSync(path);
- if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
- return lstat;
- }
- try {
- const stat = settings.fs.statSync(path);
- if (settings.markSymbolicLink) {
- stat.isSymbolicLink = () => true;
- }
- return stat;
- } catch (error) {
- if (!settings.throwErrorOnBrokenSymbolicLink) {
- return lstat;
- }
- throw error;
- }
- }
- exports2.read = read;
- }
- });
- var require_fs2 = __commonJS2({
- "node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
- var fs = require("fs");
- exports2.FILE_SYSTEM_ADAPTER = {
- lstat: fs.lstat,
- stat: fs.stat,
- lstatSync: fs.lstatSync,
- statSync: fs.statSync
- };
- function createFileSystemAdapter(fsMethods) {
- if (fsMethods === void 0) {
- return exports2.FILE_SYSTEM_ADAPTER;
- }
- return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
- }
- exports2.createFileSystemAdapter = createFileSystemAdapter;
- }
- });
- var require_settings = __commonJS2({
- "node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var fs = require_fs2();
- var Settings = class {
- constructor(_options = {}) {
- this._options = _options;
- this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
- this.fs = fs.createFileSystemAdapter(this._options.fs);
- this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
- this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
- }
- _getValue(option, value) {
- return option !== null && option !== void 0 ? option : value;
- }
- };
- exports2.default = Settings;
- }
- });
- var require_out = __commonJS2({
- "node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.statSync = exports2.stat = exports2.Settings = void 0;
- var async = require_async();
- var sync = require_sync();
- var settings_1 = require_settings();
- exports2.Settings = settings_1.default;
- function stat(path, optionsOrSettingsOrCallback, callback) {
- if (typeof optionsOrSettingsOrCallback === "function") {
- async.read(path, getSettings(), optionsOrSettingsOrCallback);
- return;
- }
- async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
- }
- exports2.stat = stat;
- function statSync(path, optionsOrSettings) {
- const settings = getSettings(optionsOrSettings);
- return sync.read(path, settings);
- }
- exports2.statSync = statSync;
- function getSettings(settingsOrOptions = {}) {
- if (settingsOrOptions instanceof settings_1.default) {
- return settingsOrOptions;
- }
- return new settings_1.default(settingsOrOptions);
- }
- }
- });
- var require_queue_microtask = __commonJS2({
- "node_modules/queue-microtask/index.js"(exports2, module2) {
- var promise;
- module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
- throw err;
- }, 0));
- }
- });
- var require_run_parallel = __commonJS2({
- "node_modules/run-parallel/index.js"(exports2, module2) {
- module2.exports = runParallel;
- var queueMicrotask2 = require_queue_microtask();
- function runParallel(tasks, cb) {
- let results, pending, keys;
- let isSync = true;
- if (Array.isArray(tasks)) {
- results = [];
- pending = tasks.length;
- } else {
- keys = Object.keys(tasks);
- results = {};
- pending = keys.length;
- }
- function done(err) {
- function end() {
- if (cb)
- cb(err, results);
- cb = null;
- }
- if (isSync)
- queueMicrotask2(end);
- else
- end();
- }
- function each(i, err, result) {
- results[i] = result;
- if (--pending === 0 || err) {
- done(err);
- }
- }
- if (!pending) {
- done(null);
- } else if (keys) {
- keys.forEach(function(key) {
- tasks[key](function(err, result) {
- each(key, err, result);
- });
- });
- } else {
- tasks.forEach(function(task, i) {
- task(function(err, result) {
- each(i, err, result);
- });
- });
- }
- isSync = false;
- }
- }
- });
- var require_constants3 = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
- var NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
- if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) {
- throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
- }
- var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
- var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
- var SUPPORTED_MAJOR_VERSION = 10;
- var SUPPORTED_MINOR_VERSION = 10;
- var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
- var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
- exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
- }
- });
- var require_fs3 = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.createDirentFromStats = void 0;
- var DirentFromStats = class {
- constructor(name, stats) {
- this.name = name;
- this.isBlockDevice = stats.isBlockDevice.bind(stats);
- this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
- this.isDirectory = stats.isDirectory.bind(stats);
- this.isFIFO = stats.isFIFO.bind(stats);
- this.isFile = stats.isFile.bind(stats);
- this.isSocket = stats.isSocket.bind(stats);
- this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
- }
- };
- function createDirentFromStats(name, stats) {
- return new DirentFromStats(name, stats);
- }
- exports2.createDirentFromStats = createDirentFromStats;
- }
- });
- var require_utils5 = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.fs = void 0;
- var fs = require_fs3();
- exports2.fs = fs;
- }
- });
- var require_common = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.joinPathSegments = void 0;
- function joinPathSegments(a, b, separator) {
- if (a.endsWith(separator)) {
- return a + b;
- }
- return a + separator + b;
- }
- exports2.joinPathSegments = joinPathSegments;
- }
- });
- var require_async2 = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
- var fsStat = require_out();
- var rpl = require_run_parallel();
- var constants_1 = require_constants3();
- var utils = require_utils5();
- var common = require_common();
- function read(directory, settings, callback) {
- if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
- readdirWithFileTypes(directory, settings, callback);
- return;
- }
- readdir(directory, settings, callback);
- }
- exports2.read = read;
- function readdirWithFileTypes(directory, settings, callback) {
- settings.fs.readdir(directory, {
- withFileTypes: true
- }, (readdirError, dirents) => {
- if (readdirError !== null) {
- callFailureCallback(callback, readdirError);
- return;
- }
- const entries = dirents.map((dirent) => ({
- dirent,
- name: dirent.name,
- path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
- }));
- if (!settings.followSymbolicLinks) {
- callSuccessCallback(callback, entries);
- return;
- }
- const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
- rpl(tasks, (rplError, rplEntries) => {
- if (rplError !== null) {
- callFailureCallback(callback, rplError);
- return;
- }
- callSuccessCallback(callback, rplEntries);
- });
- });
- }
- exports2.readdirWithFileTypes = readdirWithFileTypes;
- function makeRplTaskEntry(entry, settings) {
- return (done) => {
- if (!entry.dirent.isSymbolicLink()) {
- done(null, entry);
- return;
- }
- settings.fs.stat(entry.path, (statError, stats) => {
- if (statError !== null) {
- if (settings.throwErrorOnBrokenSymbolicLink) {
- done(statError);
- return;
- }
- done(null, entry);
- return;
- }
- entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
- done(null, entry);
- });
- };
- }
- function readdir(directory, settings, callback) {
- settings.fs.readdir(directory, (readdirError, names) => {
- if (readdirError !== null) {
- callFailureCallback(callback, readdirError);
- return;
- }
- const tasks = names.map((name) => {
- const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
- return (done) => {
- fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
- if (error !== null) {
- done(error);
- return;
- }
- const entry = {
- name,
- path,
- dirent: utils.fs.createDirentFromStats(name, stats)
- };
- if (settings.stats) {
- entry.stats = stats;
- }
- done(null, entry);
- });
- };
- });
- rpl(tasks, (rplError, entries) => {
- if (rplError !== null) {
- callFailureCallback(callback, rplError);
- return;
- }
- callSuccessCallback(callback, entries);
- });
- });
- }
- exports2.readdir = readdir;
- function callFailureCallback(callback, error) {
- callback(error);
- }
- function callSuccessCallback(callback, result) {
- callback(null, result);
- }
- }
- });
- var require_sync2 = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
- var fsStat = require_out();
- var constants_1 = require_constants3();
- var utils = require_utils5();
- var common = require_common();
- function read(directory, settings) {
- if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
- return readdirWithFileTypes(directory, settings);
- }
- return readdir(directory, settings);
- }
- exports2.read = read;
- function readdirWithFileTypes(directory, settings) {
- const dirents = settings.fs.readdirSync(directory, {
- withFileTypes: true
- });
- return dirents.map((dirent) => {
- const entry = {
- dirent,
- name: dirent.name,
- path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
- };
- if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
- try {
- const stats = settings.fs.statSync(entry.path);
- entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
- } catch (error) {
- if (settings.throwErrorOnBrokenSymbolicLink) {
- throw error;
- }
- }
- }
- return entry;
- });
- }
- exports2.readdirWithFileTypes = readdirWithFileTypes;
- function readdir(directory, settings) {
- const names = settings.fs.readdirSync(directory);
- return names.map((name) => {
- const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
- const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
- const entry = {
- name,
- path: entryPath,
- dirent: utils.fs.createDirentFromStats(name, stats)
- };
- if (settings.stats) {
- entry.stats = stats;
- }
- return entry;
- });
- }
- exports2.readdir = readdir;
- }
- });
- var require_fs4 = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
- var fs = require("fs");
- exports2.FILE_SYSTEM_ADAPTER = {
- lstat: fs.lstat,
- stat: fs.stat,
- lstatSync: fs.lstatSync,
- statSync: fs.statSync,
- readdir: fs.readdir,
- readdirSync: fs.readdirSync
- };
- function createFileSystemAdapter(fsMethods) {
- if (fsMethods === void 0) {
- return exports2.FILE_SYSTEM_ADAPTER;
- }
- return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
- }
- exports2.createFileSystemAdapter = createFileSystemAdapter;
- }
- });
- var require_settings2 = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var path = require("path");
- var fsStat = require_out();
- var fs = require_fs4();
- var Settings = class {
- constructor(_options = {}) {
- this._options = _options;
- this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
- this.fs = fs.createFileSystemAdapter(this._options.fs);
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
- this.stats = this._getValue(this._options.stats, false);
- this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
- this.fsStatSettings = new fsStat.Settings({
- followSymbolicLink: this.followSymbolicLinks,
- fs: this.fs,
- throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
- });
- }
- _getValue(option, value) {
- return option !== null && option !== void 0 ? option : value;
- }
- };
- exports2.default = Settings;
- }
- });
- var require_out2 = __commonJS2({
- "node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.Settings = exports2.scandirSync = exports2.scandir = void 0;
- var async = require_async2();
- var sync = require_sync2();
- var settings_1 = require_settings2();
- exports2.Settings = settings_1.default;
- function scandir(path, optionsOrSettingsOrCallback, callback) {
- if (typeof optionsOrSettingsOrCallback === "function") {
- async.read(path, getSettings(), optionsOrSettingsOrCallback);
- return;
- }
- async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
- }
- exports2.scandir = scandir;
- function scandirSync(path, optionsOrSettings) {
- const settings = getSettings(optionsOrSettings);
- return sync.read(path, settings);
- }
- exports2.scandirSync = scandirSync;
- function getSettings(settingsOrOptions = {}) {
- if (settingsOrOptions instanceof settings_1.default) {
- return settingsOrOptions;
- }
- return new settings_1.default(settingsOrOptions);
- }
- }
- });
- var require_reusify = __commonJS2({
- "node_modules/reusify/reusify.js"(exports2, module2) {
- "use strict";
- function reusify(Constructor) {
- var head = new Constructor();
- var tail = head;
- function get() {
- var current = head;
- if (current.next) {
- head = current.next;
- } else {
- head = new Constructor();
- tail = head;
- }
- current.next = null;
- return current;
- }
- function release(obj) {
- tail.next = obj;
- tail = obj;
- }
- return {
- get,
- release
- };
- }
- module2.exports = reusify;
- }
- });
- var require_queue = __commonJS2({
- "node_modules/fastq/queue.js"(exports2, module2) {
- "use strict";
- var reusify = require_reusify();
- function fastqueue(context, worker, concurrency) {
- if (typeof context === "function") {
- concurrency = worker;
- worker = context;
- context = null;
- }
- if (concurrency < 1) {
- throw new Error("fastqueue concurrency must be greater than 1");
- }
- var cache = reusify(Task);
- var queueHead = null;
- var queueTail = null;
- var _running = 0;
- var errorHandler = null;
- var self2 = {
- push,
- drain: noop,
- saturated: noop,
- pause,
- paused: false,
- concurrency,
- running,
- resume,
- idle,
- length,
- getQueue,
- unshift,
- empty: noop,
- kill,
- killAndDrain,
- error
- };
- return self2;
- function running() {
- return _running;
- }
- function pause() {
- self2.paused = true;
- }
- function length() {
- var current = queueHead;
- var counter = 0;
- while (current) {
- current = current.next;
- counter++;
- }
- return counter;
- }
- function getQueue() {
- var current = queueHead;
- var tasks = [];
- while (current) {
- tasks.push(current.value);
- current = current.next;
- }
- return tasks;
- }
- function resume() {
- if (!self2.paused)
- return;
- self2.paused = false;
- for (var i = 0; i < self2.concurrency; i++) {
- _running++;
- release();
- }
- }
- function idle() {
- return _running === 0 && self2.length() === 0;
- }
- function push(value, done) {
- var current = cache.get();
- current.context = context;
- current.release = release;
- current.value = value;
- current.callback = done || noop;
- current.errorHandler = errorHandler;
- if (_running === self2.concurrency || self2.paused) {
- if (queueTail) {
- queueTail.next = current;
- queueTail = current;
- } else {
- queueHead = current;
- queueTail = current;
- self2.saturated();
- }
- } else {
- _running++;
- worker.call(context, current.value, current.worked);
- }
- }
- function unshift(value, done) {
- var current = cache.get();
- current.context = context;
- current.release = release;
- current.value = value;
- current.callback = done || noop;
- if (_running === self2.concurrency || self2.paused) {
- if (queueHead) {
- current.next = queueHead;
- queueHead = current;
- } else {
- queueHead = current;
- queueTail = current;
- self2.saturated();
- }
- } else {
- _running++;
- worker.call(context, current.value, current.worked);
- }
- }
- function release(holder) {
- if (holder) {
- cache.release(holder);
- }
- var next = queueHead;
- if (next) {
- if (!self2.paused) {
- if (queueTail === queueHead) {
- queueTail = null;
- }
- queueHead = next.next;
- next.next = null;
- worker.call(context, next.value, next.worked);
- if (queueTail === null) {
- self2.empty();
- }
- } else {
- _running--;
- }
- } else if (--_running === 0) {
- self2.drain();
- }
- }
- function kill() {
- queueHead = null;
- queueTail = null;
- self2.drain = noop;
- }
- function killAndDrain() {
- queueHead = null;
- queueTail = null;
- self2.drain();
- self2.drain = noop;
- }
- function error(handler) {
- errorHandler = handler;
- }
- }
- function noop() {
- }
- function Task() {
- this.value = null;
- this.callback = noop;
- this.next = null;
- this.release = noop;
- this.context = null;
- this.errorHandler = null;
- var self2 = this;
- this.worked = function worked(err, result) {
- var callback = self2.callback;
- var errorHandler = self2.errorHandler;
- var val = self2.value;
- self2.value = null;
- self2.callback = noop;
- if (self2.errorHandler) {
- errorHandler(err, val);
- }
- callback.call(self2.context, err, result);
- self2.release(self2);
- };
- }
- function queueAsPromised(context, worker, concurrency) {
- if (typeof context === "function") {
- concurrency = worker;
- worker = context;
- context = null;
- }
- function asyncWrapper(arg, cb) {
- worker.call(this, arg).then(function(res) {
- cb(null, res);
- }, cb);
- }
- var queue = fastqueue(context, asyncWrapper, concurrency);
- var pushCb = queue.push;
- var unshiftCb = queue.unshift;
- queue.push = push;
- queue.unshift = unshift;
- queue.drained = drained;
- return queue;
- function push(value) {
- var p = new Promise(function(resolve, reject) {
- pushCb(value, function(err, result) {
- if (err) {
- reject(err);
- return;
- }
- resolve(result);
- });
- });
- p.catch(noop);
- return p;
- }
- function unshift(value) {
- var p = new Promise(function(resolve, reject) {
- unshiftCb(value, function(err, result) {
- if (err) {
- reject(err);
- return;
- }
- resolve(result);
- });
- });
- p.catch(noop);
- return p;
- }
- function drained() {
- var previousDrain = queue.drain;
- var p = new Promise(function(resolve) {
- queue.drain = function() {
- previousDrain();
- resolve();
- };
- });
- return p;
- }
- }
- module2.exports = fastqueue;
- module2.exports.promise = queueAsPromised;
- }
- });
- var require_common2 = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.joinPathSegments = exports2.replacePathSegmentSeparator = exports2.isAppliedFilter = exports2.isFatalError = void 0;
- function isFatalError(settings, error) {
- if (settings.errorFilter === null) {
- return true;
- }
- return !settings.errorFilter(error);
- }
- exports2.isFatalError = isFatalError;
- function isAppliedFilter(filter, value) {
- return filter === null || filter(value);
- }
- exports2.isAppliedFilter = isAppliedFilter;
- function replacePathSegmentSeparator(filepath, separator) {
- return filepath.split(/[/\\]/).join(separator);
- }
- exports2.replacePathSegmentSeparator = replacePathSegmentSeparator;
- function joinPathSegments(a, b, separator) {
- if (a === "") {
- return b;
- }
- if (a.endsWith(separator)) {
- return a + b;
- }
- return a + separator + b;
- }
- exports2.joinPathSegments = joinPathSegments;
- }
- });
- var require_reader = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var common = require_common2();
- var Reader = class {
- constructor(_root, _settings) {
- this._root = _root;
- this._settings = _settings;
- this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
- }
- };
- exports2.default = Reader;
- }
- });
- var require_async3 = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var events_1 = require("events");
- var fsScandir = require_out2();
- var fastq = require_queue();
- var common = require_common2();
- var reader_1 = require_reader();
- var AsyncReader = class extends reader_1.default {
- constructor(_root, _settings) {
- super(_root, _settings);
- this._settings = _settings;
- this._scandir = fsScandir.scandir;
- this._emitter = new events_1.EventEmitter();
- this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
- this._isFatalError = false;
- this._isDestroyed = false;
- this._queue.drain = () => {
- if (!this._isFatalError) {
- this._emitter.emit("end");
- }
- };
- }
- read() {
- this._isFatalError = false;
- this._isDestroyed = false;
- setImmediate(() => {
- this._pushToQueue(this._root, this._settings.basePath);
- });
- return this._emitter;
- }
- get isDestroyed() {
- return this._isDestroyed;
- }
- destroy() {
- if (this._isDestroyed) {
- throw new Error("The reader is already destroyed");
- }
- this._isDestroyed = true;
- this._queue.killAndDrain();
- }
- onEntry(callback) {
- this._emitter.on("entry", callback);
- }
- onError(callback) {
- this._emitter.once("error", callback);
- }
- onEnd(callback) {
- this._emitter.once("end", callback);
- }
- _pushToQueue(directory, base) {
- const queueItem = {
- directory,
- base
- };
- this._queue.push(queueItem, (error) => {
- if (error !== null) {
- this._handleError(error);
- }
- });
- }
- _worker(item, done) {
- this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
- if (error !== null) {
- done(error, void 0);
- return;
- }
- for (const entry of entries) {
- this._handleEntry(entry, item.base);
- }
- done(null, void 0);
- });
- }
- _handleError(error) {
- if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
- return;
- }
- this._isFatalError = true;
- this._isDestroyed = true;
- this._emitter.emit("error", error);
- }
- _handleEntry(entry, base) {
- if (this._isDestroyed || this._isFatalError) {
- return;
- }
- const fullpath = entry.path;
- if (base !== void 0) {
- entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
- }
- if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
- this._emitEntry(entry);
- }
- if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
- this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
- }
- }
- _emitEntry(entry) {
- this._emitter.emit("entry", entry);
- }
- };
- exports2.default = AsyncReader;
- }
- });
- var require_async4 = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var async_1 = require_async3();
- var AsyncProvider = class {
- constructor(_root, _settings) {
- this._root = _root;
- this._settings = _settings;
- this._reader = new async_1.default(this._root, this._settings);
- this._storage = [];
- }
- read(callback) {
- this._reader.onError((error) => {
- callFailureCallback(callback, error);
- });
- this._reader.onEntry((entry) => {
- this._storage.push(entry);
- });
- this._reader.onEnd(() => {
- callSuccessCallback(callback, this._storage);
- });
- this._reader.read();
- }
- };
- exports2.default = AsyncProvider;
- function callFailureCallback(callback, error) {
- callback(error);
- }
- function callSuccessCallback(callback, entries) {
- callback(null, entries);
- }
- }
- });
- var require_stream2 = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var stream_1 = require("stream");
- var async_1 = require_async3();
- var StreamProvider = class {
- constructor(_root, _settings) {
- this._root = _root;
- this._settings = _settings;
- this._reader = new async_1.default(this._root, this._settings);
- this._stream = new stream_1.Readable({
- objectMode: true,
- read: () => {
- },
- destroy: () => {
- if (!this._reader.isDestroyed) {
- this._reader.destroy();
- }
- }
- });
- }
- read() {
- this._reader.onError((error) => {
- this._stream.emit("error", error);
- });
- this._reader.onEntry((entry) => {
- this._stream.push(entry);
- });
- this._reader.onEnd(() => {
- this._stream.push(null);
- });
- this._reader.read();
- return this._stream;
- }
- };
- exports2.default = StreamProvider;
- }
- });
- var require_sync3 = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var fsScandir = require_out2();
- var common = require_common2();
- var reader_1 = require_reader();
- var SyncReader = class extends reader_1.default {
- constructor() {
- super(...arguments);
- this._scandir = fsScandir.scandirSync;
- this._storage = [];
- this._queue = /* @__PURE__ */ new Set();
- }
- read() {
- this._pushToQueue(this._root, this._settings.basePath);
- this._handleQueue();
- return this._storage;
- }
- _pushToQueue(directory, base) {
- this._queue.add({
- directory,
- base
- });
- }
- _handleQueue() {
- for (const item of this._queue.values()) {
- this._handleDirectory(item.directory, item.base);
- }
- }
- _handleDirectory(directory, base) {
- try {
- const entries = this._scandir(directory, this._settings.fsScandirSettings);
- for (const entry of entries) {
- this._handleEntry(entry, base);
- }
- } catch (error) {
- this._handleError(error);
- }
- }
- _handleError(error) {
- if (!common.isFatalError(this._settings, error)) {
- return;
- }
- throw error;
- }
- _handleEntry(entry, base) {
- const fullpath = entry.path;
- if (base !== void 0) {
- entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
- }
- if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
- this._pushToStorage(entry);
- }
- if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
- this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
- }
- }
- _pushToStorage(entry) {
- this._storage.push(entry);
- }
- };
- exports2.default = SyncReader;
- }
- });
- var require_sync4 = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var sync_1 = require_sync3();
- var SyncProvider = class {
- constructor(_root, _settings) {
- this._root = _root;
- this._settings = _settings;
- this._reader = new sync_1.default(this._root, this._settings);
- }
- read() {
- return this._reader.read();
- }
- };
- exports2.default = SyncProvider;
- }
- });
- var require_settings3 = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var path = require("path");
- var fsScandir = require_out2();
- var Settings = class {
- constructor(_options = {}) {
- this._options = _options;
- this.basePath = this._getValue(this._options.basePath, void 0);
- this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
- this.deepFilter = this._getValue(this._options.deepFilter, null);
- this.entryFilter = this._getValue(this._options.entryFilter, null);
- this.errorFilter = this._getValue(this._options.errorFilter, null);
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
- this.fsScandirSettings = new fsScandir.Settings({
- followSymbolicLinks: this._options.followSymbolicLinks,
- fs: this._options.fs,
- pathSegmentSeparator: this._options.pathSegmentSeparator,
- stats: this._options.stats,
- throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
- });
- }
- _getValue(option, value) {
- return option !== null && option !== void 0 ? option : value;
- }
- };
- exports2.default = Settings;
- }
- });
- var require_out3 = __commonJS2({
- "node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.Settings = exports2.walkStream = exports2.walkSync = exports2.walk = void 0;
- var async_1 = require_async4();
- var stream_1 = require_stream2();
- var sync_1 = require_sync4();
- var settings_1 = require_settings3();
- exports2.Settings = settings_1.default;
- function walk(directory, optionsOrSettingsOrCallback, callback) {
- if (typeof optionsOrSettingsOrCallback === "function") {
- new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
- return;
- }
- new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
- }
- exports2.walk = walk;
- function walkSync(directory, optionsOrSettings) {
- const settings = getSettings(optionsOrSettings);
- const provider = new sync_1.default(directory, settings);
- return provider.read();
- }
- exports2.walkSync = walkSync;
- function walkStream(directory, optionsOrSettings) {
- const settings = getSettings(optionsOrSettings);
- const provider = new stream_1.default(directory, settings);
- return provider.read();
- }
- exports2.walkStream = walkStream;
- function getSettings(settingsOrOptions = {}) {
- if (settingsOrOptions instanceof settings_1.default) {
- return settingsOrOptions;
- }
- return new settings_1.default(settingsOrOptions);
- }
- }
- });
- var require_reader2 = __commonJS2({
- "node_modules/fast-glob/out/readers/reader.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var path = require("path");
- var fsStat = require_out();
- var utils = require_utils4();
- var Reader = class {
- constructor(_settings) {
- this._settings = _settings;
- this._fsStatSettings = new fsStat.Settings({
- followSymbolicLink: this._settings.followSymbolicLinks,
- fs: this._settings.fs,
- throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
- });
- }
- _getFullEntryPath(filepath) {
- return path.resolve(this._settings.cwd, filepath);
- }
- _makeEntry(stats, pattern) {
- const entry = {
- name: pattern,
- path: pattern,
- dirent: utils.fs.createDirentFromStats(pattern, stats)
- };
- if (this._settings.stats) {
- entry.stats = stats;
- }
- return entry;
- }
- _isFatalError(error) {
- return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
- }
- };
- exports2.default = Reader;
- }
- });
- var require_stream3 = __commonJS2({
- "node_modules/fast-glob/out/readers/stream.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var stream_1 = require("stream");
- var fsStat = require_out();
- var fsWalk = require_out3();
- var reader_1 = require_reader2();
- var ReaderStream = class extends reader_1.default {
- constructor() {
- super(...arguments);
- this._walkStream = fsWalk.walkStream;
- this._stat = fsStat.stat;
- }
- dynamic(root, options) {
- return this._walkStream(root, options);
- }
- static(patterns, options) {
- const filepaths = patterns.map(this._getFullEntryPath, this);
- const stream = new stream_1.PassThrough({
- objectMode: true
- });
- stream._write = (index, _enc, done) => {
- return this._getEntry(filepaths[index], patterns[index], options).then((entry) => {
- if (entry !== null && options.entryFilter(entry)) {
- stream.push(entry);
- }
- if (index === filepaths.length - 1) {
- stream.end();
- }
- done();
- }).catch(done);
- };
- for (let i = 0; i < filepaths.length; i++) {
- stream.write(i);
- }
- return stream;
- }
- _getEntry(filepath, pattern, options) {
- return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
- if (options.errorFilter(error)) {
- return null;
- }
- throw error;
- });
- }
- _getStat(filepath) {
- return new Promise((resolve, reject) => {
- this._stat(filepath, this._fsStatSettings, (error, stats) => {
- return error === null ? resolve(stats) : reject(error);
- });
- });
- }
- };
- exports2.default = ReaderStream;
- }
- });
- var require_matcher = __commonJS2({
- "node_modules/fast-glob/out/providers/matchers/matcher.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var utils = require_utils4();
- var Matcher = class {
- constructor(_patterns, _settings, _micromatchOptions) {
- this._patterns = _patterns;
- this._settings = _settings;
- this._micromatchOptions = _micromatchOptions;
- this._storage = [];
- this._fillStorage();
- }
- _fillStorage() {
- const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns);
- for (const pattern of patterns) {
- const segments = this._getPatternSegments(pattern);
- const sections = this._splitSegmentsIntoSections(segments);
- this._storage.push({
- complete: sections.length <= 1,
- pattern,
- segments,
- sections
- });
- }
- }
- _getPatternSegments(pattern) {
- const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
- return parts.map((part) => {
- const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
- if (!dynamic) {
- return {
- dynamic: false,
- pattern: part
- };
- }
- return {
- dynamic: true,
- pattern: part,
- patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
- };
- });
- }
- _splitSegmentsIntoSections(segments) {
- return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
- }
- };
- exports2.default = Matcher;
- }
- });
- var require_partial = __commonJS2({
- "node_modules/fast-glob/out/providers/matchers/partial.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var matcher_1 = require_matcher();
- var PartialMatcher = class extends matcher_1.default {
- match(filepath) {
- const parts = filepath.split("/");
- const levels = parts.length;
- const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
- for (const pattern of patterns) {
- const section = pattern.sections[0];
- if (!pattern.complete && levels > section.length) {
- return true;
- }
- const match = parts.every((part, index) => {
- const segment = pattern.segments[index];
- if (segment.dynamic && segment.patternRe.test(part)) {
- return true;
- }
- if (!segment.dynamic && segment.pattern === part) {
- return true;
- }
- return false;
- });
- if (match) {
- return true;
- }
- }
- return false;
- }
- };
- exports2.default = PartialMatcher;
- }
- });
- var require_deep = __commonJS2({
- "node_modules/fast-glob/out/providers/filters/deep.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var utils = require_utils4();
- var partial_1 = require_partial();
- var DeepFilter = class {
- constructor(_settings, _micromatchOptions) {
- this._settings = _settings;
- this._micromatchOptions = _micromatchOptions;
- }
- getFilter(basePath, positive, negative) {
- const matcher = this._getMatcher(positive);
- const negativeRe = this._getNegativePatternsRe(negative);
- return (entry) => this._filter(basePath, entry, matcher, negativeRe);
- }
- _getMatcher(patterns) {
- return new partial_1.default(patterns, this._settings, this._micromatchOptions);
- }
- _getNegativePatternsRe(patterns) {
- const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
- return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
- }
- _filter(basePath, entry, matcher, negativeRe) {
- if (this._isSkippedByDeep(basePath, entry.path)) {
- return false;
- }
- if (this._isSkippedSymbolicLink(entry)) {
- return false;
- }
- const filepath = utils.path.removeLeadingDotSegment(entry.path);
- if (this._isSkippedByPositivePatterns(filepath, matcher)) {
- return false;
- }
- return this._isSkippedByNegativePatterns(filepath, negativeRe);
- }
- _isSkippedByDeep(basePath, entryPath) {
- if (this._settings.deep === Infinity) {
- return false;
- }
- return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
- }
- _getEntryLevel(basePath, entryPath) {
- const entryPathDepth = entryPath.split("/").length;
- if (basePath === "") {
- return entryPathDepth;
- }
- const basePathDepth = basePath.split("/").length;
- return entryPathDepth - basePathDepth;
- }
- _isSkippedSymbolicLink(entry) {
- return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
- }
- _isSkippedByPositivePatterns(entryPath, matcher) {
- return !this._settings.baseNameMatch && !matcher.match(entryPath);
- }
- _isSkippedByNegativePatterns(entryPath, patternsRe) {
- return !utils.pattern.matchAny(entryPath, patternsRe);
- }
- };
- exports2.default = DeepFilter;
- }
- });
- var require_entry = __commonJS2({
- "node_modules/fast-glob/out/providers/filters/entry.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var utils = require_utils4();
- var EntryFilter = class {
- constructor(_settings, _micromatchOptions) {
- this._settings = _settings;
- this._micromatchOptions = _micromatchOptions;
- this.index = /* @__PURE__ */ new Map();
- }
- getFilter(positive, negative) {
- const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
- const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions);
- return (entry) => this._filter(entry, positiveRe, negativeRe);
- }
- _filter(entry, positiveRe, negativeRe) {
- if (this._settings.unique && this._isDuplicateEntry(entry)) {
- return false;
- }
- if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
- return false;
- }
- if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
- return false;
- }
- const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
- const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe);
- if (this._settings.unique && isMatched) {
- this._createIndexRecord(entry);
- }
- return isMatched;
- }
- _isDuplicateEntry(entry) {
- return this.index.has(entry.path);
- }
- _createIndexRecord(entry) {
- this.index.set(entry.path, void 0);
- }
- _onlyFileFilter(entry) {
- return this._settings.onlyFiles && !entry.dirent.isFile();
- }
- _onlyDirectoryFilter(entry) {
- return this._settings.onlyDirectories && !entry.dirent.isDirectory();
- }
- _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
- if (!this._settings.absolute) {
- return false;
- }
- const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
- return utils.pattern.matchAny(fullpath, patternsRe);
- }
- _isMatchToPatterns(entryPath, patternsRe) {
- const filepath = utils.path.removeLeadingDotSegment(entryPath);
- return utils.pattern.matchAny(filepath, patternsRe) || utils.pattern.matchAny(filepath + "/", patternsRe);
- }
- };
- exports2.default = EntryFilter;
- }
- });
- var require_error = __commonJS2({
- "node_modules/fast-glob/out/providers/filters/error.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var utils = require_utils4();
- var ErrorFilter = class {
- constructor(_settings) {
- this._settings = _settings;
- }
- getFilter() {
- return (error) => this._isNonFatalError(error);
- }
- _isNonFatalError(error) {
- return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
- }
- };
- exports2.default = ErrorFilter;
- }
- });
- var require_entry2 = __commonJS2({
- "node_modules/fast-glob/out/providers/transformers/entry.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var utils = require_utils4();
- var EntryTransformer = class {
- constructor(_settings) {
- this._settings = _settings;
- }
- getTransformer() {
- return (entry) => this._transform(entry);
- }
- _transform(entry) {
- let filepath = entry.path;
- if (this._settings.absolute) {
- filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
- filepath = utils.path.unixify(filepath);
- }
- if (this._settings.markDirectories && entry.dirent.isDirectory()) {
- filepath += "/";
- }
- if (!this._settings.objectMode) {
- return filepath;
- }
- return Object.assign(Object.assign({}, entry), {
- path: filepath
- });
- }
- };
- exports2.default = EntryTransformer;
- }
- });
- var require_provider = __commonJS2({
- "node_modules/fast-glob/out/providers/provider.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var path = require("path");
- var deep_1 = require_deep();
- var entry_1 = require_entry();
- var error_1 = require_error();
- var entry_2 = require_entry2();
- var Provider = class {
- constructor(_settings) {
- this._settings = _settings;
- this.errorFilter = new error_1.default(this._settings);
- this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
- this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
- this.entryTransformer = new entry_2.default(this._settings);
- }
- _getRootDirectory(task) {
- return path.resolve(this._settings.cwd, task.base);
- }
- _getReaderOptions(task) {
- const basePath = task.base === "." ? "" : task.base;
- return {
- basePath,
- pathSegmentSeparator: "/",
- concurrency: this._settings.concurrency,
- deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
- entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
- errorFilter: this.errorFilter.getFilter(),
- followSymbolicLinks: this._settings.followSymbolicLinks,
- fs: this._settings.fs,
- stats: this._settings.stats,
- throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
- transform: this.entryTransformer.getTransformer()
- };
- }
- _getMicromatchOptions() {
- return {
- dot: this._settings.dot,
- matchBase: this._settings.baseNameMatch,
- nobrace: !this._settings.braceExpansion,
- nocase: !this._settings.caseSensitiveMatch,
- noext: !this._settings.extglob,
- noglobstar: !this._settings.globstar,
- posix: true,
- strictSlashes: false
- };
- }
- };
- exports2.default = Provider;
- }
- });
- var require_async5 = __commonJS2({
- "node_modules/fast-glob/out/providers/async.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var stream_1 = require_stream3();
- var provider_1 = require_provider();
- var ProviderAsync = class extends provider_1.default {
- constructor() {
- super(...arguments);
- this._reader = new stream_1.default(this._settings);
- }
- read(task) {
- const root = this._getRootDirectory(task);
- const options = this._getReaderOptions(task);
- const entries = [];
- return new Promise((resolve, reject) => {
- const stream = this.api(root, task, options);
- stream.once("error", reject);
- stream.on("data", (entry) => entries.push(options.transform(entry)));
- stream.once("end", () => resolve(entries));
- });
- }
- api(root, task, options) {
- if (task.dynamic) {
- return this._reader.dynamic(root, options);
- }
- return this._reader.static(task.patterns, options);
- }
- };
- exports2.default = ProviderAsync;
- }
- });
- var require_stream4 = __commonJS2({
- "node_modules/fast-glob/out/providers/stream.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var stream_1 = require("stream");
- var stream_2 = require_stream3();
- var provider_1 = require_provider();
- var ProviderStream = class extends provider_1.default {
- constructor() {
- super(...arguments);
- this._reader = new stream_2.default(this._settings);
- }
- read(task) {
- const root = this._getRootDirectory(task);
- const options = this._getReaderOptions(task);
- const source = this.api(root, task, options);
- const destination = new stream_1.Readable({
- objectMode: true,
- read: () => {
- }
- });
- source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
- destination.once("close", () => source.destroy());
- return destination;
- }
- api(root, task, options) {
- if (task.dynamic) {
- return this._reader.dynamic(root, options);
- }
- return this._reader.static(task.patterns, options);
- }
- };
- exports2.default = ProviderStream;
- }
- });
- var require_sync5 = __commonJS2({
- "node_modules/fast-glob/out/readers/sync.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var fsStat = require_out();
- var fsWalk = require_out3();
- var reader_1 = require_reader2();
- var ReaderSync = class extends reader_1.default {
- constructor() {
- super(...arguments);
- this._walkSync = fsWalk.walkSync;
- this._statSync = fsStat.statSync;
- }
- dynamic(root, options) {
- return this._walkSync(root, options);
- }
- static(patterns, options) {
- const entries = [];
- for (const pattern of patterns) {
- const filepath = this._getFullEntryPath(pattern);
- const entry = this._getEntry(filepath, pattern, options);
- if (entry === null || !options.entryFilter(entry)) {
- continue;
- }
- entries.push(entry);
- }
- return entries;
- }
- _getEntry(filepath, pattern, options) {
- try {
- const stats = this._getStat(filepath);
- return this._makeEntry(stats, pattern);
- } catch (error) {
- if (options.errorFilter(error)) {
- return null;
- }
- throw error;
- }
- }
- _getStat(filepath) {
- return this._statSync(filepath, this._fsStatSettings);
- }
- };
- exports2.default = ReaderSync;
- }
- });
- var require_sync6 = __commonJS2({
- "node_modules/fast-glob/out/providers/sync.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- var sync_1 = require_sync5();
- var provider_1 = require_provider();
- var ProviderSync = class extends provider_1.default {
- constructor() {
- super(...arguments);
- this._reader = new sync_1.default(this._settings);
- }
- read(task) {
- const root = this._getRootDirectory(task);
- const options = this._getReaderOptions(task);
- const entries = this.api(root, task, options);
- return entries.map(options.transform);
- }
- api(root, task, options) {
- if (task.dynamic) {
- return this._reader.dynamic(root, options);
- }
- return this._reader.static(task.patterns, options);
- }
- };
- exports2.default = ProviderSync;
- }
- });
- var require_settings4 = __commonJS2({
- "node_modules/fast-glob/out/settings.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
- var fs = require("fs");
- var os2 = require("os");
- var CPU_COUNT = Math.max(os2.cpus().length, 1);
- exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
- lstat: fs.lstat,
- lstatSync: fs.lstatSync,
- stat: fs.stat,
- statSync: fs.statSync,
- readdir: fs.readdir,
- readdirSync: fs.readdirSync
- };
- var Settings = class {
- constructor(_options = {}) {
- this._options = _options;
- this.absolute = this._getValue(this._options.absolute, false);
- this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
- this.braceExpansion = this._getValue(this._options.braceExpansion, true);
- this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
- this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
- this.cwd = this._getValue(this._options.cwd, process.cwd());
- this.deep = this._getValue(this._options.deep, Infinity);
- this.dot = this._getValue(this._options.dot, false);
- this.extglob = this._getValue(this._options.extglob, true);
- this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
- this.fs = this._getFileSystemMethods(this._options.fs);
- this.globstar = this._getValue(this._options.globstar, true);
- this.ignore = this._getValue(this._options.ignore, []);
- this.markDirectories = this._getValue(this._options.markDirectories, false);
- this.objectMode = this._getValue(this._options.objectMode, false);
- this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
- this.onlyFiles = this._getValue(this._options.onlyFiles, true);
- this.stats = this._getValue(this._options.stats, false);
- this.suppressErrors = this._getValue(this._options.suppressErrors, false);
- this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
- this.unique = this._getValue(this._options.unique, true);
- if (this.onlyDirectories) {
- this.onlyFiles = false;
- }
- if (this.stats) {
- this.objectMode = true;
- }
- }
- _getValue(option, value) {
- return option === void 0 ? value : option;
- }
- _getFileSystemMethods(methods = {}) {
- return Object.assign(Object.assign({}, exports2.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
- }
- };
- exports2.default = Settings;
- }
- });
- var require_out4 = __commonJS2({
- "node_modules/fast-glob/out/index.js"(exports2, module2) {
- "use strict";
- var taskManager = require_tasks();
- var patternManager = require_patterns();
- var async_1 = require_async5();
- var stream_1 = require_stream4();
- var sync_1 = require_sync6();
- var settings_1 = require_settings4();
- var utils = require_utils4();
- async function FastGlob(source, options) {
- assertPatternsInput(source);
- const works = getWorks(source, async_1.default, options);
- const result = await Promise.all(works);
- return utils.array.flatten(result);
- }
- (function(FastGlob2) {
- function sync(source, options) {
- assertPatternsInput(source);
- const works = getWorks(source, sync_1.default, options);
- return utils.array.flatten(works);
- }
- FastGlob2.sync = sync;
- function stream(source, options) {
- assertPatternsInput(source);
- const works = getWorks(source, stream_1.default, options);
- return utils.stream.merge(works);
- }
- FastGlob2.stream = stream;
- function generateTasks(source, options) {
- assertPatternsInput(source);
- const patterns = patternManager.transform([].concat(source));
- const settings = new settings_1.default(options);
- return taskManager.generate(patterns, settings);
- }
- FastGlob2.generateTasks = generateTasks;
- function isDynamicPattern(source, options) {
- assertPatternsInput(source);
- const settings = new settings_1.default(options);
- return utils.pattern.isDynamicPattern(source, settings);
- }
- FastGlob2.isDynamicPattern = isDynamicPattern;
- function escapePath(source) {
- assertPatternsInput(source);
- return utils.path.escape(source);
- }
- FastGlob2.escapePath = escapePath;
- })(FastGlob || (FastGlob = {}));
- function getWorks(source, _Provider, options) {
- const patterns = patternManager.transform([].concat(source));
- const settings = new settings_1.default(options);
- const tasks = taskManager.generate(patterns, settings);
- const provider = new _Provider(settings);
- return tasks.map(provider.read, provider);
- }
- function assertPatternsInput(input) {
- const source = [].concat(input);
- const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
- if (!isValidSource) {
- throw new TypeError("Patterns must be a string (non empty) or an array of strings");
- }
- }
- module2.exports = FastGlob;
- }
- });
- var require_expand_patterns = __commonJS2({
- "src/cli/expand-patterns.js"(exports2, module2) {
- "use strict";
- var path = require("path");
- var fastGlob = require_out4();
- var {
- statSafe
- } = require_utils();
- async function* expandPatterns(context) {
- const cwd = process.cwd();
- const seen = /* @__PURE__ */ new Set();
- let noResults = true;
- for await (const pathOrError of expandPatternsInternal(context)) {
- noResults = false;
- if (typeof pathOrError !== "string") {
- yield pathOrError;
- continue;
- }
- const relativePath = path.relative(cwd, pathOrError);
- if (seen.has(relativePath)) {
- continue;
- }
- seen.add(relativePath);
- yield relativePath;
- }
- if (noResults && context.argv.errorOnUnmatchedPattern !== false) {
- yield {
- error: `No matching files. Patterns: ${context.filePatterns.join(" ")}`
- };
- }
- }
- async function* expandPatternsInternal(context) {
- const silentlyIgnoredDirs = [".git", ".svn", ".hg"];
- if (context.argv.withNodeModules !== true) {
- silentlyIgnoredDirs.push("node_modules");
- }
- const globOptions = {
- dot: true,
- ignore: silentlyIgnoredDirs.map((dir) => "**/" + dir)
- };
- let supportedFilesGlob;
- const cwd = process.cwd();
- const entries = [];
- for (const pattern of context.filePatterns) {
- const absolutePath = path.resolve(cwd, pattern);
- if (containsIgnoredPathSegment(absolutePath, cwd, silentlyIgnoredDirs)) {
- continue;
- }
- const stat = await statSafe(absolutePath);
- if (stat) {
- if (stat.isFile()) {
- entries.push({
- type: "file",
- glob: escapePathForGlob(fixWindowsSlashes(pattern)),
- input: pattern
- });
- } else if (stat.isDirectory()) {
- const relativePath = path.relative(cwd, absolutePath) || ".";
- entries.push({
- type: "dir",
- glob: escapePathForGlob(fixWindowsSlashes(relativePath)) + "/" + getSupportedFilesGlob(),
- input: pattern
- });
- }
- } else if (pattern[0] === "!") {
- globOptions.ignore.push(fixWindowsSlashes(pattern.slice(1)));
- } else {
- entries.push({
- type: "glob",
- glob: fixWindowsSlashes(pattern),
- input: pattern
- });
- }
- }
- for (const {
- type,
- glob,
- input
- } of entries) {
- let result;
- try {
- result = await fastGlob(glob, globOptions);
- } catch ({
- message
- }) {
- yield {
- error: `${errorMessages.globError[type]}: ${input}
- ${message}`
- };
- continue;
- }
- if (result.length === 0) {
- if (context.argv.errorOnUnmatchedPattern !== false) {
- yield {
- error: `${errorMessages.emptyResults[type]}: "${input}".`
- };
- }
- } else {
- yield* sortPaths(result);
- }
- }
- function getSupportedFilesGlob() {
- if (!supportedFilesGlob) {
- const extensions = context.languages.flatMap((lang) => lang.extensions || []);
- const filenames = context.languages.flatMap((lang) => lang.filenames || []);
- supportedFilesGlob = `**/{${[...extensions.map((ext) => "*" + (ext[0] === "." ? ext : "." + ext)), ...filenames]}}`;
- }
- return supportedFilesGlob;
- }
- }
- var errorMessages = {
- globError: {
- file: "Unable to resolve file",
- dir: "Unable to expand directory",
- glob: "Unable to expand glob pattern"
- },
- emptyResults: {
- file: "Explicitly specified file was ignored due to negative glob patterns",
- dir: "No supported files were found in the directory",
- glob: "No files matching the pattern were found"
- }
- };
- function containsIgnoredPathSegment(absolutePath, cwd, ignoredDirectories) {
- return path.relative(cwd, absolutePath).split(path.sep).some((dir) => ignoredDirectories.includes(dir));
- }
- function sortPaths(paths) {
- return paths.sort((a, b) => a.localeCompare(b));
- }
- function escapePathForGlob(path2) {
- return fastGlob.escapePath(path2.replace(/\\/g, "\0")).replace(/\\!/g, "@(!)").replace(/\0/g, "@(\\\\)");
- }
- var isWindows = path.sep === "\\";
- function fixWindowsSlashes(pattern) {
- return isWindows ? pattern.replace(/\\/g, "/") : pattern;
- }
- module2.exports = {
- expandPatterns,
- fixWindowsSlashes
- };
- }
- });
- var require_get_options_for_file = __commonJS2({
- "src/cli/options/get-options-for-file.js"(exports2, module2) {
- "use strict";
- var dashify = require_dashify();
- var prettier2 = require("./index.js");
- var {
- optionsNormalizer
- } = require_prettier_internal();
- var minimist = require_minimist2();
- var createMinimistOptions = require_create_minimist_options();
- var normalizeCliOptions = require_normalize_cli_options();
- function getOptions(argv, detailedOptions) {
- return Object.fromEntries(detailedOptions.filter(({
- forwardToApi
- }) => forwardToApi).map(({
- forwardToApi,
- name
- }) => [forwardToApi, argv[name]]));
- }
- function cliifyOptions(object, apiDetailedOptionMap) {
- return Object.fromEntries(Object.entries(object || {}).map(([key, value]) => {
- const apiOption = apiDetailedOptionMap[key];
- const cliKey = apiOption ? apiOption.name : key;
- return [dashify(cliKey), value];
- }));
- }
- function createApiDetailedOptionMap(detailedOptions) {
- return Object.fromEntries(detailedOptions.filter((option) => option.forwardToApi && option.forwardToApi !== option.name).map((option) => [option.forwardToApi, option]));
- }
- function parseArgsToOptions(context, overrideDefaults) {
- const minimistOptions = createMinimistOptions(context.detailedOptions);
- const apiDetailedOptionMap = createApiDetailedOptionMap(context.detailedOptions);
- return getOptions(normalizeCliOptions(minimist(context.rawArguments, {
- string: minimistOptions.string,
- boolean: minimistOptions.boolean,
- default: cliifyOptions(overrideDefaults, apiDetailedOptionMap)
- }), context.detailedOptions, {
- logger: false
- }), context.detailedOptions);
- }
- async function getOptionsOrDie(context, filePath) {
- try {
- if (context.argv.config === false) {
- context.logger.debug("'--no-config' option found, skip loading config file.");
- return null;
- }
- context.logger.debug(context.argv.config ? `load config file from '${context.argv.config}'` : `resolve config from '${filePath}'`);
- const options = await prettier2.resolveConfig(filePath, {
- editorconfig: context.argv.editorconfig,
- config: context.argv.config
- });
- context.logger.debug("loaded options `" + JSON.stringify(options) + "`");
- return options;
- } catch (error) {
- context.logger.error(`Invalid configuration file \`${filePath}\`: ` + error.message);
- process.exit(2);
- }
- }
- function applyConfigPrecedence(context, options) {
- try {
- switch (context.argv.configPrecedence) {
- case "cli-override":
- return parseArgsToOptions(context, options);
- case "file-override":
- return Object.assign(Object.assign({}, parseArgsToOptions(context)), options);
- case "prefer-file":
- return options || parseArgsToOptions(context);
- }
- } catch (error) {
- context.logger.error(error.toString());
- process.exit(2);
- }
- }
- async function getOptionsForFile(context, filepath) {
- const options = await getOptionsOrDie(context, filepath);
- const hasPlugins = options && options.plugins;
- if (hasPlugins) {
- context.pushContextPlugins(options.plugins);
- }
- const appliedOptions = Object.assign({
- filepath
- }, applyConfigPrecedence(context, options && optionsNormalizer.normalizeApiOptions(options, context.supportOptions, {
- logger: context.logger
- })));
- context.logger.debug(`applied config-precedence (${context.argv.configPrecedence}): ${JSON.stringify(appliedOptions)}`);
- if (hasPlugins) {
- context.popContextPlugins();
- }
- return appliedOptions;
- }
- module2.exports = getOptionsForFile;
- }
- });
- var require_is_tty = __commonJS2({
- "src/cli/is-tty.js"(exports2, module2) {
- "use strict";
- var {
- isCI
- } = require("./third-party.js");
- module2.exports = function isTTY() {
- return process.stdout.isTTY && !isCI();
- };
- }
- });
- var require_commondir = __commonJS2({
- "node_modules/commondir/index.js"(exports2, module2) {
- var path = require("path");
- module2.exports = function(basedir, relfiles) {
- if (relfiles) {
- var files = relfiles.map(function(r) {
- return path.resolve(basedir, r);
- });
- } else {
- var files = basedir;
- }
- var res = files.slice(1).reduce(function(ps, file) {
- if (!file.match(/^([A-Za-z]:)?\/|\\/)) {
- throw new Error("relative path without a basedir");
- }
- var xs = file.split(/\/+|\\+/);
- for (var i = 0; ps[i] === xs[i] && i < Math.min(ps.length, xs.length); i++)
- ;
- return ps.slice(0, i);
- }, files[0].split(/\/+|\\+/));
- return res.length > 1 ? res.join("/") : "/";
- };
- }
- });
- var require_p_try = __commonJS2({
- "node_modules/pkg-dir/node_modules/p-try/index.js"(exports2, module2) {
- "use strict";
- var pTry = (fn, ...arguments_) => new Promise((resolve) => {
- resolve(fn(...arguments_));
- });
- module2.exports = pTry;
- module2.exports.default = pTry;
- }
- });
- var require_p_limit = __commonJS2({
- "node_modules/pkg-dir/node_modules/p-limit/index.js"(exports2, module2) {
- "use strict";
- var pTry = require_p_try();
- var pLimit = (concurrency) => {
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
- return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));
- }
- const queue = [];
- let activeCount = 0;
- const next = () => {
- activeCount--;
- if (queue.length > 0) {
- queue.shift()();
- }
- };
- const run2 = (fn, resolve, ...args) => {
- activeCount++;
- const result = pTry(fn, ...args);
- resolve(result);
- result.then(next, next);
- };
- const enqueue = (fn, resolve, ...args) => {
- if (activeCount < concurrency) {
- run2(fn, resolve, ...args);
- } else {
- queue.push(run2.bind(null, fn, resolve, ...args));
- }
- };
- const generator = (fn, ...args) => new Promise((resolve) => enqueue(fn, resolve, ...args));
- Object.defineProperties(generator, {
- activeCount: {
- get: () => activeCount
- },
- pendingCount: {
- get: () => queue.length
- },
- clearQueue: {
- value: () => {
- queue.length = 0;
- }
- }
- });
- return generator;
- };
- module2.exports = pLimit;
- module2.exports.default = pLimit;
- }
- });
- var require_p_locate = __commonJS2({
- "node_modules/pkg-dir/node_modules/p-locate/index.js"(exports2, module2) {
- "use strict";
- var pLimit = require_p_limit();
- var EndError = class extends Error {
- constructor(value) {
- super();
- this.value = value;
- }
- };
- var testElement = async (element, tester) => tester(await element);
- var finder = async (element) => {
- const values = await Promise.all(element);
- if (values[1] === true) {
- throw new EndError(values[0]);
- }
- return false;
- };
- var pLocate = async (iterable, tester, options) => {
- options = Object.assign({
- concurrency: Infinity,
- preserveOrder: true
- }, options);
- const limit = pLimit(options.concurrency);
- const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
- const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
- try {
- await Promise.all(items.map((element) => checkLimit(finder, element)));
- } catch (error) {
- if (error instanceof EndError) {
- return error.value;
- }
- throw error;
- }
- };
- module2.exports = pLocate;
- module2.exports.default = pLocate;
- }
- });
- var require_locate_path = __commonJS2({
- "node_modules/pkg-dir/node_modules/locate-path/index.js"(exports2, module2) {
- "use strict";
- var path = require("path");
- var fs = require("fs");
- var {
- promisify
- } = require("util");
- var pLocate = require_p_locate();
- var fsStat = promisify(fs.stat);
- var fsLStat = promisify(fs.lstat);
- var typeMappings = {
- directory: "isDirectory",
- file: "isFile"
- };
- function checkType({
- type
- }) {
- if (type in typeMappings) {
- return;
- }
- throw new Error(`Invalid type specified: ${type}`);
- }
- var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
- module2.exports = async (paths, options) => {
- options = Object.assign({
- cwd: process.cwd(),
- type: "file",
- allowSymlinks: true
- }, options);
- checkType(options);
- const statFn = options.allowSymlinks ? fsStat : fsLStat;
- return pLocate(paths, async (path_) => {
- try {
- const stat = await statFn(path.resolve(options.cwd, path_));
- return matchType(options.type, stat);
- } catch (_) {
- return false;
- }
- }, options);
- };
- module2.exports.sync = (paths, options) => {
- options = Object.assign({
- cwd: process.cwd(),
- allowSymlinks: true,
- type: "file"
- }, options);
- checkType(options);
- const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
- for (const path_ of paths) {
- try {
- const stat = statFn(path.resolve(options.cwd, path_));
- if (matchType(options.type, stat)) {
- return path_;
- }
- } catch (_) {
- }
- }
- };
- }
- });
- var require_path_exists = __commonJS2({
- "node_modules/path-exists/index.js"(exports2, module2) {
- "use strict";
- var fs = require("fs");
- var {
- promisify
- } = require("util");
- var pAccess = promisify(fs.access);
- module2.exports = async (path) => {
- try {
- await pAccess(path);
- return true;
- } catch (_) {
- return false;
- }
- };
- module2.exports.sync = (path) => {
- try {
- fs.accessSync(path);
- return true;
- } catch (_) {
- return false;
- }
- };
- }
- });
- var require_find_up = __commonJS2({
- "node_modules/pkg-dir/node_modules/find-up/index.js"(exports2, module2) {
- "use strict";
- var path = require("path");
- var locatePath = require_locate_path();
- var pathExists = require_path_exists();
- var stop = Symbol("findUp.stop");
- module2.exports = async (name, options = {}) => {
- let directory = path.resolve(options.cwd || "");
- const {
- root
- } = path.parse(directory);
- const paths = [].concat(name);
- const runMatcher = async (locateOptions) => {
- if (typeof name !== "function") {
- return locatePath(paths, locateOptions);
- }
- const foundPath = await name(locateOptions.cwd);
- if (typeof foundPath === "string") {
- return locatePath([foundPath], locateOptions);
- }
- return foundPath;
- };
- while (true) {
- const foundPath = await runMatcher(Object.assign(Object.assign({}, options), {}, {
- cwd: directory
- }));
- if (foundPath === stop) {
- return;
- }
- if (foundPath) {
- return path.resolve(directory, foundPath);
- }
- if (directory === root) {
- return;
- }
- directory = path.dirname(directory);
- }
- };
- module2.exports.sync = (name, options = {}) => {
- let directory = path.resolve(options.cwd || "");
- const {
- root
- } = path.parse(directory);
- const paths = [].concat(name);
- const runMatcher = (locateOptions) => {
- if (typeof name !== "function") {
- return locatePath.sync(paths, locateOptions);
- }
- const foundPath = name(locateOptions.cwd);
- if (typeof foundPath === "string") {
- return locatePath.sync([foundPath], locateOptions);
- }
- return foundPath;
- };
- while (true) {
- const foundPath = runMatcher(Object.assign(Object.assign({}, options), {}, {
- cwd: directory
- }));
- if (foundPath === stop) {
- return;
- }
- if (foundPath) {
- return path.resolve(directory, foundPath);
- }
- if (directory === root) {
- return;
- }
- directory = path.dirname(directory);
- }
- };
- module2.exports.exists = pathExists;
- module2.exports.sync.exists = pathExists.sync;
- module2.exports.stop = stop;
- }
- });
- var require_pkg_dir = __commonJS2({
- "node_modules/pkg-dir/index.js"(exports2, module2) {
- "use strict";
- var path = require("path");
- var findUp = require_find_up();
- var pkgDir = async (cwd) => {
- const filePath = await findUp("package.json", {
- cwd
- });
- return filePath && path.dirname(filePath);
- };
- module2.exports = pkgDir;
- module2.exports.default = pkgDir;
- module2.exports.sync = (cwd) => {
- const filePath = findUp.sync("package.json", {
- cwd
- });
- return filePath && path.dirname(filePath);
- };
- }
- });
- var require_semver = __commonJS2({
- "node_modules/make-dir/node_modules/semver/semver.js"(exports2, module2) {
- exports2 = module2.exports = SemVer;
- var debug;
- if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
- debug = function() {
- var args = Array.prototype.slice.call(arguments, 0);
- args.unshift("SEMVER");
- console.log.apply(console, args);
- };
- } else {
- debug = function() {
- };
- }
- exports2.SEMVER_SPEC_VERSION = "2.0.0";
- var MAX_LENGTH = 256;
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
- var MAX_SAFE_COMPONENT_LENGTH = 16;
- var re = exports2.re = [];
- var src = exports2.src = [];
- var t = exports2.tokens = {};
- var R = 0;
- function tok(n) {
- t[n] = R++;
- }
- tok("NUMERICIDENTIFIER");
- src[t.NUMERICIDENTIFIER] = "0|[1-9]\\d*";
- tok("NUMERICIDENTIFIERLOOSE");
- src[t.NUMERICIDENTIFIERLOOSE] = "[0-9]+";
- tok("NONNUMERICIDENTIFIER");
- src[t.NONNUMERICIDENTIFIER] = "\\d*[a-zA-Z-][a-zA-Z0-9-]*";
- tok("MAINVERSION");
- src[t.MAINVERSION] = "(" + src[t.NUMERICIDENTIFIER] + ")\\.(" + src[t.NUMERICIDENTIFIER] + ")\\.(" + src[t.NUMERICIDENTIFIER] + ")";
- tok("MAINVERSIONLOOSE");
- src[t.MAINVERSIONLOOSE] = "(" + src[t.NUMERICIDENTIFIERLOOSE] + ")\\.(" + src[t.NUMERICIDENTIFIERLOOSE] + ")\\.(" + src[t.NUMERICIDENTIFIERLOOSE] + ")";
- tok("PRERELEASEIDENTIFIER");
- src[t.PRERELEASEIDENTIFIER] = "(?:" + src[t.NUMERICIDENTIFIER] + "|" + src[t.NONNUMERICIDENTIFIER] + ")";
- tok("PRERELEASEIDENTIFIERLOOSE");
- src[t.PRERELEASEIDENTIFIERLOOSE] = "(?:" + src[t.NUMERICIDENTIFIERLOOSE] + "|" + src[t.NONNUMERICIDENTIFIER] + ")";
- tok("PRERELEASE");
- src[t.PRERELEASE] = "(?:-(" + src[t.PRERELEASEIDENTIFIER] + "(?:\\." + src[t.PRERELEASEIDENTIFIER] + ")*))";
- tok("PRERELEASELOOSE");
- src[t.PRERELEASELOOSE] = "(?:-?(" + src[t.PRERELEASEIDENTIFIERLOOSE] + "(?:\\." + src[t.PRERELEASEIDENTIFIERLOOSE] + ")*))";
- tok("BUILDIDENTIFIER");
- src[t.BUILDIDENTIFIER] = "[0-9A-Za-z-]+";
- tok("BUILD");
- src[t.BUILD] = "(?:\\+(" + src[t.BUILDIDENTIFIER] + "(?:\\." + src[t.BUILDIDENTIFIER] + ")*))";
- tok("FULL");
- tok("FULLPLAIN");
- src[t.FULLPLAIN] = "v?" + src[t.MAINVERSION] + src[t.PRERELEASE] + "?" + src[t.BUILD] + "?";
- src[t.FULL] = "^" + src[t.FULLPLAIN] + "$";
- tok("LOOSEPLAIN");
- src[t.LOOSEPLAIN] = "[v=\\s]*" + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + "?" + src[t.BUILD] + "?";
- tok("LOOSE");
- src[t.LOOSE] = "^" + src[t.LOOSEPLAIN] + "$";
- tok("GTLT");
- src[t.GTLT] = "((?:<|>)?=?)";
- tok("XRANGEIDENTIFIERLOOSE");
- src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + "|x|X|\\*";
- tok("XRANGEIDENTIFIER");
- src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + "|x|X|\\*";
- tok("XRANGEPLAIN");
- src[t.XRANGEPLAIN] = "[v=\\s]*(" + src[t.XRANGEIDENTIFIER] + ")(?:\\.(" + src[t.XRANGEIDENTIFIER] + ")(?:\\.(" + src[t.XRANGEIDENTIFIER] + ")(?:" + src[t.PRERELEASE] + ")?" + src[t.BUILD] + "?)?)?";
- tok("XRANGEPLAINLOOSE");
- src[t.XRANGEPLAINLOOSE] = "[v=\\s]*(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:" + src[t.PRERELEASELOOSE] + ")?" + src[t.BUILD] + "?)?)?";
- tok("XRANGE");
- src[t.XRANGE] = "^" + src[t.GTLT] + "\\s*" + src[t.XRANGEPLAIN] + "$";
- tok("XRANGELOOSE");
- src[t.XRANGELOOSE] = "^" + src[t.GTLT] + "\\s*" + src[t.XRANGEPLAINLOOSE] + "$";
- tok("COERCE");
- src[t.COERCE] = "(^|[^\\d])(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "})(?:\\.(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "}))?(?:\\.(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "}))?(?:$|[^\\d])";
- tok("COERCERTL");
- re[t.COERCERTL] = new RegExp(src[t.COERCE], "g");
- tok("LONETILDE");
- src[t.LONETILDE] = "(?:~>?)";
- tok("TILDETRIM");
- src[t.TILDETRIM] = "(\\s*)" + src[t.LONETILDE] + "\\s+";
- re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], "g");
- var tildeTrimReplace = "$1~";
- tok("TILDE");
- src[t.TILDE] = "^" + src[t.LONETILDE] + src[t.XRANGEPLAIN] + "$";
- tok("TILDELOOSE");
- src[t.TILDELOOSE] = "^" + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + "$";
- tok("LONECARET");
- src[t.LONECARET] = "(?:\\^)";
- tok("CARETTRIM");
- src[t.CARETTRIM] = "(\\s*)" + src[t.LONECARET] + "\\s+";
- re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], "g");
- var caretTrimReplace = "$1^";
- tok("CARET");
- src[t.CARET] = "^" + src[t.LONECARET] + src[t.XRANGEPLAIN] + "$";
- tok("CARETLOOSE");
- src[t.CARETLOOSE] = "^" + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + "$";
- tok("COMPARATORLOOSE");
- src[t.COMPARATORLOOSE] = "^" + src[t.GTLT] + "\\s*(" + src[t.LOOSEPLAIN] + ")$|^$";
- tok("COMPARATOR");
- src[t.COMPARATOR] = "^" + src[t.GTLT] + "\\s*(" + src[t.FULLPLAIN] + ")$|^$";
- tok("COMPARATORTRIM");
- src[t.COMPARATORTRIM] = "(\\s*)" + src[t.GTLT] + "\\s*(" + src[t.LOOSEPLAIN] + "|" + src[t.XRANGEPLAIN] + ")";
- re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], "g");
- var comparatorTrimReplace = "$1$2$3";
- tok("HYPHENRANGE");
- src[t.HYPHENRANGE] = "^\\s*(" + src[t.XRANGEPLAIN] + ")\\s+-\\s+(" + src[t.XRANGEPLAIN] + ")\\s*$";
- tok("HYPHENRANGELOOSE");
- src[t.HYPHENRANGELOOSE] = "^\\s*(" + src[t.XRANGEPLAINLOOSE] + ")\\s+-\\s+(" + src[t.XRANGEPLAINLOOSE] + ")\\s*$";
- tok("STAR");
- src[t.STAR] = "(<|>)?=?\\s*\\*";
- for (i = 0; i < R; i++) {
- debug(i, src[i]);
- if (!re[i]) {
- re[i] = new RegExp(src[i]);
- }
- }
- var i;
- exports2.parse = parse;
- function parse(version, options) {
- if (!options || typeof options !== "object") {
- options = {
- loose: !!options,
- includePrerelease: false
- };
- }
- if (version instanceof SemVer) {
- return version;
- }
- if (typeof version !== "string") {
- return null;
- }
- if (version.length > MAX_LENGTH) {
- return null;
- }
- var r = options.loose ? re[t.LOOSE] : re[t.FULL];
- if (!r.test(version)) {
- return null;
- }
- try {
- return new SemVer(version, options);
- } catch (er) {
- return null;
- }
- }
- exports2.valid = valid;
- function valid(version, options) {
- var v = parse(version, options);
- return v ? v.version : null;
- }
- exports2.clean = clean;
- function clean(version, options) {
- var s = parse(version.trim().replace(/^[=v]+/, ""), options);
- return s ? s.version : null;
- }
- exports2.SemVer = SemVer;
- function SemVer(version, options) {
- if (!options || typeof options !== "object") {
- options = {
- loose: !!options,
- includePrerelease: false
- };
- }
- if (version instanceof SemVer) {
- if (version.loose === options.loose) {
- return version;
- } else {
- version = version.version;
- }
- } else if (typeof version !== "string") {
- throw new TypeError("Invalid Version: " + version);
- }
- if (version.length > MAX_LENGTH) {
- throw new TypeError("version is longer than " + MAX_LENGTH + " characters");
- }
- if (!(this instanceof SemVer)) {
- return new SemVer(version, options);
- }
- debug("SemVer", version, options);
- this.options = options;
- this.loose = !!options.loose;
- var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
- if (!m) {
- throw new TypeError("Invalid Version: " + version);
- }
- this.raw = version;
- this.major = +m[1];
- this.minor = +m[2];
- this.patch = +m[3];
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
- throw new TypeError("Invalid major version");
- }
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
- throw new TypeError("Invalid minor version");
- }
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
- throw new TypeError("Invalid patch version");
- }
- if (!m[4]) {
- this.prerelease = [];
- } else {
- this.prerelease = m[4].split(".").map(function(id) {
- if (/^[0-9]+$/.test(id)) {
- var num = +id;
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
- return num;
- }
- }
- return id;
- });
- }
- this.build = m[5] ? m[5].split(".") : [];
- this.format();
- }
- SemVer.prototype.format = function() {
- this.version = this.major + "." + this.minor + "." + this.patch;
- if (this.prerelease.length) {
- this.version += "-" + this.prerelease.join(".");
- }
- return this.version;
- };
- SemVer.prototype.toString = function() {
- return this.version;
- };
- SemVer.prototype.compare = function(other) {
- debug("SemVer.compare", this.version, this.options, other);
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options);
- }
- return this.compareMain(other) || this.comparePre(other);
- };
- SemVer.prototype.compareMain = function(other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options);
- }
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
- };
- SemVer.prototype.comparePre = function(other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options);
- }
- if (this.prerelease.length && !other.prerelease.length) {
- return -1;
- } else if (!this.prerelease.length && other.prerelease.length) {
- return 1;
- } else if (!this.prerelease.length && !other.prerelease.length) {
- return 0;
- }
- var i2 = 0;
- do {
- var a = this.prerelease[i2];
- var b = other.prerelease[i2];
- debug("prerelease compare", i2, a, b);
- if (a === void 0 && b === void 0) {
- return 0;
- } else if (b === void 0) {
- return 1;
- } else if (a === void 0) {
- return -1;
- } else if (a === b) {
- continue;
- } else {
- return compareIdentifiers(a, b);
- }
- } while (++i2);
- };
- SemVer.prototype.compareBuild = function(other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options);
- }
- var i2 = 0;
- do {
- var a = this.build[i2];
- var b = other.build[i2];
- debug("prerelease compare", i2, a, b);
- if (a === void 0 && b === void 0) {
- return 0;
- } else if (b === void 0) {
- return 1;
- } else if (a === void 0) {
- return -1;
- } else if (a === b) {
- continue;
- } else {
- return compareIdentifiers(a, b);
- }
- } while (++i2);
- };
- SemVer.prototype.inc = function(release, identifier) {
- switch (release) {
- case "premajor":
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor = 0;
- this.major++;
- this.inc("pre", identifier);
- break;
- case "preminor":
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor++;
- this.inc("pre", identifier);
- break;
- case "prepatch":
- this.prerelease.length = 0;
- this.inc("patch", identifier);
- this.inc("pre", identifier);
- break;
- case "prerelease":
- if (this.prerelease.length === 0) {
- this.inc("patch", identifier);
- }
- this.inc("pre", identifier);
- break;
- case "major":
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
- this.major++;
- }
- this.minor = 0;
- this.patch = 0;
- this.prerelease = [];
- break;
- case "minor":
- if (this.patch !== 0 || this.prerelease.length === 0) {
- this.minor++;
- }
- this.patch = 0;
- this.prerelease = [];
- break;
- case "patch":
- if (this.prerelease.length === 0) {
- this.patch++;
- }
- this.prerelease = [];
- break;
- case "pre":
- if (this.prerelease.length === 0) {
- this.prerelease = [0];
- } else {
- var i2 = this.prerelease.length;
- while (--i2 >= 0) {
- if (typeof this.prerelease[i2] === "number") {
- this.prerelease[i2]++;
- i2 = -2;
- }
- }
- if (i2 === -1) {
- this.prerelease.push(0);
- }
- }
- if (identifier) {
- if (this.prerelease[0] === identifier) {
- if (isNaN(this.prerelease[1])) {
- this.prerelease = [identifier, 0];
- }
- } else {
- this.prerelease = [identifier, 0];
- }
- }
- break;
- default:
- throw new Error("invalid increment argument: " + release);
- }
- this.format();
- this.raw = this.version;
- return this;
- };
- exports2.inc = inc;
- function inc(version, release, loose, identifier) {
- if (typeof loose === "string") {
- identifier = loose;
- loose = void 0;
- }
- try {
- return new SemVer(version, loose).inc(release, identifier).version;
- } catch (er) {
- return null;
- }
- }
- exports2.diff = diff;
- function diff(version1, version2) {
- if (eq(version1, version2)) {
- return null;
- } else {
- var v1 = parse(version1);
- var v2 = parse(version2);
- var prefix = "";
- if (v1.prerelease.length || v2.prerelease.length) {
- prefix = "pre";
- var defaultResult = "prerelease";
- }
- for (var key in v1) {
- if (key === "major" || key === "minor" || key === "patch") {
- if (v1[key] !== v2[key]) {
- return prefix + key;
- }
- }
- }
- return defaultResult;
- }
- }
- exports2.compareIdentifiers = compareIdentifiers;
- var numeric = /^[0-9]+$/;
- function compareIdentifiers(a, b) {
- var anum = numeric.test(a);
- var bnum = numeric.test(b);
- if (anum && bnum) {
- a = +a;
- b = +b;
- }
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
- }
- exports2.rcompareIdentifiers = rcompareIdentifiers;
- function rcompareIdentifiers(a, b) {
- return compareIdentifiers(b, a);
- }
- exports2.major = major;
- function major(a, loose) {
- return new SemVer(a, loose).major;
- }
- exports2.minor = minor;
- function minor(a, loose) {
- return new SemVer(a, loose).minor;
- }
- exports2.patch = patch;
- function patch(a, loose) {
- return new SemVer(a, loose).patch;
- }
- exports2.compare = compare;
- function compare(a, b, loose) {
- return new SemVer(a, loose).compare(new SemVer(b, loose));
- }
- exports2.compareLoose = compareLoose;
- function compareLoose(a, b) {
- return compare(a, b, true);
- }
- exports2.compareBuild = compareBuild;
- function compareBuild(a, b, loose) {
- var versionA = new SemVer(a, loose);
- var versionB = new SemVer(b, loose);
- return versionA.compare(versionB) || versionA.compareBuild(versionB);
- }
- exports2.rcompare = rcompare;
- function rcompare(a, b, loose) {
- return compare(b, a, loose);
- }
- exports2.sort = sort;
- function sort(list, loose) {
- return list.sort(function(a, b) {
- return exports2.compareBuild(a, b, loose);
- });
- }
- exports2.rsort = rsort;
- function rsort(list, loose) {
- return list.sort(function(a, b) {
- return exports2.compareBuild(b, a, loose);
- });
- }
- exports2.gt = gt;
- function gt(a, b, loose) {
- return compare(a, b, loose) > 0;
- }
- exports2.lt = lt;
- function lt(a, b, loose) {
- return compare(a, b, loose) < 0;
- }
- exports2.eq = eq;
- function eq(a, b, loose) {
- return compare(a, b, loose) === 0;
- }
- exports2.neq = neq;
- function neq(a, b, loose) {
- return compare(a, b, loose) !== 0;
- }
- exports2.gte = gte;
- function gte(a, b, loose) {
- return compare(a, b, loose) >= 0;
- }
- exports2.lte = lte;
- function lte(a, b, loose) {
- return compare(a, b, loose) <= 0;
- }
- exports2.cmp = cmp;
- function cmp(a, op, b, loose) {
- switch (op) {
- case "===":
- if (typeof a === "object")
- a = a.version;
- if (typeof b === "object")
- b = b.version;
- return a === b;
- case "!==":
- if (typeof a === "object")
- a = a.version;
- if (typeof b === "object")
- b = b.version;
- return a !== b;
- case "":
- case "=":
- case "==":
- return eq(a, b, loose);
- case "!=":
- return neq(a, b, loose);
- case ">":
- return gt(a, b, loose);
- case ">=":
- return gte(a, b, loose);
- case "<":
- return lt(a, b, loose);
- case "<=":
- return lte(a, b, loose);
- default:
- throw new TypeError("Invalid operator: " + op);
- }
- }
- exports2.Comparator = Comparator;
- function Comparator(comp, options) {
- if (!options || typeof options !== "object") {
- options = {
- loose: !!options,
- includePrerelease: false
- };
- }
- if (comp instanceof Comparator) {
- if (comp.loose === !!options.loose) {
- return comp;
- } else {
- comp = comp.value;
- }
- }
- if (!(this instanceof Comparator)) {
- return new Comparator(comp, options);
- }
- debug("comparator", comp, options);
- this.options = options;
- this.loose = !!options.loose;
- this.parse(comp);
- if (this.semver === ANY) {
- this.value = "";
- } else {
- this.value = this.operator + this.semver.version;
- }
- debug("comp", this);
- }
- var ANY = {};
- Comparator.prototype.parse = function(comp) {
- var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
- var m = comp.match(r);
- if (!m) {
- throw new TypeError("Invalid comparator: " + comp);
- }
- this.operator = m[1] !== void 0 ? m[1] : "";
- if (this.operator === "=") {
- this.operator = "";
- }
- if (!m[2]) {
- this.semver = ANY;
- } else {
- this.semver = new SemVer(m[2], this.options.loose);
- }
- };
- Comparator.prototype.toString = function() {
- return this.value;
- };
- Comparator.prototype.test = function(version) {
- debug("Comparator.test", version, this.options.loose);
- if (this.semver === ANY || version === ANY) {
- return true;
- }
- if (typeof version === "string") {
- try {
- version = new SemVer(version, this.options);
- } catch (er) {
- return false;
- }
- }
- return cmp(version, this.operator, this.semver, this.options);
- };
- Comparator.prototype.intersects = function(comp, options) {
- if (!(comp instanceof Comparator)) {
- throw new TypeError("a Comparator is required");
- }
- if (!options || typeof options !== "object") {
- options = {
- loose: !!options,
- includePrerelease: false
- };
- }
- var rangeTmp;
- if (this.operator === "") {
- if (this.value === "") {
- return true;
- }
- rangeTmp = new Range(comp.value, options);
- return satisfies(this.value, rangeTmp, options);
- } else if (comp.operator === "") {
- if (comp.value === "") {
- return true;
- }
- rangeTmp = new Range(this.value, options);
- return satisfies(comp.semver, rangeTmp, options);
- }
- var sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">");
- var sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<");
- var sameSemVer = this.semver.version === comp.semver.version;
- var differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<=");
- var oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && (this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<");
- var oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && (this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">");
- return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
- };
- exports2.Range = Range;
- function Range(range, options) {
- if (!options || typeof options !== "object") {
- options = {
- loose: !!options,
- includePrerelease: false
- };
- }
- if (range instanceof Range) {
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
- return range;
- } else {
- return new Range(range.raw, options);
- }
- }
- if (range instanceof Comparator) {
- return new Range(range.value, options);
- }
- if (!(this instanceof Range)) {
- return new Range(range, options);
- }
- this.options = options;
- this.loose = !!options.loose;
- this.includePrerelease = !!options.includePrerelease;
- this.raw = range;
- this.set = range.split(/\s*\|\|\s*/).map(function(range2) {
- return this.parseRange(range2.trim());
- }, this).filter(function(c) {
- return c.length;
- });
- if (!this.set.length) {
- throw new TypeError("Invalid SemVer Range: " + range);
- }
- this.format();
- }
- Range.prototype.format = function() {
- this.range = this.set.map(function(comps) {
- return comps.join(" ").trim();
- }).join("||").trim();
- return this.range;
- };
- Range.prototype.toString = function() {
- return this.range;
- };
- Range.prototype.parseRange = function(range) {
- var loose = this.options.loose;
- range = range.trim();
- var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
- range = range.replace(hr, hyphenReplace);
- debug("hyphen replace", range);
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
- debug("comparator trim", range, re[t.COMPARATORTRIM]);
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
- range = range.split(/\s+/).join(" ");
- var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
- var set = range.split(" ").map(function(comp) {
- return parseComparator(comp, this.options);
- }, this).join(" ").split(/\s+/);
- if (this.options.loose) {
- set = set.filter(function(comp) {
- return !!comp.match(compRe);
- });
- }
- set = set.map(function(comp) {
- return new Comparator(comp, this.options);
- }, this);
- return set;
- };
- Range.prototype.intersects = function(range, options) {
- if (!(range instanceof Range)) {
- throw new TypeError("a Range is required");
- }
- return this.set.some(function(thisComparators) {
- return isSatisfiable(thisComparators, options) && range.set.some(function(rangeComparators) {
- return isSatisfiable(rangeComparators, options) && thisComparators.every(function(thisComparator) {
- return rangeComparators.every(function(rangeComparator) {
- return thisComparator.intersects(rangeComparator, options);
- });
- });
- });
- });
- };
- function isSatisfiable(comparators, options) {
- var result = true;
- var remainingComparators = comparators.slice();
- var testComparator = remainingComparators.pop();
- while (result && remainingComparators.length) {
- result = remainingComparators.every(function(otherComparator) {
- return testComparator.intersects(otherComparator, options);
- });
- testComparator = remainingComparators.pop();
- }
- return result;
- }
- exports2.toComparators = toComparators;
- function toComparators(range, options) {
- return new Range(range, options).set.map(function(comp) {
- return comp.map(function(c) {
- return c.value;
- }).join(" ").trim().split(" ");
- });
- }
- function parseComparator(comp, options) {
- debug("comp", comp, options);
- comp = replaceCarets(comp, options);
- debug("caret", comp);
- comp = replaceTildes(comp, options);
- debug("tildes", comp);
- comp = replaceXRanges(comp, options);
- debug("xrange", comp);
- comp = replaceStars(comp, options);
- debug("stars", comp);
- return comp;
- }
- function isX(id) {
- return !id || id.toLowerCase() === "x" || id === "*";
- }
- function replaceTildes(comp, options) {
- return comp.trim().split(/\s+/).map(function(comp2) {
- return replaceTilde(comp2, options);
- }).join(" ");
- }
- function replaceTilde(comp, options) {
- var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
- return comp.replace(r, function(_, M, m, p, pr) {
- debug("tilde", comp, _, M, m, p, pr);
- var ret;
- if (isX(M)) {
- ret = "";
- } else if (isX(m)) {
- ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
- } else if (isX(p)) {
- ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
- } else if (pr) {
- debug("replaceTilde pr", pr);
- ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
- } else {
- ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
- }
- debug("tilde return", ret);
- return ret;
- });
- }
- function replaceCarets(comp, options) {
- return comp.trim().split(/\s+/).map(function(comp2) {
- return replaceCaret(comp2, options);
- }).join(" ");
- }
- function replaceCaret(comp, options) {
- debug("caret", comp, options);
- var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
- return comp.replace(r, function(_, M, m, p, pr) {
- debug("caret", comp, _, M, m, p, pr);
- var ret;
- if (isX(M)) {
- ret = "";
- } else if (isX(m)) {
- ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
- } else if (isX(p)) {
- if (M === "0") {
- ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
- } else {
- ret = ">=" + M + "." + m + ".0 <" + (+M + 1) + ".0.0";
- }
- } else if (pr) {
- debug("replaceCaret pr", pr);
- if (M === "0") {
- if (m === "0") {
- ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + m + "." + (+p + 1);
- } else {
- ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
- }
- } else {
- ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + (+M + 1) + ".0.0";
- }
- } else {
- debug("no pr");
- if (M === "0") {
- if (m === "0") {
- ret = ">=" + M + "." + m + "." + p + " <" + M + "." + m + "." + (+p + 1);
- } else {
- ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
- }
- } else {
- ret = ">=" + M + "." + m + "." + p + " <" + (+M + 1) + ".0.0";
- }
- }
- debug("caret return", ret);
- return ret;
- });
- }
- function replaceXRanges(comp, options) {
- debug("replaceXRanges", comp, options);
- return comp.split(/\s+/).map(function(comp2) {
- return replaceXRange(comp2, options);
- }).join(" ");
- }
- function replaceXRange(comp, options) {
- comp = comp.trim();
- var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
- return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
- debug("xRange", comp, ret, gtlt, M, m, p, pr);
- var xM = isX(M);
- var xm = xM || isX(m);
- var xp = xm || isX(p);
- var anyX = xp;
- if (gtlt === "=" && anyX) {
- gtlt = "";
- }
- pr = options.includePrerelease ? "-0" : "";
- if (xM) {
- if (gtlt === ">" || gtlt === "<") {
- ret = "<0.0.0-0";
- } else {
- ret = "*";
- }
- } else if (gtlt && anyX) {
- if (xm) {
- m = 0;
- }
- p = 0;
- if (gtlt === ">") {
- gtlt = ">=";
- if (xm) {
- M = +M + 1;
- m = 0;
- p = 0;
- } else {
- m = +m + 1;
- p = 0;
- }
- } else if (gtlt === "<=") {
- gtlt = "<";
- if (xm) {
- M = +M + 1;
- } else {
- m = +m + 1;
- }
- }
- ret = gtlt + M + "." + m + "." + p + pr;
- } else if (xm) {
- ret = ">=" + M + ".0.0" + pr + " <" + (+M + 1) + ".0.0" + pr;
- } else if (xp) {
- ret = ">=" + M + "." + m + ".0" + pr + " <" + M + "." + (+m + 1) + ".0" + pr;
- }
- debug("xRange return", ret);
- return ret;
- });
- }
- function replaceStars(comp, options) {
- debug("replaceStars", comp, options);
- return comp.trim().replace(re[t.STAR], "");
- }
- function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
- if (isX(fM)) {
- from = "";
- } else if (isX(fm)) {
- from = ">=" + fM + ".0.0";
- } else if (isX(fp)) {
- from = ">=" + fM + "." + fm + ".0";
- } else {
- from = ">=" + from;
- }
- if (isX(tM)) {
- to = "";
- } else if (isX(tm)) {
- to = "<" + (+tM + 1) + ".0.0";
- } else if (isX(tp)) {
- to = "<" + tM + "." + (+tm + 1) + ".0";
- } else if (tpr) {
- to = "<=" + tM + "." + tm + "." + tp + "-" + tpr;
- } else {
- to = "<=" + to;
- }
- return (from + " " + to).trim();
- }
- Range.prototype.test = function(version) {
- if (!version) {
- return false;
- }
- if (typeof version === "string") {
- try {
- version = new SemVer(version, this.options);
- } catch (er) {
- return false;
- }
- }
- for (var i2 = 0; i2 < this.set.length; i2++) {
- if (testSet(this.set[i2], version, this.options)) {
- return true;
- }
- }
- return false;
- };
- function testSet(set, version, options) {
- for (var i2 = 0; i2 < set.length; i2++) {
- if (!set[i2].test(version)) {
- return false;
- }
- }
- if (version.prerelease.length && !options.includePrerelease) {
- for (i2 = 0; i2 < set.length; i2++) {
- debug(set[i2].semver);
- if (set[i2].semver === ANY) {
- continue;
- }
- if (set[i2].semver.prerelease.length > 0) {
- var allowed = set[i2].semver;
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
- return true;
- }
- }
- }
- return false;
- }
- return true;
- }
- exports2.satisfies = satisfies;
- function satisfies(version, range, options) {
- try {
- range = new Range(range, options);
- } catch (er) {
- return false;
- }
- return range.test(version);
- }
- exports2.maxSatisfying = maxSatisfying;
- function maxSatisfying(versions, range, options) {
- var max = null;
- var maxSV = null;
- try {
- var rangeObj = new Range(range, options);
- } catch (er) {
- return null;
- }
- versions.forEach(function(v) {
- if (rangeObj.test(v)) {
- if (!max || maxSV.compare(v) === -1) {
- max = v;
- maxSV = new SemVer(max, options);
- }
- }
- });
- return max;
- }
- exports2.minSatisfying = minSatisfying;
- function minSatisfying(versions, range, options) {
- var min = null;
- var minSV = null;
- try {
- var rangeObj = new Range(range, options);
- } catch (er) {
- return null;
- }
- versions.forEach(function(v) {
- if (rangeObj.test(v)) {
- if (!min || minSV.compare(v) === 1) {
- min = v;
- minSV = new SemVer(min, options);
- }
- }
- });
- return min;
- }
- exports2.minVersion = minVersion;
- function minVersion(range, loose) {
- range = new Range(range, loose);
- var minver = new SemVer("0.0.0");
- if (range.test(minver)) {
- return minver;
- }
- minver = new SemVer("0.0.0-0");
- if (range.test(minver)) {
- return minver;
- }
- minver = null;
- for (var i2 = 0; i2 < range.set.length; ++i2) {
- var comparators = range.set[i2];
- comparators.forEach(function(comparator) {
- var compver = new SemVer(comparator.semver.version);
- switch (comparator.operator) {
- case ">":
- if (compver.prerelease.length === 0) {
- compver.patch++;
- } else {
- compver.prerelease.push(0);
- }
- compver.raw = compver.format();
- case "":
- case ">=":
- if (!minver || gt(minver, compver)) {
- minver = compver;
- }
- break;
- case "<":
- case "<=":
- break;
- default:
- throw new Error("Unexpected operation: " + comparator.operator);
- }
- });
- }
- if (minver && range.test(minver)) {
- return minver;
- }
- return null;
- }
- exports2.validRange = validRange;
- function validRange(range, options) {
- try {
- return new Range(range, options).range || "*";
- } catch (er) {
- return null;
- }
- }
- exports2.ltr = ltr;
- function ltr(version, range, options) {
- return outside(version, range, "<", options);
- }
- exports2.gtr = gtr;
- function gtr(version, range, options) {
- return outside(version, range, ">", options);
- }
- exports2.outside = outside;
- function outside(version, range, hilo, options) {
- version = new SemVer(version, options);
- range = new Range(range, options);
- var gtfn, ltefn, ltfn, comp, ecomp;
- switch (hilo) {
- case ">":
- gtfn = gt;
- ltefn = lte;
- ltfn = lt;
- comp = ">";
- ecomp = ">=";
- break;
- case "<":
- gtfn = lt;
- ltefn = gte;
- ltfn = gt;
- comp = "<";
- ecomp = "<=";
- break;
- default:
- throw new TypeError('Must provide a hilo val of "<" or ">"');
- }
- if (satisfies(version, range, options)) {
- return false;
- }
- for (var i2 = 0; i2 < range.set.length; ++i2) {
- var comparators = range.set[i2];
- var high = null;
- var low = null;
- comparators.forEach(function(comparator) {
- if (comparator.semver === ANY) {
- comparator = new Comparator(">=0.0.0");
- }
- high = high || comparator;
- low = low || comparator;
- if (gtfn(comparator.semver, high.semver, options)) {
- high = comparator;
- } else if (ltfn(comparator.semver, low.semver, options)) {
- low = comparator;
- }
- });
- if (high.operator === comp || high.operator === ecomp) {
- return false;
- }
- if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
- return false;
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
- return false;
- }
- }
- return true;
- }
- exports2.prerelease = prerelease;
- function prerelease(version, options) {
- var parsed = parse(version, options);
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
- }
- exports2.intersects = intersects;
- function intersects(r1, r2, options) {
- r1 = new Range(r1, options);
- r2 = new Range(r2, options);
- return r1.intersects(r2);
- }
- exports2.coerce = coerce;
- function coerce(version, options) {
- if (version instanceof SemVer) {
- return version;
- }
- if (typeof version === "number") {
- version = String(version);
- }
- if (typeof version !== "string") {
- return null;
- }
- options = options || {};
- var match = null;
- if (!options.rtl) {
- match = version.match(re[t.COERCE]);
- } else {
- var next;
- while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
- if (!match || next.index + next[0].length !== match.index + match[0].length) {
- match = next;
- }
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
- }
- re[t.COERCERTL].lastIndex = -1;
- }
- if (match === null) {
- return null;
- }
- return parse(match[2] + "." + (match[3] || "0") + "." + (match[4] || "0"), options);
- }
- }
- });
- var require_make_dir = __commonJS2({
- "node_modules/make-dir/index.js"(exports2, module2) {
- "use strict";
- var fs = require("fs");
- var path = require("path");
- var {
- promisify
- } = require("util");
- var semver = require_semver();
- var useNativeRecursiveOption = semver.satisfies(process.version, ">=10.12.0");
- var checkPath = (pth) => {
- if (process.platform === "win32") {
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
- if (pathHasInvalidWinCharacters) {
- const error = new Error(`Path contains invalid characters: ${pth}`);
- error.code = "EINVAL";
- throw error;
- }
- }
- };
- var processOptions = (options) => {
- const defaults = {
- mode: 511,
- fs
- };
- return Object.assign(Object.assign({}, defaults), options);
- };
- var permissionError = (pth) => {
- const error = new Error(`operation not permitted, mkdir '${pth}'`);
- error.code = "EPERM";
- error.errno = -4048;
- error.path = pth;
- error.syscall = "mkdir";
- return error;
- };
- var makeDir = async (input, options) => {
- checkPath(input);
- options = processOptions(options);
- const mkdir = promisify(options.fs.mkdir);
- const stat = promisify(options.fs.stat);
- if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) {
- const pth = path.resolve(input);
- await mkdir(pth, {
- mode: options.mode,
- recursive: true
- });
- return pth;
- }
- const make = async (pth) => {
- try {
- await mkdir(pth, options.mode);
- return pth;
- } catch (error) {
- if (error.code === "EPERM") {
- throw error;
- }
- if (error.code === "ENOENT") {
- if (path.dirname(pth) === pth) {
- throw permissionError(pth);
- }
- if (error.message.includes("null bytes")) {
- throw error;
- }
- await make(path.dirname(pth));
- return make(pth);
- }
- try {
- const stats = await stat(pth);
- if (!stats.isDirectory()) {
- throw new Error("The path is not a directory");
- }
- } catch (_) {
- throw error;
- }
- return pth;
- }
- };
- return make(path.resolve(input));
- };
- module2.exports = makeDir;
- module2.exports.sync = (input, options) => {
- checkPath(input);
- options = processOptions(options);
- if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) {
- const pth = path.resolve(input);
- fs.mkdirSync(pth, {
- mode: options.mode,
- recursive: true
- });
- return pth;
- }
- const make = (pth) => {
- try {
- options.fs.mkdirSync(pth, options.mode);
- } catch (error) {
- if (error.code === "EPERM") {
- throw error;
- }
- if (error.code === "ENOENT") {
- if (path.dirname(pth) === pth) {
- throw permissionError(pth);
- }
- if (error.message.includes("null bytes")) {
- throw error;
- }
- make(path.dirname(pth));
- return make(pth);
- }
- try {
- if (!options.fs.statSync(pth).isDirectory()) {
- throw new Error("The path is not a directory");
- }
- } catch (_) {
- throw error;
- }
- }
- return pth;
- };
- return make(path.resolve(input));
- };
- }
- });
- var require_find_cache_dir = __commonJS2({
- "node_modules/find-cache-dir/index.js"(exports2, module2) {
- "use strict";
- var path = require("path");
- var fs = require("fs");
- var commonDir = require_commondir();
- var pkgDir = require_pkg_dir();
- var makeDir = require_make_dir();
- var {
- env: env2,
- cwd
- } = process;
- var isWritable = (path2) => {
- try {
- fs.accessSync(path2, fs.constants.W_OK);
- return true;
- } catch (_) {
- return false;
- }
- };
- function useDirectory(directory, options) {
- if (options.create) {
- makeDir.sync(directory);
- }
- if (options.thunk) {
- return (...arguments_) => path.join(directory, ...arguments_);
- }
- return directory;
- }
- function getNodeModuleDirectory(directory) {
- const nodeModules = path.join(directory, "node_modules");
- if (!isWritable(nodeModules) && (fs.existsSync(nodeModules) || !isWritable(path.join(directory)))) {
- return;
- }
- return nodeModules;
- }
- module2.exports = (options = {}) => {
- if (env2.CACHE_DIR && !["true", "false", "1", "0"].includes(env2.CACHE_DIR)) {
- return useDirectory(path.join(env2.CACHE_DIR, options.name), options);
- }
- let {
- cwd: directory = cwd()
- } = options;
- if (options.files) {
- directory = commonDir(directory, options.files);
- }
- directory = pkgDir.sync(directory);
- if (!directory) {
- return;
- }
- const nodeModules = getNodeModuleDirectory(directory);
- if (!nodeModules) {
- return void 0;
- }
- return useDirectory(path.join(directory, "node_modules", ".cache", options.name), options);
- };
- }
- });
- var require_find_cache_file = __commonJS2({
- "src/cli/find-cache-file.js"(exports2, module2) {
- "use strict";
- var fs = require("fs").promises;
- var os2 = require("os");
- var path = require("path");
- var findCacheDir = require_find_cache_dir();
- var {
- statSafe,
- isJson
- } = require_utils();
- function findDefaultCacheFile() {
- const cacheDir = findCacheDir({
- name: "prettier",
- create: true
- }) || os2.tmpdir();
- const cacheFilePath = path.join(cacheDir, ".prettier-cache");
- return cacheFilePath;
- }
- async function findCacheFileFromOption(cacheLocation) {
- const cacheFile = path.resolve(cacheLocation);
- const stat = await statSafe(cacheFile);
- if (stat) {
- if (stat.isDirectory()) {
- throw new Error(`Resolved --cache-location '${cacheFile}' is a directory`);
- }
- const data = await fs.readFile(cacheFile, "utf8");
- if (!isJson(data)) {
- throw new Error(`'${cacheFile}' isn't a valid JSON file`);
- }
- }
- return cacheFile;
- }
- async function findCacheFile(cacheLocation) {
- if (!cacheLocation) {
- return findDefaultCacheFile();
- }
- const cacheFile = await findCacheFileFromOption(cacheLocation);
- return cacheFile;
- }
- module2.exports = findCacheFile;
- }
- });
- var require_cjs = __commonJS2({
- "node_modules/flatted/cjs/index.js"(exports2) {
- "use strict";
- var {
- parse: $parse,
- stringify: $stringify
- } = JSON;
- var {
- keys
- } = Object;
- var Primitive = String;
- var primitive = "string";
- var ignore = {};
- var object = "object";
- var noop = (_, value) => value;
- var primitives = (value) => value instanceof Primitive ? Primitive(value) : value;
- var Primitives = (_, value) => typeof value === primitive ? new Primitive(value) : value;
- var revive = (input, parsed, output, $) => {
- const lazy = [];
- for (let ke = keys(output), {
- length
- } = ke, y = 0; y < length; y++) {
- const k = ke[y];
- const value = output[k];
- if (value instanceof Primitive) {
- const tmp = input[value];
- if (typeof tmp === object && !parsed.has(tmp)) {
- parsed.add(tmp);
- output[k] = ignore;
- lazy.push({
- k,
- a: [input, parsed, tmp, $]
- });
- } else
- output[k] = $.call(output, k, tmp);
- } else if (output[k] !== ignore)
- output[k] = $.call(output, k, value);
- }
- for (let {
- length
- } = lazy, i = 0; i < length; i++) {
- const {
- k,
- a
- } = lazy[i];
- output[k] = $.call(output, k, revive.apply(null, a));
- }
- return output;
- };
- var set = (known, input, value) => {
- const index = Primitive(input.push(value) - 1);
- known.set(value, index);
- return index;
- };
- var parse = (text, reviver) => {
- const input = $parse(text, Primitives).map(primitives);
- const value = input[0];
- const $ = reviver || noop;
- const tmp = typeof value === object && value ? revive(input, /* @__PURE__ */ new Set(), value, $) : value;
- return $.call({
- "": tmp
- }, "", tmp);
- };
- exports2.parse = parse;
- var stringify2 = (value, replacer, space) => {
- const $ = replacer && typeof replacer === object ? (k, v) => k === "" || -1 < replacer.indexOf(k) ? v : void 0 : replacer || noop;
- const known = /* @__PURE__ */ new Map();
- const input = [];
- const output = [];
- let i = +set(known, input, $.call({
- "": value
- }, "", value));
- let firstRun = !i;
- while (i < input.length) {
- firstRun = true;
- output[i] = $stringify(input[i++], replace, space);
- }
- return "[" + output.join(",") + "]";
- function replace(key, value2) {
- if (firstRun) {
- firstRun = !firstRun;
- return value2;
- }
- const after = $.call(this, key, value2);
- switch (typeof after) {
- case object:
- if (after === null)
- return after;
- case primitive:
- return known.get(after) || set(known, input, after);
- }
- return after;
- }
- };
- exports2.stringify = stringify2;
- var toJSON = (any) => $parse(stringify2(any));
- exports2.toJSON = toJSON;
- var fromJSON = (any) => parse($stringify(any));
- exports2.fromJSON = fromJSON;
- }
- });
- var require_utils6 = __commonJS2({
- "node_modules/flat-cache/src/utils.js"(exports2, module2) {
- var fs = require("fs");
- var path = require("path");
- var flatted = require_cjs();
- module2.exports = {
- tryParse: function(filePath, defaultValue) {
- var result;
- try {
- result = this.readJSON(filePath);
- } catch (ex) {
- result = defaultValue;
- }
- return result;
- },
- readJSON: function(filePath) {
- return flatted.parse(fs.readFileSync(filePath, {
- encoding: "utf8"
- }));
- },
- writeJSON: function(filePath, data) {
- fs.mkdirSync(path.dirname(filePath), {
- recursive: true
- });
- fs.writeFileSync(filePath, flatted.stringify(data));
- }
- };
- }
- });
- var require_old = __commonJS2({
- "node_modules/fs.realpath/old.js"(exports2) {
- var pathModule = require("path");
- var isWindows = process.platform === "win32";
- var fs = require("fs");
- var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
- function rethrow() {
- var callback;
- if (DEBUG) {
- var backtrace = new Error();
- callback = debugCallback;
- } else
- callback = missingCallback;
- return callback;
- function debugCallback(err) {
- if (err) {
- backtrace.message = err.message;
- err = backtrace;
- missingCallback(err);
- }
- }
- function missingCallback(err) {
- if (err) {
- if (process.throwDeprecation)
- throw err;
- else if (!process.noDeprecation) {
- var msg = "fs: missing callback " + (err.stack || err.message);
- if (process.traceDeprecation)
- console.trace(msg);
- else
- console.error(msg);
- }
- }
- }
- }
- function maybeCallback(cb) {
- return typeof cb === "function" ? cb : rethrow();
- }
- var normalize = pathModule.normalize;
- if (isWindows) {
- nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
- } else {
- nextPartRe = /(.*?)(?:[\/]+|$)/g;
- }
- var nextPartRe;
- if (isWindows) {
- splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
- } else {
- splitRootRe = /^[\/]*/;
- }
- var splitRootRe;
- exports2.realpathSync = function realpathSync(p, cache) {
- p = pathModule.resolve(p);
- if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
- return cache[p];
- }
- var original = p, seenLinks = {}, knownHard = {};
- var pos;
- var current;
- var base;
- var previous;
- start();
- function start() {
- var m = splitRootRe.exec(p);
- pos = m[0].length;
- current = m[0];
- base = m[0];
- previous = "";
- if (isWindows && !knownHard[base]) {
- fs.lstatSync(base);
- knownHard[base] = true;
- }
- }
- while (pos < p.length) {
- nextPartRe.lastIndex = pos;
- var result = nextPartRe.exec(p);
- previous = current;
- current += result[0];
- base = previous + result[1];
- pos = nextPartRe.lastIndex;
- if (knownHard[base] || cache && cache[base] === base) {
- continue;
- }
- var resolvedLink;
- if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
- resolvedLink = cache[base];
- } else {
- var stat = fs.lstatSync(base);
- if (!stat.isSymbolicLink()) {
- knownHard[base] = true;
- if (cache)
- cache[base] = base;
- continue;
- }
- var linkTarget = null;
- if (!isWindows) {
- var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
- if (seenLinks.hasOwnProperty(id)) {
- linkTarget = seenLinks[id];
- }
- }
- if (linkTarget === null) {
- fs.statSync(base);
- linkTarget = fs.readlinkSync(base);
- }
- resolvedLink = pathModule.resolve(previous, linkTarget);
- if (cache)
- cache[base] = resolvedLink;
- if (!isWindows)
- seenLinks[id] = linkTarget;
- }
- p = pathModule.resolve(resolvedLink, p.slice(pos));
- start();
- }
- if (cache)
- cache[original] = p;
- return p;
- };
- exports2.realpath = function realpath(p, cache, cb) {
- if (typeof cb !== "function") {
- cb = maybeCallback(cache);
- cache = null;
- }
- p = pathModule.resolve(p);
- if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
- return process.nextTick(cb.bind(null, null, cache[p]));
- }
- var original = p, seenLinks = {}, knownHard = {};
- var pos;
- var current;
- var base;
- var previous;
- start();
- function start() {
- var m = splitRootRe.exec(p);
- pos = m[0].length;
- current = m[0];
- base = m[0];
- previous = "";
- if (isWindows && !knownHard[base]) {
- fs.lstat(base, function(err) {
- if (err)
- return cb(err);
- knownHard[base] = true;
- LOOP();
- });
- } else {
- process.nextTick(LOOP);
- }
- }
- function LOOP() {
- if (pos >= p.length) {
- if (cache)
- cache[original] = p;
- return cb(null, p);
- }
- nextPartRe.lastIndex = pos;
- var result = nextPartRe.exec(p);
- previous = current;
- current += result[0];
- base = previous + result[1];
- pos = nextPartRe.lastIndex;
- if (knownHard[base] || cache && cache[base] === base) {
- return process.nextTick(LOOP);
- }
- if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
- return gotResolvedLink(cache[base]);
- }
- return fs.lstat(base, gotStat);
- }
- function gotStat(err, stat) {
- if (err)
- return cb(err);
- if (!stat.isSymbolicLink()) {
- knownHard[base] = true;
- if (cache)
- cache[base] = base;
- return process.nextTick(LOOP);
- }
- if (!isWindows) {
- var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
- if (seenLinks.hasOwnProperty(id)) {
- return gotTarget(null, seenLinks[id], base);
- }
- }
- fs.stat(base, function(err2) {
- if (err2)
- return cb(err2);
- fs.readlink(base, function(err3, target) {
- if (!isWindows)
- seenLinks[id] = target;
- gotTarget(err3, target);
- });
- });
- }
- function gotTarget(err, target, base2) {
- if (err)
- return cb(err);
- var resolvedLink = pathModule.resolve(previous, target);
- if (cache)
- cache[base2] = resolvedLink;
- gotResolvedLink(resolvedLink);
- }
- function gotResolvedLink(resolvedLink) {
- p = pathModule.resolve(resolvedLink, p.slice(pos));
- start();
- }
- };
- }
- });
- var require_fs5 = __commonJS2({
- "node_modules/fs.realpath/index.js"(exports2, module2) {
- module2.exports = realpath;
- realpath.realpath = realpath;
- realpath.sync = realpathSync;
- realpath.realpathSync = realpathSync;
- realpath.monkeypatch = monkeypatch;
- realpath.unmonkeypatch = unmonkeypatch;
- var fs = require("fs");
- var origRealpath = fs.realpath;
- var origRealpathSync = fs.realpathSync;
- var version = process.version;
- var ok = /^v[0-5]\./.test(version);
- var old = require_old();
- function newError(er) {
- return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
- }
- function realpath(p, cache, cb) {
- if (ok) {
- return origRealpath(p, cache, cb);
- }
- if (typeof cache === "function") {
- cb = cache;
- cache = null;
- }
- origRealpath(p, cache, function(er, result) {
- if (newError(er)) {
- old.realpath(p, cache, cb);
- } else {
- cb(er, result);
- }
- });
- }
- function realpathSync(p, cache) {
- if (ok) {
- return origRealpathSync(p, cache);
- }
- try {
- return origRealpathSync(p, cache);
- } catch (er) {
- if (newError(er)) {
- return old.realpathSync(p, cache);
- } else {
- throw er;
- }
- }
- }
- function monkeypatch() {
- fs.realpath = realpath;
- fs.realpathSync = realpathSync;
- }
- function unmonkeypatch() {
- fs.realpath = origRealpath;
- fs.realpathSync = origRealpathSync;
- }
- }
- });
- var require_concat_map = __commonJS2({
- "node_modules/concat-map/index.js"(exports2, module2) {
- module2.exports = function(xs, fn) {
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- var x = fn(xs[i], i);
- if (isArray(x))
- res.push.apply(res, x);
- else
- res.push(x);
- }
- return res;
- };
- var isArray = Array.isArray || function(xs) {
- return Object.prototype.toString.call(xs) === "[object Array]";
- };
- }
- });
- var require_balanced_match = __commonJS2({
- "node_modules/balanced-match/index.js"(exports2, module2) {
- "use strict";
- module2.exports = balanced;
- function balanced(a, b, str) {
- if (a instanceof RegExp)
- a = maybeMatch(a, str);
- if (b instanceof RegExp)
- b = maybeMatch(b, str);
- var r = range(a, b, str);
- return r && {
- start: r[0],
- end: r[1],
- pre: str.slice(0, r[0]),
- body: str.slice(r[0] + a.length, r[1]),
- post: str.slice(r[1] + b.length)
- };
- }
- function maybeMatch(reg, str) {
- var m = str.match(reg);
- return m ? m[0] : null;
- }
- balanced.range = range;
- function range(a, b, str) {
- var begs, beg, left, right, result;
- var ai = str.indexOf(a);
- var bi = str.indexOf(b, ai + 1);
- var i = ai;
- if (ai >= 0 && bi > 0) {
- if (a === b) {
- return [ai, bi];
- }
- begs = [];
- left = str.length;
- while (i >= 0 && !result) {
- if (i == ai) {
- begs.push(i);
- ai = str.indexOf(a, i + 1);
- } else if (begs.length == 1) {
- result = [begs.pop(), bi];
- } else {
- beg = begs.pop();
- if (beg < left) {
- left = beg;
- right = bi;
- }
- bi = str.indexOf(b, i + 1);
- }
- i = ai < bi && ai >= 0 ? ai : bi;
- }
- if (begs.length) {
- result = [left, right];
- }
- }
- return result;
- }
- }
- });
- var require_brace_expansion = __commonJS2({
- "node_modules/brace-expansion/index.js"(exports2, module2) {
- var concatMap = require_concat_map();
- var balanced = require_balanced_match();
- module2.exports = expandTop;
- var escSlash = "\0SLASH" + Math.random() + "\0";
- var escOpen = "\0OPEN" + Math.random() + "\0";
- var escClose = "\0CLOSE" + Math.random() + "\0";
- var escComma = "\0COMMA" + Math.random() + "\0";
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
- function numeric(str) {
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
- }
- function escapeBraces(str) {
- return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
- }
- function unescapeBraces(str) {
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
- }
- function parseCommaParts(str) {
- if (!str)
- return [""];
- var parts = [];
- var m = balanced("{", "}", str);
- if (!m)
- return str.split(",");
- var pre = m.pre;
- var body = m.body;
- var post = m.post;
- var p = pre.split(",");
- p[p.length - 1] += "{" + body + "}";
- var postParts = parseCommaParts(post);
- if (post.length) {
- p[p.length - 1] += postParts.shift();
- p.push.apply(p, postParts);
- }
- parts.push.apply(parts, p);
- return parts;
- }
- function expandTop(str) {
- if (!str)
- return [];
- if (str.substr(0, 2) === "{}") {
- str = "\\{\\}" + str.substr(2);
- }
- return expand(escapeBraces(str), true).map(unescapeBraces);
- }
- function embrace(str) {
- return "{" + str + "}";
- }
- function isPadded(el) {
- return /^-?0\d/.test(el);
- }
- function lte(i, y) {
- return i <= y;
- }
- function gte(i, y) {
- return i >= y;
- }
- function expand(str, isTop) {
- var expansions = [];
- var m = balanced("{", "}", str);
- if (!m || /\$$/.test(m.pre))
- return [str];
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
- var isSequence = isNumericSequence || isAlphaSequence;
- var isOptions = m.body.indexOf(",") >= 0;
- if (!isSequence && !isOptions) {
- if (m.post.match(/,.*\}/)) {
- str = m.pre + "{" + m.body + escClose + m.post;
- return expand(str);
- }
- return [str];
- }
- var n;
- if (isSequence) {
- n = m.body.split(/\.\./);
- } else {
- n = parseCommaParts(m.body);
- if (n.length === 1) {
- n = expand(n[0], false).map(embrace);
- if (n.length === 1) {
- var post = m.post.length ? expand(m.post, false) : [""];
- return post.map(function(p) {
- return m.pre + n[0] + p;
- });
- }
- }
- }
- var pre = m.pre;
- var post = m.post.length ? expand(m.post, false) : [""];
- var N;
- if (isSequence) {
- var x = numeric(n[0]);
- var y = numeric(n[1]);
- var width = Math.max(n[0].length, n[1].length);
- var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
- var test = lte;
- var reverse = y < x;
- if (reverse) {
- incr *= -1;
- test = gte;
- }
- var pad = n.some(isPadded);
- N = [];
- for (var i = x; test(i, y); i += incr) {
- var c;
- if (isAlphaSequence) {
- c = String.fromCharCode(i);
- if (c === "\\")
- c = "";
- } else {
- c = String(i);
- if (pad) {
- var need = width - c.length;
- if (need > 0) {
- var z = new Array(need + 1).join("0");
- if (i < 0)
- c = "-" + z + c.slice(1);
- else
- c = z + c;
- }
- }
- }
- N.push(c);
- }
- } else {
- N = concatMap(n, function(el) {
- return expand(el, false);
- });
- }
- for (var j = 0; j < N.length; j++) {
- for (var k = 0; k < post.length; k++) {
- var expansion = pre + N[j] + post[k];
- if (!isTop || isSequence || expansion)
- expansions.push(expansion);
- }
- }
- return expansions;
- }
- }
- });
- var require_minimatch = __commonJS2({
- "node_modules/minimatch/minimatch.js"(exports2, module2) {
- module2.exports = minimatch;
- minimatch.Minimatch = Minimatch;
- var path = function() {
- try {
- return require("path");
- } catch (e) {
- }
- }() || {
- sep: "/"
- };
- minimatch.sep = path.sep;
- var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
- var expand = require_brace_expansion();
- var plTypes = {
- "!": {
- open: "(?:(?!(?:",
- close: "))[^/]*?)"
- },
- "?": {
- open: "(?:",
- close: ")?"
- },
- "+": {
- open: "(?:",
- close: ")+"
- },
- "*": {
- open: "(?:",
- close: ")*"
- },
- "@": {
- open: "(?:",
- close: ")"
- }
- };
- var qmark = "[^/]";
- var star = qmark + "*?";
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
- var reSpecials = charSet("().*{}+?[]^$\\!");
- function charSet(s) {
- return s.split("").reduce(function(set, c) {
- set[c] = true;
- return set;
- }, {});
- }
- var slashSplit = /\/+/;
- minimatch.filter = filter;
- function filter(pattern, options) {
- options = options || {};
- return function(p, i, list) {
- return minimatch(p, pattern, options);
- };
- }
- function ext(a, b) {
- b = b || {};
- var t = {};
- Object.keys(a).forEach(function(k) {
- t[k] = a[k];
- });
- Object.keys(b).forEach(function(k) {
- t[k] = b[k];
- });
- return t;
- }
- minimatch.defaults = function(def) {
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
- return minimatch;
- }
- var orig = minimatch;
- var m = function minimatch2(p, pattern, options) {
- return orig(p, pattern, ext(def, options));
- };
- m.Minimatch = function Minimatch2(pattern, options) {
- return new orig.Minimatch(pattern, ext(def, options));
- };
- m.Minimatch.defaults = function defaults(options) {
- return orig.defaults(ext(def, options)).Minimatch;
- };
- m.filter = function filter2(pattern, options) {
- return orig.filter(pattern, ext(def, options));
- };
- m.defaults = function defaults(options) {
- return orig.defaults(ext(def, options));
- };
- m.makeRe = function makeRe2(pattern, options) {
- return orig.makeRe(pattern, ext(def, options));
- };
- m.braceExpand = function braceExpand2(pattern, options) {
- return orig.braceExpand(pattern, ext(def, options));
- };
- m.match = function(list, pattern, options) {
- return orig.match(list, pattern, ext(def, options));
- };
- return m;
- };
- Minimatch.defaults = function(def) {
- return minimatch.defaults(def).Minimatch;
- };
- function minimatch(p, pattern, options) {
- assertValidPattern(pattern);
- if (!options)
- options = {};
- if (!options.nocomment && pattern.charAt(0) === "#") {
- return false;
- }
- return new Minimatch(pattern, options).match(p);
- }
- function Minimatch(pattern, options) {
- if (!(this instanceof Minimatch)) {
- return new Minimatch(pattern, options);
- }
- assertValidPattern(pattern);
- if (!options)
- options = {};
- pattern = pattern.trim();
- if (!options.allowWindowsEscape && path.sep !== "/") {
- pattern = pattern.split(path.sep).join("/");
- }
- this.options = options;
- this.set = [];
- this.pattern = pattern;
- this.regexp = null;
- this.negate = false;
- this.comment = false;
- this.empty = false;
- this.partial = !!options.partial;
- this.make();
- }
- Minimatch.prototype.debug = function() {
- };
- Minimatch.prototype.make = make;
- function make() {
- var pattern = this.pattern;
- var options = this.options;
- if (!options.nocomment && pattern.charAt(0) === "#") {
- this.comment = true;
- return;
- }
- if (!pattern) {
- this.empty = true;
- return;
- }
- this.parseNegate();
- var set = this.globSet = this.braceExpand();
- if (options.debug)
- this.debug = function debug() {
- console.error.apply(console, arguments);
- };
- this.debug(this.pattern, set);
- set = this.globParts = set.map(function(s) {
- return s.split(slashSplit);
- });
- this.debug(this.pattern, set);
- set = set.map(function(s, si, set2) {
- return s.map(this.parse, this);
- }, this);
- this.debug(this.pattern, set);
- set = set.filter(function(s) {
- return s.indexOf(false) === -1;
- });
- this.debug(this.pattern, set);
- this.set = set;
- }
- Minimatch.prototype.parseNegate = parseNegate;
- function parseNegate() {
- var pattern = this.pattern;
- var negate = false;
- var options = this.options;
- var negateOffset = 0;
- if (options.nonegate)
- return;
- for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
- negate = !negate;
- negateOffset++;
- }
- if (negateOffset)
- this.pattern = pattern.substr(negateOffset);
- this.negate = negate;
- }
- minimatch.braceExpand = function(pattern, options) {
- return braceExpand(pattern, options);
- };
- Minimatch.prototype.braceExpand = braceExpand;
- function braceExpand(pattern, options) {
- if (!options) {
- if (this instanceof Minimatch) {
- options = this.options;
- } else {
- options = {};
- }
- }
- pattern = typeof pattern === "undefined" ? this.pattern : pattern;
- assertValidPattern(pattern);
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
- return [pattern];
- }
- return expand(pattern);
- }
- var MAX_PATTERN_LENGTH = 1024 * 64;
- var assertValidPattern = function(pattern) {
- if (typeof pattern !== "string") {
- throw new TypeError("invalid pattern");
- }
- if (pattern.length > MAX_PATTERN_LENGTH) {
- throw new TypeError("pattern is too long");
- }
- };
- Minimatch.prototype.parse = parse;
- var SUBPARSE = {};
- function parse(pattern, isSub) {
- assertValidPattern(pattern);
- var options = this.options;
- if (pattern === "**") {
- if (!options.noglobstar)
- return GLOBSTAR;
- else
- pattern = "*";
- }
- if (pattern === "")
- return "";
- var re = "";
- var hasMagic = !!options.nocase;
- var escaping = false;
- var patternListStack = [];
- var negativeLists = [];
- var stateChar;
- var inClass = false;
- var reClassStart = -1;
- var classStart = -1;
- var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
- var self2 = this;
- function clearStateChar() {
- if (stateChar) {
- switch (stateChar) {
- case "*":
- re += star;
- hasMagic = true;
- break;
- case "?":
- re += qmark;
- hasMagic = true;
- break;
- default:
- re += "\\" + stateChar;
- break;
- }
- self2.debug("clearStateChar %j %j", stateChar, re);
- stateChar = false;
- }
- }
- for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
- this.debug("%s %s %s %j", pattern, i, re, c);
- if (escaping && reSpecials[c]) {
- re += "\\" + c;
- escaping = false;
- continue;
- }
- switch (c) {
- case "/": {
- return false;
- }
- case "\\":
- clearStateChar();
- escaping = true;
- continue;
- case "?":
- case "*":
- case "+":
- case "@":
- case "!":
- this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
- if (inClass) {
- this.debug(" in class");
- if (c === "!" && i === classStart + 1)
- c = "^";
- re += c;
- continue;
- }
- self2.debug("call clearStateChar %j", stateChar);
- clearStateChar();
- stateChar = c;
- if (options.noext)
- clearStateChar();
- continue;
- case "(":
- if (inClass) {
- re += "(";
- continue;
- }
- if (!stateChar) {
- re += "\\(";
- continue;
- }
- patternListStack.push({
- type: stateChar,
- start: i - 1,
- reStart: re.length,
- open: plTypes[stateChar].open,
- close: plTypes[stateChar].close
- });
- re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
- this.debug("plType %j %j", stateChar, re);
- stateChar = false;
- continue;
- case ")":
- if (inClass || !patternListStack.length) {
- re += "\\)";
- continue;
- }
- clearStateChar();
- hasMagic = true;
- var pl = patternListStack.pop();
- re += pl.close;
- if (pl.type === "!") {
- negativeLists.push(pl);
- }
- pl.reEnd = re.length;
- continue;
- case "|":
- if (inClass || !patternListStack.length || escaping) {
- re += "\\|";
- escaping = false;
- continue;
- }
- clearStateChar();
- re += "|";
- continue;
- case "[":
- clearStateChar();
- if (inClass) {
- re += "\\" + c;
- continue;
- }
- inClass = true;
- classStart = i;
- reClassStart = re.length;
- re += c;
- continue;
- case "]":
- if (i === classStart + 1 || !inClass) {
- re += "\\" + c;
- escaping = false;
- continue;
- }
- var cs = pattern.substring(classStart + 1, i);
- try {
- RegExp("[" + cs + "]");
- } catch (er) {
- var sp = this.parse(cs, SUBPARSE);
- re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
- hasMagic = hasMagic || sp[1];
- inClass = false;
- continue;
- }
- hasMagic = true;
- inClass = false;
- re += c;
- continue;
- default:
- clearStateChar();
- if (escaping) {
- escaping = false;
- } else if (reSpecials[c] && !(c === "^" && inClass)) {
- re += "\\";
- }
- re += c;
- }
- }
- if (inClass) {
- cs = pattern.substr(classStart + 1);
- sp = this.parse(cs, SUBPARSE);
- re = re.substr(0, reClassStart) + "\\[" + sp[0];
- hasMagic = hasMagic || sp[1];
- }
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
- var tail = re.slice(pl.reStart + pl.open.length);
- this.debug("setting tail", re, pl);
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
- if (!$2) {
- $2 = "\\";
- }
- return $1 + $1 + $2 + "|";
- });
- this.debug("tail=%j\n %s", tail, tail, pl, re);
- var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
- hasMagic = true;
- re = re.slice(0, pl.reStart) + t + "\\(" + tail;
- }
- clearStateChar();
- if (escaping) {
- re += "\\\\";
- }
- var addPatternStart = false;
- switch (re.charAt(0)) {
- case "[":
- case ".":
- case "(":
- addPatternStart = true;
- }
- for (var n = negativeLists.length - 1; n > -1; n--) {
- var nl = negativeLists[n];
- var nlBefore = re.slice(0, nl.reStart);
- var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
- var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
- var nlAfter = re.slice(nl.reEnd);
- nlLast += nlAfter;
- var openParensBefore = nlBefore.split("(").length - 1;
- var cleanAfter = nlAfter;
- for (i = 0; i < openParensBefore; i++) {
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
- }
- nlAfter = cleanAfter;
- var dollar = "";
- if (nlAfter === "" && isSub !== SUBPARSE) {
- dollar = "$";
- }
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
- re = newRe;
- }
- if (re !== "" && hasMagic) {
- re = "(?=.)" + re;
- }
- if (addPatternStart) {
- re = patternStart + re;
- }
- if (isSub === SUBPARSE) {
- return [re, hasMagic];
- }
- if (!hasMagic) {
- return globUnescape(pattern);
- }
- var flags = options.nocase ? "i" : "";
- try {
- var regExp = new RegExp("^" + re + "$", flags);
- } catch (er) {
- return new RegExp("$.");
- }
- regExp._glob = pattern;
- regExp._src = re;
- return regExp;
- }
- minimatch.makeRe = function(pattern, options) {
- return new Minimatch(pattern, options || {}).makeRe();
- };
- Minimatch.prototype.makeRe = makeRe;
- function makeRe() {
- if (this.regexp || this.regexp === false)
- return this.regexp;
- var set = this.set;
- if (!set.length) {
- this.regexp = false;
- return this.regexp;
- }
- var options = this.options;
- var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
- var flags = options.nocase ? "i" : "";
- var re = set.map(function(pattern) {
- return pattern.map(function(p) {
- return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
- }).join("\\/");
- }).join("|");
- re = "^(?:" + re + ")$";
- if (this.negate)
- re = "^(?!" + re + ").*$";
- try {
- this.regexp = new RegExp(re, flags);
- } catch (ex) {
- this.regexp = false;
- }
- return this.regexp;
- }
- minimatch.match = function(list, pattern, options) {
- options = options || {};
- var mm = new Minimatch(pattern, options);
- list = list.filter(function(f) {
- return mm.match(f);
- });
- if (mm.options.nonull && !list.length) {
- list.push(pattern);
- }
- return list;
- };
- Minimatch.prototype.match = function match(f, partial) {
- if (typeof partial === "undefined")
- partial = this.partial;
- this.debug("match", f, this.pattern);
- if (this.comment)
- return false;
- if (this.empty)
- return f === "";
- if (f === "/" && partial)
- return true;
- var options = this.options;
- if (path.sep !== "/") {
- f = f.split(path.sep).join("/");
- }
- f = f.split(slashSplit);
- this.debug(this.pattern, "split", f);
- var set = this.set;
- this.debug(this.pattern, "set", set);
- var filename;
- var i;
- for (i = f.length - 1; i >= 0; i--) {
- filename = f[i];
- if (filename)
- break;
- }
- for (i = 0; i < set.length; i++) {
- var pattern = set[i];
- var file = f;
- if (options.matchBase && pattern.length === 1) {
- file = [filename];
- }
- var hit = this.matchOne(file, pattern, partial);
- if (hit) {
- if (options.flipNegate)
- return true;
- return !this.negate;
- }
- }
- if (options.flipNegate)
- return false;
- return this.negate;
- };
- Minimatch.prototype.matchOne = function(file, pattern, partial) {
- var options = this.options;
- this.debug("matchOne", {
- "this": this,
- file,
- pattern
- });
- this.debug("matchOne", file.length, pattern.length);
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
- this.debug("matchOne loop");
- var p = pattern[pi];
- var f = file[fi];
- this.debug(pattern, p, f);
- if (p === false)
- return false;
- if (p === GLOBSTAR) {
- this.debug("GLOBSTAR", [pattern, p, f]);
- var fr = fi;
- var pr = pi + 1;
- if (pr === pl) {
- this.debug("** at the end");
- for (; fi < fl; fi++) {
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
- return false;
- }
- return true;
- }
- while (fr < fl) {
- var swallowee = file[fr];
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
- this.debug("globstar found match!", fr, fl, swallowee);
- return true;
- } else {
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
- this.debug("dot detected!", file, fr, pattern, pr);
- break;
- }
- this.debug("globstar swallow a segment, and continue");
- fr++;
- }
- }
- if (partial) {
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
- if (fr === fl)
- return true;
- }
- return false;
- }
- var hit;
- if (typeof p === "string") {
- hit = f === p;
- this.debug("string match", p, f, hit);
- } else {
- hit = f.match(p);
- this.debug("pattern match", p, f, hit);
- }
- if (!hit)
- return false;
- }
- if (fi === fl && pi === pl) {
- return true;
- } else if (fi === fl) {
- return partial;
- } else if (pi === pl) {
- return fi === fl - 1 && file[fi] === "";
- }
- throw new Error("wtf?");
- };
- function globUnescape(s) {
- return s.replace(/\\(.)/g, "$1");
- }
- function regExpEscape(s) {
- return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- }
- }
- });
- var require_inherits_browser = __commonJS2({
- "node_modules/inherits/inherits_browser.js"(exports2, module2) {
- if (typeof Object.create === "function") {
- module2.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor;
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- }
- };
- } else {
- module2.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor;
- var TempCtor = function() {
- };
- TempCtor.prototype = superCtor.prototype;
- ctor.prototype = new TempCtor();
- ctor.prototype.constructor = ctor;
- }
- };
- }
- }
- });
- var require_inherits = __commonJS2({
- "node_modules/inherits/inherits.js"(exports2, module2) {
- try {
- util = require("util");
- if (typeof util.inherits !== "function")
- throw "";
- module2.exports = util.inherits;
- } catch (e) {
- module2.exports = require_inherits_browser();
- }
- var util;
- }
- });
- var require_path_is_absolute = __commonJS2({
- "node_modules/path-is-absolute/index.js"(exports2, module2) {
- "use strict";
- function posix(path) {
- return path.charAt(0) === "/";
- }
- function win32(path) {
- var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
- var result = splitDeviceRe.exec(path);
- var device = result[1] || "";
- var isUnc = Boolean(device && device.charAt(1) !== ":");
- return Boolean(result[2] || isUnc);
- }
- module2.exports = process.platform === "win32" ? win32 : posix;
- module2.exports.posix = posix;
- module2.exports.win32 = win32;
- }
- });
- var require_common3 = __commonJS2({
- "node_modules/glob/common.js"(exports2) {
- exports2.setopts = setopts;
- exports2.ownProp = ownProp;
- exports2.makeAbs = makeAbs;
- exports2.finish = finish;
- exports2.mark = mark;
- exports2.isIgnored = isIgnored;
- exports2.childrenIgnored = childrenIgnored;
- function ownProp(obj, field) {
- return Object.prototype.hasOwnProperty.call(obj, field);
- }
- var fs = require("fs");
- var path = require("path");
- var minimatch = require_minimatch();
- var isAbsolute = require_path_is_absolute();
- var Minimatch = minimatch.Minimatch;
- function alphasort(a, b) {
- return a.localeCompare(b, "en");
- }
- function setupIgnores(self2, options) {
- self2.ignore = options.ignore || [];
- if (!Array.isArray(self2.ignore))
- self2.ignore = [self2.ignore];
- if (self2.ignore.length) {
- self2.ignore = self2.ignore.map(ignoreMap);
- }
- }
- function ignoreMap(pattern) {
- var gmatcher = null;
- if (pattern.slice(-3) === "/**") {
- var gpattern = pattern.replace(/(\/\*\*)+$/, "");
- gmatcher = new Minimatch(gpattern, {
- dot: true
- });
- }
- return {
- matcher: new Minimatch(pattern, {
- dot: true
- }),
- gmatcher
- };
- }
- function setopts(self2, pattern, options) {
- if (!options)
- options = {};
- if (options.matchBase && pattern.indexOf("/") === -1) {
- if (options.noglobstar) {
- throw new Error("base matching requires globstar");
- }
- pattern = "**/" + pattern;
- }
- self2.silent = !!options.silent;
- self2.pattern = pattern;
- self2.strict = options.strict !== false;
- self2.realpath = !!options.realpath;
- self2.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
- self2.follow = !!options.follow;
- self2.dot = !!options.dot;
- self2.mark = !!options.mark;
- self2.nodir = !!options.nodir;
- if (self2.nodir)
- self2.mark = true;
- self2.sync = !!options.sync;
- self2.nounique = !!options.nounique;
- self2.nonull = !!options.nonull;
- self2.nosort = !!options.nosort;
- self2.nocase = !!options.nocase;
- self2.stat = !!options.stat;
- self2.noprocess = !!options.noprocess;
- self2.absolute = !!options.absolute;
- self2.fs = options.fs || fs;
- self2.maxLength = options.maxLength || Infinity;
- self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
- self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
- self2.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
- setupIgnores(self2, options);
- self2.changedCwd = false;
- var cwd = process.cwd();
- if (!ownProp(options, "cwd"))
- self2.cwd = cwd;
- else {
- self2.cwd = path.resolve(options.cwd);
- self2.changedCwd = self2.cwd !== cwd;
- }
- self2.root = options.root || path.resolve(self2.cwd, "/");
- self2.root = path.resolve(self2.root);
- if (process.platform === "win32")
- self2.root = self2.root.replace(/\\/g, "/");
- self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
- if (process.platform === "win32")
- self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/");
- self2.nomount = !!options.nomount;
- options.nonegate = true;
- options.nocomment = true;
- self2.minimatch = new Minimatch(pattern, options);
- self2.options = self2.minimatch.options;
- }
- function finish(self2) {
- var nou = self2.nounique;
- var all = nou ? [] : /* @__PURE__ */ Object.create(null);
- for (var i = 0, l = self2.matches.length; i < l; i++) {
- var matches = self2.matches[i];
- if (!matches || Object.keys(matches).length === 0) {
- if (self2.nonull) {
- var literal = self2.minimatch.globSet[i];
- if (nou)
- all.push(literal);
- else
- all[literal] = true;
- }
- } else {
- var m = Object.keys(matches);
- if (nou)
- all.push.apply(all, m);
- else
- m.forEach(function(m2) {
- all[m2] = true;
- });
- }
- }
- if (!nou)
- all = Object.keys(all);
- if (!self2.nosort)
- all = all.sort(alphasort);
- if (self2.mark) {
- for (var i = 0; i < all.length; i++) {
- all[i] = self2._mark(all[i]);
- }
- if (self2.nodir) {
- all = all.filter(function(e) {
- var notDir = !/\/$/.test(e);
- var c = self2.cache[e] || self2.cache[makeAbs(self2, e)];
- if (notDir && c)
- notDir = c !== "DIR" && !Array.isArray(c);
- return notDir;
- });
- }
- }
- if (self2.ignore.length)
- all = all.filter(function(m2) {
- return !isIgnored(self2, m2);
- });
- self2.found = all;
- }
- function mark(self2, p) {
- var abs = makeAbs(self2, p);
- var c = self2.cache[abs];
- var m = p;
- if (c) {
- var isDir = c === "DIR" || Array.isArray(c);
- var slash = p.slice(-1) === "/";
- if (isDir && !slash)
- m += "/";
- else if (!isDir && slash)
- m = m.slice(0, -1);
- if (m !== p) {
- var mabs = makeAbs(self2, m);
- self2.statCache[mabs] = self2.statCache[abs];
- self2.cache[mabs] = self2.cache[abs];
- }
- }
- return m;
- }
- function makeAbs(self2, f) {
- var abs = f;
- if (f.charAt(0) === "/") {
- abs = path.join(self2.root, f);
- } else if (isAbsolute(f) || f === "") {
- abs = f;
- } else if (self2.changedCwd) {
- abs = path.resolve(self2.cwd, f);
- } else {
- abs = path.resolve(f);
- }
- if (process.platform === "win32")
- abs = abs.replace(/\\/g, "/");
- return abs;
- }
- function isIgnored(self2, path2) {
- if (!self2.ignore.length)
- return false;
- return self2.ignore.some(function(item) {
- return item.matcher.match(path2) || !!(item.gmatcher && item.gmatcher.match(path2));
- });
- }
- function childrenIgnored(self2, path2) {
- if (!self2.ignore.length)
- return false;
- return self2.ignore.some(function(item) {
- return !!(item.gmatcher && item.gmatcher.match(path2));
- });
- }
- }
- });
- var require_sync7 = __commonJS2({
- "node_modules/glob/sync.js"(exports2, module2) {
- module2.exports = globSync;
- globSync.GlobSync = GlobSync;
- var rp = require_fs5();
- var minimatch = require_minimatch();
- var Minimatch = minimatch.Minimatch;
- var Glob = require_glob().Glob;
- var util = require("util");
- var path = require("path");
- var assert = require("assert");
- var isAbsolute = require_path_is_absolute();
- var common = require_common3();
- var setopts = common.setopts;
- var ownProp = common.ownProp;
- var childrenIgnored = common.childrenIgnored;
- var isIgnored = common.isIgnored;
- function globSync(pattern, options) {
- if (typeof options === "function" || arguments.length === 3)
- throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
- return new GlobSync(pattern, options).found;
- }
- function GlobSync(pattern, options) {
- if (!pattern)
- throw new Error("must provide pattern");
- if (typeof options === "function" || arguments.length === 3)
- throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
- if (!(this instanceof GlobSync))
- return new GlobSync(pattern, options);
- setopts(this, pattern, options);
- if (this.noprocess)
- return this;
- var n = this.minimatch.set.length;
- this.matches = new Array(n);
- for (var i = 0; i < n; i++) {
- this._process(this.minimatch.set[i], i, false);
- }
- this._finish();
- }
- GlobSync.prototype._finish = function() {
- assert(this instanceof GlobSync);
- if (this.realpath) {
- var self2 = this;
- this.matches.forEach(function(matchset, index) {
- var set = self2.matches[index] = /* @__PURE__ */ Object.create(null);
- for (var p in matchset) {
- try {
- p = self2._makeAbs(p);
- var real = rp.realpathSync(p, self2.realpathCache);
- set[real] = true;
- } catch (er) {
- if (er.syscall === "stat")
- set[self2._makeAbs(p)] = true;
- else
- throw er;
- }
- }
- });
- }
- common.finish(this);
- };
- GlobSync.prototype._process = function(pattern, index, inGlobStar) {
- assert(this instanceof GlobSync);
- var n = 0;
- while (typeof pattern[n] === "string") {
- n++;
- }
- var prefix;
- switch (n) {
- case pattern.length:
- this._processSimple(pattern.join("/"), index);
- return;
- case 0:
- prefix = null;
- break;
- default:
- prefix = pattern.slice(0, n).join("/");
- break;
- }
- var remain = pattern.slice(n);
- var read;
- if (prefix === null)
- read = ".";
- else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
- if (!prefix || !isAbsolute(prefix))
- prefix = "/" + prefix;
- read = prefix;
- } else
- read = prefix;
- var abs = this._makeAbs(read);
- if (childrenIgnored(this, read))
- return;
- var isGlobStar = remain[0] === minimatch.GLOBSTAR;
- if (isGlobStar)
- this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
- else
- this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
- };
- GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) {
- var entries = this._readdir(abs, inGlobStar);
- if (!entries)
- return;
- var pn = remain[0];
- var negate = !!this.minimatch.negate;
- var rawGlob = pn._glob;
- var dotOk = this.dot || rawGlob.charAt(0) === ".";
- var matchedEntries = [];
- for (var i = 0; i < entries.length; i++) {
- var e = entries[i];
- if (e.charAt(0) !== "." || dotOk) {
- var m;
- if (negate && !prefix) {
- m = !e.match(pn);
- } else {
- m = e.match(pn);
- }
- if (m)
- matchedEntries.push(e);
- }
- }
- var len = matchedEntries.length;
- if (len === 0)
- return;
- if (remain.length === 1 && !this.mark && !this.stat) {
- if (!this.matches[index])
- this.matches[index] = /* @__PURE__ */ Object.create(null);
- for (var i = 0; i < len; i++) {
- var e = matchedEntries[i];
- if (prefix) {
- if (prefix.slice(-1) !== "/")
- e = prefix + "/" + e;
- else
- e = prefix + e;
- }
- if (e.charAt(0) === "/" && !this.nomount) {
- e = path.join(this.root, e);
- }
- this._emitMatch(index, e);
- }
- return;
- }
- remain.shift();
- for (var i = 0; i < len; i++) {
- var e = matchedEntries[i];
- var newPattern;
- if (prefix)
- newPattern = [prefix, e];
- else
- newPattern = [e];
- this._process(newPattern.concat(remain), index, inGlobStar);
- }
- };
- GlobSync.prototype._emitMatch = function(index, e) {
- if (isIgnored(this, e))
- return;
- var abs = this._makeAbs(e);
- if (this.mark)
- e = this._mark(e);
- if (this.absolute) {
- e = abs;
- }
- if (this.matches[index][e])
- return;
- if (this.nodir) {
- var c = this.cache[abs];
- if (c === "DIR" || Array.isArray(c))
- return;
- }
- this.matches[index][e] = true;
- if (this.stat)
- this._stat(e);
- };
- GlobSync.prototype._readdirInGlobStar = function(abs) {
- if (this.follow)
- return this._readdir(abs, false);
- var entries;
- var lstat;
- var stat;
- try {
- lstat = this.fs.lstatSync(abs);
- } catch (er) {
- if (er.code === "ENOENT") {
- return null;
- }
- }
- var isSym = lstat && lstat.isSymbolicLink();
- this.symlinks[abs] = isSym;
- if (!isSym && lstat && !lstat.isDirectory())
- this.cache[abs] = "FILE";
- else
- entries = this._readdir(abs, false);
- return entries;
- };
- GlobSync.prototype._readdir = function(abs, inGlobStar) {
- var entries;
- if (inGlobStar && !ownProp(this.symlinks, abs))
- return this._readdirInGlobStar(abs);
- if (ownProp(this.cache, abs)) {
- var c = this.cache[abs];
- if (!c || c === "FILE")
- return null;
- if (Array.isArray(c))
- return c;
- }
- try {
- return this._readdirEntries(abs, this.fs.readdirSync(abs));
- } catch (er) {
- this._readdirError(abs, er);
- return null;
- }
- };
- GlobSync.prototype._readdirEntries = function(abs, entries) {
- if (!this.mark && !this.stat) {
- for (var i = 0; i < entries.length; i++) {
- var e = entries[i];
- if (abs === "/")
- e = abs + e;
- else
- e = abs + "/" + e;
- this.cache[e] = true;
- }
- }
- this.cache[abs] = entries;
- return entries;
- };
- GlobSync.prototype._readdirError = function(f, er) {
- switch (er.code) {
- case "ENOTSUP":
- case "ENOTDIR":
- var abs = this._makeAbs(f);
- this.cache[abs] = "FILE";
- if (abs === this.cwdAbs) {
- var error = new Error(er.code + " invalid cwd " + this.cwd);
- error.path = this.cwd;
- error.code = er.code;
- throw error;
- }
- break;
- case "ENOENT":
- case "ELOOP":
- case "ENAMETOOLONG":
- case "UNKNOWN":
- this.cache[this._makeAbs(f)] = false;
- break;
- default:
- this.cache[this._makeAbs(f)] = false;
- if (this.strict)
- throw er;
- if (!this.silent)
- console.error("glob error", er);
- break;
- }
- };
- GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) {
- var entries = this._readdir(abs, inGlobStar);
- if (!entries)
- return;
- var remainWithoutGlobStar = remain.slice(1);
- var gspref = prefix ? [prefix] : [];
- var noGlobStar = gspref.concat(remainWithoutGlobStar);
- this._process(noGlobStar, index, false);
- var len = entries.length;
- var isSym = this.symlinks[abs];
- if (isSym && inGlobStar)
- return;
- for (var i = 0; i < len; i++) {
- var e = entries[i];
- if (e.charAt(0) === "." && !this.dot)
- continue;
- var instead = gspref.concat(entries[i], remainWithoutGlobStar);
- this._process(instead, index, true);
- var below = gspref.concat(entries[i], remain);
- this._process(below, index, true);
- }
- };
- GlobSync.prototype._processSimple = function(prefix, index) {
- var exists = this._stat(prefix);
- if (!this.matches[index])
- this.matches[index] = /* @__PURE__ */ Object.create(null);
- if (!exists)
- return;
- if (prefix && isAbsolute(prefix) && !this.nomount) {
- var trail = /[\/\\]$/.test(prefix);
- if (prefix.charAt(0) === "/") {
- prefix = path.join(this.root, prefix);
- } else {
- prefix = path.resolve(this.root, prefix);
- if (trail)
- prefix += "/";
- }
- }
- if (process.platform === "win32")
- prefix = prefix.replace(/\\/g, "/");
- this._emitMatch(index, prefix);
- };
- GlobSync.prototype._stat = function(f) {
- var abs = this._makeAbs(f);
- var needDir = f.slice(-1) === "/";
- if (f.length > this.maxLength)
- return false;
- if (!this.stat && ownProp(this.cache, abs)) {
- var c = this.cache[abs];
- if (Array.isArray(c))
- c = "DIR";
- if (!needDir || c === "DIR")
- return c;
- if (needDir && c === "FILE")
- return false;
- }
- var exists;
- var stat = this.statCache[abs];
- if (!stat) {
- var lstat;
- try {
- lstat = this.fs.lstatSync(abs);
- } catch (er) {
- if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
- this.statCache[abs] = false;
- return false;
- }
- }
- if (lstat && lstat.isSymbolicLink()) {
- try {
- stat = this.fs.statSync(abs);
- } catch (er) {
- stat = lstat;
- }
- } else {
- stat = lstat;
- }
- }
- this.statCache[abs] = stat;
- var c = true;
- if (stat)
- c = stat.isDirectory() ? "DIR" : "FILE";
- this.cache[abs] = this.cache[abs] || c;
- if (needDir && c === "FILE")
- return false;
- return c;
- };
- GlobSync.prototype._mark = function(p) {
- return common.mark(this, p);
- };
- GlobSync.prototype._makeAbs = function(f) {
- return common.makeAbs(this, f);
- };
- }
- });
- var require_wrappy = __commonJS2({
- "node_modules/wrappy/wrappy.js"(exports2, module2) {
- module2.exports = wrappy;
- function wrappy(fn, cb) {
- if (fn && cb)
- return wrappy(fn)(cb);
- if (typeof fn !== "function")
- throw new TypeError("need wrapper function");
- Object.keys(fn).forEach(function(k) {
- wrapper[k] = fn[k];
- });
- return wrapper;
- function wrapper() {
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i];
- }
- var ret = fn.apply(this, args);
- var cb2 = args[args.length - 1];
- if (typeof ret === "function" && ret !== cb2) {
- Object.keys(cb2).forEach(function(k) {
- ret[k] = cb2[k];
- });
- }
- return ret;
- }
- }
- }
- });
- var require_once = __commonJS2({
- "node_modules/once/once.js"(exports2, module2) {
- var wrappy = require_wrappy();
- module2.exports = wrappy(once);
- module2.exports.strict = wrappy(onceStrict);
- once.proto = once(function() {
- Object.defineProperty(Function.prototype, "once", {
- value: function() {
- return once(this);
- },
- configurable: true
- });
- Object.defineProperty(Function.prototype, "onceStrict", {
- value: function() {
- return onceStrict(this);
- },
- configurable: true
- });
- });
- function once(fn) {
- var f = function() {
- if (f.called)
- return f.value;
- f.called = true;
- return f.value = fn.apply(this, arguments);
- };
- f.called = false;
- return f;
- }
- function onceStrict(fn) {
- var f = function() {
- if (f.called)
- throw new Error(f.onceError);
- f.called = true;
- return f.value = fn.apply(this, arguments);
- };
- var name = fn.name || "Function wrapped with `once`";
- f.onceError = name + " shouldn't be called more than once";
- f.called = false;
- return f;
- }
- }
- });
- var require_inflight = __commonJS2({
- "node_modules/inflight/inflight.js"(exports2, module2) {
- var wrappy = require_wrappy();
- var reqs = /* @__PURE__ */ Object.create(null);
- var once = require_once();
- module2.exports = wrappy(inflight);
- function inflight(key, cb) {
- if (reqs[key]) {
- reqs[key].push(cb);
- return null;
- } else {
- reqs[key] = [cb];
- return makeres(key);
- }
- }
- function makeres(key) {
- return once(function RES() {
- var cbs = reqs[key];
- var len = cbs.length;
- var args = slice(arguments);
- try {
- for (var i = 0; i < len; i++) {
- cbs[i].apply(null, args);
- }
- } finally {
- if (cbs.length > len) {
- cbs.splice(0, len);
- process.nextTick(function() {
- RES.apply(null, args);
- });
- } else {
- delete reqs[key];
- }
- }
- });
- }
- function slice(args) {
- var length = args.length;
- var array2 = [];
- for (var i = 0; i < length; i++)
- array2[i] = args[i];
- return array2;
- }
- }
- });
- var require_glob = __commonJS2({
- "node_modules/glob/glob.js"(exports2, module2) {
- module2.exports = glob;
- var rp = require_fs5();
- var minimatch = require_minimatch();
- var Minimatch = minimatch.Minimatch;
- var inherits = require_inherits();
- var EE = require("events").EventEmitter;
- var path = require("path");
- var assert = require("assert");
- var isAbsolute = require_path_is_absolute();
- var globSync = require_sync7();
- var common = require_common3();
- var setopts = common.setopts;
- var ownProp = common.ownProp;
- var inflight = require_inflight();
- var util = require("util");
- var childrenIgnored = common.childrenIgnored;
- var isIgnored = common.isIgnored;
- var once = require_once();
- function glob(pattern, options, cb) {
- if (typeof options === "function")
- cb = options, options = {};
- if (!options)
- options = {};
- if (options.sync) {
- if (cb)
- throw new TypeError("callback provided to sync glob");
- return globSync(pattern, options);
- }
- return new Glob(pattern, options, cb);
- }
- glob.sync = globSync;
- var GlobSync = glob.GlobSync = globSync.GlobSync;
- glob.glob = glob;
- function extend(origin, add) {
- if (add === null || typeof add !== "object") {
- return origin;
- }
- var keys = Object.keys(add);
- var i = keys.length;
- while (i--) {
- origin[keys[i]] = add[keys[i]];
- }
- return origin;
- }
- glob.hasMagic = function(pattern, options_) {
- var options = extend({}, options_);
- options.noprocess = true;
- var g = new Glob(pattern, options);
- var set = g.minimatch.set;
- if (!pattern)
- return false;
- if (set.length > 1)
- return true;
- for (var j = 0; j < set[0].length; j++) {
- if (typeof set[0][j] !== "string")
- return true;
- }
- return false;
- };
- glob.Glob = Glob;
- inherits(Glob, EE);
- function Glob(pattern, options, cb) {
- if (typeof options === "function") {
- cb = options;
- options = null;
- }
- if (options && options.sync) {
- if (cb)
- throw new TypeError("callback provided to sync glob");
- return new GlobSync(pattern, options);
- }
- if (!(this instanceof Glob))
- return new Glob(pattern, options, cb);
- setopts(this, pattern, options);
- this._didRealPath = false;
- var n = this.minimatch.set.length;
- this.matches = new Array(n);
- if (typeof cb === "function") {
- cb = once(cb);
- this.on("error", cb);
- this.on("end", function(matches) {
- cb(null, matches);
- });
- }
- var self2 = this;
- this._processing = 0;
- this._emitQueue = [];
- this._processQueue = [];
- this.paused = false;
- if (this.noprocess)
- return this;
- if (n === 0)
- return done();
- var sync = true;
- for (var i = 0; i < n; i++) {
- this._process(this.minimatch.set[i], i, false, done);
- }
- sync = false;
- function done() {
- --self2._processing;
- if (self2._processing <= 0) {
- if (sync) {
- process.nextTick(function() {
- self2._finish();
- });
- } else {
- self2._finish();
- }
- }
- }
- }
- Glob.prototype._finish = function() {
- assert(this instanceof Glob);
- if (this.aborted)
- return;
- if (this.realpath && !this._didRealpath)
- return this._realpath();
- common.finish(this);
- this.emit("end", this.found);
- };
- Glob.prototype._realpath = function() {
- if (this._didRealpath)
- return;
- this._didRealpath = true;
- var n = this.matches.length;
- if (n === 0)
- return this._finish();
- var self2 = this;
- for (var i = 0; i < this.matches.length; i++)
- this._realpathSet(i, next);
- function next() {
- if (--n === 0)
- self2._finish();
- }
- };
- Glob.prototype._realpathSet = function(index, cb) {
- var matchset = this.matches[index];
- if (!matchset)
- return cb();
- var found = Object.keys(matchset);
- var self2 = this;
- var n = found.length;
- if (n === 0)
- return cb();
- var set = this.matches[index] = /* @__PURE__ */ Object.create(null);
- found.forEach(function(p, i) {
- p = self2._makeAbs(p);
- rp.realpath(p, self2.realpathCache, function(er, real) {
- if (!er)
- set[real] = true;
- else if (er.syscall === "stat")
- set[p] = true;
- else
- self2.emit("error", er);
- if (--n === 0) {
- self2.matches[index] = set;
- cb();
- }
- });
- });
- };
- Glob.prototype._mark = function(p) {
- return common.mark(this, p);
- };
- Glob.prototype._makeAbs = function(f) {
- return common.makeAbs(this, f);
- };
- Glob.prototype.abort = function() {
- this.aborted = true;
- this.emit("abort");
- };
- Glob.prototype.pause = function() {
- if (!this.paused) {
- this.paused = true;
- this.emit("pause");
- }
- };
- Glob.prototype.resume = function() {
- if (this.paused) {
- this.emit("resume");
- this.paused = false;
- if (this._emitQueue.length) {
- var eq = this._emitQueue.slice(0);
- this._emitQueue.length = 0;
- for (var i = 0; i < eq.length; i++) {
- var e = eq[i];
- this._emitMatch(e[0], e[1]);
- }
- }
- if (this._processQueue.length) {
- var pq = this._processQueue.slice(0);
- this._processQueue.length = 0;
- for (var i = 0; i < pq.length; i++) {
- var p = pq[i];
- this._processing--;
- this._process(p[0], p[1], p[2], p[3]);
- }
- }
- }
- };
- Glob.prototype._process = function(pattern, index, inGlobStar, cb) {
- assert(this instanceof Glob);
- assert(typeof cb === "function");
- if (this.aborted)
- return;
- this._processing++;
- if (this.paused) {
- this._processQueue.push([pattern, index, inGlobStar, cb]);
- return;
- }
- var n = 0;
- while (typeof pattern[n] === "string") {
- n++;
- }
- var prefix;
- switch (n) {
- case pattern.length:
- this._processSimple(pattern.join("/"), index, cb);
- return;
- case 0:
- prefix = null;
- break;
- default:
- prefix = pattern.slice(0, n).join("/");
- break;
- }
- var remain = pattern.slice(n);
- var read;
- if (prefix === null)
- read = ".";
- else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
- if (!prefix || !isAbsolute(prefix))
- prefix = "/" + prefix;
- read = prefix;
- } else
- read = prefix;
- var abs = this._makeAbs(read);
- if (childrenIgnored(this, read))
- return cb();
- var isGlobStar = remain[0] === minimatch.GLOBSTAR;
- if (isGlobStar)
- this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
- else
- this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
- };
- Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) {
- var self2 = this;
- this._readdir(abs, inGlobStar, function(er, entries) {
- return self2._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
- });
- };
- Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
- if (!entries)
- return cb();
- var pn = remain[0];
- var negate = !!this.minimatch.negate;
- var rawGlob = pn._glob;
- var dotOk = this.dot || rawGlob.charAt(0) === ".";
- var matchedEntries = [];
- for (var i = 0; i < entries.length; i++) {
- var e = entries[i];
- if (e.charAt(0) !== "." || dotOk) {
- var m;
- if (negate && !prefix) {
- m = !e.match(pn);
- } else {
- m = e.match(pn);
- }
- if (m)
- matchedEntries.push(e);
- }
- }
- var len = matchedEntries.length;
- if (len === 0)
- return cb();
- if (remain.length === 1 && !this.mark && !this.stat) {
- if (!this.matches[index])
- this.matches[index] = /* @__PURE__ */ Object.create(null);
- for (var i = 0; i < len; i++) {
- var e = matchedEntries[i];
- if (prefix) {
- if (prefix !== "/")
- e = prefix + "/" + e;
- else
- e = prefix + e;
- }
- if (e.charAt(0) === "/" && !this.nomount) {
- e = path.join(this.root, e);
- }
- this._emitMatch(index, e);
- }
- return cb();
- }
- remain.shift();
- for (var i = 0; i < len; i++) {
- var e = matchedEntries[i];
- var newPattern;
- if (prefix) {
- if (prefix !== "/")
- e = prefix + "/" + e;
- else
- e = prefix + e;
- }
- this._process([e].concat(remain), index, inGlobStar, cb);
- }
- cb();
- };
- Glob.prototype._emitMatch = function(index, e) {
- if (this.aborted)
- return;
- if (isIgnored(this, e))
- return;
- if (this.paused) {
- this._emitQueue.push([index, e]);
- return;
- }
- var abs = isAbsolute(e) ? e : this._makeAbs(e);
- if (this.mark)
- e = this._mark(e);
- if (this.absolute)
- e = abs;
- if (this.matches[index][e])
- return;
- if (this.nodir) {
- var c = this.cache[abs];
- if (c === "DIR" || Array.isArray(c))
- return;
- }
- this.matches[index][e] = true;
- var st = this.statCache[abs];
- if (st)
- this.emit("stat", e, st);
- this.emit("match", e);
- };
- Glob.prototype._readdirInGlobStar = function(abs, cb) {
- if (this.aborted)
- return;
- if (this.follow)
- return this._readdir(abs, false, cb);
- var lstatkey = "lstat\0" + abs;
- var self2 = this;
- var lstatcb = inflight(lstatkey, lstatcb_);
- if (lstatcb)
- self2.fs.lstat(abs, lstatcb);
- function lstatcb_(er, lstat) {
- if (er && er.code === "ENOENT")
- return cb();
- var isSym = lstat && lstat.isSymbolicLink();
- self2.symlinks[abs] = isSym;
- if (!isSym && lstat && !lstat.isDirectory()) {
- self2.cache[abs] = "FILE";
- cb();
- } else
- self2._readdir(abs, false, cb);
- }
- };
- Glob.prototype._readdir = function(abs, inGlobStar, cb) {
- if (this.aborted)
- return;
- cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
- if (!cb)
- return;
- if (inGlobStar && !ownProp(this.symlinks, abs))
- return this._readdirInGlobStar(abs, cb);
- if (ownProp(this.cache, abs)) {
- var c = this.cache[abs];
- if (!c || c === "FILE")
- return cb();
- if (Array.isArray(c))
- return cb(null, c);
- }
- var self2 = this;
- self2.fs.readdir(abs, readdirCb(this, abs, cb));
- };
- function readdirCb(self2, abs, cb) {
- return function(er, entries) {
- if (er)
- self2._readdirError(abs, er, cb);
- else
- self2._readdirEntries(abs, entries, cb);
- };
- }
- Glob.prototype._readdirEntries = function(abs, entries, cb) {
- if (this.aborted)
- return;
- if (!this.mark && !this.stat) {
- for (var i = 0; i < entries.length; i++) {
- var e = entries[i];
- if (abs === "/")
- e = abs + e;
- else
- e = abs + "/" + e;
- this.cache[e] = true;
- }
- }
- this.cache[abs] = entries;
- return cb(null, entries);
- };
- Glob.prototype._readdirError = function(f, er, cb) {
- if (this.aborted)
- return;
- switch (er.code) {
- case "ENOTSUP":
- case "ENOTDIR":
- var abs = this._makeAbs(f);
- this.cache[abs] = "FILE";
- if (abs === this.cwdAbs) {
- var error = new Error(er.code + " invalid cwd " + this.cwd);
- error.path = this.cwd;
- error.code = er.code;
- this.emit("error", error);
- this.abort();
- }
- break;
- case "ENOENT":
- case "ELOOP":
- case "ENAMETOOLONG":
- case "UNKNOWN":
- this.cache[this._makeAbs(f)] = false;
- break;
- default:
- this.cache[this._makeAbs(f)] = false;
- if (this.strict) {
- this.emit("error", er);
- this.abort();
- }
- if (!this.silent)
- console.error("glob error", er);
- break;
- }
- return cb();
- };
- Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) {
- var self2 = this;
- this._readdir(abs, inGlobStar, function(er, entries) {
- self2._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
- });
- };
- Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
- if (!entries)
- return cb();
- var remainWithoutGlobStar = remain.slice(1);
- var gspref = prefix ? [prefix] : [];
- var noGlobStar = gspref.concat(remainWithoutGlobStar);
- this._process(noGlobStar, index, false, cb);
- var isSym = this.symlinks[abs];
- var len = entries.length;
- if (isSym && inGlobStar)
- return cb();
- for (var i = 0; i < len; i++) {
- var e = entries[i];
- if (e.charAt(0) === "." && !this.dot)
- continue;
- var instead = gspref.concat(entries[i], remainWithoutGlobStar);
- this._process(instead, index, true, cb);
- var below = gspref.concat(entries[i], remain);
- this._process(below, index, true, cb);
- }
- cb();
- };
- Glob.prototype._processSimple = function(prefix, index, cb) {
- var self2 = this;
- this._stat(prefix, function(er, exists) {
- self2._processSimple2(prefix, index, er, exists, cb);
- });
- };
- Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) {
- if (!this.matches[index])
- this.matches[index] = /* @__PURE__ */ Object.create(null);
- if (!exists)
- return cb();
- if (prefix && isAbsolute(prefix) && !this.nomount) {
- var trail = /[\/\\]$/.test(prefix);
- if (prefix.charAt(0) === "/") {
- prefix = path.join(this.root, prefix);
- } else {
- prefix = path.resolve(this.root, prefix);
- if (trail)
- prefix += "/";
- }
- }
- if (process.platform === "win32")
- prefix = prefix.replace(/\\/g, "/");
- this._emitMatch(index, prefix);
- cb();
- };
- Glob.prototype._stat = function(f, cb) {
- var abs = this._makeAbs(f);
- var needDir = f.slice(-1) === "/";
- if (f.length > this.maxLength)
- return cb();
- if (!this.stat && ownProp(this.cache, abs)) {
- var c = this.cache[abs];
- if (Array.isArray(c))
- c = "DIR";
- if (!needDir || c === "DIR")
- return cb(null, c);
- if (needDir && c === "FILE")
- return cb();
- }
- var exists;
- var stat = this.statCache[abs];
- if (stat !== void 0) {
- if (stat === false)
- return cb(null, stat);
- else {
- var type = stat.isDirectory() ? "DIR" : "FILE";
- if (needDir && type === "FILE")
- return cb();
- else
- return cb(null, type, stat);
- }
- }
- var self2 = this;
- var statcb = inflight("stat\0" + abs, lstatcb_);
- if (statcb)
- self2.fs.lstat(abs, statcb);
- function lstatcb_(er, lstat) {
- if (lstat && lstat.isSymbolicLink()) {
- return self2.fs.stat(abs, function(er2, stat2) {
- if (er2)
- self2._stat2(f, abs, null, lstat, cb);
- else
- self2._stat2(f, abs, er2, stat2, cb);
- });
- } else {
- self2._stat2(f, abs, er, lstat, cb);
- }
- }
- };
- Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
- if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
- this.statCache[abs] = false;
- return cb();
- }
- var needDir = f.slice(-1) === "/";
- this.statCache[abs] = stat;
- if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
- return cb(null, false, stat);
- var c = true;
- if (stat)
- c = stat.isDirectory() ? "DIR" : "FILE";
- this.cache[abs] = this.cache[abs] || c;
- if (needDir && c === "FILE")
- return cb();
- return cb(null, c, stat);
- };
- }
- });
- var require_rimraf = __commonJS2({
- "node_modules/rimraf/rimraf.js"(exports2, module2) {
- var assert = require("assert");
- var path = require("path");
- var fs = require("fs");
- var glob = void 0;
- try {
- glob = require_glob();
- } catch (_err) {
- }
- var defaultGlobOpts = {
- nosort: true,
- silent: true
- };
- var timeout = 0;
- var isWindows = process.platform === "win32";
- var defaults = (options) => {
- const methods = ["unlink", "chmod", "stat", "lstat", "rmdir", "readdir"];
- methods.forEach((m) => {
- options[m] = options[m] || fs[m];
- m = m + "Sync";
- options[m] = options[m] || fs[m];
- });
- options.maxBusyTries = options.maxBusyTries || 3;
- options.emfileWait = options.emfileWait || 1e3;
- if (options.glob === false) {
- options.disableGlob = true;
- }
- if (options.disableGlob !== true && glob === void 0) {
- throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");
- }
- options.disableGlob = options.disableGlob || false;
- options.glob = options.glob || defaultGlobOpts;
- };
- var rimraf = (p, options, cb) => {
- if (typeof options === "function") {
- cb = options;
- options = {};
- }
- assert(p, "rimraf: missing path");
- assert.equal(typeof p, "string", "rimraf: path should be a string");
- assert.equal(typeof cb, "function", "rimraf: callback function required");
- assert(options, "rimraf: invalid options argument provided");
- assert.equal(typeof options, "object", "rimraf: options should be object");
- defaults(options);
- let busyTries = 0;
- let errState = null;
- let n = 0;
- const next = (er) => {
- errState = errState || er;
- if (--n === 0)
- cb(errState);
- };
- const afterGlob = (er, results) => {
- if (er)
- return cb(er);
- n = results.length;
- if (n === 0)
- return cb();
- results.forEach((p2) => {
- const CB = (er2) => {
- if (er2) {
- if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) {
- busyTries++;
- return setTimeout(() => rimraf_(p2, options, CB), busyTries * 100);
- }
- if (er2.code === "EMFILE" && timeout < options.emfileWait) {
- return setTimeout(() => rimraf_(p2, options, CB), timeout++);
- }
- if (er2.code === "ENOENT")
- er2 = null;
- }
- timeout = 0;
- next(er2);
- };
- rimraf_(p2, options, CB);
- });
- };
- if (options.disableGlob || !glob.hasMagic(p))
- return afterGlob(null, [p]);
- options.lstat(p, (er, stat) => {
- if (!er)
- return afterGlob(null, [p]);
- glob(p, options.glob, afterGlob);
- });
- };
- var rimraf_ = (p, options, cb) => {
- assert(p);
- assert(options);
- assert(typeof cb === "function");
- options.lstat(p, (er, st) => {
- if (er && er.code === "ENOENT")
- return cb(null);
- if (er && er.code === "EPERM" && isWindows)
- fixWinEPERM(p, options, er, cb);
- if (st && st.isDirectory())
- return rmdir(p, options, er, cb);
- options.unlink(p, (er2) => {
- if (er2) {
- if (er2.code === "ENOENT")
- return cb(null);
- if (er2.code === "EPERM")
- return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
- if (er2.code === "EISDIR")
- return rmdir(p, options, er2, cb);
- }
- return cb(er2);
- });
- });
- };
- var fixWinEPERM = (p, options, er, cb) => {
- assert(p);
- assert(options);
- assert(typeof cb === "function");
- options.chmod(p, 438, (er2) => {
- if (er2)
- cb(er2.code === "ENOENT" ? null : er);
- else
- options.stat(p, (er3, stats) => {
- if (er3)
- cb(er3.code === "ENOENT" ? null : er);
- else if (stats.isDirectory())
- rmdir(p, options, er, cb);
- else
- options.unlink(p, cb);
- });
- });
- };
- var fixWinEPERMSync = (p, options, er) => {
- assert(p);
- assert(options);
- try {
- options.chmodSync(p, 438);
- } catch (er2) {
- if (er2.code === "ENOENT")
- return;
- else
- throw er;
- }
- let stats;
- try {
- stats = options.statSync(p);
- } catch (er3) {
- if (er3.code === "ENOENT")
- return;
- else
- throw er;
- }
- if (stats.isDirectory())
- rmdirSync(p, options, er);
- else
- options.unlinkSync(p);
- };
- var rmdir = (p, options, originalEr, cb) => {
- assert(p);
- assert(options);
- assert(typeof cb === "function");
- options.rmdir(p, (er) => {
- if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
- rmkids(p, options, cb);
- else if (er && er.code === "ENOTDIR")
- cb(originalEr);
- else
- cb(er);
- });
- };
- var rmkids = (p, options, cb) => {
- assert(p);
- assert(options);
- assert(typeof cb === "function");
- options.readdir(p, (er, files) => {
- if (er)
- return cb(er);
- let n = files.length;
- if (n === 0)
- return options.rmdir(p, cb);
- let errState;
- files.forEach((f) => {
- rimraf(path.join(p, f), options, (er2) => {
- if (errState)
- return;
- if (er2)
- return cb(errState = er2);
- if (--n === 0)
- options.rmdir(p, cb);
- });
- });
- });
- };
- var rimrafSync = (p, options) => {
- options = options || {};
- defaults(options);
- assert(p, "rimraf: missing path");
- assert.equal(typeof p, "string", "rimraf: path should be a string");
- assert(options, "rimraf: missing options");
- assert.equal(typeof options, "object", "rimraf: options should be object");
- let results;
- if (options.disableGlob || !glob.hasMagic(p)) {
- results = [p];
- } else {
- try {
- options.lstatSync(p);
- results = [p];
- } catch (er) {
- results = glob.sync(p, options.glob);
- }
- }
- if (!results.length)
- return;
- for (let i = 0; i < results.length; i++) {
- const p2 = results[i];
- let st;
- try {
- st = options.lstatSync(p2);
- } catch (er) {
- if (er.code === "ENOENT")
- return;
- if (er.code === "EPERM" && isWindows)
- fixWinEPERMSync(p2, options, er);
- }
- try {
- if (st && st.isDirectory())
- rmdirSync(p2, options, null);
- else
- options.unlinkSync(p2);
- } catch (er) {
- if (er.code === "ENOENT")
- return;
- if (er.code === "EPERM")
- return isWindows ? fixWinEPERMSync(p2, options, er) : rmdirSync(p2, options, er);
- if (er.code !== "EISDIR")
- throw er;
- rmdirSync(p2, options, er);
- }
- }
- };
- var rmdirSync = (p, options, originalEr) => {
- assert(p);
- assert(options);
- try {
- options.rmdirSync(p);
- } catch (er) {
- if (er.code === "ENOENT")
- return;
- if (er.code === "ENOTDIR")
- throw originalEr;
- if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
- rmkidsSync(p, options);
- }
- };
- var rmkidsSync = (p, options) => {
- assert(p);
- assert(options);
- options.readdirSync(p).forEach((f) => rimrafSync(path.join(p, f), options));
- const retries = isWindows ? 100 : 1;
- let i = 0;
- do {
- let threw = true;
- try {
- const ret = options.rmdirSync(p, options);
- threw = false;
- return ret;
- } finally {
- if (++i < retries && threw)
- continue;
- }
- } while (true);
- };
- module2.exports = rimraf;
- rimraf.sync = rimrafSync;
- }
- });
- var require_del = __commonJS2({
- "node_modules/flat-cache/src/del.js"(exports2, module2) {
- var rimraf = require_rimraf().sync;
- var fs = require("fs");
- module2.exports = function del(file) {
- if (fs.existsSync(file)) {
- rimraf(file, {
- glob: false
- });
- return true;
- }
- return false;
- };
- }
- });
- var require_cache = __commonJS2({
- "node_modules/flat-cache/src/cache.js"(exports2, module2) {
- var path = require("path");
- var fs = require("fs");
- var utils = require_utils6();
- var del = require_del();
- var writeJSON = utils.writeJSON;
- var cache = {
- load: function(docId, cacheDir) {
- var me = this;
- me._visited = {};
- me._persisted = {};
- me._pathToFile = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, "../.cache/", docId);
- if (fs.existsSync(me._pathToFile)) {
- me._persisted = utils.tryParse(me._pathToFile, {});
- }
- },
- loadFile: function(pathToFile) {
- var me = this;
- var dir = path.dirname(pathToFile);
- var fName = path.basename(pathToFile);
- me.load(fName, dir);
- },
- all: function() {
- return this._persisted;
- },
- keys: function() {
- return Object.keys(this._persisted);
- },
- setKey: function(key, value) {
- this._visited[key] = true;
- this._persisted[key] = value;
- },
- removeKey: function(key) {
- delete this._visited[key];
- delete this._persisted[key];
- },
- getKey: function(key) {
- this._visited[key] = true;
- return this._persisted[key];
- },
- _prune: function() {
- var me = this;
- var obj = {};
- var keys = Object.keys(me._visited);
- if (keys.length === 0) {
- return;
- }
- keys.forEach(function(key) {
- obj[key] = me._persisted[key];
- });
- me._visited = {};
- me._persisted = obj;
- },
- save: function(noPrune) {
- var me = this;
- !noPrune && me._prune();
- writeJSON(me._pathToFile, me._persisted);
- },
- removeCacheFile: function() {
- return del(this._pathToFile);
- },
- destroy: function() {
- var me = this;
- me._visited = {};
- me._persisted = {};
- me.removeCacheFile();
- }
- };
- module2.exports = {
- load: function(docId, cacheDir) {
- return this.create(docId, cacheDir);
- },
- create: function(docId, cacheDir) {
- var obj = Object.create(cache);
- obj.load(docId, cacheDir);
- return obj;
- },
- createFromFile: function(filePath) {
- var obj = Object.create(cache);
- obj.loadFile(filePath);
- return obj;
- },
- clearCacheById: function(docId, cacheDir) {
- var filePath = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, "../.cache/", docId);
- return del(filePath);
- },
- clearAll: function(cacheDir) {
- var filePath = cacheDir ? path.resolve(cacheDir) : path.resolve(__dirname, "../.cache/");
- return del(filePath);
- }
- };
- }
- });
- var require_cache2 = __commonJS2({
- "node_modules/file-entry-cache/cache.js"(exports2, module2) {
- var path = require("path");
- var crypto = require("crypto");
- module2.exports = {
- createFromFile: function(filePath, useChecksum) {
- var fname = path.basename(filePath);
- var dir = path.dirname(filePath);
- return this.create(fname, dir, useChecksum);
- },
- create: function(cacheId, _path, useChecksum) {
- var fs = require("fs");
- var flatCache = require_cache();
- var cache = flatCache.load(cacheId, _path);
- var normalizedEntries = {};
- var removeNotFoundFiles = function removeNotFoundFiles2() {
- const cachedEntries = cache.keys();
- cachedEntries.forEach(function remover(fPath) {
- try {
- fs.statSync(fPath);
- } catch (err) {
- if (err.code === "ENOENT") {
- cache.removeKey(fPath);
- }
- }
- });
- };
- removeNotFoundFiles();
- return {
- cache,
- getHash: function(buffer) {
- return crypto.createHash("md5").update(buffer).digest("hex");
- },
- hasFileChanged: function(file) {
- return this.getFileDescriptor(file).changed;
- },
- analyzeFiles: function(files) {
- var me = this;
- files = files || [];
- var res = {
- changedFiles: [],
- notFoundFiles: [],
- notChangedFiles: []
- };
- me.normalizeEntries(files).forEach(function(entry) {
- if (entry.changed) {
- res.changedFiles.push(entry.key);
- return;
- }
- if (entry.notFound) {
- res.notFoundFiles.push(entry.key);
- return;
- }
- res.notChangedFiles.push(entry.key);
- });
- return res;
- },
- getFileDescriptor: function(file) {
- var fstat;
- try {
- fstat = fs.statSync(file);
- } catch (ex) {
- this.removeEntry(file);
- return {
- key: file,
- notFound: true,
- err: ex
- };
- }
- if (useChecksum) {
- return this._getFileDescriptorUsingChecksum(file);
- }
- return this._getFileDescriptorUsingMtimeAndSize(file, fstat);
- },
- _getFileDescriptorUsingMtimeAndSize: function(file, fstat) {
- var meta = cache.getKey(file);
- var cacheExists = !!meta;
- var cSize = fstat.size;
- var cTime = fstat.mtime.getTime();
- var isDifferentDate;
- var isDifferentSize;
- if (!meta) {
- meta = {
- size: cSize,
- mtime: cTime
- };
- } else {
- isDifferentDate = cTime !== meta.mtime;
- isDifferentSize = cSize !== meta.size;
- }
- var nEntry = normalizedEntries[file] = {
- key: file,
- changed: !cacheExists || isDifferentDate || isDifferentSize,
- meta
- };
- return nEntry;
- },
- _getFileDescriptorUsingChecksum: function(file) {
- var meta = cache.getKey(file);
- var cacheExists = !!meta;
- var contentBuffer;
- try {
- contentBuffer = fs.readFileSync(file);
- } catch (ex) {
- contentBuffer = "";
- }
- var isDifferent = true;
- var hash = this.getHash(contentBuffer);
- if (!meta) {
- meta = {
- hash
- };
- } else {
- isDifferent = hash !== meta.hash;
- }
- var nEntry = normalizedEntries[file] = {
- key: file,
- changed: !cacheExists || isDifferent,
- meta
- };
- return nEntry;
- },
- getUpdatedFiles: function(files) {
- var me = this;
- files = files || [];
- return me.normalizeEntries(files).filter(function(entry) {
- return entry.changed;
- }).map(function(entry) {
- return entry.key;
- });
- },
- normalizeEntries: function(files) {
- files = files || [];
- var me = this;
- var nEntries = files.map(function(file) {
- return me.getFileDescriptor(file);
- });
- return nEntries;
- },
- removeEntry: function(entryName) {
- delete normalizedEntries[entryName];
- cache.removeKey(entryName);
- },
- deleteCacheFile: function() {
- cache.removeCacheFile();
- },
- destroy: function() {
- normalizedEntries = {};
- cache.destroy();
- },
- _getMetaForFileUsingCheckSum: function(cacheEntry) {
- var contentBuffer = fs.readFileSync(cacheEntry.key);
- var hash = this.getHash(contentBuffer);
- var meta = Object.assign(cacheEntry.meta, {
- hash
- });
- delete meta.size;
- delete meta.mtime;
- return meta;
- },
- _getMetaForFileUsingMtimeAndSize: function(cacheEntry) {
- var stat = fs.statSync(cacheEntry.key);
- var meta = Object.assign(cacheEntry.meta, {
- size: stat.size,
- mtime: stat.mtime.getTime()
- });
- delete meta.hash;
- return meta;
- },
- reconcile: function(noPrune) {
- removeNotFoundFiles();
- noPrune = typeof noPrune === "undefined" ? true : noPrune;
- var entries = normalizedEntries;
- var keys = Object.keys(entries);
- if (keys.length === 0) {
- return;
- }
- var me = this;
- keys.forEach(function(entryName) {
- var cacheEntry = entries[entryName];
- try {
- var meta = useChecksum ? me._getMetaForFileUsingCheckSum(cacheEntry) : me._getMetaForFileUsingMtimeAndSize(cacheEntry);
- cache.setKey(entryName, meta);
- } catch (err) {
- if (err.code !== "ENOENT") {
- throw err;
- }
- }
- });
- cache.save(noPrune);
- }
- };
- }
- };
- }
- });
- var require_format_results_cache = __commonJS2({
- "src/cli/format-results-cache.js"(exports2, module2) {
- "use strict";
- var fileEntryCache = require_cache2();
- var stringify2 = require_fast_json_stable_stringify();
- var {
- version: prettierVersion
- } = require("./index.js");
- var {
- createHash
- } = require_utils();
- var optionsHashCache = /* @__PURE__ */ new WeakMap();
- var nodeVersion = process && process.version;
- function getHashOfOptions(options) {
- if (optionsHashCache.has(options)) {
- return optionsHashCache.get(options);
- }
- const hash = createHash(`${prettierVersion}_${nodeVersion}_${stringify2(options)}`);
- optionsHashCache.set(options, hash);
- return hash;
- }
- function getMetadataFromFileDescriptor(fileDescriptor) {
- return fileDescriptor.meta;
- }
- var FormatResultsCache = class {
- constructor(cacheFileLocation, cacheStrategy) {
- const useChecksum = cacheStrategy === "content";
- this.cacheFileLocation = cacheFileLocation;
- this.fileEntryCache = fileEntryCache.create(cacheFileLocation, void 0, useChecksum);
- }
- existsAvailableFormatResultsCache(filePath, options) {
- const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
- if (fileDescriptor.notFound) {
- return false;
- }
- const hashOfOptions = getHashOfOptions(options);
- const meta = getMetadataFromFileDescriptor(fileDescriptor);
- const changed = fileDescriptor.changed || meta.hashOfOptions !== hashOfOptions;
- return !changed;
- }
- setFormatResultsCache(filePath, options) {
- const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
- const meta = getMetadataFromFileDescriptor(fileDescriptor);
- if (fileDescriptor && !fileDescriptor.notFound) {
- meta.hashOfOptions = getHashOfOptions(options);
- }
- }
- removeFormatResultsCache(filePath) {
- this.fileEntryCache.removeEntry(filePath);
- }
- reconcile() {
- this.fileEntryCache.reconcile();
- }
- };
- module2.exports = FormatResultsCache;
- }
- });
- var require_base = __commonJS2({
- "node_modules/diff/lib/diff/base.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2["default"] = Diff;
- function Diff() {
- }
- Diff.prototype = {
- diff: function diff(oldString, newString) {
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
- var callback = options.callback;
- if (typeof options === "function") {
- callback = options;
- options = {};
- }
- this.options = options;
- var self2 = this;
- function done(value) {
- if (callback) {
- setTimeout(function() {
- callback(void 0, value);
- }, 0);
- return true;
- } else {
- return value;
- }
- }
- oldString = this.castInput(oldString);
- newString = this.castInput(newString);
- oldString = this.removeEmpty(this.tokenize(oldString));
- newString = this.removeEmpty(this.tokenize(newString));
- var newLen = newString.length, oldLen = oldString.length;
- var editLength = 1;
- var maxEditLength = newLen + oldLen;
- var bestPath = [{
- newPos: -1,
- components: []
- }];
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
- return done([{
- value: this.join(newString),
- count: newString.length
- }]);
- }
- function execEditLength() {
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
- var basePath = void 0;
- var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
- if (addPath) {
- bestPath[diagonalPath - 1] = void 0;
- }
- var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
- if (!canAdd && !canRemove) {
- bestPath[diagonalPath] = void 0;
- continue;
- }
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
- basePath = clonePath(removePath);
- self2.pushComponent(basePath.components, void 0, true);
- } else {
- basePath = addPath;
- basePath.newPos++;
- self2.pushComponent(basePath.components, true, void 0);
- }
- _oldPos = self2.extractCommon(basePath, newString, oldString, diagonalPath);
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
- return done(buildValues(self2, basePath.components, newString, oldString, self2.useLongestToken));
- } else {
- bestPath[diagonalPath] = basePath;
- }
- }
- editLength++;
- }
- if (callback) {
- (function exec() {
- setTimeout(function() {
- if (editLength > maxEditLength) {
- return callback();
- }
- if (!execEditLength()) {
- exec();
- }
- }, 0);
- })();
- } else {
- while (editLength <= maxEditLength) {
- var ret = execEditLength();
- if (ret) {
- return ret;
- }
- }
- }
- },
- pushComponent: function pushComponent(components, added, removed) {
- var last = components[components.length - 1];
- if (last && last.added === added && last.removed === removed) {
- components[components.length - 1] = {
- count: last.count + 1,
- added,
- removed
- };
- } else {
- components.push({
- count: 1,
- added,
- removed
- });
- }
- },
- extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
- var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0;
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
- newPos++;
- oldPos++;
- commonCount++;
- }
- if (commonCount) {
- basePath.components.push({
- count: commonCount
- });
- }
- basePath.newPos = newPos;
- return oldPos;
- },
- equals: function equals(left, right) {
- if (this.options.comparator) {
- return this.options.comparator(left, right);
- } else {
- return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
- }
- },
- removeEmpty: function removeEmpty(array2) {
- var ret = [];
- for (var i = 0; i < array2.length; i++) {
- if (array2[i]) {
- ret.push(array2[i]);
- }
- }
- return ret;
- },
- castInput: function castInput(value) {
- return value;
- },
- tokenize: function tokenize(value) {
- return value.split("");
- },
- join: function join(chars) {
- return chars.join("");
- }
- };
- function buildValues(diff, components, newString, oldString, useLongestToken) {
- var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
- for (; componentPos < componentLen; componentPos++) {
- var component = components[componentPos];
- if (!component.removed) {
- if (!component.added && useLongestToken) {
- var value = newString.slice(newPos, newPos + component.count);
- value = value.map(function(value2, i) {
- var oldValue = oldString[oldPos + i];
- return oldValue.length > value2.length ? oldValue : value2;
- });
- component.value = diff.join(value);
- } else {
- component.value = diff.join(newString.slice(newPos, newPos + component.count));
- }
- newPos += component.count;
- if (!component.added) {
- oldPos += component.count;
- }
- } else {
- component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
- oldPos += component.count;
- if (componentPos && components[componentPos - 1].added) {
- var tmp = components[componentPos - 1];
- components[componentPos - 1] = components[componentPos];
- components[componentPos] = tmp;
- }
- }
- }
- var lastComponent = components[componentLen - 1];
- if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff.equals("", lastComponent.value)) {
- components[componentLen - 2].value += lastComponent.value;
- components.pop();
- }
- return components;
- }
- function clonePath(path) {
- return {
- newPos: path.newPos,
- components: path.components.slice(0)
- };
- }
- }
- });
- var require_params = __commonJS2({
- "node_modules/diff/lib/util/params.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.generateOptions = generateOptions;
- function generateOptions(options, defaults) {
- if (typeof options === "function") {
- defaults.callback = options;
- } else if (options) {
- for (var name in options) {
- if (options.hasOwnProperty(name)) {
- defaults[name] = options[name];
- }
- }
- }
- return defaults;
- }
- }
- });
- var require_line = __commonJS2({
- "node_modules/diff/lib/diff/line.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.diffLines = diffLines;
- exports2.diffTrimmedLines = diffTrimmedLines;
- exports2.lineDiff = void 0;
- var _base = _interopRequireDefault(require_base());
- var _params = require_params();
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
- }
- var lineDiff = new _base["default"]();
- exports2.lineDiff = lineDiff;
- lineDiff.tokenize = function(value) {
- var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
- linesAndNewlines.pop();
- }
- for (var i = 0; i < linesAndNewlines.length; i++) {
- var line = linesAndNewlines[i];
- if (i % 2 && !this.options.newlineIsToken) {
- retLines[retLines.length - 1] += line;
- } else {
- if (this.options.ignoreWhitespace) {
- line = line.trim();
- }
- retLines.push(line);
- }
- }
- return retLines;
- };
- function diffLines(oldStr, newStr, callback) {
- return lineDiff.diff(oldStr, newStr, callback);
- }
- function diffTrimmedLines(oldStr, newStr, callback) {
- var options = (0, _params.generateOptions)(callback, {
- ignoreWhitespace: true
- });
- return lineDiff.diff(oldStr, newStr, options);
- }
- }
- });
- var require_create = __commonJS2({
- "node_modules/diff/lib/patch/create.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", {
- value: true
- });
- exports2.structuredPatch = structuredPatch;
- exports2.formatPatch = formatPatch;
- exports2.createTwoFilesPatch = createTwoFilesPatch;
- exports2.createPatch = createPatch;
- var _line = require_line();
- function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
- }
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray(o, minLen);
- }
- function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
- return Array.from(iter);
- }
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr))
- return _arrayLikeToArray(arr);
- }
- function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- if (!options) {
- options = {};
- }
- if (typeof options.context === "undefined") {
- options.context = 4;
- }
- var diff = (0, _line.diffLines)(oldStr, newStr, options);
- diff.push({
- value: "",
- lines: []
- });
- function contextLines(lines) {
- return lines.map(function(entry) {
- return " " + entry;
- });
- }
- var hunks = [];
- var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
- var _loop = function _loop2(i2) {
- var current = diff[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n");
- current.lines = lines;
- if (current.added || current.removed) {
- var _curRange;
- if (!oldRangeStart) {
- var prev = diff[i2 - 1];
- oldRangeStart = oldLine;
- newRangeStart = newLine;
- if (prev) {
- curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
- oldRangeStart -= curRange.length;
- newRangeStart -= curRange.length;
- }
- }
- (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function(entry) {
- return (current.added ? "+" : "-") + entry;
- })));
- if (current.added) {
- newLine += lines.length;
- } else {
- oldLine += lines.length;
- }
- } else {
- if (oldRangeStart) {
- if (lines.length <= options.context * 2 && i2 < diff.length - 2) {
- var _curRange2;
- (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
- } else {
- var _curRange3;
- var contextSize = Math.min(lines.length, options.context);
- (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
- var hunk = {
- oldStart: oldRangeStart,
- oldLines: oldLine - oldRangeStart + contextSize,
- newStart: newRangeStart,
- newLines: newLine - newRangeStart + contextSize,
- lines: curRange
- };
- if (i2 >= diff.length - 2 && lines.length <= options.context) {
- var oldEOFNewline = /\n$/.test(oldStr);
- var newEOFNewline = /\n$/.test(newStr);
- var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
- if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
- curRange.splice(hunk.oldLines, 0, "\\ No newline at end of file");
- }
- if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
- curRange.push("\\ No newline at end of file");
- }
- }
- hunks.push(hunk);
- oldRangeStart = 0;
- newRangeStart = 0;
- curRange = [];
- }
- }
- oldLine += lines.length;
- newLine += lines.length;
- }
- };
- for (var i = 0; i < diff.length; i++) {
- _loop(i);
- }
- return {
- oldFileName,
- newFileName,
- oldHeader,
- newHeader,
- hunks
- };
- }
- function formatPatch(diff) {
- var ret = [];
- if (diff.oldFileName == diff.newFileName) {
- ret.push("Index: " + diff.oldFileName);
- }
- ret.push("===================================================================");
- ret.push("--- " + diff.oldFileName + (typeof diff.oldHeader === "undefined" ? "" : " " + diff.oldHeader));
- ret.push("+++ " + diff.newFileName + (typeof diff.newHeader === "undefined" ? "" : " " + diff.newHeader));
- for (var i = 0; i < diff.hunks.length; i++) {
- var hunk = diff.hunks[i];
- if (hunk.oldLines === 0) {
- hunk.oldStart -= 1;
- }
- if (hunk.newLines === 0) {
- hunk.newStart -= 1;
- }
- ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
- ret.push.apply(ret, hunk.lines);
- }
- return ret.join("\n") + "\n";
- }
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
- }
- function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
- return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
- }
- }
- });
- var require_format = __commonJS2({
- "src/cli/format.js"(exports2, module2) {
- "use strict";
- var {
- promises: fs
- } = require("fs");
- var path = require("path");
- var {
- default: chalk2
- } = (init_source(), __toCommonJS(source_exports));
- var prettier2 = require("./index.js");
- var {
- getStdin
- } = require("./third-party.js");
- var {
- createIgnorer,
- errors
- } = require_prettier_internal();
- var {
- expandPatterns,
- fixWindowsSlashes
- } = require_expand_patterns();
- var getOptionsForFile = require_get_options_for_file();
- var isTTY = require_is_tty();
- var findCacheFile = require_find_cache_file();
- var FormatResultsCache = require_format_results_cache();
- var {
- statSafe
- } = require_utils();
- function diff(a, b) {
- return require_create().createTwoFilesPatch("", "", a, b, "", "", {
- context: 2
- });
- }
- function handleError(context, filename, error, printedFilename) {
- if (error instanceof errors.UndefinedParserError) {
- if ((context.argv.write || context.argv.ignoreUnknown) && printedFilename) {
- printedFilename.clear();
- }
- if (context.argv.ignoreUnknown) {
- return;
- }
- if (!context.argv.check && !context.argv.listDifferent) {
- process.exitCode = 2;
- }
- context.logger.error(error.message);
- return;
- }
- if (context.argv.write) {
- process.stdout.write("\n");
- }
- const isParseError = Boolean(error && error.loc);
- const isValidationError = /^Invalid \S+ value\./.test(error && error.message);
- if (isParseError) {
- context.logger.error(`${filename}: ${String(error)}`);
- } else if (isValidationError || error instanceof errors.ConfigError) {
- context.logger.error(error.message);
- process.exit(1);
- } else if (error instanceof errors.DebugError) {
- context.logger.error(`${filename}: ${error.message}`);
- } else {
- context.logger.error(filename + ": " + (error.stack || error));
- }
- process.exitCode = 2;
- }
- function writeOutput(context, result, options) {
- process.stdout.write(context.argv.debugCheck ? result.filepath : result.formatted);
- if (options && options.cursorOffset >= 0) {
- process.stderr.write(result.cursorOffset + "\n");
- }
- }
- function listDifferent(context, input, options, filename) {
- if (!context.argv.check && !context.argv.listDifferent) {
- return;
- }
- try {
- if (!options.filepath && !options.parser) {
- throw new errors.UndefinedParserError("No parser and no file path given, couldn't infer a parser.");
- }
- if (!prettier2.check(input, options)) {
- if (!context.argv.write) {
- context.logger.log(filename);
- process.exitCode = 1;
- }
- }
- } catch (error) {
- context.logger.error(error.message);
- }
- return true;
- }
- function format(context, input, opt) {
- if (!opt.parser && !opt.filepath) {
- throw new errors.UndefinedParserError("No parser and no file path given, couldn't infer a parser.");
- }
- if (context.argv.debugPrintDoc) {
- const doc = prettier2.__debug.printToDoc(input, opt);
- return {
- formatted: prettier2.__debug.formatDoc(doc) + "\n"
- };
- }
- if (context.argv.debugPrintComments) {
- return {
- formatted: prettier2.format(JSON.stringify(prettier2.formatWithCursor(input, opt).comments || []), {
- parser: "json"
- })
- };
- }
- if (context.argv.debugPrintAst) {
- const {
- ast
- } = prettier2.__debug.parse(input, opt);
- return {
- formatted: JSON.stringify(ast)
- };
- }
- if (context.argv.debugCheck) {
- const pp = prettier2.format(input, opt);
- const pppp = prettier2.format(pp, opt);
- if (pp !== pppp) {
- throw new errors.DebugError("prettier(input) !== prettier(prettier(input))\n" + diff(pp, pppp));
- } else {
- const stringify2 = (obj) => JSON.stringify(obj, null, 2);
- const ast = stringify2(prettier2.__debug.parse(input, opt, true).ast);
- const past = stringify2(prettier2.__debug.parse(pp, opt, true).ast);
- if (ast !== past) {
- const MAX_AST_SIZE = 2097152;
- const astDiff = ast.length > MAX_AST_SIZE || past.length > MAX_AST_SIZE ? "AST diff too large to render" : diff(ast, past);
- throw new errors.DebugError("ast(input) !== ast(prettier(input))\n" + astDiff + "\n" + diff(input, pp));
- }
- }
- return {
- formatted: pp,
- filepath: opt.filepath || "(stdin)\n"
- };
- }
- const {
- performanceTestFlag
- } = context;
- if (performanceTestFlag !== null && performanceTestFlag !== void 0 && performanceTestFlag.debugBenchmark) {
- let benchmark;
- try {
- benchmark = require("benchmark");
- } catch {
- context.logger.debug("'--debug-benchmark' requires the 'benchmark' package to be installed.");
- process.exit(2);
- }
- context.logger.debug("'--debug-benchmark' option found, measuring formatWithCursor with 'benchmark' module.");
- const suite = new benchmark.Suite();
- suite.add("format", () => {
- prettier2.formatWithCursor(input, opt);
- }).on("cycle", (event) => {
- const results = {
- benchmark: String(event.target),
- hz: event.target.hz,
- ms: event.target.times.cycle * 1e3
- };
- context.logger.debug("'--debug-benchmark' measurements for formatWithCursor: " + JSON.stringify(results, null, 2));
- }).run({
- async: false
- });
- } else if (performanceTestFlag !== null && performanceTestFlag !== void 0 && performanceTestFlag.debugRepeat) {
- const repeat = context.argv.debugRepeat;
- context.logger.debug("'--debug-repeat' option found, running formatWithCursor " + repeat + " times.");
- let totalMs = 0;
- for (let i = 0; i < repeat; ++i) {
- const startMs = Date.now();
- prettier2.formatWithCursor(input, opt);
- totalMs += Date.now() - startMs;
- }
- const averageMs = totalMs / repeat;
- const results = {
- repeat,
- hz: 1e3 / averageMs,
- ms: averageMs
- };
- context.logger.debug("'--debug-repeat' measurements for formatWithCursor: " + JSON.stringify(results, null, 2));
- }
- return prettier2.formatWithCursor(input, opt);
- }
- async function createIgnorerFromContextOrDie(context) {
- try {
- return await createIgnorer(context.argv.ignorePath, context.argv.withNodeModules);
- } catch (e) {
- context.logger.error(e.message);
- process.exit(2);
- }
- }
- async function formatStdin2(context) {
- const filepath = context.argv.filepath ? path.resolve(process.cwd(), context.argv.filepath) : process.cwd();
- const ignorer = await createIgnorerFromContextOrDie(context);
- const relativeFilepath = context.argv.ignorePath ? path.relative(path.dirname(context.argv.ignorePath), filepath) : path.relative(process.cwd(), filepath);
- try {
- const input = await getStdin();
- if (relativeFilepath && ignorer.ignores(fixWindowsSlashes(relativeFilepath))) {
- writeOutput(context, {
- formatted: input
- });
- return;
- }
- const options = await getOptionsForFile(context, filepath);
- if (listDifferent(context, input, options, "(stdin)")) {
- return;
- }
- const formatted = format(context, input, options);
- const {
- performanceTestFlag
- } = context;
- if (performanceTestFlag) {
- context.logger.log(`'${performanceTestFlag.name}' option found, skipped print code to screen.`);
- return;
- }
- writeOutput(context, formatted, options);
- } catch (error) {
- handleError(context, relativeFilepath || "stdin", error);
- }
- }
- async function formatFiles2(context) {
- var _formatResultsCache4;
- const ignorer = await createIgnorerFromContextOrDie(context);
- let numberOfUnformattedFilesFound = 0;
- const {
- performanceTestFlag
- } = context;
- if (context.argv.check && !performanceTestFlag) {
- context.logger.log("Checking formatting...");
- }
- let formatResultsCache;
- const cacheFilePath = await findCacheFile(context.argv.cacheLocation);
- if (context.argv.cache) {
- formatResultsCache = new FormatResultsCache(cacheFilePath, context.argv.cacheStrategy || "content");
- } else {
- if (context.argv.cacheStrategy) {
- context.logger.error("`--cache-strategy` cannot be used without `--cache`.");
- process.exit(2);
- }
- if (!context.argv.cacheLocation) {
- const stat = await statSafe(cacheFilePath);
- if (stat) {
- await fs.unlink(cacheFilePath);
- }
- }
- }
- for await (const pathOrError of expandPatterns(context)) {
- var _formatResultsCache;
- if (typeof pathOrError === "object") {
- context.logger.error(pathOrError.error);
- process.exitCode = 2;
- continue;
- }
- const filename = pathOrError;
- const ignoreFilename = context.argv.ignorePath ? path.relative(path.dirname(context.argv.ignorePath), filename) : filename;
- const fileIgnored = ignorer.ignores(fixWindowsSlashes(ignoreFilename));
- if (fileIgnored && (context.argv.debugCheck || context.argv.write || context.argv.check || context.argv.listDifferent)) {
- continue;
- }
- const options = Object.assign(Object.assign({}, await getOptionsForFile(context, filename)), {}, {
- filepath: filename
- });
- let printedFilename;
- if (isTTY()) {
- printedFilename = context.logger.log(filename, {
- newline: false,
- clearable: true
- });
- }
- let input;
- try {
- input = await fs.readFile(filename, "utf8");
- } catch (error) {
- context.logger.log("");
- context.logger.error(`Unable to read file: ${filename}
- ${error.message}`);
- process.exitCode = 2;
- continue;
- }
- if (fileIgnored) {
- writeOutput(context, {
- formatted: input
- }, options);
- continue;
- }
- const start = Date.now();
- const isCacheExists = (_formatResultsCache = formatResultsCache) === null || _formatResultsCache === void 0 ? void 0 : _formatResultsCache.existsAvailableFormatResultsCache(filename, options);
- let result;
- let output;
- try {
- if (isCacheExists) {
- result = {
- formatted: input
- };
- } else {
- result = format(context, input, options);
- }
- output = result.formatted;
- } catch (error) {
- handleError(context, filename, error, printedFilename);
- continue;
- }
- const isDifferent = output !== input;
- let shouldSetCache = !isDifferent;
- if (printedFilename) {
- printedFilename.clear();
- }
- if (performanceTestFlag) {
- context.logger.log(`'${performanceTestFlag.name}' option found, skipped print code or write files.`);
- return;
- }
- if (context.argv.write) {
- if (isDifferent) {
- if (!context.argv.check && !context.argv.listDifferent) {
- context.logger.log(`${filename} ${Date.now() - start}ms`);
- }
- try {
- await fs.writeFile(filename, output, "utf8");
- shouldSetCache = true;
- } catch (error) {
- context.logger.error(`Unable to write file: ${filename}
- ${error.message}`);
- process.exitCode = 2;
- }
- } else if (!context.argv.check && !context.argv.listDifferent) {
- const message = `${chalk2.grey(filename)} ${Date.now() - start}ms`;
- if (isCacheExists) {
- context.logger.log(`${message} (cached)`);
- } else {
- context.logger.log(message);
- }
- }
- } else if (context.argv.debugCheck) {
- if (result.filepath) {
- context.logger.log(result.filepath);
- } else {
- process.exitCode = 2;
- }
- } else if (!context.argv.check && !context.argv.listDifferent) {
- writeOutput(context, result, options);
- }
- if (shouldSetCache) {
- var _formatResultsCache2;
- (_formatResultsCache2 = formatResultsCache) === null || _formatResultsCache2 === void 0 ? void 0 : _formatResultsCache2.setFormatResultsCache(filename, options);
- } else {
- var _formatResultsCache3;
- (_formatResultsCache3 = formatResultsCache) === null || _formatResultsCache3 === void 0 ? void 0 : _formatResultsCache3.removeFormatResultsCache(filename);
- }
- if (isDifferent) {
- if (context.argv.check) {
- context.logger.warn(filename);
- } else if (context.argv.listDifferent) {
- context.logger.log(filename);
- }
- numberOfUnformattedFilesFound += 1;
- }
- }
- (_formatResultsCache4 = formatResultsCache) === null || _formatResultsCache4 === void 0 ? void 0 : _formatResultsCache4.reconcile();
- if (context.argv.check) {
- if (numberOfUnformattedFilesFound === 0) {
- context.logger.log("All matched files use Prettier code style!");
- } else if (numberOfUnformattedFilesFound === 1) {
- context.logger.warn(context.argv.write ? "Code style issues fixed in the above file." : "Code style issues found in the above file. Forgot to run Prettier?");
- } else {
- context.logger.warn(context.argv.write ? "Code style issues found in " + numberOfUnformattedFilesFound + " files." : "Code style issues found in " + numberOfUnformattedFilesFound + " files. Forgot to run Prettier?");
- }
- }
- if ((context.argv.check || context.argv.listDifferent) && numberOfUnformattedFilesFound > 0 && !process.exitCode && !context.argv.write) {
- process.exitCode = 1;
- }
- }
- module2.exports = {
- formatStdin: formatStdin2,
- formatFiles: formatFiles2
- };
- }
- });
- var require_file_info = __commonJS2({
- "src/cli/file-info.js"(exports2, module2) {
- "use strict";
- var stringify2 = require_fast_json_stable_stringify();
- var prettier2 = require("./index.js");
- var {
- printToScreen: printToScreen2
- } = require_utils();
- async function logFileInfoOrDie2(context) {
- const {
- fileInfo: file,
- ignorePath,
- withNodeModules,
- plugins,
- pluginSearchDirs,
- config
- } = context.argv;
- const fileInfo = await prettier2.getFileInfo(file, {
- ignorePath,
- withNodeModules,
- plugins,
- pluginSearchDirs,
- resolveConfig: config !== false
- });
- printToScreen2(prettier2.format(stringify2(fileInfo), {
- parser: "json"
- }));
- }
- module2.exports = logFileInfoOrDie2;
- }
- });
- var require_find_config_path = __commonJS2({
- "src/cli/find-config-path.js"(exports2, module2) {
- "use strict";
- var path = require("path");
- var prettier2 = require("./index.js");
- var {
- printToScreen: printToScreen2
- } = require_utils();
- async function logResolvedConfigPathOrDie2(context) {
- const file = context.argv.findConfigPath;
- const configFile = await prettier2.resolveConfigFile(file);
- if (configFile) {
- printToScreen2(path.relative(process.cwd(), configFile));
- } else {
- throw new Error(`Can not find configure file for "${file}"`);
- }
- }
- module2.exports = logResolvedConfigPathOrDie2;
- }
- });
- var stringify = require_fast_json_stable_stringify();
- var prettier = require("./index.js");
- var createLogger = require_logger();
- var Context = require_context();
- var {
- parseArgvWithoutPlugins
- } = require_parse_cli_arguments();
- var {
- createDetailedUsage,
- createUsage
- } = require_usage();
- var {
- formatStdin,
- formatFiles
- } = require_format();
- var logFileInfoOrDie = require_file_info();
- var logResolvedConfigPathOrDie = require_find_config_path();
- var {
- utils: {
- isNonEmptyArray
- }
- } = require_prettier_internal();
- var {
- printToScreen
- } = require_utils();
- async function run(rawArguments) {
- let logger = createLogger();
- try {
- const logLevel = parseArgvWithoutPlugins(rawArguments, logger, "loglevel").loglevel;
- if (logLevel !== logger.logLevel) {
- logger = createLogger(logLevel);
- }
- const context = new Context({
- rawArguments,
- logger
- });
- if (logger.logLevel !== "debug" && context.performanceTestFlag) {
- context.logger = createLogger("debug");
- }
- await main(context);
- } catch (error) {
- logger.error(error.message);
- process.exitCode = 1;
- }
- }
- async function main(context) {
- context.logger.debug(`normalized argv: ${JSON.stringify(context.argv)}`);
- if (context.argv.pluginSearch === false) {
- const rawPluginSearchDirs = context.argv.__raw["plugin-search-dir"];
- if (typeof rawPluginSearchDirs === "string" || isNonEmptyArray(rawPluginSearchDirs)) {
- throw new Error("Cannot use --no-plugin-search and --plugin-search-dir together.");
- }
- }
- if (context.argv.check && context.argv.listDifferent) {
- throw new Error("Cannot use --check and --list-different together.");
- }
- if (context.argv.write && context.argv.debugCheck) {
- throw new Error("Cannot use --write and --debug-check together.");
- }
- if (context.argv.findConfigPath && context.filePatterns.length > 0) {
- throw new Error("Cannot use --find-config-path with multiple files");
- }
- if (context.argv.fileInfo && context.filePatterns.length > 0) {
- throw new Error("Cannot use --file-info with multiple files");
- }
- if (context.argv.version) {
- printToScreen(prettier.version);
- return;
- }
- if (context.argv.help !== void 0) {
- printToScreen(typeof context.argv.help === "string" && context.argv.help !== "" ? createDetailedUsage(context, context.argv.help) : createUsage(context));
- return;
- }
- if (context.argv.supportInfo) {
- printToScreen(prettier.format(stringify(prettier.getSupportInfo()), {
- parser: "json"
- }));
- return;
- }
- const hasFilePatterns = context.filePatterns.length > 0;
- const useStdin = !hasFilePatterns && (!process.stdin.isTTY || context.argv.filePath);
- if (context.argv.findConfigPath) {
- await logResolvedConfigPathOrDie(context);
- } else if (context.argv.fileInfo) {
- await logFileInfoOrDie(context);
- } else if (useStdin) {
- if (context.argv.cache) {
- context.logger.error("`--cache` cannot be used with stdin.");
- process.exit(2);
- }
- await formatStdin(context);
- } else if (hasFilePatterns) {
- await formatFiles(context);
- } else {
- process.exitCode = 1;
- printToScreen(createUsage(context));
- }
- }
- module.exports = {
- run
- };
|