itty-router 2.4.2 → 2.4.6

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +10 -7
  3. package/package.json +10 -3
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.6** - fixed README issues
4
5
  - **v2.4.1** - fixed type errors introduced with 2.4.0
5
6
  - **v2.4.0** - HUGE internal code-golfing refactor thanks to [@taralx](https://github.com/taralx)! Super cool work on this!!!
6
7
  - **v2.3.10** - fix: dots now properly escaped (e.g. /image.jpg should not match /imageXjpg)
package/README.md CHANGED
@@ -19,9 +19,11 @@
19
19
  <img alt="Join the discussion on Github" src="https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue" />
20
20
  </a>-->
21
21
 
22
- It's an itty bitty router, designed for Express.js-like routing within [Cloudflare Workers](https://developers.cloudflare.com/workers/) (or anywhere else). Like... it's super tiny ([~4xx bytes](https://bundlephobia.com/package/itty-router)), with zero dependencies. For reals.
22
+ It's an itty bitty router, designed for express-like routing within [Cloudflare Workers](https://developers.cloudflare.com/workers/) (or anywhere else). Like... it's super tiny ([~4xx bytes](https://bundlephobia.com/package/itty-router)), with zero dependencies. For reals.
23
23
 
24
- For quality-of-life improvements (e.g. middleware, cookies, body parsing, json handling, errors, and an itty version with automatic exception handling), to further shorten your routing code, be sure to check out [itty-router-extras](https://www.npmjs.com/package/itty-router-extras) - also specifically written for API development on [Cloudflare Workers](https://developers.cloudflare.com/workers/)!
24
+ ### Addons & Related Libraries
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).
25
27
 
26
28
  ## Features
27
29
  - [x] Tiny ([~4xx bytes](https://bundlephobia.com/package/itty-router) compressed) with zero dependencies.
@@ -33,9 +35,10 @@ For quality-of-life improvements (e.g. middleware, cookies, body parsing, json h
33
35
  - [x] [Base path](#nested-routers-with-404-handling) for prefixing all routes.
34
36
  - [x] [Multi-method support](#nested-routers-with-404-handling) using the `.all()` channel.
35
37
  - [x] Supports **any** method type (e.g. `.get() --> 'GET'` or `.puppy() --> 'PUPPY'`).
38
+ - [x] Supports [Cloudflare ES Module syntax](#cf-es6-module-syntax)! :)
39
+ - [x] [Preload or manually inject custom regex for routes](#manual-routes) (advanced usage)
36
40
  - [x] [Extendable](#extending-itty-router). Use itty as the internal base for more feature-rich/elaborate routers.
37
41
  - [x] Chainable route declarations (why not?)
38
- - [x] [Preload or manually inject custom regex for routes](#manual-routes) (advanced usage)
39
42
  - [ ] Readable internal code (yeah right...)
40
43
 
41
44
  ## Installation
@@ -195,7 +198,7 @@ GET /todos/jane?limit=2&page=1
195
198
  const missingHandler = new Response('Not found.', { status: 404 })
196
199
 
197
200
  // create a parent router
198
- const parentRouter = Router({ base: '/api' )
201
+ const parentRouter = Router({ base: '/api' })
199
202
 
200
203
  // and a child router (with FULL base path defined, from root)
201
204
  const todosRouter = Router({ base: '/api/todos' })
@@ -446,12 +449,12 @@ This trick allows methods (e.g. "get", "post") to by defined dynamically by the
446
449
  These folks are the real heroes, making open source the powerhouse that it is! Help out and get your name added to this list! <3
447
450
 
448
451
  #### Core, Concepts, and Codebase
452
+ - [@mvasigh](https://github.com/mvasigh) - proxy hack wizard behind itty, coding partner in crime, maker of the entire doc site, etc, etc.
449
453
  - [@taralx](https://github.com/taralx) - router internal code-golfing refactor for performance and character savings
450
454
  - [@hunterloftis](https://github.com/hunterloftis) - router.handle() method now accepts extra arguments and passed them to route functions
451
- - [@mvasigh](https://github.com/mvasigh) - proxy hacks courtesy of this chap
452
455
  #### Fixes
453
456
  - [@taralx](https://github.com/taralx) - QOL fixes for contributing (dev dep fix and test file consistency) <3
454
457
  - [@technoyes](https://github.com/technoyes) - three kind-of-a-big-deal errors fixed. Imagine the look on my face... thanks man!! :)
455
458
  - [@roojay520](https://github.com/roojay520) - TS interface fixes
456
- - [@arunsathiya](https://github.com/arunsathiya) - documentation
457
- - [@poacher2k](https://github.com/poacher2k) - documentation
459
+ #### Documentation
460
+ - [@arunsathiya](https://github.com/arunsathiya), [@poacher2k](https://github.com/poacher2k), [@kclauson](https://github.com/kclauson)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itty-router",
3
- "version": "2.4.2",
4
- "description": "Tiny, zero-dependency router with route param and query parsing - build for Cloudflare Workers, but works everywhere!",
3
+ "version": "2.4.6",
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",
7
7
  "files": [
@@ -11,14 +11,21 @@
11
11
  "keywords": [
12
12
  "router",
13
13
  "cloudflare",
14
+ "worker",
14
15
  "workers",
15
16
  "serverless",
17
+ "api",
16
18
  "express",
17
19
  "regex",
18
20
  "routing",
19
- "api",
20
21
  "handler",
21
22
  "params",
23
+ "request",
24
+ "response",
25
+ "service worker",
26
+ "sw",
27
+ "cf",
28
+ "optional",
22
29
  "middleware",
23
30
  "nested",
24
31
  "rest",