-
Notifications
You must be signed in to change notification settings - Fork 524
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
bcrypt for Node.js with Node addon api #551
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me. Except for a little typo in exception messages and a build issue in linux
src/bcrypt_node.cc
Outdated
if (info.Length() < 2) { | ||
Nan::ThrowTypeError("2 arguments expected"); | ||
return; | ||
throw Napi::TypeError::New(info.Env(), "3 arguments expected"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 2 args expected ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I think that I’m the code there are some errors. I will change as soon as possible now I’m leaving from Vancouver to Italy and I cannot be very active
binding.gyp
Outdated
}, | ||
"xcode_settings": { | ||
"CLANG_CXX_LIBRARY": "libc++", | ||
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need same settings in linux too.
There is additional cases for windows that needs to be handled
@NickNaso The windows targets fail with nasty errors. Can you have a look ? |
@agathver I have to do others little modifications. Can I add me to the contributors? |
package.json
Outdated
@@ -29,7 +29,7 @@ | |||
"install": "node-pre-gyp install --fallback-to-build" | |||
}, | |||
"dependencies": { | |||
"nan": "2.6.2", | |||
"node-addon-api": "git+https://github.com/nodejs/node-addon-api.git", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not merge this. This is a dependency on a floating master branch and will lead to breaking changes. Please pick a specific version to depend on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right I want only understand where was the real problem if on the code or on ```node-addon-api`` version
Is |
@defunctzombie See this:
In short, this will bring "compile once, run in any node" versions of native addons, which will save dozens of "bcrypt does not work" issues on the release of a new node version. |
Hi @agathver @defunctzombie |
This is a cute goal that I doubt will be achieved; maybe if they never introduce backwards breaking abi changes but with c++ that can be quite hard. In any case, it seems like this is the forward direction nodejs itself is promoting instead of |
Hi @agathver @defunctzombie , |
@NickNaso please feel free to add yourself to the list of contributors. |
src/bcrypt_node.cc
Outdated
Nan::ThrowTypeError("3 arguments expected"); | ||
return; | ||
throw Napi::TypeError::New(info.Env(), "3 arguments expected"); | ||
return info.Env().Undefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these returns needed if you're throwing? I see them throughout, but thought they were unnecessary, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right it's not necessary if exceptions system is enable. I provided to remove all unuseful code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semver is nice but things break. Please pin the version numbers to prevent any accidental breakage ever.
package.json
Outdated
@@ -29,8 +29,9 @@ | |||
"install": "node-pre-gyp install --fallback-to-build" | |||
}, | |||
"dependencies": { | |||
"nan": "2.6.2", | |||
"node-pre-gyp": "0.6.36" | |||
"bindings": "^1.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please pin these dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't understand. Do I need to add nan and node-pre-gyp ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Just remove the caret. "^1.3.0" becomes "1.3.0" and so on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok just done. Can you check?
Hi guys, |
@defunctzombie @ncb000gt Thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM we can iterate further as needed.
Hi guys,
More explanation here: |
bcrypt for Node.js with Node addon api
Hi,
I'm opening the PR to start iterate over the porting of bcrypt to N-API
Closes #513