diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d1d201..26a690d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [2.1.2] 2023-02-02 +- Move the debug statements to `rollup.config.mjs` to eliminate `process` references from the output file + ### [2.1.1] 2023-01-30 - Raise an exception when trying to add a task with an already existing id (instead of failing when trying to run it) - Ability to dequeue multiple tasks when scheduling (fixes not reaching the maximum concurrency limit when the cool down is very low but more than zero) diff --git a/rollup.config.mjs b/rollup.config.mjs index 3b8d9f2..f3045e0 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -28,8 +28,8 @@ export default [ }, plugins: [ modify({ - find: /debug\(.*\);?/, - replace: '' + find: /debug\((.*\));?/, + replace: (_, expr) => process?.env?.QUEUE_DEBUG ? `console.debug(${expr});` : '' }), typescript(), terser() diff --git a/src/index.ts b/src/index.ts index dd64335..80c98cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,8 @@ import { Heap } from './heap'; // This will be optimized away by V8 as I have proven in // https://bugs.chromium.org/p/v8/issues/detail?id=12756 -const debug = process?.env?.QUEUE_DEBUG ? console.debug.bind(console) : () => undefined; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +const debug = (..._) => undefined; // This is the central part of the concept: // using a Promise as a semaphore