@stacksjs/bunpress 0.2.0 → 0.2.2

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.
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$ as M,Y as _}from"./chunk-n0ebp7d8.js";import{loadConfig as A}from"bunfig";var S={docsDir:"./docs",outDir:"./dist",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
2
+ import{ba as m,ea as O}from"./chunk-3f29kjd8.js";import{loadConfig as u}from"bunfig";var h={docsDir:"./docs",outDir:"./dist",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics-configuration"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
3
3
  /* Additional BunPress customizations */
4
4
  /* Note: Base styles are provided by the VitePress theme */
5
5
 
@@ -693,6 +693,80 @@ function toggleTheme() {
693
693
  });
694
694
  })();
695
695
 
696
+ // Nav dropdowns and mega menus.
697
+ //
698
+ // The panels open on :hover and :focus-within in CSS, so they work with no
699
+ // JavaScript and with the keyboard. This adds the two things CSS cannot do:
700
+ // a real click/tap toggle (a touch device has no hover to rely on) and an
701
+ // accurate aria-expanded for screen readers.
702
+ function closeNavGroups(except) {
703
+ document.querySelectorAll('.BPNavBarMenu-group.is-open').forEach(function (group) {
704
+ if (group === except) return;
705
+ group.classList.remove('is-open');
706
+ const button = group.querySelector('.BPNavBarMenu-group-button');
707
+ if (button) button.setAttribute('aria-expanded', 'false');
708
+ });
709
+ }
710
+
711
+ function toggleNavScreen(force) {
712
+ const screen = document.getElementById('bp-nav-screen');
713
+ const toggle = document.querySelector('.BPNavToggle');
714
+ if (!screen) return;
715
+ const open = typeof force === 'boolean' ? force : screen.hasAttribute('hidden');
716
+ if (open) screen.removeAttribute('hidden');
717
+ else screen.setAttribute('hidden', '');
718
+ document.documentElement.classList.toggle('bp-nav-screen-open', open);
719
+ if (toggle) toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
720
+ }
721
+
722
+ (function () {
723
+ document.addEventListener('click', function (event) {
724
+ const button = event.target.closest ? event.target.closest('.BPNavBarMenu-group-button') : null;
725
+ if (button) {
726
+ const group = button.parentElement;
727
+ const open = !group.classList.contains('is-open');
728
+ closeNavGroups(group);
729
+ group.classList.toggle('is-open', open);
730
+ button.setAttribute('aria-expanded', open ? 'true' : 'false');
731
+ return;
732
+ }
733
+ // A click anywhere else dismisses an open panel, including a click on one
734
+ // of its own links (which navigates, but SPA routing keeps the DOM).
735
+ closeNavGroups(null);
736
+ const screen = document.getElementById('bp-nav-screen');
737
+ if (screen && !screen.hasAttribute('hidden') && !event.target.closest('.BPNav')) {
738
+ toggleNavScreen(false);
739
+ }
740
+ });
741
+
742
+ document.addEventListener('keydown', function (event) {
743
+ if (event.key !== 'Escape') return;
744
+ closeNavGroups(null);
745
+ toggleNavScreen(false);
746
+ });
747
+
748
+ // A link inside the stacked nav navigates; leaving the panel open over the
749
+ // new page would hide it.
750
+ document.addEventListener('click', function (event) {
751
+ if (event.target.closest && event.target.closest('.BPNavScreen a')) toggleNavScreen(false);
752
+ });
753
+ })();
754
+
755
+ // Hero code panel tabs. The panels are all server-rendered; this only swaps
756
+ // which one is visible, so the samples are in the HTML with or without JS.
757
+ function switchHeroCodeTab(button, index) {
758
+ const panel = button.closest('.BPHeroCode');
759
+ if (!panel) return;
760
+ panel.querySelectorAll('.BPHeroCode-tab').forEach(function (tab, i) {
761
+ tab.classList.toggle('is-active', i === index);
762
+ tab.setAttribute('aria-selected', i === index ? 'true' : 'false');
763
+ });
764
+ panel.querySelectorAll('.BPHeroCode-panel').forEach(function (body, i) {
765
+ if (i === index) body.removeAttribute('hidden');
766
+ else body.setAttribute('hidden', '');
767
+ });
768
+ }
769
+
696
770
  function switchCodeTab(groupId, panelIndex) {
697
771
  const group = document.getElementById(groupId);
698
772
  if (!group) return;
@@ -1146,9 +1220,251 @@ if (typeof document !== 'undefined') {
1146
1220
  }
1147
1221
  });
1148
1222
  }
