0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 11:51:01 +01:00
Commit Graph

403 Commits

Author SHA1 Message Date
Yusuke Wada
90da196193
fix(deno): fixed the bug calling next() multiple time in Serve Static (#594) 2022-10-10 00:11:36 +09:00
Yusuke Wada
f5fc9103f1 chore: denoify 2022-10-09 23:33:00 +09:00
Yusuke Wada
41245122b9
fix(compose): fix it for error handling with async (#583) 2022-10-04 09:01:31 +09:00
Derrick Farris
1adc9264fc
fix(validator): return HTTP 400 on malformed JSON request (#579)
* fix(validator): return http 400 on malformed JSON request

* chore(deno): denoify malformed json changes
2022-10-04 06:16:25 +09:00
Taku Amano
e992c7b7f3
fix(reg-exp-router): Register path for all the methods if method === METHOD_NAME_ALL. (#580)
* fix(reg-exp-router): Register path for all the methods if method === METHOD_NAME_ALL.

* chore: denoify.
2022-10-03 07:50:57 +09:00
Yusuke Wada
39f896a576
fix(compose): don't throw Error; set error response into c.res (#576) 2022-10-02 15:44:54 +09:00
Derrick Farris
61e24b03a1
fix(cache): export cache middleware for Deno (#573)
* fix(cache): export cache middleware for Deno

* fix(test): update  jwt test (test will be fail in 46 years)
2022-10-01 17:23:44 +09:00
Nicholas Gates
af1de3574c
Fix Trie router multiple matching path parameters (#571)
* Failing test for prefix parameters

* Fix test by removing break

* Denoify
2022-09-30 22:25:24 +09:00
Derrick Farris
9a0389e723
feat(validator): add support for JSON array path validation (#563)
* refactor(JSONPath): improve typing of JSONPath

* chore(vscode-settings): add deno.enable=false

* fix(validator): add null to type Type def

* feat(JSON-Path): add support for array JSONPath-Plus syntax

* fix(validator): update isRequired to pass valid bool types

* test: update tests for isRequired validator

* feat(validator): add support for JSON array path validation

* chore(deno): denoify array support changes

* fix(validator): type check all vals in array

* chore(deno): denoify changes

* test(validator): add tests for array type checking

* fix(validator): change JSONPrimative to JSONPrimitive

* refactor(json): More compatible with https://jsonpath.com/.

* implementation of `asArray`

* fix(validator): update JSONPath implementation and add isArray check in validation

* fix(validator): fix typing errors on SchemaToProp

* Revert "fix(validator): fix typing errors on SchemaToProp"

This reverts commit b8ddef85d0.

* fix(validator): fix SchemaToProp error for VTypeArrays

* chore(deno): denoify

Co-authored-by: Taku Amano <taku@taaas.jp>
Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2022-09-30 21:56:39 +09:00
Yusuke Wada
e5b0ea8d33 chore: denoify 2022-09-30 19:50:59 +09:00
Yusuke Wada
0e78a7698c
fix(handleEvent): use dispatch instead of fetch (#568) 2022-09-30 11:24:23 +09:00
Yusuke Wada
2c3db370ce chore: denoify 2022-09-27 21:43:55 +09:00
Yusuke Wada
03fc36f793
refactor(serve-static): use context/next instead of MiddlewareHandler (#559)
* fix(validator): make `isOptional` rule works correctly.

* refactor(serve-static): remove return type

* use context/next instead of MiddlewareHandler
2022-09-27 21:40:37 +09:00
Yusuke Wada
c0d88ff01c
fix(validator): make isOptional rule works correctly. (#555) 2022-09-27 18:19:50 +09:00
Yusuke Wada
84451d61e1
fix(types): enable types for c.env when using validator (#553) 2022-09-26 21:18:48 +09:00
Yusuke Wada
e4c8a6f467
perf: remove async from dispatch; will be 16% faster (#550) 2022-09-26 21:12:53 +09:00
Yusuke Wada
7bb9cc1a19
fix: don't use defaultNotFoundMessage variable (#549) 2022-09-21 23:05:26 +09:00
Taku Amano
957a5a9ac9
feat(validator): Enable verification results to be retrieved as structured data. (#547)
* feat(validator): Enable verification results to be retrieved as structured data.

* chore: denoify
2022-09-21 09:40:17 +09:00
Yusuke Wada
594f30aa35
fix(validator): make "Types" work well (#545)
* fix(validator): make "Types" work well

* fix import statement
2022-09-21 07:55:29 +09:00
Yusuke Wada
00547ea84e docs(readme): update! 2022-09-20 23:06:05 +09:00
Yusuke Wada
976b2c310e
feat: c.req.body and c.req.json accept generics (#529) 2022-09-20 22:01:03 +09:00
Yusuke Wada
5133a93925
feat: support appending values with c.header (#539) 2022-09-20 21:41:45 +09:00
Taku Amano
2a80b58161 feat(reg-exp-router): support optional parameter (#542)
* feat(reg-exp-router): support optional parameter

* chore: denoify
2022-09-20 21:26:59 +09:00
Yusuke Wada
24c17e340a feat(trie-router): support optional parameter (#540) 2022-09-20 21:26:27 +09:00
Yusuke Wada
730453aeb0
fix(redirect): don't have to make relative url to absolute one (#541)
* fix(redirect): don't have to make relative url to absolute one

* remove `isAbsoluteURL`
2022-09-20 18:56:31 +09:00
Yusuke Wada
a2cc1a01c2
feat: another idea of Validator Middleware (#535)
* feat: Another idea of validator middleware

* denoify

* set property value in constructor

* rename `option` to `options`

* add test for handling type error

* use `test` instead of `match`
2022-09-20 10:11:34 +09:00
Yusuke Wada
ac1c01df4a
fix(deno): serve static middleware returns 404 correctly (#537) 2022-09-19 12:22:55 +09:00
Taku Amano
8eb20215a5
feat(cors): Enable to check origin header by a function. (#533) 2022-09-16 20:59:27 +09:00
Taku Amano
bbb95585d4
Check in Origin header instead of Referer (#532)
* refactor(cors): Check in Origin header instead of Referer.

* refactor(utils/url): Remove unused function getDomainFromURL.

* chore: denoify
2022-09-16 07:23:31 +09:00
Yusuke Wada
df64870f54
feat(cors): allow multiple origins (#531)
* feat(validator): add `isBoolean` and `isNumber`

* feat(cors): allow multiple origins

Close #503
2022-09-16 00:19:02 +09:00
Yusuke Wada
9c9e1c2356
feat(validator): add isBoolean and isNumber (#530) 2022-09-16 00:10:37 +09:00
Yusuke Wada
b546fd6984 refactor: update buffer version on Deno 2022-09-14 08:44:42 +09:00
Yusuke Wada
62e3292460
feat(validator): add isFalsy and isNotFalsy (#523) 2022-09-14 08:30:46 +09:00
Yusuke Wada
e2d704fd4f
fix(types): add types to middleware correctly (#521) 2022-09-14 08:17:20 +09:00
Taku Amano
d12a11937b
feat: Lightweight RegExpRouter reborn (#519)
* Introduce RegExpLiteRouter.

* Replace RegExpRouter with RegExpLiteRouter.

* chore: denoify

* Remove old RegExpRouter and rename RegExpLiteRouter to RegExpRouter.

* chore: Update benchmarks/handle-event.
2022-09-14 08:01:14 +09:00
Yusuke Wada
46c6a8de5e
feat(middleware): introduce "built-in" Validator Middleware (#505)
* feat(middleware): introduce built-in Validator Middleware

* fixed type of `req.json()`

* Feat/builtin validator middleware another idea (#508)

* Enable overwriting of query/header data.

* Returns only verified data.

* rename `index.test.ts` to `middleware.test.ts`

* add `removeAdditional` option

* handling error that the JSON body is null

* tidy

* check is it string or not

* implement `isIn`

* enable validation the valies are duplicate

Co-authored-by: Taku Amano <taku@taaas.jp>
2022-09-13 07:54:06 +09:00
Taku Amano
a149dddfdc
Introduce StaticRouter and SmartRouter (#501)
* refactor(router): Export supported HTTP methods.

* refactor(router): Introduce UnsupportedPathError.

* feat(static-router): Introduce StaticRouter.

* feat(reg-exp-router): Add "allowAmbiguous" option to RegExpRouter.

* feat(smart-router):  Introduce SmartRouter.

* feat(hono): Make SmartRouter the default router.

* chore: denoify

* refactor(smart-router): routers is never undefined.

* chore: denoify

* refactor: Fix test for SmartRouter.
2022-09-12 20:49:18 +09:00
Yusuke Wada
3697e156ed
fix(middleware): support multiple middleware on bearer/basic auth middleware (#513)
Fix #509
2022-09-10 18:02:36 +09:00
Yusuke Wada
058e3113b3
fix(types): correct types for app.notFound / app.onError (#512)
Fix #511
2022-09-10 18:00:00 +09:00
Taku Amano
ab14da6af7
fix: regexp ambigous route (#499)
* refactor(reg-exp-router): Add existence check instead of "ts-ignore".

* fix(reg-exp-router): Rebuild all matchers as "hasAmbiguous" if some methods are ambiguous.

* Run `yarn denoify`.
2022-09-05 19:17:11 +09:00
Yusuke Wada
b6954815cb
perf(req): improve c.req.query performance (#498)
* perf(req): improve `c.req.query` performance

* allow fragments as query strings
2022-09-05 19:08:10 +09:00
Taku Amano
e174b70858
perf(compose): Always return a Promise without async. (#496) 2022-09-04 17:53:39 +09:00
Taku Amano
f3087c94e1
perf(compose): Remove await composed() from hono.ts. (#495) 2022-09-02 22:55:01 +09:00
Yusuke Wada
24a28942de
fix: fixed the issue logger called twice (#494)
* fix: fixed the issue logger called twice

* add handling the error and shorten code
2022-09-02 21:13:47 +09:00
Yusuke Wada
9793e6b8b7 docs(readme): update benchmark scores 2022-09-01 22:59:23 +09:00
Yusuke Wada
bb9a95471e
perf: do not compose if it has only one handler (#493) 2022-09-01 22:39:50 +09:00
Yusuke Wada
dec5651c2f chore: denoify 2022-08-31 18:01:33 +09:00
Yusuke Wada
d3ff952599
fix(compose): do not handle the error in compose (#491)
* fix(compose): do not handle the error in `compose`

* tweak
2022-08-31 17:49:01 +09:00
Yusuke Wada
c091517947
fix(context): fix type error (#489) 2022-08-28 18:16:51 +09:00
Yusuke Wada
1c3c9f1200
fix(type): fix type errors for Bindings and Variables (#488) 2022-08-27 23:57:33 +09:00
Yusuke Wada
128a59aec2
fix: make that c.req.parseBody parses only FormData (#487) 2022-08-27 11:38:48 +09:00
Yusuke Wada
20e8bacec8 chore: denoify 2022-08-27 11:01:09 +09:00
Yusuke Wada
c7ee2e7603
fix: enable passing Generics to c.req.parseBody, default is any (#481) 2022-08-25 09:25:11 +09:00
Yusuke Wada
ddfe07ecec
feat(types): enable adding Types for variables used in c.set/c.get (#478)
* feat(types): enable adding Types for variables used in `c.set`/`c.get`

* fix typo
2022-08-23 20:53:25 +09:00
Yusuke Wada
54a04c6a6f
fix(context): export ContextVariableMap correctly (#476) 2022-08-23 11:51:18 +09:00
Yusuke Wada
83a95ba895
perf(trie-router): fine tuning, 9~10% faster (#473)
* perf(trie-router): fine tuning, 9~10% faster!

* update readme
2022-08-21 10:11:53 +09:00
Yusuke Wada
d259b7a04d docs(readme): update readme for Deno 2022-08-19 07:30:48 +09:00
Taku Amano
db8619695e
fix(compose): Support a handler that non-async and returning a promise. (#469)
* fix(compose): Support a handler that non-async and returning a promise.

* Update deno_dist via `yarn denoify`.
2022-08-15 12:24:23 +09:00
Yusuke Wada
578833ea85
perf(compose): optimize await (#466)
Do not `await` if the handler is not promise.
2022-08-15 08:35:57 +09:00
Yusuke Wada
9edf43c63b
fix(context): fixed ContextVariableMap is not enabled in built code (#465) 2022-08-12 11:22:30 +09:00
Yusuke Wada
e07147a8ec
fix(context): fix header values shifting (#463) 2022-08-10 21:34:33 +09:00
Yusuke Wada
8879f241e8
refactor(mime): made .ico file's extension to image/x-icon (#462)
* refactor(mime): made `.ico` file's extension to `image/x-icon`

* fixed deno and bun tests
2022-08-09 10:51:08 +09:00
Yusuke Wada
7345b8105d
fix(ETag): fixed an error when the file size is too large. (#461)
Made `utils/crypto` supports `ReadbleStream`.

Fix #458
2022-08-09 10:35:30 +09:00
Yusuke Wada
8a9ebc1470
fix(utils/crypto): make Binary and JSON object crypto correct (#454) 2022-08-06 00:31:11 +09:00
Yusuke Wada
5838f9dccc Revert "refactor: add Json type for JSON object (#453)"
It's difficult to handle `Json`. So, it's ok to go with `object`.

This reverts commit bc736da6a5.
2022-08-05 08:10:41 +09:00
Yusuke Wada
bbe079134e Revert "fix(utils/crypto): stringify the parameter which is object in createHash (#452)"
It was necessary to support not only json but also other.

This reverts commit db17530b36.
2022-08-05 08:09:17 +09:00
Yusuke Wada
bc736da6a5
refactor: add Json type for JSON object (#453) 2022-08-05 06:41:28 +09:00
Yusuke Wada
db17530b36
fix(utils/crypto): stringify the parameter which is object in createHash (#452)
Fix #451
2022-08-04 08:51:09 +09:00
Yusuke Wada
a7ad89ccef refactor(utils/html): remove escape function (#450)
Close #445
2022-08-03 11:39:36 +09:00
Yusuke Wada
9f2a270c28
refactor(utils/html): rename Buffer to StringBuffer (#449) 2022-08-03 11:24:51 +09:00
Yusuke Wada
3c371d0d07 chore: denoify 2022-07-31 22:19:28 +09:00
Yusuke Wada
115395766e
fix(jsx/bun): do not escape children (#422)
For JSX middleware on Bun.
Fix bug that JSX `children` will force escaped.
2022-07-24 20:39:41 +09:00
Yusuke Wada
5f60a18227
feat(jsx): support jsxImportSource (#420)
* feat(jsx): support `jsxImportSource`

Support `jsxImportSource`.
You can use this option on Bun and Deno (Wrangler does not support it).
if you write tsconfig as below, JSX middleware will be enabled without `import { jsx } from 'hono/jsx'`.

```json
{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxFragmentFactory": "Fragment",
    "jsxImportSource": "hono/jsx"
  }
}
```

* fix export path
2022-07-24 17:36:37 +09:00
Yusuke Wada
f6f454ed42
fix(trie-router): fix the rule for capturing named parameter (#419)
Close #418
2022-07-24 11:03:04 +09:00
Yusuke Wada
c450c56460
feat(middleware): implement Cache Middleware (#417)
* feat(middleware): implement Cache Middleware

* denoify

* do not export Cache middleware for Deno.
2022-07-23 15:02:42 +09:00
Yusuke Wada
b4a660c605 chore(deno): denoify 2022-07-18 11:56:07 +09:00
Yusuke Wada
da4d9a5491
fix(logger): specify console.log for default print fn (#401) 2022-07-18 08:17:42 +09:00
Yusuke Wada
007e145eec refactor(deno): fix a definition of FetchEvent 2022-07-17 18:36:42 +09:00
Yusuke Wada
1ee08cc5ce chore(deno): denoify 2022-07-17 18:11:09 +09:00
Yusuke Wada
2a24b98e55
refactor: remove useless async for a better performance on Bun (#397)
* fix(compress): add type for enconding name

* refactor: remove useless `async` for a better performance on Bun
2022-07-17 09:13:44 +09:00
Yusuke Wada
be548c97ed
fix(compress): add type for enconding name (#396) 2022-07-17 08:59:40 +09:00
Roman Hotsiy
c63d7ed77f
chore: fix typo in error class name (#393)
* chore: fix type in error class name

* chore: update usages in other places
2022-07-17 08:54:43 +09:00
Yusuke Wada
ecfc81ff1f chore(deno): denoify 2022-07-16 21:49:59 +09:00
Yusuke Wada
87db4fc07e docs(deno): update README 2022-07-16 17:56:06 +09:00
Yusuke Wada
230d265429 chore(deno): denoify 2022-07-16 10:26:14 +09:00
Yusuke Wada
af9f6a73d9 [BREAKING] feat: remove "graphql-server" middleware, will be obsolete (#366)
It might be *third-party middleware*.

Close #357
2022-07-15 08:40:15 +09:00
Yusuke Wada
dea9484a22 test: add tests for Deno (#365)
Close #351
2022-07-15 08:40:15 +09:00
Yusuke Wada
16adde746b refactor: denoify 2022-07-15 08:40:15 +09:00
Yusuke Wada
9a41cde632 chore: denoify 2022-07-15 08:40:15 +09:00
Yusuke Wada
0d48c9f338 feat: [WIP] new structure for support Deno and third-party middleware
[skip ci]
2022-07-15 08:40:15 +09:00
Yusuke Wada
b07486b965 chore(deno): denoify 2022-07-15 08:38:09 +09:00
Yusuke Wada
503317309b chore(deno): do not export Env 2022-07-10 18:54:37 +09:00
Yusuke Wada
3f5c725435 chore: denoify 2022-07-10 18:52:04 +09:00
Yusuke Wada
a430a1fcc8 docs: i forgot return 2022-07-08 09:23:33 +09:00
Yusuke Wada
c17742e104 docs: update readme 2022-07-08 09:22:10 +09:00
Yusuke Wada
c5b90a46df
feat(deno): export everythings from middlewares (#349) 2022-07-08 08:55:44 +09:00
Yusuke Wada
9bb662922b
refactor: use arrow func for app.fetch (#348) 2022-07-08 08:44:34 +09:00
Yusuke Wada
49025e0aad
refactor(deno): [BREAKING] obsolete app.fire() (#343) 2022-07-06 10:57:55 +09:00
Yusuke Wada
dbb3ec213b chore: update deno_dist files 2022-07-02 23:22:51 +09:00
Yusuke Wada
1cdd71f676
feat: add serve-static middlware for deno (#339)
* feat: add `serve-static` middlware for deno

* make `getFilePath` into utils

* ignore deno ts files
2022-07-02 23:20:09 +09:00
Yusuke Wada
6030c051db
chore: rm *.ts.test from deno_dist (#338) 2022-07-02 22:31:10 +09:00
Yusuke Wada
d589ef0a7b docs(readme): update readme in deno_dist 2022-07-02 18:32:01 +09:00
Yusuke Wada
d9e9e62e47
feat: support Deno! (#336) 2022-07-02 15:09:45 +09:00