chore(deps): bump hono from 4.7.11 to 4.8.0 (#19404)

This commit is contained in:
dependabot[bot] 2025-06-19 11:28:16 +08:00 committed by GitHub
parent 508565fef0
commit 72466f0ea7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 34 additions and 27 deletions

View File

@ -1,4 +1,5 @@
import { type NotFoundHandler, type ErrorHandler } from 'hono';
import { routePath } from 'hono/route';
import { getDebugInfo, setDebugInfo } from '@/utils/debug-info';
import { config } from '@/config';
import * as Sentry from '@sentry/node';
@ -11,7 +12,7 @@ import { requestMetric } from '@/utils/otel';
export const errorHandler: ErrorHandler = (error, ctx) => {
const requestPath = ctx.req.path;
const matchedRoute = ctx.req.routePath;
const matchedRoute = routePath(ctx);
const hasMatchedRoute = matchedRoute !== '/*';
const debug = getDebugInfo();

View File

@ -1,4 +1,5 @@
import { MiddlewareHandler } from 'hono';
import { routePath } from 'hono/route';
import { getDebugInfo, setDebugInfo } from '@/utils/debug-info';
const middleware: MiddlewareHandler = async (ctx, next) => {
@ -17,11 +18,12 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
{
const debug = getDebugInfo();
const hasMatchedRoute = ctx.req.routePath !== '/*';
if (!debug.routes[ctx.req.routePath] && hasMatchedRoute) {
debug.routes[ctx.req.routePath] = 0;
const rPath = routePath(ctx);
const hasMatchedRoute = rPath !== '/*';
if (!debug.routes[rPath] && hasMatchedRoute) {
debug.routes[rPath] = 0;
}
hasMatchedRoute && debug.routes[ctx.req.routePath]++;
hasMatchedRoute && debug.routes[rPath]++;
if (ctx.res.headers.get('RSSHub-Cache-Status')) {
debug.hitCache++;

View File

@ -1,4 +1,5 @@
import { MiddlewareHandler } from 'hono';
import { routePath } from 'hono/route';
import etagCalculate from 'etag';
import { config } from '@/config';
import { Data } from '@/types';
@ -24,9 +25,10 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
ctx.header('Access-Control-Allow-Origin', config.allowOrigin || new URL(ctx.req.url).host);
await next();
const rPath = routePath(ctx);
if (ctx.req.routePath !== '/*') {
ctx.header('X-RSSHub-Route', ctx.req.routePath);
if (rPath !== '/*') {
ctx.header('X-RSSHub-Route', rPath);
}
const data: Data = ctx.get('data');

View File

@ -1,6 +1,7 @@
import type { APIRoute, Namespace, Route } from '@/types';
import { directoryImport } from 'directory-import';
import { Hono, type Handler } from 'hono';
import { routePath } from 'hono/route';
import path from 'node:path';
import { serveStatic } from '@hono/node-server/serve-static';
import { config } from '@/config';
@ -158,7 +159,7 @@ for (const namespace in namespaces) {
for (const [path, routeData] of sortedRoutes) {
const wrappedHandler: Handler = async (ctx) => {
logger.debug(`Matched route: ${ctx.req.routePath}`);
logger.debug(`Matched route: ${routePath(ctx)}`);
if (!ctx.get('data')) {
if (typeof routeData.handler !== 'function') {
if (process.env.NODE_ENV === 'test') {

View File

@ -1,3 +1,4 @@
import { routePath } from 'hono/route';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
@ -37,7 +38,7 @@ export const route: Route = {
async function handler(ctx) {
const { topic = 'trending-news', nav = '' } = ctx.req.param();
const useNav = ctx.req.routePath === '/apnews/nav/:nav{.*}?';
const useNav = routePath(ctx) === '/apnews/nav/:nav{.*}?';
const url = useNav ? `${HOME_PAGE}/${nav}` : `${HOME_PAGE}/hub/${topic}`;
const response = await got(url);
const $ = load(response.data);

View File

@ -84,7 +84,7 @@
"fanfou-sdk": "5.0.0",
"form-data": "4.0.3",
"googleapis": "150.0.1",
"hono": "4.7.11",
"hono": "4.8.0",
"html-to-text": "9.0.5",
"http-cookie-agent": "6.0.8",
"https-proxy-agent": "7.0.6",

View File

@ -49,10 +49,10 @@ importers:
version: 4.2.0(patch_hash=2dfb8d9be036009fcc315551cb39b08f478c9a279511267cf570a3486073d39b)
'@hono/node-server':
specifier: 1.14.4
version: 1.14.4(hono@4.7.11)
version: 1.14.4(hono@4.8.0)
'@hono/zod-openapi':
specifier: 0.19.8
version: 0.19.8(hono@4.7.11)(zod@3.25.67)
version: 0.19.8(hono@4.8.0)(zod@3.25.67)
'@notionhq/client':
specifier: 3.1.3
version: 3.1.3
@ -85,7 +85,7 @@ importers:
version: 0.0.25
'@scalar/hono-api-reference':
specifier: 0.9.4
version: 0.9.4(hono@4.7.11)
version: 0.9.4(hono@4.8.0)
'@sentry/node':
specifier: 9.30.0
version: 9.30.0
@ -141,8 +141,8 @@ importers:
specifier: 150.0.1
version: 150.0.1
hono:
specifier: 4.7.11
version: 4.7.11
specifier: 4.8.0
version: 4.8.0
html-to-text:
specifier: 9.0.5
version: 9.0.5
@ -3964,8 +3964,8 @@ packages:
hmacsha1@1.0.0:
resolution: {integrity: sha512-4FP6J0oI8jqb6gLLl9tSwVdosWJ/AKSGJ+HwYf6Ixe4MUcEkst4uWzpVQrNOCin0fzTRQbXV8ePheU8WiiDYBw==}
hono@4.7.11:
resolution: {integrity: sha512-rv0JMwC0KALbbmwJDEnxvQCeJh+xbS3KEWW5PC9cMJ08Ur9xgatI0HmtgYZfOdOSOeYsp5LO2cOhdI8cLEbDEQ==}
hono@4.8.0:
resolution: {integrity: sha512-NoiHrqJxoe1MYXqW+/0/Q4NCizKj2Ivm4KmX8mOSBtw9UJ7KYaOGKkO7csIwO5UlZpfvVRdcgiMb0GGyjEjtcw==}
engines: {node: '>=16.9.0'}
hookable@5.5.3:
@ -7361,20 +7361,20 @@ snapshots:
'@fastify/busboy@2.1.1': {}
'@hono/node-server@1.14.4(hono@4.7.11)':
'@hono/node-server@1.14.4(hono@4.8.0)':
dependencies:
hono: 4.7.11
hono: 4.8.0
'@hono/zod-openapi@0.19.8(hono@4.7.11)(zod@3.25.67)':
'@hono/zod-openapi@0.19.8(hono@4.8.0)(zod@3.25.67)':
dependencies:
'@asteasolutions/zod-to-openapi': 7.3.3(zod@3.25.67)
'@hono/zod-validator': 0.7.0(hono@4.7.11)(zod@3.25.67)
hono: 4.7.11
'@hono/zod-validator': 0.7.0(hono@4.8.0)(zod@3.25.67)
hono: 4.8.0
zod: 3.25.67
'@hono/zod-validator@0.7.0(hono@4.7.11)(zod@3.25.67)':
'@hono/zod-validator@0.7.0(hono@4.8.0)(zod@3.25.67)':
dependencies:
hono: 4.7.11
hono: 4.8.0
zod: 3.25.67
'@humanfs/core@0.19.1': {}
@ -8121,10 +8121,10 @@ snapshots:
dependencies:
'@scalar/types': 0.2.3
'@scalar/hono-api-reference@0.9.4(hono@4.7.11)':
'@scalar/hono-api-reference@0.9.4(hono@4.8.0)':
dependencies:
'@scalar/core': 0.3.3
hono: 4.7.11
hono: 4.8.0
'@scalar/openapi-types@0.3.3':
dependencies:
@ -10199,7 +10199,7 @@ snapshots:
hmacsha1@1.0.0: {}
hono@4.7.11: {}
hono@4.8.0: {}
hookable@5.5.3: {}