@stacksjs/bunpress 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +257 -26
- package/dist/bin/cli.js +2 -104
- package/dist/chunk-1ymh7yt2.js +9656 -0
- package/dist/chunk-8qj79f0y.js +2 -0
- package/dist/chunk-szme5v1e.js +8 -0
- package/dist/chunk-z0redasq.js +530 -0
- package/dist/config.d.ts +3 -5
- package/dist/highlighter.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/robots.d.ts +5 -0
- package/dist/rss.d.ts +16 -0
- package/dist/serve.d.ts +11 -1
- package/dist/sitemap.d.ts +5 -0
- package/dist/src/index.js +1 -1
- package/dist/template-loader.d.ts +5 -3
- package/dist/templates/blocks/alerts/caution.stx +9 -0
- package/dist/templates/blocks/alerts/important.stx +9 -0
- package/dist/templates/blocks/alerts/note.stx +9 -0
- package/dist/templates/blocks/alerts/tip.stx +9 -0
- package/dist/templates/blocks/alerts/warning.stx +9 -0
- package/dist/templates/blocks/containers/danger.stx +6 -0
- package/dist/templates/blocks/containers/details.stx +6 -0
- package/dist/templates/blocks/containers/info.stx +6 -0
- package/dist/templates/blocks/containers/raw.stx +3 -0
- package/dist/templates/blocks/containers/tip.stx +6 -0
- package/dist/templates/blocks/containers/warning.stx +6 -0
- package/dist/templates/blocks/inline/code.stx +1 -0
- package/dist/templates/blocks/inline/del.stx +1 -0
- package/dist/templates/blocks/inline/em.stx +1 -0
- package/dist/templates/blocks/inline/mark.stx +1 -0
- package/dist/templates/blocks/inline/strong.stx +1 -0
- package/dist/templates/blocks/inline/sub.stx +1 -0
- package/dist/templates/blocks/inline/sup.stx +1 -0
- package/dist/templates/features.stx +20 -0
- package/dist/templates/hero.stx +10 -0
- package/dist/templates/layout-doc.stx +157 -0
- package/dist/templates/layout-home.stx +23 -0
- package/dist/templates/layout-page.stx +40 -0
- package/dist/templates/page-toc.stx +267 -0
- package/dist/templates/sidebar-section.stx +42 -0
- package/dist/templates/sidebar.stx +54 -0
- package/dist/themes/bun/index.d.ts +34 -0
- package/dist/themes/index.d.ts +24 -0
- package/dist/themes/vitepress/base.css +549 -0
- package/dist/themes/vitepress/code-group.css +121 -0
- package/dist/themes/vitepress/custom-block.css +330 -0
- package/dist/themes/vitepress/index.d.ts +29 -0
- package/dist/themes/vitepress/index.ts +1963 -0
- package/dist/themes/vitepress/vars.css +436 -0
- package/dist/toc.d.ts +1 -1
- package/dist/types.d.ts +86 -5
- package/package.json +12 -39
- package/dist/chunk-he6c5f4e.js +0 -1354
- package/dist/plugin.d.ts +0 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{L as W0,g as h,i as b}from"./chunk-1ymh7yt2.js";var{Glob:F0}=globalThis.Bun;import{copyFile as j$,mkdir as M0,readdir as H$}from"fs/promises";import{join as d}from"path";import v from"process";import{EventEmitter as k0}from"events";import E6 from"process";import U6 from"process";import o from"process";import c0,{stdin as I$,stdout as w$}from"process";import k6,{stdin as p0,stdout as n0}from"process";import i0 from"readline";var{create:I0,getPrototypeOf:w0,defineProperty:A6,getOwnPropertyNames:A0}=Object,E0=Object.prototype.hasOwnProperty,T=(Z,$,Q)=>{Q=Z!=null?I0(w0(Z)):{};let Y=$||!Z||!Z.__esModule?A6(Q,"default",{value:Z,enumerable:!0}):Q;for(let X of A0(Z))if(!E0.call(Y,X))A6(Y,X,{get:()=>Z[X],enumerable:!0});return Y},V6=(Z,$)=>()=>($||Z(($={exports:{}}).exports,$),$.exports),P0=V6((Z,$)=>{function Q(X){return X==null?[]:Array.isArray(X)?X:[X]}function Y(X,J,z,K){var H,G=X[J],q=~K.string.indexOf(J)?z==null||z===!0?"":String(z):typeof z==="boolean"?z:~K.boolean.indexOf(J)?z==="false"?!1:z==="true"||(X._.push((H=+z,H*0===0)?H:z),!!z):(H=+z,H*0===0)?H:z;X[J]=G==null?q:Array.isArray(G)?G.concat(q):[G,q]}$.exports=function(X,J){X=X||[],J=J||{};var z,K,H,G,q,U={_:[]},V=0,j=0,W=0,L=X.length;let w=J.alias!==void 0,M=J.unknown!==void 0,N=J.default!==void 0;if(J.alias=J.alias||{},J.string=Q(J.string),J.boolean=Q(J.boolean),w)for(z in J.alias){K=J.alias[z]=Q(J.alias[z]);for(V=0;V<K.length;V++)(J.alias[K[V]]=K.concat(z)).splice(V,1)}for(V=J.boolean.length;V-- >0;){K=J.alias[J.boolean[V]]||[];for(j=K.length;j-- >0;)J.boolean.push(K[j])}for(V=J.string.length;V-- >0;){K=J.alias[J.string[V]]||[];for(j=K.length;j-- >0;)J.string.push(K[j])}if(N){for(z in J.default)if(G=typeof J.default[z],K=J.alias[z]=J.alias[z]||[],J[G]!==void 0){J[G].push(z);for(V=0;V<K.length;V++)J[G].push(K[V])}}let m=M?Object.keys(J.alias):[];for(V=0;V<L;V++){if(H=X[V],H==="--"){U._=U._.concat(X.slice(++V));break}for(j=0;j<H.length;j++)if(H.charCodeAt(j)!==45)break;if(j===0)U._.push(H);else if(H.substring(j,j+3)==="no-"){if(G=H.substring(j+3),M&&!~m.indexOf(G))return J.unknown(H);U[G]=!1}else{for(W=j+1;W<H.length;W++)if(H.charCodeAt(W)===61)break;G=H.substring(j,W),q=H.substring(++W)||(V+1===L||(""+X[V+1]).charCodeAt(0)===45||X[++V]),K=j===2?[G]:G;for(W=0;W<K.length;W++){if(G=K[W],M&&!~m.indexOf(G))return J.unknown("-".repeat(j)+G);Y(U,G,W+1<K.length||q,J)}}}if(N){for(z in J.default)if(U[z]===void 0)U[z]=J.default[z]}if(w)for(z in U){K=J.alias[z]||[];while(K.length>0)U[K.shift()]=U[z]}return U}}),A=V6((Z,$)=>{var Q=process||{},Y=Q.argv||[],X=Q.env||{},J=!(!!X.NO_COLOR||Y.includes("--no-color"))&&(!!X.FORCE_COLOR||Y.includes("--color")||Q.platform==="win32"||(Q.stdout||{}).isTTY&&X.TERM!=="dumb"||!!X.CI),z=(G,q,U=G)=>(V)=>{let j=""+V,W=j.indexOf(q,G.length);return~W?G+K(j,q,U,W)+q:G+j+q},K=(G,q,U,V)=>{let j="",W=0;do j+=G.substring(W,V)+U,W=V+q.length,V=G.indexOf(q,W);while(~V);return j+G.substring(W)},H=(G=J)=>{let q=G?z:()=>String;return{isColorSupported:G,reset:q("\x1B[0m","\x1B[0m"),bold:q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:q("\x1B[3m","\x1B[23m"),underline:q("\x1B[4m","\x1B[24m"),inverse:q("\x1B[7m","\x1B[27m"),hidden:q("\x1B[8m","\x1B[28m"),strikethrough:q("\x1B[9m","\x1B[29m"),black:q("\x1B[30m","\x1B[39m"),red:q("\x1B[31m","\x1B[39m"),green:q("\x1B[32m","\x1B[39m"),yellow:q("\x1B[33m","\x1B[39m"),blue:q("\x1B[34m","\x1B[39m"),magenta:q("\x1B[35m","\x1B[39m"),cyan:q("\x1B[36m","\x1B[39m"),white:q("\x1B[37m","\x1B[39m"),gray:q("\x1B[90m","\x1B[39m"),bgBlack:q("\x1B[40m","\x1B[49m"),bgRed:q("\x1B[41m","\x1B[49m"),bgGreen:q("\x1B[42m","\x1B[49m"),bgYellow:q("\x1B[43m","\x1B[49m"),bgBlue:q("\x1B[44m","\x1B[49m"),bgMagenta:q("\x1B[45m","\x1B[49m"),bgCyan:q("\x1B[46m","\x1B[49m"),bgWhite:q("\x1B[47m","\x1B[49m"),blackBright:q("\x1B[90m","\x1B[39m"),redBright:q("\x1B[91m","\x1B[39m"),greenBright:q("\x1B[92m","\x1B[39m"),yellowBright:q("\x1B[93m","\x1B[39m"),blueBright:q("\x1B[94m","\x1B[39m"),magentaBright:q("\x1B[95m","\x1B[39m"),cyanBright:q("\x1B[96m","\x1B[39m"),whiteBright:q("\x1B[97m","\x1B[39m"),bgBlackBright:q("\x1B[100m","\x1B[49m"),bgRedBright:q("\x1B[101m","\x1B[49m"),bgGreenBright:q("\x1B[102m","\x1B[49m"),bgYellowBright:q("\x1B[103m","\x1B[49m"),bgBlueBright:q("\x1B[104m","\x1B[49m"),bgMagentaBright:q("\x1B[105m","\x1B[49m"),bgCyanBright:q("\x1B[106m","\x1B[49m"),bgWhiteBright:q("\x1B[107m","\x1B[49m")}};$.exports=H(),$.exports.createColors=H}),b0=V6((Z,$)=>{$.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}}),C0=T(P0(),1);function g6(Z){return Z.replace(/[<[].+/,"").trim()}function v0(Z){let $=/<([^>]+)>/g,Q=/\[([^\]]+)\]/g,Y=[],X=(K)=>{let H=!1,G=K[1];if(G.startsWith("..."))G=G.slice(3),H=!0;return{required:K[0].startsWith("<"),value:G,variadic:H}},J;while(J=$.exec(Z))Y.push(X(J));let z;while(z=Q.exec(Z))Y.push(X(z));return Y}function y0(Z){let $={alias:{},boolean:[]};for(let[Q,Y]of Z.entries()){if(Y.names.length>1)$.alias[Y.names[0]]=Y.names.slice(1);if(Y.isBoolean)if(Y.negated){if(!Z.some((J,z)=>{return z!==Q&&J.names.some((K)=>Y.names.includes(K))&&typeof J.required==="boolean"}))$.boolean.push(Y.names[0])}else $.boolean.push(Y.names[0])}return $}function P6(Z){return Z.sort(($,Q)=>{return $.length>Q.length?-1:1})[0]}function b6(Z,$){return Z.length>=$?Z:`${Z}${" ".repeat($-Z.length)}`}function S0(Z){return Z.replace(/([a-z])-([a-z])/g,($,Q,Y)=>{return Q+Y.toUpperCase()})}function h0(Z,$,Q){let Y=0,X=$.length,J=Z,z;for(;Y<X;++Y)z=J[$[Y]],J=J[$[Y]]=Y===X-1?Q:z!=null?z:!!~$[Y+1].indexOf(".")||!(+$[Y+1]>-1)?{}:[]}function _0(Z,$){for(let Q of Object.keys($)){let Y=$[Q];if(Y.shouldTransform){if(Z[Q]=Array.prototype.concat.call([],Z[Q]),typeof Y.transformFunction==="function")Z[Q]=Z[Q].map(Y.transformFunction)}}}function f0(Z){let $=/([^\\/]+)$/.exec(Z);return $?$[1]:""}function d6(Z){return Z.split(".").map(($,Q)=>{return Q===0?S0($):$}).join(".")}class e extends Error{constructor(Z){super(Z);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(Z).stack}}function g0(){let{env:Z}=E6,{TERM:$,TERM_PROGRAM:Q}=Z;if(E6.platform!=="win32")return $!=="linux";return Boolean(Z.WT_SESSION)||Boolean(Z.TERMINUS_SUBLIME)||Z.ConEmuTask==="{cmd::Cmder}"||Q==="Terminus-Sublime"||Q==="vscode"||$==="xterm-256color"||$==="alacritty"||$==="rxvt-unicode"||$==="rxvt-unicode-256color"||Z.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var $6="\x1B",R=`${$6}[`;var S={to(Z,$){if(!$)return`${R}${Z+1}G`;return`${R}${$+1};${Z+1}H`},move(Z,$){let Q="";if(Z<0)Q+=`${R}${-Z}D`;else if(Z>0)Q+=`${R}${Z}C`;if($<0)Q+=`${R}${-$}A`;else if($>0)Q+=`${R}${$}B`;return Q},up:(Z=1)=>`${R}${Z}A`,down:(Z=1)=>`${R}${Z}B`,forward:(Z=1)=>`${R}${Z}C`,backward:(Z=1)=>`${R}${Z}D`,nextLine:(Z=1)=>`${R}E`.repeat(Z),prevLine:(Z=1)=>`${R}F`.repeat(Z),left:`${R}G`,hide:`${R}?25l`,show:`${R}?25h`,save:`${$6}7`,restore:`${$6}8`};var q6={screen:`${R}2J`,up:(Z=1)=>`${R}1J`.repeat(Z),down:(Z=1)=>`${R}J`.repeat(Z),line:`${R}2K`,lineEnd:`${R}K`,lineStart:`${R}1K`,lines(Z){let $="";for(let Q=0;Q<Z;Q++)$+=this.line+(Q<Z-1?S.up():"");if(Z)$+=S.left;return $}},L$={screen:`${$6}c`};class u6{rawName;description;name;names;isBoolean;required;config;negated;constructor(Z,$,Q){if(this.rawName=Z,this.description=$,this.config=Object.assign({},Q),Z=Z.replace(/\.\*/g,""),this.negated=!1,this.names=g6(Z).split(",").map((Y)=>{let X=Y.trim().replace(/^-{1,2}/,"");if(X.startsWith("no-"))this.negated=!0,X=X.replace(/^no-/,"");return d6(X)}).sort((Y,X)=>Y.length>X.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(Z.includes("<"))this.required=!0;else if(Z.includes("["))this.required=!1;else this.isBoolean=!0}}var B$=U6.argv,d0=`${U6.platform}-${U6.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,u0=o.argv,x0=`${o.platform}-${o.arch} node-${o.version}`;class W6{rawName;description;config;cli;options;aliasNames;name;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;constructor(Z,$,Q,Y){if(this.rawName=Z,this.description=$,this.config=Q,this.cli=Y,this.options=[],this.aliasNames=[],this.name=g6(Z),this.args=v0(Z),this.examples=[],!Q)this.config={}}usage(Z){return this.usageText=Z,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(Z,$="-v, --version"){return this.versionNumber=Z,this.option($,"Display version number"),this}example(Z){return this.examples.push(Z),this}option(Z,$,Q){let Y=new u6(Z,$,Q);return this.options.push(Y),this}alias(Z){return this.aliasNames.push(Z),this}action(Z){return this.commandAction=Z,this}isMatched(Z){return this.name===Z||this.aliasNames.includes(Z)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof F6}hasOption(Z){return Z=Z.split(".")[0],!!this.options.find(($)=>{return $.names.includes(Z)})}outputHelp(){let{name:Z,commands:$}=this.cli,{versionNumber:Q,options:Y,helpCallback:X}=this.cli.globalCommand,J=[{body:`${Z}${Q?`/${Q}`:""}`}];if(J.push({title:"Usage",body:` $ ${Z} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&$.length>0){let H=P6($.map((G)=>G.rawName));J.push({title:"Commands",body:$.map((G)=>{return` ${b6(G.rawName,H.length)} ${G.description}`}).join(`
|
|
3
|
+
`)}),J.push({title:"For more info, run any command with the `--help` flag",body:$.map((G)=>` $ ${Z}${G.name===""?"":` ${G.name}`} --help`).join(`
|
|
4
|
+
`)})}let K=this.isGlobalCommand?Y:[...this.options,...Y||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)K=K.filter((H)=>H.name!=="version");if(K.length>0){let H=P6(K.map((G)=>G.rawName));J.push({title:"Options",body:K.map((G)=>{return` ${b6(G.rawName,H.length)} ${G.description} ${G.config.default===void 0?"":`(default: ${G.config.default})`}`}).join(`
|
|
5
|
+
`)})}if(this.examples.length>0)J.push({title:"Examples",body:this.examples.map((H)=>{if(typeof H==="function")return H(Z);return H}).join(`
|
|
6
|
+
`)});if(X)J=X(J)||J;console.log(J.map((H)=>{return H.title?`${H.title}:
|
|
7
|
+
${H.body}`:H.body}).join(`
|
|
8
|
+
|
|
9
|
+
`))}outputVersion(){let{name:Z}=this.cli,{versionNumber:$}=this.cli.globalCommand;if($){let Q;if(Bun)Q=d0;else Q=x0;console.log(`${Z}/${$} ${Q}`)}}checkRequiredArgs(){let Z=this.args.filter(($)=>$.required).length;if(this.cli.args.length<Z)throw new e(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:Z,globalCommand:$}=this.cli;if(!this.config.allowUnknownOptions){for(let Q of Object.keys(Z))if(Q!=="--"&&!this.hasOption(Q)&&!$.hasOption(Q))throw new e(`Unknown option \`${Q.length>1?`--${Q}`:`-${Q}`}\``)}}checkOptionValue(){let{options:Z,globalCommand:$}=this.cli,Q=[...$.options,...this.options];for(let Y of Q){let X=Z[Y.name.split(".")[0]];if(Y.required){let J=Q.some((z)=>z.negated&&z.names.includes(Y.name));if(X===!0||X===!1&&!J)throw new e(`option \`${Y.rawName}\` value is missing`)}}}}class F6 extends W6{constructor(Z){super("@@global@@","",{},Z)}}var m0=W6;class M6 extends k0{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(Z=""){super();this.name=Z,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new F6(this),this.globalCommand.usage("<command> [options]")}usage(Z){return this.globalCommand.usage(Z),this}command(Z,$,Q){if(!Q)Q={};let Y=new m0(Z,$||"",Q,this);return Y.globalCommand=this.globalCommand,this.commands.push(Y),Y}option(Z,$,Q){return this.globalCommand.option(Z,$,Q),this}help(Z){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=Z,this.showHelpOnExit=!0,this}version(Z,$="-v, --version"){return this.globalCommand.version(Z,$),this.showVersionOnExit=!0,this}example(Z){return this.globalCommand.example(Z),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:Z,options:$},Q,Y){if(this.args=Z,this.options=$,Q)this.matchedCommand=Q;if(Y)this.matchedCommandName=Y;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(Z=u0,{run:$=!0}={}){if(this.rawArgs=Z,!this.name)this.name=Z[1]?f0(Z[1]):"cli";let Q=!0;for(let X of this.commands){let J=this.mri(Z.slice(2),X),z=J.args[0];if(X.isMatched(z)){Q=!1;let K={...J,args:J.args.slice(1)};this.setParsedInfo(K,X,z),this.emit(`command:${z}`,X)}}if(Q){for(let X of this.commands)if(X.name===""){Q=!1;let J=this.mri(Z.slice(2),X);this.setParsedInfo(J,X),this.emit("command:!",X)}}if(Q){let X=this.mri(Z.slice(2));this.setParsedInfo(X)}if(this.options.help&&this.showHelpOnExit)this.outputHelp(),$=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),$=!1,this.unsetMatchedCommand();let Y={args:this.args,options:this.options};if($)this.runMatchedCommand();if(!this.matchedCommand&&this.args[0])this.emit("command:*");return Y}mri(Z,$){let Q=[...this.globalCommand.options,...$?$.options:[]],Y=y0(Q),X=[],J=Z.indexOf("--");if(J>-1)X=Z.slice(J+1),Z=Z.slice(0,J);let z=C0.default(Z,Y);z=Object.keys(z).reduce((U,V)=>{return{...U,[d6(V)]:z[V]}},{_:[]});let K=z._,H={"--":X},G=$&&$.config.ignoreOptionDefaultValue?$.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,q=Object.create(null);for(let U of Q){if(!G&&U.config.default!==void 0)for(let V of U.names)H[V]=U.config.default;if(Array.isArray(U.config.type)){if(q[U.name]===void 0)q[U.name]=Object.create(null),q[U.name].shouldTransform=!0,q[U.name].transformFunction=U.config.type[0]}}for(let U of Object.keys(z))if(U!=="_"){let V=U.split(".");h0(H,V,z[U]),_0(H,q)}return{args:K,options:H}}runMatchedCommand(){let{args:Z,options:$,matchedCommand:Q}=this;if(!Q||!Q.commandAction)return;Q.checkUnknownOptions(),Q.checkOptionValue(),Q.checkRequiredArgs();let Y=[];return Q.args.forEach((X,J)=>{if(X.variadic)Y.push(Z.slice(J));else Y.push(Z[J])}),Y.push($),Q.commandAction.apply(this,Y)}}var T$=T(A(),1),l0=["up","down","left","right","space","enter","cancel"],Z6={actions:new Set(l0),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function x6(Z,$){if(typeof Z==="string")return Z6.aliases.get(Z)===$;for(let Q of Z){if(Q===void 0)continue;if(x6(Q,$))return!0}return!1}function a0(Z,$){if(Z===$)return[];let Q=Z.split(`
|
|
10
|
+
`),Y=$.split(`
|
|
11
|
+
`),X=[];for(let J=0;J<Math.max(Q.length,Y.length);J++)if(Q[J]!==Y[J])X.push(J);return X}var A$=c0.platform.startsWith("win"),C6=Symbol("clapp:cancel");function t(Z,$){let Q=Z;if(Q.isTTY)Q.setRawMode($)}var j6=T(A(),1);function r0({onlyFirst:Z=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",Z?void 0:"g")}var s0=r0();function m6(Z){if(typeof Z!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof Z}\``);return Z.replace(s0,"")}function t0(Z){return Z===161||Z===164||Z===167||Z===168||Z===170||Z===173||Z===174||Z>=176&&Z<=180||Z>=182&&Z<=186||Z>=188&&Z<=191||Z===198||Z===208||Z===215||Z===216||Z>=222&&Z<=225||Z===230||Z>=232&&Z<=234||Z===236||Z===237||Z===240||Z===242||Z===243||Z>=247&&Z<=250||Z===252||Z===254||Z===257||Z===273||Z===275||Z===283||Z===294||Z===295||Z===299||Z>=305&&Z<=307||Z===312||Z>=319&&Z<=322||Z===324||Z>=328&&Z<=331||Z===333||Z===338||Z===339||Z===358||Z===359||Z===363||Z===462||Z===464||Z===466||Z===468||Z===470||Z===472||Z===474||Z===476||Z===593||Z===609||Z===708||Z===711||Z>=713&&Z<=715||Z===717||Z===720||Z>=728&&Z<=731||Z===733||Z===735||Z>=768&&Z<=879||Z>=913&&Z<=929||Z>=931&&Z<=937||Z>=945&&Z<=961||Z>=963&&Z<=969||Z===1025||Z>=1040&&Z<=1103||Z===1105||Z===8208||Z>=8211&&Z<=8214||Z===8216||Z===8217||Z===8220||Z===8221||Z>=8224&&Z<=8226||Z>=8228&&Z<=8231||Z===8240||Z===8242||Z===8243||Z===8245||Z===8251||Z===8254||Z===8308||Z===8319||Z>=8321&&Z<=8324||Z===8364||Z===8451||Z===8453||Z===8457||Z===8467||Z===8470||Z===8481||Z===8482||Z===8486||Z===8491||Z===8531||Z===8532||Z>=8539&&Z<=8542||Z>=8544&&Z<=8555||Z>=8560&&Z<=8569||Z===8585||Z>=8592&&Z<=8601||Z===8632||Z===8633||Z===8658||Z===8660||Z===8679||Z===8704||Z===8706||Z===8707||Z===8711||Z===8712||Z===8715||Z===8719||Z===8721||Z===8725||Z===8730||Z>=8733&&Z<=8736||Z===8739||Z===8741||Z>=8743&&Z<=8748||Z===8750||Z>=8756&&Z<=8759||Z===8764||Z===8765||Z===8776||Z===8780||Z===8786||Z===8800||Z===8801||Z>=8804&&Z<=8807||Z===8810||Z===8811||Z===8814||Z===8815||Z===8834||Z===8835||Z===8838||Z===8839||Z===8853||Z===8857||Z===8869||Z===8895||Z===8978||Z>=9312&&Z<=9449||Z>=9451&&Z<=9547||Z>=9552&&Z<=9587||Z>=9600&&Z<=9615||Z>=9618&&Z<=9621||Z===9632||Z===9633||Z>=9635&&Z<=9641||Z===9650||Z===9651||Z===9654||Z===9655||Z===9660||Z===9661||Z===9664||Z===9665||Z>=9670&&Z<=9672||Z===9675||Z>=9678&&Z<=9681||Z>=9698&&Z<=9701||Z===9711||Z===9733||Z===9734||Z===9737||Z===9742||Z===9743||Z===9756||Z===9758||Z===9792||Z===9794||Z===9824||Z===9825||Z>=9827&&Z<=9829||Z>=9831&&Z<=9834||Z===9836||Z===9837||Z===9839||Z===9886||Z===9887||Z===9919||Z>=9926&&Z<=9933||Z>=9935&&Z<=9939||Z>=9941&&Z<=9953||Z===9955||Z===9960||Z===9961||Z>=9963&&Z<=9969||Z===9972||Z>=9974&&Z<=9977||Z===9979||Z===9980||Z===9982||Z===9983||Z===10045||Z>=10102&&Z<=10111||Z>=11094&&Z<=11097||Z>=12872&&Z<=12879||Z>=57344&&Z<=63743||Z>=65024&&Z<=65039||Z===65533||Z>=127232&&Z<=127242||Z>=127248&&Z<=127277||Z>=127280&&Z<=127337||Z>=127344&&Z<=127373||Z===127375||Z===127376||Z>=127387&&Z<=127404||Z>=917760&&Z<=917999||Z>=983040&&Z<=1048573||Z>=1048576&&Z<=1114109}function e0(Z){return Z===12288||Z>=65281&&Z<=65376||Z>=65504&&Z<=65510}function o0(Z){return Z>=4352&&Z<=4447||Z===8986||Z===8987||Z===9001||Z===9002||Z>=9193&&Z<=9196||Z===9200||Z===9203||Z===9725||Z===9726||Z===9748||Z===9749||Z>=9776&&Z<=9783||Z>=9800&&Z<=9811||Z===9855||Z>=9866&&Z<=9871||Z===9875||Z===9889||Z===9898||Z===9899||Z===9917||Z===9918||Z===9924||Z===9925||Z===9934||Z===9940||Z===9962||Z===9970||Z===9971||Z===9973||Z===9978||Z===9981||Z===9989||Z===9994||Z===9995||Z===10024||Z===10060||Z===10062||Z>=10067&&Z<=10069||Z===10071||Z>=10133&&Z<=10135||Z===10160||Z===10175||Z===11035||Z===11036||Z===11088||Z===11093||Z>=11904&&Z<=11929||Z>=11931&&Z<=12019||Z>=12032&&Z<=12245||Z>=12272&&Z<=12287||Z>=12289&&Z<=12350||Z>=12353&&Z<=12438||Z>=12441&&Z<=12543||Z>=12549&&Z<=12591||Z>=12593&&Z<=12686||Z>=12688&&Z<=12773||Z>=12783&&Z<=12830||Z>=12832&&Z<=12871||Z>=12880&&Z<=42124||Z>=42128&&Z<=42182||Z>=43360&&Z<=43388||Z>=44032&&Z<=55203||Z>=63744&&Z<=64255||Z>=65040&&Z<=65049||Z>=65072&&Z<=65106||Z>=65108&&Z<=65126||Z>=65128&&Z<=65131||Z>=94176&&Z<=94180||Z===94192||Z===94193||Z>=94208&&Z<=100343||Z>=100352&&Z<=101589||Z>=101631&&Z<=101640||Z>=110576&&Z<=110579||Z>=110581&&Z<=110587||Z===110589||Z===110590||Z>=110592&&Z<=110882||Z===110898||Z>=110928&&Z<=110930||Z===110933||Z>=110948&&Z<=110951||Z>=110960&&Z<=111355||Z>=119552&&Z<=119638||Z>=119648&&Z<=119670||Z===126980||Z===127183||Z===127374||Z>=127377&&Z<=127386||Z>=127488&&Z<=127490||Z>=127504&&Z<=127547||Z>=127552&&Z<=127560||Z===127568||Z===127569||Z>=127584&&Z<=127589||Z>=127744&&Z<=127776||Z>=127789&&Z<=127797||Z>=127799&&Z<=127868||Z>=127870&&Z<=127891||Z>=127904&&Z<=127946||Z>=127951&&Z<=127955||Z>=127968&&Z<=127984||Z===127988||Z>=127992&&Z<=128062||Z===128064||Z>=128066&&Z<=128252||Z>=128255&&Z<=128317||Z>=128331&&Z<=128334||Z>=128336&&Z<=128359||Z===128378||Z===128405||Z===128406||Z===128420||Z>=128507&&Z<=128591||Z>=128640&&Z<=128709||Z===128716||Z>=128720&&Z<=128722||Z>=128725&&Z<=128727||Z>=128732&&Z<=128735||Z===128747||Z===128748||Z>=128756&&Z<=128764||Z>=128992&&Z<=129003||Z===129008||Z>=129292&&Z<=129338||Z>=129340&&Z<=129349||Z>=129351&&Z<=129535||Z>=129648&&Z<=129660||Z>=129664&&Z<=129673||Z>=129679&&Z<=129734||Z>=129742&&Z<=129756||Z>=129759&&Z<=129769||Z>=129776&&Z<=129784||Z>=131072&&Z<=196605||Z>=196608&&Z<=262141}function ZZ(Z){if(!Number.isSafeInteger(Z))throw TypeError(`Expected a code point, got \`${typeof Z}\`.`)}function $Z(Z,{ambiguousAsWide:$=!1}={}){if(ZZ(Z),e0(Z)||o0(Z)||$&&t0(Z))return 2;return 1}var QZ=T(b0(),1),YZ=new Intl.Segmenter,JZ=/^\p{Default_Ignorable_Code_Point}$/u;function n(Z,$={}){if(typeof Z!=="string"||Z.length===0)return 0;let{ambiguousIsNarrow:Q=!0,countAnsiEscapeCodes:Y=!1}=$;if(!Y)Z=m6(Z);if(Z.length===0)return 0;let X=0,J={ambiguousAsWide:!Q};for(let{segment:z}of YZ.segment(Z)){let K=z.codePointAt(0);if(K<=31||K>=127&&K<=159)continue;if(K>=8203&&K<=8207||K===65279)continue;if(K>=768&&K<=879||K>=6832&&K<=6911||K>=7616&&K<=7679||K>=8400&&K<=8447||K>=65056&&K<=65071)continue;if(K>=55296&&K<=57343)continue;if(K>=65024&&K<=65039)continue;if(JZ.test(z))continue;if(QZ.default().test(z)){X+=2;continue}X+=$Z(K,J)}return X}var H6=10,v6=(Z=0)=>($)=>`\x1B[${$+Z}m`,y6=(Z=0)=>($)=>`\x1B[${38+Z};5;${$}m`,S6=(Z=0)=>($,Q,Y)=>`\x1B[${38+Z};2;${$};${Q};${Y}m`,D={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},b$=Object.keys(D.modifier),XZ=Object.keys(D.color),zZ=Object.keys(D.bgColor),C$=[...XZ,...zZ];function KZ(){let Z=new Map;for(let[$,Q]of Object.entries(D)){for(let[Y,X]of Object.entries(Q))D[Y]={open:`\x1B[${X[0]}m`,close:`\x1B[${X[1]}m`},Q[Y]=D[Y],Z.set(X[0],X[1]);Object.defineProperty(D,$,{value:Q,enumerable:!1})}return Object.defineProperty(D,"codes",{value:Z,enumerable:!1}),D.color.close="\x1B[39m",D.bgColor.close="\x1B[49m",D.color.ansi=v6(),D.color.ansi256=y6(),D.color.ansi16m=S6(),D.bgColor.ansi=v6(H6),D.bgColor.ansi256=y6(H6),D.bgColor.ansi16m=S6(H6),Object.defineProperties(D,{rgbToAnsi256:{value:($,Q,Y)=>{if($===Q&&Q===Y){if($<8)return 16;if($>248)return 231;return Math.round(($-8)/247*24)+232}return 16+36*Math.round($/255*5)+6*Math.round(Q/255*5)+Math.round(Y/255*5)},enumerable:!1},hexToRgb:{value:($)=>{let Q=/[a-f\d]{6}|[a-f\d]{3}/i.exec($.toString(16));if(!Q)return[0,0,0];let[Y]=Q;if(Y.length===3)Y=[...Y].map((J)=>J+J).join("");let X=Number.parseInt(Y,16);return[X>>16&255,X>>8&255,X&255]},enumerable:!1},hexToAnsi256:{value:($)=>D.rgbToAnsi256(...D.hexToRgb($)),enumerable:!1},ansi256ToAnsi:{value:($)=>{if($<8)return 30+$;if($<16)return 90+($-8);let Q,Y,X;if($>=232)Q=(($-232)*10+8)/255,Y=Q,X=Q;else{$-=16;let K=$%36;Q=Math.floor($/36)/5,Y=Math.floor(K/6)/5,X=K%6/5}let J=Math.max(Q,Y,X)*2;if(J===0)return 30;let z=30+(Math.round(X)<<2|Math.round(Y)<<1|Math.round(Q));if(J===2)z+=60;return z},enumerable:!1},rgbToAnsi:{value:($,Q,Y)=>D.ansi256ToAnsi(D.rgbToAnsi256($,Q,Y)),enumerable:!1},hexToAnsi:{value:($)=>D.ansi256ToAnsi(D.hexToAnsi256($)),enumerable:!1}}),D}var qZ=KZ(),jZ=qZ,Y6=new Set(["\x1B","\x9B"]),HZ=39,N6="\x07",c6="[",GZ="]",l6="m",Q6=`${GZ}8;;`,h6=(Z)=>`${Y6.values().next().value}${c6}${Z}${l6}`,_6=(Z)=>`${Y6.values().next().value}${Q6}${Z}${N6}`,UZ=(Z)=>Z.split(" ").map(($)=>n($)),G6=(Z,$,Q)=>{let Y=[...$],X=!1,J=!1,z=n(m6(Z.at(-1)));for(let[K,H]of Y.entries()){let G=n(H);if(z+G<=Q)Z[Z.length-1]+=H;else Z.push(H),z=0;if(Y6.has(H))X=!0,J=Y.slice(K+1,K+1+Q6.length).join("")===Q6;if(X){if(J){if(H===N6)X=!1,J=!1}else if(H===l6)X=!1;continue}if(z+=G,z===Q&&K<Y.length-1)Z.push(""),z=0}if(!z&&Z.at(-1).length>0&&Z.length>1)Z[Z.length-2]+=Z.pop()},VZ=(Z)=>{let $=Z.split(" "),Q=$.length;while(Q>0){if(n($[Q-1])>0)break;Q--}if(Q===$.length)return Z;return $.slice(0,Q).join(" ")+$.slice(Q).join("")},WZ=(Z,$,Q={})=>{if(Q.trim!==!1&&Z.trim()==="")return"";let Y="",X,J,z=UZ(Z),K=[""];for(let[U,V]of Z.split(" ").entries()){if(Q.trim!==!1)K[K.length-1]=K.at(-1).trimStart();let j=n(K.at(-1));if(U!==0){if(j>=$&&(Q.wordWrap===!1||Q.trim===!1))K.push(""),j=0;if(j>0||Q.trim===!1)K[K.length-1]+=" ",j++}if(Q.hard&&z[U]>$){let W=$-j,L=1+Math.floor((z[U]-W-1)/$);if(Math.floor((z[U]-1)/$)<L)K.push("");G6(K,V,$);continue}if(j+z[U]>$&&j>0&&z[U]>0){if(Q.wordWrap===!1&&j<$){G6(K,V,$);continue}K.push("")}if(j+z[U]>$&&Q.wordWrap===!1){G6(K,V,$);continue}K[K.length-1]+=V}if(Q.trim!==!1)K=K.map((U)=>VZ(U));let H=K.join(`
|
|
12
|
+
`),G=[...H],q=0;for(let[U,V]of G.entries()){if(Y+=V,Y6.has(V)){let{groups:W}=new RegExp(`(?:\\${c6}(?<code>\\d+)m|\\${Q6}(?<uri>.*)${N6})`).exec(H.slice(q))||{groups:{}};if(W.code!==void 0){let L=Number.parseFloat(W.code);X=L===HZ?void 0:L}else if(W.uri!==void 0)J=W.uri.length===0?void 0:W.uri}let j=jZ.codes.get(Number(X));if(G[U+1]===`
|
|
13
|
+
`){if(J)Y+=_6("");if(X&&j)Y+=h6(j)}else if(V===`
|
|
14
|
+
`){if(X&&j)Y+=h6(X);if(J)Y+=_6(J)}q+=V.length}return Y};function f6(Z,$,Q){return String(Z).normalize().replaceAll(`\r
|
|
15
|
+
`,`
|
|
16
|
+
`).split(`
|
|
17
|
+
`).map((Y)=>WZ(Y,$,Q)).join(`
|
|
18
|
+
`)}class L6{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;_manualLine="";state="initial";error="";value;userInput="";constructor(Z,$=!0){let{input:Q=p0,output:Y=n0,render:X,signal:J,...z}=Z;this.opts=z,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=X.bind(this),this._track=$,this._abortSignal=J,this.input=Q,this.output=Y}unsubscribe(){this._subscribers.clear()}setSubscriber(Z,$){let Q=this._subscribers.get(Z)??[];Q.push($),this._subscribers.set(Z,Q)}on(Z,$){return this.setSubscriber(Z,{cb:$}),this}once(Z,$){return this.setSubscriber(Z,{cb:$,once:!0}),this}emit(Z,...$){let Q=this._subscribers.get(Z)??[],Y=[];for(let X of Q)if(X.cb(...$),X.once)Y.push(()=>Q.splice(Q.indexOf(X),1));for(let X of Y)X();return this}prompt(){return new Promise((Z)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),Z(C6);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=i0.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),t(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(S.show),this.output.off("resize",this.render),t(this.input,!1),Z(this.value)}),this.once("cancel",()=>{this.output.write(S.show),this.output.off("resize",this.render),t(this.input,!1),Z(C6)})})}_isActionKey(Z,$){return Z==="\t"}_setValue(Z){this.value=Z,this.emit("value",this.value)}_setUserInput(Z,$){if(this.userInput=Z??"",this.emit("userInput",this.userInput),$&&this._track&&this.rl)this.rl.write(this.userInput),this._cursor=this.rl.cursor}onKeypress(Z,$){if(this._track&&$.name!=="return"){if($.name&&this._isActionKey(Z,$))this.rl?.write(null,{ctrl:!0,name:"h"});this._cursor=this.rl?.cursor??0;let Q=$.name==="tab"||$.name==="escape"||$.name==="backspace"||$.name==="delete"||$.name==="enter"||$.name==="return"||$.name&&["up","down","left","right"].includes($.name);if(Z&&!Q&&Z.length===1&&Z>=" ")this._manualLine+=Z;else if($.name==="backspace"&&this._manualLine.length>0)this._manualLine=this._manualLine.slice(0,-1);let Y=this._manualLine.length>=(this.rl?.line?.length||0)?this._manualLine:this.rl?.line;this._setUserInput(Y)}if(this.state==="error")this.state="active",this.error="";if($?.name){if(!this._track&&Z6.aliases.has($.name))this.emit("cursor",Z6.aliases.get($.name));if(Z6.actions.has($.name))this.emit("cursor",$.name)}if(Z&&(Z.toLowerCase()==="y"||Z.toLowerCase()==="n"))this.emit("confirm",Z.toLowerCase()==="y");if(this.emit("key",Z?.toLowerCase(),$),$?.name==="return"){if(this.opts.validate){let Q=this.opts.validate(this.value);if(Q)this.error=Q instanceof Error?Q.message:Q,this.state="error"}if(this.state!=="error")this.state="submit"}if(x6([Z,$?.name,$?.sequence],"cancel"))this.state="cancel";if(this.state==="submit"||this.state==="cancel")this.emit("finalize");if(this.render(),this.state==="submit"||this.state==="cancel")this.close()}close(){if(this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
19
|
+
`),t(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.state==="cancel")setTimeout(()=>{this.unsubscribe()},10);else this.unsubscribe()}restoreCursor(){let Z=f6(this._prevFrame,k6.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
20
|
+
`).length-1;this.output.write(S.move(-999,Z*-1))}render(){let Z=f6(this._render(this)??"",k6.stdout.columns,{hard:!0,trim:!1});if(Z===this._prevFrame)return;if(this.state==="initial")this.output.write(S.hide);else{let $=a0(this._prevFrame,Z);if(this.restoreCursor(),$&&$?.length===1){let Q=$[0];this.output.write(S.move(0,Q)),this.output.write(q6.lines(1));let Y=Z.split(`
|
|
21
|
+
`);this.output.write(Y[Q]),this._prevFrame=Z,this.output.write(S.move(0,Y.length-Q-1));return}if($&&$?.length>1){let Q=$[0];this.output.write(S.move(0,Q)),this.output.write(q6.down());let X=Z.split(`
|
|
22
|
+
`).slice(Q);this.output.write(X.join(`
|
|
23
|
+
`)),this._prevFrame=Z;return}this.output.write(q6.down())}if(this.output.write(Z),this.state==="initial")this.state="active";this._prevFrame=Z}}function FZ(Z,$){if(Z===void 0)return 0;if($.length===0)return 0;let Y=$.findIndex((X)=>X.value===Z);return Y!==-1?Y:0}function MZ(Z,$){return($.label??String($.value)).toLowerCase().includes(Z.toLowerCase())}function NZ(Z,$){if(!$)return;if(Z)return $;return $[0]}class LZ extends L6{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#Z=0;#Q="";#Y;#$;get cursor(){return this.#Z}get userInputWithCursor(){if(!this.userInput)return j6.default.inverse(j6.default.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let Z=this.userInput.slice(0,this._cursor),[$,...Q]=this.userInput.slice(this._cursor);return`${Z}${j6.default.inverse($)}${Q.join("")}`}get options(){if(typeof this.#$==="function")return this.#$();return this.#$}constructor(Z){super(Z);this.#$=Z.options;let $=this.options;this.filteredOptions=[...$],this.multiple=Z.multiple===!0,this.#Y=Z.filter??MZ;let Q;if(Z.initialValue&&Array.isArray(Z.initialValue))if(this.multiple)Q=Z.initialValue;else Q=Z.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)Q=[this.options[0].value];if(Q)for(let Y of Q){let X=$.findIndex((J)=>J.value===Y);if(X!==-1)this.toggleSelected(Y),this.#Z=X}this.focusedValue=this.options[this.#Z]?.value,this.on("key",(Y,X)=>this.#J(Y,X)),this.on("userInput",(Y)=>this.#X(Y))}_isActionKey(Z,$){return Z==="\t"||this.multiple&&this.isNavigating&&$.name==="space"&&Z!==void 0&&Z!==""}#J(Z,$){let Q=$.name==="up",Y=$.name==="down",X=$.name==="return";if(Q||Y){if(this.#Z=Math.max(0,Math.min(this.#Z+(Q?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#Z]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(X)this.value=NZ(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&($.name==="tab"||this.isNavigating&&$.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(Z){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(Z))this.selectedValues=this.selectedValues.filter(($)=>$!==Z);else this.selectedValues=[...this.selectedValues,Z];else this.selectedValues=[Z]}#X(Z){if(Z!==this.#Q){this.#Q=Z;let $=this.options;if(Z)this.filteredOptions=$.filter((Q)=>this.#Y(Z,Q));else this.filteredOptions=[...$];if(this.#Z=FZ(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#Z]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class DZ extends L6{options;cursor=0;#Z;getGroupItems(Z){return this.options.filter(($)=>$.group===Z)}isGroupSelected(Z){let $=this.getGroupItems(Z),Q=this.value;if(Q===void 0)return!1;return $.every((Y)=>Q.includes(Y.value))}toggleValue(){let Z=this.options[this.cursor];if(this.value===void 0)this.value=[];if(Z.group===!0){let $=Z.value,Q=this.getGroupItems($);if(this.isGroupSelected($))this.value=this.value.filter((Y)=>Q.findIndex((X)=>X.value===Y)===-1);else this.value=[...this.value,...Q.map((Y)=>Y.value)];this.value=Array.from(new Set(this.value))}else{let $=this.value.includes(Z.value);this.value=$?this.value.filter((Q)=>Q!==Z.value):[...this.value,Z.value]}}constructor(Z){super(Z,!1);let{options:$}=Z;this.#Z=Z.selectableGroups!==!1,this.options=Object.entries($).flatMap(([Q,Y])=>[{value:Q,group:!0,label:Q},...Y.map((X)=>({...X,group:Q}))]),this.value=[...Z.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===Z.cursorAt),this.#Z?0:1),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Y=this.options[this.cursor]?.group===!0;if(!this.#Z&&Y)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let Y=this.options[this.cursor]?.group===!0;if(!this.#Z&&Y)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}var k$=T(A(),1);var v$=T(A(),1);var y$=T(A(),1),_={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]},p={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function BZ(){return!0}function OZ(){let Z={};Z.supportsColor=BZ();function $(Y,X=[]){let J=Y===""?[]:[...X,Y],z=function(H){if(!Z.supportsColor)return H;let G="",q="";for(let U of J)if(U in p&&p[U]in _){let V=p[U];G+=_[V][0],q=_[V][1]+q}else if(U in _)G+=_[U][0],q=_[U][1]+q;return G+H+q},K=[...Object.keys(_),...Object.keys(p)];for(let H of K)if(!(H in z))Object.defineProperty(z,H,{get(){return $(H,J)}});return z}let Q=[...Object.keys(_),...Object.keys(p)];for(let Y of Q)if(!(Y in Z))Object.defineProperty(Z,Y,{get(){return $(Y)}});return Z}var S$=OZ();var TZ=g0();var B=(Z,$)=>TZ?Z:$,h$=B("\u25C6","*"),_$=B("\u25A0","x"),f$=B("\u25B2","x"),g$=B("\u25C7","o"),d$=B("\u250C","T"),RZ=B("\u2502","|"),u$=B("\u2514","\u2014"),x$=B("\u25CF",">"),m$=B("\u25CB"," "),c$=B("\u25FB","[\u2022]"),l$=B("\u25FC","[+]"),a$=B("\u25FB","[ ]"),p$=B("\u25AA","\u2022"),n$=B("\u2500","-"),i$=B("\u256E","+"),r$=B("\u251C","+"),s$=B("\u256F","+"),t$=B("\u25CF","\u2022"),e$=B("\u25C6","*"),o$=B("\u25B2","!"),ZQ=B("\u25A0","x");var $Q=T(A(),1);var QQ=T(A(),1);var YQ=T(A(),1);var JQ=T(A(),1);var XQ=T(A(),1);var zQ=T(A(),1);var KQ=T(A(),1);var qQ=T(A(),1);var jQ=T(A(),1),HQ=T(A(),1);var GQ={light:B("\u2500","-"),heavy:B("\u2501","="),block:B("\u2588","#")};var UQ=T(A(),1);var VQ=T(A(),1);var IZ=T(A(),1);function wZ(){return`${IZ.default.gray(RZ)} `}var WQ=wZ();var FQ=T(A(),1);var MQ=T(A(),1);var a6="0.1.3";import*as p6 from"fs";import*as n6 from"path";async function i6(Z,$){let Q=$.robots;if(Q?.enabled===!1)return;let Y=Q?.filename||"robots.txt",X=EZ($),J=n6.join(Z,Y);if(await p6.promises.writeFile(J,X,"utf-8"),$.verbose)console.log(`\u2705 Robots.txt generated: ${J}`)}function EZ(Z){let $=Z.robots,Q=[];if($?.rules&&$.rules.length>0)for(let Y of $.rules)Q.push(...PZ(Y)),Q.push("");else Q.push("User-agent: *"),Q.push("Allow: /"),Q.push("");if($?.host)Q.push(`Host: ${$.host}`),Q.push("");if($?.sitemaps&&$.sitemaps.length>0){for(let Y of $.sitemaps)Q.push(`Sitemap: ${Y}`);Q.push("")}else if(Z.sitemap?.enabled!==!1&&Z.sitemap?.baseUrl){let Y=Z.sitemap.filename||"sitemap.xml",X=`${Z.sitemap.baseUrl.replace(/\/$/,"")}/${Y}`;Q.push(`Sitemap: ${X}`),Q.push("")}if($?.customContent)Q.push($.customContent),Q.push("");return`${Q.join(`
|
|
24
|
+
`).trim()}
|
|
25
|
+
`}function PZ(Z){let $=[];if($.push(`User-agent: ${Z.userAgent}`),Z.allow&&Z.allow.length>0)for(let Q of Z.allow)$.push(`Allow: ${Q}`);if(Z.disallow&&Z.disallow.length>0)for(let Q of Z.disallow)$.push(`Disallow: ${Q}`);if(Z.crawlDelay!==void 0)$.push(`Crawl-delay: ${Z.crawlDelay}`);return $}var{YAML:bZ}=globalThis.Bun;import*as J6 from"fs";import*as i from"path";async function r6(Z,$,Q,Y){if(!Y?.enabled)return;let X=Q.sitemap?.baseUrl;if(!X){if(Q.verbose)console.warn("\u26A0\uFE0F RSS feed generation skipped: baseUrl not configured");return}let J=Y.title||Q.title||Q.markdown?.title||"Documentation Feed",z=Y.description||Q.description||Q.markdown?.meta?.description||"Documentation updates",K=Y.author||"Documentation Team",H=Y.email||"",G=Y.language||"en-us",q=Y.filename||"feed.xml",U=Y.maxItems||20,V=Y.fullContent||!1,j=await CZ(Z,X,V);j.sort((M,N)=>N.pubDate.getTime()-M.pubDate.getTime());let W=j.slice(0,U),L=SZ({title:J,description:z,link:X,language:G,author:K,email:H,items:W}),w=i.join($,q);if(await J6.promises.writeFile(w,L,"utf-8"),Q.verbose)console.log(`\u2705 RSS feed generated: ${w} (${W.length} items)`)}async function CZ(Z,$,Q){let Y=[],X=await kZ(Z);for(let J of X){let z=await J6.promises.readFile(J,"utf-8"),{frontmatter:K,markdown:H}=vZ(z);if(!K.date||!K.title)continue;let q=i.relative(Z,J).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!q.startsWith("/"))q=`/${q}`;if(q.endsWith("/")&&q!=="/")q=q.slice(0,-1);let U=`${$.replace(/\/$/,"")}${q}`,V=K.description||yZ(H),j=new Date(K.date),W=K.author;Y.push({title:K.title,link:U,description:V,pubDate:j,author:W,content:Q?H:void 0})}return Y}async function kZ(Z){let $=[];async function Q(Y){let X=await J6.promises.readdir(Y,{withFileTypes:!0});for(let J of X){let z=i.join(Y,J.name);if(J.isDirectory()){if(!J.name.startsWith(".")&&J.name!=="node_modules")await Q(z)}else if(J.isFile()&&J.name.endsWith(".md"))$.push(z)}}return await Q(Z),$}function vZ(Z){let $=/^---\n([\s\S]*?)\n---\n?/,Q=Z.match($);if(!Q)return{frontmatter:{},markdown:Z};let Y=Q[1],X=Z.slice(Q[0].length);try{return{frontmatter:bZ.parse(Y),markdown:X}}catch{return{frontmatter:{},markdown:Z}}}function yZ(Z,$=200){let Q=Z.replace(/^#{1,6}\s+(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]+`/g,"").replace(/!\[.*?\]\(.*?\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_~]/g,"").trim(),Y=Q.split(`
|
|
26
|
+
|
|
27
|
+
`)[0]||Q;if(Y.length>$)return`${Y.slice(0,$)}...`;return Y}function SZ(Z){let $=new Date,Q=Z.items.length>0?Z.items[0].pubDate:$,Y=Z.items.map((X)=>{let J=X.content?`
|
|
28
|
+
<content:encoded><![CDATA[${X.content}]]></content:encoded>`:"",z=X.author?`
|
|
29
|
+
<dc:creator><![CDATA[${X.author}]]></dc:creator>`:"";return` <item>
|
|
30
|
+
<title><![CDATA[${X.title}]]></title>
|
|
31
|
+
<link>${X.link}</link>
|
|
32
|
+
<guid>${X.link}</guid>
|
|
33
|
+
<description><![CDATA[${X.description}]]></description>
|
|
34
|
+
<pubDate>${X.pubDate.toUTCString()}</pubDate>${z}${J}
|
|
35
|
+
</item>`}).join(`
|
|
36
|
+
`);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
37
|
+
<rss version="2.0"
|
|
38
|
+
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
|
39
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
40
|
+
xmlns:atom="http://www.w3.org/2005/Atom">
|
|
41
|
+
<channel>
|
|
42
|
+
<title><![CDATA[${Z.title}]]></title>
|
|
43
|
+
<description><![CDATA[${Z.description}]]></description>
|
|
44
|
+
<link>${Z.link}</link>
|
|
45
|
+
<language>${Z.language}</language>
|
|
46
|
+
<lastBuildDate>${Q.toUTCString()}</lastBuildDate>
|
|
47
|
+
<atom:link href="${Z.link}/feed.xml" rel="self" type="application/rss+xml"/>
|
|
48
|
+
${Y}
|
|
49
|
+
</channel>
|
|
50
|
+
</rss>`}import*as c from"fs";import*as u from"path";async function s6(Z,$,Q){let Y=Q.sitemap;if(Y?.enabled===!1)return;if(!Y?.baseUrl){if(Q.verbose)console.warn("\u26A0\uFE0F Sitemap generation skipped: baseUrl not configured");return}let X=Y.baseUrl.replace(/\/$/,""),J=Y.filename||"sitemap.xml",z=Y.defaultPriority??0.5,K=Y.defaultChangefreq||"monthly",H=Y.maxUrlsPerFile||50000,G=Y.useSitemapIndex||!1,q=await hZ(Z,X,z,K,Y.exclude||[],Y.priorityMap||{},Y.changefreqMap||{}),U=Y.transform?q.map((V)=>Y.transform(V)).filter(Boolean):q;if(Q.verbose)console.log(`\uD83D\uDCC4 Generated ${U.length} sitemap entries`);if(G&&U.length>H)await gZ(U,$,X,J,H);else{let V=t6(U),j=u.join($,J);if(await c.promises.writeFile(j,V,"utf-8"),Q.verbose)console.log(`\u2705 Sitemap generated: ${j}`)}}async function hZ(Z,$,Q,Y,X,J,z){let K=[],H=await _Z(Z);for(let G of H){let U=u.relative(Z,G).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!U.startsWith("/"))U=`/${U}`;if(U.endsWith("/")&&U!=="/")U=U.slice(0,-1);if(fZ(U,X))continue;let j=(await c.promises.stat(G)).mtime.toISOString(),W=Q;for(let[w,M]of Object.entries(J))if(D6(U,w)){W=M;break}let L=Y;for(let[w,M]of Object.entries(z))if(D6(U,w)){L=M;break}K.push({url:U,lastmod:j,changefreq:L,priority:W})}return K}async function _Z(Z){let $=[];async function Q(Y){let X=await c.promises.readdir(Y,{withFileTypes:!0});for(let J of X){let z=u.join(Y,J.name);if(J.isDirectory()){if(!J.name.startsWith(".")&&J.name!=="node_modules")await Q(z)}else if(J.isFile()&&J.name.endsWith(".md"))$.push(z)}}return await Q(Z),$}function fZ(Z,$){for(let Q of $)if(D6(Z,Q))return!0;return!1}function D6(Z,$){let Q=$.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".");return new RegExp(`^${Q}$`).test(Z)}function t6(Z){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
51
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
52
|
+
${Z.map((Q)=>{let Y=Q.url,X=Q.lastmod?`
|
|
53
|
+
<lastmod>${e6(Q.lastmod)}</lastmod>`:"",J=Q.changefreq?`
|
|
54
|
+
<changefreq>${Q.changefreq}</changefreq>`:"",z=Q.priority!==void 0?`
|
|
55
|
+
<priority>${Q.priority.toFixed(1)}</priority>`:"";return` <url>
|
|
56
|
+
<loc>${Y}</loc>${X}${J}${z}
|
|
57
|
+
</url>`}).join(`
|
|
58
|
+
`)}
|
|
59
|
+
</urlset>`}async function gZ(Z,$,Q,Y,X){let J=dZ(Z,X),z=[];for(let q=0;q<J.length;q++){let U=`sitemap-${q+1}.xml`,V=t6(J[q]),j=u.join($,U);await c.promises.writeFile(j,V,"utf-8"),z.push(U)}let H=`<?xml version="1.0" encoding="UTF-8"?>
|
|
60
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
61
|
+
${z.map((q)=>{let U=`${Q}/${q}`,V=new Date().toISOString();return` <sitemap>
|
|
62
|
+
<loc>${U}</loc>
|
|
63
|
+
<lastmod>${e6(V)}</lastmod>
|
|
64
|
+
</sitemap>`}).join(`
|
|
65
|
+
`)}
|
|
66
|
+
</sitemapindex>`,G=u.join($,Y);await c.promises.writeFile(G,H,"utf-8")}function e6(Z){return(typeof Z==="string"?new Date(Z):Z).toISOString().split("T")[0]}function dZ(Z,$){let Q=[];for(let Y=0;Y<Z.length;Y+=$)Q.push(Z.slice(Y,Y+$));return Q}import{existsSync as uZ}from"fs";import{rm as xZ}from"fs/promises";import{join as mZ}from"path";var k={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m"};function P(Z,$){return`${k[$]}${Z}${k.reset}`}function E(Z){console.log(`${k.green}\u2713${k.reset} ${Z}`)}function F(Z){console.error(`${k.red}\u2717${k.reset} ${Z}`)}function X6(Z){console.warn(`${k.yellow}\u26A0${k.reset} ${Z}`)}function I(Z){console.log(`${k.blue}\u2139${k.reset} ${Z}`)}function y(Z){if(Z===0)return"0 B";let $=1024,Q=["B","KB","MB","GB"],Y=Math.floor(Math.log(Z)/Math.log($));return`${Number.parseFloat((Z/$**Y).toFixed(2))} ${Q[Y]}`}function B6(Z){if(Z<1000)return`${Z}ms`;if(Z<60000)return`${(Z/1000).toFixed(2)}s`;return`${(Z/60000).toFixed(2)}m`}var o6=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class x{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(Z){this.text=Z}start(){if(o6){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let Z=this.frames[this.index];process.stdout.write(`\r${k.cyan}${Z}${k.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(Z){this.stop(),E(Z||this.text)}fail(Z){this.stop(),F(Z||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!o6)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(Z){this.text=Z}}async function z6(Z,$=!1){let Q=$?"Y/n":"y/N";process.stdout.write(`${k.cyan}?${k.reset} ${Z} ${k.dim}(${Q})${k.reset}: `);let Y=Bun.file("/dev/stdin").stream().getReader(),X=new TextDecoder,{value:J}=await Y.read(),z=X.decode(J).trim().toLowerCase();if(!z)return $;return z==="y"||z==="yes"}function r(Z){if(Z.length===0)return;let $=Object.keys(Z[0]),Q={};for(let X of $)Q[X]=Math.max(X.length,...Z.map((J)=>String(J[X]).length));let Y=$.map((X)=>X.padEnd(Q[X])).join(" ");console.log(P(Y,"bold")),console.log("\u2500".repeat(Y.length));for(let X of Z){let J=$.map((z)=>String(X[z]).padEnd(Q[z])).join(" ");console.log(J)}}async function K6(Z){try{return Bun.file(Z).size}catch{return 0}}async function cZ(Z){try{let{Glob:$}=awaitPromise.resolve(globalThis.Bun),Q=new $("**/*"),Y=0;for await(let X of Q.scan(Z)){let J=`${Z}/${X}`,z=await K6(J);Y+=z}return Y}catch{return 0}}async function Z0(Z={}){let $=await b,Q=Z.outdir||$.outDir||"./dist",Y=mZ(Q,".bunpress"),X=Z.force||!1,J=Z.verbose||!1;try{if(!uZ(Y))return I(`Directory "${Y}" does not exist, nothing to clean`),!0;let K=await cZ(Y);if(J)I(`Found "${Y}" (${y(K)})`);if(!X){if(!await z6(`Delete "${Y}" directory? (${y(K)})`,!1))return I("Clean cancelled"),!1}let H=process.env.VITEST==="true"||!1,G=null;if(!H&&!J)G=new x("Cleaning build artifacts..."),G.start();if(await xZ(Y,{recursive:!0,force:!0}),G)G.succeed(`Cleaned ${y(K)} from "${Y}"`);else if(J||H)E(`Cleaned ${y(K)} from "${Y}"`);return!0}catch(z){return F(`Failed to clean directory: ${z}`),!1}}import{existsSync as O6}from"fs";import{join as T6}from"path";async function $0(Z={}){try{let $=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let X of $){let J=T6(process.cwd(),X);if(O6(J)){Q=J;break}}if(!Q)return F("No configuration file found"),I('Run "bunpress config init" to create one'),!1;E(`Configuration file: ${Q}`),console.log();let Y=await Bun.file(Q).text();return console.log(P("Configuration:","bold")),console.log(Y),!0}catch($){return F(`Failed to show configuration: ${$}`),!1}}async function Q0(Z={}){let $=Z.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],Y=null;for(let K of Q){let H=T6(process.cwd(),K);if(O6(H)){Y=H;break}}if(!Y)return F("No configuration file found"),!1;if($)I(`Validating ${Y}...`);let J=(await import(Y)).default;if(!J)return F("Configuration file does not export a default object"),!1;let z=[];if(J.markdown){if(J.markdown.toc&&typeof J.markdown.toc!=="object"&&typeof J.markdown.toc!=="boolean")z.push("markdown.toc should be an object or boolean");if(J.markdown.features){if(typeof J.markdown.features!=="object")z.push("markdown.features should be an object")}}if(J.nav){if(!Array.isArray(J.nav))z.push("nav should be an array");else for(let[K,H]of J.nav.entries())if(!H.text||!H.link)z.push(`nav[${K}] is missing required fields (text, link)`)}if(J.sitemap){if(!J.sitemap.hostname)z.push("sitemap.hostname is required for SEO")}if(z.length>0){F("Configuration validation failed:");for(let K of z)console.log(` \u2022 ${K}`);return!1}return E("Configuration is valid \u2713"),!0}catch(Q){return F(`Failed to validate configuration: ${Q}`),!1}}async function Y0(Z={}){let $=T6(process.cwd(),"bunpress.config.ts");if(O6($))return F("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
verbose: false,
|
|
70
|
+
|
|
71
|
+
markdown: {
|
|
72
|
+
toc: {
|
|
73
|
+
enabled: true,
|
|
74
|
+
position: 'sidebar',
|
|
75
|
+
minDepth: 2,
|
|
76
|
+
maxDepth: 3,
|
|
77
|
+
},
|
|
78
|
+
features: {
|
|
79
|
+
inlineFormatting: true,
|
|
80
|
+
containers: true,
|
|
81
|
+
githubAlerts: true,
|
|
82
|
+
codeBlocks: {
|
|
83
|
+
lineNumbers: true,
|
|
84
|
+
lineHighlighting: true,
|
|
85
|
+
focus: true,
|
|
86
|
+
diff: true,
|
|
87
|
+
errorWarning: true,
|
|
88
|
+
},
|
|
89
|
+
codeGroups: true,
|
|
90
|
+
codeImports: true,
|
|
91
|
+
inlineToc: true,
|
|
92
|
+
customAnchors: true,
|
|
93
|
+
emoji: true,
|
|
94
|
+
badges: true,
|
|
95
|
+
includes: true,
|
|
96
|
+
externalLinks: {
|
|
97
|
+
enabled: true,
|
|
98
|
+
openInNewTab: true,
|
|
99
|
+
addIcon: true,
|
|
100
|
+
},
|
|
101
|
+
imageLazyLoading: true,
|
|
102
|
+
tables: {
|
|
103
|
+
responsive: true,
|
|
104
|
+
striped: true,
|
|
105
|
+
hover: true,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
nav: [
|
|
111
|
+
{ text: 'Home', link: '/' },
|
|
112
|
+
{ text: 'Guide', link: '/guide/' },
|
|
113
|
+
],
|
|
114
|
+
|
|
115
|
+
sitemap: {
|
|
116
|
+
hostname: 'https://example.com',
|
|
117
|
+
},
|
|
118
|
+
} satisfies BunPressConfig
|
|
119
|
+
`;try{return await Bun.write($,Q),E(`Created ${$}`),!0}catch(Y){return F(`Failed to create configuration: ${Y}`),!1}}import{existsSync as l}from"fs";import{join as a}from"path";async function J0(Z={}){let $=Z.verbose||!1,Q=[];console.log(P(`
|
|
120
|
+
Running diagnostics...
|
|
121
|
+
`,"bold"));try{let j=Bun.version;Q.push({name:"Bun Runtime",status:"pass",message:`v${j}`})}catch(j){Q.push({name:"Bun Runtime",status:"fail",message:"Not found"})}let Y=["bunpress.config.ts","bunpress.config.js"],X=!1;for(let j of Y)if(l(a(process.cwd(),j))){X=!0,Q.push({name:"Configuration",status:"pass",message:j});break}if(!X)Q.push({name:"Configuration",status:"warn",message:"No config file found (using defaults)"});let J=a(process.cwd(),"docs");if(l(J)){let{Glob:j}=awaitPromise.resolve(globalThis.Bun),W=new j("**/*.md"),L=0;for await(let w of W.scan(J))L++;Q.push({name:"Documentation",status:L>0?"pass":"warn",message:`${L} markdown files`})}else Q.push({name:"Documentation",status:"fail",message:"docs/ directory not found"});let z=a(process.cwd(),"package.json");if(l(z)){let j=await Bun.file(z).json(),W=j.scripts?.dev,L=j.scripts?.build;Q.push({name:"Package Scripts",status:W&&L?"pass":"warn",message:`dev: ${W?"\u2713":"\u2717"}, build: ${L?"\u2713":"\u2717"}`});let w=j.dependencies?.["@stacksjs/bunpress"]||j.devDependencies?.["@stacksjs/bunpress"];Q.push({name:"BunPress Package",status:w?"pass":"warn",message:w||"Not installed"})}else Q.push({name:"Package.json",status:"warn",message:"Not found"});let K=a(process.cwd(),"node_modules");if(l(K))Q.push({name:"Dependencies",status:"pass",message:"node_modules found"});else Q.push({name:"Dependencies",status:"warn",message:"node_modules not found (run: bun install)"});let H=a(process.cwd(),".git");if(l(H))Q.push({name:"Git Repository",status:"pass",message:"Initialized"});else Q.push({name:"Git Repository",status:"warn",message:"Not initialized"});let G=a(process.cwd(),"tsconfig.json");if(l(G))Q.push({name:"TypeScript",status:"pass",message:"tsconfig.json found"});else Q.push({name:"TypeScript",status:"warn",message:"tsconfig.json not found"});for(let j of Q){let W=j.status==="pass"?"\u2713":j.status==="fail"?"\u2717":"\u26A0",L=j.status==="pass"?"green":j.status==="fail"?"red":"yellow";console.log(` ${P(W,L)} ${j.name}: ${P(j.message,"dim")}`)}console.log();let q=Q.filter((j)=>j.status==="pass").length,U=Q.filter((j)=>j.status==="fail").length,V=Q.filter((j)=>j.status==="warn").length;if(U>0){if(F(`${U} checks failed, ${V} warnings`),console.log(),I("Recommended actions:"),Q.find((j)=>j.name==="Documentation"&&j.status==="fail"))console.log(' \u2022 Run "bunpress init" to create docs directory');if(Q.find((j)=>j.name==="Dependencies"&&j.status==="warn"))console.log(' \u2022 Run "bun install" to install dependencies');if(Q.find((j)=>j.name==="BunPress Package"&&j.status==="warn"))console.log(' \u2022 Run "bun add @stacksjs/bunpress" to install BunPress');return!1}else if(V>0)return X6(`${q} checks passed, ${V} warnings`),!0;else return E(`All ${q} checks passed!`),!0}import{mkdir as R6}from"fs/promises";var lZ=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
122
|
+
|
|
123
|
+
export default {
|
|
124
|
+
verbose: false,
|
|
125
|
+
|
|
126
|
+
markdown: {
|
|
127
|
+
toc: {
|
|
128
|
+
enabled: true,
|
|
129
|
+
position: 'sidebar',
|
|
130
|
+
minDepth: 2,
|
|
131
|
+
maxDepth: 3,
|
|
132
|
+
},
|
|
133
|
+
features: {
|
|
134
|
+
inlineFormatting: true,
|
|
135
|
+
containers: true,
|
|
136
|
+
githubAlerts: true,
|
|
137
|
+
codeBlocks: {
|
|
138
|
+
lineNumbers: true,
|
|
139
|
+
lineHighlighting: true,
|
|
140
|
+
focus: true,
|
|
141
|
+
diff: true,
|
|
142
|
+
errorWarning: true,
|
|
143
|
+
},
|
|
144
|
+
codeGroups: true,
|
|
145
|
+
codeImports: true,
|
|
146
|
+
inlineToc: true,
|
|
147
|
+
customAnchors: true,
|
|
148
|
+
emoji: true,
|
|
149
|
+
badges: true,
|
|
150
|
+
includes: true,
|
|
151
|
+
externalLinks: {
|
|
152
|
+
enabled: true,
|
|
153
|
+
openInNewTab: true,
|
|
154
|
+
addIcon: true,
|
|
155
|
+
},
|
|
156
|
+
imageLazyLoading: true,
|
|
157
|
+
tables: {
|
|
158
|
+
responsive: true,
|
|
159
|
+
striped: true,
|
|
160
|
+
hover: true,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
nav: [
|
|
166
|
+
{ text: 'Home', link: '/' },
|
|
167
|
+
{ text: 'Guide', link: '/guide/' },
|
|
168
|
+
{ text: 'GitHub', link: 'https://github.com/stacksjs/bunpress' },
|
|
169
|
+
],
|
|
170
|
+
|
|
171
|
+
sitemap: {
|
|
172
|
+
hostname: 'https://example.com',
|
|
173
|
+
},
|
|
174
|
+
} satisfies BunPressConfig
|
|
175
|
+
`,aZ=`---
|
|
176
|
+
layout: home
|
|
177
|
+
title: Welcome to My Documentation
|
|
178
|
+
|
|
179
|
+
hero:
|
|
180
|
+
name: My Project
|
|
181
|
+
text: Modern documentation made easy
|
|
182
|
+
tagline: Fast, flexible, and beautiful documentation powered by BunPress
|
|
183
|
+
actions:
|
|
184
|
+
- theme: brand
|
|
185
|
+
text: Get Started
|
|
186
|
+
link: /guide/
|
|
187
|
+
- theme: alt
|
|
188
|
+
text: View on GitHub
|
|
189
|
+
link: https://github.com/yourusername/your-repo
|
|
190
|
+
|
|
191
|
+
features:
|
|
192
|
+
- icon: \u26A1
|
|
193
|
+
title: Lightning Fast
|
|
194
|
+
details: Powered by Bun runtime for incredible build and dev server performance
|
|
195
|
+
- icon: \uD83C\uDFA8
|
|
196
|
+
title: Beautiful by Default
|
|
197
|
+
details: Clean, modern design with dark mode support out of the box
|
|
198
|
+
- icon: \uD83D\uDCDD
|
|
199
|
+
title: Markdown Enhanced
|
|
200
|
+
details: Extended markdown features including containers, code groups, and more
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
# Welcome
|
|
204
|
+
|
|
205
|
+
This is your new BunPress documentation site. Start editing files in the \`docs/\` directory to customize your content.
|
|
206
|
+
`,pZ=`# Getting Started
|
|
207
|
+
|
|
208
|
+
Welcome to the getting started guide!
|
|
209
|
+
|
|
210
|
+
## Installation
|
|
211
|
+
|
|
212
|
+
\`\`\`bash
|
|
213
|
+
bun install @stacksjs/bunpress
|
|
214
|
+
\`\`\`
|
|
215
|
+
|
|
216
|
+
## Quick Start
|
|
217
|
+
|
|
218
|
+
Create your first documentation page:
|
|
219
|
+
|
|
220
|
+
\`\`\`bash
|
|
221
|
+
bunpress new my-page
|
|
222
|
+
\`\`\`
|
|
223
|
+
|
|
224
|
+
## Next Steps
|
|
225
|
+
|
|
226
|
+
::: tip
|
|
227
|
+
Check out the [markdown extensions](/guide/markdown) to learn about all the powerful features available.
|
|
228
|
+
:::
|
|
229
|
+
|
|
230
|
+
- Learn about [configuration](/guide/configuration)
|
|
231
|
+
- Explore [advanced features](/guide/advanced)
|
|
232
|
+
- Read the [API reference](/api/)
|
|
233
|
+
`,nZ=`node_modules/
|
|
234
|
+
dist/
|
|
235
|
+
.DS_Store
|
|
236
|
+
*.log
|
|
237
|
+
.env
|
|
238
|
+
.env.*
|
|
239
|
+
!.env.example
|
|
240
|
+
`,iZ=`# My BunPress Documentation
|
|
241
|
+
|
|
242
|
+
Documentation powered by [BunPress](https://github.com/stacksjs/bunpress).
|
|
243
|
+
|
|
244
|
+
## Development
|
|
245
|
+
|
|
246
|
+
Start the dev server:
|
|
247
|
+
|
|
248
|
+
\`\`\`bash
|
|
249
|
+
bun run dev
|
|
250
|
+
\`\`\`
|
|
251
|
+
|
|
252
|
+
## Build
|
|
253
|
+
|
|
254
|
+
Build the documentation:
|
|
255
|
+
|
|
256
|
+
\`\`\`bash
|
|
257
|
+
bun run build
|
|
258
|
+
\`\`\`
|
|
259
|
+
|
|
260
|
+
## Preview
|
|
261
|
+
|
|
262
|
+
Preview the built site:
|
|
263
|
+
|
|
264
|
+
\`\`\`bash
|
|
265
|
+
bun run preview
|
|
266
|
+
\`\`\`
|
|
267
|
+
`;async function X0(Z={}){try{if(await Bun.file("./docs").exists()&&!Z.force){if(!await z6("Documentation directory already exists. Continue?",!1))return I("Initialization cancelled"),!1}let Q=new x("Initializing BunPress project...");Q.start(),await R6("./docs",{recursive:!0}),await R6("./docs/guide",{recursive:!0}),await R6("./docs/public",{recursive:!0}),await Bun.write("./bunpress.config.ts",lZ),await Bun.write("./docs/index.md",aZ),await Bun.write("./docs/guide/index.md",pZ);let Y=await Bun.file("./.gitignore").exists();if(!Y)await Bun.write("./.gitignore",nZ);let X=await Bun.file("./README.md").exists();if(!X)await Bun.write("./README.md",iZ);let J="./package.json";if(await Bun.file(J).exists()){let K=await Bun.file(J).json();K.scripts=K.scripts||{},K.scripts.dev=K.scripts.dev||"bunpress dev",K.scripts.build=K.scripts.build||"bunpress build",K.scripts.preview=K.scripts.preview||"bunpress preview",await Bun.write(J,JSON.stringify(K,null,2))}if(Q.succeed("BunPress project initialized successfully!"),console.log(),E("Created files:"),console.log(" \u2022 bunpress.config.ts"),console.log(" \u2022 docs/index.md"),console.log(" \u2022 docs/guide/index.md"),console.log(" \u2022 docs/public/"),!Y)console.log(" \u2022 .gitignore");if(!X)console.log(" \u2022 README.md");return console.log(),I("Next steps:"),console.log(" 1. Install BunPress: bun add @stacksjs/bunpress"),console.log(" 2. Start dev server: bun run dev"),console.log(" 3. Edit docs/index.md to customize your home page"),!0}catch($){return F(`Failed to initialize project: ${$}`),!1}}import{mkdir as rZ}from"fs/promises";import{dirname as sZ,join as tZ}from"path";var z0={default:(Z)=>`---
|
|
268
|
+
title: ${Z}
|
|
269
|
+
description:
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
# ${Z}
|
|
273
|
+
|
|
274
|
+
Your content goes here...
|
|
275
|
+
`,guide:(Z)=>`---
|
|
276
|
+
title: ${Z}
|
|
277
|
+
description: ${Z} guide
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
# ${Z}
|
|
281
|
+
|
|
282
|
+
## Introduction
|
|
283
|
+
|
|
284
|
+
Brief introduction to the topic.
|
|
285
|
+
|
|
286
|
+
## Getting Started
|
|
287
|
+
|
|
288
|
+
Step-by-step instructions.
|
|
289
|
+
|
|
290
|
+
## Examples
|
|
291
|
+
|
|
292
|
+
\`\`\`typescript
|
|
293
|
+
// Example code
|
|
294
|
+
\`\`\`
|
|
295
|
+
|
|
296
|
+
## Next Steps
|
|
297
|
+
|
|
298
|
+
- [ ] Task 1
|
|
299
|
+
- [ ] Task 2
|
|
300
|
+
`,api:(Z)=>`---
|
|
301
|
+
title: ${Z}
|
|
302
|
+
description: API reference for ${Z}
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
# ${Z}
|
|
306
|
+
|
|
307
|
+
## Overview
|
|
308
|
+
|
|
309
|
+
Brief overview of the API.
|
|
310
|
+
|
|
311
|
+
## Methods
|
|
312
|
+
|
|
313
|
+
### \`methodName()\`
|
|
314
|
+
|
|
315
|
+
Description of the method.
|
|
316
|
+
|
|
317
|
+
**Parameters:**
|
|
318
|
+
|
|
319
|
+
- \`param1\` (\`type\`) - Description
|
|
320
|
+
|
|
321
|
+
**Returns:**
|
|
322
|
+
|
|
323
|
+
- \`ReturnType\` - Description
|
|
324
|
+
|
|
325
|
+
**Example:**
|
|
326
|
+
|
|
327
|
+
\`\`\`typescript
|
|
328
|
+
// Example usage
|
|
329
|
+
\`\`\`
|
|
330
|
+
`,blog:(Z)=>`---
|
|
331
|
+
title: ${Z}
|
|
332
|
+
description:
|
|
333
|
+
date: ${new Date().toISOString().split("T")[0]}
|
|
334
|
+
author:
|
|
335
|
+
tags: []
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
# ${Z}
|
|
339
|
+
|
|
340
|
+
Post content goes here...
|
|
341
|
+
|
|
342
|
+
## Section 1
|
|
343
|
+
|
|
344
|
+
Content...
|
|
345
|
+
`};async function K0(Z,$={}){try{let Q=Z.endsWith(".md")?Z:`${Z}.md`,Y=tZ(process.cwd(),"docs",Q);if(await Bun.file(Y).exists())return F(`File already exists: ${Q}`),!1;let J=$.title;if(!J)J=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(" ");let z=$.template||"default",K=z0[z];if(!K)return F(`Unknown template: ${z}`),F(`Available templates: ${Object.keys(z0).join(", ")}`),!1;let H=K(J),G=sZ(Y);return await rZ(G,{recursive:!0}),await Bun.write(Y,H),E(`Created ${Q}`),console.log(),console.log(` Title: ${J}`),console.log(` Template: ${z}`),console.log(` Path: ${Y}`),!0}catch(Q){return F(`Failed to create file: ${Q}`),!1}}import{join as q0}from"path";async function j0(Z={}){let $=Z.port||3000,Q=await b,Y=Z.outdir||Q.outDir||"./dist",X=q0(Y,".bunpress"),J=Z.verbose||!1;try{let{stat:z}=await import("fs/promises");try{if(!(await z(X)).isDirectory())F(`"${X}" is not a directory.`),F('Run "bunpress build" first to generate the documentation.'),process.exit(1)}catch{F(`Build directory "${X}" not found.`),F('Run "bunpress build" first to generate the documentation.'),process.exit(1)}I(`Starting preview server from ${X}`);try{let K=Bun.serve({port:$,fetch:async(H)=>{let q=new URL(H.url).pathname;if(q.startsWith("/"))q=q.slice(1);if(q===""||q==="/")q="index.html";let U=q0(X,q),V=Bun.file(U);if(await V.exists())return new Response(V,{headers:{"Content-Type":eZ(q)}});let W=`${U}.html`,L=Bun.file(W);if(await L.exists())return new Response(L,{headers:{"Content-Type":"text/html"}});return new Response("404 - Not Found",{status:404})}});E(`Preview server running at http://localhost:${$}`),console.log(`Press Ctrl+C to stop
|
|
346
|
+
`),await new Promise(()=>{})}catch(K){if(K.message?.includes("EADDRINUSE")||K.code==="EADDRINUSE")F(`Port ${$} is already in use.`),F("Try running with a different port: bunpress preview --port <port>"),F(`Or stop any processes using port ${$}`);else F(`Failed to start server: ${K.message||K}`);process.exit(1)}}catch(z){F(`Failed to start preview server: ${z}`),process.exit(1)}}function eZ(Z){let $=Z.split(".").pop()?.toLowerCase();return{html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",ico:"image/x-icon",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",eot:"application/vnd.ms-fontobject"}[$||""]||"text/plain"}import*as f from"fs";import*as g from"path";var{YAML:H0}=globalThis.Bun;async function G0(Z={}){let $=await b,Q=Z.dir||$.docsDir||"./docs",Y=Z.fix||!1;if(I("\uD83D\uDD0D Running SEO checks..."),console.log(""),!f.existsSync(Q))F(`Documentation directory not found: ${Q}`),process.exit(1);let X={totalPages:0,errors:[],warnings:[],passed:0},J=await Z$(Q);X.totalPages=J.length;for(let z of J)await oZ(z,Q,X,Y);if(z$(X),X.errors.length>0)process.exit(1)}async function oZ(Z,$,Q,Y){let X=await f.promises.readFile(Z,"utf-8"),{frontmatter:J,markdown:z}=$$(X),K=g.relative($,Z),H=!1,G=!1,q={...J};if(!J.title){let j=Q$(z);if(!j)Q.errors.push({type:"error",category:"Title",file:K,message:"Missing title in frontmatter"}),H=!0;else if(Y)q.title=j,G=!0,I(`\u2713 Added title to ${K}: "${j}"`);else Q.warnings.push({type:"warning",category:"Title",file:K,message:`No title in frontmatter (could extract: "${j}")`}),H=!0}else{let j=J.title.length;if(j>60)Q.warnings.push({type:"warning",category:"Title",file:K,message:`Title too long (${j} chars, recommended <60)`}),H=!0;else if(j<10)Q.warnings.push({type:"warning",category:"Title",file:K,message:`Title too short (${j} chars, recommended >10)`}),H=!0}if(!J.description){let j=Y$(z);if(Y)q.description=j,G=!0,I(`\u2713 Added description to ${K}`);else Q.warnings.push({type:"warning",category:"Description",file:K,message:"Missing description in frontmatter"}),H=!0}else{let j=J.description.length;if(j>160)Q.warnings.push({type:"warning",category:"Description",file:K,message:`Description too long (${j} chars, recommended <160)`}),H=!0;else if(j<50)Q.warnings.push({type:"warning",category:"Description",file:K,message:`Description too short (${j} chars, recommended >50)`}),H=!0}let U=J$(z,$,Z);for(let j of U)Q.errors.push({type:"error",category:"Links",file:K,message:`Broken internal link: ${j}`}),H=!0;let V=X$(z);for(let j of V)Q.warnings.push({type:"warning",category:"Images",file:K,message:`Image missing alt text: ${j}`}),H=!0;if(G){let j=`---
|
|
347
|
+
${H0.stringify(q)}---
|
|
348
|
+
${z}`;await f.promises.writeFile(Z,j,"utf-8")}if(!H)Q.passed++}async function Z$(Z){let $=[];async function Q(Y){let X=await f.promises.readdir(Y,{withFileTypes:!0});for(let J of X){let z=g.join(Y,J.name);if(J.isDirectory()){if(!J.name.startsWith(".")&&J.name!=="node_modules"&&J.name!=="public")await Q(z)}else if(J.isFile()&&J.name.endsWith(".md"))$.push(z)}}return await Q(Z),$}function $$(Z){let $=/^---\n([\s\S]*?)\n---\n?/,Q=Z.match($);if(!Q)return{frontmatter:{},markdown:Z};let Y=Q[1],X=Z.slice(Q[0].length);try{return{frontmatter:H0.parse(Y),markdown:X}}catch{return{frontmatter:{},markdown:Z}}}function Q$(Z){let $=Z.match(/^#\s+(.+)$/m);return $?$[1].trim():null}function Y$(Z,$=155){let Q=Z.replace(/^#{1,6}\s+.+$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]+`/g,"").replace(/!\[.*?\]\(.*?\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_~]/g,"").trim(),Y=Q.split(`
|
|
349
|
+
|
|
350
|
+
`)[0]||Q;if(Y.length>$)return`${Y.slice(0,$)}...`;return Y||"Documentation page"}function J$(Z,$,Q){let Y=[],X=/\[([^\]]+)\]\(([^)]+)\)/g,J;while((J=X.exec(Z))!==null){let z=J[2];if(z.startsWith("http://")||z.startsWith("https://"))continue;if(z.startsWith("#"))continue;let K=g.dirname(Q),H=g.resolve(K,z),G=H.endsWith(".md")?H:`${H}.md`;if(!f.existsSync(G)&&!f.existsSync(H))Y.push(z)}return Y}function X$(Z){let $=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,Y;while((Y=Q.exec(Z))!==null){let X=Y[1],J=Y[2];if(!X||X.trim()==="")$.push(J)}return $}function z$(Z){if(console.log(""),I("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${P(Z.totalPages.toString(),"blue")}`),console.log(`Passed: ${P(Z.passed.toString(),"green")}`),console.log(`Errors: ${P(Z.errors.length.toString(),Z.errors.length>0?"red":"green")}`),console.log(`Warnings: ${P(Z.warnings.length.toString(),Z.warnings.length>0?"yellow":"green")}`),console.log(""),Z.errors.length>0){F(`\u2717 ${Z.errors.length} errors found:`),console.log("");let $=Z.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));r($),console.log("")}if(Z.warnings.length>0){X6(`\u26A0 ${Z.warnings.length} warnings found:`),console.log("");let $=Z.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));r($),console.log("")}if(Z.errors.length===0&&Z.warnings.length===0)E("\u2713 All SEO checks passed!");else if(Z.errors.length===0)E("\u2713 No errors found (only warnings)")}import{join as K$}from"path";async function q$(Z){let $=await Bun.file(Z).text(),Q=$.split(`
|
|
351
|
+
`),Y=0,X=!1,J=[];for(let G of Q){if(G.trim().startsWith("```")){X=!X;continue}if(!X)J.push(G)}Y=J.join(" ").split(/\s+/).filter((G)=>G.length>0).length;let K=Q.filter((G)=>G.match(/^#{1,6}\s+/)).length,H=($.match(/```/g)||[]).length/2;return{path:Z,size:await K6(Z),lines:Q.length,words:Y,headings:K,codeBlocks:Math.floor(H)}}async function U0(Z={}){let $=await b,Q=Z.dir||$.docsDir||"./docs",Y=Z.verbose||!1;try{console.log(P(`
|
|
352
|
+
Analyzing documentation...
|
|
353
|
+
`,"bold"));let{Glob:X}=awaitPromise.resolve(globalThis.Bun),J=new X("**/*.md"),z=[];for await(let M of J.scan(Q)){let N=K$(Q,M),m=await q$(N);z.push(m)}if(z.length===0)return F("No markdown files found"),!1;let K=z.reduce((M,N)=>M+N.size,0),H=z.reduce((M,N)=>M+N.lines,0),G=z.reduce((M,N)=>M+N.words,0),q=z.reduce((M,N)=>M+N.headings,0),U=z.reduce((M,N)=>M+N.codeBlocks,0);if(console.log(P("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${z.length}`),console.log(`Total size: ${y(K)}`),console.log(`Total lines: ${H.toLocaleString()}`),console.log(`Total words: ${G.toLocaleString()}`),console.log(`Headings: ${q}`),console.log(`Code blocks: ${U}`),console.log(),Y){console.log(P("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let M=z.map((N)=>({File:N.path.replace(`${Q}/`,""),Size:y(N.size),Lines:N.lines,Words:N.words,Headings:N.headings,"Code Blocks":N.codeBlocks}));r(M),console.log()}let V=K/z.length,j=H/z.length,W=G/z.length;console.log(P("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${y(V)}`),console.log(`Lines: ${Math.round(j)}`),console.log(`Words: ${Math.round(W)}`),console.log();let L=[...z].sort((M,N)=>N.size-M.size).slice(0,5);if(L.length>0){console.log(P("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let M of L){let N=M.path.replace(`${Q}/`,"");console.log(` ${N.padEnd(40)} ${y(M.size)}`)}console.log()}let w=Math.ceil(G/200);return I(`Estimated reading time: ${w} minutes`),!0}catch(X){return F(`Failed to generate statistics: ${X}`),!1}}var C=new M6("bunpress"),O={outdir:b.outDir||"./dist",docsdir:b.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:b.verbose};async function N0(Z){let $=new F0("**/*.md"),Q=[];for await(let Y of $.scan(Z))Q.push(d(Z,Y));return Q}async function G$(Z,$,Q=!1){let Y=`${$}/public`;try{await H$(Y);let X=new F0("**/*");for await(let J of X.scan(Y)){let z=d(Y,J),K=d(Z,J);await M0(d(Z,J.split("/").slice(0,-1).join("/")),{recursive:!0}),await j$(z,K)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function U$(Z,$,Q){try{let Y=await b;if(Y.sitemap?.enabled!==!1&&Y.sitemap?.baseUrl)await s6(Z,$,Y);if(Y.robots?.enabled!==!1)await i6($,Y);if(Y.rss?.enabled)await r6(Z,$,Y,Y.rss)}catch(Y){if(Q)console.error("Error generating SEO files:",Y)}}async function V0(Z={}){let $=await b,Q=Z.outdir||$.outDir||O.outdir,Y=d(Q,".bunpress"),X=Z.dir||$.docsDir||O.docsdir,J=Z.verbose??O.verbose,z=Z.minify??!1,K=Z.sourcemap??!1,H=performance.now(),G=new x("Building documentation...");if(!J)G.start();await M0(Y,{recursive:!0});let q=await N0(X);if(q.length===0){if(!J)G.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(J)console.log(`Found ${q.length} markdown files:`),q.forEach((U)=>console.log(`- ${U}`));try{let{markdownToHtml:U,wrapInLayout:V}=await import("./chunk-8qj79f0y.js"),{mkdir:j,writeFile:W}=await import("fs/promises");if(J)console.log("Transforming markdown to HTML...");for(let M of q){let N=await Bun.file(M).text(),{html:m,frontmatter:L0}=await U(N,X),D0=M.replace(/^\.\//,""),B0=X.replace(/^\.\//,""),I6=D0.replace(B0,"").replace(/^\//,"").replace(/\.md$/,""),O0=`/${I6}`,T0=L0.layout||"doc",R0=await V(m,$,O0,T0),s=d(Y,I6+".html"),w6=s.substring(0,s.lastIndexOf("/"));if(w6)await j(w6,{recursive:!0});if(await W(s,R0),J)console.log(`Generated: ${s}`)}if(J)console.log(`Processed ${q.length} markdown files.`);await G$(Y,X,J),await W$(Y),await V$(Y,$),await U$(X,Y,J||!1);let w=performance.now()-H;if(!J)G.succeed(`Built ${q.length} pages to HTML in ${B6(w)}`);else E(`Build completed in ${B6(w)}`),console.log(`
|
|
354
|
+
Generated ${q.length} HTML files in ${Y}`);return!0}catch(U){if(!J)G.fail("Build failed");return console.error("Error during build:",U),!1}}async function V$(Z,$){let{wrapInLayout:Q}=await import("./chunk-8qj79f0y.js"),Y=`
|
|
355
|
+
<style>
|
|
356
|
+
.NotFound {
|
|
357
|
+
padding: 64px 24px 96px;
|
|
358
|
+
text-align: center;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@media (min-width: 768px) {
|
|
362
|
+
.NotFound {
|
|
363
|
+
padding: 96px 32px 168px;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.NotFound .code {
|
|
368
|
+
line-height: 64px;
|
|
369
|
+
font-size: 64px;
|
|
370
|
+
font-weight: 600;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.NotFound .title {
|
|
374
|
+
padding-top: 12px;
|
|
375
|
+
letter-spacing: 2px;
|
|
376
|
+
line-height: 20px;
|
|
377
|
+
font-size: 20px;
|
|
378
|
+
font-weight: 700;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.NotFound .divider {
|
|
382
|
+
margin: 24px auto 18px;
|
|
383
|
+
width: 64px;
|
|
384
|
+
height: 1px;
|
|
385
|
+
background-color: var(--vp-c-divider);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.NotFound .quote {
|
|
389
|
+
margin: 0 auto;
|
|
390
|
+
max-width: 256px;
|
|
391
|
+
font-size: 14px;
|
|
392
|
+
font-weight: 500;
|
|
393
|
+
color: var(--vp-c-text-2);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.NotFound .action {
|
|
397
|
+
padding-top: 20px;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.NotFound .link {
|
|
401
|
+
display: inline-block;
|
|
402
|
+
border: 1px solid var(--vp-c-brand-1);
|
|
403
|
+
border-radius: 16px;
|
|
404
|
+
padding: 3px 16px;
|
|
405
|
+
font-size: 14px;
|
|
406
|
+
font-weight: 500;
|
|
407
|
+
color: var(--vp-c-brand-1);
|
|
408
|
+
transition: border-color 0.25s, color 0.25s;
|
|
409
|
+
text-decoration: none;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.NotFound .link:hover {
|
|
413
|
+
border-color: var(--vp-c-brand-2);
|
|
414
|
+
color: var(--vp-c-brand-2);
|
|
415
|
+
}
|
|
416
|
+
</style>
|
|
417
|
+
|
|
418
|
+
<div class="NotFound">
|
|
419
|
+
<p class="code">404</p>
|
|
420
|
+
<h1 class="title">PAGE NOT FOUND</h1>
|
|
421
|
+
<div class="divider"></div>
|
|
422
|
+
<blockquote class="quote">
|
|
423
|
+
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
|
|
424
|
+
</blockquote>
|
|
425
|
+
<div class="action">
|
|
426
|
+
<a class="link" href="/docs/" aria-label="go to home">
|
|
427
|
+
Take me home
|
|
428
|
+
</a>
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
`,X=await Q(`
|
|
432
|
+
<style>
|
|
433
|
+
.NotFound {
|
|
434
|
+
padding: 64px 24px 96px;
|
|
435
|
+
text-align: center;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
@media (min-width: 768px) {
|
|
439
|
+
.NotFound {
|
|
440
|
+
padding: 96px 32px 168px;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.NotFound .code {
|
|
445
|
+
line-height: 64px;
|
|
446
|
+
font-size: 64px;
|
|
447
|
+
font-weight: 600;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.NotFound .title {
|
|
451
|
+
padding-top: 12px;
|
|
452
|
+
letter-spacing: 2px;
|
|
453
|
+
line-height: 20px;
|
|
454
|
+
font-size: 20px;
|
|
455
|
+
font-weight: 700;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.NotFound .divider {
|
|
459
|
+
margin: 24px auto 18px;
|
|
460
|
+
width: 64px;
|
|
461
|
+
height: 1px;
|
|
462
|
+
background-color: var(--vp-c-divider);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.NotFound .quote {
|
|
466
|
+
margin: 0 auto;
|
|
467
|
+
max-width: 256px;
|
|
468
|
+
font-size: 14px;
|
|
469
|
+
font-weight: 500;
|
|
470
|
+
color: var(--vp-c-text-2);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.NotFound .action {
|
|
474
|
+
padding-top: 20px;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.NotFound .link {
|
|
478
|
+
display: inline-block;
|
|
479
|
+
border: 1px solid var(--vp-c-brand-1);
|
|
480
|
+
border-radius: 16px;
|
|
481
|
+
padding: 3px 16px;
|
|
482
|
+
font-size: 14px;
|
|
483
|
+
font-weight: 500;
|
|
484
|
+
color: var(--vp-c-brand-1);
|
|
485
|
+
transition: border-color 0.25s, color 0.25s;
|
|
486
|
+
text-decoration: none;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.NotFound .link:hover {
|
|
490
|
+
border-color: var(--vp-c-brand-2);
|
|
491
|
+
color: var(--vp-c-brand-2);
|
|
492
|
+
}
|
|
493
|
+
</style>
|
|
494
|
+
|
|
495
|
+
<div class="NotFound">
|
|
496
|
+
<p class="code">404</p>
|
|
497
|
+
<h1 class="title">PAGE NOT FOUND</h1>
|
|
498
|
+
<div class="divider"></div>
|
|
499
|
+
<blockquote class="quote">
|
|
500
|
+
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
|
|
501
|
+
</blockquote>
|
|
502
|
+
<div class="action">
|
|
503
|
+
<a class="link" href="/docs/" aria-label="go to home">
|
|
504
|
+
Take me home
|
|
505
|
+
</a>
|
|
506
|
+
</div>
|
|
507
|
+
</div>
|
|
508
|
+
`,$,"/404","doc");await Bun.write(d(Z,"404.html"),X)}async function W$(Z){let $=d(Z,"index.html");try{if(!await Bun.file($).exists())console.error("Warning: No index.html found at root")}catch(Q){console.error("Error checking root index.html:",Q)}}C.command("build","Build the documentation site").option("--outdir <outdir>","Output directory").option("--dir <dir>","Documentation directory").option("--config <config>","Path to config file").option("--minify","Minify output files",{default:!1}).option("--sourcemap","Generate source maps",{default:!1}).option("--watch","Watch for changes and rebuild",{default:!1}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await V0(Z))v.exit(1);if(Z.watch){let{watch:Q}=await import("fs"),Y=await b,X=Z.dir||Y.docsDir||"./docs";console.log(`
|
|
509
|
+
Watching for changes...`),Q(X,{recursive:!0},async(J,z)=>{if(z&&z.endsWith(".md"))console.log(`
|
|
510
|
+
Detected change in ${z}, rebuilding...`),await V0(Z)}),await new Promise(()=>{})}});C.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:O.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:O.watch}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{let $=await b,Q=Z.port||O.port,Y=Z.dir||$.docsDir||O.docsdir,X=Z.watch??O.watch,J=Z.verbose??O.verbose;if(J)console.log("Starting BunPress dev server with options:",{port:Q,root:Y,watch:X,verbose:J});await W0({port:Q,root:Y,watch:X,config:$})});async function F$(Z={}){let $=await b,Q=Z.dir||$.docsDir||O.docsdir,Y=Z.output||"./docs.md",X=Z.full??!1,J=Z.verbose??O.verbose;if(J)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${Y}`),console.log(`Full content: ${X}`);let z=await N0(Q);if(z.length===0)return console.log("No markdown files found in docs directory"),!1;if(J)console.log(`Found ${z.length} markdown files`);z.sort();let K=`# Documentation
|
|
511
|
+
|
|
512
|
+
`;K+=`Generated: ${new Date().toISOString()}
|
|
513
|
+
|
|
514
|
+
`,K+=`Total files: ${z.length}
|
|
515
|
+
|
|
516
|
+
`,K+=`---
|
|
517
|
+
|
|
518
|
+
`;for(let H of z){let G=H.replace(`${Q}/`,""),q=await Bun.file(H).text();if(J)console.log(`Processing: ${G}`);if(K+=`## File: ${G}
|
|
519
|
+
|
|
520
|
+
`,X)K+=q,K+=`
|
|
521
|
+
|
|
522
|
+
`;else{let U=q.split(`
|
|
523
|
+
`),V=!1,j="";for(let W of U){if(W.trim()==="---")if(!V){V=!0;continue}else{if(V=!1,j)K+="**Frontmatter:**\n```yaml\n",K+=j,K+="```\n\n",j="";continue}if(V){j+=`${W}
|
|
524
|
+
`;continue}if(W.match(/^#{1,6}\s+/))K+=`${W}
|
|
525
|
+
`}K+=`
|
|
526
|
+
`}K+=`---
|
|
527
|
+
|
|
528
|
+
`}return await Bun.write(Y,K),console.log(`
|
|
529
|
+
LLM markdown generated successfully: ${Y}`),console.log(`Total size: ${(K.length/1024).toFixed(2)} KB`),!0}C.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--output <output>","Output file path",{default:"./docs.md"}).option("--full","Include full content (not just titles and headings)",{default:!1}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await F$(Z))v.exit(1)});C.command("init","Initialize a new BunPress project").option("--name <name>","Project name").option("--template <template>","Template to use").option("--force","Overwrite existing files",{default:!1}).action(async(Z)=>{if(!await X0(Z))v.exit(1)});C.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:O.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{await j0(Z)});C.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:O.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await Z0(Z))v.exit(1)});C.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await J0(Z))v.exit(1)});C.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await $0(Z))v.exit(1)});C.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await Q0(Z))v.exit(1)});C.command("config:init","Initialize configuration file").action(async(Z)=>{if(!await Y0(Z))v.exit(1)});C.command("new <path>","Create a new markdown file").option("--title <title>","Page title").option("--template <template>","Template to use (default, guide, api, blog)",{default:"default"}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z,$)=>{if(!await K0(Z,$))v.exit(1)});C.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await U0(Z))v.exit(1)});C.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(Z)=>{await G0(Z)});C.command("deploy","Deploy documentation to AWS using CloudFormation (S3 + CloudFront + Route53)").option("--region <region>","AWS region for S3 bucket",{default:"us-east-1"}).option("--bucket <bucket>","S3 bucket name (auto-generated if not provided)").option("--domain <domain>","Custom domain (e.g., docs.example.com)").option("--subdomain <subdomain>","Subdomain (used with --base-domain)").option("--base-domain <baseDomain>","Base domain (e.g., example.com) - must have Route53 hosted zone").option("--stack-name <stackName>","CloudFormation stack name").option("--hosted-zone-id <hostedZoneId>","Route53 hosted zone ID (auto-detected from domain)").option("--certificate-arn <certificateArn>","ACM certificate ARN (auto-created if not provided)").option("--dry-run","Show configuration without deploying",{default:!1}).option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{let{deployCommand:$}=await import("./chunk-szme5v1e.js");if(!await $(Z))v.exit(1)});C.help();C.version(a6);C.parse();
|
|
530
|
+
export{E as a,F as b,I as c,x as d,N0 as e,V0 as f};
|