itty-router 4.0.9 → 4.0.10-next.0
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/.eslintrc +26 -0
- package/.github/FUNDING.yml +12 -0
- package/.github/ISSUE_TEMPLATE/issue_template.md +52 -0
- package/.github/ISSUE_TEMPLATE/question.md +16 -0
- package/.github/pull_request_template.md +28 -0
- package/.github/workflows/coveralls.yml +23 -0
- package/.github/workflows/verify.yml +21 -0
- package/.nyc_output/17f58b46-7631-4765-9ac8-c567ad984881.json +1 -0
- package/.nyc_output/37b99878-3734-4671-b7ad-9716c334e6da.json +1 -0
- package/.nyc_output/522b1502-594a-4786-90b9-0b52ce677765.json +1 -0
- package/.nyc_output/5ad76e3a-7bd8-4131-b761-9eda43350422.json +1 -0
- package/.nyc_output/8518a247-c46c-4288-b558-73a9da27d039.json +1 -0
- package/.nyc_output/8cdba743-d03a-4ae0-80a9-be1698a6621a.json +1 -0
- package/.nyc_output/a5a529a4-8c20-4fc6-8e19-68f85c854251.json +1 -0
- package/.nyc_output/a9e151d4-d47a-4440-885b-1ab50a6ac1a0.json +1 -0
- package/.nyc_output/bfc97de7-26ae-4d9c-a9a6-2021b608d83b.json +1 -0
- package/.nyc_output/c26290ed-5973-4907-a3f1-29678d97224a.json +1 -0
- package/.nyc_output/c6b55c94-7cf5-4f08-86e7-ce60b0d7064c.json +1 -0
- package/.nyc_output/e2b16e51-822d-4c53-ad21-bb54668ec04d.json +1 -0
- package/.nyc_output/e548baf2-1d0a-4dc2-abe4-4a52ae914581.json +1 -0
- package/.nyc_output/processinfo/17f58b46-7631-4765-9ac8-c567ad984881.json +16 -0
- package/.nyc_output/processinfo/37b99878-3734-4671-b7ad-9716c334e6da.json +19 -0
- package/.nyc_output/processinfo/522b1502-594a-4786-90b9-0b52ce677765.json +16 -0
- package/.nyc_output/processinfo/5ad76e3a-7bd8-4131-b761-9eda43350422.json +16 -0
- package/.nyc_output/processinfo/8518a247-c46c-4288-b558-73a9da27d039.json +17 -0
- package/.nyc_output/processinfo/8cdba743-d03a-4ae0-80a9-be1698a6621a.json +16 -0
- package/.nyc_output/processinfo/a5a529a4-8c20-4fc6-8e19-68f85c854251.json +17 -0
- package/.nyc_output/processinfo/a9e151d4-d47a-4440-885b-1ab50a6ac1a0.json +20 -0
- package/.nyc_output/processinfo/bfc97de7-26ae-4d9c-a9a6-2021b608d83b.json +16 -0
- package/.nyc_output/processinfo/c26290ed-5973-4907-a3f1-29678d97224a.json +16 -0
- package/.nyc_output/processinfo/c6b55c94-7cf5-4f08-86e7-ce60b0d7064c.json +16 -0
- package/.nyc_output/processinfo/e2b16e51-822d-4c53-ad21-bb54668ec04d.json +17 -0
- package/.nyc_output/processinfo/e548baf2-1d0a-4dc2-abe4-4a52ae914581.json +16 -0
- package/.nyc_output/processinfo/index.json +70 -0
- package/.prettierignore +1 -0
- package/.prettierrc +4 -0
- package/CHANGELOG.md +48 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/README.md +4 -4
- package/example/bun.ts +15 -0
- package/example/cors-types.ts +92 -0
- package/example/index.ts +50 -0
- package/example/node.js +20 -0
- package/example/request-types.ts +97 -0
- package/example/runtimes/bun.ts +15 -0
- package/example/runtimes/express.js +16 -0
- package/example/runtimes/node.js +20 -0
- package/package-lock.json +13106 -0
- package/package.json +66 -3
- package/rollup.config.mjs +33 -0
- package/test/index.ts +66 -0
- package/tsconfig.json +28 -0
- package/vitest.config.ts +11 -0
- package/cjs/Router.d.ts +0 -49
- package/cjs/StatusError.d.ts +0 -10
- package/createCors.d.ts +0 -12
- package/createResponse.d.ts +0 -7
- package/error.d.ts +0 -11
- package/html.d.ts +0 -1
- package/index.d.ts +0 -15
- package/jpeg.d.ts +0 -1
- package/json.d.ts +0 -1
- package/png.d.ts +0 -1
- package/status.d.ts +0 -1
- package/text.d.ts +0 -1
- package/webp.d.ts +0 -1
- package/websocket.d.ts +0 -1
- package/withContent.d.ts +0 -2
- package/withCookies.d.ts +0 -2
- package/withParams.d.ts +0 -2
- /package/{cjs/Router.js → dist/Router.cjs.js} +0 -0
- /package/{Router.d.ts → dist/Router.d.ts} +0 -0
- /package/{Router.js → dist/Router.js} +0 -0
- /package/{cjs/StatusError.js → dist/StatusError.cjs.js} +0 -0
- /package/{StatusError.d.ts → dist/StatusError.d.ts} +0 -0
- /package/{StatusError.js → dist/StatusError.js} +0 -0
- /package/{cjs/createCors.js → dist/createCors.cjs.js} +0 -0
- /package/{cjs → dist}/createCors.d.ts +0 -0
- /package/{createCors.js → dist/createCors.js} +0 -0
- /package/{cjs/createResponse.js → dist/createResponse.cjs.js} +0 -0
- /package/{cjs → dist}/createResponse.d.ts +0 -0
- /package/{createResponse.js → dist/createResponse.js} +0 -0
- /package/{cjs/error.js → dist/error.cjs.js} +0 -0
- /package/{cjs → dist}/error.d.ts +0 -0
- /package/{error.js → dist/error.js} +0 -0
- /package/{cjs/html.js → dist/html.cjs.js} +0 -0
- /package/{cjs → dist}/html.d.ts +0 -0
- /package/{html.js → dist/html.js} +0 -0
- /package/{cjs/index.js → dist/index.cjs.js} +0 -0
- /package/{cjs → dist}/index.d.ts +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{cjs/jpeg.js → dist/jpeg.cjs.js} +0 -0
- /package/{cjs → dist}/jpeg.d.ts +0 -0
- /package/{jpeg.js → dist/jpeg.js} +0 -0
- /package/{cjs/json.js → dist/json.cjs.js} +0 -0
- /package/{cjs → dist}/json.d.ts +0 -0
- /package/{json.js → dist/json.js} +0 -0
- /package/{cjs/png.js → dist/png.cjs.js} +0 -0
- /package/{cjs → dist}/png.d.ts +0 -0
- /package/{png.js → dist/png.js} +0 -0
- /package/{cjs/status.js → dist/status.cjs.js} +0 -0
- /package/{cjs → dist}/status.d.ts +0 -0
- /package/{status.js → dist/status.js} +0 -0
- /package/{cjs/text.js → dist/text.cjs.js} +0 -0
- /package/{cjs → dist}/text.d.ts +0 -0
- /package/{text.js → dist/text.js} +0 -0
- /package/{cjs/webp.js → dist/webp.cjs.js} +0 -0
- /package/{cjs → dist}/webp.d.ts +0 -0
- /package/{webp.js → dist/webp.js} +0 -0
- /package/{cjs/websocket.js → dist/websocket.cjs.js} +0 -0
- /package/{cjs → dist}/websocket.d.ts +0 -0
- /package/{websocket.js → dist/websocket.js} +0 -0
- /package/{cjs/withContent.js → dist/withContent.cjs.js} +0 -0
- /package/{cjs → dist}/withContent.d.ts +0 -0
- /package/{withContent.js → dist/withContent.js} +0 -0
- /package/{cjs/withCookies.js → dist/withCookies.cjs.js} +0 -0
- /package/{cjs → dist}/withCookies.d.ts +0 -0
- /package/{withCookies.js → dist/withCookies.js} +0 -0
- /package/{cjs/withParams.js → dist/withParams.cjs.js} +0 -0
- /package/{cjs → dist}/withParams.d.ts +0 -0
- /package/{withParams.js → dist/withParams.js} +0 -0
package/.eslintrc
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2021": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended",
|
|
9
|
+
"prettier"
|
|
10
|
+
],
|
|
11
|
+
"overrides": [],
|
|
12
|
+
"parser": "@typescript-eslint/parser",
|
|
13
|
+
"parserOptions": {
|
|
14
|
+
"ecmaVersion": "latest",
|
|
15
|
+
"sourceType": "module"
|
|
16
|
+
},
|
|
17
|
+
"plugins": ["@typescript-eslint"],
|
|
18
|
+
"rules": {
|
|
19
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
20
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
21
|
+
"linebreak-style": ["error", "unix"],
|
|
22
|
+
"prefer-const": "off",
|
|
23
|
+
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
|
|
24
|
+
"semi": ["error", "never"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: kwhitley
|
|
4
|
+
open_collective: kevinrwhitley
|
|
5
|
+
# patreon: # Replace with a single Patreon username
|
|
6
|
+
# ko_fi: # Replace with a single Ko-fi username
|
|
7
|
+
# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
8
|
+
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
# liberapay: # Replace with a single Liberapay username
|
|
10
|
+
# issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
# otechie: # Replace with a single Otechie username
|
|
12
|
+
# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: New Issue
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Describe the Issue
|
|
10
|
+
|
|
11
|
+
A clear and concise description of what the issue is.
|
|
12
|
+
|
|
13
|
+
## Example Router Code
|
|
14
|
+
|
|
15
|
+
Please provide the itty-router code related to the issue. If possible, create a minimal, reproducible example.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// your code here
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Request Details
|
|
22
|
+
|
|
23
|
+
- Method: [e.g., GET, POST, PUT, DELETE]
|
|
24
|
+
- URL: [e.g., /api/v1/users]
|
|
25
|
+
- Request Body: If applicable, include the request body.
|
|
26
|
+
- Request Headers: If applicable, include the request headers.
|
|
27
|
+
|
|
28
|
+
## Steps to Reproduce
|
|
29
|
+
|
|
30
|
+
Steps to reproduce the behavior:
|
|
31
|
+
|
|
32
|
+
1. Run '...'
|
|
33
|
+
2. Send request to '....'
|
|
34
|
+
3. See error
|
|
35
|
+
|
|
36
|
+
## Expected Behavior
|
|
37
|
+
|
|
38
|
+
A clear and concise description of what you expected to happen.
|
|
39
|
+
|
|
40
|
+
## Actual Behavior
|
|
41
|
+
|
|
42
|
+
A clear and concise description of what actually happens. Include any error messages or unexpected responses.
|
|
43
|
+
|
|
44
|
+
## Environment (please complete the following information):
|
|
45
|
+
|
|
46
|
+
- Environment: [e.g., Node, Bun, Cloudflare Workers, Service Workers, Browser]
|
|
47
|
+
- itty-router Version: [e.g., 1.0.0]
|
|
48
|
+
- Other Relevant Libraries and their versions: [e.g., node 14.0.0]
|
|
49
|
+
|
|
50
|
+
## Additional Context
|
|
51
|
+
|
|
52
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Question
|
|
3
|
+
about: Have a question or something to discuss?
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Questions & Discussion
|
|
10
|
+
|
|
11
|
+
To cut down on long-standing topics that are discussion-based, rather than actual issues, please opt for one of the following paths, when possible. These have the benefit of potentially helping others after the issue (here) would have been closed.
|
|
12
|
+
|
|
13
|
+
1. [Create a Discussion Topic](https://github.com/kwhitley/itty-router/discussions/new/choose)
|
|
14
|
+
2. [Discuss on Discord](https://discord.com/channels/832353585802903572)
|
|
15
|
+
|
|
16
|
+
Cheers!
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
### Description
|
|
2
|
+
|
|
3
|
+
Please explain the changes you made here.
|
|
4
|
+
|
|
5
|
+
### Issue Related
|
|
6
|
+
|
|
7
|
+
- Link to the related issue:
|
|
8
|
+
|
|
9
|
+
### Type of Change (select one and follow subtasks)
|
|
10
|
+
|
|
11
|
+
- [ ] Maintenance or repo-level work (e.g. linting, build, tests, refactoring, etc.)
|
|
12
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
13
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
14
|
+
- [ ] Is this a mainstream benefit or an edge case?
|
|
15
|
+
- [ ] Is it worth the bytes?
|
|
16
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality/userland code to not work as expected)
|
|
17
|
+
- [ ] Explain why a breaking change is necessary:
|
|
18
|
+
- [ ] This change requires (or is) a documentation update
|
|
19
|
+
- [ ] I have added necessary local documentation (if appropriate)
|
|
20
|
+
- [ ] I have added necessary [itty.dev](https://github.com/kwhitley/itty.dev) documentation (if appropriate)
|
|
21
|
+
|
|
22
|
+
### Testing
|
|
23
|
+
|
|
24
|
+
Please describe the tests that you ran to verify your changes.
|
|
25
|
+
|
|
26
|
+
### Checklist
|
|
27
|
+
|
|
28
|
+
- [ ] I have read the [CONTRIBUTING](../CONTRIBUTING.md) doc
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
on: ['push', 'pull_request']
|
|
2
|
+
|
|
3
|
+
name: Coveralls
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
name: Build
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v1
|
|
11
|
+
|
|
12
|
+
- name: Use Node.js 16.x
|
|
13
|
+
uses: actions/setup-node@v3
|
|
14
|
+
with:
|
|
15
|
+
node-version: 16.x
|
|
16
|
+
|
|
17
|
+
- name: npm install, npm run coverage
|
|
18
|
+
run: |
|
|
19
|
+
npm install
|
|
20
|
+
npm run coverage
|
|
21
|
+
|
|
22
|
+
- name: Coveralls
|
|
23
|
+
uses: coverallsapp/github-action@v2
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [v4.x]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [v4.x]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v2
|
|
15
|
+
- name: Use Node.js
|
|
16
|
+
uses: actions/setup-node@v1
|
|
17
|
+
with:
|
|
18
|
+
node-version: '16.x'
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: yarn
|
|
21
|
+
- run: yarn verify
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
3
|
+
"pid": 51992,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/jest-worker/build/workers/processChild.js"
|
|
7
|
+
],
|
|
8
|
+
"execArgv": [],
|
|
9
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
10
|
+
"time": 1664080894739,
|
|
11
|
+
"ppid": 51983,
|
|
12
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/17f58b46-7631-4765-9ac8-c567ad984881.json",
|
|
13
|
+
"externalId": "",
|
|
14
|
+
"uuid": "17f58b46-7631-4765-9ac8-c567ad984881",
|
|
15
|
+
"files": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "e2b16e51-822d-4c53-ad21-bb54668ec04d",
|
|
3
|
+
"pid": 51983,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/.bin/jest",
|
|
7
|
+
"--verbose",
|
|
8
|
+
"--coverage",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"execArgv": [],
|
|
12
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
13
|
+
"time": 1664080893646,
|
|
14
|
+
"ppid": 51979,
|
|
15
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/37b99878-3734-4671-b7ad-9716c334e6da.json",
|
|
16
|
+
"externalId": "",
|
|
17
|
+
"uuid": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
18
|
+
"files": []
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
3
|
+
"pid": 51984,
|
|
4
|
+
"argv": ["/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node"],
|
|
5
|
+
"execArgv": [
|
|
6
|
+
"--eval",
|
|
7
|
+
"import(\"node:fs\").then(() => console.log(true), () => console.log(false));"
|
|
8
|
+
],
|
|
9
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
10
|
+
"time": 1664080893846,
|
|
11
|
+
"ppid": 51983,
|
|
12
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/522b1502-594a-4786-90b9-0b52ce677765.json",
|
|
13
|
+
"externalId": "",
|
|
14
|
+
"uuid": "522b1502-594a-4786-90b9-0b52ce677765",
|
|
15
|
+
"files": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
3
|
+
"pid": 51991,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/jest-worker/build/workers/processChild.js"
|
|
7
|
+
],
|
|
8
|
+
"execArgv": [],
|
|
9
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
10
|
+
"time": 1664080894703,
|
|
11
|
+
"ppid": 51983,
|
|
12
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/5ad76e3a-7bd8-4131-b761-9eda43350422.json",
|
|
13
|
+
"externalId": "",
|
|
14
|
+
"uuid": "5ad76e3a-7bd8-4131-b761-9eda43350422",
|
|
15
|
+
"files": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "e2b16e51-822d-4c53-ad21-bb54668ec04d",
|
|
3
|
+
"pid": 51980,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/usr/local/Cellar/yarn/1.22.19/libexec/bin/yarn.js",
|
|
7
|
+
"lint"
|
|
8
|
+
],
|
|
9
|
+
"execArgv": [],
|
|
10
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
11
|
+
"time": 1664080892483,
|
|
12
|
+
"ppid": 51979,
|
|
13
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/8518a247-c46c-4288-b558-73a9da27d039.json",
|
|
14
|
+
"externalId": "",
|
|
15
|
+
"uuid": "8518a247-c46c-4288-b558-73a9da27d039",
|
|
16
|
+
"files": []
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
3
|
+
"pid": 51990,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/jest-worker/build/workers/processChild.js"
|
|
7
|
+
],
|
|
8
|
+
"execArgv": [],
|
|
9
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
10
|
+
"time": 1664080894712,
|
|
11
|
+
"ppid": 51983,
|
|
12
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/8cdba743-d03a-4ae0-80a9-be1698a6621a.json",
|
|
13
|
+
"externalId": "",
|
|
14
|
+
"uuid": "8cdba743-d03a-4ae0-80a9-be1698a6621a",
|
|
15
|
+
"files": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "a9e151d4-d47a-4440-885b-1ab50a6ac1a0",
|
|
3
|
+
"pid": 51982,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/.bin/eslint",
|
|
7
|
+
"src"
|
|
8
|
+
],
|
|
9
|
+
"execArgv": [],
|
|
10
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
11
|
+
"time": 1664080892958,
|
|
12
|
+
"ppid": 51981,
|
|
13
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/a5a529a4-8c20-4fc6-8e19-68f85c854251.json",
|
|
14
|
+
"externalId": "",
|
|
15
|
+
"uuid": "a5a529a4-8c20-4fc6-8e19-68f85c854251",
|
|
16
|
+
"files": []
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "8518a247-c46c-4288-b558-73a9da27d039",
|
|
3
|
+
"pid": 51981,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/lib/node_modules/npm/bin/npm-cli.js",
|
|
7
|
+
"exec",
|
|
8
|
+
"--",
|
|
9
|
+
"eslint",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"execArgv": [],
|
|
13
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
14
|
+
"time": 1664080892683,
|
|
15
|
+
"ppid": 51980,
|
|
16
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/a9e151d4-d47a-4440-885b-1ab50a6ac1a0.json",
|
|
17
|
+
"externalId": "",
|
|
18
|
+
"uuid": "a9e151d4-d47a-4440-885b-1ab50a6ac1a0",
|
|
19
|
+
"files": []
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
3
|
+
"pid": 51993,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/jest-worker/build/workers/processChild.js"
|
|
7
|
+
],
|
|
8
|
+
"execArgv": [],
|
|
9
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
10
|
+
"time": 1664080894720,
|
|
11
|
+
"ppid": 51983,
|
|
12
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/bfc97de7-26ae-4d9c-a9a6-2021b608d83b.json",
|
|
13
|
+
"externalId": "",
|
|
14
|
+
"uuid": "bfc97de7-26ae-4d9c-a9a6-2021b608d83b",
|
|
15
|
+
"files": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
3
|
+
"pid": 51994,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/jest-worker/build/workers/processChild.js"
|
|
7
|
+
],
|
|
8
|
+
"execArgv": [],
|
|
9
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
10
|
+
"time": 1664080894736,
|
|
11
|
+
"ppid": 51983,
|
|
12
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/c26290ed-5973-4907-a3f1-29678d97224a.json",
|
|
13
|
+
"externalId": "",
|
|
14
|
+
"uuid": "c26290ed-5973-4907-a3f1-29678d97224a",
|
|
15
|
+
"files": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
3
|
+
"pid": 51989,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/jest-worker/build/workers/processChild.js"
|
|
7
|
+
],
|
|
8
|
+
"execArgv": [],
|
|
9
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
10
|
+
"time": 1664080894701,
|
|
11
|
+
"ppid": 51983,
|
|
12
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/c6b55c94-7cf5-4f08-86e7-ce60b0d7064c.json",
|
|
13
|
+
"externalId": "",
|
|
14
|
+
"uuid": "c6b55c94-7cf5-4f08-86e7-ce60b0d7064c",
|
|
15
|
+
"files": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": null,
|
|
3
|
+
"pid": 51978,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/usr/local/Cellar/yarn/1.22.19/libexec/bin/yarn.js",
|
|
7
|
+
"test"
|
|
8
|
+
],
|
|
9
|
+
"execArgv": [],
|
|
10
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
11
|
+
"time": 1664080892285,
|
|
12
|
+
"ppid": 51977,
|
|
13
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/e2b16e51-822d-4c53-ad21-bb54668ec04d.json",
|
|
14
|
+
"externalId": "",
|
|
15
|
+
"uuid": "e2b16e51-822d-4c53-ad21-bb54668ec04d",
|
|
16
|
+
"files": []
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
3
|
+
"pid": 51988,
|
|
4
|
+
"argv": [
|
|
5
|
+
"/Users/kevinwhitley/.nvm/versions/node/v16.15.1/bin/node",
|
|
6
|
+
"/Users/kevinwhitley/dev/kwhitley/itty-router/node_modules/jest-worker/build/workers/processChild.js"
|
|
7
|
+
],
|
|
8
|
+
"execArgv": [],
|
|
9
|
+
"cwd": "/Users/kevinwhitley/dev/kwhitley/itty-router",
|
|
10
|
+
"time": 1664080894718,
|
|
11
|
+
"ppid": 51983,
|
|
12
|
+
"coverageFilename": "/Users/kevinwhitley/dev/kwhitley/itty-router/.nyc_output/e548baf2-1d0a-4dc2-abe4-4a52ae914581.json",
|
|
13
|
+
"externalId": "",
|
|
14
|
+
"uuid": "e548baf2-1d0a-4dc2-abe4-4a52ae914581",
|
|
15
|
+
"files": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"processes": {
|
|
3
|
+
"17f58b46-7631-4765-9ac8-c567ad984881": {
|
|
4
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
5
|
+
"children": []
|
|
6
|
+
},
|
|
7
|
+
"37b99878-3734-4671-b7ad-9716c334e6da": {
|
|
8
|
+
"parent": "e2b16e51-822d-4c53-ad21-bb54668ec04d",
|
|
9
|
+
"children": [
|
|
10
|
+
"17f58b46-7631-4765-9ac8-c567ad984881",
|
|
11
|
+
"522b1502-594a-4786-90b9-0b52ce677765",
|
|
12
|
+
"5ad76e3a-7bd8-4131-b761-9eda43350422",
|
|
13
|
+
"8cdba743-d03a-4ae0-80a9-be1698a6621a",
|
|
14
|
+
"bfc97de7-26ae-4d9c-a9a6-2021b608d83b",
|
|
15
|
+
"c26290ed-5973-4907-a3f1-29678d97224a",
|
|
16
|
+
"c6b55c94-7cf5-4f08-86e7-ce60b0d7064c",
|
|
17
|
+
"e548baf2-1d0a-4dc2-abe4-4a52ae914581"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"522b1502-594a-4786-90b9-0b52ce677765": {
|
|
21
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
22
|
+
"children": []
|
|
23
|
+
},
|
|
24
|
+
"5ad76e3a-7bd8-4131-b761-9eda43350422": {
|
|
25
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
26
|
+
"children": []
|
|
27
|
+
},
|
|
28
|
+
"8518a247-c46c-4288-b558-73a9da27d039": {
|
|
29
|
+
"parent": "e2b16e51-822d-4c53-ad21-bb54668ec04d",
|
|
30
|
+
"children": ["a9e151d4-d47a-4440-885b-1ab50a6ac1a0"]
|
|
31
|
+
},
|
|
32
|
+
"8cdba743-d03a-4ae0-80a9-be1698a6621a": {
|
|
33
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
34
|
+
"children": []
|
|
35
|
+
},
|
|
36
|
+
"a5a529a4-8c20-4fc6-8e19-68f85c854251": {
|
|
37
|
+
"parent": "a9e151d4-d47a-4440-885b-1ab50a6ac1a0",
|
|
38
|
+
"children": []
|
|
39
|
+
},
|
|
40
|
+
"a9e151d4-d47a-4440-885b-1ab50a6ac1a0": {
|
|
41
|
+
"parent": "8518a247-c46c-4288-b558-73a9da27d039",
|
|
42
|
+
"children": ["a5a529a4-8c20-4fc6-8e19-68f85c854251"]
|
|
43
|
+
},
|
|
44
|
+
"bfc97de7-26ae-4d9c-a9a6-2021b608d83b": {
|
|
45
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
46
|
+
"children": []
|
|
47
|
+
},
|
|
48
|
+
"c26290ed-5973-4907-a3f1-29678d97224a": {
|
|
49
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
50
|
+
"children": []
|
|
51
|
+
},
|
|
52
|
+
"c6b55c94-7cf5-4f08-86e7-ce60b0d7064c": {
|
|
53
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
54
|
+
"children": []
|
|
55
|
+
},
|
|
56
|
+
"e2b16e51-822d-4c53-ad21-bb54668ec04d": {
|
|
57
|
+
"parent": null,
|
|
58
|
+
"children": [
|
|
59
|
+
"37b99878-3734-4671-b7ad-9716c334e6da",
|
|
60
|
+
"8518a247-c46c-4288-b558-73a9da27d039"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"e548baf2-1d0a-4dc2-abe4-4a52ae914581": {
|
|
64
|
+
"parent": "37b99878-3734-4671-b7ad-9716c334e6da",
|
|
65
|
+
"children": []
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"files": {},
|
|
69
|
+
"externalIds": {}
|
|
70
|
+
}
|
package/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
src/Router.ts
|
package/.prettierrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
## Changelog
|
|
2
|
+
|
|
3
|
+
- **v4.0.00** - Partial changelog below
|
|
4
|
+
- BREAKING: heavy TS rewrite for core Router (thank you, ChatGPT)
|
|
5
|
+
- added: nearly all extras from itty-router-extras
|
|
6
|
+
- added: createCors from itty-cors
|
|
7
|
+
- added: complete documentation at https://itty.dev
|
|
8
|
+
- feature: withParams may be used as upstream middleware (hooray!)
|
|
9
|
+
- **v3.0.11** - changed environment build to rollup (from tsup) and code golfed the toQuery logic. (credit [@DrLoopFall](https://github.com/DrLoopFall))
|
|
10
|
+
- **v3.0.9** - fixes some TS issue, previously requiring you to define Router Methods to chain request definitions. (credit [@jahands](https://github.com/jahands))
|
|
11
|
+
- **v3.0.0** - total TS conversion with improved types, adding greedy params (credit [@markusahlstrand](https://github.com/markusahlstrand))
|
|
12
|
+
- **v2.6.4** - merely a republish, attempting to solve NPM test scores vs CI/CD
|
|
13
|
+
- **v2.6.2** - fixes issue with using base path of "/" with route definitions starting with "/" (creating double slash)
|
|
14
|
+
- **v2.6.1** - fixes named export in ESM/mjs export
|
|
15
|
+
- **v2.6.0** - package now is hybrid export, supporting both ESM (.mjs) and CJS (.js) minified versions
|
|
16
|
+
- **v2.5.3** - corrects type for router.handle to return Promise<any>
|
|
17
|
+
- **v2.5.2** - fixes issue with arrow functions in CommonJS named exports (rare issue)
|
|
18
|
+
- **v2.5.1** - added context to Cloudflare ES module syntax example (credit [@jcapogna](https://github.com/jcapogna))
|
|
19
|
+
- **v2.5.0** - improved TypeScript docs/types (thanks [@SupremeTechnopriest](https://github.com/SupremeTechnopriest)!)
|
|
20
|
+
- **v2.4.9** - fixed the cursed "optional" file format capturing bug - RIP all the bytes lost
|
|
21
|
+
- **v2.4.6** - fixed README issues
|
|
22
|
+
- **v2.4.1** - fixed type errors introduced with 2.4.0
|
|
23
|
+
- **v2.4.0** - HUGE internal code-golfing refactor thanks to [@taralx](https://github.com/taralx)! Super cool work on this!!!
|
|
24
|
+
- **v2.3.10** - fix: dots now properly escaped (e.g. /image.jpg should not match /imageXjpg)
|
|
25
|
+
- **v2.3.9** - dev fixes: [@taralx](https://github.com/taralx) improved QOL issues for test writers and dev installers
|
|
26
|
+
- **v2.3.7** - fix: :id.:format not resolving (only conditional format would match)
|
|
27
|
+
- **v2.3.0** - feature: request handler will be passed request.proxy (if found) or request (if not) - allowing for middleware magic downstream...
|
|
28
|
+
- **v2.2.0** - feature: base path (option) is now included in the route param parsing...
|
|
29
|
+
- **v2.1.1** - fix: should now be strict-mode compatible
|
|
30
|
+
- **v2.1.0** - now handles the problematic . character within a param (e.g. /:url/action with /google.com/action)
|
|
31
|
+
- **v2.0.7** - shaved a few more characters in the regex
|
|
32
|
+
- **v2.0.0** - API break: `Router({ else: missingHandler })` has been replaced with `router.all('*', missingHandler)`, and now "all" channel respects order of entry
|
|
33
|
+
- **v1.6.0** - added { else: missingHandler } to options for 404 catch-alls (thanks to the discussion with [@martinffx](https://github.com/martinffx))
|
|
34
|
+
- **v1.5.0** - added '.all(route, handler)' handling for passthrough middleware
|
|
35
|
+
- **v1.4.3** - fixed nested routers using simple "/" routes
|
|
36
|
+
- **v1.4.1** - fixed typings for extra args (thanks [@rodrigoaddor](https://github.com/rodrigoaddor))
|
|
37
|
+
- **v1.4.0** - adds support for optional format params (e.g. "/:id.:format?" --> { params: { id: '13', format: 'jpg' }})
|
|
38
|
+
- **v1.3.0** - adds support for multiple args to handle(request, ...args) method (@hunterloftis)
|
|
39
|
+
- **v1.2.2** - fix: require verify/build pass before publishing and fixed README badges (should point to v1.x branch)
|
|
40
|
+
- **v1.2.0** - feature: chainable route declarations (with test)... that didn't take long...
|
|
41
|
+
- **v1.1.1** - updated README to reflect that chaining actually never was working... (not a breaking change, as no code could have been using it)
|
|
42
|
+
- **v1.1.0** - feature: added single option `{ base: '/some/path' }` to `Router` for route prefixing, fix: trailing wildcard issue (e.g. `/foo/*` should match `/foo`)
|
|
43
|
+
- **v1.0.0** - production release, stamped into gold from x0.9.7
|
|
44
|
+
- **v0.9.0** - added support for multiple handlers (middleware)
|
|
45
|
+
- **v0.8.0** - deep minification pass and build steps for final module
|
|
46
|
+
- **v0.7.0** - removed { path } from request handler context, travis build fixed, added coveralls, improved README docs
|
|
47
|
+
- **v0.6.0** - added types to project for vscode intellisense (thanks [@mvasigh](https://github.com/mvasigh))
|
|
48
|
+
- **v0.5.4** - fix: wildcard routes properly supported
|