1 Star 0 Fork 0

CherishTheYouth/create-vue-code-analysis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
outfile-v1.cjs 139.74 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173
#!/usr/bin/env node
/*! create-vue v3.6.4 | MIT */
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(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 __getOwnPropNames(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(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// node_modules/.pnpm/registry.npmmirror.com+minimist@1.2.8/node_modules/minimist/index.js
var require_minimist = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+minimist@1.2.8/node_modules/minimist/index.js"(exports, module2) {
"use strict";
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__";
}
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 = {};
function aliasIsBoolean(key2) {
return aliases[key2].some(function(x) {
return flags.bools[x];
});
}
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]) {
[].concat(aliases[key2]).forEach(function(k) {
flags.strings[k] = true;
});
}
});
var defaults = opts.default || {};
var argv = { _: [] };
function argDefined(key2, arg2) {
return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
}
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 lastKey = keys[keys.length - 1];
if (isConstructorOrProto(o, lastKey)) {
return;
}
if (o === Object.prototype || o === Number.prototype || o === String.prototype) {
o = {};
}
if (o === Array.prototype) {
o = [];
}
if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") {
o[lastKey] = value2;
} else if (Array.isArray(o[lastKey])) {
o[lastKey].push(value2);
} else {
o[lastKey] = [o[lastKey], value2];
}
}
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);
});
}
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("--"));
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
var key;
var next;
if (/^--.+=/.test(arg)) {
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
key = m[1];
var value = m[2];
if (flags.bools[key]) {
value = value !== "false";
}
setArg(key, value, arg);
} else if (/^--no-.+/.test(arg)) {
key = arg.match(/^--no-(.+)/)[1];
setArg(key, false, arg);
} else if (/^--.+/.test(arg)) {
key = arg.match(/^--(.+)/)[1];
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 += 1;
} else if (/^(true|false)$/.test(next)) {
setArg(key, next === "true", arg);
i += 1;
} 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++) {
next = arg.slice(j + 2);
if (next === "-") {
setArg(letters[j], next, arg);
continue;
}
if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
setArg(letters[j], next.slice(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);
}
}
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 += 1;
} else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
setArg(key, args[i + 1] === "true", arg);
i += 1;
} 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(k) {
if (!hasKey(argv, k.split("."))) {
setKey(argv, k.split("."), defaults[k]);
(aliases[k] || []).forEach(function(x) {
setKey(argv, x.split("."), defaults[k]);
});
}
});
if (opts["--"]) {
argv["--"] = notFlags.slice();
} else {
notFlags.forEach(function(k) {
argv._.push(k);
});
}
return argv;
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+kleur@3.0.3/node_modules/kleur/index.js
var require_kleur = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+kleur@3.0.3/node_modules/kleur/index.js"(exports, module2) {
"use strict";
var { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env;
var $ = {
enabled: !NODE_DISABLE_COLORS && TERM !== "dumb" && FORCE_COLOR !== "0",
// modifiers
reset: init2(0, 0),
bold: init2(1, 22),
dim: init2(2, 22),
italic: init2(3, 23),
underline: init2(4, 24),
inverse: init2(7, 27),
hidden: init2(8, 28),
strikethrough: init2(9, 29),
// colors
black: init2(30, 39),
red: init2(31, 39),
green: init2(32, 39),
yellow: init2(33, 39),
blue: init2(34, 39),
magenta: init2(35, 39),
cyan: init2(36, 39),
white: init2(37, 39),
gray: init2(90, 39),
grey: init2(90, 39),
// background colors
bgBlack: init2(40, 49),
bgRed: init2(41, 49),
bgGreen: init2(42, 49),
bgYellow: init2(43, 49),
bgBlue: init2(44, 49),
bgMagenta: init2(45, 49),
bgCyan: init2(46, 49),
bgWhite: init2(47, 49)
};
function run(arr, str) {
let i = 0, tmp, beg = "", end = "";
for (; i < arr.length; i++) {
tmp = arr[i];
beg += tmp.open;
end += tmp.close;
if (str.includes(tmp.close)) {
str = str.replace(tmp.rgx, tmp.close + tmp.open);
}
}
return beg + str + end;
}
function chain(has, keys) {
let ctx = { has, keys };
ctx.reset = $.reset.bind(ctx);
ctx.bold = $.bold.bind(ctx);
ctx.dim = $.dim.bind(ctx);
ctx.italic = $.italic.bind(ctx);
ctx.underline = $.underline.bind(ctx);
ctx.inverse = $.inverse.bind(ctx);
ctx.hidden = $.hidden.bind(ctx);
ctx.strikethrough = $.strikethrough.bind(ctx);
ctx.black = $.black.bind(ctx);
ctx.red = $.red.bind(ctx);
ctx.green = $.green.bind(ctx);
ctx.yellow = $.yellow.bind(ctx);
ctx.blue = $.blue.bind(ctx);
ctx.magenta = $.magenta.bind(ctx);
ctx.cyan = $.cyan.bind(ctx);
ctx.white = $.white.bind(ctx);
ctx.gray = $.gray.bind(ctx);
ctx.grey = $.grey.bind(ctx);
ctx.bgBlack = $.bgBlack.bind(ctx);
ctx.bgRed = $.bgRed.bind(ctx);
ctx.bgGreen = $.bgGreen.bind(ctx);
ctx.bgYellow = $.bgYellow.bind(ctx);
ctx.bgBlue = $.bgBlue.bind(ctx);
ctx.bgMagenta = $.bgMagenta.bind(ctx);
ctx.bgCyan = $.bgCyan.bind(ctx);
ctx.bgWhite = $.bgWhite.bind(ctx);
return ctx;
}
function init2(open, close) {
let blk = {
open: `\x1B[${open}m`,
close: `\x1B[${close}m`,
rgx: new RegExp(`\\x1b\\[${close}m`, "g")
};
return function(txt) {
if (this !== void 0 && this.has !== void 0) {
this.has.includes(open) || (this.has.push(open), this.keys.push(blk));
return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
}
return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
};
}
module2.exports = $;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/action.js
var require_action = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/action.js"(exports, module2) {
"use strict";
module2.exports = (key, isSelect) => {
if (key.meta && key.name !== "escape")
return;
if (key.ctrl) {
if (key.name === "a")
return "first";
if (key.name === "c")
return "abort";
if (key.name === "d")
return "abort";
if (key.name === "e")
return "last";
if (key.name === "g")
return "reset";
}
if (isSelect) {
if (key.name === "j")
return "down";
if (key.name === "k")
return "up";
}
if (key.name === "return")
return "submit";
if (key.name === "enter")
return "submit";
if (key.name === "backspace")
return "delete";
if (key.name === "delete")
return "deleteForward";
if (key.name === "abort")
return "abort";
if (key.name === "escape")
return "exit";
if (key.name === "tab")
return "next";
if (key.name === "pagedown")
return "nextPage";
if (key.name === "pageup")
return "prevPage";
if (key.name === "home")
return "home";
if (key.name === "end")
return "end";
if (key.name === "up")
return "up";
if (key.name === "down")
return "down";
if (key.name === "right")
return "right";
if (key.name === "left")
return "left";
return false;
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/strip.js
var require_strip = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/strip.js"(exports, module2) {
"use strict";
module2.exports = (str) => {
const pattern = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
].join("|");
const RGX = new RegExp(pattern, "g");
return typeof str === "string" ? str.replace(RGX, "") : str;
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+sisteransi@1.0.5/node_modules/sisteransi/src/index.js
var require_src = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module2) {
"use strict";
var ESC = "\x1B";
var CSI = `${ESC}[`;
var beep = "\x07";
var cursor = {
to(x, y) {
if (!y)
return `${CSI}${x + 1}G`;
return `${CSI}${y + 1};${x + 1}H`;
},
move(x, y) {
let ret = "";
if (x < 0)
ret += `${CSI}${-x}D`;
else if (x > 0)
ret += `${CSI}${x}C`;
if (y < 0)
ret += `${CSI}${-y}A`;
else if (y > 0)
ret += `${CSI}${y}B`;
return ret;
},
up: (count = 1) => `${CSI}${count}A`,
down: (count = 1) => `${CSI}${count}B`,
forward: (count = 1) => `${CSI}${count}C`,
backward: (count = 1) => `${CSI}${count}D`,
nextLine: (count = 1) => `${CSI}E`.repeat(count),
prevLine: (count = 1) => `${CSI}F`.repeat(count),
left: `${CSI}G`,
hide: `${CSI}?25l`,
show: `${CSI}?25h`,
save: `${ESC}7`,
restore: `${ESC}8`
};
var scroll = {
up: (count = 1) => `${CSI}S`.repeat(count),
down: (count = 1) => `${CSI}T`.repeat(count)
};
var erase = {
screen: `${CSI}2J`,
up: (count = 1) => `${CSI}1J`.repeat(count),
down: (count = 1) => `${CSI}J`.repeat(count),
line: `${CSI}2K`,
lineEnd: `${CSI}K`,
lineStart: `${CSI}1K`,
lines(count) {
let clear = "";
for (let i = 0; i < count; i++)
clear += this.line + (i < count - 1 ? cursor.up() : "");
if (count)
clear += cursor.left;
return clear;
}
};
module2.exports = { cursor, scroll, erase, beep };
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/clear.js
var require_clear = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/clear.js"(exports, module2) {
"use strict";
var strip = require_strip();
var { erase, cursor } = require_src();
var width = (str) => [...strip(str)].length;
module2.exports = function(prompt, perLine) {
if (!perLine)
return erase.line + cursor.to(0);
let rows = 0;
const lines = prompt.split(/\r?\n/);
for (let line of lines) {
rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
}
return erase.lines(rows);
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/figures.js
var require_figures = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/figures.js"(exports, module2) {
"use strict";
var main = {
arrowUp: "\u2191",
arrowDown: "\u2193",
arrowLeft: "\u2190",
arrowRight: "\u2192",
radioOn: "\u25C9",
radioOff: "\u25EF",
tick: "\u2714",
cross: "\u2716",
ellipsis: "\u2026",
pointerSmall: "\u203A",
line: "\u2500",
pointer: "\u276F"
};
var win = {
arrowUp: main.arrowUp,
arrowDown: main.arrowDown,
arrowLeft: main.arrowLeft,
arrowRight: main.arrowRight,
radioOn: "(*)",
radioOff: "( )",
tick: "\u221A",
cross: "\xD7",
ellipsis: "...",
pointerSmall: "\xBB",
line: "\u2500",
pointer: ">"
};
var figures = process.platform === "win32" ? win : main;
module2.exports = figures;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/style.js
var require_style = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/style.js"(exports, module2) {
"use strict";
var c = require_kleur();
var figures = require_figures();
var styles = Object.freeze({
password: { scale: 1, render: (input) => "*".repeat(input.length) },
emoji: { scale: 2, render: (input) => "\u{1F603}".repeat(input.length) },
invisible: { scale: 0, render: (input) => "" },
default: { scale: 1, render: (input) => `${input}` }
});
var render = (type) => styles[type] || styles.default;
var symbols = Object.freeze({
aborted: c.red(figures.cross),
done: c.green(figures.tick),
exited: c.yellow(figures.cross),
default: c.cyan("?")
});
var symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default;
var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
module2.exports = {
styles,
render,
symbols,
symbol,
delimiter,
item
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/lines.js
var require_lines = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/lines.js"(exports, module2) {
"use strict";
var strip = require_strip();
module2.exports = function(msg, perLine) {
let lines = String(strip(msg) || "").split(/\r?\n/);
if (!perLine)
return lines.length;
return lines.map((l) => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/wrap.js
var require_wrap = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/wrap.js"(exports, module2) {
"use strict";
module2.exports = (msg, opts = {}) => {
const tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(" ").join("") : opts.margin || "";
const width = opts.width;
return (msg || "").split(/\r?\n/g).map((line) => line.split(/\s+/g).reduce((arr, w) => {
if (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width)
arr[arr.length - 1] += ` ${w}`;
else
arr.push(`${tab}${w}`);
return arr;
}, [tab]).join("\n")).join("\n");
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/entriesToDisplay.js
var require_entriesToDisplay = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/entriesToDisplay.js"(exports, module2) {
"use strict";
module2.exports = (cursor, total, maxVisible) => {
maxVisible = maxVisible || total;
let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
if (startIndex < 0)
startIndex = 0;
let endIndex = Math.min(startIndex + maxVisible, total);
return { startIndex, endIndex };
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/index.js
var require_util = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/util/index.js"(exports, module2) {
"use strict";
module2.exports = {
action: require_action(),
clear: require_clear(),
style: require_style(),
strip: require_strip(),
figures: require_figures(),
lines: require_lines(),
wrap: require_wrap(),
entriesToDisplay: require_entriesToDisplay()
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/prompt.js
var require_prompt = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/prompt.js"(exports, module2) {
"use strict";
var readline = require("readline");
var { action } = require_util();
var EventEmitter = require("events");
var { beep, cursor } = require_src();
var color = require_kleur();
var Prompt = class extends EventEmitter {
constructor(opts = {}) {
super();
this.firstRender = true;
this.in = opts.stdin || process.stdin;
this.out = opts.stdout || process.stdout;
this.onRender = (opts.onRender || (() => void 0)).bind(this);
const rl = readline.createInterface({ input: this.in, escapeCodeTimeout: 50 });
readline.emitKeypressEvents(this.in, rl);
if (this.in.isTTY)
this.in.setRawMode(true);
const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
const keypress = (str, key) => {
let a = action(key, isSelect);
if (a === false) {
this._ && this._(str, key);
} else if (typeof this[a] === "function") {
this[a](key);
} else {
this.bell();
}
};
this.close = () => {
this.out.write(cursor.show);
this.in.removeListener("keypress", keypress);
if (this.in.isTTY)
this.in.setRawMode(false);
rl.close();
this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value);
this.closed = true;
};
this.in.on("keypress", keypress);
}
fire() {
this.emit("state", {
value: this.value,
aborted: !!this.aborted,
exited: !!this.exited
});
}
bell() {
this.out.write(beep);
}
render() {
this.onRender(color);
if (this.firstRender)
this.firstRender = false;
}
};
module2.exports = Prompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/text.js
var require_text = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/text.js"(exports, module2) {
var color = require_kleur();
var Prompt = require_prompt();
var { erase, cursor } = require_src();
var { style, clear, lines, figures } = require_util();
var TextPrompt = class extends Prompt {
constructor(opts = {}) {
super(opts);
this.transform = style.render(opts.style);
this.scale = this.transform.scale;
this.msg = opts.message;
this.initial = opts.initial || ``;
this.validator = opts.validate || (() => true);
this.value = ``;
this.errorMsg = opts.error || `Please Enter A Valid Value`;
this.cursor = Number(!!this.initial);
this.cursorOffset = 0;
this.clear = clear(``, this.out.columns);
this.render();
}
set value(v) {
if (!v && this.initial) {
this.placeholder = true;
this.rendered = color.gray(this.transform.render(this.initial));
} else {
this.placeholder = false;
this.rendered = this.transform.render(v);
}
this._value = v;
this.fire();
}
get value() {
return this._value;
}
reset() {
this.value = ``;
this.cursor = Number(!!this.initial);
this.cursorOffset = 0;
this.fire();
this.render();
}
exit() {
this.abort();
}
abort() {
this.value = this.value || this.initial;
this.done = this.aborted = true;
this.error = false;
this.red = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
async validate() {
let valid = await this.validator(this.value);
if (typeof valid === `string`) {
this.errorMsg = valid;
valid = false;
}
this.error = !valid;
}
async submit() {
this.value = this.value || this.initial;
this.cursorOffset = 0;
this.cursor = this.rendered.length;
await this.validate();
if (this.error) {
this.red = true;
this.fire();
this.render();
return;
}
this.done = true;
this.aborted = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
next() {
if (!this.placeholder)
return this.bell();
this.value = this.initial;
this.cursor = this.rendered.length;
this.fire();
this.render();
}
moveCursor(n) {
if (this.placeholder)
return;
this.cursor = this.cursor + n;
this.cursorOffset += n;
}
_(c, key) {
let s1 = this.value.slice(0, this.cursor);
let s2 = this.value.slice(this.cursor);
this.value = `${s1}${c}${s2}`;
this.red = false;
this.cursor = this.placeholder ? 0 : s1.length + 1;
this.render();
}
delete() {
if (this.isCursorAtStart())
return this.bell();
let s1 = this.value.slice(0, this.cursor - 1);
let s2 = this.value.slice(this.cursor);
this.value = `${s1}${s2}`;
this.red = false;
if (this.isCursorAtStart()) {
this.cursorOffset = 0;
} else {
this.cursorOffset++;
this.moveCursor(-1);
}
this.render();
}
deleteForward() {
if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
return this.bell();
let s1 = this.value.slice(0, this.cursor);
let s2 = this.value.slice(this.cursor + 1);
this.value = `${s1}${s2}`;
this.red = false;
if (this.isCursorAtEnd()) {
this.cursorOffset = 0;
} else {
this.cursorOffset++;
}
this.render();
}
first() {
this.cursor = 0;
this.render();
}
last() {
this.cursor = this.value.length;
this.render();
}
left() {
if (this.cursor <= 0 || this.placeholder)
return this.bell();
this.moveCursor(-1);
this.render();
}
right() {
if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
return this.bell();
this.moveCursor(1);
this.render();
}
isCursorAtStart() {
return this.cursor === 0 || this.placeholder && this.cursor === 1;
}
isCursorAtEnd() {
return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
}
render() {
if (this.closed)
return;
if (!this.firstRender) {
if (this.outputError)
this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
this.out.write(clear(this.outputText, this.out.columns));
}
super.render();
this.outputError = "";
this.outputText = [
style.symbol(this.done, this.aborted),
color.bold(this.msg),
style.delimiter(this.done),
this.red ? color.red(this.rendered) : this.rendered
].join(` `);
if (this.error) {
this.outputError += this.errorMsg.split(`
`).reduce((a, l, i) => a + `
${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, ``);
}
this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0));
}
};
module2.exports = TextPrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/select.js
var require_select = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/select.js"(exports, module2) {
"use strict";
var color = require_kleur();
var Prompt = require_prompt();
var { style, clear, figures, wrap, entriesToDisplay } = require_util();
var { cursor } = require_src();
var SelectPrompt = class extends Prompt {
constructor(opts = {}) {
super(opts);
this.msg = opts.message;
this.hint = opts.hint || "- Use arrow-keys. Return to submit.";
this.warn = opts.warn || "- This option is disabled";
this.cursor = opts.initial || 0;
this.choices = opts.choices.map((ch, idx) => {
if (typeof ch === "string")
ch = { title: ch, value: idx };
return {
title: ch && (ch.title || ch.value || ch),
value: ch && (ch.value === void 0 ? idx : ch.value),
description: ch && ch.description,
selected: ch && ch.selected,
disabled: ch && ch.disabled
};
});
this.optionsPerPage = opts.optionsPerPage || 10;
this.value = (this.choices[this.cursor] || {}).value;
this.clear = clear("", this.out.columns);
this.render();
}
moveCursor(n) {
this.cursor = n;
this.value = this.choices[n].value;
this.fire();
}
reset() {
this.moveCursor(0);
this.fire();
this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = true;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
submit() {
if (!this.selection.disabled) {
this.done = true;
this.aborted = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
} else
this.bell();
}
first() {
this.moveCursor(0);
this.render();
}
last() {
this.moveCursor(this.choices.length - 1);
this.render();
}
up() {
if (this.cursor === 0) {
this.moveCursor(this.choices.length - 1);
} else {
this.moveCursor(this.cursor - 1);
}
this.render();
}
down() {
if (this.cursor === this.choices.length - 1) {
this.moveCursor(0);
} else {
this.moveCursor(this.cursor + 1);
}
this.render();
}
next() {
this.moveCursor((this.cursor + 1) % this.choices.length);
this.render();
}
_(c, key) {
if (c === " ")
return this.submit();
}
get selection() {
return this.choices[this.cursor];
}
render() {
if (this.closed)
return;
if (this.firstRender)
this.out.write(cursor.hide);
else
this.out.write(clear(this.outputText, this.out.columns));
super.render();
let { startIndex, endIndex } = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage);
this.outputText = [
style.symbol(this.done, this.aborted),
color.bold(this.msg),
style.delimiter(false),
this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
].join(" ");
if (!this.done) {
this.outputText += "\n";
for (let i = startIndex; i < endIndex; i++) {
let title, prefix, desc = "", v = this.choices[i];
if (i === startIndex && startIndex > 0) {
prefix = figures.arrowUp;
} else if (i === endIndex - 1 && endIndex < this.choices.length) {
prefix = figures.arrowDown;
} else {
prefix = " ";
}
if (v.disabled) {
title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ") + prefix;
} else {
title = this.cursor === i ? color.cyan().underline(v.title) : v.title;
prefix = (this.cursor === i ? color.cyan(figures.pointer) + " " : " ") + prefix;
if (v.description && this.cursor === i) {
desc = ` - ${v.description}`;
if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
desc = "\n" + wrap(v.description, { margin: 3, width: this.out.columns });
}
}
}
this.outputText += `${prefix} ${title}${color.gray(desc)}
`;
}
}
this.out.write(this.outputText);
}
};
module2.exports = SelectPrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/toggle.js
var require_toggle = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/toggle.js"(exports, module2) {
var color = require_kleur();
var Prompt = require_prompt();
var { style, clear } = require_util();
var { cursor, erase } = require_src();
var TogglePrompt = class extends Prompt {
constructor(opts = {}) {
super(opts);
this.msg = opts.message;
this.value = !!opts.initial;
this.active = opts.active || "on";
this.inactive = opts.inactive || "off";
this.initialValue = this.value;
this.render();
}
reset() {
this.value = this.initialValue;
this.fire();
this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = true;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
submit() {
this.done = true;
this.aborted = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
deactivate() {
if (this.value === false)
return this.bell();
this.value = false;
this.render();
}
activate() {
if (this.value === true)
return this.bell();
this.value = true;
this.render();
}
delete() {
this.deactivate();
}
left() {
this.deactivate();
}
right() {
this.activate();
}
down() {
this.deactivate();
}
up() {
this.activate();
}
next() {
this.value = !this.value;
this.fire();
this.render();
}
_(c, key) {
if (c === " ") {
this.value = !this.value;
} else if (c === "1") {
this.value = true;
} else if (c === "0") {
this.value = false;
} else
return this.bell();
this.render();
}
render() {
if (this.closed)
return;
if (this.firstRender)
this.out.write(cursor.hide);
else
this.out.write(clear(this.outputText, this.out.columns));
super.render();
this.outputText = [
style.symbol(this.done, this.aborted),
color.bold(this.msg),
style.delimiter(this.done),
this.value ? this.inactive : color.cyan().underline(this.inactive),
color.gray("/"),
this.value ? color.cyan().underline(this.active) : this.active
].join(" ");
this.out.write(erase.line + cursor.to(0) + this.outputText);
}
};
module2.exports = TogglePrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/datepart.js
var require_datepart = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/datepart.js"(exports, module2) {
"use strict";
var DatePart = class {
constructor({ token, date, parts, locales }) {
this.token = token;
this.date = date || /* @__PURE__ */ new Date();
this.parts = parts || [this];
this.locales = locales || {};
}
up() {
}
down() {
}
next() {
const currentIdx = this.parts.indexOf(this);
return this.parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
}
setTo(val) {
}
prev() {
let parts = [].concat(this.parts).reverse();
const currentIdx = parts.indexOf(this);
return parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
}
toString() {
return String(this.date);
}
};
module2.exports = DatePart;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/meridiem.js
var require_meridiem = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/meridiem.js"(exports, module2) {
"use strict";
var DatePart = require_datepart();
var Meridiem = class extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setHours((this.date.getHours() + 12) % 24);
}
down() {
this.up();
}
toString() {
let meridiem = this.date.getHours() > 12 ? "pm" : "am";
return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
}
};
module2.exports = Meridiem;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/day.js
var require_day = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/day.js"(exports, module2) {
"use strict";
var DatePart = require_datepart();
var pos = (n) => {
n = n % 10;
return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
};
var Day = class extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setDate(this.date.getDate() + 1);
}
down() {
this.date.setDate(this.date.getDate() - 1);
}
setTo(val) {
this.date.setDate(parseInt(val.substr(-2)));
}
toString() {
let date = this.date.getDate();
let day = this.date.getDay();
return this.token === "DD" ? String(date).padStart(2, "0") : this.token === "Do" ? date + pos(date) : this.token === "d" ? day + 1 : this.token === "ddd" ? this.locales.weekdaysShort[day] : this.token === "dddd" ? this.locales.weekdays[day] : date;
}
};
module2.exports = Day;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/hours.js
var require_hours = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/hours.js"(exports, module2) {
"use strict";
var DatePart = require_datepart();
var Hours = class extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setHours(this.date.getHours() + 1);
}
down() {
this.date.setHours(this.date.getHours() - 1);
}
setTo(val) {
this.date.setHours(parseInt(val.substr(-2)));
}
toString() {
let hours = this.date.getHours();
if (/h/.test(this.token))
hours = hours % 12 || 12;
return this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
}
};
module2.exports = Hours;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/milliseconds.js
var require_milliseconds = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/milliseconds.js"(exports, module2) {
"use strict";
var DatePart = require_datepart();
var Milliseconds = class extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setMilliseconds(this.date.getMilliseconds() + 1);
}
down() {
this.date.setMilliseconds(this.date.getMilliseconds() - 1);
}
setTo(val) {
this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
}
toString() {
return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
}
};
module2.exports = Milliseconds;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/minutes.js
var require_minutes = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/minutes.js"(exports, module2) {
"use strict";
var DatePart = require_datepart();
var Minutes = class extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setMinutes(this.date.getMinutes() + 1);
}
down() {
this.date.setMinutes(this.date.getMinutes() - 1);
}
setTo(val) {
this.date.setMinutes(parseInt(val.substr(-2)));
}
toString() {
let m = this.date.getMinutes();
return this.token.length > 1 ? String(m).padStart(2, "0") : m;
}
};
module2.exports = Minutes;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/month.js
var require_month = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/month.js"(exports, module2) {
"use strict";
var DatePart = require_datepart();
var Month = class extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setMonth(this.date.getMonth() + 1);
}
down() {
this.date.setMonth(this.date.getMonth() - 1);
}
setTo(val) {
val = parseInt(val.substr(-2)) - 1;
this.date.setMonth(val < 0 ? 0 : val);
}
toString() {
let month = this.date.getMonth();
let tl = this.token.length;
return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
}
};
module2.exports = Month;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/seconds.js
var require_seconds = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/seconds.js"(exports, module2) {
"use strict";
var DatePart = require_datepart();
var Seconds = class extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setSeconds(this.date.getSeconds() + 1);
}
down() {
this.date.setSeconds(this.date.getSeconds() - 1);
}
setTo(val) {
this.date.setSeconds(parseInt(val.substr(-2)));
}
toString() {
let s = this.date.getSeconds();
return this.token.length > 1 ? String(s).padStart(2, "0") : s;
}
};
module2.exports = Seconds;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/year.js
var require_year = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/year.js"(exports, module2) {
"use strict";
var DatePart = require_datepart();
var Year = class extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setFullYear(this.date.getFullYear() + 1);
}
down() {
this.date.setFullYear(this.date.getFullYear() - 1);
}
setTo(val) {
this.date.setFullYear(val.substr(-4));
}
toString() {
let year = String(this.date.getFullYear()).padStart(4, "0");
return this.token.length === 2 ? year.substr(-2) : year;
}
};
module2.exports = Year;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/index.js
var require_dateparts = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/dateparts/index.js"(exports, module2) {
"use strict";
module2.exports = {
DatePart: require_datepart(),
Meridiem: require_meridiem(),
Day: require_day(),
Hours: require_hours(),
Milliseconds: require_milliseconds(),
Minutes: require_minutes(),
Month: require_month(),
Seconds: require_seconds(),
Year: require_year()
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/date.js
var require_date = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/date.js"(exports, module2) {
"use strict";
var color = require_kleur();
var Prompt = require_prompt();
var { style, clear, figures } = require_util();
var { erase, cursor } = require_src();
var { DatePart, Meridiem, Day, Hours, Milliseconds, Minutes, Month, Seconds, Year } = require_dateparts();
var regex = /\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g;
var regexGroups = {
1: ({ token }) => token.replace(/\\(.)/g, "$1"),
2: (opts) => new Day(opts),
// Day // TODO
3: (opts) => new Month(opts),
// Month
4: (opts) => new Year(opts),
// Year
5: (opts) => new Meridiem(opts),
// AM/PM // TODO (special)
6: (opts) => new Hours(opts),
// Hours
7: (opts) => new Minutes(opts),
// Minutes
8: (opts) => new Seconds(opts),
// Seconds
9: (opts) => new Milliseconds(opts)
// Fractional seconds
};
var dfltLocales = {
months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
};
var DatePrompt = class extends Prompt {
constructor(opts = {}) {
super(opts);
this.msg = opts.message;
this.cursor = 0;
this.typed = "";
this.locales = Object.assign(dfltLocales, opts.locales);
this._date = opts.initial || /* @__PURE__ */ new Date();
this.errorMsg = opts.error || "Please Enter A Valid Value";
this.validator = opts.validate || (() => true);
this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss";
this.clear = clear("", this.out.columns);
this.render();
}
get value() {
return this.date;
}
get date() {
return this._date;
}
set date(date) {
if (date)
this._date.setTime(date.getTime());
}
set mask(mask) {
let result;
this.parts = [];
while (result = regex.exec(mask)) {
let match = result.shift();
let idx = result.findIndex((gr) => gr != null);
this.parts.push(idx in regexGroups ? regexGroups[idx]({ token: result[idx] || match, date: this.date, parts: this.parts, locales: this.locales }) : result[idx] || match);
}
let parts = this.parts.reduce((arr, i) => {
if (typeof i === "string" && typeof arr[arr.length - 1] === "string")
arr[arr.length - 1] += i;
else
arr.push(i);
return arr;
}, []);
this.parts.splice(0);
this.parts.push(...parts);
this.reset();
}
moveCursor(n) {
this.typed = "";
this.cursor = n;
this.fire();
}
reset() {
this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart));
this.fire();
this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = true;
this.error = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
async validate() {
let valid = await this.validator(this.value);
if (typeof valid === "string") {
this.errorMsg = valid;
valid = false;
}
this.error = !valid;
}
async submit() {
await this.validate();
if (this.error) {
this.color = "red";
this.fire();
this.render();
return;
}
this.done = true;
this.aborted = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
up() {
this.typed = "";
this.parts[this.cursor].up();
this.render();
}
down() {
this.typed = "";
this.parts[this.cursor].down();
this.render();
}
left() {
let prev = this.parts[this.cursor].prev();
if (prev == null)
return this.bell();
this.moveCursor(this.parts.indexOf(prev));
this.render();
}
right() {
let next = this.parts[this.cursor].next();
if (next == null)
return this.bell();
this.moveCursor(this.parts.indexOf(next));
this.render();
}
next() {
let next = this.parts[this.cursor].next();
this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart));
this.render();
}
_(c) {
if (/\d/.test(c)) {
this.typed += c;
this.parts[this.cursor].setTo(this.typed);
this.render();
}
}
render() {
if (this.closed)
return;
if (this.firstRender)
this.out.write(cursor.hide);
else
this.out.write(clear(this.outputText, this.out.columns));
super.render();
this.outputText = [
style.symbol(this.done, this.aborted),
color.bold(this.msg),
style.delimiter(false),
this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join("")
].join(" ");
if (this.error) {
this.outputText += this.errorMsg.split("\n").reduce(
(a, l, i) => a + `
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`,
``
);
}
this.out.write(erase.line + cursor.to(0) + this.outputText);
}
};
module2.exports = DatePrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/number.js
var require_number = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/number.js"(exports, module2) {
var color = require_kleur();
var Prompt = require_prompt();
var { cursor, erase } = require_src();
var { style, figures, clear, lines } = require_util();
var isNumber = /[0-9]/;
var isDef = (any) => any !== void 0;
var round = (number, precision) => {
let factor = Math.pow(10, precision);
return Math.round(number * factor) / factor;
};
var NumberPrompt = class extends Prompt {
constructor(opts = {}) {
super(opts);
this.transform = style.render(opts.style);
this.msg = opts.message;
this.initial = isDef(opts.initial) ? opts.initial : "";
this.float = !!opts.float;
this.round = opts.round || 2;
this.inc = opts.increment || 1;
this.min = isDef(opts.min) ? opts.min : -Infinity;
this.max = isDef(opts.max) ? opts.max : Infinity;
this.errorMsg = opts.error || `Please Enter A Valid Value`;
this.validator = opts.validate || (() => true);
this.color = `cyan`;
this.value = ``;
this.typed = ``;
this.lastHit = 0;
this.render();
}
set value(v) {
if (!v && v !== 0) {
this.placeholder = true;
this.rendered = color.gray(this.transform.render(`${this.initial}`));
this._value = ``;
} else {
this.placeholder = false;
this.rendered = this.transform.render(`${round(v, this.round)}`);
this._value = round(v, this.round);
}
this.fire();
}
get value() {
return this._value;
}
parse(x) {
return this.float ? parseFloat(x) : parseInt(x);
}
valid(c) {
return c === `-` || c === `.` && this.float || isNumber.test(c);
}
reset() {
this.typed = ``;
this.value = ``;
this.fire();
this.render();
}
exit() {
this.abort();
}
abort() {
let x = this.value;
this.value = x !== `` ? x : this.initial;
this.done = this.aborted = true;
this.error = false;
this.fire();
this.render();
this.out.write(`
`);
this.close();
}
async validate() {
let valid = await this.validator(this.value);
if (typeof valid === `string`) {
this.errorMsg = valid;
valid = false;
}
this.error = !valid;
}
async submit() {
await this.validate();
if (this.error) {
this.color = `red`;
this.fire();
this.render();
return;
}
let x = this.value;
this.value = x !== `` ? x : this.initial;
this.done = true;
this.aborted = false;
this.error = false;
this.fire();
this.render();
this.out.write(`
`);
this.close();
}
up() {
this.typed = ``;
if (this.value === "") {
this.value = this.min - this.inc;
}
if (this.value >= this.max)
return this.bell();
this.value += this.inc;
this.color = `cyan`;
this.fire();
this.render();
}
down() {
this.typed = ``;
if (this.value === "") {
this.value = this.min + this.inc;
}
if (this.value <= this.min)
return this.bell();
this.value -= this.inc;
this.color = `cyan`;
this.fire();
this.render();
}
delete() {
let val = this.value.toString();
if (val.length === 0)
return this.bell();
this.value = this.parse(val = val.slice(0, -1)) || ``;
if (this.value !== "" && this.value < this.min) {
this.value = this.min;
}
this.color = `cyan`;
this.fire();
this.render();
}
next() {
this.value = this.initial;
this.fire();
this.render();
}
_(c, key) {
if (!this.valid(c))
return this.bell();
const now = Date.now();
if (now - this.lastHit > 1e3)
this.typed = ``;
this.typed += c;
this.lastHit = now;
this.color = `cyan`;
if (c === `.`)
return this.fire();
this.value = Math.min(this.parse(this.typed), this.max);
if (this.value > this.max)
this.value = this.max;
if (this.value < this.min)
this.value = this.min;
this.fire();
this.render();
}
render() {
if (this.closed)
return;
if (!this.firstRender) {
if (this.outputError)
this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
this.out.write(clear(this.outputText, this.out.columns));
}
super.render();
this.outputError = "";
this.outputText = [
style.symbol(this.done, this.aborted),
color.bold(this.msg),
style.delimiter(this.done),
!this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
].join(` `);
if (this.error) {
this.outputError += this.errorMsg.split(`
`).reduce((a, l, i) => a + `
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
}
this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore);
}
};
module2.exports = NumberPrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/multiselect.js
var require_multiselect = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/multiselect.js"(exports, module2) {
"use strict";
var color = require_kleur();
var { cursor } = require_src();
var Prompt = require_prompt();
var { clear, figures, style, wrap, entriesToDisplay } = require_util();
var MultiselectPrompt = class extends Prompt {
constructor(opts = {}) {
super(opts);
this.msg = opts.message;
this.cursor = opts.cursor || 0;
this.scrollIndex = opts.cursor || 0;
this.hint = opts.hint || "";
this.warn = opts.warn || "- This option is disabled -";
this.minSelected = opts.min;
this.showMinError = false;
this.maxChoices = opts.max;
this.instructions = opts.instructions;
this.optionsPerPage = opts.optionsPerPage || 10;
this.value = opts.choices.map((ch, idx) => {
if (typeof ch === "string")
ch = { title: ch, value: idx };
return {
title: ch && (ch.title || ch.value || ch),
description: ch && ch.description,
value: ch && (ch.value === void 0 ? idx : ch.value),
selected: ch && ch.selected,
disabled: ch && ch.disabled
};
});
this.clear = clear("", this.out.columns);
if (!opts.overrideRender) {
this.render();
}
}
reset() {
this.value.map((v) => !v.selected);
this.cursor = 0;
this.fire();
this.render();
}
selected() {
return this.value.filter((v) => v.selected);
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = true;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
submit() {
const selected = this.value.filter((e) => e.selected);
if (this.minSelected && selected.length < this.minSelected) {
this.showMinError = true;
this.render();
} else {
this.done = true;
this.aborted = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
}
first() {
this.cursor = 0;
this.render();
}
last() {
this.cursor = this.value.length - 1;
this.render();
}
next() {
this.cursor = (this.cursor + 1) % this.value.length;
this.render();
}
up() {
if (this.cursor === 0) {
this.cursor = this.value.length - 1;
} else {
this.cursor--;
}
this.render();
}
down() {
if (this.cursor === this.value.length - 1) {
this.cursor = 0;
} else {
this.cursor++;
}
this.render();
}
left() {
this.value[this.cursor].selected = false;
this.render();
}
right() {
if (this.value.filter((e) => e.selected).length >= this.maxChoices)
return this.bell();
this.value[this.cursor].selected = true;
this.render();
}
handleSpaceToggle() {
const v = this.value[this.cursor];
if (v.selected) {
v.selected = false;
this.render();
} else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
return this.bell();
} else {
v.selected = true;
this.render();
}
}
toggleAll() {
if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) {
return this.bell();
}
const newSelected = !this.value[this.cursor].selected;
this.value.filter((v) => !v.disabled).forEach((v) => v.selected = newSelected);
this.render();
}
_(c, key) {
if (c === " ") {
this.handleSpaceToggle();
} else if (c === "a") {
this.toggleAll();
} else {
return this.bell();
}
}
renderInstructions() {
if (this.instructions === void 0 || this.instructions) {
if (typeof this.instructions === "string") {
return this.instructions;
}
return `
Instructions:
${figures.arrowUp}/${figures.arrowDown}: Highlight option
${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
` + (this.maxChoices === void 0 ? ` a: Toggle all
` : "") + ` enter/return: Complete answer`;
}
return "";
}
renderOption(cursor2, v, i, arrowIndicator) {
const prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + arrowIndicator + " ";
let title, desc;
if (v.disabled) {
title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
} else {
title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
if (cursor2 === i && v.description) {
desc = ` - ${v.description}`;
if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
desc = "\n" + wrap(v.description, { margin: prefix.length, width: this.out.columns });
}
}
}
return prefix + title + color.gray(desc || "");
}
// shared with autocompleteMultiselect
paginateOptions(options2) {
if (options2.length === 0) {
return color.red("No matches for this query.");
}
let { startIndex, endIndex } = entriesToDisplay(this.cursor, options2.length, this.optionsPerPage);
let prefix, styledOptions = [];
for (let i = startIndex; i < endIndex; i++) {
if (i === startIndex && startIndex > 0) {
prefix = figures.arrowUp;
} else if (i === endIndex - 1 && endIndex < options2.length) {
prefix = figures.arrowDown;
} else {
prefix = " ";
}
styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
}
return "\n" + styledOptions.join("\n");
}
// shared with autocomleteMultiselect
renderOptions(options2) {
if (!this.done) {
return this.paginateOptions(options2);
}
return "";
}
renderDoneOrInstructions() {
if (this.done) {
return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
}
const output = [color.gray(this.hint), this.renderInstructions()];
if (this.value[this.cursor].disabled) {
output.push(color.yellow(this.warn));
}
return output.join(" ");
}
render() {
if (this.closed)
return;
if (this.firstRender)
this.out.write(cursor.hide);
super.render();
let prompt = [
style.symbol(this.done, this.aborted),
color.bold(this.msg),
style.delimiter(false),
this.renderDoneOrInstructions()
].join(" ");
if (this.showMinError) {
prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
this.showMinError = false;
}
prompt += this.renderOptions(this.value);
this.out.write(this.clear + prompt);
this.clear = clear(prompt, this.out.columns);
}
};
module2.exports = MultiselectPrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/autocomplete.js
var require_autocomplete = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/autocomplete.js"(exports, module2) {
"use strict";
var color = require_kleur();
var Prompt = require_prompt();
var { erase, cursor } = require_src();
var { style, clear, figures, wrap, entriesToDisplay } = require_util();
var getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]);
var getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]);
var getIndex = (arr, valOrTitle) => {
const index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
return index > -1 ? index : void 0;
};
var AutocompletePrompt = class extends Prompt {
constructor(opts = {}) {
super(opts);
this.msg = opts.message;
this.suggest = opts.suggest;
this.choices = opts.choices;
this.initial = typeof opts.initial === "number" ? opts.initial : getIndex(opts.choices, opts.initial);
this.select = this.initial || opts.cursor || 0;
this.i18n = { noMatches: opts.noMatches || "no matches found" };
this.fallback = opts.fallback || this.initial;
this.clearFirst = opts.clearFirst || false;
this.suggestions = [];
this.input = "";
this.limit = opts.limit || 10;
this.cursor = 0;
this.transform = style.render(opts.style);
this.scale = this.transform.scale;
this.render = this.render.bind(this);
this.complete = this.complete.bind(this);
this.clear = clear("", this.out.columns);
this.complete(this.render);
this.render();
}
set fallback(fb) {
this._fb = Number.isSafeInteger(parseInt(fb)) ? parseInt(fb) : fb;
}
get fallback() {
let choice;
if (typeof this._fb === "number")
choice = this.choices[this._fb];
else if (typeof this._fb === "string")
choice = { title: this._fb };
return choice || this._fb || { title: this.i18n.noMatches };
}
moveSelect(i) {
this.select = i;
if (this.suggestions.length > 0)
this.value = getVal(this.suggestions, i);
else
this.value = this.fallback.value;
this.fire();
}
async complete(cb) {
const p = this.completing = this.suggest(this.input, this.choices);
const suggestions = await p;
if (this.completing !== p)
return;
this.suggestions = suggestions.map((s, i, arr) => ({ title: getTitle(arr, i), value: getVal(arr, i), description: s.description }));
this.completing = false;
const l = Math.max(suggestions.length - 1, 0);
this.moveSelect(Math.min(l, this.select));
cb && cb();
}
reset() {
this.input = "";
this.complete(() => {
this.moveSelect(this.initial !== void 0 ? this.initial : 0);
this.render();
});
this.render();
}
exit() {
if (this.clearFirst && this.input.length > 0) {
this.reset();
} else {
this.done = this.exited = true;
this.aborted = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
}
abort() {
this.done = this.aborted = true;
this.exited = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
submit() {
this.done = true;
this.aborted = this.exited = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
_(c, key) {
let s1 = this.input.slice(0, this.cursor);
let s2 = this.input.slice(this.cursor);
this.input = `${s1}${c}${s2}`;
this.cursor = s1.length + 1;
this.complete(this.render);
this.render();
}
delete() {
if (this.cursor === 0)
return this.bell();
let s1 = this.input.slice(0, this.cursor - 1);
let s2 = this.input.slice(this.cursor);
this.input = `${s1}${s2}`;
this.complete(this.render);
this.cursor = this.cursor - 1;
this.render();
}
deleteForward() {
if (this.cursor * this.scale >= this.rendered.length)
return this.bell();
let s1 = this.input.slice(0, this.cursor);
let s2 = this.input.slice(this.cursor + 1);
this.input = `${s1}${s2}`;
this.complete(this.render);
this.render();
}
first() {
this.moveSelect(0);
this.render();
}
last() {
this.moveSelect(this.suggestions.length - 1);
this.render();
}
up() {
if (this.select === 0) {
this.moveSelect(this.suggestions.length - 1);
} else {
this.moveSelect(this.select - 1);
}
this.render();
}
down() {
if (this.select === this.suggestions.length - 1) {
this.moveSelect(0);
} else {
this.moveSelect(this.select + 1);
}
this.render();
}
next() {
if (this.select === this.suggestions.length - 1) {
this.moveSelect(0);
} else
this.moveSelect(this.select + 1);
this.render();
}
nextPage() {
this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1));
this.render();
}
prevPage() {
this.moveSelect(Math.max(this.select - this.limit, 0));
this.render();
}
left() {
if (this.cursor <= 0)
return this.bell();
this.cursor = this.cursor - 1;
this.render();
}
right() {
if (this.cursor * this.scale >= this.rendered.length)
return this.bell();
this.cursor = this.cursor + 1;
this.render();
}
renderOption(v, hovered, isStart, isEnd) {
let desc;
let prefix = isStart ? figures.arrowUp : isEnd ? figures.arrowDown : " ";
let title = hovered ? color.cyan().underline(v.title) : v.title;
prefix = (hovered ? color.cyan(figures.pointer) + " " : " ") + prefix;
if (v.description) {
desc = ` - ${v.description}`;
if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
desc = "\n" + wrap(v.description, { margin: 3, width: this.out.columns });
}
}
return prefix + " " + title + color.gray(desc || "");
}
render() {
if (this.closed)
return;
if (this.firstRender)
this.out.write(cursor.hide);
else
this.out.write(clear(this.outputText, this.out.columns));
super.render();
let { startIndex, endIndex } = entriesToDisplay(this.select, this.choices.length, this.limit);
this.outputText = [
style.symbol(this.done, this.aborted, this.exited),
color.bold(this.msg),
style.delimiter(this.completing),
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
].join(" ");
if (!this.done) {
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(
item,
this.select === i + startIndex,
i === 0 && startIndex > 0,
i + startIndex === endIndex - 1 && endIndex < this.choices.length
)).join("\n");
this.outputText += `
` + (suggestions || color.gray(this.fallback.title));
}
this.out.write(erase.line + cursor.to(0) + this.outputText);
}
};
module2.exports = AutocompletePrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/autocompleteMultiselect.js
var require_autocompleteMultiselect = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/autocompleteMultiselect.js"(exports, module2) {
"use strict";
var color = require_kleur();
var { cursor } = require_src();
var MultiselectPrompt = require_multiselect();
var { clear, style, figures } = require_util();
var AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
constructor(opts = {}) {
opts.overrideRender = true;
super(opts);
this.inputValue = "";
this.clear = clear("", this.out.columns);
this.filteredOptions = this.value;
this.render();
}
last() {
this.cursor = this.filteredOptions.length - 1;
this.render();
}
next() {
this.cursor = (this.cursor + 1) % this.filteredOptions.length;
this.render();
}
up() {
if (this.cursor === 0) {
this.cursor = this.filteredOptions.length - 1;
} else {
this.cursor--;
}
this.render();
}
down() {
if (this.cursor === this.filteredOptions.length - 1) {
this.cursor = 0;
} else {
this.cursor++;
}
this.render();
}
left() {
this.filteredOptions[this.cursor].selected = false;
this.render();
}
right() {
if (this.value.filter((e) => e.selected).length >= this.maxChoices)
return this.bell();
this.filteredOptions[this.cursor].selected = true;
this.render();
}
delete() {
if (this.inputValue.length) {
this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1);
this.updateFilteredOptions();
}
}
updateFilteredOptions() {
const currentHighlight = this.filteredOptions[this.cursor];
this.filteredOptions = this.value.filter((v) => {
if (this.inputValue) {
if (typeof v.title === "string") {
if (v.title.toLowerCase().includes(this.inputValue.toLowerCase())) {
return true;
}
}
if (typeof v.value === "string") {
if (v.value.toLowerCase().includes(this.inputValue.toLowerCase())) {
return true;
}
}
return false;
}
return true;
});
const newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex;
this.render();
}
handleSpaceToggle() {
const v = this.filteredOptions[this.cursor];
if (v.selected) {
v.selected = false;
this.render();
} else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
return this.bell();
} else {
v.selected = true;
this.render();
}
}
handleInputChange(c) {
this.inputValue = this.inputValue + c;
this.updateFilteredOptions();
}
_(c, key) {
if (c === " ") {
this.handleSpaceToggle();
} else {
this.handleInputChange(c);
}
}
renderInstructions() {
if (this.instructions === void 0 || this.instructions) {
if (typeof this.instructions === "string") {
return this.instructions;
}
return `
Instructions:
${figures.arrowUp}/${figures.arrowDown}: Highlight option
${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
[a,b,c]/delete: Filter choices
enter/return: Complete answer
`;
}
return "";
}
renderCurrentInput() {
return `
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
`;
}
renderOption(cursor2, v, i) {
let title;
if (v.disabled)
title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
else
title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
}
renderDoneOrInstructions() {
if (this.done) {
return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
}
const output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
output.push(color.yellow(this.warn));
}
return output.join(" ");
}
render() {
if (this.closed)
return;
if (this.firstRender)
this.out.write(cursor.hide);
super.render();
let prompt = [
style.symbol(this.done, this.aborted),
color.bold(this.msg),
style.delimiter(false),
this.renderDoneOrInstructions()
].join(" ");
if (this.showMinError) {
prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
this.showMinError = false;
}
prompt += this.renderOptions(this.filteredOptions);
this.out.write(this.clear + prompt);
this.clear = clear(prompt, this.out.columns);
}
};
module2.exports = AutocompleteMultiselectPrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/confirm.js
var require_confirm = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/confirm.js"(exports, module2) {
var color = require_kleur();
var Prompt = require_prompt();
var { style, clear } = require_util();
var { erase, cursor } = require_src();
var ConfirmPrompt = class extends Prompt {
constructor(opts = {}) {
super(opts);
this.msg = opts.message;
this.value = opts.initial;
this.initialValue = !!opts.initial;
this.yesMsg = opts.yes || "yes";
this.yesOption = opts.yesOption || "(Y/n)";
this.noMsg = opts.no || "no";
this.noOption = opts.noOption || "(y/N)";
this.render();
}
reset() {
this.value = this.initialValue;
this.fire();
this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = true;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
submit() {
this.value = this.value || false;
this.done = true;
this.aborted = false;
this.fire();
this.render();
this.out.write("\n");
this.close();
}
_(c, key) {
if (c.toLowerCase() === "y") {
this.value = true;
return this.submit();
}
if (c.toLowerCase() === "n") {
this.value = false;
return this.submit();
}
return this.bell();
}
render() {
if (this.closed)
return;
if (this.firstRender)
this.out.write(cursor.hide);
else
this.out.write(clear(this.outputText, this.out.columns));
super.render();
this.outputText = [
style.symbol(this.done, this.aborted),
color.bold(this.msg),
style.delimiter(this.done),
this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)
].join(" ");
this.out.write(erase.line + cursor.to(0) + this.outputText);
}
};
module2.exports = ConfirmPrompt;
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/index.js
var require_elements = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/elements/index.js"(exports, module2) {
"use strict";
module2.exports = {
TextPrompt: require_text(),
SelectPrompt: require_select(),
TogglePrompt: require_toggle(),
DatePrompt: require_date(),
NumberPrompt: require_number(),
MultiselectPrompt: require_multiselect(),
AutocompletePrompt: require_autocomplete(),
AutocompleteMultiselectPrompt: require_autocompleteMultiselect(),
ConfirmPrompt: require_confirm()
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/prompts.js
var require_prompts = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/prompts.js"(exports) {
"use strict";
var $ = exports;
var el = require_elements();
var noop = (v) => v;
function toPrompt(type, args, opts = {}) {
return new Promise((res, rej) => {
const p = new el[type](args);
const onAbort = opts.onAbort || noop;
const onSubmit = opts.onSubmit || noop;
const onExit = opts.onExit || noop;
p.on("state", args.onState || noop);
p.on("submit", (x) => res(onSubmit(x)));
p.on("exit", (x) => res(onExit(x)));
p.on("abort", (x) => rej(onAbort(x)));
});
}
$.text = (args) => toPrompt("TextPrompt", args);
$.password = (args) => {
args.style = "password";
return $.text(args);
};
$.invisible = (args) => {
args.style = "invisible";
return $.text(args);
};
$.number = (args) => toPrompt("NumberPrompt", args);
$.date = (args) => toPrompt("DatePrompt", args);
$.confirm = (args) => toPrompt("ConfirmPrompt", args);
$.list = (args) => {
const sep = args.separator || ",";
return toPrompt("TextPrompt", args, {
onSubmit: (str) => str.split(sep).map((s) => s.trim())
});
};
$.toggle = (args) => toPrompt("TogglePrompt", args);
$.select = (args) => toPrompt("SelectPrompt", args);
$.multiselect = (args) => {
args.choices = [].concat(args.choices || []);
const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
return toPrompt("MultiselectPrompt", args, {
onAbort: toSelected,
onSubmit: toSelected
});
};
$.autocompleteMultiselect = (args) => {
args.choices = [].concat(args.choices || []);
const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
return toPrompt("AutocompleteMultiselectPrompt", args, {
onAbort: toSelected,
onSubmit: toSelected
});
};
var byTitle = (input, choices) => Promise.resolve(
choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase())
);
$.autocomplete = (args) => {
args.suggest = args.suggest || byTitle;
args.choices = [].concat(args.choices || []);
return toPrompt("AutocompletePrompt", args);
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/index.js
var require_lib = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+prompts@2.4.2/node_modules/prompts/lib/index.js"(exports, module2) {
"use strict";
var prompts2 = require_prompts();
var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
var noop = () => {
};
async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {}) {
const answers = {};
const override2 = prompt._override || {};
questions = [].concat(questions);
let answer, question, quit, name, type, lastPrompt;
const getFormattedAnswer = async (question2, answer2, skipValidation = false) => {
if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
return;
}
return question2.format ? await question2.format(answer2, answers) : answer2;
};
for (question of questions) {
({ name, type } = question);
if (typeof type === "function") {
type = await type(answer, { ...answers }, question);
question["type"] = type;
}
if (!type)
continue;
for (let key in question) {
if (passOn.includes(key))
continue;
let value = question[key];
question[key] = typeof value === "function" ? await value(answer, { ...answers }, lastPrompt) : value;
}
lastPrompt = question;
if (typeof question.message !== "string") {
throw new Error("prompt message is required");
}
({ name, type } = question);
if (prompts2[type] === void 0) {
throw new Error(`prompt type (${type}) is not defined`);
}
if (override2[question.name] !== void 0) {
answer = await getFormattedAnswer(question, override2[question.name]);
if (answer !== void 0) {
answers[name] = answer;
continue;
}
}
try {
answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts2[type](question);
answers[name] = answer = await getFormattedAnswer(question, answer, true);
quit = await onSubmit(question, answer, answers);
} catch (err) {
quit = !await onCancel(question, answers);
}
if (quit)
return answers;
}
return answers;
}
function getInjectedAnswer(injected, deafultValue) {
const answer = injected.shift();
if (answer instanceof Error) {
throw answer;
}
return answer === void 0 ? deafultValue : answer;
}
function inject(answers) {
prompt._injected = (prompt._injected || []).concat(answers);
}
function override(answers) {
prompt._override = Object.assign({}, answers);
}
module2.exports = Object.assign(prompt, { prompt, prompts: prompts2, inject, override });
}
});
// node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js
var require_quote = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringifyPath = exports.quoteKey = exports.isValidVariableName = exports.IS_VALID_IDENTIFIER = exports.quoteString = void 0;
var ESCAPABLE = /[\\\'\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
var META_CHARS = /* @__PURE__ */ new Map([
["\b", "\\b"],
[" ", "\\t"],
["\n", "\\n"],
["\f", "\\f"],
["\r", "\\r"],
["'", "\\'"],
['"', '\\"'],
["\\", "\\\\"]
]);
function escapeChar(char) {
return META_CHARS.get(char) || `\\u${`0000${char.charCodeAt(0).toString(16)}`.slice(-4)}`;
}
function quoteString(str) {
return `'${str.replace(ESCAPABLE, escapeChar)}'`;
}
exports.quoteString = quoteString;
var RESERVED_WORDS = new Set("break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "));
exports.IS_VALID_IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
function isValidVariableName(name) {
return typeof name === "string" && !RESERVED_WORDS.has(name) && exports.IS_VALID_IDENTIFIER.test(name);
}
exports.isValidVariableName = isValidVariableName;
function quoteKey(key, next) {
return isValidVariableName(key) ? key : next(key);
}
exports.quoteKey = quoteKey;
function stringifyPath(path5, next) {
let result = "";
for (const key of path5) {
if (isValidVariableName(key)) {
result += `.${key}`;
} else {
result += `[${next(key)}]`;
}
}
return result;
}
exports.stringifyPath = stringifyPath;
}
});
// node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js
var require_function = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionParser = exports.dedentFunction = exports.functionToString = exports.USED_METHOD_KEY = void 0;
var quote_1 = require_quote();
var METHOD_NAMES_ARE_QUOTED = {
" "() {
}
}[" "].toString().charAt(0) === '"';
var FUNCTION_PREFIXES = {
Function: "function ",
GeneratorFunction: "function* ",
AsyncFunction: "async function ",
AsyncGeneratorFunction: "async function* "
};
var METHOD_PREFIXES = {
Function: "",
GeneratorFunction: "*",
AsyncFunction: "async ",
AsyncGeneratorFunction: "async *"
};
var TOKENS_PRECEDING_REGEXPS = new Set("case delete else in instanceof new return throw typeof void , ; : + - ! ~ & | ^ * / % < > ? =".split(" "));
exports.USED_METHOD_KEY = /* @__PURE__ */ new WeakSet();
var functionToString = (fn, space, next, key) => {
const name = typeof key === "string" ? key : void 0;
if (name !== void 0)
exports.USED_METHOD_KEY.add(fn);
return new FunctionParser(fn, space, next, name).stringify();
};
exports.functionToString = functionToString;
function dedentFunction(fnString) {
let found;
for (const line of fnString.split("\n").slice(1)) {
const m = /^[\s\t]+/.exec(line);
if (!m)
return fnString;
const [str] = m;
if (found === void 0)
found = str;
else if (str.length < found.length)
found = str;
}
return found ? fnString.split(`
${found}`).join("\n") : fnString;
}
exports.dedentFunction = dedentFunction;
var FunctionParser = class {
constructor(fn, indent, next, key) {
this.fn = fn;
this.indent = indent;
this.next = next;
this.key = key;
this.pos = 0;
this.hadKeyword = false;
this.fnString = Function.prototype.toString.call(fn);
this.fnType = fn.constructor.name;
this.keyQuote = key === void 0 ? "" : quote_1.quoteKey(key, next);
this.keyPrefix = key === void 0 ? "" : `${this.keyQuote}:${indent ? " " : ""}`;
this.isMethodCandidate = key === void 0 ? false : this.fn.name === "" || this.fn.name === key;
}
stringify() {
const value = this.tryParse();
if (!value) {
return `${this.keyPrefix}void ${this.next(this.fnString)}`;
}
return dedentFunction(value);
}
getPrefix() {
if (this.isMethodCandidate && !this.hadKeyword) {
return METHOD_PREFIXES[this.fnType] + this.keyQuote;
}
return this.keyPrefix + FUNCTION_PREFIXES[this.fnType];
}
tryParse() {
if (this.fnString[this.fnString.length - 1] !== "}") {
return this.keyPrefix + this.fnString;
}
if (this.fn.name) {
const result = this.tryStrippingName();
if (result)
return result;
}
const prevPos = this.pos;
if (this.consumeSyntax() === "class")
return this.fnString;
this.pos = prevPos;
if (this.tryParsePrefixTokens()) {
const result = this.tryStrippingName();
if (result)
return result;
let offset = this.pos;
switch (this.consumeSyntax("WORD_LIKE")) {
case "WORD_LIKE":
if (this.isMethodCandidate && !this.hadKeyword) {
offset = this.pos;
}
case "()":
if (this.fnString.substr(this.pos, 2) === "=>") {
return this.keyPrefix + this.fnString;
}
this.pos = offset;
case '"':
case "'":
case "[]":
return this.getPrefix() + this.fnString.substr(this.pos);
}
}
}
/**
* Attempt to parse the function from the current position by first stripping
* the function's name from the front. This is not a fool-proof method on all
* JavaScript engines, but yields good results on Node.js 4 (and slightly
* less good results on Node.js 6 and 8).
*/
tryStrippingName() {
if (METHOD_NAMES_ARE_QUOTED) {
return;
}
let start = this.pos;
const prefix = this.fnString.substr(this.pos, this.fn.name.length);
if (prefix === this.fn.name) {
this.pos += prefix.length;
if (this.consumeSyntax() === "()" && this.consumeSyntax() === "{}" && this.pos === this.fnString.length) {
if (this.isMethodCandidate || !quote_1.isValidVariableName(prefix)) {
start += prefix.length;
}
return this.getPrefix() + this.fnString.substr(start);
}
}
this.pos = start;
}
/**
* Attempt to advance the parser past the keywords expected to be at the
* start of this function's definition. This method sets `this.hadKeyword`
* based on whether or not a `function` keyword is consumed.
*/
tryParsePrefixTokens() {
let posPrev = this.pos;
this.hadKeyword = false;
switch (this.fnType) {
case "AsyncFunction":
if (this.consumeSyntax() !== "async")
return false;
posPrev = this.pos;
case "Function":
if (this.consumeSyntax() === "function") {
this.hadKeyword = true;
} else {
this.pos = posPrev;
}
return true;
case "AsyncGeneratorFunction":
if (this.consumeSyntax() !== "async")
return false;
case "GeneratorFunction":
let token = this.consumeSyntax();
if (token === "function") {
token = this.consumeSyntax();
this.hadKeyword = true;
}
return token === "*";
}
}
/**
* Advance the parser past one element of JavaScript syntax. This could be a
* matched pair of delimiters, like braces or parentheses, or an atomic unit
* like a keyword, variable, or operator. Return a normalized string
* representation of the element parsed--for example, returns '{}' for a
* matched pair of braces. Comments and whitespace are skipped.
*
* (This isn't a full parser, so the token scanning logic used here is as
* simple as it can be. As a consequence, some things that are one token in
* JavaScript, like decimal number literals or most multi-character operators
* like '&&', are split into more than one token here. However, awareness of
* some multi-character sequences like '=>' is necessary, so we match the few
* of them that we care about.)
*/
consumeSyntax(wordLikeToken) {
const m = this.consumeMatch(/^(?:([A-Za-z_0-9$\xA0-\uFFFF]+)|=>|\+\+|\-\-|.)/);
if (!m)
return;
const [token, match] = m;
this.consumeWhitespace();
if (match)
return wordLikeToken || match;
switch (token) {
case "(":
return this.consumeSyntaxUntil("(", ")");
case "[":
return this.consumeSyntaxUntil("[", "]");
case "{":
return this.consumeSyntaxUntil("{", "}");
case "`":
return this.consumeTemplate();
case '"':
return this.consumeRegExp(/^(?:[^\\"]|\\.)*"/, '"');
case "'":
return this.consumeRegExp(/^(?:[^\\']|\\.)*'/, "'");
}
return token;
}
consumeSyntaxUntil(startToken, endToken) {
let isRegExpAllowed = true;
for (; ; ) {
const token = this.consumeSyntax();
if (token === endToken)
return startToken + endToken;
if (!token || token === ")" || token === "]" || token === "}")
return;
if (token === "/" && isRegExpAllowed && this.consumeMatch(/^(?:\\.|[^\\\/\n[]|\[(?:\\.|[^\]])*\])+\/[a-z]*/)) {
isRegExpAllowed = false;
this.consumeWhitespace();
} else {
isRegExpAllowed = TOKENS_PRECEDING_REGEXPS.has(token);
}
}
}
consumeMatch(re) {
const m = re.exec(this.fnString.substr(this.pos));
if (m)
this.pos += m[0].length;
return m;
}
/**
* Advance the parser past an arbitrary regular expression. Return `token`,
* or the match object of the regexp.
*/
consumeRegExp(re, token) {
const m = re.exec(this.fnString.substr(this.pos));
if (!m)
return;
this.pos += m[0].length;
this.consumeWhitespace();
return token;
}
/**
* Advance the parser past a template string.
*/
consumeTemplate() {
for (; ; ) {
this.consumeMatch(/^(?:[^`$\\]|\\.|\$(?!{))*/);
if (this.fnString[this.pos] === "`") {
this.pos++;
this.consumeWhitespace();
return "`";
}
if (this.fnString.substr(this.pos, 2) === "${") {
this.pos += 2;
this.consumeWhitespace();
if (this.consumeSyntaxUntil("{", "}"))
continue;
}
return;
}
}
/**
* Advance the parser past any whitespace or comments.
*/
consumeWhitespace() {
this.consumeMatch(/^(?:\s|\/\/.*|\/\*[^]*?\*\/)*/);
}
};
exports.FunctionParser = FunctionParser;
}
});
// node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js
var require_array = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayToString = void 0;
var arrayToString = (array, space, next) => {
const values = array.map(function(value, index) {
const result = next(value, index);
if (result === void 0)
return String(result);
return space + result.split("\n").join(`
${space}`);
}).join(space ? ",\n" : ",");
const eol = space && values ? "\n" : "";
return `[${eol}${values}${eol}]`;
};
exports.arrayToString = arrayToString;
}
});
// node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js
var require_object = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectToString = void 0;
var quote_1 = require_quote();
var function_1 = require_function();
var array_1 = require_array();
var objectToString = (value, space, next, key) => {
if (typeof Buffer === "function" && Buffer.isBuffer(value)) {
return `Buffer.from(${next(value.toString("base64"))}, 'base64')`;
}
if (typeof global === "object" && value === global) {
return globalToString(value, space, next, key);
}
const toString = OBJECT_TYPES[Object.prototype.toString.call(value)];
return toString ? toString(value, space, next, key) : void 0;
};
exports.objectToString = objectToString;
var rawObjectToString = (obj, indent, next, key) => {
const eol = indent ? "\n" : "";
const space = indent ? " " : "";
const values = Object.keys(obj).reduce(function(values2, key2) {
const fn = obj[key2];
const result = next(fn, key2);
if (result === void 0)
return values2;
const value = result.split("\n").join(`
${indent}`);
if (function_1.USED_METHOD_KEY.has(fn)) {
values2.push(`${indent}${value}`);
return values2;
}
values2.push(`${indent}${quote_1.quoteKey(key2, next)}:${space}${value}`);
return values2;
}, []).join(`,${eol}`);
if (values === "")
return "{}";
return `{${eol}${values}${eol}}`;
};
var globalToString = (value, space, next) => {
return `Function(${next("return this")})()`;
};
var OBJECT_TYPES = {
"[object Array]": array_1.arrayToString,
"[object Object]": rawObjectToString,
"[object Error]": (error, space, next) => {
return `new Error(${next(error.message)})`;
},
"[object Date]": (date) => {
return `new Date(${date.getTime()})`;
},
"[object String]": (str, space, next) => {
return `new String(${next(str.toString())})`;
},
"[object Number]": (num) => {
return `new Number(${num})`;
},
"[object Boolean]": (bool) => {
return `new Boolean(${bool})`;
},
"[object Set]": (set, space, next) => {
return `new Set(${next(Array.from(set))})`;
},
"[object Map]": (map, space, next) => {
return `new Map(${next(Array.from(map))})`;
},
"[object RegExp]": String,
"[object global]": globalToString,
"[object Window]": globalToString
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js
var require_stringify = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toString = void 0;
var quote_1 = require_quote();
var object_1 = require_object();
var function_1 = require_function();
var PRIMITIVE_TYPES = {
string: quote_1.quoteString,
number: (value) => Object.is(value, -0) ? "-0" : String(value),
boolean: String,
symbol: (value, space, next) => {
const key = Symbol.keyFor(value);
if (key !== void 0)
return `Symbol.for(${next(key)})`;
return `Symbol(${next(value.description)})`;
},
bigint: (value, space, next) => {
return `BigInt(${next(String(value))})`;
},
undefined: String,
object: object_1.objectToString,
function: function_1.functionToString
};
var toString = (value, space, next, key) => {
if (value === null)
return "null";
return PRIMITIVE_TYPES[typeof value](value, space, next, key);
};
exports.toString = toString;
}
});
// node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js
var require_dist = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringify = void 0;
var stringify_1 = require_stringify();
var quote_1 = require_quote();
var ROOT_SENTINEL = Symbol("root");
function stringify2(value, replacer, indent, options2 = {}) {
const space = typeof indent === "string" ? indent : " ".repeat(indent || 0);
const path5 = [];
const stack = /* @__PURE__ */ new Set();
const tracking = /* @__PURE__ */ new Map();
const unpack = /* @__PURE__ */ new Map();
let valueCount = 0;
const { maxDepth = 100, references = false, skipUndefinedProperties = false, maxValues = 1e5 } = options2;
const valueToString = replacerToString(replacer);
const onNext = (value2, key) => {
if (++valueCount > maxValues)
return;
if (skipUndefinedProperties && value2 === void 0)
return;
if (path5.length > maxDepth)
return;
if (key === void 0)
return valueToString(value2, space, onNext, key);
path5.push(key);
const result2 = builder(value2, key === ROOT_SENTINEL ? void 0 : key);
path5.pop();
return result2;
};
const builder = references ? (value2, key) => {
if (value2 !== null && (typeof value2 === "object" || typeof value2 === "function" || typeof value2 === "symbol")) {
if (tracking.has(value2)) {
unpack.set(path5.slice(1), tracking.get(value2));
return valueToString(void 0, space, onNext, key);
}
tracking.set(value2, path5.slice(1));
}
return valueToString(value2, space, onNext, key);
} : (value2, key) => {
if (stack.has(value2))
return;
stack.add(value2);
const result2 = valueToString(value2, space, onNext, key);
stack.delete(value2);
return result2;
};
const result = onNext(value, ROOT_SENTINEL);
if (unpack.size) {
const sp = space ? " " : "";
const eol = space ? "\n" : "";
let wrapper = `var x${sp}=${sp}${result};${eol}`;
for (const [key, value2] of unpack.entries()) {
const keyPath = quote_1.stringifyPath(key, onNext);
const valuePath = quote_1.stringifyPath(value2, onNext);
wrapper += `x${keyPath}${sp}=${sp}x${valuePath};${eol}`;
}
return `(function${sp}()${sp}{${eol}${wrapper}return x;${eol}}())`;
}
return result;
}
exports.stringify = stringify2;
function replacerToString(replacer) {
if (!replacer)
return stringify_1.toString;
return (value, space, next, key) => {
return replacer(value, space, (value2) => stringify_1.toString(value2, space, next, key), key);
};
}
}
});
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/package.json
var require_package = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/package.json"(exports, module2) {
module2.exports = {
name: "@vue/create-eslint-config",
version: "0.2.1",
description: "Utility to setup ESLint in Vue.js projects.",
type: "module",
main: "index.js",
bin: {
"create-eslint-config": "bin/create-eslint-config.js"
},
engines: {
node: "^16.14.0 || >= 18.0.0"
},
repository: {
type: "git",
url: "git+https://github.com/vuejs/create-eslint-config.git"
},
keywords: [
"vue",
"eslint",
"config"
],
author: "Haoqun Jiang <haoqunjiang+npm@gmail.com>",
license: "MIT",
bugs: {
url: "https://github.com/vuejs/create-eslint-config/issues"
},
homepage: "https://github.com/vuejs/create-eslint-config#readme",
publishConfig: {
access: "public"
},
dependencies: {
enquirer: "^2.3.6",
"javascript-stringify": "^2.1.0",
kolorist: "^1.8.0"
},
devDependencies: {
"@rushstack/eslint-patch": "^1.2.0",
"@vue/eslint-config-airbnb": "^7.0.0",
"@vue/eslint-config-airbnb-with-typescript": "^7.0.0",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-standard": "^8.0.1",
"@vue/eslint-config-standard-with-typescript": "^8.0.0",
"@vue/eslint-config-typescript": "^11.0.3",
eslint: "^8.39.0",
"eslint-plugin-vue": "^9.11.0",
prettier: "^2.8.8",
standard: "^17.0.0",
typescript: "~5.0.4"
},
scripts: {
test: 'echo "Error: no test specified" && exit 1'
}
};
}
});
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/versionMap.cjs
var require_versionMap = __commonJS({
"node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/versionMap.cjs"(exports, module2) {
module2.exports = require_package().devDependencies;
}
});
// index.ts
var fs4 = __toESM(require("fs"), 1);
var path4 = __toESM(require("path"), 1);
var import_minimist = __toESM(require_minimist(), 1);
var import_prompts = __toESM(require_lib(), 1);
// node_modules/.pnpm/registry.npmmirror.com+kolorist@1.8.0/node_modules/kolorist/dist/esm/index.mjs
var enabled = true;
var globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
var supportLevel = 0;
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === "0") {
enabled = false;
} else if (FORCE_COLOR === "1" || FORCE_COLOR === "2" || FORCE_COLOR === "3") {
enabled = true;
} else if (TERM === "dumb") {
enabled = false;
} else if ("CI" in globalVar.process.env && [
"TRAVIS",
"CIRCLECI",
"APPVEYOR",
"GITLAB_CI",
"GITHUB_ACTIONS",
"BUILDKITE",
"DRONE"
].some((vendor) => vendor in globalVar.process.env)) {
enabled = true;
} else {
enabled = process.stdout.isTTY;
}
if (enabled) {
if (process.platform === "win32") {
supportLevel = 3;
} else {
if (COLORTERM && (COLORTERM === "truecolor" || COLORTERM === "24bit")) {
supportLevel = 3;
} else if (TERM && (TERM.endsWith("-256color") || TERM.endsWith("256"))) {
supportLevel = 2;
} else {
supportLevel = 1;
}
}
}
}
var options = {
enabled,
supportLevel
};
function kolorist(start, end, level = 1) {
const open = `\x1B[${start}m`;
const close = `\x1B[${end}m`;
const regex = new RegExp(`\\x1b\\[${end}m`, "g");
return (str) => {
return options.enabled && options.supportLevel >= level ? open + ("" + str).replace(regex, open) + close : "" + str;
};
}
var reset = kolorist(0, 0);
var bold = kolorist(1, 22);
var dim = kolorist(2, 22);
var italic = kolorist(3, 23);
var underline = kolorist(4, 24);
var inverse = kolorist(7, 27);
var hidden = kolorist(8, 28);
var strikethrough = kolorist(9, 29);
var black = kolorist(30, 39);
var red = kolorist(31, 39);
var green = kolorist(32, 39);
var yellow = kolorist(33, 39);
var blue = kolorist(34, 39);
var magenta = kolorist(35, 39);
var cyan = kolorist(36, 39);
var white = kolorist(97, 39);
var gray = kolorist(90, 39);
var lightGray = kolorist(37, 39);
var lightRed = kolorist(91, 39);
var lightGreen = kolorist(92, 39);
var lightYellow = kolorist(93, 39);
var lightBlue = kolorist(94, 39);
var lightMagenta = kolorist(95, 39);
var lightCyan = kolorist(96, 39);
var bgBlack = kolorist(40, 49);
var bgRed = kolorist(41, 49);
var bgGreen = kolorist(42, 49);
var bgYellow = kolorist(43, 49);
var bgBlue = kolorist(44, 49);
var bgMagenta = kolorist(45, 49);
var bgCyan = kolorist(46, 49);
var bgWhite = kolorist(107, 49);
var bgGray = kolorist(100, 49);
var bgLightRed = kolorist(101, 49);
var bgLightGreen = kolorist(102, 49);
var bgLightYellow = kolorist(103, 49);
var bgLightBlue = kolorist(104, 49);
var bgLightMagenta = kolorist(105, 49);
var bgLightCyan = kolorist(106, 49);
var bgLightGray = kolorist(47, 49);
// utils/banners.ts
var defaultBanner = "Vue.js - The Progressive JavaScript Framework";
var gradientBanner = "\x1B[38;2;66;211;146mV\x1B[39m\x1B[38;2;66;211;146mu\x1B[39m\x1B[38;2;66;211;146me\x1B[39m\x1B[38;2;66;211;146m.\x1B[39m\x1B[38;2;66;211;146mj\x1B[39m\x1B[38;2;67;209;149ms\x1B[39m \x1B[38;2;68;206;152m-\x1B[39m \x1B[38;2;69;204;155mT\x1B[39m\x1B[38;2;70;201;158mh\x1B[39m\x1B[38;2;71;199;162me\x1B[39m \x1B[38;2;72;196;165mP\x1B[39m\x1B[38;2;73;194;168mr\x1B[39m\x1B[38;2;74;192;171mo\x1B[39m\x1B[38;2;75;189;174mg\x1B[39m\x1B[38;2;76;187;177mr\x1B[39m\x1B[38;2;77;184;180me\x1B[39m\x1B[38;2;78;182;183ms\x1B[39m\x1B[38;2;79;179;186ms\x1B[39m\x1B[38;2;80;177;190mi\x1B[39m\x1B[38;2;81;175;193mv\x1B[39m\x1B[38;2;82;172;196me\x1B[39m \x1B[38;2;83;170;199mJ\x1B[39m\x1B[38;2;83;167;202ma\x1B[39m\x1B[38;2;84;165;205mv\x1B[39m\x1B[38;2;85;162;208ma\x1B[39m\x1B[38;2;86;160;211mS\x1B[39m\x1B[38;2;87;158;215mc\x1B[39m\x1B[38;2;88;155;218mr\x1B[39m\x1B[38;2;89;153;221mi\x1B[39m\x1B[38;2;90;150;224mp\x1B[39m\x1B[38;2;91;148;227mt\x1B[39m \x1B[38;2;92;145;230mF\x1B[39m\x1B[38;2;93;143;233mr\x1B[39m\x1B[38;2;94;141;236ma\x1B[39m\x1B[38;2;95;138;239mm\x1B[39m\x1B[38;2;96;136;243me\x1B[39m\x1B[38;2;97;133;246mw\x1B[39m\x1B[38;2;98;131;249mo\x1B[39m\x1B[38;2;99;128;252mr\x1B[39m\x1B[38;2;100;126;255mk\x1B[39m";
// utils/renderTemplate.ts
var fs = __toESM(require("fs"), 1);
var path = __toESM(require("path"), 1);
// utils/deepMerge.ts
var isObject = (val) => val && typeof val === "object";
var mergeArrayWithDedupe = (a, b) => Array.from(/* @__PURE__ */ new Set([...a, ...b]));
function deepMerge(target, obj) {
for (const key of Object.keys(obj)) {
const oldVal = target[key];
const newVal = obj[key];
if (Array.isArray(oldVal) && Array.isArray(newVal)) {
target[key] = mergeArrayWithDedupe(oldVal, newVal);
} else if (isObject(oldVal) && isObject(newVal)) {
target[key] = deepMerge(oldVal, newVal);
} else {
target[key] = newVal;
}
}
return target;
}
var deepMerge_default = deepMerge;
// utils/sortDependencies.ts
function sortDependencies(packageJson) {
const sorted = {};
const depTypes = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
for (const depType of depTypes) {
if (packageJson[depType]) {
sorted[depType] = {};
Object.keys(packageJson[depType]).sort().forEach((name) => {
sorted[depType][name] = packageJson[depType][name];
});
}
}
return {
...packageJson,
...sorted
};
}
// utils/renderTemplate.ts
function renderTemplate(src, dest) {
const stats = fs.statSync(src);
if (stats.isDirectory()) {
if (path.basename(src) === "node_modules") {
return;
}
fs.mkdirSync(dest, { recursive: true });
for (const file of fs.readdirSync(src)) {
renderTemplate(path.resolve(src, file), path.resolve(dest, file));
}
return;
}
const filename = path.basename(src);
if (filename === "package.json" && fs.existsSync(dest)) {
const existing = JSON.parse(fs.readFileSync(dest, "utf8"));
const newPackage = JSON.parse(fs.readFileSync(src, "utf8"));
const pkg = sortDependencies(deepMerge_default(existing, newPackage));
fs.writeFileSync(dest, JSON.stringify(pkg, null, 2) + "\n");
return;
}
if (filename === "extensions.json" && fs.existsSync(dest)) {
const existing = JSON.parse(fs.readFileSync(dest, "utf8"));
const newExtensions = JSON.parse(fs.readFileSync(src, "utf8"));
const extensions = deepMerge_default(existing, newExtensions);
fs.writeFileSync(dest, JSON.stringify(extensions, null, 2) + "\n");
return;
}
if (filename.startsWith("_")) {
dest = path.resolve(path.dirname(dest), filename.replace(/^_/, "."));
}
if (filename === "_gitignore" && fs.existsSync(dest)) {
const existing = fs.readFileSync(dest, "utf8");
const newGitignore = fs.readFileSync(src, "utf8");
fs.writeFileSync(dest, existing + "\n" + newGitignore);
return;
}
fs.copyFileSync(src, dest);
}
var renderTemplate_default = renderTemplate;
// utils/directoryTraverse.ts
var fs2 = __toESM(require("fs"), 1);
var path2 = __toESM(require("path"), 1);
function preOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
for (const filename of fs2.readdirSync(dir)) {
if (filename === ".git") {
continue;
}
const fullpath = path2.resolve(dir, filename);
if (fs2.lstatSync(fullpath).isDirectory()) {
dirCallback(fullpath);
if (fs2.existsSync(fullpath)) {
preOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
}
continue;
}
fileCallback(fullpath);
}
}
function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
for (const filename of fs2.readdirSync(dir)) {
if (filename === ".git") {
continue;
}
const fullpath = path2.resolve(dir, filename);
if (fs2.lstatSync(fullpath).isDirectory()) {
postOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
dirCallback(fullpath);
continue;
}
fileCallback(fullpath);
}
}
// utils/getCommand.ts
function getCommand(packageManager, scriptName, args) {
if (scriptName === "install") {
return packageManager === "yarn" ? "yarn" : `${packageManager} install`;
}
if (args) {
return packageManager === "npm" ? `npm run ${scriptName} -- ${args}` : `${packageManager} ${scriptName} ${args}`;
} else {
return packageManager === "npm" ? `npm run ${scriptName}` : `${packageManager} ${scriptName}`;
}
}
// utils/generateReadme.ts
var sfcTypeSupportDoc = [
"",
"## Type Support for `.vue` Imports in TS",
"",
"TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.",
"",
"If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:",
"",
"1. Disable the built-in TypeScript Extension",
" 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette",
" 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`",
"2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.",
""
].join("\n");
function generateReadme({
projectName,
packageManager,
needsTypeScript,
needsCypress,
needsCypressCT,
needsPlaywright,
needsVitest,
needsEslint
}) {
const commandFor = (scriptName, args) => getCommand(packageManager, scriptName, args);
let readme = `# ${projectName}
This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
${needsTypeScript ? sfcTypeSupportDoc : ""}
## Customize configuration
See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup
`;
let npmScriptsDescriptions = `\`\`\`sh
${commandFor("install")}
\`\`\`
### Compile and Hot-Reload for Development
\`\`\`sh
${commandFor("dev")}
\`\`\`
### ${needsTypeScript ? "Type-Check, " : ""}Compile and Minify for Production
\`\`\`sh
${commandFor("build")}
\`\`\`
`;
if (needsVitest) {
npmScriptsDescriptions += `
### Run Unit Tests with [Vitest](https://vitest.dev/)
\`\`\`sh
${commandFor("test:unit")}
\`\`\`
`;
}
if (needsCypressCT) {
npmScriptsDescriptions += `
### Run Headed Component Tests with [Cypress Component Testing](https://on.cypress.io/component)
\`\`\`sh
${commandFor("test:unit:dev")} # or \`${commandFor("test:unit")}\` for headless testing
\`\`\`
`;
}
if (needsCypress) {
npmScriptsDescriptions += `
### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
\`\`\`sh
${commandFor("test:e2e:dev")}
\`\`\`
This runs the end-to-end tests against the Vite development server.
It is much faster than the production build.
But it's still recommended to test the production build with \`test:e2e\` before deploying (e.g. in CI environments):
\`\`\`sh
${commandFor("build")}
${commandFor("test:e2e")}
\`\`\`
`;
}
if (needsPlaywright) {
npmScriptsDescriptions += `
### Run End-to-End Tests with [Playwright](https://playwright.dev)
\`\`\`sh
# Install browsers for the first run
npx playwright install
# When testing on CI, must build the project first
${commandFor("build")}
# Runs the end-to-end tests
${commandFor("test:e2e")}
# Runs the tests only on Chromium
${commandFor("test:e2e", "--project=chromium")}
# Runs the tests of a specific file
${commandFor("test:e2e", "tests/example.spec.ts")}
# Runs the tests in debug mode
${commandFor("test:e2e", "--debug")}
\`\`\`
`;
}
if (needsEslint) {
npmScriptsDescriptions += `
### Lint with [ESLint](https://eslint.org/)
\`\`\`sh
${commandFor("lint")}
\`\`\`
`;
}
readme += npmScriptsDescriptions;
return readme;
}
// utils/renderEslint.ts
var fs3 = __toESM(require("fs"), 1);
var path3 = __toESM(require("path"), 1);
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/index.js
var import_javascript_stringify = __toESM(require_dist(), 1);
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/templates/editorconfigs.js
var editorconfigs_exports = {};
__export(editorconfigs_exports, {
airbnb: () => airbnb,
standard: () => standard
});
var airbnb = `root = true
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 100
trim_trailing_whitespace = true
`;
var standard = `root = true
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
`;
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/templates/prettierrcs.js
var prettierrcs_exports = {};
__export(prettierrcs_exports, {
airbnb: () => prettierrc_airbnb_default,
default: () => prettierrc_default_default,
standard: () => prettierrc_standard_default
});
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/templates/prettierrc-default.json
var prettierrc_default_default = {
$schema: "https://json.schemastore.org/prettierrc",
semi: false,
tabWidth: 2,
singleQuote: true,
printWidth: 100,
trailingComma: "none"
};
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/templates/prettierrc-airbnb.json
var prettierrc_airbnb_default = {
$schema: "https://json.schemastore.org/prettierrc",
arrowParens: "always",
bracketSameLine: false,
bracketSpacing: true,
endOfLine: "lf",
jsxSingleQuote: false,
printWidth: 100,
proseWrap: "preserve",
quoteProps: "as-needed",
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: "all",
useTabs: false
};
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/templates/prettierrc-standard.json
var prettierrc_standard_default = {
$schema: "https://json.schemastore.org/prettierrc",
arrowParens: "always",
bracketSameLine: false,
bracketSpacing: true,
jsxSingleQuote: true,
proseWrap: "preserve",
quoteProps: "as-needed",
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: "none",
useTabs: false
};
// node_modules/.pnpm/registry.npmmirror.com+@vue+create-eslint-config@0.2.1/node_modules/@vue/create-eslint-config/index.js
var import_versionMap = __toESM(require_versionMap(), 1);
function stringifyJS(value, styleGuide) {
const result = (0, import_javascript_stringify.stringify)(value, (val, indent, stringify2, key) => {
if (key === "CREATE_ALIAS_SETTING_PLACEHOLDER") {
return `(${stringify2(val)})`;
}
return stringify2(val);
}, 2);
return result.replace(
"CREATE_ALIAS_SETTING_PLACEHOLDER: ",
`...require('@vue/eslint-config-${styleGuide}/createAliasSetting')`
);
}
var isObject2 = (val) => val && typeof val === "object";
var mergeArrayWithDedupe2 = (a, b) => Array.from(/* @__PURE__ */ new Set([...a, ...b]));
function deepMerge2(target, obj) {
for (const key of Object.keys(obj)) {
const oldVal = target[key];
const newVal = obj[key];
if (Array.isArray(oldVal) && Array.isArray(newVal)) {
target[key] = mergeArrayWithDedupe2(oldVal, newVal);
} else if (isObject2(oldVal) && isObject2(newVal)) {
target[key] = deepMerge2(oldVal, newVal);
} else {
target[key] = newVal;
}
}
return target;
}
function createConfig({
vueVersion = "3.x",
// '2.x' | '3.x' (TODO: 2.7 / vue-demi)
styleGuide = "default",
// default | airbnb | typescript
hasTypeScript = false,
// js | ts
needsPrettier = false,
// true | false
additionalConfig = {},
// e.g. Cypress, createAliasSetting for Airbnb, etc.
additionalDependencies = {}
// e.g. eslint-plugin-cypress
}) {
const pkg = { devDependencies: {} };
const addDependency = (name) => {
pkg.devDependencies[name] = import_versionMap.default[name];
};
addDependency("eslint");
addDependency("eslint-plugin-vue");
if (styleGuide !== "default" || hasTypeScript || needsPrettier) {
addDependency("@rushstack/eslint-patch");
}
const language = hasTypeScript ? "typescript" : "javascript";
const eslintConfig = {
root: true,
extends: [
vueVersion.startsWith("2") ? "plugin:vue/essential" : "plugin:vue/vue3-essential"
]
};
const addDependencyAndExtend = (name) => {
addDependency(name);
eslintConfig.extends.push(name);
};
switch (`${styleGuide}-${language}`) {
case "default-javascript":
eslintConfig.extends.push("eslint:recommended");
break;
case "default-typescript":
eslintConfig.extends.push("eslint:recommended");
addDependencyAndExtend("@vue/eslint-config-typescript");
break;
case "airbnb-javascript":
case "standard-javascript":
addDependencyAndExtend(`@vue/eslint-config-${styleGuide}`);
break;
case "airbnb-typescript":
case "standard-typescript":
addDependencyAndExtend(`@vue/eslint-config-${styleGuide}-with-typescript`);
break;
default:
throw new Error(`unexpected combination of styleGuide and language: ${styleGuide}-${language}`);
}
deepMerge2(pkg.devDependencies, additionalDependencies);
deepMerge2(eslintConfig, additionalConfig);
if (needsPrettier) {
addDependency("prettier");
addDependency("@vue/eslint-config-prettier");
eslintConfig.extends.push("@vue/eslint-config-prettier/skip-formatting");
}
const files = {
".eslintrc.cjs": ""
};
if (styleGuide === "default") {
files[".eslintrc.cjs"] += "/* eslint-env node */\n";
eslintConfig.parserOptions = {
ecmaVersion: "latest"
};
}
if (pkg.devDependencies["@rushstack/eslint-patch"]) {
files[".eslintrc.cjs"] += "require('@rushstack/eslint-patch/modern-module-resolution')\n\n";
}
files[".eslintrc.cjs"] += `module.exports = ${stringifyJS(eslintConfig, styleGuide)}
`;
if (editorconfigs_exports[styleGuide]) {
files[".editorconfig"] = editorconfigs_exports[styleGuide];
}
if (needsPrettier) {
files[".prettierrc.json"] = JSON.stringify(prettierrcs_exports[styleGuide], void 0, 2);
}
return {
pkg,
files
};
}
// template/eslint/package.json
var package_default = {
devDependencies: {
"eslint-plugin-cypress": "^2.13.3"
}
};
// utils/renderEslint.ts
var eslintDeps = package_default.devDependencies;
function renderEslint(rootDir, { needsTypeScript, needsCypress, needsCypressCT, needsPrettier }) {
const additionalConfig = {};
const additionalDependencies = {};
if (needsCypress) {
additionalConfig.overrides = [
{
files: needsCypressCT ? [
"**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}",
"cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}"
] : ["cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}"],
extends: ["plugin:cypress/recommended"]
}
];
additionalDependencies["eslint-plugin-cypress"] = eslintDeps["eslint-plugin-cypress"];
}
const { pkg, files } = createConfig({
vueVersion: "3.x",
// we currently don't support other style guides
styleGuide: "default",
hasTypeScript: needsTypeScript,
needsPrettier,
additionalConfig,
additionalDependencies
});
const scripts = {
// Note that we reuse .gitignore here to avoid duplicating the configuration
lint: needsTypeScript ? "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" : "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
};
if (needsPrettier) {
scripts.format = "prettier --write src/";
}
const packageJsonPath = path3.resolve(rootDir, "package.json");
const existingPkg = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
const updatedPkg = sortDependencies(deepMerge_default(deepMerge_default(existingPkg, pkg), { scripts }));
fs3.writeFileSync(packageJsonPath, JSON.stringify(updatedPkg, null, 2) + "\n", "utf-8");
for (const [fileName, content] of Object.entries(files)) {
const fullPath = path3.resolve(rootDir, fileName);
fs3.writeFileSync(fullPath, content, "utf-8");
}
}
// index.ts
function isValidPackageName(projectName) {
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
}
function toValidPackageName(projectName) {
return projectName.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
}
function canSkipEmptying(dir) {
if (!fs4.existsSync(dir)) {
return true;
}
const files = fs4.readdirSync(dir);
if (files.length === 0) {
return true;
}
if (files.length === 1 && files[0] === ".git") {
return true;
}
return false;
}
function emptyDir(dir) {
if (!fs4.existsSync(dir)) {
return;
}
postOrderDirectoryTraverse(
dir,
(dir2) => fs4.rmdirSync(dir2),
(file) => fs4.unlinkSync(file)
);
}
async function init() {
console.log();
console.log(
// 确定 Node.js 是否在终端上下文中运行的首选方法是检查 process.stdout.isTTY 属性的值是否为 true
process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner
);
console.log();
const cwd = process.cwd();
const argv = (0, import_minimist.default)(process.argv.slice(2), {
alias: {
typescript: ["ts"],
"with-tests": ["tests"],
router: ["vue-router"]
},
string: ["_"],
// all arguments are treated as booleans
boolean: true
});
const isFeatureFlagsUsed = typeof (argv.default ?? argv.ts ?? argv.jsx ?? argv.router ?? argv.pinia ?? argv.tests ?? argv.vitest ?? argv.cypress ?? argv.playwright ?? argv.eslint) === "boolean";
let targetDir = argv._[0];
const defaultProjectName = !targetDir ? "vue-project" : targetDir;
const forceOverwrite = argv.force;
let result = {};
try {
result = await (0, import_prompts.default)(
[
// 已设置目标目录,则跳过,已目标目录作为项目名,否则展示此选项,如果未填写,则已上面定义的默认项目名为准
{
name: "projectName",
type: targetDir ? null : "text",
message: "Project name:",
initial: defaultProjectName,
onState: (state) => targetDir = String(state.value).trim() || defaultProjectName
},
// 如果目标目录不是空目录,则询问用户是否覆盖,当用户选择否时,则终止 cli
{
name: "shouldOverwrite",
type: () => canSkipEmptying(targetDir) || forceOverwrite ? null : "confirm",
message: () => {
const dirForPrompt = targetDir === "." ? "Current directory" : `Target directory "${targetDir}"`;
return `${dirForPrompt} is not empty. Remove existing files and continue?`;
}
},
{
name: "overwriteChecker",
type: (prev, values) => {
if (values.shouldOverwrite === false) {
throw new Error(red("\u2716") + " Operation cancelled");
}
return null;
}
},
{
name: "packageName",
type: () => isValidPackageName(targetDir) ? null : "text",
message: "Package name:",
initial: () => toValidPackageName(targetDir),
validate: (dir) => isValidPackageName(dir) || "Invalid package.json name"
},
{
name: "needsTypeScript",
type: () => isFeatureFlagsUsed ? null : "toggle",
message: "Add TypeScript?",
initial: false,
active: "Yes",
inactive: "No"
},
{
name: "needsJsx",
type: () => isFeatureFlagsUsed ? null : "toggle",
message: "Add JSX Support?",
initial: false,
active: "Yes",
inactive: "No"
},
{
name: "needsRouter",
type: () => isFeatureFlagsUsed ? null : "toggle",
message: "Add Vue Router for Single Page Application development?",
initial: false,
active: "Yes",
inactive: "No"
},
{
name: "needsPinia",
type: () => isFeatureFlagsUsed ? null : "toggle",
message: "Add Pinia for state management?",
initial: false,
active: "Yes",
inactive: "No"
},
{
name: "needsVitest",
type: () => isFeatureFlagsUsed ? null : "toggle",
message: "Add Vitest for Unit Testing?",
initial: false,
active: "Yes",
inactive: "No"
},
{
name: "needsE2eTesting",
type: () => isFeatureFlagsUsed ? null : "select",
message: "Add an End-to-End Testing Solution?",
initial: 0,
choices: (prev, answers) => [
{ title: "No", value: false },
{
title: "Cypress",
description: answers.needsVitest ? void 0 : "also supports unit testing with Cypress Component Testing",
value: "cypress"
},
{
title: "Playwright",
value: "playwright"
}
]
},
{
name: "needsEslint",
type: () => isFeatureFlagsUsed ? null : "toggle",
message: "Add ESLint for code quality?",
initial: false,
active: "Yes",
inactive: "No"
},
{
name: "needsPrettier",
type: (prev, values) => {
if (isFeatureFlagsUsed || !values.needsEslint) {
return null;
}
return "toggle";
},
message: "Add Prettier for code formatting?",
initial: false,
active: "Yes",
inactive: "No"
}
],
{
onCancel: () => {
throw new Error(red("\u2716") + " Operation cancelled");
}
}
);
} catch (cancelled) {
console.log(cancelled.message);
process.exit(1);
}
const {
projectName,
packageName = projectName ?? defaultProjectName,
shouldOverwrite = argv.force,
needsJsx = argv.jsx,
needsTypeScript = argv.typescript,
needsRouter = argv.router,
needsPinia = argv.pinia,
needsVitest = argv.vitest || argv.tests,
needsEslint = argv.eslint || argv["eslint-with-prettier"],
needsPrettier = argv["eslint-with-prettier"]
} = result;
const { needsE2eTesting } = result;
const needsCypress = argv.cypress || argv.tests || needsE2eTesting === "cypress";
const needsCypressCT = needsCypress && !needsVitest;
const needsPlaywright = argv.playwright || needsE2eTesting === "playwright";
const root = path4.join(cwd, targetDir);
if (fs4.existsSync(root) && shouldOverwrite) {
emptyDir(root);
} else if (!fs4.existsSync(root)) {
fs4.mkdirSync(root);
}
console.log(`
Scaffolding project in ${root}...`);
const pkg = { name: packageName, version: "0.0.0" };
fs4.writeFileSync(path4.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
const templateRoot = path4.resolve(__dirname, "template");
const render = function render2(templateName) {
const templateDir = path4.resolve(templateRoot, templateName);
renderTemplate_default(templateDir, root);
};
render("base");
if (needsJsx) {
render("config/jsx");
}
if (needsRouter) {
render("config/router");
}
if (needsPinia) {
render("config/pinia");
}
if (needsVitest) {
render("config/vitest");
}
if (needsCypress) {
render("config/cypress");
}
if (needsCypressCT) {
render("config/cypress-ct");
}
if (needsPlaywright) {
render("config/playwright");
}
if (needsTypeScript) {
render("config/typescript");
render("tsconfig/base");
if (needsCypress) {
render("tsconfig/cypress");
}
if (needsCypressCT) {
render("tsconfig/cypress-ct");
}
if (needsPlaywright) {
render("tsconfig/playwright");
}
if (needsVitest) {
render("tsconfig/vitest");
}
}
if (needsEslint) {
renderEslint(root, { needsTypeScript, needsCypress, needsCypressCT, needsPrettier });
}
const codeTemplate = (needsTypeScript ? "typescript-" : "") + (needsRouter ? "router" : "default");
render(`code/${codeTemplate}`);
if (needsPinia && needsRouter) {
render("entry/router-and-pinia");
} else if (needsPinia) {
render("entry/pinia");
} else if (needsRouter) {
render("entry/router");
} else {
render("entry/default");
}
if (needsTypeScript) {
preOrderDirectoryTraverse(
root,
() => {
},
(filepath) => {
if (filepath.endsWith(".js")) {
const tsFilePath = filepath.replace(/\.js$/, ".ts");
if (fs4.existsSync(tsFilePath)) {
fs4.unlinkSync(filepath);
} else {
fs4.renameSync(filepath, tsFilePath);
}
} else if (path4.basename(filepath) === "jsconfig.json") {
fs4.unlinkSync(filepath);
}
}
);
const indexHtmlPath = path4.resolve(root, "index.html");
const indexHtmlContent = fs4.readFileSync(indexHtmlPath, "utf8");
fs4.writeFileSync(indexHtmlPath, indexHtmlContent.replace("src/main.js", "src/main.ts"));
} else {
preOrderDirectoryTraverse(
root,
() => {
},
(filepath) => {
if (filepath.endsWith(".ts")) {
fs4.unlinkSync(filepath);
}
}
);
}
const userAgent = process.env.npm_config_user_agent ?? "";
const packageManager = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : "npm";
fs4.writeFileSync(
path4.resolve(root, "README.md"),
generateReadme({
projectName: result.projectName ?? result.packageName ?? defaultProjectName,
packageManager,
needsTypeScript,
needsVitest,
needsCypress,
needsPlaywright,
needsCypressCT,
needsEslint
})
);
console.log(`
Done. Now run:
`);
if (root !== cwd) {
const cdProjectName = path4.relative(cwd, root);
console.log(
` ${bold(green(`cd ${cdProjectName.includes(" ") ? `"${cdProjectName}"` : cdProjectName}`))}`
);
}
console.log(` ${bold(green(getCommand(packageManager, "install")))}`);
if (needsPrettier) {
console.log(` ${bold(green(getCommand(packageManager, "format")))}`);
}
console.log(` ${bold(green(getCommand(packageManager, "dev")))}`);
console.log();
}
init().catch((e) => {
console.error(e);
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/JingWa/create-vue-code-analysis.git
git@gitee.com:JingWa/create-vue-code-analysis.git
JingWa
create-vue-code-analysis
create-vue-code-analysis
main

搜索帮助