@veluai/velu 0.2.44 → 0.2.46
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/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`,"utf-8");let o=await sn(e);console.log(`[velu] created ${t}/`);for(let i of o)console.log(` ${i}`);console.log(""),console.log("Next steps:"),console.log(` cd ${t}`),console.log(" velu dev")}async function sn(e,t=e,r=[]){let n=await me.readdir(e,{withFileTypes:!0});for(let o of n){let i=de.join(e,o.name);o.isDirectory()?await sn(i,t,r):r.push(de.relative(t,i).split(de.sep).join("/"))}return r.sort()}var eo,to,ln=_(()=>{eo=de.dirname(Qr(import.meta.url)),to=de.resolve(eo,"..","templates","starter")});import Se from"node:fs";import K from"node:path";import{fileURLToPath as ro}from"node:url";import{parse as oo,printParseErrorCode as io}from"jsonc-parser";import so from"js-yaml";function le(e,t){let r=K.relative(e,t);return r===""||!r.startsWith(`..${K.sep}`)&&r!==".."&&!K.isAbsolute(r)}function ht(e,t){let r=[],n=oo(e.replace(/^\uFEFF/,""),r,{allowTrailingComma:!0});if(r.length)throw new Error(`${t}: ${io(r[0].error)} at offset ${r[0].offset}`);return n}function cn(e,t){let r=Se.realpathSync(e);function n(i,a=[]){if(!le(r,Se.realpathSync(i)))throw new Error("Config reference escapes the source directory.");if(a.includes(i))throw new Error(`Circular config reference: ${gt(K.relative(e,i))}`);if(a.length>50)throw new Error("Config reference nesting exceeds 50 levels.");let s=Se.readFileSync(i,"utf8"),l=/\.ya?ml$/i.test(i)?so.load(s):ht(s,K.basename(i));function c(u){if(Array.isArray(u))return u.map(c);if(!W(u))return u;if(typeof u.$ref=="string"){if(!/^\.\.?\//.test(u.$ref)||/[#?]/.test(u.$ref))throw new Error(`Config $ref must be a local JSON/YAML file without a fragment: ${u.$ref}`);let p=K.resolve(K.dirname(i),u.$ref);if(!le(e,p))throw new Error("Config reference escapes the source directory.");let y=n(p,[...a,i]),m=Object.fromEntries(Object.entries(u).filter(([g])=>g!=="$ref").map(([g,v])=>[g,c(v)]));if(Object.keys(m).length&&!W(y))throw new Error("Config $ref siblings require an object reference.");return W(y)?{...y,...m}:y}return Object.fromEntries(Object.entries(u).map(([p,y])=>[p,c(y)]))}return c(l)}let o=n(K.join(e,t));if(!W(o))throw new Error(`${t} must contain an object.`);return o}function ao(e,t){let r=e.navigation||[],n=e.tabs||[];if(!Array.isArray(r)||!Array.isArray(n))throw new Error("Legacy navigation and tabs must be arrays.");function o(a,s,l){return a.flatMap(c=>{if(typeof c=="string"){let p=c.replace(/^\//,"");return(s?p===s||p.startsWith(s+"/"):!l.some(m=>p===m||p.startsWith(m+"/")))?[c]:[]}if(!W(c))return[];let u=o(c.pages||[],s,l);return u.length?[{...c,pages:u}]:[]})}let i={groups:r};if(n.length){let a=n.filter(c=>c.url&&!/^https?:/.test(c.url)).map(c=>c.url.replace(/^\/+|\/+$/g,"")),s=n.map(c=>{if(/^https?:/.test(c.url||""))return{tab:c.name,href:c.url,...c.icon?{icon:c.icon}:{}};let u=(c.url||"").replace(/^\/+|\/+$/g,"");return{tab:c.name,...c.icon?{icon:c.icon}:{},groups:o(r,u,a)}}),l=o(r,"",a);l.length&&!n.some(c=>!c.url||c.url==="/")&&s.unshift({tab:"Documentation",groups:l}),i={tabs:s}}return Array.isArray(e.anchors)&&(i.anchors=e.anchors.map(({name:a,url:s,...l})=>({...l,anchor:a,href:s}))),e.versions&&t("legacy-versions","warning","versions","Legacy version filtering needs review; all groups are retained. Convert version-specific groups to navigation.versions."),i}function un(e,t,r){let n=structuredClone(e);if(n.theme==="sequoia"&&(n.theme="vepa",n.contextual==null&&(n.contextual={options:[]})),n.theme==="mint"&&(n.theme="thulir",n.contextual==null&&(n.contextual={options:[]})),n.theme==="maple"&&(n.theme="aalam",n.contextual==null&&(n.contextual={options:[]})),n.theme==="aspen"&&(n.theme="nila",n.contextual==null&&(n.contextual={options:[]})),n.theme==="luma"&&(n.theme="kadhir"),n.theme&&!["velu","vepa","thulir","aalam","nila","kadhir"].includes(n.theme)&&(r("unsupported-config","warning","theme","This theme has no Velu preset; original setting preserved in source config."),delete n.theme),t==="mint.json"||Array.isArray(n.navigation)){if(n.navigation=ao(n,r),n.topbarLinks&&(n.navbar={...n.navbar,links:n.topbarLinks.map(({name:p,...y})=>({...y,label:p}))}),n.topbarCta){let{name:p,...y}=n.topbarCta;p&&!y.label&&(y.label=p),n.navbar={...n.navbar,primary:y}}n.footerSocials&&(n.footer={...n.footer,socials:n.footerSocials}),n.modeToggle&&r("appearance","warning","modeToggle","Set the initial theme and theme-switcher behavior manually in Velu."),typeof n.api?.baseUrl=="string"&&(n.api.server=n.api.baseUrl),n.api?.request?.example?.languages&&(n.api.examples={languages:n.api.request.example.languages});for(let p of["tabs","anchors","topbarLinks","topbarCta","footerSocials","modeToggle"])delete n[p];n.api&&(delete n.api.baseUrl,delete n.api.request)}if(n.fonts&&!n.font){let p=n.fonts.family||n.fonts.body?.family;p&&(n.font={family:p}),r("fonts","warning","fonts","Body font family migrated where available; custom font sources, weights, and heading fonts need review."),delete n.fonts}W(n.favicon)&&(n.favicon=n.favicon.light||n.favicon.dark,r("favicon-theme","warning","favicon","Velu uses one favicon; selected the light variant when available.")),W(n.logo)&&(n.logo.light??=n.logo.dark,n.logo.dark??=n.logo.light);function o(p,y="navigation"){if(Array.isArray(p))return p.map((g,v)=>o(g,`${y}[${v}]`));if(!W(p))return p;let m={...p};if(Array.isArray(m.dropdowns)&&!m.products&&!m.tabs&&(m.tabs=m.dropdowns.map(({dropdown:g,...v})=>({tab:g,...v})),delete m.dropdowns,r("navigation-dropdowns","warning",y,"Dropdowns converted to tabs. Check navigation layout and URLs.")),m.global){for(let g of["anchors","tabs"])Array.isArray(m.global[g])&&(m[g]=[...m[g]||[],...m.global[g]]);r("navigation-global","warning",`${y}.global`,"Global anchors/tabs merged into this container. Review switcher visibility; other global entries remain in the original config."),delete m.global}W(m.icon)&&typeof m.icon.name=="string"&&(m.icon=m.icon.name,r("icon-library","warning",`${y}.icon`,"Icon name retained; check its equivalent in Velu\u2019s Lucide icon library.")),W(m.openapi)&&typeof m.openapi.source=="string"&&(r("openapi-options","warning",`${y}.openapi`,"OpenAPI source retained; generation options need review."),m.openapi=m.openapi.source);for(let[g,v]of Object.entries(m))g==="pages"&&Array.isArray(v)?m[g]=v.map((d,h)=>typeof d=="string"?d.replace(/\.(mdx|md)$/i,""):o(d,`${y}.pages[${h}]`)):(W(v)||Array.isArray(v))&&(m[g]=o(v,`${y}.${g}`));return m}n.navigation=o(n.navigation||{}),(n.navigation.products||n.navigation.versions||n.navigation.languages)&&(n.navigation.preservePagePaths=!0),typeof n.description=="string"&&(n.seo={...n.seo,metatags:{description:n.description,...n.seo?.metatags}},delete n.description),n.$schema="https://veludocs.com/velu.schema.json";let i=K.dirname(ro(import.meta.url)),a=[K.resolve(i,"../../schema/velu.schema.json"),K.resolve(i,"../schema/velu.schema.json")].find(p=>Se.existsSync(p));if(!a)throw new Error("Velu config schema is missing from this installation.");let s=JSON.parse(Se.readFileSync(a,"utf8")),l=p=>p.$ref?p.$ref.split("/").slice(1).reduce((y,m)=>y[m],s):p,c=p=>Array.isArray(p)?"array":p===null?"null":typeof p;function u(p,y,m){let g=l(y);if(g.oneOf&&(g=g.oneOf.map(l).find(v=>v.type&&c(p)!==v.type||v.properties?.type?.const&&p?.type!==v.properties.type.const?!1:Array.isArray(v.required)&&v.required.length&&W(p)?v.required.every(d=>Object.prototype.hasOwnProperty.call(p,d)):!0),!g)){r("config-shape","error",m,"Value does not match any supported Velu shape; original retained in source config.");return}if(g.type&&c(p)!==g.type||g.enum&&!g.enum.includes(p)||"const"in g&&p!==g.const){r("config-value","error",m,"Unsupported value or type; original retained in source config.");return}if(typeof p=="string"&&g.minLength&&p.length<g.minLength&&r("config-value","error",m,"Value must not be empty."),W(p)){let v={};for(let[d,h]of Object.entries(p)){let S=m?`${m}.${d}`:d,O=g.properties?.[d]||(W(g.additionalProperties)?g.additionalProperties:null);if(!O&&g.additionalProperties===!1){let x=/(^|\.)(auth|authentication|groups|hidden|public|permissions|personalization)(\.|$)/.test(S);r("unsupported-config",x?"error":"warning",S,x?"Access or visibility rules require manual migration before publishing.":"No equivalent in the Velu schema; original setting preserved in source config.");continue}let A=O?u(h,O,S):h;A!==void 0&&Object.defineProperty(v,d,{value:A,enumerable:!0,writable:!0,configurable:!0})}for(let d of g.required||[])d in v||r("required-config","error",m?`${m}.${d}`:d,"Required Velu setting is missing.");return v}return Array.isArray(p)&&g.items?(g.maxItems&&p.length>g.maxItems&&r("config-limit","warning",m,`Velu supports up to ${g.maxItems} entries here; review rendering.`),p.map((v,d)=>u(v,g.items,`${m}[${d}]`)).filter(v=>v!==void 0)):p}return u(n,s,"")}var W,gt,Ge=_(()=>{W=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),gt=e=>e.split(K.sep).join("/")});var te,We=_(()=>{te=["Callout","Card","CardGroup","Accordion","AccordionGroup","Columns","Field","Prompt","Steps","Step","Tree","Folder","File","Update","Icon","Image","CodeBlock","CodeGroup","MethodBadge","ApiPath","TryItBar","ApiField","ApiClient","ApiSidebar"]});import q from"node:path";import{createProcessor as lo,compile as co}from"@mdx-js/mdx";import pn from"remark-frontmatter";import uo from"remark-mdx-frontmatter";import fn from"remark-gfm";import{visit as mn}from"unist-util-visit";import po from"js-yaml";import{parse as fo}from"@babel/parser";import mo from"postcss";async function dn(e,t,r,n,{endpointConverted:o=!1}={}){let i=lo({remarkPlugins:[pn,fn]}),a;try{a=i.parse(e)}catch(d){return n("mdx-syntax","error",t,d.reason||d.message,d.line),{text:e,adapters:[]}}let s=new Set,l=[],c=[],u=new Set,p=new Set,y=new Set,m=(d,h,S)=>c.push({start:d,end:h,value:S});mn(a,"mdxjsEsm",d=>{for(let h of d.data?.estree?.body||[]){if(h.type==="ImportDeclaration"){for(let O of h.specifiers)s.add(O.local.name);l.push({node:d,stmt:h})}let S=h.declaration;S?.id?.name&&s.add(S.id.name);for(let O of S?.declarations||[])O.id?.name&&s.add(O.id.name)}});let g=(d,h=!1)=>{if(typeof d!="string"||/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(d)||h&&!d.startsWith(".")&&!d.startsWith("/"))return d;let[,S,O]=/^([^?#]*)(.*)$/.exec(d),A=q.posix.normalize(S.startsWith("/")?S.slice(1):q.posix.join(q.posix.dirname(t),S)),x=r.get(A);if(!x)return h&&n("missing-import","error",t,`Local import cannot be resolved in migrated files: ${d}`),d;if(h){let w=q.posix.relative(q.posix.dirname(r.get(t)||t),x);return(w.startsWith(".")?w:"./"+w)+O}return/\.(md|mdx)$/i.test(x)||p.add(x),/\.mdx$/i.test(x)&&/\.(md|mdx)$/i.test(S)?S.replace(/\.(md|mdx)$/i,"")+O:d};for(let{stmt:d}of l){let h=d.source.value;/^(?:@mintlify\/|next(?:\/|$))/.test(h)&&n("runtime-import","error",t,`Replace the runtime dependency ${h} with a Velu/React equivalent.`);let S=g(h,!0);S!==h&&m(d.source.start,d.source.end,JSON.stringify(S))}mn(a,d=>{if(d.type==="yaml")try{let w=po.load(d.value)||{};for(let L of Object.keys(w))if(["auth","groups","public","hidden"].includes(L))n("page-access","error",t,`Frontmatter ${L} requires manual visibility/access migration.`,d.position.start.line);else{if(L==="openapi"&&o)continue;["api","openapi","asyncapi"].includes(L)?n("endpoint-frontmatter","error",t,`Frontmatter ${L} is preserved but does not generate an endpoint in Velu. Wire the spec into navigation.openapi and review endpoint routes.`,d.position.start.line):["title","description","icon","sidebarTitle","mode","keywords","og:title","og:description","og:image"].includes(L)||n("frontmatter-review","warning",t,`Frontmatter ${L} is preserved; verify its behavior in Velu.`,d.position.start.line)}}catch(w){n("frontmatter-syntax","error",t,w.message,d.position.start.line)}if(["link","image","definition"].includes(d.type)&&d.url){let w=g(d.url);if(w!==d.url){let L=d.position.start.offset,B=e.slice(L,d.position.end.offset).lastIndexOf(d.url);B>=0&&m(L+B,L+B+d.url.length,w)}}if(!["mdxJsxFlowElement","mdxJsxTextElement"].includes(d.type)||!d.name)return;let h=d.name,S=d.position.start.line;if(s.has(h.split(".")[0]))return;y.add(h);let O=yt[h]?"Callout":["ParamField","ResponseField"].includes(h)?"Field":h==="Expandable"?"Accordion":h;if(O!==h&&s.has(O)){n("component-name-conflict","error",t,`Cannot convert <${h}> to <${O}> because that name is already locally defined. Rename the local binding before migration.`,S);return}let A=d.attributes.filter(w=>w.type==="mdxJsxAttribute"),x=(w,L)=>{let P=A.find(B=>B.name===w);P&&!A.some(B=>B.name===L)&&m(P.position.start.offset,P.position.start.offset+w.length,L)};if(h==="ParamField")for(let w of["body","query","path","header","cookie"])x(w,"name");if(h==="CardGroup"&&x("cols","limit"),h==="Accordion"&&x("default-open","defaultOpen"),h==="Expandable"&&(x("title","title"),A.some(w=>w.name==="title")||m(d.position.start.offset+1+h.length,d.position.start.offset+1+h.length,' title="Details"')),O!==h){let w=d.position.start.offset;m(w+1,w+1+h.length,O+(yt[h]?` type="${yt[h]}"`:""));let L=d.position.end.offset,P=new RegExp(`</${h}\\s*>$`).exec(e.slice(w,L));P&&m(L-P[0].length+2,L-P[0].length+2+h.length,O)}go.has(h)?(u.add(h),n("component-adapter","warning",t,`<${h}> uses an editable React adapter. Review visual styling and optional props.`,S)):/^[A-Z]/.test(O)&&!ho.has(O)&&n("unsupported-component","error",t,`<${h}> needs a local component implementation or import.`,S);for(let w of A)if(["href","src"].includes(w.name)&&typeof w.value=="string"){let L=g(w.value);if(L!==w.value){let P=w.position.start.offset,ee=e.slice(P,w.position.end.offset).indexOf(w.value);ee>=0&&m(P+ee,P+ee+w.value.length,L)}}}),c.sort((d,h)=>h.start-d.start||h.end-d.end);let v=e;for(let d of c)v=v.slice(0,d.start)+d.value+v.slice(d.end);if(u.size){let d=q.posix.relative(q.posix.dirname(r.get(t)||t),ge);v+=`
|
|
2
|
+
var Qr=Object.defineProperty;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var Se=(e,t)=>{for(var r in t)Qr(e,r,{get:t[r],enumerable:!0})};var an={};Se(an,{initProject:()=>ro});import de from"node:fs/promises";import ge from"node:path";import{fileURLToPath as eo}from"node:url";async function ro(e,t){try{if((await de.readdir(e)).length>0)throw new Error(`Directory "${t}" already exists and is not empty. Choose a different name or remove the folder first.`)}catch(i){if(i.code!=="ENOENT")throw i}await de.mkdir(e,{recursive:!0}),await de.cp(no,e,{recursive:!0});let r=ge.join(e,"velu.json"),n=JSON.parse(await de.readFile(r,"utf-8"));n.name=t,await de.writeFile(r,JSON.stringify(n,null,2)+`
|
|
3
|
+
`,"utf-8");let o=await sn(e);console.log(`[velu] created ${t}/`);for(let i of o)console.log(` ${i}`);console.log(""),console.log("Next steps:"),console.log(` cd ${t}`),console.log(" velu dev")}async function sn(e,t=e,r=[]){let n=await de.readdir(e,{withFileTypes:!0});for(let o of n){let i=ge.join(e,o.name);o.isDirectory()?await sn(i,t,r):r.push(ge.relative(t,i).split(ge.sep).join("/"))}return r.sort()}var to,no,ln=_(()=>{to=ge.dirname(eo(import.meta.url)),no=ge.resolve(to,"..","templates","starter")});import ke from"node:fs";import X from"node:path";import{fileURLToPath as oo}from"node:url";import{parse as io,printParseErrorCode as so}from"jsonc-parser";import ao from"js-yaml";function le(e,t){let r=X.relative(e,t);return r===""||!r.startsWith(`..${X.sep}`)&&r!==".."&&!X.isAbsolute(r)}function ht(e,t){let r=[],n=io(e.replace(/^\uFEFF/,""),r,{allowTrailingComma:!0});if(r.length)throw new Error(`${t}: ${so(r[0].error)} at offset ${r[0].offset}`);return n}function cn(e,t){let r=ke.realpathSync(e);function n(i,a=[]){if(!le(r,ke.realpathSync(i)))throw new Error("Config reference escapes the source directory.");if(a.includes(i))throw new Error(`Circular config reference: ${gt(X.relative(e,i))}`);if(a.length>50)throw new Error("Config reference nesting exceeds 50 levels.");let s=ke.readFileSync(i,"utf8"),l=/\.ya?ml$/i.test(i)?ao.load(s):ht(s,X.basename(i));function c(u){if(Array.isArray(u))return u.map(c);if(!W(u))return u;if(typeof u.$ref=="string"){if(!/^\.\.?\//.test(u.$ref)||/[#?]/.test(u.$ref))throw new Error(`Config $ref must be a local JSON/YAML file without a fragment: ${u.$ref}`);let p=X.resolve(X.dirname(i),u.$ref);if(!le(e,p))throw new Error("Config reference escapes the source directory.");let y=n(p,[...a,i]),m=Object.fromEntries(Object.entries(u).filter(([g])=>g!=="$ref").map(([g,v])=>[g,c(v)]));if(Object.keys(m).length&&!W(y))throw new Error("Config $ref siblings require an object reference.");return W(y)?{...y,...m}:y}return Object.fromEntries(Object.entries(u).map(([p,y])=>[p,c(y)]))}return c(l)}let o=n(X.join(e,t));if(!W(o))throw new Error(`${t} must contain an object.`);return o}function lo(e,t){let r=e.navigation||[],n=e.tabs||[];if(!Array.isArray(r)||!Array.isArray(n))throw new Error("Legacy navigation and tabs must be arrays.");function o(a,s,l){return a.flatMap(c=>{if(typeof c=="string"){let p=c.replace(/^\//,"");return(s?p===s||p.startsWith(s+"/"):!l.some(m=>p===m||p.startsWith(m+"/")))?[c]:[]}if(!W(c))return[];let u=o(c.pages||[],s,l);return u.length?[{...c,pages:u}]:[]})}let i={groups:r};if(n.length){let a=n.filter(c=>c.url&&!/^https?:/.test(c.url)).map(c=>c.url.replace(/^\/+|\/+$/g,"")),s=n.map(c=>{if(/^https?:/.test(c.url||""))return{tab:c.name,href:c.url,...c.icon?{icon:c.icon}:{}};let u=(c.url||"").replace(/^\/+|\/+$/g,"");return{tab:c.name,...c.icon?{icon:c.icon}:{},groups:o(r,u,a)}}),l=o(r,"",a);l.length&&!n.some(c=>!c.url||c.url==="/")&&s.unshift({tab:"Documentation",groups:l}),i={tabs:s}}return Array.isArray(e.anchors)&&(i.anchors=e.anchors.map(({name:a,url:s,...l})=>({...l,anchor:a,href:s}))),e.versions&&t("legacy-versions","warning","versions","Legacy version filtering needs review; all groups are retained. Convert version-specific groups to navigation.versions."),i}function un(e,t,r){let n=structuredClone(e);if(n.theme==="sequoia"&&(n.theme="vepa",n.contextual==null&&(n.contextual={options:[]})),n.theme==="mint"&&(n.theme="thulir",n.contextual==null&&(n.contextual={options:[]})),n.theme==="maple"&&(n.theme="aalam",n.contextual==null&&(n.contextual={options:[]})),n.theme==="aspen"&&(n.theme="nila",n.contextual==null&&(n.contextual={options:[]})),n.theme==="luma"&&(n.theme="kadhir"),n.theme&&!["velu","vepa","thulir","aalam","nila","kadhir"].includes(n.theme)&&(r("unsupported-config","warning","theme","This theme has no Velu preset; original setting preserved in source config."),delete n.theme),t==="mint.json"||Array.isArray(n.navigation)){if(n.navigation=lo(n,r),n.topbarLinks&&(n.navbar={...n.navbar,links:n.topbarLinks.map(({name:p,...y})=>({...y,label:p}))}),n.topbarCta){let{name:p,...y}=n.topbarCta;p&&!y.label&&(y.label=p),n.navbar={...n.navbar,primary:y}}n.footerSocials&&(n.footer={...n.footer,socials:n.footerSocials}),n.modeToggle&&r("appearance","warning","modeToggle","Set the initial theme and theme-switcher behavior manually in Velu."),typeof n.api?.baseUrl=="string"&&(n.api.server=n.api.baseUrl),n.api?.request?.example?.languages&&(n.api.examples={languages:n.api.request.example.languages});for(let p of["tabs","anchors","topbarLinks","topbarCta","footerSocials","modeToggle"])delete n[p];n.api&&(delete n.api.baseUrl,delete n.api.request)}if(n.fonts&&!n.font){let p=n.fonts.family||n.fonts.body?.family;p&&(n.font={family:p}),r("fonts","warning","fonts","Body font family migrated where available; custom font sources, weights, and heading fonts need review."),delete n.fonts}W(n.favicon)&&(n.favicon=n.favicon.light||n.favicon.dark,r("favicon-theme","warning","favicon","Velu uses one favicon; selected the light variant when available.")),W(n.logo)&&(n.logo.light??=n.logo.dark,n.logo.dark??=n.logo.light);function o(p,y="navigation"){if(Array.isArray(p))return p.map((g,v)=>o(g,`${y}[${v}]`));if(!W(p))return p;let m={...p};if(Array.isArray(m.dropdowns)&&!m.products&&!m.tabs&&(m.tabs=m.dropdowns.map(({dropdown:g,...v})=>({tab:g,...v})),delete m.dropdowns,r("navigation-dropdowns","warning",y,"Dropdowns converted to tabs. Check navigation layout and URLs.")),m.global){for(let g of["anchors","tabs"])Array.isArray(m.global[g])&&(m[g]=[...m[g]||[],...m.global[g]]);r("navigation-global","warning",`${y}.global`,"Global anchors/tabs merged into this container. Review switcher visibility; other global entries remain in the original config."),delete m.global}W(m.icon)&&typeof m.icon.name=="string"&&(m.icon=m.icon.name,r("icon-library","warning",`${y}.icon`,"Icon name retained; check its equivalent in Velu\u2019s Lucide icon library.")),W(m.openapi)&&typeof m.openapi.source=="string"&&(r("openapi-options","warning",`${y}.openapi`,"OpenAPI source retained; generation options need review."),m.openapi=m.openapi.source);for(let[g,v]of Object.entries(m))g==="pages"&&Array.isArray(v)?m[g]=v.map((d,h)=>typeof d=="string"?d.replace(/\.(mdx|md)$/i,""):o(d,`${y}.pages[${h}]`)):(W(v)||Array.isArray(v))&&(m[g]=o(v,`${y}.${g}`));return m}n.navigation=o(n.navigation||{}),(n.navigation.products||n.navigation.versions||n.navigation.languages)&&(n.navigation.preservePagePaths=!0),typeof n.description=="string"&&(n.seo={...n.seo,metatags:{description:n.description,...n.seo?.metatags}},delete n.description),n.$schema="https://veludocs.com/velu.schema.json";let i=X.dirname(oo(import.meta.url)),a=[X.resolve(i,"../../schema/velu.schema.json"),X.resolve(i,"../schema/velu.schema.json")].find(p=>ke.existsSync(p));if(!a)throw new Error("Velu config schema is missing from this installation.");let s=JSON.parse(ke.readFileSync(a,"utf8")),l=p=>p.$ref?p.$ref.split("/").slice(1).reduce((y,m)=>y[m],s):p,c=p=>Array.isArray(p)?"array":p===null?"null":typeof p;function u(p,y,m){let g=l(y);if(g.oneOf&&(g=g.oneOf.map(l).find(v=>v.type&&c(p)!==v.type||v.properties?.type?.const&&p?.type!==v.properties.type.const?!1:Array.isArray(v.required)&&v.required.length&&W(p)?v.required.every(d=>Object.prototype.hasOwnProperty.call(p,d)):!0),!g)){r("config-shape","error",m,"Value does not match any supported Velu shape; original retained in source config.");return}if(g.type&&c(p)!==g.type||g.enum&&!g.enum.includes(p)||"const"in g&&p!==g.const){r("config-value","error",m,"Unsupported value or type; original retained in source config.");return}if(typeof p=="string"&&g.minLength&&p.length<g.minLength&&r("config-value","error",m,"Value must not be empty."),W(p)){let v={};for(let[d,h]of Object.entries(p)){let S=m?`${m}.${d}`:d,T=g.properties?.[d]||(W(g.additionalProperties)?g.additionalProperties:null);if(!T&&g.additionalProperties===!1){let x=/(^|\.)(auth|authentication|groups|hidden|public|permissions|personalization)(\.|$)/.test(S);r("unsupported-config",x?"error":"warning",S,x?"Access or visibility rules require manual migration before publishing.":"No equivalent in the Velu schema; original setting preserved in source config.");continue}let O=T?u(h,T,S):h;O!==void 0&&Object.defineProperty(v,d,{value:O,enumerable:!0,writable:!0,configurable:!0})}for(let d of g.required||[])d in v||r("required-config","error",m?`${m}.${d}`:d,"Required Velu setting is missing.");return v}return Array.isArray(p)&&g.items?(g.maxItems&&p.length>g.maxItems&&r("config-limit","warning",m,`Velu supports up to ${g.maxItems} entries here; review rendering.`),p.map((v,d)=>u(v,g.items,`${m}[${d}]`)).filter(v=>v!==void 0)):p}return u(n,s,"")}var W,gt,Ge=_(()=>{W=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),gt=e=>e.split(X.sep).join("/")});var te,We=_(()=>{te=["Callout","Card","CardGroup","Accordion","AccordionGroup","Columns","Field","Prompt","Steps","Step","Tree","Folder","File","Update","Icon","Image","CodeBlock","CodeGroup","MethodBadge","ApiPath","TryItBar","ApiField","ApiClient","ApiSidebar"]});import q from"node:path";import{createProcessor as co,compile as uo}from"@mdx-js/mdx";import pn from"remark-frontmatter";import po from"remark-mdx-frontmatter";import fn from"remark-gfm";import{visit as mn}from"unist-util-visit";import fo from"js-yaml";import{parse as mo}from"@babel/parser";import go from"postcss";async function dn(e,t,r,n,{endpointConverted:o=!1}={}){let i=co({remarkPlugins:[pn,fn]}),a;try{a=i.parse(e)}catch(d){return n("mdx-syntax","error",t,d.reason||d.message,d.line),{text:e,adapters:[]}}let s=new Set,l=[],c=[],u=new Set,p=new Set,y=new Set,m=(d,h,S)=>c.push({start:d,end:h,value:S});mn(a,"mdxjsEsm",d=>{for(let h of d.data?.estree?.body||[]){if(h.type==="ImportDeclaration"){for(let T of h.specifiers)s.add(T.local.name);l.push({node:d,stmt:h})}let S=h.declaration;S?.id?.name&&s.add(S.id.name);for(let T of S?.declarations||[])T.id?.name&&s.add(T.id.name)}});let g=(d,h=!1)=>{if(typeof d!="string"||/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(d)||h&&!d.startsWith(".")&&!d.startsWith("/"))return d;let[,S,T]=/^([^?#]*)(.*)$/.exec(d),O=q.posix.normalize(S.startsWith("/")?S.slice(1):q.posix.join(q.posix.dirname(t),S)),x=r.get(O);if(!x)return h&&n("missing-import","error",t,`Local import cannot be resolved in migrated files: ${d}`),d;if(h){let w=q.posix.relative(q.posix.dirname(r.get(t)||t),x);return(w.startsWith(".")?w:"./"+w)+T}return/\.(md|mdx)$/i.test(x)||p.add(x),/\.mdx$/i.test(x)&&/\.(md|mdx)$/i.test(S)?S.replace(/\.(md|mdx)$/i,"")+T:d};for(let{stmt:d}of l){let h=d.source.value;/^(?:@mintlify\/|next(?:\/|$))/.test(h)&&n("runtime-import","error",t,`Replace the runtime dependency ${h} with a Velu/React equivalent.`);let S=g(h,!0);S!==h&&m(d.source.start,d.source.end,JSON.stringify(S))}mn(a,d=>{if(d.type==="yaml")try{let w=fo.load(d.value)||{};for(let P of Object.keys(w))if(["auth","groups","public","hidden"].includes(P))n("page-access","error",t,`Frontmatter ${P} requires manual visibility/access migration.`,d.position.start.line);else{if(P==="openapi"&&o)continue;["api","openapi","asyncapi"].includes(P)?n("endpoint-frontmatter","error",t,`Frontmatter ${P} is preserved but does not generate an endpoint in Velu. Wire the spec into navigation.openapi and review endpoint routes.`,d.position.start.line):["title","description","icon","sidebarTitle","mode","keywords","og:title","og:description","og:image"].includes(P)||n("frontmatter-review","warning",t,`Frontmatter ${P} is preserved; verify its behavior in Velu.`,d.position.start.line)}}catch(w){n("frontmatter-syntax","error",t,w.message,d.position.start.line)}if(["link","image","definition"].includes(d.type)&&d.url){let w=g(d.url);if(w!==d.url){let P=d.position.start.offset,V=e.slice(P,d.position.end.offset).lastIndexOf(d.url);V>=0&&m(P+V,P+V+d.url.length,w)}}if(!["mdxJsxFlowElement","mdxJsxTextElement"].includes(d.type)||!d.name)return;let h=d.name,S=d.position.start.line;if(s.has(h.split(".")[0]))return;y.add(h);let T=yt[h]?"Callout":["ParamField","ResponseField"].includes(h)?"Field":h==="Expandable"?"Accordion":h;if(T!==h&&s.has(T)){n("component-name-conflict","error",t,`Cannot convert <${h}> to <${T}> because that name is already locally defined. Rename the local binding before migration.`,S);return}let O=d.attributes.filter(w=>w.type==="mdxJsxAttribute"),x=(w,P)=>{let L=O.find(V=>V.name===w);L&&!O.some(V=>V.name===P)&&m(L.position.start.offset,L.position.start.offset+w.length,P)};if(h==="ParamField")for(let w of["body","query","path","header","cookie"])x(w,"name");if(h==="CardGroup"&&x("cols","limit"),h==="Accordion"&&x("default-open","defaultOpen"),h==="Expandable"&&(x("title","title"),O.some(w=>w.name==="title")||m(d.position.start.offset+1+h.length,d.position.start.offset+1+h.length,' title="Details"')),T!==h){let w=d.position.start.offset;m(w+1,w+1+h.length,T+(yt[h]?` type="${yt[h]}"`:""));let P=d.position.end.offset,L=new RegExp(`</${h}\\s*>$`).exec(e.slice(w,P));L&&m(P-L[0].length+2,P-L[0].length+2+h.length,T)}ho.has(h)?(u.add(h),n("component-adapter","warning",t,`<${h}> uses an editable React adapter. Review visual styling and optional props.`,S)):/^[A-Z]/.test(T)&&!yo.has(T)&&n("unsupported-component","error",t,`<${h}> needs a local component implementation or import.`,S);for(let w of O)if(["href","src"].includes(w.name)&&typeof w.value=="string"){let P=g(w.value);if(P!==w.value){let L=w.position.start.offset,K=e.slice(L,w.position.end.offset).indexOf(w.value);K>=0&&m(L+K,L+K+w.value.length,P)}}}),c.sort((d,h)=>h.start-d.start||h.end-d.end);let v=e;for(let d of c)v=v.slice(0,d.start)+d.value+v.slice(d.end);if(u.size){let d=q.posix.relative(q.posix.dirname(r.get(t)||t),he);v+=`
|
|
4
4
|
|
|
5
5
|
import { ${[...u].sort().join(", ")} } from ${JSON.stringify(d.startsWith(".")?d:"./"+d)};
|
|
6
|
-
`}try{await
|
|
6
|
+
`}try{await uo(v,{remarkPlugins:[pn,po,fn]})}catch(d){n("mdx-compile","error",t,d.reason||d.message,d.line)}return{text:v,adapters:[...u],components:[...y].sort(),assets:[...p]}}function gn(e,t,r){let n=[[/\b(?:window|globalThis)\s*(?:\?\.)?\s*\.?(?:mintlify|\[\s*['"]mintlify['"]\s*\])|mintlify:user/,"mintlify-browser-api","error","Mintlify browser APIs/events need a Velu implementation; script preserved without inventing an API mapping."],[/__NEXT_DATA__|next\/router|next\/navigation|routeChangeComplete|next-route-announcer/,"next-runtime","error","Script depends on Next.js internals; adapt it to Velu\u2019s React Router runtime."],[/DOMContentLoaded|\bwindow\.onload\b|addEventListener\(\s*['"]load['"]/,"script-lifecycle","warning","Script loads after hydration; use document.readyState or an immediate initializer when DOMContentLoaded/load has already fired."],[/\brequire\s*\(|\bmodule\.exports|\bprocess\.env|from\s*['"]node:/,"node-script","error","This .js file is auto-loaded in the browser but contains Node.js constructs. Move tooling outside the docs content root or use .cjs/.mjs."],[/(?:^|\n)\s*(?:import\s|export\s)/,"module-script","error","Auto-loaded JavaScript uses classic scripts. Bundle ES modules for the browser or move them to explicitly imported .jsx/.mjs modules."],[/document\.querySelector|document\.getElementById|MutationObserver/,"script-dom","warning","Verify DOM hooks and behavior after client-side navigation; scripts execute once per full page load."]];for(let[o,i,a,s]of n){let l=o.exec(e);l&&r(i,a,t,s,e.slice(0,l.index).split(`
|
|
7
7
|
`).length)}}function hn(e,t,r){let n=JSON.parse(e),o=!1,i=!1,a=[];for(let[s,l]of Object.entries(n.scripts||{})){if(typeof l!="string"||!/\b(?:mint|mintlify)\b/.test(l))continue;i=!0;let c=/^(?:(?:npx(?: --no-install)?|yarn|pnpm(?: exec)?|bunx)\s+)?(?:mint|mintlify)\s+(dev|validate|version|v|update)\s*$/.exec(l.trim());if(c){let u=`velu ${c[1]==="v"?"version":c[1]}`;n.scripts[s]=u,o=!0,a.push({name:s,action:"converted",from:l,to:u})}else a.push({name:s,action:"preserved",from:l}),r("npm-script","warning",`package.json:scripts.${s}`,"Mintlify command/flags or compound shell script has no verified equivalent. Original retained; update manually.")}for(let s of["dependencies","devDependencies","optionalDependencies"])Object.keys(n[s]||{}).some(l=>["mint","mintlify","@mintlify/cli"].includes(l))&&(i=!0);return i&&!n.dependencies?.["@veluai/velu"]&&!n.devDependencies?.["@veluai/velu"]&&(n.devDependencies={...n.devDependencies,"@veluai/velu":`^${t}`},o=!0),i&&r("package-install","warning","package.json","Run your package manager in the migrated directory to refresh its lockfile. Mintlify dependencies remain for scripts that still need them; remove them after review."),{text:o?JSON.stringify(n,null,2)+`
|
|
8
|
-
`:e,scripts:a}}function yn(e,t,r,n){let o;try{o=
|
|
8
|
+
`:e,scripts:a}}function yn(e,t,r,n){let o;try{o=mo(e,{sourceType:"unambiguous",plugins:["jsx",.../\.[cm]?tsx?$/.test(t)?["typescript"]:[]]})}catch(l){return n("module-syntax","error",t,l.message,l.loc?.line),e}let i=[],a=new Set,s=l=>{if(!l||typeof l!="object")return;let c=["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(l.type)?l.source:l.type==="CallExpression"&&(l.callee?.type==="Import"||l.callee?.name==="require")?l.arguments?.[0]:null;if(c?.type==="StringLiteral"&&!a.has(c.start)){a.add(c.start);let u=c.value;if(u.startsWith(".")||u.startsWith("/")){let p=q.posix.normalize(u.startsWith("/")?u.slice(1):q.posix.join(q.posix.dirname(t),u)),y=r.get(p);if(y){let m=q.posix.relative(q.posix.dirname(r.get(t)||t),y),g=m.startsWith(".")?m:"./"+m;u!==g&&i.push({start:c.start,end:c.end,value:JSON.stringify(g)})}else n("missing-import","error",t,`Local module import missing or ignored: ${u}`,c.loc?.start.line)}}for(let[u,p]of Object.entries(l))["loc","comments","tokens","extra"].includes(u)||(Array.isArray(p)?p.forEach(s):p&&typeof p=="object"&&s(p))};s(o.program);for(let l of i.sort((c,u)=>u.start-c.start))e=e.slice(0,l.start)+l.value+e.slice(l.end);return e}function vn(e,t,r,n){let o;try{o=go.parse(e,{from:t})}catch(s){return n("css-syntax","error",t,s.reason||s.message,s.line),e}let i=new Set,a;return o.walkRules(s=>{for(let l of s.selector.matchAll(/#(?:content|navbar|sidebar(?:-content)?|navigation-items|page-title|header|footer|table-of-contents)(?![\w-])/g))i.add(l[0]),a??=s.source?.start?.line}),i.size&&n("css-dom","warning",t,`Styles target renderer structure (${[...i].join(", ")}). Selectors are preserved, but matching elements and their nesting can differ in Velu; compare page headers, sidebars, API pages, and mobile layouts in the browser.`,a),o.walkDecls(s=>{s.value=s.value.replace(/url\(\s*(?:"([^"\\]*)"|'([^'\\]*)'|([^)'"\\\s]*))\s*\)/gi,(l,c,u,p)=>{let y=c??u??p;if(!y||/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i.test(y))return l;let m=/^([^?#]*)(.*)$/.exec(y),g=q.posix.normalize(q.posix.join(q.posix.dirname(t),m[1]));return r.has(g)?`url("${"/"+r.get(g).split("/").map(encodeURIComponent).join("/")+m[2]}")`:(n("css-missing-asset","error",t,`CSS asset missing or ignored: ${y}`,s.source?.start?.line),l)})}),o.walkAtRules("import",s=>n("css-import","warning",t,"Custom CSS files are included globally. Check @import for duplicate styles and loading order.",s.source?.start?.line)),o.toString()}var he,yt,ho,yo,vt,bn=_(()=>{We();Ge();he="snippets/velu-mintlify-compat.jsx",yt={Note:"note",Tip:"tip",Warning:"warning",Info:"info",Check:"check",Danger:"danger"},ho=new Set(["Tabs","Tab","Frame","Tooltip","Badge","Button","Panel"]),yo=new Set(te),vt=`import React from 'react';
|
|
9
9
|
export function Tabs({ children, defaultIndex = 0 }) {
|
|
10
10
|
const tabs = React.Children.toArray(children).filter(React.isValidElement);
|
|
11
11
|
const [active, setActive] = React.useState(defaultIndex);
|
|
@@ -30,27 +30,27 @@ export function Tooltip({children,tip}) { return <span title={typeof tip === 'st
|
|
|
30
30
|
export function Badge({children,color,className=''}) { return <span data-component="badge" className={className} style={{border:'1px solid currentColor',borderRadius:'1rem',padding:'.1rem .5rem',color}}>{children}</span>; }
|
|
31
31
|
export function Button({children,href,variant,size,icon,iconType,...props}) { return href ? <a href={href} {...props}>{children}</a> : <button type="button" {...props}>{children}</button>; }
|
|
32
32
|
export function Panel({children}) { return <aside data-component="panel">{children}</aside>; }
|
|
33
|
-
`});import yo from"github-slugger";import vo from"iso-639-1";function xo(e){let t=String(e).toLowerCase();return vo.getNativeName(t)||e}function He(e){return new yo().slug(String(e??""))}function xn(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function bt(e){let t=String(e).split("#")[0].split("?")[0];try{t=decodeURI(t)}catch{}return t.startsWith("/")||(t="/"+t),t.length>1&&(t=t.replace(/\/+$/,"")),t||"/"}function X(e){let t={kind:"root",children:ke(e??{})};return e?.preservePagePaths===!0&&(t.preservePagePaths=!0),Sn(t.children),t}function ke(e){let t=Array.isArray(e.anchors)?e.anchors.map(jo):[];if(Array.isArray(e.products))return[...t,...e.products.map(wo)];if(Array.isArray(e.versions))return[...t,...e.versions.map($o)];if(Array.isArray(e.languages))return[...t,...e.languages.map(So)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(ko)];let r=[...t];return Array.isArray(e.groups)&&r.push(...e.groups.map(wn)),Array.isArray(e.pages)&&r.push(...e.pages.map($n)),r}function wo(e){return{kind:"product",label:e.name??e.product,slug:He(e.product),icon:e.icon,color:e.color,default:!!e.default,children:ke(e)}}function $o(e){return{kind:"version",label:e.version,slug:He(e.version),default:!!e.default,children:ke(e)}}function So(e){let t=String(e.language);return{kind:"language",code:t,label:xo(t),slug:He(t),default:!!e.default,children:ke(e)}}function ko(e){return{kind:"tab",label:e.tab,slug:He(e.tab),icon:e.icon,href:e.href,children:ke(e)}}function jo(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function wn(e){let t=(e.pages??[]).map($n);return e.root&&t.unshift({kind:"page",pagePath:e.root}),{kind:"group",label:e.group,icon:e.icon,expanded:!!e.expanded,root:e.root,children:t}}function $n(e){if(typeof e=="string")return{kind:"page",pagePath:e};if(e&&e.apiPage)return{kind:"page",pagePath:e.apiPage,label:e.label,method:e.method,api:!0};if(e&&typeof e.page=="string"){let t={kind:"page",pagePath:e.page};return e.icon&&(t.icon=e.icon),(e.title||e.label)&&(t.label=e.title??e.label),t}return wn(e)}function Sn(e){for(let t of bo){let r=e.filter(n=>n.kind===t);r.length&&!r.some(n=>n.default)&&(r[0].default=!0)}for(let t of e)t.children&&Sn(t.children)}function ne(e){let t=[],r=(n,o,i)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Ao(n.pagePath,o),ctx:{...o},ancestors:i,node:n});return}let a=o;n.kind==="product"?a={...o,product:n.default?null:n.slug}:n.kind==="version"?a={...o,version:n.default?null:n.slug}:n.kind==="language"&&(a={...o,language:n.default?null:n.slug});let s=n.kind==="root"?i:[...i,n];for(let l of n.children??[])r(l,a,s)};return r(e,{product:null,version:null,language:null,...e.preservePagePaths?{preservePagePaths:!0}:{}},[]),t}function Ao(e,t){if(t.preservePagePaths)return xn(e);let r=[t.product,t.version,t.language].filter(Boolean),n=xn(e).split("/").filter(Boolean);return"/"+[...r,...n].join("/")}var bo,re=_(()=>{bo=["product","version","language"]});function Oo(e,t){let r=t.slice(2).split("/").filter(o=>o!=="").map(o=>decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~")),n=e;for(let o of r){if(n==null||typeof n!="object")return;n=n[o]}return n}function kn(e){let t=new Map;function r(n){if(n==null||typeof n!="object")return n;if(t.has(n))return t.get(n);if(typeof n.$ref=="string"){let i=n.$ref;if(!i.startsWith("#/"))throw new Error(`external $ref "${i}" is not supported in the instant preview \u2014 inline it or use a single-file spec`);let a=Oo(e,i);if(a===void 0)throw new Error(`$ref "${i}" does not resolve`);let s=r(a);return t.set(n,s),s}let o=Array.isArray(n)?[]:{};t.set(n,o);for(let[i,a]of Object.entries(n))o[i]=r(a);return o}return r(e)}var jn=_(()=>{});function ce(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,r)=>{let n=ce(r);return{...t,...n,properties:{...t.properties||{},...n.properties||{}},required:[...t.required||[],...n.required||[]]}},{...e,allOf:void 0}):Array.isArray(e.oneOf)&&e.oneOf.length?ce(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?ce(e.anyOf[0]):e}function je(e){let t=ce(e);if(!t||typeof t!="object")return"any";if(Array.isArray(t.enum)&&t.enum.length)return`enum<${typeof t.enum[0]}>`;if(t.type==="array")return`${je(t.items||{})}[]`;let r=t.type||(t.properties?"object":"any");return t.format?`${r}<${t.format}>`:r}function he(e,t=0){let r=ce(e);if(!r||typeof r!="object")return null;if(r.example!==void 0)return r.example;if(r.default!==void 0)return r.default;if(Array.isArray(r.enum)&&r.enum.length)return r.enum[0];if(t>=6)return r.type==="object"?{}:null;switch(r.type){case"object":{let n={};for(let[o,i]of Object.entries(r.properties||{}))n[o]=he(i,t+1);return n}case"array":return[he(r.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Eo(r)}}function Eo(e){switch(e.format){case"date-time":return"2024-01-01T00:00:00Z";case"date":return"2024-01-01";case"email":return"user@example.com";case"uuid":return"3fa85f64-5717-4562-b3fc-2c963f66afa6";case"uri":case"url":return"https://example.com";default:return"<string>"}}function xt(e){let t=ce(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:je(t),required:!1,description:t.description||""}]:[];let r=new Set(t.required||[]);return Object.entries(t.properties).map(([n,o])=>{let i=ce(o);return{name:n,type:je(i),required:r.has(n),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function Co(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:je(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:he(t),deprecated:e.deprecated||void 0}}function On(e){if(!e||typeof e!="object")return null;let t=Object.keys(e),r=t.find(n=>/json/i.test(n))||t[0];return r?{contentType:r,media:e[r]}:null}function Lo(e){if(!e)return null;let t=On(e.content);if(!t)return null;let r=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:xt(r),example:t.media.example??he(r)}}function Po(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,r])=>{let n=On(r?.content),o=n?.media?.schema||{};return{status:t,description:r?.description||"",contentType:n?.contentType||null,fields:n?xt(o):[],example:n?n.media.example??he(o):null}})}function _o(e,t){if(!Array.isArray(e)||!t)return[];let r=[],n=new Set;for(let o of e)for(let i of Object.keys(o||{})){let a=t[i];!a||n.has(i)||(n.add(i),r.push(Ro(i,a)))}return r.filter(Boolean)}function Ro(e,t){return t.type==="http"&&/bearer/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"Bearer authentication token."}:t.type==="http"&&/basic/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Basic",description:t.description||"Basic authentication credentials."}:t.type==="apiKey"?{name:t.name||e,in:t.in||"header",required:!0,type:"string",description:t.description||"API key."}:t.type==="oauth2"||t.type==="openIdConnect"?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"OAuth 2.0 access token."}:{name:e,in:"header",required:!0,type:"string",description:t.description||""}}function An(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Uo(e){let{method:t,path:r,op:n,sharedParams:o,servers:i,schemes:a}=e,s=[...o||[],...n.parameters||[]],l={path:[],query:[],header:[],cookie:[]};for(let u of s)u&&l[u.in]&&l[u.in].push(Co(u));let c=n.security??e.globalSecurity;return{id:n.operationId?An(n.operationId):`${t}-${An(r)}`,method:t.toUpperCase(),path:r,title:n.summary||n.operationId||`${t.toUpperCase()} ${r}`,description:n.description||n.summary||"",tags:Array.isArray(n.tags)&&n.tags.length?n.tags:["API"],deprecated:n.deprecated||!1,auth:_o(c,a),parameters:l,body:Lo(n.requestBody),responses:Po(n.responses),servers:(i||[]).map(u=>u.url).filter(Boolean)}}function Fo(e,t,r,n,o,i,a){let s={};e.openapi?s.openapi=e.openapi:e.swagger?s.swagger=e.swagger:s.openapi="3.0.0",s.info=e.info||{title:"API Reference",version:"1.0.0"};let l=(n.servers||i||[]).filter(Boolean);l.length&&(s.servers=l);let c={};Array.isArray(o)&&o.length&&(c.parameters=o),c[r]=n,s.paths={[t]:c};let u=n.security??e.security;if(a&&Array.isArray(u)&&u.length){let p={};for(let y of u)for(let m of Object.keys(y||{}))a[m]&&(p[m]=a[m]);Object.keys(p).length&&(e.swagger?s.securityDefinitions=p:s.components={securitySchemes:p})}return s}function Tn(e){let t=[],r=[],n=e.components?.securitySchemes||e.securityDefinitions||{},o=e.security||[],i=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]);for(let[a,s]of Object.entries(e.paths||{})){if(!s||typeof s!="object")continue;let l=s.parameters||[],c=s.servers||i;for(let u of To){let p=s[u];!p||typeof p!="object"||(t.push(Uo({method:u,path:a,op:p,sharedParams:l,servers:p.servers||c,globalSecurity:o,schemes:n})),r.push(Fo(e,a,u,p,l,p.servers||c,n)))}}return{operations:t,segments:r}}function Ae(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:r,segments:n}=Tn(e);return{title:e.info?.title||"API Reference",version:e.info?.version||"",servers:t.map(o=>o.url).filter(Boolean),operations:r,segments:n}}var To,Ke=_(()=>{To=["get","post","put","patch","delete","options","head","trace"]});function No(e,{server:t}={}){let n=`${(t||e.servers?.[0]||"").replace(/\/+$/,"")}${e.path}`,o={};for(let a of e.auth||[])a.in==="header"&&(o[a.name]=a.prefix?`${a.prefix} <token>`:"<token>");for(let a of e.parameters?.header||[])o[a.name]||(o[a.name]=String(a.example??`<${a.type}>`));let i=!!e.body;return i&&(o["Content-Type"]=e.body.contentType||"application/json"),{method:e.method,url:n,headers:o,body:i?e.body.example??{}:null}}function Io(e){let t=`curl --request ${e.method} \\
|
|
33
|
+
`});import vo from"github-slugger";import bo from"iso-639-1";function wo(e){let t=String(e).toLowerCase();return bo.getNativeName(t)||e}function He(e){return new vo().slug(String(e??""))}function xn(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function bt(e){let t=String(e).split("#")[0].split("?")[0];try{t=decodeURI(t)}catch{}return t.startsWith("/")||(t="/"+t),t.length>1&&(t=t.replace(/\/+$/,"")),t||"/"}function Y(e){let t={kind:"root",children:je(e??{})};return e?.preservePagePaths===!0&&(t.preservePagePaths=!0),Sn(t.children),t}function je(e){let t=Array.isArray(e.anchors)?e.anchors.map(Ao):[];if(Array.isArray(e.products))return[...t,...e.products.map($o)];if(Array.isArray(e.versions))return[...t,...e.versions.map(So)];if(Array.isArray(e.languages))return[...t,...e.languages.map(ko)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(jo)];let r=[...t];return Array.isArray(e.groups)&&r.push(...e.groups.map(wn)),Array.isArray(e.pages)&&r.push(...e.pages.map($n)),r}function $o(e){return{kind:"product",label:e.name??e.product,slug:He(e.product),icon:e.icon,color:e.color,default:!!e.default,children:je(e)}}function So(e){return{kind:"version",label:e.version,slug:He(e.version),default:!!e.default,children:je(e)}}function ko(e){let t=String(e.language);return{kind:"language",code:t,label:wo(t),slug:He(t),default:!!e.default,children:je(e)}}function jo(e){return{kind:"tab",label:e.tab,slug:He(e.tab),icon:e.icon,href:e.href,children:je(e)}}function Ao(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function wn(e){let t=(e.pages??[]).map($n);return e.root&&t.unshift({kind:"page",pagePath:e.root}),{kind:"group",label:e.group,icon:e.icon,expanded:!!e.expanded,root:e.root,children:t}}function $n(e){if(typeof e=="string")return{kind:"page",pagePath:e};if(e&&e.apiPage)return{kind:"page",pagePath:e.apiPage,label:e.label,method:e.method,api:!0};if(e&&typeof e.page=="string"){let t={kind:"page",pagePath:e.page};return e.icon&&(t.icon=e.icon),(e.title||e.label)&&(t.label=e.title??e.label),t}return wn(e)}function Sn(e){for(let t of xo){let r=e.filter(n=>n.kind===t);r.length&&!r.some(n=>n.default)&&(r[0].default=!0)}for(let t of e)t.children&&Sn(t.children)}function ne(e){let t=[],r=(n,o,i)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Oo(n.pagePath,o),ctx:{...o},ancestors:i,node:n});return}let a=o;n.kind==="product"?a={...o,product:n.default?null:n.slug}:n.kind==="version"?a={...o,version:n.default?null:n.slug}:n.kind==="language"&&(a={...o,language:n.default?null:n.slug});let s=n.kind==="root"?i:[...i,n];for(let l of n.children??[])r(l,a,s)};return r(e,{product:null,version:null,language:null,...e.preservePagePaths?{preservePagePaths:!0}:{}},[]),t}function Oo(e,t){if(t.preservePagePaths)return xn(e);let r=[t.product,t.version,t.language].filter(Boolean),n=xn(e).split("/").filter(Boolean);return"/"+[...r,...n].join("/")}var xo,re=_(()=>{xo=["product","version","language"]});function To(e,t){let r=t.slice(2).split("/").filter(o=>o!=="").map(o=>decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~")),n=e;for(let o of r){if(n==null||typeof n!="object")return;n=n[o]}return n}function kn(e){let t=new Map;function r(n){if(n==null||typeof n!="object")return n;if(t.has(n))return t.get(n);if(typeof n.$ref=="string"){let i=n.$ref;if(!i.startsWith("#/"))throw new Error(`external $ref "${i}" is not supported in the instant preview \u2014 inline it or use a single-file spec`);let a=To(e,i);if(a===void 0)throw new Error(`$ref "${i}" does not resolve`);let s=r(a);return t.set(n,s),s}let o=Array.isArray(n)?[]:{};t.set(n,o);for(let[i,a]of Object.entries(n))o[i]=r(a);return o}return r(e)}var jn=_(()=>{});function ce(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,r)=>{let n=ce(r);return{...t,...n,properties:{...t.properties||{},...n.properties||{}},required:[...t.required||[],...n.required||[]]}},{...e,allOf:void 0}):Array.isArray(e.oneOf)&&e.oneOf.length?ce(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?ce(e.anyOf[0]):e}function Ae(e){let t=ce(e);if(!t||typeof t!="object")return"any";if(Array.isArray(t.enum)&&t.enum.length)return`enum<${typeof t.enum[0]}>`;if(t.type==="array")return`${Ae(t.items||{})}[]`;let r=t.type||(t.properties?"object":"any");return t.format?`${r}<${t.format}>`:r}function ye(e,t=0){let r=ce(e);if(!r||typeof r!="object")return null;if(r.example!==void 0)return r.example;if(r.default!==void 0)return r.default;if(Array.isArray(r.enum)&&r.enum.length)return r.enum[0];if(t>=6)return r.type==="object"?{}:null;switch(r.type){case"object":{let n={};for(let[o,i]of Object.entries(r.properties||{}))n[o]=ye(i,t+1);return n}case"array":return[ye(r.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Co(r)}}function Co(e){switch(e.format){case"date-time":return"2024-01-01T00:00:00Z";case"date":return"2024-01-01";case"email":return"user@example.com";case"uuid":return"3fa85f64-5717-4562-b3fc-2c963f66afa6";case"uri":case"url":return"https://example.com";default:return"<string>"}}function xt(e){let t=ce(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:Ae(t),required:!1,description:t.description||""}]:[];let r=new Set(t.required||[]);return Object.entries(t.properties).map(([n,o])=>{let i=ce(o);return{name:n,type:Ae(i),required:r.has(n),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function Po(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:Ae(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:ye(t),deprecated:e.deprecated||void 0}}function On(e){if(!e||typeof e!="object")return null;let t=Object.keys(e),r=t.find(n=>/json/i.test(n))||t[0];return r?{contentType:r,media:e[r]}:null}function Lo(e){if(!e)return null;let t=On(e.content);if(!t)return null;let r=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:xt(r),example:t.media.example??ye(r)}}function _o(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,r])=>{let n=On(r?.content),o=n?.media?.schema||{};return{status:t,description:r?.description||"",contentType:n?.contentType||null,fields:n?xt(o):[],example:n?n.media.example??ye(o):null}})}function Ro(e,t){if(!Array.isArray(e)||!t)return[];let r=[],n=new Set;for(let o of e)for(let i of Object.keys(o||{})){let a=t[i];!a||n.has(i)||(n.add(i),r.push(Uo(i,a)))}return r.filter(Boolean)}function Uo(e,t){return t.type==="http"&&/bearer/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"Bearer authentication token."}:t.type==="http"&&/basic/i.test(t.scheme||"")?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Basic",description:t.description||"Basic authentication credentials."}:t.type==="apiKey"?{name:t.name||e,in:t.in||"header",required:!0,type:"string",description:t.description||"API key."}:t.type==="oauth2"||t.type==="openIdConnect"?{name:"Authorization",in:"header",required:!0,type:"string",prefix:"Bearer",description:t.description||"OAuth 2.0 access token."}:{name:e,in:"header",required:!0,type:"string",description:t.description||""}}function An(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function No(e){let{method:t,path:r,op:n,sharedParams:o,servers:i,schemes:a}=e,s=[...o||[],...n.parameters||[]],l={path:[],query:[],header:[],cookie:[]};for(let u of s)u&&l[u.in]&&l[u.in].push(Po(u));let c=n.security??e.globalSecurity;return{id:n.operationId?An(n.operationId):`${t}-${An(r)}`,method:t.toUpperCase(),path:r,title:n.summary||n.operationId||`${t.toUpperCase()} ${r}`,description:n.description||n.summary||"",tags:Array.isArray(n.tags)&&n.tags.length?n.tags:["API"],deprecated:n.deprecated||!1,auth:Ro(c,a),parameters:l,body:Lo(n.requestBody),responses:_o(n.responses),servers:(i||[]).map(u=>u.url).filter(Boolean)}}function Fo(e,t,r,n,o,i,a){let s={};e.openapi?s.openapi=e.openapi:e.swagger?s.swagger=e.swagger:s.openapi="3.0.0",s.info=e.info||{title:"API Reference",version:"1.0.0"};let l=(n.servers||i||[]).filter(Boolean);l.length&&(s.servers=l);let c={};Array.isArray(o)&&o.length&&(c.parameters=o),c[r]=n,s.paths={[t]:c};let u=n.security??e.security;if(a&&Array.isArray(u)&&u.length){let p={};for(let y of u)for(let m of Object.keys(y||{}))a[m]&&(p[m]=a[m]);Object.keys(p).length&&(e.swagger?s.securityDefinitions=p:s.components={securitySchemes:p})}return s}function Tn(e){let t=[],r=[],n=e.components?.securitySchemes||e.securityDefinitions||{},o=e.security||[],i=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]);for(let[a,s]of Object.entries(e.paths||{})){if(!s||typeof s!="object")continue;let l=s.parameters||[],c=s.servers||i;for(let u of Eo){let p=s[u];!p||typeof p!="object"||(t.push(No({method:u,path:a,op:p,sharedParams:l,servers:p.servers||c,globalSecurity:o,schemes:n})),r.push(Fo(e,a,u,p,l,p.servers||c,n)))}}return{operations:t,segments:r}}function Oe(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:r,segments:n}=Tn(e);return{title:e.info?.title||"API Reference",version:e.info?.version||"",servers:t.map(o=>o.url).filter(Boolean),operations:r,segments:n}}var Eo,Ke=_(()=>{Eo=["get","post","put","patch","delete","options","head","trace"]});function Io(e,{server:t}={}){let n=`${(t||e.servers?.[0]||"").replace(/\/+$/,"")}${e.path}`,o={};for(let a of e.auth||[])a.in==="header"&&(o[a.name]=a.prefix?`${a.prefix} <token>`:"<token>");for(let a of e.parameters?.header||[])o[a.name]||(o[a.name]=String(a.example??`<${a.type}>`));let i=!!e.body;return i&&(o["Content-Type"]=e.body.contentType||"application/json"),{method:e.method,url:n,headers:o,body:i?e.body.example??{}:null}}function Mo(e){let t=`curl --request ${e.method} \\
|
|
34
34
|
--url ${e.url}`;for(let[r,n]of Object.entries(e.headers))t+=` \\
|
|
35
35
|
--header '${r}: ${n}'`;return e.body!=null&&(t+=` \\
|
|
36
|
-
--data '${JSON.stringify(e.body)}'`),t}function
|
|
36
|
+
--data '${JSON.stringify(e.body)}'`),t}function zo(e){let t=[` method: '${e.method}'`];if(Object.keys(e.headers).length){let r=Object.entries(e.headers).map(([n,o])=>` '${n}': '${o}'`).join(`,
|
|
37
37
|
`);t.push(` headers: {
|
|
38
38
|
${r}
|
|
39
39
|
}`)}return e.body!=null&&t.push(` body: JSON.stringify(${wt(e.body," ")})`),[`const res = await fetch('${e.url}', {`,t.join(`,
|
|
40
40
|
`),"});","const data = await res.json();"].join(`
|
|
41
|
-
`)}function
|
|
41
|
+
`)}function Vo(e){let t=["import requests","",`url = "${e.url}"`];if(Object.keys(e.headers).length){let n=Object.entries(e.headers).map(([o,i])=>` "${o}": "${i}"`).join(`,
|
|
42
42
|
`);t.push(`headers = {
|
|
43
43
|
${n}
|
|
44
44
|
}`)}let r=["url"];return e.body!=null&&(t.push(`payload = ${wt(e.body,"")}`),r.push("json=payload")),Object.keys(e.headers).length&&r.push("headers=headers"),t.push("",`response = requests.${e.method.toLowerCase()}(${r.join(", ")})`,"print(response.json())"),t.join(`
|
|
45
|
-
`)}function
|
|
46
|
-
`)}function Xe(e,{server:t,languages:r=$t}={}){let n=
|
|
45
|
+
`)}function Bo(e){let t=e.method.charAt(0)+e.method.slice(1).toLowerCase(),r=["require 'net/http'","require 'json'","",`uri = URI("${e.url}")`,"http = Net::HTTP.new(uri.host, uri.port)","http.use_ssl = true",`request = Net::HTTP::${t}.new(uri)`];for(let[n,o]of Object.entries(e.headers))r.push(`request['${n}'] = '${o}'`);return e.body!=null&&r.push(`request.body = ${wt(e.body,"")}.to_json`),r.push("","response = http.request(request)","puts response.body"),r.join(`
|
|
46
|
+
`)}function Xe(e,{server:t,languages:r=$t}={}){let n=Io(e,{server:t});return r.filter(o=>En[o]).map(o=>({key:o,label:Do[o],language:Jo[o],code:En[o](n)}))}var wt,En,Do,Jo,$t,St=_(()=>{wt=(e,t)=>JSON.stringify(e,null,2).split(`
|
|
47
47
|
`).map((r,n)=>n===0?r:t+r).join(`
|
|
48
|
-
`);En={curl:
|
|
49
|
-
`)}function
|
|
50
|
-
`)}function
|
|
48
|
+
`);En={curl:Mo,javascript:zo,python:Vo,ruby:Bo},Do={curl:"cURL",javascript:"JavaScript",python:"Python",ruby:"Ruby"},Jo={curl:"bash",javascript:"javascript",python:"python",ruby:"ruby"},$t=["curl","javascript","python","ruby"]});function Pn(e){let t=e?.font?.family;return typeof t=="string"&&t.trim()?t.trim():e?.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e?.theme)?"Inter":Go}function Te(e){return e==="vepa"||["thulir","aalam","nila","kadhir"].includes(e)?e:"velu"}function jt({light:e,dark:t,family:r,theme:n,primary:o=e,cta:i=o}){let a=n==="vepa"||["thulir","aalam","nila","kadhir"].includes(n)?Wo(o,t):"";return[":root:root {",` --accent-color: ${e};`,...["thulir","aalam","nila","kadhir"].includes(n)?[` --thulir-cta-color: ${i};`]:[],` --font-sans: "${r}", sans-serif;`,a,"}",':root:root[data-theme="dark"] {',` --accent-color: ${t};`,"}"].join(`
|
|
49
|
+
`)}function Wo(e,t){let r=(s,l)=>{let c=/^#([\da-f]{3}|[\da-f]{6})$/i.exec(s||"")?.[1];return c||(c=l),c.length===3&&(c=[...c].map(u=>u+u).join("")),[0,2,4].map(u=>parseInt(c.slice(u,u+2),16))},n=r(e,"16a34a"),o=r(t,"4ade80"),i={50:250,100:245,200:229,300:212,400:163,500:115,600:82,700:64,800:38,900:23,950:10},a=.95/(.95+.6-.95*.6);return[...Object.entries(i).map(([s,l])=>` --vepa-gray-${s}: rgb(${n.map(c=>Math.round(c*(1-a)+l*a)).join(" ")});`),` --vepa-background-dark: rgb(${o.map((s,l)=>Math.round([9,9,11][l]*.98+s*.02)).join(" ")});`].join(`
|
|
50
|
+
`)}function Ee(e){if(!e||typeof e!="object")return null;let t=[];if(e.socials&&typeof e.socials=="object")for(let[n,o]of Object.entries(e.socials))typeof o!="string"||!o.trim()||t.push({kind:qo[n]??n,href:o.trim()});let r=Array.isArray(e.links)?e.links.filter(n=>n&&typeof n=="object").map(n=>({title:(n.header??n.title??"").trim(),items:(Array.isArray(n.items)?n.items:[]).filter(o=>o&&o.label).map(o=>({label:o.label,href:o.href??"#"}))})).filter(n=>n.title||n.items.length):[];return!t.length&&!r.length?null:{socials:t,links:r}}function kt(e){return/^(https?:)?\/\//.test(e)||/^(mailto|tel):/.test(e)}function Ce(e){if(!e||typeof e!="object")return null;let t=(Array.isArray(e.links)?e.links:[]).filter(o=>o&&typeof o.href=="string"&&o.href.trim()).map(o=>({label:o.label??"",href:o.href.trim(),icon:o.icon??null,external:kt(o.href.trim())})),r=null,n=e.primary;if(n&&typeof n=="object"&&typeof n.href=="string"&&n.href.trim()){let o=n.href.trim();r=n.type==="github"?{kind:"github",label:n.label??"GitHub",href:o,external:kt(o)}:{kind:"button",label:n.label??"",href:o,external:kt(o)}}return!t.length&&!r?null:{links:t,primary:r}}function At(e){if(e==null)return{options:[...Cn],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",r=Array.isArray(e.options)?e.options:Cn,n=[];for(let o of r)typeof o=="string"?Ho.has(o)&&n.push(o):o&&typeof o=="object"&&o.title&&o.href&&n.push({title:String(o.title),description:o.description?String(o.description):"",href:String(o.href),icon:typeof o.icon=="string"?o.icon:void 0});return{options:n,display:t}}function Z(e){if(!e||typeof e!="object")return{server:null,proxy:!0,languages:void 0};let t=e.playground||{};return{server:typeof e.server=="string"?e.server.trim():null,proxy:t.proxy!==!1&&t.display!=="none",languages:Array.isArray(e.examples?.languages)?e.examples.languages:void 0}}function Pe(e){if(!e||typeof e!="object")return null;let t=typeof e.apiBase=="string"&&e.apiBase.trim()?e.apiBase.trim().replace(/\/+$/,""):null,r=typeof e.host=="string"&&e.host.trim()?e.host.trim():null,n=Array.isArray(e.suggestions)?e.suggestions.filter(o=>typeof o=="string"&&o.trim()).map(o=>o.trim()).slice(0,6):[];return!t&&!n.length?null:{apiBase:t,host:r,suggestions:n}}var qo,Go,Ho,Cn,Le=_(()=>{qo={twitter:"x","x-twitter":"x"},Go="Google Sans Flex";Ho=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),Cn=["copy","view","chatgpt","claude"]});import Ko from"node:path";import Ln from"js-yaml";function _n(e,t,r,n,o){let i=/^(?:\uFEFF)?---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(e);if(!i)return{text:e,converted:!1};let a;try{a=Ln.load(i[1])}catch{return{text:e,converted:!1}}if(typeof a?.openapi!="string")return{text:e,converted:!1};let s=/^(?:(.+?)\s+)?(GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|TRACE)\s+(\/\S+)$/i.exec(a.openapi.trim());if(!s)return{text:e,converted:!1};let l=s[1]?[s[1]]:[].concat(n.openapi||n.api?.openapi||[]);if(l=l.map(u=>typeof u=="string"?u:u?.source).filter(Boolean),!l.length)return{text:e,converted:!1};let c=[];try{for(let d of l){if(/^[a-z][a-z0-9+.-]*:/i.test(d))throw new Error("Remote specs must be downloaded locally first.");let h=Ko.posix.normalize(d.replace(/^\//,"")),S=r.get(h);if(!S)throw new Error(`Spec is missing or ignored: ${h}`);let T=/\.ya?ml$/i.test(h)?Ln.load(S.toString("utf8")):ht(S.toString("utf8"),h),O=Oe(kn(T));for(let x of O.operations)x.method===s[2].toUpperCase()&&x.path===s[3]&&c.push({operation:x,rel:h})}if(c.length!==1)throw new Error(`Expected exactly one matching operation; found ${c.length}.`);let{operation:u,rel:p}=c[0],y=Z(n.api),m=Xe(u,{server:y.server||u.servers?.[0],...y.languages?{languages:y.languages}:{}});if(/\bveluApi\b/.test(e))throw new Error("Reserved generated export name already used: veluApi");let v=`
|
|
51
51
|
export const veluApi = ${JSON.stringify({operation:u,samples:m,api:{proxy:y.proxy,server:y.server}})};
|
|
52
52
|
|
|
53
|
-
${e.slice(i[0].length)}`;return o("endpoint-snapshot","warning",t,`Generated the ${s[2].toUpperCase()} ${s[3]} playground from ${p}, preserving the page URL and body. This is an editable snapshot: regenerate after spec changes; review x-mint extensions and page-specific overrides.`),{text:e.slice(0,i[0].length)+v,converted:!0}}catch(u){return o("endpoint-conversion","error",t,`Could not migrate OpenAPI endpoint: ${u.message}`),{text:e,converted:!1}}}var Rn=_(()=>{jn();Ke();St();Le();Ge()});var zn={}
|
|
53
|
+
${e.slice(i[0].length)}`;return o("endpoint-snapshot","warning",t,`Generated the ${s[2].toUpperCase()} ${s[3]} playground from ${p}, preserving the page URL and body. This is an editable snapshot: regenerate after spec changes; review x-mint extensions and page-specific overrides.`),{text:e.slice(0,i[0].length)+v,converted:!0}}catch(u){return o("endpoint-conversion","error",t,`Could not migrate OpenAPI endpoint: ${u.message}`),{text:e,converted:!1}}}var Rn=_(()=>{jn();Ke();St();Le();Ge()});var zn={};Se(zn,{MIGRATE_HELP:()=>Nn,migrateMintlify:()=>Mn,parseMigrateArgs:()=>Fn,planMigration:()=>In,runMigrate:()=>ri});import F from"node:fs";import z from"node:path";import{randomUUID as Xo,createHash as Yo}from"node:crypto";import Zo from"ignore";function Fn(e){if(e.includes("--help")||e.includes("-h"))return{help:!0};if(e.shift()!=="mintlify")throw new Error("Specify the source platform: velu migrate mintlify [source]");let t={},r=!1;for(let n=0;n<e.length;n++){let o=e[n];if(["--dry-run","--json","--strict"].includes(o))t[{"--dry-run":"dryRun","--json":"json","--strict":"strict"}[o]]=!0;else if(["--out","--config"].includes(o)){if(!e[n+1]||e[n+1].startsWith("--"))throw new Error(`${o} requires a value.`);if(t[o.slice(2)]!==void 0)throw new Error(`${o} was specified twice.`);t[o.slice(2)]=e[++n]}else{if(o.startsWith("-"))throw new Error(`Unknown migration option: ${o}`);if(r)throw new Error("Only one source directory may be specified. Use --out for the destination.");t.source=o,r=!0}}if(t.config&&!["docs.json","mint.json"].includes(t.config))throw new Error("--config must be docs.json or mint.json.");return t}function ti(e,t){let r=z.resolve(t||`${e}-velu`),n=r,o=[];for(;!F.existsSync(n);){o.unshift(z.basename(n));let a=z.dirname(n);if(a===n)throw new Error("Cannot resolve destination parent.");n=a}let i=z.join(F.realpathSync(n),...o);if(le(e,i)||le(i,e))throw new Error("Destination must be outside the source directory and cannot be its ancestor.");if(F.existsSync(r))throw new Error("Destination already exists. Choose a new directory; migration never overwrites existing files.");return i}function ni(e){let t=r=>String(r).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ");return`# Mintlify \u2192 Velu migration
|
|
54
54
|
|
|
55
55
|
Status: **${e.status}**. ${e.summary.files} files; ${e.summary.pages} pages/snippets; ${e.summary.scripts} browser scripts; ${e.summary.styles} stylesheets.
|
|
56
56
|
|
|
@@ -69,8 +69,8 @@ The original Mintlify configuration is preserved. Unsupported settings have not
|
|
|
69
69
|
| --- | --- | --- | --- |
|
|
70
70
|
`+e.issues.map(r=>`| ${r.severity} | ${t(r.code)} | ${t(r.file)}${r.line?":"+r.line:""} | ${t(r.message)} |`).join(`
|
|
71
71
|
`)+`
|
|
72
|
-
`}async function In({source:e=".",out:t,config:r,version:n="0.2.40"}={}){let o=N.realpathSync(z.resolve(e));if(!N.statSync(o).isDirectory())throw new Error("Source must be a directory.");let i=ei(o,t);if(r&&!["docs.json","mint.json"].includes(r))throw new Error("Config must be docs.json or mint.json.");let a=r||["docs.json","mint.json"].find(f=>N.existsSync(z.join(o,f)));if(!a)throw new Error("No docs.json or mint.json found in the source directory.");let s=[],l=new Set,c=(f,b,j,C,M)=>{let ie=JSON.stringify([f,b,j,C,M]);l.has(ie)||(s.push({code:f,severity:b,file:j,message:C,...M?{line:M}:{}}),l.add(ie))},u=cn(o,a),p=un(u,a,c);!r&&N.existsSync(z.join(o,"docs.json"))&&N.existsSync(z.join(o,"mint.json"))&&c("multiple-configs","warning",a,"Both config files exist; docs.json selected. Use --config mint.json to select the legacy config.");let y=Yo(),m=z.join(o,".mintignore");if(N.existsSync(m)){if(!le(o,N.realpathSync(m)))throw new Error(".mintignore resolves outside the source.");y.add(N.readFileSync(m,"utf8"))}let g=new Map,v=[];function d(f){for(let b of N.readdirSync(f,{withFileTypes:!0}).sort((j,C)=>j.name<C.name?-1:j.name>C.name?1:0)){let j=z.join(f,b.name),C=gt(z.relative(o,j));b.isSymbolicLink()?(v.push({path:C,reason:"symbolic-link"}),c("symlink","warning",C,"Symbolic link/junction skipped. Copy its required content into the source explicitly.")):b.isDirectory()&&Zo.has(b.name)||/^\.env(?:\.|$)/i.test(b.name)||[".npmrc",".yarnrc.yml",".pnp.cjs",".pnp.loader.mjs"].includes(b.name)?v.push({path:C,reason:"dependency-cache-tooling-or-environment"}):y.ignores(C+(b.isDirectory()?"/":""))&&C!==a&&C!==".mintignore"?v.push({path:C,reason:"mintignore"}):b.isFile()&&C.startsWith(".mintlify/")&&!/\.(json|ya?ml)$/i.test(C)&&!C.startsWith(".mintlify/skills/")?v.push({path:C,reason:"mintlify-runtime-file"}):b.isDirectory()?d(j):b.isFile()?g.set(C,N.readFileSync(j)):v.push({path:C,reason:"not-regular-file"})}}if(d(o),!g.has(a))throw new Error("Source config must be a regular file, not a symbolic link.");if(g.has("velu.json"))throw new Error("Source already contains velu.json. Use the original Mintlify project to avoid replacing an existing Velu config.");let h=new Map,S=new Set,O=new Set;try{for(let f of ne(X(p.navigation)))O.add(f.pagePath.replace(/^\//,""))}catch{}for(let f of g.keys()){let b=f;/\.md$/i.test(f)&&(O.has(f.slice(0,-3))||!/^(readme|license|changelog|contributing|contribute|skill|agents|claude)\.md$/i.test(z.posix.basename(f)))&&(b=f.replace(/\.md$/i,".mdx")),/\.mdx$/i.test(f)&&(b=f.replace(/\.mdx$/i,".mdx")),/^(?:_snippets|snippets)\/.*\.js$/i.test(f)&&(b=f.replace(/\.js$/i,".jsx"));let j=b.toLowerCase();if(S.has(j)||[Ot.toLowerCase(),Tt.toLowerCase()].includes(j))throw new Error(`Migration output collision: ${b}`);S.add(j),h.set(f,b)}let A=new Map(h);for(let[f,b]of h)if(/\.(mdx?|jsx?|tsx?)$/.test(f)){let j=f.replace(/\.[^.]+$/,"");A.has(j)||A.set(j,b),/\/index$/.test(j)&&!A.has(j.slice(0,-6))&&A.set(j.slice(0,-6),b)}let x=new Map,w=[],L=new Set,P=!1,B=[];for(let[f,b]of g){let j=h.get(f),C=b,M="asset",ie;if(/\.mdx$/i.test(j)){M="content";let J=_n(b.toString("utf8"),f,g,u,c),se=await dn(J.text,f,A,c,{endpointConverted:J.converted});C=Buffer.from(se.text),ie=se.components,P||=se.adapters.length>0;for(let dt of se.assets||[])L.add(dt)}else if(f==="package.json"){M="package";let J=hn(b.toString("utf8"),n,c);C=Buffer.from(J.text),B=J.scripts}else if(/\.js$/i.test(j))M="script",gn(b.toString("utf8"),f,c),(f.startsWith("public/")||f.split("/").some(J=>J.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load JavaScript from public or dot directories; explicitly load it from a custom script if required.");else if(/\.css$/i.test(j)){M="style";let J=b.toString("utf8");f.startsWith("public/")||(C=Buffer.from(vn(J,f,h,c))),/@import|data-component-(?:name|part)|\.dark\b|__next|#banner|#header\b/.test(J)&&c("css-hooks","warning",f,"Review CSS imports, theme classes, and Mintlify-specific selectors against Velu\u2019s DOM hooks."),(f.startsWith("public/")||f.split("/").some(se=>se.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load CSS from public or dot directories.")}else/\.[cm]?[jt]sx?$/.test(j)&&(M="module",C=Buffer.from(yn(b.toString("utf8"),f,A,c)),/(?:@mintlify\/|next\/|window\.mintlify)/.test(b.toString("utf8"))&&c("module-runtime","error",f,"Custom module depends on a Mintlify/Next.js runtime. Adapt its imports and APIs."));f.startsWith(".github/workflows/")&&/mintlify|\bmint\s/.test(b.toString("utf8"))&&c("ci-workflow","warning",f,"Workflow preserved. Replace Mintlify install/validation/deployment commands manually."),x.set(j,C),w.push({source:f,destination:j,kind:M,action:f!==j?"renamed":C.equals(b)?"copied":"transformed",sha256:Pe(C),...ie?{components:ie}:{}})}for(let[f,b]of[...x]){if(!Qo.test(f)&&!L.has(f)&&!/\.(css|js)$/i.test(f)||f.startsWith("public/")||f.split("/").some(M=>M.startsWith("."))||["docs.json","mint.json","package.json","velu.json",...Un].includes(f))continue;let j=`public/${f}`,C=[...x.keys()].find(M=>M.toLowerCase()===j.toLowerCase());if(C){x.get(C).equals(b)||c("public-asset-conflict","error",f,`Different asset already exists at ${C}; public file retained. Review which URL should be served.`);continue}x.set(j,b),w.push({source:f,destination:j,kind:"public-asset",action:"mirrored",sha256:Pe(b)})}if(P){if(S.has(ge.toLowerCase()))throw new Error(`Generated adapter conflicts with source file: ${ge}`);x.set(ge,Buffer.from(vt)),w.push({destination:ge,kind:"module",action:"generated",sha256:Pe(vt)})}let ee=Buffer.from(Ye(p));x.set("velu.json",ee),w.push({destination:"velu.json",kind:"config",action:"generated",sha256:Pe(ee)});let T=Buffer.from(Ye(u));x.set(".velu-migration/source-config.json",T),w.push({destination:".velu-migration/source-config.json",kind:"config",action:"archived",sha256:Pe(T)});let $=new Set,E=new Set;try{for(let f of ne(X(p.navigation))){E.has(f.url)&&c("duplicate-route","error","velu.json",`Duplicate route: ${f.url}`),E.add(f.url);let b=f.pagePath.replace(/^\/+|\/+$/g,"")+".mdx";/\.\.(?:\/|$)|\\/.test(b)&&c("unsafe-page-path","error","velu.json",`Page path is outside the supported project-relative format: ${f.pagePath}`),$.add(b),x.has(b)||c("missing-page","error","velu.json",`Navigation page is missing or ignored: ${b}`)}}catch(f){c("navigation-invalid","error","velu.json",f.message)}for(let f of w.filter(b=>b.kind==="content"))!$.has(f.destination)&&!/^(?:_snippets|snippets)\//.test(f.destination)&&c("unlisted-page","warning",f.destination,"Page preserved but absent from navigation. Velu\u2019s current preview only renders navigation pages; add it to navigation if it must be accessible.");let k=(f,b)=>{if(typeof f!="string")return;if(/^https?:\/\//.test(f)){c("remote-asset","error",b,"Download this branding asset into the project and use a local path; migration does not fetch external assets.");return}let j=f.replace(/^\//,"").split(/[?#]/)[0];x.has(j)||c("missing-asset","error",b,`Asset is missing or ignored: ${j}`)};if(k(p.favicon,"favicon"),typeof p.logo=="string")k(p.logo,"logo");else for(let f of["light","dark"])k(p.logo?.[f],`logo.${f}`);function F(f){if(!(!f||typeof f!="object")){if(f.openapi)for(let b of[].concat(f.openapi))/^https?:\/\//.test(b)?c("remote-openapi","warning","velu.json","Remote OpenAPI URL preserved; availability and generation need validation with network access."):x.has(b.replace(/^\//,""))?c("openapi-routes","warning","velu.json",`OpenAPI source ${b} preserved; compare generated endpoint URLs and x-mint extensions in preview.`):c("missing-openapi","error","velu.json",`OpenAPI source missing or ignored: ${b}`);for(let b of Object.values(f))typeof b=="object"&&F(b)}}F(p.navigation),B.some(f=>f.action==="converted")&&[...Un].some(f=>x.has(f))&&c("lockfile-stale","warning","package.json","Lockfiles are preserved and require regeneration after the dependency changes."),s.sort((f,b)=>f.file.localeCompare(b.file)||(f.line||0)-(b.line||0)||f.code.localeCompare(b.code));let R=s.filter(f=>f.severity==="error").length,U=s.filter(f=>f.severity==="warning").length,V={reportVersion:1,source:o,destination:i,sourceConfig:a,status:R||U?"needs-review":"ready",parityReference:{cli:"@mintlify/cli@4.0.1479",common:"@mintlify/common@1.0.1132",prebuild:"@mintlify/prebuild@1.0.1286",inspected:"2026-09-08"},summary:{files:w.length,pages:w.filter(f=>f.kind==="content").length,scripts:w.filter(f=>f.kind==="script").length,styles:w.filter(f=>f.kind==="style").length,errors:R,warnings:U,skipped:v.length},issues:s,files:w,skipped:v,npmScripts:B};return x.set(Ot,Buffer.from(Ye(V))),x.set(Tt,Buffer.from(ti(V))),{report:V,files:x}}async function Mn(e={}){let t=await In(e),r=e.strict&&(t.report.summary.errors||t.report.summary.warnings),n=!1;if(!e.dryRun&&!r){let o=t.report.destination,i=z.dirname(o);N.mkdirSync(i,{recursive:!0});let a=z.join(i,`.velu-migration-${Ko()}`);N.mkdirSync(a);try{for(let[s,l]of t.files){let c=z.resolve(a,s);if(!le(a,c))throw new Error("Output path escapes the staging directory.");N.mkdirSync(z.dirname(c),{recursive:!0}),N.writeFileSync(c,l,{flag:"wx"})}if(N.existsSync(o))throw new Error("Destination appeared during migration; no existing files were changed.");N.renameSync(a,o),n=!0}finally{z.dirname(a)===i&&z.basename(a).startsWith(".velu-migration-")&&N.rmSync(a,{recursive:!0,force:!0})}}return{report:t.report,written:n,exitCode:r?3:t.report.summary.errors?2:0}}async function ni(e,t){let r=Nn([...e]);if(r.help)return console.log(Fn),0;let n=await Mn({...r,version:t});if(r.json)console.log(Ye({...n.report,written:n.written}).trimEnd());else{let{summary:o}=n.report;console.log(`${n.written?"Migrated to":"Migration plan for"} ${n.report.destination}`),console.log(`${o.files} files \xB7 ${o.pages} pages/snippets \xB7 ${o.scripts} scripts \xB7 ${o.styles} stylesheets`),console.log(`${o.errors} errors \xB7 ${o.warnings} warnings \xB7 ${o.skipped} skipped paths`);for(let i of n.report.issues)console.log(` ${i.severity.toUpperCase()} [${i.code}] ${i.file}${i.line?":"+i.line:""}: ${i.message}`);n.written?console.log(`Review ${Tt}, then run: velu validate ${JSON.stringify(n.report.destination)}`):console.log(r.strict&&n.exitCode===3?"Strict mode: review required; no files written.":"Dry run: no files written.")}return n.exitCode}var Zo,Un,Ot,Tt,Qo,Pe,Ye,Fn,Vn=_(()=>{Ge();bn();re();re();Rn();Zo=new Set(["node_modules",".git",".velu",".velu-migration",".next",".turbo",".cache",".idea",".vscode",".claude",".agents","dist","dist-preview","coverage"]),Un=new Set(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock","bun.lockb"]),Ot="velu-migration-report.json",Tt="VELU-MIGRATION.md",Qo=/\.(?:avif|apng|bmp|gif|ico|jpe?g|png|svg|svgz|tiff?|webp|mp4|webm|mov|avi|m4v|mp3|wav|ogg|flac|aac|m4a|woff2?|ttf|otf|eot|pdf|txt|csv|tsv|xml|zip|gz|tar|docx?|xlsx?|pptx?)$/i,Pe=e=>Xo("sha256").update(e).digest("hex"),Ye=e=>JSON.stringify(e,null,2)+`
|
|
73
|
-
`,
|
|
72
|
+
`}async function In({source:e=".",out:t,config:r,version:n="0.2.40"}={}){let o=F.realpathSync(z.resolve(e));if(!F.statSync(o).isDirectory())throw new Error("Source must be a directory.");let i=ti(o,t);if(r&&!["docs.json","mint.json"].includes(r))throw new Error("Config must be docs.json or mint.json.");let a=r||["docs.json","mint.json"].find(f=>F.existsSync(z.join(o,f)));if(!a)throw new Error("No docs.json or mint.json found in the source directory.");let s=[],l=new Set,c=(f,b,j,E,M)=>{let ie=JSON.stringify([f,b,j,E,M]);l.has(ie)||(s.push({code:f,severity:b,file:j,message:E,...M?{line:M}:{}}),l.add(ie))},u=cn(o,a),p=un(u,a,c);!r&&F.existsSync(z.join(o,"docs.json"))&&F.existsSync(z.join(o,"mint.json"))&&c("multiple-configs","warning",a,"Both config files exist; docs.json selected. Use --config mint.json to select the legacy config.");let y=Zo(),m=z.join(o,".mintignore");if(F.existsSync(m)){if(!le(o,F.realpathSync(m)))throw new Error(".mintignore resolves outside the source.");y.add(F.readFileSync(m,"utf8"))}let g=new Map,v=[];function d(f){for(let b of F.readdirSync(f,{withFileTypes:!0}).sort((j,E)=>j.name<E.name?-1:j.name>E.name?1:0)){let j=z.join(f,b.name),E=gt(z.relative(o,j));b.isSymbolicLink()?(v.push({path:E,reason:"symbolic-link"}),c("symlink","warning",E,"Symbolic link/junction skipped. Copy its required content into the source explicitly.")):b.isDirectory()&&Qo.has(b.name)||/^\.env(?:\.|$)/i.test(b.name)||[".npmrc",".yarnrc.yml",".pnp.cjs",".pnp.loader.mjs"].includes(b.name)?v.push({path:E,reason:"dependency-cache-tooling-or-environment"}):y.ignores(E+(b.isDirectory()?"/":""))&&E!==a&&E!==".mintignore"?v.push({path:E,reason:"mintignore"}):b.isFile()&&E.startsWith(".mintlify/")&&!/\.(json|ya?ml)$/i.test(E)&&!E.startsWith(".mintlify/skills/")?v.push({path:E,reason:"mintlify-runtime-file"}):b.isDirectory()?d(j):b.isFile()?g.set(E,F.readFileSync(j)):v.push({path:E,reason:"not-regular-file"})}}if(d(o),!g.has(a))throw new Error("Source config must be a regular file, not a symbolic link.");if(g.has("velu.json"))throw new Error("Source already contains velu.json. Use the original Mintlify project to avoid replacing an existing Velu config.");let h=new Map,S=new Set,T=new Set;try{for(let f of ne(Y(p.navigation)))T.add(f.pagePath.replace(/^\//,""))}catch{}for(let f of g.keys()){let b=f;/\.md$/i.test(f)&&(T.has(f.slice(0,-3))||!/^(readme|license|changelog|contributing|contribute|skill|agents|claude)\.md$/i.test(z.posix.basename(f)))&&(b=f.replace(/\.md$/i,".mdx")),/\.mdx$/i.test(f)&&(b=f.replace(/\.mdx$/i,".mdx")),/^(?:_snippets|snippets)\/.*\.js$/i.test(f)&&(b=f.replace(/\.js$/i,".jsx"));let j=b.toLowerCase();if(S.has(j)||[Ot.toLowerCase(),Tt.toLowerCase()].includes(j))throw new Error(`Migration output collision: ${b}`);S.add(j),h.set(f,b)}let O=new Map(h);for(let[f,b]of h)if(/\.(mdx?|jsx?|tsx?)$/.test(f)){let j=f.replace(/\.[^.]+$/,"");O.has(j)||O.set(j,b),/\/index$/.test(j)&&!O.has(j.slice(0,-6))&&O.set(j.slice(0,-6),b)}let x=new Map,w=[],P=new Set,L=!1,V=[];for(let[f,b]of g){let j=h.get(f),E=b,M="asset",ie;if(/\.mdx$/i.test(j)){M="content";let J=_n(b.toString("utf8"),f,g,u,c),se=await dn(J.text,f,O,c,{endpointConverted:J.converted});E=Buffer.from(se.text),ie=se.components,L||=se.adapters.length>0;for(let dt of se.assets||[])P.add(dt)}else if(f==="package.json"){M="package";let J=hn(b.toString("utf8"),n,c);E=Buffer.from(J.text),V=J.scripts}else if(/\.js$/i.test(j))M="script",gn(b.toString("utf8"),f,c),(f.startsWith("public/")||f.split("/").some(J=>J.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load JavaScript from public or dot directories; explicitly load it from a custom script if required.");else if(/\.css$/i.test(j)){M="style";let J=b.toString("utf8");f.startsWith("public/")||(E=Buffer.from(vn(J,f,h,c))),/@import|data-component-(?:name|part)|\.dark\b|__next|#banner|#header\b/.test(J)&&c("css-hooks","warning",f,"Review CSS imports, theme classes, and Mintlify-specific selectors against Velu\u2019s DOM hooks."),(f.startsWith("public/")||f.split("/").some(se=>se.startsWith(".")))&&c("asset-not-autoloaded","warning",f,"Velu does not auto-load CSS from public or dot directories.")}else/\.[cm]?[jt]sx?$/.test(j)&&(M="module",E=Buffer.from(yn(b.toString("utf8"),f,O,c)),/(?:@mintlify\/|next\/|window\.mintlify)/.test(b.toString("utf8"))&&c("module-runtime","error",f,"Custom module depends on a Mintlify/Next.js runtime. Adapt its imports and APIs."));f.startsWith(".github/workflows/")&&/mintlify|\bmint\s/.test(b.toString("utf8"))&&c("ci-workflow","warning",f,"Workflow preserved. Replace Mintlify install/validation/deployment commands manually."),x.set(j,E),w.push({source:f,destination:j,kind:M,action:f!==j?"renamed":E.equals(b)?"copied":"transformed",sha256:_e(E),...ie?{components:ie}:{}})}for(let[f,b]of[...x]){if(!ei.test(f)&&!P.has(f)&&!/\.(css|js)$/i.test(f)||f.startsWith("public/")||f.split("/").some(M=>M.startsWith("."))||["docs.json","mint.json","package.json","velu.json",...Un].includes(f))continue;let j=`public/${f}`,E=[...x.keys()].find(M=>M.toLowerCase()===j.toLowerCase());if(E){x.get(E).equals(b)||c("public-asset-conflict","error",f,`Different asset already exists at ${E}; public file retained. Review which URL should be served.`);continue}x.set(j,b),w.push({source:f,destination:j,kind:"public-asset",action:"mirrored",sha256:_e(b)})}if(L){if(S.has(he.toLowerCase()))throw new Error(`Generated adapter conflicts with source file: ${he}`);x.set(he,Buffer.from(vt)),w.push({destination:he,kind:"module",action:"generated",sha256:_e(vt)})}let K=Buffer.from(Ye(p));x.set("velu.json",K),w.push({destination:"velu.json",kind:"config",action:"generated",sha256:_e(K)});let k=Buffer.from(Ye(u));x.set(".velu-migration/source-config.json",k),w.push({destination:".velu-migration/source-config.json",kind:"config",action:"archived",sha256:_e(k)});let $=new Set,C=new Set;try{for(let f of ne(Y(p.navigation))){C.has(f.url)&&c("duplicate-route","error","velu.json",`Duplicate route: ${f.url}`),C.add(f.url);let b=f.pagePath.replace(/^\/+|\/+$/g,"")+".mdx";/\.\.(?:\/|$)|\\/.test(b)&&c("unsafe-page-path","error","velu.json",`Page path is outside the supported project-relative format: ${f.pagePath}`),$.add(b),x.has(b)||c("missing-page","error","velu.json",`Navigation page is missing or ignored: ${b}`)}}catch(f){c("navigation-invalid","error","velu.json",f.message)}for(let f of w.filter(b=>b.kind==="content"))!$.has(f.destination)&&!/^(?:_snippets|snippets)\//.test(f.destination)&&c("unlisted-page","warning",f.destination,"Page preserved but absent from navigation. Velu\u2019s current preview only renders navigation pages; add it to navigation if it must be accessible.");let A=(f,b)=>{if(typeof f!="string")return;if(/^https?:\/\//.test(f)){c("remote-asset","error",b,"Download this branding asset into the project and use a local path; migration does not fetch external assets.");return}let j=f.replace(/^\//,"").split(/[?#]/)[0];x.has(j)||c("missing-asset","error",b,`Asset is missing or ignored: ${j}`)};if(A(p.favicon,"favicon"),typeof p.logo=="string")A(p.logo,"logo");else for(let f of["light","dark"])A(p.logo?.[f],`logo.${f}`);function N(f){if(!(!f||typeof f!="object")){if(f.openapi)for(let b of[].concat(f.openapi))/^https?:\/\//.test(b)?c("remote-openapi","warning","velu.json","Remote OpenAPI URL preserved; availability and generation need validation with network access."):x.has(b.replace(/^\//,""))?c("openapi-routes","warning","velu.json",`OpenAPI source ${b} preserved; compare generated endpoint URLs and x-mint extensions in preview.`):c("missing-openapi","error","velu.json",`OpenAPI source missing or ignored: ${b}`);for(let b of Object.values(f))typeof b=="object"&&N(b)}}N(p.navigation),V.some(f=>f.action==="converted")&&[...Un].some(f=>x.has(f))&&c("lockfile-stale","warning","package.json","Lockfiles are preserved and require regeneration after the dependency changes."),s.sort((f,b)=>f.file.localeCompare(b.file)||(f.line||0)-(b.line||0)||f.code.localeCompare(b.code));let R=s.filter(f=>f.severity==="error").length,U=s.filter(f=>f.severity==="warning").length,D={reportVersion:1,source:o,destination:i,sourceConfig:a,status:R||U?"needs-review":"ready",parityReference:{cli:"@mintlify/cli@4.0.1479",common:"@mintlify/common@1.0.1132",prebuild:"@mintlify/prebuild@1.0.1286",inspected:"2026-09-08"},summary:{files:w.length,pages:w.filter(f=>f.kind==="content").length,scripts:w.filter(f=>f.kind==="script").length,styles:w.filter(f=>f.kind==="style").length,errors:R,warnings:U,skipped:v.length},issues:s,files:w,skipped:v,npmScripts:V};return x.set(Ot,Buffer.from(Ye(D))),x.set(Tt,Buffer.from(ni(D))),{report:D,files:x}}async function Mn(e={}){let t=await In(e),r=e.strict&&(t.report.summary.errors||t.report.summary.warnings),n=!1;if(!e.dryRun&&!r){let o=t.report.destination,i=z.dirname(o);F.mkdirSync(i,{recursive:!0});let a=z.join(i,`.velu-migration-${Xo()}`);F.mkdirSync(a);try{for(let[s,l]of t.files){let c=z.resolve(a,s);if(!le(a,c))throw new Error("Output path escapes the staging directory.");F.mkdirSync(z.dirname(c),{recursive:!0}),F.writeFileSync(c,l,{flag:"wx"})}if(F.existsSync(o))throw new Error("Destination appeared during migration; no existing files were changed.");F.renameSync(a,o),n=!0}finally{z.dirname(a)===i&&z.basename(a).startsWith(".velu-migration-")&&F.rmSync(a,{recursive:!0,force:!0})}}return{report:t.report,written:n,exitCode:r?3:t.report.summary.errors?2:0}}async function ri(e,t){let r=Fn([...e]);if(r.help)return console.log(Nn),0;let n=await Mn({...r,version:t});if(r.json)console.log(Ye({...n.report,written:n.written}).trimEnd());else{let{summary:o}=n.report;console.log(`${n.written?"Migrated to":"Migration plan for"} ${n.report.destination}`),console.log(`${o.files} files \xB7 ${o.pages} pages/snippets \xB7 ${o.scripts} scripts \xB7 ${o.styles} stylesheets`),console.log(`${o.errors} errors \xB7 ${o.warnings} warnings \xB7 ${o.skipped} skipped paths`);for(let i of n.report.issues)console.log(` ${i.severity.toUpperCase()} [${i.code}] ${i.file}${i.line?":"+i.line:""}: ${i.message}`);n.written?console.log(`Review ${Tt}, then run: velu validate ${JSON.stringify(n.report.destination)}`):console.log(r.strict&&n.exitCode===3?"Strict mode: review required; no files written.":"Dry run: no files written.")}return n.exitCode}var Qo,Un,Ot,Tt,ei,_e,Ye,Nn,Vn=_(()=>{Ge();bn();re();re();Rn();Qo=new Set(["node_modules",".git",".velu",".velu-migration",".next",".turbo",".cache",".idea",".vscode",".claude",".agents","dist","dist-preview","coverage"]),Un=new Set(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock","bun.lockb"]),Ot="velu-migration-report.json",Tt="VELU-MIGRATION.md",ei=/\.(?:avif|apng|bmp|gif|ico|jpe?g|png|svg|svgz|tiff?|webp|mp4|webm|mov|avi|m4v|mp3|wav|ogg|flac|aac|m4a|woff2?|ttf|otf|eot|pdf|txt|csv|tsv|xml|zip|gz|tar|docx?|xlsx?|pptx?)$/i,_e=e=>Yo("sha256").update(e).digest("hex"),Ye=e=>JSON.stringify(e,null,2)+`
|
|
73
|
+
`,Nn=`Usage: velu migrate mintlify [source] [--out <directory>] [--config docs.json|mint.json] [--dry-run] [--json] [--strict]
|
|
74
74
|
|
|
75
75
|
Migrate a local Mintlify project into a NEW Velu directory.
|
|
76
76
|
Defaults: source=current directory, output=<source>-velu, docs.json before mint.json.
|
|
@@ -83,29 +83,29 @@ Defaults: source=current directory, output=<source>-velu, docs.json before mint.
|
|
|
83
83
|
Source files are never modified; no project scripts or package installs are executed.
|
|
84
84
|
Exit codes: 0=completed/clean plan, 1=invalid invocation or I/O failure,
|
|
85
85
|
2=compatibility errors (output is still written unless --strict), 3=strict review required.
|
|
86
|
-
`});var _t={}
|
|
86
|
+
`});var _t={};Se(_t,{currentVersion:()=>Ct,getLatestVersion:()=>Lt,isNewer:()=>Pt,maybeAutoUpdate:()=>yi,updateCommand:()=>hi});import{spawnSync as Dn}from"node:child_process";import{readFileSync as Jn,writeFileSync as oi,mkdirSync as ii}from"node:fs";import{fileURLToPath as si}from"node:url";import{homedir as ai,tmpdir as li}from"node:os";import Et from"node:path";import ee from"node:process";function Ct(){try{return JSON.parse(Jn(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function fi(e,t){let r=i=>String(i).split("-")[0].split(".").map(a=>Number(a)||0),n=r(e),o=r(t);for(let i=0;i<3;i++){let a=(n[i]||0)-(o[i]||0);if(a!==0)return a<0?-1:1}return 0}function Pt(e,t){return!e||!t||t==="unknown"?!1:fi(e,t)>0}function qn(){let e=Et.join(ai()||li(),".velu");return Et.join(e,"update-check.json")}function Bn(){try{return JSON.parse(Jn(qn(),"utf8"))}catch{return null}}function mi(e){try{let t=qn();ii(Et.dirname(t),{recursive:!0}),oi(t,JSON.stringify(e))}catch{}}async function di(){let e=`${ci}/-/package/${Ze}/dist-tags`,t=new AbortController,r=setTimeout(()=>t.abort(),pi);try{let n=await fetch(e,{signal:t.signal,headers:{accept:"application/json"}});if(!n.ok)return null;let o=await n.json();return o&&typeof o.latest=="string"?o.latest:null}catch{return null}finally{clearTimeout(r)}}async function Lt({force:e=!1}={}){if(!e){let r=Bn();if(r?.latest&&Date.now()-(r.checkedAt||0)<ui)return r.latest}let t=await di();return t?(mi({latest:t,checkedAt:Date.now()}),t):Bn()?.latest??null}function Gn(){let e=ee.env.npm_config_user_agent||"";if(e.startsWith("pnpm"))return"pnpm";if(e.startsWith("yarn"))return"yarn";if(e.startsWith("bun"))return"bun";let t="";try{t=si(import.meta.url).replace(/\\/g,"/")}catch{}return t.includes("/pnpm/")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")?"yarn":t.includes("/.bun/")?"bun":"npm"}function gi(e){let t=`${Ze}@latest`;switch(e){case"pnpm":return["pnpm",["add","-g",t]];case"yarn":return["yarn",["global","add",t]];case"bun":return["bun",["add","-g",t]];default:return["npm",["install","-g",t]]}}function Wn(e){let[t,r]=gi(e);return Dn(t,r,{stdio:"inherit",shell:ee.platform==="win32"}).status===0}async function hi(){let e=Ct(),t=await Lt({force:!0});if(t&&!Pt(t,e)){console.log(`velu is already up to date (v${e}).`);return}let r=Gn();console.log(t?`Updating velu ${e} \u2192 ${t} (via ${r})\u2026`:`Could not reach the npm registry; installing ${Ze}@latest (via ${r}) anyway\u2026`),Wn(r)?console.log('\u2713 Updated. Run "velu version" to confirm.'):(console.error("Update failed. You can update manually with:"),console.error(` npm install -g ${Ze}@latest`),ee.exitCode=1)}async function yi(){if(ee.env.VELU_NO_UPDATE==="1"||ee.env.VELU_UPDATED==="1"||!ee.stdout.isTTY)return;let e=Ct();if(e==="unknown")return;let t=null;try{t=await Lt()}catch{return}if(!Pt(t,e))return;let r=Gn();if(console.log(`
|
|
87
87
|
New velu version available: ${e} \u2192 ${t}. Updating\u2026`),!Wn(r)){console.log("Auto-update failed; continuing on the current version. Run `velu update` to retry.\n");return}console.log(`Restarting on the new version\u2026
|
|
88
|
-
`);let n=Dn(
|
|
89
|
-
`)}var tt,cr,
|
|
88
|
+
`);let n=Dn(ee.execPath,ee.argv.slice(1),{stdio:"inherit",env:{...ee.env,VELU_UPDATED:"1"}});ee.exit(n.status??0)}var Ze,ci,ui,pi,Rt=_(()=>{Ze="@veluai/velu",ci="https://registry.npmjs.org",ui=720*60*1e3,pi=3e3});import vi from"node:fs/promises";import Qe from"node:path";function Kn(e){if(!e.favicon)return null;let t=Qe.extname(e.favicon).toLowerCase();return{url:Ut+t,type:Hn[t]||""}}function Nt(e,t){let r=e.logo?.[t];if(!r)return null;let n=Qe.extname(r).toLowerCase();return{url:(t==="dark"?Ue:Re)+n,type:Hn[n]||""}}function Ne(e){if(typeof e=="string"){let t=e.trim();return t?{light:t,dark:t,href:"/"}:null}if(e&&typeof e=="object"){let t=(e.light??e.dark)?.trim?.(),r=(e.dark??e.light)?.trim?.();return!t||!r?null:{light:t,dark:r,href:e.href?.trim?.()||"/"}}return null}function xi(e){return!e||typeof e!="object"?{metatags:{},indexing:"navigable"}:{metatags:e.metatags&&typeof e.metatags=="object"?e.metatags:{},indexing:e.indexing==="all"?"all":"navigable"}}function Ft(e={},t){let r=e.colors?.primary??bi;return{name:e.name??t??"docs",theme:Te(e.theme),url:typeof process.env.VELU_SITE_URL=="string"&&process.env.VELU_SITE_URL.trim()?process.env.VELU_SITE_URL.trim().replace(/\/+$/,""):null,seo:xi(e.seo),assistant:Pe(e.assistant),thumbnails:e.thumbnails&&typeof e.thumbnails=="object"&&typeof e.thumbnails.background=="string"?{background:e.thumbnails.background}:null,colors:{primary:r,...["thulir","aalam","nila","kadhir"].includes(e.theme)?{cta:e.colors?.dark??r}:{},light:e.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e.theme)?r:e.colors?.light??r,dark:e.theme==="vepa"||["thulir","aalam","nila","kadhir"].includes(e.theme)?e.colors?.light??r:e.colors?.dark??r},favicon:e.favicon??null,api:Z(e.api),logo:Ne(e.logo),footer:Ee(e.footer),navbar:Ce(e.navbar),font:{family:Pn(e)},navigation:e.navigation??null}}async function Xn(e){let t=Qe.join(e,"velu.json"),r;try{r=await vi.readFile(t,"utf-8")}catch(o){throw o.code==="ENOENT"?new Error(`No velu.json found in ${e}. Run \`velu init <name>\` to scaffold one.`):o}let n;try{n=JSON.parse(r)}catch(o){throw new Error(`velu.json is not valid JSON: ${o.message}`)}return Ft(n,Qe.basename(e))}function Yn(e){let{colors:t,font:r}=e;return jt({light:t.light,dark:t.dark,family:r.family,theme:e.theme,primary:t.primary,cta:t.cta})}var bi,Re,Ue,Ut,Hn,Fe=_(()=>{Le();Le();bi="#dc143c",Re="/@velu-logo-light",Ue="/@velu-logo-dark",Ut="/@velu-favicon",Hn={".svg":"image/svg+xml",".ico":"image/x-icon",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif"}});import{visit as Zn}from"unist-util-visit";import{toString as wi}from"mdast-util-to-string";import $i from"github-slugger";import{valueToEstree as Si}from"estree-util-value-to-estree";function ki(e,t){let r=a=>String(a||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=r(e),o=t==null||t===""?"":r(t);return`update-${o?n?`${n}-${o}`:o:n||"item"}`}function It(e,t){let r=(e.attributes||[]).find(n=>n&&n.type==="mdxJsxAttribute"&&n.name===t);if(r)return typeof r.value=="string"?r.value:void 0}function ji(e){let t=(e.attributes||[]).find(a=>a&&a.type==="mdxJsxAttribute"&&a.name==="tags");if(!t)return[];if(typeof t.value=="string")return[t.value];let r=t.value&&t.value.value?String(t.value.value):"",n=[],o=/["'`]([^"'`]+)["'`]/g,i;for(;i=o.exec(r);)n.push(i[1]);return n}function Ie(){return e=>{let t=new $i,r=[];Zn(e,"heading",l=>{let c=wi(l);r.push({depth:l.depth,id:t.slug(c),label:c})});let n=[],o=[],i=new Set;if(Zn(e,"mdxJsxFlowElement",l=>{if(l.name!=="Update")return;let c=It(l,"label")??It(l,"date"),u=It(l,"description");c&&n.push({id:ki(c,u),label:u||c});for(let p of ji(l)){let y=p.trim().toLowerCase();p.trim()&&!i.has(y)&&(i.add(y),o.push(p.trim()))}}),n.length){Qn(e,n),Mt(e,"changelog",{tags:o});return}let a={children:[]},s=[{node:a,depth:0}];for(let l of r){for(;s.length>1&&s[s.length-1].depth>=l.depth;)s.pop();let c={id:l.id,label:l.label},u=s[s.length-1].node;u.children||(u.children=[]),u.children.push(c),s.push({node:c,depth:l.depth})}Qn(e,a.children),Mt(e,"changelog",null)}}function Qn(e,t){Mt(e,"toc",t)}function Mt(e,t,r){e.children.unshift({type:"mdxjsEsm",value:"",data:{estree:{type:"Program",sourceType:"module",body:[{type:"ExportNamedDeclaration",specifiers:[],declaration:{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:t},init:Si(r)}]}}]}}})}var zt=_(()=>{});import{visit as Ai}from"unist-util-visit";function Vt(){return e=>{Ai(e,"code",t=>{let r=(t.meta||"").trim();if(!r)return;let n={},o=r.match(/\btitle="([^"]*)"/);o&&(n["data-title"]=o[1],r=(r.slice(0,o.index)+r.slice(o.index+o[0].length)).trim());let i=r.match(/\{([\d,\s-]+)\}/);i&&(n["data-highlight"]=i[1].replace(/\s+/g,""),r=(r.slice(0,i.index)+r.slice(i.index+i[0].length)).trim()),r=r.replace(/\blineNumbers\b/,()=>(n["data-line-numbers"]="","")).trim(),r&&(n["data-filename"]=r),Object.keys(n).length&&(t.data=t.data||{},t.data.hProperties={...t.data.hProperties||{},...n})})}}var er=_(()=>{});import Oi from"node:fs";import tr from"node:path";function ae(e,t){let r=[],n=[],o=new Set;for(let i of ne(e)){if(i.node?.api){o.add(i.url);continue}if(o.has(i.url)){r.push(`duplicate URL "${i.url}" (page "${i.pagePath}") \u2014 keeping the first occurrence`);continue}o.add(i.url);let a=i.pagePath.replace(/^\/+|\/+$/g,""),s=tr.join(t,...a.split("/"))+".mdx",l=Oi.existsSync(s);l||r.push(`page "${i.pagePath}" \u2192 ${tr.relative(t,s)} not found`),n.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:l})}return{pageEntries:n,warnings:r}}var Me=_(()=>{re()});import Ti from"@apidevtools/swagger-parser";async function Ei(e){return Ti.dereference(e)}async function nr(e){return Oe(await Ei(e))}var rr=_(()=>{Ke();Ke()});function or(e,t){if(!t||typeof t!="object")return e;let r=Z(t);return{server:t.server!=null?r.server:e?.server??null,proxy:t.playground!=null?r.proxy:e?.proxy!==!1,languages:t.examples?.languages!=null?r.languages:e?.languages}}function Ci(e,{base:t,api:r,ops:n}){let o=r?.server,i=r?.languages||$t,a={proxy:r?.proxy!==!1,server:o??null},s=new Map;for(let c of e){let u=c.op.tags?.[0]||"API";s.has(u)||s.set(u,[]),s.get(u).push(c)}let l=[];for(let[c,u]of s){let p=u.map(({op:y,segment:m})=>{let g=`${t}/${Bt(c)}/${y.id}`;return n[g]={operation:y,samples:Xe(y,{server:o||y.servers?.[0],languages:i}),segment:m,title:y.title,description:y.description,method:y.method,api:a},{apiPage:g,label:y.title,method:y.method}});l.push({group:c,pages:p})}return l}async function ir(e,{loadOps:t,base:r,api:n,ops:o}){let i=Array.isArray(e)?e:[e],a=[];for(let s of i){let{operations:l,segments:c,servers:u}=await t(s);l.forEach((p,y)=>{!p.servers?.length&&u?.length&&(p.servers=u),a.push({op:p,segment:c[y]})})}return Ci(a,{base:r,api:n,ops:o})}async function sr(e,t){if(!e||typeof e!="object")return e;if(typeof e.tab=="string"&&e.openapi){let n=Bt(e.tab),o=or(t.api,e.api),i=await ir(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e;return{...l,groups:[...l.groups||[],...i]}}if(typeof e.group=="string"&&e.openapi){let n=Bt(e.group),o=or(t.api,e.api),i=await ir(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e,c=i.flatMap(u=>u.pages);return{...l,pages:[...l.pages||[],...c]}}let r={...e};for(let n of["products","versions","languages","tabs","groups"])Array.isArray(e[n])&&(r[n]=await Promise.all(e[n].map(o=>sr(o,t))));return r}async function ar(e,{api:t,loadOps:r}){let n={};return!e||typeof e!="object"?{nav:e,ops:n}:{nav:await sr(e,{api:t,loadOps:r,ops:n}),ops:n}}var Bt,lr=_(()=>{Le();St();Bt=e=>String(e??"").replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()||"x"});import Pi from"node:path";function Li(e,t){return/^https?:\/\//.test(e)?e:Pi.resolve(t,e.replace(/^\/+/,""))}async function et(e,{targetDir:t,api:r}={}){return ar(e,{api:r,loadOps:n=>nr(Li(n,t))})}var Dt=_(()=>{rr();lr()});import ur from"node:fs";import ve from"node:path";import{createHash as _i}from"node:crypto";function ze(e,{outDir:t}={}){let r=ve.resolve(e),n=t?ve.resolve(t):null,o=[],i=[],a=l=>{let c;try{c=ur.readdirSync(l,{withFileTypes:!0})}catch{return}for(let u of c){let p=ve.join(l,u.name);if(u.isDirectory()){if(u.name.startsWith(".")||Ui.has(u.name)||n&&p===n)continue;a(p);continue}if(!u.isFile())continue;let y=ve.extname(u.name).toLowerCase();if(y!==cr&&y!==Ri)continue;let m=ve.relative(r,p).split(ve.sep).join("/"),g={rel:m,abs:p,url:`${tt}/${m.split("/").map(encodeURIComponent).join("/")}?v=${Ni(p)}`,kind:y===cr?"css":"js"};(g.kind==="css"?o:i).push(g)}};a(r);let s=(l,c)=>l.rel<c.rel?-1:l.rel>c.rel?1:0;return o.sort(s),i.sort(s),{styles:o,scripts:i}}function Ni(e){try{return _i("sha1").update(ur.readFileSync(e)).digest("hex").slice(0,8)}catch{return"0"}}function pr(e,t){let r=`${tt}/`;if(!t.startsWith(r))return null;let n;try{n=decodeURIComponent(t.slice(r.length))}catch{return null}return[...e.styles,...e.scripts].find(o=>o.rel===n)??null}function fr(e,t=""){return(e?.styles??[]).map(r=>`<link rel="stylesheet" href="${Fi(t+r.url)}" data-velu-custom />`).join(`
|
|
89
|
+
`)}var tt,cr,Ri,Ui,Fi,Jt=_(()=>{tt="/@velu-custom",cr=".css",Ri=".js",Ui=new Set(["node_modules","public","dist"]);Fi=e=>String(e).replace(/&/g,"&").replace(/"/g,""")});import mr from"node:fs";import ue from"node:path";function hr(e,{buildOutDir:t}={}){return{name:"velu-site",resolveId(r){return r===gr?dr:null},async load(r){return r!==dr?null:Ii(e,{buildOutDir:t})}}}async function Ii(e,{buildOutDir:t}={}){let r={};try{r=JSON.parse(mr.readFileSync(ue.join(e,"velu.json"),"utf-8"))}catch{}let n=Z(r.api),o=r.navigation??{},i={};try{let x=await et(r.navigation??{},{targetDir:e,api:n});o=x.nav,i=x.ops}catch(x){console.warn(`[velu] openapi: ${x.message}`)}let a=Y(o),{pageEntries:s,warnings:l}=ae(a,e);for(let x of l)console.warn(`[velu] nav: ${x}`);let c=Ne(r.logo),u={name:r.name??ue.basename(e),theme:Te(r.theme),logo:c?{light:Nt({logo:c},"light")?.url??Re,dark:Nt({logo:c},"dark")?.url??Ue,href:c.href,mono:c.light===c.dark}:null,footer:Ee(r.footer),navbar:Ce(r.navbar),contextual:At(r.contextual??(["thulir","aalam","nila","kadhir"].includes(r.theme)?{options:[]}:void 0)),assistant:Pe(r.assistant),customScripts:ze(e,{outDir:t}).scripts.map(x=>x.url)},p=[],y=[],m=0;for(let x of s){if(!x.exists)continue;let w=JSON.stringify(x.fileAbsPath.split(ue.sep).join("/")),P=JSON.stringify(ue.relative(e,x.fileAbsPath).split(ue.sep).join("/")),L=`__p${m++}`;p.push(`import * as ${L} from ${w};`),y.push(` ${JSON.stringify(x.url)}: { Component: ${L}.default, frontmatter: ${L}.frontmatter, toc: ${L}.toc, changelog: ${L}.changelog, relPath: ${P}, ...__mdxApi(${L}) },`)}let g=new Set(s.filter(x=>x.exists).map(x=>x.url));for(let x of s)!x.exists&&!g.has(x.url)&&y.push(` ${JSON.stringify(x.url)}: { missing: true },`);let v=[],d=[],h=[],S=!1,T=0;for(let x of ne(a)){if(!x.node?.api)continue;let w=i[x.pagePath];if(!w)continue;S=!0;let P=`__op${T}`,L=`__samples${T}`,V=`__api${T}`,K=ue.join(e,`${x.pagePath}.mdx`),k=mr.existsSync(K)?`__overlay${T}`:null;T+=1,k&&p.push(`import * as ${k} from ${JSON.stringify(K.split(ue.sep).join("/"))};`),v.push(`const ${P} = ${JSON.stringify(w.operation)};`),v.push(`const ${L} = ${JSON.stringify(w.samples)};`),h.push(`{ id: ${JSON.stringify(w.operation.id)}, method: ${JSON.stringify(w.operation.method)}, title: ${JSON.stringify(w.operation.title)}, url: ${JSON.stringify(x.url)}, operation: ${P}, samples: ${L}, api: ${JSON.stringify(w.api||{proxy:!0,server:null})} }`);let $=`{ preset: ${JSON.stringify(u.theme)}, operation: ${P}, samples: ${L}, apiOperations: __apiOperations, api: ${JSON.stringify(w.api||{proxy:!0,server:null})} }`;d.push(k?`function ${V}(){ return React.createElement(ApiReferencePage, ${$}, React.createElement(${k}.default)); }`:`function ${V}(){ return React.createElement(ApiReferencePage, ${$}); }`),y.push(` ${JSON.stringify(x.url)}: { Component: ${V}, frontmatter: { title: ${JSON.stringify(w.title)}, description: ${JSON.stringify(w.description)} }, toc: ${k?`${k}.toc || []`:"[]"}, operation: ${P}, samples: ${L}, api: true },`)}S&&(v.push(`const __apiOperations = [
|
|
90
90
|
${h.join(`,
|
|
91
91
|
`)}
|
|
92
92
|
];`),v.push(d.join(`
|
|
93
|
-
`)));let
|
|
93
|
+
`)));let O=[];return S&&(O.push("import React from 'react';"),O.push("import { ApiReferencePage } from 'velu-ui';")),["// AUTO-GENERATED by vite-plugin-velu-site. Do not edit.",O.join(`
|
|
94
94
|
`),p.join(`
|
|
95
95
|
`),"function __mdxApi(mod) { const data = Reflect.get(mod, 'veluApi'); return data?.operation ? { mdxApi: data, api: true, operation: data.operation, samples: data.samples } : {}; }",v.join(`
|
|
96
96
|
`),"","export const pages = {",y.join(`
|
|
97
97
|
`),"};",`export const navigation = ${JSON.stringify(a)};`,`export const site = ${JSON.stringify(u)};`,"if (site.logo) {"," const __veluBase = (import.meta.env.BASE_URL || '/').replace(/\\/$/, '');"," site.logo = { ...site.logo, light: __veluBase + site.logo.light, dark: __veluBase + site.logo.dark };","}",""].join(`
|
|
98
|
-
`)}var dr,
|
|
98
|
+
`)}var gr,dr,yr=_(()=>{re();Me();Fe();Dt();Jt();gr="virtual:velu-site",dr="\0"+gr});import nt from"node:path";function vr(e){let t=nt.resolve(e);return{name:"velu-tailwind-project-source",enforce:"pre",transform(r,n){let o=n.split("?",1)[0].replace(/\\/g,"/");if(!o.endsWith("/styles.css")||!o.includes("/velu-ui/")||r.includes("data-velu-project-source"))return null;let i=nt.dirname(n.split("?",1)[0]),a=nt.relative(i,t).split(nt.sep).join("/");!a||a===""?a=".":a.startsWith(".")||(a=`./${a}`);let s=`
|
|
99
99
|
/* data-velu-project-source */
|
|
100
100
|
@source "${a}/**/*.{mdx,md,jsx,tsx,js,ts,html}";
|
|
101
101
|
@source not "${a}/node_modules";
|
|
102
102
|
@source not "${a}/.velu";
|
|
103
103
|
@source not "${a}/dist";
|
|
104
104
|
@source not "${a}/.git";
|
|
105
|
-
`;return{code:r+s,map:null}}}}var
|
|
106
|
-
`))i.push(` ${a}`);return e.suggestion&&i.push(` ${
|
|
107
|
-
`)}function it(e,{color:t=!1}={}){if(!e.length)return
|
|
108
|
-
`)}var qt,H,
|
|
105
|
+
`;return{code:r+s,map:null}}}}var br=_(()=>{});import{visit as Mi}from"unist-util-visit";function zi(e,t){let r=xr(e).replace(/[?#].*$/,""),n=xr(t).replace(/\/+$/,"");return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):null}function wr(e,t){return()=>(r,n)=>{typeof e=="function"&&Mi(r,o=>{if(o.type!=="mdxJsxFlowElement"&&o.type!=="mdxJsxTextElement"||typeof o.name!="string"||!/^[A-Z]/.test(o.name)||o.name.includes("."))return;let i={};for(let s of o.attributes||[])s.type==="mdxJsxAttribute"&&(s.value==null?i[s.name]=!0:typeof s.value=="string"&&(i[s.name]=s.value));let a=e(o.name,i,{checkRequired:!1});if(a){let s=new Error(a.title);throw s.veluIssue={...a,file:zi(n?.path,t),line:o.position?.start?.line??null,column:o.position?.start?.column??null},s.loc={line:s.veluIssue.line,column:s.veluIssue.column},s}})}}var xr,$r=_(()=>{xr=e=>String(e||"").replace(/\\/g,"/")});import rt from"node:path";import Vi from"node:fs";import{createRequire as Bi}from"node:module";import Di from"@tailwindcss/vite";import Ji from"@vitejs/plugin-react";import qi from"@mdx-js/rollup";import Gi from"remark-frontmatter";import Wi from"remark-mdx-frontmatter";import Hi from"remark-gfm";import Ki from"rehype-slug";function Xi(e){let r=Bi(import.meta.url).resolve("@mdx-js/react"),n=rt.resolve(e,"runtime","velu-ui"),o=Vi.existsSync(n)?n:rt.resolve(e,"..","velu-ui","src");return[{find:"@mdx-js/react",replacement:r},{find:/^velu-ui$/,replacement:rt.join(o,"index.js")},{find:/^velu-ui\//,replacement:o+"/"}]}function Sr({targetDir:e,VITE_ROOT:t,validateProps:r,basePath:n,buildOutDir:o}){return{root:t,base:n?`${n}/`:"/",plugins:[hr(e,{buildOutDir:o}),qi({remarkPlugins:[Gi,Wi,Hi,Vt,Ie,wr(r,e)],rehypePlugins:[Ki],providerImportSource:"@mdx-js/react"}),Ji(),vr(e),Di({optimize:!1})],cacheDir:rt.resolve(e,".velu","vite-cache"),optimizeDeps:{include:["react","react-dom","react-dom/client","react-router-dom","@mdx-js/react","lucide-react","prism-react-renderer","iso-639-1","github-slugger"],exclude:["tailwindcss","@tailwindcss/oxide","playwright","playwright-core","@apidevtools/swagger-parser","satori","@resvg/resvg-js","pagefind"],esbuildOptions:{loader:{".mdx":"jsx"}}},resolve:{alias:Xi(t),dedupe:["react","react-dom","@mdx-js/react"]}}}var kr=_(()=>{zt();er();yr();br();$r()});function I(e){return{category:"render-crash",severity:"error",file:null,line:null,column:null,frame:null,title:"Something went wrong",detail:"",hint:"",suggestion:null,...e}}function Yi(e,t){if(e=String(e),t=String(t),e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let r=Array.from({length:t.length+1},(o,i)=>i),n=new Array(t.length+1);for(let o=1;o<=e.length;o++){n[0]=o;for(let i=1;i<=t.length;i++){let a=e[o-1]===t[i-1]?0:1;n[i]=Math.min(n[i-1]+1,r[i]+1,r[i-1]+a)}[r,n]=[n,r]}return r[t.length]}function ot(e,t=[]){if(!e)return null;let r=String(e).toLowerCase(),n=null,o=1/0;for(let a of t){let s=Yi(r,String(a).toLowerCase());s<o&&(o=s,n=a)}let i=Math.min(3,Math.max(2,Math.floor(r.length/4)));return o<=i?n:null}function Zi(e,t){return e==="warning"?Q(t,H.yellow,"\u26A0"):e==="info"?Q(t,H.cyan,"\u2139"):Q(t,H.red,"\u2716")}function Gt(e,{color:t=!1}={}){let r=qt[e.category]||e.category,n=e.line?`${e.line}${e.column?`:${e.column}`:""}`:"",o=e.file?`${e.file}${n?`:${n}`:""}`:n,i=[];if(i.push(`${Zi(e.severity,t)} ${Q(t,H.bold,r)}`+(o?` ${Q(t,H.dim,o)}`:"")),e.title&&i.push(` ${e.title}`),e.detail&&e.detail!==e.title&&i.push(` ${Q(t,H.dim,e.detail)}`),e.frame)for(let a of String(e.frame).split(`
|
|
106
|
+
`))i.push(` ${a}`);return e.suggestion&&i.push(` ${Q(t,H.cyan,`Did you mean <${e.suggestion}>?`)}`),e.hint&&i.push(` ${Q(t,H.dim,`\u2192 ${e.hint}`)}`),i.join(`
|
|
107
|
+
`)}function it(e,{color:t=!1}={}){if(!e.length)return Q(t,H.cyan,"\u2713 No issues found.");let r=new Map;for(let s of e){let l=s.file||"velu.json";r.has(l)||r.set(l,[]),r.get(l).push(s)}let n=[];for(let[s,l]of r){n.push(Q(t,H.bold,s));for(let c of l)n.push(Gt({...c,file:null},{color:t}).replace(/^/gm," "));n.push("")}let o=e.filter(s=>s.severity!=="warning"&&s.severity!=="info").length,i=e.length-o,a=`${o} error${o===1?"":"s"}`+(i?`, ${i} warning${i===1?"":"s"}`:"");return n.push(Q(t,o?H.red:H.yellow,a)),n.join(`
|
|
108
|
+
`)}var qt,H,Q,pe=_(()=>{qt={"mdx-syntax":"MDX syntax",frontmatter:"Frontmatter","unknown-component":"Unknown component","invalid-props":"Invalid options","render-crash":"Render error","config-json":"velu.json","config-schema":"velu.json","config-nav":"Navigation","config-asset":"Asset"};H={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},Q=(e,t,r)=>e?`${t}${r}${H.reset}`:r});function Qi(e){let t=e,r=0;for(;t&&t.cause&&r<3&&!(t.loc||t.line||/`[^`]+` to be defined/.test(t.message||""));)t=t.cause,r+=1;return t||e}function Wt(e,t){if(!e)return null;let r=jr(e).replace(/[?#].*$/,""),n=t?jr(t).replace(/\/+$/,""):"";return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):!/^([a-zA-Z]:\/|\/)/.test(r)&&!/node_modules/.test(r)?r:null}function es(e){return e?String(e).replace(/([a-zA-Z]:\\|\/)[^\s'"()]+/g,t=>/node_modules|[\\/]vite[\\/]|@veluai|velu-cli|velu-ui/.test(t)?"\u2026":t).trim():""}function ts(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function ns(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function os(e,t){if(!e||!t)return null;let r=String(e);return/node_modules|[\\/]vite[\\/]|@veluai[\\/]/.test(r)?null:r}function Ve(e,t={}){let{projectDir:r="",knownComponents:n=[],file:o=null}=t,i=null;for(let h=e,S=0;h&&S<6;h=h.cause,S+=1)if(h.veluIssue){i=h.veluIssue;break}if(i)return I({...i,file:i.file||o});let a=Qi(e)||{},s=a.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(s);if(l){let h=l[1],S=/referenced in your code at `(\d+):(\d+)/.exec(s),T=/\bin `([^`]+)`/.exec(s),O=T?Wt(T[1],r):null;return I({category:"unknown-component",file:O||o,line:S?Number(S[1]):null,column:S?Number(S[2]):null,title:`<${h}> is not a built-in component`,detail:"",hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:ot(h,n)})}let c=a.loc||(a.line!=null?{line:a.line,column:a.column,file:a.file}:null)||ts(a.reason||s),u=a.id||c&&c.file||a.file||null,p=Wt(u,r)||o,y=!!p&&Wt(u,r)!=null,m=os(a.frame,y||!!o),g=es(ns(a.reason||s)),v=rs.test(s),d=a.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(s)||c&&c.line===1&&/unexpected|expected/i.test(s)&&/---/.test(s);return c||v||m&&y?I({category:d?"frontmatter":"mdx-syntax",file:p,line:c?c.line:null,column:c?c.column:null,frame:m,title:g||(d?"Invalid frontmatter":"MDX syntax error"),detail:"",hint:d?"Check the YAML between the --- markers \u2014 indentation, quotes, and colons.":"Make sure every <Component> has a matching closing tag and that { } braces are balanced."}):/\.map is not a function|is not iterable|reading '|undefined \(reading/i.test(s)?I({category:"invalid-props",file:p,title:"A component received an invalid value",detail:g,hint:"Check the props/options you passed to a component on this page."}):I({category:"render-crash",file:p,title:"This page failed to render",detail:g,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var jr,rs,Ht=_(()=>{pe();jr=e=>String(e).replace(/\\/g,"/");rs=/closing tag|unexpected closing|could not parse (?:expression|import|export)|unexpected character|unexpected end of|expected a closing|expected the closing|unexpected `|in expression|misnested|before name/i});function is(e){let t=qt[e.category]||e.category,r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",n=[];return n.push('<div class="velu-err-card">'),n.push('<div class="velu-err-head">'),n.push(`<span class="velu-err-pill">${oe(t)}</span>`),n.push("</div>"),e.title&&n.push(`<div class="velu-err-title">${oe(e.title)}</div>`),r&&n.push(`<a class="velu-err-loc" title="${oe(r)}">${oe(r)}</a>`),e.detail&&n.push(`<div class="velu-err-detail">${oe(e.detail)}</div>`),e.frame&&n.push(`<pre class="velu-err-frame">${oe(e.frame)}</pre>`),e.suggestion&&n.push(`<div class="velu-err-suggest">Did you mean <code><${oe(e.suggestion)}></code>?</div>`),e.hint&&n.push(`<div class="velu-err-hint">${oe(e.hint)}</div>`),n.push("</div>"),n.join("")}function Kt(e,t={}){let r=Array.isArray(e)?e:[e],n=t.title||(r.length>1?`${r.length} problems to fix`:"There\u2019s a problem to fix"),o=r.map(is).join(`
|
|
109
109
|
`);return`<!doctype html>
|
|
110
110
|
<html lang="en">
|
|
111
111
|
<head>
|
|
@@ -177,38 +177,38 @@ ${h.join(`,
|
|
|
177
177
|
<div class="velu-err-foot">Fix the file and save \u2014 this page reloads automatically.</div>
|
|
178
178
|
</div>
|
|
179
179
|
</body>
|
|
180
|
-
</html>`}var oe,
|
|
180
|
+
</html>`}var oe,Ar=_(()=>{pe();oe=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")});import st from"node:fs";import De from"node:path";import{fileURLToPath as ss}from"node:url";import as from"iso-639-1";function Be(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
|
|
181
181
|
`).length}function us(e,t){return t==null||t<0?null:e.slice(0,t).split(`
|
|
182
182
|
`).length}function Xt(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
|
|
183
|
-
`).length}function ps(e,t,r){let n=[];return s(e,t,"",null),n;function o(l){if(l&&l.$ref){let c=l.$ref.replace(/^#\//,"").split("/"),u=r;for(let p of c)u=u?.[p];return u||{}}return l}function i(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function a(l,c){let u=n.length;s(l,c,"",null,!0);let p=n.length===u;return p||(n.length=u),p}function s(l,c,u,p,y){let m=o(c);if(m){if(m.oneOf){m.oneOf.some(v=>a(l,v))||n.push({path:u,key:p,message:"value does not match any allowed shape"});return}if(m.type&&i(l)!==m.type){n.push({path:u,key:p,message:`expected ${m.type}, got ${i(l)}`});return}if(m.type==="string"&&m.minLength!=null&&l.length<m.minLength&&n.push({path:u,key:p,message:"must not be empty"}),m.type==="object"&&i(l)==="object"){for(let v of m.required||[])v in l||n.push({path:u?`${u}.${v}`:v,key:v,message:`missing required "${v}"`});let g=m.properties||{};if(m.additionalProperties===!1)for(let v of Object.keys(l))v in g||n.push({path:u?`${u}.${v}`:v,key:v,message:`unknown field "${v}"`});for(let[v,d]of Object.entries(g))v in l&&s(l[v],d,u?`${u}.${v}`:v,v,y)}m.type==="array"&&Array.isArray(l)&&m.items&&l.forEach((g,v)=>s(g,m.items,`${u}[${v}]`,p,y))}}}function fs(e){if(typeof e!="string")return!1;let t=e.trim();return/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^(rgb|rgba|hsl|hsla|color|oklch|lab|lch)\(/i.test(t)||/^[a-z][a-z0-9-]*$/i.test(t)}function at(e){let t=[],r=De.join(e,"velu.json"),n;try{n=st.readFileSync(r,"utf-8")}catch(s){return s.code==="ENOENT"?t.push(I({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(I({category:"config-json",file:"velu.json",title:"Could not read velu.json"})),t}let o;try{o=JSON.parse(n)}catch(s){let l=/position (\d+)/.exec(s.message||""),c=l?us(n,Number(l[1])):null;return t.push(I({category:"config-json",file:"velu.json",line:c,title:"velu.json is not valid JSON",detail:String(s.message||"").replace(/\s+in JSON.*$/,""),hint:"Check for a trailing comma, a missing quote, or an unclosed brace."})),t}let i=null;try{i=JSON.parse(st.readFileSync(cs,"utf-8"))}catch{}if(i)for(let s of ps(o,i,i)){let l=/^unknown field/.test(s.message);t.push(I({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:Be(n,s.key),title:s.path?`${s.path}: ${s.message}`:s.message,hint:l?"Remove it, or check the spelling against the velu.json schema.":""}))}for(let s of["primary","light","dark"]){let l=o.colors?.[s];l!=null&&!fs(l)&&t.push(I({category:"config-schema",severity:"warning",file:"velu.json",line:Be(n,s),title:`colors.${s}: "${l}" doesn\u2019t look like a CSS color`,hint:"Use a hex value like #dc143c, an rgb()/hsl() function, or a CSS color name."}))}if(typeof o.favicon=="string"&&o.favicon.trim()){let s=De.resolve(e,o.favicon.replace(/^\/+/,""));st.existsSync(s)||t.push(I({category:"config-asset",file:"velu.json",line:Be(n,"favicon"),title:`favicon not found: ${o.favicon}`,hint:"The path is relative to the project root."}))}let a=
|
|
184
|
-
${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${
|
|
183
|
+
`).length}function ps(e,t,r){let n=[];return s(e,t,"",null),n;function o(l){if(l&&l.$ref){let c=l.$ref.replace(/^#\//,"").split("/"),u=r;for(let p of c)u=u?.[p];return u||{}}return l}function i(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function a(l,c){let u=n.length;s(l,c,"",null,!0);let p=n.length===u;return p||(n.length=u),p}function s(l,c,u,p,y){let m=o(c);if(m){if(m.oneOf){m.oneOf.some(v=>a(l,v))||n.push({path:u,key:p,message:"value does not match any allowed shape"});return}if(m.type&&i(l)!==m.type){n.push({path:u,key:p,message:`expected ${m.type}, got ${i(l)}`});return}if(m.type==="string"&&m.minLength!=null&&l.length<m.minLength&&n.push({path:u,key:p,message:"must not be empty"}),m.type==="object"&&i(l)==="object"){for(let v of m.required||[])v in l||n.push({path:u?`${u}.${v}`:v,key:v,message:`missing required "${v}"`});let g=m.properties||{};if(m.additionalProperties===!1)for(let v of Object.keys(l))v in g||n.push({path:u?`${u}.${v}`:v,key:v,message:`unknown field "${v}"`});for(let[v,d]of Object.entries(g))v in l&&s(l[v],d,u?`${u}.${v}`:v,v,y)}m.type==="array"&&Array.isArray(l)&&m.items&&l.forEach((g,v)=>s(g,m.items,`${u}[${v}]`,p,y))}}}function fs(e){if(typeof e!="string")return!1;let t=e.trim();return/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^(rgb|rgba|hsl|hsla|color|oklch|lab|lch)\(/i.test(t)||/^[a-z][a-z0-9-]*$/i.test(t)}function at(e){let t=[],r=De.join(e,"velu.json"),n;try{n=st.readFileSync(r,"utf-8")}catch(s){return s.code==="ENOENT"?t.push(I({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(I({category:"config-json",file:"velu.json",title:"Could not read velu.json"})),t}let o;try{o=JSON.parse(n)}catch(s){let l=/position (\d+)/.exec(s.message||""),c=l?us(n,Number(l[1])):null;return t.push(I({category:"config-json",file:"velu.json",line:c,title:"velu.json is not valid JSON",detail:String(s.message||"").replace(/\s+in JSON.*$/,""),hint:"Check for a trailing comma, a missing quote, or an unclosed brace."})),t}let i=null;try{i=JSON.parse(st.readFileSync(cs,"utf-8"))}catch{}if(i)for(let s of ps(o,i,i)){let l=/^unknown field/.test(s.message);t.push(I({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:Be(n,s.key),title:s.path?`${s.path}: ${s.message}`:s.message,hint:l?"Remove it, or check the spelling against the velu.json schema.":""}))}for(let s of["primary","light","dark"]){let l=o.colors?.[s];l!=null&&!fs(l)&&t.push(I({category:"config-schema",severity:"warning",file:"velu.json",line:Be(n,s),title:`colors.${s}: "${l}" doesn\u2019t look like a CSS color`,hint:"Use a hex value like #dc143c, an rgb()/hsl() function, or a CSS color name."}))}if(typeof o.favicon=="string"&&o.favicon.trim()){let s=De.resolve(e,o.favicon.replace(/^\/+/,""));st.existsSync(s)||t.push(I({category:"config-asset",file:"velu.json",line:Be(n,"favicon"),title:`favicon not found: ${o.favicon}`,hint:"The path is relative to the project root."}))}let a=Ne(o.logo);if(a){let s=new Map;for(let l of["light","dark"]){let c=a[l];c&&s.set(c,[...s.get(c)||[],l])}for(let[l,c]of s)if(!st.existsSync(De.resolve(e,l.replace(/^\/+/,"")))){let u=c.length===2?"logo":`logo (${c[0]})`;t.push(I({category:"config-asset",file:"velu.json",line:Xt(n,l),title:`${u} not found: ${l}`,hint:"The path is relative to the project root."}))}}if(o.navigation&&typeof o.navigation=="object"){let s;try{s=Y(o.navigation)}catch(l){t.push(I({category:"config-nav",file:"velu.json",line:Be(n,"navigation"),title:"navigation could not be processed",detail:String(l.message||"")})),s=null}if(s){let{pageEntries:l,warnings:c}=ae(s,e);for(let u of c){let p=/not found$/.test(u),y=/page "([^"]+)"/.exec(u),m=y?Xt(n,y[1]):null;t.push(I({category:"config-nav",severity:p?"error":"warning",file:"velu.json",line:m,title:u,hint:p?"Create the .mdx file, or remove the page from navigation.":""}))}ms(s,n,t)}}return t}function ms(e,t,r){let n=new Set,o=i=>{if(!(!i||typeof i!="object")){if(i.language&&!n.has(i.language)){n.add(i.language);let a=String(i.language).toLowerCase();as.validate(a)||r.push(I({category:"config-nav",severity:"warning",file:"velu.json",line:Xt(t,i.language)||Be(t,"language"),title:`"${i.language}" is not a valid ISO 639-1 language code`,hint:'Use a two-letter code like "en", "fr", or "ja".'}))}for(let a of Object.values(i))Array.isArray(a)?a.forEach(o):a&&typeof a=="object"&&o(a)}};o(e)}var ls,cs,Yt=_(()=>{pe();re();Me();Fe();ls=De.dirname(ss(import.meta.url)),cs=De.resolve(ls,"..","..","schema","velu.schema.json")});import ds from"node:fs/promises";import gs from"node:fs";import fe from"node:path";import{fileURLToPath as hs,pathToFileURL as ys}from"node:url";import{compile as vs}from"@mdx-js/mdx";import bs from"remark-frontmatter";import xs from"remark-mdx-frontmatter";import ws from"remark-gfm";import $s from"rehype-slug";import{visit as Ss}from"unist-util-visit";function Zt(){if(lt)return lt;let e=fe.dirname(hs(import.meta.url)),t=[fe.resolve(e,"..","runtime","velu-ui"),fe.resolve(e,"..","..","runtime","velu-ui"),fe.resolve(e,"..","..","..","velu-ui","src")],r=null;for(let n of t){let o=fe.join(n,"lib","component-schemas.js");if(gs.existsSync(o)){r=o;break}}return lt=r?import(ys(r).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),lt}function ks(e){let t={};for(let r of e.attributes||[])r.type==="mdxJsxAttribute"&&(r.value==null?t[r.name]=!0:typeof r.value=="string"&&(t[r.name]=r.value));return t}function js(e,t){return()=>r=>{Ss(r,n=>{if((n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")&&typeof n.name=="string"&&/^[A-Z]/.test(n.name)&&!n.name.includes(".")&&e.push({name:n.name,props:ks(n),line:n.position?.start?.line??null,column:n.position?.start?.column??null}),n.type==="mdxjsEsm"&&typeof n.value=="string")for(let o of n.value.matchAll(/\b([A-Z][A-Za-z0-9_]*)\b/g))t.add(o[1])})}}async function As(e,t){let r=[],n;try{n=await ds.readFile(t.fileAbsPath,"utf-8")}catch{return r}let o=fe.relative(e,t.fileAbsPath).split(fe.sep).join("/"),i=[],a=new Set;try{await vs({value:n,path:t.fileAbsPath},{remarkPlugins:[bs,xs,ws,Ie,js(i,a)],rehypePlugins:[$s],providerImportSource:"@mdx-js/react"})}catch(u){return r.push(Ve(u,{projectDir:e,knownComponents:te,file:o})),r}let s=new Set(te),l=await Zt(),c=new Set;for(let u of i)if(!a.has(u.name)){if(!s.has(u.name)){if(c.has(u.name))continue;c.add(u.name),r.push(I({category:"unknown-component",file:o,line:u.line,column:u.column,title:`<${u.name}> is not a built-in component`,hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:ot(u.name,te)}));continue}if(l){let p=l(u.name,u.props,{checkRequired:!1});p&&r.push(I({...p,file:o,line:u.line,column:u.column}))}}return r}async function Or(e,t){let r=t.filter(s=>s.exists),n=[],o=8,i=0;async function a(){for(;i<r.length;){let s=r[i++],l=await As(e,s);for(let c of l)n.push(c)}}return await Promise.all(Array.from({length:Math.min(o,r.length)},a)),n}var lt,Qt=_(()=>{zt();pe();Ht();We()});import qe from"node:fs";import en from"node:path";import Cr from"js-yaml";function tn(e,t,r){if(r>24||e===null||typeof e!="object")return r>24&&e&&typeof e=="object"?null:e;if(t.has(e))return null;t.add(e);let n;if(Array.isArray(e))n=e.map(o=>tn(o,t,r+1));else{n={};for(let[o,i]of Object.entries(e))n[o]=tn(i,t,r+1)}return t.delete(e),n}function Pr(e){return Cr.dump(tn(e,new Set,0),{noRefs:!0,lineWidth:100,skipInvalid:!0})}function Lr(e){let t=String(e).replace(/\.md$/i,"");return t===""||t==="/"||t==="/index"?"/":t.replace(/\/+$/,"")||"/"}function Os(e){return e==="/"?"/index.md":`${e}.md`}function nn(e,t){if(t==="api")return`# ${Tr}
|
|
184
|
+
${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${Tr}
|
|
185
185
|
|
|
186
|
-
`;return r?e.slice(0,r[0].length)+n+e.slice(r[0].length):n+e}function Es(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function Cs(e){try{let t=qe.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let r=
|
|
187
|
-
`)}async function
|
|
186
|
+
`;return r?e.slice(0,r[0].length)+n+e.slice(r[0].length):n+e}function Es(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function Cs(e){try{let t=qe.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let r=Cr.load(t[1]);return r&&typeof r=="object"?r:{}}catch{return{}}}async function we(e){let t={};try{t=JSON.parse(qe.readFileSync(en.join(e,"velu.json"),"utf-8"))}catch{return{name:en.basename(e),baseUrl:"",pages:[]}}let r=t.name??en.basename(e),n=typeof process.env.VELU_SITE_URL=="string"?process.env.VELU_SITE_URL.replace(/\/+$/,""):"",o=Z(t.api),i=t.navigation??{},a={};try{let p=await et(t.navigation??{},{targetDir:e,api:o});i=p.nav,a=p.ops}catch(p){console.warn(`[velu] openapi: ${p.message}`)}let s=Y(i),{pageEntries:l}=ae(s,e),c=new Map(l.map(p=>[p.url,p])),u=[];for(let p of ne(s)){if(!p.url)continue;let y=p.ancestors.filter(h=>h.kind==="group").pop(),m=p.ancestors.filter(h=>h.kind==="tab").pop(),g=y?.label||m?.label||"Pages",v=p.ancestors.filter(h=>h.kind==="tab"||h.kind==="group").map(h=>h.label),d=p.ancestors.filter(h=>h.kind==="language").pop()?.code||null;if(p.node?.api){let h=a[p.pagePath];if(!h)continue;let S=h.title||Er(p.url);u.push({url:p.url,title:S,description:h.description||"",group:g,breadcrumb:[...v,S],lang:d,frontmatter:{title:h.title,description:h.description},source:{kind:"api",segment:h.segment}})}else{let h=c.get(p.url);if(!h||!h.exists)continue;let S=Cs(h.fileAbsPath),T=S.title||Er(p.url);u.push({url:p.url,title:T,description:S.description||"",group:g,breadcrumb:[...v,T],lang:d,frontmatter:S,source:{kind:"mdx",fileAbsPath:h.fileAbsPath}})}}return{name:r,baseUrl:n,pages:u}}function ut(e){return new Map(e.pages.map(t=>[t.url,{...t.source,title:t.title}]))}async function Ps(e){return ut(await we(e))}async function rn(e,t,r){let o=(r||await Ps(e)).get(t);if(!o)return null;if(o.kind==="mdx")try{return{body:qe.readFileSync(o.fileAbsPath,"utf-8"),contentType:"text/markdown; charset=utf-8",kind:"mdx"}}catch{return null}return o.segment?{body:Pr(o.segment),contentType:"text/yaml; charset=utf-8",kind:"api"}:null}async function _r(e,t){let r=t||await we(e),n=s=>r.baseUrl?r.baseUrl+s:s,o=[`# ${r.name}`,"",`> Documentation index for ${r.name}. Append \`.md\` to any page URL (or send \`Accept: text/markdown\`) for its Markdown; fetch ${ct} for the whole site in one document.`,""],i=[],a=new Map;for(let s of r.pages)a.has(s.group)||(a.set(s.group,[]),i.push(s.group)),a.get(s.group).push(s);for(let s of i){o.push(`## ${s}`,"");for(let l of a.get(s))o.push(`- [${l.title}](${n(Os(l.url))})${l.description?`: ${l.description}`:""}`);o.push("")}return o.join(`
|
|
187
|
+
`)}async function Rr(e,t){let r=t||await we(e),n=[`# ${r.name}`,"",`> Full documentation \u2014 every page concatenated. Index: ${be}`];for(let o of r.pages)if(n.push("","---","",`# ${o.title}`,`Source: ${o.url}`,""),o.source.kind==="mdx")try{n.push(Es(qe.readFileSync(o.source.fileAbsPath,"utf-8")).trim())}catch{}else o.source.segment&&n.push("```yaml",Pr(o.source.segment).trim(),"```");return n.join(`
|
|
188
188
|
`)+`
|
|
189
|
-
`}async function
|
|
190
|
-
<title>${
|
|
191
|
-
<link>${
|
|
192
|
-
<guid isPermaLink="true">${
|
|
189
|
+
`}async function Ur(e,t){let r=t||await we(e),n=r.baseUrl||"",o=[];for(let s of r.pages){if(s.source.kind!=="mdx")continue;let l="";try{l=qe.readFileSync(s.source.fileAbsPath,"utf-8")}catch{continue}let c=/<Update\b([^>]*)>([\s\S]*?)<\/Update>/gi,u;for(;u=c.exec(l);){let p=u[1]||"",y=u[2]||"",m=Je(p,"label")||Je(p,"date")||"Update",g=Je(p,"description")||_s(y)||m,v=Je(p,"description"),d=`${n}${s.url}#${Ls(m,v)}`,h=Je(p,"date")||m,S=new Date(h),T=Number.isNaN(S.getTime())?null:S.toUTCString();o.push({title:m,link:d,description:g,pubDate:T})}}if(!o.length)return null;let i=n||"/",a=o.map(s=>` <item>
|
|
190
|
+
<title>${me(s.title)}</title>
|
|
191
|
+
<link>${me(s.link)}</link>
|
|
192
|
+
<guid isPermaLink="true">${me(s.link)}</guid>
|
|
193
193
|
`+(s.pubDate?` <pubDate>${s.pubDate}</pubDate>
|
|
194
|
-
`:"")+` <description>${
|
|
194
|
+
`:"")+` <description>${me(s.description)}</description>
|
|
195
195
|
</item>`).join(`
|
|
196
196
|
`);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
197
197
|
<rss version="2.0">
|
|
198
198
|
<channel>
|
|
199
|
-
<title>${
|
|
200
|
-
<link>${
|
|
201
|
-
<description>${
|
|
199
|
+
<title>${me(r.name)} \u2014 Changelog</title>
|
|
200
|
+
<link>${me(i)}</link>
|
|
201
|
+
<description>${me(`Product updates and announcements for ${r.name}.`)}</description>
|
|
202
202
|
<generator>Velu</generator>
|
|
203
203
|
`+a+`
|
|
204
204
|
</channel>
|
|
205
205
|
</rss>
|
|
206
|
-
`}var
|
|
206
|
+
`}var be,ct,Ts,xe,Tr,Er,me,Ls,Je,_s,Nr=_(()=>{re();Me();Fe();Dt();be="/llms.txt",ct="/llms-full.txt",Ts=`<${be}>; rel="llms-txt", <${ct}>; rel="llms-full-txt"`,xe={Link:Ts,"X-Llms-Txt":be},Tr=`Full documentation index: ${be}`;Er=e=>(e.split("/").filter(Boolean).pop()||"Home").replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase());me=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),Ls=(e,t)=>{let r=a=>String(a||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=r(e),o=t==null||t===""?"":r(t);return`update-${o?n?`${n}-${o}`:o:n||"item"}`},Je=(e,t)=>{let r=e.match(new RegExp(`${t}\\s*=\\s*["']([^"']*)["']`,"i"));return r?r[1]:void 0},_s=e=>String(e||"").replace(/```[\s\S]*?```/g,"").replace(/<[^>]+>/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[#*`_>]/g,"").replace(/\s+/g," ").trim().slice(0,500)});var Jr={};Se(Jr,{startDevServer:()=>Ks});import Fr from"node:fs/promises";import $e from"node:fs";import Rs from"node:http";import{spawn as Us}from"node:child_process";import G from"node:path";import{fileURLToPath as Ns}from"node:url";import Fs from"chokidar";import on from"express";import{createServer as Is,createLogger as Ms,searchForWorkspaceRoot as zs}from"vite";function Js(e){return`<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e).replace(/%20/g,"+")}:wght@300;400;500;600;700&display=swap`}" />`}function Mr(e,t){let r=Gt(e,{color:!!process.stderr.isTTY});console.error(`
|
|
207
207
|
`+r+`
|
|
208
|
-
`),process.env.VELU_DEBUG&&t&&console.error(t)}function
|
|
209
|
-
`)}function Hs(e,t,r){let n=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},o=process.stdout.isTTY,i=g=>o&&process.stdout.write(`\x1B]${g}\x1B\\`),a=()=>{i(`0;\u23F3 ${t}`),i("9;4;3;0")},s=()=>{i(`0;${t}`),i("9;4;0;0")};o&&process.once("exit",()=>i("9;4;0;0")),a();let l=r&&r!=="unknown"?`v${r}`:"";if(!e)return console.log(`Starting Velu${l?" "+l:""}\u2026`),{ready:g=>{console.log(`Velu${l?" "+l:""} ready \u2192 ${g}`),s(),n()}};let c="\x1B[38;2;220;20;60m",u="\x1B[0m",p="\x1B[2m";console.log("");for(let g of Gs)console.log(`${c}${g}${u}`);l&&console.log(` ${p}${l}${u}`),console.log("");let y=null;try{y=Us(process.execPath,["-e",Ws],{stdio:["ignore","inherit","ignore"]}),y.on("error",()=>{})}catch{}let m=()=>{if(y){try{y.kill()}catch{}y=null}};return process.once("exit",m),{ready:g=>{m(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${u} Velu${l?" "+l:""} ready \u2192 \x1B[36m${g}${u}`),s(),n()}}}async function Ks(e){let t=!!process.env.VELU_PROFILE,r=performance.now(),n=(
|
|
208
|
+
`),process.env.VELU_DEBUG&&t&&console.error(t)}function zr(){try{return JSON.parse($e.readFileSync(G.join(pt,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function qs(e,t){let r=G.resolve(e,".velu"),n=G.resolve(r,".velu-version"),o=null;try{o=$e.readFileSync(n,"utf8").trim()}catch{}if(o!==t){if(o!==null)try{$e.rmSync(G.join(r,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{$e.mkdirSync(r,{recursive:!0}),$e.writeFileSync(n,t)}catch{}}}async function Vr(e){try{return await Xn(e)}catch{return Ft({},G.basename(e))}}async function Br(e,t){let r=await e.moduleGraph.getModuleByUrl(t,!0),n=new Map,o=new Set;async function i(a){if(!(!a||o.has(a.url))){if(o.add(a.url),a.id&&Bs.test(a.id)){let s=a.url.includes("?")?"&":"?",l=await e.transformRequest(`${a.url}${s}direct`);l?.code&&n.set(a.url,l.code)}for(let s of a.importedModules)await i(s)}}return await i(r),[...n.values()].join(`
|
|
209
|
+
`)}function Hs(e,t,r){let n=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},o=process.stdout.isTTY,i=g=>o&&process.stdout.write(`\x1B]${g}\x1B\\`),a=()=>{i(`0;\u23F3 ${t}`),i("9;4;3;0")},s=()=>{i(`0;${t}`),i("9;4;0;0")};o&&process.once("exit",()=>i("9;4;0;0")),a();let l=r&&r!=="unknown"?`v${r}`:"";if(!e)return console.log(`Starting Velu${l?" "+l:""}\u2026`),{ready:g=>{console.log(`Velu${l?" "+l:""} ready \u2192 ${g}`),s(),n()}};let c="\x1B[38;2;220;20;60m",u="\x1B[0m",p="\x1B[2m";console.log("");for(let g of Gs)console.log(`${c}${g}${u}`);l&&console.log(` ${p}${l}${u}`),console.log("");let y=null;try{y=Us(process.execPath,["-e",Ws],{stdio:["ignore","inherit","ignore"]}),y.on("error",()=>{})}catch{}let m=()=>{if(y){try{y.kill()}catch{}y=null}};return process.once("exit",m),{ready:g=>{m(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${u} Velu${l?" "+l:""} ready \u2192 \x1B[36m${g}${u}`),s(),n()}}}async function Ks(e){let t=!!process.env.VELU_PROFILE,r=performance.now(),n=(k,$)=>t&&console.log(`[velu-profile] ${k}: ${(performance.now()-$).toFixed(0)}ms`),o=Hs(!!process.stdout.isTTY&&!t,G.basename(e),zr()),i=await Vr(e),a=l(),s=ze(e);function l(){let $=at(e).filter(C=>C.severity==="error"&&(C.category==="config-json"||C.category==="config-schema"));return $.length&&console.error(`
|
|
210
210
|
`+it($,{color:!!process.stderr.isTTY})+`
|
|
211
|
-
`),$}let c=e;try{c
|
|
211
|
+
`),$}let c=e;try{c=$e.realpathSync(e)}catch{}let u=0,p=k=>{let $=performance.now();if($-u<500)return;u=$;let C=Ve(k,{projectDir:c,knownComponents:te});Mr(C,k)};process.on("unhandledRejection",p),process.on("uncaughtException",p);let y=Number(process.env.PORT)||8358,m=await Zt();qs(e,zr());let g=on(),v=Rs.createServer(g),d=Ms(t?"info":"warn"),h=k=>typeof k=="string"&&k.includes("Failed to load source map"),S=d.warn.bind(d),T=d.warnOnce.bind(d);d.warn=(k,$)=>{h(k)||S(k,$)},d.warnOnce=(k,$)=>{h(k)||T(k,$)};let O=await Is({...Sr({targetDir:e,VITE_ROOT:pt,validateProps:m}),appType:"custom",logLevel:t?"info":"warn",customLogger:d,server:{middlewareMode:!0,fs:{allow:[zs(pt),e,c]},hmr:{server:v}}});n("vite server created",r),g.get(new RegExp(`^${tt}/`),(k,$,C)=>{let A=pr(s,k.path);if(!A)return C();$.sendFile(A.abs,N=>{N&&$.status(404).end()})}),g.use(O.middlewares);let x=G.join(e,"public");g.use(on.static(x)),g.get(new RegExp(`^${Ut}(\\.[a-z0-9]+)?$`,"i"),async(k,$)=>{if(!i.favicon)return $.status(404).end();let C=G.resolve(e,i.favicon.replace(/^\//,""));$.sendFile(C,A=>{A&&$.status(404).end()})});let w=k=>($,C)=>{let A=i.logo?.[k];if(!A)return C.status(404).end();C.sendFile(G.resolve(e,A.replace(/^\//,"")),N=>{N&&C.status(404).end()})};g.get(new RegExp(`^${Re}(\\.[a-z0-9]+)?$`,"i"),w("light")),g.get(new RegExp(`^${Ue}(\\.[a-z0-9]+)?$`,"i"),w("dark")),g.post("/@velu-api-proxy",on.json({limit:"8mb"}),async(k,$)=>{let{method:C="GET",url:A,headers:N={},body:R}=k.body||{};if(typeof A!="string"||!/^https?:\/\//i.test(A))return $.status(400).json({error:"A valid http(s) target URL is required."});try{let U=await fetch(A,{method:C,headers:N,body:R!=null&&R!==""?R:void 0}),D=await U.text(),f=U.headers.get("content-type")||"",b={};U.headers.forEach((E,M)=>{b[M]=E});let j=D;if(/json/i.test(f))try{j=JSON.parse(D)}catch{}$.json({status:U.status,statusText:U.statusText,headers:b,body:j})}catch(U){$.json({error:`Request failed: ${U.message}`})}});let P=null,L=async()=>P||=await we(e);g.get(/\.md$/i,async(k,$,C)=>{try{let A=await L(),N=await rn(e,Lr(decodeURIComponent(k.path)),ut(A));if(!N)return C();$.status(200).set({"Content-Type":N.contentType,...xe}).end(nn(N.body,N.kind))}catch{C()}}),g.get(be,async(k,$,C)=>{try{let A=await _r(e,await L());$.status(200).set({"Content-Type":"text/plain; charset=utf-8",...xe}).end(A)}catch{C()}}),g.get(ct,async(k,$,C)=>{try{let A=await Rr(e,await L());$.status(200).set({"Content-Type":"text/plain; charset=utf-8",...xe}).end(A)}catch{C()}}),g.get("/rss.xml",async(k,$,C)=>{try{let A=await Ur(e,await L());if(!A)return C();$.status(200).set({"Content-Type":"application/rss+xml; charset=utf-8"}).end(A)}catch{C()}}),g.use("*",async(k,$,C)=>{let A=k.originalUrl,N=performance.now();if(/text\/markdown/i.test(k.headers.accept||""))try{let R=await L(),U=await rn(e,bt(A),ut(R));if(U)return $.status(200).set({"Content-Type":U.contentType,...xe}).end(nn(U.body,U.kind))}catch{}if(a.length)return $.status(200).set({"Content-Type":"text/html"}).end(Kt(a,{title:"Fix velu.json to continue"}));try{let R=performance.now(),U=await Fr.readFile(Dr,"utf-8");U=await O.transformIndexHtml(A,U),n(`transformIndexHtml ${A}`,R);let D="/src/runtime/server-entry.jsx";R=performance.now();let{render:f}=await O.ssrLoadModule(D);n(`ssrLoadModule ${A} (1st req includes dep pre-bundle)`,R),R=performance.now();let b=await f(A);n(`render ${A}`,R),R=performance.now();let j=await Br(O,D);n(`collectSsrCss ${A}`,R);let E=j?`<style data-velu-ssr>${j}</style>`:"",M=`<style data-velu-config>
|
|
212
212
|
${Yn(i)}
|
|
213
|
-
</style>`,ie=Ds.has(i.font.family)?"":Js(i.font.family),J=Kn(i),se=J?`<link rel="icon"${J.type?` type="${J.type}"`:""} href="${J.url}" />`:"",dt=fr(s),
|
|
214
|
-
`),
|
|
213
|
+
</style>`,ie=Ds.has(i.font.family)?"":Js(i.font.family),J=Kn(i),se=J?`<link rel="icon"${J.type?` type="${J.type}"`:""} href="${J.url}" />`:"",dt=fr(s),Yr=[E,M,ie,se,dt].filter(Boolean).join(`
|
|
214
|
+
`),Zr=U.replace('<html lang="en">',`<html lang="en" data-current-path="${Ir(bt(A))}">`).replace("<!--app-title-->",Ir(i.name)).replace("<!--app-head-->",Yr).replace("<!--app-html-->",b);$.status(200).set({"Content-Type":"text/html",...xe}).end(Zr),n(`TOTAL ${A}`,N)}catch(R){O.ssrFixStacktrace(R);let U=Ve(R,{projectDir:c,knownComponents:te});if(/failed to load url|does the file exist|cannot find module|ERR_MODULE_NOT_FOUND/i.test(String(R&&R.message))){try{O.moduleGraph.invalidateAll()}catch{}U.hint="The dev server cache is out of sync \u2014 this usually happens after files are added, removed, or moved. Reload the page; if it persists, stop velu dev, delete the .velu folder in your project, and restart."}Mr(U,R),$.status(200).set({"Content-Type":"text/html"}).end(Kt([U]))}}),Fs.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(k,$)=>{console.log(`[velu-cli] content ${k}: ${G.relative(e,$)}`);let C=G.basename($)==="velu.json",A=$.endsWith(".mdx"),N=/\.(css|js)$/i.test($),R=!1;if(N){let f=j=>j.scripts.some(E=>E.abs===$),b=f(s);s=ze(e),R=b||f(s)}let U=/\.(ya?ml|json)$/i.test($),D=C||U||A&&(k==="add"||k==="unlink")||R;if((D||A||/\.(ya?ml|json)$/i.test($))&&(P=null),C&&(i=await Vr(e),a=l()),D)O.moduleGraph.invalidateAll();else if(A){let f=$.split(G.sep).join("/"),b=O.moduleGraph.getModulesByFile(f);if(b)for(let j of b)O.moduleGraph.invalidateModule(j)}O.ws.send({type:"full-reload"})});async function K(k){let $=new Set,C=12,A=0,N=[],R=()=>A<C?(A+=1,Promise.resolve()):new Promise(b=>N.push(b)).then(()=>{A+=1}),U=()=>{A-=1,N.shift()?.()},D=b=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(b)||/[\\/]node_modules[\\/]/.test(b)&&!/velu-ui/.test(b);async function f(b){if(!(!b||$.has(b)||D(b))){$.add(b);try{await R();try{await O.transformRequest(b,{ssr:!1})}finally{U()}let j=await O.moduleGraph.getModuleByUrl(b,!1);j?.importedModules?.size&&await Promise.all([...j.importedModules].map(E=>f(E.url)))}catch{}}}return await f(k),$.size}v.listen(y,async()=>{let k=performance.now(),$=0;try{let{render:C}=await O.ssrLoadModule("/src/runtime/server-entry.jsx");await K("/src/runtime/client-entry.jsx"),typeof O.waitForRequestsIdle=="function"&&await O.waitForRequestsIdle();let[A]=await Promise.allSettled([K("/src/runtime/client-entry.jsx"),C("/"),O.transformIndexHtml("/",await Fr.readFile(Dr,"utf-8")),Br(O,"/src/runtime/server-entry.jsx")]).then(N=>N.map(R=>R.status==="fulfilled"?R.value:0));$=A}catch(C){t&&console.log("[velu-profile] warmup error:",C?.message)}n(`cold-start warm-up (${$} client modules)`,k),o.ready(`http://localhost:${y}`)})}var Vs,Bs,Ds,Ir,pt,Dr,Gs,Ws,qr=_(()=>{Fe();kr();Ht();Ar();pe();We();Yt();Qt();Nr();re();Jt();Vs=G.dirname(Ns(import.meta.url)),Bs=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,Ds=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),Ir=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");pt=G.resolve(Vs,".."),Dr=G.resolve(pt,"src","template.html"),Gs=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],Ws="const F=['\u280B','\u2819','\u2839','\u2838','\u283C','\u2834','\u2826','\u2827','\u2807','\u280F'],M=['Starting Velu','Setting up your preview','Preparing your docs','Warming things up','Almost ready'];let f=0,m=0;const t=Date.now();const C='\\x1b[38;2;220;20;60m',R='\\x1b[0m',D='\\x1b[2m';const d=()=>{const s=(Date.now()-t)/1000|0;process.stdout.write('\\x1b[2K\\r '+C+F[f]+R+' '+M[m]+'\\u2026 '+D+s+'s'+R);f=(f+1)%F.length;};d();setInterval(d,90);setInterval(()=>{if(m<M.length-1)m++;},4000);"});var Wr={};Se(Wr,{default:()=>Qs,runValidate:()=>Gr});import Xs from"node:fs";import Ys from"node:path";function Zs(e){try{let t=JSON.parse(Xs.readFileSync(Ys.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let r=Y(t.navigation);return ae(r,e).pageEntries}catch{return[]}}async function Gr(e){let t=at(e),r=Zs(e),n=await Or(e,r),o=[...t,...n],i=!!process.stdout.isTTY;return console.log(it(o,{color:i})),o.some(s=>s.severity!=="warning"&&s.severity!=="info")?1:0}var Qs,Hr=_(()=>{re();Me();Yt();Qt();pe();Qs=Gr});import ft from"node:path";import B from"node:process";import{readFileSync as ea}from"node:fs";var[,,Kr,mt]=B.argv;function Xr(){try{return JSON.parse(ea(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function ta(){let e=B.argv.slice(3);for(let t=0;t<e.length;t++){let r=e[t];if(r==="--out"){t++;continue}if(!r.startsWith("-"))return r}}async function na(){switch(Kr){case"--version":case"-v":case"version":{console.log(Xr());break}case"init":{mt||(console.error("Usage: velu init <project-name>"),B.exit(1));let e=mt,t=ft.resolve(B.cwd(),e),{initProject:r}=await Promise.resolve().then(()=>(ln(),an));await r(t,e);break}case"migrate":{let{runMigrate:e}=await Promise.resolve().then(()=>(Vn(),zn));B.exitCode=await e(B.argv.slice(3),Xr());break}case"dev":{let{maybeAutoUpdate:e}=await Promise.resolve().then(()=>(Rt(),_t));await e();let t=ft.resolve(B.cwd(),mt??"."),{startDevServer:r}=await Promise.resolve().then(()=>(qr(),Jr));await r(t);break}case"update":{let{updateCommand:e}=await Promise.resolve().then(()=>(Rt(),_t));await e();break}case"validate":{let e=ft.resolve(B.cwd(),mt??"."),{runValidate:t}=await Promise.resolve().then(()=>(Hr(),Wr)),r=await t(e);B.exit(r);break}case"build":{let e=ft.resolve(B.cwd(),ta()??"."),t=B.argv.indexOf("--out"),r=t>-1?B.argv[t+1]:void 0,n=new URL(["..","src","build","index.js"].join("/"),import.meta.url).href,o=a=>import(a),i;try{({runBuild:i}=await o(n))}catch{console.error("velu build is an internal command, not available in this distribution."),B.exit(1)}await i(e,{out:r});break}default:console.log("Usage:"),console.log(" velu init <project-name> scaffold a new docs project"),console.log(" velu migrate mintlify [dir] migrate a Mintlify project (see --help)"),console.log(" velu dev [dir] start the dev preview server"),console.log(" velu validate [dir] check velu.json + content for problems"),console.log(" velu update update velu to the latest version"),B.exit(Kr?1:0)}}na().catch(e=>{console.error(B.env.VELU_DEBUG?e:`Error: ${e.message}`),B.exit(1)});
|
package/package.json
CHANGED
|
@@ -95,7 +95,7 @@ export default function ApiSidebar({
|
|
|
95
95
|
<Ctx.Provider value={ctx}>
|
|
96
96
|
<Stack
|
|
97
97
|
as="nav"
|
|
98
|
-
space="
|
|
98
|
+
space="0px"
|
|
99
99
|
className={`velu-api-sidebar ${className}`.trim()}
|
|
100
100
|
aria-label="API reference"
|
|
101
101
|
{...rest}
|
|
@@ -110,7 +110,7 @@ export default function ApiSidebar({
|
|
|
110
110
|
)}
|
|
111
111
|
<Stack
|
|
112
112
|
as="ul"
|
|
113
|
-
space="
|
|
113
|
+
space="0px"
|
|
114
114
|
className="velu-api-sidebar__list"
|
|
115
115
|
>
|
|
116
116
|
{(section.endpoints ?? []).map((ep, j) => (
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
/* Compact method pill in the sidebar
|
|
196
|
+
/* Compact method pill in the (non-API) sidebar when an item is an endpoint. */
|
|
197
197
|
.velu-sidebar__method {
|
|
198
198
|
flex: none;
|
|
199
199
|
font-family: var(--font-mono);
|
|
@@ -204,8 +204,8 @@
|
|
|
204
204
|
border-radius: var(--radius-xs, 4px);
|
|
205
205
|
text-transform: uppercase;
|
|
206
206
|
}
|
|
207
|
-
.velu-sidebar__method.velu-method-badge--get { color: var(--get-pill-color); background:
|
|
208
|
-
.velu-sidebar__method.velu-method-badge--post { color: var(--post-pill-color); background:
|
|
209
|
-
.velu-sidebar__method.velu-method-badge--put { color: var(--put-pill-color); background:
|
|
210
|
-
.velu-sidebar__method.velu-method-badge--patch { color: var(--patch-pill-color); background:
|
|
211
|
-
.velu-sidebar__method.velu-method-badge--delete { color: var(--delete-pill-color); background:
|
|
207
|
+
.velu-sidebar__method.velu-method-badge--get { color: var(--get-pill-stroke-color); background: var(--get-pill-color); }
|
|
208
|
+
.velu-sidebar__method.velu-method-badge--post { color: var(--post-pill-stroke-color); background: var(--post-pill-color); }
|
|
209
|
+
.velu-sidebar__method.velu-method-badge--put { color: var(--put-pill-stroke-color); background: var(--put-pill-color); }
|
|
210
|
+
.velu-sidebar__method.velu-method-badge--patch { color: var(--patch-pill-stroke-color); background: var(--patch-pill-color); }
|
|
211
|
+
.velu-sidebar__method.velu-method-badge--delete { color: var(--delete-pill-stroke-color); background: var(--delete-pill-color); }
|
|
@@ -580,22 +580,26 @@
|
|
|
580
580
|
}
|
|
581
581
|
|
|
582
582
|
/* ── ApiSidebar ────────────────────────────────────────────────────────── */
|
|
583
|
-
/*
|
|
584
|
-
|
|
585
|
-
|
|
583
|
+
/* Same nav chrome as the themed presets: sentence-case group labels,
|
|
584
|
+
compact method pills, rounded hover/active rows. Theme sheets may
|
|
585
|
+
still tighten type and spacing on top. */
|
|
586
586
|
.velu-api-sidebar {
|
|
587
|
-
|
|
588
|
-
|
|
587
|
+
margin: 0;
|
|
588
|
+
border: 0;
|
|
589
|
+
width: 100%;
|
|
589
590
|
}
|
|
590
591
|
|
|
591
592
|
.velu-api-sidebar__section {
|
|
592
593
|
display: flex;
|
|
593
594
|
align-items: center;
|
|
594
595
|
gap: var(--s-2);
|
|
595
|
-
padding
|
|
596
|
-
|
|
597
|
-
font-
|
|
598
|
-
|
|
596
|
+
padding: 0 var(--s0) 11px;
|
|
597
|
+
background: transparent;
|
|
598
|
+
font-size: var(--f-h6);
|
|
599
|
+
font-weight: var(--weight-semibold);
|
|
600
|
+
line-height: var(--lh-body);
|
|
601
|
+
letter-spacing: 0;
|
|
602
|
+
text-transform: none;
|
|
599
603
|
}
|
|
600
604
|
|
|
601
605
|
.velu-api-sidebar__list {
|
|
@@ -603,24 +607,51 @@
|
|
|
603
607
|
margin: 0;
|
|
604
608
|
padding: 0;
|
|
605
609
|
}
|
|
610
|
+
.velu-api-sidebar__list + .velu-api-sidebar__section {
|
|
611
|
+
margin-block-start: var(--s2);
|
|
612
|
+
}
|
|
606
613
|
|
|
607
|
-
/* Endpoint row — method pill + name.
|
|
608
|
-
pill stays on the first line when a long name wraps. */
|
|
614
|
+
/* Endpoint row — method pill + name. */
|
|
609
615
|
.velu-api-sidebar__item {
|
|
610
616
|
display: flex;
|
|
611
|
-
align-items:
|
|
612
|
-
gap:
|
|
613
|
-
|
|
617
|
+
align-items: center;
|
|
618
|
+
gap: 10px;
|
|
619
|
+
min-height: 36px;
|
|
620
|
+
padding: 6px var(--s0);
|
|
621
|
+
border-radius: 12px;
|
|
614
622
|
color: var(--text-color);
|
|
623
|
+
font-size: var(--f-body);
|
|
624
|
+
line-height: var(--lh-body);
|
|
615
625
|
text-decoration: none;
|
|
616
626
|
}
|
|
627
|
+
.velu-api-sidebar__item:hover {
|
|
628
|
+
background: var(--surface-color);
|
|
629
|
+
}
|
|
617
630
|
.velu-api-sidebar__item--active {
|
|
618
631
|
color: var(--accent-color);
|
|
619
|
-
|
|
632
|
+
font-weight: var(--weight-semibold);
|
|
633
|
+
background: rgb(from var(--accent-color) r g b / 10%);
|
|
634
|
+
}
|
|
635
|
+
.velu-api-sidebar__item--active .velu-method-badge {
|
|
636
|
+
color: #fff;
|
|
637
|
+
background: var(--method-cta);
|
|
620
638
|
}
|
|
621
639
|
.velu-api-sidebar__label {
|
|
622
|
-
font
|
|
623
|
-
|
|
640
|
+
font: inherit;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/* Compact method pill — colored label on the method tint, not a filled
|
|
644
|
+
badge. --method-* vars come from MethodBadge's per-method class. */
|
|
645
|
+
.velu-api-sidebar__item .velu-method-badge {
|
|
646
|
+
flex: none;
|
|
647
|
+
font-size: 9px;
|
|
648
|
+
line-height: 14px;
|
|
649
|
+
font-weight: var(--weight-bold);
|
|
650
|
+
padding: 0 4px;
|
|
651
|
+
border: 0;
|
|
652
|
+
border-radius: 5px;
|
|
653
|
+
color: var(--method-cta, var(--method-stroke, var(--muted-color)));
|
|
654
|
+
background: var(--method-pill, var(--surface-color));
|
|
624
655
|
}
|
|
625
656
|
|
|
626
657
|
.velu-api-sidebar__icon {
|