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

520 Commits

Author SHA1 Message Date
Ben
41075d5a80
fix(types): Added E env type argument to showRoutes & inspectRoutes hono parameter (#1778)
* Fixed `showRoutes` doc comment import path

* Fixed `showRoutes` & `inspectRoutes` Hono parameter types

* Updated `deno_dist` Deno files

* Renamed type arguments from `TEnv` to `E`
2023-12-05 18:47:45 +09:00
Yusuke Wada
42912df795
fix(context): Strict type checking c.json() (#1776)
* fix(context): Strict type checking `c.json()`

* denoify
2023-12-04 22:14:49 +09:00
Yusuke Wada
b21f33c987
Merge pull request #1774 from honojs/next
Next
2023-12-04 17:36:48 +09:00
Yusuke Wada
22b5f532b4
refactor: use # for private properties (#1762)
* refactor: use `#` for private properties

* denoify
2023-12-04 17:29:24 +09:00
Yusuke Wada
86c4165ea4
fix(factory): Filter undefined in createHandlers (#1772)
* fix(factory): Filter undefined in `createHandlers`

* denoify
2023-12-04 09:47:45 +09:00
Yusuke Wada
5f42d3cca4
feat(jsx): mark ErrorBoundary as experimental (#1771)
* feat(jsx): mark `ErrorBoundary` as `experimental`

* denoify
2023-12-04 05:56:25 +09:00
Yusuke Wada
99f5e132bc
fix(client): Allow optional props in JSON response (#1769)
* fix(client): allow optional props in JSON response

* denoify
2023-12-03 18:55:59 +09:00
Taku Amano
d86fcd41e1
feat(request): Introduce matchedRoutes and routePath for HonoRequest (#1744)
* feat(request): Introduce `matchedRoutes` and `routePath` for `HonoRequest`

* test: update test.

* chore: denoify

* fix: Remove unused type imports.
2023-12-03 18:55:38 +09:00
Taku Amano
d16aedfffd
feat: Ensure that calls to c.json() have a type equivalent to c.jsonT() (#1728)
* feat: Ensure that calls to `c.json()` have a type equivalent to `c.jsonT()`

* refactor: Objects with "response" properties are never returned by the handler

* refactor: "status" is not needed in TypedResponse

* refactor: Revive `c.jsonT()` and add @deprecated label

* refactor: Tweaks commenting on "eslint-disable" broken by `format:fix`

* test: Use `c.json()` instead of `c.jsonT()` to make sure there are no problems

* refactor: allow ambiguous type for `c.json()`

* chore: denoify

* fix: Remove unused TypedResponse from import statement
2023-12-03 09:03:14 +09:00
Yusuke Wada
b6133c4130
refactor(router): remove duplication MESSAGE_MATCHER_IS_ALREADY_BUILT (#1763)
* refactor(router): duplicated messages as `MESSAGE_MATCHER_IS_ALREADY_BUILT`

* denoify
2023-12-02 06:10:37 +09:00
Yusuke Wada
63179949c9
fix(types): Keep Env types with changed routes (#1757)
* fix(types): Keep `Env` types with changed routes

* denoify
2023-12-02 05:23:00 +09:00
Yusuke Wada
472fee3629 Merge branch 'main' into next 2023-12-02 05:22:10 +09:00
Yusuke Wada
4fdfdd6d12
fix(context): Set content-type with c.text() correctly (#1761)
* fix(context): Set `content-type` with `c.text()` correctly

* denoify
2023-12-02 05:15:09 +09:00
Taku Amano
bd36ad10fc
feat(helper/dev): Introduce inspectRoutes() and showRoutes() (#1716)
* feat(dev): Introduce "dev" helper

* feat(dev): Expose "dev" helper

* refactor: Use "named function" in some middleware.

* feat: `app.showRoutes()` is now deprecated. Use `showRoutes()` in `helper` instead.

* refactor: export RouterRoute interface for utility

* refactor: remove captureRouteStackTrace, add inspectRoutes

`captureRouteStackTrace` will be implemented after some more thought.
Instead, I added `inspectRoutes` to get routes as data.

* test: add tests for helper/dev/index.ts

* fix: run `format:fix`

* refactor: use named functions for middleware

* chore: denoify

* docs: tweaks deprecation warning message

* refactor(dev): Simplification of showList options

* chore: denoify
2023-11-29 19:22:09 +09:00
Stibbs
f4ff712796
feat(bearerAuth): accept a list of token strings (#1749)
* bearer-auth accepts list of token strings

* add yarn denoify output

* remove test files. retain only deno_dist bearer-auth
2023-11-29 19:04:20 +09:00
Yusuke Wada
10c16c23ef
feat(context): remove experimental from c.render/c.setRenderer() (#1748)
* feat(context): remove `experimental` from `c.render` and `c.setRenderer()`

* denoify
2023-11-29 17:38:45 +09:00
Yusuke Wada
6dd1a77fb7
feat: introduce createFactory() and createHandlers() (#1743)
* feat(helper/factory): introduce `createHandlers()`

* create `Factory` class

* support up to 10 handlers

* denoify

* fixed tests
2023-11-29 17:29:49 +09:00
Gabriel Donnantuoni Lima
b80895a8bd
feat(types): Support types until 10 handlers (#1735)
* feat: Support types until 10 handlers

* denoify

* feat: extend OnHandlerInterface to support until 10 handlers

* denoify
2023-11-29 04:18:11 +09:00
Yusuke Wada
19641d07c1 Merge branch 'main' into next 2023-11-28 18:00:14 +09:00
Yusuke Wada
7dc215577a
fix(helper/cookie): make default Path=/ for setCookie()/setSignedCookie() (#1742)
* fix(helper/cookie): make default `path` as `/` for `setCookie()`/`setSignedCookie()`

* denoify

* fixed test
2023-11-28 17:52:34 +09:00
Taku Amano
c3275eebf0
fix(jsx): Write the raw value if the value is a HtmlEscaped string (#1739)
* fix(jsx): Write the raw value if the value is a HtmlEscaped string

* chore: denoify
2023-11-27 17:19:35 +09:00
watany
bea87a0429
feat(adaptor): Enhance AWS Lambda Event Handling and Interface (#1710) 2023-11-27 15:31:10 +09:00
Robert Sasak
79dc187dbb
fix(validator): Invalid HTTP header error is hidden (#1694)
* Invalid HTTP header error is hidden

This error is captured and never shown which may by misleading. This PR suggest to throw this error directly to the reponse.

* fixed the linter error

* add a test

* denoify

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2023-11-21 19:42:27 +09:00
Taku Amano
cd6c488b76
feat(jsx): Introduce ErrorBoundary component (#1714)
* feat(jsx/streaming): Support Suspense in non-streaming mode.

* feat(jsx): Introduce ErrorBoundary component.

* chore: denoify

* feat: Support ErrorBoundary[fallbackRender].

* chore: denoify

* Rename utils.ts to components.ts

* refactor: export the ErrorBoundary component from the top level.

* fix: tweaks `resolveStream` to work with nested components

* refactor: Import `childrenToString` from `components.ts`

* fix: return immediately if the element is not found

* test: add test for jsx/components

* fix: run `npm run format:fix`

* chore: denoify
2023-11-21 18:05:05 +09:00
Yusuke Wada
257d5711b4
fix(compose): allow onError() handler to be async (#1730)
* fix(compose): allow `onError()` handler to be async

* denoify
2023-11-21 17:15:01 +09:00
Russell Schick
710992fcd4
fix(compose): allow notFound handler to be async (#1729) 2023-11-21 16:59:41 +09:00
Yusuke Wada
3b71dc647f
fix(types): fixed a typo (#1721)
* fix(types): fixed a typo

* denoify
2023-11-19 05:23:45 +09:00
Taku Amano
ae3546e32a
fix: References this._s only when paramStash is passed from the router (#1715)
* fix: References this._s only when paramStash is passed from the router.

* chore: denoify

* fix: remove debug statement.

* test: Fix test for param keys.
2023-11-17 07:35:48 +09:00
Yusuke Wada
16396bc225
perf(compose): simplify (#1701)
* perf(compose): simplify

* denoify
2023-11-15 22:22:31 +09:00
Yusuke Wada
871cf80b6a
fix(context): c.text() set the status set by c.status() (#1702)
* fix(context): `c.text()` set the status set by `c.status()`

* fixed logic

* denoify
2023-11-15 22:16:38 +09:00
Yusuke Wada
5e3e85a179
Merge pull request #1690 from honojs/next
Next
2023-11-13 14:25:42 +09:00
Yusuke Wada
d711484ac7
feat(app): use console.error() for default errorHandler (#1687)
* feat(app): use `console.error()` for default `errorHandler`

* denoify
2023-11-13 01:18:54 +09:00
Yusuke Wada
db3387353f
fix(context): implement ContextVariableMap for c.var (#1682)
* fix(context): implement `ContextVariableMap` for `c.var`

* denoify
2023-11-12 09:06:40 +09:00
Christian Rackerseder
47942ffc68
fix(types): allow arbitrary values as environment values (#1680) 2023-11-12 09:05:54 +09:00
Yusuke Wada
397e9a5cb5
feat(hono): remove experimental flag from app.mount() (#1669)
* feat(hono): remove `experimental` flag from `app.mount()`

* denoify
2023-11-10 08:20:20 +09:00
Yusuke Wada
c6fbf84de3
fix(types): infer env types with chaining handlers (#1668)
* fix(types): infer env types with chaining handlers

* denoify
2023-11-09 15:40:25 +09:00
Taku Amano
fa1abf637b
fix(jsx/streaming): Fixed a problem when multiple children are added directly under Suspense. (#1665)
* fix(jsx/streaming): Fixed a problem when multiple children are added directly under Suspense.

* refactor: Use `raw()` helper as constructor of `HtmlEscapedString`.

* chore: denoify.
2023-11-09 14:37:47 +09:00
Yusuke Wada
d6cd2720ea
docs: rename Fastly Compute@Edge to Compute (#1664) 2023-11-09 05:13:09 +09:00
Taku Amano
ebd43b91ff
feat(jsx-renderer): Support "stream" option in jsxRenderer. (#1662)
* fix(jsx/streaming): Fix await order again.

* feat(jsx): Support async component in useContext().

* fix(html): fix async component bug in html helper.

* feat(jsx-renderer): Support "stream" option in jsxRenderer.

* chore: denoify

* fix(jsx-renderer): Add "eslint-disable @typescript-eslint/no-explicit-any".
2023-11-09 05:03:54 +09:00
Taku Amano
691d02450e
perf(jsx/streaming): In multiple Suspense, go ahead in the order of resolved. (#1663)
* perf(jsx/streaming): In multiple Suspense, go ahead in the order of resolved.

* chore: denoify
2023-11-09 04:13:50 +09:00
Taku Amano
7fd9cba89d
feat(jsx/streaming): Support nested Suspense. (#1660) 2023-11-08 23:49:42 +09:00
Taku Amano
652ef7c867
feat(jsx): Define jsxTemplate/jsxAttr/jsxEscape for "@jsx precompile" of Deno 1.38 (#1651)
* fix(jsx/streaming): Fix for renderToReadableStream(promise: Promise<HtmlEscapedString>).

* feat(jsx): Define jsxTemplate/jsxAttr/jsxEscape for "@jsx precompile" of Deno 1.38

* chore: denoify

* fix(jsx/streaming): some times jsxDEV is called with null props.

* test(deno-jsx): Add runtime tests for JSX by Deno.

* test: Refactor import map.

* test: Added @jsxImportSource to avoid type warnings
2023-11-08 21:07:35 +09:00
watany
7adae90fd7
fix(helper): Stream SSE Helper Non-Closure (#1650)
* fix(helper): Stream SSE Helper Non-Closure

* denoify

* test fixed.
2023-11-08 20:54:02 +09:00
Taku Amano
a98661b419
fix(jsx/streaming): Fixed a bug that caused async components to be evaluated multiple times inside Suspense. (#1656)
* fix(jsx/streaming): Fixed a bug that caused async components to be evaluated multiple times inside Suspense.

* test(jsx/streaming): The problem of catching the global unhandledRejection and causing an error has been fixed in the vitest.

* chore: denoify
2023-11-08 20:52:29 +09:00
Yusuke Wada
86037a54eb
feat(helper/factory): remove @experimental from createMiddleware() (#1653)
* feat(helper/factory): remove `@experimental` from `createMiddleware()`

* denoify
2023-11-08 12:19:15 +09:00
Taku Amano
fedeb3d696
feat: Introduce streaming API with Suspense and use. (#1630)
* feat(jsx): Support async component.

* chore: denoify

* feat: Support nested async components.

* chore: denoify

* Remove unintended file from commit.

* test(jsx): Add test for html tagged template strings.

* feat: Introduce streaming API with `Suspense` and `use`.

* chore: denoify

* "use" receives only Promise.

* feat: Support multiple calls and nested calls to "use".

* refactor: tweaks replacement script.

* test: Add test for replacement result of streaming

* chore: denoify

* test: Add test "Complex fallback content"

* refactor: Add "typescript-eslint/no-explicit-any".

* Use jsdom instead of happy-dom due to ci failure.

* test: update test data for suspense.

* refactor: Remove excessive exports

* refactor: Changed initialization of `useContexts[]` to clarify intent.

* perf: improve `renderToReadableStream()` performance.

* chore: denoify

* pref: Shortened the output JS a bit.

* pref: Delete unneeded condition

* docs(jsx/streaming): Add `@experimental` flag to streaming API.

* fix(jsx/streadming): fix loop when using fullfilled Promise with null or undefined.

* fix(jsx/streaming): Catch unhandledRejection to avoid streaming not being closed.

* chore(jsx/streaming): Add entries for jsx/streaming to package.json.

* chore: denoify

* feat(jsx/streaming): Support the Async Component inside Suspense.

* chore: denoify

* feat(jsx/streaming): remove implementation of `use()`.
2023-11-07 07:09:04 +09:00
Yusuke Wada
48dc87dfd5
fix(utils/filepath): filepath supports Windows (#1642) 2023-11-04 06:56:14 +09:00
Yusuke Wada
517a6c486e
feat(jsx-renderer): docType option (#1621)
* feat(jsx-renderer): `docType` option

* denoify

* refactor

Co-authored-by: Taku Amano <taku@taaas.jp>

* denoify

---------

Co-authored-by: Taku Amano <taku@taaas.jp>
2023-10-27 11:11:07 +09:00
Yusuke Wada
3ead9a761c
feat(helper/adapter): add runtime option to env (#1622)
* feat(helper/adapter): add `runtime` option to `env`

* denoify
2023-10-27 11:06:21 +09:00
Yusuke Wada
b3e465a103
feat: types for JSX elements (#1614)
* feat: types for JSX elements

* make it minimal

* add children

* denoify

* fixed some attributes

* denoify

* `dateTime` to `datetime`

* remove `onxxx`

* feat: Declare in the Hono namespace so that it can be overridden by the user. (#1616)

* feat: Declare in the Hono namespace so that it can be overridden by the user.

* feat: Use interface instead of type to enable overwriting

```ts
declare global {
  namespace JSX {
    interface IntrinsicElements {
      'my-custom-element': Hono.HTMLAttributes & {
        'x-event'?: 'click' | 'scroll';
      }
    }
  }
}
```

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>

* remove `onxxx`

* denoify

---------

Co-authored-by: Taku Amano <taku@taaas.jp>
2023-10-27 06:21:33 +09:00