@visulima/ono 2.0.0-alpha.35 → 2.0.0-alpha.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ const c=globalThis.process||Object.create(null),r={versions:{}},s=new Proxy(c,{get(o,e){if(e in o)return o[e];if(e in r)return r[e]}});let t,n;const i=()=>(t??=s.version??"",t),a=()=>(n??=s.platform??"",n);export{a,s as e,i as g};
@@ -0,0 +1 @@
1
+ import{sanitize as n}from"isomorphic-dompurify";const l={javascript:()=>import("@shikijs/langs/javascript"),typescript:()=>import("@shikijs/langs/typescript"),jsx:()=>import("@shikijs/langs/jsx"),tsx:()=>import("@shikijs/langs/tsx"),json:()=>import("@shikijs/langs/json"),json5:()=>import("@shikijs/langs/json5"),jsonc:()=>import("@shikijs/langs/jsonc"),xml:()=>import("@shikijs/langs/xml"),sql:()=>import("@shikijs/langs/sql"),markdown:()=>import("@shikijs/langs/markdown"),mdx:()=>import("@shikijs/langs/mdx"),html:()=>import("@shikijs/langs/html"),css:()=>import("@shikijs/langs/css"),scss:()=>import("@shikijs/langs/scss"),less:()=>import("@shikijs/langs/less"),sass:()=>import("@shikijs/langs/sass"),stylus:()=>import("@shikijs/langs/stylus"),styl:()=>import("@shikijs/langs/styl"),svelte:()=>import("@shikijs/langs/svelte"),vue:()=>import("@shikijs/langs/vue"),bash:()=>import("@shikijs/langs/bash"),shell:()=>import("@shikijs/langs/shell"),yaml:()=>import("@shikijs/langs/yaml"),toml:()=>import("@shikijs/langs/toml"),python:()=>import("@shikijs/langs/python"),go:()=>import("@shikijs/langs/go"),rust:()=>import("@shikijs/langs/rust"),ruby:()=>import("@shikijs/langs/ruby"),php:()=>import("@shikijs/langs/php"),graphql:()=>import("@shikijs/langs/graphql"),dockerfile:()=>import("@shikijs/langs/dockerfile"),text:()=>Promise.resolve({name:"text",patterns:[],scopeName:"source.text",repository:{}})};let a;const m=async()=>{const[t,r]=await Promise.all([import("shiki/core"),import("shiki/engine/javascript")]),{createHighlighterCore:o}=t,{createJavaScriptRegexEngine:e}=r;return await o({themes:[import("../packem_chunks/min-dark.js"),import("../packem_chunks/min-light.js")],langs:[],engine:e()})},u=async(t,r)=>{if(r==="text")return;const o=r.toLowerCase();if(!(t.getLoadedLanguages?.()??t.getLanguages?.()??[]).includes(o)){const e=l[o];e&&await t.loadLanguage?.(await e())}},x=async(t=[])=>{a||(a=m());const r=await a,o=[];for(const e of t)if(typeof e=="string")o.push(e.toLowerCase());else{const s=e.name;s&&o.push(s.toLowerCase())}return await Promise.all(o.map(e=>u(r,e))),r},C="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-check%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M20%206%209%2017l-5-5%22%20%2F%3E%20%3C%2Fsvg%3E",A="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-clipboard%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Crect%20width%3D%228%22%20height%3D%224%22%20x%3D%228%22%20y%3D%222%22%20rx%3D%221%22%20ry%3D%221%22%20%2F%3E%20%3Cpath%20d%3D%22M16%204h2a2%202%200%200%201%202%202v14a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2V6a2%202%200%200%201%202-2h2%22%20%2F%3E%20%3C%2Fsvg%3E",h=["http://","https://","/","./","../"],p="#",g={'"':"&quot;","&":"&amp;","'":"&#39;","<":"&lt;",">":"&gt;"},d=/^[\w+/-]+={0,2}$/,i=t=>{if(t==null)return"";if(typeof t=="string")return t.trim();if(typeof t=="object"||Array.isArray(t))try{return JSON.stringify(t).trim()}catch{return""}return String(t).trim()},c=t=>t.replaceAll(/[&<>"']/g,r=>g[r]),D=t=>{try{return n(i(t))}catch{return c(i(t))}},E=t=>{const r=i(t);if(!r)return"";try{return n(r).replaceAll('"',"&quot;").replaceAll("'","&#39;")}catch{return c(r)}},w=t=>{const r=i(t);if(!r)return p;try{const o=n(r),e=o.toLowerCase();return h.some(s=>e.startsWith(s))?o:p}catch{return p}},F=t=>{const r=i(t);if(!r)return"";try{return n(r,{ADD_ATTR:["class","style"]})}catch{return D(r)}},y=t=>{const r=i(t);if(r)return d.test(r)?r:void 0},k=(t={})=>{try{return{...t,cspNonce:y(t.cspNonce),openInEditorUrl:t.openInEditorUrl?w(t.openInEditorUrl):void 0}}catch{return{...t,cspNonce:void 0,openInEditorUrl:void 0}}};export{D as a,C as b,x as c,F as d,w as e,y as f,k as g,A as l,E as s};
@@ -11,8 +11,11 @@ declare enum Editors {
11
11
  cursor = "Cursor",
12
12
  emacs = "GNU Emacs",
13
13
  emacsforosx = "GNU Emacs for Mac OS X",
14
+ fleet = "JetBrains Fleet",
15
+ helix = "Helix",
14
16
  intellij = "IntelliJ IDEA",
15
17
  idea = "IntelliJ IDEA",
18
+ kiro = "Kiro",
16
19
  nano = "GNU nano",
17
20
  neovim = "NeoVim",
18
21
  "notepad++" = "Notepad++",
@@ -27,6 +30,7 @@ declare enum Editors {
27
30
  vscode = "Visual Studio Code",
28
31
  vscodium = "VSCodium",
29
32
  webstorm = "WebStorm",
33
+ windsurf = "Windsurf",
30
34
  xcode = "Xcode",
31
35
  zed = "Zed",
32
36
  }
@@ -1 +1 @@
1
- var Yt=Object.defineProperty;var G=(s,a)=>Yt(s,"name",{value:a,configurable:!0});import{createRequire as en}from"node:module";import rn from"launch-editor-middleware";import{a as ve}from"../packem_shared/process-BO_aZsiL.js";const tn=en(import.meta.url),T=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,nn=G(s=>{if(typeof T<"u"&&T.versions&&T.versions.node){const[a,i]=T.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return T.getBuiltinModule(s)}return tn(s)},"__cjs_getBuiltinModule"),{realpathSync:ye}=nn("node:fs");var on=Object.defineProperty,sn=G((s,a)=>on(s,"name",{value:a,configurable:!0}),"$e"),an=Object.defineProperty,te=sn((s,a)=>an(s,"name",{value:a,configurable:!0}),"W"),ln=Object.defineProperty,u=te((s,a)=>ln(s,"name",{value:a,configurable:!0}),"u$1");let be=u(()=>{var s=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=u((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),x=u((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of c(t))!d.call(e,r)&&r!==n&&a(e,r,{get:u(()=>t[r],"get"),enumerable:!(o=i(t,r))||o.enumerable});return e},"ae"),g=u(e=>x(a({},"__esModule",{value:!0}),e),"oe"),v={};m(v,{zeptomatch:u(()=>we,"zeptomatch")});var b=u(e=>{const t=new Set,n=[e];for(let o=0;o<n.length;o++){const r=n[o];if(t.has(r))continue;t.add(r);const{children:l}=r;if(l?.length)for(let f=0,h=l.length;f<h;f++)n.push(l[f])}return Array.from(t)},"M"),j=u(e=>{let t="";const n=b(e);for(let o=0,r=n.length;o<r;o++){const l=n[o];if(!l.regex)continue;const f=l.regex.flags;if(t||(t=f),t!==f)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${f}"`)}return t},"se"),P=u((e,t,n)=>{const o=n.get(e);if(o!==void 0)return o;const r=e.partial??t;let l="";if(e.regex&&(l+=r?"(?:$|":"",l+=e.regex.source),e.children?.length){const f=J(e.children.map(h=>P(h,t,n)).filter(Boolean));if(f?.length){const h=e.children.some(H=>!H.regex||!(H.partial??t)),w=f.length>1||r&&(!l.length||h);l+=w?r?"(?:$|":"(?:":"",l+=f.join("|"),l+=w?")":""}}return e.regex&&(l+=r?")":""),n.set(e,l),l},"O"),q=u((e,t)=>{const n=new Map,o=b(e);for(let r=o.length-1;r>=0;r--){const l=P(o[r],t,n);if(!(r>0))return l}return""},"ie"),J=u(e=>Array.from(new Set(e)),"ue"),I=u((e,t,n)=>I.compile(e,n).test(t),"R");I.compile=(e,t)=>{const n=t?.partial??!1,o=q(e,n),r=j(e);return new RegExp(`^(?:${o})$`,r)};var ze=I,Ae=u((e,t)=>{const n=ze.compile(e,t),o=`${n.source.slice(0,-1)}[\\\\/]?$`,r=n.flags;return new RegExp(o,r)},"le"),ke=Ae,Re=u(e=>{const t=e.map(o=>o.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),Se=Re,ne=u(e=>Array.isArray(e),"j"),N=u(e=>typeof e=="function","_"),Ie=u(e=>e.length===0,"he"),Be=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Le=u(e=>typeof e=="number","de"),Ce=u(e=>typeof e=="object"&&e!==null,"xe"),We=u(e=>e instanceof RegExp,"me"),qe=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Ne=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),re=u(e=>typeof e=="string","A"),_=u(e=>e===void 0,"f"),Ze=u(e=>{const t=new Map;return n=>{const o=t.get(n);if(o!==void 0)return o;const r=e(n);return t.set(n,r),r}},"ye"),oe=u((e,t,n={})=>{const o={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},r=z(t)(o),l=Math.max(o.index,o.indexBacktrackMax);if(r&&o.index===e.length)return o.output;throw new Error(`Failed to parse at index ${l}`)},"I"),p=u((e,t)=>ne(e)?He(e,t):re(e)?se(e,t):Fe(e,t),"i"),He=u((e,t)=>{const n={};for(const o of e){if(o.length!==1)throw new Error(`Invalid character: "${o}"`);const r=o.charCodeAt(0);n[r]=!0}return o=>{const r=o.input;let l=o.index,f=l;for(;f<r.length&&r.charCodeAt(f)in n;)f+=1;if(f>l){if(!_(t)&&!o.options.silent){const h=r.slice(l,f),w=N(t)?t(h,r,`${l}`):t;_(w)||o.output.push(w)}o.index=f}return!0}},"we"),Fe=u((e,t)=>{if(Ne(e))return se(e.source,t);{const n=e.source,o=e.flags.replace(/y|$/,"y"),r=new RegExp(n,o);return qe(e)&&N(t)&&!Be(t)?Te(r,t):Ue(r,t)}},"$e"),Te=u((e,t)=>n=>{const o=n.index,r=n.input;e.lastIndex=o;const l=e.exec(r);if(l){const f=e.lastIndex;if(!n.options.silent){const h=t(...l,r,`${o}`);_(h)||n.output.push(h)}return n.index=f,!0}else return!1},"Ee"),Ue=u((e,t)=>n=>{const o=n.index,r=n.input;if(e.lastIndex=o,e.test(r)){const l=e.lastIndex;if(!_(t)&&!n.options.silent){const f=N(t)?t(r.slice(o,l),r,`${o}`):t;_(f)||n.output.push(f)}return n.index=l,!0}else return!1},"Ce"),se=u((e,t)=>n=>{const o=n.index,r=n.input;if(r.startsWith(e,o)){if(!_(t)&&!n.options.silent){const l=N(t)?t(e,r,`${o}`):t;_(l)||n.output.push(l)}return n.index+=e.length,!0}else return!1},"F"),V=u((e,t,n,o)=>{const r=z(e),l=t>1;return Q(K(ie(f=>{let h=0;for(;h<n;){const w=f.index;if(!r(f)||(h+=1,f.index===w))break}return h>=t},l),o))},"k"),ae=u((e,t)=>V(e,0,1,t),"L"),U=u((e,t)=>V(e,0,1/0,t),"$"),Ge=u((e,t)=>V(e,1,1/0,t),"Re"),B=u((e,t)=>{const n=e.map(z);return Q(K(ie(o=>{for(let r=0,l=n.length;r<l;r++)if(!n[r](o))return!1;return!0}),t))},"x"),O=u((e,t)=>{const n=e.map(z);return Q(K(o=>{for(let r=0,l=n.length;r<l;r++)if(n[r](o))return!0;return!1},t))},"p"),ie=u((e,t=!0,n=!1)=>{const o=z(e);return t?r=>{const l=r.index,f=r.output.length,h=o(r);return!h&&!n&&(r.indexBacktrackMax=Math.max(r.indexBacktrackMax,r.index)),(!h||n)&&(r.index=l,r.output.length!==f&&(r.output.length=f)),h}:o},"q"),K=u((e,t)=>{const n=z(e);return t?o=>{if(o.options.silent)return n(o);const r=o.output.length;if(n(o)){const l=o.output.splice(r,1/0),f=t(l);return _(f)||o.output.push(f),!0}else return!1}:n},"B"),Q=(()=>{let e=0;return t=>{const n=z(t),o=e+=1;return r=>{var l;if(r.options.memoization===!1)return n(r);const f=r.index,h=(l=r.cache)[o]||(l[o]={indexMax:-1,queue:[]}),w=h.queue;if(f<=h.indexMax){const F=h.store||(h.store=new Map);if(w.length){for(let C=0,Kt=w.length;C<Kt;C+=2){const Qt=w[C*2],Xt=w[C*2+1];F.set(Qt,Xt)}w.length=0}const E=F.get(f);if(E===!1)return!1;if(Le(E))return r.index=E,!0;if(E)return r.index=E.index,E.output?.length&&r.output.push(...E.output),!0}const H=r.output.length,Vt=n(r);if(h.indexMax=Math.max(h.indexMax,f),Vt){const F=r.index,E=r.output.length;if(E>H){const C=r.output.slice(H,E);w.push(f,{index:F,output:C})}else w.push(f,F);return!0}else return w.push(f,!1),!1}}})(),le=u(e=>{let t;return n=>(t||(t=z(e())),t(n))},"G"),z=Ze(e=>{if(N(e))return Ie(e)?le(e):e;if(re(e)||We(e))return p(e);if(ne(e))return B(e);if(Ce(e))return O(Object.values(e));throw new Error("Invalid rule")}),R=u(e=>e,"d"),De=u(e=>typeof e=="string","ke"),Je=u(e=>{const t=new WeakMap,n=new WeakMap;return(o,r)=>{const l=r?.partial?n:t,f=l.get(o);if(f!==void 0)return f;const h=e(o,r);return l.set(o,h),h}},"Be"),Ve=u(e=>{const t={},n={};return(o,r)=>{const l=r?.partial?n:t;return l[o]??(l[o]=e(o,r))}},"Pe"),Ke=p(/\\./,R),Qe=p(/./,R),Xe=p(/\*\*\*+/,"*"),Ye=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),et=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),tt=U(O([Ke,Xe,Ye,et,Qe])),nt=tt,rt=u(e=>oe(e,nt,{memoization:!1}).join(""),"Ie"),ot=rt,ce="abcdefghijklmnopqrstuvwxyz",st=u(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ce[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ue=u(e=>{let t=0;for(let n=0,o=e.length;n<o;n++)t=t*26+ce.indexOf(e[n])+1;return t},"V"),X=u((e,t)=>{if(t<e)return X(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),at=u((e,t,n)=>X(e,t).map(o=>String(o).padStart(n,"0")),"qe"),fe=u((e,t)=>X(ue(e),ue(t)).map(st),"W"),$=u(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),Z=u(e=>({children:e}),"y"),L=(()=>{const e=u((t,n,o)=>{if(o.has(t))return;o.add(t);const{children:r}=t;if(!r.length)r.push(n);else for(let l=0,f=r.length;l<f;l++)e(r[l],n,o)},"e");return t=>{if(!t.length)return Z([]);for(let n=t.length-1;n>=1;n--){const o=new Set,r=t[n-1],l=t[n];e(r,l,o)}return t[0]}})(),A=u(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),it=p(/\\./,$),lt=p(/[$.*+?^(){}[\]\|]/,e=>$(`\\${e}`)),ct=p(/[\\\/]/,A),ut=p(/[^$.*+?^(){}[\]\|\\\/]+/,$),ft=p(/^(?:!!)*!(.*)$/,(e,t)=>$(`(?!^${we.compile(t).source}$).*?`)),pt=p(/^(!!)+/),dt=O([ft,pt]),ht=p(/\/(\*\*\/)+/,()=>Z([L([A(),$(".+?"),A()]),A()])),gt=p(/^(\*\*\/)+/,()=>Z([$("^"),L([$(".*?"),A()])])),mt=p(/\/(\*\*)$/,()=>Z([L([A(),$(".*?")]),$("$")])),xt=p(/\*\*/,()=>$(".*?")),pe=O([ht,gt,mt,xt]),$t=p(/\*\/(?!\*\*\/|\*$)/,()=>L([$("[^\\\\/]*?"),A()])),wt=p(/\*/,()=>$("[^\\\\/]*")),de=O([$t,wt]),he=p("?",()=>$("[^\\\\/]")),yt=p("[",R),vt=p("]",R),bt=p(/[!^]/,"^\\\\/"),jt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,R),Pt=p(/\\./,R),Mt=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Ot=p(/[\\\/]/,"\\\\/"),Et=p(/[^$.*+?^(){}[\]\|\\\/]+/,R),_t=O([Pt,Mt,Ot,jt,Et]),ge=B([yt,ae(bt),U(_t),vt],e=>$(e.join(""))),zt=p("{","(?:"),At=p("}",")"),kt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>at(+t,+n,Math.min(t.length,n.length)).join("|")),Rt=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>fe(t,n).join("|")),St=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>fe(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),It=O([kt,Rt,St]),me=B([zt,It,At],e=>$(e.join(""))),Bt=p("{"),Lt=p("}"),Ct=p(","),Wt=p(/\\./,$),qt=p(/[$.*+?^(){[\]\|]/,e=>$(`\\${e}`)),Nt=p(/[\\\/]/,A),Zt=p(/[^$.*+?^(){}[\]\|\\\/,]+/,$),Ht=le(()=>$e),Ft=p("",()=>$("(?:)")),Tt=Ge(O([pe,de,he,ge,me,Ht,Wt,qt,Nt,Zt]),L),xe=O([Tt,Ft]),$e=B([Bt,ae(B([xe,U(B([Ct,xe]))])),Lt],Z),Ut=U(O([dt,pe,de,he,ge,me,$e,it,lt,ct,ut]),L),Gt=Ut,Dt=u(e=>oe(e,Gt,{memoization:!1})[0],"kr"),Jt=Dt,Y=u((e,t,n)=>Y.compile(e,n).test(t),"N");Y.compile=(()=>{const e=Ve((n,o)=>ke(Jt(ot(n)),o)),t=Je((n,o)=>Se(n.map(r=>e(r,o))));return(n,o)=>De(n)?e(n,o):t(n,o)})();var we=Y;return g(v)})();return s.default||s},"_lazyMatch"),ee;const cn=u((s,a)=>(ee||(ee=be(),be=null),ee(s,a)),"default");var un=Object.defineProperty,fn=te((s,a)=>un(s,"name",{value:a,configurable:!0}),"t$1");const pn=/^[A-Z]:\//i,S=fn((s="")=>s&&s.replaceAll("\\","/").replace(pn,a=>a.toUpperCase()),"normalizeWindowsPath");var dn=Object.defineProperty,y=te((s,a)=>dn(s,"name",{value:a,configurable:!0}),"r");const hn=/^[/\\]{2}/,gn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Oe=/^[A-Z]:$/i,je=/^\/([A-Z]:)?$/i,mn=/.(\.[^./]+)$/,xn=/^[/\\]|^[a-z]:[/\\]/i,$n=/\/$/,wn=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Ee=y((s,a)=>{let i="",c=0,d=-1,m=0,x;for(let g=0;g<=s.length;++g){if(g<s.length)x=s[g];else{if(x==="/")break;x="/"}if(x==="/"){if(!(d===g-1||m===1))if(m===2){if(i.length<2||c!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const v=i.lastIndexOf("/");v===-1?(i="",c=0):(i=i.slice(0,v),c=i.length-1-i.lastIndexOf("/")),d=g,m=0;continue}else if(i.length>0){i="",c=0,d=g,m=0;continue}}a&&(i+=i.length>0?"/..":"..",c=2)}else i.length>0?i+=`/${s.slice(d+1,g)}`:i=s.slice(d+1,g),c=g-d-1;d=g,m=0}else x==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),k=y(s=>gn.test(s),"isAbsolute"),W=y(function(s){if(s.length===0)return".";s=S(s);const a=hn.exec(s),i=k(s),c=s.at(-1)==="/";return s=Ee(s,!i),s.length===0?i?"/":c?"./":".":(c&&(s+="/"),Oe.test(s)&&(s+="/"),a?i?`//${s}`:`//./${s}`:i&&!k(s)?`/${s}`:s)},"normalize");y((...s)=>{let a="";for(const i of s)if(i)if(a.length>0){const c=a.at(-1)==="/",d=i[0]==="/";c&&d?a+=i.slice(1):a+=c||d?i:`/${i}`}else a+=i;return W(a)},"join");const D=y(function(...s){s=s.map(c=>S(c));let a="",i=!1;for(let c=s.length-1;c>=-1&&!i;c--){const d=c>=0?s[c]:wn();!d||d.length===0||(a=`${d}/${a}`,i=k(d))}return a=Ee(a,!i),i&&!k(a)?`/${a}`:a.length>0?a:"."},"resolve");y(function(s){return S(s)},"toNamespacedPath");const yn=y(function(s){return mn.exec(S(s))?.[1]??""},"extname"),Pe=y(function(s,a){const i=D(s).replace(je,"$1").split("/"),c=D(a).replace(je,"$1").split("/");if(c[0][1]===":"&&i[0][1]===":"&&i[0]!==c[0])return c.join("/");const d=[...i];for(const m of d){if(c[0]!==m)break;i.shift(),c.shift()}return[...i.map(()=>".."),...c].join("/")},"relative"),vn=y(s=>{const a=S(s).replace($n,"").split("/").slice(0,-1);return a.length===1&&Oe.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(k(s)?"/":".")},"dirname");y(function(s){const a=[s.root,s.dir,s.base??s.name+s.ext].filter(Boolean);return S(s.root?D(...a):a.join("/"))},"format");const bn=y((s,a)=>{const i=S(s).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");y(function(s){const a=xn.exec(s)?.[0]?.replaceAll("\\","/")??"",i=bn(s),c=yn(i);return{base:i,dir:vn(s),ext:c,name:i.slice(0,i.length-c.length),root:a}},"parse");y((s,a)=>cn(a,W(s)),"matchesGlob");var jn=Object.defineProperty,M=G((s,a)=>jn(s,"name",{value:a,configurable:!0}),"r");const Me=M(s=>{if(typeof s.status=="function"){s.status(400).send("Failed to open editor");return}s.statusCode=400,s.end("Failed to open editor")},"respond400"),_e=M((s={})=>{const a=M(async c=>{if((c.method??"GET").toUpperCase()==="POST")return c.body&&typeof c.body=="object"?c.body:new Promise(m=>{try{let x="";const g=M(()=>{typeof c.removeListener=="function"&&(c.removeListener("data",v),c.removeListener("end",b),c.removeListener("error",j))},"cleanup"),v=M(P=>{x+=String(P),x.length>1e6&&(g(),m({}))},"onData"),b=M(()=>{g();try{m(x?JSON.parse(x):{})}catch{m({})}},"onEnd"),j=M(()=>{g(),m({})},"onError");c.on("data",v),c.on("end",b),c.on("error",j)}catch{m({})}});const d=new URL(c.url??"","http://localhost");return{column:Number(d.searchParams.get("column")??1),editor:d.searchParams.get("editor")??void 0,file:d.searchParams.get("file")??void 0,line:Number(d.searchParams.get("line")??1)}},"parseRequestBody"),i=M((c,d,m)=>{if(!c)return;const x=k(c)?c:D(d,c);if(!m)try{const g=ye(d),v=ye(x),b=W(g),j=W(v),P=ve()==="win32"||ve()==="darwin",q=P?b.toLowerCase():b,J=P?j.toLowerCase():j,I=Pe(b,j);if(I.startsWith("..")||k(I)||P&&!J.startsWith(q))return}catch{const g=Pe(W(d),W(x));if(g.startsWith("..")||k(g))return}return x},"validateFilePath");return M(async function(c,d,m){try{const x=await a(c),g=s.projectRoot??process.cwd(),v=i(x.file,g,s.allowOutsideProject??!1);if(!v){Me(d);return}const b=x.editor&&/^[\w.+-]+$/.test(x.editor)?x.editor:void 0,j=rn(b,g),P=new URLSearchParams({column:String(x.column??1),file:v,line:String(x.line??1)});if(b&&P.set("editor",b),c.url=`/?${P.toString()}`,typeof m=="function"){j(c,d,m);return}await new Promise(q=>{j(c,d,()=>{q()})})}catch{Me(d)}},"universalHandler")},"createOpenInEditorMiddleware"),_n=M((s={})=>{const a=_e(s);return async(i,c)=>a(i,c)},"createNodeHttpHandler"),zn=M((s={})=>_e(s),"createExpressHandler");export{zn as createExpressHandler,_n as createNodeHttpHandler,_e as createOpenInEditorMiddleware};
1
+ import{createRequire as S}from"node:module";import C from"launch-editor-middleware";import{a as $}from"../packem_shared/process-DVasYamT.js";const x=S(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[s,r]=h.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return h.getBuiltinModule(e)}return x(e)},{realpathSync:w}=O("node:fs"),N=/^[A-Z]:\//i,v=(e="")=>e&&e.replaceAll("\\","/").replace(N,s=>s.toUpperCase()),R=/^[/\\]{2}/,T=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,W=/^[A-Z]:$/i,P=/^\/([A-Z]:)?$/i,E=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",j=(e,s)=>{let r="",t=0,n=-1,o=0,c;for(let l=0;l<=e.length;++l){if(l<e.length)c=e[l];else{if(c==="/")break;c="/"}if(c==="/"){if(!(n===l-1||o===1))if(o===2){if(r.length<2||t!==2||!r.endsWith(".")||r.at(-2)!=="."){if(r.length>2){const a=r.lastIndexOf("/");a===-1?(r="",t=0):(r=r.slice(0,a),t=r.length-1-r.lastIndexOf("/")),n=l,o=0;continue}else if(r.length>0){r="",t=0,n=l,o=0;continue}}s&&(r+=r.length>0?"/..":"..",t=2)}else r.length>0?r+=`/${e.slice(n+1,l)}`:r=e.slice(n+1,l),t=l-n-1;n=l,o=0}else c==="."&&o!==-1?++o:o=-1}return r},u=e=>T.test(e),p=function(e){if(e.length===0)return".";e=v(e);const s=R.exec(e),r=u(e),t=e.at(-1)==="/";return e=j(e,!r),e.length===0?r?"/":t?"./":".":(t&&(e+="/"),W.test(e)&&(e+="/"),s?r?`//${e}`:`//./${e}`:r&&!u(e)?`/${e}`:e)},g=function(...e){e=e.map(t=>v(t));let s="",r=!1;for(let t=e.length-1;t>=-1&&!r;t--){const n=t>=0?e[t]:E();!n||n.length===0||(s=`${n}/${s}`,r=u(n))}return s=j(s,!r),r&&!u(s)?`/${s}`:s.length>0?s:"."},b=function(e,s){const r=g(e).replace(P,"$1").split("/"),t=g(s).replace(P,"$1").split("/");if(t[0][1]===":"&&r[0][1]===":"&&r[0]!==t[0])return t.join("/");const n=Math.min(r.length,t.length);let o=0;for(;o<n&&r[o]===t[o];)o+=1;const c=r.length-o;return[...Array.from({length:c}).fill(".."),...t.slice(o)].join("/")},I=/^[\w.+-]+$/,_=e=>{if(typeof e.status=="function"){e.status(400).send("Failed to open editor");return}e.statusCode=400,e.end("Failed to open editor")},A=(e={})=>{const s=async t=>{if((t.method??"GET").toUpperCase()==="POST")return t.body&&typeof t.body=="object"?t.body:new Promise(o=>{try{let c="";const l=()=>{typeof t.removeListener=="function"&&(t.removeListener("data",a),t.removeListener("end",i),t.removeListener("error",f))},a=d=>{c+=String(d),c.length>1e6&&(l(),o({}))},i=()=>{l();try{o(c?JSON.parse(c):{})}catch{o({})}},f=()=>{l(),o({})};t.on("data",a),t.on("end",i),t.on("error",f)}catch{o({})}});const n=new URL(t.url??"","http://localhost");return{column:Number(n.searchParams.get("column")??1),editor:n.searchParams.get("editor")??void 0,file:n.searchParams.get("file")??void 0,line:Number(n.searchParams.get("line")??1)}},r=(t,n,o)=>{if(!t)return;const c=u(t)?t:g(n,t);if(!o)try{const l=w(n),a=w(c),i=p(l),f=p(a),d=$()==="win32"||$()==="darwin",m=d?i.toLowerCase():i,L=d?f.toLowerCase():f,y=b(i,f);if(y.startsWith("..")||u(y)||d&&!L.startsWith(m))return}catch{const l=b(p(n),p(c));if(l.startsWith("..")||u(l))return}return c};return async function(t,n,o){try{const c=await s(t),l=e.projectRoot??process.cwd(),a=r(c.file,l,e.allowOutsideProject??!1);if(!a){_(n);return}const i=c.editor&&I.test(c.editor)?c.editor:void 0,f=C(i,l),d=new URLSearchParams({column:String(c.column??1),file:a,line:String(c.line??1)});if(i&&d.set("editor",i),t.url=`/?${d.toString()}`,typeof o=="function"){f(t,n,o);return}await new Promise(m=>{f(t,n,()=>{m()})})}catch{_(n)}}},q=(e={})=>{const s=A(e);return async(r,t)=>s(r,t)},B=(e={})=>A(e);export{B as createExpressHandler,q as createNodeHttpHandler,A as createOpenInEditorMiddleware};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/ono",
3
- "version": "2.0.0-alpha.35",
3
+ "version": "2.0.0-alpha.36",
4
4
  "description": "Ono is an error-parsing library that pretty prints JavaScript errors on a web page or the terminal.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "dependencies": {
96
96
  "@shikijs/langs": "catalog:prod",
97
- "@visulima/error": "6.0.0-alpha.32",
97
+ "@visulima/error": "6.0.0-alpha.33",
98
98
  "isomorphic-dompurify": "catalog:prod",
99
99
  "launch-editor-middleware": "catalog:prod",
100
100
  "shiki": "catalog:syntax"
@@ -114,7 +114,7 @@
114
114
  "@types/http-errors": "catalog:types",
115
115
  "@types/node": "catalog:types",
116
116
  "@visulima/packem": "catalog:dev",
117
- "@visulima/path": "3.0.0-alpha.12",
117
+ "@visulima/path": "3.0.0-alpha.13",
118
118
  "@vitest/coverage-v8": "catalog:test",
119
119
  "cssnano": "catalog:dev",
120
120
  "esbuild": "catalog:build",
@@ -135,37 +135,6 @@
135
135
  "typescript": "catalog:tsc",
136
136
  "vitest": "catalog:test"
137
137
  },
138
- "peerDependencies": {
139
- "@ai-sdk/anthropic": "catalog:peer",
140
- "@ai-sdk/azure": "catalog:peer",
141
- "@ai-sdk/google": "catalog:peer",
142
- "@ai-sdk/mistral": "catalog:peer",
143
- "@ai-sdk/openai": "catalog:peer",
144
- "ai": "^6.0.175"
145
- },
146
- "peerDependenciesMeta": {
147
- "@ai-sdk/anthropic": {
148
- "optional": true
149
- },
150
- "@ai-sdk/azure": {
151
- "optional": true
152
- },
153
- "@ai-sdk/google": {
154
- "optional": true
155
- },
156
- "@ai-sdk/mistral": {
157
- "optional": true
158
- },
159
- "@ai-sdk/openai": {
160
- "optional": true
161
- },
162
- "ai": {
163
- "optional": true
164
- },
165
- "open-editor": {
166
- "optional": true
167
- }
168
- },
169
138
  "engines": {
170
139
  "node": "^22.14.0 || >=24.10.0"
171
140
  },
@@ -1 +0,0 @@
1
- var v=Object.defineProperty;var l=(t,e)=>v(t,"name",{value:e,configurable:!0});import{sanitize as u}from"isomorphic-dompurify";var y=Object.defineProperty,n=l((t,e)=>y(t,"name",{value:e,configurable:!0}),"r$1");const w=["http://","https://","/","./","../"],g="#",D={'"':"&quot;","&":"&amp;","'":"&#39;","<":"&lt;",">":"&gt;"},x=/^[\w+/-]+={0,2}$/,a=n(t=>{if(t==null)return"";if(typeof t=="string")return t.trim();if(typeof t=="object"||Array.isArray(t))try{return JSON.stringify(t).trim()}catch{return""}return String(t).trim()},"toString"),d=n(t=>t.replaceAll(/[&<>"']/g,e=>D[e]),"escapeHtml"),C=n(t=>{try{return u(a(t))}catch{return d(a(t))}},"sanitizeHtml"),H=n(t=>{const e=a(t);if(!e)return"";try{return u(e).replaceAll('"',"&quot;").replaceAll("'","&#39;")}catch{return d(e)}},"sanitizeAttribute"),A=n(t=>{const e=a(t);if(!e)return g;try{const i=u(e),s=i.toLowerCase();return w.some(o=>s.startsWith(o))?i:g}catch{return g}},"sanitizeUrlAttribute"),$=n(t=>{const e=a(t);if(!e)return"";try{return u(e,{ADD_ATTR:["class","style"]})}catch{return C(e)}},"sanitizeCodeHtml"),b=n(t=>{const e=a(t);if(e)return x.test(e)?e:void 0},"sanitizeCspNonce"),N=n((t={})=>{try{return{...t,cspNonce:b(t.cspNonce),openInEditorUrl:t.openInEditorUrl?A(t.openInEditorUrl):void 0}}catch{return{...t,cspNonce:void 0,openInEditorUrl:void 0}}},"sanitizeOptions");var j=Object.defineProperty,r=l((t,e)=>j(t,"name",{value:e,configurable:!0}),"t");const h={javascript:r(()=>import("@shikijs/langs/javascript"),"javascript"),typescript:r(()=>import("@shikijs/langs/typescript"),"typescript"),jsx:r(()=>import("@shikijs/langs/jsx"),"jsx"),tsx:r(()=>import("@shikijs/langs/tsx"),"tsx"),json:r(()=>import("@shikijs/langs/json"),"json"),jsonc:r(()=>import("@shikijs/langs/jsonc"),"jsonc"),xml:r(()=>import("@shikijs/langs/xml"),"xml"),sql:r(()=>import("@shikijs/langs/sql"),"sql"),markdown:r(()=>import("@shikijs/langs/markdown"),"markdown"),mdx:r(()=>import("@shikijs/langs/mdx"),"mdx"),html:r(()=>import("@shikijs/langs/html"),"html"),css:r(()=>import("@shikijs/langs/css"),"css"),scss:r(()=>import("@shikijs/langs/scss"),"scss"),less:r(()=>import("@shikijs/langs/less"),"less"),sass:r(()=>import("@shikijs/langs/sass"),"sass"),stylus:r(()=>import("@shikijs/langs/stylus"),"stylus"),styl:r(()=>import("@shikijs/langs/styl"),"styl"),svelte:r(()=>import("@shikijs/langs/svelte"),"svelte"),vue:r(()=>import("@shikijs/langs/vue"),"vue"),bash:r(()=>import("@shikijs/langs/bash"),"bash"),shell:r(()=>import("@shikijs/langs/shell"),"shell"),text:r(()=>Promise.resolve({name:"text",patterns:[],scopeName:"source.text",repository:{}}),"text")};r(async t=>{if(typeof t!="string"||!t)return;const e=h[t.toLowerCase()];if(e)return await e()},"getLanguageImport");var F=Object.defineProperty,c=l((t,e)=>F(t,"name",{value:e,configurable:!0}),"a$1");let p,m;const L=c(async()=>{const[t,e]=await Promise.all([import("shiki/core"),import("shiki/engine/javascript")]),{createHighlighterCore:i}=t,{createJavaScriptRegexEngine:s}=e,o=await i({themes:[import("../packem_chunks/min-dark.js"),import("../packem_chunks/min-light.js")],langs:[],engine:s()}),f=o;return m=c(()=>{try{o?.dispose?.()}catch{}p=void 0},"disposeFn"),f},"createSingletonHighlighter"),z=c(async(t,e)=>{if(e==="text")return;const i=e.toLowerCase();if(!(t.getLoadedLanguages?.()??t.getLanguages?.()??[]).includes(i)){const s=h[i];s&&await t.loadLanguage?.(await s())}},"ensureLanguageLoaded"),O=c(async(t=[])=>{p||(p=L());const e=await p,i=[];for(const s of t)if(typeof s=="string")i.push(s.toLowerCase());else{const o=s.name;o&&i.push(o.toLowerCase())}return await Promise.all(i.map(s=>z(e,s))),e},"getHighlighter");c(async()=>{try{m&&(m(),m=void 0)}catch{}},"disposeHighlighter");c((t=[])=>({name:"@shikijs/transformers:compact-line-options",line(e,i){const s=t.find(o=>o.line===i);return s?.classes&&this.addClassToHast(e,s.classes),e}}),"transformerCompactLineOptions");const P="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-check%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M20%206%209%2017l-5-5%22%20%2F%3E%20%3C%2Fsvg%3E",U="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-clipboard%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Crect%20width%3D%228%22%20height%3D%224%22%20x%3D%228%22%20y%3D%222%22%20rx%3D%221%22%20ry%3D%221%22%20%2F%3E%20%3Cpath%20d%3D%22M16%204h2a2%202%200%200%201%202%202v14a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2V6a2%202%200%200%201%202-2h2%22%20%2F%3E%20%3C%2Fsvg%3E";export{H as a,b,A as c,O as d,P as e,N as f,$ as g,U as n,C as s};
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var o=(r,e)=>i(r,"name",{value:e,configurable:!0});var l=Object.defineProperty,a=o((r,e)=>l(r,"name",{value:e,configurable:!0}),"r");const g=globalThis.process||Object.create(null),t={versions:{}},c=new Proxy(g,{get(r,e){if(e in r)return r[e];if(e in t)return t[e]}});let s,n;const f=a(()=>(s??=c.version??"",s),"getProcessVersion"),u=a(()=>(n??=c.platform??"",n),"getProcessPlatform");export{u as a,f as g,c as n};