Skip to content

Commit

Permalink
move debug to rollup.config
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Feb 2, 2023
1 parent 30088e9 commit a468369
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default [
},
plugins: [
modify({
find: /debug\(.*\);?/,
replace: ''
find: /debug\((.*\));?/,
replace: (_, expr) => process?.env?.QUEUE_DEBUG ? `console.debug(${expr});` : ''
}),
typescript(),
terser()
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> as a semaphore
Expand Down

0 comments on commit a468369

Please sign in to comment.