process-warning is a lightweight utility designed to standardize the creation and emission of warnings within JavaScript and TypeScript applications, particularly for the Fastify ecosystem. It ensures that warnings, including deprecation warnings, are consistently formatted and, by default, emitted only once to prevent log spam. The current stable version is 5.0.0. The package maintains a regular release cadence, often aligning with Node.js version updates and Fastify development, with minor releases for bug fixes and dependency bumps and occasional major releases for refactoring or dropping older Node.js support. Its key differentiators include built-in one-time emission, support for Node.js's native deprecation warning CLI options, and a clear API for defining warning codes and messages.
npm install process-warningVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating and emitting both standard and deprecation warnings, including the 'unlimited' option.
Review `createWarning` and `createDeprecation` usage against v3.0.0 documentation. Test warning emission and suppression thoroughly after upgrade.
Ensure your project runs on Node.js 20 or newer. Upgrade your Node.js runtime if you are still on Node.js 16 or 18.
If a warning needs to be emitted repeatedly, pass `{ unlimited: true }` in the options object to `createWarning` or `createDeprecation`.Be mindful of Node.js CLI flags when developing or deploying applications using `createDeprecation`. Communicate these potential environmental impacts to users or other developers if your module emits deprecation warnings.
For ESM, use `import { createWarning } from 'process-warning';`. For CommonJS, use `const { createWarning } = require('process-warning');`. Ensure correct destructuring and module type configuration in `package.json` if using hybrid modules.Ensure that the `code` property, a unique string identifier, is provided and correctly spelled in the options object for `createWarning` or `createDeprecation`.
Use Node.js's `--no-warnings` CLI flag to suppress all warnings, or specifically configure `process-warning` to suppress the particular warning by interacting with its `emitted` state for testing, e.g., `MyModuleWarning.emitted = true` to prevent future emissions.
No dependency data recorded yet.