docfuse 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Docfuse Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Docfuse
2
+
3
+ English | [简体中文](./README.zh-CN.md)
4
+
5
+ Docfuse is a static documentation CLI for Markdown, MDX, and project-local React components. It builds navigation, search, multilingual routes, versioned pages, and AI-readable artifacts into deployable static HTML.
6
+
7
+ ## Install
8
+
9
+ Node.js 22 or newer is required. Install Docfuse as a project-local development dependency:
10
+
11
+ ```bash
12
+ pnpm add -D docfuse
13
+ pnpm exec docfuse init --locale en
14
+ pnpm exec docfuse dev
15
+ ```
16
+
17
+ `init` creates `docs/` and a typed `docfuse.config.ts`. Add the commands you use regularly to `package.json`; use `pnpm exec docfuse ...` for an ad-hoc local invocation.
18
+
19
+ ## Commands
20
+
21
+ - `init` creates or adopts a documentation project.
22
+ - `dev` starts the development server.
23
+ - `check` validates configuration, content, routes, and plugin-owned syntax.
24
+ - `build` writes the production site to `.docfuse/dist/`.
25
+ - `preview` serves the production output locally.
26
+ - `clean` removes generated output and persistent build state.
27
+ - `deploy` writes deployment guidance for the current project.
28
+
29
+ Docfuse is a build tool, not a sandbox. MDX, local components, configuration, and extensions execute with build-process permissions and must come from reviewed sources.
30
+
31
+ See the [Docfuse documentation](https://docfuse.dev/en/guide/) for authoring, configuration, deployment, and troubleshooting.
32
+
33
+ License: MIT
@@ -0,0 +1,33 @@
1
+ # Docfuse
2
+
3
+ [English](./README.md) | 简体中文
4
+
5
+ Docfuse 是一个面向 Markdown、MDX 和项目本地 React 组件的静态文档 CLI。它负责生成导航、搜索、多语言路由、版本页面和 AI 可读产物,最终输出可直接部署的静态 HTML。
6
+
7
+ ## 安装
8
+
9
+ 要求 Node.js 22 或更高版本。建议把 Docfuse 安装为项目本地开发依赖:
10
+
11
+ ```bash
12
+ pnpm add -D docfuse
13
+ pnpm exec docfuse init
14
+ pnpm exec docfuse dev
15
+ ```
16
+
17
+ `init` 会创建 `docs/` 和带类型提示的 `docfuse.config.ts`。常用命令应写进 `package.json`;临时调用本地版本时使用 `pnpm exec docfuse ...`。
18
+
19
+ ## 命令
20
+
21
+ - `init` 创建文档项目或接管已有文档。
22
+ - `dev` 启动开发服务器。
23
+ - `check` 检查配置、内容、路由和插件拥有的语法。
24
+ - `build` 把生产站点写入 `.docfuse/dist/`。
25
+ - `preview` 在本地预览生产产物。
26
+ - `clean` 删除生成产物和持久化构建状态。
27
+ - `deploy` 根据当前项目生成部署说明。
28
+
29
+ Docfuse 是构建工具,不是沙箱。MDX、本地组件、配置和 Extension 都会以构建进程的权限执行,只能使用经过审核的源码。
30
+
31
+ 使用方法、配置、部署和故障排查见 [Docfuse 文档](https://docfuse.dev/guide/)。
32
+
33
+ 许可证:MIT
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-N26MW2YK.js";import"./chunk-M47X2MM3.js";import"./chunk-GNYJERGG.js";import"./chunk-XYJ2OBL3.js";import"./chunk-S36HQTIA.js";import"./chunk-DOOG32NU.js";import"./chunk-5NTRNUFG.js";import"./chunk-GRQDPV4U.js";import"./chunk-EAYVCA3Z.js";import"./chunk-JK7ZNBUA.js";import"./chunk-AYDF3IFZ.js";export{b as runBuild,a as versionSatisfies};
2
+ //# sourceMappingURL=build-X3KCJUYB.js.map
@@ -0,0 +1,3 @@
1
+ import{e as I,j as b,k as M}from"./chunk-M47X2MM3.js";import"./chunk-GNYJERGG.js";import"./chunk-XYJ2OBL3.js";import{a as C,b as S,j as P}from"./chunk-DOOG32NU.js";import"./chunk-GRQDPV4U.js";import"./chunk-EAYVCA3Z.js";import{d as $}from"./chunk-JK7ZNBUA.js";import{a}from"./chunk-AYDF3IFZ.js";import{mkdtemp as W,readdir as V,rm as N}from"fs/promises";import{tmpdir as Q}from"os";import{join as O,relative as K}from"path";import{posix as y}from"path";import{analyzeMarkdown as w}from"@docfuse/markdown/server/analyze";function E(e){return Array.from({length:w(e).missingCodeBlockLanguages},()=>({severity:"warning",message:"Code block is missing a language"}))}a(E,"checkCodeBlockLanguages");function H(e,n=0,o=[]){return w(e,{plugins:o}).directiveIssues.map(r=>({severity:"error",message:`${r.message}${r.line===void 0?"":` (line ${r.line+n}${r.column===void 0?"":`, column ${r.column}`})`}`}))}a(H,"checkRichDirectiveSyntax");function R(e){return typeof e.description=="string"&&e.description.trim()?[]:[{severity:"warning",message:"Frontmatter description is missing"}]}a(R,"checkFrontmatterDescription");function B(e,n){return typeof e.title=="string"&&e.title.trim()?[]:[{severity:"warning",page:n.relativePath,message:"Frontmatter title is missing"}]}a(B,"checkFrontmatterTitle");function L(e){return/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(e)}a(L,"isExternalTarget");function D(e){let n=e.indexOf("#"),o=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n+1);return{path:o.split("?")[0]??"",fragment:r}}a(D,"splitTarget");function A(e){try{return decodeURIComponent(e)}catch{return}}a(A,"decodeFragment");function F(e,n){let o=n.split("/").map(r=>{let i=decodeURIComponent(r);if(i.includes("/")||i.includes("\\"))throw new Error("Encoded path separator");return i}).join("/");return y.normalize(y.join(y.dirname(e),o.replace(/^\.\//,"")))}a(F,"resolveRelativeTarget");function j(e){try{return`public${e.split("/").map(o=>{let r=decodeURIComponent(o);if(r.includes("/")||r.includes("\\")||r==="..")throw new Error("Invalid public path");return r}).join("/")}`}catch{return}}a(j,"publicFileFor");function T(e){return e.replace(/\.(?:md|mdx)$/i,n=>n.toLocaleLowerCase("en-US"))}a(T,"markdownExtensionKey");function z(e,n,o="",r=new Set,i=new Set,u=new Map,m=new Map,f=new Set){let c=[],k=w(e),h=new Map([...n].filter(t=>/\.(?:md|mdx)$/i.test(t)).map(t=>[T(t),t]));for(let t of k.images){let s=D(t).path;if(!s||L(s))continue;if(s.startsWith("/")){n.has(j(s)??"")||c.push({severity:"error",message:`Image target does not exist: ${s}`});continue}let g;try{g=F(o,s)}catch{c.push({severity:"error",message:`Image target does not exist: ${s}`});continue}n.has(g)||c.push({severity:"error",message:`Image target does not exist: ${s}`})}for(let t of k.links){let{path:s,fragment:g}=D(t),p=A(g);if(L(s))continue;if(!s){g&&(!p||!i.has(p))&&c.push({severity:"error",message:`Heading target does not exist: #${g}`});continue}if(s.startsWith("/")){if(n.has(j(s)??""))continue;let d;try{d=S(s)}catch{c.push({severity:"error",message:`Link target does not exist: ${s}`});continue}if(f.has(d))continue;let x=d==="/"?"/":`${d.replace(/\/+$/,"")}/`;r.has(x)?g&&(!p||!u.get(x)?.has(p))&&c.push({severity:"error",message:`Heading target does not exist: ${t}`}):c.push({severity:"error",message:`Link target does not exist: ${s}`});continue}let l;try{l=F(o,s)}catch{c.push({severity:"error",message:`Link target does not exist: ${s}`});continue}let v=(/\.mdx?$/i.test(l)?[l]:[l,`${l}.md`,`${l}.mdx`,y.join(l,"index.md"),y.join(l,"index.mdx")]).map(d=>n.has(d)?d:h.get(T(d))).find(d=>!!d);v?g&&(!p||!m.get(v)?.has(p))&&c.push({severity:"error",message:`Heading target does not exist: ${t}`}):c.push({severity:"error",message:`Link target does not exist: ${s}`})}return c}a(z,"checkLinksAndImages");function U(e){let n=new Map;for(let o of e.headings){let r=o.text.normalize("NFKC").replace(/\s+/g," ").trim().toLocaleLowerCase(e.locale);r&&n.set(r,[...n.get(r)??[],o])}return[...n.values()].filter(o=>o.length>1).map(o=>{let r=o[0];return{severity:"warning",page:e.relativePath,message:`Repeated heading "${r.text}" uses numbered anchors (${o.map(i=>`#${i.slug}`).join(", ")})`}})}a(U,"checkDuplicateHeadings");function G(e){let n=new Map;for(let r of e.pages){let i=`${r.version}:${C(r.relativePath,r.locale)}`;n.set(i,(n.get(i)??new Set).add(r.locale))}let o=[];for(let[r,i]of n)for(let u of e.locales)if(!i.has(u)){let[m,...f]=r.split(":");o.push({severity:"warning",message:`Missing ${u} translation for ${f.join(":")} in version ${m}`})}return o}a(G,"checkMissingTranslations");async function q(e){let n=new Set;async function o(r){let i=await V(r,{withFileTypes:!0});for(let u of i){let m=O(r,u.name);if(u.isDirectory())await o(m);else{if(u.isSymbolicLink())throw new Error(`Documentation files must not use symbolic links: ${K(e,m)}`);n.add(K(e,m).replace(/\\/g,"/"))}}}return a(o,"walk"),await o(e),n}a(q,"collectFiles");function J(e){if(!e.body)return 0;let n=e.transformedSource.lastIndexOf(e.body);return n<0?0:e.transformedSource.slice(0,n).split(`
2
+ `).length-1}a(J,"bodyLineOffset");async function me({cwd:e}){let n=await P(e),o=await W(O(Q(),"docfuse-check-")),r=await M(e,o,n.extensions).finally(()=>N(o,{recursive:!0,force:!0})),i=await I(e,n,r),u=new Set([...b(n,i),...r.publicOutputPaths]),m=new Map(await Promise.all(n.versions.items.map(async t=>[t.id,await q($(e,t.docsDir,`versions.items[${t.id}].docsDir`))]))),f=new Set(i.pages.map(t=>t.routePath)),c=new Map(i.pages.map(t=>[t.routePath,new Set(t.headings.map(s=>s.slug))])),k=new Map(i.versions.map(t=>[t.id,new Map(i.pages.filter(s=>s.version===t.id).map(s=>[s.relativePath,new Set(s.headings.map(g=>g.slug))]))])),h=[...i.pages.flatMap(t=>[...E(t.body).map(s=>({...s,page:t.relativePath})),...H(t.body,J(t),n.markdown.plugins).map(s=>({...s,page:t.relativePath})),...B(t.frontmatter,t),...R(t.frontmatter).map(s=>({...s,page:t.relativePath})),...z(t.body,m.get(t.version)??new Set,t.relativePath,f,new Set(t.headings.map(s=>s.slug)),c,k.get(t.version),u).map(s=>({...s,page:t.sourceRelativePath})),...U(t)]),...G(i)];for(let t of h){let s=t.page?` ${t.page}`:"";console.log(`${t.severity.toUpperCase()}:${s} ${t.message}`)}return h.some(t=>t.severity==="error")&&(process.exitCode=1),h}a(me,"runCheck");export{me as runCheck};
3
+ //# sourceMappingURL=check-RJPHTGI6.js.map
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-AYDF3IFZ.js";function e(o){console.log(`[docfuse] ${o}`)}n(e,"logInfo");function c(o,...r){console.error(`[docfuse] ${o}`,...r)}n(c,"logError");export{e as a,c as b};
2
+ //# sourceMappingURL=chunk-5NTRNUFG.js.map
@@ -0,0 +1,2 @@
1
+ var c=Object.defineProperty;var d=(a,b)=>c(a,"name",{value:b,configurable:!0});export{d as a};
2
+ //# sourceMappingURL=chunk-AYDF3IFZ.js.map
@@ -0,0 +1,2 @@
1
+ import{d as D}from"./chunk-EAYVCA3Z.js";import{a as v,b as w}from"./chunk-JK7ZNBUA.js";import{a}from"./chunk-AYDF3IFZ.js";import{randomUUID as no}from"crypto";import{mkdir as io,mkdtemp as ro,rm as so,writeFile as ao}from"fs/promises";import{join as f}from"path";import{fileURLToPath as R,pathToFileURL as lo}from"url";import{build as co}from"esbuild";import{posix as u}from"path";function j(t){return t.replace(/\\/g,"/")}a(j,"normalizeRoutePath");function yo(t,e){let n=j(t),r=n.split("/");return r[0]===e?r.slice(1).join("/"):n}a(yo,"localeRelativePathFor");function p(t){if(!t.startsWith("/")||t!=="/"&&t.includes("//")||/[\\?#\u0000-\u001f]/.test(t))throw new Error(`Invalid route path: "${t}"`);for(let e of t.split("/")){let n;try{n=decodeURIComponent(e)}catch{throw new Error(`Invalid route path: "${t}"`)}if(n==="."||n===".."||n.includes("/")||n.includes("\\")||/[\u0000-\u001f]/.test(n))throw new Error(`Invalid route path: "${t}"`)}return t}a(p,"assertRoutePath");function d(t){return p(t),t.split("/").map(e=>e?encodeURIComponent(decodeURIComponent(e).normalize("NFC")):"").join("/")}a(d,"canonicalRoutePath");function T(t){let e=d(t);return e==="/"?"/":`/${e.replace(/^\/+|\/+$/g,"")}/`}a(T,"normalizedBase");function C(t){let e=j(t);if(e.startsWith("/")||/[?#\u0000-\u001f]/.test(e))throw new Error(`Invalid page path: "${t}"`);if(e.split("/").some(s=>s==="."||s===".."||s===""))throw new Error(`Invalid page path: "${t}"`);let r=D(e),i=/^index$/i.test(r)?"":r.replace(/\/index$/i,"");return i?i.split("/"):[]}a(C,"pageSegments");function U(t){return C(t).map(e=>encodeURIComponent(e)).join("/")}a(U,"pageRoute");function E(t){return C(t).join("/")}a(E,"pageOutputPath");function x(t,e,n="/"){let r=T(n);return t===e?r:`${r}${t}/`}a(x,"localeRootPath");function M(t,e,n="/"){return[T(n).replace(/^\/|\/$/g,""),t===e?"":t].filter(Boolean).join("/")}a(M,"localeOutputPrefix");function ko(t,e,n,r="/"){let i=U(n);return i?`${x(t,e,r)}${i}/`:x(t,e,r)}a(ko,"routePathFor");function So(t,e,n,r="/"){let i=E(n),s=M(t,e,r);return i?u.join(s,i,"index.html"):u.join(s,"index.html")}a(So,"htmlOutputPathFor");function Do(t,e,n,r="/"){let i=E(n),s=M(t,e,r);return i?u.join(s,i,"index.md"):u.join(s,"index.md")}a(Do,"markdownOutputPathFor");function vo(t){let e=p(t).replace(/^\/+|\/+$/g,"");return e?u.join(...e.split("/").map(n=>decodeURIComponent(n)),"index.html"):"index.html"}a(vo,"routeOutputPathFor");var z={title:"Docfuse",description:"Technical documentation",basePath:"/",docsDir:"docs",outputDir:".docfuse/dist",styles:[],layout:{header:!0},markdown:{html:"sanitize",code:{},features:{},labels:{},plugins:[]},theme:{accentColor:"docfuse",darkMode:!1,radius:8,baseColor:"paper",sidebarWidth:"17.5rem",outlineWidth:"18.75rem",tokens:{}},search:{enabled:!0,provider:"compact"},extensions:[],navigation:{},versions:{current:"current",items:[{id:"current",label:"Current",docsDir:"docs",base:"/"}]},redirects:{},i18n:{defaultLocale:"zh",locales:["zh"],localeNames:{},messages:{}},ai:{llmsTxt:!0,llmsFullTxt:!0,markdownIndex:!0,pageSummaries:!0,codeExamples:!0,chunkSizeBytes:262144,llmsFullMaxBytes:10485760,llmsFullOverflow:"manifest",versions:"current"}};import{z as o}from"zod";var P=["paper","neutral","slate","zinc","stone"];import{z as G}from"zod";var m=G.string().min(1).refine(t=>{if(t.startsWith("/")){if(t.startsWith("//"))return!1;try{return p(t),!0}catch{return!1}}try{let e=new URL(t);return e.protocol==="https:"&&!e.username&&!e.password}catch{return!1}},"Resource must be an absolute site path or HTTPS URL").transform(t=>t.startsWith("/")?d(t):t);var O=o.object({canvas:o.string().optional(),foreground:o.string().optional(),text:o.string().optional(),muted:o.string().optional(),mutedSubtle:o.string().optional(),surface:o.string().optional(),surfaceSecondary:o.string().optional(),surfaceSoft:o.string().optional(),surfaceElevated:o.string().optional(),border:o.string().optional(),borderStrong:o.string().optional(),hairline:o.string().optional(),primary:o.string().optional(),primarySoft:o.string().optional(),primaryForeground:o.string().optional(),primaryDeep:o.string().optional(),accent:o.string().optional(),info:o.string().optional(),infoDeep:o.string().optional(),success:o.string().optional(),successDeep:o.string().optional(),warning:o.string().optional(),warningDeep:o.string().optional(),danger:o.string().optional(),dangerDeep:o.string().optional(),codeBackground:o.string().optional(),codeForeground:o.string().optional(),overlay:o.string().optional(),shadow:o.string().optional(),shadowSmall:o.string().optional()}).strict().optional(),N=o.object({displayFont:o.string().min(1).optional(),sansFont:o.string().min(1).optional(),monoFont:o.string().min(1).optional(),bodySize:o.string().min(1).optional(),bodyLineHeight:o.string().min(1).optional(),headingLineHeight:o.string().min(1).optional(),heading1Size:o.string().min(1).optional(),heading2Size:o.string().min(1).optional(),heading3Size:o.string().min(1).optional(),heading4Size:o.string().min(1).optional(),heading5Size:o.string().min(1).optional(),heading6Size:o.string().min(1).optional()}).strict().optional(),A=o.object({readingWidth:o.string().min(1).optional(),contentWidth:o.string().min(1).optional(),gutter:o.string().min(1).optional()}).strict().optional(),W=o.object({radiusSmall:o.string().min(1).optional(),radiusMedium:o.string().min(1).optional(),radiusLarge:o.string().min(1).optional(),radiusFull:o.string().min(1).optional()}).strict().optional(),B=o.object({durationFast:o.string().min(1).optional(),durationNormal:o.string().min(1).optional(),easing:o.string().min(1).optional()}).strict().optional(),_=o.object({colors:o.object({light:O,dark:O}).strict().optional(),typography:N,layout:A,geometry:W,motion:B}).strict(),Z=o.object({themes:o.object({light:o.string().min(1).optional(),dark:o.string().min(1).optional()}).strict().optional(),fallbackLanguage:o.string().min(1).optional(),unknownLanguage:o.enum(["warn","error","plain-text"]).optional()}).strict(),V=o.object({callouts:o.boolean().optional(),tabs:o.boolean().optional(),codeGroups:o.boolean().optional(),steps:o.boolean().optional(),terminals:o.boolean().optional(),documentBlocks:o.boolean().optional(),tables:o.boolean().optional(),codeBlocks:o.boolean().optional()}).strict(),F=o.object({copyCode:o.string().optional(),copyFailed:o.string().optional(),copySnippet:o.string().optional(),copyTerminal:o.string().optional(),terminalTitle:o.string().optional(),tabsTitle:o.string().optional(),tabItem:o.string().optional(),codeGroupTitle:o.string().optional(),codeGroupItem:o.string().optional(),taskCompleted:o.string().optional(),taskIncomplete:o.string().optional(),copySectionLink:o.string().optional(),tableTitle:o.string().optional(),copyTableCsv:o.string().optional(),downloadTableCsv:o.string().optional(),zoomTable:o.string().optional(),closeTablePreview:o.string().optional(),sortTableColumn:o.string().optional(),zoomImage:o.string().optional(),closeImagePreview:o.string().optional(),imageGallery:o.string().optional(),closeImageGallery:o.string().optional(),previousGalleryImage:o.string().optional(),nextGalleryImage:o.string().optional(),galleryThumbnails:o.string().optional(),galleryImage:o.string().optional()}).strict(),q=o.object({skipToContent:o.string().optional(),search:o.string().optional(),searchEmpty:o.string().optional(),searchUnavailable:o.string().optional(),language:o.string().optional(),primaryNavigation:o.string().optional(),theme:o.string().optional(),openSidebar:o.string().optional(),onThisPage:o.string().optional(),edit:o.string().optional(),updated:o.string().optional(),previous:o.string().optional(),next:o.string().optional(),close:o.string().optional(),source:o.string().optional(),preview:o.string().optional(),copySource:o.string().optional(),sourceCopied:o.string().optional(),quickActions:o.string().optional(),github:o.string().optional(),docsNavigation:o.string().optional(),pageNavigation:o.string().optional(),advertisement:o.string().optional(),version:o.string().optional()}).strict(),H=o.object({headingsTitle:o.string().optional(),headingsDescription:o.string().optional(),codeTitle:o.string().optional(),codeDescription:o.string().optional(),tableTitle:o.string().optional(),tableDescription:o.string().optional(),diagramTitle:o.string().optional(),diagramDescription:o.string().optional(),sourceDescription:o.string().optional(),themeDescription:o.string().optional()}).strict(),K=o.object({title:o.string().optional(),description:o.string().optional(),home:o.string().optional()}).strict(),c=o.object({label:o.string().optional(),detail:o.string().optional(),hash:o.string().optional()}).strict(),J=o.object({headings:c.optional(),inline:c.optional(),lists:c.optional(),callouts:c.optional(),code:c.optional(),tables:c.optional(),media:c.optional(),diagrams:c.optional(),disclosure:c.optional(),extensions:c.optional(),api:c.optional(),metadata:c.optional()}).strict(),Q=o.object({labels:q.optional(),brandTagline:o.string().optional(),quickActions:H.optional(),markdownElementGroups:J.optional(),markdown:F.optional(),notFound:K.optional()}).strict(),h=o.string().min(1).refine(t=>{try{return p(t),!0}catch{return!1}},"Route must be a safe absolute path").transform(d),y=o.string().url().refine(t=>{let e=new URL(t);return(e.protocol==="https:"||e.protocol==="http:")&&!e.username&&!e.password&&!e.search&&!e.hash},"URL must use HTTP(S) without credentials, a query, or a hash"),X=y.refine(t=>new URL(t).pathname==="/",{message:"siteUrl must be an HTTP(S) origin without a path"}),I=o.string().min(1).regex(/^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/,"Version id must be a safe portable slug"),Y=o.object({enabled:o.boolean().optional(),provider:o.union([o.literal("compact"),o.custom(t=>typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.id=="string"&&(t.client==="compact"||t.client==="pagefind")&&typeof t.write=="function","search.provider must be compact or a SearchProvider object")]).optional()}).strict(),k=o.lazy(()=>o.union([o.string(),o.number().finite(),o.boolean(),o.null(),o.array(k),o.record(k)])),oo=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,to=o.custom(t=>typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.name=="string"&&oo.test(t.name),"markdown.plugins entries must be plugin objects with a lowercase kebab-case name"),eo=o.object({resolve:o.string().min(1).regex(/^\.[\\/]/,"Extension resolve must be a project-relative path beginning with ./"),options:o.record(k).optional()}).strict(),L=o.object({title:o.string().min(1).optional(),description:o.string().optional(),siteUrl:X.optional(),basePath:h.refine(t=>t.endsWith("/"),"basePath must end with /").optional(),editUrl:y.optional(),github:y.optional(),requiredVersion:o.string().optional(),docsDir:o.string().optional(),outputDir:o.string().optional(),styles:o.array(o.string().min(1)).optional(),layout:o.object({header:o.boolean().optional()}).strict().optional(),markdown:o.object({html:o.enum(["trusted","sanitize","strip"]).optional(),code:Z.optional(),features:V.optional(),labels:F.optional(),plugins:o.array(to).optional()}).strict().optional(),theme:o.object({logo:m.optional(),logoDark:m.optional(),favicon:m.optional(),accentColor:o.string().optional(),darkMode:o.boolean().optional(),radius:o.union([o.number(),o.string()]).optional(),baseColor:o.enum(P).optional(),sidebarWidth:o.union([o.number(),o.string()]).optional(),outlineWidth:o.union([o.number(),o.string()]).optional(),tokens:_.optional()}).strict().optional(),search:Y.optional(),extensions:o.array(eo).optional(),navigation:o.record(o.string(),o.array(o.object({text:o.string().min(1),link:m}).strict())).optional(),versions:o.object({current:I,items:o.array(o.object({id:I,label:o.string().min(1),docsDir:o.string().min(1),base:h}).strict()).min(1)}).strict().optional(),redirects:o.record(h,h).optional(),advertising:o.object({image:m,href:m,alt:o.string().min(1),label:o.string().min(1).optional()}).strict().optional(),i18n:o.object({defaultLocale:o.string().optional(),locales:o.array(o.string().min(1)).min(1).optional(),localeNames:o.record(o.string(),o.string().min(1)).optional(),messages:o.record(o.string(),Q).optional()}).strict().optional(),ai:o.object({llmsTxt:o.boolean().optional(),llmsFullTxt:o.boolean().optional(),markdownIndex:o.boolean().optional(),pageSummaries:o.boolean().optional(),codeExamples:o.boolean().optional(),chunkSizeBytes:o.number().int().min(16*1024).max(4*1024*1024).optional(),llmsFullMaxBytes:o.number().int().min(16*1024).max(1024*1024*1024).optional(),llmsFullOverflow:o.enum(["manifest","error"]).optional(),versions:o.enum(["current","all"]).optional()}).strict().optional()}).strict();var po=["docfuse.config.ts","docfuse.config.mts","docfuse.config.cts","docfuse.config.js","docfuse.config.mjs","docfuse.config.cjs"];function $(){return structuredClone(z)}a($,"cloneDefaultConfig");function mo(t){let e=$(),n=t.docsDir??e.docsDir,r=t.versions?{current:t.versions.current,items:t.versions.items.map(s=>({...s}))}:{current:"current",items:[{id:"current",label:"Current",docsDir:n,base:"/"}]},i=r.items.find(s=>s.id===r.current)?.docsDir??n;return{...e,...t,docsDir:i,styles:t.styles?[...t.styles]:e.styles,layout:{header:t.layout?.header??e.layout.header},markdown:{html:t.markdown?.html??e.markdown.html,code:{...e.markdown.code,...t.markdown?.code,themes:{...e.markdown.code.themes,...t.markdown?.code?.themes}},features:{...e.markdown.features,...t.markdown?.features},labels:{...e.markdown.labels,...t.markdown?.labels},plugins:t.markdown?.plugins?[...t.markdown.plugins]:e.markdown.plugins},theme:{...e.theme,...t.theme,tokens:{colors:{light:{...e.theme.tokens.colors?.light,...t.theme?.tokens?.colors?.light},dark:{...e.theme.tokens.colors?.dark,...t.theme?.tokens?.colors?.dark}},typography:{...e.theme.tokens.typography,...t.theme?.tokens?.typography},layout:{...e.theme.tokens.layout,...t.theme?.tokens?.layout},geometry:{...e.theme.tokens.geometry,...t.theme?.tokens?.geometry},motion:{...e.theme.tokens.motion,...t.theme?.tokens?.motion}}},search:{enabled:t.search?.enabled??e.search.enabled,provider:t.search?.provider??e.search.provider},extensions:(t.extensions??e.extensions).map(s=>({...s,...s.options?{options:structuredClone(s.options)}:{}})),navigation:Object.fromEntries(Object.entries(t.navigation??e.navigation).map(([s,l])=>[s,l.map(g=>({...g}))])),versions:r,redirects:{...e.redirects,...t.redirects},...t.advertising?{advertising:{...t.advertising}}:{},i18n:{...e.i18n,...t.i18n,locales:t.i18n?.locales?[...t.i18n.locales]:e.i18n.locales,localeNames:{...e.i18n.localeNames,...t.i18n?.localeNames},messages:{...e.i18n.messages,...t.i18n?.messages}},ai:{...e.ai,...t.ai}}}a(mo,"mergeConfig");function go(t){let{defaultLocale:e,locales:n,localeNames:r={},messages:i={}}=t.i18n;if(!n.includes(e))throw new Error(`i18n.defaultLocale "${e}" must be included in i18n.locales`);if(new Set(n.map(l=>l.toLowerCase())).size!==n.length)throw new Error("i18n.locales must not contain duplicate locales");for(let l of n)try{Intl.getCanonicalLocales(l)}catch{throw new Error(`Invalid locale identifier in i18n.locales: "${l}"`)}let s=new Set(n);for(let l of[...Object.keys(r),...Object.keys(i)])if(!s.has(l))throw new Error(`i18n resource key "${l}" must be included in i18n.locales`);for(let l of Object.keys(t.navigation))if(!s.has(l))throw new Error(`navigation key "${l}" must be included in i18n.locales`)}a(go,"assertI18nConfig");function uo(t){let e=t.versions.items.map(i=>i.id),n=t.versions.items.map(i=>i.base);if(!e.includes(t.versions.current))throw new Error(`versions.current "${t.versions.current}" must match a versions.items id`);if(new Set(e.map(w)).size!==e.length)throw new Error("versions.items must not contain portable-duplicate version ids");if(new Set(n.map(w)).size!==n.length)throw new Error("versions.items must not contain duplicate bases");for(let i of t.versions.items){try{p(i.base)}catch{throw new Error(`Version base "${i.base}" must be a safe absolute route ending in /`)}if(!i.base.endsWith("/")||i.base.includes("//"))throw new Error(`Version base "${i.base}" must be an absolute path ending in /`)}if(t.versions.items.find(i=>i.id===t.versions.current)?.base!=="/")throw new Error('The current documentation version must use base "/"')}a(uo,"assertVersionConfig");function ho(t){if(t.docsDir!==void 0&&t.versions!==void 0)throw new Error("docsDir cannot be combined with versions; set docsDir on each versions.items entry");if(t.theme?.logoDark&&!t.theme.logo)throw new Error("theme.logoDark requires theme.logo");if(t.theme?.logoDark&&t.theme.darkMode!==!0)throw new Error("theme.logoDark requires theme.darkMode: true")}a(ho,"assertEffectiveInput");async function fo(t){let e=[];for(let n of po){let r=f(t,n);await v(r)&&e.push(r)}if(e.length>1)throw new Error(`Multiple Docfuse configuration files found: ${e.map(n=>n.split(/[\\/]/).at(-1)).join(", ")}`);return e[0]}a(fo,"findConfigPath");async function Vo(t){let e=await fo(t);if(!e)return $();let n=f(t,".docfuse/tmp");await io(n,{recursive:!0});let r=await ro(f(n,"config-")),i=f(r,`${no()}.mjs`),s;try{let b;try{b=R(import.meta.resolve("docfuse"))}catch{b=R(new URL("../index.ts",import.meta.url))}let S=(await co({entryPoints:[e],absWorkingDir:t,alias:{docfuse:b},bundle:!0,format:"esm",platform:"node",target:"node22",external:["@docfuse/plugins"],write:!1,sourcemap:"inline"})).outputFiles[0];if(!S)throw new Error("Failed to bundle docfuse.config.ts");await ao(i,S.contents),s=await import(`${lo(i).href}?t=${Date.now()}`)}finally{await so(r,{recursive:!0,force:!0})}let l=L.parse(s.default??{});ho(l);let g=mo(l);return go(g),uo(g),g}a(Vo,"loadConfig");export{yo as a,d as b,x as c,ko as d,So as e,Do as f,vo as g,m as h,fo as i,Vo as j};
2
+ //# sourceMappingURL=chunk-DOOG32NU.js.map
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-AYDF3IFZ.js";var r=/\.(?:md|mdx)$/i;function e(t){return r.test(t)}n(e,"isMarkdownPath");function i(t){return/\.mdx$/i.test(t)}n(i,"isMdxPath");function o(t){return/^index\.(?:md|mdx)$/i.test(t)}n(o,"isMarkdownIndexName");function s(t){return t.replace(r,"")}n(s,"stripMarkdownExtension");export{e as a,i as b,o as c,s as d};
2
+ //# sourceMappingURL=chunk-EAYVCA3Z.js.map
@@ -0,0 +1,45 @@
1
+ import{b as N}from"./chunk-5NTRNUFG.js";import{c as j}from"./chunk-JK7ZNBUA.js";import{a as i}from"./chunk-AYDF3IFZ.js";import{createServer as I}from"http";import{readFile as H,realpath as k}from"fs/promises";import{extname as P,isAbsolute as $,join as v,normalize as O,relative as B,resolve as S,sep as L}from"path";var T={".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"text/javascript; charset=utf-8",".mjs":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".txt":"text/plain; charset=utf-8",".md":"text/markdown; charset=utf-8",".svg":"image/svg+xml",".xml":"application/xml; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".pagefind":"application/wasm"};function z(e){return T[P(e).toLowerCase()]??"application/octet-stream"}i(z,"contentTypeFor");var J=15e3;function U(e){for(let o of e)o.end();e.clear()}i(U,"closeReloadClients");function w(e,o){for(let n of e)try{n.write(o)}catch{e.delete(n);try{n.end()}catch{}}}i(w,"writeReloadClients");function M(e){w(e,`:keepalive
2
+
3
+ `)}i(M,"heartbeatReloadClients");function R(e,o=""){let n=o.replace(/\r\n?/g,`
4
+ `).split(`
5
+ `);return`event: ${e}
6
+ ${n.map(d=>`data: ${d}`).join(`
7
+ `)}
8
+
9
+ `}i(R,"formatServerSentEvent");function A(e,o="/__docfuse/events"){let n=`<script type="module">
10
+ const source=new EventSource(${JSON.stringify(o)});
11
+ let connected=false,disconnected=false;
12
+ let overlay=null;
13
+ function showError(msg){
14
+ if(!overlay){overlay=document.createElement('dialog');overlay.style.cssText='all:initial;position:fixed;inset:0;width:100%;height:100%;border:none;background:rgba(15,15,20,.92);color:#f87171;font:14px/1.6 monospace;padding:2rem;box-sizing:border-box;z-index:2147483647;overflow:auto;white-space:pre-wrap;word-break:break-all;';document.documentElement.appendChild(overlay);}
15
+ overlay.textContent='\u26A0\uFE0F Build error:\\n\\n'+msg;
16
+ if(!overlay.open)overlay.showModal();
17
+ }
18
+ function clearError(){if(overlay&&overlay.open){overlay.close();overlay.remove();overlay=null;}}
19
+ function normalizeRoute(value){const path=value.split(/[?#]/,1)[0]||'/';return path.endsWith('/')?path:path+'/';}
20
+ async function applyPageUpdate(update){
21
+ const currentRoute=normalizeRoute(location.pathname);
22
+ if(!update.routes.some((route)=>normalizeRoute(route)===currentRoute))return true;
23
+ const response=await fetch(location.href,{cache:'no-store',headers:{accept:'text/html'}});
24
+ if(!response.ok||!(response.headers.get('content-type')||'').includes('text/html'))return false;
25
+ const nextDocument=new DOMParser().parseFromString(await response.text(),'text/html');
26
+ if(typeof window.__docfuseApplyPageDocument!=='function')return false;
27
+ return window.__docfuseApplyPageDocument(nextDocument,{mode:'update'});
28
+ }
29
+ source.onopen=()=>{if(connected&&disconnected){clearError();location.reload();}connected=true;disconnected=false;};
30
+ source.onerror=()=>{if(connected)disconnected=true;};
31
+ source.onmessage=()=>{clearError();location.reload();};
32
+ source.addEventListener('update',async(event)=>{
33
+ clearError();
34
+ try{
35
+ const update=JSON.parse(event.data);
36
+ if(update.protocol!==1||update.type!=='update'||update.mode!=='page'){location.reload();return;}
37
+ if(!await applyPageUpdate(update))location.reload();
38
+ }catch{location.reload();}
39
+ });
40
+ source.addEventListener('build-error',(e)=>showError(e.data));
41
+ source.addEventListener('build-ok',()=>clearError());
42
+ </script>`;return e.replace("</body>",`${n}</body>`)}i(A,"injectLiveReloadScript");function W(e,o="/"){if(o==="/")return e;let n=o.replace(/\/$/,"");return e===n?"/":e.startsWith(`${n}/`)?e.slice(n.length)||"/":void 0}i(W,"resolveMountedRequestPath");function G(e,o){let n=S(e),d=o.split("/").map(f=>{let t=decodeURIComponent(f);if(t==="."||t===".."||t.includes("/")||t.includes("\\")||/[\u0000-\u001f]/.test(t))throw new Error("Forbidden");return t}),c=O(d.join("/"));if(c.split(/[\\/]/).includes(".."))throw new Error("Forbidden");let s=S(v(n,c)),p=c.endsWith("/")?[v(s,"index.html")]:P(c)===""?[s,v(s,"index.html")]:[s];for(let f of p){let t=B(n,f);if(t===".."||t.startsWith(`..${L}`)||$(t))throw new Error("Forbidden")}return p}i(G,"resolveRequestCandidates");async function _(e,o){let[n,d]=await Promise.all([k(e),k(o)]);if(!j(n,d))throw new Error("Forbidden");return d}i(_,"resolveExistingRequestPath");async function K(e){try{let o=await _(e,v(e,"404.html"));return await H(o)}catch(o){if(o.code==="ENOENT")return;throw o}}i(K,"readGeneratedNotFound");async function ee({root:e,port:o,liveReload:n=!1,basePath:d="/"}){let c=new Set,s=I(async(t,r)=>{if(t.method!=="GET"&&t.method!=="HEAD"){r.writeHead(405,{allow:"GET, HEAD"}),r.end("Method not allowed");return}let l=new URL(t.url??"/","http://127.0.0.1"),h=typeof d=="function"?d():d,y=`${h==="/"?"":h.replace(/\/$/,"")}/__docfuse/events`;if(n&&l.pathname===y){r.writeHead(200,{"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive"}),r.write(`:connected
43
+
44
+ `),c.add(r);let a=i(()=>c.delete(r),"removeClient");t.once("close",a),r.once("close",a),r.once("error",a);return}let C=W(l.pathname,h),g,E=i(async()=>{r.statusCode=404;let a=await K(g);if(a){r.setHeader("content-type",T[".html"]??"text/html; charset=utf-8"),n&&(a=Buffer.from(A(a.toString("utf8"),y))),r.end(t.method==="HEAD"?void 0:a);return}r.end(t.method==="HEAD"?void 0:"Not found")},"sendNotFound"),x=i(a=>{N("Static server error:",a),r.statusCode=500,r.end(t.method==="HEAD"?void 0:"Internal server error")},"sendInternalError");if(g=S(typeof e=="function"?e():e),C===void 0){try{await E()}catch(a){x(a)}return}let D;try{D=G(g,C)}catch{r.statusCode=403,r.end("Forbidden");return}try{let a,u;for(let b of D)try{let m=await _(g,b);u=await H(m),a=m;break}catch(m){if(m.message==="Forbidden"){r.statusCode=403,r.end("Forbidden");return}let F=m.code;if(F!=="ENOENT"&&F!=="EISDIR")throw m}if(!a||!u){await E();return}r.setHeader("content-type",z(a)),r.setHeader("cache-control","no-store"),n&&P(a)===".html"&&(u=Buffer.from(A(u.toString("utf8"),y))),r.end(t.method==="HEAD"?void 0:u)}catch(a){let u=a.code;if(u==="ENOENT"||u==="EISDIR")try{await E()}catch(b){x(b)}else x(a)}});await new Promise((t,r)=>{let l=i(h=>r(h),"onError");s.once("error",l),s.listen(o,"127.0.0.1",()=>{s.off("error",l),t()})});let p=s.address();if(!p||typeof p=="string")throw new Error("Failed to start server");let f=n?setInterval(()=>M(c),J):void 0;return f?.unref(),{port:p.port,reload:i((t={protocol:1,type:"update",mode:"full",routes:[]})=>{w(c,R("update",JSON.stringify(t)))},"reload"),sendBuildError:i(t=>{w(c,R("build-error",t))},"sendBuildError"),sendBuildOk:i(()=>{w(c,R("build-ok"))},"sendBuildOk"),close:i(()=>(f&&clearInterval(f),U(c),new Promise((t,r)=>s.close(l=>l?r(l):t()))),"close")}}i(ee,"startStaticServer");export{ee as a};
45
+ //# sourceMappingURL=chunk-FF7ZHS4U.js.map
@@ -0,0 +1,2 @@
1
+ import{a as y}from"./chunk-XYJ2OBL3.js";import{e as x,h as g}from"./chunk-JK7ZNBUA.js";import{a as r}from"./chunk-AYDF3IFZ.js";function v(e){return e?.replace(/\/+$/,"")}r(v,"normalizeSiteUrl");function k(e,t){let o=v(e.siteUrl);if(o)return`${o}${l(e,t)}`}r(k,"siteUrlFor");function l(e,t){if(/^(?:[a-z][a-z\d+.-]*:|\/\/|#)/i.test(t))return t;let o=t.startsWith("/")?t:`/${t}`;return e.basePath==="/"?o:`${e.basePath.replace(/\/$/,"")}${o}`}r(l,"publicPathFor");function m(e,t){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;let o=Object.getPrototypeOf(e);if(!Array.isArray(e)&&o!==Object.prototype&&o!==null)return!1;t.add(e);try{return Array.isArray(e)?Object.keys(e).length===e.length&&e.every(i=>m(i,t)):Object.values(e).every(i=>m(i,t))}finally{t.delete(e)}}r(m,"validateJsonValue");function P(e,t){if(!m(e,new WeakSet))throw new Error(`${t} must be JSON-serializable`)}r(P,"assertJsonValue");import{mkdir as E,rm as D,writeFile as C}from"fs/promises";import{join as p}from"path";var O=320;function F(e,t,o){let{graph:i,publicPathFor:s}=e,c=new Map,f=i.pages.filter(n=>n.version===t&&n.locale===o&&n.search).map((n,u)=>{let h=Array.isArray(n.frontmatter.tags)?n.frontmatter.tags.filter(a=>typeof a=="string"):[],b=n.codeExamples.map(a=>a.code.slice(0,300)).join(" ").slice(0,2e3),w=`${n.title} ${n.description} ${h.join(" ")} ${n.searchText} ${b}`;for(let a of y(w)){let d=c.get(a);d?d.push(u):c.set(a,[u])}return{title:n.title,description:n.description,routePath:s(n.routePath),excerpt:n.searchText.slice(0,O),tags:h}});return{version:t,locale:o,docs:f,postings:Object.fromEntries([...c.entries()].sort(([n],[u])=>n.localeCompare(u)))}}r(F,"createSearchIndex");var S={id:"compact",client:"compact",async write(e){let{graph:t,outputRoot:o}=e,i=p(o,"search");await D(i,{recursive:!0,force:!0}),await E(i,{recursive:!0});for(let s of t.versions)for(let c of t.locales){let f=s.id===t.currentVersion?i:p(i,s.id);await E(f,{recursive:!0}),await C(p(f,`${c}.json`),JSON.stringify(F(e,s.id,c),null,2))}await D(p(o,"pagefind"),{recursive:!0,force:!0})}};var $=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;function X(e){if(!$.test(e.id))throw new Error("Search provider id must be a lowercase kebab-case name");if(e.client!=="compact"&&e.client!=="pagefind")throw new Error(`Search provider "${e.id}" client must be "compact" or "pagefind"`);if(e.cacheKey!==void 0&&P(e.cacheKey,`Search provider "${e.id}" cacheKey`),typeof e.write!="function")throw new Error(`Search provider "${e.id}" must define write(context)`);return Object.freeze(e)}r(X,"defineSearchProvider");function H(e){return typeof e=="string"?"compact":e.client}r(H,"searchProviderClient");function j(e){if(typeof e!="string")return e;if(e==="compact")return S;throw new Error("The Pagefind search provider moved to @docfuse/plugins. Import pagefind() and set search.provider to pagefind().")}r(j,"searchProviderFor");async function L(e,t,o){if(!t.search.enabled)return;let i=x(e,t.outputDir);await j(t.search.provider).write({cwd:e,config:t,graph:o,outputRoot:i,publicPathFor:r(s=>l(t,s),"publicPathFor"),resolveOutputPath:r((s,c)=>g(i,s,c),"resolveOutputPath")})}r(L,"writeSearchIndexes");var B=1;function Q(e){return e}r(Q,"defineExtension");export{k as a,l as b,X as c,H as d,L as e,B as f,Q as g};
2
+ //# sourceMappingURL=chunk-GNYJERGG.js.map
@@ -0,0 +1,2 @@
1
+ var _="0.1.0";export{_ as a};
2
+ //# sourceMappingURL=chunk-GRQDPV4U.js.map
@@ -0,0 +1,2 @@
1
+ import{a as s}from"./chunk-AYDF3IFZ.js";import{access as g,realpath as f}from"fs/promises";import{basename as w,dirname as m,isAbsolute as h,relative as p,resolve as a,sep as l}from"path";async function d(o,r=g){try{return await r(o),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}s(d,"pathExists");function x(o){return o.normalize("NFC").toLocaleLowerCase("en-US")}s(x,"portablePathKey");function c(o,r){let t=p(a(o),a(r));return t===""||t!==".."&&!t.startsWith(`..${l}`)&&!h(t)}s(c,"isInside");function E(o,r,t){let e=a(o),n=a(e,r),i=p(e,n);if(i===".."||i.startsWith(`..${l}`)||h(i))throw new Error(`${t} must resolve to a path inside the project root`);return n}s(E,"resolveProjectPath");function y(o,r){let t=a(o),e=E(t,r,"outputDir");if(!p(t,e))throw new Error("outputDir must resolve to a directory inside the project root");return e}s(y,"resolveOutputRoot");async function u(o){let r=a(o),t=[];for(;;)try{return a(await f(r),...t)}catch(e){let n=e.code;if(n!=="ENOENT"&&n!=="ENOTDIR")throw e;let i=m(r);if(i===r)throw e;t.unshift(w(r)),r=i}}s(u,"canonicalPath");async function j(o,r,t){let[e,n]=await Promise.all([u(o),u(r)]);if(!c(e,n))throw new Error(`${t} must resolve to a path inside the project root`)}s(j,"assertProjectPath");async function N(o,r,t,e="outputDir"){let[n,i]=await Promise.all([u(o),u(r)]);if(c(n,i)||c(i,n))throw new Error(`${t} must not overlap ${e}`)}s(N,"assertDisjointPaths");function O(o,r,t){let e=a(o,r);if(!c(o,e))throw new Error(`${t} must stay inside outputDir`);return e}s(O,"resolveOutputPath");export{d as a,x as b,c,E as d,y as e,j as f,N as g,O as h};
2
+ //# sourceMappingURL=chunk-JK7ZNBUA.js.map
@@ -0,0 +1,6 @@
1
+ import{a as X,b as Y,d as Q,f as E}from"./chunk-GNYJERGG.js";import{a as C,b as W,d as K,e as q,f as B,g as k,h as O}from"./chunk-DOOG32NU.js";import{a as z}from"./chunk-GRQDPV4U.js";import{a as V,b as U,c as I}from"./chunk-EAYVCA3Z.js";import{a as R,b as P,d as H,e as _,f as J,h as v}from"./chunk-JK7ZNBUA.js";import{a as u}from"./chunk-AYDF3IFZ.js";import{analyzeMarkdown as jt}from"@docfuse/markdown/server/analyze";import It from"gray-matter";import{join as Rt,posix as Ct}from"path";import{z as d}from"zod";var tt=["ai","box","code","file","file-code","gauge","globe","layers","rocket","search","sparkles","terminal"],Pt=d.object({text:d.string().min(1),link:O,primary:d.boolean().optional(),icon:d.enum(tt).optional()}).strict(),bt=d.object({accent:d.string().optional(),tagline:d.string().optional(),image:O.optional(),imageAlt:d.string().optional(),actions:d.array(Pt).refine(t=>t.filter(e=>e.primary).length<=1,{message:"Home page hero actions can contain at most one primary action"}).optional()}).strict(),Et=d.object({icon:d.enum(tt).optional(),image:O.optional(),title:d.string().min(1),details:d.string().min(1)}).strict(),$t=d.string().trim().refine(t=>d.string().date().safeParse(t).success||d.string().datetime({offset:!0}).safeParse(t).success,"Expected an ISO 8601 date"),Z=d.preprocess(t=>t instanceof Date?t.toISOString():t,$t.transform(t=>new Date(t).toISOString())),et=d.object({title:d.string().optional(),description:d.string().optional(),createdAt:Z.optional(),updatedAt:Z.optional(),order:d.number().finite().optional(),group:d.string().optional(),subgroup:d.string().optional(),collapsed:d.boolean().optional(),sidebar:d.boolean().optional(),layout:d.enum(["document","playground"]).optional(),status:d.enum(["draft","published"]).optional(),search:d.boolean().optional(),ai:d.boolean().optional(),tags:d.array(d.string()).optional(),owner:d.string().optional(),hero:bt.optional(),features:d.array(Et).optional()}).passthrough();function le(t){return Object.fromEntries(["title","description","createdAt","updatedAt","order","group","subgroup","tags","owner"].flatMap(o=>t[o]===void 0?[]:[[o,t[o]]]))}u(le,"publicFrontmatterFor");import{readdir as Dt,readFile as St,stat as vt}from"fs/promises";import{join as kt,relative as rt}from"path";async function ot(t,e,o){if(!Number.isFinite(e)||e<1)throw new Error("Concurrency must be a positive finite number");let n=new Array(t.length),r=0,s,l=Math.min(Math.floor(e),t.length);if(await Promise.all(Array.from({length:l},async()=>{for(;r<t.length&&s===void 0;){let c=r++;try{n[c]=await o(t[c],c)}catch(f){s??=f}}})),s)throw s;return n}u(ot,"mapConcurrent");var Ot=32;async function nt(t){async function e(r){let s=[],l=[r];for(;l.length>0;){let c=l.pop();if(!c)continue;let f=await Dt(c,{withFileTypes:!0});for(let i of f){let a=kt(c,i.name);if(i.isSymbolicLink())throw new Error(`Documentation content must not use symbolic links: ${rt(t,a)}`);i.isDirectory()?l.push(a):i.isFile()&&V(i.name)&&s.push(a)}}return s}u(e,"walk");let o=await e(t);return(await ot(o,Ot,async r=>{let[s,l]=await Promise.all([vt(r),St(r,"utf8")]);return{path:rt(t,r),raw:l,mtimeMs:s.mtimeMs}})).sort((r,s)=>r.path.localeCompare(s.path))}u(nt,"scanMarkdownFiles");function st(t){return t.split("-").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}u(st,"humanize");function $(t){return I(C(t.relativePath,t.locale))}u($,"isLocaleHome");function Nt(t){return{type:"link",title:t.title||t.routePath,routePath:t.routePath}}u(Nt,"sidebarLink");function at(t){return C(t.relativePath,t.locale).split("/")}u(at,"pageSegments");function it(t){return at(t).slice(0,-1)}u(it,"pageDirectorySegments");function Ft(t){return I(at(t).at(-1)??"")}u(Ft,"isDirectoryIndex");function Tt(t){let e=new Map,o=new Map,n=new Map;for(let r of t)if(Ft(r)&&o.set(it(r).join("/"),r),r.group&&typeof r.frontmatter.group=="string"){let s=n.get(r.group);if(s&&s!==r.frontmatter.group)throw new Error(`Inconsistent group name for locale "${r.locale}" directory "${r.group}": "${s}" and "${r.frontmatter.group}"`);n.set(r.group,r.frontmatter.group)}for(let r of t){if($(r)||r.frontmatter.sidebar===!1)continue;let s=it(r),l=s[0]??"",c=o.get(l),f=l?typeof c?.frontmatter.group=="string"?c.frontmatter.group:c?.title||n.get(l)||st(l):"";if(typeof r.frontmatter.group=="string"&&r.frontmatter.group!==f)throw new Error(`Inconsistent group name for locale "${r.locale}" directory "${r.group}": "${f}" and "${r.frontmatter.group}"`);let i=e.get(l);if(!i)i={segment:l,title:f,items:[]},e.set(l,i);else if(i.title!==f)throw new Error(`Inconsistent group name for locale "${r.locale}" directory "${r.group}": "${i.title}" and "${f}"`);let a=i.items;for(let p=1;p<s.length;p+=1){let m=s[p];if(!m)continue;let g=s.slice(0,p+1).join("/"),h=o.get(g),w=p===1&&typeof r.frontmatter.subgroup=="string"?r.frontmatter.subgroup:void 0,y=(p===1&&typeof h?.frontmatter.subgroup=="string"?h.frontmatter.subgroup:void 0)??h?.title??w??st(m);if(w&&w!==y)throw new Error(`Inconsistent subgroup name for locale "${r.locale}" directory "${g}"`);let b=a.find(S=>S.type==="group"&&S.segment===m),x=b??{type:"group",segment:m,title:y,collapsed:h?.frontmatter.collapsed===!0,items:[]};b||a.push(x),a=x.items}a.push(Nt(r))}return[...e.values()]}u(Tt,"buildSidebar");function N(t){if(t.type==="link")return t;for(let e of t.items){let o=N(e);if(o)return o}}u(N,"firstSidebarLink");function At(t){return t.flatMap(e=>{let o=e.items[0]?N(e.items[0]):void 0;return e.title&&o?[{title:e.title,routePath:o.routePath}]:[]})}u(At,"buildAutomaticNav");function Gt(t,e){return!t.startsWith("/")||e.base==="/"?t:`${e.base}${t.replace(/^\//,"")}`}u(Gt,"versionedNavLink");function Mt(t,e){return t.map(o=>({title:o.text,routePath:Gt(o.link,e)}))}u(Mt,"buildConfiguredNav");function Lt(t,e){return t.map(o=>{if(!o.routePath.startsWith("/"))return o;let n=o.routePath.split("/").filter(Boolean),r=e.find(l=>l.segment&&n.at(-1)===l.segment&&n.length>0),s=r?.items[0]?N(r.items[0]):void 0;return s?{...o,routePath:s.routePath}:o})}u(Lt,"anchorConfiguredNavToSidebar");function Vt(t){let e=new Map;for(let o of t)for(let[n,r]of[["route",o.routePath],["output",o.outputPath],["markdown output",o.markdownOutputPath]]){let s=`${n}:${P(r)}`,l=e.get(s);if(l)throw new Error(`Duplicate ${n} target ${r} for ${l.sourceRelativePath} and ${o.sourceRelativePath}`);e.set(s,o)}}u(Vt,"assertUniquePageTargets");async function Ut(t,e,o,n){let r=H(t,o.docsDir,`versions.items[${o.id}].docsDir`),s=await nt(r),l=[];for(let c of s){let f=c.path.split(/[\\/]/);if(f[0]==="public")continue;let i=f[0]&&e.i18n.locales.includes(f[0])?f[0]:void 0,a=i??e.i18n.defaultLocale,p=i?f.slice(1):f;if(p.length===0)continue;let m=p.join("/"),g=Ct.join(o.docsDir.replace(/\\/g,"/"),c.path.replace(/\\/g,"/")),h=n?await n.transformSource({source:c.raw,sourceRelativePath:g,relativePath:c.path.replace(/\\/g,"/"),kind:U(c.path)?"mdx":"markdown",version:o.id,locale:a}):c.raw,w=It(h),y=et.parse(w.data),b=y.status??"published";if(b==="draft")continue;let x=jt(w.content),S=typeof y.order=="number"&&Number.isFinite(y.order)?y.order:Number.MAX_SAFE_INTEGER,xt=c.path.replace(/\\/g,"/"),L={sourcePath:Rt(r,c.path),transformedSource:h,sourceRelativePath:g,relativePath:xt,version:o.id,versionBase:o.base,docsDir:o.docsDir,locale:a,routePath:K(a,e.i18n.defaultLocale,m,o.base),outputPath:q(a,e.i18n.defaultLocale,m,o.base),markdownOutputPath:B(a,e.i18n.defaultLocale,m,o.base),title:typeof y.title=="string"?y.title:x.headings[0]?.text??"",description:typeof y.description=="string"?y.description:"",order:S,group:p.length>1?p[0]??"":"",status:b,search:y.search!==!1,ai:y.ai!==!1,body:w.content,headings:x.headings,searchText:x.text,codeExamples:x.codeExamples,lastUpdated:y.updatedAt??new Date(c.mtimeMs).toISOString(),frontmatter:y};l.push(n?await n.extendPage(L):L)}return l}u(Ut,"scanVersionPages");async function je(t,e,o){let n=[];for(let i of e.versions.items)for(let a of await Ut(t,e,i,o))n.push(a);let r=new Map(e.versions.items.map((i,a)=>[i.id,a])),s=new Map(e.i18n.locales.map((i,a)=>[i,a]));n.sort((i,a)=>{let p=(r.get(i.version)??0)-(r.get(a.version)??0);if(p!==0)return p;let m=(s.get(i.locale)??0)-(s.get(a.locale)??0);if(m!==0)return m;let g=$(i),h=$(a);return g!==h?g?-1:1:i.order!==a.order?i.order-a.order:i.routePath.localeCompare(a.routePath)}),Vt(n);for(let i of e.versions.items)for(let a of e.i18n.locales)if(!n.some(p=>p.version===i.id&&p.locale===a&&$(p)))throw new Error(`Missing published home page for version "${i.id}" locale "${a}"`);for(let i of e.versions.items)for(let a of e.i18n.locales){let p=n.filter(m=>m.version===i.id&&m.locale===a&&!$(m));p.forEach((m,g)=>{let h=p[g-1],w=p[g+1];h&&(m.previous={title:h.title||h.routePath,routePath:h.routePath}),w&&(m.next={title:w.title||w.routePath,routePath:w.routePath})})}let l={},c={};for(let i of e.versions.items){let a={},p={};l[i.id]=a,c[i.id]=p;for(let m of e.i18n.locales){let g=Tt(n.filter(h=>h.version===i.id&&h.locale===m));a[m]=g,p[m]=e.navigation[m]?Lt(Mt(e.navigation[m],i),g):At(g)}}let f=new Set(n.map(i=>i.routePath));for(let i of Object.values(c))for(let a of Object.values(i))for(let p of a)if(p.routePath.startsWith("/")&&!f.has(p.routePath))throw new Error(`Navigation target is not a generated page: "${p.routePath}"`);return{pages:n,sidebar:l,nav:c,locales:e.i18n.locales,defaultLocale:e.i18n.defaultLocale,versions:e.versions.items.map(i=>({...i})),currentVersion:e.versions.current}}u(je,"buildContentGraph");import{mkdir as Ht,writeFile as ct}from"fs/promises";import{dirname as _t,join as Jt}from"path";var zt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function F(t){return t.replace(/[&<>"']/g,e=>zt[e]??e)}u(F,"escapeHtml");function T(t){let e=t==="/"?"/":`${t.replace(/\/+$/,"")}/`;return W(e)}u(T,"normalizeRedirectRoute");function A(t,e){let o=new Set(e.pages.map(s=>T(s.routePath))),n=Object.entries(t.redirects).map(([s,l])=>[T(s),T(l)]),r=new Set(n.map(([s])=>s));for(let[s,l]of n){if(s==="/")throw new Error("Redirect source must not replace the site root");if(o.has(s))throw new Error(`Redirect source collides with a generated page: "${s}"`);if(r.has(l))throw new Error(`Redirect chains are not allowed: "${s}" points to redirect "${l}"`);if(!o.has(l))throw new Error(`Redirect target is not a published generated page: "${l}"`)}if(r.size!==n.length)throw new Error("Redirect sources must be unique after route normalization");return n}u(A,"resolveRedirects");async function Ve(t,e,o){let n=A(e,o);if(n.length===0)return;let r=_(t,e.outputDir);for(let[s,l]of n){let c=v(r,k(s),"redirect route"),f=Y(e,l),i=F(f),a=F(X(e,l)??f),p=JSON.stringify(f).replace(/</g,"\\u003c"),m=`<!doctype html><html><head><meta charset="utf-8"><meta name="robots" content="noindex"><link rel="canonical" href="${a}"><meta http-equiv="refresh" content="0;url=${i}"><script>location.replace(${p})</script></head><body><a href="${i}">Redirecting to ${i}</a></body></html>`;await Ht(_t(c),{recursive:!0}),await ct(c,m)}await ct(Jt(r,"redirects.json"),JSON.stringify(Object.fromEntries(n),null,2))}u(Ve,"writeRedirects");import{posix as ut}from"path";var Wt=new Set([".benchmark.json"]),Kt=["assets/docfuse-markdown","assets/docfuse-playground","assets/docfuse-plugins","assets/fonts","pagefind","ai/content","extensions"];function lt(t){let e=new Map;for(let o of t){let n=P(o),r=Kt.find(l=>n===l||n.startsWith(`${l}/`));if(r)throw new Error(`Generated output uses reserved directory "${r}": "${o}"`);let s=e.get(n);if(s)throw new Error(`Generated outputs overlap: "${s}" and "${o}"`);e.set(n,o)}for(let[o,n]of e){let r=ut.dirname(o);for(;r!==".";){let s=e.get(r);if(s)throw new Error(`Generated outputs overlap: "${s}" and "${n}"`);r=ut.dirname(r)}}}u(lt,"assertGeneratedOutputPlan");function ft(t,e){let o=[".benchmark.json","404.html","assets/docfuse.css","robots.txt","ai/pages.json","ai/manifest.json",...e.pages.flatMap(r=>[r.outputPath,r.markdownOutputPath])];if(t.search.enabled&&(o.push("assets/docfuse-search.js"),Q(t.search.provider)==="compact"))for(let r of e.versions)for(let s of e.locales)o.push(r.id===e.currentVersion?`search/${s}.json`:`search/${r.id}/${s}.json`);t.siteUrl&&o.push("sitemap.xml"),t.ai.pageSummaries&&o.push("ai/summaries.json"),t.ai.codeExamples&&o.push("ai/code-examples.json"),t.ai.markdownIndex&&o.push("ai/index.md"),t.ai.llmsTxt&&o.push("llms.txt"),t.ai.llmsFullTxt&&o.push("llms-full.txt");let n=A(t,e);if(n.length){o.push("redirects.json");for(let[r]of n)o.push(k(r))}return{paths:o,redirects:n}}u(ft,"plannedOutputPaths");function qe(t,e){let{paths:o}=ft(t,e);return lt(o),new Set(o)}u(qe,"generatedOutputPaths");function Be(t,e){let{paths:o,redirects:n}=ft(t,e);return lt(o),new Set([...o.filter(r=>!Wt.has(r)).map(r=>`/${r.split("/").map(encodeURIComponent).join("/")}`),...n.map(([r])=>r)])}u(Be,"generatedPublicPaths");import{randomUUID as Bt}from"crypto";import{mkdir as dt,readFile as Xt,rm as Yt,writeFile as gt}from"fs/promises";import{dirname as Qt,join as ht,posix as wt,resolve as Zt}from"path";import{pathToFileURL as te}from"url";import{build as ee}from"esbuild";import{createHash as pt}from"crypto";function G(t,e){if(t===null||typeof t=="boolean"||typeof t=="string")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError("Fingerprint values must contain only finite numbers");return t}if(typeof t!="object")throw new TypeError("Fingerprint values must be JSON-serializable");if(e.has(t))throw new TypeError("Fingerprint values must not be circular");let o=Object.getPrototypeOf(t);if(!Array.isArray(t)&&o!==Object.prototype&&o!==null)throw new TypeError("Fingerprint values must be JSON-serializable plain objects");e.add(t);try{if(Array.isArray(t)){if(Object.keys(t).length!==t.length)throw new TypeError("Fingerprint values must not contain sparse arrays");return t.map(r=>G(r,e))}let n=Object.entries(t).sort(([r],[s])=>r.localeCompare(s)).map(([r,s])=>[r,G(s,e)]);return Object.fromEntries(n)}finally{e.delete(t)}}u(G,"canonicalValue");function qt(t){return JSON.stringify(G(t,new WeakSet))}u(qt,"stableJson");function D(t){return pt("sha256").update(qt(t)).digest("hex")}u(D,"fingerprint");function M(t){return pt("sha256").update(t).digest("hex")}u(M,"fingerprintBytes");var oe=new Set(["apiVersion","name","outputs","transformSource","extendPage","generate"]),re=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock","bun.lockb"];function j(t){return t instanceof Error?t.message:String(t)}u(j,"errorMessage");function mt(t){return{sourceRelativePath:t.sourceRelativePath,relativePath:t.relativePath,version:t.version,locale:t.locale,routePath:t.routePath,title:t.title,description:t.description,status:t.status,search:t.search,ai:t.ai,body:t.body,searchText:t.searchText,frontmatter:structuredClone(t.frontmatter)}}u(mt,"extensionPage");function yt(t,e){if(!e||e.includes("\\")||e.startsWith("/")||e!==wt.normalize(e))throw new Error(`Extension "${t}" output must be a normalized relative POSIX path: "${e}"`);if(e.split("/").some(o=>o==="."||o===".."||!o))throw new Error(`Extension "${t}" output must not contain empty, . or .. segments: "${e}"`);return e}u(yt,"normalizeDeclaredOutput");function ne(t,e){if(!t||typeof t!="object")throw new Error(`Extension ${e.resolve} must export an extension object or factory`);let o=t,n=Object.keys(o).find(r=>!oe.has(r));if(n)throw new Error(`Extension ${e.resolve} has unknown key "${n}"`);if(o.apiVersion!==1)throw new Error(`Extension ${e.resolve} uses unsupported apiVersion ${String(o.apiVersion)}; expected ${1}`);if(typeof o.name!="string"||!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(o.name))throw new Error(`Extension ${e.resolve} name must be a lowercase portable slug`);for(let r of["transformSource","extendPage","generate"])if(o[r]!==void 0&&typeof o[r]!="function")throw new Error(`Extension "${o.name}" hook ${r} must be a function`);if(o.outputs!==void 0&&!Array.isArray(o.outputs))throw new Error(`Extension "${o.name}" outputs must be an array`);if(o.generate&&!o.outputs?.length)throw new Error(`Extension "${o.name}" with generate() must declare outputs`);if(!o.generate&&o.outputs?.length)throw new Error(`Extension "${o.name}" declares outputs without generate()`);return o}u(ne,"assertDefinition");function se(t,e){if(e===void 0)return{};if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Extension "${t}" extendPage() must return an object or undefined`);let o=new Set(["title","description","searchText","search","ai"]),n=Object.keys(e).find(s=>!o.has(s));if(n)throw new Error(`Extension "${t}" extendPage() returned unknown key "${n}"`);let r=e;for(let s of["title","description","searchText"])if(r[s]!==void 0&&typeof r[s]!="string")throw new Error(`Extension "${t}" extendPage() field ${s} must be a string`);for(let s of["search","ai"])if(r[s]!==void 0&&typeof r[s]!="boolean")throw new Error(`Extension "${t}" extendPage() field ${s} must be a boolean`);return e}u(se,"assertPagePatch");async function ie(t){let e=[];for(let o of re){let n=ht(t,o);await R(n)&&e.push({path:o,fingerprint:M(await Xt(n))})}return D(e)}u(ie,"lockfileFingerprint");async function ae(t,e,o){let n=Zt(t,o.resolve);if(await J(t,n,`extension ${o.resolve}`),!await R(n))throw new Error(`Extension module not found: ${o.resolve}`);let s=(await ee({entryPoints:[n],bundle:!0,format:"esm",platform:"node",target:"node22",write:!1,sourcemap:"inline",plugins:[{name:"docfuse-extension-api",setup(c){c.onResolve({filter:/^docfuse$/},()=>({path:"docfuse-extension-api",namespace:"docfuse-extension-api"})),c.onLoad({filter:/.*/,namespace:"docfuse-extension-api"},()=>({loader:"js",contents:`
2
+ export const DOCFUSE_EXTENSION_API_VERSION = ${JSON.stringify(1)}
3
+ export const docfuseVersion = ${JSON.stringify(z)}
4
+ export const defineExtension = (factory) => factory
5
+ `}))}}]})).outputFiles[0];if(!s)throw new Error(`Failed to bundle extension ${o.resolve}`);await dt(e,{recursive:!0});let l=ht(e,`extension-${Bt()}.mjs`);await gt(l,s.contents);try{let f=(await import(`${te(l).href}?t=${Date.now()}`)).default,i=typeof f=="function"?await f(structuredClone(o.options??{})):f,a=ne(i,o),p=(a.outputs??[]).map(m=>yt(a.name,m));if(new Set(p.map(P)).size!==p.length)throw new Error(`Extension "${a.name}" declares duplicate portable output paths`);return{definition:a,declaredOutputs:new Set(p),fingerprint:D({descriptor:o,bundle:M(s.contents)})}}finally{await Yt(l,{force:!0})}}u(ae,"loadOneExtension");async function lo(t,e,o){let n=[];for(let c of o)try{n.push(await ae(t,e,c))}catch(f){throw new Error(`Failed to load extension ${c.resolve}: ${j(f)}`,{cause:f})}let r=new Set;for(let c of n){if(r.has(c.definition.name))throw new Error(`Duplicate extension name "${c.definition.name}"`);r.add(c.definition.name)}let s=n.length?await ie(t):D({lockfiles:[]}),l=n.flatMap(({definition:c,declaredOutputs:f})=>[...f].map(i=>`/extensions/${c.name}/${i.split("/").map(encodeURIComponent).join("/")}`));return{fingerprint:D({apiVersion:1,dependencyFingerprint:s,extensions:n.map(c=>({name:c.definition.name,fingerprint:c.fingerprint}))}),publicOutputPaths:l,async transformSource(c){let f=c.source;for(let{definition:i}of n)if(i.transformSource)try{let a=await i.transformSource({...c,source:f});if(typeof a!="string")throw new Error("transformSource() must return a string");f=a}catch(a){throw new Error(`Extension "${i.name}" transformSource failed for ${c.sourceRelativePath}: ${j(a)}`,{cause:a})}return f},async extendPage(c){let f=c;for(let{definition:i}of n)if(i.extendPage)try{let a=se(i.name,await i.extendPage(mt(f)));f={...f,...a}}catch(a){throw new Error(`Extension "${i.name}" extendPage failed for ${f.sourceRelativePath}: ${j(a)}`,{cause:a})}return f},async generate(c,f){for(let{definition:i,declaredOutputs:a}of n){if(!i.generate)continue;let p=new Set;try{await i.generate({pages:f.map(mt),emitFile:u(async(g,h)=>{let w=yt(i.name,g);if(!a.has(w))throw new Error(`generate() emitted undeclared output "${w}"`);if(p.has(w))throw new Error(`generate() emitted "${w}" more than once`);p.add(w);let y=v(c,wt.join("extensions",i.name,w),`extension ${i.name} output`);await dt(Qt(y),{recursive:!0}),await gt(y,h)},"emitFile")});let m=[...a].filter(g=>!p.has(g));if(m.length)throw new Error(`generate() did not emit declared outputs: ${m.join(", ")}`)}catch(m){throw new Error(`Extension "${i.name}" generate failed: ${j(m)}`,{cause:m})}}}}}u(lo,"loadExtensionHost");export{D as a,M as b,le as c,ot as d,je as e,F as f,Ve as g,Kt as h,qe as i,Be as j,lo as k};
6
+ //# sourceMappingURL=chunk-M47X2MM3.js.map