Releases: ardatan/whatwg-node
Release list
February 05, 2025
January 10, 2025
@whatwg-node/fetch@0.10.3
Patch Changes
- #1961
2785c80
Thanks @ardatan! -ReadableStream'sSymbol.asyncIteratornow
returnsAsyncIterableIteratorlike before even if it is ok to returnAsyncIteratorright now.
It is safer to returnAsyncIterableIteratorbecause it is a common mistake to use
AsyncIteratorasAsyncIterable. - Updated dependencies
[2785c80]:- @whatwg-node/node-fetch@0.7.7
@whatwg-node/node-fetch@0.7.7
Patch Changes
January 10, 2025
@whatwg-node/fetch@0.10.2
Patch Changes
- #1929
b88b85c
Thanks @ardatan! - dependencies updates:- Updated dependency
@whatwg-node/node-fetch@^0.7.5↗︎
(from^0.7.1, independencies)
- Updated dependency
- Updated dependencies
[b88b85c,
9b39c3e,
b88b85c]:- @whatwg-node/node-fetch@0.7.6
@whatwg-node/node-fetch@0.7.6
Patch Changes
-
#1929
b88b85c
Thanks @ardatan! - dependencies updates:- Removed dependency
@kamilkisiela/fast-url-parser@^1.1.4↗︎
(fromdependencies) - Removed dependency
fast-querystring@^1.1.1↗︎ (from
dependencies)
- Removed dependency
-
#1947
9b39c3e
Thanks @ardatan! - Remove the event listener on the provided
AbortSignalwhennode-libcurlis used, the connection finishes to prevent potential memory
leaks;const res = await fetch(URL, { signal: new AbortController().signal }) // AbortController is never aborted, and HTTP request is done as expected successfully
-
#1929
b88b85c
Thanks @ardatan! - - Remove URL ponyfill implementation based on
fast-url-parserandfast-querystring, because Node now uses Ada URL parser which is fast
enough.- Fix
ReadableStream[Symbol.asyncIterator]
ReadableStreamusesReadableso it usesSymbol.asyncIteratormethod ofReadablebut the
returned iterator's.returnmethod doesn't handle cancellation correctly. So we need to call
readable.destroy(optionalError)manually to cancel the stream.This allows
ReadableStreamto use implementations relying onAsyncIterable.cancelto handle
cancellation likeReadable.fromPreviously the following was not handling cancellation;
const res = new ReadableStream({ start(controller) { controller.enqueue('Hello') controller.enqueue('World') }, cancel(reason) { console.log('cancelled', reason) } }) const readable = Readable.from(res) readable.destroy(new Error('MY REASON')) // Should log 'cancelled MY REASON'
- Fix
December 24, 2024
@whatwg-node/server@0.9.65
Patch Changes
-
#1926
bae5de1
Thanks @ardatan! - While callinghandleNodeRequestor
handleNodeRequestAndResponse,waitUntilis not added automatically as inrequestListenerfor
Node.js integration. This change addswaitUntilinto theserverContextif not present.Fixes the issue with Fastify integration that uses the mentioned methods
December 17, 2024
@whatwg-node/server@0.9.64
Patch Changes
-
#1899
a84e84a
Thanks @ardatan! - - NewonDisposehook which is alias of
Symbol.asyncDisposefor Explicit Resource Management- Registration of the server adapter's disposal to the global process termination listener is now
opt-in and configurable.
const plugin: ServerAdapterPlugin = { onDispose() { console.log('Server adapter is disposed') } } const serverAdapter = createServerAdapter(() => new Response('Hello world!'), { plugins: [plugin], // Register the server adapter's disposal to the global process termination listener // Then the server adapter will be disposed when the process exit signals only in Node.js! disposeOnProcessTerminate: true }) await serverAdapter.dispose() // Prints 'Server adapter is disposed'
- Registration of the server adapter's disposal to the global process termination listener is now
December 13, 2024
December 12, 2024
December 10, 2024
@whatwg-node/node-fetch@0.7.5
Patch Changes
-
#1872
7fb47d8
Thanks @ardatan! - Fix the error thrown `ENOTFOUND` when a parsed
URL with IPV6 hostname is givenInstead of using the parsed URL passed to the
fetchfunction, letnode:httpparse it again.
This way, the IPV6 hostname is correctly resolved. -
#1872
7fb47d8
Thanks @ardatan! -url.searchParamsparameter should reflect the
changes intoString()const url = new URL('http://example.com/?a=b') url.searchParams.set('a', 'c') console.log(url.toString()) // http://example.com/?a=c
-
#1872
7fb47d8
Thanks @ardatan! - Fix IPV6 parsing in `URL`;new URL('http://[::1]')should parse the host as `[::1]` not `::1`.
@whatwg-node/server@0.9.61
Patch Changes
-
#1872
7fb47d8
Thanks @ardatan! - Wait for remaining promises duringasyncDispose
correctlyThe
asyncDisposefunction should wait for all remaining promises to resolve before returning.
This ensures that the server is fully disposed of before the function returns.import { createServerAdapter } from '@whatwg-node/server' const deferred = Promise.withResolvers() const adapter = createServerAdapter((req, ctx) => { ctx.waitUntil(deferred.promise) return new Response('Hello, world!') }) const res = await adapter.fetch('http://example.com') console.assert(res.status === 200) console.assert((await res.text()) === 'Hello, world!') let disposed = false adapter[Symbol.asyncDispose]().then(() => { disposed = true }) console.assert(!disposed) deferred.resolve() console.assert(disposed)