create-young-proj 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - Current BluesYoung-web
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # 从现有模板快速创建工程
2
+
3
+ 🚧 WIP
4
+
5
+ - [x] template-vue-thin
6
+ - [ ] template-vue-admin
7
+ - [ ] template-vue-mobile
8
+
9
+ ## template-vue-thin
10
+
11
+ 极简 `Vue-TS` 工程,无 `UI` 框架
12
+
13
+ 自带 `polyfill`
14
+
15
+ `Pinia` 状态管理
16
+
17
+ `Unocss` 样式自动生成
18
+
19
+ `API` 自动导入,组件自动导入
20
+
21
+ 基于文件目录的自动路由
package/dist/index.mjs ADDED
@@ -0,0 +1,51 @@
1
+ import T from"node:fs";import C from"node:path";import{fileURLToPath as Ne}from"node:url";import je from"child_process";import ot from"path";import lt from"fs";import Fe from"readline";import Le from"events";var Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},B={exports:{}},ht,Nt;function Ye(){if(Nt)return ht;Nt=1,ht=i,i.sync=o;var s=lt;function t(n,r){var l=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var c=0;c<l.length;c++){var a=l[c].toLowerCase();if(a&&n.substr(-a.length).toLowerCase()===a)return!0}return!1}function e(n,r,l){return!n.isSymbolicLink()&&!n.isFile()?!1:t(r,l)}function i(n,r,l){s.stat(n,function(c,a){l(c,c?!1:e(a,n,r))})}function o(n,r){return e(s.statSync(n),n,r)}return ht}var at,jt;function He(){if(jt)return at;jt=1,at=t,t.sync=e;var s=lt;function t(n,r,l){s.stat(n,function(c,a){l(c,c?!1:i(a,r))})}function e(n,r){return i(s.statSync(n),r)}function i(n,r){return n.isFile()&&o(n,r)}function o(n,r){var l=n.mode,c=n.uid,a=n.gid,$=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),f=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),h=parseInt("100",8),b=parseInt("010",8),p=parseInt("001",8),S=h|b,E=l&p||l&b&&a===f||l&h&&c===$||l&S&&$===0;return E}return at}var Q;process.platform==="win32"||Ve.TESTING_WINDOWS?Q=Ye():Q=He();var Be=ut;ut.sync=Ue;function ut(s,t,e){if(typeof t=="function"&&(e=t,t={}),!e){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,o){ut(s,t||{},function(n,r){n?o(n):i(r)})})}Q(s,t||{},function(i,o){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,o=!1),e(i,o)})}function Ue(s,t){try{return Q.sync(s,t||{})}catch(e){if(t&&t.ignoreErrors||e.code==="EACCES")return!1;throw e}}const U=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Ft=ot,ze=U?";":":",Lt=Be,Vt=s=>Object.assign(new Error(`not found: ${s}`),{code:"ENOENT"}),Yt=(s,t)=>{const e=t.colon||ze,i=s.match(/\//)||U&&s.match(/\\/)?[""]:[...U?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(e)],o=U?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=U?o.split(e):[""];return U&&s.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:i,pathExt:n,pathExtExe:o}},Ht=(s,t,e)=>{typeof t=="function"&&(e=t,t={}),t||(t={});const{pathEnv:i,pathExt:o,pathExtExe:n}=Yt(s,t),r=[],l=a=>new Promise(($,f)=>{if(a===i.length)return t.all&&r.length?$(r):f(Vt(s));const h=i[a],b=/^".*"$/.test(h)?h.slice(1,-1):h,p=Ft.join(b,s),S=!b&&/^\.[\\\/]/.test(s)?s.slice(0,2)+p:p;$(c(S,a,0))}),c=(a,$,f)=>new Promise((h,b)=>{if(f===o.length)return h(l($+1));const p=o[f];Lt(a+p,{pathExt:n},(S,E)=>{if(!S&&E)if(t.all)r.push(a+p);else return h(a+p);return h(c(a,$,f+1))})});return e?l(0).then(a=>e(null,a),e):l(0)},We=(s,t)=>{t=t||{};const{pathEnv:e,pathExt:i,pathExtExe:o}=Yt(s,t),n=[];for(let r=0;r<e.length;r++){const l=e[r],c=/^".*"$/.test(l)?l.slice(1,-1):l,a=Ft.join(c,s),$=!c&&/^\.[\\\/]/.test(s)?s.slice(0,2)+a:a;for(let f=0;f<i.length;f++){const h=$+i[f];try{if(Lt.sync(h,{pathExt:o}))if(t.all)n.push(h);else return h}catch{}}}if(t.all&&n.length)return n;if(t.nothrow)return null;throw Vt(s)};var Ge=Ht;Ht.sync=We;var ct={exports:{}};const Bt=(s={})=>{const t=s.env||process.env;return(s.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};ct.exports=Bt,ct.exports.default=Bt;const Ut=ot,Je=Ge,Ke=ct.exports;function zt(s,t){const e=s.options.env||process.env,i=process.cwd(),o=s.options.cwd!=null,n=o&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(s.options.cwd)}catch{}let r;try{r=Je.sync(s.command,{path:e[Ke({env:e})],pathExt:t?Ut.delimiter:void 0})}catch{}finally{n&&process.chdir(i)}return r&&(r=Ut.resolve(o?s.options.cwd:"",r)),r}function qe(s){return zt(s)||zt(s,!0)}var Ze=qe,dt={};const ft=/([()\][%!^"`<>&|;, *?])/g;function Xe(s){return s=s.replace(ft,"^$1"),s}function Qe(s,t){return s=`${s}`,s=s.replace(/(\\*)"/g,'$1$1\\"'),s=s.replace(/(\\*)$/,"$1$1"),s=`"${s}"`,s=s.replace(ft,"^$1"),t&&(s=s.replace(ft,"^$1")),s}dt.command=Xe,dt.argument=Qe;var ts=/^#!(.*)/;const es=ts;var ss=(s="")=>{const t=s.match(es);if(!t)return null;const[e,i]=t[0].replace(/#! ?/,"").split(" "),o=e.split("/").pop();return o==="env"?i:i?`${o} ${i}`:o};const pt=lt,is=ss;function rs(s){const e=Buffer.alloc(150);let i;try{i=pt.openSync(s,"r"),pt.readSync(i,e,0,150,0),pt.closeSync(i)}catch{}return is(e.toString())}var ns=rs;const os=ot,Wt=Ze,Gt=dt,ls=ns,hs=process.platform==="win32",as=/\.(?:com|exe)$/i,us=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cs(s){s.file=Wt(s);const t=s.file&&ls(s.file);return t?(s.args.unshift(s.file),s.command=t,Wt(s)):s.file}function ds(s){if(!hs)return s;const t=cs(s),e=!as.test(t);if(s.options.forceShell||e){const i=us.test(t);s.command=os.normalize(s.command),s.command=Gt.command(s.command),s.args=s.args.map(n=>Gt.argument(n,i));const o=[s.command].concat(s.args).join(" ");s.args=["/d","/s","/c",`"${o}"`],s.command=process.env.comspec||"cmd.exe",s.options.windowsVerbatimArguments=!0}return s}function fs(s,t,e){t&&!Array.isArray(t)&&(e=t,t=null),t=t?t.slice(0):[],e=Object.assign({},e);const i={command:s,args:t,options:e,file:void 0,original:{command:s,args:t}};return e.shell?i:ds(i)}var ps=fs;const mt=process.platform==="win32";function gt(s,t){return Object.assign(new Error(`${t} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${s.command}`,path:s.command,spawnargs:s.args})}function ms(s,t){if(!mt)return;const e=s.emit;s.emit=function(i,o){if(i==="exit"){const n=Jt(o,t);if(n)return e.call(s,"error",n)}return e.apply(s,arguments)}}function Jt(s,t){return mt&&s===1&&!t.file?gt(t.original,"spawn"):null}function gs(s,t){return mt&&s===1&&!t.file?gt(t.original,"spawnSync"):null}var vs={hookChildProcess:ms,verifyENOENT:Jt,verifyENOENTSync:gs,notFoundError:gt};const Kt=je,vt=ps,bt=vs;function qt(s,t,e){const i=vt(s,t,e),o=Kt.spawn(i.command,i.args,i.options);return bt.hookChildProcess(o,i),o}function bs(s,t,e){const i=vt(s,t,e),o=Kt.spawnSync(i.command,i.args,i.options);return o.error=o.error||bt.verifyENOENTSync(o.status,i),o}B.exports=qt,B.exports.spawn=qt,B.exports.sync=bs,B.exports._parse=vt,B.exports._enoent=bt;var ws=function(s,t){t||(t={});var e={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(e.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?e.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(u){e.bools[u]=!0});var i={};Object.keys(t.alias||{}).forEach(function(u){i[u]=[].concat(t.alias[u]),i[u].forEach(function(w){i[w]=[u].concat(i[u].filter(function(P){return w!==P}))})}),[].concat(t.string).filter(Boolean).forEach(function(u){e.strings[u]=!0,i[u]&&(e.strings[i[u]]=!0)});var o=t.default||{},n={_:[]};Object.keys(e.bools).forEach(function(u){c(u,o[u]===void 0?!1:o[u])});var r=[];s.indexOf("--")!==-1&&(r=s.slice(s.indexOf("--")+1),s=s.slice(0,s.indexOf("--")));function l(u,w){return e.allBools&&/^--[^=]+$/.test(w)||e.strings[u]||e.bools[u]||i[u]}function c(u,w,P){if(!(P&&e.unknownFn&&!l(u,P)&&e.unknownFn(P)===!1)){var g=!e.strings[u]&&Zt(w)?Number(w):w;a(n,u.split("."),g),(i[u]||[]).forEach(function(J){a(n,J.split("."),g)})}}function a(u,w,P){for(var g=u,J=0;J<w.length-1;J++){var x=w[J];if(Xt(g,x))return;g[x]===void 0&&(g[x]={}),(g[x]===Object.prototype||g[x]===Number.prototype||g[x]===String.prototype)&&(g[x]={}),g[x]===Array.prototype&&(g[x]=[]),g=g[x]}var x=w[w.length-1];Xt(g,x)||((g===Object.prototype||g===Number.prototype||g===String.prototype)&&(g={}),g===Array.prototype&&(g=[]),g[x]===void 0||e.bools[x]||typeof g[x]=="boolean"?g[x]=P:Array.isArray(g[x])?g[x].push(P):g[x]=[g[x],P])}function $(u){return i[u].some(function(w){return e.bools[w]})}for(var f=0;f<s.length;f++){var h=s[f];if(/^--.+=/.test(h)){var b=h.match(/^--([^=]+)=([\s\S]*)$/),p=b[1],S=b[2];e.bools[p]&&(S=S!=="false"),c(p,S,h)}else if(/^--no-.+/.test(h)){var p=h.match(/^--no-(.+)/)[1];c(p,!1,h)}else if(/^--.+/.test(h)){var p=h.match(/^--(.+)/)[1],E=s[f+1];E!==void 0&&!/^-/.test(E)&&!e.bools[p]&&!e.allBools&&(i[p]?!$(p):!0)?(c(p,E,h),f++):/^(true|false)$/.test(E)?(c(p,E==="true",h),f++):c(p,e.strings[p]?"":!0,h)}else if(/^-[^-]+/.test(h)){for(var O=h.slice(1,-1).split(""),V=!1,d=0;d<O.length;d++){var E=h.slice(d+2);if(E==="-"){c(O[d],E,h);continue}if(/[A-Za-z]/.test(O[d])&&/=/.test(E)){c(O[d],E.split("=")[1],h),V=!0;break}if(/[A-Za-z]/.test(O[d])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(E)){c(O[d],E,h),V=!0;break}if(O[d+1]&&O[d+1].match(/\W/)){c(O[d],h.slice(d+2),h),V=!0;break}else c(O[d],e.strings[O[d]]?"":!0,h)}var p=h.slice(-1)[0];!V&&p!=="-"&&(s[f+1]&&!/^(-|--)[^-]/.test(s[f+1])&&!e.bools[p]&&(i[p]?!$(p):!0)?(c(p,s[f+1],h),f++):s[f+1]&&/^(true|false)$/.test(s[f+1])?(c(p,s[f+1]==="true",h),f++):c(p,e.strings[p]?"":!0,h))}else if((!e.unknownFn||e.unknownFn(h)!==!1)&&n._.push(e.strings._||!Zt(h)?h:Number(h)),t.stopEarly){n._.push.apply(n._,s.slice(f+1));break}}return Object.keys(o).forEach(function(u){ys(n,u.split("."))||(a(n,u.split("."),o[u]),(i[u]||[]).forEach(function(w){a(n,w.split("."),o[u])}))}),t["--"]?(n["--"]=new Array,r.forEach(function(u){n["--"].push(u)})):r.forEach(function(u){n._.push(u)}),n};function ys(s,t){var e=s;t.slice(0,-1).forEach(function(o){e=e[o]||{}});var i=t[t.length-1];return i in e}function Zt(s){return typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Xt(s,t){return t==="constructor"&&typeof s[t]=="function"||t==="__proto__"}var Qt={};const{FORCE_COLOR:$s,NODE_DISABLE_COLORS:xs,TERM:Ss}=process.env,m={enabled:!xs&&Ss!=="dumb"&&$s!=="0",reset:v(0,0),bold:v(1,22),dim:v(2,22),italic:v(3,23),underline:v(4,24),inverse:v(7,27),hidden:v(8,28),strikethrough:v(9,29),black:v(30,39),red:v(31,39),green:v(32,39),yellow:v(33,39),blue:v(34,39),magenta:v(35,39),cyan:v(36,39),white:v(37,39),gray:v(90,39),grey:v(90,39),bgBlack:v(40,49),bgRed:v(41,49),bgGreen:v(42,49),bgYellow:v(43,49),bgBlue:v(44,49),bgMagenta:v(45,49),bgCyan:v(46,49),bgWhite:v(47,49)};function te(s,t){let e=0,i,o="",n="";for(;e<s.length;e++)i=s[e],o+=i.open,n+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return o+t+n}function Es(s,t){let e={has:s,keys:t};return e.reset=m.reset.bind(e),e.bold=m.bold.bind(e),e.dim=m.dim.bind(e),e.italic=m.italic.bind(e),e.underline=m.underline.bind(e),e.inverse=m.inverse.bind(e),e.hidden=m.hidden.bind(e),e.strikethrough=m.strikethrough.bind(e),e.black=m.black.bind(e),e.red=m.red.bind(e),e.green=m.green.bind(e),e.yellow=m.yellow.bind(e),e.blue=m.blue.bind(e),e.magenta=m.magenta.bind(e),e.cyan=m.cyan.bind(e),e.white=m.white.bind(e),e.gray=m.gray.bind(e),e.grey=m.grey.bind(e),e.bgBlack=m.bgBlack.bind(e),e.bgRed=m.bgRed.bind(e),e.bgGreen=m.bgGreen.bind(e),e.bgYellow=m.bgYellow.bind(e),e.bgBlue=m.bgBlue.bind(e),e.bgMagenta=m.bgMagenta.bind(e),e.bgCyan=m.bgCyan.bind(e),e.bgWhite=m.bgWhite.bind(e),e}function v(s,t){let e={open:`\x1B[${s}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(s)||(this.has.push(s),this.keys.push(e)),i===void 0?this:m.enabled?te(this.keys,i+""):i+""):i===void 0?Es([s],[e]):m.enabled?te([e],i+""):i+""}}var M=m,Ts=(s,t)=>{if(!(s.meta&&s.name!=="escape")){if(s.ctrl){if(s.name==="a")return"first";if(s.name==="c"||s.name==="d")return"abort";if(s.name==="e")return"last";if(s.name==="g")return"reset"}if(t){if(s.name==="j")return"down";if(s.name==="k")return"up"}return s.name==="return"||s.name==="enter"?"submit":s.name==="backspace"?"delete":s.name==="delete"?"deleteForward":s.name==="abort"?"abort":s.name==="escape"?"exit":s.name==="tab"?"next":s.name==="pagedown"?"nextPage":s.name==="pageup"?"prevPage":s.name==="home"?"home":s.name==="end"?"end":s.name==="up"?"up":s.name==="down"?"down":s.name==="right"?"right":s.name==="left"?"left":!1}},wt=s=>{const t=["[\\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("|"),e=new RegExp(t,"g");return typeof s=="string"?s.replace(e,""):s};const yt="\x1B",y=`${yt}[`,Os="\x07",$t={to(s,t){return t?`${y}${t+1};${s+1}H`:`${y}${s+1}G`},move(s,t){let e="";return s<0?e+=`${y}${-s}D`:s>0&&(e+=`${y}${s}C`),t<0?e+=`${y}${-t}A`:t>0&&(e+=`${y}${t}B`),e},up:(s=1)=>`${y}${s}A`,down:(s=1)=>`${y}${s}B`,forward:(s=1)=>`${y}${s}C`,backward:(s=1)=>`${y}${s}D`,nextLine:(s=1)=>`${y}E`.repeat(s),prevLine:(s=1)=>`${y}F`.repeat(s),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${yt}7`,restore:`${yt}8`},Ps={up:(s=1)=>`${y}S`.repeat(s),down:(s=1)=>`${y}T`.repeat(s)},Cs={screen:`${y}2J`,up:(s=1)=>`${y}1J`.repeat(s),down:(s=1)=>`${y}J`.repeat(s),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(s){let t="";for(let e=0;e<s;e++)t+=this.line+(e<s-1?$t.up():"");return s&&(t+=$t.left),t}};var D={cursor:$t,scroll:Ps,erase:Cs,beep:Os};const Ms=wt,{erase:ee,cursor:Ds}=D,_s=s=>[...Ms(s)].length;var Is=function(s,t){if(!t)return ee.line+Ds.to(0);let e=0;const i=s.split(/\r?\n/);for(let o of i)e+=1+Math.floor(Math.max(_s(o)-1,0)/t);return ee.lines(e)};const K={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},As={arrowUp:K.arrowUp,arrowDown:K.arrowDown,arrowLeft:K.arrowLeft,arrowRight:K.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Rs=process.platform==="win32"?As:K;var se=Rs;const z=M,Y=se,xt=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),ks=s=>xt[s]||xt.default,q=Object.freeze({aborted:z.red(Y.cross),done:z.green(Y.tick),exited:z.yellow(Y.cross),default:z.cyan("?")}),Ns=(s,t,e)=>t?q.aborted:e?q.exited:s?q.done:q.default,js=s=>z.gray(s?Y.ellipsis:Y.pointerSmall),Fs=(s,t)=>z.gray(s?t?Y.pointerSmall:"+":Y.line);var Ls={styles:xt,render:ks,symbols:q,symbol:Ns,delimiter:js,item:Fs};const Vs=wt;var Ys=function(s,t){let e=String(Vs(s)||"").split(/\r?\n/);return t?e.map(i=>Math.ceil(i.length/t)).reduce((i,o)=>i+o):e.length},Hs=(s,t={})=>{const e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(s||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((n,r)=>(r.length+e.length>=i||n[n.length-1].length+r.length+1<i?n[n.length-1]+=` ${r}`:n.push(`${e}${r}`),n),[e]).join(`
2
+ `)).join(`
3
+ `)},Bs=(s,t,e)=>{e=e||t;let i=Math.min(t-e,s-Math.floor(e/2));i<0&&(i=0);let o=Math.min(i+e,t);return{startIndex:i,endIndex:o}},_={action:Ts,clear:Is,style:Ls,strip:wt,figures:se,lines:Ys,wrap:Hs,entriesToDisplay:Bs};const ie=Fe,{action:Us}=_,zs=Le,{beep:Ws,cursor:Gs}=D,Js=M;let Ks=class extends zs{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const e=ie.createInterface({input:this.in,escapeCodeTimeout:50});ie.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,o=(n,r)=>{let l=Us(r,i);l===!1?this._&&this._(n,r):typeof this[l]=="function"?this[l](r):this.bell()};this.close=()=>{this.out.write(Gs.show),this.in.removeListener("keypress",o),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",o)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Ws)}render(){this.onRender(Js),this.firstRender&&(this.firstRender=!1)}};var j=Ks;const tt=M,qs=j,{erase:Zs,cursor:Z}=D,{style:St,clear:Et,lines:Xs,figures:Qs}=_;class ti extends qs{constructor(t={}){super(t),this.transform=St.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Et("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=tt.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,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(`
4
+ `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}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(`
5
+ `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let i=this.value.slice(0,this.cursor),o=this.value.slice(this.cursor);this.value=`${i}${t}${o}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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 t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(Z.down(Xs(this.outputError,this.out.columns)-1)+Et(this.outputError,this.out.columns)),this.out.write(Et(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[St.symbol(this.done,this.aborted),tt.bold(this.msg),St.delimiter(this.done),this.red?tt.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
6
+ `).reduce((t,e,i)=>t+`
7
+ ${i?" ":Qs.pointerSmall} ${tt.red().italic(e)}`,"")),this.out.write(Zs.line+Z.to(0)+this.outputText+Z.save+this.outputError+Z.restore+Z.move(this.cursorOffset,0)))}}var ei=ti;const A=M,si=j,{style:re,clear:ne,figures:et,wrap:ii,entriesToDisplay:ri}=_,{cursor:ni}=D;class oi extends si{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((e,i)=>(typeof e=="string"&&(e={title:e,value:i}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?i:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=ne("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].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(`
8
+ `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
9
+ `),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(ni.hide):this.out.write(ne(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=ri(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[re.symbol(this.done,this.aborted),A.bold(this.msg),re.delimiter(!1),this.done?this.selection.title:this.selection.disabled?A.yellow(this.warn):A.gray(this.hint)].join(" "),!this.done){this.outputText+=`
10
+ `;for(let i=t;i<e;i++){let o,n,r="",l=this.choices[i];i===t&&t>0?n=et.arrowUp:i===e-1&&e<this.choices.length?n=et.arrowDown:n=" ",l.disabled?(o=this.cursor===i?A.gray().underline(l.title):A.strikethrough().gray(l.title),n=(this.cursor===i?A.bold().gray(et.pointer)+" ":" ")+n):(o=this.cursor===i?A.cyan().underline(l.title):l.title,n=(this.cursor===i?A.cyan(et.pointer)+" ":" ")+n,l.description&&this.cursor===i&&(r=` - ${l.description}`,(n.length+o.length+r.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(r=`
11
+ `+ii(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${o}${A.gray(r)}
12
+ `}}this.out.write(this.outputText)}}var li=oi;const st=M,hi=j,{style:oe,clear:ai}=_,{cursor:le,erase:ui}=D;class ci extends hi{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.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(`
13
+ `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
14
+ `),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()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(le.hide):this.out.write(ai(this.outputText,this.out.columns)),super.render(),this.outputText=[oe.symbol(this.done,this.aborted),st.bold(this.msg),oe.delimiter(this.done),this.value?this.inactive:st.cyan().underline(this.inactive),st.gray("/"),this.value?st.cyan().underline(this.active):this.active].join(" "),this.out.write(ui.line+le.to(0)+this.outputText))}}var di=ci;let Tt=class{constructor({token:t,date:e,parts:i,locales:o}){this.token=t,this.date=e||new Date,this.parts=i||[this],this.locales=o||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((e,i)=>i>t&&e instanceof Tt)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const e=t.indexOf(this);return t.find((i,o)=>o>e&&i instanceof Tt)}toString(){return String(this.date)}};var R=Tt;const fi=R;let pi=class extends fi{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};var mi=pi;const gi=R,vi=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");let bi=class extends gi{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+vi(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};var wi=bi;const yi=R;let $i=class extends yi{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};var xi=$i;const Si=R;let Ei=class extends Si{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};var Ti=Ei;const Oi=R;let Pi=class extends Oi{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};var Ci=Pi;const Mi=R;let Di=class extends Mi{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};var _i=Di;const Ii=R;let Ai=class extends Ii{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};var Ri=Ai;const ki=R;let Ni=class extends ki{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};var ji=Ni,Fi={DatePart:R,Meridiem:mi,Day:wi,Hours:xi,Milliseconds:Ti,Minutes:Ci,Month:_i,Seconds:Ri,Year:ji};const Ot=M,Li=j,{style:he,clear:ae,figures:Vi}=_,{erase:Yi,cursor:ue}=D,{DatePart:ce,Meridiem:Hi,Day:Bi,Hours:Ui,Milliseconds:zi,Minutes:Wi,Month:Gi,Seconds:Ji,Year:Ki}=Fi,qi=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,de={1:({token:s})=>s.replace(/\\(.)/g,"$1"),2:s=>new Bi(s),3:s=>new Gi(s),4:s=>new Ki(s),5:s=>new Hi(s),6:s=>new Ui(s),7:s=>new Wi(s),8:s=>new Ji(s),9:s=>new zi(s)},Zi={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(",")};class Xi extends Li{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Zi,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=ae("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=qi.exec(t);){let o=e.shift(),n=e.findIndex(r=>r!=null);this.parts.push(n in de?de[n]({token:e[n]||o,date:this.date,parts:this.parts,locales:this.locales}):e[n]||o)}let i=this.parts.reduce((o,n)=>(typeof n=="string"&&typeof o[o.length-1]=="string"?o[o.length-1]+=n:o.push(n),o),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof ce)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
15
+ `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}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(`
16
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof ce)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(ue.hide):this.out.write(ae(this.outputText,this.out.columns)),super.render(),this.outputText=[he.symbol(this.done,this.aborted),Ot.bold(this.msg),he.delimiter(!1),this.parts.reduce((t,e,i)=>t.concat(i===this.cursor&&!this.done?Ot.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
17
+ `).reduce((t,e,i)=>t+`
18
+ ${i?" ":Vi.pointerSmall} ${Ot.red().italic(e)}`,"")),this.out.write(Yi.line+ue.to(0)+this.outputText))}}var Qi=Xi;const it=M,tr=j,{cursor:rt,erase:er}=D,{style:Pt,figures:sr,clear:fe,lines:ir}=_,rr=/[0-9]/,Ct=s=>s!==void 0,pe=(s,t)=>{let e=Math.pow(10,t);return Math.round(s*e)/e};class nr extends tr{constructor(t={}){super(t),this.transform=Pt.render(t.style),this.msg=t.message,this.initial=Ct(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Ct(t.min)?t.min:-1/0,this.max=Ct(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=it.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${pe(t,this.round)}`),this._value=pe(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||rr.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
19
+ `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
20
+ `),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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")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(rt.down(ir(this.outputError,this.out.columns)-1)+fe(this.outputError,this.out.columns)),this.out.write(fe(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Pt.symbol(this.done,this.aborted),it.bold(this.msg),Pt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?it[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
21
+ `).reduce((t,e,i)=>t+`
22
+ ${i?" ":sr.pointerSmall} ${it.red().italic(e)}`,"")),this.out.write(er.line+rt.to(0)+this.outputText+rt.save+this.outputError+rt.restore))}}var or=nr;const I=M,{cursor:lr}=D,hr=j,{clear:me,figures:F,style:ge,wrap:ar,entriesToDisplay:ur}=_;let cr=class extends hr{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((e,i)=>(typeof e=="string"&&(e={title:e,value:i}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?i:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=me("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
23
+ `),this.close()}submit(){const t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
24
+ `),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(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const t=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
25
+ Instructions:
26
+ ${F.arrowUp}/${F.arrowDown}: Highlight option
27
+ ${F.arrowLeft}/${F.arrowRight}/[space]: Toggle selection
28
+ `+(this.maxChoices===void 0?` a: Toggle all
29
+ `:"")+" enter/return: Complete answer":""}renderOption(t,e,i,o){const n=(e.selected?I.green(F.radioOn):F.radioOff)+" "+o+" ";let r,l;return e.disabled?r=t===i?I.gray().underline(e.title):I.strikethrough().gray(e.title):(r=t===i?I.cyan().underline(e.title):e.title,t===i&&e.description&&(l=` - ${e.description}`,(n.length+r.length+l.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(l=`
30
+ `+ar(e.description,{margin:n.length,width:this.out.columns})))),n+r+I.gray(l||"")}paginateOptions(t){if(t.length===0)return I.red("No matches for this query.");let{startIndex:e,endIndex:i}=ur(this.cursor,t.length,this.optionsPerPage),o,n=[];for(let r=e;r<i;r++)r===e&&e>0?o=F.arrowUp:r===i-1&&i<t.length?o=F.arrowDown:o=" ",n.push(this.renderOption(this.cursor,t[r],r,o));return`
31
+ `+n.join(`
32
+ `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[I.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(I.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(lr.hide),super.render();let t=[ge.symbol(this.done,this.aborted),I.bold(this.msg),ge.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=I.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=me(t,this.out.columns)}};var ve=cr;const X=M,dr=j,{erase:fr,cursor:be}=D,{style:Mt,clear:we,figures:Dt,wrap:pr,entriesToDisplay:mr}=_,ye=(s,t)=>s[t]&&(s[t].value||s[t].title||s[t]),gr=(s,t)=>s[t]&&(s[t].title||s[t].value||s[t]),vr=(s,t)=>{const e=s.findIndex(i=>i.value===t||i.title===t);return e>-1?e:void 0};class br extends dr{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:vr(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=Mt.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=we("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=ye(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){const e=this.completing=this.suggest(this.input,this.choices),i=await e;if(this.completing!==e)return;this.suggestions=i.map((n,r,l)=>({title:gr(l,r),value:ye(l,r),description:n.description})),this.completing=!1;const o=Math.max(i.length-1,0);this.moveSelect(Math.min(o,this.select)),t&&t()}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(`
33
+ `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
34
+ `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
35
+ `),this.close()}_(t,e){let i=this.input.slice(0,this.cursor),o=this.input.slice(this.cursor);this.input=`${i}${t}${o}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),e=this.input.slice(this.cursor);this.input=`${t}${e}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,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(t,e,i,o){let n,r=i?Dt.arrowUp:o?Dt.arrowDown:" ",l=e?X.cyan().underline(t.title):t.title;return r=(e?X.cyan(Dt.pointer)+" ":" ")+r,t.description&&(n=` - ${t.description}`,(r.length+l.length+n.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(n=`
36
+ `+pr(t.description,{margin:3,width:this.out.columns}))),r+" "+l+X.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(be.hide):this.out.write(we(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=mr(this.select,this.choices.length,this.limit);if(this.outputText=[Mt.symbol(this.done,this.aborted,this.exited),X.bold(this.msg),Mt.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const i=this.suggestions.slice(t,e).map((o,n)=>this.renderOption(o,this.select===n+t,n===0&&t>0,n+t===e-1&&e<this.choices.length)).join(`
37
+ `);this.outputText+=`
38
+ `+(i||X.gray(this.fallback.title))}this.out.write(fr.line+be.to(0)+this.outputText)}}var wr=br;const k=M,{cursor:yr}=D,$r=ve,{clear:$e,style:xe,figures:W}=_;class xr extends $r{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=$e("",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(t=>t.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(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const e=this.filteredOptions.findIndex(i=>i===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
39
+ Instructions:
40
+ ${W.arrowUp}/${W.arrowDown}: Highlight option
41
+ ${W.arrowLeft}/${W.arrowRight}/[space]: Toggle selection
42
+ [a,b,c]/delete: Filter choices
43
+ enter/return: Complete answer
44
+ `:""}renderCurrentInput(){return`
45
+ Filtered results for: ${this.inputValue?this.inputValue:k.gray("Enter something to filter")}
46
+ `}renderOption(t,e,i){let o;return e.disabled?o=t===i?k.gray().underline(e.title):k.strikethrough().gray(e.title):o=t===i?k.cyan().underline(e.title):e.title,(e.selected?k.green(W.radioOn):W.radioOff)+" "+o}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[k.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(k.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(yr.hide),super.render();let t=[xe.symbol(this.done,this.aborted),k.bold(this.msg),xe.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=k.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=$e(t,this.out.columns)}}var Sr=xr;const Se=M,Er=j,{style:Ee,clear:Tr}=_,{erase:Or,cursor:Te}=D;class Pr extends Er{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.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(`
47
+ `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
48
+ `),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Te.hide):this.out.write(Tr(this.outputText,this.out.columns)),super.render(),this.outputText=[Ee.symbol(this.done,this.aborted),Se.bold(this.msg),Ee.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Se.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Or.line+Te.to(0)+this.outputText))}}var Cr=Pr,Mr={TextPrompt:ei,SelectPrompt:li,TogglePrompt:di,DatePrompt:Qi,NumberPrompt:or,MultiselectPrompt:ve,AutocompletePrompt:wr,AutocompleteMultiselectPrompt:Sr,ConfirmPrompt:Cr};(function(s){const t=s,e=Mr,i=r=>r;function o(r,l,c={}){return new Promise((a,$)=>{const f=new e[r](l),h=c.onAbort||i,b=c.onSubmit||i,p=c.onExit||i;f.on("state",l.onState||i),f.on("submit",S=>a(b(S))),f.on("exit",S=>a(p(S))),f.on("abort",S=>$(h(S)))})}t.text=r=>o("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>o("NumberPrompt",r),t.date=r=>o("DatePrompt",r),t.confirm=r=>o("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return o("TextPrompt",r,{onSubmit:c=>c.split(l).map(a=>a.trim())})},t.toggle=r=>o("TogglePrompt",r),t.select=r=>o("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=c=>c.filter(a=>a.selected).map(a=>a.value);return o("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=c=>c.filter(a=>a.selected).map(a=>a.value);return o("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const n=(r,l)=>Promise.resolve(l.filter(c=>c.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||n,r.choices=[].concat(r.choices||[]),o("AutocompletePrompt",r))})(Qt);const _t=Qt,Dr=["suggest","format","onState","validate","onRender","type"],Oe=()=>{};async function L(s=[],{onSubmit:t=Oe,onCancel:e=Oe}={}){const i={},o=L._override||{};s=[].concat(s);let n,r,l,c,a,$;const f=async(h,b,p=!1)=>{if(!(!p&&h.validate&&h.validate(b)!==!0))return h.format?await h.format(b,i):b};for(r of s)if({name:c,type:a}=r,typeof a=="function"&&(a=await a(n,{...i},r),r.type=a),!!a){for(let h in r){if(Dr.includes(h))continue;let b=r[h];r[h]=typeof b=="function"?await b(n,{...i},$):b}if($=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:c,type:a}=r,_t[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(o[r.name]!==void 0&&(n=await f(r,o[r.name]),n!==void 0)){i[c]=n;continue}try{n=L._injected?_r(L._injected,r.initial):await _t[a](r),i[c]=n=await f(r,n,!0),l=await t(r,n,i)}catch{l=!await e(r,i)}if(l)return i}return i}function _r(s,t){const e=s.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function Ir(s){L._injected=(L._injected||[]).concat(s)}function Ar(s){L._override=Object.assign({},s)}var Rr=Object.assign(L,{prompt:L,prompts:_t,inject:Ir,override:Ar});let H=!0;const G=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let Pe=0;if(G.process&&G.process.env&&G.process.stdout){const{FORCE_COLOR:s,NODE_DISABLE_COLORS:t,TERM:e}=G.process.env;t||s==="0"?H=!1:s==="1"?H=!0:e==="dumb"?H=!1:"CI"in G.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(i=>i in G.process.env)?H=!0:H=process.stdout.isTTY,H&&(Pe=e&&e.endsWith("-256color")?2:1)}let Ce={enabled:H,supportLevel:Pe};function nt(s,t,e=1){const i=`\x1B[${s}m`,o=`\x1B[${t}m`,n=new RegExp(`\\x1b\\[${t}m`,"g");return r=>Ce.enabled&&Ce.supportLevel>=e?i+(""+r).replace(n,i)+o:""+r}const N=nt(0,0),Me=nt(31,39),De=nt(32,39),_e=nt(34,39),It=ws(process.argv.slice(2),{string:["_"]}),At=process.cwd(),Rt=[{name:"vue",display:"Young Designed Vue Template",color:De,variants:[{name:"vue-thin",display:"Vue3 + TS + Pinia + Unocss",color:De},{name:"vue-admin",display:"Vue3 + ElementPlus + TS + Pinia + Unocss",color:_e},{name:"vue-mobile",display:"Vue3 + Vant + TS + Pinia + Unocss",color:_e}]},{name:"vite",display:"Vite Formal",color:N,variants:[{name:"create-vite",display:"create-vite",color:N,customCommand:"npm create vite@latest TARGET_DIR"}]},{name:"others",display:"Others",color:N,variants:[{name:"create-vite-extra",display:"create-vite-extra \u2197",color:N,customCommand:"npm create vite-extra@latest TARGET_DIR"}]}],Ie=Rt.map(s=>s.variants&&s.variants.map(t=>t.name)||[s.name]).reduce((s,t)=>s.concat(t),[]),kr={_gitignore:".gitignore",_env:".env"},kt="vite-project";async function Nr(){const s=Ae(It._[0]),t=It.template||It.t;let e=s||kt;const i=()=>e==="."?C.basename(C.resolve()):e;let o;try{o=await Rr([{type:s?null:"text",name:"projectName",message:N("Project name:"),initial:kt,onState:d=>{e=Ae(d.value)||kt}},{type:()=>!T.existsSync(e)||Lr(e)?null:"confirm",name:"overwrite",message:()=>(e==="."?"Current directory":`Target directory "${e}"`)+" is not empty. Remove existing files and continue?"},{type:(d,{overwrite:u})=>{if(u===!1)throw new Error(Me("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>ke(i())?null:"text",name:"packageName",message:N("Package name:"),initial:()=>jr(i()),validate:d=>ke(d)||"Invalid package.json name"},{type:t&&Ie.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!Ie.includes(t)?N(`"${t}" isn't a valid template. Please choose from below: `):N("Select a framework:"),initial:0,choices:Rt.map(d=>{const u=d.color;return{title:u(d.display||d.name),value:d}})},{type:d=>d&&d.variants?"select":null,name:"variant",message:N("Select a variant:"),choices:d=>d.variants.map(u=>{const w=u.color;return{title:w(u.display||u.name),value:u.name}})}],{onCancel:()=>{throw new Error(Me("\u2716")+" Operation cancelled")}})}catch(d){console.log(d.message);return}const{framework:n,overwrite:r,packageName:l,variant:c}=o,a=C.join(At,e);r?Vr(a):T.existsSync(a)||T.mkdirSync(a,{recursive:!0});const $=c||n?.name||t,f=Yr(process.env.npm_config_user_agent),h=f?f.name:"npm",b=h==="yarn"&&f?.version.startsWith("1."),{customCommand:p}=Rt.flatMap(d=>d.variants).find(d=>d.name===$)??{};if(p){const d=p.replace("TARGET_DIR",e).replace(/^npm create/,`${h} create`).replace("@latest",()=>b?"":"@latest").replace(/^npm exec/,()=>h==="pnpm"?"pnpm dlx":h==="yarn"&&!b?"yarn dlx":"npm exec"),[u,...w]=d.split(" "),{status:P}=B.exports.sync(u,w,{stdio:"inherit"});process.exit(P??0)}console.log(`
49
+ Scaffolding project in ${a}...`);const S=C.resolve(Ne(import.meta.url),"../..",`template-${$}`),E=(d,u)=>{const w=C.join(a,kr[d]??d);u?T.writeFileSync(w,u):Re(C.join(S,d),w)},O=T.readdirSync(S);for(const d of O.filter(u=>u!=="package.json"))E(d);const V=JSON.parse(T.readFileSync(C.join(S,"package.json"),"utf-8"));switch(V.name=l||i(),E("package.json",JSON.stringify(V,null,2)),console.log(`
50
+ Done. Now run:
51
+ `),a!==At&&console.log(` cd ${C.relative(At,a)}`),h){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${h} install`),console.log(` ${h} run dev`);break}console.log()}function Ae(s){return s?.trim().replace(/\/+$/g,"")}function Re(s,t){T.statSync(s).isDirectory()?Fr(s,t):T.copyFileSync(s,t)}function ke(s){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(s)}function jr(s){return s.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Fr(s,t){T.mkdirSync(t,{recursive:!0});for(const e of T.readdirSync(s)){const i=C.resolve(s,e),o=C.resolve(t,e);Re(i,o)}}function Lr(s){const t=T.readdirSync(s);return t.length===0||t.length===1&&t[0]===".git"}function Vr(s){if(!!T.existsSync(s))for(const t of T.readdirSync(s))t!==".git"&&T.rmSync(C.resolve(s,t),{recursive:!0,force:!0})}function Yr(s){if(!s)return;const e=s.split(" ")[0].split("/");return{name:e[0],version:e[1]}}Nr().catch(s=>{console.error(s)});
package/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import './dist/index.mjs';
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "create-young-proj",
3
+ "version": "0.0.1",
4
+ "description": "create project from template",
5
+ "main": "index.mjs",
6
+ "bin": {
7
+ "create-young-proj": "index.mjs",
8
+ "cyp": "index.mjs"
9
+ },
10
+ "files": [
11
+ "index.js",
12
+ "template-*",
13
+ "dist"
14
+ ],
15
+ "engines": {
16
+ "node": "^14.18.0 || >=16.0.0"
17
+ },
18
+ "scripts": {
19
+ "dev": "unbuild --stub",
20
+ "build": "unbuild",
21
+ "format": "rome format * --write",
22
+ "release": "changelogen && bumpp --commit --tag --no-push",
23
+ "push": "pnpm publish --access public"
24
+ },
25
+ "keywords": [
26
+ "cli",
27
+ "project template",
28
+ "young project",
29
+ "vue"
30
+ ],
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/BluesYoung-web/create-young-proj.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/BluesYoung-web/create-young-proj/issues"
37
+ },
38
+ "homepage": "https://github.com/BluesYoung-web/create-young-proj/tree/main/packages/create-vite#readme",
39
+ "author": "BluesYoung-web",
40
+ "license": "MIT",
41
+ "devDependencies": {
42
+ "bumpp": "^8.2.1",
43
+ "changelogen": "^0.4.0",
44
+ "cross-spawn": "^7.0.3",
45
+ "kolorist": "^1.6.0",
46
+ "minimist": "^1.2.7",
47
+ "prompts": "^2.4.2",
48
+ "rome": "^10.0.1",
49
+ "unbuild": "^1.0.1"
50
+ },
51
+ "dependencies": {
52
+ "@types/node": "16"
53
+ }
54
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "recommendations": [
3
+ "vue.volar",
4
+ "rome.rome",
5
+ "obkoro1.korofileheader",
6
+ "vue.vscode-typescript-vue-plugin",
7
+ "antfu.unocss",
8
+ "voorjaar.windicss-intellisense"
9
+ ]
10
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.defaultFormatter": "rome.rome"
4
+ }
@@ -0,0 +1,16 @@
1
+ # Vue 3 + TypeScript + Vite
2
+
3
+ This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
8
+
9
+ ## Type Support For `.vue` Imports in TS
10
+
11
+ Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
12
+
13
+ 1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
14
+ 2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
15
+
16
+ You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
@@ -0,0 +1 @@
1
+ VITE_CUSTOM_ENV='hello world'
@@ -0,0 +1,29 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+ .env
15
+
16
+ # Editor directories and files
17
+ .vscode/*
18
+ !.vscode/extensions.json
19
+ !.vscode/settings.json
20
+ .idea
21
+ .DS_Store
22
+ *.suo
23
+ *.ntvs*
24
+ *.njsproj
25
+ *.sln
26
+ *.sw?
27
+
28
+ .nitro
29
+ .output
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + Vue + TS</title>
8
+ <script>
9
+ // hack globalThis
10
+ this.globalThis || (this.globalThis = this);
11
+ // window.onerror = function(e) {
12
+ // console.log(e)
13
+ // window.alert('您的浏览器版本过低,请尝试使用其他浏览器或将浏览器升级至最新版本后重试!');
14
+ // }
15
+ </script>
16
+ </head>
17
+ <body>
18
+ <div id="app"></div>
19
+ <script type="module" src="/src/main.ts"></script>
20
+ </body>
21
+ </html>
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "template-vue-thin",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite --host",
8
+ "build": "vite build",
9
+ "preview": "vite preview --host",
10
+ "format": "rome format * --write",
11
+ "release": "changelogen && bumpp --commit --tag --no-push"
12
+ },
13
+ "dependencies": {
14
+ "@vueuse/core": "^9.4.0",
15
+ "core-js": "^3.26.0",
16
+ "regenerator-runtime": "^0.13.10",
17
+ "pinia": "^2.0.23",
18
+ "vue": "^3.2.41",
19
+ "vue-router": "^4.1.6"
20
+ },
21
+ "devDependencies": {
22
+ "@vitejs/plugin-vue-jsx": "^2.1.0",
23
+ "@vitejs/plugin-vue": "^3.2.0",
24
+ "typescript": "^4.8.4",
25
+ "@unocss/reset": "^0.46.3",
26
+ "@vitejs/plugin-legacy": "^2.3.0",
27
+ "unocss": "^0.46.3",
28
+ "bumpp": "^8.2.1",
29
+ "changelogen": "^0.4.0",
30
+ "less": "^4.1.3",
31
+ "rome": "^10.0.1",
32
+ "terser": "^5.15.1",
33
+ "unplugin-auto-import": "^0.11.4",
34
+ "unplugin-vue-components": "^0.22.9",
35
+ "vite-plugin-pages": "^0.27.1",
36
+ "vite-plugin-vue-layouts": "^0.7.0",
37
+ "vite": "^3.2.3"
38
+ }
39
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,9 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 15:57:40
4
+ * @LastEditTime: 2022-12-03 16:06:15
5
+ * @Description:
6
+ -->
7
+ <template>
8
+ <RouterView />
9
+ </template>
@@ -0,0 +1,9 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 16:22:39
4
+ * @LastEditTime: 2022-12-03 16:22:40
5
+ * @Description:
6
+ -->
7
+ <template>
8
+ <RouterView />
9
+ </template>
@@ -0,0 +1,12 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 16:20:06
4
+ * @LastEditTime: 2022-12-03 16:20:06
5
+ * @Description:
6
+ -->
7
+ <template>
8
+ <div>
9
+ <h1 class="text-2xl font-bold text-center">我是默认布局</h1>
10
+ <RouterView />
11
+ </div>
12
+ </template>
@@ -0,0 +1,12 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 16:21:10
4
+ * @LastEditTime: 2022-12-03 16:21:10
5
+ * @Description:
6
+ -->
7
+ <template>
8
+ <div>
9
+ <h1 class="text-2xl font-bold text-center">我是 List 布局</h1>
10
+ <RouterView />
11
+ </div>
12
+ </template>
@@ -0,0 +1,58 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 15:57:40
4
+ * @LastEditTime: 2022-12-03 16:23:01
5
+ * @Description:
6
+ */
7
+ // polyfill
8
+ import 'core-js/stable';
9
+ import 'regenerator-runtime/runtime';
10
+ // 统一浏览器样式
11
+ import '@unocss/reset/tailwind.css';
12
+ import 'uno.css';
13
+
14
+ // 路由
15
+ import { createRouter, createWebHashHistory } from 'vue-router';
16
+ import { setupLayouts } from 'virtual:generated-layouts';
17
+ import routes from '~pages';
18
+
19
+ import { createApp } from 'vue';
20
+ import App from './App.vue';
21
+
22
+ const app = createApp(App);
23
+
24
+ // 路由配置
25
+ /**
26
+ * 路由元数据类型扩展
27
+ */
28
+ declare module 'vue-router' {
29
+ interface RouteMeta {
30
+ /**
31
+ * 页面标题
32
+ */
33
+ title: string;
34
+ /**
35
+ * 需要登录,不设置则为白名单页面
36
+ */
37
+ // auth?: boolean;
38
+ /**
39
+ * 页面布局,对应 layouts 目录下的布局页面,默认为 default
40
+ */
41
+ layout?: 'default' | 'list' | 'blank';
42
+ }
43
+ }
44
+
45
+ // 自动生成路由
46
+ const finalRoutes = setupLayouts(routes);
47
+ const router = createRouter({
48
+ history: createWebHashHistory(),
49
+ routes: finalRoutes,
50
+ });
51
+
52
+ app.use(router);
53
+
54
+ // pinia
55
+ const pinia = createPinia();
56
+ app.use(pinia);
57
+
58
+ app.mount('#app');
@@ -0,0 +1,488 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2020-12-03 15:02:28
4
+ * @LastEditTime: 2022-11-07 14:39:11
5
+ * @Description: 404
6
+ -->
7
+ <route lang="yaml">
8
+ meta:
9
+ auth: false
10
+ title: 页面不存在
11
+ layout: 'blank'
12
+ </route>
13
+ <template>
14
+ <div class="g-container">
15
+ <div class="rail">
16
+ <div class="stamp four">4</div>
17
+ <div class="stamp zero">0</div>
18
+ <div class="stamp four">4</div>
19
+ <div class="stamp zero">0</div>
20
+ <div class="stamp four">4</div>
21
+ <div class="stamp zero">0</div>
22
+ <div class="stamp four">4</div>
23
+ <div class="stamp zero">0</div>
24
+ <div class="stamp four">4</div>
25
+ <div class="stamp zero">0</div>
26
+ <div class="stamp four">4</div>
27
+ <div class="stamp zero">0</div>
28
+ <div class="stamp four">4</div>
29
+ <div class="stamp zero">0</div>
30
+ <div class="stamp four">4</div>
31
+ <div class="stamp zero">0</div>
32
+ <div class="stamp four">4</div>
33
+ <div class="stamp zero">0</div>
34
+ <div class="stamp four">4</div>
35
+ <div class="stamp zero">0</div>
36
+ </div>
37
+ <div class="world">
38
+ <div class="forward">
39
+ <div class="box">
40
+ <div class="wall"></div>
41
+ <div class="wall"></div>
42
+ <div class="wall"></div>
43
+ <div class="wall"></div>
44
+ <div class="wall"></div>
45
+ <div class="wall"></div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ <div class="bullshit">
51
+ <div class="bullshit__oops">似乎出了什么问题!</div>
52
+ <div class="bullshit__headline">{{ tips }}</div>
53
+ <div class="bullshit__info">请仔细检查链接是否正确,点击按钮可返回上页</div>
54
+ <a class="bullshit__return-home" @click.prevent="goBack">返回上个页面</a>
55
+ </div>
56
+ </template>
57
+
58
+ <script lang="ts" setup>
59
+ withDefaults(defineProps<{ tips?: string; }>(), {
60
+ tips: '页面不存在......'
61
+ });
62
+ const router = useRouter();
63
+ const goBack = () => router.back();
64
+
65
+ </script>
66
+ <style lang="less" scoped>
67
+ body {
68
+ background: #fff;
69
+ height: 100vh;
70
+ overflow: hidden;
71
+ display: flex;
72
+ flex-wrap: wrap;
73
+ font-family: "Anton", sans-serif;
74
+ align-items: flex-start;
75
+ perspective: 1000px;
76
+ }
77
+ body > a {
78
+ opacity: 0;
79
+ position: fixed;
80
+ bottom: -100px;
81
+ left: -100px;
82
+ }
83
+
84
+ div {
85
+ transform-style: preserve-3d;
86
+ }
87
+
88
+ .g-container {
89
+ display: flex;
90
+ width: 100vw;
91
+ height: 30vh;
92
+ justify-content: center;
93
+ align-items: center;
94
+ /* perspective: 1000px; */
95
+ }
96
+
97
+ .rail {
98
+ position: absolute;
99
+ width: 100%;
100
+ height: 100%;
101
+ display: flex;
102
+ justify-content: center;
103
+ align-items: center;
104
+ transform: rotateX(-30deg) rotateY(-30deg);
105
+ }
106
+ .rail .stamp {
107
+ position: absolute;
108
+ width: 200px;
109
+ height: 200px;
110
+ display: flex;
111
+ justify-content: center;
112
+ align-items: center;
113
+ background: #333;
114
+ color: #fff;
115
+ font-size: 7rem;
116
+ }
117
+ .rail .stamp:nth-child(1) {
118
+ -webkit-animation: stampSlide 40000ms -2300ms linear infinite;
119
+ animation: stampSlide 40000ms -2300ms linear infinite;
120
+ }
121
+ .rail .stamp:nth-child(2) {
122
+ -webkit-animation: stampSlide 40000ms -4300ms linear infinite;
123
+ animation: stampSlide 40000ms -4300ms linear infinite;
124
+ }
125
+ .rail .stamp:nth-child(3) {
126
+ -webkit-animation: stampSlide 40000ms -6300ms linear infinite;
127
+ animation: stampSlide 40000ms -6300ms linear infinite;
128
+ }
129
+ .rail .stamp:nth-child(4) {
130
+ -webkit-animation: stampSlide 40000ms -8300ms linear infinite;
131
+ animation: stampSlide 40000ms -8300ms linear infinite;
132
+ }
133
+ .rail .stamp:nth-child(5) {
134
+ -webkit-animation: stampSlide 40000ms -10300ms linear infinite;
135
+ animation: stampSlide 40000ms -10300ms linear infinite;
136
+ }
137
+ .rail .stamp:nth-child(6) {
138
+ -webkit-animation: stampSlide 40000ms -12300ms linear infinite;
139
+ animation: stampSlide 40000ms -12300ms linear infinite;
140
+ }
141
+ .rail .stamp:nth-child(7) {
142
+ -webkit-animation: stampSlide 40000ms -14300ms linear infinite;
143
+ animation: stampSlide 40000ms -14300ms linear infinite;
144
+ }
145
+ .rail .stamp:nth-child(8) {
146
+ -webkit-animation: stampSlide 40000ms -16300ms linear infinite;
147
+ animation: stampSlide 40000ms -16300ms linear infinite;
148
+ }
149
+ .rail .stamp:nth-child(9) {
150
+ -webkit-animation: stampSlide 40000ms -18300ms linear infinite;
151
+ animation: stampSlide 40000ms -18300ms linear infinite;
152
+ }
153
+ .rail .stamp:nth-child(10) {
154
+ -webkit-animation: stampSlide 40000ms -20300ms linear infinite;
155
+ animation: stampSlide 40000ms -20300ms linear infinite;
156
+ }
157
+ .rail .stamp:nth-child(11) {
158
+ -webkit-animation: stampSlide 40000ms -22300ms linear infinite;
159
+ animation: stampSlide 40000ms -22300ms linear infinite;
160
+ }
161
+ .rail .stamp:nth-child(12) {
162
+ -webkit-animation: stampSlide 40000ms -24300ms linear infinite;
163
+ animation: stampSlide 40000ms -24300ms linear infinite;
164
+ }
165
+ .rail .stamp:nth-child(13) {
166
+ -webkit-animation: stampSlide 40000ms -26300ms linear infinite;
167
+ animation: stampSlide 40000ms -26300ms linear infinite;
168
+ }
169
+ .rail .stamp:nth-child(14) {
170
+ -webkit-animation: stampSlide 40000ms -28300ms linear infinite;
171
+ animation: stampSlide 40000ms -28300ms linear infinite;
172
+ }
173
+ .rail .stamp:nth-child(15) {
174
+ -webkit-animation: stampSlide 40000ms -30300ms linear infinite;
175
+ animation: stampSlide 40000ms -30300ms linear infinite;
176
+ }
177
+ .rail .stamp:nth-child(16) {
178
+ -webkit-animation: stampSlide 40000ms -32300ms linear infinite;
179
+ animation: stampSlide 40000ms -32300ms linear infinite;
180
+ }
181
+ .rail .stamp:nth-child(17) {
182
+ -webkit-animation: stampSlide 40000ms -34300ms linear infinite;
183
+ animation: stampSlide 40000ms -34300ms linear infinite;
184
+ }
185
+ .rail .stamp:nth-child(18) {
186
+ -webkit-animation: stampSlide 40000ms -36300ms linear infinite;
187
+ animation: stampSlide 40000ms -36300ms linear infinite;
188
+ }
189
+ .rail .stamp:nth-child(19) {
190
+ -webkit-animation: stampSlide 40000ms -38300ms linear infinite;
191
+ animation: stampSlide 40000ms -38300ms linear infinite;
192
+ }
193
+ .rail .stamp:nth-child(20) {
194
+ -webkit-animation: stampSlide 40000ms -40300ms linear infinite;
195
+ animation: stampSlide 40000ms -40300ms linear infinite;
196
+ }
197
+
198
+ @-webkit-keyframes stampSlide {
199
+ 0% {
200
+ transform: rotateX(90deg) rotateZ(-90deg) translateZ(-200px) translateY(130px);
201
+ }
202
+ 100% {
203
+ transform: rotateX(90deg) rotateZ(-90deg) translateZ(-200px) translateY(-3870px);
204
+ }
205
+ }
206
+
207
+ @keyframes stampSlide {
208
+ 0% {
209
+ transform: rotateX(90deg) rotateZ(-90deg) translateZ(-200px) translateY(130px);
210
+ }
211
+ 100% {
212
+ transform: rotateX(90deg) rotateZ(-90deg) translateZ(-200px) translateY(-3870px);
213
+ }
214
+ }
215
+ .world {
216
+ transform: rotateX(-30deg) rotateY(-30deg);
217
+ }
218
+ .world .forward {
219
+ position: absolute;
220
+ -webkit-animation: slide 2000ms linear infinite;
221
+ animation: slide 2000ms linear infinite;
222
+ }
223
+ .world .box {
224
+ width: 200px;
225
+ height: 200px;
226
+ transform-origin: 100% 100%;
227
+ -webkit-animation: roll 2000ms cubic-bezier(1, 0.01, 1, 1) infinite;
228
+ animation: roll 2000ms cubic-bezier(1, 0.01, 1, 1) infinite;
229
+ }
230
+ .world .box .wall {
231
+ position: absolute;
232
+ width: 200px;
233
+ height: 200px;
234
+ background: rgba(0, 0, 0, 0.5);
235
+ border: 1px solid #fafafa;
236
+ box-sizing: border-box;
237
+ }
238
+ .world .box .wall::before {
239
+ content: "";
240
+ position: absolute;
241
+ width: 100%;
242
+ height: 100%;
243
+ display: flex;
244
+ justify-content: center;
245
+ align-items: center;
246
+ color: #fff;
247
+ font-size: 7rem;
248
+ }
249
+ .world .box .wall:nth-child(1) {
250
+ transform: translateZ(100px);
251
+ }
252
+ .world .box .wall:nth-child(2) {
253
+ transform: rotateX(180deg) translateZ(100px);
254
+ }
255
+ .world .box .wall:nth-child(3) {
256
+ transform: rotateX(90deg) translateZ(100px);
257
+ }
258
+ .world .box .wall:nth-child(3)::before {
259
+ transform: rotateX(180deg) rotateZ(90deg) translateZ(-1px);
260
+ -webkit-animation: zeroFour 4000ms -2000ms linear infinite;
261
+ animation: zeroFour 4000ms -2000ms linear infinite;
262
+ }
263
+ .world .box .wall:nth-child(4) {
264
+ transform: rotateX(-90deg) translateZ(100px);
265
+ }
266
+ .world .box .wall:nth-child(4)::before {
267
+ transform: rotateX(180deg) rotateZ(-90deg) translateZ(-1px);
268
+ -webkit-animation: zeroFour 4000ms -2000ms linear infinite;
269
+ animation: zeroFour 4000ms -2000ms linear infinite;
270
+ }
271
+ .world .box .wall:nth-child(5) {
272
+ transform: rotateY(90deg) translateZ(100px);
273
+ }
274
+ .world .box .wall:nth-child(5)::before {
275
+ transform: rotateX(180deg) translateZ(-1px);
276
+ -webkit-animation: zeroFour 4000ms linear infinite;
277
+ animation: zeroFour 4000ms linear infinite;
278
+ }
279
+ .world .box .wall:nth-child(6) {
280
+ transform: rotateY(-90deg) translateZ(100px);
281
+ }
282
+ .world .box .wall:nth-child(6)::before {
283
+ transform: rotateX(180deg) rotateZ(180deg) translateZ(-1px);
284
+ -webkit-animation: zeroFour 4000ms linear infinite;
285
+ animation: zeroFour 4000ms linear infinite;
286
+ }
287
+
288
+ @-webkit-keyframes zeroFour {
289
+ 0% {
290
+ content: "4";
291
+ }
292
+ 100% {
293
+ content: "0";
294
+ }
295
+ }
296
+
297
+ @keyframes zeroFour {
298
+ 0% {
299
+ content: "4";
300
+ }
301
+ 100% {
302
+ content: "0";
303
+ }
304
+ }
305
+ @-webkit-keyframes roll {
306
+ 0% {
307
+ transform: rotateZ(0deg);
308
+ }
309
+ 85% {
310
+ transform: rotateZ(90deg);
311
+ }
312
+ 87% {
313
+ transform: rotateZ(88deg);
314
+ }
315
+ 90% {
316
+ transform: rotateZ(90deg);
317
+ }
318
+ 100% {
319
+ transform: rotateZ(90deg);
320
+ }
321
+ }
322
+ @keyframes roll {
323
+ 0% {
324
+ transform: rotateZ(0deg);
325
+ }
326
+ 85% {
327
+ transform: rotateZ(90deg);
328
+ }
329
+ 87% {
330
+ transform: rotateZ(88deg);
331
+ }
332
+ 90% {
333
+ transform: rotateZ(90deg);
334
+ }
335
+ 100% {
336
+ transform: rotateZ(90deg);
337
+ }
338
+ }
339
+ @-webkit-keyframes slide {
340
+ 0% {
341
+ transform: translateX(0);
342
+ }
343
+ 100% {
344
+ transform: translateX(-200px);
345
+ }
346
+ }
347
+ @keyframes slide {
348
+ 0% {
349
+ transform: translateX(0);
350
+ }
351
+ 100% {
352
+ transform: translateX(-200px);
353
+ }
354
+ }
355
+ footer {
356
+ position: fixed;
357
+ left: 0;
358
+ right: 0;
359
+ bottom: 0;
360
+ height: 32px;
361
+ color: #666;
362
+ font-size: 12px;
363
+ text-align: center;
364
+ }
365
+ .g-goto {
366
+ width: 100vw;
367
+ padding: 12px 0;
368
+ }
369
+ .g-goto p {
370
+ font-size: 14px;
371
+ text-align: center;
372
+ color: #999;
373
+ padding: 0 12px;
374
+ margin-bottom: 24px;
375
+ }
376
+ .g-btn-box {
377
+ /* width: 600px; */
378
+ display: flex;
379
+ flex-wrap: wrap;
380
+ margin: 0 auto;
381
+ justify-content: center;
382
+ }
383
+ .svg-border-animation {
384
+ position: relative;
385
+ width: 80px;
386
+ height: 32px;
387
+ margin: 12px;
388
+ }
389
+
390
+ .hover-text {
391
+ position: absolute;
392
+ line-height: 32px;
393
+ width: 80px;
394
+ top: 0;
395
+ color: #333;
396
+ font-size: 14px;
397
+ text-align: center;
398
+ cursor: pointer;
399
+ transition: all .4s;
400
+ }
401
+
402
+ .hover-text:active {
403
+ background: #3F51B50b;
404
+ }
405
+
406
+ .shape {
407
+ fill: transparent;
408
+ stroke-width: 2px;
409
+ stroke: #333;
410
+ stroke-dasharray: 30 150;
411
+ stroke-dashoffset: 42;
412
+ }
413
+
414
+ .svg-border-animation:hover .hover-text {
415
+ transition: 0.4s;
416
+ color: #3F51B5;
417
+ }
418
+
419
+ .svg-border-animation:hover .shape {
420
+ animation: draw 0.4s linear forwards;
421
+ }
422
+
423
+ @keyframes draw {
424
+ 0% {
425
+ stroke-dasharray: 30 150;
426
+ stroke-dashoffset: 42;
427
+ stroke-width: 2px;
428
+ }
429
+ 100% {
430
+ stroke-dasharray: 224;
431
+ stroke-dashoffset: 0;
432
+ stroke-width: 2px;
433
+ stroke: #3F51B5;
434
+ }
435
+ }
436
+
437
+ .bullshit {
438
+ @apply relative float-left ml-10 top-50 w-300px overflow-hidden;
439
+ @media (min-width: 768px) {
440
+ @apply float-right -top-32 mr-52;
441
+ }
442
+
443
+ &__oops {
444
+ @apply text-3xl font-bold opacity-0 mb-4;
445
+ color: #1482f0;
446
+ animation-name: slideUp;
447
+ animation-duration: 0.5s;
448
+ animation-fill-mode: forwards;
449
+ }
450
+ &__headline {
451
+ @apply text-xl font-bold opacity-0 mb-2;
452
+ color: #222;
453
+ animation-name: slideUp;
454
+ animation-duration: 0.5s;
455
+ animation-delay: 0.1s;
456
+ animation-fill-mode: forwards;
457
+ }
458
+ &__info {
459
+ @apply text-sm opacity-0 mb-6;
460
+ color: grey;
461
+ animation-name: slideUp;
462
+ animation-duration: 0.5s;
463
+ animation-delay: 0.2s;
464
+ animation-fill-mode: forwards;
465
+ }
466
+ &__return-home {
467
+ @apply block float-left w-28 h-10 rounded-3xl text-center font-bold opacity-0 cursor-pointer;
468
+ background: #1482f0;
469
+ color: #ffffff;
470
+ font-size: 14px;
471
+ line-height: 36px;
472
+ animation-name: slideUp;
473
+ animation-duration: 0.5s;
474
+ animation-delay: 0.3s;
475
+ animation-fill-mode: forwards;
476
+ }
477
+ @keyframes slideUp {
478
+ 0% {
479
+ transform: translateY(60px);
480
+ opacity: 0;
481
+ }
482
+ 100% {
483
+ transform: translateY(0);
484
+ opacity: 1;
485
+ }
486
+ }
487
+ }
488
+ </style>
@@ -0,0 +1,19 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 16:23:19
4
+ * @LastEditTime: 2022-12-03 16:28:55
5
+ * @Description:
6
+ -->
7
+ <route lang="yaml">
8
+ meta:
9
+ title: 首页
10
+ </route>
11
+
12
+ <template>
13
+ <div>
14
+ 我是首页,我会使用默认布局
15
+ <br />
16
+ <RouterLink class="text-blue-500 mr-2" to="/list">list 布局</RouterLink>
17
+ <RouterLink class="text-blue-500" to="/404">空白布局</RouterLink>
18
+ </div>
19
+ </template>
@@ -0,0 +1,17 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 16:23:19
4
+ * @LastEditTime: 2022-12-03 16:25:17
5
+ * @Description:
6
+ -->
7
+ <route lang="yaml">
8
+ meta:
9
+ title: list
10
+ layout: list
11
+ </route>
12
+
13
+ <template>
14
+ <div>
15
+ 我是 list,我会使用 list 布局
16
+ </div>
17
+ </template>
@@ -0,0 +1,22 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 15:57:40
4
+ * @LastEditTime: 2022-12-03 16:14:30
5
+ * @Description:
6
+ */
7
+ /// <reference types="vite/client" />
8
+ /// <reference types="vite-plugin-pages/client" />
9
+ /// <reference types="vite-plugin-vue-layouts/client" />
10
+
11
+ declare module '*.vue' {
12
+ import type { DefineComponent } from 'vue'
13
+ const component: DefineComponent<{}, {}, any>
14
+ export default component
15
+ }
16
+
17
+ /**
18
+ * import.meta.env 类型提示
19
+ */
20
+ declare interface ImportMetaEnv {
21
+ VITE_CUSTOM_ENV: string;
22
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "Node",
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "resolveJsonModule": true,
10
+ "isolatedModules": true,
11
+ "esModuleInterop": true,
12
+ "lib": ["ESNext", "DOM"],
13
+ "skipLibCheck": true,
14
+ "noEmit": true,
15
+ "paths": {
16
+ "@/*": ["./src/*"]
17
+ }
18
+ },
19
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
20
+ "references": [{ "path": "./tsconfig.node.json" }]
21
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "module": "ESNext",
5
+ "moduleResolution": "Node",
6
+ "allowSyntheticDefaultImports": true
7
+ },
8
+ "include": ["vite.config.ts"]
9
+ }
@@ -0,0 +1,47 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2022-03-01 19:11:11
4
+ * @LastEditTime: 2022-05-21 18:32:05
5
+ * @Description:
6
+ */
7
+ import {
8
+ defineConfig,
9
+ presetAttributify,
10
+ presetIcons,
11
+ presetTypography,
12
+ presetUno,
13
+ presetWebFonts,
14
+ transformerDirectives,
15
+ transformerVariantGroup,
16
+ } from 'unocss';
17
+
18
+ export default defineConfig({
19
+ shortcuts: [
20
+ [
21
+ 'btn',
22
+ 'px-4 py-1 rounded inline-block bg-teal-700 text-white cursor-pointer hover:bg-teal-800 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50',
23
+ ],
24
+ [
25
+ 'icon-btn',
26
+ 'inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600',
27
+ ],
28
+ ],
29
+ presets: [
30
+ presetUno(),
31
+ presetAttributify(),
32
+ presetIcons({
33
+ scale: 1.2,
34
+ warn: true,
35
+ }),
36
+ presetTypography(),
37
+ presetWebFonts({
38
+ fonts: {
39
+ sans: 'DM Sans',
40
+ serif: 'DM Serif Display',
41
+ mono: 'DM Mono',
42
+ },
43
+ }),
44
+ ],
45
+ transformers: [transformerDirectives(), transformerVariantGroup()],
46
+ safelist: 'prose prose-sm m-auto text-left'.split(' '),
47
+ });
@@ -0,0 +1,69 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-03 15:57:40
4
+ * @LastEditTime: 2022-12-03 16:18:08
5
+ * @Description:
6
+ */
7
+ import { fileURLToPath, URL } from 'node:url';
8
+ import { defineConfig, loadEnv } from 'vite';
9
+ import type { ConfigEnv, UserConfigExport } from 'vite';
10
+
11
+ import vue from '@vitejs/plugin-vue';
12
+ import vueJsx from '@vitejs/plugin-vue-jsx';
13
+ import legacy from '@vitejs/plugin-legacy';
14
+ import Unocss from 'unocss/vite';
15
+
16
+ // 自动导入
17
+ import AutoImport from 'unplugin-auto-import/vite';
18
+ import AutoComopnents from 'unplugin-vue-components/vite';
19
+
20
+ // 自动路由及布局
21
+ import Pages from 'vite-plugin-pages';
22
+ import Layouts from 'vite-plugin-vue-layouts';
23
+
24
+ // https://vitejs.dev/config/
25
+ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
26
+ const root = process.cwd();
27
+ const viteEnv = loadEnv(mode, root);
28
+ console.log('🚀 ~ file: vite.config.ts ~ line 36 ~ viteEnv', viteEnv);
29
+ return defineConfig({
30
+ base: './',
31
+ plugins: [
32
+ vue(),
33
+ vueJsx(),
34
+ Pages({
35
+ extensions: ['vue', 'tsx'],
36
+ dirs: 'src/views',
37
+ exclude: ['**/components/*.{vue,tsx}', '_*'],
38
+ }),
39
+ Layouts({ defaultLayout: 'default' }),
40
+ AutoComopnents({
41
+ dirs: ['src/components'],
42
+ dts: './src/auto-components.d.ts',
43
+ extensions: ['vue', 'tsx'],
44
+ }),
45
+ AutoImport({
46
+ dts: './src/auto-imports.d.ts',
47
+ imports: [
48
+ 'vue',
49
+ 'vue-router',
50
+ '@vueuse/core',
51
+ 'pinia'
52
+ ],
53
+ }),
54
+ Unocss(),
55
+ legacy({
56
+ // 不生成同名 polyfill 文件,打包速度翻倍,如果出现兼容问题,可以删除此配置
57
+ // renderLegacyChunks: false
58
+ }),
59
+ ],
60
+ resolve: {
61
+ alias: {
62
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
63
+ },
64
+ },
65
+ server: {
66
+ host: true,
67
+ },
68
+ });
69
+ };