Provides a small Node.js module to run a cleanup function when the process emits the exit event, designed to avoid memory leaks so objects can still be garbage collected. It uses WeakRef and FinalizationRegistry (Node v14+), with helpers to register and unregister shutdown handlers.
Project status
- The repository appears largely dormant, with the most recent listed tagged updates from 2023-10 and the latest upstream push on 2024-04-28, so there have been no evident updates in roughly the last 1.5 to 2 years (as of 2026-08-12).
- Update cadence was active around 2022-06 to 2023-10 (v2.1.0 to v2.1.2), but then slowed significantly, with no further tagged updates shown after v2.1.2.
AI summary generated
Recent updates
v2.1.2
Release v2.1.2 introduces a change to avoid creating a FinalizationRegistry instance unless it is actually needed. This is described as reducing unnecessary initialization work.
v2.1.1
v2.1.1 primarily updates the CI matrix and GitHub Actions dependencies (checkout, dependabot merge action) and adds Node.js v20 coverage while excluding Node 14 on Windows. The code diff also includes a small but potentially behavior-changing internal modification in index.js, plus a new Node engine constraint in package.json.
Featuresv2.1.0
v2.1.0 adds support for registering callbacks to run on Node's beforeExit lifecycle event in addition to the existing exit handling. The implementation introduces separate internal registries and process event listeners for 'exit' and 'beforeExit'.
Featuresv2.0.0
v2.0.0 rewrites on-exit-leak-free to reduce listener usage, switching from supporting both 'beforeExit' and 'exit' to only handling process 'exit'. The release also bumps development tooling (standard) and updates the dependabot merge GitHub Action used in CI.
Breakingv1.0.0
v1.0.0 mainly updates GitHub Actions tooling in CI (checkout, setup-node, dependabot merge) and adds a change intended to avoid MaxListenerWarning. The shipped code change also expands exit handling beyond just the exit event and alters the callback behavior.
v0.1.0
This is the initial release (v0.1.0). There are no release notes describing features, fixes, security updates, or upgrade steps beyond the fact that the project is being published for the first time.