@visulima/connect 3.0.22 → 3.0.24

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/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## @visulima/connect [3.0.24](https://github.com/visulima/visulima/compare/@visulima/connect@3.0.23...@visulima/connect@3.0.24) (2025-11-05)
2
+
3
+ ### Bug Fixes
4
+
5
+ * update dependencies across multiple packages ([36a47f2](https://github.com/visulima/visulima/commit/36a47f26d65d25a7b4d8371186710e7d0ab61a2b))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * update dependencies across multiple packages ([c526462](https://github.com/visulima/visulima/commit/c52646260c2ae8bbf85692e642f305f47a158d4e))
10
+ * update package dependencies and configurations ([7bfe7e7](https://github.com/visulima/visulima/commit/7bfe7e71869580900aab50efb064b4293994ed9a))
11
+
12
+ ## @visulima/connect [3.0.23](https://github.com/visulima/visulima/compare/@visulima/connect@3.0.22...@visulima/connect@3.0.23) (2025-10-21)
13
+
14
+ ### Bug Fixes
15
+
16
+ * allow node v25 and updated dev deps ([8158cc5](https://github.com/visulima/visulima/commit/8158cc53ec92bd0331e8c6bd0fcbc8ab61b9320f))
17
+
18
+ ### Miscellaneous Chores
19
+
20
+ * update license years and add validation rules ([b97811e](https://github.com/visulima/visulima/commit/b97811ed2d253d908c0d86b4579a0a6bc33673a8))
21
+
1
22
  ## @visulima/connect [3.0.22](https://github.com/visulima/visulima/compare/@visulima/connect@3.0.21...@visulima/connect@3.0.22) (2025-10-20)
2
23
 
3
24
  ### Bug Fixes
@@ -15,7 +36,7 @@
15
36
  ### Bug Fixes
16
37
 
17
38
  * consolidate ESLint configuration and remove obsolete files for improved maintainability ([670cc9e](https://github.com/visulima/visulima/commit/670cc9e2a16aaf43aafddc5b00bb3d34144bb1df))
18
- * update @visulima/packem to 2.0.0-alpha.30 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
39
+ * update @visulima/packem to 2.0.0-alpha.32 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
19
40
  * update @visulima/packem to version 2.0.0-alpha.29 and adjust packem.config.ts settings ([e505bcf](https://github.com/visulima/visulima/commit/e505bcfba65e8fede4286b8cd08557d976081de5))
20
41
 
21
42
  ### Miscellaneous Chores
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 visulima
3
+ Copyright (c) 2025 visulima
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./packem_shared/expressWrapper-CnZ-5oTw.cjs"),o=require("./packem_shared/withZod-CvygheEk.cjs"),r=require("./packem_shared/createEdgeRouter-KIBlNPX3.cjs"),e=require("./packem_shared/createRouter-CcKo5sWT.cjs"),u=require("./packem_shared/Router-fcD22mVn.cjs"),d=require("./packem_shared/sendJson-l4jM19lK.cjs");exports.expressWrapper=t;exports.withZod=o;exports.EdgeRouter=r.EdgeRouter;exports.createEdgeRouter=r.createEdgeRouter;exports.NodeRouter=e.NodeRouter;exports.createNodeRouter=e.createRouter;exports.createRouter=e.createRouter;exports.Router=u.Router;exports.sendJson=d;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./packem_shared/expressWrapper-CnZ-5oTw.cjs"),o=require("./packem_shared/withZod-CvygheEk.cjs"),r=require("./packem_shared/EdgeRouter-KIBlNPX3.cjs"),e=require("./packem_shared/createRouter-CcKo5sWT.cjs"),u=require("./packem_shared/Router-fcD22mVn.cjs"),d=require("./packem_shared/sendJson-l4jM19lK.cjs");exports.expressWrapper=t;exports.withZod=o;exports.EdgeRouter=r.EdgeRouter;exports.createEdgeRouter=r.createEdgeRouter;exports.NodeRouter=e.NodeRouter;exports.createNodeRouter=e.createRouter;exports.createRouter=e.createRouter;exports.Router=u.Router;exports.sendJson=d;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{default as o}from"./packem_shared/expressWrapper-D-d31tgs.mjs";import{default as a}from"./packem_shared/withZod-CTl1zUbN.mjs";import{EdgeRouter as d,createEdgeRouter as f}from"./packem_shared/createEdgeRouter-BYUWjtW1.mjs";import{NodeRouter as s,createRouter as x,createRouter as R}from"./packem_shared/createRouter-CEifSa_f.mjs";import{Router as c}from"./packem_shared/Router-kh2RTgYJ.mjs";import{default as g}from"./packem_shared/sendJson-zUtTFUYn.mjs";export{d as EdgeRouter,s as NodeRouter,c as Router,f as createEdgeRouter,x as createNodeRouter,R as createRouter,o as expressWrapper,g as sendJson,a as withZod};
1
+ import{default as o}from"./packem_shared/expressWrapper-D-d31tgs.mjs";import{default as a}from"./packem_shared/withZod-wmNwBerD.mjs";import{EdgeRouter as d,createEdgeRouter as f}from"./packem_shared/EdgeRouter-DkYqae6k.mjs";import{NodeRouter as s,createRouter as x,createRouter as R}from"./packem_shared/createRouter-Bp84h_yy.mjs";import{Router as c}from"./packem_shared/Router-Dg3J0bWq.mjs";import{default as g}from"./packem_shared/sendJson-zUtTFUYn.mjs";export{d as EdgeRouter,s as NodeRouter,c as Router,f as createEdgeRouter,x as createNodeRouter,R as createRouter,o as expressWrapper,g as sendJson,a as withZod};
@@ -1 +1 @@
1
- var p=Object.defineProperty;var h=(n,t)=>p(n,"name",{value:t,configurable:!0});import c from"./withZod-CTl1zUbN.mjs";import{Router as d}from"./Router-kh2RTgYJ.mjs";var f=Object.defineProperty,i=h((n,t)=>f(n,"name",{value:t,configurable:!0}),"r");const l=i(async n=>new Response(n.method==="HEAD"?null:`Route ${n.method} ${n.url} not found`,{status:404}),"onNoMatch"),m=i(async n=>(console.error(n),new Response("Internal Server Error",{status:500})),"onError"),u=i(n=>(n.nextUrl??new URL(n.url)).pathname,"getPathname");class s{static{h(this,"EdgeRouter")}static{i(this,"EdgeRouter")}all=this.add.bind(this,"");connect=this.add.bind(this,"CONNECT");delete=this.add.bind(this,"DELETE");get=this.add.bind(this,"GET");head=this.add.bind(this,"HEAD");options=this.add.bind(this,"OPTIONS");patch=this.add.bind(this,"PATCH");post=this.add.bind(this,"POST");put=this.add.bind(this,"PUT");trace=this.add.bind(this,"TRACE");onError;onNoMatch;router=new d;constructor(t={}){this.onNoMatch=t.onNoMatch??l,this.onError=t.onError??m}clone(){const t=new s({onError:this.onError,onNoMatch:this.onNoMatch});return t.router=this.router.clone(),t}handler(){const{routes:t}=this.router;return async(e,r)=>{const o=this.router.find(e.method,u(e));this.prepareRequest(e,o);try{return await(o.fns.length===0||o.middleOnly?this.onNoMatch(e,r,t):d.exec(o.fns,e,r))}catch(a){return await this.onError(a,e,r,t)}}}async run(t,e){const r=this.router.find(t.method,u(t));if(r.fns.length!==0)return this.prepareRequest(t,r),await d.exec(r.fns,t,e)}use(t,...e){return(typeof t=="function"||t instanceof s)&&(e.unshift(t),t="/"),this.router.use(t,...e.map(r=>r instanceof s?r.router:r)),this}add(t,e,r,...o){return typeof e=="string"&&typeof r=="function"?o=[r]:typeof r=="object"?typeof e=="function"?o=[c(r,e)]:o=o.map(a=>c(r,a)):typeof r=="function"&&(o=[r]),this.router.add(t,e,...o),this}prepareRequest(t,e){t.params={...e.params,...t.params}}}const N=i((n={})=>new s(n),"createEdgeRouter");export{s as EdgeRouter,N as createEdgeRouter,u as getPathname};
1
+ var p=Object.defineProperty;var h=(n,t)=>p(n,"name",{value:t,configurable:!0});import c from"./withZod-wmNwBerD.mjs";import{Router as d}from"./Router-Dg3J0bWq.mjs";var f=Object.defineProperty,i=h((n,t)=>f(n,"name",{value:t,configurable:!0}),"r");const l=i(async n=>new Response(n.method==="HEAD"?null:`Route ${n.method} ${n.url} not found`,{status:404}),"onNoMatch"),m=i(async n=>(console.error(n),new Response("Internal Server Error",{status:500})),"onError"),u=i(n=>(n.nextUrl??new URL(n.url)).pathname,"getPathname");class s{static{h(this,"EdgeRouter")}static{i(this,"EdgeRouter")}all=this.add.bind(this,"");connect=this.add.bind(this,"CONNECT");delete=this.add.bind(this,"DELETE");get=this.add.bind(this,"GET");head=this.add.bind(this,"HEAD");options=this.add.bind(this,"OPTIONS");patch=this.add.bind(this,"PATCH");post=this.add.bind(this,"POST");put=this.add.bind(this,"PUT");trace=this.add.bind(this,"TRACE");onError;onNoMatch;router=new d;constructor(t={}){this.onNoMatch=t.onNoMatch??l,this.onError=t.onError??m}clone(){const t=new s({onError:this.onError,onNoMatch:this.onNoMatch});return t.router=this.router.clone(),t}handler(){const{routes:t}=this.router;return async(e,r)=>{const o=this.router.find(e.method,u(e));this.prepareRequest(e,o);try{return await(o.fns.length===0||o.middleOnly?this.onNoMatch(e,r,t):d.exec(o.fns,e,r))}catch(a){return await this.onError(a,e,r,t)}}}async run(t,e){const r=this.router.find(t.method,u(t));if(r.fns.length!==0)return this.prepareRequest(t,r),await d.exec(r.fns,t,e)}use(t,...e){return(typeof t=="function"||t instanceof s)&&(e.unshift(t),t="/"),this.router.use(t,...e.map(r=>r instanceof s?r.router:r)),this}add(t,e,r,...o){return typeof e=="string"&&typeof r=="function"?o=[r]:typeof r=="object"?typeof e=="function"?o=[c(r,e)]:o=o.map(a=>c(r,a)):typeof r=="function"&&(o=[r]),this.router.add(t,e,...o),this}prepareRequest(t,e){t.params={...e.params,...t.params}}}const N=i((n={})=>new s(n),"createEdgeRouter");export{s as EdgeRouter,N as createEdgeRouter,u as getPathname};
@@ -0,0 +1 @@
1
+ var g=Object.defineProperty;var p=(c,e)=>g(c,"name",{value:e,configurable:!0});import{parse as d}from"regexparam";var k=Object.defineProperty,m=p((c,e)=>k(c,"name",{value:e,configurable:!0}),"p");class f{static{p(this,"Router")}constructor(e="/",t=[]){this.base=e,this.routes=t}static{m(this,"Router")}static async exec(e,...t){let r=0;const i=m(()=>{const s=e[++r];return s===void 0?Promise.resolve():s(...t,i)},"next");return e[r](...t,i)}add(e,t,...r){if(typeof t=="function"&&(r.unshift(t),t=""),t==="")this.routes.push({fns:r,isMiddleware:!1,matchAll:!0,method:e});else{const{keys:i,pattern:s}=d(t);this.routes.push({fns:r,isMiddleware:!1,keys:i,method:e,pattern:s})}return this}clone(e){return new f(e,[...this.routes])}find(e,t){let r=!0;const i=[],s={},y=e==="HEAD";for(const n of this.routes){if(n.method!==e&&n.method!==""&&!(y&&n.method==="GET"))continue;let l=!1;if("matchAll"in n)l=!0;else if(n.keys===!1){const o=n.pattern.exec(t);if(o===null)continue;o.groups!==void 0&&Object.keys(o.groups).forEach(a=>{s[a]=o.groups[a]}),l=!0}else if(n.keys.length>0){const o=n.pattern.exec(t);if(o===null)continue;for(let a=0;a<n.keys.length;){const u=n.keys[a];s[u]=o[++a]}l=!0}else n.pattern.test(t)&&(l=!0);l&&(i.push(...n.fns.flatMap(o=>{if(o instanceof f){const{base:a}=o;let u=t.slice(a.length);u.startsWith("/")||(u=`/${u}`);const h=o.find(e,u);return h.middleOnly||(r=!1),Object.assign(s,h.params),h.fns}return o})),n.isMiddleware||(r=!1))}return{fns:i,middleOnly:r,params:s}}use(e,...t){(typeof e=="function"||e instanceof f)&&(t.unshift(e),e="/"),t=t.map(s=>{if(s instanceof f){if(typeof e=="string")return s.clone(e);throw new Error("Mounting a router to RegExp base is not supported")}return s});const{keys:r,pattern:i}=d(e,!0);return this.routes.push({fns:t,isMiddleware:!0,keys:r,method:"",pattern:i}),this}}export{f as Router};
@@ -1 +1 @@
1
- var f=Object.defineProperty;var h=(n,t)=>f(n,"name",{value:t,configurable:!0});import c from"./withZod-CTl1zUbN.mjs";import{Router as d}from"./Router-kh2RTgYJ.mjs";var p=Object.defineProperty,s=h((n,t)=>p(n,"name",{value:t,configurable:!0}),"r");const l=s(async(n,t)=>{t.statusCode=404,t.end(n.method==="HEAD"?void 0:`Route ${n.method} ${n.url} not found`)},"onNoMatch"),m=s(async(n,t,r)=>{r.statusCode=500,console.error(n),r.end("Internal Server Error")},"onError"),u=s(n=>{const t=n.indexOf("?");return t===-1?n:n.slice(0,Math.max(0,t))},"getPathname");class i{static{h(this,"NodeRouter")}static{s(this,"NodeRouter")}all=this.add.bind(this,"");connect=this.add.bind(this,"CONNECT");delete=this.add.bind(this,"DELETE");get=this.add.bind(this,"GET");head=this.add.bind(this,"HEAD");options=this.add.bind(this,"OPTIONS");patch=this.add.bind(this,"PATCH");post=this.add.bind(this,"POST");put=this.add.bind(this,"PUT");trace=this.add.bind(this,"TRACE");onError;onNoMatch;router=new d;constructor(t={}){this.onNoMatch=t.onNoMatch??l,this.onError=t.onError??m}clone(){const t=new i({onError:this.onError,onNoMatch:this.onNoMatch});return t.router=this.router.clone(),t}handler(){const{routes:t}=this.router;return async(r,e)=>{const o=this.router.find(r.method,u(r.url));this.prepareRequest(r,o);try{await(o.fns.length===0||o.middleOnly?this.onNoMatch(r,e,t):d.exec(o.fns,r,e))}catch(a){await this.onError(a,r,e,t)}}}async run(t,r){const e=this.router.find(t.method,u(t.url));if(e.fns.length!==0)return this.prepareRequest(t,e),await d.exec(e.fns,t,r)}use(t,...r){return(typeof t=="function"||t instanceof i)&&(r.unshift(t),t="/"),this.router.use(t,...r.map(e=>e instanceof i?e.router:e)),this}add(t,r,e,...o){return typeof r=="string"&&typeof e=="function"?o=[e]:typeof e=="object"?typeof r=="function"?o=[c(e,r)]:o=o.map(a=>c(e,a)):typeof e=="function"&&(o=[e]),this.router.add(t,r,...o),this}prepareRequest(t,r){t.params={...r.params,...t.params}}}const N=s((n={})=>new i(n),"createRouter");export{i as NodeRouter,N as createRouter,u as getPathname};
1
+ var f=Object.defineProperty;var h=(n,t)=>f(n,"name",{value:t,configurable:!0});import c from"./withZod-wmNwBerD.mjs";import{Router as d}from"./Router-Dg3J0bWq.mjs";var p=Object.defineProperty,s=h((n,t)=>p(n,"name",{value:t,configurable:!0}),"r");const l=s(async(n,t)=>{t.statusCode=404,t.end(n.method==="HEAD"?void 0:`Route ${n.method} ${n.url} not found`)},"onNoMatch"),m=s(async(n,t,r)=>{r.statusCode=500,console.error(n),r.end("Internal Server Error")},"onError"),u=s(n=>{const t=n.indexOf("?");return t===-1?n:n.slice(0,Math.max(0,t))},"getPathname");class i{static{h(this,"NodeRouter")}static{s(this,"NodeRouter")}all=this.add.bind(this,"");connect=this.add.bind(this,"CONNECT");delete=this.add.bind(this,"DELETE");get=this.add.bind(this,"GET");head=this.add.bind(this,"HEAD");options=this.add.bind(this,"OPTIONS");patch=this.add.bind(this,"PATCH");post=this.add.bind(this,"POST");put=this.add.bind(this,"PUT");trace=this.add.bind(this,"TRACE");onError;onNoMatch;router=new d;constructor(t={}){this.onNoMatch=t.onNoMatch??l,this.onError=t.onError??m}clone(){const t=new i({onError:this.onError,onNoMatch:this.onNoMatch});return t.router=this.router.clone(),t}handler(){const{routes:t}=this.router;return async(r,e)=>{const o=this.router.find(r.method,u(r.url));this.prepareRequest(r,o);try{await(o.fns.length===0||o.middleOnly?this.onNoMatch(r,e,t):d.exec(o.fns,r,e))}catch(a){await this.onError(a,r,e,t)}}}async run(t,r){const e=this.router.find(t.method,u(t.url));if(e.fns.length!==0)return this.prepareRequest(t,e),await d.exec(e.fns,t,r)}use(t,...r){return(typeof t=="function"||t instanceof i)&&(r.unshift(t),t="/"),this.router.use(t,...r.map(e=>e instanceof i?e.router:e)),this}add(t,r,e,...o){return typeof r=="string"&&typeof e=="function"?o=[e]:typeof e=="object"?typeof r=="function"?o=[c(e,r)]:o=o.map(a=>c(e,a)):typeof e=="function"&&(o=[e]),this.router.add(t,r,...o),this}prepareRequest(t,r){t.params={...r.params,...t.params}}}const N=s((n={})=>new i(n),"createRouter");export{i as NodeRouter,N as createRouter,u as getPathname};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var i=(e,t)=>c(e,"name",{value:t,configurable:!0});import p from"http-errors";import{ZodError as u}from"zod";var y=Object.defineProperty,d=i((e,t)=>y(e,"name",{value:t,configurable:!0}),"d");const j=d((e,t)=>async(o,f,m)=>{let a=o;try{a=await e.parseAsync(o)}catch(r){let{message:n}=r;throw r instanceof u&&typeof r.format=="function"&&(n=r.issues.map(s=>`${s.path.join("/")} - ${s.message}`).join("/n")),p(422,n)}return t(a,f,m)},"withZod");export{j as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/connect",
3
- "version": "3.0.22",
3
+ "version": "3.0.24",
4
4
  "description": "The minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2 with support for zod validation.",
5
5
  "keywords": [
6
6
  "javascript",
@@ -77,7 +77,7 @@
77
77
  "zod": "^3.22.5"
78
78
  },
79
79
  "engines": {
80
- "node": ">=18.0.0 <=24.x"
80
+ "node": ">=18.0.0 <=25.x"
81
81
  },
82
82
  "os": [
83
83
  "darwin",
@@ -1 +0,0 @@
1
- var g=Object.defineProperty;var d=(f,e)=>g(f,"name",{value:e,configurable:!0});import{createRequire as b}from"node:module";const k=b(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const{parse:h}=k("regexparam");var v=Object.defineProperty,m=d((f,e)=>v(f,"name",{value:e,configurable:!0}),"p");class l{static{d(this,"Router")}constructor(e="/",t=[]){this.base=e,this.routes=t}static{m(this,"Router")}static async exec(e,...t){let n=0;const i=m(()=>{const s=e[++n];return s===void 0?Promise.resolve():s(...t,i)},"next");return e[n](...t,i)}add(e,t,...n){if(typeof t=="function"&&(n.unshift(t),t=""),t==="")this.routes.push({fns:n,isMiddleware:!1,matchAll:!0,method:e});else{const{keys:i,pattern:s}=h(t);this.routes.push({fns:n,isMiddleware:!1,keys:i,method:e,pattern:s})}return this}clone(e){return new l(e,[...this.routes])}find(e,t){let n=!0;const i=[],s={},y=e==="HEAD";for(const r of this.routes){if(r.method!==e&&r.method!==""&&!(y&&r.method==="GET"))continue;let c=!1;if("matchAll"in r)c=!0;else if(r.keys===!1){const o=r.pattern.exec(t);if(o===null)continue;o.groups!==void 0&&Object.keys(o.groups).forEach(u=>{s[u]=o.groups[u]}),c=!0}else if(r.keys.length>0){const o=r.pattern.exec(t);if(o===null)continue;for(let u=0;u<r.keys.length;){const a=r.keys[u];s[a]=o[++u]}c=!0}else r.pattern.test(t)&&(c=!0);c&&(i.push(...r.fns.flatMap(o=>{if(o instanceof l){const{base:u}=o;let a=t.slice(u.length);a.startsWith("/")||(a=`/${a}`);const p=o.find(e,a);return p.middleOnly||(n=!1),Object.assign(s,p.params),p.fns}return o})),r.isMiddleware||(n=!1))}return{fns:i,middleOnly:n,params:s}}use(e,...t){(typeof e=="function"||e instanceof l)&&(t.unshift(e),e="/"),t=t.map(s=>{if(s instanceof l){if(typeof e=="string")return s.clone(e);throw new Error("Mounting a router to RegExp base is not supported")}return s});const{keys:n,pattern:i}=h(e,!0);return this.routes.push({fns:t,isMiddleware:!0,keys:n,method:"",pattern:i}),this}}export{l as Router};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var a=(e,r)=>f(e,"name",{value:r,configurable:!0});import{createRequire as p}from"node:module";import{ZodError as d}from"zod";const l=p(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const m=l("http-errors");var _=Object.defineProperty,g=a((e,r)=>_(e,"name",{value:r,configurable:!0}),"d");const v=g((e,r)=>async(s,c,u)=>{let t=s;try{t=await e.parseAsync(s)}catch(o){let{message:n}=o;throw o instanceof d&&typeof o.format=="function"&&(n=o.issues.map(i=>`${i.path.join("/")} - ${i.message}`).join("/n")),m(422,n)}return r(t,c,u)},"withZod");export{v as default};