-
Notifications
You must be signed in to change notification settings - Fork 465
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
adds experimental napi_date #497
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.
Hi @mathiask88,
good work, thanks for adding this new API. There are some tasks to address. Hope to hear you very soon.
I added some docs, but the current doc structure and naming is not fully consistent. I tried to stay file scope consistent. |
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.
Some little comment about the documentation.
On other through, the doc sections should probably indicate that the Date related parts are experimental. |
@mhdawson True, I thought about it, but didn't add anything because BigInt isn't explicitly indicated as experimental. I'll add it and open another PR for all the mentioned doc stuff. Why was Date as a basic JavaScript object even added that late to N-API? And is it experimental because every new stuff starts as experimental? Just curious. |
@mathiask88, new functions are added to N-API as experimental. This allows us to properly managed what is in each N-API version and confirm that the new functions don't have fundamental usage issues before we can no longer change them. N-API does not cover all of the JavaScript spec, instead we drove the APIs based on what we saw being used in the most used modules. So it's just most likely that Date was not in the set that we'd looked at. As I wrote my comment I was thinking that we probably were not good about marking things as experimental before but I still think its a good idea going forward. Just to say that I understand why it would not have been evident that it was something to do. |
@mathiask88, also wanted to say thanks for being so understanding. We still have some work to go in getting the module to be consistent and to iorn out how we handle experimental/new functions. |
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.
It's ok for me just one last little task. Good work @mathiask88 .
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
@mhdawson Thanks, but there is still an open question #497 (comment) |
@mathiask88 good point, I've commented above that I'm ok with valueOf instead. |
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
Shouldn't it be |
@gabrielschulhof yes you're right. @mathiask88 could you change the method name like repoter by @gabrielschulhof ? |
@gabrielschulhof @NickNaso Oh, sure. I was in JavaScript lower camel case land :) |
😂 I know the feeling. |
Hi everyone, |
@NickNaso I'll start the CI. |
@gabrielschulhof It's ok so it could be a good idea mark this PR with |
@NickNaso SGTM 👍 |
Any news on this? How long does it usually take until a backport lands? I would like to see this basic functionality implemented in node/napi. |
@mathiask88 V8 is in maintenance so updates are not frequent. @gabrielschulhof with the proper version checks this could probably be landed but only be enable version N-API version >5 right? What we'd want to avoid in that case is it 8.x supporting V 5 before 10.x does. |
@mathiask88 coud you update to add the N-API version checks so that the functionality is only enabled if N-API is set to version 5 or greater? |
That is what I had in mind. Leaving that line makes sense as well. CI run on V8.x https://ci.nodejs.org/view/x%20-%20Abi%20stable%20module%20API/job/node-test-node-addon-api-new/549/ CI run on V10.x https://ci.nodejs.org/view/x%20-%20Abi%20stable%20module%20API/job/node-test-node-addon-api-new/550/ CI run on 12.x - https://ci.nodejs.org/view/x%20-%20Abi%20stable%20module%20API/job/node-test-node-addon-api-new/551/ CI run on master (13.x) - https://ci.nodejs.org/view/x%20-%20Abi%20stable%20module%20API/job/node-test-node-addon-api-new/552/ |
I'm confused because it looks like from the CI output the data tests are running on 10 and 12 which I don't expect. |
Locally I have node 12.10.0 + WIN10 and following tests are running npm test
npm test --NAPI_VERSION=4
npm test --NAPI_VERSION=5 Does obviously not compile Is |
The CI uses the process.versions to set the --NAPI_VERSION to the one reported by the version of Node.js being tested. |
From the CI job, this is how it gets and sets it. echo 'console.log(process.versions.napi)' >get_napi_version.js
NAPI_VERSION_REPORTED=`node get_napi_version.js`
npm test --NAPI_VERSION=$NAPI_VERSION_REPORTED So it should be being set appropriately for the Node.js version. When I looked it was still 4 for 10.x which is why I was confused that it ran in https://ci.nodejs.org/view/x%20-%20Abi%20stable%20module%20API/job/node-test-node-addon-api-new/nodes=rhel72-s390x/550/console |
@mathiask88 good catch , that explains why they are running. We should leave it that way as it's good to run the tests if we can. The CI has
|
CI looks good to me. |
PR-URL: #497 Reviewed-By: NickNaso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Landed as 6192e70. Thanks @mathiask88 |
Thank you! |
PR-URL: nodejs/node-addon-api#497 Reviewed-By: NickNaso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: nodejs/node-addon-api#497 Reviewed-By: NickNaso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: nodejs/node-addon-api#497 Reviewed-By: NickNaso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: nodejs/node-addon-api#497 Reviewed-By: NickNaso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
I tried to add the experimental date stuff. I'll add the docs if the rest is correct.