create-qwik 0.0.1 → 0.0.2
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/README.md +23 -6
- package/index.js +106 -2
- package/package.json +17 -25
- package/starters/apps/starter/README.md +3 -0
- package/starters/apps/starter/package.json +24 -0
- package/starters/apps/starter/rollup.config.js +30 -0
- package/starters/apps/starter/src/index.server.qwik.tsx +31 -0
- package/starters/apps/starter/src/my-app.qwik.tsx +63 -0
- package/starters/apps/starter/tsconfig.json +16 -0
- package/starters/apps/starter-builder/README.md +3 -0
- package/starters/apps/starter-builder/package.json +24 -0
- package/starters/apps/starter-builder/rollup.config.js +30 -0
- package/starters/apps/starter-builder/src/index.server.qwik.tsx +46 -0
- package/starters/apps/starter-builder/src/my-app.qwik.tsx +34 -0
- package/starters/apps/starter-builder/tsconfig.json +16 -0
- package/starters/apps/starter-partytown/README.md +3 -0
- package/starters/apps/starter-partytown/package.json +27 -0
- package/starters/apps/starter-partytown/rollup.config.js +30 -0
- package/starters/apps/starter-partytown/src/index.server.qwik.tsx +49 -0
- package/starters/apps/starter-partytown/src/my-app.qwik.tsx +103 -0
- package/starters/apps/starter-partytown/tsconfig.json +16 -0
- package/starters/apps/todo/README.md +3 -0
- package/starters/apps/todo/package.json +24 -0
- package/starters/apps/todo/public/base.css +141 -0
- package/starters/apps/todo/public/index.css +376 -0
- package/starters/apps/todo/rollup.config.js +30 -0
- package/starters/apps/todo/src/components.qwik.tsx +225 -0
- package/starters/apps/todo/src/index.server.qwik.tsx +43 -0
- package/starters/apps/todo/src/state.qwik.ts +64 -0
- package/starters/apps/todo/tsconfig.json +16 -0
- package/starters/servers/express/package.json +10 -0
- package/starters/servers/express/server/index.js +43 -0
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
# Create Qwik
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Interactive mode
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```
|
|
6
|
+
npm init qwik
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Command mode
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm init qwik <starter> <projectName>
|
|
13
|
+
```
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
#### Example:
|
|
8
16
|
|
|
9
17
|
```
|
|
10
|
-
|
|
18
|
+
npm init qwik hello-world my-app
|
|
11
19
|
```
|
|
12
20
|
|
|
13
|
-
##
|
|
21
|
+
## Community
|
|
22
|
+
|
|
23
|
+
- Ping us at [@QwikDev](https://twitter.com/QwikDev)
|
|
24
|
+
- Join our [Discord](https://discord.gg/JHVpZmqSs4) community.
|
|
25
|
+
- Join our [weekly office hours](https://calendar.google.com/calendar/u/0?cid=Y180ZG91YjR2NTZ1cW43YmgzbW1oZGJ2M3R2c0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t)
|
|
26
|
+
|
|
27
|
+
## Related
|
|
14
28
|
|
|
15
|
-
-
|
|
29
|
+
- [Qwik](https://github.com/BuilderIO/qwik)
|
|
30
|
+
- [Mitosis](https://github.com/BuilderIO/mitosis)
|
|
31
|
+
- [Partytown](https://github.com/BuilderIO/qwik)
|
|
32
|
+
- [Builder.io](https://github.com/BuilderIO/)
|
package/index.js
CHANGED
|
@@ -1,2 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Builder.io, Inc. All Rights Reserved.
|
|
4
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5
|
+
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
6
|
+
*/
|
|
7
|
+
var Qn=Object.create;var ve=Object.defineProperty;var eo=Object.getOwnPropertyDescriptor;var to=Object.getOwnPropertyNames,wt=Object.getOwnPropertySymbols,io=Object.getPrototypeOf,xt=Object.prototype.hasOwnProperty,so=Object.prototype.propertyIsEnumerable;var St=(i,e,t)=>e in i?ve(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Ne=(i,e)=>{for(var t in e||(e={}))xt.call(e,t)&&St(i,t,e[t]);if(wt)for(var t of wt(e))so.call(e,t)&&St(i,t,e[t]);return i};var ro=i=>ve(i,"__esModule",{value:!0});var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var no=(i,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of to(e))!xt.call(i,s)&&s!=="default"&&ve(i,s,{get:()=>e[s],enumerable:!(t=eo(e,s))||t.enumerable});return i},N=i=>no(ro(ve(i!=null?Qn(io(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var m=u((wu,jt)=>{"use strict";var{FORCE_COLOR:lo,NODE_DISABLE_COLORS:uo,TERM:ao}=process.env,d={enabled:!uo&&ao!=="dumb"&&lo!=="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 kt(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 co(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:`[${i}m`,close:`[${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?kt(this.keys,s+""):s+""):s===void 0?co([i],[t]):d.enabled?kt([t],s+""):s+""}}jt.exports=d});var At=u((xu,Et)=>{"use strict";Et.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 Me=u((Su,Rt)=>{"use strict";Rt.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((Ou,Ft)=>{"use strict";var Ve="",g=`${Ve}[`,fo="\x07",Je={to(i,e){return e?`${g}${e+1};${i+1}H`:`${g}${i+1}G`},move(i,e){let t="";return i<0?t+=`${g}${-i}D`:i>0&&(t+=`${g}${i}C`),e<0?t+=`${g}${-e}A`:e>0&&(t+=`${g}${e}B`),t},up:(i=1)=>`${g}${i}A`,down:(i=1)=>`${g}${i}B`,forward:(i=1)=>`${g}${i}C`,backward:(i=1)=>`${g}${i}D`,nextLine:(i=1)=>`${g}E`.repeat(i),prevLine:(i=1)=>`${g}F`.repeat(i),left:`${g}G`,hide:`${g}?25l`,show:`${g}?25h`,save:`${Ve}7`,restore:`${Ve}8`},po={up:(i=1)=>`${g}S`.repeat(i),down:(i=1)=>`${g}T`.repeat(i)},mo={screen:`${g}2J`,up:(i=1)=>`${g}1J`.repeat(i),down:(i=1)=>`${g}J`.repeat(i),line:`${g}2K`,lineEnd:`${g}K`,lineStart:`${g}1K`,lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?Je.up():"");return i&&(e+=Je.left),e}};Ft.exports={cursor:Je,scroll:po,erase:mo,beep:fo}});var Vt=u((qu,Lt)=>{"use strict";function go(i,e){var t=typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=bo(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.
|
|
8
|
+
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 bo(i,e){if(!!i){if(typeof i=="string")return Yt(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 Yt(i,e)}}function Yt(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 vo=Me(),Ht=b(),Nt=Ht.erase,yo=Ht.cursor,wo=i=>[...vo(i)].length;Lt.exports=function(i,e){if(!e)return Nt.line+yo.to(0);let t=0,s=i.split(/\r?\n/);var r=go(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(wo(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return Nt.lines(t)}});var Ge=u((Mu,Jt)=>{"use strict";var se={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},xo={arrowUp:se.arrowUp,arrowDown:se.arrowDown,arrowLeft:se.arrowLeft,arrowRight:se.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},So=process.platform==="win32"?xo:se;Jt.exports=So});var Ut=u((Pu,Gt)=>{"use strict";var W=m(),B=Ge(),Ue=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}`}}),Oo=i=>Ue[i]||Ue.default,re=Object.freeze({aborted:W.red(B.cross),done:W.green(B.tick),exited:W.yellow(B.cross),default:W.cyan("?")}),qo=(i,e,t)=>e?re.aborted:t?re.exited:i?re.done:re.default,Mo=i=>W.gray(i?B.ellipsis:B.pointerSmall),Po=(i,e)=>W.gray(i?e?B.pointerSmall:"+":B.line);Gt.exports={styles:Ue,render:Oo,symbols:re,symbol:qo,delimiter:Mo,item:Po}});var zt=u((Tu,Bt)=>{"use strict";var To=Me();Bt.exports=function(i,e){let t=String(To(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var Zt=u(($u,Wt)=>{"use strict";Wt.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(`
|
|
9
|
+
`)).join(`
|
|
10
|
+
`)}});var Xt=u((Cu,Kt)=>{"use strict";Kt.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((Du,Qt)=>{"use strict";Qt.exports={action:At(),clear:Vt(),style:Ut(),strip:Me(),figures:Ge(),lines:zt(),wrap:Zt(),entriesToDisplay:Xt()}});var k=u((Iu,si)=>{"use strict";var ei=require("readline"),$o=S(),Co=$o.action,Do=require("events"),ti=b(),Io=ti.beep,_o=ti.cursor,ko=m(),ii=class extends Do{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=ei.createInterface({input:this.in,escapeCodeTimeout:50});ei.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=Co(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(_o.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(Io)}render(){this.onRender(ko),this.firstRender&&(this.firstRender=!1)}};si.exports=ii});var ui=u((_u,li)=>{"use strict";function ri(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 ni(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){ri(n,s,r,o,h,"next",l)}function h(l){ri(n,s,r,o,h,"throw",l)}o(void 0)})}}var Pe=m(),jo=k(),oi=b(),Eo=oi.erase,ne=oi.cursor,Te=S(),Be=Te.style,ze=Te.clear,Ao=Te.lines,Ro=Te.figures,hi=class extends jo{constructor(e={}){super(e);this.transform=Be.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=ze("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Pe.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(`
|
|
11
|
+
`),this.close()}validate(){var e=this;return ni(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return ni(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(`
|
|
12
|
+
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0: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(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ne.down(Ao(this.outputError,this.out.columns)-1)+ze(this.outputError,this.out.columns)),this.out.write(ze(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Be.symbol(this.done,this.aborted),Pe.bold(this.msg),Be.delimiter(this.done),this.red?Pe.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
13
|
+
`).reduce((e,t,s)=>e+`
|
|
14
|
+
${s?" ":Ro.pointerSmall} ${Pe.red().italic(t)}`,"")),this.out.write(Eo.line+ne.to(0)+this.outputText+ne.save+this.outputError+ne.restore+ne.move(this.cursorOffset,0)))}};li.exports=hi});var pi=u((ku,fi)=>{"use strict";var j=m(),Fo=k(),oe=S(),ai=oe.style,ci=oe.clear,$e=oe.figures,Yo=oe.wrap,Ho=oe.entriesToDisplay,No=b(),Lo=No.cursor,di=class extends Fo{constructor(e={}){super(e);this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=ci("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
15
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Lo.hide):this.out.write(ci(this.outputText,this.out.columns)),super.render();let e=Ho(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,s=e.endIndex;if(this.outputText=[ai.symbol(this.done,this.aborted),j.bold(this.msg),ai.delimiter(!1),this.done?this.selection.title:this.selection.disabled?j.yellow(this.warn):j.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
17
|
+
`;for(let r=t;r<s;r++){let n,o,h="",l=this.choices[r];r===t&&t>0?o=$e.arrowUp:r===s-1&&s<this.choices.length?o=$e.arrowDown:o=" ",l.disabled?(n=this.cursor===r?j.gray().underline(l.title):j.strikethrough().gray(l.title),o=(this.cursor===r?j.bold().gray($e.pointer)+" ":" ")+o):(n=this.cursor===r?j.cyan().underline(l.title):l.title,o=(this.cursor===r?j.cyan($e.pointer)+" ":" ")+o,l.description&&this.cursor===r&&(h=` - ${l.description}`,(o.length+n.length+h.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(h=`
|
|
18
|
+
`+Yo(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${j.gray(h)}
|
|
19
|
+
`}}this.out.write(this.outputText)}};fi.exports=di});var xi=u((ju,wi)=>{"use strict";var Ce=m(),Vo=k(),mi=S(),gi=mi.style,Jo=mi.clear,bi=b(),vi=bi.cursor,Go=bi.erase,yi=class extends Vo{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(`
|
|
20
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
21
|
+
`),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(vi.hide):this.out.write(Jo(this.outputText,this.out.columns)),super.render(),this.outputText=[gi.symbol(this.done,this.aborted),Ce.bold(this.msg),gi.delimiter(this.done),this.value?this.inactive:Ce.cyan().underline(this.inactive),Ce.gray("/"),this.value?Ce.cyan().underline(this.active):this.active].join(" "),this.out.write(Go.line+vi.to(0)+this.outputText))}};wi.exports=yi});var M=u((Eu,Si)=>{"use strict";var he=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 he)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof he)}toString(){return String(this.date)}};Si.exports=he});var Mi=u((Au,qi)=>{"use strict";var Uo=M(),Oi=class extends Uo{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}};qi.exports=Oi});var $i=u((Ru,Ti)=>{"use strict";var Bo=M(),zo=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Pi=class extends Bo{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+zo(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Ti.exports=Pi});var Ii=u((Fu,Di)=>{"use strict";var Wo=M(),Ci=class extends Wo{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}};Di.exports=Ci});var ji=u((Yu,ki)=>{"use strict";var Zo=M(),_i=class extends Zo{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=_i});var Ri=u((Hu,Ai)=>{"use strict";var Ko=M(),Ei=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}};Ai.exports=Ei});var Hi=u((Nu,Yi)=>{"use strict";var Xo=M(),Fi=class extends Xo{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)}};Yi.exports=Fi});var Vi=u((Lu,Li)=>{"use strict";var Qo=M(),Ni=class extends Qo{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}};Li.exports=Ni});var Ui=u((Vu,Gi)=>{"use strict";var eh=M(),Ji=class extends eh{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}};Gi.exports=Ji});var zi=u((Ju,Bi)=>{"use strict";Bi.exports={DatePart:M(),Meridiem:Mi(),Day:$i(),Hours:Ii(),Milliseconds:ji(),Minutes:Ri(),Month:Hi(),Seconds:Vi(),Year:Ui()}});var ns=u((Gu,rs)=>{"use strict";function Wi(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 Zi(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Wi(n,s,r,o,h,"next",l)}function h(l){Wi(n,s,r,o,h,"throw",l)}o(void 0)})}}var We=m(),th=k(),Ze=S(),Ki=Ze.style,Xi=Ze.clear,ih=Ze.figures,Qi=b(),sh=Qi.erase,es=Qi.cursor,E=zi(),ts=E.DatePart,rh=E.Meridiem,nh=E.Day,oh=E.Hours,hh=E.Milliseconds,lh=E.Minutes,uh=E.Month,ah=E.Seconds,ch=E.Year,dh=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,is={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new nh(i),3:i=>new uh(i),4:i=>new ch(i),5:i=>new rh(i),6:i=>new oh(i),7:i=>new lh(i),8:i=>new ah(i),9:i=>new hh(i)},fh={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(",")},ss=class extends th{constructor(e={}){super(e);this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(fh,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=Xi("",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=dh.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in is?is[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 ts)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
22
|
+
`),this.close()}validate(){var e=this;return Zi(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Zi(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(`
|
|
23
|
+
`),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 ts)),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(es.hide):this.out.write(Xi(this.outputText,this.out.columns)),super.render(),this.outputText=[Ki.symbol(this.done,this.aborted),We.bold(this.msg),Ki.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?We.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
24
|
+
`).reduce((e,t,s)=>e+`
|
|
25
|
+
${s?" ":ih.pointerSmall} ${We.red().italic(t)}`,"")),this.out.write(sh.line+es.to(0)+this.outputText))}};rs.exports=ss});var fs=u((Uu,ds)=>{"use strict";function os(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 hs(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){os(n,s,r,o,h,"next",l)}function h(l){os(n,s,r,o,h,"throw",l)}o(void 0)})}}var De=m(),ph=k(),ls=b(),Ie=ls.cursor,mh=ls.erase,_e=S(),Ke=_e.style,gh=_e.figures,us=_e.clear,bh=_e.lines,vh=/[0-9]/,Xe=i=>i!==void 0,as=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},cs=class extends ph{constructor(e={}){super(e);this.transform=Ke.render(e.style),this.msg=e.message,this.initial=Xe(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Xe(e.min)?e.min:-1/0,this.max=Xe(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=De.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${as(e,this.round)}`),this._value=as(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||vh.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
26
|
+
`),this.close()}validate(){var e=this;return hs(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return hs(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let t=e.value;e.value=t!==""?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
|
|
27
|
+
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",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()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Ie.down(bh(this.outputError,this.out.columns)-1)+us(this.outputError,this.out.columns)),this.out.write(us(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ke.symbol(this.done,this.aborted),De.bold(this.msg),Ke.delimiter(this.done),!this.done||!this.done&&!this.placeholder?De[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
28
|
+
`).reduce((e,t,s)=>e+`
|
|
29
|
+
${s?" ":gh.pointerSmall} ${De.red().italic(t)}`,"")),this.out.write(mh.line+Ie.to(0)+this.outputText+Ie.save+this.outputError+Ie.restore))}};ds.exports=cs});var Qe=u((Bu,bs)=>{"use strict";var P=m(),yh=b(),wh=yh.cursor,xh=k(),le=S(),ps=le.clear,L=le.figures,ms=le.style,Sh=le.wrap,Oh=le.entriesToDisplay,gs=class extends xh{constructor(e={}){super(e);this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=ps("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
30
|
+
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
31
|
+
`),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(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[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()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
32
|
+
Instructions:
|
|
33
|
+
${L.arrowUp}/${L.arrowDown}: Highlight option
|
|
34
|
+
${L.arrowLeft}/${L.arrowRight}/[space]: Toggle selection
|
|
35
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
36
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?P.green(L.radioOn):L.radioOff)+" "+r+" ",o,h;return t.disabled?o=e===s?P.gray().underline(t.title):P.strikethrough().gray(t.title):(o=e===s?P.cyan().underline(t.title):t.title,e===s&&t.description&&(h=` - ${t.description}`,(n.length+o.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
37
|
+
`+Sh(t.description,{margin:n.length,width:this.out.columns})))),n+o+P.gray(h||"")}paginateOptions(e){if(e.length===0)return P.red("No matches for this query.");let t=Oh(this.cursor,e.length,this.optionsPerPage),s=t.startIndex,r=t.endIndex,n,o=[];for(let h=s;h<r;h++)h===s&&s>0?n=L.arrowUp:h===r-1&&r<e.length?n=L.arrowDown:n=" ",o.push(this.renderOption(this.cursor,e[h],h,n));return`
|
|
38
|
+
`+o.join(`
|
|
39
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[P.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(P.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(wh.hide),super.render();let e=[ms.symbol(this.done,this.aborted),P.bold(this.msg),ms.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=P.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=ps(e,this.out.columns)}};bs.exports=gs});var Ms=u((zu,qs)=>{"use strict";function vs(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 qh(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){vs(n,s,r,o,h,"next",l)}function h(l){vs(n,s,r,o,h,"throw",l)}o(void 0)})}}var ue=m(),Mh=k(),ys=b(),Ph=ys.erase,ws=ys.cursor,ae=S(),et=ae.style,xs=ae.clear,tt=ae.figures,Th=ae.wrap,$h=ae.entriesToDisplay,Ss=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Ch=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Dh=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},Os=class extends Mh{constructor(e={}){super(e);this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Dh(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=et.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=xs("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Ss(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return qh(function*(){let s=t.completing=t.suggest(t.input,t.choices),r=yield s;if(t.completing!==s)return;t.suggestions=r.map((o,h,l)=>({title:Ch(l,h),value:Ss(l,h),description:o.description})),t.completing=!1;let n=Math.max(r.length-1,0);t.moveSelect(Math.min(n,t.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
40
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
41
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
42
|
+
`),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?tt.arrowUp:r?tt.arrowDown:" ",h=t?ue.cyan().underline(e.title):e.title;return o=(t?ue.cyan(tt.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
43
|
+
`+Th(e.description,{margin:3,width:this.out.columns}))),o+" "+h+ue.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(ws.hide):this.out.write(xs(this.outputText,this.out.columns)),super.render();let e=$h(this.select,this.choices.length,this.limit),t=e.startIndex,s=e.endIndex;if(this.outputText=[et.symbol(this.done,this.aborted,this.exited),ue.bold(this.msg),et.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(`
|
|
44
|
+
`);this.outputText+=`
|
|
45
|
+
`+(r||ue.gray(this.fallback.title))}this.out.write(Ph.line+ws.to(0)+this.outputText)}};qs.exports=Os});var Ds=u((Wu,Cs)=>{"use strict";var A=m(),Ih=b(),_h=Ih.cursor,kh=Qe(),it=S(),Ps=it.clear,Ts=it.style,Z=it.figures,$s=class extends kh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Ps("",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:`
|
|
46
|
+
Instructions:
|
|
47
|
+
${Z.arrowUp}/${Z.arrowDown}: Highlight option
|
|
48
|
+
${Z.arrowLeft}/${Z.arrowRight}/[space]: Toggle selection
|
|
49
|
+
[a,b,c]/delete: Filter choices
|
|
50
|
+
enter/return: Complete answer
|
|
51
|
+
`:""}renderCurrentInput(){return`
|
|
52
|
+
Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
|
|
53
|
+
`}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(Z.radioOn):Z.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(_h.hide),super.render();let e=[Ts.symbol(this.done,this.aborted),A.bold(this.msg),Ts.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=Ps(e,this.out.columns)}};Cs.exports=$s});var Fs=u((Zu,Rs)=>{"use strict";var Is=m(),jh=k(),_s=S(),ks=_s.style,Eh=_s.clear,js=b(),Ah=js.erase,Es=js.cursor,As=class extends jh{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(`
|
|
54
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
55
|
+
`),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(Es.hide):this.out.write(Eh(this.outputText,this.out.columns)),super.render(),this.outputText=[ks.symbol(this.done,this.aborted),Is.bold(this.msg),ks.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Is.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Ah.line+Es.to(0)+this.outputText))}};Rs.exports=As});var Hs=u((Ku,Ys)=>{"use strict";Ys.exports={TextPrompt:ui(),SelectPrompt:pi(),TogglePrompt:xi(),DatePrompt:ns(),NumberPrompt:fs(),MultiselectPrompt:Qe(),AutocompletePrompt:Ms(),AutocompleteMultiselectPrompt:Ds(),ConfirmPrompt:Fs()}});var Ls=u(Ns=>{"use strict";var w=Ns,Rh=Hs(),ke=i=>i;function T(i,e,t={}){return new Promise((s,r)=>{let n=new Rh[i](e),o=t.onAbort||ke,h=t.onSubmit||ke,l=t.onExit||ke;n.on("state",e.onState||ke),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}w.text=i=>T("TextPrompt",i);w.password=i=>(i.style="password",w.text(i));w.invisible=i=>(i.style="invisible",w.text(i));w.number=i=>T("NumberPrompt",i);w.date=i=>T("DatePrompt",i);w.confirm=i=>T("ConfirmPrompt",i);w.list=i=>{let e=i.separator||",";return T("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};w.toggle=i=>T("TogglePrompt",i);w.select=i=>T("SelectPrompt",i);w.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return T("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 T("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Fh=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));w.autocomplete=i=>(i.suggest=i.suggest||Fh,i.choices=[].concat(i.choices||[]),T("AutocompletePrompt",i))});var Zs=u((Qu,Ws)=>{"use strict";function Vs(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 Js(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vs(Object(t),!0).forEach(function(s){Yh(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Vs(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function Yh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hh(i,e){var t=typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Nh(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.
|
|
56
|
+
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 Nh(i,e){if(!!i){if(typeof i=="string")return Gs(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 Gs(i,e)}}function Gs(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 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 Bs(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 st=Ls(),Lh=["suggest","format","onState","validate","onRender","type"],zs=()=>{};function V(){return rt.apply(this,arguments)}function rt(){return rt=Bs(function*(i=[],{onSubmit:e=zs,onCancel:t=zs}={}){let s={},r=V._override||{};i=[].concat(i);let n,o,h,l,a,Q,ee=function(){var H=Bs(function*(I,be,yt=!1){if(!(!yt&&I.validate&&I.validate(be)!==!0))return I.format?yield I.format(be,s):be});return function(be,yt){return H.apply(this,arguments)}}();var v=Hh(i),q;try{for(v.s();!(q=v.n()).done;){o=q.value;var ge=o;if(l=ge.name,a=ge.type,typeof a=="function"&&(a=yield a(n,Js({},s),o),o.type=a),!!a){for(let H in o){if(Lh.includes(H))continue;let I=o[H];o[H]=typeof I=="function"?yield I(n,Js({},s),Q):I}if(Q=o,typeof o.message!="string")throw new Error("prompt message is required");var vt=o;if(l=vt.name,a=vt.type,st[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=yield ee(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=V._injected?Vh(V._injected,o.initial):yield st[a](o),s[l]=n=yield ee(o,n,!0),h=yield e(o,n,s)}catch(H){h=!(yield t(o,s))}if(h)return s}}}catch(H){v.e(H)}finally{v.f()}return s}),rt.apply(this,arguments)}function Vh(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Jh(i){V._injected=(V._injected||[]).concat(i)}function Gh(i){V._override=Object.assign({},i)}Ws.exports=Object.assign(V,{prompt:V,prompts:st,inject:Jh,override:Gh})});var Xs=u((ea,Ks)=>{"use strict";Ks.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 je=u((ta,Qs)=>{"use strict";Qs.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 ir=u((ia,tr)=>{"use strict";var Uh=je(),{erase:er,cursor:Bh}=b(),zh=i=>[...Uh(i)].length;tr.exports=function(i,e){if(!e)return er.line+Bh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(zh(r)-1,0)/e);return er.lines(t)}});var nt=u((sa,sr)=>{"use strict";var ce={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Wh={arrowUp:ce.arrowUp,arrowDown:ce.arrowDown,arrowLeft:ce.arrowLeft,arrowRight:ce.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Zh=process.platform==="win32"?Wh:ce;sr.exports=Zh});var nr=u((ra,rr)=>{"use strict";var K=m(),z=nt(),ot=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=>ot[i]||ot.default,de=Object.freeze({aborted:K.red(z.cross),done:K.green(z.tick),exited:K.yellow(z.cross),default:K.cyan("?")}),Xh=(i,e,t)=>e?de.aborted:t?de.exited:i?de.done:de.default,Qh=i=>K.gray(i?z.ellipsis:z.pointerSmall),el=(i,e)=>K.gray(i?e?z.pointerSmall:"+":z.line);rr.exports={styles:ot,render:Kh,symbols:de,symbol:Xh,delimiter:Qh,item:el}});var hr=u((na,or)=>{"use strict";var tl=je();or.exports=function(i,e){let t=String(tl(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var ur=u((oa,lr)=>{"use strict";lr.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(`
|
|
57
|
+
`)).join(`
|
|
58
|
+
`)}});var cr=u((ha,ar)=>{"use strict";ar.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 O=u((la,dr)=>{"use strict";dr.exports={action:Xs(),clear:ir(),style:nr(),strip:je(),figures:nt(),lines:hr(),wrap:ur(),entriesToDisplay:cr()}});var R=u((ua,mr)=>{"use strict";var fr=require("readline"),{action:il}=O(),sl=require("events"),{beep:rl,cursor:nl}=b(),ol=m(),pr=class extends sl{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=fr.createInterface({input:this.in,escapeCodeTimeout:50});fr.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=il(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(nl.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(rl)}render(){this.onRender(ol),this.firstRender&&(this.firstRender=!1)}};mr.exports=pr});var vr=u((aa,br)=>{var Ee=m(),hl=R(),{erase:ll,cursor:fe}=b(),{style:ht,clear:lt,lines:ul,figures:al}=O(),gr=class extends hl{constructor(e={}){super(e);this.transform=ht.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=lt("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Ee.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(`
|
|
59
|
+
`),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(`
|
|
60
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0: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(){this.closed||(this.firstRender||(this.outputError&&this.out.write(fe.down(ul(this.outputError,this.out.columns)-1)+lt(this.outputError,this.out.columns)),this.out.write(lt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ht.symbol(this.done,this.aborted),Ee.bold(this.msg),ht.delimiter(this.done),this.red?Ee.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
61
|
+
`).reduce((e,t,s)=>e+`
|
|
62
|
+
${s?" ":al.pointerSmall} ${Ee.red().italic(t)}`,"")),this.out.write(ll.line+fe.to(0)+this.outputText+fe.save+this.outputError+fe.restore+fe.move(this.cursorOffset,0)))}};br.exports=gr});var Or=u((ca,Sr)=>{"use strict";var F=m(),cl=R(),{style:yr,clear:wr,figures:Ae,wrap:dl,entriesToDisplay:fl}=O(),{cursor:pl}=b(),xr=class extends cl{constructor(e={}){super(e);this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=wr("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
63
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
64
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(pl.hide):this.out.write(wr(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=fl(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[yr.symbol(this.done,this.aborted),F.bold(this.msg),yr.delimiter(!1),this.done?this.selection.title:this.selection.disabled?F.yellow(this.warn):F.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
65
|
+
`;for(let s=e;s<t;s++){let r,n,o="",h=this.choices[s];s===e&&e>0?n=Ae.arrowUp:s===t-1&&t<this.choices.length?n=Ae.arrowDown:n=" ",h.disabled?(r=this.cursor===s?F.gray().underline(h.title):F.strikethrough().gray(h.title),n=(this.cursor===s?F.bold().gray(Ae.pointer)+" ":" ")+n):(r=this.cursor===s?F.cyan().underline(h.title):h.title,n=(this.cursor===s?F.cyan(Ae.pointer)+" ":" ")+n,h.description&&this.cursor===s&&(o=` - ${h.description}`,(n.length+r.length+o.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(o=`
|
|
66
|
+
`+dl(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${r}${F.gray(o)}
|
|
67
|
+
`}}this.out.write(this.outputText)}};Sr.exports=xr});var $r=u((da,Tr)=>{var Re=m(),ml=R(),{style:qr,clear:gl}=O(),{cursor:Mr,erase:bl}=b(),Pr=class extends ml{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(`
|
|
68
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
69
|
+
`),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(Mr.hide):this.out.write(gl(this.outputText,this.out.columns)),super.render(),this.outputText=[qr.symbol(this.done,this.aborted),Re.bold(this.msg),qr.delimiter(this.done),this.value?this.inactive:Re.cyan().underline(this.inactive),Re.gray("/"),this.value?Re.cyan().underline(this.active):this.active].join(" "),this.out.write(bl.line+Mr.to(0)+this.outputText))}};Tr.exports=Pr});var $=u((fa,Cr)=>{"use strict";var pe=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 pe)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof pe)}toString(){return String(this.date)}};Cr.exports=pe});var _r=u((pa,Ir)=>{"use strict";var vl=$(),Dr=class extends vl{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}};Ir.exports=Dr});var Er=u((ma,jr)=>{"use strict";var yl=$(),wl=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),kr=class extends yl{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+wl(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};jr.exports=kr});var Fr=u((ga,Rr)=>{"use strict";var xl=$(),Ar=class extends xl{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}};Rr.exports=Ar});var Nr=u((ba,Hr)=>{"use strict";var Sl=$(),Yr=class extends Sl{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=Yr});var Jr=u((va,Vr)=>{"use strict";var Ol=$(),Lr=class extends Ol{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}};Vr.exports=Lr});var Br=u((ya,Ur)=>{"use strict";var ql=$(),Gr=class extends ql{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)}};Ur.exports=Gr});var Zr=u((wa,Wr)=>{"use strict";var Ml=$(),zr=class extends Ml{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}};Wr.exports=zr});var Qr=u((xa,Xr)=>{"use strict";var Pl=$(),Kr=class extends Pl{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}};Xr.exports=Kr});var tn=u((Sa,en)=>{"use strict";en.exports={DatePart:$(),Meridiem:_r(),Day:Er(),Hours:Fr(),Milliseconds:Nr(),Minutes:Jr(),Month:Br(),Seconds:Zr(),Year:Qr()}});var an=u((Oa,un)=>{"use strict";var ut=m(),Tl=R(),{style:sn,clear:rn,figures:$l}=O(),{erase:Cl,cursor:nn}=b(),{DatePart:on,Meridiem:Dl,Day:Il,Hours:_l,Milliseconds:kl,Minutes:jl,Month:El,Seconds:Al,Year:Rl}=tn(),Fl=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,hn={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Il(i),3:i=>new El(i),4:i=>new Rl(i),5:i=>new Dl(i),6:i=>new _l(i),7:i=>new jl(i),8:i=>new Al(i),9:i=>new kl(i)},Yl={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(",")},ln=class extends Tl{constructor(e={}){super(e);this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Yl,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=rn("",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=Fl.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in hn?hn[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 on)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
70
|
+
`),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(`
|
|
71
|
+
`),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 on)),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(nn.hide):this.out.write(rn(this.outputText,this.out.columns)),super.render(),this.outputText=[sn.symbol(this.done,this.aborted),ut.bold(this.msg),sn.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?ut.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
72
|
+
`).reduce((e,t,s)=>e+`
|
|
73
|
+
${s?" ":$l.pointerSmall} ${ut.red().italic(t)}`,"")),this.out.write(Cl.line+nn.to(0)+this.outputText))}};un.exports=ln});var mn=u((qa,pn)=>{var Fe=m(),Hl=R(),{cursor:Ye,erase:Nl}=b(),{style:at,figures:Ll,clear:cn,lines:Vl}=O(),Jl=/[0-9]/,ct=i=>i!==void 0,dn=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},fn=class extends Hl{constructor(e={}){super(e);this.transform=at.render(e.style),this.msg=e.message,this.initial=ct(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=ct(e.min)?e.min:-1/0,this.max=ct(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Fe.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${dn(e,this.round)}`),this._value=dn(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Jl.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
74
|
+
`),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}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
75
|
+
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",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()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Ye.down(Vl(this.outputError,this.out.columns)-1)+cn(this.outputError,this.out.columns)),this.out.write(cn(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[at.symbol(this.done,this.aborted),Fe.bold(this.msg),at.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Fe[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
76
|
+
`).reduce((e,t,s)=>e+`
|
|
77
|
+
${s?" ":Ll.pointerSmall} ${Fe.red().italic(t)}`,"")),this.out.write(Nl.line+Ye.to(0)+this.outputText+Ye.save+this.outputError+Ye.restore))}};pn.exports=fn});var dt=u((Ma,yn)=>{"use strict";var C=m(),{cursor:Gl}=b(),Ul=R(),{clear:gn,figures:J,style:bn,wrap:Bl,entriesToDisplay:zl}=O(),vn=class extends Ul{constructor(e={}){super(e);this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=gn("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
78
|
+
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
79
|
+
`),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(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[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()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
80
|
+
Instructions:
|
|
81
|
+
${J.arrowUp}/${J.arrowDown}: Highlight option
|
|
82
|
+
${J.arrowLeft}/${J.arrowRight}/[space]: Toggle selection
|
|
83
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
84
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?C.green(J.radioOn):J.radioOff)+" "+r+" ",o,h;return t.disabled?o=e===s?C.gray().underline(t.title):C.strikethrough().gray(t.title):(o=e===s?C.cyan().underline(t.title):t.title,e===s&&t.description&&(h=` - ${t.description}`,(n.length+o.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
85
|
+
`+Bl(t.description,{margin:n.length,width:this.out.columns})))),n+o+C.gray(h||"")}paginateOptions(e){if(e.length===0)return C.red("No matches for this query.");let{startIndex:t,endIndex:s}=zl(this.cursor,e.length,this.optionsPerPage),r,n=[];for(let o=t;o<s;o++)o===t&&t>0?r=J.arrowUp:o===s-1&&s<e.length?r=J.arrowDown:r=" ",n.push(this.renderOption(this.cursor,e[o],o,r));return`
|
|
86
|
+
`+n.join(`
|
|
87
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[C.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(C.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Gl.hide),super.render();let e=[bn.symbol(this.done,this.aborted),C.bold(this.msg),bn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=C.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=gn(e,this.out.columns)}};yn.exports=vn});var Mn=u((Pa,qn)=>{"use strict";var me=m(),Wl=R(),{erase:Zl,cursor:wn}=b(),{style:ft,clear:xn,figures:pt,wrap:Kl,entriesToDisplay:Xl}=O(),Sn=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Ql=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),eu=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},On=class extends Wl{constructor(e={}){super(e);this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:eu(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=ft.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=xn("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Sn(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),s=await t;if(this.completing!==t)return;this.suggestions=s.map((n,o,h)=>({title:Ql(h,o),value:Sn(h,o),description:n.description})),this.completing=!1;let r=Math.max(s.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
88
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
89
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
90
|
+
`),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?pt.arrowUp:r?pt.arrowDown:" ",h=t?me.cyan().underline(e.title):e.title;return o=(t?me.cyan(pt.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
91
|
+
`+Kl(e.description,{margin:3,width:this.out.columns}))),o+" "+h+me.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(wn.hide):this.out.write(xn(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Xl(this.select,this.choices.length,this.limit);if(this.outputText=[ft.symbol(this.done,this.aborted,this.exited),me.bold(this.msg),ft.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(`
|
|
92
|
+
`);this.outputText+=`
|
|
93
|
+
`+(s||me.gray(this.fallback.title))}this.out.write(Zl.line+wn.to(0)+this.outputText)}};qn.exports=On});var Dn=u((Ta,Cn)=>{"use strict";var Y=m(),{cursor:tu}=b(),iu=dt(),{clear:Pn,style:Tn,figures:X}=O(),$n=class extends iu{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Pn("",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:`
|
|
94
|
+
Instructions:
|
|
95
|
+
${X.arrowUp}/${X.arrowDown}: Highlight option
|
|
96
|
+
${X.arrowLeft}/${X.arrowRight}/[space]: Toggle selection
|
|
97
|
+
[a,b,c]/delete: Filter choices
|
|
98
|
+
enter/return: Complete answer
|
|
99
|
+
`:""}renderCurrentInput(){return`
|
|
100
|
+
Filtered results for: ${this.inputValue?this.inputValue:Y.gray("Enter something to filter")}
|
|
101
|
+
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?Y.gray().underline(t.title):Y.strikethrough().gray(t.title):r=e===s?Y.cyan().underline(t.title):t.title,(t.selected?Y.green(X.radioOn):X.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[Y.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(Y.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(tu.hide),super.render();let e=[Tn.symbol(this.done,this.aborted),Y.bold(this.msg),Tn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Y.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=Pn(e,this.out.columns)}};Cn.exports=$n});var An=u(($a,En)=>{var In=m(),su=R(),{style:_n,clear:ru}=O(),{erase:nu,cursor:kn}=b(),jn=class extends su{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(`
|
|
102
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
103
|
+
`),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(kn.hide):this.out.write(ru(this.outputText,this.out.columns)),super.render(),this.outputText=[_n.symbol(this.done,this.aborted),In.bold(this.msg),_n.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:In.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(nu.line+kn.to(0)+this.outputText))}};En.exports=jn});var Fn=u((Ca,Rn)=>{"use strict";Rn.exports={TextPrompt:vr(),SelectPrompt:Or(),TogglePrompt:$r(),DatePrompt:an(),NumberPrompt:mn(),MultiselectPrompt:dt(),AutocompletePrompt:Mn(),AutocompleteMultiselectPrompt:Dn(),ConfirmPrompt:An()}});var Hn=u(Yn=>{"use strict";var x=Yn,ou=Fn(),He=i=>i;function D(i,e,t={}){return new Promise((s,r)=>{let n=new ou[i](e),o=t.onAbort||He,h=t.onSubmit||He,l=t.onExit||He;n.on("state",e.onState||He),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}x.text=i=>D("TextPrompt",i);x.password=i=>(i.style="password",x.text(i));x.invisible=i=>(i.style="invisible",x.text(i));x.number=i=>D("NumberPrompt",i);x.date=i=>D("DatePrompt",i);x.confirm=i=>D("ConfirmPrompt",i);x.list=i=>{let e=i.separator||",";return D("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};x.toggle=i=>D("TogglePrompt",i);x.select=i=>D("SelectPrompt",i);x.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return D("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};x.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return D("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var hu=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));x.autocomplete=i=>(i.suggest=i.suggest||hu,i.choices=[].concat(i.choices||[]),D("AutocompletePrompt",i))});var Vn=u((Ia,Ln)=>{"use strict";var mt=Hn(),lu=["suggest","format","onState","validate","onRender","type"],Nn=()=>{};async function G(i=[],{onSubmit:e=Nn,onCancel:t=Nn}={}){let s={},r=G._override||{};i=[].concat(i);let n,o,h,l,a,Q,ee=async(v,q,ge=!1)=>{if(!(!ge&&v.validate&&v.validate(q)!==!0))return v.format?await v.format(q,s):q};for(o of i)if({name:l,type:a}=o,typeof a=="function"&&(a=await a(n,Ne({},s),o),o.type=a),!!a){for(let v in o){if(lu.includes(v))continue;let q=o[v];o[v]=typeof q=="function"?await q(n,Ne({},s),Q):q}if(Q=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=o,mt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=await ee(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=G._injected?uu(G._injected,o.initial):await mt[a](o),s[l]=n=await ee(o,n,!0),h=await e(o,n,s)}catch(v){h=!await t(o,s)}if(h)return s}return s}function uu(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function au(i){G._injected=(G._injected||[]).concat(i)}function cu(i){G._override=Object.assign({},i)}Ln.exports=Object.assign(G,{prompt:G,prompts:mt,inject:au,override:cu})});var Gn=u((_a,Jn)=>{function du(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=du("8.6.0")?Zs():Vn()});var Kn=N(require("path"));var Dt=N(require("fs"));"use strict";var Le,Ot,qt,Mt,Pt=!0;typeof process!="undefined"&&({FORCE_COLOR:Le,NODE_DISABLE_COLORS:Ot,NO_COLOR:qt,TERM:Mt}=process.env,Pt=process.stdout&&process.stdout.isTTY);var c={enabled:!Ot&&qt==null&&Mt!=="dumb"&&(Le!=null&&Le!=="0"||Pt),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 Tt(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 oo(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:`[${i}m`,close:`[${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?Tt(this.keys,s+""):s+""):s===void 0?oo([i],[t]):c.enabled?Tt([t],s+""):s+""}}var _=c;var It=N(require("path"));var y=N(require("fs"));var U=N(require("path"));function te(i){console.error(`
|
|
104
|
+
\u274C ${_.red(i)}
|
|
105
|
+
`),process.exit(1)}function ye(i){(0,y.existsSync)(i)&&te(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}function we(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function xe(i){return(0,U.resolve)(process.cwd(),i)}function Se(i,e){let t=(0,y.readdirSync)(i);for(let s of t){let r=(0,U.join)(i,s),n=(0,U.join)(e,s),o=(0,y.statSync)(r);o.isDirectory()?((0,y.mkdirSync)(n),Se(r,n)):o.isFile()&&(0,y.copyFileSync)(r,n)}}function ie(i){let e=(0,U.join)(i,"package.json");return JSON.parse((0,y.readFileSync)(e,"utf-8"))}function $t(i,e){let t=(0,U.join)(i,"package.json");(0,y.writeFileSync)(t,JSON.stringify(e,null,2)+`
|
|
106
|
+
`)}function Ct(i){return i.toLocaleLowerCase().split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Oe(i,e,t){if(e[t]){i[t]?Object.assign(i[t],e[t]):i[t]=e[t];let s={},r=Object.keys(i[t]).sort();for(let n of r)s[n]=i[t][n];i[t]=s}}function qe(i,e){_t(e.projectName)||te("Missing project name"),_t(e.appId)||te("Missing starter id");let t=we(e.projectName),s=xe(t);ye(s),(0,Dt.mkdirSync)(s,{recursive:!0});let r=i.apps.find(o=>o.id===e.appId),n=i.servers.find(o=>o.id===e.serverId);r?ho(s,r,n):te(`Invalid starter id "${e.appId}".`)}function ho(i,e,t){Se(e.dir,i);let s=ie(e.dir);if(t){s.name+="-"+t.id,Se(t.dir,i);let n=ie(t.dir);Oe(s,n,"scripts"),Oe(s,n,"dependencies"),Oe(s,n,"devDependencies")}$t(i,s);let r=(0,It.relative)(process.cwd(),i);console.log(""),console.log(`\u2B50\uFE0F ${_.green("Success! Project saved in")} ${_.yellow(r)} ${_.green("directory")}`),console.log(""),console.log(`\u{1F4DF} ${_.cyan("Next steps:")}`),console.log(` cd ${r}`),console.log(" npm install"),console.log(" npm start"),console.log("")}function _t(i){return typeof i=="string"&&i.trim().length>0}var Un=N(Gn());async function Bn(i){console.clear(),console.log(`\u{1F4AB} ${_.cyan("Let's create a Qwik project")} \u{1F4AB}`),console.log("");let e=await(0,Un.default)([{type:"text",name:"projectName",message:"Project name",initial:"qwik-app",validate:s=>{let r=we(s),n=xe(r);return ye(n),!0}},{type:"select",name:"appId",message:"Select a starter",choices:i.apps.map(s=>({title:s.name,value:s.id,description:s.description}))},{type:"select",name:"serverId",message:"Select a server",choices:[...i.servers.map(s=>({title:s.name,value:s.id,description:s.description})),{title:"Setup later",value:"no-hosting",description:"I'll setup my own hosting"}]}]),t={projectName:e.projectName,appId:e.appId,serverId:e.serverId};qe(i,t)}var zn=N(require("fs")),gt=N(require("path"));function Wn(i){return{apps:Zn(i,"apps"),servers:Zn(i,"servers")}}function Zn(i,e){let t=(0,gt.join)(i,e);return(0,zn.readdirSync)(t).map(r=>{let n=(0,gt.join)(t,r),o=ie(n);return{id:r,name:Ct(r),description:o.description,dir:n}}).sort((r,n)=>r.name<n.name?-1:r.name>n.name?1:0)}var bt=process.argv.slice(2),Xn=Wn((0,Kn.join)(__dirname,"starters"));if(bt.length>=2){let i={appId:bt[0],projectName:bt[1]};qe(Xn,i)}else Bn(Xn);
|
package/package.json
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-qwik",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"index.js"
|
|
8
|
-
],
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Interactive CLI for generating Qwik projects.",
|
|
9
5
|
"bin": {
|
|
10
6
|
"create-qwik": "index.js"
|
|
11
7
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"version": "npm build",
|
|
17
|
-
"release": "np --no-2fa "
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@rollup/plugin-commonjs": "^19.0.0",
|
|
21
|
-
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
22
|
-
"@rollup/plugin-typescript": "^8.2.1",
|
|
23
|
-
"np": "^7.5.0",
|
|
24
|
-
"prettier": "^2.3.2",
|
|
25
|
-
"rollup": "^2.52.3",
|
|
26
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
27
|
-
"typescript": "^4.3.4"
|
|
28
|
-
},
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"starters"
|
|
11
|
+
],
|
|
29
12
|
"author": "Builder.io Team",
|
|
30
13
|
"license": "MIT",
|
|
31
14
|
"keywords": [
|
|
32
15
|
"qwik",
|
|
33
|
-
"generator"
|
|
16
|
+
"generator",
|
|
17
|
+
"builder.io"
|
|
34
18
|
],
|
|
19
|
+
"homepage": "https://github.com/BuilderIO/qwik#readme",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/BuilderIO/qwik.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/BuilderIO/qwik/issues"
|
|
26
|
+
},
|
|
35
27
|
"engines": {
|
|
36
|
-
"node": ">=10
|
|
28
|
+
"node": ">=10",
|
|
37
29
|
"npm": ">=6.0.0"
|
|
38
30
|
}
|
|
39
31
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qwik-starter",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Blank starter app",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run clean && rollup -c",
|
|
7
|
+
"clean": "rimraf */build/",
|
|
8
|
+
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\""
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@builder.io/qwik": "~0.0.14",
|
|
12
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
13
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
14
|
+
"concurrently": "^6.4.0",
|
|
15
|
+
"rimraf": "^3.0.2",
|
|
16
|
+
"rollup": "^2.59.0",
|
|
17
|
+
"typescript": "^4.5.2"
|
|
18
|
+
},
|
|
19
|
+
"author": "Builder.io Team",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=14.14.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
2
|
+
import { qwikRollup } from '@builder.io/qwik/optimizer';
|
|
3
|
+
import typescript from '@rollup/plugin-typescript';
|
|
4
|
+
|
|
5
|
+
export default async function () {
|
|
6
|
+
return {
|
|
7
|
+
input: [
|
|
8
|
+
'src/index.server.qwik.tsx',
|
|
9
|
+
'src/my-app.qwik.tsx'
|
|
10
|
+
],
|
|
11
|
+
plugins: [
|
|
12
|
+
nodeResolve(),
|
|
13
|
+
qwikRollup({
|
|
14
|
+
symbolsPath: 'q-symbols.json',
|
|
15
|
+
}),
|
|
16
|
+
typescript(),
|
|
17
|
+
],
|
|
18
|
+
output: [
|
|
19
|
+
{
|
|
20
|
+
chunkFileNames: 'q-[hash].js',
|
|
21
|
+
dir: 'public/build',
|
|
22
|
+
format: 'es',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
dir: 'server/build',
|
|
26
|
+
format: 'cjs',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Builder.io, Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { h } from '@builder.io/qwik';
|
|
10
|
+
import { renderToString, RenderToStringOptions, QwikLoader } from '@builder.io/qwik/server';
|
|
11
|
+
import { MyApp } from './my-app.qwik';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Entry point for server-side pre-rendering.
|
|
15
|
+
*
|
|
16
|
+
* @returns a promise when all of the rendering is completed.
|
|
17
|
+
*/
|
|
18
|
+
export default function serverRender(opts: RenderToStringOptions) {
|
|
19
|
+
return renderToString(
|
|
20
|
+
<html>
|
|
21
|
+
<head>
|
|
22
|
+
<title>Qwik Blank App</title>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<MyApp />
|
|
26
|
+
<QwikLoader debug={opts.debug} />
|
|
27
|
+
</body>
|
|
28
|
+
</html>,
|
|
29
|
+
opts
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { h } from '@builder.io/qwik';
|
|
2
|
+
import { qComponent, qHook, useEvent } from '@builder.io/qwik';
|
|
3
|
+
|
|
4
|
+
export const MyApp = qComponent<{}, { name: string }>({
|
|
5
|
+
tagName: 'my-app', // optional
|
|
6
|
+
onMount: qHook(() => ({ name: 'World' })),
|
|
7
|
+
onRender: qHook((props, state) => {
|
|
8
|
+
return (
|
|
9
|
+
<div>
|
|
10
|
+
<p style={{ 'text-align': 'center' }}>
|
|
11
|
+
<a href="https://github.com/builderio/qwik">
|
|
12
|
+
<img
|
|
13
|
+
alt="Qwik Logo"
|
|
14
|
+
width={400}
|
|
15
|
+
src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F667ab6c2283d4c4d878fb9083aacc10f"
|
|
16
|
+
/>
|
|
17
|
+
</a>
|
|
18
|
+
</p>
|
|
19
|
+
<p>Congratulations Qwik is working!</p>
|
|
20
|
+
|
|
21
|
+
<p>Next steps:</p>
|
|
22
|
+
<ol>
|
|
23
|
+
<li>
|
|
24
|
+
Open dev-tools network tab and notice that no JavaScript was downloaded to render this
|
|
25
|
+
page. (Zero JavaScript no matter the size of your app.)
|
|
26
|
+
</li>
|
|
27
|
+
<li>
|
|
28
|
+
Try interacting with this component by changing{' '}
|
|
29
|
+
<input
|
|
30
|
+
value={state.name}
|
|
31
|
+
on:keyup={qHook<typeof MyApp>((props, state) => {
|
|
32
|
+
const event = useEvent<KeyboardEvent>();
|
|
33
|
+
const input = event.target as HTMLInputElement;
|
|
34
|
+
state.name = input.value;
|
|
35
|
+
})}
|
|
36
|
+
></input>
|
|
37
|
+
.
|
|
38
|
+
</li>
|
|
39
|
+
<li>
|
|
40
|
+
Observe that the binding changes: <code>Hello {state.name}!</code>
|
|
41
|
+
</li>
|
|
42
|
+
<li>
|
|
43
|
+
Notice that Qwik automatically lazily-loaded and hydrated the component upon interaction
|
|
44
|
+
without the developer having to code that behavior. (Lazy hydration is what gives even
|
|
45
|
+
large apps instant on behavior.)
|
|
46
|
+
</li>
|
|
47
|
+
<li>
|
|
48
|
+
Read the docs <a href="https://github.com/builderio/qwik">here</a>.
|
|
49
|
+
</li>
|
|
50
|
+
<li>Replace the content of this component with your code.</li>
|
|
51
|
+
<li>Build amazing web-sites with unbeatable startup performance.</li>
|
|
52
|
+
</ol>
|
|
53
|
+
<hr />
|
|
54
|
+
<p style={{ 'text-align': 'center' }}>
|
|
55
|
+
Made with ❤️ by{' '}
|
|
56
|
+
<a target="_blank" href="https://www.builder.io/">
|
|
57
|
+
Builder.io
|
|
58
|
+
</a>
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"module": "ES2020",
|
|
5
|
+
"lib": ["es2020", "DOM"],
|
|
6
|
+
"jsx": "react",
|
|
7
|
+
"jsxFactory": "h",
|
|
8
|
+
"jsxFragmentFactory": "Fragment",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"incremental": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["src"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qwik-starter-builder",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Blank builder starter app",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run clean && rollup -c",
|
|
7
|
+
"clean": "rimraf */build/",
|
|
8
|
+
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\""
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@builder.io/qwik": "~0.0.14",
|
|
12
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
13
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
14
|
+
"concurrently": "^6.4.0",
|
|
15
|
+
"rimraf": "^3.0.2",
|
|
16
|
+
"rollup": "^2.59.0",
|
|
17
|
+
"typescript": "^4.5.2"
|
|
18
|
+
},
|
|
19
|
+
"author": "Builder.io Team",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=14.14.0"
|
|
23
|
+
}
|
|
24
|
+
}
|