boltdocs 2.9.3 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/bin/boltdocs.js +2 -1
  2. package/dist/{adapters-uGz-UKQa.cjs → adapters-C5AWWGfb.cjs} +1 -1
  3. package/dist/{adapters-HVuXENAe.mjs → adapters-DEXNIv3x.mjs} +1 -1
  4. package/dist/{banner-D2NddBfF.d.ts → banner-CfdalYLL.d.ts} +1 -1
  5. package/dist/{banner-C_xkGxzI.d.cts → banner-DNSkgUsO.d.cts} +1 -1
  6. package/dist/{cache-B19MLTpN.cjs → cache-DETwlACe.cjs} +1 -1
  7. package/dist/{cache-CfhOTR3Q.mjs → cache-SF59enb3.mjs} +1 -1
  8. package/dist/client/index.cjs +126 -24
  9. package/dist/client/index.d.cts +4 -3
  10. package/dist/client/index.d.ts +4 -3
  11. package/dist/client/index.js +125 -24
  12. package/dist/client/mdx.cjs +1 -1
  13. package/dist/client/mdx.js +1 -1
  14. package/dist/client/primitives.cjs +2 -2
  15. package/dist/client/primitives.d.cts +10 -8
  16. package/dist/client/primitives.d.ts +10 -8
  17. package/dist/client/primitives.js +2 -2
  18. package/dist/config-B5uVv5q4.cjs +7 -0
  19. package/dist/config-D3_zDkHh.mjs +7 -0
  20. package/dist/{config-CnmfjOE4.cjs → config-JGkMJoJQ.cjs} +1 -1
  21. package/dist/csp-gaZ51xzq.mjs +6 -0
  22. package/dist/doctor-3MheVMwd.mjs +7 -0
  23. package/dist/{parser-CHsNUEhU.cjs → doctor-BR1B2Mkz.cjs} +1 -1
  24. package/dist/doctor-DQxLM202.cjs +7 -0
  25. package/dist/handler-Btd4t_67.mjs +28 -0
  26. package/dist/{headers-DuCAOgYX.cjs → headers-BXKxiPUv.cjs} +1 -1
  27. package/dist/headers-CXyf0auY.mjs +6 -0
  28. package/dist/{image-BCDyLHyD.js → image-C9md50h2.js} +14 -6
  29. package/dist/{image-DWdmichO.cjs → image-CR6UlaI5.cjs} +14 -6
  30. package/dist/{mdx-9QJoSITt.cjs → mdx-DJBg5DuL.cjs} +10 -23
  31. package/dist/{mdx-DFbspTP9.js → mdx-DhyMkc35.js} +10 -23
  32. package/dist/node/cli-entry.cjs +3 -3
  33. package/dist/node/cli-entry.mjs +3 -3
  34. package/dist/node/index.cjs +1 -1
  35. package/dist/node/index.d.cts +40 -19
  36. package/dist/node/index.d.mts +41 -20
  37. package/dist/node/index.mjs +1 -1
  38. package/dist/node-Ct4PB0S_.mjs +105 -0
  39. package/dist/node-joF9IMNr.cjs +105 -0
  40. package/dist/{package-Di7alQGe.mjs → package-BovY3RQH.mjs} +1 -1
  41. package/dist/{package-BlYktJR3.cjs → package-DnyxhwD-.cjs} +1 -1
  42. package/dist/pages-external-BYa4JSda.mjs +6 -0
  43. package/dist/pages-external-CX2uyW95.cjs +6 -0
  44. package/dist/parser-CNIPHx4s.cjs +8 -0
  45. package/dist/parser-D0QHIQsi.mjs +8 -0
  46. package/dist/plugin-DeOYQvry.cjs +68 -0
  47. package/dist/plugin-IBKz7CRF.mjs +68 -0
  48. package/dist/rolldown-runtime-fkIsjY3S.mjs +6 -0
  49. package/dist/routes-BajCwrvX.cjs +6 -0
  50. package/dist/routes-CyrnmVuG.mjs +6 -0
  51. package/dist/routes-D6Tuu7Fs.cjs +6 -0
  52. package/dist/{search-dialog-DRNJsxOv.js → search-dialog-CQneRo8T.js} +1 -1
  53. package/dist/{search-dialog-BsAiQgnx.cjs → search-dialog-CwNh8lIN.cjs} +27 -30
  54. package/dist/{search-dialog-BhXg05Ri.cjs → search-dialog-D4rplZMv.cjs} +1 -0
  55. package/dist/{search-dialog-DaR66wl0.js → search-dialog-DaeSPvEo.js} +1 -0
  56. package/dist/{search-dialog-CaOO1Q4i.js → search-dialog-DoGobmuG.js} +28 -31
  57. package/dist/{search-dialog-CzwvKoLW.cjs → search-dialog-cHJoKjts.cjs} +1 -1
  58. package/dist/server/index.cjs +1 -1
  59. package/dist/server/index.d.mts +1 -1
  60. package/dist/server/index.mjs +1 -1
  61. package/dist/{shiki-adapter-BB71nVsG.cjs → shiki-adapter-CGTmrR6S.cjs} +1 -1
  62. package/dist/shiki-adapter-CXEGRnjr.mjs +6 -0
  63. package/dist/{doctor-BL6c8x2Q.cjs → shiki-adapter-Mr8_oT_9.cjs} +1 -1
  64. package/dist/{sidebar-BtJyWHy4.d.cts → sidebar-7gIifpBX.d.cts} +21 -4
  65. package/dist/{sidebar-C4fuRYYS.d.ts → sidebar-BAKgJ-Er.d.ts} +21 -4
  66. package/dist/types-generator-DVOnRVKU.mjs +26 -0
  67. package/dist/{utils-DexBrwiP.mjs → utils-B3xYMrpK.mjs} +1 -1
  68. package/dist/{utils-BWy_8ASj.cjs → utils-Bz1tG9Dg.cjs} +1 -1
  69. package/package.json +3 -2
  70. package/src/shared/types.ts +22 -3
  71. package/dist/config-BCqkPkjC.mjs +0 -7
  72. package/dist/config-BPWGa2W3.mjs +0 -6
  73. package/dist/config-D7ERJhqe.cjs +0 -7
  74. package/dist/csp-DtM6q2gZ.mjs +0 -6
  75. package/dist/doctor-A17UhTRn.cjs +0 -7
  76. package/dist/doctor-Bc-Tx_md.mjs +0 -7
  77. package/dist/handler-CyIBbZdb.mjs +0 -28
  78. package/dist/handler-eNNcucnf.mjs +0 -6
  79. package/dist/headers-DK0Hw7iB.mjs +0 -6
  80. package/dist/node/routes/worker.cjs +0 -6
  81. package/dist/node/routes/worker.d.cts +0 -2
  82. package/dist/node/routes/worker.d.mts +0 -2
  83. package/dist/node/routes/worker.mjs +0 -6
  84. package/dist/node-JQ6C-CBi.mjs +0 -105
  85. package/dist/node-cZgna618.cjs +0 -105
  86. package/dist/parser-CLtGv_XH.cjs +0 -6
  87. package/dist/parser-Ww0eOqs7.mjs +0 -6
  88. package/dist/plugin-BCCYSeId.cjs +0 -61
  89. package/dist/plugin-Bu75gPjx.mjs +0 -61
  90. package/dist/routes-B2joDAlC.cjs +0 -6
  91. package/dist/routes-CyKj3dzf.cjs +0 -6
  92. package/dist/routes-DMBny9t9.mjs +0 -6
  93. package/dist/routes-DZjS8QSV.mjs +0 -6
  94. package/dist/shiki-adapter-CL-IQwKI.cjs +0 -6
  95. package/dist/shiki-adapter-CxTLkjew.mjs +0 -6
  96. package/dist/shiki-adapter-rQ087Lx3.mjs +0 -6
  97. package/dist/types-generator-BRyf4o9F.mjs +0 -26
  98. package/dist/types-generator-Cu2jQP-V.mjs +0 -6
  99. package/dist/worker-pool-CgOMozUz.cjs +0 -6
  100. package/dist/worker-pool-v6tW2MDQ.mjs +0 -6
  101. /package/dist/{csp-DbbF3R9Q.cjs → csp-CBysWlAf.cjs} +0 -0
  102. /package/dist/{generator-BaSvGlxR.mjs → generator-CcOBN5vI.mjs} +0 -0
  103. /package/dist/{generator-DsajVrDx.cjs → generator-DtUU3Cfk.cjs} +0 -0
  104. /package/dist/{handler-1LRMYeI4.cjs → handler-Dzf4dSnV.cjs} +0 -0
  105. /package/dist/{index-ZqgZUvwp.d.mts → index-CdJv4ocW.d.mts} +0 -0
  106. /package/dist/{meta-loader-CD3Yptr5.mjs → meta-loader-C4Hu9RN9.mjs} +0 -0
  107. /package/dist/{meta-loader-CjphwtS7.cjs → meta-loader-C9MKjAs0.cjs} +0 -0
  108. /package/dist/{types-generator-BqNKCbrx.cjs → types-generator-CYcHkDzZ.cjs} +0 -0
@@ -154,6 +154,13 @@ interface BoltdocsSecurityConfig {
154
154
  enableCSP?: boolean;
155
155
  customHeaders?: Record<string, string>;
156
156
  }
157
+ interface BoltdocsVerificationConfig {
158
+ google?: string;
159
+ bing?: string;
160
+ yandex?: string;
161
+ pinterest?: string;
162
+ facebook?: string;
163
+ }
157
164
  /**
158
165
  * Configuration for SEO.
159
166
  */
@@ -163,6 +170,7 @@ interface BoltdocsSeoConfig {
163
170
  thumbnails?: {
164
171
  background?: string;
165
172
  };
173
+ verification?: BoltdocsVerificationConfig;
166
174
  }
167
175
  /**
168
176
  * Configuration for Google Analytics 4 (GA4).
@@ -224,10 +232,19 @@ interface BoltdocsCustomFeedbackConfig {
224
232
  categorySlug?: string;
225
233
  endpoint?: string;
226
234
  }
235
+ interface BoltdocsVercelConfig {
236
+ analytics?: boolean;
237
+ speedInsights?: boolean;
238
+ }
227
239
  interface BoltdocsIntegrationsConfig {
228
- ga4?: BoltdocsGA4Config;
229
- gtm?: BoltdocsGTMConfig;
230
- algolia?: BoltdocsAlgoliaConfig;
240
+ analytics?: {
241
+ ga4?: BoltdocsGA4Config;
242
+ vercel?: BoltdocsVercelConfig;
243
+ gtm?: BoltdocsGTMConfig;
244
+ };
245
+ search?: {
246
+ algolia?: BoltdocsAlgoliaConfig;
247
+ };
231
248
  feedback?: {
232
249
  giscus?: BoltdocsGiscusConfig;
233
250
  custom?: BoltdocsCustomFeedbackConfig;
@@ -525,7 +542,7 @@ declare function SidebarGroup({
525
542
  */
