Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to N-API #2

Closed
wants to merge 13 commits into from
Closed

Migrate to N-API #2

wants to merge 13 commits into from

Conversation

mauricioszabo
Copy link

So, for everyone wanting to help on this migration:

  1. We have to uncomment everything that's on here: master...pulsar-edit:superstring:napi#diff-0d6aa7470314ca774fd7e07f67b35ecd3045fe5cb3a0e5c99f48bae897905d32

  2. It helps quite a lot to have a LSP server running. The LSP I know that works with it uses Clang, and it expects a compile_commands.json on the root of the code. To generate this just run npm install then run:

node-gyp -- configure -f=compile_commands_json

This will generate both Debug/compile_commands.json and Release/compile_commands.json. Just select one and move to the root, like mv Release/compile_commands.json .

  1. Some tricks to help the migration: in the Nan code, constructors of ...Wrapped classes can receive arbitrary data. This basically do not work with Napi, so we need to generate a Napi::External<arbitrary-data> and pass this to the contructor. There's an example on PointWrapper class: master...pulsar-edit:superstring:napi#diff-ca393bd63cb0ed098a1eee4542120db434961ff60b65c22b2476c15eb954451aR52-R54

Other trick is that Nan have lots of Unwrap() and Wrap(). These are not necessary on Napi (Napi is saner in this sense)

  1. Some APIs return nop. This is No-op, so I don't see any reason to keep them. I'm removing it completely, just so people know :)

@mauricioszabo
Copy link
Author

Replaced by #5, that is a more complete version

@mauricioszabo mauricioszabo deleted the napi branch October 18, 2023 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant