@whatwg-node/server
Advanced tools
Comparing version 0.9.57 to 0.9.58
@@ -68,14 +68,12 @@ "use strict"; | ||
for (const plugin of options.plugins) { | ||
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.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); | ||
} | ||
} | ||
@@ -82,0 +80,0 @@ } |
@@ -560,6 +560,3 @@ "use strict"; | ||
globalThis.process.once(event, function terminateHandler() { | ||
return Promise.allSettled([...disposableStacks].map(stack => !stack.disposed && | ||
stack.disposeAsync().catch(e => { | ||
console.error('Error while disposing:', e); | ||
}))); | ||
return Promise.allSettled([...disposableStacks].map(stack => !stack.disposed && stack.disposeAsync())); | ||
}); | ||
@@ -566,0 +563,0 @@ } |
@@ -64,14 +64,12 @@ /* eslint-disable @typescript-eslint/ban-types */ | ||
for (const plugin of options.plugins) { | ||
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.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); | ||
} | ||
} | ||
@@ -78,0 +76,0 @@ } |
@@ -537,6 +537,3 @@ export function isAsyncIterable(body) { | ||
globalThis.process.once(event, function terminateHandler() { | ||
return Promise.allSettled([...disposableStacks].map(stack => !stack.disposed && | ||
stack.disposeAsync().catch(e => { | ||
console.error('Error while disposing:', e); | ||
}))); | ||
return Promise.allSettled([...disposableStacks].map(stack => !stack.disposed && stack.disposeAsync())); | ||
}); | ||
@@ -543,0 +540,0 @@ } |
{ | ||
"name": "@whatwg-node/server", | ||
"version": "0.9.57", | ||
"version": "0.9.58", | ||
"description": "Fetch API compliant HTTP Server adapter", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
import { FetchAPI, ServerAdapterRequestHandler, type ServerAdapterInitialContext } from '../types.js'; | ||
export type ServerAdapterPlugin<TServerContext = {}> = { | ||
export interface ServerAdapterPlugin<TServerContext = {}> { | ||
onRequest?: OnRequestHook<TServerContext & ServerAdapterInitialContext>; | ||
@@ -7,3 +7,3 @@ onResponse?: OnResponseHook<TServerContext & ServerAdapterInitialContext>; | ||
[Symbol.asyncDispose]?: () => PromiseLike<void> | void; | ||
} | undefined; | ||
} | ||
export type OnRequestHook<TServerContext> = (payload: OnRequestEventPayload<TServerContext>) => Promise<void> | void; | ||
@@ -10,0 +10,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
153895
3284