ReviewOS

also looking at this

stacks/dtsx

chore(deps): update all non-major dependencies

#2997
Closed renovate[bot] wants to merge renovate/all-minor-patch into main
29 files +1047 -444
packages/dtsx/src/extractor/hash.tsadded+19-0
Changes to packages/dtsx/src/extractor/hash.ts
@@ -0,0 +1,19 @@
1/**
2 * Fast hash function for content comparison.
3 * This module is intentionally TS-free to keep the hot path lightweight.
4 */
5
6const hasBunHash = typeof globalThis.Bun?.hash === 'function'
7
8export function hashContent(content: string): number | bigint {
9 if (hasBunHash) {
10 return Bun.hash(content)
11 }
12 let hash = 0
13 for (let i = 0; i < content.length; i++) {
14 const char = content.charCodeAt(i)
15 hash = ((hash << 5) - hash) + char
16 hash = hash & hash
17 }
18 return hash
19}