Open
Description
The delay method currently uses a polyfill for node-abort-controller that's only needed for Node.js versions < 15.4.0. This adds unnecessary dependency and complexity to the codebase since we're targeting modern Node.js versions.
Describe the solution you'd like
- Remove the node-abort-controller polyfill
- Update the delay function to use native setTimeout from node:timers/promises
- Add proper TypeScript configuration to support modern Node.js module resolution
- Set minimum Node.js version requirement to ≥15.4.0 in package.json
Describe alternatives you've considered
- Keep backwards compatibility by checking Node.js version at runtime
- Use native Promise with setTimeout instead of timers/promises
- Maintain the polyfill for older Node.js versions support
Additional context
The change requires updating @types/node
from v12
to at least v16
and configuring proper module resolution in tsconfig.json
to support the node: protocol.
Reference files affected:
- src/utils.ts
Suggested change:
import { setTimeout as setTimeoutPromises } from 'node:timers/promises';
export function delay(
ms: number,
abortController?: AbortController,
): Promise<void> {
return setTimeoutPromises<undefined>(ms, undefined, {
signal: abortController?.signal,
});
}