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

Added support for Node 13 #348

Merged
merged 2 commits into from
Nov 16, 2019
Merged

Added support for Node 13 #348

merged 2 commits into from
Nov 16, 2019

Conversation

giovannicalo
Copy link

As mentioned in #346, this library fails to install with Node 13.0.1, due to compilation errors.
After a quick investigation, the issue seems to be

v8::Local<v8::Value> v8::Object::Get(uint32_t index)

which has already been deprecated for a while and seems to have been removed in favour of

v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context> context, uint32_t index)

in Node 13 / V8 7.8.

This seems to fix the issue.

It's only been tested with Node 12.13.0 and 13.0.1, on Windows.

This might break compatibility with older versions of Node, however the new method was already present (and the old one was already deprecated) in Node 6 / V8 5.1, so it shouldn't be the case.

It might not be the best way to fix it, but works for me.

Copy link
Member

@lgeiger lgeiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

Could you add Node 13 to the list of node versions in travis.yml so we can test this fix on CI?

@lgeiger lgeiger requested a review from reqshark November 3, 2019 01:23
@lgeiger lgeiger changed the base branch from master to 5.x November 3, 2019 20:30
@lgeiger
Copy link
Member

lgeiger commented Nov 5, 2019

Thanks for adding it to travis.yml. I am not familiar with this part of the code and V8 in general, @reqshark @rolftimmermans could you take a quick look?

@rolftimmermans
Copy link
Member

There is also the Nan::Get() helper which might be a safe alternative?

@giovannicalo
Copy link
Author

As I said, there might be better ways to fix it.

I just needed it to work and figured I'd have a look, rather than downgrading Node, so I went with the least possible changes and stopped as soon as it worked.

Otherwise, lately I've been using node-addon-api rather than N-API, NAN or V8.

Anyway, I guess it's between

Local<Object> buf = batch->Get(Nan::GetCurrentContext(), i).ToLocalChecked().As<Object>();

and

Local<Object> buf = Nan::Get(batch, i).ToLocalChecked().As<Object>();

which is shorter and probably more stable, so might indeed be better.

@lgeiger
Copy link
Member

lgeiger commented Nov 16, 2019

@rolftimmermans What do you think, can we merge this, or should we use Nan::Get()?

I am not very familiar with this, but I can do a patch release once this PR is merged.

@rolftimmermans
Copy link
Member

Let’s just merge for now, we can always improve later!

@lgeiger
Copy link
Member

lgeiger commented Nov 16, 2019

Let’s just merge for now, we can always improve later!

👍 @giovannicalo Thanks for the PR. Let's ship it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants