@whatwg-node/server
Advanced tools
Comparing version 0.10.0-alpha-20241125130609-2d42652904068bfd5c22714b7277b8c77917aeba to 0.10.0-alpha-20241125131513-7ac7e92d53ef0d5a6ddab6fcb0b311d88708df6d
@@ -46,3 +46,7 @@ "use strict"; | ||
if (waitUntilPromises.size > 0) { | ||
return Promise.allSettled(waitUntilPromises).then(() => { }, () => { }); | ||
return Promise.allSettled(waitUntilPromises).then(() => { | ||
waitUntilPromises.clear(); | ||
}, () => { | ||
waitUntilPromises.clear(); | ||
}); | ||
} | ||
@@ -55,3 +59,4 @@ }); | ||
} | ||
waitUntilPromises.add(promiseLike.then(() => { | ||
waitUntilPromises.add(promiseLike); | ||
promiseLike.then(() => { | ||
waitUntilPromises.delete(promiseLike); | ||
@@ -61,3 +66,3 @@ }, err => { | ||
waitUntilPromises.delete(promiseLike); | ||
})); | ||
}); | ||
} | ||
@@ -64,0 +69,0 @@ if (options?.plugins != null) { |
@@ -50,3 +50,2 @@ "use strict"; | ||
onResponse({ request, response, setResponse, fetchAPI, serverContext }) { | ||
const waitUntil = serverContext.waitUntil?.bind(serverContext) || (() => { }); | ||
// Hack for avoiding to create whatwg-node to create a readable stream until it's needed | ||
@@ -65,4 +64,6 @@ if (response['bodyInit'] || response.body) { | ||
const writer = compressionStream.writable.getWriter(); | ||
waitUntil(writer.write(bufOfRes)); | ||
waitUntil(writer.close()); | ||
const write$ = writer.write(bufOfRes); | ||
serverContext.waitUntil?.(write$); | ||
const close$ = writer.close(); | ||
serverContext.waitUntil?.(close$); | ||
const uint8Arrays$ = (0, utils_js_1.isReadable)(compressionStream.readable['readable']) | ||
@@ -85,3 +86,4 @@ ? collectReadableValues(compressionStream.readable['readable']) | ||
setResponse(compressedResponse); | ||
waitUntil(compressionStream.writable.close()); | ||
const close$ = compressionStream.writable.close(); | ||
serverContext.waitUntil?.(close$); | ||
}); | ||
@@ -88,0 +90,0 @@ } |
@@ -42,3 +42,7 @@ /* eslint-disable @typescript-eslint/ban-types */ | ||
if (waitUntilPromises.size > 0) { | ||
return Promise.allSettled(waitUntilPromises).then(() => { }, () => { }); | ||
return Promise.allSettled(waitUntilPromises).then(() => { | ||
waitUntilPromises.clear(); | ||
}, () => { | ||
waitUntilPromises.clear(); | ||
}); | ||
} | ||
@@ -51,3 +55,4 @@ }); | ||
} | ||
waitUntilPromises.add(promiseLike.then(() => { | ||
waitUntilPromises.add(promiseLike); | ||
promiseLike.then(() => { | ||
waitUntilPromises.delete(promiseLike); | ||
@@ -57,3 +62,3 @@ }, err => { | ||
waitUntilPromises.delete(promiseLike); | ||
})); | ||
}); | ||
} | ||
@@ -60,0 +65,0 @@ if (options?.plugins != null) { |
@@ -47,3 +47,2 @@ import { decompressedResponseMap, getSupportedEncodings, isAsyncIterable, isReadable, } from '../utils.js'; | ||
onResponse({ request, response, setResponse, fetchAPI, serverContext }) { | ||
const waitUntil = serverContext.waitUntil?.bind(serverContext) || (() => { }); | ||
// Hack for avoiding to create whatwg-node to create a readable stream until it's needed | ||
@@ -62,4 +61,6 @@ if (response['bodyInit'] || response.body) { | ||
const writer = compressionStream.writable.getWriter(); | ||
waitUntil(writer.write(bufOfRes)); | ||
waitUntil(writer.close()); | ||
const write$ = writer.write(bufOfRes); | ||
serverContext.waitUntil?.(write$); | ||
const close$ = writer.close(); | ||
serverContext.waitUntil?.(close$); | ||
const uint8Arrays$ = isReadable(compressionStream.readable['readable']) | ||
@@ -82,3 +83,4 @@ ? collectReadableValues(compressionStream.readable['readable']) | ||
setResponse(compressedResponse); | ||
waitUntil(compressionStream.writable.close()); | ||
const close$ = compressionStream.writable.close(); | ||
serverContext.waitUntil?.(close$); | ||
}); | ||
@@ -85,0 +87,0 @@ } |
{ | ||
"name": "@whatwg-node/server", | ||
"version": "0.10.0-alpha-20241125130609-2d42652904068bfd5c22714b7277b8c77917aeba", | ||
"version": "0.10.0-alpha-20241125131513-7ac7e92d53ef0d5a6ddab6fcb0b311d88708df6d", | ||
"description": "Fetch API compliant HTTP Server adapter", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
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
153539
3280