From 28e510389374f5736c447395443d4a6687325048 Mon Sep 17 00:00:00 2001 From: dcode Date: Tue, 18 Feb 2025 20:51:34 +0100 Subject: [PATCH] fix: Use upstream fix to emit interop helpers --- index.js | 3 --- package-lock.json | 8 ++++---- package.json | 2 +- tests/index.js | 7 +++++++ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 764ce77..f91fff4 100644 --- a/index.js +++ b/index.js @@ -64,9 +64,6 @@ function randomBytes(len) { return randomFallback(len); } -// Default fallback, if any -randomFallback = null; - /** * Sets the pseudo random number generator to use as a fallback if neither node's `crypto` module nor the Web Crypto * API is available. Please note: It is highly important that the PRNG used is cryptographically secure and that it diff --git a/package-lock.json b/package-lock.json index 743f383..2f8928e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ }, "devDependencies": { "bcrypt": "^5.1.1", - "esm2umd": "^0.3.0", + "esm2umd": "^0.3.1", "prettier": "^3.5.0", "typescript": "^5.7.3" } @@ -614,9 +614,9 @@ } }, "node_modules/esm2umd": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/esm2umd/-/esm2umd-0.3.0.tgz", - "integrity": "sha512-dHcmK+4D2thL27HUz8UazgPqIIJARj+whPF/Wr5zraqlCe54UpPIFsg1wKRJEZK/BCmq6jPMqTtYBTXHz9j01A==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/esm2umd/-/esm2umd-0.3.1.tgz", + "integrity": "sha512-5WcGtkITdTHoLSkM/ZGWgsieCvlPUJLJdGOAmnmXPjjNBU/lwMGg3D4Tx/FWe32pY0ZhhAwoM8Oy+1hBI7BKQg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e69e715..c5fd74d 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ }, "devDependencies": { "bcrypt": "^5.1.1", - "esm2umd": "^0.3.0", + "esm2umd": "^0.3.1", "prettier": "^3.5.0", "typescript": "^5.7.3" } diff --git a/tests/index.js b/tests/index.js index 4a83d2d..525a44d 100644 --- a/tests/index.js +++ b/tests/index.js @@ -1,7 +1,10 @@ import assert from "node:assert"; +import { createRequire } from "node:module"; import bcryptcpp from "bcrypt"; import bcrypt from "../index.js"; +const require = createRequire(import.meta.url); + const tests = [ function encodeBase64(done) { var str = bcrypt.encodeBase64( @@ -226,6 +229,10 @@ const tests = [ done(); }, + function commonJS(done) { + var umd = require("../umd/index.js"); + umd.genSalt().then(done); + }, ]; function next() {