Repository navigation
feat(jsi): add standalone @nativescript/ios-jsi and @nativescript/android-jsi packages - #76
NathanWalker wants to merge 6 commits into
Conversation
…roid-jsi packages
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
… without CocoaPods
|
Hello Nathan, i like the enthusiasm here but I believe these should be in a separate repo, not part of the runtimes repo at all. Runtimes are strictly just Nativescript Even if you still wanted, this should have landed in the v8 runtime repo because it's v8 only AFAIK which is something I am against too. Keep this in a separate repo outside v8 or the runtimes repo. |
|
Do you feel https://github.com/NativeScript/plugins or https://github.com/NativeScript/ui-kit is better place? |
|
@NathanWalker This repo is the wrong home for it. jsi::Runtime is React Native's abstraction. This repo is the NativeScript runtimes. If you want this to exist, put it in its own repo and depend on a published runtime version. Then you can move as fast as you like without the runtime holding you back, or the other way round. |
|
@ammarahm-ed JSI is already part of this repo (the Hermes backend in ffi/hermes/jsi, packages/react-native, and your nativescript::engine layer on android-react-native from #69). The main reason to keep these here is that V8Runtime has to match the runtime's exact V8 version, so keeping them next to the runtime means they ship in sync. In a separate repo we'd need a version matrix and CI just to stop them drifting apart. Android is the exception for now, since main doesn't build an Android runtime yet and android-jsi links against the published @nativescript/android. That gets sorted once #69 lands. I'll clean this up so it builds against the runtime's own V8 headers instead of shipping a copy, and pin it to a runtime version. Longer term I'd like it to work across engines so it isn't V8-only. Hermes is basically free since the runtime already holds a jsi::Runtime, and the rest could sit on top of your engine layer once it's on main. Wrote up how here: https://github.com/NativeScript/runtimes/blob/73bbeadeba16d5a5b4e72ae39134d3af7c7d5374/docs/jsi-multi-engine.md Would that work for you? |
|
I still think this shouldn't live here. JSI shows up in this repo only where something hands us a jsi::Runtime: Hermes is a JSI runtime, and React Native gives us its own. We use it. This PR is different. It builds a JSI runtime for V8 and offers it as a public API for outside libraries. That's a new commitment, and it's one this repo would have to keep working through every engine upgrade. Keep this in its own repo, pinned to a published runtime version. If it needs something from the runtime, like a supported way to get the isolate, or the jsi::Runtime Hermes already has, open an issue for that hook and we'll add it properly. We can revisit multi-engine once the engine layer has landed and settled, and once we've decided we want this. @DjDeveloperr can comment on this too but It's a hard no for me. |
|
Fair enough, @ammarahm-ed. Using a jsi::Runtime is different from providing one, and I agree a public V8 JSI implementation shouldn't become something this repo has to support. I'll move it to its own repo (probably on it's own NativeScript/jsi) and pin it to a published runtime version. For that to work without drifting from V8, I'll open issues for a few small hooks later:
I'll close this PR once the new repo is up. Multi-engine can wait until the engine layer has landed and settled. |
Summary
Extracts
facebook::jsiandrnv8::V8Runtimeinto two standalone, opt-in packages so the core@nativescript/iosand@nativescript/androidruntime binaries remain completely free of JSI bloat:@nativescript/ios-jsi(packages/ios-jsi):Package.swift) wired vianativescript.config.ts(SPMPackages) with zero CocoaPods required.facebook::jsiandrnv8::V8Runtimefor iOS.NativeScriptJSIRuntime(),tns::GetJSIRuntime(), and Objective-C/SwiftJSIRuntime.runtime()/JSIRuntime.runtimePointer()keyed perv8::Isolate::GetCurrent()(supporting both main thread and Worker isolates) without depending on internal NativeScript runtime headers.@nativescript/android-jsi(packages/android-jsi):facebook::jsiandrnv8::V8Runtime(libnativescript-jsi.so) for Android.libNativeScript.soruntime in the process and keysstd::shared_ptr<facebook::jsi::Runtime>perv8::Isolate::GetCurrent().NativeScriptJSIRuntime(),tns::GetJSIRuntime(), andorg.nativescript.jsi.JSIRuntimeJNI helpers.