1149
- `],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"},search:{enabled:!0,maxResults:12,keyboardShortcuts:!0},themeConfig:{socialLinks:[{icon:"github",link:"https://github.com/stacksjs/bunpress"}]},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}};function L(q){let J=q.plugins;if(!Array.isArray(J)||J.length===0)return q;let V=q;for(let Q of J){if(!Q||typeof Q!=="object")continue;let W=Q.name||"unnamed plugin";try{if(typeof Q.extendConfig==="function")V=Q.extendConfig(V)??V}catch(Z){console.error(`[bunpress] ${W}: extendConfig failed \u2014`,Z)}try{if(typeof Q.validateConfig==="function"){let Z=Q.validateConfig(V);for(let $ of Z?.warnings??[])console.warn(`[bunpress] ${W}: ${$}`);for(let $ of Z?.errors??[])console.error(`[bunpress] ${W}: ${$}`)}}catch(Z){console.error(`[bunpress] ${W}: validateConfig failed \u2014`,Z)}}for(let Q of J)try{Q?.onConfigLoad?.(V)}catch(W){console.error(`[bunpress] ${Q?.name||"unnamed plugin"}: onConfigLoad failed \u2014`,W)}return V}var k=L(await A({name:"bunpress",alias:"docs",defaultConfig:S}));async function l(){return k}var{Glob:b,YAML:P}=globalThis.Bun;import{join as T}from"path";var t="/search-index.json",I={include:["**/*.md"],exclude:["public/**","**/node_modules/**"],searchFields:["title","content","headings","keywords"],maxResults:10,minQueryLength:1,fuzzy:!1,fuzziness:1,stemmer:"none",maxContentLength:800,boost:{title:10,headings:5,content:1}};function F(q){let J=q?.options??{};return{...I,...J,include:J.include??I.include,exclude:J.exclude??I.exclude,searchFields:J.searchFields??I.searchFields,maxResults:J.maxResults??q?.maxResults??I.maxResults,boost:{...I.boost,...J.boost??{}}}}var x=[{key:"k",meta:!0,ctrl:!1,alt:!1,shift:!1},{key:"k",meta:!1,ctrl:!0,alt:!1,shift:!1},{key:"/",meta:!1,ctrl:!1,alt:!1,shift:!1}];function v(q){if(!q)return x;let J=(Array.isArray(q)?q:[q]).map((W)=>String(W).toLowerCase()),V={meta:!1,ctrl:!1,alt:!1,shift:!1},Q="";for(let W of J)if(W==="meta"||W==="cmd"||W==="command")V.meta=!0;else if(W==="ctrl"||W==="control")V.ctrl=!0;else if(W==="alt"||W==="option")V.alt=!0;else if(W==="shift")V.shift=!0;else Q=W;if(!Q)return x;return[{key:Q,...V}]}function y(q){if(typeof q!=="function")return null;let J=Function.prototype.toString.call(q);return J.includes("[native code]")?null:J}function o(q,J){let V=q?.search??q?.markdown?.search,Q=F(V),W=V?.resultOptions??{};return{indexUrl:J,placeholder:V?.placeholder??"Search documentation",lazy:V?.lazy!==!1,maxResults:Q.maxResults,minQueryLength:Q.minQueryLength,searchFields:Q.searchFields,boost:{title:Q.boost.title??10,headings:Q.boost.headings??5,content:Q.boost.content??1},fuzzy:Q.fuzzy,fuzziness:Q.fuzziness,stemmer:Q.stemmer,shortcuts:{keyboard:V?.keyboardShortcuts!==!1,keys:v(V?.shortcut)},result:{showDescription:W.showDescription!==!1,descriptionLength:W.descriptionLength??180,highlightMatches:W.highlightMatches!==!1,showPath:W.showPath!==!1},tokenizeSource:y(V?.options?.tokenize),onSearchSource:y(V?.onSearch),locale:null}}function O(){let q=null;return(J)=>{let V=J.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!V)return q!==null;let Q=V[1];if(q===null)return q=Q,!0;let W=Q[0]===q[0],Z=Q.length>=q.length;if(W&&Z&&V[2].trim()==="")q=null;return!0}}function m(q){let J=O();return q.split(`
1150
- `).filter((V)=>!J(V)).join(`
1151
- `)}function E(q){return m(q).replace(/^:::.*$/gm," ").replace(/^\s{0,3}>\s*\[!(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/gim," ").replace(/<[^>]+>/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~]{1,3}([^*_~]+)[*_~]{1,3}/g,"$1").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm," ").replace(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/gm," ").replace(/\|/g," ").replace(/\s+/g," ").trim()}function f(q){return q.replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_~]/g,"").trim().toLowerCase().replace(/\//g,"-").replace(/\s+/g,"-").replace(/[^\w-]/g,"").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function g(q){let J=q.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!J)return{body:q,data:{}};let V={};try{V=P.parse(J[1])??{}}catch{V={}}return{body:q.slice(J[0].length),data:V}}function h(q){let J=q.replace(/\.md$/,"");if(J==="index")return"/";if(J.endsWith("/index"))return`/${J.slice(0,-6)}`;return`/${J}`}function u(q,J,V){let{body:Q,data:W}=g(J);if(W.search===!1)return[];if(W.layout==="home")return[];let Z=typeof W.search==="object"&&W.search!==null?W.search:{},$=Array.isArray(Z.keywords)?Z.keywords.map(String):[],K=h(q),H=Q.split(`
1152
- `),G=Q.match(/^#\s+(.+)$/m),B=Z.title||W.title||(G?G[1].trim():K),N=[],X={title:B,anchor:"",level:1,buffer:[]},z=()=>{let Y=E(X.buffer.join(`
1153
- `)).slice(0,V.maxContentLength);if(!Y&&!X.title)return;let j={url:X.anchor?`${K}#${X.anchor}`:K,page:B,title:E(X.title)||B,text:Y,level:X.level};if($.length)j.keywords=$;N.push(j)},R=O();for(let Y of H){let j=R(Y)?null:Y.match(/^(#{1,6})\s+(.+?)\s*$/);if(!j){X.buffer.push(Y);continue}let D=j[1].length;if(D===1){X.buffer.push("");continue}z();let w=j[2].replace(/\s*\{#([\w-]+)\}\s*$/,""),U=j[2].match(/\{#([\w-]+)\}\s*$/);X={title:w,anchor:U?U[1]:f(w),level:D,buffer:[]}}return z(),N.filter((Y)=>Y.text||Y.level>1)}function p(q,J){let{storeFields:V}=J;if(!V||!V.length)return q;let Q=new Set(["url",...V]);if(J.searchFields.includes("title"))Q.add("title");if(J.searchFields.includes("content"))Q.add("text");if(J.searchFields.includes("headings"))Q.add("page");if(J.searchFields.includes("keywords"))Q.add("keywords");return q.map((W)=>{let Z={};for(let[$,K]of Object.entries(W))if(Q.has($)&&K!==void 0)Z[$]=K;return Z})}function C(q){return q.split("#")[0]}function d(q,J){if(!J.enabled)return{locale:J.defaultLocale,page:q};let V=q.split("/");if(V.length>1&&J.locales.includes(V[0])&&V[0]!==J.defaultLocale)return{locale:V[0],page:V.slice(1).join("/")};let Q=q.match(/^(.*)\.([A-Za-z-]+)(\.md)$/);if(Q&&J.locales.includes(Q[2]))return{locale:Q[2],page:`${Q[1]}${Q[3]}`};return{locale:J.defaultLocale,page:q}}async function r(q,J){let V=J?.search??J?.markdown?.search,Q=F(V),W=_(J),Z=Q.exclude.map((G)=>new b(G)),$=[],K=new Set,H=new Map;for(let G of W.locales)H.set(G,new Set);for(let G of Q.include){let B=new b(G);for await(let N of B.scan(q)){let X=N.replace(/\\/g,"/");if(K.has(X))continue;if(Z.some((z)=>z.match(X)))continue;K.add(X);try{let z=await Bun.file(T(q,X)).text(),{locale:R,page:Y}=d(X,W);for(let j of u(Y,z,Q)){if(W.enabled)j.locale=R,j.url=M(W,R,j.url);$.push(j),H.get(R)?.add(C(j.url))}}catch{}}}if(W.enabled){let G=$.filter((B)=>B.locale===W.defaultLocale);for(let B of W.locales){if(B===W.defaultLocale)continue;let N=H.get(B)??new Set;for(let X of G){let z=M(W,B,X.url);if(N.has(C(z)))continue;$.push({...X,url:z,locale:B})}}}return p($,Q)}
1154
- export{S as Q,L as R,k as S,l as T,t as U,o as V,r as W};
1223
+ `],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"},search:{enabled:!0,maxResults:12,keyboardShortcuts:!0},themeConfig:{socialLinks:[{icon:"github",link:"https://github.com/stacksjs/bunpress"}]},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}};function g(Q){let V=Q.plugins;if(!Array.isArray(V)||V.length===0)return Q;let W=Q;for(let X of V){if(!X||typeof X!=="object")continue;let Z=X.name||"unnamed plugin";try{if(typeof X.extendConfig==="function")W=X.extendConfig(W)??W}catch($){console.error(`[bunpress] ${Z}: extendConfig failed \u2014`,$)}try{if(typeof X.validateConfig==="function"){let $=X.validateConfig(W);for(let j of $?.warnings??[])console.warn(`[bunpress] ${Z}: ${j}`);for(let j of $?.errors??[])console.error(`[bunpress] ${Z}: ${j}`)}}catch($){console.error(`[bunpress] ${Z}: validateConfig failed \u2014`,$)}}for(let X of V)try{X?.onConfigLoad?.(W)}catch(Z){console.error(`[bunpress] ${X?.name||"unnamed plugin"}: onConfigLoad failed \u2014`,Z)}return W}async function d(){let Q=["bunpress.config.ts","bunpress.config.js",".config/bunpress.ts","docs.config.ts",".config/docs.ts"],V=[];for(let W of Q)if(await Bun.file(W).exists())V.push(W);if(V.length>1){let[W,...X]=V;console.warn(`[bunpress] Multiple config files found. Using ${W}; ignoring ${X.join(", ")}.`)}}await d();var c=g(await u({name:"bunpress",alias:"docs",defaultConfig:h}));async function GQ(){return c}function E(){let Q=null;return(V)=>{let W=V.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!W)return Q!==null;let X=W[1];if(Q===null)return Q=X,!0;let Z=X[0]===Q[0],$=X.length>=Q.length;if(Z&&$&&W[2].trim()==="")Q=null;return!0}}function P(Q){let V=E();return Q.split(`
1224
+ `).filter((W)=>!V(W)).join(`
1225
+ `)}function L(Q){return`\x00BPCODE${Q}\x00`}var l=/\u0000BPCODE(\d+)\u0000/g;function s(Q){let V=[],W=E(),X=[],Z=null,$=()=>{if(!Z)return;V.push(Z.join(`
1226
+ `)),X.push(L(V.length-1)),Z=null};for(let j of Q.split(`
1227
+ `)){if(W(j)){Z??=[],Z.push(j);continue}$(),X.push(j.replace(/(`+)(?:(?!\1)[\s\S])*\1/g,(J)=>{return V.push(J),L(V.length-1)}))}return $(),{masked:X.join(`
1228
+ `),restore:(j)=>j.replace(l,(J,Y)=>V[Number(Y)]??J)}}async function qQ(Q,V){let{masked:W,restore:X}=s(Q);return X(await V(W))}var a={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function y(Q){return Q.replace(/\s*<!-- toc-ignore -->\s*/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/<[^>]*>/g,"").trim()}function D(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 A(Q,V){let W=Q,X=1;while(V.has(Q))Q=`${W}-${X}`,X++;return V.add(Q),Q}function w(Q,V){return A(D(Q),V)}function i(Q){let V=[],W=new Set,X=/^(#{1,6})\s+(.+)$/gm,Z;while((Z=X.exec(Q))!==null){let $=Z[1].length,j=Z[2].trim();if(!j)continue;if(j.includes("toc-ignore"))continue;let J=j.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();J=J.replace(/`([^`]+)`/g,"<code>$1</code>");let Y=J.includes("<code>"),q=w(y(j),W);V.push({level:$,text:J,id:q,children:[],hasCode:Y})}return V}function o(Q){let V=[],W=[];for(let X of Q){while(W.length>0&&W[W.length-1].level>=X.level)W.pop();if(W.length===0)V.push(X);else W[W.length-1].children.push(X);W.push(X)}return V}function r(Q,V){let{minDepth:W=2,maxDepth:X=6,exclude:Z=[]}=V,$=(j)=>{let J=[];for(let Y of j){if(Z.some((G)=>{if(G.startsWith("/")&&G.endsWith("/"))return new RegExp(G.slice(1,-1)).test(Y.text);else return Y.text===G}))continue;if(Y.level>X)continue;let q=$(Y.children);if(Y.level>=W&&Y.level<=X)J.push({...Y,children:q});else J.push(...q)}return J};return $(Q)}function _(Q){let{items:V,title:W,config:X}=Q,{className:Z,collapsible:$}=X,j=(J,Y=0)=>{if(J.length===0)return"";let q=Y===0?"toc-list":"toc-sublist",G=Y===0?"toc-item":"toc-subitem";return`<ul class="${q}">
1229
+ ${J.map((z)=>{let I=z.children.length>0,K=I&&$?"toc-expand":"",M=I?j(z.children,Y+1):"",U=50,B=z.text.length>50?`${z.text.substring(0,50)}...`:z.text,N=z.text.length>50?"toc-truncate":"";return`<li class="${z.hasCode?"toc-code":""} ${K} ${G} ${N}">
1230
+ <a href="#${z.id}" class="toc-link" title="${z.text.replace(/<[^>]*>/g,"")}">${B}</a>
1231
+ ${M}
1232
+ </li>`}).join(`
1233
+ `)}
1234
+ </ul>`};return[`<nav class="${Z}" role="navigation" aria-label="${W}">`,'<div class="toc-container">',` <h2 class="toc-title">${W}</h2>`,` ${j(V)}`,"</div>","</nav>"].join(`
1235
+ `)}function C(Q){return _(Q).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function n(Q){return _(Q).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function t(Q){return _(Q).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function e(Q,V={}){let W={...V};if(typeof W.position==="string")W.position=[W.position];let X={...a,...W},Z=i(Q),$=o(Z),j=r($,X);return{title:X.title,items:j,config:X}}function BQ(Q,V={}){let W=e(Q,V);return(Array.isArray(V.position)?V.position:[V.position||"sidebar"]).map((Z)=>{let $;switch(Z){case"inline":$=C(W);break;case"sidebar":$=n(W);break;case"floating":$=t(W);break;default:$=_(W)}return{position:Z,data:W,html:$}})}function IQ(Q,V){let W=C(V);return Q.replace(/\[\[toc\]\]/gi,W)}function NQ(Q){let V=new Set;return Q.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(W,X,Z)=>{let $=w(Z.replace(/<[^>]*>/g,""),V);return`<h${X} id="${$}"><a href="#${$}" class="heading-anchor">#</a>${Z}</h${X}>`})}function MQ(){return`
1236
+ .table-of-contents {
1237
+ position: sticky;
1238
+ top: 60px; /* Match navbar height */
1239
+ height: calc(100vh - 60px);
1240
+ width: 200px;
1241
+ overflow-y: auto;
1242
+ padding: 1rem;
1243
+ }
1244
+
1245
+ .toc-container {
1246
+ padding: 0;
1247
+ }
1248
+
1249
+ .toc-title {
1250
+ margin: 0 0 1rem 0;
1251
+ font-size: 1.2rem;
1252
+ font-weight: 600;
1253
+ }
1254
+
1255
+ .toc-list,
1256
+ .toc-sublist {
1257
+ list-style: none;
1258
+ padding: 0;
1259
+ margin: 0;
1260
+ }
1261
+
1262
+ .toc-list {
1263
+ padding-left: 0;
1264
+ }
1265
+
1266
+ .toc-sublist {
1267
+ padding-left: 1rem;
1268
+ margin-top: 0.5rem;
1269
+ }
1270
+
1271
+ .toc-item,
1272
+ .toc-subitem {
1273
+ margin-bottom: 0.5rem;
1274
+ }
1275
+
1276
+ .toc-link {
1277
+ color: inherit;
1278
+ text-decoration: none;
1279
+ display: block;
1280
+ padding: 0.25rem 0;
1281
+ border-radius: 0.25rem;
1282
+ transition: background-color 0.2s;
1283
+ }
1284
+
1285
+ .toc-link:hover {
1286
+ background-color: rgba(0, 0, 0, 0.05);
1287
+ }
1288
+
1289
+ .toc-active .toc-link,
1290
+ .active-toc-item .toc-link {
1291
+ background-color: rgba(0, 123, 255, 0.1);
1292
+ font-weight: 500;
1293
+ }
1294
+
1295
+ .toc-truncate {
1296
+ /* Styles for truncated TOC items */
1297
+ }
1298
+
1299
+ .toc-truncate .toc-link {
1300
+ white-space: nowrap;
1301
+ overflow: hidden;
1302
+ text-overflow: ellipsis;
1303
+ }
1304
+
1305
+ .toc-collapse .toc-link::before {
1306
+ content: '\u25B6';
1307
+ margin-right: 0.5rem;
1308
+ transition: transform 0.2s;
1309
+ }
1310
+
1311
+ .toc-collapse.collapsed .toc-link::before {
1312
+ transform: rotate(90deg);
1313
+ }
1314
+
1315
+ .toc-expand .toc-link::before {
1316
+ content: '\u25BC';
1317
+ margin-right: 0.5rem;
1318
+ }
1319
+
1320
+ .heading-anchor {
1321
+ color: inherit;
1322
+ text-decoration: none;
1323
+ opacity: 0;
1324
+ margin-left: -1rem;
1325
+ padding-right: 0.5rem;
1326
+ transition: opacity 0.2s;
1327
+ }
1328
+
1329
+ h1:hover .heading-anchor,
1330
+ h2:hover .heading-anchor,
1331
+ h3:hover .heading-anchor,
1332
+ h4:hover .heading-anchor,
1333
+ h5:hover .heading-anchor,
1334
+ h6:hover .heading-anchor {
1335
+ opacity: 0.7;
1336
+ }
1337
+
1338
+ .heading-anchor:hover {
1339
+ opacity: 1;
1340
+ }
1341
+
1342
+ /* Smooth scrolling */
1343
+ html {
1344
+ scroll-behavior: smooth;
1345
+ }
1346
+
1347
+ /* Responsive adjustments */
1348
+ @media (max-width: 768px) {
1349
+ .toc-sidebar {
1350
+ display: none;
1351
+ }
1352
+
1353
+ .toc-floating {
1354
+ position: fixed;
1355
+ bottom: 1rem;
1356
+ right: 1rem;
1357
+ background: white;
1358
+ border: 1px solid #ddd;
1359
+ border-radius: 0.5rem;
1360
+ padding: 1rem;
1361
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
1362
+ max-width: 250px;
1363
+ }
1364
+ }
1365
+ `}function RQ(Q={}){let V=Q.smoothScroll!==!1,W=Q.activeHighlight!==!1,X=Q.collapsible!==!1;return`
1366
+ function initToc() {
1367
+ const tocLinks = document.querySelectorAll('.toc-link')
1368
+
1369
+ // Smooth scrolling for TOC links
1370
+ if (${String(V)}) tocLinks.forEach(link => {
1371
+ link.addEventListener('click', function(e) {
1372
+ e.preventDefault()
1373
+ const targetId = this.getAttribute('href')?.substring(1)
1374
+ const targetElement = document.getElementById(targetId)
1375
+
1376
+ if (targetElement) {
1377
+ targetElement.scrollIntoView({
1378
+ behavior: 'smooth',
1379
+ block: 'start'
1380
+ })
1381
+
1382
+ // Update URL without page reload
1383
+ history.pushState(null, '', \`#\${targetId}\`)
1384
+ }
1385
+ })
1386
+ })
1387
+
1388
+ // Active TOC item highlighting on scroll
1389
+ function updateActiveTocItem() {
1390
+ if (!${String(W)}) return
1391
+ const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6')
1392
+ const tocLinks = document.querySelectorAll('.toc-link')
1393
+
1394
+ let currentActive = null
1395
+ let currentDistance = Infinity
1396
+
1397
+ headings.forEach((heading, index) => {
1398
+ const rect = heading.getBoundingClientRect()
1399
+ const distance = Math.abs(rect.top)
1400
+
1401
+ if (distance < currentDistance && rect.top <= 100) {
1402
+ currentActive = heading.id
1403
+ currentDistance = distance
1404
+ }
1405
+ })
1406
+
1407
+ tocLinks.forEach(link => {
1408
+ const parent = link.parentElement
1409
+ if (parent) {
1410
+ parent.classList.remove('toc-active', 'active-toc-item')
1411
+ const href = link.getAttribute('href')?.substring(1)
1412
+ if (href === currentActive) {
1413
+ parent.classList.add('toc-active', 'active-toc-item')
1414
+ }
1415
+ }
1416
+ })
1417
+ }
1418
+
1419
+ // Throttle scroll events
1420
+ let scrollTimeout
1421
+ function throttledUpdate() {
1422
+ if (!scrollTimeout) {
1423
+ scrollTimeout = setTimeout(() => {
1424
+ updateActiveTocItem()
1425
+ scrollTimeout = null
1426
+ }, 100)
1427
+ }
1428
+ }
1429
+
1430
+ window.addEventListener('scroll', throttledUpdate)
1431
+ updateActiveTocItem()
1432
+
1433
+ // TOC collapse/expand functionality
1434
+ const expandableItems = ${String(X)} ? document.querySelectorAll('.toc-expand') : []
1435
+
1436
+ expandableItems.forEach(item => {
1437
+ item.addEventListener('click', function(e) {
1438
+ if (e.target === this || e.target.closest('.toc-link')) {
1439
+ this.classList.toggle('collapsed')
1440
+ }
1441
+ })
1442
+ })
1443
+
1444
+ // Handle URL hash on page load
1445
+ if (window.location.hash) {
1446
+ const targetId = window.location.hash.substring(1)
1447
+ const targetElement = document.getElementById(targetId)
1448
+
1449
+ if (targetElement) {
1450
+ setTimeout(() => {
1451
+ targetElement.scrollIntoView({
1452
+ behavior: 'smooth',
1453
+ block: 'start'
1454
+ })
1455
+ }, 100)
1456
+ }
1457
+ }
1458
+ }
1459
+
1460
+ // Initialize TOC when DOM is ready
1461
+ if (document.readyState === 'loading') {
1462
+ document.addEventListener('DOMContentLoaded', initToc)
1463
+ }
1464
+ else {
1465
+ initToc()
1466
+ }
1467
+ `}var{Glob:S,YAML:QQ}=globalThis.Bun;import{join as VQ}from"path";var AQ="/search-index.json",R={include:["**/*.md"],exclude:["public/**","**/node_modules/**"],searchFields:["title","content","headings","keywords"],maxResults:10,minQueryLength:1,fuzzy:!1,fuzziness:1,stemmer:"none",maxContentLength:800,boost:{title:10,headings:5,content:1}};function f(Q){let V=Q?.options??{};return{...R,...V,include:V.include??R.include,exclude:V.exclude??R.exclude,searchFields:V.searchFields??R.searchFields,maxResults:V.maxResults??Q?.maxResults??R.maxResults,boost:{...R.boost,...V.boost??{}}}}var x=[{key:"k",meta:!0,ctrl:!1,alt:!1,shift:!1},{key:"k",meta:!1,ctrl:!0,alt:!1,shift:!1},{key:"/",meta:!1,ctrl:!1,alt:!1,shift:!1}];function WQ(Q){if(!Q)return x;let V=(Array.isArray(Q)?Q:[Q]).map((Z)=>String(Z).toLowerCase()),W={meta:!1,ctrl:!1,alt:!1,shift:!1},X="";for(let Z of V)if(Z==="meta"||Z==="cmd"||Z==="command")W.meta=!0;else if(Z==="ctrl"||Z==="control")W.ctrl=!0;else if(Z==="alt"||Z==="option")W.alt=!0;else if(Z==="shift")W.shift=!0;else X=Z;if(!X)return x;return[{key:X,...W}]}function v(Q){if(typeof Q!=="function")return null;let V=Function.prototype.toString.call(Q);return V.includes("[native code]")?null:V}function OQ(Q,V){let W=Q?.search??Q?.markdown?.search,X=f(W),Z=W?.resultOptions??{};return{indexUrl:V,placeholder:W?.placeholder??"Search documentation",lazy:W?.lazy!==!1,maxResults:X.maxResults,minQueryLength:X.minQueryLength,searchFields:X.searchFields,boost:{title:X.boost.title??10,headings:X.boost.headings??5,content:X.boost.content??1},fuzzy:X.fuzzy,fuzziness:X.fuzziness,stemmer:X.stemmer,shortcuts:{keyboard:W?.keyboardShortcuts!==!1,keys:WQ(W?.shortcut)},result:{showDescription:Z.showDescription!==!1,descriptionLength:Z.descriptionLength??180,highlightMatches:Z.highlightMatches!==!1,showPath:Z.showPath!==!1},tokenizeSource:v(W?.options?.tokenize),onSearchSource:v(W?.onSearch),locale:null}}function k(Q){return P(Q).replace(/^:::.*$/gm," ").replace(/^\s{0,3}>\s*\[!(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/gim," ").replace(/<[^>]+>/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~]{1,3}([^*_~]+)[*_~]{1,3}/g,"$1").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm," ").replace(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/gm," ").replace(/\|/g," ").replace(/\s+/g," ").trim()}function XQ(Q){let V=Q.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!V)return{body:Q,data:{}};let W={};try{W=QQ.parse(V[1])??{}}catch{W={}}return{body:Q.slice(V[0].length),data:W}}function ZQ(Q){let V=Q.replace(/\.md$/,"");if(V==="index")return"/";if(V.endsWith("/index"))return`/${V.slice(0,-6)}`;return`/${V}`}function $Q(Q,V,W){let{body:X,data:Z}=XQ(V);if(Z.search===!1)return[];if(Z.layout==="home")return[];let $=typeof Z.search==="object"&&Z.search!==null?Z.search:{},j=Array.isArray($.keywords)?$.keywords.map(String):[],J=ZQ(Q),Y=X.split(`
1468
+ `),q=X.match(/^#\s+(.+)$/m),G=$.title||Z.title||(q?q[1].trim():J),z=[],I=new Set,K={title:G,anchor:"",level:1,buffer:[]},M=()=>{let B=k(K.buffer.join(`
1469
+ `)).slice(0,W.maxContentLength);if(!B&&!K.title)return;let N={url:K.anchor?`${J}#${K.anchor}`:J,page:G,title:k(K.title)||G,text:B,level:K.level};if(j.length)N.keywords=j;z.push(N)},U=E();for(let B of Y){let N=U(B)?null:B.match(/^(#{1,6})\s+(.+?)\s*$/);if(!N){K.buffer.push(B);continue}let b=N[1].length,H=N[2].replace(/\s*\{#([\w-]+)\}\s*$/,""),F=N[2].match(/\{#([\w-]+)\}\s*$/),p=A(F?F[1]:D(y(H)),I);if(b===1){K.buffer.push("");continue}M(),K={title:H,anchor:p,level:b,buffer:[]}}return M(),z.filter((B)=>B.text||B.level>1)}function jQ(Q,V){let{storeFields:W}=V;if(!W||!W.length)return Q;let X=new Set(["url",...W]);if(V.searchFields.includes("title"))X.add("title");if(V.searchFields.includes("content"))X.add("text");if(V.searchFields.includes("headings"))X.add("page");if(V.searchFields.includes("keywords"))X.add("keywords");return Q.map((Z)=>{let $={};for(let[j,J]of Object.entries(Z))if(X.has(j)&&J!==void 0)$[j]=J;return $})}function T(Q){return Q.split("#")[0]}function JQ(Q,V){if(!V.enabled)return{locale:V.defaultLocale,page:Q};let W=Q.split("/");if(W.length>1&&V.locales.includes(W[0])&&W[0]!==V.defaultLocale)return{locale:W[0],page:W.slice(1).join("/")};let X=Q.match(/^(.*)\.([A-Za-z-]+)(\.md)$/);if(X&&V.locales.includes(X[2]))return{locale:X[2],page:`${X[1]}${X[3]}`};return{locale:V.defaultLocale,page:Q}}async function HQ(Q,V){let W=V?.search??V?.markdown?.search,X=f(W),Z=m(V),$=X.exclude.map((q)=>new S(q)),j=[],J=new Set,Y=new Map;for(let q of Z.locales)Y.set(q,new Set);for(let q of X.include){let G=new S(q);for await(let z of G.scan(Q)){let I=z.replace(/\\/g,"/");if(J.has(I))continue;if($.some((K)=>K.match(I)))continue;J.add(I);try{let K=await Bun.file(VQ(Q,I)).text(),{locale:M,page:U}=JQ(I,Z);for(let B of $Q(U,K,X)){if(Z.enabled)B.locale=M,B.url=O(Z,M,B.url);j.push(B),Y.get(M)?.add(T(B.url))}}catch{}}}if(Z.enabled){let q=j.filter((G)=>G.locale===Z.defaultLocale);for(let G of Z.locales){if(G===Z.defaultLocale)continue;let z=Y.get(G)??new Set;for(let I of q){let K=O(Z,G,I.url);if(z.has(T(K)))continue;j.push({...I,url:K,locale:G})}}}return jQ(j,X)}
1470
+ export{h as B,g as C,c as D,GQ as E,P as F,qQ as G,a as H,y as I,D as J,A as K,w as L,i as M,o as N,r as O,_ as P,C as Q,n as R,t as S,e as T,BQ as U,IQ as V,NQ as W,MQ as X,RQ as Y,AQ as Z,OQ as _,HQ as $};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ba as a,ca as b,da as c,ea as d,fa as e,ga as f,ha as g,ia as h,ja as i}from"./chunk-3f29kjd8.js";export{c as splitLocaleFromPath,a as resolveI18nConfig,d as localizeUrl,g as localeLabel,e as localeContentCandidates,b as loadI18nTranslations,i as generateLocaleDetectionScript,h as generateHreflangTags,f as configForLocale};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{E as $,F as I,G as f,H as h,K as x}from"./chunk-x5m3c6jd.js";import"./chunk-av14gbps.js";import{S as _}from"./chunk-avg4ftb9.js";import"./chunk-n0ebp7d8.js";import{join as D}from"path";var E="@stacksjs/ts-cloud";async function Y(){try{return await import(E)}catch(j){throw Error(`Deploying requires @stacksjs/ts-cloud, which is an optional dependency.
2
+ import{p as $,q as I,r as f,s as h,v as x}from"./chunk-8b52ry67.js";import"./chunk-5cxb3t2e.js";import{D as _}from"./chunk-he00q0q4.js";import"./chunk-3f29kjd8.js";import{join as D}from"path";var E="@stacksjs/ts-cloud";async function Y(){try{return await import(E)}catch(j){throw Error(`Deploying requires @stacksjs/ts-cloud, which is an optional dependency.
3
3
  Install it with: bun add -d @stacksjs/ts-cloud
4
4
  Original error: ${j instanceof Error?j.message:String(j)}`)}}function W(j,A){let k=A||j?.provider;if(!k||k==="route53")return null;if(k==="porkbun"){let m=j?.apiKey||process.env.PORKBUN_API_KEY,w=j?.secretKey||process.env.PORKBUN_SECRET_KEY;if(!m||!w)throw Error("Porkbun API credentials not found. Set PORKBUN_API_KEY and PORKBUN_SECRET_KEY environment variables, or configure them in bunpress.config.ts under cloud.dnsProvider");return{provider:"porkbun",apiKey:m,secretKey:w}}if(k==="godaddy"){let m=j?.apiKey||process.env.GODADDY_API_KEY,w=j?.secretKey||process.env.GODADDY_API_SECRET,J=j?.environment||process.env.GODADDY_ENVIRONMENT;if(!m||!w)throw Error("GoDaddy API credentials not found. Set GODADDY_API_KEY and GODADDY_API_SECRET environment variables, or configure them in bunpress.config.ts under cloud.dnsProvider");return{provider:"godaddy",apiKey:m,apiSecret:w,environment:J}}throw Error(`Unknown DNS provider: ${k}. Supported: porkbun, godaddy, route53`)}async function F(j={}){let A=await _,k=A.cloud||{},m=j.verbose??A.verbose??!1,w=j.region||k.region||"us-east-1",J=j.domain||k.domain,M=j.subdomain||k.subdomain,N=j.baseDomain||k.baseDomain,O=j.bucket||k.bucket,P=j.stackName||k.stackName,U=j.hostedZoneId||k.hostedZoneId,Q=j.certificateArn||k.certificateArn,V=k.cacheControl||"max-age=31536000, public",B;if(J)B=J;else if(M&&N)B=`${M}.${N}`;let K=B?.replace(/\./g,"-")||"bunpress-site",G=null;try{G=W(k.dnsProvider,j.dnsProvider)}catch(H){return I(H.message),!1}let L=G!==null;if(j.dryRun){if(f("Dry run mode - no changes will be made"),console.log(`
5
5
  Configuration:`),console.log(` Region: ${w}`),console.log(` Site Name: ${K}`),console.log(` Bucket: ${O||"auto-generated"}`),console.log(` Domain: ${B||"not specified"}`),console.log(` Stack Name: ${P||`${K}-static-site`}`),console.log(` DNS Provider: ${G?.provider||"route53 (AWS)"}`),!L)console.log(` Hosted Zone ID: ${U||"auto-detected"}`);return console.log(` Certificate ARN: ${Q||"auto-created"}`),!0}if(!process.env.AWS_ACCESS_KEY_ID||!process.env.AWS_SECRET_ACCESS_KEY)return I("AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables."),!1;let z=new h("Building documentation...");try{if(!m)z.start();if(!await x({verbose:m})){if(!m)z.fail("Build failed");return!1}if(!m)z.succeed("Documentation built successfully");let C=A.outDir||"./dist",X=D(C,".bunpress");if(!m)z.text="Deploying infrastructure with CloudFormation...",z.start();else if(console.log(`
@@ -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-2ns9va8d.js";import"./chunk-avg4ftb9.js";import"./chunk-n0ebp7d8.js";export{c as wrapInLayout,b as stripConfiguredBasePath,e as startServer,f as serveCLI,d as markdownToHtml,a as getConfiguredBasePath};
2
+ import{j as a,k as b,l as c,m as d,n as e,o as f}from"./chunk-2vne40yj.js";import"./chunk-he00q0q4.js";import"./chunk-3f29kjd8.js";export{c as wrapInLayout,b as stripConfiguredBasePath,e as startServer,f as serveCLI,d as markdownToHtml,a as getConfiguredBasePath};
@@ -3,6 +3,7 @@ import type { Highlighter as TSHighlighter } from 'ts-syntax-highlighter';
3
3
  * Reset the global highlighter instance (useful when changing themes)
4
4
  */
5
5
  export declare function resetHighlighter(): void;
6
+ export declare function setLanguageAliases(aliases: Record<string, string> | undefined): void;
6
7
  /**
7
8
  * Normalizes a language identifier to its canonical id.
8
9
  * Unknown identifiers are returned as-is so the caller can report them.
package/dist/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{A as wj,B as zj,C as Bj,D as Dj,a as W,b as X,c as Y,d as Z,e as _,f as $,g as b,h as v,i as y,j as p,k as f,l as c,m as d,n as g,o as a,p as n,q as o,r,s as t,t as i,u as s,v as e,w as jj,x as kj,y as qj,z as uj}from"../chunk-2ns9va8d.js";import{L as j,M as k,N as q,O as u,P as w}from"../chunk-av14gbps.js";import{Q,R as S,S as T,T as V,U as z,V as B,W as D}from"../chunk-avg4ftb9.js";import{$ as U,Y as A,Z as F,_ as R,aa as m,ba as x,ca as C,da as l,ea as h}from"../chunk-n0ebp7d8.js";export{wj as wrapInLayout,uj as stripConfiguredBasePath,Bj as startServer,R as splitLocaleFromPath,Dj as serveCLI,A as resolveI18nConfig,W as resetHighlighter,s as processInlineTocSyntax,b as prewarmHighlighter,X as normalizeLanguage,zj as markdownToHtml,U as localizeUrl,C as localeLabel,m as localeContentCandidates,F as loadI18nTranslations,Y as isLanguageSupported,_ as highlightCodeSync,Z as highlightCode,$ as getSyntaxHighlightingStyles,v as getHighlighterInstance,qj as getConfiguredBasePath,V as getConfig,f as generateUniqueSlug,jj as generateTocStyles,kj as generateTocScripts,i as generateTocPositions,a as generateTocHtml,t as generateTocData,p as generateSlug,w as generateSitemap,o as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,h as generateLocaleDetectionScript,n as generateInlineTocHtml,l as generateHreflangTags,r as generateFloatingTocHtml,g as filterHeadings,c as extractHeadings,e as enhanceHeadingsWithAnchors,y as defaultTocConfig,Q as defaultConfig,x as configForLocale,T as config,d as buildTocHierarchy,u as buildSitemap,B as buildSearchRuntimeConfig,D as buildSearchIndex,j as buildRssFeed,S as applyConfigPlugins,z as SEARCH_INDEX_PATH};
2
+ import{a as W,b as X,c as Y,d as Z,e as _,f as $,g as b,h as v,i as A,j as zj,k as Bj,l as Dj,m as Ej,n as Gj,o as Hj}from"../chunk-2vne40yj.js";import{A as w,w as j,x as k,y as q,z as u}from"../chunk-5cxb3t2e.js";import{$ as D,B as Q,C as S,D as T,E as V,H as p,I as f,J as c,K as d,L as g,M as a,N as n,O as o,P as r,Q as t,R as i,S as s,T as e,U as jj,V as kj,W as qj,X as uj,Y as wj,Z as z,_ as B}from"../chunk-he00q0q4.js";import{ba as F,ca as R,da as U,ea as m,fa as x,ga as C,ha as l,ia as h,ja as y}from"../chunk-3f29kjd8.js";export{Dj as wrapInLayout,Bj as stripConfiguredBasePath,Gj as startServer,U as splitLocaleFromPath,X as setLanguageAliases,Hj as serveCLI,F as resolveI18nConfig,W as resetHighlighter,d as reserveUniqueSlug,kj as processInlineTocSyntax,v as prewarmHighlighter,Y as normalizeLanguage,Ej as markdownToHtml,f as markdownHeadingText,m as localizeUrl,l as localeLabel,x as localeContentCandidates,R as loadI18nTranslations,Z as isLanguageSupported,$ as highlightCodeSync,_ as highlightCode,b as getSyntaxHighlightingStyles,A as getHighlighterInstance,zj as getConfiguredBasePath,V as getConfig,g as generateUniqueSlug,uj as generateTocStyles,wj as generateTocScripts,jj as generateTocPositions,r as generateTocHtml,e as generateTocData,c as generateSlug,w as generateSitemap,i as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,y as generateLocaleDetectionScript,t as generateInlineTocHtml,h as generateHreflangTags,s as generateFloatingTocHtml,o as filterHeadings,a as extractHeadings,qj as enhanceHeadingsWithAnchors,p as defaultTocConfig,Q as defaultConfig,C as configForLocale,T as config,n as buildTocHierarchy,u as buildSitemap,B as buildSearchRuntimeConfig,D as buildSearchIndex,j as buildRssFeed,S as applyConfigPlugins,z as SEARCH_INDEX_PATH};
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Locating code regions in markdown.
3
+ *
4
+ * Every markdown extension BunPress adds — includes, code imports, containers,
5
+ * alerts, emoji, badges — is a plain-text pattern, which means a docs page that
6
+ * *demonstrates* one in a code block would otherwise have it executed instead
7
+ * of shown. This module is how the pipeline tells "code" from "prose".
8
+ */
9
+ /**
10
+ * A stateful predicate answering "is this line part of a fenced code block?",
11
+ * fence markers included. Feed it every line of a document in order.
12
+ *
13
+ * A regex pass over the whole file cannot do this: docs commonly wrap example
14
+ * markdown in a four-backtick fence containing three-backtick fences, and
15
+ * naive pairing desyncs on the first one. CommonMark's rule is that the
16
+ * closing fence uses the same character and is at least as long as the opener,
17
+ * which is what this tracks.
18
+ */
19
+ export declare function createFenceTracker(): (line: string) => boolean;
20
+ /** Remove fenced code blocks, fences included. */
21
+ export declare function stripFencedCode(markdown: string): string;
22
+ /**
23
+ * Hide fenced code blocks and inline code spans behind placeholders so a
24
+ * transform can run over prose without reaching into code examples.
25
+ *
26
+ * Restoring is a single pass: code regions are captured verbatim and can never
27
+ * themselves contain a placeholder, so there is nothing to recurse into.
28
+ */
29
+ export declare function maskCodeRegions(markdown: string): MaskedCode;
30
+ /**
31
+ * Run a transform over `markdown` with code regions hidden.
32
+ */
33
+ export declare function withCodeMasked(markdown: string, transform: (masked: string) => string | Promise<string>): Promise<string>;
34
+ export declare interface MaskedCode {
35
+ masked: string
36
+ restore: (content: string) => string
37
+ }
package/dist/src/toc.d.ts CHANGED
@@ -1,8 +1,22 @@
1
1
  import type { TocConfig, TocData, TocHeading, TocPositionData } from './types';
2
+ /**
3
+ * Return the text a rendered Markdown heading exposes to the slugger.
4
+ *
5
+ * This intentionally does not reuse prose/list cleanup: a heading beginning
6
+ * with `1.` is numbered text, not an ordered-list marker.
7
+ */
8
+ export declare function markdownHeadingText(markdown: string): string;
2
9
  /**
3
10
  * Generate a URL-safe slug from heading text
4
11
  */
5
12
  export declare function generateSlug(text: string): string;
13
+ /**
14
+ * Reserve a unique heading id from an already-normalized slug.
15
+ *
16
+ * Custom anchors and generated slugs share one namespace in the rendered
17
+ * document, so callers must reserve both through the same path.
18
+ */
19
+ export declare function reserveUniqueSlug(slug: string, existingSlugs: Set<string>): string;
6
20
  /**
7
21
  * Generate unique slug for heading, handling duplicates
8
22
  */
@@ -68,6 +68,7 @@ export declare interface MarkdownPluginConfig {
68
68
  template?: string
69
69
  css?: string
70
70
  scripts?: string[]
71
+ languageAliases?: Record<string, string>
71
72
  title?: string
72
73
  meta?: Record<string, string>
73
74
  parserOptions?: {
@@ -99,14 +100,33 @@ export declare interface SidebarItem {
99
100
  collapsed?: boolean
100
101
  }
101
102
  /**
102
- * Navigation bar item
103
+ * Navigation bar item.
104
+ *
105
+ * An item with `items` renders a dropdown. The dropdown upgrades itself to a
106
+ * multi-column mega menu as soon as the content asks for one: when any child
107
+ * carries a `description`, when children are nested one level deeper into
108
+ * groups, or when `mega` is set explicitly. A flat list of bare links keeps
109
+ * rendering as the compact flyout it always did.
103
110
  */
104
111
  export declare interface NavItem {
105
112
  text: string
106
113
  link?: string
107
114
  icon?: string
115
+ description?: string
108
116
  items?: NavItem[]
109
117
  activeMatch?: string
118
+ mega?: boolean
119
+ columns?: number
120
+ footer?: NavItemFooter
121
+ }
122
+ /**
123
+ * Footer strip at the bottom of a mega-menu panel. Use it for the "see
124
+ * everything" link that would otherwise be one more item in a column.
125
+ */
126
+ export declare interface NavItemFooter {
127
+ text: string
128
+ link: string
129
+ note?: string
110
130
  }
111
131
  /**
112
132
  * Action link in hero section
@@ -116,6 +136,24 @@ export declare interface HeroAction {
116
136
  text: string
117
137
  link: string
118
138
  }
139
+ /**
140
+ * A code sample rendered as the hero's visual, highlighted by the same
141
+ * highlighter that renders markdown fences.
142
+ */
143
+ export declare interface HeroCode {
144
+ lang?: string
145
+ file?: string
146
+ content: string
147
+ }
148
+ /**
149
+ * Small link above the hero headline: a release note, a launch post, a
150
+ * "what changed" pointer.
151
+ */
152
+ export declare interface HeroAnnouncement {
153
+ text: string
154
+ link: string
155
+ tag?: string
156
+ }
119
157
  /**
120
158
  * Hero section configuration
121
159
  */
@@ -124,6 +162,8 @@ export declare interface Hero {
124
162
  text: string
125
163
  tagline?: string
126
164
  image?: string
165
+ code?: HeroCode | HeroCode[]
166
+ announcement?: HeroAnnouncement
127
167
  actions?: HeroAction[]
128
168
  }
129
169
  /**
@@ -133,6 +173,9 @@ export declare interface Feature {
133
173
  title: string
134
174
  icon?: string
135
175
  details: string
176
+ link?: string
177
+ linkText?: string
178
+ span?: number
136
179
  }
137
180
  /**
138
181
  * Frontmatter structure extracted from markdown files
@@ -1,6 +1,7 @@
1
1
  <div class="BPHomeHero">
2
2
  <div class="hero-container">
3
3
  <div class="hero-content">
4
+ {!! announcement !!}
4
5
  {!! name !!}
5
6
  {!! text !!}
6
7
  {!! tagline !!}
@@ -45,6 +46,15 @@
45
46
  height: auto;
46
47
  }
47
48
 
49
+ /* A code panel is a full column, not a logo slot: it stacks under the copy on
50
+ * narrow screens and takes the right half from 960px up. min-width:0 is what
51
+ * lets its own <pre> scroll instead of stretching the flex row. */
52
+ .hero-container > .BPHeroCode {
53
+ margin-top: 32px;
54
+ min-width: 0;
55
+ width: 100%;
56
+ }
57
+
48
58
  @media (min-width: 960px) {
49
59
  .BPHomeHero {
50
60
  padding: 56px 64px 72px;
@@ -52,6 +62,7 @@
52
62
 
53
63
  .hero-container {
54
64
  flex-direction: row;
65
+ align-items: center;
55
66
  text-align: left;
56
67
  gap: 64px;
57
68
  }
@@ -68,5 +79,16 @@
68
79
  .hero-image img {
69
80
  max-width: 280px;
70
81
  }
82
+
83
+ .hero-container > .BPHeroCode {
84
+ margin-top: 0;
85
+ flex: 0 1 46%;
86
+ }
87
+
88
+ /* Without a visual the copy is the whole hero, so it keeps its measure
89
+ * rather than running the full 1152px. */
90
+ .hero-container > .hero-content:only-child {
91
+ max-width: 780px;
92
+ }
71
93
  }
72
94
  </style>
@@ -22,8 +22,10 @@
22
22
  {!! localeSwitcher !!}
23
23
  {!! socialLinks !!}
24
24
  </div>
25
+ {!! navToggle !!}
25
26
  </div>
26
27
  </div>
28
+ {!! navScreen !!}
27
29
  </header>
28
30
 
29
31
  <style>