@stacksjs/bunpress 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bin/cli.d.ts +13 -0
- package/dist/bin/cli.js +1 -1
- package/dist/{chunk-mch0qmg4.js → chunk-9cm3e4r4.js} +1 -1
- package/dist/{chunk-s98n2933.js → chunk-kxr6zf7e.js} +24 -24
- package/dist/{chunk-e5q66hsy.js → chunk-m0g9vk1e.js} +1 -1
- package/dist/{chunk-188svpa8.js → chunk-mjhqecp5.js} +29 -29
- package/dist/{chunk-ss6yzy9f.js → chunk-qdmkac4z.js} +1 -1
- package/dist/{chunk-gxhjya5p.js → chunk-qrp18ybj.js} +1 -1
- package/dist/{chunk-w6byd4st.js → chunk-wmvgjzgh.js} +1 -1
- package/dist/{chunk-hm3c3p37.js → chunk-zmxtnx2v.js} +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Q as lQ,R as P}from"./chunk-m0g9vk1e.js";import{T as u}from"./chunk-wmvgjzgh.js";var{Glob:pQ,YAML:mQ}=globalThis.Bun;import{stat as hQ}from"fs/promises";import{join as i}from"path";import f from"process";var{Glob:oQ}=globalThis.Bun;import{join as jQ}from"path";var h=new Map;function nQ(Q,Z,$){let Y=Z.split("."),J=Q;for(let O=0;O<Y.length-1;O++){let q=Y[O];if(typeof J[q]!=="object"||J[q]===null)J[q]={};J=J[q]}J[Y[Y.length-1]]=$}async function NQ(Q){if(h.has(Q))return h.get(Q);let Z={},$=jQ(Q,".data");try{let Y=new oQ("**/*.json");for await(let J of Y.scan({cwd:$,absolute:!1}))try{let O=await Bun.file(jQ($,J)).text(),q=J.replace(/\.json$/,"").replace(/[/\\]/g,".");nQ(Z,q,JSON.parse(O))}catch{}}catch{}return h.set(Q,Z),Z}function EQ(){h.clear()}import{createHighlighter as tQ,highlight as eQ}from"ts-syntax-highlighter";var C=null;function G0(){C=null}async function RQ(){if(C)return C;return C=await tQ({theme:"github-light",cache:!0}),C}var QZ={js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",htm:"html",sh:"bash",shell:"bash",zsh:"bash"};function n(Q){let Z=Q.toLowerCase().trim();return QZ[Z]||Z}function AQ(Q){let Z=n(Q);return["javascript","typescript","html","css","json","stx","bash"].includes(Z)}function g(Q){return Q.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ZZ(Q,Z){let $=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,Y=[],J;while((J=$.exec(Z))!==null){let X=J[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;/g,"'");if(X)Y.push({text:X,span:J[0]})}if(Y.length===0)return Z;let O="",q=0,K=Q.match(/^(\s*)/);if(K&&K[1])O+=K[1],q=K[1].length;for(let X=0;X<Y.length;X++){let{text:z,span:V}=Y[X],_=Q.indexOf(z,q);if(_===-1){O+=V;continue}if(_>q){let G=Q.substring(q,_);if(/^\s+$/.test(G))O+=G}O+=V,q=_+z.length}return O}async function t(Q,Z,$="github-light"){let Y=n(Z);if(!AQ(Y))return Q.split(`
|
|
3
3
|
`).map((O)=>`<span class="line">${g(O)}</span>`).join(`
|
|
4
4
|
`);try{let J=Q.split(`
|
|
5
5
|
`);return(await Promise.all(J.map(async(q)=>{if(!q.trim())return`<span class="line">${q}</span>`;let X=(await eQ(q,Y,{theme:$})).html;if(X=X.replace(/<div[^>]*class="syntax-wrapper"[^>]*>/g,""),X=X.replace(/<\/div>\s*$/g,""),X=X.replace(/<pre[^>]*>/g,""),X=X.replace(/<\/pre>/g,""),X=X.replace(/<code[^>]*>/g,""),X=X.replace(/<\/code>/g,""),X=ZZ(q,X.trim()),!X.startsWith('<span class="line">'))X=`<span class="line">${X}</span>`;return X}))).join(`
|
|
6
6
|
`)}catch(J){return console.warn(`Failed to highlight code for language "${Z}":`,J),Q.split(`
|
|
7
7
|
`).map((q)=>`<span class="line">${g(q)}</span>`).join(`
|
|
8
|
-
`)}}function U0(Q,Z){let $=n(Z);if(!
|
|
8
|
+
`)}}function U0(Q,Z){let $=n(Z);if(!AQ($))return g(Q);return g(Q)}function BQ(){return`
|
|
9
9
|
/* Basic syntax highlighting styles for ts-syntax-highlighter */
|
|
10
10
|
/* The actual theme colors are injected by ts-syntax-highlighter */
|
|
11
11
|
|
|
@@ -115,7 +115,7 @@ code {
|
|
|
115
115
|
color: #9ca3af;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
`}async function j0(){await
|
|
118
|
+
`}async function j0(){await RQ()}async function N0(){return RQ()}import{join as e}from"path";var d=new Map,FQ="\x00BPCODE",MQ="\x00";async function $Z(Q,Z){let $=e(Q,Z);if(d.has($))return d.get($);let Y=[e(Q,`${Z}.stx`),e(Q,Z,"index.stx")],J=null;for(let O of Y){let q=Bun.file(O);if(await q.exists()){J=await q.text();break}}return d.set($,J),J}function IQ(){d.clear()}function JZ(Q,Z){try{let $=Object.keys(Z),Y=$.map((J)=>Z[J]);return Function(...$,`"use strict"; return (${Q});`)(...Y)}catch{return}}function YZ(Q,Z){let $={};if(!Q)return $;let Y=/([:@]?[\w-]+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]*)\}))?/g,J;while(J=Y.exec(Q)){let O=J[1];if(!O)continue;let q=O.startsWith(":"),K=O.replace(/^[:@]/,""),X=J[2],z=J[3],V=J[4],_=X??z??V;if(_===void 0)$[K]=!0;else if(q||V!==void 0)$[K]=JZ(_,Z);else $[K]=_}return $}async function QQ(Q,Z,$,Y=0){if(Y>10||!Q.includes("<"))return Q;let J=[],O=Q.replace(/```[\s\S]*?```/g,(_)=>{return J.push(_),`${FQ}${J.length-1}${MQ}`}).replace(/`[^`\n]*`/g,(_)=>{return J.push(_),`${FQ}${J.length-1}${MQ}`}),q=/<([A-Z][A-Za-z0-9]*)((?:\s[^>]*?)?)(\/?)>/g,K="",X=0,z=!1,V;while(V=q.exec(O)){let _=V[0],G=V[1],j=V[2],N=V[3],W=await $Z(Z,G);if(W==null)continue;z=!0,K+=O.slice(X,V.index);let E="",U=V.index+_.length;if(!N){let B=new RegExp(`</${G}>`,"g");B.lastIndex=U;let M=B.exec(O);if(M)E=O.slice(U,M.index).trim(),U=M.index+M[0].length}let F=YZ(j.trim(),$),A="";try{let{renderString:B}=await import("@stacksjs/stx");A=await B(W,{...$,...F,slot:E})}catch{A=""}K+=A,X=U,q.lastIndex=U}if(K+=O.slice(X),K=K.replace(/\u0000BPCODE(\d+)\u0000/g,(_,G)=>J[Number(G)]??""),z)return QQ(K,Z,$,Y+1);return K}import{join as TQ}from"path";var OZ=TQ(import.meta.dir,"templates"),c=new Map;async function XZ(Q){if(c.has(Q))return c.get(Q);let Z=TQ(OZ,`${Q}.stx`),$=Bun.file(Z);if(!await $.exists())throw Error(`Template not found: ${Q}`);let Y=await $.text();return c.set(Q,Y),Y}async function v(Q,Z){let $=await XZ(Q);return qZ($,Z)}function LQ(){c.clear()}function qZ(Q,Z){return Q.replace(/\{!!\s*([\w.]+)\s*!!\}/g,($,Y)=>DQ(wQ(Z,Y))).replace(/\{\{\s*([\w.]+)\s*\}\}/g,($,Y)=>KZ(DQ(wQ(Z,Y))))}function wQ(Q,Z){return Z.split(".").reduce(($,Y)=>{if($==null||typeof $!=="object")return;return $[Y]},Q)}function DQ(Q){if(Q==null)return"";return String(Q)}function KZ(Q){return Q.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var HQ=`/**
|
|
119
119
|
* VitePress Theme for BunPress - Layout & Chrome
|
|
120
120
|
* -------------------------------------------------------------------------- */
|
|
121
121
|
|
|
@@ -5204,7 +5204,7 @@ mjx-container > svg {
|
|
|
5204
5204
|
margin: 0;
|
|
5205
5205
|
border-radius: 0;
|
|
5206
5206
|
border: none;
|
|
5207
|
-
}`}var GZ={name:"vitepress",getCSS:ZQ,getVars:_Z,getBase:zZ,getCustomBlocks:VZ,getCodeGroups:WZ},
|
|
5207
|
+
}`}var GZ={name:"vitepress",getCSS:ZQ,getVars:_Z,getBase:zZ,getCustomBlocks:VZ,getCodeGroups:WZ},PQ=GZ;var yQ=`/**
|
|
5208
5208
|
* Bun Theme for BunPress
|
|
5209
5209
|
* Colors extracted from bun.sh
|
|
5210
5210
|
* -------------------------------------------------------------------------- */
|
|
@@ -5758,7 +5758,7 @@ mjx-container > svg {
|
|
|
5758
5758
|
|
|
5759
5759
|
.bpi-search {
|
|
5760
5760
|
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'%3E%3Cpath d='m21 21l-4.34-4.34'/%3E%3Ccircle cx='11' cy='11' r='8' stroke-width='1.4'/%3E%3C/g%3E%3C/svg%3E");
|
|
5761
|
-
}`,
|
|
5761
|
+
}`,vQ=`/**
|
|
5762
5762
|
* Bun Theme for BunPress - Base Styles
|
|
5763
5763
|
* -------------------------------------------------------------------------- */
|
|
5764
5764
|
|
|
@@ -6557,7 +6557,7 @@ p {
|
|
|
6557
6557
|
.bp-doc .custom-block .bp-code-group .tabs {
|
|
6558
6558
|
margin: 0;
|
|
6559
6559
|
border-radius: 5px 5px 0 0;
|
|
6560
|
-
}`,
|
|
6560
|
+
}`,kQ=`/**
|
|
6561
6561
|
* Bun Theme for BunPress - Custom Blocks
|
|
6562
6562
|
* -------------------------------------------------------------------------- */
|
|
6563
6563
|
|
|
@@ -6921,7 +6921,7 @@ p {
|
|
|
6921
6921
|
|
|
6922
6922
|
.github-alert-caution .github-alert-icon {
|
|
6923
6923
|
fill: var(--bp-c-caution-1);
|
|
6924
|
-
}`,
|
|
6924
|
+
}`,bQ=`/**
|
|
6925
6925
|
* Bun Theme for BunPress - Code Groups
|
|
6926
6926
|
* -------------------------------------------------------------------------- */
|
|
6927
6927
|
|
|
@@ -7051,7 +7051,7 @@ p {
|
|
|
7051
7051
|
margin: 0;
|
|
7052
7052
|
border-radius: 0;
|
|
7053
7053
|
border: none;
|
|
7054
|
-
}`,
|
|
7054
|
+
}`,SQ=`/**
|
|
7055
7055
|
* Bun Theme for BunPress - Extra Bun-specific styles
|
|
7056
7056
|
* -------------------------------------------------------------------------- */
|
|
7057
7057
|
|
|
@@ -7205,23 +7205,23 @@ p {
|
|
|
7205
7205
|
|
|
7206
7206
|
.interactive-hover:hover {
|
|
7207
7207
|
transform: scale(1.06);
|
|
7208
|
-
}`;function
|
|
7208
|
+
}`;function xQ(){return`
|
|
7209
7209
|
/* Bun Theme for BunPress */
|
|
7210
7210
|
/* Colors extracted from bun.sh */
|
|
7211
|
-
${PQ}
|
|
7212
7211
|
${yQ}
|
|
7213
|
-
${LQ}
|
|
7214
7212
|
${vQ}
|
|
7213
|
+
${HQ}
|
|
7215
7214
|
${kQ}
|
|
7216
7215
|
${bQ}
|
|
7217
|
-
|
|
7216
|
+
${SQ}
|
|
7217
|
+
`}function UZ(){return yQ}function jZ(){return vQ}function NZ(){return kQ}function EZ(){return bQ}function RZ(){return SQ}var AZ={name:"bun",getCSS:xQ,getVars:UZ,getBase:jZ,getCustomBlocks:NZ,getCodeGroups:EZ,getExtras:RZ},CQ=AZ;var BZ={vitepress:PQ,bun:CQ};function uQ(Q="vitepress"){let Z=BZ[Q];if(!Z)return console.warn(`[BunPress] Unknown theme: ${Q}, falling back to vitepress`),ZQ();return Z.getCSS()}var $Q={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function JQ(Q){return Q.toLowerCase().trim().replace(/<[^>]*>/g,"").replace(/what's new\?\s*\(v2\.0\)/g,"whats-new-v2-0").replace(/features\s*&\s*benefits/g,"features-benefits").replace(/vue\.js\s*\+\s*typescript\s*=\s*\u2764\uFE0F/g,"vue-js-typescript").replace(/\//g,"-").replace(/\./g,"-").replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function fQ(Q,Z){let $=JQ(Q),Y=$,J=1;while(Z.has($))$=`${Y}-${J}`,J++;return Z.add($),$}function YQ(Q){let Z=[],$=new Set,Y=/^(#{1,6})\s+(.+)$/gm,J;while((J=Y.exec(Q))!==null){let O=J[1].length,q=J[2].trim();if(!q)continue;if(q.includes("toc-ignore"))continue;let K=q.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();K=K.replace(/`([^`]+)`/g,"<code>$1</code>");let X=K.includes("<code>"),z=fQ(K.replace(/<[^>]*>/g,""),$);Z.push({level:O,text:K,id:z,children:[],hasCode:X})}return Z}function OQ(Q){let Z=[],$=[];for(let Y of Q){while($.length>0&&$[$.length-1].level>=Y.level)$.pop();if($.length===0)Z.push(Y);else $[$.length-1].children.push(Y);$.push(Y)}return Z}function XQ(Q,Z){let{minDepth:$=2,maxDepth:Y=6,exclude:J=[]}=Z,O=(q)=>{let K=[];for(let X of q){if(J.some((V)=>{if(V.startsWith("/")&&V.endsWith("/"))return new RegExp(V.slice(1,-1)).test(X.text);else return X.text===V}))continue;if(X.level>Y)continue;let z=O(X.children);if(X.level>=$&&X.level<=Y)K.push({...X,children:z});else K.push(...z)}return K};return O(Q)}function l(Q){let{items:Z,title:$,config:Y}=Q,{className:J,collapsible:O}=Y,q=(K,X=0)=>{if(K.length===0)return"";let z=X===0?"toc-list":"toc-sublist",V=X===0?"toc-item":"toc-subitem";return`<ul class="${z}">
|
|
7218
7218
|
${K.map((_)=>{let G=_.children.length>0,j=G&&O?"toc-expand":"",N=G?q(_.children,X+1):"",W=50,E=_.text.length>50?`${_.text.substring(0,50)}...`:_.text,U=_.text.length>50?"toc-truncate":"";return`<li class="${_.hasCode?"toc-code":""} ${j} ${V} ${U}">
|
|
7219
7219
|
<a href="#${_.id}" class="toc-link" title="${_.text.replace(/<[^>]*>/g,"")}">${E}</a>
|
|
7220
7220
|
${N}
|
|
7221
7221
|
</li>`}).join(`
|
|
7222
7222
|
`)}
|
|
7223
7223
|
</ul>`};return[`<nav class="${J}" role="navigation" aria-label="${$}">`,'<div class="toc-container">',` <h2 class="toc-title">${$}</h2>`,` ${q(Z)}`,"</div>","</nav>"].join(`
|
|
7224
|
-
`)}function r(Q){return l(Q).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function FZ(Q){return l(Q).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function MZ(Q){return l(Q).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function IZ(Q,Z={}){let $={...Z};if(typeof $.position==="string")$.position=[$.position];let Y={...$Q,...$},J=YQ(Q),O=OQ(J),q=XQ(O,Y);return{title:Y.title,items:q,config:Y}}function H0(Q,Z={}){let $=IZ(Q,Z);return(Array.isArray(Z.position)?Z.position:[Z.position||"sidebar"]).map((J)=>{let O;switch(J){case"inline":O=r($);break;case"sidebar":O=FZ($);break;case"floating":O=MZ($);break;default:O=l($)}return{position:J,data:$,html:O}})}function P0(Q,Z){let $=r(Z);return Q.replace(/\[\[toc\]\]/gi,$)}function y0(Q){let Z=new Set;return Q.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,($,Y,J)=>{let O=
|
|
7224
|
+
`)}function r(Q){return l(Q).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function FZ(Q){return l(Q).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function MZ(Q){return l(Q).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function IZ(Q,Z={}){let $={...Z};if(typeof $.position==="string")$.position=[$.position];let Y={...$Q,...$},J=YQ(Q),O=OQ(J),q=XQ(O,Y);return{title:Y.title,items:q,config:Y}}function H0(Q,Z={}){let $=IZ(Q,Z);return(Array.isArray(Z.position)?Z.position:[Z.position||"sidebar"]).map((J)=>{let O;switch(J){case"inline":O=r($);break;case"sidebar":O=FZ($);break;case"floating":O=MZ($);break;default:O=l($)}return{position:J,data:$,html:O}})}function P0(Q,Z){let $=r(Z);return Q.replace(/\[\[toc\]\]/gi,$)}function y0(Q){let Z=new Set;return Q.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,($,Y,J)=>{let O=fQ(J.replace(/<[^>]*>/g,""),Z);return`<h${Y} id="${O}"><a href="#${O}" class="heading-anchor">#</a>${J}</h${Y}>`})}function v0(){return`
|
|
7225
7225
|
.table-of-contents {
|
|
7226
7226
|
position: sticky;
|
|
7227
7227
|
top: 60px; /* Match navbar height */
|
|
@@ -7452,7 +7452,7 @@ if (document.readyState === 'loading') {
|
|
|
7452
7452
|
else {
|
|
7453
7453
|
initToc()
|
|
7454
7454
|
}
|
|
7455
|
-
`}async function wZ(Q,Z){let $=Q.themeConfig?.sidebar||Q.markdown?.sidebar;if(!$)return"";let Y=[];if(Array.isArray($))Y=$;else if(typeof $==="object"){let q=Object.keys($).sort((K,X)=>X.length-K.length).find((K)=>Z.startsWith(K))||"/";Y=$[q]||[]}let J=await Promise.all(Y.map(async(O)=>{let q=O.items?O.items.map((K)=>{let X=K.link||"/",z=
|
|
7455
|
+
`}async function wZ(Q,Z){let $=Q.themeConfig?.sidebar||Q.markdown?.sidebar;if(!$)return"";let Y=[];if(Array.isArray($))Y=$;else if(typeof $==="object"){let q=Object.keys($).sort((K,X)=>X.length-K.length).find((K)=>Z.startsWith(K))||"/";Y=$[q]||[]}let J=await Promise.all(Y.map(async(O)=>{let q=O.items?O.items.map((K)=>{let X=K.link||"/",z=WQ(Q,X);return`<li><a class="${X===Z||K.link===Z?"BPSidebarItem-link is-active":"BPSidebarItem-link"}" href="${z}">${K.text}</a></li>`}).join(""):"";return await v("sidebar-section",{title:O.text,items:q,collapsedClass:O.collapsed?" collapsed":""})}));return await v("sidebar",{sections:J.join("")})}async function DZ(Q){let Z=/<h([2-6])([^>]*)>(.*?)<\/h\1>/g,$=[],Y;while((Y=Z.exec(Q))!==null){let O=Number.parseInt(Y[1]),q=Y[2],K=Y[3];K=K.replace(/<[^>]*>/g,"");let X=q.match(/id="([^"]*)"/),z=X?X[1]:K.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"");$.push({level:O,text:K,id:z})}if($.length===0)return"";let J=$.map((O)=>{let q=O.level>2?`level-${O.level}`:"";return`<a href="#${O.id}" class="${q}">${O.text}</a>`}).join(`
|
|
7456
7456
|
`);return await v("page-toc",{items:J})}function TZ(Q){return Q.replace(/<h([1-6])([^>]*)>(.*?)<\/h\1>/g,(Z,$,Y,J)=>{if(Y.includes("id="))return Z;let O=J.match(/\s*\{#([\w-]+)\}\s*$/),q,K=J;if(O)q=O[1],K=J.replace(/\s*\{#[\w-]+\}\s*$/,"");else q=J.replace(/<[^>]*>/g,"").toLowerCase().replace(/\//g,"-").replace(/\s+/g,"-").replace(/[^\w-]/g,"").replace(/-+/g,"-").replace(/^-+|-+$/g,"");return`<h${$}${Y} id="${q}">${K}</h${$}>`})}function qQ(Q){let Z=LZ(),$=Q.lastIndexOf("</body>");if($===-1)return Q+Z;return Q.slice(0,$)+Z+Q.slice($)}function KQ(Q,Z){if(!Z)return Q;let $=Q.lastIndexOf("</body>");if($===-1)return Q+Z;return Q.slice(0,$)+Z+Q.slice($)}function LZ(){return`<script data-bp-router="1">
|
|
7457
7457
|
(function(){
|
|
7458
7458
|
if (history.scrollRestoration) history.scrollRestoration = 'manual';
|
|
@@ -7749,7 +7749,7 @@ else {
|
|
|
7749
7749
|
|
|
7750
7750
|
updateActiveLinks();
|
|
7751
7751
|
})();
|
|
7752
|
-
<`+"/script>"}function HZ(Q){let Z=Q.themeConfig?.nav||Q.markdown?.nav||Q.nav;if(!Z||Z.length===0)return"";let $=(J)=>{return
|
|
7752
|
+
<`+"/script>"}function HZ(Q){let Z=Q.themeConfig?.nav||Q.markdown?.nav||Q.nav;if(!Z||Z.length===0)return"";let $=(J)=>{return WQ(Q,J||"/")};return Z.map((J)=>{if(J.items&&J.items.length>0)return`<div class="BPNavBarMenu-group">
|
|
7753
7753
|
<button class="BPNavBarMenu-group-button" type="button">
|
|
7754
7754
|
<span>${J.text}</span>
|
|
7755
7755
|
<svg class="chevron" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
@@ -7759,7 +7759,7 @@ else {
|
|
|
7759
7759
|
<div class="BPNavBarMenu-group-items">
|
|
7760
7760
|
${J.items.map((O)=>`<a href="${$(O.link)}">${O.text}</a>`).join("")}
|
|
7761
7761
|
</div>
|
|
7762
|
-
</div>`;return`<a class="BPNavBarMenu-link" href="${$(J.link)}">${J.text}</a>`}).join("")}function rQ(Q){if(Q.basePath){let $=Q.basePath.trim().replace(/\/+$/,"");if(!$||$==="/")return"";return $.startsWith("/")?$:`/${$}`}let Z=Q.sitemap?.baseUrl;if(!Z)return"";try{let $=new URL(Z).pathname.replace(/\/+$/,"");return $==="/"?"":$}catch{return""}}function PZ(Q,Z){let $=rQ(Q);if(!$)return Z;if(Z===$||Z.startsWith(`${$}/`))return Z.slice($.length)||"/";return Z}function
|
|
7762
|
+
</div>`;return`<a class="BPNavBarMenu-link" href="${$(J.link)}">${J.text}</a>`}).join("")}function rQ(Q){if(Q.basePath){let $=Q.basePath.trim().replace(/\/+$/,"");if(!$||$==="/")return"";return $.startsWith("/")?$:`/${$}`}let Z=Q.sitemap?.baseUrl;if(!Z)return"";try{let $=new URL(Z).pathname.replace(/\/+$/,"");return $==="/"?"":$}catch{return""}}function PZ(Q,Z){let $=rQ(Q);if(!$)return Z;if(Z===$||Z.startsWith(`${$}/`))return Z.slice($.length)||"/";return Z}function WQ(Q,Z){let $=rQ(Q);if(!$||!Z.startsWith("/")||Z.startsWith("//"))return Z;if(Z===$||Z.startsWith(`${$}/`))return Z;return Z==="/"?`${$}/`:`${$}${Z}`}function _Q(Q,Z){return Q.replace(/\b(href|src|action)="(\/[^"]*)"/g,($,Y,J)=>{let O=WQ(Z,J);return O===J?$:`${Y}="${O}"`})}function yZ(Q,Z){let $=Q.sitemap?.baseUrl;if(!$)return"";return`<link rel="canonical" href="${$.replace(/\/$/,"")}${Z==="/index"?"/":Z}">`}function vZ(Q,Z,$,Y){let J=$.sitemap?.baseUrl;if(!J)return"";let K=`${J.replace(/\/$/,"")}${Y==="/index"?"/":Y}`,X=$.title||$.markdown?.title||Q,z=$.markdown?.meta?.["og:image"]||$.markdown?.meta?.ogImage,V=['<meta property="og:type" content="website">',`<meta property="og:url" content="${K}">`,`<meta property="og:title" content="${Q}">`,`<meta property="og:description" content="${Z}">`,`<meta property="og:site_name" content="${X}">`];if(z)V.push(`<meta property="og:image" content="${z}">`);return V.join(`
|
|
7763
7763
|
`)}function kZ(Q,Z,$){let Y=$.markdown?.meta?.["twitter:card"]||$.markdown?.meta?.twitterCard||"summary",J=$.markdown?.meta?.["twitter:site"]||$.markdown?.meta?.twitterSite,O=$.markdown?.meta?.["twitter:image"]||$.markdown?.meta?.twitterImage,q=[`<meta name="twitter:card" content="${Y}">`,`<meta name="twitter:title" content="${Q}">`,`<meta name="twitter:description" content="${Z}">`];if(J)q.push(`<meta name="twitter:site" content="${J}">`);if(O)q.push(`<meta name="twitter:image" content="${O}">`);return q.join(`
|
|
7764
7764
|
`)}function bZ(Q,Z,$,Y){let J=$.sitemap?.baseUrl;if(!J)return"";let O=J.replace(/\/$/,""),q=Y==="/index"?"/":Y,K=`${O}${q}`;if(q==="/"){let _={"@context":"https://schema.org","@type":"WebSite",name:$.title||$.markdown?.title||Q,description:Z,url:O};return`<script type="application/ld+json">
|
|
7765
7765
|
${JSON.stringify(_,null,2)}
|
|
@@ -7772,7 +7772,7 @@ ${JSON.stringify(_,null,2)}
|
|
|
7772
7772
|
${JSON.stringify(X,null,2)}
|
|
7773
7773
|
</script>`}function SZ(Q){let Z=Q.fonts;if(!Z)return{fontLinks:"",fontFaceCss:""};let $=[],Y=Z.google?.filter(Boolean)??[];if(Y.length>0){if(Z.preconnect!==!1)$.push('<link rel="preconnect" href="https://fonts.googleapis.com">'),$.push('<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>');let O=Y.map((K)=>`family=${K.trim().replace(/\s+/g,"+")}`).join("&"),q=Z.display??"swap";$.push(`<link href="https://fonts.googleapis.com/css2?${O}&display=${q}" rel="stylesheet">`)}let J=(Z.faces??[]).map((O)=>O.trim()).filter(Boolean).join(`
|
|
7774
7774
|
`);return{fontLinks:$.join(`
|
|
7775
|
-
`),fontFaceCss:J}}async function
|
|
7775
|
+
`),fontFaceCss:J}}async function gQ(Q,Z,$,Y="doc"){let J=Z.title||Z.themeConfig?.siteTitle||Z.markdown?.title||"BunPress Documentation",O=Z.description||Z.markdown?.meta?.description||"Documentation built with BunPress",q=Z.theme||"vitepress",K=uQ(q),X=BQ(),z=lQ.markdown?.css||"",V=Z.markdown?.css||"",_=V&&V!==z?V:"",G=yZ(Z,$),j=vZ(J,O,Z,$),N=kZ(J,O,Z),W=bZ(J,O,Z,$),E=Object.entries(Z.markdown?.meta||{}).filter(([I])=>!I.startsWith("og:")&&!I.startsWith("twitter:")&&I!=="description"&&I!=="ogImage"&&I!=="twitterCard"&&I!=="twitterSite"&&I!=="twitterImage").map(([I,k])=>`<meta name="${I}" content="${k}">`).join(`
|
|
7776
7776
|
`),{fontLinks:U,fontFaceCss:F}=SZ(Z),A=[E,G,j,N,U].filter(Boolean).join(`
|
|
7777
7777
|
`),B=CZ(Z),M=uZ(Z),T=Z.markdown?.scripts?.map((I)=>`<script>${I}</script>`).join(`
|
|
7778
7778
|
`)||"",w=[W,B,M,T].filter(Boolean).join(`
|
|
@@ -7795,7 +7795,7 @@ ${K}
|
|
|
7795
7795
|
${X}
|
|
7796
7796
|
${a}
|
|
7797
7797
|
${z}
|
|
7798
|
-
${_}`,o=await v("layout-doc",{htmlClass:p,themeMode:S,title:J,description:O,meta:A,customCSS:m,nav:L,sidebar:R,content:H,pageTOC:D});return _Q(qQ(KQ(o,w)),Z)}var s=null,
|
|
7798
|
+
${_}`,o=await v("layout-doc",{htmlClass:p,themeMode:S,title:J,description:O,meta:A,customCSS:m,nav:L,sidebar:R,content:H,pageTOC:D});return _Q(qQ(KQ(o,w)),Z)}var s=null,dQ=!1;async function xZ(){if(dQ)return s;dQ=!0;try{s=await import("./chunk-9cm3e4r4.js")}catch{s=null}return s}async function zQ(Q){let Z=await xZ();if(!Z)return"";let Y=new Z.Scanner([]).scanContent(Q);if(Y.size===0)return"";let J=new Z.CSSGenerator(Z.defaultConfig);for(let O of Y)J.generate(O);return J.toCSS(!1,!1)}function CZ(Q){if(!Q.fathom?.enabled||!Q.fathom?.siteId)return"";let Z=Q.fathom.scriptUrl||"https://cdn.usefathom.com/script.js",$=Q.fathom.defer!==!1,Y=Q.fathom.honorDNT||!1,J=Q.fathom.auto!==!1,O=Q.fathom.canonical,q=Q.fathom.spa||!1,K=[`data-site="${Q.fathom.siteId}"`,Y?'data-honor-dnt="true"':"",!J?'data-auto="false"':"",O?`data-canonical="${O}"`:"",q?'data-spa="auto"':""].filter(Boolean).join(" ");return`<script src="${Z}" ${K}${$?" defer":""}></script>`}function uZ(Q){let Z=Q.analytics||Q.selfHostedAnalytics;if(!Z?.enabled||!Z?.siteId)return"";let $=VQ(Z.siteId);if(Z.scriptSrc)return`<script defer src="${VQ(Z.scriptSrc)}" data-site="${$}"></script>`;let Y=Z.apiEndpoint?VQ(Z.apiEndpoint):"",J=Z.honorDNT?`var dnt=n.doNotTrack||w.doNotTrack||n.msDoNotTrack;if(dnt==="1"||dnt==="yes"||dnt===true){l('DNT enabled, skipping');return;}`:"",O=Z.trackHashChanges?"w.addEventListener('hashchange',function(){pv();});":"",q=Z.trackOutboundLinks?`d.addEventListener('click',function(e){try{var a=e.target.closest('a');if(a&&a.hostname&&a.hostname!==location.hostname){t('outbound',{url:a.href,text:(a.textContent||'').slice(0,100)});}}
|
|
7799
7799
|
catch (err){l('Outbound error',err);}});`:"",K=Y?` data-api="${Y}"`:"";return`<!-- ts-analytics: privacy-first analytics -->
|
|
7800
7800
|
<script data-site="${$}"${K} defer>
|
|
7801
7801
|
(function(){
|
|
@@ -7858,8 +7858,8 @@ l('Initialized',site);
|
|
|
7858
7858
|
}
|
|
7859
7859
|
catch(err){if(w.console)console.error('[Analytics] Init error:',err);}
|
|
7860
7860
|
})();
|
|
7861
|
-
</script>`}function
|
|
7862
|
-
`),$=/^---\n([\s\S]*?)\n---\n?/,Y=Z.match($);if(!Y)return{frontmatter:{},content:Z};let J=Y[1],O=Z.slice(Y[0].length);try{return{frontmatter:
|
|
7861
|
+
</script>`}function VQ(Q){return Q.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function fZ(Q){let Z=Q.replace(/\r\n/g,`
|
|
7862
|
+
`),$=/^---\n([\s\S]*?)\n---\n?/,Y=Z.match($);if(!Y)return{frontmatter:{},content:Z};let J=Y[1],O=Z.slice(Y[0].length);try{return{frontmatter:mQ.parse(J),content:O}}catch{try{let q=J.replace(/^(\s*\w+:\s*)"(.+)",\s*(.+)$/gm,`$1'"$2," $3'`);return{frontmatter:mQ.parse(q),content:O}}catch(q){return console.error("Failed to parse frontmatter YAML:",q),{frontmatter:{},content:Q}}}}async function pZ(Q){if(!Q)return"";let Z=Q.name?`<p class="BPHero-name">${Q.name}</p>`:"",$=Q.text?`<h1 class="BPHero-text">${Q.text}</h1>`:"",Y=Q.tagline?`<p class="BPHero-tagline">${Q.tagline}</p>`:"",J="";if(Q.actions)J=`<div class="BPHero-actions">${Q.actions.map((K)=>{return`<a class="${K.theme==="brand"?"BPButton BPButton-brand":"BPButton BPButton-alt"}" href="${K.link}">${K.text}</a>`}).join(`
|
|
7863
7863
|
`)}</div>`;let O=Q.image?`<div class="hero-image"><img src="${Q.image}" alt="${Q.name||""}" /></div>`:"";return await v("hero",{name:Z,text:$,tagline:Y,actions:J,image:O})}var mZ={Fast:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/></svg>',Shield:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>',Blade:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>',Tools:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>',Components:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>',Stream:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2 12h6l3-9 3 18 3-9h5"/></svg>',Desktop:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8m-4-4v4"/></svg>',Parser:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M16 18l6-6-6-6M8 6l-6 6 6 6"/></svg>',Icons:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/></svg>'};function hZ(Q){if(Q.startsWith("<")||/\p{Emoji}/u.test(Q))return Q;return mZ[Q]||`<span class="BPFeature-icon-text">${Q.charAt(0)}</span>`}async function gZ(Q){if(!Q||Q.length===0)return"";let Z=Q.map(($)=>{let Y=$.icon?hZ($.icon):"",J=Y?`<div class="BPFeature-icon">${Y}</div>`:"",O=$.link,q=O?"a":"div",K=O?` href="${O}"`:"";return`
|
|
7864
7864
|
<${q} class="BPFeature"${K}>
|
|
7865
7865
|
${J}
|
|
@@ -7881,15 +7881,15 @@ ${A}
|
|
|
7881
7881
|
`).filter((j)=>j.trim()).map((j)=>`<p>${sQ(j)}</p>`).join(`
|
|
7882
7882
|
`),G=await v(`blocks/containers/${q}`,{title:V,content:_});Y=Y.slice(0,J.index)+G+Y.slice(J.index+O.length)}return Y}function Q0(Q){let Z=Q.match(/^(\w+)/),$=Z?Z[1]:"",Y=Q.match(/\{([^}]+)\}/),J=[];if(Y){let q=Y[1].split(",");for(let K of q){let X=K.trim();if(X.includes("-")){let[z,V]=X.split("-").map(Number);for(let _=z;_<=V;_++)J.push(_)}else J.push(Number(X))}}let O=Q.includes(":line-numbers");return{lang:$,highlights:J,showLineNumbers:O}}async function Z0(Q,Z){let $=Q[Z],Y=$.match(/^(`{3,})/),J=Y?Y[1].length:3,O="`".repeat(J),q=$.substring(J).trim(),{lang:K,highlights:X,showLineNumbers:z}=Q0(q),V=[],_=Z+1;while(_<Q.length){let H=Q[_];if(H.match(new RegExp(`^\`{${J},}\\s*$`)))break;V.push(H),_++}let G=new Set,j=new Set,N=new Set,W=new Set,E=new Set,U=V.map((H,D)=>{let R=H;if(R.includes("// [!code focus]"))G.add(D),R=R.replace(/\/\/ \[!code focus\]/,"").trimEnd();if(R.includes("// [!code ++]"))j.add(D),R=R.replace(/\/\/ \[!code \+\+\]/,"").trimEnd();if(R.includes("// [!code --]"))N.add(D),R=R.replace(/\/\/ \[!code --\]/,"").trimEnd();if(R.includes("// [!code error]"))W.add(D),R=R.replace(/\/\/ \[!code error\]/,"").trimEnd();if(R.includes("// [!code warning]"))E.add(D),R=R.replace(/\/\/ \[!code warning\]/,"").trimEnd();return R}),F=G.size>0,A=U.join(`
|
|
7883
7883
|
`),B=P.markdown?.syntaxHighlightTheme||"github-light",w=(await t(A,K,B)).split(`
|
|
7884
|
-
`).map((H,D)=>{let R=D+1,a=X.includes(R),m=G.has(D),o=j.has(D),I=N.has(D),k=W.has(D),x=E.has(D),y=["line"];if(a)y.push("highlighted");if(m)y.push("focused");if(F&&!m)y.push("dimmed");if(o)y.push("diff-add");if(I)y.push("diff-remove");if(k)y.push("has-error");if(x)y.push("has-warning");if(H.startsWith('<span class="line">')){let aQ=y.join(" "),
|
|
7884
|
+
`).map((H,D)=>{let R=D+1,a=X.includes(R),m=G.has(D),o=j.has(D),I=N.has(D),k=W.has(D),x=E.has(D),y=["line"];if(a)y.push("highlighted");if(m)y.push("focused");if(F&&!m)y.push("dimmed");if(o)y.push("diff-add");if(I)y.push("diff-remove");if(k)y.push("has-error");if(x)y.push("has-warning");if(H.startsWith('<span class="line">')){let aQ=y.join(" "),UQ=H.replace('<span class="line">',`<span class="${aQ}">`);if(z)return`<span class="${y.join(" ")}"><span class="line-number">${R}</span>${UQ.replace(/^<span class="[^"]*">/,"").replace(/<\/span>$/,"")}</span>`;return UQ}let GQ=y.length>0?` class="${y.join(" ")}"`:"";if(z)return`<span${GQ}><span class="line-number">${R}</span>${H}</span>`;return`<span${GQ}>${H}</span>`}).join(`
|
|
7885
7885
|
`),L=[];if(z)L.push("line-numbers-mode");if(F)L.push("has-focused-lines");let b=L.length>0?` class="${L.join(" ")}"`:"",S=K?` data-lang="${K}"`:"";return{html:`<pre${b}${S}><code class="language-${K}">${w}</code></pre>`,endIndex:_}}function $0(Q){let Z=new Map;return{content:Q.replace(/^(#{1,6})\s+(.*?)\s*\{#([\w-]+)\}\s*$/gm,(Y,J,O,q)=>{let K=O.trim().replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").trim();return Z.set(K,q),`${J} ${O.trim()}`}),customAnchors:Z}}async function J0(Q,Z){let $=Q.split(`
|
|
7886
7886
|
`),Y=[],J=0,O=0;while(J<$.length){let q=$[J];if(q.match(/^`{3,}/)){let{html:K,endIndex:X}=await Z0($,J),z=`<!--BUNPRESS_CODE_${O++}-->`;Z.set(z,K),Y.push(""),Y.push(z),Y.push(""),J=X+1}else Y.push(q),J++}return Y.join(`
|
|
7887
7887
|
`)}function Y0(Q){return Q=Q.replace(/==(.+?)==/g,"<mark>$1</mark>"),Q=Q.replace(/\^(.+?)\^/g,"<sup>$1</sup>"),Q=Q.replace(/(?<!~)~(?!~)(.+?)(?<!~)~(?!~)/g,"<sub>$1</sub>"),Q}function O0(Q){return Q=Q.replace(/<table>/g,`<div class="table-responsive">
|
|
7888
7888
|
<table class="enhanced-table">`),Q=Q.replace(/<\/table>/g,`</table>
|
|
7889
|
-
</div>`),Q=Q.replace(/<(th|td) align="(left|center|right)">/g,(Z,$,Y)=>{return`<${$} style="text-align: ${Y}">`}),Q=Q.replace(/<(th|td)>/g,(Z,$)=>{return`<${$} style="text-align: left">`}),Q}function X0(Q,Z){let $=new Set;return Q.replace(/<h([1-6])([^>]*)>([\s\S]*?)<\/h\1>/g,(Y,J,O,q)=>{if(O.includes(" id="))return Y;let K=q.replace(/<[^>]+>/g,"").trim(),X=Z.get(K);if(!X)X=JQ(K);if($.has(X)){let z=1;while($.has(`${X}-${z}`))z++;X=`${X}-${z}`}return $.add(X),`<h${J} id="${X}"${O}>${q}</h${J}>`})}async function q0(Q,Z="./docs"){let{frontmatter:$,content:Y}=fZ(Q);if($.layout==="home"){let O=await pZ($.hero),q=await gZ($.features),K=Y.trim()?await cQ(Y,$,Z):"",X=K?`<div class="BPHome-content"><div class="bp-doc vp-doc container">${K}</div></div>`:"";return{html:O+q+X,frontmatter:$}}return{html:await cQ(Y,$,Z),frontmatter:$}}async function cQ(Q,Z,$){let Y=P.markdown?.features,J=(E)=>{if(!Y)return!0;let U=Y[E];return U===void 0||U===!0||typeof U==="object"&&U!==null},O=J("includes")?await iQ(Q,$):Q,q={...Z,data:await
|
|
7889
|
+
</div>`),Q=Q.replace(/<(th|td) align="(left|center|right)">/g,(Z,$,Y)=>{return`<${$} style="text-align: ${Y}">`}),Q=Q.replace(/<(th|td)>/g,(Z,$)=>{return`<${$} style="text-align: left">`}),Q}function X0(Q,Z){let $=new Set;return Q.replace(/<h([1-6])([^>]*)>([\s\S]*?)<\/h\1>/g,(Y,J,O,q)=>{if(O.includes(" id="))return Y;let K=q.replace(/<[^>]+>/g,"").trim(),X=Z.get(K);if(!X)X=JQ(K);if($.has(X)){let z=1;while($.has(`${X}-${z}`))z++;X=`${X}-${z}`}return $.add(X),`<h${J} id="${X}"${O}>${q}</h${J}>`})}async function q0(Q,Z="./docs"){let{frontmatter:$,content:Y}=fZ(Q);if($.layout==="home"){let O=await pZ($.hero),q=await gZ($.features),K=Y.trim()?await cQ(Y,$,Z):"",X=K?`<div class="BPHome-content"><div class="bp-doc vp-doc container">${K}</div></div>`:"";return{html:O+q+X,frontmatter:$}}return{html:await cQ(Y,$,Z),frontmatter:$}}async function cQ(Q,Z,$){let Y=P.markdown?.features,J=(E)=>{if(!Y)return!0;let U=Y[E];return U===void 0||U===!0||typeof U==="object"&&U!==null},O=J("includes")?await iQ(Q,$):Q,q={...Z,data:await NQ($),site:{title:P.title||P.markdown?.title||"",description:P.description||P.markdown?.meta?.description||"",themeConfig:P.themeConfig}},K=P.componentsDir?i(f.cwd(),P.componentsDir):i($,".components");O=await QQ(O,K,q);let X=O.replace(/```[\s\S]*?```/g,"");if(X.includes("@if")||X.includes("@foreach")||X.includes("@for (")||X.includes("<script server")||X.includes("@include")||/\{\{(?!\{)\s*\w/.test(X))try{let E=await import("@stacksjs/stx"),U=[],F=O.replace(/```[\s\S]*?```/g,(A)=>{return U.push(A),`\x00BPSTXCODE${U.length-1}\x00`}).replace(/`[^`\n]*`/g,(A)=>{return U.push(A),`\x00BPSTXCODE${U.length-1}\x00`});O=await E.renderString(F,q),O=O.replace(/\u0000BPSTXCODE(\d+)\u0000/g,(A,B)=>U[Number(B)]??"")}catch{}let{content:V,tocHtml:_}=J("inlineToc")?iZ(O,Z.toc):{content:O,tocHtml:""};O=J("codeImports")?await nZ(V,$):V,O=J("codeGroups")?await tZ(O):O,O=J("githubAlerts")?await oZ(O):O,O=J("containers")?await eZ(O):O,O=J("emoji")?dZ(O):O,O=J("badges")?cZ(O):O;let{content:G,customAnchors:j}=J("customAnchors")?$0(O):{content:O,customAnchors:new Map};O=G;let N=new Map;O=J("codeBlocks")?await J0(O,N):O;let W=Bun.markdown.html(O,{tables:!0,strikethrough:!0,tasklists:!0,autolinks:!0});for(let[E,U]of N)W=W.replace(`<p>${E}</p>`,U),W=W.replace(E,U);if(J("inlineFormatting"))W=Y0(W);if(J("tables"))W=O0(W);if(W=X0(W,j),_)W=aZ(W,_);if(J("externalLinks"))W=lZ(W),W=rZ(W);if(J("imageLazyLoading"))W=sZ(W);return W}async function K0(Q={}){let Z=Q.config||P,$=Q.port??3000,Y=Q.root||"./docs",J=Bun.serve({port:$,async fetch(K){let X=new URL(K.url),z=PZ(Z,X.pathname);if(z==="/")z="/index";if([".png",".jpg",".jpeg",".gif",".svg",".css",".js",".ico",".woff",".woff2",".ttf"].some((G)=>z.endsWith(G)))try{let G=`${Y}/public${z}`,j=Bun.file(G);if(await j.exists())return new Response(j);let N=`${Y}${z}`,W=Bun.file(N);if(await W.exists())return new Response(W)}catch{}let _=`${Y}${z}.md`;try{let G=Bun.file(_);if(await G.exists()){let j=await G.text(),{html:N,frontmatter:W}=await q0(j,Y),E=W.layout||"doc",U=await gQ(N,Z,z,E);return new Response(U,{headers:{"Content-Type":"text/html; charset=utf-8"}})}}catch{}return new Response(await gQ("<h1>404 - Page Not Found</h1><p>The page you are looking for does not exist.</p>",Z,z),{status:404,headers:{"Content-Type":"text/html; charset=utf-8"}})}}),O=`http://localhost:${J.port}`,q=()=>J.stop();if(!Q.quiet)console.log(`
|
|
7890
7890
|
\uD83D\uDCDA BunPress documentation server running at ${O}`),console.log(`Press Ctrl+C to stop
|
|
7891
7891
|
`);return{server:J,url:O,stop:q}}async function l0(Q={}){let{stop:Z}=await K0(Q),$=Q.watch!==void 0?Q.watch:!0,Y=Q.root||"./docs";if($){console.log(`Watching for changes in ${Y} directory...
|
|
7892
|
-
`);try{let J=new Map,O=new
|
|
7892
|
+
`);try{let J=new Map,O=new pQ("**/*.{md,stx,ts,js,css,html}");for await(let X of O.scan(Y))try{let z=i(Y,X),V=await hQ(z);J.set(X,V.mtimeMs)}catch{}let q=null,K=()=>{if(q)clearTimeout(q);q=setTimeout(async()=>{console.log("File changed detected, reloading..."),LQ(),IQ(),EQ(),console.log("Ready for requests")},100)};setInterval(async()=>{try{let X=!1,z=new Set,V=new pQ("**/*.{md,stx,ts,js,css,html}");for await(let _ of V.scan(Y)){z.add(_);try{let G=i(Y,_),j=await hQ(G),N=J.get(_);if(N===void 0||j.mtimeMs>N)X=!0,J.set(_,j.mtimeMs)}catch{}}for(let _ of J.keys())if(!z.has(_))X=!0,J.delete(_);if(X)K()}catch{}},1000)}catch(J){console.error("Error setting up file watcher:",J)}}f.on("SIGINT",()=>{console.log(`
|
|
7893
7893
|
Shutting down server...`),Z(),f.exit(0)}),f.on("SIGTERM",()=>{console.log(`
|
|
7894
7894
|
Shutting down server...`),Z(),f.exit(0)}),await new Promise(()=>{})}
|
|
7895
|
-
export{G0 as a,n as b,
|
|
7895
|
+
export{G0 as a,n as b,AQ as c,t as d,U0 as e,BQ as f,j0 as g,N0 as h,$Q as i,JQ as j,fQ as k,YQ as l,OQ as m,XQ as n,l as o,r as p,FZ as q,MZ as r,IZ as s,H0 as t,P0 as u,y0 as v,v0 as w,k0 as x,rQ as y,PZ as z,gQ as A,q0 as B,K0 as C,l0 as D};
|
|
@@ -1186,4 +1186,4 @@ if (typeof document !== 'undefined') {
|
|
|
1186
1186
|
});
|
|
1187
1187
|
}
|
|
1188
1188
|
`],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}},q=await h({name:"bunpress",alias:"docs",defaultConfig:j});async function x(){return q}
|
|
1189
|
-
export{j as
|
|
1189
|
+
export{j as Q,q as R,x as S};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{M as W6,N as U6,P as V6}from"./chunk-qdmkac4z.js";import{R as O}from"./chunk-m0g9vk1e.js";import{T as y}from"./chunk-wmvgjzgh.js";var{Glob:j6}=globalThis.Bun;import{copyFile as i6,mkdir as A6,readdir as s6}from"fs/promises";import{existsSync as r6}from"fs";import{join as D,resolve as e6}from"path";import I from"process";import{CLI as t6}from"@stacksjs/clapp";var s="0.1.21";import{existsSync as z6}from"fs";import{rm as L6}from"fs/promises";import{join as I6}from"path";var z={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 x(K,Z){return`${z[Z]}${K}${z.reset}`}function G(K){console.log(`${z.green}\u2713${z.reset} ${K}`)}function W(K){console.error(`${z.red}\u2717${z.reset} ${K}`)}function g(K){console.warn(`${z.yellow}\u26A0${z.reset} ${K}`)}function B(K){console.log(`${z.blue}\u2139${z.reset} ${K}`)}function S(K){if(K===0)return"0 B";let Z=1024,Q=["B","KB","MB","GB"],$=Math.floor(Math.log(K)/Math.log(Z));return`${Number.parseFloat((K/Z**$).toFixed(2))} ${Q[$]}`}function f(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var r=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class C{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(K){this.text=K}start(){if(r){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let K=this.frames[this.index];process.stdout.write(`\r${z.cyan}${K}${z.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(K){this.stop(),G(K||this.text)}fail(K){this.stop(),W(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!r)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function u(K,Z=!1){let Q=Z?"Y/n":"y/N";process.stdout.write(`${z.cyan}?${z.reset} ${K} ${z.dim}(${Q})${z.reset}: `);let $=Bun.file("/dev/stdin").stream().getReader(),N=new TextDecoder,{value:X}=await $.read(),Y=N.decode(X).trim().toLowerCase();if(!Y)return Z;return Y==="y"||Y==="yes"}function h(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let N of Z)Q[N]=Math.max(N.length,...K.map((X)=>String(X[N]).length));let $=Z.map((N)=>N.padEnd(Q[N])).join(" ");console.log(x($,"bold")),console.log("\u2500".repeat($.length));for(let N of K){let X=Z.map((Y)=>String(N[Y]).padEnd(Q[Y])).join(" ");console.log(X)}}async function d(K){try{return Bun.file(K).size}catch{return 0}}async function S6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let N of Q.scan(K)){let X=`${K}/${N}`,Y=await d(X);$+=Y}return $}catch{return 0}}async function e(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=I6(Q,".bunpress"),N=K.force||!1,X=K.verbose||!1;try{if(!z6($))return B(`Directory "${$}" does not exist, nothing to clean`),!0;let q=await S6($);if(X)B(`Found "${$}" (${S(q)})`);if(!N){if(!await u(`Delete "${$}" directory? (${S(q)})`,!1))return B("Clean cancelled"),!1}let _=process.env.VITEST==="true"||!1,R=null;if(!_&&!X)R=new C("Cleaning build artifacts..."),R.start();if(await L6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${S(q)} from "${$}"`);else if(X||_)G(`Cleaned ${S(q)} from "${$}"`);return!0}catch(Y){return W(`Failed to clean directory: ${Y}`),!1}}import{existsSync as p}from"fs";import{join as l}from"path";async function t(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let N of Z){let X=l(process.cwd(),N);if(p(X)){Q=X;break}}if(!Q)return W("No configuration file found"),B('Run "bunpress config init" to create one'),!1;G(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(x("Configuration:","bold")),console.log($),!0}catch(Z){return W(`Failed to show configuration: ${Z}`),!1}}async function o(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let q of Q){let _=l(process.cwd(),q);if(p(_)){$=_;break}}if(!$)return W("No configuration file found"),!1;if(Z)B(`Validating ${$}...`);let X=(await import($)).default;if(!X)return W("Configuration file does not export a default object"),!1;let Y=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")Y.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")Y.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))Y.push("nav should be an array");else for(let[q,_]of X.nav.entries())if(!_.text||!_.link)Y.push(`nav[${q}] is missing required fields (text, link)`)}if(X.sitemap){if(!X.sitemap.hostname)Y.push("sitemap.hostname is required for SEO")}if(Y.length>0){W("Configuration validation failed:");for(let q of Y)console.log(` \u2022 ${q}`);return!1}return G("Configuration is valid \u2713"),!0}catch(Q){return W(`Failed to validate configuration: ${Q}`),!1}}async function K6(K={}){let Z=l(process.cwd(),"bunpress.config.ts");if(p(Z))return W("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
verbose: false,
|
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
} satisfies BunPressConfig
|
|
55
55
|
`;try{return await Bun.write(Z,Q),G(`Created ${Z}`),!0}catch($){return W(`Failed to create configuration: ${$}`),!1}}import{existsSync as w}from"fs";import{join as k}from"path";async function Q6(K={}){let Z=K.verbose||!1,Q=[];console.log(x(`
|
|
56
56
|
Running diagnostics...
|
|
57
|
-
`,"bold"));try{let H=Bun.version;Q.push({name:"Bun Runtime",status:"pass",message:`v${H}`})}catch(H){Q.push({name:"Bun Runtime",status:"fail",message:"Not found"})}let $=["bunpress.config.ts","bunpress.config.js"],
|
|
57
|
+
`,"bold"));try{let H=Bun.version;Q.push({name:"Bun Runtime",status:"pass",message:`v${H}`})}catch(H){Q.push({name:"Bun Runtime",status:"fail",message:"Not found"})}let $=["bunpress.config.ts","bunpress.config.js"],N=!1;for(let H of $)if(w(k(process.cwd(),H))){N=!0,Q.push({name:"Configuration",status:"pass",message:H});break}if(!N)Q.push({name:"Configuration",status:"warn",message:"No config file found (using defaults)"});let X=k(process.cwd(),"docs");if(w(X)){let{Glob:H}=awaitPromise.resolve(globalThis.Bun),T=new H("**/*.md"),L=0;for await(let F of T.scan(X))L++;Q.push({name:"Documentation",status:L>0?"pass":"warn",message:`${L} markdown files`})}else Q.push({name:"Documentation",status:"fail",message:"docs/ directory not found"});let Y=k(process.cwd(),"package.json");if(w(Y)){let H=await Bun.file(Y).json(),T=H.scripts?.dev,L=H.scripts?.build;Q.push({name:"Package Scripts",status:T&&L?"pass":"warn",message:`dev: ${T?"\u2713":"\u2717"}, build: ${L?"\u2713":"\u2717"}`});let F=H.dependencies?.["@stacksjs/bunpress"]||H.devDependencies?.["@stacksjs/bunpress"];Q.push({name:"BunPress Package",status:F?"pass":"warn",message:F||"Not installed"})}else Q.push({name:"Package.json",status:"warn",message:"Not found"});let q=k(process.cwd(),"node_modules");if(w(q))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 _=k(process.cwd(),".git");if(w(_))Q.push({name:"Git Repository",status:"pass",message:"Initialized"});else Q.push({name:"Git Repository",status:"warn",message:"Not initialized"});let R=k(process.cwd(),"tsconfig.json");if(w(R))Q.push({name:"TypeScript",status:"pass",message:"tsconfig.json found"});else Q.push({name:"TypeScript",status:"warn",message:"tsconfig.json not found"});for(let H of Q){let T=H.status==="pass"?"\u2713":H.status==="fail"?"\u2717":"\u26A0",L=H.status==="pass"?"green":H.status==="fail"?"red":"yellow";console.log(` ${x(T,L)} ${H.name}: ${x(H.message,"dim")}`)}console.log();let U=Q.filter((H)=>H.status==="pass").length,A=Q.filter((H)=>H.status==="fail").length,J=Q.filter((H)=>H.status==="warn").length;if(A>0){if(W(`${A} checks failed, ${J} warnings`),console.log(),B("Recommended actions:"),Q.find((H)=>H.name==="Documentation"&&H.status==="fail"))console.log(' \u2022 Run "bunpress init" to create docs directory');if(Q.find((H)=>H.name==="Dependencies"&&H.status==="warn"))console.log(' \u2022 Run "bun install" to install dependencies');if(Q.find((H)=>H.name==="BunPress Package"&&H.status==="warn"))console.log(' \u2022 Run "bun add @stacksjs/bunpress" to install BunPress');return!1}else if(J>0)return g(`${U} checks passed, ${J} warnings`),!0;else return G(`All ${U} checks passed!`),!0}import{mkdir as a}from"fs/promises";var y6=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
58
58
|
|
|
59
59
|
export default {
|
|
60
60
|
verbose: false,
|
|
@@ -166,14 +166,14 @@ Check out the [markdown extensions](/guide/markdown) to learn about all the powe
|
|
|
166
166
|
- Learn about [configuration](/guide/configuration)
|
|
167
167
|
- Explore [advanced features](/guide/advanced)
|
|
168
168
|
- Read the [API reference](/api/)
|
|
169
|
-
`,
|
|
169
|
+
`,D6=`node_modules/
|
|
170
170
|
dist/
|
|
171
171
|
.DS_Store
|
|
172
172
|
*.log
|
|
173
173
|
.env
|
|
174
174
|
.env.*
|
|
175
175
|
!.env.example
|
|
176
|
-
`,
|
|
176
|
+
`,C6=`# My BunPress Documentation
|
|
177
177
|
|
|
178
178
|
Documentation powered by [BunPress](https://github.com/stacksjs/bunpress).
|
|
179
179
|
|
|
@@ -200,7 +200,7 @@ Preview the built site:
|
|
|
200
200
|
\`\`\`bash
|
|
201
201
|
bun run preview
|
|
202
202
|
\`\`\`
|
|
203
|
-
`;async function Z6(K={}){try{if(await Bun.file("./docs").exists()&&!K.force){if(!await u("Documentation directory already exists. Continue?",!1))return B("Initialization cancelled"),!1}let Q=new
|
|
203
|
+
`;async function Z6(K={}){try{if(await Bun.file("./docs").exists()&&!K.force){if(!await u("Documentation directory already exists. Continue?",!1))return B("Initialization cancelled"),!1}let Q=new C("Initializing BunPress project...");Q.start(),await a("./docs",{recursive:!0}),await a("./docs/guide",{recursive:!0}),await a("./docs/public",{recursive:!0}),await Bun.write("./bunpress.config.ts",y6),await Bun.write("./docs/index.md",E6),await Bun.write("./docs/guide/index.md",F6);let $=await Bun.file("./.gitignore").exists();if(!$)await Bun.write("./.gitignore",D6);let N=await Bun.file("./README.md").exists();if(!N)await Bun.write("./README.md",C6);let X="./package.json";if(await Bun.file(X).exists()){let q=await Bun.file(X).json();q.scripts=q.scripts||{},q.scripts.dev=q.scripts.dev||"bunpress dev",q.scripts.build=q.scripts.build||"bunpress build",q.scripts.preview=q.scripts.preview||"bunpress preview",await Bun.write(X,JSON.stringify(q,null,2))}if(Q.succeed("BunPress project initialized successfully!"),console.log(),G("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/"),!$)console.log(" \u2022 .gitignore");if(!N)console.log(" \u2022 README.md");return console.log(),B("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(Z){return W(`Failed to initialize project: ${Z}`),!1}}import{mkdir as v6}from"fs/promises";import{dirname as w6,join as k6}from"path";var $6={default:(K)=>`---
|
|
204
204
|
title: ${K}
|
|
205
205
|
description:
|
|
206
206
|
---
|
|
@@ -278,17 +278,17 @@ Post content goes here...
|
|
|
278
278
|
## Section 1
|
|
279
279
|
|
|
280
280
|
Content...
|
|
281
|
-
`};async function X6(K,Z={}){try{let Q=K.endsWith(".md")?K:`${K}.md`,$=k6(process.cwd(),"docs",Q);if(await Bun.file($).exists())return W(`File already exists: ${Q}`),!1;let X=Z.title;if(!X)X=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(" ");let Y=Z.template||"default",
|
|
282
|
-
`),await new Promise(()=>{})}catch(
|
|
281
|
+
`};async function X6(K,Z={}){try{let Q=K.endsWith(".md")?K:`${K}.md`,$=k6(process.cwd(),"docs",Q);if(await Bun.file($).exists())return W(`File already exists: ${Q}`),!1;let X=Z.title;if(!X)X=(Q.split("/").pop()?.replace(".md","")||"").split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(" ");let Y=Z.template||"default",q=$6[Y];if(!q)return W(`Unknown template: ${Y}`),W(`Available templates: ${Object.keys($6).join(", ")}`),!1;let _=q(X),R=w6($);return await v6(R,{recursive:!0}),await Bun.write($,_),G(`Created ${Q}`),console.log(),console.log(` Title: ${X}`),console.log(` Template: ${Y}`),console.log(` Path: ${$}`),!0}catch(Q){return W(`Failed to create file: ${Q}`),!1}}import{join as Y6}from"path";async function N6(K={}){let Z=K.port||3000,Q=await O,$=K.outdir||Q.outDir||"./dist",N=Y6($,".bunpress"),X=K.verbose||!1;try{let{stat:Y}=await import("fs/promises");try{if(!(await Y(N)).isDirectory())W(`"${N}" is not a directory.`),W('Run "bunpress build" first to generate the documentation.'),process.exit(1)}catch{W(`Build directory "${N}" not found.`),W('Run "bunpress build" first to generate the documentation.'),process.exit(1)}B(`Starting preview server from ${N}`);try{let q=Bun.serve({port:Z,fetch:async(_)=>{let U=new URL(_.url).pathname;if(U.startsWith("/"))U=U.slice(1);if(U===""||U==="/")U="index.html";let A=Y6(N,U),J=Bun.file(A);if(await J.exists())return new Response(J,{headers:{"Content-Type":P6(U)}});let T=`${A}.html`,L=Bun.file(T);if(await L.exists())return new Response(L,{headers:{"Content-Type":"text/html"}});return new Response("404 - Not Found",{status:404})}});G(`Preview server running at http://localhost:${Z}`),console.log(`Press Ctrl+C to stop
|
|
282
|
+
`),await new Promise(()=>{})}catch(q){if(q.message?.includes("EADDRINUSE")||q.code==="EADDRINUSE")W(`Port ${Z} is already in use.`),W("Try running with a different port: bunpress preview --port <port>"),W(`Or stop any processes using port ${Z}`);else W(`Failed to start server: ${q.message||q}`);process.exit(1)}}catch(Y){W(`Failed to start preview server: ${Y}`),process.exit(1)}}function P6(K){let Z=K.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"}[Z||""]||"text/plain"}import*as v from"fs";import*as E from"path";var{YAML:q6}=globalThis.Bun;async function H6(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.fix||!1;if(B("\uD83D\uDD0D Running SEO checks..."),console.log(""),!v.existsSync(Q))W(`Documentation directory not found: ${Q}`),process.exit(1);let N={totalPages:0,errors:[],warnings:[],passed:0},X=await g6(Q);N.totalPages=X.length;for(let Y of X)await h6(Y,Q,N,$);if(l6(N),N.errors.length>0)process.exit(1)}async function h6(K,Z,Q,$){let N=await v.promises.readFile(K,"utf-8"),{frontmatter:X,markdown:Y}=u6(N),q=E.relative(Z,K),_=!1,R=$&&Object.keys(X).length>0,U={...X};if(!X.title){let H=d6(Y);if(!H)Q.errors.push({type:"error",category:"Title",file:q,message:"Missing title in frontmatter"}),_=!0;else if($)U.title=H,R=!0,B(`\u2713 Added title to ${q}: "${H}"`);else Q.warnings.push({type:"warning",category:"Title",file:q,message:`No title in frontmatter (could extract: "${H}")`}),_=!0}else{let H=X.title.length;if(H>60)Q.warnings.push({type:"warning",category:"Title",file:q,message:`Title too long (${H} chars, recommended <60)`}),_=!0;else if(H<10)Q.warnings.push({type:"warning",category:"Title",file:q,message:`Title too short (${H} chars, recommended >10)`}),_=!0}if(!X.description){let H=c6(Y);if($)U.description=H,R=!0,B(`\u2713 Added description to ${q}`);else Q.warnings.push({type:"warning",category:"Description",file:q,message:"Missing description in frontmatter"}),_=!0}else{let H=X.description.length;if(H>160)Q.warnings.push({type:"warning",category:"Description",file:q,message:`Description too long (${H} chars, recommended <160)`}),_=!0;else if(H<50)Q.warnings.push({type:"warning",category:"Description",file:q,message:`Description too short (${H} chars, recommended >50)`}),_=!0}let A=f6(Y,Z,K);for(let H of A)Q.errors.push({type:"error",category:"Links",file:q,message:`Broken internal link: ${H}`}),_=!0;let J=p6(Y);for(let H of J)Q.warnings.push({type:"warning",category:"Images",file:q,message:`Image missing alt text: ${H}`}),_=!0;if(R){let H=m6(U,Y);await v.promises.writeFile(K,H,"utf-8")}if(!_)Q.passed++}function m6(K,Z){return`---
|
|
283
283
|
${q6.stringify(K,null,2)}
|
|
284
284
|
---
|
|
285
|
-
${Z}`}async function g6(K){let Z=[];async function Q($){let
|
|
285
|
+
${Z}`}async function g6(K){let Z=[];async function Q($){let N=await v.promises.readdir($,{withFileTypes:!0});for(let X of N){let Y=E.join($,X.name);if(X.isDirectory()){if(!X.name.startsWith(".")&&X.name!=="node_modules"&&X.name!=="public")await Q(Y)}else if(X.isFile()&&X.name.endsWith(".md"))Z.push(Y)}}return await Q(K),Z}function u6(K){let Z=/^---\n([\s\S]*?)\n---\n?/,Q=K.match(Z);if(!Q)return{frontmatter:{},markdown:K};let $=Q[1],N=K.slice(Q[0].length);try{return{frontmatter:q6.parse($),markdown:N}}catch{return{frontmatter:{},markdown:K}}}function d6(K){let Z=K.match(/^#\s+(.+)$/m);return Z?Z[1].trim():null}function c6(K,Z=155){let Q=K.replace(/^#{1,6}\s+.+$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]+`/g,"").replace(/!\[.*?\]\(.*?\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_~]/g,"").trim(),$=Q.split(`
|
|
286
286
|
|
|
287
|
-
`)[0]||Q;if($.length>Z)return`${$.slice(0,Z)}...`;return $||"Documentation page"}function f6(K,Z,Q){let $=[],
|
|
288
|
-
`),$=0,
|
|
287
|
+
`)[0]||Q;if($.length>Z)return`${$.slice(0,Z)}...`;return $||"Documentation page"}function f6(K,Z,Q){let $=[],N=/\[([^\]]+)\]\(([^)]+)\)/g,X=K.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`+[^`\n]*`+/g,"").replace(/<!--[\s\S]*?-->/g,""),Y;while((Y=N.exec(X))!==null){let q=Y[2].trim();if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(q))continue;if(q.startsWith("#"))continue;let _=q.split("#",1)[0].split("?",1)[0];if(!_)continue;let R;try{R=decodeURIComponent(_.replace(/^<|>$/g,""))}catch{$.push(q);continue}let U=R.startsWith("/")?E.resolve(Z,`.${R}`):E.resolve(E.dirname(Q),R);if(!(U.endsWith(".md")?[U]:[U,`${U}.md`,E.join(U,"index.md")]).some((J)=>v.existsSync(J)))$.push(q)}return $}function p6(K){let Z=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,$;while(($=Q.exec(K))!==null){let N=$[1],X=$[2];if(!N||N.trim()==="")Z.push(X)}return Z}function l6(K){if(console.log(""),B("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${x(K.totalPages.toString(),"blue")}`),console.log(`Passed: ${x(K.passed.toString(),"green")}`),console.log(`Errors: ${x(K.errors.length.toString(),K.errors.length>0?"red":"green")}`),console.log(`Warnings: ${x(K.warnings.length.toString(),K.warnings.length>0?"yellow":"green")}`),console.log(""),K.errors.length>0){W(`\u2717 ${K.errors.length} errors found:`),console.log("");let Z=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));h(Z),console.log("")}if(K.warnings.length>0){g(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let Z=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));h(Z),console.log("")}if(K.errors.length===0&&K.warnings.length===0)G("\u2713 All SEO checks passed!");else if(K.errors.length===0)G("\u2713 No errors found (only warnings)")}import{join as a6}from"path";async function n6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
|
|
288
|
+
`),$=0,N=!1,X=[];for(let R of Q){if(R.trim().startsWith("```")){N=!N;continue}if(!N)X.push(R)}$=X.join(" ").split(/\s+/).filter((R)=>R.length>0).length;let q=Q.filter((R)=>R.match(/^#{1,6}\s+/)).length,_=(Z.match(/```/g)||[]).length/2;return{path:K,size:await d(K),lines:Q.length,words:$,headings:q,codeBlocks:Math.floor(_)}}async function _6(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.verbose||!1;try{console.log(x(`
|
|
289
289
|
Analyzing documentation...
|
|
290
|
-
`,"bold"));let{Glob:
|
|
291
|
-
Generated ${U.length} HTML files in ${$}`);return!0}catch(A){if(!X)R.fail("Build failed");return console.error("Error during build:",A),!1}}async function
|
|
290
|
+
`,"bold"));let{Glob:N}=awaitPromise.resolve(globalThis.Bun),X=new N("**/*.md"),Y=[];for await(let M of X.scan(Q)){let V=a6(Q,M),c=await n6(V);Y.push(c)}if(Y.length===0)return W("No markdown files found"),!1;let q=Y.reduce((M,V)=>M+V.size,0),_=Y.reduce((M,V)=>M+V.lines,0),R=Y.reduce((M,V)=>M+V.words,0),U=Y.reduce((M,V)=>M+V.headings,0),A=Y.reduce((M,V)=>M+V.codeBlocks,0);if(console.log(x("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${Y.length}`),console.log(`Total size: ${S(q)}`),console.log(`Total lines: ${_.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${U}`),console.log(`Code blocks: ${A}`),console.log(),$){console.log(x("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let M=Y.map((V)=>({File:V.path.replace(`${Q}/`,""),Size:S(V.size),Lines:V.lines,Words:V.words,Headings:V.headings,"Code Blocks":V.codeBlocks}));h(M),console.log()}let J=q/Y.length,H=_/Y.length,T=R/Y.length;console.log(x("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${S(J)}`),console.log(`Lines: ${Math.round(H)}`),console.log(`Words: ${Math.round(T)}`),console.log();let L=[...Y].sort((M,V)=>V.size-M.size).slice(0,5);if(L.length>0){console.log(x("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let M of L){let V=M.path.replace(`${Q}/`,"");console.log(` ${V.padEnd(40)} ${S(M.size)}`)}console.log()}let F=Math.ceil(R/200);return B(`Estimated reading time: ${F} minutes`),!0}catch(N){return W(`Failed to generate statistics: ${N}`),!1}}var b=new t6("bunpress"),j={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function M6(K){let Z=new j6("**/*.md"),Q=[];for await(let $ of Z.scan(K))Q.push(D(K,$));return Q}async function o6(K,Z,Q=!1){let $=`${Z}/public`;try{await s6($);let N=new j6("**/*");for await(let X of N.scan($)){let Y=D($,X),q=D(K,X);await A6(D(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await i6(Y,q)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function K4(K,Z,Q){try{let $=await O;if($.sitemap?.enabled!==!1&&$.sitemap?.baseUrl)await V6(K,Z,$);if($.robots?.enabled!==!1)await U6(Z,$);if($.rss?.enabled)await W6(K,Z,$,$.rss)}catch($){if(Q)console.error("Error generating SEO files:",$)}}async function Q4(K={}){let Z=await O;if(!K.config)return Z;let Q=e6(I.cwd(),K.config);if(!r6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),N=$.default??$;return{...Z,...N}}async function R6(K={}){let Z=await Q4(K),Q=K.outdir||Z.outDir||j.outdir,$=D(Q,".bunpress"),N=K.dir||Z.docsDir||j.docsdir,X=K.verbose??j.verbose,Y=K.minify??!1,q=K.sourcemap??!1,_=performance.now(),R=new C("Building documentation...");if(!X)R.start();await A6($,{recursive:!0});let U=await M6(N);if(U.length===0){if(!X)R.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 ${U.length} markdown files:`),U.forEach((A)=>console.log(`- ${A}`));try{let{markdownToHtml:A,wrapInLayout:J}=await import("./chunk-qrp18ybj.js"),{mkdir:H,writeFile:T}=await import("fs/promises");if(X)console.log("Transforming markdown to HTML...");for(let M of U){let V=await Bun.file(M).text(),{html:c,frontmatter:B6}=await A(V,N),G6=M.replace(/^\.\//,""),J6=N.replace(/^\.\//,""),P=G6.replace(J6,"").replace(/^\//,"").replace(/\.md$/,""),x6=`/${P}`,T6=B6.layout||"doc",O6=await J(c,Z,x6,T6),m=P==="index"||P.endsWith("/index")?D($,`${P}.html`):D($,P,"index.html"),i=m.substring(0,m.lastIndexOf("/"));if(i)await H(i,{recursive:!0});if(await T(m,O6),X)console.log(`Generated: ${m}`)}if(X)console.log(`Processed ${U.length} markdown files.`);await o6($,N,X),await $4($),await Z4($,Z),await K4(N,$,X||!1);let F=performance.now()-_;if(!X)R.succeed(`Built ${U.length} pages to HTML in ${f(F)}`);else G(`Build completed in ${f(F)}`),console.log(`
|
|
291
|
+
Generated ${U.length} HTML files in ${$}`);return!0}catch(A){if(!X)R.fail("Build failed");return console.error("Error during build:",A),!1}}async function Z4(K,Z){let{wrapInLayout:Q}=await import("./chunk-qrp18ybj.js"),$=`
|
|
292
292
|
<style>
|
|
293
293
|
.NotFound {
|
|
294
294
|
padding: 64px 24px 96px;
|
|
@@ -365,7 +365,7 @@ Generated ${U.length} HTML files in ${$}`);return!0}catch(A){if(!X)R.fail("Build
|
|
|
365
365
|
</a>
|
|
366
366
|
</div>
|
|
367
367
|
</div>
|
|
368
|
-
`,
|
|
368
|
+
`,N=await Q(`
|
|
369
369
|
<style>
|
|
370
370
|
.NotFound {
|
|
371
371
|
padding: 64px 24px 96px;
|
|
@@ -442,26 +442,26 @@ Generated ${U.length} HTML files in ${$}`);return!0}catch(A){if(!X)R.fail("Build
|
|
|
442
442
|
</a>
|
|
443
443
|
</div>
|
|
444
444
|
</div>
|
|
445
|
-
`,Z,"/404","doc");await Bun.write(
|
|
446
|
-
Watching for changes...`),Q(
|
|
447
|
-
Detected change in ${Y}, rebuilding...`),await R6(K)}),await new Promise(()=>{})}});b.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:j.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:j.watch}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{let Z=await O,Q=K.port||j.port,$=K.dir||Z.docsDir||j.docsdir,
|
|
445
|
+
`,Z,"/404","doc");await Bun.write(D(K,"404.html"),N)}async function $4(K){let Z=D(K,"index.html");try{if(!await Bun.file(Z).exists())console.error("Warning: No index.html found at root")}catch(Q){console.error("Error checking root index.html:",Q)}}b.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:j.verbose}).action(async(K)=>{if(!await R6(K))I.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await O,N=K.dir||$.docsDir||"./docs";console.log(`
|
|
446
|
+
Watching for changes...`),Q(N,{recursive:!0},async(X,Y)=>{if(Y&&Y.endsWith(".md"))console.log(`
|
|
447
|
+
Detected change in ${Y}, rebuilding...`),await R6(K)}),await new Promise(()=>{})}});b.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:j.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:j.watch}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{let Z=await O,Q=K.port||j.port,$=K.dir||Z.docsDir||j.docsdir,N=K.watch??j.watch,X=K.verbose??j.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:N,verbose:X});let{serveCLI:Y}=await import("./chunk-qrp18ybj.js");await Y({port:Q,root:$,watch:N,config:Z})});async function X4(K={}){let Z=await O,Q=K.dir||Z.docsDir||j.docsdir,$=K.output||"./docs.md",N=K.full??!1,X=K.verbose??j.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${N}`);let Y=await M6(Q);if(Y.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${Y.length} markdown files`);Y.sort();let q=`# Documentation
|
|
448
448
|
|
|
449
|
-
`;
|
|
449
|
+
`;q+=`Generated: ${new Date().toISOString()}
|
|
450
450
|
|
|
451
|
-
`,
|
|
451
|
+
`,q+=`Total files: ${Y.length}
|
|
452
452
|
|
|
453
|
-
`,
|
|
453
|
+
`,q+=`---
|
|
454
454
|
|
|
455
|
-
`;for(let _ of Y){let R=_.replace(`${Q}/`,""),U=await Bun.file(_).text();if(X)console.log(`Processing: ${R}`);if(
|
|
455
|
+
`;for(let _ of Y){let R=_.replace(`${Q}/`,""),U=await Bun.file(_).text();if(X)console.log(`Processing: ${R}`);if(q+=`## File: ${R}
|
|
456
456
|
|
|
457
|
-
`,q
|
|
457
|
+
`,N)q+=U,q+=`
|
|
458
458
|
|
|
459
459
|
`;else{let A=U.split(`
|
|
460
|
-
`),J=!1,H="";for(let T of A){if(T.trim()==="---")if(!J){J=!0;continue}else{if(J=!1,H)
|
|
461
|
-
`;continue}if(T.match(/^#{1,6}\s+/))
|
|
462
|
-
`}
|
|
463
|
-
`}
|
|
464
|
-
|
|
465
|
-
`}return await Bun.write($,
|
|
466
|
-
LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(
|
|
467
|
-
export{G as E,W as F,B as G,
|
|
460
|
+
`),J=!1,H="";for(let T of A){if(T.trim()==="---")if(!J){J=!0;continue}else{if(J=!1,H)q+="**Frontmatter:**\n```yaml\n",q+=H,q+="```\n\n",H="";continue}if(J){H+=`${T}
|
|
461
|
+
`;continue}if(T.match(/^#{1,6}\s+/))q+=`${T}
|
|
462
|
+
`}q+=`
|
|
463
|
+
`}q+=`---
|
|
464
|
+
|
|
465
|
+
`}return await Bun.write($,q),console.log(`
|
|
466
|
+
LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(q.length/1024).toFixed(2)} KB`),!0}b.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:j.verbose}).action(async(K)=>{if(!await X4(K))I.exit(1)});b.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(K)=>{if(!await Z6(K))I.exit(1)});b.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:j.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{await N6(K)});b.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:j.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await e(K))I.exit(1)});b.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await Q6(K))I.exit(1)});b.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await t(K))I.exit(1)});b.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await o(K))I.exit(1)});b.command("config:init","Initialize configuration file").action(async(K)=>{if(!await K6(K))I.exit(1)});b.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:j.verbose}).action(async(K,Z)=>{if(!await X6(K,Z))I.exit(1)});b.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await _6(K))I.exit(1)});b.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(K)=>{await H6(K)});b.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:j.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-zmxtnx2v.js");if(!await Z(K))I.exit(1)});b.help();b.version(s);var n=Bun.argv[1]||"",Y4=n.endsWith("/bunpress")||n.endsWith("/cli.ts")||n.endsWith("/cli.js");if(Y4)b.parse();
|
|
467
|
+
export{G as E,W as F,B as G,C as H,M6 as I,Q4 as J,R6 as K};
|
|
@@ -30,4 +30,4 @@ ${Q.map((V)=>{let W=`${j}/${V}`,B=new Date().toISOString();return` <sitemap>
|
|
|
30
30
|
</sitemap>`}).join(`
|
|
31
31
|
`)}
|
|
32
32
|
</sitemapindex>`,$=Y.join(J,K);await A.promises.writeFile($,_,"utf-8")}function F(H){return(typeof H==="string"?new Date(H):H).toISOString().split("T")[0]}function m(H,J){let j=[];for(let K=0;K<H.length;K+=J)j.push(H.slice(K,K+J));return j}
|
|
33
|
-
export{k as
|
|
33
|
+
export{k as L,g as M,l as N,s as O,o as P};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{A as c,B as d,C as e,D as f,y as a,z as b}from"./chunk-
|
|
2
|
+
import{A as c,B as d,C as e,D as f,y as a,z as b}from"./chunk-kxr6zf7e.js";import"./chunk-m0g9vk1e.js";import"./chunk-wmvgjzgh.js";export{c as wrapInLayout,b as stripConfiguredBasePath,e as startServer,f as serveCLI,d as markdownToHtml,a as getConfiguredBasePath};
|