@whatwg-node/server
Advanced tools
Comparing version 0.9.46 to 0.9.47-alpha-20240814155933-2365ba5d093b5b9d61934ab89d7b8a0cb135d4af
@@ -535,18 +535,23 @@ "use strict"; | ||
const possibleEncodings = ['deflate', 'gzip', 'deflate-raw', 'br']; | ||
supportedEncodings = possibleEncodings.filter(encoding => { | ||
// deflate-raw is not supported in Node.js >v20 | ||
if (globalThis.process?.version?.startsWith('v2') && | ||
fetchAPI.DecompressionStream === globalThis.DecompressionStream && | ||
encoding === 'deflate-raw') { | ||
return false; | ||
} | ||
try { | ||
// eslint-disable-next-line no-new | ||
new fetchAPI.DecompressionStream(encoding); | ||
return true; | ||
} | ||
catch { | ||
return false; | ||
} | ||
}); | ||
if (fetchAPI.DecompressionStream['supportedFormats']) { | ||
supportedEncodings = fetchAPI.DecompressionStream['supportedFormats']; | ||
} | ||
else { | ||
supportedEncodings = possibleEncodings.filter(encoding => { | ||
// deflate-raw is not supported in Node.js >v20 | ||
if (globalThis.process?.version?.startsWith('v2') && | ||
fetchAPI.DecompressionStream === globalThis.DecompressionStream && | ||
encoding === 'deflate-raw') { | ||
return false; | ||
} | ||
try { | ||
// eslint-disable-next-line no-new | ||
new fetchAPI.DecompressionStream(encoding); | ||
return true; | ||
} | ||
catch { | ||
return false; | ||
} | ||
}); | ||
} | ||
supportedEncodingsByFetchAPI.set(fetchAPI, supportedEncodings); | ||
@@ -553,0 +558,0 @@ } |
@@ -513,18 +513,23 @@ import { URL } from '@whatwg-node/fetch'; | ||
const possibleEncodings = ['deflate', 'gzip', 'deflate-raw', 'br']; | ||
supportedEncodings = possibleEncodings.filter(encoding => { | ||
// deflate-raw is not supported in Node.js >v20 | ||
if (globalThis.process?.version?.startsWith('v2') && | ||
fetchAPI.DecompressionStream === globalThis.DecompressionStream && | ||
encoding === 'deflate-raw') { | ||
return false; | ||
} | ||
try { | ||
// eslint-disable-next-line no-new | ||
new fetchAPI.DecompressionStream(encoding); | ||
return true; | ||
} | ||
catch { | ||
return false; | ||
} | ||
}); | ||
if (fetchAPI.DecompressionStream['supportedFormats']) { | ||
supportedEncodings = fetchAPI.DecompressionStream['supportedFormats']; | ||
} | ||
else { | ||
supportedEncodings = possibleEncodings.filter(encoding => { | ||
// deflate-raw is not supported in Node.js >v20 | ||
if (globalThis.process?.version?.startsWith('v2') && | ||
fetchAPI.DecompressionStream === globalThis.DecompressionStream && | ||
encoding === 'deflate-raw') { | ||
return false; | ||
} | ||
try { | ||
// eslint-disable-next-line no-new | ||
new fetchAPI.DecompressionStream(encoding); | ||
return true; | ||
} | ||
catch { | ||
return false; | ||
} | ||
}); | ||
} | ||
supportedEncodingsByFetchAPI.set(fetchAPI, supportedEncodings); | ||
@@ -531,0 +536,0 @@ } |
{ | ||
"name": "@whatwg-node/server", | ||
"version": "0.9.46", | ||
"version": "0.9.47-alpha-20240814155933-2365ba5d093b5b9d61934ab89d7b8a0cb135d4af", | ||
"description": "Fetch API compliant HTTP Server adapter", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
140987
2886