526
543
  interface SidebarLinkProps extends ComponentBase {
527
544
  label: string;
528
- href: string;
545
+ href: BoltdocsRoutePathWithFallback$1;
529
546
  active?: boolean;
530
547
  icon?: React.ElementType;
531
548
  badge?: ComponentRoute['badge'];
@@ -154,6 +154,13 @@ interface BoltdocsSecurityConfig {
154
154
  enableCSP?: boolean;
155
155
  customHeaders?: Record<string, string>;
156
156
  }
157
+ interface BoltdocsVerificationConfig {
158
+ google?: string;
159
+ bing?: string;
160
+ yandex?: string;
161
+ pinterest?: string;
162
+ facebook?: string;
163
+ }
157
164
  /**
158
165
  * Configuration for SEO.
159
166
  */
@@ -163,6 +170,7 @@ interface BoltdocsSeoConfig {
163
170
  thumbnails?: {
164
171
  background?: string;
165
172
  };
173
+ verification?: BoltdocsVerificationConfig;
166
174
  }
167
175
  /**
168
176
  * Configuration for Google Analytics 4 (GA4).
@@ -224,10 +232,19 @@ interface BoltdocsCustomFeedbackConfig {
224
232
  categorySlug?: string;
225
233
  endpoint?: string;
226
234
  }
235
+ interface BoltdocsVercelConfig {
236
+ analytics?: boolean;
237
+ speedInsights?: boolean;
238
+ }
227
239
  interface BoltdocsIntegrationsConfig {
228
- ga4?: BoltdocsGA4Config;
229
- gtm?: BoltdocsGTMConfig;
230
- algolia?: BoltdocsAlgoliaConfig;
240
+ analytics?: {
241
+ ga4?: BoltdocsGA4Config;
242
+ vercel?: BoltdocsVercelConfig;
243
+ gtm?: BoltdocsGTMConfig;
244
+ };
245
+ search?: {
246
+ algolia?: BoltdocsAlgoliaConfig;
247
+ };
231
248
  feedback?: {
232
249
  giscus?: BoltdocsGiscusConfig;
233
250
  custom?: BoltdocsCustomFeedbackConfig;
@@ -525,7 +542,7 @@ declare function SidebarGroup({
525
542
  */
526
543
  interface SidebarLinkProps extends ComponentBase {
527
544
  label: string;
528
- href: string;
545
+ href: BoltdocsRoutePathWithFallback$1;
529
546
  active?: boolean;
530
547
  icon?: React.ElementType;
531
548
  badge?: ComponentRoute['badge'];
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ import{t as e}from"./rolldown-runtime-fkIsjY3S.mjs";import t from"node:path";import n from"node:fs";var r=e({generateProjectTypes:()=>i,writeLinkTree:()=>a});function i(e,r,i=process.cwd(),a){let o=t.resolve(i,`.boltdocs`,`generated`);n.existsSync(o)||n.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=t.resolve(i,r,`mdx-components.${e}`);if(n.existsSync(a)){let e=t.join(i,r,`mdx-components`),n=t.relative(o,e).replace(/\\/g,`/`);f=`import type * as MdxComponentsModule from '${n.startsWith(`.`)?n:`./${n}`}'\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
+ `;n.writeFileSync(t.resolve(o,`types.d.ts`),h)}function a(e,r=process.cwd()){let i=t.resolve(r,`.boltdocs`,`generated`);n.existsSync(i)||n.mkdirSync(i,{recursive:!0});let a={routes:Array.from(new Set(e)).sort(),timestamp:Date.now()};n.writeFileSync(t.resolve(i,`link-tree.json`),JSON.stringify(a,null,2))}export{r as n,a as r,i as t};
@@ -4,4 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  import{r as e}from"./errors-C0Hx15Ag.mjs";import t from"node:fs";import n from"isomorphic-dompurify";import{z as r}from"zod";import{error as i}from"@bdocs/dui";const a=/^[a-zA-Z0-9\-_/.()[\]]+$/,o=r.looseObject({title:r.string().max(200).optional(),description:r.string().max(500).optional(),permalink:r.string().optional(),sidebarPosition:r.number().optional(),sidebarLabel:r.string().max(100).optional(),sidebarHidden:r.boolean().optional(),hidden:r.boolean().optional(),category:r.string().max(50).optional(),order:r.number().optional(),badge:r.union([r.string().max(50),r.object({text:r.string().max(50),expires:r.string().optional()})]).optional(),icon:r.string().max(50).optional(),date:r.union([r.string(),r.date()]).optional(),lastUpdated:r.union([r.string(),r.date()]).optional(),groupTitle:r.string().max(100).optional(),groupPosition:r.number().optional(),seo:r.record(r.string(),r.any()).optional(),tags:r.array(r.string().max(50)).optional(),author:r.union([r.string().max(100),r.object({name:r.string().max(100),avatar:r.string().optional(),url:r.string().optional(),image:r.string().optional()})]).optional(),draft:r.boolean().optional(),excerpt:r.string().max(500).optional(),coverImage:r.string().nullable().optional()});function s(e){let t=e.trim();if(!t.startsWith(`---`))return{data:{},content:e,rawMatter:``};let n=t.indexOf(`---`,3);if(n===-1||n===3)return{data:{},content:e,rawMatter:``};let r=t.slice(3,n).trim(),i=t.slice(n+3).trim();return c(r)?{data:{},content:i,rawMatter:r}:{data:l(r),content:i,rawMatter:r}}function c(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r],a=r>0?e[r-1]:``;i===`'`&&!n&&a!==`\\`?t=!t:i===`"`&&!t&&a!==`\\`&&(n=!n)}return t||n}function l(e){let t=e.split(`
7
- `),n={},r=0;for(;r<t.length;){let e=t[r],i=e.trim();if(!i||i.startsWith(`#`)){r++;continue}let a=i.indexOf(`:`);if(a!==-1){let o=i.slice(0,a).trim(),s=i.slice(a+1).trim();if(s===``){let i=u(t.slice(r+1),e.search(/\S|$/));i.value===void 0?r++:(n[o]=i.value,r+=i.linesConsumed+1)}else n[o]=d(s),r++}else r++}return n}function u(e,t){if(e.length===0)return{value:void 0,linesConsumed:0};if(e[0].trim().startsWith(`-`)){let n=[],r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(o.startsWith(`-`)){let e=o.slice(1).trim();if(e.includes(`:`)){let t={},r=e.split(/,\s*/);for(let e of r){let n=e.indexOf(`:`);if(n!==-1){let r=e.slice(0,n).trim();t[r]=d(e.slice(n+1).trim())}}n.push(t)}else n.push(e)}else if(a>t&&n.length>0){let e=n[n.length-1];if(typeof e==`object`&&e){let t=e,n=o.indexOf(`:`);if(n!==-1){let e=o.slice(0,n).trim();t[e]=d(o.slice(n+1).trim())}}}else break;r++}return{value:n.length>0?n:void 0,linesConsumed:r}}let n={},r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(a<=t)break;let s=o.indexOf(`:`);if(s!==-1){let e=o.slice(0,s).trim();n[e]=d(o.slice(s+1).trim())}r++}return{value:Object.keys(n).length>0?n:void 0,linesConsumed:r}}function d(e){let t=e.trim();if(t===`true`)return!0;if(t===`false`)return!1;if(t===`null`||t===`~`)return null;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))return t.slice(1,-1);if(t.startsWith(`[`)&&t.endsWith(`]`)){let e=t.slice(1,-1).trim();return e?e.split(/,\s*/).map(e=>d(e.trim())):[]}if(t.startsWith(`{`)&&t.endsWith(`}`)){let e=t.slice(1,-1).trim(),n={},r=e.split(/,\s*/);for(let e of r){let t=e.indexOf(`:`);if(t!==-1){let r=e.slice(0,t).trim();n[r]=d(e.slice(t+1).trim())}}return n}return t}function f(e){return e.replace(/\\/g,`/`)}function p(e){return e.replace(/^\d+\./,``)}function m(e){let t=e.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function h(e){return/\.mdx?$/.test(e)}function g(e){try{return t.statSync(e).mtimeMs}catch{return 0}}function _(t,n,r){let{data:i,content:a,rawMatter:c}=s(n);if(c&&c.length>10240)throw E(`FRONTMATTER_TOO_LARGE`,`Frontmatter block exceeds size limit`,{size:c.length,file:t}),new e(`Security breach: Frontmatter size exceeds limit of 10240 bytes`);if(!r)return{data:i,content:a};let l=o.safeParse(i),u={...l.success?l.data:{}};return u.title&&=C(u.title).trim(),u.description&&=C(u.description).trim(),{data:u,content:a}}async function v(n,r=!0){let i=``;try{i=await t.promises.readFile(n,`utf-8`);let{data:e,content:a}=_(n,i,r);if(r&&!e.lastUpdated)try{e.lastUpdated=(await t.promises.stat(n)).mtimeMs}catch{e.lastUpdated=0}return{data:e,content:a,raw:i}}catch(t){if(t instanceof e)throw t;return{data:{},content:i,raw:i}}}function y(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function b(e){return y(e)}function x(e){let t=f(e).split(`/`).map(e=>T(p(e))).join(`/`).replace(/\/$/,``);return t=t.replace(/\.mdx?$/,``),(t===`index`||t.endsWith(`/index`))&&(t=t.replace(/index$/,``)),t.startsWith(`/`)||(t=`/`+t),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function S(e){return n.sanitize(e,{ALLOWED_TAGS:`b.i.em.strong.a.p.br.code.pre.span.div.h1.h2.h3.h4.h5.h6.ul.ol.li.table.thead.tbody.tr.th.td.blockquote.hr`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`class`,`id`,`src`,`alt`,`width`,`height`],FORCE_BODY:!0})}n.addHook(`afterSanitizeAttributes`,e=>{if(e.hasAttribute(`href`)){let t=e.getAttribute(`href`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`href`)}if(e.hasAttribute(`src`)){let t=e.getAttribute(`src`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`src`)}});function C(e){return e?e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,``).replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,``).replace(/<!--[\s\S]*?-->/g,``).replace(/<[^>]+>/g,` `).replace(/\s+/g,` `).trim():``}function w(e){return e.charAt(0).toUpperCase()+e.slice(1)}function T(e){return e.replace(/[^a-zA-Z0-9\-_/.]/g,``).split(`/`).filter(e=>e!==`..`&&e!==`.`).map(e=>e.replace(/\.\.+/g,`.`)).join(`/`)}function E(e,t,n={}){let r=new Date().toISOString(),a={...n};for(let e in a)typeof a[e]==`string`&&a[e].includes(`:`)&&(a[e]=a[e].split(/[\\/]/).pop()||a[e]);i(`[SECURITY][${r}] TYPE: ${e} | MESSAGE: ${t} | DETAILS: ${JSON.stringify(a)}`)}function D(){return{dir:process.env.BOLTDOCS_CACHE_DIR||`.boltdocs/cache`,noCache:process.env.BOLTDOCS_NO_CACHE===`1`,lruLimit:parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||`2000`,10),lruTTL:parseInt(process.env.BOLTDOCS_CACHE_LRU_TTL||`14400000`,10),compress:process.env.BOLTDOCS_CACHE_COMPRESS!==`0`}}export{a as _,x as a,h as c,v as d,T as f,o as g,p as h,m as i,E as l,C as m,y as n,D as o,S as p,b as r,g as s,w as t,f as u};
7
+ `),n={},r=0;for(;r<t.length;){let e=t[r],i=e.trim();if(!i||i.startsWith(`#`)){r++;continue}let a=i.indexOf(`:`);if(a!==-1){let o=i.slice(0,a).trim(),s=i.slice(a+1).trim();if(s===``){let i=u(t.slice(r+1),e.search(/\S|$/));i.value===void 0?r++:(n[o]=i.value,r+=i.linesConsumed+1)}else n[o]=d(s),r++}else r++}return n}function u(e,t){if(e.length===0)return{value:void 0,linesConsumed:0};if(e[0].trim().startsWith(`-`)){let n=[],r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(o.startsWith(`-`)){let e=o.slice(1).trim();if(e.includes(`:`)){let t={},r=e.split(/,\s*/);for(let e of r){let n=e.indexOf(`:`);if(n!==-1){let r=e.slice(0,n).trim();t[r]=d(e.slice(n+1).trim())}}n.push(t)}else n.push(e)}else if(a>t&&n.length>0){let e=n[n.length-1];if(typeof e==`object`&&e){let t=e,n=o.indexOf(`:`);if(n!==-1){let e=o.slice(0,n).trim();t[e]=d(o.slice(n+1).trim())}}}else break;r++}return{value:n.length>0?n:void 0,linesConsumed:r}}let n={},r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(a<=t)break;let s=o.indexOf(`:`);if(s!==-1){let e=o.slice(0,s).trim();n[e]=d(o.slice(s+1).trim())}r++}return{value:Object.keys(n).length>0?n:void 0,linesConsumed:r}}function d(e){let t=e.trim();if(t===`true`)return!0;if(t===`false`)return!1;if(t===`null`||t===`~`)return null;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))return t.slice(1,-1);if(t.startsWith(`[`)&&t.endsWith(`]`)){let e=t.slice(1,-1).trim();return e?e.split(/,\s*/).map(e=>d(e.trim())):[]}if(t.startsWith(`{`)&&t.endsWith(`}`)){let e=t.slice(1,-1).trim(),n={},r=e.split(/,\s*/);for(let e of r){let t=e.indexOf(`:`);if(t!==-1){let r=e.slice(0,t).trim();n[r]=d(e.slice(t+1).trim())}}return n}return t}function f(e){return e.replace(/\\/g,`/`)}function p(e){return e.replace(/^\d+\./,``)}function m(e){let t=e.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function h(e){return/\.mdx?$/.test(e)}function g(e){try{return t.statSync(e).mtimeMs}catch{return 0}}function _(t,n,r){let{data:i,content:a,rawMatter:c}=s(n);if(c&&c.length>10240)throw E(`FRONTMATTER_TOO_LARGE`,`Frontmatter block exceeds size limit`,{size:c.length,file:t}),new e(`Security breach: Frontmatter size exceeds limit of 10240 bytes`);if(!r)return{data:i,content:a};let l=o.safeParse(i),u={...l.success?l.data:{}};return u.title&&=C(u.title).trim(),u.description&&=C(u.description).trim(),{data:u,content:a}}async function v(n,r=!0){let i=``;try{i=await t.promises.readFile(n,`utf-8`);let{data:e,content:a}=_(n,i,r);if(r&&!e.lastUpdated)try{e.lastUpdated=(await t.promises.stat(n)).mtimeMs}catch{e.lastUpdated=0}return{data:e,content:a,raw:i}}catch(t){if(t instanceof e)throw t;return{data:{},content:i,raw:i}}}function y(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function b(e){return y(e)}function x(e){let t=f(e).split(`/`).map(e=>T(p(e))).join(`/`).replace(/\/$/,``);return t=t.replace(/\.mdx?$/,``),(t===`index`||t.endsWith(`/index`))&&(t=t.replace(/index$/,``)),t.startsWith(`/`)||(t=`/`+t),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function S(e){return n.sanitize(e,{ALLOWED_TAGS:`b.i.em.strong.a.p.br.code.pre.span.div.h1.h2.h3.h4.h5.h6.ul.ol.li.table.thead.tbody.tr.th.td.blockquote.hr`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`class`,`id`,`src`,`alt`,`width`,`height`],FORCE_BODY:!0})}n.addHook(`afterSanitizeAttributes`,e=>{if(e.hasAttribute(`href`)){let t=e.getAttribute(`href`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`href`)}if(e.hasAttribute(`src`)){let t=e.getAttribute(`src`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`src`)}});function C(e){return e?n.sanitize(e,{ALLOWED_TAGS:[]}).replace(/\s+/g,` `).trim():``}function w(e){return e.charAt(0).toUpperCase()+e.slice(1)}function T(e){return e.replace(/[^a-zA-Z0-9\-_/.]/g,``).split(`/`).filter(e=>e!==`..`&&e!==`.`).map(e=>e.replace(/\.\.+/g,`.`)).join(`/`)}function E(e,t,n={}){let r=new Date().toISOString(),a={...n};for(let e in a)typeof a[e]==`string`&&a[e].includes(`:`)&&(a[e]=a[e].split(/[\\/]/).pop()||a[e]);i(`[SECURITY][${r}] TYPE: ${e} | MESSAGE: ${t} | DETAILS: ${JSON.stringify(a)}`)}function D(){return{dir:process.env.BOLTDOCS_CACHE_DIR||`.boltdocs/cache`,noCache:process.env.BOLTDOCS_NO_CACHE===`1`,lruLimit:parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||`2000`,10),lruTTL:parseInt(process.env.BOLTDOCS_CACHE_LRU_TTL||`14400000`,10),compress:process.env.BOLTDOCS_CACHE_COMPRESS!==`0`}}export{o as _,x as a,h as c,v as d,T as f,s as g,p as h,m as i,E as l,C as m,y as n,D as o,S as p,b as r,g as s,w as t,f as u,a as v};
@@ -4,4 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  const e=require(`./chunk-Ds5LZdWN.cjs`),t=require(`./errors-Dx6JHoKE.cjs`);let n=require(`node:fs`);n=e.n(n);let r=require(`isomorphic-dompurify`);r=e.n(r);let i=require(`zod`),a=require(`@bdocs/dui`);const o=/^[a-zA-Z0-9\-_/.()[\]]+$/,s=i.z.looseObject({title:i.z.string().max(200).optional(),description:i.z.string().max(500).optional(),permalink:i.z.string().optional(),sidebarPosition:i.z.number().optional(),sidebarLabel:i.z.string().max(100).optional(),sidebarHidden:i.z.boolean().optional(),hidden:i.z.boolean().optional(),category:i.z.string().max(50).optional(),order:i.z.number().optional(),badge:i.z.union([i.z.string().max(50),i.z.object({text:i.z.string().max(50),expires:i.z.string().optional()})]).optional(),icon:i.z.string().max(50).optional(),date:i.z.union([i.z.string(),i.z.date()]).optional(),lastUpdated:i.z.union([i.z.string(),i.z.date()]).optional(),groupTitle:i.z.string().max(100).optional(),groupPosition:i.z.number().optional(),seo:i.z.record(i.z.string(),i.z.any()).optional(),tags:i.z.array(i.z.string().max(50)).optional(),author:i.z.union([i.z.string().max(100),i.z.object({name:i.z.string().max(100),avatar:i.z.string().optional(),url:i.z.string().optional(),image:i.z.string().optional()})]).optional(),draft:i.z.boolean().optional(),excerpt:i.z.string().max(500).optional(),coverImage:i.z.string().nullable().optional()});function c(e){let t=e.trim();if(!t.startsWith(`---`))return{data:{},content:e,rawMatter:``};let n=t.indexOf(`---`,3);if(n===-1||n===3)return{data:{},content:e,rawMatter:``};let r=t.slice(3,n).trim(),i=t.slice(n+3).trim();return l(r)?{data:{},content:i,rawMatter:r}:{data:u(r),content:i,rawMatter:r}}function l(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r],a=r>0?e[r-1]:``;i===`'`&&!n&&a!==`\\`?t=!t:i===`"`&&!t&&a!==`\\`&&(n=!n)}return t||n}function u(e){let t=e.split(`
7
- `),n={},r=0;for(;r<t.length;){let e=t[r],i=e.trim();if(!i||i.startsWith(`#`)){r++;continue}let a=i.indexOf(`:`);if(a!==-1){let o=i.slice(0,a).trim(),s=i.slice(a+1).trim();if(s===``){let i=d(t.slice(r+1),e.search(/\S|$/));i.value===void 0?r++:(n[o]=i.value,r+=i.linesConsumed+1)}else n[o]=f(s),r++}else r++}return n}function d(e,t){if(e.length===0)return{value:void 0,linesConsumed:0};if(e[0].trim().startsWith(`-`)){let n=[],r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(o.startsWith(`-`)){let e=o.slice(1).trim();if(e.includes(`:`)){let t={},r=e.split(/,\s*/);for(let e of r){let n=e.indexOf(`:`);if(n!==-1){let r=e.slice(0,n).trim();t[r]=f(e.slice(n+1).trim())}}n.push(t)}else n.push(e)}else if(a>t&&n.length>0){let e=n[n.length-1];if(typeof e==`object`&&e){let t=e,n=o.indexOf(`:`);if(n!==-1){let e=o.slice(0,n).trim();t[e]=f(o.slice(n+1).trim())}}}else break;r++}return{value:n.length>0?n:void 0,linesConsumed:r}}let n={},r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(a<=t)break;let s=o.indexOf(`:`);if(s!==-1){let e=o.slice(0,s).trim();n[e]=f(o.slice(s+1).trim())}r++}return{value:Object.keys(n).length>0?n:void 0,linesConsumed:r}}function f(e){let t=e.trim();if(t===`true`)return!0;if(t===`false`)return!1;if(t===`null`||t===`~`)return null;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))return t.slice(1,-1);if(t.startsWith(`[`)&&t.endsWith(`]`)){let e=t.slice(1,-1).trim();return e?e.split(/,\s*/).map(e=>f(e.trim())):[]}if(t.startsWith(`{`)&&t.endsWith(`}`)){let e=t.slice(1,-1).trim(),n={},r=e.split(/,\s*/);for(let e of r){let t=e.indexOf(`:`);if(t!==-1){let r=e.slice(0,t).trim();n[r]=f(e.slice(t+1).trim())}}return n}return t}function p(e){return e.replace(/\\/g,`/`)}function m(e){return e.replace(/^\d+\./,``)}function h(e){let t=e.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function g(e){return/\.mdx?$/.test(e)}function _(e){try{return n.default.statSync(e).mtimeMs}catch{return 0}}function v(e,n,r){let{data:i,content:a,rawMatter:o}=c(n);if(o&&o.length>10240)throw D(`FRONTMATTER_TOO_LARGE`,`Frontmatter block exceeds size limit`,{size:o.length,file:e}),new t.r(`Security breach: Frontmatter size exceeds limit of 10240 bytes`);if(!r)return{data:i,content:a};let l=s.safeParse(i),u={...l.success?l.data:{}};return u.title&&=w(u.title).trim(),u.description&&=w(u.description).trim(),{data:u,content:a}}async function y(e,r=!0){let i=``;try{i=await n.default.promises.readFile(e,`utf-8`);let{data:t,content:a}=v(e,i,r);if(r&&!t.lastUpdated)try{t.lastUpdated=(await n.default.promises.stat(e)).mtimeMs}catch{t.lastUpdated=0}return{data:t,content:a,raw:i}}catch(e){if(e instanceof t.r)throw e;return{data:{},content:i,raw:i}}}function b(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function x(e){return b(e)}function S(e){let t=p(e).split(`/`).map(e=>E(m(e))).join(`/`).replace(/\/$/,``);return t=t.replace(/\.mdx?$/,``),(t===`index`||t.endsWith(`/index`))&&(t=t.replace(/index$/,``)),t.startsWith(`/`)||(t=`/`+t),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function C(e){return r.default.sanitize(e,{ALLOWED_TAGS:`b.i.em.strong.a.p.br.code.pre.span.div.h1.h2.h3.h4.h5.h6.ul.ol.li.table.thead.tbody.tr.th.td.blockquote.hr`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`class`,`id`,`src`,`alt`,`width`,`height`],FORCE_BODY:!0})}r.default.addHook(`afterSanitizeAttributes`,e=>{if(e.hasAttribute(`href`)){let t=e.getAttribute(`href`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`href`)}if(e.hasAttribute(`src`)){let t=e.getAttribute(`src`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`src`)}});function w(e){return e?e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,``).replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,``).replace(/<!--[\s\S]*?-->/g,``).replace(/<[^>]+>/g,` `).replace(/\s+/g,` `).trim():``}function T(e){return e.charAt(0).toUpperCase()+e.slice(1)}function E(e){return e.replace(/[^a-zA-Z0-9\-_/.]/g,``).split(`/`).filter(e=>e!==`..`&&e!==`.`).map(e=>e.replace(/\.\.+/g,`.`)).join(`/`)}function D(e,t,n={}){let r=new Date().toISOString(),i={...n};for(let e in i)typeof i[e]==`string`&&i[e].includes(`:`)&&(i[e]=i[e].split(/[\\/]/).pop()||i[e]);(0,a.error)(`[SECURITY][${r}] TYPE: ${e} | MESSAGE: ${t} | DETAILS: ${JSON.stringify(i)}`)}function O(){return{dir:process.env.BOLTDOCS_CACHE_DIR||`.boltdocs/cache`,noCache:process.env.BOLTDOCS_NO_CACHE===`1`,lruLimit:parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||`2000`,10),lruTTL:parseInt(process.env.BOLTDOCS_CACHE_LRU_TTL||`14400000`,10),compress:process.env.BOLTDOCS_CACHE_COMPRESS!==`0`}}Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return p}});
7
+ `),n={},r=0;for(;r<t.length;){let e=t[r],i=e.trim();if(!i||i.startsWith(`#`)){r++;continue}let a=i.indexOf(`:`);if(a!==-1){let o=i.slice(0,a).trim(),s=i.slice(a+1).trim();if(s===``){let i=d(t.slice(r+1),e.search(/\S|$/));i.value===void 0?r++:(n[o]=i.value,r+=i.linesConsumed+1)}else n[o]=f(s),r++}else r++}return n}function d(e,t){if(e.length===0)return{value:void 0,linesConsumed:0};if(e[0].trim().startsWith(`-`)){let n=[],r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(o.startsWith(`-`)){let e=o.slice(1).trim();if(e.includes(`:`)){let t={},r=e.split(/,\s*/);for(let e of r){let n=e.indexOf(`:`);if(n!==-1){let r=e.slice(0,n).trim();t[r]=f(e.slice(n+1).trim())}}n.push(t)}else n.push(e)}else if(a>t&&n.length>0){let e=n[n.length-1];if(typeof e==`object`&&e){let t=e,n=o.indexOf(`:`);if(n!==-1){let e=o.slice(0,n).trim();t[e]=f(o.slice(n+1).trim())}}}else break;r++}return{value:n.length>0?n:void 0,linesConsumed:r}}let n={},r=0;for(;r<e.length;){let i=e[r],a=i.search(/\S|$/),o=i.trim();if(!o||o.startsWith(`#`)){r++;continue}if(a<=t)break;let s=o.indexOf(`:`);if(s!==-1){let e=o.slice(0,s).trim();n[e]=f(o.slice(s+1).trim())}r++}return{value:Object.keys(n).length>0?n:void 0,linesConsumed:r}}function f(e){let t=e.trim();if(t===`true`)return!0;if(t===`false`)return!1;if(t===`null`||t===`~`)return null;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))return t.slice(1,-1);if(t.startsWith(`[`)&&t.endsWith(`]`)){let e=t.slice(1,-1).trim();return e?e.split(/,\s*/).map(e=>f(e.trim())):[]}if(t.startsWith(`{`)&&t.endsWith(`}`)){let e=t.slice(1,-1).trim(),n={},r=e.split(/,\s*/);for(let e of r){let t=e.indexOf(`:`);if(t!==-1){let r=e.slice(0,t).trim();n[r]=f(e.slice(t+1).trim())}}return n}return t}function p(e){return e.replace(/\\/g,`/`)}function m(e){return e.replace(/^\d+\./,``)}function h(e){let t=e.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function g(e){return/\.mdx?$/.test(e)}function _(e){try{return n.default.statSync(e).mtimeMs}catch{return 0}}function v(e,n,r){let{data:i,content:a,rawMatter:o}=c(n);if(o&&o.length>10240)throw D(`FRONTMATTER_TOO_LARGE`,`Frontmatter block exceeds size limit`,{size:o.length,file:e}),new t.r(`Security breach: Frontmatter size exceeds limit of 10240 bytes`);if(!r)return{data:i,content:a};let l=s.safeParse(i),u={...l.success?l.data:{}};return u.title&&=w(u.title).trim(),u.description&&=w(u.description).trim(),{data:u,content:a}}async function y(e,r=!0){let i=``;try{i=await n.default.promises.readFile(e,`utf-8`);let{data:t,content:a}=v(e,i,r);if(r&&!t.lastUpdated)try{t.lastUpdated=(await n.default.promises.stat(e)).mtimeMs}catch{t.lastUpdated=0}return{data:t,content:a,raw:i}}catch(e){if(e instanceof t.r)throw e;return{data:{},content:i,raw:i}}}function b(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function x(e){return b(e)}function S(e){let t=p(e).split(`/`).map(e=>E(m(e))).join(`/`).replace(/\/$/,``);return t=t.replace(/\.mdx?$/,``),(t===`index`||t.endsWith(`/index`))&&(t=t.replace(/index$/,``)),t.startsWith(`/`)||(t=`/`+t),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function C(e){return r.default.sanitize(e,{ALLOWED_TAGS:`b.i.em.strong.a.p.br.code.pre.span.div.h1.h2.h3.h4.h5.h6.ul.ol.li.table.thead.tbody.tr.th.td.blockquote.hr`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`class`,`id`,`src`,`alt`,`width`,`height`],FORCE_BODY:!0})}r.default.addHook(`afterSanitizeAttributes`,e=>{if(e.hasAttribute(`href`)){let t=e.getAttribute(`href`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`href`)}if(e.hasAttribute(`src`)){let t=e.getAttribute(`src`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`src`)}});function w(e){return e?r.default.sanitize(e,{ALLOWED_TAGS:[]}).replace(/\s+/g,` `).trim():``}function T(e){return e.charAt(0).toUpperCase()+e.slice(1)}function E(e){return e.replace(/[^a-zA-Z0-9\-_/.]/g,``).split(`/`).filter(e=>e!==`..`&&e!==`.`).map(e=>e.replace(/\.\.+/g,`.`)).join(`/`)}function D(e,t,n={}){let r=new Date().toISOString(),i={...n};for(let e in i)typeof i[e]==`string`&&i[e].includes(`:`)&&(i[e]=i[e].split(/[\\/]/).pop()||i[e]);(0,a.error)(`[SECURITY][${r}] TYPE: ${e} | MESSAGE: ${t} | DETAILS: ${JSON.stringify(i)}`)}function O(){return{dir:process.env.BOLTDOCS_CACHE_DIR||`.boltdocs/cache`,noCache:process.env.BOLTDOCS_NO_CACHE===`1`,lruLimit:parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||`2000`,10),lruTTL:parseInt(process.env.BOLTDOCS_CACHE_LRU_TTL||`14400000`,10),compress:process.env.BOLTDOCS_CACHE_COMPRESS!==`0`}}Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return o}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boltdocs",
3
- "version": "2.9.3",
3
+ "version": "3.0.1",
4
4
  "description": "A lightweight documentation generator for React projects.",
