@whatwg-node/server
Advanced tools
Comparing version 0.10.0-alpha-20241125135107-f57895e3cc8e9724899983c32c8b503cbd283558 to 0.10.0-alpha-20241125142132-d9f044a9ea5bb1f5c81f5bc09c613fdd5be81281
@@ -68,8 +68,14 @@ "use strict"; | ||
for (const plugin of options.plugins) { | ||
if (plugin.onRequest) { | ||
onRequestHooks.push(plugin.onRequest); | ||
if (plugin != null) { | ||
if (plugin.onRequest) { | ||
onRequestHooks.push(plugin.onRequest); | ||
} | ||
if (plugin.onResponse) { | ||
onResponseHooks.push(plugin.onResponse); | ||
} | ||
const disposeFn = plugin[disposablestack_1.DisposableSymbols.asyncDispose] || plugin[disposablestack_1.DisposableSymbols.dispose]; | ||
if (disposeFn != null) { | ||
disposableStack.defer(disposeFn); | ||
} | ||
} | ||
if (plugin.onResponse) { | ||
onResponseHooks.push(plugin.onResponse); | ||
} | ||
} | ||
@@ -76,0 +82,0 @@ } |
@@ -64,8 +64,14 @@ /* eslint-disable @typescript-eslint/ban-types */ | ||
for (const plugin of options.plugins) { | ||
if (plugin.onRequest) { | ||
onRequestHooks.push(plugin.onRequest); | ||
if (plugin != null) { | ||
if (plugin.onRequest) { | ||
onRequestHooks.push(plugin.onRequest); | ||
} | ||
if (plugin.onResponse) { | ||
onResponseHooks.push(plugin.onResponse); | ||
} | ||
const disposeFn = plugin[DisposableSymbols.asyncDispose] || plugin[DisposableSymbols.dispose]; | ||
if (disposeFn != null) { | ||
disposableStack.defer(disposeFn); | ||
} | ||
} | ||
if (plugin.onResponse) { | ||
onResponseHooks.push(plugin.onResponse); | ||
} | ||
} | ||
@@ -72,0 +78,0 @@ } |
{ | ||
"name": "@whatwg-node/server", | ||
"version": "0.10.0-alpha-20241125135107-f57895e3cc8e9724899983c32c8b503cbd283558", | ||
"version": "0.10.0-alpha-20241125142132-d9f044a9ea5bb1f5c81f5bc09c613fdd5be81281", | ||
"description": "Fetch API compliant HTTP Server adapter", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
import { FetchAPI, ServerAdapterRequestHandler, type ServerAdapterInitialContext } from '../types.js'; | ||
export interface ServerAdapterPlugin<TServerContext = {}> { | ||
export type ServerAdapterPlugin<TServerContext = {}> = { | ||
onRequest?: OnRequestHook<TServerContext & ServerAdapterInitialContext>; | ||
onResponse?: OnResponseHook<TServerContext & ServerAdapterInitialContext>; | ||
} | ||
[Symbol.dispose]?: () => void; | ||
[Symbol.asyncDispose]?: () => PromiseLike<void> | void; | ||
} | undefined; | ||
export type OnRequestHook<TServerContext> = (payload: OnRequestEventPayload<TServerContext>) => Promise<void> | void; | ||
@@ -7,0 +9,0 @@ export interface OnRequestEventPayload<TServerContext> { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154377
3294