Skip to content

Commit 5a8e3f1

Browse files
chrispaderclaude
andcommitted
chore(example): replace react-native-quick-crypto with buffer
The example only used react-native-quick-crypto and @craftzdog/react-native-buffer to provide a global Buffer. The buffer package covers that without native code and drops a Nitro 0.x module that can't build against Nitro V1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 92744b3 commit 5a8e3f1

6 files changed

Lines changed: 6 additions & 96 deletions

File tree

‎bun.lock‎

Lines changed: 1 addition & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎example/babel.config.shared.js‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path')
22
const libraryPackage = require('../packages/react-native-nitro-sqlite/package.json')
33

4-
function createExampleBabelConfig(projectRoot, { buffer, crypto } = {}) {
4+
function createExampleBabelConfig(projectRoot) {
55
const sourceDirectory = path.join(projectRoot, 'src')
66
const testsDirectory = path.join(projectRoot, 'tests')
77
const aliases = {
@@ -20,14 +20,6 @@ function createExampleBabelConfig(projectRoot, { buffer, crypto } = {}) {
2020
'^@tests/(.+)': `${testsDirectory}/\\1`,
2121
}
2222

23-
if (buffer !== false) {
24-
aliases.buffer = buffer ?? 'react-native-quick-crypto'
25-
}
26-
27-
if (crypto !== false) {
28-
aliases.crypto = crypto ?? 'react-native-quick-crypto'
29-
}
30-
3123
return {
3224
presets: ['module:@react-native/babel-preset'],
3325
plugins: [

‎example/ios/Podfile.lock‎

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,6 @@ PODS:
3838
- ReactCommon/turbomodule/core
3939
- ReactNativeDependencies
4040
- Yoga
41-
- QuickCrypto (1.1.8):
42-
- hermes-engine
43-
- NitroModules
44-
- RCTRequired
45-
- RCTTypeSafety
46-
- React-bridging
47-
- React-callinvoker
48-
- React-Core
49-
- React-Core-prebuilt
50-
- React-cxxstableapi
51-
- React-debug
52-
- React-Fabric
53-
- React-featureflags
54-
- React-graphics
55-
- React-ImageManager
56-
- React-jsi
57-
- React-NativeModulesApple
58-
- React-RCTFabric
59-
- React-renderercss
60-
- React-rendererdebug
61-
- React-utils
62-
- ReactCodegen
63-
- ReactCommon/turbomodule/core
64-
- ReactNativeDependencies
65-
- Yoga
6641
- RCT-Folly (2024.11.18.00):
6742
- RCT-Folly/Default (= 2024.11.18.00)
6843
- ReactNativeDependencies
@@ -1398,29 +1373,6 @@ PODS:
13981373
- ReactCommon/turbomodule/core
13991374
- ReactNativeDependencies
14001375
- Yoga
1401-
- react-native-quick-base64 (3.0.1):
1402-
- hermes-engine
1403-
- RCTRequired
1404-
- RCTTypeSafety
1405-
- React-bridging
1406-
- React-Core
1407-
- React-Core-prebuilt
1408-
- React-cxxstableapi
1409-
- React-debug
1410-
- React-Fabric
1411-
- React-featureflags
1412-
- React-graphics
1413-
- React-ImageManager
1414-
- React-jsi
1415-
- React-NativeModulesApple
1416-
- React-RCTFabric
1417-
- React-renderercss
1418-
- React-rendererdebug
1419-
- React-utils
1420-
- ReactCodegen
1421-
- ReactCommon/turbomodule/core
1422-
- ReactNativeDependencies
1423-
- Yoga
14241376
- react-native-safe-area-context (5.10.1):
14251377
- hermes-engine
14261378
- RCTRequired
@@ -1997,7 +1949,6 @@ DEPENDENCIES:
19971949
- glog (from `build/rndeps-facades/glog`)
19981950
- hermes-engine (from `../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
19991951
- NitroModules (from `../../node_modules/react-native-nitro-modules`)
2000-
- QuickCrypto (from `../../node_modules/react-native-quick-crypto`)
20011952
- RCT-Folly (from `build/rndeps-facades/RCT-Folly`)
20021953
- RCTDeprecation (from `build/rncore-facades/RCTDeprecation`)
20031954
- RCTRequired (from `build/rncore-facades/RCTRequired`)
@@ -2039,7 +1990,6 @@ DEPENDENCIES:
20391990
- React-Mapbuffer (from `../../node_modules/react-native/ReactCommon`)
20401991
- React-microtasksnativemodule (from `../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)
20411992
- React-mutationobservernativemodule (from `../../node_modules/react-native/ReactCommon/react/nativemodule/mutationobserver`)
2042-
- react-native-quick-base64 (from `../../node_modules/react-native-quick-base64`)
20431993
- react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`)
20441994
- React-NativeModulesApple (from `../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
20451995
- React-networking (from `../../node_modules/react-native/ReactCommon/react/networking`)
@@ -2103,8 +2053,6 @@ EXTERNAL SOURCES:
21032053
:tag: hermes-v260318099.0.2
21042054
NitroModules:
21052055
:path: "../../node_modules/react-native-nitro-modules"
2106-
QuickCrypto:
2107-
:path: "../../node_modules/react-native-quick-crypto"
21082056
RCT-Folly:
21092057
:path: build/rndeps-facades/RCT-Folly
21102058
RCTDeprecation:
@@ -2185,8 +2133,6 @@ EXTERNAL SOURCES:
21852133
:path: "../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks"
21862134
React-mutationobservernativemodule:
21872135
:path: "../../node_modules/react-native/ReactCommon/react/nativemodule/mutationobserver"
2188-
react-native-quick-base64:
2189-
:path: "../../node_modules/react-native-quick-base64"
21902136
react-native-safe-area-context:
21912137
:path: "../../node_modules/react-native-safe-area-context"
21922138
React-NativeModulesApple:
@@ -2285,7 +2231,6 @@ SPEC CHECKSUMS:
22852231
glog: 3cf7cb46f743c4bc758ae3e6d9c15bd1b4cfd6d4
22862232
hermes-engine: 6a00d96909f1648698fe5419972fe3c9e628755e
22872233
NitroModules: 92c2f230ec822ce8be72c8330fe292cdcf24e3a4
2288-
QuickCrypto: 3e6ba9b95e4e6ddf3a5e01290b96d22ada38d3cf
22892234
RCT-Folly: 82921e585c0400eda46fac1068297aa9dfb035e4
22902235
RCTDeprecation: e134f2a2c096a6450f5fcbbe949531f913a2ff04
22912236
RCTRequired: f1a68295837ee8f91e112ed1b5694d12e7ff1784
@@ -2326,7 +2271,6 @@ SPEC CHECKSUMS:
23262271
React-Mapbuffer: cf4026a5c35cd3598b648ce6f3ac6e8bfae12ad5
23272272
React-microtasksnativemodule: 3c7c5f3624403317fe91b4ddefa86b60023552a8
23282273
React-mutationobservernativemodule: 7284a91b3c7d7fb85b5d4ac04f7f8da811b22977
2329-
react-native-quick-base64: f93ca829b2c94cc5b3a175533af49f934a4697e7
23302274
react-native-safe-area-context: 7b143af09becaf26ba247b9a82d355f91b77b9b0
23312275
React-NativeModulesApple: 52f3def085f129de1307e3eb78e26729ff70f421
23322276
React-networking: e97a095de90a95bf811b887e2dfdb225f20fd493

‎example/macos/babel.config.js‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
const path = require('path')
22
const createExampleBabelConfig = require('../babel.config.shared')
33

4-
module.exports = createExampleBabelConfig(path.resolve(__dirname, '..'), {
5-
// react-native-quick-base64 does not have a macOS native implementation.
6-
// Use the portable Buffer package instead of the mobile crypto polyfill.
7-
buffer: false,
8-
crypto: false,
9-
})
4+
module.exports = createExampleBabelConfig(path.resolve(__dirname, '..'))

‎example/package.json‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"test:harness:ios": "react-native-harness --harnessRunner ios"
2323
},
2424
"dependencies": {
25-
"@craftzdog/react-native-buffer": "^6.1.2",
2625
"@react-native-clipboard/clipboard": "^1.16.3",
2726
"@react-navigation/native": "^7.5.1",
2827
"@react-navigation/native-stack": "^7.21.0",
28+
"buffer": "^6.0.3",
2929
"chai": "^4.3.7",
3030
"chance": "^1.1.9",
3131
"events": "^3.3.0",
@@ -35,8 +35,6 @@
3535
"react-native-nitro-modules": "*",
3636
"react-native-nitro-sqlite": "10.2.0",
3737
"react-native-nitro-sqlite-vec": "10.2.0",
38-
"react-native-quick-base64": "^3.0.1",
39-
"react-native-quick-crypto": "^1.1.8",
4038
"react-native-safe-area-context": "^5.10.1",
4139
"react-native-screens": "^4.30.0",
4240
"reflect-metadata": "^0.2.2",

‎example/src/initGlobals.ts‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
import { Buffer as CraftzdogBuffer } from '@craftzdog/react-native-buffer'
2-
import {
3-
install as installQuickCrypto,
4-
Buffer as QuickCryptoBuffer,
5-
} from 'react-native-quick-crypto'
6-
7-
declare global {
8-
// eslint-disable-next-line no-var
9-
var Buffer: typeof CraftzdogBuffer | typeof QuickCryptoBuffer
10-
}
1+
import { Buffer } from 'buffer'
112

123
if (!globalThis.process) {
134
// @ts-expect-error - if process is not defined, we need to set it to an empty object
145
globalThis.process = {}
156
}
167

17-
globalThis.Buffer = QuickCryptoBuffer
8+
globalThis.Buffer = Buffer
189
globalThis.process.cwd = () => 'sxsx'
1910
globalThis.process.env = { NODE_ENV: 'production' }
20-
21-
installQuickCrypto()

0 commit comments

Comments
 (0)