5
5
  "main": "dist/node/index.mjs",
6
6
  "module": "dist/node/index.mjs",
@@ -92,7 +92,8 @@
92
92
  "unist-util-visit": "5.1.0",
93
93
  "vite": "7.0.0 || 8.0.0",
94
94
  "zod": "4.3.6",
95
- "@bdocs/plugin-image-optimizer": "0.2.0",
95
+ "@bdocs/plugin-image-optimizer": "0.2.1",
96
+ "@bdocs/parser": "1.0.0",
96
97
  "@bdocs/ssg": "0.1.1"
97
98
  },
98
99
  "peerDependencies": {
@@ -168,6 +168,14 @@ export interface BoltdocsSecurityConfig {
168
168
  customHeaders?: Record<string, string>
169
169
  }
170
170
 
171
+ export interface BoltdocsVerificationConfig {
172
+ google?: string
173
+ bing?: string
174
+ yandex?: string
175
+ pinterest?: string
176
+ facebook?: string
177
+ }
178
+
171
179
  /**
172
180
  * Configuration for SEO.
173
181
  */
@@ -177,6 +185,7 @@ export interface BoltdocsSeoConfig {
177
185
  thumbnails?: {
178
186
  background?: string
179
187
  }
188
+ verification?: BoltdocsVerificationConfig
180
189
  }
181
190
 
182
191
  /**
@@ -244,10 +253,20 @@ export interface BoltdocsCustomFeedbackConfig {
244
253
  endpoint?: string
245
254
  }
246
255
 
256
+ export interface BoltdocsVercelConfig {
257
+ analytics?: boolean
258
+ speedInsights?: boolean
259
+ }
260
+
247
261
  export interface BoltdocsIntegrationsConfig {
248
- ga4?: BoltdocsGA4Config
249
- gtm?: BoltdocsGTMConfig
250
- algolia?: BoltdocsAlgoliaConfig
262
+ analytics?: {
263
+ ga4?: BoltdocsGA4Config
264
+ vercel?: BoltdocsVercelConfig
265
+ gtm?: BoltdocsGTMConfig
266
+ }
267
+ search?: {
268
+ algolia?: BoltdocsAlgoliaConfig
269
+ }
251
270
  feedback?: {
252
271
  giscus?: BoltdocsGiscusConfig
253
272
  custom?: BoltdocsCustomFeedbackConfig
@@ -1,7 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- import{r as e}from"./errors-C0Hx15Ag.mjs";import{t}from"./types-generator-BRyf4o9F.mjs";import n from"node:path";import r from"node:fs";import{z as i}from"zod";import{warn as a}from"@bdocs/dui";function o(e){return e}const s=i.object({icon:i.string().max(50),link:i.string().url()});i.object({text:i.string().max(2e3).optional()});const c=i.object({name:i.string(),enforce:i.enum([`pre`,`post`]).optional(),version:i.string().optional(),boltdocsVersion:i.string().optional(),remarkPlugins:i.array(i.unknown()).optional(),rehypePlugins:i.array(i.unknown()).optional(),vitePlugins:i.array(i.unknown()).optional(),components:i.record(i.string(),i.string()).optional(),hooks:i.record(i.string(),i.unknown()).optional()}),l=i.object({title:i.union([i.string(),i.record(i.string(),i.string())]).optional(),description:i.union([i.string(),i.record(i.string(),i.string())]).optional(),logo:i.union([i.string(),i.object({dark:i.string(),light:i.string(),alt:i.string().optional(),width:i.number().optional(),height:i.number().optional()})]).optional(),navbar:i.array(i.object({label:i.union([i.string(),i.record(i.string(),i.string())]),href:i.string(),items:i.array(i.object({label:i.union([i.string(),i.record(i.string(),i.string())]),href:i.string()})).optional()})).optional(),sidebar:i.record(i.string(),i.array(i.object({text:i.string(),link:i.string()}))).optional(),sidebarGroups:i.record(i.string(),i.object({title:i.union([i.string(),i.record(i.string(),i.string())]).optional(),icon:i.string().optional()})).optional(),socialLinks:i.array(s).optional(),editLink:i.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:i.string().url().optional(),version:i.string().max(50).optional(),githubRepo:i.string().max(100).optional(),favicon:i.string().optional(),tabs:i.array(i.object({id:i.string(),text:i.union([i.string(),i.record(i.string(),i.string())]),icon:i.string().optional()})).optional(),codeTheme:i.union([i.string(),i.object({light:i.string(),dark:i.string()})]).optional()}),u=i.union([i.string(),i.object({rules:i.array(i.object({userAgent:i.string(),allow:i.union([i.string(),i.array(i.string())]).optional(),disallow:i.union([i.string(),i.array(i.string())]).optional()})).optional(),sitemaps:i.array(i.string().url()).optional()})]),d=i.object({defaultLocale:i.string(),locales:i.union([i.record(i.string(),i.string()),i.array(i.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:i.record(i.string(),i.object({label:i.string().optional(),direction:i.enum([`ltr`,`rtl`]).optional(),htmlLang:i.string().optional(),calendar:i.string().optional()})).optional()}),f=i.object({defaultVersion:i.string(),prefix:i.string().optional(),versions:i.array(i.object({label:i.string(),path:i.string()}))}),p=i.object({headers:i.record(i.string(),i.string()).optional(),enableCSP:i.boolean().optional(),customHeaders:i.record(i.string(),i.string()).optional()}),m=i.object({metatags:i.record(i.string(),i.string()).optional(),indexing:i.enum([`all`,`public`]).optional(),thumbnails:i.object({background:i.string().optional()}).optional()}),h=i.object({measurementId:i.string().min(1,`Measurement ID is required for GA4`),debug:i.boolean().optional(),anonymizeIp:i.boolean().optional(),sendPageView:i.boolean().optional(),cookieFlags:i.string().optional(),autoTrack:i.object({pageViews:i.boolean().optional(),downloads:i.boolean().optional(),externalLinks:i.boolean().optional(),search:i.boolean().optional()}).optional()}),g=i.object({tagId:i.string().min(1,`Tag ID is required for GTM`),dataLayerName:i.string().optional(),preview:i.string().optional()}),_=i.object({appId:i.string().min(1,`Algolia App ID is required`),apiKey:i.string().min(1,`Algolia API Key is required`),indexName:i.string().min(1,`Algolia Index Name is required`)}),v=i.object({repo:i.string().min(1,`Giscus repository is required`),repoId:i.string().min(1,`Giscus repository ID is required`),category:i.string().optional(),categoryId:i.string().optional(),mapping:i.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:i.union([i.enum([`0`,`1`]),i.boolean()]).optional(),reactionsEnabled:i.union([i.enum([`0`,`1`]),i.boolean()]).optional(),emitMetadata:i.union([i.enum([`0`,`1`]),i.boolean()]).optional(),inputPosition:i.enum([`top`,`bottom`]).optional(),theme:i.string().optional(),darkTheme:i.string().optional(),lang:i.string().optional(),loading:i.enum([`lazy`,`eager`]).optional()}),y=i.object({enabled:i.boolean(),owner:i.string().min(1,`GitHub owner is required`),repo:i.string().min(1,`GitHub repository name is required`),categorySlug:i.string().optional(),endpoint:i.string().optional()}),b=i.object({ga4:h.optional(),gtm:g.optional(),algolia:_.optional(),feedback:i.object({giscus:v.optional(),custom:y.optional()}).optional()}),x=i.object({siteUrl:i.string().url().optional(),docsDir:i.string().optional(),base:i.string().optional(),theme:l.optional(),i18n:d.optional(),versions:f.optional(),plugins:i.array(c).optional(),robots:u.optional(),security:p.optional(),seo:m.optional(),integrations:b.optional(),vite:i.record(i.string(),i.unknown()).optional()}),S=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function C(t,i=process.cwd()){let o=i,s={docsDir:n.resolve(t),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},c={};for(let e of S){let t=n.resolve(o,e);if(r.existsSync(t))try{let{loadConfigFromFile:e}=await import(`vite`),n=await e({command:`serve`,mode:`development`},t,o);if(n){c=n.config;break}}catch(t){a(`Failed to load config from ${e}:`,t)}}let l={title:c.title,description:c.description,logo:c.logo,favicon:c.favicon,navbar:c.navbar,sidebar:c.sidebar,sidebarGroups:c.theme?.sidebarGroups,socialLinks:c.socialLinks,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,communityHelp:c.communityHelp,version:c.version,editLink:c.editLink,...c.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:n.resolve(t),theme:{...s.theme,...u},i18n:c.i18n?{...c.i18n,locales:Array.isArray(c.i18n.locales)?Object.fromEntries(c.i18n.locales.map(e=>[e,e])):c.i18n.locales}:void 0,versions:c.versions,siteUrl:c.siteUrl,base:c.base,seo:c.seo,plugins:c.plugins||[],robots:c.robots,security:c.security,integrations:c.integrations,vite:c.vite},f=x.safeParse(d);if(!f.success)throw new e(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
7
- `)}`);return f.data}async function w(e,n=process.cwd()){let r=await C(e,n);return t(r,e,n),r}export{o as a,c as i,C as n,w as r,S as t};
@@ -1,6 +0,0 @@
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,n as t,r as n,t as r}from"./config-BCqkPkjC.mjs";export{r as CONFIG_FILES,e as defineConfig,t as resolveConfig,n as resolveConfigAndGenerateTypes};
@@ -1,7 +0,0 @@
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(`./errors-Dx6JHoKE.cjs`),n=require(`./types-generator-BqNKCbrx.cjs`);let r=require(`node:path`);r=e.n(r);let i=require(`node:fs`);i=e.n(i);let a=require(`zod`),o=require(`@bdocs/dui`);function s(e){return e}const c=a.z.object({icon:a.z.string().max(50),link:a.z.string().url()});a.z.object({text:a.z.string().max(2e3).optional()});const l=a.z.object({name:a.z.string(),enforce:a.z.enum([`pre`,`post`]).optional(),version:a.z.string().optional(),boltdocsVersion:a.z.string().optional(),remarkPlugins:a.z.array(a.z.unknown()).optional(),rehypePlugins:a.z.array(a.z.unknown()).optional(),vitePlugins:a.z.array(a.z.unknown()).optional(),components:a.z.record(a.z.string(),a.z.string()).optional(),hooks:a.z.record(a.z.string(),a.z.unknown()).optional()}),u=a.z.object({title:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),description:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),logo:a.z.union([a.z.string(),a.z.object({dark:a.z.string(),light:a.z.string(),alt:a.z.string().optional(),width:a.z.number().optional(),height:a.z.number().optional()})]).optional(),navbar:a.z.array(a.z.object({label:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),href:a.z.string(),items:a.z.array(a.z.object({label:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),href:a.z.string()})).optional()})).optional(),sidebar:a.z.record(a.z.string(),a.z.array(a.z.object({text:a.z.string(),link:a.z.string()}))).optional(),sidebarGroups:a.z.record(a.z.string(),a.z.object({title:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]).optional(),icon:a.z.string().optional()})).optional(),socialLinks:a.z.array(c).optional(),editLink:a.z.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:a.z.string().url().optional(),version:a.z.string().max(50).optional(),githubRepo:a.z.string().max(100).optional(),favicon:a.z.string().optional(),tabs:a.z.array(a.z.object({id:a.z.string(),text:a.z.union([a.z.string(),a.z.record(a.z.string(),a.z.string())]),icon:a.z.string().optional()})).optional(),codeTheme:a.z.union([a.z.string(),a.z.object({light:a.z.string(),dark:a.z.string()})]).optional()}),d=a.z.union([a.z.string(),a.z.object({rules:a.z.array(a.z.object({userAgent:a.z.string(),allow:a.z.union([a.z.string(),a.z.array(a.z.string())]).optional(),disallow:a.z.union([a.z.string(),a.z.array(a.z.string())]).optional()})).optional(),sitemaps:a.z.array(a.z.string().url()).optional()})]),f=a.z.object({defaultLocale:a.z.string(),locales:a.z.union([a.z.record(a.z.string(),a.z.string()),a.z.array(a.z.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:a.z.record(a.z.string(),a.z.object({label:a.z.string().optional(),direction:a.z.enum([`ltr`,`rtl`]).optional(),htmlLang:a.z.string().optional(),calendar:a.z.string().optional()})).optional()}),p=a.z.object({defaultVersion:a.z.string(),prefix:a.z.string().optional(),versions:a.z.array(a.z.object({label:a.z.string(),path:a.z.string()}))}),m=a.z.object({headers:a.z.record(a.z.string(),a.z.string()).optional(),enableCSP:a.z.boolean().optional(),customHeaders:a.z.record(a.z.string(),a.z.string()).optional()}),h=a.z.object({metatags:a.z.record(a.z.string(),a.z.string()).optional(),indexing:a.z.enum([`all`,`public`]).optional(),thumbnails:a.z.object({background:a.z.string().optional()}).optional()}),g=a.z.object({measurementId:a.z.string().min(1,`Measurement ID is required for GA4`),debug:a.z.boolean().optional(),anonymizeIp:a.z.boolean().optional(),sendPageView:a.z.boolean().optional(),cookieFlags:a.z.string().optional(),autoTrack:a.z.object({pageViews:a.z.boolean().optional(),downloads:a.z.boolean().optional(),externalLinks:a.z.boolean().optional(),search:a.z.boolean().optional()}).optional()}),_=a.z.object({tagId:a.z.string().min(1,`Tag ID is required for GTM`),dataLayerName:a.z.string().optional(),preview:a.z.string().optional()}),v=a.z.object({appId:a.z.string().min(1,`Algolia App ID is required`),apiKey:a.z.string().min(1,`Algolia API Key is required`),indexName:a.z.string().min(1,`Algolia Index Name is required`)}),y=a.z.object({repo:a.z.string().min(1,`Giscus repository is required`),repoId:a.z.string().min(1,`Giscus repository ID is required`),category:a.z.string().optional(),categoryId:a.z.string().optional(),mapping:a.z.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),reactionsEnabled:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),emitMetadata:a.z.union([a.z.enum([`0`,`1`]),a.z.boolean()]).optional(),inputPosition:a.z.enum([`top`,`bottom`]).optional(),theme:a.z.string().optional(),darkTheme:a.z.string().optional(),lang:a.z.string().optional(),loading:a.z.enum([`lazy`,`eager`]).optional()}),b=a.z.object({enabled:a.z.boolean(),owner:a.z.string().min(1,`GitHub owner is required`),repo:a.z.string().min(1,`GitHub repository name is required`),categorySlug:a.z.string().optional(),endpoint:a.z.string().optional()}),x=a.z.object({ga4:g.optional(),gtm:_.optional(),algolia:v.optional(),feedback:a.z.object({giscus:y.optional(),custom:b.optional()}).optional()}),S=a.z.object({siteUrl:a.z.string().url().optional(),docsDir:a.z.string().optional(),base:a.z.string().optional(),theme:u.optional(),i18n:f.optional(),versions:p.optional(),plugins:a.z.array(l).optional(),robots:d.optional(),security:m.optional(),seo:h.optional(),integrations:x.optional(),vite:a.z.record(a.z.string(),a.z.unknown()).optional()}),C=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function w(e,n=process.cwd()){let a=n,s={docsDir:r.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`}}},c={};for(let e of C){let t=r.default.resolve(a,e);if(i.default.existsSync(t))try{let{loadConfigFromFile:e}=await import(`vite`),n=await e({command:`serve`,mode:`development`},t,a);if(n){c=n.config;break}}catch(t){(0,o.warn)(`Failed to load config from ${e}:`,t)}}let l={title:c.title,description:c.description,logo:c.logo,favicon:c.favicon,navbar:c.navbar,sidebar:c.sidebar,sidebarGroups:c.theme?.sidebarGroups,socialLinks:c.socialLinks,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,communityHelp:c.communityHelp,version:c.version,editLink:c.editLink,...c.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:r.default.resolve(e),theme:{...s.theme,...u},i18n:c.i18n?{...c.i18n,locales:Array.isArray(c.i18n.locales)?Object.fromEntries(c.i18n.locales.map(e=>[e,e])):c.i18n.locales}:void 0,versions:c.versions,siteUrl:c.siteUrl,base:c.base,seo:c.seo,plugins:c.plugins||[],robots:c.robots,security:c.security,integrations:c.integrations,vite:c.vite},f=S.safeParse(d);if(!f.success)throw new t.r(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
7
- `)}`);return f.data}async function T(e,t=process.cwd()){let r=await w(e,t);return n.t(r,e,t),r}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return C}});
@@ -1,6 +0,0 @@
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}from"./node-JQ6C-CBi.mjs";var t=e({getCSPHeader:()=>n});function n(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}export{n,t};
@@ -1,7 +0,0 @@
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-BWy_8ASj.cjs`),n=require(`./config-D7ERJhqe.cjs`),r=require(`./node/cli-entry.cjs`);let i=require(`node:path`);i=e.n(i);let a=require(`node:fs`);a=e.n(a);let o=require(`@bdocs/dui`),s=require(`fdir`),c=require(`picomatch`);c=e.n(c);let l=require(`fastest-levenshtein`);const u={$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 d(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 f(e,t,n){return e.doctorConfig.severity[t]||n}async function p(e,t){a.default.existsSync(t)||a.default.mkdirSync(t,{recursive:!0});let n=i.default.basename(e),r=new Date().toISOString().replace(/[:.]/g,`-`),o=i.default.join(t,`${n}.${r}.bak`);a.default.copyFileSync(e,o)}const m=new Map;function h(e){let n=m.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 m.set(e,r),r}const g=new Map;function _(e){if(g.has(e))return g.get(e);let t=!1;try{t=a.default.existsSync(e)&&a.default.statSync(e).isFile()}catch{t=!1}return g.set(e,t),t}async function v(e){let t=i.default.resolve(e,`doctor.json`);if(a.default.existsSync(t))try{let e=JSON.parse(a.default.readFileSync(t,`utf-8`));return{...u,...e,checks:{...u.checks,...e.checks,metadata:{...u.checks.metadata,...e.checks?.metadata},links:{...u.checks.links,...e.checks?.links},i18n:{...u.checks.i18n,...e.checks?.i18n},performance:{...u.checks.performance,...e.checks?.performance,budgets:{...u.checks.performance?.budgets,...e.checks?.performance?.budgets}}},fix:{...u.fix,...e.fix},reporting:{...u.reporting,...e.reporting},severity:{...u.severity,...e.severity},exclude:[...u.exclude,...e.exclude||[]]}}catch(e){(0,o.warn)(`Failed to parse doctor.json: ${e}`)}return u}async function y(e,n=process.cwd(),r,o){let c=i.default.resolve(n,`.boltdocs`,`generated`);a.default.existsSync(c)||a.default.mkdirSync(c,{recursive:!0});let l=o;l||=await new s.fdir().withFullPaths().filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)).crawl(e).withPromise();let u=r?.base||`/docs`,d=[];for(let n=0;n<l.length;n+=100){let r=l.slice(n,n+100),a=await Promise.all(r.map(async n=>{let r=i.default.isAbsolute(n)?n:i.default.resolve(e,n),a=i.default.relative(e,r),{data:o}=await h(r),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 a.default.writeFileSync(i.default.resolve(c,`link-tree.json`),JSON.stringify(f,null,2)),f}function b(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,l.distance)(i,a)/Math.max(i.length,a.length);return o>.8?o*.95:1-(0,l.distance)(e,t)/Math.max(e.length,t.length)}const x=new Map;function S(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=b(e,a);c>i&&(i=c,r=a)}let a={bestMatch:r,similarity:i};return x.set(e,a),a}async function C(e){let n=[];if(!e.doctorConfig.checks.metadata.enabled)return n;let{titleMin:r,titleMax:a,descriptionMin:o}=e.doctorConfig.checks.metadata,s=new Map;for(let c of e.files){let l=t.u(i.default.relative(e.docsDir,c));try{let{raw:i,data:u}=await h(c);if(i.trim().startsWith(`---`)&&i.split(`---`).length>=3&&Object.keys(u).length===0){let t=f(e,`malformedFrontmatter`,`high`);t!==`off`&&n.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.g.safeParse(u);if(!d.success){let t=f(e,`invalidFrontmatter`,`high`);if(t!==`off`)for(let e of d.error.issues)n.push({file:l,level:t,message:`Invalid frontmatter field "${e.path.join(`.`)}": ${e.message}`,suggestion:`Ensure the field follows the correct type.`})}let p=Array.from(new Set([`title`,...e.doctorConfig.checks.metadata.required]));for(let t of p)if(u[t]===void 0){let r=f(e,`missingMetadata`,`warning`);r!==`off`&&n.push({file:l,level:r,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 r of t)if(u[r]&&Number.isNaN(Date.parse(String(u[r])))){let t=f(e,`invalidFrontmatter`,`high`);t!==`off`&&n.push({file:l,level:t,message:`Invalid date format in field "${r}": "${u[r]}".`,suggestion:`Use a valid ISO date format (e.g., YYYY-MM-DD).`})}}if(u.title){let t=String(u.title);if(t.length<r){let i=f(e,`shortMetadata`,`low`);i!==`off`&&n.push({file:l,level:i,message:`Title is too short (${t.length} chars).`,suggestion:`Titles should be at least ${r} characters for better SEO.`})}else if(t.length>a){let r=f(e,`shortMetadata`,`low`);r!==`off`&&n.push({file:l,level:r,message:`Title is too long (${t.length} chars).`,suggestion:`Titles should be under ${a} characters.`})}let i=s.get(t)||[];i.push(l),s.set(t,i)}if(u.description&&String(u.description).length<o){let t=f(e,`shortMetadata`,`low`);t!==`off`&&n.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 r=f(e,`malformedFrontmatter`,`high`);r!==`off`&&n.push({file:l,level:r,message:`Malformed frontmatter (YAML error): ${t.message}`,suggestion:`Check your YAML syntax for indentation or unquoted special characters.`})}}}for(let[t,r]of s.entries())if(r.length>1){let i=f(e,`duplicateTitle`,`low`);if(i!==`off`)for(let e of r)n.push({file:e,level:i,message:`Duplicate title found: "${t}"`,suggestion:`Ensure each page has a unique title. Also used in: ${r.filter(t=>t!==e).join(`, `)}`})}return n}async function w(e){let n=[],{internal:r,external:s,ignore:c,timeout:l,concurrency:u}=e.doctorConfig.checks.links;if(!r&&!s&&!e.options.checkExternal)return n;let d=/(?:\[.*?\]\((.*?)\))|(?:href=["']([^"']+)["'])/g,p=new Set,g=5e5;for(let o of e.files){let l=t.u(i.default.relative(e.docsDir,o)),{content:u}=await h(o),v=[...(u.length>g?u.slice(0,g):u).replace(/```[\s\S]*?```/g,``).replace(/`[^`\n]*`/g,``).matchAll(d)];for(let t of v){let u=t[1]||t[2],d=!!t[1];if(!u||c.some(e=>u.includes(e)))continue;if(/^https?:\/\//i.test(u)){(s||e.options.checkExternal)&&p.add({url:u,file:o});continue}if(!r||/^(mailto|tel|#)/i.test(u))continue;let h;try{h=decodeURIComponent(u.split(`#`)[0].split(`?`)[0])}catch{h=u.split(`#`)[0].split(`?`)[0]}if(!h)continue;let g=!1,v=``;if(h.startsWith(`/`))if(e.routeIndex.has(h)||e.routeIndexWithSlash.has(h)||e.routeIndexWithoutSlash.has(h))g=!0;else{let t=e.basePrefix+(h.startsWith(`/`)?h:`/`+h);if(e.routeIndex.has(t)||e.routeIndexWithSlash.has(t))g=!1,v=t;else{let t=e.config.base!==`/`&&h.startsWith(e.config.base||`/`)?h.substring((e.config.base||`/`).length):h,n=t.startsWith(`/`)?t.substring(1):t;v=i.default.join(e.docsDir,n),g=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>_(v+e))}}else v=i.default.resolve(i.default.dirname(o),h),g=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>_(v+e));if(!g){let{bestMatch:t,similarity:r}=S(h,e.linkTree.routes),i=!1,s=e.basePrefix+(h.startsWith(`/`)?h:`/`+h);(e.routeIndex.has(s)||e.routeIndexWithSlash.has(s))&&(t=s,r=1,i=!0);let c=r>.6||i,p=r>.75&&t!==h||i,g=f(e,`brokenLink`,`high`);g!==`off`&&n.push({file:l,level:g,message:`Broken internal link: "${u}"`,suggestion:c?`Did you mean "${t}"?`:`Ensure the target exists or check for typos.`,fix:p?async()=>{let e=u.includes(`#`)?`#`+u.split(`#`)[1]:``,n=d?`(${u})`:`href="${u}"`,r=d?`(${t}${e})`:`href="${t}${e}"`,i=a.default.readFileSync(o,`utf-8`).replace(n,r);a.default.writeFileSync(o,i),m.delete(o)}:void 0})}}}if(p.size>0){(0,o.info)(o.colors.gray(`Verifying ${p.size} external links...`));let r=new Map;for(let e of p)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}}},s=Array.from(r.keys()),c=[];for(let e=0;e<s.length;e+=u){let t=s.slice(e,e+u),n=await Promise.allSettled(t.map(a));c.push(...n.map(e=>e.status===`fulfilled`?e.value:{url:`unknown`,ok:!1,error:e.reason}))}for(let a of c)if(!a.ok){let o=f(e,`brokenLink`,`warning`);if(o!==`off`){let s=r.get(a.url)||[];for(let r of s)n.push({file:t.u(i.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 n}async function T(e){let n=[];if(!e.doctorConfig.checks.i18n.enabled||!e.config.i18n)return n;let{defaultLocale:r,locales:o}=e.config.i18n,s=Object.keys(o),c=s.filter(e=>e!==r);for(let o of e.files){let l=t.u(i.default.relative(e.docsDir,o)),u=l.split(`/`),d=u[0];if(d===r){let t=u.slice(1).join(`/`);for(let r of c){let s=i.default.join(e.docsDir,r,t);if(!_(s)){let c=f(e,`missingTranslation`,`warning`);c!==`off`&&n.push({file:l,level:c,message:`Missing translation for locale "${r}"`,suggestion:`Create a version at "${r}/${t}".`,fix:async()=>{let e=i.default.dirname(s);a.default.existsSync(e)||a.default.mkdirSync(e,{recursive:!0}),a.default.copyFileSync(o,s)}})}}}else if(s.includes(d)){let t=u.slice(1).join(`/`);if(!_(i.default.join(e.docsDir,r,t))){let i=f(e,`missingTranslation`,`low`);i!==`off`&&n.push({file:l,level:i,message:`Orphaned translation (source missing in "${r}")`,suggestion:`Remove this file or create the source at "${r}/${t}".`,fix:async()=>{a.default.unlinkSync(o)}})}}}return n}async function E(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=f(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}=S(r.link,e.linkTree.routes),a=i>.6,o=f(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=f(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 D(e){let t=[],n=e.doctorConfig.checks.performance;if(!n?.enabled)return t;let r=i.default.resolve(e.root,`.boltdocs`,`reports`,`performance.json`);if(!a.default.existsSync(r))return t.push({file:`(build)`,level:f(e,`budgetExceeded`,`warning`),message:"Performance metrics not found. Run `boltdocs build` first."}),t;let o;try{o=JSON.parse(a.default.readFileSync(r,`utf-8`))}catch{return t.push({file:`(build)`,level:f(e,`budgetExceeded`,`warning`),message:`Failed to parse performance metrics file.`}),t}let s=n.budgets,c=f(e,`budgetExceeded`,`warning`),l=d(s?.maxJSBundleSize,1/0),u=d(s?.maxCSSBundleSize,1/0),p=d(s?.maxPageHTMLSize,1/0),m=s?.maxImagesKB??1/0,h=s?.maxBuildTime??1/0,g=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(p!==1/0){for(let e of o.pages)if(e.htmlSize>p){let n=(e.htmlSize/1024).toFixed(0),r=(p/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 _=m*1024;if(m!==1/0&&o.totalImagesSize>_){let e=(o.totalImagesSize/1024).toFixed(0);t.push({file:`(build)`,level:c,message:`Image assets exceed budget: ${e}kb > ${m}kb`,suggestion:`Optimize images with lossy compression or use next-gen formats (webp/avif).`})}if(h!==1/0&&o.buildTime>h){let e=(o.buildTime/1e3).toFixed(1),n=(h/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 g!==1/0&&o.fontCount>g&&t.push({file:`(build)`,level:c,message:`Font files exceed budget: ${o.fontCount} > ${g}`,suggestion:`Reduce the number of font families or use variable fonts.`}),t}async function O(e){let t=i.default.resolve(e,`doctor.json`);if(a.default.existsSync(t)){(0,o.warn)(`"doctor.json" already exists at ${e}.`);return}try{a.default.writeFileSync(t,JSON.stringify(u,null,2)),(0,o.success)(`Created "doctor.json" with default configuration.`)}catch(e){(0,o.error)(`Failed to create "doctor.json": ${e}`)}}async function k(e=process.cwd(),t={}){if(t.init){await O(e);return}r.t();try{let r=await v(e),{format:l}=r.reporting,u=performance.now(),d=await n.n(`docs`,e),f=i.default.resolve(e,`docs`);a.default.existsSync(f)||(l===`pretty`&&(0,o.error)(`Docs dir not found at ${f}`),process.exit(1)),l===`pretty`&&console.log((0,o.double)([` ${o.colors.dim(`Docs dir:`)} ${f}`,` ${o.colors.dim(`Reports:`)} ${e}/.boltdocs/reports/`],{title:`✦ DOCTOR — Documentation Health Check`})),l===`pretty`&&(0,o.info)(o.colors.dim(`🔍 Discovering files and routes...`));let m=(0,c.default)(r.exclude||[]),h=await new s.fdir().withFullPaths().filter(e=>{if(!(e.endsWith(`.md`)||e.endsWith(`.mdx`)))return!1;let t=i.default.relative(f,e).replace(/\\/g,`/`),n=t.split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`);return!m(t)&&!n}).crawl(f).withPromise();for(let e of h)g.set(e,!0);let _=await y(f,e,d,h),b=d.base||`/`,x=b===`/`?``:b.endsWith(`/`)?b.slice(0,-1):b,S={root:e,docsDir:f,config:d,doctorConfig:r,linkTree:_,files:h,options:t,routeIndex:new Set(_.routes),routeIndexWithSlash:new Set(_.routes.map(e=>e.endsWith(`/`)?e:e+`/`)),routeIndexWithoutSlash:new Set(_.routes.map(e=>e.endsWith(`/`)?e.slice(0,-1):e)),basePrefix:x};l===`pretty`&&(0,o.info)(o.colors.dim(`🧪 Running diagnostic checks in parallel...`));let O=[C(S),w(S),T(S),E(S)];t.budget&&O.push(D(S));let[k,A,j,M,...N]=await Promise.all(O),P=t.budget?N[0]:[],F=[...k,...A,...j,...M,...P];if(l===`pretty`){let e=[{label:`Metadata checks ${k.length>0?`— ${k.length} issue${k.length===1?``:`s`}`:`— OK`}`,done:k.length===0},{label:`Link checks ${A.length>0?`— ${A.length} issue${A.length===1?``:`s`}`:`— OK`}`,done:A.length===0},{label:`i18n checks ${j.length>0?`— ${j.length} issue${j.length===1?``:`s`}`:`— OK`}`,done:j.length===0},{label:`Sidebar checks ${M.length>0?`— ${M.length} issue${M.length===1?``:`s`}`:`— OK`}`,done:M.length===0}];t.budget&&e.push({label:`Performance budget ${P.length>0?`— ${P.length} issue${P.length===1?``:`s`}`:`— OK`}`,done:P.length===0}),console.log(`\n${(0,o.tasks)(e)}`)}let I=0;if(t.fix){for(let e of F)if(e.fix){if(S.doctorConfig.fix.confirmChanges&&!await(0,o.confirm)(`Fix issue in "${e.file}": ${e.message}?`))continue;if(S.doctorConfig.fix.backupFiles){let t=i.default.resolve(S.docsDir,e.file);a.default.existsSync(t)&&await p(t,i.default.resolve(S.root,S.doctorConfig.fix.backupPath))}await e.fix(),I++}}let L=((performance.now()-u)/1e3).toFixed(2),R=F.filter(e=>e.level===`high`).length,z=F.filter(e=>e.level===`warning`).length,B=F.filter(e=>e.level===`low`).length,V={summary:{total:F.length,high:R,warning:z,low:B,fixed:I,duration:L},issues:F.map(e=>({...e,fix:void 0}))};if(r.reporting.outputFile){let t=i.default.resolve(e,r.reporting.outputFile);a.default.existsSync(i.default.dirname(t))||a.default.mkdirSync(i.default.dirname(t),{recursive:!0}),a.default.writeFileSync(t,JSON.stringify(V,null,2))}if(l===`json`)console.log(JSON.stringify(V,null,2));else if(l===`pretty`){let e=F.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(t),e),{});if(F.length>0){(0,o.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`?o.colors.red:n.level===`warning`?o.colors.yellow:o.colors.blue;e.push(`${r} ${i(n.level.toUpperCase())}: ${n.message}`),n.suggestion&&e.push(` ${o.colors.dim(`💡 ${n.suggestion}`)}`),t.fix&&n.fix&&e.push(` ${o.colors.green(`✅ Fixed automatically`)}`)}console.log(`\n${(0,o.single)(e,{title:`📄 ${n}`})}`)}(0,o.dividerLog)()}if(F.length===0)console.log((0,o.round)([` Everything looks perfect!`,` Your documentation is in great shape.`,``,` ${o.colors.dim(`Scanned ${h.length} file${h.length===1?``:`s`} in ${L}s`)}`],{title:`✨ Documentation Health Check`}));else{let e=[];R>0&&e.push(o.colors.red(`${R} Critical Error${R===1?``:`s`}`)),z>0&&e.push(o.colors.yellow(`${z} Warning${z===1?``:`s`}`)),B>0&&e.push(o.colors.blue(`${B} Improvement${B===1?``:`s`}`));let t=[...(0,o.bullet)(e).split(`
7
- `).map(e=>e.trimStart()),``,o.colors.dim(`Scanned ${h.length} file${h.length===1?``:`s`} in ${L}s`)];console.log(`\n${(0,o.double)(t,{title:`Diagnosis Results`})}\n`),I>0&&(0,o.success)(`Successfully fixed ${I} issues automatically!`),R>0?(0,o.error)(`Please fix the critical errors before building for production.`):(0,o.success)(`No critical issues found. You are ready to go!`)}}r.reporting.failOnError&&R>0&&process.exit(1),r.reporting.maxWarnings!==-1&&z>r.reporting.maxWarnings&&(l===`pretty`&&(0,o.error)(`Failed: Too many warnings (${z} > ${r.reporting.maxWarnings})`),process.exit(1))}catch(e){(0,o.error)(`Doctor failed: ${e}`),process.exit(1)}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return u}});
@@ -1,7 +0,0 @@
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}from"./node-JQ6C-CBi.mjs";import{a as t,d as n,g as r,u as i}from"./utils-DexBrwiP.mjs";import{n as a}from"./config-BCqkPkjC.mjs";import{t as o}from"./node/cli-entry.mjs";import s from"node:path";import c from"node:fs";import{bullet as l,colors as u,confirm as d,dividerLog as f,double as p,error as m,info as h,round as g,single as _,success as v,tasks as y,warn as b}from"@bdocs/dui";import{fdir as x}from"fdir";import S from"picomatch";import{distance as C}from"fastest-levenshtein";const w={$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 T(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 E(e,t,n){return e.doctorConfig.severity[t]||n}async function D(e,t){c.existsSync(t)||c.mkdirSync(t,{recursive:!0});let n=s.basename(e),r=new Date().toISOString().replace(/[:.]/g,`-`),i=s.join(t,`${n}.${r}.bak`);c.copyFileSync(e,i)}const O=new Map;function k(e){let t=O.get(e);if(t)return t;let r=(async()=>{let t=await n(e,!1);return{raw:t.raw,data:t.data,content:t.content}})();return O.set(e,r),r}const A=new Map;function j(e){if(A.has(e))return A.get(e);let t=!1;try{t=c.existsSync(e)&&c.statSync(e).isFile()}catch{t=!1}return A.set(e,t),t}async function M(e){let t=s.resolve(e,`doctor.json`);if(c.existsSync(t))try{let e=JSON.parse(c.readFileSync(t,`utf-8`));return{...w,...e,checks:{...w.checks,...e.checks,metadata:{...w.checks.metadata,...e.checks?.metadata},links:{...w.checks.links,...e.checks?.links},i18n:{...w.checks.i18n,...e.checks?.i18n},performance:{...w.checks.performance,...e.checks?.performance,budgets:{...w.checks.performance?.budgets,...e.checks?.performance?.budgets}}},fix:{...w.fix,...e.fix},reporting:{...w.reporting,...e.reporting},severity:{...w.severity,...e.severity},exclude:[...w.exclude,...e.exclude||[]]}}catch(e){b(`Failed to parse doctor.json: ${e}`)}return w}async function N(e,n=process.cwd(),r,i){let a=s.resolve(n,`.boltdocs`,`generated`);c.existsSync(a)||c.mkdirSync(a,{recursive:!0});let o=i;o||=await new x().withFullPaths().filter(e=>e.endsWith(`.md`)||e.endsWith(`.mdx`)).crawl(e).withPromise();let l=r?.base||`/docs`,u=[];for(let n=0;n<o.length;n+=100){let r=o.slice(n,n+100),i=await Promise.all(r.map(async n=>{let r=s.isAbsolute(n)?n:s.resolve(e,n),i=s.relative(e,r),{data:a}=await k(r),o;return o=a.permalink?a.permalink.startsWith(`/`)?a.permalink:`/${a.permalink}`:t(i),l===`/`?o:(l.endsWith(`/`)?l:l+`/`)+(o.startsWith(`/`)?o.substring(1):o)}));u.push(...i)}u.includes(l)||u.push(l);let d={routes:Array.from(new Set(u)).sort(),timestamp:Date.now()};return c.writeFileSync(s.resolve(a,`link-tree.json`),JSON.stringify(d,null,2)),d}function P(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 F=new Map;function I(e,t){if(F.has(e))return F.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=P(e,a);c>i&&(i=c,r=a)}let a={bestMatch:r,similarity:i};return F.set(e,a),a}async function L(e){let t=[];if(!e.doctorConfig.checks.metadata.enabled)return t;let{titleMin:n,titleMax:a,descriptionMin:o}=e.doctorConfig.checks.metadata,c=new Map;for(let l of e.files){let u=i(s.relative(e.docsDir,l));try{let{raw:i,data:s}=await k(l);if(i.trim().startsWith(`---`)&&i.split(`---`).length>=3&&Object.keys(s).length===0){let n=E(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=r.safeParse(s);if(!d.success){let n=E(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(s[n]===void 0){let r=E(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(s[r]&&Number.isNaN(Date.parse(String(s[r])))){let n=E(e,`invalidFrontmatter`,`high`);n!==`off`&&t.push({file:u,level:n,message:`Invalid date format in field "${r}": "${s[r]}".`,suggestion:`Use a valid ISO date format (e.g., YYYY-MM-DD).`})}}if(s.title){let r=String(s.title);if(r.length<n){let i=E(e,`shortMetadata`,`low`);i!==`off`&&t.push({file:u,level:i,message:`Title is too short (${r.length} chars).`,suggestion:`Titles should be at least ${n} characters for better SEO.`})}else if(r.length>a){let n=E(e,`shortMetadata`,`low`);n!==`off`&&t.push({file:u,level:n,message:`Title is too long (${r.length} chars).`,suggestion:`Titles should be under ${a} characters.`})}let i=c.get(r)||[];i.push(u),c.set(r,i)}if(s.description&&String(s.description).length<o){let n=E(e,`shortMetadata`,`low`);n!==`off`&&t.push({file:u,level:n,message:`Description is very short.`,suggestion:`Descriptions should ideally be at least ${o} characters.`})}}catch(n){if(n instanceof Error){let r=E(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=E(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 R(e){let t=[],{internal:n,external:r,ignore:a,timeout:o,concurrency:l}=e.doctorConfig.checks.links;if(!n&&!r&&!e.options.checkExternal)return t;let d=/(?:\[.*?\]\((.*?)\))|(?:href=["']([^"']+)["'])/g,f=new Set,p=5e5;for(let o of e.files){let l=i(s.relative(e.docsDir,o)),{content:u}=await k(o),m=[...(u.length>p?u.slice(0,p):u).replace(/```[\s\S]*?```/g,``).replace(/`[^`\n]*`/g,``).matchAll(d)];for(let i of m){let u=i[1]||i[2],d=!!i[1];if(!u||a.some(e=>u.includes(e)))continue;if(/^https?:\/\//i.test(u)){(r||e.options.checkExternal)&&f.add({url:u,file:o});continue}if(!n||/^(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=s.join(e.docsDir,n),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>j(h+e))}}else h=s.resolve(s.dirname(o),p),m=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`].some(e=>j(h+e));if(!m){let{bestMatch:n,similarity:r}=I(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 s=r>.6||i,f=r>.75&&n!==p||i,m=E(e,`brokenLink`,`high`);m!==`off`&&t.push({file:l,level:m,message:`Broken internal link: "${u}"`,suggestion:s?`Did you mean "${n}"?`:`Ensure the target exists or check for typos.`,fix:f?async()=>{let e=u.includes(`#`)?`#`+u.split(`#`)[1]:``,t=d?`(${u})`:`href="${u}"`,r=d?`(${n}${e})`:`href="${n}${e}"`,i=c.readFileSync(o,`utf-8`).replace(t,r);c.writeFileSync(o,i),O.delete(o)}:void 0})}}}if(f.size>0){h(u.gray(`Verifying ${f.size} external links...`));let n=new Map;for(let e of f)n.has(e.url)||n.set(e.url,[]),n.get(e.url).push(e.file);let r=async e=>{try{let t=new AbortController,n=setTimeout(()=>t.abort(),o),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(n.keys()),c=[];for(let e=0;e<a.length;e+=l){let t=a.slice(e,e+l),n=await Promise.allSettled(t.map(r));c.push(...n.map(e=>e.status===`fulfilled`?e.value:{url:`unknown`,ok:!1,error:e.reason}))}for(let r of c)if(!r.ok){let a=E(e,`brokenLink`,`warning`);if(a!==`off`){let o=n.get(r.url)||[];for(let n of o)t.push({file:i(s.relative(e.docsDir,n)),level:a,message:`Broken external link: "${r.url}"`,suggestion:`Verify the URL or update it if it's permanently down. Error: ${r.error||`Status >= 400`}`})}}}return t}async function z(e){let t=[];if(!e.doctorConfig.checks.i18n.enabled||!e.config.i18n)return t;let{defaultLocale:n,locales:r}=e.config.i18n,a=Object.keys(r),o=a.filter(e=>e!==n);for(let r of e.files){let l=i(s.relative(e.docsDir,r)),u=l.split(`/`),d=u[0];if(d===n){let n=u.slice(1).join(`/`);for(let i of o){let a=s.join(e.docsDir,i,n);if(!j(a)){let o=E(e,`missingTranslation`,`warning`);o!==`off`&&t.push({file:l,level:o,message:`Missing translation for locale "${i}"`,suggestion:`Create a version at "${i}/${n}".`,fix:async()=>{let e=s.dirname(a);c.existsSync(e)||c.mkdirSync(e,{recursive:!0}),c.copyFileSync(r,a)}})}}}else if(a.includes(d)){let i=u.slice(1).join(`/`);if(!j(s.join(e.docsDir,n,i))){let a=E(e,`missingTranslation`,`low`);a!==`off`&&t.push({file:l,level:a,message:`Orphaned translation (source missing in "${n}")`,suggestion:`Remove this file or create the source at "${n}/${i}".`,fix:async()=>{c.unlinkSync(r)}})}}}return t}async function B(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=E(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}=I(r.link,e.linkTree.routes),a=i>.6,o=E(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=E(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 V(e){let t=[],n=e.doctorConfig.checks.performance;if(!n?.enabled)return t;let r=s.resolve(e.root,`.boltdocs`,`reports`,`performance.json`);if(!c.existsSync(r))return t.push({file:`(build)`,level:E(e,`budgetExceeded`,`warning`),message:"Performance metrics not found. Run `boltdocs build` first."}),t;let i;try{i=JSON.parse(c.readFileSync(r,`utf-8`))}catch{return t.push({file:`(build)`,level:E(e,`budgetExceeded`,`warning`),message:`Failed to parse performance metrics file.`}),t}let a=n.budgets,o=E(e,`budgetExceeded`,`warning`),l=T(a?.maxJSBundleSize,1/0),u=T(a?.maxCSSBundleSize,1/0),d=T(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:o,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:o,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:o,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:o,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:o,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:o,message:`Font files exceed budget: ${i.fontCount} > ${m}`,suggestion:`Reduce the number of font families or use variable fonts.`}),t}var H=e({DEFAULT_DOCTOR_CONFIG:()=>w,checkI18n:()=>z,checkLinks:()=>R,checkMetadata:()=>L,checkPerformance:()=>V,checkSidebar:()=>B,doctorAction:()=>W,doctorInit:()=>U,generateLinkTree:()=>N,loadDoctorConfig:()=>M});async function U(e){let t=s.resolve(e,`doctor.json`);if(c.existsSync(t)){b(`"doctor.json" already exists at ${e}.`);return}try{c.writeFileSync(t,JSON.stringify(w,null,2)),v(`Created "doctor.json" with default configuration.`)}catch(e){m(`Failed to create "doctor.json": ${e}`)}}async function W(e=process.cwd(),t={}){if(t.init){await U(e);return}o();try{let n=await M(e),{format:r}=n.reporting,i=performance.now(),o=await a(`docs`,e),b=s.resolve(e,`docs`);c.existsSync(b)||(r===`pretty`&&m(`Docs dir not found at ${b}`),process.exit(1)),r===`pretty`&&console.log(p([` ${u.dim(`Docs dir:`)} ${b}`,` ${u.dim(`Reports:`)} ${e}/.boltdocs/reports/`],{title:`✦ DOCTOR — Documentation Health Check`})),r===`pretty`&&h(u.dim(`🔍 Discovering files and routes...`));let C=S(n.exclude||[]),w=await new x().withFullPaths().filter(e=>{if(!(e.endsWith(`.md`)||e.endsWith(`.mdx`)))return!1;let t=s.relative(b,e).replace(/\\/g,`/`),n=t.split(`/`).some(e=>e.startsWith(`_`)&&e!==`_index.md`&&e!==`_index.mdx`);return!C(t)&&!n}).crawl(b).withPromise();for(let e of w)A.set(e,!0);let T=await N(b,e,o,w),E=o.base||`/`,O=E===`/`?``:E.endsWith(`/`)?E.slice(0,-1):E,k={root:e,docsDir:b,config:o,doctorConfig:n,linkTree:T,files:w,options:t,routeIndex:new Set(T.routes),routeIndexWithSlash:new Set(T.routes.map(e=>e.endsWith(`/`)?e:e+`/`)),routeIndexWithoutSlash:new Set(T.routes.map(e=>e.endsWith(`/`)?e.slice(0,-1):e)),basePrefix:O};r===`pretty`&&h(u.dim(`🧪 Running diagnostic checks in parallel...`));let j=[L(k),R(k),z(k),B(k)];t.budget&&j.push(V(k));let[P,F,I,H,...U]=await Promise.all(j),W=t.budget?U[0]:[],G=[...P,...F,...I,...H,...W];if(r===`pretty`){let e=[{label:`Metadata checks ${P.length>0?`— ${P.length} issue${P.length===1?``:`s`}`:`— OK`}`,done:P.length===0},{label:`Link checks ${F.length>0?`— ${F.length} issue${F.length===1?``:`s`}`:`— OK`}`,done:F.length===0},{label:`i18n checks ${I.length>0?`— ${I.length} issue${I.length===1?``:`s`}`:`— OK`}`,done:I.length===0},{label:`Sidebar checks ${H.length>0?`— ${H.length} issue${H.length===1?``:`s`}`:`— OK`}`,done:H.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${y(e)}`)}let K=0;if(t.fix){for(let e of G)if(e.fix){if(k.doctorConfig.fix.confirmChanges&&!await d(`Fix issue in "${e.file}": ${e.message}?`))continue;if(k.doctorConfig.fix.backupFiles){let t=s.resolve(k.docsDir,e.file);c.existsSync(t)&&await D(t,s.resolve(k.root,k.doctorConfig.fix.backupPath))}await e.fix(),K++}}let q=((performance.now()-i)/1e3).toFixed(2),J=G.filter(e=>e.level===`high`).length,Y=G.filter(e=>e.level===`warning`).length,X=G.filter(e=>e.level===`low`).length,Z={summary:{total:G.length,high:J,warning:Y,low:X,fixed:K,duration:q},issues:G.map(e=>({...e,fix:void 0}))};if(n.reporting.outputFile){let t=s.resolve(e,n.reporting.outputFile);c.existsSync(s.dirname(t))||c.mkdirSync(s.dirname(t),{recursive:!0}),c.writeFileSync(t,JSON.stringify(Z,null,2))}if(r===`json`)console.log(JSON.stringify(Z,null,2));else if(r===`pretty`){let e=G.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(t),e),{});if(G.length>0){f();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`?u.red:n.level===`warning`?u.yellow:u.blue;e.push(`${r} ${i(n.level.toUpperCase())}: ${n.message}`),n.suggestion&&e.push(` ${u.dim(`💡 ${n.suggestion}`)}`),t.fix&&n.fix&&e.push(` ${u.green(`✅ Fixed automatically`)}`)}console.log(`\n${_(e,{title:`📄 ${n}`})}`)}f()}if(G.length===0)console.log(g([` Everything looks perfect!`,` Your documentation is in great shape.`,``,` ${u.dim(`Scanned ${w.length} file${w.length===1?``:`s`} in ${q}s`)}`],{title:`✨ Documentation Health Check`}));else{let e=[];J>0&&e.push(u.red(`${J} Critical Error${J===1?``:`s`}`)),Y>0&&e.push(u.yellow(`${Y} Warning${Y===1?``:`s`}`)),X>0&&e.push(u.blue(`${X} Improvement${X===1?``:`s`}`));let t=[...l(e).split(`
7
- `).map(e=>e.trimStart()),``,u.dim(`Scanned ${w.length} file${w.length===1?``:`s`} in ${q}s`)];console.log(`\n${p(t,{title:`Diagnosis Results`})}\n`),K>0&&v(`Successfully fixed ${K} issues automatically!`),J>0?m(`Please fix the critical errors before building for production.`):v(`No critical issues found. You are ready to go!`)}}n.reporting.failOnError&&J>0&&process.exit(1),n.reporting.maxWarnings!==-1&&Y>n.reporting.maxWarnings&&(r===`pretty`&&m(`Failed: Too many warnings (${Y} > ${n.reporting.maxWarnings})`),process.exit(1))}catch(e){m(`Doctor failed: ${e}`),process.exit(1)}}export{N as n,H as t};
@@ -1,28 +0,0 @@
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};
@@ -1,6 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- import{t as e}from"./handler-CyIBbZdb.mjs";export{e as handleFeedback};
@@ -1,6 +0,0 @@
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}from"./node-JQ6C-CBi.mjs";var t=e({SECURITY_HEADERS:()=>n});const n={"X-Content-Type-Options":`nosniff`,"X-Frame-Options":`DENY`,"X-XSS-Protection":`1; mode=block`,"Referrer-Policy":`strict-origin-when-cross-origin`,"Permissions-Policy":`camera=(), microphone=(), geolocation=()`,"Strict-Transport-Security":`max-age=31536000; includeSubDomains`};export{t as n,n as t};
@@ -1,6 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- require(`../../chunk-Ds5LZdWN.cjs`);const e=require(`../../parser-CLtGv_XH.cjs`);let t=require(`node:worker_threads`);if(!t.parentPort)throw Error(`This file must be run as a worker thread.`);t.parentPort.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e.t(n.file,n.docsDir,n.basePath,n.config);t.parentPort?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t.parentPort?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});
@@ -1,2 +0,0 @@
1
-
2
- export { };
@@ -1,2 +0,0 @@
1
-
2
- export { };
@@ -1,6 +0,0 @@
1
- /**
2
- * Boltdocs - https://boltdocs.vercel.app
3
- * Copyright (c) 2026 Jesus Alcala
4
- * Licensed under the MIT License.
5
- */
6
- import{n as e}from"../../parser-Ww0eOqs7.mjs";import{parentPort as t}from"node:worker_threads";if(!t)throw Error(`This file must be run as a worker thread.`);t.on(`message`,async n=>{if(n.type===`PARSE_FILE`)try{let r=await e(n.file,n.docsDir,n.basePath,n.config);t?.postMessage({type:`SUCCESS`,file:n.file,result:r})}catch(e){t?.postMessage({type:`ERROR`,file:n.file,error:e.message||`Unknown parsing error`})}});export{};