@stacksjs/bunpress 0.1.21 → 0.2.0
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.d.ts +3 -0
- package/dist/bin/cli.js +1 -1
- package/dist/{chunk-kxr6zf7e.js → chunk-2ns9va8d.js} +1315 -464
- package/dist/{chunk-qdmkac4z.js → chunk-av14gbps.js} +10 -11
- package/dist/{chunk-m0g9vk1e.js → chunk-avg4ftb9.js} +159 -194
- package/dist/chunk-fyb5bzsp.js +10 -0
- package/dist/chunk-n0ebp7d8.js +38 -0
- package/dist/{chunk-qrp18ybj.js → chunk-trhgd2dy.js} +1 -1
- package/dist/chunk-w615shtf.js +2 -0
- package/dist/chunk-x5m3c6jd.js +469 -0
- package/dist/src/build-manifest.d.ts +22 -0
- package/dist/src/config.d.ts +12 -0
- package/dist/src/data-loader.d.ts +6 -3
- package/dist/src/highlighter.d.ts +2 -1
- package/dist/src/i18n.d.ts +67 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/page-meta.d.ts +19 -0
- package/dist/src/search-index.d.ts +61 -0
- package/dist/src/serve.d.ts +20 -5
- package/dist/src/toc.d.ts +6 -2
- package/dist/src/types.d.ts +80 -8
- package/dist/templates/blocks/alerts/caution.stx +2 -2
- package/dist/templates/blocks/alerts/important.stx +2 -2
- package/dist/templates/blocks/alerts/note.stx +2 -2
- package/dist/templates/blocks/alerts/tip.stx +2 -2
- package/dist/templates/blocks/alerts/warning.stx +2 -2
- package/dist/templates/blocks/containers/danger.stx +2 -2
- package/dist/templates/blocks/containers/details.stx +2 -2
- package/dist/templates/blocks/containers/info.stx +2 -2
- package/dist/templates/blocks/containers/raw.stx +1 -1
- package/dist/templates/blocks/containers/tip.stx +2 -2
- package/dist/templates/blocks/containers/warning.stx +2 -2
- package/dist/templates/copy-page.stx +81 -0
- package/dist/templates/doc-footer.stx +51 -0
- package/dist/templates/footer.stx +45 -0
- package/dist/templates/hero.stx +9 -2
- package/dist/templates/layout-doc.stx +8 -125
- package/dist/templates/layout-home.stx +7 -14
- package/dist/templates/layout-page.stx +7 -14
- package/dist/templates/locale-switcher.stx +115 -0
- package/dist/templates/navbar.stx +49 -0
- package/dist/templates/page-outline.stx +149 -0
- package/dist/templates/page-toc.stx +1 -1
- package/dist/templates/search-algolia.stx +85 -0
- package/dist/templates/search.stx +661 -0
- package/dist/templates/sidebar-section.stx +44 -11
- package/dist/templates/sidebar.stx +11 -2
- package/dist/themes/vitepress/index.ts +558 -165
- package/package.json +16 -7
- package/dist/chunk-9cm3e4r4.js +0 -688
- package/dist/chunk-mjhqecp5.js +0 -467
- package/dist/chunk-wmvgjzgh.js +0 -3
- package/dist/chunk-zmxtnx2v.js +0 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var{YAML:
|
|
2
|
+
var{YAML:E}=globalThis.Bun;import*as I from"fs";import*as A from"path";async function R(H,J,j){let K=J.sitemap?.baseUrl||"",N=j?.title||J.title||J.markdown?.title||"Documentation Feed",O=j?.description||J.description||J.markdown?.meta?.description||"Documentation updates",Q=j?.author||"Documentation Team",Z=j?.email||"",_=j?.language||"en-us",$=j?.maxItems||20,V=j?.fullContent||!1,W=await F(H,K,V);W.sort((G,Y)=>Y.pubDate.getTime()-G.pubDate.getTime());let B=W.slice(0,$);return x({title:N,description:O,link:K,language:_,author:Q,email:Z,items:B})}async function u(H,J,j,K){if(!K?.enabled)return;if(!j.sitemap?.baseUrl){if(j.verbose)console.warn("\u26A0\uFE0F RSS feed generation skipped: baseUrl not configured");return}let N=await R(H,j,K),O=K.filename||"feed.xml",Q=A.join(J,O);if(await I.promises.writeFile(Q,N,"utf-8"),j.verbose){let Z=(N.match(/<item>/g)||[]).length;console.log(`\u2705 RSS feed generated: ${Q} (${Z} items)`)}}async function F(H,J,j){let K=[],N=await w(H);for(let O of N){let Q=await I.promises.readFile(O,"utf-8"),{frontmatter:Z,markdown:_}=k(Q);if(!Z.date||!Z.title)continue;let V=A.relative(H,O).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!V.startsWith("/"))V=`/${V}`;if(V.endsWith("/")&&V!=="/")V=V.slice(0,-1);let W=`${J.replace(/\/$/,"")}${V}`,B=Z.description||U(_),G=new Date(Z.date),Y=Z.author;K.push({title:Z.title,link:W,description:B,pubDate:G,author:Y,content:j?_:void 0})}return K}async function w(H){let J=[];async function j(K){let N=await I.promises.readdir(K,{withFileTypes:!0});for(let O of N){let Q=A.join(K,O.name);if(O.isDirectory()){if(!O.name.startsWith(".")&&O.name!=="node_modules")await j(Q)}else if(O.isFile()&&O.name.endsWith(".md"))J.push(Q)}}return await j(H),J}function k(H){let J=/^---\n([\s\S]*?)\n---\n?/,j=H.match(J);if(!j)return{frontmatter:{},markdown:H};let K=j[1],N=H.slice(j[0].length);try{return{frontmatter:E.parse(K),markdown:N}}catch{return{frontmatter:{},markdown:H}}}function U(H,J=200){let j=H.replace(/^#{1,6}\s+(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]+`/g,"").replace(/!\[.*?\]\(.*?\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_~]/g,"").trim(),K=j.split(`
|
|
3
3
|
|
|
4
|
-
`)[0]||j;if(K.length>J)return`${K.slice(0,J)}...`;return K}function
|
|
4
|
+
`)[0]||j;if(K.length>J)return`${K.slice(0,J)}...`;return K}function x(H){let J=new Date,j=H.items.length>0?H.items[0].pubDate:J,K=H.items.map((N)=>{let O=N.content?`
|
|
5
5
|
<content:encoded><![CDATA[${N.content}]]></content:encoded>`:"",Q=N.author?`
|
|
6
6
|
<dc:creator><![CDATA[${N.author}]]></dc:creator>`:"";return` <item>
|
|
7
7
|
<title><![CDATA[${N.title}]]></title>
|
|
@@ -11,23 +11,22 @@ var{YAML:w}=globalThis.Bun;import*as I from"fs";import*as T from"path";async fun
|
|
|
11
11
|
<pubDate>${N.pubDate.toUTCString()}</pubDate>${Q}${O}
|
|
12
12
|
</item>`}).join(`
|
|
13
13
|
`);return['<?xml version="1.0" encoding="UTF-8"?>','<rss version="2.0"',' xmlns:content="http://purl.org/rss/1.0/modules/content/"',' xmlns:dc="http://purl.org/dc/elements/1.1/"',' xmlns:atom="http://www.w3.org/2005/Atom">'," <channel>",` <title><![CDATA[${H.title}]]></title>`,` <description><![CDATA[${H.description}]]></description>`,` <link>${H.link}</link>`,` <language>${H.language}</language>`,` <lastBuildDate>${j.toUTCString()}</lastBuildDate>`,` <atom:link href="${H.link}/feed.xml" rel="self" type="application/rss+xml"/>`,K," </channel>","</rss>"].join(`
|
|
14
|
-
`)}import*as
|
|
14
|
+
`)}import*as M from"fs";import*as S from"path";async function g(H,J){let j=J.robots;if(j?.enabled===!1)return;let K=j?.filename||"robots.txt",N=P(J),O=S.join(H,K);if(await M.promises.writeFile(O,N,"utf-8"),J.verbose)console.log(`\u2705 Robots.txt generated: ${O}`)}function P(H){let J=H.robots,j=[];if(J?.rules&&J.rules.length>0)for(let K of J.rules)j.push(...b(K)),j.push("");else j.push("User-agent: *"),j.push("Allow: /"),j.push("");if(J?.host)j.push(`Host: ${J.host}`),j.push("");if(J?.sitemaps&&J.sitemaps.length>0){for(let K of J.sitemaps)j.push(`Sitemap: ${K}`);j.push("")}else if(H.sitemap?.enabled!==!1&&H.sitemap?.baseUrl){let K=H.sitemap.filename||"sitemap.xml",N=`${H.sitemap.baseUrl.replace(/\/$/,"")}/${K}`;j.push(`Sitemap: ${N}`),j.push("")}if(J?.customContent)j.push(J.customContent),j.push("");return`${j.join(`
|
|
15
15
|
`).trim()}
|
|
16
|
-
`}function
|
|
16
|
+
`}function b(H){let J=[];if(J.push(`User-agent: ${H.userAgent}`),H.allow&&H.allow.length>0)for(let j of H.allow)J.push(`Allow: ${j}`);if(H.disallow&&H.disallow.length>0)for(let j of H.disallow)J.push(`Disallow: ${j}`);if(H.crawlDelay!==void 0)J.push(`Crawl-delay: ${H.crawlDelay}`);return J}import*as T from"fs";import*as z from"path";async function v(H,J,j){let K=J.sitemap,N=await D(H,j,K?.defaultPriority??0.5,K?.defaultChangefreq||"monthly",K?.exclude||[],K?.priorityMap||{},K?.changefreqMap||{});return K?.transform?N.map((O)=>K.transform(O)).filter(Boolean):N}async function l(H,J){let j=(J.sitemap?.baseUrl||"").replace(/\/$/,""),K=await v(H,J,j);return q(K,j)}async function a(H,J,j){let K=j.sitemap;if(K?.enabled===!1)return;if(!K?.baseUrl){if(j.verbose)console.warn("\u26A0\uFE0F Sitemap generation skipped: baseUrl not configured");return}let N=K.baseUrl.replace(/\/$/,""),O=K.filename||"sitemap.xml",Q=K.maxUrlsPerFile||50000,Z=K.useSitemapIndex||!1,_=await v(H,j,N);if(j.verbose)console.log(`\uD83D\uDCC4 Generated ${_.length} sitemap entries`);if(Z&&_.length>Q)await C(_,J,N,O,Q);else{let $=q(_,N),V=z.join(J,O);if(await T.promises.writeFile(V,$,"utf-8"),j.verbose)console.log(`\u2705 Sitemap generated: ${V}`)}}async function D(H,J,j,K,N,O,Q){let Z=[],_=await y(H);for(let $ of _){let W=z.relative(H,$).replace(/\.md$/,"").replace(/index$/,"").replace(/\\/g,"/");if(!W.startsWith("/"))W=`/${W}`;if(W.endsWith("/")&&W!=="/")W=W.slice(0,-1);if(h(W,N))continue;let B=j;for(let[Y,X]of Object.entries(O))if(L(W,Y)){B=X;break}let G=K;for(let[Y,X]of Object.entries(Q))if(L(W,Y)){G=X;break}Z.push({url:W,changefreq:G,priority:B})}return Z.sort(($,V)=>$.url.localeCompare(V.url))}async function y(H){let J=[];async function j(K){let N=await T.promises.readdir(K,{withFileTypes:!0});for(let O of N){let Q=z.join(K,O.name);if(O.isDirectory()){if(!O.name.startsWith(".")&&O.name!=="node_modules")await j(Q)}else if(O.isFile()&&O.name.endsWith(".md"))J.push(Q)}}return await j(H),J}function h(H,J){for(let j of J)if(L(H,j))return!0;return!1}function L(H,J){let j=J.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".");return new RegExp(`^${j}$`).test(H)}function q(H,J=""){let j=J.replace(/\/$/,"");return`<?xml version="1.0" encoding="UTF-8"?>
|
|
17
17
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
18
18
|
${H.map((N)=>{let O=/^https?:\/\//.test(N.url)?N.url:`${j}${N.url}`,Q=N.lastmod?`
|
|
19
|
-
<lastmod>${
|
|
19
|
+
<lastmod>${p(N.lastmod)}</lastmod>`:"",Z=N.changefreq?`
|
|
20
20
|
<changefreq>${N.changefreq}</changefreq>`:"",_=N.priority!==void 0?`
|
|
21
21
|
<priority>${N.priority.toFixed(1)}</priority>`:"";return` <url>
|
|
22
22
|
<loc>${O}</loc>${Q}${Z}${_}
|
|
23
23
|
</url>`}).join(`
|
|
24
24
|
`)}
|
|
25
|
-
</urlset>`}async function
|
|
25
|
+
</urlset>`}async function C(H,J,j,K,N){let O=d(H,N),Q=[];for(let V=0;V<O.length;V++){let W=`sitemap-${V+1}.xml`,B=q(O[V],j),G=z.join(J,W);await T.promises.writeFile(G,B,"utf-8"),Q.push(W)}let _=`<?xml version="1.0" encoding="UTF-8"?>
|
|
26
26
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
27
|
-
${Q.map((V)=>{
|
|
28
|
-
<loc>${
|
|
29
|
-
<lastmod>${F(B)}</lastmod>
|
|
27
|
+
${Q.map((V)=>{return` <sitemap>
|
|
28
|
+
<loc>${`${j}/${V}`}</loc>
|
|
30
29
|
</sitemap>`}).join(`
|
|
31
30
|
`)}
|
|
32
|
-
</sitemapindex>`,$=
|
|
33
|
-
export{
|
|
31
|
+
</sitemapindex>`,$=z.join(J,K);await T.promises.writeFile($,_,"utf-8")}function p(H){return(typeof H==="string"?new Date(H):H).toISOString().split("T")[0]}function d(H,J){let j=[];for(let K=0;K<H.length;K+=J)j.push(H.slice(K,K+J));return j}
|
|
32
|
+
export{R as L,u as M,g as N,l as O,a as P};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{loadConfig as
|
|
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:`
|
|
3
3
|
/* Additional BunPress customizations */
|
|
4
4
|
/* Note: Base styles are provided by the VitePress theme */
|
|
5
5
|
|
|
@@ -69,6 +69,11 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
69
69
|
font-size: 14px;
|
|
70
70
|
line-height: 1.7;
|
|
71
71
|
color: #24292f;
|
|
72
|
+
/* Scroll, never wrap: wrapped code loses its indentation. */
|
|
73
|
+
white-space: pre;
|
|
74
|
+
/* fit-content + min-width lets a long line extend the scroll width. */
|
|
75
|
+
width: fit-content;
|
|
76
|
+
min-width: 100%;
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
/* Dark mode code blocks */
|
|
@@ -84,95 +89,7 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
84
89
|
color: #e6edf3;
|
|
85
90
|
}
|
|
86
91
|
|
|
87
|
-
/* Code groups -
|
|
88
|
-
.code-group {
|
|
89
|
-
margin: 16px 0;
|
|
90
|
-
border-radius: 8px;
|
|
91
|
-
overflow: hidden;
|
|
92
|
-
border: 1px solid #e2e2e3;
|
|
93
|
-
background-color: #f6f6f7 !important;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
html.dark .code-group {
|
|
97
|
-
border-color: #3c3f44;
|
|
98
|
-
background-color: #161618 !important;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.code-group-tabs {
|
|
102
|
-
display: flex;
|
|
103
|
-
background-color: #f6f6f7 !important;
|
|
104
|
-
border-bottom: 1px solid #e2e2e3;
|
|
105
|
-
overflow-x: auto;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
html.dark .code-group-tabs {
|
|
109
|
-
background-color: #161618 !important;
|
|
110
|
-
border-bottom-color: #3c3f44;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.code-group-tab {
|
|
114
|
-
padding: 12px 16px;
|
|
115
|
-
font-size: 14px;
|
|
116
|
-
font-weight: 500;
|
|
117
|
-
color: #67676c;
|
|
118
|
-
background: transparent;
|
|
119
|
-
border: none;
|
|
120
|
-
border-bottom: 2px solid transparent;
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
white-space: nowrap;
|
|
123
|
-
transition: color 0.2s, border-color 0.2s;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.code-group-tab:hover {
|
|
127
|
-
color: #3c3c43;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.code-group-tab.active {
|
|
131
|
-
color: #3451b2;
|
|
132
|
-
border-bottom-color: #3451b2;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
html.dark .code-group-tab {
|
|
136
|
-
color: #9ca3af;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
html.dark .code-group-tab:hover {
|
|
140
|
-
color: #e6edf3;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
html.dark .code-group-tab.active {
|
|
144
|
-
color: #a8b1ff;
|
|
145
|
-
border-bottom-color: #a8b1ff;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.code-group-panels {
|
|
149
|
-
background-color: #f6f6f7 !important;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
html.dark .code-group-panels {
|
|
153
|
-
background-color: #161618 !important;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.code-group-panel {
|
|
157
|
-
display: none;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.code-group-panel.active {
|
|
161
|
-
display: block;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.code-group-panel pre,
|
|
165
|
-
.code-group pre {
|
|
166
|
-
margin: 0 !important;
|
|
167
|
-
border-radius: 0 !important;
|
|
168
|
-
border: none !important;
|
|
169
|
-
background-color: #f6f6f7 !important;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
html.dark .code-group-panel pre,
|
|
173
|
-
html.dark .code-group pre {
|
|
174
|
-
background-color: #161618 !important;
|
|
175
|
-
}
|
|
92
|
+
/* Code groups are styled by the theme (codeGroupCSS), which owns the tab metrics, the active-tab bar and dark mode via CSS variables. Duplicating them here fought it: a second padding rule on top of the theme's 48px line-height inflated the tab bar to 74px, and a second border-bottom drew a second active indicator under the theme's own. */
|
|
176
93
|
|
|
177
94
|
/* Language label positioning */
|
|
178
95
|
pre[data-lang]::before {
|
|
@@ -228,67 +145,62 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
228
145
|
margin-bottom: 12px;
|
|
229
146
|
}
|
|
230
147
|
|
|
231
|
-
/* List styling
|
|
148
|
+
/* List styling. Scoped to a bare article element only: inside .bp-doc the theme owns lists, and duplicating them here produced two competing sets of margins. */
|
|
232
149
|
article ul,
|
|
233
|
-
article ol
|
|
234
|
-
.bp-doc ul,
|
|
235
|
-
.bp-doc ol {
|
|
150
|
+
article ol {
|
|
236
151
|
padding-left: 1.5rem;
|
|
237
152
|
margin: 16px 0;
|
|
153
|
+
list-style-position: outside;
|
|
238
154
|
}
|
|
239
155
|
|
|
240
|
-
article ul
|
|
241
|
-
.bp-doc ul {
|
|
156
|
+
article ul {
|
|
242
157
|
list-style-type: disc;
|
|
243
158
|
}
|
|
244
159
|
|
|
245
|
-
article ol
|
|
246
|
-
.bp-doc ol {
|
|
160
|
+
article ol {
|
|
247
161
|
list-style-type: decimal;
|
|
248
162
|
}
|
|
249
163
|
|
|
250
|
-
article li
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
line-height: 1.7;
|
|
164
|
+
article li {
|
|
165
|
+
margin: 6px 0;
|
|
166
|
+
line-height: 1.75;
|
|
254
167
|
}
|
|
255
168
|
|
|
256
169
|
/* Nested lists */
|
|
257
170
|
article ul ul,
|
|
258
171
|
article ol ul,
|
|
259
172
|
article ul ol,
|
|
260
|
-
article ol ol
|
|
261
|
-
|
|
262
|
-
.bp-doc ol ul,
|
|
263
|
-
.bp-doc ul ol,
|
|
264
|
-
.bp-doc ol ol {
|
|
265
|
-
margin: 8px 0;
|
|
173
|
+
article ol ol {
|
|
174
|
+
margin: 6px 0 0;
|
|
266
175
|
padding-left: 1.5rem;
|
|
267
176
|
}
|
|
268
177
|
|
|
269
|
-
article ul ul
|
|
270
|
-
.bp-doc ul ul {
|
|
178
|
+
article ul ul {
|
|
271
179
|
list-style-type: circle;
|
|
272
180
|
}
|
|
273
181
|
|
|
274
|
-
article ul ul ul
|
|
275
|
-
.bp-doc ul ul ul {
|
|
182
|
+
article ul ul ul {
|
|
276
183
|
list-style-type: square;
|
|
277
184
|
}
|
|
278
185
|
|
|
279
|
-
/* Enhanced
|
|
186
|
+
/* Enhanced tables. The wrapper is the scroll container and owns the frame; the table stays a real table so columns size against the available width. Keep in sync with the .bp-doc table rules in the theme. */
|
|
280
187
|
.table-responsive {
|
|
281
188
|
overflow-x: auto;
|
|
282
|
-
|
|
189
|
+
overscroll-behavior-x: contain;
|
|
190
|
+
margin: 20px 0;
|
|
283
191
|
border-radius: 8px;
|
|
284
192
|
border: 1px solid var(--bp-c-divider, #e2e2e3);
|
|
193
|
+
background-color: var(--bp-c-bg, #ffffff);
|
|
285
194
|
}
|
|
286
195
|
|
|
287
196
|
.enhanced-table {
|
|
197
|
+
display: table;
|
|
288
198
|
width: 100%;
|
|
199
|
+
margin: 0;
|
|
200
|
+
border: none;
|
|
289
201
|
border-collapse: collapse;
|
|
290
202
|
font-size: 14px;
|
|
291
|
-
|
|
203
|
+
line-height: 1.6;
|
|
292
204
|
}
|
|
293
205
|
|
|
294
206
|
.enhanced-table thead {
|
|
@@ -296,19 +208,28 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
296
208
|
}
|
|
297
209
|
|
|
298
210
|
.enhanced-table th {
|
|
299
|
-
padding:
|
|
211
|
+
padding: 10px 16px;
|
|
212
|
+
font-size: 13px;
|
|
300
213
|
font-weight: 600;
|
|
214
|
+
text-align: left;
|
|
301
215
|
color: var(--bp-c-text-2, #67676c);
|
|
302
|
-
border-bottom:
|
|
216
|
+
border-bottom: 1px solid var(--bp-c-divider, #e2e2e3);
|
|
303
217
|
white-space: nowrap;
|
|
304
218
|
}
|
|
305
219
|
|
|
306
220
|
.enhanced-table td {
|
|
307
|
-
padding:
|
|
221
|
+
padding: 10px 16px;
|
|
222
|
+
vertical-align: top;
|
|
308
223
|
color: var(--bp-c-text-1, #3c3c43);
|
|
309
224
|
border-bottom: 1px solid var(--bp-c-divider, #e2e2e3);
|
|
310
225
|
}
|
|
311
226
|
|
|
227
|
+
/* The wrapper already draws the bottom edge. */
|
|
228
|
+
.enhanced-table tbody tr:last-child > td,
|
|
229
|
+
.enhanced-table tbody tr:last-child > th {
|
|
230
|
+
border-bottom: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
312
233
|
.enhanced-table tbody tr:nth-child(2n) {
|
|
313
234
|
background-color: var(--bp-c-bg-soft, #f6f6f7);
|
|
314
235
|
}
|
|
@@ -318,6 +239,29 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
318
239
|
transition: background-color 0.2s ease;
|
|
319
240
|
}
|
|
320
241
|
|
|
242
|
+
/* Long values wrap inside their column rather than dictating its width. 'anywhere' (not 'break-word') also lowers the cell's intrinsic minimum, which is what frees the auto table algorithm to widen the prose column. */
|
|
243
|
+
.enhanced-table td > code,
|
|
244
|
+
.enhanced-table th > code {
|
|
245
|
+
white-space: normal;
|
|
246
|
+
overflow-wrap: anywhere;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Narrow screens: hold a readable floor and let the wrapper scroll rather than compressing four columns into one word per line. */
|
|
250
|
+
@media (max-width: 767px) {
|
|
251
|
+
.enhanced-table {
|
|
252
|
+
min-width: 38rem;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.enhanced-table th {
|
|
256
|
+
white-space: normal;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.enhanced-table th,
|
|
260
|
+
.enhanced-table td {
|
|
261
|
+
padding: 10px 12px;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
321
265
|
/* Image Captions */
|
|
322
266
|
.image-figure {
|
|
323
267
|
margin: 24px 0;
|
|
@@ -353,47 +297,45 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
353
297
|
}
|
|
354
298
|
|
|
355
299
|
/* Copy Page Dropdown */
|
|
300
|
+
/* Rendered server-side inside .bp-page-header, so it needs no JS to be placed and no "hidden until positioned" state. */
|
|
356
301
|
.copy-page-dropdown {
|
|
357
|
-
position:
|
|
358
|
-
right: 0;
|
|
359
|
-
top: 50%;
|
|
360
|
-
transform: translateY(-50%);
|
|
361
|
-
display: none; /* Hidden until JS positions it */
|
|
362
|
-
z-index: 10;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
.copy-page-dropdown.positioned {
|
|
302
|
+
position: relative;
|
|
366
303
|
display: inline-block;
|
|
304
|
+
flex-shrink: 0;
|
|
305
|
+
z-index: 10;
|
|
367
306
|
}
|
|
368
307
|
|
|
369
|
-
/* Page header row
|
|
308
|
+
/* Page header row: H1 on the left, copy control trailing it. */
|
|
370
309
|
.bp-page-header {
|
|
371
310
|
display: flex;
|
|
372
|
-
align-items:
|
|
311
|
+
align-items: baseline;
|
|
373
312
|
justify-content: space-between;
|
|
374
313
|
gap: 16px;
|
|
375
314
|
position: relative;
|
|
376
315
|
margin-bottom: 16px;
|
|
316
|
+
/* On narrow screens the button drops below the title instead of squeezing it into a one-word-per-line column. */
|
|
317
|
+
flex-wrap: wrap;
|
|
377
318
|
}
|
|
378
319
|
|
|
379
320
|
.bp-page-header h1 {
|
|
380
321
|
margin: 0;
|
|
381
|
-
flex: 1;
|
|
322
|
+
flex: 1 1 16rem;
|
|
382
323
|
min-width: 0;
|
|
324
|
+
/* Break only where there is no other option, never mid-word while the title still has room to wrap between words. */
|
|
325
|
+
overflow-wrap: break-word;
|
|
326
|
+
word-break: normal;
|
|
327
|
+
hyphens: none;
|
|
383
328
|
}
|
|
384
329
|
|
|
330
|
+
/* The control is chrome, not content: it sits on the title's baseline and stays visually quieter than the heading it accompanies. */
|
|
385
331
|
.bp-page-header .copy-page-dropdown {
|
|
386
|
-
|
|
387
|
-
right: auto;
|
|
388
|
-
top: auto;
|
|
389
|
-
transform: none;
|
|
390
|
-
flex-shrink: 0;
|
|
391
|
-
margin-top: 4px;
|
|
392
|
-
display: inline-block;
|
|
332
|
+
align-self: baseline;
|
|
393
333
|
}
|
|
394
334
|
|
|
395
|
-
|
|
396
|
-
|
|
335
|
+
@media (max-width: 639px) {
|
|
336
|
+
.bp-page-header {
|
|
337
|
+
gap: 10px;
|
|
338
|
+
}
|
|
397
339
|
}
|
|
398
340
|
|
|
399
341
|
/* Split button group */
|
|
@@ -405,31 +347,40 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
405
347
|
.copy-page-button {
|
|
406
348
|
display: flex;
|
|
407
349
|
align-items: center;
|
|
408
|
-
gap:
|
|
409
|
-
|
|
410
|
-
|
|
350
|
+
gap: 6px;
|
|
351
|
+
/* Deliberately smaller than body copy: this is a utility next to the page title, and at 14px/40px tall it competed with the H1. */
|
|
352
|
+
height: 32px;
|
|
353
|
+
padding: 0 10px;
|
|
354
|
+
background-color: transparent;
|
|
411
355
|
border: 1px solid var(--bp-c-divider, #e2e2e3);
|
|
412
|
-
color: var(--bp-c-text-
|
|
413
|
-
font-
|
|
356
|
+
color: var(--bp-c-text-2, #67676c);
|
|
357
|
+
font-family: inherit;
|
|
358
|
+
font-size: 13px;
|
|
414
359
|
font-weight: 500;
|
|
360
|
+
white-space: nowrap;
|
|
415
361
|
cursor: pointer;
|
|
416
|
-
transition:
|
|
362
|
+
transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
|
|
417
363
|
}
|
|
418
364
|
|
|
419
365
|
.copy-page-button.copy-page-main {
|
|
420
|
-
border-radius:
|
|
366
|
+
border-radius: 6px 0 0 6px;
|
|
421
367
|
border-right: none;
|
|
422
|
-
padding-right: 12px;
|
|
423
368
|
}
|
|
424
369
|
|
|
425
370
|
.copy-page-button.copy-page-toggle {
|
|
426
|
-
border-radius: 0
|
|
427
|
-
padding:
|
|
371
|
+
border-radius: 0 6px 6px 0;
|
|
372
|
+
padding: 0 6px;
|
|
428
373
|
border-left: 1px solid var(--bp-c-divider, #e2e2e3);
|
|
429
374
|
}
|
|
430
375
|
|
|
431
376
|
.copy-page-button:hover {
|
|
432
|
-
|
|
377
|
+
color: var(--bp-c-text-1, #3c3c43);
|
|
378
|
+
background-color: var(--bp-c-bg-soft, #f6f6f7);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.copy-page-button:focus-visible {
|
|
382
|
+
outline: 2px solid var(--bp-c-brand-1, #5672cd);
|
|
383
|
+
outline-offset: 2px;
|
|
433
384
|
}
|
|
434
385
|
|
|
435
386
|
.copy-page-button-group:hover .copy-page-button {
|
|
@@ -441,8 +392,9 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
441
392
|
}
|
|
442
393
|
|
|
443
394
|
.copy-page-button svg {
|
|
444
|
-
width:
|
|
445
|
-
height:
|
|
395
|
+
width: 15px;
|
|
396
|
+
height: 15px;
|
|
397
|
+
flex-shrink: 0;
|
|
446
398
|
}
|
|
447
399
|
|
|
448
400
|
.copy-page-button .chevron {
|
|
@@ -477,7 +429,9 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
477
429
|
position: absolute;
|
|
478
430
|
top: calc(100% + 8px);
|
|
479
431
|
right: 0;
|
|
480
|
-
|
|
432
|
+
width: 280px;
|
|
433
|
+
/* The trigger sits near the left edge on a phone, so a right-anchored 280px panel hangs off-screen. Cap it to the viewport and let the start-edge clamp below flip it when there is no room to the left. */
|
|
434
|
+
max-width: calc(100vw - 32px);
|
|
481
435
|
background-color: var(--bp-c-bg, #ffffff);
|
|
482
436
|
border: 1px solid var(--bp-c-divider, #e2e2e3);
|
|
483
437
|
border-radius: 12px;
|
|
@@ -485,11 +439,19 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
485
439
|
opacity: 0;
|
|
486
440
|
visibility: hidden;
|
|
487
441
|
transform: translateY(-8px);
|
|
488
|
-
transition:
|
|
442
|
+
transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
|
|
489
443
|
z-index: 100;
|
|
490
444
|
overflow: hidden;
|
|
491
445
|
}
|
|
492
446
|
|
|
447
|
+
/* Below the point where the panel is wider than the space to the trigger's left, anchor it to the start edge instead so it opens into the page. */
|
|
448
|
+
@media (max-width: 519px) {
|
|
449
|
+
.copy-page-menu {
|
|
450
|
+
right: auto;
|
|
451
|
+
left: 0;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
493
455
|
.copy-page-dropdown.open .copy-page-menu {
|
|
494
456
|
opacity: 1;
|
|
495
457
|
visibility: visible;
|
|
@@ -502,11 +464,22 @@ import{loadConfig as h}from"bunfig";var j={docsDir:"./docs",outDir:"./dist",them
|
|
|
502
464
|
gap: 12px;
|
|
503
465
|
padding: 12px 16px;
|
|
504
466
|
color: var(--bp-c-text-1, #3c3c43);
|
|
505
|
-
text-decoration: none;
|
|
506
467
|
cursor: pointer;
|
|
507
468
|
transition: background-color 0.15s ease;
|
|
508
469
|
}
|
|
509
470
|
|
|
471
|
+
/* The control is rendered inside .bp-doc, so prose link styling (brand colour + underline) would otherwise bleed onto every menu row. */
|
|
472
|
+
.copy-page-dropdown a,
|
|
473
|
+
.copy-page-dropdown a:hover {
|
|
474
|
+
color: inherit;
|
|
475
|
+
font-weight: inherit;
|
|
476
|
+
text-decoration: none;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.copy-page-dropdown a::after {
|
|
480
|
+
content: none;
|
|
481
|
+
}
|
|
482
|
+
|
|
510
483
|
.copy-page-menu-item:hover {
|
|
511
484
|
background-color: var(--bp-c-bg-soft, #f6f6f7);
|
|
512
485
|
}
|
|
@@ -831,46 +804,34 @@ function copyCode(button) {
|
|
|
831
804
|
});
|
|
832
805
|
}
|
|
833
806
|
|
|
834
|
-
// Add copy buttons to all code blocks
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
const h1 = document.querySelector('article.bp-doc h1');
|
|
855
|
-
const dropdown = document.getElementById('copy-page-dropdown');
|
|
856
|
-
if (h1 && dropdown) {
|
|
857
|
-
// Create wrapper div for H1 and dropdown
|
|
858
|
-
const wrapper = document.createElement('div');
|
|
859
|
-
wrapper.className = 'bp-page-header';
|
|
860
|
-
|
|
861
|
-
// Insert wrapper before H1
|
|
862
|
-
h1.parentNode.insertBefore(wrapper, h1);
|
|
863
|
-
|
|
864
|
-
// Move H1 and dropdown into wrapper
|
|
865
|
-
wrapper.appendChild(h1);
|
|
866
|
-
wrapper.appendChild(dropdown);
|
|
867
|
-
|
|
868
|
-
// Show dropdown now that it's positioned
|
|
869
|
-
dropdown.classList.add('positioned');
|
|
870
|
-
}
|
|
807
|
+
// Add copy buttons to all code blocks.
|
|
808
|
+
// Idempotent and re-run after client-side navigation: the SPA router replaces
|
|
809
|
+
// .BPDoc wholesale, so buttons added on first load are gone from the new page.
|
|
810
|
+
// (The copy-page control is rendered server-side inside the content, so it
|
|
811
|
+
// survives the same swap without any JS.)
|
|
812
|
+
function addCodeCopyButtons() {
|
|
813
|
+
document.querySelectorAll('pre > code').forEach(code => {
|
|
814
|
+
const pre = code.parentElement;
|
|
815
|
+
if (!pre || pre.querySelector('.copy-code-button')) return;
|
|
816
|
+
|
|
817
|
+
const button = document.createElement('button');
|
|
818
|
+
button.className = 'copy-code-button';
|
|
819
|
+
button.setAttribute('onclick', 'copyCode(this)');
|
|
820
|
+
button.setAttribute('type', 'button');
|
|
821
|
+
button.setAttribute('aria-label', 'Copy code');
|
|
822
|
+
button.innerHTML = \`<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
823
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
|
|
824
|
+
</svg>\`;
|
|
825
|
+
|
|
826
|
+
pre.appendChild(button);
|
|
871
827
|
});
|
|
872
828
|
}
|
|
873
829
|
|
|
830
|
+
if (typeof document !== 'undefined') {
|
|
831
|
+
document.addEventListener('DOMContentLoaded', addCodeCopyButtons);
|
|
832
|
+
document.addEventListener('bp:navigated', addCodeCopyButtons);
|
|
833
|
+
}
|
|
834
|
+
|
|
874
835
|
// Copy Page Dropdown functionality
|
|
875
836
|
function toggleCopyPageDropdown(event) {
|
|
876
837
|
event.stopPropagation();
|
|
@@ -1185,5 +1146,9 @@ if (typeof document !== 'undefined') {
|
|
|
1185
1146
|
}
|
|
1186
1147
|
});
|
|
1187
1148
|
}
|
|
1188
|
-
`],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}}
|
|
1189
|
-
|
|
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};
|
|
@@ -0,0 +1,10 @@
|
|
|
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.
|
|
3
|
+
Install it with: bun add -d @stacksjs/ts-cloud
|
|
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
|
+
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(`
|
|
6
|
+
Deploying with CloudFormation...`),L)console.log(`Using external DNS provider: ${G.provider}`);let q;if(L&&B){let R={siteName:K,region:w,domain:B,bucket:O,stackName:P,certificateArn:Q,cacheControl:V,defaultRootObject:"index.html",errorDocument:"404.html",sourceDir:X,dnsProvider:G,tags:{Project:"BunPress",Environment:k.environment||"production"},invalidateCache:k.invalidateCache,waitForInvalidation:k.waitForInvalidation,onProgress:Z(z,m)},{deployStaticSiteWithExternalDnsFull:T}=await Y();q=await T(R)}else{let R={siteName:K,region:w,bucket:O,domain:B,subdomain:M,baseDomain:N,stackName:P,hostedZoneId:U,certificateArn:Q,cacheControl:V,defaultRootObject:"index.html",errorDocument:"404.html",sourceDir:X,tags:{Project:"BunPress",Environment:k.environment||"production"},invalidateCache:k.invalidateCache,waitForInvalidation:k.waitForInvalidation,onProgress:Z(z,m)},{deployStaticSiteFull:T}=await Y();q=await T(R)}if(!q.success){if(!m)z.fail("Deployment failed");return I(q.message),!1}if(console.log(`
|
|
7
|
+
`+"=".repeat(50)),$("Deployment complete!"),console.log("=".repeat(50)),console.log(`
|
|
8
|
+
CloudFormation Stack: ${q.stackName}`),console.log(`S3 Bucket: ${q.bucket}`),q.distributionId)console.log(`CloudFront Distribution: ${q.distributionId}`),console.log(`CloudFront Domain: ${q.distributionDomain}`);if(q.filesUploaded)console.log(`Files Uploaded: ${q.filesUploaded}`);if(L)console.log(`DNS Provider: ${G.provider}`);if(q.domain)console.log(`
|
|
9
|
+
Your site: https://${q.domain}`);else if(q.distributionDomain)console.log(`
|
|
10
|
+
Your site: https://${q.distributionDomain}`);return!0}catch(H){if(!m)z.fail("Deployment failed");if(I(H.message),m&&H.stack)console.error(H.stack);return!1}}function Z(j,A){return(k,m)=>{if(A)console.log(`[${k}] ${m||""}`);else switch(k){case"infrastructure":j.text=m||"Deploying CloudFormation stack...",j.start();break;case"upload":if(m?.startsWith("Uploading"))j.text=m;break;case"invalidate":j.text="Invalidating CloudFront cache...";break;case"complete":j.succeed("Deployment complete!");break}}}export{F as deployCommand};
|