Realm-js: N-API (and Node 12) support

Created on 10 Sep 2019  Â·  10Comments  Â·  Source: realm/realm-js

This task can be split basically by file. The re-implementation consists of going over every node_xxx file in the src directory and rewriting it to use Napi. Here is a list of all files that should be visited

  • [x] js_adapter.hpp
  • [x] js_global_notifier.hpp
  • [x] node_class.hpp
  • [x] node_context.hpp
  • [x] node_dummy.cpp
  • [x] node_exception.hpp
  • [x] node_function.hpp
  • [x] node_init.cpp
  • [x] node_init.hpp
  • [x] node_napi_convert.hpp
  • [x] node_object.hpp
  • [x] node_protected.hpp
  • [x] node_return_value.hpp
  • [x] node_string.hpp
  • [x] node_types.hpp
  • [x] node_value.hpp
  • [x] platform.cpp
  • [x] sync_logger.cpp
  • [x] sync_logger.hpp
  • [x] Visit implementation and add EscapableHandleScopes where needed (more than one napi value created)
  • [x] Handle and remove all //NAPI: comments
  • [x] Remove all nan.h, v8.h references
  • [x] Tidy up implementation (if needed)
  • [x] Test for node 12 issues
  • [x] Make CI work (jenkins, docker)
  • [x] Minimal Benchmark ( run adapter benchmark)
  • [ ] RN class syntax support changes 

These tasks can change over the course of the reimplementation.

T-Feature

Most helpful comment

Since we are in the testing/stabilization phase its better to add this list to better keep track of the progress

  • [x] list-tests.js
  • [x] results-tests.js
  • [x] object-tests.js
  • [x] realm-tests.js
  • [x] user-tests.js
  • [x] query-tests.js
  • [x] permission-tests.js
  • [x] encryption-tests.js
  • [x] migration-tests.js
  • [x] object-id-tests.js
  • [x] open-behavior-tests.js
  • [x] session-tests.js
  • [x] subscription-tests.js
  • [x] async-tests.js
  • [x] linkingobjects-tests.js

All 10 comments

Since we are in the testing/stabilization phase its better to add this list to better keep track of the progress

  • [x] list-tests.js
  • [x] results-tests.js
  • [x] object-tests.js
  • [x] realm-tests.js
  • [x] user-tests.js
  • [x] query-tests.js
  • [x] permission-tests.js
  • [x] encryption-tests.js
  • [x] migration-tests.js
  • [x] object-id-tests.js
  • [x] open-behavior-tests.js
  • [x] session-tests.js
  • [x] subscription-tests.js
  • [x] async-tests.js
  • [x] linkingobjects-tests.js

Hey, is there a way to build this not finished version on my own?

We are building our app from the ground up and using newest Electron, that has Node version 12.

We would like to use Realm JS now, even not stable as it will take ~6 months to finish our app and release. And I guess in this time there will be some version of Realm supporting Node 12.

  1. Which branch should I use if I want to build Realm version for Node 12?
  2. Does it have same set of JS apis as 4.0.0-beta? (I can see that code is not merged between 4.0.0 and NAPI branch)

@bimusiek It's not ready for consumption but we are really close to an alpha version. I would suggest just wait a bit until we release it as opposed to wasting time and effort trying to compile it from here.

@blagoev Ok, thanks for the info.

For now we have downgraded Electron from version 7 to version 4 and successfully compiled realm for electron. Thanks to this, we have one implementation for both Electron and React Native in one source code.

Is there any update on that? Is there any alpha or even pre-alpha version we could try?

We have an Electron app in production working great with Realm. But because of this issue we have not been able to update our product anymore for months and that puts us in an increasingly problematic situation.

We want to at least start migrating to the latest Electron version. For that we would only need some version of Realm that would work with Electron 7 or 8 independent how stable it is.

Yes, the latest pre-release versions seem to work fine with Node v12, at least right now.

@wash try v3.7.0-alpha releases, see https://github.com/realm/realm-js/releases

@Dids and @xmedeko Thanks so much! I missed that this alpha included the napi branch.

Any news about Hermes support since this issue was closed?

Hi @ouabing – We're still looking at Hermes support for the future. While we don't have a specific date planned at this time we're watching Hermes develop and continually discussing when the right time for us to support is. I'd recommend tracking #2455 for updates.

Was this page helpful?
0 / 5 - 0 ratings