-
Notifications
You must be signed in to change notification settings - Fork 6
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
First working version with code extracted from Node.js 15 #1
Conversation
IMO this should be importable module in the first place and then maybe polyfill. |
Can you explain a bit more? |
index.js is polyfill. Patching builtin objects should not be default. |
I can change that, but purposse of this project has been to create a polyfill since begining, that's the reason of the |
Polyfill for node + implementation for browser. The api is not part of any spec and is node specific. |
It is :-) |
Oh, cool. Thanks! I missed this. |
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.
Polyfill for node + implementation for browser. The api is not part of any spec and is node specific.
Echoing this sentiment. This is a polyfill for Node's implementation. While that is the only implementation currently in the wild, I expect that will change fairly quickly as the WICG work progresses. Specifically:
disableEntropyCache
is unlikely to be part of the spec- If/when type assertions are specified, I would expect them to be
TypeError
s, not the adhoc error classes seen here.
I'm okay moving forward with this but once there's a formal standard, I would assume this module switches to whatever that is (as a breaking change), with Node either leading or following the way on that I guess.
Also, there should be browser tests as well. Maybe take a page out of the uuid
module's approach? (Kind of a nuisance to do, though. @ctavan: thoughts?)
Co-authored-by: Robert Kieffer <robert@broofa.com>
Co-authored-by: Robert Kieffer <robert@broofa.com>
…verage `uuidBuf` will be inmediatly being used at `randomFillSync()`, that will throw a `TypeError` itself since it's `undefined`
Sorry for the delay. I've reviewed and fixed your concerns, and made sure tests pass on both Node.js (down to v12) and JsDOM environments, with almost 100% tests coverage. There's an issue with Thoughts? Comments? |
Any update on this? How can we move it forward? |
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 nit-picky changes here, but nothing critical. Approving to allow this to move forward.
Note: A few things I'd like to see added in the near future, if possible:
- code linting (preferably using
uuid
. I.e. eslint + uuid's.eslintrc.json
) - markdown linting (preferably consistent with
uuid
. I.e. prettier + uuid'sprettier.config.js
) - CI (preferably GH Action)
Co-authored-by: Robert Kieffer <robert@broofa.com>
Co-authored-by: Robert Kieffer <robert@broofa.com>
Co-authored-by: Robert Kieffer <robert@broofa.com>
Added linting fixes based 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.
It looks likeeslint-plugin-import
, eslint-plugin-node
,eslint-plugin-promise
, and prettier
all need to be added as devDependencies
.
(Couldn't get npm test
to work until I installed these.)
Oh, we should probably also go ahead and add
This is mostly relevent for ESM imports, which aren't supported here yet, but there's no harm in being explicit about this now. |
In my machine I've not needed to add them... Ubuntu Mate 20.10 |
Seems to be really interesting :-) |
Do you have them installed globally? |
No, my globals are only these ones:
|
Here's my recipe for recreating the missing modules issue...
etc... |
I think npm v7 is installing missing |
Ok, I've checked it with Node.js v14.16.0 and npm v6.14.11 and I'm seeing the same problem as you, so seems it's the thing about npm 7 installing peerDependencies. I'm going to add the missing dependencies. |
I've added the missing dependencies. |
My apologies for the delay. I've gone ahead and landed this since, as previously noted, I think we're at a place where we can push this out and deal with issues as/how they get reported. I've also taken the following actions (@ctavan, take note):
@piranna: I'll leave it to you to do the |
No worries :-)
Thank you so much! :-D
I've not received any invitation, just only the one for Github org... Maybe there's some missing step? On https://www.npmjs.com/org/uuid it shows nothing too, but I appear in https://www.npmjs.com/package/randomuuid.
What version should I use? |
You are welcome, I'm glad to help here :-) |
I'd go with Edit: |
And... published :-) |
You are welcome :-) |
It also has tests, it's compatible with both Node.js and browser, and have been removed Node.js specific code, but lacks of documentation.