Skip to content

Commit c02fcda

Browse files
chrispaderclaude
andcommitted
feat!: migrate to Nitro V1
Rewrite the Nitro specs as decorated classes, regenerate the bindings, and port the C++ hybrid objects to V1's value-type Promise, ArrayBuffer and Callback APIs. JavaScript imports the hybrid classes from the specs, which re-export the runtime modules that nitrogen generates under #nitro/*. Nitro V1 doesn't support CocoaPods, so the iOS, macOS and native lockfile jobs are paused. The Nitro 0.37 patch moves into the macOS example because the root install can't apply it to Nitro V1. BREAKING CHANGE: Requires React Native 0.88 and Nitro V1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3a5ae3f commit c02fcda

93 files changed

Lines changed: 1507 additions & 1358 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ jobs:
149149
lockfiles:
150150
name: Native lockfiles
151151
needs: checks
152+
# Paused because Nitro V1 doesn't support CocoaPods. Remove `false &&` to resume it.
152153
if: >-
154+
false &&
153155
github.event_name != 'push' && !github.event.pull_request.draft &&
154156
(needs.checks.outputs.ios_pods == 'true' || needs.checks.outputs.macos_pods == 'true')
155157
uses: ./.github/workflows/update-lockfiles.yml
@@ -173,7 +175,10 @@ jobs:
173175
ios:
174176
name: iOS
175177
needs: [checks, lockfiles]
178+
# Paused because Nitro V1 builds iOS with Swift Package Manager, which this workflow doesn't set up yet.
179+
# Remove `false &&` to resume it.
176180
if: >-
181+
false &&
177182
!cancelled() && needs.checks.result == 'success' &&
178183
(needs.lockfiles.result == 'success' || needs.lockfiles.result == 'skipped') &&
179184
github.event_name != 'push' && !github.event.pull_request.draft &&
@@ -185,7 +190,9 @@ jobs:
185190
macos:
186191
name: macOS
187192
needs: [checks, lockfiles]
193+
# Paused until Nitro V1 supports React Native macOS. Remove `false &&` to resume it.
188194
if: >-
195+
false &&
189196
!cancelled() && needs.checks.result == 'success' &&
190197
(needs.lockfiles.result == 'success' || needs.lockfiles.result == 'skipped') &&
191198
github.event_name != 'push' && !github.event.pull_request.draft &&

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,18 @@ jobs:
9494
bun run sync:lockfile
9595
bun run check:lockfile
9696
bun install --frozen-lockfile
97+
# The CocoaPods steps are paused because Nitro V1 doesn't support CocoaPods.
9798
- uses: ruby/setup-ruby@v1
99+
if: false
98100
with:
99101
ruby-version: 3.3.0
100102
bundler-cache: true
101103
working-directory: example
102104
- name: Select Xcode
105+
if: false
103106
run: sudo xcode-select -s "/Applications/Xcode_26.5.app/Contents/Developer"
104107
- name: Update iOS and macOS lockfiles
108+
if: false
105109
run: |
106110
bun example pods
107111
bun example pods:macos

‎bun.lock‎

Lines changed: 43 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/scripts/check-api.mjs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ const requiredMembers = {
6868
'executeAsync',
6969
'executeBatch',
7070
'executeBatchAsync',
71-
'close',
72-
'drop',
73-
'attach',
74-
'detach',
75-
'loadFile',
76-
'loadFileAsync',
7771
],
7872
NitroSQLiteConnection: [
7973
'close',

‎docs/typedoc-fumadocs.mjs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ class NitroMemberRouter extends MemberRouter {
117117
}
118118

119119
function isHybridObject(reflection) {
120+
// Nitro V1 exports the HybridObject base class through a NativeHybridObject constant.
120121
return reflection.extendedTypes?.some(
121-
(type) => type.type === 'reference' && type.name === 'HybridObject',
122+
(type) =>
123+
type.type === 'reference' &&
124+
['HybridObject', 'NativeHybridObject'].includes(type.name),
122125
)
123126
}
124127

patches/react-native-nitro-modules+0.37.1.patch renamed to example/macos/patches/react-native-nitro-modules+0.37.1.patch

File renamed without changes.

‎example/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"expo-status-bar": "^1.12.1",
3333
"react": "19.3.1",
3434
"react-native": "0.88.0",
35-
"react-native-nitro-modules": "*",
35+
"react-native-nitro-modules": "1.0.0-alpha.nightly.86.g15e19db42041",
3636
"react-native-nitro-sqlite": "10.2.0",
3737
"react-native-nitro-sqlite-vec": "10.2.0",
3838
"react-native-safe-area-context": "^5.10.1",

‎example/tests/unit/specs/operations/execute.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { createArrayBufferTestDb, testDb } from '@tests/db'
44
import { open } from 'react-native-nitro-sqlite'
55
import { buildJSQueryResult } from '@nitro-sqlite/operations/execute'
66
import type { ColumnType } from 'react-native-nitro-sqlite'
7-
import type { NitroSQLiteQueryResult } from '@nitro-sqlite/specs/NitroSQLiteQueryResult.nitro'
7+
import type { NitroSQLiteQueryResult } from '@nitro-sqlite/specs/NitroSQLiteQueryResult'
88

99
const QUERY_RESULT_SIZES = [60, 1_000, 10_000]
1010
// Asynchronous reads hand rows to JavaScript in batches of 256; cover the batch edges.

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"patch-package": "^8.0.0",
4242
"react": "19.3.1",
4343
"react-native": "0.88.0",
44-
"react-native-nitro-modules": "0.37.1"
44+
"react-native-nitro-modules": "1.0.0-alpha.nightly.86.g15e19db42041"
4545
},
4646
"devDependencies": {
4747
"@babel/core": "^7.28.5",
@@ -67,7 +67,7 @@
6767
"eslint-plugin-prettier": "^5.5.4",
6868
"jest": "^30.2.0",
6969
"jsonc-parser": "^3.3.1",
70-
"nitrogen": "0.37.1",
70+
"nitrogen": "1.0.0-alpha.nightly.86.g15e19db42041",
7171
"prettier": "^3.6.2",
7272
"typeorm": "1.1.1",
7373
"typescript": "^6.0.3",

‎packages/react-native-nitro-sqlite/android/RNNitroSQLiteAdapter.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "HybridNitroSQLite.hpp"
2-
#include "RNNitroSQLiteOnLoad.hpp"
2+
#include <RNNitroSQLite/private/RNNitroSQLiteOnLoad.hpp>
33
#include <cstdlib>
44
#include <fbjni/fbjni.h>
55
#include <jni.h>
@@ -10,7 +10,7 @@
1010
using namespace margelo::nitro::rnnitrosqlite;
1111

1212
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
13-
return margelo::nitro::rnnitrosqlite::initialize(vm);
13+
return facebook::jni::initialize(vm, [] { margelo::nitro::rnnitrosqlite::registerAllNatives(); });
1414
}
1515

1616
extern "C" JNIEXPORT void JNICALL Java_com_margelo_rnnitrosqlite_DocPathSetter_setDocPathInJNI(JNIEnv* env, jclass clazz, jstring doc_path,

0 commit comments

Comments
 (0)