@stacksjs/bunpress 0.2.25 → 0.2.26
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/dist/bin/cli.js +1 -1
- package/dist/{chunk-q05cdgcg.js → chunk-0m9dwwyx.js} +5 -5
- package/dist/{chunk-09bb68gh.js → chunk-1a9sqtm0.js} +1 -1
- package/dist/{chunk-vm81tncs.js → chunk-778jqyb6.js} +30 -27
- package/dist/{chunk-za8p29nc.js → chunk-7g6bps6a.js} +1 -1
- package/dist/{chunk-27q0tg0q.js → chunk-sbdrmrx0.js} +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/message-previews.d.ts +6 -1
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{s as b,t as c}from"../chunk-
|
|
3
|
+
import{s as b,t as c}from"../chunk-0m9dwwyx.js";import"../chunk-5dtz0br7.js";import{ca as a}from"../chunk-778jqyb6.js";import"../chunk-gn1n2yxt.js";export{b as resolveConfig,a as findMarkdownFiles,c as buildDocs};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{v as f4,w as c4,y as p4}from"./chunk-5dtz0br7.js";import{$ as u4,A as g4,B as O,D as $4,I as w4,J as b4,K as v4,Z as d4,ca as r,da as l4}from"./chunk-
|
|
2
|
+
import{v as f4,w as c4,y as p4}from"./chunk-5dtz0br7.js";import{$ as u4,A as g4,B as O,D as $4,I as w4,J as b4,K as v4,Z as d4,ca as r,da as l4}from"./chunk-778jqyb6.js";import{fa as F,ga as i}from"./chunk-gn1n2yxt.js";var{Glob:g6}=globalThis.Bun;import{copyFile as f6,mkdir as c6,readdir as p6}from"fs/promises";import{existsSync as d6}from"fs";import{join as v,resolve as u6}from"path";import S from"process";import{CLI as l6}from"@stacksjs/clapp";var p="0.2.26";import{randomUUID as e4}from"crypto";import{mkdir as R4,mkdtemp as K6,readFile as Q6,realpath as Z6,rename as o,rm as d,rmdir as $6,writeFile as X6}from"fs/promises";import{basename as Y6,dirname as W4,join as q4,resolve as N6}from"path";var u=new Map;async function H6(K,Z){let Q=u.get(K)??Promise.resolve(),$,Y=new Promise((H)=>{$=H}),X=Q.then(()=>Y);u.set(K,X),await Q;try{return await Z()}finally{if($(),u.get(K)===X)u.delete(K)}}function _6(K){return K!==null&&typeof K==="object"&&"code"in K&&K.code==="ENOENT"}async function G4(K,Z,Q){let $=N6(K);await R4(W4($),{recursive:!0});let Y=q4(await Z6(W4($)),Y6($));return H6(Y,async()=>{let X=`${Y}.lock`;try{await R4(X,{mode:448})}catch(V){if(V!==null&&typeof V==="object"&&"code"in V&&V.code==="EEXIST")throw Error(`Documentation output is locked: ${X}. Verify the recorded owner has stopped before removing a stale lock.`);throw V}let H=JSON.stringify({pid:process.pid,token:e4()}),N=q4(X,"owner.json"),_,R,q=!1,G=!1;try{await X6(N,H,{flag:"wx",mode:384}),_=await K6(`${Y}.tmp-`);let V=await Z(_),U=`${_}.previous`;try{await o(Y,U),R=U}catch(W){if(!_6(W))throw W}if(await o(_,Y),q=!0,await Q?.(),G=!0,R)await d(R,{recursive:!0});return V}catch(V){if(!G&&(q||R))try{if(q)await d(Y,{recursive:!0});if(R)await o(R,Y)}catch(U){throw AggregateError([V,U],`Documentation publication failed; previous output is retained at ${R??Y}`)}throw V}finally{try{if(_)await d(_,{recursive:!0,force:!0})}finally{if(await Q6(N,"utf8").catch(()=>{return})===H)await d(N),await $6(X);else throw Error(`Documentation output lock ownership changed: ${X}`)}}})}var{Glob:R6}=globalThis.Bun;import{dirname as W6,relative as q6,resolve as l,sep as V4}from"path";import{mkdir as G6}from"fs/promises";function A4(K){return V4==="/"?K:K.split(V4).join("/")}function V6(K){let Z=new Bun.CryptoHasher("sha256");return Z.update(K),Z.digest("hex")}async function j4(K,Z,Q){let $=l(K),Y=Q?A4(q6($,l(Q))):void 0,X=[],H=new R6("**/*");for await(let R of H.scan({cwd:$,onlyFiles:!0})){let q=A4(R);if(q===Y)continue;X.push(q)}X.sort((R,q)=>R.localeCompare(q));let N=[],_=new Bun.CryptoHasher("sha256");for(let R of X){let q=new Uint8Array(await Bun.file(l($,R)).arrayBuffer()),G=V6(q);N.push({path:R,bytes:q.byteLength,sha256:G}),_.update(`${R}\x00${q.byteLength}\x00${G}
|
|
3
3
|
`)}return{schema_version:1,generator:"bunpress",generator_version:Z,outputs:N,tree_sha256:_.digest("hex")}}async function M4(K,Z,Q){let $=await j4(K,Q,Z);return await G6(W6(l(Z)),{recursive:!0}),await Bun.write(Z,`${JSON.stringify($,null,2)}
|
|
4
4
|
`),$}function J4(K){return new Map(K.outputs.map((Z)=>[Z.path,Z]))}async function U4(K,Z,Q){let $=await Bun.file(Z).json();if($.schema_version!==1||$.generator!=="bunpress"||!Array.isArray($.outputs))throw Error(`Unsupported or malformed BunPress build manifest: ${Z}`);let Y=await j4(K,Q,Z);if(JSON.stringify(Y)===JSON.stringify($))return Y;let X=J4($),H=J4(Y),N=Y.outputs.filter((G)=>!X.has(G.path)).map((G)=>G.path),_=$.outputs.filter((G)=>!H.has(G.path)).map((G)=>G.path),R=Y.outputs.filter((G)=>{let V=X.get(G.path);return V&&(V.bytes!==G.bytes||V.sha256!==G.sha256)}).map((G)=>{let V=X.get(G.path);return`${G.path} [bytes ${V.bytes} -> ${G.bytes}; sha256 ${V.sha256} -> ${G.sha256}]`}),q=[$.generator_version!==Y.generator_version?`generator ${$.generator_version} -> ${Y.generator_version}`:"",N.length?`added: ${N.join(", ")}`:"",_.length?`removed: ${_.join(", ")}`:"",R.length?`changed: ${R.join(", ")}`:""].filter(Boolean);throw Error(`BunPress output does not match ${Z}: ${q.join("; ")||"tree hash changed"}`)}import{existsSync as A6}from"fs";import{rm as J6}from"fs/promises";import{join as j6}from"path";var I={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 z(K,Z){return`${I[Z]}${K}${I.reset}`}function T(K){console.log(`${I.green}\u2713${I.reset} ${K}`)}function A(K){console.error(`${I.red}\u2717${I.reset} ${K}`)}function h(K){console.warn(`${I.yellow}\u26A0${I.reset} ${K}`)}function B(K){console.log(`${I.blue}\u2139${I.reset} ${K}`)}function w(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 t(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var B4=!!(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(B4){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let K=this.frames[this.index];process.stdout.write(`\r${I.cyan}${K}${I.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(K){this.stop(),T(K||this.text)}fail(K){this.stop(),A(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!B4)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function a(K,Z=!1){let Q=Z?"Y/n":"y/N";process.stdout.write(`${I.cyan}?${I.reset} ${K} ${I.dim}(${Q})${I.reset}: `);let $=Bun.file("/dev/stdin").stream().getReader(),Y=new TextDecoder,{value:X}=await $.read(),H=Y.decode(X).trim().toLowerCase();if(!H)return Z;return H==="y"||H==="yes"}function g(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let Y of Z)Q[Y]=Math.max(Y.length,...K.map((X)=>String(X[Y]).length));let $=Z.map((Y)=>Y.padEnd(Q[Y])).join(" ");console.log(z($,"bold")),console.log("\u2500".repeat($.length));for(let Y of K){let X=Z.map((H)=>String(Y[H]).padEnd(Q[H])).join(" ");console.log(X)}}async function n(K){try{return Bun.file(K).size}catch{return 0}}async function M6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let Y of Q.scan(K)){let X=`${K}/${Y}`,H=await n(X);$+=H}return $}catch{return 0}}async function T4(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=j6(Q,".bunpress"),Y=K.force||!1,X=K.verbose||!1;try{if(!A6($))return B(`Directory "${$}" does not exist, nothing to clean`),!0;let N=await M6($);if(X)B(`Found "${$}" (${w(N)})`);if(!Y){if(!await a(`Delete "${$}" directory? (${w(N)})`,!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 J6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${w(N)} from "${$}"`);else if(X||_)T(`Cleaned ${w(N)} from "${$}"`);return!0}catch(H){return A(`Failed to clean directory: ${H}`),!1}}import{existsSync as e}from"fs";import{join as K4}from"path";async function z4(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let Y of Z){let X=K4(process.cwd(),Y);if(e(X)){Q=X;break}}if(!Q)return A("No configuration file found"),B('Run "bunpress config init" to create one'),!1;T(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(z("Configuration:","bold")),console.log($),!0}catch(Z){return A(`Failed to show configuration: ${Z}`),!1}}async function O4(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let _ of Q){let R=K4(process.cwd(),_);if(e(R)){$=R;break}}if(!$)return A("No configuration file found"),!1;if(Z)B(`Validating ${$}...`);let X=(await import($)).default;if(!X)return A("Configuration file does not export a default object"),!1;let H=[],N=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")H.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")H.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))H.push("nav should be an array");else for(let[_,R]of X.nav.entries())if(!R.text||!R.link)H.push(`nav[${_}] is missing required fields (text, link)`)}if(!i(X))N.push("no `url` set: sitemap, RSS, canonical links and Open Graph tags are all skipped without an absolute base URL");if(H.length>0){A("Configuration validation failed:");for(let _ of H)console.log(` \u2022 ${_}`);return!1}for(let _ of N)h(_);return T("Configuration is valid \u2713"),!0}catch(Q){return A(`Failed to validate configuration: ${Q}`),!1}}async function L4(K={}){let Z=K4(process.cwd(),"bunpress.config.ts");if(e(Z))return A("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
5
5
|
|
|
@@ -290,8 +290,8 @@ ${Z}`}async function y6(K){let Z=[];async function Q($){let Y=await b.promises.r
|
|
|
290
290
|
`)){let X=Y.match(/^#{1,6}\s+(.*)$/);if(!X)continue;let H=X[1].trim(),N=H.match(/\{#([\w-]+)\}\s*$/),_=N?N[1]:b4(w4(H));if(!_)continue;v4(_,Q)}}catch{}return y4.set(K,Q),Q}function k6(K){let Z=[],Q=/!\[([^\]]*)\]\(([^)]+)\)/g,$;while(($=Q.exec(K))!==null){let Y=$[1],X=$[2];if(!Y||Y.trim()==="")Z.push(X)}return Z}function P6(K){if(console.log(""),B("\uD83D\uDCCA SEO Report"),console.log(""),console.log(`Total pages checked: ${z(K.totalPages.toString(),"blue")}`),console.log(`Passed: ${z(K.passed.toString(),"green")}`),console.log(`Errors: ${z(K.errors.length.toString(),K.errors.length>0?"red":"green")}`),console.log(`Warnings: ${z(K.warnings.length.toString(),K.warnings.length>0?"yellow":"green")}`),console.log(""),K.errors.length>0){A(`\u2717 ${K.errors.length} errors found:`),console.log("");let Z=K.errors.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g(Z),console.log("")}if(K.warnings.length>0){h(`\u26A0 ${K.warnings.length} warnings found:`),console.log("");let Z=K.warnings.map((Q)=>({Category:Q.category,File:Q.file,Message:Q.message}));g(Z),console.log("")}if(K.errors.length===0&&K.warnings.length===0)T("\u2713 All SEO checks passed!");else if(K.errors.length===0)T("\u2713 No errors found (only warnings)")}import{join as h6}from"path";async function m6(K){let Z=await Bun.file(K).text(),Q=Z.split(`
|
|
291
291
|
`),$=0,Y=!1,X=[];for(let R of Q){if(R.trim().startsWith("```")){Y=!Y;continue}if(!Y)X.push(R)}$=X.join(" ").split(/\s+/).filter((R)=>R.length>0).length;let N=Q.filter((R)=>R.match(/^#{1,6}\s+/)).length,_=(Z.match(/```/g)||[]).length/2;return{path:K,size:await n(K),lines:Q.length,words:$,headings:N,codeBlocks:Math.floor(_)}}async function h4(K={}){let Z=await O,Q=K.dir||Z.docsDir||"./docs",$=K.verbose||!1;try{console.log(z(`
|
|
292
292
|
Analyzing documentation...
|
|
293
|
-
`,"bold"));let{Glob:Y}=awaitPromise.resolve(globalThis.Bun),X=new Y("**/*.md"),H=[];for await(let j of X.scan(Q)){let J=h6(Q,j),f=await m6(J);H.push(f)}if(H.length===0)return A("No markdown files found"),!1;let N=H.reduce((j,J)=>j+J.size,0),_=H.reduce((j,J)=>j+J.lines,0),R=H.reduce((j,J)=>j+J.words,0),q=H.reduce((j,J)=>j+J.headings,0),G=H.reduce((j,J)=>j+J.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${H.length}`),console.log(`Total size: ${w(N)}`),console.log(`Total lines: ${_.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${q}`),console.log(`Code blocks: ${G}`),console.log(),$){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let j=H.map((J)=>({File:J.path.replace(`${Q}/`,""),Size:w(J.size),Lines:J.lines,Words:J.words,Headings:J.headings,"Code Blocks":J.codeBlocks}));g(j),console.log()}let V=N/H.length,U=_/H.length,W=R/H.length;console.log(z("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${w(V)}`),console.log(`Lines: ${Math.round(U)}`),console.log(`Words: ${Math.round(W)}`),console.log();let E=[...H].sort((j,J)=>J.size-j.size).slice(0,5);if(E.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let j of E){let J=j.path.replace(`${Q}/`,"");console.log(` ${J.padEnd(40)} ${w(j.size)}`)}console.log()}let x=Math.ceil(R/200);return B(`Estimated reading time: ${x} minutes`),!0}catch(Y){return A(`Failed to generate statistics: ${Y}`),!1}}var L=new l6("bunpress"),M={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function a6(K,Z,Q=!1){let $=`${Z}/public`;try{await p6($);let Y=new g6("**/*");for await(let X of Y.scan($)){let H=v($,X),N=v(K,X);await c6(v(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await f6(H,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function n6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let Y=await u4(K,Q);if(await Bun.write(v(Z,d4.replace(/^\//,"")),JSON.stringify(Y)),$)console.log(`Indexed ${Y.length} sections for search.`)}catch(Y){if($)console.error("Error generating search index:",Y)}}async function i6(K,Z,Q,$){try{if(Q.sitemap?.enabled!==!1&&i(Q))await p4(K,Z,Q);if(Q.robots?.enabled!==!1)await c4(Z,Q);if(Q.rss?.enabled)await f4(K,Z,Q,Q.rss)}catch(Y){if($)console.error("Error generating SEO files:",Y)}}async function s6(K={}){let Z=await O;if(!K.config)return Z;let Q=u6(S.cwd(),K.config);if(!d6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),Y=$.default??$;return g4({...Z,...Y})}async function m4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await s6(K),Q=K.outdir||Z.outDir||M.outdir,$=v(Q,".bunpress"),Y=K.dir||Z.docsDir||M.docsdir,X=K.verbose??M.verbose,H=performance.now(),N=new C("Building documentation...");if(!X)N.start();try{let _=await G4($,async(q)=>{let G=await r(Y);if(G.length===0)throw Error("No markdown files found in docs directory");if(X)console.log(`Found ${G.length} markdown files:`),G.forEach((y)=>console.log(`- ${y}`));let{markdownToHtml:V,wrapInLayout:U}=await import("./chunk-
|
|
294
|
-
Generated ${_} HTML files in ${$}`);return!0}catch(_){if(!X)N.fail("Build failed");return console.error("Error during build:",_),!1}}async function r6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-
|
|
293
|
+
`,"bold"));let{Glob:Y}=awaitPromise.resolve(globalThis.Bun),X=new Y("**/*.md"),H=[];for await(let j of X.scan(Q)){let J=h6(Q,j),f=await m6(J);H.push(f)}if(H.length===0)return A("No markdown files found"),!1;let N=H.reduce((j,J)=>j+J.size,0),_=H.reduce((j,J)=>j+J.lines,0),R=H.reduce((j,J)=>j+J.words,0),q=H.reduce((j,J)=>j+J.headings,0),G=H.reduce((j,J)=>j+J.codeBlocks,0);if(console.log(z("Summary","bold")),console.log("\u2500".repeat(50)),console.log(`Files: ${H.length}`),console.log(`Total size: ${w(N)}`),console.log(`Total lines: ${_.toLocaleString()}`),console.log(`Total words: ${R.toLocaleString()}`),console.log(`Headings: ${q}`),console.log(`Code blocks: ${G}`),console.log(),$){console.log(z("Per-file Statistics","bold")),console.log("\u2500".repeat(50));let j=H.map((J)=>({File:J.path.replace(`${Q}/`,""),Size:w(J.size),Lines:J.lines,Words:J.words,Headings:J.headings,"Code Blocks":J.codeBlocks}));g(j),console.log()}let V=N/H.length,U=_/H.length,W=R/H.length;console.log(z("Averages per File","bold")),console.log("\u2500".repeat(50)),console.log(`Size: ${w(V)}`),console.log(`Lines: ${Math.round(U)}`),console.log(`Words: ${Math.round(W)}`),console.log();let E=[...H].sort((j,J)=>J.size-j.size).slice(0,5);if(E.length>0){console.log(z("Top 5 Largest Files","bold")),console.log("\u2500".repeat(50));for(let j of E){let J=j.path.replace(`${Q}/`,"");console.log(` ${J.padEnd(40)} ${w(j.size)}`)}console.log()}let x=Math.ceil(R/200);return B(`Estimated reading time: ${x} minutes`),!0}catch(Y){return A(`Failed to generate statistics: ${Y}`),!1}}var L=new l6("bunpress"),M={outdir:O.outDir||"./dist",docsdir:O.docsDir||"./docs",port:3000,open:!0,watch:!0,verbose:O.verbose};async function a6(K,Z,Q=!1){let $=`${Z}/public`;try{await p6($);let Y=new g6("**/*");for await(let X of Y.scan($)){let H=v($,X),N=v(K,X);await c6(v(K,X.split("/").slice(0,-1).join("/")),{recursive:!0}),await f6(H,N)}}catch{if(Q)console.log("No public directory found, skipping static assets copy")}}async function n6(K,Z,Q,$){if((Q.search??Q.markdown?.search)?.enabled===!1)return;try{let Y=await u4(K,Q);if(await Bun.write(v(Z,d4.replace(/^\//,"")),JSON.stringify(Y)),$)console.log(`Indexed ${Y.length} sections for search.`)}catch(Y){if($)console.error("Error generating search index:",Y)}}async function i6(K,Z,Q,$){try{if(Q.sitemap?.enabled!==!1&&i(Q))await p4(K,Z,Q);if(Q.robots?.enabled!==!1)await c4(Z,Q);if(Q.rss?.enabled)await f4(K,Z,Q,Q.rss)}catch(Y){if($)console.error("Error generating SEO files:",Y)}}async function s6(K={}){let Z=await O;if(!K.config)return Z;let Q=u6(S.cwd(),K.config);if(!d6(Q))throw Error(`Config file not found: ${Q}`);let $=await import(Q),Y=$.default??$;return g4({...Z,...Y})}async function m4(K={}){if(K.manifest&&K.checkManifest)throw Error("--manifest and --check-manifest are mutually exclusive");let Z=await s6(K),Q=K.outdir||Z.outDir||M.outdir,$=v(Q,".bunpress"),Y=K.dir||Z.docsDir||M.docsdir,X=K.verbose??M.verbose,H=performance.now(),N=new C("Building documentation...");if(!X)N.start();try{let _=await G4($,async(q)=>{let G=await r(Y);if(G.length===0)throw Error("No markdown files found in docs directory");if(X)console.log(`Found ${G.length} markdown files:`),G.forEach((y)=>console.log(`- ${y}`));let{markdownToHtml:V,wrapInLayout:U}=await import("./chunk-7g6bps6a.js"),{loadI18nTranslations:W,resolveI18nConfig:E}=await import("./chunk-15vwh1bm.js"),{mkdir:x,writeFile:j}=await import("fs/promises"),J=await W(E(Z),Z);if(X)console.log("Transforming markdown to HTML...");let f=l4(G,Y,J),Y4=f.pages;for(let y of Y4){let a4=await Bun.file(y.sourceFile).text(),{html:n4,frontmatter:N4}=await V(a4,Y,{page:y,catalog:f}),m=y.relativePath,i4=`/${m}`,s4=N4.layout||"doc",r4=await U(n4,Z,i4,s4,N4,{i18n:J,locale:y.locale,sourceFile:y.sourceFile,docsDir:Y}),o4=m==="index"||m.endsWith("/index"),H4=y.locale&&y.locale!==J.defaultLocale&&J.enabled?v(q,y.locale):q,c=o4?v(H4,`${m}.html`):v(H4,m,"index.html"),_4=c.substring(0,c.lastIndexOf("/"));if(_4)await x(_4,{recursive:!0});if(await j(c,r4),X)console.log(`Generated: ${c}`)}if(X)console.log(`Processed ${G.length} markdown files into ${Y4.length} pages.`);if(await a6(q,Y,X),await o6(q),await r6(q,Z),K.searchIndex!==!1)await n6(Y,q,Z,X||!1);if(await i6(Y,q,Z,X||!1),K.checkManifest)await U4(q,K.checkManifest,p);return G.length},async()=>{if(K.manifest)await M4($,K.manifest,p)}),R=performance.now()-H;if(!X)N.succeed(`Built ${_} pages to HTML in ${t(R)}`);else T(`Build completed in ${t(R)}`),console.log(`
|
|
294
|
+
Generated ${_} HTML files in ${$}`);return!0}catch(_){if(!X)N.fail("Build failed");return console.error("Error during build:",_),!1}}async function r6(K,Z){let{getConfiguredBasePath:Q,wrapInLayout:$}=await import("./chunk-7g6bps6a.js"),X=`
|
|
295
295
|
<style>
|
|
296
296
|
.NotFound {
|
|
297
297
|
padding: 64px 24px 96px;
|
|
@@ -370,7 +370,7 @@ Generated ${_} HTML files in ${$}`);return!0}catch(_){if(!X)N.fail("Build failed
|
|
|
370
370
|
</div>
|
|
371
371
|
`,H=await $(X,Z,"/404","doc");await Bun.write(v(K,"404.html"),H)}async function o6(K){let Z=v(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)}}L.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("--manifest <path>","Write a deterministic rendered-tree manifest").option("--check-manifest <path>","Fail unless the rendered tree matches a checked manifest").option("--search-index","Write the client search index (on by default; --no-search-index skips it)",{default:!0}).option("--watch","Watch for changes and rebuild",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await m4(K))S.exit(1);if(K.watch){let{watch:Q}=await import("fs"),$=await O,Y=K.dir||$.docsDir||"./docs";console.log(`
|
|
372
372
|
Watching for changes...`),Q(Y,{recursive:!0},async(X,H)=>{if(H&&H.endsWith(".md"))console.log(`
|
|
373
|
-
Detected change in ${H}, rebuilding...`),await m4(K)}),await new Promise(()=>{})}});L.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:M.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:M.watch}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{let Z=await O,Q=K.port||M.port,$=K.dir||Z.docsDir||M.docsdir,Y=K.watch??M.watch,X=K.verbose??M.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:Y,verbose:X});let{serveCLI:H}=await import("./chunk-
|
|
373
|
+
Detected change in ${H}, rebuilding...`),await m4(K)}),await new Promise(()=>{})}});L.command("dev","Build and serve documentation using BunPress server").option("--port <port>","Port to listen on",{default:M.port}).option("--dir <dir>","Documentation directory").option("--watch","Watch for changes",{default:M.watch}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{let Z=await O,Q=K.port||M.port,$=K.dir||Z.docsDir||M.docsdir,Y=K.watch??M.watch,X=K.verbose??M.verbose;if(X)console.log("Starting BunPress dev server with options:",{port:Q,root:$,watch:Y,verbose:X});let{serveCLI:H}=await import("./chunk-7g6bps6a.js");await H({port:Q,root:$,watch:Y,config:Z})});async function t6(K={}){let Z=await O,Q=K.dir||Z.docsDir||M.docsdir,$=K.output||"./docs.md",Y=K.full??!1,X=K.verbose??M.verbose;if(X)console.log(`Generating LLM markdown from ${Q}`),console.log(`Output file: ${$}`),console.log(`Full content: ${Y}`);let H=await r(Q);if(H.length===0)return console.log("No markdown files found in docs directory"),!1;if(X)console.log(`Found ${H.length} markdown files`);H.sort();let N=`# Documentation
|
|
374
374
|
|
|
375
375
|
`;N+=`Generated: ${new Date().toISOString()}
|
|
376
376
|
|
|
@@ -389,5 +389,5 @@ Detected change in ${H}, rebuilding...`),await m4(K)}),await new Promise(()=>{})
|
|
|
389
389
|
`}N+=`---
|
|
390
390
|
|
|
391
391
|
`}return await Bun.write($,N),console.log(`
|
|
392
|
-
LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}L.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory (defaults to config docsDir)").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:M.verbose}).action(async(K)=>{if(!await t6(K))S.exit(1)});L.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 E4(K))S.exit(1)});L.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:M.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{await D4(K)});L.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:M.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await T4(K))S.exit(1)});L.command("doctor","Run diagnostic checks on the project").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await x4(K))S.exit(1)});L.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await z4(K))S.exit(1)});L.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await O4(K))S.exit(1)});L.command("config:init","Initialize configuration file").action(async(K)=>{if(!await L4(K))S.exit(1)});L.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:M.verbose}).action(async(K,Z)=>{if(!await F4(K,Z))S.exit(1)});L.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await h4(K))S.exit(1)});L.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await k4(K)});L.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:M.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-
|
|
392
|
+
LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}L.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory (defaults to config docsDir)").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:M.verbose}).action(async(K)=>{if(!await t6(K))S.exit(1)});L.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 E4(K))S.exit(1)});L.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:M.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{await D4(K)});L.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:M.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await T4(K))S.exit(1)});L.command("doctor","Run diagnostic checks on the project").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await x4(K))S.exit(1)});L.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await z4(K))S.exit(1)});L.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await O4(K))S.exit(1)});L.command("config:init","Initialize configuration file").action(async(K)=>{if(!await L4(K))S.exit(1)});L.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:M.verbose}).action(async(K,Z)=>{if(!await F4(K,Z))S.exit(1)});L.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--verbose","Enable verbose logging",{default:M.verbose}).action(async(K)=>{if(!await h4(K))S.exit(1)});L.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory (defaults to config docsDir)").option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await k4(K)});L.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:M.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-1a9sqtm0.js");if(!await Z(K))S.exit(1)});L.help();L.version(p);var X4=Bun.argv[1]||"",e6=X4.endsWith("/bunpress")||X4.endsWith("/cli.ts")||X4.endsWith("/cli.js");if(e6)L.parse();
|
|
393
393
|
export{T as o,A as p,B as q,C as r,s6 as s,m4 as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{o as $,p as I,q as f,r as h,t as x}from"./chunk-
|
|
2
|
+
import{o as $,p as I,q as f,r as h,t as x}from"./chunk-0m9dwwyx.js";import"./chunk-5dtz0br7.js";import{B as _}from"./chunk-778jqyb6.js";import"./chunk-gn1n2yxt.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;if(k.driver&&k.driver!=="aws")return I(`Unsupported cloud driver: ${k.driver}. Only 'aws' is implemented.`),!1;let 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,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ha as
|
|
2
|
+
import{ha as $0,ia as J0,la as C,ma as K0}from"./chunk-gn1n2yxt.js";import{loadConfig as B0}from"bunfig";var M0={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
|
|
|
@@ -1236,19 +1236,20 @@ if (typeof document !== 'undefined') {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
});
|
|
1238
1238
|
}
|
|
1239
|
-
`],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
|
|
1240
|
-
`).filter((
|
|
1241
|
-
`)}function
|
|
1242
|
-
`)),$.push(
|
|
1243
|
-
`)){if(
|
|
1244
|
-
`),restore:(W)=>W.replace(
|
|
1239
|
+
`],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 U0(Z){let Q=Z.plugins;if(!Array.isArray(Q)||Q.length===0)return Z;let X=Z;for(let $ of Q){if(!$||typeof $!=="object")continue;let J=$.name||"unnamed plugin";try{if(typeof $.extendConfig==="function")X=$.extendConfig(X)??X}catch(V){console.error(`[bunpress] ${J}: extendConfig failed \u2014`,V)}try{if(typeof $.validateConfig==="function"){let V=$.validateConfig(X);for(let W of V?.warnings??[])console.warn(`[bunpress] ${J}: ${W}`);for(let W of V?.errors??[])console.error(`[bunpress] ${J}: ${W}`)}}catch(V){console.error(`[bunpress] ${J}: validateConfig failed \u2014`,V)}}for(let $ of Q)try{$?.onConfigLoad?.(X)}catch(J){console.error(`[bunpress] ${$?.name||"unnamed plugin"}: onConfigLoad failed \u2014`,J)}return X}async function I0(){let Z=["bunpress.config.ts","bunpress.config.js",".config/bunpress.ts","docs.config.ts",".config/docs.ts"],Q=[];for(let X of Z)if(await Bun.file(X).exists())Q.push(X);if(Q.length>1){let[X,...$]=Q;console.warn(`[bunpress] Multiple config files found. Using ${X}; ignoring ${$.join(", ")}.`)}await _0(Q.length>0)}async function _0(Z){let Q=["docs","documentation","site"],X=["bunpress.config.ts","bunpress.config.js","docs.config.ts"];for(let $ of Q)for(let J of X){let V=`${$}/${J}`;if(!await Bun.file(V).exists())continue;let W=Z?`merge it into the config at the project root, or pass --config ${V}`:`move it to ./${J}, or pass --config ${V}`;console.warn(`[bunpress] ${V} is never loaded: config is discovered from the working directory, not the docs directory. To use it, ${W}.`);return}}await I0();var F0=U0(await B0({name:"bunpress",alias:"docs",defaultConfig:M0}));async function e0(){return F0}function y(){let Z=null;return(Q)=>{let X=Q.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!X)return Z!==null;let $=X[1];if(Z===null)return Z=$,!0;let J=$[0]===Z[0],V=$.length>=Z.length;if(J&&V&&X[2].trim()==="")Z=null;return!0}}function p(Z){let Q=y();return Z.split(`
|
|
1240
|
+
`).filter((X)=>!Q(X)).join(`
|
|
1241
|
+
`)}function u(Z){return`\x00BPCODE${Z}\x00`}var R0=/\u0000BPCODE(\d+)\u0000/g;function D0(Z){let Q=[],X=y(),$=[],J=null,V=()=>{if(!J)return;Q.push(J.join(`
|
|
1242
|
+
`)),$.push(u(Q.length-1)),J=null};for(let W of Z.split(`
|
|
1243
|
+
`)){if(X(W)){J??=[],J.push(W);continue}V(),$.push(W.replace(/(`+)(?:(?!\1)[\s\S])*\1/g,(Y)=>{return Q.push(Y),u(Q.length-1)}))}return V(),{masked:$.join(`
|
|
1244
|
+
`),restore:(W)=>W.replace(R0,(Y,q)=>Q[Number(q)]??Y)}}async function X1(Z,Q){let{masked:X,restore:$}=D0(Z);return $(await Q(X))}var O0=["email","email-html","sms"];function A0(Z){return O0.includes(Z.toLowerCase())}function _(Z){return Z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var s=/\{\{\s*([\w.-]+)\s*\}\}|\{([\w.-]+)\}/g;function O(Z){return _(Z).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*\w])\*([^*\s][^*]*)\*(?!\w)/g,"$1<em>$2</em>").replace(s,(Q)=>`<span class="bp-message-var">${Q}</span>`)}var L0=/\[([^\]]+)\]\(([^)\s]+)\)|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/g;function r(Z){if(/[\u0000-\u0020\u007f]/.test(Z))return!1;try{let Q=new URL(Z,"https://preview.invalid/");return["https:","http:","mailto:","tel:"].includes(Q.protocol)}catch{return!1}}function F(Z){let Q="",X=0;for(let $ of Z.matchAll(L0)){Q+=O(Z.slice(X,$.index));let J=$[2]??$[3],V=$[1]??$[3];Q+=r(J)?`<a href="${_(J)}" target="_blank" rel="noopener noreferrer">${O(V)}</a>`:O(V),X=$.index+$[0].length}return Q+O(Z.slice(X))}var g=/^([A-Za-z][\w-]*):\s*(.*)$/,w=/^\s*-{3,}\s*$/;function S(Z,Q){let X=Z.replace(/\r\n?/g,`
|
|
1245
1245
|
`).replace(/^\n+|\n+$/g,"").split(`
|
|
1246
|
-
`),$=[],J=0,V=
|
|
1247
|
-
`).split(/\n\s*-{3,}\s*\n?/).map((
|
|
1248
|
-
`).map(
|
|
1249
|
-
`)}var
|
|
1250
|
-
\xD8\xF8\r\xC5\xE5\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039E\xC6\xE6\xDF\xC9 !"#\xA4%&'()*+,-./0123456789:;<=>?\xA1ABCDEFGHIJKLMNOPQRSTUVWXYZ\xC4\xD6\xD1\xDC\xA7\xBFabcdefghijklmnopqrstuvwxyz\xE4\xF6\xF1\xFC\xE0`,
|
|
1251
|
-
`),
|
|
1246
|
+
`),$=[],J=0,V=X.findIndex((Y)=>w.test(Y));if(V>0){let Y=X.slice(0,V).filter((q)=>q.trim()!=="");if(Y.length>0&&Y.every((q)=>g.test(q))){for(let q of Y){let[,K,j]=q.match(g);$.push({key:K.toLowerCase(),value:j.trim()})}J=V+1}}let W=[[]];for(let Y of X.slice(J)){if(Q&&w.test(Y)){W.push([]);continue}W[W.length-1].push(Y)}return{headers:$,parts:W.map((Y)=>H0(Y)).filter((Y)=>Y.length>0)}}function H0(Z){let Q=0,X=Z.length;while(Q<X&&Z[Q].trim()==="")Q++;while(X>Q&&Z[X-1].trim()==="")X--;return Z.slice(Q,X)}function C0(Z){let Q=[[]];for(let X of Z){if(X.trim()===""){if(Q[Q.length-1].length>0)Q.push([]);continue}Q[Q.length-1].push(X)}return Q.filter((X)=>X.length>0)}var h=/^\s*\[([^\]]+)\]\(([^)\s]+)\)\s*$/,d=/^\s*[-*]\s+/;function c(Z){return C0(Z).map((Q)=>{if(Q.length===1&&w.test(Q[0]))return"<hr>";if(Q.every((X)=>h.test(X)))return`<p class="bp-email-actions">${Q.map(($)=>{let[,J,V]=$.match(h);if(!r(V))return O(J);return`<a class="bp-email-button" href="${_(V)}" target="_blank" rel="noopener noreferrer">${O(J)}</a>`}).join("")}</p>`;if(Q.every((X)=>d.test(X)))return`<ul>${Q.map((X)=>`<li>${F(X.replace(d,""))}</li>`).join("")}</ul>`;if(Q.every((X)=>X.startsWith(">")))return`<blockquote>${Q.map((X)=>F(X.replace(/^>\s?/,""))).join("<br>")}</blockquote>`;return Q.join(`
|
|
1247
|
+
`).split(/\n\s*-{3,}\s*\n?/).map((X)=>`<p>${X.split(`
|
|
1248
|
+
`).map(F).join("<br>")}</p>`).join("<hr>")}).join(`
|
|
1249
|
+
`)}var E0={from:"From",to:"To",cc:"Cc",bcc:"Bcc","reply-to":"Reply-To"};function o(Z){return E0[Z]??Z.replace(/[-_]/g," ").replace(/^\w/,(Q)=>Q.toUpperCase())}function l(Z,Q){let{headers:X,parts:$}=S(Z,!1),J=X.find((K)=>K.key==="subject")?.value,V=X.find((K)=>K.key==="preheader")?.value,W=X.find((K)=>K.key==="preview")?.value,Y=W&&/^\/(?!\/)[a-z0-9_./-]+\.html$/i.test(W)&&!W.split("/").includes("..")?W:void 0,q=X.filter((K)=>!["subject","preheader","preview"].includes(K.key)).map((K)=>`<div><dt>${_(o(K.key))}</dt><dd>${F(K.value)}</dd></div>`).join("");return['<figure class="bp-email bp-message" aria-label="Email preview">','<div class="bp-email-bar"><span class="bp-email-dots" aria-hidden="true"><i></i><i></i><i></i></span><span class="bp-message-kind">Email</span></div>',J?`<div class="bp-email-subject">${F(J)}</div>`:"",q?`<dl class="bp-email-headers">${q}</dl>`:"",V?`<div class="bp-email-preheader"><span>Preview text</span> ${F(V)}</div>`:"",Q?`<iframe class="bp-email-rendered" srcdoc="${_(Q)}" title="${_(J||"Rendered email preview")}" sandbox="" loading="lazy" referrerpolicy="no-referrer"></iframe>`:"",Y?`<iframe class="bp-email-rendered" src="${_(Y)}" title="${_(J||"Rendered email preview")}" sandbox="" loading="lazy" referrerpolicy="no-referrer"></iframe>`:"",Q?"":Y?`<details class="bp-email-copy"><summary>Message copy</summary><div class="bp-email-body">${c($[0]??[])}</div></details>`:`<div class="bp-email-body">${c($[0]??[])}</div>`,"</figure>"].join("")}var y0=`@\xA3$\xA5\xE8\xE9\xF9\xEC\xF2\xC7
|
|
1250
|
+
\xD8\xF8\r\xC5\xE5\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039E\xC6\xE6\xDF\xC9 !"#\xA4%&'()*+,-./0123456789:;<=>?\xA1ABCDEFGHIJKLMNOPQRSTUVWXYZ\xC4\xD6\xD1\xDC\xA7\xBFabcdefghijklmnopqrstuvwxyz\xE4\xF6\xF1\xFC\xE0`,S0="^{}\\[~]|\u20AC\f";function P0(Z){let Q=0,X=!0;for(let J of Z)if(y0.includes(J))Q+=1;else if(S0.includes(J))Q+=2;else{X=!1;break}if(X)return{encoding:"GSM-7",length:Q,segments:Q<=160?1:Math.ceil(Q/153)};let $=Z.length;return{encoding:"UCS-2",length:$,segments:$<=70?1:Math.ceil($/67)}}function w0(Z){let Q=Z.replace(s,""),X=Q!==Z;if(X&&Q.trim()==="")return'<div class="bp-sms-meta">Length depends on what is filled in</div>';let{encoding:$,length:J,segments:V}=P0(Q),W=X?" + placeholders":"",Y=`${X?"at least ":""}${V} ${V===1?"segment":"segments"}`,q=`${J} ${$==="GSM-7"?"characters":"UTF-16 units"} (${$})${X?", not counting placeholders":""}`;return`<div class="bp-sms-meta" title="${_(q)}">${J} chars${W} \xB7 ${Y}${$==="UCS-2"?" \xB7 Unicode":""}</div>`}function T0(Z){let{headers:Q,parts:X}=S(Z,!0),$=Q.find((q)=>q.key==="from")?.value??"",J=Q.find((q)=>q.key==="to")?.value,V=Q.filter((q)=>q.key!=="from"&&q.key!=="to").map((q)=>`<div><dt>${_(o(q.key))}</dt><dd>${F(q.value)}</dd></div>`).join(""),W=($.replace(/[^A-Za-z0-9]/g,"")[0]??"#").toUpperCase(),Y=X.map((q)=>{let K=q.every((z)=>z.trim()===""||z.startsWith(">")),j=K?q.map((z)=>z.replace(/^>\s?/,"")):q,B=j.join(`
|
|
1251
|
+
`),G=j.map(F).join("<br>");if(K)return`<div class="bp-sms-reply bp-sms-row"><div class="bp-sms-bubble">${G}</div></div>`;return`<div class="bp-sms-row"><div class="bp-sms-bubble">${G}</div>${w0(B)}</div>`}).join("");return['<figure class="bp-message bp-sms" aria-label="SMS preview">','<div class="bp-sms-phone">','<div class="bp-sms-header">',`<span class="bp-sms-avatar" aria-hidden="true">${_(W)}</span>`,'<span class="bp-sms-who">',`<span class="bp-sms-from">${F($||"Text message")}</span>`,J?`<span class="bp-sms-to">to ${F(J)}</span>`:"","</span>",'<span class="bp-message-kind">SMS</span>',"</div>",V?`<dl class="bp-sms-details">${V}</dl>`:"",`<div class="bp-sms-thread">${Y}</div>`,"</div>","</figure>"].join("")}function $1(Z,Q){switch(Z.toLowerCase()){case"email":return l(Q);case"email-html":{let{parts:X}=S(Q,!1);return l(Q,(X[0]??[]).join(`
|
|
1252
|
+
`))}case"sms":return T0(Q);default:return null}}var J1=`
|
|
1252
1253
|
.bp-message {
|
|
1253
1254
|
margin: 20px 0;
|
|
1254
1255
|
font-size: 15px;
|
|
@@ -1305,6 +1306,8 @@ if (typeof document !== 'undefined') {
|
|
|
1305
1306
|
background: var(--bp-c-bg-elv, #fff);
|
|
1306
1307
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
|
|
1307
1308
|
}
|
|
1309
|
+
.bp-email-rendered { display: block; width: 100%; height: 720px; border: 0; background: #f0f2f1; }
|
|
1310
|
+
.bp-email-copy > summary { padding: 12px 24px; cursor: pointer; font-size: 13px; border-top: 1px solid var(--bp-c-divider); }
|
|
1308
1311
|
.bp-email-bar {
|
|
1309
1312
|
display: flex;
|
|
1310
1313
|
align-items: center;
|
|
@@ -1491,17 +1494,17 @@ if (typeof document !== 'undefined') {
|
|
|
1491
1494
|
font-size: 11px;
|
|
1492
1495
|
color: var(--bp-c-text-3, #929295);
|
|
1493
1496
|
}
|
|
1494
|
-
`;function
|
|
1497
|
+
`;function i(Z){let Q=[],X=null,$=null;for(let J of Z.split(`
|
|
1495
1498
|
`)){let V=J.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if($){if(V&&V[1][0]===$.marker[0]&&V[1].length>=$.marker.length&&V[2].trim()===""){let{headers:W,parts:Y}=S($.lines.join(`
|
|
1496
|
-
`),!0);Q.push("",...W.map((
|
|
1497
|
-
`)}var
|
|
1498
|
-
${Y.map((B)=>{let
|
|
1499
|
-
<a href="#${B.id}" class="toc-link" title="${B.text.replace(/<[^>]*>/g,"")}">${
|
|
1500
|
-
${
|
|
1499
|
+
`),!0);Q.push("",...W.map((q)=>q.value),...Y.flat(),""),$=null}else $.lines.push(J);continue}if(X){if(V&&V[1][0]===X[0]&&V[1].length>=X.length&&V[2].trim()==="")X=null;Q.push(J);continue}if(V){if(A0(V[2].trim().split(/[\s{]/)[0]??""))$={marker:V[1],lines:[]};else X=V[1];if(!$)Q.push(J);continue}Q.push(J)}return Q.join(`
|
|
1500
|
+
`)}var b0={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function T(Z){return Z.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 b(Z){return Z.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 v(Z,Q){let X=Z,$=1;while(Q.has(Z))Z=`${X}-${$}`,$++;return Q.add(Z),Z}function n(Z,Q){return v(b(Z),Q)}function v0(Z){let Q=[],X=new Set,$=/^(#{1,6})\s+(.+)$/gm,J;while((J=$.exec(Z))!==null){let V=J[1].length,W=J[2].trim();if(!W)continue;if(W.includes("toc-ignore"))continue;let Y=W.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();Y=Y.replace(/`([^`]+)`/g,"<code>$1</code>");let q=Y.includes("<code>"),K=n(T(W),X);Q.push({level:V,text:Y,id:K,children:[],hasCode:q})}return Q}function x0(Z){let Q=[],X=[];for(let $ of Z){while(X.length>0&&X[X.length-1].level>=$.level)X.pop();if(X.length===0)Q.push($);else X[X.length-1].children.push($);X.push($)}return Q}function k0(Z,Q){let{minDepth:X=2,maxDepth:$=6,exclude:J=[]}=Q,V=(W)=>{let Y=[];for(let q of W){if(J.some((j)=>{if(j.startsWith("/")&&j.endsWith("/"))return new RegExp(j.slice(1,-1)).test(q.text);else return q.text===j}))continue;if(q.level>$)continue;let K=V(q.children);if(q.level>=X&&q.level<=$)Y.push({...q,children:K});else Y.push(...K)}return Y};return V(Z)}function P(Z){let{items:Q,title:X,config:$}=Z,{className:J,collapsible:V}=$,W=(Y,q=0)=>{if(Y.length===0)return"";let K=q===0?"toc-list":"toc-sublist",j=q===0?"toc-item":"toc-subitem";return`<ul class="${K}">
|
|
1501
|
+
${Y.map((B)=>{let G=B.children.length>0,z=G&&V?"toc-expand":"",N=G?W(B.children,q+1):"",I=50,M=B.text.length>50?`${B.text.substring(0,50)}...`:B.text,U=B.text.length>50?"toc-truncate":"";return`<li class="${B.hasCode?"toc-code":""} ${z} ${j} ${U}">
|
|
1502
|
+
<a href="#${B.id}" class="toc-link" title="${B.text.replace(/<[^>]*>/g,"")}">${M}</a>
|
|
1503
|
+
${N}
|
|
1501
1504
|
</li>`}).join(`
|
|
1502
1505
|
`)}
|
|
1503
|
-
</ul>`};return[`<nav class="${J}" role="navigation" aria-label="${
|
|
1504
|
-
`)}function
|
|
1506
|
+
</ul>`};return[`<nav class="${J}" role="navigation" aria-label="${X}">`,'<div class="toc-container">',` <h2 class="toc-title">${X}</h2>`,` ${W(Q)}`,"</div>","</nav>"].join(`
|
|
1507
|
+
`)}function a(Z){return P(Z).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function m0(Z){return P(Z).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function f0(Z){return P(Z).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function u0(Z,Q={}){let X={...Q};if(typeof X.position==="string")X.position=[X.position];let $={...b0,...X},J=v0(Z),V=x0(J),W=k0(V,$);return{title:$.title,items:W,config:$}}function W1(Z,Q={}){let X=u0(Z,Q);return(Array.isArray(Q.position)?Q.position:[Q.position||"sidebar"]).map((J)=>{let V;switch(J){case"inline":V=a(X);break;case"sidebar":V=m0(X);break;case"floating":V=f0(X);break;default:V=P(X)}return{position:J,data:X,html:V}})}function Y1(Z,Q){let X=a(Q);return Z.replace(/\[\[toc\]\]/gi,X)}function q1(Z){let Q=new Set;return Z.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(X,$,J)=>{let V=n(J.replace(/<[^>]*>/g,""),Q);return`<h${$} id="${V}"><a href="#${V}" class="heading-anchor">#</a>${J}</h${$}>`})}function z1(){return`
|
|
1505
1508
|
.table-of-contents {
|
|
1506
1509
|
position: sticky;
|
|
1507
1510
|
top: 60px; /* Match navbar height */
|
|
@@ -1631,7 +1634,7 @@ html {
|
|
|
1631
1634
|
max-width: 250px;
|
|
1632
1635
|
}
|
|
1633
1636
|
}
|
|
1634
|
-
`}function j1(
|
|
1637
|
+
`}function j1(Z={}){let Q=Z.smoothScroll!==!1,X=Z.activeHighlight!==!1,$=Z.collapsible!==!1;return`
|
|
1635
1638
|
function initToc() {
|
|
1636
1639
|
const tocLinks = document.querySelectorAll('.toc-link')
|
|
1637
1640
|
|
|
@@ -1656,7 +1659,7 @@ function initToc() {
|
|
|
1656
1659
|
|
|
1657
1660
|
// Active TOC item highlighting on scroll
|
|
1658
1661
|
function updateActiveTocItem() {
|
|
1659
|
-
if (!${String(
|
|
1662
|
+
if (!${String(X)}) return
|
|
1660
1663
|
const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6')
|
|
1661
1664
|
const tocLinks = document.querySelectorAll('.toc-link')
|
|
1662
1665
|
|
|
@@ -1733,7 +1736,7 @@ if (document.readyState === 'loading') {
|
|
|
1733
1736
|
else {
|
|
1734
1737
|
initToc()
|
|
1735
1738
|
}
|
|
1736
|
-
`}var{Glob:
|
|
1737
|
-
`),
|
|
1738
|
-
`)).slice(0,
|
|
1739
|
-
export{
|
|
1739
|
+
`}var{Glob:t,YAML:p0}=globalThis.Bun;import{join as g0}from"path";var F1="/search-index.json",A={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 V0(Z){let Q=Z?.options??{};return{...A,...Q,include:Q.include??A.include,exclude:Q.exclude??A.exclude,searchFields:Q.searchFields??A.searchFields,maxResults:Q.maxResults??Z?.maxResults??A.maxResults,boost:{...A.boost,...Q.boost??{}}}}var e=[{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 h0(Z){if(!Z)return e;let Q=(Array.isArray(Z)?Z:[Z]).map((J)=>String(J).toLowerCase()),X={meta:!1,ctrl:!1,alt:!1,shift:!1},$="";for(let J of Q)if(J==="meta"||J==="cmd"||J==="command")X.meta=!0;else if(J==="ctrl"||J==="control")X.ctrl=!0;else if(J==="alt"||J==="option")X.alt=!0;else if(J==="shift")X.shift=!0;else $=J;if(!$)return e;return[{key:$,...X}]}function Q0(Z){if(typeof Z!=="function")return null;let Q=Function.prototype.toString.call(Z);return Q.includes("[native code]")?null:Q}function R1(Z,Q){let X=Z?.search??Z?.markdown?.search,$=V0(X),J=X?.resultOptions??{};return{indexUrl:Q,placeholder:X?.placeholder??"Search documentation",lazy:X?.lazy!==!1,maxResults:$.maxResults,minQueryLength:$.minQueryLength,searchFields:$.searchFields,boost:{title:$.boost.title??10,headings:$.boost.headings??5,content:$.boost.content??1},fuzzy:$.fuzzy,fuzziness:$.fuzziness,stemmer:$.stemmer,shortcuts:{keyboard:X?.keyboardShortcuts!==!1,keys:h0(X?.shortcut)},result:{showDescription:J.showDescription!==!1,descriptionLength:J.descriptionLength??180,highlightMatches:J.highlightMatches!==!1,showPath:J.showPath!==!1},tokenizeSource:Q0(X?.options?.tokenize),onSearchSource:Q0(X?.onSearch),locale:null}}function X0(Z){return p(i(Z)).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 d0(Z){let Q=Z.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!Q)return{body:Z,data:{}};let X={};try{X=p0.parse(Q[1])??{}}catch{X={}}return{body:Z.slice(Q[0].length),data:X}}function c0(Z){let Q=Z.replace(/\.md$/,"");if(Q==="index")return"/";if(Q.endsWith("/index"))return`/${Q.slice(0,-6)}`;return`/${Q}`}function l0(Z,Q,X){let{body:$,data:J}=d0(Q);if(J.search===!1)return[];if(J.layout==="home")return[];let V=typeof J.search==="object"&&J.search!==null?J.search:{},W=Array.isArray(V.keywords)?V.keywords.map(String):[],Y=c0(Z),q=$.split(`
|
|
1740
|
+
`),K=$.match(/^#\s+(.+)$/m),j=V.title||J.title||(K?K[1].trim():Y),B=[],G=new Set,z={title:j,anchor:"",level:1,buffer:[]},N=()=>{let M=X0(z.buffer.join(`
|
|
1741
|
+
`)).slice(0,X.maxContentLength);if(!M&&!z.title)return;let U={url:z.anchor?`${Y}#${z.anchor}`:Y,page:j,title:X0(z.title)||j,text:M,level:z.level};if(W.length)U.keywords=W;B.push(U)},I=y();for(let M of q){let U=I(M)?null:M.match(/^(#{1,6})\s+(.+?)\s*$/);if(!U){z.buffer.push(M);continue}let L=U[1].length,H=U[2].replace(/\s*\{#([\w-]+)\}\s*$/,""),R=U[2].match(/\{#([\w-]+)\}\s*$/),D=v(R?R[1]:b(T(H)),G);if(L===1){z.buffer.push("");continue}N(),z={title:H,anchor:D,level:L,buffer:[]}}return N(),B.filter((M)=>M.text||M.level>1)}function s0(Z,Q){let{storeFields:X}=Q;if(!X||!X.length)return Z;let $=new Set(["url",...X]);if(Q.searchFields.includes("title"))$.add("title");if(Q.searchFields.includes("content"))$.add("text");if(Q.searchFields.includes("headings"))$.add("page");if(Q.searchFields.includes("keywords"))$.add("keywords");return Z.map((J)=>{let V={};for(let[W,Y]of Object.entries(J))if($.has(W)&&Y!==void 0)V[W]=Y;return V})}function Z0(Z){return Z.split("#")[0]}function r0(Z,Q){if(!Q.enabled)return{locale:Q.defaultLocale,page:Z};let X=Z.split("/");if(X.length>1&&Q.locales.includes(X[0])&&X[0]!==Q.defaultLocale)return{locale:X[0],page:X.slice(1).join("/")};let $=Z.match(/^(.*)\.([A-Za-z-]+)(\.md)$/);if($&&Q.locales.includes($[2]))return{locale:$[2],page:`${$[1]}${$[3]}`};return{locale:Q.defaultLocale,page:Z}}async function D1(Z,Q){let X=Q?.search??Q?.markdown?.search,$=V0(X),J=J0(Q),V=$.exclude.map((j)=>new t(j)),W=[],Y=new Set,q=new Map;for(let j of J.locales)q.set(j,new Set);for(let j of $.include){let B=new t(j);for await(let G of B.scan(Z)){let z=G.replace(/\\/g,"/");if(V.some((N)=>N.match(z)))continue;Y.add(z)}}for(let j of[...Y].sort())try{let B=await Bun.file(g0(Z,j)).text(),{locale:G,page:z}=r0(j,J);for(let N of l0(z,B,$)){if(J.enabled)N.locale=G,N.url=C(J,G,N.url);W.push(N),q.get(G)?.add(Z0(N.url))}}catch{}if(J.enabled){let j=W.filter((B)=>B.locale===J.defaultLocale);for(let B of J.locales){if(B===J.defaultLocale)continue;let G=q.get(B)??new Set;for(let z of j){let N=C(J,B,z.url);if(G.has(Z0(N)))continue;W.push({...z,url:N,locale:B})}}}let K=Q?$0(Q):"";if(K)for(let j of W)j.url=`${K}${j.url}`;return s0(W,$)}function W0(Z){let Q={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};return Z.replace(/&(#x[\da-f]+|#\d+|[a-z]+);/gi,(X,$)=>{if($[0]==="#"){let J=$[1]==="x"||$[1]==="X"?Number.parseInt($.slice(2),16):Number.parseInt($.slice(1),10);return Number.isFinite(J)&&J>0&&J<=1114111?String.fromCodePoint(J):X}return Q[$.toLowerCase()]??X})}function Y0(Z){return String(Z??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var{Glob:o0}=globalThis.Bun;import{dirname as i0,isAbsolute as q0,join as n0,relative as z0,resolve as E,sep as j0}from"path";async function y1(Z){let Q=[];for await(let X of new o0("**/*.md").scan({cwd:Z,onlyFiles:!0}))Q.push(n0(Z,X));return Q}function G0(Z){return Z.split("/").map((Q)=>encodeURIComponent(Q)).join("/")}function x(Z){let Q=Z==="index"?"":Z.replace(/\/index$/,"/");return`/${G0(Q)}`}function k(Z){return Z.split("/").map((X)=>encodeURIComponent(decodeURIComponent(X))).join("/").replace(/\/+$/,"")||"/"}function S1(Z,Q,X){let $=E(Q),J={...X,locales:[...X.locales]},V=new Set(Z.map((G)=>E(G))),W=new Map,Y=new Set;for(let G of V){let z=z0($,G).split(j0).join("/").replace(/\.md$/,"");if(z===".."||z.startsWith("../")||q0(z))throw Error("Markdown source is outside the documentation root");let N=J.defaultLocale,I=!1;if(J.enabled){let M=z.split("/");if(M.length>1&&J.locales.includes(M[0])&&M[0]!==J.defaultLocale)N=M.shift(),I=!0,z=M.join("/");else{let U=z.match(/^(.*)\.([A-Za-z-]+)$/);if(U&&J.locales.includes(U[2]))z=U[1],N=U[2],I=!0}}W.set(G,{path:z,locale:N,explicitLocale:I}),Y.add(z)}let q=[],K=new Map,j=new Map,B=new Map;for(let G of J.locales)for(let z of Y){let N=J.enabled?K0(J,$,G,`/${z}`).map((U)=>E(U)).find((U)=>V.has(U)):E($,`${z}.md`);if(!N||!V.has(N))continue;let I=Object.freeze({sourceFile:N,relativePath:z,locale:G}),M=`${G}\x00${k(x(z))}`;if(j.has(M))throw Error(`Documentation pages share an output route: ${x(z)}`);j.set(M,I),K.set(`${G}\x00${z}`,I),B.set(`${G}\x00${k(`/${G0(z)}`)}`,I),q.push(I)}return Object.freeze({pages:Object.freeze(q),findPage(G,z){let N=`${G}\x00${k(z)}`;return j.get(N)??B.get(N)},resolveLink(G,z){if(!z||/^(?:[a-z][a-z\d+.-]*:|\/|#|\?)/i.test(z))return z;let N=z.search(/[?#]/),I=N===-1?z:z.slice(0,N),M=N===-1?"":z.slice(N),U=I.replace(/%([\da-f]{2})/gi,(a0,N0)=>String.fromCharCode(Number.parseInt(N0,16)));if(!/\.md$/i.test(U))return z;let L=decodeURIComponent(I),H=E(i0(G.sourceFile),L),R=z0($,H);if(R===".."||R.startsWith(`..${j0}`)||q0(R))return z;let D=W.get(H);if(!D)throw Error(`Markdown link has no documentation source: ${I}`);let m=D.explicitLocale?D.locale:G.locale,f=K.get(`${m}\x00${D.path}`);if(!f)throw Error(`Markdown link has no rendered page: ${I}`);return`${C(J,m,x(f.relativePath))}${M}`}})}async function P1(Z,Q,X=new Map){let $=[Q.page],J=new Set(X.keys()),V=await new HTMLRewriter().onDocument({comments(W){let Y=X.get(W.text);if(Y===void 0)return;if(!J.delete(W.text))throw Error("Markdown include source boundary was duplicated");if(Y===null){if($.length===1)throw Error("Markdown include source boundaries are unbalanced");$.pop()}else $.push(Y);W.remove()}}).on("a[href]",{element(W){let Y=W0(W.getAttribute("href")),q=Q.catalog.resolveLink($[$.length-1],Y);if(q!==Y)W.setAttribute("href",Y0(q))}}).transform(new Response(Z)).text();if(J.size||$.length!==1)throw Error("Markdown include source boundaries did not survive rendering");return V}
|
|
1742
|
+
export{M0 as z,U0 as A,F0 as B,e0 as C,p as D,X1 as E,$1 as F,J1 as G,b0 as H,T as I,b as J,v as K,n as L,v0 as M,x0 as N,k0 as O,P,a as Q,m0 as R,f0 as S,u0 as T,W1 as U,Y1 as V,q1 as W,z1 as X,j1 as Y,F1 as Z,R1 as _,D1 as $,W0 as aa,Y0 as ba,y1 as ca,S1 as da,P1 as ea};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{j as c,k as d,l as e,m as f,n as g}from"./chunk-
|
|
2
|
+
import{j as c,k as d,l as e,m as f,n as g}from"./chunk-sbdrmrx0.js";import{aa as b}from"./chunk-778jqyb6.js";import{ha as a}from"./chunk-gn1n2yxt.js";export{d as wrapInLayout,c as stripConfiguredBasePath,f as startServer,g as serveCLI,e as markdownToHtml,a as getConfiguredBasePath,b as decodeHtmlEntities};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as mQ,B as P,E as t,F as CQ,G as _J,H as bQ,I as fQ,J as bJ,K as fJ,M as pQ,N as uQ,O as hQ,Q as gQ,Z as GJ,_ as dQ,aa as pJ,ba as E,ca as cQ,da as lQ,ea as sQ,z as yQ}from"./chunk-
|
|
2
|
+
import{$ as mQ,B as P,E as t,F as CQ,G as _J,H as bQ,I as fQ,J as bJ,K as fJ,M as pQ,N as uQ,O as hQ,Q as gQ,Z as GJ,_ as dQ,aa as pJ,ba as E,ca as cQ,da as lQ,ea as sQ,z as yQ}from"./chunk-778jqyb6.js";import{fa as a,ga as UJ,ha as p,ia as xJ,ja as CJ,ka as PQ,la as SQ,na as kQ,oa as kJ,pa as vQ,qa as xQ}from"./chunk-gn1n2yxt.js";var{Glob:IQ,YAML:DQ}=globalThis.Bun;import{randomUUID as rQ}from"crypto";import{stat as wQ}from"fs/promises";import{join as jJ,resolve as pZ}from"path";import n from"process";var{Glob:KZ}=globalThis.Bun;import{join as sJ,resolve as VZ}from"path";import _Z from"process";var $J=new Map;function GZ(J,Z,Q){let $=Z.split("."),Y=J;for(let X=0;X<$.length-1;X++){let q=$[X];if(typeof Y[q]!=="object"||Y[q]===null)Y[q]={};Y=Y[q]}Y[$[$.length-1]]=Q}async function rJ(J,Z){let Q=Z?VZ(_Z.cwd(),Z):sJ(J,".data");if($J.has(Q))return $J.get(Q);let $={};try{let Y=new KZ("**/*.json");for await(let X of Y.scan({cwd:Q,absolute:!1}))try{let q=await Bun.file(sJ(Q,X)).text(),z=X.replace(/\.json$/,"").replace(/[/\\]/g,".");GZ($,z,JSON.parse(q))}catch{}}catch{}return $J.set(Q,$),$}function iJ(){$J.clear()}import{createHighlighter as jZ,highlight as UZ,listLanguages as OZ}from"ts-syntax-highlighter";var r=null;function g0(){r=null}async function oJ(){if(r)return r;return r=await jZ({theme:"github-light",cache:!0}),r}var DJ=null;function aJ(){if(DJ)return DJ;let J=new Map;try{for(let Z of OZ()){J.set(Z.id.toLowerCase(),Z.id);for(let Q of Z.aliases??[])J.set(Q.toLowerCase(),Z.id)}}catch{}return DJ=J,J}var YJ={};function nJ(J){YJ={};for(let[Z,Q]of Object.entries(J??{}))YJ[Z.toLowerCase().trim()]=Q.toLowerCase().trim()}function tJ(J){let Z=J.toLowerCase().trim(),Q=YJ[Z]??Z;return aJ().get(Q)??Q}function eJ(J){let Z=J.toLowerCase().trim();return aJ().has(YJ[Z]??Z)}function XJ(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function NZ(J,Z){let Q=/<span[^>]*class="token[^"]*"[^>]*>([^<]*)<\/span>/g,$=[],Y;while((Y=Q.exec(Z))!==null){let z=Y[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;/g,"'");if(z)$.push({text:z,span:Y[0]})}if($.length===0)return Z;let X="",q=0;for(let z=0;z<$.length;z++){let{text:W,span:_}=$[z],K=J.indexOf(W,q);if(K===-1){X+=_;continue}if(K>q){let G=J.substring(q,K);if(/^\s+$/.test(G))X+=G}X+=_,q=K+W.length}return X}async function qJ(J,Z,Q="github-light"){let $=tJ(Z);if(!eJ($))return J.split(`
|
|
3
3
|
`).map((X)=>`<span class="line">${XJ(X)}</span>`).join(`
|
|
4
4
|
`);try{let Y=J.split(`
|
|
5
5
|
`);return(await Promise.all(Y.map(async(q)=>{if(!q.trim())return`<span class="line">${q}</span>`;let W=(await UZ(q,$,{theme:Q})).html;if(W=W.replace(/<div[^>]*class="syntax-wrapper"[^>]*>/g,""),W=W.replace(/<\/div>\s*$/g,""),W=W.replace(/<pre[^>]*>/g,""),W=W.replace(/<\/pre>/g,""),W=W.replace(/<code[^>]*>/g,""),W=W.replace(/<\/code>/g,""),W=NZ(q,W.trim()),!W.startsWith('<span class="line">'))W=`<span class="line">${W}</span>`;return W}))).join(`
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
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 Dj,k as Ej,l as Gj,m as Hj,n as Ij}from"../chunk-
|
|
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 Dj,k as Ej,l as Gj,m as Hj,n as Ij}from"../chunk-sbdrmrx0.js";import{u as j,v as k,w as q,x as u,y as w}from"../chunk-5dtz0br7.js";import{$ as D,A as S,B as T,C as V,H as f,I as c,J as d,K as g,L as a,M as n,N as o,O as r,P as t,Q as i,R as s,S as e,T as jj,U as kj,V as qj,W as uj,X as wj,Y as zj,Z as z,_ as B,aa as Bj,z as Q}from"../chunk-778jqyb6.js";import{ha as F,ia as R,ja as U,ka as m,la as x,ma as C,na as l,oa as h,pa as y,qa as p}from"../chunk-gn1n2yxt.js";export{Ej as wrapInLayout,Dj as stripConfiguredBasePath,Hj as startServer,m as splitLocaleFromPath,X as setLanguageAliases,Ij as serveCLI,R as resolveI18nConfig,W as resetHighlighter,g as reserveUniqueSlug,qj as processInlineTocSyntax,v as prewarmHighlighter,Y as normalizeLanguage,Gj as markdownToHtml,c as markdownHeadingText,x as localizeUrl,h as localeLabel,C as localeContentCandidates,U as loadI18nTranslations,Z as isLanguageSupported,$ as highlightCodeSync,_ as highlightCode,b as getSyntaxHighlightingStyles,A as getHighlighterInstance,F as getConfiguredBasePath,V as getConfig,a as generateUniqueSlug,wj as generateTocStyles,zj as generateTocScripts,kj as generateTocPositions,t as generateTocHtml,jj as generateTocData,d as generateSlug,w as generateSitemap,s as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,p as generateLocaleDetectionScript,i as generateInlineTocHtml,y as generateHreflangTags,e as generateFloatingTocHtml,r as filterHeadings,n as extractHeadings,uj as enhanceHeadingsWithAnchors,f as defaultTocConfig,Q as defaultConfig,Bj as decodeHtmlEntities,l as configForLocale,T as config,o as buildTocHierarchy,u as buildSitemap,B as buildSearchRuntimeConfig,D as buildSearchIndex,j as buildRssFeed,S as applyConfigPlugins,z as SEARCH_INDEX_PATH};
|
|
@@ -5,7 +5,7 @@ export declare function isMessagePreviewLang(lang: string): boolean;
|
|
|
5
5
|
* colon is never mistaken for one.
|
|
6
6
|
*/
|
|
7
7
|
export declare function parseMessage(source: string, splitParts: boolean): ParsedMessage;
|
|
8
|
-
export declare function renderEmailPreview(source: string): string;
|
|
8
|
+
export declare function renderEmailPreview(source: string, renderedHtml?: string): string;
|
|
9
9
|
/** How many SMS segments a message costs, the way carriers count them. */
|
|
10
10
|
export declare function countSmsSegments(text: string): SmsSegments;
|
|
11
11
|
export declare function renderSmsPreview(source: string): string;
|
|
@@ -43,6 +43,11 @@ export declare function unwrapMessageFences(markdown: string): string;
|
|
|
43
43
|
* In an `sms` fence every later `---` starts another message in the thread,
|
|
44
44
|
* and a message whose lines all start with `> ` is a reply from the recipient.
|
|
45
45
|
* In an `email` fence a later `---` is a divider (above a footer, say).
|
|
46
|
+
* `email-html` fences accept rendered HTML after their headers and show it
|
|
47
|
+
* in a script-free sandbox. This keeps a real template preview self-contained.
|
|
48
|
+
* `preview: /email-previews/welcome.html` embeds an actual rendered static email
|
|
49
|
+
* in a sandboxed iframe, with the text copy kept in a disclosure underneath.
|
|
50
|
+
* Preview paths must be same-site absolute HTML paths without parent segments.
|
|
46
51
|
* `{name}` and `{{ name }}` placeholders are highlighted as variables.
|
|
47
52
|
*/
|
|
48
53
|
/** The fence languages rendered as message previews. */
|