@stacksjs/bunpress 0.1.21 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.js +1 -1
- package/dist/bin/commands/doctor.d.ts +1 -0
- package/dist/bin/commands/seo.d.ts +19 -0
- package/dist/{chunk-qrp18ybj.js → chunk-desvs9bx.js} +1 -1
- package/dist/chunk-em1tv2bw.js +38 -0
- package/dist/{chunk-kxr6zf7e.js → chunk-kfbpnqaw.js} +1308 -696
- package/dist/chunk-qqn901qf.js +393 -0
- package/dist/{chunk-qdmkac4z.js → chunk-qzhr4d2q.js} +10 -11
- package/dist/chunk-y3z183hg.js +10 -0
- package/dist/chunk-yfwm5337.js +2 -0
- package/dist/{chunk-m0g9vk1e.js → chunk-zkdm5pr7.js} +401 -194
- 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/markdown-fences.d.ts +37 -0
- 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 +20 -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
package/dist/bin/cli.d.ts
CHANGED
package/dist/bin/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{
|
|
3
|
+
import{s as a,t as b,u as c}from"../chunk-qqn901qf.js";import"../chunk-qzhr4d2q.js";import"../chunk-zkdm5pr7.js";import"../chunk-em1tv2bw.js";export{b as resolveConfig,a as findMarkdownFiles,c as buildDocs};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { config } from '../../src/config';
|
|
2
|
+
import type { BunPressConfig } from '../../src/types';
|
|
1
3
|
/**
|
|
2
4
|
* Check SEO for all documentation pages
|
|
3
5
|
*/
|
|
@@ -5,9 +7,26 @@ export declare function seoCheck(options?: {
|
|
|
5
7
|
dir?: string
|
|
6
8
|
fix?: boolean
|
|
7
9
|
}): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Walk the configured nav and sidebar and report entries that do not resolve.
|
|
12
|
+
*/
|
|
13
|
+
export declare function checkConfiguredLinks(config: BunPressConfig, docsDir: string, report: SeoReport): void;
|
|
8
14
|
/** Serialize frontmatter in block style with delimiters on their own lines. */
|
|
9
15
|
export declare function serializeFrontmatter(frontmatter: Record<string, unknown>, markdown: string): string;
|
|
10
16
|
/**
|
|
11
17
|
* Find broken internal links in markdown
|
|
12
18
|
*/
|
|
13
19
|
export declare function findBrokenInternalLinks(markdown: string, docsDir: string, currentFile: string): string[];
|
|
20
|
+
export declare function headingAnchors(file: string): Set<string>;
|
|
21
|
+
declare interface SeoIssue {
|
|
22
|
+
type: 'error' | 'warning'
|
|
23
|
+
category: string
|
|
24
|
+
file: string
|
|
25
|
+
message: string
|
|
26
|
+
}
|
|
27
|
+
declare interface SeoReport {
|
|
28
|
+
totalPages: number
|
|
29
|
+
errors: SeoIssue[]
|
|
30
|
+
warnings: SeoIssue[]
|
|
31
|
+
passed: number
|
|
32
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{i as a,j as b,k as c,l as d,m as e,n as f}from"./chunk-kfbpnqaw.js";import"./chunk-zkdm5pr7.js";import"./chunk-em1tv2bw.js";export{c as wrapInLayout,b as stripConfiguredBasePath,e as startServer,f as serveCLI,d as markdownToHtml,a as getConfiguredBasePath};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var W=import.meta.require;var Q={"search.placeholder":"Search documentation","toc.title":"On this page","nav.menu":"Menu","search.noResults":"No results for","theme.toggle":"Toggle dark mode"};function Z(q){let x=q?.i18n,B=(x?.locales??[]).filter(Boolean),G=x?.defaultLocale||B[0]||"en",H=(x?.enabled??B.length>1)&&B.length>0;return{enabled:H,locales:H?B:[G],defaultLocale:G,fallbackLocale:x?.fallbackLocale??G,localePath:x?.localePath??"./locales",detectLocale:x?.detectLocale===!0,localeNames:x?.localeNames??{},localeConfig:x?.localeConfig??{},translate:(J)=>Q[J]??J}}async function $(q,x){if(!q.enabled)return q;try{let{createTranslator:B,loadTranslations:G}=await import("@stacksjs/ts-i18n"),H=await G({translationsDir:q.localePath,defaultLocale:q.defaultLocale,fallbackLocale:q.fallbackLocale,sources:x?.i18n?.sources??["ts","yaml","json"],optional:!0,verbose:!1}),J=B(H,{defaultLocale:q.defaultLocale,fallbackLocale:q.fallbackLocale}),O=new Set;for(let K of Object.values(H))for(let M of Object.keys(K??{}))O.add(M);let R=[...O].sort((K,M)=>K==="theme"?-1:M==="theme"?1:K.localeCompare(M));return{...q,translate:(K,M,V)=>{for(let P of[K,...R.map((N)=>`${N}.${K}`)])try{let N=J(P,M,V);if(typeof N==="string"&&N&&N!==P)return N}catch{}return Q[K]??K}}}catch(B){return console.warn("[bunpress] i18n translations could not be loaded; falling back to defaults \u2014",B instanceof Error?B.message:B),q}}function j(q,x){if(!q.enabled)return{locale:q.defaultLocale,path:x};let B=x.match(/^\/([^/]+)(\/.*)?$/);if(B&&q.locales.includes(B[1])&&B[1]!==q.defaultLocale)return{locale:B[1],path:B[2]||"/"};return{locale:q.defaultLocale,path:x}}function X(q,x,B){if(!q.enabled||x===q.defaultLocale)return B||"/";return`/${x}${B==="/"?"":B}`||`/${x}`}function z(q,x,B,G){let H=G==="/"?"/index":G,J=[];if(q.enabled&&B!==q.defaultLocale)J.push(`${x}/${B}${H}.md`),J.push(`${x}/${B}${H}/index.md`),J.push(`${x}${H}.${B}.md`);if(J.push(`${x}${H}.md`),J.push(`${x}${H}/index.md`),q.enabled)J.push(`${x}${H}.${q.defaultLocale}.md`);return J}function C(q,x,B){let G=x.localeConfig[B];if(!G)return q;return{...q,...G,themeConfig:G.themeConfig?{...q.themeConfig,...G.themeConfig}:q.themeConfig,markdown:G.markdown?{...q.markdown,...G.markdown}:q.markdown}}function A(q,x){return q.localeNames[x]??x}function E(q,x,B){if(!q.enabled)return"";let G=x.sitemap?.baseUrl?.replace(/\/$/,"");if(!G)return"";let H=q.locales.map((J)=>{let O=`${G}${X(q,J,B==="/index"?"/":B)}`;return`<link rel="alternate" hreflang="${J}" href="${O}">`});return H.push(`<link rel="alternate" hreflang="x-default" href="${G}${B==="/index"?"/":B}">`),H.join(`
|
|
3
|
+
`)}function F(q){if(!q.enabled||!q.detectLocale)return"";return`
|
|
4
|
+
(function () {
|
|
5
|
+
var LOCALES = ${JSON.stringify(q.locales)};
|
|
6
|
+
var DEFAULT = ${JSON.stringify(q.defaultLocale)};
|
|
7
|
+
var KEY = 'bunpress-locale';
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
var current = location.pathname.split('/')[1];
|
|
11
|
+
if (LOCALES.indexOf(current) !== -1) {
|
|
12
|
+
// Reading a non-default locale is itself a choice; remember it.
|
|
13
|
+
localStorage.setItem(KEY, current);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (localStorage.getItem(KEY)) return;
|
|
17
|
+
|
|
18
|
+
var preferred = (navigator.languages || [navigator.language || ''])
|
|
19
|
+
.map(function (tag) { return String(tag).toLowerCase(); });
|
|
20
|
+
|
|
21
|
+
for (var i = 0; i < preferred.length; i++) {
|
|
22
|
+
var tag = preferred[i];
|
|
23
|
+
var exact = LOCALES.indexOf(tag) !== -1 ? tag : null;
|
|
24
|
+
// 'en-GB' should match an 'en' locale.
|
|
25
|
+
var base = exact || (LOCALES.indexOf(tag.split('-')[0]) !== -1 ? tag.split('-')[0] : null);
|
|
26
|
+
if (base && base !== DEFAULT) {
|
|
27
|
+
localStorage.setItem(KEY, base);
|
|
28
|
+
location.replace(\`/\${base}\${location.pathname}\${location.search}\${location.hash}\`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (base === DEFAULT) return;
|
|
32
|
+
}
|
|
33
|
+
} catch (_) {
|
|
34
|
+
// Storage or history unavailable: leave the reader where they are.
|
|
35
|
+
}
|
|
36
|
+
})();
|
|
37
|
+
`.trim()}
|
|
38
|
+
export{W as $,Z as aa,$ as ba,j as ca,X as da,z as ea,C as fa,A as ga,E as ha,F as ia};
|