Skip to content

Releases: ardatan/whatwg-node

December 24, 2024

24 Dec 14:57
fdf8ac0
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

  • #1926
    bae5de1
    Thanks @ardatan! - While calling handleNodeRequest or
    handleNodeRequestAndResponse, waitUntil is not added automatically as in requestListener for
    Node.js integration. This change adds waitUntil into the serverContext if not present.

    Fixes the issue with Fastify integration that uses the mentioned methods

December 17, 2024

17 Dec 13:51
dd8f5d1
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

  • #1899
    a84e84a
    Thanks @ardatan! - - New onDispose hook which is alias of
    Symbol.asyncDispose for 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'

December 13, 2024

13 Dec 08:28
77f5c26
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

  • c75e6e3
    Thanks @ardatan! - Export `DisposableSymbols` for disposable
    plugins

December 12, 2024

12 Dec 14:13
6a42223
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

December 10, 2024

10 Dec 21:24
ded85ee
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

  • #1872
    7fb47d8
    Thanks @ardatan! - Fix the error thrown `ENOTFOUND` when a parsed
    URL with IPV6 hostname is given

    Instead of using the parsed URL passed to the fetch function, let node:http parse it again.
    This way, the IPV6 hostname is correctly resolved.

  • #1872
    7fb47d8
    Thanks @ardatan! - url.searchParams parameter should reflect the
    changes in toString()

    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/[email protected]

Patch Changes

  • #1872
    7fb47d8
    Thanks @ardatan! - Wait for remaining promises during asyncDispose
    correctly

    The asyncDispose function 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)

November 25, 2024

25 Nov 20:59
7ec7cc4
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

November 25, 2024

25 Nov 18:49
5d67e83
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

  • b4ab548
    Thanks @ardatan! - Remove SIGTERM from termination events to prevent
    hangs, and always add disposable stack to the termination events

November 25, 2024

25 Nov 15:17
d3d3f64
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

November 25, 2024

25 Nov 14:57
8186ea8
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

@whatwg-node/[email protected]

Patch Changes

  • e88ab4a
    Thanks @ardatan! - dependencies updates:

  • e88ab4a
    Thanks @ardatan! - New Explicit Resource Management feature for the
    server adapters;
    Learn more

    • Symbol.dispose and Symbol.asyncDispose hooks When the server adapter plugin has these hooks,
      it is added to the disposable stack of the server adapter. When the server adapter is disposed,
      those hooks are triggered
    • disposableStack in the server adapter The shared disposable stack that will be triggered when
      Symbol.asyncDispose is called.
    • Automatic disposal on Node and Node-compatible environments Even if the server adapter is not
      disposed explicitly, the disposal logic will be triggered on the process termination (SIGINT,
      SIGTERM etc)
    • ctx.waitUntil relation If it is an environment does not natively provide waitUntil, the
      unresolved passed promises will be resolved by the disposable stack.

November 19, 2024

19 Nov 13:19
0e7e7a1
Compare
Choose a tag to compare

@whatwg-node/[email protected]

Patch Changes

@whatwg-node/[email protected]

Patch Changes