From 239a4da8355a490aa8de2ff3b56b239c8fe8d077 Mon Sep 17 00:00:00 2001 From: David Snelling Date: Tue, 24 Feb 2026 12:25:26 -0800 Subject: [PATCH] fix: replace require('crypto') with ESM import in SSTable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SSTable.calculateChecksum() used require('crypto') which breaks in ESM environments and Bun. Replace with top-level import { createHash } from 'node:crypto' — SSTable is Node-only (LSM-tree filesystem storage) so a direct node:crypto import is appropriate. --- src/graph/lsm/SSTable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graph/lsm/SSTable.ts b/src/graph/lsm/SSTable.ts index 9944d753..da64db98 100644 --- a/src/graph/lsm/SSTable.ts +++ b/src/graph/lsm/SSTable.ts @@ -14,6 +14,7 @@ * - Footer: checksum, stats */ +import { createHash } from 'node:crypto' import { encode as defaultEncode, decode as defaultDecode } from '@msgpack/msgpack' import { BloomFilter, SerializedBloomFilter } from './BloomFilter.js' @@ -326,8 +327,7 @@ export class SSTable { * Simple but effective: hash of all sourceIds concatenated */ private calculateChecksum(entries: SSTableEntry[]): string { - const crypto = require('crypto') - const hash = crypto.createHash('sha256') + const hash = createHash('sha256') for (const entry of entries) { hash.update(entry.sourceId)