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

Native Addon Modules #96

Open
b3nab opened this issue Oct 26, 2021 · 3 comments
Open

Native Addon Modules #96

b3nab opened this issue Oct 26, 2021 · 3 comments

Comments

@b3nab
Copy link

b3nab commented Oct 26, 2021

Hello :)
I have some simple questions regarding the "native addon" for nodejs, in the Readme it's explicitly written that epm will not work with native addons.

  • Why epm cannot support nodejs native addons using pacote?
  • Could it be possible to integrate such a feature into epm?
  • To build a native addon the only required things is node-gyp I think, so could it works?
@pksunkara
Copy link
Owner

pksunkara commented Oct 26, 2021

I am not sure because I haven't tried and I didn't have a need. You can give it a go and see if it works.

@b3nab
Copy link
Author

b3nab commented Oct 27, 2021

Actually I'm building an electron app and my plan is to support extensions to add external functionality and let other developers create some extensions.
Since the app need to run on Windows, Mac and Linux there is a chance that a native module is needed, for example a way to mute and unmute the pc audio. Nodejs doesn't let this through its api and so I need to fallback and use a npm package that needs to be compiled because it was written in C/C++.

So I'm wondering what's the actual implementation? Basically you only use pacote.extract() to recursively unpack all dependencies and nothing else..?

@pksunkara
Copy link
Owner

Yup. I extract the JS files and just load them on the manager when asked.

For a native module, loading should be fine, but we would need to build it first I guess.

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

No branches or pull requests

2 participants