create-qwik 0.0.36 → 0.0.39-dev20220722190315
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/create-qwik +14 -14
- package/index.js +12 -8
- package/package.json +1 -1
- package/starters/apps/base/{.eslintrc.js → .eslintrc.cjs} +0 -0
- package/starters/apps/base/package.json +9 -8
- package/starters/apps/blank/package.json +5 -1
- package/starters/apps/library/package.json +9 -5
- package/starters/apps/library/vite.config.ts +2 -1
- package/starters/apps/qwik-city/package.json +6 -1
- package/starters/apps/qwik-city/src/components/breadcrumbs/breadcrumbs.css +25 -0
- package/starters/apps/qwik-city/src/components/breadcrumbs/breadcrumbs.tsx +77 -0
- package/starters/apps/qwik-city/src/components/footer/footer.css +1 -1
- package/starters/apps/qwik-city/src/components/footer/footer.tsx +3 -1
- package/starters/apps/qwik-city/src/components/header/header.css +10 -1
- package/starters/apps/qwik-city/src/components/header/header.tsx +24 -32
- package/starters/apps/qwik-city/src/components/menu/menu.css +10 -0
- package/starters/apps/qwik-city/src/components/menu/menu.tsx +4 -4
- package/starters/apps/qwik-city/src/global.css +21 -12
- package/starters/apps/qwik-city/src/routes/about-us.tsx +2 -4
- package/starters/apps/qwik-city/src/routes/api/[org]/[user].json/index.ts +12 -23
- package/starters/apps/qwik-city/src/routes/api/_layout-foo/index.tsx +16 -22
- package/starters/apps/qwik-city/src/routes/api/data.json.ts +6 -9
- package/starters/apps/qwik-city/src/routes/api/index@foo.tsx +7 -4
- package/starters/apps/qwik-city/src/routes/blog/[...slug].tsx +28 -5
- package/starters/apps/qwik-city/src/routes/blog/_layout/index.tsx +2 -2
- package/starters/apps/qwik-city/src/routes/dashboard/index.tsx +8 -0
- package/starters/apps/qwik-city/src/routes/docs/[category]/[id]/index.tsx +14 -6
- package/starters/apps/qwik-city/src/routes/docs/{_layout/docs.css → _layout!/index.css} +2 -1
- package/starters/apps/qwik-city/src/routes/docs/_layout!/index.tsx +31 -0
- package/starters/apps/qwik-city/src/routes/docs/_menu.md +4 -2
- package/starters/apps/qwik-city/src/routes/docs/getting-started.md +44 -0
- package/starters/apps/qwik-city/src/routes/docs/index.tsx +2 -4
- package/starters/apps/qwik-city/src/routes/docs/{introduction → overview}/index.md +2 -2
- package/starters/apps/qwik-city/src/routes/index.tsx +6 -1
- package/starters/apps/qwik-city/src/routes/products/[id].tsx +132 -0
- package/starters/features/react/package.json +2 -2
- package/starters/features/react/src/react/app.tsx +1 -1
- package/starters/servers/cloudflare-pages/functions/[[path]].ts +1 -1
- package/starters/servers/express/package.json +1 -1
- package/starters/servers/express/src/entry.express.tsx +2 -1
- package/starters/apps/qwik-city/src/routes/__auth/_layout.tsx +0 -17
- package/starters/apps/qwik-city/src/routes/__auth/sign-in.tsx +0 -25
- package/starters/apps/qwik-city/src/routes/__auth/sign-up.tsx +0 -29
- package/starters/apps/qwik-city/src/routes/api/on-sign-in.ts +0 -67
- package/starters/apps/qwik-city/src/routes/docs/_layout/index.tsx +0 -23
- package/starters/apps/qwik-city/src/routes/docs/getting-started.mdx +0 -32
package/create-qwik
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
8
8
|
*/
|
|
9
9
|
var Fn=Object.create;var Jt=Object.defineProperty;var Yn=Object.getOwnPropertyDescriptor;var Hn=Object.getOwnPropertyNames;var Vn=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty;var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Nn=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Hn(e))!Ln.call(i,r)&&r!==t&&Jt(i,r,{get:()=>e[r],enumerable:!(s=Yn(e,r))||s.enumerable});return i};var Gn=(i,e,t)=>(t=i!=null?Fn(Vn(i)):{},Nn(e||!i||!i.__esModule?Jt(t,"default",{value:i,enumerable:!0}):t,i));var g=u((uu,oi)=>{"use strict";var{FORCE_COLOR:zn,NODE_DISABLE_COLORS:Wn,TERM:Zn}=process.env,d={enabled:!Wn&&Zn!=="dumb"&&zn!=="0",reset:p(0,0),bold:p(1,22),dim:p(2,22),italic:p(3,23),underline:p(4,24),inverse:p(7,27),hidden:p(8,28),strikethrough:p(9,29),black:p(30,39),red:p(31,39),green:p(32,39),yellow:p(33,39),blue:p(34,39),magenta:p(35,39),cyan:p(36,39),white:p(37,39),gray:p(90,39),grey:p(90,39),bgBlack:p(40,49),bgRed:p(41,49),bgGreen:p(42,49),bgYellow:p(43,49),bgBlue:p(44,49),bgMagenta:p(45,49),bgCyan:p(46,49),bgWhite:p(47,49)};function ni(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,e.includes(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Kn(i,e){let t={has:i,keys:e};return t.reset=d.reset.bind(t),t.bold=d.bold.bind(t),t.dim=d.dim.bind(t),t.italic=d.italic.bind(t),t.underline=d.underline.bind(t),t.inverse=d.inverse.bind(t),t.hidden=d.hidden.bind(t),t.strikethrough=d.strikethrough.bind(t),t.black=d.black.bind(t),t.red=d.red.bind(t),t.green=d.green.bind(t),t.yellow=d.yellow.bind(t),t.blue=d.blue.bind(t),t.magenta=d.magenta.bind(t),t.cyan=d.cyan.bind(t),t.white=d.white.bind(t),t.gray=d.gray.bind(t),t.grey=d.grey.bind(t),t.bgBlack=d.bgBlack.bind(t),t.bgRed=d.bgRed.bind(t),t.bgGreen=d.bgGreen.bind(t),t.bgYellow=d.bgYellow.bind(t),t.bgBlue=d.bgBlue.bind(t),t.bgMagenta=d.bgMagenta.bind(t),t.bgCyan=d.bgCyan.bind(t),t.bgWhite=d.bgWhite.bind(t),t}function p(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:d.enabled?ni(this.keys,s+""):s+""):s===void 0?Kn([i],[t]):d.enabled?ni([t],s+""):s+""}}oi.exports=d});var li=u((au,hi)=>{"use strict";hi.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var ve=u((cu,ui)=>{"use strict";ui.exports=i=>{let e=["[\\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("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var b=u((du,ai)=>{"use strict";var Re="\x1B",m=`${Re}[`,Qn="\x07",ke={to(i,e){return e?`${m}${e+1};${i+1}H`:`${m}${i+1}G`},move(i,e){let t="";return i<0?t+=`${m}${-i}D`:i>0&&(t+=`${m}${i}C`),e<0?t+=`${m}${-e}A`:e>0&&(t+=`${m}${e}B`),t},up:(i=1)=>`${m}${i}A`,down:(i=1)=>`${m}${i}B`,forward:(i=1)=>`${m}${i}C`,backward:(i=1)=>`${m}${i}D`,nextLine:(i=1)=>`${m}E`.repeat(i),prevLine:(i=1)=>`${m}F`.repeat(i),left:`${m}G`,hide:`${m}?25l`,show:`${m}?25h`,save:`${Re}7`,restore:`${Re}8`},Xn={up:(i=1)=>`${m}S`.repeat(i),down:(i=1)=>`${m}T`.repeat(i)},eo={screen:`${m}2J`,up:(i=1)=>`${m}1J`.repeat(i),down:(i=1)=>`${m}J`.repeat(i),line:`${m}2K`,lineEnd:`${m}K`,lineStart:`${m}1K`,lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?ke.up():"");return i&&(e+=ke.left),e}};ai.exports={cursor:ke,scroll:Xn,erase:eo,beep:Qn}});var gi=u((fu,pi)=>{"use strict";function to(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=io(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(a){throw a},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
10
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function io(i,e){if(!!i){if(typeof i=="string")return ci(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ci(i,e)}}function ci(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}var so=ve(),fi=b(),di=fi.erase,ro=fi.cursor,no=i=>[...so(i)].length;pi.exports=function(i,e){if(!e)return di.line+ro.to(0);let t=0,s=i.split(/\r?\n/);var r=to(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(no(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return di.lines(t)}});var Fe=u((pu,mi)=>{"use strict";var ee={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},oo={arrowUp:ee.arrowUp,arrowDown:ee.arrowDown,arrowLeft:ee.arrowLeft,arrowRight:ee.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},ho=process.platform==="win32"?oo:ee;mi.exports=ho});var vi=u((gu,bi)=>{"use strict";var
|
|
10
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function io(i,e){if(!!i){if(typeof i=="string")return ci(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ci(i,e)}}function ci(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}var so=ve(),fi=b(),di=fi.erase,ro=fi.cursor,no=i=>[...so(i)].length;pi.exports=function(i,e){if(!e)return di.line+ro.to(0);let t=0,s=i.split(/\r?\n/);var r=to(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(no(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return di.lines(t)}});var Fe=u((pu,mi)=>{"use strict";var ee={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},oo={arrowUp:ee.arrowUp,arrowDown:ee.arrowDown,arrowLeft:ee.arrowLeft,arrowRight:ee.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},ho=process.platform==="win32"?oo:ee;mi.exports=ho});var vi=u((gu,bi)=>{"use strict";var J=g(),B=Fe(),Ye=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),lo=i=>Ye[i]||Ye.default,te=Object.freeze({aborted:J.red(B.cross),done:J.green(B.tick),exited:J.yellow(B.cross),default:J.cyan("?")}),uo=(i,e,t)=>e?te.aborted:t?te.exited:i?te.done:te.default,ao=i=>J.gray(i?B.ellipsis:B.pointerSmall),co=(i,e)=>J.gray(i?e?B.pointerSmall:"+":B.line);bi.exports={styles:Ye,render:lo,symbols:te,symbol:uo,delimiter:ao,item:co}});var yi=u((mu,wi)=>{"use strict";var fo=ve();wi.exports=function(i,e){let t=String(fo(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var Si=u((bu,xi)=>{"use strict";xi.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
|
|
11
11
|
`)).join(`
|
|
12
12
|
`)}});var qi=u((vu,Oi)=>{"use strict";Oi.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var x=u((wu,Mi)=>{"use strict";Mi.exports={action:li(),clear:gi(),style:vi(),strip:ve(),figures:Fe(),lines:yi(),wrap:Si(),entriesToDisplay:qi()}});var C=u((yu,Ii)=>{"use strict";var Ti=require("readline"),po=x(),go=po.action,mo=require("events"),$i=b(),bo=$i.beep,vo=$i.cursor,wo=g(),He=class extends mo{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=Ti.createInterface({input:this.in,escapeCodeTimeout:50});Ti.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let h=go(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(vo.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(bo)}render(){this.onRender(wo),this.firstRender&&(this.firstRender=!1)}};Ii.exports=He});var Ei=u((xu,Ci)=>{"use strict";function _i(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function Pi(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){_i(n,s,r,o,h,"next",l)}function h(l){_i(n,s,r,o,h,"throw",l)}o(void 0)})}}var we=g(),yo=C(),Di=b(),xo=Di.erase,ie=Di.cursor,ye=x(),Ve=ye.style,Le=ye.clear,So=ye.lines,Oo=ye.figures,Ne=class extends yo{constructor(e={}){super(e),this.transform=Ve.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Le("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=we.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,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=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
13
13
|
`),this.close()}validate(){var e=this;return Pi(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Pi(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
@@ -20,7 +20,7 @@ ${s?" ":Oo.pointerSmall} ${we.red().italic(t)}`,"")),this.out.write(xo.line+ie.t
|
|
|
20
20
|
`+Mo(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${E.gray(h)}
|
|
21
21
|
`}}this.out.write(this.outputText)}};Ri.exports=Ge});var Ni=u((Ou,Li)=>{"use strict";var Se=g(),_o=C(),Hi=x(),Fi=Hi.style,Po=Hi.clear,Vi=b(),Yi=Vi.cursor,Do=Vi.erase,Be=class extends _o{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.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=!0,this.fire(),this.render(),this.out.write(`
|
|
22
22
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
23
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,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()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Yi.hide):this.out.write(Po(this.outputText,this.out.columns)),super.render(),this.outputText=[Fi.symbol(this.done,this.aborted),Se.bold(this.msg),Fi.delimiter(this.done),this.value?this.inactive:Se.cyan().underline(this.inactive),Se.gray("/"),this.value?Se.cyan().underline(this.active):this.active].join(" "),this.out.write(Do.line+Yi.to(0)+this.outputText))}};Li.exports=Be});var M=u((qu,Gi)=>{"use strict";var
|
|
23
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,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()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Yi.hide):this.out.write(Po(this.outputText,this.out.columns)),super.render(),this.outputText=[Fi.symbol(this.done,this.aborted),Se.bold(this.msg),Fi.delimiter(this.done),this.value?this.inactive:Se.cyan().underline(this.inactive),Se.gray("/"),this.value?Se.cyan().underline(this.active):this.active].join(" "),this.out.write(Do.line+Yi.to(0)+this.outputText))}};Li.exports=Be});var M=u((qu,Gi)=>{"use strict";var z=class{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof z)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof z)}toString(){return String(this.date)}};Gi.exports=z});var Ui=u((Mu,Bi)=>{"use strict";var Co=M(),Ue=class extends Co{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Bi.exports=Ue});var zi=u((Tu,Ji)=>{"use strict";var Eo=M(),jo=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Je=class extends Eo{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+jo(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Ji.exports=Je});var Zi=u(($u,Wi)=>{"use strict";var Ao=M(),ze=class extends Ao{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Wi.exports=ze});var Qi=u((Iu,Ki)=>{"use strict";var Ro=M(),We=class extends Ro{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Ki.exports=We});var es=u((_u,Xi)=>{"use strict";var ko=M(),Ze=class extends ko{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Xi.exports=Ze});var is=u((Pu,ts)=>{"use strict";var Fo=M(),Ke=class extends Fo{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};ts.exports=Ke});var rs=u((Du,ss)=>{"use strict";var Yo=M(),Qe=class extends Yo{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};ss.exports=Qe});var os=u((Cu,ns)=>{"use strict";var Ho=M(),Xe=class extends Ho{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};ns.exports=Xe});var ls=u((Eu,hs)=>{"use strict";hs.exports={DatePart:M(),Meridiem:Ui(),Day:zi(),Hours:Zi(),Milliseconds:Qi(),Minutes:es(),Month:is(),Seconds:rs(),Year:os()}});var vs=u((ju,bs)=>{"use strict";function us(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function as(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){us(n,s,r,o,h,"next",l)}function h(l){us(n,s,r,o,h,"throw",l)}o(void 0)})}}var et=g(),Vo=C(),it=x(),cs=it.style,ds=it.clear,Lo=it.figures,ms=b(),No=ms.erase,fs=ms.cursor,j=ls(),ps=j.DatePart,Go=j.Meridiem,Bo=j.Day,Uo=j.Hours,Jo=j.Milliseconds,zo=j.Minutes,Wo=j.Month,Zo=j.Seconds,Ko=j.Year,Qo=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,gs={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Bo(i),3:i=>new Wo(i),4:i=>new Ko(i),5:i=>new Go(i),6:i=>new Uo(i),7:i=>new zo(i),8:i=>new Zo(i),9:i=>new Jo(i)},Xo={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(",")},tt=class extends Vo{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Xo,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=ds("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=Qo.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in gs?gs[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof ps)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
24
24
|
`),this.close()}validate(){var e=this;return as(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return as(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
25
25
|
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof ps)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(fs.hide):this.out.write(ds(this.outputText,this.out.columns)),super.render(),this.outputText=[cs.symbol(this.done,this.aborted),et.bold(this.msg),cs.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?et.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
26
26
|
`).reduce((e,t,s)=>e+`
|
|
@@ -44,18 +44,18 @@ Instructions:
|
|
|
44
44
|
`),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):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(e,t,s,r){let n,o=s?ut.arrowUp:r?ut.arrowDown:" ",h=t?ne.cyan().underline(e.title):e.title;return o=(t?ne.cyan(ut.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
45
45
|
`+fh(e.description,{margin:3,width:this.out.columns}))),o+" "+h+ne.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Ps.hide):this.out.write(Ds(this.outputText,this.out.columns)),super.render();let e=ph(this.select,this.choices.length,this.limit),t=e.startIndex,s=e.endIndex;if(this.outputText=[lt.symbol(this.done,this.aborted,this.exited),ne.bold(this.msg),lt.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let r=this.suggestions.slice(t,s).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===s-1&&s<this.choices.length)).join(`
|
|
46
46
|
`);this.outputText+=`
|
|
47
|
-
`+(r||ne.gray(this.fallback.title))}this.out.write(dh.line+Ps.to(0)+this.outputText)}};js.exports=at});var Ys=u((Fu,Fs)=>{"use strict";var A=g(),bh=b(),vh=bh.cursor,wh=ht(),dt=x(),Rs=dt.clear,ks=dt.style,
|
|
47
|
+
`+(r||ne.gray(this.fallback.title))}this.out.write(dh.line+Ps.to(0)+this.outputText)}};js.exports=at});var Ys=u((Fu,Fs)=>{"use strict";var A=g(),bh=b(),vh=bh.cursor,wh=ht(),dt=x(),Rs=dt.clear,ks=dt.style,W=dt.figures,ct=class extends wh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Rs("",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(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
48
48
|
Instructions:
|
|
49
|
-
${
|
|
50
|
-
${
|
|
49
|
+
${W.arrowUp}/${W.arrowDown}: Highlight option
|
|
50
|
+
${W.arrowLeft}/${W.arrowRight}/[space]: Toggle selection
|
|
51
51
|
[a,b,c]/delete: Filter choices
|
|
52
52
|
enter/return: Complete answer
|
|
53
53
|
`:""}renderCurrentInput(){return`
|
|
54
54
|
Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
|
|
55
|
-
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?A.gray().underline(t.title):A.strikethrough().gray(t.title):r=e===s?A.cyan().underline(t.title):t.title,(t.selected?A.green(
|
|
55
|
+
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?A.gray().underline(t.title):A.strikethrough().gray(t.title):r=e===s?A.cyan().underline(t.title):t.title,(t.selected?A.green(W.radioOn):W.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[A.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(A.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(vh.hide),super.render();let e=[ks.symbol(this.done,this.aborted),A.bold(this.msg),ks.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=A.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Rs(e,this.out.columns)}};Fs.exports=ct});var Us=u((Yu,Bs)=>{"use strict";var Hs=g(),yh=C(),Ns=x(),Vs=Ns.style,xh=Ns.clear,Gs=b(),Sh=Gs.erase,Ls=Gs.cursor,ft=class extends yh{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
56
56
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
57
57
|
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Ls.hide):this.out.write(xh(this.outputText,this.out.columns)),super.render(),this.outputText=[Vs.symbol(this.done,this.aborted),Hs.bold(this.msg),Vs.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Hs.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Sh.line+Ls.to(0)+this.outputText))}};Bs.exports=ft});var zs=u((Hu,Js)=>{"use strict";Js.exports={TextPrompt:Ei(),SelectPrompt:ki(),TogglePrompt:Ni(),DatePrompt:vs(),NumberPrompt:Ms(),MultiselectPrompt:ht(),AutocompletePrompt:As(),AutocompleteMultiselectPrompt:Ys(),ConfirmPrompt:Us()}});var Zs=u(Ws=>{"use strict";var w=Ws,Oh=zs(),Te=i=>i;function $(i,e,t={}){return new Promise((s,r)=>{let n=new Oh[i](e),o=t.onAbort||Te,h=t.onSubmit||Te,l=t.onExit||Te;n.on("state",e.onState||Te),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}w.text=i=>$("TextPrompt",i);w.password=i=>(i.style="password",w.text(i));w.invisible=i=>(i.style="invisible",w.text(i));w.number=i=>$("NumberPrompt",i);w.date=i=>$("DatePrompt",i);w.confirm=i=>$("ConfirmPrompt",i);w.list=i=>{let e=i.separator||",";return $("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};w.toggle=i=>$("TogglePrompt",i);w.select=i=>$("SelectPrompt",i);w.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return $("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};w.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return $("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var qh=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));w.autocomplete=i=>(i.suggest=i.suggest||qh,i.choices=[].concat(i.choices||[]),$("AutocompletePrompt",i))});var rr=u((Lu,sr)=>{"use strict";function Ks(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function Qs(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ks(Object(t),!0).forEach(function(s){Mh(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ks(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function Mh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Th(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=$h(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(a){throw a},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
58
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function $h(i,e){if(!!i){if(typeof i=="string")return Xs(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Xs(i,e)}}function Xs(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function er(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function tr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){er(n,s,r,o,h,"next",l)}function h(l){er(n,s,r,o,h,"throw",l)}o(void 0)})}}var pt=Zs(),Ih=["suggest","format","onState","validate","onRender","type"],ir=()=>{};function V(){return gt.apply(this,arguments)}function gt(){return gt=tr(function*(i=[],{onSubmit:e=ir,onCancel:t=ir}={}){let s={},r=V._override||{};i=[].concat(i);let n,o,h,l,a,
|
|
58
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function $h(i,e){if(!!i){if(typeof i=="string")return Xs(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Xs(i,e)}}function Xs(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function er(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function tr(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){er(n,s,r,o,h,"next",l)}function h(l){er(n,s,r,o,h,"throw",l)}o(void 0)})}}var pt=Zs(),Ih=["suggest","format","onState","validate","onRender","type"],ir=()=>{};function V(){return gt.apply(this,arguments)}function gt(){return gt=tr(function*(i=[],{onSubmit:e=ir,onCancel:t=ir}={}){let s={},r=V._override||{};i=[].concat(i);let n,o,h,l,a,G,X=function(){var Y=tr(function*(D,de,Ut=!1){if(!(!Ut&&D.validate&&D.validate(de)!==!0))return D.format?yield D.format(de,s):de});return function(de,Ut){return Y.apply(this,arguments)}}();var v=Th(i),O;try{for(v.s();!(O=v.n()).done;){o=O.value;var ce=o;if(l=ce.name,a=ce.type,typeof a=="function"&&(a=yield a(n,Qs({},s),o),o.type=a),!!a){for(let Y in o){if(Ih.includes(Y))continue;let D=o[Y];o[Y]=typeof D=="function"?yield D(n,Qs({},s),G):D}if(G=o,typeof o.message!="string")throw new Error("prompt message is required");var Bt=o;if(l=Bt.name,a=Bt.type,pt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=yield X(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=V._injected?_h(V._injected,o.initial):yield pt[a](o),s[l]=n=yield X(o,n,!0),h=yield e(o,n,s)}catch{h=!(yield t(o,s))}if(h)return s}}}catch(Y){v.e(Y)}finally{v.f()}return s}),gt.apply(this,arguments)}function _h(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Ph(i){V._injected=(V._injected||[]).concat(i)}function Dh(i){V._override=Object.assign({},i)}sr.exports=Object.assign(V,{prompt:V,prompts:pt,inject:Ph,override:Dh})});var or=u((Nu,nr)=>{"use strict";nr.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var $e=u((Gu,hr)=>{"use strict";hr.exports=i=>{let e=["[\\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("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var ar=u((Bu,ur)=>{"use strict";var Ch=$e(),{erase:lr,cursor:Eh}=b(),jh=i=>[...Ch(i)].length;ur.exports=function(i,e){if(!e)return lr.line+Eh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(jh(r)-1,0)/e);return lr.lines(t)}});var mt=u((Uu,cr)=>{"use strict";var he={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Ah={arrowUp:he.arrowUp,arrowDown:he.arrowDown,arrowLeft:he.arrowLeft,arrowRight:he.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Rh=process.platform==="win32"?Ah:he;cr.exports=Rh});var fr=u((Ju,dr)=>{"use strict";var Z=g(),U=mt(),bt=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),kh=i=>bt[i]||bt.default,le=Object.freeze({aborted:Z.red(U.cross),done:Z.green(U.tick),exited:Z.yellow(U.cross),default:Z.cyan("?")}),Fh=(i,e,t)=>e?le.aborted:t?le.exited:i?le.done:le.default,Yh=i=>Z.gray(i?U.ellipsis:U.pointerSmall),Hh=(i,e)=>Z.gray(i?e?U.pointerSmall:"+":U.line);dr.exports={styles:bt,render:kh,symbols:le,symbol:Fh,delimiter:Yh,item:Hh}});var gr=u((zu,pr)=>{"use strict";var Vh=$e();pr.exports=function(i,e){let t=String(Vh(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var br=u((Wu,mr)=>{"use strict";mr.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
|
|
59
59
|
`)).join(`
|
|
60
60
|
`)}});var wr=u((Zu,vr)=>{"use strict";vr.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var S=u((Ku,yr)=>{"use strict";yr.exports={action:or(),clear:ar(),style:fr(),strip:$e(),figures:mt(),lines:gr(),wrap:br(),entriesToDisplay:wr()}});var R=u((Qu,Sr)=>{"use strict";var xr=require("readline"),{action:Lh}=S(),Nh=require("events"),{beep:Gh,cursor:Bh}=b(),Uh=g(),vt=class extends Nh{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=xr.createInterface({input:this.in,escapeCodeTimeout:50});xr.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let h=Lh(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(Bh.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Gh)}render(){this.onRender(Uh),this.firstRender&&(this.firstRender=!1)}};Sr.exports=vt});var qr=u((Xu,Or)=>{var Ie=g(),Jh=R(),{erase:zh,cursor:ue}=b(),{style:wt,clear:yt,lines:Wh,figures:Zh}=S(),xt=class extends Jh{constructor(e={}){super(e),this.transform=wt.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=yt("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Ie.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,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=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
61
61
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
@@ -68,7 +68,7 @@ ${s?" ":Zh.pointerSmall} ${Ie.red().italic(t)}`,"")),this.out.write(zh.line+ue.t
|
|
|
68
68
|
`+Qh(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${r}${k.gray(o)}
|
|
69
69
|
`}}this.out.write(this.outputText)}};$r.exports=St});var Cr=u((ta,Dr)=>{var Pe=g(),tl=R(),{style:_r,clear:il}=S(),{cursor:Pr,erase:sl}=b(),Ot=class extends tl{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.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=!0,this.fire(),this.render(),this.out.write(`
|
|
70
70
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
71
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,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()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Pr.hide):this.out.write(il(this.outputText,this.out.columns)),super.render(),this.outputText=[_r.symbol(this.done,this.aborted),Pe.bold(this.msg),_r.delimiter(this.done),this.value?this.inactive:Pe.cyan().underline(this.inactive),Pe.gray("/"),this.value?Pe.cyan().underline(this.active):this.active].join(" "),this.out.write(sl.line+Pr.to(0)+this.outputText))}};Dr.exports=Ot});var I=u((ia,Er)=>{"use strict";var
|
|
71
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,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()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Pr.hide):this.out.write(il(this.outputText,this.out.columns)),super.render(),this.outputText=[_r.symbol(this.done,this.aborted),Pe.bold(this.msg),_r.delimiter(this.done),this.value?this.inactive:Pe.cyan().underline(this.inactive),Pe.gray("/"),this.value?Pe.cyan().underline(this.active):this.active].join(" "),this.out.write(sl.line+Pr.to(0)+this.outputText))}};Dr.exports=Ot});var I=u((ia,Er)=>{"use strict";var K=class{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof K)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof K)}toString(){return String(this.date)}};Er.exports=K});var Ar=u((sa,jr)=>{"use strict";var rl=I(),qt=class extends rl{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};jr.exports=qt});var kr=u((ra,Rr)=>{"use strict";var nl=I(),ol=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Mt=class extends nl{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+ol(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Rr.exports=Mt});var Yr=u((na,Fr)=>{"use strict";var hl=I(),Tt=class extends hl{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Fr.exports=Tt});var Vr=u((oa,Hr)=>{"use strict";var ll=I(),$t=class extends ll{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Hr.exports=$t});var Nr=u((ha,Lr)=>{"use strict";var ul=I(),It=class extends ul{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Lr.exports=It});var Br=u((la,Gr)=>{"use strict";var al=I(),_t=class extends al{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Gr.exports=_t});var Jr=u((ua,Ur)=>{"use strict";var cl=I(),Pt=class extends cl{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Ur.exports=Pt});var Wr=u((aa,zr)=>{"use strict";var dl=I(),Dt=class extends dl{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};zr.exports=Dt});var Kr=u((ca,Zr)=>{"use strict";Zr.exports={DatePart:I(),Meridiem:Ar(),Day:kr(),Hours:Yr(),Milliseconds:Vr(),Minutes:Nr(),Month:Br(),Seconds:Jr(),Year:Wr()}});var nn=u((da,rn)=>{"use strict";var Ct=g(),fl=R(),{style:Qr,clear:Xr,figures:pl}=S(),{erase:gl,cursor:en}=b(),{DatePart:tn,Meridiem:ml,Day:bl,Hours:vl,Milliseconds:wl,Minutes:yl,Month:xl,Seconds:Sl,Year:Ol}=Kr(),ql=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,sn={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new bl(i),3:i=>new xl(i),4:i=>new Ol(i),5:i=>new ml(i),6:i=>new vl(i),7:i=>new yl(i),8:i=>new Sl(i),9:i=>new wl(i)},Ml={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(",")},Et=class extends fl{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Ml,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Xr("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=ql.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in sn?sn[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof tn)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
72
72
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
73
73
|
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof tn)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(en.hide):this.out.write(Xr(this.outputText,this.out.columns)),super.render(),this.outputText=[Qr.symbol(this.done,this.aborted),Ct.bold(this.msg),Qr.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?Ct.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
74
74
|
`).reduce((e,t,s)=>e+`
|
|
@@ -92,16 +92,16 @@ Instructions:
|
|
|
92
92
|
`),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):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(e,t,s,r){let n,o=s?Ht.arrowUp:r?Ht.arrowDown:" ",h=t?ae.cyan().underline(e.title):e.title;return o=(t?ae.cyan(Ht.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
93
93
|
`+kl(e.description,{margin:3,width:this.out.columns}))),o+" "+h+ae.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(fn.hide):this.out.write(pn(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Fl(this.select,this.choices.length,this.limit);if(this.outputText=[Yt.symbol(this.done,this.aborted,this.exited),ae.bold(this.msg),Yt.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let s=this.suggestions.slice(e,t).map((r,n)=>this.renderOption(r,this.select===n+e,n===0&&e>0,n+e===t-1&&t<this.choices.length)).join(`
|
|
94
94
|
`);this.outputText+=`
|
|
95
|
-
`+(s||ae.gray(this.fallback.title))}this.out.write(Rl.line+fn.to(0)+this.outputText)}};mn.exports=Vt});var xn=u((ma,yn)=>{"use strict";var F=g(),{cursor:Vl}=b(),Ll=Ft(),{clear:vn,style:wn,figures:
|
|
95
|
+
`+(s||ae.gray(this.fallback.title))}this.out.write(Rl.line+fn.to(0)+this.outputText)}};mn.exports=Vt});var xn=u((ma,yn)=>{"use strict";var F=g(),{cursor:Vl}=b(),Ll=Ft(),{clear:vn,style:wn,figures:Q}=S(),Lt=class extends Ll{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=vn("",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(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
96
96
|
Instructions:
|
|
97
|
-
${
|
|
98
|
-
${
|
|
97
|
+
${Q.arrowUp}/${Q.arrowDown}: Highlight option
|
|
98
|
+
${Q.arrowLeft}/${Q.arrowRight}/[space]: Toggle selection
|
|
99
99
|
[a,b,c]/delete: Filter choices
|
|
100
100
|
enter/return: Complete answer
|
|
101
101
|
`:""}renderCurrentInput(){return`
|
|
102
102
|
Filtered results for: ${this.inputValue?this.inputValue:F.gray("Enter something to filter")}
|
|
103
|
-
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?F.gray().underline(t.title):F.strikethrough().gray(t.title):r=e===s?F.cyan().underline(t.title):t.title,(t.selected?F.green(
|
|
103
|
+
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?F.gray().underline(t.title):F.strikethrough().gray(t.title):r=e===s?F.cyan().underline(t.title):t.title,(t.selected?F.green(Q.radioOn):Q.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[F.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(F.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Vl.hide),super.render();let e=[wn.symbol(this.done,this.aborted),F.bold(this.msg),wn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=F.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=vn(e,this.out.columns)}};yn.exports=Lt});var Tn=u((ba,Mn)=>{var Sn=g(),Nl=R(),{style:On,clear:Gl}=S(),{erase:Bl,cursor:qn}=b(),Nt=class extends Nl{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
104
104
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
105
|
-
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(qn.hide):this.out.write(Gl(this.outputText,this.out.columns)),super.render(),this.outputText=[On.symbol(this.done,this.aborted),Sn.bold(this.msg),On.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Sn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Bl.line+qn.to(0)+this.outputText))}};Mn.exports=Nt});var In=u((va,$n)=>{"use strict";$n.exports={TextPrompt:qr(),SelectPrompt:Ir(),TogglePrompt:Cr(),DatePrompt:nn(),NumberPrompt:un(),MultiselectPrompt:Ft(),AutocompletePrompt:bn(),AutocompleteMultiselectPrompt:xn(),ConfirmPrompt:Tn()}});var Pn=u(_n=>{"use strict";var y=_n,Ul=In(),Ee=i=>i;function P(i,e,t={}){return new Promise((s,r)=>{let n=new Ul[i](e),o=t.onAbort||Ee,h=t.onSubmit||Ee,l=t.onExit||Ee;n.on("state",e.onState||Ee),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}y.text=i=>P("TextPrompt",i);y.password=i=>(i.style="password",y.text(i));y.invisible=i=>(i.style="invisible",y.text(i));y.number=i=>P("NumberPrompt",i);y.date=i=>P("DatePrompt",i);y.confirm=i=>P("ConfirmPrompt",i);y.list=i=>{let e=i.separator||",";return P("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};y.toggle=i=>P("TogglePrompt",i);y.select=i=>P("SelectPrompt",i);y.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return P("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};y.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return P("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Jl=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));y.autocomplete=i=>(i.suggest=i.suggest||Jl,i.choices=[].concat(i.choices||[]),P("AutocompletePrompt",i))});var En=u((ya,Cn)=>{"use strict";var Gt=Pn(),zl=["suggest","format","onState","validate","onRender","type"],Dn=()=>{};async function N(i=[],{onSubmit:e=Dn,onCancel:t=Dn}={}){let s={},r=N._override||{};i=[].concat(i);let n,o,h,l,a,
|
|
105
|
+
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(qn.hide):this.out.write(Gl(this.outputText,this.out.columns)),super.render(),this.outputText=[On.symbol(this.done,this.aborted),Sn.bold(this.msg),On.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Sn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Bl.line+qn.to(0)+this.outputText))}};Mn.exports=Nt});var In=u((va,$n)=>{"use strict";$n.exports={TextPrompt:qr(),SelectPrompt:Ir(),TogglePrompt:Cr(),DatePrompt:nn(),NumberPrompt:un(),MultiselectPrompt:Ft(),AutocompletePrompt:bn(),AutocompleteMultiselectPrompt:xn(),ConfirmPrompt:Tn()}});var Pn=u(_n=>{"use strict";var y=_n,Ul=In(),Ee=i=>i;function P(i,e,t={}){return new Promise((s,r)=>{let n=new Ul[i](e),o=t.onAbort||Ee,h=t.onSubmit||Ee,l=t.onExit||Ee;n.on("state",e.onState||Ee),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}y.text=i=>P("TextPrompt",i);y.password=i=>(i.style="password",y.text(i));y.invisible=i=>(i.style="invisible",y.text(i));y.number=i=>P("NumberPrompt",i);y.date=i=>P("DatePrompt",i);y.confirm=i=>P("ConfirmPrompt",i);y.list=i=>{let e=i.separator||",";return P("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};y.toggle=i=>P("TogglePrompt",i);y.select=i=>P("SelectPrompt",i);y.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return P("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};y.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return P("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Jl=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));y.autocomplete=i=>(i.suggest=i.suggest||Jl,i.choices=[].concat(i.choices||[]),P("AutocompletePrompt",i))});var En=u((ya,Cn)=>{"use strict";var Gt=Pn(),zl=["suggest","format","onState","validate","onRender","type"],Dn=()=>{};async function N(i=[],{onSubmit:e=Dn,onCancel:t=Dn}={}){let s={},r=N._override||{};i=[].concat(i);let n,o,h,l,a,G,X=async(v,O,ce=!1)=>{if(!(!ce&&v.validate&&v.validate(O)!==!0))return v.format?await v.format(O,s):O};for(o of i)if({name:l,type:a}=o,typeof a=="function"&&(a=await a(n,{...s},o),o.type=a),!!a){for(let v in o){if(zl.includes(v))continue;let O=o[v];o[v]=typeof O=="function"?await O(n,{...s},G):O}if(G=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=o,Gt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=await X(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=N._injected?Wl(N._injected,o.initial):await Gt[a](o),s[l]=n=await X(o,n,!0),h=await e(o,n,s)}catch{h=!await t(o,s)}if(h)return s}return s}function Wl(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Zl(i){N._injected=(N._injected||[]).concat(i)}function Kl(i){N._override=Object.assign({},i)}Cn.exports=Object.assign(N,{prompt:N,prompts:Gt,inject:Zl,override:Kl})});var An=u((xa,jn)=>{function Ql(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let e=0,t=process.versions.node.split(".").map(Number);for(;e<i.length;e++){if(t[e]>i[e])return!1;if(i[e]>t[e])return!0}return!1}jn.exports=Ql("8.6.0")?rr():En()});var ii=require("fs"),si=require("./index.js");var Ae,Wt,Zt,Kt,Qt=!0;typeof process<"u"&&({FORCE_COLOR:Ae,NODE_DISABLE_COLORS:Wt,NO_COLOR:Zt,TERM:Kt}=process.env||{},Qt=process.stdout&&process.stdout.isTTY);var c={enabled:!Wt&&Zt==null&&Kt!=="dumb"&&(Ae!=null&&Ae!=="0"||Qt),reset:f(0,0),bold:f(1,22),dim:f(2,22),italic:f(3,23),underline:f(4,24),inverse:f(7,27),hidden:f(8,28),strikethrough:f(9,29),black:f(30,39),red:f(31,39),green:f(32,39),yellow:f(33,39),blue:f(34,39),magenta:f(35,39),cyan:f(36,39),white:f(37,39),gray:f(90,39),grey:f(90,39),bgBlack:f(40,49),bgRed:f(41,49),bgGreen:f(42,49),bgYellow:f(43,49),bgBlue:f(44,49),bgMagenta:f(45,49),bgCyan:f(46,49),bgWhite:f(47,49)};function zt(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,~e.indexOf(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function Bn(i,e){let t={has:i,keys:e};return t.reset=c.reset.bind(t),t.bold=c.bold.bind(t),t.dim=c.dim.bind(t),t.italic=c.italic.bind(t),t.underline=c.underline.bind(t),t.inverse=c.inverse.bind(t),t.hidden=c.hidden.bind(t),t.strikethrough=c.strikethrough.bind(t),t.black=c.black.bind(t),t.red=c.red.bind(t),t.green=c.green.bind(t),t.yellow=c.yellow.bind(t),t.blue=c.blue.bind(t),t.magenta=c.magenta.bind(t),t.cyan=c.cyan.bind(t),t.white=c.white.bind(t),t.gray=c.gray.bind(t),t.grey=c.grey.bind(t),t.bgBlack=c.bgBlack.bind(t),t.bgRed=c.bgRed.bind(t),t.bgGreen=c.bgGreen.bind(t),t.bgYellow=c.bgYellow.bind(t),t.bgBlue=c.bgBlue.bind(t),t.bgMagenta=c.bgMagenta.bind(t),t.bgCyan=c.bgCyan.bind(t),t.bgWhite=c.bgWhite.bind(t),t}function f(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:c.enabled?zt(this.keys,s+""):s+""):s===void 0?Bn([i],[t]):c.enabled?zt([t],s+""):s+""}}var q=c;var Xt=require("path");function fe(i){let e=process.cwd()===i.outDir,t=(0,Xt.relative)(process.cwd(),i.outDir);console.log(""),console.log(e?`\u2B50\uFE0F ${q.green("Success!")}`:`\u2B50\uFE0F ${q.green("Success! Project saved in")} ${q.yellow(t)} ${q.green("directory")}`),console.log(""),console.log(`\u{1F916} ${q.cyan("Next steps:")}`),e||console.log(` cd ${t}`),console.log(" npm install"),console.log(" npm start"),console.log(""),console.log(`\u{1F4AC} ${q.cyan("Questions? Start the conversation at:")}`),console.log(" https://qwik.builder.io/chat"),console.log(" https://twitter.com/QwikDev"),console.log("")}function pe(i){console.error(`
|
|
106
106
|
\u274C ${q.red(i)}
|
|
107
|
-
`),process.exit(1)}var ei=require("fs"),ti=require("path");function ge(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function me(i){return(0,ti.resolve)(process.cwd(),i)}function be(i){(0,ei.existsSync)(i)&&pe(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}async function ri(i,e){let t=ge(e),s;Un()?s=process.cwd():(s=me(t),be(s),(0,ii.mkdirSync)(s,{recursive:!0}));let n=await(0,si.generateStarter)({appId:i,projectName:e,serverId:"express",outDir:s,featureIds:[]});fe(n)}function Un(){return Jn()}function Jn(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Rn=Gn(An());var je=require("./index.js");async function kn(){console.clear(),console.log(`\u{1F4AB} ${q.cyan("Let's create a Qwik app")} \u{1F4AB}`),console.log("");let i=await(0,je.getStarters)(),e=i.apps.filter(r=>r.id!=="base"),t={projectName:"",appId:"",serverId:"",featureIds:[],outDir:""};await(0,Rn.default)([{type:"text",name:"projectName",message:"Project name",initial:"qwik-app",validate:r=>{let n=ge(r);return t.outDir=me(n),be(t.outDir),!0},format:r=>t.projectName=r},{type:"select",name:"appId",message:"Select a starter",choices:e.map(r=>({title:r.name,value:r.id,description:r.description})),format:r=>t.appId=r},{type:()=>{let r=i.apps.find(n=>n.id===t.appId);return r!=null&&r.selectServer?"select":null},name:"serverId",message:"Select a server",choices:()=>[...i.servers.map(r=>({title:r.name,value:r.id,description:r.description})),{title:"Setup later",value:"no-hosting",description:"I'll setup my own hosting"}],format:r=>t.serverId=r},{type:()=>{let r=i.apps.find(n=>n.id===t.appId);return r&&r.featureOptions.length>0?"multiselect":null},name:"featureIds",message:"Features",instructions:!1,choices:()=>
|
|
107
|
+
`),process.exit(1)}var ei=require("fs"),ti=require("path");function ge(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function me(i){return(0,ti.resolve)(process.cwd(),i)}function be(i){(0,ei.existsSync)(i)&&pe(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}async function ri(i,e){let t=ge(e),s;Un()?s=process.cwd():(s=me(t),be(s),(0,ii.mkdirSync)(s,{recursive:!0}));let n=await(0,si.generateStarter)({appId:i,projectName:e,serverId:"express",outDir:s,featureIds:[]});fe(n)}function Un(){return Jn()}function Jn(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Rn=Gn(An());var je=require("./index.js");async function kn(){console.clear(),console.log(`\u{1F4AB} ${q.cyan("Let's create a Qwik app")} \u{1F4AB}`),console.log("");let i=await(0,je.getStarters)(),e=i.apps.filter(r=>r.id!=="base"),t={projectName:"",appId:"",serverId:"",featureIds:[],outDir:""};await(0,Rn.default)([{type:"text",name:"projectName",message:"Project name",initial:"qwik-app",validate:r=>{let n=ge(r);return t.outDir=me(n),be(t.outDir),!0},format:r=>t.projectName=r},{type:"select",name:"appId",message:"Select a starter",choices:e.map(r=>({title:r.name,value:r.id,description:r.description})),format:r=>t.appId=r},{type:()=>{let r=i.apps.find(n=>n.id===t.appId);return r!=null&&r.selectServer?"select":null},name:"serverId",message:"Select a server",choices:()=>[...i.servers.map(r=>({title:r.name,value:r.id,description:r.description})),{title:"Setup later",value:"no-hosting",description:"I'll setup my own hosting"}],format:r=>t.serverId=r},{type:()=>{let r=i.apps.find(n=>n.id===t.appId);return r&&r.featureOptions.length>0?"multiselect":null},name:"featureIds",message:"Features",instructions:!1,choices:()=>{let r=i.apps.find(h=>h.id===t.appId),n=[...r.featureOptions],o=[...r.featureEnabled];return n.map(h=>{let l=i.features.find(G=>G.id===h),a=o.includes(l.id);return{title:l.name,value:l.id,description:l.description,selected:a}})},format:r=>t.featureIds=r}]);let s=await(0,je.generateStarter)(t);fe(s)}async function Xl(){try{let i=process.argv.slice(2);if(i.length>=2){let e=i[0],t=i[1];await ri(e,t)}else await kn()}catch(i){pe(i.message||i)}}Xl();
|
package/index.js
CHANGED
|
@@ -5,14 +5,18 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
7
7
|
*/
|
|
8
|
-
var
|
|
9
|
-
`)}function
|
|
8
|
+
var V=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var r in t)V(e,r,{get:t[r],enumerable:!0})},W=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of q(t))!U.call(e,n)&&n!==r&&V(e,n,{get:()=>t[n],enumerable:!(s=L(t,n))||s.enumerable});return e};var v=e=>W(V({},"__esModule",{value:!0}),e);var H={};K(H,{generateStarter:()=>x,getStarters:()=>O});module.exports=v(H);var h=require("fs"),F=require("path");var f=require("fs"),T=require("path");function S(e,t,r){let s=(0,f.readdirSync)(e);for(let n of s){let o=n==="gitignore"?".gitignore":n,i=(0,T.join)(e,n),c=(0,T.join)(t,o),u=(0,f.statSync)(i);if(u.isDirectory())(0,f.mkdirSync)(c,{recursive:!0}),S(i,c,r);else if(u.isFile())if(r.length>0&&[".json",".toml",".md",".html","vite.config.ts"].some(m=>i.endsWith(m))){let m=(0,f.readFileSync)(i,"utf8");for(let I of r)m=m.replace(I[0],I[1]);(0,f.writeFileSync)(c,m)}else(0,f.copyFileSync)(i,c)}}function l(e){let t=(0,T.join)(e,"package.json");return JSON.parse((0,f.readFileSync)(t,"utf-8"))}function R(e,t){let r=(0,T.join)(e,"package.json");(0,f.writeFileSync)(r,JSON.stringify(t,null,2)+`
|
|
9
|
+
`)}function C(e){return e.toLocaleLowerCase().split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function J(e){return e.toLocaleLowerCase().replace(/ /g,"-")}function w(e,t){["scripts","dependencies","devDependencies"].forEach(s=>{B(e,t,s)})}function B(e,t,r){if(t[r]){e[r]?Object.assign(e[r],{...t[r]}):e[r]={...t[r]};let s={},n=Object.keys(e[r]).sort();for(let o of n)s[o]=e[r][o];e[r]=s}}async function x(e){if(!N(e.projectName))throw new Error("Missing project name");if(!N(e.appId))throw new Error("Missing starter id");if(!N(e.outDir))throw new Error("Missing outDir");(0,h.existsSync)(e.outDir)||(0,h.mkdirSync)(e.outDir,{recursive:!0});let t={projectName:e.projectName,appId:e.appId,serverId:e.serverId,outDir:e.outDir},r=await O(),s=r.apps.find(i=>i.id===e.appId),n=r.servers.find(i=>i.id===e.serverId),o=r.features.filter(i=>e.featureIds.includes(i.id));if(s)A(r,t,s,n,o);else throw new Error(`Invalid starter id "${e.appId}".`);return t}function A(e,t,r,s,n){var j,G;let o=[[/\bqwik-project-name\b/g,t.projectName]],i=e.apps.find(d=>d.id==="base");if(!i)throw new Error("Unable to find base app.");let c={VITE_IMPORTS:[],VITE_CONFIG:[],VITE_QWIK:[],VITE_PLUGINS:[]};if(s){let a=(j=l(s.dir).__qwik__)==null?void 0:j.vite;a!=null&&a.VITE_IMPORTS&&c.VITE_IMPORTS.push(a.VITE_IMPORTS),a!=null&&a.VITE_CONFIG&&c.VITE_CONFIG.push(a.VITE_CONFIG),a!=null&&a.VITE_QWIK&&c.VITE_QWIK.push(a.VITE_QWIK),a!=null&&a.VITE_PLUGINS&&c.VITE_PLUGINS.push(a.VITE_PLUGINS)}for(let d of n){S(d.dir,t.outDir,o);let p=(G=l(d.dir).__qwik__)==null?void 0:G.vite;p!=null&&p.VITE_IMPORTS&&c.VITE_IMPORTS.push(p.VITE_IMPORTS),p!=null&&p.VITE_CONFIG&&c.VITE_CONFIG.push(p.VITE_CONFIG),p!=null&&p.VITE_QWIK&&c.VITE_QWIK.push(p.VITE_QWIK),p!=null&&p.VITE_PLUGINS&&c.VITE_PLUGINS.push(p.VITE_PLUGINS)}o.push([/\/\* VITE_IMPORTS \*\//g,c.VITE_IMPORTS.join(`
|
|
10
|
+
`)]),o.push([/\/\* VITE_CONFIG \*\//g,c.VITE_CONFIG.join(`
|
|
11
|
+
`)]),o.push([/\/\* VITE_QWIK \*\//g,c.VITE_QWIK.join(`
|
|
12
|
+
`)]),o.push([/\/\* VITE_PLUGINS \*\//g,c.VITE_PLUGINS.join(`
|
|
13
|
+
`)]),S(i.dir,t.outDir,o),S(r.dir,t.outDir,o);let u=l(i.dir),_=l(r.dir);w(u,_);let m=["version","private","main","module","qwik","types","exports","files"];for(let d of m)_[d]!==void 0&&(u[d]=_[d]);let I=i.readme.trim()+`
|
|
10
14
|
|
|
11
|
-
`,
|
|
15
|
+
`,g=[r.description,"Vite.js tooling."];if(s){S(s.dir,t.outDir,o);let d=l(s.dir);w(u,d),d.description&&g.push(d.description),s.readme&&(I+=s.readme.trim()+`
|
|
12
16
|
|
|
13
|
-
`)}for(let
|
|
17
|
+
`)}for(let d of n){S(d.dir,t.outDir,o);let a=l(d.dir);w(u,a),a.description&&g.push(a.description),d.readme&&(I+=d.readme.trim()+`
|
|
14
18
|
|
|
15
|
-
`)}
|
|
16
|
-
`).trim(),b=[`# Qwik ${t.projectName} \u26A1\uFE0F`,"",
|
|
17
|
-
`);(0,
|
|
18
|
-
`);let
|
|
19
|
+
`)}u.name=J(t.projectName),u.description=g.join(" ").trim();let D=(0,F.join)(t.outDir,"README.md"),M=g.map(d=>`- ${d}`).join(`
|
|
20
|
+
`).trim(),b=[`# Qwik ${t.projectName} \u26A1\uFE0F`,"",M,"",I.trim(),"","--------------------","","## Related","","- [Qwik Docs](https://qwik.builder.io/)","- [Qwik Github](https://github.com/BuilderIO/qwik)","- [@QwikDev](https://twitter.com/QwikDev)","- [Discord](https://qwik.builder.io/chat)","- [Vite](https://vitejs.dev/)","- [Partytown](https://partytown.builder.io/)","- [Mitosis](https://github.com/BuilderIO/mitosis)","- [Builder.io](https://www.builder.io/)"].join(`
|
|
21
|
+
`);(0,h.writeFileSync)(D,b.trim()+`
|
|
22
|
+
`);let Q=$(u);R(t.outDir,Q)}function $(e){e={...e};let t={name:e.name,version:e.version,description:e.description,scripts:e.scripts,dependencies:e.dependencies,devDependencies:e.devDependencies};Object.keys(t).forEach(s=>{delete e[s]}),delete e.__qwik__;let r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function N(e){return typeof e=="string"&&e.trim().length>0}var E=require("fs"),y=require("path");var k=null;async function O(){return k==null&&(k=z((0,y.join)(__dirname,"starters"))),k}function z(e){return{apps:P(e,"apps"),servers:P(e,"servers"),features:P(e,"features")}}function P(e,t){let r=(0,y.join)(e,t);return(0,E.readdirSync)(r).filter(n=>(0,E.statSync)((0,y.join)(r,n)).isDirectory()).map(n=>{var _,m,I,g;let o=(0,y.join)(r,n),i=l(o),c=null;try{c=(0,E.readFileSync)((0,y.join)(o,"README.md"),"utf-8")}catch{}return{id:n,name:C(n),description:i.description??"",readme:c,dir:o,selectServer:((_=i==null?void 0:i.__qwik__)==null?void 0:_.selectServer)??!1,priority:((m=i==null?void 0:i.__qwik__)==null?void 0:m.priority)??0,featureOptions:((I=i==null?void 0:i.__qwik__)==null?void 0:I.featureOptions)??[],featureEnabled:((g=i==null?void 0:i.__qwik__)==null?void 0:g.featureEnabled)??[]}}).sort((n,o)=>n.priority>o.priority?-1:n.priority<o.priority?1:n.name<o.name?-1:n.name>o.name?1:0)}0&&(module.exports={generateStarter,getStarters});
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -9,23 +9,24 @@
|
|
|
9
9
|
"dev": "npm run dev.ssr",
|
|
10
10
|
"dev.client": "vite",
|
|
11
11
|
"dev.ssr": "node --inspect node_modules/vite/bin/vite.js --mode ssr",
|
|
12
|
-
"dev.debug": "node --inspect-brk node_modules/vite/bin/vite.js --mode ssr",
|
|
12
|
+
"dev.debug": "node --inspect-brk node_modules/vite/bin/vite.js --force --mode ssr",
|
|
13
13
|
"start": "npm run dev",
|
|
14
14
|
"lint": "eslint \"src/**/*.ts*\"",
|
|
15
15
|
"typecheck": "tsc --incremental --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@builder.io/qwik": "0.0.
|
|
18
|
+
"@builder.io/qwik": "0.0.39-dev20220722190315",
|
|
19
19
|
"@types/eslint": "8.4.5",
|
|
20
20
|
"@types/node": "latest",
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "5.30.
|
|
22
|
-
"@typescript-eslint/parser": "5.30.
|
|
23
|
-
"eslint-plugin-qwik": "0.0.
|
|
24
|
-
"eslint": "8.
|
|
25
|
-
"node-fetch": "2.
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "5.30.7",
|
|
22
|
+
"@typescript-eslint/parser": "5.30.7",
|
|
23
|
+
"eslint-plugin-qwik": "0.0.39-dev20220722190315",
|
|
24
|
+
"eslint": "8.20.0",
|
|
25
|
+
"node-fetch": "3.2.9",
|
|
26
26
|
"typescript": "4.7.4",
|
|
27
|
-
"vite": "
|
|
27
|
+
"vite": "3.0.2"
|
|
28
28
|
},
|
|
29
|
+
"type": "module",
|
|
29
30
|
"homepage": "https://qwik.builder.io/",
|
|
30
31
|
"private": true,
|
|
31
32
|
"engines": {
|
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
"description": "Blank Qwik starter app.",
|
|
3
3
|
"scripts": {
|
|
4
4
|
"build.ssr": "vite build --ssr src/entry.express.tsx",
|
|
5
|
-
"serve": "node server/entry.express
|
|
5
|
+
"serve": "node server/entry.express"
|
|
6
6
|
},
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@types/express": "4.17.13",
|
|
9
9
|
"express": "4.17.3"
|
|
10
10
|
},
|
|
11
|
+
"type": "module",
|
|
11
12
|
"__qwik__": {
|
|
12
13
|
"priority": 0,
|
|
13
14
|
"featureOptions": [
|
|
14
15
|
"prettier",
|
|
15
16
|
"tailwindcss"
|
|
17
|
+
],
|
|
18
|
+
"featureEnabled": [
|
|
19
|
+
"prettier"
|
|
16
20
|
]
|
|
17
21
|
}
|
|
18
22
|
}
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
"description": "Create a component library",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"private": false,
|
|
5
|
-
"main": "./lib/index.
|
|
6
|
-
"qwik": "./lib/index.
|
|
7
|
-
"module": "./lib/index.
|
|
5
|
+
"main": "./lib/index.qwik.cjs",
|
|
6
|
+
"qwik": "./lib/index.qwik.mjs",
|
|
7
|
+
"module": "./lib/index.qwik.mjs",
|
|
8
8
|
"types": "./lib/types/index.d.ts",
|
|
9
|
+
"type": "module",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
|
-
"import": "./lib/index.
|
|
12
|
-
"require": "./lib/index.
|
|
12
|
+
"import": "./lib/index.qwik.mjs",
|
|
13
|
+
"require": "./lib/index.qwik.cjs"
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
@@ -28,6 +29,9 @@
|
|
|
28
29
|
"priority": -1,
|
|
29
30
|
"featureOptions": [
|
|
30
31
|
"prettier"
|
|
32
|
+
],
|
|
33
|
+
"featureEnabled": [
|
|
34
|
+
"prettier"
|
|
31
35
|
]
|
|
32
36
|
}
|
|
33
37
|
}
|
|
@@ -6,10 +6,11 @@ export default defineConfig(() => {
|
|
|
6
6
|
return {
|
|
7
7
|
/* VITE_CONFIG */
|
|
8
8
|
build: {
|
|
9
|
+
target: 'es2020',
|
|
9
10
|
lib: {
|
|
10
11
|
entry: './src/index.ts',
|
|
11
12
|
formats: ['es', 'cjs'],
|
|
12
|
-
fileName: (format) => `index.${format}
|
|
13
|
+
fileName: (format) => `index.qwik.${format === 'es' ? 'mjs' : 'cjs'}`,
|
|
13
14
|
},
|
|
14
15
|
},
|
|
15
16
|
plugins: [
|
|
@@ -5,11 +5,16 @@
|
|
|
5
5
|
"selectServer": true,
|
|
6
6
|
"featureOptions": [
|
|
7
7
|
"prettier",
|
|
8
|
+
"react",
|
|
8
9
|
"tailwindcss"
|
|
10
|
+
],
|
|
11
|
+
"featureEnabled": [
|
|
12
|
+
"prettier"
|
|
9
13
|
]
|
|
10
14
|
},
|
|
15
|
+
"type": "module",
|
|
11
16
|
"devDependencies": {
|
|
12
|
-
"@builder.io/qwik-city": "0.0.
|
|
17
|
+
"@builder.io/qwik-city": "0.0.25",
|
|
13
18
|
"vite-tsconfig-paths": "3.5.0"
|
|
14
19
|
}
|
|
15
20
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
nav.breadcrumbs {
|
|
2
|
+
padding: 5px;
|
|
3
|
+
border-bottom: 1px solid #ddd;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
nav.breadcrumbs > span {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
padding: 5px 0;
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
nav.breadcrumbs > span a {
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
color: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
nav.breadcrumbs > span::after {
|
|
18
|
+
content: '>';
|
|
19
|
+
padding: 0 5px;
|
|
20
|
+
opacity: 0.4;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
nav.breadcrumbs > span:last-child::after {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { component$, Host, useScopedStyles$ } from '@builder.io/qwik';
|
|
2
|
+
import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city';
|
|
3
|
+
import styles from './breadcrumbs.css?inline';
|
|
4
|
+
|
|
5
|
+
export const Breadcrumbs = component$(
|
|
6
|
+
() => {
|
|
7
|
+
useScopedStyles$(styles);
|
|
8
|
+
|
|
9
|
+
const { menu } = useContent();
|
|
10
|
+
const loc = useLocation();
|
|
11
|
+
|
|
12
|
+
const breadcrumbs = createBreadcrumbs(menu, loc.pathname);
|
|
13
|
+
if (breadcrumbs.length === 0) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Host class="breadcrumbs">
|
|
19
|
+
{breadcrumbs.map((b) => (
|
|
20
|
+
<span>{b.href ? <a href={b.href}>{b.text}</a> : b.text}</span>
|
|
21
|
+
))}
|
|
22
|
+
</Host>
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
{ tagName: 'nav' }
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export function createBreadcrumbs(menu: ContentMenu | undefined, pathname: string) {
|
|
29
|
+
if (menu?.items) {
|
|
30
|
+
for (const indexA of menu.items) {
|
|
31
|
+
const breadcrumbA: ContentBreadcrumb = {
|
|
32
|
+
text: indexA.text,
|
|
33
|
+
};
|
|
34
|
+
if (typeof indexA.href === 'string') {
|
|
35
|
+
breadcrumbA.href = indexA.href;
|
|
36
|
+
}
|
|
37
|
+
if (indexA.href === pathname) {
|
|
38
|
+
return [breadcrumbA];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (indexA.items) {
|
|
42
|
+
for (const indexB of indexA.items) {
|
|
43
|
+
const breadcrumbB: ContentBreadcrumb = {
|
|
44
|
+
text: indexB.text,
|
|
45
|
+
};
|
|
46
|
+
if (typeof indexB.href === 'string') {
|
|
47
|
+
breadcrumbB.href = indexB.href;
|
|
48
|
+
}
|
|
49
|
+
if (indexB.href === pathname) {
|
|
50
|
+
return [breadcrumbA, breadcrumbB];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (indexB.items) {
|
|
54
|
+
for (const indexC of indexB.items) {
|
|
55
|
+
const breadcrumbC: ContentBreadcrumb = {
|
|
56
|
+
text: indexC.text,
|
|
57
|
+
};
|
|
58
|
+
if (typeof indexC.href === 'string') {
|
|
59
|
+
breadcrumbC.href = indexC.href;
|
|
60
|
+
}
|
|
61
|
+
if (indexC.href === pathname) {
|
|
62
|
+
return [breadcrumbA, breadcrumbB, breadcrumbC];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface ContentBreadcrumb {
|
|
75
|
+
text: string;
|
|
76
|
+
href?: string;
|
|
77
|
+
}
|