unjs / unenv

🕊️ Convert javaScript code to be runtime agnostic
MIT License
340 stars 18 forks source link

refactor(node): import from `node:` for non extend usages #270

Closed pi0 closed 1 week ago

pi0 commented 2 weeks ago

I have checked recent changes for usage for node modules within polyfills.

With explicit import of node:, we can allow hybrid polyfills.

With explicit relative import, we can allow polyfills extending each other.

This PR unifies to use node: with exception of polyfill classes extending each other -- other than EventEmitter : (constructors like Readable are imported from node:*)

Relative dependencies summary:

fetch => node/http (virtual request)
node/http => node/stream (extends polyfills)
node/net => node/stream (extends polyfills)
node/tls => node/net (extends polyfills)
node/tty => node/net (extends polyfills)
pi0 commented 1 week ago

Merging to iterate