@stacksjs/bunpress 0.0.5 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +296 -0
- package/README.md +113 -26
- package/dist/bin/cli.js +2 -85
- package/dist/chunk-16hpnayn.js +505 -0
- package/dist/chunk-njjmvdjd.js +8 -0
- package/dist/chunk-nt1zw6bf.js +9632 -0
- package/dist/chunk-zabbw4a8.js +2 -0
- package/dist/config.d.ts +3 -5
- package/dist/highlighter.d.ts +37 -0
- package/dist/index.d.ts +2 -0
- package/dist/robots.d.ts +5 -0
- package/dist/rss.d.ts +16 -0
- package/dist/serve.d.ts +28 -0
- package/dist/sitemap.d.ts +5 -0
- package/dist/src/index.js +1 -242
- package/dist/template-loader.d.ts +16 -0
- 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/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/types.d.ts +154 -3
- package/package.json +32 -14
- package/dist/chunk-z2xpw4s7.js +0 -322
- package/dist/plugin.d.ts +0 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{L as H6,g as h,i as P}from"./chunk-nt1zw6bf.js";var{Glob:G6}=globalThis.Bun;import{copyFile as o1,mkdir as U6,readdir as ZZ}from"fs/promises";import{join as d}from"path";import v from"process";import{EventEmitter as b6}from"events";import I0 from"process";import H0 from"process";import e from"process";import d6,{stdin as WZ,stdout as FZ}from"process";import P0,{stdin as m6,stdout as c6}from"process";import l6 from"readline";var{create:B6,getPrototypeOf:O6,defineProperty:w0,getOwnPropertyNames:T6}=Object,R6=Object.prototype.hasOwnProperty,T=(Z,$,Q)=>{Q=Z!=null?B6(O6(Z)):{};let Y=$||!Z||!Z.__esModule?w0(Q,"default",{value:Z,enumerable:!0}):Q;for(let J of T6(Z))if(!R6.call(Y,J))w0(Y,J,{get:()=>Z[J],enumerable:!0});return Y},G0=(Z,$)=>()=>($||Z(($={exports:{}}).exports,$),$.exports),w6=G0((Z,$)=>{function Q(J){return J==null?[]:Array.isArray(J)?J:[J]}function Y(J,X,j,z){var H,G=J[X],K=~z.string.indexOf(X)?j==null||j===!0?"":String(j):typeof j==="boolean"?j:~z.boolean.indexOf(X)?j==="false"?!1:j==="true"||(J._.push((H=+j,H*0===0)?H:j),!!j):(H=+j,H*0===0)?H:j;J[X]=G==null?K:Array.isArray(G)?G.concat(K):[G,K]}$.exports=function(J,X){J=J||[],X=X||{};var j,z,H,G,K,U={_:[]},V=0,q=0,W=0,N=J.length;let E=X.alias!==void 0,M=X.unknown!==void 0,L=X.default!==void 0;if(X.alias=X.alias||{},X.string=Q(X.string),X.boolean=Q(X.boolean),E)for(j in X.alias){z=X.alias[j]=Q(X.alias[j]);for(V=0;V<z.length;V++)(X.alias[z[V]]=z.concat(j)).splice(V,1)}for(V=X.boolean.length;V-- >0;){z=X.alias[X.boolean[V]]||[];for(q=z.length;q-- >0;)X.boolean.push(z[q])}for(V=X.string.length;V-- >0;){z=X.alias[X.string[V]]||[];for(q=z.length;q-- >0;)X.string.push(z[q])}if(L){for(j in X.default)if(G=typeof X.default[j],z=X.alias[j]=X.alias[j]||[],X[G]!==void 0){X[G].push(j);for(V=0;V<z.length;V++)X[G].push(z[V])}}let m=M?Object.keys(X.alias):[];for(V=0;V<N;V++){if(H=J[V],H==="--"){U._=U._.concat(J.slice(++V));break}for(q=0;q<H.length;q++)if(H.charCodeAt(q)!==45)break;if(q===0)U._.push(H);else if(H.substring(q,q+3)==="no-"){if(G=H.substring(q+3),M&&!~m.indexOf(G))return X.unknown(H);U[G]=!1}else{for(W=q+1;W<H.length;W++)if(H.charCodeAt(W)===61)break;G=H.substring(q,W),K=H.substring(++W)||(V+1===N||(""+J[V+1]).charCodeAt(0)===45||J[++V]),z=q===2?[G]:G;for(W=0;W<z.length;W++){if(G=z[W],M&&!~m.indexOf(G))return X.unknown("-".repeat(q)+G);Y(U,G,W+1<z.length||K,X)}}}if(L){for(j in X.default)if(U[j]===void 0)U[j]=X.default[j]}if(E)for(j in U){z=X.alias[j]||[];while(z.length>0)U[z.shift()]=U[j]}return U}}),I=G0((Z,$)=>{var Q=process||{},Y=Q.argv||[],J=Q.env||{},X=!(!!J.NO_COLOR||Y.includes("--no-color"))&&(!!J.FORCE_COLOR||Y.includes("--color")||Q.platform==="win32"||(Q.stdout||{}).isTTY&&J.TERM!=="dumb"||!!J.CI),j=(G,K,U=G)=>(V)=>{let q=""+V,W=q.indexOf(K,G.length);return~W?G+z(q,K,U,W)+K:G+q+K},z=(G,K,U,V)=>{let q="",W=0;do q+=G.substring(W,V)+U,W=V+K.length,V=G.indexOf(K,W);while(~V);return q+G.substring(W)},H=(G=X)=>{let K=G?j:()=>String;return{isColorSupported:G,reset:K("\x1B[0m","\x1B[0m"),bold:K("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:K("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:K("\x1B[3m","\x1B[23m"),underline:K("\x1B[4m","\x1B[24m"),inverse:K("\x1B[7m","\x1B[27m"),hidden:K("\x1B[8m","\x1B[28m"),strikethrough:K("\x1B[9m","\x1B[29m"),black:K("\x1B[30m","\x1B[39m"),red:K("\x1B[31m","\x1B[39m"),green:K("\x1B[32m","\x1B[39m"),yellow:K("\x1B[33m","\x1B[39m"),blue:K("\x1B[34m","\x1B[39m"),magenta:K("\x1B[35m","\x1B[39m"),cyan:K("\x1B[36m","\x1B[39m"),white:K("\x1B[37m","\x1B[39m"),gray:K("\x1B[90m","\x1B[39m"),bgBlack:K("\x1B[40m","\x1B[49m"),bgRed:K("\x1B[41m","\x1B[49m"),bgGreen:K("\x1B[42m","\x1B[49m"),bgYellow:K("\x1B[43m","\x1B[49m"),bgBlue:K("\x1B[44m","\x1B[49m"),bgMagenta:K("\x1B[45m","\x1B[49m"),bgCyan:K("\x1B[46m","\x1B[49m"),bgWhite:K("\x1B[47m","\x1B[49m"),blackBright:K("\x1B[90m","\x1B[39m"),redBright:K("\x1B[91m","\x1B[39m"),greenBright:K("\x1B[92m","\x1B[39m"),yellowBright:K("\x1B[93m","\x1B[39m"),blueBright:K("\x1B[94m","\x1B[39m"),magentaBright:K("\x1B[95m","\x1B[39m"),cyanBright:K("\x1B[96m","\x1B[39m"),whiteBright:K("\x1B[97m","\x1B[39m"),bgBlackBright:K("\x1B[100m","\x1B[49m"),bgRedBright:K("\x1B[101m","\x1B[49m"),bgGreenBright:K("\x1B[102m","\x1B[49m"),bgYellowBright:K("\x1B[103m","\x1B[49m"),bgBlueBright:K("\x1B[104m","\x1B[49m"),bgMagentaBright:K("\x1B[105m","\x1B[49m"),bgCyanBright:K("\x1B[106m","\x1B[49m"),bgWhiteBright:K("\x1B[107m","\x1B[49m")}};$.exports=H(),$.exports.createColors=H}),I6=G0((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}}),A6=T(w6(),1);function _0(Z){return Z.replace(/[<[].+/,"").trim()}function E6(Z){let $=/<([^>]+)>/g,Q=/\[([^\]]+)\]/g,Y=[],J=(z)=>{let H=!1,G=z[1];if(G.startsWith("..."))G=G.slice(3),H=!0;return{required:z[0].startsWith("<"),value:G,variadic:H}},X;while(X=$.exec(Z))Y.push(J(X));let j;while(j=Q.exec(Z))Y.push(J(j));return Y}function P6(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((X,j)=>{return j!==Q&&X.names.some((z)=>Y.names.includes(z))&&typeof X.required==="boolean"}))$.boolean.push(Y.names[0])}else $.boolean.push(Y.names[0])}return $}function A0(Z){return Z.sort(($,Q)=>{return $.length>Q.length?-1:1})[0]}function b0(Z,$){return Z.length>=$?Z:`${Z}${" ".repeat($-Z.length)}`}function k6(Z){return Z.replace(/([a-z])-([a-z])/g,($,Q,Y)=>{return Q+Y.toUpperCase()})}function C6(Z,$,Q){let Y=0,J=$.length,X=Z,j;for(;Y<J;++Y)j=X[$[Y]],X=X[$[Y]]=Y===J-1?Q:j!=null?j:!!~$[Y+1].indexOf(".")||!(+$[Y+1]>-1)?{}:[]}function v6(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 y6(Z){let $=/([^\\/]+)$/.exec(Z);return $?$[1]:""}function f0(Z){return Z.split(".").map(($,Q)=>{return Q===0?k6($):$}).join(".")}class t 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 S6(){let{env:Z}=I0,{TERM:$,TERM_PROGRAM:Q}=Z;if(I0.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 Z0="\x1B",R=`${Z0}[`;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:`${Z0}7`,restore:`${Z0}8`};var j0={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 $}},KZ={screen:`${Z0}c`};class g0{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=_0(Z).split(",").map((Y)=>{let J=Y.trim().replace(/^-{1,2}/,"");if(J.startsWith("no-"))this.negated=!0,J=J.replace(/^no-/,"");return f0(J)}).sort((Y,J)=>Y.length>J.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 HZ=H0.argv,h6=`${H0.platform}-${H0.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,_6=e.argv,f6=`${e.platform}-${e.arch} node-${e.version}`;class U0{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=_0(Z),this.args=E6(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 g0(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 V0}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:J}=this.cli.globalCommand,X=[{body:`${Z}${Q?`/${Q}`:""}`}];if(X.push({title:"Usage",body:` $ ${Z} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&$.length>0){let H=A0($.map((G)=>G.rawName));X.push({title:"Commands",body:$.map((G)=>{return` ${b0(G.rawName,H.length)} ${G.description}`}).join(`
|
|
3
|
+
`)}),X.push({title:"For more info, run any command with the `--help` flag",body:$.map((G)=>` $ ${Z}${G.name===""?"":` ${G.name}`} --help`).join(`
|
|
4
|
+
`)})}let z=this.isGlobalCommand?Y:[...this.options,...Y||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)z=z.filter((H)=>H.name!=="version");if(z.length>0){let H=A0(z.map((G)=>G.rawName));X.push({title:"Options",body:z.map((G)=>{return` ${b0(G.rawName,H.length)} ${G.description} ${G.config.default===void 0?"":`(default: ${G.config.default})`}`}).join(`
|
|
5
|
+
`)})}if(this.examples.length>0)X.push({title:"Examples",body:this.examples.map((H)=>{if(typeof H==="function")return H(Z);return H}).join(`
|
|
6
|
+
`)});if(J)X=J(X)||X;console.log(X.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=h6;else Q=f6;console.log(`${Z}/${$} ${Q}`)}}checkRequiredArgs(){let Z=this.args.filter(($)=>$.required).length;if(this.cli.args.length<Z)throw new t(`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 t(`Unknown option \`${Q.length>1?`--${Q}`:`-${Q}`}\``)}}checkOptionValue(){let{options:Z,globalCommand:$}=this.cli,Q=[...$.options,...this.options];for(let Y of Q){let J=Z[Y.name.split(".")[0]];if(Y.required){let X=Q.some((j)=>j.negated&&j.names.includes(Y.name));if(J===!0||J===!1&&!X)throw new t(`option \`${Y.rawName}\` value is missing`)}}}}class V0 extends U0{constructor(Z){super("@@global@@","",{},Z)}}var g6=U0;class W0 extends b6{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 V0(this),this.globalCommand.usage("<command> [options]")}usage(Z){return this.globalCommand.usage(Z),this}command(Z,$,Q){if(!Q)Q={};let Y=new g6(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=_6,{run:$=!0}={}){if(this.rawArgs=Z,!this.name)this.name=Z[1]?y6(Z[1]):"cli";let Q=!0;for(let J of this.commands){let X=this.mri(Z.slice(2),J),j=X.args[0];if(J.isMatched(j)){Q=!1;let z={...X,args:X.args.slice(1)};this.setParsedInfo(z,J,j),this.emit(`command:${j}`,J)}}if(Q){for(let J of this.commands)if(J.name===""){Q=!1;let X=this.mri(Z.slice(2),J);this.setParsedInfo(X,J),this.emit("command:!",J)}}if(Q){let J=this.mri(Z.slice(2));this.setParsedInfo(J)}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=P6(Q),J=[],X=Z.indexOf("--");if(X>-1)J=Z.slice(X+1),Z=Z.slice(0,X);let j=A6.default(Z,Y);j=Object.keys(j).reduce((U,V)=>{return{...U,[f0(V)]:j[V]}},{_:[]});let z=j._,H={"--":J},G=$&&$.config.ignoreOptionDefaultValue?$.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,K=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(K[U.name]===void 0)K[U.name]=Object.create(null),K[U.name].shouldTransform=!0,K[U.name].transformFunction=U.config.type[0]}}for(let U of Object.keys(j))if(U!=="_"){let V=U.split(".");C6(H,V,j[U]),v6(H,K)}return{args:z,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((J,X)=>{if(J.variadic)Y.push(Z.slice(X));else Y.push(Z[X])}),Y.push($),Q.commandAction.apply(this,Y)}}var UZ=T(I(),1),u6=["up","down","left","right","space","enter","cancel"],o={actions:new Set(u6),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function d0(Z,$){if(typeof Z==="string")return o.aliases.get(Z)===$;for(let Q of Z){if(Q===void 0)continue;if(d0(Q,$))return!0}return!1}function x6(Z,$){if(Z===$)return[];let Q=Z.split(`
|
|
10
|
+
`),Y=$.split(`
|
|
11
|
+
`),J=[];for(let X=0;X<Math.max(Q.length,Y.length);X++)if(Q[X]!==Y[X])J.push(X);return J}var MZ=d6.platform.startsWith("win"),E0=Symbol("clapp:cancel");function s(Z,$){let Q=Z;if(Q.isTTY)Q.setRawMode($)}var z0=T(I(),1);function a6({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 n6=a6();function u0(Z){if(typeof Z!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof Z}\``);return Z.replace(n6,"")}function p6(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 i6(Z){return Z===12288||Z>=65281&&Z<=65376||Z>=65504&&Z<=65510}function r6(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 s6(Z){if(!Number.isSafeInteger(Z))throw TypeError(`Expected a code point, got \`${typeof Z}\`.`)}function t6(Z,{ambiguousAsWide:$=!1}={}){if(s6(Z),i6(Z)||r6(Z)||$&&p6(Z))return 2;return 1}var e6=T(I6(),1),o6=new Intl.Segmenter,Z1=/^\p{Default_Ignorable_Code_Point}$/u;function p(Z,$={}){if(typeof Z!=="string"||Z.length===0)return 0;let{ambiguousIsNarrow:Q=!0,countAnsiEscapeCodes:Y=!1}=$;if(!Y)Z=u0(Z);if(Z.length===0)return 0;let J=0,X={ambiguousAsWide:!Q};for(let{segment:j}of o6.segment(Z)){let z=j.codePointAt(0);if(z<=31||z>=127&&z<=159)continue;if(z>=8203&&z<=8207||z===65279)continue;if(z>=768&&z<=879||z>=6832&&z<=6911||z>=7616&&z<=7679||z>=8400&&z<=8447||z>=65056&&z<=65071)continue;if(z>=55296&&z<=57343)continue;if(z>=65024&&z<=65039)continue;if(Z1.test(j))continue;if(e6.default().test(j)){J+=2;continue}J+=t6(z,X)}return J}var K0=10,k0=(Z=0)=>($)=>`\x1B[${$+Z}m`,C0=(Z=0)=>($)=>`\x1B[${38+Z};5;${$}m`,v0=(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]}},DZ=Object.keys(D.modifier),$1=Object.keys(D.color),Q1=Object.keys(D.bgColor),BZ=[...$1,...Q1];function Y1(){let Z=new Map;for(let[$,Q]of Object.entries(D)){for(let[Y,J]of Object.entries(Q))D[Y]={open:`\x1B[${J[0]}m`,close:`\x1B[${J[1]}m`},Q[Y]=D[Y],Z.set(J[0],J[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=k0(),D.color.ansi256=C0(),D.color.ansi16m=v0(),D.bgColor.ansi=k0(K0),D.bgColor.ansi256=C0(K0),D.bgColor.ansi16m=v0(K0),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((X)=>X+X).join("");let J=Number.parseInt(Y,16);return[J>>16&255,J>>8&255,J&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,J;if($>=232)Q=(($-232)*10+8)/255,Y=Q,J=Q;else{$-=16;let z=$%36;Q=Math.floor($/36)/5,Y=Math.floor(z/6)/5,J=z%6/5}let X=Math.max(Q,Y,J)*2;if(X===0)return 30;let j=30+(Math.round(J)<<2|Math.round(Y)<<1|Math.round(Q));if(X===2)j+=60;return j},enumerable:!1},rgbToAnsi:{value:($,Q,Y)=>D.ansi256ToAnsi(D.rgbToAnsi256($,Q,Y)),enumerable:!1},hexToAnsi:{value:($)=>D.ansi256ToAnsi(D.hexToAnsi256($)),enumerable:!1}}),D}var X1=Y1(),J1=X1,Q0=new Set(["\x1B","\x9B"]),j1=39,F0="\x07",x0="[",z1="]",m0="m",$0=`${z1}8;;`,y0=(Z)=>`${Q0.values().next().value}${x0}${Z}${m0}`,S0=(Z)=>`${Q0.values().next().value}${$0}${Z}${F0}`,K1=(Z)=>Z.split(" ").map(($)=>p($)),q0=(Z,$,Q)=>{let Y=[...$],J=!1,X=!1,j=p(u0(Z.at(-1)));for(let[z,H]of Y.entries()){let G=p(H);if(j+G<=Q)Z[Z.length-1]+=H;else Z.push(H),j=0;if(Q0.has(H))J=!0,X=Y.slice(z+1,z+1+$0.length).join("")===$0;if(J){if(X){if(H===F0)J=!1,X=!1}else if(H===m0)J=!1;continue}if(j+=G,j===Q&&z<Y.length-1)Z.push(""),j=0}if(!j&&Z.at(-1).length>0&&Z.length>1)Z[Z.length-2]+=Z.pop()},q1=(Z)=>{let $=Z.split(" "),Q=$.length;while(Q>0){if(p($[Q-1])>0)break;Q--}if(Q===$.length)return Z;return $.slice(0,Q).join(" ")+$.slice(Q).join("")},H1=(Z,$,Q={})=>{if(Q.trim!==!1&&Z.trim()==="")return"";let Y="",J,X,j=K1(Z),z=[""];for(let[U,V]of Z.split(" ").entries()){if(Q.trim!==!1)z[z.length-1]=z.at(-1).trimStart();let q=p(z.at(-1));if(U!==0){if(q>=$&&(Q.wordWrap===!1||Q.trim===!1))z.push(""),q=0;if(q>0||Q.trim===!1)z[z.length-1]+=" ",q++}if(Q.hard&&j[U]>$){let W=$-q,N=1+Math.floor((j[U]-W-1)/$);if(Math.floor((j[U]-1)/$)<N)z.push("");q0(z,V,$);continue}if(q+j[U]>$&&q>0&&j[U]>0){if(Q.wordWrap===!1&&q<$){q0(z,V,$);continue}z.push("")}if(q+j[U]>$&&Q.wordWrap===!1){q0(z,V,$);continue}z[z.length-1]+=V}if(Q.trim!==!1)z=z.map((U)=>q1(U));let H=z.join(`
|
|
12
|
+
`),G=[...H],K=0;for(let[U,V]of G.entries()){if(Y+=V,Q0.has(V)){let{groups:W}=new RegExp(`(?:\\${x0}(?<code>\\d+)m|\\${$0}(?<uri>.*)${F0})`).exec(H.slice(K))||{groups:{}};if(W.code!==void 0){let N=Number.parseFloat(W.code);J=N===j1?void 0:N}else if(W.uri!==void 0)X=W.uri.length===0?void 0:W.uri}let q=J1.codes.get(Number(J));if(G[U+1]===`
|
|
13
|
+
`){if(X)Y+=S0("");if(J&&q)Y+=y0(q)}else if(V===`
|
|
14
|
+
`){if(J&&q)Y+=y0(J);if(X)Y+=S0(X)}K+=V.length}return Y};function h0(Z,$,Q){return String(Z).normalize().replaceAll(`\r
|
|
15
|
+
`,`
|
|
16
|
+
`).split(`
|
|
17
|
+
`).map((Y)=>H1(Y,$,Q)).join(`
|
|
18
|
+
`)}class M0{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=m6,output:Y=c6,render:J,signal:X,...j}=Z;this.opts=j,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=J.bind(this),this._track=$,this._abortSignal=X,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 J of Q)if(J.cb(...$),J.once)Y.push(()=>Q.splice(Q.indexOf(J),1));for(let J of Y)J();return this}prompt(){return new Promise((Z)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),Z(E0);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=l6.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),s(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),s(this.input,!1),Z(this.value)}),this.once("cancel",()=>{this.output.write(S.show),this.output.off("resize",this.render),s(this.input,!1),Z(E0)})})}_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&&o.aliases.has($.name))this.emit("cursor",o.aliases.get($.name));if(o.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(d0([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
|
+
`),s(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=h0(this._prevFrame,P0.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
20
|
+
`).length-1;this.output.write(S.move(-999,Z*-1))}render(){let Z=h0(this._render(this)??"",P0.stdout.columns,{hard:!0,trim:!1});if(Z===this._prevFrame)return;if(this.state==="initial")this.output.write(S.hide);else{let $=x6(this._prevFrame,Z);if(this.restoreCursor(),$&&$?.length===1){let Q=$[0];this.output.write(S.move(0,Q)),this.output.write(j0.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(j0.down());let J=Z.split(`
|
|
22
|
+
`).slice(Q);this.output.write(J.join(`
|
|
23
|
+
`)),this._prevFrame=Z;return}this.output.write(j0.down())}if(this.output.write(Z),this.state==="initial")this.state="active";this._prevFrame=Z}}function G1(Z,$){if(Z===void 0)return 0;if($.length===0)return 0;let Y=$.findIndex((J)=>J.value===Z);return Y!==-1?Y:0}function U1(Z,$){return($.label??String($.value)).toLowerCase().includes(Z.toLowerCase())}function V1(Z,$){if(!$)return;if(Z)return $;return $[0]}class W1 extends M0{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#Z=0;#Q="";#Y;#$;get cursor(){return this.#Z}get userInputWithCursor(){if(!this.userInput)return z0.default.inverse(z0.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}${z0.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??U1;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 J=$.findIndex((X)=>X.value===Y);if(J!==-1)this.toggleSelected(Y),this.#Z=J}this.focusedValue=this.options[this.#Z]?.value,this.on("key",(Y,J)=>this.#X(Y,J)),this.on("userInput",(Y)=>this.#J(Y))}_isActionKey(Z,$){return Z==="\t"||this.multiple&&this.isNavigating&&$.name==="space"&&Z!==void 0&&Z!==""}#X(Z,$){let Q=$.name==="up",Y=$.name==="down",J=$.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(J)this.value=V1(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]}#J(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=G1(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 F1 extends M0{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((J)=>J.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((J)=>({...J,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 OZ=T(I(),1);var TZ=T(I(),1);var RZ=T(I(),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"]},n={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function M1(){return!0}function L1(){let Z={};Z.supportsColor=M1();function $(Y,J=[]){let X=Y===""?[]:[...J,Y],j=function(H){if(!Z.supportsColor)return H;let G="",K="";for(let U of X)if(U in n&&n[U]in _){let V=n[U];G+=_[V][0],K=_[V][1]+K}else if(U in _)G+=_[U][0],K=_[U][1]+K;return G+H+K},z=[...Object.keys(_),...Object.keys(n)];for(let H of z)if(!(H in j))Object.defineProperty(j,H,{get(){return $(H,X)}});return j}let Q=[...Object.keys(_),...Object.keys(n)];for(let Y of Q)if(!(Y in Z))Object.defineProperty(Z,Y,{get(){return $(Y)}});return Z}var wZ=L1();var N1=S6();var B=(Z,$)=>N1?Z:$,IZ=B("\u25C6","*"),AZ=B("\u25A0","x"),bZ=B("\u25B2","x"),EZ=B("\u25C7","o"),PZ=B("\u250C","T"),D1=B("\u2502","|"),kZ=B("\u2514","\u2014"),CZ=B("\u25CF",">"),vZ=B("\u25CB"," "),yZ=B("\u25FB","[\u2022]"),SZ=B("\u25FC","[+]"),hZ=B("\u25FB","[ ]"),_Z=B("\u25AA","\u2022"),fZ=B("\u2500","-"),gZ=B("\u256E","+"),dZ=B("\u251C","+"),uZ=B("\u256F","+"),xZ=B("\u25CF","\u2022"),mZ=B("\u25C6","*"),cZ=B("\u25B2","!"),lZ=B("\u25A0","x");var aZ=T(I(),1);var nZ=T(I(),1);var pZ=T(I(),1);var iZ=T(I(),1);var rZ=T(I(),1);var sZ=T(I(),1);var tZ=T(I(),1);var eZ=T(I(),1);var oZ=T(I(),1),Z$=T(I(),1);var $$={light:B("\u2500","-"),heavy:B("\u2501","="),block:B("\u2588","#")};var Q$=T(I(),1);var Y$=T(I(),1);var B1=T(I(),1);function O1(){return`${B1.default.gray(D1)} `}var X$=O1();var J$=T(I(),1);var j$=T(I(),1);var c0="0.1.1";import*as l0 from"fs";import*as a0 from"path";async function n0(Z,$){let Q=$.robots;if(Q?.enabled===!1)return;let Y=Q?.filename||"robots.txt",J=R1($),X=a0.join(Z,Y);if(await l0.promises.writeFile(X,J,"utf-8"),$.verbose)console.error(`\u2705 Robots.txt generated: ${X}`)}function R1(Z){let $=Z.robots,Q=[];if($?.rules&&$.rules.length>0)for(let Y of $.rules)Q.push(...w1(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",J=`${Z.sitemap.baseUrl.replace(/\/$/,"")}/${Y}`;Q.push(`Sitemap: ${J}`),Q.push("")}if($?.customContent)Q.push($.customContent),Q.push("");return`${Q.join(`
|
|
24
|
+
`).trim()}
|
|
25
|
+
`}function w1(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 $}import*as c from"fs";import*as u from"path";async function p0(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 J=Y.baseUrl.replace(/\/$/,""),X=Y.filename||"sitemap.xml",j=Y.defaultPriority??0.5,z=Y.defaultChangefreq||"monthly",H=Y.maxUrlsPerFile||50000,G=Y.useSitemapIndex||!1,K=await I1(Z,J,j,z,Y.exclude||[],Y.priorityMap||{},Y.changefreqMap||{}),U=Y.transform?K.map((V)=>Y.transform(V)).filter(Boolean):K;if(Q.verbose)console.error(`\uD83D\uDCC4 Generated ${U.length} sitemap entries`);if(G&&U.length>H)await E1(U,$,J,X,H);else{let V=i0(U),q=u.join($,X);if(await c.promises.writeFile(q,V,"utf-8"),Q.verbose)console.error(`\u2705 Sitemap generated: ${q}`)}}async function I1(Z,$,Q,Y,J,X,j){let z=[],H=await A1(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(b1(U,J))continue;let q=(await c.promises.stat(G)).mtime.toISOString(),W=Q;for(let[E,M]of Object.entries(X))if(L0(U,E)){W=M;break}let N=Y;for(let[E,M]of Object.entries(j))if(L0(U,E)){N=M;break}z.push({url:U,lastmod:q,changefreq:N,priority:W})}return z}async function A1(Z){let $=[];async function Q(Y){let J=await c.promises.readdir(Y,{withFileTypes:!0});for(let X of J){let j=u.join(Y,X.name);if(X.isDirectory()){if(!X.name.startsWith(".")&&X.name!=="node_modules")await Q(j)}else if(X.isFile()&&X.name.endsWith(".md"))$.push(j)}}return await Q(Z),$}function b1(Z,$){for(let Q of $)if(L0(Z,Q))return!0;return!1}function L0(Z,$){let Q=$.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".");return new RegExp(`^${Q}$`).test(Z)}function i0(Z){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
26
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
27
|
+
${Z.map((Q)=>{let Y=Q.url,J=Q.lastmod?`
|
|
28
|
+
<lastmod>${r0(Q.lastmod)}</lastmod>`:"",X=Q.changefreq?`
|
|
29
|
+
<changefreq>${Q.changefreq}</changefreq>`:"",j=Q.priority!==void 0?`
|
|
30
|
+
<priority>${Q.priority.toFixed(1)}</priority>`:"";return` <url>
|
|
31
|
+
<loc>${Y}</loc>${J}${X}${j}
|
|
32
|
+
</url>`}).join(`
|
|
33
|
+
`)}
|
|
34
|
+
</urlset>`}async function E1(Z,$,Q,Y,J){let X=P1(Z,J),j=[];for(let K=0;K<X.length;K++){let U=`sitemap-${K+1}.xml`,V=i0(X[K]),q=u.join($,U);await c.promises.writeFile(q,V,"utf-8"),j.push(U)}let H=`<?xml version="1.0" encoding="UTF-8"?>
|
|
35
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
36
|
+
${j.map((K)=>{let U=`${Q}/${K}`,V=new Date().toISOString();return` <sitemap>
|
|
37
|
+
<loc>${U}</loc>
|
|
38
|
+
<lastmod>${r0(V)}</lastmod>
|
|
39
|
+
</sitemap>`}).join(`
|
|
40
|
+
`)}
|
|
41
|
+
</sitemapindex>`,G=u.join($,Y);await c.promises.writeFile(G,H,"utf-8")}function r0(Z){return(typeof Z==="string"?new Date(Z):Z).toISOString().split("T")[0]}function P1(Z,$){let Q=[];for(let Y=0;Y<Z.length;Y+=$)Q.push(Z.slice(Y,Y+$));return Q}import{existsSync as k1}from"fs";import{rm as C1}from"fs/promises";import{join as v1}from"path";var C={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 b(Z,$){return`${C[$]}${Z}${C.reset}`}function A(Z){console.log(`${C.green}\u2713${C.reset} ${Z}`)}function F(Z){console.error(`${C.red}\u2717${C.reset} ${Z}`)}function Y0(Z){console.warn(`${C.yellow}\u26A0${C.reset} ${Z}`)}function w(Z){console.log(`${C.blue}\u2139${C.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 N0(Z){if(Z<1000)return`${Z}ms`;if(Z<60000)return`${(Z/1000).toFixed(2)}s`;return`${(Z/60000).toFixed(2)}m`}class x{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(Z){this.text=Z}start(){process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let Z=this.frames[this.index];process.stdout.write(`\r${C.cyan}${Z}${C.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(Z){this.stop(),A(Z||this.text)}fail(Z){this.stop(),F(Z||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(Z){this.text=Z}}async function X0(Z,$=!1){let Q=$?"Y/n":"y/N";process.stdout.write(`${C.cyan}?${C.reset} ${Z} ${C.dim}(${Q})${C.reset}: `);let Y=Bun.file("/dev/stdin").stream().getReader(),J=new TextDecoder,{value:X}=await Y.read(),j=J.decode(X).trim().toLowerCase();if(!j)return $;return j==="y"||j==="yes"}function i(Z){if(Z.length===0)return;let $=Object.keys(Z[0]),Q={};for(let J of $)Q[J]=Math.max(J.length,...Z.map((X)=>String(X[J]).length));let Y=$.map((J)=>J.padEnd(Q[J])).join(" ");console.log(b(Y,"bold")),console.log("\u2500".repeat(Y.length));for(let J of Z){let X=$.map((j)=>String(J[j]).padEnd(Q[j])).join(" ");console.log(X)}}async function J0(Z){try{return Bun.file(Z).size}catch{return 0}}async function y1(Z){try{let{Glob:$}=awaitPromise.resolve(globalThis.Bun),Q=new $("**/*"),Y=0;for await(let J of Q.scan(Z)){let X=`${Z}/${J}`,j=await J0(X);Y+=j}return Y}catch{return 0}}async function s0(Z={}){let $=await P,Q=Z.outdir||$.outDir||"./dist",Y=v1(Q,".bunpress"),J=Z.force||!1,X=Z.verbose||!1;try{if(!k1(Y))return w(`Directory "${Y}" does not exist, nothing to clean`),!0;let z=await y1(Y);if(X)w(`Found "${Y}" (${y(z)})`);if(!J){if(!await X0(`Delete "${Y}" directory? (${y(z)})`,!1))return w("Clean cancelled"),!1}let H=process.env.VITEST==="true"||!1,G=null;if(!H&&!X)G=new x("Cleaning build artifacts..."),G.start();if(await C1(Y,{recursive:!0,force:!0}),G)G.succeed(`Cleaned ${y(z)} from "${Y}"`);else if(X||H)A(`Cleaned ${y(z)} from "${Y}"`);return!0}catch(j){return F(`Failed to clean directory: ${j}`),!1}}import{existsSync as D0}from"fs";import{join as B0}from"path";async function t0(Z={}){try{let $=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let J of $){let X=B0(process.cwd(),J);if(D0(X)){Q=X;break}}if(!Q)return F("No configuration file found"),w('Run "bunpress config init" to create one'),!1;A(`Configuration file: ${Q}`),console.log();let Y=await Bun.file(Q).text();return console.log(b("Configuration:","bold")),console.log(Y),!0}catch($){return F(`Failed to show configuration: ${$}`),!1}}async function e0(Z={}){let $=Z.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],Y=null;for(let z of Q){let H=B0(process.cwd(),z);if(D0(H)){Y=H;break}}if(!Y)return F("No configuration file found"),!1;if($)w(`Validating ${Y}...`);let X=(await import(Y)).default;if(!X)return F("Configuration file does not export a default object"),!1;let j=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")j.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")j.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))j.push("nav should be an array");else for(let[z,H]of X.nav.entries())if(!H.text||!H.link)j.push(`nav[${z}] is missing required fields (text, link)`)}if(X.sitemap){if(!X.sitemap.hostname)j.push("sitemap.hostname is required for SEO")}if(j.length>0){F("Configuration validation failed:");for(let z of j)console.log(` \u2022 ${z}`);return!1}return A("Configuration is valid \u2713"),!0}catch(Q){return F(`Failed to validate configuration: ${Q}`),!1}}async function o0(Z={}){let $=B0(process.cwd(),"bunpress.config.ts");if(D0($))return F("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
verbose: false,
|
|
45
|
+
|
|
46
|
+
markdown: {
|
|
47
|
+
toc: {
|
|
48
|
+
enabled: true,
|
|
49
|
+
position: 'sidebar',
|
|
50
|
+
minDepth: 2,
|
|
51
|
+
maxDepth: 3,
|
|
52
|
+
},
|
|
53
|
+
features: {
|
|
54
|
+
inlineFormatting: true,
|
|
55
|
+
containers: true,
|
|
56
|
+
githubAlerts: true,
|
|
57
|
+
codeBlocks: {
|
|
58
|
+
lineNumbers: true,
|
|
59
|
+
lineHighlighting: true,
|
|
60
|
+
focus: true,
|
|
61
|
+
diff: true,
|
|
62
|
+
errorWarning: true,
|
|
63
|
+
},
|
|
64
|
+
codeGroups: true,
|
|
65
|
+
codeImports: true,
|
|
66
|
+
inlineToc: true,
|
|
67
|
+
customAnchors: true,
|
|
68
|
+
emoji: true,
|
|
69
|
+
badges: true,
|
|
70
|
+
includes: true,
|
|
71
|
+
externalLinks: {
|
|
72
|
+
enabled: true,
|
|
73
|
+
openInNewTab: true,
|
|
74
|
+
addIcon: true,
|
|
75
|
+
},
|
|
76
|
+
imageLazyLoading: true,
|
|
77
|
+
tables: {
|
|
78
|
+
responsive: true,
|
|
79
|
+
striped: true,
|
|
80
|
+
hover: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
nav: [
|
|
86
|
+
{ text: 'Home', link: '/' },
|
|
87
|
+
{ text: 'Guide', link: '/guide/' },
|
|
88
|
+
],
|
|
89
|
+
|
|
90
|
+
sitemap: {
|
|
91
|
+
hostname: 'https://example.com',
|
|
92
|
+
},
|
|
93
|
+
} satisfies BunPressConfig
|
|
94
|
+
`;try{return await Bun.write($,Q),A(`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 Z6(Z={}){let $=Z.verbose||!1,Q=[];console.log(b(`
|
|
95
|
+
Running diagnostics...
|
|
96
|
+
`,"bold"));try{let q=Bun.version;Q.push({name:"Bun Runtime",status:"pass",message:`v${q}`})}catch(q){Q.push({name:"Bun Runtime",status:"fail",message:"Not found"})}let Y=["bunpress.config.ts","bunpress.config.js"],J=!1;for(let q of Y)if(l(a(process.cwd(),q))){J=!0,Q.push({name:"Configuration",status:"pass",message:q});break}if(!J)Q.push({name:"Configuration",status:"warn",message:"No config file found (using defaults)"});let X=a(process.cwd(),"docs");if(l(X)){let{Glob:q}=awaitPromise.resolve(globalThis.Bun),W=new q("**/*.md"),N=0;for await(let E of W.scan(X))N++;Q.push({name:"Documentation",status:N>0?"pass":"warn",message:`${N} markdown files`})}else Q.push({name:"Documentation",status:"fail",message:"docs/ directory not found"});let j=a(process.cwd(),"package.json");if(l(j)){let q=await Bun.file(j).json(),W=q.scripts?.dev,N=q.scripts?.build;Q.push({name:"Package Scripts",status:W&&N?"pass":"warn",message:`dev: ${W?"\u2713":"\u2717"}, build: ${N?"\u2713":"\u2717"}`});let E=q.dependencies?.["@stacksjs/bunpress"]||q.devDependencies?.["@stacksjs/bunpress"];Q.push({name:"BunPress Package",status:E?"pass":"warn",message:E||"Not installed"})}else Q.push({name:"Package.json",status:"warn",message:"Not found"});let z=a(process.cwd(),"node_modules");if(l(z))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 q of Q){let W=q.status==="pass"?"\u2713":q.status==="fail"?"\u2717":"\u26A0",N=q.status==="pass"?"green":q.status==="fail"?"red":"yellow";console.log(` ${b(W,N)} ${q.name}: ${b(q.message,"dim")}`)}console.log();let K=Q.filter((q)=>q.status==="pass").length,U=Q.filter((q)=>q.status==="fail").length,V=Q.filter((q)=>q.status==="warn").length;if(U>0){if(F(`${U} checks failed, ${V} warnings`),console.log(),w("Recommended actions:"),Q.find((q)=>q.name==="Documentation"&&q.status==="fail"))console.log(' \u2022 Run "bunpress init" to create docs directory');if(Q.find((q)=>q.name==="Dependencies"&&q.status==="warn"))console.log(' \u2022 Run "bun install" to install dependencies');if(Q.find((q)=>q.name==="BunPress Package"&&q.status==="warn"))console.log(' \u2022 Run "bun add @stacksjs/bunpress" to install BunPress');return!1}else if(V>0)return Y0(`${K} checks passed, ${V} warnings`),!0;else return A(`All ${K} checks passed!`),!0}import{mkdir as O0}from"fs/promises";var S1=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
|
+
verbose: false,
|
|
100
|
+
|
|
101
|
+
markdown: {
|
|
102
|
+
toc: {
|
|
103
|
+
enabled: true,
|
|
104
|
+
position: 'sidebar',
|
|
105
|
+
minDepth: 2,
|
|
106
|
+
maxDepth: 3,
|
|
107
|
+
},
|
|
108
|
+
features: {
|
|
109
|
+
inlineFormatting: true,
|
|
110
|
+
containers: true,
|
|
111
|
+
githubAlerts: true,
|
|
112
|
+
codeBlocks: {
|
|
113
|
+
lineNumbers: true,
|
|
114
|
+
lineHighlighting: true,
|
|
115
|
+
focus: true,
|
|
116
|
+
diff: true,
|
|
117
|
+
errorWarning: true,
|
|
118
|
+
},
|
|
119
|
+
codeGroups: true,
|
|
120
|
+
codeImports: true,
|
|
121
|
+
inlineToc: true,
|
|
122
|
+
customAnchors: true,
|
|
123
|
+
emoji: true,
|
|
124
|
+
badges: true,
|
|
125
|
+
includes: true,
|
|
126
|
+
externalLinks: {
|
|
127
|
+
enabled: true,
|
|
128
|
+
openInNewTab: true,
|
|
129
|
+
addIcon: true,
|
|
130
|
+
},
|
|
131
|
+
imageLazyLoading: true,
|
|
132
|
+
tables: {
|
|
133
|
+
responsive: true,
|
|
134
|
+
striped: true,
|
|
135
|
+
hover: true,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
nav: [
|
|
141
|
+
{ text: 'Home', link: '/' },
|
|
142
|
+
{ text: 'Guide', link: '/guide/' },
|
|
143
|
+
{ text: 'GitHub', link: 'https://github.com/stacksjs/bunpress' },
|
|
144
|
+
],
|
|
145
|
+
|
|
146
|
+
sitemap: {
|
|
147
|
+
hostname: 'https://example.com',
|
|
148
|
+
},
|
|
149
|
+
} satisfies BunPressConfig
|
|
150
|
+
`,h1=`---
|
|
151
|
+
layout: home
|
|
152
|
+
title: Welcome to My Documentation
|
|
153
|
+
|
|
154
|
+
hero:
|
|
155
|
+
name: My Project
|
|
156
|
+
text: Modern documentation made easy
|
|
157
|
+
tagline: Fast, flexible, and beautiful documentation powered by BunPress
|
|
158
|
+
actions:
|
|
159
|
+
- theme: brand
|
|
160
|
+
text: Get Started
|
|
161
|
+
link: /guide/
|
|
162
|
+
- theme: alt
|
|
163
|
+
text: View on GitHub
|
|
164
|
+
link: https://github.com/yourusername/your-repo
|
|
165
|
+
|
|
166
|
+
features:
|
|
167
|
+
- icon: \u26A1
|
|
168
|
+
title: Lightning Fast
|
|
169
|
+
details: Powered by Bun runtime for incredible build and dev server performance
|
|
170
|
+
- icon: \uD83C\uDFA8
|
|
171
|
+
title: Beautiful by Default
|
|
172
|
+
details: Clean, modern design with dark mode support out of the box
|
|
173
|
+
- icon: \uD83D\uDCDD
|
|
174
|
+
title: Markdown Enhanced
|
|
175
|
+
details: Extended markdown features including containers, code groups, and more
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
# Welcome
|
|
179
|
+
|
|
180
|
+
This is your new BunPress documentation site. Start editing files in the \`docs/\` directory to customize your content.
|
|
181
|
+
`,_1=`# Getting Started
|
|
182
|
+
|
|
183
|
+
Welcome to the getting started guide!
|
|
184
|
+
|
|
185
|
+
## Installation
|
|
186
|
+
|
|
187
|
+
\`\`\`bash
|
|
188
|
+
bun install @stacksjs/bunpress
|
|
189
|
+
\`\`\`
|
|
190
|
+
|
|
191
|
+
## Quick Start
|
|
192
|
+
|
|
193
|
+
Create your first documentation page:
|
|
194
|
+
|
|
195
|
+
\`\`\`bash
|
|
196
|
+
bunpress new my-page
|
|
197
|
+
\`\`\`
|
|
198
|
+
|
|
199
|
+
## Next Steps
|
|
200
|
+
|
|
201
|
+
::: tip
|
|
202
|
+
Check out the [markdown extensions](/guide/markdown) to learn about all the powerful features available.
|
|
203
|
+
:::
|
|
204
|
+
|
|
205
|
+
- Learn about [configuration](/guide/configuration)
|
|
206
|
+
- Explore [advanced features](/guide/advanced)
|
|
207
|
+
- Read the [API reference](/api/)
|
|
208
|
+
`,f1=`node_modules/
|
|
209
|
+
dist/
|
|
210
|
+
.DS_Store
|
|
211
|
+
*.log
|
|
212
|
+
.env
|
|
213
|
+
.env.*
|
|
214
|
+
!.env.example
|
|
215
|
+
`,g1=`# My BunPress Documentation
|
|
216
|
+
|
|
217
|
+
Documentation powered by [BunPress](https://github.com/stacksjs/bunpress).
|
|
218
|
+
|
|
219
|
+
## Development
|
|
220
|
+
|
|
221
|
+
Start the dev server:
|
|
222
|
+
|
|
223
|
+
\`\`\`bash
|
|
224
|
+
bun run dev
|
|
225
|
+
\`\`\`
|
|
226
|
+
|
|
227
|
+
## Build
|
|
228
|
+
|
|
229
|
+
Build the documentation:
|
|
230
|
+
|
|
231
|
+
\`\`\`bash
|
|
232
|
+
bun run build
|
|
233
|
+
\`\`\`
|
|
234
|
+
|
|
235
|
+
## Preview
|
|
236
|
+
|
|
237
|
+
Preview the built site:
|
|
238
|
+
|
|
239
|
+
\`\`\`bash
|
|
240
|
+
bun run preview
|
|
241
|
+
\`\`\`
|
|
242
|
+
`;async function $6(Z={}){try{if(await Bun.file("./docs").exists()&&!Z.force){if(!await X0("Documentation directory already exists. Continue?",!1))return w("Initialization cancelled"),!1}let Q=new x("Initializing BunPress project...");Q.start(),await O0("./docs",{recursive:!0}),await O0("./docs/guide",{recursive:!0}),await O0("./docs/public",{recursive:!0}),await Bun.write("./bunpress.config.ts",S1),await Bun.write("./docs/index.md",h1),await Bun.write("./docs/guide/index.md",_1);let Y=await Bun.file("./.gitignore").exists();if(!Y)await Bun.write("./.gitignore",f1);let J=await Bun.file("./README.md").exists();if(!J)await Bun.write("./README.md",g1);let X="./package.json";if(await Bun.file(X).exists()){let z=await Bun.file(X).json();z.scripts=z.scripts||{},z.scripts.dev=z.scripts.dev||"bunpress dev",z.scripts.build=z.scripts.build||"bunpress build",z.scripts.preview=z.scripts.preview||"bunpress preview",await Bun.write(X,JSON.stringify(z,null,2))}if(Q.succeed("BunPress project initialized successfully!"),console.log(),A("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(!J)console.log(" \u2022 README.md");return console.log(),w("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 d1}from"fs/promises";import{dirname as u1,join as x1}from"path";var Q6={default:(Z)=>`---
|
|
243
|
+
title: ${Z}
|
|
244
|
+
description:
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
# ${Z}
|
|
248
|
+
|
|
249
|
+
Your content goes here...
|
|
250
|
+
`,guide:(Z)=>`---
|
|
251
|
+
title: ${Z}
|
|
252
|
+
description: ${Z} guide
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
# ${Z}
|
|
256
|
+
|
|
257
|
+
## Introduction
|
|
258
|
+
|
|
259
|
+
Brief introduction to the topic.
|
|
260
|
+
|
|
261
|
+
## Getting Started
|
|
262
|
+
|
|
263
|
+
Step-by-step instructions.
|
|
264
|
+
|
|
265
|
+
## Examples
|
|
266
|
+
|
|
267
|
+
\`\`\`typescript
|
|
268
|
+
// Example code
|
|
269
|
+
\`\`\`
|
|
270
|
+
|
|
271
|
+
## Next Steps
|
|
272
|
+
|
|
273
|
+
- [ ] Task 1
|
|
274
|
+
- [ ] Task 2
|
|
275
|
+
`,api:(Z)=>`---
|
|
276
|
+
title: ${Z}
|
|
277
|
+
description: API reference for ${Z}
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
# ${Z}
|
|
281
|
+
|
|
282
|
+
## Overview
|
|
283
|
+
|
|
284
|
+
Brief overview of the API.
|
|
285
|
+
|
|
286
|
+
## Methods
|
|
287
|
+
|
|
288
|
+
### \`methodName()\`
|
|
289
|
+
|
|
290
|
+
Description of the method.
|
|
291
|
+
|
|
292
|
+
**Parameters:**
|
|
293
|
+
|
|
294
|
+
- \`param1\` (\`type\`) - Description
|
|
295
|
+
|
|
296
|
+
**Returns:**
|
|
297
|
+
|
|
298
|
+
- \`ReturnType\` - Description
|
|
299
|
+
|
|
300
|
+
**Example:**
|
|
301
|
+
|
|
302
|
+
\`\`\`typescript
|
|
303
|
+
// Example usage
|
|
304
|
+
\`\`\`
|
|
305
|
+
`,blog:(Z)=>`---
|
|
306
|
+
title: ${Z}
|
|
307
|
+
description:
|
|
308
|
+
date: ${new Date().toISOString().split("T")[0]}
|
|
309
|
+
author:
|
|
310
|
+
tags: []
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
# ${Z}
|
|
314
|
+
|
|
315
|
+
Post content goes here...
|
|
316
|
+
|
|
317
|
+
## Section 1
|
|
318
|
+
|
|
319
|
+
Content...
|
|
320
|
+
`};async function Y6(Z,$={}){try{let Q=Z.endsWith(".md")?Z:`${Z}.md`,Y=x1(process.cwd(),"docs",Q);if(await Bun.file(Y).exists())return F(`File already exists: ${Q}`),!1;let X=$.title;if(!X)X=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(" ");let j=$.template||"default",z=Q6[j];if(!z)return F(`Unknown template: ${j}`),F(`Available templates: ${Object.keys(Q6).join(", ")}`),!1;let H=z(X),G=u1(Y);return await d1(G,{recursive:!0}),await Bun.write(Y,H),A(`Created ${Q}`),console.log(),console.log(` Title: ${X}`),console.log(` Template: ${j}`),console.log(` Path: ${Y}`),!0}catch(Q){return F(`Failed to create file: ${Q}`),!1}}import{join as X6}from"path";async function J6(Z={}){let $=Z.port||3000,Q=await P,Y=Z.outdir||Q.outDir||"./dist",J=X6(Y,".bunpress"),X=Z.verbose||!1;try{let{stat:j}=await import("fs/promises");try{if(!(await j(J)).isDirectory())F(`"${J}" is not a directory.`),F('Run "bunpress build" first to generate the documentation.'),process.exit(1)}catch{F(`Build directory "${J}" not found.`),F('Run "bunpress build" first to generate the documentation.'),process.exit(1)}w(`Starting preview server from ${J}`);try{let z=Bun.serve({port:$,fetch:async(H)=>{let K=new URL(H.url).pathname;if(K.startsWith("/"))K=K.slice(1);if(K===""||K==="/")K="index.html";let U=X6(J,K),V=Bun.file(U);if(await V.exists())return new Response(V,{headers:{"Content-Type":m1(K)}});let W=`${U}.html`,N=Bun.file(W);if(await N.exists())return new Response(N,{headers:{"Content-Type":"text/html"}});return new Response("404 - Not Found",{status:404})}});A(`Preview server running at http://localhost:${$}`),console.log(`Press Ctrl+C to stop
|
|
321
|
+
`),await new Promise(()=>{})}catch(z){if(z.message?.includes("EADDRINUSE")||z.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: ${z.message||z}`);process.exit(1)}}catch(j){F(`Failed to start preview server: ${j}`),process.exit(1)}}function m1(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:j6}=globalThis.Bun;async function z6(Z={}){let $=await P,Q=Z.dir||$.docsDir||"./docs",Y=Z.fix||!1;if(w("\uD83D\uDD0D Running SEO checks..."),console.log(""),!f.existsSync(Q))F(`Documentation directory not found: ${Q}`),process.exit(1);let J={totalPages:0,errors:[],warnings:[],passed:0},X=await l1(Q);J.totalPages=X.length;for(let j of X)await c1(j,Q,J,Y);if(s1(J),J.errors.length>0)process.exit(1)}async function c1(Z,$,Q,Y){let J=await f.promises.readFile(Z,"utf-8"),{frontmatter:X,markdown:j}=a1(J),z=g.relative($,Z),H=!1,G=!1,K={...X};if(!X.title){let q=n1(j);if(!q)Q.errors.push({type:"error",category:"Title",file:z,message:"Missing title in frontmatter"}),H=!0;else if(Y)K.title=q,G=!0,w(`\u2713 Added title to ${z}: "${q}"`);else Q.warnings.push({type:"warning",category:"Title",file:z,message:`No title in frontmatter (could extract: "${q}")`}),H=!0}else{let q=X.title.length;if(q>60)Q.warnings.push({type:"warning",category:"Title",file:z,message:`Title too long (${q} chars, recommended <60)`}),H=!0;else if(q<10)Q.warnings.push({type:"warning",category:"Title",file:z,message:`Title too short (${q} chars, recommended >10)`}),H=!0}if(!X.description){let q=p1(j);if(Y)K.description=q,G=!0,w(`\u2713 Added description to ${z}`);else Q.warnings.push({type:"warning",category:"Description",file:z,message:"Missing description in frontmatter"}),H=!0}else{let q=X.description.length;if(q>160)Q.warnings.push({type:"warning",category:"Description",file:z,message:`Description too long (${q} chars, recommended <160)`}),H=!0;else if(q<50)Q.warnings.push({type:"warning",category:"Description",file:z,message:`Description too short (${q} chars, recommended >50)`}),H=!0}let U=i1(j,$,Z);for(let q of U)Q.errors.push({type:"error",category:"Links",file:z,message:`Broken internal link: ${q}`}),H=!0;let V=r1(j);for(let q of V)Q.warnings.push({type:"warning",category:"Images",file:z,message:`Image missing alt text: ${q}`}),H=!0;if(G){let q=`---
|
|
322
|
+
${j6.stringify(K)}---
|
|
323
|
+
${j}`;await f.promises.writeFile(Z,q,"utf-8")}if(!H)Q.passed++}async function l1(Z){let $=[];async function Q(Y){let J=await f.promises.readdir(Y,{withFileTypes:!0});for(let X of J){let j=g.join(Y,X.name);if(X.isDirectory()){if(!X.name.startsWith(".")&&X.name!=="node_modules"&&X.name!=="public")await Q(j)}else if(X.isFile()&&X.name.endsWith(".md"))$.push(j)}}return await Q(Z),$}function a1(Z){let $=/^---\n([\s\S]*?)\n---\n?/,Q=Z.match($);if(!Q)return{frontmatter:{},markdown:Z};let Y=Q[1],J=Z.slice(Q[0].length);try{return{frontmatter:j6.parse(Y),markdown:J}}catch{return{frontmatter:{},markdown:Z}}}function n1(Z){let $=Z.match(/^#\s+(.+)$/m);return $?$[1].trim():null}function p1(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(`
|
|
324
|
+
|
|
325
|
+
`)[0]||Q;if(Y.length>$)return`${Y.slice(0,$)}...`;return Y||"Documentation page"}function i1(Z,$,Q){let Y=[],J=/\[([^\]]+)\]\(([^)]+)\)/g,X;while((X=J.exec(Z))!==null){let j=X[2];if(j.startsWith("http://")||j.startsWith("https://"))continue;if(j.startsWith("#"))continue;let z=g.dirname(Q),H=g.resolve(z,j),G=H.endsWith(".md")?H:`${H}.md`;if(!f.existsSync(G)&&!f.existsSync(H))Y.push(j)}return Y}function r1(Z){let $=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,Y;while((Y=Q.exec(Z))!==null){let J=Y[1],X=Y[2];if(!J||J.trim()==="")$.push(X)}return $}function s1(Z){if(console.log(""),w("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${b(Z.totalPages.toString(),"blue")}`),console.log(`Passed: ${b(Z.passed.toString(),"green")}`),console.log(`Errors: ${b(Z.errors.length.toString(),Z.errors.length>0?"red":"green")}`),console.log(`Warnings: ${b(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}));i($),console.log("")}if(Z.warnings.length>0){Y0(`\u26A0 ${Z.warnings.length} warnings found:`),console.log("");let $=Z.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));i($),console.log("")}if(Z.errors.length===0&&Z.warnings.length===0)A("\u2713 All SEO checks passed!");else if(Z.errors.length===0)A("\u2713 No errors found (only warnings)")}import{join as t1}from"path";async function e1(Z){let $=await Bun.file(Z).text(),Q=$.split(`
|
|
326
|
+
`),Y=0,J=!1,X=[];for(let G of Q){if(G.trim().startsWith("```")){J=!J;continue}if(!J)X.push(G)}Y=X.join(" ").split(/\s+/).filter((G)=>G.length>0).length;let z=Q.filter((G)=>G.match(/^#{1,6}\s+/)).length,H=($.match(/```/g)||[]).length/2;return{path:Z,size:await J0(Z),lines:Q.length,words:Y,headings:z,codeBlocks:Math.floor(H)}}async function K6(Z={}){let $=await P,Q=Z.dir||$.docsDir||"./docs",Y=Z.verbose||!1;try{console.log(b(`
|
|
327
|
+
Analyzing documentation...
|
|
328
|
+
`,"bold"));let{Glob:J}=awaitPromise.resolve(globalThis.Bun),X=new J("**/*.md"),j=[];for await(let M of X.scan(Q)){let L=t1(Q,M),m=await e1(L);j.push(m)}if(j.length===0)return F("No markdown files found"),!1;let z=j.reduce((M,L)=>M+L.size,0),H=j.reduce((M,L)=>M+L.lines,0),G=j.reduce((M,L)=>M+L.words,0),K=j.reduce((M,L)=>M+L.headings,0),U=j.reduce((M,L)=>M+L.codeBlocks,0);if(console.log(b("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${j.length}`),console.log(`Total size: ${y(z)}`),console.log(`Total lines: ${H.toLocaleString()}`),console.log(`Total words: ${G.toLocaleString()}`),console.log(`Headings: ${K}`),console.log(`Code blocks: ${U}`),console.log(),Y){console.log(b("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let M=j.map((L)=>({File:L.path.replace(`${Q}/`,""),Size:y(L.size),Lines:L.lines,Words:L.words,Headings:L.headings,"Code Blocks":L.codeBlocks}));i(M),console.log()}let V=z/j.length,q=H/j.length,W=G/j.length;console.log(b("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${y(V)}`),console.log(`Lines: ${Math.round(q)}`),console.log(`Words: ${Math.round(W)}`),console.log();let N=[...j].sort((M,L)=>L.size-M.size).slice(0,5);if(N.length>0){console.log(b("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let M of N){let L=M.path.replace(`${Q}/`,"");console.log(` ${L.padEnd(40)} ${y(M.size)}`)}console.log()}let E=Math.ceil(G/200);return w(`Estimated reading time: ${E} minutes`),!0}catch(J){return F(`Failed to generate statistics: ${J}`),!1}}var k=new W0("bunpress"),O={outdir:P.outDir||"./dist",docsdir:P.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:P.verbose};async function V6(Z){let $=new G6("**/*.md"),Q=[];for await(let Y of $.scan(Z))Q.push(d(Z,Y));return Q}async function $Z(Z,$,Q=!1){let Y=`${$}/public`;try{await ZZ(Y);let J=new G6("**/*");for await(let X of J.scan(Y)){let j=d(Y,X),z=d(Z,X);await U6(d(Z,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await o1(j,z)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function QZ(Z,$,Q){try{let Y=await P;if(Y.sitemap?.enabled!==!1&&Y.sitemap?.baseUrl)await p0(Z,$,Y);if(Y.robots?.enabled!==!1)await n0($,Y)}catch(Y){if(Q)console.error("Error generating SEO files:",Y)}}async function q6(Z={}){let $=await P,Q=Z.outdir||$.outDir||O.outdir,Y=d(Q,".bunpress"),J=Z.dir||$.docsDir||O.docsdir,X=Z.verbose??O.verbose,j=Z.minify??!1,z=Z.sourcemap??!1,H=performance.now(),G=new x("Building documentation...");if(!X)G.start();await U6(Y,{recursive:!0});let K=await V6(J);if(K.length===0){if(!X)G.fail("No markdown files found in docs directory");else console.log("No markdown files found in docs directory");return!1}if(X)console.log(`Found ${K.length} markdown files:`),K.forEach((U)=>console.log(`- ${U}`));try{let{markdownToHtml:U,wrapInLayout:V}=await import("./chunk-zabbw4a8.js"),{mkdir:q,writeFile:W}=await import("fs/promises");if(X)console.log("Transforming markdown to HTML...");for(let M of K){let L=await Bun.file(M).text(),{html:m,frontmatter:W6}=await U(L,J),F6=M.replace(/^\.\//,""),M6=J.replace(/^\.\//,""),T0=F6.replace(M6,"").replace(/^\//,"").replace(/\.md$/,""),L6=`/${T0}`,N6=W6.layout==="home",D6=await V(m,$,L6,N6),r=d(Y,T0+".html"),R0=r.substring(0,r.lastIndexOf("/"));if(R0)await q(R0,{recursive:!0});if(await W(r,D6),X)console.log(`Generated: ${r}`)}if(X)console.log(`Processed ${K.length} markdown files.`);await $Z(Y,J,X),await XZ(Y),await YZ(Y,$),await QZ(J,Y,X||!1);let E=performance.now()-H;if(!X)G.succeed(`Built ${K.length} pages to HTML in ${N0(E)}`);else A(`Build completed in ${N0(E)}`),console.log(`
|
|
329
|
+
Generated ${K.length} HTML files in ${Y}`);return!0}catch(U){if(!X)G.fail("Build failed");return console.error("Error during build:",U),!1}}async function YZ(Z,$){let{wrapInLayout:Q}=await import("./chunk-zabbw4a8.js"),Y=`
|
|
330
|
+
<style>
|
|
331
|
+
.NotFound {
|
|
332
|
+
padding: 64px 24px 96px;
|
|
333
|
+
text-align: center;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
@media (min-width: 768px) {
|
|
337
|
+
.NotFound {
|
|
338
|
+
padding: 96px 32px 168px;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.NotFound .code {
|
|
343
|
+
line-height: 64px;
|
|
344
|
+
font-size: 64px;
|
|
345
|
+
font-weight: 600;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.NotFound .title {
|
|
349
|
+
padding-top: 12px;
|
|
350
|
+
letter-spacing: 2px;
|
|
351
|
+
line-height: 20px;
|
|
352
|
+
font-size: 20px;
|
|
353
|
+
font-weight: 700;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.NotFound .divider {
|
|
357
|
+
margin: 24px auto 18px;
|
|
358
|
+
width: 64px;
|
|
359
|
+
height: 1px;
|
|
360
|
+
background-color: var(--vp-c-divider);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.NotFound .quote {
|
|
364
|
+
margin: 0 auto;
|
|
365
|
+
max-width: 256px;
|
|
366
|
+
font-size: 14px;
|
|
367
|
+
font-weight: 500;
|
|
368
|
+
color: var(--vp-c-text-2);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.NotFound .action {
|
|
372
|
+
padding-top: 20px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.NotFound .link {
|
|
376
|
+
display: inline-block;
|
|
377
|
+
border: 1px solid var(--vp-c-brand-1);
|
|
378
|
+
border-radius: 16px;
|
|
379
|
+
padding: 3px 16px;
|
|
380
|
+
font-size: 14px;
|
|
381
|
+
font-weight: 500;
|
|
382
|
+
color: var(--vp-c-brand-1);
|
|
383
|
+
transition: border-color 0.25s, color 0.25s;
|
|
384
|
+
text-decoration: none;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.NotFound .link:hover {
|
|
388
|
+
border-color: var(--vp-c-brand-2);
|
|
389
|
+
color: var(--vp-c-brand-2);
|
|
390
|
+
}
|
|
391
|
+
</style>
|
|
392
|
+
|
|
393
|
+
<div class="NotFound">
|
|
394
|
+
<p class="code">404</p>
|
|
395
|
+
<h1 class="title">PAGE NOT FOUND</h1>
|
|
396
|
+
<div class="divider"></div>
|
|
397
|
+
<blockquote class="quote">
|
|
398
|
+
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
|
|
399
|
+
</blockquote>
|
|
400
|
+
<div class="action">
|
|
401
|
+
<a class="link" href="/docs/" aria-label="go to home">
|
|
402
|
+
Take me home
|
|
403
|
+
</a>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
`,J=await Q(`
|
|
407
|
+
<style>
|
|
408
|
+
.NotFound {
|
|
409
|
+
padding: 64px 24px 96px;
|
|
410
|
+
text-align: center;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
@media (min-width: 768px) {
|
|
414
|
+
.NotFound {
|
|
415
|
+
padding: 96px 32px 168px;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.NotFound .code {
|
|
420
|
+
line-height: 64px;
|
|
421
|
+
font-size: 64px;
|
|
422
|
+
font-weight: 600;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.NotFound .title {
|
|
426
|
+
padding-top: 12px;
|
|
427
|
+
letter-spacing: 2px;
|
|
428
|
+
line-height: 20px;
|
|
429
|
+
font-size: 20px;
|
|
430
|
+
font-weight: 700;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.NotFound .divider {
|
|
434
|
+
margin: 24px auto 18px;
|
|
435
|
+
width: 64px;
|
|
436
|
+
height: 1px;
|
|
437
|
+
background-color: var(--vp-c-divider);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.NotFound .quote {
|
|
441
|
+
margin: 0 auto;
|
|
442
|
+
max-width: 256px;
|
|
443
|
+
font-size: 14px;
|
|
444
|
+
font-weight: 500;
|
|
445
|
+
color: var(--vp-c-text-2);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.NotFound .action {
|
|
449
|
+
padding-top: 20px;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.NotFound .link {
|
|
453
|
+
display: inline-block;
|
|
454
|
+
border: 1px solid var(--vp-c-brand-1);
|
|
455
|
+
border-radius: 16px;
|
|
456
|
+
padding: 3px 16px;
|
|
457
|
+
font-size: 14px;
|
|
458
|
+
font-weight: 500;
|
|
459
|
+
color: var(--vp-c-brand-1);
|
|
460
|
+
transition: border-color 0.25s, color 0.25s;
|
|
461
|
+
text-decoration: none;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.NotFound .link:hover {
|
|
465
|
+
border-color: var(--vp-c-brand-2);
|
|
466
|
+
color: var(--vp-c-brand-2);
|
|
467
|
+
}
|
|
468
|
+
</style>
|
|
469
|
+
|
|
470
|
+
<div class="NotFound">
|
|
471
|
+
<p class="code">404</p>
|
|
472
|
+
<h1 class="title">PAGE NOT FOUND</h1>
|
|
473
|
+
<div class="divider"></div>
|
|
474
|
+
<blockquote class="quote">
|
|
475
|
+
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
|
|
476
|
+
</blockquote>
|
|
477
|
+
<div class="action">
|
|
478
|
+
<a class="link" href="/docs/" aria-label="go to home">
|
|
479
|
+
Take me home
|
|
480
|
+
</a>
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
`,$,"/404",!1);await Bun.write(d(Z,"404.html"),J)}async function XZ(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)}}k.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 q6(Z))v.exit(1);if(Z.watch){let{watch:Q}=await import("fs"),Y=await P,J=Z.dir||Y.docsDir||"./docs";console.log(`
|
|
484
|
+
Watching for changes...`),Q(J,{recursive:!0},async(X,j)=>{if(j&&j.endsWith(".md"))console.log(`
|
|
485
|
+
Detected change in ${j}, rebuilding...`),await q6(Z)}),await new Promise(()=>{})}});k.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 P,Q=Z.port||O.port,Y=Z.dir||$.docsDir||O.docsdir,J=Z.watch??O.watch,X=Z.verbose??O.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:Y,watch:J,verbose:X});await H6({port:Q,root:Y,watch:J,config:$})});async function JZ(Z={}){let $=await P,Q=Z.dir||$.docsDir||O.docsdir,Y=Z.output||"./docs.md",J=Z.full??!1,X=Z.verbose??O.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${Y}`),console.log(`Full content: ${J}`);let j=await V6(Q);if(j.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${j.length} markdown files`);j.sort();let z=`# Documentation
|
|
486
|
+
|
|
487
|
+
`;z+=`Generated: ${new Date().toISOString()}
|
|
488
|
+
|
|
489
|
+
`,z+=`Total files: ${j.length}
|
|
490
|
+
|
|
491
|
+
`,z+=`---
|
|
492
|
+
|
|
493
|
+
`;for(let H of j){let G=H.replace(`${Q}/`,""),K=await Bun.file(H).text();if(X)console.log(`Processing: ${G}`);if(z+=`## File: ${G}
|
|
494
|
+
|
|
495
|
+
`,J)z+=K,z+=`
|
|
496
|
+
|
|
497
|
+
`;else{let U=K.split(`
|
|
498
|
+
`),V=!1,q="";for(let W of U){if(W.trim()==="---")if(!V){V=!0;continue}else{if(V=!1,q)z+="**Frontmatter:**\n```yaml\n",z+=q,z+="```\n\n",q="";continue}if(V){q+=`${W}
|
|
499
|
+
`;continue}if(W.match(/^#{1,6}\s+/))z+=`${W}
|
|
500
|
+
`}z+=`
|
|
501
|
+
`}z+=`---
|
|
502
|
+
|
|
503
|
+
`}return await Bun.write(Y,z),console.log(`
|
|
504
|
+
LLM markdown generated successfully: ${Y}`),console.log(`Total size: ${(z.length/1024).toFixed(2)} KB`),!0}k.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 JZ(Z))v.exit(1)});k.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 $6(Z))v.exit(1)});k.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 J6(Z)});k.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 s0(Z))v.exit(1)});k.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await Z6(Z))v.exit(1)});k.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await t0(Z))v.exit(1)});k.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:O.verbose}).action(async(Z)=>{if(!await e0(Z))v.exit(1)});k.command("config:init","Initialize configuration file").action(async(Z)=>{if(!await o0(Z))v.exit(1)});k.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 Y6(Z,$))v.exit(1)});k.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 K6(Z))v.exit(1)});k.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 z6(Z)});k.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-njjmvdjd.js");if(!await $(Z))v.exit(1)});k.help();k.version(c0);k.parse();
|
|
505
|
+
export{A as a,F as b,w as c,x as d,V6 as e,q6 as f};
|