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

N-API support for node-serialport #1186

Open
mhdawson opened this issue Jun 6, 2017 · 22 comments

Comments

4 participants
@mhdawson
Copy link

commented Jun 6, 2017

The recently announced Node 8 has a new experimental feature called N-API which is aimed at reducing maintenance cost for node native addons. Checkout this blog for more details on its benefits.

node-serialport is one of the top 30 native modules by download dependency count, and in order to help the Node.js community make the important transition to N-API, we are hoping you will be able to work with us in order to port X to support N-API. Your support and feedback is important in making this effort a success.

I am part of the N-API working group and and would like to talk to you about how you can can get started with N-API and what help we might be able to provide. I'm available to talk on the phone individually if you'd like. Alternatively, if you prefer, feel free to jump in our WG meeting which happens every Thursday at 1.30 Eastern / 10.30 Pacific US time, to discuss any issues.

Here’s a video of N-API in action
https://www.youtube.com/watch?v=nmXhJ88nZsk

@reconbot

This comment has been minimized.

Copy link
Member

commented Jun 7, 2017

This is great. Once it supports LTS nodes this will make life a lot easier for a lot of people.

@hanfengcan

This comment has been minimized.

Copy link

commented Jun 7, 2017

great !

@mhdawson

This comment has been minimized.

Copy link
Author

commented Jun 7, 2017

@reconbot can we set up a time to have a quick chat ?

@reconbot

This comment has been minimized.

Copy link
Member

commented Jun 20, 2017

hit me up via email @mhdawson

@mhdawson

This comment has been minimized.

Copy link
Author

commented Jun 22, 2017

sent to your wizard email listed in github profile.

@mhdawson

This comment has been minimized.

Copy link
Author

commented Jun 28, 2017

This is my understanding of our conversation today:

We talked today about Node Serial port. Francis is happy to have a branch in the repo and help maintain once there is a port.

Francis sees definite benefits in that today the npm needs to support downloading because there has to be a different binary for every version of Node.js and the sum of those are too big to bundle into an npm. With a single binary bundling would be possible.

The plan is for me to take a first cut at porting, Francis is available to support us by answering questions etc. Once we have an initial cut we'll get back together to get it into a branch in the repo and figure out the plan going forward.

@reconbot

This comment has been minimized.

Copy link
Member

commented Jul 9, 2017

Now is the time to go head with what's in master I think 5.0.0-beta6 will probably be the last beta. =)

@mhdawson

This comment has been minimized.

Copy link
Author

commented Jul 21, 2017

Starting to work on the port here https://github.com/mhdawson/node-serialport/tree/n-api. Have just started so have only done a small part of the conversion so far.

@mhdawson

This comment has been minimized.

Copy link
Author

commented Jul 21, 2017

One note is that I saw a few tests failing before I started, notably those that required changing the baud rate. I commented those out and other than those 3-4 all were passing using a connected arduino and linux. I figure as long as the same tests pass after the N-API port that will be a good starting point.

@reconbot

This comment has been minimized.

Copy link
Member

commented Jul 22, 2017

Looks good so far =)

@reconbot reconbot referenced this issue Jul 29, 2017

Open

Roadmap #1264

@joegoggins

This comment has been minimized.

Copy link

commented Nov 1, 2017

👍 !

We (at Particle) are really excited about the prospect of simplifying and improving reliability of node-serialport installations across the various platforms our particle-cli npm module is designed to run on. This has been a big pain point for our community. Am I correct in thinking that this work will help on this front?

I'm assuming the answer is yes. If not, would be curious to know where I got the wrong assumption.

We'll be watching progress of N-API and this issue, thanks for taking this on, please don't hesitate to reach out to me or @monkbroc if there is potential technical work we could do to help with this.

@reconbot

This comment has been minimized.

Copy link
Member

commented Nov 1, 2017

This will help for sure. I switched us to prebuild with the last major bump which also seems to have helped installation and provides us with a lot more prebuilt binaries than we had before. (Over 50!) The N-API (currently only supported in node 8+) when stabilized and backported will allow us to have a single binary per platform for all or most versions of node.

Another side effect of prebuild is much smaller binaries, it's now feasible to package them with serialport and not worry about downloading anything. I'll be pushing for "binding packages" so the core serialport module doesn't rely on c++ itself and instead relies on installing the right binding package, those could include all necessary packages for a platform.

All this is neither here nor there if n-api takes over.

@mhdawson

This comment has been minimized.

Copy link
Author

commented Nov 3, 2017

I've not made as much progress as I'd like on this (just lack of time, its been a busy last few months for me), @joegoggins if you would like to collaborate on the port lets touch base and discuss how we do that.

@joegoggins

This comment has been minimized.

Copy link

commented Nov 17, 2017

Hey there @mhdawson thank you kindly for reaching out to collaborate. Despite our keen interest in seeing this project move forward, we are actually in the same boat--we don't have extra engineering muscle to throw down on this right now. Additionally, in grok-ing the commits you introduced in your n-api serialport fork, I don't know if we have anyone here that would be able to contribute quickly and productively to this project.

All of that ^^ could change though; so please reach out the next time you dig deep into this or want someone to alpha test your fork. In the meantime, let's hope someone else on the interwebs steps up with the resources to you help push this forward.

Cheers 🍻 !

@mhdawson

This comment has been minimized.

Copy link
Author

commented Nov 17, 2017

@joegoggins thanks for the response. I do hope to get back to this soon and I'll keep this issue up to date so you can see where it is at if there are changes on your side.

@reconbot

This comment has been minimized.

Copy link
Member

commented Aug 29, 2018

Hey everyone, what's the status of this?

@reconbot

This comment has been minimized.

Copy link
Member

commented Aug 29, 2018

And does this prebuild issues effect it at all? prebuild/prebuild#220

@mhdawson

This comment has been minimized.

Copy link
Author

commented Aug 29, 2018

Unfortunately, I never squeezed in time push it forward. If node-serialport uses prebuild then that discussion/PR will help when it comes time to build binaries for N-API versions.

@reconbot

This comment has been minimized.

Copy link
Member

commented Aug 29, 2018

@reconbot

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

So node 6 is EOL Today 🎉

I had a call with the N-API working group yesterday where they guided my hand a bit. The biggest takeaway is that I can't use node's libuv, as that's not ABI stable. (or it isn't guaranteed but is stable and maybe we can't rely on that?) I love libuv but as far as I know there's not much I can do, other than move away from it. The steps as I see it;

  • We can consider node-addon-api vs the c function calls.
  • We can replace all use of uv_work_t with napi_async_work
  • We have to rewrite serialport not use use uv_poll_t on Darwin and Linux
  • We can keep prebuild which we use for publishing and downloading the binaries is already N-API aware, so we need to tell it we are now N-API compatible.
@reconbot

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

@reconbot

This comment has been minimized.

Copy link
Member

commented May 8, 2019

Which now says we can probably rely on uv_poll_t remaining abi stable with v2 =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.