Skip to content

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Mar 17, 2025

(context: found while investigating nuxt-hub/core#499)

Current ReadStream/WriteStream polyfill implementations used for process.std{in,out,err} polyfills are extending node:net wrongly.

This causes not only extra bundle impact when not used (in pure polyfill mode) but also is the wrong extension as tty is not a network socket and also internal cycling dependencies.

Also process.std{out,err}.write was completely nonfunctional.

I have implemented both as partial types with WriteStream.write redirect to real console as polyfill.

I don't expect any libraries in compat mode to expect more tty methods but we can later explicitly implement/mock them if needed. Alternatively, overlay presets can check implementation.

@pi0 pi0 merged commit 47916e6 into main Mar 17, 2025
2 checks passed
@pi0 pi0 deleted the refactor/tty-streams branch March 17, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant