boltdocs 2.8.4 → 2.9.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/bin/boltdocs.js +7 -6
- package/dist/{banner-DFACg5Dy.d.cts → banner-C_xkGxzI.d.cts} +1 -1
- package/dist/{banner-BLTQUA2O.d.ts → banner-D2NddBfF.d.ts} +1 -1
- package/dist/cache-C2PiGyg8.cjs +6 -0
- package/dist/cache-DFW4R3S0.mjs +6 -0
- package/dist/chunk-Ds5LZdWN.cjs +6 -0
- package/dist/client/index.cjs +464 -279
- package/dist/client/index.d.cts +74 -8
- package/dist/client/index.d.ts +74 -8
- package/dist/client/index.js +463 -280
- package/dist/client/mdx.cjs +1 -1
- package/dist/client/mdx.js +1 -1
- package/dist/client/primitives.cjs +4 -4
- package/dist/client/primitives.d.cts +1 -1
- package/dist/client/primitives.d.ts +1 -1
- package/dist/client/primitives.js +4 -4
- package/dist/client/theme/neutral.css +5 -3
- package/dist/client/theme/reset.css +19 -0
- package/dist/{docs-layout-CVCf3xkZ.cjs → docs-layout-3TpAt6MB.cjs} +302 -238
- package/dist/{docs-layout-BBv6wILp.js → docs-layout-6FQ8__ok.js} +303 -239
- package/dist/doctor-BY1tSmQd.mjs +34 -0
- package/dist/{doctor-DT4jh07O.cjs → doctor-Bknon8f5.cjs} +1 -1
- package/dist/doctor-DcFLi4t1.cjs +34 -0
- package/dist/{doctor-BGPdO1Ah.mjs → doctor-wsPTzt8Y.mjs} +1 -1
- package/dist/{generator-CC2yHzhZ.cjs → generator-BEIF6MOx.cjs} +2 -2
- package/dist/{generator-BHCrLU6h.mjs → generator-DILs0EFN.mjs} +1 -1
- package/dist/handler-B31cxNw0.mjs +6 -0
- package/dist/handler-DfhH9D1b.mjs +28 -0
- package/dist/handler-Djy0HfsI.cjs +28 -0
- package/dist/{icons-dev-C8sFxeBk.cjs → icons-dev-BryEFkJu.cjs} +90 -4
- package/dist/{icons-dev-CFcv5Nb8.js → icons-dev-kJyGWNeg.js} +73 -5
- package/dist/{image-DCMxxidi.cjs → image-B9YA_oQ_.cjs} +17 -9
- package/dist/{image-DufDOid8.js → image-CjYu9Eml.js} +17 -9
- package/dist/{mdx-Bto8CvGl.js → mdx-Cy_c2zio.js} +116 -33
- package/dist/{mdx-BH9kHiF9.cjs → mdx-WXjAMS8Y.cjs} +121 -32
- package/dist/{meta-loader-Cv9O0Pzl.cjs → meta-loader-D0V6oOQt.cjs} +1 -1
- package/dist/node/cli-entry.cjs +3 -3
- package/dist/node/cli-entry.mjs +3 -3
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +368 -24
- package/dist/node/index.d.mts +369 -24
- package/dist/node/index.mjs +1 -1
- package/dist/node/routes/worker.cjs +1 -1
- package/dist/node/routes/worker.mjs +1 -1
- package/dist/node-DV-EPtMU.mjs +160 -0
- package/dist/node-vOVNRABe.cjs +160 -0
- package/dist/{package-DlgexgpQ.mjs → package-BK_82QLX.mjs} +1 -1
- package/dist/{package-CwNjt3Sd.cjs → package-OxKE0p6j.cjs} +1 -1
- package/dist/{parser-B7-6PyQz.cjs → parser-C2Pw18LY.cjs} +1 -1
- package/dist/{parser-BzB-zCkF.cjs → parser-DJoEF96Y.cjs} +1 -1
- package/dist/{parser-9LqyiEnB.mjs → parser-DScG_PTs.mjs} +1 -1
- package/dist/routes--LYHSHT7.cjs +6 -0
- package/dist/routes-BAsfsn_e.mjs +6 -0
- package/dist/routes-C6Kr2HFN.cjs +6 -0
- package/dist/routes-CKgGAy8P.mjs +6 -0
- package/dist/{search-dialog-Cvux-qSk.cjs → search-dialog-BhXg05Ri.cjs} +1 -1
- package/dist/{search-dialog-CmHYOt18.cjs → search-dialog-BsAiQgnx.cjs} +2 -2
- package/dist/{search-dialog-jHZ21G4i.js → search-dialog-CaOO1Q4i.js} +2 -2
- package/dist/{search-dialog-Cr7SC8Xt.cjs → search-dialog-CzwvKoLW.cjs} +1 -1
- package/dist/{search-dialog-DBNaG5At.js → search-dialog-DRNJsxOv.js} +1 -1
- package/dist/{search-dialog-e86WPpck.js → search-dialog-DaR66wl0.js} +1 -1
- package/dist/shiki-adapter-CUtj-xKv.cjs +6 -0
- package/dist/shiki-adapter-EZptJAmW.mjs +6 -0
- package/dist/shiki-adapter-F-P-lDon.mjs +6 -0
- package/dist/shiki-adapter-PQBl32AN.cjs +6 -0
- package/dist/{sidebar-kQBonN82.d.ts → sidebar-BtJyWHy4.d.cts} +42 -5
- package/dist/{sidebar---RgTmZD.d.cts → sidebar-C4fuRYYS.d.ts} +42 -5
- package/dist/{utils-BYITg7T5.mjs → utils-DC4Wq-S2.mjs} +1 -1
- package/dist/{utils-Cjmx1hhk.cjs → utils-wHud9ny5.cjs} +1 -1
- package/dist/worker-pool-BS1LX67P.cjs +6 -0
- package/dist/worker-pool-DRv8ef4z.mjs +6 -0
- package/package.json +6 -3
- package/src/shared/types.ts +36 -3
- package/dist/cache-BMUyNiiA.mjs +0 -6
- package/dist/cache-CKm45d2w.cjs +0 -6
- package/dist/chunk-CU-zTemE.cjs +0 -6
- package/dist/doctor-Dnv77Lfx.mjs +0 -28
- package/dist/doctor-VBPlQf7d.cjs +0 -28
- package/dist/node-JM9bx0mO.cjs +0 -160
- package/dist/node-q-Y2mdLX.mjs +0 -160
- package/dist/routes-3sAccArX.cjs +0 -6
- package/dist/routes-DZpXqq1p.mjs +0 -6
- package/dist/routes-DjoxNeef.mjs +0 -6
- package/dist/routes-DpJnb2VS.cjs +0 -6
- package/dist/worker-pool-DXLyeHJg.cjs +0 -6
- package/dist/worker-pool-Kn4F9gDq.mjs +0 -6
- /package/dist/{meta-loader-DzwDFtdT.mjs → meta-loader-By22EnYa.mjs} +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import{a as e,d as t,u as n,v as r,y as i}from"./utils-DC4Wq-S2.mjs";import{createRequire as a}from"node:module";import o from"node:path";import s from"node:fs";import{loadConfigFromFile as c}from"vite";import{fdir as l}from"fdir";import{z as u}from"zod";import{bullet as d,colors as f,confirm as p,dividerLog as m,double as h,error as g,info as _,padCenter as v,round as ee,single as te,success as y,tasks as ne,warn as b}from"@bdocs/dui";import{fileURLToPath as x}from"node:url";import re from"picomatch";import S from"node:os";import{distance as C}from"fastest-levenshtein";const w=u.object({icon:u.string().max(50),link:u.string().url()});u.object({text:u.string().max(2e3).optional()});const T=u.object({name:u.string(),enforce:u.enum([`pre`,`post`]).optional(),version:u.string().optional(),boltdocsVersion:u.string().optional(),remarkPlugins:u.array(u.unknown()).optional(),rehypePlugins:u.array(u.unknown()).optional(),vitePlugins:u.array(u.unknown()).optional(),components:u.record(u.string(),u.string()).optional(),hooks:u.record(u.string(),u.unknown()).optional()}),E=u.object({title:u.union([u.string(),u.record(u.string(),u.string())]).optional(),description:u.union([u.string(),u.record(u.string(),u.string())]).optional(),logo:u.union([u.string(),u.object({dark:u.string(),light:u.string(),alt:u.string().optional(),width:u.number().optional(),height:u.number().optional()})]).optional(),navbar:u.array(u.object({label:u.union([u.string(),u.record(u.string(),u.string())]),href:u.string(),items:u.array(u.object({label:u.union([u.string(),u.record(u.string(),u.string())]),href:u.string()})).optional()})).optional(),sidebar:u.record(u.string(),u.array(u.object({text:u.string(),link:u.string()}))).optional(),sidebarGroups:u.record(u.string(),u.object({title:u.union([u.string(),u.record(u.string(),u.string())]).optional(),icon:u.string().optional()})).optional(),socialLinks:u.array(w).optional(),editLink:u.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:u.string().url().optional(),version:u.string().max(50).optional(),githubRepo:u.string().max(100).optional(),favicon:u.string().optional(),tabs:u.array(u.object({id:u.string(),text:u.union([u.string(),u.record(u.string(),u.string())]),icon:u.string().optional()})).optional(),codeTheme:u.union([u.string(),u.object({light:u.string(),dark:u.string()})]).optional()}),D=u.union([u.string(),u.object({rules:u.array(u.object({userAgent:u.string(),allow:u.union([u.string(),u.array(u.string())]).optional(),disallow:u.union([u.string(),u.array(u.string())]).optional()})).optional(),sitemaps:u.array(u.string().url()).optional()})]),O=u.object({defaultLocale:u.string(),locales:u.union([u.record(u.string(),u.string()),u.array(u.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:u.record(u.string(),u.object({label:u.string().optional(),direction:u.enum([`ltr`,`rtl`]).optional(),htmlLang:u.string().optional(),calendar:u.string().optional()})).optional()}),k=u.object({defaultVersion:u.string(),prefix:u.string().optional(),versions:u.array(u.object({label:u.string(),path:u.string()}))}),A=u.object({headers:u.record(u.string(),u.string()).optional(),enableCSP:u.boolean().optional(),customHeaders:u.record(u.string(),u.string()).optional()}),j=u.object({metatags:u.record(u.string(),u.string()).optional(),indexing:u.enum([`all`,`public`]).optional(),thumbnails:u.object({background:u.string().optional()}).optional()}),M=u.object({measurementId:u.string().min(1,`Measurement ID is required for GA4`),debug:u.boolean().optional(),anonymizeIp:u.boolean().optional(),sendPageView:u.boolean().optional(),cookieFlags:u.string().optional(),autoTrack:u.object({pageViews:u.boolean().optional(),downloads:u.boolean().optional(),externalLinks:u.boolean().optional(),search:u.boolean().optional()}).optional()}),N=u.object({tagId:u.string().min(1,`Tag ID is required for GTM`),dataLayerName:u.string().optional(),preview:u.string().optional()}),P=u.object({appId:u.string().min(1,`Algolia App ID is required`),apiKey:u.string().min(1,`Algolia API Key is required`),indexName:u.string().min(1,`Algolia Index Name is required`)}),F=u.object({repo:u.string().min(1,`Giscus repository is required`),repoId:u.string().min(1,`Giscus repository ID is required`),category:u.string().optional(),categoryId:u.string().optional(),mapping:u.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:u.union([u.enum([`0`,`1`]),u.boolean()]).optional(),reactionsEnabled:u.union([u.enum([`0`,`1`]),u.boolean()]).optional(),emitMetadata:u.union([u.enum([`0`,`1`]),u.boolean()]).optional(),inputPosition:u.enum([`top`,`bottom`]).optional(),theme:u.string().optional(),darkTheme:u.string().optional(),lang:u.string().optional(),loading:u.enum([`lazy`,`eager`]).optional()}),I=u.object({enabled:u.boolean(),owner:u.string().min(1,`GitHub owner is required`),repo:u.string().min(1,`GitHub repository name is required`),categorySlug:u.string().optional(),endpoint:u.string().optional()}),L=u.object({ga4:M.optional(),gtm:N.optional(),algolia:P.optional(),feedback:u.object({giscus:F.optional(),custom:I.optional()}).optional()}),ie=u.object({siteUrl:u.string().url().optional(),docsDir:u.string().optional(),base:u.string().optional(),theme:E.optional(),i18n:O.optional(),versions:k.optional(),plugins:u.array(T).optional(),robots:D.optional(),security:A.optional(),seo:j.optional(),integrations:L.optional(),vite:u.record(u.string(),u.unknown()).optional()});function ae(e,t,n=process.cwd(),r){let i=o.resolve(n,`.boltdocs`,`generated`);s.existsSync(i)||s.mkdirSync(i,{recursive:!0});let a=e.i18n?Object.keys(e.i18n.locales):[],c=e.versions?e.versions.versions.map(e=>e.path):[],l=a.length>0?a.map(e=>`'${e}'`).join(` | `):`string`,u=c.length>0?c.map(e=>`'${e}'`).join(` | `):`string`,d=[`tsx`,`ts`,`jsx`,`js`],f=``,p=``;for(let e of d){let r=o.resolve(n,t,`mdx-components.${e}`);if(s.existsSync(r)){let e=o.join(n,t,`mdx-components`),r=o.relative(i,e).replace(/\\/g,`/`);f=`import type * as MdxComponentsModule from '${r.startsWith(`.`)?r:`./${r}`}'\n`,p=` MdxComponents: typeof MdxComponentsModule`;break}}let m=r&&r.length>0?`\ndeclare global {
|
|
7
|
+
namespace Boltdocs {
|
|
8
|
+
interface RoutePaths {
|
|
9
|
+
${r.map(e=>` '${e}': void`).join(`
|
|
10
|
+
`)}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}`:``,h=`// This file is automatically generated by Boltdocs.
|
|
14
|
+
// Do not edit this file manually.
|
|
15
|
+
|
|
16
|
+
${f}declare global {
|
|
17
|
+
namespace Boltdocs {
|
|
18
|
+
interface Types {
|
|
19
|
+
Locale: ${l}
|
|
20
|
+
Version: ${u}${p?`\n${p}`:``}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}${m}
|
|
24
|
+
|
|
25
|
+
export {}
|
|
26
|
+
`;s.writeFileSync(o.resolve(i,`types.d.ts`),h)}function oe(e,t=process.cwd()){let n=o.resolve(t,`.boltdocs`,`generated`);s.existsSync(n)||s.mkdirSync(n,{recursive:!0});let r={routes:Array.from(new Set(e)).sort(),timestamp:Date.now()};s.writeFileSync(o.resolve(n,`link-tree.json`),JSON.stringify(r,null,2))}function se(e){return e}const R=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function z(e,t=process.cwd()){let n=t,i={docsDir:o.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},a={};for(let e of R){let t=o.resolve(n,e);if(s.existsSync(t))try{let e=await c({command:`serve`,mode:`development`},t,n);if(e){a=e.config;break}}catch(t){b(`Failed to load config from ${e}:`,t)}}let l={title:a.title,description:a.description,logo:a.logo,favicon:a.favicon,navbar:a.navbar,sidebar:a.sidebar,sidebarGroups:a.theme?.sidebarGroups,socialLinks:a.socialLinks,githubRepo:a.githubRepo,tabs:a.tabs,codeTheme:a.codeTheme,communityHelp:a.communityHelp,version:a.version,editLink:a.editLink,...a.theme||{}},u=Object.fromEntries(Object.entries(l).filter(([e,t])=>t!==void 0));u.navbar&&=u.navbar.map(e=>({label:e.label||e.text||``,href:e.href||e.link||e.to||``,items:e.items}));let d={docsDir:o.resolve(e),theme:{...i.theme,...u},i18n:a.i18n?{...a.i18n,locales:Array.isArray(a.i18n.locales)?Object.fromEntries(a.i18n.locales.map(e=>[e,e])):a.i18n.locales}:void 0,versions:a.versions,siteUrl:a.siteUrl,base:a.base,seo:a.seo,plugins:a.plugins||[],robots:a.robots,security:a.security,integrations:a.integrations,vite:a.vite},f=ie.safeParse(d);if(!f.success)throw new r(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
|
|
27
|
+
`)}`);return f.data}function ce(e,t){let n=t?` ${f.green(`➜`)} ${f.green(`Network:`)} ${f.cyan(t)}`:` ${f.green(`➜`)} ${f.green(`Network:`)} ${f.gray(`use --host to expose`)}`;return`
|
|
28
|
+
`+h([` ${f.green(`➜`)} ${f.green(`Local:`)} ${f.cyan(e)}`,n,``,` ${f.dim(`press h + enter for help`)}`],{title:`boltdocs dev server`})+`
|
|
29
|
+
`}function le(e,t){let n=t?` ${f.green(`➜`)} ${f.green(`Network:`)} ${f.cyan(t)}`:` ${f.green(`➜`)} ${f.green(`Network:`)} ${f.gray(`use --host to expose`)}`;return`
|
|
30
|
+
`+h([` ${f.green(`➜`)} ${f.green(`Local:`)} ${f.cyan(e)}`,n],{title:`boltdocs preview server`})+`
|
|
31
|
+
`}function ue(e,t){return`
|
|
32
|
+
`+h([v(`🚀 Update available!`,50),``,` ${f.dim(`Current:`)} ${f.red(e)} ${f.gray(`→`)} ${f.green(t)}`,``,` ${f.dim(`Run:`)} ${f.bold(`npm install boltdocs@latest`)}`])+`
|
|
33
|
+
`}const de=a(import.meta.url);function fe(e,t){let n=e.split(`-`)[0].split(`.`).map(Number),r=t.split(`-`)[0].split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]??0,i=r[e]??0;if(Number.isNaN(t)||Number.isNaN(i))return!1;if(t!==i)return t>i}return!1}async function pe(){try{let e=new AbortController,t=setTimeout(()=>e.abort(),2e3),n=await fetch(`https://registry.npmjs.org/boltdocs/latest`,{signal:e.signal,headers:{Accept:`application/vnd.npm.install-v1+json`}});return clearTimeout(t),n.ok?(await n.json()).version??null:null}catch{return null}}async function me(){try{let e=x(import.meta.url),t=o.dirname(e);for(let e=0;e<5;e++){let e=o.join(t,`package.json`);if(s.existsSync(e)){let t=JSON.parse(s.readFileSync(e,`utf-8`));if(t.name===`boltdocs`)return t.version}t=o.dirname(t)}}catch{}try{return de(`boltdocs/package.json`).version}catch{return`0.0.0`}}async function B(){let e=``;try{e=o.join(S.homedir(),`.boltdocs`,`update-check.json`)}catch{return}let t=0;try{if(s.existsSync(e)){let n=JSON.parse(s.readFileSync(e,`utf-8`));t=Number(n.lastCheck)||0}}catch{}let n=Date.now();if(n-t<864e5)return;try{s.mkdirSync(o.dirname(e),{recursive:!0}),s.writeFileSync(e,JSON.stringify({lastCheck:n}),`utf-8`)}catch{}let r=await me();if(r===`0.0.0`)return;let i=await pe();i&&fe(i,r)&&console.log(ue(r,i))}const V={$schema:`https://boltdocs.vercel.app/schemas/doctor-config.schema.json`,checks:{metadata:{enabled:!0,titleMin:10,titleMax:60,descriptionMin:50,required:[`title`,`description`],optional:[],validateDates:!1},links:{internal:!0,external:!1,timeout:1e4,concurrency:10,ignore:[]},i18n:{enabled:!0},performance:{enabled:!0,budgets:{maxJSBundleSize:`200kb`,maxCSSBundleSize:`30kb`,maxPageHTMLSize:`80kb`,maxImagesKB:500,maxBuildTime:3e4,maxFontCount:3}}},fix:{confirmChanges:!1,backupFiles:!1,backupPath:`.boltdocs/backups`},reporting:{format:`pretty`,outputFile:`.boltdocs/reports/doctor.json`,failOnError:!1,maxWarnings:-1},severity:{missingTranslation:`warning`,brokenLink:`high`,brokenAnchor:`warning`,largeFile:`warning`,orphanedPage:`low`,duplicateTitle:`low`,shortMetadata:`low`,missingMetadata:`warning`,malformedFrontmatter:`high`,invalidFrontmatter:`high`,budgetExceeded:`warning`},exclude:[]};function H(e,t){if(e==null)return t;if(typeof e==`number`)return e;let n=e.toLowerCase().match(/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/);if(!n)return t;let r=Number.parseFloat(n[1]),i=n[2]||`b`;return Math.round(r*({b:1,kb:1024,mb:1024*1024,gb:1024*1024*1024}[i]||1))}function U(e,t,n){return e.doctorConfig.severity[t]||n}async function he(e,t){s.existsSync(t)||s.mkdirSync(t,{recursive:!0});let n=o.basename(e),r=new Date().toISOString().replace(/[:.]/g,`-`),i=o.join(t,`${n}.${r}.bak`);s.copyFileSync(e,i)}const W=new Map;function G(e){let n=W.get(e);if(n)return n;let r=(async()=>{let n=await t(e,!1);return{raw:n.raw,data:n.data,content:n.content}})();return W.set(e,r),r}const K=new Map;function q(e){if(K.has(e))return K.get(e);let t=!1;try{t=s.existsSync(e)&&s.statSync(e).isFile()}catch{t=!1}return K.set(e,t),t}async function J(e){let t=o.resolve(e,`doctor.json`);if(s.existsSync(t))try{let e=JSON.parse(s.readFileSync(t,`utf-8`));return{...V,...e,checks:{...V.checks,...e.checks,metadata:{...V.checks.metadata,...e.checks?.metadata},links:{...V.checks.links,...e.checks?.links},i18n:{...V.checks.i18n,...e.checks?.i18n},performance:{...V.checks.performance,...e.checks?.performance,budgets:{...V.checks.performance?.budgets,...e.checks?.performance?.budgets}}},fix:{...V.fix,...e.fix},reporting:{...V.reporting,...e.reporting},severity:{...V.severity,...e.severity},exclude:[...V.exclude,...e.exclude||[]]}}catch(e){b(`Failed to parse doctor.json: ${e}`)}return V}async function Y(t,n=process.cwd(),r,i){let a=o.resolve(n,`.boltdocs`,`generated`);s.existsSync(a)||s.mkdirSync(a,{recursive:!0});let c=i;c||=await new l().withFullPaths().filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)).crawl(t).withPromise();let u=r?.base||`/docs`,d=[];for(let n=0;n<c.length;n+=100){let r=c.slice(n,n+100),i=await Promise.all(r.map(async n=>{let r=o.isAbsolute(n)?n:o.resolve(t,n),i=o.relative(t,r),{data:a}=await G(r),s;return s=a.permalink?a.permalink.startsWith(`/`)?a.permalink:`/${a.permalink}`:e(i),u===`/`?s:(u.endsWith(`/`)?u:u+`/`)+(s.startsWith(`/`)?s.substring(1):s)}));d.push(...i)}d.includes(u)||d.push(u);let f={routes:Array.from(new Set(d)).sort(),timestamp:Date.now()};return s.writeFileSync(o.resolve(a,`link-tree.json`),JSON.stringify(f,null,2)),f}function ge(e,t){if(e===t)return 1;if(!e||!t)return 0;let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean),i=n[n.length-1]||``,a=r[r.length-1]||``;if(i===a){let e=0;for(let t of n)r.includes(t)&&e++;return e>=2?.99:.9}if(i.length>3&&a.length>3&&(a.startsWith(i)||i.startsWith(a))&&Math.min(i.length,a.length)/Math.max(i.length,a.length)>.5)return .88;let o=1-C(i,a)/Math.max(i.length,a.length);return o>.8?o*.95:1-C(e,t)/Math.max(e.length,t.length)}const X=new Map;function Z(e,t){if(X.has(e))return X.get(e);let n=e.length,r=``,i=0;for(let a of t){if(a===e)continue;let t=a.length,o=Math.max(n,t);if(o===0)continue;let s=1-Math.abs(n-t)/o;if(s<=.8&&s<=i)continue;let c=ge(e,a);c>i&&(i=c,r=a)}let a={bestMatch:r,similarity:i};return X.set(e,a),a}async function Q(e){let t=[];if(!e.doctorConfig.checks.metadata.enabled)return t;let{titleMin:r,titleMax:a,descriptionMin:s}=e.doctorConfig.checks.metadata,c=new Map;for(let l of e.files){let u=n(o.relative(e.docsDir,l));try{let{raw:n,data:o}=await G(l);if(n.trim().startsWith(`---`)&&n.split(`---`).length>=3&&Object.keys(o).length===0){let n=U(e,`malformedFrontmatter`,`high`);n!==`off`&&t.push({file:u,level:n,message:`Malformed frontmatter (YAML parsing failed).`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}let d=i.safeParse(o);if(!d.success){let n=U(e,`invalidFrontmatter`,`high`);if(n!==`off`)for(let e of d.error.issues)t.push({file:u,level:n,message:`Invalid frontmatter field "${e.path.join(`.`)}": ${e.message}`,suggestion:`Ensure the field follows the correct type.`})}let f=Array.from(new Set([`title`,...e.doctorConfig.checks.metadata.required]));for(let n of f)if(o[n]===void 0){let r=U(e,`missingMetadata`,`warning`);r!==`off`&&t.push({file:u,level:r,message:`Missing required frontmatter field: "${n}".`,suggestion:`Add the "${n}" field to your frontmatter.`})}if(e.doctorConfig.checks.metadata.validateDates){let n=[`date`,`lastUpdated`,...e.doctorConfig.checks.metadata.optional.filter(e=>e.toLowerCase().includes(`date`))];for(let r of n)if(o[r]&&Number.isNaN(Date.parse(String(o[r])))){let n=U(e,`invalidFrontmatter`,`high`);n!==`off`&&t.push({file:u,level:n,message:`Invalid date format in field "${r}": "${o[r]}".`,suggestion:`Use a valid ISO date format (e.g., YYYY-MM-DD).`})}}if(o.title){let n=String(o.title);if(n.length<r){let i=U(e,`shortMetadata`,`low`);i!==`off`&&t.push({file:u,level:i,message:`Title is too short (${n.length} chars).`,suggestion:`Titles should be at least ${r} characters for better SEO.`})}else if(n.length>a){let r=U(e,`shortMetadata`,`low`);r!==`off`&&t.push({file:u,level:r,message:`Title is too long (${n.length} chars).`,suggestion:`Titles should be under ${a} characters.`})}let i=c.get(n)||[];i.push(u),c.set(n,i)}if(o.description&&String(o.description).length<s){let n=U(e,`shortMetadata`,`low`);n!==`off`&&t.push({file:u,level:n,message:`Description is very short.`,suggestion:`Descriptions should ideally be at least ${s} characters.`})}}catch(n){if(n instanceof Error){let r=U(e,`malformedFrontmatter`,`high`);r!==`off`&&t.push({file:u,level:r,message:`Malformed frontmatter (YAML error): ${n.message}`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}}}for(let[n,r]of c.entries())if(r.length>1){let i=U(e,`duplicateTitle`,`low`);if(i!==`off`)for(let e of r)t.push({file:e,level:i,message:`Duplicate title found: "${n}"`,suggestion:`Ensure each page has a unique title. Also used in: ${r.filter(t=>t!==e).join(`, `)}`})}return t}async function $(e){let t=[],{internal:r,external:i,ignore:a,timeout:c,concurrency:l}=e.doctorConfig.checks.links;if(!r&&!i&&!e.options.checkExternal)return t;let u=/(?:\[.*?\]\((.*?)\))|(?:href=["']([^"']+)["'])/g,d=new Set,p=5e5;for(let c of e.files){let l=n(o.relative(e.docsDir,c)),{content:f}=await G(c),m=[...(f.length>p?f.slice(0,p):f).replace(/```[\s\S]*?```/g,``).replace(/`[^`\n]*`/g,``).matchAll(u)];for(let n of m){let u=n[1]||n[2],f=!!n[1];if(!u||a.some(e=>u.includes(e)))continue;if(/^https?:\/\//i.test(u)){(i||e.options.checkExternal)&&d.add({url:u,file:c});continue}if(!r||/^(mailto|tel|#)/i.test(u))continue;let p;try{p=decodeURIComponent(u.split(`#`)[0].split(`?`)[0])}catch{p=u.split(`#`)[0].split(`?`)[0]}if(!p)continue;let m=!1,h=``;if(p.startsWith(`/`))if(e.routeIndex.has(p)||e.routeIndexWithSlash.has(p)||e.routeIndexWithoutSlash.has(p))m=!0;else{let t=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);if(e.routeIndex.has(t)||e.routeIndexWithSlash.has(t))m=!1,h=t;else{let t=e.config.base!==`/`&&p.startsWith(e.config.base||`/`)?p.substring((e.config.base||`/`).length):p,n=t.startsWith(`/`)?t.substring(1):t;h=o.join(e.docsDir,n),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>q(h+e))}}else h=o.resolve(o.dirname(c),p),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>q(h+e));if(!m){let{bestMatch:n,similarity:r}=Z(p,e.linkTree.routes),i=!1,a=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);(e.routeIndex.has(a)||e.routeIndexWithSlash.has(a))&&(n=a,r=1,i=!0);let o=r>.6||i,d=r>.75&&n!==p||i,m=U(e,`brokenLink`,`high`);m!==`off`&&t.push({file:l,level:m,message:`Broken internal link: "${u}"`,suggestion:o?`Did you mean "${n}"?`:`Ensure the target exists or check for typos.`,fix:d?async()=>{let e=u.includes(`#`)?`#`+u.split(`#`)[1]:``,t=f?`(${u})`:`href="${u}"`,r=f?`(${n}${e})`:`href="${n}${e}"`,i=s.readFileSync(c,`utf-8`).replace(t,r);s.writeFileSync(c,i),W.delete(c)}:void 0})}}}if(d.size>0){_(f.gray(`Verifying ${d.size} external links...`));let r=new Map;for(let e of d)r.has(e.url)||r.set(e.url,[]),r.get(e.url).push(e.file);let i=async e=>{try{let t=new AbortController,n=setTimeout(()=>t.abort(),c),r=await fetch(e,{method:`HEAD`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}});return clearTimeout(n),!r.ok&&r.status!==404?{url:e,ok:(await fetch(e,{method:`GET`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}})).ok}:{url:e,ok:r.ok}}catch(t){return{url:e,ok:!1,error:t.message}}},a=Array.from(r.keys()),s=[];for(let e=0;e<a.length;e+=l){let t=a.slice(e,e+l),n=await Promise.allSettled(t.map(i));s.push(...n.map(e=>e.status===`fulfilled`?e.value:{url:`unknown`,ok:!1,error:e.reason}))}for(let i of s)if(!i.ok){let a=U(e,`brokenLink`,`warning`);if(a!==`off`){let s=r.get(i.url)||[];for(let r of s)t.push({file:n(o.relative(e.docsDir,r)),level:a,message:`Broken external link: "${i.url}"`,suggestion:`Verify the URL or update it if it's permanently down. Error: ${i.error||`Status >= 400`}`})}}}return t}async function _e(e){let t=[];if(!e.doctorConfig.checks.i18n.enabled||!e.config.i18n)return t;let{defaultLocale:r,locales:i}=e.config.i18n,a=Object.keys(i),c=a.filter(e=>e!==r);for(let i of e.files){let l=n(o.relative(e.docsDir,i)),u=l.split(`/`),d=u[0];if(d===r){let n=u.slice(1).join(`/`);for(let r of c){let a=o.join(e.docsDir,r,n);if(!q(a)){let c=U(e,`missingTranslation`,`warning`);c!==`off`&&t.push({file:l,level:c,message:`Missing translation for locale "${r}"`,suggestion:`Create a version at "${r}/${n}".`,fix:async()=>{let e=o.dirname(a);s.existsSync(e)||s.mkdirSync(e,{recursive:!0}),s.copyFileSync(i,a)}})}}}else if(a.includes(d)){let n=u.slice(1).join(`/`);if(!q(o.join(e.docsDir,r,n))){let a=U(e,`missingTranslation`,`low`);a!==`off`&&t.push({file:l,level:a,message:`Orphaned translation (source missing in "${r}")`,suggestion:`Remove this file or create the source at "${r}/${n}".`,fix:async()=>{s.unlinkSync(i)}})}}}return t}async function ve(e){let t=[];if(!e.config.theme.sidebar)return t;let n=new Set,r=e.config.theme.sidebar;for(let[i,a]of Object.entries(r))for(let r of a){if(!r.text){let n=U(e,`invalidFrontmatter`,`warning`);n!==`off`&&t.push({file:`boltdocs.config.ts`,level:n,message:`Sidebar item in group "${i}" is missing a label.`,suggestion:`Add a "text" property to the sidebar item.`})}if(r.link&&(n.add(r.link),!e.routeIndex.has(r.link))){let{bestMatch:n,similarity:i}=Z(r.link,e.linkTree.routes),a=i>.6,o=U(e,`brokenLink`,`high`);o!==`off`&&t.push({file:`boltdocs.config.ts`,level:o,message:`Broken sidebar link: "${r.link}"`,suggestion:a?`Did you mean "${n}"?`:`Ensure the route exists and is correctly formatted.`})}}for(let r of e.linkTree.routes)if(!(r===`/`||r===``)&&!n.has(r)){let n=U(e,`orphanedPage`,`low`);n!==`off`&&t.push({file:`Sidebar`,level:n,message:`Orphaned page found: "${r}" is not linked in the sidebar.`,suggestion:`Consider adding it to the sidebar for better discoverability.`})}return t}async function ye(e){let t=[],n=e.doctorConfig.checks.performance;if(!n?.enabled)return t;let r=o.resolve(e.root,`.boltdocs`,`reports`,`performance.json`);if(!s.existsSync(r))return t.push({file:`(build)`,level:U(e,`budgetExceeded`,`warning`),message:"Performance metrics not found. Run `boltdocs build` first."}),t;let i;try{i=JSON.parse(s.readFileSync(r,`utf-8`))}catch{return t.push({file:`(build)`,level:U(e,`budgetExceeded`,`warning`),message:`Failed to parse performance metrics file.`}),t}let a=n.budgets,c=U(e,`budgetExceeded`,`warning`),l=H(a?.maxJSBundleSize,1/0),u=H(a?.maxCSSBundleSize,1/0),d=H(a?.maxPageHTMLSize,1/0),f=a?.maxImagesKB??1/0,p=a?.maxBuildTime??1/0,m=a?.maxFontCount??1/0;if(l!==1/0&&i.totalJSBundleSize>l){let e=(i.totalJSBundleSize/1024).toFixed(0),n=(l/1024).toFixed(0);t.push({file:`(build)`,level:c,message:`JS bundle size exceeds budget: ${e}kb > ${n}kb`,suggestion:`Code-split large dependencies or lazy-load route components.`})}if(u!==1/0&&i.totalCSSBundleSize>u){let e=(i.totalCSSBundleSize/1024).toFixed(0),n=(u/1024).toFixed(0);t.push({file:`(build)`,level:c,message:`CSS bundle size exceeds budget: ${e}kb > ${n}kb`,suggestion:`Remove unused styles or split CSS by route.`})}if(d!==1/0){for(let e of i.pages)if(e.htmlSize>d){let n=(e.htmlSize/1024).toFixed(0),r=(d/1024).toFixed(0);t.push({file:e.route,level:c,message:`Page HTML size exceeds budget: ${n}kb > ${r}kb`,suggestion:`Reduce the amount of inline content or split into sub-pages.`})}}let h=f*1024;if(f!==1/0&&i.totalImagesSize>h){let e=(i.totalImagesSize/1024).toFixed(0);t.push({file:`(build)`,level:c,message:`Image assets exceed budget: ${e}kb > ${f}kb`,suggestion:`Optimize images with lossy compression or use next-gen formats (webp/avif).`})}if(p!==1/0&&i.buildTime>p){let e=(i.buildTime/1e3).toFixed(1),n=(p/1e3).toFixed(1);t.push({file:`(build)`,level:c,message:`Build time exceeds budget: ${e}s > ${n}s`,suggestion:"Check for large unoptimized assets or increase `concurrency` in SSG options."})}return m!==1/0&&i.fontCount>m&&t.push({file:`(build)`,level:c,message:`Font files exceed budget: ${i.fontCount} > ${m}`,suggestion:`Reduce the number of font families or use variable fonts.`}),t}async function be(e){let t=o.resolve(e,`doctor.json`);if(s.existsSync(t)){b(`"doctor.json" already exists at ${e}.`);return}try{s.writeFileSync(t,JSON.stringify(V,null,2)),y(`Created "doctor.json" with default configuration.`)}catch(e){g(`Failed to create "doctor.json": ${e}`)}}async function xe(e=process.cwd(),t={}){if(t.init){await be(e);return}B();try{let n=await J(e),{format:r}=n.reporting,i=performance.now(),a=await z(`docs`,e),c=o.resolve(e,`docs`);s.existsSync(c)||(r===`pretty`&&g(`Docs dir not found at ${c}`),process.exit(1)),r===`pretty`&&console.log(h([` ${f.dim(`Docs dir:`)} ${c}`,` ${f.dim(`Reports:`)} ${e}/.boltdocs/reports/`],{title:`✦ DOCTOR — Documentation Health Check`})),r===`pretty`&&_(f.dim(`🔍 Discovering files and routes...`));let u=re(n.exclude||[]),v=await new l().withFullPaths().filter(e=>{if(!(e.endsWith(`.md`)||e.endsWith(`.mdx`)))return!1;let t=o.relative(c,e).replace(/\\/g,`/`),n=t.split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`);return!u(t)&&!n}).crawl(c).withPromise();for(let e of v)K.set(e,!0);let b=await Y(c,e,a,v),x=a.base||`/`,S=x===`/`?``:x.endsWith(`/`)?x.slice(0,-1):x,C={root:e,docsDir:c,config:a,doctorConfig:n,linkTree:b,files:v,options:t,routeIndex:new Set(b.routes),routeIndexWithSlash:new Set(b.routes.map(e=>e.endsWith(`/`)?e:e+`/`)),routeIndexWithoutSlash:new Set(b.routes.map(e=>e.endsWith(`/`)?e.slice(0,-1):e)),basePrefix:S};r===`pretty`&&_(f.dim(`🧪 Running diagnostic checks in parallel...`));let w=[Q(C),$(C),_e(C),ve(C)];t.budget&&w.push(ye(C));let[T,E,D,O,...k]=await Promise.all(w),A=t.budget?k[0]:[],j=[...T,...E,...D,...O,...A];if(r===`pretty`){let e=[{label:`Metadata checks ${T.length>0?`— ${T.length} issue${T.length===1?``:`s`}`:`— OK`}`,done:T.length===0},{label:`Link checks ${E.length>0?`— ${E.length} issue${E.length===1?``:`s`}`:`— OK`}`,done:E.length===0},{label:`i18n checks ${D.length>0?`— ${D.length} issue${D.length===1?``:`s`}`:`— OK`}`,done:D.length===0},{label:`Sidebar checks ${O.length>0?`— ${O.length} issue${O.length===1?``:`s`}`:`— OK`}`,done:O.length===0}];t.budget&&e.push({label:`Performance budget ${A.length>0?`— ${A.length} issue${A.length===1?``:`s`}`:`— OK`}`,done:A.length===0}),console.log(`\n${ne(e)}`)}let M=0;if(t.fix){for(let e of j)if(e.fix){if(C.doctorConfig.fix.confirmChanges&&!await p(`Fix issue in "${e.file}": ${e.message}?`))continue;if(C.doctorConfig.fix.backupFiles){let t=o.resolve(C.docsDir,e.file);s.existsSync(t)&&await he(t,o.resolve(C.root,C.doctorConfig.fix.backupPath))}await e.fix(),M++}}let N=((performance.now()-i)/1e3).toFixed(2),P=j.filter(e=>e.level===`high`).length,F=j.filter(e=>e.level===`warning`).length,I=j.filter(e=>e.level===`low`).length,L={summary:{total:j.length,high:P,warning:F,low:I,fixed:M,duration:N},issues:j.map(e=>({...e,fix:void 0}))};if(n.reporting.outputFile){let t=o.resolve(e,n.reporting.outputFile);s.existsSync(o.dirname(t))||s.mkdirSync(o.dirname(t),{recursive:!0}),s.writeFileSync(t,JSON.stringify(L,null,2))}if(r===`json`)console.log(JSON.stringify(L,null,2));else if(r===`pretty`){let e=j.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(t),e),{});if(j.length>0){m();for(let[n,r]of Object.entries(e)){let e=[];for(let n of r){let r=n.level===`high`?`❌`:n.level===`warning`?`⚠️`:`ℹ️`,i=n.level===`high`?f.red:n.level===`warning`?f.yellow:f.blue;e.push(`${r} ${i(n.level.toUpperCase())}: ${n.message}`),n.suggestion&&e.push(` ${f.dim(`💡 ${n.suggestion}`)}`),t.fix&&n.fix&&e.push(` ${f.green(`✅ Fixed automatically`)}`)}console.log(`\n${te(e,{title:`📄 ${n}`})}`)}m()}if(j.length===0)console.log(ee([` Everything looks perfect!`,` Your documentation is in great shape.`,``,` ${f.dim(`Scanned ${v.length} file${v.length===1?``:`s`} in ${N}s`)}`],{title:`✨ Documentation Health Check`}));else{let e=[];P>0&&e.push(f.red(`${P} Critical Error${P===1?``:`s`}`)),F>0&&e.push(f.yellow(`${F} Warning${F===1?``:`s`}`)),I>0&&e.push(f.blue(`${I} Improvement${I===1?``:`s`}`));let t=[...d(e).split(`
|
|
34
|
+
`).map(e=>e.trimStart()),``,f.dim(`Scanned ${v.length} file${v.length===1?``:`s`} in ${N}s`)];console.log(`\n${h(t,{title:`Diagnosis Results`})}\n`),M>0&&y(`Successfully fixed ${M} issues automatically!`),P>0?g(`Please fix the critical errors before building for production.`):y(`No critical issues found. You are ready to go!`)}}n.reporting.failOnError&&P>0&&process.exit(1),n.reporting.maxWarnings!==-1&&F>n.reporting.maxWarnings&&(r===`pretty`&&g(`Failed: Too many warnings (${F} > ${n.reporting.maxWarnings})`),process.exit(1))}catch(e){g(`Doctor failed: ${e}`),process.exit(1)}}export{ae as _,Q as a,Y as c,B as d,ce as f,se as g,z as h,$ as i,J as l,R as m,be as n,ye as o,le as p,_e as r,ve as s,xe as t,V as u,oe as v,T as y};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
const e=require(`./chunk-Ds5LZdWN.cjs`),t=require(`./utils-wHud9ny5.cjs`);let n=require(`node:path`);n=e.n(n);let r=require(`node:fs`);r=e.n(r);let i=require(`node:module`),a=require(`vite`),o=require(`fdir`),s=require(`zod`),c=require(`@bdocs/dui`),l=require(`picomatch`);l=e.n(l);let u=require(`node:os`);u=e.n(u);let d=require(`node:url`),f=require(`fastest-levenshtein`);const p=s.z.object({icon:s.z.string().max(50),link:s.z.string().url()});s.z.object({text:s.z.string().max(2e3).optional()});const m=s.z.object({name:s.z.string(),enforce:s.z.enum([`pre`,`post`]).optional(),version:s.z.string().optional(),boltdocsVersion:s.z.string().optional(),remarkPlugins:s.z.array(s.z.unknown()).optional(),rehypePlugins:s.z.array(s.z.unknown()).optional(),vitePlugins:s.z.array(s.z.unknown()).optional(),components:s.z.record(s.z.string(),s.z.string()).optional(),hooks:s.z.record(s.z.string(),s.z.unknown()).optional()}),h=s.z.object({title:s.z.union([s.z.string(),s.z.record(s.z.string(),s.z.string())]).optional(),description:s.z.union([s.z.string(),s.z.record(s.z.string(),s.z.string())]).optional(),logo:s.z.union([s.z.string(),s.z.object({dark:s.z.string(),light:s.z.string(),alt:s.z.string().optional(),width:s.z.number().optional(),height:s.z.number().optional()})]).optional(),navbar:s.z.array(s.z.object({label:s.z.union([s.z.string(),s.z.record(s.z.string(),s.z.string())]),href:s.z.string(),items:s.z.array(s.z.object({label:s.z.union([s.z.string(),s.z.record(s.z.string(),s.z.string())]),href:s.z.string()})).optional()})).optional(),sidebar:s.z.record(s.z.string(),s.z.array(s.z.object({text:s.z.string(),link:s.z.string()}))).optional(),sidebarGroups:s.z.record(s.z.string(),s.z.object({title:s.z.union([s.z.string(),s.z.record(s.z.string(),s.z.string())]).optional(),icon:s.z.string().optional()})).optional(),socialLinks:s.z.array(p).optional(),editLink:s.z.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:s.z.string().url().optional(),version:s.z.string().max(50).optional(),githubRepo:s.z.string().max(100).optional(),favicon:s.z.string().optional(),tabs:s.z.array(s.z.object({id:s.z.string(),text:s.z.union([s.z.string(),s.z.record(s.z.string(),s.z.string())]),icon:s.z.string().optional()})).optional(),codeTheme:s.z.union([s.z.string(),s.z.object({light:s.z.string(),dark:s.z.string()})]).optional()}),g=s.z.union([s.z.string(),s.z.object({rules:s.z.array(s.z.object({userAgent:s.z.string(),allow:s.z.union([s.z.string(),s.z.array(s.z.string())]).optional(),disallow:s.z.union([s.z.string(),s.z.array(s.z.string())]).optional()})).optional(),sitemaps:s.z.array(s.z.string().url()).optional()})]),_=s.z.object({defaultLocale:s.z.string(),locales:s.z.union([s.z.record(s.z.string(),s.z.string()),s.z.array(s.z.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:s.z.record(s.z.string(),s.z.object({label:s.z.string().optional(),direction:s.z.enum([`ltr`,`rtl`]).optional(),htmlLang:s.z.string().optional(),calendar:s.z.string().optional()})).optional()}),v=s.z.object({defaultVersion:s.z.string(),prefix:s.z.string().optional(),versions:s.z.array(s.z.object({label:s.z.string(),path:s.z.string()}))}),y=s.z.object({headers:s.z.record(s.z.string(),s.z.string()).optional(),enableCSP:s.z.boolean().optional(),customHeaders:s.z.record(s.z.string(),s.z.string()).optional()}),b=s.z.object({metatags:s.z.record(s.z.string(),s.z.string()).optional(),indexing:s.z.enum([`all`,`public`]).optional(),thumbnails:s.z.object({background:s.z.string().optional()}).optional()}),x=s.z.object({measurementId:s.z.string().min(1,`Measurement ID is required for GA4`),debug:s.z.boolean().optional(),anonymizeIp:s.z.boolean().optional(),sendPageView:s.z.boolean().optional(),cookieFlags:s.z.string().optional(),autoTrack:s.z.object({pageViews:s.z.boolean().optional(),downloads:s.z.boolean().optional(),externalLinks:s.z.boolean().optional(),search:s.z.boolean().optional()}).optional()}),S=s.z.object({tagId:s.z.string().min(1,`Tag ID is required for GTM`),dataLayerName:s.z.string().optional(),preview:s.z.string().optional()}),C=s.z.object({appId:s.z.string().min(1,`Algolia App ID is required`),apiKey:s.z.string().min(1,`Algolia API Key is required`),indexName:s.z.string().min(1,`Algolia Index Name is required`)}),w=s.z.object({repo:s.z.string().min(1,`Giscus repository is required`),repoId:s.z.string().min(1,`Giscus repository ID is required`),category:s.z.string().optional(),categoryId:s.z.string().optional(),mapping:s.z.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:s.z.union([s.z.enum([`0`,`1`]),s.z.boolean()]).optional(),reactionsEnabled:s.z.union([s.z.enum([`0`,`1`]),s.z.boolean()]).optional(),emitMetadata:s.z.union([s.z.enum([`0`,`1`]),s.z.boolean()]).optional(),inputPosition:s.z.enum([`top`,`bottom`]).optional(),theme:s.z.string().optional(),darkTheme:s.z.string().optional(),lang:s.z.string().optional(),loading:s.z.enum([`lazy`,`eager`]).optional()}),T=s.z.object({enabled:s.z.boolean(),owner:s.z.string().min(1,`GitHub owner is required`),repo:s.z.string().min(1,`GitHub repository name is required`),categorySlug:s.z.string().optional(),endpoint:s.z.string().optional()}),E=s.z.object({ga4:x.optional(),gtm:S.optional(),algolia:C.optional(),feedback:s.z.object({giscus:w.optional(),custom:T.optional()}).optional()}),D=s.z.object({siteUrl:s.z.string().url().optional(),docsDir:s.z.string().optional(),base:s.z.string().optional(),theme:h.optional(),i18n:_.optional(),versions:v.optional(),plugins:s.z.array(m).optional(),robots:g.optional(),security:y.optional(),seo:b.optional(),integrations:E.optional(),vite:s.z.record(s.z.string(),s.z.unknown()).optional()});function O(e,t,i=process.cwd(),a){let o=n.default.resolve(i,`.boltdocs`,`generated`);r.default.existsSync(o)||r.default.mkdirSync(o,{recursive:!0});let s=e.i18n?Object.keys(e.i18n.locales):[],c=e.versions?e.versions.versions.map(e=>e.path):[],l=s.length>0?s.map(e=>`'${e}'`).join(` | `):`string`,u=c.length>0?c.map(e=>`'${e}'`).join(` | `):`string`,d=[`tsx`,`ts`,`jsx`,`js`],f=``,p=``;for(let e of d){let a=n.default.resolve(i,t,`mdx-components.${e}`);if(r.default.existsSync(a)){let e=n.default.join(i,t,`mdx-components`),r=n.default.relative(o,e).replace(/\\/g,`/`);f=`import type * as MdxComponentsModule from '${r.startsWith(`.`)?r:`./${r}`}'\n`,p=` MdxComponents: typeof MdxComponentsModule`;break}}let m=a&&a.length>0?`\ndeclare global {
|
|
7
|
+
namespace Boltdocs {
|
|
8
|
+
interface RoutePaths {
|
|
9
|
+
${a.map(e=>` '${e}': void`).join(`
|
|
10
|
+
`)}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}`:``,h=`// This file is automatically generated by Boltdocs.
|
|
14
|
+
// Do not edit this file manually.
|
|
15
|
+
|
|
16
|
+
${f}declare global {
|
|
17
|
+
namespace Boltdocs {
|
|
18
|
+
interface Types {
|
|
19
|
+
Locale: ${l}
|
|
20
|
+
Version: ${u}${p?`\n${p}`:``}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}${m}
|
|
24
|
+
|
|
25
|
+
export {}
|
|
26
|
+
`;r.default.writeFileSync(n.default.resolve(o,`types.d.ts`),h)}function k(e,t=process.cwd()){let i=n.default.resolve(t,`.boltdocs`,`generated`);r.default.existsSync(i)||r.default.mkdirSync(i,{recursive:!0});let a={routes:Array.from(new Set(e)).sort(),timestamp:Date.now()};r.default.writeFileSync(n.default.resolve(i,`link-tree.json`),JSON.stringify(a,null,2))}function A(e){return e}const j=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function M(e,i=process.cwd()){let o=i,s={docsDir:n.default.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},l={};for(let e of j){let t=n.default.resolve(o,e);if(r.default.existsSync(t))try{let e=await(0,a.loadConfigFromFile)({command:`serve`,mode:`development`},t,o);if(e){l=e.config;break}}catch(t){(0,c.warn)(`Failed to load config from ${e}:`,t)}}let u={title:l.title,description:l.description,logo:l.logo,favicon:l.favicon,navbar:l.navbar,sidebar:l.sidebar,sidebarGroups:l.theme?.sidebarGroups,socialLinks:l.socialLinks,githubRepo:l.githubRepo,tabs:l.tabs,codeTheme:l.codeTheme,communityHelp:l.communityHelp,version:l.version,editLink:l.editLink,...l.theme||{}},d=Object.fromEntries(Object.entries(u).filter(([e,t])=>t!==void 0));d.navbar&&=d.navbar.map(e=>({label:e.label||e.text||``,href:e.href||e.link||e.to||``,items:e.items}));let f={docsDir:n.default.resolve(e),theme:{...s.theme,...d},i18n:l.i18n?{...l.i18n,locales:Array.isArray(l.i18n.locales)?Object.fromEntries(l.i18n.locales.map(e=>[e,e])):l.i18n.locales}:void 0,versions:l.versions,siteUrl:l.siteUrl,base:l.base,seo:l.seo,plugins:l.plugins||[],robots:l.robots,security:l.security,integrations:l.integrations,vite:l.vite},p=D.safeParse(f);if(!p.success)throw new t.v(`Invalid Boltdocs configuration:\n${p.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
|
|
27
|
+
`)}`);return p.data}function ee(e,t){let n=t?` ${c.colors.green(`➜`)} ${c.colors.green(`Network:`)} ${c.colors.cyan(t)}`:` ${c.colors.green(`➜`)} ${c.colors.green(`Network:`)} ${c.colors.gray(`use --host to expose`)}`;return`
|
|
28
|
+
`+(0,c.double)([` ${c.colors.green(`➜`)} ${c.colors.green(`Local:`)} ${c.colors.cyan(e)}`,n,``,` ${c.colors.dim(`press h + enter for help`)}`],{title:`boltdocs dev server`})+`
|
|
29
|
+
`}function te(e,t){let n=t?` ${c.colors.green(`➜`)} ${c.colors.green(`Network:`)} ${c.colors.cyan(t)}`:` ${c.colors.green(`➜`)} ${c.colors.green(`Network:`)} ${c.colors.gray(`use --host to expose`)}`;return`
|
|
30
|
+
`+(0,c.double)([` ${c.colors.green(`➜`)} ${c.colors.green(`Local:`)} ${c.colors.cyan(e)}`,n],{title:`boltdocs preview server`})+`
|
|
31
|
+
`}function ne(e,t){return`
|
|
32
|
+
`+(0,c.double)([(0,c.padCenter)(`🚀 Update available!`,50),``,` ${c.colors.dim(`Current:`)} ${c.colors.red(e)} ${c.colors.gray(`→`)} ${c.colors.green(t)}`,``,` ${c.colors.dim(`Run:`)} ${c.colors.bold(`npm install boltdocs@latest`)}`])+`
|
|
33
|
+
`}const re=(0,i.createRequire)(require(`url`).pathToFileURL(__filename).href);function N(e,t){let n=e.split(`-`)[0].split(`.`).map(Number),r=t.split(`-`)[0].split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]??0,i=r[e]??0;if(Number.isNaN(t)||Number.isNaN(i))return!1;if(t!==i)return t>i}return!1}async function ie(){try{let e=new AbortController,t=setTimeout(()=>e.abort(),2e3),n=await fetch(`https://registry.npmjs.org/boltdocs/latest`,{signal:e.signal,headers:{Accept:`application/vnd.npm.install-v1+json`}});return clearTimeout(t),n.ok?(await n.json()).version??null:null}catch{return null}}async function ae(){try{let e=(0,d.fileURLToPath)(require(`url`).pathToFileURL(__filename).href),t=n.default.dirname(e);for(let e=0;e<5;e++){let e=n.default.join(t,`package.json`);if(r.default.existsSync(e)){let t=JSON.parse(r.default.readFileSync(e,`utf-8`));if(t.name===`boltdocs`)return t.version}t=n.default.dirname(t)}}catch{}try{return re(`boltdocs/package.json`).version}catch{return`0.0.0`}}async function P(){let e=``;try{e=n.default.join(u.default.homedir(),`.boltdocs`,`update-check.json`)}catch{return}let t=0;try{if(r.default.existsSync(e)){let n=JSON.parse(r.default.readFileSync(e,`utf-8`));t=Number(n.lastCheck)||0}}catch{}let i=Date.now();if(i-t<864e5)return;try{r.default.mkdirSync(n.default.dirname(e),{recursive:!0}),r.default.writeFileSync(e,JSON.stringify({lastCheck:i}),`utf-8`)}catch{}let a=await ae();if(a===`0.0.0`)return;let o=await ie();o&&N(o,a)&&console.log(ne(a,o))}const F={$schema:`https://boltdocs.vercel.app/schemas/doctor-config.schema.json`,checks:{metadata:{enabled:!0,titleMin:10,titleMax:60,descriptionMin:50,required:[`title`,`description`],optional:[],validateDates:!1},links:{internal:!0,external:!1,timeout:1e4,concurrency:10,ignore:[]},i18n:{enabled:!0},performance:{enabled:!0,budgets:{maxJSBundleSize:`200kb`,maxCSSBundleSize:`30kb`,maxPageHTMLSize:`80kb`,maxImagesKB:500,maxBuildTime:3e4,maxFontCount:3}}},fix:{confirmChanges:!1,backupFiles:!1,backupPath:`.boltdocs/backups`},reporting:{format:`pretty`,outputFile:`.boltdocs/reports/doctor.json`,failOnError:!1,maxWarnings:-1},severity:{missingTranslation:`warning`,brokenLink:`high`,brokenAnchor:`warning`,largeFile:`warning`,orphanedPage:`low`,duplicateTitle:`low`,shortMetadata:`low`,missingMetadata:`warning`,malformedFrontmatter:`high`,invalidFrontmatter:`high`,budgetExceeded:`warning`},exclude:[]};function I(e,t){if(e==null)return t;if(typeof e==`number`)return e;let n=e.toLowerCase().match(/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/);if(!n)return t;let r=Number.parseFloat(n[1]),i=n[2]||`b`;return Math.round(r*({b:1,kb:1024,mb:1024*1024,gb:1024*1024*1024}[i]||1))}function L(e,t,n){return e.doctorConfig.severity[t]||n}async function R(e,t){r.default.existsSync(t)||r.default.mkdirSync(t,{recursive:!0});let i=n.default.basename(e),a=new Date().toISOString().replace(/[:.]/g,`-`),o=n.default.join(t,`${i}.${a}.bak`);r.default.copyFileSync(e,o)}const z=new Map;function B(e){let n=z.get(e);if(n)return n;let r=(async()=>{let n=await t.d(e,!1);return{raw:n.raw,data:n.data,content:n.content}})();return z.set(e,r),r}const V=new Map;function H(e){if(V.has(e))return V.get(e);let t=!1;try{t=r.default.existsSync(e)&&r.default.statSync(e).isFile()}catch{t=!1}return V.set(e,t),t}async function U(e){let t=n.default.resolve(e,`doctor.json`);if(r.default.existsSync(t))try{let e=JSON.parse(r.default.readFileSync(t,`utf-8`));return{...F,...e,checks:{...F.checks,...e.checks,metadata:{...F.checks.metadata,...e.checks?.metadata},links:{...F.checks.links,...e.checks?.links},i18n:{...F.checks.i18n,...e.checks?.i18n},performance:{...F.checks.performance,...e.checks?.performance,budgets:{...F.checks.performance?.budgets,...e.checks?.performance?.budgets}}},fix:{...F.fix,...e.fix},reporting:{...F.reporting,...e.reporting},severity:{...F.severity,...e.severity},exclude:[...F.exclude,...e.exclude||[]]}}catch(e){(0,c.warn)(`Failed to parse doctor.json: ${e}`)}return F}async function W(e,i=process.cwd(),a,s){let c=n.default.resolve(i,`.boltdocs`,`generated`);r.default.existsSync(c)||r.default.mkdirSync(c,{recursive:!0});let l=s;l||=await new o.fdir().withFullPaths().filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)).crawl(e).withPromise();let u=a?.base||`/docs`,d=[];for(let r=0;r<l.length;r+=100){let i=l.slice(r,r+100),a=await Promise.all(i.map(async r=>{let i=n.default.isAbsolute(r)?r:n.default.resolve(e,r),a=n.default.relative(e,i),{data:o}=await B(i),s;return s=o.permalink?o.permalink.startsWith(`/`)?o.permalink:`/${o.permalink}`:t.a(a),u===`/`?s:(u.endsWith(`/`)?u:u+`/`)+(s.startsWith(`/`)?s.substring(1):s)}));d.push(...a)}d.includes(u)||d.push(u);let f={routes:Array.from(new Set(d)).sort(),timestamp:Date.now()};return r.default.writeFileSync(n.default.resolve(c,`link-tree.json`),JSON.stringify(f,null,2)),f}function G(e,t){if(e===t)return 1;if(!e||!t)return 0;let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean),i=n[n.length-1]||``,a=r[r.length-1]||``;if(i===a){let e=0;for(let t of n)r.includes(t)&&e++;return e>=2?.99:.9}if(i.length>3&&a.length>3&&(a.startsWith(i)||i.startsWith(a))&&Math.min(i.length,a.length)/Math.max(i.length,a.length)>.5)return .88;let o=1-(0,f.distance)(i,a)/Math.max(i.length,a.length);return o>.8?o*.95:1-(0,f.distance)(e,t)/Math.max(e.length,t.length)}const K=new Map;function q(e,t){if(K.has(e))return K.get(e);let n=e.length,r=``,i=0;for(let a of t){if(a===e)continue;let t=a.length,o=Math.max(n,t);if(o===0)continue;let s=1-Math.abs(n-t)/o;if(s<=.8&&s<=i)continue;let c=G(e,a);c>i&&(i=c,r=a)}let a={bestMatch:r,similarity:i};return K.set(e,a),a}async function J(e){let r=[];if(!e.doctorConfig.checks.metadata.enabled)return r;let{titleMin:i,titleMax:a,descriptionMin:o}=e.doctorConfig.checks.metadata,s=new Map;for(let c of e.files){let l=t.u(n.default.relative(e.docsDir,c));try{let{raw:n,data:u}=await B(c);if(n.trim().startsWith(`---`)&&n.split(`---`).length>=3&&Object.keys(u).length===0){let t=L(e,`malformedFrontmatter`,`high`);t!==`off`&&r.push({file:l,level:t,message:`Malformed frontmatter (YAML parsing failed).`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}let d=t.y.safeParse(u);if(!d.success){let t=L(e,`invalidFrontmatter`,`high`);if(t!==`off`)for(let e of d.error.issues)r.push({file:l,level:t,message:`Invalid frontmatter field "${e.path.join(`.`)}": ${e.message}`,suggestion:`Ensure the field follows the correct type.`})}let f=Array.from(new Set([`title`,...e.doctorConfig.checks.metadata.required]));for(let t of f)if(u[t]===void 0){let n=L(e,`missingMetadata`,`warning`);n!==`off`&&r.push({file:l,level:n,message:`Missing required frontmatter field: "${t}".`,suggestion:`Add the "${t}" field to your frontmatter.`})}if(e.doctorConfig.checks.metadata.validateDates){let t=[`date`,`lastUpdated`,...e.doctorConfig.checks.metadata.optional.filter(e=>e.toLowerCase().includes(`date`))];for(let n of t)if(u[n]&&Number.isNaN(Date.parse(String(u[n])))){let t=L(e,`invalidFrontmatter`,`high`);t!==`off`&&r.push({file:l,level:t,message:`Invalid date format in field "${n}": "${u[n]}".`,suggestion:`Use a valid ISO date format (e.g., YYYY-MM-DD).`})}}if(u.title){let t=String(u.title);if(t.length<i){let n=L(e,`shortMetadata`,`low`);n!==`off`&&r.push({file:l,level:n,message:`Title is too short (${t.length} chars).`,suggestion:`Titles should be at least ${i} characters for better SEO.`})}else if(t.length>a){let n=L(e,`shortMetadata`,`low`);n!==`off`&&r.push({file:l,level:n,message:`Title is too long (${t.length} chars).`,suggestion:`Titles should be under ${a} characters.`})}let n=s.get(t)||[];n.push(l),s.set(t,n)}if(u.description&&String(u.description).length<o){let t=L(e,`shortMetadata`,`low`);t!==`off`&&r.push({file:l,level:t,message:`Description is very short.`,suggestion:`Descriptions should ideally be at least ${o} characters.`})}}catch(t){if(t instanceof Error){let n=L(e,`malformedFrontmatter`,`high`);n!==`off`&&r.push({file:l,level:n,message:`Malformed frontmatter (YAML error): ${t.message}`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}}}for(let[t,n]of s.entries())if(n.length>1){let i=L(e,`duplicateTitle`,`low`);if(i!==`off`)for(let e of n)r.push({file:e,level:i,message:`Duplicate title found: "${t}"`,suggestion:`Ensure each page has a unique title. Also used in: ${n.filter(t=>t!==e).join(`, `)}`})}return r}async function Y(e){let i=[],{internal:a,external:o,ignore:s,timeout:l,concurrency:u}=e.doctorConfig.checks.links;if(!a&&!o&&!e.options.checkExternal)return i;let d=/(?:\[.*?\]\((.*?)\))|(?:href=["']([^"']+)["'])/g,f=new Set,p=5e5;for(let c of e.files){let l=t.u(n.default.relative(e.docsDir,c)),{content:u}=await B(c),m=[...(u.length>p?u.slice(0,p):u).replace(/```[\s\S]*?```/g,``).replace(/`[^`\n]*`/g,``).matchAll(d)];for(let t of m){let u=t[1]||t[2],d=!!t[1];if(!u||s.some(e=>u.includes(e)))continue;if(/^https?:\/\//i.test(u)){(o||e.options.checkExternal)&&f.add({url:u,file:c});continue}if(!a||/^(mailto|tel|#)/i.test(u))continue;let p;try{p=decodeURIComponent(u.split(`#`)[0].split(`?`)[0])}catch{p=u.split(`#`)[0].split(`?`)[0]}if(!p)continue;let m=!1,h=``;if(p.startsWith(`/`))if(e.routeIndex.has(p)||e.routeIndexWithSlash.has(p)||e.routeIndexWithoutSlash.has(p))m=!0;else{let t=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);if(e.routeIndex.has(t)||e.routeIndexWithSlash.has(t))m=!1,h=t;else{let t=e.config.base!==`/`&&p.startsWith(e.config.base||`/`)?p.substring((e.config.base||`/`).length):p,r=t.startsWith(`/`)?t.substring(1):t;h=n.default.join(e.docsDir,r),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>H(h+e))}}else h=n.default.resolve(n.default.dirname(c),p),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>H(h+e));if(!m){let{bestMatch:t,similarity:n}=q(p,e.linkTree.routes),a=!1,o=e.basePrefix+(p.startsWith(`/`)?p:`/`+p);(e.routeIndex.has(o)||e.routeIndexWithSlash.has(o))&&(t=o,n=1,a=!0);let s=n>.6||a,f=n>.75&&t!==p||a,m=L(e,`brokenLink`,`high`);m!==`off`&&i.push({file:l,level:m,message:`Broken internal link: "${u}"`,suggestion:s?`Did you mean "${t}"?`:`Ensure the target exists or check for typos.`,fix:f?async()=>{let e=u.includes(`#`)?`#`+u.split(`#`)[1]:``,n=d?`(${u})`:`href="${u}"`,i=d?`(${t}${e})`:`href="${t}${e}"`,a=r.default.readFileSync(c,`utf-8`).replace(n,i);r.default.writeFileSync(c,a),z.delete(c)}:void 0})}}}if(f.size>0){(0,c.info)(c.colors.gray(`Verifying ${f.size} external links...`));let r=new Map;for(let e of f)r.has(e.url)||r.set(e.url,[]),r.get(e.url).push(e.file);let a=async e=>{try{let t=new AbortController,n=setTimeout(()=>t.abort(),l),r=await fetch(e,{method:`HEAD`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}});return clearTimeout(n),!r.ok&&r.status!==404?{url:e,ok:(await fetch(e,{method:`GET`,signal:t.signal,headers:{"User-Agent":`boltdocs-doctor/1.0`}})).ok}:{url:e,ok:r.ok}}catch(t){return{url:e,ok:!1,error:t.message}}},o=Array.from(r.keys()),s=[];for(let e=0;e<o.length;e+=u){let t=o.slice(e,e+u),n=await Promise.allSettled(t.map(a));s.push(...n.map(e=>e.status===`fulfilled`?e.value:{url:`unknown`,ok:!1,error:e.reason}))}for(let a of s)if(!a.ok){let o=L(e,`brokenLink`,`warning`);if(o!==`off`){let s=r.get(a.url)||[];for(let r of s)i.push({file:t.u(n.default.relative(e.docsDir,r)),level:o,message:`Broken external link: "${a.url}"`,suggestion:`Verify the URL or update it if it's permanently down. Error: ${a.error||`Status >= 400`}`})}}}return i}async function X(e){let i=[];if(!e.doctorConfig.checks.i18n.enabled||!e.config.i18n)return i;let{defaultLocale:a,locales:o}=e.config.i18n,s=Object.keys(o),c=s.filter(e=>e!==a);for(let o of e.files){let l=t.u(n.default.relative(e.docsDir,o)),u=l.split(`/`),d=u[0];if(d===a){let t=u.slice(1).join(`/`);for(let a of c){let s=n.default.join(e.docsDir,a,t);if(!H(s)){let c=L(e,`missingTranslation`,`warning`);c!==`off`&&i.push({file:l,level:c,message:`Missing translation for locale "${a}"`,suggestion:`Create a version at "${a}/${t}".`,fix:async()=>{let e=n.default.dirname(s);r.default.existsSync(e)||r.default.mkdirSync(e,{recursive:!0}),r.default.copyFileSync(o,s)}})}}}else if(s.includes(d)){let t=u.slice(1).join(`/`);if(!H(n.default.join(e.docsDir,a,t))){let n=L(e,`missingTranslation`,`low`);n!==`off`&&i.push({file:l,level:n,message:`Orphaned translation (source missing in "${a}")`,suggestion:`Remove this file or create the source at "${a}/${t}".`,fix:async()=>{r.default.unlinkSync(o)}})}}}return i}async function Z(e){let t=[];if(!e.config.theme.sidebar)return t;let n=new Set,r=e.config.theme.sidebar;for(let[i,a]of Object.entries(r))for(let r of a){if(!r.text){let n=L(e,`invalidFrontmatter`,`warning`);n!==`off`&&t.push({file:`boltdocs.config.ts`,level:n,message:`Sidebar item in group "${i}" is missing a label.`,suggestion:`Add a "text" property to the sidebar item.`})}if(r.link&&(n.add(r.link),!e.routeIndex.has(r.link))){let{bestMatch:n,similarity:i}=q(r.link,e.linkTree.routes),a=i>.6,o=L(e,`brokenLink`,`high`);o!==`off`&&t.push({file:`boltdocs.config.ts`,level:o,message:`Broken sidebar link: "${r.link}"`,suggestion:a?`Did you mean "${n}"?`:`Ensure the route exists and is correctly formatted.`})}}for(let r of e.linkTree.routes)if(!(r===`/`||r===``)&&!n.has(r)){let n=L(e,`orphanedPage`,`low`);n!==`off`&&t.push({file:`Sidebar`,level:n,message:`Orphaned page found: "${r}" is not linked in the sidebar.`,suggestion:`Consider adding it to the sidebar for better discoverability.`})}return t}async function Q(e){let t=[],i=e.doctorConfig.checks.performance;if(!i?.enabled)return t;let a=n.default.resolve(e.root,`.boltdocs`,`reports`,`performance.json`);if(!r.default.existsSync(a))return t.push({file:`(build)`,level:L(e,`budgetExceeded`,`warning`),message:"Performance metrics not found. Run `boltdocs build` first."}),t;let o;try{o=JSON.parse(r.default.readFileSync(a,`utf-8`))}catch{return t.push({file:`(build)`,level:L(e,`budgetExceeded`,`warning`),message:`Failed to parse performance metrics file.`}),t}let s=i.budgets,c=L(e,`budgetExceeded`,`warning`),l=I(s?.maxJSBundleSize,1/0),u=I(s?.maxCSSBundleSize,1/0),d=I(s?.maxPageHTMLSize,1/0),f=s?.maxImagesKB??1/0,p=s?.maxBuildTime??1/0,m=s?.maxFontCount??1/0;if(l!==1/0&&o.totalJSBundleSize>l){let e=(o.totalJSBundleSize/1024).toFixed(0),n=(l/1024).toFixed(0);t.push({file:`(build)`,level:c,message:`JS bundle size exceeds budget: ${e}kb > ${n}kb`,suggestion:`Code-split large dependencies or lazy-load route components.`})}if(u!==1/0&&o.totalCSSBundleSize>u){let e=(o.totalCSSBundleSize/1024).toFixed(0),n=(u/1024).toFixed(0);t.push({file:`(build)`,level:c,message:`CSS bundle size exceeds budget: ${e}kb > ${n}kb`,suggestion:`Remove unused styles or split CSS by route.`})}if(d!==1/0){for(let e of o.pages)if(e.htmlSize>d){let n=(e.htmlSize/1024).toFixed(0),r=(d/1024).toFixed(0);t.push({file:e.route,level:c,message:`Page HTML size exceeds budget: ${n}kb > ${r}kb`,suggestion:`Reduce the amount of inline content or split into sub-pages.`})}}let h=f*1024;if(f!==1/0&&o.totalImagesSize>h){let e=(o.totalImagesSize/1024).toFixed(0);t.push({file:`(build)`,level:c,message:`Image assets exceed budget: ${e}kb > ${f}kb`,suggestion:`Optimize images with lossy compression or use next-gen formats (webp/avif).`})}if(p!==1/0&&o.buildTime>p){let e=(o.buildTime/1e3).toFixed(1),n=(p/1e3).toFixed(1);t.push({file:`(build)`,level:c,message:`Build time exceeds budget: ${e}s > ${n}s`,suggestion:"Check for large unoptimized assets or increase `concurrency` in SSG options."})}return m!==1/0&&o.fontCount>m&&t.push({file:`(build)`,level:c,message:`Font files exceed budget: ${o.fontCount} > ${m}`,suggestion:`Reduce the number of font families or use variable fonts.`}),t}async function $(e){let t=n.default.resolve(e,`doctor.json`);if(r.default.existsSync(t)){(0,c.warn)(`"doctor.json" already exists at ${e}.`);return}try{r.default.writeFileSync(t,JSON.stringify(F,null,2)),(0,c.success)(`Created "doctor.json" with default configuration.`)}catch(e){(0,c.error)(`Failed to create "doctor.json": ${e}`)}}async function oe(e=process.cwd(),t={}){if(t.init){await $(e);return}P();try{let i=await U(e),{format:a}=i.reporting,s=performance.now(),u=await M(`docs`,e),d=n.default.resolve(e,`docs`);r.default.existsSync(d)||(a===`pretty`&&(0,c.error)(`Docs dir not found at ${d}`),process.exit(1)),a===`pretty`&&console.log((0,c.double)([` ${c.colors.dim(`Docs dir:`)} ${d}`,` ${c.colors.dim(`Reports:`)} ${e}/.boltdocs/reports/`],{title:`✦ DOCTOR — Documentation Health Check`})),a===`pretty`&&(0,c.info)(c.colors.dim(`🔍 Discovering files and routes...`));let f=(0,l.default)(i.exclude||[]),p=await new o.fdir().withFullPaths().filter(e=>{if(!(e.endsWith(`.md`)||e.endsWith(`.mdx`)))return!1;let t=n.default.relative(d,e).replace(/\\/g,`/`),r=t.split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`);return!f(t)&&!r}).crawl(d).withPromise();for(let e of p)V.set(e,!0);let m=await W(d,e,u,p),h=u.base||`/`,g=h===`/`?``:h.endsWith(`/`)?h.slice(0,-1):h,_={root:e,docsDir:d,config:u,doctorConfig:i,linkTree:m,files:p,options:t,routeIndex:new Set(m.routes),routeIndexWithSlash:new Set(m.routes.map(e=>e.endsWith(`/`)?e:e+`/`)),routeIndexWithoutSlash:new Set(m.routes.map(e=>e.endsWith(`/`)?e.slice(0,-1):e)),basePrefix:g};a===`pretty`&&(0,c.info)(c.colors.dim(`🧪 Running diagnostic checks in parallel...`));let v=[J(_),Y(_),X(_),Z(_)];t.budget&&v.push(Q(_));let[y,b,x,S,...C]=await Promise.all(v),w=t.budget?C[0]:[],T=[...y,...b,...x,...S,...w];if(a===`pretty`){let e=[{label:`Metadata checks ${y.length>0?`— ${y.length} issue${y.length===1?``:`s`}`:`— OK`}`,done:y.length===0},{label:`Link checks ${b.length>0?`— ${b.length} issue${b.length===1?``:`s`}`:`— OK`}`,done:b.length===0},{label:`i18n checks ${x.length>0?`— ${x.length} issue${x.length===1?``:`s`}`:`— OK`}`,done:x.length===0},{label:`Sidebar checks ${S.length>0?`— ${S.length} issue${S.length===1?``:`s`}`:`— OK`}`,done:S.length===0}];t.budget&&e.push({label:`Performance budget ${w.length>0?`— ${w.length} issue${w.length===1?``:`s`}`:`— OK`}`,done:w.length===0}),console.log(`\n${(0,c.tasks)(e)}`)}let E=0;if(t.fix){for(let e of T)if(e.fix){if(_.doctorConfig.fix.confirmChanges&&!await(0,c.confirm)(`Fix issue in "${e.file}": ${e.message}?`))continue;if(_.doctorConfig.fix.backupFiles){let t=n.default.resolve(_.docsDir,e.file);r.default.existsSync(t)&&await R(t,n.default.resolve(_.root,_.doctorConfig.fix.backupPath))}await e.fix(),E++}}let D=((performance.now()-s)/1e3).toFixed(2),O=T.filter(e=>e.level===`high`).length,k=T.filter(e=>e.level===`warning`).length,A=T.filter(e=>e.level===`low`).length,j={summary:{total:T.length,high:O,warning:k,low:A,fixed:E,duration:D},issues:T.map(e=>({...e,fix:void 0}))};if(i.reporting.outputFile){let t=n.default.resolve(e,i.reporting.outputFile);r.default.existsSync(n.default.dirname(t))||r.default.mkdirSync(n.default.dirname(t),{recursive:!0}),r.default.writeFileSync(t,JSON.stringify(j,null,2))}if(a===`json`)console.log(JSON.stringify(j,null,2));else if(a===`pretty`){let e=T.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(t),e),{});if(T.length>0){(0,c.dividerLog)();for(let[n,r]of Object.entries(e)){let e=[];for(let n of r){let r=n.level===`high`?`❌`:n.level===`warning`?`⚠️`:`ℹ️`,i=n.level===`high`?c.colors.red:n.level===`warning`?c.colors.yellow:c.colors.blue;e.push(`${r} ${i(n.level.toUpperCase())}: ${n.message}`),n.suggestion&&e.push(` ${c.colors.dim(`💡 ${n.suggestion}`)}`),t.fix&&n.fix&&e.push(` ${c.colors.green(`✅ Fixed automatically`)}`)}console.log(`\n${(0,c.single)(e,{title:`📄 ${n}`})}`)}(0,c.dividerLog)()}if(T.length===0)console.log((0,c.round)([` Everything looks perfect!`,` Your documentation is in great shape.`,``,` ${c.colors.dim(`Scanned ${p.length} file${p.length===1?``:`s`} in ${D}s`)}`],{title:`✨ Documentation Health Check`}));else{let e=[];O>0&&e.push(c.colors.red(`${O} Critical Error${O===1?``:`s`}`)),k>0&&e.push(c.colors.yellow(`${k} Warning${k===1?``:`s`}`)),A>0&&e.push(c.colors.blue(`${A} Improvement${A===1?``:`s`}`));let t=[...(0,c.bullet)(e).split(`
|
|
34
|
+
`).map(e=>e.trimStart()),``,c.colors.dim(`Scanned ${p.length} file${p.length===1?``:`s`} in ${D}s`)];console.log(`\n${(0,c.double)(t,{title:`Diagnosis Results`})}\n`),E>0&&(0,c.success)(`Successfully fixed ${E} issues automatically!`),O>0?(0,c.error)(`Please fix the critical errors before building for production.`):(0,c.success)(`No critical issues found. You are ready to go!`)}}i.reporting.failOnError&&O>0&&process.exit(1),i.reporting.maxWarnings!==-1&&k>i.reporting.maxWarnings&&(a===`pretty`&&(0,c.error)(`Failed: Too many warnings (${k} > ${i.reporting.maxWarnings})`),process.exit(1))}catch(e){(0,c.error)(`Doctor failed: ${e}`),process.exit(1)}}Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return m}});
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
const e=require(`./chunk-
|
|
6
|
+
const e=require(`./chunk-Ds5LZdWN.cjs`);let t=require(`node:path`);t=e.n(t);let n=require(`node:fs`);n=e.n(n);let r=require(`@bdocs/dui`);function i(e){return e.replace(/^v/,``).replace(/^\[|\]$/g,``)}function a(e){let t=e.match(/Thanks \[@(\w+)\]/);return t?t[1]:void 0}function o(e){let t=e.match(/Thanks \[@[^\]]+\]\(([^)]+)\)/);return t?t[1]:void 0}function s(e){let t=e.match(/\[`([a-f0-9]+)`\]/);return t?t[1]:void 0}function c(e){let t=e.match(/\[`[a-f0-9]+`\]\(([^)]+)\)/);return t?t[1]:void 0}function l(e,t){let n=e;return n=n.replace(/Thanks \[@[^\]]+\]\([^)]+\)/g,``),n=n.replace(/\[`[a-f0-9]+`\]\([^)]+\)/g,``),n=n.replace(/!\s*-/g,``),n=n.replace(/^-\s*/,``),n=n.replace(/^feat:\s*/i,``),n=n.replace(/^fix:\s*/i,``),n=n.replace(/^perf:\s*/i,``),n=n.replace(/^refactor:\s*/i,``),n=n.replace(/^docs:\s*/i,``),n=n.replace(/^chore:\s*/i,``),n=n.replace(/^\*\*[a-z]+(\([^)]+\))?:\*\*/gi,``),n.trim()}function u(e){let t=/^###\s+(Minor Changes|Major Changes|Patch Changes)/m.test(e),n=/^##\s+v?(\d+\.\d+\.\d+)/m.test(e);return t&&n}function d(e,t){for(let n=t+1;n<Math.min(t+10,e.length);n++){let t=e[n].trim().toLowerCase();if(t.startsWith(`### major`))return`major`;if(t.startsWith(`### minor`))return`minor`;if(t.startsWith(`### patch`))return`patch`}return null}function f(e){let t=e.split(`
|
|
7
7
|
`),n=[],r=null,u=``;for(let e=0;e<t.length;e++){let f=t[e].trim(),p=f.match(/^##\s+v?(\d+\.\d+\.\d+)/);if(p){r&&n.push(r);let a=i(p[1]),o=`patch`,s,c=f.match(/\((\d{4}-\d{2}-\d{2})\)/);c&&(s=c[1]);let l=d(t,e);l&&(o=l),r={version:a,type:o,date:s,changes:[]},u=``;continue}let m=f.match(/^###\s+(.+)$/i);if(m){u=m[1].toLowerCase();continue}if(f.startsWith(`- `)&&r){let e=f.slice(2).trim(),t=`other`;u.includes(`feat`)||u.includes(`minor`)?t=`feat`:u.includes(`fix`)||u.includes(`patch`)?t=`fix`:u.includes(`perf`)?t=`perf`:u.includes(`refactor`)?t=`refactor`:u.includes(`docs`)||u.includes(`documentation`)?t=`docs`:u.includes(`chore`)&&(t=`chore`);let n={type:t,message:l(e,t),author:a(e),authorUrl:o(e),commit:s(e),commitUrl:c(e)};r.changes.push(n)}}return r&&n.push(r),n}const p={name:`changesets`,detect:u,parse:f},m={added:`feat`,changed:`refactor`,deprecated:`fix`,removed:`fix`,fixed:`fix`,security:`fix`};function h(e){let t=/^#\s+Changelog/i.test(e),n=/^##\s*\[[\d.]+\]\s*-\s*\d{4}-\d{2}-\d{2}/m.test(e),r=/^###\s+(Added|Changed|Deprecated|Removed|Fixed|Security)$/m.test(e);return t&&n&&r}function g(e){let t=e.split(`
|
|
8
8
|
`),n=[],r=null,u=``;for(let e=0;e<t.length;e++){let d=t[e].trim(),f=d.match(/^##\s*\[(\d+\.\d+\.\d+[^\]]*)\]\s*-\s*(\d{4}-\d{2}-\d{2})/);if(f){r&&n.push(r),r={version:i(f[1]),type:`patch`,date:f[2],changes:[]},u=``;continue}if(d.match(/^##\s*\[Unreleased\]/i)){r&&n.push(r),r={version:`unreleased`,type:`patch`,date:void 0,changes:[]},u=``;continue}let p=d.match(/^###\s+(Added|Changed|Deprecated|Removed|Fixed|Security)$/i);if(p){u=p[1].toLowerCase();continue}if((d.startsWith(`- `)||d.startsWith(`* `))&&r){let e=d.slice(2).trim(),t=m[u]||`other`,n={type:t,message:l(e,t),author:a(e),authorUrl:o(e),commit:s(e),commitUrl:c(e)};r.changes.push(n)}}return r&&n.push(r),n}const _={name:`keep-a-changelog`,detect:h,parse:g},v={features:`feat`,"breaking changes":`feat`,breaking:`feat`,"bug fixes":`fix`,bugfixes:`fix`,fixes:`fix`,performance:`perf`,"build system":`chore`,builds:`chore`,tests:`chore`,chores:`chore`,documentation:`docs`,docs:`docs`,revert:`fix`,reverts:`fix`,refactor:`refactor`,"code refactoring":`refactor`};function y(e){let t=/^###\s+(Features|Bug Fixes|BREAKING CHANGES|Build System|Tests|Chores|Documentation|Reverts)/m.test(e),n=/^\*\*[a-z]+(\([^)]+\))?:\*\*/m.test(e),r=/^##\s*\[[\d.]+\]\([^)]+\)\s*\(\d{4}-\d{2}-\d{2}\)/m.test(e);return t&&(n||r)}function b(e){let t=e.split(`
|
|
9
9
|
`),n=[],r=null,u=``;for(let e=0;e<t.length;e++){let d=t[e].trim(),f=d.match(/^##\s*\[(\d+\.\d+\.\d+[^\]]*)\]\([^)]+\)\s*\((\d{4}-\d{2}-\d{2})\)/);if(f){r&&n.push(r);let a=i(f[1]),o=`patch`;for(let n=e+1;n<Math.min(e+20,t.length);n++){let e=t[n].toLowerCase();if(e.includes(`major`)||e.includes(`breaking`)){o=`major`;break}(e.includes(`minor`)||e.includes(`feat`))&&(o=`minor`)}r={version:a,type:o,date:f[2],changes:[]},u=``;continue}let p=d.match(/^###\s+(.+)$/i);if(p){u=p[1].toLowerCase();continue}if((d.startsWith(`- `)||d.startsWith(`* `))&&r){let e=d.slice(2).trim(),t=v[u]||`other`,n={type:t,message:l(e,t),author:a(e),authorUrl:o(e),commit:s(e),commitUrl:c(e)};r.changes.push(n)}}return r&&n.push(r),n}const x={name:`semantic-release`,detect:y,parse:b},S={features:`feat`,"breaking changes":`feat`,breaking:`feat`,"bug fixes":`fix`,fixes:`fix`,performance:`perf`,"build system":`chore`,builds:`chore`,tests:`chore`,chores:`chore`,documentation:`docs`,docs:`docs`,revert:`fix`,reverts:`fix`,refactor:`refactor`,"code refactoring":`refactor`};function C(e){let t=/^##\s+(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)/m.test(e),n=/^###\s+(Features|Bug Fixes|BREAKING CHANGES|Build System|Tests|Chores|Documentation)/m.test(e),r=/^[*-]\s+/m.test(e);return t&&n&&r}function w(e){let t=e.split(`
|
|
10
|
-
`),n=[],r=null,u=``;for(let e=0;e<t.length;e++){let d=t[e].trim(),f=d.match(/^##\s+(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)/);if(f){r&&n.push(r);let a=i(f[1]),o=`patch`;for(let n=e+1;n<Math.min(e+20,t.length);n++){let e=t[n].toLowerCase();if(e.includes(`major`)||e.includes(`breaking`)){o=`major`;break}(e.includes(`minor`)||e.includes(`feat`))&&(o=`minor`)}r={version:a,type:o,date:f[2],changes:[]},u=``;continue}let p=d.match(/^###\s+(.+)$/i);if(p){u=p[1].toLowerCase();continue}if((d.startsWith(`- `)||d.startsWith(`* `))&&r){let e=d.slice(2).trim(),t=S[u]||`other`,n={type:t,message:l(e,t),author:a(e),authorUrl:o(e),commit:s(e),commitUrl:c(e)};r.changes.push(n)}}return r&&n.push(r),n}const T=[_,x,{name:`standard-version`,detect:C,parse:w},p];function E(e){for(let t of T)if(t.detect(e))return{parser:t,name:t.name};return{parser:p,name:`changesets (fallback)`}}function D(e){let{parser:t}=E(e);return t?.parse(e)||[]}function O(e){return D(e)}function k(e){let r=t.default.resolve(e);if(!n.default.existsSync(r))throw Error(`Changelog file not found: ${r}`);return n.default.readFileSync(r,`utf-8`)}const A={feat:`Feature`,fix:`Bug Fix`,perf:`Performance`,refactor:`Refactor`,docs:`Documentation`,chore:`Chore`,other:`Other`};async function j(e,i={}){let a=t.default.resolve(i.output||`docs/changelog`),o=i.title||`Changelog`,s=i.inferTab!==!1,c=i.limit?Math.max(1,i.limit):void 0;(0,r.info)(`📄 Reading changelog from: ${e}`);let l=O(k(e));if(l.length===0){(0,r.warn)(`⚠️ No versions found in changelog`);return}let u=c?l.slice(0,c):l;n.default.existsSync(a)||(n.default.mkdirSync(a,{recursive:!0}),(0,r.info)(`📁 Created directory: ${a}`));for(let[e,i]of u.entries()){let c=M(i,o,s),l=`${e+1}.v${i.version}.md`,u=t.default.join(a,l);n.default.writeFileSync(u,c,`utf-8`),(0,r.success)(`Generated: ${l}`)}let d=[` ✨ Generated ${c&&c<l.length?`${c} of ${l.length} versions`:`${l.length} versions`} changelog pages in ${a}`,``,` 📝 Add this to your navbar in boltdocs.config.ts:`,` { label: '${o}', href: '/changelog' }`];console.log(`\n${(0,r.double)(
|
|
10
|
+
`),n=[],r=null,u=``;for(let e=0;e<t.length;e++){let d=t[e].trim(),f=d.match(/^##\s+(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)/);if(f){r&&n.push(r);let a=i(f[1]),o=`patch`;for(let n=e+1;n<Math.min(e+20,t.length);n++){let e=t[n].toLowerCase();if(e.includes(`major`)||e.includes(`breaking`)){o=`major`;break}(e.includes(`minor`)||e.includes(`feat`))&&(o=`minor`)}r={version:a,type:o,date:f[2],changes:[]},u=``;continue}let p=d.match(/^###\s+(.+)$/i);if(p){u=p[1].toLowerCase();continue}if((d.startsWith(`- `)||d.startsWith(`* `))&&r){let e=d.slice(2).trim(),t=S[u]||`other`,n={type:t,message:l(e,t),author:a(e),authorUrl:o(e),commit:s(e),commitUrl:c(e)};r.changes.push(n)}}return r&&n.push(r),n}const T=[_,x,{name:`standard-version`,detect:C,parse:w},p];function E(e){for(let t of T)if(t.detect(e))return{parser:t,name:t.name};return{parser:p,name:`changesets (fallback)`}}function D(e){let{parser:t}=E(e);return t?.parse(e)||[]}function O(e){return D(e)}function k(e){let r=t.default.resolve(e);if(!n.default.existsSync(r))throw Error(`Changelog file not found: ${r}`);return n.default.readFileSync(r,`utf-8`)}const A={feat:`Feature`,fix:`Bug Fix`,perf:`Performance`,refactor:`Refactor`,docs:`Documentation`,chore:`Chore`,other:`Other`};async function j(e,i={}){let a=t.default.resolve(i.output||`docs/changelog`),o=i.title||`Changelog`,s=i.inferTab!==!1,c=i.limit?Math.max(1,i.limit):void 0;(0,r.info)(`📄 Reading changelog from: ${e}`);let l=O(k(e));if(l.length===0){(0,r.warn)(`⚠️ No versions found in changelog`);return}let u=c?l.slice(0,c):l;n.default.existsSync(a)||(n.default.mkdirSync(a,{recursive:!0}),(0,r.info)(`📁 Created directory: ${a}`));for(let[e,i]of u.entries()){let c=M(i,o,s),l=`${e+1}.v${i.version}.md`,u=t.default.join(a,l);n.default.writeFileSync(u,c,`utf-8`),(0,r.success)(`Generated: ${l}`)}let d=[` ✨ Generated ${c&&c<l.length?`${c} of ${l.length} versions`:`${l.length} versions`} changelog pages in ${a}`,``,` 📝 Add this to your navbar in boltdocs.config.ts:`,` { label: '${o}', href: '/changelog' }`];console.log(`\n${(0,r.double)(d,{title:`Changelog Generation`})}\n`)}function M(e,t,n){let r=e.type.charAt(0).toUpperCase()+e.type.slice(1),i=N(e.changes),a=`---
|
|
11
11
|
title: v${e.version}
|
|
12
12
|
badge: "${r}"
|
|
13
13
|
description: Changelog version ${e.version}${e.date?` (${e.date})`:``}
|
|
@@ -7,7 +7,7 @@ import e from"node:path";import t from"node:fs";import{double as n,info as r,suc
|
|
|
7
7
|
`),n=[],r=null,i=``;for(let e=0;e<t.length;e++){let a=t[e].trim(),f=a.match(/^##\s+v?(\d+\.\d+\.\d+)/);if(f){r&&n.push(r);let s=o(f[1]),c=`patch`,l,u=a.match(/\((\d{4}-\d{2}-\d{2})\)/);u&&(l=u[1]);let d=p(t,e);d&&(c=d),r={version:s,type:c,date:l,changes:[]},i=``;continue}let m=a.match(/^###\s+(.+)$/i);if(m){i=m[1].toLowerCase();continue}if(a.startsWith(`- `)&&r){let e=a.slice(2).trim(),t=`other`;i.includes(`feat`)||i.includes(`minor`)?t=`feat`:i.includes(`fix`)||i.includes(`patch`)?t=`fix`:i.includes(`perf`)?t=`perf`:i.includes(`refactor`)?t=`refactor`:i.includes(`docs`)||i.includes(`documentation`)?t=`docs`:i.includes(`chore`)&&(t=`chore`);let n={type:t,message:d(e,t),author:s(e),authorUrl:c(e),commit:l(e),commitUrl:u(e)};r.changes.push(n)}}return r&&n.push(r),n}const h={name:`changesets`,detect:f,parse:m},g={added:`feat`,changed:`refactor`,deprecated:`fix`,removed:`fix`,fixed:`fix`,security:`fix`};function _(e){let t=/^#\s+Changelog/i.test(e),n=/^##\s*\[[\d.]+\]\s*-\s*\d{4}-\d{2}-\d{2}/m.test(e),r=/^###\s+(Added|Changed|Deprecated|Removed|Fixed|Security)$/m.test(e);return t&&n&&r}function v(e){let t=e.split(`
|
|
8
8
|
`),n=[],r=null,i=``;for(let e=0;e<t.length;e++){let a=t[e].trim(),f=a.match(/^##\s*\[(\d+\.\d+\.\d+[^\]]*)\]\s*-\s*(\d{4}-\d{2}-\d{2})/);if(f){r&&n.push(r),r={version:o(f[1]),type:`patch`,date:f[2],changes:[]},i=``;continue}if(a.match(/^##\s*\[Unreleased\]/i)){r&&n.push(r),r={version:`unreleased`,type:`patch`,date:void 0,changes:[]},i=``;continue}let p=a.match(/^###\s+(Added|Changed|Deprecated|Removed|Fixed|Security)$/i);if(p){i=p[1].toLowerCase();continue}if((a.startsWith(`- `)||a.startsWith(`* `))&&r){let e=a.slice(2).trim(),t=g[i]||`other`,n={type:t,message:d(e,t),author:s(e),authorUrl:c(e),commit:l(e),commitUrl:u(e)};r.changes.push(n)}}return r&&n.push(r),n}const y={name:`keep-a-changelog`,detect:_,parse:v},b={features:`feat`,"breaking changes":`feat`,breaking:`feat`,"bug fixes":`fix`,bugfixes:`fix`,fixes:`fix`,performance:`perf`,"build system":`chore`,builds:`chore`,tests:`chore`,chores:`chore`,documentation:`docs`,docs:`docs`,revert:`fix`,reverts:`fix`,refactor:`refactor`,"code refactoring":`refactor`};function x(e){let t=/^###\s+(Features|Bug Fixes|BREAKING CHANGES|Build System|Tests|Chores|Documentation|Reverts)/m.test(e),n=/^\*\*[a-z]+(\([^)]+\))?:\*\*/m.test(e),r=/^##\s*\[[\d.]+\]\([^)]+\)\s*\(\d{4}-\d{2}-\d{2}\)/m.test(e);return t&&(n||r)}function S(e){let t=e.split(`
|
|
9
9
|
`),n=[],r=null,i=``;for(let e=0;e<t.length;e++){let a=t[e].trim(),f=a.match(/^##\s*\[(\d+\.\d+\.\d+[^\]]*)\]\([^)]+\)\s*\((\d{4}-\d{2}-\d{2})\)/);if(f){r&&n.push(r);let a=o(f[1]),s=`patch`;for(let n=e+1;n<Math.min(e+20,t.length);n++){let e=t[n].toLowerCase();if(e.includes(`major`)||e.includes(`breaking`)){s=`major`;break}(e.includes(`minor`)||e.includes(`feat`))&&(s=`minor`)}r={version:a,type:s,date:f[2],changes:[]},i=``;continue}let p=a.match(/^###\s+(.+)$/i);if(p){i=p[1].toLowerCase();continue}if((a.startsWith(`- `)||a.startsWith(`* `))&&r){let e=a.slice(2).trim(),t=b[i]||`other`,n={type:t,message:d(e,t),author:s(e),authorUrl:c(e),commit:l(e),commitUrl:u(e)};r.changes.push(n)}}return r&&n.push(r),n}const C={name:`semantic-release`,detect:x,parse:S},w={features:`feat`,"breaking changes":`feat`,breaking:`feat`,"bug fixes":`fix`,fixes:`fix`,performance:`perf`,"build system":`chore`,builds:`chore`,tests:`chore`,chores:`chore`,documentation:`docs`,docs:`docs`,revert:`fix`,reverts:`fix`,refactor:`refactor`,"code refactoring":`refactor`};function T(e){let t=/^##\s+(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)/m.test(e),n=/^###\s+(Features|Bug Fixes|BREAKING CHANGES|Build System|Tests|Chores|Documentation)/m.test(e),r=/^[*-]\s+/m.test(e);return t&&n&&r}function E(e){let t=e.split(`
|
|
10
|
-
`),n=[],r=null,i=``;for(let e=0;e<t.length;e++){let a=t[e].trim(),f=a.match(/^##\s+(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)/);if(f){r&&n.push(r);let a=o(f[1]),s=`patch`;for(let n=e+1;n<Math.min(e+20,t.length);n++){let e=t[n].toLowerCase();if(e.includes(`major`)||e.includes(`breaking`)){s=`major`;break}(e.includes(`minor`)||e.includes(`feat`))&&(s=`minor`)}r={version:a,type:s,date:f[2],changes:[]},i=``;continue}let p=a.match(/^###\s+(.+)$/i);if(p){i=p[1].toLowerCase();continue}if((a.startsWith(`- `)||a.startsWith(`* `))&&r){let e=a.slice(2).trim(),t=w[i]||`other`,n={type:t,message:d(e,t),author:s(e),authorUrl:c(e),commit:l(e),commitUrl:u(e)};r.changes.push(n)}}return r&&n.push(r),n}const D=[y,C,{name:`standard-version`,detect:T,parse:E},h];function O(e){for(let t of D)if(t.detect(e))return{parser:t,name:t.name};return{parser:h,name:`changesets (fallback)`}}function k(e){let{parser:t}=O(e);return t?.parse(e)||[]}function A(e){return k(e)}function j(n){let r=e.resolve(n);if(!t.existsSync(r))throw Error(`Changelog file not found: ${r}`);return t.readFileSync(r,`utf-8`)}const M={feat:`Feature`,fix:`Bug Fix`,perf:`Performance`,refactor:`Refactor`,docs:`Documentation`,chore:`Chore`,other:`Other`};async function N(o,s={}){let c=e.resolve(s.output||`docs/changelog`),l=s.title||`Changelog`,u=s.inferTab!==!1,d=s.limit?Math.max(1,s.limit):void 0;r(`📄 Reading changelog from: ${o}`);let f=A(j(o));if(f.length===0){a(`⚠️ No versions found in changelog`);return}let p=d?f.slice(0,d):f;t.existsSync(c)||(t.mkdirSync(c,{recursive:!0}),r(`📁 Created directory: ${c}`));for(let[n,r]of p.entries()){let a=P(r,l,u),o=`${n+1}.v${r.version}.md`,s=e.join(c,o);t.writeFileSync(s,a,`utf-8`),i(`Generated: ${o}`)}let m=[` ✨ Generated ${d&&d<f.length?`${d} of ${f.length} versions`:`${f.length} versions`} changelog pages in ${c}`,``,` 📝 Add this to your navbar in boltdocs.config.ts:`,` { label: '${l}', href: '/changelog' }`];console.log(`\n${n(
|
|
10
|
+
`),n=[],r=null,i=``;for(let e=0;e<t.length;e++){let a=t[e].trim(),f=a.match(/^##\s+(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)/);if(f){r&&n.push(r);let a=o(f[1]),s=`patch`;for(let n=e+1;n<Math.min(e+20,t.length);n++){let e=t[n].toLowerCase();if(e.includes(`major`)||e.includes(`breaking`)){s=`major`;break}(e.includes(`minor`)||e.includes(`feat`))&&(s=`minor`)}r={version:a,type:s,date:f[2],changes:[]},i=``;continue}let p=a.match(/^###\s+(.+)$/i);if(p){i=p[1].toLowerCase();continue}if((a.startsWith(`- `)||a.startsWith(`* `))&&r){let e=a.slice(2).trim(),t=w[i]||`other`,n={type:t,message:d(e,t),author:s(e),authorUrl:c(e),commit:l(e),commitUrl:u(e)};r.changes.push(n)}}return r&&n.push(r),n}const D=[y,C,{name:`standard-version`,detect:T,parse:E},h];function O(e){for(let t of D)if(t.detect(e))return{parser:t,name:t.name};return{parser:h,name:`changesets (fallback)`}}function k(e){let{parser:t}=O(e);return t?.parse(e)||[]}function A(e){return k(e)}function j(n){let r=e.resolve(n);if(!t.existsSync(r))throw Error(`Changelog file not found: ${r}`);return t.readFileSync(r,`utf-8`)}const M={feat:`Feature`,fix:`Bug Fix`,perf:`Performance`,refactor:`Refactor`,docs:`Documentation`,chore:`Chore`,other:`Other`};async function N(o,s={}){let c=e.resolve(s.output||`docs/changelog`),l=s.title||`Changelog`,u=s.inferTab!==!1,d=s.limit?Math.max(1,s.limit):void 0;r(`📄 Reading changelog from: ${o}`);let f=A(j(o));if(f.length===0){a(`⚠️ No versions found in changelog`);return}let p=d?f.slice(0,d):f;t.existsSync(c)||(t.mkdirSync(c,{recursive:!0}),r(`📁 Created directory: ${c}`));for(let[n,r]of p.entries()){let a=P(r,l,u),o=`${n+1}.v${r.version}.md`,s=e.join(c,o);t.writeFileSync(s,a,`utf-8`),i(`Generated: ${o}`)}let m=[` ✨ Generated ${d&&d<f.length?`${d} of ${f.length} versions`:`${f.length} versions`} changelog pages in ${c}`,``,` 📝 Add this to your navbar in boltdocs.config.ts:`,` { label: '${l}', href: '/changelog' }`];console.log(`\n${n(m,{title:`Changelog Generation`})}\n`)}function P(e,t,n){let r=e.type.charAt(0).toUpperCase()+e.type.slice(1),i=F(e.changes),a=`---
|
|
11
11
|
title: v${e.version}
|
|
12
12
|
badge: "${r}"
|
|
13
13
|
description: Changelog version ${e.version}${e.date?` (${e.date})`:``}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import*as e from"zod";import t from"node:crypto";function n(e,n){let r={alg:`RS256`,typ:`JWT`},i=Math.floor(Date.now()/1e3),a={iat:i-60,exp:i+600,iss:e},o=e=>Buffer.from(JSON.stringify(e)).toString(`base64url`),s=o(r),c=o(a),l=t.createSign(`RSA-SHA256`);l.update(`${s}.${c}`);let u=n.replace(/\\n/g,`
|
|
7
|
+
`);return`${s}.${c}.${l.sign(u,`base64`)}`}async function r(e,t,r){let i=n(e,t),a=await fetch(`https://api.github.com/app/installations/${r}/access_tokens`,{method:`POST`,headers:{Authorization:`Bearer ${i}`,Accept:`application/vnd.github+json`,"User-Agent":`Boltdocs-Feedback`}});if(!a.ok){let e=await a.text();throw Error(`Failed to get installation access token: ${a.status} ${e}`)}return(await a.json()).token}async function i(e,t,n={}){let r=await fetch(`https://api.github.com/graphql`,{method:`POST`,headers:{Authorization:`bearer ${e}`,"Content-Type":`application/json`,"User-Agent":`Boltdocs-Feedback`},body:JSON.stringify({query:t,variables:n})});if(!r.ok){let e=await r.text();throw Error(`GitHub GraphQL API error: ${r.status} ${e}`)}let i=await r.json();if(i.errors?.length){let e=i.errors.map(e=>e.message).join(`, `);throw Error(`GitHub GraphQL Error: ${e}`)}return i.data}async function a(e,t){let n=t.token;if(!n)if(t.appId&&t.privateKey&&t.installationId)n=await r(t.appId,t.privateKey,t.installationId);else throw Error(`GitHub authentication credentials missing. Provide GITHUB_TOKEN or GITHUB_APP_* variables.`);let{owner:a,repo:o,categorySlug:s=`general`}=t,{rating:c,comment:l,path:u,title:d,blockId:f}=e,p=await i(n,`query GetRepoAndCategory($owner: String!, $name: String!, $categorySlug: String!) {
|
|
8
|
+
repository(owner: $owner, name: $name) {
|
|
9
|
+
id
|
|
10
|
+
discussionCategory(slug: $categorySlug) { id }
|
|
11
|
+
}
|
|
12
|
+
}`,{owner:a,name:o,categorySlug:s});if(!p?.repository)throw Error(`Repository not found: ${a}/${o}`);let m=p.repository.id,h=p.repository.discussionCategory?.id;if(!h)throw Error(`Discussion category slug "${s}" not found in ${a}/${o}`);let g=`[Feedback] ${u}`,_=((await i(n,`query FindDiscussion($searchQuery: String!) {
|
|
13
|
+
search(query: $searchQuery, type: DISCUSSION, first: 10) {
|
|
14
|
+
nodes {
|
|
15
|
+
... on Discussion { id title }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}`,{searchQuery:`repo:${a}/${o} in:title "${g}"`}))?.search?.nodes||[]).find(e=>e.title===g)?.id;if(_||=(await i(n,`mutation CreateDiscussion($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
|
|
19
|
+
createDiscussion(input: {repositoryId: $repositoryId, categoryId: $categoryId, title: $title, body: $body}) {
|
|
20
|
+
discussion { id }
|
|
21
|
+
}
|
|
22
|
+
}`,{repositoryId:m,categoryId:h,title:g,body:`This discussion thread holds feedback comments for page: [${d}](${u}).`}))?.createDiscussion?.discussion?.id,!_)throw Error(`Failed to resolve or create discussion thread.`);let v=[f?`### Code Block Feedback`:`### Page Feedback`,`- **Page:** [${d}](${u})`,`- **Rating:** ${{good:`😊 GOOD`,neutral:`😐 NEUTRAL`,bad:`🙁 BAD`}[c]}`,f?`- **Block:** ${f}`:``,l?`\n**Comment:**\n${l}`:`
|
|
23
|
+
_No comments provided._`];return await i(n,`mutation AddComment($discussionId: ID!, $body: String!) {
|
|
24
|
+
addDiscussionComment(input: {discussionId: $discussionId, body: $body}) {
|
|
25
|
+
comment { id }
|
|
26
|
+
}
|
|
27
|
+
}`,{discussionId:_,body:v.filter(Boolean).join(`
|
|
28
|
+
`)}),{success:!0}}const o=e.object({rating:e.enum([`good`,`neutral`,`bad`]),path:e.string(),title:e.string(),comment:e.string().optional()});async function s(e,t=process.env,n={}){let r=o.safeParse(e);if(!r.success)throw Error(`Invalid feedback payload`);let i=r.data,s=n.owner||t.GITHUB_REPO_OWNER||t.BOLTDOCS_GITHUB_REPO_OWNER,c=n.repo||t.GITHUB_REPO_NAME||t.BOLTDOCS_GITHUB_REPO_NAME,l=n.categorySlug||t.GITHUB_DISCUSSION_CATEGORY||t.BOLTDOCS_GITHUB_DISCUSSION_CATEGORY||`general`,u=n.token||t.BOLTDOCS_GITHUB_TOKEN||t.GITHUB_TOKEN,d=n.appId||t.GITHUB_APP_ID,f=n.privateKey||t.GITHUB_PRIVATE_KEY,p=n.installationId||t.GITHUB_INSTALLATION_ID;if(!s||!c)throw Error(`GitHub repository coordinates (owner and repo name) are missing. Please set GITHUB_REPO_OWNER and GITHUB_REPO_NAME.`);return await a(i,{owner:s,repo:c,categorySlug:l,token:u,appId:d,privateKey:f,installationId:p}),{success:!0}}export{s as t};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
const e=require(`./chunk-Ds5LZdWN.cjs`);let t=require(`zod`);t=e.n(t);let n=require(`node:crypto`);n=e.n(n);function r(e,t){let r={alg:`RS256`,typ:`JWT`},i=Math.floor(Date.now()/1e3),a={iat:i-60,exp:i+600,iss:e},o=e=>Buffer.from(JSON.stringify(e)).toString(`base64url`),s=o(r),c=o(a),l=n.default.createSign(`RSA-SHA256`);l.update(`${s}.${c}`);let u=t.replace(/\\n/g,`
|
|
7
|
+
`);return`${s}.${c}.${l.sign(u,`base64`)}`}async function i(e,t,n){let i=r(e,t),a=await fetch(`https://api.github.com/app/installations/${n}/access_tokens`,{method:`POST`,headers:{Authorization:`Bearer ${i}`,Accept:`application/vnd.github+json`,"User-Agent":`Boltdocs-Feedback`}});if(!a.ok){let e=await a.text();throw Error(`Failed to get installation access token: ${a.status} ${e}`)}return(await a.json()).token}async function a(e,t,n={}){let r=await fetch(`https://api.github.com/graphql`,{method:`POST`,headers:{Authorization:`bearer ${e}`,"Content-Type":`application/json`,"User-Agent":`Boltdocs-Feedback`},body:JSON.stringify({query:t,variables:n})});if(!r.ok){let e=await r.text();throw Error(`GitHub GraphQL API error: ${r.status} ${e}`)}let i=await r.json();if(i.errors?.length){let e=i.errors.map(e=>e.message).join(`, `);throw Error(`GitHub GraphQL Error: ${e}`)}return i.data}async function o(e,t){let n=t.token;if(!n)if(t.appId&&t.privateKey&&t.installationId)n=await i(t.appId,t.privateKey,t.installationId);else throw Error(`GitHub authentication credentials missing. Provide GITHUB_TOKEN or GITHUB_APP_* variables.`);let{owner:r,repo:o,categorySlug:s=`general`}=t,{rating:c,comment:l,path:u,title:d,blockId:f}=e,p=await a(n,`query GetRepoAndCategory($owner: String!, $name: String!, $categorySlug: String!) {
|
|
8
|
+
repository(owner: $owner, name: $name) {
|
|
9
|
+
id
|
|
10
|
+
discussionCategory(slug: $categorySlug) { id }
|
|
11
|
+
}
|
|
12
|
+
}`,{owner:r,name:o,categorySlug:s});if(!p?.repository)throw Error(`Repository not found: ${r}/${o}`);let m=p.repository.id,h=p.repository.discussionCategory?.id;if(!h)throw Error(`Discussion category slug "${s}" not found in ${r}/${o}`);let g=`[Feedback] ${u}`,_=((await a(n,`query FindDiscussion($searchQuery: String!) {
|
|
13
|
+
search(query: $searchQuery, type: DISCUSSION, first: 10) {
|
|
14
|
+
nodes {
|
|
15
|
+
... on Discussion { id title }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}`,{searchQuery:`repo:${r}/${o} in:title "${g}"`}))?.search?.nodes||[]).find(e=>e.title===g)?.id;if(_||=(await a(n,`mutation CreateDiscussion($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
|
|
19
|
+
createDiscussion(input: {repositoryId: $repositoryId, categoryId: $categoryId, title: $title, body: $body}) {
|
|
20
|
+
discussion { id }
|
|
21
|
+
}
|
|
22
|
+
}`,{repositoryId:m,categoryId:h,title:g,body:`This discussion thread holds feedback comments for page: [${d}](${u}).`}))?.createDiscussion?.discussion?.id,!_)throw Error(`Failed to resolve or create discussion thread.`);let v=[f?`### Code Block Feedback`:`### Page Feedback`,`- **Page:** [${d}](${u})`,`- **Rating:** ${{good:`😊 GOOD`,neutral:`😐 NEUTRAL`,bad:`🙁 BAD`}[c]}`,f?`- **Block:** ${f}`:``,l?`\n**Comment:**\n${l}`:`
|
|
23
|
+
_No comments provided._`];return await a(n,`mutation AddComment($discussionId: ID!, $body: String!) {
|
|
24
|
+
addDiscussionComment(input: {discussionId: $discussionId, body: $body}) {
|
|
25
|
+
comment { id }
|
|
26
|
+
}
|
|
27
|
+
}`,{discussionId:_,body:v.filter(Boolean).join(`
|
|
28
|
+
`)}),{success:!0}}var s=e.t({handleFeedback:()=>l});const c=t.object({rating:t.enum([`good`,`neutral`,`bad`]),path:t.string(),title:t.string(),comment:t.string().optional()});async function l(e,t=process.env,n={}){let r=c.safeParse(e);if(!r.success)throw Error(`Invalid feedback payload`);let i=r.data,a=n.owner||t.GITHUB_REPO_OWNER||t.BOLTDOCS_GITHUB_REPO_OWNER,s=n.repo||t.GITHUB_REPO_NAME||t.BOLTDOCS_GITHUB_REPO_NAME,l=n.categorySlug||t.GITHUB_DISCUSSION_CATEGORY||t.BOLTDOCS_GITHUB_DISCUSSION_CATEGORY||`general`,u=n.token||t.BOLTDOCS_GITHUB_TOKEN||t.GITHUB_TOKEN,d=n.appId||t.GITHUB_APP_ID,f=n.privateKey||t.GITHUB_PRIVATE_KEY,p=n.installationId||t.GITHUB_INSTALLATION_ID;if(!a||!s)throw Error(`GitHub repository coordinates (owner and repo name) are missing. Please set GITHUB_REPO_OWNER and GITHUB_REPO_NAME.`);return await o(i,{owner:a,repo:s,categorySlug:l,token:u,appId:d,privateKey:f,installationId:p}),{success:!0}}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -58,7 +58,7 @@ function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" })
|
|
|
58
58
|
const getSavedPrefs = () => {
|
|
59
59
|
if (typeof window === "undefined") return {};
|
|
60
60
|
try {
|
|
61
|
-
const raw = localStorage.getItem(PREFERENCES_KEY);
|
|
61
|
+
const raw = window.localStorage.getItem(PREFERENCES_KEY);
|
|
62
62
|
return raw ? JSON.parse(raw) : {};
|
|
63
63
|
} catch {
|
|
64
64
|
return {};
|
|
@@ -84,7 +84,7 @@ function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" })
|
|
|
84
84
|
setLocaleState(newL);
|
|
85
85
|
if (typeof window !== "undefined") try {
|
|
86
86
|
const prefs = getSavedPrefs();
|
|
87
|
-
localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
|
|
87
|
+
window.localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
|
|
88
88
|
...prefs,
|
|
89
89
|
locale: newL
|
|
90
90
|
}));
|
|
@@ -95,7 +95,7 @@ function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" })
|
|
|
95
95
|
setVersionState(newV);
|
|
96
96
|
if (typeof window !== "undefined") try {
|
|
97
97
|
const prefs = getSavedPrefs();
|
|
98
|
-
localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
|
|
98
|
+
window.localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
|
|
99
99
|
...prefs,
|
|
100
100
|
version: newV
|
|
101
101
|
}));
|
|
@@ -160,6 +160,9 @@ var icons_exports = /* @__PURE__ */ __exportAll({
|
|
|
160
160
|
Copy: () => Copy,
|
|
161
161
|
CornerDownLeft: () => CornerDownLeft,
|
|
162
162
|
ExternalLink: () => ExternalLink,
|
|
163
|
+
FaceBad: () => FaceBad,
|
|
164
|
+
FaceGood: () => FaceGood,
|
|
165
|
+
FaceRegular: () => FaceRegular,
|
|
163
166
|
File: () => File,
|
|
164
167
|
FileText: () => FileText,
|
|
165
168
|
Hash: () => Hash,
|
|
@@ -424,6 +427,71 @@ const FileText = createIcon("FileText", /* @__PURE__ */ (0, react_jsx_runtime.js
|
|
|
424
427
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 17H8" })
|
|
425
428
|
] }));
|
|
426
429
|
const CornerDownLeft = createIcon("CornerDownLeft", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", { points: "9 10 4 15 9 20" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" })] }));
|
|
430
|
+
const FaceGood = createIcon("FaceGood", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
431
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
432
|
+
cx: "12",
|
|
433
|
+
cy: "12",
|
|
434
|
+
r: "10"
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 14s1.5 2 4 2 4-2 4-2" }),
|
|
437
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
438
|
+
x1: "9",
|
|
439
|
+
y1: "9",
|
|
440
|
+
x2: "9.01",
|
|
441
|
+
y2: "9"
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
444
|
+
x1: "15",
|
|
445
|
+
y1: "9",
|
|
446
|
+
x2: "15.01",
|
|
447
|
+
y2: "9"
|
|
448
|
+
})
|
|
449
|
+
] }));
|
|
450
|
+
const FaceRegular = createIcon("FaceRegular", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
451
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
452
|
+
cx: "12",
|
|
453
|
+
cy: "12",
|
|
454
|
+
r: "10"
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
457
|
+
x1: "8",
|
|
458
|
+
y1: "15",
|
|
459
|
+
x2: "16",
|
|
460
|
+
y2: "15"
|
|
461
|
+
}),
|
|
462
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
463
|
+
x1: "9",
|
|
464
|
+
y1: "9",
|
|
465
|
+
x2: "9.01",
|
|
466
|
+
y2: "9"
|
|
467
|
+
}),
|
|
468
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
469
|
+
x1: "15",
|
|
470
|
+
y1: "9",
|
|
471
|
+
x2: "15.01",
|
|
472
|
+
y2: "9"
|
|
473
|
+
})
|
|
474
|
+
] }));
|
|
475
|
+
const FaceBad = createIcon("FaceBad", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
476
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
477
|
+
cx: "12",
|
|
478
|
+
cy: "12",
|
|
479
|
+
r: "10"
|
|
480
|
+
}),
|
|
481
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 16s-1.5-2-4-2-4 2-4 2" }),
|
|
482
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
483
|
+
x1: "9",
|
|
484
|
+
y1: "9",
|
|
485
|
+
x2: "9.01",
|
|
486
|
+
y2: "9"
|
|
487
|
+
}),
|
|
488
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
489
|
+
x1: "15",
|
|
490
|
+
y1: "9",
|
|
491
|
+
x2: "15.01",
|
|
492
|
+
y2: "9"
|
|
493
|
+
})
|
|
494
|
+
] }));
|
|
427
495
|
|
|
428
496
|
//#endregion
|
|
429
497
|
//#region src/client/app/routes-context.tsx
|
|
@@ -467,7 +535,7 @@ function useRoutes() {
|
|
|
467
535
|
const { routes: allRoutes } = useRoutesContext();
|
|
468
536
|
const config = useConfig();
|
|
469
537
|
const location = (0, react_router_dom.useLocation)();
|
|
470
|
-
const {
|
|
538
|
+
const { currentLocale: currentLocaleStore, currentVersion: currentVersionStore } = useBoltdocsContext();
|
|
471
539
|
const currentPath = normalizePath(location.pathname);
|
|
472
540
|
const currentRoute = allRoutes?.find?.((r) => normalizePath(r.path) === currentPath);
|
|
473
541
|
const currentLocale = config.i18n ? currentLocaleStore || config.i18n.defaultLocale : void 0;
|
|
@@ -982,6 +1050,24 @@ Object.defineProperty(exports, 'ExternalLink', {
|
|
|
982
1050
|
return ExternalLink;
|
|
983
1051
|
}
|
|
984
1052
|
});
|
|
1053
|
+
Object.defineProperty(exports, 'FaceBad', {
|
|
1054
|
+
enumerable: true,
|
|
1055
|
+
get: function () {
|
|
1056
|
+
return FaceBad;
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
Object.defineProperty(exports, 'FaceGood', {
|
|
1060
|
+
enumerable: true,
|
|
1061
|
+
get: function () {
|
|
1062
|
+
return FaceGood;
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
Object.defineProperty(exports, 'FaceRegular', {
|
|
1066
|
+
enumerable: true,
|
|
1067
|
+
get: function () {
|
|
1068
|
+
return FaceRegular;
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
985
1071
|
Object.defineProperty(exports, 'File', {
|
|
986
1072
|
enumerable: true,
|
|
987
1073
|
get: function () {
|
|
@@ -35,7 +35,7 @@ function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" })
|
|
|
35
35
|
const getSavedPrefs = () => {
|
|
36
36
|
if (typeof window === "undefined") return {};
|
|
37
37
|
try {
|
|
38
|
-
const raw = localStorage.getItem(PREFERENCES_KEY);
|
|
38
|
+
const raw = window.localStorage.getItem(PREFERENCES_KEY);
|
|
39
39
|
return raw ? JSON.parse(raw) : {};
|
|
40
40
|
} catch {
|
|
41
41
|
return {};
|
|
@@ -61,7 +61,7 @@ function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" })
|
|
|
61
61
|
setLocaleState(newL);
|
|
62
62
|
if (typeof window !== "undefined") try {
|
|
63
63
|
const prefs = getSavedPrefs();
|
|
64
|
-
localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
|
|
64
|
+
window.localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
|
|
65
65
|
...prefs,
|
|
66
66
|
locale: newL
|
|
67
67
|
}));
|
|
@@ -72,7 +72,7 @@ function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" })
|
|
|
72
72
|
setVersionState(newV);
|
|
73
73
|
if (typeof window !== "undefined") try {
|
|
74
74
|
const prefs = getSavedPrefs();
|
|
75
|
-
localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
|
|
75
|
+
window.localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
|
|
76
76
|
...prefs,
|
|
77
77
|
version: newV
|
|
78
78
|
}));
|
|
@@ -137,6 +137,9 @@ var icons_exports = /* @__PURE__ */ __exportAll({
|
|
|
137
137
|
Copy: () => Copy,
|
|
138
138
|
CornerDownLeft: () => CornerDownLeft,
|
|
139
139
|
ExternalLink: () => ExternalLink,
|
|
140
|
+
FaceBad: () => FaceBad,
|
|
141
|
+
FaceGood: () => FaceGood,
|
|
142
|
+
FaceRegular: () => FaceRegular,
|
|
140
143
|
File: () => File,
|
|
141
144
|
FileText: () => FileText,
|
|
142
145
|
Hash: () => Hash,
|
|
@@ -401,6 +404,71 @@ const FileText = createIcon("FileText", /* @__PURE__ */ jsxs(Fragment, { childre
|
|
|
401
404
|
/* @__PURE__ */ jsx("path", { d: "M16 17H8" })
|
|
402
405
|
] }));
|
|
403
406
|
const CornerDownLeft = createIcon("CornerDownLeft", /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("polyline", { points: "9 10 4 15 9 20" }), /* @__PURE__ */ jsx("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" })] }));
|
|
407
|
+
const FaceGood = createIcon("FaceGood", /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
408
|
+
/* @__PURE__ */ jsx("circle", {
|
|
409
|
+
cx: "12",
|
|
410
|
+
cy: "12",
|
|
411
|
+
r: "10"
|
|
412
|
+
}),
|
|
413
|
+
/* @__PURE__ */ jsx("path", { d: "M8 14s1.5 2 4 2 4-2 4-2" }),
|
|
414
|
+
/* @__PURE__ */ jsx("line", {
|
|
415
|
+
x1: "9",
|
|
416
|
+
y1: "9",
|
|
417
|
+
x2: "9.01",
|
|
418
|
+
y2: "9"
|
|
419
|
+
}),
|
|
420
|
+
/* @__PURE__ */ jsx("line", {
|
|
421
|
+
x1: "15",
|
|
422
|
+
y1: "9",
|
|
423
|
+
x2: "15.01",
|
|
424
|
+
y2: "9"
|
|
425
|
+
})
|
|
426
|
+
] }));
|
|
427
|
+
const FaceRegular = createIcon("FaceRegular", /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
428
|
+
/* @__PURE__ */ jsx("circle", {
|
|
429
|
+
cx: "12",
|
|
430
|
+
cy: "12",
|
|
431
|
+
r: "10"
|
|
432
|
+
}),
|
|
433
|
+
/* @__PURE__ */ jsx("line", {
|
|
434
|
+
x1: "8",
|
|
435
|
+
y1: "15",
|
|
436
|
+
x2: "16",
|
|
437
|
+
y2: "15"
|
|
438
|
+
}),
|
|
439
|
+
/* @__PURE__ */ jsx("line", {
|
|
440
|
+
x1: "9",
|
|
441
|
+
y1: "9",
|
|
442
|
+
x2: "9.01",
|
|
443
|
+
y2: "9"
|
|
444
|
+
}),
|
|
445
|
+
/* @__PURE__ */ jsx("line", {
|
|
446
|
+
x1: "15",
|
|
447
|
+
y1: "9",
|
|
448
|
+
x2: "15.01",
|
|
449
|
+
y2: "9"
|
|
450
|
+
})
|
|
451
|
+
] }));
|
|
452
|
+
const FaceBad = createIcon("FaceBad", /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
453
|
+
/* @__PURE__ */ jsx("circle", {
|
|
454
|
+
cx: "12",
|
|
455
|
+
cy: "12",
|
|
456
|
+
r: "10"
|
|
457
|
+
}),
|
|
458
|
+
/* @__PURE__ */ jsx("path", { d: "M16 16s-1.5-2-4-2-4 2-4 2" }),
|
|
459
|
+
/* @__PURE__ */ jsx("line", {
|
|
460
|
+
x1: "9",
|
|
461
|
+
y1: "9",
|
|
462
|
+
x2: "9.01",
|
|
463
|
+
y2: "9"
|
|
464
|
+
}),
|
|
465
|
+
/* @__PURE__ */ jsx("line", {
|
|
466
|
+
x1: "15",
|
|
467
|
+
y1: "9",
|
|
468
|
+
x2: "15.01",
|
|
469
|
+
y2: "9"
|
|
470
|
+
})
|
|
471
|
+
] }));
|
|
404
472
|
|
|
405
473
|
//#endregion
|
|
406
474
|
//#region src/client/app/routes-context.tsx
|
|
@@ -444,7 +512,7 @@ function useRoutes() {
|
|
|
444
512
|
const { routes: allRoutes } = useRoutesContext();
|
|
445
513
|
const config = useConfig();
|
|
446
514
|
const location = useLocation();
|
|
447
|
-
const {
|
|
515
|
+
const { currentLocale: currentLocaleStore, currentVersion: currentVersionStore } = useBoltdocsContext();
|
|
448
516
|
const currentPath = normalizePath(location.pathname);
|
|
449
517
|
const currentRoute = allRoutes?.find?.((r) => normalizePath(r.path) === currentPath);
|
|
450
518
|
const currentLocale = config.i18n ? currentLocaleStore || config.i18n.defaultLocale : void 0;
|
|
@@ -845,4 +913,4 @@ const BracketsRed = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
845
913
|
});
|
|
846
914
|
|
|
847
915
|
//#endregion
|
|
848
|
-
export {
|
|
916
|
+
export { TextAlignStart as $, ChevronRight as A, Hash as B, RoutesProvider as C, Check as D, ArrowLeft as E, FaceBad as F, Link$2 as G, Info as H, FaceGood as I, Moon as J, Menu as K, FaceRegular as L, Copy as M, CornerDownLeft as N, ChevronDown as O, ExternalLink as P, Sun as Q, File as R, normalizePath as S, AlertTriangle as T, Languages as U, Home as V, Lightbulb as W, Pencil as X, MoreVertical as Y, Search as Z, Link$1 as _, Csv as a, useBoltdocsContext as at, useLocalizedTo as b, JavaScript as c, React$1 as d, X as et, Rust as f, Yaml as g, XSocial as h, Css as i, BoltdocsProvider as it, CircleHelp as j, ChevronLeft as k, Json as l, TypeScript as m, BracketsOrange as n, ConfigContext as nt, Discord as o, Shell as p, Monitor as q, BracketsRed as r, useConfig as rt, Github as s, Bluesky as t, icons_exports as tt, Markdown as u, NavLink as v, AlertCircle as w, useRoutes as x, cn as y, FileText as z };
|