itty-router 2.4.8 → 2.4.9

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,6 +1,7 @@
1
1
  ## Changelog
2
2
  Until this library makes it to a production release of v1.x, **minor versions may contain breaking changes to the API**. After v1.x, semantic versioning will be honored, and breaking changes will only occur under the umbrella of a major version bump.
3
3
 
4
+ - **v2.4.7** - fixed the cursed "optional" file format capturing bug - RIP all the bytes lost
4
5
  - **v2.4.6** - fixed README issues
5
6
  - **v2.4.1** - fixed type errors introduced with 2.4.0
6
7
  - **v2.4.0** - HUGE internal code-golfing refactor thanks to [@taralx](https://github.com/taralx)! Super cool work on this!!!
package/README.md CHANGED
@@ -23,7 +23,7 @@ It's an itty bitty router, designed for express-like routing within [Cloudflare
23
23
 
24
24
  ### Addons & Related Libraries
25
25
  1. [itty-router-extras](https://www.npmjs.com/package/itty-router-extras) - adds quality-of-life improvements and utility functions for simplifying request/response code (e.g. middleware, cookies, body parsing, json handling, errors, and an itty version with automatic exception handling)!
26
- 2. [itty-durable](https://github.com/kwhitley/itty-durable) - creates a more direct object-like API for interacting with [Cloudflare Durable Objects](https://developers.cloudflare.com/workers/learning/using-durable-objects).
26
+ 2. [itty-durable](https://github.com/kwhitley/itty-durable) - (EXPERIMENTAL/alpha) creates a more direct object-like API for interacting with [Cloudflare Durable Objects](https://developers.cloudflare.com/workers/learning/using-durable-objects).
27
27
 
28
28
  ## Features
29
29
  - [x] Tiny ([~4xx bytes](https://bundlephobia.com/package/itty-router) compressed) with zero dependencies.
@@ -399,6 +399,7 @@ const Router = ({ base = '', routes = [] } = {}) => ({
399
399
  .replace(/\/$/, '')
400
400
  .replace(/:(\w+)(\?)?(\.)?/g, '$2(?<$1>[^/]+)$2$3')
401
401
  .replace(/\.(?=[\w(])/, '\\.')
402
+ .replace(/\)\.\?\(([^\[]+)\[\^/g, '?)\\.?($1(?<=\\.)[^\\.')
402
403
  }/*$`),
403
404
  H,
404
405
  ]) && c
@@ -1 +1 @@
1
- module.exports={Router:({base:t="",routes:l=[]}={})=>({__proto__:new Proxy({},{get:(e,a,o)=>(e,...r)=>l.push([a.toUpperCase(),RegExp(`^${(t+e).replace(/(\/?)\*/g,"($1.*)?").replace(/\/$/,"").replace(/:(\w+)(\?)?(\.)?/g,"$2(?<$1>[^/]+)$2$3").replace(/\.(?=[\w(])/,"\\.")}/*$`),r])&&o}),routes:l,async handle(e,...r){let a,o,t=new URL(e.url);e.query=Object.fromEntries(t.searchParams);for(var[p,s,u]of l)if((p===e.method||"ALL"===p)&&(o=t.pathname.match(s))){e.params=o.groups;for(var c of u)if(void 0!==(a=await c(e.proxy||e,...r)))return a}}})};
1
+ module.exports={Router:({base:p="",routes:u=[]}={})=>({__proto__:new Proxy({},{get:(e,a,o)=>(e,...r)=>u.push([a.toUpperCase(),RegExp(`^${(p+e).replace(/(\/?)\*/g,"($1.*)?").replace(/\/$/,"").replace(/:(\w+)(\?)?(\.)?/g,"$2(?<$1>[^/]+)$2$3").replace(/\.(?=[\w(])/,"\\.").replace(/\)\.\?\(([^\[]+)\[\^/g,"?)\\.?($1(?<=\\.)[^\\.")}/*$`),r])&&o}),routes:u,async handle(e,...r){let a,o,p=new URL(e.url);e.query=Object.fromEntries(p.searchParams);for(var[t,s,c]of u)if((t===e.method||"ALL"===t)&&(o=p.pathname.match(s))){e.params=o.groups;for(var l of c)if(void 0!==(a=await l(e.proxy||e,...r)))return a}}})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itty-router",
3
- "version": "2.4.8",
3
+ "version": "2.4.9",
4
4
  "description": "Tiny, zero-dependency router with route param and query parsing - built for Cloudflare Workers, but works everywhere!",
5
5
  "main": "./dist/itty-router.min.js",
6
6
  "types": "./dist/itty-router.d.ts",