[Snyk] Upgrade hono from 4.6.12 to 4.7.9#122
Open
nerdy-tech-com-gitub wants to merge 1 commit intodevfrom
Open
[Snyk] Upgrade hono from 4.6.12 to 4.7.9#122nerdy-tech-com-gitub wants to merge 1 commit intodevfrom
nerdy-tech-com-gitub wants to merge 1 commit intodevfrom
Conversation
Snyk has created this PR to upgrade hono from 4.6.12 to 4.7.9. See this package in npm: hono See this project in Snyk: https://app.snyk.io/org/nerds-github/project/7ac3a559-e245-43bc-aea8-6d68ed454985?utm_source=github&utm_medium=referral&page=upgrade-pr
Reviewer's GuideThis PR bumps the project's Hono dependency from version 4.6.12 to 4.7.9 by updating the version string in package.json to incorporate the latest fixes and improvements. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Snyk has created this PR to upgrade hono from 4.6.12 to 4.7.9.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
The recommended version is 18 versions ahead of your current version.
The recommended version was released a month ago.
Release notes
Package name: hono
What's Changed
getSignedCookieparameters type by @ Hill-98 in #4123New Contributors
Full Changelog: v4.7.8...v4.7.9
What's Changed
4.12.0by @ yusukebe in #4096replaceRequest: falseoption for.mountby @ geelen in #4113New Contributors
Full Changelog: v4.7.7...v4.7.8
What's Changed
c.header()when it's finalized by @ yusukebe in #4078New Contributors
Full Changelog: v4.7.6...v4.7.7
What's Changed
hono is cooltohono is hotby @ EdamAme-x in #4035New Contributors
Full Changelog: v4.7.5...v4.7.6
What's Changed
BunWebSocketDataandBunWebSocketHandlerby @ yusukebe in #4002New Contributors
Full Changelog: v4.7.4...v4.7.5
What's Changed
Full Changelog: v4.7.3...v4.7.4
What's Changed
BunWebSocketHandlerby @ yusukebe in #3964New Contributors
Full Changelog: v4.7.2...v4.7.3
What's Changed
RequestandResponseclasses by @ BarryThePenguin in #3928Full Changelog: v4.7.1...v4.7.2
What's Changed
next()by @ usualoma in #3905cryptoby @ EdamAme-x in #3916New Contributors
Full Changelog: v4.7.0...v4.7.1
Release Notes
Hono v4.7.0 is now available!
This release introduces one helper and two middleware.
Plus, Standard Schema Validator has been born.
Let's look at each of these.
Proxy Helper
We sometimes use the Hono application as a reverse proxy. In that case, it accesses the backend using
fetch. However, it sends an unintended headers.For example,
fetchmay sendAccept-Encoding, causing the origin server to return a compressed response. Some runtimes automatically decode it, leading to aContent-Lengthmismatch and potential client-side errors.Also, you should probably remove some of the headers sent from the origin server, such as
Transfer-Encoding.Proxy Helper will send requests to the origin and handle responses properly. The above headers problem is solved simply by writing as follows.
import { proxy } from 'hono/proxy'
app.get('/proxy/:path', (c) => {
return proxy(
http://<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">originServer</span><span class="pl-kos">}</span></span>/<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-c1">req</span><span class="pl-kos">.</span><span class="pl-en">param</span><span class="pl-kos">(</span><span class="pl-s">'path'</span><span class="pl-kos">)</span><span class="pl-kos">}</span></span>)})
You can also use it in more complex ways.
Thanks @ usualoma!
Language Middleware
Language Middleware provides 18n functions to Hono applications. By using the
languageDetectorfunction, you can get the language that your application should support.import { languageDetector } from 'hono/language'
const app = new Hono()
app.use(
languageDetector({
supportedLanguages: ['en', 'ar', 'ja'], // Must include fallback
fallbackLanguage: 'en', // Required
})
)
app.get('/', (c) => {
const lang = c.get('language')
return c.text(
Hello! Your language is <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">lang</span><span class="pl-kos">}</span></span>)})
You can get the target language in various ways, not just by using
Accept-Language.Accept-LanguageheaderThanks @ lord007tn!
JWK Auth Middleware
Finally, middleware that supports JWK (JSON Web Key) has landed. Using JWK Auth Middleware, you can authenticate by verifying JWK tokens. It can access keys fetched from the specified URL.
import { jwk } from 'hono/jwk'
app.use(
'/auth/*',
jwk({
jwks_uri:
https://<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">backendServer</span><span class="pl-kos">}</span></span>/.well-known/jwks.json,})
)
app.get('/auth/page', (c) => {
return c.text('You are authorized')
})
Thanks @ Beyondo!
Standard Schema Validator
Standard Schema provides a common interface for TypeScript validator libraries. Standard Schema Validator is a validator that uses it. This means that Standard Schema Validator can handle several validators, such as Zod, Valibot, and ArkType, with the same interface.
The code below really works!
import { sValidator } from '@ hono/standard-validator'
import { type } from 'arktype'
import * as v from 'valibot'
import { z } from 'zod'
const aSchema = type({
agent: 'string',
})
const vSchema = v.object({
slag: v.string(),
})
const zSchema = z.object({
name: z.string(),
})
const app = new Hono()
app.get(
'/:slag',
sValidator('header', aSchema),
sValidator('param', vSchema),
sValidator('query', zSchema),
(c) => {
const headerValue = c.req.valid('header')
const paramValue = c.req.valid('param')
const queryValue = c.req.valid('query')
return c.json({ headerValue, paramValue, queryValue })
}
)
const res = await app.request('/foo?name=foo', {
headers: {
agent: 'foo',
},
})
console.log(await res.json())
Thanks @ muningis!
New features
All changes
yarnby @ EdamAme-x in #3878toLowerCase()is unnecessary forreq.header()by @ yusukebe in #3880envtype by @ yusukebe in #3885