Skip to content

Commit 92208da

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 b16e1f1 commit 92208da

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

‎.eslintrc.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,7 @@ module.exports = {
415415
},
416416
},
417417
{
418-
files: [
419-
'packages/react-native-renderer/**/*.js',
420-
],
418+
files: ['packages/react-native-renderer/**/*.js'],
421419
globals: {
422420
nativeFabricUIManager: 'readonly',
423421
},

‎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+
};

‎scripts/rollup/validate/eslintrc.cjs.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ module.exports = {
6565

6666
// Native Scheduler
6767
nativeRuntimeScheduler: 'readonly',
68+
69+
Bun: 'readonly',
6870
},
6971
parserOptions: {
7072
ecmaVersion: 2020,

‎scripts/rollup/validate/eslintrc.cjs2015.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ module.exports = {
6262

6363
// act
6464
IS_REACT_ACT_ENVIRONMENT: 'readonly',
65+
66+
Bun: 'readonly',
6567
},
6668
parserOptions: {
6769
ecmaVersion: 2015,

‎scripts/rollup/validate/eslintrc.esm.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ module.exports = {
6262

6363
// act
6464
IS_REACT_ACT_ENVIRONMENT: 'readonly',
65+
66+
Bun: 'readonly',
6567
},
6668
parserOptions: {
6769
ecmaVersion: 2020,

0 commit comments

Comments
 (0)