Deno: Add Node.js native module polyfills to std/node

Created on 26 Nov 2019  路  12Comments  路  Source: denoland/deno

Many Node.js native module polyfills are needed in std/node, to support loading npm packages (such that we are able to leverage some of the tools while Deno specific versions are not available yet).

Note some of the modules might not yet have a corresponding Deno API available. In that case, adding a new native binding for Deno or adding a new module in std modules might be reasonable.

3382 is an example how to inject a polyfill for require().

Some of the polyfill tasks can be Good First Issue.

  • [x] buffer
  • [ ] child_process
  • [ ] cluster (maybe low priority?)
  • [ ] crypto
  • [ ] dns
  • [x] events
  • [ ] fs (partially, high priority)
  • [ ] http/https/http2/dgram/net/tls (maybe low priority?)
  • [x] modules
  • [x] os (more bindings needed, #3802)
  • [x] path
  • [x] querystring #4370
  • [ ] readline
  • [ ] repl
  • [ ] stream
  • [ ] tty
  • [ ] url
  • [ ] util (partially)

Most helpful comment

@kevinkassimo #4370 took care of querystring

All 12 comments

I'm working on the 'os' polyfill, though as discussed in #3802 there's a lot of functionality Deno is missing.

@kevinkassimo - That's the 'os' polyfill taken as far as I can, so please mark this as partly completed. Now moving onto 'events'.

@cknight Thanks so much! Marked

@kevinkassimo - That's the 'events' polyfill complete now (#3944, #3960, #4016). I'm going to attempt to pick up fs next, though will progress this in small chunks due to its large size.

@cknight see #4017, will bring us closer to being able to polyfill Node's fs

Nice one @dubiousjim. I've not yet looked at detail into what Deno can offer, but at a glance it looks like your pending PRs will get us a lot closer to a full polyfill.

Is there consensus on if or how much of node's crypto module to reimplement?

It's got a pretty big API surface and openssl-isms leak through in many places but it should be possible to make basic functionality (cipher/decipher/hash/hmac/sign/verify) work for the most common ciphers and hashes using RustCrypto.

currently working on os stuff impl.

@kevinkassimo #4370 took care of querystring

@kevinkassimo i'm diving back into Deno after not working on it for a while (and I've only really contributed to the TypeScript portion). Which of these would be a good first issues?

@acconrad Good for starters would be url or dns
Most useful would be probably crypto(though in my opinion better handler by the API implementation that's in development)

@Soremwar cool! url is massive and feels a bit over my head for the first one. dns seems pretty reasonable as does crypto (though would I also need to build out all of the helper classes like Hash, Sign, and Cipher?) if so I could just start with dns and see how that goes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CruxCv picture CruxCv  路  3Comments

ry picture ry  路  3Comments

zugende picture zugende  路  3Comments

ry picture ry  路  3Comments

justjavac picture justjavac  路  3Comments