@visulima/connect 3.0.15 → 3.0.16

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,21 @@
1
+ ## @visulima/connect [3.0.16](https://github.com/visulima/visulima/compare/@visulima/connect@3.0.15...@visulima/connect@3.0.16) (2024-12-12)
2
+
3
+ ### Bug Fixes
4
+
5
+ * added missing placeholder variables into LICENSE.md file ([cef32c6](https://github.com/visulima/visulima/commit/cef32c6eb19dc3215a835e848ef12223a8fa05e0))
6
+ * allow node v23 ([8ca929a](https://github.com/visulima/visulima/commit/8ca929af311ce8036cbbfde68b6db05381b860a5))
7
+ * allowed node 23, updated dev dependencies ([f99d34e](https://github.com/visulima/visulima/commit/f99d34e01f6b13be8586a1b5d37dc8b8df0a5817))
8
+ * updated packem to v1.8.2 ([23f869b](https://github.com/visulima/visulima/commit/23f869b4120856cc97e2bffa6d508e2ae30420ea))
9
+ * updated packem to v1.9.2 ([47bdc2d](https://github.com/visulima/visulima/commit/47bdc2dfaeca4e7014dbe7772eae2fdf8c8b35bb))
10
+
11
+ ### Styles
12
+
13
+ * cs fixes ([46d31e0](https://github.com/visulima/visulima/commit/46d31e082e1865262bf380859c14fabd28ff456d))
14
+
15
+ ### Miscellaneous Chores
16
+
17
+ * updated dev dependencies ([a916944](https://github.com/visulima/visulima/commit/a916944b888bb34c34b0c54328b38d29e4399857))
18
+
1
19
  ## @visulima/connect [3.0.15](https://github.com/visulima/visulima/compare/@visulima/connect@3.0.14...@visulima/connect@3.0.15) (2024-10-05)
2
20
 
3
21
  ### Bug Fixes
@@ -19,3 +19,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+ <!-- DEPENDENCIES -->
24
+ <!-- /DEPENDENCIES -->
25
+
26
+ <!-- TYPE_DEPENDENCIES -->
27
+ <!-- /TYPE_DEPENDENCIES -->
package/README.md CHANGED
@@ -35,11 +35,11 @@ and based on
35
35
 
36
36
  ## Features
37
37
 
38
- - Async middleware
39
- - [Lightweight](https://bundlephobia.com/scan-results?packages=express,@visulima/connect,koa,micro) => Suitable for serverless environment
40
- - [way faster](https://github.com/visulima/packages/connect/tree/main/bench) than Express.js. Compatible with Express.js via [a wrapper](#expressjs-compatibility).
41
- - Works with async handlers (with error catching)
42
- - TypeScript support
38
+ - Async middleware
39
+ - [Lightweight](https://bundlephobia.com/scan-results?packages=express,@visulima/connect,koa,micro) => Suitable for serverless environment
40
+ - [way faster](https://github.com/visulima/packages/connect/tree/main/bench) than Express.js. Compatible with Express.js via [a wrapper](#expressjs-compatibility).
41
+ - Works with async handlers (with error catching)
42
+ - TypeScript support
43
43
 
44
44
  ## Installation
45
45
 
@@ -279,8 +279,8 @@ Create an instance Node.js router.
279
279
 
280
280
  `fn`(s) can either be:
281
281
 
282
- - functions of `(req, res[, next])`
283
- - **or** a router instance
282
+ - functions of `(req, res[, next])`
283
+ - **or** a router instance
284
284
 
285
285
  ```javascript
286
286
  // Mount a middleware function
@@ -612,9 +612,9 @@ If you would like to help take a look at the [list of issues](https://github.com
612
612
 
613
613
  ## Credits
614
614
 
615
- - [next-connect](https://github.com/hoangvvo/next-connect)
616
- - [Daniel Bannert](https://github.com/prisis)
617
- - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
615
+ - [next-connect](https://github.com/hoangvvo/next-connect)
616
+ - [Daniel Bannert](https://github.com/prisis)
617
+ - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
618
618
 
619
619
  ## License
620
620
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./packem_shared/expressWrapper-CnZ-5oTw.cjs"),o=require("./packem_shared/withZod-DuW1_gKH.cjs"),r=require("./packem_shared/EdgeRouter-BhNSG2Ub.cjs"),e=require("./packem_shared/createRouter-TaXyXKVU.cjs"),u=require("./packem_shared/Router-DxPKBXlz.cjs"),s=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=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./packem_shared/expressWrapper-CnZ-5oTw.cjs"),o=require("./packem_shared/withZod--KKMTPIV.cjs"),r=require("./packem_shared/EdgeRouter-BkXpG9tj.cjs"),e=require("./packem_shared/createRouter-CFoX3Ket.cjs"),u=require("./packem_shared/Router-DxPKBXlz.cjs"),R=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=R;
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var h=(o,t)=>p(o,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./withZod-DuW1_gKH.cjs"),d=require("./Router-DxPKBXlz.cjs");var f=Object.defineProperty,i=h((o,t)=>f(o,"name",{value:t,configurable:!0}),"r");const l=i(async o=>new Response(o.method==="HEAD"?null:`Route ${o.method} ${o.url} not found`,{status:404}),"onNoMatch"),E=i(async o=>(console.error(o),new Response("Internal Server Error",{status:500})),"onError"),u=i(o=>(o.nextUrl??new URL(o.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.Router;constructor(t={}){this.onNoMatch=t.onNoMatch??l,this.onError=t.onError??E}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(r,e)=>{const n=this.router.find(r.method,u(r));this.prepareRequest(r,n);try{return await(n.fns.length===0||n.middleOnly?this.onNoMatch(r,e,t):d.Router.exec(n.fns,r,e))}catch(a){return await this.onError(a,r,e,t)}}}async run(t,r){const e=this.router.find(t.method,u(t));if(e.fns.length!==0)return this.prepareRequest(t,e),await d.Router.exec(e.fns,t,r)}use(t,...r){return(typeof t=="function"||t instanceof s)&&(r.unshift(t),t="/"),this.router.use(t,...r.map(e=>e instanceof s?e.router:e)),this}add(t,r,e,...n){return typeof r=="string"&&typeof e=="function"?n=[e]:typeof e=="object"?typeof r=="function"?n=[c(e,r)]:n=n.map(a=>c(e,a)):typeof e=="function"&&(n=[e]),this.router.add(t,r,...n),this}prepareRequest(t,r){t.params={...r.params,...t.params}}}const m=i((o={})=>new s(o),"createEdgeRouter");exports.EdgeRouter=s;exports.createEdgeRouter=m;exports.getPathname=u;
1
+ "use strict";var p=Object.defineProperty;var h=(o,t)=>p(o,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./withZod--KKMTPIV.cjs"),d=require("./Router-DxPKBXlz.cjs");var f=Object.defineProperty,i=h((o,t)=>f(o,"name",{value:t,configurable:!0}),"r");const l=i(async o=>new Response(o.method==="HEAD"?null:`Route ${o.method} ${o.url} not found`,{status:404}),"onNoMatch"),E=i(async o=>(console.error(o),new Response("Internal Server Error",{status:500})),"onError"),u=i(o=>(o.nextUrl??new URL(o.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.Router;constructor(t={}){this.onNoMatch=t.onNoMatch??l,this.onError=t.onError??E}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(r,e)=>{const n=this.router.find(r.method,u(r));this.prepareRequest(r,n);try{return await(n.fns.length===0||n.middleOnly?this.onNoMatch(r,e,t):d.Router.exec(n.fns,r,e))}catch(a){return await this.onError(a,r,e,t)}}}async run(t,r){const e=this.router.find(t.method,u(t));if(e.fns.length!==0)return this.prepareRequest(t,e),await d.Router.exec(e.fns,t,r)}use(t,...r){return(typeof t=="function"||t instanceof s)&&(r.unshift(t),t="/"),this.router.use(t,...r.map(e=>e instanceof s?e.router:e)),this}add(t,r,e,...n){return typeof r=="string"&&typeof e=="function"?n=[e]:typeof e=="object"?typeof r=="function"?n=[c(e,r)]:n=n.map(a=>c(e,a)):typeof e=="function"&&(n=[e]),this.router.add(t,r,...n),this}prepareRequest(t,r){t.params={...r.params,...t.params}}}const m=i((o={})=>new s(o),"createEdgeRouter");exports.EdgeRouter=s;exports.createEdgeRouter=m;exports.getPathname=u;
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var h=(o,t)=>f(o,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./withZod-DuW1_gKH.cjs"),d=require("./Router-DxPKBXlz.cjs");var p=Object.defineProperty,s=h((o,t)=>p(o,"name",{value:t,configurable:!0}),"r");const l=s(async(o,t)=>{t.statusCode=404,t.end(o.method==="HEAD"?void 0:`Route ${o.method} ${o.url} not found`)},"onNoMatch"),m=s(async(o,t,e)=>{e.statusCode=500,console.error(o),e.end("Internal Server Error")},"onError"),c=s(o=>{const t=o.indexOf("?");return t===-1?o:o.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.Router;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(e,r)=>{const n=this.router.find(e.method,c(e.url));this.prepareRequest(e,n);try{await(n.fns.length===0||n.middleOnly?this.onNoMatch(e,r,t):d.Router.exec(n.fns,e,r))}catch(a){await this.onError(a,e,r,t)}}}async run(t,e){const r=this.router.find(t.method,c(t.url));if(r.fns.length!==0)return this.prepareRequest(t,r),await d.Router.exec(r.fns,t,e)}use(t,...e){return(typeof t=="function"||t instanceof i)&&(e.unshift(t),t="/"),this.router.use(t,...e.map(r=>r instanceof i?r.router:r)),this}add(t,e,r,...n){return typeof e=="string"&&typeof r=="function"?n=[r]:typeof r=="object"?typeof e=="function"?n=[u(r,e)]:n=n.map(a=>u(r,a)):typeof r=="function"&&(n=[r]),this.router.add(t,e,...n),this}prepareRequest(t,e){t.params={...e.params,...t.params}}}const E=s((o={})=>new i(o),"createRouter");exports.NodeRouter=i;exports.createRouter=E;exports.getPathname=c;
1
+ "use strict";var f=Object.defineProperty;var h=(o,t)=>f(o,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./withZod--KKMTPIV.cjs"),d=require("./Router-DxPKBXlz.cjs");var p=Object.defineProperty,s=h((o,t)=>p(o,"name",{value:t,configurable:!0}),"r");const l=s(async(o,t)=>{t.statusCode=404,t.end(o.method==="HEAD"?void 0:`Route ${o.method} ${o.url} not found`)},"onNoMatch"),m=s(async(o,t,e)=>{e.statusCode=500,console.error(o),e.end("Internal Server Error")},"onError"),u=s(o=>{const t=o.indexOf("?");return t===-1?o:o.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.Router;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(e,r)=>{const n=this.router.find(e.method,u(e.url));this.prepareRequest(e,n);try{await(n.fns.length===0||n.middleOnly?this.onNoMatch(e,r,t):d.Router.exec(n.fns,e,r))}catch(a){await this.onError(a,e,r,t)}}}async run(t,e){const r=this.router.find(t.method,u(t.url));if(r.fns.length!==0)return this.prepareRequest(t,r),await d.Router.exec(r.fns,t,e)}use(t,...e){return(typeof t=="function"||t instanceof i)&&(e.unshift(t),t="/"),this.router.use(t,...e.map(r=>r instanceof i?r.router:r)),this}add(t,e,r,...n){return typeof e=="string"&&typeof r=="function"?n=[r]:typeof r=="object"?typeof e=="function"?n=[c(r,e)]:n=n.map(a=>c(r,a)):typeof r=="function"&&(n=[r]),this.router.add(t,e,...n),this}prepareRequest(t,e){t.params={...e.params,...t.params}}}const E=s((o={})=>new i(o),"createRouter");exports.NodeRouter=i;exports.createRouter=E;exports.getPathname=u;
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var n=(t,e)=>u(t,"name",{value:e,configurable:!0});const p=require("http-errors"),d=require("zod"),l=n(t=>t&&typeof t=="object"&&"default"in t?t.default:t,"_interopDefaultCompat"),y=l(p);var m=Object.defineProperty,h=n((t,e)=>m(t,"name",{value:e,configurable:!0}),"d");const j=h((t,e)=>async(a,i,f)=>{let r=a;try{r=await t.parseAsync(a)}catch(o){let{message:s}=o;throw o instanceof d.ZodError&&typeof o.format=="function"&&(s=o.issues.map(c=>`${c.path.join("/")} - ${c.message}`).join("/n")),y(422,s)}return e(r,i,f)},"withZod");module.exports=j;
1
+ "use strict";var u=Object.defineProperty;var a=(t,e)=>u(t,"name",{value:e,configurable:!0});const p=require("http-errors"),d=require("zod"),l=a(t=>t&&typeof t=="object"&&"default"in t?t.default:t,"_interopDefaultCompat"),y=l(p);var m=Object.defineProperty,h=a((t,e)=>m(t,"name",{value:e,configurable:!0}),"d");const j=h((t,e)=>async(n,i,f)=>{let r=n;try{r=await t.parseAsync(n)}catch(o){let{message:s}=o;throw o instanceof d.ZodError&&typeof o.format=="function"&&(s=o.issues.map(c=>`${c.path.join("/")} - ${c.message}`).join("/n")),y(422,s)}return e(r,i,f)},"withZod");module.exports=j;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/connect",
3
- "version": "3.0.15",
3
+ "version": "3.0.16",
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",
@@ -76,17 +76,17 @@
76
76
  "devDependencies": {
77
77
  "@anolilab/eslint-config": "^15.0.3",
78
78
  "@anolilab/prettier-config": "^5.0.14",
79
- "@anolilab/semantic-release-pnpm": "^1.1.3",
80
- "@anolilab/semantic-release-preset": "^9.0.0",
81
- "@arethetypeswrong/cli": "^0.16.4",
82
- "@babel/core": "^7.25.7",
79
+ "@anolilab/semantic-release-pnpm": "^1.1.5",
80
+ "@anolilab/semantic-release-preset": "^9.0.2",
81
+ "@arethetypeswrong/cli": "^0.17.1",
82
+ "@babel/core": "^7.26.0",
83
83
  "@rushstack/eslint-plugin-security": "^0.8.3",
84
84
  "@types/http-errors": "^2.0.4",
85
85
  "@types/node": "18.19.15",
86
86
  "@visulima/nextra-theme-docs": "4.0.26",
87
- "@visulima/packem": "1.0.7",
88
- "@vitest/coverage-v8": "^2.1.2",
89
- "@vitest/ui": "^2.1.2",
87
+ "@visulima/packem": "1.9.2",
88
+ "@vitest/coverage-v8": "^2.1.8",
89
+ "@vitest/ui": "^2.1.8",
90
90
  "conventional-changelog-conventionalcommits": "8.0.0",
91
91
  "cross-env": "^7.0.3",
92
92
  "esbuild": "0.24.0",
@@ -98,21 +98,21 @@
98
98
  "eslint-plugin-vitest": "^0.4.1",
99
99
  "eslint-plugin-vitest-globals": "^1.5.0",
100
100
  "eslint-plugin-zod": "^1.4.0",
101
- "express": "^4.21.0",
102
- "fastify": "^5.0.0",
101
+ "express": "^4.21.2",
102
+ "fastify": "^5.1.0",
103
103
  "isomorphic-fetch": "^3.0.0",
104
- "prettier": "^3.3.3",
104
+ "prettier": "^3.4.2",
105
105
  "rimraf": "5.0.9",
106
106
  "semantic-release": "24.0.0",
107
107
  "typescript": "5.4.5",
108
- "vitest": "^2.1.2",
109
- "zod": "^3.23.8"
108
+ "vitest": "^2.1.8",
109
+ "zod": "^3.24.1"
110
110
  },
111
111
  "peerDependencies": {
112
112
  "zod": "^3.22.4"
113
113
  },
114
114
  "engines": {
115
- "node": ">=18.* <=22.*"
115
+ "node": ">=18.* <=23.*"
116
116
  },
117
117
  "os": [
118
118
  "darwin",