default-resolution is a utility package from the Gulp.js ecosystem designed to determine the default time resolution (e.g., 1 second or 1 millisecond) based on the current Node.js runtime environment. It abstracts away the nuances of event loop timing changes across different Node.js versions, providing a consistent way to get a baseline resolution value. The current stable version is 3.0.0, which dropped support for Node.js versions older than 10.13.0 and refactored its internal `nodeVersion` export. The package provides a simple function that can also be overridden with a custom resolution value. Its release cadence appears to be infrequent, driven by core Node.js compatibility requirements or internal Gulp.js ecosystem needs, rather than a continuous feature stream. Its key differentiator is its singular focus on this specific Node.js timing heuristic, making it a minimal and specialized tool for platform-aware timing.
npm install default-resolutionVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to get the default Node.js event loop resolution and how to override it with a custom value.
Ensure your project's Node.js environment is at least 10.13.0. Update your runtime or specify a compatible engine in your `package.json`.
If `nodeVersion` functionality is needed, consider importing and using `parse-node-version` directly, or refactor your code to not rely on this internal detail.
Update logic to check for `1` (millisecond) instead of `0`. This change ensures a non-zero, positive resolution value consistently.
If your project is an ES Module, use `import defaultResolution from 'default-resolution';`. If you intend to use CommonJS, ensure your file is `.cjs` or `package.json` specifies `"type": "commonjs"`.
For ESM, use `import defaultResolution from 'default-resolution';`. For CommonJS, use `const defaultResolution = require('default-resolution');`.Upgrade your Node.js runtime to version 10.13.0 or newer. Alternatively, if locked to an older Node.js, downgrade `default-resolution` to a compatible major version (e.g., `^2.0.0`).