// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
// SPDX-License-Identifier: GPL-3.0-or-later
+import blake2b from 'blake2b'
+
async function ckdBlake2b () {
- const { default: blake2b } = await import('blake2b')
+ let blake2b: any
let addEventListener = globalThis.addEventListener
let postMessage = globalThis.postMessage
if (addEventListener == null || postMessage == null) {
+ blake2b = (await import('blake2b')).default
const { isMainThread, parentPort } = await import('node:worker_threads')
if (!isMainThread && parentPort) {
addEventListener = Object.getPrototypeOf(parentPort).addListener.bind(parentPort)