@veluai/velu 0.2.14 → 0.2.15
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 +80 -80
- package/dist/cli.js +37 -37
- package/package.json +64 -64
- package/runtime/velu-ui/base.css +320 -320
- package/runtime/velu-ui/components/Accordion.jsx +64 -64
- package/runtime/velu-ui/components/ApiClient.jsx +207 -207
- package/runtime/velu-ui/components/ApiField.jsx +87 -87
- package/runtime/velu-ui/components/ApiPath.jsx +63 -63
- package/runtime/velu-ui/components/ApiReferencePage.jsx +384 -384
- package/runtime/velu-ui/components/ApiSamples.jsx +36 -36
- package/runtime/velu-ui/components/ApiSidebar.jsx +122 -122
- package/runtime/velu-ui/components/AskBar.jsx +71 -71
- package/runtime/velu-ui/components/Callout.jsx +114 -114
- package/runtime/velu-ui/components/Card.jsx +131 -131
- package/runtime/velu-ui/components/Chatbot.jsx +885 -885
- package/runtime/velu-ui/components/CodeBlock.jsx +375 -375
- package/runtime/velu-ui/components/Columns.jsx +56 -56
- package/runtime/velu-ui/components/ContextMenu.jsx +298 -298
- package/runtime/velu-ui/components/ErrorCard.jsx +138 -138
- package/runtime/velu-ui/components/Field.jsx +81 -81
- package/runtime/velu-ui/components/Image.jsx +163 -163
- package/runtime/velu-ui/components/Logo.jsx +31 -31
- package/runtime/velu-ui/components/MethodBadge.jsx +31 -31
- package/runtime/velu-ui/components/NavSelect.jsx +108 -108
- package/runtime/velu-ui/components/NotFound.jsx +63 -63
- package/runtime/velu-ui/components/PageFeedback.jsx +219 -219
- package/runtime/velu-ui/components/PageFooter.jsx +145 -145
- package/runtime/velu-ui/components/PageHeader.jsx +422 -422
- package/runtime/velu-ui/components/PageNav.jsx +77 -77
- package/runtime/velu-ui/components/PoweredBy.jsx +51 -51
- package/runtime/velu-ui/components/Prompt.jsx +115 -115
- package/runtime/velu-ui/components/Search.jsx +460 -460
- package/runtime/velu-ui/components/Sidebar.jsx +254 -254
- package/runtime/velu-ui/components/SocialLinks.jsx +90 -90
- package/runtime/velu-ui/components/Steps.jsx +65 -65
- package/runtime/velu-ui/components/ThemeToggle.jsx +48 -48
- package/runtime/velu-ui/components/Toc.jsx +537 -537
- package/runtime/velu-ui/components/TocBar.jsx +195 -195
- package/runtime/velu-ui/components/Tree.jsx +87 -87
- package/runtime/velu-ui/components/TryItBar.jsx +102 -102
- package/runtime/velu-ui/components/accordion.css +92 -92
- package/runtime/velu-ui/components/api-page.css +208 -208
- package/runtime/velu-ui/components/api.css +635 -635
- package/runtime/velu-ui/components/ask-bar.css +94 -94
- package/runtime/velu-ui/components/card.css +105 -105
- package/runtime/velu-ui/components/chatbot.css +622 -622
- package/runtime/velu-ui/components/code-block.css +263 -263
- package/runtime/velu-ui/components/context-menu.css +173 -173
- package/runtime/velu-ui/components/docs-layout.css +822 -822
- package/runtime/velu-ui/components/field.css +82 -82
- package/runtime/velu-ui/components/image.css +237 -237
- package/runtime/velu-ui/components/nav-select.css +157 -157
- package/runtime/velu-ui/components/not-found.css +94 -94
- package/runtime/velu-ui/components/page-feedback.css +241 -241
- package/runtime/velu-ui/components/page-footer.css +130 -130
- package/runtime/velu-ui/components/page-header.css +558 -558
- package/runtime/velu-ui/components/page-nav.css +50 -50
- package/runtime/velu-ui/components/powered-by.css +92 -92
- package/runtime/velu-ui/components/prompt.css +99 -99
- package/runtime/velu-ui/components/search.css +307 -307
- package/runtime/velu-ui/components/sidebar.css +205 -205
- package/runtime/velu-ui/components/steps.css +77 -77
- package/runtime/velu-ui/components/theme-toggle.css +102 -102
- package/runtime/velu-ui/components/toc-bar.css +234 -234
- package/runtime/velu-ui/components/tree.css +49 -49
- package/runtime/velu-ui/index.js +54 -54
- package/runtime/velu-ui/lib/api-send.js +92 -92
- package/runtime/velu-ui/lib/brand-icons.jsx +103 -103
- package/runtime/velu-ui/lib/component-schemas.js +100 -100
- package/runtime/velu-ui/lib/copyText.js +64 -64
- package/runtime/velu-ui/lib/docs-assistant.js +250 -250
- package/runtime/velu-ui/lib/lang-icons.jsx +147 -147
- package/runtime/velu-ui/lib/pagefind.js +113 -113
- package/runtime/velu-ui/lib/prism-langs.js +957 -957
- package/runtime/velu-ui/lib/prism-loader.js +74 -74
- package/runtime/velu-ui/lib/resolveIcon.jsx +29 -29
- package/runtime/velu-ui/lib/scrollIntoNearestView.js +66 -66
- package/runtime/velu-ui/mdx-components.jsx +105 -105
- package/runtime/velu-ui/primitives/Cluster.jsx +49 -49
- package/runtime/velu-ui/primitives/Stack.jsx +63 -63
- package/runtime/velu-ui/primitives/Switcher.jsx +57 -57
- package/runtime/velu-ui/primitives/stack.css +3 -3
- package/runtime/velu-ui/primitives/switcher.css +25 -25
- package/runtime/velu-ui/styles.css +46 -46
- package/runtime/velu-ui/tokens.css +4 -4
- package/schema/velu.schema.json +423 -423
- package/src/lib/extract-mdx-error.js +170 -170
- package/src/lib/issues.js +159 -159
- package/src/lib/known-components.js +34 -34
- package/src/navigation.js +443 -443
- package/src/runtime/App.jsx +1669 -1669
- package/src/runtime/ErrorBoundary.jsx +54 -54
- package/src/runtime/client-entry.jsx +22 -22
- package/src/runtime/server-entry.jsx +16 -16
- package/src/template.html +48 -48
- package/templates/starter/ai-tools/claude-code.mdx +26 -26
- package/templates/starter/ai-tools/cursor.mdx +17 -17
- package/templates/starter/api-reference/introduction.mdx +43 -43
- package/templates/starter/development.mdx +19 -19
- package/templates/starter/essentials/code.mdx +29 -29
- package/templates/starter/essentials/images.mdx +29 -29
- package/templates/starter/essentials/markdown.mdx +25 -25
- package/templates/starter/essentials/navigation.mdx +39 -39
- package/templates/starter/essentials/settings.mdx +30 -30
- package/templates/starter/favicon.svg +6 -6
- package/templates/starter/index.mdx +31 -31
- package/templates/starter/openapi.json +160 -160
- package/templates/starter/quickstart.mdx +31 -31
- package/templates/starter/velu.json +41 -41
package/README.md
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
# Velu
|
|
2
|
-
|
|
3
|
-
A documentation-site generator with live preview. Scaffold a docs project
|
|
4
|
-
and run it locally with two commands — author your pages in Markdown +
|
|
5
|
-
components, configure the site with a single `velu.json`.
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g @veluai/velu
|
|
9
|
-
velu init my-docs
|
|
10
|
-
velu dev my-docs
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Then open <http://localhost:8358>. Editing any `.mdx` page or `velu.json`
|
|
14
|
-
reloads the browser automatically.
|
|
15
|
-
|
|
16
|
-
> Requires **Node.js 18+**. Prefer not to install globally? Use
|
|
17
|
-
> `npx @veluai/velu init my-docs` and `npx @veluai/velu dev my-docs`.
|
|
18
|
-
|
|
19
|
-
## Commands
|
|
20
|
-
|
|
21
|
-
| Command | What it does |
|
|
22
|
-
| --- | --- |
|
|
23
|
-
| `velu init <dir>` | Scaffold a new docs project into `<dir>` (creates `velu.json`, a favicon, and a set of starter `.mdx` pages). |
|
|
24
|
-
| `velu dev [dir]` | Start the live-preview dev server for the project in `<dir>` (defaults to the current directory). |
|
|
25
|
-
|
|
26
|
-
Set a custom port with the `PORT` env var:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
PORT=5180 velu dev my-docs
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Project layout
|
|
33
|
-
|
|
34
|
-
`velu init` produces a project shaped like this:
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
my-docs/
|
|
38
|
-
├─ velu.json # site config: name, colors, font, favicon, navigation
|
|
39
|
-
├─ favicon.svg
|
|
40
|
-
├─ index.mdx # pages, organized however your navigation references them
|
|
41
|
-
├─ quickstart.mdx
|
|
42
|
-
└─ …
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## `velu.json`
|
|
46
|
-
|
|
47
|
-
`velu.json` drives the whole site — branding and navigation:
|
|
48
|
-
|
|
49
|
-
```json
|
|
50
|
-
{
|
|
51
|
-
"$schema": "https://veluai.com/velu.schema.json",
|
|
52
|
-
"name": "My Docs",
|
|
53
|
-
"colors": { "primary": "#dc143c" },
|
|
54
|
-
"favicon": "/favicon.svg",
|
|
55
|
-
"font": { "family": "Inter" },
|
|
56
|
-
"navigation": {
|
|
57
|
-
"tabs": [
|
|
58
|
-
{
|
|
59
|
-
"tab": "Guides",
|
|
60
|
-
"groups": [
|
|
61
|
-
{ "group": "Getting started", "pages": ["index", "quickstart"] }
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
- **`colors`** — `primary` is required; `light` and `dark` default to `primary`.
|
|
70
|
-
- **`navigation`** — Mintlify-compatible: `products → versions → languages →
|
|
71
|
-
tabs → anchors → groups → pages`. Switchable axes (products, versions,
|
|
72
|
-
languages) become URL path prefixes; the default value of each axis is
|
|
73
|
-
unprefixed. Languages are stored as ISO 639-1 codes and shown with their
|
|
74
|
-
native name.
|
|
75
|
-
|
|
76
|
-
Page labels come from each page's frontmatter `title`.
|
|
77
|
-
|
|
78
|
-
## License
|
|
79
|
-
|
|
80
|
-
Proprietary. © Velu.
|
|
1
|
+
# Velu
|
|
2
|
+
|
|
3
|
+
A documentation-site generator with live preview. Scaffold a docs project
|
|
4
|
+
and run it locally with two commands — author your pages in Markdown +
|
|
5
|
+
components, configure the site with a single `velu.json`.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @veluai/velu
|
|
9
|
+
velu init my-docs
|
|
10
|
+
velu dev my-docs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then open <http://localhost:8358>. Editing any `.mdx` page or `velu.json`
|
|
14
|
+
reloads the browser automatically.
|
|
15
|
+
|
|
16
|
+
> Requires **Node.js 18+**. Prefer not to install globally? Use
|
|
17
|
+
> `npx @veluai/velu init my-docs` and `npx @veluai/velu dev my-docs`.
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
| Command | What it does |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `velu init <dir>` | Scaffold a new docs project into `<dir>` (creates `velu.json`, a favicon, and a set of starter `.mdx` pages). |
|
|
24
|
+
| `velu dev [dir]` | Start the live-preview dev server for the project in `<dir>` (defaults to the current directory). |
|
|
25
|
+
|
|
26
|
+
Set a custom port with the `PORT` env var:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
PORT=5180 velu dev my-docs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Project layout
|
|
33
|
+
|
|
34
|
+
`velu init` produces a project shaped like this:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
my-docs/
|
|
38
|
+
├─ velu.json # site config: name, colors, font, favicon, navigation
|
|
39
|
+
├─ favicon.svg
|
|
40
|
+
├─ index.mdx # pages, organized however your navigation references them
|
|
41
|
+
├─ quickstart.mdx
|
|
42
|
+
└─ …
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## `velu.json`
|
|
46
|
+
|
|
47
|
+
`velu.json` drives the whole site — branding and navigation:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"$schema": "https://veluai.com/velu.schema.json",
|
|
52
|
+
"name": "My Docs",
|
|
53
|
+
"colors": { "primary": "#dc143c" },
|
|
54
|
+
"favicon": "/favicon.svg",
|
|
55
|
+
"font": { "family": "Inter" },
|
|
56
|
+
"navigation": {
|
|
57
|
+
"tabs": [
|
|
58
|
+
{
|
|
59
|
+
"tab": "Guides",
|
|
60
|
+
"groups": [
|
|
61
|
+
{ "group": "Getting started", "pages": ["index", "quickstart"] }
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **`colors`** — `primary` is required; `light` and `dark` default to `primary`.
|
|
70
|
+
- **`navigation`** — Mintlify-compatible: `products → versions → languages →
|
|
71
|
+
tabs → anchors → groups → pages`. Switchable axes (products, versions,
|
|
72
|
+
languages) become URL path prefixes; the default value of each axis is
|
|
73
|
+
unprefixed. Languages are stored as ISO 639-1 codes and shown with their
|
|
74
|
+
native name.
|
|
75
|
+
|
|
76
|
+
Page labels come from each page's frontmatter `title`.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Proprietary. © Velu.
|
package/dist/cli.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`,"utf-8");let o=await
|
|
4
|
-
`)}var bn,xn,ge,he,Ue,$n,Y=A(()=>{Ie();Ie();bn="#dc143c",xn="Google Sans Flex",ge="/@velu-logo-light",he="/@velu-logo-dark",Ue="/@velu-favicon",$n={".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 Sn}from"unist-util-visit";import{toString as kn}from"mdast-util-to-string";import An from"github-slugger";import{valueToEstree as jn}from"estree-util-value-to-estree";function ie(){return e=>{let t=new An,n=[];Sn(e,"heading",a=>{let s=kn(a);n.push({depth:a.depth,id:t.slug(s),label:s})});let r={children:[]},o=[{node:r,depth:0}];for(let a of n){for(;o.length>1&&o[o.length-1].depth>=a.depth;)o.pop();let s={id:a.id,label:a.label},l=o[o.length-1].node;l.children||(l.children=[]),l.children.push(s),o.push({node:s,depth:a.depth})}let i=r.children;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:"toc"},init:jn(i)}]}}]}}})}}var ze=A(()=>{});import On from"github-slugger";import Tn from"iso-639-1";function Pn(e){let t=String(e).toLowerCase();return Tn.getNativeName(t)||e}function ye(e){return new On().slug(String(e??""))}function _n(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function ft(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 U(e){let t={kind:"root",children:se(e??{})};return gt(t.children),t}function se(e){let t=Array.isArray(e.anchors)?e.anchors.map(In):[];if(Array.isArray(e.products))return[...t,...e.products.map(Cn)];if(Array.isArray(e.versions))return[...t,...e.versions.map(En)];if(Array.isArray(e.languages))return[...t,...e.languages.map(Fn)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(Nn)];let n=[...t];return Array.isArray(e.groups)&&n.push(...e.groups.map(mt)),Array.isArray(e.pages)&&n.push(...e.pages.map(dt)),n}function Cn(e){return{kind:"product",label:e.name??e.product,slug:ye(e.product),icon:e.icon,color:e.color,default:!!e.default,children:se(e)}}function En(e){return{kind:"version",label:e.version,slug:ye(e.version),default:!!e.default,children:se(e)}}function Fn(e){let t=String(e.language);return{kind:"language",code:t,label:Pn(t),slug:ye(t),default:!!e.default,children:se(e)}}function Nn(e){return{kind:"tab",label:e.tab,slug:ye(e.tab),icon:e.icon,href:e.href,children:se(e)}}function In(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function mt(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}:mt(e)}function gt(e){for(let t of Ln){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&>(t.children)}function K(e){let t=[],n=(r,o,i)=>{if(r.kind==="page"){t.push({pagePath:r.pagePath,url:Rn(r.pagePath,o),ctx:{...o},ancestors:i,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 s=r.kind==="root"?i:[...i,r];for(let l of r.children??[])n(l,a,s)};return n(e,{product:null,version:null,language:null},[]),t}function Rn(e,t){let n=[t.product,t.version,t.language].filter(Boolean),r=_n(e).split("/").filter(Boolean);return"/"+[...n,...r].join("/")}var Ln,B=A(()=>{Ln=["product","version","language"]});import Un from"node:fs";import ht from"node:path";function M(e,t){let n=[],r=[],o=new Set;for(let i of K(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 a=i.pagePath.replace(/^\/+|\/+$/g,""),s=ht.join(t,...a.split("/"))+".mdx",l=Un.existsSync(s);l||n.push(`page "${i.pagePath}" \u2192 ${ht.relative(t,s)} not found`),r.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:l})}return{pageEntries:r,warnings:n}}var ae=A(()=>{B()});import Mn from"@apidevtools/swagger-parser";async function Gn(e){return Mn.dereference(e)}function G(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,n)=>{let r=G(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?G(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?G(e.anyOf[0]):e}function ve(e){let t=G(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`${ve(t.items||{})}[]`;let n=t.type||(t.properties?"object":"any");return t.format?`${n}<${t.format}>`:n}function le(e,t=0){let n=G(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>=Bn)return n.type==="object"?{}:null;switch(n.type){case"object":{let r={};for(let[o,i]of Object.entries(n.properties||{}))r[o]=le(i,t+1);return r}case"array":return[le(n.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return Jn(n)}}function Jn(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 vt(e){let t=G(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:ve(t),required:!1,description:t.description||""}]:[];let n=new Set(t.required||[]);return Object.entries(t.properties).map(([r,o])=>{let i=G(o);return{name:r,type:ve(i),required:n.has(r),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function Vn(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:ve(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:le(t),deprecated:e.deprecated||void 0}}function bt(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 qn(e){if(!e)return null;let t=bt(e.content);if(!t)return null;let n=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:vt(n),example:t.media.example??le(n)}}function Hn(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>{let r=bt(n?.content),o=r?.media?.schema||{};return{status:t,description:n?.description||"",contentType:r?.contentType||null,fields:r?vt(o):[],example:r?r.media.example??le(o):null}})}function Dn(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 a=t[i];!a||r.has(i)||(r.add(i),n.push(Xn(i,a)))}return n.filter(Boolean)}function Xn(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 Yn(e){let{method:t,path:n,op:r,sharedParams:o,servers:i,schemes:a}=e,s=[...o||[],...r.parameters||[]],l={path:[],query:[],header:[],cookie:[]};for(let u of s)u&&l[u.in]&&l[u.in].push(Vn(u));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:Dn(p,a),parameters:l,body:qn(r.requestBody),responses:Hn(r.responses),servers:(i||[]).map(u=>u.url).filter(Boolean)}}function Kn(e,t,n,r,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=(r.servers||i||[]).filter(Boolean);l.length&&(s.servers=l);let p={};Array.isArray(o)&&o.length&&(p.parameters=o),p[n]=r,s.paths={[t]:p};let u=r.security??e.security;if(a&&Array.isArray(u)&&u.length){let c={};for(let b of u)for(let d of Object.keys(b||{}))a[d]&&(c[d]=a[d]);Object.keys(c).length&&(e.swagger?s.securityDefinitions=c:s.components={securitySchemes:c})}return s}function Wn(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[a,s]of Object.entries(e.paths||{})){if(!s||typeof s!="object")continue;let l=s.parameters||[],p=s.servers||i;for(let u of zn){let c=s[u];!c||typeof c!="object"||(t.push(Yn({method:u,path:a,op:c,sharedParams:l,servers:c.servers||p,globalSecurity:o,schemes:r})),n.push(Kn(e,a,u,c,l,c.servers||p,r)))}}return{operations:t,segments:n}}async function xt(e){let t=await Gn(e),n=t.servers||(t.host?[{url:`https://${t.host}${t.basePath||""}`}]:[]),{operations:r,segments:o}=Wn(t);return{title:t.info?.title||"API Reference",version:t.info?.version||"",servers:n.map(i=>i.url).filter(Boolean),operations:r,segments:o}}var zn,Bn,$t=A(()=>{zn=["get","post","put","patch","delete","options","head","trace"],Bn=6});function Zn(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 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 Qn(e){let t=`curl --request ${e.method} \\
|
|
5
|
-
--url ${e.url}`;for(let[n
|
|
6
|
-
--header '${
|
|
7
|
-
--data '${JSON.stringify(e.body)}'`),t}function
|
|
2
|
+
var hn=Object.defineProperty;var A=(e,t)=>()=>(e&&(t=e(e=0)),t);var Fe=(e,t)=>{for(var r in t)hn(e,r,{get:t[r],enumerable:!0})};var ct={};Fe(ct,{initProject:()=>xn});import D from"node:fs/promises";import X from"node:path";import{fileURLToPath as yn}from"node:url";async function xn(e,t){try{if((await D.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 D.mkdir(e,{recursive:!0}),await D.cp(bn,e,{recursive:!0});let r=X.join(e,"velu.json"),n=JSON.parse(await D.readFile(r,"utf-8"));n.name=t,await D.writeFile(r,JSON.stringify(n,null,2)+`
|
|
3
|
+
`,"utf-8");let o=await lt(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 lt(e,t=e,r=[]){let n=await D.readdir(e,{withFileTypes:!0});for(let o of n){let i=X.join(e,o.name);o.isDirectory()?await lt(i,t,r):r.push(X.relative(t,i).split(X.sep).join("/"))}return r.sort()}var vn,bn,ut=A(()=>{vn=X.dirname(yn(import.meta.url)),bn=X.resolve(vn,"..","templates","starter")});function te(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:$n[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 Ne(e){return/^(https?:)?\/\//.test(e)||/^(mailto|tel):/.test(e)}function ne(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:Ne(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:Ne(o)}:{kind:"button",label:n.label??"",href:o,external:Ne(o)}}return!t.length&&!r?null:{links:t,primary:r}}function Ie(e){if(e==null)return{options:[...pt],display:"header"};if(typeof e!="object")return{options:[],display:"header"};let t=e.display==="toc"?"toc":"header",r=Array.isArray(e.options)?e.options:pt,n=[];for(let o of r)typeof o=="string"?wn.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 I(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 re(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 $n,wn,pt,he=A(()=>{$n={twitter:"x","x-twitter":"x"};wn=new Set(["copy","assistant","view","download-pdf","download-spec","chatgpt","claude","perplexity","grok","aistudio","devin","windsurf","mcp","add-mcp","cursor","vscode","devin-mcp"]),pt=["copy","view","chatgpt","claude"]});import Sn from"node:fs/promises";import Re from"node:path";function ft(e){if(!e.favicon)return null;let t=Re.extname(e.favicon).toLowerCase();return{url:Ue+t,type:jn[t]||""}}function oe(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 On(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 Me(e={},t){let r=e.colors?.primary??kn;return{name:e.name??t??"docs",url:typeof e.url=="string"&&e.url.trim()?e.url.trim().replace(/\/+$/,""):null,seo:On(e.seo),assistant:re(e.assistant),thumbnails:e.thumbnails&&typeof e.thumbnails=="object"&&typeof e.thumbnails.background=="string"?{background:e.thumbnails.background}:null,colors:{primary:r,light:e.colors?.light??r,dark:e.colors?.dark??r},favicon:e.favicon??null,api:I(e.api),logo:oe(e.logo),footer:te(e.footer),navbar:ne(e.navbar),font:{family:e.font?.family??An},navigation:e.navigation??null}}async function mt(e){let t=Re.join(e,"velu.json"),r;try{r=await Sn.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 Me(n,Re.basename(e))}function dt(e){let{colors:t,font:r}=e;return[":root:root {",` --accent-color: ${t.light};`,` --font-sans: "${r.family}", sans-serif;`,"}",':root:root[data-theme="dark"] {',` --accent-color: ${t.dark};`,"}"].join(`
|
|
4
|
+
`)}var kn,An,ye,ve,Ue,jn,ie=A(()=>{he();he();kn="#dc143c",An="Google Sans Flex",ye="/@velu-logo-light",ve="/@velu-logo-dark",Ue="/@velu-favicon",jn={".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 Tn}from"unist-util-visit";import{toString as Ln}from"mdast-util-to-string";import Pn from"github-slugger";import{valueToEstree as _n}from"estree-util-value-to-estree";function se(){return e=>{let t=new Pn,r=[];Tn(e,"heading",a=>{let s=Ln(a);r.push({depth:a.depth,id:t.slug(s),label:s})});let n={children:[]},o=[{node:n,depth:0}];for(let a of r){for(;o.length>1&&o[o.length-1].depth>=a.depth;)o.pop();let s={id:a.id,label:a.label},l=o[o.length-1].node;l.children||(l.children=[]),l.children.push(s),o.push({node:s,depth:a.depth})}let i=n.children;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:"toc"},init:_n(i)}]}}]}}})}}var ze=A(()=>{});import Cn from"github-slugger";import En from"iso-639-1";function Nn(e){let t=String(e).toLowerCase();return En.getNativeName(t)||e}function be(e){return new Cn().slug(String(e??""))}function In(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function gt(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 M(e){let t={kind:"root",children:ae(e??{})};return vt(t.children),t}function ae(e){let t=Array.isArray(e.anchors)?e.anchors.map(Bn):[];if(Array.isArray(e.products))return[...t,...e.products.map(Rn)];if(Array.isArray(e.versions))return[...t,...e.versions.map(Un)];if(Array.isArray(e.languages))return[...t,...e.languages.map(Mn)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(zn)];let r=[...t];return Array.isArray(e.groups)&&r.push(...e.groups.map(ht)),Array.isArray(e.pages)&&r.push(...e.pages.map(yt)),r}function Rn(e){return{kind:"product",label:e.name??e.product,slug:be(e.product),icon:e.icon,color:e.color,default:!!e.default,children:ae(e)}}function Un(e){return{kind:"version",label:e.version,slug:be(e.version),default:!!e.default,children:ae(e)}}function Mn(e){let t=String(e.language);return{kind:"language",code:t,label:Nn(t),slug:be(t),default:!!e.default,children:ae(e)}}function zn(e){return{kind:"tab",label:e.tab,slug:be(e.tab),icon:e.icon,href:e.href,children:ae(e)}}function Bn(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function ht(e){let t=(e.pages??[]).map(yt);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 yt(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 vt(e){for(let t of Fn){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&&vt(t.children)}function W(e){let t=[],r=(n,o,i)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Gn(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},[]),t}function Gn(e,t){let r=[t.product,t.version,t.language].filter(Boolean),n=In(e).split("/").filter(Boolean);return"/"+[...r,...n].join("/")}var Fn,B=A(()=>{Fn=["product","version","language"]});import Jn from"node:fs";import bt from"node:path";function z(e,t){let r=[],n=[],o=new Set;for(let i of W(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=bt.join(t,...a.split("/"))+".mdx",l=Jn.existsSync(s);l||r.push(`page "${i.pagePath}" \u2192 ${bt.relative(t,s)} not found`),n.push({pagePath:i.pagePath,url:i.url,fileAbsPath:s,exists:l})}return{pageEntries:n,warnings:r}}var le=A(()=>{B()});function G(e){return!e||typeof e!="object"?e||{}:Array.isArray(e.allOf)?e.allOf.reduce((t,r)=>{let n=G(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?G(e.oneOf[0]):Array.isArray(e.anyOf)&&e.anyOf.length?G(e.anyOf[0]):e}function ce(e){let t=G(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`${ce(t.items||{})}[]`;let r=t.type||(t.properties?"object":"any");return t.format?`${r}<${t.format}>`:r}function Y(e,t=0){let r=G(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]=Y(i,t+1);return n}case"array":return[Y(r.items||{},t+1)];case"integer":case"number":return 0;case"boolean":return!0;default:return qn(r)}}function qn(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 Be(e){let t=G(e);if(!t||t.type!=="object"||!t.properties)return t&&(t.type||t.items)?[{name:"body",type:ce(t),required:!1,description:t.description||""}]:[];let r=new Set(t.required||[]);return Object.entries(t.properties).map(([n,o])=>{let i=G(o);return{name:n,type:ce(i),required:r.has(n),description:i.description||"",enum:Array.isArray(i.enum)?i.enum:void 0,deprecated:i.deprecated||void 0}})}function Hn(e){let t=e.schema||{};return{name:e.name,in:e.in,required:e.in==="path"?!0:!!e.required,type:ce(t),description:e.description||"",enum:Array.isArray(t.enum)?t.enum:void 0,example:Y(t),deprecated:e.deprecated||void 0}}function $t(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 Dn(e){if(!e)return null;let t=$t(e.content);if(!t)return null;let r=t.media.schema||{};return{required:!!e.required,description:e.description||"",contentType:t.contentType,fields:Be(r),example:t.media.example??Y(r)}}function Xn(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,r])=>{let n=$t(r?.content),o=n?.media?.schema||{};return{status:t,description:r?.description||"",contentType:n?.contentType||null,fields:n?Be(o):[],example:n?n.media.example??Y(o):null}})}function Wn(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(Yn(i,a)))}return r.filter(Boolean)}function Yn(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 xt(e){return String(e).replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Kn(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 c of s)c&&l[c.in]&&l[c.in].push(Hn(c));let p=n.security??e.globalSecurity;return{id:n.operationId?xt(n.operationId):`${t}-${xt(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:Wn(p,a),parameters:l,body:Dn(n.requestBody),responses:Xn(n.responses),servers:(i||[]).map(c=>c.url).filter(Boolean)}}function Zn(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 p={};Array.isArray(o)&&o.length&&(p.parameters=o),p[r]=n,s.paths={[t]:p};let c=n.security??e.security;if(a&&Array.isArray(c)&&c.length){let u={};for(let x of c)for(let d of Object.keys(x||{}))a[d]&&(u[d]=a[d]);Object.keys(u).length&&(e.swagger?s.securityDefinitions=u:s.components={securitySchemes:u})}return s}function wt(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||[],p=s.servers||i;for(let c of Vn){let u=s[c];!u||typeof u!="object"||(t.push(Kn({method:c,path:a,op:u,sharedParams:l,servers:u.servers||p,globalSecurity:o,schemes:n})),r.push(Zn(e,a,c,u,l,u.servers||p,n)))}}return{operations:t,segments:r}}function Ge(e){let t=e.servers||(e.host?[{url:`https://${e.host}${e.basePath||""}`}]:[]),{operations:r,segments:n}=wt(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 Vn,Je=A(()=>{Vn=["get","post","put","patch","delete","options","head","trace"]});import Qn from"@apidevtools/swagger-parser";async function er(e){return Qn.dereference(e)}async function St(e){return Ge(await er(e))}var kt=A(()=>{Je();Je()});function tr(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 nr(e){let t=`curl --request ${e.method} \\
|
|
5
|
+
--url ${e.url}`;for(let[r,n]of Object.entries(e.headers))t+=` \\
|
|
6
|
+
--header '${r}: ${n}'`;return e.body!=null&&(t+=` \\
|
|
7
|
+
--data '${JSON.stringify(e.body)}'`),t}function rr(e){let t=[` method: '${e.method}'`];if(Object.keys(e.headers).length){let r=Object.entries(e.headers).map(([n,o])=>` '${n}': '${o}'`).join(`,
|
|
8
8
|
`);t.push(` headers: {
|
|
9
|
-
${
|
|
10
|
-
}`)}return e.body!=null&&t.push(` body: JSON.stringify(${
|
|
9
|
+
${r}
|
|
10
|
+
}`)}return e.body!=null&&t.push(` body: JSON.stringify(${Ve(e.body," ")})`),[`const res = await fetch('${e.url}', {`,t.join(`,
|
|
11
11
|
`),"});","const data = await res.json();"].join(`
|
|
12
|
-
`)}function
|
|
12
|
+
`)}function or(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(`,
|
|
13
13
|
`);t.push(`headers = {
|
|
14
|
-
${
|
|
15
|
-
}`)}let
|
|
16
|
-
`)}function
|
|
17
|
-
`)}function
|
|
18
|
-
`).map((n
|
|
19
|
-
`);
|
|
14
|
+
${n}
|
|
15
|
+
}`)}let r=["url"];return e.body!=null&&(t.push(`payload = ${Ve(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(`
|
|
16
|
+
`)}function ir(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 = ${Ve(e.body,"")}.to_json`),r.push("","response = http.request(request)","puts response.body"),r.join(`
|
|
17
|
+
`)}function jt(e,{server:t,languages:r=qe}={}){let n=tr(e,{server:t});return r.filter(o=>At[o]).map(o=>({key:o,label:sr[o],language:ar[o],code:At[o](n)}))}var Ve,At,sr,ar,qe,Ot=A(()=>{Ve=(e,t)=>JSON.stringify(e,null,2).split(`
|
|
18
|
+
`).map((r,n)=>n===0?r:t+r).join(`
|
|
19
|
+
`);At={curl:nr,javascript:rr,python:or,ruby:ir},sr={curl:"cURL",javascript:"JavaScript",python:"Python",ruby:"Ruby"},ar={curl:"bash",javascript:"javascript",python:"python",ruby:"ruby"},qe=["curl","javascript","python","ruby"]});function Tt(e,t){if(!t||typeof t!="object")return e;let r=I(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 lr(e,{base:t,api:r,ops:n}){let o=r?.server,i=r?.languages||qe,a={proxy:r?.proxy!==!1,server:o??null},s=new Map;for(let p of e){let c=p.op.tags?.[0]||"API";s.has(c)||s.set(c,[]),s.get(c).push(p)}let l=[];for(let[p,c]of s){let u=c.map(({op:x,segment:d})=>{let $=`${t}/${He(p)}/${x.id}`;return n[$]={operation:x,samples:jt(x,{server:o||x.servers?.[0],languages:i}),segment:d,title:x.title,description:x.description,method:x.method,api:a},{apiPage:$,label:x.title,method:x.method}});l.push({group:p,pages:u})}return l}async function Lt(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:p,servers:c}=await t(s);l.forEach((u,x)=>{!u.servers?.length&&c?.length&&(u.servers=c),a.push({op:u,segment:p[x]})})}return lr(a,{base:r,api:n,ops:o})}async function Pt(e,t){if(!e||typeof e!="object")return e;if(typeof e.tab=="string"&&e.openapi){let n=He(e.tab),o=Tt(t.api,e.api),i=await Lt(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=He(e.group),o=Tt(t.api,e.api),i=await Lt(e.openapi,{...t,base:n,api:o}),{openapi:a,api:s,...l}=e,p=i.flatMap(c=>c.pages);return{...l,pages:[...l.pages||[],...p]}}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=>Pt(o,t))));return r}async function _t(e,{api:t,loadOps:r}){let n={};return!e||typeof e!="object"?{nav:e,ops:n}:{nav:await Pt(e,{api:t,loadOps:r,ops:n}),ops:n}}var He,Ct=A(()=>{he();Ot();He=e=>String(e??"").replace(/\{[^}]+\}/g,t=>t.slice(1,-1)).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()||"x"});import cr from"node:path";function ur(e,t){return/^https?:\/\//.test(e)?e:cr.resolve(t,e.replace(/^\/+/,""))}async function xe(e,{targetDir:t,api:r}={}){return _t(e,{api:r,loadOps:n=>St(ur(n,t))})}var De=A(()=>{kt();Ct()});import pr from"node:fs";import ue from"node:path";function Nt(e){return{name:"velu-site",resolveId(t){return t===Ft?Et:null},async load(t){return t!==Et?null:fr(e)}}}async function fr(e){let t={};try{t=JSON.parse(pr.readFileSync(ue.join(e,"velu.json"),"utf-8"))}catch{}let r=I(t.api),n=t.navigation??{},o={};try{let b=await xe(t.navigation??{},{targetDir:e,api:r});n=b.nav,o=b.ops}catch(b){console.warn(`[velu] openapi: ${b.message}`)}let i=M(n),{pageEntries:a,warnings:s}=z(i,e);for(let b of s)console.warn(`[velu] nav: ${b}`);let l=oe(t.logo),p={name:t.name??ue.basename(e),logo:l?{light:ye,dark:ve,href:l.href,mono:l.light===l.dark}:null,footer:te(t.footer),navbar:ne(t.navbar),contextual:Ie(t.contextual),assistant:re(t.assistant)},c=[],u=[],x=0;for(let b of a){if(!b.exists)continue;let y=JSON.stringify(b.fileAbsPath.split(ue.sep).join("/")),f=JSON.stringify(ue.relative(e,b.fileAbsPath).split(ue.sep).join("/")),g=`__p${x++}`;c.push(`import * as ${g} from ${y};`),u.push(` ${JSON.stringify(b.url)}: { Component: ${g}.default, frontmatter: ${g}.frontmatter, toc: ${g}.toc, relPath: ${f} },`)}let d=new Set(a.filter(b=>b.exists).map(b=>b.url));for(let b of a)!b.exists&&!d.has(b.url)&&u.push(` ${JSON.stringify(b.url)}: { missing: true },`);let $=[],m=[],L=[],h=!1,w=0;for(let b of W(i)){if(!b.node?.api)continue;let y=o[b.pagePath];if(!y)continue;h=!0;let f=`__op${w}`,g=`__samples${w}`,v=`__api${w}`;w+=1,$.push(`const ${f} = ${JSON.stringify(y.operation)};`),$.push(`const ${g} = ${JSON.stringify(y.samples)};`),L.push(`{ id: ${JSON.stringify(y.operation.id)}, method: ${JSON.stringify(y.operation.method)}, title: ${JSON.stringify(y.operation.title)}, url: ${JSON.stringify(b.url)}, operation: ${f}, samples: ${g}, api: ${JSON.stringify(y.api||{proxy:!0,server:null})} }`),m.push(`function ${v}(){ return React.createElement(ApiReferencePage, { operation: ${f}, samples: ${g}, apiOperations: __apiOperations, api: ${JSON.stringify(y.api||{proxy:!0,server:null})} }); }`),u.push(` ${JSON.stringify(b.url)}: { Component: ${v}, frontmatter: { title: ${JSON.stringify(y.title)}, description: ${JSON.stringify(y.description)} }, toc: [], operation: ${f}, samples: ${g}, api: true },`)}h&&($.push(`const __apiOperations = [
|
|
20
20
|
${L.join(`,
|
|
21
21
|
`)}
|
|
22
22
|
];`),$.push(m.join(`
|
|
23
23
|
`)));let F=[];return h&&(F.push("import React from 'react';"),F.push("import { ApiReferencePage } from 'velu-ui';")),["// AUTO-GENERATED by vite-plugin-velu-site. Do not edit.",F.join(`
|
|
24
|
-
`),
|
|
24
|
+
`),c.join(`
|
|
25
25
|
`),$.join(`
|
|
26
|
-
`),"","export const pages = {",
|
|
26
|
+
`),"","export const pages = {",u.join(`
|
|
27
27
|
`),"};",`export const navigation = ${JSON.stringify(i)};`,`export const site = ${JSON.stringify(p)};`,""].join(`
|
|
28
|
-
`)}var
|
|
28
|
+
`)}var Ft,Et,It=A(()=>{B();le();ie();De();Ft="virtual:velu-site",Et="\0"+Ft});import{visit as mr}from"unist-util-visit";function dr(e,t){let r=Rt(e).replace(/[?#].*$/,""),n=Rt(t).replace(/\/+$/,"");return n&&r.toLowerCase().startsWith(n.toLowerCase())?r.slice(n.length).replace(/^\/+/,""):null}function Ut(e,t){return()=>(r,n)=>{typeof e=="function"&&mr(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:dr(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 Rt,Mt=A(()=>{Rt=e=>String(e||"").replace(/\\/g,"/")});import $e from"node:path";import gr from"node:fs";import{createRequire as hr}from"node:module";import yr from"@tailwindcss/vite";import vr from"@vitejs/plugin-react";import br from"@mdx-js/rollup";import xr from"remark-frontmatter";import $r from"remark-mdx-frontmatter";import wr from"remark-gfm";import Sr from"rehype-slug";function kr(e){let r=hr(import.meta.url).resolve("@mdx-js/react"),n=$e.resolve(e,"runtime","velu-ui"),o=gr.existsSync(n)?n:$e.resolve(e,"..","velu-ui","src");return[{find:"@mdx-js/react",replacement:r},{find:/^velu-ui$/,replacement:$e.join(o,"index.js")},{find:/^velu-ui\//,replacement:o+"/"}]}function zt({targetDir:e,VITE_ROOT:t,validateProps:r}){return{root:t,plugins:[Nt(e),br({remarkPlugins:[xr,$r,wr,se,Ut(r,e)],rehypePlugins:[Sr],providerImportSource:"@mdx-js/react"}),vr(),yr({optimize:!1})],cacheDir:$e.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:kr(t),dedupe:["react","react-dom","@mdx-js/react"]}}}var Bt=A(()=>{ze();It();Mt()});function j(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 Ar(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 we(e,t=[]){if(!e)return null;let r=String(e).toLowerCase(),n=null,o=1/0;for(let a of t){let s=Ar(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 jr(e,t){return e==="warning"?E(t,C.yellow,"\u26A0"):e==="info"?E(t,C.cyan,"\u2139"):E(t,C.red,"\u2716")}function We(e,{color:t=!1}={}){let r=Xe[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(`${jr(e.severity,t)} ${E(t,C.bold,r)}`+(o?` ${E(t,C.dim,o)}`:"")),e.title&&i.push(` ${e.title}`),e.detail&&e.detail!==e.title&&i.push(` ${E(t,C.dim,e.detail)}`),e.frame)for(let a of String(e.frame).split(`
|
|
29
29
|
`))i.push(` ${a}`);return e.suggestion&&i.push(` ${E(t,C.cyan,`Did you mean <${e.suggestion}>?`)}`),e.hint&&i.push(` ${E(t,C.dim,`\u2192 ${e.hint}`)}`),i.join(`
|
|
30
|
-
`)}function
|
|
31
|
-
`)}var
|
|
30
|
+
`)}function Se(e,{color:t=!1}={}){if(!e.length)return E(t,C.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(E(t,C.bold,s));for(let p of l)n.push(We({...p,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(E(t,o?C.red:C.yellow,a)),n.join(`
|
|
31
|
+
`)}var Xe,C,E,J=A(()=>{Xe={"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"};C={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},E=(e,t,r)=>e?`${t}${r}${C.reset}`:r});function Or(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 Ye(e,t){if(!e)return null;let r=Gt(e).replace(/[?#].*$/,""),n=t?Gt(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 Tr(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 Lr(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function Pr(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function Cr(e,t){if(!e||!t)return null;let r=String(e);return/node_modules|[\\/]vite[\\/]|@veluai[\\/]/.test(r)?null:r}function pe(e,t={}){let{projectDir:r="",knownComponents:n=[],file:o=null}=t,i=null;for(let h=e,w=0;h&&w<6;h=h.cause,w+=1)if(h.veluIssue){i=h.veluIssue;break}if(i)return j({...i,file:i.file||o});let a=Or(e)||{},s=a.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(s);if(l){let h=l[1],w=/referenced in your code at `(\d+):(\d+)/.exec(s),F=/\bin `([^`]+)`/.exec(s),b=F?Ye(F[1],r):null;return j({category:"unknown-component",file:b||o,line:w?Number(w[1]):null,column:w?Number(w[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:we(h,n)})}let p=a.loc||(a.line!=null?{line:a.line,column:a.column,file:a.file}:null)||Lr(a.reason||s),c=a.id||p&&p.file||a.file||null,u=Ye(c,r)||o,x=!!u&&Ye(c,r)!=null,d=Cr(a.frame,x||!!o),$=Tr(Pr(a.reason||s)),m=_r.test(s),L=a.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(s)||p&&p.line===1&&/unexpected|expected/i.test(s)&&/---/.test(s);return p||m||d&&x?j({category:L?"frontmatter":"mdx-syntax",file:u,line:p?p.line:null,column:p?p.column:null,frame:d,title:$||(L?"Invalid frontmatter":"MDX syntax error"),detail:"",hint:L?"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)?j({category:"invalid-props",file:u,title:"A component received an invalid value",detail:$,hint:"Check the props/options you passed to a component on this page."}):j({category:"render-crash",file:u,title:"This page failed to render",detail:$,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var Gt,_r,Ke=A(()=>{J();Gt=e=>String(e).replace(/\\/g,"/");_r=/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 Er(e){let t=Xe[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">${R(t)}</span>`),n.push("</div>"),e.title&&n.push(`<div class="velu-err-title">${R(e.title)}</div>`),r&&n.push(`<a class="velu-err-loc" title="${R(r)}">${R(r)}</a>`),e.detail&&n.push(`<div class="velu-err-detail">${R(e.detail)}</div>`),e.frame&&n.push(`<pre class="velu-err-frame">${R(e.frame)}</pre>`),e.suggestion&&n.push(`<div class="velu-err-suggest">Did you mean <code><${R(e.suggestion)}></code>?</div>`),e.hint&&n.push(`<div class="velu-err-hint">${R(e.hint)}</div>`),n.push("</div>"),n.join("")}function Ze(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(Er).join(`
|
|
32
32
|
`);return`<!doctype html>
|
|
33
33
|
<html lang="en">
|
|
34
34
|
<head>
|
|
@@ -95,26 +95,26 @@ ${L.join(`,
|
|
|
95
95
|
<body>
|
|
96
96
|
<div class="velu-err-wrap">
|
|
97
97
|
<div class="velu-err-brand">velu</div>
|
|
98
|
-
<h1 class="velu-err-h">${
|
|
98
|
+
<h1 class="velu-err-h">${R(n)}</h1>
|
|
99
99
|
${o}
|
|
100
100
|
<div class="velu-err-foot">Fix the file and save \u2014 this page reloads automatically.</div>
|
|
101
101
|
</div>
|
|
102
102
|
</body>
|
|
103
|
-
</html>`}var
|
|
104
|
-
`).length}function
|
|
105
|
-
`).length}function
|
|
106
|
-
`).length}function
|
|
107
|
-
${e}`;let
|
|
103
|
+
</html>`}var R,Jt=A(()=>{J();R=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")});var V,Qe=A(()=>{V=["Callout","Card","CardGroup","Accordion","AccordionGroup","Columns","Field","Prompt","Steps","Step","Tree","Folder","File","Image","CodeBlock","CodeGroup","MethodBadge","ApiPath","TryItBar","ApiField","ApiClient","ApiSidebar"]});import ke from"node:fs";import me from"node:path";import{fileURLToPath as Fr}from"node:url";import Nr from"iso-639-1";function fe(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
|
|
104
|
+
`).length}function Ur(e,t){return t==null||t<0?null:e.slice(0,t).split(`
|
|
105
|
+
`).length}function et(e,t){if(!t)return null;let r=e.indexOf(`"${t}"`);return r===-1?null:e.slice(0,r).split(`
|
|
106
|
+
`).length}function Mr(e,t,r){let n=[];return s(e,t,"",null),n;function o(l){if(l&&l.$ref){let p=l.$ref.replace(/^#\//,"").split("/"),c=r;for(let u of p)c=c?.[u];return c||{}}return l}function i(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function a(l,p){let c=n.length;s(l,p,"",null,!0);let u=n.length===c;return u||(n.length=c),u}function s(l,p,c,u,x){let d=o(p);if(d){if(d.oneOf){d.oneOf.some(m=>a(l,m))||n.push({path:c,key:u,message:"value does not match any allowed shape"});return}if(d.type&&i(l)!==d.type){n.push({path:c,key:u,message:`expected ${d.type}, got ${i(l)}`});return}if(d.type==="string"&&d.minLength!=null&&l.length<d.minLength&&n.push({path:c,key:u,message:"must not be empty"}),d.type==="object"&&i(l)==="object"){for(let m of d.required||[])m in l||n.push({path:c?`${c}.${m}`:m,key:m,message:`missing required "${m}"`});let $=d.properties||{};if(d.additionalProperties===!1)for(let m of Object.keys(l))m in $||n.push({path:c?`${c}.${m}`:m,key:m,message:`unknown field "${m}"`});for(let[m,L]of Object.entries($))m in l&&s(l[m],L,c?`${c}.${m}`:m,m,x)}d.type==="array"&&Array.isArray(l)&&d.items&&l.forEach(($,m)=>s($,d.items,`${c}[${m}]`,u,x))}}}function zr(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 Ae(e){let t=[],r=me.join(e,"velu.json"),n;try{n=ke.readFileSync(r,"utf-8")}catch(s){return s.code==="ENOENT"?t.push(j({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(j({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||""),p=l?Ur(n,Number(l[1])):null;return t.push(j({category:"config-json",file:"velu.json",line:p,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(ke.readFileSync(Rr,"utf-8"))}catch{}if(i)for(let s of Mr(o,i,i)){let l=/^unknown field/.test(s.message);t.push(j({category:"config-schema",severity:l?"warning":"error",file:"velu.json",line:fe(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&&!zr(l)&&t.push(j({category:"config-schema",severity:"warning",file:"velu.json",line:fe(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=me.resolve(e,o.favicon.replace(/^\/+/,""));ke.existsSync(s)||t.push(j({category:"config-asset",file:"velu.json",line:fe(n,"favicon"),title:`favicon not found: ${o.favicon}`,hint:"The path is relative to the project root."}))}let a=oe(o.logo);if(a){let s=new Map;for(let l of["light","dark"]){let p=a[l];p&&s.set(p,[...s.get(p)||[],l])}for(let[l,p]of s)if(!ke.existsSync(me.resolve(e,l.replace(/^\/+/,"")))){let c=p.length===2?"logo":`logo (${p[0]})`;t.push(j({category:"config-asset",file:"velu.json",line:et(n,l),title:`${c} not found: ${l}`,hint:"The path is relative to the project root."}))}}if(o.navigation&&typeof o.navigation=="object"){let s;try{s=M(o.navigation)}catch(l){t.push(j({category:"config-nav",file:"velu.json",line:fe(n,"navigation"),title:"navigation could not be processed",detail:String(l.message||"")})),s=null}if(s){let{pageEntries:l,warnings:p}=z(s,e);for(let c of p){let u=/not found$/.test(c),x=/page "([^"]+)"/.exec(c),d=x?et(n,x[1]):null;t.push(j({category:"config-nav",severity:u?"error":"warning",file:"velu.json",line:d,title:c,hint:u?"Create the .mdx file, or remove the page from navigation.":""}))}Br(s,n,t)}}return t}function Br(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();Nr.validate(a)||r.push(j({category:"config-nav",severity:"warning",file:"velu.json",line:et(t,i.language)||fe(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 Ir,Rr,tt=A(()=>{J();B();le();ie();Ir=me.dirname(Fr(import.meta.url)),Rr=me.resolve(Ir,"..","..","schema","velu.schema.json")});import Gr from"node:fs/promises";import Jr from"node:fs";import q from"node:path";import{fileURLToPath as Vr,pathToFileURL as qr}from"node:url";import{compile as Hr}from"@mdx-js/mdx";import Dr from"remark-frontmatter";import Xr from"remark-mdx-frontmatter";import Wr from"remark-gfm";import Yr from"rehype-slug";import{visit as Kr}from"unist-util-visit";function nt(){if(je)return je;let e=q.dirname(Vr(import.meta.url)),t=[q.resolve(e,"..","runtime","velu-ui"),q.resolve(e,"..","..","runtime","velu-ui"),q.resolve(e,"..","..","..","velu-ui","src")],r=null;for(let n of t){let o=q.join(n,"lib","component-schemas.js");if(Jr.existsSync(o)){r=o;break}}return je=r?import(qr(r).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),je}function Zr(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 Qr(e,t){return()=>r=>{Kr(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:Zr(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 eo(e,t){let r=[],n;try{n=await Gr.readFile(t.fileAbsPath,"utf-8")}catch{return r}let o=q.relative(e,t.fileAbsPath).split(q.sep).join("/"),i=[],a=new Set;try{await Hr({value:n,path:t.fileAbsPath},{remarkPlugins:[Dr,Xr,Wr,se,Qr(i,a)],rehypePlugins:[Yr],providerImportSource:"@mdx-js/react"})}catch(c){return r.push(pe(c,{projectDir:e,knownComponents:V,file:o})),r}let s=new Set(V),l=await nt(),p=new Set;for(let c of i)if(!a.has(c.name)){if(!s.has(c.name)){if(p.has(c.name))continue;p.add(c.name),r.push(j({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:we(c.name,V)}));continue}if(l){let u=l(c.name,c.props,{checkRequired:!1});u&&r.push(j({...u,file:o,line:c.line,column:c.column}))}}return r}async function Vt(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 eo(e,s);for(let p of l)n.push(p)}}return await Promise.all(Array.from({length:Math.min(o,r.length)},a)),n}var je,rt=A(()=>{ze();J();Ke();Qe()});import Oe from"node:fs";import ot from"node:path";import Dt from"js-yaml";function it(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=>it(o,t,r+1));else{n={};for(let[o,i]of Object.entries(e))n[o]=it(i,t,r+1)}return t.delete(e),n}function Xt(e){return Dt.dump(it(e,new Set,0),{noRefs:!0,lineWidth:100,skipInvalid:!0})}function Wt(e){let t=String(e).replace(/\.md$/i,"");return t===""||t==="/"||t==="/index"?"/":t.replace(/\/+$/,"")||"/"}function to(e){return e==="/"?"/index.md":`${e}.md`}function st(e,t){if(t==="api")return`# ${qt}
|
|
107
|
+
${e}`;let r=e.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/),n=`> ${qt}
|
|
108
108
|
|
|
109
|
-
`;return
|
|
110
|
-
`)}async function
|
|
109
|
+
`;return r?e.slice(0,r[0].length)+n+e.slice(r[0].length):n+e}function ro(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function oo(e){try{let t=Oe.readFileSync(e,"utf-8").match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return{};let r=Dt.load(t[1]);return r&&typeof r=="object"?r:{}}catch{return{}}}async function de(e){let t={};try{t=JSON.parse(Oe.readFileSync(ot.join(e,"velu.json"),"utf-8"))}catch{return{name:ot.basename(e),baseUrl:"",pages:[]}}let r=t.name??ot.basename(e),n=typeof t.url=="string"?t.url.replace(/\/+$/,""):"",o=I(t.api),i=t.navigation??{},a={};try{let u=await xe(t.navigation??{},{targetDir:e,api:o});i=u.nav,a=u.ops}catch(u){console.warn(`[velu] openapi: ${u.message}`)}let s=M(i),{pageEntries:l}=z(s,e),p=new Map(l.map(u=>[u.url,u])),c=[];for(let u of W(s)){if(!u.url)continue;let x=u.ancestors.filter(h=>h.kind==="group").pop(),d=u.ancestors.filter(h=>h.kind==="tab").pop(),$=x?.label||d?.label||"Pages",m=u.ancestors.filter(h=>h.kind==="tab"||h.kind==="group").map(h=>h.label),L=u.ancestors.filter(h=>h.kind==="language").pop()?.code||null;if(u.node?.api){let h=a[u.pagePath];if(!h)continue;let w=h.title||Ht(u.url);c.push({url:u.url,title:w,description:h.description||"",group:$,breadcrumb:[...m,w],lang:L,frontmatter:{title:h.title,description:h.description},source:{kind:"api",segment:h.segment}})}else{let h=p.get(u.url);if(!h||!h.exists)continue;let w=oo(h.fileAbsPath),F=w.title||Ht(u.url);c.push({url:u.url,title:F,description:w.description||"",group:$,breadcrumb:[...m,F],lang:L,frontmatter:w,source:{kind:"mdx",fileAbsPath:h.fileAbsPath}})}}return{name:r,baseUrl:n,pages:c}}function Le(e){return new Map(e.pages.map(t=>[t.url,{...t.source,title:t.title}]))}async function io(e){return Le(await de(e))}async function at(e,t,r){let o=(r||await io(e)).get(t);if(!o)return null;if(o.kind==="mdx")try{return{body:Oe.readFileSync(o.fileAbsPath,"utf-8"),contentType:"text/markdown; charset=utf-8",kind:"mdx"}}catch{return null}return o.segment?{body:Xt(o.segment),contentType:"text/yaml; charset=utf-8",kind:"api"}:null}async function Yt(e,t){let r=t||await de(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 ${Te} 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(to(l.url))})${l.description?`: ${l.description}`:""}`);o.push("")}return o.join(`
|
|
110
|
+
`)}async function Kt(e,t){let r=t||await de(e),n=[`# ${r.name}`,"",`> Full documentation \u2014 every page concatenated. Index: ${K}`];for(let o of r.pages)if(n.push("","---","",`# ${o.title}`,`Source: ${o.url}`,""),o.source.kind==="mdx")try{n.push(ro(Oe.readFileSync(o.source.fileAbsPath,"utf-8")).trim())}catch{}else o.source.segment&&n.push("```yaml",Xt(o.source.segment).trim(),"```");return n.join(`
|
|
111
111
|
`)+`
|
|
112
|
-
`}var
|
|
113
|
-
`+
|
|
114
|
-
`),process.env.VELU_DEBUG&&t&&console.error(t)}function
|
|
115
|
-
`)}function
|
|
116
|
-
`+
|
|
117
|
-
`),f}let l=e;try{l=Q.realpathSync(e)}catch{}let p=0,
|
|
118
|
-
${
|
|
119
|
-
</style>`,
|
|
120
|
-
`),
|
|
112
|
+
`}var K,Te,no,Z,qt,Ht,Zt=A(()=>{B();le();ie();De();K="/llms.txt",Te="/llms-full.txt",no=`<${K}>; rel="llms-txt", <${Te}>; rel="llms-full-txt"`,Z={Link:no,"X-Llms-Txt":K},qt=`Full documentation index: ${K}`;Ht=e=>(e.split("/").filter(Boolean).pop()||"Home").replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase())});var sn={};Fe(sn,{startDevServer:()=>So});import Qt from"node:fs/promises";import Q from"node:fs";import so from"node:http";import{spawn as ao}from"node:child_process";import P from"node:path";import{fileURLToPath as lo}from"node:url";import co from"chokidar";import en from"express";import{createServer as uo,searchForWorkspaceRoot as po}from"vite";function yo(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 tn(e,t){let r=We(e,{color:!!process.stderr.isTTY});console.error(`
|
|
113
|
+
`+r+`
|
|
114
|
+
`),process.env.VELU_DEBUG&&t&&console.error(t)}function vo(){try{return JSON.parse(Q.readFileSync(P.join(Pe,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function bo(e,t){let r=P.resolve(e,".velu"),n=P.resolve(r,".velu-version"),o=null;try{o=Q.readFileSync(n,"utf8").trim()}catch{}if(o!==t){if(o!==null)try{Q.rmSync(P.join(r,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{Q.mkdirSync(r,{recursive:!0}),Q.writeFileSync(n,t)}catch{}}}async function nn(e){try{return await mt(e)}catch{return Me({},P.basename(e))}}async function rn(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&&mo.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(`
|
|
115
|
+
`)}function wo(e,t){let r=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},n=process.stdout.isTTY,o=u=>n&&process.stdout.write(`\x1B]${u}\x1B\\`),i=()=>{o(`0;\u23F3 ${t}`),o("9;4;3;0")},a=()=>{o(`0;${t}`),o("9;4;0;0")};if(n&&process.once("exit",()=>o("9;4;0;0")),i(),!e)return console.log("Starting Velu\u2026"),{ready:u=>{console.log(`Velu ready \u2192 ${u}`),a(),r()}};let s="\x1B[38;2;220;20;60m",l="\x1B[0m";console.log("");for(let u of xo)console.log(`${s}${u}${l}`);console.log("");let p=null;try{p=ao(process.execPath,["-e",$o],{stdio:["ignore","inherit","ignore"]}),p.on("error",()=>{})}catch{}let c=()=>{if(p){try{p.kill()}catch{}p=null}};return process.once("exit",c),{ready:u=>{c(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${l} Velu ready \u2192 \x1B[36m${u}${l}`),a(),r()}}}async function So(e){let t=!!process.env.VELU_PROFILE,r=performance.now(),n=(y,f)=>t&&console.log(`[velu-profile] ${y}: ${(performance.now()-f).toFixed(0)}ms`),o=wo(!!process.stdout.isTTY&&!t,P.basename(e)),i=await nn(e),a=s();function s(){let f=Ae(e).filter(g=>g.severity==="error"&&(g.category==="config-json"||g.category==="config-schema"));return f.length&&console.error(`
|
|
116
|
+
`+Se(f,{color:!!process.stderr.isTTY})+`
|
|
117
|
+
`),f}let l=e;try{l=Q.realpathSync(e)}catch{}let p=0,c=y=>{let f=performance.now();if(f-p<500)return;p=f;let g=pe(y,{projectDir:l,knownComponents:V});tn(g,y)};process.on("unhandledRejection",c),process.on("uncaughtException",c);let u=Number(process.env.PORT)||8358,x=await nt();bo(e,vo());let d=en(),$=so.createServer(d),m=await uo({...zt({targetDir:e,VITE_ROOT:Pe,validateProps:x}),appType:"custom",logLevel:t?"info":"warn",server:{middlewareMode:!0,fs:{allow:[po(Pe),e,l]},hmr:{server:$}}});n("vite server created",r),d.use(m.middlewares),d.get(new RegExp(`^${Ue}(\\.[a-z0-9]+)?$`,"i"),async(y,f)=>{if(!i.favicon)return f.status(404).end();let g=P.resolve(e,i.favicon.replace(/^\//,""));f.sendFile(g,v=>{v&&f.status(404).end()})});let L=y=>(f,g)=>{let v=i.logo?.[y];if(!v)return g.status(404).end();g.sendFile(P.resolve(e,v.replace(/^\//,"")),O=>{O&&g.status(404).end()})};d.get(ye,L("light")),d.get(ve,L("dark")),d.post("/@velu-api-proxy",en.json({limit:"8mb"}),async(y,f)=>{let{method:g="GET",url:v,headers:O={},body:S}=y.body||{};if(typeof v!="string"||!/^https?:\/\//i.test(v))return f.status(400).json({error:"A valid http(s) target URL is required."});try{let k=await fetch(v,{method:g,headers:O,body:S!=null&&S!==""?S:void 0}),N=await k.text(),H=k.headers.get("content-type")||"",T={};k.headers.forEach((ee,Ee)=>{T[Ee]=ee});let U=N;if(/json/i.test(H))try{U=JSON.parse(N)}catch{}f.json({status:k.status,statusText:k.statusText,headers:T,body:U})}catch(k){f.json({error:`Request failed: ${k.message}`})}});let h=null,w=async()=>h||=await de(e);d.get(/\.md$/i,async(y,f,g)=>{try{let v=await w(),O=await at(e,Wt(decodeURIComponent(y.path)),Le(v));if(!O)return g();f.status(200).set({"Content-Type":O.contentType,...Z}).end(st(O.body,O.kind))}catch{g()}}),d.get(K,async(y,f,g)=>{try{let v=await Yt(e,await w());f.status(200).set({"Content-Type":"text/plain; charset=utf-8",...Z}).end(v)}catch{g()}}),d.get(Te,async(y,f,g)=>{try{let v=await Kt(e,await w());f.status(200).set({"Content-Type":"text/plain; charset=utf-8",...Z}).end(v)}catch{g()}}),d.use("*",async(y,f,g)=>{let v=y.originalUrl,O=performance.now();if(/text\/markdown/i.test(y.headers.accept||""))try{let S=await w(),k=await at(e,gt(v),Le(S));if(k)return f.status(200).set({"Content-Type":k.contentType,...Z}).end(st(k.body,k.kind))}catch{}if(a.length)return f.status(200).set({"Content-Type":"text/html"}).end(Ze(a,{title:"Fix velu.json to continue"}));try{let S=performance.now(),k=await Qt.readFile(on,"utf-8");k=await m.transformIndexHtml(v,k),n(`transformIndexHtml ${v}`,S);let N="/src/runtime/server-entry.jsx";S=performance.now();let{render:H}=await m.ssrLoadModule(N);n(`ssrLoadModule ${v} (1st req includes dep pre-bundle)`,S),S=performance.now();let T=await H(v);n(`render ${v}`,S),S=performance.now();let U=await rn(m,N);n(`collectSsrCss ${v}`,S);let ee=U?`<style data-velu-ssr>${U}</style>`:"",Ee=`<style data-velu-config>
|
|
118
|
+
${dt(i)}
|
|
119
|
+
</style>`,fn=go.has(i.font.family)?"":yo(i.font.family),ge=ft(i),mn=ge?`<link rel="icon"${ge.type?` type="${ge.type}"`:""} href="${ge.url}" />`:"",dn=[ee,Ee,fn,mn].filter(Boolean).join(`
|
|
120
|
+
`),gn=k.replace("<!--app-title-->",ho(i.name)).replace("<!--app-head-->",dn).replace("<!--app-html-->",T);f.status(200).set({"Content-Type":"text/html",...Z}).end(gn),n(`TOTAL ${v}`,O)}catch(S){m.ssrFixStacktrace(S);let k=pe(S,{projectDir:l,knownComponents:V});tn(k,S),f.status(200).set({"Content-Type":"text/html"}).end(Ze([k]))}}),co.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(y,f)=>{console.log(`[velu-cli] content ${y}: ${P.relative(e,f)}`);let g=P.basename(f)==="velu.json",v=f.endsWith(".mdx"),O=g||v&&(y==="add"||y==="unlink");if((O||v||/\.(ya?ml|json)$/i.test(f))&&(h=null),g&&(i=await nn(e),a=s()),O)m.moduleGraph.invalidateAll();else if(v){let S=f.split(P.sep).join("/"),k=m.moduleGraph.getModulesByFile(S);if(k)for(let N of k)m.moduleGraph.invalidateModule(N)}m.ws.send({type:"full-reload"})});async function b(y){let f=new Set,g=12,v=0,O=[],S=()=>v<g?(v+=1,Promise.resolve()):new Promise(T=>O.push(T)).then(()=>{v+=1}),k=()=>{v-=1,O.shift()?.()},N=T=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(T)||/[\\/]node_modules[\\/]/.test(T)&&!/velu-ui/.test(T);async function H(T){if(!(!T||f.has(T)||N(T))){f.add(T);try{await S();try{await m.transformRequest(T,{ssr:!1})}finally{k()}let U=await m.moduleGraph.getModuleByUrl(T,!1);U?.importedModules?.size&&await Promise.all([...U.importedModules].map(ee=>H(ee.url)))}catch{}}}return await H(y),f.size}$.listen(u,async()=>{let y=performance.now(),f=0;try{let{render:g}=await m.ssrLoadModule("/src/runtime/server-entry.jsx");await b("/src/runtime/client-entry.jsx"),typeof m.waitForRequestsIdle=="function"&&await m.waitForRequestsIdle();let[v]=await Promise.allSettled([b("/src/runtime/client-entry.jsx"),g("/"),m.transformIndexHtml("/",await Qt.readFile(on,"utf-8")),rn(m,"/src/runtime/server-entry.jsx")]).then(O=>O.map(S=>S.status==="fulfilled"?S.value:0));f=v}catch(g){t&&console.log("[velu-profile] warmup error:",g?.message)}n(`cold-start warm-up (${f} client modules)`,y),o.ready(`http://localhost:${u}`)})}var fo,mo,go,ho,Pe,on,xo,$o,an=A(()=>{ie();Bt();Ke();Jt();J();Qe();tt();rt();Zt();B();fo=P.dirname(lo(import.meta.url)),mo=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,go=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),ho=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");Pe=P.resolve(fo,".."),on=P.resolve(Pe,"src","template.html"),xo=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],$o="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 cn={};Fe(cn,{default:()=>Oo,runValidate:()=>ln});import ko from"node:fs";import Ao from"node:path";function jo(e){try{let t=JSON.parse(ko.readFileSync(Ao.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let r=M(t.navigation);return z(r,e).pageEntries}catch{return[]}}async function ln(e){let t=Ae(e),r=jo(e),n=await Vt(e,r),o=[...t,...n],i=!!process.stdout.isTTY;return console.log(Se(o,{color:i})),o.some(s=>s.severity!=="warning"&&s.severity!=="info")?1:0}var Oo,un=A(()=>{B();le();tt();rt();J();Oo=ln});import _e from"node:path";import _ from"node:process";import{readFileSync as To}from"node:fs";var[,,pn,Ce]=_.argv;function Lo(){try{return JSON.parse(To(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}function Po(){let e=_.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 _o(){switch(pn){case"--version":case"-v":case"version":{console.log(Lo());break}case"init":{Ce||(console.error("Usage: velu init <project-name>"),_.exit(1));let e=Ce,t=_e.resolve(_.cwd(),e),{initProject:r}=await Promise.resolve().then(()=>(ut(),ct));await r(t,e);break}case"dev":{let e=_e.resolve(_.cwd(),Ce??"."),{startDevServer:t}=await Promise.resolve().then(()=>(an(),sn));await t(e);break}case"validate":{let e=_e.resolve(_.cwd(),Ce??"."),{runValidate:t}=await Promise.resolve().then(()=>(un(),cn)),r=await t(e);_.exit(r);break}case"build":{let e=_e.resolve(_.cwd(),Po()??"."),t=_.argv.indexOf("--out"),r=t>-1?_.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."),_.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 dev [dir] start the dev preview server"),console.log(" velu validate [dir] check velu.json + content for problems"),_.exit(pn?1:0)}}_o().catch(e=>{console.error(_.env.VELU_DEBUG?e:`Error: ${e.message}`),_.exit(1)});
|