| // src/adapter/service-worker/index.ts | ||
| import { handle } from "./handler.js"; | ||
| var fire = (app, options = { | ||
| fetch: void 0 | ||
| }) => { | ||
| var fire = (app, options) => { | ||
| addEventListener("fetch", handle(app, options)); | ||
@@ -7,0 +5,0 @@ }; |
@@ -25,5 +25,3 @@ var __defProp = Object.defineProperty; | ||
| var import_handler = require("./handler"); | ||
| const fire = (app, options = { | ||
| fetch: void 0 | ||
| }) => { | ||
| const fire = (app, options) => { | ||
| addEventListener("fetch", (0, import_handler.handle)(app, options)); | ||
@@ -30,0 +28,0 @@ }; |
@@ -141,3 +141,3 @@ var __defProp = Object.defineProperty; | ||
| } | ||
| await pool.run(() => app.fetch(forGetInfoURLRequest)); | ||
| await pool.run(() => app.fetch(forGetInfoURLRequest, { [import_middleware.SSG_CONTEXT]: true })); | ||
| if (!forGetInfoURLRequest.ssgParams) { | ||
@@ -144,0 +144,0 @@ if ((0, import_utils2.isDynamicRoute)(route.path)) { |
@@ -37,2 +37,5 @@ var __defProp = Object.defineProperty; | ||
| if (optsOrigin === "*") { | ||
| if (opts.credentials) { | ||
| return (origin) => origin || null; | ||
| } | ||
| return () => optsOrigin; | ||
@@ -72,3 +75,3 @@ } else { | ||
| if (c.req.method === "OPTIONS") { | ||
| if (opts.origin !== "*") { | ||
| if (opts.origin !== "*" || opts.credentials) { | ||
| set("Vary", "Origin"); | ||
@@ -103,3 +106,3 @@ } | ||
| await next(); | ||
| if (opts.origin !== "*") { | ||
| if (opts.origin !== "*" || opts.credentials) { | ||
| c.header("Vary", "Origin", { append: true }); | ||
@@ -106,0 +109,0 @@ } |
@@ -108,3 +108,3 @@ var __defProp = Object.defineProperty; | ||
| async parseBody(options) { | ||
| return this.bodyCache.parsedBody ??= await (0, import_body.parseBody)(this, options); | ||
| return (0, import_body.parseBody)(this, options); | ||
| } | ||
@@ -111,0 +111,0 @@ #cachedBody = (key) => { |
@@ -113,3 +113,3 @@ // src/helper/ssg/ssg.ts | ||
| } | ||
| await pool.run(() => app.fetch(forGetInfoURLRequest)); | ||
| await pool.run(() => app.fetch(forGetInfoURLRequest, { [SSG_CONTEXT]: true })); | ||
| if (!forGetInfoURLRequest.ssgParams) { | ||
@@ -116,0 +116,0 @@ if (isDynamicRoute(route.path)) { |
@@ -16,2 +16,5 @@ // src/middleware/cors/index.ts | ||
| if (optsOrigin === "*") { | ||
| if (opts.credentials) { | ||
| return (origin) => origin || null; | ||
| } | ||
| return () => optsOrigin; | ||
@@ -51,3 +54,3 @@ } else { | ||
| if (c.req.method === "OPTIONS") { | ||
| if (opts.origin !== "*") { | ||
| if (opts.origin !== "*" || opts.credentials) { | ||
| set("Vary", "Origin"); | ||
@@ -82,3 +85,3 @@ } | ||
| await next(); | ||
| if (opts.origin !== "*") { | ||
| if (opts.origin !== "*" || opts.credentials) { | ||
| c.header("Vary", "Origin", { append: true }); | ||
@@ -85,0 +88,0 @@ } |
+1
-1
@@ -86,3 +86,3 @@ // src/request.ts | ||
| async parseBody(options) { | ||
| return this.bodyCache.parsedBody ??= await parseBody(this, options); | ||
| return parseBody(this, options); | ||
| } | ||
@@ -89,0 +89,0 @@ #cachedBody = (key) => { |
@@ -7,2 +7,2 @@ /** | ||
| export { parseResponse, DetailedError } from './utils'; | ||
| export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions, ClientRequest, ClientResponse, ApplyGlobalResponse, } from './types'; | ||
| export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions, ClientRequest, ClientResponse, ApplyGlobalResponse, PickResponseByStatusCode, } from './types'; |
@@ -209,2 +209,22 @@ import type { Hono } from '../hono'; | ||
| export type ApplyGlobalResponse<App, Def extends GlobalResponseDefinition> = App extends HonoBase<infer E, infer _ extends Schema, infer B> ? ModSchema<ExtractSchema<App>, Def> extends infer S extends Schema ? Hono<E, S, B> : never : never; | ||
| type PickRoute<R, U extends StatusCode> = R extends Endpoint ? R extends { | ||
| status: U; | ||
| } ? R : never : R; | ||
| type PickSchema<D, U extends StatusCode> = { | ||
| [K in keyof D]: { | ||
| [M in keyof D[K]]: PickRoute<D[K][M], U>; | ||
| }; | ||
| }; | ||
| /** | ||
| * Keep only specific status code responses from all routes of an app. | ||
| * Useful when error responses are handled centrally (e.g., via custom fetch) | ||
| * and you want the client to only expose success response types. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * type AppSuccessOnly = PickResponseByStatusCode<typeof app, 200> | ||
| * const client = hc<AppSuccessOnly>('http://localhost') | ||
| * ``` | ||
| */ | ||
| export type PickResponseByStatusCode<App, U extends StatusCode> = App extends HonoBase<infer E, infer _ extends Schema, infer B> ? PickSchema<ExtractSchema<App>, U> extends infer S extends Schema ? Hono<E, S, B> : never : never; | ||
| export {}; |
@@ -14,5 +14,3 @@ import { GET_MATCH_RESULT } from './request/constants'; | ||
| }; | ||
| type BodyCache = Partial<Body & { | ||
| parsedBody: BodyData; | ||
| }>; | ||
| type BodyCache = Partial<Body>; | ||
| export declare class HonoRequest<P extends string = '/', I extends Input['out'] = {}> { | ||
@@ -19,0 +17,0 @@ |
+1
-1
| { | ||
| "name": "hono", | ||
| "version": "4.12.8", | ||
| "version": "4.12.9", | ||
| "description": "Web framework built on Web Standards", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1364835
0.08%35902
0.06%105
-0.94%