fix(deps): update dependency hono to ~3.6.0 #6707
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
~3.5.0
->~3.6.0
Release Notes
honojs/hono (hono)
v3.6.0
Compare Source
Hono v3.6.0 is now available! Let's take a look at the new features.
Introduce
c.render()
We introduce
c.render()
andc.setRenderer()
functions.These functions enhance Hono's response handling, allowing for more flexible and modular response structures, especially useful for defining common parts of responses, like HTML layouts.
You can set a layout using
c.setRenderer()
within a custom middleware, as shown below:Then, you can utilize
c.render()
to create responses within this layout:The output of which will be:
Additionally, this feature offers the flexibility to customize arguments. To ensure type safety, types can be defined as:
Here's an example of how you can use this:
Using
c.render()
with JSX and html middleware, you can create HTML pages more easily!Introduce
c.var
The next feature we're introducing is
c.var
.Before this release, to access the actual value of a variable, you had to use
c.get()
:Now, with
c.var
, a more intuitive syntax is available:For instance, you can set an instance of the client for accessing an API with a middleware and then retrieve it using
c.var.client
:FC
for JSXThe type
FC
is exported fromhono/jsx
. You can use it to specify types for your function components.$url()
in Hono ClientYou can get a
URL
object for accessing the the endpoint by using$url()
.Thanks @renzor-fist !
Factory helper
Now, Hono offers a
middleware
factory method to create a middleware handler.By defining your middleware with
middleware
, the appropriate types will be added.Vite dev-server for Hono
Now, we introduce a new Vite Plugin to enhance developing your Hono application.
@hono/vite-dev-server
is a Vite Plugin that provides a custom dev-server forfetch
-based web applications like those using Hono.You can develop your application with Vite. It's fast.
Features
fetch
-based applications.Demo
Screen.Recording.2023-09-07.at.15.05.25.mov
Usage
Installation
You can install
vite
and@hono/vite-dev-server
via npm.Or you can install them with Bun.
Settings
Add
"type": "module"
to yourpackage.json
. Then, createvite.config.ts
and edit it.Development
Just run
vite
.Or
See more details
Visit the GitHub project: https://github.com/honojs/vite-plugins/tree/main/packages/dev-server
Deprecate some properties in HonoRequest
These properties in the
HonoRequest
have been deprecated.headers()
body()
bodyUsed()
integrity()
keepalive()
referrer()
signal()
For instance, if you want to use
headers
, please usec.req.raw.headers()
.Replaced Jest with Vitest
This might not be a new feature, but it's a significant change.
We've switched the test framework used in Hono's core project from Jest to Vitest! It's fast!
Thanks @ThatOneBro for the great work!
All Updates
status
toTypedResponse
by @ThatOneBro in https://github.com/honojs/hono/pull/1403c.render()
by @yusukebe in https://github.com/honojs/hono/pull/1397c.req.headers
(notc.req.header
) and others by @yusukebe in https://github.com/honojs/hono/pull/1410RequestContext
by @yusukebe in https://github.com/honojs/hono/pull/1421jest
withvitest
by @ThatOneBro in https://github.com/honojs/hono/pull/1404sandbox
dir by @yusukebe in https://github.com/honojs/hono/pull/1424--no-warnings
option formain
by @yusukebe in https://github.com/honojs/hono/pull/1425MergeSchemaPath
correct by @yusukebe in https://github.com/honojs/hono/pull/1426tsc
beforevitest
by @yusukebe in https://github.com/honojs/hono/pull/1427$url()
by @yusukebe in https://github.com/honojs/hono/pull/1430c.var
by @yusukebe in https://github.com/honojs/hono/pull/1406FC
by @yusukebe in https://github.com/honojs/hono/pull/1420factory
helper by @yusukebe in https://github.com/honojs/hono/pull/1434New Contributors
Full Changelog: honojs/hono@v3.5.8...v3.6.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.