From 95e03ad147e276c61b03ab84902349dfe5084396 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 1 Jan 2024 15:09:07 +0100 Subject: [PATCH] build: fix import error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- bundle.js | 1 + src/utils/AsyncLock.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bundle.js b/bundle.js index 9821a48d..27c9b953 100644 --- a/bundle.js +++ b/bundle.js @@ -26,6 +26,7 @@ import { copy } from 'esbuild-plugin-copy' 'just-merge', 'logform', 'mnemonist', + 'mnemonist/*', 'mongodb', 'node:*', 'poolifier', diff --git a/src/utils/AsyncLock.ts b/src/utils/AsyncLock.ts index b58e3a77..d1141972 100644 --- a/src/utils/AsyncLock.ts +++ b/src/utils/AsyncLock.ts @@ -1,6 +1,6 @@ // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. -import { Queue } from 'mnemonist' +import Queue from 'mnemonist/queue.js' import { Constants } from './Constants.js' @@ -18,6 +18,7 @@ export class AsyncLock { private constructor () { this.acquired = false + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this.resolveQueue = new Queue() } @@ -36,19 +37,22 @@ export class AsyncLock { return } await new Promise((resolve) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access asyncLock.resolveQueue.enqueue(resolve) }) } private static async release (type: AsyncLockType): Promise { const asyncLock = AsyncLock.getAsyncLock(type) + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access if (asyncLock.resolveQueue.size === 0 && asyncLock.acquired) { asyncLock.acquired = false return } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access const queuedResolve = asyncLock.resolveQueue.dequeue()! await new Promise((resolve) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call queuedResolve() resolve() }) -- 2.34.1