@veluai/velu 0.2.34 → 0.2.36
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/README.md +39 -0
- package/dist/cli.js +57 -49
- package/package.json +1 -1
- package/runtime/velu-ui/components/Accordion.jsx +3 -3
- package/runtime/velu-ui/components/ApiClient.jsx +4 -2
- package/runtime/velu-ui/components/ApiReferencePage.jsx +12 -12
- package/runtime/velu-ui/components/ApiSamples.jsx +2 -2
- package/runtime/velu-ui/components/AskBar.jsx +3 -2
- package/runtime/velu-ui/components/Callout.jsx +11 -26
- package/runtime/velu-ui/components/Card.jsx +9 -8
- package/runtime/velu-ui/components/ChangelogFilters.jsx +2 -1
- package/runtime/velu-ui/components/Chatbot.jsx +11 -5
- package/runtime/velu-ui/components/CodeBlock.jsx +7 -6
- package/runtime/velu-ui/components/Columns.jsx +1 -0
- package/runtime/velu-ui/components/ContextMenu.jsx +3 -2
- package/runtime/velu-ui/components/Field.jsx +2 -2
- package/runtime/velu-ui/components/Icon.jsx +1 -0
- package/runtime/velu-ui/components/Image.jsx +2 -2
- package/runtime/velu-ui/components/MethodBadge.jsx +2 -2
- package/runtime/velu-ui/components/NavSelect.jsx +22 -4
- package/runtime/velu-ui/components/NotFound.jsx +7 -7
- package/runtime/velu-ui/components/PageFeedback.jsx +13 -3
- package/runtime/velu-ui/components/PageHeader.jsx +25 -10
- package/runtime/velu-ui/components/PageNav.jsx +2 -1
- package/runtime/velu-ui/components/Prompt.jsx +2 -2
- package/runtime/velu-ui/components/Search.jsx +1 -0
- package/runtime/velu-ui/components/Sidebar.jsx +18 -6
- package/runtime/velu-ui/components/Steps.jsx +4 -4
- package/runtime/velu-ui/components/ThemeToggle.jsx +1 -0
- package/runtime/velu-ui/components/Toc.jsx +6 -4
- package/runtime/velu-ui/components/Tree.jsx +6 -5
- package/runtime/velu-ui/components/TryItBar.jsx +1 -0
- package/runtime/velu-ui/components/Update.jsx +2 -2
- package/runtime/velu-ui/components/callout.css +28 -0
- package/runtime/velu-ui/components/docs-layout.css +5 -0
- package/runtime/velu-ui/components/page-header.css +5 -0
- package/runtime/velu-ui/components/sidebar.css +5 -5
- package/runtime/velu-ui/element-selectors.css +66 -0
- package/runtime/velu-ui/primitives/Cluster.jsx +12 -0
- package/runtime/velu-ui/primitives/Stack.jsx +12 -0
- package/runtime/velu-ui/primitives/Switcher.jsx +11 -1
- package/runtime/velu-ui/styles.css +51 -35
- package/src/runtime/App.jsx +43 -11
- package/src/runtime/client-entry.jsx +23 -0
- package/src/runtime/dev-warnings.js +16 -0
- package/src/runtime/server-entry.jsx +1 -0
package/dist/cli.js
CHANGED
|
@@ -1,36 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`,"utf-8");let o=await
|
|
4
|
-
New velu version available: ${e} \u2192 ${t}. Updating\u2026`),!
|
|
5
|
-
`);let r=
|
|
6
|
-
`)}function ae(e){if(!e||typeof e!="object")return null;let t=[];if(e.socials&&typeof e.socials=="object")for(let[r,o]of Object.entries(e.socials))typeof o!="string"||!o.trim()||t.push({kind:pr[r]??r,href:o.trim()});let n=Array.isArray(e.links)?e.links.filter(r=>r&&typeof r=="object").map(r=>({title:(r.header??r.title??"").trim(),items:(Array.isArray(r.items)?r.items:[]).filter(o=>o&&o.label).map(o=>({label:o.label,href:o.href??"#"}))})).filter(r=>r.title||r.items.length):[];return!t.length&&!n.length?null:{socials:t,links:n}}function Ye(e){return/^(https?:)?\/\//.test(e)||/^(mailto|tel):/.test(e)}function le(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:Ye(o.href.trim())})),n=null,r=e.primary;if(r&&typeof r=="object"&&typeof r.href=="string"&&r.href.trim()){let o=r.href.trim();n=r.type==="github"?{kind:"github",label:r.label??"GitHub",href:o,external:Ye(o)}:{kind:"button",label:r.label??"",href:o,external:Ye(o)}}return!t.length&&!n?null:{links:t,primary:n}}function Ke(e){if(e==null)return{options:[...Nt],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",n=Array.isArray(e.options)?e.options:Nt,r=[];for(let o of n)typeof o=="string"?fr.has(o)&&r.push(o):o&&typeof o=="object"&&o.title&&o.href&&r.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:r,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 ce(e){if(!e||typeof e!="object")return null;let t=typeof e.apiBase=="string"&&e.apiBase.trim()?e.apiBase.trim().replace(/\/+$/,""):null,n=typeof e.host=="string"&&e.host.trim()?e.host.trim():null,r=Array.isArray(e.suggestions)?e.suggestions.filter(o=>typeof o=="string"&&o.trim()).map(o=>o.trim()).slice(0,6):[];return!t&&!r.length?null:{apiBase:t,host:n,suggestions:r}}var pr,fr,Nt,ke=A(()=>{pr={twitter:"x","x-twitter":"x"};fr=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),Nt=["copy","view","chatgpt","claude"]});import mr from"node:fs/promises";import Ze from"node:path";function Rt(e){if(!e.favicon)return null;let t=Ze.extname(e.favicon).toLowerCase();return{url:Qe+t,type:hr[t]||""}}function ue(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?.(),n=(e.dark??e.light)?.trim?.();return!t||!n?null:{light:t,dark:n,href:e.href?.trim?.()||"/"}}return null}function yr(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 et(e={},t){let n=e.colors?.primary??dr;return{name:e.name??t??"docs",url:typeof process.env.VELU_SITE_URL=="string"&&process.env.VELU_SITE_URL.trim()?process.env.VELU_SITE_URL.trim().replace(/\/+$/,""):null,seo:yr(e.seo),assistant:ce(e.assistant),thumbnails:e.thumbnails&&typeof e.thumbnails=="object"&&typeof e.thumbnails.background=="string"?{background:e.thumbnails.background}:null,colors:{primary:n,light:e.colors?.light??n,dark:e.colors?.dark??n},favicon:e.favicon??null,api:z(e.api),logo:ue(e.logo),footer:ae(e.footer),navbar:le(e.navbar),font:{family:e.font?.family??gr},navigation:e.navigation??null}}async function It(e){let t=Ze.join(e,"velu.json"),n;try{n=await mr.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 r;try{r=JSON.parse(n)}catch(o){throw new Error(`velu.json is not valid JSON: ${o.message}`)}return et(r,Ze.basename(e))}function Mt(e){let{colors:t,font:n}=e;return Xe({light:t.light,dark:t.dark,family:n.family})}var dr,gr,Ae,je,Qe,hr,pe=A(()=>{ke();ke();dr="#dc143c",gr="Google Sans Flex",Ae="/@velu-logo-light",je="/@velu-logo-dark",Qe="/@velu-favicon",hr={".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 zt}from"unist-util-visit";import{toString as vr}from"mdast-util-to-string";import br from"github-slugger";import{valueToEstree as xr}from"estree-util-value-to-estree";function $r(e){return`update-${String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"item"}`}function Bt(e,t){let n=(e.attributes||[]).find(r=>r&&r.type==="mdxJsxAttribute"&&r.name===t);if(n)return typeof n.value=="string"?n.value:void 0}function wr(e){let t=(e.attributes||[]).find(l=>l&&l.type==="mdxJsxAttribute"&&l.name==="tags");if(!t)return[];if(typeof t.value=="string")return[t.value];let n=t.value&&t.value.value?String(t.value.value):"",r=[],o=/["'`]([^"'`]+)["'`]/g,i;for(;i=o.exec(n);)r.push(i[1]);return r}function fe(){return e=>{let t=new br,n=[];zt(e,"heading",a=>{let p=vr(a);n.push({depth:a.depth,id:t.slug(p),label:p})});let r=[],o=[],i=new Set;if(zt(e,"mdxJsxFlowElement",a=>{if(a.name!=="Update")return;let p=Bt(a,"label")??Bt(a,"date");p&&r.push({id:$r(p),label:p});for(let c of wr(a)){let u=c.trim().toLowerCase();c.trim()&&!i.has(u)&&(i.add(u),o.push(c.trim()))}}),r.length){Vt(e,r),tt(e,"changelog",{tags:o});return}let l={children:[]},s=[{node:l,depth:0}];for(let a of n){for(;s.length>1&&s[s.length-1].depth>=a.depth;)s.pop();let p={id:a.id,label:a.label},c=s[s.length-1].node;c.children||(c.children=[]),c.children.push(p),s.push({node:p,depth:a.depth})}Vt(e,l.children),tt(e,"changelog",null)}}function Vt(e,t){tt(e,"toc",t)}function tt(e,t,n){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:xr(n)}]}}]}}})}var nt=A(()=>{});import{visit as Sr}from"unist-util-visit";function rt(){return e=>{Sr(e,"code",t=>{let n=(t.meta||"").trim();if(!n)return;let r={},o=n.match(/\btitle="([^"]*)"/);o&&(r["data-title"]=o[1],n=(n.slice(0,o.index)+n.slice(o.index+o[0].length)).trim());let i=n.match(/\{([\d,\s-]+)\}/);i&&(r["data-highlight"]=i[1].replace(/\s+/g,""),n=(n.slice(0,i.index)+n.slice(i.index+i[0].length)).trim()),n=n.replace(/\blineNumbers\b/,()=>(r["data-line-numbers"]="","")).trim(),n&&(r["data-filename"]=n),Object.keys(r).length&&(t.data=t.data||{},t.data.hProperties={...t.data.hProperties||{},...r})})}}var Gt=A(()=>{});import kr from"github-slugger";import Ar from"iso-639-1";function Tr(e){let t=String(e).toLowerCase();return Ar.getNativeName(t)||e}function Te(e){return new kr().slug(String(e??""))}function Lr(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function Jt(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 G(e){let t={kind:"root",children:me(e??{})};return qt(t.children),t}function me(e){let t=Array.isArray(e.anchors)?e.anchors.map(Cr):[];if(Array.isArray(e.products))return[...t,...e.products.map(Or)];if(Array.isArray(e.versions))return[...t,...e.versions.map(_r)];if(Array.isArray(e.languages))return[...t,...e.languages.map(Er)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(Pr)];let n=[...t];return Array.isArray(e.groups)&&n.push(...e.groups.map(Ht)),Array.isArray(e.pages)&&n.push(...e.pages.map(Dt)),n}function Or(e){return{kind:"product",label:e.name??e.product,slug:Te(e.product),icon:e.icon,color:e.color,default:!!e.default,children:me(e)}}function _r(e){return{kind:"version",label:e.version,slug:Te(e.version),default:!!e.default,children:me(e)}}function Er(e){let t=String(e.language);return{kind:"language",code:t,label:Tr(t),slug:Te(t),default:!!e.default,children:me(e)}}function Pr(e){return{kind:"tab",label:e.tab,slug:Te(e.tab),icon:e.icon,href:e.href,children:me(e)}}function Cr(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function Ht(e){let t=(e.pages??[]).map(Dt);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 Dt(e){return typeof e=="string"?{kind:"page",pagePath:e}:e&&e.apiPage?{kind:"page",pagePath:e.apiPage,label:e.label,method:e.method,api:!0}:Ht(e)}function qt(e){for(let t of jr){let n=e.filter(r=>r.kind===t);n.length&&!n.some(r=>r.default)&&(n[0].default=!0)}for(let t of e)t.children&&qt(t.children)}function ee(e){let t=[],n=(r,o,i)=>{if(r.kind==="page"){t.push({pagePath:r.pagePath,url:Ur(r.pagePath,o),ctx:{...o},ancestors:i,node:r});return}let l=o;r.kind==="product"?l={...o,product:r.default?null:r.slug}:r.kind==="version"?l={...o,version:r.default?null:r.slug}:r.kind==="language"&&(l={...o,language:r.default?null:r.slug});let s=r.kind==="root"?i:[...i,r];for(let a of r.children??[])n(a,l,s)};return n(e,{product:null,version:null,language:null},[]),t}function Ur(e,t){let n=[t.product,t.version,t.language].filter(Boolean),r=Lr(e).split("/").filter(Boolean);return"/"+[...n,...r].join("/")}var jr,H=A(()=>{jr=["product","version","language"]});import Fr from"node:fs";import Wt from"node:path";function J(e,t){let n=[],r=[],o=new Set;for(let i of ee(e)){if(i.node?.api){o.add(i.url);continue}if(o.has(i.url)){n.push(`duplicate URL "${i.url}" (page "${i.pagePath}") \u2014 keeping the first occurrence`);continue}o.add(i.url);let l=i.pagePath.replace(/^\/+|\/+$/g,""),s=Wt.join(t,...l.split("/"))+".mdx",a=Fr.existsSync(s);a||n.push(`page "${i.pagePath}" \u2192 ${Wt.relative(t,s)} not found`),r.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:a})}return{pageEntries:r,warnings:n}}var de=A(()=>{H()});function D(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,n)=>{let r=D(n);return{...t,...r,properties:{...t.properties||{},...r.properties||{}},required:[...t.required||[],...r.required||[]]}},{...e,allOf:void 0}):Array.isArray(e.oneOf)&&e.oneOf.length?D(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?D(e.anyOf[0]):e}function ge(e){let t=D(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`${ge(t.items||{})}[]`;let n=t.type||(t.properties?"object":"any");return t.format?`${n}<${t.format}>`:n}function te(e,t=0){let n=D(e);if(!n||typeof n!="object")return null;if(n.example!==void 0)return n.example;if(n.default!==void 0)return n.default;if(Array.isArray(n.enum)&&n.enum.length)return n.enum[0];if(t>=6)return n.type==="object"?{}:null;switch(n.type){case"object":{let r={};for(let[o,i]of Object.entries(n.properties||{}))r[o]=te(i,t+1);return r}case"array":return[te(n.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Rr(n)}}function Rr(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 ot(e){let t=D(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:ge(t),required:!1,description:t.description||""}]:[];let n=new Set(t.required||[]);return Object.entries(t.properties).map(([r,o])=>{let i=D(o);return{name:r,type:ge(i),required:n.has(r),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function Ir(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:ge(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:te(t),deprecated:e.deprecated||void 0}}function Xt(e){if(!e||typeof e!="object")return null;let t=Object.keys(e),n=t.find(r=>/json/i.test(r))||t[0];return n?{contentType:n,media:e[n]}:null}function Mr(e){if(!e)return null;let t=Xt(e.content);if(!t)return null;let n=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:ot(n),example:t.media.example??te(n)}}function zr(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>{let r=Xt(n?.content),o=r?.media?.schema||{};return{status:t,description:n?.description||"",contentType:r?.contentType||null,fields:r?ot(o):[],example:r?r.media.example??te(o):null}})}function Br(e,t){if(!Array.isArray(e)||!t)return[];let n=[],r=new Set;for(let o of e)for(let i of Object.keys(o||{})){let l=t[i];!l||r.has(i)||(r.add(i),n.push(Vr(i,l)))}return n.filter(Boolean)}function Vr(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 Yt(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Gr(e){let{method:t,path:n,op:r,sharedParams:o,servers:i,schemes:l}=e,s=[...o||[],...r.parameters||[]],a={path:[],query:[],header:[],cookie:[]};for(let c of s)c&&a[c.in]&&a[c.in].push(Ir(c));let p=r.security??e.globalSecurity;return{id:r.operationId?Yt(r.operationId):`${t}-${Yt(n)}`,method:t.toUpperCase(),path:n,title:r.summary||r.operationId||`${t.toUpperCase()} ${n}`,description:r.description||r.summary||"",tags:Array.isArray(r.tags)&&r.tags.length?r.tags:["API"],deprecated:r.deprecated||!1,auth:Br(p,l),parameters:a,body:Mr(r.requestBody),responses:zr(r.responses),servers:(i||[]).map(c=>c.url).filter(Boolean)}}function Jr(e,t,n,r,o,i,l){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 a=(r.servers||i||[]).filter(Boolean);a.length&&(s.servers=a);let p={};Array.isArray(o)&&o.length&&(p.parameters=o),p[n]=r,s.paths={[t]:p};let c=r.security??e.security;if(l&&Array.isArray(c)&&c.length){let u={};for(let y of c)for(let f of Object.keys(y||{}))l[f]&&(u[f]=l[f]);Object.keys(u).length&&(e.swagger?s.securityDefinitions=u:s.components={securitySchemes:u})}return s}function Kt(e){let t=[],n=[],r=e.components?.securitySchemes||e.securityDefinitions||{},o=e.security||[],i=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]);for(let[l,s]of Object.entries(e.paths||{})){if(!s||typeof s!="object")continue;let a=s.parameters||[],p=s.servers||i;for(let c of Nr){let u=s[c];!u||typeof u!="object"||(t.push(Gr({method:c,path:l,op:u,sharedParams:a,servers:u.servers||p,globalSecurity:o,schemes:r})),n.push(Jr(e,l,c,u,a,u.servers||p,r)))}}return{operations:t,segments:n}}function it(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:n,segments:r}=Kt(e);return{title:e.info?.title||"API Reference",version:e.info?.version||"",servers:t.map(o=>o.url).filter(Boolean),operations:n,segments:r}}var Nr,st=A(()=>{Nr=["get","post","put","patch","delete","options","head","trace"]});import Hr from"@apidevtools/swagger-parser";async function Dr(e){return Hr.dereference(e)}async function Zt(e){return it(await Dr(e))}var Qt=A(()=>{st();st()});function qr(e,{server:t}={}){let r=`${(t||e.servers?.[0]||"").replace(/\/+$/,"")}${e.path}`,o={};for(let l of e.auth||[])l.in==="header"&&(o[l.name]=l.prefix?`${l.prefix} <token>`:"<token>");for(let l of e.parameters?.header||[])o[l.name]||(o[l.name]=String(l.example??`<${l.type}>`));let i=!!e.body;return i&&(o["Content-Type"]=e.body.contentType||"application/json"),{method:e.method,url:r,headers:o,body:i?e.body.example??{}:null}}function Wr(e){let t=`curl --request ${e.method} \\
|
|
2
|
+
var ir=Object.defineProperty;var w=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ae=(e,t)=>{for(var n in t)ir(e,n,{get:t[n],enumerable:!0})};var Ft={};Ae(Ft,{initProject:()=>ur});import Q from"node:fs/promises";import ee from"node:path";import{fileURLToPath as ar}from"node:url";async function ur(e,t){try{if((await Q.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(s){if(s.code!=="ENOENT")throw s}await Q.mkdir(e,{recursive:!0}),await Q.cp(cr,e,{recursive:!0});let n=ee.join(e,"velu.json"),r=JSON.parse(await Q.readFile(n,"utf-8"));r.name=t,await Q.writeFile(n,JSON.stringify(r,null,2)+`
|
|
3
|
+
`,"utf-8");let o=await Ut(e);console.log(`[velu] created ${t}/`);for(let s of o)console.log(` ${s}`);console.log(""),console.log("Next steps:"),console.log(` cd ${t}`),console.log(" velu dev")}async function Ut(e,t=e,n=[]){let r=await Q.readdir(e,{withFileTypes:!0});for(let o of r){let s=ee.join(e,o.name);o.isDirectory()?await Ut(s,t,n):n.push(ee.relative(t,s).split(ee.sep).join("/"))}return n.sort()}var lr,cr,Rt=w(()=>{lr=ee.dirname(ar(import.meta.url)),cr=ee.resolve(lr,"..","templates","starter")});var Ze={};Ae(Ze,{currentVersion:()=>Xe,getLatestVersion:()=>Ke,isNewer:()=>Ye,maybeAutoUpdate:()=>kr,updateCommand:()=>wr});import{spawnSync as It}from"node:child_process";import{readFileSync as Mt,writeFileSync as pr,mkdirSync as fr}from"node:fs";import{fileURLToPath as mr}from"node:url";import{homedir as dr,tmpdir as gr}from"node:os";import We from"node:path";import B from"node:process";function Xe(){try{return JSON.parse(Mt(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function br(e,t){let n=s=>String(s).split("-")[0].split(".").map(a=>Number(a)||0),r=n(e),o=n(t);for(let s=0;s<3;s++){let a=(r[s]||0)-(o[s]||0);if(a!==0)return a<0?-1:1}return 0}function Ye(e,t){return!e||!t||t==="unknown"?!1:br(e,t)>0}function zt(){let e=We.join(dr()||gr(),".velu");return We.join(e,"update-check.json")}function Nt(){try{return JSON.parse(Mt(zt(),"utf8"))}catch{return null}}function xr(e){try{let t=zt();fr(We.dirname(t),{recursive:!0}),pr(t,JSON.stringify(e))}catch{}}async function $r(){let e=`${hr}/-/package/${je}/dist-tags`,t=new AbortController,n=setTimeout(()=>t.abort(),vr);try{let r=await fetch(e,{signal:t.signal,headers:{accept:"application/json"}});if(!r.ok)return null;let o=await r.json();return o&&typeof o.latest=="string"?o.latest:null}catch{return null}finally{clearTimeout(n)}}async function Ke({force:e=!1}={}){if(!e){let n=Nt();if(n?.latest&&Date.now()-(n.checkedAt||0)<yr)return n.latest}let t=await $r();return t?(xr({latest:t,checkedAt:Date.now()}),t):Nt()?.latest??null}function Bt(){let e=B.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=mr(import.meta.url).replace(/\\/g,"/")}catch{}return t.includes("/pnpm/")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")?"yarn":t.includes("/.bun/")?"bun":"npm"}function Sr(e){let t=`${je}@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 Vt(e){let[t,n]=Sr(e);return It(t,n,{stdio:"inherit",shell:B.platform==="win32"}).status===0}async function wr(){let e=Xe(),t=await Ke({force:!0});if(t&&!Ye(t,e)){console.log(`velu is already up to date (v${e}).`);return}let n=Bt();console.log(t?`Updating velu ${e} \u2192 ${t} (via ${n})\u2026`:`Could not reach the npm registry; installing ${je}@latest (via ${n}) anyway\u2026`),Vt(n)?console.log('\u2713 Updated. Run "velu version" to confirm.'):(console.error("Update failed. You can update manually with:"),console.error(` npm install -g ${je}@latest`),B.exitCode=1)}async function kr(){if(B.env.VELU_NO_UPDATE==="1"||B.env.VELU_UPDATED==="1"||!B.stdout.isTTY)return;let e=Xe();if(e==="unknown")return;let t=null;try{t=await Ke()}catch{return}if(!Ye(t,e))return;let n=Bt();if(console.log(`
|
|
4
|
+
New velu version available: ${e} \u2192 ${t}. Updating\u2026`),!Vt(n)){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
|
|
5
|
+
`);let r=It(B.execPath,B.argv.slice(1),{stdio:"inherit",env:{...B.env,VELU_UPDATED:"1"}});B.exit(r.status??0)}var je,hr,yr,vr,Qe=w(()=>{je="@veluai/velu",hr="https://registry.npmjs.org",yr=720*60*1e3,vr=3e3});function tt({light:e,dark:t,family:n}){return[":root:root {",` --accent-color: ${e};`,` --font-sans: "${n}", sans-serif;`,"}",':root:root[data-theme="dark"] {',` --accent-color: ${t};`,"}"].join(`
|
|
6
|
+
`)}function ce(e){if(!e||typeof e!="object")return null;let t=[];if(e.socials&&typeof e.socials=="object")for(let[r,o]of Object.entries(e.socials))typeof o!="string"||!o.trim()||t.push({kind:Ar[r]??r,href:o.trim()});let n=Array.isArray(e.links)?e.links.filter(r=>r&&typeof r=="object").map(r=>({title:(r.header??r.title??"").trim(),items:(Array.isArray(r.items)?r.items:[]).filter(o=>o&&o.label).map(o=>({label:o.label,href:o.href??"#"}))})).filter(r=>r.title||r.items.length):[];return!t.length&&!n.length?null:{socials:t,links:n}}function et(e){return/^(https?:)?\/\//.test(e)||/^(mailto|tel):/.test(e)}function ue(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:et(o.href.trim())})),n=null,r=e.primary;if(r&&typeof r=="object"&&typeof r.href=="string"&&r.href.trim()){let o=r.href.trim();n=r.type==="github"?{kind:"github",label:r.label??"GitHub",href:o,external:et(o)}:{kind:"button",label:r.label??"",href:o,external:et(o)}}return!t.length&&!n?null:{links:t,primary:n}}function nt(e){if(e==null)return{options:[...Gt],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",n=Array.isArray(e.options)?e.options:Gt,r=[];for(let o of n)typeof o=="string"?jr.has(o)&&r.push(o):o&&typeof o=="object"&&o.title&&o.href&&r.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:r,display:t}}function G(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,n=typeof e.host=="string"&&e.host.trim()?e.host.trim():null,r=Array.isArray(e.suggestions)?e.suggestions.filter(o=>typeof o=="string"&&o.trim()).map(o=>o.trim()).slice(0,6):[];return!t&&!r.length?null:{apiBase:t,host:n,suggestions:r}}var Ar,jr,Gt,Te=w(()=>{Ar={twitter:"x","x-twitter":"x"};jr=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),Gt=["copy","view","chatgpt","claude"]});import Tr from"node:fs/promises";import rt from"node:path";function Jt(e){if(!e.favicon)return null;let t=rt.extname(e.favicon).toLowerCase();return{url:ot+t,type:Or[t]||""}}function fe(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?.(),n=(e.dark??e.light)?.trim?.();return!t||!n?null:{light:t,dark:n,href:e.href?.trim?.()||"/"}}return null}function Cr(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 st(e={},t){let n=e.colors?.primary??Lr;return{name:e.name??t??"docs",url:typeof process.env.VELU_SITE_URL=="string"&&process.env.VELU_SITE_URL.trim()?process.env.VELU_SITE_URL.trim().replace(/\/+$/,""):null,seo:Cr(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:n,light:e.colors?.light??n,dark:e.colors?.dark??n},favicon:e.favicon??null,api:G(e.api),logo:fe(e.logo),footer:ce(e.footer),navbar:ue(e.navbar),font:{family:e.font?.family??_r},navigation:e.navigation??null}}async function Ht(e){let t=rt.join(e,"velu.json"),n;try{n=await Tr.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 r;try{r=JSON.parse(n)}catch(o){throw new Error(`velu.json is not valid JSON: ${o.message}`)}return st(r,rt.basename(e))}function qt(e){let{colors:t,font:n}=e;return tt({light:t.light,dark:t.dark,family:n.family})}var Lr,_r,Le,_e,ot,Or,me=w(()=>{Te();Te();Lr="#dc143c",_r="Google Sans Flex",Le="/@velu-logo-light",_e="/@velu-logo-dark",ot="/@velu-favicon",Or={".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 Dt}from"unist-util-visit";import{toString as Er}from"mdast-util-to-string";import Pr from"github-slugger";import{valueToEstree as Ur}from"estree-util-value-to-estree";function Fr(e){return`update-${String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"item"}`}function Wt(e,t){let n=(e.attributes||[]).find(r=>r&&r.type==="mdxJsxAttribute"&&r.name===t);if(n)return typeof n.value=="string"?n.value:void 0}function Rr(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 n=t.value&&t.value.value?String(t.value.value):"",r=[],o=/["'`]([^"'`]+)["'`]/g,s;for(;s=o.exec(n);)r.push(s[1]);return r}function de(){return e=>{let t=new Pr,n=[];Dt(e,"heading",l=>{let u=Er(l);n.push({depth:l.depth,id:t.slug(u),label:u})});let r=[],o=[],s=new Set;if(Dt(e,"mdxJsxFlowElement",l=>{if(l.name!=="Update")return;let u=Wt(l,"label")??Wt(l,"date");u&&r.push({id:Fr(u),label:u});for(let c of Rr(l)){let p=c.trim().toLowerCase();c.trim()&&!s.has(p)&&(s.add(p),o.push(c.trim()))}}),r.length){Xt(e,r),it(e,"changelog",{tags:o});return}let a={children:[]},i=[{node:a,depth:0}];for(let l of n){for(;i.length>1&&i[i.length-1].depth>=l.depth;)i.pop();let u={id:l.id,label:l.label},c=i[i.length-1].node;c.children||(c.children=[]),c.children.push(u),i.push({node:u,depth:l.depth})}Xt(e,a.children),it(e,"changelog",null)}}function Xt(e,t){it(e,"toc",t)}function it(e,t,n){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:Ur(n)}]}}]}}})}var at=w(()=>{});import{visit as Nr}from"unist-util-visit";function lt(){return e=>{Nr(e,"code",t=>{let n=(t.meta||"").trim();if(!n)return;let r={},o=n.match(/\btitle="([^"]*)"/);o&&(r["data-title"]=o[1],n=(n.slice(0,o.index)+n.slice(o.index+o[0].length)).trim());let s=n.match(/\{([\d,\s-]+)\}/);s&&(r["data-highlight"]=s[1].replace(/\s+/g,""),n=(n.slice(0,s.index)+n.slice(s.index+s[0].length)).trim()),n=n.replace(/\blineNumbers\b/,()=>(r["data-line-numbers"]="","")).trim(),n&&(r["data-filename"]=n),Object.keys(r).length&&(t.data=t.data||{},t.data.hProperties={...t.data.hProperties||{},...r})})}}var Yt=w(()=>{});import Ir from"github-slugger";import Mr from"iso-639-1";function Br(e){let t=String(e).toLowerCase();return Mr.getNativeName(t)||e}function Oe(e){return new Ir().slug(String(e??""))}function Vr(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function ct(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 H(e){let t={kind:"root",children:ge(e??{})};return Qt(t.children),t}function ge(e){let t=Array.isArray(e.anchors)?e.anchors.map(Dr):[];if(Array.isArray(e.products))return[...t,...e.products.map(Gr)];if(Array.isArray(e.versions))return[...t,...e.versions.map(Jr)];if(Array.isArray(e.languages))return[...t,...e.languages.map(Hr)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(qr)];let n=[...t];return Array.isArray(e.groups)&&n.push(...e.groups.map(Kt)),Array.isArray(e.pages)&&n.push(...e.pages.map(Zt)),n}function Gr(e){return{kind:"product",label:e.name??e.product,slug:Oe(e.product),icon:e.icon,color:e.color,default:!!e.default,children:ge(e)}}function Jr(e){return{kind:"version",label:e.version,slug:Oe(e.version),default:!!e.default,children:ge(e)}}function Hr(e){let t=String(e.language);return{kind:"language",code:t,label:Br(t),slug:Oe(t),default:!!e.default,children:ge(e)}}function qr(e){return{kind:"tab",label:e.tab,slug:Oe(e.tab),icon:e.icon,href:e.href,children:ge(e)}}function Dr(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function Kt(e){let t=(e.pages??[]).map(Zt);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 Zt(e){return typeof e=="string"?{kind:"page",pagePath:e}:e&&e.apiPage?{kind:"page",pagePath:e.apiPage,label:e.label,method:e.method,api:!0}:Kt(e)}function Qt(e){for(let t of zr){let n=e.filter(r=>r.kind===t);n.length&&!n.some(r=>r.default)&&(n[0].default=!0)}for(let t of e)t.children&&Qt(t.children)}function te(e){let t=[],n=(r,o,s)=>{if(r.kind==="page"){t.push({pagePath:r.pagePath,url:Wr(r.pagePath,o),ctx:{...o},ancestors:s,node:r});return}let a=o;r.kind==="product"?a={...o,product:r.default?null:r.slug}:r.kind==="version"?a={...o,version:r.default?null:r.slug}:r.kind==="language"&&(a={...o,language:r.default?null:r.slug});let i=r.kind==="root"?s:[...s,r];for(let l of r.children??[])n(l,a,i)};return n(e,{product:null,version:null,language:null},[]),t}function Wr(e,t){let n=[t.product,t.version,t.language].filter(Boolean),r=Vr(e).split("/").filter(Boolean);return"/"+[...n,...r].join("/")}var zr,D=w(()=>{zr=["product","version","language"]});import Xr from"node:fs";import en from"node:path";function q(e,t){let n=[],r=[],o=new Set;for(let s of te(e)){if(s.node?.api){o.add(s.url);continue}if(o.has(s.url)){n.push(`duplicate URL "${s.url}" (page "${s.pagePath}") \u2014 keeping the first occurrence`);continue}o.add(s.url);let a=s.pagePath.replace(/^\/+|\/+$/g,""),i=en.join(t,...a.split("/"))+".mdx",l=Xr.existsSync(i);l||n.push(`page "${s.pagePath}" \u2192 ${en.relative(t,i)} not found`),r.push({pagePath:s.pagePath,url:s.url,fileAbsPath:i,exists:l})}return{pageEntries:r,warnings:n}}var he=w(()=>{D()});function W(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,n)=>{let r=W(n);return{...t,...r,properties:{...t.properties||{},...r.properties||{}},required:[...t.required||[],...r.required||[]]}},{...e,allOf:void 0}):Array.isArray(e.oneOf)&&e.oneOf.length?W(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?W(e.anyOf[0]):e}function ye(e){let t=W(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`${ye(t.items||{})}[]`;let n=t.type||(t.properties?"object":"any");return t.format?`${n}<${t.format}>`:n}function ne(e,t=0){let n=W(e);if(!n||typeof n!="object")return null;if(n.example!==void 0)return n.example;if(n.default!==void 0)return n.default;if(Array.isArray(n.enum)&&n.enum.length)return n.enum[0];if(t>=6)return n.type==="object"?{}:null;switch(n.type){case"object":{let r={};for(let[o,s]of Object.entries(n.properties||{}))r[o]=ne(s,t+1);return r}case"array":return[ne(n.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Kr(n)}}function Kr(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 ut(e){let t=W(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:ye(t),required:!1,description:t.description||""}]:[];let n=new Set(t.required||[]);return Object.entries(t.properties).map(([r,o])=>{let s=W(o);return{name:r,type:ye(s),required:n.has(r),description:s.description||"",enum:Array.isArray(s.enum)?s.enum:void 0,deprecated:s.deprecated||void 0}})}function Zr(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:ye(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:ne(t),deprecated:e.deprecated||void 0}}function nn(e){if(!e||typeof e!="object")return null;let t=Object.keys(e),n=t.find(r=>/json/i.test(r))||t[0];return n?{contentType:n,media:e[n]}:null}function Qr(e){if(!e)return null;let t=nn(e.content);if(!t)return null;let n=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:ut(n),example:t.media.example??ne(n)}}function eo(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>{let r=nn(n?.content),o=r?.media?.schema||{};return{status:t,description:n?.description||"",contentType:r?.contentType||null,fields:r?ut(o):[],example:r?r.media.example??ne(o):null}})}function to(e,t){if(!Array.isArray(e)||!t)return[];let n=[],r=new Set;for(let o of e)for(let s of Object.keys(o||{})){let a=t[s];!a||r.has(s)||(r.add(s),n.push(no(s,a)))}return n.filter(Boolean)}function no(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 tn(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function ro(e){let{method:t,path:n,op:r,sharedParams:o,servers:s,schemes:a}=e,i=[...o||[],...r.parameters||[]],l={path:[],query:[],header:[],cookie:[]};for(let c of i)c&&l[c.in]&&l[c.in].push(Zr(c));let u=r.security??e.globalSecurity;return{id:r.operationId?tn(r.operationId):`${t}-${tn(n)}`,method:t.toUpperCase(),path:n,title:r.summary||r.operationId||`${t.toUpperCase()} ${n}`,description:r.description||r.summary||"",tags:Array.isArray(r.tags)&&r.tags.length?r.tags:["API"],deprecated:r.deprecated||!1,auth:to(u,a),parameters:l,body:Qr(r.requestBody),responses:eo(r.responses),servers:(s||[]).map(c=>c.url).filter(Boolean)}}function oo(e,t,n,r,o,s,a){let i={};e.openapi?i.openapi=e.openapi:e.swagger?i.swagger=e.swagger:i.openapi="3.0.0",i.info=e.info||{title:"API Reference",version:"1.0.0"};let l=(r.servers||s||[]).filter(Boolean);l.length&&(i.servers=l);let u={};Array.isArray(o)&&o.length&&(u.parameters=o),u[n]=r,i.paths={[t]:u};let c=r.security??e.security;if(a&&Array.isArray(c)&&c.length){let p={};for(let m of c)for(let d of Object.keys(m||{}))a[d]&&(p[d]=a[d]);Object.keys(p).length&&(e.swagger?i.securityDefinitions=p:i.components={securitySchemes:p})}return i}function rn(e){let t=[],n=[],r=e.components?.securitySchemes||e.securityDefinitions||{},o=e.security||[],s=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]);for(let[a,i]of Object.entries(e.paths||{})){if(!i||typeof i!="object")continue;let l=i.parameters||[],u=i.servers||s;for(let c of Yr){let p=i[c];!p||typeof p!="object"||(t.push(ro({method:c,path:a,op:p,sharedParams:l,servers:p.servers||u,globalSecurity:o,schemes:r})),n.push(oo(e,a,c,p,l,p.servers||u,r)))}}return{operations:t,segments:n}}function pt(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:n,segments:r}=rn(e);return{title:e.info?.title||"API Reference",version:e.info?.version||"",servers:t.map(o=>o.url).filter(Boolean),operations:n,segments:r}}var Yr,ft=w(()=>{Yr=["get","post","put","patch","delete","options","head","trace"]});import so from"@apidevtools/swagger-parser";async function io(e){return so.dereference(e)}async function on(e){return pt(await io(e))}var sn=w(()=>{ft();ft()});function ao(e,{server:t}={}){let r=`${(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 s=!!e.body;return s&&(o["Content-Type"]=e.body.contentType||"application/json"),{method:e.method,url:r,headers:o,body:s?e.body.example??{}:null}}function lo(e){let t=`curl --request ${e.method} \\
|
|
7
7
|
--url ${e.url}`;for(let[n,r]of Object.entries(e.headers))t+=` \\
|
|
8
8
|
--header '${n}: ${r}'`;return e.body!=null&&(t+=` \\
|
|
9
|
-
--data '${JSON.stringify(e.body)}'`),t}function
|
|
9
|
+
--data '${JSON.stringify(e.body)}'`),t}function co(e){let t=[` method: '${e.method}'`];if(Object.keys(e.headers).length){let n=Object.entries(e.headers).map(([r,o])=>` '${r}': '${o}'`).join(`,
|
|
10
10
|
`);t.push(` headers: {
|
|
11
11
|
${n}
|
|
12
|
-
}`)}return e.body!=null&&t.push(` body: JSON.stringify(${
|
|
12
|
+
}`)}return e.body!=null&&t.push(` body: JSON.stringify(${mt(e.body," ")})`),[`const res = await fetch('${e.url}', {`,t.join(`,
|
|
13
13
|
`),"});","const data = await res.json();"].join(`
|
|
14
|
-
`)}function
|
|
14
|
+
`)}function uo(e){let t=["import requests","",`url = "${e.url}"`];if(Object.keys(e.headers).length){let r=Object.entries(e.headers).map(([o,s])=>` "${o}": "${s}"`).join(`,
|
|
15
15
|
`);t.push(`headers = {
|
|
16
16
|
${r}
|
|
17
|
-
}`)}let n=["url"];return e.body!=null&&(t.push(`payload = ${
|
|
18
|
-
`)}function
|
|
19
|
-
`)}function
|
|
17
|
+
}`)}let n=["url"];return e.body!=null&&(t.push(`payload = ${mt(e.body,"")}`),n.push("json=payload")),Object.keys(e.headers).length&&n.push("headers=headers"),t.push("",`response = requests.${e.method.toLowerCase()}(${n.join(", ")})`,"print(response.json())"),t.join(`
|
|
18
|
+
`)}function po(e){let t=e.method.charAt(0)+e.method.slice(1).toLowerCase(),n=["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[r,o]of Object.entries(e.headers))n.push(`request['${r}'] = '${o}'`);return e.body!=null&&n.push(`request.body = ${mt(e.body,"")}.to_json`),n.push("","response = http.request(request)","puts response.body"),n.join(`
|
|
19
|
+
`)}function ln(e,{server:t,languages:n=dt}={}){let r=ao(e,{server:t});return n.filter(o=>an[o]).map(o=>({key:o,label:fo[o],language:mo[o],code:an[o](r)}))}var mt,an,fo,mo,dt,cn=w(()=>{mt=(e,t)=>JSON.stringify(e,null,2).split(`
|
|
20
20
|
`).map((n,r)=>r===0?n:t+n).join(`
|
|
21
|
-
`);
|
|
22
|
-
${
|
|
21
|
+
`);an={curl:lo,javascript:co,python:uo,ruby:po},fo={curl:"cURL",javascript:"JavaScript",python:"Python",ruby:"Ruby"},mo={curl:"bash",javascript:"javascript",python:"python",ruby:"ruby"},dt=["curl","javascript","python","ruby"]});function un(e,t){if(!t||typeof t!="object")return e;let n=G(t);return{server:t.server!=null?n.server:e?.server??null,proxy:t.playground!=null?n.proxy:e?.proxy!==!1,languages:t.examples?.languages!=null?n.languages:e?.languages}}function go(e,{base:t,api:n,ops:r}){let o=n?.server,s=n?.languages||dt,a={proxy:n?.proxy!==!1,server:o??null},i=new Map;for(let u of e){let c=u.op.tags?.[0]||"API";i.has(c)||i.set(c,[]),i.get(c).push(u)}let l=[];for(let[u,c]of i){let p=c.map(({op:m,segment:d})=>{let g=`${t}/${gt(u)}/${m.id}`;return r[g]={operation:m,samples:ln(m,{server:o||m.servers?.[0],languages:s}),segment:d,title:m.title,description:m.description,method:m.method,api:a},{apiPage:g,label:m.title,method:m.method}});l.push({group:u,pages:p})}return l}async function pn(e,{loadOps:t,base:n,api:r,ops:o}){let s=Array.isArray(e)?e:[e],a=[];for(let i of s){let{operations:l,segments:u,servers:c}=await t(i);l.forEach((p,m)=>{!p.servers?.length&&c?.length&&(p.servers=c),a.push({op:p,segment:u[m]})})}return go(a,{base:n,api:r,ops:o})}async function fn(e,t){if(!e||typeof e!="object")return e;if(typeof e.tab=="string"&&e.openapi){let r=gt(e.tab),o=un(t.api,e.api),s=await pn(e.openapi,{...t,base:r,api:o}),{openapi:a,api:i,...l}=e;return{...l,groups:[...l.groups||[],...s]}}if(typeof e.group=="string"&&e.openapi){let r=gt(e.group),o=un(t.api,e.api),s=await pn(e.openapi,{...t,base:r,api:o}),{openapi:a,api:i,...l}=e,u=s.flatMap(c=>c.pages);return{...l,pages:[...l.pages||[],...u]}}let n={...e};for(let r of["products","versions","languages","tabs","groups"])Array.isArray(e[r])&&(n[r]=await Promise.all(e[r].map(o=>fn(o,t))));return n}async function mn(e,{api:t,loadOps:n}){let r={};return!e||typeof e!="object"?{nav:e,ops:r}:{nav:await fn(e,{api:t,loadOps:n,ops:r}),ops:r}}var gt,dn=w(()=>{Te();cn();gt=e=>String(e??"").replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()||"x"});import ho from"node:path";function yo(e,t){return/^https?:\/\//.test(e)?e:ho.resolve(t,e.replace(/^\/+/,""))}async function Ce(e,{targetDir:t,api:n}={}){return mn(e,{api:n,loadOps:r=>on(yo(r,t))})}var ht=w(()=>{sn();dn()});import hn from"node:fs";import re from"node:path";import{createHash as vo}from"node:crypto";function ve(e,{outDir:t}={}){let n=re.resolve(e),r=t?re.resolve(t):null,o=[],s=[],a=l=>{let u;try{u=hn.readdirSync(l,{withFileTypes:!0})}catch{return}for(let c of u){let p=re.join(l,c.name);if(c.isDirectory()){if(c.name.startsWith(".")||xo.has(c.name)||r&&p===r)continue;a(p);continue}if(!c.isFile())continue;let m=re.extname(c.name).toLowerCase();if(m!==gn&&m!==bo)continue;let d=re.relative(n,p).split(re.sep).join("/"),g={rel:d,abs:p,url:`${Ee}/${d.split("/").map(encodeURIComponent).join("/")}?v=${$o(p)}`,kind:m===gn?"css":"js"};(g.kind==="css"?o:s).push(g)}};a(n);let i=(l,u)=>l.rel<u.rel?-1:l.rel>u.rel?1:0;return o.sort(i),s.sort(i),{styles:o,scripts:s}}function $o(e){try{return vo("sha1").update(hn.readFileSync(e)).digest("hex").slice(0,8)}catch{return"0"}}function yn(e,t){let n=`${Ee}/`;if(!t.startsWith(n))return null;let r;try{r=decodeURIComponent(t.slice(n.length))}catch{return null}return[...e.styles,...e.scripts].find(o=>o.rel===r)??null}function vn(e,t=""){return(e?.styles??[]).map(n=>`<link rel="stylesheet" href="${So(t+n.url)}" data-velu-custom />`).join(`
|
|
22
|
+
`)}var Ee,gn,bo,xo,So,yt=w(()=>{Ee="/@velu-custom",gn=".css",bo=".js",xo=new Set(["node_modules","public","dist"]);So=e=>String(e).replace(/&/g,"&").replace(/"/g,""")});import wo from"node:fs";import be from"node:path";function $n(e,{buildOutDir:t}={}){return{name:"velu-site",resolveId(n){return n===xn?bn:null},async load(n){return n!==bn?null:ko(e,{buildOutDir:t})}}}async function ko(e,{buildOutDir:t}={}){let n={};try{n=JSON.parse(wo.readFileSync(be.join(e,"velu.json"),"utf-8"))}catch{}let r=G(n.api),o=n.navigation??{},s={};try{let $=await Ce(n.navigation??{},{targetDir:e,api:r});o=$.nav,s=$.ops}catch($){console.warn(`[velu] openapi: ${$.message}`)}let a=H(o),{pageEntries:i,warnings:l}=q(a,e);for(let $ of l)console.warn(`[velu] nav: ${$}`);let u=fe(n.logo),c={name:n.name??be.basename(e),logo:u?{light:Le,dark:_e,href:u.href,mono:u.light===u.dark}:null,footer:ce(n.footer),navbar:ue(n.navbar),contextual:nt(n.contextual),assistant:pe(n.assistant),customScripts:ve(e,{outDir:t}).scripts.map($=>$.url)},p=[],m=[],d=0;for(let $ of i){if(!$.exists)continue;let E=JSON.stringify($.fileAbsPath.split(be.sep).join("/")),V=JSON.stringify(be.relative(e,$.fileAbsPath).split(be.sep).join("/")),C=`__p${d++}`;p.push(`import * as ${C} from ${E};`),m.push(` ${JSON.stringify($.url)}: { Component: ${C}.default, frontmatter: ${C}.frontmatter, toc: ${C}.toc, changelog: ${C}.changelog, relPath: ${V} },`)}let g=new Set(i.filter($=>$.exists).map($=>$.url));for(let $ of i)!$.exists&&!g.has($.url)&&m.push(` ${JSON.stringify($.url)}: { missing: true },`);let v=[],T=[],y=[],j=!1,N=0;for(let $ of te(a)){if(!$.node?.api)continue;let E=s[$.pagePath];if(!E)continue;j=!0;let V=`__op${N}`,C=`__samples${N}`,qe=`__api${N}`;N+=1,v.push(`const ${V} = ${JSON.stringify(E.operation)};`),v.push(`const ${C} = ${JSON.stringify(E.samples)};`),y.push(`{ id: ${JSON.stringify(E.operation.id)}, method: ${JSON.stringify(E.operation.method)}, title: ${JSON.stringify(E.operation.title)}, url: ${JSON.stringify($.url)}, operation: ${V}, samples: ${C}, api: ${JSON.stringify(E.api||{proxy:!0,server:null})} }`),T.push(`function ${qe}(){ return React.createElement(ApiReferencePage, { operation: ${V}, samples: ${C}, apiOperations: __apiOperations, api: ${JSON.stringify(E.api||{proxy:!0,server:null})} }); }`),m.push(` ${JSON.stringify($.url)}: { Component: ${qe}, frontmatter: { title: ${JSON.stringify(E.title)}, description: ${JSON.stringify(E.description)} }, toc: [], operation: ${V}, samples: ${C}, api: true },`)}j&&(v.push(`const __apiOperations = [
|
|
23
|
+
${y.join(`,
|
|
23
24
|
`)}
|
|
24
|
-
];`),
|
|
25
|
-
`)));let
|
|
26
|
-
`),
|
|
27
|
-
`),
|
|
28
|
-
`),"","export const pages = {",
|
|
29
|
-
`),"};",`export const navigation = ${JSON.stringify(
|
|
30
|
-
`)}var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
];`),v.push(T.join(`
|
|
26
|
+
`)));let A=[];return j&&(A.push("import React from 'react';"),A.push("import { ApiReferencePage } from 'velu-ui';")),["// AUTO-GENERATED by vite-plugin-velu-site. Do not edit.",A.join(`
|
|
27
|
+
`),p.join(`
|
|
28
|
+
`),v.join(`
|
|
29
|
+
`),"","export const pages = {",m.join(`
|
|
30
|
+
`),"};",`export const navigation = ${JSON.stringify(a)};`,`export const site = ${JSON.stringify(c)};`,"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(`
|
|
31
|
+
`)}var xn,bn,Sn=w(()=>{D();he();me();ht();yt();xn="virtual:velu-site",bn="\0"+xn});import Pe from"node:path";function wn(e){let t=Pe.resolve(e);return{name:"velu-tailwind-project-source",enforce:"pre",transform(n,r){let o=r.split("?",1)[0].replace(/\\/g,"/");if(!o.endsWith("/styles.css")||!o.includes("/velu-ui/")||n.includes("data-velu-project-source"))return null;let s=Pe.dirname(r.split("?",1)[0]),a=Pe.relative(s,t).split(Pe.sep).join("/");!a||a===""?a=".":a.startsWith(".")||(a=`./${a}`);let i=`
|
|
32
|
+
/* data-velu-project-source */
|
|
33
|
+
@source "${a}/**/*.{mdx,md,jsx,tsx,js,ts,html}";
|
|
34
|
+
@source not "${a}/node_modules";
|
|
35
|
+
@source not "${a}/.velu";
|
|
36
|
+
@source not "${a}/dist";
|
|
37
|
+
@source not "${a}/.git";
|
|
38
|
+
`;return{code:n+i,map:null}}}}var kn=w(()=>{});import{visit as Ao}from"unist-util-visit";function jo(e,t){let n=An(e).replace(/[?#].*$/,""),r=An(t).replace(/\/+$/,"");return r&&n.toLowerCase().startsWith(r.toLowerCase())?n.slice(r.length).replace(/^\/+/,""):null}function jn(e,t){return()=>(n,r)=>{typeof e=="function"&&Ao(n,o=>{if(o.type!=="mdxJsxFlowElement"&&o.type!=="mdxJsxTextElement"||typeof o.name!="string"||!/^[A-Z]/.test(o.name)||o.name.includes("."))return;let s={};for(let i of o.attributes||[])i.type==="mdxJsxAttribute"&&(i.value==null?s[i.name]=!0:typeof i.value=="string"&&(s[i.name]=i.value));let a=e(o.name,s,{checkRequired:!1});if(a){let i=new Error(a.title);throw i.veluIssue={...a,file:jo(r?.path,t),line:o.position?.start?.line??null,column:o.position?.start?.column??null},i.loc={line:i.veluIssue.line,column:i.veluIssue.column},i}})}}var An,Tn=w(()=>{An=e=>String(e||"").replace(/\\/g,"/")});import Ue from"node:path";import To from"node:fs";import{createRequire as Lo}from"node:module";import _o from"@tailwindcss/vite";import Oo from"@vitejs/plugin-react";import Co from"@mdx-js/rollup";import Eo from"remark-frontmatter";import Po from"remark-mdx-frontmatter";import Uo from"remark-gfm";import Fo from"rehype-slug";function Ro(e){let n=Lo(import.meta.url).resolve("@mdx-js/react"),r=Ue.resolve(e,"runtime","velu-ui"),o=To.existsSync(r)?r:Ue.resolve(e,"..","velu-ui","src");return[{find:"@mdx-js/react",replacement:n},{find:/^velu-ui$/,replacement:Ue.join(o,"index.js")},{find:/^velu-ui\//,replacement:o+"/"}]}function Ln({targetDir:e,VITE_ROOT:t,validateProps:n,basePath:r,buildOutDir:o}){return{root:t,base:r?`${r}/`:"/",plugins:[$n(e,{buildOutDir:o}),Co({remarkPlugins:[Eo,Po,Uo,lt,de,jn(n,e)],rehypePlugins:[Fo],providerImportSource:"@mdx-js/react"}),Oo(),wn(e),_o({optimize:!1})],cacheDir:Ue.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:Ro(t),dedupe:["react","react-dom","@mdx-js/react"]}}}var _n=w(()=>{at();Yt();Sn();kn();Tn()});function _(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 No(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 n=Array.from({length:t.length+1},(o,s)=>s),r=new Array(t.length+1);for(let o=1;o<=e.length;o++){r[0]=o;for(let s=1;s<=t.length;s++){let a=e[o-1]===t[s-1]?0:1;r[s]=Math.min(r[s-1]+1,n[s]+1,n[s-1]+a)}[n,r]=[r,n]}return n[t.length]}function Fe(e,t=[]){if(!e)return null;let n=String(e).toLowerCase(),r=null,o=1/0;for(let a of t){let i=No(n,String(a).toLowerCase());i<o&&(o=i,r=a)}let s=Math.min(3,Math.max(2,Math.floor(n.length/4)));return o<=s?r:null}function Io(e,t){return e==="warning"?M(t,R.yellow,"\u26A0"):e==="info"?M(t,R.cyan,"\u2139"):M(t,R.red,"\u2716")}function bt(e,{color:t=!1}={}){let n=vt[e.category]||e.category,r=e.line?`${e.line}${e.column?`:${e.column}`:""}`:"",o=e.file?`${e.file}${r?`:${r}`:""}`:r,s=[];if(s.push(`${Io(e.severity,t)} ${M(t,R.bold,n)}`+(o?` ${M(t,R.dim,o)}`:"")),e.title&&s.push(` ${e.title}`),e.detail&&e.detail!==e.title&&s.push(` ${M(t,R.dim,e.detail)}`),e.frame)for(let a of String(e.frame).split(`
|
|
39
|
+
`))s.push(` ${a}`);return e.suggestion&&s.push(` ${M(t,R.cyan,`Did you mean <${e.suggestion}>?`)}`),e.hint&&s.push(` ${M(t,R.dim,`\u2192 ${e.hint}`)}`),s.join(`
|
|
40
|
+
`)}function Re(e,{color:t=!1}={}){if(!e.length)return M(t,R.cyan,"\u2713 No issues found.");let n=new Map;for(let i of e){let l=i.file||"velu.json";n.has(l)||n.set(l,[]),n.get(l).push(i)}let r=[];for(let[i,l]of n){r.push(M(t,R.bold,i));for(let u of l)r.push(bt({...u,file:null},{color:t}).replace(/^/gm," "));r.push("")}let o=e.filter(i=>i.severity!=="warning"&&i.severity!=="info").length,s=e.length-o,a=`${o} error${o===1?"":"s"}`+(s?`, ${s} warning${s===1?"":"s"}`:"");return r.push(M(t,o?R.red:R.yellow,a)),r.join(`
|
|
41
|
+
`)}var vt,R,M,X=w(()=>{vt={"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"};R={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},M=(e,t,n)=>e?`${t}${n}${R.reset}`:n});function Mo(e){let t=e,n=0;for(;t&&t.cause&&n<3&&!(t.loc||t.line||/`[^`]+` to be defined/.test(t.message||""));)t=t.cause,n+=1;return t||e}function xt(e,t){if(!e)return null;let n=On(e).replace(/[?#].*$/,""),r=t?On(t).replace(/\/+$/,""):"";return r&&n.toLowerCase().startsWith(r.toLowerCase())?n.slice(r.length).replace(/^\/+/,""):!/^([a-zA-Z]:\/|\/)/.test(n)&&!/node_modules/.test(n)?n:null}function zo(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 Bo(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function Vo(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function Jo(e,t){if(!e||!t)return null;let n=String(e);return/node_modules|[\\/]vite[\\/]|@veluai[\\/]/.test(n)?null:n}function xe(e,t={}){let{projectDir:n="",knownComponents:r=[],file:o=null}=t,s=null;for(let y=e,j=0;y&&j<6;y=y.cause,j+=1)if(y.veluIssue){s=y.veluIssue;break}if(s)return _({...s,file:s.file||o});let a=Mo(e)||{},i=a.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(i);if(l){let y=l[1],j=/referenced in your code at `(\d+):(\d+)/.exec(i),N=/\bin `([^`]+)`/.exec(i),A=N?xt(N[1],n):null;return _({category:"unknown-component",file:A||o,line:j?Number(j[1]):null,column:j?Number(j[2]):null,title:`<${y}> is not a built-in component`,detail:"",hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:Fe(y,r)})}let u=a.loc||(a.line!=null?{line:a.line,column:a.column,file:a.file}:null)||Bo(a.reason||i),c=a.id||u&&u.file||a.file||null,p=xt(c,n)||o,m=!!p&&xt(c,n)!=null,d=Jo(a.frame,m||!!o),g=zo(Vo(a.reason||i)),v=Go.test(i),T=a.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(i)||u&&u.line===1&&/unexpected|expected/i.test(i)&&/---/.test(i);return u||v||d&&m?_({category:T?"frontmatter":"mdx-syntax",file:p,line:u?u.line:null,column:u?u.column:null,frame:d,title:g||(T?"Invalid frontmatter":"MDX syntax error"),detail:"",hint:T?"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(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."}):_({category:"render-crash",file:p,title:"This page failed to render",detail:g,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var On,Go,$t=w(()=>{X();On=e=>String(e).replace(/\\/g,"/");Go=/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 Ho(e){let t=vt[e.category]||e.category,n=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",r=[];return r.push('<div class="velu-err-card">'),r.push('<div class="velu-err-head">'),r.push(`<span class="velu-err-pill">${J(t)}</span>`),r.push("</div>"),e.title&&r.push(`<div class="velu-err-title">${J(e.title)}</div>`),n&&r.push(`<a class="velu-err-loc" title="${J(n)}">${J(n)}</a>`),e.detail&&r.push(`<div class="velu-err-detail">${J(e.detail)}</div>`),e.frame&&r.push(`<pre class="velu-err-frame">${J(e.frame)}</pre>`),e.suggestion&&r.push(`<div class="velu-err-suggest">Did you mean <code><${J(e.suggestion)}></code>?</div>`),e.hint&&r.push(`<div class="velu-err-hint">${J(e.hint)}</div>`),r.push("</div>"),r.join("")}function St(e,t={}){let n=Array.isArray(e)?e:[e],r=t.title||(n.length>1?`${n.length} problems to fix`:"There\u2019s a problem to fix"),o=n.map(Ho).join(`
|
|
34
42
|
`);return`<!doctype html>
|
|
35
43
|
<html lang="en">
|
|
36
44
|
<head>
|
|
@@ -97,43 +105,43 @@ ${_.join(`,
|
|
|
97
105
|
<body>
|
|
98
106
|
<div class="velu-err-wrap">
|
|
99
107
|
<div class="velu-err-brand">velu</div>
|
|
100
|
-
<h1 class="velu-err-h">${
|
|
108
|
+
<h1 class="velu-err-h">${J(r)}</h1>
|
|
101
109
|
${o}
|
|
102
110
|
<div class="velu-err-foot">Fix the file and save \u2014 this page reloads automatically.</div>
|
|
103
111
|
</div>
|
|
104
112
|
</body>
|
|
105
|
-
</html>`}var
|
|
106
|
-
`).length}function
|
|
107
|
-
`).length}function
|
|
108
|
-
`).length}function
|
|
109
|
-
${e}`;let n=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),r=`> ${
|
|
113
|
+
</html>`}var J,Cn=w(()=>{X();J=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")});var Y,wt=w(()=>{Y=["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 Ne from"node:fs";import Se from"node:path";import{fileURLToPath as qo}from"node:url";import Do from"iso-639-1";function $e(e,t){if(!t)return null;let n=e.indexOf(`"${t}"`);return n===-1?null:e.slice(0,n).split(`
|
|
114
|
+
`).length}function Yo(e,t){return t==null||t<0?null:e.slice(0,t).split(`
|
|
115
|
+
`).length}function kt(e,t){if(!t)return null;let n=e.indexOf(`"${t}"`);return n===-1?null:e.slice(0,n).split(`
|
|
116
|
+
`).length}function Ko(e,t,n){let r=[];return i(e,t,"",null),r;function o(l){if(l&&l.$ref){let u=l.$ref.replace(/^#\//,"").split("/"),c=n;for(let p of u)c=c?.[p];return c||{}}return l}function s(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function a(l,u){let c=r.length;i(l,u,"",null,!0);let p=r.length===c;return p||(r.length=c),p}function i(l,u,c,p,m){let d=o(u);if(d){if(d.oneOf){d.oneOf.some(v=>a(l,v))||r.push({path:c,key:p,message:"value does not match any allowed shape"});return}if(d.type&&s(l)!==d.type){r.push({path:c,key:p,message:`expected ${d.type}, got ${s(l)}`});return}if(d.type==="string"&&d.minLength!=null&&l.length<d.minLength&&r.push({path:c,key:p,message:"must not be empty"}),d.type==="object"&&s(l)==="object"){for(let v of d.required||[])v in l||r.push({path:c?`${c}.${v}`:v,key:v,message:`missing required "${v}"`});let g=d.properties||{};if(d.additionalProperties===!1)for(let v of Object.keys(l))v in g||r.push({path:c?`${c}.${v}`:v,key:v,message:`unknown field "${v}"`});for(let[v,T]of Object.entries(g))v in l&&i(l[v],T,c?`${c}.${v}`:v,v,m)}d.type==="array"&&Array.isArray(l)&&d.items&&l.forEach((g,v)=>i(g,d.items,`${c}[${v}]`,p,m))}}}function Zo(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 Ie(e){let t=[],n=Se.join(e,"velu.json"),r;try{r=Ne.readFileSync(n,"utf-8")}catch(i){return i.code==="ENOENT"?t.push(_({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(_({category:"config-json",file:"velu.json",title:"Could not read velu.json"})),t}let o;try{o=JSON.parse(r)}catch(i){let l=/position (\d+)/.exec(i.message||""),u=l?Yo(r,Number(l[1])):null;return t.push(_({category:"config-json",file:"velu.json",line:u,title:"velu.json is not valid JSON",detail:String(i.message||"").replace(/\s+in JSON.*$/,""),hint:"Check for a trailing comma, a missing quote, or an unclosed brace."})),t}let s=null;try{s=JSON.parse(Ne.readFileSync(Xo,"utf-8"))}catch{}if(s)for(let i of Ko(o,s,s)){let l=/^unknown field/.test(i.message);t.push(_({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:$e(r,i.key),title:i.path?`${i.path}: ${i.message}`:i.message,hint:l?"Remove it, or check the spelling against the velu.json schema.":""}))}for(let i of["primary","light","dark"]){let l=o.colors?.[i];l!=null&&!Zo(l)&&t.push(_({category:"config-schema",severity:"warning",file:"velu.json",line:$e(r,i),title:`colors.${i}: "${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 i=Se.resolve(e,o.favicon.replace(/^\/+/,""));Ne.existsSync(i)||t.push(_({category:"config-asset",file:"velu.json",line:$e(r,"favicon"),title:`favicon not found: ${o.favicon}`,hint:"The path is relative to the project root."}))}let a=fe(o.logo);if(a){let i=new Map;for(let l of["light","dark"]){let u=a[l];u&&i.set(u,[...i.get(u)||[],l])}for(let[l,u]of i)if(!Ne.existsSync(Se.resolve(e,l.replace(/^\/+/,"")))){let c=u.length===2?"logo":`logo (${u[0]})`;t.push(_({category:"config-asset",file:"velu.json",line:kt(r,l),title:`${c} not found: ${l}`,hint:"The path is relative to the project root."}))}}if(o.navigation&&typeof o.navigation=="object"){let i;try{i=H(o.navigation)}catch(l){t.push(_({category:"config-nav",file:"velu.json",line:$e(r,"navigation"),title:"navigation could not be processed",detail:String(l.message||"")})),i=null}if(i){let{pageEntries:l,warnings:u}=q(i,e);for(let c of u){let p=/not found$/.test(c),m=/page "([^"]+)"/.exec(c),d=m?kt(r,m[1]):null;t.push(_({category:"config-nav",severity:p?"error":"warning",file:"velu.json",line:d,title:c,hint:p?"Create the .mdx file, or remove the page from navigation.":""}))}Qo(i,r,t)}}return t}function Qo(e,t,n){let r=new Set,o=s=>{if(!(!s||typeof s!="object")){if(s.language&&!r.has(s.language)){r.add(s.language);let a=String(s.language).toLowerCase();Do.validate(a)||n.push(_({category:"config-nav",severity:"warning",file:"velu.json",line:kt(t,s.language)||$e(t,"language"),title:`"${s.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(s))Array.isArray(a)?a.forEach(o):a&&typeof a=="object"&&o(a)}};o(e)}var Wo,Xo,At=w(()=>{X();D();he();me();Wo=Se.dirname(qo(import.meta.url)),Xo=Se.resolve(Wo,"..","..","schema","velu.schema.json")});import es from"node:fs/promises";import ts from"node:fs";import K from"node:path";import{fileURLToPath as ns,pathToFileURL as rs}from"node:url";import{compile as os}from"@mdx-js/mdx";import ss from"remark-frontmatter";import is from"remark-mdx-frontmatter";import as from"remark-gfm";import ls from"rehype-slug";import{visit as cs}from"unist-util-visit";function jt(){if(Me)return Me;let e=K.dirname(ns(import.meta.url)),t=[K.resolve(e,"..","runtime","velu-ui"),K.resolve(e,"..","..","runtime","velu-ui"),K.resolve(e,"..","..","..","velu-ui","src")],n=null;for(let r of t){let o=K.join(r,"lib","component-schemas.js");if(ts.existsSync(o)){n=o;break}}return Me=n?import(rs(n).href).then(r=>r.validateProps).catch(()=>null):Promise.resolve(null),Me}function us(e){let t={};for(let n of e.attributes||[])n.type==="mdxJsxAttribute"&&(n.value==null?t[n.name]=!0:typeof n.value=="string"&&(t[n.name]=n.value));return t}function ps(e,t){return()=>n=>{cs(n,r=>{if((r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")&&typeof r.name=="string"&&/^[A-Z]/.test(r.name)&&!r.name.includes(".")&&e.push({name:r.name,props:us(r),line:r.position?.start?.line??null,column:r.position?.start?.column??null}),r.type==="mdxjsEsm"&&typeof r.value=="string")for(let o of r.value.matchAll(/\b([A-Z][A-Za-z0-9_]*)\b/g))t.add(o[1])})}}async function fs(e,t){let n=[],r;try{r=await es.readFile(t.fileAbsPath,"utf-8")}catch{return n}let o=K.relative(e,t.fileAbsPath).split(K.sep).join("/"),s=[],a=new Set;try{await os({value:r,path:t.fileAbsPath},{remarkPlugins:[ss,is,as,de,ps(s,a)],rehypePlugins:[ls],providerImportSource:"@mdx-js/react"})}catch(c){return n.push(xe(c,{projectDir:e,knownComponents:Y,file:o})),n}let i=new Set(Y),l=await jt(),u=new Set;for(let c of s)if(!a.has(c.name)){if(!i.has(c.name)){if(u.has(c.name))continue;u.add(c.name),n.push(_({category:"unknown-component",file:o,line:c.line,column:c.column,title:`<${c.name}> is not a built-in component`,hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:Fe(c.name,Y)}));continue}if(l){let p=l(c.name,c.props,{checkRequired:!1});p&&n.push(_({...p,file:o,line:c.line,column:c.column}))}}return n}async function En(e,t){let n=t.filter(i=>i.exists),r=[],o=8,s=0;async function a(){for(;s<n.length;){let i=n[s++],l=await fs(e,i);for(let u of l)r.push(u)}}return await Promise.all(Array.from({length:Math.min(o,n.length)},a)),r}var Me,Tt=w(()=>{at();X();$t();wt()});import we from"node:fs";import Lt from"node:path";import Fn from"js-yaml";function _t(e,t,n){if(n>24||e===null||typeof e!="object")return n>24&&e&&typeof e=="object"?null:e;if(t.has(e))return null;t.add(e);let r;if(Array.isArray(e))r=e.map(o=>_t(o,t,n+1));else{r={};for(let[o,s]of Object.entries(e))r[o]=_t(s,t,n+1)}return t.delete(e),r}function Rn(e){return Fn.dump(_t(e,new Set,0),{noRefs:!0,lineWidth:100,skipInvalid:!0})}function Nn(e){let t=String(e).replace(/\.md$/i,"");return t===""||t==="/"||t==="/index"?"/":t.replace(/\/+$/,"")||"/"}function ms(e){return e==="/"?"/index.md":`${e}.md`}function Ot(e,t){if(t==="api")return`# ${Pn}
|
|
117
|
+
${e}`;let n=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),r=`> ${Pn}
|
|
110
118
|
|
|
111
|
-
`;return n?e.slice(0,n[0].length)+r+e.slice(n[0].length):r+e}function
|
|
112
|
-
`)}async function
|
|
119
|
+
`;return n?e.slice(0,n[0].length)+r+e.slice(n[0].length):r+e}function gs(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function hs(e){try{let t=we.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let n=Fn.load(t[1]);return n&&typeof n=="object"?n:{}}catch{return{}}}async function ie(e){let t={};try{t=JSON.parse(we.readFileSync(Lt.join(e,"velu.json"),"utf-8"))}catch{return{name:Lt.basename(e),baseUrl:"",pages:[]}}let n=t.name??Lt.basename(e),r=typeof process.env.VELU_SITE_URL=="string"?process.env.VELU_SITE_URL.replace(/\/+$/,""):"",o=G(t.api),s=t.navigation??{},a={};try{let p=await Ce(t.navigation??{},{targetDir:e,api:o});s=p.nav,a=p.ops}catch(p){console.warn(`[velu] openapi: ${p.message}`)}let i=H(s),{pageEntries:l}=q(i,e),u=new Map(l.map(p=>[p.url,p])),c=[];for(let p of te(i)){if(!p.url)continue;let m=p.ancestors.filter(y=>y.kind==="group").pop(),d=p.ancestors.filter(y=>y.kind==="tab").pop(),g=m?.label||d?.label||"Pages",v=p.ancestors.filter(y=>y.kind==="tab"||y.kind==="group").map(y=>y.label),T=p.ancestors.filter(y=>y.kind==="language").pop()?.code||null;if(p.node?.api){let y=a[p.pagePath];if(!y)continue;let j=y.title||Un(p.url);c.push({url:p.url,title:j,description:y.description||"",group:g,breadcrumb:[...v,j],lang:T,frontmatter:{title:y.title,description:y.description},source:{kind:"api",segment:y.segment}})}else{let y=u.get(p.url);if(!y||!y.exists)continue;let j=hs(y.fileAbsPath),N=j.title||Un(p.url);c.push({url:p.url,title:N,description:j.description||"",group:g,breadcrumb:[...v,N],lang:T,frontmatter:j,source:{kind:"mdx",fileAbsPath:y.fileAbsPath}})}}return{name:n,baseUrl:r,pages:c}}function Ve(e){return new Map(e.pages.map(t=>[t.url,{...t.source,title:t.title}]))}async function ys(e){return Ve(await ie(e))}async function Ct(e,t,n){let o=(n||await ys(e)).get(t);if(!o)return null;if(o.kind==="mdx")try{return{body:we.readFileSync(o.fileAbsPath,"utf-8"),contentType:"text/markdown; charset=utf-8",kind:"mdx"}}catch{return null}return o.segment?{body:Rn(o.segment),contentType:"text/yaml; charset=utf-8",kind:"api"}:null}async function In(e,t){let n=t||await ie(e),r=i=>n.baseUrl?n.baseUrl+i:i,o=[`# ${n.name}`,"",`> Documentation index for ${n.name}. Append \`.md\` to any page URL (or send \`Accept: text/markdown\`) for its Markdown; fetch ${Be} for the whole site in one document.`,""],s=[],a=new Map;for(let i of n.pages)a.has(i.group)||(a.set(i.group,[]),s.push(i.group)),a.get(i.group).push(i);for(let i of s){o.push(`## ${i}`,"");for(let l of a.get(i))o.push(`- [${l.title}](${r(ms(l.url))})${l.description?`: ${l.description}`:""}`);o.push("")}return o.join(`
|
|
120
|
+
`)}async function Mn(e,t){let n=t||await ie(e),r=[`# ${n.name}`,"",`> Full documentation \u2014 every page concatenated. Index: ${oe}`];for(let o of n.pages)if(r.push("","---","",`# ${o.title}`,`Source: ${o.url}`,""),o.source.kind==="mdx")try{r.push(gs(we.readFileSync(o.source.fileAbsPath,"utf-8")).trim())}catch{}else o.source.segment&&r.push("```yaml",Rn(o.source.segment).trim(),"```");return r.join(`
|
|
113
121
|
`)+`
|
|
114
|
-
`}async function
|
|
115
|
-
<title>${
|
|
116
|
-
<link>${
|
|
117
|
-
<guid isPermaLink="true">${
|
|
118
|
-
`+(
|
|
119
|
-
`:"")+` <description>${
|
|
122
|
+
`}async function zn(e,t){let n=t||await ie(e),r=n.baseUrl||"",o=[];for(let i of n.pages){if(i.source.kind!=="mdx")continue;let l="";try{l=we.readFileSync(i.source.fileAbsPath,"utf-8")}catch{continue}let u=/<Update\b([^>]*)>([\s\S]*?)<\/Update>/gi,c;for(;c=u.exec(l);){let p=c[1]||"",m=c[2]||"",d=ze(p,"label")||ze(p,"date")||"Update",g=ze(p,"description")||bs(m)||d,v=`${r}${i.url}#${vs(d)}`,T=ze(p,"date")||d,y=new Date(T),j=Number.isNaN(y.getTime())?null:y.toUTCString();o.push({title:d,link:v,description:g,pubDate:j})}}if(!o.length)return null;let s=r||"/",a=o.map(i=>` <item>
|
|
123
|
+
<title>${Z(i.title)}</title>
|
|
124
|
+
<link>${Z(i.link)}</link>
|
|
125
|
+
<guid isPermaLink="true">${Z(i.link)}</guid>
|
|
126
|
+
`+(i.pubDate?` <pubDate>${i.pubDate}</pubDate>
|
|
127
|
+
`:"")+` <description>${Z(i.description)}</description>
|
|
120
128
|
</item>`).join(`
|
|
121
129
|
`);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
122
130
|
<rss version="2.0">
|
|
123
131
|
<channel>
|
|
124
|
-
<title>${
|
|
125
|
-
<link>${
|
|
126
|
-
<description>${
|
|
132
|
+
<title>${Z(n.name)} \u2014 Changelog</title>
|
|
133
|
+
<link>${Z(s)}</link>
|
|
134
|
+
<description>${Z(`Product updates and announcements for ${n.name}.`)}</description>
|
|
127
135
|
<generator>Velu</generator>
|
|
128
|
-
`+
|
|
136
|
+
`+a+`
|
|
129
137
|
</channel>
|
|
130
138
|
</rss>
|
|
131
|
-
`}var
|
|
139
|
+
`}var oe,Be,ds,se,Pn,Un,Z,vs,ze,bs,Bn=w(()=>{D();he();me();ht();oe="/llms.txt",Be="/llms-full.txt",ds=`<${oe}>; rel="llms-txt", <${Be}>; rel="llms-full-txt"`,se={Link:ds,"X-Llms-Txt":oe},Pn=`Full documentation index: ${oe}`;Un=e=>(e.split("/").filter(Boolean).pop()||"Home").replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase());Z=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),vs=e=>`update-${String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"item"}`,ze=(e,t)=>{let n=e.match(new RegExp(`${t}\\s*=\\s*["']([^"']*)["']`,"i"));return n?n[1]:void 0},bs=e=>String(e||"").replace(/```[\s\S]*?```/g,"").replace(/<[^>]+>/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[#*`_>]/g,"").replace(/\s+/g," ").trim().slice(0,500)});var Xn={};Ae(Xn,{startDevServer:()=>Fs});import Vn from"node:fs/promises";import ae from"node:fs";import xs from"node:http";import{spawn as $s}from"node:child_process";import P from"node:path";import{fileURLToPath as Ss}from"node:url";import ws from"chokidar";import Et from"express";import{createServer as ks,createLogger as As,searchForWorkspaceRoot as js}from"vite";function Os(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 Jn(e,t){let n=bt(e,{color:!!process.stderr.isTTY});console.error(`
|
|
132
140
|
`+n+`
|
|
133
|
-
`),process.env.VELU_DEBUG&&t&&console.error(t)}function
|
|
134
|
-
`)}function
|
|
135
|
-
`+
|
|
136
|
-
`),
|
|
137
|
-
${
|
|
138
|
-
</style>`,
|
|
139
|
-
`),
|
|
141
|
+
`),process.env.VELU_DEBUG&&t&&console.error(t)}function Hn(){try{return JSON.parse(ae.readFileSync(P.join(Ge,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function Cs(e,t){let n=P.resolve(e,".velu"),r=P.resolve(n,".velu-version"),o=null;try{o=ae.readFileSync(r,"utf8").trim()}catch{}if(o!==t){if(o!==null)try{ae.rmSync(P.join(n,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{ae.mkdirSync(n,{recursive:!0}),ae.writeFileSync(r,t)}catch{}}}async function qn(e){try{return await Ht(e)}catch{return st({},P.basename(e))}}async function Dn(e,t){let n=await e.moduleGraph.getModuleByUrl(t,!0),r=new Map,o=new Set;async function s(a){if(!(!a||o.has(a.url))){if(o.add(a.url),a.id&&Ls.test(a.id)){let i=a.url.includes("?")?"&":"?",l=await e.transformRequest(`${a.url}${i}direct`);l?.code&&r.set(a.url,l.code)}for(let i of a.importedModules)await s(i)}}return await s(n),[...r.values()].join(`
|
|
142
|
+
`)}function Us(e,t,n){let r=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},o=process.stdout.isTTY,s=g=>o&&process.stdout.write(`\x1B]${g}\x1B\\`),a=()=>{s(`0;\u23F3 ${t}`),s("9;4;3;0")},i=()=>{s(`0;${t}`),s("9;4;0;0")};o&&process.once("exit",()=>s("9;4;0;0")),a();let l=n&&n!=="unknown"?`v${n}`:"";if(!e)return console.log(`Starting Velu${l?" "+l:""}\u2026`),{ready:g=>{console.log(`Velu${l?" "+l:""} ready \u2192 ${g}`),i(),r()}};let u="\x1B[38;2;220;20;60m",c="\x1B[0m",p="\x1B[2m";console.log("");for(let g of Es)console.log(`${u}${g}${c}`);l&&console.log(` ${p}${l}${c}`),console.log("");let m=null;try{m=$s(process.execPath,["-e",Ps],{stdio:["ignore","inherit","ignore"]}),m.on("error",()=>{})}catch{}let d=()=>{if(m){try{m.kill()}catch{}m=null}};return process.once("exit",d),{ready:g=>{d(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${c} Velu${l?" "+l:""} ready \u2192 \x1B[36m${g}${c}`),i(),r()}}}async function Fs(e){let t=!!process.env.VELU_PROFILE,n=performance.now(),r=(b,f)=>t&&console.log(`[velu-profile] ${b}: ${(performance.now()-f).toFixed(0)}ms`),o=Us(!!process.stdout.isTTY&&!t,P.basename(e),Hn()),s=await qn(e),a=l(),i=ve(e);function l(){let f=Ie(e).filter(x=>x.severity==="error"&&(x.category==="config-json"||x.category==="config-schema"));return f.length&&console.error(`
|
|
143
|
+
`+Re(f,{color:!!process.stderr.isTTY})+`
|
|
144
|
+
`),f}let u=e;try{u=ae.realpathSync(e)}catch{}let c=0,p=b=>{let f=performance.now();if(f-c<500)return;c=f;let x=xe(b,{projectDir:u,knownComponents:Y});Jn(x,b)};process.on("unhandledRejection",p),process.on("uncaughtException",p);let m=Number(process.env.PORT)||8358,d=await jt();Cs(e,Hn());let g=Et(),v=xs.createServer(g),T=As(t?"info":"warn"),y=b=>typeof b=="string"&&b.includes("Failed to load source map"),j=T.warn.bind(T),N=T.warnOnce.bind(T);T.warn=(b,f)=>{y(b)||j(b,f)},T.warnOnce=(b,f)=>{y(b)||N(b,f)};let A=await ks({...Ln({targetDir:e,VITE_ROOT:Ge,validateProps:d}),appType:"custom",logLevel:t?"info":"warn",customLogger:T,server:{middlewareMode:!0,fs:{allow:[js(Ge),e,u]},hmr:{server:v}}});r("vite server created",n),g.get(new RegExp(`^${Ee}/`),(b,f,x)=>{let h=yn(i,b.path);if(!h)return x();f.sendFile(h.abs,O=>{O&&f.status(404).end()})}),g.use(A.middlewares);let $=P.join(e,"public");g.use(Et.static($)),g.get(new RegExp(`^${ot}(\\.[a-z0-9]+)?$`,"i"),async(b,f)=>{if(!s.favicon)return f.status(404).end();let x=P.resolve(e,s.favicon.replace(/^\//,""));f.sendFile(x,h=>{h&&f.status(404).end()})});let E=b=>(f,x)=>{let h=s.logo?.[b];if(!h)return x.status(404).end();x.sendFile(P.resolve(e,h.replace(/^\//,"")),O=>{O&&x.status(404).end()})};g.get(Le,E("light")),g.get(_e,E("dark")),g.post("/@velu-api-proxy",Et.json({limit:"8mb"}),async(b,f)=>{let{method:x="GET",url:h,headers:O={},body:S}=b.body||{};if(typeof h!="string"||!/^https?:\/\//i.test(h))return f.status(400).json({error:"A valid http(s) target URL is required."});try{let k=await fetch(h,{method:x,headers:O,body:S!=null&&S!==""?S:void 0}),F=await k.text(),I=k.headers.get("content-type")||"",L={};k.headers.forEach((le,De)=>{L[De]=le});let z=F;if(/json/i.test(I))try{z=JSON.parse(F)}catch{}f.json({status:k.status,statusText:k.statusText,headers:L,body:z})}catch(k){f.json({error:`Request failed: ${k.message}`})}});let V=null,C=async()=>V||=await ie(e);g.get(/\.md$/i,async(b,f,x)=>{try{let h=await C(),O=await Ct(e,Nn(decodeURIComponent(b.path)),Ve(h));if(!O)return x();f.status(200).set({"Content-Type":O.contentType,...se}).end(Ot(O.body,O.kind))}catch{x()}}),g.get(oe,async(b,f,x)=>{try{let h=await In(e,await C());f.status(200).set({"Content-Type":"text/plain; charset=utf-8",...se}).end(h)}catch{x()}}),g.get(Be,async(b,f,x)=>{try{let h=await Mn(e,await C());f.status(200).set({"Content-Type":"text/plain; charset=utf-8",...se}).end(h)}catch{x()}}),g.get("/rss.xml",async(b,f,x)=>{try{let h=await zn(e,await C());if(!h)return x();f.status(200).set({"Content-Type":"application/rss+xml; charset=utf-8"}).end(h)}catch{x()}}),g.use("*",async(b,f,x)=>{let h=b.originalUrl,O=performance.now();if(/text\/markdown/i.test(b.headers.accept||""))try{let S=await C(),k=await Ct(e,ct(h),Ve(S));if(k)return f.status(200).set({"Content-Type":k.contentType,...se}).end(Ot(k.body,k.kind))}catch{}if(a.length)return f.status(200).set({"Content-Type":"text/html"}).end(St(a,{title:"Fix velu.json to continue"}));try{let S=performance.now(),k=await Vn.readFile(Wn,"utf-8");k=await A.transformIndexHtml(h,k),r(`transformIndexHtml ${h}`,S);let F="/src/runtime/server-entry.jsx";S=performance.now();let{render:I}=await A.ssrLoadModule(F);r(`ssrLoadModule ${h} (1st req includes dep pre-bundle)`,S),S=performance.now();let L=await I(h);r(`render ${h}`,S),S=performance.now();let z=await Dn(A,F);r(`collectSsrCss ${h}`,S);let le=z?`<style data-velu-ssr>${z}</style>`:"",De=`<style data-velu-config>
|
|
145
|
+
${qt(s)}
|
|
146
|
+
</style>`,tr=_s.has(s.font.family)?"":Os(s.font.family),ke=Jt(s),nr=ke?`<link rel="icon"${ke.type?` type="${ke.type}"`:""} href="${ke.url}" />`:"",rr=vn(i),or=[le,De,tr,nr,rr].filter(Boolean).join(`
|
|
147
|
+
`),sr=k.replace('<html lang="en">',`<html lang="en" data-current-path="${Gn(ct(h))}">`).replace("<!--app-title-->",Gn(s.name)).replace("<!--app-head-->",or).replace("<!--app-html-->",L);f.status(200).set({"Content-Type":"text/html",...se}).end(sr),r(`TOTAL ${h}`,O)}catch(S){A.ssrFixStacktrace(S);let k=xe(S,{projectDir:u,knownComponents:Y});if(/failed to load url|does the file exist|cannot find module|ERR_MODULE_NOT_FOUND/i.test(String(S&&S.message))){try{A.moduleGraph.invalidateAll()}catch{}k.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."}Jn(k,S),f.status(200).set({"Content-Type":"text/html"}).end(St([k]))}}),ws.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(b,f)=>{console.log(`[velu-cli] content ${b}: ${P.relative(e,f)}`);let x=P.basename(f)==="velu.json",h=f.endsWith(".mdx"),O=/\.(css|js)$/i.test(f),S=!1;if(O){let F=L=>L.scripts.some(z=>z.abs===f),I=F(i);i=ve(e),S=I||F(i)}let k=x||h&&(b==="add"||b==="unlink")||S;if((k||h||/\.(ya?ml|json)$/i.test(f))&&(V=null),x&&(s=await qn(e),a=l()),k)A.moduleGraph.invalidateAll();else if(h){let F=f.split(P.sep).join("/"),I=A.moduleGraph.getModulesByFile(F);if(I)for(let L of I)A.moduleGraph.invalidateModule(L)}A.ws.send({type:"full-reload"})});async function Pt(b){let f=new Set,x=12,h=0,O=[],S=()=>h<x?(h+=1,Promise.resolve()):new Promise(L=>O.push(L)).then(()=>{h+=1}),k=()=>{h-=1,O.shift()?.()},F=L=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(L)||/[\\/]node_modules[\\/]/.test(L)&&!/velu-ui/.test(L);async function I(L){if(!(!L||f.has(L)||F(L))){f.add(L);try{await S();try{await A.transformRequest(L,{ssr:!1})}finally{k()}let z=await A.moduleGraph.getModuleByUrl(L,!1);z?.importedModules?.size&&await Promise.all([...z.importedModules].map(le=>I(le.url)))}catch{}}}return await I(b),f.size}v.listen(m,async()=>{let b=performance.now(),f=0;try{let{render:x}=await A.ssrLoadModule("/src/runtime/server-entry.jsx");await Pt("/src/runtime/client-entry.jsx"),typeof A.waitForRequestsIdle=="function"&&await A.waitForRequestsIdle();let[h]=await Promise.allSettled([Pt("/src/runtime/client-entry.jsx"),x("/"),A.transformIndexHtml("/",await Vn.readFile(Wn,"utf-8")),Dn(A,"/src/runtime/server-entry.jsx")]).then(O=>O.map(S=>S.status==="fulfilled"?S.value:0));f=h}catch(x){t&&console.log("[velu-profile] warmup error:",x?.message)}r(`cold-start warm-up (${f} client modules)`,b),o.ready(`http://localhost:${m}`)})}var Ts,Ls,_s,Gn,Ge,Wn,Es,Ps,Yn=w(()=>{me();_n();$t();Cn();X();wt();At();Tt();Bn();D();yt();Ts=P.dirname(Ss(import.meta.url)),Ls=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,_s=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),Gn=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");Ge=P.resolve(Ts,".."),Wn=P.resolve(Ge,"src","template.html"),Es=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],Ps="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 Zn={};Ae(Zn,{default:()=>Ms,runValidate:()=>Kn});import Rs from"node:fs";import Ns from"node:path";function Is(e){try{let t=JSON.parse(Rs.readFileSync(Ns.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let n=H(t.navigation);return q(n,e).pageEntries}catch{return[]}}async function Kn(e){let t=Ie(e),n=Is(e),r=await En(e,n),o=[...t,...r],s=!!process.stdout.isTTY;return console.log(Re(o,{color:s})),o.some(i=>i.severity!=="warning"&&i.severity!=="info")?1:0}var Ms,Qn=w(()=>{D();he();At();Tt();X();Ms=Kn});import Je from"node:path";import U from"node:process";import{readFileSync as zs}from"node:fs";var[,,er,He]=U.argv;function Bs(){try{return JSON.parse(zs(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function Vs(){let e=U.argv.slice(3);for(let t=0;t<e.length;t++){let n=e[t];if(n==="--out"){t++;continue}if(!n.startsWith("-"))return n}}async function Gs(){switch(er){case"--version":case"-v":case"version":{console.log(Bs());break}case"init":{He||(console.error("Usage: velu init <project-name>"),U.exit(1));let e=He,t=Je.resolve(U.cwd(),e),{initProject:n}=await Promise.resolve().then(()=>(Rt(),Ft));await n(t,e);break}case"dev":{let{maybeAutoUpdate:e}=await Promise.resolve().then(()=>(Qe(),Ze));await e();let t=Je.resolve(U.cwd(),He??"."),{startDevServer:n}=await Promise.resolve().then(()=>(Yn(),Xn));await n(t);break}case"update":{let{updateCommand:e}=await Promise.resolve().then(()=>(Qe(),Ze));await e();break}case"validate":{let e=Je.resolve(U.cwd(),He??"."),{runValidate:t}=await Promise.resolve().then(()=>(Qn(),Zn)),n=await t(e);U.exit(n);break}case"build":{let e=Je.resolve(U.cwd(),Vs()??"."),t=U.argv.indexOf("--out"),n=t>-1?U.argv[t+1]:void 0,r=new URL(["..","src","build","index.js"].join("/"),import.meta.url).href,o=a=>import(a),s;try{({runBuild:s}=await o(r))}catch{console.error("velu build is an internal command, not available in this distribution."),U.exit(1)}await s(e,{out:n});break}default:console.log("Usage:"),console.log(" velu init <project-name> scaffold a new docs project"),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"),U.exit(er?1:0)}}Gs().catch(e=>{console.error(U.env.VELU_DEBUG?e:`Error: ${e.message}`),U.exit(1)});
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ export function Accordion({
|
|
|
39
39
|
.join(' ');
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
|
-
<details className={cls} open={defaultOpen || undefined} {...rest}>
|
|
42
|
+
<details className={cls} data-component="accordion" open={defaultOpen || undefined} {...rest}>
|
|
43
43
|
<summary className="velu-accordion__summary">
|
|
44
44
|
<span className="velu-accordion__chevron" aria-hidden="true">
|
|
45
45
|
{resolveIcon('chevron-right', { size: '1em' })}
|
|
@@ -54,9 +54,9 @@ export function Accordion({
|
|
|
54
54
|
export function AccordionGroup({ children, className = '', ...rest }) {
|
|
55
55
|
return (
|
|
56
56
|
<GroupCtx.Provider value={true}>
|
|
57
|
-
<
|
|
57
|
+
<accordion-group class={`velu-accordion-group ${className}`.trim()} {...rest}>
|
|
58
58
|
{children}
|
|
59
|
-
</
|
|
59
|
+
</accordion-group>
|
|
60
60
|
</GroupCtx.Provider>
|
|
61
61
|
);
|
|
62
62
|
}
|