@@ -30,3 +30,3 @@ var __defProp = Object.defineProperty; | ||
| if (!("token" in options || "verifyToken" in options)) { | ||
| throw new Error('bearer auth middleware requires options for "token"'); | ||
| throw new Error('bearer auth middleware requires options for "token" or "verifyToken"'); | ||
| } | ||
@@ -33,0 +33,0 @@ if (!options.realm) { |
@@ -86,16 +86,8 @@ var __defProp = Object.defineProperty; | ||
| const detectFromQuery = (c, options) => { | ||
| try { | ||
| const query = c.req.query(options.lookupQueryString); | ||
| return normalizeLanguage(query, options); | ||
| } catch { | ||
| return void 0; | ||
| } | ||
| const query = c.req.query(options.lookupQueryString); | ||
| return normalizeLanguage(query, options); | ||
| }; | ||
| const detectFromCookie = (c, options) => { | ||
| try { | ||
| const cookie = (0, import_cookie.getCookie)(c, options.lookupCookie); | ||
| return normalizeLanguage(cookie, options); | ||
| } catch { | ||
| return void 0; | ||
| } | ||
| const cookie = (0, import_cookie.getCookie)(c, options.lookupCookie); | ||
| return normalizeLanguage(cookie, options); | ||
| }; | ||
@@ -121,10 +113,6 @@ function detectFromHeader(c, options) { | ||
| function detectFromPath(c, options) { | ||
| try { | ||
| const url = new URL(c.req.url); | ||
| const pathSegments = url.pathname.split("/").filter(Boolean); | ||
| const langSegment = pathSegments[options.lookupFromPathIndex]; | ||
| return normalizeLanguage(langSegment, options); | ||
| } catch { | ||
| return void 0; | ||
| } | ||
| const url = new URL(c.req.url); | ||
| const pathSegments = url.pathname.split("/").filter(Boolean); | ||
| const langSegment = pathSegments[options.lookupFromPathIndex]; | ||
| return normalizeLanguage(langSegment, options); | ||
| } | ||
@@ -164,5 +152,2 @@ const detectors = { | ||
| const detector = detectors[detectorName]; | ||
| if (!detector) { | ||
| continue; | ||
| } | ||
| try { | ||
@@ -200,11 +185,4 @@ detectedLang = detector(c, options); | ||
| return async function languageDetector2(ctx, next) { | ||
| try { | ||
| const lang = detectLanguage(ctx, options); | ||
| ctx.set("language", lang); | ||
| } catch (error) { | ||
| if (options.debug) { | ||
| console.error("Language detection failed:", error); | ||
| } | ||
| ctx.set("language", options.fallbackLanguage); | ||
| } | ||
| const lang = detectLanguage(ctx, options); | ||
| ctx.set("language", lang); | ||
| await next(); | ||
@@ -211,0 +189,0 @@ }; |
@@ -59,3 +59,5 @@ var __defProp = Object.defineProperty; | ||
| if (options.autoEnd) { | ||
| timers.forEach((_, key) => endTime(c, key)); | ||
| timers.forEach((_, key) => { | ||
| endTime(c, key); | ||
| }); | ||
| } | ||
@@ -62,0 +64,0 @@ const enabled = typeof options.enabled === "function" ? options.enabled(c) : options.enabled; |
@@ -46,3 +46,5 @@ var __defProp = Object.defineProperty; | ||
| } else { | ||
| sections[i + 1] === "" && sections.splice(i + 1, 1); | ||
| while (sections[i + 1] === "") { | ||
| sections.splice(i + 1, 1); | ||
| } | ||
| sections[i] = new Array(8 - sections.length + 1).fill("0000").join(":"); | ||
@@ -267,2 +269,5 @@ } | ||
| const convertIPv6BinaryToString = (ipV6) => { | ||
| if (ipV6 === 0n) { | ||
| return "::"; | ||
| } | ||
| if (isIPv4MappedIPv6(ipV6)) { | ||
@@ -269,0 +274,0 @@ return `::ffff:${convertIPv4BinaryToString(convertIPv4MappedIPv6ToIPv4(ipV6))}`; |
@@ -9,3 +9,3 @@ // src/middleware/bearer-auth/index.ts | ||
| if (!("token" in options || "verifyToken" in options)) { | ||
| throw new Error('bearer auth middleware requires options for "token"'); | ||
| throw new Error('bearer auth middleware requires options for "token" or "verifyToken"'); | ||
| } | ||
@@ -12,0 +12,0 @@ if (!options.realm) { |
@@ -56,16 +56,8 @@ // src/middleware/language/language.ts | ||
| var detectFromQuery = (c, options) => { | ||
| try { | ||
| const query = c.req.query(options.lookupQueryString); | ||
| return normalizeLanguage(query, options); | ||
| } catch { | ||
| return void 0; | ||
| } | ||
| const query = c.req.query(options.lookupQueryString); | ||
| return normalizeLanguage(query, options); | ||
| }; | ||
| var detectFromCookie = (c, options) => { | ||
| try { | ||
| const cookie = getCookie(c, options.lookupCookie); | ||
| return normalizeLanguage(cookie, options); | ||
| } catch { | ||
| return void 0; | ||
| } | ||
| const cookie = getCookie(c, options.lookupCookie); | ||
| return normalizeLanguage(cookie, options); | ||
| }; | ||
@@ -91,10 +83,6 @@ function detectFromHeader(c, options) { | ||
| function detectFromPath(c, options) { | ||
| try { | ||
| const url = new URL(c.req.url); | ||
| const pathSegments = url.pathname.split("/").filter(Boolean); | ||
| const langSegment = pathSegments[options.lookupFromPathIndex]; | ||
| return normalizeLanguage(langSegment, options); | ||
| } catch { | ||
| return void 0; | ||
| } | ||
| const url = new URL(c.req.url); | ||
| const pathSegments = url.pathname.split("/").filter(Boolean); | ||
| const langSegment = pathSegments[options.lookupFromPathIndex]; | ||
| return normalizeLanguage(langSegment, options); | ||
| } | ||
@@ -134,5 +122,2 @@ var detectors = { | ||
| const detector = detectors[detectorName]; | ||
| if (!detector) { | ||
| continue; | ||
| } | ||
| try { | ||
@@ -170,11 +155,4 @@ detectedLang = detector(c, options); | ||
| return async function languageDetector2(ctx, next) { | ||
| try { | ||
| const lang = detectLanguage(ctx, options); | ||
| ctx.set("language", lang); | ||
| } catch (error) { | ||
| if (options.debug) { | ||
| console.error("Language detection failed:", error); | ||
| } | ||
| ctx.set("language", options.fallbackLanguage); | ||
| } | ||
| const lang = detectLanguage(ctx, options); | ||
| ctx.set("language", lang); | ||
| await next(); | ||
@@ -181,0 +159,0 @@ }; |
@@ -34,3 +34,5 @@ // src/middleware/timing/timing.ts | ||
| if (options.autoEnd) { | ||
| timers.forEach((_, key) => endTime(c, key)); | ||
| timers.forEach((_, key) => { | ||
| endTime(c, key); | ||
| }); | ||
| } | ||
@@ -37,0 +39,0 @@ const enabled = typeof options.enabled === "function" ? options.enabled(c) : options.enabled; |
@@ -17,3 +17,5 @@ // src/utils/ipaddr.ts | ||
| } else { | ||
| sections[i + 1] === "" && sections.splice(i + 1, 1); | ||
| while (sections[i + 1] === "") { | ||
| sections.splice(i + 1, 1); | ||
| } | ||
| sections[i] = new Array(8 - sections.length + 1).fill("0000").join(":"); | ||
@@ -238,2 +240,5 @@ } | ||
| var convertIPv6BinaryToString = (ipV6) => { | ||
| if (ipV6 === 0n) { | ||
| return "::"; | ||
| } | ||
| if (isIPv4MappedIPv6(ipV6)) { | ||
@@ -240,0 +245,0 @@ return `::ffff:${convertIPv4BinaryToString(convertIPv4MappedIPv6ToIPv4(ipV6))}`; |
+18
-10
| { | ||
| "name": "hono", | ||
| "version": "4.12.23", | ||
| "version": "4.12.24", | ||
| "description": "Web framework built on Web Standards", | ||
@@ -509,5 +509,14 @@ "main": "dist/cjs/index.js", | ||
| ], | ||
| "jsx/dom/jsx-dev-runtime": [ | ||
| "./dist/types/jsx/dom/jsx-dev-runtime.d.ts" | ||
| ], | ||
| "jsx/dom/jsx-runtime": [ | ||
| "./dist/types/jsx/dom/jsx-runtime.d.ts" | ||
| ], | ||
| "jwt": [ | ||
| "./dist/types/middleware/jwt" | ||
| ], | ||
| "jwk": [ | ||
| "./dist/types/middleware/jwk" | ||
| ], | ||
| "timeout": [ | ||
@@ -556,15 +565,15 @@ "./dist/types/middleware/timeout" | ||
| "router/reg-exp-router": [ | ||
| "./dist/types/router/reg-exp-router/router.d.ts" | ||
| "./dist/types/router/reg-exp-router" | ||
| ], | ||
| "router/smart-router": [ | ||
| "./dist/types/router/smart-router/router.d.ts" | ||
| "./dist/types/router/smart-router" | ||
| ], | ||
| "router/trie-router": [ | ||
| "./dist/types/router/trie-router/router.d.ts" | ||
| "./dist/types/router/trie-router" | ||
| ], | ||
| "router/pattern-router": [ | ||
| "./dist/types/router/pattern-router/router.d.ts" | ||
| "./dist/types/router/pattern-router" | ||
| ], | ||
| "router/linear-router": [ | ||
| "./dist/types/router/linear-router/router.d.ts" | ||
| "./dist/types/router/linear-router" | ||
| ], | ||
@@ -601,5 +610,2 @@ "utils/jwt": [ | ||
| ], | ||
| "nextjs": [ | ||
| "./dist/types/adapter/nextjs" | ||
| ], | ||
| "aws-lambda": [ | ||
@@ -611,2 +617,5 @@ "./dist/types/adapter/aws-lambda" | ||
| ], | ||
| "netlify": [ | ||
| "./dist/types/adapter/netlify" | ||
| ], | ||
| "lambda-edge": [ | ||
@@ -665,3 +674,2 @@ "./dist/types/adapter/lambda-edge" | ||
| "@hono/node-server": "^2.0.2", | ||
| "@types/glob": "^9.0.0", | ||
| "@types/jsdom": "^21.1.7", | ||
@@ -668,0 +676,0 @@ "@types/node": "^24.3.0", |
Sorry, the diff of this file is not supported yet
27
-3.57%1416096
-0.03%37211
-0.08%