Skip to content

Commit 006694d

Browse files
committed
Implement createFastHash for Bun
In Bun builds, createFastHash uses Bun.hash. See: https://bun.sh/docs/api/hashing#bun-hash
1 parent a1fdc96 commit 006694d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/react-server/src/ReactServerStreamConfigBun.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* @flow
88
*/
99

10+
/* global Bun */
11+
1012
type BunReadableStreamController = ReadableStreamController & {
1113
end(): mixed,
1214
write(data: Chunk | BinaryChunk): void,
@@ -98,5 +100,5 @@ export function closeWithError(destination: Destination, error: mixed): void {
98100
}
99101

100102
export function createFastHash(input: string): string | number {
101-
return input;
103+
return Bun.hash(input);
102104
}

scripts/flow/environment.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,9 @@ declare module 'node:worker_threads' {
281281
port2: MessagePort;
282282
}
283283
}
284+
285+
declare var Bun: {
286+
hash(
287+
input: string | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer,
288+
): number,
289+
};

0 commit comments

Comments
 (0)