create-void 0.10.13 → 0.20.1
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/LICENSE +21 -0
- package/dist/index.mjs +26 -23
- package/package.json +9 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, Cloudflare, Inc.
|
|
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/dist/index.mjs
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{existsSync as e,mkdirSync as t,
|
|
3
|
-
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){
|
|
4
|
-
`){a&&(r+=
|
|
5
|
-
`&&(i&&
|
|
6
|
-
`)}var
|
|
2
|
+
import{existsSync as e,mkdirSync as t,readFileSync as n,readdirSync as r,writeFileSync as i}from"node:fs";import{styleText as a}from"node:util";import o,{stdin as s,stdout as c}from"node:process";import l from"node:readline";import u from"node:path";import{spawn as d}from"node:child_process";var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),y=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e},b=(e,t,n)=>(n=e==null?{}:f(g(e)),y(t||!e||!e.__esModule||!_.call(e,`default`)?p(n,`default`,{value:e,enumerable:!0}):n,e));const ee=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),te=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ne=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,re=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,ie=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,x=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,ae=/\t{1,1000}/y,S=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,oe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,se=/\p{M}+/gu,ce={limit:1/0,ellipsis:``},C=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?C(i,ce,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[oe,l],[re,0],[ie,o],[ae,s],[S,c],[x,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,w=0,T=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(se,``)){let t=e.codePointAt(0)||0;if(T=te(t)?2:ne(t)?u:l,w+T>v&&(_=Math.min(_,Math.max(y,f)+h)),w+T>r){g=!0;break outer}h+=e.length,w+=T}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===x?ee(e.slice(p,n.lastIndex)):n===S?1:n.lastIndex-p,T=h*i,w+T>v&&(_=Math.min(_,p+Math.floor((v-w)/i))),w+T>r){g=!0;break outer}w+=T,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:w,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},w={limit:1/0,ellipsis:``,ellipsisWidth:0},T=(e,t={})=>C(e,w,t).width,E=`]8;;`,D=RegExp(`(?:\\[(?<code>\\d+)m|\\${E}(?<uri>.*))`,`y`),O=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},k=e=>`[${e}m`,A=e=>`${E}${e}`,j=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:T(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=T(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(E,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},le=e=>{let t=e.split(` `),n=t.length;for(;n&&!T(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},ue=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=T(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=T(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),j(s,r,t),c=T(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){j(s,r,t),c=T(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){j(s,r,t),c=T(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>le(e)));let l=s.join(`
|
|
3
|
+
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){D.lastIndex=e+1;let t=D.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
4
|
+
`){a&&(r+=A(``));let e=i?O(i):void 0;i&&e&&(r+=k(e))}else t===`
|
|
5
|
+
`&&(i&&O(i)&&(r+=k(i)),a&&(r+=A(a)))}return r},de=/\r?\n/;function M(e,t,n){return String(e).normalize().split(de).map(e=>ue(e,t,n)).join(`
|
|
6
|
+
`)}var N=v(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}}))();const P={actions:new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0,accessible:void 0,date:{monthNames:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],messages:{required:`Please enter a valid date`,invalidMonth:`There are only 12 months in a year`,invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function fe(e){if(e!==void 0)return e;if(P.accessible!==void 0)return P.accessible;let t=process.env.ACCESSIBLE;return t!==void 0&&t!==``&&t!==`0`&&t!==`false`}function F(e,t){if(typeof e==`string`)return P.aliases.get(e)===t;for(let n of e)if(n!==void 0&&F(n,t))return!0;return!1}function pe(e,t){if(e===t)return;let n=e.split(`
|
|
7
7
|
`),r=t.split(`
|
|
8
|
-
`),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}globalThis.process.platform.startsWith(`win`);const
|
|
9
|
-
`),
|
|
10
|
-
`).length-1;this.output.write(
|
|
11
|
-
`);this.output.write(t[a]),this._prevFrame=e,this.output.write(
|
|
8
|
+
`),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}globalThis.process.platform.startsWith(`win`);const I=Symbol(`clack:cancel`);function me(e){return e===I}function L(e,t){let n=e;n.isTTY&&n.setRawMode(t)}const he=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function ge(e,t){if(`~standard`in e){let n=e[`~standard`].validate(t);return n instanceof Promise?n.then(e=>e.issues?.at(0)?.message):n.issues?.at(0)?.message}return e(t)}var _e=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;get accessible(){return fe(this.opts.accessible)}constructor(e,t=!0){let{input:n=s,output:r=c,render:i,signal:a,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=a,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(I);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=l.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),L(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(N.cursor.show),this.output.off(`resize`,this.render),L(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(N.cursor.show),this.output.off(`resize`,this.render),L(this.input,!1),e(I)})})}_isActionKey(e,t){return e===` `}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}async onKeypress(e,t){if(this.state!==`validating`){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&P.aliases.has(t.name)&&this.emit(`cursor`,P.aliases.get(t.name)),P.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e,t),t?.name===`return`&&this._shouldSubmit(e,t)){if(this.opts.validate){let e=ge(this.opts.validate,this.value),t;e instanceof Promise?(this.state=`validating`,this.render(),t=await e):t=e,t&&(this.error=t instanceof Error?t.message:t,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}F([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
|
|
9
|
+
`),L(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=M(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
10
|
+
`).length-1;this.output.write(N.cursor.move(-999,e*-1))}render(){let e=M(this._render(this)??``,process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(N.cursor.hide);else{let t=pe(this._prevFrame,e),n=he(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-n),i=Math.max(0,t.numLinesBefore-n),a=t.lines.find(e=>e>=r);if(a===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(N.cursor.move(0,a-i)),this.output.write(N.erase.lines(1));let t=e.split(`
|
|
11
|
+
`);this.output.write(t[a]),this._prevFrame=e,this.output.write(N.cursor.move(0,t.length-a-1));return}if(t.lines.length>1){if(r<i)a=r;else{let e=a-i;e>0&&this.output.write(N.cursor.move(0,e))}this.output.write(N.erase.down());let t=e.split(`
|
|
12
12
|
`).slice(a);this.output.write(t.join(`
|
|
13
|
-
`)),this._prevFrame=e;return}}this.output.write(
|
|
13
|
+
`)),this._prevFrame=e;return}}this.output.write(N.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},ve=class extends _e{get userInputWithCursor(){if(this.state===`submit`)return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let t=e.slice(0,this.cursor),n=e.slice(this.cursor,this.cursor+1),r=e.slice(this.cursor+1);return`${t}${a(`inverse`,n)}${r}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on(`userInput`,e=>{this._setValue(e)}),this.on(`finalize`,()=>{this.value||=e.defaultValue,this.value===void 0&&(this.value=``)})}};function ye(){return o.platform===`win32`?!!o.env.CI||!!o.env.WT_SESSION||!!o.env.TERMINUS_SUBLIME||o.env.ConEmuTask===`{cmd::Cmder}`||o.env.TERM_PROGRAM===`Terminus-Sublime`||o.env.TERM_PROGRAM===`vscode`||o.env.TERM===`xterm-256color`||o.env.TERM===`alacritty`||o.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:o.env.TERM!==`linux`}const be=ye(),R=(e,t)=>be?e:t,z=R(`◆`,`*`),xe=R(`■`,`x`),Se=R(`▲`,`x`),B=R(`◇`,`o`),Ce=R(`┌`,`T`),V=R(`│`,`|`),H=R(`└`,`—`),we=R(`●`,`•`),Te=R(`◆`,`*`),Ee=R(`▲`,`!`),De=R(`■`,`x`),Oe=e=>{switch(e){case`initial`:case`active`:return a(`cyan`,z);case`cancel`:return a(`red`,xe);case`error`:return a(`yellow`,Se);case`submit`:return a(`green`,B);case`validating`:return a(`dim`,z)}};`${a(`dim`,`↑/↓`)}`,`${a(`dim`,`Space:`)}`,`${a(`dim`,`Enter:`)}`;const U={message:(e=[],{symbol:t=a(`gray`,V),secondarySymbol:n=a(`gray`,V),output:r=process.stdout,spacing:i=1,withGuide:o}={})=>{let s=[],c=o??P.withGuide,l=c?n:``,u=c?`${t} `:``,d=c?`${n} `:``;for(let e=0;e<i;e++)s.push(l);let f=Array.isArray(e)?e:e.split(`
|
|
14
14
|
`);if(f.length>0){let[e,...r]=f;e.length>0?s.push(`${u}${e}`):s.push(c?t:``);for(let e of r)e.length>0?s.push(`${d}${e}`):s.push(c?n:``)}r.write(`${s.join(`
|
|
15
15
|
`)}
|
|
16
|
-
`)},info:(e,t)=>{U.message(e,{...t,symbol:
|
|
16
|
+
`)},info:(e,t)=>{U.message(e,{...t,symbol:a(`blue`,we)})},success:(e,t)=>{U.message(e,{...t,symbol:a(`green`,Te)})},step:(e,t)=>{U.message(e,{...t,symbol:a(`green`,B)})},warn:(e,t)=>{U.message(e,{...t,symbol:a(`yellow`,Ee)})},warning:(e,t)=>{U.warn(e,t)},error:(e,t)=>{U.message(e,{...t,symbol:a(`red`,De)})}},ke=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??P.withGuide?`${a(`gray`,H)} `:``;n.write(`${r}${a(`red`,e)}
|
|
17
17
|
|
|
18
|
-
`)},
|
|
19
|
-
`)},
|
|
20
|
-
${
|
|
18
|
+
`)},Ae=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??P.withGuide?`${a(`gray`,Ce)} `:``;n.write(`${r}${e}
|
|
19
|
+
`)},je=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??P.withGuide?`${a(`gray`,V)}
|
|
20
|
+
${a(`gray`,H)} `:``;n.write(`${r}${e}
|
|
21
21
|
|
|
22
|
-
`)};`${
|
|
23
|
-
`:``}${
|
|
24
|
-
`,r=e.placeholder&&e.placeholder.length>0?
|
|
25
|
-
${r}${a}
|
|
22
|
+
`)};`${a(`dim`,`↑/↓`)}`,`${a(`dim`,`Enter:`)}`,`${a(`gray`,V)}`;const Me=e=>new ve({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??P.withGuide,n=`${`${t?`${a(`gray`,V)}
|
|
23
|
+
`:``}${Oe(this.state)} `}${e.message}
|
|
24
|
+
`,r=e.placeholder&&e.placeholder.length>0?a(`inverse`,e.placeholder[0])+a(`dim`,e.placeholder.slice(1)):a([`inverse`,`hidden`],`_`),i=this.userInput?this.userInputWithCursor:r,o=this.value??``;switch(this.state){case`validating`:{let e=t?`${a(`cyan`,V)} `:``,r=t?a(`cyan`,H):``;return`${n}${e}${a(`dim`,i)}
|
|
25
|
+
${r} ${a(`dim`,`Validating...`)}
|
|
26
|
+
`}case`error`:{let e=this.error?` ${a(`yellow`,this.error)}`:``,r=t?`${a(`yellow`,V)} `:``,o=t?a(`yellow`,H):``;return`${n.trim()}
|
|
27
|
+
${r}${i}
|
|
26
28
|
${o}${e}
|
|
27
|
-
`}case`submit`:{let e=o?` ${
|
|
28
|
-
${r}`:``}`}default:return`${n}${t?`${
|
|
29
|
-
${t?
|
|
30
|
-
`}}}).prompt(),
|
|
31
|
-
`)
|
|
29
|
+
`}case`submit`:{let e=o?`${t?` `:``}${a(`dim`,o)}`:``;return`${n}${t?a(`gray`,V):``}${e}`}case`cancel`:{let e=o?` ${a([`strikethrough`,`dim`],o)}`:``,r=t?a(`gray`,V):``;return`${n}${r}${e}${o.trim()?`
|
|
30
|
+
${r}`:``}`}default:return`${n}${t?`${a(`cyan`,V)} `:``}${i}
|
|
31
|
+
${t?a(`cyan`,H):``}
|
|
32
|
+
`}}}).prompt(),Ne=/\\/g,Pe=process.platform===`win32`,W=e=>e.startsWith(`\\\\?\\`)?e:e.replace(Ne,`/`),G=u.win32;function K(e){return(...t)=>W(e(...t))}const q={resolve:K(G.resolve),normalize:K(G.normalize),join:K(G.join),relative:K(G.relative),dirname:K(G.dirname),format:K(G.format),parse:e=>{let t=G.parse(e);return t.root=W(t.root),t.dir=W(t.dir),t},basename:G.basename,extname:G.extname,isAbsolute:G.isAbsolute,matchesGlob:G.matchesGlob,toNamespacedPath:G.toNamespacedPath,delimiter:G.delimiter,sep:`/`},J={...u.posix};J.posix=q.posix=J,J.win32=q.win32=q;const{basename:Fe,delimiter:Ie,dirname:Le,extname:Re,format:ze,isAbsolute:Be,join:Ve,matchesGlob:He,normalize:Ue,parse:We,relative:Ge,resolve:Y,sep:Ke,toNamespacedPath:qe}=Pe?q:J;var X=b(v(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}))(),1);const Je=[`esbuild`,`sharp`,`workerd`];function Ye(e,t){t===`pnpm`&&i(Ve(e,`pnpm-workspace.yaml`),`allowBuilds:\n better-sqlite3: false\n${Je.map(e=>` ${e}: true`).join(`
|
|
33
|
+
`)}\n`)}function Xe(){let e=process.env.npm_config_user_agent;if(e){if(e.startsWith(`pnpm/`))return`pnpm`;if(e.startsWith(`yarn/`))return`yarn`;if(e.startsWith(`bun/`))return`bun`}return`npm`}function Z(e){return e===`pnpm`?[e,`install`,`--no-frozen-lockfile`]:[e,`install`]}function Ze(e){switch(e){case`npm`:return[`npx`];case`pnpm`:return[`pnpm`,`exec`];case`yarn`:return[`yarn`,`exec`];case`bun`:return[`bunx`]}}function Q(e,t){return new Promise((n,r)=>{let[i,...a]=e,o=d(i,a,{stdio:`inherit`,cwd:t,shell:process.platform===`win32`});o.on(`close`,e=>{e===0?n():r(Error(`create-void: '${i}' exited with code ${e}.`))}),o.on(`error`,r)})}const $=Xe();async function Qe(){console.log(),Ae(X.default.bgCyan(X.default.black(` create-void `)));let a=process.argv[2];if(!a){let e=await Me({message:`Project name:`,defaultValue:`my-app`,placeholder:`my-app`,validate(e){if(e&&!e.trim())return`Project name cannot be blank`}});(me(e)||typeof e!=`string`)&&(ke(`Cancelled.`),process.exit(0)),a=e}let o=Y(a);e(o)&&r(o).length>0&&(U.error(`create-void: Directory '${X.default.bold(a)}' is not empty.`),process.exit(1));let{version:s}=JSON.parse(n(new URL(`../package.json`,import.meta.url),`utf8`));t(o,{recursive:!0});let c={name:a,private:!0,type:`module`,devDependencies:{void:s}};i(Y(o,`package.json`),JSON.stringify(c,null,2)+`
|
|
34
|
+
`),Ye(o,$),U.step(`Installing Void...`),await Q([...Z($)],o),U.step(`Scaffolding starter...`),await Q([...Ze($),`void`,`init`],o),U.step(`Installing starter dependencies...`),await Q([...Z($)],o),U.success(`Created ${X.default.bold(a)}`),je(`cd ${a} && ${$===`npm`?`npm run`:$} dev`)}Qe().catch(e=>{U.error(e.message),process.exit(1)});export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-void",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -17,14 +17,18 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@clack/prompts": "^1.
|
|
21
|
-
"@types/node": "^26.1
|
|
20
|
+
"@clack/prompts": "^1.8.0",
|
|
21
|
+
"@types/node": "^26.5.1",
|
|
22
22
|
"pathslash": "^0.1.0",
|
|
23
23
|
"picocolors": "^1.1.1",
|
|
24
|
-
"vite
|
|
24
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.1",
|
|
25
|
+
"vite-plus": "0.3.1"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=24.21.0"
|
|
25
29
|
},
|
|
26
30
|
"scripts": {
|
|
27
31
|
"build": "vp pack",
|
|
28
|
-
"typecheck": "
|
|
32
|
+
"typecheck": "tsc --noEmit"
|
|
29
33
|
}
|
|
30
34
|
}
|