canofold 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-7SEVEAYT.js +2 -0
- package/dist/{check-FCYLN6KO.js → check-NY3EVN5Q.js} +2 -2
- package/dist/{chunk-OATSOVSV.js → chunk-7SYMF26J.js} +2 -2
- package/dist/{chunk-56TT2V3X.js → chunk-B2QFU4ZW.js} +2 -2
- package/dist/{chunk-4E7M3CIK.js → chunk-FCABZITC.js} +2 -2
- package/dist/chunk-KUDMXVOM.js +2 -0
- package/dist/{clean-74GN2NZC.js → clean-7ENN3I7K.js} +2 -2
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1 -1
- package/dist/{dev-WJCFAWYD.js → dev-AMVXGDVE.js} +2 -2
- package/dist/index.d.ts +439 -0
- package/dist/index.js +1 -1
- package/dist/{init-6R5SLESH.js → init-5E5UEXP2.js} +2 -2
- package/dist/playground-client.d.ts +17 -0
- package/dist/search-client.d.ts +3 -0
- package/package.json +3 -3
- package/dist/build-RBMQ6TZ7.js +0 -2
- package/dist/chunk-3TIVCYR7.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-B2QFU4ZW.js";import"./chunk-FCABZITC.js";import"./chunk-ENPRUF6E.js";import"./chunk-XYJ2OBL3.js";import"./chunk-7SYMF26J.js";import"./chunk-4OALGQQB.js";import"./chunk-M6T5RSNJ.js";import"./chunk-KUDMXVOM.js";import"./chunk-EAYVCA3Z.js";import"./chunk-JK7ZNBUA.js";import"./chunk-AYDF3IFZ.js";export{b as runBuild,a as versionSatisfies};
|
|
2
|
+
//# sourceMappingURL=build-7SEVEAYT.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e as I,j as b,k as M}from"./chunk-
|
|
1
|
+
import{e as I,j as b,k as M}from"./chunk-FCABZITC.js";import"./chunk-ENPRUF6E.js";import"./chunk-XYJ2OBL3.js";import{a as C,b as S,j as P}from"./chunk-4OALGQQB.js";import"./chunk-KUDMXVOM.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"@canofold/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,g=new Map,u=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 d;try{d=F(o,s)}catch{c.push({severity:"error",message:`Image target does not exist: ${s}`});continue}n.has(d)||c.push({severity:"error",message:`Image target does not exist: ${s}`})}for(let t of k.links){let{path:s,fragment:d}=D(t),p=A(d);if(L(s))continue;if(!s){d&&(!p||!i.has(p))&&c.push({severity:"error",message:`Heading target does not exist: #${d}`});continue}if(s.startsWith("/")){if(n.has(j(s)??""))continue;let m;try{m=S(s)}catch{c.push({severity:"error",message:`Link target does not exist: ${s}`});continue}if(f.has(m))continue;let x=m==="/"?"/":`${m.replace(/\/+$/,"")}/`;r.has(x)?d&&(!p||!g.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(m=>n.has(m)?m:h.get(T(m))).find(m=>!!m);v?d&&(!p||!u.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 g of e.locales)if(!i.has(g)){let[u,...f]=r.split(":");o.push({severity:"warning",message:`Missing ${g} translation for ${f.join(":")} in version ${u}`})}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 g of i){let u=O(r,g.name);if(g.isDirectory())await o(u);else{if(g.isSymbolicLink())throw new Error(`Documentation files must not use symbolic links: ${K(e,u)}`);n.add(K(e,u).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
2
|
`).length-1}a(J,"bodyLineOffset");async function ue({cwd:e}){let n=await P(e),o=await W(O(Q(),"canofold-check-")),r=await M(e,o,n.extensions).finally(()=>N(o,{recursive:!0,force:!0})),i=await I(e,n,r),g=new Set([...b(n,i),...r.publicOutputPaths]),u=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(d=>d.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,u.get(t.version)??new Set,t.relativePath,f,new Set(t.headings.map(s=>s.slug)),c,k.get(t.version),g).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(ue,"runCheck");export{ue as runCheck};
|
|
3
|
-
//# sourceMappingURL=check-
|
|
3
|
+
//# sourceMappingURL=check-NY3EVN5Q.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-KUDMXVOM.js";import{d as a,e as E,f as d,g as u}from"./chunk-JK7ZNBUA.js";import{a as i}from"./chunk-AYDF3IFZ.js";import{randomUUID as b}from"crypto";import{mkdir as B,open as x,readFile as p,rename as S,rm as f,stat as k,writeFile as M}from"fs/promises";import{hostname as O}from"os";import{dirname as v,join as y}from"path";var w=600*1e3,A=Math.floor(w/3);function l(t){return typeof t=="string"&&t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&t.split("/").every(e=>e!==""&&e!=="."&&e!=="..")}i(l,"isSafeOutputPath");function Q(t){return a(t,".canofold/cache","build cache")}i(Q,"resolveBuildCacheRoot");function Y(t){return a(t,".canofold/tmp","temporary build files")}i(Y,"resolveBuildTemporaryRoot");function P(t){return y(t,"build-manifest.json")}i(P,"manifestPath");function R(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.fingerprint=="string"&&l(e.outputPath)&&l(e.markdownOutputPath)&&Array.isArray(e.assetOutputPaths)&&e.assetOutputPaths.every(l)}i(R,"isPageState");function j(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.fingerprint=="string"&&Number.isSafeInteger(e.size)&&Number(e.size)>=0}i(j,"isOutputState");function C(t){if(!t||typeof t!="object")return!1;let e=t;return e.schemaVersion===3&&e.canofoldVersion===h&&typeof e.buildFingerprint=="string"&&typeof e.sharedFingerprint=="string"&&!!e.pages&&typeof e.pages=="object"&&Object.values(e.pages).every(R)&&!!e.outputs&&typeof e.outputs=="object"&&Object.keys(e.outputs).length>0&&Object.keys(e.outputs).every(l)&&Object.values(e.outputs).every(j)}i(C,"isBuildManifest");async function Z(t){try{let e=JSON.parse(await p(P(t),"utf8"));return C(e)?e:void 0}catch(e){if(e.code==="ENOENT"||e instanceof SyntaxError)return;throw e}}i(Z,"readBuildManifest");async function tt(t,e){await B(t,{recursive:!0});let n=P(t),o=y(t,`.build-manifest.${b()}.tmp`);try{await M(o,`${JSON.stringify(e,null,2)}
|
|
2
2
|
`,{flag:"wx",flush:!0});try{await S(o,n)}catch(r){let s=r.code;if(s!=="EEXIST"&&s!=="EPERM")throw r;await f(n,{force:!0}),await S(o,n)}}finally{await f(o,{force:!0})}}i(tt,"writeBuildManifest");function T(t){try{return process.kill(t,0),!0}catch(e){return e.code!=="ESRCH"}}i(T,"processIsAlive");function D(t,e,n=Date.now()){if(t.hostname===O()&&typeof t.pid=="number"&&Number.isSafeInteger(t.pid)&&t.pid>0&&!T(t.pid))return!0;let o=typeof t.updatedAt=="number"?t.updatedAt:typeof t.createdAt=="number"?t.createdAt:void 0,r=o===void 0?e:Math.max(o,e);return r===void 0||!Number.isFinite(r)||r>n+w||n-r>w}i(D,"lockIsStale");function F(t,e){return JSON.stringify({ownerId:t,pid:process.pid,hostname:O(),createdAt:e})}i(F,"lockContents");async function g(t){try{return JSON.parse(await p(t,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}i(g,"readBuildLock");async function m(t){let e=await x(t,"wx"),n=b(),o=Date.now();try{return await e.writeFile(F(n,o)),{handle:e,path:t,ownerId:n,createdAt:o}}catch(r){throw await e.close(),await f(t,{force:!0}),r}}i(m,"createBuildLock");async function N(t){(await g(t.path))?.ownerId===t.ownerId&&await f(t.path,{force:!0})}i(N,"releaseBuildLock");async function I(t){let e,n;try{let[r,s]=await Promise.all([p(t,"utf8"),k(t)]);e=r,n=s.mtimeMs}catch(r){if(r.code==="ENOENT")return!0;throw r}let o;try{o=D(JSON.parse(e),n)}catch{o=Date.now()-n>w}if(!o)return!1;try{let[r,s]=await Promise.all([p(t,"utf8"),k(t)]);return r!==e||s.mtimeMs!==n?!1:(await f(t),!0)}catch(r){if(r.code==="ENOENT")return!0;throw r}}i(I,"removeStaleLock");async function J(t){try{return await m(t)}catch(e){if(e.code!=="EEXIST")throw e;if(!await I(t))throw new Error("Another Canofold build is already running for this project");try{return await m(t)}catch(n){throw n.code==="EEXIST"?new Error("Another Canofold build is already running for this project"):n}}}i(J,"acquireBuildLock");async function _(t){let e=v(t);await B(e,{recursive:!0});let n=y(e,"build.lock"),o=await J(`${n}.reclaim`);try{try{return await m(n)}catch(r){if(r.code!=="EEXIST")throw r;if(!await I(n))throw new Error("Another Canofold build is already running for this project");return await m(n)}}finally{await o.handle.close(),await N(o)}}i(_,"openBuildLock");async function $(t){if((await g(t.path))?.ownerId!==t.ownerId)return!1;let n=new Date;return await t.handle.utimes(n,n),!0}i($,"refreshBuildLock");async function V(t){if((await g(t.path))?.ownerId!==t.ownerId)throw new Error("Canofold build lock ownership was lost during the build")}i(V,"assertBuildLockOwned");async function et(t,e){let n=await _(t),o,r=setInterval(()=>{$(n).then(s=>{s||(o=new Error("Canofold build lock ownership was lost during the build"))}).catch(s=>{o=s})},A);r.unref();try{let s=i(()=>V(n),"assertOwned"),c=await e(s);if(o)throw o;return await s(),c}finally{clearInterval(r),await n.handle.close(),await N(n)}}i(et,"withBuildLock");async function it(t,e,n){let o=E(t,e.outputDir);await d(t,o,"outputDir"),await d(t,n,"build cache"),await u(o,n,"build cache");for(let r of e.versions.items){let s=a(t,r.docsDir,`versions.items[${r.id}].docsDir`);await d(t,s,`versions.items[${r.id}].docsDir`),await u(o,s,`versions.items[${r.id}].docsDir`),await u(n,s,`versions.items[${r.id}].docsDir`,"build cache")}for(let[r,s]of e.styles.entries()){let c=a(t,s,`styles[${r}]`);await d(t,c,`styles[${r}]`),await u(o,c,`styles[${r}]`),await u(n,c,`styles[${r}]`,"build cache")}return o}i(it,"resolveSafeOutputRoot");export{Q as a,Y as b,Z as c,tt as d,et as e,it as f};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-7SYMF26J.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as H,b as B,c as yt,d as F,e as bt,f as _,g as wt,h as Pt,i as St,k as Et}from"./chunk-
|
|
1
|
+
import{a as H,b as B,c as yt,d as F,e as bt,f as _,g as wt,h as Pt,i as St,k as Et}from"./chunk-FCABZITC.js";import{a as V,b as g,d as kt,e as vt}from"./chunk-ENPRUF6E.js";import{a as xt,b as Ct,c as Mt,d as Dt,e as Nt,f as At}from"./chunk-7SYMF26J.js";import{a as ht,c as j,j as gt}from"./chunk-4OALGQQB.js";import{a as Z}from"./chunk-M6T5RSNJ.js";import{a as q}from"./chunk-KUDMXVOM.js";import{b as G}from"./chunk-EAYVCA3Z.js";import{a as X,b as $,c as ee,d as K,e as R,f as ft,h as T}from"./chunk-JK7ZNBUA.js";import{a as s}from"./chunk-AYDF3IFZ.js";import{randomUUID as Ln}from"crypto";import{mkdir as Rn,rename as Me,rm as pe,writeFile as Tn}from"fs/promises";import{basename as nr,dirname as lt,join as ct,relative as On,resolve as $n}from"path";import{mkdir as Ee,open as cr,rm as dr,writeFile as Ae}from"fs/promises";import{dirname as ur,join as O,posix as Tt}from"path";import{analyzeMarkdown as Lt}from"@canofold/markdown/server/analyze";function Rt({description:e,body:t}){if(e.trim())return e.trim();let o=t.split(/\n\n+/).find(r=>{let a=r.trim();if(!a)return!1;let i=Lt(a);return i.text&&i.headings.length===0});return o?Lt(o.trim()).text:""}s(Rt,"createDeterministicSummary");var pr=1;function Ot(e){return e.replace(/\r?\n/g," ").replace(/([\\[\]])/g,"\\$1")}s(Ot,"markdownLinkLabel");function $t(e,t){let o=`${t.routePath}index.md`;return{title:t.title,description:t.description,routePath:g(e,t.routePath),markdownPath:g(e,o),version:t.version,locale:t.locale,status:t.status,tags:Array.isArray(t.frontmatter.tags)?t.frontmatter.tags.filter(r=>typeof r=="string"):[],owner:typeof t.frontmatter.owner=="string"?t.frontmatter.owner:void 0,headings:t.headings,lastUpdated:t.lastUpdated,frontmatter:yt(t.frontmatter)}}s($t,"pageMetadata");async function fe(e,t){await Ee(ur(e),{recursive:!0});let o=await cr(e,"w");try{for await(let r of t)await o.write(r)}finally{await o.close()}}s(fe,"writePieces");async function Ne(e,t,o){async function*r(){yield`{"${t}":[`;let a=!0;for(let i of o)yield`${a?"":","}
|
|
2
2
|
${JSON.stringify(i,null,2)}`,a=!1;yield`${a?"":`
|
|
3
3
|
`}]}
|
|
4
4
|
`}s(r,"pieces"),await fe(e,r())}s(Ne,"writeJsonArray");function mr(e,t){return t.pages.filter(o=>o.ai&&(e.ai.versions==="all"||o.version===t.currentVersion))}s(mr,"selectedPages");function fr(e){if(e==='"'||e==="\\")return 2;let t=e.codePointAt(0)??0;return t===8||t===9||t===10||t===12||t===13?2:t<32?6:Buffer.byteLength(e)}s(fr,"jsonEscapedCharacterBytes");function hr(e,t,o){let r=Buffer.byteLength(JSON.stringify({...e,part:999999999,parts:999999999,content:""})+`
|
|
@@ -661,4 +661,4 @@ ${o?`Sitemap: ${o}
|
|
|
661
661
|
${a}
|
|
662
662
|
</urlset>
|
|
663
663
|
`)}s(Vo,"writeSitemap");import{createMarkdownRenderer as Fn}from"@canofold/markdown/server";import{satisfies as In,valid as Bn,validRange as _n}from"semver";function Wo({current:e,previous:t,outputExists:o,outputValid:r=o,forceClean:a=!1}){if(a)return{mode:"clean",changedPageKeys:Object.keys(e.pages),removedPageKeys:[],reason:"forced"};if(!t)return{mode:"clean",changedPageKeys:Object.keys(e.pages),removedPageKeys:[],reason:"missing-manifest"};if(!o)return{mode:"clean",changedPageKeys:Object.keys(e.pages),removedPageKeys:Object.keys(t.pages).filter(n=>!e.pages[n]),reason:"missing-output"};if(!r)return{mode:"clean",changedPageKeys:Object.keys(e.pages),removedPageKeys:Object.keys(t.pages).filter(n=>!e.pages[n]),reason:"invalid-output"};if(e.buildFingerprint===t.buildFingerprint)return{mode:"cached",changedPageKeys:[],removedPageKeys:[],reason:"unchanged-inputs"};if(e.sharedFingerprint!==t.sharedFingerprint)return{mode:"clean",changedPageKeys:Object.keys(e.pages),removedPageKeys:Object.keys(t.pages).filter(n=>!e.pages[n]),reason:"shared-inputs-changed"};let i=Object.entries(e.pages).filter(([n,d])=>t.pages[n]?.fingerprint!==d.fingerprint).map(([n])=>n),l=Object.keys(t.pages).filter(n=>!e.pages[n]);return i.length===0&&l.length===0?{mode:"clean",changedPageKeys:Object.keys(e.pages),removedPageKeys:[],reason:"unclassified-inputs-changed"}:{mode:"incremental",changedPageKeys:i,removedPageKeys:l,reason:"page-inputs-changed"}}s(Wo,"planBuild");import{copyFile as hn,mkdir as gn,readFile as Jo,readdir as yn,stat as bn}from"fs/promises";import{dirname as wn,relative as kn,resolve as ot}from"path";var rt=16;function Xo(e,t){return kn(ot(e),ot(t)).replace(/\\/g,"/")}s(Xo,"portablePath");async function Yo(e){async function t(o){let r=await yn(o,{withFileTypes:!0});return(await Promise.all(r.map(async a=>{let i=ot(o,a.name);if(a.isSymbolicLink())throw new Error(`Generated output must not be a symbolic link: ${i}`);return a.isDirectory()?t(i):a.isFile()?[i]:[]}))).flat()}return s(t,"walk"),t(e)}s(Yo,"outputFilesUnder");async function Qo(e){let t=(await Yo(e)).sort(),o=await F(t,rt,async r=>{let a=await Jo(r);return[Xo(e,r),{fingerprint:B(a),size:a.byteLength}]});return Object.fromEntries(o)}s(Qo,"captureBuildOutputs");async function Zo(e,t){try{let o=Object.keys(t).sort(),r=(await Yo(e)).map(i=>Xo(e,i)).sort();return r.length!==o.length||r.some((i,l)=>i!==o[l])?!1:(await F(Object.entries(t),rt,async([i,l])=>{let n=T(e,i,`cached output ${i}`),d=await bn(n);return!d.isFile()||d.size!==l.size?!1:B(await Jo(n))===l.fingerprint})).every(Boolean)}catch(o){if(o.code==="ENOENT")return!1;throw o}}s(Zo,"verifyBuildOutputs");async function er(e,t,o){await F(Object.keys(o),rt,async r=>{let a=T(e,r,`cached output ${r}`),i=T(t,r,`staged output ${r}`);await gn(wn(i),{recursive:!0}),await hn(a,i)})}s(er,"copyBuildOutputs");import{readFile as st,readdir as Pn}from"fs/promises";import{dirname as tr,join as Q,relative as Sn,resolve as ue}from"path";import{fileURLToPath as at}from"url";import{detectMarkdownAssets as xn}from"@canofold/markdown/server/analyze";var Ce=16;function it(e,t){return Sn(ue(e),ue(t)).replace(/\\/g,"/")}s(it,"portablePath");function de(e){return JSON.stringify([e.version,e.sourceRelativePath])}s(de,"buildPageKey");async function or(e){async function t(o){let r=await Pn(o,{withFileTypes:!0});return(await Promise.all(r.map(async a=>{let i=Q(o,a.name);if(a.isDirectory())return t(i);if(a.isSymbolicLink())throw new Error(`Documentation support files must not use symbolic links: ${it(e,i)}`);return!a.isFile()||/\.mdx?$/i.test(a.name)?[]:[i]}))).flat()}return s(t,"walk"),t(e)}s(or,"supportFilesUnder");async function Cn(e){let t=[...new Set(e.map(r=>ue(r)))].sort(),o=(await F(t,Ce,async r=>{try{return{path:r,fingerprint:B(await st(r))}}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ENOENT")throw a;return null}})).filter(r=>r!==null);return H(o)}s(Cn,"fingerprintExistingFiles");async function nt(e){try{return await or(e)}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return[];throw t}}s(nt,"filesUnderIfPresent");async function Mn(){let e=tr(at(import.meta.url)),t=[];try{let o=at(import.meta.resolve("@canofold/markdown/theme")),r=tr(o);t.push(Q(r,"tokens.css"),Q(r,"styles.css"),Q(r,"theme.css"),Q(r,"base.css"),o)}catch{}return Cn([...await nt(e),...await nt(Q(e,"render")),...await nt(at(new URL("../render",import.meta.url))),...t])}s(Mn,"runtimeFingerprint");async function Dn(e,t,o){let r=[...new Set(t.versions.items.map(n=>n.docsDir))].map(n=>K(e,n,"docsDir")),a=(await Promise.all(r.map(n=>or(n)))).flat();for(let n of t.styles)a.push(K(e,n,"styles"));let i=[...new Set(a.map(n=>ue(n)))].filter(n=>!o.has(n)).sort(),l=await F(i,Ce,async n=>({path:it(e,n),fingerprint:B(await st(n))}));return H(l)}s(Dn,"supportFingerprint");function Nn(e){return{sourceRelativePath:e.sourceRelativePath,relativePath:e.relativePath,version:e.version,versionBase:e.versionBase,docsDir:e.docsDir,locale:e.locale,routePath:e.routePath,outputPath:e.outputPath,markdownOutputPath:e.markdownOutputPath,title:e.title,description:e.description,order:e.order,group:e.group,status:e.status,search:e.search,ai:e.ai,body:e.body,transformedSource:e.transformedSource,headings:e.headings,searchText:e.searchText,codeExamples:e.codeExamples,lastUpdated:e.lastUpdated,...e.previous?{previous:e.previous}:{},...e.next?{next:e.next}:{},frontmatter:e.frontmatter}}s(Nn,"serializablePage");function An(e,t){return{sidebar:e.sidebar[t.version]?.[t.locale]??[],nav:e.nav[t.version]?.[t.locale]??[],locales:e.locales,defaultLocale:e.defaultLocale,versions:e.versions,currentVersion:e.currentVersion}}s(An,"pageLayoutContext");function En(e){let t=e.search.provider;return{...e,markdown:{...e.markdown,plugins:e.markdown.plugins.map(o=>({name:o.name,version:o.version??"",cacheKey:o.cacheKey??null}))},search:{...e.search,provider:typeof t=="string"?t:{id:t.id,client:t.client,version:t.version??"",cacheKey:t.cacheKey??null}}}}s(En,"serializableConfig");async function rr(e,t,o,r=H({extensions:[]})){let a=new Map;await F(o.pages,Ce,async c=>{if(!G(c.relativePath))return;let p=ke(c.body).imports,m=await wo(p,c.sourcePath,e),w=await F(m,Ce,async h=>({path:it(e,h),fingerprint:B(await st(h))}));a.set(de(c),w.sort((h,S)=>h.path.localeCompare(S.path)))});let i=new Set([...a.values()].flat().map(c=>ue(e,c.path))),l=H(En(t)),n=H({canofoldVersion:q,runtimeFingerprint:await Mn(),configFingerprint:l,benchmarkReport:process.env.CANOFOLD_BENCHMARK_REPORT==="1",extensionFingerprint:r,math:o.pages.some(c=>xn(c.body,t.markdown.plugins,G(c.relativePath)?"mdx":"markdown").math),playground:o.pages.some(c=>c.frontmatter.layout==="playground"),support:await Dn(e,t,i)}),d=Object.fromEntries(o.pages.map(c=>[de(c),{fingerprint:H({page:Nn(c),localComponents:a.get(de(c))??[],layout:An(o,c)}),outputPath:c.outputPath,markdownOutputPath:c.markdownOutputPath,assetOutputPaths:[...le([c])].sort()}])),u=H({sharedFingerprint:n,pages:d});return{schemaVersion:3,canofoldVersion:q,buildFingerprint:u,sharedFingerprint:n,pages:d,outputs:{}}}s(rr,"createBuildManifest");function Un(e,t){if(!Bn(e))throw new Error(`Invalid Canofold version: ${e}`);if(!_n(t))throw new Error(`Invalid requiredVersion range: ${t}`);return In(e,t)}s(Un,"versionSatisfies");function qn(e){if(e.requiredVersion&&!Un(q,e.requiredVersion))throw new Error(`Canofold ${q} does not satisfy requiredVersion ${e.requiredVersion}`)}s(qn,"assertRequiredVersion");async function ar({cwd:e,config:t,graph:o,pages:r,previousPages:a,renderer:i,writeSharedAssets:l,extensions:n}){await Go({cwd:e,config:t,graph:o,pages:r,previousPages:a,renderer:i,writeSharedAssets:l}),await vt(e,t,o),await Vo(e,t,o),await Ko(e,t),await Ft(e,t,o),await wt(e,t,o),await n.generate(R(e,t.outputDir),o.pages),process.env.CANOFOLD_BENCHMARK_REPORT==="1"&&await Tn(ct(R(e,t.outputDir),".benchmark.json"),JSON.stringify({maxRssBytes:process.resourceUsage().maxRSS*1024}))}s(ar,"writeBuildOutputs");function sr(e){return ct(lt(e),`.${nr(e)}.backup`)}s(sr,"outputBackupRoot");async function jn(e){let t=sr(e);await X(t)&&(await X(e)?await pe(t,{recursive:!0,force:!0}):await Me(t,e))}s(jn,"recoverInterruptedOutputReplacement");async function Hn(e,t){let o=sr(e),r=await X(e);try{r&&await Me(e,o),await Me(t,e)}catch(a){throw r&&await X(o)&&(await pe(e,{recursive:!0,force:!0}),await Me(o,e)),a}await pe(o,{recursive:!0,force:!0})}s(Hn,"replaceOutputDirectory");async function zn(e,t,o,r){let a=R(e,t.outputDir),i=new Set(r.flatMap(l=>[l.outputPath,l.markdownOutputPath]).map($));await Promise.all(o.flatMap(l=>[l.outputPath,l.markdownOutputPath].filter(n=>!i.has($(n))).map(n=>pe(T(a,n,`removed page output ${n}`),{force:!0}))))}s(zn,"removeDeletedPageOutputs");async function Gn(e,t,o,r,a){await jn(r);let i=await Et(e.cwd,Ct(e.cwd),o.extensions),l=await bt(e.cwd,o,i),n=await rr(e.cwd,o,l,i.fingerprint),d=e.noCache?void 0:await Mt(t),u=await X(r),c=u&&d?await Zo(r,d.outputs):u,p=Wo({current:n,previous:d,outputExists:u,outputValid:c,forceClean:e.forceClean||e.noCache}),m=e.renderer??Fn();if(p.mode==="cached")return Z(`Built ${o.outputDir} (cache hit)`),{config:o,graph:l,incremental:!1,cached:!0,mode:p.mode,changedPages:[],partialReload:!1,reason:p.reason};let w=new Map(l.pages.map(f=>[de(f),f])),h=p.changedPageKeys.flatMap(f=>{let M=w.get(f);return M?[M]:[]}),S=ct(lt(r),`.${nr(r)}.tmp-${Ln()}`),C={...o,outputDir:On($n(e.cwd),S)};await Rn(lt(S),{recursive:!0});try{if(p.mode==="incremental"){await er(r,S,d?.outputs??{}),await ar({cwd:e.cwd,config:C,graph:l,pages:h,previousPages:d?Object.values(d.pages):[],renderer:m,writeSharedAssets:!1,extensions:i});let f=p.removedPageKeys.flatMap(M=>{let x=d?.pages[M];return x?[x]:[]});await zn(e.cwd,C,f,Object.values(n.pages))}else m.clear(),await ar({cwd:e.cwd,config:C,graph:l,pages:l.pages,renderer:m,writeSharedAssets:!0,extensions:i});await a(),await Hn(r,S)}finally{await pe(S,{recursive:!0,force:!0})}let b={...n,outputs:await Qo(r)};return await a(),await Dt(t,b),Z(`Built ${o.outputDir} (${p.mode}: ${p.reason})`),{config:o,graph:l,incremental:p.mode==="incremental",cached:!1,mode:p.mode,changedPages:[...new Set(h.map(f=>f.sourceRelativePath))],partialReload:p.mode==="incremental"&&p.changedPageKeys.length===1&&p.removedPageKeys.length===0&&d?.pages[p.changedPageKeys[0]??""]?.outputPath===n.pages[p.changedPageKeys[0]??""]?.outputPath,reason:p.reason}}s(Gn,"runBuildLocked");async function bc(e){let t=xt(e.cwd);await ft(e.cwd,t,"build cache");let o=await gt(e.cwd);qn(o);let r=await At(e.cwd,o,t);return Nt(t,a=>Gn(e,t,o,r,a))}s(bc,"runBuild");export{Un as a,bc as b};
|
|
664
|
-
//# sourceMappingURL=chunk-
|
|
664
|
+
//# sourceMappingURL=chunk-B2QFU4ZW.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as X,b as Y,d as Q,f as E}from"./chunk-ENPRUF6E.js";import{a as R,b as W,d as K,e as q,f as B,g as k,h as O}from"./chunk-4OALGQQB.js";import{a as H}from"./chunk-3TIVCYR7.js";import{a as V,b as z,c as j}from"./chunk-EAYVCA3Z.js";import{a as I,b as P,d as U,e as _,f as J,h as v}from"./chunk-JK7ZNBUA.js";import{a as u}from"./chunk-AYDF3IFZ.js";import{analyzeMarkdown as Dt}from"@canofold/markdown/server/analyze";import jt from"gray-matter";import{join as It,posix as Rt}from"path";import{z as m}from"zod";var tt=["ai","box","code","file","file-code","gauge","globe","layers","rocket","search","sparkles","terminal"],Pt=m.object({text:m.string().min(1),link:O,primary:m.boolean().optional(),icon:m.enum(tt).optional()}).strict(),bt=m.object({accent:m.string().optional(),tagline:m.string().optional(),image:O.optional(),imageAlt:m.string().optional(),actions:m.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=m.object({icon:m.enum(tt).optional(),image:O.optional(),title:m.string().min(1),details:m.string().min(1)}).strict(),$t=m.string().trim().refine(t=>m.string().date().safeParse(t).success||m.string().datetime({offset:!0}).safeParse(t).success,"Expected an ISO 8601 date"),Z=m.preprocess(t=>t instanceof Date?t.toISOString():t,$t.transform(t=>new Date(t).toISOString())),et=m.object({title:m.string().optional(),seoTitle:m.string().trim().min(1).optional(),description:m.string().optional(),createdAt:Z.optional(),updatedAt:Z.optional(),order:m.number().finite().optional(),group:m.string().optional(),subgroup:m.string().optional(),collapsed:m.boolean().optional(),sidebar:m.boolean().optional(),layout:m.enum(["document","playground"]).optional(),status:m.enum(["draft","published"]).optional(),search:m.boolean().optional(),ai:m.boolean().optional(),tags:m.array(m.string()).optional(),owner:m.string().optional(),hero:bt.optional(),features:m.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 St,readFile as Ct,stat as vt}from"fs/promises";import{join as kt,relative as nt}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 r=new Array(t.length),n=0,i,l=Math.min(Math.floor(e),t.length);if(await Promise.all(Array.from({length:l},async()=>{for(;n<t.length&&i===void 0;){let c=n++;try{r[c]=await o(t[c],c)}catch(p){i??=p}}})),i)throw i;return r}u(ot,"mapConcurrent");var Ot=32;async function rt(t){async function e(n){let i=[],l=[n];for(;l.length>0;){let c=l.pop();if(!c)continue;let p=await St(c,{withFileTypes:!0});for(let a of p){let s=kt(c,a.name);if(a.isSymbolicLink())throw new Error(`Documentation content must not use symbolic links: ${nt(t,s)}`);a.isDirectory()?l.push(s):a.isFile()&&V(a.name)&&i.push(s)}}return i}u(e,"walk");let o=await e(t);return(await ot(o,Ot,async n=>{let[i,l]=await Promise.all([vt(n),Ct(n,"utf8")]);return{path:nt(t,n),raw:l,mtimeMs:i.mtimeMs}})).sort((n,i)=>n.path.localeCompare(i.path))}u(rt,"scanMarkdownFiles");function it(t){return t.split("-").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}u(it,"humanize");function $(t){return j(R(t.relativePath,t.locale))}u($,"isLocaleHome");function Nt(t){return{type:"link",title:t.title||t.routePath,routePath:t.routePath}}u(Nt,"sidebarLink");function st(t){return R(t.relativePath,t.locale).split("/")}u(st,"pageSegments");function at(t){return st(t).slice(0,-1)}u(at,"pageDirectorySegments");function Tt(t){return j(st(t).at(-1)??"")}u(Tt,"isDirectoryIndex");function Ft(t){let e=new Map,o=new Map,r=new Map;for(let n of t)if(Tt(n)&&o.set(at(n).join("/"),n),n.group&&typeof n.frontmatter.group=="string"){let i=r.get(n.group);if(i&&i!==n.frontmatter.group)throw new Error(`Inconsistent group name for locale "${n.locale}" directory "${n.group}": "${i}" and "${n.frontmatter.group}"`);r.set(n.group,n.frontmatter.group)}for(let n of t){if($(n)||n.frontmatter.sidebar===!1)continue;let i=at(n),l=i[0]??"",c=o.get(l),p=l?typeof c?.frontmatter.group=="string"?c.frontmatter.group:c?.title||r.get(l)||it(l):"";if(typeof n.frontmatter.group=="string"&&n.frontmatter.group!==p)throw new Error(`Inconsistent group name for locale "${n.locale}" directory "${n.group}": "${p}" and "${n.frontmatter.group}"`);let a=e.get(l);if(!a)a={segment:l,title:p,items:[]},e.set(l,a);else if(a.title!==p)throw new Error(`Inconsistent group name for locale "${n.locale}" directory "${n.group}": "${a.title}" and "${p}"`);let s=a.items;for(let f=1;f<i.length;f+=1){let d=i[f];if(!d)continue;let g=i.slice(0,f+1).join("/"),h=o.get(g),w=f===1&&typeof n.frontmatter.subgroup=="string"?n.frontmatter.subgroup:void 0,y=(f===1&&typeof h?.frontmatter.subgroup=="string"?h.frontmatter.subgroup:void 0)??h?.title??w??it(d);if(w&&w!==y)throw new Error(`Inconsistent subgroup name for locale "${n.locale}" directory "${g}"`);let b=s.find(C=>C.type==="group"&&C.segment===d),x=b??{type:"group",segment:d,title:y,collapsed:h?.frontmatter.collapsed===!0,items:[]};b||s.push(x),s=x.items}s.push(Nt(n))}return[...e.values()]}u(Ft,"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 r=o.routePath.split("/").filter(Boolean),n=e.find(l=>l.segment&&r.at(-1)===l.segment&&r.length>0),i=n?.items[0]?N(n.items[0]):void 0;return i?{...o,routePath:i.routePath}:o})}u(Lt,"anchorConfiguredNavToSidebar");function Vt(t){let e=new Map;for(let o of t)for(let[r,n]of[["route",o.routePath],["output",o.outputPath],["markdown output",o.markdownOutputPath]]){let i=`${r}:${P(n)}`,l=e.get(i);if(l)throw new Error(`Duplicate ${r} target ${n} for ${l.sourceRelativePath} and ${o.sourceRelativePath}`);e.set(i,o)}}u(Vt,"assertUniquePageTargets");async function zt(t,e,o,r){let n=U(t,o.docsDir,`versions.items[${o.id}].docsDir`),i=await rt(n),l=[];for(let c of i){let p=c.path.split(/[\\/]/);if(p[0]==="public")continue;let a=p[0]&&e.i18n.locales.includes(p[0])?p[0]:void 0,s=a??e.i18n.defaultLocale,f=a?p.slice(1):p;if(f.length===0)continue;let d=f.join("/"),g=Rt.join(o.docsDir.replace(/\\/g,"/"),c.path.replace(/\\/g,"/")),h=r?await r.transformSource({source:c.raw,sourceRelativePath:g,relativePath:c.path.replace(/\\/g,"/"),kind:z(c.path)?"mdx":"markdown",version:o.id,locale:s}):c.raw,w=jt(h),y=et.parse(w.data),b=y.status??"published";if(b==="draft")continue;let x=Dt(w.content),C=typeof y.order=="number"&&Number.isFinite(y.order)?y.order:Number.MAX_SAFE_INTEGER,xt=c.path.replace(/\\/g,"/"),L={sourcePath:It(n,c.path),transformedSource:h,sourceRelativePath:g,relativePath:xt,version:o.id,versionBase:o.base,docsDir:o.docsDir,locale:s,routePath:K(s,e.i18n.defaultLocale,d,o.base),outputPath:q(s,e.i18n.defaultLocale,d,o.base),markdownOutputPath:B(s,e.i18n.defaultLocale,d,o.base),title:typeof y.title=="string"?y.title:x.headings[0]?.text??"",description:typeof y.description=="string"?y.description:"",order:C,group:f.length>1?f[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(r?await r.extendPage(L):L)}return l}u(zt,"scanVersionPages");async function De(t,e,o){let r=[];for(let a of e.versions.items)for(let s of await zt(t,e,a,o))r.push(s);let n=new Map(e.versions.items.map((a,s)=>[a.id,s])),i=new Map(e.i18n.locales.map((a,s)=>[a,s]));r.sort((a,s)=>{let f=(n.get(a.version)??0)-(n.get(s.version)??0);if(f!==0)return f;let d=(i.get(a.locale)??0)-(i.get(s.locale)??0);if(d!==0)return d;let g=$(a),h=$(s);return g!==h?g?-1:1:a.order!==s.order?a.order-s.order:a.routePath.localeCompare(s.routePath)}),Vt(r);for(let a of e.versions.items)for(let s of e.i18n.locales)if(!r.some(f=>f.version===a.id&&f.locale===s&&$(f)))throw new Error(`Missing published home page for version "${a.id}" locale "${s}"`);for(let a of e.versions.items)for(let s of e.i18n.locales){let f=r.filter(d=>d.version===a.id&&d.locale===s&&!$(d));f.forEach((d,g)=>{let h=f[g-1],w=f[g+1];h&&(d.previous={title:h.title||h.routePath,routePath:h.routePath}),w&&(d.next={title:w.title||w.routePath,routePath:w.routePath})})}let l={},c={};for(let a of e.versions.items){let s={},f={};l[a.id]=s,c[a.id]=f;for(let d of e.i18n.locales){let g=Ft(r.filter(h=>h.version===a.id&&h.locale===d));s[d]=g,f[d]=e.navigation[d]?Lt(Mt(e.navigation[d],a),g):At(g)}}let p=new Set(r.map(a=>a.routePath));for(let a of Object.values(c))for(let s of Object.values(a))for(let f of s)if(f.routePath.startsWith("/")&&!p.has(f.routePath))throw new Error(`Navigation target is not a generated page: "${f.routePath}"`);return{pages:r,sidebar:l,nav:c,locales:e.i18n.locales,defaultLocale:e.i18n.defaultLocale,versions:e.versions.items.map(a=>({...a})),currentVersion:e.versions.current}}u(De,"buildContentGraph");import{mkdir as Ut,writeFile as ct}from"fs/promises";import{dirname as _t,join as Jt}from"path";var Ht={"&":"&","<":"<",">":">",'"':""","'":"'"};function T(t){return t.replace(/[&<>"']/g,e=>Ht[e]??e)}u(T,"escapeHtml");function F(t){let e=t==="/"?"/":`${t.replace(/\/+$/,"")}/`;return W(e)}u(F,"normalizeRedirectRoute");function A(t,e){let o=new Set(e.pages.map(i=>F(i.routePath))),r=Object.entries(t.redirects).map(([i,l])=>[F(i),F(l)]),n=new Set(r.map(([i])=>i));for(let[i,l]of r){if(i==="/")throw new Error("Redirect source must not replace the site root");if(o.has(i))throw new Error(`Redirect source collides with a generated page: "${i}"`);if(n.has(l))throw new Error(`Redirect chains are not allowed: "${i}" points to redirect "${l}"`);if(!o.has(l))throw new Error(`Redirect target is not a published generated page: "${l}"`)}if(n.size!==r.length)throw new Error("Redirect sources must be unique after route normalization");return r}u(A,"resolveRedirects");async function Ve(t,e,o){let r=A(e,o);if(r.length===0)return;let n=_(t,e.outputDir);for(let[i,l]of r){let c=v(n,k(i),"redirect route"),p=Y(e,l),a=T(p),s=T(X(e,l)??p),f=JSON.stringify(p).replace(/</g,"\\u003c"),d=`<!doctype html><html><head><meta charset="utf-8"><meta name="robots" content="noindex"><link rel="canonical" href="${s}"><meta http-equiv="refresh" content="0;url=${a}"><script>location.replace(${f})</script></head><body><a href="${a}">Redirecting to ${a}</a></body></html>`;await Ut(_t(c),{recursive:!0}),await ct(c,d)}await ct(Jt(n,"redirects.json"),JSON.stringify(Object.fromEntries(r),null,2))}u(Ve,"writeRedirects");import{posix as ut}from"path";var Wt=new Set([".benchmark.json"]),Kt=["assets/canofold-markdown","assets/canofold-playground","assets/canofold-plugins","assets/fonts","pagefind","ai/content","extensions"];function lt(t){let e=new Map;for(let o of t){let r=P(o),n=Kt.find(l=>r===l||r.startsWith(`${l}/`));if(n)throw new Error(`Generated output uses reserved directory "${n}": "${o}"`);let i=e.get(r);if(i)throw new Error(`Generated outputs overlap: "${i}" and "${o}"`);e.set(r,o)}for(let[o,r]of e){let n=ut.dirname(o);for(;n!==".";){let i=e.get(n);if(i)throw new Error(`Generated outputs overlap: "${i}" and "${r}"`);n=ut.dirname(n)}}}u(lt,"assertGeneratedOutputPlan");function pt(t,e){let o=[".benchmark.json","404.html","assets/canofold.css","robots.txt","ai/pages.json","ai/manifest.json",...e.pages.flatMap(n=>[n.outputPath,n.markdownOutputPath])];if(t.search.enabled&&(o.push("assets/canofold-search.js"),Q(t.search.provider)==="compact"))for(let n of e.versions)for(let i of e.locales)o.push(n.id===e.currentVersion?`search/${i}.json`:`search/${n.id}/${i}.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 r=A(t,e);if(r.length){o.push("redirects.json");for(let[n]of r)o.push(k(n))}return{paths:o,redirects:r}}u(pt,"plannedOutputPaths");function qe(t,e){let{paths:o}=pt(t,e);return lt(o),new Set(o)}u(qe,"generatedOutputPaths");function Be(t,e){let{paths:o,redirects:r}=pt(t,e);return lt(o),new Set([...o.filter(n=>!Wt.has(n)).map(n=>`/${n.split("/").map(encodeURIComponent).join("/")}`),...r.map(([n])=>n)])}u(Be,"generatedPublicPaths");import{randomUUID as Bt}from"crypto";import{mkdir as mt,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 ft}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(n=>G(n,e))}let r=Object.entries(t).sort(([n],[i])=>n.localeCompare(i)).map(([n,i])=>[n,G(i,e)]);return Object.fromEntries(r)}finally{e.delete(t)}}u(G,"canonicalValue");function qt(t){return JSON.stringify(G(t,new WeakSet))}u(qt,"stableJson");function S(t){return ft("sha256").update(qt(t)).digest("hex")}u(S,"fingerprint");function M(t){return ft("sha256").update(t).digest("hex")}u(M,"fingerprintBytes");var oe=new Set(["apiVersion","name","outputs","transformSource","extendPage","generate"]),ne=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock","bun.lockb"];function D(t){return t instanceof Error?t.message:String(t)}u(D,"errorMessage");function dt(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(dt,"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 re(t,e){if(!t||typeof t!="object")throw new Error(`Extension ${e.resolve} must export an extension object or factory`);let o=t,r=Object.keys(o).find(n=>!oe.has(n));if(r)throw new Error(`Extension ${e.resolve} has unknown key "${r}"`);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 n of["transformSource","extendPage","generate"])if(o[n]!==void 0&&typeof o[n]!="function")throw new Error(`Extension "${o.name}" hook ${n} 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(re,"assertDefinition");function ie(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"]),r=Object.keys(e).find(i=>!o.has(i));if(r)throw new Error(`Extension "${t}" extendPage() returned unknown key "${r}"`);let n=e;for(let i of["title","description","searchText"])if(n[i]!==void 0&&typeof n[i]!="string")throw new Error(`Extension "${t}" extendPage() field ${i} must be a string`);for(let i of["search","ai"])if(n[i]!==void 0&&typeof n[i]!="boolean")throw new Error(`Extension "${t}" extendPage() field ${i} must be a boolean`);return e}u(ie,"assertPagePatch");async function ae(t){let e=[];for(let o of ne){let r=ht(t,o);await I(r)&&e.push({path:o,fingerprint:M(await Xt(r))})}return S(e)}u(ae,"lockfileFingerprint");async function se(t,e,o){let r=Zt(t,o.resolve);if(await J(t,r,`extension ${o.resolve}`),!await I(r))throw new Error(`Extension module not found: ${o.resolve}`);let i=(await ee({entryPoints:[r],bundle:!0,format:"esm",platform:"node",target:"node22",write:!1,sourcemap:"inline",plugins:[{name:"canofold-extension-api",setup(c){c.onResolve({filter:/^canofold$/},()=>({path:"canofold-extension-api",namespace:"canofold-extension-api"})),c.onLoad({filter:/.*/,namespace:"canofold-extension-api"},()=>({loader:"js",contents:`
|
|
1
|
+
import{a as X,b as Y,d as Q,f as E}from"./chunk-ENPRUF6E.js";import{a as R,b as W,d as K,e as q,f as B,g as k,h as O}from"./chunk-4OALGQQB.js";import{a as H}from"./chunk-KUDMXVOM.js";import{a as V,b as z,c as j}from"./chunk-EAYVCA3Z.js";import{a as I,b as P,d as U,e as _,f as J,h as v}from"./chunk-JK7ZNBUA.js";import{a as u}from"./chunk-AYDF3IFZ.js";import{analyzeMarkdown as Dt}from"@canofold/markdown/server/analyze";import jt from"gray-matter";import{join as It,posix as Rt}from"path";import{z as m}from"zod";var tt=["ai","box","code","file","file-code","gauge","globe","layers","rocket","search","sparkles","terminal"],Pt=m.object({text:m.string().min(1),link:O,primary:m.boolean().optional(),icon:m.enum(tt).optional()}).strict(),bt=m.object({accent:m.string().optional(),tagline:m.string().optional(),image:O.optional(),imageAlt:m.string().optional(),actions:m.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=m.object({icon:m.enum(tt).optional(),image:O.optional(),title:m.string().min(1),details:m.string().min(1)}).strict(),$t=m.string().trim().refine(t=>m.string().date().safeParse(t).success||m.string().datetime({offset:!0}).safeParse(t).success,"Expected an ISO 8601 date"),Z=m.preprocess(t=>t instanceof Date?t.toISOString():t,$t.transform(t=>new Date(t).toISOString())),et=m.object({title:m.string().optional(),seoTitle:m.string().trim().min(1).optional(),description:m.string().optional(),createdAt:Z.optional(),updatedAt:Z.optional(),order:m.number().finite().optional(),group:m.string().optional(),subgroup:m.string().optional(),collapsed:m.boolean().optional(),sidebar:m.boolean().optional(),layout:m.enum(["document","playground"]).optional(),status:m.enum(["draft","published"]).optional(),search:m.boolean().optional(),ai:m.boolean().optional(),tags:m.array(m.string()).optional(),owner:m.string().optional(),hero:bt.optional(),features:m.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 St,readFile as Ct,stat as vt}from"fs/promises";import{join as kt,relative as nt}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 r=new Array(t.length),n=0,i,l=Math.min(Math.floor(e),t.length);if(await Promise.all(Array.from({length:l},async()=>{for(;n<t.length&&i===void 0;){let c=n++;try{r[c]=await o(t[c],c)}catch(p){i??=p}}})),i)throw i;return r}u(ot,"mapConcurrent");var Ot=32;async function rt(t){async function e(n){let i=[],l=[n];for(;l.length>0;){let c=l.pop();if(!c)continue;let p=await St(c,{withFileTypes:!0});for(let a of p){let s=kt(c,a.name);if(a.isSymbolicLink())throw new Error(`Documentation content must not use symbolic links: ${nt(t,s)}`);a.isDirectory()?l.push(s):a.isFile()&&V(a.name)&&i.push(s)}}return i}u(e,"walk");let o=await e(t);return(await ot(o,Ot,async n=>{let[i,l]=await Promise.all([vt(n),Ct(n,"utf8")]);return{path:nt(t,n),raw:l,mtimeMs:i.mtimeMs}})).sort((n,i)=>n.path.localeCompare(i.path))}u(rt,"scanMarkdownFiles");function it(t){return t.split("-").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}u(it,"humanize");function $(t){return j(R(t.relativePath,t.locale))}u($,"isLocaleHome");function Nt(t){return{type:"link",title:t.title||t.routePath,routePath:t.routePath}}u(Nt,"sidebarLink");function st(t){return R(t.relativePath,t.locale).split("/")}u(st,"pageSegments");function at(t){return st(t).slice(0,-1)}u(at,"pageDirectorySegments");function Tt(t){return j(st(t).at(-1)??"")}u(Tt,"isDirectoryIndex");function Ft(t){let e=new Map,o=new Map,r=new Map;for(let n of t)if(Tt(n)&&o.set(at(n).join("/"),n),n.group&&typeof n.frontmatter.group=="string"){let i=r.get(n.group);if(i&&i!==n.frontmatter.group)throw new Error(`Inconsistent group name for locale "${n.locale}" directory "${n.group}": "${i}" and "${n.frontmatter.group}"`);r.set(n.group,n.frontmatter.group)}for(let n of t){if($(n)||n.frontmatter.sidebar===!1)continue;let i=at(n),l=i[0]??"",c=o.get(l),p=l?typeof c?.frontmatter.group=="string"?c.frontmatter.group:c?.title||r.get(l)||it(l):"";if(typeof n.frontmatter.group=="string"&&n.frontmatter.group!==p)throw new Error(`Inconsistent group name for locale "${n.locale}" directory "${n.group}": "${p}" and "${n.frontmatter.group}"`);let a=e.get(l);if(!a)a={segment:l,title:p,items:[]},e.set(l,a);else if(a.title!==p)throw new Error(`Inconsistent group name for locale "${n.locale}" directory "${n.group}": "${a.title}" and "${p}"`);let s=a.items;for(let f=1;f<i.length;f+=1){let d=i[f];if(!d)continue;let g=i.slice(0,f+1).join("/"),h=o.get(g),w=f===1&&typeof n.frontmatter.subgroup=="string"?n.frontmatter.subgroup:void 0,y=(f===1&&typeof h?.frontmatter.subgroup=="string"?h.frontmatter.subgroup:void 0)??h?.title??w??it(d);if(w&&w!==y)throw new Error(`Inconsistent subgroup name for locale "${n.locale}" directory "${g}"`);let b=s.find(C=>C.type==="group"&&C.segment===d),x=b??{type:"group",segment:d,title:y,collapsed:h?.frontmatter.collapsed===!0,items:[]};b||s.push(x),s=x.items}s.push(Nt(n))}return[...e.values()]}u(Ft,"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 r=o.routePath.split("/").filter(Boolean),n=e.find(l=>l.segment&&r.at(-1)===l.segment&&r.length>0),i=n?.items[0]?N(n.items[0]):void 0;return i?{...o,routePath:i.routePath}:o})}u(Lt,"anchorConfiguredNavToSidebar");function Vt(t){let e=new Map;for(let o of t)for(let[r,n]of[["route",o.routePath],["output",o.outputPath],["markdown output",o.markdownOutputPath]]){let i=`${r}:${P(n)}`,l=e.get(i);if(l)throw new Error(`Duplicate ${r} target ${n} for ${l.sourceRelativePath} and ${o.sourceRelativePath}`);e.set(i,o)}}u(Vt,"assertUniquePageTargets");async function zt(t,e,o,r){let n=U(t,o.docsDir,`versions.items[${o.id}].docsDir`),i=await rt(n),l=[];for(let c of i){let p=c.path.split(/[\\/]/);if(p[0]==="public")continue;let a=p[0]&&e.i18n.locales.includes(p[0])?p[0]:void 0,s=a??e.i18n.defaultLocale,f=a?p.slice(1):p;if(f.length===0)continue;let d=f.join("/"),g=Rt.join(o.docsDir.replace(/\\/g,"/"),c.path.replace(/\\/g,"/")),h=r?await r.transformSource({source:c.raw,sourceRelativePath:g,relativePath:c.path.replace(/\\/g,"/"),kind:z(c.path)?"mdx":"markdown",version:o.id,locale:s}):c.raw,w=jt(h),y=et.parse(w.data),b=y.status??"published";if(b==="draft")continue;let x=Dt(w.content),C=typeof y.order=="number"&&Number.isFinite(y.order)?y.order:Number.MAX_SAFE_INTEGER,xt=c.path.replace(/\\/g,"/"),L={sourcePath:It(n,c.path),transformedSource:h,sourceRelativePath:g,relativePath:xt,version:o.id,versionBase:o.base,docsDir:o.docsDir,locale:s,routePath:K(s,e.i18n.defaultLocale,d,o.base),outputPath:q(s,e.i18n.defaultLocale,d,o.base),markdownOutputPath:B(s,e.i18n.defaultLocale,d,o.base),title:typeof y.title=="string"?y.title:x.headings[0]?.text??"",description:typeof y.description=="string"?y.description:"",order:C,group:f.length>1?f[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(r?await r.extendPage(L):L)}return l}u(zt,"scanVersionPages");async function De(t,e,o){let r=[];for(let a of e.versions.items)for(let s of await zt(t,e,a,o))r.push(s);let n=new Map(e.versions.items.map((a,s)=>[a.id,s])),i=new Map(e.i18n.locales.map((a,s)=>[a,s]));r.sort((a,s)=>{let f=(n.get(a.version)??0)-(n.get(s.version)??0);if(f!==0)return f;let d=(i.get(a.locale)??0)-(i.get(s.locale)??0);if(d!==0)return d;let g=$(a),h=$(s);return g!==h?g?-1:1:a.order!==s.order?a.order-s.order:a.routePath.localeCompare(s.routePath)}),Vt(r);for(let a of e.versions.items)for(let s of e.i18n.locales)if(!r.some(f=>f.version===a.id&&f.locale===s&&$(f)))throw new Error(`Missing published home page for version "${a.id}" locale "${s}"`);for(let a of e.versions.items)for(let s of e.i18n.locales){let f=r.filter(d=>d.version===a.id&&d.locale===s&&!$(d));f.forEach((d,g)=>{let h=f[g-1],w=f[g+1];h&&(d.previous={title:h.title||h.routePath,routePath:h.routePath}),w&&(d.next={title:w.title||w.routePath,routePath:w.routePath})})}let l={},c={};for(let a of e.versions.items){let s={},f={};l[a.id]=s,c[a.id]=f;for(let d of e.i18n.locales){let g=Ft(r.filter(h=>h.version===a.id&&h.locale===d));s[d]=g,f[d]=e.navigation[d]?Lt(Mt(e.navigation[d],a),g):At(g)}}let p=new Set(r.map(a=>a.routePath));for(let a of Object.values(c))for(let s of Object.values(a))for(let f of s)if(f.routePath.startsWith("/")&&!p.has(f.routePath))throw new Error(`Navigation target is not a generated page: "${f.routePath}"`);return{pages:r,sidebar:l,nav:c,locales:e.i18n.locales,defaultLocale:e.i18n.defaultLocale,versions:e.versions.items.map(a=>({...a})),currentVersion:e.versions.current}}u(De,"buildContentGraph");import{mkdir as Ut,writeFile as ct}from"fs/promises";import{dirname as _t,join as Jt}from"path";var Ht={"&":"&","<":"<",">":">",'"':""","'":"'"};function T(t){return t.replace(/[&<>"']/g,e=>Ht[e]??e)}u(T,"escapeHtml");function F(t){let e=t==="/"?"/":`${t.replace(/\/+$/,"")}/`;return W(e)}u(F,"normalizeRedirectRoute");function A(t,e){let o=new Set(e.pages.map(i=>F(i.routePath))),r=Object.entries(t.redirects).map(([i,l])=>[F(i),F(l)]),n=new Set(r.map(([i])=>i));for(let[i,l]of r){if(i==="/")throw new Error("Redirect source must not replace the site root");if(o.has(i))throw new Error(`Redirect source collides with a generated page: "${i}"`);if(n.has(l))throw new Error(`Redirect chains are not allowed: "${i}" points to redirect "${l}"`);if(!o.has(l))throw new Error(`Redirect target is not a published generated page: "${l}"`)}if(n.size!==r.length)throw new Error("Redirect sources must be unique after route normalization");return r}u(A,"resolveRedirects");async function Ve(t,e,o){let r=A(e,o);if(r.length===0)return;let n=_(t,e.outputDir);for(let[i,l]of r){let c=v(n,k(i),"redirect route"),p=Y(e,l),a=T(p),s=T(X(e,l)??p),f=JSON.stringify(p).replace(/</g,"\\u003c"),d=`<!doctype html><html><head><meta charset="utf-8"><meta name="robots" content="noindex"><link rel="canonical" href="${s}"><meta http-equiv="refresh" content="0;url=${a}"><script>location.replace(${f})</script></head><body><a href="${a}">Redirecting to ${a}</a></body></html>`;await Ut(_t(c),{recursive:!0}),await ct(c,d)}await ct(Jt(n,"redirects.json"),JSON.stringify(Object.fromEntries(r),null,2))}u(Ve,"writeRedirects");import{posix as ut}from"path";var Wt=new Set([".benchmark.json"]),Kt=["assets/canofold-markdown","assets/canofold-playground","assets/canofold-plugins","assets/fonts","pagefind","ai/content","extensions"];function lt(t){let e=new Map;for(let o of t){let r=P(o),n=Kt.find(l=>r===l||r.startsWith(`${l}/`));if(n)throw new Error(`Generated output uses reserved directory "${n}": "${o}"`);let i=e.get(r);if(i)throw new Error(`Generated outputs overlap: "${i}" and "${o}"`);e.set(r,o)}for(let[o,r]of e){let n=ut.dirname(o);for(;n!==".";){let i=e.get(n);if(i)throw new Error(`Generated outputs overlap: "${i}" and "${r}"`);n=ut.dirname(n)}}}u(lt,"assertGeneratedOutputPlan");function pt(t,e){let o=[".benchmark.json","404.html","assets/canofold.css","robots.txt","ai/pages.json","ai/manifest.json",...e.pages.flatMap(n=>[n.outputPath,n.markdownOutputPath])];if(t.search.enabled&&(o.push("assets/canofold-search.js"),Q(t.search.provider)==="compact"))for(let n of e.versions)for(let i of e.locales)o.push(n.id===e.currentVersion?`search/${i}.json`:`search/${n.id}/${i}.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 r=A(t,e);if(r.length){o.push("redirects.json");for(let[n]of r)o.push(k(n))}return{paths:o,redirects:r}}u(pt,"plannedOutputPaths");function qe(t,e){let{paths:o}=pt(t,e);return lt(o),new Set(o)}u(qe,"generatedOutputPaths");function Be(t,e){let{paths:o,redirects:r}=pt(t,e);return lt(o),new Set([...o.filter(n=>!Wt.has(n)).map(n=>`/${n.split("/").map(encodeURIComponent).join("/")}`),...r.map(([n])=>n)])}u(Be,"generatedPublicPaths");import{randomUUID as Bt}from"crypto";import{mkdir as mt,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 ft}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(n=>G(n,e))}let r=Object.entries(t).sort(([n],[i])=>n.localeCompare(i)).map(([n,i])=>[n,G(i,e)]);return Object.fromEntries(r)}finally{e.delete(t)}}u(G,"canonicalValue");function qt(t){return JSON.stringify(G(t,new WeakSet))}u(qt,"stableJson");function S(t){return ft("sha256").update(qt(t)).digest("hex")}u(S,"fingerprint");function M(t){return ft("sha256").update(t).digest("hex")}u(M,"fingerprintBytes");var oe=new Set(["apiVersion","name","outputs","transformSource","extendPage","generate"]),ne=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock","bun.lockb"];function D(t){return t instanceof Error?t.message:String(t)}u(D,"errorMessage");function dt(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(dt,"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 re(t,e){if(!t||typeof t!="object")throw new Error(`Extension ${e.resolve} must export an extension object or factory`);let o=t,r=Object.keys(o).find(n=>!oe.has(n));if(r)throw new Error(`Extension ${e.resolve} has unknown key "${r}"`);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 n of["transformSource","extendPage","generate"])if(o[n]!==void 0&&typeof o[n]!="function")throw new Error(`Extension "${o.name}" hook ${n} 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(re,"assertDefinition");function ie(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"]),r=Object.keys(e).find(i=>!o.has(i));if(r)throw new Error(`Extension "${t}" extendPage() returned unknown key "${r}"`);let n=e;for(let i of["title","description","searchText"])if(n[i]!==void 0&&typeof n[i]!="string")throw new Error(`Extension "${t}" extendPage() field ${i} must be a string`);for(let i of["search","ai"])if(n[i]!==void 0&&typeof n[i]!="boolean")throw new Error(`Extension "${t}" extendPage() field ${i} must be a boolean`);return e}u(ie,"assertPagePatch");async function ae(t){let e=[];for(let o of ne){let r=ht(t,o);await I(r)&&e.push({path:o,fingerprint:M(await Xt(r))})}return S(e)}u(ae,"lockfileFingerprint");async function se(t,e,o){let r=Zt(t,o.resolve);if(await J(t,r,`extension ${o.resolve}`),!await I(r))throw new Error(`Extension module not found: ${o.resolve}`);let i=(await ee({entryPoints:[r],bundle:!0,format:"esm",platform:"node",target:"node22",write:!1,sourcemap:"inline",plugins:[{name:"canofold-extension-api",setup(c){c.onResolve({filter:/^canofold$/},()=>({path:"canofold-extension-api",namespace:"canofold-extension-api"})),c.onLoad({filter:/.*/,namespace:"canofold-extension-api"},()=>({loader:"js",contents:`
|
|
2
2
|
export const CANOFOLD_EXTENSION_API_VERSION = ${JSON.stringify(1)}
|
|
3
3
|
export const canofoldVersion = ${JSON.stringify(H)}
|
|
4
4
|
export const defineExtension = (factory) => factory
|
|
5
5
|
`}))}}]})).outputFiles[0];if(!i)throw new Error(`Failed to bundle extension ${o.resolve}`);await mt(e,{recursive:!0});let l=ht(e,`extension-${Bt()}.mjs`);await gt(l,i.contents);try{let p=(await import(`${te(l).href}?t=${Date.now()}`)).default,a=typeof p=="function"?await p(structuredClone(o.options??{})):p,s=re(a,o),f=(s.outputs??[]).map(d=>yt(s.name,d));if(new Set(f.map(P)).size!==f.length)throw new Error(`Extension "${s.name}" declares duplicate portable output paths`);return{definition:s,declaredOutputs:new Set(f),fingerprint:S({descriptor:o,bundle:M(i.contents)})}}finally{await Yt(l,{force:!0})}}u(se,"loadOneExtension");async function lo(t,e,o){let r=[];for(let c of o)try{r.push(await se(t,e,c))}catch(p){throw new Error(`Failed to load extension ${c.resolve}: ${D(p)}`,{cause:p})}let n=new Set;for(let c of r){if(n.has(c.definition.name))throw new Error(`Duplicate extension name "${c.definition.name}"`);n.add(c.definition.name)}let i=r.length?await ae(t):S({lockfiles:[]}),l=r.flatMap(({definition:c,declaredOutputs:p})=>[...p].map(a=>`/extensions/${c.name}/${a.split("/").map(encodeURIComponent).join("/")}`));return{fingerprint:S({apiVersion:1,dependencyFingerprint:i,extensions:r.map(c=>({name:c.definition.name,fingerprint:c.fingerprint}))}),publicOutputPaths:l,async transformSource(c){let p=c.source;for(let{definition:a}of r)if(a.transformSource)try{let s=await a.transformSource({...c,source:p});if(typeof s!="string")throw new Error("transformSource() must return a string");p=s}catch(s){throw new Error(`Extension "${a.name}" transformSource failed for ${c.sourceRelativePath}: ${D(s)}`,{cause:s})}return p},async extendPage(c){let p=c;for(let{definition:a}of r)if(a.extendPage)try{let s=ie(a.name,await a.extendPage(dt(p)));p={...p,...s}}catch(s){throw new Error(`Extension "${a.name}" extendPage failed for ${p.sourceRelativePath}: ${D(s)}`,{cause:s})}return p},async generate(c,p){for(let{definition:a,declaredOutputs:s}of r){if(!a.generate)continue;let f=new Set;try{await a.generate({pages:p.map(dt),emitFile:u(async(g,h)=>{let w=yt(a.name,g);if(!s.has(w))throw new Error(`generate() emitted undeclared output "${w}"`);if(f.has(w))throw new Error(`generate() emitted "${w}" more than once`);f.add(w);let y=v(c,wt.join("extensions",a.name,w),`extension ${a.name} output`);await mt(Qt(y),{recursive:!0}),await gt(y,h)},"emitFile")});let d=[...s].filter(g=>!f.has(g));if(d.length)throw new Error(`generate() did not emit declared outputs: ${d.join(", ")}`)}catch(d){throw new Error(`Extension "${a.name}" generate failed: ${D(d)}`,{cause:d})}}}}}u(lo,"loadExtensionHost");export{S as a,M as b,le as c,ot as d,De as e,T as f,Ve as g,Kt as h,qe as i,Be as j,lo as k};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-FCABZITC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s,b as f,e as p,f as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=clean-
|
|
1
|
+
import{a as s,b as f,e as p,f as l}from"./chunk-7SYMF26J.js";import{j as m}from"./chunk-4OALGQQB.js";import{a as n}from"./chunk-M6T5RSNJ.js";import"./chunk-KUDMXVOM.js";import"./chunk-EAYVCA3Z.js";import"./chunk-JK7ZNBUA.js";import{a as u}from"./chunk-AYDF3IFZ.js";import{readdir as R,rm as o}from"fs/promises";import{basename as h,dirname as g,join as b}from"path";async function x({cwd:t}){let i=await m(t),r=s(t),a=await l(t,i,r);await p(r,async()=>{let c=g(a),d=h(a).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),w=new RegExp(`^\\.${d}\\.(?:backup|(?:tmp|backup)-[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$`,"i"),v=await R(c,{withFileTypes:!0}).catch(e=>{if(e.code==="ENOENT")return[];throw e});await Promise.all(v.filter(e=>w.test(e.name)).map(e=>o(b(c,e.name),{recursive:!0,force:!0}))),await o(a,{recursive:!0,force:!0}),await o(r,{recursive:!0,force:!0}),await o(f(t),{recursive:!0,force:!0})}),n(`Removed ${i.outputDir}, .canofold/cache, and temporary or interrupted build files`)}u(x,"runClean");export{x as runClean};
|
|
2
|
+
//# sourceMappingURL=clean-7ENN3I7K.js.map
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
CHANGED
|
@@ -13,5 +13,5 @@ Commands:
|
|
|
13
13
|
Preview .canofold/dist on a custom local port
|
|
14
14
|
check Run documentation checks
|
|
15
15
|
deploy Generate deployment guidance
|
|
16
|
-
`)}l(g,"printHelp");function a(n,o){let t=n[o];if(t!==void 0)throw new Error(`Unknown option: ${t}`)}l(a,"assertArgumentCount");async function m(n,o=process.cwd()){let t=n[0]??"help";if(t==="help"||t==="--help"||t==="-h"){a(n,1),g();return}if(t==="init"){let{runInit:r}=await import("./init-
|
|
16
|
+
`)}l(g,"printHelp");function a(n,o){let t=n[o];if(t!==void 0)throw new Error(`Unknown option: ${t}`)}l(a,"assertArgumentCount");async function m(n,o=process.cwd()){let t=n[0]??"help";if(t==="help"||t==="--help"||t==="-h"){a(n,1),g();return}if(t==="init"){let{runInit:r}=await import("./init-5E5UEXP2.js");return r({cwd:o,...h(n)})}if(t==="build"){let{runBuild:r}=await import("./build-7SEVEAYT.js");return r({cwd:o,...d(n)})}if(t==="clean"){a(n,1);let{runClean:r}=await import("./clean-7ENN3I7K.js");return r({cwd:o})}if(t==="dev"){let{runDev:r}=await import("./dev-AMVXGDVE.js");return r({cwd:o,port:u(n)})}if(t==="preview"){let{runPreview:r}=await import("./preview-ODXGCQZ7.js"),i=u(n);return r({cwd:o,port:i})}if(t==="check"){a(n,1);let{runCheck:r}=await import("./check-NY3EVN5Q.js");return r({cwd:o})}if(t==="deploy"){a(n,1);let{runDeploy:r}=await import("./deploy-4YUYRVRO.js");return r({cwd:o})}throw new Error(`Unknown command: ${t}`)}l(m,"runCli");m(process.argv.slice(2)).catch(n=>{f(n instanceof Error?n.message:String(n)),process.exitCode=1});
|
|
17
17
|
//# sourceMappingURL=cli.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as b}from"./chunk-JZIKHPBO.js";import{b as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=dev-
|
|
1
|
+
import{a as b}from"./chunk-JZIKHPBO.js";import{b as g}from"./chunk-B2QFU4ZW.js";import"./chunk-FCABZITC.js";import{b as h}from"./chunk-ENPRUF6E.js";import"./chunk-XYJ2OBL3.js";import{a as B}from"./chunk-7SYMF26J.js";import"./chunk-4OALGQQB.js";import{a as v,b as f}from"./chunk-M6T5RSNJ.js";import"./chunk-KUDMXVOM.js";import"./chunk-EAYVCA3Z.js";import{c as p,e as m}from"./chunk-JK7ZNBUA.js";import{a as o}from"./chunk-AYDF3IFZ.js";import w from"chokidar";import{createMarkdownRenderer as S}from"@canofold/markdown/server";import{relative as P,resolve as k,sep as R}from"path";function D({build:n,reload:c,onBuildError:l=o(t=>f(t instanceof Error?t.message:String(t)),"onBuildError"),onBuildOk:i,debounceMs:s=80}){let t,u,e=!1,r=!1,a=o(()=>{if(t=void 0,!r){if(u){e=!0;return}u=(async()=>{try{let d=await n();r||(i?.(),c(d))}catch(d){l(d)}finally{u=void 0,e&&!r&&(e=!1,t=setTimeout(a,0))}})()}},"run");return{schedule(){if(!r){if(u){e=!0;return}t&&clearTimeout(t),t=setTimeout(a,s)}},async close(){r=!0,e=!1,t&&clearTimeout(t),t=void 0,await u}}}o(D,"createBuildScheduler");async function y({cwd:n,port:c}){let l=S(),i=await g({cwd:n,renderer:l}),s=await b({root:o(()=>m(n,i.config.outputDir),"root"),port:c,liveReload:!0,basePath:o(()=>i.config.basePath,"basePath")}),t=w.watch(".",{cwd:n,ignoreInitial:!0,ignored:o(e=>{let r=k(n,e),a=P(n,r).split(R);return a.includes("node_modules")||a.includes(".git")||a.includes(".canofold")||a.some(d=>/^\..+\.(?:tmp|backup)-/.test(d))?!0:p(m(n,i.config.outputDir),r)||p(B(n),r)},"ignored")}),u=D({build:o(async()=>{i=await g({cwd:n,renderer:l});let e=i.changedPages.flatMap(r=>{let a=i.graph.pages.find(d=>d.sourceRelativePath===r);return a?[h(i.config,a.routePath)]:[]});return{protocol:1,type:"update",mode:i.partialReload&&e.length===1?"page":"full",routes:e}},"build"),reload:o(e=>s.reload(e),"reload"),onBuildError:o(e=>{let r=e instanceof Error?e.message:String(e);f("Build error:",r),s.sendBuildError(r)},"onBuildError"),onBuildOk:o(()=>s.sendBuildOk(),"onBuildOk")});return t.on("all",()=>u.schedule()),t.on("error",e=>{let r=e instanceof Error?e.message:String(e);f("File watcher error:",r),s.sendBuildError(r)}),{port:s.port,close:o(async()=>{await t.close(),await u.close(),await s.close()},"close")}}o(y,"startDevServer");async function z({cwd:n,port:c=3333}){let l=await y({cwd:n,port:c});return v(`Dev server running at http://127.0.0.1:${l.port}/`),l}o(z,"runDev");export{z as runDev};
|
|
2
|
+
//# sourceMappingURL=dev-AMVXGDVE.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { MarkdownHtmlPolicy, MarkdownCodeOptions, MarkdownFeatureOptions, MarkdownLabels, MarkdownPlugin } from '@canofold/markdown';
|
|
2
|
+
import { MarkdownThemeInput } from '@canofold/markdown/theme';
|
|
3
|
+
import { MarkdownHeading, MarkdownCodeExample } from '@canofold/markdown/server/analyze';
|
|
4
|
+
|
|
5
|
+
/** Package version injected by tsup so chunk nesting cannot affect lookup. */
|
|
6
|
+
declare const canofoldVersion: string;
|
|
7
|
+
|
|
8
|
+
declare const homeIconNames: readonly ["ai", "box", "code", "file", "file-code", "gauge", "globe", "layers", "rocket", "search", "sparkles", "terminal"];
|
|
9
|
+
type HomeIconName = (typeof homeIconNames)[number];
|
|
10
|
+
interface CanofoldFrontmatter {
|
|
11
|
+
title?: string;
|
|
12
|
+
seoTitle?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
createdAt?: string;
|
|
15
|
+
updatedAt?: string;
|
|
16
|
+
order?: number;
|
|
17
|
+
group?: string;
|
|
18
|
+
subgroup?: string;
|
|
19
|
+
collapsed?: boolean;
|
|
20
|
+
sidebar?: boolean;
|
|
21
|
+
layout?: 'document' | 'playground';
|
|
22
|
+
status?: 'draft' | 'published';
|
|
23
|
+
search?: boolean;
|
|
24
|
+
ai?: boolean;
|
|
25
|
+
tags?: string[];
|
|
26
|
+
owner?: string;
|
|
27
|
+
hero?: {
|
|
28
|
+
accent?: string;
|
|
29
|
+
tagline?: string;
|
|
30
|
+
image?: string;
|
|
31
|
+
imageAlt?: string;
|
|
32
|
+
actions?: Array<{
|
|
33
|
+
text: string;
|
|
34
|
+
link: string;
|
|
35
|
+
primary?: boolean;
|
|
36
|
+
icon?: HomeIconName;
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
features?: Array<{
|
|
40
|
+
icon?: HomeIconName;
|
|
41
|
+
image?: string;
|
|
42
|
+
title: string;
|
|
43
|
+
details: string;
|
|
44
|
+
}>;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface PageLink {
|
|
49
|
+
title: string;
|
|
50
|
+
routePath: string;
|
|
51
|
+
}
|
|
52
|
+
interface SidebarLink {
|
|
53
|
+
type: 'link';
|
|
54
|
+
title: string;
|
|
55
|
+
routePath: string;
|
|
56
|
+
}
|
|
57
|
+
interface SidebarTreeGroup {
|
|
58
|
+
type: 'group';
|
|
59
|
+
/** Stable identity among sibling directories; display titles may be translated or duplicated. */
|
|
60
|
+
segment: string;
|
|
61
|
+
title: string;
|
|
62
|
+
collapsed: boolean;
|
|
63
|
+
items: SidebarItem[];
|
|
64
|
+
}
|
|
65
|
+
type SidebarItem = SidebarLink | SidebarTreeGroup;
|
|
66
|
+
interface SidebarGroup {
|
|
67
|
+
/** First directory segment under the locale; used to select a section sidebar. */
|
|
68
|
+
segment: string;
|
|
69
|
+
/** Section title used by automatic top navigation, not rendered inside the sidebar. */
|
|
70
|
+
title: string;
|
|
71
|
+
items: SidebarItem[];
|
|
72
|
+
}
|
|
73
|
+
interface NavItem {
|
|
74
|
+
title: string;
|
|
75
|
+
routePath: string;
|
|
76
|
+
}
|
|
77
|
+
interface DocPage {
|
|
78
|
+
sourcePath: string;
|
|
79
|
+
/** Complete source after extension transforms, including frontmatter and MDX imports. */
|
|
80
|
+
transformedSource: string;
|
|
81
|
+
/** Project-relative source path, including a version-specific docsDir. */
|
|
82
|
+
sourceRelativePath: string;
|
|
83
|
+
/** Path relative to this version's docs root. */
|
|
84
|
+
relativePath: string;
|
|
85
|
+
version: string;
|
|
86
|
+
versionBase: string;
|
|
87
|
+
docsDir: string;
|
|
88
|
+
locale: string;
|
|
89
|
+
routePath: string;
|
|
90
|
+
outputPath: string;
|
|
91
|
+
markdownOutputPath: string;
|
|
92
|
+
title: string;
|
|
93
|
+
description: string;
|
|
94
|
+
order: number;
|
|
95
|
+
/** First sub-directory segment under the locale, '' for root-level pages. */
|
|
96
|
+
group: string;
|
|
97
|
+
status: 'draft' | 'published';
|
|
98
|
+
search: boolean;
|
|
99
|
+
ai: boolean;
|
|
100
|
+
body: string;
|
|
101
|
+
headings: MarkdownHeading[];
|
|
102
|
+
searchText: string;
|
|
103
|
+
codeExamples: MarkdownCodeExample[];
|
|
104
|
+
lastUpdated: string;
|
|
105
|
+
previous?: PageLink;
|
|
106
|
+
next?: PageLink;
|
|
107
|
+
frontmatter: CanofoldFrontmatter;
|
|
108
|
+
}
|
|
109
|
+
interface ContentGraph {
|
|
110
|
+
pages: DocPage[];
|
|
111
|
+
/** Grouped sidebar entries per version and locale. */
|
|
112
|
+
sidebar: Record<string, Record<string, SidebarGroup[]>>;
|
|
113
|
+
/** Top navigation entries per version and locale. */
|
|
114
|
+
nav: Record<string, Record<string, NavItem[]>>;
|
|
115
|
+
locales: string[];
|
|
116
|
+
defaultLocale: string;
|
|
117
|
+
versions: Array<{
|
|
118
|
+
id: string;
|
|
119
|
+
label: string;
|
|
120
|
+
base: string;
|
|
121
|
+
docsDir: string;
|
|
122
|
+
}>;
|
|
123
|
+
currentVersion: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface SearchProviderContext {
|
|
127
|
+
cwd: string;
|
|
128
|
+
config: CanofoldConfig;
|
|
129
|
+
graph: ContentGraph;
|
|
130
|
+
outputRoot: string;
|
|
131
|
+
publicPathFor(routePath: string): string;
|
|
132
|
+
resolveOutputPath(outputPath: string, label: string): string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Whole-site index lifecycle. Unlike a Markdown plugin, a provider consumes the
|
|
136
|
+
* completed ContentGraph and output root; unlike an Extension, it owns only the
|
|
137
|
+
* configured search implementation's artifacts.
|
|
138
|
+
*/
|
|
139
|
+
interface SearchProvider {
|
|
140
|
+
readonly id: string;
|
|
141
|
+
/** Browser-side query protocol consumed by Canofold's built-in search modal. */
|
|
142
|
+
readonly client: 'compact' | 'pagefind';
|
|
143
|
+
readonly version?: string;
|
|
144
|
+
/** Resolved JSON options used for build invalidation. Bump `version` when implementation changes. */
|
|
145
|
+
readonly cacheKey?: CanofoldJsonValue;
|
|
146
|
+
write(context: SearchProviderContext): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare const THEME_BASE_COLORS: readonly ["paper", "neutral", "slate", "zinc", "stone"];
|
|
150
|
+
declare const CANOFOLD_MARKDOWN_ELEMENT_GROUP_IDS: readonly ["headings", "inline", "lists", "callouts", "code", "tables", "media", "diagrams", "disclosure", "extensions", "api", "metadata"];
|
|
151
|
+
|
|
152
|
+
type ThemeBaseColor = (typeof THEME_BASE_COLORS)[number];
|
|
153
|
+
type CanofoldMarkdownElementGroupId = (typeof CANOFOLD_MARKDOWN_ELEMENT_GROUP_IDS)[number];
|
|
154
|
+
interface CanofoldNavigationItem {
|
|
155
|
+
text: string;
|
|
156
|
+
link: string;
|
|
157
|
+
}
|
|
158
|
+
interface CanofoldVersionItem {
|
|
159
|
+
id: string;
|
|
160
|
+
label: string;
|
|
161
|
+
docsDir: string;
|
|
162
|
+
/** Absolute URL base. The current version normally uses `/`. */
|
|
163
|
+
base: string;
|
|
164
|
+
}
|
|
165
|
+
interface CanofoldAdvertisement {
|
|
166
|
+
image: string;
|
|
167
|
+
href: string;
|
|
168
|
+
alt: string;
|
|
169
|
+
label?: string;
|
|
170
|
+
}
|
|
171
|
+
interface CanofoldSearchConfig {
|
|
172
|
+
enabled: boolean;
|
|
173
|
+
provider: 'compact' | SearchProvider;
|
|
174
|
+
}
|
|
175
|
+
type CanofoldJsonValue = string | number | boolean | null | CanofoldJsonValue[] | {
|
|
176
|
+
[key: string]: CanofoldJsonValue;
|
|
177
|
+
};
|
|
178
|
+
interface CanofoldExtensionDescriptor {
|
|
179
|
+
/** Project-relative TypeScript or JavaScript module. Extensions execute as trusted build code. */
|
|
180
|
+
resolve: string;
|
|
181
|
+
/** JSON-serializable factory options; functions and environment-specific values are rejected. */
|
|
182
|
+
options?: {
|
|
183
|
+
[key: string]: CanofoldJsonValue;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
interface CanofoldLayoutLabels {
|
|
187
|
+
skipToContent: string;
|
|
188
|
+
search: string;
|
|
189
|
+
searchEmpty: string;
|
|
190
|
+
searchUnavailable: string;
|
|
191
|
+
language: string;
|
|
192
|
+
primaryNavigation: string;
|
|
193
|
+
theme: string;
|
|
194
|
+
openSidebar: string;
|
|
195
|
+
onThisPage: string;
|
|
196
|
+
edit: string;
|
|
197
|
+
updated: string;
|
|
198
|
+
previous: string;
|
|
199
|
+
next: string;
|
|
200
|
+
close: string;
|
|
201
|
+
source: string;
|
|
202
|
+
preview: string;
|
|
203
|
+
copySource: string;
|
|
204
|
+
sourceCopied: string;
|
|
205
|
+
quickActions: string;
|
|
206
|
+
github: string;
|
|
207
|
+
docsNavigation: string;
|
|
208
|
+
pageNavigation: string;
|
|
209
|
+
advertisement: string;
|
|
210
|
+
version: string;
|
|
211
|
+
}
|
|
212
|
+
interface CanofoldQuickActionMessages {
|
|
213
|
+
headingsTitle: string;
|
|
214
|
+
headingsDescription: string;
|
|
215
|
+
codeTitle: string;
|
|
216
|
+
codeDescription: string;
|
|
217
|
+
tableTitle: string;
|
|
218
|
+
tableDescription: string;
|
|
219
|
+
diagramTitle: string;
|
|
220
|
+
diagramDescription: string;
|
|
221
|
+
sourceDescription: string;
|
|
222
|
+
themeDescription: string;
|
|
223
|
+
}
|
|
224
|
+
interface CanofoldMarkdownElementGroupMessages {
|
|
225
|
+
label?: string;
|
|
226
|
+
detail?: string;
|
|
227
|
+
hash?: string;
|
|
228
|
+
}
|
|
229
|
+
interface CanofoldNotFoundMessages {
|
|
230
|
+
title: string;
|
|
231
|
+
description: string;
|
|
232
|
+
home: string;
|
|
233
|
+
}
|
|
234
|
+
interface CanofoldLocaleMessages {
|
|
235
|
+
labels?: Partial<CanofoldLayoutLabels>;
|
|
236
|
+
brandTagline?: string;
|
|
237
|
+
quickActions?: Partial<CanofoldQuickActionMessages>;
|
|
238
|
+
markdownElementGroups?: Partial<Record<CanofoldMarkdownElementGroupId, CanofoldMarkdownElementGroupMessages>>;
|
|
239
|
+
markdown?: Partial<MarkdownLabels>;
|
|
240
|
+
notFound?: Partial<CanofoldNotFoundMessages>;
|
|
241
|
+
}
|
|
242
|
+
/** Public authoring contract for canofold.config.ts. Runtime validation uses the matching strict schema. */
|
|
243
|
+
interface CanofoldConfigInput {
|
|
244
|
+
title?: string;
|
|
245
|
+
description?: string;
|
|
246
|
+
siteUrl?: string;
|
|
247
|
+
basePath?: string;
|
|
248
|
+
editUrl?: string;
|
|
249
|
+
github?: string;
|
|
250
|
+
requiredVersion?: string;
|
|
251
|
+
docsDir?: string;
|
|
252
|
+
outputDir?: string;
|
|
253
|
+
styles?: string[];
|
|
254
|
+
layout?: {
|
|
255
|
+
header?: boolean;
|
|
256
|
+
};
|
|
257
|
+
markdown?: {
|
|
258
|
+
html?: MarkdownHtmlPolicy;
|
|
259
|
+
code?: Pick<MarkdownCodeOptions, 'themes' | 'fallbackLanguage' | 'unknownLanguage'>;
|
|
260
|
+
features?: MarkdownFeatureOptions;
|
|
261
|
+
labels?: Partial<MarkdownLabels>;
|
|
262
|
+
/**
|
|
263
|
+
* Compiler plugins imported into canofold.config.ts, e.g. from
|
|
264
|
+
* `@canofold/plugins`. They execute as trusted build code; cache identity
|
|
265
|
+
* comes from each plugin's `name`, `version` and `cacheKey`.
|
|
266
|
+
*/
|
|
267
|
+
plugins?: readonly MarkdownPlugin[];
|
|
268
|
+
};
|
|
269
|
+
theme?: {
|
|
270
|
+
logo?: string;
|
|
271
|
+
logoDark?: string;
|
|
272
|
+
favicon?: string;
|
|
273
|
+
accentColor?: string;
|
|
274
|
+
darkMode?: boolean;
|
|
275
|
+
radius?: number | string;
|
|
276
|
+
baseColor?: ThemeBaseColor;
|
|
277
|
+
sidebarWidth?: number | string;
|
|
278
|
+
outlineWidth?: number | string;
|
|
279
|
+
tokens?: MarkdownThemeInput;
|
|
280
|
+
};
|
|
281
|
+
search?: {
|
|
282
|
+
enabled?: boolean;
|
|
283
|
+
/** Use `compact` or a provider such as `pagefind()` from @canofold/plugins. */
|
|
284
|
+
provider?: 'compact' | SearchProvider;
|
|
285
|
+
};
|
|
286
|
+
extensions?: CanofoldExtensionDescriptor[];
|
|
287
|
+
navigation?: Record<string, CanofoldNavigationItem[]>;
|
|
288
|
+
versions?: {
|
|
289
|
+
current: string;
|
|
290
|
+
items: CanofoldVersionItem[];
|
|
291
|
+
};
|
|
292
|
+
redirects?: Record<string, string>;
|
|
293
|
+
advertising?: CanofoldAdvertisement;
|
|
294
|
+
i18n?: {
|
|
295
|
+
defaultLocale?: string;
|
|
296
|
+
locales?: string[];
|
|
297
|
+
localeNames?: Record<string, string>;
|
|
298
|
+
messages?: Record<string, CanofoldLocaleMessages>;
|
|
299
|
+
};
|
|
300
|
+
ai?: {
|
|
301
|
+
llmsTxt?: boolean;
|
|
302
|
+
llmsFullTxt?: boolean;
|
|
303
|
+
markdownIndex?: boolean;
|
|
304
|
+
pageSummaries?: boolean;
|
|
305
|
+
codeExamples?: boolean;
|
|
306
|
+
/** Maximum encoded size of one ai/content JSONL shard. */
|
|
307
|
+
chunkSizeBytes?: number;
|
|
308
|
+
/** Maximum size of the legacy single-file llms-full.txt body. */
|
|
309
|
+
llmsFullMaxBytes?: number;
|
|
310
|
+
/** Write a manifest pointer or fail when llms-full.txt exceeds its budget. */
|
|
311
|
+
llmsFullOverflow?: 'manifest' | 'error';
|
|
312
|
+
/** Current avoids duplicate historical answers; all publishes every configured version. */
|
|
313
|
+
versions?: 'current' | 'all';
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
interface CanofoldConfig {
|
|
317
|
+
title: string;
|
|
318
|
+
description: string;
|
|
319
|
+
siteUrl?: string;
|
|
320
|
+
basePath: string;
|
|
321
|
+
editUrl?: string;
|
|
322
|
+
github?: string;
|
|
323
|
+
requiredVersion?: string;
|
|
324
|
+
docsDir: string;
|
|
325
|
+
outputDir: string;
|
|
326
|
+
styles: string[];
|
|
327
|
+
layout: {
|
|
328
|
+
header: boolean;
|
|
329
|
+
};
|
|
330
|
+
markdown: {
|
|
331
|
+
html: MarkdownHtmlPolicy;
|
|
332
|
+
code: MarkdownCodeOptions;
|
|
333
|
+
features: MarkdownFeatureOptions;
|
|
334
|
+
labels: Partial<MarkdownLabels>;
|
|
335
|
+
plugins: readonly MarkdownPlugin[];
|
|
336
|
+
};
|
|
337
|
+
theme: {
|
|
338
|
+
logo?: string;
|
|
339
|
+
logoDark?: string;
|
|
340
|
+
favicon?: string;
|
|
341
|
+
accentColor: string;
|
|
342
|
+
darkMode: boolean;
|
|
343
|
+
radius: number | string;
|
|
344
|
+
baseColor: ThemeBaseColor;
|
|
345
|
+
sidebarWidth: number | string;
|
|
346
|
+
outlineWidth: number | string;
|
|
347
|
+
tokens: MarkdownThemeInput;
|
|
348
|
+
};
|
|
349
|
+
search: CanofoldSearchConfig;
|
|
350
|
+
extensions: CanofoldExtensionDescriptor[];
|
|
351
|
+
navigation: Record<string, CanofoldNavigationItem[]>;
|
|
352
|
+
versions: {
|
|
353
|
+
current: string;
|
|
354
|
+
items: CanofoldVersionItem[];
|
|
355
|
+
};
|
|
356
|
+
redirects: Record<string, string>;
|
|
357
|
+
advertising?: CanofoldAdvertisement;
|
|
358
|
+
i18n: {
|
|
359
|
+
defaultLocale: string;
|
|
360
|
+
locales: string[];
|
|
361
|
+
localeNames?: Record<string, string>;
|
|
362
|
+
messages?: Record<string, CanofoldLocaleMessages>;
|
|
363
|
+
};
|
|
364
|
+
ai: {
|
|
365
|
+
llmsTxt: boolean;
|
|
366
|
+
llmsFullTxt: boolean;
|
|
367
|
+
markdownIndex: boolean;
|
|
368
|
+
pageSummaries: boolean;
|
|
369
|
+
codeExamples: boolean;
|
|
370
|
+
chunkSizeBytes: number;
|
|
371
|
+
llmsFullMaxBytes: number;
|
|
372
|
+
llmsFullOverflow: 'manifest' | 'error';
|
|
373
|
+
versions: 'current' | 'all';
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** Add contextual typing to canofold.config.ts without changing its runtime value. */
|
|
378
|
+
declare function defineConfig(config: CanofoldConfigInput): CanofoldConfigInput;
|
|
379
|
+
|
|
380
|
+
declare function defineSearchProvider<T extends SearchProvider>(provider: T): T;
|
|
381
|
+
|
|
382
|
+
declare const CANOFOLD_EXTENSION_API_VERSION: 1;
|
|
383
|
+
interface CanofoldExtensionSourceContext {
|
|
384
|
+
source: string;
|
|
385
|
+
sourceRelativePath: string;
|
|
386
|
+
relativePath: string;
|
|
387
|
+
kind: 'markdown' | 'mdx';
|
|
388
|
+
version: string;
|
|
389
|
+
locale: string;
|
|
390
|
+
}
|
|
391
|
+
interface CanofoldExtensionPage {
|
|
392
|
+
sourceRelativePath: string;
|
|
393
|
+
relativePath: string;
|
|
394
|
+
version: string;
|
|
395
|
+
locale: string;
|
|
396
|
+
routePath: string;
|
|
397
|
+
title: string;
|
|
398
|
+
description: string;
|
|
399
|
+
status: 'draft' | 'published';
|
|
400
|
+
search: boolean;
|
|
401
|
+
ai: boolean;
|
|
402
|
+
body: string;
|
|
403
|
+
searchText: string;
|
|
404
|
+
frontmatter: CanofoldFrontmatter;
|
|
405
|
+
}
|
|
406
|
+
interface CanofoldExtensionPagePatch {
|
|
407
|
+
title?: string;
|
|
408
|
+
description?: string;
|
|
409
|
+
searchText?: string;
|
|
410
|
+
search?: boolean;
|
|
411
|
+
ai?: boolean;
|
|
412
|
+
}
|
|
413
|
+
interface CanofoldExtensionGenerateContext {
|
|
414
|
+
pages: readonly CanofoldExtensionPage[];
|
|
415
|
+
emitFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Versioned, semantic site-build contract. Compiler ASTs and internal render
|
|
419
|
+
* plugins intentionally stay private so upgrades do not depend on pipeline order.
|
|
420
|
+
* Per-document syntax belongs to MarkdownPlugin; whole-site search indexing
|
|
421
|
+
* belongs to SearchProvider.
|
|
422
|
+
*/
|
|
423
|
+
interface CanofoldExtension {
|
|
424
|
+
apiVersion: typeof CANOFOLD_EXTENSION_API_VERSION;
|
|
425
|
+
name: string;
|
|
426
|
+
/** Every generated path must be declared up front and is scoped under extensions/{name}/. */
|
|
427
|
+
outputs?: string[];
|
|
428
|
+
transformSource?(context: Readonly<CanofoldExtensionSourceContext>): string | Promise<string>;
|
|
429
|
+
extendPage?(page: Readonly<CanofoldExtensionPage>): CanofoldExtensionPagePatch | void | Promise<CanofoldExtensionPagePatch | void>;
|
|
430
|
+
generate?(context: CanofoldExtensionGenerateContext): void | Promise<void>;
|
|
431
|
+
}
|
|
432
|
+
type CanofoldExtensionOptions = {
|
|
433
|
+
[key: string]: CanofoldJsonValue;
|
|
434
|
+
};
|
|
435
|
+
type CanofoldExtensionFactory = (options: Readonly<CanofoldExtensionOptions>) => CanofoldExtension | Promise<CanofoldExtension>;
|
|
436
|
+
declare function defineExtension(extension: CanofoldExtension): CanofoldExtension;
|
|
437
|
+
declare function defineExtension(factory: CanofoldExtensionFactory): CanofoldExtensionFactory;
|
|
438
|
+
|
|
439
|
+
export { CANOFOLD_EXTENSION_API_VERSION, type CanofoldConfigInput, type CanofoldExtension, type CanofoldExtensionDescriptor, type CanofoldExtensionFactory, type CanofoldExtensionGenerateContext, type CanofoldExtensionPage, type CanofoldExtensionPagePatch, type CanofoldExtensionSourceContext, type CanofoldJsonValue, type SearchProvider, type SearchProviderContext, canofoldVersion, defineConfig, defineExtension, defineSearchProvider };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as t,f,g as r}from"./chunk-ENPRUF6E.js";import"./chunk-XYJ2OBL3.js";import{a as n}from"./chunk-
|
|
1
|
+
import{c as t,f,g as r}from"./chunk-ENPRUF6E.js";import"./chunk-XYJ2OBL3.js";import{a as n}from"./chunk-KUDMXVOM.js";import"./chunk-JK7ZNBUA.js";import{a as o}from"./chunk-AYDF3IFZ.js";function i(e){return e}o(i,"defineConfig");export{f as CANOFOLD_EXTENSION_API_VERSION,n as canofoldVersion,i as defineConfig,r as defineExtension,t as defineSearchProvider};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-M6T5RSNJ.js";import{a as b}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-M6T5RSNJ.js";import{a as b}from"./chunk-KUDMXVOM.js";import{a as k,d as S}from"./chunk-EAYVCA3Z.js";import{a as T,d as j,f as N}from"./chunk-JK7ZNBUA.js";import{a as l}from"./chunk-AYDF3IFZ.js";import{mkdir as U,readFile as B,readdir as G,rm as V,rmdir as Y,writeFile as _}from"fs/promises";import{dirname as W,isAbsolute as Q,join as E}from"path";import{createInterface as Z}from"readline/promises";import{join as y}from"path";var R=`/**
|
|
2
2
|
* Minimal declarations for trusted project-local TSX components.
|
|
3
3
|
*
|
|
4
4
|
* Canofold intentionally does not publish or emulate a UI component module.
|
|
@@ -68,4 +68,4 @@ export default defineConfig({
|
|
|
68
68
|
}
|
|
69
69
|
})
|
|
70
70
|
`}l(H,"configTemplate");function O(e){let{docsDir:t,defaultLocale:n,locales:i,includeContent:r,includeConfig:s}=e,c={[y(t,"canofold-env.d.ts")]:R};if(s&&(c["canofold.config.ts"]=H(t,n,i)),!r)return c;for(let g of i){let p=g===n?t:y(t,g),a=q(g);c[y(p,"index.md")]=a?.index??A,a&&(c[y(p,"guide.md")]=a.guide)}return c}l(O,"createInitFiles");async function J(e,t=""){let n;try{n=await G(e,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return[];throw r}let i=[];for(let r of n){let s=t?E(t,r.name):r.name;if(r.isFile()&&k(r.name)&&i.push(s),r.isDirectory()&&(t||r.name!=="public"))for(let c of await J(E(e,r.name),s))i.push(c)}return i.sort((r,s)=>r.localeCompare(s))}l(J,"listMarkdownFiles");function ee(e,t){for(let n of t)try{Intl.getCanonicalLocales(n)}catch{throw new Error(`Invalid locale: ${n}`)}if(new Set(t.map(n=>n.toLowerCase())).size!==t.length)throw new Error("Locales must not contain duplicates");if(!t.some(n=>n.toLowerCase()===e.toLowerCase()))throw new Error(`Default locale ${e} must be included in locales`)}l(ee,"validateLocaleSelection");async function te(e=Z({input:process.stdin,output:process.stdout})){try{let n=((await e.question("Existing documents found. Enter their locale, or a comma-separated locale list (default: zh): ")).trim()||"zh").split(",").map(i=>i.trim());if(n.some(i=>!i))throw new Error("Locales must be a comma-separated list of locale identifiers");return n}catch(t){throw t.code==="ABORT_ERR"?new Error("Canofold initialization cancelled"):t}finally{e.close()}}l(te,"promptForLocales");function ne(e,t){return e.length===t.length&&e.every((n,i)=>n.toLowerCase()===t[i]?.toLowerCase())}l(ne,"sameLocales");function oe(e,t){if(e.docsDir&&e.docsDir!==t.docsDir)throw new Error(`--docs-dir ${e.docsDir} conflicts with configured docsDir ${t.docsDir}`);if(e.locale&&e.locale.toLowerCase()!==t.i18n.defaultLocale.toLowerCase())throw new Error(`--locale ${e.locale} conflicts with configured defaultLocale ${t.i18n.defaultLocale}`);if(e.locales&&!ne(e.locales,t.i18n.locales))throw new Error(`--locales ${e.locales.join(",")} conflicts with configured locales ${t.i18n.locales.join(",")}`)}l(oe,"assertOptionsMatchConfig");function $(e){return S(e.replace(/\\/g,"/")).normalize("NFC").toLocaleLowerCase("en-US")}l($,"portablePageKey");function ie(e,t,n){if(!e.length)return[];let i=[],r=e.map(a=>a.replace(/\\/g,"/")),s=l(a=>n==="."?a:`${n.replace(/\\/g,"/")}/${a}`,"displayPath"),c=t.normalize("NFC").toLocaleLowerCase("en-US");r.some(a=>{let h=$(a);return h==="index"||h===`${c}/index`})||i.push(`no default-language index.md or index.mdx was found in ${n}`);let p=new Map;for(let a of r)a.startsWith(`${t}/`)||p.set($(a),a);for(let a of r){if(!a.startsWith(`${t}/`))continue;let h=a.slice(t.length+1),u=p.get($(h));u&&i.push(`${s(u)} and ${s(a)} map to the same default-language page; keep only one source`)}return i}l(ie,"existingContentWarnings");async function re(e,t){let n=[],i=e;for(;!await T(i);){n.push(i);let r=W(i);if(r===i)break;i=r}for(let r of n.reverse())try{await U(r),t.push(r)}catch(s){if(s.code!=="EEXIST")throw s}}l(re,"createMissingDirectoryChain");async function xe(e,t={}){let n=e.targetDir?E(e.cwd,e.targetDir):e.cwd,{findConfigPath:i,loadConfig:r}=await import("./load-W4JHZIBF.js"),s=!!await i(n),c=s?await r(n):void 0;c&&oe(e,c);let g=c?.docsDir??e.docsDir??"docs";if(Q(g))throw new Error("docsDir must be a relative path");let p=j(n,g,"docsDir");await N(n,p,"docsDir");let a=await J(p),h=a.length>0,u=e.locales;if(h&&!s&&!e.locale&&!u){let o=e.localePrompt??(process.stdin.isTTY&&process.stdout.isTTY?te:void 0);if(!o){let f=a[0]??"";throw new Error(`Found ${a.length} existing Markdown file(s) in "${g}" (e.g. "${f}"), but cannot determine their language in a non-interactive environment. Specify the locale explicitly: canofold init --locale <locale> (e.g. --locale zh)`)}u=await o()}let x=c?.i18n.defaultLocale??e.locale??u?.[0]??"zh";u=c?.i18n.locales??u??[x],ee(x,u);let M=O({docsDir:g,defaultLocale:x,locales:u,includeContent:!h,includeConfig:!s}),P=[],F=[],D=ie(a,x,g);for(let[o,f]of Object.entries(M)){let w=E(n,o);try{let C=await B(w,"utf8");F.push(o),C!==f&&D.push(`${o} already exists with different content`)}catch(C){let v=C.code;if(v==="EISDIR")throw new Error(`Cannot create ${o} because a directory exists at that path`);if(v!=="ENOENT")throw C;P.push({relativePath:o,content:f,fullPath:w})}}let m={mode:s?"configured":h?"adopt":"create",createFiles:P,keepFiles:F,warnings:D};if(!m.createFiles.length){for(let o of m.warnings)d(`Warning: ${o}`);d(`Canofold is already initialized in ${n}`);return}let L=[],K=t.writeFile??((o,f,w)=>_(o,f,w)),X=[...new Set(m.createFiles.map(o=>W(o.fullPath)))].sort((o,f)=>o.length-f.length),I=[];try{for(let o of X)await re(o,I);for(let o of m.createFiles)await K(o.fullPath,o.content,{flag:"wx"}),L.push(o.fullPath)}catch(o){await Promise.all(L.map(f=>V(f,{force:!0})));for(let f of I.sort((w,C)=>C.length-w.length))try{await Y(f)}catch{}throw o}for(let o of m.createFiles)d(`Created ${o.relativePath}`);for(let o of m.keepFiles)d(`Kept existing ${o}`);for(let o of m.warnings)d(`Warning: ${o}`);if(m.mode==="adopt"){let o=a.length===1?"document":"documents";d(`Adopted ${a.length} existing ${o} in ${n}`),d(`Kept ${a.length} existing ${o} unchanged`),d("Next: canofold check")}else m.mode==="configured"?(d(`Created missing documentation files in ${n}`),d("Next: canofold dev")):(d(`Created Canofold docs in ${n}`),d("Next: canofold dev"));d("Add .canofold/ to .gitignore if this directory is versioned.")}l(xe,"runInit");export{te as promptForLocales,xe as runInit};
|
|
71
|
-
//# sourceMappingURL=init-
|
|
71
|
+
//# sourceMappingURL=init-5E5UEXP2.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RenderMarkdownOptions } from '@canofold/markdown';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
__canofoldBootstrapMarkdown?: () => Promise<void>;
|
|
6
|
+
__canofoldEnhanceMarkdown?: (root: ParentNode) => Promise<() => void>;
|
|
7
|
+
__canofoldMarkdownDispose?: () => void;
|
|
8
|
+
__canofoldMarkdownReady?: Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
interface PlaygroundClientOptions {
|
|
12
|
+
basePath: string;
|
|
13
|
+
markdown: Omit<RenderMarkdownOptions, 'labels'>;
|
|
14
|
+
}
|
|
15
|
+
declare function mountPlaygrounds(options: PlaygroundClientOptions): void;
|
|
16
|
+
|
|
17
|
+
export { type PlaygroundClientOptions, mountPlaygrounds };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canofold",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A static-first, minimally invasive knowledge and documentation platform for Markdown, MDX, search, and AI-ready output.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Canofold Contributors",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"chokidar": "^5.0.0",
|
|
52
52
|
"esbuild": "^0.28.2",
|
|
53
53
|
"gray-matter": "^4.0.3",
|
|
54
|
-
"lucide-react": "
|
|
54
|
+
"lucide-react": "1.34.0",
|
|
55
55
|
"react": "^19.2.8",
|
|
56
56
|
"react-dom": "^19.2.8",
|
|
57
57
|
"semver": "^7.8.5",
|
|
58
58
|
"zod": "^4.4.3",
|
|
59
|
-
"@canofold/markdown": "0.2.
|
|
59
|
+
"@canofold/markdown": "0.2.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/react": "^19.2.18",
|
package/dist/build-RBMQ6TZ7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-56TT2V3X.js";import"./chunk-4E7M3CIK.js";import"./chunk-ENPRUF6E.js";import"./chunk-XYJ2OBL3.js";import"./chunk-OATSOVSV.js";import"./chunk-4OALGQQB.js";import"./chunk-M6T5RSNJ.js";import"./chunk-3TIVCYR7.js";import"./chunk-EAYVCA3Z.js";import"./chunk-JK7ZNBUA.js";import"./chunk-AYDF3IFZ.js";export{b as runBuild,a as versionSatisfies};
|
|
2
|
-
//# sourceMappingURL=build-RBMQ6TZ7.js.map
|
package/dist/chunk-3TIVCYR7.js
DELETED