Skip to content

fix: support Node 12 / Electron 5 #36

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

Merged
merged 1 commit into from
Apr 18, 2019

Conversation

jacobq
Copy link
Contributor

@jacobq jacobq commented Apr 8, 2019

Ref: #17 (comment)

Replace v8::Handle with v8::Local
This should not affect behavior in any way since Handle was an alias for Local.

From v8docs.nodesource.com:

#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
// Handle is an alias for Local for historical reasons.
template <class T>
using Handle = Local<T>;
#endif

See also:

Replace `v8::Handle` with `v8::Local`
This should not affect behavior in any way since `Handle` was an alias for `Local`.

From `https://v8docs.nodesource.com/node-10.6/d4/da0/v8_8h_source.html#l00342`:
```
  340 // Handle is an alias for Local for historical reasons.
  341 template <class T>
  342 using Handle = Local<T>;
  343 #endif
```

See also:

* https://electronjs.org/blog/nodejs-native-addons-and-electron-5
* https://codereview.chromium.org/1224623004
* https://v8docs.nodesource.com/node-10.6/d2/dc3/namespacev8.html#a569580ff6260b59779fb214d5a1448fd
@jduncanator
Copy link
Owner

jduncanator commented Apr 9, 2019

Thanks for the PR!

It looks like recent versions of V8 have Handle defined as an alias for Local, but this wasn't always the case.

diskusage has a "soft" compatibility target of supporting back to Node 0.10 (due to some internal projects that I maintain stuck on that version of Node.js for legacy reasons). It looks like back then, Handle was not an alias (however Local was derived from Handle so should be fine).

I'll do some testing internally to ensure we maintain backwards compatibility with Node 0.10. We may need to include some additional logic to switch between Handle and Local depending on Node version if we run into issues.

As an aside, I thought this was precisely the thing NAN was intended to prevent. Either I'm using NAN incorrectly, or it doesn't really seem that NAN is meeting it's goals... 🤷‍♂️

@jduncanator jduncanator self-assigned this Apr 9, 2019
@jacobq
Copy link
Contributor Author

jacobq commented Apr 9, 2019

As an aside, I thought this was precisely the thing NAN was intended to prevent. Either I'm using NAN incorrectly, or it doesn't really seem that NAN is meeting it's goals... 🤷‍♂️

I hear ya, but I think NAN mainly aims to meet that goal for non end-of-life versions of Node. More recently, N-API has come onto the scene aiming to do a better job solving this problem.

@jduncanator
Copy link
Owner

Tested on Node v0.10, still working. Merging, thanks!

@jduncanator jduncanator merged commit aedecd8 into jduncanator:master Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants