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
- Maintenance status: The GitHub source appears quiet/dormant as of today (2026-08-13). The last recorded upstream push was 2024-04-28, and the last published updates were v2.1.2 on 2023-10-03.
- Update cadence: Updates were relatively clustered early on (notably v2.1.0 to v2.1.2 in 2023-10-03), then shifted to a long gap (no further published updates after 2023-10-03).
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.