@veluai/velu 0.1.11 → 0.1.13
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 +18 -18
- package/package.json +5 -2
- package/runtime/velu-ui/components/ErrorCard.jsx +138 -138
- package/runtime/velu-ui/components/theme-toggle.css +101 -70
- package/runtime/velu-ui/index.js +46 -46
- package/runtime/velu-ui/lib/component-schemas.js +100 -100
- package/runtime/velu-ui/lib/copyText.js +64 -64
- package/runtime/velu-ui/mdx-components.jsx +105 -105
- package/src/lib/extract-mdx-error.js +170 -0
- package/src/lib/issues.js +159 -0
- package/src/lib/known-components.js +34 -0
- package/src/runtime/App.jsx +1476 -1476
- package/src/runtime/ErrorBoundary.jsx +54 -54
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,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`,"utf-8");let r=await
|
|
4
|
-
`)}var
|
|
2
|
+
var ft=Object.defineProperty;var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var ue=(e,t)=>{for(var o in t)ft(e,o,{get:t[o],enumerable:!0})};var Ae={};ue(Ae,{initProject:()=>gt});import z from"node:fs/promises";import V from"node:path";import{fileURLToPath as pt}from"node:url";async function gt(e,t){try{if((await z.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 z.mkdir(e,{recursive:!0}),await z.cp(dt,e,{recursive:!0});let o=V.join(e,"velu.json"),n=JSON.parse(await z.readFile(o,"utf-8"));n.name=t,await z.writeFile(o,JSON.stringify(n,null,2)+`
|
|
3
|
+
`,"utf-8");let r=await je(e);console.log(`[velu] created ${t}/`);for(let s of r)console.log(` ${s}`);console.log(""),console.log("Next steps:"),console.log(` cd ${t}`),console.log(" velu dev")}async function je(e,t=e,o=[]){let n=await z.readdir(e,{withFileTypes:!0});for(let r of n){let s=V.join(e,r.name);r.isDirectory()?await je(s,t,o):o.push(V.relative(t,s).split(V.sep).join("/"))}return o.sort()}var mt,dt,Pe=k(()=>{mt=V.dirname(pt(import.meta.url)),dt=V.resolve(mt,"..","templates","starter")});import{visit as ht}from"unist-util-visit";import{toString as vt}from"mdast-util-to-string";import yt from"github-slugger";import{valueToEstree as xt}from"estree-util-value-to-estree";function Y(){return e=>{let t=new yt,o=[];ht(e,"heading",i=>{let a=vt(i);o.push({depth:i.depth,id:t.slug(a),label:a})});let n={children:[]},r=[{node:n,depth:0}];for(let i of o){for(;r.length>1&&r[r.length-1].depth>=i.depth;)r.pop();let a={id:i.id,label:i.label},l=r[r.length-1].node;l.children||(l.children=[]),l.children.push(a),r.push({node:a,depth:i.depth})}let s=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:xt(s)}]}}]}}})}}var fe=k(()=>{});import wt from"node:fs/promises";import Ce from"node:path";function pe(e={},t){let o=e.colors?.primary??bt;return{name:e.name??t??"docs",colors:{primary:o,light:e.colors?.light??o,dark:e.colors?.dark??o},favicon:e.favicon??null,font:{family:e.font?.family??kt},navigation:e.navigation??null}}async function Ee(e){let t=Ce.join(e,"velu.json"),o;try{o=await wt.readFile(t,"utf-8")}catch(r){throw r.code==="ENOENT"?new Error(`No velu.json found in ${e}. Run \`velu init <name>\` to scaffold one.`):r}let n;try{n=JSON.parse(o)}catch(r){throw new Error(`velu.json is not valid JSON: ${r.message}`)}return pe(n,Ce.basename(e))}function Te(e){let{colors:t,font:o}=e;return[":root:root {",` --accent-color: ${t.light};`,` --font-sans: "${o.family}", sans-serif;`,"}",':root:root[data-theme="dark"] {',` --accent-color: ${t.dark};`,"}"].join(`
|
|
4
|
+
`)}var bt,kt,_e=k(()=>{bt="#dc143c",kt="Google Sans Flex"});import St from"github-slugger";import $t from"iso-639-1";function At(e){let t=String(e).toLowerCase();return $t.getNativeName(t)||e}function ee(e){return new St().slug(String(e??""))}function Pt(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function B(e){let t={kind:"root",children:H(e??{})};return Le(t.children),t}function H(e){let t=Array.isArray(e.anchors)?e.anchors.map(Ot):[];if(Array.isArray(e.products))return[...t,...e.products.map(Ct)];if(Array.isArray(e.versions))return[...t,...e.versions.map(Et)];if(Array.isArray(e.languages))return[...t,...e.languages.map(Tt)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(_t)];let o=[...t];return Array.isArray(e.groups)&&o.push(...e.groups.map(Oe)),Array.isArray(e.pages)&&o.push(...e.pages.map(Ne)),o}function Ct(e){return{kind:"product",label:e.name??e.product,slug:ee(e.product),icon:e.icon,color:e.color,default:!!e.default,children:H(e)}}function Et(e){return{kind:"version",label:e.version,slug:ee(e.version),default:!!e.default,children:H(e)}}function Tt(e){let t=String(e.language);return{kind:"language",code:t,label:At(t),slug:ee(t),default:!!e.default,children:H(e)}}function _t(e){return{kind:"tab",label:e.tab,slug:ee(e.tab),icon:e.icon,href:e.href,children:H(e)}}function Ot(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function Oe(e){let t=(e.pages??[]).map(Ne);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 Ne(e){return typeof e=="string"?{kind:"page",pagePath:e}:Oe(e)}function Le(e){for(let t of jt){let o=e.filter(n=>n.kind===t);o.length&&!o.some(n=>n.default)&&(o[0].default=!0)}for(let t of e)t.children&&Le(t.children)}function Fe(e){let t=[],o=(n,r,s)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Nt(n.pagePath,r),ctx:{...r},ancestors:s,node:n});return}let i=r;n.kind==="product"?i={...r,product:n.default?null:n.slug}:n.kind==="version"?i={...r,version:n.default?null:n.slug}:n.kind==="language"&&(i={...r,language:n.default?null:n.slug});let a=n.kind==="root"?s:[...s,n];for(let l of n.children??[])o(l,i,a)};return o(e,{product:null,version:null,language:null},[]),t}function Nt(e,t){let o=[t.product,t.version,t.language].filter(Boolean),n=Pt(e).split("/").filter(Boolean);return"/"+[...o,...n].join("/")}var jt,W=k(()=>{jt=["product","version","language"]});import Lt from"node:fs";import Ie from"node:path";function G(e,t){let o=[],n=[],r=new Set;for(let s of Fe(e)){if(r.has(s.url)){o.push(`duplicate URL "${s.url}" (page "${s.pagePath}") \u2014 keeping the first occurrence`);continue}r.add(s.url);let i=s.pagePath.replace(/^\/+|\/+$/g,""),a=Ie.join(t,...i.split("/"))+".mdx",l=Lt.existsSync(a);l||o.push(`page "${s.pagePath}" \u2192 ${Ie.relative(t,a)} not found`),n.push({pagePath:s.pagePath,url:s.url,fileAbsPath:a,exists:l})}return{pageEntries:n,warnings:o}}var te=k(()=>{W()});import Ft from"node:fs";import ne from"node:path";function Ue(e){return{name:"velu-site",resolveId(t){return t===Me?Re:null},load(t){return t!==Re?null:It(e)}}}function It(e){let t={};try{t=JSON.parse(Ft.readFileSync(ne.join(e,"velu.json"),"utf-8"))}catch{}let o=B(t.navigation??{}),{pageEntries:n,warnings:r}=G(o,e);for(let l of r)console.warn(`[velu] nav: ${l}`);let s=[],i=[],a=0;for(let l of n)if(l.exists){let u=JSON.stringify(l.fileAbsPath.split(ne.sep).join("/")),c=JSON.stringify(ne.relative(e,l.fileAbsPath).split(ne.sep).join("/")),f=`__p${a++}`;s.push(`import * as ${f} from ${u};`),i.push(` ${JSON.stringify(l.url)}: { Component: ${f}.default, frontmatter: ${f}.frontmatter, toc: ${f}.toc, relPath: ${c} },`)}else i.push(` ${JSON.stringify(l.url)}: { missing: true },`);return["// AUTO-GENERATED by vite-plugin-velu-site. Do not edit.",s.join(`
|
|
5
5
|
`),"","export const pages = {",i.join(`
|
|
6
6
|
`),"};",`export const navigation = ${JSON.stringify(o)};`,""].join(`
|
|
7
|
-
`)}var
|
|
8
|
-
`))s.push(` ${i}`);return e.suggestion&&s.push(` ${
|
|
9
|
-
`)}function
|
|
10
|
-
`)}var
|
|
7
|
+
`)}var Me,Re,ze=k(()=>{W();te();Me="virtual:velu-site",Re="\0"+Me});function h(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 Rt(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 o=Array.from({length:t.length+1},(r,s)=>s),n=new Array(t.length+1);for(let r=1;r<=e.length;r++){n[0]=r;for(let s=1;s<=t.length;s++){let i=e[r-1]===t[s-1]?0:1;n[s]=Math.min(n[s-1]+1,o[s]+1,o[s-1]+i)}[o,n]=[n,o]}return o[t.length]}function oe(e,t=[]){if(!e)return null;let o=String(e).toLowerCase(),n=null,r=1/0;for(let i of t){let a=Rt(o,String(i).toLowerCase());a<r&&(r=a,n=i)}let s=Math.min(3,Math.max(2,Math.floor(o.length/4)));return r<=s?n:null}function Mt(e,t){return e==="warning"?P(t,$.yellow,"\u26A0"):e==="info"?P(t,$.cyan,"\u2139"):P(t,$.red,"\u2716")}function de(e,{color:t=!1}={}){let o=me[e.category]||e.category,n=e.line?`${e.line}${e.column?`:${e.column}`:""}`:"",r=e.file?`${e.file}${n?`:${n}`:""}`:n,s=[];if(s.push(`${Mt(e.severity,t)} ${P(t,$.bold,o)}`+(r?` ${P(t,$.dim,r)}`:"")),e.title&&s.push(` ${e.title}`),e.detail&&e.detail!==e.title&&s.push(` ${P(t,$.dim,e.detail)}`),e.frame)for(let i of String(e.frame).split(`
|
|
8
|
+
`))s.push(` ${i}`);return e.suggestion&&s.push(` ${P(t,$.cyan,`Did you mean <${e.suggestion}>?`)}`),e.hint&&s.push(` ${P(t,$.dim,`\u2192 ${e.hint}`)}`),s.join(`
|
|
9
|
+
`)}function re(e,{color:t=!1}={}){if(!e.length)return P(t,$.cyan,"\u2713 No issues found.");let o=new Map;for(let a of e){let l=a.file||"velu.json";o.has(l)||o.set(l,[]),o.get(l).push(a)}let n=[];for(let[a,l]of o){n.push(P(t,$.bold,a));for(let u of l)n.push(de({...u,file:null},{color:t}).replace(/^/gm," "));n.push("")}let r=e.filter(a=>a.severity!=="warning"&&a.severity!=="info").length,s=e.length-r,i=`${r} error${r===1?"":"s"}`+(s?`, ${s} warning${s===1?"":"s"}`:"");return n.push(P(t,r?$.red:$.yellow,i)),n.join(`
|
|
10
|
+
`)}var me,$,P,I=k(()=>{me={"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"};$={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},P=(e,t,o)=>e?`${t}${o}${$.reset}`:o});function Ut(e){let t=e,o=0;for(;t&&t.cause&&o<3&&!(t.loc||t.line||/`[^`]+` to be defined/.test(t.message||""));)t=t.cause,o+=1;return t||e}function ge(e,t){if(!e)return null;let o=Ve(e).replace(/[?#].*$/,""),n=t?Ve(t).replace(/\/+$/,""):"";return n&&o.toLowerCase().startsWith(n.toLowerCase())?o.slice(n.length).replace(/^\/+/,""):!/^([a-zA-Z]:\/|\/)/.test(o)&&!/node_modules/.test(o)?o:null}function zt(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 Vt(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function Bt(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function Jt(e,t){if(!e||!t)return null;let o=String(e);return/node_modules|[\\/]vite[\\/]|@veluai[\\/]/.test(o)?null:o}function K(e,t={}){let{projectDir:o="",knownComponents:n=[],file:r=null}=t,s=null;for(let C=e,E=0;C&&E<6;C=C.cause,E+=1)if(C.veluIssue){s=C.veluIssue;break}if(s)return h({...s,file:s.file||r});let i=Ut(e)||{},a=i.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(a);if(l){let C=l[1],E=/referenced in your code at `(\d+):(\d+)/.exec(a),F=/\bin `([^`]+)`/.exec(a),X=F?ge(F[1],o):null;return h({category:"unknown-component",file:X||r,line:E?Number(E[1]):null,column:E?Number(E[2]):null,title:`<${C}> is not a built-in component`,detail:"",hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:oe(C,n)})}let u=i.loc||(i.line!=null?{line:i.line,column:i.column,file:i.file}:null)||Vt(i.reason||a),c=i.id||u&&u.file||i.file||null,f=ge(c,o)||r,_=!!f&&ge(c,o)!=null,d=Jt(i.frame,_||!!r),j=zt(Bt(i.reason||a)),m=Gt.test(a),L=i.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(a)||u&&u.line===1&&/unexpected|expected/i.test(a)&&/---/.test(a);return u||m||d&&_?h({category:L?"frontmatter":"mdx-syntax",file:f,line:u?u.line:null,column:u?u.column:null,frame:d,title:j||(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(a)?h({category:"invalid-props",file:f,title:"A component received an invalid value",detail:j,hint:"Check the props/options you passed to a component on this page."}):h({category:"render-crash",file:f,title:"This page failed to render",detail:j,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var Ve,Gt,he=k(()=>{I();Ve=e=>String(e).replace(/\\/g,"/");Gt=/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 qt(e){let t=me[e.category]||e.category,o=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">${O(t)}</span>`),n.push("</div>"),e.title&&n.push(`<div class="velu-err-title">${O(e.title)}</div>`),o&&n.push(`<a class="velu-err-loc" title="${O(o)}">${O(o)}</a>`),e.detail&&n.push(`<div class="velu-err-detail">${O(e.detail)}</div>`),e.frame&&n.push(`<pre class="velu-err-frame">${O(e.frame)}</pre>`),e.suggestion&&n.push(`<div class="velu-err-suggest">Did you mean <code><${O(e.suggestion)}></code>?</div>`),e.hint&&n.push(`<div class="velu-err-hint">${O(e.hint)}</div>`),n.push("</div>"),n.join("")}function ve(e,t={}){let o=Array.isArray(e)?e:[e],n=t.title||(o.length>1?`${o.length} problems to fix`:"There\u2019s a problem to fix"),r=o.map(qt).join(`
|
|
11
11
|
`);return`<!doctype html>
|
|
12
12
|
<html lang="en">
|
|
13
13
|
<head>
|
|
@@ -79,15 +79,15 @@ var ut=Object.defineProperty;var b=(e,t)=>()=>(e&&(t=e(e=0)),t);var le=(e,t)=>{f
|
|
|
79
79
|
<div class="velu-err-foot">Fix the file and save \u2014 this page reloads automatically.</div>
|
|
80
80
|
</div>
|
|
81
81
|
</body>
|
|
82
|
-
</html>`}var O,
|
|
83
|
-
`).length}function
|
|
84
|
-
`).length}function
|
|
85
|
-
`).length}function
|
|
82
|
+
</html>`}var O,Be=k(()=>{I();O=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")});var R,ye=k(()=>{R=["Callout","Card","CardGroup","Accordion","AccordionGroup","Columns","Field","Prompt","Steps","Step","Tree","Folder","File","Image","CodeBlock","CodeGroup","MethodBadge","ApiPath","TryItBar","ApiField","ApiClient","ApiSidebar"]});import xe from"node:fs";import ie from"node:path";import{fileURLToPath as Dt}from"node:url";import Yt from"iso-639-1";function Z(e,t){if(!t)return null;let o=e.indexOf(`"${t}"`);return o===-1?null:e.slice(0,o).split(`
|
|
83
|
+
`).length}function Kt(e,t){return t==null||t<0?null:e.slice(0,t).split(`
|
|
84
|
+
`).length}function Ge(e,t){if(!t)return null;let o=e.indexOf(`"${t}"`);return o===-1?null:e.slice(0,o).split(`
|
|
85
|
+
`).length}function Zt(e,t,o){let n=[];return a(e,t,"",null),n;function r(l){if(l&&l.$ref){let u=l.$ref.replace(/^#\//,"").split("/"),c=o;for(let f of u)c=c?.[f];return c||{}}return l}function s(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function i(l,u){let c=n.length;a(l,u,"",null,!0);let f=n.length===c;return f||(n.length=c),f}function a(l,u,c,f,_){let d=r(u);if(d){if(d.oneOf){d.oneOf.some(m=>i(l,m))||n.push({path:c,key:f,message:"value does not match any allowed shape"});return}if(d.type&&s(l)!==d.type){n.push({path:c,key:f,message:`expected ${d.type}, got ${s(l)}`});return}if(d.type==="string"&&d.minLength!=null&&l.length<d.minLength&&n.push({path:c,key:f,message:"must not be empty"}),d.type==="object"&&s(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 j=d.properties||{};if(d.additionalProperties===!1)for(let m of Object.keys(l))m in j||n.push({path:c?`${c}.${m}`:m,key:m,message:`unknown field "${m}"`});for(let[m,L]of Object.entries(j))m in l&&a(l[m],L,c?`${c}.${m}`:m,m,_)}d.type==="array"&&Array.isArray(l)&&d.items&&l.forEach((j,m)=>a(j,d.items,`${c}[${m}]`,f,_))}}}function Xt(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 se(e){let t=[],o=ie.join(e,"velu.json"),n;try{n=xe.readFileSync(o,"utf-8")}catch(i){return i.code==="ENOENT"?t.push(h({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(h({category:"config-json",file:"velu.json",title:"Could not read velu.json"})),t}let r;try{r=JSON.parse(n)}catch(i){let a=/position (\d+)/.exec(i.message||""),l=a?Kt(n,Number(a[1])):null;return t.push(h({category:"config-json",file:"velu.json",line:l,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(xe.readFileSync(Wt,"utf-8"))}catch{}if(s)for(let i of Zt(r,s,s)){let a=/^unknown field/.test(i.message);t.push(h({category:"config-schema",severity:a?"warning":"error",file:"velu.json",line:Z(n,i.key),title:i.path?`${i.path}: ${i.message}`:i.message,hint:a?"Remove it, or check the spelling against the velu.json schema.":""}))}for(let i of["primary","light","dark"]){let a=r.colors?.[i];a!=null&&!Xt(a)&&t.push(h({category:"config-schema",severity:"warning",file:"velu.json",line:Z(n,i),title:`colors.${i}: "${a}" 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 r.favicon=="string"&&r.favicon.trim()){let i=ie.resolve(e,r.favicon.replace(/^\/+/,""));xe.existsSync(i)||t.push(h({category:"config-asset",file:"velu.json",line:Z(n,"favicon"),title:`favicon not found: ${r.favicon}`,hint:"The path is relative to the project root."}))}if(r.navigation&&typeof r.navigation=="object"){let i;try{i=B(r.navigation)}catch(a){t.push(h({category:"config-nav",file:"velu.json",line:Z(n,"navigation"),title:"navigation could not be processed",detail:String(a.message||"")})),i=null}if(i){let{pageEntries:a,warnings:l}=G(i,e);for(let u of l){let c=/not found$/.test(u),f=/page "([^"]+)"/.exec(u),_=f?Ge(n,f[1]):null;t.push(h({category:"config-nav",severity:c?"error":"warning",file:"velu.json",line:_,title:u,hint:c?"Create the .mdx file, or remove the page from navigation.":""}))}Qt(i,n,t)}}return t}function Qt(e,t,o){let n=new Set,r=s=>{if(!(!s||typeof s!="object")){if(s.language&&!n.has(s.language)){n.add(s.language);let i=String(s.language).toLowerCase();Yt.validate(i)||o.push(h({category:"config-nav",severity:"warning",file:"velu.json",line:Ge(t,s.language)||Z(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 i of Object.values(s))Array.isArray(i)?i.forEach(r):i&&typeof i=="object"&&r(i)}};r(e)}var Ht,Wt,we=k(()=>{I();W();te();Ht=ie.dirname(Dt(import.meta.url)),Wt=ie.resolve(Ht,"..","..","schema","velu.schema.json")});import en from"node:fs/promises";import tn from"node:fs";import M from"node:path";import{fileURLToPath as nn,pathToFileURL as on}from"node:url";import{compile as rn}from"@mdx-js/mdx";import sn from"remark-frontmatter";import an from"remark-mdx-frontmatter";import ln from"remark-gfm";import cn from"rehype-slug";import{visit as un}from"unist-util-visit";function be(){if(ae)return ae;let e=M.dirname(nn(import.meta.url)),t=[M.resolve(e,"..","runtime","velu-ui"),M.resolve(e,"..","..","runtime","velu-ui"),M.resolve(e,"..","..","..","velu-ui","src")],o=null;for(let n of t){let r=M.join(n,"lib","component-schemas.js");if(tn.existsSync(r)){o=r;break}}return ae=o?import(on(o).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),ae}function fn(e){let t={};for(let o of e.attributes||[])o.type==="mdxJsxAttribute"&&(o.value==null?t[o.name]=!0:typeof o.value=="string"&&(t[o.name]=o.value));return t}function pn(e,t){return()=>o=>{un(o,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:fn(n),line:n.position?.start?.line??null,column:n.position?.start?.column??null}),n.type==="mdxjsEsm"&&typeof n.value=="string")for(let r of n.value.matchAll(/\b([A-Z][A-Za-z0-9_]*)\b/g))t.add(r[1])})}}async function mn(e,t){let o=[],n;try{n=await en.readFile(t.fileAbsPath,"utf-8")}catch{return o}let r=M.relative(e,t.fileAbsPath).split(M.sep).join("/"),s=[],i=new Set;try{await rn({value:n,path:t.fileAbsPath},{remarkPlugins:[sn,an,ln,Y,pn(s,i)],rehypePlugins:[cn],providerImportSource:"@mdx-js/react"})}catch(c){return o.push(K(c,{projectDir:e,knownComponents:R,file:r})),o}let a=new Set(R),l=await be(),u=new Set;for(let c of s)if(!i.has(c.name)){if(!a.has(c.name)){if(u.has(c.name))continue;u.add(c.name),o.push(h({category:"unknown-component",file:r,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:oe(c.name,R)}));continue}if(l){let f=l(c.name,c.props,{checkRequired:!1});f&&o.push(h({...f,file:r,line:c.line,column:c.column}))}}return o}async function Je(e,t){let o=t.filter(a=>a.exists),n=[],r=8,s=0;async function i(){for(;s<o.length;){let a=o[s++],l=await mn(e,a);for(let u of l)n.push(u)}}return await Promise.all(Array.from({length:Math.min(r,o.length)},i)),n}var ae,ke=k(()=>{fe();I();he();ye()});import{visit as dn}from"unist-util-visit";function gn(e,t){let o=qe(e).replace(/[?#].*$/,""),n=qe(t).replace(/\/+$/,"");return n&&o.toLowerCase().startsWith(n.toLowerCase())?o.slice(n.length).replace(/^\/+/,""):null}function De(e,t){return()=>(o,n)=>{typeof e=="function"&&dn(o,r=>{if(r.type!=="mdxJsxFlowElement"&&r.type!=="mdxJsxTextElement"||typeof r.name!="string"||!/^[A-Z]/.test(r.name)||r.name.includes("."))return;let s={};for(let a of r.attributes||[])a.type==="mdxJsxAttribute"&&(a.value==null?s[a.name]=!0:typeof a.value=="string"&&(s[a.name]=a.value));let i=e(r.name,s,{checkRequired:!1});if(i){let a=new Error(i.title);throw a.veluIssue={...i,file:gn(n?.path,t),line:r.position?.start?.line??null,column:r.position?.start?.column??null},a.loc={line:a.veluIssue.line,column:a.veluIssue.column},a}})}}var qe,Ye=k(()=>{qe=e=>String(e||"").replace(/\\/g,"/")});var et={};ue(et,{startDevServer:()=>Vn});import He from"node:fs/promises";import q from"node:fs";import hn from"node:http";import{spawn as vn}from"node:child_process";import b from"node:path";import{fileURLToPath as yn}from"node:url";import{createRequire as xn}from"node:module";import wn from"chokidar";import bn from"express";import kn from"@tailwindcss/vite";import Sn from"@vitejs/plugin-react";import $n from"@mdx-js/rollup";import jn from"remark-frontmatter";import An from"remark-mdx-frontmatter";import Pn from"remark-gfm";import Cn from"rehype-slug";import{createServer as En,searchForWorkspaceRoot as Tn}from"vite";function Fn(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 Ke(e,t){let o=de(e,{color:!!process.stderr.isTTY});console.error(`
|
|
86
86
|
`+o+`
|
|
87
|
-
`),process.env.VELU_DEBUG&&t&&console.error(t)}async function
|
|
88
|
-
`)}function
|
|
89
|
-
`+
|
|
90
|
-
`),p}let l=e;try{l=
|
|
91
|
-
${
|
|
92
|
-
</style>`,
|
|
93
|
-
`),
|
|
87
|
+
`),process.env.VELU_DEBUG&&t&&console.error(t)}function In(){try{return JSON.parse(q.readFileSync(b.join(J,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function Rn(e,t){let o=b.resolve(e,".velu",".velu-version"),n=null;try{n=q.readFileSync(o,"utf8").trim()}catch{}if(n===t)return!1;try{q.mkdirSync(b.dirname(o),{recursive:!0}),q.writeFileSync(o,t)}catch{}return!0}async function Ze(e){try{return await Ee(e)}catch{return pe({},b.basename(e))}}async function Xe(e,t){let o=await e.moduleGraph.getModuleByUrl(t,!0),n=new Map,r=new Set;async function s(i){if(!(!i||r.has(i.url))){if(r.add(i.url),i.id&&On.test(i.id)){let a=i.url.includes("?")?"&":"?",l=await e.transformRequest(`${i.url}${a}direct`);l?.code&&n.set(i.url,l.code)}for(let a of i.importedModules)await s(a)}}return await s(o),[...n.values()].join(`
|
|
88
|
+
`)}function zn(e,t){let o=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},n=process.stdout.isTTY,r=f=>n&&process.stdout.write(`\x1B]${f}\x1B\\`),s=()=>{r(`0;\u23F3 ${t}`),r("9;4;3;0")},i=()=>{r(`0;${t}`),r("9;4;0;0")};if(n&&process.once("exit",()=>r("9;4;0;0")),s(),!e)return console.log("Starting Velu\u2026"),{ready:f=>{console.log(`Velu ready \u2192 ${f}`),i(),o()}};let a="\x1B[38;2;220;20;60m",l="\x1B[0m";console.log("");for(let f of Mn)console.log(`${a}${f}${l}`);console.log("");let u=null;try{u=vn(process.execPath,["-e",Un],{stdio:["ignore","inherit","ignore"]}),u.on("error",()=>{})}catch{}let c=()=>{if(u){try{u.kill()}catch{}u=null}};return process.once("exit",c),{ready:f=>{c(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${l} Velu ready \u2192 \x1B[36m${f}${l}`),i(),o()}}}async function Vn(e){let t=!!process.env.VELU_PROFILE,o=performance.now(),n=(x,p)=>t&&console.log(`[velu-profile] ${x}: ${(performance.now()-p).toFixed(0)}ms`),r=zn(!!process.stdout.isTTY&&!t,b.basename(e)),s=await Ze(e),i=a();function a(){let p=se(e).filter(w=>w.severity==="error"&&(w.category==="config-json"||w.category==="config-schema"));return p.length&&console.error(`
|
|
89
|
+
`+re(p,{color:!!process.stderr.isTTY})+`
|
|
90
|
+
`),p}let l=e;try{l=q.realpathSync(e)}catch{}let u=0,c=x=>{let p=performance.now();if(p-u<500)return;u=p;let w=K(x,{projectDir:l,knownComponents:R});Ke(w,x)};process.on("unhandledRejection",c),process.on("uncaughtException",c);let _=xn(import.meta.url).resolve("@mdx-js/react"),d=b.resolve(J,"runtime","velu-ui"),j=q.existsSync(d)?d:b.resolve(J,"..","velu-ui","src"),m=[{find:"@mdx-js/react",replacement:_},{find:/^velu-ui$/,replacement:b.join(j,"index.js")},{find:/^velu-ui\//,replacement:j+"/"}],L=Number(process.env.PORT)||8358,C=await be(),E=Rn(e,In());E&&console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026");let F=bn(),X=hn.createServer(F),y=await En({root:J,appType:"custom",logLevel:t?"info":"warn",plugins:[Ue(e),$n({remarkPlugins:[jn,An,Pn,Y,De(C,e)],rehypePlugins:[Cn],providerImportSource:"@mdx-js/react"}),Sn(),kn()],cacheDir:b.resolve(e,".velu","vite-cache"),optimizeDeps:{force:E,include:["react","react-dom","react-dom/client","react-router-dom","@mdx-js/react","lucide-react","prism-react-renderer","iso-639-1","github-slugger"],esbuildOptions:{loader:{".mdx":"jsx"}}},resolve:{alias:m,dedupe:["react","react-dom","@mdx-js/react"]},server:{middlewareMode:!0,fs:{allow:[Tn(J),e,l]},hmr:{server:X}}});n("vite server created",o),F.use(y.middlewares),F.get(We,async(x,p,w)=>{if(!s.favicon)return p.status(404).end();let g=b.resolve(e,s.favicon.replace(/^\//,""));p.sendFile(g,T=>{T&&p.status(404).end()})}),F.use("*",async(x,p,w)=>{let g=x.originalUrl,T=performance.now();if(i.length)return p.status(200).set({"Content-Type":"text/html"}).end(ve(i,{title:"Fix velu.json to continue"}));try{let v=performance.now(),A=await He.readFile(Qe,"utf-8");A=await y.transformIndexHtml(g,A),n(`transformIndexHtml ${g}`,v);let U="/src/runtime/server-entry.jsx";v=performance.now();let{render:Q}=await y.ssrLoadModule(U);n(`ssrLoadModule ${g} (1st req includes dep pre-bundle)`,v),v=performance.now();let S=await Q(g);n(`render ${g}`,v),v=performance.now();let D=await Xe(y,U);n(`collectSsrCss ${g}`,v);let ce=D?`<style data-velu-ssr>${D}</style>`:"",st=`<style data-velu-config>
|
|
91
|
+
${Te(s)}
|
|
92
|
+
</style>`,at=Nn.has(s.font.family)?"":Fn(s.font.family),lt=s.favicon?`<link rel="icon" href="${We}" />`:"",ct=[ce,st,at,lt].filter(Boolean).join(`
|
|
93
|
+
`),ut=A.replace("<!--app-title-->",Ln(s.name)).replace("<!--app-head-->",ct).replace("<!--app-html-->",S);p.status(200).set({"Content-Type":"text/html"}).end(ut),n(`TOTAL ${g}`,T)}catch(v){y.ssrFixStacktrace(v);let A=K(v,{projectDir:l,knownComponents:R});Ke(A,v),p.status(200).set({"Content-Type":"text/html"}).end(ve([A]))}}),wn.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(x,p)=>{console.log(`[velu-cli] content ${x}: ${b.relative(e,p)}`);let w=b.basename(p)==="velu.json",g=p.endsWith(".mdx"),T=w||g&&(x==="add"||x==="unlink");if(w&&(s=await Ze(e),i=a()),T)y.moduleGraph.invalidateAll();else if(g){let v=p.split(b.sep).join("/"),A=y.moduleGraph.getModulesByFile(v);if(A)for(let U of A)y.moduleGraph.invalidateModule(U)}y.ws.send({type:"full-reload"})});async function $e(x){let p=new Set,w=12,g=0,T=[],v=()=>g<w?(g+=1,Promise.resolve()):new Promise(S=>T.push(S)).then(()=>{g+=1}),A=()=>{g-=1,T.shift()?.()},U=S=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(S)||/[\\/]node_modules[\\/]/.test(S)&&!/velu-ui/.test(S);async function Q(S){if(!(!S||p.has(S)||U(S))){p.add(S);try{await v();try{await y.transformRequest(S,{ssr:!1})}finally{A()}let D=await y.moduleGraph.getModuleByUrl(S,!1);D?.importedModules?.size&&await Promise.all([...D.importedModules].map(ce=>Q(ce.url)))}catch{}}}return await Q(x),p.size}X.listen(L,async()=>{let x=performance.now(),p=0;try{let{render:w}=await y.ssrLoadModule("/src/runtime/server-entry.jsx");await $e("/src/runtime/client-entry.jsx"),typeof y.waitForRequestsIdle=="function"&&await y.waitForRequestsIdle();let[g]=await Promise.allSettled([$e("/src/runtime/client-entry.jsx"),w("/"),y.transformIndexHtml("/",await He.readFile(Qe,"utf-8")),Xe(y,"/src/runtime/server-entry.jsx")]).then(T=>T.map(v=>v.status==="fulfilled"?v.value:0));p=g}catch(w){t&&console.log("[velu-profile] warmup error:",w?.message)}n(`cold-start warm-up (${p} client modules)`,x),r.ready(`http://localhost:${L}`)})}var _n,On,Nn,We,Ln,J,Qe,Mn,Un,tt=k(()=>{fe();_e();ze();he();Be();I();ye();we();ke();Ye();_n=b.dirname(yn(import.meta.url)),On=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,Nn=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),We="/@velu-favicon",Ln=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");J=b.resolve(_n,".."),Qe=b.resolve(J,"src","template.html"),Mn=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],Un="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 ot={};ue(ot,{default:()=>qn,runValidate:()=>nt});import Bn from"node:fs";import Gn from"node:path";function Jn(e){try{let t=JSON.parse(Bn.readFileSync(Gn.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let o=B(t.navigation);return G(o,e).pageEntries}catch{return[]}}async function nt(e){let t=se(e),o=Jn(e),n=await Je(e,o),r=[...t,...n],s=!!process.stdout.isTTY;return console.log(re(r,{color:s})),r.some(a=>a.severity!=="warning"&&a.severity!=="info")?1:0}var qn,rt=k(()=>{W();te();we();ke();I();qn=nt});import Se from"node:path";import N from"node:process";import{readFileSync as Dn}from"node:fs";var[,,it,le]=N.argv;function Yn(){try{return JSON.parse(Dn(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}async function Hn(){switch(it){case"--version":case"-v":case"version":{console.log(Yn());break}case"init":{le||(console.error("Usage: velu init <project-name>"),N.exit(1));let e=le,t=Se.resolve(N.cwd(),e),{initProject:o}=await Promise.resolve().then(()=>(Pe(),Ae));await o(t,e);break}case"dev":{let e=Se.resolve(N.cwd(),le??"."),{startDevServer:t}=await Promise.resolve().then(()=>(tt(),et));await t(e);break}case"validate":{let e=Se.resolve(N.cwd(),le??"."),{runValidate:t}=await Promise.resolve().then(()=>(rt(),ot)),o=await t(e);N.exit(o);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"),N.exit(it?1:0)}}Hn().catch(e=>{console.error(N.env.VELU_DEBUG?e:`Error: ${e.message}`),N.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veluai/velu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "./dist/cli.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"src/runtime/**",
|
|
12
12
|
"src/navigation.js",
|
|
13
13
|
"src/template.html",
|
|
14
|
+
"src/lib/issues.js",
|
|
15
|
+
"src/lib/extract-mdx-error.js",
|
|
16
|
+
"src/lib/known-components.js",
|
|
14
17
|
"runtime/velu-ui/**",
|
|
15
18
|
"schema/**",
|
|
16
19
|
"templates/**"
|
|
@@ -49,4 +52,4 @@
|
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"esbuild": "^0.28.0"
|
|
51
54
|
}
|
|
52
|
-
}
|
|
55
|
+
}
|